@sdxc/ui 2026.11.1 → 2026.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +1 -1
  2. package/dist/app/app-shell-toggle.d.ts +31 -0
  3. package/dist/app/app-shell-toggle.js +43 -0
  4. package/dist/app/app-shell.d.ts +131 -0
  5. package/dist/app/app-shell.js +542 -0
  6. package/dist/app/auto-refresh.d.ts +104 -0
  7. package/dist/app/auto-refresh.js +126 -0
  8. package/dist/app/behaviors/refresh-schedule.d.ts +53 -0
  9. package/dist/app/behaviors/refresh-schedule.js +95 -0
  10. package/dist/app/behaviors/shortcuts.d.ts +175 -0
  11. package/dist/app/behaviors/shortcuts.js +401 -0
  12. package/dist/app/behaviors/toaster.d.ts +31 -2
  13. package/dist/app/behaviors/toaster.js +62 -5
  14. package/dist/app/chart.d.ts +62 -8
  15. package/dist/app/chart.js +207 -9
  16. package/dist/app/command-palette.d.ts +132 -0
  17. package/dist/app/command-palette.js +181 -0
  18. package/dist/app/danger-zone.d.ts +66 -0
  19. package/dist/app/danger-zone.js +66 -0
  20. package/dist/app/detail-sheet.d.ts +119 -0
  21. package/dist/app/detail-sheet.js +173 -0
  22. package/dist/app/drop-zone.d.ts +2 -1
  23. package/dist/app/drop-zone.js +6 -3
  24. package/dist/app/editor-layout.d.ts +69 -0
  25. package/dist/app/editor-layout.js +143 -0
  26. package/dist/app/empty.d.ts +56 -19
  27. package/dist/app/empty.js +129 -22
  28. package/dist/app/filter-bar.d.ts +169 -0
  29. package/dist/app/filter-bar.js +346 -0
  30. package/dist/app/index.d.ts +51 -0
  31. package/dist/app/index.js +51 -0
  32. package/dist/app/keyboard-help.d.ts +66 -0
  33. package/dist/app/keyboard-help.js +56 -0
  34. package/dist/app/mixins/app-shell-controls.d.ts +46 -0
  35. package/dist/app/mixins/app-shell-controls.js +131 -0
  36. package/dist/app/mixins/auto-refresh.d.ts +29 -0
  37. package/dist/app/mixins/auto-refresh.js +66 -0
  38. package/dist/app/mixins/command-palette.d.ts +56 -0
  39. package/dist/app/mixins/command-palette.js +297 -0
  40. package/dist/app/mixins/copy-permalink.d.ts +26 -0
  41. package/dist/app/mixins/copy-permalink.js +54 -0
  42. package/dist/app/mixins/detail-sheet-keys.d.ts +28 -0
  43. package/dist/app/mixins/detail-sheet-keys.js +88 -0
  44. package/dist/app/mixins/escape-link.d.ts +17 -0
  45. package/dist/app/mixins/escape-link.js +35 -0
  46. package/dist/app/mixins/keyboard-help.d.ts +38 -0
  47. package/dist/app/mixins/keyboard-help.js +51 -0
  48. package/dist/app/mixins/optimistic-toggle-sync.d.ts +80 -0
  49. package/dist/app/mixins/optimistic-toggle-sync.js +153 -0
  50. package/dist/app/mixins/range-picker-keys.d.ts +18 -0
  51. package/dist/app/mixins/range-picker-keys.js +94 -0
  52. package/dist/app/mixins/row-navigation.d.ts +85 -0
  53. package/dist/app/mixins/row-navigation.js +208 -0
  54. package/dist/app/mixins/save-bar-sync.d.ts +27 -0
  55. package/dist/app/mixins/save-bar-sync.js +106 -0
  56. package/dist/app/mixins/save-shortcut.d.ts +47 -0
  57. package/dist/app/mixins/save-shortcut.js +101 -0
  58. package/dist/app/mixins/save-status-sync.d.ts +77 -0
  59. package/dist/app/mixins/save-status-sync.js +159 -0
  60. package/dist/app/mixins/selection-bar-sync.d.ts +32 -0
  61. package/dist/app/mixins/selection-bar-sync.js +151 -0
  62. package/dist/app/mixins/split-view.d.ts +66 -0
  63. package/dist/app/mixins/split-view.js +319 -0
  64. package/dist/app/mixins/status-strip-keys.d.ts +17 -0
  65. package/dist/app/mixins/status-strip-keys.js +79 -0
  66. package/dist/app/mixins/submit-on-change.d.ts +16 -0
  67. package/dist/app/mixins/submit-on-change.js +28 -0
  68. package/dist/app/mixins/table-selection.d.ts +39 -0
  69. package/dist/app/mixins/table-selection.js +272 -0
  70. package/dist/app/mixins/toast-queue.d.ts +36 -0
  71. package/dist/app/mixins/toast-queue.js +77 -0
  72. package/dist/app/mixins/toast-stack.d.ts +20 -0
  73. package/dist/app/mixins/toast-stack.js +55 -0
  74. package/dist/app/optimistic-toggle.d.ts +48 -0
  75. package/dist/app/optimistic-toggle.js +38 -0
  76. package/dist/app/page-header.d.ts +71 -0
  77. package/dist/app/page-header.js +249 -0
  78. package/dist/app/range-picker.d.ts +102 -0
  79. package/dist/app/range-picker.js +118 -0
  80. package/dist/app/save-bar.d.ts +54 -0
  81. package/dist/app/save-bar.js +64 -0
  82. package/dist/app/save-status.d.ts +50 -0
  83. package/dist/app/save-status.js +54 -0
  84. package/dist/app/selection-bar.d.ts +101 -0
  85. package/dist/app/selection-bar.js +157 -0
  86. package/dist/app/settings-layout.d.ts +70 -0
  87. package/dist/app/settings-layout.js +112 -0
  88. package/dist/app/settings-section.d.ts +140 -0
  89. package/dist/app/settings-section.js +182 -0
  90. package/dist/app/skeleton.d.ts +47 -4
  91. package/dist/app/skeleton.js +149 -2
  92. package/dist/app/sparkline.d.ts +61 -0
  93. package/dist/app/sparkline.js +145 -0
  94. package/dist/app/split-view.d.ts +154 -0
  95. package/dist/app/split-view.js +272 -0
  96. package/dist/app/stat-card.d.ts +109 -0
  97. package/dist/app/stat-card.js +379 -0
  98. package/dist/app/status-strip.d.ts +70 -0
  99. package/dist/app/status-strip.js +155 -0
  100. package/dist/app/styles/action-row.d.ts +41 -0
  101. package/dist/app/styles/action-row.js +59 -0
  102. package/dist/app/styles/stat-delta.d.ts +29 -0
  103. package/dist/app/styles/stat-delta.js +36 -0
  104. package/dist/app/styles/toast-stack.d.ts +21 -0
  105. package/dist/app/styles/toast-stack.js +54 -0
  106. package/dist/app/table.d.ts +199 -24
  107. package/dist/app/table.js +640 -36
  108. package/dist/app/toast.d.ts +105 -5
  109. package/dist/app/toast.js +89 -17
  110. package/dist/app/toasts.d.ts +49 -0
  111. package/dist/app/toasts.js +103 -0
  112. package/dist/app/utils/app-shell-cookie.d.ts +21 -0
  113. package/dist/app/utils/app-shell-cookie.js +33 -0
  114. package/dist/app/utils/chart-marker-indices.d.ts +9 -5
  115. package/dist/app/utils/chart-marker-indices.js +9 -8
  116. package/dist/app/utils/chart-path.d.ts +14 -10
  117. package/dist/app/utils/chart-path.js +46 -18
  118. package/dist/app/utils/edited-time.d.ts +19 -0
  119. package/dist/app/utils/edited-time.js +35 -0
  120. package/dist/app/utils/key-target.d.ts +23 -0
  121. package/dist/app/utils/key-target.js +48 -0
  122. package/dist/app/utils/search-params.d.ts +69 -0
  123. package/dist/app/utils/search-params.js +132 -0
  124. package/dist/app/utils/shortcut-groups.d.ts +21 -0
  125. package/dist/app/utils/shortcut-groups.js +53 -0
  126. package/dist/app/utils/split-view-layout.d.ts +48 -0
  127. package/dist/app/utils/split-view-layout.js +71 -0
  128. package/dist/app/view-options.d.ts +99 -0
  129. package/dist/app/view-options.js +182 -0
  130. package/dist/components/banner.d.ts +61 -0
  131. package/dist/components/banner.js +101 -0
  132. package/dist/components/confirm.d.ts +54 -5
  133. package/dist/components/confirm.js +44 -5
  134. package/dist/components/group.d.ts +14 -0
  135. package/dist/components/group.js +66 -11
  136. package/dist/components/index.d.ts +5 -0
  137. package/dist/components/index.js +5 -0
  138. package/dist/components/input.js +9 -3
  139. package/dist/components/link-button.js +8 -2
  140. package/dist/components/property-list.d.ts +76 -0
  141. package/dist/components/property-list.js +175 -0
  142. package/dist/components/relative-time.d.ts +72 -0
  143. package/dist/components/relative-time.js +45 -0
  144. package/dist/components/status-dot.d.ts +62 -0
  145. package/dist/components/status-dot.js +99 -0
  146. package/dist/components/text-field.d.ts +17 -2
  147. package/dist/components/text-field.js +13 -4
  148. package/dist/components/timeline.d.ts +67 -0
  149. package/dist/components/timeline.js +159 -0
  150. package/dist/components/typeset.d.ts +2 -1
  151. package/dist/components/typeset.js +4 -1
  152. package/dist/docs/code-tabs-sync.d.ts +1 -1
  153. package/dist/docs/code-tabs-sync.js +2 -2
  154. package/dist/docs/copy-button.d.ts +1 -1
  155. package/dist/docs/copy-button.js +2 -2
  156. package/dist/docs/docs-feedback.d.ts +12 -0
  157. package/dist/docs/docs-feedback.js +4 -2
  158. package/dist/docs/docs-hub.js +4 -4
  159. package/dist/docs/docs-layout.d.ts +1 -1
  160. package/dist/docs/docs-layout.js +1 -1
  161. package/dist/docs/docs-nav-tools.d.ts +1 -1
  162. package/dist/docs/docs-nav-tools.js +2 -2
  163. package/dist/docs/docs-nav.d.ts +6 -2
  164. package/dist/docs/docs-nav.js +2 -2
  165. package/dist/docs/docs-pager.d.ts +5 -1
  166. package/dist/docs/docs-pager.js +7 -6
  167. package/dist/docs/mixins/docs-nav-tools.d.ts +2 -2
  168. package/dist/docs/mixins/docs-nav-tools.js +32 -5
  169. package/dist/docs/next-steps.js +3 -2
  170. package/dist/docs/page-actions.d.ts +1 -1
  171. package/dist/docs/page-actions.js +2 -2
  172. package/dist/docs/table-of-contents.d.ts +1 -1
  173. package/dist/docs/table-of-contents.js +2 -2
  174. package/dist/mixins/confirm-phrase.d.ts +19 -0
  175. package/dist/mixins/confirm-phrase.js +56 -0
  176. package/dist/mixins/index.d.ts +2 -0
  177. package/dist/mixins/index.js +2 -0
  178. package/dist/mixins/viewer-time.d.ts +20 -0
  179. package/dist/mixins/viewer-time.js +40 -0
  180. package/dist/styles/index.d.ts +1 -0
  181. package/dist/styles/index.js +1 -0
  182. package/dist/styles/segmented-control.d.ts +49 -0
  183. package/dist/styles/segmented-control.js +71 -0
  184. package/dist/test/table.d.ts +65 -0
  185. package/dist/test/table.js +108 -0
  186. package/dist/utils/index.d.ts +1 -0
  187. package/dist/utils/index.js +1 -0
  188. package/dist/utils/relative-time.d.ts +44 -0
  189. package/dist/utils/relative-time.js +69 -0
  190. package/package.json +6 -6
@@ -28,13 +28,15 @@ const VOTED = `input[name="${DOCS_FEEDBACK_VOTE_FIELD}"]:checked`;
28
28
  * @returns The render function producing the block's markup.
29
29
  * @example
30
30
  * <DocsFeedback action="/docs/feedback" page="/docs/alerts" state={sent ? "sent" : "idle"} labels={labels} />
31
+ * @example
32
+ * <DocsFeedback frame="feedback" resetScroll="manual" action="/docs/feedback" page="/docs/alerts" labels={labels} />
31
33
  */
32
34
  export function DocsFeedback(handle) {
33
35
  return () => {
34
- let { action, page, labels, state, mix, ...rest } = handle.props;
36
+ let { action, page, labels, state, frame, resetScroll, mix, ...rest } = handle.props;
35
37
  let isSent = state === "sent";
36
38
  let questionId = `${handle.id}-question`;
37
- return (_jsxs("div", { ...rest, "data-slot": "docs-feedback", "data-state": isSent ? "sent" : "idle", mix: mergeMix([minIs(0), text("sm"), fg("neutral")], mix), children: [_jsx("p", { role: "status", "data-slot": "docs-feedback-thanks", mix: [m(0), isSent ? [] : visuallyHidden()], children: isSent ? labels.thanks : "" }), isSent ? null : (_jsxs("form", { method: "post", action: action, "data-slot": "docs-feedback-form", mix: [vstack({ gap: 3, align: "stretch" })], children: [_jsx("input", { type: "hidden", name: DOCS_FEEDBACK_PAGE_FIELD, value: page }), _jsxs("div", { role: "radiogroup", "aria-labelledby": questionId, "data-slot": "docs-feedback-vote", mix: [flex(), items("center"), gap(4, 3), raw({ flexWrap: "wrap" }), minIs(0)], children: [_jsx("span", { id: questionId, "data-slot": "docs-feedback-question", mix: [weight("medium"), fg("neutral.emphasis")], children: labels.question }), _jsxs("span", { mix: [hstack({ gap: 2, align: "center" })], children: [_jsx(DocsFeedbackChoice, { value: "yes", label: labels.yes }), _jsx(DocsFeedbackChoice, { value: "no", label: labels.no })] })] }), _jsxs("div", { "data-slot": "docs-feedback-note", mix: [
39
+ return (_jsxs("div", { ...rest, "data-slot": "docs-feedback", "data-state": isSent ? "sent" : "idle", mix: mergeMix([minIs(0), text("sm"), fg("neutral")], mix), children: [_jsx("p", { role: "status", "data-slot": "docs-feedback-thanks", mix: [m(0), isSent ? [] : visuallyHidden()], children: isSent ? labels.thanks : "" }), isSent ? null : (_jsxs("form", { method: "post", action: action, "data-rmx-target": frame, "data-rmx-reset-scroll": resetScroll, "data-slot": "docs-feedback-form", mix: [vstack({ gap: 3, align: "stretch" })], children: [_jsx("input", { type: "hidden", name: DOCS_FEEDBACK_PAGE_FIELD, value: page }), _jsxs("div", { role: "radiogroup", "aria-labelledby": questionId, "data-slot": "docs-feedback-vote", mix: [flex(), items("center"), gap(4, 3), raw({ flexWrap: "wrap" }), minIs(0)], children: [_jsx("span", { id: questionId, "data-slot": "docs-feedback-question", mix: [weight("medium"), fg("neutral.emphasis")], children: labels.question }), _jsxs("span", { mix: [hstack({ gap: 2, align: "center" })], children: [_jsx(DocsFeedbackChoice, { value: "yes", label: labels.yes }), _jsx(DocsFeedbackChoice, { value: "no", label: labels.no })] })] }), _jsxs("div", { "data-slot": "docs-feedback-note", mix: [
38
40
  /**
39
41
  * One rule holds both displays, so the revealed state always outranks the
40
42
  * hidden one whatever order the stylesheet layers land in.
@@ -85,7 +85,7 @@ export function DocsHub(handle) {
85
85
  balance(),
86
86
  fg("neutral.emphasis"),
87
87
  raw({ fontWeight: 650, letterSpacing: "-0.02em", lineHeight: 1.1 }),
88
- ], children: title }), lead ? (_jsx("p", { "data-slot": "docs-hub-lead", mix: [m(0), text("lg"), pretty(), fg("neutral"), raw({ maxInlineSize: "65ch" })], children: lead })) : null] }), search ? (_jsx("div", { "data-slot": "docs-hub-search", mix: [raw({ maxInlineSize: "36rem" })], children: search })) : null, topics && topics.length > 0 ? (_jsx("nav", { "data-slot": "docs-hub-topics", "aria-label": labels.topics, children: _jsx("ul", { mix: [hstack({ gap: 2 }), flexWrap("wrap"), m(0), p(0), listStyle("none")], children: topics.map((topic) => (_jsx("li", { children: _jsx("a", { href: topic.href, "data-rmx-prefetch": "intent", "data-slot": "docs-hub-topic", mix: [
88
+ ], children: title }), lead ? (_jsx("p", { "data-slot": "docs-hub-lead", mix: [m(0), text("lg"), pretty(), fg("neutral"), raw({ maxInlineSize: "65ch" })], children: lead })) : null] }), search ? (_jsx("div", { "data-slot": "docs-hub-search", mix: [raw({ maxInlineSize: "36rem" })], children: search })) : null, topics && topics.length > 0 ? (_jsx("nav", { "data-slot": "docs-hub-topics", "aria-label": labels.topics, children: _jsx("ul", { "data-slot": "docs-hub-topic-list", "data-not-typeset": "", mix: [hstack({ gap: 2 }), flexWrap("wrap"), m(0), p(0), listStyle("none")], children: topics.map((topic) => (_jsx("li", { children: _jsx("a", { href: topic.href, "data-rmx-prefetch": "intent", "data-slot": "docs-hub-topic", mix: [
89
89
  hstack({ align: "center" }),
90
90
  raw({
91
91
  minBlockSize: "2.25rem",
@@ -100,7 +100,7 @@ export function DocsHub(handle) {
100
100
  hover(border("brand.border")),
101
101
  when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
102
102
  motionSafe(raw({ transition: `border-color 150ms ${EASE_OUT}` })),
103
- ], children: topic.title }) }, topic.href))) }) })) : null] }), start.length > 0 ? (_jsxs("section", { "data-slot": "docs-hub-start", mix: [vstack({ gap: 4, align: "stretch" })], children: [_jsx(BlockTag, { mix: blockHeading, children: labels.start }), _jsx("ul", { mix: [fillGrid("20rem"), m(0), p(0), listStyle("none")], children: start.map((item) => (_jsx("li", { mix: [grid()], children: _jsxs("a", { href: item.href, "data-rmx-prefetch": "intent", "data-slot": "docs-hub-start-card", mix: [cardLink(), p(6), bg("neutral.bg-tint"), raw({ minBlockSize: "11rem" })], children: [item.eyebrow ? (_jsx("span", { mix: [text("xs"), font("mono"), fg("neutral.muted")], children: item.eyebrow })) : null, _jsx(CardTag, { "data-slot": "docs-hub-start-title", mix: [
103
+ ], children: topic.title }) }, topic.href))) }) })) : null] }), start.length > 0 ? (_jsxs("section", { "data-slot": "docs-hub-start", mix: [vstack({ gap: 4, align: "stretch" })], children: [_jsx(BlockTag, { mix: blockHeading, children: labels.start }), _jsx("ul", { "data-slot": "docs-hub-start-list", "data-not-typeset": "", mix: [fillGrid("20rem"), m(0), p(0), listStyle("none")], children: start.map((item) => (_jsx("li", { mix: [grid()], children: _jsxs("a", { href: item.href, "data-rmx-prefetch": "intent", "data-slot": "docs-hub-start-card", mix: [cardLink(), p(6), bg("neutral.bg-tint"), raw({ minBlockSize: "11rem" })], children: [item.eyebrow ? (_jsx("span", { mix: [text("xs"), font("mono"), fg("neutral.muted")], children: item.eyebrow })) : null, _jsx(CardTag, { "data-slot": "docs-hub-start-title", mix: [
104
104
  m(0),
105
105
  text("xl"),
106
106
  weight("semibold"),
@@ -112,7 +112,7 @@ export function DocsHub(handle) {
112
112
  text("sm"),
113
113
  weight("medium"),
114
114
  fg("brand"),
115
- ], children: [item.cta, _jsx(ArrowRightIcon, { size: 14, "aria-hidden": "true" })] })) : null] }) }, item.href))) })] })) : null, sections.length > 0 ? (_jsxs("section", { "data-slot": "docs-hub-sections", mix: [vstack({ gap: 4, align: "stretch" })], children: [_jsx(BlockTag, { mix: blockHeading, children: labels.sections }), _jsx("ul", { mix: [fillGrid("15rem"), m(0), p(0), listStyle("none")], children: sections.map((section) => {
115
+ ], children: [item.cta, _jsx(ArrowRightIcon, { size: 14, "aria-hidden": "true" })] })) : null] }) }, item.href))) })] })) : null, sections.length > 0 ? (_jsxs("section", { "data-slot": "docs-hub-sections", mix: [vstack({ gap: 4, align: "stretch" })], children: [_jsx(BlockTag, { mix: blockHeading, children: labels.sections }), _jsx("ul", { "data-slot": "docs-hub-section-list", "data-not-typeset": "", mix: [fillGrid("15rem"), m(0), p(0), listStyle("none")], children: sections.map((section) => {
116
116
  let countText = section.countLabel ??
117
117
  (section.count === undefined
118
118
  ? undefined
@@ -129,7 +129,7 @@ export function DocsHub(handle) {
129
129
  font("mono"),
130
130
  fg("neutral.muted"),
131
131
  ], children: countText })) : null] }) }, section.href));
132
- }) })] })) : null, popular && popular.length > 0 ? (_jsxs("section", { "data-slot": "docs-hub-popular", mix: [vstack({ gap: 4, align: "stretch" })], children: [labels.popular ? _jsx(BlockTag, { mix: blockHeading, children: labels.popular }) : null, _jsx("ul", { mix: [fillGrid("15rem", "fill"), m(0), p(0), listStyle("none")], children: popular.map((item) => (_jsx("li", { mix: [grid()], children: _jsxs("a", { href: item.href, "data-rmx-prefetch": "intent", "data-slot": "docs-hub-popular-card", mix: [cardLink(), raw({ overflow: "hidden" })], children: [item.image ? (_jsx("span", { "data-slot": "docs-hub-popular-image", mix: [
132
+ }) })] })) : null, popular && popular.length > 0 ? (_jsxs("section", { "data-slot": "docs-hub-popular", mix: [vstack({ gap: 4, align: "stretch" })], children: [labels.popular ? _jsx(BlockTag, { mix: blockHeading, children: labels.popular }) : null, _jsx("ul", { "data-slot": "docs-hub-popular-list", "data-not-typeset": "", mix: [fillGrid("15rem", "fill"), m(0), p(0), listStyle("none")], children: popular.map((item) => (_jsx("li", { mix: [grid()], children: _jsxs("a", { href: item.href, "data-rmx-prefetch": "intent", "data-slot": "docs-hub-popular-card", mix: [cardLink(), raw({ overflow: "hidden" })], children: [item.image ? (_jsx("span", { "data-slot": "docs-hub-popular-image", mix: [
133
133
  raw({
134
134
  display: "block",
135
135
  aspectRatio: "16 / 9",
@@ -77,7 +77,7 @@ export declare namespace DocsLayout {
77
77
  }
78
78
  /**
79
79
  * Renders the three columns and their narrow-screen fallbacks. Load
80
- * `@sdxc/ui/table-of-contents` and `@sdxc/ui/dialog-dismiss` in the browser entry. Headings
80
+ * `@sdxc/ui/docs/table-of-contents` and `@sdxc/ui/dialog-dismiss` in the browser entry. Headings
81
81
  * with an `id` in the article get a `scroll-margin-top` that clears the sticky chrome, and
82
82
  * `--ui-docs-scroll-margin` carries the same offset for anything else jumped to.
83
83
  *
@@ -31,7 +31,7 @@ const BAR_HEIGHT = "2.75rem";
31
31
  const RING_CLEARANCE = "0.375rem";
32
32
  /**
33
33
  * Renders the three columns and their narrow-screen fallbacks. Load
34
- * `@sdxc/ui/table-of-contents` and `@sdxc/ui/dialog-dismiss` in the browser entry. Headings
34
+ * `@sdxc/ui/docs/table-of-contents` and `@sdxc/ui/dialog-dismiss` in the browser entry. Headings
35
35
  * with an `id` in the article get a `scroll-margin-top` that clears the sticky chrome, and
36
36
  * `--ui-docs-scroll-margin` carries the same offset for anything else jumped to.
37
37
  *
@@ -20,6 +20,6 @@ export declare namespace DocsNavTools {
20
20
  }
21
21
  /**
22
22
  * Renders the filter field, hidden until it loads, inside the nav it enhances. `DocsNav`
23
- * places it; load `@sdxc/ui/docs-nav-tools` in the browser entry.
23
+ * places it; load `@sdxc/ui/docs/docs-nav-tools` in the browser entry.
24
24
  */
25
25
  export declare const DocsNavTools: EntryComponent<DocsNavTools.Props>;
@@ -4,9 +4,9 @@ import { SearchField } from "../components/search-field.js";
4
4
  import { docsNavTools } from "./mixins/docs-nav-tools.js";
5
5
  /**
6
6
  * Renders the filter field, hidden until it loads, inside the nav it enhances. `DocsNav`
7
- * places it; load `@sdxc/ui/docs-nav-tools` in the browser entry.
7
+ * places it; load `@sdxc/ui/docs/docs-nav-tools` in the browser entry.
8
8
  */
9
- export const DocsNavTools = clientEntry("@sdxc/ui/docs-nav-tools#DocsNavTools", function DocsNavTools(handle) {
9
+ export const DocsNavTools = clientEntry("@sdxc/ui/docs/docs-nav-tools#DocsNavTools", function DocsNavTools(handle) {
10
10
  return () => {
11
11
  let { filter } = handle.props;
12
12
  return (_jsx("div", { hidden: true, mix: [docsNavTools()], children: filter ? (_jsx(SearchField, { "aria-label": filter.label, children: _jsx(SearchField.Input, { placeholder: filter.placeholder, autocomplete: "off" }) })) : null }));
@@ -25,7 +25,11 @@ export declare namespace DocsNav {
25
25
  placeholder: string;
26
26
  noResults: string;
27
27
  };
28
- /** Drawn under the tree, such as "Contact support" or a status link. */
28
+ /**
29
+ * Drawn under the tree, such as "Contact support" or a status link, flush with the
30
+ * nav's edge; give its links the rows' inline padding (or render them as
31
+ * `Sidebar.MenuLink`s) to line their text up with the pages above.
32
+ */
29
33
  footer?: RemixNode;
30
34
  /**
31
35
  * Folds every group except the ones holding the current page, for a tree whose
@@ -43,7 +47,7 @@ export declare namespace DocsNav {
43
47
  /**
44
48
  * Renders the tree in reading order. A group whose `href` is set links its own page from
45
49
  * its summary, and every group is a native `<details>`, so folding needs no script. Load
46
- * `@sdxc/ui/docs-nav-tools` in the browser entry for the scroll-to-current and the filter.
50
+ * `@sdxc/ui/docs/docs-nav-tools` in the browser entry for the scroll-to-current and the filter.
47
51
  *
48
52
  * @example
49
53
  * <DocsNav tree={tree} activePath={url.pathname} />
@@ -14,7 +14,7 @@ import { DocsNavTools } from "./docs-nav-tools.js";
14
14
  /**
15
15
  * Renders the tree in reading order. A group whose `href` is set links its own page from
16
16
  * its summary, and every group is a native `<details>`, so folding needs no script. Load
17
- * `@sdxc/ui/docs-nav-tools` in the browser entry for the scroll-to-current and the filter.
17
+ * `@sdxc/ui/docs/docs-nav-tools` in the browser entry for the scroll-to-current and the filter.
18
18
  *
19
19
  * @example
20
20
  * <DocsNav tree={tree} activePath={url.pathname} />
@@ -29,7 +29,7 @@ export function DocsNav(handle) {
29
29
  vstack({ gap: 4 }),
30
30
  minIs(0),
31
31
  when("& [hidden]", raw({ display: "none !important" })),
32
- ], children: [_jsx(DocsNavTools, { filter: filter ? { label: filter.label, placeholder: filter.placeholder } : undefined }), _jsxs(Sidebar.Nav, { "aria-label": tree.label, mix: [raw({ gap: "1.25rem" })], children: [tree.sections.map((section) => (_jsxs("div", { "data-docs-nav-section": "", mix: [vstack({ gap: 1 })], children: [_jsx("p", { mix: [m(0), p(1, 2.5), text("sm"), weight("semibold"), fg("neutral.emphasis")], children: section.title }), _jsx(Sidebar.Menu, { "data-docs-nav-list": "", mix: [m(0), p(0), listStyle("none")], children: section.items.map((item) => (_jsx(NavItem, { item: item, context: context, depth: 0 }, item.href ?? item.title))) })] }, section.title))), filter ? (_jsx("p", { "data-docs-nav-empty": "", hidden: true, mix: [m(0), p(2, 2.5), text("sm"), fg("neutral.muted")], children: filter.noResults })) : null] }), footer ? _jsx("div", { mix: [pi("0.625rem")], children: footer }) : null] }));
32
+ ], children: [_jsx(DocsNavTools, { filter: filter ? { label: filter.label, placeholder: filter.placeholder } : undefined }), _jsxs(Sidebar.Nav, { "aria-label": tree.label, mix: [raw({ gap: "1.25rem" })], children: [tree.sections.map((section) => (_jsxs("div", { "data-docs-nav-section": "", mix: [vstack({ gap: 1 })], children: [_jsx("p", { mix: [m(0), p(1, 2.5), text("sm"), weight("semibold"), fg("neutral.emphasis")], children: section.title }), _jsx(Sidebar.Menu, { "data-docs-nav-list": "", mix: [m(0), p(0), listStyle("none")], children: section.items.map((item) => (_jsx(NavItem, { item: item, context: context, depth: 0 }, item.href ?? item.title))) })] }, section.title))), filter ? (_jsx("p", { "data-docs-nav-empty": "", hidden: true, mix: [m(0), p(2, 2.5), text("sm"), fg("neutral.muted")], children: filter.noResults })) : null] }), footer ? _jsx("div", { "data-docs-nav-footer": "", children: footer }) : null] }));
33
33
  };
34
34
  }
35
35
  /** Whether `item` is, or holds, the page at `path`. */
@@ -25,8 +25,12 @@ export declare namespace DocsPager {
25
25
  previous: string;
26
26
  next: string;
27
27
  }
28
+ /** When the pager's links prefetch their page, as `LinkButton` does. */
29
+ type Prefetch = "intent" | "viewport";
28
30
  /** Props accepted by {@link DocsPager}. */
29
31
  interface Props extends Omit<TagProps<"nav">, "children"> {
32
+ /** Prefetches each neighbour's page; unset prefetches none. */
33
+ prefetch?: Prefetch;
30
34
  previous?: Entry | null;
31
35
  next?: Entry | null;
32
36
  /** Section of the page being read; a destination in another section names its own. */
@@ -41,6 +45,6 @@ export declare namespace DocsPager {
41
45
  * @param handle Runtime handle carrying the pager's props.
42
46
  * @returns The render function producing the pager's markup.
43
47
  * @example
44
- * <DocsPager {...findNeighbours(tree, path)} section="Guides" labels={{ nav: "Pagination", previous: "Previous", next: "Next" }} />
48
+ * <DocsPager {...findNeighbours(tree, path)} section="Guides" prefetch="intent" labels={{ nav: "Pagination", previous: "Previous", next: "Next" }} />
45
49
  */
46
50
  export declare function DocsPager(handle: Handle<DocsPager.Props>): () => import("remix/component").RemixElement | null;
@@ -9,7 +9,7 @@ import { motionSafe } from "@sdxc/u/responsive";
9
9
  import { is, minIs, p } from "@sdxc/u/size";
10
10
  import { hover, when } from "@sdxc/u/state";
11
11
  import { translateProperty } from "@sdxc/u/transform";
12
- import { overflowWrap, text, textAlign, weight } from "@sdxc/u/typography";
12
+ import { overflowWrap, text, textAlign, textDecoration, weight } from "@sdxc/u/typography";
13
13
  /** Container the pager measures; at 36rem of its own width a pair of cards sits side by side. */
14
14
  const PAGER_CONTAINER = "ui-docs-pager";
15
15
  /** Selector for a card's arrow, which hover and focus nudge toward the destination. */
@@ -21,11 +21,11 @@ const ARROW = '& [data-slot="docs-pager-arrow"]';
21
21
  * @param handle Runtime handle carrying the pager's props.
22
22
  * @returns The render function producing the pager's markup.
23
23
  * @example
24
- * <DocsPager {...findNeighbours(tree, path)} section="Guides" labels={{ nav: "Pagination", previous: "Previous", next: "Next" }} />
24
+ * <DocsPager {...findNeighbours(tree, path)} section="Guides" prefetch="intent" labels={{ nav: "Pagination", previous: "Previous", next: "Next" }} />
25
25
  */
26
26
  export function DocsPager(handle) {
27
27
  return () => {
28
- let { previous, next, section, labels, mix, ...rest } = handle.props;
28
+ let { previous, next, section, labels, prefetch, mix, ...rest } = handle.props;
29
29
  if (!previous && !next)
30
30
  return null;
31
31
  let paired = Boolean(previous && next);
@@ -42,7 +42,7 @@ export function DocsPager(handle) {
42
42
  gridTemplateColumns: paired ? "repeat(2, minmax(0, 1fr))" : "minmax(0, 1fr)",
43
43
  },
44
44
  }),
45
- ], children: [previous ? (_jsx(DocsPagerCard, { entry: previous, label: labels.previous, direction: "previous", section: section })) : null, next ? (_jsx(DocsPagerCard, { entry: next, label: labels.next, direction: "next", section: section })) : null] }) }));
45
+ ], children: [previous ? (_jsx(DocsPagerCard, { entry: previous, prefetch: prefetch, label: labels.previous, direction: "previous", section: section })) : null, next ? (_jsx(DocsPagerCard, { entry: next, label: labels.next, direction: "next", section: section, prefetch: prefetch })) : null] }) }));
46
46
  };
47
47
  }
48
48
  /**
@@ -52,12 +52,12 @@ export function DocsPager(handle) {
52
52
  */
53
53
  function DocsPagerCard(handle) {
54
54
  return () => {
55
- let { direction, entry, label, section } = handle.props;
55
+ let { direction, entry, label, section, prefetch } = handle.props;
56
56
  let isNext = direction === "next";
57
57
  let Arrow = isNext ? ArrowRightIcon : ArrowLeftIcon;
58
58
  let showSection = entry.section !== undefined && entry.section !== section;
59
59
  let arrow = (_jsx(Arrow, { size: 14, "aria-hidden": "true", "data-slot": "docs-pager-arrow", mix: [transition("translate")] }));
60
- return (_jsxs("a", { href: entry.href, rel: isNext ? "next" : "prev", "data-slot": "docs-pager-card", "data-direction": direction, mix: [
60
+ return (_jsxs("a", { href: entry.href, "data-rmx-prefetch": prefetch, rel: isNext ? "next" : "prev", "data-slot": "docs-pager-card", "data-direction": direction, mix: [
61
61
  vstack({ gap: 1, align: isNext ? "end" : "start" }),
62
62
  minIs(0),
63
63
  p(4, 5),
@@ -65,6 +65,7 @@ function DocsPagerCard(handle) {
65
65
  border({ color: "neutral.border", width: 1, style: "solid" }),
66
66
  textAlign(isNext ? "end" : "start"),
67
67
  overflowWrap("anywhere"),
68
+ textDecoration("none"),
68
69
  transition("border-color, background-color"),
69
70
  hover([border("brand.border"), bg("neutral.bg-tint")]),
70
71
  when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
@@ -12,8 +12,8 @@ import type { ElementProps, MixinFactory } from "remix/component";
12
12
  * `aria-current="page"`. When the host holds an `<input>`, typing hides every `li` whose
13
13
  * title misses the query, hides sections left empty, opens `<details>` groups holding a
14
14
  * match, and shows `[data-docs-nav-empty]` when nothing matches; clearing the field restores
15
- * every group's own open state. The host is `hidden` until this runs, so a page without
16
- * script never shows an inert field.
15
+ * every group's own open state. A page reload that resets the tree keeps the query applied.
16
+ * The host is `hidden` until this runs, so a page without script never shows an inert field.
17
17
  *
18
18
  * @example
19
19
  * <div data-docs-nav><div hidden mix={[docsNavTools()]}><input type="search" /></div><nav>…</nav></div>
@@ -13,8 +13,8 @@ import { revealInScroller } from "../utils/reveal-in-scroller.js";
13
13
  * `aria-current="page"`. When the host holds an `<input>`, typing hides every `li` whose
14
14
  * title misses the query, hides sections left empty, opens `<details>` groups holding a
15
15
  * match, and shows `[data-docs-nav-empty]` when nothing matches; clearing the field restores
16
- * every group's own open state. The host is `hidden` until this runs, so a page without
17
- * script never shows an inert field.
16
+ * every group's own open state. A page reload that resets the tree keeps the query applied.
17
+ * The host is `hidden` until this runs, so a page without script never shows an inert field.
18
18
  *
19
19
  * @example
20
20
  * <div data-docs-nav><div hidden mix={[docsNavTools()]}><input type="search" /></div><nav>…</nav></div>
@@ -47,9 +47,36 @@ function enhance(host, signal) {
47
47
  if (!input)
48
48
  return;
49
49
  host.hidden = false;
50
- let groups = [...nav.querySelectorAll("details")];
51
- let ownState = new Map(groups.map((group) => [group, group.open]));
52
- input.addEventListener("input", () => filterDocsNav(nav, input.value, ownState), { signal });
50
+ let ownState = new Map();
51
+ let snapshot = () => {
52
+ ownState = new Map([...nav.querySelectorAll("details")].map((group) => [group, group.open]));
53
+ };
54
+ snapshot();
55
+ let observer = new MutationObserver((records) => {
56
+ if (!input.value || !records.some(isReset))
57
+ return;
58
+ snapshot();
59
+ filterDocsNav(nav, input.value, ownState);
60
+ observer.takeRecords();
61
+ });
62
+ let apply = () => {
63
+ filterDocsNav(nav, input.value, ownState);
64
+ observer.takeRecords();
65
+ };
66
+ observer.observe(nav, { subtree: true, childList: true, attributeFilter: ["hidden"] });
67
+ signal.addEventListener("abort", () => observer.disconnect());
68
+ input.addEventListener("input", apply, { signal });
69
+ if (input.value)
70
+ apply();
71
+ }
72
+ /**
73
+ * Whether `record` is a page reload putting the server's markup back: pages added or
74
+ * replaced, or a page the filter hid shown again. The filter's own writes only hide.
75
+ */
76
+ function isReset(record) {
77
+ if (record.type === "childList")
78
+ return true;
79
+ return record.target instanceof HTMLElement && !record.target.hidden;
53
80
  }
54
81
  /**
55
82
  * Shows the pages whose title holds every word of `query`, case- and accent-insensitive,
@@ -8,7 +8,7 @@ import { motionSafe } from "@sdxc/u/responsive";
8
8
  import { m, minIs, p, pb } from "@sdxc/u/size";
9
9
  import { hover, when } from "@sdxc/u/state";
10
10
  import { translateProperty } from "@sdxc/u/transform";
11
- import { leading, overflowWrap, pretty, text, weight } from "@sdxc/u/typography";
11
+ import { leading, overflowWrap, pretty, text, textDecoration, weight } from "@sdxc/u/typography";
12
12
  import { readAmbientLevel, TAG_BY_LEVEL } from "../components/heading-scope.js";
13
13
  /** Look {@link NextSteps} draws when `variant` is omitted. */
14
14
  const DEFAULT_VARIANT = "cards";
@@ -31,7 +31,7 @@ export function NextSteps(handle) {
31
31
  let resolvedVariant = variant ?? DEFAULT_VARIANT;
32
32
  let Tag = TAG_BY_LEVEL[level ?? readAmbientLevel(handle) ?? DEFAULT_LEVEL];
33
33
  let isCards = resolvedVariant === "cards";
34
- return (_jsxs("section", { ...rest, "aria-labelledby": id, "aria-label": id ? undefined : title, "data-slot": "next-steps", "data-variant": resolvedVariant, mix: mergeMix([vstack({ gap: 4, align: "stretch" }), minIs(0)], mix), children: [_jsx(Tag, { id: id, "data-slot": "next-steps-title", mix: [m(0), text("lg"), weight("semibold"), fg("neutral.emphasis"), leading("snug")], children: title }), _jsx("ul", { "data-slot": "next-steps-list", mix: [
34
+ return (_jsxs("section", { ...rest, "aria-labelledby": id, "aria-label": id ? undefined : title, "data-slot": "next-steps", "data-variant": resolvedVariant, mix: mergeMix([vstack({ gap: 4, align: "stretch" }), minIs(0)], mix), children: [_jsx(Tag, { id: id, "data-slot": "next-steps-title", mix: [m(0), text("lg"), weight("semibold"), fg("neutral.emphasis"), leading("snug")], children: title }), _jsx("ul", { "data-slot": "next-steps-list", "data-not-typeset": "", mix: [
35
35
  m(0),
36
36
  p(0),
37
37
  listStyle(),
@@ -63,6 +63,7 @@ function NextStepsLink(handle) {
63
63
  return (_jsxs("a", { href: item.href, "data-slot": "next-steps-link", mix: [
64
64
  vstack({ gap: 1, align: "stretch" }),
65
65
  overflowWrap("anywhere"),
66
+ textDecoration("none"),
66
67
  cards
67
68
  ? [
68
69
  p(4),
@@ -68,7 +68,7 @@ export declare namespace PageActions {
68
68
  export declare function PageActions(handle: Handle<PageActions.Props>): () => import("remix/component").RemixElement;
69
69
  /**
70
70
  * Client island: the main half of {@link PageActions}, loaded from the bare
71
- * `@sdxc/ui/page-actions` specifier. It copies `href`'s body, swaps its glyph and label to
71
+ * `@sdxc/ui/docs/page-actions` specifier. It copies `href`'s body, swaps its glyph and label to
72
72
  * the copied state for two seconds and announces it; before hydration it is inert.
73
73
  *
74
74
  * @example
@@ -34,13 +34,13 @@ export function PageActions(handle) {
34
34
  }
35
35
  /**
36
36
  * Client island: the main half of {@link PageActions}, loaded from the bare
37
- * `@sdxc/ui/page-actions` specifier. It copies `href`'s body, swaps its glyph and label to
37
+ * `@sdxc/ui/docs/page-actions` specifier. It copies `href`'s body, swaps its glyph and label to
38
38
  * the copied state for two seconds and announces it; before hydration it is inert.
39
39
  *
40
40
  * @example
41
41
  * <PageActionsCopy href="/docs/install.md" copy="Copy page" copied="Copied" failed="Could not copy" />
42
42
  */
43
- export const PageActionsCopy = clientEntry("@sdxc/ui/page-actions#PageActionsCopy", function PageActionsCopy(handle) {
43
+ export const PageActionsCopy = clientEntry("@sdxc/ui/docs/page-actions#PageActionsCopy", function PageActionsCopy(handle) {
44
44
  return () => {
45
45
  let { copied, copy, failed, href, joined = false } = handle.props;
46
46
  return (_jsxs(Button, { type: "button", size: "sm", variant: "surface", color: "neutral", "data-slot": "page-actions-copy", mix: [
@@ -36,7 +36,7 @@ export declare namespace TableOfContents {
36
36
  }
37
37
  /**
38
38
  * Renders the in-page navigation, or nothing when the page has fewer than `minItems`
39
- * headings. Load `@sdxc/ui/table-of-contents` in the browser entry. Headings that the
39
+ * headings. Load `@sdxc/ui/docs/table-of-contents` in the browser entry. Headings that the
40
40
  * page's layout gives a `scroll-margin-top` set the line a section is read from.
41
41
  *
42
42
  * @example
@@ -27,7 +27,7 @@ const RING = 43.98;
27
27
  const SETTLE = "cubic-bezier(0.32, 0.72, 0, 1)";
28
28
  /**
29
29
  * Renders the in-page navigation, or nothing when the page has fewer than `minItems`
30
- * headings. Load `@sdxc/ui/table-of-contents` in the browser entry. Headings that the
30
+ * headings. Load `@sdxc/ui/docs/table-of-contents` in the browser entry. Headings that the
31
31
  * page's layout gives a `scroll-margin-top` set the line a section is read from.
32
32
  *
33
33
  * @example
@@ -35,7 +35,7 @@ const SETTLE = "cubic-bezier(0.32, 0.72, 0, 1)";
35
35
  * @example
36
36
  * <TableOfContents items={anchors} label="On this page" layout="bar" />
37
37
  */
38
- export const TableOfContents = clientEntry("@sdxc/ui/table-of-contents#TableOfContents", function TableOfContents(handle) {
38
+ export const TableOfContents = clientEntry("@sdxc/ui/docs/table-of-contents#TableOfContents", function TableOfContents(handle) {
39
39
  return () => {
40
40
  let { items, label, layout = "rail", minItems = TOC_MIN_ITEMS } = handle.props;
41
41
  if (items.length < minItems)
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Why JS: a button cannot disable itself until a field matches a phrase, so script keeps
3
+ * a type-to-confirm dialog's confirming control disabled until the text matches exactly.
4
+ * No-JS baseline: the field's `pattern` and `required` make the browser refuse a mismatch.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/component";
10
+ /** Attribute marking a dialog's confirming control, which {@link confirmPhrase} enables on a match. */
11
+ export declare const CONFIRM_ACTION_ATTRIBUTE = "data-confirm-action";
12
+ /**
13
+ * Applied to a type-to-confirm field: enables the enclosing dialog's
14
+ * `[data-confirm-action]` control exactly while the field holds `phrase`, and clears the
15
+ * field when the dialog closes so every opening starts locked.
16
+ *
17
+ * @example <Input pattern={escaped} required mix={[confirmPhrase("acme-ops")]} />
18
+ */
19
+ export declare const confirmPhrase: MixinFactory<HTMLInputElement, [phrase: string]>;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Why JS: a button cannot disable itself until a field matches a phrase, so script keeps
3
+ * a type-to-confirm dialog's confirming control disabled until the text matches exactly.
4
+ * No-JS baseline: the field's `pattern` and `required` make the browser refuse a mismatch.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ /** Attribute marking a dialog's confirming control, which {@link confirmPhrase} enables on a match. */
11
+ export const CONFIRM_ACTION_ATTRIBUTE = "data-confirm-action";
12
+ /**
13
+ * Applied to a type-to-confirm field: enables the enclosing dialog's
14
+ * `[data-confirm-action]` control exactly while the field holds `phrase`, and clears the
15
+ * field when the dialog closes so every opening starts locked.
16
+ *
17
+ * @example <Input pattern={escaped} required mix={[confirmPhrase("acme-ops")]} />
18
+ */
19
+ export const confirmPhrase = createMixin((handle) => {
20
+ let phrase = "";
21
+ let controller;
22
+ handle.addEventListener("insert", (event) => {
23
+ controller?.abort();
24
+ controller = new AbortController();
25
+ connect(event.node, () => phrase, controller.signal);
26
+ });
27
+ handle.addEventListener("remove", () => {
28
+ controller?.abort();
29
+ controller = undefined;
30
+ });
31
+ return (next) => {
32
+ phrase = next;
33
+ };
34
+ });
35
+ /**
36
+ * Locks `input`'s dialog until `signal` aborts.
37
+ *
38
+ * @param input The phrase field.
39
+ * @param phrase Reads the phrase to match, which may change between renders.
40
+ * @param signal Ends every listener once the field leaves the document.
41
+ */
42
+ function connect(input, phrase, signal) {
43
+ let dialog = input.closest("dialog");
44
+ let action = dialog?.querySelector(`[${CONFIRM_ACTION_ATTRIBUTE}]`);
45
+ /** Enables the confirming control exactly while the field holds the phrase. */
46
+ let sync = () => {
47
+ if (action)
48
+ action.disabled = input.value !== phrase();
49
+ };
50
+ input.addEventListener("input", sync, { signal });
51
+ dialog?.addEventListener("close", () => {
52
+ input.value = "";
53
+ sync();
54
+ }, { signal });
55
+ sync();
56
+ }
@@ -40,3 +40,5 @@ export * from "./track-host-node.js";
40
40
  export * from "./validate.js";
41
41
  export * from "./view-transition.js";
42
42
  export * from "./while-live.js";
43
+ export * from "./confirm-phrase.js";
44
+ export * from "./viewer-time.js";
@@ -40,3 +40,5 @@ export * from "./track-host-node.js";
40
40
  export * from "./validate.js";
41
41
  export * from "./view-transition.js";
42
42
  export * from "./while-live.js";
43
+ export * from "./confirm-phrase.js";
44
+ export * from "./viewer-time.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Why JS: a server cannot know the viewer's time zone or clock, so a relative time it renders
3
+ * names the server's zone. No-JS baseline: the server's text and title stand, readable and
4
+ * correct in the zone they name.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { ElementProps, MixinFactory } from "remix/component";
10
+ /** Arguments of {@link viewerTime}: the locale, then the reference moment the text counts from. */
11
+ type ViewerTimeArgs = [locale: string | undefined, now?: string | number];
12
+ /**
13
+ * Rewrites the host `<time>` from its own `datetime` once it is live in a document, and after
14
+ * every update around it: the date and title in the viewer's zone, the text against `now` when
15
+ * given and the viewer's clock otherwise, so a fixed reference reads the same on every machine.
16
+ *
17
+ * @example <time dateTime={iso} mix={[viewerTime(locale, now)]}>{serverText}</time>
18
+ */
19
+ export declare const viewerTime: MixinFactory<HTMLTimeElement, ViewerTimeArgs, ElementProps>;
20
+ export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Why JS: a server cannot know the viewer's time zone or clock, so a relative time it renders
3
+ * names the server's zone. No-JS baseline: the server's text and title stand, readable and
4
+ * correct in the zone they name.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ import { formatRelativeTime } from "../utils/relative-time.js";
11
+ /**
12
+ * Rewrites the host `<time>` from its own `datetime` once it is live in a document, and after
13
+ * every update around it: the date and title in the viewer's zone, the text against `now` when
14
+ * given and the viewer's clock otherwise, so a fixed reference reads the same on every machine.
15
+ *
16
+ * @example <time dateTime={iso} mix={[viewerTime(locale, now)]}>{serverText}</time>
17
+ */
18
+ export const viewerTime = createMixin((handle) => {
19
+ let locale;
20
+ let now;
21
+ /** Formats the host's own `datetime` in the viewer's zone, against `now` or their clock. */
22
+ function rewrite(node) {
23
+ let formatted = formatRelativeTime(node.dateTime, {
24
+ now,
25
+ locale,
26
+ timeZone: new Intl.DateTimeFormat().resolvedOptions().timeZone,
27
+ });
28
+ if (!formatted.dateTime)
29
+ return;
30
+ node.textContent = formatted.text;
31
+ node.title = formatted.title;
32
+ }
33
+ handle.addEventListener("insert", (event) => rewrite(event.node));
34
+ handle.addEventListener("commit", (event) => rewrite(event.node));
35
+ return (nextLocale, nextNow) => {
36
+ locale = nextLocale;
37
+ now = nextNow;
38
+ return handle.element;
39
+ };
40
+ }, { ssr: false });
@@ -15,5 +15,6 @@ export * from "./landing.js";
15
15
  export * from "./output-caption-text.js";
16
16
  export * from "./panel-chrome.js";
17
17
  export * from "./range-thumb-appearance.js";
18
+ export * from "./segmented-control.js";
18
19
  export * from "./semantic-color-panel.js";
19
20
  export * from "./surface-control.js";
@@ -15,5 +15,6 @@ export * from "./landing.js";
15
15
  export * from "./output-caption-text.js";
16
16
  export * from "./panel-chrome.js";
17
17
  export * from "./range-thumb-appearance.js";
18
+ export * from "./segmented-control.js";
18
19
  export * from "./semantic-color-panel.js";
19
20
  export * from "./surface-control.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The `segmentedTrack()` and `segmentedItem()` style-mixin factories: the recessed track of a
3
+ * segmented control and the segments inside it, with the chosen segment raised on a filled,
4
+ * edged tile in heavier ink, so the choice reads at a glance in light and dark.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { UtilityMixin } from "@sdxc/u";
10
+ /**
11
+ * Options accepted by {@link segmentedItem}.
12
+ */
13
+ export interface SegmentedItemOptions {
14
+ /**
15
+ * Selector, relative to the segment, that matches while it is the chosen one.
16
+ *
17
+ * @default '&[aria-pressed="true"]'
18
+ */
19
+ selected?: string;
20
+ /**
21
+ * Selector, relative to the segment, that matches while keyboard focus is on it.
22
+ *
23
+ * @default "&:focus-visible"
24
+ */
25
+ focused?: string;
26
+ }
27
+ /**
28
+ * Draws the track the segments sit in: a recessed tint with a hairline edge and an inner
29
+ * padding that leaves room for the chosen segment's edge and the focus ring.
30
+ *
31
+ * @returns A `css()` mixin ready for the track's `mix` prop.
32
+ * @example
33
+ * <div role="group" aria-label={t("range")} mix={[segmentedTrack()]}>{segments}</div>;
34
+ */
35
+ export declare function segmentedTrack<Node extends Element = Element>(): UtilityMixin<Node>;
36
+ /**
37
+ * Draws one segment. A resting segment is muted ink on the track and takes a translucent
38
+ * wash on hover; the chosen one is a raised tile edged in the strong border role, which
39
+ * keeps at least 3:1 against the track in either scheme, with emphasis ink in semibold.
40
+ * The states compose into one rule, so the chosen state wins whatever order layers land in.
41
+ *
42
+ * @param options Selectors for the chosen and focused states.
43
+ * @returns A `css()` mixin ready for the segment's `mix` prop.
44
+ * @example
45
+ * <button aria-pressed={active ? "true" : "false"} mix={[segmentedItem()]}>{label}</button>;
46
+ * @example
47
+ * <label mix={[segmentedItem({ selected: "&:has(input:checked)", focused: "&:has(input:focus-visible)" })]} />;
48
+ */
49
+ export declare function segmentedItem<Node extends Element = Element>(options?: SegmentedItemOptions): UtilityMixin<Node>;