mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
539 files changed
+19929
-46256
No files matched your search
@@ -1,397 +0,0 @@
|
|||||||
/** @type {import('dependency-cruiser').IConfiguration} */
|
|
||||||
module.exports = {
|
|
||||||
forbidden: [
|
|
||||||
{
|
|
||||||
name: "no-circular",
|
|
||||||
severity: "warn",
|
|
||||||
comment:
|
|
||||||
"This dependency is part of a circular relationship. You might want to revise " +
|
|
||||||
"your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
circular: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no-orphans",
|
|
||||||
comment:
|
|
||||||
"This is an orphan module - it's likely not used (anymore?). Either use it or " +
|
|
||||||
"remove it. If it's logical this module is an orphan (i.e. it's a config file), " +
|
|
||||||
"add an exception for it in your dependency-cruiser configuration. By default " +
|
|
||||||
"this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration " +
|
|
||||||
"files (.d.ts), tsconfig.json and some of the babel and webpack configs.",
|
|
||||||
severity: "warn",
|
|
||||||
from: {
|
|
||||||
orphan: true,
|
|
||||||
pathNot: [
|
|
||||||
"(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$", // dot files
|
|
||||||
"[.]d[.]ts$", // TypeScript declaration files
|
|
||||||
"(^|/)tsconfig[.]json$", // TypeScript config
|
|
||||||
"(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$", // other configs
|
|
||||||
],
|
|
||||||
},
|
|
||||||
to: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no-deprecated-core",
|
|
||||||
comment:
|
|
||||||
"A module depends on a node core module that has been deprecated. Find an alternative - these are " +
|
|
||||||
"bound to exist - node doesn't deprecate lightly.",
|
|
||||||
severity: "warn",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
dependencyTypes: ["core"],
|
|
||||||
path: [
|
|
||||||
"^v8/tools/codemap$",
|
|
||||||
"^v8/tools/consarray$",
|
|
||||||
"^v8/tools/csvparser$",
|
|
||||||
"^v8/tools/logreader$",
|
|
||||||
"^v8/tools/profile_view$",
|
|
||||||
"^v8/tools/profile$",
|
|
||||||
"^v8/tools/SourceMap$",
|
|
||||||
"^v8/tools/splaytree$",
|
|
||||||
"^v8/tools/tickprocessor-driver$",
|
|
||||||
"^v8/tools/tickprocessor$",
|
|
||||||
"^node-inspect/lib/_inspect$",
|
|
||||||
"^node-inspect/lib/internal/inspect_client$",
|
|
||||||
"^node-inspect/lib/internal/inspect_repl$",
|
|
||||||
"^async_hooks$",
|
|
||||||
"^punycode$",
|
|
||||||
"^domain$",
|
|
||||||
"^constants$",
|
|
||||||
"^sys$",
|
|
||||||
"^_linklist$",
|
|
||||||
"^_stream_wrap$",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "not-to-deprecated",
|
|
||||||
comment:
|
|
||||||
"This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later " +
|
|
||||||
"version of that module, or find an alternative. Deprecated modules are a security risk.",
|
|
||||||
severity: "warn",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
dependencyTypes: ["deprecated"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no-non-package-json",
|
|
||||||
severity: "error",
|
|
||||||
comment:
|
|
||||||
"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " +
|
|
||||||
"That's problematic as the package either (1) won't be available on live (2 - worse) will be " +
|
|
||||||
"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies " +
|
|
||||||
"in your package.json.",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
dependencyTypes: ["npm-no-pkg", "npm-unknown"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "not-to-unresolvable",
|
|
||||||
comment:
|
|
||||||
"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " +
|
|
||||||
"module: add it to your package.json. In all other cases you likely already know what to do.",
|
|
||||||
severity: "error",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
couldNotResolve: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no-duplicate-dep-types",
|
|
||||||
comment:
|
|
||||||
"Likely this module depends on an external ('npm') package that occurs more than once " +
|
|
||||||
"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " +
|
|
||||||
"maintenance problems later on.",
|
|
||||||
severity: "warn",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
moreThanOneDependencyType: true,
|
|
||||||
// as it's pretty common to have a type import be a type only import
|
|
||||||
// _and_ (e.g.) a devDependency - don't consider type-only dependency
|
|
||||||
// types for this rule
|
|
||||||
dependencyTypesNot: ["type-only"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/* rules you might want to tweak for your specific situation: */
|
|
||||||
|
|
||||||
{
|
|
||||||
name: "not-to-spec",
|
|
||||||
comment:
|
|
||||||
"This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. " +
|
|
||||||
"If there's something in a spec that's of use to other modules, it doesn't have that single " +
|
|
||||||
"responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.",
|
|
||||||
severity: "error",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
path: "[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "not-to-dev-dep",
|
|
||||||
severity: "error",
|
|
||||||
comment:
|
|
||||||
"This module depends on an npm package from the 'devDependencies' section of your " +
|
|
||||||
"package.json. It looks like something that ships to production, though. To prevent problems " +
|
|
||||||
"with npm packages that aren't there on production declare it (only!) in the 'dependencies'" +
|
|
||||||
"section of your package.json. If this module is development only - add it to the " +
|
|
||||||
"from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration",
|
|
||||||
from: {
|
|
||||||
path: "^(src)",
|
|
||||||
pathNot: "[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$",
|
|
||||||
},
|
|
||||||
to: {
|
|
||||||
dependencyTypes: ["npm-dev"],
|
|
||||||
// type only dependencies are not a problem as they don't end up in the
|
|
||||||
// production code or are ignored by the runtime.
|
|
||||||
dependencyTypesNot: ["type-only"],
|
|
||||||
pathNot: ["node_modules/@types/"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "optional-deps-used",
|
|
||||||
severity: "info",
|
|
||||||
comment:
|
|
||||||
"This module depends on an npm package that is declared as an optional dependency " +
|
|
||||||
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
|
|
||||||
"If you're using an optional dependency here by design - add an exception to your" +
|
|
||||||
"dependency-cruiser configuration.",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
dependencyTypes: ["npm-optional"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "peer-deps-used",
|
|
||||||
comment:
|
|
||||||
"This module depends on an npm package that is declared as a peer dependency " +
|
|
||||||
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
|
|
||||||
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
|
|
||||||
"add an exception to your dependency-cruiser configuration.",
|
|
||||||
severity: "warn",
|
|
||||||
from: {},
|
|
||||||
to: {
|
|
||||||
dependencyTypes: ["npm-peer"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
options: {
|
|
||||||
/* Which modules not to follow further when encountered */
|
|
||||||
doNotFollow: {
|
|
||||||
/* path: an array of regular expressions in strings to match against */
|
|
||||||
path: ["node_modules"],
|
|
||||||
},
|
|
||||||
|
|
||||||
/* Which modules to exclude */
|
|
||||||
// exclude : {
|
|
||||||
// /* path: an array of regular expressions in strings to match against */
|
|
||||||
// path: '',
|
|
||||||
// },
|
|
||||||
|
|
||||||
/* Which modules to exclusively include (array of regular expressions in strings)
|
|
||||||
dependency-cruiser will skip everything not matching this pattern
|
|
||||||
*/
|
|
||||||
// includeOnly : [''],
|
|
||||||
|
|
||||||
/* List of module systems to cruise.
|
|
||||||
When left out dependency-cruiser will fall back to the list of _all_
|
|
||||||
module systems it knows of. It's the default because it's the safe option
|
|
||||||
It might come at a performance penalty, though.
|
|
||||||
moduleSystems: ['amd', 'cjs', 'es6', 'tsd']
|
|
||||||
|
|
||||||
As in practice only commonjs ('cjs') and ecmascript modules ('es6')
|
|
||||||
are widely used, you can limit the moduleSystems to those.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// moduleSystems: ['cjs', 'es6'],
|
|
||||||
|
|
||||||
/*
|
|
||||||
false: don't look at JSDoc imports (the default)
|
|
||||||
true: dependency-cruiser will detect dependencies in JSDoc-style
|
|
||||||
import statements. Implies "parser": "tsc", so the dependency-cruiser
|
|
||||||
will use the typescript parser for JavaScript files.
|
|
||||||
|
|
||||||
For this to work the typescript compiler will need to be installed in the
|
|
||||||
same spot as you're running dependency-cruiser from.
|
|
||||||
*/
|
|
||||||
// detectJSDocImports: true,
|
|
||||||
|
|
||||||
/* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/main/'
|
|
||||||
to open it on your online repo or `vscode://file/${process.cwd()}/` to
|
|
||||||
open it in visual studio code),
|
|
||||||
*/
|
|
||||||
// prefix: `vscode://file/${process.cwd()}/`,
|
|
||||||
|
|
||||||
/* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation
|
|
||||||
true: also detect dependencies that only exist before typescript-to-javascript compilation
|
|
||||||
"specify": for each dependency identify whether it only exists before compilation or also after
|
|
||||||
*/
|
|
||||||
tsPreCompilationDeps: true,
|
|
||||||
|
|
||||||
/* list of extensions to scan that aren't javascript or compile-to-javascript.
|
|
||||||
Empty by default. Only put extensions in here that you want to take into
|
|
||||||
account that are _not_ parsable.
|
|
||||||
*/
|
|
||||||
// extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],
|
|
||||||
|
|
||||||
/* if true combines the package.jsons found from the module up to the base
|
|
||||||
folder the cruise is initiated from. Useful for how (some) mono-repos
|
|
||||||
manage dependencies & dependency definitions.
|
|
||||||
*/
|
|
||||||
// combinedDependencies: false,
|
|
||||||
|
|
||||||
/* if true leave symlinks untouched, otherwise use the realpath */
|
|
||||||
// preserveSymlinks: false,
|
|
||||||
|
|
||||||
/* TypeScript project file ('tsconfig.json') to use for
|
|
||||||
(1) compilation and
|
|
||||||
(2) resolution (e.g. with the paths property)
|
|
||||||
|
|
||||||
The (optional) fileName attribute specifies which file to take (relative to
|
|
||||||
dependency-cruiser's current working directory). When not provided
|
|
||||||
defaults to './tsconfig.json'.
|
|
||||||
*/
|
|
||||||
tsConfig: {
|
|
||||||
fileName: "tsconfig.json",
|
|
||||||
},
|
|
||||||
|
|
||||||
/* Webpack configuration to use to get resolve options from.
|
|
||||||
|
|
||||||
The (optional) fileName attribute specifies which file to take (relative
|
|
||||||
to dependency-cruiser's current working directory. When not provided defaults
|
|
||||||
to './webpack.conf.js'.
|
|
||||||
|
|
||||||
The (optional) `env` and `arguments` attributes contain the parameters
|
|
||||||
to be passed if your webpack config is a function and takes them (see
|
|
||||||
webpack documentation for details)
|
|
||||||
*/
|
|
||||||
// webpackConfig: {
|
|
||||||
// fileName: 'webpack.config.js',
|
|
||||||
// env: {},
|
|
||||||
// arguments: {}
|
|
||||||
// },
|
|
||||||
|
|
||||||
/* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use
|
|
||||||
for compilation
|
|
||||||
*/
|
|
||||||
// babelConfig: {
|
|
||||||
// fileName: '.babelrc',
|
|
||||||
// },
|
|
||||||
|
|
||||||
/* List of strings you have in use in addition to cjs/ es6 requires
|
|
||||||
& imports to declare module dependencies. Use this e.g. if you've
|
|
||||||
re-declared require, use a require-wrapper or use window.require as
|
|
||||||
a hack.
|
|
||||||
*/
|
|
||||||
// exoticRequireStrings: [],
|
|
||||||
|
|
||||||
/* options to pass on to enhanced-resolve, the package dependency-cruiser
|
|
||||||
uses to resolve module references to disk. The values below should be
|
|
||||||
suitable for most situations
|
|
||||||
|
|
||||||
If you use webpack: you can also set these in webpack.conf.js. The set
|
|
||||||
there will override the ones specified here.
|
|
||||||
*/
|
|
||||||
enhancedResolveOptions: {
|
|
||||||
/* What to consider as an 'exports' field in package.jsons */
|
|
||||||
exportsFields: ["exports"],
|
|
||||||
/* List of conditions to check for in the exports field.
|
|
||||||
Only works when the 'exportsFields' array is non-empty.
|
|
||||||
*/
|
|
||||||
conditionNames: ["import", "require", "node", "default", "types"],
|
|
||||||
/* The extensions, by default are the same as the ones dependency-cruiser
|
|
||||||
can access (run `npx depcruise --info` to see which ones that are in
|
|
||||||
_your_ environment). If that list is larger than you need you can pass
|
|
||||||
the extensions you actually use (e.g. [".js", ".jsx"]). This can speed
|
|
||||||
up module resolution, which is the most expensive step.
|
|
||||||
*/
|
|
||||||
// extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
|
|
||||||
/* What to consider a 'main' field in package.json */
|
|
||||||
mainFields: ["module", "main", "types", "typings"],
|
|
||||||
/* A list of alias fields in package.jsons
|
|
||||||
|
|
||||||
See [this specification](https://github.com/defunctzombie/package-browser-field-spec) and
|
|
||||||
the webpack [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields)
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
Defaults to an empty array (= don't use alias fields).
|
|
||||||
*/
|
|
||||||
// aliasFields: ["browser"],
|
|
||||||
},
|
|
||||||
|
|
||||||
/* skipAnalysisNotInRules will make dependency-cruiser execute
|
|
||||||
analysis strictly necessary for checking the rule set only.
|
|
||||||
|
|
||||||
See https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#skipanalysisnotinrules
|
|
||||||
for details
|
|
||||||
*/
|
|
||||||
skipAnalysisNotInRules: true,
|
|
||||||
|
|
||||||
/* List of built-in modules to use on top of the ones node declares.
|
|
||||||
|
|
||||||
See https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#builtinmodules-influencing-what-to-consider-built-in--core-modules
|
|
||||||
for details
|
|
||||||
*/
|
|
||||||
builtInModules: {
|
|
||||||
add: [
|
|
||||||
"bun",
|
|
||||||
"bun:ffi",
|
|
||||||
"bun:jsc",
|
|
||||||
"bun:sqlite",
|
|
||||||
"bun:test",
|
|
||||||
"bun:wrap",
|
|
||||||
"detect-libc",
|
|
||||||
"undici",
|
|
||||||
"ws",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
reporterOptions: {
|
|
||||||
dot: {
|
|
||||||
/* pattern of modules that can be consolidated in the detailed
|
|
||||||
graphical dependency graph. The default pattern in this configuration
|
|
||||||
collapses everything in node_modules to one folder deep so you see
|
|
||||||
the external modules, but their innards.
|
|
||||||
*/
|
|
||||||
collapsePattern: "node_modules/(?:@[^/]+/[^/]+|[^/]+)",
|
|
||||||
|
|
||||||
/* Options to tweak the appearance of your graph.See
|
|
||||||
https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions
|
|
||||||
for details and some examples. If you don't specify a theme
|
|
||||||
dependency-cruiser falls back to a built-in one.
|
|
||||||
*/
|
|
||||||
// theme: {
|
|
||||||
// graph: {
|
|
||||||
// /* splines: "ortho" gives straight lines, but is slow on big graphs
|
|
||||||
// splines: "true" gives bezier curves (fast, not as nice as ortho)
|
|
||||||
// */
|
|
||||||
// splines: "true"
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
archi: {
|
|
||||||
/* pattern of modules that can be consolidated in the high level
|
|
||||||
graphical dependency graph. If you use the high level graphical
|
|
||||||
dependency graph reporter (`archi`) you probably want to tweak
|
|
||||||
this collapsePattern to your situation.
|
|
||||||
*/
|
|
||||||
collapsePattern:
|
|
||||||
"^(?:packages|src|lib(s?)|app(s?)|bin|test(s?)|spec(s?))/[^/]+|node_modules/(?:@[^/]+/[^/]+|[^/]+)",
|
|
||||||
|
|
||||||
/* Options to tweak the appearance of your graph. If you don't specify a
|
|
||||||
theme for 'archi' dependency-cruiser will use the one specified in the
|
|
||||||
dot section above and otherwise use the default one.
|
|
||||||
*/
|
|
||||||
// theme: { },
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
highlightFocused: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
// generated: dependency-cruiser@16.10.0 on 2025-02-16T22:32:01.621Z
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"commonjs": true,
|
|
||||||
"es2021": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": ["eslint:recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": ["@typescript-eslint", "import"],
|
|
||||||
"ignorePatterns": ["**/*.d.ts"],
|
|
||||||
"globals": {
|
|
||||||
"__ENABLE_GH_RELEASE_UPDATE_CHECK__": "readonly",
|
|
||||||
"__GH_RELEASE_REPO__": "readonly",
|
|
||||||
"__UPDATE_CHANNEL__": "readonly",
|
|
||||||
"__BUILD_LABEL__": "readonly"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"no-undef": "off",
|
|
||||||
"no-useless-escape": "off",
|
|
||||||
"no-prototype-builtins": "off",
|
|
||||||
"no-empty": "off",
|
|
||||||
"no-case-declarations": "off",
|
|
||||||
"no-irregular-whitespace": "off",
|
|
||||||
"sort-imports": "off",
|
|
||||||
"import/extensions": "off",
|
|
||||||
"no-async-promise-executor": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
@@ -1,42 +1,51 @@
|
|||||||
name: Bug report
|
name: Bug report
|
||||||
description: Report an issue with the modpack in its unmodified state. For other issues, use Discord.
|
description: Something in BetterSEQTA+ is broken. For questions, ask in Discord instead.
|
||||||
labels: bug
|
labels: bug
|
||||||
title: "[BUG]"
|
title: "[BUG] "
|
||||||
type: "Bug"
|
type: "Bug"
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
Before reporting an issue, [please search](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) to make sure it has not already been reported (make sure to search closed issues as well!).
|
Please [search existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues?q=is%3Aissue) first, including closed ones. For general help you'll get a faster answer in [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Describe the bug
|
label: What happened?
|
||||||
description: Describe your issue. For general issues and questions you'll get a faster answer [from our Discord.](https://discord.gg/YzmbnCDkat)
|
description: What went wrong, and what did you expect to happen instead?
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
placeholder: |
|
||||||
|
1. Open the timetable
|
||||||
|
2. Click a class
|
||||||
|
3. ...
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Extension version
|
label: Extension version
|
||||||
description: What version of the extension are you using?
|
description: Shown on your browser's extensions page (`chrome://extensions` or `about:addons`).
|
||||||
placeholder: Find it by opening the config menu and clicking the about icon in the top right.
|
placeholder: "1.0.0"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Browser
|
label: Browser
|
||||||
description: Which Browser are you using?
|
|
||||||
options:
|
options:
|
||||||
- Chrome
|
- Chrome
|
||||||
- Firefox
|
|
||||||
- Brave
|
|
||||||
- Safari
|
|
||||||
- DuckDuckGO
|
|
||||||
- Microsoft Edge
|
- Microsoft Edge
|
||||||
- Other Chromium-Based Browser
|
- Brave
|
||||||
- Other Non-Chromium-Based Browser
|
- Opera
|
||||||
|
- Other Chromium browser
|
||||||
|
- Firefox
|
||||||
|
- Safari
|
||||||
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -44,14 +53,13 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Confirm
|
label: Confirm
|
||||||
options:
|
options:
|
||||||
- label: This bug report is about an issue with the extension itself. I have not modified the extension nor added any unsupported plugins. If this is not the case, I know that I should post the issue to the extension's Discord support channel instead.
|
- label: I'm using an unmodified build from a store or GitHub release, without third-party plugins.
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional context
|
label: Screenshots and console output
|
||||||
description: Screenshots, video or any other information. Include photos of the console if possible
|
description: Screenshots, a video, or errors from the browser console all help.
|
||||||
placeholder: |
|
placeholder: Drag images or log files into this box to attach them.
|
||||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
contact_links:
|
contact_links:
|
||||||
- name: BetterSEQTA Community Support
|
- name: Discord
|
||||||
url: https://discord.gg/YzmbnCDkat
|
url: https://discord.gg/YzmbnCDkat
|
||||||
about: Join our discord for community updates, discussion, and more!
|
about: Questions, help and community chat.
|
||||||
|
- name: Documentation
|
||||||
|
url: https://docs.betterseqta.org
|
||||||
|
about: Guides for installing, making themes and writing plugins.
|
||||||
@@ -1,52 +1,42 @@
|
|||||||
name: Feature request
|
name: Feature request
|
||||||
description: Suggest a new Feature to be added or replaced in BetterSeqtaPLUS
|
description: Suggest something new for BetterSEQTA+ or a change to an existing feature.
|
||||||
labels: enhancement
|
labels: enhancement
|
||||||
title: "[FR]"
|
title: "[FR] "
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Confirm
|
|
||||||
options:
|
|
||||||
- label: "Is this feature request related to a Bug report?"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Bug report link
|
|
||||||
description: "If this feature request is related to a bug report, please insert the link to the bug report here"
|
|
||||||
placeholder: "https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/..."
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
## Feature details
|
Please [search existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues?q=is%3Aissue) first, including closed ones, in case it's already been suggested.
|
||||||
Before you request a feature, [please search](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) if it has already been requested. (Make sure to check closed issues as well!)
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: What would you like?
|
||||||
|
description: Describe the feature in as much detail as you can, and the problem it solves.
|
||||||
|
placeholder: It would be great if...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Feature type
|
label: Type
|
||||||
multiple: false
|
|
||||||
options:
|
options:
|
||||||
- Graphical
|
- Visual / design
|
||||||
- Functional
|
- Functionality
|
||||||
- Not Sure
|
- Not sure
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Feature Details
|
label: Related bug report
|
||||||
description: Please write, with as much detail as possible, what you would like to see from this feature.
|
description: If this comes from a bug report, link it here.
|
||||||
placeholder: it would be cool if
|
placeholder: https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/...
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional details
|
label: Anything else
|
||||||
description: Anything else that would help describe your vision (reference images, descriptions, etc)
|
description: Mockups, reference images, or examples from other apps.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
@@ -1,114 +1,64 @@
|
|||||||
name: 🙋 New Contributor - Need Help Getting Started
|
name: New contributor
|
||||||
description: Perfect for first-time contributors who need guidance
|
description: First time contributing? Tell us what you'd like to work on and we'll help you get started.
|
||||||
labels: ["help wanted", "documentation"]
|
labels: ["help wanted"]
|
||||||
title: "[NEW CONTRIBUTOR] "
|
title: "[NEW CONTRIBUTOR] "
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
## Hi there! 👋
|
Welcome to BetterSEQTA+! Fill in what you can and a maintainer will point you in the right direction. For real-time help, join the [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
Welcome to BetterSEQTA+! We're excited to have you join our community.
|
|
||||||
|
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: Tell us about yourself (check all that apply)
|
label: About you
|
||||||
options:
|
options:
|
||||||
- label: "This is my first time contributing to open source"
|
- label: This is my first open source contribution
|
||||||
required: false
|
- label: I'm new to browser extensions
|
||||||
- label: "I'm new to browser extensions"
|
- label: I'm new to TypeScript or Svelte
|
||||||
required: false
|
- label: I've coded before but I'm new to this project
|
||||||
- label: "I'm new to TypeScript/JavaScript"
|
|
||||||
required: false
|
|
||||||
- label: "I have some coding experience but new to this project"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: What would you like to work on? (check all that apply)
|
|
||||||
options:
|
|
||||||
- label: "Fix a bug 🐛"
|
|
||||||
required: false
|
|
||||||
- label: "Add a new feature ✨"
|
|
||||||
required: false
|
|
||||||
- label: "Improve documentation 📚"
|
|
||||||
required: false
|
|
||||||
- label: "Create a plugin 🧩"
|
|
||||||
required: false
|
|
||||||
- label: "Improve the UI/design 🎨"
|
|
||||||
required: false
|
|
||||||
- label: "Write tests 🧪"
|
|
||||||
required: false
|
|
||||||
- label: "Not sure - I want to help but need guidance!"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: Have you read our guides?
|
label: What would you like to work on?
|
||||||
options:
|
options:
|
||||||
- label: "Getting Started Guide (see docs/GETTING_STARTED_CONTRIBUTING.md)"
|
- label: Fixing a bug
|
||||||
required: true
|
- label: A new feature
|
||||||
- label: "Architecture Guide (see docs/ARCHITECTURE.md)"
|
- label: A plugin
|
||||||
required: true
|
- label: UI and design
|
||||||
- label: "Plugin Development Guide (see docs/plugins/README.md)"
|
- label: Tests
|
||||||
|
- label: Documentation
|
||||||
|
- label: Not sure yet, I'd like suggestions
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Have you read the guides?
|
||||||
|
options:
|
||||||
|
- label: "[CONTRIBUTING.md](https://github.com/BetterSEQTA/BetterSEQTA-Plus/blob/main/CONTRIBUTING.md)"
|
||||||
required: true
|
required: true
|
||||||
|
- label: "The [architecture guide](https://docs.betterseqta.org/architecture/)"
|
||||||
|
- label: "The [plugin development guide](https://docs.betterseqta.org/plugin-development/), if you're writing a plugin"
|
||||||
|
|
||||||
- type: checkboxes
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Have you set up the development environment yet?
|
label: Is your dev environment working?
|
||||||
options:
|
options:
|
||||||
- label: Yes, everything works! 🎉
|
- Yes, `npm run dev` works
|
||||||
required: false
|
- Partly, I'm running into issues
|
||||||
- label: Partially - I can run `npm run dev` but having some issues
|
- Not set up yet
|
||||||
required: false
|
validations:
|
||||||
- label: No, I need help with setup
|
required: true
|
||||||
required: false
|
|
||||||
- label: I tried but ran into errors (please describe below)
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Errors
|
label: Errors
|
||||||
description: "Please list any encountered errors here:"
|
description: Paste any errors you've hit.
|
||||||
placeholder: "I am encountering issues with..."
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Questions or Issues
|
label: Questions
|
||||||
description: "Tell us:
|
description: What would you like help with? Is anything in the docs unclear?
|
||||||
1. What specifically would you like help with?
|
|
||||||
2. Are you stuck on anything?
|
|
||||||
3. Do you have any questions about the codebase?
|
|
||||||
4. Is there anything in our documentation that's unclear?"
|
|
||||||
placeholder: "I want help with..."
|
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Ideas or Suggestions
|
|
||||||
description: "If you have any ideas for features, improvements, or just want to share your thoughts:"
|
|
||||||
placeholder: "It would be cool if I could help add..."
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
## What happens next?
|
|
||||||
|
|
||||||
A maintainer will respond within 24-48 hours to:
|
|
||||||
- Answer your questions
|
|
||||||
- Suggest some good issues to work on
|
|
||||||
- Help you with setup if needed
|
|
||||||
- Point you to relevant documentation
|
|
||||||
|
|
||||||
Don't worry if you're new to this - we're here to help! Every expert was once a beginner. 🚀
|
|
||||||
|
|
||||||
**Join our [Discord server](https://discord.gg/YzmbnCDkat) for real-time help and community chat!**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
## Description
|
## What does this change?
|
||||||
|
|
||||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
<!-- A short summary, and why it's needed. -->
|
||||||
|
|
||||||
Fixes # (issue)
|
Fixes #
|
||||||
|
|
||||||
## Type of change
|
## Type of change
|
||||||
|
|
||||||
Please delete options that are not relevant.
|
- [ ] Bug fix
|
||||||
|
- [ ] New feature
|
||||||
|
- [ ] Breaking change
|
||||||
|
- [ ] Docs or tooling only
|
||||||
|
|
||||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
## Checklist
|
||||||
- [ ] New feature (non-breaking change which adds functionality)
|
|
||||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
- [ ] `npm run lint`, `npm test` and `npm run build` pass
|
||||||
- [ ] This change requires a documentation update
|
- [ ] Tested on a SEQTA page
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Run lint
|
name: Run lint
|
||||||
description: Run ESLint on src.
|
description: Run oxlint, the format check and the type check.
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -7,5 +7,11 @@ runs:
|
|||||||
- name: Lint
|
- name: Lint
|
||||||
shell: bash
|
shell: bash
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
env:
|
|
||||||
ESLINT_USE_FLAT_CONFIG: "false"
|
- name: Format check
|
||||||
|
shell: bash
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
shell: bash
|
||||||
|
run: npm run typecheck
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
name: Setup Node and dependencies
|
name: Setup Node and dependencies
|
||||||
description: Install Node.js 22.x and npm dependencies.
|
description: Install Node.js 26.x and npm dependencies.
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Use Node.js 22.x
|
- name: Use Node.js 26.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: 22.x
|
node-version: 26.x
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: npm install --legacy-peer-deps
|
run: npm ci
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
# Nightly release workflow — updates the same "nightly" release with fresh builds from main.
|
# Rebuilds main every night and replaces the assets on the "nightly" prerelease.
|
||||||
# Runs only on BetterSEQTA/BetterSEQTA-Plus. Uses the default GITHUB_TOKEN.
|
# Runs on Windows because the layerchart Svelte build fails on Linux.
|
||||||
#
|
|
||||||
# Scheduled at midnight Australia/Adelaide (ACST/ACDT). GitHub cron is UTC-only, so we
|
|
||||||
# trigger at 13:30 and 14:30 UTC and only proceed when Adelaide local time is 00:00.
|
|
||||||
# Builds on windows-latest (matches local dev; Linux nightly builds were failing on Vite/Svelte).
|
|
||||||
|
|
||||||
name: Nightly Release
|
name: Nightly Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# 13:30 UTC = 00:00 Adelaide during daylight saving (ACDT, UTC+10:30)
|
# Midnight in Adelaide during daylight saving (UTC+10:30).
|
||||||
- cron: "30 13 * * *"
|
- cron: "30 13 * * *"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -26,8 +22,7 @@ jobs:
|
|||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set build date
|
- name: Set build date
|
||||||
id: build_date
|
id: build_date
|
||||||
|
|||||||
@@ -6,15 +6,24 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
# windows-latest: Vite/Svelte build fails on Linux CI for layerchart vendor .svelte (see nightly.yml).
|
permissions:
|
||||||
|
contents: read
|
||||||
|
# The layerchart Svelte build fails on Linux, so CI runs on Windows.
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup Node and dependencies
|
- name: Setup Node and dependencies
|
||||||
uses: ./.github/actions/setup-node-deps
|
uses: ./.github/actions/setup-node-deps
|
||||||
@@ -23,12 +32,14 @@ jobs:
|
|||||||
uses: ./.github/actions/run-lint
|
uses: ./.github/actions/run-lint
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup Node and dependencies
|
- name: Setup Node and dependencies
|
||||||
uses: ./.github/actions/setup-node-deps
|
uses: ./.github/actions/setup-node-deps
|
||||||
@@ -37,13 +48,15 @@ jobs:
|
|||||||
uses: ./.github/actions/run-unit-tests
|
uses: ./.github/actions/run-unit-tests
|
||||||
|
|
||||||
build-and-smoke:
|
build-and-smoke:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
needs: [lint, unit-tests]
|
needs: [lint, unit-tests]
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Build extension
|
- name: Build extension
|
||||||
id: build
|
id: build
|
||||||
@@ -52,7 +65,7 @@ jobs:
|
|||||||
gh_release_update_check: "false"
|
gh_release_update_check: "false"
|
||||||
|
|
||||||
- name: Upload extension zips
|
- name: Upload extension zips
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: extension-zips
|
name: extension-zips
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
# Manual release workflow only — runs on BetterSEQTA/BetterSEQTA-Plus via workflow_dispatch.
|
|
||||||
# Bump package.json version on main, confirm when dispatching, then run.
|
|
||||||
# Uses the default GITHUB_TOKEN (contents: write).
|
|
||||||
|
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version_updated:
|
|
||||||
description: I have already updated the version in package.json
|
|
||||||
type: boolean
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Confirm version was updated
|
|
||||||
if: inputs.version_updated != true
|
|
||||||
run: |
|
|
||||||
echo "Check the confirmation box: you must update package.json version before releasing."
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Read version
|
|
||||||
id: version
|
|
||||||
run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build extension
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-extension
|
|
||||||
with:
|
|
||||||
gh_release_update_check: "true"
|
|
||||||
update_channel: stable
|
|
||||||
release_repo: ${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Create release if missing
|
|
||||||
run: |
|
|
||||||
if ! gh release view "${{ steps.version.outputs.version }}" 2>/dev/null; then
|
|
||||||
gh release create "${{ steps.version.outputs.version }}" \
|
|
||||||
--title "${{ steps.version.outputs.version }}" \
|
|
||||||
--notes "Edit this release description on GitHub."
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload release assets
|
|
||||||
run: |
|
|
||||||
gh release upload "${{ steps.version.outputs.version }}" \
|
|
||||||
--clobber \
|
|
||||||
"${{ steps.build.outputs.chrome_zip }}" \
|
|
||||||
"${{ steps.build.outputs.firefox_zip }}"
|
|
||||||
+18
-22
@@ -1,32 +1,28 @@
|
|||||||
# npm
|
# Dependencies
|
||||||
node_modules/
|
node_modules/
|
||||||
package-lock.json
|
|
||||||
bun.lockb
|
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
yarn.lock
|
|
||||||
bun.lock
|
|
||||||
|
|
||||||
# PDF.js extension assets (copied by postinstall from pdfjs-dist)
|
# Build output
|
||||||
src/public/resources/pdfjs/pdf.worker.min.mjs
|
betterseqtaplus-safari/
|
||||||
src/public/resources/pdfjs/pdf.legacy.min.mjs
|
coverage/
|
||||||
# ONNX Runtime WASM assets (copied by postinstall from @huggingface/transformers)
|
dist/
|
||||||
|
|
||||||
|
# Copied in by postinstall
|
||||||
src/public/resources/ort/ort-wasm-simd-threaded.jsep.mjs
|
src/public/resources/ort/ort-wasm-simd-threaded.jsep.mjs
|
||||||
src/public/resources/ort/ort-wasm-simd-threaded.jsep.wasm
|
src/public/resources/ort/ort-wasm-simd-threaded.jsep.wasm
|
||||||
|
src/public/resources/pdfjs/pdf.legacy.min.mjs
|
||||||
|
src/public/resources/pdfjs/pdf.worker.min.mjs
|
||||||
|
|
||||||
# Build
|
# Environment
|
||||||
extension.zip
|
|
||||||
build/
|
|
||||||
dist/
|
|
||||||
betterseqtaplus-safari/
|
|
||||||
|
|
||||||
.million/
|
|
||||||
.vscode/
|
|
||||||
.cursor/
|
|
||||||
**/.DS_Store
|
|
||||||
.parcel-cache
|
|
||||||
.env
|
.env
|
||||||
.env.submit
|
.env.submit
|
||||||
dependency-graph.svg
|
|
||||||
|
|
||||||
update-videos/
|
# Editors and OS
|
||||||
|
.cursor/
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||||
|
"ignorePatterns": [
|
||||||
|
"betterseqtaplus-safari/",
|
||||||
|
"coverage/",
|
||||||
|
"dist/",
|
||||||
|
"package-lock.json",
|
||||||
|
"src/public/"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": ["typescript", "unicorn", "oxc", "import"],
|
||||||
|
"categories": {
|
||||||
|
"correctness": "error"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"builtin": true,
|
||||||
|
"browser": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"__ENABLE_GH_RELEASE_UPDATE_CHECK__": "readonly",
|
||||||
|
"__GH_RELEASE_REPO__": "readonly",
|
||||||
|
"__UPDATE_CHANNEL__": "readonly",
|
||||||
|
"__BUILD_LABEL__": "readonly",
|
||||||
|
"__GOOGLE_OAUTH_CLIENT_ID__": "readonly",
|
||||||
|
"__OUTLOOK_OAUTH_CLIENT_ID__": "readonly"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoreRestSiblings": true,
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"varsIgnorePattern": "^_",
|
||||||
|
"caughtErrors": "none"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"import/default": "off"
|
||||||
|
},
|
||||||
|
"ignorePatterns": ["src/public/**"]
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
build
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"tabWidth": 2,
|
|
||||||
"useTabs": false,
|
|
||||||
"semi": true
|
|
||||||
}
|
|
||||||
+3
-2
@@ -59,8 +59,9 @@ representative at an online or offline event.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported to the community leaders responsible for enforcement at
|
reported to the community leaders responsible for enforcement by emailing
|
||||||
N/A (literally sorry guys).
|
[betterseqta.plus@gmail.com](mailto:betterseqta.plus@gmail.com) or messaging a
|
||||||
|
moderator in the [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
|||||||
+54
-61
@@ -1,72 +1,65 @@
|
|||||||
# Contributing to BetterSEQTA+
|
# Contributing to BetterSEQTA+
|
||||||
|
|
||||||
Hey there! 👋 Thanks for your interest in contributing to BetterSEQTA+! We're excited to have you join our community of contributors.
|
Thanks for helping out! For anything bigger than a small fix, open an issue or ask in [Discord](https://discord.gg/YzmbnCDkat) first so we can agree on the approach.
|
||||||
|
|
||||||
## 🚀 New Contributors Start Here!
|
## Setup
|
||||||
|
|
||||||
**Never contributed to an open source project before?** No worries! We've made it super easy to get started:
|
You need Node.js 26+, Git and a Chromium browser (Chrome, Edge or Brave).
|
||||||
|
|
||||||
- **📖 Read our [contributing guide](https://docs.betterseqta.org/contributing/)** - This walks you through everything step-by-step, from setting up your development environment to making your first pull request.
|
```bash
|
||||||
- **🏗️ Understand the codebase** with the [architecture guide](https://docs.betterseqta.org/architecture/)
|
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus
|
||||||
- **🔧 Having issues?** Check the [troubleshooting guide](https://docs.betterseqta.org/troubleshooting/)
|
cd BetterSEQTA-Plus
|
||||||
|
npm install
|
||||||
We have lots of [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/good%20first%20issue) labels that are perfect for beginners!
|
npm run dev
|
||||||
|
|
||||||
## Discussion Before Contributing
|
|
||||||
|
|
||||||
For significant changes, please first discuss what you'd like to change via:
|
|
||||||
- Opening an issue
|
|
||||||
- Joining our Discord server
|
|
||||||
- Emailing the maintainers
|
|
||||||
|
|
||||||
This helps ensure your contribution aligns with the project's goals and saves you time!
|
|
||||||
|
|
||||||
## Community
|
|
||||||
|
|
||||||
Join our community channels to discuss the project, get help, and connect with other contributors:
|
|
||||||
|
|
||||||
- **Discord Server**: [Join our Discord](https://discord.gg/YzmbnCDkat)
|
|
||||||
- **GitHub Discussions**: For longer-form conversations
|
|
||||||
- **GitHub Issues**: For bug reports and feature requests
|
|
||||||
|
|
||||||
## Creating Plugins
|
|
||||||
|
|
||||||
If you're interested in creating plugins for BetterSEQTA+, check out our plugin development guides:
|
|
||||||
|
|
||||||
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
|
|
||||||
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
|
|
||||||
## Pull Request Process
|
|
||||||
|
|
||||||
1. It is recommended to start by opening an issue to discuss the change you wish to make. This will allow us to discuss the change and ensure it is a good fit for the project.
|
|
||||||
2. Fork the repo and create your branch from `main`.
|
|
||||||
3. When writing your pull request, make sure to use the pull request template.
|
|
||||||
|
|
||||||
### Pull Request Template
|
|
||||||
|
|
||||||
```
|
|
||||||
## Description
|
|
||||||
|
|
||||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
|
||||||
|
|
||||||
Fixes # (issue)
|
|
||||||
|
|
||||||
## Type of change
|
|
||||||
|
|
||||||
Please delete options that are not relevant.
|
|
||||||
|
|
||||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
||||||
- [ ] New feature (non-breaking change which adds functionality)
|
|
||||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
||||||
- [ ] This change requires a documentation update
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Issues
|
Then load the extension:
|
||||||
|
|
||||||
#### Create a new issue
|
1. Open `chrome://extensions` and turn on Developer mode.
|
||||||
|
2. Click **Load unpacked** and pick the `dist/chrome` folder.
|
||||||
|
3. Open a SEQTA Learn page.
|
||||||
|
|
||||||
If you spot a problem with the readme or code, [search if an issue already exists](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/new).
|
For Firefox, run `npm run dev:firefox` and load `dist/firefox` from `about:debugging`.
|
||||||
|
|
||||||
#### Solve an issue
|
## Project layout
|
||||||
|
|
||||||
Scan through our [existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) to find one that interests you. You can narrow down the search using `labels` as filters. As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.
|
| Path | What's in it |
|
||||||
|
| -------------------------------------- | --------------------------------------------- |
|
||||||
|
| `src/SEQTA.ts` | Content script entry point |
|
||||||
|
| `src/background.ts`, `src/background/` | Service worker |
|
||||||
|
| `src/seqta/` | Everything injected into SEQTA pages |
|
||||||
|
| `src/interface/` | Settings popup and theme store (Svelte) |
|
||||||
|
| `src/plugins/` | Plugin system and built-in plugins |
|
||||||
|
| `src/css/` | Injected styles and the shared Tailwind setup |
|
||||||
|
| `lib/`, `scripts/` | Vite plugins and build scripts |
|
||||||
|
|
||||||
|
The [architecture guide](https://docs.betterseqta.org/architecture/) goes into more detail.
|
||||||
|
|
||||||
|
## Making changes
|
||||||
|
|
||||||
|
1. Branch from `main`, e.g. `git checkout -b fix/timetable-colours`.
|
||||||
|
2. Keep each PR to one change and match the style of the surrounding code.
|
||||||
|
3. Add tests for logic changes.
|
||||||
|
4. Before opening the PR, check everything passes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run format
|
||||||
|
npm run lint
|
||||||
|
npm run typecheck
|
||||||
|
npm test
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Use short conventional commit messages: `feat:`, `fix:`, `chore:`, `docs:`.
|
||||||
|
6. Open the PR and fill in the template.
|
||||||
|
|
||||||
|
## Issues
|
||||||
|
|
||||||
|
Search [existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) before opening a new one, and use the issue forms. [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-Plus/labels/good%20first%20issue) and [`help wanted`](https://github.com/BetterSEQTA/BetterSEQTA-Plus/labels/help%20wanted) are good places to start. Issues aren't assigned, so just open a PR when you have a fix.
|
||||||
|
|
||||||
|
## More docs
|
||||||
|
|
||||||
|
- [Plugin development](https://docs.betterseqta.org/plugin-development/) and the [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
||||||
|
- [Theme creation](https://docs.betterseqta.org/theme-creation/)
|
||||||
|
- [Troubleshooting](https://docs.betterseqta.org/troubleshooting/)
|
||||||
|
- [Releases and CI](docs/RELEASES.md)
|
||||||
@@ -3,92 +3,61 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
A beautiful 🤩 browser extension that transforms <a href="https://www.tes.com/en-au/for-schools/seqta">SEQTA</a> with modern themes, powerful customization, productivity tools, and an improved user experience. Contributions are always welcome!
|
A browser extension that makes <a href="https://www.tes.com/en-au/for-schools/seqta">SEQTA</a> faster, nicer to look at and easier to use.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a target="_blank" href="https://chromewebstore.google.com/detail/betterseqta+/afdgaoaclhkhemfkkkonemoapeinchel"><img src="https://user-images.githubusercontent.com/95666457/149519713-159d7ef7-2c21-4034-a616-f037ff46d9a4.png" alt="ChromeDownload" width="250"></a>
|
<a target="_blank" href="https://chromewebstore.google.com/detail/betterseqta+/afdgaoaclhkhemfkkkonemoapeinchel"><img src="https://user-images.githubusercontent.com/95666457/149519713-159d7ef7-2c21-4034-a616-f037ff46d9a4.png" alt="Available in the Chrome Web Store" width="250"></a>
|
||||||
<a target="_blank" href="https://discord.gg/YzmbnCDkat"><img src="https://github.com/BetterSEQTA/BetterSEQTA-Plus/assets/108050083/23055730-b16e-44c0-9bef-221d8545af92" width="240" style="border-radius:10%;" /></a>
|
<a target="_blank" href="https://discord.gg/YzmbnCDkat"><img src="https://github.com/BetterSEQTA/BetterSEQTA-Plus/assets/108050083/23055730-b16e-44c0-9bef-221d8545af92" alt="Join the Discord" width="240" style="border-radius:10%;" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div>
|
<p align="center">
|
||||||
<img src="https://img.shields.io/chrome-web-store/users/afdgaoaclhkhemfkkkonemoapeinchel" />
|
<img src="https://img.shields.io/chrome-web-store/users/afdgaoaclhkhemfkkkonemoapeinchel" alt="Chrome Web Store users" />
|
||||||
<img src="https://img.shields.io/chrome-web-store/rating/afdgaoaclhkhemfkkkonemoapeinchel" />
|
<img src="https://img.shields.io/chrome-web-store/rating/afdgaoaclhkhemfkkkonemoapeinchel" alt="Chrome Web Store rating" />
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Everything you need to get started with BetterSEQTA+ can be found in the [official documentation](https://docs.betterseqta.org).
|
|
||||||
|
|
||||||
Includes:
|
|
||||||
- Getting Started
|
|
||||||
- Installation & Development
|
|
||||||
- Architecture
|
|
||||||
- Plugin System
|
|
||||||
- Theme Creation
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Dark mode
|
- **Themes:** dark mode, custom colours and backgrounds, a community theme store and a theme creator.
|
||||||
- Custom Background/Themes
|
- **Home page:** today's lessons, upcoming assessments, notices and your own shortcuts in one place.
|
||||||
- Improved Styling/CSS
|
- **Global search:** jump to assessments, messages, courses and notices from a keyboard shortcut.
|
||||||
- Improved look for SEQTA Learn
|
- **Assessments:** an overview board grouped by status, averages and weightings on the assessments page, and grade analytics with trends and charts.
|
||||||
- Custom Home Page including:
|
- **Timetable:** extra timetable tools, editable room and teacher names, calendar sync and opt-in classmates.
|
||||||
- Daily Lessons
|
- **Messages and notifications:** custom message folders and a local archive of notifications that outlasts SEQTA's own history.
|
||||||
- Shortcuts
|
- **BetterSEQTA Cloud:** sign in to back up your settings and use your profile picture across devices.
|
||||||
- Easier Access Notices
|
- **Extras:** hide side menu items, animated backgrounds, background music and the classic kitten 404 page.
|
||||||
- Assessments
|
|
||||||
- Options to remove certain items from the side menu
|
|
||||||
- Grades calculator
|
|
||||||
- Fully customisable themes and an official theme store
|
|
||||||
- Notification for next lesson (sent 5 minutes before end of the lesson)
|
|
||||||
- Browser Support
|
|
||||||
- Chrome, Edge, Brave, Opera and other Chromium-Based browsers are supported
|
|
||||||
- Firefox Supported: [here](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/)!
|
|
||||||
- Safari (Experimental and not recommended - only available via compilation)
|
|
||||||
|
|
||||||
## Creating Custom Themes
|
Works in Chrome, Edge, Brave, Opera and other Chromium browsers, and in [Firefox](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/). Safari support is experimental and needs a build from source.
|
||||||
|
|
||||||
If you are looking to create custom themes, I would recommend you start at the official documentation [here](https://docs.betterseqta.org/theme-creation/). You can see some premade examples along with a compilation script that can be used to allow for CSS frameworks and libraries such as SCSS to be used [here](https://github.com/BetterSEQTA/BetterSEQTA-Theme-Generator).
|
## Documentation
|
||||||
|
|
||||||
Don't worry- if you get stuck feel free to ask around in the [discord](https://discord.gg/YzmbnCDkat). We're open and happy to help out! Happy creating :)
|
Guides for installing, making themes and writing plugins are at **[docs.betterseqta.org](https://docs.betterseqta.org)**. If you get stuck, ask in the [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
|
|
||||||
## 🚀 Contributing
|
## Contributing
|
||||||
**New contributors welcome!**
|
|
||||||
- 📖 Start here: https://docs.betterseqta.org/install/
|
|
||||||
- 🧠 Architecture: https://docs.betterseqta.org/architecture/
|
|
||||||
- 🧩 Plugins: https://docs.betterseqta.org/plugins/
|
|
||||||
- 💬 Discord: https://discord.gg/YzmbnCDkat
|
|
||||||
|
|
||||||
|
Contributions are welcome. Setup takes a few minutes:
|
||||||
## ⚡ Quick Start
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/YOUR_USERNAME_FORKED_WITH/BetterSEQTA-Plus
|
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus
|
||||||
cd BetterSEQTA-Plus
|
cd BetterSEQTA-Plus
|
||||||
npm install --legacy-peer-deps
|
npm install
|
||||||
npm run dev
|
npm run dev
|
||||||
````
|
```
|
||||||
|
|
||||||
Then load `dist` in `chrome://extensions` (Developer Mode → Load unpacked).
|
Then open `chrome://extensions`, turn on Developer mode, click **Load unpacked** and pick `dist/chrome`.
|
||||||
|
|
||||||
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide.
|
||||||
|
|
||||||
Full development setup guide can be found [here](https://docs.betterseqta.org/install/#for-developers-development-environment).
|
<a href="https://github.com/BetterSEQTA/BetterSEQTA-Plus/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=betterseqta/betterseqta-plus" alt="Contributors" />
|
||||||
## Contributors
|
|
||||||
|
|
||||||
<a href="https://github.com/betterseqta/betterseqta-plus/graphs/contributors">
|
|
||||||
<img src="https://contrib.rocks/image?repo=betterseqta/betterseqta-plus" />
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
Want to contribute? [Click Here!](https://docs.betterseqta.org/contributing/)
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Originally developed by [Nulkem](https://github.com/Nulkem/betterseqta)
|
Originally developed by [Nulkem](https://github.com/Nulkem/betterseqta).
|
||||||
Ported to Manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68)
|
Ported to Manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68).
|
||||||
Maintained by [SethBurkart123](https://github.com/SethBurkart123), [Crazypersonalph](https://github.com/Crazypersonalph) & the rest of the BetterSEQTA team!
|
Maintained by [SethBurkart123](https://github.com/SethBurkart123), [Crazypersonalph](https://github.com/Crazypersonalph) and the rest of the BetterSEQTA team.
|
||||||
|
|
||||||
## Star History
|
## Star history
|
||||||
|
|
||||||
[](https://star-history.com/#BetterSEQTA/BetterSEQTA-Plus&Date)
|
[](https://star-history.com/#BetterSEQTA/BetterSEQTA-Plus&Date)
|
||||||
+5
-12
@@ -1,16 +1,9 @@
|
|||||||
# Security Policy
|
# Security policy
|
||||||
|
|
||||||
## Supported Versions
|
## Supported versions
|
||||||
|
|
||||||
The following versions of BetterSEQTA+ are currently supported.
|
Only the latest release gets security fixes. Store installs update automatically. If you sideload from GitHub, grab the newest [release](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases).
|
||||||
|
|
||||||
| Version | Supported |
|
## Reporting a vulnerability
|
||||||
| ------- | --------- |
|
|
||||||
| 3.4.3 or later | ✅ |
|
|
||||||
| Earlier than 3.4.3 | ❌ |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
Please report vulnerabilities privately through [GitHub Security Advisories](https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new), not in a public issue.
|
||||||
|
|
||||||
If you discover a security vulnerability, please report it responsibly through GitHub Security Advisories:
|
|
||||||
|
|
||||||
https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new
|
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
# BetterSEQTA+ Architecture
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/architecture/](https://docs.betterseqta.org/architecture/)
|
|
||||||
|
|
||||||
Hey there! 👋 New to the codebase and feeling a bit lost? Don't worry - this guide will help you understand how everything fits together!
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Overview](#overview)
|
|
||||||
- [High-Level Architecture](#high-level-architecture)
|
|
||||||
- [Core Components](#core-components)
|
|
||||||
- [Plugin System](#plugin-system)
|
|
||||||
- [File Structure Explained](#file-structure-explained)
|
|
||||||
- [Data Flow](#data-flow)
|
|
||||||
- [Browser Extension Basics](#browser-extension-basics)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
BetterSEQTA+ is a browser extension that enhances SEQTA Learn by:
|
|
||||||
- Adding new features through a plugin system
|
|
||||||
- Providing customizable themes and UI improvements
|
|
||||||
- Offering better navigation and user experience
|
|
||||||
|
|
||||||
Think of it like this: **SEQTA Learn + BetterSEQTA+ = Enhanced SEQTA Experience**
|
|
||||||
|
|
||||||
## High-Level Architecture
|
|
||||||
|
|
||||||
```
|
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
|
||||||
│ BROWSER EXTENSION │
|
|
||||||
├─────────────────────────────────────────────────────────────┤
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────┐ ┌──────────────────┐ │
|
|
||||||
│ │ Background │ │ Content Script │ │
|
|
||||||
│ │ Script │ │ (SEQTA.ts) │ │
|
|
||||||
│ │ │ │ │ │
|
|
||||||
│ │ - Settings │◄───┤ - Page Detection│ │
|
|
||||||
│ │ - Storage │ │ - Plugin Loading│ │
|
|
||||||
│ │ - Updates │ │ - UI Injection │ │
|
|
||||||
│ └─────────────────┘ └──────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ ┌─────────▼─────────┐ │
|
|
||||||
│ │ Plugin System │ │
|
|
||||||
│ │ │ │
|
|
||||||
│ │ ┌─────────────┐ │ │
|
|
||||||
│ │ │ Built-in │ │ │
|
|
||||||
│ │ │ Plugins │ │ │
|
|
||||||
│ │ │ │ │ │
|
|
||||||
│ │ │ - Themes │ │ │
|
|
||||||
│ │ │ - Search │ │ │
|
|
||||||
│ │ │ - Timetable │ │ │
|
|
||||||
│ │ │ - etc... │ │ │
|
|
||||||
│ │ └─────────────┘ │ │
|
|
||||||
│ └───────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ ┌─────────▼─────────┐ │
|
|
||||||
│ │ Settings UI │ │
|
|
||||||
│ │ (Svelte App) │ │
|
|
||||||
│ │ │ │
|
|
||||||
│ │ - Plugin Config │ │
|
|
||||||
│ │ - Theme Creator │ │
|
|
||||||
│ │ - General Settings│ │
|
|
||||||
│ └───────────────────┘ │
|
|
||||||
└─────────────────────────────────────────────────────────────┘
|
|
||||||
│
|
|
||||||
┌─────────▼─────────┐
|
|
||||||
│ SEQTA Learn │
|
|
||||||
│ Website │
|
|
||||||
└───────────────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
## Core Components
|
|
||||||
|
|
||||||
### 1. Entry Point (`src/SEQTA.ts`)
|
|
||||||
This is where it all begins! It runs on every website, so it stays tiny:
|
|
||||||
1. Detects if you're on a SEQTA Learn page
|
|
||||||
2. If you are, loads `src/seqta/boot.ts`, which:
|
|
||||||
- Injects our CSS styles
|
|
||||||
- Changes the favicon to BetterSEQTA+ icon
|
|
||||||
- Loads settings from storage
|
|
||||||
- Initializes the plugin system
|
|
||||||
|
|
||||||
### 2. Plugin System (`src/plugins/`)
|
|
||||||
The heart of BetterSEQTA+! This is what makes it extensible:
|
|
||||||
- **Plugin Manager**: Registers and manages all plugins
|
|
||||||
- **Built-in Plugins**: Pre-made plugins (themes, search, etc.)
|
|
||||||
- **Plugin API**: Provides plugins with tools to interact with SEQTA
|
|
||||||
|
|
||||||
### 3. Settings UI (`src/interface/`)
|
|
||||||
A Svelte application that lets users:
|
|
||||||
- Enable/disable plugins
|
|
||||||
- Configure plugin settings
|
|
||||||
- Create custom themes
|
|
||||||
- Browse the theme store
|
|
||||||
|
|
||||||
### 4. Background Script (`src/background.ts`)
|
|
||||||
Runs in the background and handles:
|
|
||||||
- Extension-wide settings storage
|
|
||||||
- Communication between different parts
|
|
||||||
- Update notifications
|
|
||||||
|
|
||||||
## Plugin System
|
|
||||||
|
|
||||||
Our plugin system is what makes BetterSEQTA+ so powerful. Here's how it works:
|
|
||||||
|
|
||||||
### Plugin Lifecycle
|
|
||||||
```
|
|
||||||
Plugin Registration → Settings Loading → Plugin Initialization → Running → Cleanup
|
|
||||||
```
|
|
||||||
|
|
||||||
### Built-in Plugins Overview
|
|
||||||
|
|
||||||
| Plugin | What it does | Files |
|
|
||||||
|--------|-------------|-------|
|
|
||||||
| **Themes** | Custom CSS themes and backgrounds | `src/plugins/built-in/themes/` |
|
|
||||||
| **Global Search** | Search across all SEQTA content | `src/plugins/built-in/globalSearch/` |
|
|
||||||
| **Timetable** | Enhanced timetable features | `src/plugins/built-in/timetable/` |
|
|
||||||
| **Profile Picture** | Custom profile pictures | `src/plugins/built-in/profilePicture/` |
|
|
||||||
| **Animated Background** | Moving background animations | `src/plugins/built-in/animatedBackground/` |
|
|
||||||
|
|
||||||
### Creating a Plugin
|
|
||||||
Every plugin follows this structure:
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "unique-plugin-id",
|
|
||||||
name: "Human Readable Name",
|
|
||||||
description: "What does this plugin do?",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: { /* user configurable options */ },
|
|
||||||
run: async (api) => {
|
|
||||||
// Your plugin code goes here!
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## File Structure Explained
|
|
||||||
|
|
||||||
```
|
|
||||||
src/
|
|
||||||
├── SEQTA.ts # 🚀 Main entry point - start reading here!
|
|
||||||
├── background.ts # 🔧 Background script for extension
|
|
||||||
├── manifests/ # 📦 Browser extension manifests
|
|
||||||
├── plugins/ # 🧩 Plugin system (the magic happens here!)
|
|
||||||
│ ├── core/ # 🏗️ Plugin infrastructure
|
|
||||||
│ ├── built-in/ # 🎁 Pre-made plugins
|
|
||||||
│ └── index.ts # 📋 Plugin registration
|
|
||||||
├── interface/ # 🎨 Settings UI (Svelte app)
|
|
||||||
│ ├── pages/ # 📄 Settings pages
|
|
||||||
│ ├── components/ # 🧱 Reusable UI components
|
|
||||||
│ └── main.ts # 🏠 Settings app entry point
|
|
||||||
├── seqta/ # 🔗 SEQTA-specific utilities
|
|
||||||
│ ├── main.ts # 🎯 Core SEQTA modifications
|
|
||||||
│ ├── ui/ # 🎨 UI manipulation helpers
|
|
||||||
│ └── utils/ # 🛠️ Helper functions
|
|
||||||
└── css/ # 💄 Styles and themes
|
|
||||||
```
|
|
||||||
|
|
||||||
### Where to Start Reading?
|
|
||||||
1. **New to the project?** Start with `src/SEQTA.ts`
|
|
||||||
2. **Want to understand plugins?** Look at `src/plugins/core/types.ts`
|
|
||||||
3. **Want to see a simple plugin?** Check out `src/plugins/built-in/profilePicture/`
|
|
||||||
4. **Interested in the UI?** Explore `src/interface/main.ts`
|
|
||||||
|
|
||||||
## Data Flow
|
|
||||||
|
|
||||||
Here's how data flows through the system:
|
|
||||||
|
|
||||||
```
|
|
||||||
User visits SEQTA → SEQTA.ts detects page → Loads settings from storage
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
Plugin Manager initializes → Each plugin gets API access → Plugins modify SEQTA
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
User opens settings → Svelte UI loads → Settings changed → Storage updated
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
Storage change detected → Plugins notified → UI updates automatically
|
|
||||||
```
|
|
||||||
|
|
||||||
## Browser Extension Basics
|
|
||||||
|
|
||||||
Never worked on a browser extension before? Here's what you need to know:
|
|
||||||
|
|
||||||
### Content Scripts vs Background Scripts
|
|
||||||
- **Content Script** (`SEQTA.ts`): Runs on SEQTA pages, can access and modify the page
|
|
||||||
- **Background Script** (`background.ts`): Runs in the background, handles storage and messaging
|
|
||||||
|
|
||||||
### Manifest Files
|
|
||||||
Each browser needs a slightly different manifest file:
|
|
||||||
- `manifests/chrome.ts` - Chrome, Edge, Brave
|
|
||||||
- `manifests/firefox.ts` - Firefox
|
|
||||||
- `manifests/safari.ts` - Safari (experimental)
|
|
||||||
|
|
||||||
### Communication
|
|
||||||
Different parts of the extension communicate using:
|
|
||||||
- `browser.runtime.sendMessage()` - Send messages
|
|
||||||
- `browser.storage` - Shared storage, but we have created a custom storage system that is easier to use:
|
|
||||||
```ts
|
|
||||||
settingsState.[the setting name] = [whatever you want to set it to]
|
|
||||||
console.log(settingsState.[the setting name])
|
|
||||||
```
|
|
||||||
- Custom events for plugin communication
|
|
||||||
|
|
||||||
## Development Tips
|
|
||||||
|
|
||||||
### Debugging
|
|
||||||
1. **Chrome DevTools**: Right-click → Inspect → Console tab
|
|
||||||
2. **Extension Console**: `chrome://extensions` → BetterSEQTA+ → "Inspect views: background page"
|
|
||||||
3. **Look for logs**: We log everything with `[BetterSEQTA+]` prefix
|
|
||||||
|
|
||||||
### Making Changes
|
|
||||||
1. Edit code → Save → Browser auto-reloads extension → Refresh SEQTA page
|
|
||||||
2. For UI changes: The dev server hot-reloads automatically
|
|
||||||
3. For plugin changes: May need to disable/enable the plugin in settings
|
|
||||||
|
|
||||||
### Common Gotchas
|
|
||||||
- Settings take a moment to load (use `api.settings.loaded` promise)
|
|
||||||
- Some SEQTA elements load dynamically (use `api.seqta.onMount()`)
|
|
||||||
- Plugin cleanup is important (always return a cleanup function)
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Ready to contribute? Here's what to do next:
|
|
||||||
|
|
||||||
1. **Read the code**: Start with `src/SEQTA.ts` and follow the flow
|
|
||||||
2. **Try creating a simple plugin**: Follow the [plugin documentation](https://docs.betterseqta.org/plugins/)
|
|
||||||
3. **Look at existing issues**: Check our [GitHub issues](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues) for "good first issue" labels
|
|
||||||
4. **Join our Discord**: Get help from the community!
|
|
||||||
|
|
||||||
## Questions?
|
|
||||||
|
|
||||||
Still confused about something? That's totally normal! Here are your options:
|
|
||||||
- 💬 Ask in our [Discord server](https://discord.gg/YzmbnCDkat)
|
|
||||||
- 🐛 Open an issue on GitHub
|
|
||||||
- 📧 Email us at betterseqta.plus@gmail.com
|
|
||||||
|
|
||||||
Remember: **Every expert was once a beginner!** We're here to help you learn and contribute. 🚀
|
|
||||||
+406
-429
File diff suppressed because it is too large.
Load diff
@@ -74,7 +74,7 @@ Returns the caller’s latest settings backup.
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"themeId": "uuid-string-or-empty",
|
"themeId": "uuid-string-or-empty",
|
||||||
"data": { },
|
"data": {},
|
||||||
"updated_at": "2026-04-07T12:00:00.000Z"
|
"updated_at": "2026-04-07T12:00:00.000Z"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -96,11 +96,11 @@ The extension resolves **`themeId`** (if non-empty), else **`data.selectedTheme`
|
|||||||
|
|
||||||
Example relational layout:
|
Example relational layout:
|
||||||
|
|
||||||
| Column | Type | Notes |
|
| Column | Type | Notes |
|
||||||
|---------------|-------------|--------|
|
| ------------ | ------------ | -------------------------------------------------------------------------------------- |
|
||||||
| `user_id` | FK → users | Unique per backup row (one row per user). |
|
| `user_id` | FK → users | Unique per backup row (one row per user). |
|
||||||
| `payload` | JSON / JSONB| Store `{ "schemaVersion", "data" }` or only `data` + separate `schema_version` column. |
|
| `payload` | JSON / JSONB | Store `{ "schemaVersion", "data" }` or only `data` + separate `schema_version` column. |
|
||||||
| `updated_at` | timestamptz | Set on each successful `PUT`. |
|
| `updated_at` | timestamptz | Set on each successful `PUT`. |
|
||||||
|
|
||||||
Unique constraint on `user_id`.
|
Unique constraint on `user_id`.
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ The extension may call **`GET /api/user/cloud-summary`** (same host, `Authorizat
|
|||||||
- **Auto-sync flow:** compare `bsplus.updated_at` to a **client-only** watermark stored in extension storage as **`bsplus_cloud_settings_known_remote_updated_at`** (never uploaded, never applied from the server payload; preserved on restore).
|
- **Auto-sync flow:** compare `bsplus.updated_at` to a **client-only** watermark stored in extension storage as **`bsplus_cloud_settings_known_remote_updated_at`** (never uploaded, never applied from the server payload; preserved on restore).
|
||||||
- If the server timestamp is newer (and `schemaVersion` is not ahead of the client), the client then calls **`GET /api/bsplus/settings/sync`** and applies the full envelope as usual.
|
- If the server timestamp is newer (and `schemaVersion` is not ahead of the client), the client then calls **`GET /api/bsplus/settings/sync`** and applies the full envelope as usual.
|
||||||
|
|
||||||
This uses standard **WebExtension** APIs (`browser.alarms`, `runtime` messages, `storage`) and works on **Chromium and Firefox** builds (see `webextension-polyfill`).
|
This uses standard **WebExtension** APIs (`browser.alarms`, `runtime` messages, `storage`) and works on **Chromium and Firefox** builds.
|
||||||
|
|
||||||
## Client reference (extension)
|
## Client reference (extension)
|
||||||
|
|
||||||
|
|||||||
@@ -1,287 +0,0 @@
|
|||||||
# Getting Started as a Contributor
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/contributing/](https://docs.betterseqta.org/contributing/)
|
|
||||||
|
|
||||||
Welcome to BetterSEQTA+! 🎉 This guide will walk you through making your first contribution, even if you're completely new to the project.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Before You Start](#before-you-start)
|
|
||||||
- [Your First 30 Minutes](#your-first-30-minutes)
|
|
||||||
- [Making Your First Contribution](#making-your-first-contribution)
|
|
||||||
- [Types of Contributions](#types-of-contributions)
|
|
||||||
- [Finding Something to Work On](#finding-something-to-work-on)
|
|
||||||
- [Development Workflow](#development-workflow)
|
|
||||||
- [Getting Help](#getting-help)
|
|
||||||
|
|
||||||
## Before You Start
|
|
||||||
|
|
||||||
### What You'll Need
|
|
||||||
- **Node.js** (v16 or higher) - [Download here](https://nodejs.org/)
|
|
||||||
- **Git** - [Download here](https://git-scm.com/)
|
|
||||||
- **A code editor** - We recommend [VS Code](https://code.visualstudio.com/)
|
|
||||||
- **A Chromium browser** (Chrome, Edge, Brave) for testing (recommended, however you can use firefox although it requires being built every time you make a change)
|
|
||||||
|
|
||||||
### Helpful Background (but not required!)
|
|
||||||
- Basic JavaScript/TypeScript knowledge
|
|
||||||
- Some familiarity with HTML/CSS
|
|
||||||
- Understanding of browser extensions (we'll teach you!)
|
|
||||||
|
|
||||||
**Don't worry if you're missing some of these!** We're happy to help you learn. 🤗
|
|
||||||
|
|
||||||
## Your First 30 Minutes
|
|
||||||
|
|
||||||
Let's get you up and running quickly:
|
|
||||||
|
|
||||||
### 1. Get the Code (3 minutes)
|
|
||||||
```bash
|
|
||||||
# Fork the repository on GitHub first, then:
|
|
||||||
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-plus.git
|
|
||||||
cd BetterSEQTA-plus
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Install Dependencies (3 minutes)
|
|
||||||
```bash
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Start Development Server (2 minutes)
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Load Extension in Browser (4 minutes)
|
|
||||||
1. Open Chrome and go to `chrome://extensions`
|
|
||||||
2. Enable "Developer mode" (toggle in top right)
|
|
||||||
3. Click "Load unpacked"
|
|
||||||
4. Select the `dist` folder in your project
|
|
||||||
5. Visit a SEQTA Learn page to see BetterSEQTA+ in action!
|
|
||||||
|
|
||||||
### 5. Make a Tiny Change (5 minutes)
|
|
||||||
Let's prove everything works:
|
|
||||||
1. Open `src/seqta/boot.ts`
|
|
||||||
2. Find the line that says `"[BetterSEQTA+] Successfully initialised"`
|
|
||||||
3. Change it to `"[BetterSEQTA+] Successfully initialised - Hello [YOUR_NAME]!"`
|
|
||||||
4. Save the file
|
|
||||||
5. Go to `chrome://extensions`, click the refresh icon on BetterSEQTA+
|
|
||||||
6. Refresh a SEQTA page and check the browser console (F12) - you should see your message!
|
|
||||||
|
|
||||||
### 6. Reset Your Change (3 minutes)
|
|
||||||
```bash
|
|
||||||
git checkout -- src/seqta/boot.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
**Congratulations! 🎉 You've successfully set up BetterSEQTA+ for development!**
|
|
||||||
|
|
||||||
## Making Your First Contribution
|
|
||||||
|
|
||||||
### Easy First Contributions
|
|
||||||
|
|
||||||
Here are some great starter contributions:
|
|
||||||
|
|
||||||
1. **Fix a typo in documentation** - Super easy and always appreciated!
|
|
||||||
2. **Improve error messages** - Make them more helpful
|
|
||||||
3. **Add comments to code** - Help other contributors understand
|
|
||||||
4. **Create a simple plugin** - Follow our plugin guide
|
|
||||||
5. **Fix a bug you found** - If you found a bug, fix it!
|
|
||||||
|
|
||||||
### Step-by-Step: Your First Pull Request
|
|
||||||
|
|
||||||
#### Step 1: Pick an Issue
|
|
||||||
- Go to our [Issues page](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues)
|
|
||||||
- Look for labels like:
|
|
||||||
- `good first issue` - Perfect for beginners
|
|
||||||
- `help wanted` - We'd love help with these
|
|
||||||
- `documentation` - Improve our docs
|
|
||||||
- `bug` - Fix something broken
|
|
||||||
|
|
||||||
#### Step 2: Claim the Issue
|
|
||||||
Comment on the issue saying "I'd like to work on this!" We'll assign it to you.
|
|
||||||
|
|
||||||
#### Step 3: Create a Branch
|
|
||||||
```bash
|
|
||||||
git checkout -b fix-issue-123 # Replace 123 with the issue number
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Step 4: Make Your Changes
|
|
||||||
- Follow the patterns you see in existing code
|
|
||||||
- Test your changes thoroughly
|
|
||||||
- Keep changes focused and small
|
|
||||||
|
|
||||||
#### Step 5: Test Everything
|
|
||||||
```bash
|
|
||||||
# Test the extension still loads
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# Test in browser
|
|
||||||
# 1. Reload extension at chrome://extensions
|
|
||||||
# 2. Visit SEQTA page
|
|
||||||
# 3. Verify everything still works
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Step 6: Commit Your Changes
|
|
||||||
```bash
|
|
||||||
git add .
|
|
||||||
git commit -m "Fix issue #123: Brief description of what you fixed"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Step 7: Push and Create Pull Request
|
|
||||||
```bash
|
|
||||||
git push origin fix-issue-123
|
|
||||||
```
|
|
||||||
|
|
||||||
Then go to GitHub and create a pull request with:
|
|
||||||
- **Clear title**: "Fix issue #123: Brief description"
|
|
||||||
- **Description**: Explain what you changed and why
|
|
||||||
- **Testing**: Describe how you tested it
|
|
||||||
|
|
||||||
## Types of Contributions
|
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
|
||||||
- Fix broken features
|
|
||||||
- Improve error handling
|
|
||||||
- Resolve compatibility issues
|
|
||||||
|
|
||||||
**Example**: "The theme selector doesn't work on Firefox"
|
|
||||||
|
|
||||||
### ✨ New Features
|
|
||||||
- Add new plugins
|
|
||||||
- Enhance existing functionality
|
|
||||||
- Improve user experience
|
|
||||||
|
|
||||||
**Example**: "Add keyboard shortcuts for common actions"
|
|
||||||
|
|
||||||
### 📚 Documentation
|
|
||||||
- Fix typos and unclear explanations
|
|
||||||
- Add examples and tutorials
|
|
||||||
- Improve code comments
|
|
||||||
|
|
||||||
**Example**: "Add more examples to the plugin guide"
|
|
||||||
|
|
||||||
### 🎨 Design & UI
|
|
||||||
- Improve the settings interface
|
|
||||||
- Make things more user-friendly
|
|
||||||
- Add animations and polish
|
|
||||||
|
|
||||||
**Example**: "Make the theme creator more intuitive"
|
|
||||||
|
|
||||||
### 🔧 Technical Improvements
|
|
||||||
- Refactor code for clarity
|
|
||||||
- Add tests
|
|
||||||
- Improve performance
|
|
||||||
|
|
||||||
**Example**: "Simplify the plugin loading logic"
|
|
||||||
|
|
||||||
## Finding Something to Work On
|
|
||||||
|
|
||||||
### Browse Issues by Label
|
|
||||||
- [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/good%20first%20issue) - Perfect for beginners
|
|
||||||
- [`help wanted`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/help%20wanted) - We need help with these
|
|
||||||
- [`documentation`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/documentation) - Improve our docs
|
|
||||||
- [`bug`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/bug) - Fix something broken
|
|
||||||
- [`enhancement`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/enhancement) - Add new features
|
|
||||||
|
|
||||||
### Create Your Own Issue
|
|
||||||
Found a bug or have an idea? Create an issue first to discuss it!
|
|
||||||
|
|
||||||
### Plugin Ideas
|
|
||||||
Want to create a plugin? Here are some ideas:
|
|
||||||
- **Study Timer**: Track study time across SEQTA pages
|
|
||||||
- **Grade Tracker**: Better visualization of grades over time
|
|
||||||
- **Quick Notes**: Add notes to any SEQTA page
|
|
||||||
- **Homework Reminder**: Smart notifications for upcoming due dates
|
|
||||||
- **Custom Shortcuts**: User-defined keyboard shortcuts
|
|
||||||
|
|
||||||
## Development Workflow
|
|
||||||
|
|
||||||
### Daily Development
|
|
||||||
```bash
|
|
||||||
# Start working
|
|
||||||
git pull origin main
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# Make changes, test, commit
|
|
||||||
git add .
|
|
||||||
git commit -m "Descriptive commit message"
|
|
||||||
|
|
||||||
# Push when ready
|
|
||||||
git push origin your-branch-name
|
|
||||||
```
|
|
||||||
|
|
||||||
### Before Submitting PR
|
|
||||||
1. **Test thoroughly** - Make sure nothing breaks
|
|
||||||
2. **Check console** - No new errors
|
|
||||||
3. **Test in different browsers** - Chrome and Firefox
|
|
||||||
4. **Update documentation** - If you changed how something works
|
|
||||||
|
|
||||||
### Code Style
|
|
||||||
- Use TypeScript where possible
|
|
||||||
- Follow existing naming conventions
|
|
||||||
- Add comments for complex logic
|
|
||||||
- Keep functions small and focused
|
|
||||||
|
|
||||||
## Getting Help
|
|
||||||
|
|
||||||
### Stuck? Here's How to Get Unstuck
|
|
||||||
|
|
||||||
1. **Check the docs** - The [architecture guide](https://docs.betterseqta.org/architecture/) explains everything
|
|
||||||
2. **Search existing issues** - Someone might have had the same problem
|
|
||||||
3. **Ask in Discord** - Our community is super helpful
|
|
||||||
4. **Create an issue** - If you found a bug or need help
|
|
||||||
|
|
||||||
### Discord Community
|
|
||||||
Join our [Discord server](https://discord.gg/YzmbnCDkat) for:
|
|
||||||
- Real-time help and discussion
|
|
||||||
- Collaboration on features
|
|
||||||
- Sharing ideas and feedback
|
|
||||||
- Getting to know the community
|
|
||||||
|
|
||||||
### Code Review Process
|
|
||||||
- All contributions need code review
|
|
||||||
- We'll provide helpful feedback
|
|
||||||
- Don't worry about making mistakes - we're here to help!
|
|
||||||
- Reviews usually happen within 24-48 hours
|
|
||||||
|
|
||||||
## Common Questions
|
|
||||||
|
|
||||||
**Q: I'm new to browser extensions. Is this too advanced for me?**
|
|
||||||
A: Not at all! We have lots of beginner-friendly issues, and our plugin system makes it easy to add features without understanding all the browser extension complexities.
|
|
||||||
|
|
||||||
**Q: How long does it take to get my first PR merged?**
|
|
||||||
A: For simple fixes, usually 1-3 days. For larger features, it might take a week or two as we discuss the best approach.
|
|
||||||
|
|
||||||
**Q: I made a mistake in my PR. What do I do?**
|
|
||||||
A: No worries! Just push more commits to the same branch and they'll be added to your PR automatically.
|
|
||||||
|
|
||||||
**Q: Can I work on multiple issues at once?**
|
|
||||||
A: It's better to focus on one issue at a time, especially when starting out. This makes code review easier and reduces conflicts.
|
|
||||||
|
|
||||||
**Q: What if I start working on something and get stuck?**
|
|
||||||
A: Ask for help! Create a draft PR with what you have so far, and we'll help you figure out the next steps.
|
|
||||||
|
|
||||||
## Recognition
|
|
||||||
|
|
||||||
All contributors get:
|
|
||||||
- Recognition in our README
|
|
||||||
- Contributor badge in Discord
|
|
||||||
- Our eternal gratitude! 🙏
|
|
||||||
|
|
||||||
Significant contributors may also get:
|
|
||||||
- Special Discord roles
|
|
||||||
- Input on project direction
|
|
||||||
- Maintainer status
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Ready to contribute? Here's what to do:
|
|
||||||
|
|
||||||
1. ✅ **Set up your development environment** (follow the 30-minute guide above)
|
|
||||||
2. 🔍 **Find an issue to work on** (check the "good first issue" label)
|
|
||||||
3. 💬 **Join our Discord** and introduce yourself
|
|
||||||
4. 🚀 **Make your first contribution** and submit a PR
|
|
||||||
|
|
||||||
Remember: **Every expert was once a beginner!** We're excited to help you learn and grow as a contributor. Welcome to the team! 🎉
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
*Questions? Suggestions for improving this guide? Open an issue or message us on Discord!*
|
|
||||||
+14
-51
@@ -1,56 +1,19 @@
|
|||||||
# BetterSEQTA+ Documentation
|
# Docs
|
||||||
|
|
||||||
**Canonical documentation lives at [docs.betterseqta.org](https://docs.betterseqta.org/).** The pages below are the same topics; use the site for search, navigation, and the latest updates.
|
The main documentation lives at **[docs.betterseqta.org](https://docs.betterseqta.org/)**, built from [BetterSEQTA-Docs](https://github.com/BetterSEQTA/BetterSEQTA-Docs). Send fixes for those pages there.
|
||||||
|
|
||||||
## Table of Contents
|
| Topic | Where |
|
||||||
|
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| Installing | [docs.betterseqta.org/install](https://docs.betterseqta.org/install/) |
|
||||||
|
| Architecture | [docs.betterseqta.org/architecture](https://docs.betterseqta.org/architecture/) |
|
||||||
|
| Writing plugins | [Plugin development](https://docs.betterseqta.org/plugin-development/), [Plugin API](https://docs.betterseqta.org/plugin-api/), [Example plugin](https://docs.betterseqta.org/example-plugin/) |
|
||||||
|
| Making themes | [docs.betterseqta.org/theme-creation](https://docs.betterseqta.org/theme-creation/) |
|
||||||
|
| Troubleshooting | [docs.betterseqta.org/troubleshooting](https://docs.betterseqta.org/troubleshooting/) |
|
||||||
|
|
||||||
### Getting Started
|
These pages only live in this repo because they track the code closely:
|
||||||
|
|
||||||
- [Documentation home](https://docs.betterseqta.org/)
|
- [RELEASES.md](RELEASES.md): CI, stable and nightly releases, and the update badge.
|
||||||
- [Installation](https://docs.betterseqta.org/install/)
|
- [CLOUD_SETTINGS_SYNC_SERVER.md](CLOUD_SETTINGS_SYNC_SERVER.md): the HTTP API the extension expects for cloud settings backup.
|
||||||
- [Contributing](https://docs.betterseqta.org/contributing/)
|
- [CLOUD_SETTINGS_SYNC_OPTIONS.md](CLOUD_SETTINGS_SYNC_OPTIONS.md): every value that goes into a cloud backup and how it is stored.
|
||||||
- [GitHub releases & CI](RELEASES.md) — workflows, nightly builds, update detector
|
|
||||||
- [Architecture](https://docs.betterseqta.org/architecture/)
|
|
||||||
- [Contribution guidelines (repository)](../CONTRIBUTING.md)
|
|
||||||
- [Troubleshooting](https://docs.betterseqta.org/troubleshooting/)
|
|
||||||
|
|
||||||
### Features & customization
|
For contributing, see [CONTRIBUTING.md](../CONTRIBUTING.md).
|
||||||
|
|
||||||
- [Features](https://docs.betterseqta.org/features/)
|
|
||||||
- [Themes & customization](https://docs.betterseqta.org/customization/)
|
|
||||||
- [Theme creation](https://docs.betterseqta.org/theme-creation/)
|
|
||||||
|
|
||||||
### Plugin system
|
|
||||||
|
|
||||||
- [Plugins overview](https://docs.betterseqta.org/plugins/)
|
|
||||||
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
|
|
||||||
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
- [Example plugin](https://docs.betterseqta.org/example-plugin/)
|
|
||||||
|
|
||||||
## Core Concepts
|
|
||||||
|
|
||||||
BetterSEQTA+ is built around several core concepts:
|
|
||||||
|
|
||||||
1. **Plugin System**: BetterSEQTA+ uses a plugin system to extend SEQTA with new features. Plugins are self-contained pieces of code that can be enabled or disabled by the user. See the [plugins documentation](https://docs.betterseqta.org/plugins/).
|
|
||||||
|
|
||||||
2. **Type-Safe Settings**: Each plugin can define settings that are type-safe and automatically rendered in the settings UI. The settings system uses TypeScript decorators to make it easy to define settings with proper typing.
|
|
||||||
|
|
||||||
3. **Storage API**: Plugins can use the Storage API to persist data between sessions. The Storage API is also type-safe, ensuring that plugins can only access their own data.
|
|
||||||
|
|
||||||
4. **SEQTA Integration**: BetterSEQTA+ integrates with SEQTA Learn by injecting code into the page. This allows plugins to modify the SEQTA UI and add new features.
|
|
||||||
|
|
||||||
## Getting Help
|
|
||||||
|
|
||||||
If you need help with BetterSEQTA+, you can:
|
|
||||||
|
|
||||||
- [Open an Issue](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) - Report bugs or request features
|
|
||||||
- [Join the Discord](https://discord.gg/YzmbnCDkat) - Chat with the community
|
|
||||||
- [Email the Maintainers](mailto:betterseqta.plus@gmail.com) - Contact the maintainers directly
|
|
||||||
|
|
||||||
## Contributing to the Documentation
|
|
||||||
|
|
||||||
We welcome contributions to the documentation. The published site is built from the documentation repository; see [Contributing](https://docs.betterseqta.org/contributing/) for how to help.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
BetterSEQTA+ is licensed under the [MIT License](../LICENSE).
|
|
||||||
+36
-245
@@ -1,267 +1,58 @@
|
|||||||
# GitHub releases, CI, and the update detector
|
# Releases, CI and the update badge
|
||||||
|
|
||||||
BetterSEQTA+ is distributed on the Chrome Web Store and Firefox Add-ons, but some users sideload builds from GitHub. This document explains how automated builds, releases, and the in-extension update badge work.
|
BetterSEQTA+ ships through the Chrome Web Store and Firefox Add-ons. GitHub also hosts sideload builds, and those builds can tell users when a newer one is out. This page covers how all of that is built.
|
||||||
|
|
||||||
All published releases target the upstream repository: **[BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**.
|
## Workflows
|
||||||
|
|
||||||
---
|
| Workflow | Runs on | What it does |
|
||||||
|
| ------------------------------------------------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
||||||
|
| [`pr-ci.yml`](../.github/workflows/pr-ci.yml) | Every pull request and push to `main` | Lint, unit tests, then build and smoke test. Uploads the zips as an artifact. |
|
||||||
|
| [`nightly.yml`](../.github/workflows/nightly.yml) | Daily at 13:30 UTC (midnight in Adelaide during daylight saving) | Builds `main` and replaces the assets on the `nightly` prerelease. |
|
||||||
|
|
||||||
## Overview
|
Both build through the shared [`build-extension`](../.github/actions/build-extension/action.yml) action: install with `npm ci`, run `npm run build` for Chrome and Firefox, then zip `dist/chrome` and `dist/firefox`. Nightly publishes with the default `GITHUB_TOKEN`, so it needs no extra secrets.
|
||||||
|
|
||||||
```mermaid
|
## Publishing a stable release
|
||||||
flowchart TB
|
|
||||||
subgraph ci [Continuous integration]
|
|
||||||
PrCi[pr-ci.yml — every PR]
|
|
||||||
Mvp[mvp.yml — push to main]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph releases [GitHub releases]
|
Stable releases are published by hand:
|
||||||
Manual[release.yml — manual stable]
|
|
||||||
Nightly[nightly.yml — daily cron]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph output [Outputs]
|
1. Bump `version` in `package.json` on `main` and push it.
|
||||||
Zips["betterseqtaplus-VERSION-chrome.zip\nbetterseqtaplus-VERSION-firefox.zip"]
|
2. Build with the update checker, then zip:
|
||||||
GhStable["Release tag: 3.7.0"]
|
|
||||||
GhNightly["Release tag: nightly"]
|
|
||||||
Badge[Update badge in settings]
|
|
||||||
end
|
|
||||||
|
|
||||||
PrCi -->|build only| NoRelease[No release]
|
```bash
|
||||||
Mvp -->|artifact| DistZip[dist.zip artifact]
|
GH_RELEASE_UPDATE_CHECK=true UPDATE_CHANNEL=stable npm run build
|
||||||
|
npm run zip
|
||||||
|
```
|
||||||
|
|
||||||
Manual --> Zips
|
3. Run `npm run release`. It creates the release for that version with generated notes and uploads `betterseqtaplus@{version}-chrome.zip` and `-firefox.zip`.
|
||||||
Manual --> GhStable
|
|
||||||
Manual --> Badge
|
|
||||||
|
|
||||||
Nightly --> Zips
|
## Nightly builds
|
||||||
Nightly --> GhNightly
|
|
||||||
Nightly --> Badge
|
|
||||||
```
|
|
||||||
|
|
||||||
| Workflow | Trigger | Creates a release? | Update detector in build? |
|
The `nightly` tag always points at the latest build of `main`. Each run renames the release to `Nightly (YYYY-MM-DD)` and replaces its zips (`betterseqtaplus-nightly-{date}-chrome.zip` and `-firefox.zip`). The release text comes from [`nightly-release-notes.md`](../.github/nightly-release-notes.md) when the release is first created.
|
||||||
|----------|---------|------------------|---------------------------|
|
|
||||||
| `pr-ci.yml` | Every pull request to `main` | No | No |
|
|
||||||
| `mvp.yml` | Every push to `main` | No | No |
|
|
||||||
| `release.yml` | Manual (`workflow_dispatch`) | Yes — stable version tag | Yes — stable channel |
|
|
||||||
| `nightly.yml` | Daily at 03:00 UTC + manual | Yes — reuses `nightly` tag | Yes — nightly channel |
|
|
||||||
|
|
||||||
---
|
Get it from [releases/tag/nightly](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases/tag/nightly).
|
||||||
|
|
||||||
## Shared build action
|
GitHub builds are for sideloading only. Never upload them to an extension store.
|
||||||
|
|
||||||
All release and CI builds that need packaged extensions use the composite action at [`.github/actions/build-extension/action.yml`](../.github/actions/build-extension/action.yml).
|
## Build-time flags
|
||||||
|
|
||||||
It:
|
Release builds pass these into Vite, which bakes them in through `define` in [`vite.config.ts`](../vite.config.ts). Their types live in [`src/env.d.ts`](../src/env.d.ts).
|
||||||
|
|
||||||
1. Installs dependencies (`npm install --legacy-peer-deps`)
|
| Variable | Stable | Nightly | PRs and local builds |
|
||||||
2. Runs `npm run build` (Chrome then Firefox via Vite)
|
| ------------------------- | ------------------------------ | -------------- | -------------------- |
|
||||||
3. Zips each unpacked folder into sideload-ready archives:
|
| `GH_RELEASE_UPDATE_CHECK` | `true` | `true` | unset |
|
||||||
- `dist/betterseqtaplus-{version}-chrome.zip`
|
| `UPDATE_CHANNEL` | `stable` | `nightly` | unset |
|
||||||
- `dist/betterseqtaplus-{version}-firefox.zip`
|
| `GH_RELEASE_REPO` | `BetterSEQTA/BetterSEQTA-Plus` | same | same |
|
||||||
|
| `BUILD_LABEL` | empty | UTC build date | empty |
|
||||||
|
|
||||||
The `{version}` comes from `package.json`.
|
Without `GH_RELEASE_UPDATE_CHECK=true`, the update checker is removed from the bundle entirely.
|
||||||
|
|
||||||
### Build-time flags (release builds only)
|
## Update badge
|
||||||
|
|
||||||
Release and nightly workflows pass environment variables into Vite, which bakes them into the extension at compile time via `define` in [`vite.config.ts`](../vite.config.ts):
|
Release builds show an amber **Update — {version}** pill at the bottom of the settings sidebar when a newer build exists. Clicking it opens the releases page. The logic is in [`src/utils/githubReleaseUpdate.ts`](../src/utils/githubReleaseUpdate.ts):
|
||||||
|
|
||||||
| Variable | Stable release | Nightly | PR / local dev |
|
- **Stable** compares the highest semver release tag (ignoring `nightly`) with the installed version.
|
||||||
|----------|----------------|---------|----------------|
|
- **Nightly** compares the `nightly` release's publish time with the last one seen, stored as `lastSeenNightlyPublishedAt`. The first check after install only records it.
|
||||||
| `GH_RELEASE_UPDATE_CHECK` | `true` | `true` | `false` / unset |
|
|
||||||
| `UPDATE_CHANNEL` | `stable` | `nightly` | `stable` (unused) |
|
|
||||||
| `GH_RELEASE_REPO` | `BetterSEQTA/BetterSEQTA-Plus` | same | same |
|
|
||||||
| `BUILD_LABEL` | empty | UTC build date (`YYYY-MM-DD`) | empty |
|
|
||||||
|
|
||||||
When `GH_RELEASE_UPDATE_CHECK` is not `true`, the update-checker code is tree-shaken out of the bundle. PR CI builds and local `npm run build` do **not** include the update badge.
|
Checks run at most every 6 hours (`localStorage` key `bsplus_lastGhReleaseCheck`).
|
||||||
|
|
||||||
To test a release-style build locally:
|
To test the badge without publishing, turn on dev mode (click the settings logo and type `dev`), then set **GitHub latest version override** in the Advanced section to a higher version such as `9.9.9`.
|
||||||
|
|
||||||
```bash
|
|
||||||
# PowerShell
|
|
||||||
$env:GH_RELEASE_UPDATE_CHECK="true"
|
|
||||||
$env:UPDATE_CHANNEL="stable"
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# bash
|
|
||||||
GH_RELEASE_UPDATE_CHECK=true UPDATE_CHANNEL=stable npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Stable release (`release.yml`)
|
|
||||||
|
|
||||||
**Purpose:** A safe, manual way to publish versioned builds that users can download from GitHub.
|
|
||||||
|
|
||||||
**Trigger:** Manual only — Actions → **Release** → **Run workflow**. There is no schedule or automatic trigger.
|
|
||||||
|
|
||||||
When dispatching, check **“I have already updated the version in package.json”**. The workflow will not run without that confirmation.
|
|
||||||
|
|
||||||
### Before you run it
|
|
||||||
|
|
||||||
1. Merge your changes to `main`.
|
|
||||||
2. Bump `version` in [`package.json`](../package.json) (e.g. `3.7.0` → `3.8.0`).
|
|
||||||
3. Commit and push that bump.
|
|
||||||
|
|
||||||
### What the workflow does
|
|
||||||
|
|
||||||
1. Aborts if the version confirmation was not checked.
|
|
||||||
2. Reads the version from `package.json`.
|
|
||||||
3. Builds Chrome and Firefox with the update detector enabled (stable channel).
|
|
||||||
4. If no release exists for that tag: creates one (e.g. `3.8.0`) with a placeholder description.
|
|
||||||
5. If a release already exists for that tag: **only replaces the zip assets** (`--clobber`). Title and body are left unchanged.
|
|
||||||
6. Uploads `betterseqtaplus-{version}-chrome.zip` and `-firefox.zip`.
|
|
||||||
|
|
||||||
On first publish, edit the **title** and **release notes** on GitHub afterward. Re-running for the same version refreshes the files only.
|
|
||||||
|
|
||||||
### Downloading and installing
|
|
||||||
|
|
||||||
1. Open [github.com/BetterSEQTA/BetterSEQTA-Plus/releases](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases).
|
|
||||||
2. Pick the version you want.
|
|
||||||
3. Download `betterseqtaplus-{version}-chrome.zip` or `-firefox.zip`.
|
|
||||||
4. Unzip and load the unpacked folder as a temporary extension (Chrome: Extensions → Load unpacked; Firefox: `about:debugging` → Load Temporary Add-on).
|
|
||||||
|
|
||||||
**These GitHub builds are for sideloading only. Do not upload them to the Chrome Web Store or Firefox Add-ons.**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Nightly release (`nightly.yml`)
|
|
||||||
|
|
||||||
**Purpose:** Continuous experimental builds from `main` so testers always have a single place to get the latest code.
|
|
||||||
|
|
||||||
**Trigger:**
|
|
||||||
|
|
||||||
- Automatically every day at **03:00 UTC**
|
|
||||||
- Manually via Actions → **Nightly Release** → **Run workflow**
|
|
||||||
|
|
||||||
### What the workflow does
|
|
||||||
|
|
||||||
1. Builds from the current `main` branch with the update detector enabled (nightly channel).
|
|
||||||
2. Uses a fixed release tag: **`nightly`** (marked as prerelease).
|
|
||||||
3. On first run: creates the `nightly` release with the text in [`.github/nightly-release-notes.md`](../.github/nightly-release-notes.md).
|
|
||||||
4. On every run: sets the release title to **`Nightly (YYYY-MM-DD)`** (UTC build date) and **replaces** the zip assets on the same release (`--clobber`). The release body is not rewritten.
|
|
||||||
5. Packages zips as `betterseqtaplus-nightly-{date}-chrome.zip` / `-firefox.zip`.
|
|
||||||
|
|
||||||
The nightly release body warns that builds are experimental and must not be uploaded to extension stores.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## PR CI (`pr-ci.yml`)
|
|
||||||
|
|
||||||
**Purpose:** Verify that every pull request builds cleanly in a fresh environment.
|
|
||||||
|
|
||||||
**Trigger:** Every pull request targeting `main`.
|
|
||||||
|
|
||||||
**Steps:**
|
|
||||||
|
|
||||||
1. `npm install --legacy-peer-deps`
|
|
||||||
2. `npm run lint` (ESLint on `src/**/*.{js,ts}`)
|
|
||||||
3. Build via the shared action with **no** update detector
|
|
||||||
|
|
||||||
No release is created and no artifacts are published for end users.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Push CI (`mvp.yml`)
|
|
||||||
|
|
||||||
**Purpose:** Build verification when code lands on `main`.
|
|
||||||
|
|
||||||
**Trigger:** Push to `main` only (not pull requests — those use `pr-ci.yml`).
|
|
||||||
|
|
||||||
Uploads a `dist.zip` artifact containing the full `dist/` folder for debugging. No release, no update detector.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Authentication
|
|
||||||
|
|
||||||
Release workflows run **only on [BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**. They use the default `GITHUB_TOKEN` with `contents: write` — no extra secrets or PATs required.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Update detector (in-extension)
|
|
||||||
|
|
||||||
GitHub release builds include a small feature that tells sideload users when a newer build is available, so they do not have to check GitHub manually.
|
|
||||||
|
|
||||||
### Where it appears
|
|
||||||
|
|
||||||
In the **settings popup** header (top-right): an amber **“Update available — X.X.X”** pill when an update exists, plus a muted line:
|
|
||||||
|
|
||||||
> GitHub release build — do not upload to extension stores.
|
|
||||||
|
|
||||||
Clicking the badge opens the relevant GitHub releases page.
|
|
||||||
|
|
||||||
### How it checks for updates
|
|
||||||
|
|
||||||
Implementation: [`src/utils/githubReleaseUpdate.ts`](../src/utils/githubReleaseUpdate.ts)
|
|
||||||
|
|
||||||
**Stable channel** (from `release.yml` builds):
|
|
||||||
|
|
||||||
1. Fetches releases from the GitHub API for `BetterSEQTA/BetterSEQTA-Plus`.
|
|
||||||
2. Ignores the `nightly` tag and any non-semver tags.
|
|
||||||
3. Finds the highest semver tag.
|
|
||||||
4. Compares it to `browser.runtime.getManifest().version`.
|
|
||||||
5. Shows the badge if the remote version is newer.
|
|
||||||
|
|
||||||
**Nightly channel** (from `nightly.yml` builds):
|
|
||||||
|
|
||||||
1. Fetches the `nightly` release.
|
|
||||||
2. Compares its `published_at` timestamp to `lastSeenNightlyPublishedAt` in extension storage.
|
|
||||||
3. On first install, records the current publish time without showing a badge.
|
|
||||||
4. Shows **“Update available — nightly (YYYY-MM-DD)”** when a newer nightly has been published.
|
|
||||||
|
|
||||||
Checks are throttled to once every **6 hours** per browser profile (`localStorage` key `bsplus_lastGhReleaseCheck`). Recent results are cached in memory for the session.
|
|
||||||
|
|
||||||
### Dev override (testing)
|
|
||||||
|
|
||||||
To test the badge without publishing a real release:
|
|
||||||
|
|
||||||
1. Open settings and unlock **dev mode** (click the logo, type `dev`).
|
|
||||||
2. In the developer section, set **GitHub latest version override** to a version higher than your installed one (e.g. `9.9.9`).
|
|
||||||
3. Reopen settings — the badge should appear.
|
|
||||||
|
|
||||||
This only applies when dev mode is on. Clear the field to return to normal API checks.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## File reference
|
|
||||||
|
|
||||||
| Path | Role |
|
|
||||||
|------|------|
|
|
||||||
| `.github/actions/build-extension/action.yml` | Shared install, build, zip |
|
|
||||||
| `.github/workflows/release.yml` | Manual stable releases |
|
|
||||||
| `.github/workflows/nightly.yml` | Nightly releases |
|
|
||||||
| `.github/workflows/pr-ci.yml` | PR lint + build |
|
|
||||||
| `.github/workflows/mvp.yml` | Push-to-main build artifact |
|
|
||||||
| `.github/nightly-release-notes.md` | Static body for the `nightly` release |
|
|
||||||
| `vite.config.ts` | Injects build-time `define` flags |
|
|
||||||
| `src/env.d.ts` | TypeScript declarations for those flags |
|
|
||||||
| `src/utils/githubReleaseUpdate.ts` | Update check logic |
|
|
||||||
| `src/interface/pages/settings.svelte` | Badge and disclaimer UI |
|
|
||||||
| `src/interface/pages/settings/general.svelte` | Dev override input |
|
|
||||||
| `src/types/storage.ts` | `devGhReleaseVersionOverride`, `lastSeenNightlyPublishedAt` |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Quick reference
|
|
||||||
|
|
||||||
### Publish a stable release
|
|
||||||
|
|
||||||
```text
|
|
||||||
1. Bump version in package.json on main
|
|
||||||
2. Actions → Release → Run workflow → confirm version checkbox
|
|
||||||
3. Edit release title/notes on GitHub (first time only)
|
|
||||||
4. Re-run with same version to refresh zips without changing release text
|
|
||||||
```
|
|
||||||
|
|
||||||
### Get the latest nightly
|
|
||||||
|
|
||||||
```text
|
|
||||||
https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases/tag/nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
### Verify a PR locally
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run lint
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
@@ -1,587 +0,0 @@
|
|||||||
# Theme Creation Guide
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/theme-creation/](https://docs.betterseqta.org/theme-creation/)
|
|
||||||
|
|
||||||
This guide covers everything you need to know about creating custom themes for BetterSEQTA+.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
1. [Overview](#overview)
|
|
||||||
2. [Theme Structure](#theme-structure)
|
|
||||||
3. [CSS Variables](#css-variables)
|
|
||||||
4. [CSS Selectors & Classes](#css-selectors--classes)
|
|
||||||
5. [Custom Images](#custom-images)
|
|
||||||
6. [Theme Settings](#theme-settings)
|
|
||||||
7. [Best Practices](#best-practices)
|
|
||||||
8. [Examples](#examples)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Themes in BetterSEQTA+ allow you to completely customize the appearance of SEQTA Learn. A theme consists of:
|
|
||||||
|
|
||||||
- **Custom CSS**: CSS rules that override default styles
|
|
||||||
- **Custom Images**: Images that can be referenced via CSS variables
|
|
||||||
- **Theme Metadata**: Name, description, default color, etc.
|
|
||||||
- **Theme Settings**: Options like forcing dark/light mode
|
|
||||||
|
|
||||||
Themes are applied by injecting CSS into the SEQTA page and setting CSS custom properties (variables) on the document root.
|
|
||||||
|
|
||||||
## CSS Variables
|
|
||||||
|
|
||||||
BetterSEQTA+ provides a comprehensive set of CSS variables that you can use in your themes. These variables automatically adapt to light/dark mode and user preferences.
|
|
||||||
|
|
||||||
### Core Background Variables
|
|
||||||
|
|
||||||
| Variable | Light Mode | Dark Mode | Description |
|
|
||||||
|----------|------------|-----------|-------------|
|
|
||||||
| `--background-primary` | `#ffffff` | `#232323` | Main background color |
|
|
||||||
| `--background-secondary` | `#e5e7eb` | `#1a1a1a` | Secondary background color |
|
|
||||||
| `--theme-primary` | `#ffffff` | `#232323` | Primary theme color (same as background-primary) |
|
|
||||||
| `--theme-secondary` | `#e5e7eb` | `#1a1a1a` | Secondary theme color (same as background-secondary) |
|
|
||||||
| `--text-primary` | `black` | `white` | Primary text color |
|
|
||||||
| `--text-color` | `black` | `white` | Text color (alias for text-primary) |
|
|
||||||
|
|
||||||
### BetterSEQTA+ Specific Variables
|
|
||||||
|
|
||||||
| Variable | Description | Notes |
|
|
||||||
|----------|-------------|-------|
|
|
||||||
| `--better-main` | User's selected accent color | Dynamically set based on color picker |
|
|
||||||
| `--better-sub` | Dark navy color | Always `#161616` |
|
|
||||||
| `--better-pale` | Lightened version of accent color | Only available in light mode |
|
|
||||||
| `--better-light` | Lighter version of accent color | Calculated based on brightness |
|
|
||||||
| `--better-alert-highlight` | Alert/highlight color | `#c61851` |
|
|
||||||
| `--betterseqta-logo` | Logo URL | Changes based on dark/light mode |
|
|
||||||
| `--auto-background` | Auto background color | Falls back to `--better-pale` or `--background-secondary` |
|
|
||||||
| `--navy` | Navy color | `#1a1a1a` |
|
|
||||||
| `--theme-fg-parts` | Theme foreground parts | `white` |
|
|
||||||
|
|
||||||
### Subject/Item Color Variables
|
|
||||||
|
|
||||||
| Variable | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `--item-colour` | Subject/item color | Set dynamically per subject/item |
|
|
||||||
| `--colour` | Generic color variable | Used in various contexts |
|
|
||||||
| `--person-colour` | Person/avatar color | `var(--better-light)` for staff |
|
|
||||||
|
|
||||||
### Transparency Effects
|
|
||||||
|
|
||||||
When transparency effects are enabled, background variables become semi-transparent:
|
|
||||||
|
|
||||||
| Variable | Light Mode (Transparent) | Dark Mode (Transparent) |
|
|
||||||
|----------|--------------------------|-------------------------|
|
|
||||||
| `--background-primary` | `rgba(255, 255, 255, 0.6)` | `rgba(35, 35, 35, 0.6)` |
|
|
||||||
| `--background-secondary` | `rgba(229, 231, 235, 0.6)` | `rgba(26, 26, 26, 0.6)` |
|
|
||||||
|
|
||||||
### Using CSS Variables
|
|
||||||
|
|
||||||
You can use these variables in your custom CSS:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Example: Style a custom element */
|
|
||||||
.my-custom-element {
|
|
||||||
background: var(--background-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
border: 1px solid var(--better-main);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Example: Create a gradient */
|
|
||||||
.gradient-box {
|
|
||||||
background: linear-gradient(
|
|
||||||
to bottom,
|
|
||||||
var(--better-main),
|
|
||||||
var(--background-secondary)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## CSS Selectors & Classes
|
|
||||||
|
|
||||||
BetterSEQTA+ uses specific CSS selectors and classes that you can target in your themes. Here are the most important ones:
|
|
||||||
|
|
||||||
### Main Layout Elements
|
|
||||||
|
|
||||||
| Selector | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `#container` | Main container element |
|
|
||||||
| `#content` | Content area |
|
|
||||||
| `#main` | Main content wrapper |
|
|
||||||
| `#title` | Top title bar |
|
|
||||||
| `#menu` | Sidebar menu |
|
|
||||||
|
|
||||||
### Dark Mode
|
|
||||||
|
|
||||||
The `dark` class is added to `html` when dark mode is active:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Target dark mode specifically */
|
|
||||||
html.dark #main {
|
|
||||||
background: var(--background-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Target light mode */
|
|
||||||
html:not(.dark) #main {
|
|
||||||
background: var(--background-primary);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Transparency Effects
|
|
||||||
|
|
||||||
When transparency effects are enabled, the `transparencyEffects` class is added to `html`:
|
|
||||||
|
|
||||||
```css
|
|
||||||
html.transparencyEffects .notice {
|
|
||||||
backdrop-filter: blur(80px);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Common SEQTA Classes
|
|
||||||
|
|
||||||
| Class/Selector | Description |
|
|
||||||
|----------------|-------------|
|
|
||||||
| `.notice` | Notice cards |
|
|
||||||
| `.day` | Day containers in timetable |
|
|
||||||
| `.dashboard` | Dashboard sections |
|
|
||||||
| `.dashlet` | Dashboard widgets |
|
|
||||||
| `.document` | Document elements |
|
|
||||||
| `.quickbar` | Quick action bar |
|
|
||||||
| `.calendar` | Calendar elements |
|
|
||||||
| `.message` | Message elements |
|
|
||||||
| `.thread` | Forum threads |
|
|
||||||
| `.shortcut` | Shortcut buttons |
|
|
||||||
| `.upcoming-assessment` | Upcoming assessments |
|
|
||||||
| `.entry.class` | Timetable entries |
|
|
||||||
|
|
||||||
### BetterSEQTA+ Specific Classes
|
|
||||||
|
|
||||||
| Class | Description |
|
|
||||||
|-------|-------------|
|
|
||||||
| `.addedButton` | BetterSEQTA+ added buttons |
|
|
||||||
| `.tooltip` | Tooltip elements |
|
|
||||||
| `.notice-unified-content` | Unified notice content |
|
|
||||||
| `.home-container` | Home page container |
|
|
||||||
| `.timetable-container` | Timetable container |
|
|
||||||
| `.notices-container` | Notices container |
|
|
||||||
|
|
||||||
### Attribute Selectors
|
|
||||||
|
|
||||||
SEQTA uses data attributes that you can target:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Target specific data types */
|
|
||||||
[data-type="student"] .header {
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Target specific labels */
|
|
||||||
[data-label="inbox"] {
|
|
||||||
/* Styles */
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### CSS Modules
|
|
||||||
|
|
||||||
SEQTA uses CSS modules with hashed class names. You can target them using attribute selectors:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Target CSS module classes */
|
|
||||||
[class*="MessageList__MessageList___"] {
|
|
||||||
background: var(--background-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
[class*="BasicPanel__BasicPanel___"] {
|
|
||||||
border-radius: 16px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Custom Images
|
|
||||||
|
|
||||||
Themes can include custom images that are made available as CSS variables.
|
|
||||||
|
|
||||||
### Adding Images
|
|
||||||
|
|
||||||
1. Upload an image in the theme creator
|
|
||||||
2. Set a CSS variable name (e.g., `custom-background`)
|
|
||||||
3. The image will be available as `var(--custom-background)`
|
|
||||||
|
|
||||||
### Using Image Variables
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Use as background */
|
|
||||||
.my-element {
|
|
||||||
background-image: var(--custom-background);
|
|
||||||
background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use in content */
|
|
||||||
.my-icon::before {
|
|
||||||
content: '';
|
|
||||||
background-image: var(--custom-icon);
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Image Variable Format
|
|
||||||
|
|
||||||
Images are stored as `url()` values:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* The variable contains: url(blob:...) */
|
|
||||||
--custom-background: url(blob:chrome-extension://...);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Theme Settings
|
|
||||||
|
|
||||||
### Force Dark/Light Mode
|
|
||||||
|
|
||||||
You can force a theme to always use dark or light mode:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
forceDark: true // Force dark mode
|
|
||||||
forceDark: false // Force light mode
|
|
||||||
forceDark: undefined // Use user's preference (default)
|
|
||||||
```
|
|
||||||
|
|
||||||
When `forceDark` is set, users cannot toggle dark/light mode while the theme is active.
|
|
||||||
|
|
||||||
### Default Color
|
|
||||||
|
|
||||||
Set a default accent color for your theme:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
defaultColour: "rgba(0, 123, 255, 1)" // Blue
|
|
||||||
defaultColour: "#ff6b6b" // Red (hex format)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Allow Color Changes
|
|
||||||
|
|
||||||
Control whether users can change the accent color:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
CanChangeColour: true // Users can change color
|
|
||||||
CanChangeColour: false // Color is locked
|
|
||||||
```
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
### 1. Use CSS Variables
|
|
||||||
|
|
||||||
Always use CSS variables instead of hardcoded colors:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Good */
|
|
||||||
.my-element {
|
|
||||||
background: var(--background-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bad */
|
|
||||||
.my-element {
|
|
||||||
background: #ffffff;
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Support Both Light and Dark Modes
|
|
||||||
|
|
||||||
Unless your theme forces a specific mode, ensure it works in both:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Use variables that adapt automatically */
|
|
||||||
.my-element {
|
|
||||||
background: var(--background-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Or explicitly handle both modes */
|
|
||||||
html.dark .my-element {
|
|
||||||
background: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
html:not(.dark) .my-element {
|
|
||||||
background: #ffffff;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Use !important Sparingly
|
|
||||||
|
|
||||||
Only use `!important` when necessary to override SEQTA's default styles:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Good - necessary override */
|
|
||||||
#title {
|
|
||||||
background: var(--background-primary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bad - unnecessary */
|
|
||||||
.my-element {
|
|
||||||
color: var(--text-primary) !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Test Responsive Design
|
|
||||||
|
|
||||||
SEQTA is responsive. Test your theme at different screen sizes:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Example: Mobile-specific styles */
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
#menu {
|
|
||||||
transform: translate(-270px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 5. Use Semantic Selectors
|
|
||||||
|
|
||||||
Prefer semantic selectors over fragile ones:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Good - stable selector */
|
|
||||||
#main > .dashboard > section {
|
|
||||||
border-radius: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Caution - CSS module classes may change */
|
|
||||||
[class*="Dashboard__Dashboard___"] {
|
|
||||||
border-radius: 16px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6. Optimize Images
|
|
||||||
|
|
||||||
Keep image file sizes reasonable:
|
|
||||||
|
|
||||||
- Use appropriate formats (PNG for transparency, JPG for photos)
|
|
||||||
- Compress images before uploading
|
|
||||||
- Consider using CSS for simple graphics instead of images
|
|
||||||
|
|
||||||
### 7. Document Your Theme
|
|
||||||
|
|
||||||
Include comments in your CSS explaining complex styles:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/*
|
|
||||||
* Custom gradient background for dashboard
|
|
||||||
* Uses the user's accent color for a cohesive look
|
|
||||||
*/
|
|
||||||
#main > .dashboard {
|
|
||||||
background: linear-gradient(
|
|
||||||
135deg,
|
|
||||||
var(--better-main),
|
|
||||||
var(--background-secondary)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Example 1: Simple Color Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Change accent color throughout */
|
|
||||||
:root {
|
|
||||||
--better-main: #ff6b6b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Style the menu */
|
|
||||||
#menu {
|
|
||||||
background: var(--background-primary);
|
|
||||||
border-right: 3px solid var(--better-main);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Style buttons */
|
|
||||||
.uiButton {
|
|
||||||
background: var(--better-main);
|
|
||||||
color: var(--text-color);
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 2: Custom Background Image
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Use a custom background image */
|
|
||||||
body {
|
|
||||||
background-image: var(--custom-background);
|
|
||||||
background-size: cover;
|
|
||||||
background-attachment: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add overlay for readability */
|
|
||||||
#main::before {
|
|
||||||
content: '';
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.3);
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 3: Rounded Corners Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Make everything more rounded */
|
|
||||||
#main > .dashboard > section,
|
|
||||||
.dashlet,
|
|
||||||
.notice,
|
|
||||||
.document {
|
|
||||||
border-radius: 20px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Round buttons */
|
|
||||||
.uiButton {
|
|
||||||
border-radius: 25px !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 4: Minimal Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Remove shadows and borders */
|
|
||||||
#main > .dashboard > section,
|
|
||||||
.dashlet,
|
|
||||||
.notice {
|
|
||||||
box-shadow: none !important;
|
|
||||||
border: 1px solid var(--background-secondary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Simplify colors */
|
|
||||||
#menu {
|
|
||||||
background: var(--background-primary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove gradients */
|
|
||||||
.day {
|
|
||||||
background: var(--background-primary) !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 5: High Contrast Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Increase contrast */
|
|
||||||
:root {
|
|
||||||
--background-primary: #000000;
|
|
||||||
--background-secondary: #1a1a1a;
|
|
||||||
--text-primary: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
html:not(.dark) {
|
|
||||||
--background-primary: #ffffff;
|
|
||||||
--background-secondary: #f0f0f0;
|
|
||||||
--text-primary: #000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add borders for clarity */
|
|
||||||
.dashlet,
|
|
||||||
.notice,
|
|
||||||
.document {
|
|
||||||
border: 2px solid var(--better-main) !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Advanced Techniques
|
|
||||||
|
|
||||||
### CSS Custom Properties Override
|
|
||||||
|
|
||||||
You can override CSS variables in your theme:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Override a variable */
|
|
||||||
:root {
|
|
||||||
--better-main: #your-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Override conditionally */
|
|
||||||
html.dark {
|
|
||||||
--background-primary: #your-dark-color;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Animations
|
|
||||||
|
|
||||||
Add smooth transitions:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Smooth color transitions */
|
|
||||||
#menu li {
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hover effects */
|
|
||||||
.dashlet:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pseudo-elements
|
|
||||||
|
|
||||||
Use pseudo-elements for decorative elements:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Add decorative border */
|
|
||||||
.notice::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 4px;
|
|
||||||
background: var(--better-main);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Theme Not Applying
|
|
||||||
|
|
||||||
1. Check browser console for CSS errors
|
|
||||||
2. Verify CSS syntax is correct
|
|
||||||
3. Ensure selectors are specific enough
|
|
||||||
4. Check if `!important` is needed
|
|
||||||
|
|
||||||
### Colors Not Changing
|
|
||||||
|
|
||||||
1. Verify you're using CSS variables
|
|
||||||
2. Check if `forceDark` is overriding your styles
|
|
||||||
3. Ensure variables are set on `:root` or `html`
|
|
||||||
|
|
||||||
### Images Not Showing
|
|
||||||
|
|
||||||
1. Verify image variable name matches CSS
|
|
||||||
2. Check image format is supported
|
|
||||||
3. Ensure image size is reasonable
|
|
||||||
4. Verify `url()` wrapper in CSS
|
|
||||||
|
|
||||||
### Dark Mode Issues
|
|
||||||
|
|
||||||
1. Test with `forceDark: true` and `forceDark: false`
|
|
||||||
2. Check if transparency effects are interfering
|
|
||||||
3. Verify `html.dark` selector is correct
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
- **Theme Creator**: Access via BetterSEQTA+ settings
|
|
||||||
- **CSS Variables Reference**: See [CSS Variables](#css-variables) section above
|
|
||||||
- **SEQTA DOM Structure**: Inspect SEQTA pages in browser DevTools
|
|
||||||
- **BetterSEQTA+ Source**: Check `src/css/injected.scss` for default styles
|
|
||||||
|
|
||||||
## Contributing Themes
|
|
||||||
|
|
||||||
If you create a great theme, consider sharing it:
|
|
||||||
|
|
||||||
1. Export your theme (Share button in theme creator)
|
|
||||||
2. Submit to the BetterSEQTA+ theme store
|
|
||||||
3. Or share on GitHub/Discord
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Note**: This documentation is based on BetterSEQTA+ v3.4.13. Some details may change in future versions.
|
|
||||||
|
|
||||||
@@ -1,350 +0,0 @@
|
|||||||
# Troubleshooting Guide
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/troubleshooting/](https://docs.betterseqta.org/troubleshooting/)
|
|
||||||
|
|
||||||
Having issues with BetterSEQTA+ development? This guide covers the most common problems and their solutions.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Installation Issues](#installation-issues)
|
|
||||||
- [Development Server Issues](#development-server-issues)
|
|
||||||
- [Browser Extension Issues](#browser-extension-issues)
|
|
||||||
- [Plugin Development Issues](#plugin-development-issues)
|
|
||||||
- [Build Issues](#build-issues)
|
|
||||||
- [Still Stuck?](#still-stuck)
|
|
||||||
|
|
||||||
## Installation Issues
|
|
||||||
|
|
||||||
### ❌ "npm install" fails with peer dependency errors
|
|
||||||
|
|
||||||
**Problem**: You see errors about peer dependencies or conflicting packages.
|
|
||||||
|
|
||||||
**Solution**:
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules package-lock.json
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ "Cannot find module" errors
|
|
||||||
|
|
||||||
**Problem**: Node.js can't find required packages.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Clear and reinstall**:
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Check Node.js version**:
|
|
||||||
```bash
|
|
||||||
node --version # Should be v16 or higher
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Try with npm cache clean**:
|
|
||||||
```bash
|
|
||||||
npm cache clean --force
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ Permission errors on macOS/Linux
|
|
||||||
|
|
||||||
**Problem**: "EACCES" or permission denied errors.
|
|
||||||
|
|
||||||
**Solution**:
|
|
||||||
```bash
|
|
||||||
sudo chown -R $(whoami) ~/.npm
|
|
||||||
sudo chown -R $(whoami) /usr/local/lib/node_modules
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development Server Issues
|
|
||||||
|
|
||||||
### ❌ "npm run dev" fails
|
|
||||||
|
|
||||||
**Problem**: Development server won't start.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check if port is in use**:
|
|
||||||
```bash
|
|
||||||
lsof -i :5173 # Kill the process using the port
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Clear dist folder**:
|
|
||||||
```bash
|
|
||||||
rm -rf dist
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check for TypeScript errors**:
|
|
||||||
```bash
|
|
||||||
npx tsc --noEmit # Check for type errors
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ Changes not reflecting in browser
|
|
||||||
|
|
||||||
**Problem**: You make code changes but don't see them in the browser.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Reload the extension**:
|
|
||||||
- Go to `chrome://extensions`
|
|
||||||
- Find BetterSEQTA+ and click the refresh icon
|
|
||||||
- Refresh your SEQTA page
|
|
||||||
|
|
||||||
2. **Check if dev server is running**:
|
|
||||||
- Look for "Build completed" in your terminal
|
|
||||||
- If not, restart `npm run dev`
|
|
||||||
|
|
||||||
3. **Hard refresh the page**:
|
|
||||||
- Press `Ctrl+Shift+R` (or `Cmd+Shift+R` on Mac)
|
|
||||||
|
|
||||||
## Browser Extension Issues
|
|
||||||
|
|
||||||
### ❌ Extension doesn't load in Chrome
|
|
||||||
|
|
||||||
**Problem**: Extension appears in `chrome://extensions` but doesn't work.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check for errors**:
|
|
||||||
- Go to `chrome://extensions`
|
|
||||||
- Click "Errors" button on BetterSEQTA+
|
|
||||||
- Fix any JavaScript errors shown
|
|
||||||
|
|
||||||
2. **Verify manifest**:
|
|
||||||
- Check if `dist/manifest.json` exists
|
|
||||||
- Ensure it has proper structure
|
|
||||||
|
|
||||||
3. **Check permissions**:
|
|
||||||
- Extension needs permission to access SEQTA pages
|
|
||||||
- Click "Details" → "Site access" → "On all sites"
|
|
||||||
|
|
||||||
### ❌ Extension doesn't appear on SEQTA pages
|
|
||||||
|
|
||||||
**Problem**: Extension loads but doesn't modify SEQTA.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check if you're on a SEQTA Learn page**:
|
|
||||||
- URL should contain "seqta" or "learn"
|
|
||||||
- Page title should include "SEQTA Learn"
|
|
||||||
|
|
||||||
2. **Check browser console**:
|
|
||||||
- Press `F12` → Console tab
|
|
||||||
- Look for "[BetterSEQTA+]" messages
|
|
||||||
- If no messages, extension isn't running
|
|
||||||
|
|
||||||
3. **Verify page detection**:
|
|
||||||
- Extension only runs on actual SEQTA Learn pages
|
|
||||||
- Test on a real SEQTA instance
|
|
||||||
|
|
||||||
### ❌ Settings page won't open
|
|
||||||
|
|
||||||
**Problem**: Clicking the extension icon doesn't open settings.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check popup errors**:
|
|
||||||
- Right-click extension icon → "Inspect popup"
|
|
||||||
- Look for JavaScript errors
|
|
||||||
|
|
||||||
2. **Clear extension storage**:
|
|
||||||
```javascript
|
|
||||||
// In browser console on any page:
|
|
||||||
chrome.storage.local.clear()
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Reload extension and try again**
|
|
||||||
|
|
||||||
## Plugin Development Issues
|
|
||||||
|
|
||||||
### ❌ My plugin doesn't appear in settings
|
|
||||||
|
|
||||||
**Problem**: Created a plugin but it's not showing up.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check plugin registration**:
|
|
||||||
- Ensure your plugin is imported in `src/plugins/index.ts`
|
|
||||||
- Verify `pluginManager.registerPlugin(yourPlugin)` is called
|
|
||||||
|
|
||||||
2. **Check plugin structure**:
|
|
||||||
```typescript
|
|
||||||
// Ensure your plugin has all required fields
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "unique-id", // Must be unique
|
|
||||||
name: "Display Name",
|
|
||||||
description: "What it does",
|
|
||||||
version: "1.0.0",
|
|
||||||
run: async (api) => {
|
|
||||||
// Your code here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check for errors**:
|
|
||||||
- Look in browser console for plugin loading errors
|
|
||||||
|
|
||||||
### ❌ Plugin settings not working
|
|
||||||
|
|
||||||
**Problem**: Plugin settings don't save or load properly.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check settings definition**:
|
|
||||||
```typescript
|
|
||||||
import { defineSettings, booleanSetting } from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
const settings = defineSettings({
|
|
||||||
myOption: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "My Option",
|
|
||||||
description: "What this does"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Wait for settings to load**:
|
|
||||||
```typescript
|
|
||||||
run: async (api) => {
|
|
||||||
await api.settings.loaded; // Wait for settings to load
|
|
||||||
console.log(api.settings.myOption); // Now you can use settings
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ Plugin API functions not working
|
|
||||||
|
|
||||||
**Problem**: `api.seqta.onMount()` or other API functions don't work.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check selector specificity**:
|
|
||||||
```typescript
|
|
||||||
// Be specific with selectors
|
|
||||||
api.seqta.onMount(".home-page", (element) => {
|
|
||||||
// Your code
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Wait for elements**:
|
|
||||||
```typescript
|
|
||||||
// Some elements load after page navigation
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
if (page === "home") {
|
|
||||||
api.seqta.onMount(".home-content", (element) => {
|
|
||||||
// Now element should exist
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build Issues
|
|
||||||
|
|
||||||
### ❌ "npm run build" fails
|
|
||||||
|
|
||||||
**Problem**: Production build fails with errors.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check TypeScript errors**:
|
|
||||||
```bash
|
|
||||||
npx tsc --noEmit
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Clear cache and rebuild**:
|
|
||||||
```bash
|
|
||||||
rm -rf dist node_modules
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check for import errors**:
|
|
||||||
- Ensure all imports use correct paths
|
|
||||||
- Check for missing files
|
|
||||||
|
|
||||||
### ❌ Built extension doesn't work
|
|
||||||
|
|
||||||
**Problem**: `npm run build` succeeds but extension doesn't work.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Test the built extension**:
|
|
||||||
- Load the `dist` folder as unpacked extension
|
|
||||||
- Check console for errors
|
|
||||||
|
|
||||||
2. **Compare with dev version**:
|
|
||||||
- If dev works but build doesn't, there might be a build configuration issue
|
|
||||||
|
|
||||||
3. **Check manifest generation**:
|
|
||||||
- Verify `dist/manifest.json` looks correct
|
|
||||||
- Compare with working version
|
|
||||||
|
|
||||||
## Common Error Messages
|
|
||||||
|
|
||||||
### "Cannot access contents of the URL"
|
|
||||||
- **Cause**: Extension permissions issue
|
|
||||||
- **Fix**: Go to `chrome://extensions` → BetterSEQTA+ → Details → Site access → "On all sites"
|
|
||||||
|
|
||||||
### "Extension context invalidated"
|
|
||||||
- **Cause**: Extension was reloaded while page was open
|
|
||||||
- **Fix**: Refresh the SEQTA page
|
|
||||||
|
|
||||||
### "Uncaught ReferenceError: browser is not defined"
|
|
||||||
- **Cause**: Missing webextension-polyfill import
|
|
||||||
- **Fix**: Add `import browser from "webextension-polyfill";` at top of file
|
|
||||||
|
|
||||||
### "Module not found: Can't resolve '@/...' "
|
|
||||||
- **Cause**: TypeScript path mapping issue
|
|
||||||
- **Fix**: Check `tsconfig.json` and `vite.config.ts` for path configuration
|
|
||||||
|
|
||||||
## Performance Issues
|
|
||||||
|
|
||||||
### Extension makes SEQTA slow
|
|
||||||
1. **Check for memory leaks**:
|
|
||||||
- Use Chrome DevTools → Performance tab
|
|
||||||
- Look for growing memory usage
|
|
||||||
|
|
||||||
2. **Optimize plugin code**:
|
|
||||||
- Remove unnecessary listeners
|
|
||||||
- Clean up intervals/timeouts
|
|
||||||
- Use efficient selectors
|
|
||||||
|
|
||||||
3. **Profile your changes**:
|
|
||||||
- Test with extension disabled vs enabled
|
|
||||||
- Identify which plugin is causing issues
|
|
||||||
|
|
||||||
## Still Stuck?
|
|
||||||
|
|
||||||
If none of these solutions work:
|
|
||||||
|
|
||||||
1. **🔍 Search existing issues**: [GitHub Issues](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues)
|
|
||||||
|
|
||||||
2. **💬 Ask on Discord**: [Join our server](https://discord.gg/YzmbnCDkat) - fastest way to get help!
|
|
||||||
|
|
||||||
3. **📝 Create a new issue**: Include:
|
|
||||||
- Your operating system
|
|
||||||
- Node.js version (`node --version`)
|
|
||||||
- Browser version
|
|
||||||
- Exact error message
|
|
||||||
- Steps to reproduce
|
|
||||||
- What you've already tried
|
|
||||||
|
|
||||||
4. **📧 Email us**: betterseqta.plus@gmail.com for urgent issues
|
|
||||||
|
|
||||||
## Getting More Debug Info
|
|
||||||
|
|
||||||
### Enable verbose logging
|
|
||||||
Add this to your plugin's `run` function:
|
|
||||||
```typescript
|
|
||||||
console.log("[DEBUG] Plugin starting:", api);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check extension background page
|
|
||||||
1. Go to `chrome://extensions`
|
|
||||||
2. Click "Details" on BetterSEQTA+
|
|
||||||
3. Click "Inspect views: background page"
|
|
||||||
4. Check console for background script errors
|
|
||||||
|
|
||||||
### Export debug info
|
|
||||||
Run this in browser console on a SEQTA page:
|
|
||||||
```javascript
|
|
||||||
console.log("Extension info:", {
|
|
||||||
version: chrome.runtime.getManifest().version,
|
|
||||||
url: window.location.href,
|
|
||||||
userAgent: navigator.userAgent,
|
|
||||||
storage: await chrome.storage.local.get()
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
Remember: **Don't give up!** Every developer faces these issues. The community is here to help, and solving these problems makes you a better developer. 💪
|
|
||||||
@@ -1,290 +0,0 @@
|
|||||||
# Contributing to BetterSEQTA+
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/contributing/](https://docs.betterseqta.org/contributing/)
|
|
||||||
|
|
||||||
Thank you for your interest in contributing to BetterSEQTA+! This document provides guidelines and instructions for contributing to the project.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Code of Conduct](#code-of-conduct)
|
|
||||||
- [Getting Started](#getting-started)
|
|
||||||
- [Setting Up Your Development Environment](#setting-up-your-development-environment)
|
|
||||||
- [Project Structure](#project-structure)
|
|
||||||
- [Contributing Code](#contributing-code)
|
|
||||||
- [Branching Strategy](#branching-strategy)
|
|
||||||
- [Pull Request Process](#pull-request-process)
|
|
||||||
- [Coding Standards](#coding-standards)
|
|
||||||
- [Reporting Bugs](#reporting-bugs)
|
|
||||||
- [Suggesting Features](#suggesting-features)
|
|
||||||
- [Writing Documentation](#writing-documentation)
|
|
||||||
- [Community](#community)
|
|
||||||
|
|
||||||
## Code of Conduct
|
|
||||||
|
|
||||||
BetterSEQTA+ is committed to providing a welcoming and inclusive environment for all contributors. We expect all participants to adhere to our Code of Conduct, which promotes respectful and harassment-free interaction.
|
|
||||||
|
|
||||||
Key points:
|
|
||||||
|
|
||||||
- Be respectful and inclusive
|
|
||||||
- Focus on what is best for the community
|
|
||||||
- Show empathy towards other community members
|
|
||||||
- Be open to constructive feedback
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Setting Up Your Development Environment
|
|
||||||
|
|
||||||
1. **Fork the Repository**
|
|
||||||
|
|
||||||
Start by forking the BetterSEQTA+ repository to your GitHub account.
|
|
||||||
|
|
||||||
2. **Clone Your Fork**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/yourusername/betterseqta-plus.git
|
|
||||||
cd betterseqta-plus
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Install Dependencies**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Set Up Development Environment**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **Install in Chrome/Firefox**
|
|
||||||
|
|
||||||
Follow the [installation instructions](https://docs.betterseqta.org/install/) to load the development version into your browser.
|
|
||||||
|
|
||||||
### Project Structure
|
|
||||||
|
|
||||||
Understanding the project structure will help you navigate the codebase:
|
|
||||||
|
|
||||||
```
|
|
||||||
betterseqta-plus/
|
|
||||||
├── src/ # Source code
|
|
||||||
│ ├── plugins/ # Plugin system
|
|
||||||
│ │ ├── built-in/ # Built-in plugins
|
|
||||||
│ │ ├── core/ # Plugin core functionality
|
|
||||||
│ ├── settings/ # Settings system
|
|
||||||
│ ├── utils/ # Utility functions
|
|
||||||
│ ├── extension/ # Browser extension code
|
|
||||||
├── docs/ # Documentation
|
|
||||||
├── test/ # Test files
|
|
||||||
├── dist/ # Build output (generated)
|
|
||||||
├── package.json # Project dependencies
|
|
||||||
├── tsconfig.json # TypeScript configuration
|
|
||||||
└── README.md # Project README
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing Code
|
|
||||||
|
|
||||||
### Branching Strategy
|
|
||||||
|
|
||||||
We follow a simple branching strategy:
|
|
||||||
|
|
||||||
- `main` - The main development branch
|
|
||||||
- `feature/*` - Feature branches
|
|
||||||
- `bugfix/*` - Bug fix branches
|
|
||||||
- `docs/*` - Documentation branches
|
|
||||||
|
|
||||||
Always create a new branch for your changes:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git checkout -b feature/my-new-feature
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pull Request Process
|
|
||||||
|
|
||||||
1. **Keep PRs Focused**
|
|
||||||
|
|
||||||
Each pull request should address a single concern. If you're working on multiple features, create separate PRs for each.
|
|
||||||
|
|
||||||
2. **Write Clear Commit Messages**
|
|
||||||
|
|
||||||
Follow the conventional commits format:
|
|
||||||
|
|
||||||
```
|
|
||||||
feat: add new feature
|
|
||||||
fix: resolve bug with timetable
|
|
||||||
docs: update installation instructions
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Update Documentation**
|
|
||||||
|
|
||||||
If your changes require documentation updates, include them in the same PR.
|
|
||||||
|
|
||||||
4. **Run CI checks locally**
|
|
||||||
|
|
||||||
Pull requests trigger **PR CI**, which lints and builds in a clean environment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run lint
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **Submit Your PR**
|
|
||||||
|
|
||||||
When you're ready, push your branch and create a pull request on GitHub.
|
|
||||||
|
|
||||||
6. **Code Review**
|
|
||||||
|
|
||||||
All PRs will be reviewed by maintainers. Be responsive to feedback and make requested changes.
|
|
||||||
|
|
||||||
7. **Merge**
|
|
||||||
|
|
||||||
Once approved, a maintainer will merge your PR.
|
|
||||||
|
|
||||||
### GitHub Actions workflows
|
|
||||||
|
|
||||||
See [RELEASES.md](RELEASES.md) for a full guide (workflows, sideload installs, and update detector).
|
|
||||||
|
|
||||||
| Workflow | Trigger | Purpose |
|
|
||||||
|----------|---------|---------|
|
|
||||||
| `pr-ci.yml` | Every PR to `main` | Typecheck, lint, and build (no release) |
|
|
||||||
| `mvp.yml` | Push to `main` | Build and upload `dist.zip` artifact |
|
|
||||||
| `release.yml` | Manual (`workflow_dispatch`) | Stable release on [BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus) tagged with `package.json` version |
|
|
||||||
| `nightly.yml` | Daily cron + manual | Updates the fixed `nightly` prerelease with latest `main` builds |
|
|
||||||
|
|
||||||
**Releasing a stable version:** bump `version` in `package.json` on `main`, then manually run the **Release** workflow and confirm the version checkbox. Edit the release title and notes on GitHub after the first publish. Re-running for the same tag only updates the zip files. Assets are `betterseqtaplus-{version}-chrome.zip` and `-firefox.zip`.
|
|
||||||
|
|
||||||
**Nightly builds** replace assets on the same `nightly` release. The release body warns that builds are experimental and must not be uploaded to extension stores.
|
|
||||||
|
|
||||||
**GitHub release builds** include an in-extension update checker (settings header badge). **PR CI and local dev builds do not.**
|
|
||||||
|
|
||||||
Release workflows are dispatched only on the main **BetterSEQTA/BetterSEQTA-Plus** repository and use the default `GITHUB_TOKEN`.
|
|
||||||
|
|
||||||
### Coding Standards
|
|
||||||
|
|
||||||
We follow TypeScript best practices and have a consistent code style:
|
|
||||||
|
|
||||||
1. **Use TypeScript**
|
|
||||||
|
|
||||||
All new code should be written in TypeScript with proper typing.
|
|
||||||
|
|
||||||
2. **Follow Existing Patterns**
|
|
||||||
|
|
||||||
Match the coding style of the existing codebase.
|
|
||||||
|
|
||||||
3. **Write Tests**
|
|
||||||
|
|
||||||
Add tests for new features and bug fixes.
|
|
||||||
|
|
||||||
4. **Document Your Code**
|
|
||||||
|
|
||||||
Add comments for complex logic and JSDoc comments for functions.
|
|
||||||
|
|
||||||
5. **Use Linters**
|
|
||||||
|
|
||||||
We use ESLint and Prettier. Run them before submitting your PR:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run lint
|
|
||||||
npm run format
|
|
||||||
```
|
|
||||||
|
|
||||||
## Reporting Bugs
|
|
||||||
|
|
||||||
If you find a bug, please report it by creating an issue on GitHub:
|
|
||||||
|
|
||||||
1. **Search Existing Issues**
|
|
||||||
|
|
||||||
Check if the bug has already been reported.
|
|
||||||
|
|
||||||
2. **Use the Bug Report Template**
|
|
||||||
|
|
||||||
Fill in all sections of the bug report template:
|
|
||||||
|
|
||||||
- Description
|
|
||||||
- Steps to reproduce
|
|
||||||
- Expected behavior
|
|
||||||
- Actual behavior
|
|
||||||
- Screenshots (if applicable)
|
|
||||||
- Environment (browser, OS, etc.)
|
|
||||||
|
|
||||||
3. **Be Specific**
|
|
||||||
|
|
||||||
The more details you provide, the easier it will be to fix the bug.
|
|
||||||
|
|
||||||
## Suggesting Features
|
|
||||||
|
|
||||||
We welcome feature suggestions! To suggest a new feature:
|
|
||||||
|
|
||||||
1. **Search Existing Suggestions**
|
|
||||||
|
|
||||||
Check if your idea has already been suggested.
|
|
||||||
|
|
||||||
2. **Use the Feature Request Template**
|
|
||||||
|
|
||||||
Fill in all sections of the feature request template:
|
|
||||||
|
|
||||||
- Description
|
|
||||||
- Use case
|
|
||||||
- Potential implementation
|
|
||||||
- Alternatives considered
|
|
||||||
|
|
||||||
3. **Be Patient**
|
|
||||||
|
|
||||||
Feature requests are evaluated based on alignment with project goals, feasibility, and maintainer bandwidth.
|
|
||||||
|
|
||||||
## Writing Documentation
|
|
||||||
|
|
||||||
Good documentation is crucial for the project. To contribute to documentation:
|
|
||||||
|
|
||||||
1. **Identify Gaps**
|
|
||||||
|
|
||||||
Look for areas where documentation is missing or unclear.
|
|
||||||
|
|
||||||
2. **Follow Documentation Style**
|
|
||||||
|
|
||||||
Maintain a consistent style and format.
|
|
||||||
|
|
||||||
3. **Use Clear Language**
|
|
||||||
|
|
||||||
Write in simple, clear English. Avoid jargon when possible.
|
|
||||||
|
|
||||||
4. **Include Examples**
|
|
||||||
|
|
||||||
Code examples and screenshots help users understand.
|
|
||||||
|
|
||||||
5. **Submit a PR**
|
|
||||||
|
|
||||||
Follow the same process as code contributions, but create a branch with a `docs/` prefix.
|
|
||||||
|
|
||||||
## Community
|
|
||||||
|
|
||||||
Join our community channels to discuss the project, get help, and connect with other contributors:
|
|
||||||
|
|
||||||
- **Discord Server**: [Join our Discord](https://discord.gg/betterseqta)
|
|
||||||
- **GitHub Discussions**: For longer-form conversations
|
|
||||||
- **GitHub Issues**: For bug reports and feature requests
|
|
||||||
|
|
||||||
## Creating Plugins
|
|
||||||
|
|
||||||
If you're interested in creating plugins for BetterSEQTA+, check out our plugin development guides:
|
|
||||||
|
|
||||||
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
|
|
||||||
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
|
|
||||||
## Recognition
|
|
||||||
|
|
||||||
Contributors are recognized in several ways:
|
|
||||||
|
|
||||||
1. **CONTRIBUTORS.md**: All contributors are listed in this file
|
|
||||||
2. **Release Notes**: Significant contributions are highlighted in release notes
|
|
||||||
3. **Community Recognition**: Regular shout-outs in community channels
|
|
||||||
|
|
||||||
## Questions?
|
|
||||||
|
|
||||||
If you have any questions about contributing, please:
|
|
||||||
|
|
||||||
1. Check the documentation
|
|
||||||
2. Ask in the Discord server
|
|
||||||
3. Open a GitHub Discussion
|
|
||||||
|
|
||||||
Thank you for contributing to BetterSEQTA+! Your efforts help make SEQTA better for students and teachers everywhere.
|
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
# Installing BetterSEQTA+
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/install/](https://docs.betterseqta.org/install/)
|
|
||||||
|
|
||||||
This guide will walk you through the process of installing and setting up BetterSEQTA+ for development or usage.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Before you begin, make sure you have the following installed:
|
|
||||||
|
|
||||||
- [npm](https://www.npmjs.com/) (v7 or higher) or [Bun](https://bun.sh/) (recommended)
|
|
||||||
- A modern web browser (Chrome, Firefox, Edge, etc.)
|
|
||||||
|
|
||||||
## Installation Methods
|
|
||||||
|
|
||||||
There are two ways to install BetterSEQTA+:
|
|
||||||
|
|
||||||
1. **For Users**: Install the browser extension
|
|
||||||
2. **For Developers**: Clone the repository and set up the development environment
|
|
||||||
|
|
||||||
## For Users: Installing the Browser Extension
|
|
||||||
|
|
||||||
BetterSEQTA+ is available as a browser extension for Chrome, Firefox, and Edge.
|
|
||||||
|
|
||||||
### Chrome/Edge
|
|
||||||
|
|
||||||
1. Visit the [Chrome Web Store page for BetterSEQTA+](https://chrome.google.com/webstore/detail/betterseqta)
|
|
||||||
2. Click the "Add to Chrome" button
|
|
||||||
3. Confirm the installation when prompted
|
|
||||||
4. The extension will be installed and ready to use
|
|
||||||
|
|
||||||
### Firefox
|
|
||||||
|
|
||||||
1. Visit the [Firefox Add-ons page for BetterSEQTA+](https://addons.mozilla.org/en-US/firefox/addon/betterseqta)
|
|
||||||
2. Click the "Add to Firefox" button
|
|
||||||
3. Confirm the installation when prompted
|
|
||||||
4. The extension will be installed and ready to use
|
|
||||||
|
|
||||||
## For Developers: Setting Up the Development Environment
|
|
||||||
|
|
||||||
If you want to develop for BetterSEQTA+ or modify the code, follow these steps:
|
|
||||||
|
|
||||||
### 1. Clone the Repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/SeqtaLearning/betterseqta-plus.git
|
|
||||||
cd betterseqta-plus
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Install Dependencies
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
```
|
|
||||||
|
|
||||||
Using Bun (recommended):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun install
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Set Up Environment Variables - Only required for pushing to extension stores from the command line
|
|
||||||
|
|
||||||
Copy the example environment file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp .env.submit.example .env
|
|
||||||
```
|
|
||||||
|
|
||||||
Edit the `.env` file with your SEQTA credentials and settings.
|
|
||||||
|
|
||||||
### 4. Start the Development Server
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Using Bun:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
This will start a development server and build the extension in watch mode.
|
|
||||||
|
|
||||||
### 5. Load the Extension in Your Browser
|
|
||||||
|
|
||||||
#### Chrome/Edge
|
|
||||||
|
|
||||||
1. Open Chrome/Edge and navigate to `chrome://extensions` or `edge://extensions`
|
|
||||||
2. Enable "Developer mode" using the toggle in the top right
|
|
||||||
3. Click "Load unpacked" and select the `dist` folder in your BetterSEQTA+ directory
|
|
||||||
4. The extension should now appear in your extensions list
|
|
||||||
|
|
||||||
#### Firefox
|
|
||||||
|
|
||||||
1. Open Firefox and navigate to `about:debugging#/runtime/this-firefox`
|
|
||||||
2. Click "Load Temporary Add-on..."
|
|
||||||
3. Select the `manifest.json` file in the `dist` folder
|
|
||||||
4. The extension should now appear in your add-ons list
|
|
||||||
|
|
||||||
### 6. Test Your Changes
|
|
||||||
|
|
||||||
After making changes to the code, the development server will automatically rebuild the extension. However, you may need to reload the extension in your browser to see the changes:
|
|
||||||
|
|
||||||
1. Go to the extensions page in your browser
|
|
||||||
2. Find BetterSEQTA+ and click the reload icon
|
|
||||||
3. Refresh any SEQTA Learn pages you have open
|
|
||||||
|
|
||||||
## Troubleshooting Installation
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### "Cannot find module" errors
|
|
||||||
|
|
||||||
If you see errors about missing modules, try:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
Or with Bun:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules
|
|
||||||
bun install
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Extension not appearing in SEQTA
|
|
||||||
|
|
||||||
Make sure:
|
|
||||||
|
|
||||||
- You're visiting a SEQTA Learn page
|
|
||||||
- The extension is enabled
|
|
||||||
- You've refreshed the page after installing the extension
|
|
||||||
|
|
||||||
#### Development build not updating
|
|
||||||
|
|
||||||
Try:
|
|
||||||
|
|
||||||
1. Stopping the development server
|
|
||||||
2. Clearing your browser cache
|
|
||||||
3. Removing the extension from your browser
|
|
||||||
4. Rebuilding the extension
|
|
||||||
5. Loading it again
|
|
||||||
|
|
||||||
## Updating BetterSEQTA+
|
|
||||||
|
|
||||||
### For Users
|
|
||||||
|
|
||||||
Browser extensions update automatically, but you can manually check for updates:
|
|
||||||
|
|
||||||
- **Chrome/Edge**: Go to `chrome://extensions` or `edge://extensions`, enable Developer mode, and click "Update"
|
|
||||||
- **Firefox**: Go to `about:addons`, click the gear icon, and select "Check for Updates"
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
|
|
||||||
If you're working on the code, pull the latest changes and reinstall dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git pull
|
|
||||||
npm install
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Or with Bun:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git pull
|
|
||||||
bun install
|
|
||||||
bun run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Now that you have BetterSEQTA+ installed, you can:
|
|
||||||
|
|
||||||
- [Plugins](https://docs.betterseqta.org/plugins/)
|
|
||||||
- [Contribute to the project](https://docs.betterseqta.org/contributing/) · [Repository CONTRIBUTING.md](../CONTRIBUTING.md)
|
|
||||||
@@ -1,337 +0,0 @@
|
|||||||
# Example Plugin Template
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/example-plugin/](https://docs.betterseqta.org/example-plugin/)
|
|
||||||
|
|
||||||
This is a complete, working example of a simple BetterSEQTA+ plugin. You can copy this code and modify it to create your own plugin!
|
|
||||||
|
|
||||||
## What This Example Does
|
|
||||||
|
|
||||||
This plugin adds a friendly welcome message to the SEQTA homepage and lets users customize the message through settings.
|
|
||||||
|
|
||||||
## Complete Plugin Code
|
|
||||||
|
|
||||||
Create a new file in `src/plugins/built-in/my-first-plugin/index.ts`:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
defineSettings,
|
|
||||||
booleanSetting,
|
|
||||||
stringSetting
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
import { Setting } from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// Define the plugin settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
enabled: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Show Welcome Message",
|
|
||||||
description: "Display a welcome message on the SEQTA homepage"
|
|
||||||
}),
|
|
||||||
customMessage: stringSetting({
|
|
||||||
default: "Welcome to SEQTA! 🎉",
|
|
||||||
title: "Custom Message",
|
|
||||||
description: "The message to display on the homepage",
|
|
||||||
maxLength: 100
|
|
||||||
}),
|
|
||||||
showEmoji: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Show Emoji",
|
|
||||||
description: "Include emojis in the welcome message"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create settings class
|
|
||||||
class MyFirstPluginSettings extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.enabled)
|
|
||||||
enabled!: boolean;
|
|
||||||
|
|
||||||
@Setting(settings.customMessage)
|
|
||||||
customMessage!: string;
|
|
||||||
|
|
||||||
@Setting(settings.showEmoji)
|
|
||||||
showEmoji!: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create settings instance
|
|
||||||
const settingsInstance = new MyFirstPluginSettings();
|
|
||||||
|
|
||||||
// Define the plugin
|
|
||||||
const myFirstPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "my-first-plugin",
|
|
||||||
name: "My First Plugin",
|
|
||||||
description: "Adds a customizable welcome message to the SEQTA homepage",
|
|
||||||
version: "1.0.0",
|
|
||||||
|
|
||||||
// Link our settings
|
|
||||||
settings: settingsInstance.settings,
|
|
||||||
|
|
||||||
// Mark as beta (optional)
|
|
||||||
beta: true,
|
|
||||||
|
|
||||||
// Add some CSS styles (optional)
|
|
||||||
styles: `
|
|
||||||
.my-plugin-welcome {
|
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
||||||
color: white;
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 12px;
|
|
||||||
margin: 20px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
text-align: center;
|
|
||||||
font-size: 18px;
|
|
||||||
animation: slideIn 0.5s ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes slideIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(-20px);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-plugin-welcome .close-btn {
|
|
||||||
float: right;
|
|
||||||
background: rgba(255, 255, 255, 0.2);
|
|
||||||
border: none;
|
|
||||||
color: white;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-plugin-welcome .close-btn:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
|
|
||||||
// Main plugin function
|
|
||||||
run: async (api) => {
|
|
||||||
console.log("[My First Plugin] Starting up! 🚀");
|
|
||||||
|
|
||||||
// Wait for settings to load
|
|
||||||
await api.settings.loaded;
|
|
||||||
|
|
||||||
let welcomeElement: HTMLElement | null = null;
|
|
||||||
|
|
||||||
// Function to create the welcome message
|
|
||||||
const createWelcomeMessage = () => {
|
|
||||||
// Only show if enabled in settings
|
|
||||||
if (!api.settings.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove existing message if it exists
|
|
||||||
if (welcomeElement) {
|
|
||||||
welcomeElement.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the message element
|
|
||||||
welcomeElement = document.createElement("div");
|
|
||||||
welcomeElement.className = "my-plugin-welcome";
|
|
||||||
|
|
||||||
// Build the message content
|
|
||||||
let message = api.settings.customMessage;
|
|
||||||
if (!api.settings.showEmoji) {
|
|
||||||
// Remove emojis if disabled
|
|
||||||
message = message.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
welcomeElement.innerHTML = `
|
|
||||||
<button class="close-btn" onclick="this.parentElement.remove()">×</button>
|
|
||||||
<div>${message}</div>
|
|
||||||
<small style="opacity: 0.8; margin-top: 10px; display: block;">
|
|
||||||
Powered by My First Plugin
|
|
||||||
</small>
|
|
||||||
`;
|
|
||||||
|
|
||||||
return welcomeElement;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Function to add message to homepage
|
|
||||||
const addToHomepage = () => {
|
|
||||||
api.seqta.onMount(".home-page, .dashboard, [class*='home']", (homePage) => {
|
|
||||||
console.log("[My First Plugin] Found homepage, adding welcome message");
|
|
||||||
|
|
||||||
const message = createWelcomeMessage();
|
|
||||||
if (message) {
|
|
||||||
// Add to the top of the homepage
|
|
||||||
homePage.insertBefore(message, homePage.firstChild);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Add message when plugin starts
|
|
||||||
addToHomepage();
|
|
||||||
|
|
||||||
// Re-add message when user navigates to homepage
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
console.log("[My First Plugin] Page changed to:", page);
|
|
||||||
if (page.includes("home") || page.includes("dashboard")) {
|
|
||||||
// Small delay to let the page load
|
|
||||||
setTimeout(addToHomepage, 500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Listen for settings changes and update the message
|
|
||||||
api.settings.onChange("enabled", (enabled) => {
|
|
||||||
console.log("[My First Plugin] Enabled setting changed:", enabled);
|
|
||||||
if (enabled) {
|
|
||||||
addToHomepage();
|
|
||||||
} else if (welcomeElement) {
|
|
||||||
welcomeElement.remove();
|
|
||||||
welcomeElement = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
api.settings.onChange("customMessage", (newMessage) => {
|
|
||||||
console.log("[My First Plugin] Message changed:", newMessage);
|
|
||||||
if (welcomeElement && api.settings.enabled) {
|
|
||||||
// Update existing message
|
|
||||||
addToHomepage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
api.settings.onChange("showEmoji", (showEmoji) => {
|
|
||||||
console.log("[My First Plugin] Show emoji changed:", showEmoji);
|
|
||||||
if (welcomeElement && api.settings.enabled) {
|
|
||||||
// Update existing message
|
|
||||||
addToHomepage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return cleanup function (called when plugin is disabled)
|
|
||||||
return () => {
|
|
||||||
console.log("[My First Plugin] Cleaning up...");
|
|
||||||
if (welcomeElement) {
|
|
||||||
welcomeElement.remove();
|
|
||||||
welcomeElement = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default myFirstPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to Use This Example
|
|
||||||
|
|
||||||
### Step 1: Create the Plugin File
|
|
||||||
1. Create a new folder: `src/plugins/built-in/my-first-plugin/`
|
|
||||||
2. Create `index.ts` in that folder
|
|
||||||
3. Copy the code above into `index.ts`
|
|
||||||
|
|
||||||
### Step 2: Register the Plugin
|
|
||||||
Add this to `src/plugins/index.ts`:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Add this import at the top
|
|
||||||
import myFirstPlugin from "./built-in/my-first-plugin";
|
|
||||||
|
|
||||||
// Add this line where other plugins are registered
|
|
||||||
pluginManager.registerPlugin(myFirstPlugin);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 3: Test It
|
|
||||||
1. Run `npm run dev`
|
|
||||||
2. Reload your extension in Chrome
|
|
||||||
3. Visit a SEQTA page
|
|
||||||
4. You should see your welcome message!
|
|
||||||
5. Open BetterSEQTA+ settings to customize it
|
|
||||||
|
|
||||||
## Key Concepts Explained
|
|
||||||
|
|
||||||
### 1. Plugin Structure
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "unique-id", // Must be unique across all plugins
|
|
||||||
name: "Display Name", // Shown in settings
|
|
||||||
description: "What it does", // Shown in settings
|
|
||||||
version: "1.0.0", // Plugin version
|
|
||||||
settings: settingsObject, // User-configurable options
|
|
||||||
styles: "/* CSS here */", // Optional CSS styles
|
|
||||||
run: async (api) => { // Main plugin code
|
|
||||||
// Your code here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Settings System
|
|
||||||
```typescript
|
|
||||||
// Define what settings your plugin has
|
|
||||||
const settings = defineSettings({
|
|
||||||
myOption: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "My Option",
|
|
||||||
description: "What this option does"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// Use in your plugin
|
|
||||||
if (api.settings.myOption) {
|
|
||||||
// Do something
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. SEQTA Integration
|
|
||||||
```typescript
|
|
||||||
// Wait for elements to appear
|
|
||||||
api.seqta.onMount(".some-selector", (element) => {
|
|
||||||
// Modify the element
|
|
||||||
});
|
|
||||||
|
|
||||||
// Detect page changes
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
if (page === "home") {
|
|
||||||
// User navigated to homepage
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Cleanup
|
|
||||||
Always return a cleanup function to remove your changes when the plugin is disabled:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
run: async (api) => {
|
|
||||||
// Add your features
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
// Remove your features
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Customization Ideas
|
|
||||||
|
|
||||||
Want to modify this example? Here are some ideas:
|
|
||||||
|
|
||||||
1. **Change the styling**: Modify the CSS to use different colors, animations, or layouts
|
|
||||||
2. **Add more settings**: Number settings, select dropdowns, hotkeys
|
|
||||||
3. **Different trigger**: Show on different pages, or based on time of day
|
|
||||||
4. **Add interactions**: Buttons that do things when clicked
|
|
||||||
5. **Store data**: Use `api.storage` to remember user preferences
|
|
||||||
6. **Communicate with other plugins**: Use `api.events` to send/receive events
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Once you've got this working:
|
|
||||||
|
|
||||||
1. **Experiment**: Try changing things and see what happens
|
|
||||||
2. **Read other plugins**: Look at the built-in plugins for inspiration
|
|
||||||
3. **Check the API docs**: Learn about all available API functions
|
|
||||||
4. **Share your creation**: Show it off in Discord!
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
- 💬 Ask in our [Discord server](https://discord.gg/YzmbnCDkat)
|
|
||||||
- 📚 Read the [plugin documentation](https://docs.betterseqta.org/plugins/)
|
|
||||||
- 🐛 Check the [troubleshooting guide](https://docs.betterseqta.org/troubleshooting/)
|
|
||||||
- 📝 Open an issue on GitHub
|
|
||||||
|
|
||||||
Happy coding! 🎉
|
|
||||||
@@ -1,299 +0,0 @@
|
|||||||
# Creating Plugins for BetterSEQTA+
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/plugins/](https://docs.betterseqta.org/plugins/) · [Plugin development](https://docs.betterseqta.org/plugin-development/) · [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
|
|
||||||
Hey there! 👋 So you want to create a plugin for BetterSEQTA+? That's awesome! This guide will walk you through everything you need to know, from the very basics to more advanced features. Don't worry if you're new to this - we'll explain everything step by step.
|
|
||||||
|
|
||||||
## What is a Plugin?
|
|
||||||
|
|
||||||
In BetterSEQTA+, a plugin is like a mini-app that adds new features to SEQTA. Think of it as a piece of LEGO that you can snap onto SEQTA to make it do new things. For example, you could create a plugin that:
|
|
||||||
|
|
||||||
- Changes how SEQTA looks
|
|
||||||
- Adds new buttons or features
|
|
||||||
- Shows extra information on your timetable
|
|
||||||
- Collects notifications in a better way
|
|
||||||
- Really, anything you can imagine!
|
|
||||||
|
|
||||||
## Your First Plugin
|
|
||||||
|
|
||||||
Let's create a super simple plugin together. We'll make one that adds a friendly message to the SEQTA homepage. Here's what we'll need:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const myFirstPlugin: Plugin = {
|
|
||||||
// Every plugin needs these basic details
|
|
||||||
id: "my-first-plugin",
|
|
||||||
name: "My First Plugin",
|
|
||||||
description: "Adds a friendly message to SEQTA",
|
|
||||||
version: "1.0.0",
|
|
||||||
|
|
||||||
// This tells BetterSEQTA+ that users can turn our plugin on/off
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
// Optional: Mark your plugin as beta to show a "Beta" tag in settings
|
|
||||||
beta: true,
|
|
||||||
|
|
||||||
// This is where the magic happens!
|
|
||||||
run: async (api) => {
|
|
||||||
// Wait for the homepage to load
|
|
||||||
api.seqta.onMount(".home-page", (homePage) => {
|
|
||||||
// Create our message
|
|
||||||
const message = document.createElement("div");
|
|
||||||
message.textContent = "Hello from my first plugin! 🎉";
|
|
||||||
message.style.padding = "20px";
|
|
||||||
message.style.backgroundColor = "#e9f5ff";
|
|
||||||
message.style.borderRadius = "8px";
|
|
||||||
message.style.margin = "20px";
|
|
||||||
|
|
||||||
// Add it to the page
|
|
||||||
homePage.prepend(message);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return a cleanup function that removes our message when the plugin is disabled
|
|
||||||
return () => {
|
|
||||||
const message = document.querySelector(".home-page > div");
|
|
||||||
message?.remove();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default myFirstPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
Let's break down what's happening here:
|
|
||||||
|
|
||||||
1. First, we import the `Plugin` type that tells TypeScript what a plugin should look like
|
|
||||||
2. We create our plugin object with some basic information:
|
|
||||||
- `id`: A unique name for your plugin (use lowercase and dashes)
|
|
||||||
- `name`: A friendly name that users will see
|
|
||||||
- `description`: Explain what your plugin does
|
|
||||||
- `version`: Your plugin's version number
|
|
||||||
3. We set `disableToggle: true` so users can turn our plugin on/off in settings
|
|
||||||
4. We set `beta: true` to mark the plugin as beta
|
|
||||||
5. The `run` function is where we put our plugin's code
|
|
||||||
6. We use `api.seqta.onMount` to wait for the homepage to load
|
|
||||||
7. We create and style a message element
|
|
||||||
8. We return a cleanup function that removes our changes when the plugin is disabled
|
|
||||||
|
|
||||||
## The Plugin API
|
|
||||||
|
|
||||||
When your plugin runs, it gets access to a powerful API that lets you do all sorts of things. Let's look at what you can do:
|
|
||||||
|
|
||||||
### SEQTA API (`api.seqta`)
|
|
||||||
|
|
||||||
This helps you interact with SEQTA's pages:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Wait for an element to appear on the page
|
|
||||||
api.seqta.onMount(".some-class", (element) => {
|
|
||||||
// Do something with the element
|
|
||||||
});
|
|
||||||
|
|
||||||
// Know when the user changes pages
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
console.log("User went to:", page);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get the current page
|
|
||||||
const currentPage = api.seqta.getCurrentPage();
|
|
||||||
```
|
|
||||||
|
|
||||||
### Settings API (`api.settings`)
|
|
||||||
|
|
||||||
Want to let users customize your plugin? Use settings!
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
booleanSetting,
|
|
||||||
defineSettings,
|
|
||||||
Setting,
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// Define your settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
showMessage: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Show Welcome Message",
|
|
||||||
description: "Show a friendly message on the homepage",
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a class for your plugin
|
|
||||||
class MyPluginClass extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.showMessage)
|
|
||||||
showMessage!: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create your plugin
|
|
||||||
const settingsInstance = new MyPluginClass();
|
|
||||||
|
|
||||||
const myPlugin: Plugin<typeof settings> = {
|
|
||||||
// ... other plugin details ...
|
|
||||||
settings: settingsInstance.settings,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Use the setting
|
|
||||||
if (api.settings.showMessage) {
|
|
||||||
// Show the message
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for setting changes
|
|
||||||
api.settings.onChange("showMessage", (newValue) => {
|
|
||||||
if (newValue) {
|
|
||||||
// Show the message
|
|
||||||
} else {
|
|
||||||
// Hide the message
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Storage API (`api.storage`)
|
|
||||||
|
|
||||||
Need to save some data? The storage API has got you covered:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Save some data
|
|
||||||
await api.storage.set("lastVisit", new Date().toISOString());
|
|
||||||
|
|
||||||
// Get it back later
|
|
||||||
const lastVisit = await api.storage.get("lastVisit");
|
|
||||||
|
|
||||||
// Listen for changes
|
|
||||||
api.storage.onChange("lastVisit", (newValue) => {
|
|
||||||
console.log("Last visit updated:", newValue);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Events API (`api.events`)
|
|
||||||
|
|
||||||
Want your plugin to be able to interface with other plugins? Then use events!
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Listen for an event
|
|
||||||
api.events.on("myCustomEvent", (data) => {
|
|
||||||
console.log("Got event:", data);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Send an event
|
|
||||||
api.events.emit("myCustomEvent", { some: "data" });
|
|
||||||
```
|
|
||||||
|
|
||||||
## Adding Styles
|
|
||||||
|
|
||||||
Want to make your plugin look pretty? You can add CSS styles:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
// ... other plugin details ...
|
|
||||||
|
|
||||||
// Add your CSS here
|
|
||||||
styles: `
|
|
||||||
.my-plugin-message {
|
|
||||||
background: linear-gradient(135deg, #6e8efb, #a777e3);
|
|
||||||
color: white;
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
margin: 20px;
|
|
||||||
animation: slide-in 0.3s ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes slide-in {
|
|
||||||
from { transform: translateY(-20px); opacity: 0; }
|
|
||||||
to { transform: translateY(0); opacity: 1; }
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Your plugin code here
|
|
||||||
},
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
Here are some tips to make your plugin awesome:
|
|
||||||
|
|
||||||
1. **Always Clean Up**: When your plugin is disabled, clean up any changes you made:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
run: async (api) => {
|
|
||||||
// Add stuff to the page
|
|
||||||
const element = document.createElement("div");
|
|
||||||
document.body.appendChild(element);
|
|
||||||
|
|
||||||
// Return a cleanup function
|
|
||||||
return () => {
|
|
||||||
element.remove();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Use TypeScript**: It helps catch errors before they happen and makes your code easier to understand.
|
|
||||||
|
|
||||||
3. **Test Your Plugin**: Make sure it works in different situations:
|
|
||||||
|
|
||||||
- When SEQTA is loading
|
|
||||||
- When the user switches pages
|
|
||||||
- When the plugin is enabled/disabled
|
|
||||||
- When settings are changed
|
|
||||||
|
|
||||||
4. **Keep It Fast**: Don't slow down SEQTA:
|
|
||||||
|
|
||||||
- Use `onMount` instead of intervals or timeouts
|
|
||||||
- Clean up event listeners when they're not needed
|
|
||||||
- Don't do heavy calculations on the main thread
|
|
||||||
|
|
||||||
5. **Make It User-Friendly**:
|
|
||||||
- Add clear settings with good descriptions
|
|
||||||
- Use `disableToggle: true` so users can turn it off if needed
|
|
||||||
- Add helpful error messages if something goes wrong
|
|
||||||
- Use `beta: true` for experimental features to let users know they're trying something new
|
|
||||||
|
|
||||||
## Plugin Metadata Options
|
|
||||||
|
|
||||||
Your plugin object supports several optional flags to customize how it appears and behaves:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "my-plugin",
|
|
||||||
name: "My Plugin",
|
|
||||||
description: "What my plugin does",
|
|
||||||
version: "1.0.0",
|
|
||||||
|
|
||||||
// Optional flags:
|
|
||||||
disableToggle: true, // Show enable/disable toggle in settings
|
|
||||||
defaultEnabled: false, // Start disabled by default (requires disableToggle: true)
|
|
||||||
beta: true, // Show "Beta" tag in settings UI
|
|
||||||
|
|
||||||
// Your plugin code...
|
|
||||||
run: async (api) => { /* ... */ },
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
- **`disableToggle`**: When `true`, users can enable/disable your plugin in settings
|
|
||||||
- **`defaultEnabled`**: When `false`, your plugin starts disabled (only works with `disableToggle: true`)
|
|
||||||
- **`beta`**: When `true`, shows an orange "Beta" tag next to your plugin name in settings
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
Want to see more examples? Check out our built-in plugins:
|
|
||||||
|
|
||||||
- [themes](../../src/plugins/built-in/themes/index.ts): Shows how to change SEQTA's appearance
|
|
||||||
- [notificationCollector](../../src/plugins/built-in/notificationCollector/index.ts): Shows how to work with SEQTA's notifications
|
|
||||||
- [timetable](../../src/plugins/built-in/timetable/index.ts): Shows how to modify SEQTA's timetable view
|
|
||||||
- [assessmentsAverage](../../src/plugins/built-in/assessmentsAverage/index.ts): Shows how to add new features to existing pages
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
Got stuck? No worries! Here's where you can get help:
|
|
||||||
|
|
||||||
- Join our [Discord server](https://discord.gg/YzmbnCDkat)
|
|
||||||
- Check out the built-in plugins in the `src/plugins/built-in` folder
|
|
||||||
- Open an issue on our [GitHub page](https://github.com/betterseqta/betterseqta-plus/issues)
|
|
||||||
|
|
||||||
Happy coding and feel free to check out the [plugin API](https://docs.betterseqta.org/plugin-api/) on the documentation site.
|
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
# Plugin API Reference
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/plugin-api/](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
|
|
||||||
This document provides detailed technical information about BetterSEQTA+'s plugin APIs. For a beginner-friendly introduction, see the [plugins section](https://docs.betterseqta.org/plugins/) at [docs.betterseqta.org](https://docs.betterseqta.org/).
|
|
||||||
|
|
||||||
## Plugin Structure
|
|
||||||
|
|
||||||
Here's how a plugin is structured:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
booleanSetting,
|
|
||||||
defineSettings,
|
|
||||||
Setting,
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// First, define your settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
enabled: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Enable Feature",
|
|
||||||
description: "Turn this feature on or off",
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a class to handle your settings
|
|
||||||
class MyPluginClass extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.enabled)
|
|
||||||
enabled!: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create an instance of your settings
|
|
||||||
const settingsInstance = new MyPluginClass();
|
|
||||||
|
|
||||||
// Create your plugin
|
|
||||||
const myPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "my-plugin",
|
|
||||||
name: "My Plugin",
|
|
||||||
description: "A cool plugin that does things",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: settingsInstance.settings,
|
|
||||||
disableToggle: true,
|
|
||||||
beta: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
console.log("Plugin is running!");
|
|
||||||
|
|
||||||
// Do stuff when settings change
|
|
||||||
api.settings.onChange("enabled", (enabled) => {
|
|
||||||
if (enabled) {
|
|
||||||
console.log("Feature enabled!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return a cleanup function
|
|
||||||
return () => {
|
|
||||||
console.log("Plugin cleanup");
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default myPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Plugin Metadata
|
|
||||||
|
|
||||||
The plugin object supports several metadata fields and options:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
interface Plugin {
|
|
||||||
// Required fields
|
|
||||||
id: string; // Unique identifier (lowercase, dashes)
|
|
||||||
name: string; // Display name shown to users
|
|
||||||
description: string; // Brief description of what the plugin does
|
|
||||||
version: string; // Semantic version (e.g., "1.0.0")
|
|
||||||
settings: PluginSettings; // Plugin settings object
|
|
||||||
run: (api: PluginAPI) => void; // Main plugin function
|
|
||||||
|
|
||||||
// Optional fields
|
|
||||||
styles?: string; // CSS styles to inject
|
|
||||||
disableToggle?: boolean; // Show enable/disable toggle in settings
|
|
||||||
defaultEnabled?: boolean; // Start enabled/disabled (requires disableToggle)
|
|
||||||
beta?: boolean; // Show "Beta" tag in settings UI
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Metadata Options
|
|
||||||
|
|
||||||
- **`disableToggle`**: When `true`, users can enable/disable your plugin in the settings page
|
|
||||||
- **`defaultEnabled`**: When `false`, your plugin starts disabled by default (only works with `disableToggle: true`)
|
|
||||||
- **`beta`**: When `true`, displays an orange "Beta" tag next to your plugin name in the settings UI
|
|
||||||
- **`styles`**: CSS string that gets injected into the page when your plugin runs
|
|
||||||
|
|
||||||
## SEQTA API
|
|
||||||
|
|
||||||
The SEQTA API helps you interact with SEQTA's pages:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const seqtaPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "seqta-example",
|
|
||||||
name: "SEQTA Example",
|
|
||||||
description: "Shows how to use the SEQTA API",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Wait for elements to appear
|
|
||||||
const { unregister: timetableUnregister } = api.seqta.onMount(
|
|
||||||
".timetable",
|
|
||||||
(timetable) => {
|
|
||||||
const button = document.createElement("button");
|
|
||||||
button.textContent = "Export";
|
|
||||||
timetable.appendChild(button);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Track page changes
|
|
||||||
const { unregister: pageUnregister } = api.seqta.onPageChange((page) => {
|
|
||||||
console.log("User went to:", page);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Clean up when disabled
|
|
||||||
return () => {
|
|
||||||
timetableUnregister();
|
|
||||||
pageUnregister();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default seqtaPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Settings API
|
|
||||||
|
|
||||||
Here's how to add settings to your plugin:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
booleanSetting,
|
|
||||||
stringSetting,
|
|
||||||
numberSetting,
|
|
||||||
selectSetting,
|
|
||||||
defineSettings,
|
|
||||||
Setting,
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// Define your settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
darkMode: booleanSetting({
|
|
||||||
default: false,
|
|
||||||
title: "Dark Mode",
|
|
||||||
description: "Enable dark mode",
|
|
||||||
}),
|
|
||||||
userName: stringSetting({
|
|
||||||
default: "",
|
|
||||||
title: "User Name",
|
|
||||||
description: "Your display name",
|
|
||||||
placeholder: "Enter your name...",
|
|
||||||
}),
|
|
||||||
theme: selectSetting({
|
|
||||||
default: "light",
|
|
||||||
title: "Theme",
|
|
||||||
description: "Choose your theme",
|
|
||||||
options: [
|
|
||||||
{ value: "light", label: "Light" },
|
|
||||||
{ value: "dark", label: "Dark" },
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create your settings class
|
|
||||||
class ThemePluginClass extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.darkMode)
|
|
||||||
darkMode!: boolean;
|
|
||||||
|
|
||||||
@Setting(settings.userName)
|
|
||||||
userName!: string;
|
|
||||||
|
|
||||||
@Setting(settings.theme)
|
|
||||||
theme!: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the plugin
|
|
||||||
const themePlugin: Plugin<typeof settings> = {
|
|
||||||
id: "theme-example",
|
|
||||||
name: "Theme Example",
|
|
||||||
description: "Shows how to use settings",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: new ThemePluginClass().settings,
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Apply initial settings
|
|
||||||
if (api.settings.darkMode) {
|
|
||||||
document.body.classList.add("dark");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for changes
|
|
||||||
const { unregister } = api.settings.onChange("darkMode", (enabled) => {
|
|
||||||
document.body.classList.toggle("dark", enabled);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unregister();
|
|
||||||
document.body.classList.remove("dark");
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default themePlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Storage API
|
|
||||||
|
|
||||||
Here's how to use storage in your plugin:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const storagePlugin: Plugin<typeof settings> = {
|
|
||||||
id: "storage-example",
|
|
||||||
name: "Storage Example",
|
|
||||||
description: "Shows how to use storage",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Wait for storage to be ready
|
|
||||||
await api.storage.loaded;
|
|
||||||
|
|
||||||
// Save some data
|
|
||||||
await api.storage.set("lastVisit", new Date().toISOString());
|
|
||||||
|
|
||||||
// Get saved data
|
|
||||||
const lastVisit = await api.storage.get("lastVisit");
|
|
||||||
console.log("Last visit:", lastVisit);
|
|
||||||
|
|
||||||
// Listen for changes
|
|
||||||
const { unregister } = api.storage.onChange("lastVisit", (newValue) => {
|
|
||||||
console.log("Last visit updated:", newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unregister();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default storagePlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Events API
|
|
||||||
|
|
||||||
Here's how to use events in your plugin:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const eventsPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "events-example",
|
|
||||||
name: "Events Example",
|
|
||||||
description: "Shows how to use events",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Listen for theme changes
|
|
||||||
const { unregister: themeListener } = api.events.on(
|
|
||||||
"theme.changed",
|
|
||||||
(theme) => {
|
|
||||||
console.log("Theme changed to:", theme);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Listen for notifications
|
|
||||||
const { unregister: notifyListener } = api.events.on(
|
|
||||||
"notification.new",
|
|
||||||
(notification) => {
|
|
||||||
console.log("New notification:", notification);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Clean up listeners
|
|
||||||
return () => {
|
|
||||||
themeListener();
|
|
||||||
notifyListener();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default eventsPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Performance Tips
|
|
||||||
|
|
||||||
Here's how to write efficient plugins:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const efficientPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "efficient-example",
|
|
||||||
name: "Efficient Example",
|
|
||||||
description: "Shows performance best practices",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// ✅ Good: Use onMount
|
|
||||||
const { unregister } = api.seqta.onMount(".timetable", (el) => {
|
|
||||||
el.classList.add("enhanced");
|
|
||||||
});
|
|
||||||
|
|
||||||
// ❌ Bad: Don't use intervals
|
|
||||||
// const interval = setInterval(() => {
|
|
||||||
// const el = document.querySelector('.timetable');
|
|
||||||
// if (el) el.classList.add('enhanced');
|
|
||||||
// }, 100);
|
|
||||||
|
|
||||||
// ✅ Good: Cache DOM elements
|
|
||||||
const header = document.querySelector(".header");
|
|
||||||
if (header) {
|
|
||||||
// Reuse header instead of querying again
|
|
||||||
}
|
|
||||||
|
|
||||||
// ✅ Good: Batch DOM updates
|
|
||||||
const fragment = document.createDocumentFragment();
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
const div = document.createElement("div");
|
|
||||||
fragment.appendChild(div);
|
|
||||||
}
|
|
||||||
document.body.appendChild(fragment);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unregister();
|
|
||||||
// clearInterval(interval); // If you used the bad approach
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default efficientPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
Each plugin should be in its own file and exported as the default export. The plugin should:
|
|
||||||
|
|
||||||
1. Import necessary types and helpers
|
|
||||||
2. Define settings if needed
|
|
||||||
3. Create a settings class if using settings
|
|
||||||
4. Create the plugin object with proper type annotation
|
|
||||||
5. Export the plugin as default
|
|
||||||
|
|
||||||
Remember to always:
|
|
||||||
|
|
||||||
- Use proper TypeScript types
|
|
||||||
- Clean up when your plugin is disabled
|
|
||||||
- Handle errors gracefully
|
|
||||||
- Follow the plugin structure shown above
|
|
||||||
+15
-24
@@ -1,29 +1,20 @@
|
|||||||
export default {
|
export default {
|
||||||
preset: 'ts-jest',
|
preset: "ts-jest",
|
||||||
testEnvironment: 'node',
|
testEnvironment: "node",
|
||||||
roots: ['<rootDir>/src'],
|
roots: ["<rootDir>/src"],
|
||||||
testMatch: [
|
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
|
||||||
'**/__tests__/**/*.ts',
|
|
||||||
'**/?(*.)+(spec|test).ts'
|
|
||||||
],
|
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest',
|
"^.+\\.ts$": "ts-jest",
|
||||||
'^.+\\.js$': ['ts-jest', { tsconfig: { allowJs: true } }],
|
"^.+\\.js$": ["ts-jest", { tsconfig: { allowJs: true } }],
|
||||||
},
|
},
|
||||||
transformIgnorePatterns: [
|
transformIgnorePatterns: ["/node_modules/(?!(color|color-string|color-convert|color-name)/)"],
|
||||||
'/node_modules/(?!(color|color-string|color-convert|color-name)/)',
|
|
||||||
],
|
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^@/(.*)\\?script(?:&(?:iife|module))?$':
|
"^@/(.*)\\?script(?:&(?:iife|module))?$": "<rootDir>/src/test/mocks/crxjsScriptPath.ts",
|
||||||
'<rootDir>/src/test/mocks/crxjsScriptPath.ts',
|
"^@/lib/browser$": "<rootDir>/src/test/mocks/browser.ts",
|
||||||
'^@/(.*)$': '<rootDir>/src/$1',
|
"^@/(.*)$": "<rootDir>/src/$1",
|
||||||
'^color$': '<rootDir>/src/test/mocks/color.ts',
|
"^color$": "<rootDir>/src/test/mocks/color.ts",
|
||||||
'^webextension-polyfill$': '<rootDir>/src/test/mocks/webextension-polyfill.ts',
|
|
||||||
},
|
},
|
||||||
setupFilesAfterEnv: ['<rootDir>/src/test/jest.setup.ts'],
|
setupFilesAfterEnv: ["<rootDir>/src/test/jest.setup.ts"],
|
||||||
moduleFileExtensions: ['ts', 'js', 'json'],
|
moduleFileExtensions: ["ts", "js", "json"],
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: ["src/**/*.ts", "!src/**/*.d.ts"],
|
||||||
'src/**/*.ts',
|
};
|
||||||
'!src/**/*.d.ts',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
+3
-35
@@ -1,42 +1,10 @@
|
|||||||
import fs from "fs";
|
import fs from "node:fs";
|
||||||
import mime from "mime-types";
|
import mime from "mime-types";
|
||||||
|
|
||||||
/**
|
|
||||||
* A Vite plugin designed to load files as base64 encoded data URLs.
|
|
||||||
* This plugin intercepts module imports that have a `?base64` query parameter
|
|
||||||
* appended to the file path. It then reads the targeted file, converts its content
|
|
||||||
* to a base64 string, and constructs a data URL which is then exported as the
|
|
||||||
* default export of a new JavaScript module.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* // To use this loader, import a file with ?base64 query:
|
|
||||||
* // import myImageBase64 from './path/to/myimage.png?base64';
|
|
||||||
* // myImageBase64 will then be a string like "data:image/png;base64,..."
|
|
||||||
*/
|
|
||||||
export const base64Loader = {
|
export const base64Loader = {
|
||||||
/**
|
|
||||||
* The name of the Vite plugin.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
name: "base64-loader",
|
name: "base64-loader",
|
||||||
/**
|
transform(_sourceCode: string, id: string) {
|
||||||
* The core transformation function of the Vite plugin.
|
void _sourceCode;
|
||||||
* It is called by Vite for modules that might need transformation. This function
|
|
||||||
* checks if the module ID includes the `?base64` query. If so, it reads the
|
|
||||||
* specified file, converts it to a base64 data URL, and returns a new
|
|
||||||
* JavaScript module that default exports this data URL.
|
|
||||||
*
|
|
||||||
* @param {any} _ The original code of the file. This parameter is unused by this loader.
|
|
||||||
* @param {string} id The ID of the module being transformed. This string typically
|
|
||||||
* contains the absolute file path and any query parameters
|
|
||||||
* (e.g., "/path/to/file.png?base64").
|
|
||||||
* @returns {string | null} If the module ID does not contain `?base64` query,
|
|
||||||
* it returns `null` to indicate no transformation.
|
|
||||||
* Otherwise, it returns a string of JavaScript code
|
|
||||||
* that default exports the base64 data URL of the file.
|
|
||||||
* For example: `export default 'data:image/png;base64,xxxx';`
|
|
||||||
*/
|
|
||||||
transform(_: any, id: string) {
|
|
||||||
const [filePath, query] = id.split("?");
|
const [filePath, query] = id.split("?");
|
||||||
if (query !== "base64") return null;
|
if (query !== "base64") return null;
|
||||||
|
|
||||||
|
|||||||
+3
-44
@@ -1,46 +1,5 @@
|
|||||||
import type { Browser, BuildTarget, Manifest } from "./types";
|
import type { Browser, BuildTarget, Manifest } from "./types.ts";
|
||||||
import type { AnyCase } from "./utils";
|
|
||||||
|
|
||||||
/**
|
export function createManifest(manifest: Manifest, browser: Browser): BuildTarget {
|
||||||
* Packages a given manifest object with a specific target browser identifier.
|
return { manifest, browser };
|
||||||
* This function is typically used in multi-browser extension build processes
|
|
||||||
* to create a configuration object that pairs the manifest data with the browser
|
|
||||||
* it's intended for. The `AnyCase<Browser>` type for the browser parameter
|
|
||||||
* implies that browser names like 'chrome', 'firefox', etc., can be provided
|
|
||||||
* in various casings.
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @param {Manifest} manifest The core manifest data for the extension,
|
|
||||||
* compatible with `chrome.runtime.ManifestV3` as defined by the {@link Manifest} type.
|
|
||||||
* @param {AnyCase<Browser>} browser The target browser identifier (e.g., 'chrome', 'firefox', 'CHROME').
|
|
||||||
* Refers to the {@link Browser} type, allowing for flexible casing.
|
|
||||||
* @returns {BuildTarget} An object that pairs the `manifest` with its target `browser`.
|
|
||||||
* The structure is `{ manifest: Manifest; browser: AnyCase<Browser>; }`
|
|
||||||
* as defined by the {@link BuildTarget} type.
|
|
||||||
*/
|
|
||||||
export function createManifest(
|
|
||||||
manifest: Manifest,
|
|
||||||
browser: AnyCase<Browser>,
|
|
||||||
): BuildTarget {
|
|
||||||
return {
|
|
||||||
manifest,
|
|
||||||
browser,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines a base manifest object.
|
|
||||||
* This function is typically used to establish a common, shared foundation for an extension's manifest
|
|
||||||
* (compatible with `chrome.runtime.ManifestV3` as per the {@link Manifest} type).
|
|
||||||
* This base can then be extended or modified for different browsers or specific build configurations.
|
|
||||||
* For example, you might define core permissions and properties here, and then add
|
|
||||||
* browser-specific keys in subsequent steps.
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @param {Manifest} manifest The core manifest data to be used as a base.
|
|
||||||
* This should conform to the {@link Manifest} type structure.
|
|
||||||
* @returns {Manifest} The provided manifest object, intended to serve as a reusable base.
|
|
||||||
*/
|
|
||||||
export function createManifestBase(manifest: Manifest): Manifest {
|
|
||||||
return manifest;
|
|
||||||
}
|
}
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
import { createHash } from "node:crypto";
|
|
||||||
import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
||||||
import { resolve } from "node:path";
|
|
||||||
import { dirname, relative } from "node:path/posix";
|
|
||||||
import { globSync } from "glob";
|
|
||||||
import type { Plugin } from "rollup";
|
|
||||||
|
|
||||||
const hash = (path: string) =>
|
|
||||||
createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
||||||
|
|
||||||
/** Reuse identical files already copied to stable extension paths. */
|
|
||||||
export default (): Plugin => ({
|
|
||||||
name: "dedupe-public-assets",
|
|
||||||
writeBundle({ dir }) {
|
|
||||||
if (!dir) return;
|
|
||||||
const files = globSync("**/*", { cwd: dir, nodir: true });
|
|
||||||
const stable = new Map<string, string>();
|
|
||||||
const duplicates = new Map<string, string>();
|
|
||||||
for (const file of files) {
|
|
||||||
if (file.startsWith("resources/"))
|
|
||||||
stable.set(hash(resolve(dir, file)), file);
|
|
||||||
}
|
|
||||||
for (const file of files) {
|
|
||||||
const match = file.startsWith("assets/")
|
|
||||||
? stable.get(hash(resolve(dir, file)))
|
|
||||||
: undefined;
|
|
||||||
if (match) duplicates.set(file, match);
|
|
||||||
}
|
|
||||||
for (const file of files.filter((file) =>
|
|
||||||
/\.(?:css|html|js)$/.test(file),
|
|
||||||
)) {
|
|
||||||
const path = resolve(dir, file);
|
|
||||||
let output = readFileSync(path, "utf8");
|
|
||||||
for (const [asset, canonical] of duplicates) {
|
|
||||||
output = output.replaceAll(
|
|
||||||
relative(dirname(file), asset),
|
|
||||||
relative(dirname(file), canonical),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
writeFileSync(path, output);
|
|
||||||
}
|
|
||||||
for (const file of duplicates.keys()) unlinkSync(resolve(dir, file));
|
|
||||||
|
|
||||||
const manifestPath = resolve(dir, "manifest.json");
|
|
||||||
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
||||||
for (const entry of manifest.web_accessible_resources ?? []) {
|
|
||||||
entry.resources = entry.resources.filter(
|
|
||||||
(file: string) => !duplicates.has(file),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
+2
-1
@@ -18,12 +18,13 @@ export default function InlineWorkerDevPlugin(): Plugin {
|
|||||||
format: "iife",
|
format: "iife",
|
||||||
target: "esnext",
|
target: "esnext",
|
||||||
minify: true,
|
minify: true,
|
||||||
|
conditions: ["onnxruntime-web-use-extern-wasm"],
|
||||||
alias: {
|
alias: {
|
||||||
"@huggingface/transformers": resolve(
|
"@huggingface/transformers": resolve(
|
||||||
"node_modules/@huggingface/transformers/dist/transformers.web.js",
|
"node_modules/@huggingface/transformers/dist/transformers.web.js",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
external: ["webextension-polyfill"],
|
external: ["@/lib/browser"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const workerCode = result.outputFiles[0].text;
|
const workerCode = result.outputFiles[0].text;
|
||||||
|
|||||||
+8
-64
@@ -11,35 +11,17 @@
|
|||||||
* or `node lib/publish.js --b firefox`
|
* or `node lib/publish.js --b firefox`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { globSync } = require("glob");
|
import { globSync } from "node:fs";
|
||||||
const semver = require("semver");
|
import semver from "semver";
|
||||||
const { execSync } = require("child_process");
|
import { execSync } from "node:child_process";
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines the latest version string from a list of filenames that include version numbers.
|
|
||||||
* Filenames are expected to follow a pattern like `betterseqtaplus@3.4.5.1-chrome.zip`.
|
|
||||||
* This function handles potential 4-part versions (e.g., `3.4.5.1`) by trimming them
|
|
||||||
* to 3 parts (e.g., `3.4.5`) for comparison using the `semver` library. After identifying
|
|
||||||
* the latest semver-compatible version, it returns the original full version string
|
|
||||||
* (e.g., "3.4.5.1") that corresponds to this latest version.
|
|
||||||
*
|
|
||||||
* @param {string[]} files An array of filenames.
|
|
||||||
* @returns {string | null} The latest version string (e.g., "3.4.5.1") found among the files,
|
|
||||||
* or `null` if no valid version numbers are found or no files are provided.
|
|
||||||
*/
|
|
||||||
function getLatestVersion(files) {
|
function getLatestVersion(files) {
|
||||||
console.log("Files passed to getLatestVersion:", files);
|
console.log("Files passed to getLatestVersion:", files);
|
||||||
|
|
||||||
const versions = files
|
const versions = files
|
||||||
.map((file) => {
|
.map((file) => {
|
||||||
const match = file.match(/@([\d\.]+)-/);
|
const match = file.match(/@([\d.]+)-/);
|
||||||
console.log(
|
console.log("Matching file:", file, "Version found:", match ? match[1] : "None");
|
||||||
"Matching file:",
|
|
||||||
file,
|
|
||||||
"Version found:",
|
|
||||||
match ? match[1] : "None",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
|
|
||||||
@@ -74,26 +56,13 @@ function getLatestVersion(files) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the original full version string that matches the identified latest SemVer version
|
// Get the original full version string that matches the identified latest SemVer version
|
||||||
const latestVersionData = versions.find(
|
const latestVersionData = versions.find((v) => v.semverVersion === latestSemver);
|
||||||
(v) => v.semverVersion === latestSemver,
|
|
||||||
);
|
|
||||||
const latestFullVersion = latestVersionData ? latestVersionData.fullVersion : null;
|
const latestFullVersion = latestVersionData ? latestVersionData.fullVersion : null;
|
||||||
|
|
||||||
console.log("Final selected latest version:", latestFullVersion);
|
console.log("Final selected latest version:", latestFullVersion);
|
||||||
return latestFullVersion;
|
return latestFullVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the path to the latest built ZIP file for a specific browser.
|
|
||||||
* It constructs a glob pattern based on the browser name (e.g., `dist/betterseqtaplus@*-*chrome.zip`),
|
|
||||||
* finds all matching files, and then uses `getLatestVersion` to identify the version string
|
|
||||||
* of the most recent file. Finally, it returns the full path to that specific file.
|
|
||||||
*
|
|
||||||
* @param {string} browser A string indicating the target browser (e.g., "chrome", "firefox").
|
|
||||||
* @returns {string | undefined} The filepath string to the latest ZIP file for the specified browser,
|
|
||||||
* or `undefined` if no matching file is found or if the latest version
|
|
||||||
* cannot be determined.
|
|
||||||
*/
|
|
||||||
function getLatestFiles(browser) {
|
function getLatestFiles(browser) {
|
||||||
const pattern = `dist/betterseqtaplus@*-*${browser}.zip`;
|
const pattern = `dist/betterseqtaplus@*-*${browser}.zip`;
|
||||||
console.log("Glob pattern:", pattern);
|
console.log("Glob pattern:", pattern);
|
||||||
@@ -119,14 +88,6 @@ function getLatestFiles(browser) {
|
|||||||
return latestFile;
|
return latestFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a ZIP file of the project's source code, excluding specified development-related
|
|
||||||
* files and directories such as `node_modules`, `dist`, `.git`, etc.
|
|
||||||
* It uses the `7z` command-line tool to perform the archiving.
|
|
||||||
* The output filename is fixed as `dist/betterseqtaplus@latest-sources.zip`.
|
|
||||||
*
|
|
||||||
* @returns {string} The filename of the created ZIP file (e.g., `dist/betterseqtaplus@latest-sources.zip`).
|
|
||||||
*/
|
|
||||||
function zipSources() {
|
function zipSources() {
|
||||||
const zipFileName = `dist/betterseqtaplus@latest-sources.zip`;
|
const zipFileName = `dist/betterseqtaplus@latest-sources.zip`;
|
||||||
|
|
||||||
@@ -152,26 +113,9 @@ function zipSources() {
|
|||||||
return zipFileName;
|
return zipFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Orchestrates the extension publishing process for the specified browsers.
|
|
||||||
* This function performs the following steps:
|
|
||||||
* 1. Calls `getLatestFiles` to find the latest built ZIP for Chrome if "chrome" is in `browsers`.
|
|
||||||
* 2. Calls `getLatestFiles` to find the latest built ZIP for Firefox if "firefox" is in `browsers`.
|
|
||||||
* 3. Calls `zipSources` to create a source code ZIP if "firefox" is in `browsers` (required for Mozilla Add-ons).
|
|
||||||
* 4. Validates that all required files were found and that at least one browser was specified. Exits if not.
|
|
||||||
* 5. Constructs the `publish-extension` command-line string with the appropriate arguments
|
|
||||||
* based on the found ZIP files for the specified browsers.
|
|
||||||
* 6. Executes the constructed `publish-extension` command.
|
|
||||||
*
|
|
||||||
* @param {string[]} browsers An array of browser strings (e.g., ["chrome", "firefox"]) for which to publish the extension.
|
|
||||||
*/
|
|
||||||
function runPublishCommand(browsers) {
|
function runPublishCommand(browsers) {
|
||||||
const chromeZip = browsers.includes("chrome")
|
const chromeZip = browsers.includes("chrome") ? getLatestFiles("chrome") : null;
|
||||||
? getLatestFiles("chrome")
|
const firefoxZip = browsers.includes("firefox") ? getLatestFiles("firefox") : null;
|
||||||
: null;
|
|
||||||
const firefoxZip = browsers.includes("firefox")
|
|
||||||
? getLatestFiles("firefox")
|
|
||||||
: null;
|
|
||||||
// Sources are typically only needed for Firefox submissions
|
// Sources are typically only needed for Firefox submissions
|
||||||
const firefoxSourcesZip = browsers.includes("firefox") ? zipSources() : null;
|
const firefoxSourcesZip = browsers.includes("firefox") ? zipSources() : null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import type { Plugin } from "vite";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Previously touched CSS mtimes on JS HMR to force style refresh.
|
|
||||||
* That raced with CRXJS runtime reload and corrupted Vite's module graph
|
|
||||||
* (missing named/`default` exports until `npm run dev` was restarted).
|
|
||||||
*
|
|
||||||
* Style updates are now covered by `stabilizeCrxDevHmr` full reloads.
|
|
||||||
*/
|
|
||||||
export default function touchGlobalCSSPlugin(): Plugin {
|
|
||||||
return {
|
|
||||||
name: "touch-global-css",
|
|
||||||
apply: "serve",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+2
-232
@@ -1,240 +1,10 @@
|
|||||||
import type { ManifestV3Export } from "@crxjs/vite-plugin";
|
import type { ManifestV3Export } from "@crxjs/vite-plugin";
|
||||||
import { type AnyCase, createEnum, ObjectValues } from "./utils";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerates supported JavaScript frameworks for project generation or configuration.
|
|
||||||
*/
|
|
||||||
export const FrameworkEnum = {
|
|
||||||
React: "React",
|
|
||||||
Vanilla: "Vanilla",
|
|
||||||
Preact: "Preact",
|
|
||||||
Lit: "Lit",
|
|
||||||
Svelte: "Svelte",
|
|
||||||
Vue: "Vue",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerates supported web browsers, typically for targeting builds or configurations.
|
|
||||||
*/
|
|
||||||
export const BrowserEnum = {
|
|
||||||
Chrome: "Chrome",
|
|
||||||
Brave: "Brave",
|
|
||||||
Opera: "Opera",
|
|
||||||
Edge: "Edge",
|
|
||||||
Firefox: "Firefox",
|
|
||||||
Safari: "Safari",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* Enumerates supported programming languages for project setup.
|
|
||||||
* This enum is not exported, suggesting it's for internal use within this module or related modules.
|
|
||||||
*/
|
|
||||||
const LanguageEnum = {
|
|
||||||
TypeScript: "TypeScript",
|
|
||||||
JavaScript: "JavaScript",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerates supported styling options or libraries.
|
|
||||||
*/
|
|
||||||
export const StyleEnum = {
|
|
||||||
Tailwind: "Tailwind",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerates supported package managers.
|
|
||||||
*/
|
|
||||||
export const PackageManagerEnum = {
|
|
||||||
Bun: "Bun",
|
|
||||||
PnPm: "PnPm",
|
|
||||||
Npm: "Npm",
|
|
||||||
Yarn: "Yarn",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the structure for browser-specific settings within a web extension manifest.
|
|
||||||
* This is particularly used for Firefox (gecko) extensions to specify properties like
|
|
||||||
* an extension ID, and minimum/maximum supported browser versions.
|
|
||||||
* The structure is based on common manifest extensions for Firefox.
|
|
||||||
* See: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings
|
|
||||||
* The link in the original code (// see: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/firefox-webext-browser/index.d.ts)
|
|
||||||
* also points to type definitions that include this structure.
|
|
||||||
*
|
|
||||||
* @property {object} [browser_specific_settings] - Container for browser-specific settings.
|
|
||||||
* @property {object} [browser_specific_settings.gecko] - Settings specific to Gecko-based browsers (e.g., Firefox).
|
|
||||||
* @property {string} [browser_specific_settings.gecko.id] - The unique identifier for the extension in Firefox.
|
|
||||||
* @property {string} [browser_specific_settings.gecko.strict_min_version] - The minimum version of Firefox the extension is compatible with.
|
|
||||||
* @property {string} [browser_specific_settings.gecko.strict_max_version] - The maximum version of Firefox the extension is compatible with.
|
|
||||||
*/
|
|
||||||
export type BrowserSpecificSettings = {
|
|
||||||
browser_specific_settings?: {
|
|
||||||
gecko?: {
|
|
||||||
id: string;
|
|
||||||
strict_min_version?: string;
|
|
||||||
strict_max_version?: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the structure of a Chrome Manifest V3 file.
|
|
||||||
* This type is an alias for `ManifestV3Export` from the `@crxjs/vite-plugin`,
|
|
||||||
* which provides a comprehensive definition for Chrome extension manifests.
|
|
||||||
*/
|
|
||||||
export type Manifest = ManifestV3Export;
|
export type Manifest = ManifestV3Export;
|
||||||
|
|
||||||
/** Alias for the `icons` property within a Chrome Manifest V3. */
|
export type Browser = "chrome" | "brave" | "edge" | "firefox" | "opera" | "safari";
|
||||||
export type ManifestIcons = chrome.runtime.ManifestIcons;
|
|
||||||
/** Alias for the `background` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestBackground = chrome.runtime.ManifestV3["background"];
|
|
||||||
/** Alias for the `content_scripts` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestContentScripts =
|
|
||||||
chrome.runtime.ManifestV3["content_scripts"];
|
|
||||||
/** Alias for the `web_accessible_resources` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestWebAccessibleResources =
|
|
||||||
chrome.runtime.ManifestV3["web_accessible_resources"];
|
|
||||||
/** Alias for the `commands` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestCommands = chrome.runtime.ManifestV3["commands"];
|
|
||||||
/** Alias for the `action` property (or `browser_action`/`page_action`) within a Chrome Manifest V3. */
|
|
||||||
export type ManifestAction = chrome.runtime.ManifestV3["action"];
|
|
||||||
/** Alias for the `permissions` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestPermissions = chrome.runtime.ManifestV3["permissions"];
|
|
||||||
/** Alias for the `options_ui` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestOptionsUI = chrome.runtime.ManifestV3["options_ui"];
|
|
||||||
/** Alias for the `chrome_url_overrides` property within a Chrome Manifest V3. */
|
|
||||||
export type ManifestURLOverrides =
|
|
||||||
chrome.runtime.ManifestV3["chrome_url_overrides"];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a type that accepts a string literal `T` in either its capitalized or lowercase form.
|
|
||||||
* Useful for defining types that should be case-insensitive for specific known strings.
|
|
||||||
* @template T - A string literal type.
|
|
||||||
*/
|
|
||||||
export type BrowserName<T extends string> = Capitalize<T> | Lowercase<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a record type where both keys and values are derived from a string literal `T`,
|
|
||||||
* specifically using `BrowserName<T>` which allows for capitalized or lowercase forms.
|
|
||||||
* This could be used to define an object where, for example, keys are 'Chrome' or 'chrome'
|
|
||||||
* and values are also 'Chrome' or 'chrome'.
|
|
||||||
* @template T - A string literal type, typically representing a browser name.
|
|
||||||
*/
|
|
||||||
export type BrowserEnumType<T extends string> = {
|
|
||||||
[browser in BrowserName<T>]: BrowserName<T>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the target browser for a build, allowing for various casings of browser names
|
|
||||||
* (e.g., "chrome", "Chrome", "CHROME") through the `AnyCase<Browser>` utility type.
|
|
||||||
* `Browser` itself is a union of specific browser name strings (e.g., "Chrome" | "Firefox").
|
|
||||||
*/
|
|
||||||
export type BuildMode = AnyCase<Browser>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines an object structure that pairs a web extension `Manifest`
|
|
||||||
* with its target `browser` (represented as `AnyCase<Browser>`).
|
|
||||||
* This is commonly used in build processes to manage configurations for different browsers.
|
|
||||||
*/
|
|
||||||
export type BuildTarget = {
|
export type BuildTarget = {
|
||||||
manifest: Manifest;
|
manifest: Manifest;
|
||||||
browser: AnyCase<Browser>;
|
browser: Browser;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the configuration options for a build process.
|
|
||||||
* @property {"build" | "serve"} [command] - The type of build command (e.g., 'build' for production, 'serve' for development).
|
|
||||||
* @property {AnyCase<Browser> | string | undefined} [mode] - The target build mode, typically a browser name (allowing various casings)
|
|
||||||
* or potentially other custom mode strings.
|
|
||||||
*/
|
|
||||||
export type BuildConfig = {
|
|
||||||
command?: "build" | "serve";
|
|
||||||
mode?: AnyCase<Browser> | string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the structure for repository information, commonly found in `package.json`.
|
|
||||||
* @property {string} type - The type of the repository (e.g., "git").
|
|
||||||
* @property {string} [url] - The URL of the repository.
|
|
||||||
* @property {Bugs} [bugs] - An object containing information about where to report bugs.
|
|
||||||
*/
|
|
||||||
export interface Repository {
|
|
||||||
type: string;
|
|
||||||
url?: string;
|
|
||||||
bugs?: Bugs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the structure for bug reporting information, often part of the `Repository` interface.
|
|
||||||
* @property {string} [url] - The URL of the issue tracker.
|
|
||||||
* @property {string} [email] - The email address for reporting bugs.
|
|
||||||
*/
|
|
||||||
export interface Bugs {
|
|
||||||
url?: string;
|
|
||||||
email?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string literal union type representing supported browser names, derived from the values of `BrowserEnum`.
|
|
||||||
* e.g., "Chrome" | "Firefox" | ...
|
|
||||||
*/
|
|
||||||
export type Browser = ObjectValues<typeof BrowserEnum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A constant intended to provide access to browser names, potentially in various casings.
|
|
||||||
* Its type `AnyCase<Browser>` suggests it can be used where case-insensitivity for browser names is needed.
|
|
||||||
* The `createEnum(BrowserEnum)` call aims to produce a representation of browser names from `BrowserEnum`.
|
|
||||||
* Note: `createEnum` from `lib/utils.ts` has a declared return type of `ObjectValues<T>` (a union of values),
|
|
||||||
* while its implementation uses `Object.values()` which returns an array. This constant will hold the
|
|
||||||
* runtime array value, but its JSDoc type refers to the more restrictive `AnyCase<Browser>` union type.
|
|
||||||
*/
|
|
||||||
export const Browser: AnyCase<Browser> = createEnum(BrowserEnum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string literal union type representing supported package managers, derived from the values of `PackageManagerEnum`.
|
|
||||||
* e.g., "Bun" | "PnPm" | "Npm" | "Yarn"
|
|
||||||
*/
|
|
||||||
export type PackageManager = ObjectValues<typeof PackageManagerEnum>;
|
|
||||||
/**
|
|
||||||
* A constant intended to provide access to package manager names, potentially in various casings.
|
|
||||||
* Its type `AnyCase<PackageManager>` suggests it can be used where case-insensitivity for package manager names is needed.
|
|
||||||
* Utilizes `createEnum(PackageManagerEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
|
|
||||||
*/
|
|
||||||
export const PackageManager: AnyCase<PackageManager> =
|
|
||||||
createEnum(PackageManagerEnum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string literal union type representing supported JavaScript frameworks, derived from the values of `FrameworkEnum`.
|
|
||||||
* e.g., "React" | "Vanilla" | ...
|
|
||||||
*/
|
|
||||||
export type Framework = ObjectValues<typeof FrameworkEnum>;
|
|
||||||
/**
|
|
||||||
* A constant intended to provide access to framework names, potentially in various casings.
|
|
||||||
* Its type `AnyCase<Framework>` suggests it can be used where case-insensitivity for framework names is needed.
|
|
||||||
* Utilizes `createEnum(FrameworkEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
|
|
||||||
*/
|
|
||||||
export const Framework: AnyCase<Framework> = createEnum(FrameworkEnum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string literal union type representing supported styling options, derived from the values of `StyleEnum`.
|
|
||||||
* e.g., "Tailwind"
|
|
||||||
*/
|
|
||||||
export type Style = ObjectValues<typeof StyleEnum>;
|
|
||||||
/**
|
|
||||||
* A constant intended to provide access to style option names, potentially in various casings.
|
|
||||||
* Its type `AnyCase<Style>` suggests it can be used where case-insensitivity for style names is needed.
|
|
||||||
* Utilizes `createEnum(StyleEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
|
|
||||||
*/
|
|
||||||
export const Style: AnyCase<Style> = createEnum(StyleEnum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string literal union type representing supported programming languages, derived from the values of `LanguageEnum`.
|
|
||||||
* e.g., "TypeScript" | "JavaScript"
|
|
||||||
*/
|
|
||||||
export type Language = ObjectValues<typeof LanguageEnum>;
|
|
||||||
/**
|
|
||||||
* A constant intended to provide access to programming language names, potentially in various casings.
|
|
||||||
* Its type `AnyCase<Language>` suggests it can be used where case-insensitivity for language names is needed.
|
|
||||||
* Utilizes `createEnum(LanguageEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
|
|
||||||
*/
|
|
||||||
export const Language: AnyCase<Language> = createEnum(LanguageEnum);
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/**
|
|
||||||
* Extracts a union type of all values from the properties of an object type `T`.
|
|
||||||
*
|
|
||||||
* @template T - An object type (typically a Record or an enum-like object).
|
|
||||||
* @example
|
|
||||||
* type MyObject = { a: "foo", b: "bar", c: 123 };
|
|
||||||
* type MyObjectValues = ObjectValues<MyObject>; // "foo" | "bar" | 123
|
|
||||||
*/
|
|
||||||
export type ObjectValues<T> = T[keyof T];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a union of an object's string values, often used to represent the set of possible values for an enum-like object.
|
|
||||||
* Note: The implementation `Object.values(enumObj) as unknown as ObjectValues<T>` returns an array at runtime,
|
|
||||||
* but the declared return type `ObjectValues<T>` is a union of the object's property values.
|
|
||||||
* This type signature suggests it's intended to represent the set of possible string values from `enumObj`.
|
|
||||||
*
|
|
||||||
* @template T - An object type where keys are strings and values are strings (e.g., `const MyEnum = { VAL_A: "A", VAL_B: "B" }`).
|
|
||||||
* @param {T} enumObj - The object from which to extract values.
|
|
||||||
* @returns {ObjectValues<T>} A union type representing all possible string values of the `enumObj`.
|
|
||||||
* For example, if `enumObj` is `{ A: "valA", B: "valB" }`, the return type is `"valA" | "valB"`.
|
|
||||||
* (Runtime behavior of `Object.values()` is to return an array like `["valA", "valB"]`).
|
|
||||||
*/
|
|
||||||
export function createEnum<T extends Record<string, string>>(enumObj: T) {
|
|
||||||
return Object.values(enumObj) as unknown as ObjectValues<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a union type that includes various case formats (uppercase, lowercase, capitalized, uncapitalized)
|
|
||||||
* of a given string literal type `T`.
|
|
||||||
*
|
|
||||||
* @template T - A string literal type.
|
|
||||||
* @example
|
|
||||||
* type MyString = "example";
|
|
||||||
* type MyStringAnyCase = AnyCase<MyString>; // "EXAMPLE" | "example" | "Example" | "example" (Uncapitalize<"Example"> is "example")
|
|
||||||
*/
|
|
||||||
export type AnyCase<T extends string> =
|
|
||||||
| Uppercase<T>
|
|
||||||
| Lowercase<T>
|
|
||||||
| Capitalize<T>
|
|
||||||
| Uncapitalize<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a union type that includes various case formats (uppercase, lowercase, capitalized, uncapitalized)
|
|
||||||
* of the union of two given string literal types `T` and `K`.
|
|
||||||
* This is useful for representing a combined set of related string constants where case variations are permitted for each.
|
|
||||||
*
|
|
||||||
* @template T - A string literal type.
|
|
||||||
* @template K - Another string literal type.
|
|
||||||
* @example
|
|
||||||
* type Lang1 = "english";
|
|
||||||
* type Lang2 = "french";
|
|
||||||
* type CombinedLangsAnyCase = AnyCaseLanguage<Lang1, Lang2>;
|
|
||||||
* // Result includes: "ENGLISH" | "english" | "English" | "FRENCH" | "french" | "French" etc.
|
|
||||||
* // for all case variations of "english" and "french".
|
|
||||||
*/
|
|
||||||
export type AnyCaseLanguage<T extends string, K extends string> =
|
|
||||||
| Uppercase<T | K>
|
|
||||||
| Lowercase<T | K>
|
|
||||||
| Capitalize<T | K>
|
|
||||||
| Uncapitalize<T | K>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extracts a new object type containing only the keys of `T` whose properties are optional
|
|
||||||
* (i.e., their type includes `undefined`). The values associated with these keys retain their original types.
|
|
||||||
*
|
|
||||||
* @template T - An object type.
|
|
||||||
* @example
|
|
||||||
* type MyObject = {
|
|
||||||
* requiredProp: string;
|
|
||||||
* optionalProp?: number;
|
|
||||||
* anotherOptional?: boolean | undefined;
|
|
||||||
* nullProp: string | null;
|
|
||||||
* };
|
|
||||||
* type MyOptionalProps = OptionalKeys<MyObject>;
|
|
||||||
* // MyOptionalProps would be conceptually equivalent to:
|
|
||||||
* // {
|
|
||||||
* // optionalProp?: number;
|
|
||||||
* // anotherOptional?: boolean | undefined;
|
|
||||||
* // }
|
|
||||||
* // The actual resulting type is an object type with only these optional keys.
|
|
||||||
*/
|
|
||||||
export type OptionalKeys<T> = {
|
|
||||||
[K in keyof T as undefined extends T[K] ? K : never]: T[K];
|
|
||||||
};
|
|
||||||
Generated
+11123
File diff suppressed because it is too large.
Load diff
+77
-84
@@ -1,9 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "betterseqtaplus",
|
"name": "betterseqtaplus",
|
||||||
"version": "3.7.6",
|
"version": "3.7.6",
|
||||||
"type": "module",
|
|
||||||
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development and add heaps more features!",
|
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development and add heaps more features!",
|
||||||
"browserslist": "> 0.5%, last 2 versions, not dead",
|
"keywords": [],
|
||||||
|
"license": "MIT",
|
||||||
|
"author": {
|
||||||
|
"name": "SethBurkart123",
|
||||||
|
"email": "betterseqta.plus@gmail.com",
|
||||||
|
"url": "https://github.com/BetterSEQTA/BetterSEQTA-Plus"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile:layerchart": "node scripts/compile-layerchart-vendor.mjs",
|
"compile:layerchart": "node scripts/compile-layerchart-vendor.mjs",
|
||||||
"postinstall": "node scripts/copy-runtime-assets.mjs && npm run compile:layerchart",
|
"postinstall": "node scripts/copy-runtime-assets.mjs && npm run compile:layerchart",
|
||||||
@@ -17,105 +23,92 @@
|
|||||||
"build:safari": "cross-env MODE=safari vite build",
|
"build:safari": "cross-env MODE=safari vite build",
|
||||||
"build:dev": "cross-env MODE=chrome SOURCEMAP=true vite build && cross-env MODE=firefox SOURCEMAP=true vite build",
|
"build:dev": "cross-env MODE=chrome SOURCEMAP=true vite build && cross-env MODE=firefox SOURCEMAP=true vite build",
|
||||||
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
|
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
|
||||||
"dependency-graph": "depcruise src --include-only \"^src\" --output-type dot | dot -T svg > dependency-graph.svg",
|
"lint": "oxlint --deny-warnings",
|
||||||
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint \"src/**/*.{js,ts}\"",
|
"format": "oxfmt",
|
||||||
|
"format:check": "oxfmt --check",
|
||||||
|
"typecheck": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings",
|
||||||
"test": "npm run test:unit",
|
"test": "npm run test:unit",
|
||||||
"test:unit": "jest",
|
"test:unit": "cross-env NODE_OPTIONS=--no-experimental-webstorage jest",
|
||||||
"test:smoke": "node scripts/smoke-test.mjs",
|
"test:smoke": "node scripts/smoke-test.mjs",
|
||||||
"test:ci": "npm run test:unit && npm run build && npm run test:smoke",
|
"test:ci": "npm run test:unit && npm run build && npm run test:smoke",
|
||||||
"release": "gh release create $npm_package_version --repo BetterSEQTA/BetterSEQTA-Plus ./dist/*.zip --generate-notes",
|
"release": "gh release create $npm_package_version --repo BetterSEQTA/BetterSEQTA-Plus ./dist/*.zip --generate-notes",
|
||||||
"publish": "bun lib/publish.js --b",
|
"publish": "node lib/publish.js --b",
|
||||||
"zip": "node scripts/package-extension-zips.mjs"
|
"zip": "node scripts/package-extension-zips.mjs"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
|
||||||
"author": {
|
|
||||||
"name": "SethBurkart123",
|
|
||||||
"email": "betterseqta.plus@gmail.com",
|
|
||||||
"url": "https://github.com/BetterSEQTA/BetterSEQTA-Plus"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/runtime": "^7.26.9",
|
|
||||||
"@bedframe/cli": "^0.1.2",
|
|
||||||
"@crxjs/vite-plugin": "^2.6.1",
|
|
||||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
||||||
"@tailwindcss/forms": "^0.5.10",
|
|
||||||
"@tsconfig/svelte": "^5.0.4",
|
|
||||||
"@types/chrome": "^0.1.4",
|
|
||||||
"@types/color": "^4.2.0",
|
|
||||||
"@types/d3-scale": "^4.0.9",
|
|
||||||
"@types/d3-shape": "^3.1.8",
|
|
||||||
"@types/jest": "^30.0.0",
|
|
||||||
"@types/mime-types": "^3.0.1",
|
|
||||||
"@types/node": "^24.3.0",
|
|
||||||
"@types/qrcode": "^1.5.6",
|
|
||||||
"@types/react": "^17.0.0",
|
|
||||||
"@types/react-dom": "^17.0.0",
|
|
||||||
"@types/sortablejs": "^1.15.8",
|
|
||||||
"@types/webextension-polyfill": "^0.12.3",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^8.60.1",
|
|
||||||
"@typescript-eslint/parser": "^8.60.1",
|
|
||||||
"autoprefixer": "^10.4.21",
|
|
||||||
"cross-env": "^10.0.0",
|
|
||||||
"dependency-cruiser": "^17.0.1",
|
|
||||||
"esbuild": "^0.25.3",
|
|
||||||
"eslint": "^9.33.0",
|
|
||||||
"eslint-plugin-import": "^2.31.0",
|
|
||||||
"glob": "^13.0.6",
|
|
||||||
"jest": "^30.4.2",
|
|
||||||
"jest-environment-jsdom": "^30.4.1",
|
|
||||||
"mime-types": "^3.0.1",
|
|
||||||
"postcss": "^8.5.3",
|
|
||||||
"prettier": "^3.5.3",
|
|
||||||
"publish-browser-extension": "^4.0.4",
|
|
||||||
"sass": "^1.85.1",
|
|
||||||
"tailwindcss": "3",
|
|
||||||
"ts-jest": "^29.4.11",
|
|
||||||
"typescript": "^5.8.2",
|
|
||||||
"vite": "^6.2.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bedframe/core": "^0.1.0",
|
"@codemirror/autocomplete": "^6.20.4",
|
||||||
"@codemirror/autocomplete": "^6.18.6",
|
"@codemirror/commands": "^6.11.1",
|
||||||
"@codemirror/commands": "^6.8.0",
|
|
||||||
"@codemirror/lang-css": "^6.3.1",
|
"@codemirror/lang-css": "^6.3.1",
|
||||||
"@codemirror/language": "^6.10.8",
|
"@codemirror/language": "^6.13.1",
|
||||||
"@codemirror/search": "^6.5.10",
|
"@codemirror/search": "^6.7.2",
|
||||||
"@codemirror/state": "^6.5.2",
|
"@codemirror/state": "^6.7.6",
|
||||||
"@codemirror/view": "^6.36.4",
|
"@codemirror/view": "^6.43.15",
|
||||||
"@huggingface/transformers": "^3.8.1",
|
"@huggingface/transformers": "^3.8.1",
|
||||||
"@uiw/codemirror-extensions-color": "^4.23.10",
|
"@uiw/codemirror-extensions-color": "^4.25.12",
|
||||||
"@uiw/codemirror-theme-github": "^4.23.10",
|
"@uiw/codemirror-theme-github": "^4.25.12",
|
||||||
"canvas-confetti": "^1.9.3",
|
"canvas-confetti": "^1.9.4",
|
||||||
"color": "^5.0.0",
|
"color": "^5.0.3",
|
||||||
"d3-scale": "^4.0.2",
|
"d3-scale": "^4.0.2",
|
||||||
"d3-shape": "^3.2.0",
|
"d3-shape": "^3.2.0",
|
||||||
"dompurify": "^3.2.4",
|
"dompurify": "^3.4.17",
|
||||||
"embeddia": "^1.3.0",
|
"embeddia": "^1.3.0",
|
||||||
"embla-carousel-autoplay": "^8.5.2",
|
"embla-carousel-autoplay": "^8.6.0",
|
||||||
"embla-carousel-svelte": "^8.5.2",
|
"embla-carousel-svelte": "^8.6.0",
|
||||||
"fuse.js": "^7.1.0",
|
"fuse.js": "^7.5.0",
|
||||||
"layerchart": "2.0.0-next.27",
|
"layerchart": "^2.9.2",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"mathjs": "^14.4.0",
|
"mathjs": "^15.2.0",
|
||||||
"motion": "^12.4.12",
|
"motion": "^14.9.0",
|
||||||
"pdfjs-dist": "^5.4.530",
|
"pdfjs-dist": "^6.5.438",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"react": "17",
|
|
||||||
"react-best-gradient-color-picker": "3.0.11",
|
|
||||||
"react-dom": "17",
|
|
||||||
"rss-parser": "^3.13.0",
|
|
||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
"sortablejs": "^1.15.6",
|
"sortablejs": "^1.15.7",
|
||||||
"svelte": "^5.46.4",
|
"svelte": "^5.57.3"
|
||||||
"webextension-polyfill": "^0.12.0"
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@crxjs/vite-plugin": "^3.0.0",
|
||||||
|
"@jest/globals": "30.5.2",
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
||||||
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
|
"@tailwindcss/postcss": "^4.3.3",
|
||||||
|
"@tsconfig/svelte": "^5.0.8",
|
||||||
|
"@types/canvas-confetti": "^1.9.0",
|
||||||
|
"@types/chrome": "^0.3.7",
|
||||||
|
"@types/d3-scale": "^4.0.9",
|
||||||
|
"@types/d3-shape": "^3.2.0",
|
||||||
|
"@types/jest": "^30.0.0",
|
||||||
|
"@types/mime-types": "^3.0.1",
|
||||||
|
"@types/node": "^26.6.6",
|
||||||
|
"@types/qrcode": "^1.5.6",
|
||||||
|
"@types/semver": "^7.8.0",
|
||||||
|
"@types/sortablejs": "^1.15.9",
|
||||||
|
"cross-env": "^10.1.0",
|
||||||
|
"esbuild": "^0.28.2",
|
||||||
|
"jest": "^30.5.2",
|
||||||
|
"jest-environment-jsdom": "^30.5.2",
|
||||||
|
"mime-types": "^3.0.2",
|
||||||
|
"oxfmt": "^0.75.0",
|
||||||
|
"oxlint": "^1.90.0",
|
||||||
|
"publish-browser-extension": "^6.2.0",
|
||||||
|
"sass": "^1.107.1",
|
||||||
|
"svelte-check": "^4.7.8",
|
||||||
|
"tailwindcss": "^4.3.3",
|
||||||
|
"ts-jest": "^29.4.15",
|
||||||
|
"typescript": "~6.0.3",
|
||||||
|
"vite": "^8.3.5"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"glob": "^13.0.6"
|
"glob": "^14.0.3"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
||||||
"overrides": {
|
"engines": {
|
||||||
"glob": "^13.0.6"
|
"node": ">=26"
|
||||||
}
|
},
|
||||||
|
"allowScripts": {
|
||||||
|
"@parcel/watcher": false,
|
||||||
|
"esbuild": false,
|
||||||
|
"onnxruntime-node": false,
|
||||||
|
"protobufjs": false,
|
||||||
|
"sharp": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+66
-52
@@ -13,7 +13,6 @@ if (!path) {
|
|||||||
const raw = fs.readFileSync(path, "utf8");
|
const raw = fs.readFileSync(path, "utf8");
|
||||||
const { traceEvents } = JSON.parse(raw);
|
const { traceEvents } = JSON.parse(raw);
|
||||||
|
|
||||||
const DURATION_PHASES = new Set(["X", "b", "e"]);
|
|
||||||
const openStacks = new Map(); // key -> { name, cat, args, ts }
|
const openStacks = new Map(); // key -> { name, cat, args, ts }
|
||||||
|
|
||||||
const byName = new Map();
|
const byName = new Map();
|
||||||
@@ -40,10 +39,6 @@ function add(map, key, dur, count = 1) {
|
|||||||
map.set(key, e);
|
map.set(key, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stackKey(ev) {
|
|
||||||
return `${ev.pid}:${ev.tid}:${ev.name}:${ev.ts}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const ev of traceEvents) {
|
for (const ev of traceEvents) {
|
||||||
if (ev.ts != null) {
|
if (ev.ts != null) {
|
||||||
minTs = Math.min(minTs, ev.ts);
|
minTs = Math.min(minTs, ev.ts);
|
||||||
@@ -75,20 +70,13 @@ for (const ev of traceEvents) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const url =
|
const url =
|
||||||
args.data?.url ??
|
args.data?.url ?? args.url ?? args.fileName ?? args.data?.scriptName ?? args.data?.frame ?? "";
|
||||||
args.url ??
|
|
||||||
args.fileName ??
|
|
||||||
args.data?.scriptName ??
|
|
||||||
args.data?.frame ??
|
|
||||||
"";
|
|
||||||
if (url && typeof url === "string" && dur > 0) {
|
if (url && typeof url === "string" && dur > 0) {
|
||||||
add(byUrl, url.slice(0, 200), dur);
|
add(byUrl, url.slice(0, 200), dur);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn =
|
const fn =
|
||||||
args.data?.functionName ??
|
(args.data?.functionName ?? args.functionName ?? args.data?.columnNumber != null)
|
||||||
args.functionName ??
|
|
||||||
args.data?.columnNumber != null
|
|
||||||
? `${args.data?.functionName ?? name}@${args.data?.url ?? ""}:${args.data?.lineNumber ?? "?"}`
|
? `${args.data?.functionName ?? name}@${args.data?.url ?? ""}:${args.data?.lineNumber ?? "?"}`
|
||||||
: "";
|
: "";
|
||||||
if (fn && dur > 100) {
|
if (fn && dur > 100) {
|
||||||
@@ -104,10 +92,18 @@ for (const ev of traceEvents) {
|
|||||||
if (name === "RunTask" && dur > 50000) {
|
if (name === "RunTask" && dur > 50000) {
|
||||||
longTasks.push({ dur, ts: ev.ts, cat, args: JSON.stringify(args).slice(0, 300) });
|
longTasks.push({ dur, ts: ev.ts, cat, args: JSON.stringify(args).slice(0, 300) });
|
||||||
}
|
}
|
||||||
if (/Timer|setTimeout|setInterval|FireIdleCallback|requestAnimationFrame|RequestAnimationFrame/i.test(name)) {
|
if (
|
||||||
|
/Timer|setTimeout|setInterval|FireIdleCallback|requestAnimationFrame|RequestAnimationFrame/i.test(
|
||||||
|
name,
|
||||||
|
)
|
||||||
|
) {
|
||||||
timers.push({ name, dur, ts: ev.ts });
|
timers.push({ name, dur, ts: ev.ts });
|
||||||
}
|
}
|
||||||
if (/MutationObserver|ResizeObserver|IntersectionObserver|DeliverObservations|NotifyMutation/i.test(name)) {
|
if (
|
||||||
|
/MutationObserver|ResizeObserver|IntersectionObserver|DeliverObservations|NotifyMutation/i.test(
|
||||||
|
name,
|
||||||
|
)
|
||||||
|
) {
|
||||||
observers.push({ name, dur, ts: ev.ts });
|
observers.push({ name, dur, ts: ev.ts });
|
||||||
}
|
}
|
||||||
if (/HitTest|FindElement|ElementAt/i.test(name)) {
|
if (/HitTest|FindElement|ElementAt/i.test(name)) {
|
||||||
@@ -142,39 +138,57 @@ function top(map, n = 40, minCount = 1) {
|
|||||||
|
|
||||||
const traceDurationMs = ((maxTs - minTs) / 1000).toFixed(0);
|
const traceDurationMs = ((maxTs - minTs) / 1000).toFixed(0);
|
||||||
|
|
||||||
console.log(JSON.stringify({
|
console.log(
|
||||||
summary: {
|
JSON.stringify(
|
||||||
traceDurationMs,
|
{
|
||||||
eventCount: traceEvents.length,
|
summary: {
|
||||||
layoutCount: layoutEvents.length,
|
traceDurationMs,
|
||||||
layoutTotalMs: (layoutEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
eventCount: traceEvents.length,
|
||||||
paintCount: paintEvents.length,
|
layoutCount: layoutEvents.length,
|
||||||
paintTotalMs: (paintEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
layoutTotalMs: (layoutEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
longTaskCount: longTasks.length,
|
paintCount: paintEvents.length,
|
||||||
longTaskTotalMs: (longTasks.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
paintTotalMs: (paintEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
timerCount: timers.length,
|
longTaskCount: longTasks.length,
|
||||||
timerTotalMs: (timers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
longTaskTotalMs: (longTasks.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
observerCount: observers.length,
|
timerCount: timers.length,
|
||||||
observerTotalMs: (observers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
timerTotalMs: (timers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
hitTestCount: hitTests.length,
|
observerCount: observers.length,
|
||||||
hitTestTotalMs: (hitTests.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
observerTotalMs: (observers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
gcCount: gcEvents.length,
|
hitTestCount: hitTests.length,
|
||||||
gcTotalMs: (gcEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
hitTestTotalMs: (hitTests.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
},
|
gcCount: gcEvents.length,
|
||||||
topEventNames: top(byName, 50),
|
gcTotalMs: (gcEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
|
||||||
topCategories: top(byCat, 30),
|
},
|
||||||
topUrls: top(byUrl, 40),
|
topEventNames: top(byName, 50),
|
||||||
topFunctions: top(byFunction, 40, 1),
|
topCategories: top(byCat, 30),
|
||||||
topBetterseqta: top(betterseqtaHits, 50),
|
topUrls: top(byUrl, 40),
|
||||||
topLongTasks: longTasks.sort((a, b) => b.dur - a.dur).slice(0, 20).map(e => ({
|
topFunctions: top(byFunction, 40, 1),
|
||||||
ms: (e.dur / 1000).toFixed(1),
|
topBetterseqta: top(betterseqtaHits, 50),
|
||||||
cat: e.cat,
|
topLongTasks: longTasks
|
||||||
args: e.args,
|
.sort((a, b) => b.dur - a.dur)
|
||||||
})),
|
.slice(0, 20)
|
||||||
topLayout: layoutEvents.sort((a, b) => b.dur - a.dur).slice(0, 15).map(e => ({
|
.map((e) => ({
|
||||||
name: e.name, ms: (e.dur / 1000).toFixed(2),
|
ms: (e.dur / 1000).toFixed(1),
|
||||||
})),
|
cat: e.cat,
|
||||||
topObservers: observers.sort((a, b) => b.dur - a.dur).slice(0, 15).map(e => ({
|
args: e.args,
|
||||||
name: e.name, ms: (e.dur / 1000).toFixed(2), count: 1,
|
})),
|
||||||
})),
|
topLayout: layoutEvents
|
||||||
}, null, 2));
|
.sort((a, b) => b.dur - a.dur)
|
||||||
|
.slice(0, 15)
|
||||||
|
.map((e) => ({
|
||||||
|
name: e.name,
|
||||||
|
ms: (e.dur / 1000).toFixed(2),
|
||||||
|
})),
|
||||||
|
topObservers: observers
|
||||||
|
.sort((a, b) => b.dur - a.dur)
|
||||||
|
.slice(0, 15)
|
||||||
|
.map((e) => ({
|
||||||
|
name: e.name,
|
||||||
|
ms: (e.dur / 1000).toFixed(2),
|
||||||
|
count: 1,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
);
|
||||||
@@ -33,7 +33,9 @@ const layerchartVersion = JSON.parse(
|
|||||||
const stampContent = `${layerchartVersion}\n${COMPILE_ALGO_VERSION}`;
|
const stampContent = `${layerchartVersion}\n${COMPILE_ALGO_VERSION}`;
|
||||||
|
|
||||||
if (exists(stampPath) && readFileSync(stampPath, "utf8").trim() === stampContent) {
|
if (exists(stampPath) && readFileSync(stampPath, "utf8").trim() === stampContent) {
|
||||||
console.log(`compile-layerchart-vendor: layerchart@${layerchartVersion} already compiled, skipping`);
|
console.log(
|
||||||
|
`compile-layerchart-vendor: layerchart@${layerchartVersion} already compiled, skipping`,
|
||||||
|
);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,9 +51,7 @@ const walkFiles = (dir, files = []) => {
|
|||||||
|
|
||||||
const patchSvelteImports = (content) => content.replace(importSuffixPattern, ".js");
|
const patchSvelteImports = (content) => content.replace(importSuffixPattern, ".js");
|
||||||
const stripRollupBreakingSyntax = (code) =>
|
const stripRollupBreakingSyntax = (code) =>
|
||||||
code
|
code.replace(/(\w+)\?(?=\s*[,)\]])/g, "$1").replace(/(\w+)\?(?=\s*:)/g, "$1");
|
||||||
.replace(/(\w+)\?(?=\s*[,)\]])/g, "$1")
|
|
||||||
.replace(/(\w+)\?(?=\s*:)/g, "$1");
|
|
||||||
|
|
||||||
const svelteFiles = walkFiles(layerchartDist).filter((f) => f.endsWith(".svelte"));
|
const svelteFiles = walkFiles(layerchartDist).filter((f) => f.endsWith(".svelte"));
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ function assertManifest(browserDir) {
|
|||||||
if (!manifest.name) fail(`${browserDir} manifest missing name`);
|
if (!manifest.name) fail(`${browserDir} manifest missing name`);
|
||||||
if (!manifest.version) fail(`${browserDir} manifest missing version`);
|
if (!manifest.version) fail(`${browserDir} manifest missing version`);
|
||||||
|
|
||||||
const sw =
|
const sw = manifest.background?.service_worker ?? manifest.background?.scripts?.[0] ?? null;
|
||||||
manifest.background?.service_worker ??
|
|
||||||
manifest.background?.scripts?.[0] ??
|
|
||||||
null;
|
|
||||||
if (sw) {
|
if (sw) {
|
||||||
const swPath = path.join(root, "dist", browserDir, sw);
|
const swPath = path.join(root, "dist", browserDir, sw);
|
||||||
if (!fs.existsSync(swPath)) {
|
if (!fs.existsSync(swPath)) {
|
||||||
|
|||||||
@@ -25,10 +25,7 @@ const [bootScript, errorPageScript]: string[] = JSON.parse(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
test.each([
|
test.each([{ onoff: false }, { "plugin.error-page-kitten.settings": { enabled: false } }])(
|
||||||
{ onoff: false },
|
|
||||||
{ "plugin.error-page-kitten.settings": { enabled: false } },
|
|
||||||
])(
|
|
||||||
"disabled 404 customization preserves the native error message: %j",
|
"disabled 404 customization preserves the native error message: %j",
|
||||||
async (stored) => {
|
async (stored) => {
|
||||||
document.head.innerHTML = "";
|
document.head.innerHTML = "";
|
||||||
@@ -47,7 +44,7 @@ test.each([
|
|||||||
});
|
});
|
||||||
return loaded.exports;
|
return loaded.exports;
|
||||||
}
|
}
|
||||||
if (module === "webextension-polyfill") {
|
if (module === "@/lib/browser") {
|
||||||
return { storage: { local: { get: async () => stored } } };
|
return { storage: { local: { get: async () => stored } } };
|
||||||
}
|
}
|
||||||
if (module.includes("errorPageKitten")) {
|
if (module.includes("errorPageKitten")) {
|
||||||
@@ -64,8 +61,6 @@ test.each([
|
|||||||
for (let i = 0; i < 10; i++) await Promise.resolve();
|
for (let i = 0; i < 10; i++) await Promise.resolve();
|
||||||
|
|
||||||
expect(mount).not.toHaveBeenCalled();
|
expect(mount).not.toHaveBeenCalled();
|
||||||
expect(
|
expect(window.getComputedStyle(document.querySelector(".message")!).display).not.toBe("none");
|
||||||
window.getComputedStyle(document.querySelector(".message")!).display,
|
|
||||||
).not.toBe("none");
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
+3
-8
@@ -10,13 +10,10 @@ let isSeqtaPage = false;
|
|||||||
// This check is placed outside of the document load event due to issues with EP (https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/84)
|
// This check is placed outside of the document load event due to issues with EP (https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/84)
|
||||||
if (document.childNodes[1]) {
|
if (document.childNodes[1]) {
|
||||||
hasSEQTAText =
|
hasSEQTAText =
|
||||||
document.childNodes[1].textContent?.includes(
|
document.childNodes[1].textContent?.includes("Copyright (c) SEQTA Software") ?? false;
|
||||||
"Copyright (c) SEQTA Software",
|
|
||||||
) ?? false;
|
|
||||||
isSeqtaPage =
|
isSeqtaPage =
|
||||||
hasSEQTAText &&
|
hasSEQTAText &&
|
||||||
(document.title.includes("SEQTA Learn") ||
|
(document.title.includes("SEQTA Learn") || document.title.includes("SEQTA Engage"));
|
||||||
document.title.includes("SEQTA Engage"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSEQTAText) {
|
if (hasSEQTAText) {
|
||||||
@@ -25,9 +22,7 @@ if (hasSEQTAText) {
|
|||||||
|
|
||||||
// Standalone 404 documents never pass the SEQTA SPA gate above.
|
// Standalone 404 documents never pass the SEQTA SPA gate above.
|
||||||
if (!isSeqtaPage) {
|
if (!isSeqtaPage) {
|
||||||
void import("@/seqta/bootErrorPage").then(({ bootErrorPage }) =>
|
void import("@/seqta/bootErrorPage").then(({ bootErrorPage }) => bootErrorPage());
|
||||||
bootErrorPage(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
|
|||||||
+117
-179
@@ -1,5 +1,4 @@
|
|||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import semver from "semver";
|
|
||||||
import type { SettingsState } from "@/types/storage";
|
import type { SettingsState } from "@/types/storage";
|
||||||
import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings";
|
import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings";
|
||||||
import { ensureSyncableStorageDefaults } from "@/seqta/utils/ensureSyncableStorageDefaults";
|
import { ensureSyncableStorageDefaults } from "@/seqta/utils/ensureSyncableStorageDefaults";
|
||||||
@@ -14,10 +13,11 @@ import {
|
|||||||
} from "./background/cloudSettingsAutoSync";
|
} from "./background/cloudSettingsAutoSync";
|
||||||
import { getBsplusDeviceName } from "@/seqta/utils/bsplusDeviceName";
|
import { getBsplusDeviceName } from "@/seqta/utils/bsplusDeviceName";
|
||||||
import { isAllowedFetchUrl } from "@/seqta/utils/allowedFetchUrl";
|
import { isAllowedFetchUrl } from "@/seqta/utils/allowedFetchUrl";
|
||||||
import { initCalendarBackground } from "./background/calendarBackground";
|
|
||||||
import {
|
import {
|
||||||
|
initCalendarBackground,
|
||||||
registerGoogleCalendarMessageHandlers,
|
registerGoogleCalendarMessageHandlers,
|
||||||
registerOutlookCalendarMessageHandlers,
|
registerOutlookCalendarMessageHandlers,
|
||||||
|
type CalendarMessageHandlerMap,
|
||||||
} from "./background/calendarBackground";
|
} from "./background/calendarBackground";
|
||||||
import { createCustomThemesHandlers } from "./background/customThemesHandlers";
|
import { createCustomThemesHandlers } from "./background/customThemesHandlers";
|
||||||
import {
|
import {
|
||||||
@@ -26,9 +26,11 @@ import {
|
|||||||
refreshRemoteConfig,
|
refreshRemoteConfig,
|
||||||
} from "./background/remoteConfig";
|
} from "./background/remoteConfig";
|
||||||
import { BSPLUS_INSTALL_REGISTERED_AT_KEY } from "@/seqta/utils/remoteConfig/storageKeys";
|
import { BSPLUS_INSTALL_REGISTERED_AT_KEY } from "@/seqta/utils/remoteConfig/storageKeys";
|
||||||
|
import { DEFAULT_BACKGROUND_PENDING_KEY } from "@/seqta/ui/defaultBackgroundKey";
|
||||||
import { handleSearchThemeStockPhotos } from "./background/searchThemeStockPhotos";
|
import { handleSearchThemeStockPhotos } from "./background/searchThemeStockPhotos";
|
||||||
import { bsplusApiQueryParams, withBsplusApiQuery } from "@/seqta/utils/bsplusClientContext";
|
import { bsplusApiQueryParams, withBsplusApiQuery } from "@/seqta/utils/bsplusClientContext";
|
||||||
import { initTimetableClassmatesBackgroundSync } from "./background/timetableClassmatesSync";
|
import { initTimetableClassmatesBackgroundSync } from "./background/timetableClassmatesSync";
|
||||||
|
import { runStorageMigrations } from "./background/storageMigrations";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session-only dev-mode override of the content API base.
|
* Session-only dev-mode override of the content API base.
|
||||||
@@ -49,12 +51,9 @@ function apiBase(): string {
|
|||||||
|
|
||||||
function reloadSeqtaPages() {
|
function reloadSeqtaPages() {
|
||||||
const result = browser.tabs.query({});
|
const result = browser.tabs.query({});
|
||||||
function open(tabs: any) {
|
function open(tabs: chrome.tabs.Tab[]) {
|
||||||
for (let tab of tabs) {
|
for (const tab of tabs) {
|
||||||
if (
|
if (tab.title?.includes("SEQTA Learn") || tab.title?.includes("SEQTA Engage")) {
|
||||||
tab.title?.includes("SEQTA Learn") ||
|
|
||||||
tab.title?.includes("SEQTA Engage")
|
|
||||||
) {
|
|
||||||
browser.tabs.reload(tab.id);
|
browser.tabs.reload(tab.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,6 +64,14 @@ function reloadSeqtaPages() {
|
|||||||
/** Callback for sending a response back to the message sender */
|
/** Callback for sending a response back to the message sender */
|
||||||
type MessageSender = { (response?: unknown): void };
|
type MessageSender = { (response?: unknown): void };
|
||||||
|
|
||||||
|
/** Runtime message payloads from extension pages / content scripts */
|
||||||
|
type BackgroundRequest = Record<string, unknown>;
|
||||||
|
|
||||||
|
function reqString(req: BackgroundRequest, key: string): string | undefined {
|
||||||
|
const value = req[key];
|
||||||
|
return typeof value === "string" ? value : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
async function getAccessTokenFromStorage(): Promise<string | null> {
|
async function getAccessTokenFromStorage(): Promise<string | null> {
|
||||||
const { bsplus_token } = await browser.storage.local.get("bsplus_token");
|
const { bsplus_token } = await browser.storage.local.get("bsplus_token");
|
||||||
return typeof bsplus_token === "string" && bsplus_token.length > 0 ? bsplus_token : null;
|
return typeof bsplus_token === "string" && bsplus_token.length > 0 ? bsplus_token : null;
|
||||||
@@ -103,7 +110,7 @@ function normalizeFetchThemesResponse(json: unknown): {
|
|||||||
return { success: true, data: { themes } };
|
return { success: true, data: { themes } };
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchThemes(request: any, sendResponse: MessageSender): boolean {
|
function handleFetchThemes(_request: unknown, sendResponse: MessageSender): boolean {
|
||||||
void (async () => {
|
void (async () => {
|
||||||
const token = await getAccessTokenFromStorage();
|
const token = await getAccessTokenFromStorage();
|
||||||
const params = await bsplusApiQueryParams();
|
const params = await bsplusApiQueryParams();
|
||||||
@@ -119,7 +126,10 @@ function handleFetchThemes(request: any, sendResponse: MessageSender): boolean {
|
|||||||
const json = await r.json();
|
const json = await r.json();
|
||||||
if (!r.ok) {
|
if (!r.ok) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
(json && typeof json === "object" && "error" in json && typeof (json as { error?: string }).error === "string"
|
(json &&
|
||||||
|
typeof json === "object" &&
|
||||||
|
"error" in json &&
|
||||||
|
typeof (json as { error?: string }).error === "string"
|
||||||
? (json as { error: string }).error
|
? (json as { error: string }).error
|
||||||
: null) ?? `Themes API HTTP ${r.status}`,
|
: null) ?? `Themes API HTTP ${r.status}`,
|
||||||
);
|
);
|
||||||
@@ -146,7 +156,7 @@ function handleFetchThemes(request: any, sendResponse: MessageSender): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchThemeDetails(request: any, sendResponse: MessageSender): boolean {
|
function handleFetchThemeDetails(request: BackgroundRequest, sendResponse: MessageSender): boolean {
|
||||||
const { themeId } = request;
|
const { themeId } = request;
|
||||||
if (!themeId || typeof themeId !== "string") {
|
if (!themeId || typeof themeId !== "string") {
|
||||||
sendResponse({ success: false, error: "Missing themeId" });
|
sendResponse({ success: false, error: "Missing themeId" });
|
||||||
@@ -170,28 +180,26 @@ function handleFetchThemeDetails(request: any, sendResponse: MessageSender): boo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTrustedSender(sender?: browser.Runtime.MessageSender): boolean {
|
function isTrustedSender(sender?: chrome.runtime.MessageSender): boolean {
|
||||||
if (!sender) return false;
|
if (!sender) return false;
|
||||||
if (sender.id && sender.id !== browser.runtime.id) return false;
|
if (sender.id && sender.id !== browser.runtime.id) return false;
|
||||||
|
|
||||||
const urls = [sender.url, sender.tab?.url].filter(Boolean) as string[];
|
const urls = [sender.url, sender.tab?.url].filter(Boolean) as string[];
|
||||||
for (const pageUrl of urls) {
|
for (const pageUrl of urls) {
|
||||||
if (/^chrome-extension:\/\//.test(pageUrl) || /^moz-extension:\/\//.test(pageUrl)) {
|
if (pageUrl.startsWith("chrome-extension://") || pageUrl.startsWith("moz-extension://")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (isSeqtaOrigin(new URL(pageUrl).origin)) return true;
|
if (isSeqtaOrigin(new URL(pageUrl).origin)) return true;
|
||||||
} catch {
|
} catch {}
|
||||||
// try next URL
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchFromUrl(
|
function handleFetchFromUrl(
|
||||||
request: any,
|
request: BackgroundRequest,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
sender?: browser.Runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!isTrustedSender(sender)) {
|
if (!isTrustedSender(sender)) {
|
||||||
sendResponse({ error: "Unauthorized sender" });
|
sendResponse({ error: "Unauthorized sender" });
|
||||||
@@ -239,7 +247,7 @@ function handleFetchFromUrl(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function parseJsonResponse(r: Response): Promise<any> {
|
async function parseJsonResponse(r: Response): Promise<unknown> {
|
||||||
const text = await r.text();
|
const text = await r.text();
|
||||||
try {
|
try {
|
||||||
return text ? JSON.parse(text) : {};
|
return text ? JSON.parse(text) : {};
|
||||||
@@ -248,8 +256,12 @@ async function parseJsonResponse(r: Response): Promise<any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudReserveClient(request: any, sendResponse: MessageSender): boolean {
|
function handleCloudReserveClient(
|
||||||
const redirect_uri = request.redirect_uri ?? "https://accounts.betterseqta.org/auth/bsplus/callback";
|
request: BackgroundRequest,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
|
const redirect_uri =
|
||||||
|
request.redirect_uri ?? "https://accounts.betterseqta.org/auth/bsplus/callback";
|
||||||
fetch("https://accounts.betterseqta.org/api/bsplus/client/reserve", {
|
fetch("https://accounts.betterseqta.org/api/bsplus/client/reserve", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
@@ -257,7 +269,11 @@ function handleCloudReserveClient(request: any, sendResponse: MessageSender): bo
|
|||||||
})
|
})
|
||||||
.then(async (r) => {
|
.then(async (r) => {
|
||||||
const data = await parseJsonResponse(r);
|
const data = await parseJsonResponse(r);
|
||||||
if (!r.ok) sendResponse({ error: data?.error ?? `Reserve failed (${r.status})` });
|
const errorText =
|
||||||
|
data && typeof data === "object" && "error" in data
|
||||||
|
? String((data as { error?: unknown }).error)
|
||||||
|
: undefined;
|
||||||
|
if (!r.ok) sendResponse({ error: errorText ?? `Reserve failed (${r.status})` });
|
||||||
else sendResponse(data);
|
else sendResponse(data);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -268,15 +284,19 @@ function handleCloudReserveClient(request: any, sendResponse: MessageSender): bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudLogin(
|
function handleCloudLogin(
|
||||||
request: any,
|
request: BackgroundRequest,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
sender?: browser.Runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!isTrustedSender(sender)) {
|
if (!isTrustedSender(sender)) {
|
||||||
sendResponse({ error: "Unauthorized sender" });
|
sendResponse({ error: "Unauthorized sender" });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const { client_id, redirect_uri, login, password, device_name } = request;
|
const client_id = reqString(request, "client_id");
|
||||||
|
const redirect_uri = reqString(request, "redirect_uri");
|
||||||
|
const login = reqString(request, "login");
|
||||||
|
const password = reqString(request, "password");
|
||||||
|
const device_name = reqString(request, "device_name");
|
||||||
if (!client_id || !redirect_uri || !login || !password) {
|
if (!client_id || !redirect_uri || !login || !password) {
|
||||||
sendResponse({ error: "Missing client_id, redirect_uri, login, or password" });
|
sendResponse({ error: "Missing client_id, redirect_uri, login, or password" });
|
||||||
return false;
|
return false;
|
||||||
@@ -287,7 +307,7 @@ function handleCloudLogin(
|
|||||||
redirect_uri,
|
redirect_uri,
|
||||||
login,
|
login,
|
||||||
password,
|
password,
|
||||||
device_name: device_name ?? await getBsplusDeviceName(),
|
device_name: device_name ?? (await getBsplusDeviceName()),
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const r = await fetch("https://accounts.betterseqta.org/api/bsplus/login", {
|
const r = await fetch("https://accounts.betterseqta.org/api/bsplus/login", {
|
||||||
@@ -296,7 +316,11 @@ function handleCloudLogin(
|
|||||||
body: JSON.stringify(loginBody),
|
body: JSON.stringify(loginBody),
|
||||||
});
|
});
|
||||||
const data = await parseJsonResponse(r);
|
const data = await parseJsonResponse(r);
|
||||||
if (!r.ok) sendResponse({ error: data?.error ?? "Login failed" });
|
const errorText =
|
||||||
|
data && typeof data === "object" && "error" in data
|
||||||
|
? String((data as { error?: unknown }).error)
|
||||||
|
: undefined;
|
||||||
|
if (!r.ok) sendResponse({ error: errorText ?? "Login failed" });
|
||||||
else sendResponse(data);
|
else sendResponse(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("[Background] cloudLogin error:", err);
|
console.error("[Background] cloudLogin error:", err);
|
||||||
@@ -306,26 +330,30 @@ function handleCloudLogin(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudStartLogin(request: any, sendResponse: MessageSender): boolean {
|
function handleCloudStartLogin(request: BackgroundRequest, sendResponse: MessageSender): boolean {
|
||||||
const { client_id, redirect_uri } = request;
|
const client_id = reqString(request, "client_id");
|
||||||
|
const redirect_uri = reqString(request, "redirect_uri");
|
||||||
if (!client_id || !redirect_uri) {
|
if (!client_id || !redirect_uri) {
|
||||||
sendResponse({ error: "Missing client_id or redirect_uri" });
|
sendResponse({ error: "Missing client_id or redirect_uri" });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const authorizeUrl = `https://accounts.betterseqta.org/login?redirect=${encodeURIComponent(`/oauth/authorize?client_id=${client_id}&redirect_uri=${encodeURIComponent(redirect_uri)}`)}`;
|
const authorizeUrl = `https://accounts.betterseqta.org/login?redirect=${encodeURIComponent(`/oauth/authorize?client_id=${client_id}&redirect_uri=${encodeURIComponent(redirect_uri)}`)}`;
|
||||||
browser.tabs.create({ url: authorizeUrl }).then(() => {
|
browser.tabs
|
||||||
sendResponse({ success: true });
|
.create({ url: authorizeUrl })
|
||||||
}).catch((err) => {
|
.then(() => {
|
||||||
console.error("[Background] cloudStartLogin error:", err);
|
sendResponse({ success: true });
|
||||||
sendResponse({ error: err?.message ?? "Failed to open login page" });
|
})
|
||||||
});
|
.catch((err) => {
|
||||||
|
console.error("[Background] cloudStartLogin error:", err);
|
||||||
|
sendResponse({ error: err?.message ?? "Failed to open login page" });
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CALLBACK_URL_PREFIX = "https://accounts.betterseqta.org/auth/bsplus/callback";
|
const CALLBACK_URL_PREFIX = "https://accounts.betterseqta.org/auth/bsplus/callback";
|
||||||
|
|
||||||
function initCloudLoginCallbackListener() {
|
function initCloudLoginCallbackListener() {
|
||||||
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
browser.tabs.onUpdated.addListener((tabId, changeInfo) => {
|
||||||
if (changeInfo.url && changeInfo.url.startsWith(CALLBACK_URL_PREFIX)) {
|
if (changeInfo.url && changeInfo.url.startsWith(CALLBACK_URL_PREFIX)) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(changeInfo.url);
|
const url = new URL(changeInfo.url);
|
||||||
@@ -334,7 +362,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
const userId = url.searchParams.get("user_id");
|
const userId = url.searchParams.get("user_id");
|
||||||
|
|
||||||
if (token && refreshToken) {
|
if (token && refreshToken) {
|
||||||
// Store tokens
|
|
||||||
void (async () => {
|
void (async () => {
|
||||||
try {
|
try {
|
||||||
await browser.storage.local.set({
|
await browser.storage.local.set({
|
||||||
@@ -342,7 +369,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
bsplus_refresh_token: refreshToken,
|
bsplus_refresh_token: refreshToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch full user info
|
|
||||||
const userRes = await fetch("https://accounts.betterseqta.org/api/auth/me", {
|
const userRes = await fetch("https://accounts.betterseqta.org/api/auth/me", {
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
});
|
});
|
||||||
@@ -353,7 +379,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
await browser.storage.local.set({ bsplus_user: { id: userId } });
|
await browser.storage.local.set({ bsplus_user: { id: userId } });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger cloud settings download
|
|
||||||
void performCloudSettingsDownloadWithRetry(token).catch((err) => {
|
void performCloudSettingsDownloadWithRetry(token).catch((err) => {
|
||||||
console.warn("[Background] Cloud settings download after login:", err);
|
console.warn("[Background] Cloud settings download after login:", err);
|
||||||
});
|
});
|
||||||
@@ -362,7 +387,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Close the callback tab
|
|
||||||
void browser.tabs.remove(tabId);
|
void browser.tabs.remove(tabId);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -374,7 +398,7 @@ function initCloudLoginCallbackListener() {
|
|||||||
|
|
||||||
initCloudLoginCallbackListener();
|
initCloudLoginCallbackListener();
|
||||||
|
|
||||||
function handleCloudRefresh(request: any, sendResponse: MessageSender): boolean {
|
function handleCloudRefresh(request: BackgroundRequest, sendResponse: MessageSender): boolean {
|
||||||
const { refresh_token, client_id } = request;
|
const { refresh_token, client_id } = request;
|
||||||
if (!refresh_token || !client_id) {
|
if (!refresh_token || !client_id) {
|
||||||
sendResponse({ error: "Missing refresh_token or client_id" });
|
sendResponse({ error: "Missing refresh_token or client_id" });
|
||||||
@@ -387,7 +411,11 @@ function handleCloudRefresh(request: any, sendResponse: MessageSender): boolean
|
|||||||
})
|
})
|
||||||
.then(async (r) => {
|
.then(async (r) => {
|
||||||
const data = await parseJsonResponse(r);
|
const data = await parseJsonResponse(r);
|
||||||
if (!r.ok) sendResponse({ error: data?.error ?? "Refresh failed" });
|
const errorText =
|
||||||
|
data && typeof data === "object" && "error" in data
|
||||||
|
? String((data as { error?: unknown }).error)
|
||||||
|
: undefined;
|
||||||
|
if (!r.ok) sendResponse({ error: errorText ?? "Refresh failed" });
|
||||||
else sendResponse(data);
|
else sendResponse(data);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -398,9 +426,9 @@ function handleCloudRefresh(request: any, sendResponse: MessageSender): boolean
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudSettingsUpload(
|
function handleCloudSettingsUpload(
|
||||||
request: any,
|
_request: unknown,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
sender?: browser.Runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!isTrustedSender(sender)) {
|
if (!isTrustedSender(sender)) {
|
||||||
sendResponse({ success: false, error: "Unauthorized sender" });
|
sendResponse({ success: false, error: "Unauthorized sender" });
|
||||||
@@ -431,9 +459,9 @@ function handleCloudSettingsUpload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudSettingsDownload(
|
function handleCloudSettingsDownload(
|
||||||
request: any,
|
_request: unknown,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
sender?: browser.Runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!isTrustedSender(sender)) {
|
if (!isTrustedSender(sender)) {
|
||||||
sendResponse({ success: false, error: "Unauthorized sender" });
|
sendResponse({ success: false, error: "Unauthorized sender" });
|
||||||
@@ -464,7 +492,7 @@ function handleCloudSettingsDownload(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudFavorite(request: any, sendResponse: MessageSender): boolean {
|
function handleCloudFavorite(request: BackgroundRequest, sendResponse: MessageSender): boolean {
|
||||||
const { themeId, action } = request;
|
const { themeId, action } = request;
|
||||||
if (!themeId) {
|
if (!themeId) {
|
||||||
sendResponse({ success: false, error: "Theme ID required" });
|
sendResponse({ success: false, error: "Theme ID required" });
|
||||||
@@ -493,7 +521,11 @@ function handleCloudFavorite(request: any, sendResponse: MessageSender): boolean
|
|||||||
|
|
||||||
/** Handler for a message type; receives request, sendResponse, and optional sender (for tab routing) */
|
/** Handler for a message type; receives request, sendResponse, and optional sender (for tab routing) */
|
||||||
type MessageHandler = {
|
type MessageHandler = {
|
||||||
(request: any, sendResponse: MessageSender, sender?: browser.Runtime.MessageSender): boolean | void;
|
(
|
||||||
|
request: BackgroundRequest,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
sender?: chrome.runtime.MessageSender,
|
||||||
|
): boolean | void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function isSeqtaOrigin(origin: string): boolean {
|
function isSeqtaOrigin(origin: string): boolean {
|
||||||
@@ -506,9 +538,9 @@ function isSeqtaOrigin(origin: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleSetDevApiBase(
|
function handleSetDevApiBase(
|
||||||
request: any,
|
request: BackgroundRequest,
|
||||||
_sendResponse: MessageSender,
|
_sendResponse: MessageSender,
|
||||||
sender?: browser.Runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!isTrustedSender(sender)) return false;
|
if (!isTrustedSender(sender)) return false;
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
@@ -568,7 +600,8 @@ const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
|||||||
sendResponse({ error: "Unauthorized sender" });
|
sendResponse({ error: "Unauthorized sender" });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fetchNews(req.source ?? "australia", sendResponse);
|
const source = typeof req.source === "string" ? req.source : undefined;
|
||||||
|
void fetchNews(source).then((news) => sendResponse({ news }));
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
fetchThemes: handleFetchThemes,
|
fetchThemes: handleFetchThemes,
|
||||||
@@ -589,7 +622,11 @@ const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
|||||||
requestCloudSettingsDebouncedUpload();
|
requestCloudSettingsDebouncedUpload();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
getSeqtaSession: (req: { baseUrl?: string }, sendResponse: MessageSender, sender?: browser.Runtime.MessageSender) => {
|
getSeqtaSession: (
|
||||||
|
req: { baseUrl?: string },
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
sender?: chrome.runtime.MessageSender,
|
||||||
|
) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
let tabId = sender?.tab?.id;
|
let tabId = sender?.tab?.id;
|
||||||
@@ -616,7 +653,8 @@ const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
|||||||
const reply = (await browser.tabs.sendMessage(tabId, { type: "fetchSeqtaAppLink" })) as
|
const reply = (await browser.tabs.sendMessage(tabId, { type: "fetchSeqtaAppLink" })) as
|
||||||
| { appLink?: string | null }
|
| { appLink?: string | null }
|
||||||
| undefined;
|
| undefined;
|
||||||
const appLink = typeof reply?.appLink === "string" && reply.appLink.length > 0 ? reply.appLink : null;
|
const appLink =
|
||||||
|
typeof reply?.appLink === "string" && reply.appLink.length > 0 ? reply.appLink : null;
|
||||||
sendResponse({ appLink });
|
sendResponse({ appLink });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("[Background] getSeqtaSession error:", err);
|
console.error("[Background] getSeqtaSession error:", err);
|
||||||
@@ -627,14 +665,23 @@ const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
registerGoogleCalendarMessageHandlers(MESSAGE_HANDLERS, isTrustedSender);
|
registerGoogleCalendarMessageHandlers(
|
||||||
registerOutlookCalendarMessageHandlers(MESSAGE_HANDLERS, isTrustedSender);
|
MESSAGE_HANDLERS as CalendarMessageHandlerMap,
|
||||||
|
isTrustedSender,
|
||||||
|
);
|
||||||
|
registerOutlookCalendarMessageHandlers(
|
||||||
|
MESSAGE_HANDLERS as CalendarMessageHandlerMap,
|
||||||
|
isTrustedSender,
|
||||||
|
);
|
||||||
initCalendarBackground();
|
initCalendarBackground();
|
||||||
|
|
||||||
browser.runtime.onMessage.addListener(
|
browser.runtime.onMessage.addListener(
|
||||||
// @ts-ignore - OnMessageListener expects literal true for async, we return boolean
|
(
|
||||||
(request: any, sender: browser.Runtime.MessageSender, sendResponse: MessageSender) => {
|
request: BackgroundRequest,
|
||||||
const handler = MESSAGE_HANDLERS[request.type];
|
sender: chrome.runtime.MessageSender,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
) => {
|
||||||
|
const handler = MESSAGE_HANDLERS[request.type as string];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
const result = handler(request, sendResponse, sender);
|
const result = handler(request, sendResponse, sender);
|
||||||
return result === true;
|
return result === true;
|
||||||
@@ -654,134 +701,17 @@ function SetStorageValue(object: SettingsState) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One-time migration for 3.6.5: opt upgraders into Global Search + indexing + transparency defaults. */
|
|
||||||
const GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY = "plugin.global-search.settings";
|
|
||||||
const GLOBAL_SEARCH_MIGRATION_VERSION = "3.6.5";
|
|
||||||
|
|
||||||
async function migrateGlobalSearchDefaultsFor365Upgrade(
|
|
||||||
previousVersion: string,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
|
||||||
const currRaw = browser.runtime.getManifest().version;
|
|
||||||
const prev = semver.coerce(previousVersion);
|
|
||||||
const curr = semver.coerce(currRaw);
|
|
||||||
if (
|
|
||||||
prev == null ||
|
|
||||||
curr == null ||
|
|
||||||
semver.lt(curr, GLOBAL_SEARCH_MIGRATION_VERSION) ||
|
|
||||||
!semver.lt(prev, GLOBAL_SEARCH_MIGRATION_VERSION)
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const got = await browser.storage.local.get(GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY);
|
|
||||||
const existing = (got[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY] ?? {}) as Record<
|
|
||||||
string,
|
|
||||||
unknown
|
|
||||||
>;
|
|
||||||
|
|
||||||
await browser.storage.local.set({
|
|
||||||
[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY]: {
|
|
||||||
...existing,
|
|
||||||
enabled: true,
|
|
||||||
transparencyEffects: true,
|
|
||||||
runIndexingOnLoad: true,
|
|
||||||
passiveIndexing: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.info(
|
|
||||||
`[BetterSEQTA+] Migration ${GLOBAL_SEARCH_MIGRATION_VERSION}: Global Search and related settings enabled (from ${previousVersion}).`,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("[BetterSEQTA+] Global Search 3.6.5 settings migration failed:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** One-time reset for 3.6.6: re-enable Theme of the Month for existing users. */
|
|
||||||
const THEME_OF_THE_MONTH_RESET_VERSION = "3.6.6";
|
|
||||||
|
|
||||||
async function resetThemeOfTheMonthDisabledFor366Upgrade(
|
|
||||||
previousVersion: string,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
|
||||||
const currRaw = browser.runtime.getManifest().version;
|
|
||||||
const prev = semver.coerce(previousVersion);
|
|
||||||
const curr = semver.coerce(currRaw);
|
|
||||||
if (
|
|
||||||
prev == null ||
|
|
||||||
curr == null ||
|
|
||||||
semver.lt(curr, THEME_OF_THE_MONTH_RESET_VERSION) ||
|
|
||||||
!semver.lt(prev, THEME_OF_THE_MONTH_RESET_VERSION)
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await browser.storage.local.set({
|
|
||||||
themeOfTheMonthDisabled: false,
|
|
||||||
themeOfTheMonthLastSeenId: undefined,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.info(
|
|
||||||
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RESET_VERSION}: Theme of the Month re-enabled (from ${previousVersion}).`,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn(
|
|
||||||
"[BetterSEQTA+] Theme of the Month 3.6.6 reset migration failed:",
|
|
||||||
e,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 3.7.0: Close no longer marks entries seen — clear legacy dismissal keys. */
|
|
||||||
const THEME_OF_THE_MONTH_RELOAD_VERSION = "3.7.0";
|
|
||||||
|
|
||||||
async function resetThemeOfTheMonthDismissalFor370Upgrade(
|
|
||||||
previousVersion: string,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
|
||||||
const currRaw = browser.runtime.getManifest().version;
|
|
||||||
const prev = semver.coerce(previousVersion);
|
|
||||||
const curr = semver.coerce(currRaw);
|
|
||||||
if (
|
|
||||||
prev == null ||
|
|
||||||
curr == null ||
|
|
||||||
semver.lt(curr, THEME_OF_THE_MONTH_RELOAD_VERSION) ||
|
|
||||||
!semver.lt(prev, THEME_OF_THE_MONTH_RELOAD_VERSION)
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await browser.storage.local.set({
|
|
||||||
themeOfTheMonthLastSeenId: undefined,
|
|
||||||
themeOfTheMonthDismissedMonth: undefined,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.info(
|
|
||||||
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RELOAD_VERSION}: Theme of the Month shows again until dismissed for the month (from ${previousVersion}).`,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn(
|
|
||||||
"[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:",
|
|
||||||
e,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
browser.runtime.onInstalled.addListener(function (event) {
|
browser.runtime.onInstalled.addListener(function (event) {
|
||||||
browser.storage.local.remove(["justupdated"]);
|
browser.storage.local.remove(["justupdated", "data"]);
|
||||||
browser.storage.local.remove(["data"]);
|
|
||||||
|
|
||||||
void ensureSyncableStorageDefaults();
|
const defaultsReady = ensureSyncableStorageDefaults();
|
||||||
|
|
||||||
if (event.reason == "install" || event.reason == "update") {
|
if (event.reason == "install" || event.reason == "update") {
|
||||||
browser.storage.local.set({ justupdated: true });
|
browser.storage.local.set({ justupdated: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.reason === "update" && event.previousVersion) {
|
if (event.reason === "update" && event.previousVersion) {
|
||||||
void migrateGlobalSearchDefaultsFor365Upgrade(event.previousVersion);
|
void runStorageMigrations(event.previousVersion);
|
||||||
void resetThemeOfTheMonthDisabledFor366Upgrade(event.previousVersion);
|
|
||||||
void resetThemeOfTheMonthDismissalFor370Upgrade(event.previousVersion);
|
|
||||||
void browser.storage.local.remove(BSPLUS_INSTALL_REGISTERED_AT_KEY).then(() => {
|
void browser.storage.local.remove(BSPLUS_INSTALL_REGISTERED_AT_KEY).then(() => {
|
||||||
void refreshRemoteConfig(apiBase);
|
void refreshRemoteConfig(apiBase);
|
||||||
});
|
});
|
||||||
@@ -790,6 +720,14 @@ browser.runtime.onInstalled.addListener(function (event) {
|
|||||||
|
|
||||||
if (event.reason === "install") {
|
if (event.reason === "install") {
|
||||||
void refreshRemoteConfig(apiBase);
|
void refreshRemoteConfig(apiBase);
|
||||||
|
void browser.storage.local.set({ [DEFAULT_BACKGROUND_PENDING_KEY]: true });
|
||||||
|
void defaultsReady
|
||||||
|
.catch(() => undefined)
|
||||||
|
.then(async () => {
|
||||||
|
const key = "plugin.animated-background.settings";
|
||||||
|
const { [key]: settings } = await browser.storage.local.get(key);
|
||||||
|
await browser.storage.local.set({ [key]: { ...(settings as object), enabled: false } });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import {
|
|||||||
writeOutlookCalendarState,
|
writeOutlookCalendarState,
|
||||||
type OutlookCalendarStatus,
|
type OutlookCalendarStatus,
|
||||||
} from "@/seqta/utils/calendarSync/providerStorage";
|
} from "@/seqta/utils/calendarSync/providerStorage";
|
||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import { isSeqtaTab } from "@/seqta/utils/seqtaTabMatch";
|
import { isSeqtaTab } from "@/seqta/utils/seqtaTabMatch";
|
||||||
|
|
||||||
const WEEKLY_PERIOD_MINUTES = 7 * 24 * 60;
|
const WEEKLY_PERIOD_MINUTES = 7 * 24 * 60;
|
||||||
@@ -60,7 +60,7 @@ const WEEKLY_PERIOD_MINUTES = 7 * 24 * 60;
|
|||||||
export type CalendarMessageHandler = (
|
export type CalendarMessageHandler = (
|
||||||
request: unknown,
|
request: unknown,
|
||||||
sendResponse: (response?: unknown) => void,
|
sendResponse: (response?: unknown) => void,
|
||||||
sender?: browser.Runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
) => boolean | void;
|
) => boolean | void;
|
||||||
|
|
||||||
export type CalendarMessageHandlerMap = Record<string, CalendarMessageHandler>;
|
export type CalendarMessageHandlerMap = Record<string, CalendarMessageHandler>;
|
||||||
@@ -71,6 +71,7 @@ type StoredTokens = {
|
|||||||
expiresAt?: number;
|
expiresAt?: number;
|
||||||
lastSyncAt?: number;
|
lastSyncAt?: number;
|
||||||
lastSyncOrigin?: string;
|
lastSyncOrigin?: string;
|
||||||
|
calendarId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type OAuthTabFlowOptions = {
|
type OAuthTabFlowOptions = {
|
||||||
@@ -116,7 +117,14 @@ function createProviderBackend(
|
|||||||
return {
|
return {
|
||||||
...backend,
|
...backend,
|
||||||
exchange: (code, redirectUri, verifier) =>
|
exchange: (code, redirectUri, verifier) =>
|
||||||
exchangeAccountsCode(tokenUrl, code, redirectUri, verifier, notReadyHint, includeErrorDescription),
|
exchangeAccountsCode(
|
||||||
|
tokenUrl,
|
||||||
|
code,
|
||||||
|
redirectUri,
|
||||||
|
verifier,
|
||||||
|
notReadyHint,
|
||||||
|
includeErrorDescription,
|
||||||
|
),
|
||||||
refresh: (refreshToken) =>
|
refresh: (refreshToken) =>
|
||||||
refreshAccountsToken(refreshUrl, refreshToken, notReadyHint, includeErrorDescription),
|
refreshAccountsToken(refreshUrl, refreshToken, notReadyHint, includeErrorDescription),
|
||||||
};
|
};
|
||||||
@@ -250,12 +258,11 @@ function waitForOAuthCallback(authTabId: number, opts: OAuthTabFlowOptions): Pro
|
|||||||
|
|
||||||
const onUpdated = (
|
const onUpdated = (
|
||||||
tabId: number,
|
tabId: number,
|
||||||
changeInfo: browser.Tabs.OnUpdatedChangeInfoType,
|
changeInfo: chrome.tabs.OnUpdatedInfo,
|
||||||
tab: browser.Tabs.Tab,
|
tab: chrome.tabs.Tab,
|
||||||
) => {
|
) => {
|
||||||
if (tabId !== authTabId) return;
|
if (tabId !== authTabId) return;
|
||||||
const url =
|
const url = changeInfo.url ?? (changeInfo.status === "complete" ? tab.url : undefined);
|
||||||
changeInfo.url ?? (changeInfo.status === "complete" ? tab.url : undefined);
|
|
||||||
if (url) finishFromUrl(url, tabId);
|
if (url) finishFromUrl(url, tabId);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -281,9 +288,7 @@ function tokenExpiresAt(expiresIn?: number): number {
|
|||||||
return expiresIn ? Date.now() + expiresIn * 1000 : Date.now() + 3_600_000;
|
return expiresIn ? Date.now() + expiresIn * 1000 : Date.now() + 3_600_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getValidStoredAccessToken(
|
async function getValidStoredAccessToken(provider: CalendarProviderBackend): Promise<string> {
|
||||||
provider: CalendarProviderBackend,
|
|
||||||
): Promise<string> {
|
|
||||||
const state = await provider.read();
|
const state = await provider.read();
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (state.accessToken && state.expiresAt && state.expiresAt > now + 60_000) {
|
if (state.accessToken && state.expiresAt && state.expiresAt > now + 60_000) {
|
||||||
@@ -301,7 +306,7 @@ async function getValidStoredAccessToken(
|
|||||||
|
|
||||||
export function registerTrustedAsyncHandler(
|
export function registerTrustedAsyncHandler(
|
||||||
handlers: CalendarMessageHandlerMap,
|
handlers: CalendarMessageHandlerMap,
|
||||||
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
|
isTrustedSender: (sender?: chrome.runtime.MessageSender) => boolean,
|
||||||
key: string,
|
key: string,
|
||||||
fn: (request: unknown) => Promise<unknown>,
|
fn: (request: unknown) => Promise<unknown>,
|
||||||
onError?: (err: unknown) => unknown,
|
onError?: (err: unknown) => unknown,
|
||||||
@@ -326,14 +331,15 @@ export function registerTrustedAsyncHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getGoogleCalendarStatus(): Promise<GoogleCalendarStatus> {
|
async function getGoogleCalendarStatus(): Promise<GoogleCalendarStatus> {
|
||||||
const [state, shared, syncWeeksAhead, autoSyncWeekly, syncAssessmentDueDates] =
|
const [state, shared, syncWeeksAhead, autoSyncWeekly, syncAssessmentDueDates] = await Promise.all(
|
||||||
await Promise.all([
|
[
|
||||||
readGoogleCalendarState(),
|
readGoogleCalendarState(),
|
||||||
readSharedCalendarSyncSettings(),
|
readSharedCalendarSyncSettings(),
|
||||||
getSyncWeeksAhead(),
|
getSyncWeeksAhead(),
|
||||||
getAutoSyncWeekly(),
|
getAutoSyncWeekly(),
|
||||||
getSyncAssessmentDueDates(),
|
getSyncAssessmentDueDates(),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
configured: isGoogleCalendarConfigured(),
|
configured: isGoogleCalendarConfigured(),
|
||||||
connected: !!(state.refreshToken || state.accessToken),
|
connected: !!(state.refreshToken || state.accessToken),
|
||||||
@@ -356,7 +362,9 @@ async function getOutlookCalendarStatus(): Promise<OutlookCalendarStatus> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function connectCalendar(provider: CalendarProviderBackend): Promise<GoogleCalendarSyncResult> {
|
async function connectCalendar(
|
||||||
|
provider: CalendarProviderBackend,
|
||||||
|
): Promise<GoogleCalendarSyncResult> {
|
||||||
if (!provider.isConfigured()) {
|
if (!provider.isConfigured()) {
|
||||||
return { success: false, configured: false, error: provider.notConfiguredError };
|
return { success: false, configured: false, error: provider.notConfiguredError };
|
||||||
}
|
}
|
||||||
@@ -382,8 +390,7 @@ async function connectCalendar(provider: CalendarProviderBackend): Promise<Googl
|
|||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = err instanceof Error ? err.message : provider.signInFailed;
|
const message = err instanceof Error ? err.message : provider.signInFailed;
|
||||||
const mismatch =
|
const mismatch = provider.mismatchRe.test(message) || provider.mismatchRe.test(String(err));
|
||||||
provider.mismatchRe.test(message) || provider.mismatchRe.test(String(err));
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
configured: true,
|
configured: true,
|
||||||
@@ -424,7 +431,7 @@ async function connectCalendar(provider: CalendarProviderBackend): Promise<Googl
|
|||||||
|
|
||||||
function registerProviderHandlers(
|
function registerProviderHandlers(
|
||||||
handlers: CalendarMessageHandlerMap,
|
handlers: CalendarMessageHandlerMap,
|
||||||
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
|
isTrustedSender: (sender?: chrome.runtime.MessageSender) => boolean,
|
||||||
provider: CalendarProviderBackend,
|
provider: CalendarProviderBackend,
|
||||||
getStatus: () => Promise<unknown>,
|
getStatus: () => Promise<unknown>,
|
||||||
): void {
|
): void {
|
||||||
@@ -464,49 +471,62 @@ function registerProviderHandlers(
|
|||||||
handlers,
|
handlers,
|
||||||
isTrustedSender,
|
isTrustedSender,
|
||||||
`${messagePrefix}GetAccessToken`,
|
`${messagePrefix}GetAccessToken`,
|
||||||
() => getValidStoredAccessToken(provider).then((accessToken) => ({ success: true, accessToken })),
|
() =>
|
||||||
|
getValidStoredAccessToken(provider).then((accessToken) => ({ success: true, accessToken })),
|
||||||
(err) => ({ success: false, error: errMsg(err, "Token refresh failed") }),
|
(err) => ({ success: false, error: errMsg(err, "Token refresh failed") }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerGoogleCalendarMessageHandlers(
|
export function registerGoogleCalendarMessageHandlers(
|
||||||
handlers: CalendarMessageHandlerMap,
|
handlers: CalendarMessageHandlerMap,
|
||||||
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
|
isTrustedSender: (sender?: chrome.runtime.MessageSender) => boolean,
|
||||||
): void {
|
): void {
|
||||||
registerProviderHandlers(handlers, isTrustedSender, GOOGLE_BACKEND, getGoogleCalendarStatus);
|
registerProviderHandlers(handlers, isTrustedSender, GOOGLE_BACKEND, getGoogleCalendarStatus);
|
||||||
|
|
||||||
registerTrustedAsyncHandler(handlers, isTrustedSender, "googleCalendarEnsureWeeklyAlarm", async () => {
|
registerTrustedAsyncHandler(
|
||||||
await ensureWeeklySyncAlarm();
|
handlers,
|
||||||
return { success: true };
|
isTrustedSender,
|
||||||
}, (err) => ({
|
"googleCalendarEnsureWeeklyAlarm",
|
||||||
success: false,
|
async () => {
|
||||||
error: err instanceof Error ? err.message : "Could not schedule weekly sync",
|
await ensureWeeklySyncAlarm();
|
||||||
}));
|
return { success: true };
|
||||||
|
},
|
||||||
|
(err) => ({
|
||||||
|
success: false,
|
||||||
|
error: err instanceof Error ? err.message : "Could not schedule weekly sync",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
registerTrustedAsyncHandler(handlers, isTrustedSender, "googleCalendarUpdateSyncSettings", async (request) => {
|
registerTrustedAsyncHandler(
|
||||||
const body = request as {
|
handlers,
|
||||||
syncWeeksAhead?: number;
|
isTrustedSender,
|
||||||
autoSyncWeekly?: boolean;
|
"googleCalendarUpdateSyncSettings",
|
||||||
syncAssessmentDueDates?: boolean;
|
async (request) => {
|
||||||
};
|
const body = request as {
|
||||||
const patch: Record<string, unknown> = {};
|
syncWeeksAhead?: number;
|
||||||
if (body.syncWeeksAhead != null) patch.syncWeeksAhead = clampSyncWeeks(body.syncWeeksAhead);
|
autoSyncWeekly?: boolean;
|
||||||
if (body.autoSyncWeekly != null) patch.autoSyncWeekly = !!body.autoSyncWeekly;
|
syncAssessmentDueDates?: boolean;
|
||||||
if (body.syncAssessmentDueDates != null) {
|
};
|
||||||
patch.syncAssessmentDueDates = !!body.syncAssessmentDueDates;
|
const patch: Record<string, unknown> = {};
|
||||||
}
|
if (body.syncWeeksAhead != null) patch.syncWeeksAhead = clampSyncWeeks(body.syncWeeksAhead);
|
||||||
if (Object.keys(patch).length > 0) await writeSharedCalendarSyncSettings(patch);
|
if (body.autoSyncWeekly != null) patch.autoSyncWeekly = !!body.autoSyncWeekly;
|
||||||
await ensureWeeklySyncAlarm();
|
if (body.syncAssessmentDueDates != null) {
|
||||||
return { success: true, ...(await getGoogleCalendarStatus()) };
|
patch.syncAssessmentDueDates = !!body.syncAssessmentDueDates;
|
||||||
}, (err) => ({
|
}
|
||||||
success: false,
|
if (Object.keys(patch).length > 0) await writeSharedCalendarSyncSettings(patch);
|
||||||
error: err instanceof Error ? err.message : "Could not update sync settings",
|
await ensureWeeklySyncAlarm();
|
||||||
}));
|
return { success: true, ...(await getGoogleCalendarStatus()) };
|
||||||
|
},
|
||||||
|
(err) => ({
|
||||||
|
success: false,
|
||||||
|
error: err instanceof Error ? err.message : "Could not update sync settings",
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerOutlookCalendarMessageHandlers(
|
export function registerOutlookCalendarMessageHandlers(
|
||||||
handlers: CalendarMessageHandlerMap,
|
handlers: CalendarMessageHandlerMap,
|
||||||
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
|
isTrustedSender: (sender?: chrome.runtime.MessageSender) => boolean,
|
||||||
): void {
|
): void {
|
||||||
registerProviderHandlers(handlers, isTrustedSender, OUTLOOK_BACKEND, getOutlookCalendarStatus);
|
registerProviderHandlers(handlers, isTrustedSender, OUTLOOK_BACKEND, getOutlookCalendarStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import {
|
import {
|
||||||
ensureSyncableStorageDefaults,
|
ensureSyncableStorageDefaults,
|
||||||
getSyncableStorageDefaults,
|
getSyncableStorageDefaults,
|
||||||
@@ -47,7 +47,19 @@ function isAutoCloudSyncEnabled(all: Record<string, unknown>): boolean {
|
|||||||
return all.autoCloudSettingsSync !== false;
|
return all.autoCloudSettingsSync !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function parseJsonResponse(r: Response): Promise<any> {
|
type CloudJsonBody = {
|
||||||
|
access_token?: string;
|
||||||
|
refresh_token?: string;
|
||||||
|
user?: unknown;
|
||||||
|
error?: string;
|
||||||
|
updated_at?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
function asCloudJsonBody(data: unknown): CloudJsonBody {
|
||||||
|
return data && typeof data === "object" ? (data as CloudJsonBody) : {};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function parseJsonResponse(r: Response): Promise<unknown> {
|
||||||
const text = await r.text();
|
const text = await r.text();
|
||||||
try {
|
try {
|
||||||
return text ? JSON.parse(text) : {};
|
return text ? JSON.parse(text) : {};
|
||||||
@@ -77,7 +89,7 @@ async function tryRefreshTokens(): Promise<boolean> {
|
|||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ refresh_token, client_id }),
|
body: JSON.stringify({ refresh_token, client_id }),
|
||||||
});
|
});
|
||||||
const data = await parseJsonResponse(r);
|
const data = asCloudJsonBody(await parseJsonResponse(r));
|
||||||
if (!r.ok || !data.access_token || !data.refresh_token) return false;
|
if (!r.ok || !data.access_token || !data.refresh_token) return false;
|
||||||
|
|
||||||
await browser.storage.local.set({
|
await browser.storage.local.set({
|
||||||
@@ -103,8 +115,7 @@ function isServerTimestampNewer(serverIso: string, localIso: string | undefined)
|
|||||||
async function fetchCloudSummaryOnce(
|
async function fetchCloudSummaryOnce(
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<
|
): Promise<
|
||||||
| { ok: true; data: CloudSummaryResponse }
|
{ ok: true; data: CloudSummaryResponse } | { ok: false; unauthorized: boolean; error?: string }
|
||||||
| { ok: false; unauthorized: boolean; error?: string }
|
|
||||||
> {
|
> {
|
||||||
try {
|
try {
|
||||||
const r = await fetchWithTimeout(CLOUD_SUMMARY_URL, {
|
const r = await fetchWithTimeout(CLOUD_SUMMARY_URL, {
|
||||||
@@ -130,9 +141,7 @@ async function fetchCloudSummaryOnce(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchCloudSummaryWithAuthRetry(
|
async function fetchCloudSummaryWithAuthRetry(token: string): Promise<CloudSummaryResponse | null> {
|
||||||
token: string,
|
|
||||||
): Promise<CloudSummaryResponse | null> {
|
|
||||||
let t = token;
|
let t = token;
|
||||||
for (let attempt = 0; attempt < 2; attempt++) {
|
for (let attempt = 0; attempt < 2; attempt++) {
|
||||||
const res = await fetchCloudSummaryOnce(t);
|
const res = await fetchCloudSummaryOnce(t);
|
||||||
@@ -192,16 +201,16 @@ async function putSettingsOnce(token: string): Promise<PutResult> {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
});
|
});
|
||||||
const data = await parseJsonResponse(r);
|
const data = asCloudJsonBody(await parseJsonResponse(r));
|
||||||
if (r.status === 401) return { ok: false, unauthorized: true };
|
if (r.status === 401) return { ok: false, unauthorized: true };
|
||||||
if (!r.ok) {
|
if (!r.ok) {
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
unauthorized: false,
|
unauthorized: false,
|
||||||
error: data?.error ?? `Upload failed (${r.status})`,
|
error: data.error ?? `Upload failed (${r.status})`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const updated_at = data?.updated_at as string | undefined;
|
const updated_at = data.updated_at;
|
||||||
await saveLastUploadedSnapshot(normalized);
|
await saveLastUploadedSnapshot(normalized);
|
||||||
await setKnownRemoteUpdatedAt(updated_at);
|
await setKnownRemoteUpdatedAt(updated_at);
|
||||||
return { ok: true, updated_at };
|
return { ok: true, updated_at };
|
||||||
@@ -250,7 +259,7 @@ async function getSettingsAndApplyOnce(token: string): Promise<GetResult> {
|
|||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
});
|
});
|
||||||
const data = await parseJsonResponse(r);
|
const data = asCloudJsonBody(await parseJsonResponse(r));
|
||||||
if (r.status === 401) return { ok: false, unauthorized: true };
|
if (r.status === 401) return { ok: false, unauthorized: true };
|
||||||
if (r.status === 404) {
|
if (r.status === 404) {
|
||||||
return {
|
return {
|
||||||
@@ -264,7 +273,7 @@ async function getSettingsAndApplyOnce(token: string): Promise<GetResult> {
|
|||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
unauthorized: false,
|
unauthorized: false,
|
||||||
error: data?.error ?? `Download failed (${r.status})`,
|
error: data.error ?? `Download failed (${r.status})`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const themeIdToEnsure = resolveThemeIdForPostSyncDownload(data);
|
const themeIdToEnsure = resolveThemeIdForPostSyncDownload(data);
|
||||||
@@ -355,9 +364,7 @@ async function runCloudSettingsPollInner(): Promise<void> {
|
|||||||
typeof bsplus.schemaVersion === "number" &&
|
typeof bsplus.schemaVersion === "number" &&
|
||||||
bsplus.schemaVersion > CLOUD_SETTINGS_SYNC_SCHEMA_VERSION
|
bsplus.schemaVersion > CLOUD_SETTINGS_SYNC_SCHEMA_VERSION
|
||||||
) {
|
) {
|
||||||
console.warn(
|
console.warn("[BS+ cloud sync] Server schemaVersion newer than client; skip auto-download");
|
||||||
"[BS+ cloud sync] Server schemaVersion newer than client; skip auto-download",
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,12 +451,12 @@ async function syncAutoUploadWithStorage(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onStorageChanged(
|
function onStorageChanged(
|
||||||
changes: Record<string, browser.storage.StorageChange>,
|
changes: Record<string, chrome.storage.StorageChange>,
|
||||||
area: string,
|
area: string,
|
||||||
): void {
|
): void {
|
||||||
if (area !== "local") return;
|
if (area !== "local") return;
|
||||||
|
|
||||||
if (Object.prototype.hasOwnProperty.call(changes, "autoCloudSettingsSync")) {
|
if (Object.hasOwn(changes, "autoCloudSettingsSync")) {
|
||||||
void syncAutoUploadWithStorage();
|
void syncAutoUploadWithStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,4 +491,3 @@ export function initCloudSettingsAutoSync(deps: { reloadSeqtaPages: () => void }
|
|||||||
browser.storage.onChanged.addListener(onStorageChanged);
|
browser.storage.onChanged.addListener(onStorageChanged);
|
||||||
void runCloudSettingsPoll();
|
void runCloudSettingsPoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { normalizeCustomThemeApiResponse } from "@/seqta/utils/customThemes/parseApiEnvelope";
|
import { normalizeCustomThemeApiResponse } from "@/seqta/utils/customThemes/parseApiEnvelope";
|
||||||
import { bsplusApiQueryParams } from "@/seqta/utils/bsplusClientContext";
|
import { bsplusApiQueryParams } from "@/seqta/utils/bsplusClientContext";
|
||||||
|
import { base64ToBlob } from "@/seqta/utils/base64";
|
||||||
|
|
||||||
type MessageSender = { (response?: unknown): void };
|
type MessageSender = { (response?: unknown): void };
|
||||||
|
|
||||||
@@ -16,29 +17,14 @@ type UploadPayload = {
|
|||||||
submissionNotes?: string;
|
submissionNotes?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function base64ToBlob(base64: string, mimeType: string): Blob {
|
|
||||||
const binary = atob(base64);
|
|
||||||
const bytes = new Uint8Array(binary.length);
|
|
||||||
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
||||||
return new Blob([bytes], { type: mimeType });
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildFormDataFromPayload(payload: UploadPayload): FormData {
|
function buildFormDataFromPayload(payload: UploadPayload): FormData {
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
if (payload.themeZip) {
|
if (payload.themeZip) {
|
||||||
const part = payload.themeZip;
|
const part = payload.themeZip;
|
||||||
form.append(
|
form.append(part.fieldName, base64ToBlob(part.dataBase64, part.mimeType), part.filename);
|
||||||
part.fieldName,
|
|
||||||
base64ToBlob(part.dataBase64, part.mimeType),
|
|
||||||
part.filename,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
for (const part of payload.looseFiles ?? []) {
|
for (const part of payload.looseFiles ?? []) {
|
||||||
form.append(
|
form.append(part.fieldName, base64ToBlob(part.dataBase64, part.mimeType), part.filename);
|
||||||
part.fieldName,
|
|
||||||
base64ToBlob(part.dataBase64, part.mimeType),
|
|
||||||
part.filename,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (payload.submissionNotes?.trim()) {
|
if (payload.submissionNotes?.trim()) {
|
||||||
form.append("submission_notes", payload.submissionNotes.trim());
|
form.append("submission_notes", payload.submissionNotes.trim());
|
||||||
@@ -49,10 +35,10 @@ function buildFormDataFromPayload(payload: UploadPayload): FormData {
|
|||||||
export function createCustomThemesHandlers(deps: {
|
export function createCustomThemesHandlers(deps: {
|
||||||
apiBase: () => string;
|
apiBase: () => string;
|
||||||
getAccessTokenFromStorage: () => Promise<string | null>;
|
getAccessTokenFromStorage: () => Promise<string | null>;
|
||||||
}): Record<string, (request: any, sendResponse: MessageSender) => boolean> {
|
}): Record<string, (request: Record<string, unknown>, sendResponse: MessageSender) => boolean> {
|
||||||
async function readCustomThemesResponse(r: Response): Promise<Record<string, unknown>> {
|
async function readCustomThemesResponse(r: Response): Promise<Record<string, unknown>> {
|
||||||
const text = await r.text();
|
const text = await r.text();
|
||||||
let body: unknown = {};
|
let body: unknown;
|
||||||
try {
|
try {
|
||||||
body = text ? JSON.parse(text) : {};
|
body = text ? JSON.parse(text) : {};
|
||||||
} catch {
|
} catch {
|
||||||
@@ -109,7 +95,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return await readCustomThemesResponse(r);
|
return await readCustomThemesResponse(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchCustomThemes(request: any, sendResponse: MessageSender): boolean {
|
function handleFetchCustomThemes(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
void (async () => {
|
void (async () => {
|
||||||
try {
|
try {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
@@ -118,7 +107,8 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
params.set("limit", String(request.limit ?? 20));
|
params.set("limit", String(request.limit ?? 20));
|
||||||
(await bsplusApiQueryParams()).forEach((value, key) => params.set(key, value));
|
(await bsplusApiQueryParams()).forEach((value, key) => params.set(key, value));
|
||||||
if (request.sort) params.set("sort", String(request.sort));
|
if (request.sort) params.set("sort", String(request.sort));
|
||||||
const search = request.search?.trim();
|
const searchRaw = request.search;
|
||||||
|
const search = typeof searchRaw === "string" ? searchRaw.trim() : "";
|
||||||
const path = search
|
const path = search
|
||||||
? `/api/custom-themes/search?${params}&q=${encodeURIComponent(search)}`
|
? `/api/custom-themes/search?${params}&q=${encodeURIComponent(search)}`
|
||||||
: `/api/custom-themes?${params}`;
|
: `/api/custom-themes?${params}`;
|
||||||
@@ -134,7 +124,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchMyCustomThemes(request: any, sendResponse: MessageSender): boolean {
|
function handleFetchMyCustomThemes(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
void (async () => {
|
void (async () => {
|
||||||
try {
|
try {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
@@ -143,9 +136,7 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
params.set("type", "betterseqta");
|
params.set("type", "betterseqta");
|
||||||
(await bsplusApiQueryParams()).forEach((value, key) => params.set(key, value));
|
(await bsplusApiQueryParams()).forEach((value, key) => params.set(key, value));
|
||||||
if (request.status) params.set("status", String(request.status));
|
if (request.status) params.set("status", String(request.status));
|
||||||
sendResponse(
|
sendResponse(await customThemesJsonFetch(`/api/custom-themes/mine?${params}`, {}, true));
|
||||||
await customThemesJsonFetch(`/api/custom-themes/mine?${params}`, {}, true),
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("[Background] fetchMyCustomThemes error:", err);
|
console.error("[Background] fetchMyCustomThemes error:", err);
|
||||||
sendResponse({
|
sendResponse({
|
||||||
@@ -157,7 +148,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchMyCustomThemeDetail(request: any, sendResponse: MessageSender): boolean {
|
function handleFetchMyCustomThemeDetail(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
const { themeId } = request;
|
const { themeId } = request;
|
||||||
if (!themeId || typeof themeId !== "string") {
|
if (!themeId || typeof themeId !== "string") {
|
||||||
sendResponse({ success: false, error: "Missing themeId" });
|
sendResponse({ success: false, error: "Missing themeId" });
|
||||||
@@ -183,7 +177,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSubmitCustomTheme(request: any, sendResponse: MessageSender): boolean {
|
function handleSubmitCustomTheme(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
const payload = request.payload as UploadPayload | undefined;
|
const payload = request.payload as UploadPayload | undefined;
|
||||||
if (!payload?.themeZip && (!payload?.looseFiles || payload.looseFiles.length === 0)) {
|
if (!payload?.themeZip && (!payload?.looseFiles || payload.looseFiles.length === 0)) {
|
||||||
sendResponse({ success: false, error: "Missing upload files" });
|
sendResponse({ success: false, error: "Missing upload files" });
|
||||||
@@ -204,12 +201,17 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleReplaceCustomThemeFiles(request: any, sendResponse: MessageSender): boolean {
|
function handleReplaceCustomThemeFiles(
|
||||||
const { themeId, payload } = request;
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
|
const { themeId, payload: payloadRaw } = request;
|
||||||
if (!themeId || typeof themeId !== "string") {
|
if (!themeId || typeof themeId !== "string") {
|
||||||
sendResponse({ success: false, error: "Missing themeId" });
|
sendResponse({ success: false, error: "Missing themeId" });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const payload =
|
||||||
|
payloadRaw && typeof payloadRaw === "object" ? (payloadRaw as UploadPayload) : undefined;
|
||||||
if (!payload?.themeZip && (!payload?.looseFiles || payload.looseFiles.length === 0)) {
|
if (!payload?.themeZip && (!payload?.looseFiles || payload.looseFiles.length === 0)) {
|
||||||
sendResponse({ success: false, error: "Missing upload files" });
|
sendResponse({ success: false, error: "Missing upload files" });
|
||||||
return false;
|
return false;
|
||||||
@@ -219,7 +221,7 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
sendResponse(
|
sendResponse(
|
||||||
await customThemesMultipartPost(
|
await customThemesMultipartPost(
|
||||||
`/api/custom-themes/mine/${encodeURIComponent(themeId)}/files`,
|
`/api/custom-themes/mine/${encodeURIComponent(themeId)}/files`,
|
||||||
payload,
|
payload as UploadPayload,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -233,7 +235,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdateCustomThemeMetadata(request: any, sendResponse: MessageSender): boolean {
|
function handleUpdateCustomThemeMetadata(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
const { themeId, body } = request;
|
const { themeId, body } = request;
|
||||||
if (!themeId || typeof themeId !== "string") {
|
if (!themeId || typeof themeId !== "string") {
|
||||||
sendResponse({ success: false, error: "Missing themeId" });
|
sendResponse({ success: false, error: "Missing themeId" });
|
||||||
@@ -263,7 +268,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDeleteCustomTheme(request: any, sendResponse: MessageSender): boolean {
|
function handleDeleteCustomTheme(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
const { themeId } = request;
|
const { themeId } = request;
|
||||||
if (!themeId || typeof themeId !== "string") {
|
if (!themeId || typeof themeId !== "string") {
|
||||||
sendResponse({ success: false, error: "Missing themeId" });
|
sendResponse({ success: false, error: "Missing themeId" });
|
||||||
@@ -303,7 +311,10 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchBsplusAdminThemes(request: any, sendResponse: MessageSender): boolean {
|
function handleFetchBsplusAdminThemes(
|
||||||
|
request: Record<string, unknown>,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
): boolean {
|
||||||
void (async () => {
|
void (async () => {
|
||||||
try {
|
try {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
@@ -311,7 +322,8 @@ export function createCustomThemesHandlers(deps: {
|
|||||||
params.set("limit", String(Math.min(Number(request.limit ?? 20) || 20, 100)));
|
params.set("limit", String(Math.min(Number(request.limit ?? 20) || 20, 100)));
|
||||||
if (request.status) params.set("status", String(request.status));
|
if (request.status) params.set("status", String(request.status));
|
||||||
if (request.source) params.set("source", String(request.source));
|
if (request.source) params.set("source", String(request.source));
|
||||||
const search = request.search?.trim();
|
const searchRaw = request.search;
|
||||||
|
const search = typeof searchRaw === "string" ? searchRaw.trim() : "";
|
||||||
if (search) params.set("search", search);
|
if (search) params.set("search", search);
|
||||||
sendResponse(await customThemesJsonFetch(`/api/bsplus/admin/themes?${params}`, {}, true));
|
sendResponse(await customThemesJsonFetch(`/api/bsplus/admin/themes?${params}`, {}, true));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
+50
-129
@@ -1,57 +1,16 @@
|
|||||||
import Parser from "rss-parser";
|
import type { NewsFeed, NewsPayload } from "@/seqta/utils/newsFeed";
|
||||||
|
|
||||||
|
const NEWS_API_KEY = "17c0da766ba347c89d094449504e3080";
|
||||||
const MAX_RATE_LIMIT_RETRIES = 3;
|
const MAX_RATE_LIMIT_RETRIES = 3;
|
||||||
|
const REQUEST_TIMEOUT_MS = 10_000;
|
||||||
|
const DAY_MS = 86_400_000;
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches news articles specifically for Australia from the NewsAPI.
|
|
||||||
*
|
|
||||||
* This function handles a specific case for fetching Australian news. It includes a
|
|
||||||
* mechanism to retry the fetch operation by appending "%00" to the URL if a
|
|
||||||
* rate limit error (`response.code == "rateLimited"`) is encountered. This is
|
|
||||||
* likely a workaround for cache-busting or bypassing certain rate-limiting measures.
|
|
||||||
*
|
|
||||||
* @param {string} url The NewsAPI URL to fetch Australian news from.
|
|
||||||
* @param {any} sendResponse A callback function (likely from a browser extension message listener)
|
|
||||||
* to send the fetched news data back to the caller.
|
|
||||||
* It's called with an object like `{ news: responseData }`.
|
|
||||||
*/
|
|
||||||
const fetchAustraliaNews = async (
|
|
||||||
url: string,
|
|
||||||
sendResponse: any,
|
|
||||||
rateLimitRetryCount = 0,
|
|
||||||
) => {
|
|
||||||
fetch(url)
|
|
||||||
.then((result) => result.json())
|
|
||||||
.then((response) => {
|
|
||||||
if (response.code == "rateLimited" && rateLimitRetryCount < MAX_RATE_LIMIT_RETRIES) {
|
|
||||||
fetchAustraliaNews(`${url}%00`, sendResponse, rateLimitRetryCount + 1);
|
|
||||||
} else {
|
|
||||||
sendResponse({ news: response });
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error("[BetterSEQTA+] Failed to fetch Australia news", error);
|
|
||||||
sendResponse({ news: { articles: [] } });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A record mapping lowercase country codes (e.g., "usa", "canada") to an array
|
|
||||||
* of RSS feed URLs for news sources in that country.
|
|
||||||
*
|
|
||||||
* @type {Record<string, string[]>}
|
|
||||||
*/
|
|
||||||
const rssFeedsByCountry: Record<string, string[]> = {
|
const rssFeedsByCountry: Record<string, string[]> = {
|
||||||
usa: [
|
usa: [
|
||||||
"https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
|
"https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
|
||||||
"https://www.huffpost.com/section/front-page/feed",
|
"https://feeds.npr.org/1001/rss.xml",
|
||||||
"https://www.npr.org/rss/rss.php",
|
|
||||||
],
|
|
||||||
taiwan: [
|
|
||||||
"https://news.ltn.com.tw/rss/all.xml",
|
|
||||||
"https://www.taipeitimes.com/xml/index.rss",
|
|
||||||
"https://international.thenewslens.com/rss",
|
|
||||||
],
|
],
|
||||||
|
taiwan: ["https://news.ltn.com.tw/rss/all.xml", "https://www.taipeitimes.com/xml/index.rss"],
|
||||||
hong_kong: [
|
hong_kong: [
|
||||||
"https://rthk9.rthk.hk/rthk/news/rss/e_expressnews_elocal.xml",
|
"https://rthk9.rthk.hk/rthk/news/rss/e_expressnews_elocal.xml",
|
||||||
"https://www.scmp.com/rss/91/feed",
|
"https://www.scmp.com/rss/91/feed",
|
||||||
@@ -60,106 +19,68 @@ const rssFeedsByCountry: Record<string, string[]> = {
|
|||||||
"https://critica.com.pa/rss.xml",
|
"https://critica.com.pa/rss.xml",
|
||||||
"https://www.panamaamerica.com.pa/rss.xml",
|
"https://www.panamaamerica.com.pa/rss.xml",
|
||||||
"https://noticiassin.com/feed/",
|
"https://noticiassin.com/feed/",
|
||||||
"https://elcapitalfinanciero.com/feed/",
|
|
||||||
],
|
],
|
||||||
canada: [
|
canada: [
|
||||||
"https://www.cbc.ca/cmlink/rss-topstories",
|
"https://www.cbc.ca/cmlink/rss-topstories",
|
||||||
"https://calgaryherald.com/feed",
|
"https://calgaryherald.com/feed",
|
||||||
"https://ottawacitizen.com/feed",
|
"https://ottawacitizen.com/feed",
|
||||||
"https://www.montrealgazette.com/feed",
|
|
||||||
],
|
],
|
||||||
singapore: [
|
singapore: [
|
||||||
"https://www.straitstimes.com/news/singapore/rss.xml",
|
"https://www.straitstimes.com/news/singapore/rss.xml",
|
||||||
"https://www.channelnewsasia.com/rssfeeds/8395986",
|
"https://www.channelnewsasia.com/rssfeeds/8395986",
|
||||||
],
|
],
|
||||||
uk: [
|
uk: ["https://feeds.bbci.co.uk/news/rss.xml", "https://www.theguardian.com/uk/rss"],
|
||||||
"http://feeds.bbci.co.uk/news/rss.xml",
|
|
||||||
"https://www.theguardian.com/uk/rss",
|
|
||||||
],
|
|
||||||
japan: [
|
japan: [
|
||||||
"https://www3.nhk.or.jp/nhkworld/en/news/feeds/",
|
"https://www3.nhk.or.jp/rss/news/cat0.xml",
|
||||||
"https://news.livedoor.com/topics/rss/int.xml",
|
"https://news.livedoor.com/topics/rss/int.xml",
|
||||||
],
|
],
|
||||||
netherlands: ["https://www.dutchnews.nl/feed/", "https://www.nrc.nl/rss/"],
|
netherlands: ["https://www.dutchnews.nl/feed/", "https://www.nrc.nl/rss/"],
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
async function fetchAustraliaNews(): Promise<NewsPayload> {
|
||||||
* Fetches news articles based on a specified source.
|
const from = new Date(Date.now() - 5 * DAY_MS).toISOString().slice(0, 10);
|
||||||
*
|
let url = `https://newsapi.org/v2/everything?domains=abc.net.au&from=${from}&apiKey=${NEWS_API_KEY}`;
|
||||||
* The source can be:
|
|
||||||
* 1. The string "australia": Fetches news from Australian sources via NewsAPI,
|
|
||||||
* handled by the `fetchAustraliaNews` function.
|
|
||||||
* 2. A lowercase country code (e.g., "usa", "canada"): Fetches news from a predefined
|
|
||||||
* list of RSS feeds for that country, as specified in `rssFeedsByCountry`.
|
|
||||||
* 3. A direct RSS feed URL (starting with "http"): Fetches news directly from this URL.
|
|
||||||
*
|
|
||||||
* The fetched articles are then sent back to the caller using the `sendResponse` callback.
|
|
||||||
*
|
|
||||||
* @param {string} source The news source identifier. This can be "australia", a
|
|
||||||
* lowercase country code, or a direct RSS feed URL.
|
|
||||||
* @param {any} sendResponse A callback function (typically from a browser extension
|
|
||||||
* message listener, like `chrome.runtime.onMessage`)
|
|
||||||
* used to send the fetched news data back to the caller.
|
|
||||||
* It's called with an object like `{ news: { articles: [...] } }`.
|
|
||||||
*/
|
|
||||||
export async function fetchNews(source: string | undefined, sendResponse: any) {
|
|
||||||
const normalizedSource = typeof source === "string" && source.trim()
|
|
||||||
? source.trim()
|
|
||||||
: "australia";
|
|
||||||
|
|
||||||
if (normalizedSource === "australia") {
|
try {
|
||||||
const date = new Date();
|
for (let attempt = 0; attempt <= MAX_RATE_LIMIT_RETRIES; attempt++) {
|
||||||
date.setDate(date.getDate() - 5);
|
const response = await fetch(url, { signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
|
||||||
|
const data = await response.json();
|
||||||
const from =
|
if (data.code !== "rateLimited") return { articles: data.articles ?? [] };
|
||||||
date.getFullYear() +
|
url += "%00";
|
||||||
"-" +
|
|
||||||
String(date.getMonth() + 1).padStart(2, "0") +
|
|
||||||
"-" +
|
|
||||||
String(date.getDate()).padStart(2, "0");
|
|
||||||
|
|
||||||
const url = `https://newsapi.org/v2/everything?domains=abc.net.au&from=${from}&apiKey=17c0da766ba347c89d094449504e3080`;
|
|
||||||
fetchAustraliaNews(url, sendResponse);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const parser = new Parser();
|
|
||||||
let feeds: string[];
|
|
||||||
|
|
||||||
if (rssFeedsByCountry[normalizedSource.toLowerCase()]) {
|
|
||||||
feeds = rssFeedsByCountry[normalizedSource.toLowerCase()];
|
|
||||||
} else if (normalizedSource.startsWith("http")) {
|
|
||||||
feeds = [normalizedSource];
|
|
||||||
} else {
|
|
||||||
console.warn("[BetterSEQTA+] Invalid news source, falling back to Australia", normalizedSource);
|
|
||||||
return fetchNews("australia", sendResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
const articlesPromises = feeds.map(async (feedUrl) => {
|
|
||||||
try {
|
|
||||||
const response = await fetch(feedUrl);
|
|
||||||
if (!response.ok) {
|
|
||||||
console.error(`Failed to fetch RSS feed: ${feedUrl} (${response.status})`);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const feedString = await response.text();
|
|
||||||
const feed = await parser.parseString(feedString);
|
|
||||||
|
|
||||||
return feed.items.map((item) => ({
|
|
||||||
title: item.title || "",
|
|
||||||
description: item.contentSnippet || "",
|
|
||||||
url: item.link || "",
|
|
||||||
urlToImage: null,
|
|
||||||
}));
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Failed to fetch RSS feed: ${feedUrl}`, error);
|
|
||||||
return [];
|
|
||||||
}
|
}
|
||||||
});
|
} catch (error) {
|
||||||
|
console.error("[BetterSEQTA+] Failed to fetch Australia news", error);
|
||||||
|
}
|
||||||
|
return { articles: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchFeed(url: string): Promise<NewsFeed> {
|
||||||
|
const response = await fetch(url, { signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
|
||||||
|
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||||
|
return { url: response.url || url, xml: await response.text() };
|
||||||
|
}
|
||||||
|
|
||||||
|
function feedsForSource(source: string): string[] | null {
|
||||||
|
const preset = rssFeedsByCountry[source.toLowerCase()];
|
||||||
|
if (preset) return preset;
|
||||||
|
return /^https?:\/\//i.test(source) ? [source] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchNews(source?: string): Promise<NewsPayload> {
|
||||||
|
const normalizedSource = source?.trim() || "australia";
|
||||||
|
if (normalizedSource === "australia") return fetchAustraliaNews();
|
||||||
|
|
||||||
const articlesArray = await Promise.all(articlesPromises);
|
const feedUrls = feedsForSource(normalizedSource);
|
||||||
const articles = articlesArray.flat();
|
if (!feedUrls) {
|
||||||
|
console.warn("[BetterSEQTA+] Invalid news source, falling back to Australia", normalizedSource);
|
||||||
|
return fetchAustraliaNews();
|
||||||
|
}
|
||||||
|
|
||||||
sendResponse({ news: { articles } });
|
const results = await Promise.allSettled(feedUrls.map(fetchFeed));
|
||||||
|
const feeds = results.flatMap((result, i) => {
|
||||||
|
if (result.status === "fulfilled") return [result.value];
|
||||||
|
console.error("[BetterSEQTA+] Failed to fetch RSS feed:", feedUrls[i], result.reason);
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
return { feeds };
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import { getBsplusDeviceName } from "@/seqta/utils/bsplusDeviceName";
|
import { getBsplusDeviceName } from "@/seqta/utils/bsplusDeviceName";
|
||||||
import {
|
import { bsplusApiQueryParams, bsplusExtensionPayload } from "@/seqta/utils/bsplusClientContext";
|
||||||
bsplusApiQueryParams,
|
|
||||||
bsplusExtensionPayload,
|
|
||||||
} from "@/seqta/utils/bsplusClientContext";
|
|
||||||
import { getOrCreateInstallId } from "@/seqta/utils/feedback/installId";
|
import { getOrCreateInstallId } from "@/seqta/utils/feedback/installId";
|
||||||
import { isAllowedFetchUrl } from "@/seqta/utils/allowedFetchUrl";
|
import { isAllowedFetchUrl } from "@/seqta/utils/allowedFetchUrl";
|
||||||
import {
|
import {
|
||||||
@@ -78,9 +75,7 @@ async function fetchGithubSnapshot(): Promise<RemoteConfigSnapshot | null> {
|
|||||||
BS_STATUS_MANIFEST_URL.replace(/manifest\.json$/, "") ||
|
BS_STATUS_MANIFEST_URL.replace(/manifest\.json$/, "") ||
|
||||||
"https://raw.githubusercontent.com/BetterSEQTA/BS-Status/main/config/";
|
"https://raw.githubusercontent.com/BetterSEQTA/BS-Status/main/config/";
|
||||||
const files: Record<string, unknown> = {};
|
const files: Record<string, unknown> = {};
|
||||||
for (const [key, fileName] of Object.entries(
|
for (const [key, fileName] of Object.entries(manifest.files as Record<string, string>)) {
|
||||||
manifest.files as Record<string, string>,
|
|
||||||
)) {
|
|
||||||
if (typeof fileName !== "string") continue;
|
if (typeof fileName !== "string") continue;
|
||||||
const url = fileName.startsWith("http") ? fileName : `${base}${fileName}`;
|
const url = fileName.startsWith("http") ? fileName : `${base}${fileName}`;
|
||||||
if (!isAllowedFetchUrl(url)) continue;
|
if (!isAllowedFetchUrl(url)) continue;
|
||||||
@@ -95,11 +90,7 @@ async function fetchGithubSnapshot(): Promise<RemoteConfigSnapshot | null> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function registerInstall(
|
async function registerInstall(apiBase: string, primaryOk: boolean, force = false): Promise<void> {
|
||||||
apiBase: string,
|
|
||||||
primaryOk: boolean,
|
|
||||||
force = false,
|
|
||||||
): Promise<void> {
|
|
||||||
if (!primaryOk) return;
|
if (!primaryOk) return;
|
||||||
const stored = await browser.storage.local.get(BSPLUS_INSTALL_REGISTERED_AT_KEY);
|
const stored = await browser.storage.local.get(BSPLUS_INSTALL_REGISTERED_AT_KEY);
|
||||||
const last = Number(stored[BSPLUS_INSTALL_REGISTERED_AT_KEY] ?? 0);
|
const last = Number(stored[BSPLUS_INSTALL_REGISTERED_AT_KEY] ?? 0);
|
||||||
@@ -259,10 +250,9 @@ export function initRemoteConfigBackground(apiBase: () => string): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
export function createRemoteConfigHandlers(
|
||||||
string,
|
apiBase: () => string,
|
||||||
(request: unknown, sendResponse: MessageSender) => boolean
|
): Record<string, (request: unknown, sendResponse: MessageSender) => boolean> {
|
||||||
> {
|
|
||||||
function handleRefresh(_req: unknown, sendResponse: MessageSender): boolean {
|
function handleRefresh(_req: unknown, sendResponse: MessageSender): boolean {
|
||||||
void refreshRemoteConfig(apiBase)
|
void refreshRemoteConfig(apiBase)
|
||||||
.then((res) => sendResponse(res))
|
.then((res) => sendResponse(res))
|
||||||
@@ -275,20 +265,17 @@ export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleGetSnapshot(_req: unknown, sendResponse: MessageSender): boolean {
|
function handleGetSnapshot(_req: unknown, sendResponse: MessageSender): boolean {
|
||||||
void browser.storage.local
|
void browser.storage.local.get(BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY).then((stored) => {
|
||||||
.get(BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY)
|
sendResponse({
|
||||||
.then((stored) => {
|
snapshot: normalizeRemoteConfigSnapshot(stored[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY]),
|
||||||
sendResponse({
|
|
||||||
snapshot: normalizeRemoteConfigSnapshot(
|
|
||||||
stored[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY],
|
|
||||||
),
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSetPageContext(req: { hostname?: string }, sendResponse: MessageSender): boolean {
|
function handleSetPageContext(req: unknown, sendResponse: MessageSender): boolean {
|
||||||
const hostname = typeof req.hostname === "string" ? req.hostname.trim() : "";
|
const { hostname: rawHostname } = req as { hostname?: unknown };
|
||||||
|
const hostname = typeof rawHostname === "string" ? rawHostname.trim() : "";
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
void browser.storage.local
|
void browser.storage.local
|
||||||
.set({ [BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY]: hostname })
|
.set({ [BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY]: hostname })
|
||||||
@@ -299,11 +286,9 @@ export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchRemoteThemePackage(
|
function handleFetchRemoteThemePackage(req: unknown, sendResponse: MessageSender): boolean {
|
||||||
req: { packageId?: string },
|
const { packageId: rawPackageId } = req as { packageId?: unknown };
|
||||||
sendResponse: MessageSender,
|
const packageId = typeof rawPackageId === "string" ? rawPackageId.trim() : "";
|
||||||
): boolean {
|
|
||||||
const packageId = typeof req.packageId === "string" ? req.packageId.trim() : "";
|
|
||||||
if (!packageId) {
|
if (!packageId) {
|
||||||
sendResponse({ error: "Missing packageId" });
|
sendResponse({ error: "Missing packageId" });
|
||||||
return false;
|
return false;
|
||||||
@@ -339,11 +324,9 @@ export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchRemoteThemePackageUrl(
|
function handleFetchRemoteThemePackageUrl(req: unknown, sendResponse: MessageSender): boolean {
|
||||||
req: { url?: string },
|
const { url: rawUrl } = req as { url?: unknown };
|
||||||
sendResponse: MessageSender,
|
const url = typeof rawUrl === "string" ? rawUrl.trim() : "";
|
||||||
): boolean {
|
|
||||||
const url = typeof req.url === "string" ? req.url.trim() : "";
|
|
||||||
if (!url || !isAllowedFetchUrl(url)) {
|
if (!url || !isAllowedFetchUrl(url)) {
|
||||||
sendResponse({ error: "URL not allowed" });
|
sendResponse({ error: "URL not allowed" });
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -29,7 +29,12 @@ export function handleSearchThemeStockPhotos(
|
|||||||
});
|
});
|
||||||
const res = await fetch(`https://commons.wikimedia.org/w/api.php?${params}`);
|
const res = await fetch(`https://commons.wikimedia.org/w/api.php?${params}`);
|
||||||
const json = (await res.json()) as {
|
const json = (await res.json()) as {
|
||||||
query?: { pages?: Record<string, { title?: string; imageinfo?: { thumburl?: string; url?: string }[] }> };
|
query?: {
|
||||||
|
pages?: Record<
|
||||||
|
string,
|
||||||
|
{ title?: string; imageinfo?: { thumburl?: string; url?: string }[] }
|
||||||
|
>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
const pages = json.query?.pages ?? {};
|
const pages = json.query?.pages ?? {};
|
||||||
const results: StockPhotoResult[] = Object.values(pages)
|
const results: StockPhotoResult[] = Object.values(pages)
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import semver from "semver";
|
||||||
|
import browser from "@/lib/browser";
|
||||||
|
|
||||||
|
function crossedUpgrade(previousVersion: string, boundary: string): boolean {
|
||||||
|
const prev = semver.coerce(previousVersion);
|
||||||
|
const curr = semver.coerce(browser.runtime.getManifest().version);
|
||||||
|
return prev != null && curr != null && !semver.lt(curr, boundary) && semver.lt(prev, boundary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** One-time storage patches when crossing 3.6.5 / 3.6.6 / 3.7.0 (see git history on main). */
|
||||||
|
export async function runStorageMigrations(previousVersion: string): Promise<void> {
|
||||||
|
if (crossedUpgrade(previousVersion, "3.6.5")) {
|
||||||
|
try {
|
||||||
|
const key = "plugin.global-search.settings";
|
||||||
|
const got = await browser.storage.local.get(key);
|
||||||
|
const existing = (got[key] ?? {}) as Record<string, unknown>;
|
||||||
|
await browser.storage.local.set({
|
||||||
|
[key]: {
|
||||||
|
...existing,
|
||||||
|
enabled: true,
|
||||||
|
transparencyEffects: true,
|
||||||
|
runIndexingOnLoad: true,
|
||||||
|
passiveIndexing: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[BetterSEQTA+] Global Search 3.6.5 settings migration failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crossedUpgrade(previousVersion, "3.6.6")) {
|
||||||
|
try {
|
||||||
|
await browser.storage.local.set({
|
||||||
|
themeOfTheMonthDisabled: false,
|
||||||
|
themeOfTheMonthLastSeenId: undefined,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[BetterSEQTA+] Theme of the Month 3.6.6 reset migration failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crossedUpgrade(previousVersion, "3.7.0")) {
|
||||||
|
try {
|
||||||
|
await browser.storage.local.set({
|
||||||
|
themeOfTheMonthLastSeenId: undefined,
|
||||||
|
themeOfTheMonthDismissedMonth: undefined,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
|
|
||||||
import { hasAnySyncOptInScope } from "@/plugins/built-in/timetableClassmates/syncScopes";
|
import { hasAnySyncOptInScope } from "@/plugins/built-in/timetableClassmates/syncScopes";
|
||||||
import { isSeqtaTab } from "@/seqta/utils/seqtaTabMatch";
|
import { isSeqtaTab } from "@/seqta/utils/seqtaTabMatch";
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ export const OUTLOOK_CALENDAR_REFRESH_URL = `${ACCOUNTS_BASE}/api/bsplus/microso
|
|||||||
|
|
||||||
export const OUTLOOK_CALENDAR_SCOPE = "offline_access Calendars.ReadWrite User.Read";
|
export const OUTLOOK_CALENDAR_SCOPE = "offline_access Calendars.ReadWrite User.Read";
|
||||||
|
|
||||||
export const OUTLOOK_AUTH_URL =
|
export const OUTLOOK_AUTH_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
|
||||||
"https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
|
|
||||||
|
|
||||||
export const OUTLOOK_GRAPH_API = "https://graph.microsoft.com/v1.0";
|
export const OUTLOOK_GRAPH_API = "https://graph.microsoft.com/v1.0";
|
||||||
|
|
||||||
|
|||||||
@@ -110,9 +110,7 @@ html {
|
|||||||
transform-origin: top;
|
transform-origin: top;
|
||||||
transition: transform 0.2s;
|
transition: transform 0.2s;
|
||||||
}
|
}
|
||||||
body:has(.outside-container:not(.hide))
|
body:has(.outside-container:not(.hide)) #AddedSettings.tooltip:hover > .tooltiptext {
|
||||||
#AddedSettings.tooltip:hover
|
|
||||||
> .tooltiptext {
|
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
}
|
}
|
||||||
.assessmenttooltip svg {
|
.assessmenttooltip svg {
|
||||||
|
|||||||
+164
-232
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
@use "sass:meta";
|
@use "sass:meta";
|
||||||
@import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600,700");
|
@import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600,700");
|
||||||
|
|
||||||
@@ -81,13 +80,20 @@ select {
|
|||||||
|
|
||||||
select:hover {
|
select:hover {
|
||||||
background: var(--theme-secondary, var(--background-secondary)) !important;
|
background: var(--theme-secondary, var(--background-secondary)) !important;
|
||||||
border-color: var(--theme-offset-bg, var(--theme-secondary, var(--background-secondary))) !important;
|
border-color: var(
|
||||||
|
--theme-offset-bg,
|
||||||
|
var(--theme-secondary, var(--background-secondary))
|
||||||
|
) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
select:focus {
|
select:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
background: var(--theme-secondary, var(--background-secondary)) !important;
|
background: var(--theme-secondary, var(--background-secondary)) !important;
|
||||||
border-color: color-mix(in srgb, var(--text-primary) 18%, var(--theme-offset-bg, var(--theme-secondary, var(--background-secondary))) 82%) !important;
|
border-color: color-mix(
|
||||||
|
in srgb,
|
||||||
|
var(--text-primary) 18%,
|
||||||
|
var(--theme-offset-bg, var(--theme-secondary, var(--background-secondary))) 82%
|
||||||
|
) !important;
|
||||||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--text-primary) 12%, transparent) !important;
|
box-shadow: 0 0 0 1px color-mix(in srgb, var(--text-primary) 12%, transparent) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,11 +241,11 @@ html:not(.dark) .legacy-root {
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
#AddedSettings {
|
#AddedSettings {
|
||||||
top: 17.5px !important;
|
|
||||||
z-index: 21 !important;
|
z-index: 21 !important;
|
||||||
}
|
}
|
||||||
.addedButton {
|
.addedButton {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
|
top: 17.5px !important;
|
||||||
right: 105px;
|
right: 105px;
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
align-items: center !important;
|
align-items: center !important;
|
||||||
@@ -251,6 +257,8 @@ html:not(.dark) .legacy-root {
|
|||||||
color: var(--theme-primary) !important;
|
color: var(--theme-primary) !important;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
width: 35px !important;
|
width: 35px !important;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Engage toolbar: keep settings/theme buttons above React chrome */
|
/* Engage toolbar: keep settings/theme buttons above React chrome */
|
||||||
@@ -504,7 +512,9 @@ ul.magicDelete > li.deleting {
|
|||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu li.hasChildren:is(.active, .bsplus-active) > .sub:has(.hasChildren:is(.active, .bsplus-active)) {
|
#menu
|
||||||
|
li.hasChildren:is(.active, .bsplus-active)
|
||||||
|
> .sub:has(.hasChildren:is(.active, .bsplus-active)) {
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,8 +751,7 @@ body.icon-only-sidebar {
|
|||||||
width: 92.5% !important;
|
width: 92.5% !important;
|
||||||
margin-left: 7.5% !important;
|
margin-left: 7.5% !important;
|
||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
border-radius: var(--bsplus-sidebar-radius, 12px) 0 0
|
border-radius: var(--bsplus-sidebar-radius, 12px) 0 0 var(--bsplus-sidebar-radius, 12px) !important;
|
||||||
var(--bsplus-sidebar-radius, 12px) !important;
|
|
||||||
background: var(--background-primary) !important;
|
background: var(--background-primary) !important;
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
color: var(--text-primary) !important;
|
color: var(--text-primary) !important;
|
||||||
@@ -776,9 +785,8 @@ body.icon-only-sidebar {
|
|||||||
var(--background-primary) var(--bsplus-sidebar-radius, 12px)
|
var(--background-primary) var(--bsplus-sidebar-radius, 12px)
|
||||||
)
|
)
|
||||||
bottom / 100% var(--bsplus-sidebar-radius, 12px) no-repeat,
|
bottom / 100% var(--bsplus-sidebar-radius, 12px) no-repeat,
|
||||||
linear-gradient(var(--background-primary), var(--background-primary))
|
linear-gradient(var(--background-primary), var(--background-primary)) center / 100%
|
||||||
center / 100% calc(100% - 2 * var(--bsplus-sidebar-radius, 12px))
|
calc(100% - 2 * var(--bsplus-sidebar-radius, 12px)) no-repeat;
|
||||||
no-repeat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu > ul > .hasChildren > .sub {
|
#menu > ul > .hasChildren > .sub {
|
||||||
@@ -786,10 +794,7 @@ body.icon-only-sidebar {
|
|||||||
right: auto !important;
|
right: auto !important;
|
||||||
top: 71px !important;
|
top: 71px !important;
|
||||||
margin-top: 0 !important;
|
margin-top: 0 !important;
|
||||||
width: min(
|
width: min(var(--bsplus-sidebar-width, 270px), calc(100vw - 70px)) !important;
|
||||||
var(--bsplus-sidebar-width, 270px),
|
|
||||||
calc(100vw - 70px)
|
|
||||||
) !important;
|
|
||||||
background: var(--background-primary) !important;
|
background: var(--background-primary) !important;
|
||||||
color: var(--text-primary) !important;
|
color: var(--text-primary) !important;
|
||||||
border-right: 1px solid var(--border-color, rgba(128, 128, 128, 0.3)) !important;
|
border-right: 1px solid var(--border-color, rgba(128, 128, 128, 0.3)) !important;
|
||||||
@@ -813,22 +818,13 @@ body.icon-only-sidebar {
|
|||||||
fill: currentColor !important;
|
fill: currentColor !important;
|
||||||
}
|
}
|
||||||
:is(li, section):hover {
|
:is(li, section):hover {
|
||||||
background: color-mix(
|
background: color-mix(in srgb, var(--text-primary) 8%, transparent) !important;
|
||||||
in srgb,
|
|
||||||
var(--text-primary) 8%,
|
|
||||||
transparent
|
|
||||||
) !important;
|
|
||||||
}
|
}
|
||||||
:is(li, section):is(.active, .bsplus-active):not(.hasChildren) {
|
:is(li, section):is(.active, .bsplus-active):not(.hasChildren) {
|
||||||
background: color-mix(
|
background: color-mix(in srgb, var(--text-primary) 14%, transparent) !important;
|
||||||
in srgb,
|
|
||||||
var(--text-primary) 14%,
|
|
||||||
transparent
|
|
||||||
) !important;
|
|
||||||
&::after {
|
&::after {
|
||||||
background: var(--text-primary) !important;
|
background: var(--text-primary) !important;
|
||||||
box-shadow: 0 0 10px
|
box-shadow: 0 0 10px color-mix(in srgb, var(--text-primary) 45%, transparent) !important;
|
||||||
color-mix(in srgb, var(--text-primary) 45%, transparent) !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.sub {
|
.sub {
|
||||||
@@ -901,14 +897,15 @@ body.icon-only-sidebar {
|
|||||||
box-sizing: border-box !important;
|
box-sizing: border-box !important;
|
||||||
margin-inline: 0 !important;
|
margin-inline: 0 !important;
|
||||||
}
|
}
|
||||||
body:not(.icon-only-sidebar) #menu#menu.bsplus-sidebar-style-strip > ul > :is(li.item, section.item) {
|
body:not(.icon-only-sidebar)
|
||||||
|
#menu#menu.bsplus-sidebar-style-strip
|
||||||
|
> ul
|
||||||
|
> :is(li.item, section.item) {
|
||||||
width: calc(100% + 1px) !important;
|
width: calc(100% + 1px) !important;
|
||||||
box-sizing: border-box !important;
|
box-sizing: border-box !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.icon-only-sidebar:has(
|
body.icon-only-sidebar:has(#menu > ul > .hasChildren:is(.active, .bsplus-active)) {
|
||||||
#menu > ul > .hasChildren:is(.active, .bsplus-active)
|
|
||||||
) {
|
|
||||||
--bsplus-icon-rail-space: calc(
|
--bsplus-icon-rail-space: calc(
|
||||||
70px + min(var(--bsplus-sidebar-width, 270px), calc(100vw - 70px))
|
70px + min(var(--bsplus-sidebar-width, 270px), calc(100vw - 70px))
|
||||||
);
|
);
|
||||||
@@ -1351,11 +1348,7 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li {
|
|||||||
border-bottom: none !important;
|
border-bottom: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.transparencyEffects
|
html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + li {
|
||||||
[class*="BasicPanel__BasicPanel___q92_U"]
|
|
||||||
> ol
|
|
||||||
> li
|
|
||||||
+ li {
|
|
||||||
border-top: 1px solid var(--theme-offset-bg);
|
border-top: 1px solid var(--theme-offset-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1381,7 +1374,9 @@ html.transparencyEffects
|
|||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s ease;
|
transition:
|
||||||
|
left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
transform 0.4s ease;
|
||||||
left: var(--bsplus-sidebar-width, 270px);
|
left: var(--bsplus-sidebar-width, 270px);
|
||||||
background: unset;
|
background: unset;
|
||||||
}
|
}
|
||||||
@@ -1430,7 +1425,9 @@ html.transparencyEffects
|
|||||||
-webkit-transform: translatex(-70px);
|
-webkit-transform: translatex(-70px);
|
||||||
transform: translatex(-70px);
|
transform: translatex(-70px);
|
||||||
}
|
}
|
||||||
#content { left: 0 !important; }
|
#content {
|
||||||
|
left: 0 !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
body.icon-only-sidebar.menuShown #content {
|
body.icon-only-sidebar.menuShown #content {
|
||||||
-webkit-transform: translatex(var(--bsplus-icon-rail-space)) !important;
|
-webkit-transform: translatex(var(--bsplus-icon-rail-space)) !important;
|
||||||
@@ -2006,13 +2003,10 @@ html.transparencyEffects
|
|||||||
margin: 20px auto 0px;
|
margin: 20px auto 0px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.dark
|
.dark [class*="notifications__detailsBody___"] > [class*="notifications__subtitle___"] {
|
||||||
[class*="notifications__detailsBody___"]
|
|
||||||
> [class*="notifications__subtitle___"] {
|
|
||||||
color: #c1bcbc;
|
color: #c1bcbc;
|
||||||
}
|
}
|
||||||
[class*="notifications__detailsBody___"]
|
[class*="notifications__detailsBody___"] > [class*="notifications__subtitle___"] {
|
||||||
> [class*="notifications__subtitle___"] {
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
[class*="notifications__notifications___"] > button {
|
[class*="notifications__notifications___"] > button {
|
||||||
@@ -2026,9 +2020,7 @@ html.transparencyEffects
|
|||||||
height: 25px;
|
height: 25px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
}
|
}
|
||||||
[class*="notifications__notifications___"]
|
[class*="notifications__notifications___"] > button > [class*="notifications__bubble___"] {
|
||||||
> button
|
|
||||||
> [class*="notifications__bubble___"] {
|
|
||||||
background: var(--better-alert-highlight);
|
background: var(--better-alert-highlight);
|
||||||
width: 25px;
|
width: 25px;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
@@ -2256,20 +2248,32 @@ iframe.userHTML {
|
|||||||
background-color: var(--auto-background);
|
background-color: var(--auto-background);
|
||||||
}
|
}
|
||||||
[class*="OverallResult__OverallResult___"] {
|
[class*="OverallResult__OverallResult___"] {
|
||||||
--fill-colour: var(--assessment-accent-colour, var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts)))));
|
--fill-colour: var(
|
||||||
|
--assessment-accent-colour,
|
||||||
|
var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts))))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
[class*="OverallResult__OverallResult___"] [class*="Thermoscore__Thermoscore___"],
|
[class*="OverallResult__OverallResult___"] [class*="Thermoscore__Thermoscore___"],
|
||||||
[class*="OverallResult__OverallResult___"] [class*="Thermoscore__fill___"],
|
[class*="OverallResult__OverallResult___"] [class*="Thermoscore__fill___"],
|
||||||
[class*="OverallResult__OverallResult___"] > div > div {
|
[class*="OverallResult__OverallResult___"] > div > div {
|
||||||
--fill-colour: var(--assessment-accent-colour, var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts)))));
|
--fill-colour: var(
|
||||||
|
--assessment-accent-colour,
|
||||||
|
var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts))))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
[class*="AssessableCriterion__header___"] {
|
[class*="AssessableCriterion__header___"] {
|
||||||
--fill-colour: var(--assessment-accent-colour, var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts)))));
|
--fill-colour: var(
|
||||||
|
--assessment-accent-colour,
|
||||||
|
var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts))))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
[class*="AssessableCriterion__header___"] [class*="Thermoscore__Thermoscore___"],
|
[class*="AssessableCriterion__header___"] [class*="Thermoscore__Thermoscore___"],
|
||||||
[class*="AssessableCriterion__header___"] [class*="Thermoscore__fill___"],
|
[class*="AssessableCriterion__header___"] [class*="Thermoscore__fill___"],
|
||||||
[class*="AssessableCriterion__header___"] > div > div > div {
|
[class*="AssessableCriterion__header___"] > div > div > div {
|
||||||
--fill-colour: var(--assessment-accent-colour, var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts)))));
|
--fill-colour: var(
|
||||||
|
--assessment-accent-colour,
|
||||||
|
var(--item-colour, var(--container-accent, rgb(var(--theme-sel-bg-parts))))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
.dark [class*="Thermoscore__Thermoscore___"] {
|
.dark [class*="Thermoscore__Thermoscore___"] {
|
||||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||||
@@ -2466,13 +2470,10 @@ div:has(> [class*="AssessmentDetails__AssessmentDetails___"]) {
|
|||||||
> [class*="SelectedAssessment__clearBtn___"] {
|
> [class*="SelectedAssessment__clearBtn___"] {
|
||||||
background: var(--better-main);
|
background: var(--better-main);
|
||||||
}
|
}
|
||||||
[class*="SelectedAssessment__SelectedAssessment___"]
|
[class*="SelectedAssessment__SelectedAssessment___"] > [class*="SelectedAssessment__meta___"] {
|
||||||
> [class*="SelectedAssessment__meta___"] {
|
|
||||||
border-bottom: 1px solid var(--better-main);
|
border-bottom: 1px solid var(--better-main);
|
||||||
}
|
}
|
||||||
[class*="TabSet__TabSet___"]
|
[class*="TabSet__TabSet___"] > ol[class*="TabSet__tabs___"] > li[class*="TabSet__selected___"] {
|
||||||
> ol[class*="TabSet__tabs___"]
|
|
||||||
> li[class*="TabSet__selected___"] {
|
|
||||||
border-bottom-color: var(--better-main);
|
border-bottom-color: var(--better-main);
|
||||||
}
|
}
|
||||||
[class*="TabSet__TabSet___"] > ol[class*="TabSet__tabs___"] {
|
[class*="TabSet__TabSet___"] > ol[class*="TabSet__tabs___"] {
|
||||||
@@ -2595,15 +2596,7 @@ div.entry.class[style*="left: 46.5%"] {
|
|||||||
div.entry.class[style*="width: 46.5%"] {
|
div.entry.class[style*="width: 46.5%"] {
|
||||||
width: 50% !important;
|
width: 50% !important;
|
||||||
}
|
}
|
||||||
.timetablepage
|
.timetablepage .dailycal > .content > .wrapper > .days > tbody > tr > td > .entriesWrapper {
|
||||||
.dailycal
|
|
||||||
> .content
|
|
||||||
> .wrapper
|
|
||||||
> .days
|
|
||||||
> tbody
|
|
||||||
> tr
|
|
||||||
> td
|
|
||||||
> .entriesWrapper {
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
@@ -2994,15 +2987,7 @@ body {
|
|||||||
.forumView .assessment {
|
.forumView .assessment {
|
||||||
background: var(--better-main);
|
background: var(--better-main);
|
||||||
}
|
}
|
||||||
.dailycal
|
.dailycal > .content > .wrapper > .days > tbody > tr > td > .entriesWrapper > .entry {
|
||||||
> .content
|
|
||||||
> .wrapper
|
|
||||||
> .days
|
|
||||||
> tbody
|
|
||||||
> tr
|
|
||||||
> td
|
|
||||||
> .entriesWrapper
|
|
||||||
> .entry {
|
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
transition: opacity 0.2s ease-in-out;
|
transition: opacity 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
@@ -3078,9 +3063,7 @@ body {
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
[class*="MessageList__MessageList___"]
|
[class*="MessageList__MessageList___"] > ol > li[class*="MessageList__unread___"]::before,
|
||||||
> ol
|
|
||||||
> li[class*="MessageList__unread___"]::before,
|
|
||||||
[class*="MessageList__MessageList___"] > ol > li::before {
|
[class*="MessageList__MessageList___"] > ol > li::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -3092,9 +3075,7 @@ body {
|
|||||||
transition: width 0.1s;
|
transition: width 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
[class*="MessageList__MessageList___"]
|
[class*="MessageList__MessageList___"] > ol > li[class*="MessageList__unread___"]::before {
|
||||||
> ol
|
|
||||||
> li[class*="MessageList__unread___"]::before {
|
|
||||||
width: 3px;
|
width: 3px;
|
||||||
}
|
}
|
||||||
.connectedNotificationsWrapper > div > button {
|
.connectedNotificationsWrapper > div > button {
|
||||||
@@ -3150,16 +3131,11 @@ body:not(.clr-open) .clr-picker,
|
|||||||
visibility: hidden !important;
|
visibility: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark
|
.dark [class*="MessageList__MessageList___"] > ol > li[class*="MessageList__selected___"] {
|
||||||
[class*="MessageList__MessageList___"]
|
|
||||||
> ol
|
|
||||||
> li[class*="MessageList__selected___"] {
|
|
||||||
background: var(--background-secondary);
|
background: var(--background-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
[class*="MessageList__MessageList___"]
|
[class*="MessageList__MessageList___"] > ol > li[class*="MessageList__selected___"] {
|
||||||
> ol
|
|
||||||
> li[class*="MessageList__selected___"] {
|
|
||||||
background: var(--background-secondary, rgb(228 225 225));
|
background: var(--background-secondary, rgb(228 225 225));
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
@@ -3746,16 +3722,15 @@ div.day-empty {
|
|||||||
transition: 200ms;
|
transition: 200ms;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
display: flex;
|
display: flex;
|
||||||
min-height: 32px;
|
height: 70px;
|
||||||
height: 64px;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
z-index: 21;
|
z-index: 21;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 250px;
|
top: 0;
|
||||||
|
right: 190px;
|
||||||
}
|
}
|
||||||
.engage-titlebar {
|
.engage-titlebar {
|
||||||
right: 250px;
|
right: 190px;
|
||||||
top: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Engage parent home: same timetable DOM as Learn; title+student replace the lone h2 — give the cluster Learn’s h2 margin/inset. */
|
/* Engage parent home: same timetable DOM as Learn; title+student replace the lone h2 — give the cluster Learn’s h2 margin/inset. */
|
||||||
@@ -3792,12 +3767,16 @@ div.day-empty {
|
|||||||
max-width: 16rem;
|
max-width: 16rem;
|
||||||
min-width: 10rem;
|
min-width: 10rem;
|
||||||
padding: 0.35rem 0.6rem;
|
padding: 0.35rem 0.6rem;
|
||||||
transition: border-color 0.2s ease-in-out, color 0.2s ease-in-out;
|
transition:
|
||||||
|
border-color 0.2s ease-in-out,
|
||||||
|
color 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.engage-child-select:focus {
|
.engage-child-select:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
box-shadow: 0 0 0 2px var(--background-primary), 0 0 0 4px rgba(59, 130, 246, 0.45);
|
box-shadow:
|
||||||
|
0 0 0 2px var(--background-primary),
|
||||||
|
0 0 0 4px rgba(59, 130, 246, 0.45);
|
||||||
}
|
}
|
||||||
|
|
||||||
#engage-day-container:has(> .day-empty) {
|
#engage-day-container:has(> .day-empty) {
|
||||||
@@ -3852,13 +3831,12 @@ div.day-empty {
|
|||||||
.userInfo {
|
.userInfo {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 4px 0;
|
|
||||||
}
|
}
|
||||||
.userInfoText {
|
.userInfoText {
|
||||||
text-align: end;
|
text-align: end;
|
||||||
padding: 2px 0;
|
|
||||||
}
|
}
|
||||||
.userInfoName {
|
.userInfoName {
|
||||||
|
grid-area: name;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -3869,137 +3847,81 @@ div.day-empty {
|
|||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
.userInfoNameRow {
|
.userInfoNameRow {
|
||||||
display: inline-flex;
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"house name"
|
||||||
|
". code";
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-items: end;
|
||||||
gap: 6px;
|
column-gap: 10px;
|
||||||
|
row-gap: 2px;
|
||||||
}
|
}
|
||||||
.userInfoDetails {
|
.userInfoDetails {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
.userInfoDetails > .userInfoCode {
|
||||||
|
grid-area: code;
|
||||||
|
}
|
||||||
|
.userInfoHouseWrap,
|
||||||
|
.userInfoNameRow > .bsplus-founder-badge-slot {
|
||||||
|
grid-area: house;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
align-items: flex-end;
|
gap: 6px;
|
||||||
gap: 2px;
|
|
||||||
}
|
}
|
||||||
.userInfoHouseWrap {
|
.bsplus-founder-badge-slot {
|
||||||
display: inline-block;
|
|
||||||
margin: 0 8px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.userInfoHouseWrap .userInfohouse {
|
|
||||||
display: block;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 6px !important;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.userInfoHouseWrap .bsplus-founder-badge-slot {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
margin-top: 4px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge-carousel {
|
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 100%;
|
justify-items: end;
|
||||||
max-width: 100%;
|
order: -1;
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
.bsplus-founder-badge-carousel > .bsplus-founder-badge {
|
.bsplus-founder-badge-slot[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.titlebar .bsplus-titlebar-badge {
|
||||||
grid-area: 1 / 1;
|
grid-area: 1 / 1;
|
||||||
width: 100%;
|
height: auto;
|
||||||
min-width: 0;
|
min-height: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(ellipse 72% 68% at 18% 42%, var(--badge-blob-a), transparent 72%),
|
||||||
|
radial-gradient(ellipse 68% 62% at 82% 58%, var(--badge-blob-b), transparent 70%),
|
||||||
|
radial-gradient(ellipse 64% 56% at 50% 88%, var(--badge-blob-c), transparent 68%),
|
||||||
|
var(--badge-base);
|
||||||
|
color: #fff;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.3;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
opacity 0.45s ease,
|
||||||
|
visibility 0s;
|
||||||
|
}
|
||||||
|
.titlebar .bsplus-titlebar-badge[aria-hidden="true"] {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
transform: translateY(5px);
|
|
||||||
transition:
|
transition:
|
||||||
opacity 0.45s ease,
|
opacity 0.45s ease,
|
||||||
transform 0.45s ease,
|
|
||||||
visibility 0s linear 0.45s;
|
visibility 0s linear 0.45s;
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
.bsplus-founder-badge-carousel > .bsplus-founder-badge--active {
|
.titlebar .bsplus-titlebar-badge:focus-visible {
|
||||||
opacity: 1;
|
outline: 2px solid var(--theme-primary);
|
||||||
visibility: visible;
|
outline-offset: 2px;
|
||||||
transform: translateY(0);
|
|
||||||
transition:
|
|
||||||
opacity 0.45s ease,
|
|
||||||
transform 0.45s ease,
|
|
||||||
visibility 0s;
|
|
||||||
pointer-events: auto;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
.bsplus-founder-badge-carousel--static > .bsplus-founder-badge {
|
.bsplus-founder-badge-slot--static .bsplus-titlebar-badge {
|
||||||
transition: none;
|
transition: none !important;
|
||||||
transform: none;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge-carousel--static > .bsplus-founder-badge--active {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
}
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.bsplus-founder-badge-carousel > .bsplus-founder-badge {
|
.titlebar .bsplus-titlebar-badge {
|
||||||
transition: none;
|
transition: none;
|
||||||
transform: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.userInfoHouseWrap .bsplus-founder-badge-slot[hidden],
|
|
||||||
.bsplus-founder-badge-slot[hidden] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
border-radius: 5px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__glass {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
box-shadow:
|
|
||||||
inset 0 0 0 1px rgba(255, 255, 255, 0.22),
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__content {
|
|
||||||
display: flex;
|
|
||||||
flex: 1 1 auto;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0 6px;
|
|
||||||
gap: 0;
|
|
||||||
min-height: 0;
|
|
||||||
min-width: 0;
|
|
||||||
height: auto;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: normal;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
backdrop-filter: none;
|
|
||||||
-webkit-backdrop-filter: none;
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar .bsplus-founder-badge__label {
|
|
||||||
display: block;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar:hover {
|
|
||||||
transform: none;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar:focus-visible {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.bsplus-founder-badge--titlebar:focus-visible .bsplus-founder-badge__glass {
|
|
||||||
box-shadow:
|
|
||||||
inset 0 0 0 1px rgba(255, 255, 255, 0.22),
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
|
||||||
0 0 0 2px var(--theme-primary, #f97316),
|
|
||||||
0 0 0 4px rgba(249, 115, 22, 0.35);
|
|
||||||
}
|
|
||||||
.legacy-root .bsplus-founder-badge,
|
.legacy-root .bsplus-founder-badge,
|
||||||
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn {
|
.legacy-root .bsplus-founder-badge-actions .bsplus-cal-btn {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
@@ -4254,12 +4176,12 @@ div.day-empty {
|
|||||||
.userInfosvgdiv {
|
.userInfosvgdiv {
|
||||||
width: 50px !important;
|
width: 50px !important;
|
||||||
height: 50px !important;
|
height: 50px !important;
|
||||||
|
flex-shrink: 0;
|
||||||
|
order: 1;
|
||||||
color: var(--better-main);
|
color: var(--better-main);
|
||||||
margin: 10px;
|
margin-left: 10px;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
position: absolute !important;
|
position: relative !important;
|
||||||
right: -70px !important;
|
|
||||||
top: -2px !important;
|
|
||||||
}
|
}
|
||||||
.userInfosvgdiv::before {
|
.userInfosvgdiv::before {
|
||||||
content: "";
|
content: "";
|
||||||
@@ -4270,27 +4192,26 @@ div.day-empty {
|
|||||||
border-radius: 16000px;
|
border-radius: 16000px;
|
||||||
top: 15%;
|
top: 15%;
|
||||||
left: 15%;
|
left: 15%;
|
||||||
|
transition: background 200ms;
|
||||||
}
|
}
|
||||||
.userInfosvg::after {
|
.userInfosvg path {
|
||||||
width: 35px;
|
transition: fill 200ms;
|
||||||
height: 35px;
|
|
||||||
background: antiquewhite;
|
|
||||||
position: absolute;
|
|
||||||
}
|
}
|
||||||
.userInfohouse {
|
.userInfohouse {
|
||||||
padding: 0px 10px;
|
padding: 2px 8px;
|
||||||
font-size: 15px;
|
font-size: 14px;
|
||||||
margin: 0 8px !important;
|
font-weight: 600;
|
||||||
border-radius: 5px;
|
line-height: 1.3;
|
||||||
|
margin: 0 !important;
|
||||||
|
border-radius: 6px;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
background: var(--auto-background);
|
background: var(--auto-background);
|
||||||
outline: solid 1px black;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.DarkLightButton {
|
.DarkLightButton {
|
||||||
right: 145px !important;
|
right: 145px !important;
|
||||||
z-index: 21 !important;
|
z-index: 21 !important;
|
||||||
top: 17.5px;
|
|
||||||
}
|
}
|
||||||
.whatsnewContainer {
|
.whatsnewContainer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -4378,14 +4299,16 @@ div.day-empty {
|
|||||||
/* Lightweight popup motion (performance mode) — fade + scale, no blur springs. */
|
/* Lightweight popup motion (performance mode) — fade + scale, no blur springs. */
|
||||||
.whatsnewBackground.bsplus-popup-css-animate {
|
.whatsnewBackground.bsplus-popup-css-animate {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
transition: opacity var(--bs-motion-duration, 0.2s)
|
||||||
|
var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
||||||
|
|
||||||
.whatsnewContainer {
|
.whatsnewContainer {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: scale(0.94);
|
transform: scale(0.94);
|
||||||
transition:
|
transition:
|
||||||
opacity var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)),
|
opacity var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)),
|
||||||
transform var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
transform var(--bs-motion-duration, 0.2s)
|
||||||
|
var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
&.bsplus-popup-css-animate--open {
|
&.bsplus-popup-css-animate--open {
|
||||||
@@ -4834,7 +4757,9 @@ div.day-empty {
|
|||||||
inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 14%, transparent);
|
inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 14%, transparent);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
-webkit-backdrop-filter: blur(8px);
|
-webkit-backdrop-filter: blur(8px);
|
||||||
transition: background 0.15s ease, transform 0.15s ease;
|
transition:
|
||||||
|
background 0.15s ease,
|
||||||
|
transform 0.15s ease;
|
||||||
}
|
}
|
||||||
.themeOfTheMonthCardPopoutIcon {
|
.themeOfTheMonthCardPopoutIcon {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@@ -5018,7 +4943,9 @@ div.day-empty {
|
|||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: color-mix(in srgb, var(--text-primary) 28%, transparent);
|
background: color-mix(in srgb, var(--text-primary) 28%, transparent);
|
||||||
transition: background 0.15s ease, transform 0.15s ease;
|
transition:
|
||||||
|
background 0.15s ease,
|
||||||
|
transform 0.15s ease;
|
||||||
}
|
}
|
||||||
.themeOfTheMonthCardGalleryDotActive {
|
.themeOfTheMonthCardGalleryDotActive {
|
||||||
background: var(--better-pri, #6366f1);
|
background: var(--better-pri, #6366f1);
|
||||||
@@ -5096,7 +5023,10 @@ div.day-empty {
|
|||||||
padding: 0.5rem 0.85rem;
|
padding: 0.5rem 0.85rem;
|
||||||
font-size: 0.84rem;
|
font-size: 0.84rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
|
transition:
|
||||||
|
transform 0.15s ease,
|
||||||
|
filter 0.15s ease,
|
||||||
|
background 0.15s ease;
|
||||||
}
|
}
|
||||||
.themeOfTheMonthCardConfirmCancel {
|
.themeOfTheMonthCardConfirmCancel {
|
||||||
background: color-mix(in srgb, var(--text-primary) 10%, transparent);
|
background: color-mix(in srgb, var(--text-primary) 10%, transparent);
|
||||||
@@ -5208,7 +5138,9 @@ div.day-empty {
|
|||||||
padding: 0.58rem 0.9rem;
|
padding: 0.58rem 0.9rem;
|
||||||
font-size: 0.86rem;
|
font-size: 0.86rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
transition: background 0.15s ease, color 0.15s ease;
|
transition:
|
||||||
|
background 0.15s ease,
|
||||||
|
color 0.15s ease;
|
||||||
}
|
}
|
||||||
.themeOfTheMonthCardPrimary {
|
.themeOfTheMonthCardPrimary {
|
||||||
background: var(--better-pri, #6366f1);
|
background: var(--better-pri, #6366f1);
|
||||||
@@ -5280,7 +5212,8 @@ div.day-empty {
|
|||||||
animation: bsplusThemeHighlightPulse 1.4s ease-in-out 2;
|
animation: bsplusThemeHighlightPulse 1.4s ease-in-out 2;
|
||||||
}
|
}
|
||||||
@keyframes bsplusThemeHighlightPulse {
|
@keyframes bsplusThemeHighlightPulse {
|
||||||
0%, 100% {
|
0%,
|
||||||
|
100% {
|
||||||
box-shadow: 0 0 0 0 color-mix(in srgb, var(--better-pri, #6366f1) 0%, transparent);
|
box-shadow: 0 0 0 0 color-mix(in srgb, var(--better-pri, #6366f1) 0%, transparent);
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
@@ -5290,7 +5223,9 @@ div.day-empty {
|
|||||||
|
|
||||||
.popup-media-fullscreenable {
|
.popup-media-fullscreenable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
|
transition:
|
||||||
|
opacity 0.2s ease-in-out,
|
||||||
|
transform 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
.popup-media-fullscreenable:hover {
|
.popup-media-fullscreenable:hover {
|
||||||
opacity: 0.95;
|
opacity: 0.95;
|
||||||
@@ -5505,10 +5440,7 @@ div.day-empty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:hover)
|
&:not(:hover) .cke_button:not(.cke_button_on):not(.cke_button__seqta-align-left:first-child) {
|
||||||
.cke_button:not(.cke_button_on):not(
|
|
||||||
.cke_button__seqta-align-left:first-child
|
|
||||||
) {
|
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
transition:
|
transition:
|
||||||
|
|||||||
@@ -29,12 +29,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu#menu
|
#menu#menu ul.bsplus-drill-rows:has(> .hasChildren:is(.active, .bsplus-active)) > :is(li, section) {
|
||||||
ul.bsplus-drill-rows:has(> .hasChildren:is(.active, .bsplus-active))
|
margin-left: calc(var(--bsplus-row-margin-left) + var(--bsplus-slide-off, -320px)) !important;
|
||||||
> :is(li, section) {
|
|
||||||
margin-left: calc(
|
|
||||||
var(--bsplus-row-margin-left) + var(--bsplus-slide-off, -320px)
|
|
||||||
) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Incoming rows travel only with their native panel. */
|
/* Incoming rows travel only with their native panel. */
|
||||||
@@ -62,9 +58,7 @@
|
|||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu
|
#menu > ul:has(li.hasChildren:is(.active, .bsplus-active)) > li:is(.active, .bsplus-active) {
|
||||||
> ul:has(li.hasChildren:is(.active, .bsplus-active))
|
|
||||||
> li:is(.active, .bsplus-active) {
|
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,191 +0,0 @@
|
|||||||
/* Sidebar on the right edge — layout, drill direction, and mirrored accents. */
|
|
||||||
|
|
||||||
body.bsplus-sidebar-right {
|
|
||||||
#menu {
|
|
||||||
left: auto !important;
|
|
||||||
right: 0 !important;
|
|
||||||
width: var(--bsplus-sidebar-width, 270px) !important;
|
|
||||||
overflow: visible !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content {
|
|
||||||
left: 0 !important;
|
|
||||||
right: var(--bsplus-sidebar-width, 270px) !important;
|
|
||||||
transition:
|
|
||||||
right 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
|
||||||
left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
|
||||||
transform 0.4s ease !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sub panels open to the left of the menu — anchor to menu edge, not viewport. */
|
|
||||||
#menu .sub {
|
|
||||||
left: auto !important;
|
|
||||||
right: 100% !important;
|
|
||||||
width: var(--bsplus-sidebar-width, 270px) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Title bar spans the full viewport; only page content respects sidebar inset. */
|
|
||||||
#container #content #title,
|
|
||||||
#title {
|
|
||||||
left: 0 !important;
|
|
||||||
right: 0 !important;
|
|
||||||
width: 100% !important;
|
|
||||||
max-width: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.icon-only-sidebar {
|
|
||||||
#menu {
|
|
||||||
width: 70px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content {
|
|
||||||
right: var(--bsplus-icon-rail-space) !important;
|
|
||||||
transition: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu .sub {
|
|
||||||
right: 100% !important;
|
|
||||||
width: var(--bsplus-sidebar-width, 270px) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:has(#menu.bsplus-styled-sidebar) #container #content #title,
|
|
||||||
&.menuShown:has(#menu.bsplus-styled-sidebar) #container #content #title {
|
|
||||||
box-shadow: -6px 0 8px -4px rgb(0 0 0 / 0.25) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu.bsplus-styled-sidebar {
|
|
||||||
&.bsplus-sidebar-indicator-bar:not(.bsplus-sidebar-style-strip) {
|
|
||||||
> ul > li.item.active:not(.hasChildren)::after,
|
|
||||||
.sub li.item.active:not(.hasChildren)::after {
|
|
||||||
left: auto !important;
|
|
||||||
right: 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.bsplus-sidebar-style-strip {
|
|
||||||
> ul > li.item.active:not(.hasChildren)::after,
|
|
||||||
.sub li.item.active:not(.hasChildren)::after {
|
|
||||||
left: auto !important;
|
|
||||||
right: 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu
|
|
||||||
li:is(.active, .hasChildren.bsplus-active)
|
|
||||||
> .sub
|
|
||||||
> ul
|
|
||||||
> .item:not(.hasChildren)::before {
|
|
||||||
left: auto !important;
|
|
||||||
right: 0 !important;
|
|
||||||
border-radius: 0 8px 8px 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
body.bsplus-sidebar-right {
|
|
||||||
#menu {
|
|
||||||
left: auto !important;
|
|
||||||
right: 0 !important;
|
|
||||||
transform: translateX(var(--bsplus-sidebar-width, 270px)) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.menuShown #menu {
|
|
||||||
transform: translateX(0) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content {
|
|
||||||
left: 0 !important;
|
|
||||||
right: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.menuShown #content {
|
|
||||||
transform: translateX(
|
|
||||||
calc(-1 * var(--bsplus-sidebar-width, 270px))
|
|
||||||
) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.icon-only-sidebar {
|
|
||||||
#menu {
|
|
||||||
transform: translateX(70px) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.menuShown #content {
|
|
||||||
right: 0 !important;
|
|
||||||
transform: translateX(
|
|
||||||
calc(-1 * var(--bsplus-icon-rail-space))
|
|
||||||
) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#menuToggle {
|
|
||||||
left: auto !important;
|
|
||||||
right: 8px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#container #content #title,
|
|
||||||
#title {
|
|
||||||
left: 0 !important;
|
|
||||||
right: 0 !important;
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Counter `#content` slide so the fixed title stays viewport-wide. */
|
|
||||||
&.menuShown #container #content #title {
|
|
||||||
transform: translateX(var(--bsplus-sidebar-width, 270px)) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.icon-only-sidebar.menuShown #container #content #title {
|
|
||||||
transform: translateX(var(--bsplus-icon-rail-space)) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body.icon-only-sidebar.bsplus-sidebar-right {
|
|
||||||
#menu#menu > ul > .hasChildren:is(.active, .bsplus-active) {
|
|
||||||
margin-left: 0 !important;
|
|
||||||
margin-right: 7.5% !important;
|
|
||||||
border-radius: 0 var(--bsplus-sidebar-radius, 12px)
|
|
||||||
var(--bsplus-sidebar-radius, 12px) 0 !important;
|
|
||||||
> label {
|
|
||||||
transform: translateX(2.625px) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#menu#menu > ul > .hasChildren:is(.active, .bsplus-active) > label::after {
|
|
||||||
right: auto;
|
|
||||||
left: calc((100% - 70px) / 2 - 1px);
|
|
||||||
background:
|
|
||||||
radial-gradient(
|
|
||||||
circle at 100% 0,
|
|
||||||
transparent calc(var(--bsplus-sidebar-radius, 12px) - 0.5px),
|
|
||||||
var(--background-primary) var(--bsplus-sidebar-radius, 12px)
|
|
||||||
)
|
|
||||||
top / 100% var(--bsplus-sidebar-radius, 12px) no-repeat,
|
|
||||||
radial-gradient(
|
|
||||||
circle at 100% 100%,
|
|
||||||
transparent calc(var(--bsplus-sidebar-radius, 12px) - 0.5px),
|
|
||||||
var(--background-primary) var(--bsplus-sidebar-radius, 12px)
|
|
||||||
)
|
|
||||||
bottom / 100% var(--bsplus-sidebar-radius, 12px) no-repeat,
|
|
||||||
linear-gradient(var(--background-primary), var(--background-primary))
|
|
||||||
center / 100% calc(100% - 2 * var(--bsplus-sidebar-radius, 12px))
|
|
||||||
no-repeat;
|
|
||||||
}
|
|
||||||
#menu > ul > .hasChildren > .sub {
|
|
||||||
left: auto !important;
|
|
||||||
right: 70px !important;
|
|
||||||
border-right: none !important;
|
|
||||||
border-left: 1px solid var(--border-color, rgba(128, 128, 128, 0.3)) !important;
|
|
||||||
transform: translateX(100%);
|
|
||||||
clip-path: inset(0 100% 0 0);
|
|
||||||
}
|
|
||||||
#menu > ul > .hasChildren:is(.active, .bsplus-active) > .sub {
|
|
||||||
transform: none;
|
|
||||||
clip-path: inset(0);
|
|
||||||
}
|
|
||||||
#menu > ul > .hasChildren > .sub .sub {
|
|
||||||
left: 0 !important;
|
|
||||||
right: auto !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 273 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 141 KiB |
@@ -0,0 +1,48 @@
|
|||||||
|
@import "tailwindcss" source("../");
|
||||||
|
|
||||||
|
@plugin "@tailwindcss/forms";
|
||||||
|
|
||||||
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
|
@theme {
|
||||||
|
--text-*: initial;
|
||||||
|
--text-xs: 0.65rem;
|
||||||
|
--text-sm: 0.775rem;
|
||||||
|
--text-base: 0.65rem;
|
||||||
|
--text-md: 0.65rem;
|
||||||
|
--text-lg: 1rem;
|
||||||
|
--text-xl: 1.25rem;
|
||||||
|
--text-2xl: 1.5rem;
|
||||||
|
--text-3xl: 1.875rem;
|
||||||
|
--text-4xl: 2.25rem;
|
||||||
|
--text-5xl: 3rem;
|
||||||
|
--text-6xl: 4rem;
|
||||||
|
--text-7xl: 5rem;
|
||||||
|
--text-8xl: 6rem;
|
||||||
|
--text-9xl: 8rem;
|
||||||
|
--text-10xl: 10rem;
|
||||||
|
--text-11xl: 12rem;
|
||||||
|
--text-12xl: 14rem;
|
||||||
|
--text-13xl: 16rem;
|
||||||
|
--text-14xl: 18rem;
|
||||||
|
|
||||||
|
--font-IconFamily: IconFamily;
|
||||||
|
|
||||||
|
--animate-spin-fast: spin 0.4s linear infinite;
|
||||||
|
|
||||||
|
--aspect-theme: 5 / 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
*,
|
||||||
|
::after,
|
||||||
|
::before,
|
||||||
|
::backdrop,
|
||||||
|
::file-selector-button {
|
||||||
|
border-color: var(--color-gray-200, currentcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+1
@@ -3,6 +3,7 @@ declare module "*.webm";
|
|||||||
declare module "*.woff";
|
declare module "*.woff";
|
||||||
declare module "*.scss";
|
declare module "*.scss";
|
||||||
declare module "*.png";
|
declare module "*.png";
|
||||||
|
declare module "*.webp";
|
||||||
declare module "*.html";
|
declare module "*.html";
|
||||||
declare module "*.svelte";
|
declare module "*.svelte";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"last_updated": "2024-06-15T12:00:00Z",
|
|
||||||
"whatsnew_html": "<div class=\"whatsnewTextContainer\" style=\"overflow-y: auto; font-size: 1.3rem; line-height: 1.6;\"><p>It has come to our attention that several schools have expressed concerns about BetterSEQTA+. This is very disheartening, so we have decided to release a statement on the situation.</p><p>To view our privacy policy, please click the <strong>shield icon</strong> in the settings menu, or <a href=\"https://betterseqta.org/privacy\" target=\"_blank\" rel=\"noopener noreferrer\" id=\"privacy-link\" style=\"color: inherit; text-decoration: underline; cursor: pointer; white-space: nowrap;\">click here</a>.</p><p style=\"font-weight: bold; margin-top: 15px;\">We never collect any information from you, and aim to provide the best features possible.</p></div>"
|
|
||||||
}
|
|
||||||
@@ -6,14 +6,14 @@
|
|||||||
variant = "secondary",
|
variant = "secondary",
|
||||||
icon,
|
icon,
|
||||||
class: className = "",
|
class: className = "",
|
||||||
} = $props<{
|
}: {
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
text: string;
|
text: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
variant?: "primary" | "secondary" | "ghost";
|
variant?: "primary" | "secondary" | "ghost";
|
||||||
icon?: string;
|
icon?: string;
|
||||||
class?: string;
|
class?: string;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const variants = {
|
const variants = {
|
||||||
primary: "bg-zinc-100 text-zinc-900 border-transparent enabled:hover:bg-white",
|
primary: "bg-zinc-100 text-zinc-900 border-transparent enabled:hover:bg-white",
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
onclick={onClick}
|
onclick={onClick}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 {variants[variant]} {className}"
|
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 {variants[variant]} {className}"
|
||||||
>
|
>
|
||||||
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
|
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
|
||||||
{text}
|
{text}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
||||||
import Button from "./Button.svelte";
|
import Button from "./Button.svelte";
|
||||||
|
|
||||||
const { hidePanel } = $props<{
|
const { hidePanel }: {
|
||||||
hidePanel: () => void;
|
hidePanel: () => void;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let cloudState = $state(cloudAuth.state);
|
let cloudState = $state(cloudAuth.state);
|
||||||
let background = $state<HTMLDivElement | null>(null);
|
let background = $state<HTMLDivElement | null>(null);
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { resolveCloudPfp, defaultAccountsPfpUrl } from "@/seqta/utils/cloudPfpCache";
|
import { resolveCloudPfp, defaultAccountsPfpUrl } from "@/seqta/utils/cloudPfpCache";
|
||||||
import type { CloudUser } from "@/seqta/utils/CloudAuth";
|
import type { CloudUser } from "@/seqta/utils/CloudAuth";
|
||||||
|
|
||||||
const { user, class: className = "" } = $props<{
|
const { user, class: className = "" }: {
|
||||||
user: CloudUser | null | undefined;
|
user: CloudUser | null | undefined;
|
||||||
class?: string;
|
class?: string;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let avatarSrc = $state<string | undefined>(undefined);
|
let avatarSrc = $state<string | undefined>(undefined);
|
||||||
let revokeUrl: string | undefined;
|
let revokeUrl: string | undefined;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||||
import Button from "./Button.svelte";
|
import Button from "./Button.svelte";
|
||||||
import Switch from "./Switch.svelte";
|
import Switch from "./Switch.svelte";
|
||||||
|
|
||||||
let { showDisclaimer } = $props<{
|
let { showDisclaimer }: {
|
||||||
showDisclaimer: (onConfirm: () => void, onCancel: () => void) => void;
|
showDisclaimer: (onConfirm: () => void, onCancel: () => void) => void;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let cloudState = $state(cloudAuth.state);
|
let cloudState = $state(cloudAuth.state);
|
||||||
let busy = $state(false);
|
let busy = $state(false);
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
href="https://betterseqta.org/privacy"
|
href="https://betterseqta.org/privacy"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="font-medium text-emerald-600 underline decoration-emerald-600/50 underline-offset-2 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 rounded-sm"
|
class="font-medium text-emerald-600 underline decoration-emerald-600/50 underline-offset-2 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 rounded-xs"
|
||||||
>Privacy policy</a>
|
>Privacy policy</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,21 +7,19 @@
|
|||||||
import { indentWithTab, history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
import { indentWithTab, history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||||
import { indentOnInput, indentUnit, bracketMatching, foldKeymap, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
|
import { indentOnInput, indentUnit, bracketMatching, foldKeymap, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
|
||||||
import { closeBrackets, autocompletion, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
import { closeBrackets, autocompletion, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
||||||
import { highlightSpecialChars, drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine, keymap, EditorView, dropCursor } from '@codemirror/view';
|
import { highlightSpecialChars, drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine, keymap, EditorView, dropCursor, type KeyBinding } from '@codemirror/view';
|
||||||
import { color } from '@uiw/codemirror-extensions-color'
|
import { color } from '@uiw/codemirror-extensions-color'
|
||||||
import { Compartment } from '@codemirror/state';
|
import { Compartment } from '@codemirror/state';
|
||||||
|
|
||||||
// Theme
|
|
||||||
import { githubLight, githubDark } from '@uiw/codemirror-theme-github';
|
import { githubLight, githubDark } from '@uiw/codemirror-theme-github';
|
||||||
|
|
||||||
// Language
|
|
||||||
import { css } from "@codemirror/lang-css";
|
import { css } from "@codemirror/lang-css";
|
||||||
|
|
||||||
let editor = $state<HTMLDivElement | null>(null)
|
let editor = $state<HTMLDivElement | null>(null)
|
||||||
let view: EditorView | null = null;
|
let view: EditorView | null = null;
|
||||||
let unsubSettings: (() => void) | undefined;
|
let unsubSettings: (() => void) | undefined;
|
||||||
let editorTheme = new Compartment();
|
let editorTheme = new Compartment();
|
||||||
let { value, onChange, className } = $props<{value: string, onChange: (value: string) => void, className?: string}>()
|
let { value, onChange, className }: {value: string, onChange: (value: string) => void, className?: string} = $props()
|
||||||
|
|
||||||
function createEditorState(initialContents: string) {
|
function createEditorState(initialContents: string) {
|
||||||
let extensions = [
|
let extensions = [
|
||||||
@@ -47,7 +45,7 @@
|
|||||||
...historyKeymap,
|
...historyKeymap,
|
||||||
...foldKeymap,
|
...foldKeymap,
|
||||||
...completionKeymap,
|
...completionKeymap,
|
||||||
]),
|
] as KeyBinding[]),
|
||||||
EditorView.updateListener.of((update) => {
|
EditorView.updateListener.of((update) => {
|
||||||
if (update.docChanged) {
|
if (update.docChanged) {
|
||||||
onChange(update.state.doc.toString())
|
onChange(update.state.doc.toString())
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
div:has(> #rbgcp-wrapper) {
|
|
||||||
background: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-inputs-wrap {
|
|
||||||
padding-top: 4px !important;
|
|
||||||
margin-bottom: -8px;
|
|
||||||
|
|
||||||
#rbgcp-hex-input,
|
|
||||||
#rbgcp-input {
|
|
||||||
height: 28px !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark {
|
|
||||||
#rbgcp-wrapper {
|
|
||||||
div[style="padding-top: 11px; position: relative;"] div {
|
|
||||||
color: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-inputs-wrap #rbgcp-hex-input,
|
|
||||||
#rbgcp-inputs-wrap #rbgcp-input {
|
|
||||||
color: white !important;
|
|
||||||
background-color: #37373b !important;
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:has(> #rbgcp-solid-btn),
|
|
||||||
div:has(> #rbgcp-advanced-btn),
|
|
||||||
#rbgcp-color-model-btn > div,
|
|
||||||
#rbgcp-gradient-controls-wrap {
|
|
||||||
background-color: #37373b !important;
|
|
||||||
color: white !important;
|
|
||||||
|
|
||||||
svg {
|
|
||||||
circle {
|
|
||||||
fill: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
polyline,
|
|
||||||
line,
|
|
||||||
g,
|
|
||||||
path {
|
|
||||||
stroke: white !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-radial-btn,
|
|
||||||
#rbgcp-linear-btn {
|
|
||||||
&[style*="background: white;"] {
|
|
||||||
background-color: #28282b !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
svg {
|
|
||||||
path,
|
|
||||||
g,
|
|
||||||
polyline,
|
|
||||||
circle {
|
|
||||||
stroke: white !important;
|
|
||||||
fill: transparent !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div:has(> #rbgcp-stop-input) svg {
|
|
||||||
path {
|
|
||||||
stroke: unset !important;
|
|
||||||
fill: white !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-comparibles-btn svg path {
|
|
||||||
fill: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
> div {
|
|
||||||
color: white !important;
|
|
||||||
|
|
||||||
&[style*="background: white;"] {
|
|
||||||
background: #28282b !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div:has(> #rbgcp-degree-input) {
|
|
||||||
width: 70px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-degree-input {
|
|
||||||
width: 50px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-degree-input,
|
|
||||||
#rbgcp-stop-input {
|
|
||||||
color: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#rbgcp-gradient-controls-wrap > div,
|
|
||||||
#rbgcp-gradient-controls-wrap > div > div:not([role="button"]) {
|
|
||||||
background-color: #37373b !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +1,113 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import type { Component } from 'svelte'
|
|
||||||
import { animate } from 'motion';
|
import { animate } from 'motion';
|
||||||
import { delay } from '@/seqta/utils/delay.ts'
|
import { delay } from '@/seqta/utils/delay'
|
||||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState.ts'
|
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||||
|
import GradientPicker from './colourPicker/GradientPicker.svelte'
|
||||||
|
|
||||||
const { hidePicker, standalone = false, savePresets = true, customOnChange = null, customState = null } = $props<{
|
const PRESETS_KEY = 'colorPickerPresets';
|
||||||
hidePicker?: () => void,
|
const MAX_PRESETS = 18;
|
||||||
standalone?: boolean,
|
const DEFAULT_PRESETS = [
|
||||||
savePresets?: boolean,
|
"linear-gradient(30deg, rgba(229,209,218,1) 0%, RGBA(235,169,202,1) 46%, rgba(214,155,162,1) 100%)",
|
||||||
customOnChange?: (color: string) => void,
|
"linear-gradient(40deg, rgba(201,61,0,1) 0%, RGBA(170, 5, 58, 1) 100%)",
|
||||||
customState?: string
|
"linear-gradient(40deg, rgba(0, 141, 201, 0.76) 0%, rgba(8, 5, 170, 0.66) 100%)",
|
||||||
}>();
|
"linear-gradient(40deg, rgba(0, 201, 20, 0.76) 0%, rgba(4, 160, 105, 0.66) 100%)",
|
||||||
|
"linear-gradient(40deg, rgba(199, 20, 55, 0.76) 0%, rgba(95, 11, 160, 0.66) 100%)",
|
||||||
|
"linear-gradient(40deg, rgba(24, 20, 199, 0.76) 0%, rgba(23, 173, 65, 0.66) 100%)",
|
||||||
|
"radial-gradient(circle, rgba(20, 199, 178, 0.76) 32%, rgba(3, 120, 57, 0.66) 100%)",
|
||||||
|
"radial-gradient(circle, rgba(13, 15, 145, 0.76) 12%, rgba(103, 3, 120, 0.66) 100%)",
|
||||||
|
"linear-gradient(20deg, rgb(230, 21, 21) 0%, rgb(230, 109, 21) 12%, rgb(230, 34, 21) 26%, rgb(230, 21, 21) 39%, rgb(230, 84, 21) 48%, rgb(230, 34, 21) 58%, rgb(230, 96, 21) 69%, rgb(230, 34, 21) 80%, rgb(230, 71, 21) 89%, rgb(230, 21, 21) 100%)",
|
||||||
|
"rgba(114, 1, 170, 0.89)",
|
||||||
|
"rgba(93, 135, 63, 0.89)",
|
||||||
|
"rgba(4, 4, 138, 0.77)",
|
||||||
|
"rgba(21, 20, 20, 0.89)",
|
||||||
|
"linear-gradient(340deg, rgb(205, 74, 82) 18%, rgba(132, 8, 8, 0.89) 46%, rgb(204, 78, 85) 72%)",
|
||||||
|
"radial-gradient(circle, rgb(74, 205, 158) 0%, rgba(8, 72, 132, 0.89) 99%)",
|
||||||
|
"rgba(17, 94, 89, 1)",
|
||||||
|
"rgba(30, 64, 175, 0.89)",
|
||||||
|
"rgba(134, 25, 143, 1)",
|
||||||
|
"rgba(14, 165, 233, 0.9)",
|
||||||
|
];
|
||||||
|
|
||||||
|
const {
|
||||||
|
hidePicker,
|
||||||
|
standalone = false,
|
||||||
|
savePresets = true,
|
||||||
|
customOnChange = null,
|
||||||
|
customState = null,
|
||||||
|
}: {
|
||||||
|
hidePicker?: () => void;
|
||||||
|
standalone?: boolean;
|
||||||
|
savePresets?: boolean;
|
||||||
|
customOnChange?: ((color: string) => void) | null;
|
||||||
|
customState?: string | null;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
let background = $state<HTMLDivElement | null>(null);
|
let background = $state<HTMLDivElement | null>(null);
|
||||||
let content = $state<HTMLDivElement | null>(null);
|
let content = $state<HTMLDivElement | null>(null);
|
||||||
let ReactAdapter = $state<Component | null>(null);
|
let presets = $state<string[]>(loadPresets());
|
||||||
let ColourPickerEl = $state<unknown>(null);
|
let current = $state(initialColour());
|
||||||
let pickerReady = $state(false);
|
|
||||||
|
|
||||||
const loadPicker = async () => {
|
function initialColour(): string {
|
||||||
const [adapterMod, pickerMod] = await Promise.all([
|
return customState ?? settingsState.selectedColor ?? '';
|
||||||
import('./utils/ReactAdapter.svelte'),
|
}
|
||||||
import('./ColourPicker.tsx'),
|
|
||||||
]);
|
function loadPresets(): string[] {
|
||||||
ReactAdapter = adapterMod.default;
|
try {
|
||||||
ColourPickerEl = pickerMod.default;
|
const saved = JSON.parse(localStorage.getItem(PRESETS_KEY) ?? 'null');
|
||||||
pickerReady = true;
|
return Array.isArray(saved) ? saved : DEFAULT_PRESETS;
|
||||||
};
|
} catch {
|
||||||
|
return DEFAULT_PRESETS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rememberPreset(colour: string) {
|
||||||
|
if (!colour || presets[0] === colour) return;
|
||||||
|
const updated = [colour, ...presets.filter((preset) => preset !== colour)].slice(0, MAX_PRESETS);
|
||||||
|
localStorage.setItem(PRESETS_KEY, JSON.stringify(updated));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleChange(colour: string) {
|
||||||
|
current = colour;
|
||||||
|
if (customOnChange) customOnChange(colour);
|
||||||
|
else settingsState.selectedColor = colour;
|
||||||
|
}
|
||||||
|
|
||||||
const closePicker = async () => {
|
const closePicker = async () => {
|
||||||
if (standalone) return;
|
if (standalone || !background || !content) return;
|
||||||
if (!background || !content) return;
|
|
||||||
|
|
||||||
animate(
|
animate(content, { scale: [1, 0.4], opacity: [1, 0] }, { type: 'spring', stiffness: 400, damping: 30 });
|
||||||
content,
|
animate(background, { opacity: [1, 0] }, { ease: [0.4, 0, 0.2, 1] });
|
||||||
{ scale: [1, 0.4], opacity: [1, 0] },
|
|
||||||
{
|
|
||||||
type: 'spring',
|
|
||||||
stiffness: 400,
|
|
||||||
damping: 30
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
animate(
|
|
||||||
background,
|
|
||||||
{ opacity: [1, 0] },
|
|
||||||
{ ease: [0.4, 0, 0.2, 1] }
|
|
||||||
);
|
|
||||||
|
|
||||||
await delay(400);
|
await delay(400);
|
||||||
hidePicker?.();
|
hidePicker?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
void loadPicker().then(() => {
|
if (!standalone && background && content) {
|
||||||
if (standalone) return;
|
animate(background, { opacity: [0, 1] }, { duration: 0.3, ease: [0.4, 0, 0.2, 1] });
|
||||||
if (!background || !content) return;
|
animate(content, { scale: [0.4, 1], opacity: [0, 1] }, { type: 'spring', stiffness: 400, damping: 30 });
|
||||||
|
}
|
||||||
|
|
||||||
animate(
|
const handleEscapeKey = (event: KeyboardEvent) => {
|
||||||
background,
|
if (event.key === 'Escape') closePicker();
|
||||||
{ opacity: [0, 1] },
|
|
||||||
{ duration: 0.3, ease: [0.4, 0, 0.2, 1] }
|
|
||||||
);
|
|
||||||
|
|
||||||
animate(
|
|
||||||
content,
|
|
||||||
{ scale: [0.4, 1], opacity: [0, 1] },
|
|
||||||
{
|
|
||||||
type: 'spring',
|
|
||||||
stiffness: 400,
|
|
||||||
damping: 30
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleEscapeKey = (e: KeyboardEvent) => {
|
|
||||||
if (e.key === 'Escape') {
|
|
||||||
closePicker();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('keydown', handleEscapeKey);
|
document.addEventListener('keydown', handleEscapeKey);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener('keydown', handleEscapeKey);
|
document.removeEventListener('keydown', handleEscapeKey);
|
||||||
|
if (savePresets && !customOnChange) rememberPreset(current);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleBackgroundClick(event: MouseEvent) {
|
function handleBackgroundClick(event: MouseEvent) {
|
||||||
if (event.target === background) {
|
if (event.target === background) closePicker();
|
||||||
closePicker();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if standalone}
|
{#if standalone}
|
||||||
<div class="h-auto overflow-clip rounded-xl {$settingsState.DarkMode ? 'dark' : ''}">
|
<div class="h-auto {$settingsState.DarkMode ? 'dark' : ''}">
|
||||||
{#if pickerReady && ReactAdapter && ColourPickerEl}
|
<GradientPicker value={customState ?? current} onchange={handleChange} {presets} />
|
||||||
<ReactAdapter customOnChange={customOnChange} customState={customState} savePresets={savePresets} el={ColourPickerEl} />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||||
@@ -107,15 +115,13 @@
|
|||||||
bind:this={background}
|
bind:this={background}
|
||||||
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full shadow-2xl cursor-pointer bg-black/20 border border-[#DDDDDD]/30 dark:border-[#38373D]/30 {$settingsState.DarkMode ? 'dark' : ''}"
|
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full shadow-2xl cursor-pointer bg-black/20 border border-[#DDDDDD]/30 dark:border-[#38373D]/30 {$settingsState.DarkMode ? 'dark' : ''}"
|
||||||
onclick={handleBackgroundClick}
|
onclick={handleBackgroundClick}
|
||||||
onkeydown={(e) => { if (e.key === 'Enter') handleBackgroundClick(e as unknown as MouseEvent) }}
|
onkeydown={(event) => { if (event.key === 'Enter') handleBackgroundClick(event as unknown as MouseEvent) }}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
bind:this={content}
|
bind:this={content}
|
||||||
class="p-4 h-auto bg-white rounded-xl border shadow-lg cursor-auto dark:bg-zinc-800 border-zinc-100 dark:border-zinc-700"
|
class="p-4 h-auto bg-white rounded-xl border shadow-lg cursor-auto dark:bg-zinc-800 border-zinc-100 dark:border-zinc-700"
|
||||||
>
|
>
|
||||||
{#if pickerReady && ReactAdapter && ColourPickerEl}
|
<GradientPicker value={current} onchange={handleChange} {presets} />
|
||||||
<ReactAdapter customOnChange={customOnChange} customState={customState} savePresets={savePresets} el={ColourPickerEl} />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
import ColorPicker from "react-best-gradient-color-picker";
|
|
||||||
import { useEffect, useRef, useState } from "react";
|
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts";
|
|
||||||
|
|
||||||
const defaultPresets = [
|
|
||||||
"linear-gradient(30deg, rgba(229,209,218,1) 0%, RGBA(235,169,202,1) 46%, rgba(214,155,162,1) 100%)",
|
|
||||||
"linear-gradient(40deg, rgba(201,61,0,1) 0%, RGBA(170, 5, 58, 1) 100%)",
|
|
||||||
"linear-gradient(40deg, rgba(0, 141, 201, 0.76) 0%, rgba(8, 5, 170, 0.66) 100%)",
|
|
||||||
"linear-gradient(40deg, rgba(0, 201, 20, 0.76) 0%, rgba(4, 160, 105, 0.66) 100%)",
|
|
||||||
"linear-gradient(40deg, rgba(199, 20, 55, 0.76) 0%, rgba(95, 11, 160, 0.66) 100%)",
|
|
||||||
"linear-gradient(40deg, rgba(24, 20, 199, 0.76) 0%, rgba(23, 173, 65, 0.66) 100%)",
|
|
||||||
"radial-gradient(circle, rgba(20, 199, 178, 0.76) 32%, rgba(3, 120, 57, 0.66) 100%)",
|
|
||||||
"radial-gradient(circle, rgba(13, 15, 145, 0.76) 12%, rgba(103, 3, 120, 0.66) 100%)",
|
|
||||||
"linear-gradient(20deg, rgb(230, 21, 21) 0%, rgb(230, 109, 21) 12%, rgb(230, 34, 21) 26%, rgb(230, 21, 21) 39%, rgb(230, 84, 21) 48%, rgb(230, 34, 21) 58%, rgb(230, 96, 21) 69%, rgb(230, 34, 21) 80%, rgb(230, 71, 21) 89%, rgb(230, 21, 21) 100%)",
|
|
||||||
"rgba(114, 1, 170, 0.89)",
|
|
||||||
"rgba(93, 135, 63, 0.89)",
|
|
||||||
"rgba(4, 4, 138, 0.77)",
|
|
||||||
"rgba(21, 20, 20, 0.89)",
|
|
||||||
"linear-gradient(340deg, rgb(205, 74, 82) 18%, rgba(132, 8, 8, 0.89) 46%, rgb(204, 78, 85) 72%)",
|
|
||||||
"radial-gradient(circle, rgb(74, 205, 158) 0%, rgba(8, 72, 132, 0.89) 99%)",
|
|
||||||
"rgba(17, 94, 89, 1)",
|
|
||||||
"rgba(30, 64, 175, 0.89)",
|
|
||||||
"rgba(134, 25, 143, 1)",
|
|
||||||
"rgba(14, 165, 233, 0.9)",
|
|
||||||
];
|
|
||||||
|
|
||||||
interface PickerProps {
|
|
||||||
customOnChange?: (color: string) => void;
|
|
||||||
customState?: string;
|
|
||||||
savePresets?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Picker({
|
|
||||||
customOnChange,
|
|
||||||
customState,
|
|
||||||
savePresets = true,
|
|
||||||
}: PickerProps) {
|
|
||||||
const [customThemeColor, setCustomThemeColor] = useState<string | null>();
|
|
||||||
const [presets, setPresets] = useState<string[]>();
|
|
||||||
|
|
||||||
const latestValuesRef = useRef({
|
|
||||||
customThemeColor,
|
|
||||||
customOnChange,
|
|
||||||
savePresets,
|
|
||||||
presets,
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (customState !== undefined && customState !== null) {
|
|
||||||
setCustomThemeColor(customState);
|
|
||||||
} else {
|
|
||||||
setCustomThemeColor(settingsState.selectedColor ?? null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (presets === undefined) {
|
|
||||||
const savedPresets = localStorage.getItem("colorPickerPresets");
|
|
||||||
setPresets(savedPresets ? JSON.parse(savedPresets) : defaultPresets);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
latestValuesRef.current = {
|
|
||||||
customThemeColor,
|
|
||||||
customOnChange,
|
|
||||||
savePresets,
|
|
||||||
presets,
|
|
||||||
};
|
|
||||||
}, [customThemeColor, customOnChange, savePresets, presets]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
const { customThemeColor, customOnChange, savePresets, presets } =
|
|
||||||
latestValuesRef.current;
|
|
||||||
if (!(customThemeColor && !customOnChange && savePresets && presets))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Only proceed if presets are different (avoid unnecessary updates)
|
|
||||||
const existingIndex = presets.indexOf(customThemeColor);
|
|
||||||
let updatedPresets;
|
|
||||||
|
|
||||||
if (existingIndex === 0) {
|
|
||||||
// No need to update if the selected color is already the first element
|
|
||||||
return;
|
|
||||||
} else if (existingIndex > -1) {
|
|
||||||
updatedPresets = [
|
|
||||||
customThemeColor,
|
|
||||||
...presets.slice(0, existingIndex),
|
|
||||||
...presets.slice(existingIndex + 1),
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
updatedPresets = [customThemeColor, ...presets].slice(0, 18);
|
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem(
|
|
||||||
"colorPickerPresets",
|
|
||||||
JSON.stringify(updatedPresets),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (customThemeColor && !customOnChange) {
|
|
||||||
settingsState.selectedColor = customThemeColor;
|
|
||||||
}
|
|
||||||
}, [customThemeColor, customOnChange]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ColorPicker
|
|
||||||
disableDarkMode={true}
|
|
||||||
presets={presets}
|
|
||||||
value={customThemeColor ?? ""}
|
|
||||||
onChange={(color: string) => {
|
|
||||||
if (customOnChange) {
|
|
||||||
customOnChange(color);
|
|
||||||
setCustomThemeColor(color);
|
|
||||||
} else {
|
|
||||||
setCustomThemeColor(color);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from "svelte/transition";
|
import { fade } from "svelte/transition";
|
||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import QRCode from "qrcode";
|
import QRCode from "qrcode";
|
||||||
import Button from "./Button.svelte";
|
import Button from "./Button.svelte";
|
||||||
import { portal } from "../utils/portal";
|
import { portal } from "../utils/portal";
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
{#if showQrModal && qrDataUrl}
|
{#if showQrModal && qrDataUrl}
|
||||||
<div
|
<div
|
||||||
use:portal
|
use:portal
|
||||||
class="fixed cursor-auto inset-0 z-[10000] flex justify-center items-center bg-black/50 {isStandalone ? 'backdrop-blur-sm' : ''} {$settingsState.DarkMode ? 'dark' : ''}"
|
class="fixed cursor-auto inset-0 z-10000 flex justify-center items-center bg-black/50 {isStandalone ? 'backdrop-blur-xs' : ''} {$settingsState.DarkMode ? 'dark' : ''}"
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
onclick={(e) => {
|
onclick={(e) => {
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
import { animate } from 'motion';
|
import { animate } from 'motion';
|
||||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState';
|
import { settingsState } from '@/seqta/utils/listeners/SettingsState';
|
||||||
|
|
||||||
let { onConfirm, onCancel, title, message } = $props<{
|
let { onConfirm, onCancel, title, message }: {
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
title: string;
|
title: string;
|
||||||
message: string;
|
message: string;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let modalElement: HTMLElement;
|
let modalElement: HTMLElement;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex fixed inset-0 z-[10000] justify-center items-center bg-black/50 {$settingsState.DarkMode ? 'dark' : ''}"
|
class="flex fixed inset-0 z-10000 justify-center items-center bg-black/50 {$settingsState.DarkMode ? 'dark' : ''}"
|
||||||
style="position: fixed; top: 0; left: 0; right: 0; bottom: 0;"
|
style="position: fixed; top: 0; left: 0; right: 0; bottom: 0;"
|
||||||
onclick={(e) => {
|
onclick={(e) => {
|
||||||
if (e.target === e.currentTarget) onCancel();
|
if (e.target === e.currentTarget) onCancel();
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||||
import Spinner from "./Spinner.svelte";
|
import Spinner from "./Spinner.svelte";
|
||||||
|
|
||||||
let { onClose, initialFeedbackId = null } = $props<{
|
let { onClose, initialFeedbackId = null }: {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
initialFeedbackId?: string | null;
|
initialFeedbackId?: string | null;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let tab = $state<"send" | "status">(
|
let tab = $derived<"send" | "status">(
|
||||||
typeof initialFeedbackId === "string" && initialFeedbackId ? "status" : "send",
|
typeof initialFeedbackId === "string" && initialFeedbackId ? "status" : "send",
|
||||||
);
|
);
|
||||||
let category = $state<FeedbackCategory>("bug");
|
let category = $state<FeedbackCategory>("bug");
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
: "background-color:#fff;color:#18181b;border-color:#e4e4e7;color-scheme:light",
|
: "background-color:#fff;color:#18181b;border-color:#e4e4e7;color-scheme:light",
|
||||||
);
|
);
|
||||||
const field =
|
const field =
|
||||||
"feedback-field w-full px-3 py-2.5 text-[18px] rounded-lg border focus:outline-none focus:ring-2 focus:ring-zinc-400";
|
"feedback-field w-full px-3 py-2.5 text-[18px] rounded-lg border focus:outline-hidden focus:ring-2 focus:ring-zinc-400";
|
||||||
const btn =
|
const btn =
|
||||||
"px-4 py-2 text-[18px] font-medium rounded-lg transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-zinc-400 disabled:opacity-50";
|
"px-4 py-2 text-[18px] font-medium rounded-lg transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-hidden focus:ring-2 focus:ring-zinc-400 disabled:opacity-50";
|
||||||
const btnMuted = $derived(
|
const btnMuted = $derived(
|
||||||
`${btn} ${isDark ? "bg-zinc-700 text-zinc-200" : "bg-zinc-200 text-zinc-700"}`,
|
`${btn} ${isDark ? "bg-zinc-700 text-zinc-200" : "bg-zinc-200 text-zinc-700"}`,
|
||||||
);
|
);
|
||||||
@@ -175,14 +175,14 @@
|
|||||||
|
|
||||||
<!-- Backdrop click target — separate from dialog so inner clicks never bubble to a "close" handler. -->
|
<!-- Backdrop click target — separate from dialog so inner clicks never bubble to a "close" handler. -->
|
||||||
<div
|
<div
|
||||||
class="feedback-overlay fixed inset-0 z-[99999] overflow-y-auto overscroll-contain {isDark
|
class="feedback-overlay fixed inset-0 z-99999 overflow-y-auto overscroll-contain {isDark
|
||||||
? 'dark'
|
? 'dark'
|
||||||
: ''}"
|
: ''}"
|
||||||
transition:fade={{ duration: $settingsState.animations ? 200 : 0 }}
|
transition:fade={{ duration: $settingsState.animations ? 200 : 0 }}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="feedback-overlay__backdrop fixed inset-0 bg-black/50 backdrop-blur-sm border-0 p-0 cursor-default"
|
class="feedback-overlay__backdrop fixed inset-0 bg-black/50 backdrop-blur-xs border-0 p-0 cursor-default"
|
||||||
aria-label="Close feedback"
|
aria-label="Close feedback"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
></button>
|
></button>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="feedback-overlay__center relative z-[1] flex min-h-full items-center justify-center p-4 sm:p-6 pointer-events-none"
|
class="feedback-overlay__center relative z-1 flex min-h-full items-center justify-center p-4 sm:p-6 pointer-events-none"
|
||||||
>
|
>
|
||||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||||
<div
|
<div
|
||||||
@@ -226,8 +226,8 @@
|
|||||||
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
|
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
|
||||||
'send'
|
'send'
|
||||||
? isDark
|
? isDark
|
||||||
? 'bg-zinc-700 text-white font-semibold shadow-sm'
|
? 'bg-zinc-700 text-white font-semibold shadow-xs'
|
||||||
: 'bg-white text-zinc-900 font-semibold shadow-sm'
|
: 'bg-white text-zinc-900 font-semibold shadow-xs'
|
||||||
: isDark
|
: isDark
|
||||||
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
|
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
|
||||||
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
|
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
|
||||||
@@ -242,8 +242,8 @@
|
|||||||
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
|
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
|
||||||
'status'
|
'status'
|
||||||
? isDark
|
? isDark
|
||||||
? 'bg-zinc-700 text-white font-semibold shadow-sm'
|
? 'bg-zinc-700 text-white font-semibold shadow-xs'
|
||||||
: 'bg-white text-zinc-900 font-semibold shadow-sm'
|
: 'bg-white text-zinc-900 font-semibold shadow-xs'
|
||||||
: isDark
|
: isDark
|
||||||
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
|
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
|
||||||
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
|
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
|
||||||
@@ -387,7 +387,7 @@
|
|||||||
<h2 id="feedback-modal-title" class="text-xl font-bold">Feedback status</h2>
|
<h2 id="feedback-modal-title" class="text-xl font-bold">Feedback status</h2>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="{btnMuted} !text-base !px-3 !py-1.5"
|
class="{btnMuted} text-base! px-3! py-1.5!"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
selectedItem = null;
|
selectedItem = null;
|
||||||
void loadStatusList();
|
void loadStatusList();
|
||||||
@@ -430,7 +430,7 @@
|
|||||||
<h2 id="feedback-modal-title" class="text-xl font-bold">My feedback</h2>
|
<h2 id="feedback-modal-title" class="text-xl font-bold">My feedback</h2>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="{btnMuted} !text-base !px-3 !py-1.5"
|
class="{btnMuted} text-base! px-3! py-1.5!"
|
||||||
onclick={() => void loadStatusList()}
|
onclick={() => void loadStatusList()}
|
||||||
disabled={statusLoading}
|
disabled={statusLoading}
|
||||||
>
|
>
|
||||||
@@ -461,7 +461,7 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => openStatusItem(item.id)}
|
onclick={() => openStatusItem(item.id)}
|
||||||
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] focus:outline-none focus:ring-2 focus:ring-zinc-400 {isDark
|
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] focus:outline-hidden focus:ring-2 focus:ring-zinc-400 {isDark
|
||||||
? 'border-zinc-700 bg-zinc-900/40'
|
? 'border-zinc-700 bg-zinc-900/40'
|
||||||
: 'border-zinc-200 bg-white'}"
|
: 'border-zinc-200 bg-white'}"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
import { syncPageThemeToElement } from "@/interface/utils/syncPageTheme";
|
import { syncPageThemeToElement } from "@/interface/utils/syncPageTheme";
|
||||||
import fontPickerStyles from "./fontPickerModal.css?inline";
|
import fontPickerStyles from "./fontPickerModal.css?inline";
|
||||||
|
|
||||||
let { hidePicker } = $props<{ hidePicker: () => void }>();
|
let { hidePicker }: { hidePicker: () => void } = $props();
|
||||||
|
|
||||||
let rootEl = $state<HTMLElement | null>(null);
|
let rootEl = $state<HTMLElement | null>(null);
|
||||||
let selectedId = $state(getFontPreset($settingsState.selectedFont).id);
|
let selectedId = $state(getFontPreset($settingsState.selectedFont).id);
|
||||||
@@ -87,6 +87,7 @@
|
|||||||
onclick={(event) => event.stopPropagation()}
|
onclick={(event) => event.stopPropagation()}
|
||||||
onkeydown={(event) => event.stopPropagation()}
|
onkeydown={(event) => event.stopPropagation()}
|
||||||
role="dialog"
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
aria-modal="true"
|
aria-modal="true"
|
||||||
aria-labelledby="font-picker-title"
|
aria-labelledby="font-picker-title"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { isValidHotkey, parseHotkey } from '@/plugins/built-in/globalSearch/src/utils/hotkeyUtils';
|
import { isValidHotkey, parseHotkey } from '@/plugins/built-in/globalSearch/src/utils/hotkeyUtils';
|
||||||
|
|
||||||
let { value, onChange } = $props<{
|
let { value, onChange }: {
|
||||||
value: string,
|
value: string,
|
||||||
onChange: (newValue: string) => void
|
onChange: (newValue: string) => void
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let isRecording = $state(false);
|
let isRecording = $state(false);
|
||||||
let recordedKeys = $state<Set<string>>(new Set());
|
let recordedKeys = $state<Set<string>>(new Set());
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatKeyForDisplay = (key: string): string => {
|
const formatKeyForDisplay = (key: string): string => {
|
||||||
// Map keys to their display format
|
|
||||||
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||||
const keyMap: Record<string, string> = {
|
const keyMap: Record<string, string> = {
|
||||||
'ctrl': isMac ? '⌃' : 'Ctrl',
|
'ctrl': isMac ? '⌃' : 'Ctrl',
|
||||||
@@ -70,7 +69,6 @@
|
|||||||
if (parsed.alt) parts.push('alt');
|
if (parsed.alt) parts.push('alt');
|
||||||
if (parsed.shift) parts.push('shift');
|
if (parsed.shift) parts.push('shift');
|
||||||
|
|
||||||
// Add the main key
|
|
||||||
if (parsed.key) parts.push(parsed.key);
|
if (parsed.key) parts.push(parsed.key);
|
||||||
|
|
||||||
return parts;
|
return parts;
|
||||||
@@ -92,7 +90,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the hotkey string
|
|
||||||
const modifiers: string[] = [];
|
const modifiers: string[] = [];
|
||||||
let mainKey = '';
|
let mainKey = '';
|
||||||
|
|
||||||
@@ -131,7 +128,6 @@
|
|||||||
|
|
||||||
const key = formatKeyForHotkey(e.key);
|
const key = formatKeyForHotkey(e.key);
|
||||||
|
|
||||||
// Add modifiers
|
|
||||||
if (e.ctrlKey) addRecordedKey('ctrl');
|
if (e.ctrlKey) addRecordedKey('ctrl');
|
||||||
if (e.metaKey) addRecordedKey('cmd');
|
if (e.metaKey) addRecordedKey('cmd');
|
||||||
if (e.altKey) addRecordedKey('alt');
|
if (e.altKey) addRecordedKey('alt');
|
||||||
@@ -166,7 +162,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get the parts to display
|
|
||||||
const hotkeyParts = $derived(isRecording
|
const hotkeyParts = $derived(isRecording
|
||||||
? Array.from(recordedKeys).map(formatKeyForDisplay)
|
? Array.from(recordedKeys).map(formatKeyForDisplay)
|
||||||
: getHotkeyParts(value).map(formatKeyForDisplay));
|
: getHotkeyParts(value).map(formatKeyForDisplay));
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
props = {},
|
props = {},
|
||||||
remountKey = "default",
|
remountKey = "default",
|
||||||
}: {
|
}: {
|
||||||
loader: () => Promise<{ default: Component }>;
|
loader: () => Promise<{ default: Component<any> }>;
|
||||||
props?: Record<string, unknown>;
|
props?: Record<string, unknown>;
|
||||||
/** Change to force a fresh import (e.g. different panel). Props-only updates reuse the component. */
|
/** Change to force a fresh import (e.g. different panel). Props-only updates reuse the component. */
|
||||||
remountKey?: string;
|
remountKey?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let Comp = $state<Component | null>(null);
|
let Comp = $state<Component<any> | null>(null);
|
||||||
let loadedKey = $state("");
|
let loadedKey = $state("");
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
import { animate as motionAnimate } from 'motion';
|
import { animate as motionAnimate } from 'motion';
|
||||||
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
||||||
|
|
||||||
let { initial, animate, exit, transition, children, class: className } = $props<{
|
let { initial, animate, exit, transition, children, class: className }: {
|
||||||
initial?: any,
|
initial?: any,
|
||||||
animate?: any,
|
animate?: any,
|
||||||
exit?: any,
|
exit?: any,
|
||||||
transition?: any,
|
transition?: any,
|
||||||
children?: any,
|
children?: any,
|
||||||
class?: string
|
class?: string
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let divElement: HTMLElement;
|
let divElement: HTMLElement;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||||
|
|
||||||
let { onClick } = $props<{ onClick: () => void }>();
|
let { onClick }: { onClick: () => void } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { onclick, label = "Close" } = $props<{
|
let { onclick, label = "Close" }: {
|
||||||
onclick: () => void;
|
onclick: () => void;
|
||||||
label?: string;
|
label?: string;
|
||||||
}>();
|
} = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
{onclick}
|
{onclick}
|
||||||
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-none dark:text-zinc-400 dark:hover:text-white"
|
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden dark:text-zinc-400 dark:hover:text-white"
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import { getRemoteStatusMessage } from "@/seqta/utils/remoteConfig/apply";
|
import { getRemoteStatusMessage } from "@/seqta/utils/remoteConfig/apply";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||||
import { requestSettingsDestination } from "@/seqta/utils/settingsNavigation";
|
import { requestSettingsDestination } from "@/seqta/utils/settingsNavigation";
|
||||||
import browser from "webextension-polyfill";
|
import browser from "@/lib/browser";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
let localOverride = $state(false);
|
let localOverride = $state(false);
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openGeneralSettings() {
|
function openGeneralSettings() {
|
||||||
requestSettingsDestination({ section: "general" });
|
requestSettingsDestination({ page: "settings", section: "general" });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
{#if activeTheme?.mode === "optional" && snapshot.remoteTheme?.allowUserOptOut !== false}
|
{#if activeTheme?.mode === "optional" && snapshot.remoteTheme?.allowUserOptOut !== false}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-lg bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
|
class="rounded-lg bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-hidden focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
|
||||||
onclick={() => void turnOffOptionalTheme()}
|
onclick={() => void turnOffOptionalTheme()}
|
||||||
>
|
>
|
||||||
Turn off school theme
|
Turn off school theme
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
{#if killActive && !isEffectiveBsplusEnabled() && allowOverride}
|
{#if killActive && !isEffectiveBsplusEnabled() && allowOverride}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-lg bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
|
class="rounded-lg bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-hidden focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
|
||||||
onclick={enableLocalRun}
|
onclick={enableLocalRun}
|
||||||
>
|
>
|
||||||
Run locally anyway
|
Run locally anyway
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-lg border border-amber-300/80 px-3 py-1.5 text-xs font-medium transition-colors duration-200 hover:bg-amber-100/80 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:border-amber-800 dark:hover:bg-amber-900/50 dark:focus:ring-offset-zinc-900"
|
class="rounded-lg border border-amber-300/80 px-3 py-1.5 text-xs font-medium transition-colors duration-200 hover:bg-amber-100/80 focus:outline-hidden focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:border-amber-800 dark:hover:bg-amber-900/50 dark:focus:ring-offset-zinc-900"
|
||||||
onclick={openGeneralSettings}
|
onclick={openGeneralSettings}
|
||||||
>
|
>
|
||||||
General settings
|
General settings
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { value, onChange, options } = $props<{
|
let { value, onChange, options }: {
|
||||||
value: string,
|
value: string,
|
||||||
onChange: (newValue: string) => void,
|
onChange: (newValue: string) => void,
|
||||||
options: Array<{ value: string, label: string }>
|
options: Array<{ value: string, label: string }>
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const listboxId = `select-listbox-${Math.random().toString(36).slice(2, 9)}`;
|
const listboxId = $props.id();
|
||||||
|
|
||||||
let isOpen = $state(false);
|
let isOpen = $state(false);
|
||||||
let activeIndex = $state(0);
|
let activeIndex = $state(0);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import Switch from "@/interface/components/Switch.svelte";
|
import Switch from "@/interface/components/Switch.svelte";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||||
import { matchesSearch } from "@/interface/pages/settings/shared";
|
import { matchesSearch } from "@/interface/pages/settings/shared";
|
||||||
|
import type { SettingsList } from "@/interface/types/SettingsProps";
|
||||||
import {
|
import {
|
||||||
DEFAULT_SIDEBAR_BLUR,
|
DEFAULT_SIDEBAR_BLUR,
|
||||||
DEFAULT_SIDEBAR_RADIUS,
|
DEFAULT_SIDEBAR_RADIUS,
|
||||||
@@ -132,7 +133,7 @@
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!transparencyOn) return base;
|
if (!transparencyOn) return base as unknown as SettingsList[];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...base,
|
...base,
|
||||||
@@ -149,7 +150,7 @@
|
|||||||
onChange: (value: number) => (settingsState.sidebarBlur = value),
|
onChange: (value: number) => (settingsState.sidebarBlur = value),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
] as unknown as SettingsList[];
|
||||||
});
|
});
|
||||||
|
|
||||||
const visible = $derived(
|
const visible = $derived(
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
let { groups, selectedId, onselect } = $props<{
|
let { groups, selectedId, onselect }: {
|
||||||
groups: NavGroup[];
|
groups: NavGroup[];
|
||||||
selectedId: string;
|
selectedId: string;
|
||||||
onselect: (id: string) => void;
|
onselect: (id: string) => void;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let trackEl = $state<HTMLElement | null>(null);
|
let trackEl = $state<HTMLElement | null>(null);
|
||||||
let indicatorX = $state(0);
|
let indicatorX = $state(0);
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
const scheduleIndicator = rafThrottle(updateIndicator);
|
const scheduleIndicator = rafThrottle(updateIndicator);
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
selectedId;
|
void selectedId;
|
||||||
groups;
|
void groups;
|
||||||
trackEl;
|
void trackEl;
|
||||||
scheduleIndicator();
|
scheduleIndicator();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
emphasized = false,
|
emphasized = false,
|
||||||
trackId,
|
trackId,
|
||||||
onclick,
|
onclick,
|
||||||
} = $props<{
|
}: {
|
||||||
label: string;
|
label: string;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
nested?: boolean;
|
nested?: boolean;
|
||||||
emphasized?: boolean;
|
emphasized?: boolean;
|
||||||
trackId?: string;
|
trackId?: string;
|
||||||
onclick: () => void;
|
onclick: () => void;
|
||||||
}>();
|
} = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||||
|
|
||||||
let { onClose } = $props<{ onClose: () => void }>();
|
let { onClose }: { onClose: () => void } = $props();
|
||||||
let modalElement: HTMLElement;
|
let modalElement: HTMLElement;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex fixed inset-0 z-[99999] justify-center items-center bg-black/50"
|
class="flex fixed inset-0 z-99999 justify-center items-center bg-black/50"
|
||||||
onclick={(e) => {
|
onclick={(e) => {
|
||||||
if (e.target === e.currentTarget) onClose();
|
if (e.target === e.currentTarget) onClose();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { width, height } = $props<{ width?: string; height?: string }>();
|
let { width, height }: { width?: string; height?: string } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { state = $bindable(), onChange, min = 0, max = 100, step = 1 } = $props<{
|
let { state = $bindable(), onChange, min = 0, max = 100, step = 1 }: {
|
||||||
state: number,
|
state: number,
|
||||||
onChange: (value: number) => void,
|
onChange: (value: number) => void,
|
||||||
min?: number,
|
min?: number,
|
||||||
max?: number,
|
max?: number,
|
||||||
step?: number
|
step?: number
|
||||||
}>();
|
} = $props();
|
||||||
let percentage = $derived(((state - min) / (max - min)) * 100);
|
let percentage = $derived(((state - min) / (max - min)) * 100);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { standalone } from '../utils/standalone.svelte';
|
import { standalone } from '../utils/standalone.svelte';
|
||||||
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
||||||
|
|
||||||
let { state: checked, onChange } = $props<{ state: boolean, onChange: (newState: boolean) => void }>();
|
let { state: checked, onChange }: { state: boolean, onChange: (newState: boolean) => void } = $props();
|
||||||
|
|
||||||
let motionReady = $state(false);
|
let motionReady = $state(false);
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex w-14 p-1 cursor-pointer transition-all duration-150 rounded-full bg-gradient-to-tr select-none shadow-2xl ring-[1px] ring-[#DDDDDD]/30 dark:ring-[#38373D]/30 {checked ? 'to-[#30D259]/80 from-[#30D259] dark:from-[#30D259]/40 dark:to-[#30D259]' : 'dark:from-[#38373D]/50 dark:to-[#38373D] to-[#DDDDDD]/50 from-[#DDDDDD]'}"
|
class="flex w-14 p-1 cursor-pointer transition-all duration-150 rounded-full bg-linear-to-tr select-none shadow-2xl ring-[1px] ring-[#DDDDDD]/30 dark:ring-[#38373D]/30 {checked ? 'to-[#30D259]/80 from-[#30D259] dark:from-[#30D259]/40 dark:to-[#30D259]' : 'dark:from-[#38373D]/50 dark:to-[#38373D] to-[#DDDDDD]/50 from-[#DDDDDD]'}"
|
||||||
onclick={() => onChange(!checked)}
|
onclick={() => onChange(!checked)}
|
||||||
onkeydown={(e) => e.key === "Enter" && onChange(!checked)}
|
onkeydown={(e) => e.key === "Enter" && onChange(!checked)}
|
||||||
role="switch"
|
role="switch"
|
||||||
|
|||||||
@@ -6,15 +6,15 @@
|
|||||||
|
|
||||||
type TabDef = {
|
type TabDef = {
|
||||||
title: string;
|
title: string;
|
||||||
Content?: Component;
|
Content?: Component<any>;
|
||||||
loader?: () => Promise<{ default: Component }>;
|
loader?: () => Promise<{ default: Component<any> }>;
|
||||||
props?: Record<string, unknown>;
|
props?: Record<string, unknown>;
|
||||||
};
|
};
|
||||||
|
|
||||||
let { tabs, activeTab = $bindable(0) } = $props<{
|
let { tabs, activeTab = $bindable(0) }: {
|
||||||
tabs: TabDef[];
|
tabs: TabDef[];
|
||||||
activeTab?: number;
|
activeTab?: number;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const handleMessage = (event: MessageEvent) => {
|
const handleMessage = (event: MessageEvent) => {
|
||||||
@@ -31,14 +31,14 @@
|
|||||||
<div class="top-0 z-10 shrink-0 text-[0.875rem] pb-0.5 mx-4 px-2 tab-width-container" role="tablist">
|
<div class="top-0 z-10 shrink-0 text-[0.875rem] pb-0.5 mx-4 px-2 tab-width-container" role="tablist">
|
||||||
<div class="flex relative">
|
<div class="flex relative">
|
||||||
<div
|
<div
|
||||||
class="absolute top-0 left-0 z-0 h-full bg-gradient-to-tr dark:from-[#38373D]/80 dark:to-[#38373D] from-[#DDDDDD]/80 to-[#DDDDDD] rounded-full opacity-40 tab-width"
|
class="absolute top-0 left-0 z-0 h-full bg-linear-to-tr dark:from-[#38373D]/80 dark:to-[#38373D] from-[#DDDDDD]/80 to-[#DDDDDD] rounded-full opacity-40 tab-width"
|
||||||
style={`width: ${100 / Math.max(1, tabs.length)}%; transform: translateX(${activeTab * 100}%); transition: transform ${fullMotionEffectsEnabled() ? 250 : 0}ms cubic-bezier(0.22, 1, 0.36, 1)`}
|
style={`width: ${100 / Math.max(1, tabs.length)}%; transform: translateX(${activeTab * 100}%); transition: transform ${fullMotionEffectsEnabled() ? 250 : 0}ms cubic-bezier(0.22, 1, 0.36, 1)`}
|
||||||
></div>
|
></div>
|
||||||
{#each tabs as { title }, index}
|
{#each tabs as { title }, index}
|
||||||
<button
|
<button
|
||||||
role="tab"
|
role="tab"
|
||||||
aria-selected={activeTab === index}
|
aria-selected={activeTab === index}
|
||||||
class="relative z-10 flex-1 px-4 py-2 focus-visible:outline-none"
|
class="relative z-10 flex-1 px-4 py-2 focus-visible:outline-hidden"
|
||||||
onclick={() => (activeTab = index)}
|
onclick={() => (activeTab = index)}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
@@ -48,14 +48,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="relative overflow-hidden px-4 flex-1 min-h-0">
|
<div class="relative overflow-hidden px-4 flex-1 min-h-0">
|
||||||
<div
|
<div
|
||||||
class="tab-scroll-fade absolute inset-x-4 top-0 h-3 bg-gradient-to-b from-white/80 dark:from-zinc-800/80 to-transparent pointer-events-none z-[1]"
|
class="tab-scroll-fade absolute inset-x-4 top-0 h-3 bg-linear-to-b from-white/80 dark:from-zinc-800/80 to-transparent pointer-events-none z-1"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
></div>
|
></div>
|
||||||
{#each tabs as tab, index (index)}
|
{#each tabs as tab, index (index)}
|
||||||
{#if activeTab === index}
|
{#if activeTab === index}
|
||||||
<div
|
<div
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
class="focus:outline-none w-full h-full min-h-0 pt-2 overflow-y-auto no-scrollbar pb-6 tab active relative"
|
class="focus:outline-hidden w-full h-full min-h-0 pt-2 overflow-y-auto no-scrollbar pb-6 tab active relative"
|
||||||
>
|
>
|
||||||
{#if tab.loader}
|
{#if tab.loader}
|
||||||
<LazyPanel loader={tab.loader} props={tab.props} />
|
<LazyPanel loader={tab.loader} props={tab.props} />
|
||||||
|
|||||||
@@ -0,0 +1,517 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { untrack } from "svelte";
|
||||||
|
import { slide } from "svelte/transition";
|
||||||
|
import {
|
||||||
|
clamp,
|
||||||
|
colourAt,
|
||||||
|
formatColour,
|
||||||
|
formatStops,
|
||||||
|
formatValue,
|
||||||
|
hsvaToRgba,
|
||||||
|
parseColour,
|
||||||
|
parseValue,
|
||||||
|
rgbaToHex,
|
||||||
|
rgbaToHsva,
|
||||||
|
type ColourValue,
|
||||||
|
type GradientStop,
|
||||||
|
type Hsva,
|
||||||
|
type Rgba,
|
||||||
|
} from "./colourValue";
|
||||||
|
|
||||||
|
type EyeDropperApi = { open: () => Promise<{ sRGBHex: string }> };
|
||||||
|
|
||||||
|
let {
|
||||||
|
value,
|
||||||
|
onchange,
|
||||||
|
presets = [],
|
||||||
|
}: {
|
||||||
|
value: string;
|
||||||
|
onchange: (value: string) => void;
|
||||||
|
presets?: string[];
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
const MODES = [
|
||||||
|
{ kind: "solid", label: "Solid" },
|
||||||
|
{ kind: "linear", label: "Linear" },
|
||||||
|
{ kind: "radial", label: "Radial" },
|
||||||
|
] as const;
|
||||||
|
const CHECKERBOARD = "repeating-conic-gradient(#d4d4d8 0% 25%, #ffffff 0% 50%) 50% / 8px 8px";
|
||||||
|
const EyeDropper = (globalThis as { EyeDropper?: new () => EyeDropperApi }).EyeDropper;
|
||||||
|
|
||||||
|
const initial = untrack(() => parseValue(value));
|
||||||
|
let model = $state<ColourValue>(initial);
|
||||||
|
let selected = $state(0);
|
||||||
|
let hsva = $state<Hsva>(rgbaToHsva(colourOf(initial, 0)));
|
||||||
|
let lastAngle = initial.kind === "linear" ? initial.angle : 90;
|
||||||
|
let lastEmitted = untrack(() => value);
|
||||||
|
let area = $state<HTMLDivElement>();
|
||||||
|
let bar = $state<HTMLDivElement>();
|
||||||
|
let dragging = $state<number | null>(null);
|
||||||
|
|
||||||
|
const active = $derived(colourOf(model, selected));
|
||||||
|
const hex = $derived(rgbaToHex(active));
|
||||||
|
const stops = $derived(model.kind === "solid" ? [] : model.stops);
|
||||||
|
const shownPresets = $derived([...new Set(presets)].slice(0, 18));
|
||||||
|
const modeIndex = $derived(MODES.findIndex((mode) => mode.kind === model.kind));
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (value === lastEmitted) return;
|
||||||
|
lastEmitted = value;
|
||||||
|
load(parseValue(value));
|
||||||
|
});
|
||||||
|
|
||||||
|
function asLayer(css: string): string {
|
||||||
|
return /gradient\(/i.test(css) ? css : `linear-gradient(${css}, ${css})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function colourOf(m: ColourValue, index: number): Rgba {
|
||||||
|
return m.kind === "solid" ? m.colour : m.stops[Math.min(index, m.stops.length - 1)].colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
function load(next: ColourValue) {
|
||||||
|
if (next.kind === "linear") lastAngle = next.angle;
|
||||||
|
model = next;
|
||||||
|
selected = 0;
|
||||||
|
hsva = rgbaToHsva(colourOf(next, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
function commit(next: ColourValue) {
|
||||||
|
model = next;
|
||||||
|
lastEmitted = formatValue(next);
|
||||||
|
onchange(lastEmitted);
|
||||||
|
}
|
||||||
|
|
||||||
|
function snapshot(): ColourValue {
|
||||||
|
return $state.snapshot(model) as ColourValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function withStops(m: ColourValue, update: (stops: GradientStop[]) => GradientStop[]): ColourValue {
|
||||||
|
return m.kind === "solid" ? m : { ...m, stops: update(m.stops) };
|
||||||
|
}
|
||||||
|
|
||||||
|
function setActiveColour(colour: Rgba) {
|
||||||
|
const m = snapshot();
|
||||||
|
commit(
|
||||||
|
m.kind === "solid"
|
||||||
|
? { kind: "solid", colour }
|
||||||
|
: withStops(m, (all) => all.map((stop, i) => (i === selected ? { ...stop, colour } : stop))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateHsva(next: Partial<Hsva>) {
|
||||||
|
hsva = { ...hsva, ...next };
|
||||||
|
setActiveColour(hsvaToRgba(hsva));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRgba(colour: Rgba) {
|
||||||
|
hsva = rgbaToHsva(colour);
|
||||||
|
setActiveColour(colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectStop(index: number) {
|
||||||
|
selected = index;
|
||||||
|
hsva = rgbaToHsva(colourOf(model, index));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMode(kind: ColourValue["kind"]) {
|
||||||
|
const m = snapshot();
|
||||||
|
if (m.kind === kind) return;
|
||||||
|
const colour = colourOf(m, selected);
|
||||||
|
const base = rgbaToHsva(colour);
|
||||||
|
const gradientStops =
|
||||||
|
m.kind === "solid"
|
||||||
|
? [
|
||||||
|
{ colour, position: 0 },
|
||||||
|
{ colour: hsvaToRgba({ ...base, h: (base.h + 60) % 360 }), position: 100 },
|
||||||
|
]
|
||||||
|
: m.stops;
|
||||||
|
const next: ColourValue =
|
||||||
|
kind === "solid"
|
||||||
|
? { kind, colour }
|
||||||
|
: kind === "linear"
|
||||||
|
? { kind, angle: lastAngle, stops: gradientStops }
|
||||||
|
: { kind, stops: gradientStops };
|
||||||
|
load(next);
|
||||||
|
commit(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickArea(event: PointerEvent) {
|
||||||
|
const rect = area!.getBoundingClientRect();
|
||||||
|
updateHsva({
|
||||||
|
s: clamp((event.clientX - rect.left) / rect.width, 0, 1) * 100,
|
||||||
|
v: (1 - clamp((event.clientY - rect.top) / rect.height, 0, 1)) * 100,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function areaKeys(event: KeyboardEvent) {
|
||||||
|
const step = event.shiftKey ? 10 : 1;
|
||||||
|
const moves: Record<string, Partial<Hsva>> = {
|
||||||
|
ArrowLeft: { s: clamp(hsva.s - step, 0, 100) },
|
||||||
|
ArrowRight: { s: clamp(hsva.s + step, 0, 100) },
|
||||||
|
ArrowDown: { v: clamp(hsva.v - step, 0, 100) },
|
||||||
|
ArrowUp: { v: clamp(hsva.v + step, 0, 100) },
|
||||||
|
};
|
||||||
|
if (!moves[event.key]) return;
|
||||||
|
event.preventDefault();
|
||||||
|
updateHsva(moves[event.key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function barPosition(event: PointerEvent): number {
|
||||||
|
const rect = bar!.getBoundingClientRect();
|
||||||
|
return Math.round(clamp((event.clientX - rect.left) / rect.width, 0, 1) * 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveStop(index: number, position: number) {
|
||||||
|
commit(withStops(snapshot(), (all) => all.map((stop, i) => (i === index ? { ...stop, position } : stop))));
|
||||||
|
}
|
||||||
|
|
||||||
|
function startStopDrag(event: PointerEvent, index: number) {
|
||||||
|
event.stopPropagation();
|
||||||
|
selectStop(index);
|
||||||
|
bar!.setPointerCapture(event.pointerId);
|
||||||
|
dragging = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addStop(event: PointerEvent) {
|
||||||
|
const m = snapshot();
|
||||||
|
if (m.kind === "solid") return;
|
||||||
|
const position = barPosition(event);
|
||||||
|
const colour = colourAt(m.stops, position);
|
||||||
|
commit(withStops(m, (all) => [...all, { colour, position }]));
|
||||||
|
selectStop(m.stops.length);
|
||||||
|
bar!.setPointerCapture(event.pointerId);
|
||||||
|
dragging = m.stops.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeStop(index: number) {
|
||||||
|
const m = snapshot();
|
||||||
|
if (m.kind === "solid" || m.stops.length <= 2) return;
|
||||||
|
commit(withStops(m, (all) => all.filter((_, i) => i !== index)));
|
||||||
|
selectStop(Math.min(selected, m.stops.length - 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopKeys(event: KeyboardEvent, index: number) {
|
||||||
|
const step = event.shiftKey ? 10 : 1;
|
||||||
|
const position = stops[index].position;
|
||||||
|
if (event.key === "ArrowLeft") moveStop(index, clamp(position - step, 0, 100));
|
||||||
|
else if (event.key === "ArrowRight") moveStop(index, clamp(position + step, 0, 100));
|
||||||
|
else if (event.key === "Delete" || event.key === "Backspace") removeStop(index);
|
||||||
|
else return;
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAngle(angle: number) {
|
||||||
|
const m = snapshot();
|
||||||
|
if (m.kind !== "linear") return;
|
||||||
|
lastAngle = clamp(Math.round(angle), 0, 360);
|
||||||
|
commit({ ...m, angle: lastAngle });
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHex(input: string, final = false) {
|
||||||
|
const digits = input.trim().replace(/^#/, "");
|
||||||
|
const complete = /^[0-9a-f]{6}$/i.test(digits) || (final && /^[0-9a-f]{3}$/i.test(digits));
|
||||||
|
const parsed = complete ? parseColour(`#${digits}`) : null;
|
||||||
|
if (parsed) setRgba({ ...parsed, a: active.a });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pickFromScreen() {
|
||||||
|
if (!EyeDropper) return;
|
||||||
|
try {
|
||||||
|
const { sRGBHex } = await new EyeDropper().open();
|
||||||
|
const parsed = parseColour(sRGBHex);
|
||||||
|
if (parsed) setRgba({ ...parsed, a: active.a });
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyPreset(preset: string) {
|
||||||
|
const next = parseValue(preset);
|
||||||
|
load(next);
|
||||||
|
commit(next);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-3 w-72 max-w-full text-zinc-900 select-none dark:text-white">
|
||||||
|
<div>
|
||||||
|
<div class="grid relative grid-cols-3 p-0.5 rounded-lg bg-zinc-100 dark:bg-zinc-700/70" role="radiogroup" aria-label="Fill type">
|
||||||
|
<div
|
||||||
|
class="absolute left-0.5 inset-y-0.5 w-[calc((100%-0.25rem)/3)] rounded-md bg-white shadow-sm transition-transform duration-200 ease-out motion-reduce:transition-none dark:bg-zinc-600"
|
||||||
|
style="transform: translateX({modeIndex * 100}%);"
|
||||||
|
aria-hidden="true"
|
||||||
|
></div>
|
||||||
|
{#each MODES as mode (mode.kind)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
role="radio"
|
||||||
|
aria-checked={model.kind === mode.kind}
|
||||||
|
class="relative py-1 text-xs font-medium rounded-md transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-zinc-900 dark:focus-visible:outline-white {model.kind === mode.kind
|
||||||
|
? 'text-zinc-900 dark:text-white'
|
||||||
|
: 'text-zinc-500 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white'}"
|
||||||
|
onclick={() => setMode(mode.kind)}
|
||||||
|
>
|
||||||
|
{mode.label}
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if model.kind !== "solid"}
|
||||||
|
<div class="flex gap-2 items-center pt-3" transition:slide={{ duration: 180 }}>
|
||||||
|
<div
|
||||||
|
class="flex-1 px-2.5 py-1.5 cursor-copy touch-none"
|
||||||
|
role="group"
|
||||||
|
aria-label="Gradient stops"
|
||||||
|
onpointerdown={addStop}
|
||||||
|
onpointermove={(event) => {
|
||||||
|
if (dragging !== null) moveStop(dragging, barPosition(event));
|
||||||
|
}}
|
||||||
|
onpointerup={() => (dragging = null)}
|
||||||
|
onpointercancel={() => (dragging = null)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
bind:this={bar}
|
||||||
|
class="relative h-3 rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/10"
|
||||||
|
style="background: linear-gradient(to right, {formatStops(stops)}), {CHECKERBOARD};"
|
||||||
|
>
|
||||||
|
{#each stops as stop, index (index)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="absolute top-1/2 handle cursor-grab active:cursor-grabbing {index === selected ? 'handle-selected' : ''}"
|
||||||
|
style="left: {stop.position}%; --swatch: {formatColour(stop.colour)};"
|
||||||
|
aria-label="Colour stop at {Math.round(stop.position)}%"
|
||||||
|
aria-pressed={index === selected}
|
||||||
|
onpointerdown={(event) => startStopDrag(event, index)}
|
||||||
|
onkeydown={(event) => stopKeys(event, index)}
|
||||||
|
></button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#if model.kind === "linear"}
|
||||||
|
<label class="flex shrink-0 items-center px-2 w-14 h-7 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
max="360"
|
||||||
|
class="p-0 w-full min-w-0 text-xs text-right bg-transparent border-0 outline-none select-text picker-number focus:ring-0"
|
||||||
|
aria-label="Gradient angle in degrees"
|
||||||
|
value={model.angle}
|
||||||
|
oninput={(event) => {
|
||||||
|
if (event.currentTarget.value !== "") setAngle(Number(event.currentTarget.value));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span class="text-zinc-500 dark:text-zinc-400">°</span>
|
||||||
|
</label>
|
||||||
|
{/if}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="grid shrink-0 place-items-center rounded-md transition size-7 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 disabled:opacity-30 disabled:pointer-events-none focus-visible:outline-2 focus-visible:outline-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white dark:focus-visible:outline-white"
|
||||||
|
aria-label="Remove selected stop"
|
||||||
|
disabled={stops.length <= 2}
|
||||||
|
onclick={() => removeStop(selected)}
|
||||||
|
>
|
||||||
|
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||||
|
<path d="M3 6h18M8 6V4h8v2m-9 0 1 14h8l1-14" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
bind:this={area}
|
||||||
|
class="relative h-40 rounded-lg cursor-crosshair touch-none outline-none ring-1 ring-inset ring-black/10 focus-visible:ring-2 focus-visible:ring-zinc-900 dark:ring-white/10 dark:focus-visible:ring-white"
|
||||||
|
style="background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl({hsva.h} 100% 50%));"
|
||||||
|
role="slider"
|
||||||
|
tabindex="0"
|
||||||
|
aria-label="Saturation and brightness"
|
||||||
|
aria-valuenow={Math.round(hsva.s)}
|
||||||
|
aria-valuetext="Saturation {Math.round(hsva.s)}%, brightness {Math.round(hsva.v)}%"
|
||||||
|
onpointerdown={(event) => {
|
||||||
|
area!.setPointerCapture(event.pointerId);
|
||||||
|
pickArea(event);
|
||||||
|
}}
|
||||||
|
onpointermove={(event) => {
|
||||||
|
if (area!.hasPointerCapture(event.pointerId)) pickArea(event);
|
||||||
|
}}
|
||||||
|
onkeydown={areaKeys}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="absolute pointer-events-none handle"
|
||||||
|
style="left: {hsva.s}%; top: {100 - hsva.v}%; --swatch: {hex};"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-3 items-center">
|
||||||
|
{#if EyeDropper}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="grid shrink-0 place-items-center rounded-md transition size-8 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 focus-visible:outline-2 focus-visible:outline-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white dark:focus-visible:outline-white"
|
||||||
|
aria-label="Pick a colour from the screen"
|
||||||
|
onclick={pickFromScreen}
|
||||||
|
>
|
||||||
|
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||||
|
<path d="m2 22 1-1h3l9-9M3 21v-3l9-9m3-3 3.5-3.5a2.1 2.1 0 0 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
<div class="flex flex-col flex-1 gap-3">
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
min="0"
|
||||||
|
max="359"
|
||||||
|
class="picker-track"
|
||||||
|
style="background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); --swatch: hsl({hsva.h} 100% 50%);"
|
||||||
|
aria-label="Hue"
|
||||||
|
value={Math.round(hsva.h)}
|
||||||
|
oninput={(event) => updateHsva({ h: Number(event.currentTarget.value) })}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
min="0"
|
||||||
|
max="100"
|
||||||
|
class="picker-track"
|
||||||
|
style="background: linear-gradient(to right, transparent, {hex}), {CHECKERBOARD}; --swatch: {formatColour(active)};"
|
||||||
|
aria-label="Opacity"
|
||||||
|
value={Math.round(hsva.a * 100)}
|
||||||
|
oninput={(event) => updateHsva({ a: Number(event.currentTarget.value) / 100 })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="shrink-0 rounded-md ring-1 ring-inset ring-black/10 size-8 dark:ring-white/10"
|
||||||
|
style="background: {asLayer(formatValue(model))}, {CHECKERBOARD};"
|
||||||
|
aria-hidden="true"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<label class="flex flex-1 gap-1.5 items-center px-2.5 min-w-0 h-8 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70">
|
||||||
|
<span class="text-zinc-500 dark:text-zinc-400">#</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 p-0 min-w-0 font-mono text-xs uppercase bg-transparent border-0 outline-none select-text focus:ring-0"
|
||||||
|
aria-label="Hex colour"
|
||||||
|
value={hex.slice(1)}
|
||||||
|
spellcheck="false"
|
||||||
|
autocomplete="off"
|
||||||
|
maxlength="7"
|
||||||
|
oninput={(event) => setHex(event.currentTarget.value)}
|
||||||
|
onkeydown={(event) => {
|
||||||
|
if (event.key === "Enter") event.currentTarget.blur();
|
||||||
|
}}
|
||||||
|
onblur={(event) => {
|
||||||
|
setHex(event.currentTarget.value, true);
|
||||||
|
event.currentTarget.value = hex.slice(1);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label class="flex shrink-0 items-center px-2.5 w-16 h-8 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
max="100"
|
||||||
|
class="p-0 w-full min-w-0 text-xs text-right bg-transparent border-0 outline-none select-text picker-number focus:ring-0"
|
||||||
|
aria-label="Opacity percent"
|
||||||
|
value={Math.round(active.a * 100)}
|
||||||
|
oninput={(event) => {
|
||||||
|
if (event.currentTarget.value !== "") updateHsva({ a: clamp(Number(event.currentTarget.value), 0, 100) / 100 });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span class="text-zinc-500 dark:text-zinc-400">%</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if shownPresets.length}
|
||||||
|
<div class="grid grid-cols-9 gap-1.5 pt-3 border-t border-zinc-100 dark:border-zinc-700">
|
||||||
|
{#each shownPresets as preset (preset)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="rounded-md ring-1 ring-inset transition aspect-square ring-black/10 hover:scale-110 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-zinc-900 dark:ring-white/10 dark:focus-visible:outline-white"
|
||||||
|
style="background: {asLayer(preset)}, {CHECKERBOARD};"
|
||||||
|
aria-label="Apply preset {preset}"
|
||||||
|
onclick={() => applyPreset(preset)}
|
||||||
|
></button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.handle {
|
||||||
|
width: 1.125rem;
|
||||||
|
height: 1.125rem;
|
||||||
|
border-radius: 9999px;
|
||||||
|
border: 2px solid white;
|
||||||
|
background: linear-gradient(var(--swatch), var(--swatch)),
|
||||||
|
repeating-conic-gradient(#d4d4d8 0% 25%, #ffffff 0% 50%) 50% / 6px 6px;
|
||||||
|
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
transition: transform 120ms ease, box-shadow 120ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.handle:focus-visible {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 2px rgb(24 24 27), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.dark) .handle:focus-visible {
|
||||||
|
box-shadow: 0 0 0 2px white, 0 1px 3px rgb(0 0 0 / 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.handle-selected {
|
||||||
|
z-index: 1;
|
||||||
|
transform: translate(-50%, -50%) scale(1.2);
|
||||||
|
box-shadow: 0 0 0 2px rgb(24 24 27 / 0.85), 0 2px 6px rgb(0 0 0 / 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.dark) .handle-selected {
|
||||||
|
box-shadow: 0 0 0 2px rgb(255 255 255 / 0.9), 0 2px 6px rgb(0 0 0 / 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-number {
|
||||||
|
appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-number::-webkit-inner-spin-button,
|
||||||
|
.picker-number::-webkit-outer-spin-button {
|
||||||
|
appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-track {
|
||||||
|
appearance: none;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 0.75rem;
|
||||||
|
border-radius: 9999px;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-track:focus-visible {
|
||||||
|
outline: 2px solid rgb(24 24 27);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.dark) .picker-track:focus-visible {
|
||||||
|
outline-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-track::-webkit-slider-thumb {
|
||||||
|
appearance: none;
|
||||||
|
width: 1.125rem;
|
||||||
|
height: 1.125rem;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 9999px;
|
||||||
|
background: var(--swatch);
|
||||||
|
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-track::-moz-range-thumb {
|
||||||
|
width: 1.125rem;
|
||||||
|
height: 1.125rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 9999px;
|
||||||
|
background: var(--swatch);
|
||||||
|
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loaded 100 of 539 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user