@f-ewald/components 1.37.5 → 1.39.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.
Files changed (78) hide show
  1. package/README.md +25 -1
  2. package/custom-elements.json +45 -6
  3. package/dist/calendar-day.js +1 -1
  4. package/dist/calendar-day.js.map +1 -1
  5. package/dist/distribution-chart.js +1 -1
  6. package/dist/distribution-chart.js.map +1 -1
  7. package/dist/dropdown-button.js +1 -1
  8. package/dist/dropdown-button.js.map +1 -1
  9. package/dist/form-select.js +1 -1
  10. package/dist/form-select.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/kanban-board.js +1 -1
  16. package/dist/kanban-board.js.map +1 -1
  17. package/dist/kanban-column.js +1 -1
  18. package/dist/kanban-column.js.map +1 -1
  19. package/dist/link-card.js +1 -1
  20. package/dist/link-card.js.map +1 -1
  21. package/dist/loading-dots.js +1 -1
  22. package/dist/loading-dots.js.map +1 -1
  23. package/dist/multi-select.js +1 -1
  24. package/dist/multi-select.js.map +1 -1
  25. package/dist/photo-gallery.js +3 -3
  26. package/dist/photo-gallery.js.map +1 -1
  27. package/dist/radio-pills.js +1 -1
  28. package/dist/radio-pills.js.map +1 -1
  29. package/dist/range-slider.js +5 -5
  30. package/dist/range-slider.js.map +1 -1
  31. package/dist/scroll-dots.js +1 -1
  32. package/dist/scroll-dots.js.map +1 -1
  33. package/dist/slide-panel.js +1 -1
  34. package/dist/slide-panel.js.map +1 -1
  35. package/dist/stat-meter.js +1 -1
  36. package/dist/stat-meter.js.map +1 -1
  37. package/dist/status-pill.js +1 -1
  38. package/dist/status-pill.js.map +1 -1
  39. package/dist/timeline-entry.js +2 -2
  40. package/dist/timeline-entry.js.map +1 -1
  41. package/dist/tokens.css +17 -1
  42. package/dist/tokens.d.ts +27 -0
  43. package/dist/tokens.d.ts.map +1 -1
  44. package/dist/tokens.js +54 -0
  45. package/dist/tokens.js.map +1 -1
  46. package/dist/ui-button.js +2 -2
  47. package/dist/ui-button.js.map +1 -1
  48. package/dist/ui-checkbox.d.ts +10 -1
  49. package/dist/ui-checkbox.d.ts.map +1 -1
  50. package/dist/ui-checkbox.js +11 -2
  51. package/dist/ui-checkbox.js.map +1 -1
  52. package/dist/user-avatar.js +2 -2
  53. package/dist/user-avatar.js.map +1 -1
  54. package/dist/utils/transport-controls.js +5 -5
  55. package/dist/utils/transport-controls.js.map +1 -1
  56. package/docs/calendar-day.md +1 -0
  57. package/docs/design-language.md +21 -4
  58. package/docs/distribution-chart.md +1 -0
  59. package/docs/dropdown-button.md +1 -0
  60. package/docs/form-select.md +1 -0
  61. package/docs/kanban-board.md +1 -0
  62. package/docs/kanban-column.md +1 -0
  63. package/docs/link-card.md +1 -0
  64. package/docs/loading-dots.md +1 -0
  65. package/docs/multi-select.md +1 -0
  66. package/docs/photo-gallery.md +1 -0
  67. package/docs/radio-pills.md +1 -0
  68. package/docs/range-slider.md +2 -0
  69. package/docs/scroll-dots.md +1 -0
  70. package/docs/slide-panel.md +1 -0
  71. package/docs/stat-meter.md +1 -0
  72. package/docs/status-pill.md +1 -0
  73. package/docs/timeline-entry.md +1 -0
  74. package/docs/ui-button.md +1 -0
  75. package/docs/ui-checkbox.md +13 -2
  76. package/docs/user-avatar.md +1 -0
  77. package/llms.txt +34 -20
  78. package/package.json +1 -1
package/README.md CHANGED
@@ -178,12 +178,36 @@ set. Don't reintroduce that pattern.)
178
178
  Setting `data-theme="gradient"` on `<html>` layers a glossy gradient look
179
179
  onto `ui-button` (primary, danger, and secondary variants) and
180
180
  `toast-notification` (all four variants: success, error, info, warning) on
181
- top of the flat light palette — see `gradientTokenValues` in
181
+ top of the flat light palette, plus the secondary muted surface shared by
182
+ `button-group`, `pagination-nav`, `radio-cards`, and `radio-pills` — see
183
+ `gradientTokenValues` in
182
184
  [`src/tokens.ts`](./src/tokens.ts). Every other token stays at its light-mode
183
185
  value. It takes precedence over the
184
186
  OS dark preference (like `data-theme="light"` does), since the gradient's
185
187
  color stops are hardcoded for a light surface.
186
188
 
189
+ ### Metro theme
190
+
191
+ Setting `data-theme="metro"` on `<html>` flattens the light palette: square
192
+ corners, hairline separators in place of drop shadows, and a blue accent — see
193
+ `metroTokenValues` in [`src/tokens.ts`](./src/tokens.ts). Like
194
+ `data-theme="gradient"`, it is built on the light palette and so takes
195
+ precedence over the OS dark preference.
196
+
197
+ This is the one theme that overrides **shape** rather than only color. It
198
+ squares every corner in the design system, including the deliberate pill and
199
+ circle shapes — chips, avatars, dots, slider thumbs — which read
200
+ `--ui-radius-pill`/`--ui-radius-circle` for exactly that reason. Two notes:
201
+
202
+ - If you add a component, route any pill or circle through those tokens rather
203
+ than a literal `9999px`/`50%`; a literal silently opts that shape out of every
204
+ theme. A design-language contract test enforces this.
205
+ - One residual is out of reach: `price-history-chart` rounds its bars with an
206
+ SVG `rx` presentation attribute, which cannot take a `var()`.
207
+ - `--ui-shadow`/`--ui-shadow-lg` become a hard 1px ring rather than `none`.
208
+ Removing them outright would leave `slide-panel` — the only overlay with no
209
+ border of its own — as an invisible white-on-white edge.
210
+
187
211
  The full token set is defined in [`src/tokens.ts`](./src/tokens.ts).
188
212
  Typography, spacing, control, icon, radius, panel, chart, and accessibility
189
213
  measurements follow the canonical
@@ -11159,6 +11159,22 @@
11159
11159
  "module": "./tokens.js"
11160
11160
  }
11161
11161
  },
11162
+ {
11163
+ "kind": "js",
11164
+ "name": "gradientTokenValues",
11165
+ "declaration": {
11166
+ "name": "gradientTokenValues",
11167
+ "module": "./tokens.js"
11168
+ }
11169
+ },
11170
+ {
11171
+ "kind": "js",
11172
+ "name": "metroTokenValues",
11173
+ "declaration": {
11174
+ "name": "metroTokenValues",
11175
+ "module": "./tokens.js"
11176
+ }
11177
+ },
11162
11178
  {
11163
11179
  "kind": "js",
11164
11180
  "name": "*",
@@ -19451,7 +19467,7 @@
19451
19467
  "type": {
19452
19468
  "text": "Record<string, string>"
19453
19469
  },
19454
- "default": "{ // Colors \"--ui-primary\": \"#4f46e5\", // indigo-600 \"--ui-primary-hover\": \"#4338ca\", // indigo-700 // Button-specific background/border hooks: default to the flat --ui-primary // / --ui-danger tokens above unchanged, so those stay the single source of // truth for every other component. Overriding just these lets a theme opt // ui-button into a gradient (or any other) background without touching // component markup; --ui-button-border/--ui-button-danger-border default // to transparent (today's look) and are meant to be paired with a shade // darker than the gradient's dark stop when one is set. The `-active` // variants default to whatever `-background` already resolved to (so a // solid override still applies while pressed) — a gradient theme should // set them to the same stops in reverse, for a pressed/\"indented\" look. \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\", \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\", \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\", \"--ui-button-border\": \"transparent\", // The bordered, transparent-background secondary variant's equivalents — // shared with confirm-dialog's Cancel button, which is the same visual // pattern. Defaults reproduce today's literal secondary styling exactly // (no background at any state, border colors matching --ui-border / // --ui-text-muted), so a theme only needs to override these to make // secondary/Cancel buttons match a primary/danger gradient theme. \"--ui-button-secondary-background\": \"none\", \"--ui-button-secondary-background-hover\": \"none\", \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\", \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\", \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\", // A muted-gray surface used wherever something already paints // --ui-surface-muted as a state indicator in flat mode — button-group's // unchecked-segment hover, pagination-nav's button hover, and // radio-cards/radio-pills' checked background — which is a genuinely // different default than secondary's borderless flat hover, so it can't // reuse --ui-button-secondary-background-hover's \"none\" default. \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\", // Shared by both primary/danger — a purely cosmetic gloss/legibility pair, // not color-specific, so one token covers both variants. `-highlight` is a // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for // a glossy top edge, defaulting to a fully transparent (so invisible) // shadow rather than the keyword `none` — some usages combine it with // another literal shadow in a comma-separated list, where a bare `none` // item is invalid CSS and would zero out the *whole* declaration. // `-text-shadow` is a full text-shadow value for label legibility against // a gradient's lighter stop, always used standalone, so it keeps `none`. \"--ui-button-highlight\": \"0 0 0 0 transparent\", \"--ui-button-text-shadow\": \"none\", // A solid stand-in for the same accent, for spots that can't render a // background gradient at all — a native <input>'s accent-color only // accepts a plain color, and a hard-stop background gradient (e.g. // range-slider's filled track) can't nest another gradient inside its own // color-stop list. Consumers that theme the buttons into a gradient should // set this to the gradient's dark stop, so these non-button accents (radio // selection indicators, the range-slider track/thumb) stay visually // coordinated with it even though they can't literally paint a gradient. \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\", \"--ui-info\": \"#0ea5e9\", // sky-500 \"--ui-info-hover\": \"#0284c7\", // sky-600 \"--ui-danger\": \"#dc2626\", // red-600 \"--ui-danger-hover\": \"#b91c1c\", // red-700 \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\", \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\", \"--ui-button-danger-background-active\": \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\", \"--ui-button-danger-border\": \"transparent\", \"--ui-success\": \"#16a34a\", // green-600 \"--ui-warning\": \"#d97706\", // amber-600 \"--ui-warning-hover\": \"#b45309\", // amber-700 // toast-notification's per-variant background hooks: default to the flat // --ui-success/--ui-danger/--ui-info/--ui-warning tokens unchanged, so // those stay the single source of truth for every other component — // the same pattern as --ui-button-background/--ui-button-danger-background // above. `-highlight`/`-text-shadow` are the same glossy-top-edge / // legibility-shadow pair as --ui-button-highlight/--ui-button-text-shadow, // kept as separate tokens so a theme can gloss toasts and buttons // independently. \"--ui-toast-success-background\": \"var(--ui-success, #16a34a)\", \"--ui-toast-error-background\": \"var(--ui-danger, #dc2626)\", \"--ui-toast-info-background\": \"var(--ui-info, #0ea5e9)\", \"--ui-toast-warning-background\": \"var(--ui-warning, #d97706)\", \"--ui-toast-highlight\": \"0 0 0 0 transparent\", \"--ui-toast-text-shadow\": \"none\", // AI accent sweep — the four stops of the animated multi-hue ring // ui-button's `ai` modifier draws around a button (and the only place a // rainbow reads as meaning \"this action is AI-powered\" rather than a // semantic state). Ordered around the color wheel and looping back to // stop 1, so the sweep is seamless; --ui-ai-2 is --ui-primary's own // indigo, anchoring the ring to the rest of the palette. Overriding these // four retunes every AI button at once. \"--ui-ai-1\": \"#38bdf8\", // sky-400 \"--ui-ai-2\": \"#6366f1\", // indigo-500 \"--ui-ai-3\": \"#d946ef\", // fuchsia-500 \"--ui-ai-4\": \"#fbbf24\", // amber-400 \"--ui-on-accent\": \"#ffffff\", \"--ui-text\": \"#0f172a\", // slate-900 \"--ui-text-muted\": \"#64748b\", // slate-500 \"--ui-border\": \"#e2e8f0\", // slate-200 \"--ui-surface\": \"#ffffff\", // white \"--ui-surface-muted\": \"#f8fafc\", // slate-50 \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash \"--ui-tooltip\": \"#0f172a\", // slate-900 \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\", \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45% // Shape / depth \"--ui-radius\": \"0.5rem\", // rounded-lg \"--ui-radius-sm\": \"0.25rem\", // rounded \"--ui-shadow\": \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md \"--ui-shadow-lg\": \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\", // Type \"--ui-font\": 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"', \"--ui-font-mono\": \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\", \"--ui-font-size-lg\": \"1rem\", // text-base \"--ui-font-size\": \"0.875rem\", // text-sm \"--ui-font-size-sm\": \"0.75rem\", // text-xs \"--ui-font-size-xs\": \"0.6875rem\", // Font weights — the only four weights the system uses. \"--ui-font-weight-regular\": \"400\", \"--ui-font-weight-medium\": \"500\", \"--ui-font-weight-semibold\": \"600\", \"--ui-font-weight-bold\": \"700\", // Line heights — glyph (icon/marker box), tight (headings), normal (body). \"--ui-line-height-glyph\": \"1\", \"--ui-line-height-tight\": \"1.25\", \"--ui-line-height-normal\": \"1.5\", // Letter spacing / tracking — default and the single widened step. \"--ui-tracking-normal\": \"0\", \"--ui-tracking-wide\": \"0.04em\", }",
19470
+ "default": "{ // Colors \"--ui-primary\": \"#4f46e5\", // indigo-600 \"--ui-primary-hover\": \"#4338ca\", // indigo-700 // Button-specific background/border hooks: default to the flat --ui-primary // / --ui-danger tokens above unchanged, so those stay the single source of // truth for every other component. Overriding just these lets a theme opt // ui-button into a gradient (or any other) background without touching // component markup; --ui-button-border/--ui-button-danger-border default // to transparent (today's look) and are meant to be paired with a shade // darker than the gradient's dark stop when one is set. The `-active` // variants default to whatever `-background` already resolved to (so a // solid override still applies while pressed) — a gradient theme should // set them to the same stops in reverse, for a pressed/\"indented\" look. \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\", \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\", \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\", \"--ui-button-border\": \"transparent\", // The bordered, transparent-background secondary variant's equivalents — // shared with confirm-dialog's Cancel button, which is the same visual // pattern. Defaults reproduce today's literal secondary styling exactly // (no background at any state, border colors matching --ui-border / // --ui-text-muted), so a theme only needs to override these to make // secondary/Cancel buttons match a primary/danger gradient theme. \"--ui-button-secondary-background\": \"none\", \"--ui-button-secondary-background-hover\": \"none\", \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\", \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\", \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\", // A muted-gray surface used wherever something already paints // --ui-surface-muted as a state indicator in flat mode — button-group's // unchecked-segment hover, pagination-nav's button hover, and // radio-cards/radio-pills' checked background — which is a genuinely // different default than secondary's borderless flat hover, so it can't // reuse --ui-button-secondary-background-hover's \"none\" default. \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\", // Shared by both primary/danger — a purely cosmetic gloss/legibility pair, // not color-specific, so one token covers both variants. `-highlight` is a // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for // a glossy top edge, defaulting to a fully transparent (so invisible) // shadow rather than the keyword `none` — some usages combine it with // another literal shadow in a comma-separated list, where a bare `none` // item is invalid CSS and would zero out the *whole* declaration. // `-text-shadow` is a full text-shadow value for label legibility against // a gradient's lighter stop, always used standalone, so it keeps `none`. \"--ui-button-highlight\": \"0 0 0 0 transparent\", \"--ui-button-text-shadow\": \"none\", // A solid stand-in for the same accent, for spots that can't render a // background gradient at all — a native <input>'s accent-color only // accepts a plain color, and a hard-stop background gradient (e.g. // range-slider's filled track) can't nest another gradient inside its own // color-stop list. Consumers that theme the buttons into a gradient should // set this to the gradient's dark stop, so these non-button accents (radio // selection indicators, the range-slider track/thumb) stay visually // coordinated with it even though they can't literally paint a gradient. \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\", \"--ui-info\": \"#0ea5e9\", // sky-500 \"--ui-info-hover\": \"#0284c7\", // sky-600 \"--ui-danger\": \"#dc2626\", // red-600 \"--ui-danger-hover\": \"#b91c1c\", // red-700 \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\", \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\", \"--ui-button-danger-background-active\": \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\", \"--ui-button-danger-border\": \"transparent\", \"--ui-success\": \"#16a34a\", // green-600 \"--ui-warning\": \"#d97706\", // amber-600 \"--ui-warning-hover\": \"#b45309\", // amber-700 // toast-notification's per-variant background hooks: default to the flat // --ui-success/--ui-danger/--ui-info/--ui-warning tokens unchanged, so // those stay the single source of truth for every other component — // the same pattern as --ui-button-background/--ui-button-danger-background // above. `-highlight`/`-text-shadow` are the same glossy-top-edge / // legibility-shadow pair as --ui-button-highlight/--ui-button-text-shadow, // kept as separate tokens so a theme can gloss toasts and buttons // independently. \"--ui-toast-success-background\": \"var(--ui-success, #16a34a)\", \"--ui-toast-error-background\": \"var(--ui-danger, #dc2626)\", \"--ui-toast-info-background\": \"var(--ui-info, #0ea5e9)\", \"--ui-toast-warning-background\": \"var(--ui-warning, #d97706)\", \"--ui-toast-highlight\": \"0 0 0 0 transparent\", \"--ui-toast-text-shadow\": \"none\", // AI accent sweep — the four stops of the animated multi-hue ring // ui-button's `ai` modifier draws around a button (and the only place a // rainbow reads as meaning \"this action is AI-powered\" rather than a // semantic state). Ordered around the color wheel and looping back to // stop 1, so the sweep is seamless; --ui-ai-2 is --ui-primary's own // indigo, anchoring the ring to the rest of the palette. Overriding these // four retunes every AI button at once. \"--ui-ai-1\": \"#38bdf8\", // sky-400 \"--ui-ai-2\": \"#6366f1\", // indigo-500 \"--ui-ai-3\": \"#d946ef\", // fuchsia-500 \"--ui-ai-4\": \"#fbbf24\", // amber-400 \"--ui-on-accent\": \"#ffffff\", \"--ui-text\": \"#0f172a\", // slate-900 \"--ui-text-muted\": \"#64748b\", // slate-500 \"--ui-border\": \"#e2e8f0\", // slate-200 \"--ui-surface\": \"#ffffff\", // white \"--ui-surface-muted\": \"#f8fafc\", // slate-50 \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash \"--ui-tooltip\": \"#0f172a\", // slate-900 \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\", \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45% // Shape / depth \"--ui-radius\": \"0.5rem\", // rounded-lg \"--ui-radius-sm\": \"0.25rem\", // rounded // Deliberate pill/circle shapes — a chip, an avatar, a slider thumb, a dot. // Tokenized rather than hardcoded so a theme that squares the design system // (metro) can reach them too; a literal 9999px/50% silently opts that shape // out of every theme. Use these only where the shape is the point, not as a // heavier --ui-radius. \"--ui-radius-pill\": \"9999px\", \"--ui-radius-circle\": \"50%\", \"--ui-shadow\": \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md \"--ui-shadow-lg\": \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\", // Type \"--ui-font\": 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"', \"--ui-font-mono\": \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\", \"--ui-font-size-lg\": \"1rem\", // text-base \"--ui-font-size\": \"0.875rem\", // text-sm \"--ui-font-size-sm\": \"0.75rem\", // text-xs \"--ui-font-size-xs\": \"0.6875rem\", // Font weights — the only four weights the system uses. \"--ui-font-weight-regular\": \"400\", \"--ui-font-weight-medium\": \"500\", \"--ui-font-weight-semibold\": \"600\", \"--ui-font-weight-bold\": \"700\", // Line heights — glyph (icon/marker box), tight (headings), normal (body). \"--ui-line-height-glyph\": \"1\", \"--ui-line-height-tight\": \"1.25\", \"--ui-line-height-normal\": \"1.5\", // Letter spacing / tracking — default and the single widened step. \"--ui-tracking-normal\": \"0\", \"--ui-tracking-wide\": \"0.04em\", }",
19455
19471
  "description": "Design token values, sourced from Tailwind v4's default theme palette.\nEach entry maps a `--ui-*` custom property name to its default value.\nThese are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\nthroughout component styles, so components render correctly with zero\nexternal CSS. Consumers may override any of these by setting the custom\nproperty on `:root` or an ancestor element (see `tokens.css`)."
19456
19472
  },
19457
19473
  {
@@ -19469,9 +19485,18 @@
19469
19485
  "type": {
19470
19486
  "text": "Record<string, string>"
19471
19487
  },
19472
- "default": "{ \"--ui-button-background\": \"linear-gradient(180deg, #6366f1 0%, #4f46e5 100%)\", // indigo-500 -> 600 \"--ui-button-background-hover\": \"linear-gradient(180deg, #818cf8 0%, #6366f1 100%)\", // indigo-400 -> 500 \"--ui-button-background-active\": \"linear-gradient(180deg, #4f46e5 0%, #6366f1 100%)\", // reversed 600 -> 500 \"--ui-button-border\": \"#4338ca\", // indigo-700 \"--ui-button-danger-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600 \"--ui-button-danger-background-hover\": \"linear-gradient(180deg, #f87171 0%, #ef4444 100%)\", // red-400 -> 500 \"--ui-button-danger-background-active\": \"linear-gradient(180deg, #dc2626 0%, #ef4444 100%)\", // reversed 600 -> 500 \"--ui-button-danger-border\": \"#b91c1c\", // red-700 // Secondary stays neutral gray rather than a saturated hue, matching its // flat \"not the primary action\" role, but one shade darker than the // original white -> slate-50 pairing: at a small button size, that pair // read as flat white with no visible gradient at all. slate-50 -> 100 // keeps enough contrast to actually look like a gradient while still // being clearly lighter/quieter than primary/danger. Border stays // slate-300 (a step past the flat slate-200) so its edge still reads // against the fill. \"--ui-button-secondary-background\": \"linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)\", // slate-50 -> 100 \"--ui-button-secondary-background-hover\": \"linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%)\", // slate-100 -> 200 \"--ui-button-secondary-background-active\": \"linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%)\", // reversed 100 -> 50 \"--ui-button-secondary-border\": \"#cbd5e1\", // slate-300 \"--ui-button-secondary-border-hover\": \"#94a3b8\", // slate-400 \"--ui-button-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge \"--ui-button-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility on primary/danger \"--ui-button-accent\": \"#4338ca\", // indigo-700, matches --ui-button-border // toast-notification: same light-to-dark, one-shade-step gradient // convention as the button variants above; the bottom stop always matches // the flat --ui-success/--ui-danger/--ui-info/--ui-warning value exactly. \"--ui-toast-success-background\": \"linear-gradient(180deg, #22c55e 0%, #16a34a 100%)\", // green-500 -> 600 \"--ui-toast-error-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600 \"--ui-toast-info-background\": \"linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%)\", // sky-400 -> 500 \"--ui-toast-warning-background\": \"linear-gradient(180deg, #f59e0b 0%, #d97706 100%)\", // amber-500 -> 600 \"--ui-toast-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge, same as --ui-button-highlight \"--ui-toast-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility, same as --ui-button-text-shadow }",
19488
+ "default": "{ \"--ui-button-background\": \"linear-gradient(180deg, #6366f1 0%, #4f46e5 100%)\", // indigo-500 -> 600 \"--ui-button-background-hover\": \"linear-gradient(180deg, #818cf8 0%, #6366f1 100%)\", // indigo-400 -> 500 \"--ui-button-background-active\": \"linear-gradient(180deg, #4f46e5 0%, #6366f1 100%)\", // reversed 600 -> 500 \"--ui-button-border\": \"#4338ca\", // indigo-700 \"--ui-button-danger-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600 \"--ui-button-danger-background-hover\": \"linear-gradient(180deg, #f87171 0%, #ef4444 100%)\", // red-400 -> 500 \"--ui-button-danger-background-active\": \"linear-gradient(180deg, #dc2626 0%, #ef4444 100%)\", // reversed 600 -> 500 \"--ui-button-danger-border\": \"#b91c1c\", // red-700 // Secondary stays neutral gray rather than a saturated hue, matching its // flat \"not the primary action\" role, but one shade darker than the // original white -> slate-50 pairing: at a small button size, that pair // read as flat white with no visible gradient at all. slate-50 -> 100 // keeps enough contrast to actually look like a gradient while still // being clearly lighter/quieter than primary/danger. Border stays // slate-300 (a step past the flat slate-200) so its edge still reads // against the fill. \"--ui-button-secondary-background\": \"linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)\", // slate-50 -> 100 \"--ui-button-secondary-background-hover\": \"linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%)\", // slate-100 -> 200 \"--ui-button-secondary-background-active\": \"linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%)\", // reversed 100 -> 50 \"--ui-button-secondary-border\": \"#cbd5e1\", // slate-300 \"--ui-button-secondary-border-hover\": \"#94a3b8\", // slate-400 // button-group's unchecked segments, pagination-nav's prev/next buttons, and // radio-cards/radio-pills' checked background read this rather than // --ui-button-secondary-background (see tokens above). Left flat they were // the one \"secondary\" surface that stayed matte while every actual secondary // button turned glossy, so it tracks the hover gradient rather than a // separate literal that could drift out of step with it. \"--ui-button-secondary-surface-muted\": \"var(--ui-button-secondary-background-hover)\", \"--ui-button-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge \"--ui-button-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility on primary/danger \"--ui-button-accent\": \"#4338ca\", // indigo-700, matches --ui-button-border // toast-notification: same light-to-dark, one-shade-step gradient // convention as the button variants above; the bottom stop always matches // the flat --ui-success/--ui-danger/--ui-info/--ui-warning value exactly. \"--ui-toast-success-background\": \"linear-gradient(180deg, #22c55e 0%, #16a34a 100%)\", // green-500 -> 600 \"--ui-toast-error-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600 \"--ui-toast-info-background\": \"linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%)\", // sky-400 -> 500 \"--ui-toast-warning-background\": \"linear-gradient(180deg, #f59e0b 0%, #d97706 100%)\", // amber-500 -> 600 \"--ui-toast-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge, same as --ui-button-highlight \"--ui-toast-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility, same as --ui-button-text-shadow }",
19473
19489
  "description": "\"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\nlight palette, using exactly the `--ui-button-*`/`--ui-button-danger-*`/\n`--ui-button-secondary-*` hooks `ui-button.ts` already reads (see that\nfile's doc comment), plus the `--ui-toast-*` hooks `toast-notification.ts`\nreads (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\ntoasts 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\ntoken so it still reads as \"the same color, glossy\" rather than a\ndifferent hue; `-hover` shifts the whole pair one shade lighter, `-active`\nreverses the two stops for a pressed/\"indented\" look, and `-border` is a\nshade darker than the gradient's dark stop for a defining edge."
19474
19490
  },
19491
+ {
19492
+ "kind": "variable",
19493
+ "name": "metroTokenValues",
19494
+ "type": {
19495
+ "text": "Record<string, string>"
19496
+ },
19497
+ "default": "{ \"--ui-primary\": \"#3274d0\", // the del.icio.us blue; no Tailwind equivalent \"--ui-primary-hover\": \"#2559a8\", \"--ui-focus-ring\": \"0 0 0 2px #3274d0\", // solid and crisp, not the default 3px translucent ring \"--ui-radius\": \"0\", \"--ui-radius-sm\": \"0\", \"--ui-radius-pill\": \"0\", \"--ui-radius-circle\": \"0\", // Hairline rings (slate-900 at low alpha) rather than blurred drop shadows: // separation without depth. -lg is a touch stronger, matching the default // pair's relative weighting. \"--ui-shadow\": \"0 0 0 1px rgb(15 23 42 / 0.12)\", \"--ui-shadow-lg\": \"0 0 0 1px rgb(15 23 42 / 0.18)\", }",
19498
+ "description": "\"Metro\" theme overrides, applied via `data-theme=\"metro\"` on `<html>` (see\n`generate-tokens-css.mjs`) — forces `color-scheme: light` like the `\"light\"`\nand `\"gradient\"` overrides, and strips the roundness and depth off the flat\nlight palette to leave hard-edged surfaces over a blue accent, after the\ndense square-cornered look of the early social bookmarking sites.\n\nThis is the first theme to override shape rather than only color, so the\n\"shape/type tokens are theme-independent\" rule `darkTokenValues` notes above\nholds for every theme except this one (see `docs/design-language.md`).\nSquaring the design system means squaring the deliberate pill and circle\nshapes 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\nOne residual is genuinely out of reach: `price-history-chart` rounds its bars\nwith an SVG `rx` presentation attribute, which cannot take a `var()`, so\nthose stay slightly rounded under metro.\n\nThe shadows flatten to a hairline ring rather than to `none`. Dropping them\noutright would leave `slide-panel` — the only overlay with no border of its\nown — 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\nit on hover/active over an already-bordered control. A hard 1px ring keeps\nthat separation while removing the blur and the faked depth."
19499
+ },
19475
19500
  {
19476
19501
  "kind": "variable",
19477
19502
  "name": "tokens",
@@ -19504,6 +19529,14 @@
19504
19529
  "module": "src/tokens.ts"
19505
19530
  }
19506
19531
  },
19532
+ {
19533
+ "kind": "js",
19534
+ "name": "metroTokenValues",
19535
+ "declaration": {
19536
+ "name": "metroTokenValues",
19537
+ "module": "src/tokens.ts"
19538
+ }
19539
+ },
19507
19540
  {
19508
19541
  "kind": "js",
19509
19542
  "name": "tokens",
@@ -20097,8 +20130,14 @@
20097
20130
  "declarations": [
20098
20131
  {
20099
20132
  "kind": "class",
20100
- "description": "A form-associated boolean checkbox, usable standalone or inside a native\n`<form>`. Submits `name=on` when checked (matching native\n`<input type=\"checkbox\">` semantics) and participates fully in form\n`reset()`, ancestor `<fieldset disabled>`, and `required` validity.\n\nRenders a native `<input type=\"checkbox\">` wrapped in a `<label>`, styled\nvia `:has()` on the wrapping label (matching `radio-pills`/`radio-cards`)\nrather than styling the native input directly; the checkbox itself renders\nat `1rem`, matching the existing radio-input convention. An optional\npre-rendered `icon` (matching `form-select`'s per-option icon convention)\nrenders between the box and the label, inside the same clickable `<label>`\n— for a row that pairs a checkbox with an icon/swatch and needs the whole\nrow, icon included, to stay one click target.",
20133
+ "description": "A form-associated boolean checkbox, usable standalone or inside a native\n`<form>`. Submits `name=on` when checked (matching native\n`<input type=\"checkbox\">` semantics) and participates fully in form\n`reset()`, ancestor `<fieldset disabled>`, and `required` validity.\n\nRenders a native `<input type=\"checkbox\">` wrapped in a `<label>`, styled\nvia `:has()` on the wrapping label (matching `radio-pills`/`radio-cards`)\nrather than styling the native input directly; the checkbox itself renders\nat `1rem`, matching the existing radio-input convention. An optional\npre-rendered `icon` (matching `form-select`'s per-option icon convention)\nrenders between the box and the label, inside the same clickable `<label>`\n— for a row that pairs a checkbox with an icon/swatch and needs the whole\nrow, icon included, to stay one click target.\n\nThe label is the default slot, with the `label` property as its fallback.\nSlot it instead of setting the property when it needs its own markup or\nstyling — a link, an emphasized word — since a property renders inside this\ncomponent's shadow DOM and cannot be reached from outside. Either way the\nlabel sits inside the native `<label>`, so it stays clickable and still\nnames the checkbox for assistive technology.",
20101
20134
  "name": "UiCheckbox",
20135
+ "slots": [
20136
+ {
20137
+ "description": "The label, overriding the `label` property; for a label that needs its own markup or styling.",
20138
+ "name": ""
20139
+ }
20140
+ ],
20102
20141
  "members": [
20103
20142
  {
20104
20143
  "kind": "field",
@@ -20166,7 +20205,7 @@
20166
20205
  "text": "string"
20167
20206
  },
20168
20207
  "default": "\"\"",
20169
- "description": "Visible label text rendered next to the box.",
20208
+ "description": "Visible label text rendered next to the box; overridden by the default slot.",
20170
20209
  "attribute": "label"
20171
20210
  },
20172
20211
  {
@@ -20381,7 +20420,7 @@
20381
20420
  "text": "string"
20382
20421
  },
20383
20422
  "default": "\"\"",
20384
- "description": "Visible label text rendered next to the box.",
20423
+ "description": "Visible label text rendered next to the box; overridden by the default slot.",
20385
20424
  "fieldName": "label"
20386
20425
  },
20387
20426
  {
@@ -22353,7 +22392,7 @@
22353
22392
  {
22354
22393
  "kind": "variable",
22355
22394
  "name": "transportRangeStyles",
22356
- "default": "css` input[type=\"range\"] { -webkit-appearance: none; appearance: none; /* Width is intentionally left to the consumer (e.g. .seek/.volume in audio-player/video-player) — this element+attribute selector has higher specificity than a single class rule, so setting a width here would win over a component's own narrower class and silently stretch every range input (including a fixed-width volume slider) to 100%. */ height: 1rem; margin: 0; background: transparent; cursor: pointer; } input[type=\"range\"]:disabled { cursor: not-allowed; opacity: 0.6; } input[type=\"range\"]::-webkit-slider-runnable-track { height: 0.25rem; border-radius: 9999px; /* A hard-stop gradient two-tone fill trick — see range-slider.ts for why this reads --ui-button-accent rather than --ui-button-background. */ background: linear-gradient( to right, var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%, var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%), var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%), var(--ui-surface-muted, #f8fafc) 100% ); } input[type=\"range\"]::-moz-range-track { height: 0.25rem; border-radius: 9999px; background: var(--ui-surface-muted, #f8fafc); } input[type=\"range\"]::-moz-range-progress { height: 0.25rem; border-radius: 9999px; background: var(--ui-button-accent, var(--ui-primary, #4f46e5)); } input[type=\"range\"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 0.75rem; height: 0.75rem; /* WebKit centers the thumb on the input's full 1rem box, not the thinner custom track — nudge it up to align, as in range-slider.ts. */ transform: translateY(-0.25rem); border-radius: 50%; background: var(--ui-button-background, var(--ui-primary, #4f46e5)); border: 2px solid var(--ui-surface, #ffffff); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent); } input[type=\"range\"]::-moz-range-thumb { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--ui-button-background, var(--ui-primary, #4f46e5)); border: 2px solid var(--ui-surface, #ffffff); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent); } input[type=\"range\"]:disabled::-webkit-slider-thumb { background: var(--ui-text-muted, #64748b); } input[type=\"range\"]:disabled::-moz-range-thumb { background: var(--ui-text-muted, #64748b); } input[type=\"range\"]:focus-visible { outline: none; } input[type=\"range\"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)); } input[type=\"range\"]:focus-visible::-moz-range-thumb { box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)); } @media (prefers-reduced-motion: no-preference) { input[type=\"range\"]::-webkit-slider-thumb { transition: box-shadow 120ms ease; } input[type=\"range\"]::-moz-range-thumb { transition: box-shadow 120ms ease; } } @media (forced-colors: active) { input[type=\"range\"]::-webkit-slider-runnable-track { background: Canvas; border: 1px solid CanvasText; } input[type=\"range\"]::-webkit-slider-thumb { background: Highlight; border-color: Canvas; } input[type=\"range\"]:focus-visible::-webkit-slider-thumb { outline: 2px solid CanvasText; outline-offset: 2px; box-shadow: none; } } `",
22395
+ "default": "css` input[type=\"range\"] { -webkit-appearance: none; appearance: none; /* Width is intentionally left to the consumer (e.g. .seek/.volume in audio-player/video-player) — this element+attribute selector has higher specificity than a single class rule, so setting a width here would win over a component's own narrower class and silently stretch every range input (including a fixed-width volume slider) to 100%. */ height: 1rem; margin: 0; background: transparent; cursor: pointer; } input[type=\"range\"]:disabled { cursor: not-allowed; opacity: 0.6; } input[type=\"range\"]::-webkit-slider-runnable-track { height: 0.25rem; border-radius: var(--ui-radius-pill, 9999px); /* A hard-stop gradient two-tone fill trick — see range-slider.ts for why this reads --ui-button-accent rather than --ui-button-background. */ background: linear-gradient( to right, var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%, var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%), var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%), var(--ui-surface-muted, #f8fafc) 100% ); } input[type=\"range\"]::-moz-range-track { height: 0.25rem; border-radius: var(--ui-radius-pill, 9999px); background: var(--ui-surface-muted, #f8fafc); } input[type=\"range\"]::-moz-range-progress { height: 0.25rem; border-radius: var(--ui-radius-pill, 9999px); background: var(--ui-button-accent, var(--ui-primary, #4f46e5)); } input[type=\"range\"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 0.75rem; height: 0.75rem; /* WebKit centers the thumb on the input's full 1rem box, not the thinner custom track — nudge it up to align, as in range-slider.ts. */ transform: translateY(-0.25rem); border-radius: var(--ui-radius-circle, 50%); background: var(--ui-button-background, var(--ui-primary, #4f46e5)); border: 2px solid var(--ui-surface, #ffffff); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent); } input[type=\"range\"]::-moz-range-thumb { width: 0.75rem; height: 0.75rem; border-radius: var(--ui-radius-circle, 50%); background: var(--ui-button-background, var(--ui-primary, #4f46e5)); border: 2px solid var(--ui-surface, #ffffff); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent); } input[type=\"range\"]:disabled::-webkit-slider-thumb { background: var(--ui-text-muted, #64748b); } input[type=\"range\"]:disabled::-moz-range-thumb { background: var(--ui-text-muted, #64748b); } input[type=\"range\"]:focus-visible { outline: none; } input[type=\"range\"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)); } input[type=\"range\"]:focus-visible::-moz-range-thumb { box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)); } @media (prefers-reduced-motion: no-preference) { input[type=\"range\"]::-webkit-slider-thumb { transition: box-shadow 120ms ease; } input[type=\"range\"]::-moz-range-thumb { transition: box-shadow 120ms ease; } } @media (forced-colors: active) { input[type=\"range\"]::-webkit-slider-runnable-track { background: Canvas; border: 1px solid CanvasText; } input[type=\"range\"]::-webkit-slider-thumb { background: Highlight; border-color: Canvas; } input[type=\"range\"]:focus-visible::-webkit-slider-thumb { outline: 2px solid CanvasText; outline-offset: 2px; box-shadow: none; } } `",
22357
22396
  "description": "Shared `<input type=\"range\">` track/thumb styling for media transport\ncontrols (the seek bar and volume slider in `audio-player`/`video-player`).\nReuses `range-slider.ts`'s track/fill visual language (a filled portion up\nto `--range-percent`) so both players get free native keyboard/pointer\nseeking instead of a custom-built draggable control, matching the \"native\nsemantics before custom ARIA\" rule. Extracted here rather than duplicated\nbecause both components need the identical rule set."
22358
22397
  }
22359
22398
  ],
@@ -205,7 +205,7 @@ let CalendarDay = class CalendarDay extends CalendarTimelineBase {
205
205
  position: absolute;
206
206
  top: 50%;
207
207
  right: 100%;
208
- border-radius: 9999px;
208
+ border-radius: var(--ui-radius-pill, 9999px);
209
209
  padding: 0.125rem 0.25rem;
210
210
  background: var(--ui-danger, #dc2626);
211
211
  color: var(--ui-on-accent, #ffffff);
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-day.js","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,SAAS,GAEV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,kBAAkB,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AAM,CAAC,CACxF;cACC,SAAS,KAAK,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,qCAAqC,SAAS;2CACvB,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;uBACjD;YACT,CAAC,CAAC,OAAO;;;4BAGK,IAAI,CAAC,gBAAgB;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AApZ8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAsC;AAOI;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CAAoB;AAQpC;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;6CAAe;AAElD;IAAhB,KAAK,EAAE;yCAA2B;AAnBxB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAsZvB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n assignLanes,\n isWeekend,\n minutesSinceMidnight,\n monthName,\n parseIsoDate,\n toIsoDate,\n type LanedEntry,\n} from \"./utils/calendar.js\";\n\nconst NOW_MARKER_INTERVAL_MS = 60_000;\n\nconst HOUR_HEIGHT_REM = 3;\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\nconst nowLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n// Half-heights of the current-time pill and of an hour label, derived from\n// --ui-font-size-sm x --ui-line-height-tight (plus the pill's vertical\n// padding). Used to work out which hour label the pill covers.\nconst NOW_PILL_HALF_HEIGHT_REM = (0.75 * 1.25 + 0.25) / 2;\nconst HOUR_LABEL_HALF_HEIGHT_REM = (0.75 * 1.25) / 2;\n\n/**\n * Formats `date` as a locale-aware clock time without any AM/PM marker, e.g.\n * \"6:37\" in a 12-hour locale and \"18:37\" in a 24-hour one. The meridiem is\n * dropped so the label stays narrow enough for the hour gutter.\n */\nfunction nowLabel(date: Date): string {\n return nowLabelFormatter\n .formatToParts(date)\n .filter((part) => part.type !== \"dayPeriod\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n}\n\n/**\n * The hour (0-23) whose gutter label the current-time pill overlaps, given the\n * pill's offset in rem from the top of the grid, or `null` when the pill\n * clears every label. Labels sit flush with the top of their own hour cell.\n */\nfunction hourLabelCoveredByNow(nowTopRem: number | null): number | null {\n if (nowTopRem === null) return null;\n const hour = Math.round((nowTopRem - HOUR_LABEL_HALF_HEIGHT_REM) / HOUR_HEIGHT_REM);\n if (hour < 0 || hour > 23) return null;\n const labelCenterRem = hour * HOUR_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n const clearance = NOW_PILL_HALF_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n return Math.abs(nowTopRem - labelCenterRem) < clearance ? hour : null;\n}\n\n/**\n * A single day rendered as an hourly time grid — a Google-Calendar-style\n * view distinct from `calendar-month`'s whole-day table. Declarative\n * `calendar-entry` children with a time-of-day in `start`/`end` (e.g.\n * `start=\"2026-03-05T09:00\"`) render as positioned/sized blocks; entries\n * with only a date (no time) render in an all-day band above the grid.\n * Overlapping timed entries stack into side-by-side columns; overlapping\n * all-day/multi-day entries stack into lanes, same as `calendar-month`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-week` via `CalendarTimelineBase`.\n *\n * @element calendar-day\n * @slot - Declarative `calendar-entry` elements to render for this day.\n * @slot actions - Optional controls rendered beside the day name (e.g. day-navigation buttons).\n */\n@customElement(\"calendar-day\")\nexport class CalendarDay extends CalendarTimelineBase {\n /** The day shown, `\"YYYY-MM-DD\"`. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n /**\n * Shows a fine live line marking the current time, with a rounded pill in\n * the hour gutter reading the current clock time. The hour label the pill\n * covers is hidden while it does. Only rendered when `date` is today.\n */\n @property({ type: Boolean, reflect: true, attribute: \"time-marker\" }) timeMarker = false;\n\n /**\n * Minimum width for the day column, as a CSS length (e.g. `\"18rem\"`).\n * Unset leaves the host's width fully controlled by its container —\n * useful as the sizing floor when placing several `calendar-day`\n * elements in a scrollable row.\n */\n @property({ reflect: true, attribute: \"min-width\" }) minWidth = \"\";\n\n @state() private _now = Date.now();\n\n private _nowTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n min-width: var(--calendar-day-min-width, 0);\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 .day-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .day-name {\n margin: 0;\n min-width: 0;\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .day-name.weekend {\n color: var(--ui-text-muted, #64748b);\n }\n .day-name.today {\n color: var(--ui-primary, #4f46e5);\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .all-day-lanes {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 0.25rem;\n }\n .all-day-lane {\n display: flex;\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: right;\n white-space: nowrap;\n }\n /* Hidden rather than removed so the cell keeps its own separator line. */\n .hour-label.covered {\n visibility: hidden;\n }\n .day-column {\n position: relative;\n flex: 1 1 auto;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n }\n .day-column.weekend {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .now-line {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: var(--ui-danger, #dc2626);\n pointer-events: none;\n z-index: 2;\n }\n /* Overhangs left into the hour gutter; nothing between here and .grid\n clips overflow, and .day-column's z-index stays auto, so the pill\n paints above the (unpositioned) hour labels it overlaps. */\n .now-pill {\n position: absolute;\n top: 50%;\n right: 100%;\n border-radius: 9999px;\n padding: 0.125rem 0.25rem;\n background: var(--ui-danger, #dc2626);\n color: var(--ui-on-accent, #ffffff);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transform: translateY(-50%);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n flex: 1 1 auto;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Starts the current-time ticker if `time-marker` is already set on connect. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._syncNowTimer();\n }\n\n /** Stops the current-time ticker when this element disconnects. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._nowTimer != null) clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n\n /** Starts/stops the current-time ticker and re-syncs the min-width host style to match the latest properties. */\n protected override updated(): void {\n super.updated();\n this._syncNowTimer();\n this._syncMinWidth();\n }\n\n /** Ensures a 60s current-time ticker is running only while `timeMarker` is enabled. */\n private _syncNowTimer(): void {\n if (this.timeMarker && this._nowTimer == null) {\n this._now = Date.now();\n this._nowTimer = setInterval(() => {\n this._now = Date.now();\n }, NOW_MARKER_INTERVAL_MS);\n } else if (!this.timeMarker && this._nowTimer != null) {\n clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n }\n\n /** Reflects `minWidth` onto the `--calendar-day-min-width` custom property the host's own styles read. */\n private _syncMinWidth(): void {\n if (this.minWidth) {\n this.style.setProperty(\"--calendar-day-min-width\", this.minWidth);\n } else {\n this.style.removeProperty(\"--calendar-day-min-width\");\n }\n }\n\n /** Renders one lane's stacked all-day bars, given the entries assigned to it. */\n private _renderAllDayLane(laned: LanedEntry[], lane: number) {\n const entries = laned.filter((entry) => entry.lane === lane);\n return html`\n <div class=\"all-day-lane\">\n ${entries.map((entry) => {\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n })}\n </div>\n `;\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to this day's bounds. */\n private _renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n protected override render() {\n const day = parseIsoDate(this.date) ?? new Date();\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const isToday = toIsoDate(day) === toIsoDate(new Date());\n const isWeekendDay = isWeekend(day);\n\n const resolved = this.resolveTimedEntriesFor(dayStart, dayEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n const { entries: lanedTimed, laneCount: timedLaneCount } = assignLanes(timed);\n const nowTopRem =\n this.timeMarker && isToday ? (minutesSinceMidnight(new Date(this._now)) / 60) * HOUR_HEIGHT_REM : null;\n const coveredHour = hourLabelCoveredByNow(nowTopRem);\n\n return html`\n <div class=\"day\">\n <div class=\"day-header\">\n <h4 class=\"day-name ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${monthName(day.getMonth() + 1)} ${day.getDate()}, ${day.getFullYear()}\n </h4>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\">\n ${repeat(\n Array.from({ length: Math.max(allDayLaneCount, 1) }, (_, i) => i),\n (lane) => lane,\n (lane) => this._renderAllDayLane(lanedAllDay, lane),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map(\n (h) =>\n html`<div class=\"hour-label-cell\">\n <span class=\"hour-label ${h === coveredHour ? \"covered\" : \"\"}\">${hourLabel(h)}</span>\n </div>`,\n )}\n </div>\n <div class=\"day-column ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n lanedTimed,\n (entry) => this.entryKey(entry),\n (entry) => this._renderTimedEntry(entry, Math.max(timedLaneCount, 1), dayStart, dayEnd),\n )}\n ${nowTopRem !== null\n ? html`<div class=\"now-line\" style=\"top: ${nowTopRem}rem\" aria-hidden=\"true\">\n <span class=\"now-pill\">${nowLabel(new Date(this._now))}</span>\n </div>`\n : nothing}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-day\": CalendarDay;\n }\n}\n"]}
1
+ {"version":3,"file":"calendar-day.js","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,SAAS,GAEV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,kBAAkB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAEnF,yEAAyE;AACzE,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,kBAAkB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,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;AAOI;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CAAoB;AAQpC;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;6CAAe;AAElD;IAAhB,KAAK,EAAE;yCAA2B;AAnBxB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAsZvB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n assignLanes,\n isWeekend,\n minutesSinceMidnight,\n monthName,\n parseIsoDate,\n toIsoDate,\n type LanedEntry,\n} from \"./utils/calendar.js\";\n\nconst NOW_MARKER_INTERVAL_MS = 60_000;\n\nconst HOUR_HEIGHT_REM = 3;\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\nconst nowLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n// Half-heights of the current-time pill and of an hour label, derived from\n// --ui-font-size-sm x --ui-line-height-tight (plus the pill's vertical\n// padding). Used to work out which hour label the pill covers.\nconst NOW_PILL_HALF_HEIGHT_REM = (0.75 * 1.25 + 0.25) / 2;\nconst HOUR_LABEL_HALF_HEIGHT_REM = (0.75 * 1.25) / 2;\n\n/**\n * Formats `date` as a locale-aware clock time without any AM/PM marker, e.g.\n * \"6:37\" in a 12-hour locale and \"18:37\" in a 24-hour one. The meridiem is\n * dropped so the label stays narrow enough for the hour gutter.\n */\nfunction nowLabel(date: Date): string {\n return nowLabelFormatter\n .formatToParts(date)\n .filter((part) => part.type !== \"dayPeriod\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n}\n\n/**\n * The hour (0-23) whose gutter label the current-time pill overlaps, given the\n * pill's offset in rem from the top of the grid, or `null` when the pill\n * clears every label. Labels sit flush with the top of their own hour cell.\n */\nfunction hourLabelCoveredByNow(nowTopRem: number | null): number | null {\n if (nowTopRem === null) return null;\n const hour = Math.round((nowTopRem - HOUR_LABEL_HALF_HEIGHT_REM) / HOUR_HEIGHT_REM);\n if (hour < 0 || hour > 23) return null;\n const labelCenterRem = hour * HOUR_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n const clearance = NOW_PILL_HALF_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n return Math.abs(nowTopRem - labelCenterRem) < clearance ? hour : null;\n}\n\n/**\n * A single day rendered as an hourly time grid — a Google-Calendar-style\n * view distinct from `calendar-month`'s whole-day table. Declarative\n * `calendar-entry` children with a time-of-day in `start`/`end` (e.g.\n * `start=\"2026-03-05T09:00\"`) render as positioned/sized blocks; entries\n * with only a date (no time) render in an all-day band above the grid.\n * Overlapping timed entries stack into side-by-side columns; overlapping\n * all-day/multi-day entries stack into lanes, same as `calendar-month`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-week` via `CalendarTimelineBase`.\n *\n * @element calendar-day\n * @slot - Declarative `calendar-entry` elements to render for this day.\n * @slot actions - Optional controls rendered beside the day name (e.g. day-navigation buttons).\n */\n@customElement(\"calendar-day\")\nexport class CalendarDay extends CalendarTimelineBase {\n /** The day shown, `\"YYYY-MM-DD\"`. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n /**\n * Shows a fine live line marking the current time, with a rounded pill in\n * the hour gutter reading the current clock time. The hour label the pill\n * covers is hidden while it does. Only rendered when `date` is today.\n */\n @property({ type: Boolean, reflect: true, attribute: \"time-marker\" }) timeMarker = false;\n\n /**\n * Minimum width for the day column, as a CSS length (e.g. `\"18rem\"`).\n * Unset leaves the host's width fully controlled by its container —\n * useful as the sizing floor when placing several `calendar-day`\n * elements in a scrollable row.\n */\n @property({ reflect: true, attribute: \"min-width\" }) minWidth = \"\";\n\n @state() private _now = Date.now();\n\n private _nowTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n min-width: var(--calendar-day-min-width, 0);\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 .day-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .day-name {\n margin: 0;\n min-width: 0;\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .day-name.weekend {\n color: var(--ui-text-muted, #64748b);\n }\n .day-name.today {\n color: var(--ui-primary, #4f46e5);\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .all-day-lanes {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 0.25rem;\n }\n .all-day-lane {\n display: flex;\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: right;\n white-space: nowrap;\n }\n /* Hidden rather than removed so the cell keeps its own separator line. */\n .hour-label.covered {\n visibility: hidden;\n }\n .day-column {\n position: relative;\n flex: 1 1 auto;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n }\n .day-column.weekend {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .now-line {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: var(--ui-danger, #dc2626);\n pointer-events: none;\n z-index: 2;\n }\n /* Overhangs left into the hour gutter; nothing between here and .grid\n clips overflow, and .day-column's z-index stays auto, so the pill\n paints above the (unpositioned) hour labels it overlaps. */\n .now-pill {\n position: absolute;\n top: 50%;\n right: 100%;\n border-radius: var(--ui-radius-pill, 9999px);\n padding: 0.125rem 0.25rem;\n background: var(--ui-danger, #dc2626);\n color: var(--ui-on-accent, #ffffff);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transform: translateY(-50%);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n flex: 1 1 auto;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Starts the current-time ticker if `time-marker` is already set on connect. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._syncNowTimer();\n }\n\n /** Stops the current-time ticker when this element disconnects. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._nowTimer != null) clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n\n /** Starts/stops the current-time ticker and re-syncs the min-width host style to match the latest properties. */\n protected override updated(): void {\n super.updated();\n this._syncNowTimer();\n this._syncMinWidth();\n }\n\n /** Ensures a 60s current-time ticker is running only while `timeMarker` is enabled. */\n private _syncNowTimer(): void {\n if (this.timeMarker && this._nowTimer == null) {\n this._now = Date.now();\n this._nowTimer = setInterval(() => {\n this._now = Date.now();\n }, NOW_MARKER_INTERVAL_MS);\n } else if (!this.timeMarker && this._nowTimer != null) {\n clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n }\n\n /** Reflects `minWidth` onto the `--calendar-day-min-width` custom property the host's own styles read. */\n private _syncMinWidth(): void {\n if (this.minWidth) {\n this.style.setProperty(\"--calendar-day-min-width\", this.minWidth);\n } else {\n this.style.removeProperty(\"--calendar-day-min-width\");\n }\n }\n\n /** Renders one lane's stacked all-day bars, given the entries assigned to it. */\n private _renderAllDayLane(laned: LanedEntry[], lane: number) {\n const entries = laned.filter((entry) => entry.lane === lane);\n return html`\n <div class=\"all-day-lane\">\n ${entries.map((entry) => {\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n })}\n </div>\n `;\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to this day's bounds. */\n private _renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n protected override render() {\n const day = parseIsoDate(this.date) ?? new Date();\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const isToday = toIsoDate(day) === toIsoDate(new Date());\n const isWeekendDay = isWeekend(day);\n\n const resolved = this.resolveTimedEntriesFor(dayStart, dayEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n const { entries: lanedTimed, laneCount: timedLaneCount } = assignLanes(timed);\n const nowTopRem =\n this.timeMarker && isToday ? (minutesSinceMidnight(new Date(this._now)) / 60) * HOUR_HEIGHT_REM : null;\n const coveredHour = hourLabelCoveredByNow(nowTopRem);\n\n return html`\n <div class=\"day\">\n <div class=\"day-header\">\n <h4 class=\"day-name ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${monthName(day.getMonth() + 1)} ${day.getDate()}, ${day.getFullYear()}\n </h4>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\">\n ${repeat(\n Array.from({ length: Math.max(allDayLaneCount, 1) }, (_, i) => i),\n (lane) => lane,\n (lane) => this._renderAllDayLane(lanedAllDay, lane),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map(\n (h) =>\n html`<div class=\"hour-label-cell\">\n <span class=\"hour-label ${h === coveredHour ? \"covered\" : \"\"}\">${hourLabel(h)}</span>\n </div>`,\n )}\n </div>\n <div class=\"day-column ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n lanedTimed,\n (entry) => this.entryKey(entry),\n (entry) => this._renderTimedEntry(entry, Math.max(timedLaneCount, 1), dayStart, dayEnd),\n )}\n ${nowTopRem !== null\n ? html`<div class=\"now-line\" style=\"top: ${nowTopRem}rem\" aria-hidden=\"true\">\n <span class=\"now-pill\">${nowLabel(new Date(this._now))}</span>\n </div>`\n : nothing}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-day\": CalendarDay;\n }\n}\n"]}
@@ -132,7 +132,7 @@ let DistributionChart = class DistributionChart extends LitElement {
132
132
  display: inline-block;
133
133
  width: 0.5rem;
134
134
  height: 0.5rem;
135
- border-radius: 50%;
135
+ border-radius: var(--ui-radius-circle, 50%);
136
136
  flex: 0 0 auto;
137
137
  }
138
138
  @media (prefers-reduced-motion: reduce) {
@@ -1 +1 @@
1
- {"version":3,"file":"distribution-chart.js","sourceRoot":"","sources":["../src/distribution-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBrC,2FAA2F;AAC3F,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE3E;;;;;;;;;;;GAWG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAgGL,wEAAwE;QAC5D,WAAM,GAAG,EAAE,CAAC;QACxB,4DAA4D;QAC5B,WAAM,GAAwB,EAAE,CAAC;QACjE,oFAAoF;QACpD,iBAAY,GAAa,qBAAqB,CAAC;QAC/E,8GAA8G;QAC1D,aAAQ,GAAG,EAAE,CAAC;QAEjD,UAAK,GAA4B,IAAI,CAAC;QACtC,aAAQ,GAAG,KAAK,CAAC;QACjB,WAAM,GAAkB,IAAI,CAAC;QAC9C,0EAA0E;QACzD,WAAM,GAAG,CAAC,CAAC;QAC5B,wFAAwF;QACvE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AE,CAAC;mDAAe;AAEjD;IAAhB,KAAK,EAAE;gDAA+C;AACtC;IAAhB,KAAK,EAAE;mDAA0B;AACjB;IAAhB,KAAK,EAAE;iDAAsC;AAE7B;IAAhB,KAAK,EAAE;iDAAoB;AAEX;IAAhB,KAAK,EAAE;kDAAuC;AA/GpC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA8R7B","sourcesContent":["import { LitElement, css, html, nothing, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { scaleLinear } from \"d3-scale\";\nimport { line, area } from \"d3-shape\";\nimport { max } from \"d3-array\";\nimport { tokens } from \"./tokens.js\";\n\ninterface DistributionPoint {\n x: number;\n y: number;\n}\n\ninterface DistributionData {\n points: DistributionPoint[];\n unit: string;\n label: string;\n min: number;\n max: number;\n mean: number;\n}\n\nexport interface DistributionValue {\n /** Short label shown on the chart marker, e.g. 'A'. Empty string = show raw value instead. */\n label: string;\n value: number;\n}\n\n/** Fixed SVG height in CSS pixels — the coordinate system is always 1 user-unit = 1 px. */\nconst SVG_H = 130;\nconst PAD = { top: 22, right: 12, bottom: 18, left: 12 };\n\n/** Default marker colors (indigo/amber/teal/rose 600s), assigned in order. */\nconst DEFAULT_MARKER_COLORS = [\"#4f46e5\", \"#d97706\", \"#0d9488\", \"#e11d48\"];\n\n/**\n * Renders a KDE distribution curve for a named metric with one or more value\n * markers. The SVG viewBox is kept in sync with the element's pixel width via\n * ResizeObserver so that font sizes and stroke widths are always in real pixels\n * regardless of container width.\n *\n * Pass `fontSize` to control all text size (default 10). Pass a single\n * `{label:'', value}` for a single-value display or multiple\n * `{label:'A'|'B'|...}` entries to compare several values.\n *\n * @element distribution-chart\n */\n@customElement(\"distribution-chart\")\nexport class DistributionChart extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n padding: 0.25rem 0 0.5rem;\n }\n svg {\n display: block;\n overflow: visible;\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 .curve {\n fill: none;\n stroke: var(--ui-primary, #4f46e5);\n stroke-width: 1.5;\n stroke-linejoin: round;\n }\n .fill {\n fill: url(#dist-fill-grad);\n }\n .fill-start {\n stop-color: var(--ui-primary, #4f46e5);\n }\n .crosshair {\n stroke: var(--ui-text-muted, #64748b);\n }\n .chart-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .skeleton {\n background: linear-gradient(\n 90deg,\n var(--ui-surface-muted, #f8fafc) 25%,\n var(--ui-border, #e2e8f0) 50%,\n var(--ui-surface-muted, #f8fafc) 75%\n );\n background-size: 200% 100%;\n animation: shimmer 1.4s infinite;\n border-radius: var(--ui-radius-sm, 0.25rem);\n height: 6.25rem;\n }\n @keyframes shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n .error {\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-danger, #dc2626);\n padding: 0.5rem 0;\n }\n .legend {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem 0.75rem;\n padding: 0.25rem 0 0.25rem 0.5rem;\n }\n .legend-item {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n color: var(--ui-text-muted, #64748b);\n }\n .legend-dot {\n display: inline-block;\n width: 0.5rem;\n height: 0.5rem;\n border-radius: 50%;\n flex: 0 0 auto;\n }\n @media (prefers-reduced-motion: reduce) {\n .skeleton {\n animation: none;\n }\n }\n `,\n ];\n\n /** Metric name, fetched from `/api/distribution/<metric>` on change. */\n @property() metric = \"\";\n /** One or more values to mark on the distribution curve. */\n @property({ attribute: false }) values: DistributionValue[] = [];\n /** Colors assigned to markers in order. Defaults to indigo/amber/teal/rose 600s. */\n @property({ attribute: false }) markerColors: string[] = DEFAULT_MARKER_COLORS;\n /** Target font size in CSS pixels (default 10). Always renders at this size regardless of container width. */\n @property({ type: Number, attribute: \"font-size\" }) fontSize = 10;\n\n @state() private _data: DistributionData | null = null;\n @state() private _loading = false;\n @state() private _error: string | null = null;\n /** Measured element width in CSS pixels. 0 until ResizeObserver fires. */\n @state() private _width = 0;\n /** Inner x coordinate (px) of the current hover position, or null when not hovering. */\n @state() private _hoverX: number | null = null;\n\n private _fetchedFor = \"\";\n private _ro: ResizeObserver | null = null;\n\n override connectedCallback() {\n super.connectedCallback();\n this._maybeFetch();\n }\n\n override firstUpdated() {\n this._ro = new ResizeObserver((entries) => {\n const w = Math.floor(entries[0].contentRect.width);\n if (w > 0 && w !== this._width) this._width = w;\n });\n this._ro.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has(\"metric\")) this._maybeFetch();\n }\n\n private _maybeFetch() {\n if (!this.metric || this._fetchedFor === this.metric) return;\n this._fetchedFor = this.metric;\n this._loading = true;\n this._error = null;\n fetch(`/api/distribution/${encodeURIComponent(this.metric)}`)\n .then((r) => {\n if (!r.ok) throw new Error(`HTTP ${r.status}`);\n return r.json() as Promise<DistributionData>;\n })\n .then((data) => {\n this._data = data;\n this._loading = false;\n })\n .catch((err: unknown) => {\n this._error = err instanceof Error ? err.message : \"Failed to load\";\n this._loading = false;\n });\n }\n\n private _renderSvg(data: DistributionData) {\n if (this._width === 0) return nothing;\n\n const innerW = this._width - PAD.left - PAD.right;\n const innerH = SVG_H - PAD.top - PAD.bottom;\n const fs = this.fontSize;\n\n const pts = data.points;\n const maxY = max(pts, (p) => p.y) ?? 1;\n\n const xScale = scaleLinear().domain([pts[0].x, pts[pts.length - 1].x]).range([0, innerW]);\n const yScale = scaleLinear().domain([0, maxY]).range([innerH, 0]);\n\n const lineFn = line<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y((p) => yScale(p.y));\n\n const areaFn = area<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y0(innerH)\n .y1((p) => yScale(p.y));\n\n const curvePath = lineFn(pts) ?? \"\";\n const fillPath = areaFn(pts) ?? \"\";\n\n const minLabel = data.min.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n const maxLabel = data.max.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n\n const hasLabels = this.values.some((v) => v.label !== \"\");\n\n const markers = this.values\n .filter((v) => v.value >= pts[0].x && v.value <= pts[pts.length - 1].x)\n .map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const mx = xScale(v.value);\n const labelText = hasLabels\n ? v.label\n : `${v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 })} ${data.unit}`;\n return svg`\n <line stroke=${color} stroke-width=\"1.5\" stroke-dasharray=\"4 3\"\n x1=${mx} y1=${0} x2=${mx} y2=${innerH} />\n <text font-size=${fs} font-weight=\"600\" fill=${color} text-anchor=\"middle\"\n x=${mx} y=${-fs * 0.4}>${labelText}</text>\n `;\n });\n\n const crosshair = this._hoverX != null ? (() => {\n const hx = Math.max(0, Math.min(innerW, this._hoverX!));\n const hVal = xScale.invert(hx);\n const hLabel = `${Math.round(hVal).toLocaleString(\"en-US\")} ${data.unit}`;\n // Keep label anchor away from edges so it doesn't clip\n const anchor = hx < innerW * 0.2 ? \"start\" : hx > innerW * 0.8 ? \"end\" : \"middle\";\n const lx = hx < innerW * 0.2 ? 0 : hx > innerW * 0.8 ? innerW : hx;\n return svg`\n <line class=\"crosshair\" stroke-width=\"1\" x1=${hx} y1=${0} x2=${hx} y2=${innerH} />\n <text class=\"chart-label\" font-size=${fs} font-weight=\"500\"\n text-anchor=${anchor} x=${lx} y=${-fs * 0.4}>${hLabel}</text>\n `;\n })() : nothing;\n\n const markerSummary = this.values.length > 0\n ? ` Markers: ${this.values\n .map((value) => `${value.label || \"value\"} ${value.value.toLocaleString(\"en-US\")} ${data.unit}`)\n .join(\", \")}.`\n : \"\";\n const summary =\n `${data.label}: ${data.min.toLocaleString(\"en-US\")} to ${data.max.toLocaleString(\"en-US\")} ${data.unit}, ` +\n `mean ${data.mean.toLocaleString(\"en-US\")} ${data.unit}.${markerSummary}`;\n\n return svg`\n <svg viewBox=\"0 0 ${this._width} ${SVG_H}\" width=${this._width} height=${SVG_H}\n role=\"img\" aria-label=${summary}\n style=\"cursor:crosshair\"\n @mousemove=${(e: MouseEvent) => {\n const innerX = e.offsetX - PAD.left;\n this._hoverX = (innerX >= 0 && innerX <= innerW) ? innerX : null;\n }}\n @mouseleave=${() => { this._hoverX = null; }}>\n <defs>\n <linearGradient id=\"dist-fill-grad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"fill-start\" offset=\"0%\" stop-opacity=\"0.28\"/>\n <stop class=\"fill-start\" offset=\"100%\" stop-opacity=\"0\"/>\n </linearGradient>\n </defs>\n <g transform=\"translate(${PAD.left},${PAD.top})\">\n <path class=\"fill\" d=${fillPath} />\n <path class=\"curve\" d=${curvePath} />\n ${markers}\n ${crosshair}\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"start\" x=${0} y=${innerH + fs * 1.4}>${minLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"end\" x=${innerW} y=${innerH + fs * 1.4}>${maxLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"middle\" x=${innerW / 2} y=${innerH + fs * 1.4}>${data.unit}</text>\n </g>\n </svg>\n `;\n }\n\n private _renderLegend(data: DistributionData) {\n const hasLabels = this.values.some((v) => v.label !== \"\");\n if (!hasLabels) return nothing;\n return html`\n <div class=\"legend\">\n ${this.values.map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const formatted = v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n return html`\n <span class=\"legend-item\">\n <span class=\"legend-dot\" style=\"background:${color}\"></span>\n ${v.label}: ${formatted} ${data.unit}\n </span>\n `;\n })}\n </div>\n `;\n }\n\n override render() {\n if (this._loading || this._width === 0) return html`<div class=\"wrap\"><div class=\"skeleton\"></div></div>`;\n if (this._error) return html`<div class=\"wrap\"><div class=\"error\">Could not load distribution</div></div>`;\n if (!this._data) return nothing;\n return html`\n <div class=\"wrap\">\n ${this._renderSvg(this._data)}\n ${this._renderLegend(this._data)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"distribution-chart\": DistributionChart;\n }\n}\n"]}
1
+ {"version":3,"file":"distribution-chart.js","sourceRoot":"","sources":["../src/distribution-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBrC,2FAA2F;AAC3F,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE3E;;;;;;;;;;;GAWG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAgGL,wEAAwE;QAC5D,WAAM,GAAG,EAAE,CAAC;QACxB,4DAA4D;QAC5B,WAAM,GAAwB,EAAE,CAAC;QACjE,oFAAoF;QACpD,iB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AAE;iDAAa;AAEQ;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAAkC;AAEjC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDAAgD;AAE3B;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;mDAAe;AAEjD;IAAhB,KAAK,EAAE;gDAA+C;AACtC;IAAhB,KAAK,EAAE;mDAA0B;AACjB;IAAhB,KAAK,EAAE;iDAAsC;AAE7B;IAAhB,KAAK,EAAE;iDAAoB;AAEX;IAAhB,KAAK,EAAE;kDAAuC;AA/GpC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA8R7B","sourcesContent":["import { LitElement, css, html, nothing, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { scaleLinear } from \"d3-scale\";\nimport { line, area } from \"d3-shape\";\nimport { max } from \"d3-array\";\nimport { tokens } from \"./tokens.js\";\n\ninterface DistributionPoint {\n x: number;\n y: number;\n}\n\ninterface DistributionData {\n points: DistributionPoint[];\n unit: string;\n label: string;\n min: number;\n max: number;\n mean: number;\n}\n\nexport interface DistributionValue {\n /** Short label shown on the chart marker, e.g. 'A'. Empty string = show raw value instead. */\n label: string;\n value: number;\n}\n\n/** Fixed SVG height in CSS pixels — the coordinate system is always 1 user-unit = 1 px. */\nconst SVG_H = 130;\nconst PAD = { top: 22, right: 12, bottom: 18, left: 12 };\n\n/** Default marker colors (indigo/amber/teal/rose 600s), assigned in order. */\nconst DEFAULT_MARKER_COLORS = [\"#4f46e5\", \"#d97706\", \"#0d9488\", \"#e11d48\"];\n\n/**\n * Renders a KDE distribution curve for a named metric with one or more value\n * markers. The SVG viewBox is kept in sync with the element's pixel width via\n * ResizeObserver so that font sizes and stroke widths are always in real pixels\n * regardless of container width.\n *\n * Pass `fontSize` to control all text size (default 10). Pass a single\n * `{label:'', value}` for a single-value display or multiple\n * `{label:'A'|'B'|...}` entries to compare several values.\n *\n * @element distribution-chart\n */\n@customElement(\"distribution-chart\")\nexport class DistributionChart extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n padding: 0.25rem 0 0.5rem;\n }\n svg {\n display: block;\n overflow: visible;\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 .curve {\n fill: none;\n stroke: var(--ui-primary, #4f46e5);\n stroke-width: 1.5;\n stroke-linejoin: round;\n }\n .fill {\n fill: url(#dist-fill-grad);\n }\n .fill-start {\n stop-color: var(--ui-primary, #4f46e5);\n }\n .crosshair {\n stroke: var(--ui-text-muted, #64748b);\n }\n .chart-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .skeleton {\n background: linear-gradient(\n 90deg,\n var(--ui-surface-muted, #f8fafc) 25%,\n var(--ui-border, #e2e8f0) 50%,\n var(--ui-surface-muted, #f8fafc) 75%\n );\n background-size: 200% 100%;\n animation: shimmer 1.4s infinite;\n border-radius: var(--ui-radius-sm, 0.25rem);\n height: 6.25rem;\n }\n @keyframes shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n .error {\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-danger, #dc2626);\n padding: 0.5rem 0;\n }\n .legend {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem 0.75rem;\n padding: 0.25rem 0 0.25rem 0.5rem;\n }\n .legend-item {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n color: var(--ui-text-muted, #64748b);\n }\n .legend-dot {\n display: inline-block;\n width: 0.5rem;\n height: 0.5rem;\n border-radius: var(--ui-radius-circle, 50%);\n flex: 0 0 auto;\n }\n @media (prefers-reduced-motion: reduce) {\n .skeleton {\n animation: none;\n }\n }\n `,\n ];\n\n /** Metric name, fetched from `/api/distribution/<metric>` on change. */\n @property() metric = \"\";\n /** One or more values to mark on the distribution curve. */\n @property({ attribute: false }) values: DistributionValue[] = [];\n /** Colors assigned to markers in order. Defaults to indigo/amber/teal/rose 600s. */\n @property({ attribute: false }) markerColors: string[] = DEFAULT_MARKER_COLORS;\n /** Target font size in CSS pixels (default 10). Always renders at this size regardless of container width. */\n @property({ type: Number, attribute: \"font-size\" }) fontSize = 10;\n\n @state() private _data: DistributionData | null = null;\n @state() private _loading = false;\n @state() private _error: string | null = null;\n /** Measured element width in CSS pixels. 0 until ResizeObserver fires. */\n @state() private _width = 0;\n /** Inner x coordinate (px) of the current hover position, or null when not hovering. */\n @state() private _hoverX: number | null = null;\n\n private _fetchedFor = \"\";\n private _ro: ResizeObserver | null = null;\n\n override connectedCallback() {\n super.connectedCallback();\n this._maybeFetch();\n }\n\n override firstUpdated() {\n this._ro = new ResizeObserver((entries) => {\n const w = Math.floor(entries[0].contentRect.width);\n if (w > 0 && w !== this._width) this._width = w;\n });\n this._ro.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has(\"metric\")) this._maybeFetch();\n }\n\n private _maybeFetch() {\n if (!this.metric || this._fetchedFor === this.metric) return;\n this._fetchedFor = this.metric;\n this._loading = true;\n this._error = null;\n fetch(`/api/distribution/${encodeURIComponent(this.metric)}`)\n .then((r) => {\n if (!r.ok) throw new Error(`HTTP ${r.status}`);\n return r.json() as Promise<DistributionData>;\n })\n .then((data) => {\n this._data = data;\n this._loading = false;\n })\n .catch((err: unknown) => {\n this._error = err instanceof Error ? err.message : \"Failed to load\";\n this._loading = false;\n });\n }\n\n private _renderSvg(data: DistributionData) {\n if (this._width === 0) return nothing;\n\n const innerW = this._width - PAD.left - PAD.right;\n const innerH = SVG_H - PAD.top - PAD.bottom;\n const fs = this.fontSize;\n\n const pts = data.points;\n const maxY = max(pts, (p) => p.y) ?? 1;\n\n const xScale = scaleLinear().domain([pts[0].x, pts[pts.length - 1].x]).range([0, innerW]);\n const yScale = scaleLinear().domain([0, maxY]).range([innerH, 0]);\n\n const lineFn = line<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y((p) => yScale(p.y));\n\n const areaFn = area<DistributionPoint>()\n .x((p) => xScale(p.x))\n .y0(innerH)\n .y1((p) => yScale(p.y));\n\n const curvePath = lineFn(pts) ?? \"\";\n const fillPath = areaFn(pts) ?? \"\";\n\n const minLabel = data.min.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n const maxLabel = data.max.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n\n const hasLabels = this.values.some((v) => v.label !== \"\");\n\n const markers = this.values\n .filter((v) => v.value >= pts[0].x && v.value <= pts[pts.length - 1].x)\n .map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const mx = xScale(v.value);\n const labelText = hasLabels\n ? v.label\n : `${v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 })} ${data.unit}`;\n return svg`\n <line stroke=${color} stroke-width=\"1.5\" stroke-dasharray=\"4 3\"\n x1=${mx} y1=${0} x2=${mx} y2=${innerH} />\n <text font-size=${fs} font-weight=\"600\" fill=${color} text-anchor=\"middle\"\n x=${mx} y=${-fs * 0.4}>${labelText}</text>\n `;\n });\n\n const crosshair = this._hoverX != null ? (() => {\n const hx = Math.max(0, Math.min(innerW, this._hoverX!));\n const hVal = xScale.invert(hx);\n const hLabel = `${Math.round(hVal).toLocaleString(\"en-US\")} ${data.unit}`;\n // Keep label anchor away from edges so it doesn't clip\n const anchor = hx < innerW * 0.2 ? \"start\" : hx > innerW * 0.8 ? \"end\" : \"middle\";\n const lx = hx < innerW * 0.2 ? 0 : hx > innerW * 0.8 ? innerW : hx;\n return svg`\n <line class=\"crosshair\" stroke-width=\"1\" x1=${hx} y1=${0} x2=${hx} y2=${innerH} />\n <text class=\"chart-label\" font-size=${fs} font-weight=\"500\"\n text-anchor=${anchor} x=${lx} y=${-fs * 0.4}>${hLabel}</text>\n `;\n })() : nothing;\n\n const markerSummary = this.values.length > 0\n ? ` Markers: ${this.values\n .map((value) => `${value.label || \"value\"} ${value.value.toLocaleString(\"en-US\")} ${data.unit}`)\n .join(\", \")}.`\n : \"\";\n const summary =\n `${data.label}: ${data.min.toLocaleString(\"en-US\")} to ${data.max.toLocaleString(\"en-US\")} ${data.unit}, ` +\n `mean ${data.mean.toLocaleString(\"en-US\")} ${data.unit}.${markerSummary}`;\n\n return svg`\n <svg viewBox=\"0 0 ${this._width} ${SVG_H}\" width=${this._width} height=${SVG_H}\n role=\"img\" aria-label=${summary}\n style=\"cursor:crosshair\"\n @mousemove=${(e: MouseEvent) => {\n const innerX = e.offsetX - PAD.left;\n this._hoverX = (innerX >= 0 && innerX <= innerW) ? innerX : null;\n }}\n @mouseleave=${() => { this._hoverX = null; }}>\n <defs>\n <linearGradient id=\"dist-fill-grad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"fill-start\" offset=\"0%\" stop-opacity=\"0.28\"/>\n <stop class=\"fill-start\" offset=\"100%\" stop-opacity=\"0\"/>\n </linearGradient>\n </defs>\n <g transform=\"translate(${PAD.left},${PAD.top})\">\n <path class=\"fill\" d=${fillPath} />\n <path class=\"curve\" d=${curvePath} />\n ${markers}\n ${crosshair}\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"start\" x=${0} y=${innerH + fs * 1.4}>${minLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"end\" x=${innerW} y=${innerH + fs * 1.4}>${maxLabel}</text>\n <text class=\"chart-label\" font-size=${fs} text-anchor=\"middle\" x=${innerW / 2} y=${innerH + fs * 1.4}>${data.unit}</text>\n </g>\n </svg>\n `;\n }\n\n private _renderLegend(data: DistributionData) {\n const hasLabels = this.values.some((v) => v.label !== \"\");\n if (!hasLabels) return nothing;\n return html`\n <div class=\"legend\">\n ${this.values.map((v, i) => {\n const color = this.markerColors[i % this.markerColors.length];\n const formatted = v.value.toLocaleString(\"en-US\", { maximumFractionDigits: 0 });\n return html`\n <span class=\"legend-item\">\n <span class=\"legend-dot\" style=\"background:${color}\"></span>\n ${v.label}: ${formatted} ${data.unit}\n </span>\n `;\n })}\n </div>\n `;\n }\n\n override render() {\n if (this._loading || this._width === 0) return html`<div class=\"wrap\"><div class=\"skeleton\"></div></div>`;\n if (this._error) return html`<div class=\"wrap\"><div class=\"error\">Could not load distribution</div></div>`;\n if (!this._data) return nothing;\n return html`\n <div class=\"wrap\">\n ${this._renderSvg(this._data)}\n ${this._renderLegend(this._data)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"distribution-chart\": DistributionChart;\n }\n}\n"]}
@@ -141,7 +141,7 @@ let DropdownButton = class DropdownButton extends LitElement {
141
141
  an avatar) — overrides the default rounded-square footprint so the
142
142
  hover/focus highlight matches the wrapped element's own shape. */
143
143
  :host([variant="icon"][circular]) button.trigger {
144
- border-radius: 50%;
144
+ border-radius: var(--ui-radius-circle, 50%);
145
145
  }
146
146
  :host([size="sm"]) button.trigger {
147
147
  height: 1.5rem;
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-button.js","sourceRoot":"","sources":["../src/dropdown-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,IAAI,aAAa,GAAG,CAAC,CAAC;AAetB;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe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itElement, css, html, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/** A single menu action. */\nexport interface DropdownOption {\n value: string;\n label: string;\n /** Optional leading icon rendered ahead of the label in the menu item. */\n icon?: TemplateResult | null;\n /** Renders the item in the danger color, for a destructive action (e.g. Delete). */\n danger?: boolean;\n}\n\n/** How the trigger presents itself: label only, icon only, or icon + label. */\nexport type DropdownButtonVariant = \"text\" | \"icon\" | \"text-icon\";\n\n/**\n * A button that opens an anchored menu of actions — essentially `form-select`\n * minus \"current value\" semantics: a menu, not a select. Use for a set of\n * mutually exclusive next-step actions (e.g. a failed task's Retry / Close /\n * Backlog, or a table row's overflow actions).\n *\n * Three trigger presentations share one base: `text` (the default — a\n * primary-filled button with a label and a rotating chevron), `text-icon`\n * (the same, with `icon` ahead of the label), and `icon` (a borderless,\n * square, low-emphasis icon target in the style of `icon-button` — the\n * classic \"three-dot\"/overflow menu, where `label` becomes the accessible\n * name rather than visible text). Set `size=\"sm\"` for a compact trigger one\n * step below the default, matching `ui-button`'s `sm` size. Set `circular`\n * on the `icon` variant when the trigger wraps an inherently circular\n * element (e.g. an avatar) so the hover/focus highlight matches its shape\n * instead of the default rounded-square icon-button footprint.\n *\n * @element dropdown-button\n * @fires select - Fired with `{ value: string }` when a menu item is picked.\n */\n@customElement(\"dropdown-button\")\nexport class DropdownButton extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n position: relative;\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 /* Shared trigger base — layout, type, shape, and interaction states every\n variant has in common. Variant blocks below only add fill/padding. */\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\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 font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n border: 1px solid transparent;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n /* text + text-icon: the primary-filled trigger. Written as :not([variant=\"icon\"])\n rather than two positive selectors so the default presentation is correct\n even before the reflected attribute lands. */\n :host(:not([variant=\"icon\"])) button.trigger {\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n padding: 0.5rem 1rem;\n }\n :host(:not([variant=\"icon\"])) button.trigger:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n :host(:not([variant=\"icon\"])) button.trigger:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n :host(:not([variant=\"icon\"])) button.trigger: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 /* icon: borderless low-emphasis square target, matching icon-button. */\n :host([variant=\"icon\"]) button.trigger {\n width: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: none;\n }\n :host([variant=\"icon\"]) button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n /* circular: for an icon-variant trigger wrapping a round element (e.g.\n an avatar) — overrides the default rounded-square footprint so the\n hover/focus highlight matches the wrapped element's own shape. */\n :host([variant=\"icon\"][circular]) button.trigger {\n border-radius: 50%;\n }\n :host([size=\"sm\"]) button.trigger {\n height: 1.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n :host(:not([variant=\"icon\"])[size=\"sm\"]) button.trigger {\n padding: 0.25rem 0.5rem;\n }\n :host([variant=\"icon\"][size=\"sm\"]) button.trigger {\n width: 1.5rem;\n }\n .icon {\n display: flex;\n line-height: 0;\n }\n .chevron {\n display: flex;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n right: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n background: var(--ui-surface, #ffffff);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n color: var(--ui-text, #0f172a);\n }\n li .icon {\n color: var(--ui-text-muted, #64748b);\n }\n li.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n li.danger {\n color: var(--ui-danger, #dc2626);\n }\n li.active,\n li:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li.danger.active,\n li.danger:hover {\n color: var(--ui-danger-hover, #b91c1c);\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover,\n li.danger.active,\n li.danger:hover {\n color: HighlightText;\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The trigger button's label. In the `icon` variant it is the accessible name instead of visible text. */\n @property() label = \"\";\n /** The menu's actions. */\n @property({ attribute: false }) options: DropdownOption[] = [];\n /** Disables the trigger, preventing the menu from opening. */\n @property({ type: Boolean }) disabled = false;\n /** Trigger presentation: label only, icon only, or icon + label. */\n @property({ reflect: true }) variant: DropdownButtonVariant = \"text\";\n /** Icon template rendered by the `icon` and `text-icon` variants. */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n /** Size — `sm` reduces the trigger's height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n /** `icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar). */\n @property({ type: Boolean, reflect: true }) circular = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n readonly #menuId = `dropdown-button-menu-${++instanceCount}`;\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n this._open = false;\n this._activeIndex = -1;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"disabled\") && this.disabled) {\n this._open = false;\n this._activeIndex = -1;\n }\n if (!changed.has(\"_open\")) return;\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this._open = false;\n };\n\n #toggle(): void {\n if (this.disabled) return;\n this._open = !this._open;\n if (this._open) this._activeIndex = 0;\n }\n\n #select(option: DropdownOption): void {\n if (this.disabled) return;\n this._open = false;\n this.dispatchEvent(new CustomEvent(\"select\", { detail: { value: option.value } }));\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#toggle();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#confirmActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this._open = false;\n }\n }\n\n #moveActive(delta: number): void {\n if (this.options.length === 0) return;\n const n = this.options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #confirmActive(): void {\n const option = this.options[this._activeIndex];\n if (option) this.#select(option);\n }\n\n private renderMenu() {\n if (!this._open) return nothing;\n return html`\n <ul id=${this.#menuId} class=\"options\" role=\"menu\" aria-label=${this.label}>\n ${this.options.map(\n (o, i) => html`\n <li\n id=${`${this.#menuId}-item-${i}`}\n role=\"menuitem\"\n class=${[i === this._activeIndex ? \"active\" : \"\", o.danger ? \"danger\" : \"\"]\n .filter(Boolean)\n .join(\" \")}\n @mousedown=${(e: MouseEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n this.#select(o);\n }}\n >\n ${o.icon ? html`<span class=\"icon\" aria-hidden=\"true\">${o.icon}</span>` : nothing}\n ${o.label}\n </li>\n `,\n )}\n </ul>\n `;\n }\n\n override render() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#menuId}-item-${this._activeIndex}`\n : nothing;\n const iconOnly = this.variant === \"icon\";\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n aria-haspopup=\"menu\"\n aria-expanded=${this._open}\n aria-controls=${this.#menuId}\n aria-activedescendant=${activeDescendant}\n aria-label=${iconOnly && this.label ? this.label : nothing}\n title=${iconOnly && this.label ? this.label : nothing}\n ?disabled=${this.disabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n ${this.variant !== \"text\" && this.icon\n ? html`<span class=\"icon\" aria-hidden=\"true\">${this.icon}</span>`\n : nothing}\n ${iconOnly ? nothing : html`<span>${this.label}</span>`}\n ${iconOnly\n ? nothing\n : html`<span class=\"chevron\" aria-hidden=\"true\">${iconChevronRight(14)}</span>`}\n </button>\n ${this.renderMenu()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dropdown-button\": DropdownButton;\n }\n}\n"]}
1
+ {"version":3,"file":"dropdown-button.js","sourceRoot":"","sources":["../src/dropdown-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,IAAI,aAAa,GAAG,CAAC,CAAC;AAetB;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAoLL,2GAA2G;QAC/F,UAAK,GAAG,EAAE,CAAC;QACvB,0BAA0B;QACM,YAAO,GAAqB,EAAE,CAAC;QAC/D,8DAA8D;QACjC,aAAQ,GAAG,KAAK,CAAC;QAC9C,oEAAoE;QACvC,YAAO,GAA0B,MAAM,CAAC;QACrE,qEAAqE;QACrC,SAAI,GAA0B,IAAI,CAAC;QACnE,6FAA6F;QAChE,SAAI,GAAgB,IAAI,CAAC;QACtD,0JAA0J;QAC9G,aAAQ,GAAG,KAAK,CAAC;QAE5C,UAAK,GAAG,KAAK,CAAC;QACd,iBAAY,GAAG,CAAC,CAAC,CAAC;QAC1B,YAAO,GAAG,wBAAwB,EAAE,aAAa,EAAE,CAAC;QAuB7D,uBAAkB,GAAG,CAAC,CAA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gBAAgB,CAAC,EAAE,CAAC,SAAS;;QAEjF,IAAI,CAAC,UAAU,EAAE;KACpB,CAAC;IACJ,CAAC;CACF,CAAA;AA5Ia;IAAX,QAAQ,EAAE;6CAAY;AAES;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAAgC;AAElC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAyC;AAErC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAoC;AAEtC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAA0B;AAEV;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAkB;AAE5C;IAAhB,KAAK,EAAE;6CAAuB;AACd;IAAhB,KAAK,EAAE;oDAA2B;AApMxB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAiU1B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/** A single menu action. */\nexport interface DropdownOption {\n value: string;\n label: string;\n /** Optional leading icon rendered ahead of the label in the menu item. */\n icon?: TemplateResult | null;\n /** Renders the item in the danger color, for a destructive action (e.g. Delete). */\n danger?: boolean;\n}\n\n/** How the trigger presents itself: label only, icon only, or icon + label. */\nexport type DropdownButtonVariant = \"text\" | \"icon\" | \"text-icon\";\n\n/**\n * A button that opens an anchored menu of actions — essentially `form-select`\n * minus \"current value\" semantics: a menu, not a select. Use for a set of\n * mutually exclusive next-step actions (e.g. a failed task's Retry / Close /\n * Backlog, or a table row's overflow actions).\n *\n * Three trigger presentations share one base: `text` (the default — a\n * primary-filled button with a label and a rotating chevron), `text-icon`\n * (the same, with `icon` ahead of the label), and `icon` (a borderless,\n * square, low-emphasis icon target in the style of `icon-button` — the\n * classic \"three-dot\"/overflow menu, where `label` becomes the accessible\n * name rather than visible text). Set `size=\"sm\"` for a compact trigger one\n * step below the default, matching `ui-button`'s `sm` size. Set `circular`\n * on the `icon` variant when the trigger wraps an inherently circular\n * element (e.g. an avatar) so the hover/focus highlight matches its shape\n * instead of the default rounded-square icon-button footprint.\n *\n * @element dropdown-button\n * @fires select - Fired with `{ value: string }` when a menu item is picked.\n */\n@customElement(\"dropdown-button\")\nexport class DropdownButton extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n position: relative;\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 /* Shared trigger base — layout, type, shape, and interaction states every\n variant has in common. Variant blocks below only add fill/padding. */\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\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 font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n border: 1px solid transparent;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n /* text + text-icon: the primary-filled trigger. Written as :not([variant=\"icon\"])\n rather than two positive selectors so the default presentation is correct\n even before the reflected attribute lands. */\n :host(:not([variant=\"icon\"])) button.trigger {\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n padding: 0.5rem 1rem;\n }\n :host(:not([variant=\"icon\"])) button.trigger:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n :host(:not([variant=\"icon\"])) button.trigger:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n :host(:not([variant=\"icon\"])) button.trigger: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 /* icon: borderless low-emphasis square target, matching icon-button. */\n :host([variant=\"icon\"]) button.trigger {\n width: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: none;\n }\n :host([variant=\"icon\"]) button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n /* circular: for an icon-variant trigger wrapping a round element (e.g.\n an avatar) — overrides the default rounded-square footprint so the\n hover/focus highlight matches the wrapped element's own shape. */\n :host([variant=\"icon\"][circular]) button.trigger {\n border-radius: var(--ui-radius-circle, 50%);\n }\n :host([size=\"sm\"]) button.trigger {\n height: 1.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n :host(:not([variant=\"icon\"])[size=\"sm\"]) button.trigger {\n padding: 0.25rem 0.5rem;\n }\n :host([variant=\"icon\"][size=\"sm\"]) button.trigger {\n width: 1.5rem;\n }\n .icon {\n display: flex;\n line-height: 0;\n }\n .chevron {\n display: flex;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n right: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n background: var(--ui-surface, #ffffff);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n color: var(--ui-text, #0f172a);\n }\n li .icon {\n color: var(--ui-text-muted, #64748b);\n }\n li.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n li.danger {\n color: var(--ui-danger, #dc2626);\n }\n li.active,\n li:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li.danger.active,\n li.danger:hover {\n color: var(--ui-danger-hover, #b91c1c);\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover,\n li.danger.active,\n li.danger:hover {\n color: HighlightText;\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The trigger button's label. In the `icon` variant it is the accessible name instead of visible text. */\n @property() label = \"\";\n /** The menu's actions. */\n @property({ attribute: false }) options: DropdownOption[] = [];\n /** Disables the trigger, preventing the menu from opening. */\n @property({ type: Boolean }) disabled = false;\n /** Trigger presentation: label only, icon only, or icon + label. */\n @property({ reflect: true }) variant: DropdownButtonVariant = \"text\";\n /** Icon template rendered by the `icon` and `text-icon` variants. */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n /** Size — `sm` reduces the trigger's height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n /** `icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar). */\n @property({ type: Boolean, reflect: true }) circular = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n readonly #menuId = `dropdown-button-menu-${++instanceCount}`;\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n this._open = false;\n this._activeIndex = -1;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"disabled\") && this.disabled) {\n this._open = false;\n this._activeIndex = -1;\n }\n if (!changed.has(\"_open\")) return;\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this._open = false;\n };\n\n #toggle(): void {\n if (this.disabled) return;\n this._open = !this._open;\n if (this._open) this._activeIndex = 0;\n }\n\n #select(option: DropdownOption): void {\n if (this.disabled) return;\n this._open = false;\n this.dispatchEvent(new CustomEvent(\"select\", { detail: { value: option.value } }));\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#toggle();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#confirmActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this._open = false;\n }\n }\n\n #moveActive(delta: number): void {\n if (this.options.length === 0) return;\n const n = this.options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #confirmActive(): void {\n const option = this.options[this._activeIndex];\n if (option) this.#select(option);\n }\n\n private renderMenu() {\n if (!this._open) return nothing;\n return html`\n <ul id=${this.#menuId} class=\"options\" role=\"menu\" aria-label=${this.label}>\n ${this.options.map(\n (o, i) => html`\n <li\n id=${`${this.#menuId}-item-${i}`}\n role=\"menuitem\"\n class=${[i === this._activeIndex ? \"active\" : \"\", o.danger ? \"danger\" : \"\"]\n .filter(Boolean)\n .join(\" \")}\n @mousedown=${(e: MouseEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n this.#select(o);\n }}\n >\n ${o.icon ? html`<span class=\"icon\" aria-hidden=\"true\">${o.icon}</span>` : nothing}\n ${o.label}\n </li>\n `,\n )}\n </ul>\n `;\n }\n\n override render() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#menuId}-item-${this._activeIndex}`\n : nothing;\n const iconOnly = this.variant === \"icon\";\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n aria-haspopup=\"menu\"\n aria-expanded=${this._open}\n aria-controls=${this.#menuId}\n aria-activedescendant=${activeDescendant}\n aria-label=${iconOnly && this.label ? this.label : nothing}\n title=${iconOnly && this.label ? this.label : nothing}\n ?disabled=${this.disabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n ${this.variant !== \"text\" && this.icon\n ? html`<span class=\"icon\" aria-hidden=\"true\">${this.icon}</span>`\n : nothing}\n ${iconOnly ? nothing : html`<span>${this.label}</span>`}\n ${iconOnly\n ? nothing\n : html`<span class=\"chevron\" aria-hidden=\"true\">${iconChevronRight(14)}</span>`}\n </button>\n ${this.renderMenu()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dropdown-button\": DropdownButton;\n }\n}\n"]}