@sdxc/ui 2026.10.30 → 2026.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -113
- package/dist/{behaviors → app/behaviors}/drag-session.js +1 -1
- package/dist/{behaviors → app/behaviors}/toaster.js +1 -1
- package/dist/{components → app}/chart.d.ts +1 -1
- package/dist/{components → app}/chart.js +18 -34
- package/dist/{components → app}/context-menu.d.ts +2 -2
- package/dist/{components → app}/context-menu.js +8 -7
- package/dist/{components → app}/drop-indicator.js +3 -3
- package/dist/{components → app}/drop-zone.js +3 -3
- package/dist/{components → app}/empty.d.ts +1 -1
- package/dist/{components → app}/empty.js +11 -21
- package/dist/{components → app}/file-trigger.js +2 -2
- package/dist/{components → app}/grid-list.d.ts +1 -1
- package/dist/{components → app}/grid-list.js +16 -18
- package/dist/app/index.d.ts +41 -0
- package/dist/app/index.js +41 -0
- package/dist/{components → app}/menubar.js +5 -7
- package/dist/{mixins → app/mixins}/drag-reorder.js +1 -1
- package/dist/{mixins → app/mixins}/drop-zone.js +1 -1
- package/dist/{mixins → app/mixins}/grid-list-keys.js +2 -2
- package/dist/{mixins → app/mixins}/menubar-keys.js +2 -2
- package/dist/{mixins → app/mixins}/resize-handle.js +3 -3
- package/dist/{mixins/treeKeys.js → app/mixins/tree-keys.js} +2 -2
- package/dist/{components → app}/resizable.js +7 -10
- package/dist/{components → app}/shortcut-list.js +4 -3
- package/dist/{components → app}/skeleton.js +3 -3
- package/dist/{styles → app/styles}/chart-palette.d.ts +1 -1
- package/dist/{styles → app/styles}/graphic-host.d.ts +1 -1
- package/dist/{styles → app/styles}/legend-toggle.d.ts +1 -1
- package/dist/{components → app}/table.js +12 -15
- package/dist/{components → app}/toast.js +18 -24
- package/dist/{components → app}/toolbar.js +3 -3
- package/dist/{components → app}/tree.d.ts +1 -1
- package/dist/{components → app}/tree.js +10 -14
- package/dist/{utils → app/utils}/chart-path.d.ts +1 -1
- package/dist/{utils → app/utils}/chart-path.js +2 -2
- package/dist/{utils → app/utils}/chart-scale.js +1 -1
- package/dist/behaviors/index.d.ts +0 -5
- package/dist/behaviors/index.js +0 -5
- package/dist/{components → chat}/attachment.d.ts +1 -1
- package/dist/{components → chat}/attachment.js +17 -23
- package/dist/{behaviors → chat/behaviors}/scroll-follow-model.js +1 -1
- package/dist/{components → chat}/bubble.js +14 -14
- package/dist/chat/index.d.ts +16 -0
- package/dist/chat/index.js +16 -0
- package/dist/{components → chat}/marker.js +6 -8
- package/dist/{components → chat}/message-scroller.d.ts +1 -1
- package/dist/{components → chat}/message-scroller.js +12 -18
- package/dist/{components → chat}/message.js +10 -12
- package/dist/{mixins → chat/mixins}/message-follow.js +2 -2
- package/dist/{components → color}/color-area.js +7 -10
- package/dist/{components → color}/color-field.js +7 -6
- package/dist/{components → color}/color-picker.d.ts +1 -1
- package/dist/{components → color}/color-picker.js +9 -12
- package/dist/{components → color}/color-slider.js +10 -13
- package/dist/{components → color}/color-swatch-picker.js +4 -5
- package/dist/{components → color}/color-swatch.js +3 -4
- package/dist/{components → color}/color-wheel.js +5 -6
- package/dist/color/index.d.ts +21 -0
- package/dist/color/index.js +21 -0
- package/dist/{mixins → color/mixins}/color-area-drag.d.ts +1 -1
- package/dist/{mixins → color/mixins}/color-area-drag.js +2 -2
- package/dist/{mixins → color/mixins}/color-preview.js +1 -1
- package/dist/{mixins → color/mixins}/color-wheel-drag.js +1 -1
- package/dist/{styles → color/styles}/rtl-aware-gradient-direction.d.ts +1 -1
- package/dist/components/accordion.d.ts +3 -3
- package/dist/components/accordion.js +19 -15
- package/dist/components/alert-dialog.js +5 -4
- package/dist/components/alert.js +10 -20
- package/dist/components/aspect-ratio.js +3 -4
- package/dist/components/avatar.d.ts +6 -6
- package/dist/components/avatar.js +56 -8
- package/dist/components/badge.js +11 -9
- package/dist/components/breadcrumbs.js +7 -9
- package/dist/components/button.d.ts +8 -6
- package/dist/components/button.js +22 -14
- package/dist/components/calendar.js +13 -24
- package/dist/components/card.js +9 -11
- package/dist/components/carousel.d.ts +1 -1
- package/dist/components/carousel.js +12 -20
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +2 -2
- package/dist/components/combobox.js +6 -6
- package/dist/components/command.js +10 -14
- package/dist/components/cta-group.d.ts +30 -14
- package/dist/components/cta-group.js +29 -10
- package/dist/components/date-field.js +2 -1
- package/dist/components/date-picker.js +4 -5
- package/dist/components/date-range-picker.js +3 -2
- package/dist/components/description.js +2 -1
- package/dist/components/dialog-dismiss.d.ts +18 -0
- package/dist/components/dialog-dismiss.js +15 -0
- package/dist/components/dialog.js +11 -15
- package/dist/components/disclosure.js +10 -14
- package/dist/components/drawer.js +3 -4
- package/dist/components/field-error.js +3 -3
- package/dist/components/form.js +2 -1
- package/dist/components/group.js +3 -3
- package/dist/components/header.js +3 -3
- package/dist/components/heading-scope.js +2 -1
- package/dist/components/heading.d.ts +4 -4
- package/dist/components/heading.js +7 -7
- package/dist/components/highlight.js +17 -12
- package/dist/components/hover-card.js +6 -8
- package/dist/components/image-placeholder.js +13 -19
- package/dist/components/index.d.ts +6 -38
- package/dist/components/index.js +6 -38
- package/dist/components/input.js +3 -4
- package/dist/components/item.js +10 -19
- package/dist/components/keyboard.js +3 -3
- package/dist/components/label.js +2 -1
- package/dist/components/link-button.d.ts +7 -5
- package/dist/components/link-button.js +16 -11
- package/dist/components/link.js +3 -4
- package/dist/components/listbox.js +6 -11
- package/dist/components/menu.js +5 -6
- package/dist/components/meter.js +5 -6
- package/dist/components/modal.js +9 -11
- package/dist/components/nav-link.d.ts +1 -1
- package/dist/components/nav-link.js +3 -4
- package/dist/components/navigation-menu.js +17 -23
- package/dist/components/number-field.js +8 -10
- package/dist/components/otp-field.js +2 -1
- package/dist/components/overlay-arrow.js +3 -4
- package/dist/components/pagination.js +8 -10
- package/dist/components/popover.js +3 -4
- package/dist/components/progress-bar.js +5 -5
- package/dist/components/radio-group.js +5 -7
- package/dist/components/range-calendar.js +3 -3
- package/dist/components/scroll-area.js +4 -5
- package/dist/components/search-field.js +8 -11
- package/dist/components/section.js +2 -1
- package/dist/components/select.js +10 -22
- package/dist/components/selection-indicator.js +3 -3
- package/dist/components/sentinel-row.js +3 -3
- package/dist/components/separator.js +3 -3
- package/dist/components/shared-element.js +2 -1
- package/dist/components/sheet.js +6 -7
- package/dist/components/sidebar.js +48 -76
- package/dist/components/slider.js +8 -10
- package/dist/components/spinner.js +3 -3
- package/dist/components/switch.js +3 -3
- package/dist/components/tabs.js +9 -12
- package/dist/components/tag-group.js +7 -9
- package/dist/components/text-field.js +2 -1
- package/dist/components/text.js +2 -1
- package/dist/components/textarea.js +3 -4
- package/dist/components/time-field.js +2 -1
- package/dist/components/toggle-button.js +5 -7
- package/dist/components/tooltip.js +3 -3
- package/dist/components/typeset.js +128 -123
- package/dist/components/youtube-embed.js +2 -1
- package/dist/docs/anchor-heading.d.ts +41 -0
- package/dist/docs/anchor-heading.js +62 -0
- package/dist/docs/callout.d.ts +46 -0
- package/dist/docs/callout.js +61 -0
- package/dist/docs/code-block.d.ts +74 -0
- package/dist/docs/code-block.js +322 -0
- package/dist/docs/code-tabs-sync.d.ts +26 -0
- package/dist/docs/code-tabs-sync.js +12 -0
- package/dist/docs/code-tabs.d.ts +53 -0
- package/dist/docs/code-tabs.js +102 -0
- package/dist/docs/copy-button.d.ts +31 -0
- package/dist/docs/copy-button.js +49 -0
- package/dist/docs/docs-feedback.d.ts +55 -0
- package/dist/docs/docs-feedback.js +72 -0
- package/dist/docs/docs-footer.d.ts +40 -0
- package/dist/docs/docs-footer.js +45 -0
- package/dist/docs/docs-hub.d.ts +93 -0
- package/dist/docs/docs-hub.js +142 -0
- package/dist/docs/docs-layout.d.ts +90 -0
- package/dist/docs/docs-layout.js +166 -0
- package/dist/docs/docs-nav-tools.d.ts +25 -0
- package/dist/docs/docs-nav-tools.js +14 -0
- package/dist/docs/docs-nav.d.ts +53 -0
- package/dist/docs/docs-nav.js +76 -0
- package/dist/docs/docs-not-found.d.ts +68 -0
- package/dist/docs/docs-not-found.js +100 -0
- package/dist/docs/docs-page-header.d.ts +55 -0
- package/dist/docs/docs-page-header.js +54 -0
- package/dist/docs/docs-pager.d.ts +46 -0
- package/dist/docs/docs-pager.js +74 -0
- package/dist/docs/file-tree.d.ts +57 -0
- package/dist/docs/file-tree.js +142 -0
- package/dist/docs/index.d.ts +38 -0
- package/dist/docs/index.js +38 -0
- package/dist/docs/install-command.d.ts +54 -0
- package/dist/docs/install-command.js +33 -0
- package/dist/docs/mixins/code-tabs-sync.d.ts +47 -0
- package/dist/docs/mixins/code-tabs-sync.js +137 -0
- package/dist/docs/mixins/copy-feedback.d.ts +25 -0
- package/dist/docs/mixins/copy-feedback.js +49 -0
- package/dist/docs/mixins/copy-from-url.d.ts +27 -0
- package/dist/docs/mixins/copy-from-url.js +95 -0
- package/dist/docs/mixins/docs-nav-tools.d.ts +27 -0
- package/dist/docs/mixins/docs-nav-tools.js +97 -0
- package/dist/docs/mixins/toc-spy.d.ts +30 -0
- package/dist/docs/mixins/toc-spy.js +165 -0
- package/dist/docs/next-steps.d.ts +45 -0
- package/dist/docs/next-steps.js +79 -0
- package/dist/docs/page-actions.d.ts +77 -0
- package/dist/docs/page-actions.js +78 -0
- package/dist/docs/plan-notice.d.ts +28 -0
- package/dist/docs/plan-notice.js +33 -0
- package/dist/docs/props-table.d.ts +64 -0
- package/dist/docs/props-table.js +147 -0
- package/dist/docs/steps.d.ts +51 -0
- package/dist/docs/steps.js +112 -0
- package/dist/docs/table-of-contents.d.ts +49 -0
- package/dist/docs/table-of-contents.js +139 -0
- package/dist/docs/ui-label.d.ts +51 -0
- package/dist/docs/ui-label.js +64 -0
- package/dist/docs/utils/docs-tree.d.ts +81 -0
- package/dist/docs/utils/docs-tree.js +57 -0
- package/dist/docs/utils/reveal-in-scroller.d.ts +19 -0
- package/dist/docs/utils/reveal-in-scroller.js +43 -0
- package/dist/landing/accent-text.d.ts +47 -0
- package/dist/landing/accent-text.js +107 -0
- package/dist/landing/animations/entrance.d.ts +40 -0
- package/dist/landing/animations/entrance.js +52 -0
- package/dist/landing/announcement-chip.d.ts +45 -0
- package/dist/landing/announcement-chip.js +36 -0
- package/dist/landing/author-band.d.ts +78 -0
- package/dist/landing/author-band.js +190 -0
- package/dist/landing/bento.d.ts +99 -0
- package/dist/landing/bento.js +138 -0
- package/dist/landing/changelog-strip.d.ts +74 -0
- package/dist/landing/changelog-strip.js +201 -0
- package/dist/{patterns → landing}/check-row.js +5 -7
- package/dist/{patterns → landing}/closing-cta.d.ts +4 -4
- package/dist/{patterns → landing}/closing-cta.js +8 -8
- package/dist/landing/code-stage.d.ts +93 -0
- package/dist/landing/code-stage.js +434 -0
- package/dist/landing/crosshair.d.ts +44 -0
- package/dist/landing/crosshair.js +48 -0
- package/dist/landing/curriculum.d.ts +79 -0
- package/dist/landing/curriculum.js +194 -0
- package/dist/landing/drawn-chart.d.ts +74 -0
- package/dist/landing/drawn-chart.js +377 -0
- package/dist/landing/event-ticker.d.ts +71 -0
- package/dist/landing/event-ticker.js +331 -0
- package/dist/landing/fan-out-diagram.d.ts +70 -0
- package/dist/landing/fan-out-diagram.js +481 -0
- package/dist/{patterns → landing}/faq-band.d.ts +5 -5
- package/dist/{patterns → landing}/faq-band.js +13 -14
- package/dist/landing/feature-band.d.ts +108 -0
- package/dist/landing/feature-band.js +67 -0
- package/dist/landing/feature.d.ts +148 -0
- package/dist/landing/feature.js +219 -0
- package/dist/landing/flow-diagram.d.ts +62 -0
- package/dist/landing/flow-diagram.js +240 -0
- package/dist/{patterns → landing}/icon-well.d.ts +17 -7
- package/dist/landing/icon-well.js +31 -0
- package/dist/landing/index.d.ts +52 -0
- package/dist/landing/index.js +52 -0
- package/dist/{patterns → landing}/install-tabs.js +4 -5
- package/dist/landing/landing-header.d.ts +103 -0
- package/dist/landing/landing-header.js +110 -0
- package/dist/landing/landing-hero.d.ts +119 -0
- package/dist/landing/landing-hero.js +172 -0
- package/dist/{components/marketing-section.d.ts → landing/landing-section.d.ts} +38 -15
- package/dist/landing/landing-section.js +183 -0
- package/dist/landing/logo-cloud.d.ts +56 -0
- package/dist/landing/logo-cloud.js +160 -0
- package/dist/landing/logo-sentence.d.ts +38 -0
- package/dist/landing/logo-sentence.js +51 -0
- package/dist/landing/marquee.d.ts +44 -0
- package/dist/landing/marquee.js +97 -0
- package/dist/landing/motion-loop.d.ts +43 -0
- package/dist/landing/motion-loop.js +42 -0
- package/dist/landing/pricing-band.d.ts +94 -0
- package/dist/landing/pricing-band.js +151 -0
- package/dist/landing/product-frame.d.ts +108 -0
- package/dist/landing/product-frame.js +202 -0
- package/dist/{patterns → landing}/proof-strip.d.ts +4 -4
- package/dist/{patterns → landing}/proof-strip.js +3 -3
- package/dist/landing/rails.d.ts +45 -0
- package/dist/landing/rails.js +69 -0
- package/dist/landing/rotating-text.d.ts +44 -0
- package/dist/landing/rotating-text.js +67 -0
- package/dist/landing/segmented-stage.d.ts +75 -0
- package/dist/landing/segmented-stage.js +141 -0
- package/dist/landing/sequence-diagram.d.ts +65 -0
- package/dist/landing/sequence-diagram.js +348 -0
- package/dist/landing/site-footer.d.ts +100 -0
- package/dist/landing/site-footer.js +274 -0
- package/dist/landing/site-header.d.ts +126 -0
- package/dist/landing/site-header.js +595 -0
- package/dist/{components → landing}/split.d.ts +12 -5
- package/dist/{components → landing}/split.js +26 -18
- package/dist/landing/sponsor-wall.d.ts +81 -0
- package/dist/landing/sponsor-wall.js +241 -0
- package/dist/{components → landing}/stat-strip.d.ts +31 -7
- package/dist/landing/stat-strip.js +105 -0
- package/dist/landing/step-list.d.ts +73 -0
- package/dist/landing/step-list.js +182 -0
- package/dist/landing/styles/card-grid.d.ts +115 -0
- package/dist/landing/styles/card-grid.js +295 -0
- package/dist/{patterns → landing}/tabbed-stage.d.ts +26 -8
- package/dist/landing/tabbed-stage.js +233 -0
- package/dist/landing/testimonial-band.d.ts +110 -0
- package/dist/landing/testimonial-band.js +164 -0
- package/dist/landing/typed-terminal.d.ts +62 -0
- package/dist/landing/typed-terminal.js +233 -0
- package/dist/landing/utils/pause-toggle.d.ts +37 -0
- package/dist/landing/utils/pause-toggle.js +71 -0
- package/dist/mixins/copy-to-clipboard.d.ts +6 -0
- package/dist/mixins/copy-to-clipboard.js +17 -1
- package/dist/mixins/dialog-dismiss.d.ts +21 -0
- package/dist/mixins/dialog-dismiss.js +62 -0
- package/dist/mixins/index.d.ts +2 -15
- package/dist/mixins/index.js +2 -15
- package/dist/styles/index.d.ts +2 -5
- package/dist/styles/index.js +2 -5
- package/dist/styles/landing.d.ts +200 -0
- package/dist/styles/landing.js +516 -0
- package/dist/styles/surface-control.d.ts +18 -0
- package/dist/styles/surface-control.js +31 -0
- package/dist/utils/eyebrow.d.ts +39 -0
- package/dist/utils/eyebrow.js +21 -0
- package/dist/utils/index.d.ts +1 -5
- package/dist/utils/index.js +1 -5
- package/package.json +14 -4
- package/src/theme.css +87 -22
- package/dist/components/feature.d.ts +0 -102
- package/dist/components/feature.js +0 -150
- package/dist/components/logo-cloud.d.ts +0 -42
- package/dist/components/logo-cloud.js +0 -41
- package/dist/components/marketing-header.d.ts +0 -71
- package/dist/components/marketing-header.js +0 -81
- package/dist/components/marketing-section.js +0 -117
- package/dist/components/stat-strip.js +0 -65
- package/dist/patterns/accent-text.d.ts +0 -30
- package/dist/patterns/accent-text.js +0 -17
- package/dist/patterns/announcement-chip.d.ts +0 -41
- package/dist/patterns/announcement-chip.js +0 -49
- package/dist/patterns/bento.d.ts +0 -68
- package/dist/patterns/bento.js +0 -94
- package/dist/patterns/code-stage.d.ts +0 -63
- package/dist/patterns/code-stage.js +0 -82
- package/dist/patterns/feature-band.d.ts +0 -85
- package/dist/patterns/feature-band.js +0 -50
- package/dist/patterns/icon-well.js +0 -38
- package/dist/patterns/index.d.ts +0 -23
- package/dist/patterns/index.js +0 -23
- package/dist/patterns/landing-hero.d.ts +0 -93
- package/dist/patterns/landing-hero.js +0 -126
- package/dist/patterns/product-frame.d.ts +0 -60
- package/dist/patterns/product-frame.js +0 -70
- package/dist/patterns/step-list.d.ts +0 -47
- package/dist/patterns/step-list.js +0 -85
- package/dist/patterns/tabbed-stage.js +0 -77
- package/dist/styles/marketing.d.ts +0 -120
- package/dist/styles/marketing.js +0 -225
- package/dist/utils/semantic-color-panel.d.ts +0 -35
- package/dist/utils/semantic-color-panel.js +0 -28
- /package/dist/{behaviors → app/behaviors}/drag-session.d.ts +0 -0
- /package/dist/{behaviors → app/behaviors}/resize-session.d.ts +0 -0
- /package/dist/{behaviors → app/behaviors}/resize-session.js +0 -0
- /package/dist/{behaviors → app/behaviors}/selection-model.d.ts +0 -0
- /package/dist/{behaviors → app/behaviors}/selection-model.js +0 -0
- /package/dist/{behaviors → app/behaviors}/toaster.d.ts +0 -0
- /package/dist/{components → app}/drop-indicator.d.ts +0 -0
- /package/dist/{components → app}/drop-zone.d.ts +0 -0
- /package/dist/{components → app}/file-trigger.d.ts +0 -0
- /package/dist/{components → app}/menubar.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/chart-tooltip.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/chart-tooltip.js +0 -0
- /package/dist/{mixins → app/mixins}/context-menu.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/context-menu.js +0 -0
- /package/dist/{mixins → app/mixins}/drag-reorder.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/drop-zone.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/grid-list-keys.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/menubar-keys.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/resize-handle.d.ts +0 -0
- /package/dist/{mixins/treeKeys.d.ts → app/mixins/tree-keys.d.ts} +0 -0
- /package/dist/{components → app}/resizable.d.ts +0 -0
- /package/dist/{components → app}/shortcut-list.d.ts +0 -0
- /package/dist/{components → app}/skeleton.d.ts +0 -0
- /package/dist/{styles → app/styles}/chart-palette.js +0 -0
- /package/dist/{styles → app/styles}/graphic-host.js +0 -0
- /package/dist/{styles → app/styles}/legend-toggle.js +0 -0
- /package/dist/{components → app}/table.d.ts +0 -0
- /package/dist/{components → app}/toast.d.ts +0 -0
- /package/dist/{components → app}/toolbar.d.ts +0 -0
- /package/dist/{utils → app/utils}/chart-marker-indices.d.ts +0 -0
- /package/dist/{utils → app/utils}/chart-marker-indices.js +0 -0
- /package/dist/{utils → app/utils}/chart-scale.d.ts +0 -0
- /package/dist/{behaviors → chat/behaviors}/scroll-follow-model.d.ts +0 -0
- /package/dist/{components → chat}/bubble.d.ts +0 -0
- /package/dist/{components → chat}/marker.d.ts +0 -0
- /package/dist/{components → chat}/message.d.ts +0 -0
- /package/dist/{mixins → chat/mixins}/attachment-trigger.d.ts +0 -0
- /package/dist/{mixins → chat/mixins}/attachment-trigger.js +0 -0
- /package/dist/{mixins → chat/mixins}/message-follow.d.ts +0 -0
- /package/dist/{components → color}/color-area.d.ts +0 -0
- /package/dist/{components → color}/color-field.d.ts +0 -0
- /package/dist/{components → color}/color-slider.d.ts +0 -0
- /package/dist/{components → color}/color-swatch-picker.d.ts +0 -0
- /package/dist/{components → color}/color-swatch.d.ts +0 -0
- /package/dist/{components → color}/color-wheel.d.ts +0 -0
- /package/dist/{mixins → color/mixins}/color-channel-sync.d.ts +0 -0
- /package/dist/{mixins → color/mixins}/color-channel-sync.js +0 -0
- /package/dist/{mixins → color/mixins}/color-preview.d.ts +0 -0
- /package/dist/{mixins → color/mixins}/color-wheel-drag.d.ts +0 -0
- /package/dist/{styles → color/styles}/rtl-aware-gradient-direction.js +0 -0
- /package/dist/{utils → color/utils}/hue-spectrum.d.ts +0 -0
- /package/dist/{utils → color/utils}/hue-spectrum.js +0 -0
- /package/dist/{patterns → landing}/check-row.d.ts +0 -0
- /package/dist/{patterns → landing}/install-tabs.d.ts +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
3
|
+
import { keyframes } from "@sdxc/u/animation";
|
|
4
|
+
import { raw } from "@sdxc/u/general";
|
|
5
|
+
import { motionSafe } from "@sdxc/u/responsive";
|
|
6
|
+
import { landingSurface } from "../styles/landing.js";
|
|
7
|
+
import { MotionLoop } from "./motion-loop.js";
|
|
8
|
+
/** Length of one loop: the figure draws, holds the finished chart, then resets. */
|
|
9
|
+
const CYCLE_SECONDS = 10;
|
|
10
|
+
/** Percent of the cycle at which every drawn element returns to empty for the next loop. */
|
|
11
|
+
const RESET_AT = 94;
|
|
12
|
+
/** Percent of the cycle the headline number starts counting at. */
|
|
13
|
+
const COUNT_FROM = 6;
|
|
14
|
+
/** Percent of the cycle the headline number reaches its value at. */
|
|
15
|
+
const COUNT_TO = 46;
|
|
16
|
+
/** Frames the count passes through on its way up; each is a precomputed, formatted number. */
|
|
17
|
+
const COUNT_STEPS = 24;
|
|
18
|
+
/** Percent of the cycle the first bar, or the line, starts drawing at. */
|
|
19
|
+
const DRAW_FROM = 10;
|
|
20
|
+
/** Percent of the cycle one bar takes to grow to its value. */
|
|
21
|
+
const BAR_GROW = 18;
|
|
22
|
+
/** Percent of the cycle the bars' start times spread over, so a long series still holds. */
|
|
23
|
+
const BAR_STAGGER_SPAN = 30;
|
|
24
|
+
/** Most percent of the cycle between one bar starting and the next. */
|
|
25
|
+
const MAX_BAR_GAP = 6;
|
|
26
|
+
/** Percent of the cycle the line takes to draw from its first point to its last. */
|
|
27
|
+
const LINE_DRAW = 40;
|
|
28
|
+
/**
|
|
29
|
+
* The line's reveal, from nothing to the whole plot. It wipes from the first point to the
|
|
30
|
+
* last, which on a chart read left to right is the line stroking in; the outsets keep the
|
|
31
|
+
* stroke's round caps and the peaks at the plot's edge uncut.
|
|
32
|
+
*/
|
|
33
|
+
const HIDDEN_CLIP = "inset(-0.5rem 100% -0.5rem -0.5rem)";
|
|
34
|
+
/** The line's reveal at rest: the whole plot, plus the outset for the stroke. */
|
|
35
|
+
const SHOWN_CLIP = "inset(-0.5rem -0.5rem -0.5rem -0.5rem)";
|
|
36
|
+
/** Height of the line chart's plot, which the SVG stretches to fill. */
|
|
37
|
+
const LINE_HEIGHT = "7.5rem";
|
|
38
|
+
/** Size of a point on the line; the highlighted point is drawn larger. */
|
|
39
|
+
const POINT = "0.5rem";
|
|
40
|
+
/** Easing a bar's growth starts with, so it lands softly on its value. */
|
|
41
|
+
const GROW_EASING = "cubic-bezier(0.2, 0.7, 0.2, 1)";
|
|
42
|
+
/**
|
|
43
|
+
* Room the first text line keeps at its end for the pause toggle pinned to the surface's
|
|
44
|
+
* top corner, so a label that wraps on a phone stays clear of the button.
|
|
45
|
+
*/
|
|
46
|
+
const PAUSE_CLEARANCE = "2.75rem";
|
|
47
|
+
/** Locale the headline number formats in when `metric.locale` is omitted. */
|
|
48
|
+
const DEFAULT_LOCALE = "en-US";
|
|
49
|
+
/**
|
|
50
|
+
* Renders the figure on a raised surface inside a {@link MotionLoop}. The markup is the
|
|
51
|
+
* finished figure: full bars or line and the real formatted number, which is what reduced
|
|
52
|
+
* motion and assistive technology get. Charts with the same series length share keyframes.
|
|
53
|
+
*
|
|
54
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
55
|
+
* @returns The render function producing the figure's markup.
|
|
56
|
+
* @example
|
|
57
|
+
* <DrawnChart
|
|
58
|
+
* aria-label="Median time between checks, by how often a feed posts"
|
|
59
|
+
* metric={{ value: 15, suffix: " min", label: "Between checks of an hourly feed" }}
|
|
60
|
+
* series={[{ label: "Hourly", value: 15, display: "15 min" }, { label: "Daily", value: 240, display: "4 h" }]}
|
|
61
|
+
* highlight={0}
|
|
62
|
+
* />
|
|
63
|
+
*/
|
|
64
|
+
export function DrawnChart(handle) {
|
|
65
|
+
return () => {
|
|
66
|
+
let { "aria-label": label, footnote, highlight, max, metric, mix, pauseLabel, series, variant, ...rest } = handle.props;
|
|
67
|
+
let scale = max ?? Math.max(0, ...series.map((datum) => datum.value));
|
|
68
|
+
let chart = (variant ?? "bars") === "line" ? (_jsx(LineChart, { label: label, series: series, scale: scale, highlight: highlight })) : (_jsx(BarChart, { label: label, series: series, scale: scale, highlight: highlight, clearance: metric === undefined }));
|
|
69
|
+
return (_jsx(MotionLoop, { ...rest, pauseLabel: pauseLabel, placement: "start-end", mix: mix, children: _jsxs("div", { "data-slot": "drawn-chart", mix: [
|
|
70
|
+
landingSurface(),
|
|
71
|
+
raw({ display: "grid", gap: "1.5rem", padding: "clamp(1.25rem, 4cqi, 2rem)" }),
|
|
72
|
+
], children: [metric ? _jsx(Headline, { metric: metric }) : null, chart, footnote ? (_jsx("p", { "data-slot": "drawn-chart-footnote", mix: [
|
|
73
|
+
small(),
|
|
74
|
+
raw({
|
|
75
|
+
margin: "0",
|
|
76
|
+
paddingBlockStart: "1rem",
|
|
77
|
+
borderBlockStart: "1px solid var(--ui-landing-hairline, var(--ui-neutral-border))",
|
|
78
|
+
}),
|
|
79
|
+
], children: footnote })) : null] }) }));
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The large number over its label. An integer value also gets a decorative counter whose
|
|
84
|
+
* `::before` steps through precomputed formatted frames while motion is allowed; the real
|
|
85
|
+
* number stays in the DOM as text, only visually hidden while the counter shows.
|
|
86
|
+
*/
|
|
87
|
+
function Headline(handle) {
|
|
88
|
+
return () => {
|
|
89
|
+
let { metric } = handle.props;
|
|
90
|
+
let text = formatMetric(metric, metric.value);
|
|
91
|
+
let counts = Number.isInteger(metric.value) && metric.value !== 0;
|
|
92
|
+
return (_jsxs("div", { "data-slot": "drawn-chart-metric", mix: [raw({ display: "grid", gap: "0.25rem", paddingInlineEnd: PAUSE_CLEARANCE })], children: [_jsxs("p", { "data-slot": "drawn-chart-number", mix: [
|
|
93
|
+
raw({
|
|
94
|
+
position: "relative",
|
|
95
|
+
margin: "0",
|
|
96
|
+
fontSize: "clamp(2.25rem, 10cqi, 3.25rem)",
|
|
97
|
+
lineHeight: "1.05",
|
|
98
|
+
fontWeight: "700",
|
|
99
|
+
letterSpacing: "-0.02em",
|
|
100
|
+
fontVariantNumeric: "tabular-nums",
|
|
101
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
102
|
+
}),
|
|
103
|
+
], children: [counts ? _jsx(Counter, { metric: metric, text: text }) : null, _jsx("span", { "data-slot": "drawn-chart-number-text", mix: [counts ? motionSafe(visuallyHidden()) : []], children: text })] }), _jsx("p", { mix: [small(), raw({ margin: "0" })], children: metric.label })] }));
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The counting number, drawn only by a pseudo-element and hidden from assistive technology.
|
|
108
|
+
* Its resting content is the finished number, so a browser that skips animating `content`
|
|
109
|
+
* still shows the right value.
|
|
110
|
+
*/
|
|
111
|
+
function Counter(handle) {
|
|
112
|
+
return () => {
|
|
113
|
+
let { metric, text } = handle.props;
|
|
114
|
+
let frames = countFrames(metric);
|
|
115
|
+
let name = `ui-drawn-chart-count-${hash(Object.values(frames)
|
|
116
|
+
.map((frame) => frame.content)
|
|
117
|
+
.join("|"))}`;
|
|
118
|
+
return (_jsx("span", { "aria-hidden": "true", "data-slot": "drawn-chart-count", mix: [
|
|
119
|
+
keyframes(name, frames),
|
|
120
|
+
raw({ display: "none" }),
|
|
121
|
+
motionSafe(raw({
|
|
122
|
+
display: "inline",
|
|
123
|
+
"&::before": {
|
|
124
|
+
content: cssString(text),
|
|
125
|
+
...loop(name),
|
|
126
|
+
animationTimingFunction: "step-end",
|
|
127
|
+
},
|
|
128
|
+
})),
|
|
129
|
+
] }));
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Keyframe stops for the count: zero until {@link COUNT_FROM}, then {@link COUNT_STEPS}
|
|
134
|
+
* eased-out frames up to the value, held until {@link RESET_AT}. Each stop's `content` is
|
|
135
|
+
* the frame already formatted with the metric's prefix, suffix and number format.
|
|
136
|
+
*/
|
|
137
|
+
function countFrames(metric) {
|
|
138
|
+
let frame = (value) => ({ content: cssString(formatMetric(metric, value)) });
|
|
139
|
+
let frames = { "0%": frame(0) };
|
|
140
|
+
for (let step = 0; step <= COUNT_STEPS; step++) {
|
|
141
|
+
let progress = step / COUNT_STEPS;
|
|
142
|
+
let eased = 1 - (1 - progress) ** 3;
|
|
143
|
+
frames[percent(COUNT_FROM + (COUNT_TO - COUNT_FROM) * progress)] = frame(Math.round(metric.value * eased));
|
|
144
|
+
}
|
|
145
|
+
frames[`${RESET_AT}%`] = frame(metric.value);
|
|
146
|
+
frames["100%"] = frame(0);
|
|
147
|
+
return frames;
|
|
148
|
+
}
|
|
149
|
+
/** The metric's value, or one counted frame of it, with its prefix and suffix. */
|
|
150
|
+
function formatMetric(metric, value) {
|
|
151
|
+
let number = new Intl.NumberFormat(metric.locale ?? DEFAULT_LOCALE, metric.format).format(value);
|
|
152
|
+
return `${metric.prefix ?? ""}${number}${metric.suffix ?? ""}`;
|
|
153
|
+
}
|
|
154
|
+
/** `text` as a quoted CSS string, safe for the `content` property. */
|
|
155
|
+
function cssString(text) {
|
|
156
|
+
return `"${text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
157
|
+
}
|
|
158
|
+
/** A short, stable name fragment for a set of frames, so different metrics never share keyframes. */
|
|
159
|
+
function hash(text) {
|
|
160
|
+
let value = 5381;
|
|
161
|
+
for (let index = 0; index < text.length; index++) {
|
|
162
|
+
value = (Math.imul(value, 33) ^ text.charCodeAt(index)) >>> 0;
|
|
163
|
+
}
|
|
164
|
+
return value.toString(36);
|
|
165
|
+
}
|
|
166
|
+
/** A keyframe stop key, rounded so computed offsets stay readable in the stylesheet. */
|
|
167
|
+
function percent(value) {
|
|
168
|
+
return `${Math.round(value * 100) / 100}%`;
|
|
169
|
+
}
|
|
170
|
+
/** Share of the scale `value` fills, in percent and clamped to the track. */
|
|
171
|
+
function share(value, scale) {
|
|
172
|
+
return scale > 0 ? Math.min(100, Math.max(0, (value / scale) * 100)) : 0;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The series as a named list of horizontal bars: each row's label and value over a track
|
|
176
|
+
* whose fill is the value's share of the scale. Each fill grows from zero in turn.
|
|
177
|
+
*/
|
|
178
|
+
function BarChart(handle) {
|
|
179
|
+
return () => {
|
|
180
|
+
let { clearance, highlight, label, scale, series } = handle.props;
|
|
181
|
+
let gap = series.length > 0 ? Math.min(MAX_BAR_GAP, BAR_STAGGER_SPAN / series.length) : 0;
|
|
182
|
+
return (_jsx("ol", { "aria-label": label, "data-slot": "drawn-chart-bars", mix: [
|
|
183
|
+
raw({ display: "grid", gap: "0.875rem", margin: "0", padding: "0", listStyle: "none" }),
|
|
184
|
+
], children: series.map((datum, index) => {
|
|
185
|
+
let lit = index === highlight;
|
|
186
|
+
let name = `ui-drawn-chart-bar-${series.length}-${index}`;
|
|
187
|
+
let start = DRAW_FROM + index * gap;
|
|
188
|
+
return (_jsxs("li", { mix: [raw({ display: "grid", gap: "0.375rem" })], children: [_jsxs("span", { mix: [
|
|
189
|
+
raw({
|
|
190
|
+
display: "flex",
|
|
191
|
+
justifyContent: "space-between",
|
|
192
|
+
alignItems: "baseline",
|
|
193
|
+
gap: "0.75rem",
|
|
194
|
+
}),
|
|
195
|
+
clearance && index === 0 ? raw({ paddingInlineEnd: PAUSE_CLEARANCE }) : [],
|
|
196
|
+
], children: [_jsx("span", { mix: [caption(lit)], children: datum.label }), _jsx("span", { mix: [caption(lit), raw({ flexShrink: "0", fontVariantNumeric: "tabular-nums" })], children: datum.display ?? datum.value })] }), _jsx("span", { "aria-hidden": "true", mix: [
|
|
197
|
+
raw({
|
|
198
|
+
display: "block",
|
|
199
|
+
blockSize: "0.5rem",
|
|
200
|
+
borderRadius: "9999px",
|
|
201
|
+
backgroundColor: "var(--ui-neutral-bg-tint)",
|
|
202
|
+
overflow: "hidden",
|
|
203
|
+
}),
|
|
204
|
+
], children: _jsx("span", { "data-slot": "drawn-chart-bar", style: { inlineSize: `${share(datum.value, scale)}%` }, mix: [
|
|
205
|
+
keyframes(name, {
|
|
206
|
+
"0%": { transform: "scaleX(0)" },
|
|
207
|
+
[percent(start)]: {
|
|
208
|
+
transform: "scaleX(0)",
|
|
209
|
+
animationTimingFunction: GROW_EASING,
|
|
210
|
+
},
|
|
211
|
+
[percent(start + BAR_GROW)]: { transform: "scaleX(1)" },
|
|
212
|
+
[`${RESET_AT}%`]: { transform: "scaleX(1)" },
|
|
213
|
+
[`${RESET_AT + 2}%`]: { transform: "scaleX(0)" },
|
|
214
|
+
"100%": { transform: "scaleX(0)" },
|
|
215
|
+
}),
|
|
216
|
+
raw({
|
|
217
|
+
display: "block",
|
|
218
|
+
blockSize: "100%",
|
|
219
|
+
borderRadius: "inherit",
|
|
220
|
+
backgroundColor: lit
|
|
221
|
+
? "var(--ui-brand-bg-solid)"
|
|
222
|
+
: "var(--ui-neutral-fg-muted)",
|
|
223
|
+
transformOrigin: "left center",
|
|
224
|
+
"&:dir(rtl)": { transformOrigin: "right center" },
|
|
225
|
+
}),
|
|
226
|
+
motionSafe(raw(loop(name))),
|
|
227
|
+
] }) })] }, index));
|
|
228
|
+
}) }));
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The series as a line drawn in from its first point, each point appearing as the line
|
|
233
|
+
* reaches it, with short labels under the plot. The SVG is a named image; a visually
|
|
234
|
+
* hidden list carries every label and value for assistive technology.
|
|
235
|
+
*/
|
|
236
|
+
function LineChart(handle) {
|
|
237
|
+
return () => {
|
|
238
|
+
let { highlight, label, scale, series } = handle.props;
|
|
239
|
+
let count = series.length;
|
|
240
|
+
let points = series.map((datum, index) => ({
|
|
241
|
+
x: count > 1 ? (index / (count - 1)) * 100 : 50,
|
|
242
|
+
y: 100 - share(datum.value, scale),
|
|
243
|
+
}));
|
|
244
|
+
let path = points
|
|
245
|
+
.map((point, index) => `${index === 0 ? "M" : "L"}${round(point.x)} ${round(point.y)}`)
|
|
246
|
+
.join(" ");
|
|
247
|
+
let lineName = `ui-drawn-chart-line-${count}`;
|
|
248
|
+
return (_jsxs("div", { "data-slot": "drawn-chart-line", mix: [raw({ display: "grid", gap: "0.625rem" })], children: [_jsxs("div", { mix: [
|
|
249
|
+
raw({
|
|
250
|
+
position: "relative",
|
|
251
|
+
blockSize: LINE_HEIGHT,
|
|
252
|
+
marginInline: `calc(${POINT} / 2)`,
|
|
253
|
+
borderBlockEnd: "1px solid var(--ui-landing-hairline, var(--ui-neutral-border))",
|
|
254
|
+
}),
|
|
255
|
+
], children: [_jsx("svg", { role: "img", "aria-label": label, viewBox: "0 0 100 100", preserveAspectRatio: "none", "data-slot": "drawn-chart-plot", mix: [
|
|
256
|
+
keyframes(lineName, {
|
|
257
|
+
"0%": { clipPath: HIDDEN_CLIP },
|
|
258
|
+
[`${DRAW_FROM}%`]: { clipPath: HIDDEN_CLIP },
|
|
259
|
+
[`${DRAW_FROM + LINE_DRAW}%`]: { clipPath: SHOWN_CLIP },
|
|
260
|
+
[`${RESET_AT}%`]: { clipPath: SHOWN_CLIP },
|
|
261
|
+
[`${RESET_AT + 2}%`]: { clipPath: HIDDEN_CLIP },
|
|
262
|
+
"100%": { clipPath: HIDDEN_CLIP },
|
|
263
|
+
}),
|
|
264
|
+
raw({
|
|
265
|
+
display: "block",
|
|
266
|
+
inlineSize: "100%",
|
|
267
|
+
blockSize: "100%",
|
|
268
|
+
overflow: "visible",
|
|
269
|
+
}),
|
|
270
|
+
motionSafe(raw(loop(lineName))),
|
|
271
|
+
], children: _jsx("path", { d: path, mix: [
|
|
272
|
+
raw({
|
|
273
|
+
fill: "none",
|
|
274
|
+
stroke: "var(--ui-neutral-fg-emphasis)",
|
|
275
|
+
strokeWidth: "2",
|
|
276
|
+
strokeLinecap: "round",
|
|
277
|
+
strokeLinejoin: "round",
|
|
278
|
+
vectorEffect: "non-scaling-stroke",
|
|
279
|
+
}),
|
|
280
|
+
] }) }), points.map((point, index) => (_jsx(Point, { x: point.x, y: point.y, count: count, index: index, lit: index === highlight }, index)))] }), _jsx("div", { "aria-hidden": "true", mix: [
|
|
281
|
+
raw({
|
|
282
|
+
position: "relative",
|
|
283
|
+
blockSize: "1.125rem",
|
|
284
|
+
marginInline: `calc(${POINT} / 2)`,
|
|
285
|
+
}),
|
|
286
|
+
], children: series.map((datum, index) => (_jsx("span", { style: { left: `${points[index].x}%` }, mix: [
|
|
287
|
+
small(),
|
|
288
|
+
raw({
|
|
289
|
+
position: "absolute",
|
|
290
|
+
insetBlockStart: "0",
|
|
291
|
+
whiteSpace: "nowrap",
|
|
292
|
+
lineHeight: "1.125rem",
|
|
293
|
+
translate: edgeAlign(index, count),
|
|
294
|
+
}),
|
|
295
|
+
index === highlight ? raw({ color: "var(--ui-brand-fg)", fontWeight: "600" }) : [],
|
|
296
|
+
], children: datum.label }, index))) }), _jsx("ol", { mix: [visuallyHidden()], children: series.map((datum, index) => (_jsxs("li", { children: [datum.label, ": ", datum.display ?? datum.value] }, index))) })] }));
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/** Rounds a plot coordinate so the path data stays short. */
|
|
300
|
+
function round(value) {
|
|
301
|
+
return Math.round(value * 100) / 100;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* How far a label under the line shifts from its point: the first and last align to the
|
|
305
|
+
* plot's edges so they stay inside the surface, every other one centres on its point.
|
|
306
|
+
*/
|
|
307
|
+
function edgeAlign(index, count) {
|
|
308
|
+
if (count > 1 && index === 0)
|
|
309
|
+
return "0";
|
|
310
|
+
if (count > 1 && index === count - 1)
|
|
311
|
+
return "-100%";
|
|
312
|
+
return "-50%";
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* A point on the line, drawn in HTML over the stretched SVG so it stays round. It appears
|
|
316
|
+
* when the line reaches it, and the highlighted point is larger and in the brand colour.
|
|
317
|
+
*/
|
|
318
|
+
function Point(handle) {
|
|
319
|
+
return () => {
|
|
320
|
+
let { count, index, lit, x, y } = handle.props;
|
|
321
|
+
let name = `ui-drawn-chart-point-${count}-${index}`;
|
|
322
|
+
let at = DRAW_FROM + (count > 1 ? (index / (count - 1)) * LINE_DRAW : 0);
|
|
323
|
+
let off = { opacity: "0", transform: "scale(0.4)" };
|
|
324
|
+
let on = { opacity: "1", transform: "scale(1)" };
|
|
325
|
+
return (_jsx("span", { "aria-hidden": "true", "data-slot": "drawn-chart-point", style: { left: `${x}%`, top: `${y}%` }, mix: [
|
|
326
|
+
keyframes(name, {
|
|
327
|
+
"0%": off,
|
|
328
|
+
[percent(Math.max(0, at - 1))]: off,
|
|
329
|
+
[percent(at + 1)]: on,
|
|
330
|
+
[`${RESET_AT}%`]: on,
|
|
331
|
+
[`${RESET_AT + 2}%`]: off,
|
|
332
|
+
"100%": off,
|
|
333
|
+
}),
|
|
334
|
+
raw({
|
|
335
|
+
position: "absolute",
|
|
336
|
+
inlineSize: lit ? `calc(${POINT} * 1.75)` : POINT,
|
|
337
|
+
blockSize: lit ? `calc(${POINT} * 1.75)` : POINT,
|
|
338
|
+
marginInlineStart: lit ? `calc(${POINT} * -0.875)` : `calc(${POINT} / -2)`,
|
|
339
|
+
marginBlockStart: lit ? `calc(${POINT} * -0.875)` : `calc(${POINT} / -2)`,
|
|
340
|
+
borderRadius: "9999px",
|
|
341
|
+
backgroundColor: lit ? "var(--ui-brand-bg-solid)" : "var(--ui-neutral-fg-emphasis)",
|
|
342
|
+
boxShadow: "0 0 0 2px var(--ui-bg)",
|
|
343
|
+
}),
|
|
344
|
+
motionSafe(raw(loop(name))),
|
|
345
|
+
] }));
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/** The animation declarations every drawn element shares: one linear loop of the cycle. */
|
|
349
|
+
function loop(name) {
|
|
350
|
+
return {
|
|
351
|
+
animationName: name,
|
|
352
|
+
animationDuration: `${CYCLE_SECONDS}s`,
|
|
353
|
+
animationTimingFunction: "linear",
|
|
354
|
+
animationIterationCount: "infinite",
|
|
355
|
+
animationFillMode: "both",
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
/** A bar's label or value, in the heading ink, or the brand ink when highlighted. */
|
|
359
|
+
function caption(lit) {
|
|
360
|
+
return raw({
|
|
361
|
+
fontSize: "0.875rem",
|
|
362
|
+
lineHeight: "1.25rem",
|
|
363
|
+
fontWeight: lit ? "600" : "500",
|
|
364
|
+
color: lit ? "var(--ui-brand-fg)" : "var(--ui-neutral-fg-emphasis)",
|
|
365
|
+
minInlineSize: "0",
|
|
366
|
+
overflowWrap: "anywhere",
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/** The quieter text: the metric's label, the line's labels and the footnote. */
|
|
370
|
+
function small() {
|
|
371
|
+
return raw({
|
|
372
|
+
fontSize: "0.8125rem",
|
|
373
|
+
lineHeight: "1.25rem",
|
|
374
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
375
|
+
overflowWrap: "anywhere",
|
|
376
|
+
});
|
|
377
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An animated feed of events landing one by one, newest on top, with the exception
|
|
3
|
+
* surfaced: checks pass every few minutes and the one that broke names its failing step,
|
|
4
|
+
* feed items arrive, jobs finish. It proves continuous activity without a screenshot.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
/**
|
|
11
|
+
* Prop types for {@link EventTicker}.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace EventTicker {
|
|
14
|
+
/** Outcome of one event, drawn as a success, warning, danger or neutral chip. */
|
|
15
|
+
type Status = "ok" | "warn" | "fail" | "pending";
|
|
16
|
+
/** What a row turns into partway through its life, such as a pending job finishing. */
|
|
17
|
+
interface Flip {
|
|
18
|
+
status: Status;
|
|
19
|
+
/** Quieter line that replaces the row's `detail`. */
|
|
20
|
+
detail?: RemixNode;
|
|
21
|
+
/** Mono line that replaces the row's `code`. */
|
|
22
|
+
code?: string;
|
|
23
|
+
}
|
|
24
|
+
/** One event of the feed. */
|
|
25
|
+
interface Row {
|
|
26
|
+
/** When it happened, set in mono, such as "09:42". */
|
|
27
|
+
time: string;
|
|
28
|
+
label: RemixNode;
|
|
29
|
+
status: Status;
|
|
30
|
+
/** Quieter line under the label; a failed row tints it in the danger tone. */
|
|
31
|
+
detail?: RemixNode;
|
|
32
|
+
/** The detail set in mono in place of `detail`, such as the failing step's source. */
|
|
33
|
+
code?: string;
|
|
34
|
+
/** The status, and optionally the detail, the row settles on; the finished state shows it. */
|
|
35
|
+
flipTo?: Flip;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Props accepted by {@link EventTicker}.
|
|
39
|
+
*/
|
|
40
|
+
interface Props extends Omit<TagProps<"div">, "children" | "title"> {
|
|
41
|
+
/** Accessible name of the feed's list. Required — the library ships no copy. */
|
|
42
|
+
"aria-label": string;
|
|
43
|
+
/** Accessible name of the pause toggle. */
|
|
44
|
+
pauseLabel?: string;
|
|
45
|
+
/** Header line over the feed, drawn beside a live dot. */
|
|
46
|
+
title?: RemixNode;
|
|
47
|
+
/** The events, oldest first; the feed renders them newest first. */
|
|
48
|
+
rows: readonly Row[];
|
|
49
|
+
/** The text of each status chip, such as `{ ok: "Passed", fail: "Failed", … }`. */
|
|
50
|
+
statusLabels: Record<Status, string>;
|
|
51
|
+
/** A note under the feed, such as how often the checks run. */
|
|
52
|
+
footnote?: RemixNode;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Renders the feed as an ordered list on a raised surface inside a {@link MotionLoop}.
|
|
57
|
+
* Each row opens in its turn at the top and pushes the older ones down; a hidden copy of
|
|
58
|
+
* the finished feed holds the surface's height, so the page never shifts while it loops.
|
|
59
|
+
* Without motion every row shows with its final status. Equal row counts share keyframes.
|
|
60
|
+
*
|
|
61
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
62
|
+
* @returns The render function producing the ticker's markup.
|
|
63
|
+
* @example
|
|
64
|
+
* <EventTicker
|
|
65
|
+
* aria-label="Recent checks"
|
|
66
|
+
* title="Checkout flow"
|
|
67
|
+
* rows={[{ time: "09:40", label: "Run passed", status: "ok" }]}
|
|
68
|
+
* statusLabels={{ ok: "Passed", warn: "Slow", fail: "Failed", pending: "Running" }}
|
|
69
|
+
* />
|
|
70
|
+
*/
|
|
71
|
+
export declare function EventTicker(handle: Handle<EventTicker.Props>): () => import("remix/component").RemixElement;
|