mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
fix: resolve all type errors and add typecheck to ci
This commit is contained in:
99 files changed
+377
-334
No files matched your search
@@ -22,6 +22,9 @@ jobs:
|
|||||||
- name: Run lint
|
- name: Run lint
|
||||||
uses: ./.github/actions/run-lint
|
uses: ./.github/actions/run-lint
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: npm run typecheck
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
defaults:
|
defaults:
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ The [architecture guide](https://docs.betterseqta.org/architecture/) goes into m
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run lint
|
npm run lint
|
||||||
|
npm run typecheck
|
||||||
npm test
|
npm test
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|||||||
Generated
+97
@@ -46,6 +46,7 @@
|
|||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/postcss": "^4.3.3",
|
"@tailwindcss/postcss": "^4.3.3",
|
||||||
"@tsconfig/svelte": "^5.0.8",
|
"@tsconfig/svelte": "^5.0.8",
|
||||||
|
"@types/canvas-confetti": "^1.9.0",
|
||||||
"@types/chrome": "^0.3.7",
|
"@types/chrome": "^0.3.7",
|
||||||
"@types/d3-scale": "^4.0.9",
|
"@types/d3-scale": "^4.0.9",
|
||||||
"@types/d3-shape": "^3.2.0",
|
"@types/d3-shape": "^3.2.0",
|
||||||
@@ -65,6 +66,7 @@
|
|||||||
"prettier": "^3.9.10",
|
"prettier": "^3.9.10",
|
||||||
"publish-browser-extension": "^6.2.0",
|
"publish-browser-extension": "^6.2.0",
|
||||||
"sass": "^1.107.1",
|
"sass": "^1.107.1",
|
||||||
|
"svelte-check": "^4.7.8",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^4.3.3",
|
||||||
"ts-jest": "^29.4.15",
|
"ts-jest": "^29.4.15",
|
||||||
"typescript": "~6.0.3",
|
"typescript": "~6.0.3",
|
||||||
@@ -3742,6 +3744,16 @@
|
|||||||
"acorn": "^8.9.0"
|
"acorn": "^8.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@sveltejs/load-config": {
|
||||||
|
"version": "0.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sveltejs/load-config/-/load-config-0.2.3.tgz",
|
||||||
|
"integrity": "sha512-VT3qmUb8pRV2QrZjd8iAmtg8lf4W0TIjZbvXtz5MKei/q96teWZgGJyyidJzOjzZzvdq616eSRVeMYIQChUTAQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sveltejs/vite-plugin-svelte": {
|
"node_modules/@sveltejs/vite-plugin-svelte": {
|
||||||
"version": "7.3.1",
|
"version": "7.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.3.1.tgz",
|
||||||
@@ -4130,6 +4142,13 @@
|
|||||||
"@babel/types": "^7.28.2"
|
"@babel/types": "^7.28.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/canvas-confetti": {
|
||||||
|
"version": "1.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/canvas-confetti/-/canvas-confetti-1.9.0.tgz",
|
||||||
|
"integrity": "sha512-aBGj/dULrimR1XDZLtG9JwxX1b4HPRF6CX9Yfwh3NvstZEm1ZL7RBnel4keCPSqs1ANRu1u2Aoz9R+VmtjYuTg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/chrome": {
|
"node_modules/@types/chrome": {
|
||||||
"version": "0.3.7",
|
"version": "0.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.3.7.tgz",
|
||||||
@@ -8911,6 +8930,16 @@
|
|||||||
"integrity": "sha512-woO0/Nb7ys75f94fjvQi/6leiHGvZUYkeHUPEZ3vxsV+9OpEVhkxp01x8MlRwX0zt31EqgXsKDAoBoJLC148Tw==",
|
"integrity": "sha512-woO0/Nb7ys75f94fjvQi/6leiHGvZUYkeHUPEZ3vxsV+9OpEVhkxp01x8MlRwX0zt31EqgXsKDAoBoJLC148Tw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/mri": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
@@ -9900,6 +9929,19 @@
|
|||||||
"tslib": "^2.1.0"
|
"tslib": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sade": {
|
||||||
|
"version": "1.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
|
||||||
|
"integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mri": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/safer-buffer": {
|
"node_modules/safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
@@ -10255,6 +10297,61 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/svelte-check": {
|
||||||
|
"version": "4.7.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.7.8.tgz",
|
||||||
|
"integrity": "sha512-laZ49GFHZ3b0z2PWinJWL0syehc/PTR8aHaUaTiBkWJ+4Y38nhxjmXsSz7CbGa3VdKopViVbrBH3bGNqIAI0bQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/trace-mapping": "^0.3.25",
|
||||||
|
"@sveltejs/load-config": "^0.2.3",
|
||||||
|
"chokidar": "^4.0.1",
|
||||||
|
"fdir": "^6.2.0",
|
||||||
|
"picocolors": "^1.0.0",
|
||||||
|
"sade": "^1.7.4"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"svelte-check": "bin/svelte-check"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"svelte": "^4.0.0 || ^5.0.0-next.0",
|
||||||
|
"typescript": "^5.0.0 || ^6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/svelte-check/node_modules/chokidar": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"readdirp": "^4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.16.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/svelte-check/node_modules/readdirp": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.18.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/symbol-tree": {
|
"node_modules/symbol-tree": {
|
||||||
"version": "3.2.4",
|
"version": "3.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"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",
|
||||||
"lint": "eslint \"src/**/*.{js,ts}\"",
|
"lint": "eslint \"src/**/*.{js,ts}\"",
|
||||||
|
"typecheck": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings",
|
||||||
"test": "npm run test:unit",
|
"test": "npm run test:unit",
|
||||||
"test:unit": "cross-env NODE_OPTIONS=--no-experimental-webstorage 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",
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/postcss": "^4.3.3",
|
"@tailwindcss/postcss": "^4.3.3",
|
||||||
"@tsconfig/svelte": "^5.0.8",
|
"@tsconfig/svelte": "^5.0.8",
|
||||||
|
"@types/canvas-confetti": "^1.9.0",
|
||||||
"@types/chrome": "^0.3.7",
|
"@types/chrome": "^0.3.7",
|
||||||
"@types/d3-scale": "^4.0.9",
|
"@types/d3-scale": "^4.0.9",
|
||||||
"@types/d3-shape": "^3.2.0",
|
"@types/d3-shape": "^3.2.0",
|
||||||
@@ -62,6 +64,7 @@
|
|||||||
"prettier": "^3.9.10",
|
"prettier": "^3.9.10",
|
||||||
"publish-browser-extension": "^6.2.0",
|
"publish-browser-extension": "^6.2.0",
|
||||||
"sass": "^1.107.1",
|
"sass": "^1.107.1",
|
||||||
|
"svelte-check": "^4.7.8",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^4.3.3",
|
||||||
"ts-jest": "^29.4.15",
|
"ts-jest": "^29.4.15",
|
||||||
"typescript": "~6.0.3",
|
"typescript": "~6.0.3",
|
||||||
|
|||||||
+41
-44
@@ -52,10 +52,7 @@ function reloadSeqtaPages() {
|
|||||||
const result = browser.tabs.query({});
|
const result = browser.tabs.query({});
|
||||||
function open(tabs: any) {
|
function open(tabs: any) {
|
||||||
for (let tab of tabs) {
|
for (let 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +101,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();
|
||||||
@@ -120,7 +117,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}`,
|
||||||
);
|
);
|
||||||
@@ -177,13 +177,12 @@ function isTrustedSender(sender?: chrome.runtime.MessageSender): boolean {
|
|||||||
|
|
||||||
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 {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -249,7 +248,8 @@ async function parseJsonResponse(r: Response): Promise<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudReserveClient(request: any, sendResponse: MessageSender): boolean {
|
function handleCloudReserveClient(request: any, sendResponse: MessageSender): boolean {
|
||||||
const redirect_uri = request.redirect_uri ?? "https://accounts.betterseqta.org/auth/bsplus/callback";
|
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" },
|
||||||
@@ -287,7 +287,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", {
|
||||||
@@ -313,19 +313,22 @@ function handleCloudStartLogin(request: any, sendResponse: MessageSender): boole
|
|||||||
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);
|
||||||
@@ -394,7 +397,7 @@ function handleCloudRefresh(request: any, sendResponse: MessageSender): boolean
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudSettingsUpload(
|
function handleCloudSettingsUpload(
|
||||||
request: any,
|
_request: unknown,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
sender?: chrome.runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
@@ -427,7 +430,7 @@ function handleCloudSettingsUpload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudSettingsDownload(
|
function handleCloudSettingsDownload(
|
||||||
request: any,
|
_request: unknown,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
sender?: chrome.runtime.MessageSender,
|
sender?: chrome.runtime.MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
@@ -489,7 +492,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?: chrome.runtime.MessageSender): boolean | void;
|
(
|
||||||
|
request: any,
|
||||||
|
sendResponse: MessageSender,
|
||||||
|
sender?: chrome.runtime.MessageSender,
|
||||||
|
): boolean | void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function isSeqtaOrigin(origin: string): boolean {
|
function isSeqtaOrigin(origin: string): boolean {
|
||||||
@@ -585,7 +592,11 @@ const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
|||||||
requestCloudSettingsDebouncedUpload();
|
requestCloudSettingsDebouncedUpload();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
getSeqtaSession: (req: { baseUrl?: string }, sendResponse: MessageSender, sender?: chrome.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;
|
||||||
@@ -612,7 +623,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);
|
||||||
@@ -651,9 +663,7 @@ function SetStorageValue(object: SettingsState) {
|
|||||||
const GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY = "plugin.global-search.settings";
|
const GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY = "plugin.global-search.settings";
|
||||||
const GLOBAL_SEARCH_MIGRATION_VERSION = "3.6.5";
|
const GLOBAL_SEARCH_MIGRATION_VERSION = "3.6.5";
|
||||||
|
|
||||||
async function migrateGlobalSearchDefaultsFor365Upgrade(
|
async function migrateGlobalSearchDefaultsFor365Upgrade(previousVersion: string): Promise<void> {
|
||||||
previousVersion: string,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
try {
|
||||||
const currRaw = browser.runtime.getManifest().version;
|
const currRaw = browser.runtime.getManifest().version;
|
||||||
const prev = semver.coerce(previousVersion);
|
const prev = semver.coerce(previousVersion);
|
||||||
@@ -668,10 +678,7 @@ async function migrateGlobalSearchDefaultsFor365Upgrade(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const got = await browser.storage.local.get(GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY);
|
const got = await browser.storage.local.get(GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY);
|
||||||
const existing = (got[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY] ?? {}) as Record<
|
const existing = (got[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY] ?? {}) as Record<string, unknown>;
|
||||||
string,
|
|
||||||
unknown
|
|
||||||
>;
|
|
||||||
|
|
||||||
await browser.storage.local.set({
|
await browser.storage.local.set({
|
||||||
[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY]: {
|
[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY]: {
|
||||||
@@ -694,9 +701,7 @@ async function migrateGlobalSearchDefaultsFor365Upgrade(
|
|||||||
/** One-time reset for 3.6.6: re-enable Theme of the Month for existing users. */
|
/** 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";
|
const THEME_OF_THE_MONTH_RESET_VERSION = "3.6.6";
|
||||||
|
|
||||||
async function resetThemeOfTheMonthDisabledFor366Upgrade(
|
async function resetThemeOfTheMonthDisabledFor366Upgrade(previousVersion: string): Promise<void> {
|
||||||
previousVersion: string,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
try {
|
||||||
const currRaw = browser.runtime.getManifest().version;
|
const currRaw = browser.runtime.getManifest().version;
|
||||||
const prev = semver.coerce(previousVersion);
|
const prev = semver.coerce(previousVersion);
|
||||||
@@ -719,19 +724,14 @@ async function resetThemeOfTheMonthDisabledFor366Upgrade(
|
|||||||
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RESET_VERSION}: Theme of the Month re-enabled (from ${previousVersion}).`,
|
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RESET_VERSION}: Theme of the Month re-enabled (from ${previousVersion}).`,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(
|
console.warn("[BetterSEQTA+] Theme of the Month 3.6.6 reset migration failed:", e);
|
||||||
"[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. */
|
/** 3.7.0: Close no longer marks entries seen — clear legacy dismissal keys. */
|
||||||
const THEME_OF_THE_MONTH_RELOAD_VERSION = "3.7.0";
|
const THEME_OF_THE_MONTH_RELOAD_VERSION = "3.7.0";
|
||||||
|
|
||||||
async function resetThemeOfTheMonthDismissalFor370Upgrade(
|
async function resetThemeOfTheMonthDismissalFor370Upgrade(previousVersion: string): Promise<void> {
|
||||||
previousVersion: string,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
try {
|
||||||
const currRaw = browser.runtime.getManifest().version;
|
const currRaw = browser.runtime.getManifest().version;
|
||||||
const prev = semver.coerce(previousVersion);
|
const prev = semver.coerce(previousVersion);
|
||||||
@@ -754,10 +754,7 @@ async function resetThemeOfTheMonthDismissalFor370Upgrade(
|
|||||||
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RELOAD_VERSION}: Theme of the Month shows again until dismissed for the month (from ${previousVersion}).`,
|
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RELOAD_VERSION}: Theme of the Month shows again until dismissed for the month (from ${previousVersion}).`,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(
|
console.warn("[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:", e);
|
||||||
"[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:",
|
|
||||||
e,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ type StoredTokens = {
|
|||||||
expiresAt?: number;
|
expiresAt?: number;
|
||||||
lastSyncAt?: number;
|
lastSyncAt?: number;
|
||||||
lastSyncOrigin?: string;
|
lastSyncOrigin?: string;
|
||||||
|
calendarId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type OAuthTabFlowOptions = {
|
type OAuthTabFlowOptions = {
|
||||||
|
|||||||
@@ -287,8 +287,9 @@ export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
|||||||
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 })
|
||||||
@@ -300,10 +301,11 @@ export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchRemoteThemePackage(
|
function handleFetchRemoteThemePackage(
|
||||||
req: { packageId?: string },
|
req: unknown,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
const packageId = typeof req.packageId === "string" ? req.packageId.trim() : "";
|
const { packageId: rawPackageId } = req as { packageId?: unknown };
|
||||||
|
const packageId = typeof rawPackageId === "string" ? rawPackageId.trim() : "";
|
||||||
if (!packageId) {
|
if (!packageId) {
|
||||||
sendResponse({ error: "Missing packageId" });
|
sendResponse({ error: "Missing packageId" });
|
||||||
return false;
|
return false;
|
||||||
@@ -340,10 +342,11 @@ export function createRemoteConfigHandlers(apiBase: () => string): Record<
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleFetchRemoteThemePackageUrl(
|
function handleFetchRemoteThemePackageUrl(
|
||||||
req: { url?: string },
|
req: unknown,
|
||||||
sendResponse: MessageSender,
|
sendResponse: MessageSender,
|
||||||
): boolean {
|
): boolean {
|
||||||
const url = typeof req.url === "string" ? req.url.trim() : "";
|
const { url: rawUrl } = req as { url?: unknown };
|
||||||
|
const url = typeof rawUrl === "string" ? rawUrl.trim() : "";
|
||||||
if (!url || !isAllowedFetchUrl(url)) {
|
if (!url || !isAllowedFetchUrl(url)) {
|
||||||
sendResponse({ error: "URL not allowed" });
|
sendResponse({ error: "URL not allowed" });
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
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);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
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 = [
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
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 = $derived<"send" | "status">(
|
let tab = $derived<"send" | "status">(
|
||||||
typeof initialFeedbackId === "string" && initialFeedbackId ? "status" : "send",
|
typeof initialFeedbackId === "string" && initialFeedbackId ? "status" : "send",
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
@@ -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,8 +1,8 @@
|
|||||||
<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
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openGeneralSettings() {
|
function openGeneralSettings() {
|
||||||
requestSettingsDestination({ section: "general" });
|
requestSettingsDestination({ page: "settings", section: "general" });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<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 = $props.id();
|
const listboxId = $props.id();
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
|
|||||||
@@ -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) => {
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
const themeManager = ThemeManager.getInstance();
|
const themeManager = ThemeManager.getInstance();
|
||||||
|
|
||||||
type Background = { id: string; category: string; type: string; lowResUrl: string; highResUrl: string; name: string; description: string; featured?: boolean };
|
type Background = { id: string; category: string; type: string; lowResUrl: string; highResUrl: string; name: string; description: string; featured?: boolean };
|
||||||
let { searchTerm, selectedCategory, onCategoriesChange } = $props<{
|
let { searchTerm, selectedCategory, onCategoriesChange }: {
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
selectedCategory: string;
|
selectedCategory: string;
|
||||||
onCategoriesChange: (categories: string[]) => void;
|
onCategoriesChange: (categories: string[]) => void;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let backgrounds = $state<Background[]>([]);
|
let backgrounds = $state<Background[]>([]);
|
||||||
let error = $state<string | null>(null);
|
let error = $state<string | null>(null);
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||||
|
|
||||||
let { alwaysShowUserName = false, onClick = undefined, compact = false } = $props<{
|
let { alwaysShowUserName = false, onClick = undefined, compact = false }: {
|
||||||
alwaysShowUserName?: boolean;
|
alwaysShowUserName?: boolean;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let cloudState = $state(cloudAuth.state);
|
let cloudState = $state(cloudAuth.state);
|
||||||
let open = $state(false);
|
let open = $state(false);
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
||||||
import Autoplay from 'embla-carousel-autoplay';
|
import Autoplay from 'embla-carousel-autoplay';
|
||||||
|
|
||||||
let { slides, setDisplayTheme } = $props<{
|
let { slides, setDisplayTheme }: {
|
||||||
slides: ThemeCoverSlide[];
|
slides: ThemeCoverSlide[];
|
||||||
setDisplayTheme: (theme: import('@/interface/types/Theme').Theme) => void;
|
setDisplayTheme: (theme: import('@/interface/types/Theme').Theme) => void;
|
||||||
}>();
|
} = $props();
|
||||||
let emblaApi = $state();
|
let emblaApi = $state();
|
||||||
|
|
||||||
const options = $derived({ loop: slides.length > 1 });
|
const options = $derived({ loop: slides.length > 1 });
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
onLogoClick,
|
onLogoClick,
|
||||||
onClose,
|
onClose,
|
||||||
onToggleSize,
|
onToggleSize,
|
||||||
} = $props<{
|
}: {
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
setSearchTerm: (term: string) => void;
|
setSearchTerm: (term: string) => void;
|
||||||
activePage: SettingsPage;
|
activePage: SettingsPage;
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
onLogoClick: () => void;
|
onLogoClick: () => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onToggleSize?: () => void;
|
onToggleSize?: () => void;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const tabs: { id: SettingsPage; title: string }[] = [
|
const tabs: { id: SettingsPage; title: string }[] = [
|
||||||
{ id: "settings", title: "Settings" },
|
{ id: "settings", title: "Settings" },
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import { isStoreThemeInstalled } from '@/interface/utils/themeListFilters'
|
import { isStoreThemeInstalled } from '@/interface/utils/themeListFilters'
|
||||||
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
||||||
import Autoplay from 'embla-carousel-autoplay';
|
import Autoplay from 'embla-carousel-autoplay';
|
||||||
let { theme, onClick, toggleFavorite, isLoggedIn, onRequestSignIn, allStoreThemeRows, installedThemeIds = [], variant = 'official' } = $props<{
|
let { theme, onClick, toggleFavorite, isLoggedIn, onRequestSignIn, allStoreThemeRows, installedThemeIds = [], variant = 'official' }: {
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
toggleFavorite: (theme: Theme) => void;
|
toggleFavorite: (theme: Theme) => void;
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
allStoreThemeRows?: Theme[];
|
allStoreThemeRows?: Theme[];
|
||||||
installedThemeIds?: string[];
|
installedThemeIds?: string[];
|
||||||
variant?: 'official' | 'community';
|
variant?: 'official' | 'community';
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const displayDownloadCount = $derived(
|
const displayDownloadCount = $derived(
|
||||||
allStoreThemeRows != null
|
allStoreThemeRows != null
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
allStoreThemeRows,
|
allStoreThemeRows,
|
||||||
installedThemeIds = [],
|
installedThemeIds = [],
|
||||||
variant = 'official',
|
variant = 'official',
|
||||||
} = $props<{
|
}: {
|
||||||
themes: Theme[];
|
themes: Theme[];
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
setDisplayTheme: (theme: Theme) => void;
|
setDisplayTheme: (theme: Theme) => void;
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
allStoreThemeRows?: Theme[];
|
allStoreThemeRows?: Theme[];
|
||||||
installedThemeIds?: string[];
|
installedThemeIds?: string[];
|
||||||
variant?: 'official' | 'community';
|
variant?: 'official' | 'community';
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let filteredThemes = $derived(themes.filter((theme: Theme) => {
|
let filteredThemes = $derived(themes.filter((theme: Theme) => {
|
||||||
const q = searchTerm.toLowerCase();
|
const q = searchTerm.toLowerCase();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ selectedThemeId = '',
|
|||||||
installedThemeColors = {},
|
installedThemeColors = {},
|
||||||
variant = 'official',
|
variant = 'official',
|
||||||
adminPreviewMode = false,
|
adminPreviewMode = false,
|
||||||
} = $props<{
|
}: {
|
||||||
theme: Theme | null
|
theme: Theme | null
|
||||||
currentThemes: string[]
|
currentThemes: string[]
|
||||||
setDisplayTheme: (theme: Theme | null) => void
|
setDisplayTheme: (theme: Theme | null) => void
|
||||||
@@ -49,7 +49,7 @@ selectedThemeId?: string
|
|||||||
installedThemeColors?: Record<string, string>
|
installedThemeColors?: Record<string, string>
|
||||||
variant?: 'official' | 'community'
|
variant?: 'official' | 'community'
|
||||||
adminPreviewMode?: boolean
|
adminPreviewMode?: boolean
|
||||||
}>()
|
} = $props()
|
||||||
const installActionLabel = $derived(adminPreviewMode ? 'Preview & apply' : 'Install')
|
const installActionLabel = $derived(adminPreviewMode ? 'Preview & apply' : 'Install')
|
||||||
const isCommunity = $derived(variant === 'community')
|
const isCommunity = $derived(variant === 'community')
|
||||||
const themeStoreInstallLocked = $derived(isRemoteThemeStoreDisabled() && !adminPreviewMode)
|
const themeStoreInstallLocked = $derived(isRemoteThemeStoreDisabled() && !adminPreviewMode)
|
||||||
@@ -142,7 +142,7 @@ damping: 20,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const hideModal = (relatedTheme = null) => {
|
const hideModal = (relatedTheme: Theme | null = null) => {
|
||||||
animate(
|
animate(
|
||||||
modalElement,
|
modalElement,
|
||||||
{ y: [0, 16], opacity: [1, 0], scale: [1, 0.98] },
|
{ y: [0, 16], opacity: [1, 0], scale: [1, 0.98] },
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
url?: string | undefined;
|
url?: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { bg, isSelected, isEditMode, onClick, onDelete } = $props<{ bg: Background, isSelected: boolean, isEditMode: boolean, onClick: () => void, onDelete: () => void }>();
|
let { bg, isSelected, isEditMode, onClick, onDelete }: { bg: Background, isSelected: boolean, isEditMode: boolean, onClick: () => void, onDelete: () => void } = $props();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { loadBackground } from '@/seqta/ui/ImageBackgrounds'
|
import { loadBackground } from '@/seqta/ui/ImageBackgrounds'
|
||||||
import { backgroundUpdates } from '@/interface/hooks/BackgroundUpdates'
|
import { backgroundUpdates } from '@/interface/hooks/BackgroundUpdates'
|
||||||
|
|
||||||
let { isEditMode, selectNoBackground = $bindable(), selectedBackground = $bindable() } = $props<{ isEditMode: boolean, selectNoBackground: () => void, selectedBackground: string | null }>();
|
let { isEditMode, selectNoBackground = $bindable(), selectedBackground = $bindable() }: { isEditMode: boolean, selectNoBackground: () => void, selectedBackground: string | null } = $props();
|
||||||
let backgrounds = $state<{ id: string; type: string; blob: Blob | null; url?: string }[]>([]);
|
let backgrounds = $state<{ id: string; type: string; blob: Blob | null; url?: string }[]>([]);
|
||||||
let feedback = $state<{ kind: 'error' | 'warn'; text: string } | null>(null);
|
let feedback = $state<{ kind: 'error' | 'warn'; text: string } | null>(null);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { blobToDataUrl } from '@/seqta/utils/base64'
|
import { blobToDataUrl } from '@/seqta/utils/base64'
|
||||||
|
|
||||||
let { source, alt = '', class: className = '' } = $props<{
|
let { source, alt = '', class: className = '' }: {
|
||||||
source: string | Blob | null | undefined
|
source: string | Blob | null | undefined
|
||||||
alt?: string
|
alt?: string
|
||||||
class?: string
|
class?: string
|
||||||
}>()
|
} = $props()
|
||||||
|
|
||||||
let src = $state('')
|
let src = $state('')
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||||
import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
|
import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
|
||||||
import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
|
import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
|
||||||
import { closeExtensionPopup } from '@/seqta/utils/closers/closeExtensionPopup'
|
|
||||||
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
||||||
import { getRemoteConfigSnapshot, resolveEffectiveRemoteTheme } from '@/seqta/utils/remoteConfig/runtime'
|
import { getRemoteConfigSnapshot, resolveEffectiveRemoteTheme } from '@/seqta/utils/remoteConfig/runtime'
|
||||||
|
|
||||||
@@ -20,10 +19,10 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
let themes = $state<ThemeList | null>(null);
|
let themes = $state<ThemeList | null>(null);
|
||||||
let { isEditMode, showNavigation = true } = $props<{
|
let { isEditMode, showNavigation = true }: {
|
||||||
isEditMode: boolean;
|
isEditMode: boolean;
|
||||||
showNavigation?: boolean;
|
showNavigation?: boolean;
|
||||||
}>();
|
} = $props();
|
||||||
let favoriteStatus = $state<Record<string, boolean>>({});
|
let favoriteStatus = $state<Record<string, boolean>>({});
|
||||||
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
||||||
let prevLoggedIn = $state(false);
|
let prevLoggedIn = $state(false);
|
||||||
|
|||||||
@@ -197,11 +197,11 @@
|
|||||||
|
|
||||||
const handleDevModeToggle = () => armDevModeUnlock();
|
const handleDevModeToggle = () => armDevModeUnlock();
|
||||||
|
|
||||||
let ColourPickerComponent = $state<Component | null>(null);
|
let ColourPickerComponent = $state<Component<any> | null>(null);
|
||||||
let FontPickerComponent = $state<Component | null>(null);
|
let FontPickerComponent = $state<Component<any> | null>(null);
|
||||||
let CloudPanelComponent = $state<Component | null>(null);
|
let CloudPanelComponent = $state<Component<any> | null>(null);
|
||||||
let DisclaimerModalComponent = $state<Component | null>(null);
|
let DisclaimerModalComponent = $state<Component<any> | null>(null);
|
||||||
let FeedbackModalComponent = $state<Component | null>(null);
|
let FeedbackModalComponent = $state<Component<any> | null>(null);
|
||||||
|
|
||||||
const openColourPicker = async () => {
|
const openColourPicker = async () => {
|
||||||
if (!ColourPickerComponent) {
|
if (!ColourPickerComponent) {
|
||||||
@@ -232,7 +232,7 @@
|
|||||||
closeExtensionPopup();
|
closeExtensionPopup();
|
||||||
};
|
};
|
||||||
|
|
||||||
let { standalone } = $props<{ standalone?: boolean }>();
|
let { standalone }: { standalone?: boolean } = $props();
|
||||||
let showColourPicker = $state<boolean>(false);
|
let showColourPicker = $state<boolean>(false);
|
||||||
let showFontPicker = $state<boolean>(false);
|
let showFontPicker = $state<boolean>(false);
|
||||||
let showCloudPanel = $state<boolean>(false);
|
let showCloudPanel = $state<boolean>(false);
|
||||||
|
|||||||
@@ -28,7 +28,9 @@
|
|||||||
section,
|
section,
|
||||||
showDisclaimer,
|
showDisclaimer,
|
||||||
searchQuery = "",
|
searchQuery = "",
|
||||||
}: SettingsSectionSharedProps & { section: SettingsSectionId } = $props();
|
}: Pick<SettingsSectionSharedProps, "showDisclaimer" | "searchQuery"> & {
|
||||||
|
section: SettingsSectionId;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
let cloudState = $state(cloudAuth.state);
|
let cloudState = $state(cloudAuth.state);
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { SettingsSectionId } from "./shared";
|
|||||||
|
|
||||||
export const SECTION_LOADERS: Record<
|
export const SECTION_LOADERS: Record<
|
||||||
SettingsSectionId,
|
SettingsSectionId,
|
||||||
() => Promise<{ default: Component }>
|
() => Promise<{ default: Component<any> }>
|
||||||
> = {
|
> = {
|
||||||
account: () => import("./sections/account.svelte"),
|
account: () => import("./sections/account.svelte"),
|
||||||
general: () => import("./sections/generalOptions.svelte"),
|
general: () => import("./sections/generalOptions.svelte"),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Shortcuts from "@/seqta/content/links.json"
|
import Shortcuts from "@/seqta/content/links.json"
|
||||||
|
|
||||||
let { searchQuery = "" } = $props<{ searchQuery?: string }>();
|
let { searchQuery = "" }: { searchQuery?: string } = $props();
|
||||||
const q = $derived(searchQuery.trim().toLowerCase());
|
const q = $derived(searchQuery.trim().toLowerCase());
|
||||||
|
|
||||||
let isLoaded = $state(false);
|
let isLoaded = $state(false);
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
import Button from "@/interface/components/Button.svelte"
|
import Button from "@/interface/components/Button.svelte"
|
||||||
import { standalone } from "@/interface/utils/standalone.svelte"
|
import { standalone } from "@/interface/utils/standalone.svelte"
|
||||||
|
|
||||||
let { section = "all" } = $props<{
|
let { section = "all" }: {
|
||||||
section?: "all" | "themes" | "backgrounds";
|
section?: "all" | "themes" | "backgrounds";
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let selectedBackground = $state<string | null>(null);
|
let selectedBackground = $state<string | null>(null);
|
||||||
let selectNoBackground = $state<() => void>(() => { });
|
let selectNoBackground = $state<() => void>(() => { });
|
||||||
|
|||||||
@@ -27,14 +27,14 @@
|
|||||||
setActiveTab,
|
setActiveTab,
|
||||||
setSearchTerm,
|
setSearchTerm,
|
||||||
setBackgroundCategories,
|
setBackgroundCategories,
|
||||||
} = $props<{
|
}: {
|
||||||
activeTab: StoreTab;
|
activeTab: StoreTab;
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
selectedBackgroundCategory: string;
|
selectedBackgroundCategory: string;
|
||||||
setActiveTab: (tab: StoreTab) => void;
|
setActiveTab: (tab: StoreTab) => void;
|
||||||
setSearchTerm: (term: string) => void;
|
setSearchTerm: (term: string) => void;
|
||||||
setBackgroundCategories: (categories: string[]) => void;
|
setBackgroundCategories: (categories: string[]) => void;
|
||||||
}>();
|
} = $props();
|
||||||
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(() => {
|
||||||
window.addEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
window.addEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
||||||
themeUpdates.addListener(fetchCurrentThemes);
|
themeUpdates.addListener(fetchCurrentThemes);
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,12 @@
|
|||||||
defaultThemeCreatorMeta,
|
defaultThemeCreatorMeta,
|
||||||
mergeThemeWithCreatorMeta,
|
mergeThemeWithCreatorMeta,
|
||||||
snapshotSidebarSettings,
|
snapshotSidebarSettings,
|
||||||
type ThemeCreatorSidebarMeta,
|
|
||||||
} from '@/interface/utils/themeCreatorMeta'
|
} from '@/interface/utils/themeCreatorMeta'
|
||||||
import { ensureThemeCoverImage } from '@/interface/utils/themePlaceholderCover'
|
import { ensureThemeCoverImage } from '@/interface/utils/themePlaceholderCover'
|
||||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||||
import type { ThemeCreatorMeta } from '@/types/CustomThemes'
|
import type { ThemeCreatorMeta } from '@/types/CustomThemes'
|
||||||
|
|
||||||
const { themeID } = $props<{ themeID: string }>()
|
const { themeID }: { themeID: string } = $props()
|
||||||
const themeManager = ThemeManager.getInstance();
|
const themeManager = ThemeManager.getInstance();
|
||||||
|
|
||||||
let theme = $state<LoadedCustomTheme>({
|
let theme = $state<LoadedCustomTheme>({
|
||||||
@@ -71,8 +70,6 @@
|
|||||||
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
||||||
let panelDark = $state(Boolean(settingsState.DarkMode));
|
let panelDark = $state(Boolean(settingsState.DarkMode));
|
||||||
let creatorMeta = $state<ThemeCreatorMeta>(defaultThemeCreatorMeta());
|
let creatorMeta = $state<ThemeCreatorMeta>(defaultThemeCreatorMeta());
|
||||||
let originalSidebar = $state<ThemeCreatorSidebarMeta | null>(null);
|
|
||||||
let originalFontId = $state<string | null>(null);
|
|
||||||
/** When true, generated font/background CSS is merged for live preview and save. */
|
/** When true, generated font/background CSS is merged for live preview and save. */
|
||||||
let composeVisuals = $state(false);
|
let composeVisuals = $state(false);
|
||||||
|
|
||||||
@@ -169,7 +166,7 @@
|
|||||||
return await ensureThemeCoverImage(merged);
|
return await ensureThemeCoverImage(merged);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(() => {
|
||||||
const unsubCloud = cloudAuth.subscribe((s) => {
|
const unsubCloud = cloudAuth.subscribe((s) => {
|
||||||
cloudLoggedIn = s.isLoggedIn;
|
cloudLoggedIn = s.isLoggedIn;
|
||||||
});
|
});
|
||||||
@@ -178,9 +175,15 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
void ensureFontPickerFontsLoaded();
|
void ensureFontPickerFontsLoaded();
|
||||||
originalSidebar = snapshotSidebarSettings();
|
void loadTheme();
|
||||||
originalFontId = settingsState.selectedFont ?? DEFAULT_FONT_ID;
|
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unsubCloud();
|
||||||
|
unsubSettings();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
async function loadTheme() {
|
||||||
if (themeID) {
|
if (themeID) {
|
||||||
const tempTheme = await themeManager.getTheme(themeID);
|
const tempTheme = await themeManager.getTheme(themeID);
|
||||||
if (!tempTheme) return;
|
if (!tempTheme) return;
|
||||||
@@ -208,14 +211,7 @@
|
|||||||
applySelectedFont(creatorMeta.fontId);
|
applySelectedFont(creatorMeta.fontId);
|
||||||
themeLoaded = true;
|
themeLoaded = true;
|
||||||
themeUpdates.triggerUpdate();
|
themeUpdates.triggerUpdate();
|
||||||
|
}
|
||||||
return () => {
|
|
||||||
unsubCloud();
|
|
||||||
unsubSettings();
|
|
||||||
if (originalSidebar) applySidebarSettings(originalSidebar);
|
|
||||||
if (originalFontId) applySelectedFont(originalFontId);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
function onImageUpload(event: Event) {
|
function onImageUpload(event: Event) {
|
||||||
const updated = handleImageUpload(event, theme);
|
const updated = handleImageUpload(event, theme);
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ export async function ensureTransformersEnv(
|
|||||||
const { env } = await import("@huggingface/transformers");
|
const { env } = await import("@huggingface/transformers");
|
||||||
const base = ortWasmBase ?? extensionAssetUrl(ORT_RESOURCE_DIR);
|
const base = ortWasmBase ?? extensionAssetUrl(ORT_RESOURCE_DIR);
|
||||||
|
|
||||||
env.backends.onnx.wasm = env.backends.onnx.wasm ?? {};
|
if (env.backends.onnx.wasm) env.backends.onnx.wasm.wasmPaths = base.endsWith("/") ? base : `${base}/`;
|
||||||
env.backends.onnx.wasm.wasmPaths = base.endsWith("/") ? base : `${base}/`;
|
|
||||||
|
|
||||||
configured = true;
|
configured = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PluginAPI } from "@/plugins/core/types";
|
import type { NumberSetting, PluginAPI } from "@/plugins/core/types";
|
||||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||||
import { waitForSeqtaMenu } from "@/seqta/utils/waitForSeqtaShell";
|
import { waitForSeqtaMenu } from "@/seqta/utils/waitForSeqtaShell";
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ export function removeAnimatedBackgroundLayers(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function syncAnimatedBackground(
|
export async function syncAnimatedBackground(
|
||||||
api: PluginAPI<{ speed: number }>,
|
api: PluginAPI<{ speed: NumberSetting }>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const [container, menu] = await Promise.all([
|
const [container, menu] = await Promise.all([
|
||||||
|
|||||||
@@ -9,15 +9,9 @@ import {
|
|||||||
letterToNumber,
|
letterToNumber,
|
||||||
parseAssessments,
|
parseAssessments,
|
||||||
processAssessments,
|
processAssessments,
|
||||||
type WeightingEntry,
|
|
||||||
} from "./utils.ts";
|
} from "./utils.ts";
|
||||||
import { injectRubricCopyButtons, teardownRubricCopyButtons } from "./rubricCopy.ts";
|
import { injectRubricCopyButtons, teardownRubricCopyButtons } from "./rubricCopy.ts";
|
||||||
|
|
||||||
interface weightingsStorage {
|
|
||||||
weightings: Record<string, WeightingEntry>;
|
|
||||||
assessments: Record<string, string>;
|
|
||||||
weightingOverrides: Record<string, string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
let overrideListenerController: AbortController | null = null;
|
let overrideListenerController: AbortController | null = null;
|
||||||
let wrapperColourObserver: MutationObserver | null = null;
|
let wrapperColourObserver: MutationObserver | null = null;
|
||||||
@@ -156,7 +150,7 @@ async function renderSubjectAverage(api: any) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const assessmentItems = Array.from(
|
const assessmentItems = Array.from(
|
||||||
assessmentsList.querySelectorAll(
|
assessmentsList.querySelectorAll<HTMLElement>(
|
||||||
`[class*='AssessmentItem__AssessmentItem___']`,
|
`[class*='AssessmentItem__AssessmentItem___']`,
|
||||||
),
|
),
|
||||||
).filter(
|
).filter(
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ function updateWeightLabelContent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createWeightLabel(
|
function createWeightLabel(
|
||||||
assessmentItem: Element,
|
assessmentItem: HTMLElement,
|
||||||
weighting: string | undefined,
|
weighting: string | undefined,
|
||||||
api: any,
|
api: any,
|
||||||
refreshing = false,
|
refreshing = false,
|
||||||
@@ -662,7 +662,6 @@ export async function extractPDFText(url: string): Promise<string> {
|
|||||||
useSystemFonts: true,
|
useSystemFonts: true,
|
||||||
verbosity: 0,
|
verbosity: 0,
|
||||||
useWorkerFetch: false,
|
useWorkerFetch: false,
|
||||||
isEvalSupported: false,
|
|
||||||
}).promise;
|
}).promise;
|
||||||
|
|
||||||
let text = "";
|
let text = "";
|
||||||
@@ -909,7 +908,7 @@ export async function parseAssessments(api: any) {
|
|||||||
await Promise.all(marks.map((mark: any) => handleWeightings(mark, api)));
|
await Promise.all(marks.map((mark: any) => handleWeightings(mark, api)));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function processAssessments(api: any, assessmentItems: Element[]) {
|
export async function processAssessments(api: any, assessmentItems: HTMLElement[]) {
|
||||||
let weightedTotal = 0;
|
let weightedTotal = 0;
|
||||||
let totalWeight = 0;
|
let totalWeight = 0;
|
||||||
let hasInaccurateWeighting = false;
|
let hasInaccurateWeighting = false;
|
||||||
@@ -937,8 +936,7 @@ export async function processAssessments(api: any, assessmentItems: Element[]) {
|
|||||||
|
|
||||||
const assessmentID = await resolveAssessmentId(api, title, fiberMarks);
|
const assessmentID = await resolveAssessmentId(api, title, fiberMarks);
|
||||||
if (assessmentID) {
|
if (assessmentID) {
|
||||||
(assessmentItem as HTMLElement).dataset.betterseqtaAssessmentId =
|
assessmentItem.dataset.betterseqtaAssessmentId = assessmentID;
|
||||||
assessmentID;
|
|
||||||
}
|
}
|
||||||
const entry = assessmentID
|
const entry = assessmentID
|
||||||
? (api.storage.weightings?.[assessmentID] as WeightingEntry | undefined)
|
? (api.storage.weightings?.[assessmentID] as WeightingEntry | undefined)
|
||||||
@@ -1054,7 +1052,7 @@ function resolveTabSetClasses(): Record<string, string> {
|
|||||||
|
|
||||||
interface WeightingTabContext {
|
interface WeightingTabContext {
|
||||||
assessmentID?: string;
|
assessmentID?: string;
|
||||||
autoWeight?: number;
|
autoWeight?: string;
|
||||||
override?: number | string;
|
override?: number | string;
|
||||||
weightingUnavailable: boolean;
|
weightingUnavailable: boolean;
|
||||||
statusNote: string;
|
statusNote: string;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ describe("errorPageKitten", () => {
|
|||||||
document.title = "SEQTA Learn";
|
document.title = "SEQTA Learn";
|
||||||
document.body.innerHTML = '<div id="container"></div>';
|
document.body.innerHTML = '<div id="container"></div>';
|
||||||
|
|
||||||
const cleanup = await errorPageKittenPlugin.run();
|
const cleanup = await errorPageKittenPlugin.run({} as Parameters<typeof errorPageKittenPlugin.run>[0]);
|
||||||
|
|
||||||
expect(getCard()).toBeNull();
|
expect(getCard()).toBeNull();
|
||||||
expect(cleanup).toBeDefined();
|
expect(cleanup).toBeDefined();
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ const settings = defineSettings({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export type GlobalSearchSettings = typeof settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shell loads immediately so the Quick Search chip can show in the title bar.
|
* Shell loads immediately so the Quick Search chip can show in the title bar.
|
||||||
* Heavy indexing / SearchBar chunk stays in the lazy core loader.
|
* Heavy indexing / SearchBar chunk stays in the lazy core loader.
|
||||||
@@ -102,7 +104,7 @@ globalSearchPlugin.run = async (api) => {
|
|||||||
titleBarState.showSearch = true;
|
titleBarState.showSearch = true;
|
||||||
|
|
||||||
let heavyCleanup: (() => void) | void;
|
let heavyCleanup: (() => void) | void;
|
||||||
const heavyPromise = runGlobalSearch(api).then((cleanup) => {
|
const heavyPromise = Promise.resolve(runGlobalSearch(api)).then((cleanup) => {
|
||||||
heavyCleanup = cleanup;
|
heavyCleanup = cleanup;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
const {
|
const {
|
||||||
transparencyEffects,
|
transparencyEffects,
|
||||||
searchHotkey: initialSearchHotkey
|
searchHotkey: initialSearchHotkey
|
||||||
} = $props<{
|
}: {
|
||||||
transparencyEffects: boolean,
|
transparencyEffects: boolean,
|
||||||
searchHotkey: string
|
searchHotkey: string
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let currentSearchHotkey = $derived(initialSearchHotkey);
|
let currentSearchHotkey = $derived(initialSearchHotkey);
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
||||||
import type { FuseResultMatch } from '../../core/types';
|
import type { FuseResultMatch } from '../../core/types';
|
||||||
|
|
||||||
const { item, isSelected, searchTerm, matches, onclick } = $props<{
|
const { item, isSelected, searchTerm, matches, onclick }: {
|
||||||
item: DynamicContentItem;
|
item: DynamicContentItem;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
matches?: readonly FuseResultMatch[];
|
matches?: readonly FuseResultMatch[];
|
||||||
onclick: () => void;
|
onclick: () => void;
|
||||||
}>();
|
} = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
||||||
import type { FuseResultMatch } from '../../core/types';
|
import type { FuseResultMatch } from '../../core/types';
|
||||||
|
|
||||||
const { item, isSelected, searchTerm, matches, onclick } = $props<{
|
const { item, isSelected, searchTerm, matches, onclick }: {
|
||||||
item: DynamicContentItem;
|
item: DynamicContentItem;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
matches?: readonly FuseResultMatch[];
|
matches?: readonly FuseResultMatch[];
|
||||||
onclick: () => void;
|
onclick: () => void;
|
||||||
}>();
|
} = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
import type { DynamicContentItem } from '../../utils/dynamicItems';
|
||||||
import type { FuseResultMatch } from '../../core/types';
|
import type { FuseResultMatch } from '../../core/types';
|
||||||
|
|
||||||
const { item, isSelected, searchTerm, matches, onclick } = $props<{
|
const { item, isSelected, searchTerm, matches, onclick }: {
|
||||||
item: DynamicContentItem;
|
item: DynamicContentItem;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
matches?: readonly FuseResultMatch[];
|
matches?: readonly FuseResultMatch[];
|
||||||
onclick: () => void;
|
onclick: () => void;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const categoryLabel = (category: string): string => {
|
const categoryLabel = (category: string): string => {
|
||||||
if (!category) return '';
|
if (!category) return '';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Plugin } from "@/plugins/core/types";
|
import type { Plugin } from "@/plugins/core/types";
|
||||||
|
import type { GlobalSearchSettings } from "../../lazy";
|
||||||
import { verboseDebug, verboseLog } from "@/utils/verboseLog";
|
import { verboseDebug, verboseLog } from "@/utils/verboseLog";
|
||||||
import styles from "./styles.css?inline";
|
|
||||||
import { waitForSeqtaTitle } from "@/seqta/utils/waitForSeqtaShell";
|
import { waitForSeqtaTitle } from "@/seqta/utils/waitForSeqtaShell";
|
||||||
import { runIndexing, ensureSchemaCurrent } from "../indexing/indexer";
|
import { runIndexing, ensureSchemaCurrent } from "../indexing/indexer";
|
||||||
import { installResetIndexMessageListener } from "../indexing/resetIndexes";
|
import { installResetIndexMessageListener } from "../indexing/resetIndexes";
|
||||||
@@ -22,16 +22,7 @@ function scheduleIdleIndexing(run: () => void): void {
|
|||||||
setTimeout(run, 2000);
|
setTimeout(run, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalSearchPlugin: Plugin<{}> = {
|
const globalSearchPlugin: Pick<Plugin<GlobalSearchSettings>, "run"> = {
|
||||||
id: "global-search",
|
|
||||||
name: "Global Search",
|
|
||||||
description: "Quick search for everything in SEQTA",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
defaultEnabled: false,
|
|
||||||
styles,
|
|
||||||
|
|
||||||
run: async (api) => {
|
run: async (api) => {
|
||||||
const appRef = { current: null };
|
const appRef = { current: null };
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import type { StaticCommandItem } from "./commands";
|
import type { StaticCommandItem } from "./commands";
|
||||||
import type { IndexItem } from "../indexing/types";
|
import type { IndexItem } from "../indexing/types";
|
||||||
|
|
||||||
export interface MatchIndices {
|
export type MatchIndices = readonly [number, number];
|
||||||
readonly 0: number;
|
|
||||||
readonly 1: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FuseResultMatch {
|
export interface FuseResultMatch {
|
||||||
key?: string;
|
key?: string;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { VectorWorkerManager } from "../worker/vectorWorkerManager";
|
|||||||
import { loadAllStoredItems } from "../indexer";
|
import { loadAllStoredItems } from "../indexer";
|
||||||
import { publishDynamicItemsUpdate } from "../renderComponents";
|
import { publishDynamicItemsUpdate } from "../renderComponents";
|
||||||
|
|
||||||
import { verboseDebug, verboseInfo, verboseLog } from '@/utils/verboseLog';
|
import { verboseInfo, verboseLog } from '@/utils/verboseLog';
|
||||||
const RATE_LIMIT_CONFIG = {
|
const RATE_LIMIT_CONFIG = {
|
||||||
minDelay: 30,
|
minDelay: 30,
|
||||||
maxDelay: 3000,
|
maxDelay: 3000,
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ let ortWasmBase: string | null = null;
|
|||||||
|
|
||||||
async function configureOrtWasm(base: string): Promise<void> {
|
async function configureOrtWasm(base: string): Promise<void> {
|
||||||
const { env } = await import("@huggingface/transformers");
|
const { env } = await import("@huggingface/transformers");
|
||||||
env.backends.onnx.wasm = env.backends.onnx.wasm ?? {};
|
if (env.backends.onnx.wasm) env.backends.onnx.wasm.wasmPaths = base.endsWith("/") ? base : `${base}/`;
|
||||||
env.backends.onnx.wasm.wasmPaths = base.endsWith("/") ? base : `${base}/`;
|
|
||||||
}
|
}
|
||||||
let vectorIndex: EmbeddingIndex | null = null;
|
let vectorIndex: EmbeddingIndex | null = null;
|
||||||
let isInitialized = false;
|
let isInitialized = false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import Fuse, { type FuseResult } from "fuse.js";
|
import Fuse, { type FuseResult, type IFuseOptions } from "fuse.js";
|
||||||
import { getStaticCommands, type StaticCommandItem } from "../core/commands";
|
import { getStaticCommands, type StaticCommandItem } from "../core/commands";
|
||||||
import { getDynamicItems } from "../utils/dynamicItems";
|
import { getDynamicItems } from "../utils/dynamicItems";
|
||||||
import type { CombinedResult } from "../core/types";
|
import type { CombinedResult } from "../core/types";
|
||||||
@@ -120,7 +120,7 @@ export const DYNAMIC_FUSE_OPTIONS = {
|
|||||||
ignoreLocation: true,
|
ignoreLocation: true,
|
||||||
findAllMatches: true,
|
findAllMatches: true,
|
||||||
shouldSort: true,
|
shouldSort: true,
|
||||||
} as const;
|
} satisfies IFuseOptions<IndexItem>;
|
||||||
|
|
||||||
export interface DynamicItemsUpdatedDetail {
|
export interface DynamicItemsUpdatedDetail {
|
||||||
incremental?: boolean;
|
incremental?: boolean;
|
||||||
@@ -136,10 +136,7 @@ export interface DynamicItemsUpdatedDetail {
|
|||||||
export function createDynamicContentFuse(
|
export function createDynamicContentFuse(
|
||||||
items: IndexItem[],
|
items: IndexItem[],
|
||||||
): Fuse<IndexItem> {
|
): Fuse<IndexItem> {
|
||||||
return new Fuse(
|
return new Fuse(dedupeIndexItemsForSearch(items), DYNAMIC_FUSE_OPTIONS);
|
||||||
dedupeIndexItemsForSearch(items),
|
|
||||||
DYNAMIC_FUSE_OPTIONS,
|
|
||||||
) as Fuse<IndexItem>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { FuseResultMatch } from '../core/types';
|
import type { FuseResultMatch } from '../core/types';
|
||||||
|
|
||||||
const { text, term, matches } = $props<{
|
const { text, term, matches }: {
|
||||||
text: string;
|
text: string;
|
||||||
term: string;
|
term: string;
|
||||||
matches?: readonly FuseResultMatch[];
|
matches?: readonly FuseResultMatch[];
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const segments = $derived(buildSegments(text, term, matches));
|
const segments = $derived(buildSegments(text, term, matches));
|
||||||
|
|
||||||
function buildSegments(text: string, term: string, matches = undefined) {
|
function buildSegments(text: string, term: string, matches?: readonly FuseResultMatch[]) {
|
||||||
if (!term.trim() || !matches?.length) return [{ text, highlight: false }];
|
if (!term.trim() || !matches?.length) return [{ text, highlight: false }];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as Chart from "./chart/index";
|
import * as Chart from "./chart/index";
|
||||||
import { scaleLinear } from "d3-scale";
|
import { scaleLinear } from "d3-scale";
|
||||||
import { Area, AreaChart, ChartClipPath, Spline } from "layerchart";
|
import { Area, AreaChart, ChartClipPath, Spline, type ChartState } from "layerchart";
|
||||||
import { curveMonotoneX } from "d3-shape";
|
import { curveMonotoneX } from "d3-shape";
|
||||||
import { cubicInOut } from "svelte/easing";
|
import { cubicInOut } from "svelte/easing";
|
||||||
import type { Assessment } from "./types";
|
import type { Assessment } from "./types";
|
||||||
@@ -37,6 +37,9 @@
|
|||||||
|
|
||||||
const chartUid = $props.id();
|
const chartUid = $props.id();
|
||||||
|
|
||||||
|
const hasAverage = (p: TrendPoint): p is TrendPoint & { average: number } =>
|
||||||
|
p.average != null && !Number.isNaN(p.average);
|
||||||
|
|
||||||
const chartResult = $derived.by(() =>
|
const chartResult = $derived.by(() =>
|
||||||
buildGradeTrendChart(data, timeRange, {
|
buildGradeTrendChart(data, timeRange, {
|
||||||
showPerSubject: showSubjectTrends,
|
showPerSubject: showSubjectTrends,
|
||||||
@@ -55,7 +58,7 @@
|
|||||||
if (!showPrediction) return null;
|
if (!showPrediction) return null;
|
||||||
const points = aggregateToMonthlyPoints(
|
const points = aggregateToMonthlyPoints(
|
||||||
historicalData
|
historicalData
|
||||||
.filter((p) => !Number.isNaN(p.average))
|
.filter(hasAverage)
|
||||||
.map((p) => ({ date: p.date, average: p.average })),
|
.map((p) => ({ date: p.date, average: p.average })),
|
||||||
);
|
);
|
||||||
return computeGradeForecast(points, predictionMonths);
|
return computeGradeForecast(points, predictionMonths);
|
||||||
@@ -134,11 +137,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const trend = $derived.by(() => {
|
const trend = $derived.by(() => {
|
||||||
if (historicalData.length < 2) {
|
const recent = historicalData.filter(hasAverage).slice(-2);
|
||||||
|
if (recent.length < 2) {
|
||||||
return { percentage: "0", direction: "neutral" as const };
|
return { percentage: "0", direction: "neutral" as const };
|
||||||
}
|
}
|
||||||
|
|
||||||
const recent = historicalData.slice(-2);
|
|
||||||
const change = recent[1].average - recent[0].average;
|
const change = recent[1].average - recent[0].average;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -169,7 +172,7 @@
|
|||||||
const canForecast = $derived.by(() => {
|
const canForecast = $derived.by(() => {
|
||||||
const monthly = aggregateToMonthlyPoints(
|
const monthly = aggregateToMonthlyPoints(
|
||||||
historicalData
|
historicalData
|
||||||
.filter((p) => !Number.isNaN(p.average))
|
.filter(hasAverage)
|
||||||
.map((p) => ({ date: p.date, average: p.average })),
|
.map((p) => ({ date: p.date, average: p.average })),
|
||||||
);
|
);
|
||||||
return monthly.length >= 3;
|
return monthly.length >= 3;
|
||||||
@@ -184,7 +187,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const points = historicalData.map((p) => ({ ...p }));
|
const points = historicalData.map((p) => ({ ...p }));
|
||||||
const validHist = points.filter((p) => !Number.isNaN(p.average));
|
const validHist = points.filter(hasAverage);
|
||||||
const last = validHist[validHist.length - 1];
|
const last = validHist[validHist.length - 1];
|
||||||
|
|
||||||
if (last) {
|
if (last) {
|
||||||
@@ -266,7 +269,7 @@
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{#snippet marks({ context })}
|
{#snippet marks({ context }: { context: ChartState<TrendPoint> })}
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id={chartUid} x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id={chartUid} x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="0%" stop-color={accentColor} stop-opacity="0.55" />
|
<stop offset="0%" stop-color={accentColor} stop-opacity="0.55" />
|
||||||
|
|||||||
@@ -40,14 +40,14 @@
|
|||||||
saveGradeInferenceSettings,
|
saveGradeInferenceSettings,
|
||||||
} from "./storage";
|
} from "./storage";
|
||||||
|
|
||||||
let { simpleMode = false } = $props<{ simpleMode?: boolean }>();
|
let { simpleMode = false }: { simpleMode?: boolean } = $props();
|
||||||
|
|
||||||
const LOAD_ERROR =
|
const LOAD_ERROR =
|
||||||
"Unable to load analytics. Check your connection, then select Refresh data.";
|
"Unable to load analytics. Check your connection, then select Refresh data.";
|
||||||
const SYNC_ERROR_WITH_DATA =
|
const SYNC_ERROR_WITH_DATA =
|
||||||
"Unable to sync. Showing saved data. Select Refresh data to try again.";
|
"Unable to sync. Showing saved data. Select Refresh data to try again.";
|
||||||
|
|
||||||
let analyticsData: Assessment[] | null = $state(null);
|
let analyticsData = $state<Assessment[] | null>(null);
|
||||||
let loading = $state(true);
|
let loading = $state(true);
|
||||||
let syncing = $state(false);
|
let syncing = $state(false);
|
||||||
let lastUpdated: Date | null = $state(null);
|
let lastUpdated: Date | null = $state(null);
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
let filterSubjects: string[] = $state([]);
|
let filterSubjects: string[] = $state([]);
|
||||||
let filterSearch = $state("");
|
let filterSearch = $state("");
|
||||||
let gradeRange = $state([0, 100]);
|
let gradeRange = $state<[number, number]>([0, 100]);
|
||||||
let showSubjectsDropdown = $state(false);
|
let showSubjectsDropdown = $state(false);
|
||||||
let showTimeRangeDropdown = $state(false);
|
let showTimeRangeDropdown = $state(false);
|
||||||
let timeRange: TimeRange = $state("all");
|
let timeRange: TimeRange = $state("all");
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
min = 0,
|
min = 0,
|
||||||
max = 100,
|
max = 100,
|
||||||
step = 1,
|
step = 1,
|
||||||
} = $props<{
|
}: {
|
||||||
value?: [number, number];
|
value?: [number, number];
|
||||||
min?: number;
|
min?: number;
|
||||||
max?: number;
|
max?: number;
|
||||||
step?: number;
|
step?: number;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
let dragging: "min" | "max" | null = $state(null);
|
let dragging: "min" | "max" | null = $state(null);
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
class="bsplus-analytics-range-value"
|
class="bsplus-analytics-range-value"
|
||||||
value={value[0]}
|
value={value[0]}
|
||||||
oninput={(e) => onInput(e, "min", true)}
|
oninput={(e) => onInput(e, "min", true)}
|
||||||
placeholder={min}
|
placeholder={String(min)}
|
||||||
min={min}
|
min={min}
|
||||||
max={max}
|
max={max}
|
||||||
step={step}
|
step={step}
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
class="bsplus-analytics-range-value"
|
class="bsplus-analytics-range-value"
|
||||||
value={value[1]}
|
value={value[1]}
|
||||||
oninput={(e) => onInput(e, "max", true)}
|
oninput={(e) => onInput(e, "max", true)}
|
||||||
placeholder={max}
|
placeholder={String(max)}
|
||||||
min={min}
|
min={min}
|
||||||
max={max}
|
max={max}
|
||||||
step={step}
|
step={step}
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
max = 12,
|
max = 12,
|
||||||
step = 1,
|
step = 1,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
} = $props<{
|
}: {
|
||||||
value?: number;
|
value?: number;
|
||||||
min?: number;
|
min?: number;
|
||||||
max?: number;
|
max?: number;
|
||||||
step?: number;
|
step?: number;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}>();
|
} = $props();
|
||||||
|
|
||||||
const percent = $derived(((value - min) / (max - min || 1)) * 100);
|
const percent = $derived(((value - min) / (max - min || 1)) * 100);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import type { AnalyticsGradeInferenceSettings } from "./gradeInferenceSettings";
|
|||||||
import type { Assessment, AssessmentStatus, AnalyticsClassOption } from "./types";
|
import type { Assessment, AssessmentStatus, AnalyticsClassOption } from "./types";
|
||||||
|
|
||||||
const PAST_FETCH_CONCURRENCY = 8;
|
const PAST_FETCH_CONCURRENCY = 8;
|
||||||
const DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
||||||
|
|
||||||
interface Subject {
|
interface Subject {
|
||||||
code: string;
|
code: string;
|
||||||
@@ -102,11 +101,6 @@ export function parseAssessment(data: unknown): Assessment | null {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonGradeToString(grade: unknown): string | undefined {
|
|
||||||
if (typeof grade === "string") return grade.trim() || undefined;
|
|
||||||
if (typeof grade === "number") return String(grade);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyResolvedGrade(
|
function applyResolvedGrade(
|
||||||
raw: Record<string, unknown>,
|
raw: Record<string, unknown>,
|
||||||
@@ -118,26 +112,6 @@ function applyResolvedGrade(
|
|||||||
if (resolved.source) raw.gradeSource = resolved.source;
|
if (resolved.source) raw.gradeSource = resolved.source;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractLetterGrade(
|
|
||||||
assessment: Record<string, unknown>,
|
|
||||||
): string | undefined {
|
|
||||||
if (assessment.status !== "MARKS_RELEASED") return undefined;
|
|
||||||
|
|
||||||
const criteria = assessment.criteria as
|
|
||||||
| { results?: { grade?: unknown } }[]
|
|
||||||
| undefined;
|
|
||||||
const c0 = criteria?.[0]?.results?.grade;
|
|
||||||
const fromCriteria = jsonGradeToString(c0);
|
|
||||||
if (fromCriteria) return fromCriteria;
|
|
||||||
|
|
||||||
const results = assessment.results as { grade?: unknown } | undefined;
|
|
||||||
const fromResults = jsonGradeToString(results?.grade);
|
|
||||||
if (fromResults) return fromResults;
|
|
||||||
|
|
||||||
return extractLetterGradeStringFromPayload(
|
|
||||||
assessment as Parameters<typeof extractLetterGradeStringFromPayload>[0],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function classKey(programme: number, metaclass: number): string {
|
function classKey(programme: number, metaclass: number): string {
|
||||||
return `${programme}-${metaclass}`;
|
return `${programme}-${metaclass}`;
|
||||||
@@ -332,7 +306,6 @@ function mergeRawAssessments(
|
|||||||
applyResolvedGrade(raw, inference);
|
applyResolvedGrade(raw, inference);
|
||||||
const finalGrade =
|
const finalGrade =
|
||||||
raw.finalGrade !== undefined ? Number(raw.finalGrade) : undefined;
|
raw.finalGrade !== undefined ? Number(raw.finalGrade) : undefined;
|
||||||
const letterGrade = extractLetterGrade(raw);
|
|
||||||
|
|
||||||
const existingItem = existingMap.get(id);
|
const existingItem = existingMap.get(id);
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { HTMLAttributes } from "svelte/elements";
|
import type { HTMLAttributes } from "svelte/elements";
|
||||||
import { getChartContext, Tooltip as TooltipPrimitive } from "layerchart";
|
import { getChartContext, Tooltip as TooltipPrimitive } from "layerchart";
|
||||||
import { cn } from "../utils/cn";
|
|
||||||
import { useChart } from "./chart-utils";
|
import { useChart } from "./chart-utils";
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -37,10 +36,10 @@
|
|||||||
|
|
||||||
<TooltipPrimitive.Root variant="none" portal={false}>
|
<TooltipPrimitive.Root variant="none" portal={false}>
|
||||||
<div
|
<div
|
||||||
class={cn(
|
class={[
|
||||||
"grid min-w-36 items-start gap-1.5 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 px-2.5 py-1.5 text-xs shadow-xl text-zinc-900 dark:text-white",
|
"grid min-w-36 items-start gap-1.5 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 px-2.5 py-1.5 text-xs shadow-xl text-zinc-900 dark:text-white",
|
||||||
className,
|
className,
|
||||||
)}
|
]}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
>
|
>
|
||||||
{#if !nestLabel}
|
{#if !nestLabel}
|
||||||
@@ -50,25 +49,25 @@
|
|||||||
{#each items as item (item.key)}
|
{#each items as item (item.key)}
|
||||||
{@const indicatorColor = item.color}
|
{@const indicatorColor = item.color}
|
||||||
<div
|
<div
|
||||||
class={cn(
|
class={[
|
||||||
"flex w-full flex-wrap items-stretch gap-2",
|
"flex w-full flex-wrap items-stretch gap-2",
|
||||||
indicator === "dot" && "items-center",
|
indicator === "dot" && "items-center",
|
||||||
)}
|
]}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="background: {indicatorColor}; border-color: {indicatorColor};"
|
style="background: {indicatorColor}; border-color: {indicatorColor};"
|
||||||
class={cn("shrink-0 rounded-[2px] border", {
|
class={["shrink-0 rounded-[2px] border", {
|
||||||
"size-2.5": indicator === "dot",
|
"size-2.5": indicator === "dot",
|
||||||
"h-full w-1": indicator === "line",
|
"h-full w-1": indicator === "line",
|
||||||
"w-0 border-[1.5px] border-dashed bg-transparent":
|
"w-0 border-[1.5px] border-dashed bg-transparent":
|
||||||
indicator === "dashed",
|
indicator === "dashed",
|
||||||
})}
|
}]}
|
||||||
></div>
|
></div>
|
||||||
<div
|
<div
|
||||||
class={cn(
|
class={[
|
||||||
"flex flex-1 shrink-0 justify-between leading-none",
|
"flex flex-1 shrink-0 justify-between leading-none",
|
||||||
nestLabel ? "items-end" : "items-center",
|
nestLabel ? "items-end" : "items-center",
|
||||||
)}
|
]}
|
||||||
>
|
>
|
||||||
<div class="grid gap-1.5">
|
<div class="grid gap-1.5">
|
||||||
{#if nestLabel}
|
{#if nestLabel}
|
||||||
|
|||||||
Whitespace-only changes.
@@ -1,4 +1,4 @@
|
|||||||
import { defineLazyPlugin } from "../../core/dynamicLoader";
|
import type { Plugin } from "../../core/types";
|
||||||
import { defineSettings, numberSetting } from "../../core/settingsHelpers";
|
import { defineSettings, numberSetting } from "../../core/settingsHelpers";
|
||||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||||
import { injectAnalyticsMenuItem } from "./injectAnalyticsMenuItem";
|
import { injectAnalyticsMenuItem } from "./injectAnalyticsMenuItem";
|
||||||
@@ -18,7 +18,7 @@ const settings = defineSettings({
|
|||||||
* Shell loads immediately so the sidebar Analytics icon can mount.
|
* Shell loads immediately so the sidebar Analytics icon can mount.
|
||||||
* The page UI (`loadAnalyticsPage` / charts) stays in a separate lazy chunk.
|
* The page UI (`loadAnalyticsPage` / charts) stays in a separate lazy chunk.
|
||||||
*/
|
*/
|
||||||
const gradeAnalyticsPluginLazy = defineLazyPlugin({
|
const gradeAnalyticsPlugin: Plugin<typeof settings> = {
|
||||||
id: "grade-analytics",
|
id: "grade-analytics",
|
||||||
name: "Grade Analytics",
|
name: "Grade Analytics",
|
||||||
description:
|
description:
|
||||||
@@ -28,21 +28,10 @@ const gradeAnalyticsPluginLazy = defineLazyPlugin({
|
|||||||
disableToggle: true,
|
disableToggle: true,
|
||||||
defaultEnabled: true,
|
defaultEnabled: true,
|
||||||
styles,
|
styles,
|
||||||
// Kept for API compatibility; menu injection no longer waits on this chunk.
|
run: async () => {
|
||||||
loader: () => import("./core/index"),
|
if (isSeqtaEngageExperience()) return () => {};
|
||||||
});
|
return injectAnalyticsMenuItem();
|
||||||
|
},
|
||||||
gradeAnalyticsPluginLazy.run = async () => {
|
|
||||||
if (isSeqtaEngageExperience()) {
|
|
||||||
return () => {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eager: sidebar icon / native menu row only.
|
|
||||||
const cleanupMenu = await injectAnalyticsMenuItem();
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
cleanupMenu();
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default gradeAnalyticsPluginLazy;
|
export default gradeAnalyticsPlugin;
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export function cn(...classes: (string | false | null | undefined)[]): string {
|
|
||||||
return classes.filter(Boolean).join(" ");
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { Plugin } from "../../core/types";
|
import type { Plugin } from "../../core/types";
|
||||||
|
import type { MessageFoldersSettings } from "./lazy";
|
||||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||||
|
|
||||||
interface Folder {
|
interface Folder {
|
||||||
@@ -86,8 +87,8 @@ function appendFolderBadgeContent(badge: HTMLElement, folder: Folder): void {
|
|||||||
const MESSAGE_LIST_ITEM_SELECTOR =
|
const MESSAGE_LIST_ITEM_SELECTOR =
|
||||||
"[class*='MessageList__MessageList___'] ol > li[data-message]";
|
"[class*='MessageList__MessageList___'] ol > li[data-message]";
|
||||||
|
|
||||||
function getMessageListItems(): NodeListOf<Element> {
|
function getMessageListItems(): NodeListOf<HTMLElement> {
|
||||||
return document.querySelectorAll(MESSAGE_LIST_ITEM_SELECTOR);
|
return document.querySelectorAll<HTMLElement>(MESSAGE_LIST_ITEM_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearMessageListBadges(
|
function clearMessageListBadges(
|
||||||
@@ -155,8 +156,13 @@ function createFolderBadge(
|
|||||||
return badge;
|
return badge;
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageFoldersPlugin = {
|
type MessageFoldersStorage = {
|
||||||
run: async (api: Parameters<NonNullable<Plugin["run"]>>[0]) => {
|
folders?: Folder[];
|
||||||
|
messageAssignments?: Record<string, string[]>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersStorage>, "run"> = {
|
||||||
|
run: async (api) => {
|
||||||
await api.storage.loaded;
|
await api.storage.loaded;
|
||||||
|
|
||||||
if (!api.storage.folders) api.storage.folders = [];
|
if (!api.storage.folders) api.storage.folders = [];
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ const settings = defineSettings({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export type MessageFoldersSettings = typeof settings;
|
||||||
|
|
||||||
export default defineLazyPlugin({
|
export default defineLazyPlugin({
|
||||||
id: "messageFolders",
|
id: "messageFolders",
|
||||||
name: "Message Folders",
|
name: "Message Folders",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { Plugin } from "@/plugins/core/types";
|
||||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||||
import { booleanSetting } from "@/plugins/core/settingsHelpers";
|
import { booleanSetting } from "@/plugins/core/settingsHelpers";
|
||||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PluginAPI } from "../../core/types";
|
import type { PluginAPI, PluginSettings } from "../../core/types";
|
||||||
import ReactFiber from "@/seqta/utils/ReactFiber";
|
import ReactFiber from "@/seqta/utils/ReactFiber";
|
||||||
import { delay } from "@/seqta/utils/delay";
|
import { delay } from "@/seqta/utils/delay";
|
||||||
import {
|
import {
|
||||||
@@ -89,7 +89,7 @@ export function applyBackupBadges(archive: ArchiveMap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function mountArchivedNotificationInjection(
|
export function mountArchivedNotificationInjection(
|
||||||
api: PluginAPI<Record<string, never>, { archivesByUser?: ArchivesByUser }>,
|
api: Pick<PluginAPI<PluginSettings, { archivesByUser?: ArchivesByUser }>, "seqta" | "storage">,
|
||||||
getUserKey: () => Promise<string | null>,
|
getUserKey: () => Promise<string | null>,
|
||||||
) {
|
) {
|
||||||
let observer: MutationObserver | null = null;
|
let observer: MutationObserver | null = null;
|
||||||
|
|||||||
@@ -145,9 +145,6 @@ function getMinutesOfDay(now: Date = new Date()): number {
|
|||||||
return now.getHours() * 60 + now.getMinutes();
|
return now.getHours() * 60 + now.getMinutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimeState(now: Date = new Date()): TimeState {
|
|
||||||
return timeStateForMinutes(getMinutesOfDay(now));
|
|
||||||
}
|
|
||||||
|
|
||||||
function clamp01(value: number): number {
|
function clamp01(value: number): number {
|
||||||
return Math.max(0, Math.min(1, value));
|
return Math.max(0, Math.min(1, value));
|
||||||
|
|||||||
@@ -1012,7 +1012,7 @@
|
|||||||
font-family: var(--bsplus-cal-font-family, var(--betterseqta-font-family, Rubik), sans-serif);
|
font-family: var(--bsplus-cal-font-family, var(--betterseqta-font-family, Rubik), sans-serif);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bsplus-cal-menu.dark {
|
.bsplus-cal-menu:global(.dark) {
|
||||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
|
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1132,7 +1132,7 @@
|
|||||||
backdrop-filter: blur(4px);
|
backdrop-filter: blur(4px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bsplus-cal-modal-backdrop.dark .bsplus-cal-modal {
|
.bsplus-cal-modal-backdrop:global(.dark) .bsplus-cal-modal {
|
||||||
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ const timetableClassmatesPlugin: Plugin<typeof timetableClassmatesSettings> = {
|
|||||||
const title = quickbar.querySelector(".title")?.textContent?.trim() ?? "";
|
const title = quickbar.querySelector(".title")?.textContent?.trim() ?? "";
|
||||||
const host =
|
const host =
|
||||||
(quickbar.querySelector(".meta") as HTMLElement | null) ?? (quickbar as HTMLElement);
|
(quickbar.querySelector(".meta") as HTMLElement | null) ?? (quickbar as HTMLElement);
|
||||||
paints.push(paintHost(host, ciOf(findClassEntryByTitle(page, title))));
|
paints.push(paintHost(host, classKeyFromCi(ciOf(findClassEntryByTitle(page, title)), ciMap)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||||
import { createPopupHeroVideo } from "@/seqta/utils/openers/attachPopupMediaFullscreen";
|
import { createPopupHeroVideo } from "@/seqta/utils/openers/attachPopupMediaFullscreen";
|
||||||
import { closePopup, openPopup } from "@/seqta/utils/openers/PopupManager";
|
import { closePopup, openPopup } from "@/seqta/utils/openers/PopupManager";
|
||||||
import { mount, unmount } from "svelte";
|
import { mount, unmount, type Component } from "svelte";
|
||||||
import TimetableClassmatesOptInPopup from "./TimetableClassmatesOptInPopup.svelte";
|
import TimetableClassmatesOptInPopup from "./TimetableClassmatesOptInPopup.svelte";
|
||||||
import TimetableClassmatesOptOutPopup from "./TimetableClassmatesOptOutPopup.svelte";
|
import TimetableClassmatesOptOutPopup from "./TimetableClassmatesOptOutPopup.svelte";
|
||||||
import popupStyles from "./consentPopup.css?inline";
|
import popupStyles from "./consentPopup.css?inline";
|
||||||
@@ -31,11 +31,16 @@ type ConsentPopupOptions = {
|
|||||||
heroVideo?: boolean;
|
heroVideo?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
function openConsentPopup(
|
type ConsentPopupControls = {
|
||||||
|
onCancel: () => void;
|
||||||
|
onComplete: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
function openConsentPopup<P extends Record<string, unknown>>(
|
||||||
title: string,
|
title: string,
|
||||||
subtitle: string,
|
subtitle: string,
|
||||||
component: typeof TimetableClassmatesOptInPopup | typeof TimetableClassmatesOptOutPopup,
|
component: Component<P & ConsentPopupControls>,
|
||||||
props: Record<string, unknown>,
|
props: P,
|
||||||
options?: ConsentPopupOptions,
|
options?: ConsentPopupOptions,
|
||||||
): void {
|
): void {
|
||||||
if (document.getElementById("whatsnewbk")) return;
|
if (document.getElementById("whatsnewbk")) return;
|
||||||
|
|||||||
@@ -3,25 +3,25 @@ import { classBundlePlaintext } from "./relayPayload";
|
|||||||
|
|
||||||
const IV_BYTES = 12;
|
const IV_BYTES = 12;
|
||||||
|
|
||||||
function base64FromBytes(bytes: Uint8Array): string {
|
function base64FromBytes(bytes: Uint8Array<ArrayBuffer>): string {
|
||||||
let binary = "";
|
let binary = "";
|
||||||
for (const b of bytes) binary += String.fromCharCode(b);
|
for (const b of bytes) binary += String.fromCharCode(b);
|
||||||
return btoa(binary);
|
return btoa(binary);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decodeBundleKey(bundleKeyB64: string): Uint8Array {
|
export function decodeBundleKey(bundleKeyB64: string): Uint8Array<ArrayBuffer> {
|
||||||
const binary = atob(bundleKeyB64);
|
const binary = atob(bundleKeyB64);
|
||||||
const out = new Uint8Array(binary.length);
|
const out = new Uint8Array(binary.length);
|
||||||
for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
|
for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sha256(data: Uint8Array): Promise<Uint8Array> {
|
async function sha256(data: Uint8Array<ArrayBuffer>): Promise<Uint8Array<ArrayBuffer>> {
|
||||||
const hash = await crypto.subtle.digest("SHA-256", data);
|
const hash = await crypto.subtle.digest("SHA-256", data);
|
||||||
return new Uint8Array(hash);
|
return new Uint8Array(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function classAesKey(bundleKey: Uint8Array, classKey: string): Promise<CryptoKey> {
|
async function classAesKey(bundleKey: Uint8Array<ArrayBuffer>, classKey: string): Promise<CryptoKey> {
|
||||||
const prefix = new TextEncoder().encode(`tq-v1:${classKey}`);
|
const prefix = new TextEncoder().encode(`tq-v1:${classKey}`);
|
||||||
const material = new Uint8Array(bundleKey.length + 1 + prefix.length);
|
const material = new Uint8Array(bundleKey.length + 1 + prefix.length);
|
||||||
material.set(bundleKey, 0);
|
material.set(bundleKey, 0);
|
||||||
@@ -31,7 +31,7 @@ async function classAesKey(bundleKey: Uint8Array, classKey: string): Promise<Cry
|
|||||||
return crypto.subtle.importKey("raw", raw, "AES-GCM", false, ["encrypt", "decrypt"]);
|
return crypto.subtle.importKey("raw", raw, "AES-GCM", false, ["encrypt", "decrypt"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function compressUtf8(json: string): Promise<Uint8Array> {
|
async function compressUtf8(json: string): Promise<Uint8Array<ArrayBuffer>> {
|
||||||
const input = new TextEncoder().encode(json);
|
const input = new TextEncoder().encode(json);
|
||||||
if (typeof CompressionStream === "undefined") return input;
|
if (typeof CompressionStream === "undefined") return input;
|
||||||
const stream = new Blob([input]).stream().pipeThrough(new CompressionStream("deflate"));
|
const stream = new Blob([input]).stream().pipeThrough(new CompressionStream("deflate"));
|
||||||
@@ -39,7 +39,7 @@ async function compressUtf8(json: string): Promise<Uint8Array> {
|
|||||||
return new Uint8Array(buf);
|
return new Uint8Array(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function decompressUtf8(bytes: Uint8Array): Promise<string> {
|
async function decompressUtf8(bytes: Uint8Array<ArrayBuffer>): Promise<string> {
|
||||||
if (typeof DecompressionStream === "undefined") {
|
if (typeof DecompressionStream === "undefined") {
|
||||||
return new TextDecoder().decode(bytes);
|
return new TextDecoder().decode(bytes);
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ export type RelayWireBundle = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function encryptClassBundle(
|
export async function encryptClassBundle(
|
||||||
bundleKey: Uint8Array,
|
bundleKey: Uint8Array<ArrayBuffer>,
|
||||||
classKey: string,
|
classKey: string,
|
||||||
plaintext: Record<string, unknown>,
|
plaintext: Record<string, unknown>,
|
||||||
): Promise<RelayWireBundle> {
|
): Promise<RelayWireBundle> {
|
||||||
@@ -73,7 +73,7 @@ export async function encryptClassBundle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function decryptClassBundle(
|
export async function decryptClassBundle(
|
||||||
bundleKey: Uint8Array,
|
bundleKey: Uint8Array<ArrayBuffer>,
|
||||||
bundle: RelayWireBundle,
|
bundle: RelayWireBundle,
|
||||||
): Promise<Record<string, unknown> | null> {
|
): Promise<Record<string, unknown> | null> {
|
||||||
try {
|
try {
|
||||||
@@ -91,7 +91,7 @@ export async function decryptClassBundle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function buildEncryptedBundlesForClasses(input: {
|
export async function buildEncryptedBundlesForClasses(input: {
|
||||||
bundleKey: Uint8Array;
|
bundleKey: Uint8Array<ArrayBuffer>;
|
||||||
seqtaStudentId: number;
|
seqtaStudentId: number;
|
||||||
personUuid: string;
|
personUuid: string;
|
||||||
cloudUserId: string | null;
|
cloudUserId: string | null;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import localforage, { type LocalForage } from "localforage";
|
import localforage from "localforage";
|
||||||
import { getInstanceHostname } from "@/seqta/utils/feedback/client";
|
import { getInstanceHostname } from "@/seqta/utils/feedback/client";
|
||||||
import type { ArchivedMembers, ClassRosterIndex } from "./rosterMerge";
|
import type { ArchivedMembers, ClassRosterIndex } from "./rosterMerge";
|
||||||
import { getStudentId } from "@/seqta/utils/userInfo";
|
import { getStudentId } from "@/seqta/utils/userInfo";
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ async function maybeHeartbeat(instanceHost: string): Promise<void> {
|
|||||||
async function applyRelaySnapshot(
|
async function applyRelaySnapshot(
|
||||||
instanceHost: string,
|
instanceHost: string,
|
||||||
shares: RelaySnapshotShare[],
|
shares: RelaySnapshotShare[],
|
||||||
bundleKey: Uint8Array,
|
bundleKey: Uint8Array<ArrayBuffer>,
|
||||||
allowedSeqtaIds: ReadonlySet<number>,
|
allowedSeqtaIds: ReadonlySet<number>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
let index = await loadRosterIndex();
|
let index = await loadRosterIndex();
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ interface TimetableOverridesBySubject {
|
|||||||
[description: string]: { room?: string; staff?: string };
|
[description: string]: { room?: string; staff?: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TimetableStorage {
|
|
||||||
timetableOverrides?: TimetableOverrides;
|
|
||||||
timetableOverridesBySubject?: TimetableOverridesBySubject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** SEQTA timetable entries use .teacher and .room as direct children, and data-instance for ci */
|
/** SEQTA timetable entries use .teacher and .room as direct children, and data-instance for ci */
|
||||||
function getRoomAndTeacherElements(entry: HTMLElement): {
|
function getRoomAndTeacherElements(entry: HTMLElement): {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export interface LazyPlugin<T extends PluginSettings = PluginSettings, S = any>
|
|||||||
disableToggle?: boolean;
|
disableToggle?: boolean;
|
||||||
defaultEnabled?: boolean;
|
defaultEnabled?: boolean;
|
||||||
beta?: boolean;
|
beta?: boolean;
|
||||||
loader: () => Promise<{ default: Plugin<T, S> }>;
|
loader: () => Promise<{ default: Pick<Plugin<T, S>, "run"> }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ASSET_LOAD_ERRORS = ["MIME type", "NS_ERROR_CORRUPTED_CONTENT", "preload CSS"];
|
const ASSET_LOAD_ERRORS = ["MIME type", "NS_ERROR_CORRUPTED_CONTENT", "preload CSS"];
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ test.each(["plugin", "master", "performance"])(
|
|||||||
async (disable) => {
|
async (disable) => {
|
||||||
const manager = PluginManager.getInstance();
|
const manager = PluginManager.getInstance();
|
||||||
const id = `pending-${disable}`;
|
const id = `pending-${disable}`;
|
||||||
const storageKey = `plugin.${id}.settings`;
|
const storageKey = `plugin.${id}.settings` as const;
|
||||||
let release!: () => void;
|
let release!: () => void;
|
||||||
let enter!: () => void;
|
let enter!: () => void;
|
||||||
const ready = new Promise<void>((resolve) => {
|
const ready = new Promise<void>((resolve) => {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import type {
|
|||||||
ComponentSetting,
|
ComponentSetting,
|
||||||
HotkeySetting,
|
HotkeySetting,
|
||||||
NumberSetting,
|
NumberSetting,
|
||||||
PluginSettings,
|
|
||||||
SelectSetting,
|
SelectSetting,
|
||||||
StringSetting,
|
StringSetting,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ export interface PluginAPI<T extends PluginSettings, S = any> {
|
|||||||
dispose: () => void;
|
dispose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PluginRunResult = void | (() => void);
|
||||||
|
|
||||||
export interface Plugin<T extends PluginSettings = PluginSettings, S = any> {
|
export interface Plugin<T extends PluginSettings = PluginSettings, S = any> {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -154,7 +156,5 @@ export interface Plugin<T extends PluginSettings = PluginSettings, S = any> {
|
|||||||
disableToggle?: boolean; // Optional flag to show/hide the plugin's enable/disable toggle in settings
|
disableToggle?: boolean; // Optional flag to show/hide the plugin's enable/disable toggle in settings
|
||||||
defaultEnabled?: boolean; // Optional flag to set the plugin's default enabled state
|
defaultEnabled?: boolean; // Optional flag to set the plugin's default enabled state
|
||||||
beta?: boolean; // Optional flag to mark the plugin as beta
|
beta?: boolean; // Optional flag to mark the plugin as beta
|
||||||
run: (
|
run: (api: PluginAPI<T, S>) => PluginRunResult | Promise<PluginRunResult>;
|
||||||
api: PluginAPI<T, S>,
|
|
||||||
) => void | Promise<void> | (() => void) | Promise<() => void>;
|
|
||||||
}
|
}
|
||||||
@@ -505,7 +505,6 @@ function CheckNoticeTextColour(notice: Element) {
|
|||||||
for (const m of mutations)
|
for (const m of mutations)
|
||||||
for (const node of m.removedNodes)
|
for (const node of m.removedNodes)
|
||||||
if (node instanceof Element && noticeContainers.has(node)) {
|
if (node instanceof Element && noticeContainers.has(node)) {
|
||||||
noticeColourObserver!.unobserve(node);
|
|
||||||
noticeContainers.delete(node);
|
noticeContainers.delete(node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import browser from "@/lib/browser";
|
import browser from "@/lib/browser";
|
||||||
import { PRODUCTION_API_BASE, resolveApiBase } from "@/seqta/utils/apiBasePolicy";
|
import { resolveApiBase } from "@/seqta/utils/apiBasePolicy";
|
||||||
|
|
||||||
export { PRODUCTION_API_BASE } from "@/seqta/utils/apiBasePolicy";
|
export { PRODUCTION_API_BASE } from "@/seqta/utils/apiBasePolicy";
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,15 @@ export type BadgeItem = {
|
|||||||
awarded_at?: number;
|
awarded_at?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type BadgeVisual = (typeof BADGE_TIERS)[number] | (typeof ACHIEVEMENT_BADGES)[number];
|
type BadgeVisual = {
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
rankLabel: string;
|
||||||
|
description: string;
|
||||||
|
base: string;
|
||||||
|
blobs: readonly string[];
|
||||||
|
icon: string;
|
||||||
|
};
|
||||||
|
|
||||||
const TIER_BY_KEY = new Map(BADGE_TIERS.map((t) => [t.key, t]));
|
const TIER_BY_KEY = new Map(BADGE_TIERS.map((t) => [t.key, t]));
|
||||||
const VISUAL_BY_KEY = new Map<string, BadgeVisual>([
|
const VISUAL_BY_KEY = new Map<string, BadgeVisual>([
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
GOOGLE_CALENDAR_API,
|
GOOGLE_CALENDAR_API,
|
||||||
} from "@/config/googleCalendar";
|
} from "@/config/googleCalendar";
|
||||||
|
|
||||||
type GoogleCalendarResource = { id?: string; summary?: string };
|
type GoogleCalendarResource = { id?: string; summary?: string } & GoogleApiError;
|
||||||
type GoogleCalendarListResponse = { items?: GoogleCalendarResource[] };
|
type GoogleCalendarListResponse = { items?: GoogleCalendarResource[] };
|
||||||
type GoogleApiError = { error?: { message?: string } };
|
type GoogleApiError = { error?: { message?: string } };
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { applySelectedFont } from "@/seqta/ui/fonts/Manager";
|
|||||||
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
||||||
import { FilterUpcomingAssessments } from "@/seqta/utils/FilterUpcomingAssessments";
|
import { FilterUpcomingAssessments } from "@/seqta/utils/FilterUpcomingAssessments";
|
||||||
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/LoadHomePage";
|
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/LoadHomePage";
|
||||||
import { applyMenuItemVisibility, scheduleMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
import { scheduleMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
||||||
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||||
import { syncPerformanceModeEffects } from "@/seqta/utils/performanceMode";
|
import { syncPerformanceModeEffects } from "@/seqta/utils/performanceMode";
|
||||||
|
|
||||||
|
|||||||
@@ -632,26 +632,15 @@ async function CreateUpcomingSection(assessments: any, activeSubjects: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterSubjects = subjectsWithUpcomingAssessments(
|
const filterSubjects = subjectsWithUpcomingAssessments(assessments, activeSubjects).map(
|
||||||
assessments,
|
(subject) => {
|
||||||
activeSubjects,
|
const colour = colours.find(
|
||||||
|
(c: any) => c.name === `timetable.subject.colour.${subject.code}`,
|
||||||
|
);
|
||||||
|
return { code: subject.code, colour: `--item-colour: ${colour?.value ?? "#8e8e8e"};` };
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
for (let i = 0; i < filterSubjects.length; i++) {
|
|
||||||
const element = filterSubjects[i];
|
|
||||||
const colour = colours.find(
|
|
||||||
(c: any) => c.name === `timetable.subject.colour.${element.code}`,
|
|
||||||
);
|
|
||||||
if (!colour) {
|
|
||||||
element.colour = "--item-colour: #8e8e8e;";
|
|
||||||
} else {
|
|
||||||
element.colour = `--item-colour: ${colour.value};`;
|
|
||||||
if (GetThresholdOfColor(colour.value) > 300) {
|
|
||||||
element.invert = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateFilters(filterSubjects);
|
CreateFilters(filterSubjects);
|
||||||
|
|
||||||
for (let i = 0; i < assessments.length; i++) {
|
for (let i = 0; i < assessments.length; i++) {
|
||||||
@@ -828,7 +817,7 @@ async function GetLessonColours() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateFilters(subjects: { code: string }[]) {
|
function CreateFilters(subjects: { code: string; colour: string }[]) {
|
||||||
const filteroptions = { ...settingsState.subjectfilters };
|
const filteroptions = { ...settingsState.subjectfilters };
|
||||||
const filterdiv = document.querySelector("#upcoming-filters");
|
const filterdiv = document.querySelector("#upcoming-filters");
|
||||||
if (!filterdiv) return;
|
if (!filterdiv) return;
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ function createMenuSortable(): Sortable | undefined {
|
|||||||
try {
|
try {
|
||||||
const el = document.querySelector("#menu > ul");
|
const el = document.querySelector("#menu > ul");
|
||||||
if (!el) return undefined;
|
if (!el) return undefined;
|
||||||
let sortable: Sortable | undefined;
|
const sortable: Sortable = Sortable.create(el as HTMLElement, {
|
||||||
sortable = Sortable.create(el as HTMLElement, {
|
|
||||||
draggable: ".draggable",
|
draggable: ".draggable",
|
||||||
dataIdAttr: "data-key",
|
dataIdAttr: "data-key",
|
||||||
animation: 150,
|
animation: 150,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function attachPopupMediaFullscreen(el: HTMLImageElement | HTMLVideoEleme
|
|||||||
};
|
};
|
||||||
|
|
||||||
el.addEventListener("click", open);
|
el.addEventListener("click", open);
|
||||||
el.addEventListener("keydown", (e) => {
|
(el as HTMLElement).addEventListener("keydown", (e) => {
|
||||||
if (e.key === "Enter" || e.key === " ") {
|
if (e.key === "Enter" || e.key === " ") {
|
||||||
open(e);
|
open(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export function openRemoteCampaignPopup(
|
|||||||
if (btn.action === "url" && btn.url) {
|
if (btn.action === "url" && btn.url) {
|
||||||
window.open(btn.url, "_blank", "noopener,noreferrer");
|
window.open(btn.url, "_blank", "noopener,noreferrer");
|
||||||
} else if (btn.action === "openSettingsSection" && btn.section) {
|
} else if (btn.action === "openSettingsSection" && btn.section) {
|
||||||
requestSettingsDestination({ section: btn.section });
|
requestSettingsDestination({ page: "settings", section: btn.section });
|
||||||
await openSettingsPopup();
|
await openSettingsPopup();
|
||||||
}
|
}
|
||||||
if (campaign.requireAcknowledge) acknowledged = true;
|
if (campaign.requireAcknowledge) acknowledged = true;
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ async function applyRemoteTheme(
|
|||||||
snapshot: RemoteConfigSnapshot,
|
snapshot: RemoteConfigSnapshot,
|
||||||
directive: RemoteThemeDirective,
|
directive: RemoteThemeDirective,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (directive.mode === "off") return;
|
||||||
const key = directiveKey(snapshot, directive);
|
const key = directiveKey(snapshot, directive);
|
||||||
const prior = await loadActiveState();
|
const prior = await loadActiveState();
|
||||||
if (prior?.directiveKey === key) return;
|
if (prior?.directiveKey === key) return;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface SettingsState {
|
export type SettingsState = {
|
||||||
DarkMode: boolean;
|
DarkMode: boolean;
|
||||||
selectedTheme: string;
|
selectedTheme: string;
|
||||||
customshortcuts: CustomShortcut[];
|
customshortcuts: CustomShortcut[];
|
||||||
@@ -110,7 +110,8 @@ export interface SettingsState {
|
|||||||
autoCloudSettingsSync?: boolean;
|
autoCloudSettingsSync?: boolean;
|
||||||
/** When not `false`, show Cloud badges in the SEQTA titlebar (default-on). */
|
/** When not `false`, show Cloud badges in the SEQTA titlebar (default-on). */
|
||||||
showTitlebarFounderBadge?: boolean;
|
showTitlebarFounderBadge?: boolean;
|
||||||
}
|
[pluginKey: `plugin.${string}`]: unknown;
|
||||||
|
};
|
||||||
|
|
||||||
interface ToggleItem {
|
interface ToggleItem {
|
||||||
toggle: boolean;
|
toggle: boolean;
|
||||||
|
|||||||
Reference in new issue
Block a user