@f-ewald/components 1.27.3 → 1.29.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 (64) hide show
  1. package/README.md +2 -0
  2. package/custom-elements.json +460 -9
  3. package/dist/fullscreen-button.d.ts +43 -0
  4. package/dist/fullscreen-button.d.ts.map +1 -0
  5. package/dist/fullscreen-button.js +172 -0
  6. package/dist/fullscreen-button.js.map +1 -0
  7. package/dist/icons.d.ts +1 -1
  8. package/dist/icons.d.ts.map +1 -1
  9. package/dist/icons.js +1 -1
  10. package/dist/icons.js.map +1 -1
  11. package/dist/index.d.ts +3 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/percent-bar-chart.d.ts.map +1 -1
  16. package/dist/percent-bar-chart.js +9 -2
  17. package/dist/percent-bar-chart.js.map +1 -1
  18. package/dist/radio-cards.d.ts +5 -1
  19. package/dist/radio-cards.d.ts.map +1 -1
  20. package/dist/radio-cards.js +19 -2
  21. package/dist/radio-cards.js.map +1 -1
  22. package/dist/scroll-dots.d.ts +54 -0
  23. package/dist/scroll-dots.d.ts.map +1 -0
  24. package/dist/scroll-dots.js +178 -0
  25. package/dist/scroll-dots.js.map +1 -0
  26. package/dist/scroll-to-bottom.d.ts +6 -0
  27. package/dist/scroll-to-bottom.d.ts.map +1 -1
  28. package/dist/scroll-to-bottom.js +31 -7
  29. package/dist/scroll-to-bottom.js.map +1 -1
  30. package/dist/scroll-to-top.d.ts +6 -0
  31. package/dist/scroll-to-top.d.ts.map +1 -1
  32. package/dist/scroll-to-top.js +31 -7
  33. package/dist/scroll-to-top.js.map +1 -1
  34. package/dist/timeline-container.d.ts +21 -5
  35. package/dist/timeline-container.d.ts.map +1 -1
  36. package/dist/timeline-container.js +35 -7
  37. package/dist/timeline-container.js.map +1 -1
  38. package/dist/timeline-entry.d.ts +32 -0
  39. package/dist/timeline-entry.d.ts.map +1 -1
  40. package/dist/timeline-entry.js +130 -3
  41. package/dist/timeline-entry.js.map +1 -1
  42. package/dist/tokens.css +4 -0
  43. package/dist/tokens.d.ts.map +1 -1
  44. package/dist/tokens.js +11 -0
  45. package/dist/tokens.js.map +1 -1
  46. package/dist/ui-button.d.ts +24 -0
  47. package/dist/ui-button.d.ts.map +1 -1
  48. package/dist/ui-button.js +122 -1
  49. package/dist/ui-button.js.map +1 -1
  50. package/dist/weight-bar-chart.js +2 -2
  51. package/dist/weight-bar-chart.js.map +1 -1
  52. package/docs/design-language.md +19 -0
  53. package/docs/fullscreen-button.md +70 -0
  54. package/docs/icons.md +1 -1
  55. package/docs/radio-cards.md +6 -1
  56. package/docs/scroll-dots.md +65 -0
  57. package/docs/scroll-to-bottom.md +15 -0
  58. package/docs/scroll-to-top.md +15 -0
  59. package/docs/timeline-container.md +30 -6
  60. package/docs/timeline-entry.md +18 -0
  61. package/docs/ui-button.md +28 -0
  62. package/docs/weight-bar-chart.md +1 -0
  63. package/llms.txt +159 -16
  64. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,YAAY,GAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB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AAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,cAAc,YAAY,CAAC","sourcesContent":["export { AnimateConfetti } from \"./animate-confetti.js\";\nexport { GalleryItem } from \"./gallery-item.js\";\nexport { GalleryItemVariant } from \"./gallery-item-variant.js\";\nexport {\n PhotoGallery,\n type PhotoGalleryChangeReason,\n type PhotoGalleryObjectFit,\n type PhotoGallerySlideChangeDetail,\n} from \"./photo-gallery.js\";\nexport { RevealButton } from \"./reveal-button.js\";\nexport { RomanNumeral } from \"./roman-numeral.js\";\nexport { ConfirmDialog } from \"./confirm-dialog.js\";\nexport { ModalDialog, type ModalDialogSize } from \"./modal-dialog.js\";\nexport { ContentDivider } from \"./content-divider.js\";\nexport {\n ToastNotification,\n notifySuccess,\n notifyError,\n notifyInfo,\n notifyWarning,\n type ToastVariant,\n} from \"./toast-notification.js\";\nexport { ScrollToBottom } from \"./scroll-to-bottom.js\";\nexport { ScrollToTop } from \"./scroll-to-top.js\";\nexport { SlidePanel } from \"./slide-panel.js\";\nexport { CopyLinkButton } from \"./copy-link-button.js\";\nexport { RelativeTime } from \"./relative-time.js\";\nexport { DistanceValue } from \"./distance-value.js\";\nexport { PriceHistoryChart, type PricePoint } from \"./price-history-chart.js\";\nexport { DistributionChart, type DistributionValue } from \"./distribution-chart.js\";\nexport { PercentBarChart, type PercentBarGroup } from \"./percent-bar-chart.js\";\nexport { WeightBarChart, type WeightBarItem } from \"./weight-bar-chart.js\";\nexport {\n AddressAutocomplete,\n type AddressSuggestion,\n} from \"./address-autocomplete.js\";\nexport {\n AutocompleteInput,\n type AutocompleteOption,\n} from \"./autocomplete-input.js\";\nexport { UserAvatar } from \"./user-avatar.js\";\nexport { MapPin } from \"./map-pin.js\";\nexport { MapCircle } from \"./map-circle.js\";\nexport { MapboxMap } from \"./mapbox-map.js\";\nexport { RadioCards, type RadioCardOption } from \"./radio-cards.js\";\nexport { RadioPills, type RadioPillOption } from \"./radio-pills.js\";\nexport { RangeSlider } from \"./range-slider.js\";\nexport { ButtonGroup, type ButtonGroupOption } from \"./button-group.js\";\nexport { UiButton, type ButtonVariant } from \"./ui-button.js\";\nexport { StatMeter } from \"./stat-meter.js\";\nexport { StatusBanner, type StatusBannerVariant } from \"./status-banner.js\";\nexport { StatusPill, type StatusPillColor } from \"./status-pill.js\";\nexport { EditableText } from \"./editable-text.js\";\nexport { LiveTimer } from \"./live-timer.js\";\nexport { LoadMore } from \"./load-more.js\";\nexport { LoadingSpinner } from \"./loading-spinner.js\";\nexport { LoadingDots } from \"./loading-dots.js\";\nexport {\n ChatMessage,\n type ChatMessageRole,\n type ChatMessageVariant,\n} from \"./chat-message.js\";\nexport { UiCheckbox } from \"./ui-checkbox.js\";\nexport { FormField } from \"./form-field.js\";\nexport { FormSelect, type SelectOption } from \"./form-select.js\";\nexport {\n MultiSelect,\n type MultiSelectOption,\n type MultiSelectVariant,\n} from \"./multi-select.js\";\nexport { DataTable, type DataTableColumn } from \"./data-table.js\";\nexport { TileGrid } from \"./tile-grid.js\";\nexport { TreeView, type TreeNode } from \"./tree-view.js\";\nexport { PopoverPanel } from \"./popover-panel.js\";\nexport {\n DropdownButton,\n type DropdownButtonVariant,\n type DropdownOption,\n} from \"./dropdown-button.js\";\nexport { IconButton } from \"./icon-button.js\";\nexport { KbdHint, type KbdPlatform } from \"./kbd-hint.js\";\nexport { FrameBox } from \"./frame-box.js\";\nexport { AppShell, type SidebarToggleDetail } from \"./app-shell.js\";\nexport { AppSidebar } from \"./app-sidebar.js\";\nexport { ActionBar } from \"./action-bar.js\";\nexport { PageHeader } from \"./page-header.js\";\nexport { PaginationNav, type PageChangeDetail } from \"./pagination-nav.js\";\nexport { FormActions } from \"./form-actions.js\";\nexport { TimelineContainer } from \"./timeline-container.js\";\nexport { TimelineEntry } from \"./timeline-entry.js\";\nexport { CalendarDay } from \"./calendar-day.js\";\nexport { CalendarEntry } from \"./calendar-entry.js\";\nexport { CalendarMonth } from \"./calendar-month.js\";\nexport { CalendarWeek } from \"./calendar-week.js\";\nexport { CalendarYear } from \"./calendar-year.js\";\nexport {\n KanbanBoard,\n type KanbanCardData,\n type KanbanColumnData,\n type KanbanCardMoveDetail,\n type KanbanCardOpenDetail,\n} from \"./kanban-board.js\";\nexport { KanbanColumn } from \"./kanban-column.js\";\nexport { KanbanCard } from \"./kanban-card.js\";\nexport { TextArea } from \"./text-area.js\";\nexport { LinkCard, type LinkCardStatus } from \"./link-card.js\";\nexport { CardGrid } from \"./card-grid.js\";\nexport { MarkdownView } from \"./markdown-view.js\";\nexport { AutoScroll } from \"./auto-scroll.js\";\nexport { SplitHero } from \"./split-hero.js\";\nexport { TabBar, type TabChangeDetail } from \"./tab-bar.js\";\nexport { TabItem } from \"./tab-item.js\";\nexport { MarkdownEditor } from \"./markdown-editor.js\";\nexport {\n parseFrontMatter,\n formatFrontMatterValue,\n type FrontMatterResult,\n} from \"./utils/front-matter.js\";\nexport {\n formatDuration,\n formatClockDuration,\n type DurationFormat,\n} from \"./utils/duration.js\";\nexport { AudioPlayer } from \"./audio-player.js\";\nexport { VideoPlayer } from \"./video-player.js\";\nexport { CommentComposer } from \"./comment-composer.js\";\nexport { tokens, tokenValues, darkTokenValues } from \"./tokens.js\";\nexport * from \"./icons.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,YAAY,GAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;A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,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAwB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,cAAc,YAAY,CAAC","sourcesContent":["export { AnimateConfetti } from \"./animate-confetti.js\";\nexport { GalleryItem } from \"./gallery-item.js\";\nexport { GalleryItemVariant } from \"./gallery-item-variant.js\";\nexport {\n PhotoGallery,\n type PhotoGalleryChangeReason,\n type PhotoGalleryObjectFit,\n type PhotoGallerySlideChangeDetail,\n} from \"./photo-gallery.js\";\nexport { RevealButton } from \"./reveal-button.js\";\nexport { RomanNumeral } from \"./roman-numeral.js\";\nexport { ConfirmDialog } from \"./confirm-dialog.js\";\nexport { ModalDialog, type ModalDialogSize } from \"./modal-dialog.js\";\nexport { ContentDivider } from \"./content-divider.js\";\nexport {\n ToastNotification,\n notifySuccess,\n notifyError,\n notifyInfo,\n notifyWarning,\n type ToastVariant,\n} from \"./toast-notification.js\";\nexport { ScrollToBottom } from \"./scroll-to-bottom.js\";\nexport {\n ScrollDots,\n type DotSelectDetail,\n type ScrollDotItem,\n type ScrollDotsItem,\n} from \"./scroll-dots.js\";\nexport { ScrollToTop } from \"./scroll-to-top.js\";\nexport { FullscreenButton, type FullscreenChangeDetail } from \"./fullscreen-button.js\";\nexport { SlidePanel } from \"./slide-panel.js\";\nexport { CopyLinkButton } from \"./copy-link-button.js\";\nexport { RelativeTime } from \"./relative-time.js\";\nexport { DistanceValue } from \"./distance-value.js\";\nexport { PriceHistoryChart, type PricePoint } from \"./price-history-chart.js\";\nexport { DistributionChart, type DistributionValue } from \"./distribution-chart.js\";\nexport { PercentBarChart, type PercentBarGroup } from \"./percent-bar-chart.js\";\nexport { WeightBarChart, type WeightBarItem } from \"./weight-bar-chart.js\";\nexport {\n AddressAutocomplete,\n type AddressSuggestion,\n} from \"./address-autocomplete.js\";\nexport {\n AutocompleteInput,\n type AutocompleteOption,\n} from \"./autocomplete-input.js\";\nexport { UserAvatar } from \"./user-avatar.js\";\nexport { MapPin } from \"./map-pin.js\";\nexport { MapCircle } from \"./map-circle.js\";\nexport { MapboxMap } from \"./mapbox-map.js\";\nexport { RadioCards, type RadioCardOption } from \"./radio-cards.js\";\nexport { RadioPills, type RadioPillOption } from \"./radio-pills.js\";\nexport { RangeSlider } from \"./range-slider.js\";\nexport { ButtonGroup, type ButtonGroupOption } from \"./button-group.js\";\nexport { UiButton, type ButtonVariant } from \"./ui-button.js\";\nexport { StatMeter } from \"./stat-meter.js\";\nexport { StatusBanner, type StatusBannerVariant } from \"./status-banner.js\";\nexport { StatusPill, type StatusPillColor } from \"./status-pill.js\";\nexport { EditableText } from \"./editable-text.js\";\nexport { LiveTimer } from \"./live-timer.js\";\nexport { LoadMore } from \"./load-more.js\";\nexport { LoadingSpinner } from \"./loading-spinner.js\";\nexport { LoadingDots } from \"./loading-dots.js\";\nexport {\n ChatMessage,\n type ChatMessageRole,\n type ChatMessageVariant,\n} from \"./chat-message.js\";\nexport { UiCheckbox } from \"./ui-checkbox.js\";\nexport { FormField } from \"./form-field.js\";\nexport { FormSelect, type SelectOption } from \"./form-select.js\";\nexport {\n MultiSelect,\n type MultiSelectOption,\n type MultiSelectVariant,\n} from \"./multi-select.js\";\nexport { DataTable, type DataTableColumn } from \"./data-table.js\";\nexport { TileGrid } from \"./tile-grid.js\";\nexport { TreeView, type TreeNode } from \"./tree-view.js\";\nexport { PopoverPanel } from \"./popover-panel.js\";\nexport {\n DropdownButton,\n type DropdownButtonVariant,\n type DropdownOption,\n} from \"./dropdown-button.js\";\nexport { IconButton } from \"./icon-button.js\";\nexport { KbdHint, type KbdPlatform } from \"./kbd-hint.js\";\nexport { FrameBox } from \"./frame-box.js\";\nexport { AppShell, type SidebarToggleDetail } from \"./app-shell.js\";\nexport { AppSidebar } from \"./app-sidebar.js\";\nexport { ActionBar } from \"./action-bar.js\";\nexport { PageHeader } from \"./page-header.js\";\nexport { PaginationNav, type PageChangeDetail } from \"./pagination-nav.js\";\nexport { FormActions } from \"./form-actions.js\";\nexport { TimelineContainer, type TimelineLayout } from \"./timeline-container.js\";\nexport { TimelineEntry } from \"./timeline-entry.js\";\nexport { CalendarDay } from \"./calendar-day.js\";\nexport { CalendarEntry } from \"./calendar-entry.js\";\nexport { CalendarMonth } from \"./calendar-month.js\";\nexport { CalendarWeek } from \"./calendar-week.js\";\nexport { CalendarYear } from \"./calendar-year.js\";\nexport {\n KanbanBoard,\n type KanbanCardData,\n type KanbanColumnData,\n type KanbanCardMoveDetail,\n type KanbanCardOpenDetail,\n} from \"./kanban-board.js\";\nexport { KanbanColumn } from \"./kanban-column.js\";\nexport { KanbanCard } from \"./kanban-card.js\";\nexport { TextArea } from \"./text-area.js\";\nexport { LinkCard, type LinkCardStatus } from \"./link-card.js\";\nexport { CardGrid } from \"./card-grid.js\";\nexport { MarkdownView } from \"./markdown-view.js\";\nexport { AutoScroll } from \"./auto-scroll.js\";\nexport { SplitHero } from \"./split-hero.js\";\nexport { TabBar, type TabChangeDetail } from \"./tab-bar.js\";\nexport { TabItem } from \"./tab-item.js\";\nexport { MarkdownEditor } from \"./markdown-editor.js\";\nexport {\n parseFrontMatter,\n formatFrontMatterValue,\n type FrontMatterResult,\n} from \"./utils/front-matter.js\";\nexport {\n formatDuration,\n formatClockDuration,\n type DurationFormat,\n} from \"./utils/duration.js\";\nexport { AudioPlayer } from \"./audio-player.js\";\nexport { VideoPlayer } from \"./video-player.js\";\nexport { CommentComposer } from \"./comment-composer.js\";\nexport { tokens, tokenValues, darkTokenValues } from \"./tokens.js\";\nexport * from \"./icons.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"percent-bar-chart.d.ts","sourceRoot":"","sources":["../src/percent-bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMjD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC;AACjD,8EAA8E;AAC9E,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,UAAU,CAAC;AAkB9D;;;;;;;;;GASG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,MAAM,4BA+BpB;IAEF,qCAAqC;IACL,MAAM,EAAE,eAAe,EAAE,CAAM;IAC/D,4GAA4G;IAChG,IAAI,EAAE,cAAc,CAAa;IAC7C,gFAAgF;IACpE,WAAW,EAAE,qBAAqB,CAAgB;IAC9D,mHAAmH;IACvF,GAAG,CAAC,EAAE,MAAM,CAAC;IACzC,kGAAkG;IAClE,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAC7C;IAEhB,OAAO,CAAC,MAAM,CAAK;IAE5B,OAAO,CAAC,GAAG,CAA+B;IAC1C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6C;IAEzE,6DAA6D;IAC7D,OAAO,CAAC,OAAO;IAIf,qEAAqE;IACrE,OAAO,CAAC,SAAS;IAIjB,6DAA6D;IAC7D,OAAO,CAAC,UAAU;IAMT,YAAY,SAMpB;IAEQ,oBAAoB,SA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MT,YAAY,SAMpB;IAEQ,oBAAoB,SAI5B;IAED,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,iBAAiB;IAuBzB,OAAO,CAAC,eAAe;IA0Bd,MAAM,yCAmBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
@@ -20,6 +20,13 @@ const VALUE_LABEL_H = 14;
20
20
  const MAX_BAR_W = 28;
21
21
  const COL_GAP = 8;
22
22
  const PAD = { top: 4, right: 4, bottom: 4, left: 4 };
23
+ /**
24
+ * Bar corner radius, in SVG user units. Presentation attributes can't take
25
+ * `var()`, so the shared 4px control radius (0.25rem) is inlined as a
26
+ * literal here, the same way `price-history-chart`'s bars do it. Overriding
27
+ * the radius token does not reach these bars.
28
+ */
29
+ const BAR_RADIUS = 4;
23
30
  let gradientIdCounter = 0;
24
31
  /**
25
32
  * Bar chart for labeled rows, using D3's linear scale. Horizontal (default)
@@ -138,7 +145,7 @@ let PercentBarChart = class PercentBarChart extends LitElement {
138
145
  <text class="chart-label" x=${PAD.left} y=${cy} font-size="10"
139
146
  text-anchor="start" dominant-baseline="middle">${g.label}</text>
140
147
  <rect x=${PAD.left + LABEL_W} y=${cy - 5}
141
- width=${bw} height="10" rx="5"
148
+ width=${bw} height="10" rx=${BAR_RADIUS}
142
149
  fill="url(#${this._gradId(i)})" />
143
150
  <text class="chart-label" x=${PAD.left + LABEL_W + barMaxW + 4} y=${cy} font-size="10"
144
151
  text-anchor="start" dominant-baseline="middle">${this._labelFor(g.value)}</text>
@@ -159,7 +166,7 @@ let PercentBarChart = class PercentBarChart extends LitElement {
159
166
  const barTop = PAD.top + VALUE_LABEL_H + (COL_TRACK_H - barH);
160
167
  const catLabelY = PAD.top + VALUE_LABEL_H + COL_TRACK_H + CAT_LABEL_H - 4;
161
168
  return svg `
162
- <rect x=${cx - barW / 2} y=${barTop} width=${barW} height=${barH} rx=${barW / 2}
169
+ <rect x=${cx - barW / 2} y=${barTop} width=${barW} height=${barH} rx=${BAR_RADIUS}
163
170
  fill="url(#${this._gradId(i)})" />
164
171
  <text class="chart-label" x=${cx} y=${barTop - 4} font-size="10"
165
172
  text-anchor="middle">${this._labelFor(g.value)}</text>
@@ -1 +1 @@
1
- {"version":3,"file":"percent-bar-chart.js","sourceRoot":"","sources":["../src/percent-bar-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBrC,2BAA2B;AAC3B,MAAM,KAAK,GAAG,EAAE,CAAC;AACjB,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,4BAA4B;AAC5B,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAErD,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B;;;;;;;;;GASG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAkCL,qCAAqC;QACL,WAAM,GAAsB,EAAE,CAAC;QAC/D,4GAA4G;QAChG,SAAI,GAAm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AAC;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAEjE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GACrB,IAAI,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACtF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;QAEtE,OAAO,IAAI,CAAA;;uBAEQ,IAAI,CAAC,MAAM,IAAI,IAAI;gBAC1B,IAAI,CAAC,MAAM;iBACV,IAAI;;qBAEA,GAAG,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;;gBAEnG,IAAI,CAAC,gBAAgB,EAAE;UAC7B,OAAO;;KAEZ,CAAC;IACJ,CAAC;CACF,CAAA;AAxIiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAAgC;AAEnD;IAAX,QAAQ,EAAE;6CAAkC;AAEjC;IAAX,QAAQ,EAAE;oDAAmD;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AAET;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDACN;AAER;IAAhB,KAAK,EAAE;+CAAoB;AA9CjB,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA2K3B","sourcesContent":["import { LitElement, css, html, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { scaleLinear } from \"d3-scale\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface PercentBarGroup {\n key: string;\n label: string;\n /**\n * The row's value. In `mode=\"percent\"` (default) this is a 0-100\n * percentage, scaled against a fixed domain. In `mode=\"value\"` this is an\n * arbitrary raw number, scaled against `max` (or the largest `value`\n * across `groups` when `max` is unset).\n */\n value: number;\n color: string;\n}\n\n/** Whether `PercentBarGroup.value` is a 0-100 percentage or an arbitrary raw number. */\nexport type PercentBarMode = \"percent\" | \"value\";\n/** Bars grow rightward as stacked rows, or upward as side-by-side columns. */\nexport type PercentBarOrientation = \"horizontal\" | \"vertical\";\n\n// Horizontal (row) layout.\nconst ROW_H = 20;\nconst LABEL_W = 56;\nconst VALUE_W = 36;\n\n// Vertical (column) layout.\nconst COL_TRACK_H = 96;\nconst CAT_LABEL_H = 16;\nconst VALUE_LABEL_H = 14;\nconst MAX_BAR_W = 28;\nconst COL_GAP = 8;\n\nconst PAD = { top: 4, right: 4, bottom: 4, left: 4 };\n\nlet gradientIdCounter = 0;\n\n/**\n * Bar chart for labeled rows, using D3's linear scale. Horizontal (default)\n * renders stacked rows with bars growing rightward; `orientation=\"vertical\"`\n * renders side-by-side columns growing upward instead. `mode=\"percent\"`\n * (default) scales `value` against a fixed 0-100 domain and labels it with a\n * `%` suffix; `mode=\"value\"` scales it against `max` (or the largest `value`\n * present) and formats it with `valueFormat`.\n *\n * @element percent-bar-chart\n */\n@customElement(\"percent-bar-chart\")\nexport class PercentBarChart extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\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 .chart-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .gradient-start {\n stop-color: color-mix(in srgb, var(--percent-bar-color) 70%, #ffffff);\n }\n .gradient-end {\n stop-color: color-mix(in srgb, var(--percent-bar-color) 70%, #000000);\n }\n `,\n ];\n\n /** Rows to render, one per group. */\n @property({ attribute: false }) groups: PercentBarGroup[] = [];\n /** Whether `value` is a 0-100 percentage (fixed domain) or an arbitrary number (domain from data/`max`). */\n @property() mode: PercentBarMode = \"percent\";\n /** Bar direction: stacked rows growing rightward, or columns growing upward. */\n @property() orientation: PercentBarOrientation = \"horizontal\";\n /** Explicit domain max for `mode=\"value\"`; auto-computed from `groups` when unset. Ignored in `mode=\"percent\"`. */\n @property({ type: Number }) max?: number;\n /** Formats a row's value for its label in `mode=\"value\"`. Defaults to locale-formatted number. */\n @property({ attribute: false }) valueFormat: (value: number) => string = (value) =>\n value.toLocaleString();\n\n @state() private _width = 0;\n\n private _ro: ResizeObserver | null = null;\n private readonly _gradIdBase = `percent-bar-grad-${gradientIdCounter++}`;\n\n /** Per-row gradient id, unique across instances and rows. */\n private _gradId(index: number): string {\n return `${this._gradIdBase}-${index}`;\n }\n\n /** The row's value formatted for display, per the current `mode`. */\n private _labelFor(value: number): string {\n return this.mode === \"percent\" ? `${value.toFixed(1)}%` : this.valueFormat(value);\n }\n\n /** The scale domain's upper bound for the current `mode`. */\n private _domainMax(): number {\n if (this.mode === \"percent\") return 100;\n if (this.max !== undefined) return this.max;\n return Math.max(0.000001, ...this.groups.map((g) => g.value));\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 private _renderGradients() {\n return this.groups.map((g, i) => {\n const color = g.color.trim();\n const gradId = this._gradId(i);\n return svg`\n <linearGradient\n id=${gradId}\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n style=${styleMap({ \"--percent-bar-color\": color })}\n >\n <stop class=\"gradient-start\" offset=\"0%\" />\n <stop class=\"gradient-end\" offset=\"100%\" />\n </linearGradient>\n `;\n });\n }\n\n private _renderHorizontal() {\n const innerW = this._width - PAD.left - PAD.right;\n const barMaxW = innerW - LABEL_W - VALUE_W;\n const svgH = PAD.top + this.groups.length * ROW_H + PAD.bottom;\n const xScale = scaleLinear().domain([0, this._domainMax()]).range([0, barMaxW]);\n\n const rows = this.groups.map((g, i) => {\n const cy = PAD.top + i * ROW_H + ROW_H / 2;\n const bw = Math.max(0, xScale(g.value));\n return svg`\n <text class=\"chart-label\" x=${PAD.left} y=${cy} font-size=\"10\"\n text-anchor=\"start\" dominant-baseline=\"middle\">${g.label}</text>\n <rect x=${PAD.left + LABEL_W} y=${cy - 5}\n width=${bw} height=\"10\" rx=\"5\"\n fill=\"url(#${this._gradId(i)})\" />\n <text class=\"chart-label\" x=${PAD.left + LABEL_W + barMaxW + 4} y=${cy} font-size=\"10\"\n text-anchor=\"start\" dominant-baseline=\"middle\">${this._labelFor(g.value)}</text>\n `;\n });\n\n return { svgH, content: rows };\n }\n\n private _renderVertical() {\n const innerW = this._width - PAD.left - PAD.right;\n const n = this.groups.length;\n const colSlotW = n > 0 ? innerW / n : 0;\n const barW = Math.max(4, Math.min(MAX_BAR_W, colSlotW - COL_GAP));\n const svgH = PAD.top + VALUE_LABEL_H + COL_TRACK_H + CAT_LABEL_H + PAD.bottom;\n const yScale = scaleLinear().domain([0, this._domainMax()]).range([0, COL_TRACK_H]);\n\n const cols = this.groups.map((g, i) => {\n const cx = PAD.left + i * colSlotW + colSlotW / 2;\n const barH = Math.max(0, yScale(g.value));\n const barTop = PAD.top + VALUE_LABEL_H + (COL_TRACK_H - barH);\n const catLabelY = PAD.top + VALUE_LABEL_H + COL_TRACK_H + CAT_LABEL_H - 4;\n return svg`\n <rect x=${cx - barW / 2} y=${barTop} width=${barW} height=${barH} rx=${barW / 2}\n fill=\"url(#${this._gradId(i)})\" />\n <text class=\"chart-label\" x=${cx} y=${barTop - 4} font-size=\"10\"\n text-anchor=\"middle\">${this._labelFor(g.value)}</text>\n <text class=\"chart-label\" x=${cx} y=${catLabelY} font-size=\"10\"\n text-anchor=\"middle\">${g.label}</text>\n `;\n });\n\n return { svgH, content: cols };\n }\n\n override render() {\n if (this._width === 0 || this.groups.length === 0) return html``;\n\n const { svgH, content } =\n this.orientation === \"vertical\" ? this._renderVertical() : this._renderHorizontal();\n const ariaPrefix = this.mode === \"percent\" ? \"Percentages\" : \"Values\";\n\n return html`\n <svg\n viewBox=\"0 0 ${this._width} ${svgH}\"\n width=${this._width}\n height=${svgH}\n role=\"img\"\n aria-label=${`${ariaPrefix}: ${this.groups.map((g) => `${g.label} ${this._labelFor(g.value)}`).join(\", \")}`}\n >\n <defs>${this._renderGradients()}</defs>\n ${content}\n </svg>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"percent-bar-chart\": PercentBarChart;\n }\n}\n"]}
1
+ {"version":3,"file":"percent-bar-chart.js","sourceRoot":"","sources":["../src/percent-bar-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBrC,2BAA2B;AAC3B,MAAM,KAAK,GAAG,EAAE,CAAC;AACjB,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,4BAA4B;AAC5B,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,SAAS,GAAG,EAAE,CAAC;A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;IAAX,QAAQ,EAAE;6CAAkC;AAEjC;IAAX,QAAQ,EAAE;oDAAmD;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AAET;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDACN;AAER;IAAhB,KAAK,EAAE;+CAAoB;AA9CjB,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA2K3B","sourcesContent":["import { LitElement, css, html, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { scaleLinear } from \"d3-scale\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface PercentBarGroup {\n key: string;\n label: string;\n /**\n * The row's value. In `mode=\"percent\"` (default) this is a 0-100\n * percentage, scaled against a fixed domain. In `mode=\"value\"` this is an\n * arbitrary raw number, scaled against `max` (or the largest `value`\n * across `groups` when `max` is unset).\n */\n value: number;\n color: string;\n}\n\n/** Whether `PercentBarGroup.value` is a 0-100 percentage or an arbitrary raw number. */\nexport type PercentBarMode = \"percent\" | \"value\";\n/** Bars grow rightward as stacked rows, or upward as side-by-side columns. */\nexport type PercentBarOrientation = \"horizontal\" | \"vertical\";\n\n// Horizontal (row) layout.\nconst ROW_H = 20;\nconst LABEL_W = 56;\nconst VALUE_W = 36;\n\n// Vertical (column) layout.\nconst COL_TRACK_H = 96;\nconst CAT_LABEL_H = 16;\nconst VALUE_LABEL_H = 14;\nconst MAX_BAR_W = 28;\nconst COL_GAP = 8;\n\nconst PAD = { top: 4, right: 4, bottom: 4, left: 4 };\n/**\n * Bar corner radius, in SVG user units. Presentation attributes can't take\n * `var()`, so the shared 4px control radius (0.25rem) is inlined as a\n * literal here, the same way `price-history-chart`'s bars do it. Overriding\n * the radius token does not reach these bars.\n */\nconst BAR_RADIUS = 4;\n\nlet gradientIdCounter = 0;\n\n/**\n * Bar chart for labeled rows, using D3's linear scale. Horizontal (default)\n * renders stacked rows with bars growing rightward; `orientation=\"vertical\"`\n * renders side-by-side columns growing upward instead. `mode=\"percent\"`\n * (default) scales `value` against a fixed 0-100 domain and labels it with a\n * `%` suffix; `mode=\"value\"` scales it against `max` (or the largest `value`\n * present) and formats it with `valueFormat`.\n *\n * @element percent-bar-chart\n */\n@customElement(\"percent-bar-chart\")\nexport class PercentBarChart extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\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 .chart-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .gradient-start {\n stop-color: color-mix(in srgb, var(--percent-bar-color) 70%, #ffffff);\n }\n .gradient-end {\n stop-color: color-mix(in srgb, var(--percent-bar-color) 70%, #000000);\n }\n `,\n ];\n\n /** Rows to render, one per group. */\n @property({ attribute: false }) groups: PercentBarGroup[] = [];\n /** Whether `value` is a 0-100 percentage (fixed domain) or an arbitrary number (domain from data/`max`). */\n @property() mode: PercentBarMode = \"percent\";\n /** Bar direction: stacked rows growing rightward, or columns growing upward. */\n @property() orientation: PercentBarOrientation = \"horizontal\";\n /** Explicit domain max for `mode=\"value\"`; auto-computed from `groups` when unset. Ignored in `mode=\"percent\"`. */\n @property({ type: Number }) max?: number;\n /** Formats a row's value for its label in `mode=\"value\"`. Defaults to locale-formatted number. */\n @property({ attribute: false }) valueFormat: (value: number) => string = (value) =>\n value.toLocaleString();\n\n @state() private _width = 0;\n\n private _ro: ResizeObserver | null = null;\n private readonly _gradIdBase = `percent-bar-grad-${gradientIdCounter++}`;\n\n /** Per-row gradient id, unique across instances and rows. */\n private _gradId(index: number): string {\n return `${this._gradIdBase}-${index}`;\n }\n\n /** The row's value formatted for display, per the current `mode`. */\n private _labelFor(value: number): string {\n return this.mode === \"percent\" ? `${value.toFixed(1)}%` : this.valueFormat(value);\n }\n\n /** The scale domain's upper bound for the current `mode`. */\n private _domainMax(): number {\n if (this.mode === \"percent\") return 100;\n if (this.max !== undefined) return this.max;\n return Math.max(0.000001, ...this.groups.map((g) => g.value));\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 private _renderGradients() {\n return this.groups.map((g, i) => {\n const color = g.color.trim();\n const gradId = this._gradId(i);\n return svg`\n <linearGradient\n id=${gradId}\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n style=${styleMap({ \"--percent-bar-color\": color })}\n >\n <stop class=\"gradient-start\" offset=\"0%\" />\n <stop class=\"gradient-end\" offset=\"100%\" />\n </linearGradient>\n `;\n });\n }\n\n private _renderHorizontal() {\n const innerW = this._width - PAD.left - PAD.right;\n const barMaxW = innerW - LABEL_W - VALUE_W;\n const svgH = PAD.top + this.groups.length * ROW_H + PAD.bottom;\n const xScale = scaleLinear().domain([0, this._domainMax()]).range([0, barMaxW]);\n\n const rows = this.groups.map((g, i) => {\n const cy = PAD.top + i * ROW_H + ROW_H / 2;\n const bw = Math.max(0, xScale(g.value));\n return svg`\n <text class=\"chart-label\" x=${PAD.left} y=${cy} font-size=\"10\"\n text-anchor=\"start\" dominant-baseline=\"middle\">${g.label}</text>\n <rect x=${PAD.left + LABEL_W} y=${cy - 5}\n width=${bw} height=\"10\" rx=${BAR_RADIUS}\n fill=\"url(#${this._gradId(i)})\" />\n <text class=\"chart-label\" x=${PAD.left + LABEL_W + barMaxW + 4} y=${cy} font-size=\"10\"\n text-anchor=\"start\" dominant-baseline=\"middle\">${this._labelFor(g.value)}</text>\n `;\n });\n\n return { svgH, content: rows };\n }\n\n private _renderVertical() {\n const innerW = this._width - PAD.left - PAD.right;\n const n = this.groups.length;\n const colSlotW = n > 0 ? innerW / n : 0;\n const barW = Math.max(4, Math.min(MAX_BAR_W, colSlotW - COL_GAP));\n const svgH = PAD.top + VALUE_LABEL_H + COL_TRACK_H + CAT_LABEL_H + PAD.bottom;\n const yScale = scaleLinear().domain([0, this._domainMax()]).range([0, COL_TRACK_H]);\n\n const cols = this.groups.map((g, i) => {\n const cx = PAD.left + i * colSlotW + colSlotW / 2;\n const barH = Math.max(0, yScale(g.value));\n const barTop = PAD.top + VALUE_LABEL_H + (COL_TRACK_H - barH);\n const catLabelY = PAD.top + VALUE_LABEL_H + COL_TRACK_H + CAT_LABEL_H - 4;\n return svg`\n <rect x=${cx - barW / 2} y=${barTop} width=${barW} height=${barH} rx=${BAR_RADIUS}\n fill=\"url(#${this._gradId(i)})\" />\n <text class=\"chart-label\" x=${cx} y=${barTop - 4} font-size=\"10\"\n text-anchor=\"middle\">${this._labelFor(g.value)}</text>\n <text class=\"chart-label\" x=${cx} y=${catLabelY} font-size=\"10\"\n text-anchor=\"middle\">${g.label}</text>\n `;\n });\n\n return { svgH, content: cols };\n }\n\n override render() {\n if (this._width === 0 || this.groups.length === 0) return html``;\n\n const { svgH, content } =\n this.orientation === \"vertical\" ? this._renderVertical() : this._renderHorizontal();\n const ariaPrefix = this.mode === \"percent\" ? \"Percentages\" : \"Values\";\n\n return html`\n <svg\n viewBox=\"0 0 ${this._width} ${svgH}\"\n width=${this._width}\n height=${svgH}\n role=\"img\"\n aria-label=${`${ariaPrefix}: ${this.groups.map((g) => `${g.label} ${this._labelFor(g.value)}`).join(\", \")}`}\n >\n <defs>${this._renderGradients()}</defs>\n ${content}\n </svg>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"percent-bar-chart\": PercentBarChart;\n }\n}\n"]}
@@ -15,7 +15,11 @@ export interface RadioCardOption {
15
15
  * stand-in, since `border-color`/`accent-color` can't render a gradient),
16
16
  * and its background reads the shared `--ui-button-secondary-surface-muted`
17
17
  * plus `--ui-button-highlight`, so a gradient theme tints it consistently
18
- * with `button-group`/`pagination-nav`'s equivalents.
18
+ * with `button-group`/`pagination-nav`'s equivalents. That shared value is
19
+ * tuned for small controls, so a card — with far more area — blends it 45%
20
+ * toward `--ui-surface` rather than taking a second token: the tint stays
21
+ * the same hue and gradient, just lighter on light themes (and
22
+ * correspondingly deeper on dark ones) than on a button.
19
23
  *
20
24
  * @element radio-cards
21
25
  * @fires change - A card was selected; detail: { value }.
@@ -1 +1 @@
1
- {"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAsFpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAwBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAmGpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAwBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -20,7 +20,11 @@ let instanceCount = 0;
20
20
  * stand-in, since `border-color`/`accent-color` can't render a gradient),
21
21
  * and its background reads the shared `--ui-button-secondary-surface-muted`
22
22
  * plus `--ui-button-highlight`, so a gradient theme tints it consistently
23
- * with `button-group`/`pagination-nav`'s equivalents.
23
+ * with `button-group`/`pagination-nav`'s equivalents. That shared value is
24
+ * tuned for small controls, so a card — with far more area — blends it 45%
25
+ * toward `--ui-surface` rather than taking a second token: the tint stays
26
+ * the same hue and gradient, just lighter on light themes (and
27
+ * correspondingly deeper on dark ones) than on a button.
24
28
  *
25
29
  * @element radio-cards
26
30
  * @fires change - A card was selected; detail: { value }.
@@ -68,9 +72,22 @@ let RadioCards = class RadioCards extends LitElement {
68
72
  );
69
73
  font-size: var(--ui-font-size-sm, 0.75rem);
70
74
  }
75
+ /* Same single muted-surface variable as button-group/pagination-nav,
76
+ but blended toward the card's own surface: that value is tuned for a
77
+ small control, and across a card's much larger area it reads too
78
+ heavy. Mixing with --ui-surface (rather than plain white) keeps the
79
+ adjustment theme-correct — it lightens on light themes and deepens
80
+ on dark ones. Written with the background shorthand (not
81
+ background-image) so it stays valid whether the variable resolves to
82
+ a gradient or a flat color. */
71
83
  .card:has(input:checked) {
72
84
  border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
73
- background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
85
+ background:
86
+ linear-gradient(
87
+ color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent),
88
+ color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent)
89
+ ),
90
+ var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
74
91
  box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
75
92
  }
76
93
  .card input {
@@ -1 +1 @@
1
- {"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAyFL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAErC,UAAK,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC;IAiCpD,CAAC;aAhIiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmFF;KACF,AAtFqB,CAsFpB;IASO,KAAK,CAAoC;IAE1C,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtG,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,IAAI,CAAC,OAAO,EACZ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAClB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;;;;uBAIA,IAAI,CAAC,KAAK;2BACN,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;4BACvB,IAAI,CAAC,QAAQ;0BACf,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;;;2CAGd,GAAG,CAAC,KAAK;kBAClC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,kCAAkC,GAAG,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAvCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AA9FnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAiItB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioCardOption {\n value: string;\n label: string;\n description?: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of full-width cards, each with a label and optional\n * description — for a handful of meaningfully different choices where the\n * description matters. For many short, same-shaped options (a color swatch,\n * a basemap style), use `radio-pills` instead. Wraps native radio inputs for\n * keyboard/a11y and fires `change` rather than relying on form submission.\n *\n * The selected card's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-cards\n * @fires change - A card was selected; detail: { value }.\n */\n@customElement(\"radio-cards\")\nexport class RadioCards extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n gap: 0.5rem;\n flex-wrap: wrap;\n }\n .card {\n flex: 1 1 11.25rem;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\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 .card:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card input {\n width: 1rem;\n height: 1rem;\n margin-top: 0.25rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n }\n .card-label {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-text, #0f172a);\n }\n .card-description {\n display: block;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n }\n .card:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .card:has(input:checked):has(input:focus-visible) {\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 .card:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .card:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .card:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .card:has(input:checked) {\n border-color: Highlight;\n }\n .card:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n .card:has(input:disabled) .card-label,\n .card:has(input:disabled) .card-description {\n color: GrayText;\n }\n }\n `,\n ];\n\n /** Options to render, one card each. */\n @property({ attribute: false }) options: RadioCardOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-cards-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"card\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>\n <span class=\"card-label\">${opt.label}</span>\n ${opt.description ? html`<span class=\"card-description\">${opt.description}</span>` : nothing}\n </span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-cards\": RadioCards;\n }\n}\n"]}
1
+ {"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MA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AAC,KAAK;kBAClC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,kCAAkC,GAAG,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAvCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AA3GnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8ItB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioCardOption {\n value: string;\n label: string;\n description?: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of full-width cards, each with a label and optional\n * description — for a handful of meaningfully different choices where the\n * description matters. For many short, same-shaped options (a color swatch,\n * a basemap style), use `radio-pills` instead. Wraps native radio inputs for\n * keyboard/a11y and fires `change` rather than relying on form submission.\n *\n * The selected card's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents. That shared value is\n * tuned for small controls, so a card — with far more area — blends it 45%\n * toward `--ui-surface` rather than taking a second token: the tint stays\n * the same hue and gradient, just lighter on light themes (and\n * correspondingly deeper on dark ones) than on a button.\n *\n * @element radio-cards\n * @fires change - A card was selected; detail: { value }.\n */\n@customElement(\"radio-cards\")\nexport class RadioCards extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n gap: 0.5rem;\n flex-wrap: wrap;\n }\n .card {\n flex: 1 1 11.25rem;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\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 /* Same single muted-surface variable as button-group/pagination-nav,\n but blended toward the card's own surface: that value is tuned for a\n small control, and across a card's much larger area it reads too\n heavy. Mixing with --ui-surface (rather than plain white) keeps the\n adjustment theme-correct — it lightens on light themes and deepens\n on dark ones. Written with the background shorthand (not\n background-image) so it stays valid whether the variable resolves to\n a gradient or a flat color. */\n .card:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background:\n linear-gradient(\n color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent),\n color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent)\n ),\n var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card input {\n width: 1rem;\n height: 1rem;\n margin-top: 0.25rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n }\n .card-label {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-text, #0f172a);\n }\n .card-description {\n display: block;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n }\n .card:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .card:has(input:checked):has(input:focus-visible) {\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 .card:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .card:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .card:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .card:has(input:checked) {\n border-color: Highlight;\n }\n .card:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n .card:has(input:disabled) .card-label,\n .card:has(input:disabled) .card-description {\n color: GrayText;\n }\n }\n `,\n ];\n\n /** Options to render, one card each. */\n @property({ attribute: false }) options: RadioCardOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-cards-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"card\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>\n <span class=\"card-label\">${opt.label}</span>\n ${opt.description ? html`<span class=\"card-description\">${opt.description}</span>` : nothing}\n </span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-cards\": RadioCards;\n }\n}\n"]}
@@ -0,0 +1,54 @@
1
+ import { LitElement } from "lit";
2
+ /** One dot on a `scroll-dots` rail. */
3
+ export interface ScrollDotItem {
4
+ /** Accessible name for the dot's button — the section or slide title. */
5
+ label: string;
6
+ /** Renders the dot smaller and quieter, for a section subordinate to its neighbours. */
7
+ muted?: boolean;
8
+ }
9
+ /** A dot, or a bare string as shorthand for `{ label }`. */
10
+ export type ScrollDotsItem = string | ScrollDotItem;
11
+ /** Fired when the user picks a dot. `detail.index` is the 0-based target. */
12
+ export interface DotSelectDetail {
13
+ index: number;
14
+ }
15
+ /**
16
+ * Vertical section navigator for a long scrolled page or a slide deck: one dot
17
+ * per section, the active one drawn as an elongated rounded bar rather than a
18
+ * dot, which is the only cue needed to read position at a glance.
19
+ *
20
+ * Controlled, like `pagination-nav`: it owns no scroll behavior and never
21
+ * reads the scroll position. The consumer sets `active` and moves the page in
22
+ * response to `dot-select` — what counts as the active section differs too much
23
+ * between a snapped deck and an ordinary long page to bake in.
24
+ *
25
+ * Positioning is also the consumer's, since a rail is normally fixed into a
26
+ * reserved gutter that only the page knows the width of.
27
+ *
28
+ * The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,
29
+ * derived from a single base `color` — a rail beside a map reads as the same
30
+ * family of marks as the pins on it.
31
+ *
32
+ * @element scroll-dots
33
+ * @fires dot-select - The user picked a dot (`detail: { index }`).
34
+ */
35
+ export declare class ScrollDots extends LitElement {
36
+ /** Dots to render, in document order. A bare string is shorthand for `{ label }`. */
37
+ items: ScrollDotsItem[];
38
+ /** 0-based index of the active dot. Out-of-range values simply match no dot. */
39
+ active: number;
40
+ /** Base color the dot gradient is derived from. Empty uses `--ui-primary`. */
41
+ color: string;
42
+ /** Accessible name for the rail, e.g. "Journey stops". */
43
+ label: string;
44
+ static styles: import("lit").CSSResult[];
45
+ render(): import("lit-html").TemplateResult<1>;
46
+ private _renderDot;
47
+ private _select;
48
+ }
49
+ declare global {
50
+ interface HTMLElementTagNameMap {
51
+ "scroll-dots": ScrollDots;
52
+ }
53
+ }
54
+ //# sourceMappingURL=scroll-dots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-dots.d.ts","sourceRoot":"","sources":["../src/scroll-dots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,uCAAuC;AACvC,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,aAAa,CAAC;AAEpD,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,qFAAqF;IACrD,KAAK,EAAE,cAAc,EAAE,CAAM;IAE7D,gFAAgF;IACpD,MAAM,SAAK;IAEvC,8EAA8E;IAClE,KAAK,SAAM;IAEvB,0DAA0D;IAC9C,KAAK,SAAM;IAEvB,OAAgB,MAAM,4BAiFpB;IAEO,MAAM,yCAUd;IAED,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,OAAO;CAShB;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -0,0 +1,178 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, css, html } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { tokens } from "./tokens.js";
10
+ /**
11
+ * Vertical section navigator for a long scrolled page or a slide deck: one dot
12
+ * per section, the active one drawn as an elongated rounded bar rather than a
13
+ * dot, which is the only cue needed to read position at a glance.
14
+ *
15
+ * Controlled, like `pagination-nav`: it owns no scroll behavior and never
16
+ * reads the scroll position. The consumer sets `active` and moves the page in
17
+ * response to `dot-select` — what counts as the active section differs too much
18
+ * between a snapped deck and an ordinary long page to bake in.
19
+ *
20
+ * Positioning is also the consumer's, since a rail is normally fixed into a
21
+ * reserved gutter that only the page knows the width of.
22
+ *
23
+ * The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,
24
+ * derived from a single base `color` — a rail beside a map reads as the same
25
+ * family of marks as the pins on it.
26
+ *
27
+ * @element scroll-dots
28
+ * @fires dot-select - The user picked a dot (`detail: { index }`).
29
+ */
30
+ let ScrollDots = class ScrollDots extends LitElement {
31
+ constructor() {
32
+ super(...arguments);
33
+ /** Dots to render, in document order. A bare string is shorthand for `{ label }`. */
34
+ this.items = [];
35
+ /** 0-based index of the active dot. Out-of-range values simply match no dot. */
36
+ this.active = 0;
37
+ /** Base color the dot gradient is derived from. Empty uses `--ui-primary`. */
38
+ this.color = "";
39
+ /** Accessible name for the rail, e.g. "Journey stops". */
40
+ this.label = "";
41
+ }
42
+ static { this.styles = [
43
+ tokens,
44
+ css `
45
+ /*
46
+ * will-change promotes the rail to its own compositor layer. A rail is
47
+ * typically fixed over the page's main content — for a map deck, over a
48
+ * WebGL canvas — and without it the browser repaints the dots on the main
49
+ * thread, which flickers and squares off their rounded edges whenever a
50
+ * scroll and an animation are competing for that thread.
51
+ */
52
+ :host {
53
+ display: inline-flex;
54
+ will-change: transform;
55
+ backface-visibility: hidden;
56
+ }
57
+ nav {
58
+ display: flex;
59
+ flex-direction: column;
60
+ align-items: center;
61
+ gap: 0.75rem;
62
+ }
63
+ button {
64
+ width: 0.625rem;
65
+ height: 0.625rem;
66
+ padding: 0;
67
+ border: none;
68
+ border-radius: 9999px;
69
+ /* Same lighter-on-top token gradient as map-circle/timeline-entry's
70
+ dot; the base color is swapped via the private --_dot var. */
71
+ background: linear-gradient(
72
+ to bottom,
73
+ color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #ffffff) 0%,
74
+ color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #000000) 100%
75
+ );
76
+ opacity: 0.45;
77
+ cursor: pointer;
78
+ /*
79
+ * Size is deliberately absent: height is a layout property, so
80
+ * transitioning it animates on the main thread, where a concurrent
81
+ * animation elsewhere on the page can starve it down to a couple of
82
+ * frames and render the bar with squared-off edges. The size change
83
+ * snaps; only the compositable properties ease.
84
+ */
85
+ transition: opacity 0.25s ease;
86
+ }
87
+ button.muted {
88
+ width: 0.4rem;
89
+ height: 0.4rem;
90
+ }
91
+ button:hover {
92
+ opacity: 0.8;
93
+ }
94
+ button:focus-visible {
95
+ outline: none;
96
+ box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
97
+ }
98
+ button.active {
99
+ height: 2.25rem;
100
+ --_dot: var(--_color, var(--ui-primary, #4f46e5));
101
+ opacity: 1;
102
+ }
103
+ @media (forced-colors: active) {
104
+ button {
105
+ background: GrayText;
106
+ opacity: 1;
107
+ }
108
+ button.active {
109
+ background: Highlight;
110
+ }
111
+ button:focus-visible {
112
+ outline: 2px solid CanvasText;
113
+ outline-offset: 2px;
114
+ box-shadow: none;
115
+ }
116
+ }
117
+ @media (prefers-reduced-motion: reduce) {
118
+ button {
119
+ transition: none;
120
+ }
121
+ }
122
+ `,
123
+ ]; }
124
+ render() {
125
+ const dots = this.items.map((item, index) => this._renderDot(normalize(item), index));
126
+ return html `
127
+ <nav
128
+ aria-label=${this.label}
129
+ style=${this.color === "" ? "" : `--_color: ${this.color}`}
130
+ >
131
+ ${dots}
132
+ </nav>
133
+ `;
134
+ }
135
+ _renderDot(item, index) {
136
+ const isActive = index === this.active;
137
+ const classes = [item.muted ? "muted" : "", isActive ? "active" : ""]
138
+ .filter(Boolean)
139
+ .join(" ");
140
+ return html `
141
+ <button
142
+ type="button"
143
+ class=${classes}
144
+ aria-label=${item.label}
145
+ title=${item.label}
146
+ aria-current=${String(isActive)}
147
+ @click=${() => this._select(index)}
148
+ ></button>
149
+ `;
150
+ }
151
+ _select(index) {
152
+ this.dispatchEvent(new CustomEvent("dot-select", {
153
+ detail: { index },
154
+ bubbles: true,
155
+ composed: true,
156
+ }));
157
+ }
158
+ };
159
+ __decorate([
160
+ property({ attribute: false })
161
+ ], ScrollDots.prototype, "items", void 0);
162
+ __decorate([
163
+ property({ type: Number })
164
+ ], ScrollDots.prototype, "active", void 0);
165
+ __decorate([
166
+ property()
167
+ ], ScrollDots.prototype, "color", void 0);
168
+ __decorate([
169
+ property()
170
+ ], ScrollDots.prototype, "label", void 0);
171
+ ScrollDots = __decorate([
172
+ customElement("scroll-dots")
173
+ ], ScrollDots);
174
+ export { ScrollDots };
175
+ function normalize(item) {
176
+ return typeof item === "string" ? { label: item } : item;
177
+ }
178
+ //# sourceMappingURL=scroll-dots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-dots.js","sourceRoot":"","sources":["../src/scroll-dots.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkBrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,qFAAqF;QACrD,UAAK,GAAqB,EAAE,CAAC;QAE7D,gFAAgF;QACpD,WAAM,GAAG,CAAC,CAAC;QAEvC,8EAA8E;QAClE,UAAK,GAAG,EAAE,CAAC;QAEvB,0DAA0D;QAC9C,UAAK,GAAG,EAAE,CAAC;IA2HzB,CAAC;aAzHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8EF;KACF,AAjFqB,CAiFpB;IAEO,MAAM;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAA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AAQ,EAAE;yCAAY;AAGX;IAAX,QAAQ,EAAE;yCAAY;AAXZ,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAsItB;;AAED,SAAS,SAAS,CAAC,IAAoB;IACrC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One dot on a `scroll-dots` rail. */\nexport interface ScrollDotItem {\n /** Accessible name for the dot's button — the section or slide title. */\n label: string;\n /** Renders the dot smaller and quieter, for a section subordinate to its neighbours. */\n muted?: boolean;\n}\n\n/** A dot, or a bare string as shorthand for `{ label }`. */\nexport type ScrollDotsItem = string | ScrollDotItem;\n\n/** Fired when the user picks a dot. `detail.index` is the 0-based target. */\nexport interface DotSelectDetail {\n index: number;\n}\n\n/**\n * Vertical section navigator for a long scrolled page or a slide deck: one dot\n * per section, the active one drawn as an elongated rounded bar rather than a\n * dot, which is the only cue needed to read position at a glance.\n *\n * Controlled, like `pagination-nav`: it owns no scroll behavior and never\n * reads the scroll position. The consumer sets `active` and moves the page in\n * response to `dot-select` — what counts as the active section differs too much\n * between a snapped deck and an ordinary long page to bake in.\n *\n * Positioning is also the consumer's, since a rail is normally fixed into a\n * reserved gutter that only the page knows the width of.\n *\n * The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,\n * derived from a single base `color` — a rail beside a map reads as the same\n * family of marks as the pins on it.\n *\n * @element scroll-dots\n * @fires dot-select - The user picked a dot (`detail: { index }`).\n */\n@customElement(\"scroll-dots\")\nexport class ScrollDots extends LitElement {\n /** Dots to render, in document order. A bare string is shorthand for `{ label }`. */\n @property({ attribute: false }) items: ScrollDotsItem[] = [];\n\n /** 0-based index of the active dot. Out-of-range values simply match no dot. */\n @property({ type: Number }) active = 0;\n\n /** Base color the dot gradient is derived from. Empty uses `--ui-primary`. */\n @property() color = \"\";\n\n /** Accessible name for the rail, e.g. \"Journey stops\". */\n @property() label = \"\";\n\n static override styles = [\n tokens,\n css`\n /*\n * will-change promotes the rail to its own compositor layer. A rail is\n * typically fixed over the page's main content — for a map deck, over a\n * WebGL canvas — and without it the browser repaints the dots on the main\n * thread, which flickers and squares off their rounded edges whenever a\n * scroll and an animation are competing for that thread.\n */\n :host {\n display: inline-flex;\n will-change: transform;\n backface-visibility: hidden;\n }\n nav {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.75rem;\n }\n button {\n width: 0.625rem;\n height: 0.625rem;\n padding: 0;\n border: none;\n border-radius: 9999px;\n /* Same lighter-on-top token gradient as map-circle/timeline-entry's\n dot; the base color is swapped via the private --_dot var. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #000000) 100%\n );\n opacity: 0.45;\n cursor: pointer;\n /*\n * Size is deliberately absent: height is a layout property, so\n * transitioning it animates on the main thread, where a concurrent\n * animation elsewhere on the page can starve it down to a couple of\n * frames and render the bar with squared-off edges. The size change\n * snaps; only the compositable properties ease.\n */\n transition: opacity 0.25s ease;\n }\n button.muted {\n width: 0.4rem;\n height: 0.4rem;\n }\n button:hover {\n opacity: 0.8;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n button.active {\n height: 2.25rem;\n --_dot: var(--_color, var(--ui-primary, #4f46e5));\n opacity: 1;\n }\n @media (forced-colors: active) {\n button {\n background: GrayText;\n opacity: 1;\n }\n button.active {\n background: Highlight;\n }\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n button {\n transition: none;\n }\n }\n `,\n ];\n\n override render() {\n const dots = this.items.map((item, index) => this._renderDot(normalize(item), index));\n return html`\n <nav\n aria-label=${this.label}\n style=${this.color === \"\" ? \"\" : `--_color: ${this.color}`}\n >\n ${dots}\n </nav>\n `;\n }\n\n private _renderDot(item: ScrollDotItem, index: number) {\n const isActive = index === this.active;\n const classes = [item.muted ? \"muted\" : \"\", isActive ? \"active\" : \"\"]\n .filter(Boolean)\n .join(\" \");\n return html`\n <button\n type=\"button\"\n class=${classes}\n aria-label=${item.label}\n title=${item.label}\n aria-current=${String(isActive)}\n @click=${() => this._select(index)}\n ></button>\n `;\n }\n\n private _select(index: number): void {\n this.dispatchEvent(\n new CustomEvent<DotSelectDetail>(\"dot-select\", {\n detail: { index },\n bubbles: true,\n composed: true,\n }),\n );\n }\n}\n\nfunction normalize(item: ScrollDotsItem): ScrollDotItem {\n return typeof item === \"string\" ? { label: item } : item;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"scroll-dots\": ScrollDots;\n }\n}\n"]}
@@ -13,6 +13,12 @@ import { LitElement, type PropertyValues } from "lit";
13
13
  * own visible corner as its content scrolls, rather than floating over the
14
14
  * whole page.
15
15
  *
16
+ * The control is styled as a standard secondary button (ui-button's
17
+ * `secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
18
+ * `--ui-button-secondary-*` background/border tokens, so a gradient theme
19
+ * carries over) rather than a pill, layered over an opaque `--ui-surface`
20
+ * base and an elevation shadow, since it floats above scrolled content.
21
+ *
16
22
  * @element scroll-to-bottom
17
23
  * @fires scroll-to-bottom-triggered - The button was clicked, just before
18
24
  * scrolling; detail: `{ target }`.
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-to-bottom.d.ts","sourceRoot":"","sources":["../src/scroll-to-bottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAMjE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,cAAe,SAAQ,UAAU;;IAC5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 +23,12 @@ import { tokens } from "./tokens.js";
23
23
  * own visible corner as its content scrolls, rather than floating over the
24
24
  * whole page.
25
25
  *
26
+ * The control is styled as a standard secondary button (ui-button's
27
+ * `secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
28
+ * `--ui-button-secondary-*` background/border tokens, so a gradient theme
29
+ * carries over) rather than a pill, layered over an opaque `--ui-surface`
30
+ * base and an elevation shadow, since it floats above scrolled content.
31
+ *
26
32
  * @element scroll-to-bottom
27
33
  * @fires scroll-to-bottom-triggered - The button was clicked, just before
28
34
  * scrolling; detail: `{ target }`.
@@ -74,12 +80,19 @@ let ScrollToBottom = class ScrollToBottom extends LitElement {
74
80
  gap: 0.25rem;
75
81
  height: 2rem;
76
82
  box-sizing: border-box;
77
- padding: 0 0.75rem;
83
+ padding: 0.5rem 1rem;
78
84
  color: var(--ui-text, #0f172a);
79
- background: var(--ui-surface, #ffffff);
80
- border: 1px solid var(--ui-border, #e2e8f0);
81
- border-radius: 999px;
82
- 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));
85
+ /* ui-button's secondary variant, over an opaque --ui-surface base: a
86
+ floating control can't let scrolled content show through the way a
87
+ secondary button's transparent flat background does. */
88
+ background:
89
+ var(--ui-button-secondary-background, none),
90
+ var(--ui-surface, #ffffff);
91
+ border: 1px solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));
92
+ border-radius: var(--ui-radius-sm, 0.25rem);
93
+ box-shadow:
94
+ var(--ui-button-highlight, 0 0 0 0 transparent),
95
+ var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));
83
96
  cursor: pointer;
84
97
  font-family: var(
85
98
  --ui-font,
@@ -97,11 +110,22 @@ let ScrollToBottom = class ScrollToBottom extends LitElement {
97
110
  white-space: nowrap;
98
111
  }
99
112
  button:hover {
100
- background: var(--ui-surface-muted, #f8fafc);
113
+ background:
114
+ var(--ui-button-secondary-background-hover, none),
115
+ var(--ui-surface-muted, #f8fafc);
116
+ border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));
117
+ }
118
+ button:active {
119
+ background:
120
+ var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),
121
+ var(--ui-surface-muted, #f8fafc);
122
+ 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));
101
123
  }
102
124
  button:focus-visible {
103
125
  outline: none;
104
- box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
126
+ box-shadow:
127
+ var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)),
128
+ var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));
105
129
  }
106
130
  @media (prefers-reduced-motion: reduce) {
107
131
  :host {