mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-07 04:03:49 +10:30
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75aab28446 | ||
|
|
e3a0426e26 | ||
|
|
b6728561d1 | ||
|
|
ccd5c8b1a4 | ||
|
|
49698b9dd3 | ||
|
|
0548d7a699 | ||
|
|
5a72be2117 | ||
|
|
ec0503018d | ||
|
|
032dbab5f5 | ||
|
|
4509632774 | ||
|
|
057548f401 | ||
|
|
d4c01209fd | ||
|
|
ca2a6e763a | ||
|
|
f935d0ad9d | ||
|
|
5bbe1c6a32 | ||
|
|
84922f27d2 | ||
|
|
b383a21d2b | ||
|
|
e4397d91d4 | ||
|
|
f3b875e563 | ||
|
|
80ab0b878c | ||
|
|
991c727267 | ||
|
|
998be36575 | ||
|
|
f4ff4093d4 | ||
|
|
a620274c9f | ||
|
|
9acebab94b | ||
|
|
f0abb8f6f3 | ||
|
|
4c3f91f2f6 | ||
|
|
c12793de06 | ||
|
|
1d17e0e7c4 | ||
|
|
e41abd37b9 | ||
|
|
e70ab3e86c | ||
|
|
3023e12407 | ||
|
|
261584666f | ||
|
|
175df9fb47 | ||
|
|
dc5c16ff1a | ||
|
|
a5dfb38791 | ||
|
|
9fd51512e3 | ||
|
|
a2b604a87a | ||
|
|
c223a4ccae | ||
|
|
41553a8fc4 | ||
|
|
bfe8e3645b | ||
|
|
7198822d87 | ||
|
|
26d06d2aab | ||
|
|
c8d174f871 | ||
|
|
54359d51c4 | ||
|
|
64126439c6 | ||
|
|
086a3c90ba | ||
|
|
deafdd27a0 | ||
|
|
6df36716b8 | ||
|
|
31b8c96050 | ||
|
|
3b8517496f | ||
|
|
10134ac116 | ||
|
|
2ca4f0a621 |
No files matched your search
@@ -2,6 +2,10 @@ name: Build Extension
|
||||
description: Install dependencies, build Chrome and Firefox extensions, and package zips.
|
||||
|
||||
inputs:
|
||||
include_sources:
|
||||
description: Include the committed source and Firefox build instructions.
|
||||
required: false
|
||||
default: "false"
|
||||
gh_release_update_check:
|
||||
description: Enable GitHub release update checker in the built extension.
|
||||
required: false
|
||||
@@ -29,6 +33,9 @@ outputs:
|
||||
firefox_zip:
|
||||
description: Path to the Firefox extension zip
|
||||
value: ${{ steps.zip.outputs.firefox_zip }}
|
||||
sources_zip:
|
||||
description: Path to the Firefox source zip when include_sources is true
|
||||
value: ${{ steps.zip.outputs.sources_zip }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
@@ -56,4 +63,4 @@ runs:
|
||||
env:
|
||||
UPDATE_CHANNEL: ${{ inputs.update_channel }}
|
||||
BUILD_LABEL: ${{ inputs.build_label }}
|
||||
run: node scripts/package-extension-zips.mjs "${{ steps.version.outputs.version }}"
|
||||
run: node scripts/package-extension-zips.mjs "${{ steps.version.outputs.version }}" "${{ inputs.include_sources == 'true' && '--sources' || '' }}"
|
||||
@@ -15,8 +15,6 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
permissions:
|
||||
contents: read
|
||||
# The layerchart Svelte build fails on Linux, so CI runs on Windows.
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
@@ -32,8 +30,6 @@ jobs:
|
||||
uses: ./.github/actions/run-lint
|
||||
|
||||
unit-tests:
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -48,8 +44,6 @@ jobs:
|
||||
uses: ./.github/actions/run-unit-tests
|
||||
|
||||
build-and-smoke:
|
||||
permissions:
|
||||
contents: read
|
||||
needs: [lint, unit-tests]
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
name: Publish Stores
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: store-release-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.event_name == 'workflow_dispatch' || !github.event.release.prerelease
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: write
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
outputs:
|
||||
publisher_version: ${{ steps.publisher.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check release version
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: test "${RELEASE_TAG#v}" = "$(node -p "require('./package.json').version")"
|
||||
|
||||
- name: Build store packages
|
||||
id: build
|
||||
uses: ./.github/actions/build-extension
|
||||
with:
|
||||
include_sources: "true"
|
||||
|
||||
- name: Check build
|
||||
run: npm run lint && npm run test:unit && npm run test:smoke
|
||||
|
||||
- name: Verify Firefox source rebuild
|
||||
env:
|
||||
SOURCES_ZIP: ${{ steps.build.outputs.sources_zip }}
|
||||
run: |
|
||||
mkdir "$RUNNER_TEMP/source-rebuild"
|
||||
powershell -NoProfile -Command 'Expand-Archive -LiteralPath $env:SOURCES_ZIP -DestinationPath "$env:RUNNER_TEMP/source-rebuild"'
|
||||
cd "$RUNNER_TEMP/source-rebuild"
|
||||
npm ci
|
||||
npm run build:firefox
|
||||
diff -ru "$GITHUB_WORKSPACE/dist/firefox" dist/firefox
|
||||
|
||||
- name: Record publisher version and package checksums
|
||||
id: publisher
|
||||
run: |
|
||||
echo "version=$(node -p "require('./node_modules/publish-browser-extension/package.json').version")" >> "$GITHUB_OUTPUT"
|
||||
echo "Commit: $GITHUB_SHA" >> "$GITHUB_STEP_SUMMARY"
|
||||
sha256sum dist/*.zip | tee -a "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Upload review artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: store-packages
|
||||
path: dist/*.zip
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Attach packages to release
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: gh release upload "$RELEASE_TAG" dist/*.zip --clobber
|
||||
|
||||
publish:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment: store-publishing
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
store: [chrome, firefox]
|
||||
env:
|
||||
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: 26.x
|
||||
|
||||
- uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: store-packages
|
||||
path: dist
|
||||
|
||||
- name: Install publisher without lifecycle scripts
|
||||
env:
|
||||
PUBLISHER_VERSION: ${{ needs.build.outputs.publisher_version }}
|
||||
run: npm install --prefix "$RUNNER_TEMP/publisher" --ignore-scripts --no-audit --no-fund "publish-browser-extension@$PUBLISHER_VERSION"
|
||||
|
||||
- name: Submit Chrome
|
||||
if: matrix.store == 'chrome'
|
||||
env:
|
||||
CHROME_API_VERSION: v2
|
||||
CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
|
||||
CHROME_PUBLISHER_ID: ${{ secrets.CHROME_PUBLISHER_ID }}
|
||||
CHROME_SERVICE_ACCOUNT_CLIENT_EMAIL: ${{ secrets.CHROME_SERVICE_ACCOUNT_CLIENT_EMAIL }}
|
||||
CHROME_SERVICE_ACCOUNT_PRIVATE_KEY: ${{ secrets.CHROME_SERVICE_ACCOUNT_PRIVATE_KEY }}
|
||||
run: '"$RUNNER_TEMP/publisher/node_modules/.bin/publish-extension" --chrome-zip dist/*-chrome.zip --dry-run "$DRY_RUN"'
|
||||
|
||||
- name: Submit Firefox with sources
|
||||
if: matrix.store == 'firefox'
|
||||
env:
|
||||
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }}
|
||||
FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }}
|
||||
FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }}
|
||||
FIREFOX_CHANNEL: listed
|
||||
run: '"$RUNNER_TEMP/publisher/node_modules/.bin/publish-extension" --firefox-zip dist/*-firefox.zip --firefox-sources-zip dist/*-sources.zip --dry-run "$DRY_RUN"'
|
||||
@@ -18,6 +18,7 @@ src/public/resources/pdfjs/pdf.worker.min.mjs
|
||||
.env.submit
|
||||
|
||||
# Editors and OS
|
||||
.claude/
|
||||
.cursor/
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"ignorePatterns": [
|
||||
"betterseqtaplus-safari/",
|
||||
"coverage/",
|
||||
"dist/",
|
||||
"package-lock.json",
|
||||
"src/public/"
|
||||
]
|
||||
"ignorePatterns": ["package-lock.json", "src/public/"]
|
||||
}
|
||||
+2
-19
@@ -1,33 +1,16 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": ["typescript", "unicorn", "oxc", "import"],
|
||||
"categories": {
|
||||
"correctness": "error"
|
||||
},
|
||||
"env": {
|
||||
"builtin": true,
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"__ENABLE_GH_RELEASE_UPDATE_CHECK__": "readonly",
|
||||
"__GH_RELEASE_REPO__": "readonly",
|
||||
"__UPDATE_CHANNEL__": "readonly",
|
||||
"__BUILD_LABEL__": "readonly",
|
||||
"__GOOGLE_OAUTH_CLIENT_ID__": "readonly",
|
||||
"__OUTLOOK_OAUTH_CLIENT_ID__": "readonly"
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"ignoreRestSiblings": true,
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"caughtErrors": "none"
|
||||
"ignoreRestSiblings": true
|
||||
}
|
||||
],
|
||||
"import/default": "off"
|
||||
]
|
||||
},
|
||||
"ignorePatterns": ["src/public/**"]
|
||||
}
|
||||
@@ -9,7 +9,7 @@ Exhaustive reference for every value that **is** or **would be** included in a B
|
||||
- Auto-sync (debounce, poll, triggers): `src/background/cloudSettingsAutoSync.ts`
|
||||
- Core defaults: `src/seqta/utils/defaultSettings.ts`
|
||||
- Full-schema initializer: `src/seqta/utils/ensureSyncableStorageDefaults.ts`
|
||||
- In-memory settings + persistence: `src/seqta/utils/listeners/SettingsState.ts`
|
||||
- In-memory settings + persistence: `src/seqta/utils/listeners/settingsState.ts`
|
||||
- Type definitions: `src/types/storage.ts`
|
||||
|
||||
---
|
||||
@@ -488,13 +488,13 @@ Keys (from `SettingsState`):
|
||||
|
||||
#### `shortcuts`
|
||||
|
||||
| | |
|
||||
| -------------- | ------------------------------------------------------------------------------------- |
|
||||
| **Type** | `array` |
|
||||
| **Default** | Outlook, Office, Google — each `enabled: true` |
|
||||
| **UI** | Settings → Shortcuts |
|
||||
| **Item shape** | `{ "name": string, "enabled": boolean }` |
|
||||
| **Notes** | `name` matches keys in `src/seqta/content/links.json` (e.g. `"Outlook"`, `"YouTube"`) |
|
||||
| | |
|
||||
| -------------- | ------------------------------------------------------------------------------------ |
|
||||
| **Type** | `array` |
|
||||
| **Default** | Outlook, Office, Google — each `enabled: true` |
|
||||
| **UI** | Settings → Shortcuts |
|
||||
| **Item shape** | `{ "name": string, "enabled": boolean }` |
|
||||
| **Notes** | `name` matches keys in `src/seqta/content/links.json` (e.g. `"Outlook"`, `"Google"`) |
|
||||
|
||||
**Example:**
|
||||
|
||||
@@ -1195,7 +1195,7 @@ Implementation: `ensureSyncableStorageDefaults()` + `getSyncableStorageDefaults(
|
||||
|
||||
### Settings persistence and live UI
|
||||
|
||||
`SettingsState` (`src/seqta/utils/listeners/SettingsState.ts`):
|
||||
`SettingsState` (`src/seqta/utils/listeners/settingsState.ts`):
|
||||
|
||||
- Assignments (`settingsState.foo = …`) and `setKey()` persist to `chrome.storage.local` and **notify registered listeners** in the same context (required for embedded SEQTA settings).
|
||||
- `saveToStorage()` omits `undefined` values so optional keys are not accidentally stripped.
|
||||
@@ -0,0 +1,33 @@
|
||||
# Calendar sync manual QA
|
||||
|
||||
Run these checks before merging calendar sync changes. Use a school SEQTA account with Google Calendar and/or Outlook connected in BetterSEQTA+ settings.
|
||||
|
||||
## Dual-tab overlap (duplicate prevention)
|
||||
|
||||
1. Open SEQTA in **Tab A** and wait for an automatic calendar sync to start (or trigger **Sync now** from settings).
|
||||
2. Open the **same school** SEQTA origin in **Tab B** while Tab A is still syncing.
|
||||
3. In Tab B, click **Sync now** for the same provider.
|
||||
4. **Expected:** Tab B shows an error that sync is already running in another tab (no new duplicate events).
|
||||
5. After Tab A finishes, sync from Tab B should succeed.
|
||||
|
||||
## Same-tab overlap
|
||||
|
||||
1. With one tab open, click **Sync now** twice quickly (or trigger sync while page-load sync is still running).
|
||||
2. **Expected:** Only one sync runs; no duplicate calendar events for the same lessons.
|
||||
|
||||
## Google and Outlook together
|
||||
|
||||
1. Connect **both** Google and Outlook if available.
|
||||
2. Start sync for Google, then immediately start sync for Outlook (same or different tabs).
|
||||
3. **Expected:** Both providers can sync concurrently; neither blocks the other.
|
||||
|
||||
## Resume after interrupted sync
|
||||
|
||||
1. Start a full sync, then close the tab mid-sync (or kill the tab process).
|
||||
2. Wait longer than the heartbeat stale window (~45s) without another tab syncing.
|
||||
3. Reload SEQTA.
|
||||
4. **Expected:** Sync resumes or can be started cleanly without duplicate events piling up.
|
||||
|
||||
## Duplicate cleanup (optional)
|
||||
|
||||
If duplicates already exist from an older build, run a full sync once and confirm extra remote events for the same lesson are removed from the calendar.
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { build } from "esbuild";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
/** Bundle worker entry points imported with `?inlineWorker` as Blob-backed Workers in dev. */
|
||||
export default function InlineWorkerDevPlugin(): Plugin {
|
||||
export default function inlineWorkerDevPlugin(): Plugin {
|
||||
return {
|
||||
name: "vite:inline-worker-dev",
|
||||
async load(id) {
|
||||
|
||||
+32
-155
@@ -1,158 +1,35 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* This script is a command-line utility for publishing the BetterSEQTA+ extension.
|
||||
* It automates the process of finding the latest built extension ZIP files for specified
|
||||
* browsers, zipping the project source code (for Firefox), and then invoking the
|
||||
* `publish-extension` tool with the appropriate arguments.
|
||||
*
|
||||
* To use this script, invoke it with Node.js followed by browser arguments:
|
||||
* e.g., `node lib/publish.js --b chrome firefox`
|
||||
* or `node lib/publish.js --b chrome`
|
||||
* or `node lib/publish.js --b firefox`
|
||||
*/
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { globSync } from "node:fs";
|
||||
import semver from "semver";
|
||||
import { execSync } from "node:child_process";
|
||||
|
||||
function getLatestVersion(files) {
|
||||
console.log("Files passed to getLatestVersion:", files);
|
||||
|
||||
const versions = files
|
||||
.map((file) => {
|
||||
const match = file.match(/@([\d.]+)-/);
|
||||
console.log("Matching file:", file, "Version found:", match ? match[1] : "None");
|
||||
|
||||
if (!match) return null;
|
||||
|
||||
const fullVersion = match[1]; // Original version (e.g., 3.4.5.1)
|
||||
// Trim to 3 parts for semver comparison, as semver typically handles X.Y.Z
|
||||
const semverVersion = fullVersion.split(".").slice(0, 3).join(".");
|
||||
|
||||
return { fullVersion, semverVersion };
|
||||
})
|
||||
.filter(Boolean); // Remove null entries if any file didn't match
|
||||
|
||||
console.log(
|
||||
"Extracted versions:",
|
||||
versions.map((v) => v.semverVersion),
|
||||
);
|
||||
|
||||
if (versions.length === 0) {
|
||||
console.log("No versions extracted.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find latest version using the trimmed semver format
|
||||
const latestSemver = semver.maxSatisfying(
|
||||
versions.map((v) => v.semverVersion),
|
||||
"*", // Satisfy any version, effectively finding the max
|
||||
);
|
||||
console.log("Latest SemVer-compatible version:", latestSemver);
|
||||
|
||||
if (!latestSemver) {
|
||||
console.log("Could not determine latest semver version.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the original full version string that matches the identified latest SemVer version
|
||||
const latestVersionData = versions.find((v) => v.semverVersion === latestSemver);
|
||||
const latestFullVersion = latestVersionData ? latestVersionData.fullVersion : null;
|
||||
|
||||
console.log("Final selected latest version:", latestFullVersion);
|
||||
return latestFullVersion;
|
||||
}
|
||||
|
||||
function getLatestFiles(browser) {
|
||||
const pattern = `dist/betterseqtaplus@*-*${browser}.zip`;
|
||||
console.log("Glob pattern:", pattern);
|
||||
|
||||
const files = globSync(pattern);
|
||||
console.log("Files found for browser", browser, ":", files);
|
||||
|
||||
if (files.length === 0) {
|
||||
console.log("No files found for browser", browser);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const latestVersion = getLatestVersion(files);
|
||||
if (!latestVersion) {
|
||||
console.log("Could not determine latest version for browser", browser);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Find the exact file by matching the original full version string
|
||||
const latestFile = files.find((file) => file.includes(`@${latestVersion}-`));
|
||||
|
||||
console.log("Latest file for browser", browser, ":", latestFile);
|
||||
return latestFile;
|
||||
}
|
||||
|
||||
function zipSources() {
|
||||
const zipFileName = `dist/betterseqtaplus@latest-sources.zip`;
|
||||
|
||||
const excludePatterns = [
|
||||
"node_modules",
|
||||
"dist",
|
||||
".env*",
|
||||
".git",
|
||||
".github",
|
||||
".vscode",
|
||||
"LICENSE",
|
||||
"package.json",
|
||||
]
|
||||
.map((pattern) => `-x!${pattern}`) // Format for 7z exclude syntax
|
||||
.join(" ");
|
||||
|
||||
// Command to zip the current directory's contents into zipFileName, applying exclude patterns
|
||||
const zipCommand = `7zz a ${zipFileName} . ${excludePatterns}`;
|
||||
|
||||
console.log("Zipping project sources with command:", zipCommand);
|
||||
execSync(zipCommand, { stdio: "inherit" }); // Execute synchronously and show output
|
||||
|
||||
return zipFileName;
|
||||
}
|
||||
|
||||
function runPublishCommand(browsers) {
|
||||
const chromeZip = browsers.includes("chrome") ? getLatestFiles("chrome") : null;
|
||||
const firefoxZip = browsers.includes("firefox") ? getLatestFiles("firefox") : null;
|
||||
// Sources are typically only needed for Firefox submissions
|
||||
const firefoxSourcesZip = browsers.includes("firefox") ? zipSources() : null;
|
||||
|
||||
console.log("Chrome zip:", chromeZip);
|
||||
console.log("Firefox zip:", firefoxZip);
|
||||
console.log("Firefox sources zip:", firefoxSourcesZip);
|
||||
|
||||
if (browsers.length === 0) {
|
||||
console.log("No browsers specified. Exiting.");
|
||||
process.exit(0); // Exit gracefully if no action is needed
|
||||
}
|
||||
|
||||
// Check if required files are missing for the specified browsers
|
||||
if (
|
||||
(browsers.includes("chrome") && !chromeZip) ||
|
||||
(browsers.includes("firefox") && (!firefoxZip || !firefoxSourcesZip))
|
||||
) {
|
||||
console.error("Could not find required zip files for specified browsers.");
|
||||
process.exit(1); // Exit with error status
|
||||
}
|
||||
|
||||
let command = "publish-extension";
|
||||
if (chromeZip) {
|
||||
command += ` --chrome-zip ${chromeZip}`;
|
||||
}
|
||||
if (firefoxZip && firefoxSourcesZip) {
|
||||
command += ` --firefox-zip ${firefoxZip} --firefox-sources-zip ${firefoxSourcesZip}`;
|
||||
}
|
||||
|
||||
console.log("Running command:", command);
|
||||
execSync(command, { stdio: "inherit" }); // Execute and show output
|
||||
}
|
||||
|
||||
// Parse command-line arguments to determine which browsers to publish for
|
||||
process.chdir(fileURLToPath(new URL("..", import.meta.url)));
|
||||
const args = process.argv.slice(2);
|
||||
const browserIndex = args.indexOf("--b"); // Find the --b flag
|
||||
// If --b is found, take all subsequent arguments as browser names
|
||||
const browsers = browserIndex !== -1 ? args.slice(browserIndex + 1) : [];
|
||||
const browsers = args.filter((arg) => arg !== "--b" && arg !== "--dry-run");
|
||||
if (!browsers.length || browsers.some((browser) => !["chrome", "firefox"].includes(browser))) {
|
||||
throw new Error("Usage: npm run publish -- chrome firefox [--dry-run]");
|
||||
}
|
||||
|
||||
runPublishCommand(browsers);
|
||||
const { name, version } = JSON.parse(readFileSync("package.json", "utf8"));
|
||||
if (browsers.includes("firefox")) {
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
["scripts/package-extension-zips.mjs", version, "--sources-only"],
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const flags = browsers.flatMap((browser) => [
|
||||
`--${browser}-zip`,
|
||||
`dist/${name}@${version}-${browser}.zip`,
|
||||
]);
|
||||
if (browsers.includes("firefox")) {
|
||||
flags.push("--firefox-sources-zip", `dist/${name}@${version}-sources.zip`);
|
||||
}
|
||||
if (args.includes("--dry-run")) flags.push("--dry-run");
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
[fileURLToPath(import.meta.resolve("publish-browser-extension/cli")), ...flags],
|
||||
{ stdio: "inherit" },
|
||||
);
|
||||
Generated
+412
-598
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "betterseqtaplus",
|
||||
"version": "3.7.6",
|
||||
"version": "3.7.7",
|
||||
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development and add heaps more features!",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
@@ -31,7 +31,7 @@
|
||||
"test:unit": "cross-env NODE_OPTIONS=--no-experimental-webstorage jest",
|
||||
"test:smoke": "node scripts/smoke-test.mjs",
|
||||
"test:ci": "npm run test:unit && npm run build && npm run test:smoke",
|
||||
"release": "gh release create $npm_package_version --repo BetterSEQTA/BetterSEQTA-Plus ./dist/*.zip --generate-notes",
|
||||
"release": "gh release create $npm_package_version --repo BetterSEQTA/BetterSEQTA-Plus --generate-notes",
|
||||
"publish": "node lib/publish.js --b",
|
||||
"zip": "node scripts/package-extension-zips.mjs"
|
||||
},
|
||||
@@ -67,7 +67,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@crxjs/vite-plugin": "^3.0.0",
|
||||
"@jest/globals": "30.5.2",
|
||||
"@jest/globals": "^30.5.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
||||
"@tailwindcss/forms": "^0.5.11",
|
||||
"@tailwindcss/postcss": "^4.3.3",
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
* Package Chrome/Firefox build folders into Windows-friendly zip files.
|
||||
*/
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { appendFileSync, existsSync, mkdirSync, readFileSync, unlinkSync } from "node:fs";
|
||||
import {
|
||||
appendFileSync,
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
readdirSync,
|
||||
readFileSync,
|
||||
unlinkSync,
|
||||
} from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -12,22 +19,16 @@ function zipDirectory(sourceRel, outRel) {
|
||||
const sourceDir = join(root, sourceRel);
|
||||
const outZip = join(root, outRel);
|
||||
if (!existsSync(sourceDir)) throw new Error(`Missing build output: ${sourceRel}`);
|
||||
const manifest = JSON.parse(readFileSync(join(sourceDir, "manifest.json"), "utf8"));
|
||||
if (manifest.version !== version) throw new Error(`Rebuild ${sourceRel} for version ${version}`);
|
||||
|
||||
mkdirSync(dirname(outZip), { recursive: true });
|
||||
if (existsSync(outZip)) unlinkSync(outZip);
|
||||
|
||||
if (process.platform === "win32") {
|
||||
const esc = (s) => s.replace(/'/g, "''");
|
||||
execFileSync(
|
||||
"powershell",
|
||||
[
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
[
|
||||
"Add-Type -AssemblyName System.IO.Compression.FileSystem",
|
||||
`[IO.Compression.ZipFile]::CreateFromDirectory('${esc(sourceDir)}', '${esc(outZip)}')`,
|
||||
].join("; "),
|
||||
],
|
||||
join(process.env.SystemRoot, "System32", "tar.exe"),
|
||||
["-a", "-cf", outZip, "-C", sourceDir, "--", ...readdirSync(sourceDir)],
|
||||
{ stdio: "inherit" },
|
||||
);
|
||||
} else {
|
||||
@@ -47,10 +48,41 @@ const base =
|
||||
const chromeZip = `dist/${base}-chrome.zip`;
|
||||
const firefoxZip = `dist/${base}-firefox.zip`;
|
||||
|
||||
zipDirectory("dist/chrome", chromeZip);
|
||||
zipDirectory("dist/firefox", firefoxZip);
|
||||
console.log(`Packaged ${chromeZip}\nPackaged ${firefoxZip}`);
|
||||
if (!process.argv.includes("--sources-only")) {
|
||||
zipDirectory("dist/chrome", chromeZip);
|
||||
zipDirectory("dist/firefox", firefoxZip);
|
||||
console.log(`Packaged ${chromeZip}\nPackaged ${firefoxZip}`);
|
||||
}
|
||||
|
||||
const sourcesZip = `dist/${base}-sources.zip`;
|
||||
if (process.argv.includes("--sources") || process.argv.includes("--sources-only")) {
|
||||
// Archive the committed source only, never local credentials or dependency folders.
|
||||
execFileSync("git", ["diff", "--quiet", "HEAD", "--"], { cwd: root, stdio: "inherit" });
|
||||
mkdirSync(join(root, "dist"), { recursive: true });
|
||||
const instructions =
|
||||
`Build environment: ${process.platform} ${process.arch}, Node.js ${process.version}.\n` +
|
||||
"On Windows, run these commands in Git Bash:\n\n" +
|
||||
"npm ci\n" +
|
||||
"GH_RELEASE_UPDATE_CHECK=false UPDATE_CHANNEL=stable npm run build\n\n" +
|
||||
"Firefox output: dist/firefox. No .env file is required.\n";
|
||||
execFileSync(
|
||||
"git",
|
||||
[
|
||||
"archive",
|
||||
"--format=zip",
|
||||
"--output",
|
||||
join(root, sourcesZip),
|
||||
`--add-virtual-file=BUILD.txt:${instructions}`,
|
||||
"HEAD",
|
||||
],
|
||||
{ cwd: root, stdio: "inherit" },
|
||||
);
|
||||
console.log(`Packaged ${sourcesZip}`);
|
||||
}
|
||||
|
||||
if (process.env.GITHUB_OUTPUT) {
|
||||
appendFileSync(process.env.GITHUB_OUTPUT, `chrome_zip=${chromeZip}\nfirefox_zip=${firefoxZip}\n`);
|
||||
appendFileSync(
|
||||
process.env.GITHUB_OUTPUT,
|
||||
`chrome_zip=${chromeZip}\nfirefox_zip=${firefoxZip}\nsources_zip=${sourcesZip}\n`,
|
||||
);
|
||||
}
|
||||
+38
-86
@@ -19,36 +19,13 @@ import {
|
||||
registerOutlookCalendarMessageHandlers,
|
||||
type CalendarMessageHandlerMap,
|
||||
} from "./background/calendarBackground";
|
||||
import { API_BASE } from "./config/apiBase";
|
||||
import { createCustomThemesHandlers } from "./background/customThemesHandlers";
|
||||
import {
|
||||
createRemoteConfigHandlers,
|
||||
initRemoteConfigBackground,
|
||||
refreshRemoteConfig,
|
||||
} from "./background/remoteConfig";
|
||||
import { BSPLUS_INSTALL_REGISTERED_AT_KEY } from "@/seqta/utils/remoteConfig/storageKeys";
|
||||
import { DEFAULT_BACKGROUND_PENDING_KEY } from "@/seqta/ui/defaultBackgroundKey";
|
||||
import { handleSearchThemeStockPhotos } from "./background/searchThemeStockPhotos";
|
||||
import { bsplusApiQueryParams, withBsplusApiQuery } from "@/seqta/utils/bsplusClientContext";
|
||||
import { initTimetableClassmatesBackgroundSync } from "./background/timetableClassmatesSync";
|
||||
import { runStorageMigrations } from "./background/storageMigrations";
|
||||
|
||||
/**
|
||||
* Session-only dev-mode override of the content API base.
|
||||
*
|
||||
* Stored in a module-level variable (not `chrome.storage`) so it is wiped
|
||||
* automatically when the browser/service-worker process restarts. Content
|
||||
* scripts re-sync this on every page load via `setDevApiBase` so the value
|
||||
* survives transient service-worker terminations within the same browser
|
||||
* session.
|
||||
*/
|
||||
const DEFAULT_API_BASE = "https://betterseqta.org";
|
||||
let DEV_API_BASE: string | null = null;
|
||||
function apiBase(): string {
|
||||
// Extension dev builds always hit production (see DevApiBase.ts).
|
||||
if (import.meta.env.DEV) return DEFAULT_API_BASE;
|
||||
return DEV_API_BASE ?? DEFAULT_API_BASE;
|
||||
}
|
||||
|
||||
function reloadSeqtaPages() {
|
||||
const result = browser.tabs.query({});
|
||||
function open(tabs: chrome.tabs.Tab[]) {
|
||||
@@ -113,11 +90,7 @@ function normalizeFetchThemesResponse(json: unknown): {
|
||||
function handleFetchThemes(_request: unknown, sendResponse: MessageSender): boolean {
|
||||
void (async () => {
|
||||
const token = await getAccessTokenFromStorage();
|
||||
const params = await bsplusApiQueryParams();
|
||||
params.set("type", "betterseqta");
|
||||
params.set("limit", "100");
|
||||
params.set("nocache", String(Date.now()));
|
||||
const apiUrl = `${apiBase()}/api/themes?${params}`;
|
||||
const apiUrl = `${API_BASE}/api/themes?type=betterseqta&limit=100&nocache=${Date.now()}`;
|
||||
const githubUrl = `https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/themes.json?nocache=${Date.now()}`;
|
||||
const headers: Record<string, string> = {};
|
||||
if (token) headers["Authorization"] = `Bearer ${token}`;
|
||||
@@ -138,7 +111,10 @@ function handleFetchThemes(_request: unknown, sendResponse: MessageSender): bool
|
||||
})
|
||||
.then(sendResponse)
|
||||
.catch((err) => {
|
||||
console.warn("[Background] fetchThemes API failed, trying GitHub fallback:", err?.message);
|
||||
console.warn(
|
||||
"[BetterSEQTA+] Background: fetchThemes API failed, trying GitHub fallback:",
|
||||
err?.message,
|
||||
);
|
||||
fetch(githubUrl, { cache: "no-store" })
|
||||
.then(async (r) => {
|
||||
if (!r.ok) throw new Error(`GitHub fallback HTTP ${r.status}`);
|
||||
@@ -148,7 +124,10 @@ function handleFetchThemes(_request: unknown, sendResponse: MessageSender): bool
|
||||
})
|
||||
.then(sendResponse)
|
||||
.catch((fallbackErr) => {
|
||||
console.error("[Background] fetchThemes GitHub fallback error:", fallbackErr);
|
||||
console.error(
|
||||
"[BetterSEQTA+] Background: fetchThemes GitHub fallback error:",
|
||||
fallbackErr,
|
||||
);
|
||||
sendResponse({ success: false, error: fallbackErr?.message });
|
||||
});
|
||||
});
|
||||
@@ -166,14 +145,11 @@ function handleFetchThemeDetails(request: BackgroundRequest, sendResponse: Messa
|
||||
const token = await getAccessTokenFromStorage();
|
||||
const headers: Record<string, string> = {};
|
||||
if (token) headers["Authorization"] = `Bearer ${token}`;
|
||||
const detailUrl = await withBsplusApiQuery(
|
||||
`${apiBase()}/api/themes/${encodeURIComponent(themeId)}`,
|
||||
);
|
||||
fetch(detailUrl, { cache: "no-store", headers })
|
||||
fetch(`${API_BASE}/api/themes/${themeId}`, { cache: "no-store", headers })
|
||||
.then((r) => r.json())
|
||||
.then(sendResponse)
|
||||
.catch((err) => {
|
||||
console.error("[Background] fetchThemeDetails error:", err);
|
||||
console.error("[BetterSEQTA+] Background: fetchThemeDetails error:", err);
|
||||
sendResponse({ success: false, error: err?.message });
|
||||
});
|
||||
})();
|
||||
@@ -196,6 +172,8 @@ function isTrustedSender(sender?: chrome.runtime.MessageSender): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
const AUTH_FETCH_ORIGINS = [API_BASE, "https://accounts.betterseqta.org"];
|
||||
|
||||
function handleFetchFromUrl(
|
||||
request: BackgroundRequest,
|
||||
sendResponse: MessageSender,
|
||||
@@ -214,6 +192,10 @@ function handleFetchFromUrl(
|
||||
sendResponse({ error: "URL not allowed" });
|
||||
return false;
|
||||
}
|
||||
if (request.auth === true && !AUTH_FETCH_ORIGINS.includes(new URL(url).origin)) {
|
||||
sendResponse({ error: "URL not allowed" });
|
||||
return false;
|
||||
}
|
||||
void (async () => {
|
||||
try {
|
||||
const headers: Record<string, string> = { Accept: "application/json" };
|
||||
@@ -240,7 +222,7 @@ function handleFetchFromUrl(
|
||||
sendResponse({ error: "Invalid JSON response" });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("[Background] fetchFromUrl error:", err);
|
||||
console.error("[BetterSEQTA+] Background: fetchFromUrl error:", err);
|
||||
sendResponse({ error: (err as Error)?.message });
|
||||
}
|
||||
})();
|
||||
@@ -277,7 +259,7 @@ function handleCloudReserveClient(
|
||||
else sendResponse(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("[Background] cloudReserveClient error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudReserveClient error:", err);
|
||||
sendResponse({ error: err?.message ?? "Network error" });
|
||||
});
|
||||
return true;
|
||||
@@ -323,7 +305,7 @@ function handleCloudLogin(
|
||||
if (!r.ok) sendResponse({ error: errorText ?? "Login failed" });
|
||||
else sendResponse(data);
|
||||
} catch (err) {
|
||||
console.error("[Background] cloudLogin error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudLogin error:", err);
|
||||
sendResponse({ error: (err as Error)?.message ?? "Network error" });
|
||||
}
|
||||
})();
|
||||
@@ -344,7 +326,7 @@ function handleCloudStartLogin(request: BackgroundRequest, sendResponse: Message
|
||||
sendResponse({ success: true });
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("[Background] cloudStartLogin error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudStartLogin error:", err);
|
||||
sendResponse({ error: err?.message ?? "Failed to open login page" });
|
||||
});
|
||||
return true;
|
||||
@@ -380,17 +362,20 @@ function initCloudLoginCallbackListener() {
|
||||
}
|
||||
|
||||
void performCloudSettingsDownloadWithRetry(token).catch((err) => {
|
||||
console.warn("[Background] Cloud settings download after login:", err);
|
||||
console.warn(
|
||||
"[BetterSEQTA+] Background: Cloud settings download after login:",
|
||||
err,
|
||||
);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("[Background] Failed to process login callback:", err);
|
||||
console.error("[BetterSEQTA+] Background: Failed to process login callback:", err);
|
||||
}
|
||||
})();
|
||||
|
||||
void browser.tabs.remove(tabId);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("[Background] Error parsing callback URL:", err);
|
||||
console.error("[BetterSEQTA+] Background: Error parsing callback URL:", err);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -419,7 +404,7 @@ function handleCloudRefresh(request: BackgroundRequest, sendResponse: MessageSen
|
||||
else sendResponse(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("[Background] cloudRefresh error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudRefresh error:", err);
|
||||
sendResponse({ error: err?.message ?? "Network error" });
|
||||
});
|
||||
return true;
|
||||
@@ -448,7 +433,7 @@ function handleCloudSettingsUpload(
|
||||
updated_at: res.updated_at,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("[Background] cloudSettingsUpload error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudSettingsUpload error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Upload failed",
|
||||
@@ -482,7 +467,7 @@ function handleCloudSettingsDownload(
|
||||
updated_at: res.updated_at,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("[Background] cloudSettingsDownload error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudSettingsDownload error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Download failed",
|
||||
@@ -505,14 +490,14 @@ function handleCloudFavorite(request: BackgroundRequest, sendResponse: MessageSe
|
||||
return;
|
||||
}
|
||||
const isFavorite = action === "favorite";
|
||||
fetch(`${apiBase()}/api/themes/${themeId}/favorite`, {
|
||||
fetch(`${API_BASE}/api/themes/${themeId}/favorite`, {
|
||||
method: isFavorite ? "POST" : "DELETE",
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
.then((r) => r.json())
|
||||
.then(sendResponse)
|
||||
.catch((err) => {
|
||||
console.error("[Background] cloudFavorite error:", err);
|
||||
console.error("[BetterSEQTA+] Background: cloudFavorite error:", err);
|
||||
sendResponse({ success: false, error: err?.message });
|
||||
});
|
||||
})();
|
||||
@@ -537,38 +522,12 @@ function isSeqtaOrigin(origin: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
function handleSetDevApiBase(
|
||||
request: BackgroundRequest,
|
||||
_sendResponse: MessageSender,
|
||||
sender?: chrome.runtime.MessageSender,
|
||||
): boolean {
|
||||
if (!isTrustedSender(sender)) return false;
|
||||
if (import.meta.env.DEV) {
|
||||
DEV_API_BASE = null;
|
||||
return false;
|
||||
}
|
||||
const url = typeof request?.url === "string" ? request.url.trim() : null;
|
||||
if (url && /^https?:\/\//.test(url)) {
|
||||
DEV_API_BASE = url.replace(/\/$/, "");
|
||||
} else {
|
||||
DEV_API_BASE = null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const customThemesHandlers = createCustomThemesHandlers({
|
||||
apiBase,
|
||||
getAccessTokenFromStorage,
|
||||
});
|
||||
|
||||
const remoteConfigHandlers = createRemoteConfigHandlers(apiBase);
|
||||
const customThemesHandlers = createCustomThemesHandlers({ getAccessTokenFromStorage });
|
||||
|
||||
const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
||||
...customThemesHandlers,
|
||||
...remoteConfigHandlers,
|
||||
searchThemeStockPhotos: handleSearchThemeStockPhotos,
|
||||
reloadTabs: () => reloadSeqtaPages(),
|
||||
setDevApiBase: handleSetDevApiBase,
|
||||
extensionPages: (req) => {
|
||||
browser.tabs.query({}).then((tabs) => {
|
||||
for (const tab of tabs) {
|
||||
@@ -657,7 +616,7 @@ const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
|
||||
typeof reply?.appLink === "string" && reply.appLink.length > 0 ? reply.appLink : null;
|
||||
sendResponse({ appLink });
|
||||
} catch (err) {
|
||||
console.error("[Background] getSeqtaSession error:", err);
|
||||
console.error("[BetterSEQTA+] Background: getSeqtaSession error:", err);
|
||||
sendResponse({ appLink: null });
|
||||
}
|
||||
})();
|
||||
@@ -682,11 +641,9 @@ browser.runtime.onMessage.addListener(
|
||||
sendResponse: MessageSender,
|
||||
) => {
|
||||
const handler = MESSAGE_HANDLERS[request.type as string];
|
||||
if (handler) {
|
||||
const result = handler(request, sendResponse, sender);
|
||||
return result === true;
|
||||
}
|
||||
console.log("Unknown request type");
|
||||
if (!handler) return false;
|
||||
if (handler(request, sendResponse, sender) === true) return true;
|
||||
sendResponse();
|
||||
return false;
|
||||
},
|
||||
);
|
||||
@@ -712,14 +669,10 @@ browser.runtime.onInstalled.addListener(function (event) {
|
||||
|
||||
if (event.reason === "update" && event.previousVersion) {
|
||||
void runStorageMigrations(event.previousVersion);
|
||||
void browser.storage.local.remove(BSPLUS_INSTALL_REGISTERED_AT_KEY).then(() => {
|
||||
void refreshRemoteConfig(apiBase);
|
||||
});
|
||||
reloadSeqtaPages();
|
||||
}
|
||||
|
||||
if (event.reason === "install") {
|
||||
void refreshRemoteConfig(apiBase);
|
||||
void browser.storage.local.set({ [DEFAULT_BACKGROUND_PENDING_KEY]: true });
|
||||
void defaultsReady
|
||||
.catch(() => undefined)
|
||||
@@ -736,6 +689,5 @@ browser.runtime.onStartup.addListener(() => {
|
||||
});
|
||||
|
||||
initCloudSettingsAutoSync({ reloadSeqtaPages });
|
||||
initRemoteConfigBackground(apiBase);
|
||||
initTimetableClassmatesBackgroundSync();
|
||||
void ensureSyncableStorageDefaults();
|
||||
@@ -16,7 +16,11 @@ import {
|
||||
getLastUploadedSnapshot,
|
||||
setKnownRemoteUpdatedAt,
|
||||
} from "@/seqta/utils/cloudSettingsSync";
|
||||
import { isRemoteCloudSyncDisabled } from "./remoteConfig";
|
||||
import { readRemoteStatus } from "@/seqta/utils/remoteStatus";
|
||||
|
||||
async function isCloudSyncDisabled(): Promise<boolean> {
|
||||
return (await readRemoteStatus()).disabledFeatures.includes("cloud.sync");
|
||||
}
|
||||
|
||||
const ACCOUNTS_BASE = "https://accounts.betterseqta.org";
|
||||
export const CLOUD_SUMMARY_URL = `${ACCOUNTS_BASE}/api/user/cloud-summary`;
|
||||
@@ -154,7 +158,7 @@ async function fetchCloudSummaryWithAuthRetry(token: string): Promise<CloudSumma
|
||||
t = next;
|
||||
continue;
|
||||
}
|
||||
if (res.error) console.warn("[BS+ cloud sync] cloud-summary:", res.error);
|
||||
if (res.error) console.warn("[BetterSEQTA+] Cloud sync: cloud-summary:", res.error);
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
@@ -226,8 +230,8 @@ async function putSettingsOnce(token: string): Promise<PutResult> {
|
||||
export async function performCloudSettingsUploadWithRetry(
|
||||
token: string,
|
||||
): Promise<{ success: boolean; error?: string; updated_at?: string; skipped?: boolean }> {
|
||||
if (await isRemoteCloudSyncDisabled()) {
|
||||
return { success: false, error: "Cloud sync disabled by remote config", skipped: true };
|
||||
if (await isCloudSyncDisabled()) {
|
||||
return { success: false, error: "Cloud sync is temporarily disabled", skipped: true };
|
||||
}
|
||||
let t = token;
|
||||
for (let attempt = 0; attempt < 2; attempt++) {
|
||||
@@ -333,19 +337,19 @@ export async function performCloudSettingsDownloadWithRetry(
|
||||
async function maybeUploadBaseline(token: string): Promise<void> {
|
||||
const res = await performCloudSettingsUploadWithRetry(token);
|
||||
if (!res.success) {
|
||||
console.warn("[BS+ cloud sync] Baseline upload failed:", res.error);
|
||||
console.warn("[BetterSEQTA+] Cloud sync: Baseline upload failed:", res.error);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadIfNeeded(token: string): Promise<void> {
|
||||
const res = await performCloudSettingsDownloadWithRetry(token);
|
||||
if (!res.success && !res.notFound) {
|
||||
console.warn("[BS+ cloud sync] Auto-download failed:", res.error);
|
||||
console.warn("[BetterSEQTA+] Cloud sync: Auto-download failed:", res.error);
|
||||
}
|
||||
}
|
||||
|
||||
async function runCloudSettingsPollInner(): Promise<void> {
|
||||
if (await isRemoteCloudSyncDisabled()) return;
|
||||
if (await isCloudSyncDisabled()) return;
|
||||
|
||||
const all = (await browser.storage.local.get()) as Record<string, unknown>;
|
||||
if (!isAutoCloudSyncEnabled(all)) return;
|
||||
@@ -364,7 +368,9 @@ async function runCloudSettingsPollInner(): Promise<void> {
|
||||
typeof bsplus.schemaVersion === "number" &&
|
||||
bsplus.schemaVersion > CLOUD_SETTINGS_SYNC_SCHEMA_VERSION
|
||||
) {
|
||||
console.warn("[BS+ cloud sync] Server schemaVersion newer than client; skip auto-download");
|
||||
console.warn(
|
||||
"[BetterSEQTA+] Cloud sync: Server schemaVersion newer than client; skip auto-download",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -395,7 +401,7 @@ export function runCloudSettingsPoll(): Promise<void> {
|
||||
await runCloudSettingsPollInner();
|
||||
await browser.storage.local.set({ [POLL_THROTTLE_KEY]: Date.now() });
|
||||
} catch (e) {
|
||||
console.error("[BS+ cloud sync] Poll error:", e);
|
||||
console.error("[BetterSEQTA+] Cloud sync: Poll error:", e);
|
||||
} finally {
|
||||
pollInFlight = null;
|
||||
}
|
||||
@@ -422,7 +428,7 @@ function scheduleDebouncedUpload(): void {
|
||||
/** Call after store theme install (and similar) so cloud upload runs even if storage events are flaky. */
|
||||
export function requestCloudSettingsDebouncedUpload(): void {
|
||||
void (async () => {
|
||||
if (await isRemoteCloudSyncDisabled()) return;
|
||||
if (await isCloudSyncDisabled()) return;
|
||||
const all = (await browser.storage.local.get()) as Record<string, unknown>;
|
||||
if (!isAutoCloudSyncEnabled(all)) return;
|
||||
if (suppressAutoUploadDuringRestore) return;
|
||||
@@ -432,14 +438,14 @@ export function requestCloudSettingsDebouncedUpload(): void {
|
||||
}
|
||||
|
||||
async function runDebouncedUploadJob(): Promise<void> {
|
||||
if (await isRemoteCloudSyncDisabled()) return;
|
||||
if (await isCloudSyncDisabled()) return;
|
||||
const all = (await browser.storage.local.get()) as Record<string, unknown>;
|
||||
if (!isAutoCloudSyncEnabled(all)) return;
|
||||
const token = await getAccessToken();
|
||||
if (!token) return;
|
||||
const res = await performCloudSettingsUploadWithRetry(token);
|
||||
if (!res.success) {
|
||||
console.warn("[BS+ cloud sync] Auto-upload failed:", res.error);
|
||||
console.warn("[BetterSEQTA+] Cloud sync: Auto-upload failed:", res.error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +470,7 @@ function onStorageChanged(
|
||||
if (!keys.some((k) => isKeyIncludedInCloudUploadPayload(k))) return;
|
||||
|
||||
void (async () => {
|
||||
if (await isRemoteCloudSyncDisabled()) return;
|
||||
if (await isCloudSyncDisabled()) return;
|
||||
const all = (await browser.storage.local.get()) as Record<string, unknown>;
|
||||
if (!isAutoCloudSyncEnabled(all)) return;
|
||||
if (suppressAutoUploadDuringRestore) return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { API_BASE } from "@/config/apiBase";
|
||||
import { normalizeCustomThemeApiResponse } from "@/seqta/utils/customThemes/parseApiEnvelope";
|
||||
import { bsplusApiQueryParams } from "@/seqta/utils/bsplusClientContext";
|
||||
import { base64ToBlob } from "@/seqta/utils/base64";
|
||||
|
||||
type MessageSender = { (response?: unknown): void };
|
||||
@@ -33,7 +33,6 @@ function buildFormDataFromPayload(payload: UploadPayload): FormData {
|
||||
}
|
||||
|
||||
export function createCustomThemesHandlers(deps: {
|
||||
apiBase: () => string;
|
||||
getAccessTokenFromStorage: () => Promise<string | null>;
|
||||
}): Record<string, (request: Record<string, unknown>, sendResponse: MessageSender) => boolean> {
|
||||
async function readCustomThemesResponse(r: Response): Promise<Record<string, unknown>> {
|
||||
@@ -46,7 +45,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
}
|
||||
const normalized = normalizeCustomThemeApiResponse(body, r.status, text);
|
||||
if (!r.ok || normalized.success === false) {
|
||||
console.error("[BetterSEQTA+ CustomThemes]", r.status, r.url, normalized);
|
||||
console.error("[BetterSEQTA+] CustomThemes:", r.status, r.url, normalized);
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
@@ -67,7 +66,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
}
|
||||
headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
const url = `${deps.apiBase()}${path}`;
|
||||
const url = `${API_BASE}${path}`;
|
||||
const r = await fetch(url, {
|
||||
...init,
|
||||
headers,
|
||||
@@ -85,7 +84,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
return { success: false, error: "Not authenticated", httpStatus: 401 };
|
||||
}
|
||||
const form = buildFormDataFromPayload(payload);
|
||||
const url = `${deps.apiBase()}${path}`;
|
||||
const url = `${API_BASE}${path}`;
|
||||
const r = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
@@ -105,7 +104,6 @@ export function createCustomThemesHandlers(deps: {
|
||||
params.set("type", "betterseqta");
|
||||
params.set("page", String(request.page ?? 1));
|
||||
params.set("limit", String(request.limit ?? 20));
|
||||
(await bsplusApiQueryParams()).forEach((value, key) => params.set(key, value));
|
||||
if (request.sort) params.set("sort", String(request.sort));
|
||||
const searchRaw = request.search;
|
||||
const search = typeof searchRaw === "string" ? searchRaw.trim() : "";
|
||||
@@ -114,7 +112,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
: `/api/custom-themes?${params}`;
|
||||
sendResponse(await customThemesJsonFetch(path));
|
||||
} catch (err) {
|
||||
console.error("[Background] fetchCustomThemes error:", err);
|
||||
console.error("[BetterSEQTA+] Background: fetchCustomThemes error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Fetch failed",
|
||||
@@ -134,11 +132,10 @@ export function createCustomThemesHandlers(deps: {
|
||||
params.set("page", String(request.page ?? 1));
|
||||
params.set("limit", String(request.limit ?? 20));
|
||||
params.set("type", "betterseqta");
|
||||
(await bsplusApiQueryParams()).forEach((value, key) => params.set(key, value));
|
||||
if (request.status) params.set("status", String(request.status));
|
||||
sendResponse(await customThemesJsonFetch(`/api/custom-themes/mine?${params}`, {}, true));
|
||||
} catch (err) {
|
||||
console.error("[Background] fetchMyCustomThemes error:", err);
|
||||
console.error("[BetterSEQTA+] Background: fetchMyCustomThemes error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Fetch failed",
|
||||
@@ -167,7 +164,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
),
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[Background] fetchMyCustomThemeDetail error:", err);
|
||||
console.error("[BetterSEQTA+] Background: fetchMyCustomThemeDetail error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Fetch failed",
|
||||
@@ -190,7 +187,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
try {
|
||||
sendResponse(await customThemesMultipartPost("/api/custom-themes/mine", payload!));
|
||||
} catch (err) {
|
||||
console.error("[Background] submitCustomTheme error:", err);
|
||||
console.error("[BetterSEQTA+] Background: submitCustomTheme error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: { message: err instanceof Error ? err.message : "Upload failed" },
|
||||
@@ -225,7 +222,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
),
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[Background] replaceCustomThemeFiles error:", err);
|
||||
console.error("[BetterSEQTA+] Background: replaceCustomThemeFiles error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Upload failed",
|
||||
@@ -258,7 +255,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
),
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[Background] updateCustomThemeMetadata error:", err);
|
||||
console.error("[BetterSEQTA+] Background: updateCustomThemeMetadata error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Update failed",
|
||||
@@ -287,7 +284,7 @@ export function createCustomThemesHandlers(deps: {
|
||||
),
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[Background] deleteCustomTheme error:", err);
|
||||
console.error("[BetterSEQTA+] Background: deleteCustomTheme error:", err);
|
||||
sendResponse({
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Delete failed",
|
||||
@@ -317,15 +314,41 @@ export function createCustomThemesHandlers(deps: {
|
||||
): boolean {
|
||||
void (async () => {
|
||||
try {
|
||||
const params = new URLSearchParams();
|
||||
params.set("page", String(request.page ?? 1));
|
||||
params.set("limit", String(Math.min(Number(request.limit ?? 20) || 20, 100)));
|
||||
if (request.status) params.set("status", String(request.status));
|
||||
if (request.source) params.set("source", String(request.source));
|
||||
const searchRaw = request.search;
|
||||
const search = typeof searchRaw === "string" ? searchRaw.trim() : "";
|
||||
if (search) params.set("search", search);
|
||||
sendResponse(await customThemesJsonFetch(`/api/bsplus/admin/themes?${params}`, {}, true));
|
||||
const adminThemeParams = (source?: string) => {
|
||||
const params = new URLSearchParams();
|
||||
params.set("page", String(request.page ?? 1));
|
||||
params.set("limit", String(Math.min(Number(request.limit ?? 20) || 20, 100)));
|
||||
if (request.status) params.set("status", String(request.status));
|
||||
if (source) params.set("source", source);
|
||||
const search = typeof request.search === "string" ? request.search.trim() : "";
|
||||
if (search) params.set("search", search);
|
||||
return params;
|
||||
};
|
||||
const fetchAdminThemes = (source?: string) =>
|
||||
customThemesJsonFetch(`/api/bsplus/admin/themes?${adminThemeParams(source)}`, {}, true);
|
||||
|
||||
const source =
|
||||
request.source === "community" || request.source === "marketplace"
|
||||
? request.source
|
||||
: undefined;
|
||||
if (source) {
|
||||
sendResponse(await fetchAdminThemes(source));
|
||||
return;
|
||||
}
|
||||
|
||||
const [community, marketplace] = await Promise.all([
|
||||
fetchAdminThemes("community"),
|
||||
fetchAdminThemes("marketplace"),
|
||||
]);
|
||||
if (community.success === false && marketplace.success === false) {
|
||||
sendResponse(community);
|
||||
return;
|
||||
}
|
||||
const themes = [
|
||||
...((community.data as { themes?: unknown[] } | undefined)?.themes ?? []),
|
||||
...((marketplace.data as { themes?: unknown[] } | undefined)?.themes ?? []),
|
||||
];
|
||||
sendResponse({ success: true, data: { themes } });
|
||||
} catch (err) {
|
||||
sendResponse({
|
||||
success: false,
|
||||
|
||||
@@ -1,369 +0,0 @@
|
||||
import browser from "@/lib/browser";
|
||||
import { getBsplusDeviceName } from "@/seqta/utils/bsplusDeviceName";
|
||||
import { bsplusApiQueryParams, bsplusExtensionPayload } from "@/seqta/utils/bsplusClientContext";
|
||||
import { getOrCreateInstallId } from "@/seqta/utils/feedback/installId";
|
||||
import { isAllowedFetchUrl } from "@/seqta/utils/allowedFetchUrl";
|
||||
import {
|
||||
mergeGithubConfigFiles,
|
||||
normalizeRemoteConfigSnapshot,
|
||||
} from "@/seqta/utils/remoteConfig/normalize";
|
||||
import {
|
||||
BSPLUS_INSTALL_REGISTERED_AT_KEY,
|
||||
BSPLUS_REMOTE_CONFIG_ETAG_KEY,
|
||||
BSPLUS_REMOTE_CONFIG_FETCHED_AT_KEY,
|
||||
BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY,
|
||||
BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY,
|
||||
BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY,
|
||||
BS_STATUS_MANIFEST_URL,
|
||||
REGISTER_INTERVAL_MS,
|
||||
REMOTE_CONFIG_ALARM,
|
||||
REMOTE_CONFIG_POLL_MINUTES,
|
||||
} from "@/seqta/utils/remoteConfig/storageKeys";
|
||||
import type { RemoteConfigSnapshot } from "@/seqta/utils/remoteConfig/types";
|
||||
|
||||
type MessageSender = { (response?: unknown): void };
|
||||
|
||||
const ACCOUNTS_BASE = "https://accounts.betterseqta.org";
|
||||
|
||||
async function linkCloudInstall(token: string, installId: string): Promise<void> {
|
||||
try {
|
||||
const extension = bsplusExtensionPayload();
|
||||
const r = await fetch(`${ACCOUNTS_BASE}/api/bsplus/installs/link`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
installId,
|
||||
extensionVersion: extension.version,
|
||||
extension,
|
||||
deviceName: await getBsplusDeviceName(),
|
||||
lastSeenAt: new Date().toISOString(),
|
||||
}),
|
||||
cache: "no-store",
|
||||
});
|
||||
if (!r.ok) console.warn("[BetterSEQTA+] cloud install link failed:", r.status);
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] cloud install link failed:", e);
|
||||
}
|
||||
}
|
||||
|
||||
async function parseJson(r: Response): Promise<unknown> {
|
||||
const text = await r.text();
|
||||
try {
|
||||
return text ? JSON.parse(text) : {};
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function readLastHostname(): Promise<string | undefined> {
|
||||
const stored = await browser.storage.local.get(BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY);
|
||||
const hostname = stored[BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY];
|
||||
return typeof hostname === "string" && hostname.length > 0 ? hostname : undefined;
|
||||
}
|
||||
|
||||
async function fetchGithubSnapshot(): Promise<RemoteConfigSnapshot | null> {
|
||||
try {
|
||||
const manifestRes = await fetch(BS_STATUS_MANIFEST_URL, { cache: "no-store" });
|
||||
if (!manifestRes.ok) return null;
|
||||
const manifest = (await parseJson(manifestRes)) as Record<string, unknown> | null;
|
||||
if (!manifest?.files || typeof manifest.files !== "object") return null;
|
||||
const base =
|
||||
BS_STATUS_MANIFEST_URL.replace(/manifest\.json$/, "") ||
|
||||
"https://raw.githubusercontent.com/BetterSEQTA/BS-Status/main/config/";
|
||||
const files: Record<string, unknown> = {};
|
||||
for (const [key, fileName] of Object.entries(manifest.files as Record<string, string>)) {
|
||||
if (typeof fileName !== "string") continue;
|
||||
const url = fileName.startsWith("http") ? fileName : `${base}${fileName}`;
|
||||
if (!isAllowedFetchUrl(url)) continue;
|
||||
const fr = await fetch(url, { cache: "no-store" });
|
||||
if (!fr.ok) continue;
|
||||
files[key] = await parseJson(fr);
|
||||
}
|
||||
return mergeGithubConfigFiles(manifest, files);
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] GitHub remote config fallback failed:", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function registerInstall(apiBase: string, primaryOk: boolean, force = false): Promise<void> {
|
||||
if (!primaryOk) return;
|
||||
const stored = await browser.storage.local.get(BSPLUS_INSTALL_REGISTERED_AT_KEY);
|
||||
const last = Number(stored[BSPLUS_INSTALL_REGISTERED_AT_KEY] ?? 0);
|
||||
if (!force && Date.now() - last < REGISTER_INTERVAL_MS) return;
|
||||
|
||||
const installId = await getOrCreateInstallId();
|
||||
const extension = bsplusExtensionPayload();
|
||||
const { bsplus_token, bsplus_user } = await browser.storage.local.get([
|
||||
"bsplus_token",
|
||||
"bsplus_user",
|
||||
]);
|
||||
const token =
|
||||
typeof bsplus_token === "string" && bsplus_token.length > 0 ? bsplus_token : undefined;
|
||||
const userId =
|
||||
bsplus_user && typeof bsplus_user === "object" && "id" in bsplus_user
|
||||
? String((bsplus_user as { id: string }).id)
|
||||
: undefined;
|
||||
|
||||
const hostname = await readLastHostname();
|
||||
|
||||
const body = {
|
||||
installId,
|
||||
extensionVersion: extension.version,
|
||||
extension,
|
||||
userId,
|
||||
lastSeenAt: new Date().toISOString(),
|
||||
...(hostname ? { hostname } : {}),
|
||||
};
|
||||
|
||||
try {
|
||||
const headers: Record<string, string> = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
if (token) headers.Authorization = `Bearer ${token}`;
|
||||
const r = await fetch(`${apiBase}/api/bsplus/installs/register`, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify(body),
|
||||
cache: "no-store",
|
||||
});
|
||||
if (r.ok) {
|
||||
await browser.storage.local.set({
|
||||
[BSPLUS_INSTALL_REGISTERED_AT_KEY]: Date.now(),
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] install register failed:", e);
|
||||
}
|
||||
if (token) void linkCloudInstall(token, installId);
|
||||
}
|
||||
|
||||
export async function refreshRemoteConfig(apiBase: () => string): Promise<{
|
||||
snapshot: RemoteConfigSnapshot;
|
||||
fromNetwork: boolean;
|
||||
primaryOk: boolean;
|
||||
}> {
|
||||
const base = apiBase();
|
||||
const hostname = await readLastHostname();
|
||||
const params = await bsplusApiQueryParams();
|
||||
if (hostname) params.set("hostname", hostname);
|
||||
|
||||
const stored = await browser.storage.local.get([
|
||||
BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY,
|
||||
BSPLUS_REMOTE_CONFIG_ETAG_KEY,
|
||||
]);
|
||||
const etag = stored[BSPLUS_REMOTE_CONFIG_ETAG_KEY] as string | undefined;
|
||||
const prior = stored[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY];
|
||||
|
||||
let primaryOk = false;
|
||||
let snapshot: RemoteConfigSnapshot | null = null;
|
||||
|
||||
try {
|
||||
const headers: Record<string, string> = { Accept: "application/json" };
|
||||
if (etag) headers["If-None-Match"] = etag;
|
||||
const r = await fetch(`${base}/api/bsplus/remote-config?${params}`, {
|
||||
cache: "no-store",
|
||||
headers,
|
||||
});
|
||||
if (r.status === 304 && prior) {
|
||||
primaryOk = true;
|
||||
snapshot = normalizeRemoteConfigSnapshot(prior);
|
||||
snapshot.source = "cache";
|
||||
} else if (r.ok) {
|
||||
primaryOk = true;
|
||||
const json = await parseJson(r);
|
||||
snapshot = normalizeRemoteConfigSnapshot(json);
|
||||
snapshot.source = "api";
|
||||
const newEtag = r.headers.get("ETag") ?? snapshot.etag;
|
||||
if (newEtag) snapshot.etag = newEtag;
|
||||
await browser.storage.local.set({
|
||||
[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY]: snapshot,
|
||||
[BSPLUS_REMOTE_CONFIG_FETCHED_AT_KEY]: Date.now(),
|
||||
[BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY]: true,
|
||||
...(newEtag ? { [BSPLUS_REMOTE_CONFIG_ETAG_KEY]: newEtag } : {}),
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] remote-config primary fetch failed:", e);
|
||||
}
|
||||
|
||||
if (!snapshot) {
|
||||
snapshot = await fetchGithubSnapshot();
|
||||
if (snapshot) {
|
||||
await browser.storage.local.set({
|
||||
[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY]: snapshot,
|
||||
[BSPLUS_REMOTE_CONFIG_FETCHED_AT_KEY]: Date.now(),
|
||||
[BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY]: false,
|
||||
});
|
||||
} else if (prior) {
|
||||
snapshot = normalizeRemoteConfigSnapshot(prior);
|
||||
snapshot.source = "cache";
|
||||
} else {
|
||||
snapshot = normalizeRemoteConfigSnapshot(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (primaryOk) {
|
||||
await browser.storage.local.set({ [BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY]: true });
|
||||
}
|
||||
|
||||
void registerInstall(base, primaryOk);
|
||||
return { snapshot, fromNetwork: primaryOk, primaryOk };
|
||||
}
|
||||
|
||||
export function initRemoteConfigBackground(apiBase: () => string): void {
|
||||
void refreshRemoteConfig(apiBase);
|
||||
|
||||
browser.alarms.create(REMOTE_CONFIG_ALARM, {
|
||||
periodInMinutes: REMOTE_CONFIG_POLL_MINUTES,
|
||||
});
|
||||
|
||||
browser.alarms.onAlarm.addListener((alarm) => {
|
||||
if (alarm.name === REMOTE_CONFIG_ALARM) void refreshRemoteConfig(apiBase);
|
||||
});
|
||||
|
||||
browser.storage.onChanged.addListener((changes, area) => {
|
||||
if (area !== "local") return;
|
||||
if (changes.bsplus_token || changes.bsplus_user) {
|
||||
void (async () => {
|
||||
const lastPrimary = await browser.storage.local.get(BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY);
|
||||
const primaryOk = lastPrimary[BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY] === true;
|
||||
if (primaryOk) {
|
||||
await registerInstall(apiBase(), true, true);
|
||||
} else {
|
||||
const res = await refreshRemoteConfig(apiBase);
|
||||
if (res.primaryOk) await registerInstall(apiBase(), true, true);
|
||||
else {
|
||||
const { bsplus_token } = await browser.storage.local.get("bsplus_token");
|
||||
if (typeof bsplus_token === "string" && bsplus_token) {
|
||||
void linkCloudInstall(bsplus_token, await getOrCreateInstallId());
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function createRemoteConfigHandlers(
|
||||
apiBase: () => string,
|
||||
): Record<string, (request: unknown, sendResponse: MessageSender) => boolean> {
|
||||
function handleRefresh(_req: unknown, sendResponse: MessageSender): boolean {
|
||||
void refreshRemoteConfig(apiBase)
|
||||
.then((res) => sendResponse(res))
|
||||
.catch((err) =>
|
||||
sendResponse({
|
||||
error: err instanceof Error ? err.message : "Refresh failed",
|
||||
}),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleGetSnapshot(_req: unknown, sendResponse: MessageSender): boolean {
|
||||
void browser.storage.local.get(BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY).then((stored) => {
|
||||
sendResponse({
|
||||
snapshot: normalizeRemoteConfigSnapshot(stored[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY]),
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleSetPageContext(req: unknown, sendResponse: MessageSender): boolean {
|
||||
const { hostname: rawHostname } = req as { hostname?: unknown };
|
||||
const hostname = typeof rawHostname === "string" ? rawHostname.trim() : "";
|
||||
if (hostname) {
|
||||
void browser.storage.local
|
||||
.set({ [BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY]: hostname })
|
||||
.then(() => sendResponse({ ok: true }));
|
||||
} else {
|
||||
sendResponse({ ok: false });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleFetchRemoteThemePackage(req: unknown, sendResponse: MessageSender): boolean {
|
||||
const { packageId: rawPackageId } = req as { packageId?: unknown };
|
||||
const packageId = typeof rawPackageId === "string" ? rawPackageId.trim() : "";
|
||||
if (!packageId) {
|
||||
sendResponse({ error: "Missing packageId" });
|
||||
return false;
|
||||
}
|
||||
void (async () => {
|
||||
try {
|
||||
const hostname = await readLastHostname();
|
||||
const params = await bsplusApiQueryParams();
|
||||
if (hostname) params.set("hostname", hostname);
|
||||
const base = apiBase();
|
||||
const url = `${base}/api/bsplus/remote-theme-packages/${encodeURIComponent(packageId)}?${params}`;
|
||||
if (!isAllowedFetchUrl(url)) {
|
||||
sendResponse({ error: "URL not allowed" });
|
||||
return;
|
||||
}
|
||||
const r = await fetch(url, { cache: "no-store", headers: { Accept: "application/json" } });
|
||||
if (!r.ok) {
|
||||
sendResponse({ error: `HTTP ${r.status}` });
|
||||
return;
|
||||
}
|
||||
const json = await parseJson(r);
|
||||
if (!json || typeof json !== "object") {
|
||||
sendResponse({ error: "Invalid package response" });
|
||||
return;
|
||||
}
|
||||
sendResponse({ package: json });
|
||||
} catch (e) {
|
||||
sendResponse({
|
||||
error: e instanceof Error ? e.message : "Fetch failed",
|
||||
});
|
||||
}
|
||||
})();
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleFetchRemoteThemePackageUrl(req: unknown, sendResponse: MessageSender): boolean {
|
||||
const { url: rawUrl } = req as { url?: unknown };
|
||||
const url = typeof rawUrl === "string" ? rawUrl.trim() : "";
|
||||
if (!url || !isAllowedFetchUrl(url)) {
|
||||
sendResponse({ error: "URL not allowed" });
|
||||
return false;
|
||||
}
|
||||
void (async () => {
|
||||
try {
|
||||
const r = await fetch(url, { cache: "no-store" });
|
||||
if (!r.ok) {
|
||||
sendResponse({ error: `HTTP ${r.status}` });
|
||||
return;
|
||||
}
|
||||
const theme = await parseJson(r);
|
||||
if (!theme || typeof theme !== "object") {
|
||||
sendResponse({ error: "Invalid theme JSON" });
|
||||
return;
|
||||
}
|
||||
sendResponse({ theme });
|
||||
} catch (e) {
|
||||
sendResponse({
|
||||
error: e instanceof Error ? e.message : "Fetch failed",
|
||||
});
|
||||
}
|
||||
})();
|
||||
return true;
|
||||
}
|
||||
|
||||
return {
|
||||
refreshRemoteConfig: handleRefresh,
|
||||
getRemoteConfigSnapshot: handleGetSnapshot,
|
||||
setRemoteConfigPageContext: handleSetPageContext,
|
||||
fetchRemoteThemePackage: handleFetchRemoteThemePackage,
|
||||
fetchRemoteThemePackageUrl: handleFetchRemoteThemePackageUrl,
|
||||
};
|
||||
}
|
||||
|
||||
export async function isRemoteCloudSyncDisabled(): Promise<boolean> {
|
||||
const stored = await browser.storage.local.get(BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY);
|
||||
const snap = normalizeRemoteConfigSnapshot(stored[BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY]);
|
||||
return snap.global.disableCloudSync === true;
|
||||
}
|
||||
@@ -7,33 +7,12 @@ function crossedUpgrade(previousVersion: string, boundary: string): boolean {
|
||||
return prev != null && curr != null && !semver.lt(curr, boundary) && semver.lt(prev, boundary);
|
||||
}
|
||||
|
||||
/** One-time storage patches when crossing 3.6.5 / 3.6.6 / 3.7.0 (see git history on main). */
|
||||
/** One-time storage patches when crossing 3.6.6 / 3.7.0 / 3.7.7 (see git history on main). */
|
||||
export async function runStorageMigrations(previousVersion: string): Promise<void> {
|
||||
if (crossedUpgrade(previousVersion, "3.6.5")) {
|
||||
try {
|
||||
const key = "plugin.global-search.settings";
|
||||
const got = await browser.storage.local.get(key);
|
||||
const existing = (got[key] ?? {}) as Record<string, unknown>;
|
||||
await browser.storage.local.set({
|
||||
[key]: {
|
||||
...existing,
|
||||
enabled: true,
|
||||
transparencyEffects: true,
|
||||
runIndexingOnLoad: true,
|
||||
passiveIndexing: true,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] Global Search 3.6.5 settings migration failed:", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (crossedUpgrade(previousVersion, "3.6.6")) {
|
||||
try {
|
||||
await browser.storage.local.set({
|
||||
themeOfTheMonthDisabled: false,
|
||||
themeOfTheMonthLastSeenId: undefined,
|
||||
});
|
||||
await browser.storage.local.set({ themeOfTheMonthDisabled: false });
|
||||
await browser.storage.local.remove("themeOfTheMonthLastSeenId");
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] Theme of the Month 3.6.6 reset migration failed:", e);
|
||||
}
|
||||
@@ -41,12 +20,33 @@ export async function runStorageMigrations(previousVersion: string): Promise<voi
|
||||
|
||||
if (crossedUpgrade(previousVersion, "3.7.0")) {
|
||||
try {
|
||||
await browser.storage.local.set({
|
||||
themeOfTheMonthLastSeenId: undefined,
|
||||
themeOfTheMonthDismissedMonth: undefined,
|
||||
});
|
||||
await browser.storage.local.remove([
|
||||
"themeOfTheMonthLastSeenId",
|
||||
"themeOfTheMonthDismissedMonth",
|
||||
]);
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (crossedUpgrade(previousVersion, "3.7.7")) {
|
||||
try {
|
||||
await browser.storage.local.remove([
|
||||
"bsplus_remote_config_snapshot",
|
||||
"bsplus_remote_config_etag",
|
||||
"bsplus_remote_config_fetched_at",
|
||||
"bsplus_remote_config_last_hostname",
|
||||
"bsplus_remote_last_primary_ok",
|
||||
"bsplus_campaign_seen",
|
||||
"bsplus_local_override_onoff",
|
||||
"bsplus_features_hidden_until_version",
|
||||
"bsplus_install_registered_at",
|
||||
"bsplus_remote_theme_before_v1",
|
||||
"bsplus_remote_theme_state_v1",
|
||||
"bsplus_remote_theme_user_off",
|
||||
]);
|
||||
} catch (e) {
|
||||
console.warn("[BetterSEQTA+] 3.7.7 storage cleanup migration failed:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export const API_BASE = "https://betterseqta.org";
|
||||
+70
-121
@@ -38,16 +38,13 @@
|
||||
|
||||
@layer override {
|
||||
.legacy-root,
|
||||
.legacy-root *:not(.iconFamily) {
|
||||
.legacy-root * {
|
||||
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
|
||||
}
|
||||
}
|
||||
|
||||
.iconFamily,
|
||||
.iconFamily *,
|
||||
[class~="iconFamily"],
|
||||
[class~="iconFamily"] * {
|
||||
font-family: "IconFamily" !important;
|
||||
}
|
||||
:root {
|
||||
--bsplus-focus-ring: 2px solid var(--text-primary, currentColor);
|
||||
}
|
||||
|
||||
html {
|
||||
@@ -56,126 +53,78 @@ html {
|
||||
font-family: Roboto, system-ui, -apple-system, sans-serif !important;
|
||||
}
|
||||
|
||||
.tooltip svg {
|
||||
fill: var(--theme-primary);
|
||||
}
|
||||
.tooltip {
|
||||
display: inline-block;
|
||||
z-index: 5 !important;
|
||||
width: 28px;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
.tooltip .tooltiptext {
|
||||
width: 120px;
|
||||
transform: scale(0);
|
||||
transition: transform 0.2s;
|
||||
transform-origin: top;
|
||||
background: var(--background-primary);
|
||||
color: var(--text-primary);
|
||||
.bsplus-tooltip-bubble {
|
||||
position: fixed;
|
||||
inset: auto;
|
||||
margin: 0;
|
||||
min-width: 50px;
|
||||
max-width: 220px;
|
||||
padding: 4px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
overflow: visible;
|
||||
background: var(--text-primary);
|
||||
color: var(--background-primary);
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 105%;
|
||||
left: 50%;
|
||||
margin-left: -62px;
|
||||
}
|
||||
.tooltip .tooltiptext::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent var(--text-primary) transparent;
|
||||
}
|
||||
.tooltiptext p:hover {
|
||||
cursor: pointer;
|
||||
background: rgba(0, 0, 0, 0.3) !important;
|
||||
transition: 200ms;
|
||||
}
|
||||
.tooltiptext p {
|
||||
border-radius: 8px !important;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
.tooltip:hover .tooltiptext {
|
||||
transform: scale(1);
|
||||
transform-origin: top;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
body:has(.outside-container:not(.hide)) #AddedSettings.tooltip:hover > .tooltiptext {
|
||||
transform: scale(0);
|
||||
transform-origin: top center;
|
||||
transition:
|
||||
transform 0.15s,
|
||||
overlay 0.15s allow-discrete,
|
||||
display 0.15s allow-discrete;
|
||||
|
||||
&:popover-open {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: calc(100% - 1px);
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border: 5px solid transparent;
|
||||
border-bottom-color: var(--text-primary);
|
||||
}
|
||||
|
||||
a,
|
||||
button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
border-radius: 6px;
|
||||
padding: 2px 8px;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: background 200ms;
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--background-primary) 20%, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
.assessmenttooltip svg {
|
||||
fill: var(--text-primary);
|
||||
.bsplus-tooltip:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
@starting-style {
|
||||
.bsplus-tooltip-bubble:popover-open {
|
||||
transform: scale(0);
|
||||
}
|
||||
}
|
||||
.assessmenttooltip {
|
||||
bottom: 0px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 5px;
|
||||
}
|
||||
.topmenutooltip {
|
||||
top: 115% !important;
|
||||
background: var(--text-primary) !important;
|
||||
color: var(--theme-primary) !important;
|
||||
}
|
||||
.fixed-tooltip {
|
||||
display: inline-block;
|
||||
z-index: 5 !important;
|
||||
width: 28px;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
.fixed-tooltip svg {
|
||||
fill: var(--theme-primary);
|
||||
}
|
||||
.tooltiptext-fixed {
|
||||
width: 120px;
|
||||
transform: scale(0);
|
||||
transition: transform 0.2s;
|
||||
transform-origin: top;
|
||||
background: var(--background-primary);
|
||||
color: var(--text-primary);
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
padding: 2px;
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin-left: -62px;
|
||||
}
|
||||
.tooltiptext-fixed::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent var(--text-primary) transparent;
|
||||
}
|
||||
.tooltiptext-fixed.show {
|
||||
transform: scale(1);
|
||||
transform-origin: top;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.tooltiptext-fixed p:hover {
|
||||
cursor: pointer;
|
||||
background: rgba(0, 0, 0, 0.3) !important;
|
||||
transition: 200ms;
|
||||
}
|
||||
.tooltiptext-fixed p {
|
||||
border-radius: 8px !important;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
margin: 2px;
|
||||
}
|
||||
+2
-18
@@ -44,12 +44,9 @@ body {
|
||||
}
|
||||
|
||||
> .date > .value,
|
||||
blockquote.forward > .preamble > .sender > .value {
|
||||
color: rgba(255, 255, 255, 0.7) !important;
|
||||
}
|
||||
|
||||
> .date > .label,
|
||||
blockquote.forward > .preamble > .sender > .label {
|
||||
> .sender > .value,
|
||||
> .sender > .label {
|
||||
color: rgba(255, 255, 255, 0.7) !important;
|
||||
}
|
||||
}
|
||||
@@ -90,19 +87,6 @@ body {
|
||||
border-top-right-radius: 1rem;
|
||||
}
|
||||
|
||||
blockquote.forward > .preamble {
|
||||
color: rgba(255, 255, 255, 0.7) !important;
|
||||
}
|
||||
|
||||
blockquote.forward > .preamble > .date > .value,
|
||||
blockquote.forward > .preamble > .sender > .value {
|
||||
color: rgba(255, 255, 255, 0.7) !important;
|
||||
}
|
||||
blockquote.forward > .preamble > .date > .label,
|
||||
blockquote.forward > .preamble > .sender > .label {
|
||||
color: rgba(255, 255, 255, 0.7) !important;
|
||||
}
|
||||
|
||||
#backgroundTable > * {
|
||||
background-color: #161616;
|
||||
border: none;
|
||||
|
||||
+185
-401
@@ -31,20 +31,20 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button.timetable-zoom.iconFamily,
|
||||
button.bsplus-timetable-control.iconFamily,
|
||||
.iconFamily {
|
||||
font-family: "IconFamily" !important;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body,
|
||||
.legacy-root input,
|
||||
.legacy-root textarea,
|
||||
.legacy-root button:not(.iconFamily),
|
||||
.legacy-root button,
|
||||
.legacy-root select,
|
||||
.legacy-root option,
|
||||
.legacy-root .input,
|
||||
@@ -61,6 +61,8 @@ html {
|
||||
|
||||
body {
|
||||
font-family: Rubik, sans-serif !important;
|
||||
background: var(--theme-primary);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
select {
|
||||
@@ -87,14 +89,16 @@ select:hover {
|
||||
}
|
||||
|
||||
select:focus {
|
||||
outline: none !important;
|
||||
background: var(--theme-secondary, var(--background-secondary)) !important;
|
||||
border-color: color-mix(
|
||||
in srgb,
|
||||
var(--text-primary) 18%,
|
||||
var(--theme-offset-bg, var(--theme-secondary, var(--background-secondary))) 82%
|
||||
) !important;
|
||||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--text-primary) 12%, transparent) !important;
|
||||
}
|
||||
select:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
select:not([multiple]):not([size]),
|
||||
@@ -133,7 +137,7 @@ select option {
|
||||
background: var(--auto-background) !important;
|
||||
}
|
||||
.legacy-root,
|
||||
.legacy-root *:not(.iconFamily) {
|
||||
.legacy-root * {
|
||||
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
|
||||
}
|
||||
|
||||
@@ -210,9 +214,6 @@ html:not(.dark) .legacy-root {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
.connectedNotificationsWrapper > div > button > svg > g {
|
||||
fill: var(--theme-primary) !important;
|
||||
}
|
||||
#main {
|
||||
color: var(--text-primary);
|
||||
position: relative;
|
||||
@@ -258,7 +259,20 @@ html:not(.dark) .legacy-root {
|
||||
height: 35px;
|
||||
width: 35px !important;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
.addedButton,
|
||||
.connectedNotificationsWrapper > div > button {
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
|
||||
&::after {
|
||||
content: none !important;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Engage toolbar: keep settings/theme buttons above React chrome */
|
||||
@@ -350,6 +364,10 @@ html:not(.dark) .legacy-root {
|
||||
cursor: pointer;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
.legacy-root .bsplus-timetable-control > svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#main > .dashboard {
|
||||
grid-template-columns: repeat(autofit, minmax(200px, 400px)) !important;
|
||||
@@ -434,7 +452,6 @@ ul.magicDelete > li.deleting {
|
||||
display: block;
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
fill: var(--theme-primary);
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
#menu,
|
||||
@@ -466,10 +483,12 @@ ul.magicDelete > li.deleting {
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
place-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
#menu .sub {
|
||||
top: 71px;
|
||||
margin-top: -2px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Drill-in stack: only the current list + folder header stay clickable.
|
||||
@@ -504,10 +523,6 @@ ul.magicDelete > li.deleting {
|
||||
}
|
||||
|
||||
/* Only the frontmost open .sub panel receives pointer events */
|
||||
#menu .sub {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#menu li.hasChildren:is(.active, .bsplus-active) > .sub {
|
||||
pointer-events: auto;
|
||||
}
|
||||
@@ -639,6 +654,7 @@ ul.magicDelete > li.deleting {
|
||||
color: var(--text-color);
|
||||
border-right: none;
|
||||
transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--menuHidden: none;
|
||||
}
|
||||
|
||||
/* Custom title bar: keep native `#title` children for sync, hide them visually.
|
||||
@@ -959,37 +975,35 @@ body > .sortable-fallback.bsplus-sortable-drag,
|
||||
list-style: none !important;
|
||||
}
|
||||
|
||||
#menu {
|
||||
li:is(.active, .hasChildren.bsplus-active) > .sub > ul > .item:not(.hasChildren) {
|
||||
position: relative;
|
||||
#menu li:is(.active, .hasChildren.bsplus-active) > .sub > ul > .item:not(.hasChildren) {
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: var(--item-colour, transparent);
|
||||
transition:
|
||||
width 100ms,
|
||||
transform 0.3s ease;
|
||||
border-radius: 8px 0 0 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:hover::before,
|
||||
&:is(.active, .bsplus-active)::before {
|
||||
width: 6px;
|
||||
background: var(--item-colour, transparent);
|
||||
}
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: var(--item-colour, transparent);
|
||||
transition:
|
||||
width 100ms,
|
||||
transform 0.3s ease;
|
||||
border-radius: 8px 0 0 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
li.active > .sub > ul > .active {
|
||||
background: rgba(0, 0, 0, 0.3) !important;
|
||||
&:hover::before,
|
||||
&:is(.active, .bsplus-active)::before {
|
||||
width: 6px;
|
||||
background: var(--item-colour, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
#menu li.active > .sub > ul > .active {
|
||||
background: rgba(0, 0, 0, 0.3) !important;
|
||||
}
|
||||
|
||||
#userActions {
|
||||
display: none;
|
||||
}
|
||||
@@ -1364,8 +1378,8 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
|
||||
#menu li:focus-visible,
|
||||
#menu section:focus-visible {
|
||||
outline: 1px solid rgb(from currentColor r g b / 0.55);
|
||||
outline-offset: -1px;
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: -2px;
|
||||
background: rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
|
||||
@@ -1863,12 +1877,16 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
border-radius: 50px;
|
||||
}
|
||||
.shortcut {
|
||||
box-sizing: border-box;
|
||||
height: 4em;
|
||||
width: 15em;
|
||||
max-width: 15em;
|
||||
padding: 0 20px 0 12px;
|
||||
gap: 10px;
|
||||
background: var(--background-primary);
|
||||
color: var(--text-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 80px;
|
||||
position: relative;
|
||||
transition: 200ms;
|
||||
@@ -1877,9 +1895,10 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
background: var(--auto-background);
|
||||
}
|
||||
.shortcut p {
|
||||
margin: auto 0px auto 5px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
width: 150px;
|
||||
word-wrap: break-word;
|
||||
line-height: 20px;
|
||||
}
|
||||
@@ -2022,14 +2041,9 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
}
|
||||
[class*="notifications__notifications___"] > button > [class*="notifications__bubble___"] {
|
||||
background: var(--better-alert-highlight);
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
.dark .legacy-root button.iconFamily::after {
|
||||
background: white;
|
||||
}
|
||||
.legacy-root button.iconFamily::after {
|
||||
background: currentColor;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.legacy-root button:not([disabled]):focus {
|
||||
border-color: var(--better-sub);
|
||||
@@ -2044,8 +2058,6 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
margin-bottom: 4px !important;
|
||||
|
||||
> [class*="notifications__dismiss___"] {
|
||||
background: rgba(0, 0, 0, 0.1) !important;
|
||||
color: var(--text-primary);
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
@@ -2086,11 +2098,37 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
margin-top: 5px;
|
||||
}
|
||||
[class*="notifications__actions___"] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 8px 4px 4px !important;
|
||||
background: var(--auto-background);
|
||||
|
||||
button {
|
||||
background: none !important;
|
||||
border: 1px solid white;
|
||||
margin: 0 !important;
|
||||
}
|
||||
}
|
||||
[class*="notifications__actions___"] button,
|
||||
[class*="notifications__dismiss___"] {
|
||||
border: none !important;
|
||||
border-radius: 8px !important;
|
||||
box-shadow: none !important;
|
||||
background: color-mix(in srgb, var(--text-primary) 10%, transparent) !important;
|
||||
color: var(--text-primary) !important;
|
||||
transition: background 200ms;
|
||||
|
||||
&::after {
|
||||
content: none !important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--text-primary) 18%, transparent) !important;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
[class*="notifications__details___"] {
|
||||
@@ -2127,7 +2165,6 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
content: "";
|
||||
font-size: 12px;
|
||||
margin-right: 4px;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -2163,7 +2200,6 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
|
||||
font-size: 16px;
|
||||
margin-left: 8px;
|
||||
margin-top: auto;
|
||||
font-family: "IconFamily";
|
||||
pointer-events: none;
|
||||
}
|
||||
[class*="Input__Input___"] {
|
||||
@@ -2918,14 +2954,12 @@ div.bar.flat {
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.dark {
|
||||
.cke_toolbox > .cke_toolbar .cke_combo_on > .cke_combo_button,
|
||||
.cke_toolbox > .cke_toolbar .cke_button_on {
|
||||
background-color: #3d3d3e !important;
|
||||
.dark .cke_toolbox > .cke_toolbar .cke_combo_on > .cke_combo_button,
|
||||
.dark .cke_toolbox > .cke_toolbar .cke_button_on {
|
||||
background-color: #3d3d3e !important;
|
||||
|
||||
&::after {
|
||||
background: rgb(207, 207, 207) !important;
|
||||
}
|
||||
&::after {
|
||||
background: rgb(207, 207, 207) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2967,18 +3001,14 @@ ul.uiSplitButtonList,
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
body {
|
||||
background: var(--theme-primary);
|
||||
overflow: hidden;
|
||||
}
|
||||
.shortcuticondiv {
|
||||
height: 39px;
|
||||
width: 39px;
|
||||
flex-shrink: 0;
|
||||
height: 39px !important;
|
||||
width: 39px !important;
|
||||
border-radius: 50%;
|
||||
padding: 0;
|
||||
margin: auto 0px auto 10px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
margin: 0;
|
||||
object-fit: contain;
|
||||
}
|
||||
.forumView > .messages > .thread,
|
||||
.forumView > .messages > .deletedPlaceholder,
|
||||
@@ -3219,9 +3249,6 @@ body:not(.clr-open) .clr-picker,
|
||||
z-index: 10;
|
||||
opacity: 0.4;
|
||||
}
|
||||
#menu {
|
||||
--menuHidden: none;
|
||||
}
|
||||
.editmenuoption {
|
||||
background: var(--background-primary);
|
||||
color: var(--text-primary);
|
||||
@@ -3239,18 +3266,48 @@ body:not(.clr-open) .clr-picker,
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.logout {
|
||||
background: none !important;
|
||||
padding: 5px 10px;
|
||||
.bsplus-tooltip-bubble:has(> .bsplus-logout) {
|
||||
min-width: 0;
|
||||
}
|
||||
.bsplus-tooltip-bubble .bsplus-logout {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px !important;
|
||||
height: 32px !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border: none !important;
|
||||
border-radius: 6px;
|
||||
box-shadow: none !important;
|
||||
background: none !important;
|
||||
color: #fff !important;
|
||||
opacity: 1 !important;
|
||||
cursor: pointer;
|
||||
transition: background 150ms;
|
||||
|
||||
#logouttooltip {
|
||||
width: 50px !important;
|
||||
margin-left: -28px !important;
|
||||
top: 105% !important;
|
||||
html.dark & {
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
.uiButton svg g {
|
||||
color: var(--background-primary) !important;
|
||||
&::after {
|
||||
content: none !important;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
fill: none !important;
|
||||
stroke: currentColor !important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, currentColor 12%, transparent) !important;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid currentColor !important;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
}
|
||||
.svg {
|
||||
@@ -3352,6 +3409,7 @@ body:not(.clr-open) .clr-picker,
|
||||
width: 25px;
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
color: inherit;
|
||||
}
|
||||
#userActions > .details > .code {
|
||||
text-transform: initial;
|
||||
@@ -3493,50 +3551,9 @@ div.day-empty {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.upcoming-blank {
|
||||
display: flex;
|
||||
border-bottom: 2px solid #bebebe;
|
||||
margin: 5px 50px;
|
||||
height: 2em;
|
||||
padding: 0px;
|
||||
}
|
||||
.upcoming-tick {
|
||||
align-self: center;
|
||||
}
|
||||
.upcoming-title h2 {
|
||||
width: 100%;
|
||||
}
|
||||
.upcoming-filters {
|
||||
display: flex;
|
||||
height: 26px;
|
||||
width: 65%;
|
||||
align-self: center;
|
||||
align-items: center;
|
||||
color: var(--text-color);
|
||||
padding: 5px;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.upcoming-checkbox-container {
|
||||
position: relative;
|
||||
padding: none !important;
|
||||
padding-left: 25px !important;
|
||||
padding-right: 10px !important;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
height: 20px;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.upcoming-hiddenassessment {
|
||||
color: #797979;
|
||||
}
|
||||
|
||||
.calendarEventEditor > .tabset > .item {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
@@ -3659,64 +3676,10 @@ div.day-empty {
|
||||
.upcoming-special-day {
|
||||
font-size: 20px;
|
||||
}
|
||||
.upcoming-blank {
|
||||
display: flex;
|
||||
border-bottom: 2px solid #bebebe;
|
||||
margin: 5px 50px;
|
||||
height: 2em;
|
||||
padding: 0px;
|
||||
}
|
||||
.upcoming-blank p {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.upcoming-title {
|
||||
display: flex;
|
||||
align-content: space-between;
|
||||
}
|
||||
.upcoming-checkbox-container input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.upcoming-checkmark {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
border: 3px solid var(--item-colour);
|
||||
border-radius: 5px;
|
||||
color: var(--text-color);
|
||||
}
|
||||
.upcoming-checkbox-container:hover input ~ .upcoming-checkmark {
|
||||
filter: brightness(0.8);
|
||||
}
|
||||
.upcoming-checkbox-container input:checked ~ .upcoming-checkmark {
|
||||
background: var(--item-colour);
|
||||
}
|
||||
.upcoming-checkmark:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: none;
|
||||
}
|
||||
.upcoming-checkbox-container input:checked ~ .upcoming-checkmark:after {
|
||||
display: block;
|
||||
}
|
||||
.upcoming-checkbox-container .upcoming-checkmark:after {
|
||||
left: 3.5px;
|
||||
top: 0px;
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
border: solid white;
|
||||
border-width: 0 3px 3px 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.titlebar {
|
||||
align-items: center;
|
||||
transition: 200ms;
|
||||
@@ -3772,11 +3735,9 @@ div.day-empty {
|
||||
color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.engage-child-select:focus {
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--background-primary),
|
||||
0 0 0 4px rgba(59, 130, 246, 0.45);
|
||||
.engage-child-select:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
#engage-day-container:has(> .day-empty) {
|
||||
@@ -3793,27 +3754,6 @@ div.day-empty {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#engage-logouttooltip {
|
||||
width: 50px !important;
|
||||
margin-left: -28px !important;
|
||||
top: 105% !important;
|
||||
|
||||
.engage-logout {
|
||||
background: none !important;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: var(--background-primary) !important;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 5px;
|
||||
|
||||
svg {
|
||||
fill: var(--background-primary) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pagename {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
@@ -3911,7 +3851,7 @@ div.day-empty {
|
||||
visibility 0s linear 0.45s;
|
||||
}
|
||||
.titlebar .bsplus-titlebar-badge:focus-visible {
|
||||
outline: 2px solid var(--theme-primary);
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.bsplus-founder-badge-slot--static .bsplus-titlebar-badge {
|
||||
@@ -3960,17 +3900,9 @@ div.day-empty {
|
||||
.bsplus-founder-badge:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
.bsplus-founder-badge:focus {
|
||||
outline: none;
|
||||
}
|
||||
.bsplus-founder-badge:focus-visible .bsplus-founder-badge__glass {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.78),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.52),
|
||||
inset 0 2px 8px rgba(255, 255, 255, 0.14),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.08),
|
||||
0 0 0 2px var(--theme-primary, #f97316),
|
||||
0 0 0 4px rgba(249, 115, 22, 0.35);
|
||||
.bsplus-founder-badge:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.bsplus-founder-badge__glass {
|
||||
position: relative;
|
||||
@@ -4077,23 +4009,6 @@ div.day-empty {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.bsplus-remote-page-banner {
|
||||
width: 90%;
|
||||
margin: 0 auto 0.75rem;
|
||||
padding: 0.65rem 0.85rem;
|
||||
border-radius: 12px;
|
||||
border: 1px solid color-mix(in srgb, var(--text-primary) 14%, transparent);
|
||||
background: color-mix(in srgb, var(--text-primary) 5%, var(--background-primary));
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.5;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.bsplus-remote-page-banner__title {
|
||||
font-weight: 600;
|
||||
margin: 0 0 0.35rem;
|
||||
}
|
||||
|
||||
.whatsnewTextContainer.bsplus-founder-badge-body p {
|
||||
margin: 0 0 1rem;
|
||||
font-size: 1.2rem;
|
||||
@@ -4142,10 +4057,8 @@ div.day-empty {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn:focus-visible {
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--background-primary, #fff),
|
||||
0 0 0 4px var(--better-main, #3b82f6);
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.bsplus-founder-badge-actions .bsplus-cal-btn--ghost {
|
||||
background: color-mix(in srgb, var(--text-primary, #111) 8%, transparent);
|
||||
@@ -4173,6 +4086,9 @@ div.day-empty {
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
}
|
||||
.userInfosvg path {
|
||||
transition: fill 200ms;
|
||||
}
|
||||
.userInfosvgdiv {
|
||||
width: 50px !important;
|
||||
height: 50px !important;
|
||||
@@ -4194,9 +4110,7 @@ div.day-empty {
|
||||
left: 15%;
|
||||
transition: background 200ms;
|
||||
}
|
||||
.userInfosvg path {
|
||||
transition: fill 200ms;
|
||||
}
|
||||
|
||||
.userInfohouse {
|
||||
padding: 2px 8px;
|
||||
font-size: 14px;
|
||||
@@ -4471,14 +4385,9 @@ div.day-empty {
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.bsplus-tos-btn:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.bsplus-tos-btn:focus-visible {
|
||||
box-shadow:
|
||||
0 0 0 2px var(--background-primary),
|
||||
0 0 0 4px color-mix(in srgb, var(--text-primary) 45%, transparent);
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.bsplus-tos-btn--primary {
|
||||
@@ -4586,6 +4495,13 @@ div.day-empty {
|
||||
.whatsnewFooter a {
|
||||
border: none;
|
||||
}
|
||||
.whatsnewFooter .socials {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 5px;
|
||||
padding: 0;
|
||||
background: none !important;
|
||||
}
|
||||
.whatsnewFooter div {
|
||||
margin: 0 15px;
|
||||
display: flex;
|
||||
@@ -4859,6 +4775,7 @@ div.day-empty {
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
line-clamp: 3;
|
||||
text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.themeOfTheMonthCardExpanded .themeOfTheMonthCardHeroEmbossVariants {
|
||||
@@ -4956,6 +4873,7 @@ div.day-empty {
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: unset;
|
||||
line-clamp: unset;
|
||||
}
|
||||
.themeOfTheMonthCard::before {
|
||||
content: "";
|
||||
@@ -5091,10 +5009,12 @@ div.day-empty {
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
line-clamp: 3;
|
||||
}
|
||||
.themeOfTheMonthCardDescriptionExpanded {
|
||||
display: block;
|
||||
-webkit-line-clamp: unset;
|
||||
line-clamp: unset;
|
||||
}
|
||||
.themeOfTheMonthCardExpanding:not(.themeOfTheMonthCardExpandedShell)
|
||||
.themeOfTheMonthCardDescriptionExpanded {
|
||||
@@ -5230,12 +5150,19 @@ div.day-empty {
|
||||
.popup-media-fullscreenable:hover {
|
||||
opacity: 0.95;
|
||||
}
|
||||
.popup-media-fullscreenable:focus {
|
||||
outline: none;
|
||||
[class*="Input__Input___"]:has(> input:focus-visible) {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.betterseqta-weight-input:focus-visible,
|
||||
#betterseqta-weight-override:focus-visible,
|
||||
#theme-of-the-month-card button:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.popup-media-fullscreenable:focus-visible {
|
||||
outline: 2px solid color-mix(in srgb, var(--text-primary) 70%, transparent);
|
||||
outline-offset: 4px;
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.bsplus-popup-media-overlay-backdrop {
|
||||
@@ -5503,18 +5430,6 @@ div.day-empty {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.notice-preview {
|
||||
font-size: 14px;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.notice-modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@@ -5716,122 +5631,8 @@ button.notice-close-btn {
|
||||
}
|
||||
}
|
||||
|
||||
.notice-modal-badge-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.notice-modal-badge {
|
||||
padding: 6px 12px;
|
||||
border-radius: 20px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.notice-modal-staff {
|
||||
font-size: 14px;
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.notice-modal-close {
|
||||
background: var(--background-secondary);
|
||||
border: none;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
color: var(--text-primary);
|
||||
transition: all 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
|
||||
&:hover {
|
||||
background: var(--background-tertiary);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
.notice-modal-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 16px 20px 20px;
|
||||
line-height: 1.3;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.notice-modal-body {
|
||||
padding: 0 20px 20px;
|
||||
font-size: 15px;
|
||||
line-height: 1.6;
|
||||
color: var(--text-secondary);
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 12px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--theme-primary);
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
margin: 12px 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.dark {
|
||||
.notice-card {
|
||||
border-color: rgba(255, 255, 255, 0.05);
|
||||
|
||||
&:hover {
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.notice-modal-content {
|
||||
border-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
.dark .notice-modal-content {
|
||||
border-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -5842,23 +5643,6 @@ button.notice-close-btn {
|
||||
.notice-modal-content {
|
||||
max-height: 90vh;
|
||||
}
|
||||
|
||||
.notice-modal-title {
|
||||
font-size: 20px;
|
||||
margin: 12px 16px 16px;
|
||||
}
|
||||
|
||||
.notice-modal-body {
|
||||
padding: 0 16px 16px;
|
||||
}
|
||||
|
||||
.notice-card {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.notice-preview {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
h2.home-subtitle {
|
||||
|
||||
+26
-2
@@ -26,11 +26,11 @@
|
||||
--text-13xl: 16rem;
|
||||
--text-14xl: 18rem;
|
||||
|
||||
--font-IconFamily: IconFamily;
|
||||
|
||||
--animate-spin-fast: spin 0.4s linear infinite;
|
||||
|
||||
--aspect-theme: 5 / 1;
|
||||
|
||||
--font-IconFamily: IconFamily;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -45,4 +45,28 @@
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
:root,
|
||||
:host {
|
||||
--bsplus-focus-ring: 2px solid var(--color-zinc-900);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--bsplus-focus-ring: 2px solid var(--color-white);
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
:focus-visible,
|
||||
input:focus-visible,
|
||||
[type]:focus-visible,
|
||||
textarea:focus-visible,
|
||||
select:focus-visible {
|
||||
outline: var(--bsplus-focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
Vendored
-1
@@ -1,6 +1,5 @@
|
||||
declare module "*.mp4";
|
||||
declare module "*.webm";
|
||||
declare module "*.woff";
|
||||
declare module "*.scss";
|
||||
declare module "*.png";
|
||||
declare module "*.webp";
|
||||
|
||||
@@ -17,16 +17,20 @@
|
||||
|
||||
const variants = {
|
||||
primary: "bg-zinc-100 text-zinc-900 border-transparent enabled:hover:bg-white",
|
||||
secondary: "dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white enabled:hover:brightness-125",
|
||||
ghost: "bg-transparent border-transparent dark:text-white enabled:hover:bg-zinc-200/60 dark:enabled:hover:bg-zinc-700/50",
|
||||
secondary:
|
||||
"dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white enabled:hover:brightness-125",
|
||||
ghost:
|
||||
"bg-transparent border-transparent dark:text-white enabled:hover:bg-zinc-200/60 dark:enabled:hover:bg-zinc-700/50",
|
||||
};
|
||||
</script>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onclick={onClick}
|
||||
disabled={disabled}
|
||||
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 {variants[variant]} {className}"
|
||||
{disabled}
|
||||
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] disabled:cursor-not-allowed disabled:opacity-50 {variants[
|
||||
variant
|
||||
]} {className}"
|
||||
>
|
||||
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
|
||||
{text}
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
import { onMount } from "svelte";
|
||||
import { animate } from "motion";
|
||||
import { delay } from "@/seqta/utils/delay.ts";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
|
||||
import Button from "./Button.svelte";
|
||||
|
||||
const { hidePanel }: {
|
||||
const {
|
||||
hidePanel,
|
||||
}: {
|
||||
hidePanel: () => void;
|
||||
} = $props();
|
||||
|
||||
@@ -22,15 +24,11 @@
|
||||
});
|
||||
|
||||
if (background && content) {
|
||||
animate(
|
||||
background,
|
||||
{ opacity: [0, 1] },
|
||||
{ duration: 0.3, ease: [0.4, 0, 0.2, 1] }
|
||||
);
|
||||
animate(background, { opacity: [0, 1] }, { duration: 0.3, ease: [0.4, 0, 0.2, 1] });
|
||||
animate(
|
||||
content,
|
||||
{ scale: [0.4, 1], opacity: [0, 1] },
|
||||
{ type: "spring", stiffness: 400, damping: 30 }
|
||||
{ type: "spring", stiffness: 400, damping: 30 },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,13 +48,9 @@
|
||||
animate(
|
||||
content,
|
||||
{ scale: [1, 0.4], opacity: [1, 0] },
|
||||
{ type: "spring", stiffness: 400, damping: 30 }
|
||||
);
|
||||
animate(
|
||||
background,
|
||||
{ opacity: [1, 0] },
|
||||
{ ease: [0.4, 0, 0.2, 1] }
|
||||
{ type: "spring", stiffness: 400, damping: 30 },
|
||||
);
|
||||
animate(background, { opacity: [1, 0] }, { ease: [0.4, 0, 0.2, 1] });
|
||||
await delay(400);
|
||||
hidePanel();
|
||||
}
|
||||
@@ -92,9 +86,13 @@
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
bind:this={background}
|
||||
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full cursor-pointer bg-black/50 {$settingsState.DarkMode ? 'dark' : ''}"
|
||||
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full cursor-pointer bg-black/50 {$settingsState.DarkMode
|
||||
? 'dark'
|
||||
: ''}"
|
||||
onclick={handleBackgroundClick}
|
||||
onkeydown={(e) => { if (e.key === "Enter") handleBackgroundClick(e as unknown as MouseEvent) }}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Enter") handleBackgroundClick(e as unknown as MouseEvent);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
bind:this={content}
|
||||
@@ -114,16 +112,23 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if !cloudState.user?.pfpUrl}
|
||||
<div class="flex items-center justify-center w-12 h-12 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-base">
|
||||
<div
|
||||
class="flex items-center justify-center w-12 h-12 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-base"
|
||||
>
|
||||
{getInitials()}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="text-sm font-medium text-zinc-900 dark:text-white truncate">
|
||||
{cloudState.user?.displayName || cloudState.user?.username || cloudState.user?.email || "User"}
|
||||
{cloudState.user?.displayName ||
|
||||
cloudState.user?.username ||
|
||||
cloudState.user?.email ||
|
||||
"User"}
|
||||
</p>
|
||||
{#if cloudState.user?.email && cloudState.user?.email !== (cloudState.user?.displayName || cloudState.user?.username)}
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400 truncate">{cloudState.user.email}</p>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400 truncate">
|
||||
{cloudState.user.email}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -140,7 +145,7 @@
|
||||
<p class="text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to sync settings across devices, use your cloud profile picture, and more.
|
||||
</p>
|
||||
<Button class="w-full" icon={""} text="Sign in with BetterSEQTA Cloud" onClick={handleSignIn} />
|
||||
<Button class="w-full" text="Sign in with BetterSEQTA Cloud" onClick={handleSignIn} />
|
||||
{#if loginError}
|
||||
<p class="text-xs text-red-600 dark:text-red-400">{loginError}</p>
|
||||
{/if}
|
||||
|
||||
@@ -1,42 +1,37 @@
|
||||
<script lang="ts">
|
||||
import { resolveCloudPfp, defaultAccountsPfpUrl } from "@/seqta/utils/cloudPfpCache";
|
||||
import type { CloudUser } from "@/seqta/utils/CloudAuth";
|
||||
import {
|
||||
resolveCloudPfp,
|
||||
defaultAccountsPfpUrl,
|
||||
revokePfpUrl,
|
||||
} from "@/seqta/utils/cloudPfpCache";
|
||||
import type { CloudUser } from "@/seqta/utils/cloudAuth";
|
||||
|
||||
const { user, class: className = "" }: {
|
||||
const {
|
||||
user,
|
||||
class: className = "",
|
||||
}: {
|
||||
user: CloudUser | null | undefined;
|
||||
class?: string;
|
||||
} = $props();
|
||||
|
||||
let avatarSrc = $state<string | undefined>(undefined);
|
||||
let revokeUrl: string | undefined;
|
||||
let avatarSrc = $state<string | null>(null);
|
||||
|
||||
$effect(() => {
|
||||
const u = user;
|
||||
if (revokeUrl) {
|
||||
URL.revokeObjectURL(revokeUrl);
|
||||
revokeUrl = undefined;
|
||||
}
|
||||
avatarSrc = undefined;
|
||||
|
||||
avatarSrc = null;
|
||||
if (!u?.id) return;
|
||||
|
||||
const pfpUrl = u.pfpUrl ?? defaultAccountsPfpUrl(u.id);
|
||||
|
||||
let cancelled = false;
|
||||
void resolveCloudPfp(u.id, pfpUrl).then((resolved) => {
|
||||
if (cancelled || !resolved) return;
|
||||
if (resolved.fromCache) {
|
||||
revokeUrl = resolved.src;
|
||||
}
|
||||
avatarSrc = resolved.src;
|
||||
let resolved: string | null = null;
|
||||
void resolveCloudPfp(u.id, u.pfpUrl ?? defaultAccountsPfpUrl(u.id)).then((src) => {
|
||||
resolved = src;
|
||||
if (cancelled) return revokePfpUrl(src);
|
||||
avatarSrc = src;
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
if (revokeUrl) {
|
||||
URL.revokeObjectURL(revokeUrl);
|
||||
revokeUrl = undefined;
|
||||
}
|
||||
revokePfpUrl(resolved);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<script lang="ts">
|
||||
import browser from "@/lib/browser";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import Button from "./Button.svelte";
|
||||
import Switch from "./Switch.svelte";
|
||||
|
||||
let { showDisclaimer }: {
|
||||
let {
|
||||
showDisclaimer,
|
||||
}: {
|
||||
showDisclaimer: (onConfirm: () => void, onCancel: () => void) => void;
|
||||
} = $props();
|
||||
|
||||
@@ -73,7 +75,9 @@
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-[11px] font-semibold text-zinc-800 dark:text-zinc-100">Automatic sync</p>
|
||||
<p class="text-[10px] text-zinc-500 dark:text-zinc-400">Syncs settings when SEQTA loads and when you make changes</p>
|
||||
<p class="text-[10px] text-zinc-500 dark:text-zinc-400">
|
||||
Syncs settings when SEQTA loads and when you make changes
|
||||
</p>
|
||||
</div>
|
||||
<div class="shrink-0">
|
||||
<Switch
|
||||
@@ -84,11 +88,7 @@
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button
|
||||
text={busy ? "Please wait\u2026" : "Upload"}
|
||||
onClick={upload}
|
||||
disabled={busy}
|
||||
/>
|
||||
<Button text={busy ? "Please wait\u2026" : "Upload"} onClick={upload} disabled={busy} />
|
||||
<Button
|
||||
text={busy ? "Please wait\u2026" : "Download"}
|
||||
onClick={promptDownload}
|
||||
@@ -110,7 +110,8 @@
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="font-medium text-emerald-600 underline decoration-emerald-600/50 underline-offset-2 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 rounded-xs"
|
||||
>Privacy policy</a>
|
||||
>Privacy policy</a
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,69 +1,95 @@
|
||||
<script lang="ts">
|
||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
import { EditorState } from '@codemirror/state';
|
||||
import { highlightSelectionMatches } from '@codemirror/search';
|
||||
import { indentWithTab, history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||
import { indentOnInput, indentUnit, bracketMatching, foldKeymap, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
|
||||
import { closeBrackets, autocompletion, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
||||
import { highlightSpecialChars, drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine, keymap, EditorView, dropCursor, type KeyBinding } from '@codemirror/view';
|
||||
import { color } from '@uiw/codemirror-extensions-color'
|
||||
import { Compartment } from '@codemirror/state';
|
||||
import { EditorState } from "@codemirror/state";
|
||||
import { highlightSelectionMatches } from "@codemirror/search";
|
||||
import { indentWithTab, history, defaultKeymap, historyKeymap } from "@codemirror/commands";
|
||||
import {
|
||||
indentOnInput,
|
||||
indentUnit,
|
||||
bracketMatching,
|
||||
foldKeymap,
|
||||
syntaxHighlighting,
|
||||
defaultHighlightStyle,
|
||||
} from "@codemirror/language";
|
||||
import {
|
||||
closeBrackets,
|
||||
autocompletion,
|
||||
closeBracketsKeymap,
|
||||
completionKeymap,
|
||||
} from "@codemirror/autocomplete";
|
||||
import {
|
||||
highlightSpecialChars,
|
||||
drawSelection,
|
||||
rectangularSelection,
|
||||
crosshairCursor,
|
||||
highlightActiveLine,
|
||||
keymap,
|
||||
EditorView,
|
||||
dropCursor,
|
||||
type KeyBinding,
|
||||
} from "@codemirror/view";
|
||||
import { color } from "@uiw/codemirror-extensions-color";
|
||||
import { Compartment } from "@codemirror/state";
|
||||
|
||||
import { githubLight, githubDark } from '@uiw/codemirror-theme-github';
|
||||
import { githubLight, githubDark } from "@uiw/codemirror-theme-github";
|
||||
|
||||
import { css } from "@codemirror/lang-css";
|
||||
|
||||
let editor = $state<HTMLDivElement | null>(null)
|
||||
let editor = $state<HTMLDivElement | null>(null);
|
||||
let view: EditorView | null = null;
|
||||
let unsubSettings: (() => void) | undefined;
|
||||
let editorTheme = new Compartment();
|
||||
let { value, onChange, className }: {value: string, onChange: (value: string) => void, className?: string} = $props()
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
className,
|
||||
}: { value: string; onChange: (value: string) => void; className?: string } = $props();
|
||||
|
||||
function createEditorState(initialContents: string) {
|
||||
let extensions = [
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
drawSelection(),
|
||||
indentUnit.of(" "),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
indentOnInput(),
|
||||
bracketMatching(),
|
||||
closeBrackets(),
|
||||
autocompletion(),
|
||||
rectangularSelection(),
|
||||
crosshairCursor(),
|
||||
dropCursor(),
|
||||
highlightActiveLine(),
|
||||
highlightSelectionMatches(),
|
||||
editorTheme.of(githubLight),
|
||||
keymap.of([
|
||||
indentWithTab,
|
||||
...closeBracketsKeymap,
|
||||
...defaultKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
] as KeyBinding[]),
|
||||
EditorView.updateListener.of((update) => {
|
||||
if (update.docChanged) {
|
||||
onChange(update.state.doc.toString())
|
||||
}
|
||||
}),
|
||||
css(),
|
||||
color,
|
||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
||||
];
|
||||
let extensions = [
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
drawSelection(),
|
||||
indentUnit.of(" "),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
indentOnInput(),
|
||||
bracketMatching(),
|
||||
closeBrackets(),
|
||||
autocompletion(),
|
||||
rectangularSelection(),
|
||||
crosshairCursor(),
|
||||
dropCursor(),
|
||||
highlightActiveLine(),
|
||||
highlightSelectionMatches(),
|
||||
editorTheme.of(githubLight),
|
||||
keymap.of([
|
||||
indentWithTab,
|
||||
...closeBracketsKeymap,
|
||||
...defaultKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
] as KeyBinding[]),
|
||||
EditorView.updateListener.of((update) => {
|
||||
if (update.docChanged) {
|
||||
onChange(update.state.doc.toString());
|
||||
}
|
||||
}),
|
||||
css(),
|
||||
color,
|
||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
||||
];
|
||||
|
||||
return EditorState.create({
|
||||
doc: initialContents,
|
||||
extensions
|
||||
});
|
||||
return EditorState.create({
|
||||
doc: initialContents,
|
||||
extensions,
|
||||
});
|
||||
}
|
||||
|
||||
function createEditorView(state: EditorState, parent: HTMLElement) {
|
||||
return new EditorView({ state, parent });
|
||||
return new EditorView({ state, parent });
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
@@ -75,10 +101,8 @@
|
||||
unsubSettings = settingsState.subscribe((settings) => {
|
||||
if (view) {
|
||||
view.dispatch({
|
||||
effects: editorTheme.reconfigure(
|
||||
settings.DarkMode ? githubDark : githubLight
|
||||
)
|
||||
})
|
||||
effects: editorTheme.reconfigure(settings.DarkMode ? githubDark : githubLight),
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -88,7 +112,10 @@
|
||||
if (view) {
|
||||
view.destroy();
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class={`rounded-lg text-[13px] overflow-clip w-full bg-white dark:bg-zinc-900 ${className}`} bind:this={editor}></div>
|
||||
<div
|
||||
class={`rounded-lg text-[13px] overflow-clip w-full bg-white dark:bg-zinc-900 ${className}`}
|
||||
bind:this={editor}
|
||||
></div>
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import { animate } from 'motion';
|
||||
import { delay } from '@/seqta/utils/delay'
|
||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||
import GradientPicker from './colourPicker/GradientPicker.svelte'
|
||||
import { onMount } from "svelte";
|
||||
import { animate } from "motion";
|
||||
import { delay } from "@/seqta/utils/delay";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import GradientPicker from "./colourPicker/GradientPicker.svelte";
|
||||
|
||||
const PRESETS_KEY = 'colorPickerPresets';
|
||||
const PRESETS_KEY = "colorPickerPresets";
|
||||
const MAX_PRESETS = 18;
|
||||
const DEFAULT_PRESETS = [
|
||||
"linear-gradient(30deg, rgba(229,209,218,1) 0%, RGBA(235,169,202,1) 46%, rgba(214,155,162,1) 100%)",
|
||||
@@ -49,12 +49,12 @@
|
||||
let current = $state(initialColour());
|
||||
|
||||
function initialColour(): string {
|
||||
return customState ?? settingsState.selectedColor ?? '';
|
||||
return customState ?? settingsState.selectedColor ?? "";
|
||||
}
|
||||
|
||||
function loadPresets(): string[] {
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(PRESETS_KEY) ?? 'null');
|
||||
const saved = JSON.parse(localStorage.getItem(PRESETS_KEY) ?? "null");
|
||||
return Array.isArray(saved) ? saved : DEFAULT_PRESETS;
|
||||
} catch {
|
||||
return DEFAULT_PRESETS;
|
||||
@@ -63,7 +63,10 @@
|
||||
|
||||
function rememberPreset(colour: string) {
|
||||
if (!colour || presets[0] === colour) return;
|
||||
const updated = [colour, ...presets.filter((preset) => preset !== colour)].slice(0, MAX_PRESETS);
|
||||
const updated = [colour, ...presets.filter((preset) => preset !== colour)].slice(
|
||||
0,
|
||||
MAX_PRESETS,
|
||||
);
|
||||
localStorage.setItem(PRESETS_KEY, JSON.stringify(updated));
|
||||
}
|
||||
|
||||
@@ -76,26 +79,34 @@
|
||||
const closePicker = async () => {
|
||||
if (standalone || !background || !content) return;
|
||||
|
||||
animate(content, { scale: [1, 0.4], opacity: [1, 0] }, { type: 'spring', stiffness: 400, damping: 30 });
|
||||
animate(
|
||||
content,
|
||||
{ scale: [1, 0.4], opacity: [1, 0] },
|
||||
{ type: "spring", stiffness: 400, damping: 30 },
|
||||
);
|
||||
animate(background, { opacity: [1, 0] }, { ease: [0.4, 0, 0.2, 1] });
|
||||
|
||||
await delay(400);
|
||||
hidePicker?.();
|
||||
}
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
if (!standalone && background && content) {
|
||||
animate(background, { opacity: [0, 1] }, { duration: 0.3, ease: [0.4, 0, 0.2, 1] });
|
||||
animate(content, { scale: [0.4, 1], opacity: [0, 1] }, { type: 'spring', stiffness: 400, damping: 30 });
|
||||
animate(
|
||||
content,
|
||||
{ scale: [0.4, 1], opacity: [0, 1] },
|
||||
{ type: "spring", stiffness: 400, damping: 30 },
|
||||
);
|
||||
}
|
||||
|
||||
const handleEscapeKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') closePicker();
|
||||
if (event.key === "Escape") closePicker();
|
||||
};
|
||||
document.addEventListener('keydown', handleEscapeKey);
|
||||
document.addEventListener("keydown", handleEscapeKey);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('keydown', handleEscapeKey);
|
||||
document.removeEventListener("keydown", handleEscapeKey);
|
||||
if (savePresets && !customOnChange) rememberPreset(current);
|
||||
};
|
||||
});
|
||||
@@ -113,9 +124,13 @@
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
bind:this={background}
|
||||
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full shadow-2xl cursor-pointer bg-black/20 border border-[#DDDDDD]/30 dark:border-[#38373D]/30 {$settingsState.DarkMode ? 'dark' : ''}"
|
||||
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full shadow-2xl cursor-pointer bg-black/20 border border-[#DDDDDD]/30 dark:border-[#38373D]/30 {$settingsState.DarkMode
|
||||
? 'dark'
|
||||
: ''}"
|
||||
onclick={handleBackgroundClick}
|
||||
onkeydown={(event) => { if (event.key === 'Enter') handleBackgroundClick(event as unknown as MouseEvent) }}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter") handleBackgroundClick(event as unknown as MouseEvent);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
bind:this={content}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import QRCode from "qrcode";
|
||||
import Button from "./Button.svelte";
|
||||
import { portal } from "../utils/portal";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
|
||||
let showQrModal = $state(false);
|
||||
let qrDataUrl = $state<string | null>(null);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { fade } from 'svelte/transition';
|
||||
import { animate } from 'motion';
|
||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState';
|
||||
import { fade } from "svelte/transition";
|
||||
import { animate } from "motion";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
|
||||
let { onConfirm, onCancel, title, message }: {
|
||||
let {
|
||||
onConfirm,
|
||||
onCancel,
|
||||
title,
|
||||
message,
|
||||
}: {
|
||||
onConfirm: () => void;
|
||||
onCancel: () => void;
|
||||
title: string;
|
||||
@@ -18,39 +23,41 @@
|
||||
modalElement,
|
||||
{ scale: [0.9, 1], opacity: [0, 1] },
|
||||
{
|
||||
type: 'spring',
|
||||
type: "spring",
|
||||
stiffness: 300,
|
||||
damping: 25
|
||||
}
|
||||
damping: 25,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="flex fixed inset-0 z-10000 justify-center items-center bg-black/50 {$settingsState.DarkMode ? 'dark' : ''}"
|
||||
<div
|
||||
class="flex fixed inset-0 z-10000 justify-center items-center bg-black/50 {$settingsState.DarkMode
|
||||
? 'dark'
|
||||
: ''}"
|
||||
style="position: fixed; top: 0; left: 0; right: 0; bottom: 0;"
|
||||
onclick={(e) => {
|
||||
if (e.target === e.currentTarget) onCancel();
|
||||
}}
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Escape') onCancel();
|
||||
}}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
if (e.key === "Escape") onCancel();
|
||||
}}
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
transition:fade={{ duration: 150 }}
|
||||
>
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
bind:this={modalElement}
|
||||
class="p-4 mx-4 w-full max-w-md bg-white rounded-2xl shadow-2xl dark:bg-zinc-800"
|
||||
class="p-4 mx-4 w-full max-w-md bg-white rounded-2xl shadow-2xl dark:bg-zinc-800"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onkeydown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<h2 class="mb-3 text-xl font-bold text-gray-900 dark:text-white">
|
||||
{title}
|
||||
</h2>
|
||||
|
||||
|
||||
<div class="mb-6 text-lg text-gray-700 whitespace-pre-line dark:text-gray-300">
|
||||
{message}
|
||||
</div>
|
||||
@@ -71,4 +78,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,10 +22,13 @@
|
||||
validateFeedbackForm,
|
||||
type FeedbackStatusItem,
|
||||
} from "@/seqta/utils/feedback/client";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import Spinner from "./Spinner.svelte";
|
||||
|
||||
let { onClose, initialFeedbackId = null }: {
|
||||
let {
|
||||
onClose,
|
||||
initialFeedbackId = null,
|
||||
}: {
|
||||
onClose: () => void;
|
||||
initialFeedbackId?: string | null;
|
||||
} = $props();
|
||||
@@ -56,10 +59,9 @@
|
||||
? "background-color:#18181b;color:#fafafa;border-color:#52525b;color-scheme:dark"
|
||||
: "background-color:#fff;color:#18181b;border-color:#e4e4e7;color-scheme:light",
|
||||
);
|
||||
const field =
|
||||
"feedback-field w-full px-3 py-2.5 text-[18px] rounded-lg border focus:outline-hidden focus:ring-2 focus:ring-zinc-400";
|
||||
const field = "feedback-field w-full px-3 py-2.5 text-[18px] rounded-lg border ";
|
||||
const btn =
|
||||
"px-4 py-2 text-[18px] font-medium rounded-lg transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-hidden focus:ring-2 focus:ring-zinc-400 disabled:opacity-50";
|
||||
"px-4 py-2 text-[18px] font-medium rounded-lg transition-all duration-200 hover:scale-105 active:scale-95 disabled:opacity-50";
|
||||
const btnMuted = $derived(
|
||||
`${btn} ${isDark ? "bg-zinc-700 text-zinc-200" : "bg-zinc-200 text-zinc-700"}`,
|
||||
);
|
||||
@@ -412,8 +414,9 @@
|
||||
{:else}
|
||||
<p class="mb-4 text-zinc-500">No response yet.</p>
|
||||
{/if}
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p
|
||||
>{/if}
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">
|
||||
{statusError}
|
||||
</p>{/if}
|
||||
<div class="flex gap-3 justify-end">
|
||||
<button
|
||||
type="button"
|
||||
@@ -437,8 +440,9 @@
|
||||
{statusLoading ? "…" : "Refresh"}
|
||||
</button>
|
||||
</div>
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p
|
||||
>{/if}
|
||||
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">
|
||||
{statusError}
|
||||
</p>{/if}
|
||||
{#if statusLoading && !statusItems.length}
|
||||
<div class="feedback-loading" aria-busy="true" aria-live="polite">
|
||||
<Spinner size="md" />
|
||||
@@ -461,14 +465,13 @@
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => openStatusItem(item.id)}
|
||||
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] focus:outline-hidden focus:ring-2 focus:ring-zinc-400 {isDark
|
||||
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] {isDark
|
||||
? 'border-zinc-700 bg-zinc-900/40'
|
||||
: 'border-zinc-200 bg-white'}"
|
||||
>
|
||||
<p class="text-base text-zinc-500 mb-0.5">
|
||||
{formatStatus(item.status)}{#if hasReply(item)} · Reply{/if} · {categoryLabel(
|
||||
item.category,
|
||||
)}
|
||||
{formatStatus(item.status)}{#if hasReply(item)}
|
||||
· Reply{/if} · {categoryLabel(item.category)}
|
||||
</p>
|
||||
<p class="font-medium truncate">{item.subject || "Untitled"}</p>
|
||||
</button>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { fade } from "svelte/transition";
|
||||
import { onMount } from "svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { FONT_PRESETS, DEFAULT_FONT_ID, getFontPreset } from "@/seqta/ui/fonts/presets";
|
||||
import {
|
||||
applySelectedFont,
|
||||
buildFontPreviewCss,
|
||||
ensureFontPickerFontsLoaded,
|
||||
} from "@/seqta/ui/fonts/Manager";
|
||||
} from "@/seqta/ui/fonts/fontManager";
|
||||
import { portal } from "@/interface/utils/portal";
|
||||
import { syncPageThemeToElement } from "@/interface/utils/syncPageTheme";
|
||||
import { copyPageTheme, resolvePageAccentColor } from "@/seqta/ui/colors/pageTheme";
|
||||
import fontPickerStyles from "./fontPickerModal.css?inline";
|
||||
|
||||
let { hidePicker }: { hidePicker: () => void } = $props();
|
||||
@@ -33,15 +33,16 @@
|
||||
}
|
||||
|
||||
function syncTheme() {
|
||||
if (rootEl) syncPageThemeToElement(rootEl);
|
||||
if (rootEl) {
|
||||
copyPageTheme(rootEl);
|
||||
rootEl.style.setProperty("--better-main", resolvePageAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
void ensureFontPickerFontsLoaded();
|
||||
|
||||
styleEl = document.getElementById(
|
||||
"betterseqta-font-picker-styles",
|
||||
) as HTMLStyleElement | null;
|
||||
styleEl = document.getElementById("betterseqta-font-picker-styles") as HTMLStyleElement | null;
|
||||
if (!styleEl) {
|
||||
styleEl = document.createElement("style");
|
||||
styleEl.id = "betterseqta-font-picker-styles";
|
||||
@@ -77,7 +78,8 @@
|
||||
class="bsplus-font-picker-overlay bsplus-font-picker-root"
|
||||
onclick={handleBackdropClick}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") handleBackdropClick(event as unknown as MouseEvent);
|
||||
if (event.key === "Enter" || event.key === " ")
|
||||
handleBackdropClick(event as unknown as MouseEvent);
|
||||
}}
|
||||
role="presentation"
|
||||
transition:fade={{ duration: 200 }}
|
||||
@@ -112,12 +114,8 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="bsplus-font-picker-header-text">
|
||||
<h2 id="font-picker-title" class="bsplus-font-picker-title">
|
||||
Choose a font
|
||||
</h2>
|
||||
<p class="bsplus-font-picker-desc">
|
||||
Choose a typeface for SEQTA Learn.
|
||||
</p>
|
||||
<h2 id="font-picker-title" class="bsplus-font-picker-title">Choose a font</h2>
|
||||
<p class="bsplus-font-picker-desc">Choose a typeface for SEQTA Learn.</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -130,7 +128,7 @@
|
||||
data-font-id={preset.id}
|
||||
>
|
||||
<div class="bsplus-font-picker-option-head">
|
||||
<span
|
||||
<span
|
||||
class="bsplus-font-picker-option-name"
|
||||
style="font-family: {preset.stack} !important;"
|
||||
>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
<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 }: {
|
||||
value: string,
|
||||
onChange: (newValue: string) => void
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (newValue: string) => void;
|
||||
} = $props();
|
||||
|
||||
let isRecording = $state(false);
|
||||
@@ -13,43 +19,43 @@
|
||||
const formatKeyForHotkey = (key: string): string => {
|
||||
// Map special keys to their hotkey format
|
||||
const keyMap: Record<string, string> = {
|
||||
'Control': 'ctrl',
|
||||
'Meta': 'cmd',
|
||||
'Alt': 'alt',
|
||||
'Shift': 'shift',
|
||||
' ': 'space',
|
||||
'ArrowUp': 'up',
|
||||
'ArrowDown': 'down',
|
||||
'ArrowLeft': 'left',
|
||||
'ArrowRight': 'right',
|
||||
'Escape': 'esc',
|
||||
'Enter': 'enter',
|
||||
'Tab': 'tab',
|
||||
'Backspace': 'backspace',
|
||||
'Delete': 'delete',
|
||||
Control: "ctrl",
|
||||
Meta: "cmd",
|
||||
Alt: "alt",
|
||||
Shift: "shift",
|
||||
" ": "space",
|
||||
ArrowUp: "up",
|
||||
ArrowDown: "down",
|
||||
ArrowLeft: "left",
|
||||
ArrowRight: "right",
|
||||
Escape: "esc",
|
||||
Enter: "enter",
|
||||
Tab: "tab",
|
||||
Backspace: "backspace",
|
||||
Delete: "delete",
|
||||
};
|
||||
|
||||
return keyMap[key] || key.toLowerCase();
|
||||
};
|
||||
|
||||
const formatKeyForDisplay = (key: string): string => {
|
||||
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
||||
const keyMap: Record<string, string> = {
|
||||
'ctrl': isMac ? '⌃' : 'Ctrl',
|
||||
'cmd': '⌘',
|
||||
'meta': '⌘',
|
||||
'alt': isMac ? '⌥' : 'Alt',
|
||||
'shift': isMac ? '⇧' : 'Shift',
|
||||
'space': 'Space',
|
||||
'up': '↑',
|
||||
'down': '↓',
|
||||
'left': '←',
|
||||
'right': '→',
|
||||
'esc': 'Esc',
|
||||
'enter': 'Enter',
|
||||
'tab': 'Tab',
|
||||
'backspace': 'Backspace',
|
||||
'delete': 'Delete',
|
||||
ctrl: isMac ? "⌃" : "Ctrl",
|
||||
cmd: "⌘",
|
||||
meta: "⌘",
|
||||
alt: isMac ? "⌥" : "Alt",
|
||||
shift: isMac ? "⇧" : "Shift",
|
||||
space: "Space",
|
||||
up: "↑",
|
||||
down: "↓",
|
||||
left: "←",
|
||||
right: "→",
|
||||
esc: "Esc",
|
||||
enter: "Enter",
|
||||
tab: "Tab",
|
||||
backspace: "Backspace",
|
||||
delete: "Delete",
|
||||
};
|
||||
|
||||
return keyMap[key.toLowerCase()] || key.toUpperCase();
|
||||
@@ -62,15 +68,15 @@
|
||||
|
||||
const parsed = parseHotkey(hotkeyString);
|
||||
const parts: string[] = [];
|
||||
|
||||
|
||||
// Add modifiers in a consistent order
|
||||
if (parsed.ctrl) parts.push('ctrl');
|
||||
if (parsed.meta) parts.push('cmd');
|
||||
if (parsed.alt) parts.push('alt');
|
||||
if (parsed.shift) parts.push('shift');
|
||||
|
||||
if (parsed.ctrl) parts.push("ctrl");
|
||||
if (parsed.meta) parts.push("cmd");
|
||||
if (parsed.alt) parts.push("alt");
|
||||
if (parsed.shift) parts.push("shift");
|
||||
|
||||
if (parsed.key) parts.push(parsed.key);
|
||||
|
||||
|
||||
return parts;
|
||||
};
|
||||
|
||||
@@ -82,8 +88,8 @@
|
||||
|
||||
const stopRecording = () => {
|
||||
if (recordedKeys.size > 0) {
|
||||
if (recordedKeys.has('esc')) {
|
||||
onChange('');
|
||||
if (recordedKeys.has("esc")) {
|
||||
onChange("");
|
||||
isRecording = false;
|
||||
recordedKeys = new Set();
|
||||
inputElement?.blur();
|
||||
@@ -91,10 +97,10 @@
|
||||
}
|
||||
|
||||
const modifiers: string[] = [];
|
||||
let mainKey = '';
|
||||
let mainKey = "";
|
||||
|
||||
for (const key of recordedKeys) {
|
||||
if (['ctrl', 'cmd', 'alt', 'shift'].includes(key)) {
|
||||
if (["ctrl", "cmd", "alt", "shift"].includes(key)) {
|
||||
modifiers.push(key);
|
||||
} else {
|
||||
mainKey = key;
|
||||
@@ -102,13 +108,13 @@
|
||||
}
|
||||
|
||||
if (mainKey) {
|
||||
const hotkeyString = [...modifiers, mainKey].join('+');
|
||||
const hotkeyString = [...modifiers, mainKey].join("+");
|
||||
if (isValidHotkey(hotkeyString)) {
|
||||
onChange(hotkeyString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
isRecording = false;
|
||||
recordedKeys = new Set();
|
||||
inputElement?.blur();
|
||||
@@ -122,24 +128,24 @@
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (!isRecording) return;
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const key = formatKeyForHotkey(e.key);
|
||||
|
||||
if (e.ctrlKey) addRecordedKey('ctrl');
|
||||
if (e.metaKey) addRecordedKey('cmd');
|
||||
if (e.altKey) addRecordedKey('alt');
|
||||
if (e.shiftKey) addRecordedKey('shift');
|
||||
|
||||
|
||||
if (e.ctrlKey) addRecordedKey("ctrl");
|
||||
if (e.metaKey) addRecordedKey("cmd");
|
||||
if (e.altKey) addRecordedKey("alt");
|
||||
if (e.shiftKey) addRecordedKey("shift");
|
||||
|
||||
// Add the main key (ignore modifier keys themselves)
|
||||
if (!['ctrl', 'cmd', 'alt', 'shift'].includes(key)) {
|
||||
if (!["ctrl", "cmd", "alt", "shift"].includes(key)) {
|
||||
addRecordedKey(key);
|
||||
}
|
||||
|
||||
// Auto-stop recording if we have a main key
|
||||
if (!['ctrl', 'cmd', 'alt', 'shift'].includes(key)) {
|
||||
if (!["ctrl", "cmd", "alt", "shift"].includes(key)) {
|
||||
setTimeout(stopRecording, 100);
|
||||
}
|
||||
};
|
||||
@@ -162,16 +168,18 @@
|
||||
}
|
||||
});
|
||||
|
||||
const hotkeyParts = $derived(isRecording
|
||||
? Array.from(recordedKeys).map(formatKeyForDisplay)
|
||||
: getHotkeyParts(value).map(formatKeyForDisplay));
|
||||
const hotkeyParts = $derived(
|
||||
isRecording
|
||||
? Array.from(recordedKeys).map(formatKeyForDisplay)
|
||||
: getHotkeyParts(value).map(formatKeyForDisplay),
|
||||
);
|
||||
</script>
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="relative">
|
||||
{#if isRecording}
|
||||
<!-- Recording state -->
|
||||
<div
|
||||
<div
|
||||
class="flex items-center justify-center px-3 py-1.5 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white border cursor-pointer text-nowrap"
|
||||
onclick={startRecording}
|
||||
onkeydown={startRecording}
|
||||
@@ -182,7 +190,7 @@
|
||||
</div>
|
||||
{:else if hotkeyParts.length > 0}
|
||||
<!-- Display current hotkey -->
|
||||
<div
|
||||
<div
|
||||
class="flex gap-1 items-center text-sm rounded-md border-none cursor-pointer dark:text-white"
|
||||
onclick={startRecording}
|
||||
onkeydown={startRecording}
|
||||
@@ -190,14 +198,16 @@
|
||||
tabindex="0"
|
||||
>
|
||||
{#each hotkeyParts as part}
|
||||
<div class="size-8 text-sm flex items-center justify-center rounded-md border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30">
|
||||
<div
|
||||
class="size-8 text-sm flex items-center justify-center rounded-md border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30"
|
||||
>
|
||||
{part}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<!-- Empty state -->
|
||||
<div
|
||||
<div
|
||||
class="flex items-center justify-center px-3 py-2 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none cursor-pointer text-nowrap"
|
||||
onclick={startRecording}
|
||||
onkeydown={startRecording}
|
||||
@@ -225,4 +235,4 @@
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,15 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { animate as motionAnimate } from 'motion';
|
||||
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
import { animate as motionAnimate } from "motion";
|
||||
import { fullMotionEffectsEnabled } from "@/seqta/utils/performanceMode";
|
||||
|
||||
let { initial, animate, exit, transition, children, class: className }: {
|
||||
initial?: any,
|
||||
animate?: any,
|
||||
exit?: any,
|
||||
transition?: any,
|
||||
children?: any,
|
||||
class?: string
|
||||
let {
|
||||
initial,
|
||||
animate,
|
||||
exit,
|
||||
transition,
|
||||
children,
|
||||
class: className,
|
||||
}: {
|
||||
initial?: any;
|
||||
animate?: any;
|
||||
exit?: any;
|
||||
transition?: any;
|
||||
children?: any;
|
||||
class?: string;
|
||||
} = $props();
|
||||
|
||||
let divElement: HTMLElement;
|
||||
@@ -18,12 +25,12 @@
|
||||
if (!divElement || !keyframe) return;
|
||||
if (keyframe.x != null) {
|
||||
divElement.style.transition =
|
||||
'transform var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))';
|
||||
"transform var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))";
|
||||
const x = keyframe.x;
|
||||
divElement.style.transform =
|
||||
typeof x === 'number' ? `translateX(${x}px)` : `translateX(${String(x)})`;
|
||||
typeof x === "number" ? `translateX(${x}px)` : `translateX(${String(x)})`;
|
||||
}
|
||||
if (typeof keyframe.opacity === 'number') {
|
||||
if (typeof keyframe.opacity === "number") {
|
||||
divElement.style.opacity = String(keyframe.opacity);
|
||||
}
|
||||
};
|
||||
@@ -37,34 +44,30 @@
|
||||
|
||||
let finalKeyframe = { ...keyframe };
|
||||
|
||||
if (finalKeyframe.height === 'auto') {
|
||||
if (finalKeyframe.height === "auto") {
|
||||
const prevHeight = divElement.style.height;
|
||||
const prevVisibility = divElement.style.visibility;
|
||||
|
||||
divElement.style.height = 'auto';
|
||||
divElement.style.visibility = 'hidden';
|
||||
divElement.style.position = 'absolute';
|
||||
|
||||
|
||||
divElement.style.height = "auto";
|
||||
divElement.style.visibility = "hidden";
|
||||
divElement.style.position = "absolute";
|
||||
|
||||
const autoHeight = divElement.offsetHeight;
|
||||
|
||||
|
||||
divElement.style.height = prevHeight;
|
||||
divElement.style.visibility = prevVisibility;
|
||||
divElement.style.position = '';
|
||||
|
||||
divElement.style.position = "";
|
||||
|
||||
finalKeyframe.height = `${autoHeight}px`;
|
||||
}
|
||||
|
||||
const defaultSpringConfig = { stiffness: 250, damping: 25 };
|
||||
|
||||
const animation = motionAnimate(
|
||||
[divElement],
|
||||
finalKeyframe,
|
||||
{
|
||||
type: 'spring',
|
||||
stiffness: transition?.stiffness || defaultSpringConfig.stiffness,
|
||||
damping: transition?.damping || defaultSpringConfig.damping
|
||||
}
|
||||
);
|
||||
const animation = motionAnimate([divElement], finalKeyframe, {
|
||||
type: "spring",
|
||||
stiffness: transition?.stiffness || defaultSpringConfig.stiffness,
|
||||
damping: transition?.damping || defaultSpringConfig.damping,
|
||||
});
|
||||
return animation;
|
||||
}
|
||||
return Promise.resolve();
|
||||
@@ -78,7 +81,7 @@
|
||||
await playAnimation(animate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$effect(() => {
|
||||
if (animate) {
|
||||
playAnimation(animate);
|
||||
@@ -92,7 +95,11 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class={className} bind:this={divElement} style={fullMotionEffectsEnabled() ? 'will-change: transform, opacity;' : undefined}>
|
||||
<div
|
||||
class={className}
|
||||
bind:this={divElement}
|
||||
style={fullMotionEffectsEnabled() ? "will-change: transform, opacity;" : undefined}
|
||||
>
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
|
||||
let { onClick }: { onClick: () => void } = $props();
|
||||
</script>
|
||||
@@ -9,4 +9,4 @@
|
||||
onclick={onClick}
|
||||
style="background: {$settingsState.selectedColor}"
|
||||
class="w-16 h-8 rounded-md shadow-2xl ring-[1px] ring-[#DDDDDD]/30 dark:ring-[#38373D]/30"
|
||||
></button>
|
||||
></button>
|
||||
@@ -1,99 +0,0 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
dismissOptionalRemoteTheme,
|
||||
getRemoteConfigSnapshot,
|
||||
isEffectiveBsplusEnabled,
|
||||
isRemoteKillActive,
|
||||
resolveEffectiveRemoteTheme,
|
||||
setLocalOverrideOnoff,
|
||||
} from "@/seqta/utils/remoteConfig/runtime";
|
||||
import { getRemoteStatusMessage } from "@/seqta/utils/remoteConfig/apply";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { requestSettingsDestination } from "@/seqta/utils/settingsNavigation";
|
||||
import browser from "@/lib/browser";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
let localOverride = $state(false);
|
||||
|
||||
const snapshot = $derived(getRemoteConfigSnapshot());
|
||||
const activeTheme = $derived(resolveEffectiveRemoteTheme(snapshot));
|
||||
const killActive = $derived(isRemoteKillActive());
|
||||
const statusMessage = $derived(getRemoteStatusMessage(snapshot));
|
||||
const allowOverride = $derived(snapshot.global.allowLocalOverride !== false);
|
||||
const showStrip = $derived(
|
||||
killActive ||
|
||||
activeTheme?.mode === "optional" ||
|
||||
!!statusMessage ||
|
||||
!!snapshot.global.maintenance?.body ||
|
||||
!!snapshot.global.maintenance?.title,
|
||||
);
|
||||
|
||||
async function turnOffOptionalTheme() {
|
||||
await dismissOptionalRemoteTheme(snapshot);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
void browser.storage.local.get("bsplus_local_override_onoff").then((stored) => {
|
||||
localOverride = stored.bsplus_local_override_onoff === true;
|
||||
});
|
||||
});
|
||||
|
||||
async function enableLocalRun() {
|
||||
await setLocalOverrideOnoff(true);
|
||||
localOverride = true;
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function openGeneralSettings() {
|
||||
requestSettingsDestination({ page: "settings", section: "general" });
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if showStrip}
|
||||
<div
|
||||
class="shrink-0 border-b border-amber-200/80 bg-amber-50 px-4 py-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-50"
|
||||
role="status"
|
||||
>
|
||||
<p class="leading-relaxed">
|
||||
{activeTheme?.mode === "optional" && activeTheme.message?.body
|
||||
? activeTheme.message.body
|
||||
: statusMessage ??
|
||||
"BetterSEQTA+ is temporarily limited. You can review settings for details."}
|
||||
</p>
|
||||
<div class="mt-2 flex flex-wrap items-center gap-2">
|
||||
{#if activeTheme?.mode === "optional" && snapshot.remoteTheme?.allowUserOptOut !== false}
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-hidden focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
|
||||
onclick={() => void turnOffOptionalTheme()}
|
||||
>
|
||||
Turn off school theme
|
||||
</button>
|
||||
{/if}
|
||||
{#if killActive && !isEffectiveBsplusEnabled() && allowOverride}
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-hidden focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900"
|
||||
onclick={enableLocalRun}
|
||||
>
|
||||
Run locally anyway
|
||||
</button>
|
||||
{:else if killActive && localOverride && isEffectiveBsplusEnabled()}
|
||||
<span class="text-xs text-amber-800 dark:text-amber-200/90">
|
||||
Running locally (override). Reload SEQTA after the operator clears the kill switch.
|
||||
</span>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-amber-300/80 px-3 py-1.5 text-xs font-medium transition-colors duration-200 hover:bg-amber-100/80 focus:outline-hidden focus:ring-2 focus:ring-amber-500 focus:ring-offset-2 dark:border-amber-800 dark:hover:bg-amber-900/50 dark:focus:ring-offset-zinc-900"
|
||||
onclick={openGeneralSettings}
|
||||
>
|
||||
General settings
|
||||
</button>
|
||||
{#if $settingsState.onoff === false}
|
||||
<span class="text-xs opacity-80">Master toggle is off in General.</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { choosePause, getRemoteStatus, isPaused, pauseMessage } from "@/seqta/utils/remoteStatus";
|
||||
|
||||
const status = getRemoteStatus();
|
||||
const message = status.off ? pauseMessage() : status.message;
|
||||
|
||||
async function runAnyway() {
|
||||
await choosePause(true);
|
||||
location.reload();
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if message}
|
||||
<div
|
||||
class="flex shrink-0 items-center gap-3 border-b border-amber-200/80 bg-amber-50 px-4 py-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-50"
|
||||
role="status"
|
||||
>
|
||||
<p class="flex-1 leading-relaxed">{message}</p>
|
||||
{#if isPaused()}
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded-lg px-3 py-1.5 font-semibold ring-1 ring-current"
|
||||
onclick={runAnyway}>Run Anyway</button
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -4,9 +4,9 @@
|
||||
import Select from "@/interface/components/Select.svelte";
|
||||
import Slider from "@/interface/components/Slider.svelte";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { matchesSearch } from "@/interface/pages/settings/shared";
|
||||
import type { SettingsList } from "@/interface/types/SettingsProps";
|
||||
import type { SettingsList } from "@/interface/types/settingsProps";
|
||||
import {
|
||||
DEFAULT_SIDEBAR_BLUR,
|
||||
DEFAULT_SIDEBAR_RADIUS,
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
}[];
|
||||
};
|
||||
|
||||
let { groups, selectedId, onselect }: {
|
||||
let {
|
||||
groups,
|
||||
selectedId,
|
||||
onselect,
|
||||
}: {
|
||||
groups: NavGroup[];
|
||||
selectedId: string;
|
||||
onselect: (id: string) => void;
|
||||
@@ -74,7 +78,9 @@
|
||||
{/if}
|
||||
{#each group.items as item (item.id)}
|
||||
{#if item.divided}
|
||||
<div class="my-2 border-t border-zinc-200 dark:border-zinc-700 {item.nested ? 'ml-4' : ''}"></div>
|
||||
<div
|
||||
class="my-2 border-t border-zinc-200 dark:border-zinc-700 {item.nested ? 'ml-4' : ''}"
|
||||
></div>
|
||||
{/if}
|
||||
<SidebarNavItem
|
||||
label={item.label}
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
data-nav-section={trackId}
|
||||
{onclick}
|
||||
class="relative z-10 rounded-lg text-left transition-[color,background-color] duration-200
|
||||
{nested
|
||||
? 'ml-4 w-[calc(100%-1rem)] px-3 py-2 text-base'
|
||||
: 'w-full px-3 py-2.5 text-lg'}
|
||||
{nested ? 'ml-4 w-[calc(100%-1rem)] px-3 py-2 text-base' : 'w-full px-3 py-2.5 text-lg'}
|
||||
{active || emphasized
|
||||
? 'font-medium text-zinc-900 dark:text-white'
|
||||
: 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white'}"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { fade } from "svelte/transition";
|
||||
import { animate } from "motion";
|
||||
import { onMount } from "svelte";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
|
||||
let { onClose }: { onClose: () => void } = $props();
|
||||
let modalElement: HTMLElement;
|
||||
@@ -47,12 +47,11 @@
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onkeydown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<h2 class="mb-3 text-xl font-bold text-zinc-900 dark:text-white">
|
||||
Sign in to favorite themes
|
||||
</h2>
|
||||
<h2 class="mb-3 text-xl font-bold text-zinc-900 dark:text-white">Sign in to favorite themes</h2>
|
||||
|
||||
<p class="mb-4 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to the Theme Store to save favorites across devices, or create an account to get started.
|
||||
Sign in to the Theme Store to save favorites across devices, or create an account to get
|
||||
started.
|
||||
</p>
|
||||
|
||||
<button
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
<script lang="ts">
|
||||
let { state = $bindable(), onChange, min = 0, max = 100, step = 1 }: {
|
||||
state: number,
|
||||
onChange: (value: number) => void,
|
||||
min?: number,
|
||||
max?: number,
|
||||
step?: number
|
||||
let {
|
||||
state = $bindable(),
|
||||
onChange,
|
||||
min = 0,
|
||||
max = 100,
|
||||
step = 1,
|
||||
}: {
|
||||
state: number;
|
||||
onChange: (value: number) => void;
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
} = $props();
|
||||
let percentage = $derived(((state - min) / (max - min)) * 100);
|
||||
</script>
|
||||
@@ -12,9 +18,9 @@
|
||||
<div class="relative w-full min-w-0">
|
||||
<input
|
||||
type="range"
|
||||
min={min}
|
||||
max={max}
|
||||
step={step}
|
||||
{min}
|
||||
{max}
|
||||
{step}
|
||||
bind:value={state}
|
||||
style={`background: linear-gradient(to right, #30d259ad 0%, #30D259 ${percentage}%, #dddddd ${percentage}%)`}
|
||||
oninput={(e) => onChange(Number(e.currentTarget.value))}
|
||||
@@ -43,4 +49,4 @@
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
let { size = 'md', color = 'currentColor' } = $props();
|
||||
let { size = "md", color = "currentColor" } = $props();
|
||||
|
||||
const sizeMap = {
|
||||
sm: '1rem',
|
||||
md: '2rem',
|
||||
lg: '3rem',
|
||||
sm: "1rem",
|
||||
md: "2rem",
|
||||
lg: "3rem",
|
||||
};
|
||||
|
||||
let dimensions = $derived(sizeMap[size as keyof typeof sizeMap] || size);
|
||||
@@ -18,17 +18,10 @@
|
||||
width={dimensions}
|
||||
height={dimensions}
|
||||
>
|
||||
<circle
|
||||
class="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
stroke={color}
|
||||
stroke-width="4"
|
||||
></circle>
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke={color} stroke-width="4"></circle>
|
||||
<path
|
||||
class="opacity-75"
|
||||
fill={color}
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
||||
></path>
|
||||
</svg>
|
||||
</svg>
|
||||
@@ -1,15 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { standalone } from '../utils/standalone.svelte';
|
||||
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
|
||||
import { standalone } from "../utils/standalone.svelte";
|
||||
import { fullMotionEffectsEnabled } from "@/seqta/utils/performanceMode";
|
||||
|
||||
let { state: checked, onChange }: { state: boolean, onChange: (newState: boolean) => void } = $props();
|
||||
let { state: checked, onChange }: { state: boolean; onChange: (newState: boolean) => void } =
|
||||
$props();
|
||||
|
||||
let motionReady = $state(false);
|
||||
onMount(() => {
|
||||
// Paint the hydrated position before enabling transitions for later toggles.
|
||||
let frame = requestAnimationFrame(() => {
|
||||
frame = requestAnimationFrame(() => { motionReady = true; });
|
||||
frame = requestAnimationFrame(() => {
|
||||
motionReady = true;
|
||||
});
|
||||
});
|
||||
return () => cancelAnimationFrame(frame);
|
||||
});
|
||||
@@ -18,7 +21,9 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="flex w-14 p-1 cursor-pointer transition-all duration-150 rounded-full bg-linear-to-tr select-none shadow-2xl ring-[1px] ring-[#DDDDDD]/30 dark:ring-[#38373D]/30 {checked ? 'to-[#30D259]/80 from-[#30D259] dark:from-[#30D259]/40 dark:to-[#30D259]' : 'dark:from-[#38373D]/50 dark:to-[#38373D] to-[#DDDDDD]/50 from-[#DDDDDD]'}"
|
||||
class="flex w-14 p-1 cursor-pointer transition-all duration-150 rounded-full bg-linear-to-tr select-none shadow-2xl ring-[1px] ring-[#DDDDDD]/30 dark:ring-[#38373D]/30 {checked
|
||||
? 'to-[#30D259]/80 from-[#30D259] dark:from-[#30D259]/40 dark:to-[#30D259]'
|
||||
: 'dark:from-[#38373D]/50 dark:to-[#38373D] to-[#DDDDDD]/50 from-[#DDDDDD]'}"
|
||||
onclick={() => onChange(!checked)}
|
||||
onkeydown={(e) => e.key === "Enter" && onChange(!checked)}
|
||||
role="switch"
|
||||
@@ -33,6 +38,8 @@
|
||||
|
||||
<style>
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
[role="switch"] > div { transition: none !important; }
|
||||
[role="switch"] > div {
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -11,7 +11,10 @@
|
||||
props?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
let { tabs, activeTab = $bindable(0) }: {
|
||||
let {
|
||||
tabs,
|
||||
activeTab = $bindable(0),
|
||||
}: {
|
||||
tabs: TabDef[];
|
||||
activeTab?: number;
|
||||
} = $props();
|
||||
@@ -28,7 +31,10 @@
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col h-full min-h-0">
|
||||
<div class="top-0 z-10 shrink-0 text-[0.875rem] pb-0.5 mx-4 px-2 tab-width-container" role="tablist">
|
||||
<div
|
||||
class="top-0 z-10 shrink-0 text-[0.875rem] pb-0.5 mx-4 px-2 tab-width-container"
|
||||
role="tablist"
|
||||
>
|
||||
<div class="flex relative">
|
||||
<div
|
||||
class="absolute top-0 left-0 z-0 h-full bg-linear-to-tr dark:from-[#38373D]/80 dark:to-[#38373D] from-[#DDDDDD]/80 to-[#DDDDDD] rounded-full opacity-40 tab-width"
|
||||
@@ -38,7 +44,7 @@
|
||||
<button
|
||||
role="tab"
|
||||
aria-selected={activeTab === index}
|
||||
class="relative z-10 flex-1 px-4 py-2 focus-visible:outline-hidden"
|
||||
class="relative z-10 flex-1 px-4 py-2"
|
||||
onclick={() => (activeTab = index)}
|
||||
>
|
||||
{title}
|
||||
@@ -55,7 +61,7 @@
|
||||
{#if activeTab === index}
|
||||
<div
|
||||
role="tabpanel"
|
||||
class="focus:outline-hidden w-full h-full min-h-0 pt-2 overflow-y-auto no-scrollbar pb-6 tab active relative"
|
||||
class="w-full h-full min-h-0 pt-2 overflow-y-auto no-scrollbar pb-6 tab active relative"
|
||||
>
|
||||
{#if tab.loader}
|
||||
<LazyPanel loader={tab.loader} props={tab.props} />
|
||||
@@ -70,6 +76,8 @@
|
||||
|
||||
<style>
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.tab-width { transition: none !important; }
|
||||
.tab-width {
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -85,7 +85,10 @@
|
||||
return $state.snapshot(model) as ColourValue;
|
||||
}
|
||||
|
||||
function withStops(m: ColourValue, update: (stops: GradientStop[]) => GradientStop[]): ColourValue {
|
||||
function withStops(
|
||||
m: ColourValue,
|
||||
update: (stops: GradientStop[]) => GradientStop[],
|
||||
): ColourValue {
|
||||
return m.kind === "solid" ? m : { ...m, stops: update(m.stops) };
|
||||
}
|
||||
|
||||
@@ -94,7 +97,9 @@
|
||||
commit(
|
||||
m.kind === "solid"
|
||||
? { kind: "solid", colour }
|
||||
: withStops(m, (all) => all.map((stop, i) => (i === selected ? { ...stop, colour } : stop))),
|
||||
: withStops(m, (all) =>
|
||||
all.map((stop, i) => (i === selected ? { ...stop, colour } : stop)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,7 +167,11 @@
|
||||
}
|
||||
|
||||
function moveStop(index: number, position: number) {
|
||||
commit(withStops(snapshot(), (all) => all.map((stop, i) => (i === index ? { ...stop, position } : stop))));
|
||||
commit(
|
||||
withStops(snapshot(), (all) =>
|
||||
all.map((stop, i) => (i === index ? { ...stop, position } : stop)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function startStopDrag(event: PointerEvent, index: number) {
|
||||
@@ -172,15 +181,26 @@
|
||||
dragging = index;
|
||||
}
|
||||
|
||||
function addStop(event: PointerEvent) {
|
||||
function addStop(position: number) {
|
||||
const m = snapshot();
|
||||
if (m.kind === "solid") return;
|
||||
const position = barPosition(event);
|
||||
const colour = colourAt(m.stops, position);
|
||||
commit(withStops(m, (all) => [...all, { colour, position }]));
|
||||
selectStop(m.stops.length);
|
||||
bar!.setPointerCapture(event.pointerId);
|
||||
dragging = m.stops.length;
|
||||
}
|
||||
|
||||
function selectStopAtPosition(event: PointerEvent) {
|
||||
const m = snapshot();
|
||||
if (m.kind === "solid") return;
|
||||
const position = barPosition(event);
|
||||
const nearest = m.stops.reduce(
|
||||
(closest, stop, index) =>
|
||||
Math.abs(stop.position - position) < Math.abs(m.stops[closest].position - position)
|
||||
? index
|
||||
: closest,
|
||||
0,
|
||||
);
|
||||
selectStop(nearest);
|
||||
}
|
||||
|
||||
function removeStop(index: number) {
|
||||
@@ -234,92 +254,111 @@
|
||||
|
||||
<div class="flex flex-col gap-3 w-72 max-w-full text-zinc-900 select-none dark:text-white">
|
||||
<div>
|
||||
<div class="grid relative grid-cols-3 p-0.5 rounded-lg bg-zinc-100 dark:bg-zinc-700/70" role="radiogroup" aria-label="Fill type">
|
||||
<div
|
||||
class="absolute left-0.5 inset-y-0.5 w-[calc((100%-0.25rem)/3)] rounded-md bg-white shadow-sm transition-transform duration-200 ease-out motion-reduce:transition-none dark:bg-zinc-600"
|
||||
style="transform: translateX({modeIndex * 100}%);"
|
||||
aria-hidden="true"
|
||||
></div>
|
||||
{#each MODES as mode (mode.kind)}
|
||||
<button
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={model.kind === mode.kind}
|
||||
class="relative py-1 text-xs font-medium rounded-md transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-zinc-900 dark:focus-visible:outline-white {model.kind === mode.kind
|
||||
? 'text-zinc-900 dark:text-white'
|
||||
: 'text-zinc-500 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white'}"
|
||||
onclick={() => setMode(mode.kind)}
|
||||
>
|
||||
{mode.label}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if model.kind !== "solid"}
|
||||
<div class="flex gap-2 items-center pt-3" transition:slide={{ duration: 180 }}>
|
||||
class="grid relative grid-cols-3 p-0.5 rounded-lg bg-zinc-100 dark:bg-zinc-700/70"
|
||||
role="radiogroup"
|
||||
aria-label="Fill type"
|
||||
>
|
||||
<div
|
||||
class="flex-1 px-2.5 py-1.5 cursor-copy touch-none"
|
||||
role="group"
|
||||
aria-label="Gradient stops"
|
||||
onpointerdown={addStop}
|
||||
onpointermove={(event) => {
|
||||
if (dragging !== null) moveStop(dragging, barPosition(event));
|
||||
}}
|
||||
onpointerup={() => (dragging = null)}
|
||||
onpointercancel={() => (dragging = null)}
|
||||
>
|
||||
<div
|
||||
bind:this={bar}
|
||||
class="relative h-3 rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/10"
|
||||
style="background: linear-gradient(to right, {formatStops(stops)}), {CHECKERBOARD};"
|
||||
class="absolute left-0.5 inset-y-0.5 w-[calc((100%-0.25rem)/3)] rounded-md bg-white shadow-sm transition-transform duration-200 ease-out motion-reduce:transition-none dark:bg-zinc-600"
|
||||
style="transform: translateX({modeIndex * 100}%);"
|
||||
aria-hidden="true"
|
||||
></div>
|
||||
{#each MODES as mode (mode.kind)}
|
||||
<button
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={model.kind === mode.kind}
|
||||
class="relative py-1 text-xs font-medium rounded-md transition-colors duration-200 {model.kind ===
|
||||
mode.kind
|
||||
? 'text-zinc-900 dark:text-white'
|
||||
: 'text-zinc-500 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white'}"
|
||||
onclick={() => setMode(mode.kind)}
|
||||
>
|
||||
{#each stops as stop, index (index)}
|
||||
<button
|
||||
type="button"
|
||||
class="absolute top-1/2 handle cursor-grab active:cursor-grabbing {index === selected ? 'handle-selected' : ''}"
|
||||
style="left: {stop.position}%; --swatch: {formatColour(stop.colour)};"
|
||||
aria-label="Colour stop at {Math.round(stop.position)}%"
|
||||
aria-pressed={index === selected}
|
||||
onpointerdown={(event) => startStopDrag(event, index)}
|
||||
onkeydown={(event) => stopKeys(event, index)}
|
||||
></button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{#if model.kind === "linear"}
|
||||
<label class="flex shrink-0 items-center px-2 w-14 h-7 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70">
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="360"
|
||||
class="p-0 w-full min-w-0 text-xs text-right bg-transparent border-0 outline-none select-text picker-number focus:ring-0"
|
||||
aria-label="Gradient angle in degrees"
|
||||
value={model.angle}
|
||||
oninput={(event) => {
|
||||
if (event.currentTarget.value !== "") setAngle(Number(event.currentTarget.value));
|
||||
}}
|
||||
/>
|
||||
<span class="text-zinc-500 dark:text-zinc-400">°</span>
|
||||
</label>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="grid shrink-0 place-items-center rounded-md transition size-7 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 disabled:opacity-30 disabled:pointer-events-none focus-visible:outline-2 focus-visible:outline-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white dark:focus-visible:outline-white"
|
||||
aria-label="Remove selected stop"
|
||||
disabled={stops.length <= 2}
|
||||
onclick={() => removeStop(selected)}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M3 6h18M8 6V4h8v2m-9 0 1 14h8l1-14" />
|
||||
</svg>
|
||||
</button>
|
||||
{mode.label}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if model.kind !== "solid"}
|
||||
<div class="flex gap-2 items-center pt-3" transition:slide={{ duration: 180 }}>
|
||||
<div
|
||||
class="flex-1 px-2.5 py-1.5 cursor-copy touch-none"
|
||||
role="group"
|
||||
aria-label="Gradient stops"
|
||||
onpointerdown={selectStopAtPosition}
|
||||
onpointermove={(event) => {
|
||||
if (dragging !== null) moveStop(dragging, barPosition(event));
|
||||
}}
|
||||
onpointerup={() => (dragging = null)}
|
||||
onpointercancel={() => (dragging = null)}
|
||||
>
|
||||
<div
|
||||
bind:this={bar}
|
||||
class="relative h-3 rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/10"
|
||||
style="background: linear-gradient(to right, {formatStops(stops)}), {CHECKERBOARD};"
|
||||
>
|
||||
{#each stops as stop, index (index)}
|
||||
<button
|
||||
type="button"
|
||||
class="absolute top-1/2 handle cursor-grab active:cursor-grabbing {index ===
|
||||
selected
|
||||
? 'handle-selected'
|
||||
: ''}"
|
||||
style="left: {stop.position}%; --swatch: {formatColour(stop.colour)};"
|
||||
aria-label="Colour stop at {Math.round(stop.position)}%"
|
||||
aria-pressed={index === selected}
|
||||
onpointerdown={(event) => startStopDrag(event, index)}
|
||||
onkeydown={(event) => stopKeys(event, index)}
|
||||
></button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="grid shrink-0 place-items-center rounded-md transition size-7 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white"
|
||||
aria-label="Add colour stop"
|
||||
title="Add colour stop"
|
||||
onclick={() => addStop(50)}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
|
||||
</button>
|
||||
{#if model.kind === "linear"}
|
||||
<label
|
||||
class="flex shrink-0 items-center px-2 w-14 h-7 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="360"
|
||||
class="p-0 w-full min-w-0 text-xs text-right bg-transparent border-0 outline-none select-text picker-number"
|
||||
aria-label="Gradient angle in degrees"
|
||||
value={model.angle}
|
||||
oninput={(event) => {
|
||||
if (event.currentTarget.value !== "") setAngle(Number(event.currentTarget.value));
|
||||
}}
|
||||
/>
|
||||
<span class="text-zinc-500 dark:text-zinc-400">°</span>
|
||||
</label>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="grid shrink-0 place-items-center rounded-md transition size-7 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 disabled:opacity-30 disabled:pointer-events-none dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white"
|
||||
aria-label="Remove selected stop"
|
||||
disabled={stops.length <= 2}
|
||||
onclick={() => removeStop(selected)}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M3 6h18M8 6V4h8v2m-9 0 1 14h8l1-14" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div
|
||||
bind:this={area}
|
||||
class="relative h-40 rounded-lg cursor-crosshair touch-none outline-none ring-1 ring-inset ring-black/10 focus-visible:ring-2 focus-visible:ring-zinc-900 dark:ring-white/10 dark:focus-visible:ring-white"
|
||||
class="relative h-40 rounded-lg cursor-crosshair touch-none outline-none ring-1 ring-inset ring-black/10 dark:ring-white/10"
|
||||
style="background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl({hsva.h} 100% 50%));"
|
||||
role="slider"
|
||||
tabindex="0"
|
||||
@@ -345,7 +384,7 @@
|
||||
{#if EyeDropper}
|
||||
<button
|
||||
type="button"
|
||||
class="grid shrink-0 place-items-center rounded-md transition size-8 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 focus-visible:outline-2 focus-visible:outline-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white dark:focus-visible:outline-white"
|
||||
class="grid shrink-0 place-items-center rounded-md transition size-8 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white"
|
||||
aria-label="Pick a colour from the screen"
|
||||
onclick={pickFromScreen}
|
||||
>
|
||||
@@ -370,7 +409,9 @@
|
||||
min="0"
|
||||
max="100"
|
||||
class="picker-track"
|
||||
style="background: linear-gradient(to right, transparent, {hex}), {CHECKERBOARD}; --swatch: {formatColour(active)};"
|
||||
style="background: linear-gradient(to right, transparent, {hex}), {CHECKERBOARD}; --swatch: {formatColour(
|
||||
active,
|
||||
)};"
|
||||
aria-label="Opacity"
|
||||
value={Math.round(hsva.a * 100)}
|
||||
oninput={(event) => updateHsva({ a: Number(event.currentTarget.value) / 100 })}
|
||||
@@ -384,10 +425,12 @@
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<label class="flex flex-1 gap-1.5 items-center px-2.5 min-w-0 h-8 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70">
|
||||
<label
|
||||
class="flex flex-1 gap-1.5 items-center px-2.5 min-w-0 h-8 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70"
|
||||
>
|
||||
<span class="text-zinc-500 dark:text-zinc-400">#</span>
|
||||
<input
|
||||
class="flex-1 p-0 min-w-0 font-mono text-xs uppercase bg-transparent border-0 outline-none select-text focus:ring-0"
|
||||
class="flex-1 p-0 min-w-0 font-mono text-xs uppercase bg-transparent border-0 outline-none select-text"
|
||||
aria-label="Hex colour"
|
||||
value={hex.slice(1)}
|
||||
spellcheck="false"
|
||||
@@ -403,16 +446,19 @@
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
<label class="flex shrink-0 items-center px-2.5 w-16 h-8 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70">
|
||||
<label
|
||||
class="flex shrink-0 items-center px-2.5 w-16 h-8 text-xs rounded-md bg-zinc-100 dark:bg-zinc-700/70"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
class="p-0 w-full min-w-0 text-xs text-right bg-transparent border-0 outline-none select-text picker-number focus:ring-0"
|
||||
class="p-0 w-full min-w-0 text-xs text-right bg-transparent border-0 outline-none select-text picker-number"
|
||||
aria-label="Opacity percent"
|
||||
value={Math.round(active.a * 100)}
|
||||
oninput={(event) => {
|
||||
if (event.currentTarget.value !== "") updateHsva({ a: clamp(Number(event.currentTarget.value), 0, 100) / 100 });
|
||||
if (event.currentTarget.value !== "")
|
||||
updateHsva({ a: clamp(Number(event.currentTarget.value), 0, 100) / 100 });
|
||||
}}
|
||||
/>
|
||||
<span class="text-zinc-500 dark:text-zinc-400">%</span>
|
||||
@@ -424,7 +470,7 @@
|
||||
{#each shownPresets as preset (preset)}
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-md ring-1 ring-inset transition aspect-square ring-black/10 hover:scale-110 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-zinc-900 dark:ring-white/10 dark:focus-visible:outline-white"
|
||||
class="rounded-md ring-1 ring-inset transition aspect-square ring-black/10 hover:scale-110 dark:ring-white/10"
|
||||
style="background: {asLayer(preset)}, {CHECKERBOARD};"
|
||||
aria-label="Apply preset {preset}"
|
||||
onclick={() => applyPreset(preset)}
|
||||
@@ -440,30 +486,30 @@
|
||||
height: 1.125rem;
|
||||
border-radius: 9999px;
|
||||
border: 2px solid white;
|
||||
background: linear-gradient(var(--swatch), var(--swatch)),
|
||||
background:
|
||||
linear-gradient(var(--swatch), var(--swatch)),
|
||||
repeating-conic-gradient(#d4d4d8 0% 25%, #ffffff 0% 50%) 50% / 6px 6px;
|
||||
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||
box-shadow:
|
||||
0 0 0 1px rgb(0 0 0 / 0.15),
|
||||
0 1px 3px rgb(0 0 0 / 0.3);
|
||||
transform: translate(-50%, -50%);
|
||||
transition: transform 120ms ease, box-shadow 120ms ease;
|
||||
}
|
||||
|
||||
.handle:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px rgb(24 24 27), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||
}
|
||||
|
||||
:global(.dark) .handle:focus-visible {
|
||||
box-shadow: 0 0 0 2px white, 0 1px 3px rgb(0 0 0 / 0.3);
|
||||
transition:
|
||||
transform 120ms ease,
|
||||
box-shadow 120ms ease;
|
||||
}
|
||||
|
||||
.handle-selected {
|
||||
z-index: 1;
|
||||
transform: translate(-50%, -50%) scale(1.2);
|
||||
box-shadow: 0 0 0 2px rgb(24 24 27 / 0.85), 0 2px 6px rgb(0 0 0 / 0.35);
|
||||
box-shadow:
|
||||
0 0 0 2px rgb(24 24 27 / 0.85),
|
||||
0 2px 6px rgb(0 0 0 / 0.35);
|
||||
}
|
||||
|
||||
:global(.dark) .handle-selected {
|
||||
box-shadow: 0 0 0 2px rgb(255 255 255 / 0.9), 0 2px 6px rgb(0 0 0 / 0.5);
|
||||
box-shadow:
|
||||
0 0 0 2px rgb(255 255 255 / 0.9),
|
||||
0 2px 6px rgb(0 0 0 / 0.5);
|
||||
}
|
||||
|
||||
.picker-number {
|
||||
@@ -486,15 +532,6 @@
|
||||
box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1);
|
||||
}
|
||||
|
||||
.picker-track:focus-visible {
|
||||
outline: 2px solid rgb(24 24 27);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
:global(.dark) .picker-track:focus-visible {
|
||||
outline-color: white;
|
||||
}
|
||||
|
||||
.picker-track::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
width: 1.125rem;
|
||||
@@ -502,7 +539,9 @@
|
||||
border: 2px solid white;
|
||||
border-radius: 9999px;
|
||||
background: var(--swatch);
|
||||
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||
box-shadow:
|
||||
0 0 0 1px rgb(0 0 0 / 0.15),
|
||||
0 1px 3px rgb(0 0 0 / 0.3);
|
||||
}
|
||||
|
||||
.picker-track::-moz-range-thumb {
|
||||
@@ -512,6 +551,8 @@
|
||||
border: 2px solid white;
|
||||
border-radius: 9999px;
|
||||
background: var(--swatch);
|
||||
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
|
||||
box-shadow:
|
||||
0 0 0 1px rgb(0 0 0 / 0.15),
|
||||
0 1px 3px rgb(0 0 0 / 0.3);
|
||||
}
|
||||
</style>
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
let { communityState, searchTerm }: { communityState: CommunityThemesState; searchTerm: string } =
|
||||
$props();
|
||||
|
||||
</script>
|
||||
|
||||
{#if communityState.browseLoading}
|
||||
@@ -48,7 +47,8 @@
|
||||
installedThemeColors={communityState.installedThemeColors}
|
||||
variant="community"
|
||||
onInstall={async (themeId) => {
|
||||
if (communityState.displayTheme) await communityState.installCommunityTheme(themeId, communityState.displayTheme);
|
||||
if (communityState.displayTheme)
|
||||
await communityState.installCommunityTheme(themeId, communityState.displayTheme);
|
||||
}}
|
||||
onRemove={(id) => void communityState.removeInstalledTheme(id)}
|
||||
onApply={(id) => void communityState.applyInstalledTheme(id)}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
} from "@/seqta/utils/customThemes/client";
|
||||
import ThemePlaceholderCover from "@/interface/components/themes/ThemePlaceholderCover.svelte";
|
||||
import ThemeBlobImage from "@/interface/components/themes/ThemeBlobImage.svelte";
|
||||
import type { CustomTheme } from "@/types/CustomThemes";
|
||||
import type { CustomTheme } from "@/types/customThemes";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
import { themeUpdates } from "@/interface/hooks/ThemeUpdates";
|
||||
import { themeUpdates } from "@/interface/hooks/themeUpdates";
|
||||
import { isLocalCustomTheme } from "@/interface/utils/themeListFilters";
|
||||
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
||||
|
||||
@@ -90,7 +90,9 @@
|
||||
Submit a custom theme you created or imported without opening the theme builder.
|
||||
</p>
|
||||
{#if localSubmitError}
|
||||
<p class="mt-2 whitespace-pre-line text-sm text-red-600 dark:text-red-400">{localSubmitError}</p>
|
||||
<p class="mt-2 whitespace-pre-line text-sm text-red-600 dark:text-red-400">
|
||||
{localSubmitError}
|
||||
</p>
|
||||
{/if}
|
||||
{#if localThemesLoading}
|
||||
<div class="mt-3 grid grid-cols-1 gap-3">
|
||||
@@ -121,9 +123,13 @@
|
||||
/>
|
||||
{/if}
|
||||
<div class="min-w-0 flex-1">
|
||||
<span class="font-semibold text-zinc-900 dark:text-white">{theme.name || "Untitled theme"}</span>
|
||||
<span class="font-semibold text-zinc-900 dark:text-white"
|
||||
>{theme.name || "Untitled theme"}</span
|
||||
>
|
||||
{#if theme.description}
|
||||
<p class="mt-1 truncate text-sm text-zinc-500 dark:text-zinc-400">{theme.description}</p>
|
||||
<p class="mt-1 truncate text-sm text-zinc-500 dark:text-zinc-400">
|
||||
{theme.description}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex shrink-0 flex-wrap gap-2">
|
||||
@@ -154,7 +160,8 @@
|
||||
{#each statusFilters as status (status)}
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-3 py-1 text-sm font-medium transition {communityState.statusFilter === status
|
||||
class="rounded-full px-3 py-1 text-sm font-medium transition {communityState.statusFilter ===
|
||||
status
|
||||
? 'bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900'
|
||||
: 'bg-zinc-200 text-zinc-700 hover:bg-zinc-300 dark:bg-zinc-800 dark:text-zinc-300'}"
|
||||
onclick={() => (communityState.statusFilter = status)}
|
||||
@@ -196,7 +203,11 @@
|
||||
onclick={() => void communityState.openDetail(theme)}
|
||||
>
|
||||
{#if theme.coverImage}
|
||||
<img src={theme.coverImage} alt="" class="h-14 w-20 shrink-0 rounded-lg object-cover" />
|
||||
<img
|
||||
src={theme.coverImage}
|
||||
alt=""
|
||||
class="h-14 w-20 shrink-0 rounded-lg object-cover"
|
||||
/>
|
||||
{:else}
|
||||
<ThemePlaceholderCover class="h-14 w-20 shrink-0 rounded-lg object-cover" />
|
||||
{/if}
|
||||
@@ -204,7 +215,9 @@
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="font-semibold text-zinc-900 dark:text-white">{theme.name}</span>
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 text-xs font-semibold {statusBadgeClass(theme.status)}"
|
||||
class="rounded-full px-2 py-0.5 text-xs font-semibold {statusBadgeClass(
|
||||
theme.status,
|
||||
)}"
|
||||
>
|
||||
{formatCustomThemeStatus(theme.status)}
|
||||
</span>
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
<span class="mb-1 block text-sm font-medium">Status</span>
|
||||
<Select
|
||||
value={communityState.reviewStatusFilter}
|
||||
onChange={(v) => (communityState.reviewStatusFilter = v as typeof communityState.reviewStatusFilter)}
|
||||
onChange={(v) =>
|
||||
(communityState.reviewStatusFilter = v as typeof communityState.reviewStatusFilter)}
|
||||
options={[
|
||||
{ value: "pending", label: "Pending" },
|
||||
{ value: "approved", label: "Approved" },
|
||||
@@ -73,7 +74,10 @@
|
||||
onApply={(id) => void communityState.applyInstalledTheme(id)}
|
||||
/>
|
||||
{#if communityState.reviewPreviewError}
|
||||
<p class="fixed bottom-6 left-1/2 z-100000 -translate-x-1/2 rounded-lg bg-red-600 px-4 py-2 text-sm text-white" role="alert">
|
||||
<p
|
||||
class="fixed bottom-6 left-1/2 z-100000 -translate-x-1/2 rounded-lg bg-red-600 px-4 py-2 text-sm text-white"
|
||||
role="alert"
|
||||
>
|
||||
{communityState.reviewPreviewError}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
@@ -145,11 +145,6 @@
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.bsplus-font-picker-reset:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--bsplus-analytics-accent) 35%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-font-picker-reset:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
@@ -186,11 +181,6 @@
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
.bsplus-font-picker-done:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--bsplus-analytics-accent) 35%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-font-picker-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@@ -241,13 +231,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
.bsplus-font-picker-option:focus-visible {
|
||||
outline: none;
|
||||
box-shadow:
|
||||
var(--bsplus-analytics-shadow-hover),
|
||||
0 0 0 3px color-mix(in srgb, var(--bsplus-analytics-accent) 30%, transparent);
|
||||
}
|
||||
|
||||
.bsplus-font-picker-option.is-selected {
|
||||
border-color: color-mix(
|
||||
in srgb,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { hasEnoughStorageSpace, isIndexedDBSupported, writeData, openDatabase, readAllData, deleteData } from '@/interface/hooks/BackgroundDataLoader';
|
||||
import { hasEnoughStorageSpace, isIndexedDBSupported, writeData, openDatabase, readAllData, deleteData } from '@/interface/hooks/backgroundDataLoader';
|
||||
import Spinner from '../Spinner.svelte';
|
||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||
import { backgroundUpdates } from '@/interface/hooks/BackgroundUpdates'
|
||||
import { settingsState } from '@/seqta/utils/listeners/settingsState'
|
||||
import { backgroundUpdates } from '@/interface/hooks/backgroundUpdates'
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
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 }: {
|
||||
alwaysShowUserName?: boolean;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { fade } from 'svelte/transition';
|
||||
import type { ThemeCoverSlide } from '@/interface/types/Theme';
|
||||
import type { ThemeCoverSlide } from '@/interface/types/theme';
|
||||
import emblaCarouselSvelte from 'embla-carousel-svelte';
|
||||
import Autoplay from 'embla-carousel-autoplay';
|
||||
|
||||
let { slides, setDisplayTheme }: {
|
||||
slides: ThemeCoverSlide[];
|
||||
setDisplayTheme: (theme: import('@/interface/types/Theme').Theme) => void;
|
||||
setDisplayTheme: (theme: import('@/interface/types/theme').Theme) => void;
|
||||
} = $props();
|
||||
let emblaApi = $state();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import MotionDiv from "../MotionDiv.svelte";
|
||||
import PlainCloseButton from "../PlainCloseButton.svelte";
|
||||
import CloudHeader from "./CloudHeader.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
|
||||
type SettingsPage = "settings" | "themes" | "backgrounds";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Theme } from '@/interface/types/Theme'
|
||||
import type { Theme } from '@/interface/types/theme'
|
||||
import {
|
||||
masterGridDisplayDownloadCount,
|
||||
gridCardPreviewImageUrls,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { Theme } from '@/interface/types/Theme'
|
||||
import ThemeCard from './ThemeCard.svelte';
|
||||
import type { Theme } from "@/interface/types/theme";
|
||||
import ThemeCard from "./ThemeCard.svelte";
|
||||
|
||||
let {
|
||||
themes,
|
||||
@@ -11,7 +11,7 @@
|
||||
onRequestSignIn,
|
||||
allStoreThemeRows,
|
||||
installedThemeIds = [],
|
||||
variant = 'official',
|
||||
variant = "official",
|
||||
}: {
|
||||
themes: Theme[];
|
||||
searchTerm: string;
|
||||
@@ -22,17 +22,19 @@
|
||||
/** Raw API list (includes `slave` rows) for master download aggregation */
|
||||
allStoreThemeRows?: Theme[];
|
||||
installedThemeIds?: string[];
|
||||
variant?: 'official' | 'community';
|
||||
variant?: "official" | "community";
|
||||
} = $props();
|
||||
|
||||
let filteredThemes = $derived(themes.filter((theme: Theme) => {
|
||||
const q = searchTerm.toLowerCase();
|
||||
const name = (theme.name ?? '').toLowerCase();
|
||||
const description = (theme.description ?? '').toLowerCase();
|
||||
return name.includes(q) || description.includes(q);
|
||||
}));
|
||||
|
||||
const isCommunity = $derived(variant === 'community');
|
||||
let filteredThemes = $derived(
|
||||
themes.filter((theme: Theme) => {
|
||||
const q = searchTerm.toLowerCase();
|
||||
const name = (theme.name ?? "").toLowerCase();
|
||||
const description = (theme.description ?? "").toLowerCase();
|
||||
return name.includes(q) || description.includes(q);
|
||||
}),
|
||||
);
|
||||
|
||||
const isCommunity = $derived(variant === "community");
|
||||
</script>
|
||||
|
||||
<div class="relative">
|
||||
@@ -64,7 +66,9 @@
|
||||
</div>
|
||||
{:else}
|
||||
<div class="absolute top-0 flex h-96 w-full flex-col items-center justify-center text-center">
|
||||
<h1 class="mt-4 text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-100 sm:text-5xl">
|
||||
<h1
|
||||
class="mt-4 text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-100 sm:text-5xl"
|
||||
>
|
||||
That doesn't exist! 😭😭😭
|
||||
</h1>
|
||||
<p class="mt-6 text-lg leading-7 text-zinc-600 dark:text-zinc-300">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Theme } from '@/interface/types/Theme'
|
||||
import type { Theme } from '@/interface/types/theme'
|
||||
import { fade } from 'svelte/transition'
|
||||
import { animate } from 'motion'
|
||||
import emblaCarouselSvelte from 'embla-carousel-svelte'
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getThemeApplyButtonStyles,
|
||||
resolveStoreVariantAccentColor,
|
||||
} from '@/interface/utils/themeListFilters'
|
||||
import { isRemoteThemeStoreDisabled } from '@/seqta/utils/remoteConfig/runtime'
|
||||
import { isFeatureDisabled } from '@/seqta/utils/remoteStatus'
|
||||
let {
|
||||
theme,
|
||||
currentThemes,
|
||||
@@ -52,7 +52,7 @@ adminPreviewMode?: boolean
|
||||
} = $props()
|
||||
const installActionLabel = $derived(adminPreviewMode ? 'Preview & apply' : 'Install')
|
||||
const isCommunity = $derived(variant === 'community')
|
||||
const themeStoreInstallLocked = $derived(isRemoteThemeStoreDisabled() && !adminPreviewMode)
|
||||
const themeStoreInstallLocked = $derived(isFeatureDisabled('themeStore.install') && !adminPreviewMode)
|
||||
const showFavorites = $derived(!isCommunity)
|
||||
function variantApplyStyles(variantId: string) {
|
||||
if (!theme) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<script lang="ts"></script>
|
||||
|
||||
<div class='w-full h-0.5 my-4 bg-zinc-200 dark:bg-zinc-700'></div>
|
||||
<div class="w-full h-0.5 my-4 bg-zinc-200 dark:bg-zinc-700"></div>
|
||||
@@ -6,33 +6,56 @@
|
||||
url?: string | undefined;
|
||||
}
|
||||
|
||||
let { bg, isSelected, isEditMode, onClick, onDelete }: { bg: Background, isSelected: boolean, isEditMode: boolean, onClick: () => void, onDelete: () => void } = $props();
|
||||
|
||||
let {
|
||||
bg,
|
||||
isSelected,
|
||||
isEditMode,
|
||||
onClick,
|
||||
onDelete,
|
||||
}: {
|
||||
bg: Background;
|
||||
isSelected: boolean;
|
||||
isEditMode: boolean;
|
||||
onClick: () => void;
|
||||
onDelete: () => void;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<div
|
||||
onclick={onClick}
|
||||
onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') onClick() }}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") onClick();
|
||||
}}
|
||||
tabindex="0"
|
||||
role="button"
|
||||
class="relative w-16 h-16 cursor-pointer rounded-xl transition ring-3 dark:ring-zinc-500/50 ring-zinc-300 {isEditMode ? 'animate-shake' : ''} {isSelected ? 'dark:ring-4 ring-4' : 'ring-0'}"
|
||||
class="relative w-16 h-16 cursor-pointer rounded-xl transition ring-3 dark:ring-zinc-500/50 ring-zinc-300 {isEditMode
|
||||
? 'animate-shake'
|
||||
: ''} {isSelected ? 'dark:ring-4 ring-4' : 'ring-0'}"
|
||||
>
|
||||
{#if isEditMode}
|
||||
<div
|
||||
tabindex="0"
|
||||
role="button"
|
||||
class="absolute top-0 right-0 z-10 flex w-6 h-6 p-2 text-white translate-x-1/2 -translate-y-1/2 bg-red-600 rounded-full place-items-center"
|
||||
onclick={(e) => { e.stopPropagation(); onDelete() }}
|
||||
onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onDelete() } }}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete();
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.stopPropagation();
|
||||
onDelete();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="w-4 h-0.5 bg-white"></div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if bg.url}
|
||||
{#if bg.type === 'image'}
|
||||
{#if bg.type === "image"}
|
||||
<img class="object-cover w-full h-full rounded-xl" src={bg.url} alt="swatch" />
|
||||
{:else if bg.type === 'video'}
|
||||
{:else if bg.type === "video"}
|
||||
<video muted loop autoplay src={bg.url} class="object-cover w-full h-full rounded-xl"></video>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,24 +1,38 @@
|
||||
<script lang="ts">
|
||||
import { hasEnoughStorageSpace, isIndexedDBSupported, writeData, readAllData, deleteData } from '@/interface/hooks/BackgroundDataLoader'
|
||||
import BackgroundUploader from './BackgroundUploader.svelte';
|
||||
import BackgroundItem from './BackgroundItem.svelte'
|
||||
import { onMount, onDestroy } from 'svelte'
|
||||
import { loadBackground } from '@/seqta/ui/ImageBackgrounds'
|
||||
import { backgroundUpdates } from '@/interface/hooks/BackgroundUpdates'
|
||||
import {
|
||||
hasEnoughStorageSpace,
|
||||
isIndexedDBSupported,
|
||||
writeData,
|
||||
readAllData,
|
||||
deleteData,
|
||||
} from "@/interface/hooks/backgroundDataLoader";
|
||||
import BackgroundUploader from "./BackgroundUploader.svelte";
|
||||
import BackgroundItem from "./BackgroundItem.svelte";
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
import { loadBackground } from "@/seqta/ui/imageBackgrounds";
|
||||
import { backgroundUpdates } from "@/interface/hooks/backgroundUpdates";
|
||||
|
||||
let { isEditMode, selectNoBackground = $bindable(), selectedBackground = $bindable() }: { isEditMode: boolean, selectNoBackground: () => void, selectedBackground: string | null } = $props();
|
||||
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 feedback = $state<{ kind: 'error' | 'warn'; text: string } | null>(null);
|
||||
let feedback = $state<{ kind: "error" | "warn"; text: string } | null>(null);
|
||||
|
||||
let imageBackgrounds = $derived(backgrounds.filter(bg => bg.type === 'image'));
|
||||
let videoBackgrounds = $derived(backgrounds.filter(bg => bg.type === 'video'));
|
||||
let imageBackgrounds = $derived(backgrounds.filter((bg) => bg.type === "image"));
|
||||
let videoBackgrounds = $derived(backgrounds.filter((bg) => bg.type === "video"));
|
||||
|
||||
function inferBackgroundType(file: File): 'image' | 'video' {
|
||||
function inferBackgroundType(file: File): "image" | "video" {
|
||||
const mime = file.type.toLowerCase();
|
||||
if (mime.startsWith('video/')) return 'video';
|
||||
if (mime.startsWith('image/')) return 'image';
|
||||
const ext = file.name.split('.').pop()?.toLowerCase() ?? '';
|
||||
return ['mp4', 'mov', 'webm', 'm4v', 'mkv'].includes(ext) ? 'video' : 'image';
|
||||
if (mime.startsWith("video/")) return "video";
|
||||
if (mime.startsWith("image/")) return "image";
|
||||
const ext = file.name.split(".").pop()?.toLowerCase() ?? "";
|
||||
return ["mp4", "mov", "webm", "m4v", "mkv"].includes(ext) ? "video" : "image";
|
||||
}
|
||||
|
||||
async function handleFileChange(file: File): Promise<void> {
|
||||
@@ -35,9 +49,13 @@
|
||||
throw new Error("Not enough storage space to save this background.");
|
||||
}
|
||||
|
||||
const fileId = `${Date.now()}-${file.name.replace(/[^\w.-]+/g, '_')}`;
|
||||
const fileId = `${Date.now()}-${file.name.replace(/[^\w.-]+/g, "_")}`;
|
||||
const fileType = inferBackgroundType(file);
|
||||
const blob = file.slice(0, file.size, file.type || (fileType === 'video' ? 'video/mp4' : 'image/jpeg'));
|
||||
const blob = file.slice(
|
||||
0,
|
||||
file.size,
|
||||
file.type || (fileType === "video" ? "video/mp4" : "image/jpeg"),
|
||||
);
|
||||
|
||||
await writeData(fileId, fileType, blob);
|
||||
backgrounds = [
|
||||
@@ -46,17 +64,17 @@
|
||||
];
|
||||
backgroundUpdates.triggerUpdate();
|
||||
|
||||
const ext = file.name.split('.').pop()?.toLowerCase() ?? '';
|
||||
if (['heic', 'heif'].includes(ext) || file.type.toLowerCase().includes('hei')) {
|
||||
const ext = file.name.split(".").pop()?.toLowerCase() ?? "";
|
||||
if (["heic", "heif"].includes(ext) || file.type.toLowerCase().includes("hei")) {
|
||||
feedback = {
|
||||
kind: 'warn',
|
||||
text: 'HEIC saved, but Chrome and Edge often cannot preview it. Export as JPEG or PNG if the thumbnail stays blank.',
|
||||
kind: "warn",
|
||||
text: "HEIC saved, but Chrome and Edge often cannot preview it. Export as JPEG or PNG if the thumbnail stays blank.",
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
feedback = {
|
||||
kind: 'error',
|
||||
text: e instanceof Error ? e.message : 'An unknown error occurred',
|
||||
kind: "error",
|
||||
text: e instanceof Error ? e.message : "An unknown error occurred",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -69,27 +87,27 @@
|
||||
throw new Error("Your browser doesn't support IndexedDB. Unable to load backgrounds.");
|
||||
}
|
||||
|
||||
selectedBackground = localStorage.getItem('selectedBackground');
|
||||
selectedBackground = localStorage.getItem("selectedBackground");
|
||||
const dbData = await readAllData();
|
||||
|
||||
backgrounds.forEach(bg => {
|
||||
backgrounds.forEach((bg) => {
|
||||
if (bg.url) URL.revokeObjectURL(bg.url);
|
||||
});
|
||||
|
||||
backgrounds = dbData.map(bg => ({
|
||||
backgrounds = dbData.map((bg) => ({
|
||||
id: bg.id,
|
||||
type: bg.type,
|
||||
blob: bg.blob,
|
||||
url: URL.createObjectURL(bg.blob)
|
||||
url: URL.createObjectURL(bg.blob),
|
||||
}));
|
||||
|
||||
if (selectedBackground && !backgrounds.some(bg => bg.id === selectedBackground)) {
|
||||
if (selectedBackground && !backgrounds.some((bg) => bg.id === selectedBackground)) {
|
||||
selectNoBackground();
|
||||
}
|
||||
} catch (e) {
|
||||
feedback = {
|
||||
kind: 'error',
|
||||
text: e instanceof Error ? e.message : 'An unknown error occurred',
|
||||
kind: "error",
|
||||
text: e instanceof Error ? e.message : "An unknown error occurred",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -101,13 +119,13 @@
|
||||
}
|
||||
|
||||
selectedBackground = fileId;
|
||||
localStorage.setItem('selectedBackground', fileId);
|
||||
localStorage.setItem("selectedBackground", fileId);
|
||||
}
|
||||
|
||||
async function deleteBackground(fileId: string): Promise<void> {
|
||||
try {
|
||||
await deleteData(fileId);
|
||||
backgrounds = backgrounds.filter(bg => bg.id !== fileId);
|
||||
backgrounds = backgrounds.filter((bg) => bg.id !== fileId);
|
||||
|
||||
if (selectedBackground === fileId) {
|
||||
selectNoBackground();
|
||||
@@ -115,16 +133,16 @@
|
||||
backgroundUpdates.triggerUpdate();
|
||||
} catch (e) {
|
||||
feedback = {
|
||||
kind: 'error',
|
||||
text: e instanceof Error ? e.message : 'An unknown error occurred',
|
||||
kind: "error",
|
||||
text: e instanceof Error ? e.message : "An unknown error occurred",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
selectNoBackground = () => {
|
||||
selectedBackground = null;
|
||||
localStorage.setItem('selectedBackground', '');
|
||||
}
|
||||
localStorage.setItem("selectedBackground", "");
|
||||
};
|
||||
|
||||
$effect(() => {
|
||||
loadBackground();
|
||||
@@ -147,13 +165,19 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="relative px-1 { !( isEditMode && imageBackgrounds.length === 0 && videoBackgrounds.length === 0 ) && 'pt-2' }">
|
||||
<div
|
||||
class="relative px-1 {!(
|
||||
isEditMode &&
|
||||
imageBackgrounds.length === 0 &&
|
||||
videoBackgrounds.length === 0
|
||||
) && 'pt-2'}"
|
||||
>
|
||||
{#if feedback}
|
||||
<div
|
||||
class="mx-1 mb-3 rounded-lg border px-3 py-2 text-sm {feedback.kind === 'warn'
|
||||
? 'border-amber-300/60 bg-amber-50 text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100'
|
||||
: 'border-red-300/60 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200'}"
|
||||
role={feedback.kind === 'warn' ? 'status' : 'alert'}
|
||||
role={feedback.kind === "warn" ? "status" : "alert"}
|
||||
>
|
||||
{feedback.text}
|
||||
</div>
|
||||
@@ -168,11 +192,12 @@
|
||||
{#each imageBackgrounds as bg (bg.id)}
|
||||
{#if bg.url}
|
||||
<BackgroundItem
|
||||
bg={bg}
|
||||
{bg}
|
||||
isSelected={selectedBackground === bg.id}
|
||||
isEditMode={isEditMode}
|
||||
{isEditMode}
|
||||
onClick={() => selectBackground(bg.id)}
|
||||
onDelete={() => deleteBackground(bg.id)}/>
|
||||
onDelete={() => deleteBackground(bg.id)}
|
||||
/>
|
||||
{:else}
|
||||
<div class="w-16 h-16 rounded-xl bg-zinc-100 dark:bg-zinc-900 animate-pulse"></div>
|
||||
{/if}
|
||||
@@ -189,9 +214,9 @@
|
||||
{#each videoBackgrounds as bg (bg.id)}
|
||||
{#if bg.url}
|
||||
<BackgroundItem
|
||||
bg={bg}
|
||||
{bg}
|
||||
isSelected={selectedBackground === bg.id}
|
||||
isEditMode={isEditMode}
|
||||
{isEditMode}
|
||||
onClick={() => selectBackground(bg.id)}
|
||||
onDelete={() => deleteBackground(bg.id)}
|
||||
/>
|
||||
|
||||
@@ -1,32 +1,36 @@
|
||||
<script lang="ts">
|
||||
import { blobToDataUrl } from '@/seqta/utils/base64'
|
||||
import { blobToDataUrl } from "@/seqta/utils/base64";
|
||||
|
||||
let { source, alt = '', class: className = '' }: {
|
||||
source: string | Blob | null | undefined
|
||||
alt?: string
|
||||
class?: string
|
||||
} = $props()
|
||||
let {
|
||||
source,
|
||||
alt = "",
|
||||
class: className = "",
|
||||
}: {
|
||||
source: string | Blob | null | undefined;
|
||||
alt?: string;
|
||||
class?: string;
|
||||
} = $props();
|
||||
|
||||
let src = $state('')
|
||||
let src = $state("");
|
||||
|
||||
$effect(() => {
|
||||
const value = source
|
||||
const value = source;
|
||||
if (!value) {
|
||||
src = ''
|
||||
return
|
||||
src = "";
|
||||
return;
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
src = value
|
||||
return
|
||||
if (typeof value === "string") {
|
||||
src = value;
|
||||
return;
|
||||
}
|
||||
let cancelled = false
|
||||
let cancelled = false;
|
||||
void blobToDataUrl(value).then((url) => {
|
||||
if (!cancelled) src = url
|
||||
})
|
||||
if (!cancelled) src = url;
|
||||
});
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
})
|
||||
cancelled = true;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if src}
|
||||
|
||||
@@ -12,4 +12,4 @@
|
||||
const src = $derived(defaultThemeCoverDataUrl(accentHint));
|
||||
</script>
|
||||
|
||||
<img src={src} alt="" class={className} draggable="false" />
|
||||
<img {src} alt="" class={className} draggable="false" />
|
||||
@@ -1,22 +1,17 @@
|
||||
<script lang="ts">
|
||||
import type { CustomTheme, ThemeList } from '@/types/CustomThemes'
|
||||
import type { CustomTheme, ThemeList } from '@/types/customThemes'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import browser from '@/lib/browser'
|
||||
import { themeUpdates } from '@/interface/hooks/ThemeUpdates'
|
||||
import { themeUpdates } from '@/interface/hooks/themeUpdates'
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
import { cloudAuth } from '@/seqta/utils/CloudAuth'
|
||||
import { cloudAuth } from '@/seqta/utils/cloudAuth'
|
||||
import SignInToFavoriteModal from '@/interface/components/SignInToFavoriteModal.svelte'
|
||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||
import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
|
||||
import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
|
||||
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
||||
import { getRemoteConfigSnapshot, resolveEffectiveRemoteTheme } from '@/seqta/utils/remoteConfig/runtime'
|
||||
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
const remoteDirective = $derived(resolveEffectiveRemoteTheme(getRemoteConfigSnapshot()));
|
||||
const remoteThemeForced = $derived(
|
||||
remoteDirective?.mode === 'forced' && (remoteDirective.applicationMode ?? 'replace') === 'replace',
|
||||
);
|
||||
|
||||
let themes = $state<ThemeList | null>(null);
|
||||
let { isEditMode, showNavigation = true }: {
|
||||
@@ -41,7 +36,7 @@
|
||||
});
|
||||
|
||||
const handleThemeClick = async (theme: CustomTheme, e: MouseEvent) => {
|
||||
if (isEditMode || remoteThemeForced) return;
|
||||
if (isEditMode) return;
|
||||
if (theme.id === themes?.selectedTheme) {
|
||||
themeManager.setTransitionPoint(e.clientX, e.clientY);
|
||||
await themeManager.disableTheme();
|
||||
@@ -106,8 +101,8 @@
|
||||
}
|
||||
|
||||
const openStorePage = async () => {
|
||||
const { OpenStorePage } = await import('@/seqta/ui/renderStore')
|
||||
await OpenStorePage()
|
||||
const { openStorePage } = await import('@/seqta/ui/renderStore')
|
||||
await openStorePage()
|
||||
}
|
||||
|
||||
const openThemeCreator = async (themeId?: string) => {
|
||||
@@ -167,12 +162,7 @@
|
||||
role="list"
|
||||
tabindex="-1"
|
||||
>
|
||||
{#if remoteThemeForced}
|
||||
<p class="mb-3 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-100">
|
||||
Your school has applied a theme. Theme selection is locked until it is removed.
|
||||
</p>
|
||||
{/if}
|
||||
<div class="{useTwoColumnLayout ? 'grid grid-cols-2 gap-3' : 'flex flex-col gap-2 px-2'} {remoteThemeForced ? 'pointer-events-none opacity-50' : ''}">
|
||||
<div class="{useTwoColumnLayout ? 'grid grid-cols-2 gap-3' : 'flex flex-col gap-2 px-2'}">
|
||||
{#if themes}
|
||||
{#each themes.themes as theme (theme.id)}
|
||||
<button
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
input {
|
||||
&:focus {
|
||||
box-shadow: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
.no-scrollbar {
|
||||
scrollbar-width: none !important;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,13 +1,13 @@
|
||||
import browser from "@/lib/browser";
|
||||
import type { Theme } from "@/interface/types/Theme";
|
||||
import type { Theme } from "@/interface/types/theme";
|
||||
import {
|
||||
getCommunityInstalledThemeIds,
|
||||
getStoreInstalledThemeIds,
|
||||
} from "@/interface/utils/themeListFilters";
|
||||
import { normalizeStoreTheme } from "@/interface/utils/themeStoreFlavours";
|
||||
import { themeUpdates } from "@/interface/hooks/ThemeUpdates";
|
||||
import { themeUpdates } from "@/interface/hooks/themeUpdates";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
import { cloudAuth, isCloudAdmin } from "@/seqta/utils/CloudAuth";
|
||||
import { cloudAuth, isCloudAdmin } from "@/seqta/utils/cloudAuth";
|
||||
import {
|
||||
deleteCustomTheme,
|
||||
fetchCommunityThemes,
|
||||
|
||||
File renamed without changes.
@@ -8,12 +8,6 @@
|
||||
width: var(--tab-width);
|
||||
}
|
||||
|
||||
input {
|
||||
&:focus {
|
||||
box-shadow: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
.animate-fade-in {
|
||||
animation: fadeIn 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
+3
-22
@@ -1,25 +1,9 @@
|
||||
import Settings from "./pages/settings.svelte";
|
||||
import IconFamily from "@/resources/fonts/IconFamily.woff";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
import renderSvelte from "./main";
|
||||
import { initializeSettingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { initializeSettingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { loadRemoteStatus } from "@/seqta/utils/remoteStatus";
|
||||
import { initVerboseLogging, verboseInfo } from "@/utils/verboseLog";
|
||||
|
||||
function InjectCustomIcons() {
|
||||
verboseInfo("[BetterSEQTA+] Injecting Icons");
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.setAttribute("type", "text/css");
|
||||
style.innerHTML = `
|
||||
@font-face {
|
||||
font-family: 'IconFamily';
|
||||
src: url('${resolveExtensionAssetUrl(IconFamily)}') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
|
||||
const mountPoint = document.getElementById("app");
|
||||
if (!mountPoint) {
|
||||
// In production, Rollup may put this entry in a shared chunk that content
|
||||
@@ -27,13 +11,10 @@ if (!mountPoint) {
|
||||
// has `#app` — never throw on SEQTA tabs.
|
||||
verboseInfo("[BetterSEQTA+] Settings bootstrap skipped (no #app — not the settings page)");
|
||||
} else {
|
||||
InjectCustomIcons();
|
||||
|
||||
void (async () => {
|
||||
await initializeSettingsState();
|
||||
await loadRemoteStatus();
|
||||
initVerboseLogging();
|
||||
const { syncApiBaseToBackground } = await import("@/seqta/utils/DevApiBase");
|
||||
syncApiBaseToBackground();
|
||||
renderSvelte(Settings, mountPoint, { standalone: true });
|
||||
})();
|
||||
}
|
||||
@@ -21,7 +21,8 @@
|
||||
<div class="inline-flex rounded-xl bg-zinc-200/80 p-1 dark:bg-zinc-800/80">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg px-4 py-2 text-sm font-medium transition-colors {communityState.innerTab === 'browse'
|
||||
class="rounded-lg px-4 py-2 text-sm font-medium transition-colors {communityState.innerTab ===
|
||||
'browse'
|
||||
? 'bg-white text-zinc-900 shadow-sm dark:bg-zinc-700 dark:text-white'
|
||||
: 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white'}"
|
||||
onclick={() => (communityState.innerTab = "browse")}
|
||||
@@ -30,7 +31,8 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg px-4 py-2 text-sm font-medium transition-colors {communityState.innerTab === 'mine'
|
||||
class="rounded-lg px-4 py-2 text-sm font-medium transition-colors {communityState.innerTab ===
|
||||
'mine'
|
||||
? 'bg-white text-zinc-900 shadow-sm dark:bg-zinc-700 dark:text-white'
|
||||
: 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white'}"
|
||||
onclick={() => (communityState.innerTab = "mine")}
|
||||
@@ -40,7 +42,8 @@
|
||||
{#if communityState.isAdmin}
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg px-4 py-2 text-sm font-medium transition-colors {communityState.innerTab === 'review'
|
||||
class="rounded-lg px-4 py-2 text-sm font-medium transition-colors {communityState.innerTab ===
|
||||
'review'
|
||||
? 'bg-white text-zinc-900 shadow-sm dark:bg-zinc-700 dark:text-white'
|
||||
: 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white'}"
|
||||
onclick={() => (communityState.innerTab = "review")}
|
||||
@@ -63,7 +66,9 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<main class="min-h-0 flex-1 overflow-y-auto bg-zinc-50/80 px-6 py-6 dark:bg-zinc-900/40 md:px-8 lg:px-10">
|
||||
<main
|
||||
class="min-h-0 flex-1 overflow-y-auto bg-zinc-50/80 px-6 py-6 dark:bg-zinc-900/40 md:px-8 lg:px-10"
|
||||
>
|
||||
{#if communityState.innerTab === "browse"}
|
||||
<BrowsePanel {communityState} {searchTerm} />
|
||||
{:else if communityState.innerTab === "mine"}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
import { standalone as StandaloneStore } from "../utils/standalone.svelte";
|
||||
import { onMount, onDestroy, tick } from "svelte";
|
||||
import { animate } from "motion";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
||||
import { OpenAboutPage } from "@/seqta/utils/openers/OpenAboutPage";
|
||||
import { OpenWhatsNewPopup } from "@/seqta/utils/openers/OpenWhatsNewPopup";
|
||||
import { openAboutPage } from "@/seqta/utils/openers/openAboutPage";
|
||||
import { openWhatsNewPopup } from "@/seqta/utils/openers/openWhatsNewPopup";
|
||||
|
||||
import type { Component } from "svelte";
|
||||
import SidebarNav from "../components/SidebarNav.svelte";
|
||||
@@ -21,8 +21,8 @@
|
||||
import { settingsPopup } from "@/seqta/utils/settingsPopup";
|
||||
import { armDevModeUnlock } from "@/seqta/utils/devModeUnlock";
|
||||
import { consumeOpenFeedbackRequest } from "@/seqta/utils/feedback/client";
|
||||
import RemoteConfigStatusStrip from "../components/RemoteConfigStatusStrip.svelte";
|
||||
import { isRemoteSettingsSectionVisible } from "@/seqta/utils/remoteConfig/runtime";
|
||||
import RemoteStatusStrip from "../components/RemoteStatusStrip.svelte";
|
||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||
import {
|
||||
consumeSettingsDestination,
|
||||
SETTINGS_NAVIGATION_EVENT,
|
||||
@@ -88,23 +88,28 @@
|
||||
const ghReleaseChannelLabel = getInstalledGhReleaseChannelLabel();
|
||||
let ghReleaseUpdate = $state<GhReleaseUpdateInfo | null>(null);
|
||||
|
||||
const isSectionVisible = (id: string) =>
|
||||
!isFeatureDisabled(id === "account" ? "settings.nav.cloud" : `settings.section.${id}`);
|
||||
|
||||
const userNav: NavItem[] = [
|
||||
{ id: "account", label: "My Account" },
|
||||
{ id: "general", label: "General" },
|
||||
{ id: "appearance", label: "Appearance" },
|
||||
].filter((item) => isRemoteSettingsSectionVisible(item.id));
|
||||
].filter((item) => isSectionVisible(item.id));
|
||||
|
||||
$effect(() => {
|
||||
if (!$settingsState.devMode && activeSection === "advanced") activeSection = "general";
|
||||
});
|
||||
|
||||
const appNav = $derived<NavItem[]>([
|
||||
{ id: "timetable", label: "Timetable" },
|
||||
{ id: "assessments", label: "Assessments" },
|
||||
{ id: "features", label: "Features" },
|
||||
...($settingsState.devMode ? [{ id: "advanced", label: "Advanced" }] : []),
|
||||
{ id: "shortcuts", label: "Shortcuts" },
|
||||
].filter((item) => isRemoteSettingsSectionVisible(item.id)));
|
||||
const appNav = $derived<NavItem[]>(
|
||||
[
|
||||
{ id: "timetable", label: "Timetable" },
|
||||
{ id: "assessments", label: "Assessments" },
|
||||
{ id: "features", label: "Features" },
|
||||
...($settingsState.devMode ? [{ id: "advanced", label: "Advanced" }] : []),
|
||||
{ id: "shortcuts", label: "Shortcuts" },
|
||||
].filter((item) => isSectionVisible(item.id)),
|
||||
);
|
||||
|
||||
const settingsNavGroups = $derived([
|
||||
{ label: "User Settings", items: userNav },
|
||||
@@ -186,8 +191,7 @@
|
||||
);
|
||||
|
||||
const openGhRelease = () => {
|
||||
const url =
|
||||
ghReleaseUpdate?.url ?? "https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases";
|
||||
const url = ghReleaseUpdate?.url ?? "https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases";
|
||||
if (ghReleaseUpdate?.available) {
|
||||
dismissNightlyUpdate();
|
||||
}
|
||||
@@ -218,12 +222,12 @@
|
||||
};
|
||||
|
||||
const openChangelog = () => {
|
||||
OpenWhatsNewPopup();
|
||||
openWhatsNewPopup();
|
||||
closeExtensionPopup();
|
||||
};
|
||||
|
||||
const openAbout = () => {
|
||||
OpenAboutPage();
|
||||
openAboutPage();
|
||||
closeExtensionPopup();
|
||||
};
|
||||
|
||||
@@ -306,7 +310,9 @@
|
||||
const from = panel ? getComputedStyle(panel) : null;
|
||||
const start = bounds.map((key) => parseFloat(from?.[key] ?? "0"));
|
||||
resizeAnimation?.stop();
|
||||
const motionEnabled = $settingsState.animations !== false && !$settingsState.performanceMode &&
|
||||
const motionEnabled =
|
||||
$settingsState.animations !== false &&
|
||||
!$settingsState.performanceMode &&
|
||||
!window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
const root = panel?.getRootNode() as ShadowRoot | Document | undefined;
|
||||
const restoreFocus = !!content?.contains(root?.activeElement ?? null);
|
||||
@@ -334,9 +340,12 @@
|
||||
await tick();
|
||||
if (!panel || !content || generation !== resizeGeneration) return;
|
||||
for (const key of bounds) panel.style.removeProperty(key);
|
||||
if (restoreFocus) content.querySelector<HTMLButtonElement>(
|
||||
`[aria-label="${nextExpanded ? "Collapse" : "Expand"} settings"]`,
|
||||
)?.focus({ preventScroll: true });
|
||||
if (restoreFocus)
|
||||
content
|
||||
.querySelector<HTMLButtonElement>(
|
||||
`[aria-label="${nextExpanded ? "Collapse" : "Expand"} settings"]`,
|
||||
)
|
||||
?.focus({ preventScroll: true });
|
||||
if (!motionEnabled) return;
|
||||
const targetStyle = getComputedStyle(panel);
|
||||
const target = bounds.map((key) => parseFloat(targetStyle[key]));
|
||||
@@ -344,9 +353,13 @@
|
||||
// move, so compact text and images never stretch across the expanded panel.
|
||||
content.style.width = `${panel.clientWidth}px`;
|
||||
content.style.height = `${panel.clientHeight}px`;
|
||||
bounds.forEach((key, index) => { panel.style[key] = `${start[index]}px`; });
|
||||
bounds.forEach((key, index) => {
|
||||
panel.style[key] = `${start[index]}px`;
|
||||
});
|
||||
resizeAnimation = animate(0, 1, {
|
||||
type: "spring", stiffness: 420, damping: 36,
|
||||
type: "spring",
|
||||
stiffness: 420,
|
||||
damping: 36,
|
||||
onUpdate: (progress) => {
|
||||
if (generation !== resizeGeneration) return;
|
||||
const opacity = Math.max(0, Math.min(1, progress));
|
||||
@@ -393,9 +406,7 @@
|
||||
};
|
||||
|
||||
const syncCompactTab = () => {
|
||||
compactActiveTab = activePage === "settings"
|
||||
? activeSection === "shortcuts" ? 1 : 0
|
||||
: 2;
|
||||
compactActiveTab = activePage === "settings" ? (activeSection === "shortcuts" ? 1 : 0) : 2;
|
||||
lastExpandedTab = compactActiveTab;
|
||||
};
|
||||
|
||||
@@ -460,7 +471,8 @@
|
||||
? "community-themes"
|
||||
: "theme-settings";
|
||||
} else if (destination.page === "backgrounds" && destination.view) {
|
||||
activeBackgroundView = destination.view === "store" ? "background-store" : "background-settings";
|
||||
activeBackgroundView =
|
||||
destination.view === "store" ? "background-store" : "background-settings";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -553,7 +565,7 @@
|
||||
onToggleSize={standalone ? undefined : toggleExpanded}
|
||||
/>
|
||||
|
||||
<RemoteConfigStatusStrip />
|
||||
<RemoteStatusStrip />
|
||||
|
||||
<!-- Body: left nav + content -->
|
||||
<div class="flex flex-1 min-h-0 overflow-hidden">
|
||||
@@ -584,18 +596,16 @@
|
||||
type="search"
|
||||
placeholder="Search settings"
|
||||
bind:value={settingsSearch}
|
||||
class="h-10 w-full rounded-lg bg-zinc-200/70 pl-9 pr-3 text-sm text-zinc-900 placeholder:text-zinc-400 transition-colors duration-200 focus:bg-white focus:outline-hidden focus:ring-2 focus:ring-zinc-400 focus:ring-offset-2 dark:bg-zinc-800/80 dark:text-white dark:placeholder:text-zinc-500 dark:focus:bg-zinc-800 dark:focus:ring-offset-zinc-900"
|
||||
class="h-10 w-full rounded-lg bg-zinc-200/70 pl-9 pr-3 text-sm text-zinc-900 placeholder:text-zinc-400 transition-colors duration-200 focus:bg-white dark:bg-zinc-800/80 dark:text-white dark:placeholder:text-zinc-500 dark:focus:bg-zinc-800"
|
||||
/>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<SidebarNav
|
||||
groups={navGroups}
|
||||
selectedId={selectedNavId}
|
||||
onselect={selectNavItem}
|
||||
/>
|
||||
<SidebarNav groups={navGroups} selectedId={selectedNavId} onselect={selectNavItem} />
|
||||
|
||||
<div class="mt-4 flex shrink-0 flex-col gap-1 border-t border-zinc-200/60 pt-4 dark:border-zinc-700/50">
|
||||
<div
|
||||
class="mt-4 flex shrink-0 flex-col gap-1 border-t border-zinc-200/60 pt-4 dark:border-zinc-700/50"
|
||||
>
|
||||
{#if ghReleaseUpdateEnabled}
|
||||
<div class="px-3 pb-2">
|
||||
{#if ghReleaseUpdate?.available}
|
||||
@@ -618,7 +628,7 @@
|
||||
<button
|
||||
type="button"
|
||||
onclick={action.onclick}
|
||||
class="flex h-10 w-full items-center gap-3 rounded-lg px-3 text-left text-[16px] font-medium text-zinc-600 transition-[color,background-color,transform] duration-150 hover:bg-zinc-200/70 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden focus:ring-2 focus:ring-zinc-400 focus:ring-offset-2 dark:text-zinc-300 dark:hover:bg-zinc-700/70 dark:hover:text-white dark:focus:ring-offset-zinc-900"
|
||||
class="flex h-10 w-full items-center gap-3 rounded-lg px-3 text-left text-[16px] font-medium text-zinc-600 transition-[color,background-color,transform] duration-150 hover:bg-zinc-200/70 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-300 dark:hover:bg-zinc-700/70 dark:hover:text-white"
|
||||
>
|
||||
<span class="w-5 text-center font-IconFamily text-[18px]" aria-hidden="true">{action.icon}</span>
|
||||
<span>{action.label}</span>
|
||||
@@ -628,7 +638,7 @@
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => openFeedback()}
|
||||
class="mt-2 flex w-full items-center gap-3 rounded-lg bg-zinc-200/70 px-3 py-2.5 text-left text-[16px] font-medium text-zinc-700 transition-[color,background-color,transform] duration-150 hover:bg-zinc-300/80 active:scale-[0.96] focus:outline-hidden focus:ring-2 focus:ring-zinc-400 focus:ring-offset-2 dark:bg-zinc-800/80 dark:text-zinc-200 dark:hover:bg-zinc-700 dark:focus:ring-offset-zinc-900"
|
||||
class="mt-2 flex w-full items-center gap-3 rounded-lg bg-zinc-200/70 px-3 py-2.5 text-left text-[16px] font-medium text-zinc-700 transition-[color,background-color,transform] duration-150 hover:bg-zinc-300/80 active:scale-[0.96] dark:bg-zinc-800/80 dark:text-zinc-200 dark:hover:bg-zinc-700"
|
||||
>
|
||||
<svg
|
||||
class="w-5 h-5 shrink-0"
|
||||
@@ -724,7 +734,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -734,15 +743,19 @@
|
||||
<div
|
||||
class="flex h-full min-h-0 flex-col gap-2 overflow-hidden bg-white dark:bg-zinc-800 dark:text-white"
|
||||
>
|
||||
<RemoteConfigStatusStrip />
|
||||
<RemoteStatusStrip />
|
||||
<div
|
||||
class="grid shrink-0 items-center border-b border-zinc-200/40 dark:border-zinc-700/40 {standalone ? 'grid-cols-1' : 'grid-cols-[minmax(0,1fr)_44px] gap-2 px-2'}"
|
||||
class="grid shrink-0 items-center border-b border-zinc-200/40 dark:border-zinc-700/40 {standalone
|
||||
? 'grid-cols-1'
|
||||
: 'grid-cols-[minmax(0,1fr)_44px] gap-2 px-2'}"
|
||||
>
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<img
|
||||
src={resolveExtensionAssetUrl(darkLogo)}
|
||||
class="min-w-0 dark:hidden {standalone ? 'mx-auto w-4/5' : 'h-auto w-full max-w-[296px] justify-self-center object-contain'}"
|
||||
class="min-w-0 dark:hidden {standalone
|
||||
? 'mx-auto w-4/5'
|
||||
: 'h-auto w-full max-w-[296px] justify-self-center object-contain'}"
|
||||
alt="BetterSEQTA+"
|
||||
onclick={handleDevModeToggle}
|
||||
/>
|
||||
@@ -750,15 +763,33 @@
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<img
|
||||
src={resolveExtensionAssetUrl(lightLogo)}
|
||||
class="hidden min-w-0 dark:block {standalone ? 'mx-auto w-4/5' : 'h-auto w-full max-w-[296px] justify-self-center object-contain'}"
|
||||
class="hidden min-w-0 dark:block {standalone
|
||||
? 'mx-auto w-4/5'
|
||||
: 'h-auto w-full max-w-[296px] justify-self-center object-contain'}"
|
||||
alt="BetterSEQTA+"
|
||||
onclick={handleDevModeToggle}
|
||||
/>
|
||||
{#if !standalone}
|
||||
<button type="button" onclick={toggleExpanded}
|
||||
class="mt-2 flex h-11 w-11 shrink-0 self-start items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden dark:text-zinc-400 dark:hover:text-white"
|
||||
aria-label="Expand settings" title="Expand settings" aria-expanded="false">
|
||||
<span class="font-IconFamily text-2xl" aria-hidden="true">{"\uebdb"}</span>
|
||||
<button
|
||||
type="button"
|
||||
onclick={toggleExpanded}
|
||||
class="mt-2 flex h-11 w-11 shrink-0 self-start items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-400 dark:hover:text-white"
|
||||
aria-label="Expand settings"
|
||||
title="Expand settings"
|
||||
aria-expanded="false"
|
||||
>
|
||||
<svg
|
||||
class="text-2xl"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -800,19 +831,20 @@
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
class="absolute inset-0 z-50 {$settingsState.DarkMode
|
||||
? 'dark'
|
||||
: ''}"
|
||||
class="absolute inset-0 z-50 {$settingsState.DarkMode ? 'dark' : ''}"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="BetterSEQTA+ settings"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="settings-backdrop absolute inset-0 {expanded ? 'bg-black/60' : 'bg-transparent'} {expanded && !$settingsState.performanceMode
|
||||
class="settings-backdrop absolute inset-0 {expanded
|
||||
? 'bg-black/60'
|
||||
: 'bg-transparent'} {expanded && !$settingsState.performanceMode
|
||||
? 'backdrop-blur-xs'
|
||||
: 'backdrop-blur-none'}"
|
||||
class:settings-backdrop--motion={$settingsState.animations !== false && !$settingsState.performanceMode}
|
||||
class:settings-backdrop--motion={$settingsState.animations !== false &&
|
||||
!$settingsState.performanceMode}
|
||||
aria-label="Close settings"
|
||||
onclick={handleClose}
|
||||
></button>
|
||||
@@ -834,44 +866,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.settings-content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.settings-panel {
|
||||
width: min(384px, calc(100vw - 20px));
|
||||
height: min(600px, calc(100vh - 95px));
|
||||
top: min(80px, 10vh);
|
||||
right: 10px;
|
||||
border-radius: 1rem;
|
||||
transform-origin: 70% 0;
|
||||
}
|
||||
|
||||
.settings-panel--expanded {
|
||||
border-radius: 0.75rem;
|
||||
transform-origin: center;
|
||||
width: min(1180px, 96vw);
|
||||
height: min(860px, 92vh);
|
||||
top: calc((100% - min(860px, 92vh)) / 2);
|
||||
right: calc((100% - min(1180px, 96vw)) / 2);
|
||||
}
|
||||
|
||||
.settings-backdrop--motion {
|
||||
transition: background-color 200ms ease;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.settings-backdrop--motion {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{#if showColourPicker && ColourPickerComponent}
|
||||
<ColourPickerComponent
|
||||
hidePicker={() => {
|
||||
@@ -922,3 +916,41 @@
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.settings-content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.settings-panel {
|
||||
width: min(384px, calc(100vw - 20px));
|
||||
height: min(600px, calc(100vh - 95px));
|
||||
top: min(80px, 10vh);
|
||||
right: 10px;
|
||||
border-radius: 1rem;
|
||||
transform-origin: 70% 0;
|
||||
}
|
||||
|
||||
.settings-panel--expanded {
|
||||
border-radius: 0.75rem;
|
||||
transform-origin: center;
|
||||
width: min(1180px, 96vw);
|
||||
height: min(860px, 92vh);
|
||||
top: calc((100% - min(860px, 92vh)) / 2);
|
||||
right: calc((100% - min(1180px, 96vw)) / 2);
|
||||
}
|
||||
|
||||
.settings-backdrop--motion {
|
||||
transition: background-color 200ms ease;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.settings-backdrop--motion {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -5,12 +5,9 @@
|
||||
import Slider from "@/interface/components/Slider.svelte";
|
||||
import Select from "@/interface/components/Select.svelte";
|
||||
import HotkeyInput from "@/interface/components/HotkeyInput.svelte";
|
||||
import SettingRow from "./SettingRow.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import {
|
||||
setPerformanceModePluginOverride,
|
||||
} from "@/seqta/utils/performanceMode";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import { setPerformanceModePluginOverride } from "@/seqta/utils/performanceMode";
|
||||
import { PERFORMANCE_HEAVY_PLUGIN_IDS } from "@/seqta/utils/performanceModeConfig";
|
||||
import { onMount } from "svelte";
|
||||
import {
|
||||
@@ -19,11 +16,7 @@
|
||||
type SettingsSectionId,
|
||||
type SettingsSectionSharedProps,
|
||||
} from "./shared";
|
||||
import {
|
||||
pluginSettingsStore,
|
||||
type PluginSettingsEntry,
|
||||
} from "./pluginSettingsState.svelte";
|
||||
import { toMountableComponent } from "@/types/mountableComponent";
|
||||
import { pluginSettingsStore, type PluginSettingsEntry } from "./pluginSettingsState.svelte";
|
||||
|
||||
let {
|
||||
section,
|
||||
@@ -56,8 +49,7 @@
|
||||
const visiblePlugins = $derived(
|
||||
pluginSettingsStore.plugins.filter(
|
||||
(plugin) =>
|
||||
(PLUGIN_SECTION_BY_ID[plugin.pluginId] ?? "features") === section &&
|
||||
pluginHit(plugin),
|
||||
(PLUGIN_SECTION_BY_ID[plugin.pluginId] ?? "features") === section && pluginHit(plugin),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -73,10 +65,15 @@
|
||||
|
||||
{#each visiblePlugins as plugin (plugin.pluginId)}
|
||||
{@const perfPaused = pluginPerfPaused(plugin.pluginId)}
|
||||
<SettingsCard class="{!(plugin as PluginSettingsEntry & { disableToggle?: boolean }).disableToggle && Object.keys(plugin.settings).length === 0 ? 'hidden' : ''} {perfPaused ? 'opacity-60' : ''}">
|
||||
<SettingsCard
|
||||
class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40 {!plugin.disableToggle &&
|
||||
Object.keys(plugin.settings).length === 0
|
||||
? 'hidden'
|
||||
: ''} {perfPaused ? 'opacity-60' : ''}"
|
||||
>
|
||||
{#if perfPaused}
|
||||
<div
|
||||
class="flex justify-between items-center px-5 py-3 border-b border-amber-200/60 dark:border-amber-900/40 bg-amber-50/80 dark:bg-amber-950/20"
|
||||
class="flex justify-between items-center px-4 py-3 rounded-lg bg-amber-50/80 dark:bg-amber-950/20"
|
||||
>
|
||||
<p class="text-sm text-amber-800 dark:text-amber-200">
|
||||
Paused by Performance Mode — enable anyway
|
||||
@@ -90,7 +87,11 @@
|
||||
{/if}
|
||||
|
||||
{#if plugin.disableToggle}
|
||||
<div class="flex justify-between items-center px-4 py-3 {perfPaused ? 'pointer-events-none' : ''}">
|
||||
<div
|
||||
class="flex justify-between items-center px-4 py-3 {perfPaused
|
||||
? 'pointer-events-none'
|
||||
: ''}"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="flex gap-2 items-center text-sm font-bold">
|
||||
Enable {plugin.name}
|
||||
@@ -106,7 +107,8 @@
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ?? true}
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.enabled as boolean | undefined) ??
|
||||
true}
|
||||
onChange={async (value) => {
|
||||
if (plugin.pluginId === "assessments-average" && value === true) {
|
||||
showDisclaimer(
|
||||
@@ -137,13 +139,15 @@
|
||||
<div>
|
||||
{#if setting.type === "boolean"}
|
||||
<Switch
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as boolean | undefined) ?? setting.default}
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as
|
||||
boolean | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "number"}
|
||||
<div class="w-28 shrink-0">
|
||||
<Slider
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as number | undefined) ?? setting.default}
|
||||
state={(pluginSettingsStore.values[plugin.pluginId]?.[key] as
|
||||
number | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
min={setting.min}
|
||||
max={setting.max}
|
||||
@@ -154,13 +158,15 @@
|
||||
<input
|
||||
type="text"
|
||||
class="px-2 py-1 text-sm rounded-md dark:bg-[#38373D]/50 bg-[#DDDDDD] dark:text-white border-none"
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as
|
||||
string | undefined) ?? setting.default}
|
||||
oninput={(e) =>
|
||||
pluginSettingsStore.update(plugin.pluginId, key, e.currentTarget.value)}
|
||||
/>
|
||||
{:else if setting.type === "select"}
|
||||
<Select
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as
|
||||
string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
options={(setting.options as string[]).map((opt) => ({
|
||||
value: opt,
|
||||
@@ -171,7 +177,8 @@
|
||||
<Button onClick={() => setting.trigger?.()} text={setting.title} />
|
||||
{:else if setting.type === "hotkey"}
|
||||
<HotkeyInput
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as string | undefined) ?? setting.default}
|
||||
value={(pluginSettingsStore.values[plugin.pluginId]?.[key] as
|
||||
string | undefined) ?? setting.default}
|
||||
onChange={(value) => pluginSettingsStore.update(plugin.pluginId, key, value)}
|
||||
/>
|
||||
{:else if setting.type === "component" && setting.component}
|
||||
@@ -183,18 +190,5 @@
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#if plugin.pluginId === "global-search"}
|
||||
<SettingRow
|
||||
title="Theme of the Month"
|
||||
description="Show the monthly featured theme popup when a new entry is available"
|
||||
id={15}
|
||||
Component={toMountableComponent(Switch)}
|
||||
{searchQuery}
|
||||
props={{
|
||||
state: !($settingsState.themeOfTheMonthDisabled ?? false),
|
||||
onChange: (isOn: boolean) => (settingsState.themeOfTheMonthDisabled = !isOn),
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</SettingsCard>
|
||||
{/each}
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { SettingsList } from "@/interface/types/SettingsProps";
|
||||
import type { SettingsList } from "@/interface/types/settingsProps";
|
||||
import { matchesSearch } from "./shared";
|
||||
|
||||
let {
|
||||
|
||||
@@ -6,16 +6,12 @@
|
||||
import CloudHeader from "@/interface/components/store/CloudHeader.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import PluginSettingsBlocks from "../PluginSettingsBlocks.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/CloudAuth";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
import { toMountableComponent } from "@/types/mountableComponent";
|
||||
|
||||
let {
|
||||
showDisclaimer,
|
||||
showCloudPanel,
|
||||
searchQuery = "",
|
||||
}: SettingsSectionSharedProps = $props();
|
||||
let { showDisclaimer, showCloudPanel, searchQuery = "" }: SettingsSectionSharedProps = $props();
|
||||
|
||||
let cloudState = $state(cloudAuth.state);
|
||||
$effect(() => {
|
||||
@@ -102,9 +98,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{:else if showFounderBadgeSetting}
|
||||
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Sign in to Cloud first.
|
||||
</div>
|
||||
<div class="px-5 pb-4 text-sm text-zinc-600 dark:text-zinc-400">Sign in to Cloud first.</div>
|
||||
{/if}
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
@@ -2,42 +2,16 @@
|
||||
import { delay } from "@/seqta/utils/delay";
|
||||
import Switch from "@/interface/components/Switch.svelte";
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { openTermsOfServicePopup } from "@/seqta/utils/openers/OpenTermsOfServicePopup";
|
||||
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/openers/OpenThemeOfTheMonthPopup";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { openTermsOfServicePopup } from "@/seqta/utils/openers/openTermsOfServicePopup";
|
||||
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/openers/openThemeOfTheMonthPopup";
|
||||
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
||||
import { getSnapshotForUpload } from "@/seqta/utils/cloudSettingsSync";
|
||||
import { getStoredOverride, PRODUCTION_API_BASE, setApiBase } from "@/seqta/utils/DevApiBase";
|
||||
|
||||
const isExtensionDevBuild = import.meta.env.DEV;
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
|
||||
let { searchQuery = "" }: SettingsSectionSharedProps = $props();
|
||||
|
||||
let devApiBaseInput = $state<string>(getStoredOverride() ?? "");
|
||||
let devApiBaseActive = $state<string | null>(getStoredOverride());
|
||||
|
||||
function applyDevApiBase() {
|
||||
const trimmed = devApiBaseInput.trim();
|
||||
if (trimmed === "") {
|
||||
setApiBase(null);
|
||||
devApiBaseActive = null;
|
||||
return;
|
||||
}
|
||||
if (!/^https?:\/\//.test(trimmed)) {
|
||||
alert("Please enter a full URL starting with http:// or https://");
|
||||
return;
|
||||
}
|
||||
setApiBase(trimmed);
|
||||
devApiBaseActive = trimmed.replace(/\/$/, "");
|
||||
}
|
||||
|
||||
function clearDevApiBase() {
|
||||
devApiBaseInput = "";
|
||||
setApiBase(null);
|
||||
devApiBaseActive = null;
|
||||
}
|
||||
|
||||
async function exportCloudSettingsJsonToFile() {
|
||||
const payload = await getSnapshotForUpload();
|
||||
const blob = new Blob([JSON.stringify(payload, null, 2)], {
|
||||
@@ -52,19 +26,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $settingsState.devMode && matchesSearch(
|
||||
searchQuery,
|
||||
"Developer Mode",
|
||||
"Verbose logging",
|
||||
"Delay loading screen",
|
||||
"Sensitive Hider",
|
||||
"Mock Notices",
|
||||
"Show Privacy Notification",
|
||||
"Show Theme of the Month",
|
||||
"Export cloud settings JSON",
|
||||
"API Base URL",
|
||||
"GitHub latest version override",
|
||||
)}
|
||||
{#if $settingsState.devMode && matchesSearch(searchQuery, "Developer Mode", "Verbose logging", "Delay loading screen", "Sensitive Hider", "Mock Notices", "Show Privacy Notification", "Show Theme of the Month", "Export cloud settings JSON", "API Base URL", "GitHub latest version override")}
|
||||
<div
|
||||
class="flex-col p-1 my-1 bg-linear-to-br from-white rounded-xl border shadow-xs to-zinc-100 border-zinc-200/50 dark:border-zinc-700/40 dark:to-zinc-900/50 dark:from-zinc-900/40"
|
||||
>
|
||||
@@ -189,43 +151,6 @@
|
||||
<Button onClick={exportCloudSettingsJsonToFile} text="Export to file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-4 py-3">
|
||||
<div class="flex justify-between items-start gap-3">
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">API Base URL (session only)</h2>
|
||||
{#if isExtensionDevBuild}
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Extension dev builds always use production ({PRODUCTION_API_BASE}) for the theme store,
|
||||
community submit, and related APIs. Build a release package to test a staging host override.
|
||||
</p>
|
||||
{:else}
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Override the content API host for this browser session. Cleared on restart. Affects
|
||||
themes, theme of the month, and other server-driven content.
|
||||
</p>
|
||||
{#if devApiBaseActive}
|
||||
<p class="text-xs mt-1 text-amber-600 dark:text-amber-400">
|
||||
Override active: <span class="font-mono">{devApiBaseActive}</span>
|
||||
</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if !isExtensionDevBuild}
|
||||
<div class="flex gap-2 items-center">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="https://betterseqta.org"
|
||||
bind:value={devApiBaseInput}
|
||||
class="flex-1 px-2 py-1 text-xs rounded-sm border bg-white dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-zinc-100"
|
||||
/>
|
||||
<Button onClick={applyDevApiBase} text="Apply" />
|
||||
{#if devApiBaseActive}
|
||||
<Button onClick={clearDevApiBase} text="Clear" />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 px-4 py-3">
|
||||
<div>
|
||||
<h2 class="text-sm font-bold">GitHub latest version override</h2>
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
import SidebarAppearance from "@/interface/components/SidebarAppearance.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import PluginSettingsBlocks from "../PluginSettingsBlocks.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
import type { SettingsList } from "@/interface/types/SettingsProps";
|
||||
import type { SettingsList } from "@/interface/types/settingsProps";
|
||||
|
||||
let {
|
||||
showColourPicker,
|
||||
@@ -21,26 +21,9 @@
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
</script>
|
||||
|
||||
{#if matchesSearch(searchQuery, "Custom Theme Colour", "Interface Font", "Customise the overall theme colour of SEQTA Learn", "Choose the typeface used across SEQTA Learn")}
|
||||
{#if matchesSearch(searchQuery, "Custom Theme Colour", "Interface Font", "Theme of the Month", "Customise the overall theme colour of SEQTA Learn", "Choose the typeface used across SEQTA Learn", "Show the monthly featured theme popup when a new entry is available")}
|
||||
<SettingsCard class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40">
|
||||
{#each (
|
||||
[
|
||||
{
|
||||
title: "Custom Theme Colour",
|
||||
description: "Customise the overall theme colour of SEQTA Learn",
|
||||
id: 4,
|
||||
Component: PickerSwatch,
|
||||
props: { onClick: showColourPicker },
|
||||
},
|
||||
{
|
||||
title: "Interface Font",
|
||||
description: "Choose the typeface used across SEQTA Learn",
|
||||
id: 16,
|
||||
Component: Button,
|
||||
props: { onClick: showFontPicker, text: "Change" },
|
||||
},
|
||||
] as unknown as SettingsList[]
|
||||
) as option (option.id)}
|
||||
{#each [{ title: "Custom Theme Colour", description: "Customise the overall theme colour of SEQTA Learn", id: 4, Component: PickerSwatch, props: { onClick: showColourPicker } }, { title: "Interface Font", description: "Choose the typeface used across SEQTA Learn", id: 16, Component: Button, props: { onClick: showFontPicker, text: "Change" } }, { title: "Theme of the Month", description: "Show the monthly featured theme popup when a new entry is available", id: 15, Component: Switch, props: { state: !($settingsState.themeOfTheMonthDisabled ?? false), onChange: (isOn: boolean) => (settingsState.themeOfTheMonthDisabled = !isOn) } }] as unknown as SettingsList[] as option (option.id)}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{/each}
|
||||
</SettingsCard>
|
||||
@@ -50,7 +33,7 @@
|
||||
<SidebarAppearance {searchQuery} />
|
||||
{/if}
|
||||
|
||||
{#if matchesSearch(searchQuery, "Adaptive Theme Colour", "Soft Gradient", "Smooth colour transition")}
|
||||
{#if matchesSearch(searchQuery, "Adaptive Theme Colour", "Soft Gradient", "Smooth Colour Transition")}
|
||||
<SettingsCard>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
@@ -88,7 +71,7 @@
|
||||
class="flex justify-between items-center px-4 py-3 pl-6 border-t border-zinc-100 dark:border-zinc-700/50"
|
||||
>
|
||||
<div class="pr-4">
|
||||
<h2 class="text-sm font-bold">Smooth colour transition</h2>
|
||||
<h2 class="text-sm font-bold">Smooth Colour Transition</h2>
|
||||
<p class="text-xs text-zinc-600 dark:text-zinc-300">
|
||||
Ease between class/subject colours when navigating instead of switching instantly
|
||||
</p>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import Button from "@/interface/components/Button.svelte";
|
||||
import Select from "@/interface/components/Select.svelte";
|
||||
import SettingRow from "../SettingRow.svelte";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import {
|
||||
PERFORMANCE_HEAVY_PLUGINS,
|
||||
@@ -12,15 +12,13 @@
|
||||
} from "@/seqta/utils/performanceMode";
|
||||
import browser from "@/lib/browser";
|
||||
import { matchesSearch, type SettingsSectionSharedProps } from "../shared";
|
||||
import type { SettingsList } from "@/interface/types/SettingsProps";
|
||||
import { checkRemoteFeature } from "@/seqta/utils/remoteConfig/runtime";
|
||||
import type { SettingsList } from "@/interface/types/settingsProps";
|
||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||
|
||||
let { searchQuery = "" }: SettingsSectionSharedProps = $props();
|
||||
|
||||
const isEngage = isSeqtaEngageExperience();
|
||||
const onoffGate = $derived(checkRemoteFeature("settings.control.onoff"));
|
||||
const onoffGreyedOut = $derived(onoffGate.mode === "greyout");
|
||||
const sidebarEditHidden = $derived(checkRemoteFeature("ui.sidebar.edit").hide);
|
||||
const sidebarEditHidden = isFeatureDisabled("ui.sidebar.edit");
|
||||
|
||||
const generalOptions = $derived([
|
||||
{
|
||||
@@ -149,19 +147,7 @@
|
||||
{#if generalOptions.some((option) => matchesSearch(searchQuery, option.title, option.description))}
|
||||
<SettingsCard class="divide-y divide-zinc-200/60 dark:divide-zinc-700/40">
|
||||
{#each generalOptions as option (option.id)}
|
||||
{#if option.id === 12}
|
||||
<div
|
||||
class:opacity-50={onoffGreyedOut}
|
||||
class:pointer-events-none={onoffGreyedOut}
|
||||
title={onoffGreyedOut
|
||||
? (onoffGate.message?.body ?? "Disabled by site operator")
|
||||
: undefined}
|
||||
>
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
</div>
|
||||
{:else}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{/if}
|
||||
<SettingRow {...option} {searchQuery} />
|
||||
{#if option.id === 0 && $settingsState.performanceMode && matchesSearch(searchQuery, "Performance Mode", "Global Search", "Assessment Averages", "enable anyway", "paused")}
|
||||
<div class="border-none -mt-px">
|
||||
<div
|
||||
@@ -174,12 +160,15 @@
|
||||
{#each PERFORMANCE_HEAVY_PLUGINS as heavy (heavy.id)}
|
||||
<div class="flex justify-between items-center gap-4">
|
||||
<div class="min-w-0">
|
||||
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">{heavy.name}</p>
|
||||
<p class="text-sm font-semibold text-zinc-800 dark:text-zinc-100">
|
||||
{heavy.name}
|
||||
</p>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400">{heavy.description}</p>
|
||||
</div>
|
||||
<Switch
|
||||
state={$settingsState.performanceModePluginOverrides?.[heavy.id] === true}
|
||||
onChange={(forceOn: boolean) => setPerformanceModePluginOverride(heavy.id, forceOn)}
|
||||
onChange={(forceOn: boolean) =>
|
||||
setPerformanceModePluginOverride(heavy.id, forceOn)}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -191,13 +180,7 @@
|
||||
</SettingsCard>
|
||||
{/if}
|
||||
|
||||
{#if matchesSearch(
|
||||
searchQuery,
|
||||
"Home Page Assessments",
|
||||
"Include Past Assessments",
|
||||
"Maximum Subjects",
|
||||
"Maximum Assessments per Subject",
|
||||
)}
|
||||
{#if matchesSearch(searchQuery, "Home Page Assessments", "Include Past Assessments", "Maximum Subjects", "Maximum Assessments per Subject")}
|
||||
<SettingsCard>
|
||||
<div class="flex justify-between items-center px-4 py-3">
|
||||
<div class="pr-4">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import MotionDiv from '@/interface/components/MotionDiv.svelte';
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState.ts"
|
||||
import Switch from "@/interface/components/Switch.svelte"
|
||||
import Button from "@/interface/components/Button.svelte"
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import CoverSwiper from '../components/store/CoverSwiper.svelte';
|
||||
import ThemeGrid from '../components/store/ThemeGrid.svelte';
|
||||
import SkeletonLoader from '../components/SkeletonLoader.svelte';
|
||||
import type { Theme } from '../types/Theme'
|
||||
import { visibleStoreThemes, buildCoverSlidesForThemes, normalizeStoreTheme } from '@/interface/utils/themeStoreFlavours'
|
||||
import browser from '@/lib/browser'
|
||||
import ThemeModal from '../components/store/ThemeModal.svelte'
|
||||
import { themeUpdates } from '../hooks/ThemeUpdates'
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
import { onMount } from "svelte";
|
||||
|
||||
import { loadBackground } from '@/seqta/ui/ImageBackgrounds'
|
||||
import Backgrounds from '../components/store/Backgrounds.svelte'
|
||||
import { cloudAuth } from '@/seqta/utils/CloudAuth'
|
||||
import SignInToFavoriteModal from '../components/SignInToFavoriteModal.svelte'
|
||||
import { getStoreInstalledThemeIds } from '@/interface/utils/themeListFilters'
|
||||
import { consumePendingHighlightThemeId } from '@/seqta/utils/openThemeStoreWithHighlight'
|
||||
import CoverSwiper from "../components/store/CoverSwiper.svelte";
|
||||
import ThemeGrid from "../components/store/ThemeGrid.svelte";
|
||||
import SkeletonLoader from "../components/SkeletonLoader.svelte";
|
||||
import type { Theme } from "../types/theme";
|
||||
import {
|
||||
visibleStoreThemes,
|
||||
buildCoverSlidesForThemes,
|
||||
normalizeStoreTheme,
|
||||
} from "@/interface/utils/themeStoreFlavours";
|
||||
import browser from "@/lib/browser";
|
||||
import ThemeModal from "../components/store/ThemeModal.svelte";
|
||||
import { themeUpdates } from "../hooks/themeUpdates";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
|
||||
import { loadBackground } from "@/seqta/ui/imageBackgrounds";
|
||||
import Backgrounds from "../components/store/Backgrounds.svelte";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
import SignInToFavoriteModal from "../components/SignInToFavoriteModal.svelte";
|
||||
import { getStoreInstalledThemeIds } from "@/interface/utils/themeListFilters";
|
||||
import { consumePendingHighlightThemeId } from "@/seqta/utils/openThemeStoreWithHighlight";
|
||||
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
type StoreTab = 'themes' | 'backgrounds';
|
||||
type StoreTab = "themes" | "backgrounds";
|
||||
let {
|
||||
activeTab,
|
||||
searchTerm,
|
||||
@@ -38,7 +42,9 @@
|
||||
let cloudLoggedIn = $state(cloudAuth.state.isLoggedIn);
|
||||
|
||||
$effect(() => {
|
||||
const unsub = cloudAuth.subscribe((s) => { cloudLoggedIn = s.isLoggedIn; });
|
||||
const unsub = cloudAuth.subscribe((s) => {
|
||||
cloudLoggedIn = s.isLoggedIn;
|
||||
});
|
||||
return unsub;
|
||||
});
|
||||
|
||||
@@ -52,9 +58,9 @@
|
||||
let loading = $state(true);
|
||||
let displayTheme = $state<Theme | null>(null);
|
||||
let currentThemes = $state<string[]>([]);
|
||||
let selectedThemeId = $state('');
|
||||
let selectedThemeId = $state("");
|
||||
let installedThemeColors = $state<Record<string, string>>({});
|
||||
|
||||
|
||||
let error = $state<string | null>(null);
|
||||
let fetchAttempt = $state(0);
|
||||
let selectedBackground = $state<string | null>(null);
|
||||
@@ -67,7 +73,15 @@
|
||||
return Promise.race([
|
||||
browser.runtime.sendMessage(message) as Promise<T>,
|
||||
new Promise<T>((_, reject) => {
|
||||
setTimeout(() => reject(new Error('Theme store request timed out — reload the SEQTA page after updating the extension.')), FETCH_MESSAGE_TIMEOUT_MS);
|
||||
setTimeout(
|
||||
() =>
|
||||
reject(
|
||||
new Error(
|
||||
"Theme store request timed out — reload the SEQTA page after updating the extension.",
|
||||
),
|
||||
),
|
||||
FETCH_MESSAGE_TIMEOUT_MS,
|
||||
);
|
||||
}),
|
||||
]);
|
||||
}
|
||||
@@ -75,7 +89,7 @@
|
||||
const fetchCurrentThemes = async () => {
|
||||
const themes = await themeManager.getAvailableThemes();
|
||||
currentThemes = getStoreInstalledThemeIds(themes);
|
||||
selectedThemeId = themeManager.getSelectedThemeId() || '';
|
||||
selectedThemeId = themeManager.getSelectedThemeId() || "";
|
||||
installedThemeColors = Object.fromEntries(
|
||||
themes
|
||||
.filter((theme) => theme != null && theme.installedFromStore === true)
|
||||
@@ -86,7 +100,7 @@
|
||||
const setDisplayTheme = (theme: Theme | null) => {
|
||||
displayTheme = theme;
|
||||
};
|
||||
|
||||
|
||||
/** Featured themes first; within each group, newest by `created_at` (API: Unix seconds). */
|
||||
function compareStoreThemes(a: Theme, b: Theme): number {
|
||||
const fa = a.featured === true ? 1 : 0;
|
||||
@@ -102,16 +116,20 @@
|
||||
if (!cloudLoggedIn) return;
|
||||
const isFavorite = !theme.is_favorited;
|
||||
const result = (await browser.runtime.sendMessage({
|
||||
type: 'cloudFavorite',
|
||||
type: "cloudFavorite",
|
||||
themeId: theme.id,
|
||||
action: isFavorite ? 'favorite' : 'unfavorite',
|
||||
action: isFavorite ? "favorite" : "unfavorite",
|
||||
})) as { success?: boolean };
|
||||
if (result?.success) {
|
||||
const delta = isFavorite ? 1 : -1;
|
||||
themes = themes.map((t) =>
|
||||
t.id === theme.id
|
||||
? { ...t, is_favorited: isFavorite, favorite_count: Math.max(0, (t.favorite_count ?? 0) + delta) }
|
||||
: t
|
||||
? {
|
||||
...t,
|
||||
is_favorited: isFavorite,
|
||||
favorite_count: Math.max(0, (t.favorite_count ?? 0) + delta),
|
||||
}
|
||||
: t,
|
||||
);
|
||||
if (displayTheme?.id === theme.id) {
|
||||
displayTheme = {
|
||||
@@ -135,10 +153,10 @@
|
||||
data?: { themes: unknown[] };
|
||||
error?: string;
|
||||
}>({
|
||||
type: 'fetchThemes',
|
||||
type: "fetchThemes",
|
||||
});
|
||||
if (!data?.success || !Array.isArray(data?.data?.themes)) {
|
||||
throw new Error(data?.error || 'Failed to fetch themes');
|
||||
throw new Error(data?.error || "Failed to fetch themes");
|
||||
}
|
||||
themes = data.data.themes
|
||||
.map((row) => normalizeStoreTheme(row as Record<string, unknown>))
|
||||
@@ -147,13 +165,13 @@
|
||||
error = null;
|
||||
loading = false;
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch themes', err);
|
||||
console.error("Failed to fetch themes", err);
|
||||
fetchAttempt += 1;
|
||||
if (fetchAttempt >= MAX_FETCH_ATTEMPTS) {
|
||||
error =
|
||||
err instanceof Error
|
||||
? err.message
|
||||
: 'Could not load themes. Reload the SEQTA page, then open the store again.';
|
||||
: "Could not load themes. Reload the SEQTA page, then open the store again.";
|
||||
loading = false;
|
||||
return;
|
||||
}
|
||||
@@ -162,24 +180,25 @@
|
||||
};
|
||||
|
||||
function focusThemeById(themeId: string) {
|
||||
const match = themes.find((t) => t.id === themeId)
|
||||
?? themes.find((t) => t.flavours?.some((f) => f.id === themeId));
|
||||
const match =
|
||||
themes.find((t) => t.id === themeId) ??
|
||||
themes.find((t) => t.flavours?.some((f) => f.id === themeId));
|
||||
if (match) {
|
||||
setActiveTab('themes');
|
||||
setSearchTerm('');
|
||||
setActiveTab("themes");
|
||||
setSearchTerm("");
|
||||
displayTheme = match;
|
||||
}
|
||||
}
|
||||
|
||||
function onHighlightThemeEvent(e: Event) {
|
||||
const detail = (e as CustomEvent).detail;
|
||||
if (detail?.themeId && typeof detail.themeId === 'string') {
|
||||
if (detail?.themeId && typeof detail.themeId === "string") {
|
||||
focusThemeById(detail.themeId);
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
window.addEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
||||
window.addEventListener("bsplus:highlight-theme", onHighlightThemeEvent);
|
||||
themeUpdates.addListener(fetchCurrentThemes);
|
||||
|
||||
const load = async () => {
|
||||
@@ -196,7 +215,7 @@
|
||||
}
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
||||
window.removeEventListener("bsplus:highlight-theme", onHighlightThemeEvent);
|
||||
themeUpdates.removeListener(fetchCurrentThemes);
|
||||
};
|
||||
});
|
||||
@@ -205,8 +224,8 @@
|
||||
let filteredThemes = $derived(
|
||||
listThemes.filter((theme) => {
|
||||
const q = searchTerm.toLowerCase();
|
||||
const name = (theme.name ?? '').toLowerCase();
|
||||
const description = (theme.description ?? '').toLowerCase();
|
||||
const name = (theme.name ?? "").toLowerCase();
|
||||
const description = (theme.description ?? "").toLowerCase();
|
||||
return name.includes(q) || description.includes(q);
|
||||
}),
|
||||
);
|
||||
@@ -225,7 +244,9 @@
|
||||
await themeManager.setTheme(themeId);
|
||||
themeUpdates.triggerUpdate();
|
||||
await fetchCurrentThemes();
|
||||
void browser.runtime.sendMessage({ type: 'cloudSettingsRequestDebouncedUpload' }).catch(() => {});
|
||||
void browser.runtime
|
||||
.sendMessage({ type: "cloudSettingsRequestDebouncedUpload" })
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
async function removeThemeFromStore(themeId: string) {
|
||||
@@ -238,7 +259,9 @@
|
||||
await themeManager.setTheme(themeId);
|
||||
selectedThemeId = themeId;
|
||||
themeUpdates.triggerUpdate();
|
||||
void browser.runtime.sendMessage({ type: 'cloudSettingsRequestDebouncedUpload' }).catch(() => {});
|
||||
void browser.runtime
|
||||
.sendMessage({ type: "cloudSettingsRequestDebouncedUpload" })
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
@@ -265,10 +288,10 @@
|
||||
</script>
|
||||
|
||||
<div class="relative flex h-full min-h-0 flex-col overflow-hidden text-zinc-900 dark:text-white">
|
||||
<main class="min-h-0 flex-1 overflow-y-auto bg-zinc-50/80 dark:bg-zinc-900/40">
|
||||
<div class={activeTab === 'backgrounds' ? 'h-full' : 'px-6 py-6 md:px-8 lg:px-10'}>
|
||||
<!-- Loading State -->
|
||||
{#if loading}
|
||||
<main class="min-h-0 flex-1 overflow-y-auto bg-zinc-50/80 dark:bg-zinc-900/40">
|
||||
<div class={activeTab === "backgrounds" ? "h-full" : "px-6 py-6 md:px-8 lg:px-10"}>
|
||||
<!-- Loading State -->
|
||||
{#if loading}
|
||||
<div class="grid grid-cols-1 gap-4 py-12 mx-auto sm:grid-cols-2 lg:grid-cols-3">
|
||||
{#each Array(6) as _, i (i)}
|
||||
<SkeletonLoader width="100%" height="200px" />
|
||||
@@ -276,10 +299,13 @@
|
||||
</div>
|
||||
{:else if error}
|
||||
<div class="flex flex-col items-center justify-center py-24 text-center max-w-lg mx-auto">
|
||||
<h2 class="text-2xl font-bold text-zinc-900 dark:text-zinc-100">Couldn't load themes</h2>
|
||||
<h2 class="text-2xl font-bold text-zinc-900 dark:text-zinc-100">
|
||||
Couldn't load themes
|
||||
</h2>
|
||||
<p class="mt-3 text-zinc-600 dark:text-zinc-300">{error}</p>
|
||||
<p class="mt-2 text-sm text-zinc-500 dark:text-zinc-400">
|
||||
After an extension update, reload your SEQTA tab so the new version can talk to the browser.
|
||||
After an extension update, reload your SEQTA tab so the new version can talk to the
|
||||
browser.
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
@@ -295,11 +321,11 @@
|
||||
</div>
|
||||
{:else}
|
||||
<!-- Themes Tab Content -->
|
||||
{#if activeTab === 'themes'}
|
||||
{#if searchTerm === ''}
|
||||
{#if activeTab === "themes"}
|
||||
{#if searchTerm === ""}
|
||||
<CoverSwiper slides={coverSlides} {setDisplayTheme} />
|
||||
{/if}
|
||||
|
||||
|
||||
<!-- ThemeGrid to display filtered themes -->
|
||||
<ThemeGrid
|
||||
themes={filteredThemes}
|
||||
@@ -311,10 +337,10 @@
|
||||
onRequestSignIn={() => (showSignInOverlay = true)}
|
||||
installedThemeIds={currentThemes}
|
||||
/>
|
||||
|
||||
|
||||
{#if displayTheme}
|
||||
<ThemeModal
|
||||
currentThemes={currentThemes}
|
||||
{currentThemes}
|
||||
allThemes={listThemes}
|
||||
allStoreThemeRows={themes}
|
||||
theme={displayTheme}
|
||||
@@ -329,7 +355,7 @@
|
||||
if (displayTheme) await installThemeFromStore(themeId, displayTheme);
|
||||
}}
|
||||
onRemove={async (themeId: string) => {
|
||||
console.debug('deleting theme', themeId);
|
||||
console.debug("deleting theme", themeId);
|
||||
await removeThemeFromStore(themeId);
|
||||
}}
|
||||
onApply={async (themeId: string) => {
|
||||
@@ -337,16 +363,16 @@
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{:else if activeTab === 'backgrounds'}
|
||||
{:else if activeTab === "backgrounds"}
|
||||
<Backgrounds
|
||||
{searchTerm}
|
||||
selectedCategory={selectedBackgroundCategory}
|
||||
onCategoriesChange={setBackgroundCategories}
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{#if showSignInOverlay}
|
||||
<SignInToFavoriteModal onClose={() => (showSignInOverlay = false)} />
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
import {
|
||||
type LoadedCustomTheme,
|
||||
shouldForceThemeAppearance,
|
||||
} from '@/types/CustomThemes'
|
||||
} from '@/types/customThemes'
|
||||
|
||||
import { settingsState } from '@/seqta/utils/listeners/SettingsState'
|
||||
import { settingsState } from '@/seqta/utils/listeners/settingsState'
|
||||
|
||||
import Divider from '@/interface/components/themeCreator/divider.svelte'
|
||||
import Switch from '@/interface/components/Switch.svelte'
|
||||
@@ -23,16 +23,16 @@
|
||||
handleImageVariableChange,
|
||||
} from '../utils/themeImageHandlers';
|
||||
import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
|
||||
import { themeUpdates } from '../hooks/ThemeUpdates'
|
||||
import { CloseThemeCreator } from '@/plugins/built-in/themes/ThemeCreator'
|
||||
import { themeUpdates } from '../hooks/themeUpdates'
|
||||
import { closeThemeCreator } from '@/plugins/built-in/themes/themeCreator'
|
||||
import { submitLocalThemeToCommunity } from '@/seqta/utils/customThemes/submitLocalTheme'
|
||||
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
|
||||
import { cloudAuth } from '@/seqta/utils/CloudAuth'
|
||||
import { cloudAuth } from '@/seqta/utils/cloudAuth'
|
||||
import LucideMoon from '@/interface/components/icons/LucideMoon.svelte'
|
||||
import LucideSun from '@/interface/components/icons/LucideSun.svelte'
|
||||
import SidebarAppearance from '@/interface/components/SidebarAppearance.svelte'
|
||||
import { FONT_PRESETS, DEFAULT_FONT_ID } from '@/seqta/ui/fonts/presets'
|
||||
import { applySelectedFont, ensureFontPickerFontsLoaded } from '@/seqta/ui/fonts/Manager'
|
||||
import { applySelectedFont, ensureFontPickerFontsLoaded } from '@/seqta/ui/fonts/fontManager'
|
||||
import {
|
||||
applySidebarSettings,
|
||||
defaultThemeCreatorMeta,
|
||||
@@ -41,7 +41,8 @@
|
||||
} from '@/interface/utils/themeCreatorMeta'
|
||||
import { ensureThemeCoverImage } from '@/interface/utils/themePlaceholderCover'
|
||||
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
|
||||
import type { ThemeCreatorMeta } from '@/types/CustomThemes'
|
||||
import type { ThemeCreatorMeta } from '@/types/customThemes'
|
||||
import { parseThemeBuilderJson } from '@/interface/utils/parseThemeBuilderJson'
|
||||
|
||||
const { themeID }: { themeID: string } = $props()
|
||||
const themeManager = ThemeManager.getInstance();
|
||||
@@ -62,7 +63,11 @@
|
||||
forceDark: undefined,
|
||||
adaptiveCssVariables: [],
|
||||
})
|
||||
let closedAccordions = $state<string[]>([])
|
||||
let closedAccordions = $state<string[]>(['Advanced'])
|
||||
let themeJsonDraft = $state('')
|
||||
let themeJsonError = $state<string | null>(null)
|
||||
/** After JSON import, preview CustomCSS as-is until the user edits generated visuals. */
|
||||
let jsonImportRawPreview = $state(false)
|
||||
let themeLoaded = $state(false);
|
||||
let codeEditorFullscreen = $state(false);
|
||||
let communityBusy = $state(false);
|
||||
@@ -75,6 +80,9 @@
|
||||
|
||||
const previewTheme = $derived.by(() => {
|
||||
if (!themeLoaded) return null;
|
||||
if (jsonImportRawPreview) {
|
||||
return { ...theme, creatorMeta };
|
||||
}
|
||||
if (composeVisuals || theme.creatorMeta || creatorMeta.pageBackgroundImageId) {
|
||||
return mergeThemeWithCreatorMeta(theme, creatorMeta);
|
||||
}
|
||||
@@ -82,12 +90,42 @@
|
||||
});
|
||||
|
||||
function touchVisuals() {
|
||||
jsonImportRawPreview = false;
|
||||
if (!composeVisuals && !theme.creatorMeta && !creatorMeta.userCustomCss.trim()) {
|
||||
creatorMeta = { ...creatorMeta, userCustomCss: theme.CustomCSS };
|
||||
}
|
||||
composeVisuals = true;
|
||||
}
|
||||
|
||||
function applyImportedThemeJson() {
|
||||
themeJsonError = null;
|
||||
try {
|
||||
const parsed = parseThemeBuilderJson(themeJsonDraft);
|
||||
jsonImportRawPreview = true;
|
||||
composeVisuals = false;
|
||||
theme = {
|
||||
...parsed,
|
||||
creatorMeta: undefined,
|
||||
adaptiveCssVariables: parsed.adaptiveCssVariables ?? [],
|
||||
forceTheme:
|
||||
parsed.forceTheme ?? (parsed.forceDark !== undefined ? true : undefined),
|
||||
};
|
||||
if (parsed.creatorMeta) {
|
||||
creatorMeta = { ...defaultThemeCreatorMeta(), ...parsed.creatorMeta };
|
||||
applySidebarSettings(parsed.creatorMeta.sidebar);
|
||||
} else {
|
||||
creatorMeta = defaultThemeCreatorMeta({
|
||||
userCustomCss: "",
|
||||
fontId: settingsState.selectedFont ?? DEFAULT_FONT_ID,
|
||||
});
|
||||
}
|
||||
applySelectedFont(creatorMeta.fontId);
|
||||
themeUpdates.triggerUpdate();
|
||||
} catch (err) {
|
||||
themeJsonError = err instanceof Error ? err.message : "Could not load theme JSON";
|
||||
}
|
||||
}
|
||||
|
||||
function imageUsage(imageId: string): 'decorative' | 'page-background' | 'cover' {
|
||||
if (creatorMeta.pageBackgroundImageId === imageId) return 'page-background';
|
||||
const image = theme.CustomImages.find((item) => item.id === imageId);
|
||||
@@ -242,7 +280,7 @@
|
||||
await themeManager.saveTheme(themeClone);
|
||||
await themeManager.setTheme(themeClone.id);
|
||||
themeUpdates.triggerUpdate();
|
||||
await CloseThemeCreator({ restoreTheme: false });
|
||||
await closeThemeCreator({ restoreTheme: false });
|
||||
}
|
||||
|
||||
async function submitThemeToCommunity() {
|
||||
@@ -263,7 +301,7 @@
|
||||
await themeManager.setTheme(themeClone.id);
|
||||
await submitLocalThemeToCommunity(themeClone, theme.description?.trim() || undefined);
|
||||
themeUpdates.triggerUpdate();
|
||||
await CloseThemeCreator({ restoreTheme: false });
|
||||
await closeThemeCreator({ restoreTheme: false });
|
||||
} catch (err) {
|
||||
communityError = formatCustomThemeApiError(err);
|
||||
} finally {
|
||||
@@ -277,7 +315,9 @@
|
||||
void themeManager.updatePreviewDebounced(snapshot);
|
||||
});
|
||||
|
||||
type SettingType = 'switch' | 'button' | 'slider' | 'select' | 'codeEditor' | 'imageUpload' | 'conditional' | 'lightDarkToggle';
|
||||
type SettingType = 'switch' | 'button' | 'slider' | 'select' | 'codeEditor' | 'imageUpload' | 'conditional' | 'lightDarkToggle' | 'themeJson';
|
||||
|
||||
type ThemeJsonProps = { value: string; onChange: (value: string) => void; onApply: () => void; error: string | null };
|
||||
|
||||
type SwitchProps = { state: boolean; onChange: (value: boolean) => void };
|
||||
type ButtonProps = { onClick: () => void; text: string };
|
||||
@@ -292,7 +332,7 @@
|
||||
children: SettingItem;
|
||||
};
|
||||
|
||||
type ComponentProps = SwitchProps | ButtonProps | SliderProps | SelectProps | CodeEditorProps | LightDarkToggleProps | ConditionalProps;
|
||||
type ComponentProps = SwitchProps | ButtonProps | SliderProps | SelectProps | CodeEditorProps | LightDarkToggleProps | ConditionalProps | ThemeJsonProps;
|
||||
|
||||
type SettingItem = {
|
||||
type: SettingType;
|
||||
@@ -392,6 +432,25 @@
|
||||
<span class='dark:text-white'>Add image</span>
|
||||
<input type="file" accept='image/*' onchange={onImageUpload} class="absolute inset-0 w-full h-full opacity-0 cursor-pointer" />
|
||||
</div>
|
||||
{:else if item.type === 'themeJson'}
|
||||
{@const jsonProps = item.props as ThemeJsonProps}
|
||||
<textarea
|
||||
value={jsonProps.value}
|
||||
oninput={(e) => jsonProps.onChange(e.currentTarget.value)}
|
||||
placeholder={'{ "name": "My theme", "CustomCSS": "...", "images": [...] }'}
|
||||
spellcheck="false"
|
||||
class="h-40 w-full resize-y rounded-lg border-0 bg-zinc-200 p-2 font-mono text-xs dark:bg-zinc-700 dark:text-white"
|
||||
></textarea>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-2 w-full rounded-lg bg-zinc-900 px-3 py-2 text-sm font-medium text-white transition hover:bg-zinc-700 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white"
|
||||
onclick={jsonProps.onApply}
|
||||
>
|
||||
Load into builder
|
||||
</button>
|
||||
{#if jsonProps.error}
|
||||
<p class="mt-2 text-sm text-red-600 dark:text-red-400">{jsonProps.error}</p>
|
||||
{/if}
|
||||
{:else if item.type === 'lightDarkToggle'}
|
||||
<button
|
||||
class="overflow-hidden relative flex justify-center items-center px-4 py-1 text-xl font-medium rounded-lg transition bg-zinc-200 dark:bg-zinc-700 hover:bg-zinc-300 dark:hover:bg-zinc-600"
|
||||
@@ -443,7 +502,7 @@
|
||||
type="button"
|
||||
class="rounded-lg p-2 text-zinc-500 transition hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
||||
aria-label="Close theme creator"
|
||||
onclick={() => void CloseThemeCreator()}
|
||||
onclick={() => void closeThemeCreator()}
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
@@ -666,6 +725,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'themeJson',
|
||||
title: 'Advanced',
|
||||
description: 'Paste a theme.json to load into the builder (images as base64 in images[])',
|
||||
direction: 'vertical',
|
||||
props: {
|
||||
value: themeJsonDraft,
|
||||
onChange: (value: string) => (themeJsonDraft = value),
|
||||
onApply: applyImportedThemeJson,
|
||||
error: themeJsonError,
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'codeEditor',
|
||||
title: 'Custom CSS',
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,19 @@
|
||||
import { parseThemeBuilderJson } from "./parseThemeBuilderJson";
|
||||
|
||||
describe("parseThemeBuilderJson", () => {
|
||||
it("parses minimal theme.json", () => {
|
||||
const theme = parseThemeBuilderJson(
|
||||
JSON.stringify({
|
||||
name: "Test",
|
||||
CustomCSS: "body { color: red; }",
|
||||
}),
|
||||
);
|
||||
expect(theme.name).toBe("Test");
|
||||
expect(theme.CustomCSS).toContain("red");
|
||||
expect(theme.CustomImages).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("rejects invalid JSON", () => {
|
||||
expect(() => parseThemeBuilderJson("{")).toThrow("Invalid JSON");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,87 @@
|
||||
import { base64ToBlob, stripBase64Prefix } from "@/seqta/utils/base64";
|
||||
import type { LoadedCustomTheme, ThemeCreatorMeta } from "@/types/customThemes";
|
||||
|
||||
function parseImageBlobs(data: Record<string, unknown>): LoadedCustomTheme["CustomImages"] {
|
||||
const raw = Array.isArray(data.images)
|
||||
? data.images
|
||||
: Array.isArray(data.CustomImages)
|
||||
? data.CustomImages
|
||||
: [];
|
||||
const images: LoadedCustomTheme["CustomImages"] = [];
|
||||
for (const entry of raw) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
const row = entry as Record<string, unknown>;
|
||||
let blob: Blob | null = null;
|
||||
if (row.blob instanceof Blob) {
|
||||
blob = row.blob;
|
||||
} else if (typeof row.data === "string" && row.data) {
|
||||
try {
|
||||
blob = base64ToBlob(stripBase64Prefix(row.data));
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!blob) continue;
|
||||
images.push({
|
||||
id: typeof row.id === "string" && row.id ? row.id : crypto.randomUUID(),
|
||||
variableName:
|
||||
typeof row.variableName === "string" && row.variableName
|
||||
? row.variableName
|
||||
: `custom-image-${images.length}`,
|
||||
blob,
|
||||
});
|
||||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
/** Parse pasted theme.json (export or upload format) into builder state. */
|
||||
export function parseThemeBuilderJson(text: string): LoadedCustomTheme {
|
||||
const trimmed = text.trim();
|
||||
if (!trimmed) throw new Error("Paste theme JSON first");
|
||||
|
||||
let data: Record<string, unknown>;
|
||||
try {
|
||||
data = JSON.parse(trimmed) as Record<string, unknown>;
|
||||
} catch {
|
||||
throw new Error("Invalid JSON");
|
||||
}
|
||||
|
||||
const name = typeof data.name === "string" ? data.name.trim() : "";
|
||||
if (!name) throw new Error('Theme JSON must include "name"');
|
||||
|
||||
const CustomImages = parseImageBlobs(data);
|
||||
let coverImage: Blob | null = null;
|
||||
if (typeof data.coverImage === "string" && data.coverImage) {
|
||||
try {
|
||||
coverImage = base64ToBlob(stripBase64Prefix(data.coverImage));
|
||||
} catch {
|
||||
coverImage = null;
|
||||
}
|
||||
}
|
||||
|
||||
const creatorMeta =
|
||||
data.creatorMeta && typeof data.creatorMeta === "object"
|
||||
? (data.creatorMeta as ThemeCreatorMeta)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
id: typeof data.id === "string" && data.id.trim() ? data.id.trim() : crypto.randomUUID(),
|
||||
name,
|
||||
description: typeof data.description === "string" ? data.description : "",
|
||||
defaultColour:
|
||||
typeof data.defaultColour === "string" ? data.defaultColour : "rgba(0, 123, 255, 1)",
|
||||
CanChangeColour: data.CanChangeColour !== false,
|
||||
allowBackgrounds: data.allowBackgrounds !== false,
|
||||
CustomCSS: typeof data.CustomCSS === "string" ? data.CustomCSS : "",
|
||||
CustomImages,
|
||||
coverImage,
|
||||
isEditable: true,
|
||||
hideThemeName: data.hideThemeName === true,
|
||||
forceTheme: typeof data.forceTheme === "boolean" ? data.forceTheme : undefined,
|
||||
forceDark: typeof data.forceDark === "boolean" ? data.forceDark : undefined,
|
||||
adaptiveCssVariables: Array.isArray(data.adaptiveCssVariables)
|
||||
? (data.adaptiveCssVariables as string[])
|
||||
: [],
|
||||
creatorMeta,
|
||||
};
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
|
||||
const THEME_CSS_VARS = [
|
||||
"--better-main",
|
||||
"--better-pale",
|
||||
"--better-light",
|
||||
"--text-color",
|
||||
"--background-primary",
|
||||
"--background-secondary",
|
||||
"--theme-primary",
|
||||
"--theme-secondary",
|
||||
"--text-primary",
|
||||
"--theme-offset-bg",
|
||||
"--better-sub",
|
||||
] as const;
|
||||
|
||||
const ACCENT_CSS_VARS = [
|
||||
"--better-main",
|
||||
"--accent-color-value",
|
||||
"--accentColor",
|
||||
"--colour-betterseqta-blue",
|
||||
] as const;
|
||||
|
||||
function extractSolidColor(value: string): string | null {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed || trimmed === "initial") return null;
|
||||
if (trimmed.startsWith("#") || trimmed.startsWith("rgb") || trimmed.startsWith("hsl")) {
|
||||
return trimmed;
|
||||
}
|
||||
if (trimmed.includes("gradient")) {
|
||||
const match = trimmed.match(/#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{3}|rgba?\([^)]+\)/i);
|
||||
return match?.[0] ?? null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function resolvePageAccentColor(): string {
|
||||
const computed = getComputedStyle(document.documentElement);
|
||||
for (const name of ACCENT_CSS_VARS) {
|
||||
const solid = extractSolidColor(computed.getPropertyValue(name));
|
||||
if (solid) return solid;
|
||||
}
|
||||
const fromSettings = settingsState.selectedColor?.trim();
|
||||
if (fromSettings) {
|
||||
const solid = extractSolidColor(fromSettings);
|
||||
if (solid) return solid;
|
||||
}
|
||||
return "#007bff";
|
||||
}
|
||||
|
||||
/** Copy SEQTA page theme tokens onto a portaled UI root (matches analytics sync). */
|
||||
export function syncPageThemeToElement(target: HTMLElement): void {
|
||||
const computed = getComputedStyle(document.documentElement);
|
||||
|
||||
for (const name of THEME_CSS_VARS) {
|
||||
const value = computed.getPropertyValue(name).trim();
|
||||
if (value) {
|
||||
target.style.setProperty(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
const accent = resolvePageAccentColor();
|
||||
target.style.setProperty("--bsplus-analytics-accent", accent);
|
||||
target.style.setProperty("--better-main", accent);
|
||||
|
||||
target.classList.toggle("dark", document.documentElement.classList.contains("dark"));
|
||||
}
|
||||
@@ -42,4 +42,16 @@ describe("themeBuilderDraft", () => {
|
||||
"Theme name is required",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not wrap gradient accent colours in color-mix (invalid CSS)", () => {
|
||||
const gradient =
|
||||
"linear-gradient(90deg, rgb(128, 44, 44) 0%, rgba(188, 63, 23, 1) 35%, rgba(249, 74, 74, 1) 100%)";
|
||||
const css = buildThemeBuilderCss(getFontPreset("rubik"), ["custom-image-0"], {
|
||||
accentColor: gradient,
|
||||
overlayOpacity: 0.35,
|
||||
backgroundBlurPx: 0,
|
||||
});
|
||||
expect(css).not.toMatch(/color-mix\(in srgb, linear-gradient/);
|
||||
expect(css).toContain("var(--custom-image-0)");
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DEFAULT_FONT_ID, getFontPreset, type FontPreset } from "@/seqta/ui/fonts/presets";
|
||||
import type { LoadedCustomTheme } from "@/types/CustomThemes";
|
||||
import type { LoadedCustomTheme } from "@/types/customThemes";
|
||||
|
||||
export type ThemeBuilderDraft = {
|
||||
name: string;
|
||||
@@ -24,6 +24,20 @@ function clamp(n: number, min: number, max: number): number {
|
||||
return Math.min(max, Math.max(min, n));
|
||||
}
|
||||
|
||||
/** Accent colours from the picker may be full `linear-gradient(...)` values — invalid inside `color-mix()`. */
|
||||
function isCssGradient(value: string): boolean {
|
||||
return /gradient\s*\(/i.test(value.trim());
|
||||
}
|
||||
|
||||
function buildOverlayGradientLayer(
|
||||
accentColor: string,
|
||||
endColor: string,
|
||||
angle: number,
|
||||
overlay: number,
|
||||
): string {
|
||||
return `linear-gradient(${angle}deg, color-mix(in srgb, ${accentColor} ${Math.round(overlay * 100)}%, transparent), color-mix(in srgb, ${endColor} ${Math.round(overlay * 100)}%, transparent))`;
|
||||
}
|
||||
|
||||
export function buildThemeBuilderCss(
|
||||
font: FontPreset,
|
||||
imageVariables: string[],
|
||||
@@ -41,7 +55,11 @@ export function buildThemeBuilderCss(
|
||||
const angle = draft.gradientAngle ?? 135;
|
||||
const overlay = clamp(draft.overlayOpacity ?? 0.35, 0, 0.85);
|
||||
const blurPx = clamp(draft.backgroundBlurPx ?? 0, 0, 24);
|
||||
const accentColor = draft.accentColor.trim();
|
||||
const endColor = (draft.gradientEnd ?? draft.accentColor).trim();
|
||||
const accentIsGradient = isCssGradient(accentColor);
|
||||
const endIsGradient = isCssGradient(endColor);
|
||||
const canUseColorMixOverlay = !accentIsGradient && !endIsGradient;
|
||||
|
||||
const rules: string[] = [
|
||||
`${importLine}body, #container, .dashboard {
|
||||
@@ -51,7 +69,9 @@ export function buildThemeBuilderCss(
|
||||
|
||||
const imageLayer =
|
||||
imageVariables.length > 0 ? imageVariables.map((name) => `var(--${name})`).join(", ") : "";
|
||||
const gradientLayer = `linear-gradient(${angle}deg, color-mix(in srgb, ${draft.accentColor} ${Math.round(overlay * 100)}%, transparent), color-mix(in srgb, ${endColor} ${Math.round(overlay * 100)}%, transparent))`;
|
||||
const gradientLayer = canUseColorMixOverlay
|
||||
? buildOverlayGradientLayer(accentColor, endColor, angle, overlay)
|
||||
: "";
|
||||
|
||||
rules.push(`#container {
|
||||
isolation: isolate;
|
||||
@@ -72,21 +92,25 @@ export function buildThemeBuilderCss(
|
||||
filter: blur(${blurPx}px);
|
||||
transform: scale(1.04);
|
||||
}`);
|
||||
const blurBgLayers = gradientLayer ? [gradientLayer] : [];
|
||||
rules.push(`#container {
|
||||
background-image: ${gradientLayer} !important;
|
||||
background-image: ${blurBgLayers.join(", ") || "none"} !important;
|
||||
background-size: cover !important;
|
||||
background-position: center !important;
|
||||
background-attachment: fixed !important;
|
||||
}`);
|
||||
} else {
|
||||
const bgLayers: string[] = [gradientLayer];
|
||||
const bgLayers: string[] = [];
|
||||
if (gradientLayer) bgLayers.push(gradientLayer);
|
||||
if (imageLayer) bgLayers.push(imageLayer);
|
||||
rules.push(`#container {
|
||||
if (bgLayers.length > 0) {
|
||||
rules.push(`#container {
|
||||
background-image: ${bgLayers.join(", ")} !important;
|
||||
background-size: cover !important;
|
||||
background-position: center !important;
|
||||
background-attachment: fixed !important;
|
||||
}`);
|
||||
}
|
||||
}
|
||||
|
||||
rules.push(`#container::before {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { buildThemeBuilderCss } from "@/interface/utils/themeBuilderDraft";
|
||||
import { applySelectedFont } from "@/seqta/ui/fonts/Manager";
|
||||
import { applySelectedFont } from "@/seqta/ui/fonts/fontManager";
|
||||
import { DEFAULT_FONT_ID, getFontPreset } from "@/seqta/ui/fonts/presets";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import type { LoadedCustomTheme, ThemeCreatorMeta } from "@/types/CustomThemes";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import type { LoadedCustomTheme, ThemeCreatorMeta } from "@/types/customThemes";
|
||||
|
||||
export type ThemeCreatorSidebarMeta = {
|
||||
sidebarStyle?: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { LoadedCustomTheme } from "@/types/CustomThemes";
|
||||
import type { LoadedCustomTheme } from "@/types/customThemes";
|
||||
|
||||
export function handleImageUpload(event: Event, theme: LoadedCustomTheme): LoadedCustomTheme {
|
||||
const input = event.target as HTMLInputElement;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CustomTheme } from "@/types/CustomThemes";
|
||||
import type { Theme } from "@/interface/types/Theme";
|
||||
import type { CustomTheme } from "@/types/customThemes";
|
||||
import type { Theme } from "@/interface/types/theme";
|
||||
import {
|
||||
getThemeApplyButtonStyles,
|
||||
getCommunityInstalledThemeIds,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CustomTheme } from "@/types/CustomThemes";
|
||||
import type { Theme } from "@/interface/types/Theme";
|
||||
import type { CustomTheme } from "@/types/customThemes";
|
||||
import type { Theme } from "@/interface/types/theme";
|
||||
import { parseCssColor } from "@/seqta/ui/colors/parseCssColor";
|
||||
|
||||
const DEFAULT_THEME_ACCENT = "rgba(0, 123, 255, 1)";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { LoadedCustomTheme } from "@/types/CustomThemes";
|
||||
import type { LoadedCustomTheme } from "@/types/customThemes";
|
||||
|
||||
/** SVG cover used when a theme has no store/community cover image. */
|
||||
export function createDefaultThemeCoverSvg(accentHint = "#52525b"): string {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Theme, ThemeCoverSlide, ThemeFlavour } from "@/interface/types/Theme";
|
||||
import type { Theme, ThemeCoverSlide, ThemeFlavour } from "@/interface/types/theme";
|
||||
|
||||
export function isHiddenStoreTheme(theme: Theme): boolean {
|
||||
return theme.theme_role === "slave";
|
||||
|
||||
@@ -3,14 +3,14 @@ import { resolveExtensionAssetUrl } from "./extensionAssetUrl";
|
||||
|
||||
describe("resolveExtensionAssetUrl", () => {
|
||||
it("returns already-resolved extension URLs unchanged", () => {
|
||||
const url = "chrome-extension://abc/assets/IconFamily-B8lopphU.woff";
|
||||
const url = "chrome-extension://abc/assets/icon-48-B8lopphU.png";
|
||||
expect(resolveExtensionAssetUrl(url)).toBe(url);
|
||||
});
|
||||
|
||||
it("repairs accidental double extension URL prefix", () => {
|
||||
const doubled = "chrome-extension://abc/chrome-extension://abc/assets/IconFamily-B8lopphU.woff";
|
||||
const doubled = "chrome-extension://abc/chrome-extension://abc/assets/icon-48-B8lopphU.png";
|
||||
expect(resolveExtensionAssetUrl(doubled)).toBe(
|
||||
"chrome-extension://abc/assets/IconFamily-B8lopphU.woff",
|
||||
"chrome-extension://abc/assets/icon-48-B8lopphU.png",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,7 @@
|
||||
getThermoscorePercent,
|
||||
readStoredList,
|
||||
} from "./utils";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { buildEngageAssessmentPagePath } from "@/seqta/utils/engageAssessmentStudent";
|
||||
import OverviewIcon from "./OverviewIcon.svelte";
|
||||
|
||||
@@ -12,7 +12,7 @@ interface PrefItem {
|
||||
}
|
||||
|
||||
import { getUserInfo } from "@/seqta/utils/userInfo";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { getMockAssessmentsData } from "@/seqta/ui/dev/hideSensitiveContent";
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { getEngageAssessmentsData } from "./engageApi";
|
||||
|
||||
@@ -45,6 +45,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.bsplus-overview-static,
|
||||
.bsplus-overview-static * {
|
||||
animation: none !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
.bsplus-overview-delay-1 {
|
||||
animation-delay: 80ms;
|
||||
}
|
||||
@@ -150,10 +156,9 @@
|
||||
color: var(--bsplus-overview-text);
|
||||
}
|
||||
|
||||
.filter-select:focus {
|
||||
outline: none;
|
||||
border-color: var(--bsplus-overview-accent);
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--bsplus-overview-accent) 22%, transparent);
|
||||
.filter-select:focus-visible {
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.filter-select:hover {
|
||||
@@ -365,7 +370,8 @@
|
||||
}
|
||||
|
||||
.menu-button:focus-visible {
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--bsplus-overview-accent) 35%, transparent) !important;
|
||||
outline: var(--bsplus-focus-ring) !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.menu-dropdown {
|
||||
|
||||
Loaded 100 of 296 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user