staffa 0.4.3 → 0.5.0

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 CHANGED
@@ -179,7 +179,8 @@ Staffa ships the full [Lucide icon set](https://lucide.dev/icons/) as named expo
179
179
  Each icon is a draw function usable anywhere a slot is accepted (e.g. a button `icon`), or called directly. Customize per call, or globally via `setDefaults()`:
180
180
 
181
181
  ```ts
182
- import { sparkles, bell } from "staffa/icons.js";
182
+ import * as S from "staffa";
183
+ import { sparkles, bell } from "staffa/icons";
183
184
  S.button({ content: "Save", icon: bell });
184
185
  sparkles({ size: "1.5em", color: "var(--s-primary)", strokeWidth: 1.5 });
185
186
  ```
@@ -280,6 +281,10 @@ ln -s ../../node_modules/staffa/skill .claude/skills/staffa
280
281
 
281
282
  ## Breaking changes
282
283
 
284
+ - **0.5**
285
+ - Surfaces (`.s-s`) now apply `border-radius` and — for `.tonal` and `.outlined` variants — `border` automatically. Custom surfaces or components that previously set these manually may see doubled or conflicting styles; remove the manual declarations.
286
+ - `border:0` is now applied to `.s-btn` by default (overriding the browser's 2px button border). Custom button-like components built on `.s-btn` that relied on the browser default border should add an explicit border.
287
+
283
288
  - **0.4**
284
289
  - There is no default export anymore: replace `import S from "staffa"` with `import * as S from "staffa"`.
285
290
  - `S.button` no longer has a `text` option: use `content` instead (it accepts a string or a draw function).
@@ -38,11 +38,11 @@ export interface AutocompleteOptions extends FieldOptions {
38
38
  * S.autocomplete({ label: "Country", options: ["Belgium", "Netherlands"], bind: $sel });
39
39
  *
40
40
  * // Multi-select, disallowing custom items
41
- * const $tags = A.proxy([] as string[]);
41
+ * const $tags = A.proxy({value: [] as string[]});
42
42
  * S.autocomplete({
43
43
  * label: "Tags",
44
44
  * multi: true,
45
- * allowCustom: true,
45
+ * allowCustom: false,
46
46
  * options: ["Rust", "JS", "C++", "Klingon", "Go"],
47
47
  * bind: A.ref($tags)
48
48
  * });
@@ -35,11 +35,11 @@ function normOption(o) {
35
35
  * S.autocomplete({ label: "Country", options: ["Belgium", "Netherlands"], bind: $sel });
36
36
  *
37
37
  * // Multi-select, disallowing custom items
38
- * const $tags = A.proxy([] as string[]);
38
+ * const $tags = A.proxy({value: [] as string[]});
39
39
  * S.autocomplete({
40
40
  * label: "Tags",
41
41
  * multi: true,
42
- * allowCustom: true,
42
+ * allowCustom: false,
43
43
  * options: ["Rust", "JS", "C++", "Klingon", "Go"],
44
44
  * bind: A.ref($tags)
45
45
  * });
@@ -27,8 +27,8 @@ export interface ButtonOptions {
27
27
  attrs?: Attributes;
28
28
  }
29
29
  /**
30
- * A button. Always carries at least a visible border so its affordance is
31
- * obvious at a glance.
30
+ * A button. Tonal and outlined variants show a border; filled variants rely on
31
+ * their solid background for affordance.
32
32
  *
33
33
  * Shortcut: pass a string to use it as the label, or a function for custom
34
34
  * content.
@@ -43,7 +43,7 @@ export interface ButtonOptions {
43
43
  *
44
44
  * @example
45
45
  * ```ts
46
- * S.button({ content: "Save", click: save });
46
+ * S.button({ content: "Save", click: S.alert("Saved.") });
47
47
  * S.button({ content: "Delete", attrs: ".danger .outlined", click: del });
48
48
  * S.button("Cancel"); // shorthand for { content: "Cancel" }
49
49
  * S.button({ href: "/docs", content: "Docs" }); // renders an <a role=button>
@@ -1,13 +1,13 @@
1
1
  import A from "aberdeen";
2
2
  import { drawSlot } from "../core.js";
3
3
  // The button is a `.s-s` surface (defaulting to `.primary` in button() below), so
4
- // its colours come from the surface classes in theme.ts. This rule only handles
5
- // layout, border, focus, hover and sizing.
4
+ // its colours, border, and border-radius come from the surface classes in theme.ts.
5
+ // This rule only handles layout, focus, hover and sizing.
6
6
  A.insertGlobalCss({
7
7
  ".s-btn": {
8
8
  "&": "display:inline-flex align-items:center justify-content:center gap:$2 " +
9
9
  "font-weight:600 line-height:1.2 white-space:nowrap cursor:pointer text-decoration:none " +
10
- "border: 1px solid $s-border; r: $s-radius; padding: 0.5em 1em; " +
10
+ "border:0 padding: 0.5em 1em; " +
11
11
  "transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s, transform 0.08s;",
12
12
  "&:focus-visible": "outline:none box-shadow: 0 0 0 3px $s-focus;",
13
13
  "&:disabled, &[aria-disabled=true]": "opacity:0.45 cursor:not-allowed pointer-events:none filter:saturate(0.6)",
@@ -23,7 +23,7 @@ A.insertGlobalCss({
23
23
  // the border (rather than making it transparent) also sidesteps a Chromium
24
24
  // artifact where a gradient clipped to a transparent rounded border fringes
25
25
  // the edge with the gradient's far colour.
26
- "&.gradient:not(.tonal):not(.outlined)": "border:0 box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;",
26
+ "&.gradient:not(.tonal):not(.outlined)": "box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;",
27
27
  "&.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);",
28
28
  // Subtle press feedback.
29
29
  "&:active:not(:disabled):not([aria-disabled=true])": "transform: translateY(1px)",
@@ -37,8 +37,8 @@ A.insertGlobalCss({
37
37
  // the default `.gradient` base so the two roles don't stack on one element.
38
38
  const ROLE_CLASS = /\.(gradient|primary|secondary|neutral|danger|success|warning|base|panel|raised)(\.|\s|$)/;
39
39
  /**
40
- * A button. Always carries at least a visible border so its affordance is
41
- * obvious at a glance.
40
+ * A button. Tonal and outlined variants show a border; filled variants rely on
41
+ * their solid background for affordance.
42
42
  *
43
43
  * Shortcut: pass a string to use it as the label, or a function for custom
44
44
  * content.
@@ -53,7 +53,7 @@ const ROLE_CLASS = /\.(gradient|primary|secondary|neutral|danger|success|warning
53
53
  *
54
54
  * @example
55
55
  * ```ts
56
- * S.button({ content: "Save", click: save });
56
+ * S.button({ content: "Save", click: S.alert("Saved.") });
57
57
  * S.button({ content: "Delete", attrs: ".danger .outlined", click: del });
58
58
  * S.button("Cancel"); // shorthand for { content: "Cancel" }
59
59
  * S.button({ href: "/docs", content: "Docs" }); // renders an <a role=button>
@@ -95,12 +95,13 @@ export declare function drawMenu(items: MenuEntry[], onActivate?: () => void): v
95
95
  * @example
96
96
  * ```ts
97
97
  * // An @-mention picker: typing "@" in the input pops up a user menu.
98
+ * const users = ['Alice', 'Bob', 'Charlie', 'Dutley']
98
99
  * A("input placeholder=Comment…", () => {
99
100
  * A("keydown=", (e: KeyboardEvent) => {
100
101
  * if (e.key !== "@") return;
101
102
  * S.showFloatingMenu({
102
103
  * anchor: e.currentTarget as HTMLElement,
103
- * items: users.map((u) => ({ label: u.name, click: () => mention(u) })),
104
+ * items: users.map((u) => ({ label: u, click: () => S.alert(`Mentioned ${u}!`) })),
104
105
  * });
105
106
  * });
106
107
  * });
@@ -170,12 +170,13 @@ mountPortal(() => {
170
170
  * @example
171
171
  * ```ts
172
172
  * // An @-mention picker: typing "@" in the input pops up a user menu.
173
+ * const users = ['Alice', 'Bob', 'Charlie', 'Dutley']
173
174
  * A("input placeholder=Comment…", () => {
174
175
  * A("keydown=", (e: KeyboardEvent) => {
175
176
  * if (e.key !== "@") return;
176
177
  * S.showFloatingMenu({
177
178
  * anchor: e.currentTarget as HTMLElement,
178
- * items: users.map((u) => ({ label: u.name, click: () => mention(u) })),
179
+ * items: users.map((u) => ({ label: u, click: () => S.alert(`Mentioned ${u}!`) })),
179
180
  * });
180
181
  * });
181
182
  * });
@@ -21,6 +21,7 @@ export interface SelectOptions extends FieldOptions {
21
21
  *
22
22
  * @example
23
23
  * ```ts
24
+ * const $sel = A.proxy("Netherlands");
24
25
  * S.select({ label: "Country", options: ["Belgium", "Netherlands"], bind: $sel });
25
26
  * ```
26
27
  */
@@ -15,6 +15,7 @@ A.insertGlobalCss({
15
15
  *
16
16
  * @example
17
17
  * ```ts
18
+ * const $sel = A.proxy("Netherlands");
18
19
  * S.select({ label: "Country", options: ["Belgium", "Netherlands"], bind: $sel });
19
20
  * ```
20
21
  */
@@ -34,6 +34,10 @@ export function tabs(opts) {
34
34
  const keyOf = (tab, index) => tab.id ?? String(index);
35
35
  // Selection state: caller-provided binding, or internal.
36
36
  const $sel = opts.bind ?? A.proxy(keyOf(opts.tabs[0] ?? { label: "" }, 0));
37
+ // If the current value isn't a valid tab key, reset to the first tab.
38
+ if (opts.tabs.length > 0 && !opts.tabs.some((t, i) => keyOf(t, i) === A.peek(() => $sel.value))) {
39
+ $sel.value = keyOf(opts.tabs[0], 0);
40
+ }
37
41
  const select = (tab, index) => {
38
42
  if (tab.disabled)
39
43
  return;
@@ -25,8 +25,10 @@ export interface TooltipOptions {
25
25
  * S.addTooltip({ tip: "Saves your work to the cloud" });
26
26
  * });
27
27
  *
28
+ * A(" ");
29
+ *
28
30
  * S.button(() => {
29
- * A(".danger#Delete");
31
+ * A(".danger #Delete");
30
32
  * S.addTooltip({ tip: "Dangerous — cannot be undone", placement: "bottom" });
31
33
  * });
32
34
  * ```
@@ -107,8 +107,10 @@ mountPortal(() => {
107
107
  * S.addTooltip({ tip: "Saves your work to the cloud" });
108
108
  * });
109
109
  *
110
+ * A(" ");
111
+ *
110
112
  * S.button(() => {
111
- * A(".danger#Delete");
113
+ * A(".danger #Delete");
112
114
  * S.addTooltip({ tip: "Dangerous — cannot be undone", placement: "bottom" });
113
115
  * });
114
116
  * ```
@@ -1 +1 @@
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};
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 r:$s-radius",".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); border: 1px solid $s-border;",".s-s.outlined":"--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg); border: 1px solid $s-border;",".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",[["primary","secondary","gradient","danger","success","warning"].flatMap(e=>[`.s-s.${e} .s-s.tonal`,`.s-s.${e} .s-s.outlined`]).join(", ")]:"--s-bg: $s-panel; background: $s-panel;"});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 s from"aberdeen";import re from"aberdeen";var fe=0;function C(e="s"){return`${e}-${++fe}`}function l(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"),o=()=>!!e.error;h("div.s-field",e.attrs,()=>{h(()=>{e.label!=null&&h(`label for=${n}`,()=>{l(e.label),e.required&&h("span.s-req aria-hidden=true #*")})}),t(n,o),h(()=>{e.help!=null&&!e.error&&h("div.s-help",()=>l(e.help))}),h(()=>{e.error&&h("div.s-error role=alert #",e.error)})})}function R(e,t,n,o){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")),o&&h("bind=",o)}s.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=s.proxy({query:"",open:!1,active:0}),o=()=>(typeof e.options=="function"?e.options():e.options).map(me),i=()=>{let c=e.bind?.value;return c==null||c===""?[]:Array.isArray(c)?c:[c]},r=c=>o().find(v=>v.value===c)?.label??c;if(!e.multi){let c=e.bind?s.peek(e.bind,"value"):void 0;typeof c=="string"&&c&&(n.query=s.peek(()=>r(c)))}let a=()=>{let c=new Set(i()),v=o();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=r(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)=>{s("div.s-ac",e.inputAttrs,()=>{s(()=>s("aria-invalid=",v()?"true":"false"));let b;s("div.s-control",()=>{s("click=",()=>b?.focus()),s(()=>{if(e.multi)for(let g of i())s("span.s-chip",()=>{s("span #",s.peek(()=>r(g))),s("button type=button aria-label=",`Remove ${g}`,()=>{s("#\xD7"),s("click=",$=>{$.stopPropagation(),p(g),b?.focus()})})})}),b=s("input type=text role=combobox autocomplete=off",()=>{s(`id=${c} aria-controls=${t} aria-autocomplete=list`),e.placeholder!=null&&s("placeholder=",e.placeholder),e.disabled&&s("disabled=true"),e.required&&s("aria-required=true"),s("bind=",s.ref(n,"query")),s(()=>s("aria-expanded=",n.open?"true":"false")),s(()=>{let $=a()[n.active];s("aria-activedescendant=",n.open&&$?`${t}-opt-${n.active}`:"")}),s("input=",()=>{n.open=!0,n.active=0}),s("focus=",()=>{n.open=!0}),s("blur=",()=>{setTimeout(()=>le(),150)}),s("keydown=",g=>U(g,b))})}),s(()=>{if(!n.open)return;let g=a(),$=n.query.trim(),ne=e.allowCustom!==!1&&$!==""&&!g.some(P=>P.label.toLowerCase()===$.toLowerCase());s("ul.s-menu role=listbox",`id=${t}`,()=>{g.forEach((P,Y)=>{s("li.s-option role=option",`id=${t}-opt-${Y}`,()=>{s(()=>s("aria-selected=",n.active===Y?"true":"false")),s("#",P.label),s("mousedown=",de=>de.preventDefault()),s("click=",()=>d(P.value,b)),s("mousemove=",()=>{n.active=Y})})}),ne&&s("li.s-option.s-add role=option",()=>{s("#",`Add "${$}"`),s("mousedown=",P=>P.preventDefault()),s("click=",()=>d($,b))}),g.length===0&&!ne&&s("li.s-empty #No matches")})}),s(()=>{if(e.name)if(e.multi)for(let g of i())s("input type=hidden",()=>{s("name=",e.name),s("value=",g)});else s("input type=hidden",()=>{s("name=",e.name),s("value=",i()[0]??"")})})})});function U(c,v){let b=a(),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 $=b[n.active];$?d($.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=r(i()[0]??""));else if(c.key==="Backspace"&&e.multi&&n.query===""){let $=i();$.length&&p($[$.length-1])}}function le(){n.open=!1,e.multi?n.query="":e.allowCustom!==!1&&n.query.trim()?d(n.query.trim()):n.query=r(i()[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,()=>l(t.header))}),q("div",t.contentAttrs,()=>{l(t.content)}),q(()=>{t.footer!=null&&q("footer.s-s.raised",t.footerAttrs,()=>l(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:0 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)":"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",o=t.attrs&&he.test(t.attrs)?"":".gradient";B(`${n}.s-btn.s-s${o}`,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),l(t.icon),l(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 o of e.buttons)A(o);l(e.content)})}function xe(e){N(()=>{let t=e.bind.value;z({attrs:e.attrs,buttons:Object.entries(e.options).map(([n,o])=>({content:o,ariaLabel:typeof o=="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&&l(e.label),e.required&&m("span.s-req aria-hidden=true #*")})}),m(()=>{e.help!=null&&!e.error&&m("div.s-help",()=>l(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 o=new FormData(n.target),i={};for(let r of new Set(o.keys())){let a=o.getAll(r);i[r]=a.length===1?a[0]:a}t.submit(i,n)}}),l(t.content),F(()=>{t.actions&&F("footer",t.actionsAttrs,()=>l(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 i=[...n.currentTarget.querySelectorAll(".s-menu-item, .s-menu-item-link")].filter(p=>p.getAttribute("aria-disabled")!=="true");if(!i.length)return;let r=i.indexOf(document.activeElement),a=n.key==="ArrowUp"?-1:1,d=n.key==="Home"?0:n.key==="End"?i.length-1:r<0?a>0?0:i.length-1:(r+a+i.length)%i.length;i[d].focus()});for(let n of e){if(typeof n=="string"||typeof n=="function"){l(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=",o=>{if(n.disabled){o.preventDefault();return}t?.(),n.click?.(o)}),n.icon&&x("span.s-menu-icon",()=>l(n.icon)),l(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,o=e.offsetHeight,i=window.innerWidth,r=window.innerHeight,a=4,d=t.left;d+n>i-8&&(d=Math.max(8,t.right-n));let p=t.bottom+a;p+o>r-8&&t.top-o-a>=8&&(p=t.top-o-a),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=i=>{let r=i.target;!t.contains(r)&&!e.anchor.contains(r)&&D()},o=i=>{(i.key==="Escape"||i.key==="Tab")&&(i.preventDefault(),D())};document.addEventListener("click",n,!0),document.addEventListener("keydown",o,!0),x.clean(()=>{document.removeEventListener("click",n,!0),document.removeEventListener("keydown",o,!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",o=t!=null&&t.items.length>0,i=o?n==="button"?".s-nav-btn-only":`.s-nav-${n}`:"";u(`div.s-main.s-s.base${i}`,e.attrs,()=>{u(()=>{(e.title!=null||e.subtitle!=null||e.icon!=null||e.menu!=null||o)&&u("header.s-s.raised",e.topbarAttrs,()=>{u("div.s-bar",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),u(()=>{o&&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",()=>l(e.icon))}),u("div.s-titles",()=>{u(()=>{e.title!=null&&u("div.s-title",()=>l(e.title))}),u(()=>{e.subtitle!=null&&u("div.s-subtitle",()=>l(e.subtitle))})}),u(()=>{e.menu&&u("div.s-menu",()=>l(e.menu))})})})}),u("div.s-body",()=>{u("div.s-body-inner",()=>{u(()=>{e.maxWidth!=null&&u("max-width:",e.maxWidth)}),o&&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)}),l(e.footer)})})})})}function Oe(e){let t=u("main",()=>{u("div.s-content",e.contentAttrs,()=>{l(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 o=()=>{delete H[n]};f.clean(()=>{t.onClose?.(),e()});let i=f.derive(()=>Se.value!=n);f("div.s-backdrop create=hidden destroy=hidden .hidden=",i,"click=",()=>{t.allowCancel!==!1&&o()}),f("div.s-dialog.s-s.panel create=hidden destroy=hidden",t.attrs,()=>{f(()=>{t.header!=null&&f("header.s-s.raised",t.headerAttrs,()=>l(t.header))}),f("div",t.contentAttrs,()=>{l(t.content,o)}),f(()=>{t.footer!=null&&f("footer.s-s.raised",t.footerAttrs,()=>l(t.footer))})})})});function j(e){Z||document.addEventListener("keydown",n=>{if(n.key==="Escape"&&e.allowCancel!==!1){let o=f.unproxy(H);for(let i=Z;i>0;i--)if(o[i]){o[i].opts.allowCancel!==!1&&delete H[i];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 o=!1;j({header:"Confirm",allowCancel:!0,content:i=>{f("p",()=>{f("#",e)}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"Cancel",attrs:".neutral .outlined",click:i}),A({content:"OK",click:()=>{o=!0,i()}})}})},...t,onClose:()=>{n(o),t.onClose?.()}})})}function Me(e,t="",n={}){return new Promise(o=>{let i=null;j({header:"Input",allowCancel:!0,content:r=>{f("p",()=>{f("#",e)});let a=f.proxy({value:t});f("form display:contents",()=>{f("submit=",d=>{d.preventDefault(),i=a.value,r()}),X({bind:f.ref(a,"value")}),z({layout:"spaced",attrs:"align-self:flex-end",content:()=>{A({content:"Cancel",attrs:".neutral .outlined",type:"button",click:r}),A({content:"OK",type:"submit"})}})})},...n,onClose:()=>{o(i),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=",o=>{e.bind&&(e.bind.value=o.target.value)}),k(()=>{let o=typeof e.options=="function"?e.options():e.options,i=e.bind?.value??"";e.placeholder!=null&&k("option",()=>{k("value= disabled=true hidden=true"),i||k("selected=true"),k("#",e.placeholder)});for(let r of o){let a=typeof r=="string"?{value:r,label:r}:{value:r.value,label:r.label??r.value};k("option",()=>{k("value=",a.value),a.value===i&&k("selected=true"),k("#",a.label)})}})})})})}import y from"aberdeen";y.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=(r,a)=>r.id??String(a),o=e.bind??y.proxy(n(e.tabs[0]??{label:""},0));e.tabs.length>0&&!e.tabs.some((r,a)=>n(r,a)===y.peek(()=>o.value))&&(o.value=n(e.tabs[0],0));let i=(r,a)=>{r.disabled||(o.value=n(r,a))};y("div.s-tabs",e.attrs,()=>{y("div.s-tablist role=tablist",()=>{e.tabs.forEach((r,a)=>{let d=n(r,a);y("button.s-tab type=button role=tab",()=>{y(`id=${t}-tab-${d} aria-controls=${t}-panel-${d}`),y(()=>{let p=o.value===d;y("aria-selected=",p?"true":"false"),y("tabindex=",p?"0":"-1")}),r.disabled&&y("disabled=true"),y("click=",()=>i(r,a)),y("keydown=",p=>qe(p,e.tabs,a,i)),l(r.icon),l(r.label)})})}),y("div.s-tabpanel role=tabpanel",e.contentAttrs,()=>{y(()=>{let r=o.value,a=e.tabs.findIndex((p,U)=>n(p,U)===r),d=e.tabs[a]??e.tabs[0];d&&(y(`id=${t}-panel-${n(d,a)} aria-labelledby=${t}-tab-${n(d,a)}`),l(d.content))})})})}function qe(e,t,n,o){let i=n;if(e.key==="ArrowRight"||e.key==="ArrowDown")i=(n+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")i=(n-1+t.length)%t.length;else if(e.key==="Home")i=0;else if(e.key==="End")i=t.length-1;else return;e.preventDefault();let r=i>=n?1:-1;for(let a=0;a<t.length;a++){let d=t[i];if(d&&!d.disabled){o(d,i),e.currentTarget?.parentElement?.children[i]?.focus();return}i=(i+r+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,o)=>{let i=E("textarea.s-input",e.inputAttrs,()=>{t?(E(".s-autoGrow"),E("input=",r=>{ae(r.currentTarget),e.input&&e.input(r)})):(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,o,e.bind)});t&&requestAnimationFrame(()=>ae(i))})}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",o=t.type??"neutral";w(`div.s-toast.s-s.${o} role=${n}`,"create=",Fe,"destroy=",De,t.attrs,()=>{w("div.s-toast-body",()=>{w(()=>{t.title!=null&&w("div.s-toast-title",()=>l(t.title))}),w("div.s-toast-msg",()=>l(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,o;return n>0&&(o=setTimeout(()=>ee(t),n)),()=>{o!=null&&clearTimeout(o),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,o){let r=window.innerWidth,a=window.innerHeight,d=0,p=0;return o==="bottom"?(d=e.left+(e.width-t)/2,p=e.bottom+7,p+n>a-8&&(p=e.top-n-7)):o==="left"?(d=e.left-t-7,p=e.top+(e.height-n)/2,d<8&&(d=e.right+7)):o==="right"?(d=e.right+7,p=e.top+(e.height-n)/2,d+t>r-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,r-t-8)),y:Math.max(8,Math.min(p,a-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,o=t.placement??"top",i=S("div.s-tt-tip role=tooltip visibility:hidden",t.attrs,()=>{S("mouseenter=",()=>{T&&(clearTimeout(T),T=null)}),S("mouseleave=",te),l(t.tip)});requestAnimationFrame(()=>{if(!document.body.contains(i))return;let{x:r,y:a}=He(n.getBoundingClientRect(),i.offsetWidth,i.offsetHeight,o);i.style.left=r+"px",i.style.top=a+"px",i.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/dist/theme.js CHANGED
@@ -234,7 +234,7 @@ A.insertGlobalCss({
234
234
  // Chromium): the thumb uses the surface's derived border token, so the bar
235
235
  // tracks the active mode/re-skin and a nested surface's own colours.
236
236
  "scrollbar-width:thin scrollbar-color: $s-border-strong transparent; " +
237
- "background:$s-bg color:$s-fg",
237
+ "background:$s-bg color:$s-fg r:$s-radius",
238
238
  // WebKit/older-Chromium counterpart to the standard `scrollbar-*` props above:
239
239
  // a transparent track and a rounded thumb (border-clipped to leave breathing
240
240
  // room) that brightens on hover.
@@ -243,12 +243,12 @@ A.insertGlobalCss({
243
243
  ".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",
244
244
  ".s-s::-webkit-scrollbar-thumb:hover, .s-s ::-webkit-scrollbar-thumb:hover": "background:$s-fg-faint background-clip:padding-box",
245
245
  // Tonal: the fill colour becomes the ink, over a soft tint of itself.
246
- ".s-s.tonal": "--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent);",
246
+ ".s-s.tonal": "--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent); border: 1px solid $s-border;",
247
247
  // Outlined: the fill colour is the ink; --s-bg *inherits* the parent's bg (the
248
248
  // token the derivations read, so the edge mixes ink with the real surroundings)
249
249
  // while the painted background is transparent, letting that parent fill — even
250
250
  // a gradient or image — show through.
251
- ".s-s.outlined": "--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg);",
251
+ ".s-s.outlined": "--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg); border: 1px solid $s-border;",
252
252
  // Filled, explicit — last among the variants so a caller's `attrs: ".filled"`
253
253
  // overrides a component's default `.tonal`/`.outlined` (resetting both the
254
254
  // anchors and the painted background).
@@ -268,6 +268,13 @@ A.insertGlobalCss({
268
268
  // the surface's own ink. (Keyed on the role modifier, so it holds across
269
269
  // variants — and tracks the tonal/outlined fg remap.)
270
270
  ".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",
271
+ // Tonal/outlined nested inside a filled accent surface would lose legibility:
272
+ // their transparency bleeds into the vivid parent fill. Swap in the neutral
273
+ // panel as a base so the role color reads as ink rather than fill.
274
+ // Specificity (4 classes) beats the 2-class variant rules — no !important needed.
275
+ [["primary", "secondary", "gradient", "danger", "success", "warning"]
276
+ .flatMap(r => [`.s-s.${r} .s-s.tonal`, `.s-s.${r} .s-s.outlined`])
277
+ .join(", ")]: "--s-bg: $s-panel; background: $s-panel;",
271
278
  });
272
279
  // A deliberately light reset. Colours/shape come from the contextual tokens, so
273
280
  // rich content (e.g. markdown-to-HTML) adapts to whatever surface holds it. The
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "staffa",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "An opinionated component library for the Aberdeen reactive UI library.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -30,14 +30,14 @@ export interface ButtonOptions {
30
30
  }
31
31
 
32
32
  // The button is a `.s-s` surface (defaulting to `.primary` in button() below), so
33
- // its colours come from the surface classes in theme.ts. This rule only handles
34
- // layout, border, focus, hover and sizing.
33
+ // its colours, border, and border-radius come from the surface classes in theme.ts.
34
+ // This rule only handles layout, focus, hover and sizing.
35
35
  A.insertGlobalCss({
36
36
  ".s-btn": {
37
37
  "&":
38
38
  "display:inline-flex align-items:center justify-content:center gap:$2 " +
39
39
  "font-weight:600 line-height:1.2 white-space:nowrap cursor:pointer text-decoration:none " +
40
- "border: 1px solid $s-border; r: $s-radius; padding: 0.5em 1em; " +
40
+ "border:0 padding: 0.5em 1em; " +
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)",
@@ -54,7 +54,7 @@ A.insertGlobalCss({
54
54
  // artifact where a gradient clipped to a transparent rounded border fringes
55
55
  // the edge with the gradient's far colour.
56
56
  "&.gradient:not(.tonal):not(.outlined)":
57
- "border:0 box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;",
57
+ "box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;",
58
58
  "&.gradient:not(.tonal):not(.outlined):hover":
59
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);",
60
60
  // Subtle press feedback.
@@ -71,8 +71,8 @@ A.insertGlobalCss({
71
71
  const ROLE_CLASS = /\.(gradient|primary|secondary|neutral|danger|success|warning|base|panel|raised)(\.|\s|$)/;
72
72
 
73
73
  /**
74
- * A button. Always carries at least a visible border so its affordance is
75
- * obvious at a glance.
74
+ * A button. Tonal and outlined variants show a border; filled variants rely on
75
+ * their solid background for affordance.
76
76
  *
77
77
  * Shortcut: pass a string to use it as the label, or a function for custom
78
78
  * content.
@@ -69,6 +69,11 @@ export function tabs(opts: TabsOptions): void {
69
69
  // Selection state: caller-provided binding, or internal.
70
70
  const $sel: Bindable<string> = opts.bind ?? A.proxy(keyOf(opts.tabs[0] ?? { label: "" }, 0));
71
71
 
72
+ // If the current value isn't a valid tab key, reset to the first tab.
73
+ if (opts.tabs.length > 0 && !opts.tabs.some((t, i) => keyOf(t, i) === A.peek(() => $sel.value))) {
74
+ $sel.value = keyOf(opts.tabs[0], 0);
75
+ }
76
+
72
77
  const select = (tab: Tab, index: number) => {
73
78
  if (tab.disabled) return;
74
79
  $sel.value = keyOf(tab, index);
package/src/theme.ts CHANGED
@@ -244,7 +244,7 @@ A.insertGlobalCss({
244
244
  // Chromium): the thumb uses the surface's derived border token, so the bar
245
245
  // tracks the active mode/re-skin and a nested surface's own colours.
246
246
  "scrollbar-width:thin scrollbar-color: $s-border-strong transparent; " +
247
- "background:$s-bg color:$s-fg",
247
+ "background:$s-bg color:$s-fg r:$s-radius",
248
248
  // WebKit/older-Chromium counterpart to the standard `scrollbar-*` props above:
249
249
  // a transparent track and a rounded thumb (border-clipped to leave breathing
250
250
  // room) that brightens on hover.
@@ -253,12 +253,12 @@ A.insertGlobalCss({
253
253
  ".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",
254
254
  ".s-s::-webkit-scrollbar-thumb:hover, .s-s ::-webkit-scrollbar-thumb:hover": "background:$s-fg-faint background-clip:padding-box",
255
255
  // Tonal: the fill colour becomes the ink, over a soft tint of itself.
256
- ".s-s.tonal": "--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent);",
256
+ ".s-s.tonal": "--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent); border: 1px solid $s-border;",
257
257
  // Outlined: the fill colour is the ink; --s-bg *inherits* the parent's bg (the
258
258
  // token the derivations read, so the edge mixes ink with the real surroundings)
259
259
  // while the painted background is transparent, letting that parent fill — even
260
260
  // a gradient or image — show through.
261
- ".s-s.outlined": "--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg);",
261
+ ".s-s.outlined": "--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg); border: 1px solid $s-border;",
262
262
  // Filled, explicit — last among the variants so a caller's `attrs: ".filled"`
263
263
  // overrides a component's default `.tonal`/`.outlined` (resetting both the
264
264
  // anchors and the painted background).
@@ -279,6 +279,12 @@ A.insertGlobalCss({
279
279
  // the surface's own ink. (Keyed on the role modifier, so it holds across
280
280
  // variants — and tracks the tonal/outlined fg remap.)
281
281
  ".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",
282
+ // Tonal/outlined nested inside a filled accent surface would lose legibility:
283
+ // their transparency bleeds into the vivid parent fill. Swap in the neutral
284
+ // panel as a base so the role color reads as ink rather than fill.
285
+ // Specificity (4 classes) beats the 2-class variant rules — no !important needed.
286
+ ".s-s.primary .s-s.tonal, .s-s.secondary .s-s.tonal, .s-s.gradient .s-s.tonal, .s-s.danger .s-s.tonal, .s-s.success .s-s.tonal, .s-s.warning .s-s.tonal, .s-s.primary .s-s.outlined, .s-s.secondary .s-s.outlined, .s-s.gradient .s-s.outlined, .s-s.danger .s-s.outlined, .s-s.success .s-s.outlined, .s-s.warning .s-s.outlined":
287
+ "--s-bg: $s-panel; background: $s-panel;",
282
288
  });
283
289
 
284
290
  // A deliberately light reset. Colours/shape come from the contextual tokens, so