staffa 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -29
- package/dist/components/autocomplete.d.ts +9 -2
- package/dist/components/autocomplete.js +9 -2
- package/dist/components/box.d.ts +1 -0
- package/dist/components/box.js +1 -0
- package/dist/components/button.d.ts +1 -0
- package/dist/components/button.js +5 -5
- package/dist/components/buttonGroup.d.ts +5 -3
- package/dist/components/buttonGroup.js +5 -3
- package/dist/components/checkbox.d.ts +1 -0
- package/dist/components/checkbox.js +1 -0
- package/dist/components/dialog.d.ts +3 -3
- package/dist/components/dialog.js +3 -3
- package/dist/components/form.d.ts +3 -2
- package/dist/components/form.js +3 -2
- package/dist/components/main.d.ts +5 -1
- package/dist/components/main.js +5 -1
- package/dist/components/menu.d.ts +39 -5
- package/dist/components/menu.js +45 -5
- package/dist/components/tabs.d.ts +2 -2
- package/dist/components/tabs.js +2 -2
- package/dist/components/textarea.d.ts +3 -2
- package/dist/components/textarea.js +3 -2
- package/dist/components/textline.d.ts +1 -0
- package/dist/components/textline.js +1 -0
- package/dist/components/toast.d.ts +1 -2
- package/dist/components/toast.js +4 -2
- package/dist/components/tooltip.d.ts +4 -2
- package/dist/components/tooltip.js +4 -2
- package/dist/core.d.ts +10 -5
- package/dist/core.js +11 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/staffa.esm.js +1 -1
- package/package.json +1 -1
- package/src/components/autocomplete.ts +9 -2
- package/src/components/box.ts +1 -0
- package/src/components/button.ts +5 -5
- package/src/components/buttonGroup.ts +5 -3
- package/src/components/checkbox.ts +1 -0
- package/src/components/dialog.ts +3 -3
- package/src/components/form.ts +3 -2
- package/src/components/main.ts +5 -1
- package/src/components/menu.ts +50 -5
- package/src/components/tabs.ts +2 -2
- package/src/components/textarea.ts +3 -2
- package/src/components/textline.ts +1 -0
- package/src/components/toast.ts +3 -2
- package/src/components/tooltip.ts +4 -2
- package/src/core.ts +11 -9
- package/src/index.ts +1 -1
package/dist/components/toast.js
CHANGED
|
@@ -22,6 +22,9 @@ let toastCount = 0;
|
|
|
22
22
|
// Keyed by stable ID so A.onEach scopes are per-toast — removing one never re-renders others.
|
|
23
23
|
const toasts = A.proxy({});
|
|
24
24
|
mountPortal(() => {
|
|
25
|
+
// Only redraws when emptiness flips, keeping the DOM clean while no toasts show.
|
|
26
|
+
if (A.isEmpty(toasts))
|
|
27
|
+
return;
|
|
25
28
|
A("div.s-toasts aria-live=polite aria-atomic=false", () => {
|
|
26
29
|
A.onEach(toasts, (entry) => {
|
|
27
30
|
const { opts } = entry;
|
|
@@ -59,8 +62,7 @@ function dismiss(id) {
|
|
|
59
62
|
* S.toast({ message: "Saved!", type: "success" });
|
|
60
63
|
* S.toast({ title: "Error", message: "Upload failed.", type: "danger", duration: 0 });
|
|
61
64
|
* const off = S.toast({ message: "Uploading…", duration: 0, dismissible: false });
|
|
62
|
-
* //
|
|
63
|
-
* off();
|
|
65
|
+
* setTimeout(off, 3000); // Later..
|
|
64
66
|
* ```
|
|
65
67
|
*/
|
|
66
68
|
export function toast(opts) {
|
|
@@ -20,11 +20,13 @@ export interface TooltipOptions {
|
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```ts
|
|
23
|
-
*
|
|
23
|
+
* S.button(() => {
|
|
24
|
+
* A("#Save");
|
|
24
25
|
* S.addTooltip({ tip: "Saves your work to the cloud" });
|
|
25
26
|
* });
|
|
26
27
|
*
|
|
27
|
-
*
|
|
28
|
+
* S.button(() => {
|
|
29
|
+
* A(".danger#Delete");
|
|
28
30
|
* S.addTooltip({ tip: "Dangerous — cannot be undone", placement: "bottom" });
|
|
29
31
|
* });
|
|
30
32
|
* ```
|
|
@@ -102,11 +102,13 @@ mountPortal(() => {
|
|
|
102
102
|
*
|
|
103
103
|
* @example
|
|
104
104
|
* ```ts
|
|
105
|
-
*
|
|
105
|
+
* S.button(() => {
|
|
106
|
+
* A("#Save");
|
|
106
107
|
* S.addTooltip({ tip: "Saves your work to the cloud" });
|
|
107
108
|
* });
|
|
108
109
|
*
|
|
109
|
-
*
|
|
110
|
+
* S.button(() => {
|
|
111
|
+
* A(".danger#Delete");
|
|
110
112
|
* S.addTooltip({ tip: "Dangerous — cannot be undone", placement: "bottom" });
|
|
111
113
|
* });
|
|
112
114
|
* ```
|
package/dist/core.d.ts
CHANGED
|
@@ -57,10 +57,15 @@ export declare function uniqueId(prefix?: string): string;
|
|
|
57
57
|
*/
|
|
58
58
|
export declare function drawSlot<Args extends unknown[] = []>(slot: Slot<Args> | undefined, ...args: Args): void;
|
|
59
59
|
/**
|
|
60
|
-
* Mount a portal (tooltip, toast, menu, dialog, …)
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
60
|
+
* Mount a portal (tooltip, toast, menu, dialog, …) directly into `<body>`.
|
|
61
|
+
* Must be called at module top level, where Aberdeen's root scope (whose
|
|
62
|
+
* element is `document.body`) is current. Separate `A.mount`s sharing a parent
|
|
63
|
+
* can't tell their nodes apart, but sibling scopes within the root scope track
|
|
64
|
+
* their positions, so portals coexist without wrapper elements and add nothing
|
|
65
|
+
* to the DOM while they draw nothing.
|
|
66
|
+
*
|
|
67
|
+
* Scope creation is deferred a microtask so that an app drawing into `<body>`
|
|
68
|
+
* at module top level gets its content *before* the portals, keeping overlays
|
|
69
|
+
* at the end of the document.
|
|
65
70
|
*/
|
|
66
71
|
export declare function mountPortal(draw: () => void): void;
|
package/dist/core.js
CHANGED
|
@@ -18,15 +18,17 @@ export function drawSlot(slot, ...args) {
|
|
|
18
18
|
A("rich=", slot);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Mount a portal (tooltip, toast, menu, dialog, …)
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
21
|
+
* Mount a portal (tooltip, toast, menu, dialog, …) directly into `<body>`.
|
|
22
|
+
* Must be called at module top level, where Aberdeen's root scope (whose
|
|
23
|
+
* element is `document.body`) is current. Separate `A.mount`s sharing a parent
|
|
24
|
+
* can't tell their nodes apart, but sibling scopes within the root scope track
|
|
25
|
+
* their positions, so portals coexist without wrapper elements and add nothing
|
|
26
|
+
* to the DOM while they draw nothing.
|
|
27
|
+
*
|
|
28
|
+
* Scope creation is deferred a microtask so that an app drawing into `<body>`
|
|
29
|
+
* at module top level gets its content *before* the portals, keeping overlays
|
|
30
|
+
* at the end of the document.
|
|
26
31
|
*/
|
|
27
32
|
export function mountPortal(draw) {
|
|
28
|
-
|
|
29
|
-
container.style.display = "contents";
|
|
30
|
-
document.body.appendChild(container);
|
|
31
|
-
A.mount(container, draw);
|
|
33
|
+
queueMicrotask(() => A(draw));
|
|
32
34
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export { buttonGroup, type ButtonGroupOptions } from "./components/buttonGroup.j
|
|
|
38
38
|
export { checkbox, type CheckboxOptions } from "./components/checkbox.js";
|
|
39
39
|
export { form, type FormOptions } from "./components/form.js";
|
|
40
40
|
export { main, type MainOptions } from "./components/main.js";
|
|
41
|
-
export { menuButton, showFloatingMenu, type MenuOptions, type MenuEntry, type MenuItem, type MenuSeparator, type FloatingMenuOptions } from "./components/menu.js";
|
|
41
|
+
export { menuButton, showFloatingMenu, addContextMenu, type MenuOptions, type MenuEntry, type MenuItem, type MenuSeparator, type FloatingMenuOptions, type ContextMenuOptions } from "./components/menu.js";
|
|
42
42
|
export { dialog, alert, confirm, prompt, type DialogOptions } from "./components/dialog.js";
|
|
43
43
|
export { select, type SelectOptions, type SelectOptionInput } from "./components/select.js";
|
|
44
44
|
export { tabs, type Tab, type TabsOptions } from "./components/tabs.js";
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { buttonGroup } from "./components/buttonGroup.js";
|
|
|
41
41
|
export { checkbox } from "./components/checkbox.js";
|
|
42
42
|
export { form } from "./components/form.js";
|
|
43
43
|
export { main } from "./components/main.js";
|
|
44
|
-
export { menuButton, showFloatingMenu } from "./components/menu.js";
|
|
44
|
+
export { menuButton, showFloatingMenu, addContextMenu } from "./components/menu.js";
|
|
45
45
|
export { dialog, alert, confirm, prompt } from "./components/dialog.js";
|
|
46
46
|
export { select } from "./components/select.js";
|
|
47
47
|
export { tabs } from "./components/tabs.js";
|
package/dist/staffa.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import O from"aberdeen";var U="staffa:darkMode",ne=O.proxy({value:ce()});function ce(){try{let e=localStorage.getItem(U);if(e==="dark")return!0;if(e==="light")return!1}catch{}}function ue(e){ne.value=e;try{e===void 0?localStorage.removeItem(U):localStorage.setItem(U,e?"dark":"light")}catch{}}function oe(e=!1){let t=ne.value;return t===void 0&&!e?O.darkMode():t}O(()=>{oe()?O.insertGlobalCss({":root":"--s-primary:#8b7bff --s-secondary:#ef7fd0 --s-danger:#ff6b6b --s-success:#46d39a --s-warning:#fbbf24 --s-neutral: color-mix(in oklab, #3d4047, $s-tint 14%); --s-page: color-mix(in oklab, #0e0f12, $s-tint 5%); --s-panel: color-mix(in oklab, #17181c, $s-tint 6%); --s-raised: color-mix(in oklab, #212327, $s-tint 8%); --s-ink: color-mix(in oklab, #e9eaec, $s-tint 8%); --s-on-accent:#0c0a14 --s-focus: color-mix(in srgb, $s-primary 45%, transparent); --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 34px rgba(0,0,0,0.5);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#6db3ff"}):O.insertGlobalCss({":root":"--s-primary:#6c5ce7 --s-secondary:#d6459e --s-danger:#e23b3b --s-success:#1f9d6b --s-warning:#d97706 --s-neutral: color-mix(in oklab, #c9cbd0, $s-tint 14%); --s-page: color-mix(in oklab, #f3f4f6, $s-tint 5%); --s-panel: color-mix(in oklab, #ffffff, $s-tint 2%); --s-raised: color-mix(in oklab, #edeef0, $s-tint 7%); --s-ink: color-mix(in oklab, #1d1f24, $s-tint 7%); --s-on-accent:#0c0a14 --s-focus: color-mix(in srgb, $s-primary 35%, transparent); --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 30px rgba(20,24,40,0.13);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#2563eb"})});O.setSpacingCssVars();O.insertGlobalCss({":root":"--s-tint: color-mix(in oklab, $s-primary, $s-secondary); --s-gradient: linear-gradient(135deg, $s-primary, $s-secondary); --s-gradient-surface: linear-gradient(170deg, color-mix(in oklab, $s-primary 85%, $s-secondary), color-mix(in oklab, $s-primary 30%, $s-secondary)); --s-glow: 0 5px 16px color-mix(in srgb, $s-primary 26%, transparent); --s-page-bg: radial-gradient(120% 80% at 100% 0%, color-mix(in oklab, $s-secondary, transparent 86%), transparent 56%), radial-gradient(120% 80% at 0% 0%, color-mix(in oklab, $s-primary, transparent 87%), transparent 56%), $s-page;",":root, .s-s.base":"--s-a:$s-ink --s-b:$s-page",".s-s.base":"background: $s-page-bg;",".s-s.panel":"--s-a:$s-ink --s-b:$s-panel",".s-s.raised":"--s-a:$s-ink --s-b:$s-raised",".s-s.neutral":"--s-a:$s-ink --s-b:$s-neutral",".s-s.primary":"--s-a:$s-on-accent --s-b:$s-primary",".s-s.secondary":"--s-a:$s-on-accent --s-b:$s-secondary",".s-s.danger":"--s-a:$s-on-accent --s-b:$s-danger",".s-s.success":"--s-a:$s-on-accent --s-b:$s-success",".s-s.warning":"--s-a:$s-on-accent --s-b:$s-warning",".s-s.gradient":"--s-a:$s-on-accent --s-b:$s-primary",":root, .s-s":"--s-fg:$s-a --s-bg:$s-b --s-fg-muted: color-mix(in oklab, $s-fg, $s-bg 42%); --s-fg-faint: color-mix(in oklab, $s-fg, $s-bg 64%); --s-border: color-mix(in oklab, $s-fg, $s-bg 82%); --s-border-strong: color-mix(in oklab, $s-fg, $s-bg 68%); scrollbar-width:thin scrollbar-color: $s-border-strong transparent; background:$s-bg color:$s-fg",".s-s::-webkit-scrollbar, .s-s ::-webkit-scrollbar":"width:10px height:10px",".s-s::-webkit-scrollbar-track, .s-s ::-webkit-scrollbar-track":"background:transparent",".s-s::-webkit-scrollbar-thumb, .s-s ::-webkit-scrollbar-thumb":"background:$s-border-strong border-radius:99px border: 2px solid transparent; background-clip:padding-box",".s-s::-webkit-scrollbar-thumb:hover, .s-s ::-webkit-scrollbar-thumb:hover":"background:$s-fg-faint background-clip:padding-box",".s-s.tonal":"--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent);",".s-s.outlined":"--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg);",".s-s.filled":"--s-fg:$s-a --s-bg:$s-b background:$s-bg;",".s-s.gradient:not(.tonal):not(.outlined)":"background: $s-gradient-surface;",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-accent:$s-primary",".s-s.primary, .s-s.secondary, .s-s.danger, .s-s.success, .s-s.warning, .s-s.gradient":"--s-accent:$s-fg --s-link:$s-fg"});O.insertGlobalCss({"*, *::before, *::after":"box-sizing:border-box",html:"text-size-adjust:100%",body:"m:0 line-height:1.5 font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing:antialiased",a:"color: $s-link; text-decoration:underline text-underline-offset:2px; transition: color 0.12s, filter 0.12s;","a:hover":"filter: brightness(1.15)","input, button, textarea, select":"font:inherit color:inherit","code, kbd, samp, pre":"font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;",code:"background: color-mix(in oklab, $s-fg, $s-bg 86%); padding: 0.12em 0.34em; r:4px font-size:0.9em",pre:"background: color-mix(in oklab, $s-fg, $s-bg 92%); p:$3 r: $s-radius; overflow:auto","pre code":"background:transparent p:0","img, svg, video, canvas":"max-width:100% h:auto",hr:"border:0 border-top: 1px solid $s-border;","::placeholder":"color: $s-fg-faint; opacity:1",":focus-visible":"outline: 2px solid $s-focus; outline-offset:2px",small:"color:$s-fg-muted font-size:0.9em","@media (prefers-reduced-motion: reduce)":{"*, *::before, *::after":"transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important;"}});O.insertGlobalCss({".s-preload, .s-preload *, .s-preload *::before, .s-preload *::after":"transition: none !important; animation: none !important;"});if(typeof document<"u"&&typeof requestAnimationFrame=="function"){let e=document.documentElement;e.classList.add("s-preload"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("s-preload")))}var pe="p, ul, ol, dl, blockquote, pre, table, figure, hr, h1, h2, h3, h4, h5, h6";O.insertGlobalCss({[`${pe}`]:{"&":"margin:0","&:not(:first-child)":"margin-top:$3"},"h1, h2, h3, h4, h5, h6":{"&":"line-height:1.15 font-weight:700 text-wrap:balance","&:not(:first-child)":"margin-top:1.4em"},h1:"font-size:2em font-weight:800 letter-spacing:-0.022em",h2:"font-size:1.55em letter-spacing:-0.018em",h3:"font-size:1.3em letter-spacing:-0.011em",h4:"font-size:1.1em",h5:"font-size:0.95em letter-spacing:0.005em",h6:"font-size:0.8em fg:$s-fg-muted text-transform:uppercase letter-spacing:0.07em","ul, ol":{"&":"padding-left:1.5em","> li:not(:first-child), li > &:not(:first-child)":"margin-top:$1"},blockquote:"border-left: 3px solid $s-border; padding-left: $3; fg: $s-fg-muted",table:"border-collapse:collapse","th, td":"text-align:left padding: $1 $2; border-bottom: 1px solid $s-border; vertical-align:top",th:"font-weight:600","thead th":"border-bottom: 2px solid $s-border-strong;",dt:"font-weight:600",dd:"margin-left: 1.5em",figcaption:"fg:$s-fg-muted font-size:0.9em margin-top:$1 text-align:center"});import r from"aberdeen";import ie from"aberdeen";var fe=0;function C(e="s"){return`${e}-${++fe}`}function a(e,...t){e!=null&&(typeof e=="function"?e(...t):ie("rich=",e))}function M(e){let t=document.createElement("div");t.style.display="contents",document.body.appendChild(t),ie.mount(t,e)}import h from"aberdeen";h.insertGlobalCss({".s-field":{"&":"display:flex flex-direction:column gap:$1","> label":"font-weight:600 font-size:0.9em fg:$s-fg user-select:none"},".s-req":"fg:$s-danger margin-left:2px",".s-help":"font-size:0.82em fg:$s-fg-muted",".s-error":"font-size:0.82em fg:$s-danger",".s-input":{"&":"w:100% bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.55em 0.7em; transition: border-color 0.15s, box-shadow 0.15s;","&:hover:not(:disabled)":"border-color:$s-border-strong","&:focus-visible":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus; outline:none","&:disabled":"opacity:0.6 cursor:not-allowed","&[aria-invalid=true]":"border-color:$s-danger"}});function L(e,t){let n=e.id??C("field"),i=()=>!!e.error;h("div.s-field",e.attrs,()=>{h(()=>{e.label!=null&&h(`label for=${n}`,()=>{a(e.label),e.required&&h("span.s-req aria-hidden=true #*")})}),t(n,i),h(()=>{e.help!=null&&!e.error&&h("div.s-help",()=>a(e.help))}),h(()=>{e.error&&h("div.s-error role=alert #",e.error)})})}function H(e,t,n,i){h(`id=${t}`),e.name&&h(`name=${e.name}`),h(()=>{e.disabled&&h("disabled=true")}),h(()=>{e.required&&h("aria-required=true")}),h(()=>h("aria-invalid=",n()?"true":"false")),i&&h("bind=",i)}r.insertGlobalCss({".s-ac":{"&":"position:relative","> .s-control":"display:flex flex-wrap:wrap align-items:center gap:$1 bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.3em 0.4em; cursor:text; transition: border-color 0.15s, box-shadow 0.15s;","> .s-control:hover":"border-color:$s-border-strong","> .s-control:focus-within":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus;","&[aria-invalid=true] > .s-control":"border-color:$s-danger",".s-chip":"display:inline-flex align-items:center gap:$1 font-size:0.85em bg:$s-raised border: 1px solid $s-border; r:$s-radius padding: 0.1em 0.2em 0.1em 0.5em;",".s-chip > button":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.2em; r:4px",".s-chip > button:hover":"fg:$s-fg background:$s-border",input:"flex:1 min-width:6ch border:0 background:transparent color:inherit outline:none padding:0.25em","> .s-menu":"position:absolute top:100% left:0 right:0 z-index:20 margin-top:4px max-height:15rem overflow-y:auto list-style:none p:$1 margin-bottom:0 bg:$s-panel border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow","> .s-menu li":"margin:0",".s-option":"padding: 0.45em 0.6em; r:6px cursor:pointer transition: background 0.1s;",".s-option[aria-selected=true]":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-add":"fg:$s-accent font-style:italic",".s-empty":"padding: 0.45em 0.6em; fg:$s-fg-muted"}});function me(e){return typeof e=="string"?{value:e,label:e}:{value:e.value,label:e.label??e.value}}function be(e){let t=C("ac-menu"),n=r.proxy({query:"",open:!1,active:0}),i=()=>(typeof e.options=="function"?e.options():e.options).map(me),o=()=>{let c=e.bind?.value;return c==null||c===""?[]:Array.isArray(c)?c:[c]},s=c=>i().find(x=>x.value===c)?.label??c;if(!e.multi){let c=e.bind?r.peek(e.bind,"value"):void 0;typeof c=="string"&&c&&(n.query=r.peek(()=>s(c)))}let l=()=>{let c=new Set(o()),x=i();e.multi&&(x=x.filter(g=>!c.has(g.value)));let b=n.query.trim().toLowerCase();return b&&(x=x.filter(g=>g.label.toLowerCase().includes(b))),x},d=(c,x)=>{if(e.multi){let b=Array.isArray(e.bind?.value)?[...e.bind.value]:[];b.includes(c)||b.push(c),e.bind&&(e.bind.value=b),n.query=""}else e.bind&&(e.bind.value=c),n.query=s(c),n.open=!1;n.active=0,x?.focus()},p=c=>{if(!e.bind)return;let x=e.bind.value??[];e.bind.value=x.filter(b=>b!==c)};L(e,(c,x)=>{r("div.s-ac",e.inputAttrs,()=>{r(()=>r("aria-invalid=",x()?"true":"false"));let b;r("div.s-control",()=>{r("click=",()=>b?.focus()),r(()=>{if(e.multi)for(let g of o())r("span.s-chip",()=>{r("span #",r.peek(()=>s(g))),r("button type=button aria-label=",`Remove ${g}`,()=>{r("#\xD7"),r("click=",y=>{y.stopPropagation(),p(g),b?.focus()})})})}),b=r("input type=text role=combobox autocomplete=off",()=>{r(`id=${c} aria-controls=${t} aria-autocomplete=list`),e.placeholder!=null&&r("placeholder=",e.placeholder),e.disabled&&r("disabled=true"),e.required&&r("aria-required=true"),r("bind=",r.ref(n,"query")),r(()=>r("aria-expanded=",n.open?"true":"false")),r(()=>{let y=l()[n.active];r("aria-activedescendant=",n.open&&y?`${t}-opt-${n.active}`:"")}),r("input=",()=>{n.open=!0,n.active=0}),r("focus=",()=>{n.open=!0}),r("blur=",()=>{setTimeout(()=>le(),150)}),r("keydown=",g=>W(g,b))})}),r(()=>{if(!n.open)return;let g=l(),y=n.query.trim(),te=e.allowCustom!==!1&&y!==""&&!g.some(I=>I.label.toLowerCase()===y.toLowerCase());r("ul.s-menu role=listbox",`id=${t}`,()=>{g.forEach((I,Y)=>{r("li.s-option role=option",`id=${t}-opt-${Y}`,()=>{r(()=>r("aria-selected=",n.active===Y?"true":"false")),r("#",I.label),r("mousedown=",de=>de.preventDefault()),r("click=",()=>d(I.value,b)),r("mousemove=",()=>{n.active=Y})})}),te&&r("li.s-option.s-add role=option",()=>{r("#",`Add "${y}"`),r("mousedown=",I=>I.preventDefault()),r("click=",()=>d(y,b))}),g.length===0&&!te&&r("li.s-empty #No matches")})}),r(()=>{if(e.name)if(e.multi)for(let g of o())r("input type=hidden",()=>{r("name=",e.name),r("value=",g)});else r("input type=hidden",()=>{r("name=",e.name),r("value=",o()[0]??"")})})})});function W(c,x){let b=l(),g=b.length-1;if(c.key==="ArrowDown")c.preventDefault(),n.open=!0,n.active=Math.min(g,n.active+1);else if(c.key==="ArrowUp")c.preventDefault(),n.active=Math.max(0,n.active-1);else if(c.key==="Enter"){c.preventDefault();let y=b[n.active];y?d(y.value,x):e.allowCustom!==!1&&n.query.trim()?d(n.query.trim(),x):n.open&&(n.open=!1)}else if(c.key==="Escape")n.open=!1,e.multi||(n.query=s(o()[0]??""));else if(c.key==="Backspace"&&e.multi&&n.query===""){let y=o();y.length&&p(y[y.length-1])}}function le(){n.open=!1,e.multi?n.query="":e.allowCustom!==!1&&n.query.trim()?d(n.query.trim()):n.query=s(o()[0]??"")}}import q from"aberdeen";q.insertGlobalCss({".s-box":{"&":"display:flex flex-direction:column border: 1px solid $s-border; r: $s-radius-lg; overflow:hidden box-shadow: $s-shadow;","&:not(:first-child)":"margin-top: $3","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 padding: $2 $3; border-top: 1px solid $s-border;","> div":"p:$3 gap:$3"}});function ge(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e;q("section.s-box.s-s.panel",t.attrs,()=>{q(()=>{t.header!=null&&q("header.s-s.raised",t.headerAttrs,()=>a(t.header))}),q("div",t.contentAttrs,()=>{a(t.content)}),q(()=>{t.footer!=null&&q("footer.s-s.raised",t.footerAttrs,()=>a(t.footer))})})}import B from"aberdeen";B.insertGlobalCss({".s-btn":{"&":"display:inline-flex align-items:center justify-content:center gap:$2 font-weight:600 line-height:1.2 white-space:nowrap cursor:pointer text-decoration:none border: 1px solid $s-border; r: $s-radius; padding: 0.5em 1em; transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s, transform 0.08s;","&:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus;","&:disabled, &[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none filter:saturate(0.6)","&:hover":"filter: brightness(1.08); transform: translateY(-1px)","&.tonal:hover, &.outlined:hover":"background: color-mix(in srgb, $s-b 26%, transparent);","&.gradient:not(.tonal):not(.outlined)":"border:0 box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;","&.gradient:not(.tonal):not(.outlined):hover":"filter: brightness(1.05); box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), 0 7px 18px color-mix(in srgb, $s-primary 34%, transparent); transform: translateY(-1px);","&:active:not(:disabled):not([aria-disabled=true])":"transform: translateY(1px)","&.small, .small > &":"padding: 0.32em 0.7em; font-size:0.85em","&.large, .large > &":"padding: 0.66em 1.3em; font-size:1.1em"}});var he=/\.(gradient|primary|secondary|neutral|danger|success|warning|base|panel|raised)(\.|\s|$)/;function A(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e,n=t.href!=null?"a":"button",i=t.attrs&&he.test(t.attrs)?"":".gradient";B(`${n}.s-btn.s-s${i}`,t.attrs,()=>{t.href!=null?(B(`href=${t.href} role=button`),t.disabled&&B("aria-disabled=true")):(B("type=",t.type??"button"),t.disabled&&B("disabled=true")),t.ariaLabel&&B("aria-label=",t.ariaLabel),t.click&&B("click=",t.click),a(t.icon),a(t.content)})}import _ from"aberdeen";import re from"aberdeen";re.insertGlobalCss({".s-bgroup":{"&":"display:inline-flex align-items:stretch","&.s-spaced":"gap:$2 flex-wrap:wrap","&.s-vertical":"flex-direction:column","&.s-attached":"gap:0","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child)":"margin-left:-1px","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached:not(.s-vertical) > .s-btn:first-child:not(:last-child)":"border-top-right-radius:0 border-bottom-right-radius:0","&.s-attached:not(.s-vertical) > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-bottom-left-radius:0","&.s-attached.s-vertical > .s-btn:not(:first-child)":"margin-top:-1px","&.s-attached.s-vertical > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached.s-vertical > .s-btn:first-child:not(:last-child)":"border-bottom-left-radius:0 border-bottom-right-radius:0","&.s-attached.s-vertical > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-top-right-radius:0","&.s-attached > .s-btn:hover, &.s-attached > .s-btn:focus-visible":"z-index:1"}});function z(e={}){let n=`.s-${e.layout??"attached"}${e.vertical?".s-vertical":""}`;re(`div.s-bgroup${n} role=group`,e.attrs,()=>{if(e.buttons)for(let i of e.buttons)A(i);a(e.content)})}function xe(e){_(()=>{let t=e.bind.value;z({attrs:e.attrs,buttons:Object.entries(e.options).map(([n,i])=>({content:i,ariaLabel:typeof i=="function"?n:void 0,attrs:t===n?".primary":".neutral .outlined",click:()=>{e.bind.value=e.allowDeselect&&t===n?void 0:n}}))})}),e.name&&_(()=>_(`input type=hidden name=${e.name} value=`,e.bind.value??""))}import m from"aberdeen";m.insertGlobalCss({".s-check":{"&":"display:flex flex-direction:column gap:$1","> label":"display:flex align-items:center gap:$2 cursor:pointer user-select:none","> label:has(input:disabled)":"cursor:not-allowed opacity:0.6",input:"width:1.15em height:1.15em accent-color:$s-accent cursor:inherit m:0"}});function ve(e={}){let t=e.id??C("check");m("div.s-check",e.attrs,()=>{m(`label for=${t}`,()=>{m("input type=checkbox",e.inputAttrs,()=>{m(`id=${t}`),e.name&&m(`name=${e.name}`),e.checked&&!e.bind&&m("checked=true"),e.change&&m("change=",e.change),m(()=>{e.disabled&&m("disabled=true")}),m(()=>{e.required&&m("aria-required=true")}),e.bind&&m("bind=",e.bind)}),m(()=>{e.label!=null&&a(e.label),e.required&&m("span.s-req aria-hidden=true #*")})}),m(()=>{e.help!=null&&!e.error&&m("div.s-help",()=>a(e.help))}),m(()=>{e.error&&m("div.s-error role=alert #",e.error)})})}import F from"aberdeen";F.insertGlobalCss({".s-form":{"&":"display:flex flex-direction:column gap:$3","&.grid":"display:grid grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap:$3","&.grid > .s-wide, &.grid > footer":"grid-column: 1 / -1;","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 flex-wrap:wrap margin-top:$1"}});function ye(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e;F("form.s-form",t.attrs,()=>{F(()=>{F(".grid=",t.layout==="grid")}),F("submit=",n=>{if(n.preventDefault(),t.submit){let i=new FormData(n.target),o={};for(let s of new Set(i.keys())){let l=i.getAll(s);o[s]=l.length===1?l[0]:l}t.submit(o,n)}}),a(t.content),F(()=>{t.actions&&F("footer",t.actionsAttrs,()=>a(t.actions))})})}import u from"aberdeen";import v from"aberdeen";import{matchCurrent as $e}from"aberdeen/route";v.insertGlobalCss({".s-menu-list":"position:fixed z-index:350 min-width:10rem display:flex flex-direction:column p:$1 border: 1px solid $s-border; r:$s-radius-lg box-shadow:$s-shadow overflow-y:auto max-height:min(80vh,28rem) transition: opacity 0.15s, transform 0.15s;",".s-menu-list.hidden":"opacity:0 pointer-events:none transform:translateY(-6px)",".s-menu-item, .s-menu-item-link":"display:flex align-items:center gap:$2 w:100% padding: 0.5em 0.65em; r:$s-radius cursor:pointer text-align:left font-size:0.9em border:0 background:transparent fg:$s-fg text-decoration:none transition: background 0.12s, color 0.12s, transform 0.12s, box-shadow 0.12s;",".s-menu-item:hover:not([aria-disabled=true]):not([aria-current=page]), .s-menu-item-link:hover:not([aria-current=page])":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-menu-item[aria-current=page], .s-menu-item-link[aria-current=page]":"color:$s-on-accent font-weight:600 background: $s-gradient; box-shadow: 0 3px 10px color-mix(in srgb, $s-primary 38%, transparent);",".s-menu-item[aria-current=page] .s-menu-icon, .s-menu-item-link[aria-current=page] .s-menu-icon":"color:$s-on-accent",".s-menu-item[aria-current=page]:hover, .s-menu-item-link[aria-current=page]:hover":"filter:brightness(1.06)",".s-menu-item:focus-visible, .s-menu-item-link:focus-visible":"outline:none background: color-mix(in srgb, $s-fg 10%, transparent); box-shadow: 0 0 0 2px inset $s-focus;",".s-menu-item[aria-disabled=true], .s-menu-item-link[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none",".s-menu-icon":"fg:$s-fg-muted flex-shrink:0","hr.s-menu-sep":"border:0 height:1px margin: $1 0.6rem; background: linear-gradient(to right, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);"});function N(e,t){v("keydown=",n=>{if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"&&n.key!=="Home"&&n.key!=="End")return;n.preventDefault();let o=[...n.currentTarget.querySelectorAll(".s-menu-item, .s-menu-item-link")].filter(p=>p.getAttribute("aria-disabled")!=="true");if(!o.length)return;let s=o.indexOf(document.activeElement),l=n.key==="ArrowUp"?-1:1,d=n.key==="Home"?0:n.key==="End"?o.length-1:s<0?l>0?0:o.length-1:(s+l+o.length)%o.length;o[d].focus()});for(let n of e){if(typeof n=="string"||typeof n=="function"){a(n);continue}if("separator"in n){v("hr.s-menu-sep");continue}v(n.href?"a.s-menu-item-link":"button.s-menu-item type=button",n.attrs,()=>{n.href&&(v("href=",n.href),n.target&&v("target=",n.target),v(()=>{$e(n.href)&&v("aria-current=page")})),n.disabled&&v("aria-disabled=true"),v("click=",i=>{if(n.disabled){i.preventDefault();return}t?.(),n.click?.(i)}),n.icon&&v("span.s-menu-icon",()=>a(n.icon)),a(n.label)})}}var R=v.proxy({opts:null});function P(){let e=R.opts?.anchor;R.opts=null,e?.focus()}function we(e,t){let n=e.offsetWidth,i=e.offsetHeight,o=window.innerWidth,s=window.innerHeight,l=4,d=t.left;d+n>o-8&&(d=Math.max(8,t.right-n));let p=t.bottom+l;p+i>s-8&&t.top-i-l>=8&&(p=t.top-i-l),e.style.left=Math.max(8,d)+"px",e.style.top=Math.max(8,p)+"px"}M(()=>{let e=R.opts;if(!e)return;let t=v("div.s-menu-list.s-s.panel create=hidden destroy=hidden",e.dropdownAttrs,()=>{N(e.items,P)}),n=o=>{let s=o.target;!t.contains(s)&&!e.anchor.contains(s)&&P()},i=o=>{(o.key==="Escape"||o.key==="Tab")&&(o.preventDefault(),P())};document.addEventListener("click",n,!0),document.addEventListener("keydown",i,!0),v.clean(()=>{document.removeEventListener("click",n,!0),document.removeEventListener("keydown",i,!0)}),requestAnimationFrame(()=>{document.body.contains(t)&&(we(t,e.anchor.getBoundingClientRect()),t.querySelector(".s-menu-item:not([aria-disabled=true]), .s-menu-item-link:not([aria-disabled=true])")?.focus())})});function se(e){return R.opts=e,P}function V(e){let t=null;v.clean(()=>{R.opts?.anchor===t&&P()}),A({icon:()=>v("span aria-hidden=true #\u2630"),...e.button?.content==null?{ariaLabel:"Open menu"}:null,attrs:".neutral .outlined",...e.button,click:n=>{if(t=n.currentTarget,R.opts?.anchor===t){P();return}se({items:e.items,anchor:t,dropdownAttrs:e.dropdownAttrs})}})}u.insertGlobalCss({".s-main":{"&":"display:flex flex-direction:column min-height:100vh max-height:100vh container-type:inline-size","> header":"border-bottom: 1px solid $s-border; position:sticky top:0 z-index:10","> footer":"border-top: 1px solid $s-border; fg:$s-fg-muted","> header > .s-bar, > footer > .s-bar":"display:flex align-items:center width:100% margin-inline:auto gap:$3 padding: $2 $3;","> header .s-header-icon":"display:flex align-items:center font-size:1.4em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent;","> header .s-titles":"display:flex flex-direction:column min-width:0 flex:1","> header .s-title":"font-weight:800 font-size:1.1em line-height:1.2 overflow:hidden text-overflow:ellipsis white-space:nowrap letter-spacing:-0.01em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent; width:fit-content max-width:100%","> header .s-subtitle":"fg:$s-fg-muted font-size:0.85em overflow:hidden text-overflow:ellipsis white-space:nowrap","> header .s-menu":"display:flex align-items:center gap:$2",".s-body":"flex:1 overflow:hidden display:flex flex-direction:row min-height:0 justify-content:center",".s-body-inner":"flex:1 display:flex flex-direction:row min-height:0","&.s-nav-right .s-body-inner":"flex-direction:row-reverse",".s-nav-sep":"width:1px flex-shrink:0 align-self:stretch margin: 0.6rem 0; border:0 background: linear-gradient(to bottom, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);",".s-body main":"flex:1 min-height:0 overflow-y:auto display:flex flex-direction:column",".s-body main > .s-content":"width:100% flex:1 p:$3",".s-body main.s-scroll-y":"margin-right:$3"},".s-nav-panel":{"&":"display:flex flex-direction:column overflow-y:auto flex-shrink:0 max-width:228px padding:$3 gap:$1 background:transparent"},".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:none",".s-main.s-nav-btn-only .s-nav-panel":"display:none",".s-main.s-nav-btn-only .s-nav-trigger":"display:flex","@container (max-width: 640px)":{".s-main.s-nav-left .s-nav-panel, .s-main.s-nav-right .s-nav-panel, .s-main .s-nav-sep":"display:none",".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:flex",".s-content > .s-box":"margin-inline: calc(-1 * $3); r:0 border-inline:0",".s-main .s-body main.s-scroll-y":"margin-right:0"}});function ke(e={}){let t=e.nav,n=e.navPosition??"left",i=t!=null&&t.items.length>0,o=i?n==="button"?".s-nav-btn-only":`.s-nav-${n}`:"";u(`div.s-main.s-s.base${o}`,e.attrs,()=>{u(()=>{(e.title!=null||e.subtitle!=null||e.icon!=null||e.menu!=null||i)&&u("header.s-s.raised",e.topbarAttrs,()=>{u("div.s-bar",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),u(()=>{i&&u("div.s-nav-trigger",()=>{V({...t,button:{icon:()=>u("span aria-hidden=true #\u2630"),ariaLabel:"Open navigation",attrs:".neutral .outlined .small",...t.button}})})}),u(()=>{e.icon!=null&&u("div.s-header-icon",()=>a(e.icon))}),u("div.s-titles",()=>{u(()=>{e.title!=null&&u("div.s-title",()=>a(e.title))}),u(()=>{e.subtitle!=null&&u("div.s-subtitle",()=>a(e.subtitle))})}),u(()=>{e.menu&&u("div.s-menu",()=>a(e.menu))})})})}),u("div.s-body",()=>{u("div.s-body-inner",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),i&&n!=="button"&&(u(`nav.s-nav-panel.s-s.raised.s-nav-${n}`,e.navAttrs,()=>{N(t.items)}),u("div.s-nav-sep aria-hidden=true")),Ae(e)})}),u(()=>{e.footer!=null&&u("footer",()=>{u("div.s-bar",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),a(e.footer)})})})})}function Ae(e){let t=u("main",()=>{u("div.s-content",e.contentAttrs,()=>{a(e.content)})});Oe(t)}function Oe(e){if(typeof ResizeObserver>"u")return;let t=()=>e.classList.toggle("s-scroll-y",e.offsetWidth>e.clientWidth),n=new ResizeObserver(t);n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),t(),u.clean(()=>n.disconnect())}import f from"aberdeen";import G from"aberdeen";function J(e={}){L(e,(t,n)=>{G("input.s-input",e.inputAttrs,()=>{G("type=",e.type??"text"),e.placeholder!=null&&G("placeholder=",e.placeholder),e.autocomplete!=null&&G("autocomplete=",e.autocomplete),e.value!=null&&!e.bind&&G("value=",e.value),e.input&&G("input=",e.input),e.change&&G("change=",e.change),H(e,t,n,e.bind)})})}f.insertGlobalCss({".s-backdrop":{"&":"position:fixed inset:0 z-index:200 display:block background: rgba(0,0,0,0.55); transition: opacity 0.4s ease-in-out;","&.hidden":"opacity:0 pointer-events:none"},".s-dialog":{"&":"position:fixed z-index:200 top:50% left:50% display:flex flex-direction:column transform:translate(-50%,-50%) min-width:20rem max-width:min(90vw,44rem) max-height:min(88vh,800px) border: 1px solid $s-border; r: $s-radius-lg; box-shadow: $s-shadow; overflow:hidden transition: opacity 0.2s ease-out, transform 0.2s ease-out;","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600 flex-shrink:0","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 padding: $2 $3; border-top: 1px solid $s-border; flex-shrink:0","> div":"p:$3 gap:$3 display:flex flex-direction:column overflow-y:auto flex:1 min-height:0","&.hidden":"opacity:0 pointer-events:none transform: translate(-50%, calc(-50% + 20px)); pointer-events:none"}});var D=f.proxy({}),Q=0,Se=f.derive(()=>{let e=Object.keys(D);if(e.length)return e[e.length-1]});M(()=>{f.onEach(D,({resolve:e,opts:t},n)=>{let i=()=>{delete D[n]};f.clean(()=>{t.onClose?.(),e()});let o=f.derive(()=>Se.value!=n);f("div.s-backdrop create=hidden destroy=hidden .hidden=",o,"click=",()=>{t.allowCancel!==!1&&i()}),f("div.s-dialog.s-s.panel create=hidden destroy=hidden",t.attrs,()=>{f(()=>{t.header!=null&&f("header.s-s.raised",t.headerAttrs,()=>a(t.header))}),f("div",t.contentAttrs,()=>{a(t.content,i)}),f(()=>{t.footer!=null&&f("footer.s-s.raised",t.footerAttrs,()=>a(t.footer))})})})});function j(e){Q||document.addEventListener("keydown",n=>{if(n.key==="Escape"&&e.allowCancel!==!1){let i=f.unproxy(D);for(let o=Q;o>0;o--)if(i[o]){i[o].opts.allowCancel!==!1&&delete D[o];break}}});let t=++Q;return e.cancelWithScope!==!1&&f.clean(()=>{delete D[t]}),new Promise(n=>{D[t]={resolve:n,opts:e}})}function Ee(e,t={}){return j({header:"Alert",allowCancel:!0,content:n=>{f("p",()=>{f("#",e)}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"OK",click:n})}})},...t})}function Te(e,t={}){return new Promise(n=>{let i=!1;j({header:"Confirm",allowCancel:!0,content:o=>{f("p",()=>{f("#",e)}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"Cancel",attrs:".neutral .outlined",click:o}),A({content:"OK",click:()=>{i=!0,o()}})}})},...t,onClose:()=>{n(i),t.onClose?.()}})})}function Ce(e,t="",n={}){return new Promise(i=>{let o=null;j({header:"Input",allowCancel:!0,content:s=>{f("p",()=>{f("#",e)});let l=f.proxy({value:t});f("form display:contents",()=>{f("submit=",d=>{d.preventDefault(),o=l.value,s()}),J({bind:f.ref(l,"value")}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"Cancel",attrs:".neutral .outlined",type:"button",click:s}),A({content:"OK",type:"submit"})}})})},...n,onClose:()=>{i(o),n.onClose?.()}})})}import w from"aberdeen";w.insertGlobalCss({".s-select_wrap":{"&":"position:relative display:block",select:"w:100% cursor:pointer padding-right:2.2em; appearance:none","&::after":"content: '\u25BE'; position:absolute right:0.7em top:50%; transform: translateY(-50%); pointer-events:none fg:$s-fg-muted font-size:0.85em"}});function Me(e){L(e,(t,n)=>{w("div.s-select_wrap",e.inputAttrs,()=>{w("select.s-input",()=>{H(e,t,n),w("change=",i=>{e.bind&&(e.bind.value=i.target.value)}),w(()=>{let i=typeof e.options=="function"?e.options():e.options,o=e.bind?.value??"";e.placeholder!=null&&w("option",()=>{w("value= disabled=true hidden=true"),o||w("selected=true"),w("#",e.placeholder)});for(let s of i){let l=typeof s=="string"?{value:s,label:s}:{value:s.value,label:s.label??s.value};w("option",()=>{w("value=",l.value),l.value===o&&w("selected=true"),w("#",l.label)})}})})})})}import $ from"aberdeen";$.insertGlobalCss({".s-tabs":{"&":"display:flex flex-direction:column gap:$3",".s-tablist":"display:flex gap:$1 align-items:stretch overflow-x:auto scrollbar-width:none border-bottom: 1px solid $s-border;",".s-tablist::-webkit-scrollbar":"display:none",".s-tab":"display:inline-flex align-items:center gap:$2 cursor:pointer background:transparent border:0 color: $s-fg-muted; font-weight:600 padding: 0.6em 0.9em; border-bottom: 3px solid transparent; margin-bottom:-1px transition: color 0.15s, background 0.15s, border-color 0.15s;",".s-tab:hover:not(:disabled), .s-tab[aria-selected=true]":"color: $s-fg;",".s-tab:disabled":"opacity:0.5 cursor:not-allowed",".s-tab:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; r: $s-radius;",".s-tab[aria-selected=true]":"border-image: $s-gradient 1;",".s-tabpanel":"display:block"}});function Le(e){let t=C("tabs"),n=(s,l)=>s.id??String(l),i=e.bind??$.proxy(n(e.tabs[0]??{label:""},0)),o=(s,l)=>{s.disabled||(i.value=n(s,l))};$("div.s-tabs",e.attrs,()=>{$("div.s-tablist role=tablist",()=>{e.tabs.forEach((s,l)=>{let d=n(s,l);$("button.s-tab type=button role=tab",()=>{$(`id=${t}-tab-${d} aria-controls=${t}-panel-${d}`),$(()=>{let p=i.value===d;$("aria-selected=",p?"true":"false"),$("tabindex=",p?"0":"-1")}),s.disabled&&$("disabled=true"),$("click=",()=>o(s,l)),$("keydown=",p=>Be(p,e.tabs,l,o)),a(s.icon),a(s.label)})})}),$("div.s-tabpanel role=tabpanel",e.contentAttrs,()=>{$(()=>{let s=i.value,l=e.tabs.findIndex((p,W)=>n(p,W)===s),d=e.tabs[l]??e.tabs[0];d&&($(`id=${t}-panel-${n(d,l)} aria-labelledby=${t}-tab-${n(d,l)}`),a(d.content))})})})}function Be(e,t,n,i){let o=n;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=(n+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=(n-1+t.length)%t.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=t.length-1;else return;e.preventDefault();let s=o>=n?1:-1;for(let l=0;l<t.length;l++){let d=t[o];if(d&&!d.disabled){i(d,o),e.currentTarget?.parentElement?.children[o]?.focus();return}o=(o+s+t.length)%t.length}}import S from"aberdeen";S.insertGlobalCss({"textarea.s-input":"resize:vertical min-height:3em line-height:1.45","textarea.s-input.s-autoGrow":"resize:none min-height:2.5em overflow-y:hidden"});function qe(e={}){let t=e.autoGrow!==!1;L(e,(n,i)=>{let o=S("textarea.s-input",e.inputAttrs,()=>{t?(S(".s-autoGrow"),S("input=",s=>{ae(s.currentTarget),e.input&&e.input(s)})):(S("rows=",e.rows??4),S("resize:",e.resize??"vertical"),e.input&&S("input=",e.input)),e.placeholder!=null&&S("placeholder=",e.placeholder),e.value!=null&&!e.bind&&S("value=",e.value),e.change&&S("change=",e.change),H(e,n,i,e.bind)});t&&requestAnimationFrame(()=>ae(o))})}function ae(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}import k from"aberdeen";import{grow as ze,shrink as Fe}from"aberdeen/transitions";k.insertGlobalCss({".s-toasts":"position:fixed bottom:$3 right:$3 z-index:400 display:flex flex-direction:column gap:$2 pointer-events:none max-width:min(90vw,24rem) w:24rem",".s-toast":{"&":"display:flex align-items:flex-start gap:$2 padding: $3; border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow pointer-events:auto",".s-toast-body":"display:flex flex-direction:column gap:$1 flex:1 min-width:0",".s-toast-title":"font-weight:700 line-height:1.3",".s-toast-msg":"font-size:0.9em fg:$s-fg-muted line-height:1.4",".s-toast-close":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.15em; r:4px flex-shrink:0 align-self:flex-start",".s-toast-close:hover":"fg:$s-fg",".s-toast-close:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; fg:$s-fg"}});var Ge=0,Z=k.proxy({});M(()=>{k("div.s-toasts aria-live=polite aria-atomic=false",()=>{k.onEach(Z,e=>{let{opts:t}=e,n=t.type==="danger"||t.type==="warning"?"alert":"status",i=t.type??"neutral";k(`div.s-toast.s-s.${i} role=${n}`,"create=",ze,"destroy=",Fe,t.attrs,()=>{k("div.s-toast-body",()=>{k(()=>{t.title!=null&&k("div.s-toast-title",()=>a(t.title))}),k("div.s-toast-msg",()=>a(t.message))}),k(()=>{t.dismissible!==!1&&k("button.s-toast-close type=button aria-label=Dismiss",()=>{k("#\xD7"),k("click=",()=>X(e.id))})})})})})});function X(e){delete Z[e]}function De(e){let t=++Ge;Z[t]={id:t,opts:e};let n=e.duration??4e3,i;return n>0&&(i=setTimeout(()=>X(t),n)),()=>{i!=null&&clearTimeout(i),X(t)}}import E from"aberdeen";E.insertGlobalCss({".s-tt-tip":{"&":"position:fixed z-index:500 max-width:20rem w:max-content bg:$s-raised fg:$s-fg border: 1px solid $s-border-strong; r:$s-radius box-shadow:$s-shadow padding: 0.3em 0.65em; font-size:0.85em line-height:1.4 pointer-events:none"}});var K=E.proxy(void 0),T=null;typeof window<"u"&&window.addEventListener("scroll",()=>{K.value=void 0},{capture:!0,passive:!0});function Ie(e,t,n,i){let s=window.innerWidth,l=window.innerHeight,d=0,p=0;return i==="bottom"?(d=e.left+(e.width-t)/2,p=e.bottom+7,p+n>l-8&&(p=e.top-n-7)):i==="left"?(d=e.left-t-7,p=e.top+(e.height-n)/2,d<8&&(d=e.right+7)):i==="right"?(d=e.right+7,p=e.top+(e.height-n)/2,d+t>s-8&&(d=e.left-t-7)):(d=e.left+(e.width-t)/2,p=e.top-n-7,p<8&&(p=e.bottom+7)),{x:Math.max(8,Math.min(d,s-t-8)),y:Math.max(8,Math.min(p,l-n-8))}}function ee(){T&&clearTimeout(T),T=setTimeout(()=>{K.value=void 0,T=null},100)}M(()=>{let e=K.value;if(!e)return;let{opts:t,anchor:n}=e,i=t.placement??"top",o=E("div.s-tt-tip role=tooltip visibility:hidden",t.attrs,()=>{E("mouseenter=",()=>{T&&(clearTimeout(T),T=null)}),E("mouseleave=",ee),a(t.tip)});requestAnimationFrame(()=>{if(!document.body.contains(o))return;let{x:s,y:l}=Ie(n.getBoundingClientRect(),o.offsetWidth,o.offsetHeight,i);o.style.left=s+"px",o.style.top=l+"px",o.style.visibility=""})});function He(e){let t=n=>{T&&(clearTimeout(T),T=null),K.value={opts:e,anchor:n.currentTarget}};E("mouseenter=",t),E("mouseleave=",ee),E("focusin=",t),E("focusout=",ee),E.clean(()=>{K.value?.opts===e&&(K.value=void 0)})}export{He as addTooltip,Ee as alert,be as autocomplete,ge as box,A as button,xe as buttonChooser,z as buttonGroup,ve as checkbox,Te as confirm,j as dialog,ye as form,oe as getDarkMode,ke as main,V as menuButton,Ce as prompt,Me as select,ue as setDarkMode,se as showFloatingMenu,Le as tabs,qe as textarea,J as textline,De as toast};
|
|
1
|
+
import O from"aberdeen";var _="staffa:darkMode",oe=O.proxy({value:ce()});function ce(){try{let e=localStorage.getItem(_);if(e==="dark")return!0;if(e==="light")return!1}catch{}}function ue(e){oe.value=e;try{e===void 0?localStorage.removeItem(_):localStorage.setItem(_,e?"dark":"light")}catch{}}function ie(e=!1){let t=oe.value;return t===void 0&&!e?O.darkMode():t}O(()=>{ie()?O.insertGlobalCss({":root":"--s-primary:#8b7bff --s-secondary:#ef7fd0 --s-danger:#ff6b6b --s-success:#46d39a --s-warning:#fbbf24 --s-neutral: color-mix(in oklab, #3d4047, $s-tint 14%); --s-page: color-mix(in oklab, #0e0f12, $s-tint 5%); --s-panel: color-mix(in oklab, #17181c, $s-tint 6%); --s-raised: color-mix(in oklab, #212327, $s-tint 8%); --s-ink: color-mix(in oklab, #e9eaec, $s-tint 8%); --s-on-accent:#0c0a14 --s-focus: color-mix(in srgb, $s-primary 45%, transparent); --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 34px rgba(0,0,0,0.5);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#6db3ff"}):O.insertGlobalCss({":root":"--s-primary:#6c5ce7 --s-secondary:#d6459e --s-danger:#e23b3b --s-success:#1f9d6b --s-warning:#d97706 --s-neutral: color-mix(in oklab, #c9cbd0, $s-tint 14%); --s-page: color-mix(in oklab, #f3f4f6, $s-tint 5%); --s-panel: color-mix(in oklab, #ffffff, $s-tint 2%); --s-raised: color-mix(in oklab, #edeef0, $s-tint 7%); --s-ink: color-mix(in oklab, #1d1f24, $s-tint 7%); --s-on-accent:#0c0a14 --s-focus: color-mix(in srgb, $s-primary 35%, transparent); --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 30px rgba(20,24,40,0.13);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#2563eb"})});O.setSpacingCssVars();O.insertGlobalCss({":root":"--s-tint: color-mix(in oklab, $s-primary, $s-secondary); --s-gradient: linear-gradient(135deg, $s-primary, $s-secondary); --s-gradient-surface: linear-gradient(170deg, color-mix(in oklab, $s-primary 85%, $s-secondary), color-mix(in oklab, $s-primary 30%, $s-secondary)); --s-glow: 0 5px 16px color-mix(in srgb, $s-primary 26%, transparent); --s-page-bg: radial-gradient(120% 80% at 100% 0%, color-mix(in oklab, $s-secondary, transparent 86%), transparent 56%), radial-gradient(120% 80% at 0% 0%, color-mix(in oklab, $s-primary, transparent 87%), transparent 56%), $s-page;",":root, .s-s.base":"--s-a:$s-ink --s-b:$s-page",".s-s.base":"background: $s-page-bg;",".s-s.panel":"--s-a:$s-ink --s-b:$s-panel",".s-s.raised":"--s-a:$s-ink --s-b:$s-raised",".s-s.neutral":"--s-a:$s-ink --s-b:$s-neutral",".s-s.primary":"--s-a:$s-on-accent --s-b:$s-primary",".s-s.secondary":"--s-a:$s-on-accent --s-b:$s-secondary",".s-s.danger":"--s-a:$s-on-accent --s-b:$s-danger",".s-s.success":"--s-a:$s-on-accent --s-b:$s-success",".s-s.warning":"--s-a:$s-on-accent --s-b:$s-warning",".s-s.gradient":"--s-a:$s-on-accent --s-b:$s-primary",":root, .s-s":"--s-fg:$s-a --s-bg:$s-b --s-fg-muted: color-mix(in oklab, $s-fg, $s-bg 42%); --s-fg-faint: color-mix(in oklab, $s-fg, $s-bg 64%); --s-border: color-mix(in oklab, $s-fg, $s-bg 82%); --s-border-strong: color-mix(in oklab, $s-fg, $s-bg 68%); scrollbar-width:thin scrollbar-color: $s-border-strong transparent; background:$s-bg color:$s-fg",".s-s::-webkit-scrollbar, .s-s ::-webkit-scrollbar":"width:10px height:10px",".s-s::-webkit-scrollbar-track, .s-s ::-webkit-scrollbar-track":"background:transparent",".s-s::-webkit-scrollbar-thumb, .s-s ::-webkit-scrollbar-thumb":"background:$s-border-strong border-radius:99px border: 2px solid transparent; background-clip:padding-box",".s-s::-webkit-scrollbar-thumb:hover, .s-s ::-webkit-scrollbar-thumb:hover":"background:$s-fg-faint background-clip:padding-box",".s-s.tonal":"--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent);",".s-s.outlined":"--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg);",".s-s.filled":"--s-fg:$s-a --s-bg:$s-b background:$s-bg;",".s-s.gradient:not(.tonal):not(.outlined)":"background: $s-gradient-surface;",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-accent:$s-primary",".s-s.primary, .s-s.secondary, .s-s.danger, .s-s.success, .s-s.warning, .s-s.gradient":"--s-accent:$s-fg --s-link:$s-fg"});O.insertGlobalCss({"*, *::before, *::after":"box-sizing:border-box",html:"text-size-adjust:100%",body:"m:0 line-height:1.5 font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing:antialiased",a:"color: $s-link; text-decoration:underline text-underline-offset:2px; transition: color 0.12s, filter 0.12s;","a:hover":"filter: brightness(1.15)","input, button, textarea, select":"font:inherit color:inherit","code, kbd, samp, pre":"font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;",code:"background: color-mix(in oklab, $s-fg, $s-bg 86%); padding: 0.12em 0.34em; r:4px font-size:0.9em",pre:"background: color-mix(in oklab, $s-fg, $s-bg 92%); p:$3 r: $s-radius; overflow:auto","pre code":"background:transparent p:0","img, svg, video, canvas":"max-width:100% h:auto",hr:"border:0 border-top: 1px solid $s-border;","::placeholder":"color: $s-fg-faint; opacity:1",":focus-visible":"outline: 2px solid $s-focus; outline-offset:2px",small:"color:$s-fg-muted font-size:0.9em","@media (prefers-reduced-motion: reduce)":{"*, *::before, *::after":"transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important;"}});O.insertGlobalCss({".s-preload, .s-preload *, .s-preload *::before, .s-preload *::after":"transition: none !important; animation: none !important;"});if(typeof document<"u"&&typeof requestAnimationFrame=="function"){let e=document.documentElement;e.classList.add("s-preload"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("s-preload")))}var pe="p, ul, ol, dl, blockquote, pre, table, figure, hr, h1, h2, h3, h4, h5, h6";O.insertGlobalCss({[`${pe}`]:{"&":"margin:0","&:not(:first-child)":"margin-top:$3"},"h1, h2, h3, h4, h5, h6":{"&":"line-height:1.15 font-weight:700 text-wrap:balance","&:not(:first-child)":"margin-top:1.4em"},h1:"font-size:2em font-weight:800 letter-spacing:-0.022em",h2:"font-size:1.55em letter-spacing:-0.018em",h3:"font-size:1.3em letter-spacing:-0.011em",h4:"font-size:1.1em",h5:"font-size:0.95em letter-spacing:0.005em",h6:"font-size:0.8em fg:$s-fg-muted text-transform:uppercase letter-spacing:0.07em","ul, ol":{"&":"padding-left:1.5em","> li:not(:first-child), li > &:not(:first-child)":"margin-top:$1"},blockquote:"border-left: 3px solid $s-border; padding-left: $3; fg: $s-fg-muted",table:"border-collapse:collapse","th, td":"text-align:left padding: $1 $2; border-bottom: 1px solid $s-border; vertical-align:top",th:"font-weight:600","thead th":"border-bottom: 2px solid $s-border-strong;",dt:"font-weight:600",dd:"margin-left: 1.5em",figcaption:"fg:$s-fg-muted font-size:0.9em margin-top:$1 text-align:center"});import r from"aberdeen";import re from"aberdeen";var fe=0;function C(e="s"){return`${e}-${++fe}`}function a(e,...t){e!=null&&(typeof e=="function"?e(...t):re("rich=",e))}function M(e){queueMicrotask(()=>re(e))}import h from"aberdeen";h.insertGlobalCss({".s-field":{"&":"display:flex flex-direction:column gap:$1","> label":"font-weight:600 font-size:0.9em fg:$s-fg user-select:none"},".s-req":"fg:$s-danger margin-left:2px",".s-help":"font-size:0.82em fg:$s-fg-muted",".s-error":"font-size:0.82em fg:$s-danger",".s-input":{"&":"w:100% bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.55em 0.7em; transition: border-color 0.15s, box-shadow 0.15s;","&:hover:not(:disabled)":"border-color:$s-border-strong","&:focus-visible":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus; outline:none","&:disabled":"opacity:0.6 cursor:not-allowed","&[aria-invalid=true]":"border-color:$s-danger"}});function L(e,t){let n=e.id??C("field"),i=()=>!!e.error;h("div.s-field",e.attrs,()=>{h(()=>{e.label!=null&&h(`label for=${n}`,()=>{a(e.label),e.required&&h("span.s-req aria-hidden=true #*")})}),t(n,i),h(()=>{e.help!=null&&!e.error&&h("div.s-help",()=>a(e.help))}),h(()=>{e.error&&h("div.s-error role=alert #",e.error)})})}function R(e,t,n,i){h(`id=${t}`),e.name&&h(`name=${e.name}`),h(()=>{e.disabled&&h("disabled=true")}),h(()=>{e.required&&h("aria-required=true")}),h(()=>h("aria-invalid=",n()?"true":"false")),i&&h("bind=",i)}r.insertGlobalCss({".s-ac":{"&":"position:relative","> .s-control":"display:flex flex-wrap:wrap align-items:center gap:$1 bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.3em 0.4em; cursor:text; transition: border-color 0.15s, box-shadow 0.15s;","> .s-control:hover":"border-color:$s-border-strong","> .s-control:focus-within":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus;","&[aria-invalid=true] > .s-control":"border-color:$s-danger",".s-chip":"display:inline-flex align-items:center gap:$1 font-size:0.85em bg:$s-raised border: 1px solid $s-border; r:$s-radius padding: 0.1em 0.2em 0.1em 0.5em;",".s-chip > button":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.2em; r:4px",".s-chip > button:hover":"fg:$s-fg background:$s-border",input:"flex:1 min-width:6ch border:0 background:transparent color:inherit outline:none padding:0.25em","> .s-menu":"position:absolute top:100% left:0 right:0 z-index:20 margin-top:4px max-height:15rem overflow-y:auto list-style:none p:$1 margin-bottom:0 bg:$s-panel border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow","> .s-menu li":"margin:0",".s-option":"padding: 0.45em 0.6em; r:6px cursor:pointer transition: background 0.1s;",".s-option[aria-selected=true]":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-add":"fg:$s-accent font-style:italic",".s-empty":"padding: 0.45em 0.6em; fg:$s-fg-muted"}});function me(e){return typeof e=="string"?{value:e,label:e}:{value:e.value,label:e.label??e.value}}function be(e){let t=C("ac-menu"),n=r.proxy({query:"",open:!1,active:0}),i=()=>(typeof e.options=="function"?e.options():e.options).map(me),o=()=>{let c=e.bind?.value;return c==null||c===""?[]:Array.isArray(c)?c:[c]},s=c=>i().find(v=>v.value===c)?.label??c;if(!e.multi){let c=e.bind?r.peek(e.bind,"value"):void 0;typeof c=="string"&&c&&(n.query=r.peek(()=>s(c)))}let l=()=>{let c=new Set(o()),v=i();e.multi&&(v=v.filter(g=>!c.has(g.value)));let b=n.query.trim().toLowerCase();return b&&(v=v.filter(g=>g.label.toLowerCase().includes(b))),v},d=(c,v)=>{if(e.multi){let b=Array.isArray(e.bind?.value)?[...e.bind.value]:[];b.includes(c)||b.push(c),e.bind&&(e.bind.value=b),n.query=""}else e.bind&&(e.bind.value=c),n.query=s(c),n.open=!1;n.active=0,v?.focus()},p=c=>{if(!e.bind)return;let v=e.bind.value??[];e.bind.value=v.filter(b=>b!==c)};L(e,(c,v)=>{r("div.s-ac",e.inputAttrs,()=>{r(()=>r("aria-invalid=",v()?"true":"false"));let b;r("div.s-control",()=>{r("click=",()=>b?.focus()),r(()=>{if(e.multi)for(let g of o())r("span.s-chip",()=>{r("span #",r.peek(()=>s(g))),r("button type=button aria-label=",`Remove ${g}`,()=>{r("#\xD7"),r("click=",y=>{y.stopPropagation(),p(g),b?.focus()})})})}),b=r("input type=text role=combobox autocomplete=off",()=>{r(`id=${c} aria-controls=${t} aria-autocomplete=list`),e.placeholder!=null&&r("placeholder=",e.placeholder),e.disabled&&r("disabled=true"),e.required&&r("aria-required=true"),r("bind=",r.ref(n,"query")),r(()=>r("aria-expanded=",n.open?"true":"false")),r(()=>{let y=l()[n.active];r("aria-activedescendant=",n.open&&y?`${t}-opt-${n.active}`:"")}),r("input=",()=>{n.open=!0,n.active=0}),r("focus=",()=>{n.open=!0}),r("blur=",()=>{setTimeout(()=>le(),150)}),r("keydown=",g=>U(g,b))})}),r(()=>{if(!n.open)return;let g=l(),y=n.query.trim(),ne=e.allowCustom!==!1&&y!==""&&!g.some(P=>P.label.toLowerCase()===y.toLowerCase());r("ul.s-menu role=listbox",`id=${t}`,()=>{g.forEach((P,Y)=>{r("li.s-option role=option",`id=${t}-opt-${Y}`,()=>{r(()=>r("aria-selected=",n.active===Y?"true":"false")),r("#",P.label),r("mousedown=",de=>de.preventDefault()),r("click=",()=>d(P.value,b)),r("mousemove=",()=>{n.active=Y})})}),ne&&r("li.s-option.s-add role=option",()=>{r("#",`Add "${y}"`),r("mousedown=",P=>P.preventDefault()),r("click=",()=>d(y,b))}),g.length===0&&!ne&&r("li.s-empty #No matches")})}),r(()=>{if(e.name)if(e.multi)for(let g of o())r("input type=hidden",()=>{r("name=",e.name),r("value=",g)});else r("input type=hidden",()=>{r("name=",e.name),r("value=",o()[0]??"")})})})});function U(c,v){let b=l(),g=b.length-1;if(c.key==="ArrowDown")c.preventDefault(),n.open=!0,n.active=Math.min(g,n.active+1);else if(c.key==="ArrowUp")c.preventDefault(),n.active=Math.max(0,n.active-1);else if(c.key==="Enter"){c.preventDefault();let y=b[n.active];y?d(y.value,v):e.allowCustom!==!1&&n.query.trim()?d(n.query.trim(),v):n.open&&(n.open=!1)}else if(c.key==="Escape")n.open=!1,e.multi||(n.query=s(o()[0]??""));else if(c.key==="Backspace"&&e.multi&&n.query===""){let y=o();y.length&&p(y[y.length-1])}}function le(){n.open=!1,e.multi?n.query="":e.allowCustom!==!1&&n.query.trim()?d(n.query.trim()):n.query=s(o()[0]??"")}}import q from"aberdeen";q.insertGlobalCss({".s-box":{"&":"display:flex flex-direction:column border: 1px solid $s-border; r: $s-radius-lg; overflow:hidden box-shadow: $s-shadow;","&:not(:first-child)":"margin-top: $3","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 padding: $2 $3; border-top: 1px solid $s-border;","> div":"p:$3 gap:$3"}});function ge(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e;q("section.s-box.s-s.panel",t.attrs,()=>{q(()=>{t.header!=null&&q("header.s-s.raised",t.headerAttrs,()=>a(t.header))}),q("div",t.contentAttrs,()=>{a(t.content)}),q(()=>{t.footer!=null&&q("footer.s-s.raised",t.footerAttrs,()=>a(t.footer))})})}import B from"aberdeen";B.insertGlobalCss({".s-btn":{"&":"display:inline-flex align-items:center justify-content:center gap:$2 font-weight:600 line-height:1.2 white-space:nowrap cursor:pointer text-decoration:none border: 1px solid $s-border; r: $s-radius; padding: 0.5em 1em; transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s, transform 0.08s;","&:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus;","&:disabled, &[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none filter:saturate(0.6)","&:hover":"filter: brightness(1.08)","&.tonal:hover, &.outlined:hover":"background: color-mix(in srgb, $s-b 26%, transparent);","&.gradient:not(.tonal):not(.outlined)":"border:0 box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;","&.gradient:not(.tonal):not(.outlined):hover":"filter: brightness(1.05); box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), 0 7px 18px color-mix(in srgb, $s-primary 34%, transparent);","&:active:not(:disabled):not([aria-disabled=true])":"transform: translateY(1px)","&.small, .small > &":"padding: 0.32em 0.7em; font-size:0.85em","&.large, .large > &":"padding: 0.66em 1.3em; font-size:1.1em"}});var he=/\.(gradient|primary|secondary|neutral|danger|success|warning|base|panel|raised)(\.|\s|$)/;function A(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e,n=t.href!=null?"a":"button",i=t.attrs&&he.test(t.attrs)?"":".gradient";B(`${n}.s-btn.s-s${i}`,t.attrs,()=>{t.href!=null?(B(`href=${t.href} role=button`),t.disabled&&B("aria-disabled=true")):(B("type=",t.type??"button"),t.disabled&&B("disabled=true")),t.ariaLabel&&B("aria-label=",t.ariaLabel),t.click&&B("click=",t.click),a(t.icon),a(t.content)})}import N from"aberdeen";import se from"aberdeen";se.insertGlobalCss({".s-bgroup":{"&":"display:inline-flex align-items:stretch","&.s-spaced":"gap:$2 flex-wrap:wrap","&.s-vertical":"flex-direction:column","&.s-attached":"gap:0","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child)":"margin-left:-1px","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached:not(.s-vertical) > .s-btn:first-child:not(:last-child)":"border-top-right-radius:0 border-bottom-right-radius:0","&.s-attached:not(.s-vertical) > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-bottom-left-radius:0","&.s-attached.s-vertical > .s-btn:not(:first-child)":"margin-top:-1px","&.s-attached.s-vertical > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached.s-vertical > .s-btn:first-child:not(:last-child)":"border-bottom-left-radius:0 border-bottom-right-radius:0","&.s-attached.s-vertical > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-top-right-radius:0","&.s-attached > .s-btn:hover, &.s-attached > .s-btn:focus-visible":"z-index:1"}});function z(e={}){let n=`.s-${e.layout??"attached"}${e.vertical?".s-vertical":""}`;se(`div.s-bgroup${n} role=group`,e.attrs,()=>{if(e.buttons)for(let i of e.buttons)A(i);a(e.content)})}function xe(e){N(()=>{let t=e.bind.value;z({attrs:e.attrs,buttons:Object.entries(e.options).map(([n,i])=>({content:i,ariaLabel:typeof i=="function"?n:void 0,attrs:t===n?".primary":".neutral .outlined",click:()=>{e.bind.value=e.allowDeselect&&t===n?void 0:n}}))})}),e.name&&N(()=>N(`input type=hidden name=${e.name} value=`,e.bind.value??""))}import m from"aberdeen";m.insertGlobalCss({".s-check":{"&":"display:flex flex-direction:column gap:$1","> label":"display:flex align-items:center gap:$2 cursor:pointer user-select:none","> label:has(input:disabled)":"cursor:not-allowed opacity:0.6",input:"width:1.15em height:1.15em accent-color:$s-accent cursor:inherit m:0"}});function ve(e={}){let t=e.id??C("check");m("div.s-check",e.attrs,()=>{m(`label for=${t}`,()=>{m("input type=checkbox",e.inputAttrs,()=>{m(`id=${t}`),e.name&&m(`name=${e.name}`),e.checked&&!e.bind&&m("checked=true"),e.change&&m("change=",e.change),m(()=>{e.disabled&&m("disabled=true")}),m(()=>{e.required&&m("aria-required=true")}),e.bind&&m("bind=",e.bind)}),m(()=>{e.label!=null&&a(e.label),e.required&&m("span.s-req aria-hidden=true #*")})}),m(()=>{e.help!=null&&!e.error&&m("div.s-help",()=>a(e.help))}),m(()=>{e.error&&m("div.s-error role=alert #",e.error)})})}import F from"aberdeen";F.insertGlobalCss({".s-form":{"&":"display:flex flex-direction:column gap:$3","&.grid":"display:grid grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap:$3","&.grid > .s-wide, &.grid > footer":"grid-column: 1 / -1;","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 flex-wrap:wrap margin-top:$1"}});function ye(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e;F("form.s-form",t.attrs,()=>{F(()=>{F(".grid=",t.layout==="grid")}),F("submit=",n=>{if(n.preventDefault(),t.submit){let i=new FormData(n.target),o={};for(let s of new Set(i.keys())){let l=i.getAll(s);o[s]=l.length===1?l[0]:l}t.submit(o,n)}}),a(t.content),F(()=>{t.actions&&F("footer",t.actionsAttrs,()=>a(t.actions))})})}import u from"aberdeen";import x from"aberdeen";import{matchCurrent as $e}from"aberdeen/route";x.insertGlobalCss({".s-menu-list":"position:fixed z-index:350 min-width:10rem display:flex flex-direction:column p:$1 border: 1px solid $s-border; r:$s-radius-lg box-shadow:$s-shadow overflow-y:auto max-height:min(80vh,28rem) transition: opacity 0.15s, transform 0.15s;",".s-menu-list.hidden":"opacity:0 pointer-events:none transform:translateY(-6px)",".s-menu-item, .s-menu-item-link":"display:flex align-items:center gap:$2 w:100% padding: 0.5em 0.65em; r:$s-radius cursor:pointer text-align:left font-size:0.9em border:0 background:transparent fg:$s-fg text-decoration:none transition: background 0.12s, color 0.12s, transform 0.12s, box-shadow 0.12s;",".s-menu-item:hover:not([aria-disabled=true]):not([aria-current=page]), .s-menu-item-link:hover:not([aria-current=page])":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-menu-item[aria-current=page], .s-menu-item-link[aria-current=page]":"color:$s-on-accent font-weight:600 background: $s-gradient; box-shadow: 0 3px 10px color-mix(in srgb, $s-primary 38%, transparent);",".s-menu-item[aria-current=page] .s-menu-icon, .s-menu-item-link[aria-current=page] .s-menu-icon":"color:$s-on-accent",".s-menu-item[aria-current=page]:hover, .s-menu-item-link[aria-current=page]:hover":"filter:brightness(1.06)",".s-menu-item:focus-visible, .s-menu-item-link:focus-visible":"outline:none background: color-mix(in srgb, $s-fg 10%, transparent); box-shadow: 0 0 0 2px inset $s-focus;",".s-menu-item[aria-disabled=true], .s-menu-item-link[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none",".s-menu-icon":"fg:$s-fg-muted flex-shrink:0","hr.s-menu-sep":"border:0 height:1px margin: $1 0.6rem; background: linear-gradient(to right, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);"});function V(e,t){x("keydown=",n=>{if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"&&n.key!=="Home"&&n.key!=="End")return;n.preventDefault();let o=[...n.currentTarget.querySelectorAll(".s-menu-item, .s-menu-item-link")].filter(p=>p.getAttribute("aria-disabled")!=="true");if(!o.length)return;let s=o.indexOf(document.activeElement),l=n.key==="ArrowUp"?-1:1,d=n.key==="Home"?0:n.key==="End"?o.length-1:s<0?l>0?0:o.length-1:(s+l+o.length)%o.length;o[d].focus()});for(let n of e){if(typeof n=="string"||typeof n=="function"){a(n);continue}if("separator"in n){x("hr.s-menu-sep");continue}x(n.href?"a.s-menu-item-link":"button.s-menu-item type=button",n.attrs,()=>{n.href&&(x("href=",n.href),n.target&&x("target=",n.target),x(()=>{$e(n.href)&&x("aria-current=page")})),n.disabled&&x("aria-disabled=true"),x("click=",i=>{if(n.disabled){i.preventDefault();return}t?.(),n.click?.(i)}),n.icon&&x("span.s-menu-icon",()=>a(n.icon)),a(n.label)})}}var G=x.proxy({opts:null});function D(){let e=G.opts?.anchor;G.opts=null,e?.focus()}function we(e,t){let n=e.offsetWidth,i=e.offsetHeight,o=window.innerWidth,s=window.innerHeight,l=4,d=t.left;d+n>o-8&&(d=Math.max(8,t.right-n));let p=t.bottom+l;p+i>s-8&&t.top-i-l>=8&&(p=t.top-i-l),e.style.left=Math.max(8,d)+"px",e.style.top=Math.max(8,p)+"px"}M(()=>{let e=G.opts;if(!e)return;let t=x("div.s-menu-list.s-s.panel create=hidden destroy=hidden",e.dropdownAttrs,()=>{V(e.items,D)}),n=o=>{let s=o.target;!t.contains(s)&&!e.anchor.contains(s)&&D()},i=o=>{(o.key==="Escape"||o.key==="Tab")&&(o.preventDefault(),D())};document.addEventListener("click",n,!0),document.addEventListener("keydown",i,!0),x.clean(()=>{document.removeEventListener("click",n,!0),document.removeEventListener("keydown",i,!0)}),requestAnimationFrame(()=>{document.body.contains(t)&&(we(t,e.anchor.getBoundingClientRect()),t.querySelector(".s-menu-item:not([aria-disabled=true]), .s-menu-item-link:not([aria-disabled=true])")?.focus())})});function J(e){return G.opts=e,D}function ke(e){let t=null;x.clean(()=>{G.opts?.anchor===t&&D()}),x("contextmenu=",n=>{n.preventDefault(),t=n.currentTarget,J({items:e.items,anchor:t,dropdownAttrs:e.dropdownAttrs})})}function Q(e){let t=null;x.clean(()=>{G.opts?.anchor===t&&D()}),A({icon:()=>x("span aria-hidden=true #\u2630"),...e.button?.content==null?{ariaLabel:"Open menu"}:null,attrs:".neutral .outlined",...e.button,click:n=>{if(t=n.currentTarget,G.opts?.anchor===t){D();return}J({items:e.items,anchor:t,dropdownAttrs:e.dropdownAttrs})}})}u.insertGlobalCss({".s-main":{"&":"display:flex flex-direction:column min-height:100vh max-height:100vh container-type:inline-size","> header":"border-bottom: 1px solid $s-border; position:sticky top:0 z-index:10","> footer":"border-top: 1px solid $s-border; fg:$s-fg-muted","> header > .s-bar, > footer > .s-bar":"display:flex align-items:center width:100% margin-inline:auto gap:$3 padding: $2 $3;","> header .s-header-icon":"display:flex align-items:center font-size:1.4em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent;","> header .s-titles":"display:flex flex-direction:column min-width:0 flex:1","> header .s-title":"font-weight:800 font-size:1.1em line-height:1.2 overflow:hidden text-overflow:ellipsis white-space:nowrap letter-spacing:-0.01em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent; width:fit-content max-width:100%","> header .s-subtitle":"fg:$s-fg-muted font-size:0.85em overflow:hidden text-overflow:ellipsis white-space:nowrap","> header .s-menu":"display:flex align-items:center gap:$2",".s-body":"flex:1 overflow:hidden display:flex flex-direction:row min-height:0 justify-content:center",".s-body-inner":"flex:1 display:flex flex-direction:row min-height:0","&.s-nav-right .s-body-inner":"flex-direction:row-reverse",".s-nav-sep":"width:1px flex-shrink:0 align-self:stretch margin: 0.6rem 0; border:0 background: linear-gradient(to bottom, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);",".s-body main":"flex:1 min-height:0 overflow-y:auto display:flex flex-direction:column",".s-body main > .s-content":"width:100% flex:1 p:$3",".s-body main.s-scroll-y":"margin-right:$3"},".s-nav-panel":{"&":"display:flex flex-direction:column overflow-y:auto flex-shrink:0 max-width:228px padding:$3 gap:$1 background:transparent"},".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:none",".s-main.s-nav-btn-only .s-nav-panel":"display:none",".s-main.s-nav-btn-only .s-nav-trigger":"display:flex","@container (max-width: 640px)":{".s-main.s-nav-left .s-nav-panel, .s-main.s-nav-right .s-nav-panel, .s-main .s-nav-sep":"display:none",".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:flex",".s-content > .s-box":"margin-inline: calc(-1 * $3); r:0 border-inline:0",".s-main .s-body main.s-scroll-y":"margin-right:0"}});function Ae(e={}){let t=e.nav,n=e.navPosition??"left",i=t!=null&&t.items.length>0,o=i?n==="button"?".s-nav-btn-only":`.s-nav-${n}`:"";u(`div.s-main.s-s.base${o}`,e.attrs,()=>{u(()=>{(e.title!=null||e.subtitle!=null||e.icon!=null||e.menu!=null||i)&&u("header.s-s.raised",e.topbarAttrs,()=>{u("div.s-bar",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),u(()=>{i&&u("div.s-nav-trigger",()=>{Q({...t,button:{icon:()=>u("span aria-hidden=true #\u2630"),ariaLabel:"Open navigation",attrs:".neutral .outlined .small",...t.button}})})}),u(()=>{e.icon!=null&&u("div.s-header-icon",()=>a(e.icon))}),u("div.s-titles",()=>{u(()=>{e.title!=null&&u("div.s-title",()=>a(e.title))}),u(()=>{e.subtitle!=null&&u("div.s-subtitle",()=>a(e.subtitle))})}),u(()=>{e.menu&&u("div.s-menu",()=>a(e.menu))})})})}),u("div.s-body",()=>{u("div.s-body-inner",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),i&&n!=="button"&&(u(`nav.s-nav-panel.s-s.raised.s-nav-${n}`,e.navAttrs,()=>{V(t.items)}),u("div.s-nav-sep aria-hidden=true")),Oe(e)})}),u(()=>{e.footer!=null&&u("footer",()=>{u("div.s-bar",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),a(e.footer)})})})})}function Oe(e){let t=u("main",()=>{u("div.s-content",e.contentAttrs,()=>{a(e.content)})});Ee(t)}function Ee(e){if(typeof ResizeObserver>"u")return;let t=()=>e.classList.toggle("s-scroll-y",e.offsetWidth>e.clientWidth),n=new ResizeObserver(t);n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),t(),u.clean(()=>n.disconnect())}import f from"aberdeen";import I from"aberdeen";function X(e={}){L(e,(t,n)=>{I("input.s-input",e.inputAttrs,()=>{I("type=",e.type??"text"),e.placeholder!=null&&I("placeholder=",e.placeholder),e.autocomplete!=null&&I("autocomplete=",e.autocomplete),e.value!=null&&!e.bind&&I("value=",e.value),e.input&&I("input=",e.input),e.change&&I("change=",e.change),R(e,t,n,e.bind)})})}f.insertGlobalCss({".s-backdrop":{"&":"position:fixed inset:0 z-index:200 display:block background: rgba(0,0,0,0.55); transition: opacity 0.4s ease-in-out;","&.hidden":"opacity:0 pointer-events:none"},".s-dialog":{"&":"position:fixed z-index:200 top:50% left:50% display:flex flex-direction:column transform:translate(-50%,-50%) min-width:20rem max-width:min(90vw,44rem) max-height:min(88vh,800px) border: 1px solid $s-border; r: $s-radius-lg; box-shadow: $s-shadow; overflow:hidden transition: opacity 0.2s ease-out, transform 0.2s ease-out;","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600 flex-shrink:0","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 padding: $2 $3; border-top: 1px solid $s-border; flex-shrink:0","> div":"p:$3 gap:$3 display:flex flex-direction:column overflow-y:auto flex:1 min-height:0","&.hidden":"opacity:0 pointer-events:none transform: translate(-50%, calc(-50% + 20px)); pointer-events:none"}});var H=f.proxy({}),Z=0,Se=f.derive(()=>{let e=Object.keys(H);if(e.length)return e[e.length-1]});M(()=>{f.onEach(H,({resolve:e,opts:t},n)=>{let i=()=>{delete H[n]};f.clean(()=>{t.onClose?.(),e()});let o=f.derive(()=>Se.value!=n);f("div.s-backdrop create=hidden destroy=hidden .hidden=",o,"click=",()=>{t.allowCancel!==!1&&i()}),f("div.s-dialog.s-s.panel create=hidden destroy=hidden",t.attrs,()=>{f(()=>{t.header!=null&&f("header.s-s.raised",t.headerAttrs,()=>a(t.header))}),f("div",t.contentAttrs,()=>{a(t.content,i)}),f(()=>{t.footer!=null&&f("footer.s-s.raised",t.footerAttrs,()=>a(t.footer))})})})});function j(e){Z||document.addEventListener("keydown",n=>{if(n.key==="Escape"&&e.allowCancel!==!1){let i=f.unproxy(H);for(let o=Z;o>0;o--)if(i[o]){i[o].opts.allowCancel!==!1&&delete H[o];break}}});let t=++Z;return e.cancelWithScope!==!1&&f.clean(()=>{delete H[t]}),new Promise(n=>{H[t]={resolve:n,opts:e}})}function Te(e,t={}){return j({header:"Alert",allowCancel:!0,content:n=>{f("p",()=>{f("#",e)}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"OK",click:n})}})},...t})}function Ce(e,t={}){return new Promise(n=>{let i=!1;j({header:"Confirm",allowCancel:!0,content:o=>{f("p",()=>{f("#",e)}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"Cancel",attrs:".neutral .outlined",click:o}),A({content:"OK",click:()=>{i=!0,o()}})}})},...t,onClose:()=>{n(i),t.onClose?.()}})})}function Me(e,t="",n={}){return new Promise(i=>{let o=null;j({header:"Input",allowCancel:!0,content:s=>{f("p",()=>{f("#",e)});let l=f.proxy({value:t});f("form display:contents",()=>{f("submit=",d=>{d.preventDefault(),o=l.value,s()}),X({bind:f.ref(l,"value")}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"Cancel",attrs:".neutral .outlined",type:"button",click:s}),A({content:"OK",type:"submit"})}})})},...n,onClose:()=>{i(o),n.onClose?.()}})})}import k from"aberdeen";k.insertGlobalCss({".s-select_wrap":{"&":"position:relative display:block",select:"w:100% cursor:pointer padding-right:2.2em; appearance:none","&::after":"content: '\u25BE'; position:absolute right:0.7em top:50%; transform: translateY(-50%); pointer-events:none fg:$s-fg-muted font-size:0.85em"}});function Le(e){L(e,(t,n)=>{k("div.s-select_wrap",e.inputAttrs,()=>{k("select.s-input",()=>{R(e,t,n),k("change=",i=>{e.bind&&(e.bind.value=i.target.value)}),k(()=>{let i=typeof e.options=="function"?e.options():e.options,o=e.bind?.value??"";e.placeholder!=null&&k("option",()=>{k("value= disabled=true hidden=true"),o||k("selected=true"),k("#",e.placeholder)});for(let s of i){let l=typeof s=="string"?{value:s,label:s}:{value:s.value,label:s.label??s.value};k("option",()=>{k("value=",l.value),l.value===o&&k("selected=true"),k("#",l.label)})}})})})})}import $ from"aberdeen";$.insertGlobalCss({".s-tabs":{"&":"display:flex flex-direction:column gap:$3",".s-tablist":"display:flex gap:$1 align-items:stretch overflow-x:auto scrollbar-width:none border-bottom: 1px solid $s-border;",".s-tablist::-webkit-scrollbar":"display:none",".s-tab":"display:inline-flex align-items:center gap:$2 cursor:pointer background:transparent border:0 color: $s-fg-muted; font-weight:600 padding: 0.6em 0.9em; border-bottom: 3px solid transparent; margin-bottom:-1px transition: color 0.15s, background 0.15s, border-color 0.15s;",".s-tab:hover:not(:disabled), .s-tab[aria-selected=true]":"color: $s-fg;",".s-tab:disabled":"opacity:0.5 cursor:not-allowed",".s-tab:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; r: $s-radius;",".s-tab[aria-selected=true]":"border-image: $s-gradient 1;",".s-tabpanel":"display:block"}});function Be(e){let t=C("tabs"),n=(s,l)=>s.id??String(l),i=e.bind??$.proxy(n(e.tabs[0]??{label:""},0)),o=(s,l)=>{s.disabled||(i.value=n(s,l))};$("div.s-tabs",e.attrs,()=>{$("div.s-tablist role=tablist",()=>{e.tabs.forEach((s,l)=>{let d=n(s,l);$("button.s-tab type=button role=tab",()=>{$(`id=${t}-tab-${d} aria-controls=${t}-panel-${d}`),$(()=>{let p=i.value===d;$("aria-selected=",p?"true":"false"),$("tabindex=",p?"0":"-1")}),s.disabled&&$("disabled=true"),$("click=",()=>o(s,l)),$("keydown=",p=>qe(p,e.tabs,l,o)),a(s.icon),a(s.label)})})}),$("div.s-tabpanel role=tabpanel",e.contentAttrs,()=>{$(()=>{let s=i.value,l=e.tabs.findIndex((p,U)=>n(p,U)===s),d=e.tabs[l]??e.tabs[0];d&&($(`id=${t}-panel-${n(d,l)} aria-labelledby=${t}-tab-${n(d,l)}`),a(d.content))})})})}function qe(e,t,n,i){let o=n;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=(n+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=(n-1+t.length)%t.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=t.length-1;else return;e.preventDefault();let s=o>=n?1:-1;for(let l=0;l<t.length;l++){let d=t[o];if(d&&!d.disabled){i(d,o),e.currentTarget?.parentElement?.children[o]?.focus();return}o=(o+s+t.length)%t.length}}import E from"aberdeen";E.insertGlobalCss({"textarea.s-input":"resize:vertical min-height:3em line-height:1.45","textarea.s-input.s-autoGrow":"resize:none min-height:2.5em overflow-y:hidden"});function ze(e={}){let t=e.autoGrow!==!1;L(e,(n,i)=>{let o=E("textarea.s-input",e.inputAttrs,()=>{t?(E(".s-autoGrow"),E("input=",s=>{ae(s.currentTarget),e.input&&e.input(s)})):(E("rows=",e.rows??4),E("resize:",e.resize??"vertical"),e.input&&E("input=",e.input)),e.placeholder!=null&&E("placeholder=",e.placeholder),e.value!=null&&!e.bind&&E("value=",e.value),e.change&&E("change=",e.change),R(e,n,i,e.bind)});t&&requestAnimationFrame(()=>ae(o))})}function ae(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}import w from"aberdeen";import{grow as Fe,shrink as De}from"aberdeen/transitions";w.insertGlobalCss({".s-toasts":"position:fixed bottom:$3 right:$3 z-index:400 display:flex flex-direction:column gap:$2 pointer-events:none max-width:min(90vw,24rem) w:24rem",".s-toast":{"&":"display:flex align-items:flex-start gap:$2 padding: $3; border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow pointer-events:auto",".s-toast-body":"display:flex flex-direction:column gap:$1 flex:1 min-width:0",".s-toast-title":"font-weight:700 line-height:1.3",".s-toast-msg":"font-size:0.9em fg:$s-fg-muted line-height:1.4",".s-toast-close":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.15em; r:4px flex-shrink:0 align-self:flex-start",".s-toast-close:hover":"fg:$s-fg",".s-toast-close:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; fg:$s-fg"}});var Ge=0,W=w.proxy({});M(()=>{w.isEmpty(W)||w("div.s-toasts aria-live=polite aria-atomic=false",()=>{w.onEach(W,e=>{let{opts:t}=e,n=t.type==="danger"||t.type==="warning"?"alert":"status",i=t.type??"neutral";w(`div.s-toast.s-s.${i} role=${n}`,"create=",Fe,"destroy=",De,t.attrs,()=>{w("div.s-toast-body",()=>{w(()=>{t.title!=null&&w("div.s-toast-title",()=>a(t.title))}),w("div.s-toast-msg",()=>a(t.message))}),w(()=>{t.dismissible!==!1&&w("button.s-toast-close type=button aria-label=Dismiss",()=>{w("#\xD7"),w("click=",()=>ee(e.id))})})})})})});function ee(e){delete W[e]}function Ie(e){let t=++Ge;W[t]={id:t,opts:e};let n=e.duration??4e3,i;return n>0&&(i=setTimeout(()=>ee(t),n)),()=>{i!=null&&clearTimeout(i),ee(t)}}import S from"aberdeen";S.insertGlobalCss({".s-tt-tip":{"&":"position:fixed z-index:500 max-width:20rem w:max-content bg:$s-raised fg:$s-fg border: 1px solid $s-border-strong; r:$s-radius box-shadow:$s-shadow padding: 0.3em 0.65em; font-size:0.85em line-height:1.4 pointer-events:none"}});var K=S.proxy(void 0),T=null;typeof window<"u"&&window.addEventListener("scroll",()=>{K.value=void 0},{capture:!0,passive:!0});function He(e,t,n,i){let s=window.innerWidth,l=window.innerHeight,d=0,p=0;return i==="bottom"?(d=e.left+(e.width-t)/2,p=e.bottom+7,p+n>l-8&&(p=e.top-n-7)):i==="left"?(d=e.left-t-7,p=e.top+(e.height-n)/2,d<8&&(d=e.right+7)):i==="right"?(d=e.right+7,p=e.top+(e.height-n)/2,d+t>s-8&&(d=e.left-t-7)):(d=e.left+(e.width-t)/2,p=e.top-n-7,p<8&&(p=e.bottom+7)),{x:Math.max(8,Math.min(d,s-t-8)),y:Math.max(8,Math.min(p,l-n-8))}}function te(){T&&clearTimeout(T),T=setTimeout(()=>{K.value=void 0,T=null},100)}M(()=>{let e=K.value;if(!e)return;let{opts:t,anchor:n}=e,i=t.placement??"top",o=S("div.s-tt-tip role=tooltip visibility:hidden",t.attrs,()=>{S("mouseenter=",()=>{T&&(clearTimeout(T),T=null)}),S("mouseleave=",te),a(t.tip)});requestAnimationFrame(()=>{if(!document.body.contains(o))return;let{x:s,y:l}=He(n.getBoundingClientRect(),o.offsetWidth,o.offsetHeight,i);o.style.left=s+"px",o.style.top=l+"px",o.style.visibility=""})});function Pe(e){let t=n=>{T&&(clearTimeout(T),T=null),K.value={opts:e,anchor:n.currentTarget}};S("mouseenter=",t),S("mouseleave=",te),S("focusin=",t),S("focusout=",te),S.clean(()=>{K.value?.opts===e&&(K.value=void 0)})}export{ke as addContextMenu,Pe as addTooltip,Te as alert,be as autocomplete,ge as box,A as button,xe as buttonChooser,z as buttonGroup,ve as checkbox,Ce as confirm,j as dialog,ye as form,ie as getDarkMode,Ae as main,Q as menuButton,Me as prompt,Le as select,ue as setDarkMode,J as showFloatingMenu,Be as tabs,ze as textarea,X as textline,Ie as toast};
|
package/package.json
CHANGED
|
@@ -64,11 +64,18 @@ function normOption(o: AutocompleteOptionInput): AcOption {
|
|
|
64
64
|
* @example
|
|
65
65
|
* ```ts
|
|
66
66
|
* // Single select from a fixed list
|
|
67
|
+
* const $sel = A.proxy("Netherlands");
|
|
67
68
|
* S.autocomplete({ label: "Country", options: ["Belgium", "Netherlands"], bind: $sel });
|
|
68
69
|
*
|
|
69
70
|
* // Multi-select, disallowing custom items
|
|
70
|
-
*
|
|
71
|
-
*
|
|
71
|
+
* const $tags = A.proxy([] as string[]);
|
|
72
|
+
* S.autocomplete({
|
|
73
|
+
* label: "Tags",
|
|
74
|
+
* multi: true,
|
|
75
|
+
* allowCustom: true,
|
|
76
|
+
* options: ["Rust", "JS", "C++", "Klingon", "Go"],
|
|
77
|
+
* bind: A.ref($tags)
|
|
78
|
+
* });
|
|
72
79
|
* ```
|
|
73
80
|
*/
|
|
74
81
|
export function autocomplete(opts: AutocompleteOptions): void {
|
package/src/components/box.ts
CHANGED
|
@@ -41,6 +41,7 @@ A.insertGlobalCss({
|
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```ts
|
|
44
|
+
* const $user = A.proxy({name: "Kvothe"});
|
|
44
45
|
* S.box({ header: "Profile", contentAttrs: "display:flex flex-direction:column", content: () => {
|
|
45
46
|
* S.textline({ label: "Name", bind: A.ref($user, "name") });
|
|
46
47
|
* }});
|
package/src/components/button.ts
CHANGED
|
@@ -41,10 +41,9 @@ A.insertGlobalCss({
|
|
|
41
41
|
"transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s, transform 0.08s;",
|
|
42
42
|
"&:focus-visible": "outline:none box-shadow: 0 0 0 3px $s-focus;",
|
|
43
43
|
"&:disabled, &[aria-disabled=true]": "opacity:0.45 cursor:not-allowed pointer-events:none filter:saturate(0.6)",
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
"&:hover": "filter: brightness(1.08); transform: translateY(-1px)",
|
|
44
|
+
// Hover feedback is colour-only (no movement). The filled `.gradient` CTA
|
|
45
|
+
// below layers a deeper shadow on top, so it still reads as the signature action.
|
|
46
|
+
"&:hover": "filter: brightness(1.08)",
|
|
48
47
|
"&.tonal:hover, &.outlined:hover": "background: color-mix(in srgb, $s-b 26%, transparent);",
|
|
49
48
|
// A filled `.gradient` button (the default) is the app's signature call to
|
|
50
49
|
// action: a borderless gradient with a hairline top highlight (a hint of
|
|
@@ -57,7 +56,7 @@ A.insertGlobalCss({
|
|
|
57
56
|
"&.gradient:not(.tonal):not(.outlined)":
|
|
58
57
|
"border:0 box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;",
|
|
59
58
|
"&.gradient:not(.tonal):not(.outlined):hover":
|
|
60
|
-
"filter: brightness(1.05); box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), 0 7px 18px color-mix(in srgb, $s-primary 34%, transparent);
|
|
59
|
+
"filter: brightness(1.05); box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), 0 7px 18px color-mix(in srgb, $s-primary 34%, transparent);",
|
|
61
60
|
// Subtle press feedback.
|
|
62
61
|
"&:active:not(:disabled):not([aria-disabled=true])": "transform: translateY(1px)",
|
|
63
62
|
// Size: set on the button itself, or inherited from a `.small`/`.large`
|
|
@@ -81,6 +80,7 @@ const ROLE_CLASS = /\.(gradient|primary|secondary|neutral|danger|success|warning
|
|
|
81
80
|
* **Tip:** pair `href` with Aberdeen's `interceptLinks()` (called once at app
|
|
82
81
|
* startup) for SPA-style navigation without manual click handlers:
|
|
83
82
|
* ```ts
|
|
83
|
+
* import {interceptLinks} from from "aberdeen/route";
|
|
84
84
|
* interceptLinks(); // once at root
|
|
85
85
|
* S.button({ href: "/dashboard", content: "Dashboard" }); // navigates via router
|
|
86
86
|
* ```
|
|
@@ -40,13 +40,15 @@ A.insertGlobalCss({
|
|
|
40
40
|
/**
|
|
41
41
|
* Groups related buttons, either as a joined segmented control (`attached`) or
|
|
42
42
|
* spaced out. A `role=group` is applied for assistive tech.
|
|
43
|
+
*
|
|
44
|
+
* If you want a single button to be *selected*, use {@link buttonChooser}.
|
|
43
45
|
*
|
|
44
46
|
* @example
|
|
45
47
|
* ```ts
|
|
46
48
|
* S.buttonGroup({ buttons: [
|
|
47
|
-
* {
|
|
48
|
-
* {
|
|
49
|
-
* {
|
|
49
|
+
* { content: "Day", attrs: ".neutral .outlined" },
|
|
50
|
+
* { content: "Week", attrs: ".neutral .outlined" },
|
|
51
|
+
* { content: "Month", attrs: ".neutral .outlined" },
|
|
50
52
|
* ]});
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
package/src/components/dialog.ts
CHANGED
|
@@ -128,7 +128,7 @@ mountPortal(() => {
|
|
|
128
128
|
* header: "Confirm",
|
|
129
129
|
* content: (close) => {
|
|
130
130
|
* A("p #Are you sure?");
|
|
131
|
-
* S.button({ content: "Yes", click: () => {
|
|
131
|
+
* S.button({ content: "Yes", click: () => { S.alert("Nice!"); close(); } });
|
|
132
132
|
* S.button({ content: "Cancel", attrs: ".neutral .outlined", click: close });
|
|
133
133
|
* },
|
|
134
134
|
* });
|
|
@@ -189,7 +189,7 @@ export function alert(message: string, opts: Partial<DialogOptions> = {}): Promi
|
|
|
189
189
|
*
|
|
190
190
|
* @example
|
|
191
191
|
* ```ts
|
|
192
|
-
* if (await S.confirm("Delete this item?"))
|
|
192
|
+
* if (await S.confirm("Delete this item?")) S.alert("Gone!");
|
|
193
193
|
* ```
|
|
194
194
|
*/
|
|
195
195
|
export function confirm(message: string, opts: Partial<DialogOptions> = {}): Promise<boolean> {
|
|
@@ -221,7 +221,7 @@ export function confirm(message: string, opts: Partial<DialogOptions> = {}): Pro
|
|
|
221
221
|
* @example
|
|
222
222
|
* ```ts
|
|
223
223
|
* const name = await S.prompt("Enter your name:", "Alice");
|
|
224
|
-
* if (name !== null)
|
|
224
|
+
* if (name !== null) S.alert(`Hi ${name}!`);
|
|
225
225
|
* ```
|
|
226
226
|
*/
|
|
227
227
|
export function prompt(message: string, defaultValue = "", opts: Partial<DialogOptions> = {}): Promise<string | null> {
|
package/src/components/form.ts
CHANGED
|
@@ -41,11 +41,12 @@ A.insertGlobalCss({
|
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```ts
|
|
44
|
+
* const $user = A.proxy({name: "Darth", email: "d.vader@example.com"});
|
|
44
45
|
* S.form({
|
|
45
46
|
* submit: () => save(),
|
|
46
47
|
* content: () => {
|
|
47
|
-
* S.textline({ label: "Name", required: true, bind: A.ref($
|
|
48
|
-
* S.textline({ label: "Email", type: "email", bind: A.ref($
|
|
48
|
+
* S.textline({ label: "Name", required: true, bind: A.ref($user, "name") });
|
|
49
|
+
* S.textline({ label: "Email", type: "email", bind: A.ref($user, "email") });
|
|
49
50
|
* },
|
|
50
51
|
* actions: () => S.button({ content: "Save", type: "submit" }),
|
|
51
52
|
* });
|
package/src/components/main.ts
CHANGED
|
@@ -137,9 +137,13 @@ A.insertGlobalCss({
|
|
|
137
137
|
* },
|
|
138
138
|
* navPosition: "left",
|
|
139
139
|
* menu: () => S.button({ content: "New", attrs: ".small" }),
|
|
140
|
-
* content:
|
|
140
|
+
* content: drawPage,
|
|
141
141
|
* footer: "© 2026",
|
|
142
142
|
* });
|
|
143
|
+
*
|
|
144
|
+
* function drawPage() {
|
|
145
|
+
* S.box({title: "Hello world", content: "Here's you app.."});
|
|
146
|
+
* }
|
|
143
147
|
* ```
|
|
144
148
|
*/
|
|
145
149
|
export function main(opts: MainOptions = {}): void {
|
package/src/components/menu.ts
CHANGED
|
@@ -72,6 +72,10 @@ export interface FloatingMenuOptions {
|
|
|
72
72
|
dropdownAttrs?: Attributes;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/** Options for {@link addContextMenu} — like {@link FloatingMenuOptions}, but
|
|
76
|
+
* the anchor is the element the handler is attached to. */
|
|
77
|
+
export type ContextMenuOptions = Omit<FloatingMenuOptions, "anchor">;
|
|
78
|
+
|
|
75
79
|
// Styles shared by the floating dropdown and the sidebar nav, so both look
|
|
76
80
|
// identical. The item styles aren't scoped to a container, so `drawMenu` can
|
|
77
81
|
// render its items into either one.
|
|
@@ -235,12 +239,21 @@ mountPortal(() => {
|
|
|
235
239
|
* no room below), and closes on Escape, Tab, item selection, or any click
|
|
236
240
|
* outside the panel and anchor. Returns a `close()` function.
|
|
237
241
|
*
|
|
242
|
+
* Menus are usually opened through {@link menuButton} or
|
|
243
|
+
* {@link addContextMenu}; reach for this primitive when you need to trigger a
|
|
244
|
+
* menu from some other event, anchored to an arbitrary element.
|
|
245
|
+
*
|
|
238
246
|
* @example
|
|
239
247
|
* ```ts
|
|
240
|
-
* //
|
|
241
|
-
*
|
|
242
|
-
* e
|
|
243
|
-
*
|
|
248
|
+
* // An @-mention picker: typing "@" in the input pops up a user menu.
|
|
249
|
+
* A("input placeholder=Comment…", () => {
|
|
250
|
+
* A("keydown=", (e: KeyboardEvent) => {
|
|
251
|
+
* if (e.key !== "@") return;
|
|
252
|
+
* S.showFloatingMenu({
|
|
253
|
+
* anchor: e.currentTarget as HTMLElement,
|
|
254
|
+
* items: users.map((u) => ({ label: u.name, click: () => mention(u) })),
|
|
255
|
+
* });
|
|
256
|
+
* });
|
|
244
257
|
* });
|
|
245
258
|
* ```
|
|
246
259
|
*/
|
|
@@ -249,6 +262,38 @@ export function showFloatingMenu(opts: FloatingMenuOptions): () => void {
|
|
|
249
262
|
return closeFloating;
|
|
250
263
|
}
|
|
251
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Attaches a context menu to the current element: adds a `contextmenu` handler
|
|
267
|
+
* via {@link A} so a {@link showFloatingMenu | floating menu} opens (instead of
|
|
268
|
+
* the browser's own menu) on right-click or long-press. The menu is anchored to
|
|
269
|
+
* the element and closes on Escape, Tab, item selection, or any click outside.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* import * as icons from "staffa/icons";
|
|
274
|
+
*
|
|
275
|
+
* S.box(() => {
|
|
276
|
+
* A("#Right-click / long-tap me!");
|
|
277
|
+
* S.addContextMenu({
|
|
278
|
+
* items: [
|
|
279
|
+
* { label: "AI something", icon: icons.sparkles, click: () => ai() },
|
|
280
|
+
* { label: "Launch missiles", icon: icons.rocket, click: () => launch() },
|
|
281
|
+
* ],
|
|
282
|
+
* });
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
export function addContextMenu(opts: ContextMenuOptions): void {
|
|
287
|
+
let myEl: HTMLElement | null = null;
|
|
288
|
+
A.clean(() => { if ($floating.opts?.anchor === myEl) closeFloating(); });
|
|
289
|
+
|
|
290
|
+
A("contextmenu=", (e: Event) => {
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
myEl = e.currentTarget as HTMLElement;
|
|
293
|
+
showFloatingMenu({ items: opts.items, anchor: myEl, dropdownAttrs: opts.dropdownAttrs });
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
252
297
|
/**
|
|
253
298
|
* A button that opens a {@link showFloatingMenu | floating dropdown menu} on
|
|
254
299
|
* click. Keyboard navigation: Arrow Up/Down, Home, End; Escape/Tab to close;
|
|
@@ -260,7 +305,7 @@ export function showFloatingMenu(opts: FloatingMenuOptions): () => void {
|
|
|
260
305
|
* @example
|
|
261
306
|
* ```ts
|
|
262
307
|
* S.menuButton({
|
|
263
|
-
* button: {
|
|
308
|
+
* button: { content: "Actions", attrs: ".neutral .outlined" },
|
|
264
309
|
* items: [
|
|
265
310
|
* { label: "Edit", icon: () => A("#✎"), click: () => edit() },
|
|
266
311
|
* { separator: true },
|
package/src/components/tabs.ts
CHANGED
|
@@ -55,8 +55,8 @@ A.insertGlobalCss({
|
|
|
55
55
|
* @example
|
|
56
56
|
* ```ts
|
|
57
57
|
* S.tabs({ tabs: [
|
|
58
|
-
* { label: "Overview", content: () => A("p
|
|
59
|
-
* { label: "Settings", content: () =>
|
|
58
|
+
* { label: "Overview", content: () => A("p#Let me give you an overview..") },
|
|
59
|
+
* { label: "Settings", content: () => S.checkbox({label: "I agree to anything", checked: true}) },
|
|
60
60
|
* ]});
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
@@ -29,11 +29,12 @@ A.insertGlobalCss({
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* A multi-line text input. Shares the field chrome and styling of
|
|
32
|
-
* {@link textline}
|
|
32
|
+
* {@link textline}.
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* ```ts
|
|
36
|
-
*
|
|
36
|
+
* const $user = A.proxy({bio: ""});
|
|
37
|
+
* S.textarea({ label: "Bio", bind: A.ref($user, "bio") });
|
|
37
38
|
* ```
|
|
38
39
|
*/
|
|
39
40
|
export function textarea(opts: TextareaOptions = {}): void {
|