@f-ewald/components 1.27.3 → 1.28.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/custom-elements.json +26 -6
- package/dist/icons.d.ts +1 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/percent-bar-chart.d.ts.map +1 -1
- package/dist/percent-bar-chart.js +9 -2
- package/dist/percent-bar-chart.js.map +1 -1
- package/dist/radio-cards.d.ts +5 -1
- package/dist/radio-cards.d.ts.map +1 -1
- package/dist/radio-cards.js +19 -2
- package/dist/radio-cards.js.map +1 -1
- package/dist/scroll-to-bottom.d.ts +6 -0
- package/dist/scroll-to-bottom.d.ts.map +1 -1
- package/dist/scroll-to-bottom.js +31 -7
- package/dist/scroll-to-bottom.js.map +1 -1
- package/dist/scroll-to-top.d.ts +6 -0
- package/dist/scroll-to-top.d.ts.map +1 -1
- package/dist/scroll-to-top.js +31 -7
- package/dist/scroll-to-top.js.map +1 -1
- package/dist/tokens.css +4 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +11 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.d.ts +24 -0
- package/dist/ui-button.d.ts.map +1 -1
- package/dist/ui-button.js +122 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/weight-bar-chart.js +2 -2
- package/dist/weight-bar-chart.js.map +1 -1
- package/docs/design-language.md +19 -0
- package/docs/icons.md +1 -1
- package/docs/radio-cards.md +6 -1
- package/docs/scroll-to-bottom.md +15 -0
- package/docs/scroll-to-top.md +15 -0
- package/docs/ui-button.md +28 -0
- package/docs/weight-bar-chart.md +1 -0
- package/llms.txt +47 -8
- package/package.json +1 -1
package/dist/ui-button.js
CHANGED
|
@@ -40,6 +40,28 @@ import { tokens } from "./tokens.js";
|
|
|
40
40
|
* transparent/bordered look, so it can be themed into a matching (e.g.
|
|
41
41
|
* white-to-gray) gradient too.
|
|
42
42
|
*
|
|
43
|
+
* `ai` is an orthogonal modifier rather than a fourth variant: it leaves the
|
|
44
|
+
* variant's fill (flat or gradient-themed) untouched and only adds an
|
|
45
|
+
* animated multi-hue ring *outside* the button box — a crisp masked edge
|
|
46
|
+
* plus a blurred bloom behind it that fades out to transparent, so the ring
|
|
47
|
+
* melts into the page instead of ending on a hard line. Both layers are
|
|
48
|
+
* masked into a donut, so nothing is ever painted over the background or
|
|
49
|
+
* label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It
|
|
50
|
+
* sweeps slowly at rest, faster on hover and while `busy`, holds still while
|
|
51
|
+
* disabled or under `prefers-reduced-motion`, and drops the bloom for a
|
|
52
|
+
* solid `CanvasText` ring in forced-colors mode. The bloom reaches about
|
|
53
|
+
* `0.5rem` past the control, so give an AI button that much clearance from
|
|
54
|
+
* its neighbors and avoid `overflow: hidden` ancestors that would clip it.
|
|
55
|
+
*
|
|
56
|
+
* Do not combine `ai` with `pill` under the gradient theme
|
|
57
|
+
* (`data-theme="gradient"`). That theme defines a button through a darker
|
|
58
|
+
* `--ui-button-border` edge plus a glossy top highlight; a pill's
|
|
59
|
+
* fully-rounded silhouette runs flush against the ring around its entire
|
|
60
|
+
* outline, so that border and gloss read as the inner edge of the rainbow
|
|
61
|
+
* rather than as the button's own shape, and the vertical gradient fill
|
|
62
|
+
* stops reading as a gradient at all. Use `ai` with the default
|
|
63
|
+
* `--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.
|
|
64
|
+
*
|
|
43
65
|
* @element ui-button
|
|
44
66
|
* @slot icon - Optional leading icon (e.g. an inline SVG).
|
|
45
67
|
* @slot - Button label.
|
|
@@ -54,6 +76,8 @@ let UiButton = class UiButton extends LitElement {
|
|
|
54
76
|
this.size = "md";
|
|
55
77
|
/** Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. */
|
|
56
78
|
this.pill = false;
|
|
79
|
+
/** Draws the animated multi-hue "AI" ring (crisp edge plus a bloom fading out to transparent) around the button, on top of whatever variant/theme it already uses. */
|
|
80
|
+
this.ai = false;
|
|
57
81
|
/** Renders an `<a href="...">` instead of a `<button>` when set. */
|
|
58
82
|
this.href = null;
|
|
59
83
|
/** Native button `type`. Ignored when `href` is set. */
|
|
@@ -161,6 +185,83 @@ let UiButton = class UiButton extends LitElement {
|
|
|
161
185
|
.btn.pill {
|
|
162
186
|
border-radius: 999px;
|
|
163
187
|
}
|
|
188
|
+
.btn.ai {
|
|
189
|
+
position: relative;
|
|
190
|
+
--ai-sweep: linear-gradient(
|
|
191
|
+
90deg,
|
|
192
|
+
var(--ui-ai-1, #38bdf8),
|
|
193
|
+
var(--ui-ai-2, #6366f1),
|
|
194
|
+
var(--ui-ai-3, #d946ef),
|
|
195
|
+
var(--ui-ai-4, #fbbf24),
|
|
196
|
+
var(--ui-ai-1, #38bdf8)
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
/* Two layers, both masked into a donut (everything except the content
|
|
200
|
+
box) so the fill underneath — flat, gradient-themed, or transparent
|
|
201
|
+
secondary — is never painted over: ::before is a blurred bloom that
|
|
202
|
+
fades out to transparent, ::after the crisp edge on top of it. The
|
|
203
|
+
gradient tile is 1.5x the box so most of the hue range is visible at
|
|
204
|
+
once, and one cycle shifts it by exactly one tile, for a seamless
|
|
205
|
+
loop. */
|
|
206
|
+
.btn.ai::before,
|
|
207
|
+
.btn.ai::after {
|
|
208
|
+
content: "";
|
|
209
|
+
position: absolute;
|
|
210
|
+
background: var(--ai-sweep);
|
|
211
|
+
background-size: 150% 100%;
|
|
212
|
+
-webkit-mask:
|
|
213
|
+
linear-gradient(#000 0 0) content-box,
|
|
214
|
+
linear-gradient(#000 0 0);
|
|
215
|
+
-webkit-mask-composite: xor;
|
|
216
|
+
mask:
|
|
217
|
+
linear-gradient(#000 0 0) content-box,
|
|
218
|
+
linear-gradient(#000 0 0);
|
|
219
|
+
mask-composite: exclude;
|
|
220
|
+
animation: ai-sweep 4s linear infinite;
|
|
221
|
+
pointer-events: none;
|
|
222
|
+
}
|
|
223
|
+
/* The transparent border is headroom: a mask layer is clipped to the
|
|
224
|
+
border box, so without it the blur's outward spread — the fade —
|
|
225
|
+
would be cut off square again. */
|
|
226
|
+
.btn.ai::before {
|
|
227
|
+
inset: -1rem;
|
|
228
|
+
border: 0.75rem solid transparent;
|
|
229
|
+
padding: 0.25rem;
|
|
230
|
+
border-radius: calc(var(--ui-radius-sm, 0.25rem) + 1rem);
|
|
231
|
+
background-clip: padding-box;
|
|
232
|
+
filter: blur(0.3125rem);
|
|
233
|
+
opacity: 0.6;
|
|
234
|
+
}
|
|
235
|
+
.btn.ai::after {
|
|
236
|
+
inset: -0.125rem;
|
|
237
|
+
padding: 0.125rem;
|
|
238
|
+
border-radius: calc(var(--ui-radius-sm, 0.25rem) + 0.125rem);
|
|
239
|
+
}
|
|
240
|
+
.btn.ai.pill::before,
|
|
241
|
+
.btn.ai.pill::after {
|
|
242
|
+
border-radius: 999px;
|
|
243
|
+
}
|
|
244
|
+
.btn.ai:hover::before,
|
|
245
|
+
.btn.ai:hover::after {
|
|
246
|
+
animation-duration: 1.5s;
|
|
247
|
+
}
|
|
248
|
+
/* A busy AI button keeps sweeping (and speeds up) — the ring reads as
|
|
249
|
+
"working"; a plainly disabled one holds still. */
|
|
250
|
+
.btn.ai[aria-busy="true"]::before,
|
|
251
|
+
.btn.ai[aria-busy="true"]::after {
|
|
252
|
+
animation-duration: 1.5s;
|
|
253
|
+
}
|
|
254
|
+
.btn.ai:disabled:not([aria-busy="true"])::before,
|
|
255
|
+
.btn.ai:disabled:not([aria-busy="true"])::after,
|
|
256
|
+
.btn.ai[aria-disabled="true"]:not([aria-busy="true"])::before,
|
|
257
|
+
.btn.ai[aria-disabled="true"]:not([aria-busy="true"])::after {
|
|
258
|
+
animation: none;
|
|
259
|
+
}
|
|
260
|
+
@keyframes ai-sweep {
|
|
261
|
+
to {
|
|
262
|
+
background-position: 300% 0;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
164
265
|
.spin {
|
|
165
266
|
display: inline-flex;
|
|
166
267
|
animation: spin 0.8s linear infinite;
|
|
@@ -177,8 +278,25 @@ let UiButton = class UiButton extends LitElement {
|
|
|
177
278
|
.spin {
|
|
178
279
|
animation: none;
|
|
179
280
|
}
|
|
281
|
+
.btn.ai::before,
|
|
282
|
+
.btn.ai::after,
|
|
283
|
+
.btn.ai:hover::before,
|
|
284
|
+
.btn.ai:hover::after,
|
|
285
|
+
.btn.ai[aria-busy="true"]::before,
|
|
286
|
+
.btn.ai[aria-busy="true"]::after {
|
|
287
|
+
animation: none;
|
|
288
|
+
}
|
|
180
289
|
}
|
|
181
290
|
@media (forced-colors: active) {
|
|
291
|
+
/* Gradients carry no meaning once colors are forced — drop the bloom
|
|
292
|
+
and keep a solid system-colored ring so the AI affordance survives. */
|
|
293
|
+
.btn.ai::before {
|
|
294
|
+
display: none;
|
|
295
|
+
}
|
|
296
|
+
.btn.ai::after {
|
|
297
|
+
background: CanvasText;
|
|
298
|
+
animation: none;
|
|
299
|
+
}
|
|
182
300
|
.btn:focus-visible {
|
|
183
301
|
outline: 2px solid CanvasText;
|
|
184
302
|
outline-offset: 2px;
|
|
@@ -207,7 +325,7 @@ let UiButton = class UiButton extends LitElement {
|
|
|
207
325
|
e.preventDefault();
|
|
208
326
|
}
|
|
209
327
|
render() {
|
|
210
|
-
const classes = `btn ${this.variant} ${this.size}${this.pill ? " pill" : ""}`;
|
|
328
|
+
const classes = `btn ${this.variant} ${this.size}${this.pill ? " pill" : ""}${this.ai ? " ai" : ""}`;
|
|
211
329
|
const isDisabled = this.disabled || this.busy;
|
|
212
330
|
if (this.href) {
|
|
213
331
|
return html `
|
|
@@ -248,6 +366,9 @@ __decorate([
|
|
|
248
366
|
__decorate([
|
|
249
367
|
property({ type: Boolean })
|
|
250
368
|
], UiButton.prototype, "pill", void 0);
|
|
369
|
+
__decorate([
|
|
370
|
+
property({ type: Boolean, reflect: true })
|
|
371
|
+
], UiButton.prototype, "ai", void 0);
|
|
251
372
|
__decorate([
|
|
252
373
|
property()
|
|
253
374
|
], UiButton.prototype, "href", void 0);
|
package/dist/ui-button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-button.js","sourceRoot":"","sources":["../src/ui-button.ts"],"names":[],"mappings":"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","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"danger\";\n\n/**\n * Button (or link styled as one) with an optional leading icon, in three\n * visual weights. Set `href` to render an `<a>` instead of a `<button>` —\n * same styling either way — for cross-page navigation that should look like\n * an action button; a disabled/busy link stays a real `<a>` with\n * `aria-disabled` + `pointer-events: none` rather than losing its href.\n * Put the icon in the `icon` slot and the label in the default slot.\n *\n * Form-associated (`type=\"submit\"`/`\"reset\"`): the actual `<button>` lives in\n * this element's shadow root, which native HTML form association does not\n * cross into from an ancestor light-DOM `<form>`. `type=\"submit\"`/`\"reset\"`\n * is instead wired through `ElementInternals.form` — the same mechanism\n * `address-autocomplete` uses to associate with an ancestor form.\n *\n * `primary`/`danger` backgrounds read `--ui-button-background`/\n * `--ui-button-danger-background` (and their `-hover`/`-active`\n * counterparts), which default to the flat `--ui-primary`/`--ui-danger`\n * tokens unchanged — so `--ui-primary`/`--ui-danger` stay the single source\n * of truth for every other component. A consumer can override just these\n * button-specific tokens with a `linear-gradient(...)` to opt every\n * `ui-button` into a gradient look without touching component markup —\n * `gradientTokenValues` in `tokens.ts` ships exactly this, wired up via\n * `data-theme=\"gradient\"` (see `tokens.css`'s \"Gradient theme\" section) —\n * pairing it with `--ui-button-border`/`--ui-button-danger-border` (default\n * `transparent`) for a defining edge a shade darker than the gradient's dark\n * stop, and setting the `-active` variant's stops in reverse for a\n * pressed/\"indented\" look while the button is held down. `secondary`'s\n * background/border read the equivalent `--ui-button-secondary-*` tokens\n * (shared with `confirm-dialog`'s Cancel button), defaulting to today's\n * transparent/bordered look, so it can be themed into a matching (e.g.\n * white-to-gray) gradient too.\n *\n * @element ui-button\n * @slot icon - Optional leading icon (e.g. an inline SVG).\n * @slot - Button label.\n */\n@customElement(\"ui-button\")\nexport class UiButton extends LitElement {\n static formAssociated = true;\n\n #internals = this.attachInternals();\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n .btn {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n height: 2rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 1rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n cursor: pointer;\n border: 1px solid transparent;\n text-decoration: none;\n box-sizing: border-box;\n }\n .btn.primary {\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn.primary:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n .btn.primary:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n .btn.secondary {\n background: var(--ui-button-secondary-background, none);\n border-color: var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n color: var(--ui-text, #0f172a);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn.secondary:hover:not(:disabled) {\n background: var(--ui-button-secondary-background-hover, none);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n .btn.secondary:active:not(:disabled) {\n background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));\n box-shadow: none;\n }\n .btn.danger {\n background: var(--ui-button-danger-background, var(--ui-danger, #dc2626));\n border-color: var(--ui-button-danger-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn.danger:hover:not(:disabled) {\n background: var(--ui-button-danger-background-hover, var(--ui-danger-hover, #b91c1c));\n }\n .btn.danger:active:not(:disabled) {\n background: var(--ui-button-danger-background-active, var(--ui-button-danger-background, var(--ui-danger, #dc2626)));\n box-shadow: none;\n }\n .btn:disabled,\n .btn[aria-disabled=\"true\"] {\n opacity: 0.6;\n cursor: default;\n pointer-events: none;\n }\n .btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .btn.primary:focus-visible:not(:active),\n .btn.danger:focus-visible:not(:active),\n .btn.secondary:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn.sm {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .btn.pill {\n border-radius: 999px;\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n .spin[hidden] {\n display: none;\n }\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spin {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n .btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .btn:disabled,\n .btn[aria-disabled=\"true\"] {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Visual weight. */\n @property() variant: ButtonVariant = \"primary\";\n /** Size — `sm` reduces height/padding/font-size one step below the default. */\n @property() size: \"sm\" | \"md\" = \"md\";\n /** Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. */\n @property({ type: Boolean }) pill = false;\n /** Renders an `<a href=\"...\">` instead of a `<button>` when set. */\n @property() href: string | null = null;\n /** Native button `type`. Ignored when `href` is set. */\n @property() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /** Disables the control and dims it. */\n @property({ type: Boolean }) disabled = false;\n /** Shows a spinner in place of the icon slot and disables the control. */\n @property({ type: Boolean }) busy = false;\n\n /** Drives submit/reset on the ancestor form via ElementInternals, since a shadow-DOM button can't do it natively. */\n private _onClick() {\n if (this.type === \"submit\") this.#internals.form?.requestSubmit();\n else if (this.type === \"reset\") this.#internals.form?.reset();\n }\n\n /** Suppresses navigation while a link-styled button is disabled or busy. */\n private _onLinkClick(e: MouseEvent) {\n if (!this.disabled && !this.busy) return;\n e.preventDefault();\n }\n\n override render() {\n const classes = `btn ${this.variant} ${this.size}${this.pill ? \" pill\" : \"\"}`;\n const isDisabled = this.disabled || this.busy;\n if (this.href) {\n return html`\n <a\n class=${classes}\n href=${this.href}\n aria-disabled=${isDisabled ? \"true\" : \"false\"}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onLinkClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </a>\n `;\n }\n return html`\n <button\n class=${classes}\n type=\"button\"\n ?disabled=${isDisabled}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-button\": UiButton;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ui-button.js","sourceRoot":"","sources":["../src/ui-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAGL,eAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAgOpC,qBAAqB;QACT,YAAO,GAAkB,SAAS,CAAC;QAC/C,+EAA+E;QACnE,SAAI,GAAgB,IAAI,CAAC;QACrC,2FAA2F;QAC9D,SAAI,GAAG,KAAK,CAAC;QAC1C,sKAAsK;QAC1H,OAAE,GAAG,KAAK,CAAC;QACvD,oEAAoE;QACxD,SAAI,GAAkB,IAAI,CAAC;QACvC,wDAAwD;QAC5C,SAAI,GAAkC,QAAQ,CAAC;QAC3D,wCAAwC;QACX,aAAQ,GAAG,KAAK,CAAC;QAC9C,0EAA0E;QAC7C,SAAI,GAAG,KAAK,CAAC;IA8C5C,CAAC;aA/RQ,mBAAc,GAAG,IAAI,AAAP,CAAQ;IAE7B,UAAU,CAA0B;aACpB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0NF;KACF,AA7NqB,CA6NpB;IAmBF,qHAAqH;IAC7G,QAAQ;QACd,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC;aAC7D,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IAChE,CAAC;IAED,4EAA4E;IACpE,YAAY,CAAC,CAAa;QAChC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO;QACzC,CAAC,CAAC,cAAc,EAAE,CAAC;IACrB,CAAC;IAEQ,MAAM;QACb,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACrG,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC;QAC9C,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,IAAI,CAAA;;kBAEC,OAAO;iBACR,IAAI,CAAC,IAAI;0BACA,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;sBACjC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;mBAC/B,IAAI,CAAC,YAAY;;0DAEsB,CAAC,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC,EAAE,CAAC;sCACnD,IAAI,CAAC,IAAI;;;OAGxC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAA;;gBAEC,OAAO;;oBAEH,UAAU;oBACV,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;iBAC/B,IAAI,CAAC,QAAQ;;wDAE0B,CAAC,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC,EAAE,CAAC;oCACnD,IAAI,CAAC,IAAI;;;KAGxC,CAAC;IACJ,CAAC;CACF,CAAA;AA5Da;IAAX,QAAQ,EAAE;yCAAoC;AAEnC;IAAX,QAAQ,EAAE;sCAA0B;AAER;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAc;AAEE;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCAAY;AAE3C;IAAX,QAAQ,EAAE;sCAA4B;AAE3B;IAAX,QAAQ,EAAE;sCAAgD;AAE9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAc;AAlP/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAgSpB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"danger\";\n\n/**\n * Button (or link styled as one) with an optional leading icon, in three\n * visual weights. Set `href` to render an `<a>` instead of a `<button>` —\n * same styling either way — for cross-page navigation that should look like\n * an action button; a disabled/busy link stays a real `<a>` with\n * `aria-disabled` + `pointer-events: none` rather than losing its href.\n * Put the icon in the `icon` slot and the label in the default slot.\n *\n * Form-associated (`type=\"submit\"`/`\"reset\"`): the actual `<button>` lives in\n * this element's shadow root, which native HTML form association does not\n * cross into from an ancestor light-DOM `<form>`. `type=\"submit\"`/`\"reset\"`\n * is instead wired through `ElementInternals.form` — the same mechanism\n * `address-autocomplete` uses to associate with an ancestor form.\n *\n * `primary`/`danger` backgrounds read `--ui-button-background`/\n * `--ui-button-danger-background` (and their `-hover`/`-active`\n * counterparts), which default to the flat `--ui-primary`/`--ui-danger`\n * tokens unchanged — so `--ui-primary`/`--ui-danger` stay the single source\n * of truth for every other component. A consumer can override just these\n * button-specific tokens with a `linear-gradient(...)` to opt every\n * `ui-button` into a gradient look without touching component markup —\n * `gradientTokenValues` in `tokens.ts` ships exactly this, wired up via\n * `data-theme=\"gradient\"` (see `tokens.css`'s \"Gradient theme\" section) —\n * pairing it with `--ui-button-border`/`--ui-button-danger-border` (default\n * `transparent`) for a defining edge a shade darker than the gradient's dark\n * stop, and setting the `-active` variant's stops in reverse for a\n * pressed/\"indented\" look while the button is held down. `secondary`'s\n * background/border read the equivalent `--ui-button-secondary-*` tokens\n * (shared with `confirm-dialog`'s Cancel button), defaulting to today's\n * transparent/bordered look, so it can be themed into a matching (e.g.\n * white-to-gray) gradient too.\n *\n * `ai` is an orthogonal modifier rather than a fourth variant: it leaves the\n * variant's fill (flat or gradient-themed) untouched and only adds an\n * animated multi-hue ring *outside* the button box — a crisp masked edge\n * plus a blurred bloom behind it that fades out to transparent, so the ring\n * melts into the page instead of ending on a hard line. Both layers are\n * masked into a donut, so nothing is ever painted over the background or\n * label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It\n * sweeps slowly at rest, faster on hover and while `busy`, holds still while\n * disabled or under `prefers-reduced-motion`, and drops the bloom for a\n * solid `CanvasText` ring in forced-colors mode. The bloom reaches about\n * `0.5rem` past the control, so give an AI button that much clearance from\n * its neighbors and avoid `overflow: hidden` ancestors that would clip it.\n *\n * Do not combine `ai` with `pill` under the gradient theme\n * (`data-theme=\"gradient\"`). That theme defines a button through a darker\n * `--ui-button-border` edge plus a glossy top highlight; a pill's\n * fully-rounded silhouette runs flush against the ring around its entire\n * outline, so that border and gloss read as the inner edge of the rainbow\n * rather than as the button's own shape, and the vertical gradient fill\n * stops reading as a gradient at all. Use `ai` with the default\n * `--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.\n *\n * @element ui-button\n * @slot icon - Optional leading icon (e.g. an inline SVG).\n * @slot - Button label.\n */\n@customElement(\"ui-button\")\nexport class UiButton extends LitElement {\n static formAssociated = true;\n\n #internals = this.attachInternals();\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n .btn {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n height: 2rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 1rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n cursor: pointer;\n border: 1px solid transparent;\n text-decoration: none;\n box-sizing: border-box;\n }\n .btn.primary {\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn.primary:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n .btn.primary:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n .btn.secondary {\n background: var(--ui-button-secondary-background, none);\n border-color: var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n color: var(--ui-text, #0f172a);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn.secondary:hover:not(:disabled) {\n background: var(--ui-button-secondary-background-hover, none);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n .btn.secondary:active:not(:disabled) {\n background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));\n box-shadow: none;\n }\n .btn.danger {\n background: var(--ui-button-danger-background, var(--ui-danger, #dc2626));\n border-color: var(--ui-button-danger-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn.danger:hover:not(:disabled) {\n background: var(--ui-button-danger-background-hover, var(--ui-danger-hover, #b91c1c));\n }\n .btn.danger:active:not(:disabled) {\n background: var(--ui-button-danger-background-active, var(--ui-button-danger-background, var(--ui-danger, #dc2626)));\n box-shadow: none;\n }\n .btn:disabled,\n .btn[aria-disabled=\"true\"] {\n opacity: 0.6;\n cursor: default;\n pointer-events: none;\n }\n .btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .btn.primary:focus-visible:not(:active),\n .btn.danger:focus-visible:not(:active),\n .btn.secondary:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn.sm {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .btn.pill {\n border-radius: 999px;\n }\n .btn.ai {\n position: relative;\n --ai-sweep: linear-gradient(\n 90deg,\n var(--ui-ai-1, #38bdf8),\n var(--ui-ai-2, #6366f1),\n var(--ui-ai-3, #d946ef),\n var(--ui-ai-4, #fbbf24),\n var(--ui-ai-1, #38bdf8)\n );\n }\n /* Two layers, both masked into a donut (everything except the content\n box) so the fill underneath — flat, gradient-themed, or transparent\n secondary — is never painted over: ::before is a blurred bloom that\n fades out to transparent, ::after the crisp edge on top of it. The\n gradient tile is 1.5x the box so most of the hue range is visible at\n once, and one cycle shifts it by exactly one tile, for a seamless\n loop. */\n .btn.ai::before,\n .btn.ai::after {\n content: \"\";\n position: absolute;\n background: var(--ai-sweep);\n background-size: 150% 100%;\n -webkit-mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n -webkit-mask-composite: xor;\n mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n mask-composite: exclude;\n animation: ai-sweep 4s linear infinite;\n pointer-events: none;\n }\n /* The transparent border is headroom: a mask layer is clipped to the\n border box, so without it the blur's outward spread — the fade —\n would be cut off square again. */\n .btn.ai::before {\n inset: -1rem;\n border: 0.75rem solid transparent;\n padding: 0.25rem;\n border-radius: calc(var(--ui-radius-sm, 0.25rem) + 1rem);\n background-clip: padding-box;\n filter: blur(0.3125rem);\n opacity: 0.6;\n }\n .btn.ai::after {\n inset: -0.125rem;\n padding: 0.125rem;\n border-radius: calc(var(--ui-radius-sm, 0.25rem) + 0.125rem);\n }\n .btn.ai.pill::before,\n .btn.ai.pill::after {\n border-radius: 999px;\n }\n .btn.ai:hover::before,\n .btn.ai:hover::after {\n animation-duration: 1.5s;\n }\n /* A busy AI button keeps sweeping (and speeds up) — the ring reads as\n \"working\"; a plainly disabled one holds still. */\n .btn.ai[aria-busy=\"true\"]::before,\n .btn.ai[aria-busy=\"true\"]::after {\n animation-duration: 1.5s;\n }\n .btn.ai:disabled:not([aria-busy=\"true\"])::before,\n .btn.ai:disabled:not([aria-busy=\"true\"])::after,\n .btn.ai[aria-disabled=\"true\"]:not([aria-busy=\"true\"])::before,\n .btn.ai[aria-disabled=\"true\"]:not([aria-busy=\"true\"])::after {\n animation: none;\n }\n @keyframes ai-sweep {\n to {\n background-position: 300% 0;\n }\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n .spin[hidden] {\n display: none;\n }\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spin {\n animation: none;\n }\n .btn.ai::before,\n .btn.ai::after,\n .btn.ai:hover::before,\n .btn.ai:hover::after,\n .btn.ai[aria-busy=\"true\"]::before,\n .btn.ai[aria-busy=\"true\"]::after {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n /* Gradients carry no meaning once colors are forced — drop the bloom\n and keep a solid system-colored ring so the AI affordance survives. */\n .btn.ai::before {\n display: none;\n }\n .btn.ai::after {\n background: CanvasText;\n animation: none;\n }\n .btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .btn:disabled,\n .btn[aria-disabled=\"true\"] {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Visual weight. */\n @property() variant: ButtonVariant = \"primary\";\n /** Size — `sm` reduces height/padding/font-size one step below the default. */\n @property() size: \"sm\" | \"md\" = \"md\";\n /** Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. */\n @property({ type: Boolean }) pill = false;\n /** Draws the animated multi-hue \"AI\" ring (crisp edge plus a bloom fading out to transparent) around the button, on top of whatever variant/theme it already uses. */\n @property({ type: Boolean, reflect: true }) ai = false;\n /** Renders an `<a href=\"...\">` instead of a `<button>` when set. */\n @property() href: string | null = null;\n /** Native button `type`. Ignored when `href` is set. */\n @property() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /** Disables the control and dims it. */\n @property({ type: Boolean }) disabled = false;\n /** Shows a spinner in place of the icon slot and disables the control. */\n @property({ type: Boolean }) busy = false;\n\n /** Drives submit/reset on the ancestor form via ElementInternals, since a shadow-DOM button can't do it natively. */\n private _onClick() {\n if (this.type === \"submit\") this.#internals.form?.requestSubmit();\n else if (this.type === \"reset\") this.#internals.form?.reset();\n }\n\n /** Suppresses navigation while a link-styled button is disabled or busy. */\n private _onLinkClick(e: MouseEvent) {\n if (!this.disabled && !this.busy) return;\n e.preventDefault();\n }\n\n override render() {\n const classes = `btn ${this.variant} ${this.size}${this.pill ? \" pill\" : \"\"}${this.ai ? \" ai\" : \"\"}`;\n const isDisabled = this.disabled || this.busy;\n if (this.href) {\n return html`\n <a\n class=${classes}\n href=${this.href}\n aria-disabled=${isDisabled ? \"true\" : \"false\"}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onLinkClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </a>\n `;\n }\n return html`\n <button\n class=${classes}\n type=\"button\"\n ?disabled=${isDisabled}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-button\": UiButton;\n }\n}\n"]}
|
package/dist/weight-bar-chart.js
CHANGED
|
@@ -55,7 +55,7 @@ let WeightBarChart = class WeightBarChart extends LitElement {
|
|
|
55
55
|
flex: 1 1 auto;
|
|
56
56
|
height: 0.75rem;
|
|
57
57
|
background: var(--ui-surface-muted, #f8fafc);
|
|
58
|
-
border-radius:
|
|
58
|
+
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
59
59
|
overflow: hidden;
|
|
60
60
|
}
|
|
61
61
|
.bar {
|
|
@@ -66,7 +66,7 @@ let WeightBarChart = class WeightBarChart extends LitElement {
|
|
|
66
66
|
color-mix(in srgb, var(--ui-primary, #4f46e5) 70%, #ffffff) 0%,
|
|
67
67
|
color-mix(in srgb, var(--ui-primary, #4f46e5) 70%, #000000) 100%
|
|
68
68
|
);
|
|
69
|
-
border-radius: 0
|
|
69
|
+
border-radius: 0 var(--ui-radius-sm, 0.25rem) var(--ui-radius-sm, 0.25rem) 0;
|
|
70
70
|
transition: width 150ms ease-out;
|
|
71
71
|
}
|
|
72
72
|
.pct {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weight-bar-chart.js","sourceRoot":"","sources":["../src/weight-bar-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC;;;;;;;;;GASG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QACL,oEAAoE;QACpC,UAAK,GAAoB,EAAE,CAAC;IAsF9D,CAAC;aApFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuDF;KACF,AA1DqB,CA0DpB;IAEO,MAAM;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,+EAA+E;QAC/E,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACjE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClG,OAAO,IAAI,CAAA;6CAC8B,OAAO;UAC1C,MAAM,CACN,MAAM,EACN,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EACjB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;oCAEY,IAAI,CAAC,KAAK;;iDAEG,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG;;kCAEvC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;;WAEnD,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAtFiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CAA6B;AAFjD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAwF1B","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface WeightBarItem {\n id: string;\n label: string;\n /** Normalized fraction (fractions across all items sum to ~1). */\n value: number;\n}\n\n/**\n * Sorted horizontal bar chart of labeled weights (normalized fractions\n * summing to ~1). Bars sort descending — the order IS the priority ranking.\n * Widths scale relative to the largest weight (which fills its track); the\n * percent labels carry the absolute values. Rows are keyed by item id\n * (repeat directive) so a re-render with new weights moves the existing\n * rows; bar widths animate via CSS, re-sorting is instant.\n *\n * @element weight-bar-chart\n */\n@customElement(\"weight-bar-chart\")\nexport class WeightBarChart extends LitElement {\n /** Items to render as weighted rows, sorted descending by value. */\n @property({ attribute: false }) items: WeightBarItem[] = [];\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .row {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0.5rem 0;\n }\n .label {\n flex: 0 0 5.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n color: var(--ui-text, #0f172a);\n }\n .track {\n flex: 1 1 auto;\n height: 0.75rem;\n background: var(--ui-surface-muted, #f8fafc);\n border-radius:
|
|
1
|
+
{"version":3,"file":"weight-bar-chart.js","sourceRoot":"","sources":["../src/weight-bar-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC;;;;;;;;;GASG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QACL,oEAAoE;QACpC,UAAK,GAAoB,EAAE,CAAC;IAsF9D,CAAC;aApFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuDF;KACF,AA1DqB,CA0DpB;IAEO,MAAM;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,+EAA+E;QAC/E,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACjE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClG,OAAO,IAAI,CAAA;6CAC8B,OAAO;UAC1C,MAAM,CACN,MAAM,EACN,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EACjB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;oCAEY,IAAI,CAAC,KAAK;;iDAEG,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG;;kCAEvC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;;WAEnD,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAtFiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CAA6B;AAFjD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAwF1B","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface WeightBarItem {\n id: string;\n label: string;\n /** Normalized fraction (fractions across all items sum to ~1). */\n value: number;\n}\n\n/**\n * Sorted horizontal bar chart of labeled weights (normalized fractions\n * summing to ~1). Bars sort descending — the order IS the priority ranking.\n * Widths scale relative to the largest weight (which fills its track); the\n * percent labels carry the absolute values. Rows are keyed by item id\n * (repeat directive) so a re-render with new weights moves the existing\n * rows; bar widths animate via CSS, re-sorting is instant.\n *\n * @element weight-bar-chart\n */\n@customElement(\"weight-bar-chart\")\nexport class WeightBarChart extends LitElement {\n /** Items to render as weighted rows, sorted descending by value. */\n @property({ attribute: false }) items: WeightBarItem[] = [];\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .row {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0.5rem 0;\n }\n .label {\n flex: 0 0 5.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n color: var(--ui-text, #0f172a);\n }\n .track {\n flex: 1 1 auto;\n height: 0.75rem;\n background: var(--ui-surface-muted, #f8fafc);\n border-radius: var(--ui-radius-sm, 0.25rem);\n overflow: hidden;\n }\n .bar {\n height: 100%;\n /* Match map-circle's 30% white/black vertical depth while preserving token overrides. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--ui-primary, #4f46e5) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--ui-primary, #4f46e5) 70%, #000000) 100%\n );\n border-radius: 0 var(--ui-radius-sm, 0.25rem) var(--ui-radius-sm, 0.25rem) 0;\n transition: width 150ms ease-out;\n }\n .pct {\n flex: 0 0 2.5rem;\n text-align: right;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-variant-numeric: tabular-nums;\n color: var(--ui-text-muted, #64748b);\n }\n @media (prefers-reduced-motion: reduce) {\n .bar {\n transition: none;\n }\n }\n `,\n ];\n\n override render() {\n if (this.items.length === 0) return null;\n // Stable sort: ties keep the incoming item order, so the chart never flickers.\n const sorted = [...this.items].sort((a, b) => b.value - a.value);\n const max = Math.max(0.01, ...sorted.map((item) => item.value));\n const summary = sorted.map((item) => `${item.label} ${Math.round(item.value * 100)}%`).join(\", \");\n return html`\n <div role=\"img\" aria-label=\"Weights: ${summary}\">\n ${repeat(\n sorted,\n (item) => item.id,\n (item) => html`\n <div class=\"row\">\n <span class=\"label\">${item.label}</span>\n <div class=\"track\">\n <div class=\"bar\" style=\"width: ${(item.value / max) * 100}%\"></div>\n </div>\n <span class=\"pct\">${Math.round(item.value * 100)}%</span>\n </div>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"weight-bar-chart\": WeightBarChart;\n }\n}\n"]}
|
package/docs/design-language.md
CHANGED
|
@@ -38,6 +38,19 @@ defines the details used when creating or reviewing components.
|
|
|
38
38
|
the active tab's `--ui-primary` line drawn on top of it) rather than
|
|
39
39
|
introducing a new token — the same precedent as `ui-button`'s `secondary`
|
|
40
40
|
variant, which is realized via `--ui-border`/`--ui-text-muted`, not a hue.
|
|
41
|
+
- `--ui-ai-1`…`--ui-ai-4` are the one multi-hue family: the stops of
|
|
42
|
+
`ui-button[ai]`'s animated ring, where the rainbow itself is the meaning
|
|
43
|
+
("this action is AI-powered") rather than a semantic state. They are only
|
|
44
|
+
ever used together, as a sweep around a control's edge — never as a fill,
|
|
45
|
+
text, or border color.
|
|
46
|
+
- The AI ring composes with every variant and both themes with one exception:
|
|
47
|
+
do not pair `ai` with `pill` under the gradient theme. The gradient theme
|
|
48
|
+
defines a button through a darker border edge plus a glossy top highlight,
|
|
49
|
+
and a pill's fully-rounded silhouette sits flush against the ring along its
|
|
50
|
+
whole outline, so that edge and gloss read as part of the rainbow instead
|
|
51
|
+
of the button, and the fill stops reading as a gradient. Gradient-theme AI
|
|
52
|
+
buttons keep the default `--ui-radius-sm` corners; `ai` + `pill` is a flat
|
|
53
|
+
theme combination.
|
|
41
54
|
|
|
42
55
|
## Typography
|
|
43
56
|
|
|
@@ -77,6 +90,12 @@ literal values are migrated onto them.
|
|
|
77
90
|
- Use `--ui-radius-sm` (`0.25rem` ≈ 4px) for controls, `--ui-radius`
|
|
78
91
|
(`0.5rem` ≈ 8px) for cards/dialogs/surfaces, and an intentional full
|
|
79
92
|
pill/circle radius only for pill/avatar/marker shapes.
|
|
93
|
+
- Chart bars and their tracks use `--ui-radius-sm` as well — literal `4` on
|
|
94
|
+
SVG `rx` attributes, which can't take `var()` (`percent-bar-chart`,
|
|
95
|
+
`price-history-chart`), or the token in CSS (`distribution-chart`,
|
|
96
|
+
`weight-bar-chart`). A bar is a data mark, not a pill: fully rounded ends
|
|
97
|
+
round away the value being read at short lengths. Genuine pill controls
|
|
98
|
+
(e.g. `range-slider`'s track and thumb) keep their full radius.
|
|
80
99
|
- Compact controls must retain a clear hit target and must not reserve layout
|
|
81
100
|
space for optional content that is absent.
|
|
82
101
|
|
package/docs/icons.md
CHANGED
|
@@ -63,7 +63,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
63
63
|
| `iconQueueList` | 16px | Queues, backlogs, or ordered work-item lists. |
|
|
64
64
|
| `iconShieldCheck` | 16px | Verified, secure, or trusted states. |
|
|
65
65
|
| `iconShieldExclamation` | 16px | Security warnings, or at-risk/compromised states. |
|
|
66
|
-
| `iconSparkles` | 16px |
|
|
66
|
+
| `iconSparkles` | 16px | An AI-powered action (pairs with ui-button's `ai` ring), a gradient-theme toggle, or a decorative/enhanced visual style. |
|
|
67
67
|
| `iconSpeakerWave` | 18px | An unmuted volume control, e.g. audio-player/video-player's mute toggle. |
|
|
68
68
|
| `iconSpeakerXMark` | 18px | A muted volume state; pair with iconSpeakerWave for the unmuted state. |
|
|
69
69
|
| `iconSquares2x2` | 18px | A grid or kanban-view toggle, or to represent card/tile layouts. |
|
package/docs/radio-cards.md
CHANGED
|
@@ -10,7 +10,11 @@ The selected card's border/radio dot read `--ui-button-accent` (a solid
|
|
|
10
10
|
stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
11
11
|
and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
12
12
|
plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
13
|
-
with `button-group`/`pagination-nav`'s equivalents.
|
|
13
|
+
with `button-group`/`pagination-nav`'s equivalents. That shared value is
|
|
14
|
+
tuned for small controls, so a card — with far more area — blends it 45%
|
|
15
|
+
toward `--ui-surface` rather than taking a second token: the tint stays
|
|
16
|
+
the same hue and gradient, just lighter on light themes (and
|
|
17
|
+
correspondingly deeper on dark ones) than on a button.
|
|
14
18
|
|
|
15
19
|
## Install
|
|
16
20
|
|
|
@@ -66,6 +70,7 @@ _None._
|
|
|
66
70
|
| `--ui-font-weight-semibold` |
|
|
67
71
|
| `--ui-primary` |
|
|
68
72
|
| `--ui-radius-sm` |
|
|
73
|
+
| `--ui-surface` |
|
|
69
74
|
| `--ui-surface-muted` |
|
|
70
75
|
| `--ui-text` |
|
|
71
76
|
| `--ui-text-muted` |
|
package/docs/scroll-to-bottom.md
CHANGED
|
@@ -13,6 +13,12 @@ auto; position: relative`, so the button stays pinned to that container's
|
|
|
13
13
|
own visible corner as its content scrolls, rather than floating over the
|
|
14
14
|
whole page.
|
|
15
15
|
|
|
16
|
+
The control is styled as a standard secondary button (ui-button's
|
|
17
|
+
`secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
|
|
18
|
+
`--ui-button-secondary-*` background/border tokens, so a gradient theme
|
|
19
|
+
carries over) rather than a pill, layered over an opaque `--ui-surface`
|
|
20
|
+
base and an elevation shadow, since it floats above scrolled content.
|
|
21
|
+
|
|
16
22
|
## Install
|
|
17
23
|
|
|
18
24
|
```js
|
|
@@ -57,12 +63,21 @@ _None._
|
|
|
57
63
|
| Custom property |
|
|
58
64
|
| --- |
|
|
59
65
|
| `--ui-border` |
|
|
66
|
+
| `--ui-button-highlight` |
|
|
67
|
+
| `--ui-button-secondary-` |
|
|
68
|
+
| `--ui-button-secondary-background` |
|
|
69
|
+
| `--ui-button-secondary-background-active` |
|
|
70
|
+
| `--ui-button-secondary-background-hover` |
|
|
71
|
+
| `--ui-button-secondary-border` |
|
|
72
|
+
| `--ui-button-secondary-border-hover` |
|
|
60
73
|
| `--ui-focus-ring` |
|
|
61
74
|
| `--ui-font` |
|
|
62
75
|
| `--ui-font-size-sm` |
|
|
63
76
|
| `--ui-font-weight-medium` |
|
|
64
77
|
| `--ui-line-height-tight` |
|
|
78
|
+
| `--ui-radius-sm` |
|
|
65
79
|
| `--ui-shadow` |
|
|
66
80
|
| `--ui-surface` |
|
|
67
81
|
| `--ui-surface-muted` |
|
|
68
82
|
| `--ui-text` |
|
|
83
|
+
| `--ui-text-muted` |
|
package/docs/scroll-to-top.md
CHANGED
|
@@ -13,6 +13,12 @@ auto; position: relative`, so the button stays pinned to that container's
|
|
|
13
13
|
own visible corner as its content scrolls, rather than floating over the
|
|
14
14
|
whole page.
|
|
15
15
|
|
|
16
|
+
The control is styled as a standard secondary button (ui-button's
|
|
17
|
+
`secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
|
|
18
|
+
`--ui-button-secondary-*` background/border tokens, so a gradient theme
|
|
19
|
+
carries over) rather than a pill, layered over an opaque `--ui-surface`
|
|
20
|
+
base and an elevation shadow, since it floats above scrolled content.
|
|
21
|
+
|
|
16
22
|
## Install
|
|
17
23
|
|
|
18
24
|
```js
|
|
@@ -48,12 +54,21 @@ _None._
|
|
|
48
54
|
| Custom property |
|
|
49
55
|
| --- |
|
|
50
56
|
| `--ui-border` |
|
|
57
|
+
| `--ui-button-highlight` |
|
|
58
|
+
| `--ui-button-secondary-` |
|
|
59
|
+
| `--ui-button-secondary-background` |
|
|
60
|
+
| `--ui-button-secondary-background-active` |
|
|
61
|
+
| `--ui-button-secondary-background-hover` |
|
|
62
|
+
| `--ui-button-secondary-border` |
|
|
63
|
+
| `--ui-button-secondary-border-hover` |
|
|
51
64
|
| `--ui-focus-ring` |
|
|
52
65
|
| `--ui-font` |
|
|
53
66
|
| `--ui-font-size-sm` |
|
|
54
67
|
| `--ui-font-weight-medium` |
|
|
55
68
|
| `--ui-line-height-tight` |
|
|
69
|
+
| `--ui-radius-sm` |
|
|
56
70
|
| `--ui-shadow` |
|
|
57
71
|
| `--ui-surface` |
|
|
58
72
|
| `--ui-surface-muted` |
|
|
59
73
|
| `--ui-text` |
|
|
74
|
+
| `--ui-text-muted` |
|
package/docs/ui-button.md
CHANGED
|
@@ -31,6 +31,28 @@ background/border read the equivalent `--ui-button-secondary-*` tokens
|
|
|
31
31
|
transparent/bordered look, so it can be themed into a matching (e.g.
|
|
32
32
|
white-to-gray) gradient too.
|
|
33
33
|
|
|
34
|
+
`ai` is an orthogonal modifier rather than a fourth variant: it leaves the
|
|
35
|
+
variant's fill (flat or gradient-themed) untouched and only adds an
|
|
36
|
+
animated multi-hue ring *outside* the button box — a crisp masked edge
|
|
37
|
+
plus a blurred bloom behind it that fades out to transparent, so the ring
|
|
38
|
+
melts into the page instead of ending on a hard line. Both layers are
|
|
39
|
+
masked into a donut, so nothing is ever painted over the background or
|
|
40
|
+
label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It
|
|
41
|
+
sweeps slowly at rest, faster on hover and while `busy`, holds still while
|
|
42
|
+
disabled or under `prefers-reduced-motion`, and drops the bloom for a
|
|
43
|
+
solid `CanvasText` ring in forced-colors mode. The bloom reaches about
|
|
44
|
+
`0.5rem` past the control, so give an AI button that much clearance from
|
|
45
|
+
its neighbors and avoid `overflow: hidden` ancestors that would clip it.
|
|
46
|
+
|
|
47
|
+
Do not combine `ai` with `pill` under the gradient theme
|
|
48
|
+
(`data-theme="gradient"`). That theme defines a button through a darker
|
|
49
|
+
`--ui-button-border` edge plus a glossy top highlight; a pill's
|
|
50
|
+
fully-rounded silhouette runs flush against the ring around its entire
|
|
51
|
+
outline, so that border and gloss read as the inner edge of the rainbow
|
|
52
|
+
rather than as the button's own shape, and the vertical gradient fill
|
|
53
|
+
stops reading as a gradient at all. Use `ai` with the default
|
|
54
|
+
`--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.
|
|
55
|
+
|
|
34
56
|
## Install
|
|
35
57
|
|
|
36
58
|
```js
|
|
@@ -46,6 +68,7 @@ import "@f-ewald/components/ui-button.js";
|
|
|
46
68
|
</ui-button>
|
|
47
69
|
<ui-button variant="danger">Delete</ui-button>
|
|
48
70
|
<ui-button variant="secondary" href="/properties?edit=42">Edit</ui-button>
|
|
71
|
+
<ui-button variant="primary" ai>Ask AI</ui-button>
|
|
49
72
|
```
|
|
50
73
|
|
|
51
74
|
## Attributes / properties
|
|
@@ -55,6 +78,7 @@ import "@f-ewald/components/ui-button.js";
|
|
|
55
78
|
| `variant` | `variant` | `ButtonVariant` | `"primary"` | Visual weight. |
|
|
56
79
|
| `size` | `size` | `"sm" | "md"` | `"md"` | Size — `sm` reduces height/padding/font-size one step below the default. |
|
|
57
80
|
| `pill` | `pill` | `boolean` | `false` | Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. |
|
|
81
|
+
| `ai` | `ai` | `boolean` | `false` | Draws the animated multi-hue "AI" ring (crisp edge plus a bloom fading out to transparent) around the button, on top of whatever variant/theme it already uses. |
|
|
58
82
|
| `href` | `href` | `string | null` | `null` | Renders an `<a href="...">` instead of a `<button>` when set. |
|
|
59
83
|
| `type` | `type` | `"button" | "submit" | "reset"` | `"button"` | Native button `type`. Ignored when `href` is set. |
|
|
60
84
|
| `disabled` | `disabled` | `boolean` | `false` | Disables the control and dims it. |
|
|
@@ -75,6 +99,10 @@ _None._
|
|
|
75
99
|
|
|
76
100
|
| Custom property |
|
|
77
101
|
| --- |
|
|
102
|
+
| `--ui-ai-1` |
|
|
103
|
+
| `--ui-ai-2` |
|
|
104
|
+
| `--ui-ai-3` |
|
|
105
|
+
| `--ui-ai-4` |
|
|
78
106
|
| `--ui-border` |
|
|
79
107
|
| `--ui-button-background` |
|
|
80
108
|
| `--ui-button-background-active` |
|
package/docs/weight-bar-chart.md
CHANGED
package/llms.txt
CHANGED
|
@@ -72,7 +72,7 @@ table to pick the icon matching a use case, for consistency across apps:
|
|
|
72
72
|
| `iconQueueList` | 16px | Queues, backlogs, or ordered work-item lists. |
|
|
73
73
|
| `iconShieldCheck` | 16px | Verified, secure, or trusted states. |
|
|
74
74
|
| `iconShieldExclamation` | 16px | Security warnings, or at-risk/compromised states. |
|
|
75
|
-
| `iconSparkles` | 16px |
|
|
75
|
+
| `iconSparkles` | 16px | An AI-powered action (pairs with ui-button's `ai` ring), a gradient-theme toggle, or a decorative/enhanced visual style. |
|
|
76
76
|
| `iconSpeakerWave` | 18px | An unmuted volume control, e.g. audio-player/video-player's mute toggle. |
|
|
77
77
|
| `iconSpeakerXMark` | 18px | A muted volume state; pair with iconSpeakerWave for the unmuted state. |
|
|
78
78
|
| `iconSquares2x2` | 18px | A grid or kanban-view toggle, or to represent card/tile layouts. |
|
|
@@ -1721,13 +1721,17 @@ The selected card's border/radio dot read `--ui-button-accent` (a solid
|
|
|
1721
1721
|
stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
1722
1722
|
and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
1723
1723
|
plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
1724
|
-
with `button-group`/`pagination-nav`'s equivalents.
|
|
1724
|
+
with `button-group`/`pagination-nav`'s equivalents. That shared value is
|
|
1725
|
+
tuned for small controls, so a card — with far more area — blends it 45%
|
|
1726
|
+
toward `--ui-surface` rather than taking a second token: the tint stays
|
|
1727
|
+
the same hue and gradient, just lighter on light themes (and
|
|
1728
|
+
correspondingly deeper on dark ones) than on a button.
|
|
1725
1729
|
|
|
1726
1730
|
Import: `import "@f-ewald/components/radio-cards.js";`
|
|
1727
1731
|
|
|
1728
1732
|
Properties: `options` (JS property only) : RadioCardOption[], default []; `value` (attribute `value`) : string, default ""; `disabled` (attribute `disabled`) : boolean, default false
|
|
1729
1733
|
Events: `change`
|
|
1730
|
-
CSS custom properties: `--ui-border`, `--ui-button-accent`, `--ui-button-highlight`, `--ui-button-secondary-surface-muted`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-regular`, `--ui-font-weight-semibold`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
1734
|
+
CSS custom properties: `--ui-border`, `--ui-button-accent`, `--ui-button-highlight`, `--ui-button-secondary-surface-muted`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-regular`, `--ui-font-weight-semibold`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
1731
1735
|
|
|
1732
1736
|
Example:
|
|
1733
1737
|
```html
|
|
@@ -1872,11 +1876,17 @@ auto; position: relative`, so the button stays pinned to that container's
|
|
|
1872
1876
|
own visible corner as its content scrolls, rather than floating over the
|
|
1873
1877
|
whole page.
|
|
1874
1878
|
|
|
1879
|
+
The control is styled as a standard secondary button (ui-button's
|
|
1880
|
+
`secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
|
|
1881
|
+
`--ui-button-secondary-*` background/border tokens, so a gradient theme
|
|
1882
|
+
carries over) rather than a pill, layered over an opaque `--ui-surface`
|
|
1883
|
+
base and an elevation shadow, since it floats above scrolled content.
|
|
1884
|
+
|
|
1875
1885
|
Import: `import "@f-ewald/components/scroll-to-bottom.js";`
|
|
1876
1886
|
|
|
1877
1887
|
Properties: `target` (JS property only) : HTMLElement | null, default null; `threshold` (attribute `threshold`) : number, default 200; `label` (attribute `label`) : string, default "Scroll to bottom"
|
|
1878
1888
|
Events: `scroll-to-bottom-triggered`
|
|
1879
|
-
CSS custom properties: `--ui-border`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`
|
|
1889
|
+
CSS custom properties: `--ui-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
1880
1890
|
|
|
1881
1891
|
Example:
|
|
1882
1892
|
```html
|
|
@@ -1907,11 +1917,17 @@ auto; position: relative`, so the button stays pinned to that container's
|
|
|
1907
1917
|
own visible corner as its content scrolls, rather than floating over the
|
|
1908
1918
|
whole page.
|
|
1909
1919
|
|
|
1920
|
+
The control is styled as a standard secondary button (ui-button's
|
|
1921
|
+
`secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
|
|
1922
|
+
`--ui-button-secondary-*` background/border tokens, so a gradient theme
|
|
1923
|
+
carries over) rather than a pill, layered over an opaque `--ui-surface`
|
|
1924
|
+
base and an elevation shadow, since it floats above scrolled content.
|
|
1925
|
+
|
|
1910
1926
|
Import: `import "@f-ewald/components/scroll-to-top.js";`
|
|
1911
1927
|
|
|
1912
1928
|
Properties: `target` (JS property only) : HTMLElement | null, default null; `threshold` (attribute `threshold`) : number, default 200; `label` (attribute `label`) : string, default "Scroll to top"
|
|
1913
1929
|
Events: `scroll-to-top-triggered`
|
|
1914
|
-
CSS custom properties: `--ui-border`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`
|
|
1930
|
+
CSS custom properties: `--ui-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
1915
1931
|
|
|
1916
1932
|
Example:
|
|
1917
1933
|
```html
|
|
@@ -2330,11 +2346,33 @@ background/border read the equivalent `--ui-button-secondary-*` tokens
|
|
|
2330
2346
|
transparent/bordered look, so it can be themed into a matching (e.g.
|
|
2331
2347
|
white-to-gray) gradient too.
|
|
2332
2348
|
|
|
2349
|
+
`ai` is an orthogonal modifier rather than a fourth variant: it leaves the
|
|
2350
|
+
variant's fill (flat or gradient-themed) untouched and only adds an
|
|
2351
|
+
animated multi-hue ring *outside* the button box — a crisp masked edge
|
|
2352
|
+
plus a blurred bloom behind it that fades out to transparent, so the ring
|
|
2353
|
+
melts into the page instead of ending on a hard line. Both layers are
|
|
2354
|
+
masked into a donut, so nothing is ever painted over the background or
|
|
2355
|
+
label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It
|
|
2356
|
+
sweeps slowly at rest, faster on hover and while `busy`, holds still while
|
|
2357
|
+
disabled or under `prefers-reduced-motion`, and drops the bloom for a
|
|
2358
|
+
solid `CanvasText` ring in forced-colors mode. The bloom reaches about
|
|
2359
|
+
`0.5rem` past the control, so give an AI button that much clearance from
|
|
2360
|
+
its neighbors and avoid `overflow: hidden` ancestors that would clip it.
|
|
2361
|
+
|
|
2362
|
+
Do not combine `ai` with `pill` under the gradient theme
|
|
2363
|
+
(`data-theme="gradient"`). That theme defines a button through a darker
|
|
2364
|
+
`--ui-button-border` edge plus a glossy top highlight; a pill's
|
|
2365
|
+
fully-rounded silhouette runs flush against the ring around its entire
|
|
2366
|
+
outline, so that border and gloss read as the inner edge of the rainbow
|
|
2367
|
+
rather than as the button's own shape, and the vertical gradient fill
|
|
2368
|
+
stops reading as a gradient at all. Use `ai` with the default
|
|
2369
|
+
`--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.
|
|
2370
|
+
|
|
2333
2371
|
Import: `import "@f-ewald/components/ui-button.js";`
|
|
2334
2372
|
|
|
2335
|
-
Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `size` (attribute `size`) : "sm" | "md", default "md"; `pill` (attribute `pill`) : boolean, default false; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
|
|
2373
|
+
Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `size` (attribute `size`) : "sm" | "md", default "md"; `pill` (attribute `pill`) : boolean, default false; `ai` (attribute `ai`) : boolean, default false; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
|
|
2336
2374
|
Events: none
|
|
2337
|
-
CSS custom properties: `--ui-border`, `--ui-button-background`, `--ui-button-background-active`, `--ui-button-background-hover`, `--ui-button-border`, `--ui-button-danger-background`, `--ui-button-danger-background-active`, `--ui-button-danger-background-hover`, `--ui-button-danger-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-text-shadow`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
|
|
2375
|
+
CSS custom properties: `--ui-ai-1`, `--ui-ai-2`, `--ui-ai-3`, `--ui-ai-4`, `--ui-border`, `--ui-button-background`, `--ui-button-background-active`, `--ui-button-background-hover`, `--ui-button-border`, `--ui-button-danger-background`, `--ui-button-danger-background-active`, `--ui-button-danger-background-hover`, `--ui-button-danger-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-text-shadow`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
|
|
2338
2376
|
|
|
2339
2377
|
Example:
|
|
2340
2378
|
```html
|
|
@@ -2344,6 +2382,7 @@ Example:
|
|
|
2344
2382
|
</ui-button>
|
|
2345
2383
|
<ui-button variant="danger">Delete</ui-button>
|
|
2346
2384
|
<ui-button variant="secondary" href="/properties?edit=42">Edit</ui-button>
|
|
2385
|
+
<ui-button variant="primary" ai>Ask AI</ui-button>
|
|
2347
2386
|
```
|
|
2348
2387
|
|
|
2349
2388
|
## <ui-checkbox>
|
|
@@ -2433,7 +2472,7 @@ Import: `import "@f-ewald/components/weight-bar-chart.js";`
|
|
|
2433
2472
|
|
|
2434
2473
|
Properties: `items` (JS property only) : WeightBarItem[], default []
|
|
2435
2474
|
Events: none
|
|
2436
|
-
CSS custom properties: `--ui-font`, `--ui-font-size-sm`, `--ui-primary`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
2475
|
+
CSS custom properties: `--ui-font`, `--ui-font-size-sm`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
2437
2476
|
|
|
2438
2477
|
Example:
|
|
2439
2478
|
```html
|