@sdxc/ui 2026.11.11 → 2026.11.14

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 (191) hide show
  1. package/README.md +89 -44
  2. package/dist/app/app-shell-toggle.d.ts +2 -0
  3. package/dist/app/app-shell-toggle.js +5 -2
  4. package/dist/app/app-shell.d.ts +25 -1
  5. package/dist/app/app-shell.js +73 -38
  6. package/dist/app/auto-refresh.d.ts +2 -0
  7. package/dist/app/auto-refresh.js +3 -3
  8. package/dist/app/behaviors/refresh-schedule.d.ts +8 -3
  9. package/dist/app/behaviors/refresh-schedule.js +4 -3
  10. package/dist/app/board.d.ts +123 -0
  11. package/dist/app/board.js +224 -0
  12. package/dist/app/chart.d.ts +2 -2
  13. package/dist/app/chart.js +7 -3
  14. package/dist/app/check-runs.d.ts +116 -0
  15. package/dist/app/check-runs.js +201 -0
  16. package/dist/app/code-view.d.ts +172 -0
  17. package/dist/app/code-view.js +414 -0
  18. package/dist/app/command-palette.d.ts +38 -3
  19. package/dist/app/command-palette.js +53 -5
  20. package/dist/app/contribution-graph.d.ts +106 -0
  21. package/dist/app/contribution-graph.js +289 -0
  22. package/dist/app/detail-sheet.d.ts +7 -0
  23. package/dist/app/detail-sheet.js +7 -7
  24. package/dist/app/diff.d.ts +200 -0
  25. package/dist/app/diff.js +702 -0
  26. package/dist/app/filter-bar.d.ts +20 -0
  27. package/dist/app/filter-bar.js +35 -15
  28. package/dist/app/filter-menu.d.ts +144 -0
  29. package/dist/app/filter-menu.js +480 -0
  30. package/dist/app/gantt.d.ts +108 -0
  31. package/dist/app/gantt.js +420 -0
  32. package/dist/app/index.d.ts +19 -0
  33. package/dist/app/index.js +19 -0
  34. package/dist/app/log-viewer.d.ts +120 -0
  35. package/dist/app/log-viewer.js +384 -0
  36. package/dist/app/merge-box.d.ts +97 -0
  37. package/dist/app/merge-box.js +227 -0
  38. package/dist/app/mixins/app-shell-controls.d.ts +4 -1
  39. package/dist/app/mixins/app-shell-controls.js +64 -4
  40. package/dist/app/mixins/auto-refresh.d.ts +5 -2
  41. package/dist/app/mixins/auto-refresh.js +9 -3
  42. package/dist/app/mixins/close-popover-on-submit.d.ts +16 -0
  43. package/dist/app/mixins/close-popover-on-submit.js +32 -0
  44. package/dist/app/mixins/code-view-selection.d.ts +60 -0
  45. package/dist/app/mixins/code-view-selection.js +276 -0
  46. package/dist/app/mixins/command-palette.d.ts +15 -4
  47. package/dist/app/mixins/command-palette.js +94 -6
  48. package/dist/app/mixins/contribution-graph-keys.d.ts +19 -0
  49. package/dist/app/mixins/contribution-graph-keys.js +155 -0
  50. package/dist/app/mixins/diff-interactions.d.ts +72 -0
  51. package/dist/app/mixins/diff-interactions.js +269 -0
  52. package/dist/app/mixins/filter-menu-keys.d.ts +41 -0
  53. package/dist/app/mixins/filter-menu-keys.js +91 -0
  54. package/dist/app/mixins/gantt-today.d.ts +17 -0
  55. package/dist/app/mixins/gantt-today.js +50 -0
  56. package/dist/app/mixins/log-viewer.d.ts +29 -0
  57. package/dist/app/mixins/log-viewer.js +333 -0
  58. package/dist/app/mixins/optimistic-toggle-sync.d.ts +5 -0
  59. package/dist/app/mixins/optimistic-toggle-sync.js +25 -1
  60. package/dist/app/mixins/save-bar-sync.d.ts +7 -1
  61. package/dist/app/mixins/save-bar-sync.js +23 -4
  62. package/dist/app/mixins/save-status-sync.js +23 -1
  63. package/dist/app/mixins/split-view.js +1 -1
  64. package/dist/app/mixins/submit-on-close.d.ts +17 -0
  65. package/dist/app/mixins/submit-on-close.js +52 -0
  66. package/dist/app/mixins/tree-filter.d.ts +44 -0
  67. package/dist/app/mixins/tree-filter.js +111 -0
  68. package/dist/app/mixins/tree-navigation.d.ts +50 -0
  69. package/dist/app/mixins/tree-navigation.js +216 -0
  70. package/dist/app/optimistic-toggle.d.ts +8 -0
  71. package/dist/app/optimistic-toggle.js +3 -2
  72. package/dist/app/page-header.d.ts +18 -3
  73. package/dist/app/page-header.js +105 -50
  74. package/dist/app/review-thread.d.ts +115 -0
  75. package/dist/app/review-thread.js +116 -0
  76. package/dist/app/save-bar.d.ts +5 -0
  77. package/dist/app/save-bar.js +1 -1
  78. package/dist/app/settings-layout.d.ts +5 -0
  79. package/dist/app/settings-layout.js +5 -5
  80. package/dist/app/skeleton.d.ts +9 -0
  81. package/dist/app/skeleton.js +28 -0
  82. package/dist/app/split-view.d.ts +4 -0
  83. package/dist/app/split-view.js +3 -3
  84. package/dist/app/styles/code-tokens.d.ts +24 -0
  85. package/dist/app/styles/code-tokens.js +47 -0
  86. package/dist/app/tab-bar.d.ts +59 -0
  87. package/dist/app/tab-bar.js +111 -0
  88. package/dist/app/tree.d.ts +111 -14
  89. package/dist/app/tree.js +202 -15
  90. package/dist/app/utils/ansi.d.ts +55 -0
  91. package/dist/app/utils/ansi.js +157 -0
  92. package/dist/app/utils/diff-rows.d.ts +82 -0
  93. package/dist/app/utils/diff-rows.js +209 -0
  94. package/dist/app/utils/fuzzy-path.d.ts +58 -0
  95. package/dist/app/utils/fuzzy-path.js +202 -0
  96. package/dist/app/utils/line-range.d.ts +48 -0
  97. package/dist/app/utils/line-range.js +61 -0
  98. package/dist/app/utils/log-lines.d.ts +107 -0
  99. package/dist/app/utils/log-lines.js +170 -0
  100. package/dist/app/utils/tree-filter.d.ts +19 -0
  101. package/dist/app/utils/tree-filter.js +26 -0
  102. package/dist/app/view-options.d.ts +2 -0
  103. package/dist/app/view-options.js +2 -2
  104. package/dist/chat/activity.d.ts +72 -0
  105. package/dist/chat/activity.js +184 -0
  106. package/dist/chat/composer-submit.d.ts +38 -0
  107. package/dist/chat/composer-submit.js +44 -0
  108. package/dist/chat/composer.d.ts +47 -0
  109. package/dist/chat/composer.js +100 -0
  110. package/dist/chat/index.d.ts +6 -0
  111. package/dist/chat/index.js +6 -0
  112. package/dist/chat/mixins/composer-send.d.ts +32 -0
  113. package/dist/chat/mixins/composer-send.js +121 -0
  114. package/dist/chat/mixins/reveal-stream.d.ts +68 -0
  115. package/dist/chat/mixins/reveal-stream.js +184 -0
  116. package/dist/chat/mixins/stream-target.d.ts +18 -0
  117. package/dist/chat/mixins/stream-target.js +38 -0
  118. package/dist/components/button.js +7 -1
  119. package/dist/components/character-count.d.ts +44 -0
  120. package/dist/components/character-count.js +68 -0
  121. package/dist/components/index.d.ts +2 -0
  122. package/dist/components/index.js +2 -0
  123. package/dist/components/label-chip.d.ts +42 -0
  124. package/dist/components/label-chip.js +86 -0
  125. package/dist/components/property-list.d.ts +9 -2
  126. package/dist/components/property-list.js +11 -6
  127. package/dist/components/textarea.js +6 -1
  128. package/dist/components/timeline.d.ts +62 -5
  129. package/dist/components/timeline.js +124 -5
  130. package/dist/docs/code-block.js +8 -31
  131. package/dist/docs/file-tree.js +3 -48
  132. package/dist/landing/case-study.d.ts +79 -0
  133. package/dist/landing/case-study.js +162 -0
  134. package/dist/landing/contributor-wall.d.ts +72 -0
  135. package/dist/landing/contributor-wall.js +129 -0
  136. package/dist/landing/countdown.d.ts +88 -0
  137. package/dist/landing/countdown.js +91 -0
  138. package/dist/landing/episode-player.d.ts +87 -0
  139. package/dist/landing/episode-player.js +113 -0
  140. package/dist/landing/faq-band.d.ts +3 -2
  141. package/dist/landing/faq-band.js +4 -3
  142. package/dist/landing/index.d.ts +7 -0
  143. package/dist/landing/index.js +7 -0
  144. package/dist/landing/landing-header.js +15 -4
  145. package/dist/landing/mixins/countdown-tick.d.ts +29 -0
  146. package/dist/landing/mixins/countdown-tick.js +65 -0
  147. package/dist/landing/mixins/usage-estimate-live.d.ts +32 -0
  148. package/dist/landing/mixins/usage-estimate-live.js +120 -0
  149. package/dist/landing/phone-frame.d.ts +2 -1
  150. package/dist/landing/price-list.d.ts +68 -0
  151. package/dist/landing/price-list.js +125 -0
  152. package/dist/landing/scroll-scene.d.ts +59 -0
  153. package/dist/landing/scroll-scene.js +70 -0
  154. package/dist/landing/sponsor-wall.d.ts +30 -6
  155. package/dist/landing/sponsor-wall.js +70 -14
  156. package/dist/landing/typed-terminal.d.ts +24 -6
  157. package/dist/landing/typed-terminal.js +22 -14
  158. package/dist/landing/usage-estimate.d.ts +127 -0
  159. package/dist/landing/usage-estimate.js +164 -0
  160. package/dist/landing/utils/countdown.d.ts +33 -0
  161. package/dist/landing/utils/countdown.js +42 -0
  162. package/dist/landing/utils/pause-toggle.d.ts +2 -1
  163. package/dist/mixins/character-count.d.ts +62 -0
  164. package/dist/mixins/character-count.js +139 -0
  165. package/dist/mixins/index.d.ts +6 -2
  166. package/dist/mixins/index.js +6 -2
  167. package/dist/mixins/invoker-fields.d.ts +18 -0
  168. package/dist/mixins/invoker-fields.js +60 -0
  169. package/dist/mixins/media-sync.d.ts +58 -0
  170. package/dist/mixins/media-sync.js +102 -0
  171. package/dist/mixins/menu-keys.d.ts +11 -0
  172. package/dist/mixins/menu-keys.js +79 -70
  173. package/dist/mixins/sortable.d.ts +96 -0
  174. package/dist/mixins/sortable.js +433 -0
  175. package/dist/utils/code-lines.d.ts +26 -0
  176. package/dist/utils/code-lines.js +29 -0
  177. package/dist/utils/file-icon.d.ts +31 -0
  178. package/dist/utils/file-icon.js +60 -0
  179. package/dist/utils/index.d.ts +2 -0
  180. package/dist/utils/index.js +2 -0
  181. package/dist/utils/write-cookie.d.ts +15 -15
  182. package/dist/utils/write-cookie.js +10 -16
  183. package/dist/video/index.d.ts +11 -0
  184. package/dist/video/index.js +11 -0
  185. package/dist/video/mixins/video-player-sync.d.ts +27 -0
  186. package/dist/video/mixins/video-player-sync.js +413 -0
  187. package/dist/video/utils/timeline.d.ts +55 -0
  188. package/dist/video/utils/timeline.js +90 -0
  189. package/dist/video/video-player.d.ts +261 -0
  190. package/dist/video/video-player.js +927 -0
  191. package/package.json +6 -3
@@ -9,6 +9,8 @@ import { HeadingScope, resolveHeadingLevel, TAG_BY_LEVEL } from "../components/h
9
9
  import { eyebrow } from "../styles/landing.js";
10
10
  /** Container the tier grids and the backer cloud query for their column steps. */
11
11
  const CONTAINER = "ui-landing-sponsor-wall";
12
+ /** The property the wall sets from `align`, read by the backer cloud and the actions row. */
13
+ const JUSTIFY = "--ui-sponsor-wall-justify";
12
14
  /** Translucent line the tier grids rule their cells with. */
13
15
  const HAIRLINE = "var(--ui-landing-hairline, color-mix(in oklch, CanvasText 8%, transparent))";
14
16
  /** Tier size {@link SponsorWall.Tier} applies when `size` is omitted. */
@@ -29,8 +31,9 @@ const PERSON_SIZES = {
29
31
  lg: "3.5rem",
30
32
  };
31
33
  /**
32
- * Stacks sponsor tiers, the backer cloud and the closing actions, and opens a heading
33
- * scope so every tier label sits one level under the band's title.
34
+ * Stacks sponsor tiers, the backer cloud and the closing actions, all server-rendered with no
35
+ * script, and opens a heading scope so every tier label sits one level under the band's title.
36
+ * Tier grids rule their cells in `--ui-landing-hairline`.
34
37
  *
35
38
  * @param handle Runtime handle carrying the host `<div>`'s props.
36
39
  * @returns The render function producing the wall's markup.
@@ -39,15 +42,24 @@ const PERSON_SIZES = {
39
42
  * <SponsorWall.Tier label={t("sponsor.gold")} size="xl">{goldMarks}</SponsorWall.Tier>
40
43
  * <SponsorWall.Tier label={t("sponsor.silver")} size="lg">{silverMarks}</SponsorWall.Tier>
41
44
  * </SponsorWall>
45
+ * @example
46
+ * <SponsorWall align="start" actions={<LinkButton href={profile}>Sponsor</LinkButton>}>
47
+ * <SponsorWall.Individuals label="Backers">
48
+ * <SponsorWall.Person href={ana.url} name="Ana Souza" src={ana.avatar} size="lg" showName />
49
+ * </SponsorWall.Individuals>
50
+ * </SponsorWall>
42
51
  */
43
52
  export function SponsorWall(handle) {
44
53
  return () => {
45
- let { actions, children, mix, ...rest } = handle.props;
54
+ let { actions, align, children, mix, ...rest } = handle.props;
46
55
  return (_jsxs("div", { ...rest, "data-slot": "sponsor-wall", mix: mergeMix([
47
56
  container(CONTAINER),
48
57
  vstack({ gap: 14, align: "stretch" }),
49
- raw({ inlineSize: "100%" }),
50
- ], mix), children: [_jsx(HeadingScope, { children: children }), actions ? (_jsx(CtaGroup, { "data-slot": "sponsor-wall-actions", mix: [raw({ justifyContent: "center" })], children: actions })) : null] }));
58
+ raw({
59
+ inlineSize: "100%",
60
+ [JUSTIFY]: align === "start" ? "flex-start" : "center",
61
+ }),
62
+ ], mix), children: [_jsx(HeadingScope, { children: children }), actions ? (_jsx(CtaGroup, { "data-slot": "sponsor-wall-actions", mix: [raw({ justifyContent: `var(${JUSTIFY}, center)` })], children: actions })) : null] }));
51
63
  };
52
64
  }
53
65
  /**
@@ -145,8 +157,8 @@ SponsorWall.Tier = function SponsorWallTier(handle) {
145
157
  };
146
158
  };
147
159
  /**
148
- * The individual backers: a centred, wrapping cloud of {@link SponsorWall.Person} circles
149
- * under an optional label.
160
+ * The individual backers: a wrapping cloud of {@link SponsorWall.Person} circles under an
161
+ * optional label, centred or on the start edge by the wall's `align`.
150
162
  *
151
163
  * @param handle Runtime handle carrying the host `<div>`'s props.
152
164
  * @returns The render function producing the cloud's markup.
@@ -167,7 +179,7 @@ SponsorWall.Individuals = function SponsorWallIndividuals(handle) {
167
179
  display: "flex",
168
180
  flexWrap: "wrap",
169
181
  alignItems: "center",
170
- justifyContent: "center",
182
+ justifyContent: `var(${JUSTIFY}, center)`,
171
183
  gap: "0.75rem",
172
184
  }),
173
185
  ], children: children })] }));
@@ -183,9 +195,9 @@ function initials(name) {
183
195
  .join("");
184
196
  }
185
197
  /**
186
- * One backer's circle in one rule: grayscale until a pointer rests on it or it takes
187
- * keyboard focus, so a wall of mixed photos reads as one band, and a hit area at least
188
- * 44px across around even the smallest circle.
198
+ * One backer's circle in one rule: grayscale until hovered or focused, so mixed photos read
199
+ * as one band, a 44px hit area around even the smallest circle, and the picture stacked over
200
+ * the initials, which show while it loads; a failed picture paints them over its broken icon.
189
201
  */
190
202
  function personCircle(diameter) {
191
203
  return combine([
@@ -212,30 +224,74 @@ function personCircle(diameter) {
212
224
  inset: `min(0px, calc((${diameter} - 2.75rem) / 2))`,
213
225
  borderRadius: "9999px",
214
226
  })),
227
+ when("& > *", raw({ gridArea: "1 / 1" })),
215
228
  when("& > img", raw({
216
229
  inlineSize: "100%",
217
230
  blockSize: "100%",
218
231
  borderRadius: "9999px",
219
232
  objectFit: "cover",
233
+ position: "relative",
220
234
  outline: "1px solid var(--ui-image-outline, rgb(0 0 0 / 0.1))",
221
235
  outlineOffset: "-1px",
222
236
  })),
237
+ when("& > img::before", raw({
238
+ content: "attr(data-initials)",
239
+ position: "absolute",
240
+ inset: "0",
241
+ zIndex: "1",
242
+ display: "grid",
243
+ placeItems: "center",
244
+ borderRadius: "9999px",
245
+ backgroundColor: "color-mix(in oklch, var(--ui-neutral-fg-emphasis, CanvasText) 10%, Canvas)",
246
+ })),
223
247
  motionSafe(raw({ transition: "filter 200ms" })),
224
248
  ]);
225
249
  }
226
250
  /**
227
- * One individual backer: a linked circle with their picture, or their initials, named by
251
+ * A named backer's caption: two centred lines at most in the heading ink, so names of any
252
+ * length keep every person in the cloud the same width.
253
+ */
254
+ function personName() {
255
+ return raw({
256
+ maxInlineSize: "100%",
257
+ fontSize: "0.8125rem",
258
+ lineHeight: "1.25",
259
+ fontWeight: "500",
260
+ textAlign: "center",
261
+ color: "var(--ui-neutral-fg-emphasis)",
262
+ textDecoration: "none",
263
+ overflowWrap: "anywhere",
264
+ display: "-webkit-box",
265
+ WebkitBoxOrient: "vertical",
266
+ WebkitLineClamp: "2",
267
+ overflow: "hidden",
268
+ });
269
+ }
270
+ /**
271
+ * One individual backer: a linked circle with their picture over their initials, named by
228
272
  * `name` for assistive technology and as a tooltip.
229
273
  *
230
274
  * @param handle Runtime handle carrying the host `<a>`'s props.
231
275
  * @returns The render function producing the backer's list item.
232
276
  * @example
233
277
  * <SponsorWall.Person href="https://github.com/ana" name="Ana Souza" src={ana} size="sm" />
278
+ * @example
279
+ * <SponsorWall.Person href="https://github.com/ana" name="Ana Souza" src={ana} size="lg" showName />
234
280
  */
235
281
  SponsorWall.Person = function SponsorWallPerson(handle) {
236
282
  return () => {
237
- let { href, mix, name, size, src, ...rest } = handle.props;
283
+ let { href, mix, name, showName, size, src, ...rest } = handle.props;
238
284
  let resolvedSize = size ?? DEFAULT_PERSON_SIZE;
239
- return (_jsx("li", { "data-slot": "sponsor-wall-person", mix: [raw({ display: "flex" })], children: _jsx("a", { ...rest, href: href, "aria-label": name, title: name, "data-size": resolvedSize, mix: mergeMix(personCircle(PERSON_SIZES[resolvedSize]), mix), children: src ? (_jsx("img", { src: src, alt: "", loading: "lazy" })) : (_jsx("span", { "aria-hidden": "true", children: initials(name) })) }) }));
285
+ return (_jsxs("li", { "data-slot": "sponsor-wall-person", mix: [
286
+ showName
287
+ ? raw({
288
+ display: "flex",
289
+ flexDirection: "column",
290
+ alignItems: "center",
291
+ gap: "0.5rem",
292
+ inlineSize: "6rem",
293
+ })
294
+ : raw({ display: "flex" }),
295
+ ], children: [_jsxs("a", { ...rest, href: href, "aria-label": name, title: name, "data-size": resolvedSize, mix: mergeMix(personCircle(PERSON_SIZES[resolvedSize]), mix), children: [_jsx("span", { "aria-hidden": "true", children: initials(name) }), src ? _jsx("img", { src: src, alt: "", loading: "lazy", "data-initials": initials(name) }) : null] }), showName ? (_jsx("a", { href: href, rel: rest.rel, tabIndex: -1, "aria-hidden": "true", "data-slot": "sponsor-wall-name", mix: [personName()], children: name })) : null] }));
240
296
  };
241
297
  };
@@ -13,6 +13,8 @@ import type { Handle, Props as TagProps, RemixNode } from "remix/component";
13
13
  export declare namespace TypedTerminal {
14
14
  /** Ink an output line prints in: a pass, a failure, or a quiet aside. */
15
15
  type Status = "ok" | "fail" | "muted";
16
+ /** Panel the session plays on: the dark terminal, or the page's own raised code card. */
17
+ type Variant = "terminal" | "code";
16
18
  /** One line of the session. */
17
19
  interface Line {
18
20
  /** An `input` line types itself out; an `output` line fades in once typed lines finish. */
@@ -29,23 +31,32 @@ export declare namespace TypedTerminal {
29
31
  * Props accepted by {@link TypedTerminal}.
30
32
  */
31
33
  interface Props extends Omit<TagProps<"div">, "children" | "title"> {
32
- /** Accessible name of the session's figure. Required — the library ships no copy. */
34
+ /** Accessible name of the session's figure, in the page's language. */
33
35
  "aria-label": string;
34
- /** Accessible name of the pause toggle. */
36
+ /**
37
+ * Accessible name of the pause toggle.
38
+ *
39
+ * @default "Pause the animation"
40
+ */
35
41
  pauseLabel?: string;
36
42
  /** Window title, such as a file name or a shell. */
37
43
  title?: RemixNode;
38
44
  /** Glyph before every input line, such as `$`; omit it for editor-style lines. */
39
45
  prompt?: string;
46
+ /**
47
+ * Panel the session plays on. `code` sets it on the raised code card in the page's
48
+ * own scheme, for a session that reads as a document being written.
49
+ * @default "terminal"
50
+ */
51
+ variant?: Variant;
40
52
  /** The session, in the order it plays. */
41
53
  lines: readonly Line[];
42
54
  }
43
55
  }
44
56
  /**
45
- * Renders the session as one `<pre>` in the terminal panel, with its pause toggle in the
46
- * panel's title bar, centred against the title.
47
- * Every line's full text is in the markup from the start, clipped only visually while it
48
- * types, so screen readers and copy read the whole session and reduced motion shows it done.
57
+ * Renders the session as one `<pre>` on the `variant`'s panel, its pause toggle in the title bar.
58
+ * The typing is CSS alone with nothing to hydrate: every line's full text is in the markup,
59
+ * clipped while it types, so screen readers, copy and reduced motion get the finished session.
49
60
  *
50
61
  * @param handle Runtime handle carrying the host `<div>`'s props.
51
62
  * @returns The render function producing the terminal's markup.
@@ -58,5 +69,12 @@ export declare namespace TypedTerminal {
58
69
  * { kind: "output", text: "✓ 1 step · 0.4s", status: "ok" },
59
70
  * ]}
60
71
  * />
72
+ * @example
73
+ * <TypedTerminal
74
+ * variant="code"
75
+ * aria-label="A spec being written"
76
+ * title="checkout.spec"
77
+ * lines={[{ kind: "input", text: 'Scenario: "Pay with a saved card"' }]}
78
+ * />
61
79
  */
62
80
  export declare function TypedTerminal(handle: Handle<TypedTerminal.Props>): () => import("remix/component").RemixElement;
@@ -27,10 +27,9 @@ const FADE = 1.5;
27
27
  /** Name of the caret's blink, shared by every terminal since it never depends on content. */
28
28
  const BLINK = "ui-typed-terminal-blink";
29
29
  /**
30
- * Renders the session as one `<pre>` in the terminal panel, with its pause toggle in the
31
- * panel's title bar, centred against the title.
32
- * Every line's full text is in the markup from the start, clipped only visually while it
33
- * types, so screen readers and copy read the whole session and reduced motion shows it done.
30
+ * Renders the session as one `<pre>` on the `variant`'s panel, its pause toggle in the title bar.
31
+ * The typing is CSS alone with nothing to hydrate: every line's full text is in the markup,
32
+ * clipped while it types, so screen readers, copy and reduced motion get the finished session.
34
33
  *
35
34
  * @param handle Runtime handle carrying the host `<div>`'s props.
36
35
  * @returns The render function producing the terminal's markup.
@@ -43,19 +42,26 @@ const BLINK = "ui-typed-terminal-blink";
43
42
  * { kind: "output", text: "✓ 1 step · 0.4s", status: "ok" },
44
43
  * ]}
45
44
  * />
45
+ * @example
46
+ * <TypedTerminal
47
+ * variant="code"
48
+ * aria-label="A spec being written"
49
+ * title="checkout.spec"
50
+ * lines={[{ kind: "input", text: 'Scenario: "Pay with a saved card"' }]}
51
+ * />
46
52
  */
47
53
  export function TypedTerminal(handle) {
48
54
  return () => {
49
- let { "aria-label": label, lines, mix, pauseLabel, prompt, title, ...rest } = handle.props;
55
+ let { "aria-label": label, lines, mix, pauseLabel, prompt, title, variant = "terminal", ...rest } = handle.props;
50
56
  let schedule = scheduleFor(lines);
51
57
  let nodes = [];
52
58
  for (let [index, line] of lines.entries()) {
53
59
  if (index > 0)
54
60
  nodes.push("\n");
55
61
  let slot = schedule.slots[index];
56
- nodes.push(line.kind === "input" ? (_jsx(InputLine, { text: line.text, prompt: prompt, slot: slot, schedule: schedule })) : (_jsx(OutputLine, { text: line.text, status: line.status, slot: slot, schedule: schedule })));
62
+ nodes.push(line.kind === "input" ? (_jsx(InputLine, { text: line.text, prompt: prompt, slot: slot, schedule: schedule })) : (_jsx(OutputLine, { text: line.text, status: line.status, variant: variant, slot: slot, schedule: schedule })));
57
63
  }
58
- return (_jsx("div", { ...rest, "data-slot": "motion-loop", mix: mergeMix([pausedWhenChecked('[data-slot="typed-terminal"]')], mix), children: _jsx("figure", { "aria-label": label, "data-slot": "typed-terminal", mix: [raw({ margin: "0", minInlineSize: "0" })], children: _jsx(CodeStage, { variant: "terminal", title: title, actions: _jsx(PauseToggle, { label: pauseLabel ?? "Pause the animation", mix: [headerToggle()] }), children: nodes }) }) }));
64
+ return (_jsx("div", { ...rest, "data-slot": "motion-loop", mix: mergeMix([pausedWhenChecked('[data-slot="typed-terminal"]')], mix), children: _jsx("figure", { "aria-label": label, "data-slot": "typed-terminal", mix: [raw({ margin: "0", minInlineSize: "0" })], children: _jsx(CodeStage, { variant: variant, title: title, actions: _jsx(PauseToggle, { label: pauseLabel ?? "Pause the animation", mix: [headerToggle()] }), children: nodes }) }) }));
59
65
  };
60
66
  }
61
67
  /**
@@ -184,7 +190,7 @@ function InputLine(handle) {
184
190
  /** A line the session prints: it fades in at its slot in the status's ink. */
185
191
  function OutputLine(handle) {
186
192
  return () => {
187
- let { schedule, slot, status, text } = handle.props;
193
+ let { schedule, slot, status, text, variant } = handle.props;
188
194
  let name = frameName("output", schedule, slot);
189
195
  return (_jsx("span", { "data-line": "", "data-kind": "output", "data-status": status, mix: [
190
196
  keyframes(name, {
@@ -195,21 +201,23 @@ function OutputLine(handle) {
195
201
  [`${RESET_AT + 2}%`]: { opacity: "0" },
196
202
  "100%": { opacity: "0" },
197
203
  }),
198
- raw({ color: statusInk(status) }),
204
+ raw({ color: statusInk(status, variant) }),
199
205
  motionSafe(raw(loop(name, schedule, "linear"))),
200
206
  ], children: text }));
201
207
  };
202
208
  }
203
209
  /**
204
- * The ink for an output status. The terminal panel inverts the page's scheme, so a pass
205
- * or failure takes the palette step that reads on the panel rather than on the page.
210
+ * The ink for an output status. The terminal panel inverts the page's scheme, so there a
211
+ * pass or failure takes the palette step that reads on the panel; the code card follows
212
+ * the page's scheme and takes the step that reads on the page.
206
213
  */
207
- function statusInk(status) {
214
+ function statusInk(status, variant) {
215
+ let [light, dark] = variant === "terminal" ? ["400", "700"] : ["700", "400"];
208
216
  if (status === "ok") {
209
- return "light-dark(var(--ui-color-success-400), var(--ui-color-success-700))";
217
+ return `light-dark(var(--ui-color-success-${light}), var(--ui-color-success-${dark}))`;
210
218
  }
211
219
  if (status === "fail") {
212
- return "light-dark(var(--ui-color-danger-400), var(--ui-color-danger-700))";
220
+ return `light-dark(var(--ui-color-danger-${light}), var(--ui-color-danger-${dark}))`;
213
221
  }
214
222
  if (status === "muted")
215
223
  return "color-mix(in oklab, currentColor 65%, transparent)";
@@ -0,0 +1,127 @@
1
+ /**
2
+ * A usage-pricing calculator that needs no script: a GET form of the reader's numbers
3
+ * beside the bill the server printed for them. In live mode the bill is a named frame that an
4
+ * island re-requests as the reader types, and without script the form still submits by GET.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
10
+ /**
11
+ * Prop types for {@link UsageEstimate}.
12
+ */
13
+ export declare namespace UsageEstimate {
14
+ /** One line of the bill. */
15
+ export interface Row {
16
+ /** What the line charges for, set as the row's header cell. */
17
+ label: RemixNode;
18
+ /** The arithmetic behind the amount, such as `35 h × $0.36`. */
19
+ detail?: RemixNode;
20
+ /** The formatted amount, such as `$12.60`. */
21
+ amount: RemixNode;
22
+ }
23
+ /** Where a live bill is loaded from. */
24
+ export interface Live {
25
+ /**
26
+ * The bill frame's name. The page's route answers a request carrying it in
27
+ * `X-Remix-Target` with a {@link UsageEstimate.Bill} alone.
28
+ */
29
+ frame: string;
30
+ /** The address the bill first loads: the page's own, with the query the fields show. */
31
+ src: string;
32
+ /**
33
+ * Milliseconds of quiet after the last input before the bill is re-requested.
34
+ * @default 250
35
+ */
36
+ delay?: number;
37
+ }
38
+ /** What every calculator takes: the form and where it submits. */
39
+ interface FormProps extends Omit<TagProps<"div">, "children"> {
40
+ /**
41
+ * Where the form submits, usually the page's own section anchor (`#pricing`), so the
42
+ * reloaded page opens on the new bill.
43
+ */
44
+ action: string;
45
+ /** The form's controls, named as the page reads them from its query. */
46
+ fields: RemixNode;
47
+ /** Label of the submit button. */
48
+ submitLabel: RemixNode;
49
+ }
50
+ /** A calculator whose bill is printed into the page and changes on submit. */
51
+ export interface StaticProps extends FormProps {
52
+ /** The bill for the query the page rendered, a {@link UsageEstimate.Bill}. */
53
+ bill: RemixNode;
54
+ /** Left unset: a printed bill and a live frame are the two exclusive modes. */
55
+ live?: undefined;
56
+ }
57
+ /** A calculator whose bill is a frame re-requested while the reader types. */
58
+ export interface LiveProps extends FormProps {
59
+ /** The frame the sheet holds, and where and how often it reloads as the reader types. */
60
+ live: Live;
61
+ /** Left unset: the route prints the bill into the `live` frame. */
62
+ bill?: undefined;
63
+ }
64
+ /**
65
+ * Props accepted by {@link UsageEstimate}: a printed `bill`, or a `live` frame that loads one.
66
+ */
67
+ export type Props = StaticProps | LiveProps;
68
+ /** Props accepted by {@link UsageEstimate.Bill}. */
69
+ export interface BillProps {
70
+ /** Accessible name of the bill's table, such as "Estimated monthly bill". */
71
+ label: string;
72
+ /** The bill's lines, in the order they add up. */
73
+ rows: readonly Row[];
74
+ /** The sum, set larger under a rule. */
75
+ total: Row;
76
+ /** A line under the total, such as what the price leaves out. */
77
+ footnote?: RemixNode;
78
+ /** The page's next step under the bill, such as its primary CTA. */
79
+ cta?: RemixNode;
80
+ }
81
+ /** Props accepted by {@link UsageEstimateLive}. */
82
+ export interface LiveIslandProps {
83
+ /** Name of the bill frame the island reloads, the calculator's `live.frame`. */
84
+ frame: string;
85
+ /** Milliseconds of quiet after the last input before the frame reloads. */
86
+ delay: number;
87
+ }
88
+ export {};
89
+ }
90
+ /**
91
+ * A GET form beside its bill on one card, side by side from 40rem, the sheet ruled in
92
+ * `--ui-landing-hairline`; with no script a submit reloads the page on the new bill. For `live`,
93
+ * map {@link UsageEstimateLive} (`@sdxc/ui/landing/usage-estimate`) to re-price while typing.
94
+ *
95
+ * @param handle Runtime handle carrying the host `<div>`'s props.
96
+ * @returns The render function producing the calculator's markup.
97
+ * @example
98
+ * <UsageEstimate
99
+ * action="#pricing"
100
+ * fields={<TextField label="Hours a month" type="number" name="hours" defaultValue="40" />}
101
+ * submitLabel="Estimate"
102
+ * bill={
103
+ * <UsageEstimate.Bill
104
+ * label="Estimated monthly bill"
105
+ * rows={[{ label: "Recorded hours", detail: "35 h × $0.36", amount: "$12.60" }]}
106
+ * total={{ label: "Per month", amount: "$12.60" }}
107
+ * />
108
+ * }
109
+ * />
110
+ * @example
111
+ * <UsageEstimate
112
+ * action="#pricing"
113
+ * fields={<TextField label="Hours a month" type="number" name="hours" defaultValue="40" />}
114
+ * submitLabel="Estimate"
115
+ * live={{ frame: "pricing-bill", src: "/?hours=40" }}
116
+ * />
117
+ */
118
+ export declare function UsageEstimate(handle: Handle<UsageEstimate.Props>): () => import("remix/component").RemixElement;
119
+ export declare namespace UsageEstimate {
120
+ var Bill: (handle: Handle<UsageEstimate.BillProps>) => () => import("remix/component").RemixElement;
121
+ }
122
+ /**
123
+ * The island a live calculator places in its form: it reloads the named bill frame for the
124
+ * form's query as the reader types, and on submit, with the address following through
125
+ * `replaceState`. Load `@sdxc/ui/landing/usage-estimate` in the browser entry.
126
+ */
127
+ export declare const UsageEstimateLive: EntryComponent<UsageEstimate.LiveIslandProps>;
@@ -0,0 +1,164 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { mergeMix, raw } from "@sdxc/u/general";
3
+ import { container, hidden } from "@sdxc/u/layout";
4
+ import { at } from "@sdxc/u/responsive";
5
+ import { clientEntry, Frame } from "remix/component";
6
+ import { Button } from "../components/button.js";
7
+ import { landingCtaChrome, landingSurface } from "../styles/landing.js";
8
+ import { usageEstimateLive } from "./mixins/usage-estimate-live.js";
9
+ /** Container the card declares, which its two columns query. */
10
+ const CONTAINER_NAME = "ui-usage-estimate";
11
+ /** Milliseconds of quiet after the last input before a live bill is re-requested. */
12
+ const DEFAULT_DELAY = 250;
13
+ /**
14
+ * A GET form beside its bill on one card, side by side from 40rem, the sheet ruled in
15
+ * `--ui-landing-hairline`; with no script a submit reloads the page on the new bill. For `live`,
16
+ * map {@link UsageEstimateLive} (`@sdxc/ui/landing/usage-estimate`) to re-price while typing.
17
+ *
18
+ * @param handle Runtime handle carrying the host `<div>`'s props.
19
+ * @returns The render function producing the calculator's markup.
20
+ * @example
21
+ * <UsageEstimate
22
+ * action="#pricing"
23
+ * fields={<TextField label="Hours a month" type="number" name="hours" defaultValue="40" />}
24
+ * submitLabel="Estimate"
25
+ * bill={
26
+ * <UsageEstimate.Bill
27
+ * label="Estimated monthly bill"
28
+ * rows={[{ label: "Recorded hours", detail: "35 h × $0.36", amount: "$12.60" }]}
29
+ * total={{ label: "Per month", amount: "$12.60" }}
30
+ * />
31
+ * }
32
+ * />
33
+ * @example
34
+ * <UsageEstimate
35
+ * action="#pricing"
36
+ * fields={<TextField label="Hours a month" type="number" name="hours" defaultValue="40" />}
37
+ * submitLabel="Estimate"
38
+ * live={{ frame: "pricing-bill", src: "/?hours=40" }}
39
+ * />
40
+ */
41
+ export function UsageEstimate(handle) {
42
+ return () => {
43
+ let { action, bill, fields, live, mix, submitLabel, ...rest } = handle.props;
44
+ return (_jsx("div", { ...rest, "data-slot": "usage-estimate", mix: mergeMix([landingSurface(), container(CONTAINER_NAME)], mix), children: _jsxs("div", { mix: [
45
+ raw({ display: "grid", gridTemplateColumns: "minmax(0, 1fr)" }),
46
+ at("40rem", CONTAINER_NAME, raw({ gridTemplateColumns: "minmax(0, 0.9fr) minmax(0, 1.1fr)" })),
47
+ ], children: [_jsxs("form", { method: "get", action: action, mix: [
48
+ raw({
49
+ display: "flex",
50
+ flexDirection: "column",
51
+ alignItems: "stretch",
52
+ gap: "1.25rem",
53
+ padding: "1.5rem",
54
+ }),
55
+ ], children: [fields, _jsx(Button, { type: "submit", color: "neutral", variant: "surface", mix: [landingCtaChrome()], children: submitLabel }), live === undefined ? null : (_jsx(UsageEstimateLive, { frame: live.frame, delay: live.delay ?? DEFAULT_DELAY }))] }), _jsx("div", { "data-slot": "usage-estimate-sheet", mix: [
56
+ raw({
57
+ display: "grid",
58
+ padding: "1.5rem",
59
+ backgroundColor: "color-mix(in oklch, CanvasText 3%, transparent)",
60
+ borderStartEndRadius: "inherit",
61
+ borderEndEndRadius: "inherit",
62
+ borderEndStartRadius: "inherit",
63
+ boxShadow: "inset 0 1px 0 var(--ui-landing-hairline)",
64
+ }),
65
+ at("40rem", CONTAINER_NAME, raw({
66
+ borderEndStartRadius: "0",
67
+ boxShadow: "inset 1px 0 0 var(--ui-landing-hairline)",
68
+ })),
69
+ ], children: live === undefined ? bill : _jsx(Frame, { name: live.frame, src: live.src }) })] }) }));
70
+ };
71
+ }
72
+ /**
73
+ * The bill a calculator shows: its lines and total in a column of tabular figures, then the
74
+ * footnote and the CTA at the sheet's foot. A live route returns it alone for the frame, and
75
+ * the total is a polite live region, so a re-priced bill is announced by its sum.
76
+ *
77
+ * @param handle Runtime handle carrying the bill.
78
+ * @returns The render function producing the bill.
79
+ * @example
80
+ * <UsageEstimate.Bill label="Estimated monthly bill" rows={[{ label: "Free hours", detail: "5 h × $0.00", amount: "$0.00" }]} total={{ label: "Per month", amount: "$0.00" }} footnote="Readers are free." />
81
+ */
82
+ UsageEstimate.Bill = function UsageEstimateBill(handle) {
83
+ return () => {
84
+ let { cta, footnote, label, rows, total } = handle.props;
85
+ return (_jsxs("div", { "data-slot": "usage-estimate-bill", mix: [
86
+ raw({
87
+ display: "flex",
88
+ flexDirection: "column",
89
+ gap: "1rem",
90
+ minBlockSize: "100%",
91
+ }),
92
+ ], children: [_jsxs("table", { "aria-label": label, mix: [
93
+ raw({
94
+ inlineSize: "100%",
95
+ borderCollapse: "collapse",
96
+ fontVariantNumeric: "tabular-nums",
97
+ fontSize: "0.9375rem",
98
+ }),
99
+ ], children: [_jsx("tbody", { children: rows.map((row) => (_jsx(BillRow, { row: row }))) }), _jsx("tfoot", { "aria-live": "polite", children: _jsx(BillRow, { row: total, total: true }) })] }), footnote === undefined ? null : (_jsx("p", { mix: [
100
+ raw({
101
+ margin: "0",
102
+ fontSize: "0.875rem",
103
+ color: "var(--ui-neutral-fg-muted)",
104
+ textWrap: "pretty",
105
+ }),
106
+ ], children: footnote })), cta === undefined ? null : (_jsx("div", { mix: [raw({ display: "grid", marginBlockStart: "auto" })], children: cta }))] }));
107
+ };
108
+ };
109
+ /**
110
+ * The island a live calculator places in its form: it reloads the named bill frame for the
111
+ * form's query as the reader types, and on submit, with the address following through
112
+ * `replaceState`. Load `@sdxc/ui/landing/usage-estimate` in the browser entry.
113
+ */
114
+ export const UsageEstimateLive = clientEntry("@sdxc/ui/landing/usage-estimate#UsageEstimateLive", function UsageEstimateLive(handle) {
115
+ /** Reloads the bill frame from `src`; a frame missing from the page rejects. */
116
+ let reload = async (src) => {
117
+ let frame = handle.frames.get(handle.props.frame);
118
+ if (frame === undefined)
119
+ throw new Error(`No frame named ${handle.props.frame}`);
120
+ await frame.reload({ src });
121
+ };
122
+ return () => (_jsx("span", { "data-slot": "usage-estimate-live", mix: [hidden(), usageEstimateLive({ reload, delay: handle.props.delay })] }));
123
+ });
124
+ /**
125
+ * One line of the bill: the label with its arithmetic under it, and the amount pinned to
126
+ * the end. The total's cells carry the rule, so it spans the table's full width.
127
+ */
128
+ function BillRow(handle) {
129
+ return () => {
130
+ let { row, total = false } = handle.props;
131
+ let cell = raw({
132
+ paddingBlock: total ? "0.875rem 0" : "0.5rem",
133
+ verticalAlign: "baseline",
134
+ borderBlockStart: total ? "1px solid var(--ui-neutral-border-strong)" : "0",
135
+ });
136
+ return (_jsxs("tr", { "data-total": total ? "" : undefined, children: [_jsxs("th", { scope: "row", mix: [
137
+ cell,
138
+ raw({
139
+ textAlign: "start",
140
+ fontWeight: total ? "600" : "400",
141
+ color: "var(--ui-neutral-fg-emphasis)",
142
+ }),
143
+ ], children: [row.label, row.detail === undefined ? null : (_jsx("span", { mix: [
144
+ raw({
145
+ display: "block",
146
+ fontFamily: "var(--ui-font-mono)",
147
+ fontSize: "0.75rem",
148
+ fontWeight: "400",
149
+ color: "var(--ui-neutral-fg-muted)",
150
+ }),
151
+ ], children: row.detail }))] }), _jsx("td", { mix: [
152
+ cell,
153
+ raw({
154
+ textAlign: "end",
155
+ whiteSpace: "nowrap",
156
+ paddingInlineStart: "1rem",
157
+ fontSize: total ? "1.75rem" : "inherit",
158
+ fontWeight: total ? "600" : "400",
159
+ letterSpacing: total ? "-0.02em" : "normal",
160
+ color: "var(--ui-neutral-fg-emphasis)",
161
+ }),
162
+ ], children: row.amount })] }));
163
+ };
164
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Splits the time left until a moment into days, hours, minutes and seconds, the arithmetic
3
+ * a launch, a sale or an event countdown shares between its server render and its island,
4
+ * so the two always agree on what the page reads.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /** Types for {@link countdownParts}. */
10
+ export declare namespace CountdownParts {
11
+ /** A moment as a `Date`, an ISO 8601 string or epoch milliseconds. */
12
+ type DateInput = Date | string | number;
13
+ /** The time left, each unit already carried into the next, and whether it has run out. */
14
+ interface Result {
15
+ /** `true` once `now` has reached `to`, when every unit reads zero. */
16
+ done: boolean;
17
+ days: number;
18
+ hours: number;
19
+ minutes: number;
20
+ seconds: number;
21
+ }
22
+ }
23
+ /**
24
+ * The whole units left from `now` until `to`, rounded down, so a countdown reads "0 days" only
25
+ * in the last day and never jumps ahead of the clock. A moment that does not parse counts as
26
+ * already reached.
27
+ *
28
+ * @param to The moment counted down to.
29
+ * @param now The moment counted from.
30
+ * @returns The days, hours, minutes and seconds left, and whether none are.
31
+ * @example countdownParts("2027-04-15T07:00:00Z", "2027-04-14T05:30:00Z") // { done: false, days: 1, hours: 1, minutes: 30, seconds: 0 }
32
+ */
33
+ export declare function countdownParts(to: CountdownParts.DateInput, now: CountdownParts.DateInput): CountdownParts.Result;