revert: restore IconFamily and pre-Lucide icons

Remove @lucide/svelte and lucide-static in favor of MenuItemSVGKey, IconFamily.woff, Heroicons overview paths, and inline SVGs used on upstream main.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
AdenMGBandCursor committed 2026-11-04 12:33:31 +10:30
1 parent 5bbe1c6a32
commit f935d0ad9d
74 files changed
+2107 -2592

No files matched your search

-17
View File
@@ -18,7 +18,6 @@
"@codemirror/state": "^6.7.6", "@codemirror/state": "^6.7.6",
"@codemirror/view": "^6.43.15", "@codemirror/view": "^6.43.15",
"@huggingface/transformers": "^3.8.1", "@huggingface/transformers": "^3.8.1",
"@lucide/svelte": "^1.66.0",
"@uiw/codemirror-extensions-color": "^4.25.12", "@uiw/codemirror-extensions-color": "^4.25.12",
"@uiw/codemirror-theme-github": "^4.25.12", "@uiw/codemirror-theme-github": "^4.25.12",
"canvas-confetti": "^1.9.4", "canvas-confetti": "^1.9.4",
@@ -32,7 +31,6 @@
"fuse.js": "^7.5.0", "fuse.js": "^7.5.0",
"layerchart": "^2.9.2", "layerchart": "^2.9.2",
"localforage": "^1.10.0", "localforage": "^1.10.0",
"lucide-static": "^1.66.0",
"mathjs": "^15.2.0", "mathjs": "^15.2.0",
"motion": "^14.9.0", "motion": "^14.9.0",
"pdfjs-dist": "^6.5.438", "pdfjs-dist": "^6.5.438",
@@ -2465,15 +2463,6 @@
"@lezer/common": "^1.0.0" "@lezer/common": "^1.0.0"
} }
}, },
"node_modules/@lucide/svelte": {
"version": "1.67.0",
"resolved": "https://registry.npmjs.org/@lucide/svelte/-/svelte-1.67.0.tgz",
"integrity": "sha512-DeqoOkMm3QihcNsrQB5drR/8azWDGuozfagDpm/anIqaJdflLUMhwLFPEANl/W3FLhXx6HmQwEWz7zBtZ6KXcQ==",
"license": "ISC",
"peerDependencies": {
"svelte": "^5"
}
},
"node_modules/@marijn/find-cluster-break": { "node_modules/@marijn/find-cluster-break": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.4.tgz",
@@ -8567,12 +8556,6 @@
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/lucide-static": {
"version": "1.67.0",
"resolved": "https://registry.npmjs.org/lucide-static/-/lucide-static-1.67.0.tgz",
"integrity": "sha512-Lu/Ntwfw1GOQiNgTC2iHd/PC4QbqzwktLVFHTB84tldlfUjFgQ+EBWiZc/UPrlNdX97O/KXWRn792hIdQh6nhA==",
"license": "ISC"
},
"node_modules/lz-string": { "node_modules/lz-string": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
-2
View File
@@ -44,7 +44,6 @@
"@codemirror/state": "^6.7.6", "@codemirror/state": "^6.7.6",
"@codemirror/view": "^6.43.15", "@codemirror/view": "^6.43.15",
"@huggingface/transformers": "^3.8.1", "@huggingface/transformers": "^3.8.1",
"@lucide/svelte": "^1.66.0",
"@uiw/codemirror-extensions-color": "^4.25.12", "@uiw/codemirror-extensions-color": "^4.25.12",
"@uiw/codemirror-theme-github": "^4.25.12", "@uiw/codemirror-theme-github": "^4.25.12",
"canvas-confetti": "^1.9.4", "canvas-confetti": "^1.9.4",
@@ -58,7 +57,6 @@
"fuse.js": "^7.5.0", "fuse.js": "^7.5.0",
"layerchart": "^2.9.2", "layerchart": "^2.9.2",
"localforage": "^1.10.0", "localforage": "^1.10.0",
"lucide-static": "^1.66.0",
"mathjs": "^15.2.0", "mathjs": "^15.2.0",
"motion": "^14.9.0", "motion": "^14.9.0",
"pdfjs-dist": "^6.5.438", "pdfjs-dist": "^6.5.438",
+8
View File
@@ -26,6 +26,14 @@
font-display: swap; font-display: swap;
} }
@font-face {
font-family: "IconFamily";
src: url("@/resources/fonts/IconFamily.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: block;
}
@layer base, override; @layer base, override;
@layer override { @layer override {
+32 -23
View File
@@ -31,13 +31,10 @@
pointer-events: none; pointer-events: none;
} }
@mixin lucide-icon($name, $size) { button.timetable-zoom.iconFamily,
content: ""; button.bsplus-timetable-control.iconFamily,
display: inline-block; .iconFamily {
width: $size; font-family: "IconFamily" !important;
height: $size;
background: currentColor;
mask: url("lucide-static/icons/#{$name}.svg") center / contain no-repeat;
} }
.hidden { .hidden {
@@ -1236,12 +1233,15 @@ td.colourBar {
padding-left: 30px; padding-left: 30px;
} }
#toolbar span:has(.search)::before { #toolbar span:has(.search)::before {
@include lucide-icon("search", 16px); content: "\eca5";
position: absolute; position: absolute;
left: 8px; left: 8px;
z-index: 10; z-index: 10;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
color: currentColor;
font-size: 16px;
font-family: "IconFamily";
pointer-events: none; pointer-events: none;
} }
#container #content .search { #container #content .search {
@@ -2033,15 +2033,6 @@ html.transparencyEffects [class*="BasicPanel__BasicPanel___q92_U"] > ol > li + l
z-index: 21 !important; z-index: 21 !important;
color: var(--better-sub); color: var(--better-sub);
padding: 8px; padding: 8px;
> svg {
display: none;
}
&::before {
@include lucide-icon(bell, 24px);
background: var(--theme-primary);
}
} }
.legacy-root button > svg, .legacy-root button > svg,
.legacy-root a > svg { .legacy-root a > svg {
@@ -3353,23 +3344,35 @@ body:not(.clr-open) .clr-picker,
align-items: center; align-items: center;
} }
[data-label="inbox"] > [class*="LabelList__name___"]::before { [data-label="inbox"] > [class*="LabelList__name___"]::before {
@include lucide-icon("inbox", 16px); content: "\eb70";
color: currentColor;
font-size: 16px;
margin-right: 8px; margin-right: 8px;
font-family: "IconFamily";
pointer-events: none; pointer-events: none;
} }
[data-label="outbox"] > [class*="LabelList__name___"]::before { [data-label="outbox"] > [class*="LabelList__name___"]::before {
@include lucide-icon("send", 16px); content: "\eca6";
color: currentColor;
font-size: 16px;
margin-right: 8px; margin-right: 8px;
font-family: "IconFamily";
pointer-events: none; pointer-events: none;
} }
[data-label="starred"] > [class*="LabelList__name___"]::before { [data-label="starred"] > [class*="LabelList__name___"]::before {
@include lucide-icon("star", 16px); content: "\ece8";
color: currentColor;
font-size: 16px;
margin-right: 8px; margin-right: 8px;
font-family: "IconFamily";
pointer-events: none; pointer-events: none;
} }
[data-label="trash"] > [class*="LabelList__name___"]::before { [data-label="trash"] > [class*="LabelList__name___"]::before {
@include lucide-icon("trash", 16px); content: "\ed2c";
color: currentColor;
font-size: 16px;
margin-right: 8px; margin-right: 8px;
font-family: "IconFamily";
pointer-events: none; pointer-events: none;
} }
.outer-circle { .outer-circle {
@@ -4513,7 +4516,10 @@ div.day-empty {
cursor: pointer; cursor: pointer;
} }
#whatsnewclosebutton::before { #whatsnewclosebutton::before {
@include lucide-icon("x", 24px); content: "\ed8a";
color: currentColor;
font-size: 24px;
font-family: "IconFamily";
pointer-events: none; pointer-events: none;
} }
.whatsnewTextContainer h1:not(.whatsnewTextHeader) { .whatsnewTextContainer h1:not(.whatsnewTextHeader) {
@@ -5699,7 +5705,10 @@ h2.home-subtitle {
} }
.bsplus-ld-surprise-close::before { .bsplus-ld-surprise-close::before {
@include lucide-icon("x", 20px); content: "\ed8a";
font-family: "IconFamily";
font-size: 20px;
line-height: 1;
pointer-events: none; pointer-events: none;
} }
+2
View File
@@ -29,6 +29,8 @@
--animate-spin-fast: spin 0.4s linear infinite; --animate-spin-fast: spin 0.4s linear infinite;
--aspect-theme: 5 / 1; --aspect-theme: 5 / 1;
--font-IconFamily: IconFamily;
} }
@layer base { @layer base {
+3 -5
View File
@@ -1,19 +1,17 @@
<script lang="ts"> <script lang="ts">
import type { Component } from "svelte";
let { let {
onClick, onClick,
text, text,
disabled = false, disabled = false,
variant = "secondary", variant = "secondary",
icon: Icon, icon,
class: className = "", class: className = "",
}: { }: {
onClick: () => void; onClick: () => void;
text: string; text: string;
disabled?: boolean; disabled?: boolean;
variant?: "primary" | "secondary" | "ghost"; variant?: "primary" | "secondary" | "ghost";
icon?: Component<{ class?: string; size?: string | number }>; icon?: string;
class?: string; class?: string;
} = $props(); } = $props();
@@ -34,6 +32,6 @@
variant variant
]} {className}" ]} {className}"
> >
{#if Icon}<Icon size="1em" class="text-base" />{/if} {#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
{text} {text}
</button> </button>
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import XIcon from "@lucide/svelte/icons/x";
import { fade } from "svelte/transition"; import { fade } from "svelte/transition";
import browser from "@/lib/browser"; import browser from "@/lib/browser";
import QRCode from "qrcode"; import QRCode from "qrcode";
@@ -80,7 +79,7 @@
qrDataUrl = dataUrl; qrDataUrl = dataUrl;
showQrModal = true; showQrModal = true;
} catch (err) { } catch (err) {
console.error("[BetterSEQTA+] ConnectMobileApp: Failed to generate QR:", err); console.error("[ConnectMobileApp] Failed to generate QR:", err);
errorMessage = "Failed to generate QR code. Please try again."; errorMessage = "Failed to generate QR code. Please try again.";
} finally { } finally {
isLoading = false; isLoading = false;
@@ -108,11 +107,7 @@
</script> </script>
<div class="flex flex-col gap-1 items-end"> <div class="flex flex-col gap-1 items-end">
<Button <Button onClick={generateQrCode} disabled={isLoading} text={isLoading ? "Generating..." : "Generate QR"} />
onClick={generateQrCode}
disabled={isLoading}
text={isLoading ? "Generating..." : "Generate QR"}
/>
{#if errorMessage} {#if errorMessage}
<p class="text-xs text-right text-amber-600 dark:text-amber-400">{errorMessage}</p> <p class="text-xs text-right text-amber-600 dark:text-amber-400">{errorMessage}</p>
{/if} {/if}
@@ -121,9 +116,7 @@
{#if showQrModal && qrDataUrl} {#if showQrModal && qrDataUrl}
<div <div
use:portal use:portal
class="fixed cursor-auto inset-0 z-10000 flex justify-center items-center bg-black/50 {isStandalone class="fixed cursor-auto inset-0 z-10000 flex justify-center items-center bg-black/50 {isStandalone ? 'backdrop-blur-xs' : ''} {$settingsState.DarkMode ? 'dark' : ''}"
? 'backdrop-blur-xs'
: ''} {$settingsState.DarkMode ? 'dark' : ''}"
role="button" role="button"
tabindex="-1" tabindex="-1"
onclick={(e) => { onclick={(e) => {
@@ -132,23 +125,22 @@
onkeydown={(e) => { onkeydown={(e) => {
if (e.key === "Escape") closeModal(); if (e.key === "Escape") closeModal();
}} }}
transition:fade={{ duration: 150 }} transition:fade={{ duration: 150 }}>
>
<!-- svelte-ignore a11y_no_static_element_interactions --> <!-- svelte-ignore a11y_no_static_element_interactions -->
<div <div
class="p-6 mx-4 w-full max-w-sm bg-white rounded-2xl shadow-2xl dark:bg-zinc-800" class="p-6 mx-4 w-full max-w-sm bg-white rounded-2xl shadow-2xl dark:bg-zinc-800"
onclick={(e) => e.stopPropagation()} onclick={(e) => e.stopPropagation()}
onkeydown={(e) => e.stopPropagation()} onkeydown={(e) => e.stopPropagation()}>
>
<div class="flex justify-between items-center mb-4"> <div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-bold text-zinc-900 dark:text-white">Scan with DesQTA</h2> <h2 class="text-lg font-bold text-zinc-900 dark:text-white">Scan with DesQTA</h2>
<button <button
type="button" type="button"
onclick={closeModal} onclick={closeModal}
class="p-2 rounded-lg transition-colors text-zinc-500 hover:text-zinc-700 hover:bg-zinc-100 dark:hover:text-zinc-400 dark:hover:bg-zinc-700" class="p-2 rounded-lg transition-colors text-zinc-500 hover:text-zinc-700 hover:bg-zinc-100 dark:hover:text-zinc-400 dark:hover:bg-zinc-700"
aria-label="Close" aria-label="Close">
> <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<XIcon class="w-5 h-5" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button> </button>
</div> </div>
<div class="flex justify-center p-4 bg-white rounded-xl dark:bg-zinc-900"> <div class="flex justify-center p-4 bg-white rounded-xl dark:bg-zinc-900">
@@ -158,15 +150,13 @@
<button <button
type="button" type="button"
onclick={openAppLink} onclick={openAppLink}
class="px-4 py-2.5 w-full text-sm font-medium text-white bg-indigo-600 rounded-lg transition-colors dark:bg-indigo-500 hover:bg-indigo-700 dark:hover:bg-indigo-600" class="px-4 py-2.5 w-full text-sm font-medium text-white bg-indigo-600 rounded-lg transition-colors dark:bg-indigo-500 hover:bg-indigo-700 dark:hover:bg-indigo-600">
>
Sign into DesQTA Desktop Sign into DesQTA Desktop
</button> </button>
<button <button
type="button" type="button"
onclick={downloadQrImage} onclick={downloadQrImage}
class="px-4 py-2 w-full text-xs font-medium rounded-lg border transition-colors text-zinc-500 dark:text-zinc-400 border-zinc-200 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800/50" class="px-4 py-2 w-full text-xs font-medium rounded-lg border transition-colors text-zinc-500 dark:text-zinc-400 border-zinc-200 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800/50">
>
Download QR as image Download QR as image
</button> </button>
</div> </div>
@@ -1,9 +1,5 @@
<script lang="ts"> <script lang="ts">
import XIcon from "@lucide/svelte/icons/x"; let { onclick, label = "Close" }: {
let {
onclick,
label = "Close",
}: {
onclick: () => void; onclick: () => void;
label?: string; label?: string;
} = $props(); } = $props();
@@ -12,8 +8,18 @@
<button <button
type="button" type="button"
{onclick} {onclick}
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-400 dark:hover:text-white" class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden dark:text-zinc-400 dark:hover:text-white"
aria-label={label} aria-label={label}
> >
<XIcon class="h-6 w-6" /> <svg
class="h-6 w-6"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
aria-hidden="true"
>
<path d="M6 6l12 12M18 6 6 18" />
</svg>
</button> </button>
+26 -13
View File
@@ -1,13 +1,8 @@
<script lang="ts"> <script lang="ts">
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down"; let { value, onChange, options }: {
let { value: string,
value, onChange: (newValue: string) => void,
onChange, options: Array<{ value: string, label: string }>
options,
}: {
value: string;
onChange: (newValue: string) => void;
options: Array<{ value: string; label: string }>;
} = $props(); } = $props();
const listboxId = $props.id(); const listboxId = $props.id();
@@ -108,7 +103,13 @@
{options.find((option) => option.value === value)?.label ?? value} {options.find((option) => option.value === value)?.label ?? value}
</span> </span>
<span class="select-icon shrink-0" aria-hidden="true"> <span class="select-icon shrink-0" aria-hidden="true">
<ChevronDownIcon class="h-4 w-4" /> <svg viewBox="0 0 20 20" fill="currentColor" class="h-4 w-4">
<path
fill-rule="evenodd"
d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z"
clip-rule="evenodd"
/>
</svg>
</span> </span>
</button> </button>
@@ -146,8 +147,11 @@
--sel-border: var(--theme-offset-bg, var(--theme-secondary, #e5e7eb)); --sel-border: var(--theme-offset-bg, var(--theme-secondary, #e5e7eb));
--sel-bg: var(--theme-primary, #ffffff); --sel-bg: var(--theme-primary, #ffffff);
--sel-surface: var(--theme-secondary, #e5e7eb); --sel-surface: var(--theme-secondary, #e5e7eb);
--sel-focus-border: color-mix(in srgb, var(--text-primary) 22%, var(--theme-secondary, #e5e7eb) 78%);
--sel-menu-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.25), 0 8px 10px -6px rgb(0 0 0 / 0.2); --sel-ring: 0 0 0 1px color-mix(in srgb, var(--text-primary) 12%, transparent);
--sel-menu-shadow:
0 10px 25px -5px rgb(0 0 0 / 0.25),
0 8px 10px -6px rgb(0 0 0 / 0.2);
} }
.select-trigger { .select-trigger {
@@ -156,8 +160,16 @@
color: var(--text-primary); color: var(--text-primary);
} }
.select-trigger:hover { .select-trigger:hover,
.select-trigger:focus-visible {
outline: none;
background: var(--sel-surface); background: var(--sel-surface);
border-color: var(--sel-border);
}
.select-trigger:focus-visible {
border-color: var(--sel-focus-border);
box-shadow: var(--sel-ring);
} }
.select-icon { .select-icon {
@@ -173,6 +185,7 @@
.select-menu:focus-visible { .select-menu:focus-visible {
outline: none; outline: none;
box-shadow: var(--sel-menu-shadow), var(--sel-ring);
} }
.select-option { .select-option {
@@ -1,7 +1,4 @@
<script lang="ts"> <script lang="ts">
import PipetteIcon from "@lucide/svelte/icons/pipette";
import PlusIcon from "@lucide/svelte/icons/plus";
import Trash2Icon from "@lucide/svelte/icons/trash-2";
import { untrack } from "svelte"; import { untrack } from "svelte";
import { slide } from "svelte/transition"; import { slide } from "svelte/transition";
import { import {
@@ -324,7 +321,7 @@
title="Add colour stop" title="Add colour stop"
onclick={() => addStop(50)} onclick={() => addStop(50)}
> >
<PlusIcon class="size-4" /> <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> </button>
{#if model.kind === "linear"} {#if model.kind === "linear"}
<label <label
@@ -351,7 +348,9 @@
disabled={stops.length <= 2} disabled={stops.length <= 2}
onclick={() => removeStop(selected)} onclick={() => removeStop(selected)}
> >
<Trash2Icon class="size-4" /> <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> </button>
</div> </div>
{/if} {/if}
@@ -389,7 +388,9 @@
aria-label="Pick a colour from the screen" aria-label="Pick a colour from the screen"
onclick={pickFromScreen} onclick={pickFromScreen}
> >
<PipetteIcon class="size-4" /> <svg viewBox="0 0 24 24" class="size-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m2 22 1-1h3l9-9M3 21v-3l9-9m3-3 3.5-3.5a2.1 2.1 0 0 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" />
</svg>
</button> </button>
{/if} {/if}
<div class="flex flex-col flex-1 gap-3"> <div class="flex flex-col flex-1 gap-3">
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import XIcon from "@lucide/svelte/icons/x";
import SkeletonLoader from "@/interface/components/SkeletonLoader.svelte"; import SkeletonLoader from "@/interface/components/SkeletonLoader.svelte";
import ModalFrame from "./ModalFrame.svelte"; import ModalFrame from "./ModalFrame.svelte";
import type { CommunityThemesState } from "@/interface/hooks/communityThemesState.svelte"; import type { CommunityThemesState } from "@/interface/hooks/communityThemesState.svelte";
@@ -26,9 +25,7 @@
<div> <div>
<h2 class="text-2xl font-bold">{theme.name}</h2> <h2 class="text-2xl font-bold">{theme.name}</h2>
<span <span
class="mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-semibold {statusBadgeClass( class="mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-semibold {statusBadgeClass(theme.status)}"
theme.status,
)}"
> >
{formatCustomThemeStatus(theme.status)} {formatCustomThemeStatus(theme.status)}
</span> </span>
@@ -39,7 +36,7 @@
aria-label="Close" aria-label="Close"
onclick={() => communityState.closeDetail()} onclick={() => communityState.closeDetail()}
> >
<XIcon size="1em" /> ✕
</button> </button>
</div> </div>
@@ -125,8 +122,7 @@
accept=".zip,application/zip" accept=".zip,application/zip"
class="block w-full text-sm" class="block w-full text-sm"
onchange={(e) => { onchange={(e) => {
communityState.replaceZipFile = communityState.replaceZipFile = (e.currentTarget as HTMLInputElement).files?.[0] ?? null;
(e.currentTarget as HTMLInputElement).files?.[0] ?? null;
}} }}
/> />
<button <button
@@ -0,0 +1,15 @@
<script lang="ts">
import { LUCIDE_MOON_PATH } from "@/lib/icons/lucideMoon";
let { class: className = "w-5 h-5" }: { class?: string } = $props();
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class={className}
aria-hidden="true"
>
<path d={LUCIDE_MOON_PATH} />
</svg>
@@ -0,0 +1,15 @@
<script lang="ts">
import { LUCIDE_SUN_PATH } from "@/lib/icons/lucideSun";
let { class: className = "w-5 h-5" }: { class?: string } = $props();
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class={className}
aria-hidden="true"
>
<path d={LUCIDE_SUN_PATH} />
</svg>
+140 -181
View File
@@ -1,36 +1,14 @@
<script lang="ts"> <script lang="ts">
import DownloadIcon from "@lucide/svelte/icons/download"; import { hasEnoughStorageSpace, isIndexedDBSupported, writeData, openDatabase, readAllData, deleteData } from '@/interface/hooks/backgroundDataLoader';
import TrashIcon from "@lucide/svelte/icons/trash"; import Spinner from '../Spinner.svelte';
import { import { settingsState } from '@/seqta/utils/listeners/settingsState'
hasEnoughStorageSpace, import { backgroundUpdates } from '@/interface/hooks/backgroundUpdates'
isIndexedDBSupported, import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
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 { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
const themeManager = ThemeManager.getInstance(); const themeManager = ThemeManager.getInstance();
type Background = { type Background = { id: string; category: string; type: string; lowResUrl: string; highResUrl: string; name: string; description: string; featured?: boolean };
id: string; let { searchTerm, selectedCategory, onCategoriesChange }: {
category: string;
type: string;
lowResUrl: string;
highResUrl: string;
name: string;
description: string;
featured?: boolean;
};
let {
searchTerm,
selectedCategory,
onCategoriesChange,
}: {
searchTerm: string; searchTerm: string;
selectedCategory: string; selectedCategory: string;
onCategoriesChange: (categories: string[]) => void; onCategoriesChange: (categories: string[]) => void;
@@ -42,16 +20,14 @@
let isLoading = $state<boolean>(true); let isLoading = $state<boolean>(true);
let savedBackgrounds = $state<string[]>([]); let savedBackgrounds = $state<string[]>([]);
let installingBackgrounds = $state<Set<string>>(new Set()); let installingBackgrounds = $state<Set<string>>(new Set());
let debugInfo = $state<string>(""); let debugInfo = $state<string>('');
let activeTab = $state<"all" | "installed" | "photos" | "videos">("all"); let activeTab = $state<'all' | 'installed' | 'photos' | 'videos'>('all');
let sortBy = $state<"newest" | "popular" | "name">("newest"); let sortBy = $state<'newest' | 'popular' | 'name'>('newest');
const loadStore = async () => { const loadStore = async () => {
try { try {
debugInfo = "Fetching backgrounds..."; debugInfo = 'Fetching backgrounds...';
const response = await fetch( const response = await fetch('https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/backgrounds.json');
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/backgrounds.json",
);
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`); throw new Error(`HTTP error! status: ${response.status}`);
} }
@@ -61,8 +37,8 @@
debugInfo = `Loaded ${backgrounds.length} backgrounds`; debugInfo = `Loaded ${backgrounds.length} backgrounds`;
await loadSavedBackgrounds(); await loadSavedBackgrounds();
} catch (e) { } catch (e) {
error = "Failed to load background store"; error = 'Failed to load background store';
debugInfo = `Error: ${e instanceof Error ? e.message : "Unknown error"}`; debugInfo = `Error: ${e instanceof Error ? e.message : 'Unknown error'}`;
} finally { } finally {
isLoading = false; isLoading = false;
} }
@@ -75,51 +51,49 @@
} }
await openDatabase(); await openDatabase();
const data = await readAllData(); const data = await readAllData();
savedBackgrounds = data.map((item) => item.id); savedBackgrounds = data.map(item => item.id);
} catch (e) { } catch (e) {
error = e instanceof Error ? e.message : "Unknown error occurred"; error = e instanceof Error ? e.message : 'Unknown error occurred';
} }
} }
loadStore(); loadStore();
let filteredBackgrounds = $derived( let filteredBackgrounds = $derived((() => {
(() => { let filtered = backgrounds;
let filtered = backgrounds;
if (searchTerm.trim()) {
const q = searchTerm.trim().toLowerCase();
filtered = backgrounds.filter((bg) =>
`${bg.name} ${bg.description}`.toLowerCase().includes(q),
);
}
if (searchTerm.trim()) { filtered = filtered.filter((bg: Background) => {
const q = searchTerm.trim().toLowerCase(); return selectedCategory === 'All'
filtered = backgrounds.filter((bg) => ? true
`${bg.name} ${bg.description}`.toLowerCase().includes(q), : selectedCategory === 'Featured'
); ? bg.featured
: bg.category === selectedCategory;
});
filtered.sort((a: Background, b: Background) => {
switch (sortBy) {
case 'name':
return a.name.localeCompare(b.name);
case 'newest':
return -1;
case 'popular':
return -1;
default:
return 0;
} }
});
filtered = filtered.filter((bg: Background) => { return filtered;
return selectedCategory === "All" })());
? true
: selectedCategory === "Featured"
? bg.featured
: bg.category === selectedCategory;
});
filtered.sort((a: Background, b: Background) => { let categories = $derived([...new Set(backgrounds.map(bg => bg.category))]);
switch (sortBy) {
case "name":
return a.name.localeCompare(b.name);
case "newest":
return -1;
case "popular":
return -1;
default:
return 0;
}
});
return filtered;
})(),
);
let categories = $derived([...new Set(backgrounds.map((bg) => bg.category))]);
async function saveBackgroundFromUrl(url: string, id: string, fileType: string): Promise<void> { async function saveBackgroundFromUrl(url: string, id: string, fileType: string): Promise<void> {
try { try {
if (!isIndexedDBSupported()) { if (!isIndexedDBSupported()) {
@@ -137,7 +111,7 @@
await writeData(id, fileType, blob); await writeData(id, fileType, blob);
savedBackgrounds = [...savedBackgrounds, id]; savedBackgrounds = [...savedBackgrounds, id];
} catch (e) { } catch (e) {
error = e instanceof Error ? e.message : "Unknown error occurred"; error = e instanceof Error ? e.message : 'Unknown error occurred';
} }
} }
@@ -145,14 +119,13 @@
installingBackgrounds = new Set(installingBackgrounds).add(fileId); installingBackgrounds = new Set(installingBackgrounds).add(fileId);
try { try {
await deleteData(fileId); await deleteData(fileId);
savedBackgrounds = savedBackgrounds.filter((id) => id !== fileId); savedBackgrounds = savedBackgrounds.filter(id => id !== fileId);
if (selectedBackground === fileId) { if (selectedBackground === fileId) {
selectNoBackground(); selectNoBackground();
} }
} catch (e) { } catch (e) {
error = error = e instanceof Error ? `Failed to delete background: ${e.message}` : 'Unknown error occurred';
e instanceof Error ? `Failed to delete background: ${e.message}` : "Unknown error occurred";
} finally { } finally {
installingBackgrounds = new Set(installingBackgrounds); installingBackgrounds = new Set(installingBackgrounds);
installingBackgrounds.delete(fileId); installingBackgrounds.delete(fileId);
@@ -177,125 +150,111 @@
await installBackground(background); await installBackground(background);
} }
} }
function selectNoBackground() { function selectNoBackground() {
selectedBackground = null; selectedBackground = null;
themeManager.setTheme(""); themeManager.setTheme('');
} }
</script> </script>
<div class="h-full overflow-auto"> <div class="h-full overflow-auto">
<!-- Header --> <!-- Header -->
<div class="sticky top-0 z-10 p-4 border-b bg-[#F1F1F3] dark:bg-zinc-900 dark:border-zinc-700"> <div class="sticky top-0 z-10 p-4 border-b bg-[#F1F1F3] dark:bg-zinc-900 dark:border-zinc-700">
<div class="flex justify-between items-center mb-4"> <div class="flex justify-between items-center mb-4">
<h1 class="text-2xl font-bold"> <h1 class="text-2xl font-bold">Explore Backgrounds {searchTerm ? `- "${searchTerm}"` : ''}</h1>
Explore Backgrounds {searchTerm ? `- "${searchTerm}"` : ""} <div class="flex gap-4 items-center">
</h1> <select
<div class="flex gap-4 items-center"> bind:value={sortBy}
<select class="p-2 rounded-lg border border-zinc-200 dark:border-zinc-700 dark:bg-zinc-800"
bind:value={sortBy} >
class="p-2 rounded-lg border border-zinc-200 dark:border-zinc-700 dark:bg-zinc-800" <option value="newest">Newest</option>
> <option value="name">Name</option>
<option value="newest">Newest</option> </select>
<option value="name">Name</option> </div>
</select> </div>
<!-- Tabs -->
<div class="flex gap-2">
{#each ['All', 'Installed', 'Photos', 'Videos'] as tab}
<button
class={`px-4 py-2 text-sm font-medium transition-colors rounded-full
${activeTab === tab.toLowerCase() ? 'bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700' :
'bg-zinc-100 dark:bg-transparent dark:outline-solid dark:outline-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-700/20'}`}
onclick={() => activeTab = tab.toLowerCase() as typeof activeTab}
>
{tab}
</button>
{/each}
</div> </div>
</div> </div>
<!-- Tabs --> <!-- Background Grid -->
<div class="flex gap-2"> <div class="p-4">
{#each ["All", "Installed", "Photos", "Videos"] as tab} {#if isLoading}
<button <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
class={`px-4 py-2 text-sm font-medium transition-colors rounded-full {#each Array(9) as _}
${ <div class="overflow-hidden relative rounded-lg animate-pulse">
activeTab === tab.toLowerCase() <!-- Image placeholder -->
? "bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700" <div class="w-full h-48 bg-zinc-200 dark:bg-zinc-800"></div>
: "bg-zinc-100 dark:bg-transparent dark:outline-solid dark:outline-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-700/20" <!-- Gradient overlay -->
}`} <div class="absolute right-0 bottom-0 left-0 h-16 to-transparent bg-linear-to-t from-zinc-300 dark:from-zinc-700">
onclick={() => (activeTab = tab.toLowerCase() as typeof activeTab)} <!-- Title placeholder -->
> <div class="absolute right-2 bottom-2 left-2">
{tab} <div class="w-2/3 h-4 rounded-full bg-zinc-200 dark:bg-zinc-800"></div>
</button> <div class="mt-2 w-1/2 h-3 rounded-full bg-zinc-200 dark:bg-zinc-800"></div>
{/each} </div>
</div>
</div>
<!-- Background Grid -->
<div class="p-4">
{#if isLoading}
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{#each Array(9) as _}
<div class="overflow-hidden relative rounded-lg animate-pulse">
<!-- Image placeholder -->
<div class="w-full h-48 bg-zinc-200 dark:bg-zinc-800"></div>
<!-- Gradient overlay -->
<div
class="absolute right-0 bottom-0 left-0 h-16 to-transparent bg-linear-to-t from-zinc-300 dark:from-zinc-700"
>
<!-- Title placeholder -->
<div class="absolute right-2 bottom-2 left-2">
<div class="w-2/3 h-4 rounded-full bg-zinc-200 dark:bg-zinc-800"></div>
<div class="mt-2 w-1/2 h-3 rounded-full bg-zinc-200 dark:bg-zinc-800"></div>
</div> </div>
</div> </div>
</div> {/each}
{/each} </div>
</div> {:else if error}
{:else if error} <div class="p-4 text-red-500 bg-red-100 rounded-lg">
<div class="p-4 text-red-500 bg-red-100 rounded-lg"> Error: {error}
Error: {error} </div>
</div> {:else}
{:else} <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3"> {#each filteredBackgrounds.filter((bg: Background) => {
{#each filteredBackgrounds.filter((bg: Background) => { if (activeTab === 'installed') return savedBackgrounds.includes(bg.id);
if (activeTab === "installed") return savedBackgrounds.includes(bg.id); if (activeTab === 'photos') return bg.type === 'image';
if (activeTab === "photos") return bg.type === "image"; if (activeTab === 'videos') return bg.type !== 'image';
if (activeTab === "videos") return bg.type !== "image"; return true;
return true; }) as background (background.id)}
}) as background (background.id)}
<div
class="overflow-hidden relative rounded-lg shadow-lg cursor-pointer group"
onclick={() => toggleBackgroundInstallation(background)}
onkeydown={(event) => {
if (event.key === "Enter" || event.key === " ") {
toggleBackgroundInstallation(background);
}
}}
role="button"
tabindex="0"
>
{#if background.type === "image"}
<img
src={background.lowResUrl}
alt={background.name}
class="object-cover w-full h-48 transition-all duration-300 group-hover:scale-105"
/>
{:else}
<video src={background.lowResUrl} class="object-cover w-full h-48" muted loop autoplay
></video>
{/if}
<div <div
class={`flex absolute inset-0 justify-center items-center opacity-0 transition-opacity duration-300 bg-black/50 group-hover:opacity-100 ${installingBackgrounds.has(background.id) ? "opacity-100" : ""}`} class="overflow-hidden relative rounded-lg shadow-lg cursor-pointer group"
onclick={() => toggleBackgroundInstallation(background)}
onkeydown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
toggleBackgroundInstallation(background);
}
}}
role="button"
tabindex="0"
> >
{#if installingBackgrounds.has(background.id)} {#if background.type === 'image'}
<Spinner /> <img src={background.lowResUrl} alt={background.name} class="object-cover w-full h-48 transition-all duration-300 group-hover:scale-105" />
{:else if savedBackgrounds.includes(background.id)}
<span class="flex items-center text-white">
<TrashIcon size="1em" class="mr-2 text-2xl" />
<span class="text-sm font-semibold">Remove</span>
</span>
{:else} {:else}
<span class="flex items-center text-white"> <video src={background.lowResUrl} class="object-cover w-full h-48" muted loop autoplay></video>
<DownloadIcon size="1em" class="mr-2 text-2xl" />
<span class="text-sm font-semibold">Install</span>
</span>
{/if} {/if}
<div class={`flex absolute inset-0 justify-center items-center opacity-0 transition-opacity duration-300 bg-black/50 group-hover:opacity-100 ${installingBackgrounds.has(background.id) ? 'opacity-100' : ''}`}>
{#if installingBackgrounds.has(background.id)}
<Spinner />
{:else if savedBackgrounds.includes(background.id)}
<span class="flex items-center text-white">
<span class="mr-2 text-2xl not-italic font-IconFamily" aria-hidden="true">&#xed2c;</span>
<span class="text-sm font-semibold">Remove</span>
</span>
{:else}
<span class="flex items-center text-white">
<span class="mr-2 text-2xl not-italic font-IconFamily" aria-hidden="true">&#xea9a;</span>
<span class="text-sm font-semibold">Install</span>
</span>
{/if}
</div>
</div> </div>
</div> {/each}
{/each} </div>
</div> {/if}
{/if} </div>
</div>
</div> </div>
{#if settingsState.devMode} {#if settingsState.devMode}
@@ -303,7 +262,7 @@
<h3 class="mb-2 font-bold">Debug Info:</h3> <h3 class="mb-2 font-bold">Debug Info:</h3>
<p>{debugInfo}</p> <p>{debugInfo}</p>
<p>Total backgrounds: {backgrounds.length}</p> <p>Total backgrounds: {backgrounds.length}</p>
<p>Categories: {categories.join(", ") || "<empty>"}</p> <p>Categories: {categories.join(', ') || '<empty>'}</p>
<p>Active Tab: {activeTab}</p> <p>Active Tab: {activeTab}</p>
<p>Selected Category: {selectedCategory}</p> <p>Selected Category: {selectedCategory}</p>
</div> </div>
@@ -1,15 +1,10 @@
<script lang="ts"> <script lang="ts">
import CircleUserRoundIcon from "@lucide/svelte/icons/circle-user-round";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { cloudAuth } from "@/seqta/utils/cloudAuth"; import { cloudAuth } from "@/seqta/utils/cloudAuth";
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte"; import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { settingsState } from "@/seqta/utils/listeners/settingsState";
let { let { alwaysShowUserName = false, onClick = undefined, compact = false }: {
alwaysShowUserName = false,
onClick = undefined,
compact = false,
}: {
alwaysShowUserName?: boolean; alwaysShowUserName?: boolean;
onClick?: () => void; onClick?: () => void;
compact?: boolean; compact?: boolean;
@@ -77,9 +72,7 @@
<button <button
type="button" type="button"
onclick={handleButtonClick} onclick={handleButtonClick}
class="flex items-center gap-2 bg-zinc-100/80 font-medium text-zinc-700 transition-colors duration-150 hover:bg-zinc-200 hover:text-zinc-950 dark:bg-zinc-900/50 dark:text-zinc-200 dark:hover:bg-zinc-700 dark:hover:text-white {compact class="flex items-center gap-2 bg-zinc-100/80 font-medium text-zinc-700 transition-colors duration-150 hover:bg-zinc-200 hover:text-zinc-950 focus:outline-hidden dark:bg-zinc-900/50 dark:text-zinc-200 dark:hover:bg-zinc-700 dark:hover:text-white {compact ? 'h-8 rounded-lg px-3 text-[0.75rem]' : 'h-12 rounded-full px-4 text-sm'}"
? 'h-8 rounded-lg px-3 text-[0.75rem]'
: 'h-12 rounded-full px-4 text-sm'}"
> >
{#if cloudState.isLoggedIn} {#if cloudState.isLoggedIn}
{#if cloudState.user?.pfpUrl} {#if cloudState.user?.pfpUrl}
@@ -89,9 +82,7 @@
/> />
{/if} {/if}
{#if !cloudState.user?.pfpUrl} {#if !cloudState.user?.pfpUrl}
<div <div class="flex items-center justify-center w-5 h-5 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-[0.6rem]">
class="flex items-center justify-center w-5 h-5 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-[0.6rem]"
>
{getInitials()} {getInitials()}
</div> </div>
{/if} {/if}
@@ -100,13 +91,10 @@
? "inline max-w-40 truncate" ? "inline max-w-40 truncate"
: "hidden max-w-24 truncate sm:inline"} : "hidden max-w-24 truncate sm:inline"}
> >
{cloudState.user?.displayName || {cloudState.user?.displayName || cloudState.user?.username || cloudState.user?.email || "User"}
cloudState.user?.username ||
cloudState.user?.email ||
"User"}
</span> </span>
{:else} {:else}
<CircleUserRoundIcon size="1em" class="text-sm" /> <span class="text-sm font-IconFamily" aria-hidden="true">{'\ued53'}</span>
<span>Sign in</span> <span>Sign in</span>
{/if} {/if}
</button> </button>
@@ -134,23 +122,16 @@
/> />
{/if} {/if}
{#if !cloudState.user?.pfpUrl} {#if !cloudState.user?.pfpUrl}
<div <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">
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()} {getInitials()}
</div> </div>
{/if} {/if}
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<p class="text-base font-medium text-zinc-900 dark:text-white truncate"> <p class="text-base font-medium text-zinc-900 dark:text-white truncate">
{cloudState.user?.displayName || {cloudState.user?.displayName || cloudState.user?.username || cloudState.user?.email || "User"}
cloudState.user?.username ||
cloudState.user?.email ||
"User"}
</p> </p>
{#if cloudState.user?.email && cloudState.user?.email !== (cloudState.user?.displayName || cloudState.user?.username)} {#if cloudState.user?.email && cloudState.user?.email !== (cloudState.user?.displayName || cloudState.user?.username)}
<p class="text-base text-zinc-500 dark:text-zinc-400 truncate"> <p class="text-base text-zinc-500 dark:text-zinc-400 truncate">{cloudState.user.email}</p>
{cloudState.user.email}
</p>
{/if} {/if}
</div> </div>
</div> </div>
@@ -1,18 +1,12 @@
<script lang="ts"> <script lang="ts">
import ChevronLeftIcon from "@lucide/svelte/icons/chevron-left"; import { fade } from 'svelte/transition';
import ChevronRightIcon from "@lucide/svelte/icons/chevron-right"; import type { ThemeCoverSlide } from '@/interface/types/theme';
import StarIcon from "@lucide/svelte/icons/star"; import emblaCarouselSvelte from 'embla-carousel-svelte';
import { fade } from "svelte/transition"; import Autoplay from 'embla-carousel-autoplay';
import type { ThemeCoverSlide } from "@/interface/types/theme";
import emblaCarouselSvelte from "embla-carousel-svelte";
import Autoplay from "embla-carousel-autoplay";
let { let { slides, setDisplayTheme }: {
slides,
setDisplayTheme,
}: {
slides: ThemeCoverSlide[]; slides: ThemeCoverSlide[];
setDisplayTheme: (theme: import("@/interface/types/theme").Theme) => void; setDisplayTheme: (theme: import('@/interface/types/theme').Theme) => void;
} = $props(); } = $props();
let emblaApi = $state(); let emblaApi = $state();
@@ -40,38 +34,37 @@
</script> </script>
{#if slides.length > 0} {#if slides.length > 0}
<div <div class="relative w-full overflow-clip rounded-xl ring-1 ring-black/10 transition-opacity dark:ring-white/10" transition:fade>
class="relative w-full overflow-clip rounded-xl ring-1 ring-black/10 transition-opacity dark:ring-white/10"
transition:fade
>
<div <div
class="w-full overflow-hidden" class="w-full overflow-hidden"
use:emblaCarouselSvelte={{ options, plugins }} use:emblaCarouselSvelte={{ options, plugins }}
onemblaInit={onInit} onemblaInit={onInit}
> >
<div class="flex"> <div class="flex">
{#each slides as slide (slide.imageUrl + slide.title + (slide.subtitle ?? ""))} {#each slides as slide (slide.imageUrl + slide.title + (slide.subtitle ?? ''))}
<div <div
class="cover-slide relative isolate min-w-0 flex-[0_0_100%] cursor-pointer overflow-hidden" class="cover-slide relative isolate min-w-0 flex-[0_0_100%] cursor-pointer overflow-hidden"
role="button" role="button"
tabindex="0" tabindex="0"
onkeydown={(e) => { onkeydown={(e) => {
if (e.key === "Enter") setDisplayTheme(slide.openTheme); if (e.key === 'Enter') setDisplayTheme(slide.openTheme);
}} }}
onclick={() => setDisplayTheme(slide.openTheme)} onclick={() => setDisplayTheme(slide.openTheme)}
> >
<img <img src={slide.imageUrl} alt="" class="absolute inset-0 z-0 h-full w-full object-cover" />
src={slide.imageUrl}
alt=""
class="absolute inset-0 z-0 h-full w-full object-cover"
/>
{#if slide.badgeFeatured === true} {#if slide.badgeFeatured === true}
<div class="absolute top-4 left-4 z-2 pointer-events-none"> <div class="absolute top-4 left-4 z-2 pointer-events-none">
<span <span
class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100 shadow-xs" class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100 shadow-xs"
aria-label="Featured theme" aria-label="Featured theme"
> >
<StarIcon class="w-3.5 h-3.5" fill="currentColor" /> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-3.5 h-3.5">
<path
fill-rule="evenodd"
d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z"
clip-rule="evenodd"
/>
</svg>
Featured Featured
</span> </span>
</div> </div>
@@ -82,9 +75,7 @@
<p class="text-lg font-medium text-white/95 mt-1 line-clamp-2">{slide.subtitle}</p> <p class="text-lg font-medium text-white/95 mt-1 line-clamp-2">{slide.subtitle}</p>
{/if} {/if}
{#if slide.openTheme.author && !slide.subtitle} {#if slide.openTheme.author && !slide.subtitle}
<p class="text-sm text-white/90 mt-1 mb-1 line-clamp-1"> <p class="text-sm text-white/90 mt-1 mb-1 line-clamp-1">By {slide.openTheme.author}</p>
By {slide.openTheme.author}
</p>
{/if} {/if}
{#if slide.openTheme.description && !slide.subtitle} {#if slide.openTheme.description && !slide.subtitle}
<p class="text-lg text-white line-clamp-3">{slide.openTheme.description}</p> <p class="text-lg text-white line-clamp-3">{slide.openTheme.description}</p>
@@ -102,7 +93,9 @@
type="button" type="button"
class="flex justify-center items-center w-8 h-8 text-white rounded-full bg-black/50 dark:bg-zinc-800 transition-all duration-200" class="flex justify-center items-center w-8 h-8 text-white rounded-full bg-black/50 dark:bg-zinc-800 transition-all duration-200"
> >
<ChevronLeftIcon class="w-6 h-6" /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="m15.75 19.5-7.5-7.5 7.5-7.5" />
</svg>
</button> </button>
<button <button
aria-label="Next" aria-label="Next"
@@ -110,7 +103,9 @@
type="button" type="button"
class="flex justify-center items-center w-8 h-8 text-white rounded-full bg-black/50 dark:bg-zinc-800 transition-all duration-200" class="flex justify-center items-center w-8 h-8 text-white rounded-full bg-black/50 dark:bg-zinc-800 transition-all duration-200"
> >
<ChevronRightIcon class="w-6 h-6" /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5" />
</svg>
</button> </button>
</div> </div>
</div> </div>
@@ -134,7 +129,7 @@
rgb(0 0 0 / 8%) 72%, rgb(0 0 0 / 8%) 72%,
transparent 88% transparent 88%
); );
content: ""; content: '';
pointer-events: none; pointer-events: none;
} }
</style> </style>
+17 -18
View File
@@ -1,6 +1,4 @@
<script lang="ts"> <script lang="ts">
import SearchIcon from "@lucide/svelte/icons/search";
import Minimize2Icon from "@lucide/svelte/icons/minimize-2";
import darkLogo from "@/resources/icons/betterseqta-dark-full.png"; import darkLogo from "@/resources/icons/betterseqta-dark-full.png";
import lightLogo from "@/resources/icons/betterseqta-light-full.png"; import lightLogo from "@/resources/icons/betterseqta-light-full.png";
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl"; import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
@@ -95,9 +93,15 @@
> >
<label class="relative block w-40 md:w-48 xl:w-56"> <label class="relative block w-40 md:w-48 xl:w-56">
<span class="sr-only">Search {activePage}</span> <span class="sr-only">Search {activePage}</span>
<SearchIcon <svg
class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400" class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"
/> fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21 21-4.35-4.35m1.35-5.65a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z" />
</svg>
<input <input
type="search" type="search"
placeholder={activePage === "themes" ? "Search themes" : "Search backgrounds"} placeholder={activePage === "themes" ? "Search themes" : "Search backgrounds"}
@@ -114,15 +118,10 @@
{/if} {/if}
{#if onToggleSize} {#if onToggleSize}
<button <button type="button" onclick={onToggleSize}
type="button" class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-hidden dark:text-zinc-400 dark:hover:text-white"
onclick={onToggleSize} aria-label="Collapse settings" title="Collapse settings" aria-expanded="true">
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] dark:text-zinc-400 dark:hover:text-white" <span class="font-IconFamily text-2xl" aria-hidden="true">{"\uec06"}</span>
aria-label="Collapse settings"
title="Collapse settings"
aria-expanded="true"
>
<Minimize2Icon size="1em" class="text-2xl" />
</button> </button>
{/if} {/if}
<PlainCloseButton onclick={onClose} label="Close settings" /> <PlainCloseButton onclick={onClose} label="Close settings" />
@@ -151,12 +150,12 @@
} }
} }
.store-search { .store-search,
.store-search:focus,
.store-search:focus-visible {
appearance: none; appearance: none;
border: 0 !important; border: 0 !important;
} outline: 0 !important;
box-shadow: none !important;
.store-search:focus-visible {
outline-offset: -2px;
} }
</style> </style>
+56 -67
View File
@@ -1,26 +1,13 @@
<script lang="ts"> <script lang="ts">
import CheckIcon from "@lucide/svelte/icons/check"; import type { Theme } from '@/interface/types/theme'
import DownloadIcon from "@lucide/svelte/icons/download";
import HeartIcon from "@lucide/svelte/icons/heart";
import StarIcon from "@lucide/svelte/icons/star";
import type { Theme } from "@/interface/types/theme";
import { import {
masterGridDisplayDownloadCount, masterGridDisplayDownloadCount,
gridCardPreviewImageUrls, gridCardPreviewImageUrls,
} from "@/interface/utils/themeStoreFlavours"; } from '@/interface/utils/themeStoreFlavours'
import { isStoreThemeInstalled } from "@/interface/utils/themeListFilters"; import { isStoreThemeInstalled } from '@/interface/utils/themeListFilters'
import emblaCarouselSvelte from "embla-carousel-svelte"; import emblaCarouselSvelte from 'embla-carousel-svelte';
import Autoplay from "embla-carousel-autoplay"; import Autoplay from 'embla-carousel-autoplay';
let { let { theme, onClick, toggleFavorite, isLoggedIn, onRequestSignIn, allStoreThemeRows, installedThemeIds = [], variant = 'official' }: {
theme,
onClick,
toggleFavorite,
isLoggedIn,
onRequestSignIn,
allStoreThemeRows,
installedThemeIds = [],
variant = "official",
}: {
theme: Theme; theme: Theme;
onClick: () => void; onClick: () => void;
toggleFavorite: (theme: Theme) => void; toggleFavorite: (theme: Theme) => void;
@@ -29,7 +16,7 @@
/** Raw API themes (includes hidden slaves) for aggregated master download totals */ /** Raw API themes (includes hidden slaves) for aggregated master download totals */
allStoreThemeRows?: Theme[]; allStoreThemeRows?: Theme[];
installedThemeIds?: string[]; installedThemeIds?: string[];
variant?: "official" | "community"; variant?: 'official' | 'community';
} = $props(); } = $props();
const displayDownloadCount = $derived( const displayDownloadCount = $derived(
@@ -42,15 +29,13 @@
/** Mirrors CoverSwiper (featured bar): horizontal slides + autoplay */ /** Mirrors CoverSwiper (featured bar): horizontal slides + autoplay */
function prefersReducedMotion(): boolean { function prefersReducedMotion(): boolean {
return ( return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
);
} }
/** Read once synchronously where `window` exists so reduced-motion doesn’t briefly mount carousel */ /** Read once synchronously where `window` exists so reduced-motion doesn’t briefly mount carousel */
let allowSlideAutoplay = $state(!prefersReducedMotion()); let allowSlideAutoplay = $state(!prefersReducedMotion());
const gridEmblaKey = $derived(gridRotatorUrls.join("|")); const gridEmblaKey = $derived(gridRotatorUrls.join('|'));
const gridEmblaOptions = $derived({ loop: gridRotatorUrls.length > 1 }); const gridEmblaOptions = $derived({ loop: gridRotatorUrls.length > 1 });
@@ -66,11 +51,11 @@
}); });
const isInstalled = $derived(isStoreThemeInstalled(theme, installedThemeIds)); const isInstalled = $derived(isStoreThemeInstalled(theme, installedThemeIds));
const isCommunity = $derived(variant === "community"); const isCommunity = $derived(variant === 'community');
const showFavorites = $derived(!isCommunity); const showFavorites = $derived(!isCommunity);
function handleCardClick(e: MouseEvent) { function handleCardClick(e: MouseEvent) {
if ((e.target as HTMLElement).closest("[data-theme-favorite]")) return; if ((e.target as HTMLElement).closest('[data-theme-favorite]')) return;
onClick(); onClick();
} }
@@ -110,52 +95,55 @@
class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100 shadow-xs" class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100 shadow-xs"
aria-label="Featured theme" aria-label="Featured theme"
> >
<StarIcon class="w-3.5 h-3.5" fill="currentColor" /> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-3.5 h-3.5">
<path fill-rule="evenodd" d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z" clip-rule="evenodd" />
</svg>
Featured Featured
</span> </span>
</div> </div>
{/if} {/if}
{#if isInstalled} {#if isInstalled}
<div <div class="absolute top-2 z-20 pointer-events-none {theme.featured === true ? (isCommunity ? 'left-44' : 'left-22') : isCommunity ? 'left-23' : 'left-2'}">
class="absolute top-2 z-20 pointer-events-none {theme.featured === true
? isCommunity
? 'left-44'
: 'left-22'
: isCommunity
? 'left-23'
: 'left-2'}"
>
<span <span
class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-emerald-100 text-emerald-900 dark:bg-emerald-950 dark:text-emerald-100 shadow-xs" class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-emerald-100 text-emerald-900 dark:bg-emerald-950 dark:text-emerald-100 shadow-xs"
aria-label="Installed" aria-label="Installed"
> >
<CheckIcon class="w-3.5 h-3.5" /> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-3.5 h-3.5">
<path fill-rule="evenodd" d="M19.916 4.626a.75.75 0 01.208 1.04l-9 13.5a.75.75 0 01-1.154.114l-6-6a.75.75 0 011.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 011.04-.208z" clip-rule="evenodd" />
</svg>
Installed Installed
</span> </span>
</div> </div>
{/if} {/if}
{#if showFavorites} {#if showFavorites}
<button <button
type="button" type="button"
data-theme-favorite data-theme-favorite
class="pointer-events-none absolute right-2 top-2 z-20 flex h-10 w-10 scale-[0.25] items-center justify-center rounded-full bg-black/50 text-white opacity-0 blur-xs transition-[opacity,transform,filter,background-color] duration-200 ease-[cubic-bezier(0.2,0,0,1)] hover:bg-black/70 active:scale-[0.96] group-hover:pointer-events-auto group-hover:scale-100 group-hover:opacity-100 group-hover:blur-0 focus-visible:pointer-events-auto focus-visible:scale-100 focus-visible:opacity-100 focus-visible:blur-0" class="pointer-events-none absolute right-2 top-2 z-20 flex h-10 w-10 scale-[0.25] items-center justify-center rounded-full bg-black/50 text-white opacity-0 blur-xs transition-[opacity,transform,filter,background-color] duration-200 ease-[cubic-bezier(0.2,0,0,1)] hover:bg-black/70 active:scale-[0.96] group-hover:pointer-events-auto group-hover:scale-100 group-hover:opacity-100 group-hover:blur-0 focus-visible:pointer-events-auto focus-visible:scale-100 focus-visible:opacity-100 focus-visible:blur-0 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white"
onclick={handleFavoriteClick} onclick={handleFavoriteClick}
aria-label={isLoggedIn aria-label={isLoggedIn
? theme.is_favorited ? theme.is_favorited
? "Remove from favourites" ? 'Remove from favourites'
: "Add to favourites" : 'Add to favourites'
: "Sign in to favourite themes"} : 'Sign in to favourite themes'}
title={isLoggedIn title={isLoggedIn
? theme.is_favorited ? theme.is_favorited
? "Remove from favourites" ? 'Remove from favourites'
: "Add to favourites" : 'Add to favourites'
: "Sign in to favourite themes"} : 'Sign in to favourite themes'}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill={theme.is_favorited ? 'currentColor' : 'none'}
stroke="currentColor"
stroke-width="2"
class="h-5 w-5 {theme.is_favorited ? 'text-red-500' : ''}"
aria-hidden="true"
> >
<HeartIcon <path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 0 1 6.364 0L12 7.636l1.318-1.318a4.5 4.5 0 0 1 6.364 6.364L12 20.364l-7.682-7.682a4.5 4.5 0 0 1 0-6.364Z" />
class="h-5 w-5 {theme.is_favorited ? 'text-red-500' : ''}" </svg>
fill={theme.is_favorited ? "currentColor" : "none"} </button>
/>
</button>
{/if} {/if}
<div class="absolute bottom-1 left-3 right-3 z-10 mb-1 flex flex-col gap-0.5"> <div class="absolute bottom-1 left-3 right-3 z-10 mb-1 flex flex-col gap-0.5">
<span class="text-xl font-bold text-white drop-shadow-md">{theme.name}</span> <span class="text-xl font-bold text-white drop-shadow-md">{theme.name}</span>
@@ -164,22 +152,23 @@
{/if} {/if}
<div class="flex gap-3 text-xs font-medium text-white/90 drop-shadow-xs"> <div class="flex gap-3 text-xs font-medium text-white/90 drop-shadow-xs">
<span class="flex items-center gap-1"> <span class="flex items-center gap-1">
<DownloadIcon class="w-3.5 h-3.5" /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-3.5 h-3.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3" />
</svg>
{displayDownloadCount.toLocaleString()} {displayDownloadCount.toLocaleString()}
</span> </span>
{#if showFavorites} {#if showFavorites}
<span class="flex items-center gap-1"> <span class="flex items-center gap-1">
<HeartIcon class="w-3.5 h-3.5" fill={theme.is_favorited ? "currentColor" : "none"} /> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill={theme.is_favorited ? 'currentColor' : 'none'} stroke="currentColor" stroke-width="1.5" class="w-3.5 h-3.5">
{(theme.favorite_count ?? 0).toLocaleString()} <path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />
</span> </svg>
{(theme.favorite_count ?? 0).toLocaleString()}
</span>
{/if} {/if}
</div> </div>
</div> </div>
{#if gridRotatorUrls.length === 0} {#if gridRotatorUrls.length === 0}
<div <div class="relative w-full h-48 overflow-hidden rounded-md bg-zinc-200 dark:bg-zinc-700" aria-hidden="true"></div>
class="relative w-full h-48 overflow-hidden rounded-md bg-zinc-200 dark:bg-zinc-700"
aria-hidden="true"
></div>
{:else if !allowSlideAutoplay || gridRotatorUrls.length === 1} {:else if !allowSlideAutoplay || gridRotatorUrls.length === 1}
<div class="relative w-full h-48 overflow-hidden rounded-md"> <div class="relative w-full h-48 overflow-hidden rounded-md">
<img <img
@@ -230,7 +219,7 @@
rgb(0 0 0 / 16%) 72%, rgb(0 0 0 / 16%) 72%,
transparent 88% transparent 88%
); );
content: ""; content: '';
pointer-events: none; pointer-events: none;
} }
</style> </style>
File diff suppressed because it is too large. Load diff
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import PlusIcon from "@lucide/svelte/icons/plus";
let { onFileChange }: { onFileChange?: (file: File) => void } = $props(); let { onFileChange }: { onFileChange?: (file: File) => void } = $props();
function handleFileChange(event: Event) { function handleFileChange(event: Event) {
@@ -15,9 +14,10 @@
<div class="relative w-16 h-16 overflow-hidden transition rounded-xl bg-zinc-100 dark:bg-zinc-900"> <div class="relative w-16 h-16 overflow-hidden transition rounded-xl bg-zinc-100 dark:bg-zinc-900">
<div <div
class="flex items-center justify-center w-full h-full text-3xl font-bold text-gray-400 transition hover:text-gray-500 pointer-events-none" class="flex items-center justify-center w-full h-full text-3xl font-bold text-gray-400 transition font-IconFamily hover:text-gray-500 pointer-events-none"
> >
<PlusIcon size="1em" /> <!-- Plus icon -->
</div> </div>
<input <input
type="file" type="file"
@@ -1,29 +1,20 @@
<script lang="ts"> <script lang="ts">
import HeartIcon from "@lucide/svelte/icons/heart"; import type { CustomTheme, ThemeList } from '@/types/customThemes'
import CloudUploadIcon from "@lucide/svelte/icons/cloud-upload"; import { onDestroy, onMount } from 'svelte'
import PencilIcon from "@lucide/svelte/icons/pencil"; import browser from '@/lib/browser'
import PlusIcon from "@lucide/svelte/icons/plus"; import { themeUpdates } from '@/interface/hooks/themeUpdates'
import ShoppingCartIcon from "@lucide/svelte/icons/shopping-cart"; import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
import UploadIcon from "@lucide/svelte/icons/upload"; import { cloudAuth } from '@/seqta/utils/cloudAuth'
import type { CustomTheme, ThemeList } from "@/types/customThemes"; import SignInToFavoriteModal from '@/interface/components/SignInToFavoriteModal.svelte'
import { onDestroy, onMount } from "svelte"; import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
import browser from "@/lib/browser"; import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
import { themeUpdates } from "@/interface/hooks/themeUpdates"; import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager"; import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
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";
const themeManager = ThemeManager.getInstance(); const themeManager = ThemeManager.getInstance();
let themes = $state<ThemeList | null>(null); let themes = $state<ThemeList | null>(null);
let { let { isEditMode, showNavigation = true }: {
isEditMode,
showNavigation = true,
}: {
isEditMode: boolean; isEditMode: boolean;
showNavigation?: boolean; showNavigation?: boolean;
} = $props(); } = $props();
@@ -49,74 +40,75 @@
if (theme.id === themes?.selectedTheme) { if (theme.id === themes?.selectedTheme) {
themeManager.setTransitionPoint(e.clientX, e.clientY); themeManager.setTransitionPoint(e.clientX, e.clientY);
await themeManager.disableTheme(); await themeManager.disableTheme();
themes.selectedTheme = ""; themes.selectedTheme = '';
} else { } else {
themeManager.setTransitionPoint(e.clientX, e.clientY); themeManager.setTransitionPoint(e.clientX, e.clientY);
await themeManager.setTheme(theme.id); await themeManager.setTheme(theme.id);
if (!themes) return; if (!themes) return;
themes.selectedTheme = theme.id; themes.selectedTheme = theme.id;
} }
}; }
const handleThemeDelete = async (themeId: string) => { const handleThemeDelete = async (themeId: string) => {
try { try {
await themeManager.deleteTheme(themeId); await themeManager.deleteTheme(themeId);
if (!themes) return; if (!themes) return;
themes.themes = themes.themes.filter((theme) => theme.id !== themeId); themes.themes = themes.themes.filter(theme => theme.id !== themeId);
if (themeId === themes.selectedTheme) { if (themeId === themes.selectedTheme) {
themes.selectedTheme = ""; themes.selectedTheme = '';
await themeManager.disableTheme(); await themeManager.disableTheme();
} }
} catch (error) { } catch (error) {
console.error("Error deleting theme:", error); console.error('Error deleting theme:', error);
} }
}; }
const handleShareTheme = async (theme: CustomTheme) => { const handleShareTheme = async (theme: CustomTheme) => {
try { try {
await themeManager.shareTheme(theme.id); await themeManager.shareTheme(theme.id);
} catch (error) { } catch (error) {
console.error("Error sharing theme:", error); console.error('Error sharing theme:', error);
} }
}; }
const fetchThemes = async () => { const fetchThemes = async () => {
themes = { themes = {
themes: await themeManager.getAvailableThemes(), themes: await themeManager.getAvailableThemes(),
selectedTheme: themeManager.getSelectedThemeId() || "", selectedTheme: themeManager.getSelectedThemeId() || '',
}; }
if (themes && cloudLoggedIn) { if (themes && cloudLoggedIn) {
const status: Record<string, boolean> = {}; const status: Record<string, boolean> = {};
await Promise.all( await Promise.all(
themes.themes.map(async (t) => { themes.themes.map(async (t) => {
try { try {
const res = (await browser.runtime.sendMessage({ const res = (await browser.runtime.sendMessage({
type: "fetchThemeDetails", type: 'fetchThemeDetails',
themeId: t.id, themeId: t.id,
})) as { success?: boolean; data?: { theme?: { is_favorited?: boolean } } }; })) as { success?: boolean; data?: { theme?: { is_favorited?: boolean } } };
if (res?.success && res?.data?.theme) { if (res?.success && res?.data?.theme) {
status[t.id] = !!res.data.theme.is_favorited; status[t.id] = !!res.data.theme.is_favorited;
}
} catch {
// Theme may not exist on store (e.g. locally created)
} }
} catch { })
// Theme may not exist on store (e.g. locally created) );
} favoriteStatus = status;
}),
);
favoriteStatus = status;
} else { } else {
favoriteStatus = {}; favoriteStatus = {};
} }
}; }
const openStorePage = async () => { const openStorePage = async () => {
await (await import("@/seqta/ui/renderStore")).openStorePage(); const { openStorePage } = await import('@/seqta/ui/renderStore')
}; await openStorePage()
}
const openThemeCreator = async (themeId?: string) => { const openThemeCreator = async (themeId?: string) => {
const { launchPageThemeBuilder } = await import("@/seqta/utils/launchPageThemeBuilder"); const { launchPageThemeBuilder } = await import('@/seqta/utils/launchPageThemeBuilder')
await launchPageThemeBuilder(themeId); await launchPageThemeBuilder(themeId)
}; }
const submitCustomTheme = async (theme: CustomTheme, e: MouseEvent) => { const submitCustomTheme = async (theme: CustomTheme, e: MouseEvent) => {
e.stopPropagation(); e.stopPropagation();
@@ -127,14 +119,14 @@
} }
submittingThemeId = theme.id; submittingThemeId = theme.id;
try { try {
const { submitThemeById } = await import("@/seqta/utils/customThemes/submitLocalTheme"); const { submitThemeById } = await import('@/seqta/utils/customThemes/submitLocalTheme');
await submitThemeById(theme.id, theme.description?.trim() || undefined); await submitThemeById(theme.id, theme.description?.trim() || undefined);
} catch (err) { } catch (err) {
submitError = formatCustomThemeApiError(err); submitError = formatCustomThemeApiError(err);
} finally { } finally {
submittingThemeId = null; submittingThemeId = null;
} }
}; }
const handleToggleFavorite = async (theme: CustomTheme, e: MouseEvent) => { const handleToggleFavorite = async (theme: CustomTheme, e: MouseEvent) => {
e.stopPropagation(); e.stopPropagation();
@@ -144,23 +136,23 @@
} }
const isFavorite = !favoriteStatus[theme.id]; const isFavorite = !favoriteStatus[theme.id];
const result = (await browser.runtime.sendMessage({ const result = (await browser.runtime.sendMessage({
type: "cloudFavorite", type: 'cloudFavorite',
themeId: theme.id, themeId: theme.id,
action: isFavorite ? "favorite" : "unfavorite", action: isFavorite ? 'favorite' : 'unfavorite',
})) as { success?: boolean }; })) as { success?: boolean };
if (result?.success) { if (result?.success) {
favoriteStatus = { ...favoriteStatus, [theme.id]: isFavorite }; favoriteStatus = { ...favoriteStatus, [theme.id]: isFavorite };
} }
}; }
onMount(async () => { onMount(async () => {
await fetchThemes(); await fetchThemes();
themeUpdates.addListener(fetchThemes); themeUpdates.addListener(fetchThemes);
}); })
onDestroy(() => { onDestroy(() => {
themeUpdates.removeListener(fetchThemes); themeUpdates.removeListener(fetchThemes);
}); })
const useTwoColumnLayout = $derived(!showNavigation); const useTwoColumnLayout = $derived(!showNavigation);
</script> </script>
@@ -170,26 +162,18 @@
role="list" role="list"
tabindex="-1" tabindex="-1"
> >
<div class={useTwoColumnLayout ? "grid grid-cols-2 gap-3" : "flex flex-col gap-2 px-2"}> <div class="{useTwoColumnLayout ? 'grid grid-cols-2 gap-3' : 'flex flex-col gap-2 px-2'}">
{#if themes} {#if themes}
{#each themes.themes as theme (theme.id)} {#each themes.themes as theme (theme.id)}
<button <button
class="relative group w-full aspect-theme flex justify-center items-center rounded-xl transition ring-3 dark:ring-white ring-zinc-300 {theme.id === class="relative group w-full aspect-theme flex justify-center items-center rounded-xl transition ring-3 dark:ring-white ring-zinc-300 {theme.id === themes.selectedTheme ? 'dark:ring-2 ring-4' : 'ring-0'}"
themes.selectedTheme
? 'dark:ring-2 ring-4'
: 'ring-0'}"
onclick={(e) => handleThemeClick(theme, e)} onclick={(e) => handleThemeClick(theme, e)}
> >
{#if isEditMode} {#if isEditMode}
<div <div
class="flex absolute top-2 right-2 z-20 place-items-center p-2 w-6 h-6 text-white bg-red-600 rounded-full opacity-100" class="flex absolute top-2 right-2 z-20 place-items-center p-2 w-6 h-6 text-white bg-red-600 rounded-full opacity-100"
onclick={(event) => { onclick={(event) => { event.stopPropagation(); handleThemeDelete(theme.id) }}
event.stopPropagation(); onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') handleThemeDelete(theme.id) }}
handleThemeDelete(theme.id);
}}
onkeydown={(event) => {
if (event.key === "Enter" || event.key === " ") handleThemeDelete(theme.id);
}}
role="button" role="button"
tabindex="-1" tabindex="-1"
> >
@@ -198,93 +182,59 @@
{/if} {/if}
{#if !isEditMode} {#if !isEditMode}
<div <div class="absolute inset-y-0 right-3 z-20 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100">
class="absolute inset-y-0 right-3 z-20 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100"
>
{#if !isLocalCustomTheme(theme)} {#if !isLocalCustomTheme(theme)}
<div <div
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-center {(favoriteStatus[ class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-center {(favoriteStatus[theme.id] ?? false) ? 'text-red-400' : 'text-white/80'}"
theme.id
] ?? false)
? 'text-red-400'
: 'text-white/80'}"
onclick={(event) => handleToggleFavorite(theme, event)} onclick={(event) => handleToggleFavorite(theme, event)}
onkeydown={(event) => { onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') handleToggleFavorite(theme, event as any) }}
if (event.key === "Enter" || event.key === " ")
handleToggleFavorite(theme, event as any);
}}
role="button" role="button"
tabindex="-1" tabindex="-1"
title={cloudLoggedIn title={cloudLoggedIn ? ((favoriteStatus[theme.id] ?? false) ? 'Remove from favorites' : 'Add to favorites') : 'Sign in to favorite themes'}
? (favoriteStatus[theme.id] ?? false)
? "Remove from favorites"
: "Add to favorites"
: "Sign in to favorite themes"}
> >
<HeartIcon <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill={(favoriteStatus[theme.id] ?? false) ? 'currentColor' : 'none'} stroke="currentColor" stroke-width="2" class="h-5 w-5">
class="h-5 w-5" <path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />
fill={(favoriteStatus[theme.id] ?? false) ? "currentColor" : "none"} </svg>
/>
</div> </div>
{/if} {/if}
<div <div
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white/80" class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white/80"
onclick={(event) => { onclick={(event) => { event.stopPropagation(); handleShareTheme(theme) }}
event.stopPropagation(); onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') handleShareTheme(theme) }}
handleShareTheme(theme);
}}
onkeydown={(event) => {
if (event.key === "Enter" || event.key === " ") handleShareTheme(theme);
}}
role="button" role="button"
tabindex="-1" tabindex="-1"
title="Export theme" title="Export theme"
> >
<UploadIcon size="1em" class="text-lg" /> <span class="text-lg font-IconFamily">&#xecb3;</span>
</div> </div>
{#if isLocalCustomTheme(theme)} {#if isLocalCustomTheme(theme)}
<div <div
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white" class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white"
onclick={(event) => { onclick={(event) => { event.stopPropagation(); void openThemeCreator(theme.id) }}
event.stopPropagation(); onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') void openThemeCreator(theme.id) }}
void openThemeCreator(theme.id);
}}
onkeydown={(event) => {
if (event.key === "Enter" || event.key === " ") void openThemeCreator(theme.id);
}}
role="button" role="button"
tabindex="-1" tabindex="-1"
title="Edit theme" title="Edit theme"
> >
<PencilIcon size="1em" class="text-lg" /> <span class="text-lg font-IconFamily">&#xeaa5;</span>
</div> </div>
<div <div
class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white {submittingThemeId === class="flex h-8 w-8 place-items-center rounded-full bg-black/50 p-2 text-white {submittingThemeId === theme.id ? 'opacity-60' : ''}"
theme.id
? 'opacity-60'
: ''}"
onclick={(event) => void submitCustomTheme(theme, event)} onclick={(event) => void submitCustomTheme(theme, event)}
onkeydown={(event) => { onkeydown={(event) => { if (event.key === 'Enter' || event.key === ' ') void submitCustomTheme(theme, event as unknown as MouseEvent) }}
if (event.key === "Enter" || event.key === " ")
void submitCustomTheme(theme, event as unknown as MouseEvent);
}}
role="button" role="button"
tabindex="-1" tabindex="-1"
title="Submit to community" title="Submit to community"
> >
<CloudUploadIcon size="1em" class="text-lg" /> <span class="text-lg font-IconFamily">&#xe9fc;</span>
</div> </div>
{/if} {/if}
</div> </div>
{/if} {/if}
<div <div class="relative top-0 z-10 flex justify-center w-full h-full overflow-hidden transition dark:text-white rounded-xl group place-items-center bg-zinc-100 dark:bg-zinc-900 { isEditMode ? 'animate-shake brightness-90' : ''}">
class="relative top-0 z-10 flex justify-center w-full h-full overflow-hidden transition dark:text-white rounded-xl group place-items-center bg-zinc-100 dark:bg-zinc-900 {isEditMode
? 'animate-shake brightness-90'
: ''}"
>
{#if theme.coverImage} {#if theme.coverImage}
<ThemeBlobImage <ThemeBlobImage
source={theme.coverImage} source={theme.coverImage}
@@ -306,31 +256,18 @@
{/if} {/if}
{#if themes && themes.themes.length === 0} {#if themes && themes.themes.length === 0}
<div <div class="flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center {useTwoColumnLayout ? 'col-span-2' : ''}">
class="flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center {useTwoColumnLayout
? 'col-span-2'
: ''}"
>
<h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance"> <h3 class="text-xl font-semibold text-zinc-900 dark:text-white" style="text-wrap: balance">
No themes installed No themes installed
</h3> </h3>
<p <p class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400" style="text-wrap: pretty">
class="mt-2 max-w-md text-base text-zinc-500 dark:text-zinc-400"
style="text-wrap: pretty"
>
Install a theme from the store or create one of your own. Install a theme from the store or create one of your own.
</p> </p>
</div> </div>
{/if} {/if}
{#if submitError} {#if submitError}
<p <p class="whitespace-pre-line text-sm text-red-600 dark:text-red-400 {useTwoColumnLayout ? 'col-span-2' : ''}">{submitError}</p>
class="whitespace-pre-line text-sm text-red-600 dark:text-red-400 {useTwoColumnLayout
? 'col-span-2'
: ''}"
>
{submitError}
</p>
{/if} {/if}
{#if themes && showNavigation} {#if themes && showNavigation}
@@ -340,7 +277,7 @@
onclick={() => void openStorePage()} onclick={() => void openStorePage()}
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white" class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
> >
<ShoppingCartIcon size="1em" class="text-xl" /> <span class="text-xl font-IconFamily">&#xecc5;</span>
<span class="ml-2">Theme Store</span> <span class="ml-2">Theme Store</span>
</button> </button>
@@ -348,7 +285,7 @@
onclick={() => void openThemeCreator()} onclick={() => void openThemeCreator()}
class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white" class="flex justify-center items-center w-full rounded-xl transition aspect-theme bg-zinc-100 dark:bg-zinc-900 dark:text-white"
> >
<PlusIcon size="1em" class="text-xl" /> <span class="text-xl font-IconFamily">&#xec60;</span>
<span class="ml-2">Create your own</span> <span class="ml-2">Create your own</span>
</button> </button>
{/if} {/if}
+41 -14
View File
@@ -1,10 +1,4 @@
<script lang="ts"> <script lang="ts">
import MessageSquareIcon from "@lucide/svelte/icons/message-square";
import SearchIcon from "@lucide/svelte/icons/search";
import InfoIcon from "@lucide/svelte/icons/info";
import Maximize2Icon from "@lucide/svelte/icons/maximize-2";
import MegaphoneIcon from "@lucide/svelte/icons/megaphone";
import ShieldIcon from "@lucide/svelte/icons/shield";
import TabbedContainer from "../components/TabbedContainer.svelte"; import TabbedContainer from "../components/TabbedContainer.svelte";
import LazyPanel from "../components/LazyPanel.svelte"; import LazyPanel from "../components/LazyPanel.svelte";
import darkLogo from "@/resources/icons/betterseqta-dark-full.png"; import darkLogo from "@/resources/icons/betterseqta-dark-full.png";
@@ -483,9 +477,9 @@
}; };
const utilityActions = [ const utilityActions = [
{ label: "About", icon: InfoIcon, onclick: openAbout }, { label: "About", icon: "\ueb73", onclick: openAbout },
{ label: "What's new", icon: MegaphoneIcon, onclick: openChangelog }, { label: "What's new", icon: "\ue929", onclick: openChangelog },
{ label: "Privacy", icon: ShieldIcon, onclick: openPrivacyStatement }, { label: "Privacy", icon: "\uecba", onclick: openPrivacyStatement },
] as const; ] as const;
onMount(() => { onMount(() => {
@@ -584,9 +578,20 @@
{#if activePage === "settings"} {#if activePage === "settings"}
<label class="relative mb-4 block shrink-0"> <label class="relative mb-4 block shrink-0">
<span class="sr-only">Search settings</span> <span class="sr-only">Search settings</span>
<SearchIcon <svg
class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400" class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"
/> fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="m21 21-4.35-4.35m1.35-5.65a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"
/>
</svg>
<input <input
type="search" type="search"
placeholder="Search settings" placeholder="Search settings"
@@ -625,7 +630,7 @@
onclick={action.onclick} 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] dark:text-zinc-300 dark:hover:bg-zinc-700/70 dark:hover:text-white" 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"
> >
<action.icon size={18} class="shrink-0" /> <span class="w-5 text-center font-IconFamily text-[18px]" aria-hidden="true">{action.icon}</span>
<span>{action.label}</span> <span>{action.label}</span>
</button> </button>
{/each} {/each}
@@ -635,7 +640,18 @@
onclick={() => openFeedback()} 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] dark:bg-zinc-800/80 dark:text-zinc-200 dark:hover:bg-zinc-700" 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"
> >
<MessageSquareIcon class="w-5 h-5 shrink-0" /> <svg
class="w-5 h-5 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
</svg>
<span>Send us feedback!</span> <span>Send us feedback!</span>
</button> </button>
</div> </div>
@@ -762,7 +778,18 @@
title="Expand settings" title="Expand settings"
aria-expanded="false" aria-expanded="false"
> >
<Maximize2Icon size="1em" class="text-2xl" /> <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> </button>
{/if} {/if}
</div> </div>
+91 -101
View File
@@ -1,12 +1,10 @@
<script lang="ts"> <script lang="ts">
import XIcon from "@lucide/svelte/icons/x"; import MotionDiv from '@/interface/components/MotionDiv.svelte';
import UploadIcon from "@lucide/svelte/icons/upload"; import { settingsState } from "@/seqta/utils/listeners/settingsState.ts"
import MotionDiv from "@/interface/components/MotionDiv.svelte"; import Switch from "@/interface/components/Switch.svelte"
import { settingsState } from "@/seqta/utils/listeners/settingsState.ts"; import Button from "@/interface/components/Button.svelte"
import Switch from "@/interface/components/Switch.svelte"; import { onMount } from 'svelte';
import Button from "@/interface/components/Button.svelte"; import Shortcuts from "@/seqta/content/links.json"
import { onMount } from "svelte";
import Shortcuts from "@/seqta/content/links.json";
let { searchQuery = "" }: { searchQuery?: string } = $props(); let { searchQuery = "" }: { searchQuery?: string } = $props();
const q = $derived(searchQuery.trim().toLowerCase()); const q = $derived(searchQuery.trim().toLowerCase());
@@ -31,14 +29,19 @@
const switchChange = (shortcut: any) => { const switchChange = (shortcut: any) => {
const current = settingsState.shortcuts ?? []; const current = settingsState.shortcuts ?? [];
const idx = current.findIndex((s) => s.name === shortcut); const idx = current.findIndex(s => s.name === shortcut);
if (idx !== -1) { if (idx !== -1) {
const updated = current.map((s) => (s.name === shortcut ? { ...s, enabled: !s.enabled } : s)); const updated = current.map(s =>
s.name === shortcut ? { ...s, enabled: !s.enabled } : s
);
settingsState.setKey("shortcuts", updated); settingsState.setKey("shortcuts", updated);
} else { } else {
settingsState.setKey("shortcuts", [...current, { name: shortcut, enabled: true }]); settingsState.setKey("shortcuts", [
...current,
{ name: shortcut, enabled: true },
]);
} }
}; }
let isFormVisible = $state(false); let isFormVisible = $state(false);
let newTitle = $state(""); let newTitle = $state("");
@@ -73,12 +76,9 @@
}; };
const isValidTitle = (title: string) => title.trim() !== ""; const isValidTitle = (title: string) => title.trim() !== "";
const isValidURL = (url: string) => { const isValidURL = (url: string) => {
const pattern = new RegExp( const pattern = new RegExp("^(https?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\-]+)*(?::\\d+)?(/[\\w\\-./]*)*$", "i");
"^(https?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\-]+)*(?::\\d+)?(/[\\w\\-./]*)*$",
"i",
);
return pattern.test(url); return pattern.test(url);
}; };
@@ -111,37 +111,37 @@
<div class="flex flex-col pt-4 divide-y divide-zinc-100 dark:divide-zinc-700"> <div class="flex flex-col pt-4 divide-y divide-zinc-100 dark:divide-zinc-700">
{#if isLoaded} {#if isLoaded}
{#if !q} {#if !q}
<div> <div>
<MotionDiv <MotionDiv
initial={{ opacity: 0, height: 0 }} initial={{ opacity: 0, height: 0 }}
animate={isFormVisible ? { opacity: 1, height: "auto" } : { opacity: 0, height: 0 }} animate={isFormVisible ? { opacity: 1, height: 'auto' } : { opacity: 0, height: 0 }}
exit={{ opacity: 0, height: 0 }} exit={{ opacity: 0, height: 0 }}
transition={{ transition={{
type: "spring", type: 'spring',
config: { stiffness: 400, damping: 25 }, config: { stiffness: 400, damping: 25 }
}} }}
> >
{#if isFormVisible} {#if isFormVisible}
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<MotionDiv <MotionDiv
initial={{ opacity: 0, y: -10 }} initial={{ opacity: 0, y: -10 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0, duration: 0.2 }} transition={{ delay: 0, duration: 0.2 }}
class="w-full" class="w-full"
> >
<input <input
class="p-2 w-full rounded-lg border-0 transition placeholder-zinc-300 bg-zinc-100 dark:bg-zinc-700 focus:bg-zinc-200/50 dark:focus:bg-zinc-600" class="p-2 w-full rounded-lg border-0 transition placeholder-zinc-300 bg-zinc-100 dark:bg-zinc-700 focus:bg-zinc-200/50 dark:focus:bg-zinc-600"
type="text" type="text"
placeholder="Shortcut Name" placeholder="Shortcut Name"
bind:value={newTitle} bind:value={newTitle}
/> />
</MotionDiv> </MotionDiv>
<MotionDiv <MotionDiv
initial={{ opacity: 0, y: -10 }} initial={{ opacity: 0, y: -10 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.05, duration: 0.2 }} transition={{ delay: 0.05, duration: 0.2 }}
class="flex gap-2 w-full" class="flex gap-2 w-full"
> >
<input <input
class="p-2 my-2 w-full rounded-lg border-0 transition placeholder-zinc-300 bg-zinc-100 dark:bg-zinc-700 focus:bg-zinc-200/50 dark:focus:bg-zinc-600" class="p-2 my-2 w-full rounded-lg border-0 transition placeholder-zinc-300 bg-zinc-100 dark:bg-zinc-700 focus:bg-zinc-200/50 dark:focus:bg-zinc-600"
type="text" type="text"
@@ -164,11 +164,7 @@
{#if newIcon} {#if newIcon}
<div class="flex overflow-hidden items-center"> <div class="flex overflow-hidden items-center">
<div class="shrink-0 mr-2 w-6 h-6"> <div class="shrink-0 mr-2 w-6 h-6">
<img <img src={`data:image/svg+xml;base64,${btoa(newIcon)}`} alt="Selected Icon" class="object-contain w-full h-full" />
src={`data:image/svg+xml;base64,${btoa(newIcon)}`}
alt="Selected Icon"
class="object-contain w-full h-full"
/>
</div> </div>
<span class="truncate">Selected Icon</span> <span class="truncate">Selected Icon</span>
</div> </div>
@@ -177,76 +173,70 @@
aria-label="Clear icon" aria-label="Clear icon"
role="button" role="button"
tabindex="0" tabindex="0"
onclick={(event) => { onclick={(event) => { event.stopPropagation(); clearIcon(); }}
event.stopPropagation();
clearIcon();
}}
onkeydown={(event) => { onkeydown={(event) => {
if (event.key === "Enter" || event.key === " ") { if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault(); event.preventDefault();
clearIcon(); clearIcon();
} }
}} }}
> >
<XIcon class="w-4 h-4" /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</span> </span>
{:else} {:else}
<UploadIcon size="1em" /> <span class="font-IconFamily">{ '\ued47' }</span>
<span class="ml-2" <span class="ml-2">SVG icon <span class="text-xs italic text-zinc-400 dark:text-zinc-500">(Optional)</span></span>
>SVG icon <span class="text-xs italic text-zinc-400 dark:text-zinc-500"
>(Optional)</span
></span
>
{/if} {/if}
</button> </button>
</MotionDiv> </MotionDiv>
</div> </div>
{/if} {/if}
</MotionDiv> </MotionDiv>
<MotionDiv <MotionDiv
initial={{ opacity: 0, y: 20 }} initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.3 }} transition={{ duration: 0.3 }}
> >
<Button <Button
class="w-full mb-4" class="w-full mb-4"
text={isFormVisible ? "Add" : "Add Custom Shortcut"} text={isFormVisible ? "Add" : "Add Custom Shortcut"}
onClick={isFormVisible ? addNewCustomShortcut : toggleForm} onClick={isFormVisible ? addNewCustomShortcut : toggleForm}
/> />
</MotionDiv> </MotionDiv>
</div> </div>
{/if} {/if}
<!-- Custom Shortcuts Section --> <!-- Custom Shortcuts Section -->
{#each $settingsState.customshortcuts ?? [] as shortcut, index} {#each ($settingsState.customshortcuts ?? []) as shortcut, index}
{#if !q || shortcut.name.toLowerCase().includes(q)} {#if !q || shortcut.name.toLowerCase().includes(q)}
<div class="flex justify-between items-center px-4 py-3"> <div class="flex justify-between items-center px-4 py-3">
{shortcut.name} {shortcut.name}
<button aria-label="Delete Shortcut" onclick={() => deleteCustomShortcut(index)}> <button aria-label="Delete Shortcut" onclick={() => deleteCustomShortcut(index)}>
<XIcon class="w-6 h-6" /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-6 h-6">
</button> <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</div> </svg>
</button>
</div>
{/if} {/if}
{/each} {/each}
{#each Object.entries(Shortcuts) as shortcut} {#each Object.entries(Shortcuts) as shortcut}
{#if !q || shortcut[1].DisplayName?.toLowerCase().includes(q) || shortcut[0] {#if !q || shortcut[1].DisplayName?.toLowerCase().includes(q) || shortcut[0].toLowerCase().includes(q)}
.toLowerCase() <div class="flex justify-between items-center px-4 py-3">
.includes(q)} <div class="pr-4">
<div class="flex justify-between items-center px-4 py-3"> <!-- Use DisplayName if it exists, otherwise use the key (shortcut[0]) as a fallback -->
<div class="pr-4"> <h2 class="text-lg font-medium">{shortcut[1].DisplayName || shortcut[0]}</h2>
<!-- Use DisplayName if it exists, otherwise use the key (shortcut[0]) as a fallback -->
<h2 class="text-lg font-medium">{shortcut[1].DisplayName || shortcut[0]}</h2>
</div>
<Switch
state={$settingsState.shortcuts.find((s) => s.name === shortcut[0])?.enabled ?? false}
onChange={() => switchChange(shortcut[0])}
/>
</div> </div>
<Switch state={$settingsState.shortcuts.find(s => s.name === shortcut[0])?.enabled ?? false} onChange={() => switchChange(shortcut[0])} />
</div>
{/if} {/if}
{/each} {/each}
{:else} {:else}
<div class="p-4 text-center">Loading shortcuts...</div> <div class="p-4 text-center">
Loading shortcuts...
</div>
{/if} {/if}
</div> </div>
+17 -24
View File
@@ -1,20 +1,16 @@
<script lang="ts"> <script lang="ts">
import BackgroundSelector from "@/interface/components/themes/BackgroundSelector.svelte"; import BackgroundSelector from "@/interface/components/themes/BackgroundSelector.svelte"
import ThemeSelector from "@/interface/components/themes/ThemeSelector.svelte"; import ThemeSelector from "@/interface/components/themes/ThemeSelector.svelte"
import Button from "@/interface/components/Button.svelte"; import Button from "@/interface/components/Button.svelte"
import CheckIcon from "@lucide/svelte/icons/check"; import { standalone } from "@/interface/utils/standalone.svelte"
import PencilIcon from "@lucide/svelte/icons/pencil";
import { standalone } from "@/interface/utils/standalone.svelte";
let { let { section = "all" }: {
section = "all",
}: {
section?: "all" | "themes" | "backgrounds"; section?: "all" | "themes" | "backgrounds";
} = $props(); } = $props();
let selectedBackground = $state<string | null>(null); let selectedBackground = $state<string | null>(null);
let selectNoBackground = $state<() => void>(() => {}); let selectNoBackground = $state<() => void>(() => { });
let clearTheme = $derived(selectedBackground !== null); let clearTheme = $derived(selectedBackground !== null);
let editMode = $state<boolean>(false); let editMode = $state<boolean>(false);
let showBackgrounds = $derived(section !== "themes"); let showBackgrounds = $derived(section !== "themes");
@@ -28,12 +24,8 @@
onClick={() => selectNoBackground()} onClick={() => selectNoBackground()}
disabled={section === "backgrounds" && !clearTheme} disabled={section === "backgrounds" && !clearTheme}
text={section === "all" text={section === "all"
? clearTheme ? clearTheme ? 'Clear Theme' : 'Select a Theme'
? "Clear Theme" : clearTheme ? 'Clear Background' : 'No Background Selected'}
: "Select a Theme"
: clearTheme
? "Clear Background"
: "No Background Selected"}
class="w-full mb-4" class="w-full mb-4"
/> />
{/if} {/if}
@@ -41,25 +33,26 @@
{#if showThemes || showBackgrounds} {#if showThemes || showBackgrounds}
<div class="mb-3 flex justify-end"> <div class="mb-3 flex justify-end">
<Button <Button
onClick={() => (editMode = !editMode)} onClick={() => editMode = !editMode}
text={editMode ? "Done" : "Remove"} text={editMode ? 'Done' : 'Remove'}
icon={editMode ? CheckIcon : PencilIcon} icon={editMode ? '\ue9e4' : '\uec38'}
/> />
</div> </div>
{/if} {/if}
{#if showBackgrounds} {#if showBackgrounds}
<BackgroundSelector isEditMode={editMode} bind:selectedBackground bind:selectNoBackground /> <BackgroundSelector isEditMode={editMode} bind:selectedBackground={selectedBackground} bind:selectNoBackground={selectNoBackground} />
{/if} {/if}
{#if showThemes} {#if showThemes}
{#if section === "themes"} {#if section === "themes"}
<Button <Button
variant="primary" variant="primary"
class="w-full mb-4" class="w-full mb-4"
icon={""}
text="Open theme builder" text="Open theme builder"
onClick={() => onClick={() =>
void import("@/seqta/utils/launchPageThemeBuilder").then( void import("@/seqta/utils/launchPageThemeBuilder").then(({ launchPageThemeBuilder }) =>
({ launchPageThemeBuilder }) => launchPageThemeBuilder(), launchPageThemeBuilder(),
)} )}
/> />
{/if} {/if}
+173 -224
View File
@@ -1,62 +1,59 @@
<script lang="ts"> <script lang="ts">
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down"; import { onMount } from 'svelte';
import Maximize2Icon from "@lucide/svelte/icons/maximize-2"; import { slide } from 'svelte/transition';
import Minimize2Icon from "@lucide/svelte/icons/minimize-2"; import { fade } from 'svelte/transition';
import CircleQuestionMarkIcon from "@lucide/svelte/icons/circle-question-mark";
import PlusIcon from "@lucide/svelte/icons/plus";
import XIcon from "@lucide/svelte/icons/x";
import { onMount } from "svelte";
import { slide } from "svelte/transition";
import { fade } from "svelte/transition";
import { type LoadedCustomTheme, shouldForceThemeAppearance } from "@/types/customThemes"; import {
type LoadedCustomTheme,
shouldForceThemeAppearance,
} 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 Divider from '@/interface/components/themeCreator/divider.svelte'
import Switch from "@/interface/components/Switch.svelte"; import Switch from '@/interface/components/Switch.svelte'
import Button from "@/interface/components/Button.svelte"; import Button from '@/interface/components/Button.svelte'
import Slider from "@/interface/components/Slider.svelte"; import Slider from '@/interface/components/Slider.svelte'
import ColourPicker from "../components/ColourPicker.svelte"; import ColourPicker from '../components/ColourPicker.svelte'
import CodeEditor from "../components/CodeEditor.svelte"; import CodeEditor from '../components/CodeEditor.svelte'
import { import {
handleImageUpload, handleImageUpload,
handleRemoveImage, handleRemoveImage,
handleImageVariableChange, handleImageVariableChange,
} from "../utils/themeImageHandlers"; } from '../utils/themeImageHandlers';
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager"; import { ThemeManager } from '@/plugins/built-in/themes/theme-manager'
import { themeUpdates } from "../hooks/themeUpdates"; import { themeUpdates } from '../hooks/themeUpdates'
import { closeThemeCreator } from "@/plugins/built-in/themes/themeCreator"; import { closeThemeCreator } from '@/plugins/built-in/themes/themeCreator'
import { submitLocalThemeToCommunity } from "@/seqta/utils/customThemes/submitLocalTheme"; import { submitLocalThemeToCommunity } from '@/seqta/utils/customThemes/submitLocalTheme'
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors"; import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
import { cloudAuth } from "@/seqta/utils/cloudAuth"; import { cloudAuth } from '@/seqta/utils/cloudAuth'
import MoonIcon from "@lucide/svelte/icons/moon"; import LucideMoon from '@/interface/components/icons/LucideMoon.svelte'
import SunIcon from "@lucide/svelte/icons/sun"; import LucideSun from '@/interface/components/icons/LucideSun.svelte'
import SidebarAppearance from "@/interface/components/SidebarAppearance.svelte"; import SidebarAppearance from '@/interface/components/SidebarAppearance.svelte'
import { FONT_PRESETS, DEFAULT_FONT_ID } from "@/seqta/ui/fonts/presets"; import { FONT_PRESETS, DEFAULT_FONT_ID } from '@/seqta/ui/fonts/presets'
import { applySelectedFont, ensureFontPickerFontsLoaded } from "@/seqta/ui/fonts/fontManager"; import { applySelectedFont, ensureFontPickerFontsLoaded } from '@/seqta/ui/fonts/fontManager'
import { import {
applySidebarSettings, applySidebarSettings,
defaultThemeCreatorMeta, defaultThemeCreatorMeta,
mergeThemeWithCreatorMeta, mergeThemeWithCreatorMeta,
snapshotSidebarSettings, snapshotSidebarSettings,
} from "@/interface/utils/themeCreatorMeta"; } from '@/interface/utils/themeCreatorMeta'
import { ensureThemeCoverImage } from "@/interface/utils/themePlaceholderCover"; import { ensureThemeCoverImage } from '@/interface/utils/themePlaceholderCover'
import ThemeBlobImage from "@/interface/components/themes/ThemeBlobImage.svelte"; import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
import type { ThemeCreatorMeta } from "@/types/customThemes"; import type { ThemeCreatorMeta } from '@/types/customThemes'
const { themeID }: { themeID: string } = $props(); const { themeID }: { themeID: string } = $props()
const themeManager = ThemeManager.getInstance(); const themeManager = ThemeManager.getInstance();
let theme = $state<LoadedCustomTheme>({ let theme = $state<LoadedCustomTheme>({
id: crypto.randomUUID(), id: crypto.randomUUID(),
name: "", name: '',
description: "", description: '',
defaultColour: "blue", defaultColour: 'blue',
CanChangeColour: true, CanChangeColour: true,
allowBackgrounds: true, allowBackgrounds: true,
CustomCSS: "", CustomCSS: '',
CustomImages: [], CustomImages: [],
coverImage: null, coverImage: null,
isEditable: true, isEditable: true,
@@ -64,8 +61,8 @@
forceTheme: undefined, forceTheme: undefined,
forceDark: undefined, forceDark: undefined,
adaptiveCssVariables: [], adaptiveCssVariables: [],
}); })
let closedAccordions = $state<string[]>([]); let closedAccordions = $state<string[]>([])
let themeLoaded = $state(false); let themeLoaded = $state(false);
let codeEditorFullscreen = $state(false); let codeEditorFullscreen = $state(false);
let communityBusy = $state(false); let communityBusy = $state(false);
@@ -91,27 +88,27 @@
composeVisuals = true; composeVisuals = true;
} }
function imageUsage(imageId: string): "decorative" | "page-background" | "cover" { function imageUsage(imageId: string): 'decorative' | 'page-background' | 'cover' {
if (creatorMeta.pageBackgroundImageId === imageId) return "page-background"; if (creatorMeta.pageBackgroundImageId === imageId) return 'page-background';
const image = theme.CustomImages.find((item) => item.id === imageId); const image = theme.CustomImages.find((item) => item.id === imageId);
if (image && theme.coverImage === image.blob) return "cover"; if (image && theme.coverImage === image.blob) return 'cover';
return "decorative"; return 'decorative';
} }
function setImageUsage(imageId: string, usage: "decorative" | "page-background" | "cover") { function setImageUsage(imageId: string, usage: 'decorative' | 'page-background' | 'cover') {
const image = theme.CustomImages.find((item) => item.id === imageId); const image = theme.CustomImages.find((item) => item.id === imageId);
if (!image) return; if (!image) return;
let nextMeta = { ...creatorMeta }; let nextMeta = { ...creatorMeta };
let coverImage = theme.coverImage; let coverImage = theme.coverImage;
if (usage === "page-background") { if (usage === 'page-background') {
nextMeta = { ...nextMeta, pageBackgroundImageId: imageId }; nextMeta = { ...nextMeta, pageBackgroundImageId: imageId };
} else if (nextMeta.pageBackgroundImageId === imageId) { } else if (nextMeta.pageBackgroundImageId === imageId) {
nextMeta = { ...nextMeta, pageBackgroundImageId: null }; nextMeta = { ...nextMeta, pageBackgroundImageId: null };
} }
if (usage === "cover") { if (usage === 'cover') {
coverImage = image.blob; coverImage = image.blob;
} else if (coverImage === image.blob) { } else if (coverImage === image.blob) {
coverImage = null; coverImage = null;
@@ -140,12 +137,12 @@
function toggleAccordion(title: string, e: MouseEvent | KeyboardEvent) { function toggleAccordion(title: string, e: MouseEvent | KeyboardEvent) {
// if the target is the fullscreen button return // if the target is the fullscreen button return
if (e.target instanceof Element && e.target.closest(".fullscreen-toggle")) { if (e.target instanceof HTMLButtonElement && e.target.classList.contains('fullscreen-toggle')) {
return; return;
} }
if (closedAccordions.includes(title)) { if (closedAccordions.includes(title)) {
closedAccordions = closedAccordions.filter((t) => t !== title); closedAccordions = closedAccordions.filter(t => t !== title);
} else { } else {
closedAccordions = [...closedAccordions, title]; closedAccordions = [...closedAccordions, title];
} }
@@ -194,7 +191,9 @@
theme = { theme = {
...tempTheme, ...tempTheme,
adaptiveCssVariables: tempTheme.adaptiveCssVariables ?? [], adaptiveCssVariables: tempTheme.adaptiveCssVariables ?? [],
forceTheme: tempTheme.forceTheme ?? (tempTheme.forceDark !== undefined ? true : undefined), forceTheme:
tempTheme.forceTheme ??
(tempTheme.forceDark !== undefined ? true : undefined),
}; };
} }
@@ -278,30 +277,13 @@
void themeManager.updatePreviewDebounced(snapshot); void themeManager.updatePreviewDebounced(snapshot);
}); });
type SettingType = type SettingType = 'switch' | 'button' | 'slider' | 'select' | 'codeEditor' | 'imageUpload' | 'conditional' | 'lightDarkToggle';
| "switch"
| "button"
| "slider"
| "select"
| "codeEditor"
| "imageUpload"
| "conditional"
| "lightDarkToggle";
type SwitchProps = { state: boolean; onChange: (value: boolean) => void }; type SwitchProps = { state: boolean; onChange: (value: boolean) => void };
type ButtonProps = { onClick: () => void; text: string }; type ButtonProps = { onClick: () => void; text: string };
type SliderProps = { type SliderProps = { state: number; onChange: (value: number) => void; min?: number; max?: number };
state: number;
onChange: (value: number) => void;
min?: number;
max?: number;
};
type SelectProps = { type SelectProps = { options: Array<{ value: string; label: string }>; value: string; onChange: (value: string) => void };
options: Array<{ value: string; label: string }>;
value: string;
onChange: (value: string) => void;
};
type CodeEditorProps = { value: string; onChange: (value: string) => void }; type CodeEditorProps = { value: string; onChange: (value: string) => void };
type LightDarkToggleProps = { state: boolean; onChange: (value: boolean) => void }; type LightDarkToggleProps = { state: boolean; onChange: (value: boolean) => void };
@@ -310,107 +292,73 @@
children: SettingItem; children: SettingItem;
}; };
type ComponentProps = type ComponentProps = SwitchProps | ButtonProps | SliderProps | SelectProps | CodeEditorProps | LightDarkToggleProps | ConditionalProps;
| SwitchProps
| ButtonProps
| SliderProps
| SelectProps
| CodeEditorProps
| LightDarkToggleProps
| ConditionalProps;
type SettingItem = { type SettingItem = {
type: SettingType; type: SettingType;
title: string; title: string;
description: string; description: string;
direction?: "horizontal" | "vertical"; direction?: 'horizontal' | 'vertical';
props: ComponentProps; props: ComponentProps;
}; };
</script> </script>
{#snippet settingItem(item: SettingItem)} {#snippet settingItem(item: SettingItem)}
{#if item.type === "conditional"} {#if item.type === 'conditional'}
{#if (item.props as ConditionalProps).condition} {#if (item.props as ConditionalProps).condition }
<div transition:slide={{ duration: 300 }}> <div transition:slide={{ duration: 300 }}>
{@render settingItem((item.props as ConditionalProps).children)} {@render settingItem((item.props as ConditionalProps).children)}
</div> </div>
{/if} {/if}
{:else} {:else}
<div <div class="flex justify-between {item.direction === 'vertical' ? 'flex-col items-start' : 'items-center'} py-3">
class="flex justify-between {item.direction === 'vertical'
? 'flex-col items-start'
: 'items-center'} py-3"
>
<!-- svelte-ignore a11y_no_static_element_interactions --> <!-- svelte-ignore a11y_no_static_element_interactions -->
<div <div
onclick={(e) => { onclick={(e) => { item.direction === 'vertical' && toggleAccordion(item.title, e) }}
item.direction === "vertical" && toggleAccordion(item.title, e); onkeydown={(e) => { e.key === 'Enter' && item.direction === 'vertical' && toggleAccordion(item.title, e) }}
}} class="flex justify-between pr-4 {item.direction === 'vertical' ? 'cursor-pointer w-full select-none' : ''}">
onkeydown={(e) => {
e.key === "Enter" && item.direction === "vertical" && toggleAccordion(item.title, e);
}}
class="flex justify-between pr-4 {item.direction === 'vertical'
? 'cursor-pointer w-full select-none'
: ''}"
>
<div> <div>
<h2 class="text-sm font-bold">{item.title}</h2> <h2 class="text-sm font-bold">{item.title}</h2>
<p class="text-xs">{item.description}</p> <p class="text-xs">{item.description}</p>
</div> </div>
{#if item.direction === "vertical"} {#if item.direction === 'vertical'}
<div <div class="flex justify-center items-center h-full text-xl font-light text-zinc-500 dark:text-zinc-300">
class="flex justify-center items-center h-full text-xl font-light text-zinc-500 dark:text-zinc-300" {#if item.type === 'codeEditor'}
>
{#if item.type === "codeEditor"}
<!-- Fullscreen toggle button --> <!-- Fullscreen toggle button -->
<button <button onclick={toggleCodeEditorFullscreen} class="px-2 mr-2 text-lg font-IconFamily fullscreen-toggle">
onclick={toggleCodeEditorFullscreen} {'\uebdb'}
class="px-2 mr-2 text-lg fullscreen-toggle"
aria-label="Expand editor"
>
<Maximize2Icon size="1em" />
</button> </button>
{/if} {/if}
<ChevronDownIcon <span class='font-IconFamily transition-transform duration-300 {closedAccordions.includes(item.title) ? 'rotate-180' : ''}'>{'\ue9e6'}</span>
size="1em"
class="transition-transform duration-300 {closedAccordions.includes(item.title)
? 'rotate-180'
: ''}"
/>
</div> </div>
{/if} {/if}
</div> </div>
{#if !closedAccordions.includes(item.title)} {#if !closedAccordions.includes(item.title)}
<div <div class="{item.direction === 'vertical' ? 'w-full mt-2' : ''}" transition:slide={{ duration: 300 }}>
class={item.direction === "vertical" ? "w-full mt-2" : ""} {#if item.type === 'switch'}
transition:slide={{ duration: 300 }} <Switch {...(item.props as SwitchProps)} />
> {:else if item.type === 'button'}
{#if item.type === "switch"} <Button {...(item.props as ButtonProps)} />
<Switch {...item.props as SwitchProps} /> {:else if item.type === 'slider'}
{:else if item.type === "button"} <Slider {...(item.props as SliderProps)} />
<Button {...item.props as ButtonProps} />
{:else if item.type === "slider"} {:else if item.type === 'codeEditor'}
<Slider {...item.props as SliderProps} />
{:else if item.type === "codeEditor"}
{#if !codeEditorFullscreen} {#if !codeEditorFullscreen}
{#key themeLoaded} {#key themeLoaded}
<!-- Only render inline if not fullscreen --> <!-- Only render inline if not fullscreen -->
<CodeEditor className="h-[400px]" {...item.props as CodeEditorProps} /> <CodeEditor className="h-[400px]" {...(item.props as CodeEditorProps)} />
{/key} {/key}
{/if} {/if}
{:else if item.type === "imageUpload"} {:else if item.type === 'imageUpload'}
{#each theme.CustomImages as image (image.id)} {#each theme.CustomImages as image (image.id)}
<div class="mb-4 space-y-2 rounded-lg bg-white px-2 py-2 shadow-lg dark:bg-zinc-700"> <div class="mb-4 space-y-2 rounded-lg bg-white px-2 py-2 shadow-lg dark:bg-zinc-700">
<div class="flex h-16 items-center gap-2"> <div class="flex h-16 items-center gap-2">
<div class="h-full"> <div class="h-full">
<ThemeBlobImage <ThemeBlobImage source={image.blob} alt={image.variableName} class="object-contain h-full rounded-sm" />
source={image.blob}
alt={image.variableName}
class="object-contain h-full rounded-sm"
/>
</div> </div>
<input <input
type="text" type="text"
@@ -419,12 +367,8 @@
placeholder="CSS variable name" placeholder="CSS variable name"
class="grow flex-3 rounded-lg border-0 bg-zinc-200 p-2 transition dark:bg-zinc-600/50 dark:placeholder-zinc-300 focus:bg-zinc-300/50 dark:focus:bg-zinc-600" class="grow flex-3 rounded-lg border-0 bg-zinc-200 p-2 transition dark:bg-zinc-600/50 dark:placeholder-zinc-300 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
/> />
<button <button onclick={() => onRemoveImage(image.id)} class="p-2 transition dark:text-white" type="button">
onclick={() => onRemoveImage(image.id)} <span class='text-xl font-IconFamily'>{'\ued8c'}</span>
class="p-2 transition dark:text-white"
type="button"
>
<XIcon size="1em" class="text-xl" />
</button> </button>
</div> </div>
<label class="block text-xs text-zinc-600 dark:text-zinc-300"> <label class="block text-xs text-zinc-600 dark:text-zinc-300">
@@ -433,10 +377,7 @@
class="mt-1 w-full rounded-lg border-0 bg-zinc-200 px-2 py-1.5 text-sm dark:bg-zinc-600" class="mt-1 w-full rounded-lg border-0 bg-zinc-200 px-2 py-1.5 text-sm dark:bg-zinc-600"
value={imageUsage(image.id)} value={imageUsage(image.id)}
onchange={(e) => onchange={(e) =>
setImageUsage( setImageUsage(image.id, e.currentTarget.value as 'decorative' | 'page-background' | 'cover')}
image.id,
e.currentTarget.value as "decorative" | "page-background" | "cover",
)}
> >
<option value="decorative">Decorative (CSS variable only)</option> <option value="decorative">Decorative (CSS variable only)</option>
<option value="page-background">SEQTA page background</option> <option value="page-background">SEQTA page background</option>
@@ -445,26 +386,16 @@
</label> </label>
</div> </div>
{/each} {/each}
<div <div class="flex overflow-hidden relative gap-1 justify-center place-items-center w-full h-8 rounded-lg transition bg-zinc-200 dark:bg-zinc-700">
class="flex overflow-hidden relative gap-1 justify-center place-items-center w-full h-8 rounded-lg transition bg-zinc-200 dark:bg-zinc-700" <span class='font-IconFamily'>{'\uec60'}</span>
> <span class='dark:text-white'>Add image</span>
<PlusIcon size="1em" /> <input type="file" accept='image/*' onchange={onImageUpload} class="absolute inset-0 w-full h-full opacity-0 cursor-pointer" />
<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> </div>
{:else if item.type === "lightDarkToggle"} {:else if item.type === 'lightDarkToggle'}
<button <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" 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"
onclick={() => onclick={() => (item.props as LightDarkToggleProps).onChange(!(item.props as LightDarkToggleProps).state)}
(item.props as LightDarkToggleProps).onChange(
!(item.props as LightDarkToggleProps).state,
)}
> >
{#key (item.props as LightDarkToggleProps).state} {#key (item.props as LightDarkToggleProps).state}
<span <span
@@ -473,13 +404,13 @@
out:fade={{ duration: 150 }} out:fade={{ duration: 150 }}
> >
{#if (item.props as LightDarkToggleProps).state} {#if (item.props as LightDarkToggleProps).state}
<MoonIcon class="w-5 h-5" /> <LucideMoon class="w-5 h-5" />
{:else} {:else}
<SunIcon class="w-5 h-5" /> <LucideSun class="w-5 h-5" />
{/if} {/if}
</span> </span>
{/key} {/key}
<span class="opacity-0 inline-flex"><MoonIcon class="w-5 h-5" /></span> <span class="opacity-0 inline-flex"><LucideMoon class="w-5 h-5" /></span>
</button> </button>
{/if} {/if}
</div> </div>
@@ -494,11 +425,7 @@
<div class="sticky top-0 px-2 h-screen"> <div class="sticky top-0 px-2 h-screen">
<div class="flex justify-between items-center my-4"> <div class="flex justify-between items-center my-4">
<h2 class="text-xl font-bold">Custom CSS</h2> <h2 class="text-xl font-bold">Custom CSS</h2>
<button <button onclick={toggleCodeEditorFullscreen} class="pr-14 text-xl font-IconFamily">{'\uec06'}</button>
onclick={toggleCodeEditorFullscreen}
class="pr-14 text-xl"
aria-label="Collapse editor"><Minimize2Icon size="1em" /></button
>
</div> </div>
<CodeEditor <CodeEditor
className="editorHeight" className="editorHeight"
@@ -508,9 +435,8 @@
</div> </div>
</div> </div>
{/if} {/if}
<div <div class="relative flex min-h-full w-full flex-col bg-zinc-100 p-2 text-zinc-900 dark:bg-zinc-800 dark:text-white">
class="relative flex min-h-full w-full flex-col bg-zinc-100 p-2 text-zinc-900 dark:bg-zinc-800 dark:text-white"
>
<div class="mb-2 flex items-start justify-between gap-2"> <div class="mb-2 flex items-start justify-between gap-2">
<h1 class="text-xl font-semibold">Theme Creator</h1> <h1 class="text-xl font-semibold">Theme Creator</h1>
<button <button
@@ -519,51 +445,42 @@
aria-label="Close theme creator" aria-label="Close theme creator"
onclick={() => void closeThemeCreator()} onclick={() => void closeThemeCreator()}
> >
<XIcon size="1em" /> ✕
</button> </button>
</div> </div>
<a <a href='https://docs.betterseqta.org/theme-creation/' target='_blank' rel='noopener noreferrer' class='text-sm font-light text-zinc-500 dark:text-zinc-400'>
href="https://docs.betterseqta.org/theme-creation/" <span class='pr-0.5 no-underline font-IconFamily'>{'\ueb44'}</span>
target="_blank" <span class='underline'>
rel="noopener noreferrer" Need help? Check out the docs!
class="text-sm font-light text-zinc-500 dark:text-zinc-400" </span>
>
<CircleQuestionMarkIcon size="1em" class="pr-0.5" />
<span class="underline"> Need help? Check out the docs! </span>
</a> </a>
<Divider /> <Divider />
<div> <div>
<div class="pb-2 text-sm">Theme Name</div> <div class='pb-2 text-sm'>Theme Name</div>
<input <input
id="themeName" id='themeName'
type="text" type='text'
placeholder="What is your theme called?" placeholder='What is your theme called?'
bind:value={theme.name} bind:value={theme.name}
class="p-2 mb-4 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600" class='p-2 mb-4 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600' />
/>
</div> </div>
<div> <div>
<div class="pb-2 text-sm"> <div class='pb-2 text-sm'>Description <span class='italic font-light opacity-80'>(optional)</span></div>
Description <span class="italic font-light opacity-80">(optional)</span>
</div>
<textarea <textarea
id="themeDescription" id='themeDescription'
placeholder="Don't worry, this one's optional!" placeholder="Don't worry, this one's optional!"
bind:value={theme.description} bind:value={theme.description}
class="p-2 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600" class='p-2 w-full rounded-lg border-0 transition dark:placeholder-zinc-300 bg-zinc-200 dark:bg-zinc-700 focus:outline-hidden focus:ring-1 focus:ring-zinc-100 dark:focus:ring-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600'></textarea>
></textarea>
</div> </div>
<Divider /> <Divider />
<div class="py-3"> <div class="py-3">
<h2 class="text-sm font-bold">Accent colour</h2> <h2 class="text-sm font-bold">Accent colour</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-400"> <p class="text-xs text-zinc-600 dark:text-zinc-400">Default accent and gradient start colour.</p>
Default accent and gradient start colour.
</p>
<div class="mt-2"> <div class="mt-2">
<ColourPicker <ColourPicker
savePresets={false} savePresets={false}
@@ -598,8 +515,7 @@
<div> <div>
<h2 class="text-sm font-bold">Images &amp; page background</h2> <h2 class="text-sm font-bold">Images &amp; page background</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-400"> <p class="text-xs text-zinc-600 dark:text-zinc-400">
Upload images, then choose how each one is used. Set one as the live SEQTA page background Upload images, then choose how each one is used. Set one as the live SEQTA page background to preview it on the main page.
to preview it on the main page.
</p> </p>
</div> </div>
@@ -614,22 +530,15 @@
placeholder="CSS variable" placeholder="CSS variable"
class="min-w-0 flex-1 rounded-lg border-0 bg-zinc-100 p-2 text-sm dark:bg-zinc-600 dark:text-white" class="min-w-0 flex-1 rounded-lg border-0 bg-zinc-100 p-2 text-sm dark:bg-zinc-600 dark:text-white"
/> />
<button <button type="button" class="p-2 dark:text-white" onclick={() => onRemoveImage(image.id)}>
type="button" <span class="text-xl font-IconFamily">{'\ued8c'}</span>
class="p-2 dark:text-white"
onclick={() => onRemoveImage(image.id)}
>
<XIcon size="1em" class="text-xl" />
</button> </button>
</div> </div>
<select <select
class="w-full rounded-lg border-0 bg-zinc-100 px-2 py-1.5 text-sm dark:bg-zinc-600" class="w-full rounded-lg border-0 bg-zinc-100 px-2 py-1.5 text-sm dark:bg-zinc-600"
value={imageUsage(image.id)} value={imageUsage(image.id)}
onchange={(e) => onchange={(e) =>
setImageUsage( setImageUsage(image.id, e.currentTarget.value as 'decorative' | 'page-background' | 'cover')}
image.id,
e.currentTarget.value as "decorative" | "page-background" | "cover",
)}
> >
<option value="decorative">Decorative only (CSS variable)</option> <option value="decorative">Decorative only (CSS variable)</option>
<option value="page-background">SEQTA page background</option> <option value="page-background">SEQTA page background</option>
@@ -638,10 +547,8 @@
</div> </div>
{/each} {/each}
<label <label class="flex h-10 cursor-pointer items-center justify-center gap-2 rounded-lg bg-zinc-200 dark:bg-zinc-700">
class="flex h-10 cursor-pointer items-center justify-center gap-2 rounded-lg bg-zinc-200 dark:bg-zinc-700" <span class="font-IconFamily">{'\uec60'}</span>
>
<PlusIcon size="1em" />
<span class="text-sm dark:text-white">Add image</span> <span class="text-sm dark:text-white">Add image</span>
<input type="file" accept="image/*" class="hidden" onchange={onImageUpload} /> <input type="file" accept="image/*" class="hidden" onchange={onImageUpload} />
</label> </label>
@@ -694,14 +601,11 @@
<div class="py-3"> <div class="py-3">
<h2 class="text-sm font-bold">Adaptive CSS variables</h2> <h2 class="text-sm font-bold">Adaptive CSS variables</h2>
<p class="text-xs text-zinc-600 dark:text-zinc-400"> <p class="text-xs text-zinc-600 dark:text-zinc-400">
One per line, each must start with <code class="text-xs">--</code>. These receive the same One per line, each must start with <code class="text-xs">--</code>. These receive the same colour as the adaptive accent when &quot;Adaptive theme colour&quot; is enabled in general settings. Use them in Custom CSS, e.g. <code class="text-xs">border-color: var(--my-accent);</code>
colour as the adaptive accent when &quot;Adaptive theme colour&quot; is enabled in general
settings. Use them in Custom CSS, e.g.
<code class="text-xs">border-color: var(--my-accent);</code>
</p> </p>
<textarea <textarea
placeholder="--my-accent&#10;--class-banner" placeholder="--my-accent&#10;--class-banner"
value={theme.adaptiveCssVariables?.join("\n") ?? ""} value={theme.adaptiveCssVariables?.join('\n') ?? ''}
oninput={(e) => { oninput={(e) => {
const lines = e.currentTarget.value const lines = e.currentTarget.value
.split(/\r?\n/) .split(/\r?\n/)
@@ -709,7 +613,7 @@
.filter(Boolean); .filter(Boolean);
theme = { ...theme, adaptiveCssVariables: lines }; theme = { ...theme, adaptiveCssVariables: lines };
}} }}
class="p-2 mt-2 w-full min-h-20 font-mono text-sm rounded-lg border-0 transition dark:placeholder-zinc-400 bg-zinc-200 dark:bg-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600" class="p-2 mt-2 w-full min-h-20 font-mono text-sm rounded-lg border-0 transition dark:placeholder-zinc-400 bg-zinc-200 dark:bg-zinc-700 focus:outline-hidden focus:ring-1 focus:ring-zinc-100 dark:focus:ring-zinc-700 focus:bg-zinc-300/50 dark:focus:bg-zinc-600"
></textarea> ></textarea>
</div> </div>
@@ -721,13 +625,58 @@
<Divider /> <Divider />
{#each [{ type: "switch", title: "Hide Theme Name", description: "Useful when your cover image contains text", props: { state: theme.hideThemeName, onChange: (value: boolean) => (theme = { ...theme, hideThemeName: value }) } }, { type: "switch", title: "Force Theme", description: "Force users to use either dark or light mode", props: { state: shouldForceThemeAppearance(theme), onChange: (value: boolean) => { {#each [
if (value) { {
theme = { ...theme, forceTheme: true, forceDark: false }; type: 'switch',
} else { title: 'Hide Theme Name',
theme = { ...theme, forceTheme: false, forceDark: undefined }; description: 'Useful when your cover image contains text',
} props: {
} } }, { type: "conditional", props: { condition: shouldForceThemeAppearance(theme), children: { type: "lightDarkToggle", title: "Mode", description: "Choose whether to force light or dark mode", props: { state: theme.forceDark === true, onChange: (value: boolean) => (theme = { ...theme, forceDark: value, forceTheme: true }) } } } }, { type: "codeEditor", title: "Custom CSS", description: "Extra CSS appended after generated theme rules", direction: "vertical", props: { value: creatorMeta.userCustomCss, onChange: (value: string) => patchCreatorMeta( { userCustomCss: value } ) } }] as SettingItem[] as setting} state: theme.hideThemeName,
onChange: (value: boolean) => theme = { ...theme, hideThemeName: value }
}
},
{
type: 'switch',
title: 'Force Theme',
description: 'Force users to use either dark or light mode',
props: {
state: shouldForceThemeAppearance(theme),
onChange: (value: boolean) => {
if (value) {
theme = { ...theme, forceTheme: true, forceDark: false };
} else {
theme = { ...theme, forceTheme: false, forceDark: undefined };
}
}
}
},
{
type: 'conditional',
props: {
condition: shouldForceThemeAppearance(theme),
children: {
type: 'lightDarkToggle',
title: 'Mode',
description: 'Choose whether to force light or dark mode',
props: {
state: theme.forceDark === true,
onChange: (value: boolean) =>
(theme = { ...theme, forceDark: value, forceTheme: true })
}
}
}
},
{
type: 'codeEditor',
title: 'Custom CSS',
description: 'Extra CSS appended after generated theme rules',
direction: 'vertical',
props: {
value: creatorMeta.userCustomCss,
onChange: (value: string) => patchCreatorMeta({ userCustomCss: value })
}
}
] as SettingItem[] as setting}
{@render settingItem(setting)} {@render settingItem(setting)}
{/each} {/each}
@@ -759,4 +708,4 @@
{/if} {/if}
</div> </div>
</div> </div>
</div> </div>
-19
View File
@@ -1,19 +0,0 @@
type IconOptions = {
class?: string;
id?: string;
size?: number | string;
style?: string;
};
export function icon(svg: string, options: IconOptions = {}): string {
const size = options.size ?? 24;
let markup = svg
.trim()
.replace(/\swidth="24"/, ` width="${size}"`)
.replace(/\sheight="24"/, ` height="${size}"`)
.replace("<svg", '<svg aria-hidden="true"');
if (options.class) markup = markup.replace('class="lucide', `class="${options.class} lucide`);
if (options.id) markup = markup.replace("<svg", `<svg id="${options.id}"`);
if (options.style) markup = markup.replace("<svg", `<svg style="${options.style}"`);
return markup;
}
+5
View File
@@ -0,0 +1,5 @@
/** Material "dark_mode" moon icon — filled style to match SEQTA menu bar icons. */
export const LUCIDE_MOON_PATH =
"M12,3C7.03,3 3,7.03 3,12C3,16.97 7.03,21 12,21C16.97,21 21,16.97 21,12C21,11.54 20.96,11.08 20.9,10.64C19.92,12.01 18.32,12.9 16.5,12.9C13.52,12.9 11.1,10.48 11.1,7.5C11.1,5.68 11.99,4.08 13.36,3.1C12.92,3.04 12.46,3 12,3Z";
export const LUCIDE_MOON_ICON_SVG = `<path fill="currentColor" d="${LUCIDE_MOON_PATH}"/>`;
+5
View File
@@ -0,0 +1,5 @@
/** Material "light_mode" sun icon — filled style to match SEQTA menu bar icons. */
export const LUCIDE_SUN_PATH =
"M12,7C9.24,7 7,9.24 7,12C7,14.76 9.24,17 12,17C14.76,17 17,14.76 17,12C17,9.24 14.76,7 12,7M2,13H4C4.55,13 5,12.55 5,12C5,11.45 4.55,11 4,11H2C1.45,11 1,11.45 1,12C1,12.55 1.45,13 2,13M20,13H22C22.55,13 23,12.55 23,12C23,11.45 22.55,11 22,11H20C19.45,11 19,11.45 19,12C19,12.55 19.45,13 20,13M11,2V4C11,4.55 11.45,5 12,5C12.55,5 13,4.55 13,4V2C13,1.45 12.55,1 12,1C11.45,1 11,1.45 11,2M11,20V22C11,22.55 11.45,23 12,23C12.55,23 13,22.55 13,22V20C13,19.45 12.55,19 12,19C11.45,19 11,19.45 11,20M5.99,4.58C5.6,4.19 4.96,4.19 4.58,4.58C4.19,4.96 4.19,5.6 4.58,5.99L5.64,7.05C6.03,7.44 6.67,7.44 7.05,7.05C7.44,6.67 7.44,6.03 7.05,5.64L5.99,4.58M18.36,16.95C17.97,16.56 17.33,16.56 16.95,16.95C16.56,17.33 16.56,17.97 16.95,18.36L18.01,19.42C18.4,19.81 19.04,19.81 19.42,19.42C19.81,19.04 19.81,18.4 19.42,18.01L18.36,16.95M19.42,5.99C19.81,5.6 19.81,4.96 19.42,4.58C19.04,4.19 18.4,4.19 18.01,4.58L16.95,5.64C16.56,6.03 16.56,6.67 16.95,7.05C17.33,7.44 17.97,7.44 18.36,7.05L19.42,5.99M7.05,18.36C7.44,17.97 7.44,17.33 7.05,16.95C6.67,16.56 6.03,16.56 5.64,16.95L4.58,18.01C4.19,18.4 4.19,19.04 4.58,19.42C4.96,19.81 5.6,19.81 5.99,19.42L7.05,18.36Z";
export const LUCIDE_SUN_ICON_SVG = `<path fill="currentColor" d="${LUCIDE_SUN_PATH}"/>`;
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { RotateCw } from "lucide-static";
import type { AssessmentsAverageApi } from "./pluginApi"; import type { AssessmentsAverageApi } from "./pluginApi";
import stringToHTML from "@/seqta/utils/stringToHTML"; import stringToHTML from "@/seqta/utils/stringToHTML";
import { waitForElm } from "@/seqta/utils/waitForElm"; import { waitForElm } from "@/seqta/utils/waitForElm";
@@ -183,7 +181,7 @@ async function renderSubjectAverage(api: AssessmentsAverageApi) {
} else if (hasRefreshingWeighting) { } else if (hasRefreshingWeighting) {
warningHTML = /* html */ ` warningHTML = /* html */ `
<div style="margin-top: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.55); opacity: 0.8; line-height: 1.3; white-space: nowrap;" title="Some weightings are being re-checked; the average may change shortly"> <div style="margin-top: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.55); opacity: 0.8; line-height: 1.3; white-space: nowrap;" title="Some weightings are being re-checked; the average may change shortly">
${icon(RotateCw, { size: "1em", style: "vertical-align: -0.125em" })} Refreshing weightings ↻ Refreshing weightings
</div> </div>
`; `;
} }
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { ClipboardCopy } from "lucide-static";
import debounce from "@/seqta/utils/debounce"; import debounce from "@/seqta/utils/debounce";
const RUBRIC_SELECTOR = const RUBRIC_SELECTOR =
@@ -90,8 +88,10 @@ function ensureStyles() {
} }
.betterseqta-rubric-copy-btn:focus-visible { .betterseqta-rubric-copy-btn:focus-visible {
outline: var(--bsplus-focus-ring) !important; outline: none !important;
outline-offset: 2px !important; box-shadow:
0 0 0 2px rgba(255, 255, 255, 0.95),
0 0 0 4px rgba(59, 130, 246, 0.85) !important;
} }
.betterseqta-rubric-copy-btn svg { .betterseqta-rubric-copy-btn svg {
@@ -291,7 +291,9 @@ function createCopyButton(rubric: Element): HTMLButtonElement {
button.className = "betterseqta-rubric-copy-btn"; button.className = "betterseqta-rubric-copy-btn";
button.setAttribute("aria-label", "Copy rubric"); button.setAttribute("aria-label", "Copy rubric");
button.innerHTML = ` button.innerHTML = `
${icon(ClipboardCopy)} <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184" />
</svg>
<span class="betterseqta-rubric-copy-label">Copy rubric</span> <span class="betterseqta-rubric-copy-label">Copy rubric</span>
`; `;
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { RotateCw } from "lucide-static";
import { getUserInfo } from "@/seqta/utils/userInfo"; import { getUserInfo } from "@/seqta/utils/userInfo";
import ReactFiber from "@/seqta/utils/ReactFiber.ts"; import ReactFiber from "@/seqta/utils/ReactFiber.ts";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage"; import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
@@ -319,7 +317,7 @@ function updateWeightLabelContent(
input.placeholder = "Set %"; input.placeholder = "Set %";
input.setAttribute("aria-label", "Assessment weighting percentage"); input.setAttribute("aria-label", "Assessment weighting percentage");
input.style.cssText = input.style.cssText =
"width:52px;padding:1px 4px;border-radius:4px;border:1px solid rgba(128,128,128,0.35);background:rgba(128,128,128,0.08);color:inherit;font-size:inherit;"; "width:52px;padding:1px 4px;border-radius:4px;border:1px solid rgba(128,128,128,0.35);background:rgba(128,128,128,0.08);color:inherit;font-size:inherit;outline:none;";
attachWeightInputListeners(input, api, assessmentID); attachWeightInputListeners(input, api, assessmentID);
weightLabel.appendChild(input); weightLabel.appendChild(input);
weightLabel.title = "Enter assessment weighting %"; weightLabel.title = "Enter assessment weighting %";
@@ -329,8 +327,7 @@ function updateWeightLabelContent(
const span = document.createElement("span"); const span = document.createElement("span");
span.className = "betterseqta-weight-value"; span.className = "betterseqta-weight-value";
const baseText = weighting && weighting !== "N/A" ? formatWeightDisplay(weighting) : "N/A"; const baseText = weighting && weighting !== "N/A" ? formatWeightDisplay(weighting) : "N/A";
span.textContent = baseText; span.textContent = refreshing ? `${baseText} ↻` : baseText;
if (refreshing) span.insertAdjacentHTML("beforeend", ` ${icon(RotateCw, { size: "1em" })}`);
if (refreshing) { if (refreshing) {
span.style.opacity = "0.7"; span.style.opacity = "0.7";
weightLabel.title = "Re-checking weighting…"; weightLabel.title = "Re-checking weighting…";
@@ -1096,6 +1093,7 @@ function renderWeightingTabHtml(sheet: HTMLElement, context: WeightingTabContext
background:rgba(128,128,128,0.08); background:rgba(128,128,128,0.08);
color:inherit; color:inherit;
font-size:13px; font-size:13px;
outline:none;
" "
/> />
</div> </div>
@@ -10,15 +10,11 @@
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { settingsState } from "@/seqta/utils/listeners/settingsState";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage"; import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import { buildEngageAssessmentPagePath } from "@/seqta/utils/engageAssessmentStudent"; import { buildEngageAssessmentPagePath } from "@/seqta/utils/engageAssessmentStudent";
import CalendarDaysIcon from "@lucide/svelte/icons/calendar-days"; import OverviewIcon from "./OverviewIcon.svelte";
import ClipboardListIcon from "@lucide/svelte/icons/clipboard-list";
import EllipsisVerticalIcon from "@lucide/svelte/icons/ellipsis-vertical";
import EyeIcon from "@lucide/svelte/icons/eye";
import { import {
DEFAULT_COLUMN_ICON,
GROUP_SORT_ICONS, GROUP_SORT_ICONS,
STATUS_COLUMN_ICONS, STATUS_COLUMN_ICONS,
type OverviewIcon, type OverviewIconName,
} from "./icons"; } from "./icons";
import confetti from "canvas-confetti"; import confetti from "canvas-confetti";
@@ -34,43 +30,18 @@
key: string; key: string;
title: string; title: string;
className: string; className: string;
icon: OverviewIcon; icon: OverviewIconName;
}; };
const HIDDEN_ASSESSMENTS_KEY = "betterseqta-hidden-assessments"; const HIDDEN_ASSESSMENTS_KEY = "betterseqta-hidden-assessments";
const COMPLETED_ASSESSMENTS_KEY = "betterseqta-completed-assessments"; const COMPLETED_ASSESSMENTS_KEY = "betterseqta-completed-assessments";
const STATUS_COLUMNS: Column[] = [ const STATUS_COLUMNS: Column[] = [
{ { key: "UPCOMING", title: "Upcoming", className: "column-upcoming", icon: "calendar-days" },
key: "UPCOMING", { key: "DUE_SOON", title: "Due Soon", className: "column-due-soon", icon: "clock" },
title: "Upcoming", { key: "OVERDUE", title: "Overdue", className: "column-overdue", icon: "exclamation-triangle" },
className: "column-upcoming", { key: "SUBMITTED", title: "Submitted", className: "column-submitted", icon: "document-check" },
icon: STATUS_COLUMN_ICONS.UPCOMING, { key: "MARKS_RELEASED", title: "Marked", className: "column-marked", icon: "check-circle" },
},
{
key: "DUE_SOON",
title: "Due Soon",
className: "column-due-soon",
icon: STATUS_COLUMN_ICONS.DUE_SOON,
},
{
key: "OVERDUE",
title: "Overdue",
className: "column-overdue",
icon: STATUS_COLUMN_ICONS.OVERDUE,
},
{
key: "SUBMITTED",
title: "Submitted",
className: "column-submitted",
icon: STATUS_COLUMN_ICONS.SUBMITTED,
},
{
key: "MARKS_RELEASED",
title: "Marked",
className: "column-marked",
icon: STATUS_COLUMN_ICONS.MARKS_RELEASED,
},
]; ];
const isEngage = isSeqtaEngageExperience(); const isEngage = isSeqtaEngageExperience();
@@ -172,11 +143,7 @@
if (hiddenIds.includes(String(a.id))) return false; if (hiddenIds.includes(String(a.id))) return false;
if (subjectFilters[a.code] === false) return false; if (subjectFilters[a.code] === false) return false;
if (currentFilters.subject !== "all" && a.code !== currentFilters.subject) return false; if (currentFilters.subject !== "all" && a.code !== currentFilters.subject) return false;
if ( if (isEngage && currentFilters.student !== "all" && String(a.studentId) !== currentFilters.student) {
isEngage &&
currentFilters.student !== "all" &&
String(a.studentId) !== currentFilters.student
) {
return false; return false;
} }
return true; return true;
@@ -189,7 +156,7 @@
return { filteredAssessments: filtered, statusGroups: groups, columns: STATUS_COLUMNS }; return { filteredAssessments: filtered, statusGroups: groups, columns: STATUS_COLUMNS };
} }
const icon = GROUP_SORT_ICONS[currentFilters.sortBy] ?? DEFAULT_COLUMN_ICON; const icon = GROUP_SORT_ICONS[currentFilters.sortBy] ?? "queue-list";
const keys = Object.keys(groups); const keys = Object.keys(groups);
const subjectTitles = new Map<string, string>( const subjectTitles = new Map<string, string>(
data?.subjects?.map((s: any) => [s.code, `${s.code} - ${s.title}`]) ?? [], data?.subjects?.map((s: any) => [s.code, `${s.code} - ${s.title}`]) ?? [],
@@ -260,15 +227,7 @@
if (overdueCount === 0 && dueSoonCount === 0) { if (overdueCount === 0 && dueSoonCount === 0) {
setTimeout(() => { setTimeout(() => {
const end = Date.now() + 100; const end = Date.now() + 100;
const side = { const side = { particleCount: 17, spread: 65, startVelocity: 40, scalar: 2, gravity: 2, decay: 0.97, ticks: 300 };
particleCount: 17,
spread: 65,
startVelocity: 40,
scalar: 2,
gravity: 2,
decay: 0.97,
ticks: 300,
};
const frame = () => { const frame = () => {
fireConfetti({ ...side, angle: 60, drift: 0.8, origin: { x: 0, y: 1 } }); fireConfetti({ ...side, angle: 60, drift: 0.8, origin: { x: 0, y: 1 } });
fireConfetti({ ...side, angle: 120, drift: -0.8, origin: { x: 1, y: 1 } }); fireConfetti({ ...side, angle: 120, drift: -0.8, origin: { x: 1, y: 1 } });
@@ -334,11 +293,7 @@
<option value={subject.code}>{subject.code} - {subject.title}</option> <option value={subject.code}>{subject.code} - {subject.title}</option>
{/each} {/each}
</select> </select>
<select <select class="filter-select" bind:value={currentFilters.sortBy} title="Group by - columns change based on this">
class="filter-select"
bind:value={currentFilters.sortBy}
title="Group by - columns change based on this"
>
<option value="due">Group: Status</option> <option value="due">Group: Status</option>
<option value="year">Group: Year</option> <option value="year">Group: Year</option>
<option value="subject">Group: Subject</option> <option value="subject">Group: Subject</option>
@@ -352,7 +307,7 @@
onclick={() => (showVisibilityPanel = !showVisibilityPanel)} onclick={() => (showVisibilityPanel = !showVisibilityPanel)}
title="Manage hidden subjects and assessments" title="Manage hidden subjects and assessments"
> >
<EyeIcon size={18} class="bsplus-overview-icon" /> <OverviewIcon name="eye" size={18} />
<span>Visibility ({hiddenSubjects.length + hiddenAssessmentsWithInfo.length})</span> <span>Visibility ({hiddenSubjects.length + hiddenAssessmentsWithInfo.length})</span>
</button> </button>
{/if} {/if}
@@ -369,10 +324,7 @@
{#each hiddenSubjects as subject} {#each hiddenSubjects as subject}
<span class="visibility-chip"> <span class="visibility-chip">
{subject.code} {subject.code}
<button <button class="visibility-unhide" onclick={() => setSubjectVisible(subject.code, true)}>Show</button>
class="visibility-unhide"
onclick={() => setSubjectVisible(subject.code, true)}>Show</button
>
</span> </span>
{/each} {/each}
</div> </div>
@@ -385,9 +337,7 @@
{#each hiddenAssessmentsWithInfo as assessment} {#each hiddenAssessmentsWithInfo as assessment}
<span class="visibility-chip"> <span class="visibility-chip">
{assessment.title} {assessment.title}
<button class="visibility-unhide" onclick={() => unhideAssessment(assessment.id)} <button class="visibility-unhide" onclick={() => unhideAssessment(assessment.id)}>Show</button>
>Show</button
>
</span> </span>
{/each} {/each}
</div> </div>
@@ -399,7 +349,7 @@
<div id="main-grid-content" class="bsplus-overview-animate bsplus-overview-delay-1"> <div id="main-grid-content" class="bsplus-overview-animate bsplus-overview-delay-1">
{#if board.filteredAssessments.length === 0} {#if board.filteredAssessments.length === 0}
<div class="empty-state"> <div class="empty-state">
<ClipboardListIcon size={40} class="bsplus-overview-icon empty-icon" /> <OverviewIcon name="clipboard-document-list" size={40} class="empty-icon" />
<p>No assessments found matching your filters</p> <p>No assessments found matching your filters</p>
</div> </div>
{:else} {:else}
@@ -410,12 +360,15 @@
<div class="kanban-column {column.className}"> <div class="kanban-column {column.className}">
<div class="column-header"> <div class="column-header">
<div class="column-title"> <div class="column-title">
<span class="column-title-main"> <span class="column-title-main">
<column.icon size={18} class="bsplus-overview-icon" /> <OverviewIcon
{column.title} name={column.icon ?? STATUS_COLUMN_ICONS[column.key] ?? "queue-list"}
</span> size={18}
<span class="column-count">{board.statusGroups[column.key].length}</span> />
</div> {column.title}
</span>
<span class="column-count">{board.statusGroups[column.key].length}</span>
</div>
</div> </div>
<div class="column-cards" id="{column.key.toLowerCase()}-cards"> <div class="column-cards" id="{column.key.toLowerCase()}-cards">
{#each board.statusGroups[column.key] as assessment} {#each board.statusGroups[column.key] as assessment}
@@ -423,7 +376,7 @@
{@const dueDateClass = getDueDateClass(assessment)} {@const dueDateClass = getDueDateClass(assessment)}
{@const isCompleted = completedIds.includes(assessment.id)} {@const isCompleted = completedIds.includes(assessment.id)}
{@const color = data.colors[assessment.code] || "#6366f1"} {@const color = data.colors[assessment.code] || "#6366f1"}
<div <div
class="assessment-card" class="assessment-card"
data-subject={assessment.code} data-subject={assessment.code}
data-status={status} data-status={status}
@@ -431,7 +384,7 @@
onclick={(e) => handleCardClick(assessment, e)} onclick={(e) => handleCardClick(assessment, e)}
role="button" role="button"
tabindex="0" tabindex="0"
onkeydown={(e) => e.key === "Enter" && handleCardClick(assessment, e)} onkeydown={(e) => e.key === 'Enter' && handleCardClick(assessment, e)}
> >
<div class="card-labels"> <div class="card-labels">
{#if isEngage && assessment.studentName} {#if isEngage && assessment.studentName}
@@ -439,58 +392,37 @@
{/if} {/if}
<span class="card-label label-subject">{assessment.code}</span> <span class="card-label label-subject">{assessment.code}</span>
{#if assessment.submitted} {#if assessment.submitted}
<span <span class="card-label label-submitted" style="background: #10b981; color: white;">Submitted</span>
class="card-label label-submitted"
style="background: #10b981; color: white;">Submitted</span
>
{/if} {/if}
{#if isCompleted && status === "MARKS_RELEASED" && !assessmentHasGradeDisplay(assessment)} {#if isCompleted && status === "MARKS_RELEASED" && !assessmentHasGradeDisplay(assessment)}
<span <span class="card-label label-completed" style="background: #059669; color: white;">Completed</span>
class="card-label label-completed"
style="background: #059669; color: white;">Completed</span
>
{/if} {/if}
</div> </div>
{#if status !== "MARKS_RELEASED" || isCompleted} {#if status !== "MARKS_RELEASED" || isCompleted}
<div class="card-menu"> <div class="card-menu">
<button <button
class="menu-button" class="menu-button"
data-assessment-id={assessment.id} data-assessment-id={assessment.id}
onclick={(e) => toggleMenu(assessment.id, e)} onclick={(e) => toggleMenu(assessment.id, e)}
aria-label="Open menu" aria-label="Open menu"
> >
<EllipsisVerticalIcon size={16} class="bsplus-overview-icon" /> <OverviewIcon name="ellipsis-vertical" size={16} />
</button> </button>
<div <div class="menu-dropdown" style="display: {openMenuId === assessment.id ? 'block' : 'none'};">
class="menu-dropdown"
style="display: {openMenuId === assessment.id ? 'block' : 'none'};"
>
{#if status !== "MARKS_RELEASED"} {#if status !== "MARKS_RELEASED"}
<button <button class="menu-item mark-completed" onclick={() => markAssessmentCompleted(assessment)}>
class="menu-item mark-completed"
onclick={() => markAssessmentCompleted(assessment)}
>
Mark as Completed Mark as Completed
</button> </button>
{:else if isCompleted} {:else if isCompleted}
<button <button class="menu-item mark-not-completed" onclick={() => unmarkAssessmentCompleted(assessment)}>
class="menu-item mark-not-completed"
onclick={() => unmarkAssessmentCompleted(assessment)}
>
Mark as Not Complete Mark as Not Complete
</button> </button>
{/if} {/if}
<button <button class="menu-item menu-item-hide" onclick={() => hideAssessment(assessment)}>
class="menu-item menu-item-hide"
onclick={() => hideAssessment(assessment)}
>
Hide assessment Hide assessment
</button> </button>
<button <button class="menu-item menu-item-hide" onclick={() => hideSubject(assessment.code)}>
class="menu-item menu-item-hide"
onclick={() => hideSubject(assessment.code)}
>
Hide subject ({assessment.code}) Hide subject ({assessment.code})
</button> </button>
</div> </div>
@@ -502,11 +434,8 @@
{#if !assessmentHasGradeDisplay(assessment) && !isCompleted} {#if !assessmentHasGradeDisplay(assessment) && !isCompleted}
<div class="assessment-meta"> <div class="assessment-meta">
<div class="due-date {dueDateClass}"> <div class="due-date {dueDateClass}">
<CalendarDaysIcon size={14} class="bsplus-overview-icon" /> <OverviewIcon name="calendar-days" size={14} />
{formatDate( {formatDate(assessment.due || assessment.date || assessment.dueDate || "", assessment.submitted)}
assessment.due || assessment.date || assessment.dueDate || "",
assessment.submitted,
)}
</div> </div>
</div> </div>
{/if} {/if}
@@ -515,10 +444,7 @@
{@const gradeLabel = getDisplayGrade(assessment, isLetterGradeMode())} {@const gradeLabel = getDisplayGrade(assessment, isLetterGradeMode())}
{@const barPercent = getThermoscorePercent(assessment) ?? 0} {@const barPercent = getThermoscorePercent(assessment) ?? 0}
<div class="card-footer"> <div class="card-footer">
<div <div class="Thermoscore__Thermoscore___WFpL3" style="--fill-colour: {color}">
class="Thermoscore__Thermoscore___WFpL3"
style="--fill-colour: {color}"
>
<div style="width: {barPercent}%" class="Thermoscore__fill___ojxDI"> <div style="width: {barPercent}%" class="Thermoscore__fill___ojxDI">
<div title={gradeLabel} class="Thermoscore__text___XSR_M"> <div title={gradeLabel} class="Thermoscore__text___XSR_M">
{gradeLabel} {gradeLabel}
@@ -1,11 +1,11 @@
<script lang="ts"> <script lang="ts">
import CircleAlertIcon from "@lucide/svelte/icons/circle-alert"; import OverviewIcon from "./OverviewIcon.svelte";
let { error }: { error: string } = $props(); let { error }: { error: string } = $props();
</script> </script>
<div class="error-container bsplus-overview-animate"> <div class="error-container bsplus-overview-animate">
<CircleAlertIcon size={40} class="bsplus-overview-icon error-icon" /> <OverviewIcon name="exclamation-circle" size={40} class="error-icon" />
<p class="error-text">Failed to load assessments</p> <p class="error-text">Failed to load assessments</p>
<p class="error-detail">{error}</p> <p class="error-detail">{error}</p>
</div> </div>
@@ -0,0 +1,32 @@
<script lang="ts">
import { OVERVIEW_ICON_PATHS, type OverviewIconName } from "./icons";
interface Props {
name: OverviewIconName;
class?: string;
size?: number;
}
let { name, class: className = "", size = 20 }: Props = $props();
const paths = $derived.by(() => {
const raw = OVERVIEW_ICON_PATHS[name];
return Array.isArray(raw) ? raw : [raw];
});
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
width={size}
height={size}
class="bsplus-overview-icon {className}"
aria-hidden="true"
>
{#each paths as path, index (index)}
<path stroke-linecap="round" stroke-linejoin="round" d={path} />
{/each}
</svg>
@@ -1,41 +1,18 @@
<script lang="ts"> <script lang="ts">
import { STATUS_COLUMN_ICONS, type OverviewIcon } from "./icons"; import OverviewIcon from "./OverviewIcon.svelte";
import type { OverviewIconName } from "./icons";
const columns: { const columns: {
key: string; key: string;
title: string; title: string;
className: string; className: string;
icon: OverviewIcon; icon: OverviewIconName;
skeletonCount: number; skeletonCount: number;
}[] = [ }[] = [
{ { key: "UPCOMING", title: "Upcoming", className: "column-upcoming", icon: "calendar-days", skeletonCount: 3 },
key: "UPCOMING", { key: "DUE_SOON", title: "Due Soon", className: "column-due-soon", icon: "clock", skeletonCount: 2 },
title: "Upcoming", { key: "OVERDUE", title: "Overdue", className: "column-overdue", icon: "exclamation-triangle", skeletonCount: 1 },
className: "column-upcoming", { key: "MARKS_RELEASED", title: "Marked", className: "column-marked", icon: "check-circle", skeletonCount: 4 },
icon: STATUS_COLUMN_ICONS.UPCOMING,
skeletonCount: 3,
},
{
key: "DUE_SOON",
title: "Due Soon",
className: "column-due-soon",
icon: STATUS_COLUMN_ICONS.DUE_SOON,
skeletonCount: 2,
},
{
key: "OVERDUE",
title: "Overdue",
className: "column-overdue",
icon: STATUS_COLUMN_ICONS.OVERDUE,
skeletonCount: 1,
},
{
key: "MARKS_RELEASED",
title: "Marked",
className: "column-marked",
icon: STATUS_COLUMN_ICONS.MARKS_RELEASED,
skeletonCount: 4,
},
]; ];
</script> </script>
@@ -63,7 +40,7 @@
<div class="column-header"> <div class="column-header">
<div class="column-title"> <div class="column-title">
<span class="column-title-main"> <span class="column-title-main">
<column.icon size={18} class="bsplus-overview-icon" /> <OverviewIcon name={column.icon} size={18} />
{column.title} {column.title}
</span> </span>
<span class="column-count">…</span> <span class="column-count">…</span>
@@ -1,28 +1,60 @@
import BookOpenIcon from "@lucide/svelte/icons/book-open"; /** Heroicons v2 outline paths (https://heroicons.com) */
import CalendarIcon from "@lucide/svelte/icons/calendar"; export type OverviewIconName =
import CalendarDaysIcon from "@lucide/svelte/icons/calendar-days"; | "calendar-days"
import ChartColumnIcon from "@lucide/svelte/icons/chart-column"; | "clock"
import CircleCheckIcon from "@lucide/svelte/icons/circle-check"; | "exclamation-triangle"
import ClockIcon from "@lucide/svelte/icons/clock"; | "document-check"
import FileCheckIcon from "@lucide/svelte/icons/file-check"; | "check-circle"
import ListIcon from "@lucide/svelte/icons/list"; | "book-open"
import TriangleAlertIcon from "@lucide/svelte/icons/triangle-alert"; | "calendar"
| "chart-bar"
| "queue-list"
| "eye"
| "clipboard-document-list"
| "ellipsis-vertical"
| "exclamation-circle";
export type OverviewIcon = typeof ListIcon; export const OVERVIEW_ICON_PATHS: Record<OverviewIconName, string | string[]> = {
"calendar-days":
export const DEFAULT_COLUMN_ICON: OverviewIcon = ListIcon; "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5",
clock: "M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z",
export const STATUS_COLUMN_ICONS: Record<string, OverviewIcon> = { "exclamation-triangle":
UPCOMING: CalendarDaysIcon, "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",
DUE_SOON: ClockIcon, "document-check":
OVERDUE: TriangleAlertIcon, "M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9zm3.75 8.625a2.625 2.625 0 100-5.25 2.625 2.625 0 000 5.25zm0 0l-3 3m3-3l3 3",
SUBMITTED: FileCheckIcon, "check-circle": "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
MARKS_RELEASED: CircleCheckIcon, "book-open":
"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25",
calendar:
"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5",
"chart-bar":
"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z",
"queue-list":
"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 010 3.75H5.625a1.875 1.875 0 010-3.75z",
eye: [
"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z",
"M15 12a3 3 0 11-6 0 3 3 0 016 0z",
],
"clipboard-document-list": [
"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 17.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z",
"M8.25 6.75V4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V6.75H8.25z",
],
"ellipsis-vertical":
"M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z",
"exclamation-circle": "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z",
}; };
export const GROUP_SORT_ICONS: Record<string, OverviewIcon> = { export const STATUS_COLUMN_ICONS: Record<string, OverviewIconName> = {
year: CalendarIcon, UPCOMING: "calendar-days",
subject: BookOpenIcon, DUE_SOON: "clock",
grade: ChartColumnIcon, OVERDUE: "exclamation-triangle",
title: ListIcon, SUBMITTED: "document-check",
MARKS_RELEASED: "check-circle",
};
export const GROUP_SORT_ICONS: Record<string, OverviewIconName> = {
year: "calendar",
subject: "book-open",
grade: "chart-bar",
title: "queue-list",
}; };
@@ -1,102 +1,89 @@
<script lang="ts"> <script lang="ts">
import UploadIcon from "@lucide/svelte/icons/upload"; import localforage from 'localforage'
import localforage from "localforage"; import { onMount } from 'svelte'
import { onMount } from "svelte";
let fileInput = $state<HTMLInputElement | undefined>(undefined); let fileInput = $state<HTMLInputElement | undefined>(undefined)
let dragging = $state(false); let dragging = $state(false)
let filename = $state<string | undefined>(undefined); let filename = $state<string | undefined>(undefined)
let durationText = $state<string | undefined>(undefined); let durationText = $state<string | undefined>(undefined)
const store = localforage.createInstance({ const store = localforage.createInstance({
name: "background-music-store", name: 'background-music-store',
storeName: "music", storeName: 'music',
}); })
async function loadExisting() { async function loadExisting() {
const name = await store.getItem<string>("audio-name"); const name = await store.getItem<string>('audio-name')
filename = name ?? undefined; filename = name ?? undefined
} }
onMount(() => { onMount(() => { loadExisting() })
loadExisting();
});
function triggerSelect() { function triggerSelect() { fileInput?.click() }
fileInput?.click();
}
async function handleFiles(files: FileList | null) { async function handleFiles(files: FileList | null) {
const file = files?.[0]; const file = files?.[0]
if (!file) return; if (!file) return
const isSupported = const isSupported = file.type === 'audio/wav' || file.type === 'audio/mpeg' ||
file.type === "audio/wav" || file.name.toLowerCase().endsWith('.wav') || file.name.toLowerCase().endsWith('.mp3')
file.type === "audio/mpeg" ||
file.name.toLowerCase().endsWith(".wav") ||
file.name.toLowerCase().endsWith(".mp3");
if (!isSupported) { if (!isSupported) {
alert("Please select a .wav or .mp3 audio file"); alert('Please select a .wav or .mp3 audio file')
return; return
} }
await store.setItem("audio-blob", file); await store.setItem('audio-blob', file)
await store.setItem("audio-name", file.name); await store.setItem('audio-name', file.name)
filename = file.name; filename = file.name
try { try {
const url = URL.createObjectURL(file); const url = URL.createObjectURL(file)
const audio = new Audio(url); const audio = new Audio(url)
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
audio.onloadedmetadata = () => resolve(); audio.onloadedmetadata = () => resolve()
audio.onerror = () => reject(); audio.onerror = () => reject()
}); })
if (!isNaN(audio.duration) && audio.duration !== Infinity) { if (!isNaN(audio.duration) && audio.duration !== Infinity) {
const minutes = Math.floor(audio.duration / 60); const minutes = Math.floor(audio.duration / 60)
const seconds = Math.round(audio.duration % 60); const seconds = Math.round(audio.duration % 60)
durationText = `${minutes}:${seconds.toString().padStart(2, "0")}`; durationText = `${minutes}:${seconds.toString().padStart(2, '0')}`
} else { } else {
durationText = undefined; durationText = undefined
} }
URL.revokeObjectURL(url); URL.revokeObjectURL(url)
} catch { } catch {
durationText = undefined; durationText = undefined
} }
window.dispatchEvent(new Event("betterseqta-background-music-updated")); window.dispatchEvent(new Event('betterseqta-background-music-updated'))
} }
function onFileChange() { function onFileChange() { handleFiles(fileInput?.files || null) }
handleFiles(fileInput?.files || null);
}
function onDrop(event: DragEvent) { function onDrop(event: DragEvent) {
event.preventDefault(); event.preventDefault()
dragging = false; dragging = false
handleFiles(event.dataTransfer?.files || null); handleFiles(event.dataTransfer?.files || null)
} }
async function removeAudio() { async function removeAudio() {
await store.removeItem("audio-blob"); await store.removeItem('audio-blob')
await store.removeItem("audio-name"); await store.removeItem('audio-name')
filename = undefined; filename = undefined
durationText = undefined; durationText = undefined
window.dispatchEvent(new Event("betterseqta-background-music-stop")); window.dispatchEvent(new Event('betterseqta-background-music-stop'))
} }
</script> </script>
<div <div
class="relative cursor-pointer select-none" class="relative cursor-pointer select-none"
onclick={() => triggerSelect()} onclick={() => triggerSelect()}
ondragover={(e) => { ondragover={(e) => { e.stopPropagation(); dragging = true }}
e.stopPropagation(); ondragleave={() => dragging = false}
dragging = true;
}}
ondragleave={() => (dragging = false)}
ondrop={onDrop} ondrop={onDrop}
onkeydown={(e) => { onkeydown={(e) => {
if (e.key === "Enter" || e.key === " ") { if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault(); e.preventDefault()
triggerSelect(); triggerSelect()
} }
}} }}
role="button" role="button"
@@ -111,30 +98,21 @@
</div> </div>
<button <button
class="flex justify-center items-center m-1 text-lg dark:text-white size-7" class="flex justify-center items-center m-1 text-lg dark:text-white size-7"
onclick={(e) => { onclick={(e) => { e.stopPropagation(); removeAudio() }}
e.stopPropagation(); aria-label="Remove audio"
removeAudio(); >&#215;</button>
}}
aria-label="Remove audio">&#215;</button
>
</div> </div>
{:else} {:else}
<div <div class="flex gap-2 items-center px-3 py-1 text-xs rounded-lg border border-dashed transition border-zinc-300 dark:border-zinc-600 text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 text-nowrap">
class="flex gap-2 items-center px-3 py-1 text-xs rounded-lg border border-dashed transition border-zinc-300 dark:border-zinc-600 text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 text-nowrap" <span class="text-lg font-IconFamily">{'\ued47'}</span>
>
<UploadIcon size="1em" class="text-lg" />
<span>Upload audio</span> <span>Upload audio</span>
</div> </div>
{/if} {/if}
</div> </div>
<input <input type="file" accept="audio/wav,audio/mpeg" class="hidden" bind:this={fileInput} onchange={onFileChange} />
type="file"
accept="audio/wav,audio/mpeg"
class="hidden"
bind:this={fileInput}
onchange={onFileChange}
/>
{#if dragging} {#if dragging}
<div class="absolute inset-0 rounded-lg bg-zinc-200/40 dark:bg-zinc-700/40"></div> <div class="absolute inset-0 rounded-lg bg-zinc-200/40 dark:bg-zinc-700/40"></div>
{/if} {/if}
</div> </div>
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { ChevronLeft, ChevronRight } from "lucide-static";
import type { Plugin } from "@/plugins/core/types"; import type { Plugin } from "@/plugins/core/types";
import { BasePlugin } from "@/plugins/core/settings"; import { BasePlugin } from "@/plugins/core/settings";
import { booleanSetting, defineSettings, Setting } from "@/plugins/core/settingsHelpers"; import { booleanSetting, defineSettings, Setting } from "@/plugins/core/settingsHelpers";
@@ -195,10 +193,10 @@ const ensureArrows = (course: HTMLElement) => {
container.id = ARROW_CONTAINER_ID; container.id = ARROW_CONTAINER_ID;
container.innerHTML = ` container.innerHTML = `
<button type="button" class="en-arrow" data-en-action="prev" title="Previous lesson" aria-label="Previous lesson"> <button type="button" class="en-arrow" data-en-action="prev" title="Previous lesson" aria-label="Previous lesson">
${icon(ChevronLeft)} <svg viewBox="0 0 24 24"><path d="M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
</button> </button>
<button type="button" class="en-arrow" data-en-action="next" title="Next lesson" aria-label="Next lesson"> <button type="button" class="en-arrow" data-en-action="next" title="Next lesson" aria-label="Next lesson">
${icon(ChevronRight)} <svg viewBox="0 0 24 24"><path d="M8.59 16.59 10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>
</button> </button>
`; `;
document.body.appendChild(container); document.body.appendChild(container);
@@ -1,10 +1,9 @@
<script lang="ts"> <script lang="ts">
import ArrowRightIcon from "@lucide/svelte/icons/arrow-right"; import { onDestroy } from 'svelte';
import { onDestroy } from "svelte"; import { calculateExpression } from '../utils/calculator';
import { calculateExpression } from "../utils/calculator";
let { let {
searchTerm = "", searchTerm = '',
isSelected = false, isSelected = false,
onresult, onresult,
}: { }: {
@@ -15,10 +14,10 @@
let result = $state<string | null>(null); let result = $state<string | null>(null);
let isCalculating = $state(false); let isCalculating = $state(false);
let inputUnit = $state<string>(""); let inputUnit = $state<string>('');
let outputUnit = $state<string>(""); let outputUnit = $state<string>('');
let isPartial = $state(false); let isPartial = $state(false);
let calcGen = 0; let calcGen = 0;
const processInput = async (input: string) => { const processInput = async (input: string) => {
@@ -37,16 +36,16 @@
onresult(calcResult.result); onresult(calcResult.result);
} else { } else {
result = null; result = null;
inputUnit = ""; inputUnit = '';
outputUnit = ""; outputUnit = '';
isPartial = false; isPartial = false;
onresult(null); onresult(null);
} }
} catch { } catch {
if (gen !== calcGen) return; if (gen !== calcGen) return;
result = null; result = null;
inputUnit = ""; inputUnit = '';
outputUnit = ""; outputUnit = '';
isPartial = false; isPartial = false;
onresult(null); onresult(null);
} finally { } finally {
@@ -57,65 +56,47 @@
$effect(() => { $effect(() => {
void processInput(searchTerm); void processInput(searchTerm);
}); });
onDestroy(() => { onDestroy(() => {
onresult(null); onresult(null);
}); });
</script> </script>
{#if result !== null} {#if result !== null}
<div class=""> <div class="">
<p class="text-[0.85rem] p-1 pb-0.5 pt-0 font-semibold text-zinc-500 dark:text-zinc-400"> <p class="text-[0.85rem] p-1 pb-0.5 pt-0 font-semibold text-zinc-500 dark:text-zinc-400">Calculator</p>
Calculator <div class="flex items-center justify-between gap-8 rounded-lg border border-transparent {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 border-zinc-900/5 dark:border-zinc-100/5' : ''}">
</p> <div class="flex flex-col flex-1 items-center py-4 pl-4 min-w-0">
<div <div class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
class="flex items-center justify-between gap-8 rounded-lg border border-transparent {isSelected style="--char-count: {searchTerm?.length || 10}; font-size: min(2.5rem, max(1rem, calc(35vw / var(--char-count, 10))))">
? 'bg-zinc-900/5 dark:bg-white/10 border-zinc-900/5 dark:border-zinc-100/5' {searchTerm}
: ''}"
>
<div class="flex flex-col flex-1 items-center py-4 pl-4 min-w-0">
<div
class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
style="--char-count: {searchTerm?.length ||
10}; font-size: min(2.5rem, max(1rem, calc(35vw / var(--char-count, 10))))"
>
{searchTerm}
</div>
<div
class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10"
>
{inputUnit || "Question"}
</div>
</div> </div>
<div class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10">
<div class="flex flex-col shrink-0 justify-center items-center w-12"> {inputUnit || 'Question'}
<div class="h-8 w-px bg-zinc-900/5 dark:bg-zinc-100/5"></div>
<div class="text-2xl text-zinc-900 dark:text-zinc-100">
<ArrowRightIcon size="1em" />
</div>
<div class="h-8 w-px bg-zinc-900/5 dark:bg-zinc-100/5"></div>
</div> </div>
{#if !isCalculating}
<div class="flex flex-col flex-1 items-center py-4 pr-4 min-w-0">
<div
class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
style="--char-count: {result?.length ||
10}; font-size: min(2.5rem, max(1rem, calc(30vw / var(--char-count, 10))))"
>
{result}
</div>
<div
class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10"
>
{outputUnit || (isPartial ? "Partial" : "Result")}
</div>
</div>
{:else}
<div
class="w-6 h-6 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"
></div>
{/if}
</div> </div>
<div class="flex flex-col shrink-0 justify-center items-center w-12">
<div class="h-8 w-px bg-zinc-900/5 dark:bg-zinc-100/5"></div>
<div class="text-2xl text-zinc-900 dark:text-zinc-100">
→
</div>
<div class="h-8 w-px bg-zinc-900/5 dark:bg-zinc-100/5"></div>
</div>
{#if !isCalculating}
<div class="flex flex-col flex-1 items-center py-4 pr-4 min-w-0">
<div class="overflow-hidden py-2 w-full font-semibold text-center whitespace-nowrap text-zinc-900 dark:text-white text-ellipsis"
style="--char-count: {result?.length || 10}; font-size: min(2.5rem, max(1rem, calc(30vw / var(--char-count, 10))))">
{result}
</div>
<div class="px-3 py-1 mt-1 text-sm rounded-md text-zinc-900 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-100/10">
{outputUnit || (isPartial ? 'Partial' : 'Result')}
</div>
</div>
{:else}
<div class="w-6 h-6 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"></div>
{/if}
</div> </div>
{/if} </div>
{/if}
@@ -1,48 +1,40 @@
<script lang="ts"> <script lang="ts">
import FolderOpenIcon from "@lucide/svelte/icons/folder-open"; import { onMount, tick } from 'svelte';
import SearchIcon from "./SearchIcon.svelte"; import { settingsState } from '@/seqta/utils/listeners/settingsState'
import { iconForCategory } from "../core/searchIcons"; import { fade, scale } from 'svelte/transition';
import { onMount, tick } from "svelte"; import { circOut, quintOut } from 'svelte/easing';
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { type StaticCommandItem } from '../core/commands';
import { fade, scale } from "svelte/transition"; import type { CombinedResult } from '../core/types';
import { circOut, quintOut } from "svelte/easing"; import { createSearchIndexes, applyDynamicIndexDelta, performSearch as doSearch, type DynamicItemsUpdatedDetail } from '../search/searchUtils';
import { type StaticCommandItem } from "../core/commands"; import Fuse from 'fuse.js';
import type { CombinedResult } from "../core/types"; import Calculator from './Calculator.svelte';
import { import { actionMap } from '../indexing/actions';
createSearchIndexes, import type { IndexItem } from '../indexing/types';
applyDynamicIndexDelta, import debounce from '@/seqta/utils/debounce';
performSearch as doSearch, import { renderComponentMap } from '../indexing/renderComponents';
type DynamicItemsUpdatedDetail, import HighlightedText from '../utils/HighlightedText.svelte';
} from "../search/searchUtils"; import { matchesHotkey } from '../utils/hotkeyUtils';
import Fuse from "fuse.js"; import { warmUpVectorSearchOnInteraction } from '../search/vector/vectorSearch';
import Calculator from "./Calculator.svelte"; import browser from '@/lib/browser';
import { actionMap } from "../indexing/actions";
import type { IndexItem } from "../indexing/types";
import debounce from "@/seqta/utils/debounce";
import { renderComponentMap } from "../indexing/renderComponents";
import HighlightedText from "../utils/HighlightedText.svelte";
import { matchesHotkey } from "../utils/hotkeyUtils";
import { warmUpVectorSearchOnInteraction } from "../search/vector/vectorSearch";
import browser from "@/lib/browser";
const { const {
transparencyEffects, transparencyEffects,
searchHotkey: initialSearchHotkey, searchHotkey: initialSearchHotkey
}: { }: {
transparencyEffects: boolean; transparencyEffects: boolean,
searchHotkey: string; searchHotkey: string
} = $props(); } = $props();
let currentSearchHotkey = $derived(initialSearchHotkey); let currentSearchHotkey = $derived(initialSearchHotkey);
let commandsFuse = $state<Fuse<StaticCommandItem>>(); let commandsFuse = $state<Fuse<StaticCommandItem>>();
let dynamicContentFuse = $state<Fuse<IndexItem>>(); let dynamicContentFuse = $state<Fuse<IndexItem>>();
const dynamicIdToItemMap = $state(new Map<string, IndexItem>()); const dynamicIdToItemMap = $state(new Map<string, IndexItem>());
const commandIdToItemMap = $state(new Map<string, StaticCommandItem>()); const commandIdToItemMap = $state(new Map<string, StaticCommandItem>());
let commandPalleteOpen = $state(false); let commandPalleteOpen = $state(false);
let searchTerm = $state(""); let searchTerm = $state('');
let selectedIndex = $state(0); let selectedIndex = $state(0);
let combinedResults = $state<CombinedResult[]>([]); let combinedResults = $state<CombinedResult[]>([]);
let searchbar = $state<HTMLInputElement>(); let searchbar = $state<HTMLInputElement>();
@@ -58,13 +50,13 @@
// the `world w` pass and clobbers the more relevant matches. // the `world w` pass and clobbers the more relevant matches.
let searchRequestId = 0; let searchRequestId = 0;
let keydownHandler: ((e: KeyboardEvent) => void) | null = null; let keydownHandler: ((e: KeyboardEvent) => void) | null = null;
$effect(() => { $effect(() => {
const loadSettings = async () => { const loadSettings = async () => {
const settings = await browser.storage.local.get("plugin.global-search.settings"); const settings = await browser.storage.local.get('plugin.global-search.settings');
const pluginSettings = settings["plugin.global-search.settings"] as const pluginSettings = settings['plugin.global-search.settings'] as { searchHotkey?: string } | undefined;
{ searchHotkey?: string } | undefined;
if (pluginSettings?.searchHotkey) { if (pluginSettings?.searchHotkey) {
currentSearchHotkey = pluginSettings.searchHotkey; currentSearchHotkey = pluginSettings.searchHotkey;
} }
@@ -73,9 +65,8 @@
loadSettings(); loadSettings();
const handleStorageChange = (changes: any, area: string) => { const handleStorageChange = (changes: any, area: string) => {
if (area === "local" && changes["plugin.global-search.settings"]) { if (area === 'local' && changes['plugin.global-search.settings']) {
const newSettings = changes["plugin.global-search.settings"].newValue as const newSettings = changes['plugin.global-search.settings'].newValue as { searchHotkey?: string } | undefined;
{ searchHotkey?: string } | undefined;
if (newSettings?.searchHotkey) { if (newSettings?.searchHotkey) {
currentSearchHotkey = newSettings.searchHotkey; currentSearchHotkey = newSettings.searchHotkey;
} }
@@ -83,7 +74,7 @@
}; };
browser.storage.onChanged.addListener(handleStorageChange); browser.storage.onChanged.addListener(handleStorageChange);
return () => { return () => {
browser.storage.onChanged.removeListener(handleStorageChange); browser.storage.onChanged.removeListener(handleStorageChange);
}; };
@@ -92,9 +83,9 @@
// Update keydown handler when hotkey changes // Update keydown handler when hotkey changes
$effect(() => { $effect(() => {
if (keydownHandler) { if (keydownHandler) {
window.removeEventListener("keydown", keydownHandler); window.removeEventListener('keydown', keydownHandler);
} }
keydownHandler = (e: KeyboardEvent) => { keydownHandler = (e: KeyboardEvent) => {
if (matchesHotkey(e, currentSearchHotkey)) { if (matchesHotkey(e, currentSearchHotkey)) {
e.preventDefault(); e.preventDefault();
@@ -102,16 +93,16 @@
commandPalleteOpen = true; commandPalleteOpen = true;
tick().then(() => searchbar?.focus()); tick().then(() => searchbar?.focus());
} }
if (e.key === "Escape") { if (e.key === 'Escape') {
commandPalleteOpen = false; commandPalleteOpen = false;
} }
}; };
window.addEventListener("keydown", keydownHandler); window.addEventListener('keydown', keydownHandler);
return () => { return () => {
if (keydownHandler) { if (keydownHandler) {
window.removeEventListener("keydown", keydownHandler); window.removeEventListener('keydown', keydownHandler);
keydownHandler = null; keydownHandler = null;
} }
}; };
@@ -121,13 +112,21 @@
const applyItemsUpdate = (event: Event) => { const applyItemsUpdate = (event: Event) => {
const detail = (event as CustomEvent<DynamicItemsUpdatedDetail>).detail; const detail = (event as CustomEvent<DynamicItemsUpdatedDetail>).detail;
if (detail?.vectorUpdate && !detail.changedItems?.length && !detail.removedIds?.length) { if (
detail?.vectorUpdate &&
!detail.changedItems?.length &&
!detail.removedIds?.length
) {
performSearch(); performSearch();
return; return;
} }
if (detail?.incremental && !detail.fullRebuild) { if (detail?.incremental && !detail.fullRebuild) {
const updatedFuse = applyDynamicIndexDelta(dynamicContentFuse, dynamicIdToItemMap, detail); const updatedFuse = applyDynamicIndexDelta(
dynamicContentFuse,
dynamicIdToItemMap,
detail,
);
if (updatedFuse) { if (updatedFuse) {
dynamicContentFuse = updatedFuse; dynamicContentFuse = updatedFuse;
performSearch(); performSearch();
@@ -153,10 +152,10 @@
}); });
}; };
window.addEventListener("dynamic-items-updated", itemsUpdatedHandler); window.addEventListener('dynamic-items-updated', itemsUpdatedHandler);
setupSearchIndexes(); setupSearchIndexes();
// @ts-ignore - Intentionally adding to window // @ts-ignore - Intentionally adding to window
window.setCommandPalleteOpen = (open: boolean) => { window.setCommandPalleteOpen = (open: boolean) => {
if (open) warmUpVectorSearchOnInteraction(); if (open) warmUpVectorSearchOnInteraction();
@@ -165,26 +164,21 @@
return () => { return () => {
if (itemsUpdateRaf) cancelAnimationFrame(itemsUpdateRaf); if (itemsUpdateRaf) cancelAnimationFrame(itemsUpdateRaf);
window.removeEventListener("dynamic-items-updated", itemsUpdatedHandler); window.removeEventListener('dynamic-items-updated', itemsUpdatedHandler);
}; };
}); });
function setupSearchIndexes() { function setupSearchIndexes() {
const { const { commandsFuse: cfuse, dynamicContentFuse: dfuse, commands, dynamicItems } = createSearchIndexes();
commandsFuse: cfuse,
dynamicContentFuse: dfuse,
commands,
dynamicItems,
} = createSearchIndexes();
commandsFuse = cfuse; commandsFuse = cfuse;
dynamicContentFuse = dfuse; dynamicContentFuse = dfuse;
dynamicIdToItemMap.clear(); dynamicIdToItemMap.clear();
commandIdToItemMap.clear(); commandIdToItemMap.clear();
dynamicItems.forEach((item) => dynamicIdToItemMap.set(item.id, item)); dynamicItems.forEach(item => dynamicIdToItemMap.set(item.id, item));
commands.forEach((item) => commandIdToItemMap.set(item.id, item)); commands.forEach(item => commandIdToItemMap.set(item.id, item));
} }
const performSearch = async () => { const performSearch = async () => {
@@ -193,7 +187,7 @@
tick().then(() => { tick().then(() => {
const selectedElement = resultsList?.querySelector(`li:nth-child(1)`); const selectedElement = resultsList?.querySelector(`li:nth-child(1)`);
selectedElement?.scrollIntoView({ block: "nearest" }); selectedElement?.scrollIntoView({ block: 'nearest' });
}); });
const term = searchTerm.trim().toLowerCase(); const term = searchTerm.trim().toLowerCase();
@@ -235,7 +229,7 @@
$effect(() => { $effect(() => {
if (commandPalleteOpen) { if (commandPalleteOpen) {
if (searchTerm === "") { if (searchTerm === '') {
// Immediate search for empty query (shows recent items) // Immediate search for empty query (shows recent items)
performSearch(); performSearch();
} else if (searchTerm.length <= 2) { } else if (searchTerm.length <= 2) {
@@ -245,9 +239,9 @@
// Debounced search for longer queries // Debounced search for longer queries
debouncedPerformSearch(); debouncedPerformSearch();
} }
tick().then(() => searchbar?.focus()); tick().then(() => searchbar?.focus());
} else { } else {
searchTerm = ""; searchTerm = '';
selectedIndex = 0; selectedIndex = 0;
combinedResults = []; combinedResults = [];
} }
@@ -265,7 +259,7 @@
selectedIndex++; selectedIndex++;
tick().then(() => { tick().then(() => {
const selectedElement = resultsList?.querySelector(`li:nth-child(${selectedIndex + 1})`); const selectedElement = resultsList?.querySelector(`li:nth-child(${selectedIndex + 1})`);
selectedElement?.scrollIntoView({ block: "nearest" }); selectedElement?.scrollIntoView({ block: 'nearest' });
}); });
} }
}; };
@@ -275,15 +269,15 @@
selectedIndex--; selectedIndex--;
tick().then(() => { tick().then(() => {
const selectedElement = resultsList?.querySelector(`li:nth-child(${selectedIndex + 1})`); const selectedElement = resultsList?.querySelector(`li:nth-child(${selectedIndex + 1})`);
selectedElement?.scrollIntoView({ block: "nearest" }); selectedElement?.scrollIntoView({ block: 'nearest' });
}); });
} }
}; };
function executeItemAction(item: StaticCommandItem | IndexItem) { function executeItemAction(item: StaticCommandItem | IndexItem) {
if ("action" in item && typeof item.action === "function") { if ('action' in item && typeof item.action === 'function') {
(item as StaticCommandItem).action(); (item as StaticCommandItem).action();
} else if ("actionId" in item && item.actionId && actionMap[item.actionId]) { } else if ('actionId' in item && item.actionId && actionMap[item.actionId]) {
actionMap[item.actionId](item as IndexItem); actionMap[item.actionId](item as IndexItem);
} }
commandPalleteOpen = false; commandPalleteOpen = false;
@@ -303,115 +297,96 @@
}; };
const handleKeyNav = (e: KeyboardEvent) => { const handleKeyNav = (e: KeyboardEvent) => {
if (e.key === "ArrowDown") { if (e.key === 'ArrowDown') {
e.preventDefault(); e.preventDefault();
selectNext(); selectNext();
} else if (e.key === "ArrowUp") { } else if (e.key === 'ArrowUp') {
e.preventDefault(); e.preventDefault();
selectPrev(); selectPrev();
} else if (e.key === "Enter") { } else if (e.key === 'Enter') {
e.preventDefault(); e.preventDefault();
executeSelected(); executeSelected();
} else if (e.key === "Escape") { } else if (e.key === 'Escape') {
commandPalleteOpen = false; commandPalleteOpen = false;
} }
}; };
</script> </script>
{#if commandPalleteOpen} {#if commandPalleteOpen}
<div role="dialog" aria-modal="true" class={settingsState.DarkMode ? "dark" : ""}> <div role="dialog" aria-modal="true" class={settingsState.DarkMode ? 'dark' : ''}>
<div <div
class="fixed inset-0 z-50000 bg-zinc-900/40 dark:bg-black/60" class="fixed inset-0 z-50000 bg-zinc-900/40 dark:bg-black/60"
transition:fade={{ duration: 150, easing: quintOut }} transition:fade={{ duration: 150, easing: quintOut }}
></div> ></div>
<div <div class="fixed inset-0 z-50000 flex justify-center place-items-start p-8 sm:p-6 md:p-8 select-none scale-120 origin-top"
class="fixed inset-0 z-50000 flex justify-center place-items-start p-8 sm:p-6 md:p-8 select-none scale-120 origin-top" onclick={() => commandPalleteOpen = false}
onclick={() => (commandPalleteOpen = false)} onkeydown={(e: KeyboardEvent) => e.key === 'Escape' && (commandPalleteOpen = false)}
onkeydown={(e: KeyboardEvent) => e.key === "Escape" && (commandPalleteOpen = false)} role="button"
role="button" tabindex="0">
tabindex="0"
>
<div <div
class="w-full max-w-2xl overflow-clip rounded-xl ring-1 shadow-2xl ring-black/5 dark:ring-white/10 {transparencyEffects class="w-full max-w-2xl overflow-clip rounded-xl ring-1 shadow-2xl ring-black/5 dark:ring-white/10 { transparencyEffects ? 'bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl' : 'bg-white dark:bg-zinc-900' }"
? 'bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl'
: 'bg-white dark:bg-zinc-900'}"
transition:scale={{ duration: 100, start: 0.95, opacity: 0, easing: circOut }} transition:scale={{ duration: 100, start: 0.95, opacity: 0, easing: circOut }}
onclick={(e: MouseEvent) => { onclick={(e: MouseEvent) => {
e.stopPropagation(); e.stopPropagation();
}} }}
onkeydown={(e: KeyboardEvent) => { onkeydown={(e: KeyboardEvent) => {
if (e.key === "Escape") { if (e.key === 'Escape') {
commandPalleteOpen = false; commandPalleteOpen = false;
} }
}} }}
role="button" role="button"
tabindex="0" tabindex="0">
>
<div class="relative p-2 border-b border-zinc-900/5 dark:border-zinc-100/5"> <div class="relative p-2 border-b border-zinc-900/5 dark:border-zinc-100/5">
<div <div class="absolute top-1/2 translate-y-[calc(-50%-3px)] scale-105 left-5 w-6 h-6 text-[1.3rem] text-zinc-900/40 dark:text-zinc-400/40 pointer-events-none font-IconFamily">
class="absolute top-1/2 translate-y-[calc(-50%-3px)] scale-105 left-5 w-6 h-6 text-[1.3rem] text-zinc-900/40 dark:text-zinc-400/40 pointer-events-none" {'\ueca5'}
>
<SearchIcon name="search" />
</div> </div>
<input <input
bind:this={searchbar} bind:this={searchbar}
bind:value={searchTerm} bind:value={searchTerm}
onkeydown={handleKeyNav} onkeydown={handleKeyNav}
class="pr-4 pl-12 w-full h-10 text-lg bg-transparent border-0 outline-hidden placeholder-zinc-400 text-zinc-700 dark:placeholder-zinc-500 dark:text-white sm:text-xl" class="pr-4 pl-12 w-full h-10 text-lg bg-transparent border-0 outline-hidden placeholder-zinc-400 text-zinc-700 dark:placeholder-zinc-500 dark:text-white focus:ring-0 sm:text-xl"
placeholder="Search..." placeholder="Search..."
/> />
</div> </div>
<ul <ul
bind:this={resultsList} bind:this={resultsList}
class="overflow-y-auto max-h-96 text-base scroll-py-2 p-2 gap-0.5 flex flex-col" class="overflow-y-auto max-h-96 text-base scroll-py-2 p-2 gap-0.5 flex flex-col"
> >
<Calculator <Calculator
{searchTerm} searchTerm={searchTerm}
isSelected={selectedIndex === 0} isSelected={selectedIndex === 0}
onresult={(result) => (calculatorResult = result)} onresult={(result) => (calculatorResult = result)}
/> />
{#if combinedResults.length > 0} {#if combinedResults.length > 0}
{#each combinedResults as result, i (result.id)} {#each combinedResults as result, i (result.id)}
{@const isSelected = selectedIndex === (calculatorResult ? i + 1 : i)} {@const isSelected = selectedIndex === (calculatorResult ? i + 1 : i)}
{@const item = result.item} {@const item = result.item}
<li> <li>
{#if result.type === "command"} {#if result.type === 'command'}
{@const staticItem = item as StaticCommandItem} {@const staticItem = item as StaticCommandItem}
<button <button
class="w-full flex items-center px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50 class="w-full flex items-center px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
{isSelected {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm'
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
onclick={() => executeItemAction(staticItem)} onclick={() => executeItemAction(staticItem)}
> >
<div <div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center bg-linear-to-br {staticItem.category === 'navigation' ? 'from-[#FA5D5D] to-[#DC2F30]' : 'from-[#4FBBFE] to-[#2090F3]'} rounded-md text-white">{staticItem.icon}</div>
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center bg-linear-to-br {staticItem.category ===
'navigation'
? 'from-[#FA5D5D] to-[#DC2F30]'
: 'from-[#4FBBFE] to-[#2090F3]'} rounded-md text-white"
>
<SearchIcon name={staticItem.icon} />
</div>
<span class="ml-4 text-lg truncate"> <span class="ml-4 text-lg truncate">
<HighlightedText <HighlightedText text={staticItem.text} term={searchTerm} matches={result.matches} />
text={staticItem.text}
term={searchTerm}
matches={result.matches}
/>
</span> </span>
</button> </button>
{:else if result.type === "dynamic"} {:else if result.type === 'dynamic'}
{@const dynamicItem = item as IndexItem} {@const dynamicItem = item as IndexItem}
{@const RenderComponent = renderComponentMap[dynamicItem.renderComponentId]} {@const RenderComponent = renderComponentMap[dynamicItem.renderComponentId]}
{#if RenderComponent} {#if RenderComponent}
<RenderComponent <RenderComponent
item={dynamicItem} item={dynamicItem}
{isSelected} isSelected={isSelected}
{searchTerm} searchTerm={searchTerm}
matches={result.matches} matches={result.matches}
onclick={() => executeItemAction(dynamicItem)} onclick={() => executeItemAction(dynamicItem)}
onkeydown={() => executeItemAction(dynamicItem)} onkeydown={() => executeItemAction(dynamicItem)}
role="button" role="button"
@@ -419,40 +394,22 @@
/> />
{:else} {:else}
<button <button
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group
{isSelected {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px]' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px]'
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
onclick={() => executeItemAction(dynamicItem)} onclick={() => executeItemAction(dynamicItem)}
> >
<div class="flex items-center w-full"> <div class="flex items-center w-full">
<div <div class="flex-none w-8 h-8 text-xl font-IconFamily flex items-center justify-center {isSelected ? 'text-zinc-900 dark:text-white' : 'text-zinc-600 dark:text-zinc-400'}">{dynamicItem.metadata?.icon || '\ue924'}</div>
class="flex-none w-8 h-8 text-xl flex items-center justify-center {isSelected
? 'text-zinc-900 dark:text-white'
: 'text-zinc-600 dark:text-zinc-400'}"
>
<SearchIcon name={iconForCategory(dynamicItem.category)} />
</div>
<span class="ml-4 text-lg truncate"> <span class="ml-4 text-lg truncate">
<HighlightedText <HighlightedText text={dynamicItem.text} term={searchTerm} matches={result.matches} />
text={dynamicItem.text}
term={searchTerm}
matches={result.matches}
/>
</span> </span>
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400"> <span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
{dynamicItem.category} {dynamicItem.category}
</span> </span>
</div> </div>
{#if dynamicItem.content} {#if dynamicItem.content}
<div <div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start" <HighlightedText text={dynamicItem.content} term={searchTerm} matches={result.matches} />
>
<HighlightedText
text={dynamicItem.content}
term={searchTerm}
matches={result.matches}
/>
</div> </div>
{/if} {/if}
</button> </button>
@@ -463,12 +420,12 @@
{:else if !calculatorResult} {:else if !calculatorResult}
<div class="px-8 py-16 text-center text-zinc-900 dark:text-zinc-200 sm:px-16"> <div class="px-8 py-16 text-center text-zinc-900 dark:text-zinc-200 sm:px-16">
{#if isLoading} {#if isLoading}
<div <div class="mx-auto w-8 h-8 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"></div>
class="mx-auto w-8 h-8 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"
></div>
<p class="mt-4 text-lg dark:text-zinc-300">Searching...</p> <p class="mt-4 text-lg dark:text-zinc-300">Searching...</p>
{:else} {:else}
<FolderOpenIcon class="mx-auto w-8 h-8" /> <svg class="mx-auto w-8 h-8" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" />
</svg>
<p class="mt-6 text-lg dark:text-zinc-300">No matches found. Try something else.</p> <p class="mt-6 text-lg dark:text-zinc-300">No matches found. Try something else.</p>
{/if} {/if}
</div> </div>
@@ -476,15 +433,13 @@
</ul> </ul>
<div class="px-3 py-2 w-full border-t border-zinc-900/5 dark:border-zinc-100/5 bg-white/5"> <div class="px-3 py-2 w-full border-t border-zinc-900/5 dark:border-zinc-100/5 bg-white/5">
{#if combinedResults.length > 0 || calculatorResult} {#if combinedResults.length > 0 || calculatorResult}
<div <div class="flex justify-between items-center h-7 text-sm text-zinc-500 dark:text-zinc-400">
class="flex justify-between items-center h-7 text-sm text-zinc-500 dark:text-zinc-400"
>
<div class="flex gap-4 items-center"> <div class="flex gap-4 items-center">
{@render Shortcut({ text: "Navigate", keybind: ["↑", "↓"] })} {@render Shortcut({ text: 'Navigate', keybind: ['↑', '↓']})}
{#if calculatorResult && selectedIndex === 0} {#if calculatorResult && selectedIndex === 0}
{@render Shortcut({ text: "Copy result", keybind: ["↵"] })} {@render Shortcut({ text: 'Copy result', keybind: ['↵']})}
{:else} {:else}
{@render Shortcut({ text: "Select", keybind: ["↵"] })} {@render Shortcut({ text: 'Select', keybind: ['↵']})}
{/if} {/if}
</div> </div>
</div> </div>
@@ -495,16 +450,13 @@
</div> </div>
{/if} {/if}
{#snippet Shortcut({ text, keybind }: { text: string; keybind: string[] })} {#snippet Shortcut({ text, keybind }: { text: string, keybind: string[] }) }
<div class="flex gap-2 items-center"> <div class="flex gap-2 items-center">
<div class="flex gap-1 items-center"> <div class="flex gap-1 items-center">
{#each keybind as key} {#each keybind as key}
<kbd <kbd class="size-6 text-[0.9rem] flex justify-center items-center rounded-sm bg-zinc-100 dark:bg-zinc-100/10">{key}</kbd>
class="size-6 text-[0.9rem] flex justify-center items-center rounded-sm bg-zinc-100 dark:bg-zinc-100/10"
>{key}</kbd
>
{/each} {/each}
</div> </div>
<span>{text}</span> <span>{text}</span>
</div> </div>
{/snippet} {/snippet}
@@ -1,48 +0,0 @@
<script lang="ts">
import AppWindowIcon from "@lucide/svelte/icons/app-window";
import BookOpenIcon from "@lucide/svelte/icons/book-open";
import CalendarIcon from "@lucide/svelte/icons/calendar";
import ClipboardListIcon from "@lucide/svelte/icons/clipboard-list";
import FileChartColumnIcon from "@lucide/svelte/icons/file-chart-column";
import FileTextIcon from "@lucide/svelte/icons/file-text";
import HouseIcon from "@lucide/svelte/icons/house";
import InboxIcon from "@lucide/svelte/icons/inbox";
import LayoutDashboardIcon from "@lucide/svelte/icons/layout-dashboard";
import MegaphoneIcon from "@lucide/svelte/icons/megaphone";
import MessageSquareIcon from "@lucide/svelte/icons/message-square";
import MessageSquareMoreIcon from "@lucide/svelte/icons/message-square-more";
import MessageSquarePlusIcon from "@lucide/svelte/icons/message-square-plus";
import MessagesSquareIcon from "@lucide/svelte/icons/messages-square";
import RouteIcon from "@lucide/svelte/icons/route";
import SearchIcon from "@lucide/svelte/icons/search";
import SunIcon from "@lucide/svelte/icons/sun";
import TargetIcon from "@lucide/svelte/icons/target";
import type { SearchIconName } from "../core/searchIcons";
let { name, class: className = "" }: { name: SearchIconName; class?: string } = $props();
const ICONS = {
"app-window": AppWindowIcon,
"book-open": BookOpenIcon,
calendar: CalendarIcon,
"clipboard-list": ClipboardListIcon,
"file-chart-column": FileChartColumnIcon,
"file-text": FileTextIcon,
house: HouseIcon,
inbox: InboxIcon,
"layout-dashboard": LayoutDashboardIcon,
megaphone: MegaphoneIcon,
"message-square": MessageSquareIcon,
"message-square-more": MessageSquareMoreIcon,
"message-square-plus": MessageSquarePlusIcon,
"messages-square": MessagesSquareIcon,
route: RouteIcon,
search: SearchIcon,
sun: SunIcon,
target: TargetIcon,
} satisfies Record<SearchIconName, unknown>;
const Icon = $derived(ICONS[name]);
</script>
<Icon size="1em" class={className} />
@@ -1,16 +1,9 @@
<script lang="ts"> <script lang="ts">
import SearchIcon from "../SearchIcon.svelte"; import HighlightedText from '../../utils/HighlightedText.svelte';
import HighlightedText from "../../utils/HighlightedText.svelte"; import type { DynamicContentItem } from '../../utils/dynamicItems';
import type { DynamicContentItem } from "../../utils/dynamicItems"; import type { FuseResultMatch } from '../../core/types';
import type { FuseResultMatch } from "../../core/types";
const { const { item, isSelected, searchTerm, matches, onclick }: {
item,
isSelected,
searchTerm,
matches,
onclick,
}: {
item: DynamicContentItem; item: DynamicContentItem;
isSelected: boolean; isSelected: boolean;
searchTerm: string; searchTerm: string;
@@ -21,19 +14,13 @@
<button <button
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50 class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
{isSelected {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' onclick={onclick}
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}" >
{onclick}
>
<div class="flex items-center w-full"> <div class="flex items-center w-full">
<div <div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center bg-linear-to-br from-[#59F675] to-[#1BC636] rounded-md text-white">{item.metadata?.icon || '\uebee'}</div>
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center bg-linear-to-br from-[#59F675] to-[#1BC636] rounded-md text-white"
>
<SearchIcon name="message-square-more" />
</div>
<span class="ml-4 text-lg truncate"> <span class="ml-4 text-lg truncate">
<HighlightedText text={item.text} term={searchTerm} {matches} /> <HighlightedText text={item.text} term={searchTerm} matches={matches} />
</span> </span>
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400"> <span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
{item.category} {item.category}
@@ -41,7 +28,7 @@
</div> </div>
{#if item.content} {#if item.content}
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start"> <div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
<HighlightedText text={item.content} term={searchTerm} {matches} /> <HighlightedText text={item.content} term={searchTerm} matches={matches} />
</div> </div>
{/if} {/if}
</button> </button>
@@ -1,16 +1,9 @@
<script lang="ts"> <script lang="ts">
import SearchIcon from "../SearchIcon.svelte"; import HighlightedText from '../../utils/HighlightedText.svelte';
import HighlightedText from "../../utils/HighlightedText.svelte"; import type { DynamicContentItem } from '../../utils/dynamicItems';
import type { DynamicContentItem } from "../../utils/dynamicItems"; import type { FuseResultMatch } from '../../core/types';
import type { FuseResultMatch } from "../../core/types";
const { const { item, isSelected, searchTerm, matches, onclick }: {
item,
isSelected,
searchTerm,
matches,
onclick,
}: {
item: DynamicContentItem; item: DynamicContentItem;
isSelected: boolean; isSelected: boolean;
searchTerm: string; searchTerm: string;
@@ -21,22 +14,16 @@
<button <button
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50 class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
{isSelected {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' onclick={onclick}
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}" >
{onclick}
>
<div class="flex items-center w-full"> <div class="flex items-center w-full">
<div <div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center text-white bg-linear-to-br from-[#59aaf6] to-[#1b62c6] rounded-md">{item.metadata?.icon || '\uebe7'}</div>
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center text-white bg-linear-to-br from-[#59aaf6] to-[#1b62c6] rounded-md"
>
<SearchIcon name="messages-square" />
</div>
<span class="ml-4 text-lg truncate {item.metadata?.closed ? 'line-through opacity-80' : ''}"> <span class="ml-4 text-lg truncate {item.metadata?.closed ? 'line-through opacity-80' : ''}">
<HighlightedText text={item.text} term={searchTerm} {matches} /> <HighlightedText text={item.text} term={searchTerm} matches={matches} />
</span> </span>
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400"> <span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
{item.category} {item.category}
</span> </span>
</div> </div>
</button> </button>
@@ -1,17 +1,9 @@
<script lang="ts"> <script lang="ts">
import SearchIcon from "../SearchIcon.svelte"; import HighlightedText from '../../utils/HighlightedText.svelte';
import { iconForCategory } from "../../core/searchIcons"; import type { DynamicContentItem } from '../../utils/dynamicItems';
import HighlightedText from "../../utils/HighlightedText.svelte"; import type { FuseResultMatch } from '../../core/types';
import type { DynamicContentItem } from "../../utils/dynamicItems";
import type { FuseResultMatch } from "../../core/types";
const { const { item, isSelected, searchTerm, matches, onclick }: {
item,
isSelected,
searchTerm,
matches,
onclick,
}: {
item: DynamicContentItem; item: DynamicContentItem;
isSelected: boolean; isSelected: boolean;
searchTerm: string; searchTerm: string;
@@ -20,51 +12,70 @@
} = $props(); } = $props();
const categoryLabel = (category: string): string => { const categoryLabel = (category: string): string => {
if (!category) return ""; if (!category) return '';
return category.charAt(0).toUpperCase() + category.slice(1); return category.charAt(0).toUpperCase() + category.slice(1);
}; };
const gradientForCategory = (category: string): string => { const gradientForCategory = (category: string): string => {
switch (category) { switch (category) {
case "courses": case 'courses':
return "from-[#7c5fe0] to-[#4d2bb8]"; return 'from-[#7c5fe0] to-[#4d2bb8]';
case "notices": case 'notices':
return "from-[#f6c453] to-[#d39007]"; return 'from-[#f6c453] to-[#d39007]';
case "documents": case 'documents':
return "from-[#4FBBFE] to-[#2090F3]"; return 'from-[#4FBBFE] to-[#2090F3]';
case "folio": case 'folio':
return "from-[#22c55e] to-[#0f9b3a]"; return 'from-[#22c55e] to-[#0f9b3a]';
case "portals": case 'portals':
return "from-[#22d3ee] to-[#0e7490]"; return 'from-[#22d3ee] to-[#0e7490]';
case "reports": case 'reports':
return "from-[#f97316] to-[#c2410c]"; return 'from-[#f97316] to-[#c2410c]';
case "goals": case 'goals':
return "from-[#10b981] to-[#047857]"; return 'from-[#10b981] to-[#047857]';
case "passive": case 'passive':
return "from-[#6b7280] to-[#374151]"; return 'from-[#6b7280] to-[#374151]';
default: default:
return "from-[#4FBBFE] to-[#2090F3]"; return 'from-[#4FBBFE] to-[#2090F3]';
}
};
const fallbackIcon = (category: string): string => {
switch (category) {
case 'courses':
return '\ueb4d';
case 'notices':
return '\ueb24';
case 'documents':
return '\ueb6f';
case 'folio':
return '\ueb16';
case 'portals':
return '\ueb01';
case 'reports':
return '\ueb70';
case 'goals':
return '\uea15';
case 'passive':
return '\ueb71';
default:
return '\ue924';
} }
}; };
</script> </script>
<button <button
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50 class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
{isSelected {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' onclick={onclick}
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
{onclick}
> >
<div class="flex items-center w-full"> <div class="flex items-center w-full">
<div <div
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center text-white rounded-md bg-linear-to-br {gradientForCategory( class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center text-white rounded-md bg-linear-to-br {gradientForCategory(item.category)}"
item.category,
)}"
> >
<SearchIcon name={iconForCategory(item.category)} /> {item.metadata?.icon || fallbackIcon(item.category)}
</div> </div>
<span class="ml-4 text-lg truncate"> <span class="ml-4 text-lg truncate">
<HighlightedText text={item.text} term={searchTerm} {matches} /> <HighlightedText text={item.text} term={searchTerm} matches={matches} />
</span> </span>
<span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400"> <span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400">
{item.metadata?.subjectCode || categoryLabel(item.category)} {item.metadata?.subjectCode || categoryLabel(item.category)}
@@ -72,7 +83,7 @@
</div> </div>
{#if item.content} {#if item.content}
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start"> <div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
<HighlightedText text={item.content} term={searchTerm} {matches} /> <HighlightedText text={item.content} term={searchTerm} matches={matches} />
</div> </div>
{/if} {/if}
</button> </button>
@@ -1,8 +1,7 @@
<script lang="ts"> <script lang="ts">
import SearchIcon from "../SearchIcon.svelte"; import HighlightedText from '../../utils/HighlightedText.svelte';
import HighlightedText from "../../utils/HighlightedText.svelte"; import type { IndexItem } from '../../indexing/types';
import type { IndexItem } from "../../indexing/types"; import type { FuseResultMatch } from '../../core/types';
import type { FuseResultMatch } from "../../core/types";
let { let {
item, item,
@@ -21,36 +20,23 @@
<button <button
class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50 class="w-full flex flex-col px-2 py-1.5 rounded-lg select-none cursor-pointer group transition-colors duration-100 ring-0 dark:ring-zinc-600/50
{isSelected {isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow-sm' onclick={onclick}
: 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
{onclick}
> >
<div class="flex items-center w-full"> <div class="flex items-center w-full">
<div <div class="flex-none scale-90 w-8 h-8 text-xl font-IconFamily flex items-center justify-center text-white {item.metadata?.type === 'assessments' ? 'bg-linear-to-br from-[#fa915d] to-[#dc6c2f] rounded-md' : 'bg-linear-to-br from-[#4FBBFE] to-[#2090F3] rounded-md'} {item.metadata.isActive ? 'opacity-100' : 'opacity-80'}">
class="flex-none scale-90 w-8 h-8 text-xl flex items-center justify-center text-white {item {item.metadata?.type === 'assessments' ? '\ueac3' : '\ueb4d'}
.metadata?.type === 'assessments'
? 'bg-linear-to-br from-[#fa915d] to-[#dc6c2f] rounded-md'
: 'bg-linear-to-br from-[#4FBBFE] to-[#2090F3] rounded-md'} {item.metadata.isActive
? 'opacity-100'
: 'opacity-80'}"
>
<SearchIcon name={item.metadata?.type === "assessments" ? "clipboard-list" : "book-open"} />
</div> </div>
<span class="ml-4 text-lg truncate {item.metadata.isActive ? 'opacity-100' : 'opacity-70'}"> <span class="ml-4 text-lg truncate {item.metadata.isActive ? 'opacity-100' : 'opacity-70'}">
<HighlightedText text={item.text} term={searchTerm} {matches} /> <HighlightedText text={item.text} term={searchTerm} matches={matches} />
</span> </span>
<span <span class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400 {item.metadata.isActive ? 'opacity-100' : 'opacity-70'}">
class="flex-none ml-auto text-xs text-zinc-500 dark:text-zinc-400 {item.metadata.isActive
? 'opacity-100'
: 'opacity-70'}"
>
{item.metadata?.subjectCode} {item.metadata?.subjectCode}
</span> </span>
</div> </div>
{#if item.content} {#if item.content}
<div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start"> <div class="mt-1 ml-12 text-sm text-zinc-600 dark:text-zinc-400 line-clamp-2 text-start">
<HighlightedText text={item.content} term={searchTerm} {matches} /> <HighlightedText text={item.content} term={searchTerm} matches={matches} />
</div> </div>
{/if} {/if}
</button> </button>
@@ -1,4 +1,3 @@
import type { SearchIconName } from "./searchIcons";
import type { HomeTimetableLesson } from "@/seqta/utils/loaders/homePageTypes"; import type { HomeTimetableLesson } from "@/seqta/utils/loaders/homePageTypes";
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { settingsState } from "@/seqta/utils/listeners/settingsState";
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage"; import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
@@ -8,7 +7,7 @@ export interface BaseCommandItem {
id: string; id: string;
text: string; text: string;
category: string; category: string;
icon: SearchIconName; icon: string;
action: () => void; action: () => void;
keywords?: string[]; keywords?: string[];
priority?: number; priority?: number;
@@ -135,7 +134,7 @@ function formatDate(date: Date): string {
const staticCommands: StaticCommandItem[] = [ const staticCommands: StaticCommandItem[] = [
{ {
id: "home", id: "home",
icon: "house", icon: "\ueb4c",
category: "navigation", category: "navigation",
text: "Home", text: "Home",
action: () => { action: () => {
@@ -146,7 +145,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "messages", id: "messages",
icon: "message-square", icon: "\uebfd",
category: "navigation", category: "navigation",
text: "Direct Messages", text: "Direct Messages",
action: () => { action: () => {
@@ -156,7 +155,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "timetable", id: "timetable",
icon: "calendar", icon: "\ue9cd",
category: "navigation", category: "navigation",
text: "Timetable", text: "Timetable",
action: () => { action: () => {
@@ -166,7 +165,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "Current Lesson", id: "Current Lesson",
icon: "book-open", icon: "\ue9a5",
category: "navigation", category: "navigation",
text: "Current Lesson", text: "Current Lesson",
priority: 4, priority: 4,
@@ -181,7 +180,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "assessments", id: "assessments",
icon: "clipboard-list", icon: "\ueac3",
category: "navigation", category: "navigation",
text: "Assessments", text: "Assessments",
keybind: ["alt+a"], keybind: ["alt+a"],
@@ -193,7 +192,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "dashboard", id: "dashboard",
icon: "layout-dashboard", icon: "\ueb87",
category: "navigation", category: "navigation",
text: "Dashboard", text: "Dashboard",
priority: 4, priority: 4,
@@ -203,7 +202,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "compose-message", id: "compose-message",
icon: "message-square-plus", icon: "\ue924",
category: "action", category: "action",
text: "Compose Message", text: "Compose Message",
action: () => { action: () => {
@@ -223,7 +222,7 @@ const staticCommands: StaticCommandItem[] = [
}, },
{ {
id: "toggle-dark-mode", id: "toggle-dark-mode",
icon: "sun", icon: "\uecfe",
category: "action", category: "action",
text: "Toggle Dark Mode", text: "Toggle Dark Mode",
action: () => (settingsState.DarkMode = !settingsState.DarkMode), action: () => (settingsState.DarkMode = !settingsState.DarkMode),
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { Search } from "lucide-static";
import SearchBar from "../components/SearchBar.svelte"; import SearchBar from "../components/SearchBar.svelte";
import { unmount } from "svelte"; import { unmount } from "svelte";
import { warmUpVectorSearchOnInteraction } from "../search/vector/vectorSearch"; import { warmUpVectorSearchOnInteraction } from "../search/vector/vectorSearch";
@@ -22,7 +20,8 @@ type AppRef = {
ownedTrigger?: boolean; ownedTrigger?: boolean;
}; };
const SEARCH_SVG = icon(Search, { size: 16 }); const SEARCH_SVG =
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>';
async function resolveTriggerWrapper(titleElement: Element): Promise<HTMLElement | null> { async function resolveTriggerWrapper(titleElement: Element): Promise<HTMLElement | null> {
const existing = titleElement.querySelector(".search-trigger-wrapper") as HTMLElement | null; const existing = titleElement.querySelector(".search-trigger-wrapper") as HTMLElement | null;
@@ -113,7 +112,7 @@ export async function mountSearchBar(titleElement: Element, api: GlobalSearchApi
!progressBar || !progressBar ||
!progressText !progressText
) { ) {
console.error("[BetterSEQTA+] Global Search: Search trigger markup incomplete"); console.error("[Global Search] Search trigger markup incomplete");
return; return;
} }
@@ -1,34 +0,0 @@
export type SearchIconName =
| "app-window"
| "book-open"
| "calendar"
| "clipboard-list"
| "file-chart-column"
| "file-text"
| "house"
| "inbox"
| "layout-dashboard"
| "megaphone"
| "message-square"
| "message-square-more"
| "message-square-plus"
| "messages-square"
| "route"
| "search"
| "sun"
| "target";
const CATEGORY_ICONS: Record<string, SearchIconName> = {
courses: "book-open",
notices: "megaphone",
documents: "file-text",
folio: "route",
portals: "app-window",
reports: "file-chart-column",
goals: "target",
passive: "inbox",
};
export function iconForCategory(category: string): SearchIconName {
return CATEGORY_ICONS[category] ?? "message-square-plus";
}
@@ -1,6 +1,4 @@
<script lang="ts"> <script lang="ts">
import CheckIcon from "@lucide/svelte/icons/check";
import XIcon from "@lucide/svelte/icons/x";
import { fade, scale } from "svelte/transition"; import { fade, scale } from "svelte/transition";
import type { AnalyticsClassGroup, AnalyticsClassOption } from "./types"; import type { AnalyticsClassGroup, AnalyticsClassOption } from "./types";
import { animationsEnabled } from "@/seqta/utils/performanceMode"; import { animationsEnabled } from "@/seqta/utils/performanceMode";
@@ -147,7 +145,7 @@
aria-label="Delete {group.name}" aria-label="Delete {group.name}"
onclick={() => deleteGroup(group.id)} onclick={() => deleteGroup(group.id)}
> >
<XIcon size="1em" /> ×
</button> </button>
</li> </li>
{/each} {/each}
@@ -178,10 +176,7 @@
> >
<header class="bsplus-analytics-class-groups-dialog-head"> <header class="bsplus-analytics-class-groups-dialog-head">
<div> <div>
<h2 <h2 id="bsplus-class-group-modal-title" class="bsplus-analytics-class-groups-dialog-title">
id="bsplus-class-group-modal-title"
class="bsplus-analytics-class-groups-dialog-title"
>
{editingId ? "Edit combined classes" : "Combine classes"} {editingId ? "Edit combined classes" : "Combine classes"}
</h2> </h2>
<p class="bsplus-analytics-class-groups-dialog-desc"> <p class="bsplus-analytics-class-groups-dialog-desc">
@@ -194,7 +189,7 @@
aria-label="Close" aria-label="Close"
onclick={cancelEditor} onclick={cancelEditor}
> >
<XIcon size="1em" /> ×
</button> </button>
</header> </header>
@@ -227,7 +222,7 @@
onchange={() => toggleDraftClass(option.key)} onchange={() => toggleDraftClass(option.key)}
/> />
<span class="bsplus-analytics-class-groups-check" aria-hidden="true"> <span class="bsplus-analytics-class-groups-check" aria-hidden="true">
{#if picked}<CheckIcon size="1em" />{/if} {#if picked}✓{/if}
</span> </span>
<span class="bsplus-analytics-class-groups-pick-text"> <span class="bsplus-analytics-class-groups-pick-text">
<span class="bsplus-analytics-class-groups-pick-label">{option.title}</span> <span class="bsplus-analytics-class-groups-pick-label">{option.title}</span>
@@ -240,7 +235,9 @@
</div> </div>
<footer class="bsplus-analytics-class-groups-dialog-actions"> <footer class="bsplus-analytics-class-groups-dialog-actions">
<button type="button" class="bsplus-analytics-btn" onclick={cancelEditor}> Cancel </button> <button type="button" class="bsplus-analytics-btn" onclick={cancelEditor}>
Cancel
</button>
<button <button
type="button" type="button"
class="bsplus-analytics-btn bsplus-analytics-btn-primary" class="bsplus-analytics-btn bsplus-analytics-btn-primary"
@@ -1,8 +1,11 @@
<script lang="ts"> <script lang="ts">
import CheckIcon from "@lucide/svelte/icons/check";
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";
import { fade } from "svelte/transition"; import { fade } from "svelte/transition";
import type { AnalyticsClassGroup, AnalyticsClassOption, Assessment } from "./types"; import type {
AnalyticsClassGroup,
AnalyticsClassOption,
Assessment,
} from "./types";
import { import {
loadGradeAnalytics, loadGradeAnalytics,
syncGradeAnalytics, syncGradeAnalytics,
@@ -39,7 +42,8 @@
let { simpleMode = false }: { simpleMode?: boolean } = $props(); let { simpleMode = false }: { simpleMode?: boolean } = $props();
const LOAD_ERROR = "Unable to load analytics. Check your connection, then select Refresh data."; const LOAD_ERROR =
"Unable to load analytics. Check your connection, then select Refresh data.";
const SYNC_ERROR_WITH_DATA = const SYNC_ERROR_WITH_DATA =
"Unable to sync. Showing saved data. Select Refresh data to try again."; "Unable to sync. Showing saved data. Select Refresh data to try again.";
@@ -62,7 +66,9 @@
let classCatalog: AnalyticsClassOption[] = $state([]); let classCatalog: AnalyticsClassOption[] = $state([]);
let activeClassGroupId: string | null = $state(null); let activeClassGroupId: string | null = $state(null);
let studentId: number | null = $state(null); let studentId: number | null = $state(null);
let gradeInference = $state<AnalyticsGradeInferenceSettings>(DEFAULT_ANALYTICS_GRADE_INFERENCE); let gradeInference = $state<AnalyticsGradeInferenceSettings>(
DEFAULT_ANALYTICS_GRADE_INFERENCE,
);
let timeRangeTrigger: HTMLButtonElement | null = $state(null); let timeRangeTrigger: HTMLButtonElement | null = $state(null);
let subjectsTrigger: HTMLButtonElement | null = $state(null); let subjectsTrigger: HTMLButtonElement | null = $state(null);
@@ -80,7 +86,9 @@
return lastUpdated ? formatLastUpdated(lastUpdated) : ""; return lastUpdated ? formatLastUpdated(lastUpdated) : "";
}); });
const activeClassGroup = $derived(classGroups.find((g) => g.id === activeClassGroupId) ?? null); const activeClassGroup = $derived(
classGroups.find((g) => g.id === activeClassGroupId) ?? null,
);
const activeClassKeys = $derived(activeClassGroup?.classKeys ?? []); const activeClassKeys = $derived(activeClassGroup?.classKeys ?? []);
@@ -122,7 +130,9 @@
filterAssessmentsByTimeRange(filteredData, timeRange, customTimeRange), filterAssessmentsByTimeRange(filteredData, timeRange, customTimeRange),
); );
const gradedFiltered = $derived(timeScopedData.filter((a) => a.finalGrade !== undefined)); const gradedFiltered = $derived(
timeScopedData.filter((a) => a.finalGrade !== undefined),
);
const statsAverage = $derived.by(() => { const statsAverage = $derived.by(() => {
if (!gradedFiltered.length) return null; if (!gradedFiltered.length) return null;
@@ -130,7 +140,9 @@
return Math.round((sum / gradedFiltered.length) * 10) / 10; return Math.round((sum / gradedFiltered.length) * 10) / 10;
}); });
const statsSubjectCount = $derived(new Set(timeScopedData.map((a) => a.subject)).size); const statsSubjectCount = $derived(
new Set(timeScopedData.map((a) => a.subject)).size,
);
const timeRangeLabel = $derived(getTimeRangeLabel(timeRange, customTimeRange)); const timeRangeLabel = $derived(getTimeRangeLabel(timeRange, customTimeRange));
@@ -319,7 +331,8 @@
} }
const ttl = getCacheTtlMs(24); const ttl = getCacheTtlMs(24);
const needsSync = !lastUpdated || Date.now() - lastUpdated.getTime() > ttl; const needsSync =
!lastUpdated || Date.now() - lastUpdated.getTime() > ttl;
if (needsSync) { if (needsSync) {
void runSync(); void runSync();
} }
@@ -343,11 +356,7 @@
<p class="bsplus-analytics-sr-only" role="status">{statusMessage}</p> <p class="bsplus-analytics-sr-only" role="status">{statusMessage}</p>
{#if error && hasData} {#if error && hasData}
<p <p class="bsplus-analytics-alert bsplus-analytics-animate" role="alert" transition:fade={{ duration: fadeDuration }}>
class="bsplus-analytics-alert bsplus-analytics-animate"
role="alert"
transition:fade={{ duration: fadeDuration }}
>
{error} {error}
</p> </p>
{/if} {/if}
@@ -368,16 +377,18 @@
<div class="bsplus-analytics-filters-head"> <div class="bsplus-analytics-filters-head">
<h2 class="bsplus-analytics-filters-title">Filters</h2> <h2 class="bsplus-analytics-filters-title">Filters</h2>
{#if hasActiveFilters} {#if hasActiveFilters}
<button type="button" class="bsplus-analytics-filters-clear" onclick={clearFilters}> <button
type="button"
class="bsplus-analytics-filters-clear"
onclick={clearFilters}
>
Clear all Clear all
</button> </button>
{/if} {/if}
</div> </div>
<div class="bsplus-analytics-filter-group"> <div class="bsplus-analytics-filter-group">
<span class="bsplus-analytics-field-label" id="bsplus-analytics-time-label" <span class="bsplus-analytics-field-label" id="bsplus-analytics-time-label">Time period</span>
>Time period</span
>
<div class="bsplus-analytics-dropdown" data-analytics-dropdown> <div class="bsplus-analytics-dropdown" data-analytics-dropdown>
<button <button
bind:this={timeRangeTrigger} bind:this={timeRangeTrigger}
@@ -402,9 +413,7 @@
aria-pressed={selected} aria-pressed={selected}
onclick={() => selectTimeRange(option.value)} onclick={() => selectTimeRange(option.value)}
> >
<span class="bsplus-analytics-dropdown-check" aria-hidden="true" <span class="bsplus-analytics-dropdown-check" aria-hidden="true">{selected ? "✓" : ""}</span>
>{#if selected}<CheckIcon size="1em" />{/if}</span
>
<span>{option.label}</span> <span>{option.label}</span>
</button> </button>
{/each} {/each}
@@ -436,9 +445,7 @@
</div> </div>
<div class="bsplus-analytics-filter-group"> <div class="bsplus-analytics-filter-group">
<span class="bsplus-analytics-field-label" id="bsplus-analytics-subjects-label" <span class="bsplus-analytics-field-label" id="bsplus-analytics-subjects-label">Subjects</span>
>Subjects</span
>
<div class="bsplus-analytics-dropdown" data-analytics-dropdown> <div class="bsplus-analytics-dropdown" data-analytics-dropdown>
<button <button
bind:this={subjectsTrigger} bind:this={subjectsTrigger}
@@ -462,9 +469,7 @@
aria-pressed={allSelected} aria-pressed={allSelected}
onclick={selectAllSubjects} onclick={selectAllSubjects}
> >
<span class="bsplus-analytics-dropdown-check" aria-hidden="true" <span class="bsplus-analytics-dropdown-check" aria-hidden="true">{allSelected ? "✓" : ""}</span>
>{#if allSelected}<CheckIcon size="1em" />{/if}</span
>
<span>All subjects</span> <span>All subjects</span>
</button> </button>
{#each uniqueSubjects as subject (subject)} {#each uniqueSubjects as subject (subject)}
@@ -476,9 +481,7 @@
aria-pressed={selected} aria-pressed={selected}
onclick={() => toggleSubject(subject)} onclick={() => toggleSubject(subject)}
> >
<span class="bsplus-analytics-dropdown-check" aria-hidden="true" <span class="bsplus-analytics-dropdown-check" aria-hidden="true">{selected ? "✓" : ""}</span>
>{#if selected}<CheckIcon size="1em" />{/if}</span
>
<span class="bsplus-analytics-filter-subject-name">{subject}</span> <span class="bsplus-analytics-filter-subject-name">{subject}</span>
</button> </button>
{/each} {/each}
@@ -520,9 +523,7 @@
role="group" role="group"
aria-labelledby="bsplus-analytics-grade-label" aria-labelledby="bsplus-analytics-grade-label"
> >
<span class="bsplus-analytics-field-label" id="bsplus-analytics-grade-label" <span class="bsplus-analytics-field-label" id="bsplus-analytics-grade-label">Grade range</span>
>Grade range</span
>
<GradeRangeSlider bind:value={gradeRange} /> <GradeRangeSlider bind:value={gradeRange} />
</div> </div>
@@ -565,10 +566,7 @@
<p class="bsplus-analytics-meta">Loading analytics…</p> <p class="bsplus-analytics-meta">Loading analytics…</p>
</div> </div>
{:else if hasData} {:else if hasData}
<div <div class="bsplus-analytics-stats bsplus-analytics-animate" aria-label="Summary statistics">
class="bsplus-analytics-stats bsplus-analytics-animate"
aria-label="Summary statistics"
>
<div class="bsplus-analytics-stat"> <div class="bsplus-analytics-stat">
<div class="bsplus-analytics-stat-label">Average grade</div> <div class="bsplus-analytics-stat-label">Average grade</div>
<div class="bsplus-analytics-stat-value"> <div class="bsplus-analytics-stat-value">
@@ -617,8 +615,8 @@
{:else} {:else}
<h2>No analytics data yet</h2> <h2>No analytics data yet</h2>
<p> <p>
Data syncs when you visit this page. Assessments with released marks will appear here Data syncs when you visit this page. Assessments with released marks will
with trends and grade breakdowns. appear here with trends and grade breakdowns.
</p> </p>
{/if} {/if}
</div> </div>
@@ -1,6 +1,4 @@
<script lang="ts"> <script lang="ts">
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
import XIcon from "@lucide/svelte/icons/x";
import { import {
createGradeBand, createGradeBand,
DEFAULT_ANALYTICS_GRADE_INFERENCE, DEFAULT_ANALYTICS_GRADE_INFERENCE,
@@ -33,7 +31,9 @@
function updateBand(id: string, patch: Partial<GradeBandMapping>) { function updateBand(id: string, patch: Partial<GradeBandMapping>) {
draft = { draft = {
...draft, ...draft,
gradeBands: draft.gradeBands.map((band) => (band.id === id ? { ...band, ...patch } : band)), gradeBands: draft.gradeBands.map((band) =>
band.id === id ? { ...band, ...patch } : band,
),
}; };
} }
@@ -83,10 +83,7 @@
> >
<span class="bsplus-analytics-field-label">Grade inference (optional)</span> <span class="bsplus-analytics-field-label">Grade inference (optional)</span>
<span class="bsplus-analytics-grade-inference-chevron" aria-hidden="true" <span class="bsplus-analytics-grade-inference-chevron" aria-hidden="true"
><ChevronDownIcon >{expanded ? "▾" : "▸"}</span
size="1em"
style={expanded ? undefined : "transform: rotate(-90deg)"}
/></span
> >
</button> </button>
@@ -101,7 +98,8 @@
type="checkbox" type="checkbox"
checked={draft.useCustomGradeBands} checked={draft.useCustomGradeBands}
disabled={disabled || saving} disabled={disabled || saving}
onchange={(e) => updateDraft({ useCustomGradeBands: e.currentTarget.checked })} onchange={(e) =>
updateDraft({ useCustomGradeBands: e.currentTarget.checked })}
/> />
<span>Map rubric / letter bands to percentages</span> <span>Map rubric / letter bands to percentages</span>
</label> </label>
@@ -116,7 +114,8 @@
placeholder="Band label (e.g. A, Proficient)" placeholder="Band label (e.g. A, Proficient)"
value={band.label} value={band.label}
disabled={disabled || saving} disabled={disabled || saving}
oninput={(e) => updateBand(band.id, { label: e.currentTarget.value })} oninput={(e) =>
updateBand(band.id, { label: e.currentTarget.value })}
/> />
<input <input
type="number" type="number"
@@ -126,7 +125,8 @@
step="1" step="1"
value={band.percent} value={band.percent}
disabled={disabled || saving} disabled={disabled || saving}
oninput={(e) => updateBand(band.id, { percent: Number(e.currentTarget.value) })} oninput={(e) =>
updateBand(band.id, { percent: Number(e.currentTarget.value) })}
/> />
<span class="bsplus-analytics-grade-band-suffix">%</span> <span class="bsplus-analytics-grade-band-suffix">%</span>
<button <button
@@ -136,7 +136,7 @@
disabled={disabled || saving} disabled={disabled || saving}
onclick={() => removeBand(band.id)} onclick={() => removeBand(band.id)}
> >
<XIcon size="1em" /> ×
</button> </button>
</div> </div>
{/each} {/each}
@@ -156,7 +156,8 @@
type="checkbox" type="checkbox"
checked={draft.rollupCriteriaGrades} checked={draft.rollupCriteriaGrades}
disabled={disabled || saving} disabled={disabled || saving}
onchange={(e) => updateDraft({ rollupCriteriaGrades: e.currentTarget.checked })} onchange={(e) =>
updateDraft({ rollupCriteriaGrades: e.currentTarget.checked })}
/> />
<span>Estimate overall % from marked criteria (sub-assessments)</span> <span>Estimate overall % from marked criteria (sub-assessments)</span>
</label> </label>
@@ -1,4 +1,4 @@
import { pageIcon } from "@/seqta/utils/pageIcons"; import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
import { waitForElm } from "@/seqta/utils/waitForElm"; import { waitForElm } from "@/seqta/utils/waitForElm";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage"; import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import { import {
@@ -14,7 +14,7 @@ import { applyMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
import { getNativeMenuList } from "@/seqta/ui/sidebar/parseNativeMenu"; import { getNativeMenuList } from "@/seqta/ui/sidebar/parseNativeMenu";
import { rafThrottle } from "@/seqta/utils/rafThrottle"; import { rafThrottle } from "@/seqta/utils/rafThrottle";
const ANALYTICS_MENU_ICON = pageIcon("analytics")!; const ANALYTICS_MENU_ICON = MenuitemSVGKey.analytics;
export const ANALYTICS_MENU_CLASS = "betterseqta-grade-analytics-item"; export const ANALYTICS_MENU_CLASS = "betterseqta-grade-analytics-item";
export const ANALYTICS_MENU_KEY = "analytics"; export const ANALYTICS_MENU_KEY = "analytics";
+84 -105
View File
@@ -1,29 +1,3 @@
import { icon } from "@/lib/icon";
import {
Book,
Briefcase,
Calendar,
Check,
ChevronDown,
FileText,
Flame,
Folder,
GripHorizontal,
Heart,
House,
Inbox,
Lightbulb,
MessageSquare,
Music,
NotepadText,
Pencil,
Plus,
Star,
Target,
Trash,
Users,
X,
} from "lucide-static";
import type { Plugin } from "../../core/types"; import type { Plugin } from "../../core/types";
import type { MessageFoldersSettings } from "./lazy"; import type { MessageFoldersSettings } from "./lazy";
import { waitForElm } from "@/seqta/utils/waitForElm"; import { waitForElm } from "@/seqta/utils/waitForElm";
@@ -32,8 +6,7 @@ interface Folder {
id: string; id: string;
name: string; name: string;
color: string; color: string;
icon: FolderIconName; emoji: string;
emoji?: string;
} }
const FOLDER_COLORS = [ const FOLDER_COLORS = [
@@ -47,70 +20,73 @@ const FOLDER_COLORS = [
"#f97316", "#f97316",
]; ];
const FOLDER_ICONS = { const folderHeroicon = (inner: string) =>
folder: Folder, `<svg style="width:16px;height:16px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${inner}</svg>`;
inbox: Inbox,
star: Star,
heart: Heart,
flame: Flame,
lightbulb: Lightbulb,
"file-text": FileText,
target: Target,
calendar: Calendar,
"notepad-text": NotepadText,
users: Users,
"message-square": MessageSquare,
briefcase: Briefcase,
house: House,
book: Book,
music: Music,
};
type FolderIconName = keyof typeof FOLDER_ICONS; const FOLDER_HEROICONS = [
folderHeroicon(
const FOLDER_ICON_NAMES = Object.keys(FOLDER_ICONS) as FolderIconName[]; '<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>',
),
const LEGACY_FOLDER_ICON_MARKERS: [string, FolderIconName][] = [ folderHeroicon(
["10 9 9 9 8 9", "file-text"], '<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',
["M22 19a2", "folder"], ),
["22 12 16 12", "inbox"], folderHeroicon(
["12 2 15.09", "star"], '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
["M20.84 4.61", "heart"], ),
["M8.5 14.5", "flame"], folderHeroicon(
["M9 18h6", "lightbulb"], '<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>',
["M14 2H6", "notepad-text"], ),
['r="10"', "target"], folderHeroicon(
['y="4" width="18"', "calendar"], '<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>',
["M17 21v-2", "users"], ),
["M21 15a2", "message-square"], folderHeroicon(
['y="7" width="20"', "briefcase"], '<path d="M9 18h6"/><path d="M10 22h4"/><path d="M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14"/>',
["M3 9l9-7", "house"], ),
["M4 19.5A2.5", "book"], folderHeroicon(
["M9 18V5", "music"], '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/>',
),
folderHeroicon(
'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',
),
folderHeroicon(
'<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/>',
),
folderHeroicon(
'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/>',
),
folderHeroicon(
'<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
),
folderHeroicon('<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>'),
folderHeroicon(
'<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>',
),
folderHeroicon(
'<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/>',
),
folderHeroicon(
'<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>',
),
folderHeroicon(
'<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
),
]; ];
const folderIconSvg = (name: FolderIconName) => icon(FOLDER_ICONS[name], { size: 16 }); const FOLDER_ICON_SVG = `<svg style="width:24px;height:24px;flex-shrink:0" viewBox="0 0 24 24"><path fill="currentColor" d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>`;
const PLUS_SVG = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>`;
const FOLDER_ICON_SVG = icon(Folder); const CHECK_SVG_WHITE = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#fff" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>`;
const PLUS_SVG = icon(Plus, { size: 14, style: "color: #888" }); const CLOSE_SVG = `<svg style="width:14px;height:14px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>`;
const CHECK_SVG_WHITE = icon(Check, { size: 14, style: "color: #fff" }); const EDIT_SVG = `<svg style="width:12px;height:12px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></svg>`;
const CLOSE_SVG = icon(X, { size: 14, style: "color: #888" }); const TRASH_SVG = `<svg style="width:12px;height:12px;flex-shrink:0" viewBox="0 0 24 24"><path fill="#888" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>`;
const EDIT_SVG = icon(Pencil, { size: 12, style: "color: #888" }); const CHEVRON_SVG = `<svg style="width:12px;height:12px;flex-shrink:0;transition:transform .2s" viewBox="0 0 24 24"><path fill="#888" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>`;
const TRASH_SVG = icon(Trash, { size: 12, style: "color: #888" }); const DRAG_SVG = `<svg style="width:14px;height:14px;flex-shrink:0;cursor:grab" viewBox="0 0 24 24"><path fill="#888" d="M6.5 12.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5.5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5.5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/></svg>`;
const CHEVRON_SVG = icon(ChevronDown, {
size: 12,
style: "color: #888; transition: transform 0.2s",
});
const DRAG_SVG = icon(GripHorizontal, { size: 14, style: "color: #888; cursor: grab" });
function isAllowedFolderColor(color: unknown): color is string { function isAllowedFolderColor(color: unknown): color is string {
return typeof color === "string" && FOLDER_COLORS.includes(color); return typeof color === "string" && FOLDER_COLORS.includes(color);
} }
function folderIconName(value: unknown): FolderIconName { function isAllowedFolderIcon(icon: unknown): icon is string {
if (typeof value !== "string") return "folder"; return typeof icon === "string" && FOLDER_HEROICONS.includes(icon);
if (Object.hasOwn(FOLDER_ICONS, value)) return value as FolderIconName;
return LEGACY_FOLDER_ICON_MARKERS.find(([marker]) => value.includes(marker))?.[1] ?? "folder";
} }
function normalizeFolder(folder: Folder): Folder { function normalizeFolder(folder: Folder): Folder {
@@ -118,22 +94,26 @@ function normalizeFolder(folder: Folder): Folder {
id: typeof folder.id === "string" && folder.id ? folder.id : crypto.randomUUID(), id: typeof folder.id === "string" && folder.id ? folder.id : crypto.randomUUID(),
name: typeof folder.name === "string" ? folder.name.trim().slice(0, 30) : "Folder", name: typeof folder.name === "string" ? folder.name.trim().slice(0, 30) : "Folder",
color: isAllowedFolderColor(folder.color) ? folder.color : FOLDER_COLORS[0], color: isAllowedFolderColor(folder.color) ? folder.color : FOLDER_COLORS[0],
icon: folderIconName(folder.icon ?? folder.emoji), emoji: isAllowedFolderIcon(folder.emoji) ? folder.emoji : FOLDER_HEROICONS[0],
}; };
} }
function setFolderIcon(parent: HTMLElement, name: FolderIconName): void { function setSvgIconContent(parent: HTMLElement, svgMarkup: string): void {
parent.innerHTML = folderIconSvg(name); parent.replaceChildren();
const template = document.createElement("template");
template.innerHTML = svgMarkup.trim();
const node = template.content.firstElementChild;
if (node) parent.appendChild(node);
} }
function appendFolderBadgeContent(badge: HTMLElement, folder: Folder): void { function appendFolderBadgeContent(badge: HTMLElement, folder: Folder): void {
badge.replaceChildren(); badge.replaceChildren();
if (folder.icon) { if (folder.emoji) {
const iconWrap = document.createElement("span"); const iconWrap = document.createElement("span");
iconWrap.style.display = "inline-flex"; iconWrap.style.display = "inline-flex";
iconWrap.style.verticalAlign = "middle"; iconWrap.style.verticalAlign = "middle";
iconWrap.style.marginRight = "2px"; iconWrap.style.marginRight = "2px";
setFolderIcon(iconWrap, folder.icon); setSvgIconContent(iconWrap, folder.emoji);
badge.appendChild(iconWrap); badge.appendChild(iconWrap);
} }
badge.appendChild(document.createTextNode(folder.name)); badge.appendChild(document.createTextNode(folder.name));
@@ -355,7 +335,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
const allItem = document.createElement("div"); const allItem = document.createElement("div");
allItem.className = `bsplus-folder-item bsplus-all-msgs${activeFolderId === null ? " bsplus-folder-active" : ""}`; allItem.className = `bsplus-folder-item bsplus-all-msgs${activeFolderId === null ? " bsplus-folder-active" : ""}`;
allItem.innerHTML = ` allItem.innerHTML = `
${icon(Inbox, { size: 14, style: "opacity: 0.5" })} <svg width="14" height="14" viewBox="0 0 24 24" style="fill: currentcolor; opacity: 0.5; flex-shrink: 0;"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>
<span class="bsplus-folder-name">All Messages</span> <span class="bsplus-folder-name">All Messages</span>
`; `;
allItem.addEventListener("click", () => { allItem.addEventListener("click", () => {
@@ -388,7 +368,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
const iconSpan = document.createElement("span"); const iconSpan = document.createElement("span");
iconSpan.className = "bsplus-folder-icon"; iconSpan.className = "bsplus-folder-icon";
setFolderIcon(iconSpan, folder.icon); setSvgIconContent(iconSpan, folder.emoji || FOLDER_HEROICONS[0]);
item.appendChild(iconSpan); item.appendChild(iconSpan);
const name = document.createElement("span"); const name = document.createElement("span");
@@ -545,7 +525,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
let selectedColor = let selectedColor =
editFolder?.color ?? FOLDER_COLORS[Math.floor(Math.random() * FOLDER_COLORS.length)]; editFolder?.color ?? FOLDER_COLORS[Math.floor(Math.random() * FOLDER_COLORS.length)];
let selectedIcon = let selectedIcon =
editFolder?.icon ?? FOLDER_ICON_NAMES[Math.floor(Math.random() * FOLDER_ICON_NAMES.length)]; editFolder?.emoji ?? FOLDER_HEROICONS[Math.floor(Math.random() * FOLDER_HEROICONS.length)];
const row = document.createElement("div"); const row = document.createElement("div");
row.className = "bsplus-folder-input"; row.className = "bsplus-folder-input";
@@ -559,7 +539,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
const iconBtn = document.createElement("button"); const iconBtn = document.createElement("button");
iconBtn.className = "bsplus-folder-icon-btn"; iconBtn.className = "bsplus-folder-icon-btn";
iconBtn.title = "Pick icon"; iconBtn.title = "Pick icon";
iconBtn.innerHTML = folderIconSvg(selectedIcon); iconBtn.innerHTML = selectedIcon;
iconBtn.addEventListener("click", (e) => { iconBtn.addEventListener("click", (e) => {
e.stopPropagation(); e.stopPropagation();
const picker = container.querySelector(".bsplus-icon-picker") as HTMLElement | null; const picker = container.querySelector(".bsplus-icon-picker") as HTMLElement | null;
@@ -567,9 +547,9 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
picker.remove(); picker.remove();
return; return;
} }
showIconPicker(container, (name) => { showIconPicker(container, (iconSvg) => {
selectedIcon = name; selectedIcon = iconSvg;
iconBtn.innerHTML = folderIconSvg(name); iconBtn.innerHTML = iconSvg;
}); });
}); });
@@ -612,7 +592,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
if (!name) return; if (!name) return;
if (editFolder) { if (editFolder) {
const folders = getFolders().map((f) => const folders = getFolders().map((f) =>
f.id === editFolder.id ? { ...f, name, color: selectedColor, icon: selectedIcon } : f, f.id === editFolder.id ? { ...f, name, color: selectedColor, emoji: selectedIcon } : f,
); );
saveFolders(folders); saveFolders(folders);
} else { } else {
@@ -620,7 +600,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
id: crypto.randomUUID(), id: crypto.randomUUID(),
name, name,
color: selectedColor, color: selectedColor,
icon: selectedIcon, emoji: selectedIcon,
}; };
saveFolders([...getFolders(), folder]); saveFolders([...getFolders(), folder]);
} }
@@ -646,20 +626,19 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
requestAnimationFrame(() => input.focus()); requestAnimationFrame(() => input.focus());
}; };
const showIconPicker = (container: Element, onSelect: (name: FolderIconName) => void) => { const showIconPicker = (container: Element, onSelect: (iconSvg: string) => void) => {
const existing = container.querySelector(".bsplus-icon-picker"); const existing = container.querySelector(".bsplus-icon-picker");
if (existing) existing.remove(); if (existing) existing.remove();
const picker = document.createElement("div"); const picker = document.createElement("div");
picker.className = "bsplus-icon-picker"; picker.className = "bsplus-icon-picker";
for (const name of FOLDER_ICON_NAMES) { for (const icon of FOLDER_HEROICONS) {
const btn = document.createElement("button"); const btn = document.createElement("button");
btn.className = "bsplus-icon-opt"; btn.className = "bsplus-icon-opt";
btn.setAttribute("aria-label", name); btn.innerHTML = icon;
btn.innerHTML = folderIconSvg(name);
btn.addEventListener("click", (e) => { btn.addEventListener("click", (e) => {
e.stopPropagation(); e.stopPropagation();
onSelect(name); onSelect(icon);
picker.remove(); picker.remove();
}); });
picker.appendChild(btn); picker.appendChild(btn);
@@ -731,7 +710,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
const iconSpan = document.createElement("span"); const iconSpan = document.createElement("span");
iconSpan.className = "bsplus-folder-icon"; iconSpan.className = "bsplus-folder-icon";
setFolderIcon(iconSpan, folder.icon); setSvgIconContent(iconSpan, folder.emoji || FOLDER_HEROICONS[0]);
const name = document.createElement("span"); const name = document.createElement("span");
name.textContent = folder.name; name.textContent = folder.name;
@@ -836,7 +815,7 @@ const messageFoldersPlugin: Pick<Plugin<MessageFoldersSettings, MessageFoldersSt
dot.style.background = folder.color; dot.style.background = folder.color;
const iconSpan = document.createElement("span"); const iconSpan = document.createElement("span");
iconSpan.className = "bsplus-folder-icon"; iconSpan.className = "bsplus-folder-icon";
setFolderIcon(iconSpan, folder.icon); setSvgIconContent(iconSpan, folder.emoji || FOLDER_HEROICONS[0]);
const name = document.createElement("span"); const name = document.createElement("span");
name.textContent = folder.name; name.textContent = folder.name;
item.appendChild(dot); item.appendChild(dot);
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { Check } from "lucide-static";
import type { PluginAPI, PluginSettings } from "../../core/types"; import type { PluginAPI, PluginSettings } from "../../core/types";
import ReactFiber from "@/seqta/utils/ReactFiber"; import ReactFiber from "@/seqta/utils/ReactFiber";
import { delay } from "@/seqta/utils/delay"; import { delay } from "@/seqta/utils/delay";
@@ -81,7 +79,7 @@ export function applyBackupBadges(archive: ArchiveMap) {
const badge = document.createElement("span"); const badge = document.createElement("span");
badge.className = BACKUP_BADGE_CLASS; badge.className = BACKUP_BADGE_CLASS;
badge.title = "Saved locally"; badge.title = "Saved locally";
badge.innerHTML = icon(Check, { size: "1em" }); badge.textContent = "✓";
itemEl.appendChild(badge); itemEl.appendChild(badge);
} }
} else { } else {
@@ -1,7 +1,4 @@
<script lang="ts"> <script lang="ts">
import UploadIcon from "@lucide/svelte/icons/upload";
import UserIcon from "@lucide/svelte/icons/user";
import XIcon from "@lucide/svelte/icons/x";
import { onMount } from "svelte"; import { onMount } from "svelte";
import browser from "@/lib/browser"; import browser from "@/lib/browser";
import { cloudAuth } from "@/seqta/utils/cloudAuth"; import { cloudAuth } from "@/seqta/utils/cloudAuth";
@@ -70,7 +67,7 @@
aria-label="Remove profile picture" aria-label="Remove profile picture"
onclick={() => setLocalPicture(null)} onclick={() => setLocalPicture(null)}
> >
<XIcon size={16} /> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" /></svg>
</button> </button>
<div <div
class="flex overflow-hidden justify-center items-center rounded-full size-10 bg-zinc-200 dark:bg-zinc-700 text-zinc-400" class="flex overflow-hidden justify-center items-center rounded-full size-10 bg-zinc-200 dark:bg-zinc-700 text-zinc-400"
@@ -78,7 +75,7 @@
{#if src} {#if src}
<img {src} alt="Your avatar" class="object-cover size-full" /> <img {src} alt="Your avatar" class="object-cover size-full" />
{:else} {:else}
<UserIcon size={20} /> <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z" /></svg>
{/if} {/if}
</div> </div>
<button <button
@@ -92,7 +89,7 @@
void save(event.dataTransfer?.files[0]); void save(event.dataTransfer?.files[0]);
}} }}
> >
<UploadIcon size={16} /> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/></svg>
Upload Upload
</button> </button>
<input <input
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import CalendarIcon from "@lucide/svelte/icons/calendar";
import { onMount } from "svelte"; import { onMount } from "svelte";
import type { Snippet } from "svelte"; import type { Snippet } from "svelte";
import { fade, fly } from "svelte/transition"; import { fade, fly } from "svelte/transition";
@@ -77,9 +76,7 @@
const isBusy = $derived(busy !== null); const isBusy = $derived(busy !== null);
const anyConnected = $derived(googleStatus.connected || outlookStatus.connected); const anyConnected = $derived(googleStatus.connected || outlookStatus.connected);
const modalOpen = $derived(showDisconnect || showDeleteEvents); const modalOpen = $derived(showDisconnect || showDeleteEvents);
const modalBusy = $derived( const modalBusy = $derived(showDisconnect ? busy?.phase === "disconnect" : busy?.phase === "delete");
showDisconnect ? busy?.phase === "disconnect" : busy?.phase === "delete",
);
const providerLabel = $derived(calendarProviderLabel(modalProvider ?? "google")); const providerLabel = $derived(calendarProviderLabel(modalProvider ?? "google"));
const showTriggerProgress = $derived( const showTriggerProgress = $derived(
isBusy && isBusy &&
@@ -381,7 +378,11 @@
busy = { provider, phase: "disconnect" }; busy = { provider, phase: "disconnect" };
try { try {
const ok = await disconnectProvider(provider, label, `Disconnected from ${label} Calendar.`); const ok = await disconnectProvider(
provider,
label,
`Disconnected from ${label} Calendar.`,
);
if (ok) showDisconnect = false; if (ok) showDisconnect = false;
} catch (err) { } catch (err) {
showToastMessage(err instanceof Error ? err.message : "Disconnect failed.", true); showToastMessage(err instanceof Error ? err.message : "Disconnect failed.", true);
@@ -583,7 +584,7 @@
> >
<span class="bsplus-cal-trigger-fill" aria-hidden="true"></span> <span class="bsplus-cal-trigger-fill" aria-hidden="true"></span>
<span class="bsplus-cal-trigger-content"> <span class="bsplus-cal-trigger-content">
<CalendarIcon size="1em" class="bsplus-cal-trigger-icon" /> <span class="bsplus-cal-trigger-icon iconFamily" aria-hidden="true">&#xe9cd;</span>
<span class="bsplus-cal-trigger-text">{triggerStatusText}</span> <span class="bsplus-cal-trigger-text">{triggerStatusText}</span>
</span> </span>
</button> </button>
@@ -599,9 +600,7 @@
> >
<div class="bsplus-cal-menu-header"> <div class="bsplus-cal-menu-header">
<span class="bsplus-cal-menu-title">Calendar sync</span> <span class="bsplus-cal-menu-title">Calendar sync</span>
<span class="bsplus-cal-menu-sub" <span class="bsplus-cal-menu-sub">Sync classes and optional assessment due dates to Google or Outlook</span>
>Sync classes and optional assessment due dates to Google or Outlook</span
>
</div> </div>
{@render providerPanel( {@render providerPanel(
@@ -656,9 +655,7 @@
<label class="bsplus-cal-setting bsplus-cal-setting--toggle"> <label class="bsplus-cal-setting bsplus-cal-setting--toggle">
<div class="bsplus-cal-setting-copy"> <div class="bsplus-cal-setting-copy">
<span class="bsplus-cal-setting-label">Sync assessment due dates</span> <span class="bsplus-cal-setting-label">Sync assessment due dates</span>
<span class="bsplus-cal-setting-desc" <span class="bsplus-cal-setting-desc">Uses the same weeks window. Update calendar once after enabling.</span>
>Uses the same weeks window. Update calendar once after enabling.</span
>
</div> </div>
<input <input
type="checkbox" type="checkbox"
@@ -699,8 +696,8 @@
Disconnect {providerLabel} Calendar? Disconnect {providerLabel} Calendar?
</h2> </h2>
<p class="bsplus-cal-modal-body"> <p class="bsplus-cal-modal-body">
Disconnecting normally removes synced classes from {providerLabel} Calendar and signs you Disconnecting normally removes synced classes from {providerLabel} Calendar and signs you out.
out. Keep this tab open while that runs. You can also disconnect without deleting your events. Keep this tab open while that runs. You can also disconnect without deleting your events.
</p> </p>
<div class="bsplus-cal-modal-actions bsplus-cal-modal-actions--disconnect"> <div class="bsplus-cal-modal-actions bsplus-cal-modal-actions--disconnect">
<button <button
@@ -729,7 +726,9 @@
</button> </button>
</div> </div>
{:else} {:else}
<h2 id="bsplus-cal-modal-title" class="bsplus-cal-modal-title">Delete synced classes?</h2> <h2 id="bsplus-cal-modal-title" class="bsplus-cal-modal-title">
Delete synced classes?
</h2>
<p class="bsplus-cal-modal-body"> <p class="bsplus-cal-modal-body">
Removes every BetterSEQTA+ timetable event from your {providerLabel} Calendar for this school. Removes every BetterSEQTA+ timetable event from your {providerLabel} Calendar for this school.
Your account stays connected — use Update calendar to sync again. Your account stays connected — use Update calendar to sync again.
@@ -773,8 +772,8 @@
Do not close this tab Do not close this tab
</h2> </h2>
<p id="bsplus-cal-disconnect-desc" class="bsplus-cal-disconnect-body"> <p id="bsplus-cal-disconnect-desc" class="bsplus-cal-disconnect-body">
Removing synced classes and disconnecting {providerLabel} Calendar. Closing SEQTA now may leave Removing synced classes and disconnecting {providerLabel} Calendar. Closing SEQTA now may
events behind or interrupt sign-out. leave events behind or interrupt sign-out.
</p> </p>
<div <div
class="bsplus-cal-disconnect-progress" class="bsplus-cal-disconnect-progress"
@@ -784,7 +783,9 @@
aria-valuenow={overlayProgressPercent} aria-valuenow={overlayProgressPercent}
aria-label={overlayStatusText} aria-label={overlayStatusText}
> >
<span class="bsplus-cal-disconnect-progress-fill" style:width="{overlayProgressPercent}%" <span
class="bsplus-cal-disconnect-progress-fill"
style:width="{overlayProgressPercent}%"
></span> ></span>
</div> </div>
<p class="bsplus-cal-disconnect-status">{overlayStatusText}</p> <p class="bsplus-cal-disconnect-status">{overlayStatusText}</p>
@@ -825,7 +826,7 @@
/> />
<path <path
d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"
fill="#EA4335" fill="#EB4335"
/> />
</svg> </svg>
{/snippet} {/snippet}
@@ -894,7 +895,8 @@
gap: 6px; gap: 6px;
} }
.bsplus-cal-trigger-content :global(.bsplus-cal-trigger-icon) { .bsplus-cal-trigger-icon {
font-family: "IconFamily" !important;
font-size: 16px; font-size: 16px;
line-height: 1; line-height: 1;
opacity: 0.9; opacity: 0.9;
@@ -942,8 +944,7 @@
margin: 8px 0 10px; margin: 8px 0 10px;
padding: 10px; padding: 10px;
border-radius: 10px; border-radius: 10px;
border: 1px solid border: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
background: color-mix(in srgb, var(--bsplus-cal-surface, #fff) 92%, transparent); background: color-mix(in srgb, var(--bsplus-cal-surface, #fff) 92%, transparent);
display: grid; display: grid;
gap: 8px; gap: 8px;
@@ -984,8 +985,7 @@
flex: 0 0 auto; flex: 0 0 auto;
padding: 6px 8px; padding: 6px 8px;
border-radius: 10px; border-radius: 10px;
border: 1px solid border: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 18%, transparent));
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 18%, transparent));
background: var(--bsplus-cal-surface, #fff); background: var(--bsplus-cal-surface, #fff);
color: var(--bsplus-cal-text, var(--text-primary, #111)); color: var(--bsplus-cal-text, var(--text-primary, #111));
font-size: 12px; font-size: 12px;
@@ -1007,8 +1007,7 @@
border-radius: 14px; border-radius: 14px;
background: var(--bsplus-cal-surface, #fff); background: var(--bsplus-cal-surface, #fff);
color: var(--bsplus-cal-text, #18181b); color: var(--bsplus-cal-text, #18181b);
border: 1px solid border: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 12%, transparent));
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
font-family: var(--bsplus-cal-font-family, var(--betterseqta-font-family, Rubik), sans-serif); font-family: var(--bsplus-cal-font-family, var(--betterseqta-font-family, Rubik), sans-serif);
} }
@@ -1019,8 +1018,7 @@
.bsplus-cal-menu-header { .bsplus-cal-menu-header {
padding: 6px 8px 10px; padding: 6px 8px 10px;
border-bottom: 1px solid border-bottom: 1px solid var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 10%, transparent));
var(--bsplus-cal-border, color-mix(in srgb, var(--bsplus-cal-text) 10%, transparent));
margin-bottom: 8px; margin-bottom: 8px;
} }
@@ -1040,10 +1038,7 @@
.bsplus-cal-provider { .bsplus-cal-provider {
padding: 8px; padding: 8px;
border-radius: 10px; border-radius: 10px;
background: var( background: var(--bsplus-cal-surface-muted, color-mix(in srgb, var(--bsplus-cal-text) 4%, transparent));
--bsplus-cal-surface-muted,
color-mix(in srgb, var(--bsplus-cal-text) 4%, transparent)
);
margin-bottom: 8px; margin-bottom: 8px;
} }
@@ -1117,10 +1112,7 @@
} }
.bsplus-cal-action--ghost { .bsplus-cal-action--ghost {
background: var( background: var(--bsplus-cal-surface-muted, color-mix(in srgb, var(--bsplus-cal-text) 8%, transparent));
--bsplus-cal-surface-muted,
color-mix(in srgb, var(--bsplus-cal-text) 8%, transparent)
);
color: var(--bsplus-cal-text, #18181b); color: var(--bsplus-cal-text, #18181b);
} }
+6 -11
View File
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { Eye, ZoomIn, ZoomOut } from "lucide-static";
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { settingsState } from "@/seqta/utils/listeners/settingsState";
import type { Plugin } from "../../core/types"; import type { Plugin } from "../../core/types";
import { attachTimetableColorisRecovery } from "@/seqta/utils/patchSeqtaMenuUpdateColours"; import { attachTimetableColorisRecovery } from "@/seqta/utils/patchSeqtaMenuUpdateColours";
@@ -101,15 +99,13 @@ function handleTimetableZoom(): void {
const zoomIn = document.createElement("button"); const zoomIn = document.createElement("button");
zoomIn.type = "button"; zoomIn.type = "button";
zoomIn.className = "timetable-zoom bsplus-timetable-control"; zoomIn.className = "timetable-zoom iconFamily bsplus-timetable-control";
zoomIn.setAttribute("aria-label", "Zoom in"); zoomIn.innerHTML = "&#xed93;"; // Unicode for zoom in icon (custom iconfamily)
zoomIn.innerHTML = icon(ZoomIn, { size: 16 });
const zoomOut = document.createElement("button"); const zoomOut = document.createElement("button");
zoomOut.type = "button"; zoomOut.type = "button";
zoomOut.className = "timetable-zoom bsplus-timetable-control"; zoomOut.className = "timetable-zoom iconFamily bsplus-timetable-control";
zoomOut.setAttribute("aria-label", "Zoom out"); zoomOut.innerHTML = "&#xed94;"; // Unicode for zoom out icon (custom iconfamily)
zoomOut.innerHTML = icon(ZoomOut, { size: 16 });
zoomControls.appendChild(zoomOut); zoomControls.appendChild(zoomOut);
zoomControls.appendChild(zoomIn); zoomControls.appendChild(zoomIn);
@@ -148,9 +144,8 @@ function handleTimetableAssessmentHide(): void {
const hideOn = document.createElement("button"); const hideOn = document.createElement("button");
hideOn.type = "button"; hideOn.type = "button";
hideOn.className = "timetable-hide bsplus-timetable-control"; hideOn.className = "timetable-hide iconFamily bsplus-timetable-control";
hideOn.setAttribute("aria-label", "Highlight assessments"); hideOn.innerHTML = "&#xeab3;";
hideOn.innerHTML = icon(Eye, { size: 16 });
hideControls.appendChild(hideOn); hideControls.appendChild(hideOn);
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import UsersIcon from "@lucide/svelte/icons/users";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { settingsState } from "@/seqta/utils/listeners/settingsState";
import { syncCalendarSyncTheme } from "@/plugins/built-in/timetable/calendarSyncUi"; import { syncCalendarSyncTheme } from "@/plugins/built-in/timetable/calendarSyncUi";
@@ -72,7 +71,7 @@
onclick={() => void handleClick()} onclick={() => void handleClick()}
> >
<span class="bsplus-cal-trigger-content"> <span class="bsplus-cal-trigger-content">
<UsersIcon size="1em" class="bsplus-cal-trigger-icon" /> <span class="bsplus-cal-trigger-icon iconFamily" aria-hidden="true">&#xed66;</span>
<span class="bsplus-cal-trigger-text"> <span class="bsplus-cal-trigger-text">
{busy ? "Syncing…" : error ? "Sync failed" : "Sync with Friends"} {busy ? "Syncing…" : error ? "Sync failed" : "Sync with Friends"}
</span> </span>
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import CircleCheckIcon from "@lucide/svelte/icons/circle-check";
import { onMount } from "svelte"; import { onMount } from "svelte";
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte"; import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
import { cloudAuth, type CloudUser } from "@/seqta/utils/cloudAuth"; import { cloudAuth, type CloudUser } from "@/seqta/utils/cloudAuth";
@@ -50,9 +49,7 @@
return null; return null;
} }
const canSubmit = $derived( const canSubmit = $derived(agreeShare && agreeJoin && cloudLoggedIn && !busy && $accountsAvailability.available);
agreeShare && agreeJoin && cloudLoggedIn && !busy && $accountsAvailability.available,
);
const checksDisabled = $derived(busy || !cloudLoggedIn); const checksDisabled = $derived(busy || !cloudLoggedIn);
async function signInWithCloud() { async function signInWithCloud() {
@@ -107,7 +104,7 @@
<span class="bsplus-tc-cloud-user-sub">{cloudSubtitle(cloudUser)}</span> <span class="bsplus-tc-cloud-user-sub">{cloudSubtitle(cloudUser)}</span>
{/if} {/if}
</div> </div>
<CircleCheckIcon size="1em" class="bsplus-tc-cloud-check" /> <span class="bsplus-tc-cloud-check iconFamily" aria-hidden="true">&#xe9db;</span>
</div> </div>
{:else} {:else}
<p class="bsplus-tc-cloud-lead"> <p class="bsplus-tc-cloud-lead">
+2 -3
View File
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { Pencil } from "lucide-static";
import type { PluginAPI } from "../../core/types"; import type { PluginAPI } from "../../core/types";
import { waitForElm } from "@/seqta/utils/waitForElm"; import { waitForElm } from "@/seqta/utils/waitForElm";
@@ -28,7 +26,8 @@ function getRoomAndTeacherElements(entry: HTMLElement): {
return { roomEl, teacherEl }; return { roomEl, teacherEl };
} }
const EDIT_ICON_SVG = icon(Pencil, { size: 20 }); const EDIT_ICON_SVG =
'<svg width="20" height="20" viewBox="0 0 24 24"><g style="fill: currentcolor;"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/></g></svg>';
function showEditModal( function showEditModal(
item: TimetableEntryData, item: TimetableEntryData,
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<circle cx="256" cy="256" r="256" fill="#151415"/>
<circle cx="248" cy="250" r="117.75" fill="none" stroke="#fff" stroke-width="38.5"/>
<rect x="248" y="348.5" width="165" height="38.5" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 276 B

+13
View File
@@ -0,0 +1,13 @@
{
"welcome": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M7.03 4.95L3.5 8.5C.17 11.81 .17 17.19 3.5 20.5S12.19 23.83 15.5 20.5L21.5 14.5C22.5 13.53 22.5 11.94 21.5 10.96C21.4 10.84 21.27 10.73 21.13 10.64L21.5 10.25C22.5 9.28 22.5 7.69 21.5 6.71C21.36 6.55 21.17 6.41 21 6.3C21.38 5.38 21.21 4.28 20.46 3.53C19.59 2.66 18.24 2.57 17.26 3.25C17.16 3.1 17.05 2.96 16.92 2.83C15.95 1.86 14.36 1.86 13.38 2.83L10.87 5.34C10.78 5.2 10.67 5.07 10.55 4.95C9.58 4 8 4 7.03 4.95M8.44 6.37C8.64 6.17 8.95 6.17 9.15 6.37S9.35 6.88 9.15 7.08L5.97 10.26C7.14 11.43 7.14 13.33 5.97 14.5L7.38 15.91C8.83 14.46 9.2 12.34 8.5 10.55L14.8 4.25C15 4.05 15.31 4.05 15.5 4.25S15.71 4.76 15.5 4.96L10.91 9.56L12.32 10.97L18.33 4.96C18.53 4.76 18.84 4.76 19.04 4.96C19.24 5.16 19.24 5.47 19.04 5.67L13.03 11.68L14.44 13.09L19.39 8.14C19.59 7.94 19.9 7.94 20.1 8.14C20.3 8.34 20.3 8.65 20.1 8.85L14.44 14.5L15.85 15.92L19.39 12.38C19.59 12.18 19.9 12.18 20.1 12.38C20.3 12.58 20.3 12.89 20.1 13.09L14.1 19.1C11.56 21.64 7.45 21.64 4.91 19.1S2.37 12.45 4.91 9.91L8.44 6.37M23 17C23 20.31 20.31 23 17 23V21.5C19.5 21.5 21.5 19.5 21.5 17H23M1 7C1 3.69 3.69 1 7 1V2.5C4.5 2.5 2.5 4.5 2.5 7H1Z\" />\n </svg>",
"assessments": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z\" />\n</svg>",
"courses": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z\" />\n</svg>",
"dashboard": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z\" />\n</svg>",
"messages": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M8,14H6V12H8V14M8,11H6V9H8V11M8,8H6V6H8V8M15,14H10V12H15V14M18,11H10V9H18V11M18,8H10V6H18V8Z\" />\n</svg>",
"notices": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M12,15H10V13H12V15M18,15H14V13H18V15M8,11H6V9H8V11M18,11H10V9H18V11M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4Z\" />\n</svg>",
"portals": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M15,4A8,8 0 0,1 23,12A8,8 0 0,1 15,20A8,8 0 0,1 7,12A8,8 0 0,1 15,4M15,18A6,6 0 0,0 21,12A6,6 0 0,0 15,6A6,6 0 0,0 9,12A6,6 0 0,0 15,18M3,12C3,14.61 4.67,16.83 7,17.65V19.74C3.55,18.85 1,15.73 1,12C1,8.27 3.55,5.15 7,4.26V6.35C4.67,7.17 3,9.39 3,12Z\" />\n</svg>",
"reports": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M18 2H12V9L9.5 7.5L7 9V2H6A2 2 0 0 0 4 4V20A2 2 0 0 0 6 22H18A2 2 0 0 0 20 20V4A2 2 0 0 0 18 2M14 12A2 2 0 1 1 12 14A2 2 0 0 1 14 12M18 20H10V19C10 17.67 12.67 17 14 17S18 17.67 18 19Z\" />\n</svg>",
"settings": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z\" />\n</svg>",
"timetable": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" d=\"M9,10V12H7V10H9M13,10V12H11V10H13M17,10V12H15V10H17M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5A2,2 0 0,1 5,3H6V1H8V3H16V1H18V3H19M19,19V8H5V19H19M9,14V16H7V14H9M13,14V16H11V14H13M17,14V16H15V14H17Z\" />\n</svg>",
"analytics": "<svg style=\"width:24px;height:24px\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n <path fill=\"currentColor\" d=\"M4,2H2V28a2,2,0,0,0,2,2H30V28H4Z\" />\n <path fill=\"currentColor\" d=\"M30,9H23v2h3.59L19,18.59l-4.29-4.3a1,1,0,0,0-1.42,0L6,21.59,7.41,23,14,16.41l4.29,4.3a1,1,0,0,0,1.42,0L28,12.41V16h2Z\" />\n</svg>"
}
+5
View File
@@ -0,0 +1,5 @@
export default /* html */ `
<svg style="width:24px;height:24px;border-radius:0;" viewBox="0 0 24 24">
<path fill="currentColor" d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z"></path>
</svg>
`;
+5
View File
@@ -0,0 +1,5 @@
export default /* html */ `
<svg style="width:24px;height:24px;border-radius:0;" viewBox="0 0 24 24">
<path fill="currentColor" d="M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z"></path>
</svg>
`;
+16 -7
View File
@@ -1,5 +1,5 @@
import { icon } from "@/lib/icon"; import { LUCIDE_MOON_ICON_SVG } from "@/lib/icons/lucideMoon";
import { LogOut, Moon, Sun, Wrench } from "lucide-static"; import { LUCIDE_SUN_ICON_SVG } from "@/lib/icons/lucideSun";
import { waitForEngageMenuList } from "@/seqta/utils/waitForEngageMenuList"; import { waitForEngageMenuList } from "@/seqta/utils/waitForEngageMenuList";
import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings"; import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage"; import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
@@ -39,6 +39,15 @@ import { getUserInfo } from "@/seqta/utils/userInfo";
const USER_AVATAR_SVG = `<svg class="userInfosvg" viewBox="0 0 24 24"><path fill="var(--text-primary)" d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"></path></svg>`; const USER_AVATAR_SVG = `<svg class="userInfosvg" viewBox="0 0 24 24"><path fill="var(--text-primary)" d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"></path></svg>`;
const LOGOUT_ICON_SVG = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>`;
const SETTINGS_WRENCH_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M23.182,6.923c-.29,0-3.662,2.122-4.142,2.4l-2.8-1.555V4.511l4.257-2.456a.518.518,0,0,0,.233-.408.479.479,0,0,0-.233-.407,6.511,6.511,0,1,0-3.327,12.107,6.582,6.582,0,0,0,6.148-4.374,5.228,5.228,0,0,0,.333-1.542A.461.461,0,0,0,23.182,6.923Z"></path><path fill="currentColor" d="M9.73,10.418,7.376,12.883c-.01.01-.021.016-.03.025L1.158,19.1a2.682,2.682,0,1,0,3.793,3.793l4.583-4.582,0,0,4.1-4.005-.037-.037A9.094,9.094,0,0,1,9.73,10.418ZM3.053,21.888A.894.894,0,1,1,3.946,21,.893.893,0,0,1,3.053,21.888Z"></path></svg>`;
function themeToggleIconMarkup(): string {
const path = settingsState.DarkMode ? LUCIDE_SUN_ICON_SVG : LUCIDE_MOON_ICON_SVG;
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">${path}</svg>`;
}
let lightDarkToggleStreak = 0; let lightDarkToggleStreak = 0;
let sidebarAccessibilityObserver: MutationObserver | null = null; let sidebarAccessibilityObserver: MutationObserver | null = null;
let sidebarTabOrderAnimationFrame: number | null = null; let sidebarTabOrderAnimationFrame: number | null = null;
@@ -158,7 +167,7 @@ function updateUserInfo(info: Awaited<ReturnType<typeof getUserInfo>>) {
${USER_AVATAR_SVG} ${USER_AVATAR_SVG}
<div class="bsplus-tooltip-bubble"> <div class="bsplus-tooltip-bubble">
<button class="bsplus-logout" type="button" aria-label="Log out"> <button class="bsplus-logout" type="button" aria-label="Log out">
${icon(LogOut, { size: 20 })} ${LOGOUT_ICON_SVG}
</button> </button>
</div> </div>
</div> </div>
@@ -284,7 +293,7 @@ async function createSettingsButton(parent?: Element) {
target.append( target.append(
stringToHTML(/* html */ ` stringToHTML(/* html */ `
<button class="addedButton" id="AddedSettings" type="button" aria-label="BetterSEQTA+ settings"> <button class="addedButton" id="AddedSettings" type="button" aria-label="BetterSEQTA+ settings">
${icon(Wrench)} ${SETTINGS_WRENCH_SVG}
</button> </button>
`).firstChild!, `).firstChild!,
); );
@@ -370,7 +379,7 @@ async function addEngageUserInfo() {
${USER_AVATAR_SVG} ${USER_AVATAR_SVG}
<div class="bsplus-tooltip-bubble"> <div class="bsplus-tooltip-bubble">
<button class="bsplus-logout" type="button" aria-label="Log out"> <button class="bsplus-logout" type="button" aria-label="Log out">
${icon(LogOut, { size: 20 })} ${LOGOUT_ICON_SVG}
</button> </button>
</div> </div>
</div> </div>
@@ -457,7 +466,7 @@ async function addDarkLightToggle(parent?: Element) {
toggleTarget.append( toggleTarget.append(
stringToHTML(/* html */ ` stringToHTML(/* html */ `
<button class="addedButton DarkLightButton" id="LightDarkModeButton" type="button" aria-label="${getLightDarkModeString()}"> <button class="addedButton DarkLightButton" id="LightDarkModeButton" type="button" aria-label="${getLightDarkModeString()}">
${icon(settingsState.DarkMode ? Sun : Moon)} ${themeToggleIconMarkup()}
</button> </button>
`).firstChild!, `).firstChild!,
); );
@@ -484,7 +493,7 @@ async function addDarkLightToggle(parent?: Element) {
settingsState.DarkMode = !settingsState.DarkMode; settingsState.DarkMode = !settingsState.DarkMode;
updateAllColors(); updateAllColors();
lightDarkModeButtonElement.innerHTML = icon(settingsState.DarkMode ? Sun : Moon); lightDarkModeButtonElement.innerHTML = themeToggleIconMarkup();
lightDarkModeButtonElement.setAttribute("aria-label", getLightDarkModeString()); lightDarkModeButtonElement.setAttribute("aria-label", getLightDarkModeString());
}); });
} }
+15 -4
View File
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import SearchIcon from "@lucide/svelte/icons/search";
import { titleBarState } from "./titleBarState.svelte"; import { titleBarState } from "./titleBarState.svelte";
</script> </script>
@@ -10,14 +9,26 @@
<div class="search-trigger-anchor"> <div class="search-trigger-anchor">
<div class="search-trigger"> <div class="search-trigger">
<span> <span>
<SearchIcon size={16} /> <svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</span> </span>
<p>Quick search...</p> <p>Quick search...</p>
<span <span
class="search-trigger-hotkey" class="search-trigger-hotkey"
style="margin-left: auto; display: flex; align-items: center; color: rgb(119, 119, 119); font-size: 12px;" style="margin-left: auto; display: flex; align-items: center; color: rgb(119, 119, 119); font-size: 12px;"
>{titleBarState.searchHotkeyLabel}</span >{titleBarState.searchHotkeyLabel}</span>
>
</div> </div>
<div class="search-progress-bar-wrapper"> <div class="search-progress-bar-wrapper">
<div class="search-progress-track"> <div class="search-progress-track">
+3 -3
View File
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { Wrench } from "lucide-static";
import stringToHTML from "@/seqta/utils/stringToHTML"; import stringToHTML from "@/seqta/utils/stringToHTML";
import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings"; import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings";
import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton"; import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
@@ -7,6 +5,8 @@ import { waitForElm } from "@/seqta/utils/waitForElm";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage"; import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import { isPerformanceMode } from "@/seqta/utils/performanceMode"; import { isPerformanceMode } from "@/seqta/utils/performanceMode";
const SETTINGS_WRENCH_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M23.182,6.923c-.29,0-3.662,2.122-4.142,2.4l-2.8-1.555V4.511l4.257-2.456a.518.518,0,0,0,.233-.408.479.479,0,0,0-.233-.407,6.511,6.511,0,1,0-3.327,12.107,6.582,6.582,0,0,0,6.148-4.374,5.228,5.228,0,0,0,.333-1.542A.461.461,0,0,0,23.182,6.923Z"></path><path fill="currentColor" d="M9.73,10.418,7.376,12.883c-.01.01-.021.016-.03.025L1.158,19.1a2.682,2.682,0,1,0,3.793,3.793l4.583-4.582,0,0,4.1-4.005-.037-.037A9.094,9.094,0,0,1,9.73,10.418ZM3.053,21.888A.894.894,0,1,1,3.946,21,.893.893,0,0,1,3.053,21.888Z"></path></svg>`;
export async function ensureSettingsAccess(): Promise<void> { export async function ensureSettingsAccess(): Promise<void> {
addExtensionSettings(); addExtensionSettings();
if (document.getElementById("AddedSettings")) { if (document.getElementById("AddedSettings")) {
@@ -48,7 +48,7 @@ export async function ensureSettingsAccess(): Promise<void> {
parent.append( parent.append(
stringToHTML(/* html */ ` stringToHTML(/* html */ `
<button class="addedButton" id="AddedSettings" type="button" aria-label="BetterSEQTA+ settings"> <button class="addedButton" id="AddedSettings" type="button" aria-label="BetterSEQTA+ settings">
${icon(Wrench)} ${SETTINGS_WRENCH_SVG}
</button> </button>
`).firstChild!, `).firstChild!,
); );
+12 -10
View File
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { Flame, Sparkles, Star, SwatchBook, Trophy } from "lucide-static";
/** Keep in sync with betterseqta-accounts `utils/badges.ts` / `utils/badgeVisuals.ts`. */ /** Keep in sync with betterseqta-accounts `utils/badges.ts` / `utils/badgeVisuals.ts`. */
export const BADGE_TIERS = [ export const BADGE_TIERS = [
@@ -165,16 +163,20 @@ export function badgeVisualForKey(key: string, labelFallback = key): BadgeVisual
return { key, label: labelFallback, ...UNKNOWN_ACHIEVEMENT_VISUAL }; return { key, label: labelFallback, ...UNKNOWN_ACHIEVEMENT_VISUAL };
} }
const BADGE_ICONS: Record<string, string> = { const ICON_PATHS: Record<string, string> = {
sparkles: Sparkles, sparkles:
star: Star, "M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z",
trophy: Trophy, star: "M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005z",
fire: Flame, trophy:
swatch: SwatchBook, "M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-3.375c0-.621-.503-1.125-1.125-1.125h-.871M7.5 18.75v-3.375c0-.621.504-1.125 1.125-1.125h.872m5.007 0H9.497m5.007 0a7.454 7.454 0 01-.982-3.172M9.497 14.25a7.454 7.454 0 00.981-3.172M5.25 4.236c-.982.143-1.954.317-2.916.52A6.003 6.003 0 007.73 9.728M5.25 4.236V4.5c0 2.108.966 3.99 2.48 5.228M5.25 4.236V2.721C7.456 2.41 9.71 2.25 12 2.25c2.291 0 4.545.16 6.75.47v1.516M7.73 9.728a6.726 6.726 0 002.748 1.35m8.272-6.842V4.5c0 2.108-.966 3.99-2.48 5.228m2.48-5.492a46.32 46.32 0 012.916.52 6.003 6.003 0 01-5.395 4.972m0 0a6.726 6.726 0 01-2.749 1.35m0 0a6.726 6.726 0 01-3.128 0m3.128 0a6.726 6.726 0 01-3.128 0",
fire: "M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48zM12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z",
swatch:
"M4.098 19.902a3.75 3.75 0 005.304 0l6.401-6.402M6.75 21A3.75 3.75 0 013 17.25V4.125C3 3.504 3.504 3 4.125 3h5.25c.621 0 1.125.504 1.125 1.125v4.072M6.75 21a3.75 3.75 0 003.75-3.75V8.197M6.75 21h13.125c.621 0 1.125-.504 1.125-1.125v-5.25c0-.621-.504-1.125-1.125-1.125h-4.072M10.5 8.197l2.88-2.88c.438-.439 1.15-.439 1.59 0l3.712 3.713c.44.44.44 1.152 0 1.59l-2.879 2.88M6.75 17.25h.008v.008H6.75v-.008z",
}; };
function badgeIconSvg(name: string, size = 15): string { function badgeIconSvg(icon: string, size = 15): string {
return icon(BADGE_ICONS[name] ?? Sparkles, { class: "bsplus-founder-badge__icon", size }); const path = ICON_PATHS[icon] ?? ICON_PATHS.sparkles;
return `<svg class="bsplus-founder-badge__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="${size}" height="${size}" aria-hidden="true"><path d="${path}"/></svg>`;
} }
function badgeBlobStyle(visual: Pick<BadgeVisual, "base" | "blobs">): string { function badgeBlobStyle(visual: Pick<BadgeVisual, "base" | "blobs">): string {
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { ChevronLeft, ChevronRight } from "lucide-static";
import LogoLight from "@/resources/icons/betterseqta-light-icon.png"; import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl"; import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
import { convertTo12HourFormat } from "@/seqta/utils/convertTo12HourFormat"; import { convertTo12HourFormat } from "@/seqta/utils/convertTo12HourFormat";
@@ -20,6 +18,9 @@ import {
import { resolveNoticeFilterTokens } from "@/seqta/utils/notices/noticeLabelFilters"; import { resolveNoticeFilterTokens } from "@/seqta/utils/notices/noticeLabelFilters";
import { fetchNoticesForDate } from "@/seqta/utils/notices/noticeHomeUi"; import { fetchNoticesForDate } from "@/seqta/utils/notices/noticeHomeUi";
const TIMETABLE_CHEVRON_BACK = `<svg width="24" height="24" viewBox="0 0 24 24" style="transform: scale(-1,1)" id="engage-home-timetable-back"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
const TIMETABLE_CHEVRON_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" id="engage-home-timetable-forward"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
export function updateEngageHomeMenuActive(isHome: boolean): void { export function updateEngageHomeMenuActive(isHome: boolean): void {
const home = document.getElementById("homebutton"); const home = document.getElementById("homebutton");
if (!home) return; if (!home) return;
@@ -290,8 +291,8 @@ export async function loadEngageHomePage(): Promise<void> {
<select id="engage-child-selector" class="engage-child-select" aria-label="Student"></select> <select id="engage-child-selector" class="engage-child-select" aria-label="Student"></select>
</div> </div>
<div class="timetable-arrows"> <div class="timetable-arrows">
${icon(ChevronLeft, { id: "engage-home-timetable-back" })} ${TIMETABLE_CHEVRON_BACK}
${icon(ChevronRight, { id: "engage-home-timetable-forward" })} ${TIMETABLE_CHEVRON_FORWARD}
</div> </div>
</div> </div>
<div class="day-container loading" id="engage-day-container"></div> <div class="day-container loading" id="engage-day-container"></div>
+13 -8
View File
@@ -1,5 +1,5 @@
import { icon } from "@/lib/icon"; import assessmentsicon from "@/seqta/icons/assessmentsIcon";
import { BookOpen, ChevronLeft, ChevronRight, ClipboardList } from "lucide-static"; import coursesicon from "@/seqta/icons/coursesIcon";
import { animate, stagger } from "motion"; import { animate, stagger } from "motion";
import LogoLight from "@/resources/icons/betterseqta-light-icon.png"; import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl"; import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
@@ -37,6 +37,11 @@ let homeTeardown: (() => void) | null = null;
let currentSelectedDate = new Date(); let currentSelectedDate = new Date();
let loadingTimeout: ReturnType<typeof setTimeout> | null = null; let loadingTimeout: ReturnType<typeof setTimeout> | null = null;
const TIMETABLE_CHEVRON_BACK = `<svg width="24" height="24" viewBox="0 0 24 24" style="transform: scale(-1,1)" id="home-timetable-back"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
const TIMETABLE_CHEVRON_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" id="home-timetable-forward"><path fill="currentColor" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /></svg>`;
const ASSESSMENTS_ICON_LG = `<svg style="width:28px;height:28px;border-radius:0;" viewBox="0 0 24 24"><path fill="currentColor" d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z" /></svg>`;
const ASSESSMENTS_ICON_WHITE = `<svg viewBox="0 0 24 24" style="width:35px;height:35px;fill:white;"><path d="M6 20H13V22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H18C19.11 2 20 2.9 20 4V12.54L18.5 11.72L18 12V4H13V12L10.5 9.75L8 12V4H6V20M24 17L18.5 14L13 17L18.5 20L24 17M15 19.09V21.09L18.5 23L22 21.09V19.09L18.5 21L15 19.09Z" /></svg>`;
function clearLessonInterval(): void { function clearLessonInterval(): void {
if (lessonInterval !== null) { if (lessonInterval !== null) {
clearInterval(lessonInterval); clearInterval(lessonInterval);
@@ -78,8 +83,8 @@ export async function loadHomePage() {
<div class="home-subtitle"> <div class="home-subtitle">
<h2 id="home-lesson-subtitle">Today's Lessons</h2> <h2 id="home-lesson-subtitle">Today's Lessons</h2>
<div class="timetable-arrows"> <div class="timetable-arrows">
${icon(ChevronLeft, { id: "home-timetable-back" })} ${TIMETABLE_CHEVRON_BACK}
${icon(ChevronRight, { id: "home-timetable-forward" })} ${TIMETABLE_CHEVRON_FORWARD}
</div> </div>
</div> </div>
<div class="day-container loading" id="day-container"> <div class="day-container loading" id="day-container">
@@ -467,8 +472,8 @@ function makeLessonDiv(lesson: HomeTimetableLesson, num: number) {
if (type == "class") { if (type == "class") {
if (programmeID !== 0) { if (programmeID !== 0) {
lessonString += ` lessonString += `
<a class="day-button clickable" style="right: 5px;" href="${buildAssessmentURL(programmeID, metaID)}" aria-label="Assessments">${icon(ClipboardList)}</a> <a class="day-button clickable" style="right: 5px;" href="${buildAssessmentURL(programmeID, metaID)}" aria-label="Assessments">${assessmentsicon}</a>
<a class="day-button clickable" style="right: 35px;" href="../#?page=/courses/${programmeID}:${metaID}" aria-label="Course">${icon(BookOpen)}</a> <a class="day-button clickable" style="right: 35px;" href="../#?page=/courses/${programmeID}:${metaID}" aria-label="Course">${coursesicon}</a>
`; `;
} }
@@ -482,7 +487,7 @@ function makeLessonDiv(lesson: HomeTimetableLesson, num: number) {
lessonString += ` lessonString += `
<div class="bsplus-tooltip assessmenttooltip" tabindex="0" aria-label="Assessments for this lesson"> <div class="bsplus-tooltip assessmenttooltip" tabindex="0" aria-label="Assessments for this lesson">
${icon(ClipboardList, { size: 28, style: "color: #ed3939" })} ${ASSESSMENTS_ICON_LG}
<div class="bsplus-tooltip-bubble">${assessmentString}</div> <div class="bsplus-tooltip-bubble">${assessmentString}</div>
</div> </div>
`; `;
@@ -678,7 +683,7 @@ function createAssessmentDateDiv(
const titlediv = document.createElement("div"); const titlediv = document.createElement("div");
titlediv.classList.add("upcoming-subject-title"); titlediv.classList.add("upcoming-subject-title");
titlediv.append( titlediv.append(
stringToHTML(icon(ClipboardList, { size: 35, style: "color: #fff" })).firstChild!, stringToHTML(ASSESSMENTS_ICON_WHITE).firstChild!,
); );
const detailsdiv = document.createElement("div"); const detailsdiv = document.createElement("div");
@@ -1,5 +1,3 @@
import { icon } from "@/lib/icon";
import { ChevronLeft, ChevronRight, Maximize2, Minimize2 } from "lucide-static";
import browser from "@/lib/browser"; import browser from "@/lib/browser";
import stringToHTML from "../stringToHTML"; import stringToHTML from "../stringToHTML";
import { settingsState } from "../listeners/settingsState"; import { settingsState } from "../listeners/settingsState";
@@ -192,8 +190,8 @@ function renderGallerySlidesHtml(slides: PopupGallerySlide[]): string {
const nav = const nav =
slides.length > 1 slides.length > 1
? ` ? `
<button type="button" class="themeOfTheMonthCardGalleryPrev" aria-label="Previous image">${icon(ChevronLeft, { size: "1em" })}</button> <button type="button" class="themeOfTheMonthCardGalleryPrev" aria-label="Previous image">‹</button>
<button type="button" class="themeOfTheMonthCardGalleryNext" aria-label="Next image">${icon(ChevronRight, { size: "1em" })}</button> <button type="button" class="themeOfTheMonthCardGalleryNext" aria-label="Next image">›</button>
<div class="themeOfTheMonthCardGalleryDots" role="tablist" aria-label="Theme previews"> <div class="themeOfTheMonthCardGalleryDots" role="tablist" aria-label="Theme previews">
${slides ${slides
.map( .map(
@@ -212,8 +210,8 @@ function renderGallerySlidesHtml(slides: PopupGallerySlide[]): string {
`; `;
} }
const POPOUT_EXPAND_SVG = /* svg */ icon(Maximize2, { size: 15 }); const POPOUT_EXPAND_SVG = /* svg */ `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>`;
const POPOUT_COLLAPSE_SVG = /* svg */ icon(Minimize2, { size: 15 }); const POPOUT_COLLAPSE_SVG = /* svg */ `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>`;
const TOTM_MARGIN_PX = 18; const TOTM_MARGIN_PX = 18;
const TOTM_EXPANDED_SHELL_MAX_PX = 560; const TOTM_EXPANDED_SHELL_MAX_PX = 560;
+7 -40
View File
@@ -1,45 +1,12 @@
import { icon } from "@/lib/icon"; import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
import {
AppWindow,
BookOpen,
Calendar,
ChartLine,
ClipboardList,
FileChartColumn,
FolderOpen,
GraduationCap,
Hand,
House,
LayoutDashboard,
Megaphone,
MessageSquare,
MessagesSquare,
Newspaper,
Settings,
Target,
} from "lucide-static";
const PAGE_ICONS: Record<string, string> = { const EXTRA_ICONS: Record<string, string> = {
analytics: ChartLine, home: `<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z" /></svg>`,
assessments: ClipboardList, news: `<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M5 7H10V13H5V7M19 17H5V15H19V17M19 13H12V11H19V13M19 9H12V7H19V9Z" /></svg>`,
courses: BookOpen,
dashboard: LayoutDashboard,
documents: FolderOpen,
forums: MessagesSquare,
goals: Target,
home: House,
messages: MessageSquare,
myed: GraduationCap,
news: Newspaper,
notices: Megaphone,
portals: AppWindow,
reports: FileChartColumn,
settings: Settings,
timetable: Calendar,
welcome: Hand,
}; };
const menuIcons = MenuitemSVGKey as Record<string, string>;
export function pageIcon(key: string): string | undefined { export function pageIcon(key: string): string | undefined {
const svg = PAGE_ICONS[key]; return menuIcons[key] ?? EXTRA_ICONS[key];
return svg && icon(svg);
} }
+4 -4
View File
@@ -1,4 +1,4 @@
import { pageIcon } from "@/seqta/utils/pageIcons"; import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder"; import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState"; import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
import { settingsState } from "@/seqta/utils/listeners/settingsState"; import { settingsState } from "@/seqta/utils/listeners/settingsState";
@@ -61,9 +61,9 @@ export function replaceMenuSVG(element: HTMLElement, svg: string) {
export function processMenuItemNode(node: HTMLElement) { export function processMenuItemNode(node: HTMLElement) {
if (!isTopLevelSidebarItem(node) || isMenuOptionsOpen()) return; if (!isTopLevelSidebarItem(node) || isMenuOptionsOpen()) return;
const svg = node.dataset.key ? pageIcon(node.dataset.key) : undefined; const key = node.dataset.key as keyof typeof MenuitemSVGKey | undefined;
if (svg) { if (key && MenuitemSVGKey[key]) {
replaceMenuSVG(node, svg); replaceMenuSVG(node, MenuitemSVGKey[key]);
} else { } else {
const label = getMenuLabel(node); const label = getMenuLabel(node);
if (label) wrapMenuLabelText(label); if (label) wrapMenuLabelText(label);