@f-ewald/components 1.40.3 → 1.41.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 +11 -3
- package/custom-elements.json +788 -97
- package/dist/app-shell.js +1 -1
- package/dist/app-shell.js.map +1 -1
- package/dist/blink-cursor.d.ts +27 -0
- package/dist/blink-cursor.d.ts.map +1 -0
- package/dist/blink-cursor.js +78 -0
- package/dist/blink-cursor.js.map +1 -0
- package/dist/code-diff.d.ts +41 -0
- package/dist/code-diff.d.ts.map +1 -0
- package/dist/code-diff.js +161 -0
- package/dist/code-diff.js.map +1 -0
- package/dist/comment-label.d.ts +26 -0
- package/dist/comment-label.d.ts.map +1 -0
- package/dist/comment-label.js +81 -0
- package/dist/comment-label.js.map +1 -0
- package/dist/confirm-dialog.d.ts +12 -6
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +50 -88
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/modal-dialog.d.ts +16 -13
- package/dist/modal-dialog.d.ts.map +1 -1
- package/dist/modal-dialog.js +69 -104
- package/dist/modal-dialog.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/price-history-chart.js +1 -1
- package/dist/price-history-chart.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +23 -17
- package/dist/progress-bar.js.map +1 -1
- package/dist/slide-panel.d.ts +3 -3
- package/dist/slide-panel.d.ts.map +1 -1
- package/dist/slide-panel.js +38 -22
- package/dist/slide-panel.js.map +1 -1
- package/dist/stat-strip.d.ts +30 -0
- package/dist/stat-strip.d.ts.map +1 -0
- package/dist/stat-strip.js +111 -0
- package/dist/stat-strip.js.map +1 -0
- package/dist/step-ladder.d.ts +46 -0
- package/dist/step-ladder.d.ts.map +1 -0
- package/dist/step-ladder.js +175 -0
- package/dist/step-ladder.js.map +1 -0
- package/dist/terminal-block.d.ts +45 -0
- package/dist/terminal-block.d.ts.map +1 -0
- package/dist/terminal-block.js +113 -0
- package/dist/terminal-block.js.map +1 -0
- package/dist/toast-notification.d.ts +7 -0
- package/dist/toast-notification.d.ts.map +1 -1
- package/dist/toast-notification.js +34 -0
- package/dist/toast-notification.js.map +1 -1
- package/dist/tokens.css +60 -1
- package/dist/tokens.d.ts +58 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +135 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.js +2 -2
- package/dist/ui-button.js.map +1 -1
- package/dist/window-chrome.d.ts +34 -0
- package/dist/window-chrome.d.ts.map +1 -0
- package/dist/window-chrome.js +141 -0
- package/dist/window-chrome.js.map +1 -0
- package/docs/app-shell.md +1 -1
- package/docs/blink-cursor.md +45 -0
- package/docs/code-diff.md +64 -0
- package/docs/comment-label.md +49 -0
- package/docs/confirm-dialog.md +4 -3
- package/docs/design-language.md +39 -20
- package/docs/layouts/marketing-landing.md +102 -0
- package/docs/modal-dialog.md +9 -9
- package/docs/photo-gallery.md +1 -1
- package/docs/price-history-chart.md +1 -0
- package/docs/slide-panel.md +2 -2
- package/docs/stat-strip.md +57 -0
- package/docs/step-ladder.md +63 -0
- package/docs/terminal-block.md +69 -0
- package/docs/ui-button.md +2 -0
- package/docs/window-chrome.md +64 -0
- package/llms.txt +225 -18
- package/package.json +1 -1
package/dist/ui-button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,mBAA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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;AAhQ/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA8SpB","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 width: 100%;\n align-items: center;\n justify-content: 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: var(--ui-border-width, 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 /* Layered over an opaque --ui-surface base rather than left flat: the\n secondary background token is transparent by default, and a bordered\n button that lets the page show through reads as broken on any\n surface that isn't plain --ui-surface (a textured or tinted page, an\n image). A themed gradient still paints over the base, so this only\n changes what shows when the token contributes nothing. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\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:\n var(--ui-button-secondary-background-hover, none),\n var(--ui-surface, #ffffff);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n .btn.secondary:active:not(:disabled) {\n background:\n var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),\n var(--ui-surface, #ffffff);\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: var(--ui-radius-pill, 9999px);\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: var(--ui-radius-pill, 9999px);\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"]}
|
|
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;QA8OpC,qBAAqB;QACT,YAAO,GAAkB,SAAS,CAAC;QAC/C,+EAA+E;QACnE,SAAI,GAAgB,IAAI,CAAC;QACrC,2FAA2F;QAC9D,SAAI,GAAG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,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAc;AAhQ/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA8SpB","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 width: 100%;\n align-items: center;\n justify-content: 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: var(--ui-border-width, 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-button-text, 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 /* Layered over an opaque --ui-surface base rather than left flat: the\n secondary background token is transparent by default, and a bordered\n button that lets the page show through reads as broken on any\n surface that isn't plain --ui-surface (a textured or tinted page, an\n image). A themed gradient still paints over the base, so this only\n changes what shows when the token contributes nothing. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\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:\n var(--ui-button-secondary-background-hover, none),\n var(--ui-surface, #ffffff);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n .btn.secondary:active:not(:disabled) {\n background:\n var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),\n var(--ui-surface, #ffffff);\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-button-danger-text, 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: var(--ui-radius-pill, 9999px);\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: var(--ui-radius-pill, 9999px);\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"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Sticky editor/terminal-style chrome bar for the top edge of a page or panel:
|
|
4
|
+
* three decorative traffic-light dots, a filename-style label, and a
|
|
5
|
+
* right-aligned actions slot for controls such as a theme toggle.
|
|
6
|
+
*
|
|
7
|
+
* The text property is named `label` rather than `title`, matching
|
|
8
|
+
* `page-header`'s text-property precedent and avoiding confusion with the
|
|
9
|
+
* global HTML `title` tooltip attribute. The dots are purely decorative, are
|
|
10
|
+
* hidden from assistive technology, and reuse the semantic `--ui-danger`,
|
|
11
|
+
* `--ui-warning`, and `--ui-success` tokens rather than introducing
|
|
12
|
+
* chrome-only colors.
|
|
13
|
+
*
|
|
14
|
+
* It sticks with `position: sticky; top: 0`, so callers must place it at the
|
|
15
|
+
* top of the element that actually scrolls. Its `z-index: 1` is a deliberate
|
|
16
|
+
* plain literal: just enough to keep the bar above in-flow content as it
|
|
17
|
+
* sticks, while staying far below the shared overlay stack (dialogs/popovers
|
|
18
|
+
* start at 100), so it does not participate in `utils/layer-stack.ts`.
|
|
19
|
+
*
|
|
20
|
+
* @element window-chrome
|
|
21
|
+
* @slot actions - Optional right-aligned controls such as theme or view toggles.
|
|
22
|
+
*/
|
|
23
|
+
export declare class WindowChrome extends LitElement {
|
|
24
|
+
/** Filename-style text shown beside the decorative dots. */
|
|
25
|
+
label: string;
|
|
26
|
+
static styles: import("lit").CSSResult[];
|
|
27
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
"window-chrome": WindowChrome;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=window-chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-chrome.d.ts","sourceRoot":"","sources":["../src/window-chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,YAAa,SAAQ,UAAU;IAC1C,4DAA4D;IAChD,KAAK,SAAM;IAEvB,OAAgB,MAAM,4BAgFpB;IAEO,MAAM,yCAcd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { tokens } from "./tokens.js";
|
|
10
|
+
/**
|
|
11
|
+
* Sticky editor/terminal-style chrome bar for the top edge of a page or panel:
|
|
12
|
+
* three decorative traffic-light dots, a filename-style label, and a
|
|
13
|
+
* right-aligned actions slot for controls such as a theme toggle.
|
|
14
|
+
*
|
|
15
|
+
* The text property is named `label` rather than `title`, matching
|
|
16
|
+
* `page-header`'s text-property precedent and avoiding confusion with the
|
|
17
|
+
* global HTML `title` tooltip attribute. The dots are purely decorative, are
|
|
18
|
+
* hidden from assistive technology, and reuse the semantic `--ui-danger`,
|
|
19
|
+
* `--ui-warning`, and `--ui-success` tokens rather than introducing
|
|
20
|
+
* chrome-only colors.
|
|
21
|
+
*
|
|
22
|
+
* It sticks with `position: sticky; top: 0`, so callers must place it at the
|
|
23
|
+
* top of the element that actually scrolls. Its `z-index: 1` is a deliberate
|
|
24
|
+
* plain literal: just enough to keep the bar above in-flow content as it
|
|
25
|
+
* sticks, while staying far below the shared overlay stack (dialogs/popovers
|
|
26
|
+
* start at 100), so it does not participate in `utils/layer-stack.ts`.
|
|
27
|
+
*
|
|
28
|
+
* @element window-chrome
|
|
29
|
+
* @slot actions - Optional right-aligned controls such as theme or view toggles.
|
|
30
|
+
*/
|
|
31
|
+
let WindowChrome = class WindowChrome extends LitElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/** Filename-style text shown beside the decorative dots. */
|
|
35
|
+
this.label = "";
|
|
36
|
+
}
|
|
37
|
+
static { this.styles = [
|
|
38
|
+
tokens,
|
|
39
|
+
css `
|
|
40
|
+
:host {
|
|
41
|
+
display: block;
|
|
42
|
+
position: sticky;
|
|
43
|
+
top: 0;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
47
|
+
background: var(--ui-surface-muted, #f8fafc);
|
|
48
|
+
font-family: var(
|
|
49
|
+
--ui-font,
|
|
50
|
+
ui-sans-serif,
|
|
51
|
+
system-ui,
|
|
52
|
+
sans-serif,
|
|
53
|
+
"Apple Color Emoji",
|
|
54
|
+
"Segoe UI Emoji",
|
|
55
|
+
"Segoe UI Symbol",
|
|
56
|
+
"Noto Color Emoji"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
.chrome {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: 0.5rem;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
padding: 0.5rem 0.75rem;
|
|
65
|
+
}
|
|
66
|
+
.leading {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 0.5rem;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
flex: 1 1 auto;
|
|
72
|
+
}
|
|
73
|
+
.dots {
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 0.25rem;
|
|
77
|
+
flex: 0 0 auto;
|
|
78
|
+
}
|
|
79
|
+
.dot {
|
|
80
|
+
width: 0.75rem;
|
|
81
|
+
height: 0.75rem;
|
|
82
|
+
border-radius: var(--ui-radius-circle, 50%);
|
|
83
|
+
flex: 0 0 auto;
|
|
84
|
+
}
|
|
85
|
+
.dot.danger {
|
|
86
|
+
background: var(--ui-danger, #dc2626);
|
|
87
|
+
}
|
|
88
|
+
.dot.warning {
|
|
89
|
+
background: var(--ui-warning, #d97706);
|
|
90
|
+
}
|
|
91
|
+
.dot.success {
|
|
92
|
+
background: var(--ui-success, #16a34a);
|
|
93
|
+
}
|
|
94
|
+
.label {
|
|
95
|
+
min-width: 0;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
text-overflow: ellipsis;
|
|
98
|
+
white-space: nowrap;
|
|
99
|
+
font-family: var(--ui-font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
|
|
100
|
+
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
101
|
+
font-weight: var(--ui-font-weight-regular, 400);
|
|
102
|
+
line-height: var(--ui-line-height-tight, 1.25);
|
|
103
|
+
color: var(--ui-text-muted, #64748b);
|
|
104
|
+
}
|
|
105
|
+
.actions {
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
margin-left: auto;
|
|
109
|
+
flex: 0 0 auto;
|
|
110
|
+
}
|
|
111
|
+
@media (forced-colors: active) {
|
|
112
|
+
:host {
|
|
113
|
+
border-bottom-color: CanvasText;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`,
|
|
117
|
+
]; }
|
|
118
|
+
render() {
|
|
119
|
+
return html `
|
|
120
|
+
<div class="chrome">
|
|
121
|
+
<div class="leading">
|
|
122
|
+
<span class="dots" aria-hidden="true">
|
|
123
|
+
<span class="dot danger"></span>
|
|
124
|
+
<span class="dot warning"></span>
|
|
125
|
+
<span class="dot success"></span>
|
|
126
|
+
</span>
|
|
127
|
+
${this.label ? html `<span class="label">${this.label}</span>` : nothing}
|
|
128
|
+
</div>
|
|
129
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
130
|
+
</div>
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
__decorate([
|
|
135
|
+
property()
|
|
136
|
+
], WindowChrome.prototype, "label", void 0);
|
|
137
|
+
WindowChrome = __decorate([
|
|
138
|
+
customElement("window-chrome")
|
|
139
|
+
], WindowChrome);
|
|
140
|
+
export { WindowChrome };
|
|
141
|
+
//# sourceMappingURL=window-chrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-chrome.js","sourceRoot":"","sources":["../src/window-chrome.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACL,4DAA4D;QAChD,UAAK,GAAG,EAAE,CAAC;IAmGzB,CAAC;aAjGiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6EF;KACF,AAhFqB,CAgFpB;IAEO,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;;YAQH,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,uBAAuB,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO;;;;KAI5E,CAAC;IACJ,CAAC;CACF,CAAA;AAnGa;IAAX,QAAQ,EAAE;2CAAY;AAFZ,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAqGxB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Sticky editor/terminal-style chrome bar for the top edge of a page or panel:\n * three decorative traffic-light dots, a filename-style label, and a\n * right-aligned actions slot for controls such as a theme toggle.\n *\n * The text property is named `label` rather than `title`, matching\n * `page-header`'s text-property precedent and avoiding confusion with the\n * global HTML `title` tooltip attribute. The dots are purely decorative, are\n * hidden from assistive technology, and reuse the semantic `--ui-danger`,\n * `--ui-warning`, and `--ui-success` tokens rather than introducing\n * chrome-only colors.\n *\n * It sticks with `position: sticky; top: 0`, so callers must place it at the\n * top of the element that actually scrolls. Its `z-index: 1` is a deliberate\n * plain literal: just enough to keep the bar above in-flow content as it\n * sticks, while staying far below the shared overlay stack (dialogs/popovers\n * start at 100), so it does not participate in `utils/layer-stack.ts`.\n *\n * @element window-chrome\n * @slot actions - Optional right-aligned controls such as theme or view toggles.\n */\n@customElement(\"window-chrome\")\nexport class WindowChrome extends LitElement {\n /** Filename-style text shown beside the decorative dots. */\n @property() label = \"\";\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: sticky;\n top: 0;\n z-index: 1;\n box-sizing: border-box;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface-muted, #f8fafc);\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 }\n .chrome {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n padding: 0.5rem 0.75rem;\n }\n .leading {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n flex: 1 1 auto;\n }\n .dots {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .dot {\n width: 0.75rem;\n height: 0.75rem;\n border-radius: var(--ui-radius-circle, 50%);\n flex: 0 0 auto;\n }\n .dot.danger {\n background: var(--ui-danger, #dc2626);\n }\n .dot.warning {\n background: var(--ui-warning, #d97706);\n }\n .dot.success {\n background: var(--ui-success, #16a34a);\n }\n .label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: var(--ui-font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n }\n .actions {\n display: flex;\n align-items: center;\n margin-left: auto;\n flex: 0 0 auto;\n }\n @media (forced-colors: active) {\n :host {\n border-bottom-color: CanvasText;\n }\n }\n `,\n ];\n\n override render() {\n return html`\n <div class=\"chrome\">\n <div class=\"leading\">\n <span class=\"dots\" aria-hidden=\"true\">\n <span class=\"dot danger\"></span>\n <span class=\"dot warning\"></span>\n <span class=\"dot success\"></span>\n </span>\n ${this.label ? html`<span class=\"label\">${this.label}</span>` : nothing}\n </div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"window-chrome\": WindowChrome;\n }\n}\n"]}
|
package/docs/app-shell.md
CHANGED
|
@@ -105,7 +105,6 @@ _None._
|
|
|
105
105
|
| `--ui-focus-ring` |
|
|
106
106
|
| `--ui-font-size-sm` |
|
|
107
107
|
| `--ui-line-height-tight` |
|
|
108
|
-
| `--ui-on-accent` |
|
|
109
108
|
| `--ui-overlay` |
|
|
110
109
|
| `--ui-radius-sm` |
|
|
111
110
|
| `--ui-shadow` |
|
|
@@ -114,3 +113,4 @@ _None._
|
|
|
114
113
|
| `--ui-surface-muted` |
|
|
115
114
|
| `--ui-text-muted` |
|
|
116
115
|
| `--ui-tooltip` |
|
|
116
|
+
| `--ui-tooltip-text` |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# `<blink-cursor>`
|
|
2
|
+
|
|
3
|
+
A small inline blinking cursor glyph for terminal- or editor-styled
|
|
4
|
+
headings, prompts, and status lines. It renders its own decorative
|
|
5
|
+
character so consumers can append it directly to adjacent text while
|
|
6
|
+
inheriting the surrounding typography.
|
|
7
|
+
|
|
8
|
+
The cursor uses the shared `--ui-primary` accent color so it reads as an
|
|
9
|
+
active insertion point across themes. Change `char` to swap the glyph (for
|
|
10
|
+
example `|` or `▋`). Under `prefers-reduced-motion` the blink stops and the
|
|
11
|
+
cursor remains visible.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import "@f-ewald/components/blink-cursor.js";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<h1>ponytail<blink-cursor></blink-cursor></h1>
|
|
23
|
+
<p>~/ponytail ❯ <blink-cursor char="|"></blink-cursor></p>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Attributes / properties
|
|
27
|
+
|
|
28
|
+
| Property | Attribute | Type | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| `char` | `char` | `string` | `"▋"` | Character shown for the cursor; any single character or short string such as `|` or `▋` works. |
|
|
31
|
+
|
|
32
|
+
## Events
|
|
33
|
+
|
|
34
|
+
_None._
|
|
35
|
+
|
|
36
|
+
## Slots
|
|
37
|
+
|
|
38
|
+
_None._
|
|
39
|
+
|
|
40
|
+
## CSS custom properties
|
|
41
|
+
|
|
42
|
+
| Custom property |
|
|
43
|
+
| --- |
|
|
44
|
+
| `--ui-line-height-glyph` |
|
|
45
|
+
| `--ui-primary` |
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# `<code-diff>`
|
|
2
|
+
|
|
3
|
+
A compact, read-only code diff viewer: a bordered panel with a header bar
|
|
4
|
+
for `filename` and `stat`, followed by a numbered `<pre>` listing of
|
|
5
|
+
`lines`. Each CodeDiffLine renders as `"add"`, `"del"`, or
|
|
6
|
+
`"context"` with fixed `"+ "` / `"- "` / `" "` prefixes so the diff
|
|
7
|
+
remains understandable even when color is unavailable.
|
|
8
|
+
|
|
9
|
+
Added and removed rows reuse `--ui-success` / `--ui-danger` for their text
|
|
10
|
+
and low-alpha background washes, while the shell itself reuses
|
|
11
|
+
`--ui-font-mono`, `--ui-border`, and `--ui-surface`. The caller owns the
|
|
12
|
+
data shape entirely: `filename` and `stat` are passed through verbatim, and
|
|
13
|
+
`lines` is a flat ordered array of `{ type, text }` objects.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import "@f-ewald/components/code-diff.js";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<code-diff filename="cache.py" stat="−48 +1"></code-diff>
|
|
25
|
+
<script type="module">
|
|
26
|
+
document.querySelector("code-diff").lines = [
|
|
27
|
+
{ type: "del", text: "class CacheManager:" },
|
|
28
|
+
{ type: "add", text: "@lru_cache(maxsize=1000)" },
|
|
29
|
+
];
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Attributes / properties
|
|
34
|
+
|
|
35
|
+
| Property | Attribute | Type | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- | --- |
|
|
37
|
+
| `filename` | `filename` | `string` | `""` | The filename shown in the header bar's left side. |
|
|
38
|
+
| `stat` | `stat` | `string` | `""` | The caller-supplied stat summary shown in the header bar's right side. |
|
|
39
|
+
| `lines` | `lines` | `CodeDiffLine[]` | `[]` | Ordered diff lines, each rendered with its type-driven prefix and styling. |
|
|
40
|
+
|
|
41
|
+
## Events
|
|
42
|
+
|
|
43
|
+
_None._
|
|
44
|
+
|
|
45
|
+
## Slots
|
|
46
|
+
|
|
47
|
+
_None._
|
|
48
|
+
|
|
49
|
+
## CSS custom properties
|
|
50
|
+
|
|
51
|
+
| Custom property |
|
|
52
|
+
| --- |
|
|
53
|
+
| `--ui-border` |
|
|
54
|
+
| `--ui-border-width` |
|
|
55
|
+
| `--ui-danger` |
|
|
56
|
+
| `--ui-font-mono` |
|
|
57
|
+
| `--ui-font-size-sm` |
|
|
58
|
+
| `--ui-line-height-normal` |
|
|
59
|
+
| `--ui-numeric` |
|
|
60
|
+
| `--ui-radius` |
|
|
61
|
+
| `--ui-success` |
|
|
62
|
+
| `--ui-surface` |
|
|
63
|
+
| `--ui-text` |
|
|
64
|
+
| `--ui-text-muted` |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# `<comment-label>`
|
|
2
|
+
|
|
3
|
+
A code-comment-style eyebrow line for section chrome in terminal- or
|
|
4
|
+
editor-themed pages. It renders a colored comment marker (`##` by default)
|
|
5
|
+
before muted slotted text, so `<comment-label>the_whole_idea</comment-label>`
|
|
6
|
+
reads like a short section kicker. Set `prefix="//"` and `italic` for a
|
|
7
|
+
closing or footer quote line that keeps the marker upright while the message
|
|
8
|
+
itself turns italic.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@f-ewald/components/comment-label.js";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<comment-label>the_whole_idea</comment-label>
|
|
20
|
+
<comment-label prefix="//" italic>the best code is the code never written.</comment-label>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Attributes / properties
|
|
24
|
+
|
|
25
|
+
| Property | Attribute | Type | Default | Description |
|
|
26
|
+
| --- | --- | --- | --- | --- |
|
|
27
|
+
| `prefix` | `prefix` | `string` | `"##"` | Comment marker rendered before the slotted label text. |
|
|
28
|
+
| `italic` | `italic` | `boolean` | `false` | Renders the slotted label text in italics while leaving the prefix upright. |
|
|
29
|
+
|
|
30
|
+
## Events
|
|
31
|
+
|
|
32
|
+
_None._
|
|
33
|
+
|
|
34
|
+
## Slots
|
|
35
|
+
|
|
36
|
+
_None._
|
|
37
|
+
|
|
38
|
+
## CSS custom properties
|
|
39
|
+
|
|
40
|
+
| Custom property |
|
|
41
|
+
| --- |
|
|
42
|
+
| `--ui-font-mono` |
|
|
43
|
+
| `--ui-font-size-sm` |
|
|
44
|
+
| `--ui-font-weight-semibold` |
|
|
45
|
+
| `--ui-label-transform` |
|
|
46
|
+
| `--ui-line-height-tight` |
|
|
47
|
+
| `--ui-primary` |
|
|
48
|
+
| `--ui-text-muted` |
|
|
49
|
+
| `--ui-tracking-wide` |
|
package/docs/confirm-dialog.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# `<confirm-dialog>`
|
|
2
2
|
|
|
3
|
-
Reusable confirmation dialog:
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Reusable confirmation dialog: a native modal `<dialog>` (top layer, inert
|
|
4
|
+
page behind it, built-in focus containment) with a slotted body, an
|
|
5
|
+
optional error line, and Cancel/Confirm actions. Instant open/close (no
|
|
6
|
+
transitions). Fires `confirm`/`cancel`
|
|
6
7
|
(bubbling, composed) instead of owning any deletion logic itself —
|
|
7
8
|
callers stay in charge of the request. Set `size="sm"` for compact
|
|
8
9
|
actions one step below the default, matching `ui-button`'s `sm` size.
|
package/docs/design-language.md
CHANGED
|
@@ -24,29 +24,41 @@ defines the details used when creating or reviewing components.
|
|
|
24
24
|
- Themes are single-valued and mutually exclusive, selected by `data-theme` on
|
|
25
25
|
`<html>`: `dark` and `light` force one of the two flat palettes, `gradient`
|
|
26
26
|
glosses buttons and toasts, `metro` squares corners and flattens shadows over
|
|
27
|
-
a blue accent,
|
|
27
|
+
a blue accent, `blueprint` restyles the palette as a monospace technical
|
|
28
28
|
spec sheet — ink on paper, one pure-blue accent, square corners, and
|
|
29
|
-
structure carried by 1.5px hairline rules instead of shadows
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
structure carried by 1.5px hairline rules instead of shadows — and
|
|
30
|
+
`developer-dark`/`developer-light` restyle it as a monospace editor/terminal
|
|
31
|
+
theme — a near-black warm palette (or its light counterpart) with one green
|
|
32
|
+
accent, small (not squared) corners, and chrome micro-labels left in
|
|
33
|
+
sentence case rather than shouted.
|
|
34
|
+
`dark`/`developer-dark` aside, each is layered on the light palette and must
|
|
35
|
+
be excluded from `tokens.css`'s `prefers-color-scheme: dark` media query —
|
|
36
|
+
that selector outranks a bare `[data-theme]`, so a missing exclusion yields
|
|
37
|
+
a half-dark hybrid rather than an outright failure. Adding a theme layered on
|
|
38
|
+
the light palette therefore means adding it to `lightThemes` in
|
|
39
|
+
`generate-tokens-css.mjs`, which derives both the block and the exclusion
|
|
40
|
+
from that one list. Adding a second *true dark* theme (like
|
|
41
|
+
`developer-dark`) instead means adding it to `darkThemes`, which layers the
|
|
42
|
+
theme's overrides over `darkTokenValues` and needs no such exclusion, since
|
|
43
|
+
its own `[data-theme]` block already outranks the bare `:root` the media
|
|
44
|
+
query types into regardless of the reader's OS preference.
|
|
36
45
|
- Colors are the normal subject of a theme. Three other axes are themeable, each
|
|
37
46
|
introduced by exactly one theme and each defaulting to the behavior that
|
|
38
47
|
predates it:
|
|
39
|
-
- **Shape** — `metro` and `blueprint` set every `--ui-radius*` to `0
|
|
48
|
+
- **Shape** — `metro` and `blueprint` set every `--ui-radius*` to `0`;
|
|
49
|
+
`developer-dark`/`developer-light` set `--ui-radius`/`--ui-radius-sm` to a
|
|
50
|
+
small but non-zero step (`0.25rem`/`0.125rem`) rather than squaring them.
|
|
40
51
|
- **Border weight** — `--ui-border-width` (`1px`), which `blueprint` takes to
|
|
41
52
|
`1.5px`. Every genuine surface or control border reads it; see "Borders"
|
|
42
53
|
below for what is deliberately excluded.
|
|
43
54
|
- **Label case** — `--ui-label-transform` (`none`), which `blueprint` takes to
|
|
44
|
-
`uppercase`, and `--ui-numeric` (`normal`), which
|
|
45
|
-
`tabular-nums`.
|
|
55
|
+
`uppercase`, and `--ui-numeric` (`normal`), which `blueprint` and
|
|
56
|
+
`developer-dark`/`developer-light` take to `tabular-nums`.
|
|
46
57
|
- **Type family** — `--ui-font` only. `blueprint` retargets it to a monospace
|
|
47
|
-
stack led by "Space Mono",
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
stack led by "Space Mono", and `developer-dark`/`developer-light` retarget
|
|
59
|
+
it to one led by "JetBrains Mono" — both fall through to the system mono
|
|
60
|
+
stack when no webfont is loaded, so the theme still renders correctly with
|
|
61
|
+
zero external CSS.
|
|
50
62
|
Type *metrics* — size, weight, line height, tracking — are never themed in any
|
|
51
63
|
theme: they encode hierarchy rather than style.
|
|
52
64
|
- Semantic states use `primary`, `info`, `success`, `warning`, and `danger`.
|
|
@@ -106,8 +118,10 @@ defines the details used when creating or reviewing components.
|
|
|
106
118
|
applies to states that already resolve to an opaque value
|
|
107
119
|
(`--ui-button-secondary-surface-muted`, `--ui-surface-muted`), nor to
|
|
108
120
|
elements that draw a *line* or a *mark* rather than a surface —
|
|
109
|
-
`content-divider`'s rule, `calendar-month`'s entry underline,
|
|
110
|
-
`app-sidebar`'s footer, which sits on the sidebar's own paper
|
|
121
|
+
`content-divider`'s rule, `calendar-month`'s entry underline,
|
|
122
|
+
`app-sidebar`'s footer, which sits on the sidebar's own paper, and
|
|
123
|
+
`step-ladder`'s rung border, which separates rows the same way
|
|
124
|
+
`content-divider`'s rule does. Those four
|
|
111
125
|
are the allowlist in `design-tests/opaque-surfaces.spec.ts`, which walks
|
|
112
126
|
every shadow root under the blueprint theme and fails on any bordered,
|
|
113
127
|
see-through surface that is not one of them.
|
|
@@ -411,10 +425,15 @@ backbone, and `app-sidebar`, `action-bar`, `page-header`, `pagination-nav`, and
|
|
|
411
425
|
|
|
412
426
|
### Templates
|
|
413
427
|
|
|
414
|
-
The recipes under `docs/layouts/` compose these into
|
|
415
|
-
list + detail, detail-only, and
|
|
416
|
-
`get_layout` tools serve them. Add a page by adding a
|
|
417
|
-
recipe and, ideally, a matching full-page demo under
|
|
428
|
+
The recipes under `docs/layouts/` compose these into five pages — list-only,
|
|
429
|
+
list + detail, detail-only, form, and marketing-landing — and the MCP
|
|
430
|
+
`list_layouts` / `get_layout` tools serve them. Add a page by adding a
|
|
431
|
+
`docs/layouts/<name>.md` recipe and, ideally, a matching full-page demo under
|
|
432
|
+
`demo/layouts/`. Not every recipe is an `app-shell` dashboard page:
|
|
433
|
+
`marketing-landing` is shell-less — a `window-chrome`-topped page built
|
|
434
|
+
directly from section components (`code-diff`, `step-ladder`, `stat-strip`,
|
|
435
|
+
`terminal-block`, etc.), for a marketing/landing-page context rather than an
|
|
436
|
+
authenticated app view.
|
|
418
437
|
|
|
419
438
|
## Playground and documentation
|
|
420
439
|
|