@sdxc/ui 2026.11.26 → 2026.11.29
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 +265 -162
- package/dist/app/app-shell.d.ts +85 -50
- package/dist/app/app-shell.js +419 -222
- package/dist/app/auto-refresh.d.ts +68 -51
- package/dist/app/auto-refresh.js +193 -61
- package/dist/app/board.d.ts +40 -17
- package/dist/app/board.js +173 -88
- package/dist/app/chart.d.ts +10 -63
- package/dist/app/chart.js +22 -29
- package/dist/app/code-view.d.ts +12 -11
- package/dist/app/code-view.js +83 -19
- package/dist/app/command-palette.d.ts +61 -33
- package/dist/app/command-palette.js +178 -32
- package/dist/app/contribution-graph.d.ts +30 -14
- package/dist/app/contribution-graph.js +87 -26
- package/dist/app/danger-zone.d.ts +40 -35
- package/dist/app/danger-zone.js +177 -34
- package/dist/app/detail-sheet.d.ts +42 -51
- package/dist/app/detail-sheet.js +156 -37
- package/dist/app/diff.d.ts +6 -5
- package/dist/app/diff.js +9 -6
- package/dist/app/drop-zone.d.ts +3 -13
- package/dist/app/drop-zone.js +2 -2
- package/dist/app/editor-layout.d.ts +69 -47
- package/dist/app/editor-layout.js +256 -115
- package/dist/app/empty.d.ts +16 -12
- package/dist/app/empty.js +45 -19
- package/dist/app/file-trigger.d.ts +5 -13
- package/dist/app/file-trigger.js +3 -4
- package/dist/app/filter-bar.d.ts +182 -120
- package/dist/app/filter-bar.js +509 -161
- package/dist/app/filter-menu.d.ts +51 -33
- package/dist/app/filter-menu.js +105 -40
- package/dist/app/gantt.d.ts +67 -27
- package/dist/app/gantt.js +320 -163
- package/dist/app/grid-list.d.ts +2 -15
- package/dist/app/grid-list.js +3 -3
- package/dist/app/merge-box.d.ts +58 -52
- package/dist/app/merge-box.js +107 -46
- package/dist/app/mixins/optimistic-toggle-sync.d.ts +2 -2
- package/dist/app/mixins/optimistic-toggle-sync.js +3 -2
- package/dist/app/mixins/range-picker-keys.d.ts +1 -1
- package/dist/app/mixins/range-picker-keys.js +1 -1
- package/dist/app/mixins/save-bar-sync.d.ts +1 -1
- package/dist/app/mixins/save-bar-sync.js +3 -2
- package/dist/app/mixins/split-view.d.ts +3 -1
- package/dist/app/mixins/split-view.js +16 -8
- package/dist/app/optimistic-toggle.d.ts +65 -37
- package/dist/app/optimistic-toggle.js +38 -15
- package/dist/app/page-header.d.ts +80 -58
- package/dist/app/page-header.js +329 -154
- package/dist/app/profile-picker.d.ts +31 -24
- package/dist/app/profile-picker.js +134 -58
- package/dist/app/range-picker.d.ts +62 -59
- package/dist/app/range-picker.js +124 -37
- package/dist/app/review-thread.d.ts +69 -66
- package/dist/app/review-thread.js +203 -53
- package/dist/app/save-bar.d.ts +56 -27
- package/dist/app/save-bar.js +66 -14
- package/dist/app/selection-bar.d.ts +64 -66
- package/dist/app/selection-bar.js +157 -56
- package/dist/app/settings-layout.d.ts +65 -52
- package/dist/app/settings-layout.js +198 -71
- package/dist/app/settings-section.d.ts +86 -93
- package/dist/app/settings-section.js +297 -120
- package/dist/app/shortcut-list.d.ts +19 -8
- package/dist/app/shortcut-list.js +50 -9
- package/dist/app/sparkline.d.ts +14 -16
- package/dist/app/sparkline.js +20 -7
- package/dist/app/split-view.d.ts +66 -42
- package/dist/app/split-view.js +235 -128
- package/dist/app/stat-card.d.ts +16 -4
- package/dist/app/stat-card.js +57 -21
- package/dist/app/status-strip.d.ts +24 -25
- package/dist/app/status-strip.js +82 -25
- package/dist/app/tab-bar.d.ts +15 -7
- package/dist/app/tab-bar.js +74 -37
- package/dist/app/table.d.ts +37 -38
- package/dist/app/table.js +101 -45
- package/dist/app/view-options.d.ts +100 -76
- package/dist/app/view-options.js +263 -129
- package/dist/audio/media-tile.d.ts +33 -21
- package/dist/audio/media-tile.js +139 -79
- package/dist/audio/player-bar.d.ts +24 -43
- package/dist/audio/player-bar.js +183 -118
- package/dist/audio/queue-list.d.ts +40 -36
- package/dist/audio/queue-list.js +172 -73
- package/dist/audio/track-list.d.ts +53 -54
- package/dist/audio/track-list.js +127 -35
- package/dist/blog/archive-list.d.ts +158 -0
- package/dist/blog/archive-list.js +353 -0
- package/dist/blog/article-layout.d.ts +81 -0
- package/dist/blog/article-layout.js +211 -0
- package/dist/blog/author-card.d.ts +99 -0
- package/dist/blog/author-card.js +184 -0
- package/dist/blog/blog-masthead.d.ts +55 -0
- package/dist/blog/blog-masthead.js +143 -0
- package/dist/blog/index.d.ts +21 -0
- package/dist/blog/index.js +21 -0
- package/dist/blog/link-host.d.ts +47 -0
- package/dist/blog/link-host.js +61 -0
- package/dist/blog/newsletter-form.d.ts +66 -0
- package/dist/blog/newsletter-form.js +100 -0
- package/dist/blog/post-byline.d.ts +96 -0
- package/dist/blog/post-byline.js +180 -0
- package/dist/blog/post-entry.d.ts +153 -0
- package/dist/blog/post-entry.js +402 -0
- package/dist/blog/post-stream.d.ts +92 -0
- package/dist/blog/post-stream.js +163 -0
- package/dist/blog/series-nav.d.ts +144 -0
- package/dist/blog/series-nav.js +275 -0
- package/dist/blog/tag-cloud.d.ts +103 -0
- package/dist/blog/tag-cloud.js +138 -0
- package/dist/blog/tag-list.d.ts +91 -0
- package/dist/blog/tag-list.js +92 -0
- package/dist/blog/widget.d.ts +68 -0
- package/dist/blog/widget.js +61 -0
- package/dist/chat/activity.d.ts +47 -15
- package/dist/chat/activity.js +124 -46
- package/dist/chat/mention-menu.d.ts +6 -7
- package/dist/chat/mention-menu.js +4 -4
- package/dist/chat/message-group.d.ts +17 -4
- package/dist/chat/message-group.js +29 -6
- package/dist/color/color-field.d.ts +41 -68
- package/dist/color/color-field.js +21 -38
- package/dist/color/color-picker.d.ts +10 -61
- package/dist/color/color-picker.js +7 -15
- package/dist/color/color-swatch-picker.d.ts +0 -11
- package/dist/color/color-swatch-picker.js +2 -3
- package/dist/color/color-wheel.d.ts +3 -13
- package/dist/color/color-wheel.js +1 -2
- package/dist/commerce/cart-drawer.d.ts +41 -24
- package/dist/commerce/cart-drawer.js +129 -58
- package/dist/commerce/cart-line.d.ts +34 -19
- package/dist/commerce/cart-line.js +94 -28
- package/dist/commerce/checkout-layout.d.ts +23 -19
- package/dist/commerce/checkout-layout.js +53 -24
- package/dist/commerce/facet-filters.d.ts +57 -59
- package/dist/commerce/facet-filters.js +219 -129
- package/dist/commerce/item-options-dialog.d.ts +69 -40
- package/dist/commerce/item-options-dialog.js +231 -104
- package/dist/commerce/menu-item-card.d.ts +36 -20
- package/dist/commerce/menu-item-card.js +114 -61
- package/dist/commerce/option-group.d.ts +46 -27
- package/dist/commerce/option-group.js +123 -52
- package/dist/commerce/order-summary.d.ts +41 -26
- package/dist/commerce/order-summary.js +103 -49
- package/dist/commerce/order-tracker.d.ts +32 -16
- package/dist/commerce/order-tracker.js +91 -66
- package/dist/commerce/price.d.ts +41 -25
- package/dist/commerce/price.js +131 -68
- package/dist/commerce/product-card.d.ts +66 -36
- package/dist/commerce/product-card.js +215 -100
- package/dist/commerce/product-gallery.d.ts +72 -38
- package/dist/commerce/product-gallery.js +187 -82
- package/dist/commerce/promo-code.d.ts +73 -37
- package/dist/commerce/promo-code.js +172 -77
- package/dist/commerce/question-list.d.ts +43 -35
- package/dist/commerce/question-list.js +146 -72
- package/dist/commerce/shipping-estimate.d.ts +68 -33
- package/dist/commerce/shipping-estimate.js +149 -25
- package/dist/commerce/sort-select.d.ts +33 -22
- package/dist/commerce/sort-select.js +55 -26
- package/dist/commerce/variant-picker.d.ts +25 -23
- package/dist/commerce/variant-picker.js +103 -29
- package/dist/{docs → components}/anchor-heading.d.ts +1 -1
- package/dist/{docs → components}/anchor-heading.js +1 -1
- package/dist/components/autocomplete.d.ts +19 -21
- package/dist/components/autocomplete.js +57 -21
- package/dist/components/banner.d.ts +48 -37
- package/dist/components/banner.js +69 -27
- package/dist/components/button.d.ts +2 -18
- package/dist/components/button.js +4 -3
- package/dist/components/callout.d.ts +52 -0
- package/dist/components/callout.js +77 -0
- package/dist/components/checkbox.d.ts +3 -12
- package/dist/components/checkbox.js +1 -2
- package/dist/components/code-block.d.ts +110 -0
- package/dist/{docs → components}/code-block.js +92 -23
- package/dist/components/confirm.d.ts +63 -130
- package/dist/components/confirm.js +133 -52
- package/dist/{docs → components}/copy-button.d.ts +1 -1
- package/dist/{docs → components}/copy-button.js +3 -3
- package/dist/components/date-field.d.ts +40 -60
- package/dist/components/date-field.js +23 -36
- package/dist/components/date-picker.d.ts +11 -67
- package/dist/components/date-picker.js +4 -15
- package/dist/components/date-range-picker.d.ts +20 -91
- package/dist/components/date-range-picker.js +13 -27
- package/dist/components/dialog-dismiss.d.ts +1 -1
- package/dist/components/dialog-dismiss.js +1 -1
- package/dist/components/field-parts.d.ts +158 -0
- package/dist/components/field-parts.js +237 -0
- package/dist/components/filter-links.d.ts +107 -0
- package/dist/components/filter-links.js +120 -0
- package/dist/components/form.d.ts +3 -1
- package/dist/components/form.js +3 -1
- package/dist/components/index.d.ts +14 -7
- package/dist/components/index.js +14 -7
- package/dist/components/lightbox.js +12 -6
- package/dist/components/listbox.d.ts +0 -9
- package/dist/components/listbox.js +2 -2
- package/dist/components/media-grid.d.ts +15 -16
- package/dist/components/media-grid.js +75 -34
- package/dist/components/pager.d.ts +103 -0
- package/dist/components/pager.js +187 -0
- package/dist/components/property-list.d.ts +38 -39
- package/dist/components/property-list.js +149 -96
- package/dist/components/radio-group.d.ts +0 -11
- package/dist/components/radio-group.js +5 -6
- package/dist/components/range-calendar.d.ts +2 -14
- package/dist/components/range-calendar.js +2 -2
- package/dist/components/range-months.d.ts +12 -2
- package/dist/components/range-months.js +32 -16
- package/dist/components/rating-input.d.ts +14 -6
- package/dist/components/rating-input.js +26 -12
- package/dist/components/rating.d.ts +13 -8
- package/dist/components/rating.js +19 -5
- package/dist/components/review-card.d.ts +51 -26
- package/dist/components/review-card.js +173 -40
- package/dist/components/search-field.js +18 -8
- package/dist/components/section-bar.d.ts +23 -15
- package/dist/components/section-bar.js +59 -37
- package/dist/components/sidebar.d.ts +27 -0
- package/dist/components/sidebar.js +49 -20
- package/dist/{docs → components}/table-of-contents.d.ts +1 -1
- package/dist/{docs → components}/table-of-contents.js +3 -3
- package/dist/components/text-field.d.ts +54 -81
- package/dist/components/text-field.js +30 -44
- package/dist/components/time-field.d.ts +45 -65
- package/dist/components/time-field.js +23 -35
- package/dist/components/timeline.d.ts +80 -86
- package/dist/components/timeline.js +383 -170
- package/dist/components/typeset.d.ts +5 -0
- package/dist/components/typeset.js +17 -2
- package/dist/docs/code-tabs.d.ts +50 -24
- package/dist/docs/code-tabs.js +91 -25
- package/dist/docs/docs-feedback.d.ts +70 -27
- package/dist/docs/docs-feedback.js +156 -27
- package/dist/docs/docs-footer.d.ts +36 -22
- package/dist/docs/docs-footer.js +76 -23
- package/dist/docs/docs-hub.d.ts +103 -73
- package/dist/docs/docs-hub.js +333 -83
- package/dist/docs/docs-layout.d.ts +111 -42
- package/dist/docs/docs-layout.js +371 -97
- package/dist/docs/docs-nav-tools.d.ts +11 -7
- package/dist/docs/docs-nav-tools.js +4 -3
- package/dist/docs/docs-nav.d.ts +53 -17
- package/dist/docs/docs-nav.js +125 -14
- package/dist/docs/docs-not-found.d.ts +61 -35
- package/dist/docs/docs-not-found.js +198 -52
- package/dist/docs/docs-page-header.d.ts +47 -30
- package/dist/docs/docs-page-header.js +114 -31
- package/dist/docs/docs-pager.d.ts +43 -27
- package/dist/docs/docs-pager.js +73 -23
- package/dist/docs/file-tree.d.ts +16 -6
- package/dist/docs/file-tree.js +19 -4
- package/dist/docs/index.d.ts +0 -7
- package/dist/docs/index.js +0 -7
- package/dist/docs/install-command.d.ts +7 -6
- package/dist/docs/install-command.js +8 -10
- package/dist/docs/mixins/docs-nav-tools.js +1 -1
- package/dist/docs/next-steps.d.ts +56 -23
- package/dist/docs/next-steps.js +121 -35
- package/dist/docs/page-actions.d.ts +68 -46
- package/dist/docs/page-actions.js +129 -21
- package/dist/docs/steps.d.ts +14 -11
- package/dist/docs/steps.js +36 -18
- package/dist/docs/ui-label.d.ts +7 -6
- package/dist/docs/ui-label.js +21 -8
- package/dist/finance/ledger.d.ts +33 -29
- package/dist/finance/ledger.js +190 -43
- package/dist/finance/payment-card.d.ts +43 -31
- package/dist/finance/payment-card.js +170 -67
- package/dist/landing/author-band.d.ts +57 -54
- package/dist/landing/author-band.js +218 -64
- package/dist/landing/case-study.d.ts +57 -57
- package/dist/landing/case-study.js +148 -17
- package/dist/landing/changelog-strip.d.ts +56 -36
- package/dist/landing/changelog-strip.js +176 -68
- package/dist/landing/closing-cta.d.ts +21 -41
- package/dist/landing/closing-cta.js +13 -19
- package/dist/landing/code-stage.d.ts +55 -47
- package/dist/landing/code-stage.js +198 -67
- package/dist/landing/contributor-wall.d.ts +4 -4
- package/dist/landing/contributor-wall.js +4 -4
- package/dist/landing/curriculum.d.ts +74 -45
- package/dist/landing/curriculum.js +220 -62
- package/dist/landing/drawn-chart.d.ts +18 -10
- package/dist/landing/drawn-chart.js +57 -26
- package/dist/landing/episode-player.d.ts +69 -43
- package/dist/landing/episode-player.js +213 -48
- package/dist/landing/event-ticker.d.ts +13 -7
- package/dist/landing/event-ticker.js +67 -32
- package/dist/landing/fan-out-diagram.d.ts +19 -8
- package/dist/landing/fan-out-diagram.js +60 -19
- package/dist/landing/faq-band.d.ts +30 -48
- package/dist/landing/faq-band.js +37 -30
- package/dist/landing/feature-band.d.ts +48 -76
- package/dist/landing/feature-band.js +71 -49
- package/dist/landing/flow-diagram.d.ts +16 -8
- package/dist/landing/flow-diagram.js +50 -18
- package/dist/landing/install-tabs.d.ts +16 -14
- package/dist/landing/install-tabs.js +87 -39
- package/dist/landing/landing-header.d.ts +75 -66
- package/dist/landing/landing-header.js +284 -57
- package/dist/landing/landing-hero.d.ts +59 -87
- package/dist/landing/landing-hero.js +157 -128
- package/dist/landing/landing-section.d.ts +0 -9
- package/dist/landing/landing-section.js +1 -2
- package/dist/landing/logo-cloud.d.ts +26 -9
- package/dist/landing/logo-cloud.js +62 -18
- package/dist/landing/phone-fan.d.ts +15 -7
- package/dist/landing/phone-fan.js +60 -17
- package/dist/landing/price-list.d.ts +29 -22
- package/dist/landing/price-list.js +175 -77
- package/dist/landing/pricing-band.d.ts +46 -53
- package/dist/landing/pricing-band.js +167 -51
- package/dist/landing/product-frame.d.ts +44 -42
- package/dist/landing/product-frame.js +182 -85
- package/dist/landing/proof-strip.d.ts +7 -2
- package/dist/landing/proof-strip.js +7 -2
- package/dist/landing/rails.d.ts +1 -1
- package/dist/landing/rails.js +1 -1
- package/dist/landing/segmented-stage.d.ts +19 -8
- package/dist/landing/segmented-stage.js +60 -16
- package/dist/landing/sequence-diagram.d.ts +18 -8
- package/dist/landing/sequence-diagram.js +49 -18
- package/dist/landing/site-footer.d.ts +89 -68
- package/dist/landing/site-footer.js +344 -111
- package/dist/landing/site-header.d.ts +118 -80
- package/dist/landing/site-header.js +482 -67
- package/dist/landing/sponsor-wall.d.ts +34 -15
- package/dist/landing/sponsor-wall.js +111 -34
- package/dist/landing/stat-strip.d.ts +7 -9
- package/dist/landing/stat-strip.js +57 -22
- package/dist/landing/step-list.d.ts +18 -21
- package/dist/landing/step-list.js +132 -38
- package/dist/landing/tabbed-stage.d.ts +23 -15
- package/dist/landing/tabbed-stage.js +103 -21
- package/dist/landing/testimonial-band.d.ts +58 -61
- package/dist/landing/testimonial-band.js +209 -71
- package/dist/landing/typed-terminal.d.ts +9 -6
- package/dist/landing/typed-terminal.js +16 -5
- package/dist/landing/usage-estimate.d.ts +83 -74
- package/dist/landing/usage-estimate.js +254 -113
- package/dist/landing/utils/has-parts.d.ts +17 -0
- package/dist/landing/utils/has-parts.js +24 -0
- package/dist/map/map-canvas.d.ts +15 -16
- package/dist/map/map-canvas.js +40 -24
- package/dist/map/map.d.ts +42 -33
- package/dist/map/map.js +149 -38
- package/dist/mixins/aria-checked.d.ts +1 -4
- package/dist/mixins/aria-checked.js +1 -4
- package/dist/mixins/clear-field.d.ts +2 -4
- package/dist/mixins/clear-field.js +2 -4
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/schedule/agenda.d.ts +69 -41
- package/dist/schedule/agenda.js +273 -134
- package/dist/schedule/day-strip.d.ts +38 -26
- package/dist/schedule/day-strip.js +119 -88
- package/dist/test/map.d.ts +1 -1
- package/dist/test/map.js +1 -6
- package/dist/test/reels.js +1 -1
- package/dist/test/stories.js +2 -2
- package/dist/travel/boarding-pass.d.ts +94 -70
- package/dist/travel/boarding-pass.js +341 -144
- package/dist/travel/car-offer.d.ts +109 -49
- package/dist/travel/car-offer.js +424 -64
- package/dist/travel/fare-options.d.ts +58 -34
- package/dist/travel/fare-options.js +210 -69
- package/dist/travel/flight-itinerary.d.ts +62 -55
- package/dist/travel/flight-itinerary.js +230 -55
- package/dist/travel/flight-option.d.ts +65 -33
- package/dist/travel/flight-option.js +250 -69
- package/dist/travel/flight-segment.d.ts +121 -70
- package/dist/travel/flight-segment.js +358 -96
- package/dist/travel/package-savings.d.ts +79 -39
- package/dist/travel/package-savings.js +309 -65
- package/dist/travel/price-breakdown.d.ts +30 -22
- package/dist/travel/price-breakdown.js +72 -17
- package/dist/travel/rating-breakdown.d.ts +25 -18
- package/dist/travel/rating-breakdown.js +60 -23
- package/dist/travel/seat-map.d.ts +29 -22
- package/dist/travel/seat-map.js +140 -78
- package/dist/travel/trip-timeline.d.ts +77 -39
- package/dist/travel/trip-timeline.js +316 -107
- package/dist/utils/eyebrow.d.ts +2 -2
- package/dist/utils/eyebrow.js +3 -3
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/video/episode-list.d.ts +22 -14
- package/dist/video/episode-list.js +89 -53
- package/dist/video/reel-feed.d.ts +21 -15
- package/dist/video/reel-feed.js +59 -24
- package/dist/video/story-viewer.d.ts +6 -5
- package/dist/video/story-viewer.js +84 -53
- package/dist/video/title-hero.d.ts +8 -8
- package/dist/video/title-hero.js +48 -34
- package/dist/video/video-card.d.ts +34 -20
- package/dist/video/video-card.js +119 -76
- package/dist/video/video-player.d.ts +17 -14
- package/dist/video/video-player.js +68 -30
- package/dist/video/video-shelf.d.ts +26 -14
- package/dist/video/video-shelf.js +88 -50
- package/package.json +4 -2
- package/dist/docs/callout.d.ts +0 -46
- package/dist/docs/callout.js +0 -61
- package/dist/docs/code-block.d.ts +0 -74
- package/dist/utils/field-parts.d.ts +0 -26
- package/dist/utils/field-parts.js +0 -12
- /package/dist/{docs/mixins → mixins}/copy-feedback.d.ts +0 -0
- /package/dist/{docs/mixins → mixins}/copy-feedback.js +0 -0
- /package/dist/{docs/mixins → mixins}/toc-spy.d.ts +0 -0
- /package/dist/{docs/mixins → mixins}/toc-spy.js +0 -0
- /package/dist/{docs/utils → utils}/reveal-in-scroller.d.ts +0 -0
- /package/dist/{docs/utils → utils}/reveal-in-scroller.js +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
|
+
import { fg, outline } from "@sdxc/u/color";
|
|
3
|
+
import { rounded } from "@sdxc/u/effects";
|
|
4
|
+
import { mergeMix, raw, vars } from "@sdxc/u/general";
|
|
5
|
+
import { container, flex, flexCol, grid, items } from "@sdxc/u/layout";
|
|
6
|
+
import { at } from "@sdxc/u/responsive";
|
|
7
|
+
import { m, minIs, p } from "@sdxc/u/size";
|
|
8
|
+
import { focusVisible, hover, when } from "@sdxc/u/state";
|
|
9
|
+
import { balance, leading, pretty, tabularNums, text, textDecoration, tracking, } from "@sdxc/u/typography";
|
|
10
|
+
import { resolveHeadingLevel, TAG_BY_LEVEL } from "../components/heading-scope.js";
|
|
11
|
+
/**
|
|
12
|
+
* Container a `margin` or `row` entry names, so its layout follows the column it sits in, not
|
|
13
|
+
* the page. A `stack` entry names none and sizes from its content inside a shrink-to-fit parent.
|
|
14
|
+
*/
|
|
15
|
+
const CONTAINER_NAME = "ui-post-entry";
|
|
16
|
+
/** Entry width from which `margin` moves the kind into its column and `row` fits one line. */
|
|
17
|
+
const WIDE_WIDTH = "36rem";
|
|
18
|
+
/** The wide `row` layout's date column, set before the kind's gutter. */
|
|
19
|
+
const DATE_COLUMN = "var(--ui-post-entry-date-width, 6.5rem)";
|
|
20
|
+
/** How {@link PostEntry.Date} writes its day when the caller passes no `format`. */
|
|
21
|
+
const DEFAULT_DATE_FORMAT = { dateStyle: "medium" };
|
|
22
|
+
/**
|
|
23
|
+
* Selects an entry's kind among the grid's children, by the part marker the kit owns, so a
|
|
24
|
+
* caller's own `data-slot` on a part leaves the layout intact.
|
|
25
|
+
*/
|
|
26
|
+
const KIND = "[data-post-entry-part='kind']";
|
|
27
|
+
/** Selects an entry's date among the grid's children. */
|
|
28
|
+
const DATE = "[data-post-entry-part='date']";
|
|
29
|
+
/** Selects an entry's title among the grid's children. */
|
|
30
|
+
const TITLE = "[data-post-entry-part='title']";
|
|
31
|
+
/**
|
|
32
|
+
* Selects a date written after the title, which a narrow `row` entry moves to the meta line;
|
|
33
|
+
* a date written before the title stays in the gutter under the kind.
|
|
34
|
+
*/
|
|
35
|
+
const DATE_IN_META = `${TITLE} ~ ${DATE}`;
|
|
36
|
+
/**
|
|
37
|
+
* Selects a narrow `row`'s grid whose date moves to the meta line: a third column splits the
|
|
38
|
+
* text column so the date, placed after every part but the meta, shares the meta's last line,
|
|
39
|
+
* with a middot between them standing in for the column gap.
|
|
40
|
+
*/
|
|
41
|
+
const HAS_DATE_IN_META = `&:has(> ${DATE_IN_META})`;
|
|
42
|
+
/** Selects an entry's meta row among the grid's children. */
|
|
43
|
+
const META = "[data-post-entry-part='meta']";
|
|
44
|
+
/**
|
|
45
|
+
* The parts' grid inside the entry, laid out per layout: a flex column for `stack` and on a
|
|
46
|
+
* narrow `margin`; from {@link WIDE_WIDTH} a gutter column for the kind beside everything else,
|
|
47
|
+
* or kind, title and meta across one line for `row`.
|
|
48
|
+
*/
|
|
49
|
+
function partsLayout() {
|
|
50
|
+
return [
|
|
51
|
+
flex(),
|
|
52
|
+
flexCol(),
|
|
53
|
+
raw({ gap: "var(--ui-post-entry-gap, 0.5rem)" }),
|
|
54
|
+
when("&[data-layout='row']", [
|
|
55
|
+
grid(),
|
|
56
|
+
raw({
|
|
57
|
+
gridTemplateColumns: "var(--ui-post-entry-gutter) minmax(0, 1fr)",
|
|
58
|
+
columnGap: "1rem",
|
|
59
|
+
rowGap: "var(--ui-post-entry-gap, 0.25rem)",
|
|
60
|
+
alignItems: "baseline",
|
|
61
|
+
[`& > :not(${KIND})`]: { gridColumn: "2" },
|
|
62
|
+
[`& > ${KIND}`]: { gridColumn: "1", gridRow: "1" },
|
|
63
|
+
[`& > ${DATE}`]: { gridColumn: "1", gridRow: "1" },
|
|
64
|
+
[`&:has(> ${KIND}) > ${DATE}`]: { gridRow: "2" },
|
|
65
|
+
[`&:not(:has(> ${KIND}))`]: { gridTemplateColumns: "minmax(0, 1fr)" },
|
|
66
|
+
[`&:not(:has(> ${KIND})) > *`]: { gridColumn: "1" },
|
|
67
|
+
[`&:has(> ${DATE}):not(:has(> ${KIND}))`]: {
|
|
68
|
+
gridTemplateColumns: "var(--ui-post-entry-gutter) minmax(0, 1fr)",
|
|
69
|
+
},
|
|
70
|
+
[`&:has(> ${DATE}):not(:has(> ${KIND})) > :not(${DATE})`]: { gridColumn: "2" },
|
|
71
|
+
[`@container ${CONTAINER_NAME} (width < ${WIDE_WIDTH})`]: {
|
|
72
|
+
[HAS_DATE_IN_META]: {
|
|
73
|
+
gridTemplateColumns: "var(--ui-post-entry-gutter) auto minmax(0, 1fr)",
|
|
74
|
+
},
|
|
75
|
+
[`${HAS_DATE_IN_META} > :not(${KIND})`]: { gridColumn: "2 / -1" },
|
|
76
|
+
[`${HAS_DATE_IN_META} > ${DATE_IN_META}`]: {
|
|
77
|
+
gridColumn: "2",
|
|
78
|
+
gridRow: "auto",
|
|
79
|
+
order: 1,
|
|
80
|
+
paddingBlockStart: "0",
|
|
81
|
+
},
|
|
82
|
+
[`${HAS_DATE_IN_META} > ${META}`]: { gridColumn: "3", order: 2 },
|
|
83
|
+
[`${HAS_DATE_IN_META}:has(> ${META}) > ${DATE_IN_META}`]: {
|
|
84
|
+
marginInlineEnd: "calc(0.5em - 1rem)",
|
|
85
|
+
},
|
|
86
|
+
[`${HAS_DATE_IN_META}:has(> ${META}) > ${DATE_IN_META}::after`]: {
|
|
87
|
+
content: '"·"',
|
|
88
|
+
marginInlineStart: "0.5em",
|
|
89
|
+
color: "var(--ui-post-entry-meta-fg, var(--ui-neutral-fg-muted))",
|
|
90
|
+
},
|
|
91
|
+
[`${HAS_DATE_IN_META}:not(:has(> ${KIND}))`]: {
|
|
92
|
+
gridTemplateColumns: "auto minmax(0, 1fr)",
|
|
93
|
+
},
|
|
94
|
+
[`${HAS_DATE_IN_META}:not(:has(> ${KIND})) > *`]: { gridColumn: "1 / -1" },
|
|
95
|
+
[`${HAS_DATE_IN_META}:not(:has(> ${KIND})) > ${DATE_IN_META}`]: { gridColumn: "1" },
|
|
96
|
+
[`${HAS_DATE_IN_META}:not(:has(> ${KIND})) > ${META}`]: { gridColumn: "2" },
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
99
|
+
at(WIDE_WIDTH, CONTAINER_NAME, [
|
|
100
|
+
raw({
|
|
101
|
+
gridTemplateColumns: "var(--ui-post-entry-gutter) minmax(0, 1fr) auto",
|
|
102
|
+
[`& > ${KIND}`]: { gridRow: "1" },
|
|
103
|
+
[`& > ${TITLE}`]: { gridColumn: "2", gridRow: "1" },
|
|
104
|
+
[`& > ${META}`]: { gridColumn: "3", gridRow: "1", justifySelf: "end" },
|
|
105
|
+
[`& > :not(${KIND}, ${TITLE}, ${META})`]: { gridColumn: "2 / -1" },
|
|
106
|
+
[`&:not(:has(> ${KIND}))`]: { gridTemplateColumns: "minmax(0, 1fr) auto" },
|
|
107
|
+
[`&:not(:has(> ${KIND})) > ${TITLE}`]: { gridColumn: "1" },
|
|
108
|
+
[`&:not(:has(> ${KIND})) > ${META}`]: { gridColumn: "2" },
|
|
109
|
+
[`&:not(:has(> ${KIND})) > :not(${TITLE}, ${META})`]: { gridColumn: "1 / -1" },
|
|
110
|
+
[`&:has(> ${DATE})`]: {
|
|
111
|
+
gridTemplateColumns: `${DATE_COLUMN} var(--ui-post-entry-gutter) minmax(0, 1fr) auto`,
|
|
112
|
+
},
|
|
113
|
+
[`&:has(> ${DATE}) > ${DATE}`]: { gridColumn: "1", gridRow: "1" },
|
|
114
|
+
[`&:has(> ${DATE}) > ${KIND}`]: { gridColumn: "2" },
|
|
115
|
+
[`&:has(> ${DATE}) > ${TITLE}`]: { gridColumn: "3" },
|
|
116
|
+
[`&:has(> ${DATE}) > ${META}`]: { gridColumn: "4" },
|
|
117
|
+
[`&:has(> ${DATE}) > :not(${DATE}, ${KIND}, ${TITLE}, ${META})`]: {
|
|
118
|
+
gridColumn: "3 / -1",
|
|
119
|
+
},
|
|
120
|
+
[`&:has(> ${DATE}):not(:has(> ${KIND}))`]: {
|
|
121
|
+
gridTemplateColumns: `${DATE_COLUMN} minmax(0, 1fr) auto`,
|
|
122
|
+
},
|
|
123
|
+
[`&:has(> ${DATE}):not(:has(> ${KIND})) > ${TITLE}`]: { gridColumn: "2" },
|
|
124
|
+
[`&:has(> ${DATE}):not(:has(> ${KIND})) > ${META}`]: { gridColumn: "3" },
|
|
125
|
+
[`&:has(> ${DATE}):not(:has(> ${KIND})) > :not(${DATE}, ${TITLE}, ${META})`]: {
|
|
126
|
+
gridColumn: "2 / -1",
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
129
|
+
]),
|
|
130
|
+
]),
|
|
131
|
+
when("&[data-layout='margin']", at(WIDE_WIDTH, CONTAINER_NAME, [
|
|
132
|
+
grid(),
|
|
133
|
+
raw({
|
|
134
|
+
gridTemplateColumns: "var(--ui-post-entry-gutter) minmax(0, 1fr)",
|
|
135
|
+
columnGap: "1.5rem",
|
|
136
|
+
rowGap: "var(--ui-post-entry-gap, 0.5rem)",
|
|
137
|
+
alignContent: "start",
|
|
138
|
+
[`& > :not(${KIND})`]: { gridColumn: "2" },
|
|
139
|
+
[`& > ${KIND}`]: { gridColumn: "1", gridRow: "1", paddingBlockStart: "0.3em" },
|
|
140
|
+
[`& > ${DATE}`]: { gridColumn: "1", gridRow: "1", paddingBlockStart: "0.3em" },
|
|
141
|
+
[`&:has(> ${KIND}) > ${DATE}`]: { gridRow: "2", paddingBlockStart: "0" },
|
|
142
|
+
}),
|
|
143
|
+
])),
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Renders the entry as an `<article>`; a `margin` or `row` entry is its own size container, so
|
|
148
|
+
* its layout answers to the column the list gives it, and a `stack` entry sizes from its content.
|
|
149
|
+
* Restyle its parts by setting {@link PostEntry.CustomProperties} on the entry.
|
|
150
|
+
*
|
|
151
|
+
* @param handle Runtime handle carrying the host `<article>`'s props.
|
|
152
|
+
* @returns The render function producing the entry.
|
|
153
|
+
* @example
|
|
154
|
+
* <PostEntry layout="margin">
|
|
155
|
+
* <PostEntry.Kind>Note</PostEntry.Kind>
|
|
156
|
+
* <PostEntry.Title>
|
|
157
|
+
* <PostEntry.TitleLink href="/notes/cache-keys">Cache keys are an API</PostEntry.TitleLink>
|
|
158
|
+
* </PostEntry.Title>
|
|
159
|
+
* <PostEntry.Lead>Why a key's shape outlives the code that wrote it.</PostEntry.Lead>
|
|
160
|
+
* <PostEntry.Meta>
|
|
161
|
+
* <time datetime="2026-11-12">Nov 12</time>
|
|
162
|
+
* <span>4 min read</span>
|
|
163
|
+
* </PostEntry.Meta>
|
|
164
|
+
* </PostEntry>
|
|
165
|
+
* @example
|
|
166
|
+
* <PostEntry featured>
|
|
167
|
+
* <PostEntry.Title>The slow web</PostEntry.Title>
|
|
168
|
+
* </PostEntry>
|
|
169
|
+
*/
|
|
170
|
+
export function PostEntry(handle) {
|
|
171
|
+
return () => {
|
|
172
|
+
let { children, featured = false, layout = "stack", mix, ...rest } = handle.props;
|
|
173
|
+
return (_jsx("article", { "data-slot": "post-entry", ...rest, "data-layout": layout, "data-featured": featured ? "" : undefined, mix: mergeMix([
|
|
174
|
+
...(layout === "stack" ? [] : [container(CONTAINER_NAME)]),
|
|
175
|
+
minIs(0),
|
|
176
|
+
vars({
|
|
177
|
+
"ui-post-entry-gutter": layout === "row" ? "4.5rem" : "6.5rem",
|
|
178
|
+
"ui-post-entry-title-size": layout === "row" ? "1.0625rem" : "1.375rem",
|
|
179
|
+
}),
|
|
180
|
+
when("&[data-featured]", [
|
|
181
|
+
vars({ "ui-post-entry-title-size": "clamp(1.625rem, 1.3rem + 1.4vw, 2.125rem)" }),
|
|
182
|
+
p(6),
|
|
183
|
+
rounded("lg"),
|
|
184
|
+
raw({
|
|
185
|
+
backgroundColor: "var(--ui-post-entry-featured-bg, var(--ui-brand-bg-tint))",
|
|
186
|
+
border: "1px solid var(--ui-post-entry-featured-border-color, var(--ui-brand-border))",
|
|
187
|
+
borderInlineStart: "var(--ui-post-entry-featured-edge-width, 4px) solid var(--ui-post-entry-featured-edge-color, var(--ui-brand-bg-solid))",
|
|
188
|
+
}),
|
|
189
|
+
]),
|
|
190
|
+
], mix), children: _jsx("div", { "data-slot": "post-entry-parts", "data-layout": layout, mix: partsLayout(), children: children }) }));
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The post's kind as a small upper-case label. In the `margin` layout it fills the gutter
|
|
195
|
+
* column; in `row` it fills the fixed first column, so kinds align down the list. Wrap its
|
|
196
|
+
* text in {@link PostEntry.KindLink} to link the list narrowed to that kind.
|
|
197
|
+
*
|
|
198
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
199
|
+
* @returns The render function producing the label.
|
|
200
|
+
* @example <PostEntry.Kind>Note</PostEntry.Kind>
|
|
201
|
+
*/
|
|
202
|
+
PostEntry.Kind = function PostEntryKind(handle) {
|
|
203
|
+
return () => {
|
|
204
|
+
let { mix, ...rest } = handle.props;
|
|
205
|
+
return (_jsx("p", { "data-slot": "post-entry-kind", ...rest, "data-post-entry-part": "kind", mix: mergeMix([
|
|
206
|
+
m(0),
|
|
207
|
+
text("xs"),
|
|
208
|
+
leading("snug"),
|
|
209
|
+
raw({
|
|
210
|
+
fontFamily: "var(--ui-post-entry-kind-font-family, inherit)",
|
|
211
|
+
fontSize: "var(--ui-post-entry-kind-font-size, var(--ui-text-xs, 0.75rem))",
|
|
212
|
+
fontWeight: "var(--ui-post-entry-kind-font-weight, 600)",
|
|
213
|
+
letterSpacing: "var(--ui-post-entry-kind-letter-spacing, var(--ui-tracking-wider, 0.05em))",
|
|
214
|
+
textTransform: "var(--ui-post-entry-kind-text-transform, uppercase)",
|
|
215
|
+
color: "var(--ui-post-entry-kind-fg, var(--ui-brand-fg))",
|
|
216
|
+
}),
|
|
217
|
+
], mix) }));
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* The kind's link, in the kind's colour and underlined under the pointer, so the label reads
|
|
222
|
+
* as type until a reader reaches for it.
|
|
223
|
+
*
|
|
224
|
+
* @param handle Runtime handle carrying the host `<a>`'s props.
|
|
225
|
+
* @returns The render function producing the link.
|
|
226
|
+
* @example
|
|
227
|
+
* <PostEntry.Kind>
|
|
228
|
+
* <PostEntry.KindLink href="/?type=links">Link</PostEntry.KindLink>
|
|
229
|
+
* </PostEntry.Kind>
|
|
230
|
+
*/
|
|
231
|
+
PostEntry.KindLink = function PostEntryKindLink(handle) {
|
|
232
|
+
return () => {
|
|
233
|
+
let { mix, ...rest } = handle.props;
|
|
234
|
+
return (_jsx("a", { "data-slot": "post-entry-kind-link", ...rest, mix: mergeMix([
|
|
235
|
+
fg("inherit"),
|
|
236
|
+
textDecoration("none"),
|
|
237
|
+
rounded("sm"),
|
|
238
|
+
hover(textDecoration("underline")),
|
|
239
|
+
focusVisible(outline({ color: "brand.ring", offset: 2 })),
|
|
240
|
+
], mix) }));
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* The post's title in the heading element matching the nearest ambient heading level, `<h1>`
|
|
245
|
+
* where nothing supplies one; the size follows the entry's layout and featured state. Its
|
|
246
|
+
* children are the title's text or a {@link PostEntry.TitleLink}, plus anything set beside it,
|
|
247
|
+
* such as a `LinkHost` chip.
|
|
248
|
+
*
|
|
249
|
+
* @param handle Runtime handle carrying the host heading element's props.
|
|
250
|
+
* @returns The render function producing the heading.
|
|
251
|
+
* @example <PostEntry.Title>A short note</PostEntry.Title>
|
|
252
|
+
* @example
|
|
253
|
+
* <PostEntry.Title>
|
|
254
|
+
* <PostEntry.TitleLink href={url} rel="noreferrer">An RFC worth reading</PostEntry.TitleLink>{" "}
|
|
255
|
+
* <LinkHost href={url} variant="chip" />
|
|
256
|
+
* </PostEntry.Title>
|
|
257
|
+
*/
|
|
258
|
+
PostEntry.Title = function PostEntryTitle(handle) {
|
|
259
|
+
return () => {
|
|
260
|
+
let { mix, ...rest } = handle.props;
|
|
261
|
+
let level = resolveHeadingLevel(handle);
|
|
262
|
+
let Tag = TAG_BY_LEVEL[level];
|
|
263
|
+
return (_jsx(Tag, { "data-slot": "post-entry-title", ...rest, "data-post-entry-part": "title", "data-heading-level": level, mix: mergeMix([
|
|
264
|
+
m(0),
|
|
265
|
+
raw({
|
|
266
|
+
fontFamily: "var(--ui-post-entry-title-font-family, inherit)",
|
|
267
|
+
fontSize: "var(--ui-post-entry-title-size)",
|
|
268
|
+
fontWeight: "var(--ui-post-entry-title-font-weight, 600)",
|
|
269
|
+
}),
|
|
270
|
+
leading("tight"),
|
|
271
|
+
tracking("tight"),
|
|
272
|
+
balance(),
|
|
273
|
+
raw({ color: "var(--ui-post-entry-title-fg, var(--ui-neutral-fg-emphasis))" }),
|
|
274
|
+
], mix) }));
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* The title's link, reading as type until hovered, when it underlines in the brand colour.
|
|
279
|
+
* Every native attribute lands on the `<a>`, so a list row marks the open post with
|
|
280
|
+
* `aria-current` and a bookmark sets its own `rel`.
|
|
281
|
+
*
|
|
282
|
+
* @param handle Runtime handle carrying the host `<a>`'s props.
|
|
283
|
+
* @returns The render function producing the link.
|
|
284
|
+
* @example
|
|
285
|
+
* <PostEntry.Title>
|
|
286
|
+
* <PostEntry.TitleLink href="/notes/a" aria-current="page">A</PostEntry.TitleLink>
|
|
287
|
+
* </PostEntry.Title>
|
|
288
|
+
*/
|
|
289
|
+
PostEntry.TitleLink = function PostEntryTitleLink(handle) {
|
|
290
|
+
return () => {
|
|
291
|
+
let { mix, ...rest } = handle.props;
|
|
292
|
+
return (_jsx("a", { "data-slot": "post-entry-title-link", ...rest, mix: mergeMix([
|
|
293
|
+
fg("inherit"),
|
|
294
|
+
textDecoration("none"),
|
|
295
|
+
rounded("sm"),
|
|
296
|
+
hover([
|
|
297
|
+
textDecoration("underline"),
|
|
298
|
+
raw({
|
|
299
|
+
color: "var(--ui-post-entry-title-hover-fg, var(--ui-brand-fg))",
|
|
300
|
+
textDecorationColor: "var(--ui-post-entry-title-hover-decoration-color, currentColor)",
|
|
301
|
+
}),
|
|
302
|
+
]),
|
|
303
|
+
focusVisible(outline({ color: "brand.ring", offset: 2 })),
|
|
304
|
+
], mix) }));
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* The day the post went out as a `<time>`, in `locale` and UTC. A wide `row` gives it a column
|
|
309
|
+
* before the kind wherever it is written. A narrow `row` sets a date written before the title
|
|
310
|
+
* under the kind, and one written after the title at the start of the meta line, led into it by
|
|
311
|
+
* a middot. In `margin` it sits in the gutter under the kind.
|
|
312
|
+
*
|
|
313
|
+
* @param handle Runtime handle carrying the host `<time>`'s props.
|
|
314
|
+
* @returns The render function producing the date.
|
|
315
|
+
* @example <PostEntry.Date date="2026-11-12" />
|
|
316
|
+
* @example <PostEntry.Date date="2026-11-12" format={{ month: "short", day: "numeric" }} />
|
|
317
|
+
*/
|
|
318
|
+
PostEntry.Date = function PostEntryDate(handle) {
|
|
319
|
+
return () => {
|
|
320
|
+
let { children, date, format = DEFAULT_DATE_FORMAT, locale = "en-US", mix, ...rest } = handle.props;
|
|
321
|
+
return (_jsx("time", { "data-slot": "post-entry-date", ...rest, "data-post-entry-part": "date", datetime: date, mix: mergeMix([
|
|
322
|
+
m(0),
|
|
323
|
+
text("sm"),
|
|
324
|
+
leading("snug"),
|
|
325
|
+
tabularNums(),
|
|
326
|
+
raw({
|
|
327
|
+
fontFamily: "var(--ui-post-entry-date-font-family, inherit)",
|
|
328
|
+
fontSize: "var(--ui-post-entry-date-font-size, var(--ui-text-sm, 0.875rem))",
|
|
329
|
+
color: "var(--ui-post-entry-date-fg, var(--ui-neutral-fg-muted))",
|
|
330
|
+
}),
|
|
331
|
+
], mix), children: children ??
|
|
332
|
+
new Intl.DateTimeFormat(locale, { ...format, timeZone: "UTC" }).format(new Date(`${date}T00:00:00Z`)) }));
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* The post's summary, a paragraph in the body colour that a reader picks the post by.
|
|
337
|
+
*
|
|
338
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
339
|
+
* @returns The render function producing the paragraph.
|
|
340
|
+
* @example <PostEntry.Lead>Why a key's shape outlives the code that wrote it.</PostEntry.Lead>
|
|
341
|
+
*/
|
|
342
|
+
PostEntry.Lead = function PostEntryLead(handle) {
|
|
343
|
+
return () => {
|
|
344
|
+
let { mix, ...rest } = handle.props;
|
|
345
|
+
return (_jsx("p", { "data-slot": "post-entry-lead", ...rest, "data-post-entry-part": "lead", mix: mergeMix([
|
|
346
|
+
m(0),
|
|
347
|
+
raw({ color: "var(--ui-post-entry-lead-fg, var(--ui-neutral-fg))" }),
|
|
348
|
+
leading("relaxed"),
|
|
349
|
+
pretty(),
|
|
350
|
+
], mix) }));
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* The post shown in full where it is listed, such as a short note; it holds any rendered
|
|
355
|
+
* content, a `Typeset` included, at the entry's measure.
|
|
356
|
+
*
|
|
357
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
358
|
+
* @returns The render function producing the body.
|
|
359
|
+
* @example <PostEntry.Body><Typeset preset="docs">{note}</Typeset></PostEntry.Body>
|
|
360
|
+
*/
|
|
361
|
+
PostEntry.Body = function PostEntryBody(handle) {
|
|
362
|
+
return () => {
|
|
363
|
+
let { mix, ...rest } = handle.props;
|
|
364
|
+
return (_jsx("div", { "data-slot": "post-entry-body", ...rest, "data-post-entry-part": "body", mix: mergeMix([minIs(0), fg("neutral")], mix) }));
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* The facts under a post (date, reading time, host, tags) as one wrapping row, each child
|
|
369
|
+
* element an item and every item after the first led by a middot. In the `row` layout it
|
|
370
|
+
* takes the line's last column, aligned to the end.
|
|
371
|
+
*
|
|
372
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
373
|
+
* @returns The render function producing the row.
|
|
374
|
+
* @example
|
|
375
|
+
* <PostEntry.Meta>
|
|
376
|
+
* <time datetime="2026-11-12">Nov 12, 2026</time>
|
|
377
|
+
* <span>8 min read</span>
|
|
378
|
+
* <TagList>…</TagList>
|
|
379
|
+
* </PostEntry.Meta>
|
|
380
|
+
*/
|
|
381
|
+
PostEntry.Meta = function PostEntryMeta(handle) {
|
|
382
|
+
return () => {
|
|
383
|
+
let { mix, ...rest } = handle.props;
|
|
384
|
+
return (_jsx("div", { "data-slot": "post-entry-meta", ...rest, "data-post-entry-part": "meta", mix: mergeMix([
|
|
385
|
+
flex(),
|
|
386
|
+
items("baseline"),
|
|
387
|
+
raw({ flexWrap: "wrap", columnGap: "0.5em", rowGap: "0.25em" }),
|
|
388
|
+
text("sm"),
|
|
389
|
+
leading("snug"),
|
|
390
|
+
raw({
|
|
391
|
+
fontFamily: "var(--ui-post-entry-meta-font-family, inherit)",
|
|
392
|
+
fontSize: "var(--ui-post-entry-meta-font-size, var(--ui-text-sm, 0.875rem))",
|
|
393
|
+
color: "var(--ui-post-entry-meta-fg, var(--ui-neutral-fg-muted))",
|
|
394
|
+
}),
|
|
395
|
+
when("& > * + *::before", raw({
|
|
396
|
+
content: '"·"',
|
|
397
|
+
marginInlineEnd: "0.5em",
|
|
398
|
+
color: "var(--ui-post-entry-meta-fg, var(--ui-neutral-fg-muted))",
|
|
399
|
+
})),
|
|
400
|
+
], mix) }));
|
|
401
|
+
};
|
|
402
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A list of posts ruled into sections, such as months or years, whose headings stick to the
|
|
3
|
+
* top of the viewport while their section scrolls past, so a reader deep in a long stream
|
|
4
|
+
* always sees which stretch of time they are in. Entries are divided by hairlines.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps } from "remix/component";
|
|
10
|
+
import type { HeadingLevel } from "../components/heading-scope.js";
|
|
11
|
+
/**
|
|
12
|
+
* Prop types for {@link PostStream} and its compound parts.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace PostStream {
|
|
15
|
+
/**
|
|
16
|
+
* The custom properties the stream and its sections read, set on the stream (or one
|
|
17
|
+
* section) through `mix` or `style`; each falls back to the default look.
|
|
18
|
+
*/
|
|
19
|
+
interface CustomProperties {
|
|
20
|
+
/** Space between entries, with the hairline drawn halfway; 2.5rem, or 1.5rem between rows. */
|
|
21
|
+
"--ui-post-stream-gap"?: string;
|
|
22
|
+
/** How far below the viewport's top a section heading sticks. */
|
|
23
|
+
"--ui-post-stream-offset"?: string;
|
|
24
|
+
/** Space between sections. */
|
|
25
|
+
"--ui-post-stream-section-gap"?: string;
|
|
26
|
+
/** Space between a section's heading and its first entry. */
|
|
27
|
+
"--ui-post-stream-entries-padding"?: string;
|
|
28
|
+
/** The hairline's colour. */
|
|
29
|
+
"--ui-post-stream-rule-color"?: string;
|
|
30
|
+
/** The hairline's style, such as `dashed`. */
|
|
31
|
+
"--ui-post-stream-rule-style"?: string;
|
|
32
|
+
/** The hairline's width; `0` drops it. */
|
|
33
|
+
"--ui-post-stream-rule-width"?: string;
|
|
34
|
+
/** A section heading's typeface. */
|
|
35
|
+
"--ui-post-stream-heading-font-family"?: string;
|
|
36
|
+
/** A section heading's size. */
|
|
37
|
+
"--ui-post-stream-heading-font-size"?: string;
|
|
38
|
+
/** A section heading's weight. */
|
|
39
|
+
"--ui-post-stream-heading-font-weight"?: string;
|
|
40
|
+
/** A section heading's letter spacing. */
|
|
41
|
+
"--ui-post-stream-heading-letter-spacing"?: string;
|
|
42
|
+
/** A section heading's text transform; `uppercase` by default. */
|
|
43
|
+
"--ui-post-stream-heading-text-transform"?: string;
|
|
44
|
+
/** A section heading's text colour. */
|
|
45
|
+
"--ui-post-stream-heading-fg"?: string;
|
|
46
|
+
/** A section heading's surface, which entries scroll under. */
|
|
47
|
+
"--ui-post-stream-heading-bg"?: string;
|
|
48
|
+
/** The colour of the rule under a section heading. */
|
|
49
|
+
"--ui-post-stream-heading-border-color"?: string;
|
|
50
|
+
}
|
|
51
|
+
/** Every native `<div>` attribute; children are entries or sections. */
|
|
52
|
+
interface Props extends TagProps<"div"> {
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Every native `<section>` attribute; its `id` is the target a jump link scrolls to, kept
|
|
56
|
+
* clear of a sticky bar by `--ui-post-stream-offset`.
|
|
57
|
+
*/
|
|
58
|
+
interface SectionProps extends TagProps<"section"> {
|
|
59
|
+
}
|
|
60
|
+
/** What a section shares with its heading. */
|
|
61
|
+
interface SectionContext {
|
|
62
|
+
/** The heading's `id`, which names the section. */
|
|
63
|
+
headingId: string;
|
|
64
|
+
/** The section's own heading level, one above its entries' titles. */
|
|
65
|
+
level: HeadingLevel;
|
|
66
|
+
}
|
|
67
|
+
/** Every native heading attribute; its children are the section's label. */
|
|
68
|
+
interface HeadingProps extends TagProps<"h2"> {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Renders the stream as a column. Entries placed directly inside are divided by hairlines;
|
|
73
|
+
* {@link PostStream.Section} children group them under headings instead. Headings stick
|
|
74
|
+
* under `--ui-post-stream-offset`, which a page with a sticky bar sets to its height; the
|
|
75
|
+
* rest of {@link PostStream.CustomProperties} restyle headings and hairlines.
|
|
76
|
+
*
|
|
77
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
78
|
+
* @returns The render function producing the stream.
|
|
79
|
+
* @example
|
|
80
|
+
* <PostStream>
|
|
81
|
+
* <PostStream.Section id="2026-11">
|
|
82
|
+
* <PostStream.Heading>November 2026</PostStream.Heading>
|
|
83
|
+
* <PostEntry>…</PostEntry>
|
|
84
|
+
* </PostStream.Section>
|
|
85
|
+
* </PostStream>
|
|
86
|
+
* @example <PostStream>{posts.map((post) => <PostEntry>…</PostEntry>)}</PostStream>
|
|
87
|
+
*/
|
|
88
|
+
export declare function PostStream(handle: Handle<PostStream.Props>): () => import("remix/component").RemixElement;
|
|
89
|
+
export declare namespace PostStream {
|
|
90
|
+
var Section: (handle: Handle<PostStream.SectionProps, PostStream.SectionContext>) => () => import("remix/component").RemixElement;
|
|
91
|
+
var Heading: (handle: Handle<PostStream.HeadingProps>) => () => import("remix/component").RemixElement;
|
|
92
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
3
|
+
import { flex, flexCol, sticky } from "@sdxc/u/layout";
|
|
4
|
+
import { m } from "@sdxc/u/size";
|
|
5
|
+
import { text } from "@sdxc/u/typography";
|
|
6
|
+
import { HeadingScope, resolveHeadingLevel, TAG_BY_LEVEL } from "../components/heading-scope.js";
|
|
7
|
+
/**
|
|
8
|
+
* Selects a section among the stream's children, which the entry rules leave alone, by a
|
|
9
|
+
* marker the kit owns, so a caller's own `data-slot` on a section keeps the layout.
|
|
10
|
+
*/
|
|
11
|
+
const SECTION = "[data-post-stream-part='section']";
|
|
12
|
+
/** Selects a section heading, which the entry rules leave alone, by the kit's own marker. */
|
|
13
|
+
const HEADING = "[data-post-stream-part='heading']";
|
|
14
|
+
/** Selects the heading scope a section sets its entries in, one level below its heading. */
|
|
15
|
+
const SCOPE = "[data-post-stream-part='scope']";
|
|
16
|
+
/** Selects a section's parts: the children of its heading scope, laid out as its own. */
|
|
17
|
+
const IN_SECTION = `& > ${SCOPE} >`;
|
|
18
|
+
/** Selects a section whose entries include a dense `row` entry, which sets them closer. */
|
|
19
|
+
const ROWS = `&:has(${IN_SECTION} [data-layout='row'])`;
|
|
20
|
+
/** The hairline between two entries, built from the stream's rule properties. */
|
|
21
|
+
const RULE = "var(--ui-post-stream-rule-width, 1px) var(--ui-post-stream-rule-style, solid) var(--ui-post-stream-rule-color, var(--ui-neutral-border))";
|
|
22
|
+
/** Selects an entry: any part of a stream or section but a section or its heading. */
|
|
23
|
+
const ENTRY = `:not(${SECTION}, ${HEADING})`;
|
|
24
|
+
/** Selects an entry that draws a hairline above it: one following another, neither featured. */
|
|
25
|
+
const RULED = `${ENTRY}:not([data-featured]) + ${ENTRY}:not([data-featured])`;
|
|
26
|
+
/** The hairline drawn on a later entry's `::before`, halfway into the space above it. */
|
|
27
|
+
function hairline(gap) {
|
|
28
|
+
return {
|
|
29
|
+
content: '""',
|
|
30
|
+
position: "absolute",
|
|
31
|
+
insetInline: 0,
|
|
32
|
+
insetBlockStart: `calc(${gap} / -2)`,
|
|
33
|
+
borderBlockStart: RULE,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The column entries sit in: a gap between them, halved by a hairline drawn on the later
|
|
38
|
+
* entry's `::before`, so an entry's own padding and surface stay its own. A featured entry
|
|
39
|
+
* already stands apart on its surface and draws no hairline.
|
|
40
|
+
*/
|
|
41
|
+
function entryRules() {
|
|
42
|
+
return [
|
|
43
|
+
flex(),
|
|
44
|
+
flexCol(),
|
|
45
|
+
raw({
|
|
46
|
+
gap: "var(--ui-post-stream-gap, 2.5rem)",
|
|
47
|
+
"&:has(> [data-layout='row'])": { gap: "var(--ui-post-stream-gap, 1.5rem)" },
|
|
48
|
+
[`& > ${ENTRY}`]: { position: "relative" },
|
|
49
|
+
[`& > ${RULED}::before`]: hairline("var(--ui-post-stream-gap, 2.5rem)"),
|
|
50
|
+
[`&:has(> [data-layout='row']) > ${RULED}::before`]: hairline("var(--ui-post-stream-gap, 1.5rem)"),
|
|
51
|
+
[`&:has(> ${SECTION})`]: { gap: "var(--ui-post-stream-section-gap, 3rem)" },
|
|
52
|
+
}),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A section's column: its heading, then its entries spaced and ruled as the stream's are.
|
|
57
|
+
* Spacing is a margin on each entry, so the space under the heading differs from the space
|
|
58
|
+
* between entries while the heading stays a plain child that sticks.
|
|
59
|
+
*/
|
|
60
|
+
function sectionRules() {
|
|
61
|
+
return [
|
|
62
|
+
flex(),
|
|
63
|
+
flexCol(),
|
|
64
|
+
raw({
|
|
65
|
+
scrollMarginBlockStart: "var(--ui-post-stream-offset, 0px)",
|
|
66
|
+
[`${IN_SECTION} ${ENTRY}`]: { position: "relative" },
|
|
67
|
+
[`${IN_SECTION} ${HEADING} + ${ENTRY}`]: {
|
|
68
|
+
marginBlockStart: "var(--ui-post-stream-entries-padding, 1.25rem)",
|
|
69
|
+
},
|
|
70
|
+
[`${IN_SECTION} ${ENTRY} + ${ENTRY}`]: {
|
|
71
|
+
marginBlockStart: "var(--ui-post-stream-gap, 2.5rem)",
|
|
72
|
+
},
|
|
73
|
+
[`${ROWS} > ${SCOPE} > ${ENTRY} + ${ENTRY}`]: {
|
|
74
|
+
marginBlockStart: "var(--ui-post-stream-gap, 1.5rem)",
|
|
75
|
+
},
|
|
76
|
+
[`${IN_SECTION} ${RULED}::before`]: hairline("var(--ui-post-stream-gap, 2.5rem)"),
|
|
77
|
+
[`${ROWS} > ${SCOPE} > ${RULED}::before`]: hairline("var(--ui-post-stream-gap, 1.5rem)"),
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Renders the stream as a column. Entries placed directly inside are divided by hairlines;
|
|
83
|
+
* {@link PostStream.Section} children group them under headings instead. Headings stick
|
|
84
|
+
* under `--ui-post-stream-offset`, which a page with a sticky bar sets to its height; the
|
|
85
|
+
* rest of {@link PostStream.CustomProperties} restyle headings and hairlines.
|
|
86
|
+
*
|
|
87
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
88
|
+
* @returns The render function producing the stream.
|
|
89
|
+
* @example
|
|
90
|
+
* <PostStream>
|
|
91
|
+
* <PostStream.Section id="2026-11">
|
|
92
|
+
* <PostStream.Heading>November 2026</PostStream.Heading>
|
|
93
|
+
* <PostEntry>…</PostEntry>
|
|
94
|
+
* </PostStream.Section>
|
|
95
|
+
* </PostStream>
|
|
96
|
+
* @example <PostStream>{posts.map((post) => <PostEntry>…</PostEntry>)}</PostStream>
|
|
97
|
+
*/
|
|
98
|
+
export function PostStream(handle) {
|
|
99
|
+
return () => {
|
|
100
|
+
let { mix, ...rest } = handle.props;
|
|
101
|
+
return _jsx("div", { "data-slot": "post-stream", ...rest, mix: mergeMix(entryRules(), mix) });
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A headed group of entries, named by its {@link PostStream.Heading}. The heading takes the
|
|
106
|
+
* ambient heading level and the entries one level below it, so with `<HeadingScope level={2}>`
|
|
107
|
+
* around the stream, sections read h2 and titles h3.
|
|
108
|
+
*
|
|
109
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
110
|
+
* @returns The render function producing the section.
|
|
111
|
+
* @example
|
|
112
|
+
* <PostStream.Section id="year-2025">
|
|
113
|
+
* <PostStream.Heading>2025</PostStream.Heading>
|
|
114
|
+
* <PostEntry layout="row">…</PostEntry>
|
|
115
|
+
* </PostStream.Section>
|
|
116
|
+
*/
|
|
117
|
+
PostStream.Section = function PostStreamSection(handle) {
|
|
118
|
+
let headingId = `post-stream-${handle.id}`;
|
|
119
|
+
return () => {
|
|
120
|
+
let { children, mix, ...rest } = handle.props;
|
|
121
|
+
let level = resolveHeadingLevel(handle);
|
|
122
|
+
handle.context.set({ headingId, level });
|
|
123
|
+
return (_jsx("section", { "data-slot": "post-stream-section", "aria-labelledby": headingId, ...rest, "data-post-stream-part": "section", mix: mergeMix(sectionRules(), mix), children: _jsx(HeadingScope, { level: Math.min(level + 1, 6), "data-post-stream-part": "scope", children: children }) }));
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A section's label at the section's heading level, sticking to the top for as long as its
|
|
128
|
+
* section is on screen, on the page's background, so entries scroll under it. Inside a
|
|
129
|
+
* {@link PostStream.Section} its `id` is the section's, which keeps the section named by it.
|
|
130
|
+
*
|
|
131
|
+
* @param handle Runtime handle carrying the host heading element's props.
|
|
132
|
+
* @returns The render function producing the heading.
|
|
133
|
+
* @example <PostStream.Heading>November 2026</PostStream.Heading>
|
|
134
|
+
*/
|
|
135
|
+
PostStream.Heading = function PostStreamHeading(handle) {
|
|
136
|
+
return () => {
|
|
137
|
+
let { id, mix, ...rest } = handle.props;
|
|
138
|
+
let context = handle.context.get(PostStream.Section);
|
|
139
|
+
let level = context?.level ?? resolveHeadingLevel(handle);
|
|
140
|
+
let Tag = TAG_BY_LEVEL[level];
|
|
141
|
+
return (_jsx(Tag, { "data-slot": "post-stream-heading", ...rest, id: context?.headingId ?? id, "data-post-stream-part": "heading", "data-heading-level": level, mix: mergeMix([
|
|
142
|
+
m(0),
|
|
143
|
+
sticky(),
|
|
144
|
+
raw({
|
|
145
|
+
insetBlockStart: "var(--ui-post-stream-offset, 0px)",
|
|
146
|
+
zIndex: 1,
|
|
147
|
+
paddingBlock: "0.625rem",
|
|
148
|
+
scrollMarginBlockStart: "var(--ui-post-stream-offset, 0px)",
|
|
149
|
+
}),
|
|
150
|
+
text("xs"),
|
|
151
|
+
raw({
|
|
152
|
+
fontFamily: "var(--ui-post-stream-heading-font-family, inherit)",
|
|
153
|
+
fontSize: "var(--ui-post-stream-heading-font-size, var(--ui-text-xs, 0.75rem))",
|
|
154
|
+
fontWeight: "var(--ui-post-stream-heading-font-weight, 600)",
|
|
155
|
+
letterSpacing: "var(--ui-post-stream-heading-letter-spacing, var(--ui-tracking-widest, 0.1em))",
|
|
156
|
+
textTransform: "var(--ui-post-stream-heading-text-transform, uppercase)",
|
|
157
|
+
color: "var(--ui-post-stream-heading-fg, var(--ui-neutral-fg-muted))",
|
|
158
|
+
backgroundColor: "var(--ui-post-stream-heading-bg, var(--ui-bg, Canvas))",
|
|
159
|
+
borderBlockEnd: "1px solid var(--ui-post-stream-heading-border-color, var(--ui-neutral-border))",
|
|
160
|
+
}),
|
|
161
|
+
], mix) }));
|
|
162
|
+
};
|
|
163
|
+
};
|