@f-ewald/components 1.39.0 → 1.40.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 +48 -0
- package/custom-elements.json +1046 -131
- package/dist/address-autocomplete.js +2 -2
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/app-shell.js +4 -4
- package/dist/app-shell.js.map +1 -1
- package/dist/app-sidebar.js +2 -2
- package/dist/app-sidebar.js.map +1 -1
- package/dist/audio-player.js +1 -1
- package/dist/audio-player.js.map +1 -1
- package/dist/autocomplete-input.js +2 -2
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/breadcrumb-nav.d.ts +69 -0
- package/dist/breadcrumb-nav.d.ts.map +1 -0
- package/dist/breadcrumb-nav.js +235 -0
- package/dist/breadcrumb-nav.js.map +1 -0
- package/dist/button-group.js +2 -2
- package/dist/button-group.js.map +1 -1
- package/dist/calendar-day.js +3 -3
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-month.d.ts.map +1 -1
- package/dist/calendar-month.js +4 -1
- package/dist/calendar-month.js.map +1 -1
- package/dist/calendar-week.js +4 -4
- package/dist/calendar-week.js.map +1 -1
- package/dist/chat-message.js +1 -1
- package/dist/chat-message.js.map +1 -1
- package/dist/comment-composer.js +1 -1
- package/dist/comment-composer.js.map +1 -1
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +5 -2
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/content-divider.js +1 -1
- package/dist/content-divider.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +6 -5
- package/dist/cron-schedule.js.map +1 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +3 -2
- package/dist/data-table.js.map +1 -1
- package/dist/dropdown-button.d.ts.map +1 -1
- package/dist/dropdown-button.js +4 -2
- package/dist/dropdown-button.js.map +1 -1
- package/dist/editable-text.js +1 -1
- package/dist/editable-text.js.map +1 -1
- package/dist/empty-state.d.ts +42 -0
- package/dist/empty-state.d.ts.map +1 -0
- package/dist/empty-state.js +172 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/form-field.js +1 -1
- package/dist/form-field.js.map +1 -1
- package/dist/form-select.js +3 -3
- package/dist/form-select.js.map +1 -1
- package/dist/frame-box.js +1 -1
- package/dist/frame-box.js.map +1 -1
- package/dist/fullscreen-button.js +1 -1
- package/dist/fullscreen-button.js.map +1 -1
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban-card.js +1 -1
- package/dist/kanban-card.js.map +1 -1
- package/dist/kanban-column.js +3 -3
- package/dist/kanban-column.js.map +1 -1
- package/dist/kbd-hint.d.ts.map +1 -1
- package/dist/kbd-hint.js +2 -1
- package/dist/kbd-hint.js.map +1 -1
- package/dist/link-card.js +1 -1
- package/dist/link-card.js.map +1 -1
- package/dist/markdown-view.js +3 -3
- package/dist/markdown-view.js.map +1 -1
- package/dist/modal-dialog.js +1 -1
- package/dist/modal-dialog.js.map +1 -1
- package/dist/multi-select.js +5 -5
- package/dist/multi-select.js.map +1 -1
- package/dist/pagination-nav.d.ts.map +1 -1
- package/dist/pagination-nav.js +5 -1
- package/dist/pagination-nav.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/popover-panel.d.ts.map +1 -1
- package/dist/popover-panel.js +4 -2
- package/dist/popover-panel.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +1 -0
- package/dist/progress-bar.js.map +1 -1
- package/dist/radio-cards.js +1 -1
- package/dist/radio-cards.js.map +1 -1
- package/dist/radio-pills.js +1 -1
- package/dist/radio-pills.js.map +1 -1
- package/dist/reveal-button.js +1 -1
- package/dist/reveal-button.js.map +1 -1
- package/dist/scroll-to-bottom.js +1 -1
- package/dist/scroll-to-bottom.js.map +1 -1
- package/dist/scroll-to-top.js +1 -1
- package/dist/scroll-to-top.js.map +1 -1
- package/dist/skip-link.d.ts +30 -0
- package/dist/skip-link.d.ts.map +1 -0
- package/dist/skip-link.js +136 -0
- package/dist/skip-link.js.map +1 -0
- package/dist/slide-panel.js +1 -1
- package/dist/slide-panel.js.map +1 -1
- package/dist/spec-list.d.ts +49 -0
- package/dist/spec-list.d.ts.map +1 -0
- package/dist/spec-list.js +168 -0
- package/dist/spec-list.js.map +1 -0
- package/dist/stat-meter.d.ts.map +1 -1
- package/dist/stat-meter.js +1 -0
- package/dist/stat-meter.js.map +1 -1
- package/dist/tab-bar.js +1 -1
- package/dist/tab-bar.js.map +1 -1
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/tile-grid.js +1 -1
- package/dist/tile-grid.js.map +1 -1
- package/dist/tokens.css +42 -1
- package/dist/tokens.d.ts +50 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +132 -0
- package/dist/tokens.js.map +1 -1
- package/dist/tree-view.js +2 -2
- package/dist/tree-view.js.map +1 -1
- package/dist/ui-admonition.js +1 -1
- package/dist/ui-admonition.js.map +1 -1
- package/dist/ui-button.js +1 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/video-player.js +1 -1
- package/dist/video-player.js.map +1 -1
- package/dist/vote-control.d.ts +40 -0
- package/dist/vote-control.d.ts.map +1 -0
- package/dist/vote-control.js +311 -0
- package/dist/vote-control.js.map +1 -0
- package/docs/address-autocomplete.md +1 -0
- package/docs/app-shell.md +1 -0
- package/docs/app-sidebar.md +1 -0
- package/docs/audio-player.md +1 -0
- package/docs/autocomplete-input.md +1 -0
- package/docs/breadcrumb-nav.md +70 -0
- package/docs/button-group.md +1 -0
- package/docs/calendar-day.md +1 -0
- package/docs/calendar-month.md +1 -0
- package/docs/calendar-week.md +1 -0
- package/docs/chat-message.md +1 -0
- package/docs/comment-composer.md +1 -0
- package/docs/confirm-dialog.md +1 -0
- package/docs/content-divider.md +1 -0
- package/docs/cron-schedule.md +2 -0
- package/docs/data-table.md +2 -0
- package/docs/design-language.md +57 -5
- package/docs/dropdown-button.md +1 -0
- package/docs/editable-text.md +1 -0
- package/docs/empty-state.md +55 -0
- package/docs/form-field.md +1 -0
- package/docs/form-select.md +1 -0
- package/docs/frame-box.md +1 -0
- package/docs/fullscreen-button.md +1 -0
- package/docs/icons.md +1 -0
- package/docs/kanban-card.md +1 -0
- package/docs/kanban-column.md +1 -0
- package/docs/kbd-hint.md +1 -0
- package/docs/link-card.md +1 -0
- package/docs/markdown-view.md +1 -0
- package/docs/modal-dialog.md +1 -0
- package/docs/multi-select.md +1 -0
- package/docs/pagination-nav.md +2 -0
- package/docs/photo-gallery.md +1 -0
- package/docs/popover-panel.md +1 -0
- package/docs/progress-bar.md +1 -0
- package/docs/radio-cards.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/reveal-button.md +1 -0
- package/docs/scroll-to-bottom.md +1 -0
- package/docs/scroll-to-top.md +1 -0
- package/docs/skip-link.md +54 -0
- package/docs/slide-panel.md +1 -0
- package/docs/spec-list.md +71 -0
- package/docs/stat-meter.md +1 -0
- package/docs/tab-bar.md +1 -0
- package/docs/text-area.md +1 -0
- package/docs/tile-grid.md +1 -0
- package/docs/tree-view.md +1 -0
- package/docs/ui-admonition.md +1 -0
- package/docs/ui-button.md +1 -0
- package/docs/video-player.md +1 -0
- package/docs/vote-control.md +73 -0
- package/llms.txt +201 -49
- package/package.json +1 -1
package/dist/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,SAAS;IACT,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kEAAkE;IAClE,0EAA0E;IAC1E,0EAA0E;IAC1E,+BAA+B,EAAE,mDAAmD,EAAE,mBAAmB;IACzG,6BAA6B,EAAE,mDAAmD,EAAE,iBAAiB;IACrG,4BAA4B,EAAE,mDAAmD,EAAE,iBAAiB;IACpG,+BAA+B,EAAE,mDAAmD,EAAE,mBAAmB;IACzG,sBAAsB,EAAE,uCAAuC,EAAE,iDAAiD;IAClH,wBAAwB,EAAE,6BAA6B,EAAE,8CAA8C;CACxG,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,cAAc,EAAE,SAAS,EAAE,+CAA+C;IAC1E,oBAAoB,EAAE,SAAS;IAC/B,iBAAiB,EAAE,mBAAmB,EAAE,wDAAwD;IAChG,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,GAAG;IACrB,kBAAkB,EAAE,GAAG;IACvB,oBAAoB,EAAE,GAAG;IACzB,4EAA4E;IAC5E,0EAA0E;IAC1E,6BAA6B;IAC7B,aAAa,EAAE,gCAAgC;IAC/C,gBAAgB,EAAE,gCAAgC;CACnD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,EAAE,CAAC","sourcesContent":["import { css } from \"lit\";\n\n/**\n * Design token values, sourced from Tailwind v4's default theme palette.\n * Each entry maps a `--ui-*` custom property name to its default value.\n * These are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\n * throughout component styles, so components render correctly with zero\n * external CSS. Consumers may override any of these by setting the custom\n * property on `:root` or an ancestor element (see `tokens.css`).\n */\nexport const tokenValues: Record<string, string> = {\n // Colors\n \"--ui-primary\": \"#4f46e5\", // indigo-600\n \"--ui-primary-hover\": \"#4338ca\", // indigo-700\n // Button-specific background/border hooks: default to the flat --ui-primary\n // / --ui-danger tokens above unchanged, so those stay the single source of\n // truth for every other component. Overriding just these lets a theme opt\n // ui-button into a gradient (or any other) background without touching\n // component markup; --ui-button-border/--ui-button-danger-border default\n // to transparent (today's look) and are meant to be paired with a shade\n // darker than the gradient's dark stop when one is set. The `-active`\n // variants default to whatever `-background` already resolved to (so a\n // solid override still applies while pressed) — a gradient theme should\n // set them to the same stops in reverse, for a pressed/\"indented\" look.\n \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\",\n \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\",\n \"--ui-button-border\": \"transparent\",\n // The bordered, transparent-background secondary variant's equivalents —\n // shared with confirm-dialog's Cancel button, which is the same visual\n // pattern. Defaults reproduce today's literal secondary styling exactly\n // (no background at any state, border colors matching --ui-border /\n // --ui-text-muted), so a theme only needs to override these to make\n // secondary/Cancel buttons match a primary/danger gradient theme.\n \"--ui-button-secondary-background\": \"none\",\n \"--ui-button-secondary-background-hover\": \"none\",\n \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\",\n \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\",\n \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\",\n // A muted-gray surface used wherever something already paints\n // --ui-surface-muted as a state indicator in flat mode — button-group's\n // unchecked-segment hover, pagination-nav's button hover, and\n // radio-cards/radio-pills' checked background — which is a genuinely\n // different default than secondary's borderless flat hover, so it can't\n // reuse --ui-button-secondary-background-hover's \"none\" default.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\",\n // Shared by both primary/danger — a purely cosmetic gloss/legibility pair,\n // not color-specific, so one token covers both variants. `-highlight` is a\n // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for\n // a glossy top edge, defaulting to a fully transparent (so invisible)\n // shadow rather than the keyword `none` — some usages combine it with\n // another literal shadow in a comma-separated list, where a bare `none`\n // item is invalid CSS and would zero out the *whole* declaration.\n // `-text-shadow` is a full text-shadow value for label legibility against\n // a gradient's lighter stop, always used standalone, so it keeps `none`.\n \"--ui-button-highlight\": \"0 0 0 0 transparent\",\n \"--ui-button-text-shadow\": \"none\",\n // A solid stand-in for the same accent, for spots that can't render a\n // background gradient at all — a native <input>'s accent-color only\n // accepts a plain color, and a hard-stop background gradient (e.g.\n // range-slider's filled track) can't nest another gradient inside its own\n // color-stop list. Consumers that theme the buttons into a gradient should\n // set this to the gradient's dark stop, so these non-button accents (radio\n // selection indicators, the range-slider track/thumb) stay visually\n // coordinated with it even though they can't literally paint a gradient.\n \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-info\": \"#0ea5e9\", // sky-500\n \"--ui-info-hover\": \"#0284c7\", // sky-600\n \"--ui-danger\": \"#dc2626\", // red-600\n \"--ui-danger-hover\": \"#b91c1c\", // red-700\n \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\",\n \"--ui-button-danger-background-active\":\n \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\",\n \"--ui-button-danger-border\": \"transparent\",\n \"--ui-success\": \"#16a34a\", // green-600\n \"--ui-warning\": \"#d97706\", // amber-600\n \"--ui-warning-hover\": \"#b45309\", // amber-700\n // toast-notification's per-variant background hooks: default to the flat\n // --ui-success/--ui-danger/--ui-info/--ui-warning tokens unchanged, so\n // those stay the single source of truth for every other component —\n // the same pattern as --ui-button-background/--ui-button-danger-background\n // above. `-highlight`/`-text-shadow` are the same glossy-top-edge /\n // legibility-shadow pair as --ui-button-highlight/--ui-button-text-shadow,\n // kept as separate tokens so a theme can gloss toasts and buttons\n // independently.\n \"--ui-toast-success-background\": \"var(--ui-success, #16a34a)\",\n \"--ui-toast-error-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-toast-info-background\": \"var(--ui-info, #0ea5e9)\",\n \"--ui-toast-warning-background\": \"var(--ui-warning, #d97706)\",\n \"--ui-toast-highlight\": \"0 0 0 0 transparent\",\n \"--ui-toast-text-shadow\": \"none\",\n // AI accent sweep — the four stops of the animated multi-hue ring\n // ui-button's `ai` modifier draws around a button (and the only place a\n // rainbow reads as meaning \"this action is AI-powered\" rather than a\n // semantic state). Ordered around the color wheel and looping back to\n // stop 1, so the sweep is seamless; --ui-ai-2 is --ui-primary's own\n // indigo, anchoring the ring to the rest of the palette. Overriding these\n // four retunes every AI button at once.\n \"--ui-ai-1\": \"#38bdf8\", // sky-400\n \"--ui-ai-2\": \"#6366f1\", // indigo-500\n \"--ui-ai-3\": \"#d946ef\", // fuchsia-500\n \"--ui-ai-4\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#0f172a\", // slate-900\n \"--ui-text-muted\": \"#64748b\", // slate-500\n \"--ui-border\": \"#e2e8f0\", // slate-200\n \"--ui-surface\": \"#ffffff\", // white\n \"--ui-surface-muted\": \"#f8fafc\", // slate-50\n \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash\n \"--ui-tooltip\": \"#0f172a\", // slate-900\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\",\n \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45%\n\n // Shape / depth\n \"--ui-radius\": \"0.5rem\", // rounded-lg\n \"--ui-radius-sm\": \"0.25rem\", // rounded\n // Deliberate pill/circle shapes — a chip, an avatar, a slider thumb, a dot.\n // Tokenized rather than hardcoded so a theme that squares the design system\n // (metro) can reach them too; a literal 9999px/50% silently opts that shape\n // out of every theme. Use these only where the shape is the point, not as a\n // heavier --ui-radius.\n \"--ui-radius-pill\": \"9999px\",\n \"--ui-radius-circle\": \"50%\",\n \"--ui-shadow\":\n \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md\n \"--ui-shadow-lg\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl\n \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\",\n\n // Type\n \"--ui-font\":\n 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n \"--ui-font-mono\":\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\",\n \"--ui-font-size-lg\": \"1rem\", // text-base\n \"--ui-font-size\": \"0.875rem\", // text-sm\n \"--ui-font-size-sm\": \"0.75rem\", // text-xs\n \"--ui-font-size-xs\": \"0.6875rem\",\n\n // Font weights — the only four weights the system uses.\n \"--ui-font-weight-regular\": \"400\",\n \"--ui-font-weight-medium\": \"500\",\n \"--ui-font-weight-semibold\": \"600\",\n \"--ui-font-weight-bold\": \"700\",\n\n // Line heights — glyph (icon/marker box), tight (headings), normal (body).\n \"--ui-line-height-glyph\": \"1\",\n \"--ui-line-height-tight\": \"1.25\",\n \"--ui-line-height-normal\": \"1.5\",\n\n // Letter spacing / tracking — default and the single widened step.\n \"--ui-tracking-normal\": \"0\",\n \"--ui-tracking-wide\": \"0.04em\",\n};\n\n/**\n * Dark-mode overrides for the same `--ui-*` custom properties, applied by\n * `tokens.css` via `@media (prefers-color-scheme: dark)` and `[data-theme]`\n * (see generate-tokens-css.mjs). Same Tailwind slate scale as the light\n * palette, inverted, with primary/danger/success lightened one step (500\n * instead of 600) for sufficient contrast against dark surfaces. Shape/type\n * tokens are theme-independent and not repeated here.\n */\nexport const darkTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#6366f1\", // indigo-500\n \"--ui-primary-hover\": \"#818cf8\", // indigo-400\n \"--ui-info\": \"#38bdf8\", // sky-400\n \"--ui-info-hover\": \"#7dd3fc\", // sky-300\n \"--ui-danger\": \"#ef4444\", // red-500\n \"--ui-danger-hover\": \"#f87171\", // red-400\n \"--ui-success\": \"#22c55e\", // green-500\n \"--ui-warning\": \"#f59e0b\", // amber-500\n \"--ui-warning-hover\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#f1f5f9\", // slate-100\n \"--ui-text-muted\": \"#94a3b8\", // slate-400\n \"--ui-border\": \"#334155\", // slate-700\n \"--ui-surface\": \"#0f172a\", // slate-900\n \"--ui-surface-muted\": \"#1e293b\", // slate-800\n \"--ui-highlight\": \"#854d0e\", // amber-800 — transient \"just changed\" flash on dark\n \"--ui-tooltip\": \"#020617\", // slate-950\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.12)\",\n \"--ui-overlay\": \"rgb(2 6 23 / 0.6)\", // slate-950 / 60%\n \"--ui-focus-ring\": \"0 0 0 3px rgb(99 102 241 / 0.45)\",\n};\n\n/**\n * \"Gradient\" theme overrides, applied via `data-theme=\"gradient\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like the\n * `\"light\"` override and layers a glossy gradient look on top of the flat\n * light palette, using exactly the `--ui-button-*`/`--ui-button-danger-*`/\n * `--ui-button-secondary-*` hooks `ui-button.ts` already reads (see that\n * file's doc comment), plus the `--ui-toast-*` hooks `toast-notification.ts`\n * reads (see its doc comment). Every other token (`--ui-text`, `--ui-surface`,\n * …) is left at its light-mode default — this theme only glosses buttons and\n * toasts by design. Each variant's gradient runs light-to-dark top-to-bottom\n * (`180deg`) across one Tailwind shade step lighter/darker than the flat\n * token so it still reads as \"the same color, glossy\" rather than a\n * different hue; `-hover` shifts the whole pair one shade lighter, `-active`\n * reverses the two stops for a pressed/\"indented\" look, and `-border` is a\n * shade darker than the gradient's dark stop for a defining edge.\n */\nexport const gradientTokenValues: Record<string, string> = {\n \"--ui-button-background\": \"linear-gradient(180deg, #6366f1 0%, #4f46e5 100%)\", // indigo-500 -> 600\n \"--ui-button-background-hover\": \"linear-gradient(180deg, #818cf8 0%, #6366f1 100%)\", // indigo-400 -> 500\n \"--ui-button-background-active\": \"linear-gradient(180deg, #4f46e5 0%, #6366f1 100%)\", // reversed 600 -> 500\n \"--ui-button-border\": \"#4338ca\", // indigo-700\n \"--ui-button-danger-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-button-danger-background-hover\": \"linear-gradient(180deg, #f87171 0%, #ef4444 100%)\", // red-400 -> 500\n \"--ui-button-danger-background-active\": \"linear-gradient(180deg, #dc2626 0%, #ef4444 100%)\", // reversed 600 -> 500\n \"--ui-button-danger-border\": \"#b91c1c\", // red-700\n // Secondary stays neutral gray rather than a saturated hue, matching its\n // flat \"not the primary action\" role, but one shade darker than the\n // original white -> slate-50 pairing: at a small button size, that pair\n // read as flat white with no visible gradient at all. slate-50 -> 100\n // keeps enough contrast to actually look like a gradient while still\n // being clearly lighter/quieter than primary/danger. Border stays\n // slate-300 (a step past the flat slate-200) so its edge still reads\n // against the fill.\n \"--ui-button-secondary-background\": \"linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)\", // slate-50 -> 100\n \"--ui-button-secondary-background-hover\": \"linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%)\", // slate-100 -> 200\n \"--ui-button-secondary-background-active\": \"linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%)\", // reversed 100 -> 50\n \"--ui-button-secondary-border\": \"#cbd5e1\", // slate-300\n \"--ui-button-secondary-border-hover\": \"#94a3b8\", // slate-400\n // button-group's unchecked segments, pagination-nav's prev/next buttons, and\n // radio-cards/radio-pills' checked background read this rather than\n // --ui-button-secondary-background (see tokens above). Left flat they were\n // the one \"secondary\" surface that stayed matte while every actual secondary\n // button turned glossy, so it tracks the hover gradient rather than a\n // separate literal that could drift out of step with it.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-button-secondary-background-hover)\",\n \"--ui-button-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge\n \"--ui-button-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility on primary/danger\n \"--ui-button-accent\": \"#4338ca\", // indigo-700, matches --ui-button-border\n // toast-notification: same light-to-dark, one-shade-step gradient\n // convention as the button variants above; the bottom stop always matches\n // the flat --ui-success/--ui-danger/--ui-info/--ui-warning value exactly.\n \"--ui-toast-success-background\": \"linear-gradient(180deg, #22c55e 0%, #16a34a 100%)\", // green-500 -> 600\n \"--ui-toast-error-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-toast-info-background\": \"linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%)\", // sky-400 -> 500\n \"--ui-toast-warning-background\": \"linear-gradient(180deg, #f59e0b 0%, #d97706 100%)\", // amber-500 -> 600\n \"--ui-toast-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge, same as --ui-button-highlight\n \"--ui-toast-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility, same as --ui-button-text-shadow\n};\n\n/**\n * \"Metro\" theme overrides, applied via `data-theme=\"metro\"` on `<html>` (see\n * `generate-tokens-css.mjs`) — forces `color-scheme: light` like the `\"light\"`\n * and `\"gradient\"` overrides, and strips the roundness and depth off the flat\n * light palette to leave hard-edged surfaces over a blue accent, after the\n * dense square-cornered look of the early social bookmarking sites.\n *\n * This is the first theme to override shape rather than only color, so the\n * \"shape/type tokens are theme-independent\" rule `darkTokenValues` notes above\n * holds for every theme except this one (see `docs/design-language.md`).\n * Squaring the design system means squaring the deliberate pill and circle\n * shapes too — chips, avatars, dots, slider thumbs — which is why those read\n * `--ui-radius-pill`/`--ui-radius-circle` rather than hardcoding `9999px`/`50%`\n * (a literal would silently opt that shape out of the theme).\n *\n * One residual is genuinely out of reach: `price-history-chart` rounds its bars\n * with an SVG `rx` presentation attribute, which cannot take a `var()`, so\n * those stay slightly rounded under metro.\n *\n * The shadows flatten to a hairline ring rather than to `none`. Dropping them\n * outright would leave `slide-panel` — the only overlay with no border of its\n * own — as an invisible white-on-white edge; every other consumer of\n * `--ui-shadow*` either pairs it with `1px solid var(--ui-border)` or applies\n * it on hover/active over an already-bordered control. A hard 1px ring keeps\n * that separation while removing the blur and the faked depth.\n */\nexport const metroTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#3274d0\", // the del.icio.us blue; no Tailwind equivalent\n \"--ui-primary-hover\": \"#2559a8\",\n \"--ui-focus-ring\": \"0 0 0 2px #3274d0\", // solid and crisp, not the default 3px translucent ring\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n // Hairline rings (slate-900 at low alpha) rather than blurred drop shadows:\n // separation without depth. -lg is a touch stronger, matching the default\n // pair's relative weighting.\n \"--ui-shadow\": \"0 0 0 1px rgb(15 23 42 / 0.12)\",\n \"--ui-shadow-lg\": \"0 0 0 1px rgb(15 23 42 / 0.18)\",\n};\n\n/**\n * Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,\n * re-declaring every token on each component's own host element as a\n * \"materialize the inherited value, or this fallback\" trick. That pattern\n * turned out to be a genuine bug, not a working default: browsers treat\n * `--ui-x: var(--ui-x, ...)` on `:host` as a self-referencing declaration\n * that computes to the guaranteed-invalid value REGARDLESS of what an\n * ancestor (e.g. `:root`) set — the host's own `:host` rule wins the cascade\n * over the ancestor's, so this dropped whatever the app actually set and\n * silently substituted the component's own fallback everywhere. It went\n * unnoticed because every component's fallback happened to equal the\n * intended light-mode value — dark mode (a real, different value at\n * `:root`) exposed it immediately (colors rendering as if no theme were\n * applied at all). Fix: don't redeclare tokens on `:host` — plain\n * inheritance already carries `:root`'s values into every shadow root\n * correctly, and every component already has its own `var(--ui-x, fallback)`\n * at each point of use, so nothing here is needed for the \"zero external\n * CSS\" default to keep working. Kept as an empty export so the existing\n * `static override styles = [tokens, css\\`...\\`]` import in every component\n * keeps compiling.\n */\nexport const tokens = css``;\n"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA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,mBAAmB,EAAE,OAAO;IAC5B,sBAAsB,EAAE,WAAW;IACnC,cAAc,EAAE,cAAc;IAC9B,WAAW,EACT,gFAAgF;CACnF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,EAAE,CAAC","sourcesContent":["import { css } from \"lit\";\n\n/**\n * Design token values, sourced from Tailwind v4's default theme palette.\n * Each entry maps a `--ui-*` custom property name to its default value.\n * These are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\n * throughout component styles, so components render correctly with zero\n * external CSS. Consumers may override any of these by setting the custom\n * property on `:root` or an ancestor element (see `tokens.css`).\n */\nexport const tokenValues: Record<string, string> = {\n // Colors\n \"--ui-primary\": \"#4f46e5\", // indigo-600\n \"--ui-primary-hover\": \"#4338ca\", // indigo-700\n // Button-specific background/border hooks: default to the flat --ui-primary\n // / --ui-danger tokens above unchanged, so those stay the single source of\n // truth for every other component. Overriding just these lets a theme opt\n // ui-button into a gradient (or any other) background without touching\n // component markup; --ui-button-border/--ui-button-danger-border default\n // to transparent (today's look) and are meant to be paired with a shade\n // darker than the gradient's dark stop when one is set. The `-active`\n // variants default to whatever `-background` already resolved to (so a\n // solid override still applies while pressed) — a gradient theme should\n // set them to the same stops in reverse, for a pressed/\"indented\" look.\n \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\",\n \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\",\n \"--ui-button-border\": \"transparent\",\n // The bordered, transparent-background secondary variant's equivalents —\n // shared with confirm-dialog's Cancel button, which is the same visual\n // pattern. Defaults reproduce today's literal secondary styling exactly\n // (no background at any state, border colors matching --ui-border /\n // --ui-text-muted), so a theme only needs to override these to make\n // secondary/Cancel buttons match a primary/danger gradient theme.\n \"--ui-button-secondary-background\": \"none\",\n \"--ui-button-secondary-background-hover\": \"none\",\n \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\",\n \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\",\n \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\",\n // A muted-gray surface used wherever something already paints\n // --ui-surface-muted as a state indicator in flat mode — button-group's\n // unchecked-segment hover, pagination-nav's button hover, and\n // radio-cards/radio-pills' checked background — which is a genuinely\n // different default than secondary's borderless flat hover, so it can't\n // reuse --ui-button-secondary-background-hover's \"none\" default.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\",\n // Shared by both primary/danger — a purely cosmetic gloss/legibility pair,\n // not color-specific, so one token covers both variants. `-highlight` is a\n // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for\n // a glossy top edge, defaulting to a fully transparent (so invisible)\n // shadow rather than the keyword `none` — some usages combine it with\n // another literal shadow in a comma-separated list, where a bare `none`\n // item is invalid CSS and would zero out the *whole* declaration.\n // `-text-shadow` is a full text-shadow value for label legibility against\n // a gradient's lighter stop, always used standalone, so it keeps `none`.\n \"--ui-button-highlight\": \"0 0 0 0 transparent\",\n \"--ui-button-text-shadow\": \"none\",\n // A solid stand-in for the same accent, for spots that can't render a\n // background gradient at all — a native <input>'s accent-color only\n // accepts a plain color, and a hard-stop background gradient (e.g.\n // range-slider's filled track) can't nest another gradient inside its own\n // color-stop list. Consumers that theme the buttons into a gradient should\n // set this to the gradient's dark stop, so these non-button accents (radio\n // selection indicators, the range-slider track/thumb) stay visually\n // coordinated with it even though they can't literally paint a gradient.\n \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-info\": \"#0ea5e9\", // sky-500\n \"--ui-info-hover\": \"#0284c7\", // sky-600\n \"--ui-danger\": \"#dc2626\", // red-600\n \"--ui-danger-hover\": \"#b91c1c\", // red-700\n \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\",\n \"--ui-button-danger-background-active\":\n \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\",\n \"--ui-button-danger-border\": \"transparent\",\n \"--ui-success\": \"#16a34a\", // green-600\n \"--ui-warning\": \"#d97706\", // amber-600\n \"--ui-warning-hover\": \"#b45309\", // amber-700\n // toast-notification's per-variant background hooks: default to the flat\n // --ui-success/--ui-danger/--ui-info/--ui-warning tokens unchanged, so\n // those stay the single source of truth for every other component —\n // the same pattern as --ui-button-background/--ui-button-danger-background\n // above. `-highlight`/`-text-shadow` are the same glossy-top-edge /\n // legibility-shadow pair as --ui-button-highlight/--ui-button-text-shadow,\n // kept as separate tokens so a theme can gloss toasts and buttons\n // independently.\n \"--ui-toast-success-background\": \"var(--ui-success, #16a34a)\",\n \"--ui-toast-error-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-toast-info-background\": \"var(--ui-info, #0ea5e9)\",\n \"--ui-toast-warning-background\": \"var(--ui-warning, #d97706)\",\n \"--ui-toast-highlight\": \"0 0 0 0 transparent\",\n \"--ui-toast-text-shadow\": \"none\",\n // AI accent sweep — the four stops of the animated multi-hue ring\n // ui-button's `ai` modifier draws around a button (and the only place a\n // rainbow reads as meaning \"this action is AI-powered\" rather than a\n // semantic state). Ordered around the color wheel and looping back to\n // stop 1, so the sweep is seamless; --ui-ai-2 is --ui-primary's own\n // indigo, anchoring the ring to the rest of the palette. Overriding these\n // four retunes every AI button at once.\n \"--ui-ai-1\": \"#38bdf8\", // sky-400\n \"--ui-ai-2\": \"#6366f1\", // indigo-500\n \"--ui-ai-3\": \"#d946ef\", // fuchsia-500\n \"--ui-ai-4\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#0f172a\", // slate-900\n \"--ui-text-muted\": \"#64748b\", // slate-500\n \"--ui-border\": \"#e2e8f0\", // slate-200\n \"--ui-surface\": \"#ffffff\", // white\n \"--ui-surface-muted\": \"#f8fafc\", // slate-50\n \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash\n \"--ui-tooltip\": \"#0f172a\", // slate-900\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\",\n \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45%\n\n // Shape / depth\n \"--ui-radius\": \"0.5rem\", // rounded-lg\n \"--ui-radius-sm\": \"0.25rem\", // rounded\n // The width of a themeable surface/control border. Spacing is deliberately\n // untokenized, but a border is chrome rather than layout: the `blueprint`\n // theme's whole structure is carried by hairline rules instead of shadows,\n // and it needs those rules one step heavier than the default. Defaults to\n // the literal 1px every component used before, so nothing renders\n // differently until a theme overrides it. Only genuine surface/control\n // borders read this — forced-colors `CanvasText` borders and purely\n // decorative literals (a slider thumb's white ring, a tab's 2px underline)\n // keep their own widths, since those aren't the theme's structural rules.\n // Anything with a fixed height/width and a themeable border must also set\n // `box-sizing: border-box`, or a heavier border grows it past the shared\n // 2rem control target.\n \"--ui-border-width\": \"1px\",\n // Deliberate pill/circle shapes — a chip, an avatar, a slider thumb, a dot.\n // Tokenized rather than hardcoded so a theme that squares the design system\n // (metro) can reach them too; a literal 9999px/50% silently opts that shape\n // out of every theme. Use these only where the shape is the point, not as a\n // heavier --ui-radius.\n \"--ui-radius-pill\": \"9999px\",\n \"--ui-radius-circle\": \"50%\",\n \"--ui-shadow\":\n \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md\n \"--ui-shadow-lg\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl\n \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\",\n\n // Type\n \"--ui-font\":\n 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n \"--ui-font-mono\":\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\",\n \"--ui-font-size-lg\": \"1rem\", // text-base\n \"--ui-font-size\": \"0.875rem\", // text-sm\n \"--ui-font-size-sm\": \"0.75rem\", // text-xs\n \"--ui-font-size-xs\": \"0.6875rem\",\n\n // Font weights — the only four weights the system uses.\n \"--ui-font-weight-regular\": \"400\",\n \"--ui-font-weight-medium\": \"500\",\n \"--ui-font-weight-semibold\": \"600\",\n \"--ui-font-weight-bold\": \"700\",\n\n // Line heights — glyph (icon/marker box), tight (headings), normal (body).\n \"--ui-line-height-glyph\": \"1\",\n \"--ui-line-height-tight\": \"1.25\",\n \"--ui-line-height-normal\": \"1.5\",\n\n // Letter spacing / tracking — default and the single widened step.\n \"--ui-tracking-normal\": \"0\",\n \"--ui-tracking-wide\": \"0.04em\",\n\n // Casing of chrome micro-labels — the small, wide-tracked labels that name a\n // region rather than carry content (a `frame-box` legend, an `app-sidebar`\n // section heading, a `stat-meter` caption). Defaults to `none`, today's\n // sentence case, so nothing changes until a theme sets it; the `blueprint`\n // theme sets `uppercase`, where signage-style labels are the point. Never\n // apply this to user-supplied content — shouting someone's data is not a\n // theme's decision, and `text-transform` is a presentational lie that\n // survives copy/paste as the original casing anyway.\n \"--ui-label-transform\": \"none\",\n\n // Numeral rendering for figures that change in place or stack into a column\n // — a score, a page number, a running clock. Defaults to `normal`\n // (proportional, as before); `tabular-nums` stops digits from jittering\n // horizontally as they tick, which the `blueprint` theme's spec-sheet\n // aesthetic wants everywhere.\n \"--ui-numeric\": \"normal\",\n};\n\n/**\n * Dark-mode overrides for the same `--ui-*` custom properties, applied by\n * `tokens.css` via `@media (prefers-color-scheme: dark)` and `[data-theme]`\n * (see generate-tokens-css.mjs). Same Tailwind slate scale as the light\n * palette, inverted, with primary/danger/success lightened one step (500\n * instead of 600) for sufficient contrast against dark surfaces. Shape/type\n * tokens are theme-independent and not repeated here.\n */\nexport const darkTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#6366f1\", // indigo-500\n \"--ui-primary-hover\": \"#818cf8\", // indigo-400\n \"--ui-info\": \"#38bdf8\", // sky-400\n \"--ui-info-hover\": \"#7dd3fc\", // sky-300\n \"--ui-danger\": \"#ef4444\", // red-500\n \"--ui-danger-hover\": \"#f87171\", // red-400\n \"--ui-success\": \"#22c55e\", // green-500\n \"--ui-warning\": \"#f59e0b\", // amber-500\n \"--ui-warning-hover\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#f1f5f9\", // slate-100\n \"--ui-text-muted\": \"#94a3b8\", // slate-400\n \"--ui-border\": \"#334155\", // slate-700\n \"--ui-surface\": \"#0f172a\", // slate-900\n \"--ui-surface-muted\": \"#1e293b\", // slate-800\n \"--ui-highlight\": \"#854d0e\", // amber-800 — transient \"just changed\" flash on dark\n \"--ui-tooltip\": \"#020617\", // slate-950\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.12)\",\n \"--ui-overlay\": \"rgb(2 6 23 / 0.6)\", // slate-950 / 60%\n \"--ui-focus-ring\": \"0 0 0 3px rgb(99 102 241 / 0.45)\",\n};\n\n/**\n * \"Gradient\" theme overrides, applied via `data-theme=\"gradient\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like the\n * `\"light\"` override and layers a glossy gradient look on top of the flat\n * light palette, using exactly the `--ui-button-*`/`--ui-button-danger-*`/\n * `--ui-button-secondary-*` hooks `ui-button.ts` already reads (see that\n * file's doc comment), plus the `--ui-toast-*` hooks `toast-notification.ts`\n * reads (see its doc comment). Every other token (`--ui-text`, `--ui-surface`,\n * …) is left at its light-mode default — this theme only glosses buttons and\n * toasts by design. Each variant's gradient runs light-to-dark top-to-bottom\n * (`180deg`) across one Tailwind shade step lighter/darker than the flat\n * token so it still reads as \"the same color, glossy\" rather than a\n * different hue; `-hover` shifts the whole pair one shade lighter, `-active`\n * reverses the two stops for a pressed/\"indented\" look, and `-border` is a\n * shade darker than the gradient's dark stop for a defining edge.\n */\nexport const gradientTokenValues: Record<string, string> = {\n \"--ui-button-background\": \"linear-gradient(180deg, #6366f1 0%, #4f46e5 100%)\", // indigo-500 -> 600\n \"--ui-button-background-hover\": \"linear-gradient(180deg, #818cf8 0%, #6366f1 100%)\", // indigo-400 -> 500\n \"--ui-button-background-active\": \"linear-gradient(180deg, #4f46e5 0%, #6366f1 100%)\", // reversed 600 -> 500\n \"--ui-button-border\": \"#4338ca\", // indigo-700\n \"--ui-button-danger-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-button-danger-background-hover\": \"linear-gradient(180deg, #f87171 0%, #ef4444 100%)\", // red-400 -> 500\n \"--ui-button-danger-background-active\": \"linear-gradient(180deg, #dc2626 0%, #ef4444 100%)\", // reversed 600 -> 500\n \"--ui-button-danger-border\": \"#b91c1c\", // red-700\n // Secondary stays neutral gray rather than a saturated hue, matching its\n // flat \"not the primary action\" role, but one shade darker than the\n // original white -> slate-50 pairing: at a small button size, that pair\n // read as flat white with no visible gradient at all. slate-50 -> 100\n // keeps enough contrast to actually look like a gradient while still\n // being clearly lighter/quieter than primary/danger. Border stays\n // slate-300 (a step past the flat slate-200) so its edge still reads\n // against the fill.\n \"--ui-button-secondary-background\": \"linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)\", // slate-50 -> 100\n \"--ui-button-secondary-background-hover\": \"linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%)\", // slate-100 -> 200\n \"--ui-button-secondary-background-active\": \"linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%)\", // reversed 100 -> 50\n \"--ui-button-secondary-border\": \"#cbd5e1\", // slate-300\n \"--ui-button-secondary-border-hover\": \"#94a3b8\", // slate-400\n // button-group's unchecked segments, pagination-nav's prev/next buttons, and\n // radio-cards/radio-pills' checked background read this rather than\n // --ui-button-secondary-background (see tokens above). Left flat they were\n // the one \"secondary\" surface that stayed matte while every actual secondary\n // button turned glossy, so it tracks the hover gradient rather than a\n // separate literal that could drift out of step with it.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-button-secondary-background-hover)\",\n \"--ui-button-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge\n \"--ui-button-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility on primary/danger\n \"--ui-button-accent\": \"#4338ca\", // indigo-700, matches --ui-button-border\n // toast-notification: same light-to-dark, one-shade-step gradient\n // convention as the button variants above; the bottom stop always matches\n // the flat --ui-success/--ui-danger/--ui-info/--ui-warning value exactly.\n \"--ui-toast-success-background\": \"linear-gradient(180deg, #22c55e 0%, #16a34a 100%)\", // green-500 -> 600\n \"--ui-toast-error-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-toast-info-background\": \"linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%)\", // sky-400 -> 500\n \"--ui-toast-warning-background\": \"linear-gradient(180deg, #f59e0b 0%, #d97706 100%)\", // amber-500 -> 600\n \"--ui-toast-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge, same as --ui-button-highlight\n \"--ui-toast-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility, same as --ui-button-text-shadow\n};\n\n/**\n * \"Metro\" theme overrides, applied via `data-theme=\"metro\"` on `<html>` (see\n * `generate-tokens-css.mjs`) — forces `color-scheme: light` like the `\"light\"`\n * and `\"gradient\"` overrides, and strips the roundness and depth off the flat\n * light palette to leave hard-edged surfaces over a blue accent, after the\n * dense square-cornered look of the early social bookmarking sites.\n *\n * This is the first theme to override shape rather than only color, so the\n * \"shape/type tokens are theme-independent\" rule `darkTokenValues` notes above\n * holds for every theme except this one (see `docs/design-language.md`).\n * Squaring the design system means squaring the deliberate pill and circle\n * shapes too — chips, avatars, dots, slider thumbs — which is why those read\n * `--ui-radius-pill`/`--ui-radius-circle` rather than hardcoding `9999px`/`50%`\n * (a literal would silently opt that shape out of the theme).\n *\n * One residual is genuinely out of reach: `price-history-chart` rounds its bars\n * with an SVG `rx` presentation attribute, which cannot take a `var()`, so\n * those stay slightly rounded under metro.\n *\n * The shadows flatten to a hairline ring rather than to `none`. Dropping them\n * outright would leave `slide-panel` — the only overlay with no border of its\n * own — as an invisible white-on-white edge; every other consumer of\n * `--ui-shadow*` either pairs it with `1px solid var(--ui-border)` or applies\n * it on hover/active over an already-bordered control. A hard 1px ring keeps\n * that separation while removing the blur and the faked depth.\n */\nexport const metroTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#3274d0\", // the del.icio.us blue; no Tailwind equivalent\n \"--ui-primary-hover\": \"#2559a8\",\n \"--ui-focus-ring\": \"0 0 0 2px #3274d0\", // solid and crisp, not the default 3px translucent ring\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n // Hairline rings (slate-900 at low alpha) rather than blurred drop shadows:\n // separation without depth. -lg is a touch stronger, matching the default\n // pair's relative weighting.\n \"--ui-shadow\": \"0 0 0 1px rgb(15 23 42 / 0.12)\",\n \"--ui-shadow-lg\": \"0 0 0 1px rgb(15 23 42 / 0.18)\",\n};\n\n/**\n * \"Blueprint\" theme overrides, applied via `data-theme=\"blueprint\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like every\n * other non-dark theme, and restyles the light palette as a technical catalog\n * / spec sheet: warm near-black ink on white paper, one pure-blue accent,\n * square corners, and structure carried entirely by hairline rules instead of\n * shadows.\n *\n * It is the widest theme in the system, and the reason three token axes exist\n * that no earlier theme needed:\n *\n * - `--ui-font` is retargeted to a monospace stack. `darkTokenValues` notes\n * that shape and type tokens are theme-independent; `metro` already broke\n * that for shape, and this breaks it for the type *family* only. Type\n * *metrics* (size, weight, line height) remain unthemed in every theme —\n * they encode hierarchy, which is not a stylistic choice. \"Space Mono\"\n * leads the stack purely so a consumer who loads that webfont gets the\n * reference face automatically; with no external CSS at all it falls\n * straight through to the same system mono stack `--ui-font-mono` uses, so\n * the theme still renders correctly on its own.\n * - `--ui-border-width` goes to `1.5px`. Every border in this theme is doing\n * the work a shadow does elsewhere, and at 1px those rules read as a faint\n * table rather than as drawn structure.\n * - `--ui-label-transform` goes to `uppercase`, which is what makes chrome\n * micro-labels read as signage/spec-sheet keys. Only labels that name a\n * region or column carry this — never user content.\n * - `--ui-numeric` goes to `tabular-nums`, so figures line up in a column and\n * do not jitter as they change.\n *\n * Buttons are deliberately NOT the accent color. `--ui-primary` stays pure\n * blue because it drives accents everywhere else (active tab underlines,\n * selected states, links, the certification-style tints), but the primary\n * button fill is overridden to ink through the `--ui-button-*` hooks and only\n * turns blue on hover — a black-on-white CTA that lights up is the\n * catalog-print look, and a large pure-blue fill next to blue accents would\n * flatten the two roles into one. That split is exactly what those hooks\n * exist for (see `gradientTokenValues` above for the same technique).\n *\n * Semantic `danger`/`success`/`warning` keep their default hues: they encode\n * meaning rather than style, and the reference's blue-only restraint is an\n * editorial choice a component library cannot make on a consumer's behalf.\n * `--ui-info` is the exception — it is \"neutral notice\", which in this theme\n * is precisely the accent, and the default sky blue would otherwise sit a few\n * degrees off the pure blue beside it and read as a mistake.\n *\n * Shadows flatten to a hard ink ring rather than to `none`, for the same\n * reason `metro` does it: `slide-panel` has no border of its own and would\n * otherwise lose its edge entirely.\n */\nexport const blueprintTokenValues: Record<string, string> = {\n // Ink over paper. --ui-text-muted is the same ink at ~65% over white rather\n // than a neutral gray, so the quiet text stays in the same warm family\n // instead of turning blue-gray beside the accent.\n \"--ui-text\": \"#17160f\",\n \"--ui-text-muted\": \"#686763\",\n \"--ui-surface\": \"#ffffff\",\n \"--ui-surface-muted\": \"#f0f0f0\",\n // ~40% ink over white: a rule that is unmistakably drawn at 1.5px without\n // going fully black, which at this width would turn every bordered surface\n // into a hard box.\n \"--ui-border\": \"#a2a29f\",\n \"--ui-tooltip\": \"#17160f\",\n \"--ui-overlay\": \"rgb(23 22 15 / 0.45)\",\n // The \"just changed\" flash tints toward the accent instead of amber, which\n // is the one warm hue this palette has no room for.\n \"--ui-highlight\": \"#dcdcff\",\n\n \"--ui-primary\": \"#0000ff\",\n \"--ui-primary-hover\": \"#0000cc\",\n \"--ui-info\": \"#0000ff\",\n \"--ui-info-hover\": \"#0000cc\",\n \"--ui-on-accent\": \"#ffffff\",\n // Solid and crisp at the reference's own 2px, not the default translucent\n // 3px halo — a blurred ring is the one soft edge this theme has nowhere to\n // put.\n \"--ui-focus-ring\": \"0 0 0 2px #0000ff\",\n\n // Ink CTA that lights up blue on hover, and inverts its two stops while\n // pressed. The border is ink at every state so the button keeps a defining\n // edge even once the fill goes blue.\n \"--ui-button-background\": \"#17160f\",\n \"--ui-button-background-hover\": \"#0000ff\",\n \"--ui-button-background-active\": \"#0000cc\",\n \"--ui-button-border\": \"#17160f\",\n \"--ui-button-danger-border\": \"#b91c1c\",\n // Secondary is the reference's ghost button: no fill, ink border, a paper\n // wash on hover and an accent border to echo the primary's hover.\n \"--ui-button-secondary-border\": \"#17160f\",\n \"--ui-button-secondary-border-hover\": \"#0000ff\",\n \"--ui-button-secondary-background-hover\": \"#f0f0f0\",\n \"--ui-button-secondary-surface-muted\": \"#f0f0f0\",\n // Non-button accents that can only take a plain color (a native input's\n // accent-color, range-slider's track/thumb) follow --ui-primary, not the\n // ink button fill — those are selection marks, not calls to action.\n \"--ui-button-accent\": \"#0000ff\",\n\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n \"--ui-shadow\": \"0 0 0 1.5px rgb(23 22 15 / 0.24)\",\n \"--ui-shadow-lg\": \"0 0 0 1.5px #17160f\",\n\n \"--ui-border-width\": \"1.5px\",\n \"--ui-label-transform\": \"uppercase\",\n \"--ui-numeric\": \"tabular-nums\",\n \"--ui-font\":\n '\"Space Mono\", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',\n};\n\n/**\n * Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,\n * re-declaring every token on each component's own host element as a\n * \"materialize the inherited value, or this fallback\" trick. That pattern\n * turned out to be a genuine bug, not a working default: browsers treat\n * `--ui-x: var(--ui-x, ...)` on `:host` as a self-referencing declaration\n * that computes to the guaranteed-invalid value REGARDLESS of what an\n * ancestor (e.g. `:root`) set — the host's own `:host` rule wins the cascade\n * over the ancestor's, so this dropped whatever the app actually set and\n * silently substituted the component's own fallback everywhere. It went\n * unnoticed because every component's fallback happened to equal the\n * intended light-mode value — dark mode (a real, different value at\n * `:root`) exposed it immediately (colors rendering as if no theme were\n * applied at all). Fix: don't redeclare tokens on `:host` — plain\n * inheritance already carries `:root`'s values into every shadow root\n * correctly, and every component already has its own `var(--ui-x, fallback)`\n * at each point of use, so nothing here is needed for the \"zero external\n * CSS\" default to keep working. Kept as an empty export so the existing\n * `static override styles = [tokens, css\\`...\\`]` import in every component\n * keeps compiling.\n */\nexport const tokens = css``;\n"]}
|
package/dist/tree-view.js
CHANGED
|
@@ -115,7 +115,7 @@ let TreeView = class TreeView extends LitElement {
|
|
|
115
115
|
left: 50%;
|
|
116
116
|
top: 0;
|
|
117
117
|
bottom: 0;
|
|
118
|
-
border-left: 1px solid var(--ui-border, #e2e8f0);
|
|
118
|
+
border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
119
119
|
}
|
|
120
120
|
.guide.connector.last::before {
|
|
121
121
|
bottom: 50%;
|
|
@@ -126,7 +126,7 @@ let TreeView = class TreeView extends LitElement {
|
|
|
126
126
|
left: 50%;
|
|
127
127
|
right: 0;
|
|
128
128
|
top: 50%;
|
|
129
|
-
border-top: 1px solid var(--ui-border, #e2e8f0);
|
|
129
|
+
border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
130
130
|
}
|
|
131
131
|
@media (forced-colors: active) {
|
|
132
132
|
.row:focus-visible {
|
package/dist/tree-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-view.js","sourceRoot":"","sources":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IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CACxE,CAAC;IACJ,CAAC;CACF,CAAA;AA9HiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uCAAwB;AAEvB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAgE;AAEnC;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;iDAAyB;AAKxC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAe;AAEzC;IAAhB,KAAK,EAAE;0CAAsC;AA7GnC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAgOpB","sourcesContent":["import { LitElement, css, html, nothing, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconChevronDown, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One tree node: a folder when `children` is set (even `[]`), a leaf otherwise. */\nexport interface TreeNode {\n id: string;\n label: string;\n children?: TreeNode[];\n data?: unknown;\n}\n\n/**\n * A generic, presentational tree shell: renders `nodes` recursively, one row\n * per node, with each row's content produced by `renderNode` (default: plain\n * label). Modeled on `data-table`'s headless pattern — knows nothing about\n * what a node's `data` means beyond what `renderNode` does with it.\n *\n * A node with a `children` array (even empty) is a folder: clicking or\n * activating its row toggles expand/collapse instead of firing `node-click`.\n * A node with no `children` is a leaf: clicking or activating its row fires\n * `node-click`. Folders start collapsed; set `default-expanded` to start\n * every folder expanded instead. Expansion state is otherwise managed\n * internally and untouched by later `nodes` updates, so a user's manual\n * toggles survive a data refresh.\n *\n * Set the `lines` boolean to draw classic file-tree connector guides: a\n * vertical line per continuing ancestor level and a branch elbow (`└`) or\n * tee (`├`) linking each node to its parent. Off by default (indentation only).\n *\n * @element tree-view\n * @fires node-click - A leaf row was activated; detail is `{ id, data }`.\n */\n@customElement(\"tree-view\")\nexport class TreeView extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\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 font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .row {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text, #0f172a);\n cursor: pointer;\n }\n .row:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .row:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .toggle {\n display: inline-flex;\n flex-shrink: 0;\n width: 1rem;\n height: 1rem;\n align-items: center;\n justify-content: center;\n color: var(--ui-text-muted, #64748b);\n }\n .content {\n min-width: 0;\n flex: 1;\n }\n :host([lines]) .row {\n padding-top: 0;\n padding-bottom: 0;\n min-height: 1.5rem;\n }\n .guides {\n display: flex;\n align-self: stretch;\n flex-shrink: 0;\n }\n .guide {\n position: relative;\n flex: 0 0 auto;\n width: 1rem;\n }\n .guide.v::before,\n .guide.connector::before {\n content: \"\";\n position: absolute;\n left: 50%;\n top: 0;\n bottom: 0;\n border-left: 1px solid var(--ui-border, #e2e8f0);\n }\n .guide.connector.last::before {\n bottom: 50%;\n }\n .guide.connector::after {\n content: \"\";\n position: absolute;\n left: 50%;\n right: 0;\n top: 50%;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n }\n @media (forced-colors: active) {\n .row:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: -2px;\n box-shadow: none;\n }\n .guide.v::before,\n .guide.connector::before,\n .guide.connector::after {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** Tree data; opaque to this component beyond what `renderNode` does with it. */\n @property({ attribute: false }) nodes: TreeNode[] = [];\n /** Produces a row's rendered content for `node`. Default: plain label text. */\n @property({ attribute: false }) renderNode: (node: TreeNode) => unknown = (node) => node.label;\n /** Start every folder expanded instead of the default all-collapsed. */\n @property({ type: Boolean, attribute: \"default-expanded\" }) defaultExpanded = false;\n /**\n * Draw classic file-tree connector guides (vertical ancestor lines plus a\n * branch elbow/tee per row) instead of indentation alone. Off by default.\n */\n @property({ type: Boolean, reflect: true }) lines = false;\n\n @state() private expanded = new Set<string>();\n #initializedExpansion = false;\n\n override willUpdate(changed: Map<string, unknown>): void {\n if (!changed.has(\"nodes\") || this.#initializedExpansion) return;\n this.#initializedExpansion = true;\n if (!this.defaultExpanded) return;\n const all = new Set<string>();\n const collect = (list: TreeNode[]) => {\n for (const node of list) {\n if (!node.children) continue;\n all.add(node.id);\n collect(node.children);\n }\n };\n collect(this.nodes);\n this.expanded = all;\n }\n\n #toggle(id: string): void {\n const next = new Set(this.expanded);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n this.expanded = next;\n }\n\n #activate(node: TreeNode): void {\n if (node.children) {\n this.#toggle(node.id);\n return;\n }\n this.dispatchEvent(\n new CustomEvent(\"node-click\", {\n detail: { id: node.id, data: node.data },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #onKeydown(node: TreeNode, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n if (e.target !== e.currentTarget) return;\n e.preventDefault();\n this.#activate(node);\n }\n\n #onRowClick(node: TreeNode, e: MouseEvent): void {\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n this.#activate(node);\n }\n\n #isNestedInteractive(path: EventTarget[], row: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === row) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n #renderNode(\n node: TreeNode,\n depth: number,\n isLast: boolean,\n ancestorHasNext: boolean[],\n ): TemplateResult {\n const isFolder = !!node.children;\n const isOpen = isFolder && this.expanded.has(node.id);\n const guides = this.lines\n ? html`<span class=\"guides\" aria-hidden=\"true\">\n ${ancestorHasNext.map(\n (hasNext) => html`<span class=\"guide ${hasNext ? \"v\" : \"\"}\"></span>`,\n )}\n <span class=\"guide connector ${isLast ? \"last\" : \"\"}\"></span>\n </span>`\n : nothing;\n return html`\n <div\n class=\"row\"\n role=${isFolder ? \"button\" : \"link\"}\n aria-expanded=${isFolder ? String(isOpen) : nothing}\n tabindex=\"0\"\n style=${this.lines ? nothing : `padding-left: ${depth * 1.25}rem`}\n @click=${(e: MouseEvent) => this.#onRowClick(node, e)}\n @keydown=${(e: KeyboardEvent) => this.#onKeydown(node, e)}\n >\n ${guides}\n <span class=\"toggle\" aria-hidden=\"true\">\n ${isFolder ? (isOpen ? iconChevronDown(14) : iconChevronRight(14)) : nothing}\n </span>\n <span class=\"content\">${this.renderNode(node)}</span>\n </div>\n ${isFolder && isOpen\n ? repeat(\n node.children!,\n (child) => child.id,\n (child, i) =>\n this.#renderNode(child, depth + 1, i === node.children!.length - 1, [\n ...ancestorHasNext,\n !isLast,\n ]),\n )\n : nothing}\n `;\n }\n\n override render() {\n return repeat(\n this.nodes,\n (node) => node.id,\n (node, i) => this.#renderNode(node, 0, i === this.nodes.length - 1, []),\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tree-view\": TreeView;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tree-view.js","sourceRoot":"","sources":["../src/tree-view.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,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,EAAE,CAAC;uCAAwB;AAEvB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAgE;AAEnC;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;iDAAyB;AAKxC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAe;AAEzC;IAAhB,KAAK,EAAE;0CAAsC;AA7GnC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAgOpB","sourcesContent":["import { LitElement, css, html, nothing, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconChevronDown, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One tree node: a folder when `children` is set (even `[]`), a leaf otherwise. */\nexport interface TreeNode {\n id: string;\n label: string;\n children?: TreeNode[];\n data?: unknown;\n}\n\n/**\n * A generic, presentational tree shell: renders `nodes` recursively, one row\n * per node, with each row's content produced by `renderNode` (default: plain\n * label). Modeled on `data-table`'s headless pattern — knows nothing about\n * what a node's `data` means beyond what `renderNode` does with it.\n *\n * A node with a `children` array (even empty) is a folder: clicking or\n * activating its row toggles expand/collapse instead of firing `node-click`.\n * A node with no `children` is a leaf: clicking or activating its row fires\n * `node-click`. Folders start collapsed; set `default-expanded` to start\n * every folder expanded instead. Expansion state is otherwise managed\n * internally and untouched by later `nodes` updates, so a user's manual\n * toggles survive a data refresh.\n *\n * Set the `lines` boolean to draw classic file-tree connector guides: a\n * vertical line per continuing ancestor level and a branch elbow (`└`) or\n * tee (`├`) linking each node to its parent. Off by default (indentation only).\n *\n * @element tree-view\n * @fires node-click - A leaf row was activated; detail is `{ id, data }`.\n */\n@customElement(\"tree-view\")\nexport class TreeView extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\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 font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .row {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text, #0f172a);\n cursor: pointer;\n }\n .row:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .row:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .toggle {\n display: inline-flex;\n flex-shrink: 0;\n width: 1rem;\n height: 1rem;\n align-items: center;\n justify-content: center;\n color: var(--ui-text-muted, #64748b);\n }\n .content {\n min-width: 0;\n flex: 1;\n }\n :host([lines]) .row {\n padding-top: 0;\n padding-bottom: 0;\n min-height: 1.5rem;\n }\n .guides {\n display: flex;\n align-self: stretch;\n flex-shrink: 0;\n }\n .guide {\n position: relative;\n flex: 0 0 auto;\n width: 1rem;\n }\n .guide.v::before,\n .guide.connector::before {\n content: \"\";\n position: absolute;\n left: 50%;\n top: 0;\n bottom: 0;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .guide.connector.last::before {\n bottom: 50%;\n }\n .guide.connector::after {\n content: \"\";\n position: absolute;\n left: 50%;\n right: 0;\n top: 50%;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n @media (forced-colors: active) {\n .row:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: -2px;\n box-shadow: none;\n }\n .guide.v::before,\n .guide.connector::before,\n .guide.connector::after {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** Tree data; opaque to this component beyond what `renderNode` does with it. */\n @property({ attribute: false }) nodes: TreeNode[] = [];\n /** Produces a row's rendered content for `node`. Default: plain label text. */\n @property({ attribute: false }) renderNode: (node: TreeNode) => unknown = (node) => node.label;\n /** Start every folder expanded instead of the default all-collapsed. */\n @property({ type: Boolean, attribute: \"default-expanded\" }) defaultExpanded = false;\n /**\n * Draw classic file-tree connector guides (vertical ancestor lines plus a\n * branch elbow/tee per row) instead of indentation alone. Off by default.\n */\n @property({ type: Boolean, reflect: true }) lines = false;\n\n @state() private expanded = new Set<string>();\n #initializedExpansion = false;\n\n override willUpdate(changed: Map<string, unknown>): void {\n if (!changed.has(\"nodes\") || this.#initializedExpansion) return;\n this.#initializedExpansion = true;\n if (!this.defaultExpanded) return;\n const all = new Set<string>();\n const collect = (list: TreeNode[]) => {\n for (const node of list) {\n if (!node.children) continue;\n all.add(node.id);\n collect(node.children);\n }\n };\n collect(this.nodes);\n this.expanded = all;\n }\n\n #toggle(id: string): void {\n const next = new Set(this.expanded);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n this.expanded = next;\n }\n\n #activate(node: TreeNode): void {\n if (node.children) {\n this.#toggle(node.id);\n return;\n }\n this.dispatchEvent(\n new CustomEvent(\"node-click\", {\n detail: { id: node.id, data: node.data },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #onKeydown(node: TreeNode, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n if (e.target !== e.currentTarget) return;\n e.preventDefault();\n this.#activate(node);\n }\n\n #onRowClick(node: TreeNode, e: MouseEvent): void {\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n this.#activate(node);\n }\n\n #isNestedInteractive(path: EventTarget[], row: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === row) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n #renderNode(\n node: TreeNode,\n depth: number,\n isLast: boolean,\n ancestorHasNext: boolean[],\n ): TemplateResult {\n const isFolder = !!node.children;\n const isOpen = isFolder && this.expanded.has(node.id);\n const guides = this.lines\n ? html`<span class=\"guides\" aria-hidden=\"true\">\n ${ancestorHasNext.map(\n (hasNext) => html`<span class=\"guide ${hasNext ? \"v\" : \"\"}\"></span>`,\n )}\n <span class=\"guide connector ${isLast ? \"last\" : \"\"}\"></span>\n </span>`\n : nothing;\n return html`\n <div\n class=\"row\"\n role=${isFolder ? \"button\" : \"link\"}\n aria-expanded=${isFolder ? String(isOpen) : nothing}\n tabindex=\"0\"\n style=${this.lines ? nothing : `padding-left: ${depth * 1.25}rem`}\n @click=${(e: MouseEvent) => this.#onRowClick(node, e)}\n @keydown=${(e: KeyboardEvent) => this.#onKeydown(node, e)}\n >\n ${guides}\n <span class=\"toggle\" aria-hidden=\"true\">\n ${isFolder ? (isOpen ? iconChevronDown(14) : iconChevronRight(14)) : nothing}\n </span>\n <span class=\"content\">${this.renderNode(node)}</span>\n </div>\n ${isFolder && isOpen\n ? repeat(\n node.children!,\n (child) => child.id,\n (child, i) =>\n this.#renderNode(child, depth + 1, i === node.children!.length - 1, [\n ...ancestorHasNext,\n !isLast,\n ]),\n )\n : nothing}\n `;\n }\n\n override render() {\n return repeat(\n this.nodes,\n (node) => node.id,\n (node, i) => this.#renderNode(node, 0, i === this.nodes.length - 1, []),\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tree-view\": TreeView;\n }\n}\n"]}
|
package/dist/ui-admonition.js
CHANGED
|
@@ -43,7 +43,7 @@ let UiAdmonition = class UiAdmonition extends LitElement {
|
|
|
43
43
|
align-items: flex-start;
|
|
44
44
|
gap: 0.5rem;
|
|
45
45
|
border-radius: var(--ui-radius, 0.5rem);
|
|
46
|
-
border: 1px solid;
|
|
46
|
+
border: var(--ui-border-width, 1px) solid;
|
|
47
47
|
padding: 0.75rem 1rem;
|
|
48
48
|
box-sizing: border-box;
|
|
49
49
|
font-family: var(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-admonition.js","sourceRoot":"","sources":["../src/ui-admonition.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAuB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;GAYG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QA4FL,4EAA4E;QAC/C,YAAO,GAAsB,MAAM,CAAC;QAEjE;;;;WAIG;QAC6B,SAAI,GAA0B,IAAI,CAAC;IAarE,CAAC;aAhHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsFF;KACF,AAzFqB,CAyFpB;IAYO,MAAM;QACb,OAAO,IAAI,CAAA;wBACS,IAAI,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;UAClF,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO;;;;;;KAMvE,CAAC;IACJ,CAAC;CACF,CAAA;AApB8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAqC;AAOjC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CAAoC;AApGxD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAiHxB","sourcesContent":["import { LitElement, type TemplateResult, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type AdmonitionVariant = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\n/**\n * Bordered, rounded callout card for an inline notice with an optional call\n * to action — \"take the quiz to personalize your weights\", \"this feature is\n * in beta\", etc. Unlike `status-banner` (a borderless, non-rounded\n * full-width bar for a persistent app-level condition), this is meant to sit\n * inline within a page's content column, so it always has a visible border\n * and radius. Colors follow the same tinted-background + accent-color\n * scheme as `status-banner`/`status-pill`.\n *\n * @element ui-admonition\n * @slot - The message text.\n * @slot actions - Optional call-to-action controls, e.g. a primary `<ui-button>`.\n */\n@customElement(\"ui-admonition\")\nexport class UiAdmonition extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .box {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border-radius: var(--ui-radius, 0.5rem);\n border: 1px solid;\n padding: 0.75rem 1rem;\n box-sizing: border-box;\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 font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n }\n .icon {\n display: inline-flex;\n line-height: 0;\n flex: 0 0 auto;\n margin-top: 0.125rem;\n }\n .body {\n flex: 1 1 auto;\n min-width: 0;\n }\n .actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 0.75rem;\n }\n .actions:empty {\n display: none;\n }\n .box.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-text-muted, #64748b) 30%, transparent);\n }\n .box.neutral .icon {\n color: var(--ui-text-muted, #64748b);\n }\n .box.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-info, #0ea5e9) 30%, transparent);\n }\n .box.info .icon {\n color: var(--ui-info, #0ea5e9);\n }\n .box.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-success, #16a34a) 30%, transparent);\n }\n .box.success .icon {\n color: var(--ui-success, #16a34a);\n }\n .box.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-warning, #d97706) 30%, transparent);\n }\n .box.warning .icon {\n color: var(--ui-warning, #d97706);\n }\n .box.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-danger, #dc2626) 30%, transparent);\n }\n .box.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .box {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** Visual style; also selects the accent color for the icon/border/tint. */\n @property({ reflect: true }) variant: AdmonitionVariant = \"info\";\n\n /**\n * Optional leading icon, pre-rendered by the consumer (e.g. `iconInfo(18)`),\n * matching `status-banner`/`nav-item`/`icon-button` — icons are passed in,\n * not named, so the component never has to know the icon catalog.\n */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n\n override render() {\n return html`\n <div class=\"box ${this.variant}\" role=${this.variant === \"danger\" ? \"alert\" : \"status\"}>\n ${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : nothing}\n <div class=\"body\">\n <div class=\"text\"><slot></slot></div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-admonition\": UiAdmonition;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ui-admonition.js","sourceRoot":"","sources":["../src/ui-admonition.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAuB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;GAYG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QA4FL,4EAA4E;QAC/C,YAAO,GAAsB,MAAM,CAAC;QAEjE;;;;WAIG;QAC6B,SAAI,GAA0B,IAAI,CAAC;IAarE,CAAC;aAhHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsFF;KACF,AAzFqB,CAyFpB;IAYO,MAAM;QACb,OAAO,IAAI,CAAA;wBACS,IAAI,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;UAClF,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO;;;;;;KAMvE,CAAC;IACJ,CAAC;CACF,CAAA;AApB8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAqC;AAOjC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CAAoC;AApGxD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAiHxB","sourcesContent":["import { LitElement, type TemplateResult, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type AdmonitionVariant = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\n/**\n * Bordered, rounded callout card for an inline notice with an optional call\n * to action — \"take the quiz to personalize your weights\", \"this feature is\n * in beta\", etc. Unlike `status-banner` (a borderless, non-rounded\n * full-width bar for a persistent app-level condition), this is meant to sit\n * inline within a page's content column, so it always has a visible border\n * and radius. Colors follow the same tinted-background + accent-color\n * scheme as `status-banner`/`status-pill`.\n *\n * @element ui-admonition\n * @slot - The message text.\n * @slot actions - Optional call-to-action controls, e.g. a primary `<ui-button>`.\n */\n@customElement(\"ui-admonition\")\nexport class UiAdmonition extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .box {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border-radius: var(--ui-radius, 0.5rem);\n border: var(--ui-border-width, 1px) solid;\n padding: 0.75rem 1rem;\n box-sizing: border-box;\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 font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n }\n .icon {\n display: inline-flex;\n line-height: 0;\n flex: 0 0 auto;\n margin-top: 0.125rem;\n }\n .body {\n flex: 1 1 auto;\n min-width: 0;\n }\n .actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 0.75rem;\n }\n .actions:empty {\n display: none;\n }\n .box.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-text-muted, #64748b) 30%, transparent);\n }\n .box.neutral .icon {\n color: var(--ui-text-muted, #64748b);\n }\n .box.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-info, #0ea5e9) 30%, transparent);\n }\n .box.info .icon {\n color: var(--ui-info, #0ea5e9);\n }\n .box.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-success, #16a34a) 30%, transparent);\n }\n .box.success .icon {\n color: var(--ui-success, #16a34a);\n }\n .box.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-warning, #d97706) 30%, transparent);\n }\n .box.warning .icon {\n color: var(--ui-warning, #d97706);\n }\n .box.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-danger, #dc2626) 30%, transparent);\n }\n .box.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .box {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** Visual style; also selects the accent color for the icon/border/tint. */\n @property({ reflect: true }) variant: AdmonitionVariant = \"info\";\n\n /**\n * Optional leading icon, pre-rendered by the consumer (e.g. `iconInfo(18)`),\n * matching `status-banner`/`nav-item`/`icon-button` — icons are passed in,\n * not named, so the component never has to know the icon catalog.\n */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n\n override render() {\n return html`\n <div class=\"box ${this.variant}\" role=${this.variant === \"danger\" ? \"alert\" : \"status\"}>\n ${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : nothing}\n <div class=\"body\">\n <div class=\"text\"><slot></slot></div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-admonition\": UiAdmonition;\n }\n}\n"]}
|
package/dist/ui-button.js
CHANGED
|
@@ -118,7 +118,7 @@ let UiButton = class UiButton extends LitElement {
|
|
|
118
118
|
"Noto Color Emoji"
|
|
119
119
|
);
|
|
120
120
|
cursor: pointer;
|
|
121
|
-
border: 1px solid transparent;
|
|
121
|
+
border: var(--ui-border-width, 1px) solid transparent;
|
|
122
122
|
text-decoration: none;
|
|
123
123
|
box-sizing: border-box;
|
|
124
124
|
}
|
package/dist/ui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AEC,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;AApP/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkSpB","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: 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: 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;QAkOpC,qBAAqB;QACT,YAAO,GAAkB,SAAS,CAAC;QAC/C,+EAA+E;QACnE,SAAI,GAAgB,IAAI,CAAC;QACrC,2FAA2F;QAC9D,SAAI,GAAG,KAAK,CA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,EAAE,CAAC;sCAAc;AApP/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkSpB","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 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: 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"]}
|
package/dist/video-player.js
CHANGED
|
@@ -57,7 +57,7 @@ let VideoPlayer = class VideoPlayer extends LitElement {
|
|
|
57
57
|
display: block;
|
|
58
58
|
}
|
|
59
59
|
.player {
|
|
60
|
-
border: 1px solid var(--ui-border, #e2e8f0);
|
|
60
|
+
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
61
61
|
border-radius: var(--ui-radius, 0.5rem);
|
|
62
62
|
overflow: hidden;
|
|
63
63
|
background: var(--ui-surface, #ffffff);
|
package/dist/video-player.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-player.js","sourceRoot":"","sources":["../src/video-player.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;GAaG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA8EL,qCAAqC;QACzB,QAAG,GAAG,EAAE,CAAC;QACrB,iDAAiD;QACrC,WAAM,GAAG,EAAE,CAAC;QACxB,0DAA0D;QAC9C,UAAK,GAAG,cAAc,CAAC;QACnC,8CAA8C;QACjB,SAAI,GAAG,KAAK,CAAC;QAC1C,qCAAqC;QACzB,YAAO,GAAiC,UAAU,CAAC;QAE9C,aAAQ,GAAG,KAAK,CAAC;QACjB,iBAAY,GAAG,CAAC,CAAC;QACjB,cAAS,GAAG,GAAG,CAAC;QACh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AER,CAAC;IACJ,CAAC;CACF,CAAA;AAhLa;IAAX,QAAQ,EAAE;wCAAU;AAET;IAAX,QAAQ,EAAE;2CAAa;AAEZ;IAAX,QAAQ,EAAE;0CAAwB;AAEN;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAc;AAE9B;IAAX,QAAQ,EAAE;4CAAoD;AAE9C;IAAhB,KAAK,EAAE;6CAA0B;AACjB;IAAhB,KAAK,EAAE;iDAA0B;AACjB;IAAhB,KAAK,EAAE;8CAAyB;AAChB;IAAhB,KAAK,EAAE;4CAAqB;AACZ;IAAhB,KAAK,EAAE;2CAAwB;AACf;IAAhB,KAAK,EAAE;6CAA0B;AACjB;IAAhB,KAAK,EAAE;gDAA6B;AAEb;IAAvB,KAAK,CAAC,OAAO,CAAC;2CAAmC;AACzB;IAAxB,KAAK,CAAC,QAAQ,CAAC;2CAAiC;AAlGtC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA+PvB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport { transportRangeStyles } from \"./utils/transport-controls.js\";\nimport { formatClockDuration } from \"./utils/duration.js\";\nimport {\n iconArrowsPointingIn,\n iconArrowsPointingOut,\n iconPause,\n iconPlay,\n iconSpeakerWave,\n iconSpeakerXMark,\n} from \"./icons.js\";\nimport \"./icon-button.js\";\n\n/**\n * Video player wrapping a native `<video>` element (native `controls`\n * disabled) with the same tokenized transport bar as `audio-player` — a\n * play/pause `icon-button`, elapsed/total time, a seekable progress bar, a\n * mute toggle + volume slider — plus a fullscreen toggle. The control bar\n * sits in a persistent strip under the video frame rather than a\n * hover-reveal overlay, so it stays usable for keyboard/touch input without\n * a pointer hover state.\n *\n * @element video-player\n * @fires play - The video started playing.\n * @fires pause - The video was paused.\n * @fires ended - Playback reached the end.\n */\n@customElement(\"video-player\")\nexport class VideoPlayer extends LitElement {\n static override styles = [\n tokens,\n transportRangeStyles,\n css`\n :host {\n display: block;\n }\n .player {\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n overflow: hidden;\n background: var(--ui-surface, #ffffff);\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 .frame {\n display: flex;\n /* Letterboxing behind the video's own content is a universal video\n convention independent of the surrounding theme — same literal-color\n exception category as this package's white map rings/avatar marks. */\n background: #000000;\n }\n video {\n display: block;\n width: 100%;\n max-height: 30rem;\n object-fit: contain;\n }\n .controls {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n }\n .time {\n flex: 0 0 auto;\n min-width: 2.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n text-align: center;\n }\n .seek {\n /* Sets its own width (100%) and flex-basis: 0 (not auto) so it\n fills the row's remaining space via flex-grow — an auto basis\n would otherwise derive its hypothetical size from that same\n width:100%, resolved against an indefinite container, and\n collapse the track to 0. */\n flex: 1 1 0%;\n min-width: 0;\n width: 100%;\n }\n .volume {\n flex: 0 0 auto;\n width: 4rem;\n }\n .error {\n padding: 0.5rem 0.75rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .player {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** URL of the video file to play. */\n @property() src = \"\";\n /** Poster image shown before playback starts. */\n @property() poster = \"\";\n /** Accessible name for the player, e.g. a video title. */\n @property() label = \"Video player\";\n /** Loops playback once it reaches the end. */\n @property({ type: Boolean }) loop = false;\n /** Native `<video preload>` hint. */\n @property() preload: \"none\" | \"metadata\" | \"auto\" = \"metadata\";\n\n @state() private _playing = false;\n @state() private _currentTime = 0;\n @state() private _duration = NaN;\n @state() private _volume = 1;\n @state() private _muted = false;\n @state() private _errored = false;\n @state() private _fullscreen = false;\n\n @query(\"video\") private _video?: HTMLVideoElement;\n @query(\".frame\") private _frame?: HTMLDivElement;\n\n #onFullscreenChange = (): void => {\n this._fullscreen = document.fullscreenElement === this._frame;\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener(\"fullscreenchange\", this.#onFullscreenChange);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"fullscreenchange\", this.#onFullscreenChange);\n }\n\n private _togglePlay(): void {\n const video = this._video;\n if (!video) return;\n if (video.paused) video.play();\n else video.pause();\n }\n\n private _toggleMute(): void {\n const video = this._video;\n if (!video) return;\n video.muted = !video.muted;\n }\n\n private _toggleFullscreen(): void {\n const frame = this._frame;\n if (!frame) return;\n if (document.fullscreenElement === frame) document.exitFullscreen();\n else frame.requestFullscreen();\n }\n\n private _onSeekInput(e: Event): void {\n const video = this._video;\n if (!video) return;\n const value = Number((e.target as HTMLInputElement).value);\n video.currentTime = value;\n this._currentTime = value;\n }\n\n private _onVolumeInput(e: Event): void {\n const video = this._video;\n if (!video) return;\n const value = Number((e.target as HTMLInputElement).value);\n video.volume = value;\n // Adjusting the slider while muted is treated as an implicit unmute, so\n // dragging it back up audibly takes effect instead of appearing frozen.\n if (video.muted && value > 0) video.muted = false;\n }\n\n private _onLoadedMetadata(): void {\n this._duration = this._video?.duration ?? NaN;\n this._errored = false;\n }\n\n private _onTimeUpdate(): void {\n this._currentTime = this._video?.currentTime ?? 0;\n }\n\n private _onPlay(): void {\n this._playing = true;\n this.dispatchEvent(new CustomEvent(\"play\", { bubbles: true, composed: true }));\n }\n\n private _onPause(): void {\n this._playing = false;\n this.dispatchEvent(new CustomEvent(\"pause\", { bubbles: true, composed: true }));\n }\n\n private _onEnded(): void {\n this._playing = false;\n this.dispatchEvent(new CustomEvent(\"ended\", { bubbles: true, composed: true }));\n }\n\n private _onVolumeChange(): void {\n const video = this._video;\n if (!video) return;\n this._volume = video.volume;\n this._muted = video.muted;\n }\n\n private _onError(): void {\n this._errored = true;\n }\n\n override render() {\n const duration = this._duration;\n const seekMax = Number.isFinite(duration) && duration > 0 ? duration : 0;\n return html`\n <div class=\"player\" role=\"group\" aria-label=${this.label}>\n <div class=\"frame\">\n <video\n .src=${this.src}\n poster=${this.poster || \"\"}\n ?loop=${this.loop}\n preload=${this.preload}\n @loadedmetadata=${this._onLoadedMetadata}\n @timeupdate=${this._onTimeUpdate}\n @play=${this._onPlay}\n @pause=${this._onPause}\n @ended=${this._onEnded}\n @volumechange=${this._onVolumeChange}\n @error=${this._onError}\n @click=${this._togglePlay}\n ></video>\n </div>\n ${this._errored\n ? html`<span class=\"error\">Unable to load video</span>`\n : html`\n <div class=\"controls\">\n <icon-button\n .icon=${this._playing ? iconPause(18) : iconPlay(18)}\n label=${this._playing ? \"Pause\" : \"Play\"}\n @click=${this._togglePlay}\n ></icon-button>\n <span class=\"time\">${formatClockDuration(this._currentTime)}</span>\n <input\n class=\"seek\"\n type=\"range\"\n min=\"0\"\n max=${seekMax}\n step=\"0.1\"\n .value=${String(this._currentTime)}\n aria-label=\"Seek\"\n aria-valuetext=${formatClockDuration(this._currentTime)}\n @input=${this._onSeekInput}\n />\n <span class=\"time\">${formatClockDuration(duration)}</span>\n <icon-button\n .icon=${this._muted || this._volume === 0 ? iconSpeakerXMark(18) : iconSpeakerWave(18)}\n label=${this._muted ? \"Unmute\" : \"Mute\"}\n @click=${this._toggleMute}\n ></icon-button>\n <input\n class=\"volume\"\n type=\"range\"\n min=\"0\"\n max=\"1\"\n step=\"0.05\"\n .value=${String(this._muted ? 0 : this._volume)}\n aria-label=\"Volume\"\n @input=${this._onVolumeInput}\n />\n <icon-button\n .icon=${this._fullscreen ? iconArrowsPointingIn(18) : iconArrowsPointingOut(18)}\n label=${this._fullscreen ? \"Exit fullscreen\" : \"Enter fullscreen\"}\n @click=${this._toggleFullscreen}\n ></icon-button>\n </div>\n `}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"video-player\": VideoPlayer;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"video-player.js","sourceRoot":"","sources":["../src/video-player.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;GAaG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA8EL,qCAAqC;QACzB,QAAG,GAAG,EAAE,CAAC;QACrB,iDAAiD;QACrC,WAAM,GAAG,EAAE,CAAC;QACxB,0DAA0D;QAC9C,UAAK,GAAG,cAAc,CAAC;QACnC,8CAA8C;QACjB,SAAI,GAAG,KAAK,CAAC;QAC1C,qCAAqC;QACzB,YAAO,GAAiC,UAAU,CAAC;QAE9C,aAAQ,GAAG,KAAK,CAAC;QACjB,iBAAY,GAAG,CAAC,CAAC;QACjB,cAAS,GAAG,GAAG,CAAC;QAChB,YAAO,GAAG,CAAC,CAAC;QACZ,WAAM,GAAG,KAAK,CAAC;QACf,aAAQ,GAAG,KAAK,CAAC;QACjB,gBAAW,GAAG,KAAK,CAAC;QAKrC,wBAAmB,GAAG,GAAS,EAAE;YAC/B,IAAI,CAAC,WAAW,GAAG,QA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AE,CAAC;yCAAc;AAE9B;IAAX,QAAQ,EAAE;4CAAoD;AAE9C;IAAhB,KAAK,EAAE;6CAA0B;AACjB;IAAhB,KAAK,EAAE;iDAA0B;AACjB;IAAhB,KAAK,EAAE;8CAAyB;AAChB;IAAhB,KAAK,EAAE;4CAAqB;AACZ;IAAhB,KAAK,EAAE;2CAAwB;AACf;IAAhB,KAAK,EAAE;6CAA0B;AACjB;IAAhB,KAAK,EAAE;gDAA6B;AAEb;IAAvB,KAAK,CAAC,OAAO,CAAC;2CAAmC;AACzB;IAAxB,KAAK,CAAC,QAAQ,CAAC;2CAAiC;AAlGtC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA+PvB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport { transportRangeStyles } from \"./utils/transport-controls.js\";\nimport { formatClockDuration } from \"./utils/duration.js\";\nimport {\n iconArrowsPointingIn,\n iconArrowsPointingOut,\n iconPause,\n iconPlay,\n iconSpeakerWave,\n iconSpeakerXMark,\n} from \"./icons.js\";\nimport \"./icon-button.js\";\n\n/**\n * Video player wrapping a native `<video>` element (native `controls`\n * disabled) with the same tokenized transport bar as `audio-player` — a\n * play/pause `icon-button`, elapsed/total time, a seekable progress bar, a\n * mute toggle + volume slider — plus a fullscreen toggle. The control bar\n * sits in a persistent strip under the video frame rather than a\n * hover-reveal overlay, so it stays usable for keyboard/touch input without\n * a pointer hover state.\n *\n * @element video-player\n * @fires play - The video started playing.\n * @fires pause - The video was paused.\n * @fires ended - Playback reached the end.\n */\n@customElement(\"video-player\")\nexport class VideoPlayer extends LitElement {\n static override styles = [\n tokens,\n transportRangeStyles,\n css`\n :host {\n display: block;\n }\n .player {\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n overflow: hidden;\n background: var(--ui-surface, #ffffff);\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 .frame {\n display: flex;\n /* Letterboxing behind the video's own content is a universal video\n convention independent of the surrounding theme — same literal-color\n exception category as this package's white map rings/avatar marks. */\n background: #000000;\n }\n video {\n display: block;\n width: 100%;\n max-height: 30rem;\n object-fit: contain;\n }\n .controls {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n }\n .time {\n flex: 0 0 auto;\n min-width: 2.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n text-align: center;\n }\n .seek {\n /* Sets its own width (100%) and flex-basis: 0 (not auto) so it\n fills the row's remaining space via flex-grow — an auto basis\n would otherwise derive its hypothetical size from that same\n width:100%, resolved against an indefinite container, and\n collapse the track to 0. */\n flex: 1 1 0%;\n min-width: 0;\n width: 100%;\n }\n .volume {\n flex: 0 0 auto;\n width: 4rem;\n }\n .error {\n padding: 0.5rem 0.75rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .player {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** URL of the video file to play. */\n @property() src = \"\";\n /** Poster image shown before playback starts. */\n @property() poster = \"\";\n /** Accessible name for the player, e.g. a video title. */\n @property() label = \"Video player\";\n /** Loops playback once it reaches the end. */\n @property({ type: Boolean }) loop = false;\n /** Native `<video preload>` hint. */\n @property() preload: \"none\" | \"metadata\" | \"auto\" = \"metadata\";\n\n @state() private _playing = false;\n @state() private _currentTime = 0;\n @state() private _duration = NaN;\n @state() private _volume = 1;\n @state() private _muted = false;\n @state() private _errored = false;\n @state() private _fullscreen = false;\n\n @query(\"video\") private _video?: HTMLVideoElement;\n @query(\".frame\") private _frame?: HTMLDivElement;\n\n #onFullscreenChange = (): void => {\n this._fullscreen = document.fullscreenElement === this._frame;\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener(\"fullscreenchange\", this.#onFullscreenChange);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"fullscreenchange\", this.#onFullscreenChange);\n }\n\n private _togglePlay(): void {\n const video = this._video;\n if (!video) return;\n if (video.paused) video.play();\n else video.pause();\n }\n\n private _toggleMute(): void {\n const video = this._video;\n if (!video) return;\n video.muted = !video.muted;\n }\n\n private _toggleFullscreen(): void {\n const frame = this._frame;\n if (!frame) return;\n if (document.fullscreenElement === frame) document.exitFullscreen();\n else frame.requestFullscreen();\n }\n\n private _onSeekInput(e: Event): void {\n const video = this._video;\n if (!video) return;\n const value = Number((e.target as HTMLInputElement).value);\n video.currentTime = value;\n this._currentTime = value;\n }\n\n private _onVolumeInput(e: Event): void {\n const video = this._video;\n if (!video) return;\n const value = Number((e.target as HTMLInputElement).value);\n video.volume = value;\n // Adjusting the slider while muted is treated as an implicit unmute, so\n // dragging it back up audibly takes effect instead of appearing frozen.\n if (video.muted && value > 0) video.muted = false;\n }\n\n private _onLoadedMetadata(): void {\n this._duration = this._video?.duration ?? NaN;\n this._errored = false;\n }\n\n private _onTimeUpdate(): void {\n this._currentTime = this._video?.currentTime ?? 0;\n }\n\n private _onPlay(): void {\n this._playing = true;\n this.dispatchEvent(new CustomEvent(\"play\", { bubbles: true, composed: true }));\n }\n\n private _onPause(): void {\n this._playing = false;\n this.dispatchEvent(new CustomEvent(\"pause\", { bubbles: true, composed: true }));\n }\n\n private _onEnded(): void {\n this._playing = false;\n this.dispatchEvent(new CustomEvent(\"ended\", { bubbles: true, composed: true }));\n }\n\n private _onVolumeChange(): void {\n const video = this._video;\n if (!video) return;\n this._volume = video.volume;\n this._muted = video.muted;\n }\n\n private _onError(): void {\n this._errored = true;\n }\n\n override render() {\n const duration = this._duration;\n const seekMax = Number.isFinite(duration) && duration > 0 ? duration : 0;\n return html`\n <div class=\"player\" role=\"group\" aria-label=${this.label}>\n <div class=\"frame\">\n <video\n .src=${this.src}\n poster=${this.poster || \"\"}\n ?loop=${this.loop}\n preload=${this.preload}\n @loadedmetadata=${this._onLoadedMetadata}\n @timeupdate=${this._onTimeUpdate}\n @play=${this._onPlay}\n @pause=${this._onPause}\n @ended=${this._onEnded}\n @volumechange=${this._onVolumeChange}\n @error=${this._onError}\n @click=${this._togglePlay}\n ></video>\n </div>\n ${this._errored\n ? html`<span class=\"error\">Unable to load video</span>`\n : html`\n <div class=\"controls\">\n <icon-button\n .icon=${this._playing ? iconPause(18) : iconPlay(18)}\n label=${this._playing ? \"Pause\" : \"Play\"}\n @click=${this._togglePlay}\n ></icon-button>\n <span class=\"time\">${formatClockDuration(this._currentTime)}</span>\n <input\n class=\"seek\"\n type=\"range\"\n min=\"0\"\n max=${seekMax}\n step=\"0.1\"\n .value=${String(this._currentTime)}\n aria-label=\"Seek\"\n aria-valuetext=${formatClockDuration(this._currentTime)}\n @input=${this._onSeekInput}\n />\n <span class=\"time\">${formatClockDuration(duration)}</span>\n <icon-button\n .icon=${this._muted || this._volume === 0 ? iconSpeakerXMark(18) : iconSpeakerWave(18)}\n label=${this._muted ? \"Unmute\" : \"Mute\"}\n @click=${this._toggleMute}\n ></icon-button>\n <input\n class=\"volume\"\n type=\"range\"\n min=\"0\"\n max=\"1\"\n step=\"0.05\"\n .value=${String(this._muted ? 0 : this._volume)}\n aria-label=\"Volume\"\n @input=${this._onVolumeInput}\n />\n <icon-button\n .icon=${this._fullscreen ? iconArrowsPointingIn(18) : iconArrowsPointingOut(18)}\n label=${this._fullscreen ? \"Exit fullscreen\" : \"Enter fullscreen\"}\n @click=${this._toggleFullscreen}\n ></icon-button>\n </div>\n `}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"video-player\": VideoPlayer;\n }\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { PropertyValues } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* An up/down vote widget with a live score readout — the "vote an entry up or
|
|
5
|
+
* down toward a promotion threshold" pattern from a public register site,
|
|
6
|
+
* where one member casts a single vote that can be changed or withdrawn at any
|
|
7
|
+
* time. Two native `<button>`s flank a score; the button matching the user's
|
|
8
|
+
* own cast `vote` reads as pressed (`aria-pressed`), and clicking it again
|
|
9
|
+
* withdraws the vote. Set an optional `target` to render a thin progress meter
|
|
10
|
+
* toward the promotion threshold beneath (vertical) or beside (horizontal) the
|
|
11
|
+
* buttons.
|
|
12
|
+
*
|
|
13
|
+
* @element vote-control
|
|
14
|
+
* @fires vote-change - The user cast, switched, or withdrew their vote;
|
|
15
|
+
* detail: { vote: "up" | "down" | null, value: number }.
|
|
16
|
+
*/
|
|
17
|
+
export declare class VoteControl extends LitElement {
|
|
18
|
+
#private;
|
|
19
|
+
static styles: import("lit").CSSResult[];
|
|
20
|
+
/** The current net score shown between the buttons. */
|
|
21
|
+
value: number;
|
|
22
|
+
/** This user's own cast vote, or `null` if they have not voted. Reflected so CSS can style the pressed button. */
|
|
23
|
+
vote: "up" | "down" | null;
|
|
24
|
+
/** Disables both buttons and dims the control. */
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
/** Layout — `vertical` is the compact stacked box (default); `horizontal` is the wide inline variant. */
|
|
27
|
+
orientation: "vertical" | "horizontal";
|
|
28
|
+
/** Promotion threshold. When > 0, a thin progress meter toward it renders; when 0 (default) no meter renders and no space is reserved for it. */
|
|
29
|
+
target: number;
|
|
30
|
+
/** Accessible label naming the vote group. */
|
|
31
|
+
label: string;
|
|
32
|
+
updated(changed: PropertyValues<this>): void;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
"vote-control": VoteControl;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=vote-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vote-control.d.ts","sourceRoot":"","sources":["../src/vote-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK1C;;;;;;;;;;;;;GAaG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,OAAgB,MAAM,4BA0KpB;IAEF,uDAAuD;IACZ,KAAK,SAAK;IAErD,kHAAkH;IACrF,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAQ;IAE/D,kDAAkD;IACN,QAAQ,UAAS;IAE7D,yGAAyG;IAC5E,WAAW,EAAE,UAAU,GAAG,YAAY,CAAc;IAEjF,iJAAiJ;IACrH,MAAM,SAAK;IAEvC,8CAA8C;IAClC,KAAK,SAAU;IAElB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,QAI7C;IA4BQ,MAAM,yCA8Cd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|