@sdxc/kit 2026.11.1 → 2026.11.4

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 (58) hide show
  1. package/README.md +68 -0
  2. package/changelog.jsonl +260 -0
  3. package/config.schema.json +14 -0
  4. package/dist/ci/install.d.ts +15 -0
  5. package/dist/ci/install.js +27 -0
  6. package/dist/ci/locate.d.ts +23 -0
  7. package/dist/ci/locate.js +43 -0
  8. package/dist/cli.js +6 -0
  9. package/dist/commands/ci/clean.d.ts +11 -0
  10. package/dist/commands/ci/clean.js +15 -0
  11. package/dist/commands/ci/list.d.ts +16 -0
  12. package/dist/commands/ci/list.js +24 -0
  13. package/dist/commands/ci/run.d.ts +70 -0
  14. package/dist/commands/ci/run.js +43 -0
  15. package/dist/commands/ci/signoff.d.ts +15 -0
  16. package/dist/commands/ci/signoff.js +15 -0
  17. package/dist/commands/ci/verify.d.ts +17 -0
  18. package/dist/commands/ci/verify.js +15 -0
  19. package/dist/commands/create.js +3 -0
  20. package/dist/commands/pkg.d.ts +16 -0
  21. package/dist/commands/pkg.js +71 -0
  22. package/dist/commands/routes.d.ts +1 -1
  23. package/dist/config.d.ts +10 -4
  24. package/dist/config.js +8 -0
  25. package/dist/contract.d.ts +65 -1
  26. package/dist/contract.js +51 -0
  27. package/dist/create/workspace.d.ts +15 -0
  28. package/dist/create/workspace.js +42 -0
  29. package/dist/doctor/checks.js +4 -0
  30. package/dist/doctor/ci.d.ts +15 -0
  31. package/dist/doctor/ci.js +63 -0
  32. package/dist/doctor/translations.d.ts +19 -0
  33. package/dist/doctor/translations.js +144 -0
  34. package/dist/package-manager.d.ts +2 -0
  35. package/dist/package-manager.js +16 -2
  36. package/dist/pkg/catalog.d.ts +12 -0
  37. package/dist/pkg/catalog.js +153 -0
  38. package/dist/pkg/resolve.d.ts +67 -0
  39. package/dist/pkg/resolve.js +147 -0
  40. package/dist/upgrade/changelog.d.ts +2 -2
  41. package/dist/upgrade/project.d.ts +2 -2
  42. package/package.json +10 -8
  43. package/registry/ui/banner.json +16 -0
  44. package/registry/ui/confirm.json +8 -4
  45. package/registry/ui/group.json +2 -2
  46. package/registry/ui/input.json +2 -2
  47. package/registry/ui/link-button.json +2 -2
  48. package/registry/ui/property-list.json +18 -0
  49. package/registry/ui/relative-time.json +17 -0
  50. package/registry/ui/status-dot.json +16 -0
  51. package/registry/ui/text-field.json +7 -3
  52. package/registry/ui/timeline.json +16 -0
  53. package/registry/ui/typeset.json +2 -2
  54. package/templates/app/.config/sdxc/ci.ts +26 -0
  55. package/templates/app/.github/workflows/ci.yml +46 -0
  56. package/templates/app/README.md +4 -0
  57. package/templates/app/package.json +1 -0
  58. package/templates/app/public/_headers +4 -0
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "input",
3
- "changedIn": "2026.11.1",
3
+ "changedIn": "2026.11.3",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Input"
7
7
  ],
8
8
  "source": {
9
9
  "path": "input.tsx",
10
- "content": "/**\n * A single-line native form field for free text entry, rendered as a\n * bordered, rounded `<input>` whose border, background, and focus ring read\n * from a semantic color role. It supplies the field's own box styling only,\n * ready to compose alongside a paired label, hint, and validation message,\n * and serves as the shared foundation every other single-line text control\n * in this library builds on.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, mergeMix } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Input} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Input.Color = \"neutral\";\n\n/**\n * Prop types for {@link Input}.\n */\nexport namespace Input {\n\t/**\n\t * Semantic color role for the focus-visible ring, each mapped to its\n\t * matching `--ui-*` variables. A field marked invalid always reads the\n\t * danger tone for its ring regardless of `color`.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix`\n\t * passthrough. `role` narrows to match whichever `type` is set, the\n\t * same correlation the platform itself defines between the two.\n\t */\n\texport type Props = TagProps<\"input\"> & {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t};\n}\n\n/**\n * Renders a native `<input>` host colored via `data-color`, with hover,\n * focus, and disabled states driven by native pseudo-classes; `[aria-invalid=\"true\"]`\n * together with `:user-invalid` forces the danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * <Input id=\"email\" type=\"email\" required />\n * @example\n * <Input\n * \taria-label={t(\"form.search.label\")}\n * \tcolor=\"brand\"\n * \tplaceholder={t(\"form.search.placeholder\")}\n * />\n * @example\n * <Input id=\"username\" aria-describedby=\"username-error\" aria-invalid=\"true\" />\n * <FieldError id=\"username-error\">{t(\"form.username.taken\")}</FieldError>\n */\nexport function Input(handle: Handle<Input.Props>) {\n\treturn () => {\n\t\tlet { color, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(10),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Focus draws a ring standing off the field, as every button here does, and the border\n\t\t\t\t\t\t * steps only to its hover weight: a strong border flush with the ring reads as the field\n\t\t\t\t\t\t * changing shape.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Pointer focus drops the platform outline and keyboard focus keeps the ring below. The\n\t\t\t\t\t\t * selectors exclude each other because `outline: none` is a shorthand, and from a later\n\t\t\t\t\t\t * cascade layer it resets the ring's color, width and style at once.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\t\t\tfocusVisible([\n\t\t\t\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\twhen('&[data-color=\"success\"]', outline(\"success.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"warning\"]', outline(\"warning.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"danger\"]', outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tinvalid([border(\"danger\"), outline({ color: \"danger.ring\", offset: 2 })]),\n\t\t\t\t\t\twhen(\"&:disabled\", [opacity(50), bg(\"neutral.bg-tint-hover\"), cursor(\"not-allowed\")]),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A single-line native form field for free text entry, rendered as a\n * bordered, rounded `<input>` whose border, background, and focus ring read\n * from a semantic color role. It supplies the field's own box styling only,\n * ready to compose alongside a paired label, hint, and validation message,\n * and serves as the shared foundation every other single-line text control\n * in this library builds on.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, mergeMix } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Input} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Input.Color = \"neutral\";\n\n/** An input joined to a `Group.Text` addon, whose group draws the field's focus and invalid rings. */\nconst BESIDE_ADDON = ':is([data-slot=\"group-text\"] ~ *, :has(~ [data-slot=\"group-text\"]))';\n\n/** An input standing on its own, drawing its focus and invalid rings itself. */\nconst STANDALONE = `:not(${BESIDE_ADDON})`;\n\n/**\n * Prop types for {@link Input}.\n */\nexport namespace Input {\n\t/**\n\t * Semantic color role for the focus-visible ring, each mapped to its\n\t * matching `--ui-*` variables. A field marked invalid always reads the\n\t * danger tone for its ring regardless of `color`.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix`\n\t * passthrough. `role` narrows to match whichever `type` is set, the\n\t * same correlation the platform itself defines between the two.\n\t */\n\texport type Props = TagProps<\"input\"> & {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t};\n}\n\n/**\n * Renders a native `<input>` host colored via `data-color`, with hover,\n * focus, and disabled states driven by native pseudo-classes; `[aria-invalid=\"true\"]`\n * together with `:user-invalid` forces the danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * <Input id=\"email\" type=\"email\" required />\n * @example\n * <Input\n * \taria-label={t(\"form.search.label\")}\n * \tcolor=\"brand\"\n * \tplaceholder={t(\"form.search.placeholder\")}\n * />\n * @example\n * <Input id=\"username\" aria-describedby=\"username-error\" aria-invalid=\"true\" />\n * <FieldError id=\"username-error\">{t(\"form.username.taken\")}</FieldError>\n */\nexport function Input(handle: Handle<Input.Props>) {\n\treturn () => {\n\t\tlet { color, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(10),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Focus draws a ring standing off the field, as every button here does, and the border\n\t\t\t\t\t\t * steps only to its hover weight: a strong border flush with the ring reads as the field\n\t\t\t\t\t\t * changing shape.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Pointer focus drops the platform outline and keyboard focus keeps the ring below. The\n\t\t\t\t\t\t * selectors exclude each other because `outline: none` is a shorthand, and from a later\n\t\t\t\t\t\t * cascade layer it resets the ring's color, width and style at once.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\t\t\tfocusVisible(border(\"neutral.border-hover\")),\n\t\t\t\t\t\twhen(`&:focus-visible${STANDALONE}`, [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\twhen('&[data-color=\"success\"]', outline(\"success.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"warning\"]', outline(\"warning.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"danger\"]', outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(`&:focus${BESIDE_ADDON}`, outline(\"none\")),\n\t\t\t\t\t\tinvalid(border(\"danger\")),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t`&:is(:user-invalid, [aria-invalid=\"true\"])${STANDALONE}`,\n\t\t\t\t\t\t\toutline({ color: \"danger.ring\", offset: 2 }),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:disabled\", [opacity(50), bg(\"neutral.bg-tint-hover\"), cursor(\"not-allowed\")]),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "link-button",
3
- "changedIn": "2026.11.1",
3
+ "changedIn": "2026.11.3",
4
4
  "dependencies": [
5
5
  "cta-group"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "link-button.tsx",
12
- "content": "/**\n * A navigation action styled to read as a button rather than inline text —\n * \"View project\", \"Download\", a dialog's \"Cancel\" that also navigates away.\n * Its host renders as a native `<a>`, sharing {@link Button}'s semantic\n * color role, visual weight variant, and size so a link and a button placed\n * side by side render pixel-identical.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, raw, userSelect, mergeMix } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { surfaceControl } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\nimport { CtaGroup } from \"@sdxc/ui/cta-group\";\n\n/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: LinkButton.Color = \"neutral\";\n\n/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: LinkButton.Variant = \"solid\";\n\n/** Size variant {@link LinkButton} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: LinkButton.Size = \"md\";\n\n/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: LinkButton.Prefetch = \"none\";\n\n/**\n * Prop types for {@link LinkButton}.\n */\nexport namespace LinkButton {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Visual weight the link renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, a fully\n\t * transparent fill with just a colored label, or a raised `surface` fill with\n\t * the emphasis ink and a tactile edge — a secondary that reads as a control\n\t * beside a solid primary, and turns translucent inside inverse and brand bands.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\" | \"surface\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t * Inside a {@link CtaGroup} an omitted size takes the group's, so a hero row\n\t * sizes every action at once; `\"md\"` is the 40px landing CTA.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link LinkButton}. A type alias rather than an\n\t * interface, since the native anchor props resolve to an intersection\n\t * type that TypeScript can't use in an `extends` clause.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, since each\n\t\t * hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.\n\t\t */\n\t\tprefetch?: Prefetch;\n\t};\n}\n\n/**\n * Renders a native `<a>` host, colored and shaped through the same color,\n * variant, and size data attributes as {@link Button}. `aria-disabled=\"true\"`\n * keeps it focusable while dimmed, so drop `href` too for full inertness.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <LinkButton href=\"/projects/new\" prefetch=\"intent\">{t(\"actions.createProject\")}</LinkButton>\n * @example\n * <LinkButton href=\"/projects\" color=\"neutral\" variant=\"outline\" size=\"sm\">{t(\"actions.cancel\")}</LinkButton>\n * @example\n * <LinkButton href=\"/export/report.csv\" download aria-disabled={!hasReport || undefined}>{t(\"actions.download\")}</LinkButton>\n */\nexport function LinkButton(handle: Handle<LinkButton.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, prefetch, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet group = handle.context.get(CtaGroup) as CtaGroup.Context | undefined;\n\t\tlet resolvedSize = size ?? group?.size ?? DEFAULT_SIZE;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\t\tmix={mergeMix(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph inside a link button is measured and held at size by the same rules\n\t\t\t\t\t\t\t * `Button` states, for the same reasons: it is sized against the label beside\n\t\t\t\t\t\t\t * it so the row keeps the height its text and padding ask for, and it never\n\t\t\t\t\t\t\t * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-button-radius, var(--ui-radius-md, 0.375rem))\",\n\t\t\t\t\t\t\t\tfontWeight: \"var(--ui-button-weight, 500)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", [pi(3), pb(1.5), minBs(\"2rem\"), when(\"& > svg\", [is(3), bs(3)])]),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph beside a label carries its own side bearing, so the padding on that\n\t\t\t\t\t\t\t * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"variant\", \"outline\", bg(\"transparent\")),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"variant\", \"ghost\", [bg(\"transparent\"), border(\"transparent\")]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"surface\", surfaceControl()),\n\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tmix,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
12
+ "content": "/**\n * A navigation action styled to read as a button rather than inline text —\n * \"View project\", \"Download\", a dialog's \"Cancel\" that also navigates away.\n * Its host renders as a native `<a>`, sharing {@link Button}'s semantic\n * color role, visual weight variant, and size so a link and a button placed\n * side by side render pixel-identical.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, raw, userSelect, mergeMix } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { surfaceControl } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\nimport { CtaGroup } from \"@sdxc/ui/cta-group\";\n\n/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: LinkButton.Color = \"neutral\";\n\n/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: LinkButton.Variant = \"solid\";\n\n/** Size variant {@link LinkButton} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: LinkButton.Size = \"md\";\n\n/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: LinkButton.Prefetch = \"none\";\n\n/**\n * Prop types for {@link LinkButton}.\n */\nexport namespace LinkButton {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Visual weight the link renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, a fully\n\t * transparent fill with just a colored label, or a raised `surface` fill with\n\t * the emphasis ink and a tactile edge — a secondary that reads as a control\n\t * beside a solid primary, and turns translucent inside inverse and brand bands.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\" | \"surface\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t * Inside a {@link CtaGroup} an omitted size takes the group's, so a hero row\n\t * sizes every action at once; `\"md\"` is the 40px landing CTA.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link LinkButton}. A type alias rather than an\n\t * interface, since the native anchor props resolve to an intersection\n\t * type that TypeScript can't use in an `extends` clause.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, since each\n\t\t * hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.\n\t\t */\n\t\tprefetch?: Prefetch;\n\t};\n}\n\n/**\n * Renders a native `<a>` host, colored and shaped through the same color,\n * variant, and size data attributes as {@link Button}. `aria-disabled=\"true\"`\n * keeps it focusable while dimmed, so drop `href` too for full inertness.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <LinkButton href=\"/projects/new\" prefetch=\"intent\">{t(\"actions.createProject\")}</LinkButton>\n * @example\n * <LinkButton href=\"/projects\" color=\"neutral\" variant=\"outline\" size=\"sm\">{t(\"actions.cancel\")}</LinkButton>\n * @example\n * <LinkButton href=\"/export/report.csv\" download aria-disabled={!hasReport || undefined}>{t(\"actions.download\")}</LinkButton>\n */\nexport function LinkButton(handle: Handle<LinkButton.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, prefetch, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet group = handle.context.get(CtaGroup) as CtaGroup.Context | undefined;\n\t\tlet resolvedSize = size ?? group?.size ?? DEFAULT_SIZE;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\t\tmix={mergeMix(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph inside a link button is measured and held at size by the same rules\n\t\t\t\t\t\t\t * `Button` states, for the same reasons: it is sized against the label beside\n\t\t\t\t\t\t\t * it so the row keeps the height its text and padding ask for, and it never\n\t\t\t\t\t\t\t * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-button-radius, var(--ui-radius-md, 0.375rem))\",\n\t\t\t\t\t\t\t\tfontWeight: \"var(--ui-button-weight, 500)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", [pi(3), pb(1.5), minBs(\"2rem\"), when(\"& > svg\", [is(3), bs(3)])]),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph beside a label carries its own side bearing, so the padding on that\n\t\t\t\t\t\t\t * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Each variant's resting fill sits in the same block as its hover and active\n\t\t\t\t\t\t\t * fills, so the state rules win on specificity and keep winning whatever order\n\t\t\t\t\t\t\t * a page first uses the classes in.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\t\tborder(\"transparent\"),\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"surface\", surfaceControl()),\n\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tmix,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
13
13
  },
14
14
  "test": {
15
15
  "path": "link-button.test.tsx",
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "property-list",
3
+ "changedIn": "2026.11.3",
4
+ "dependencies": [
5
+ "popover"
6
+ ],
7
+ "exports": [
8
+ "PropertyList"
9
+ ],
10
+ "source": {
11
+ "path": "property-list.tsx",
12
+ "content": "/**\n * Label/value rows for one record's properties, as a `<dl>`: a fixed label column beside\n * each value that stacks once its container narrows, empty values named in words, and an\n * editable row whose value opens an anchored native popover holding the app's own form.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { ChevronDownIcon } from \"@sdxc/icons\";\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded, transition } from \"@sdxc/u/effects\";\nimport { cursor, raw, mergeMix } from \"@sdxc/u/general\";\nimport { container, flex, gap, grid, items, justify, shrink, vstack } from \"@sdxc/u/layout\";\nimport { is, m, minBs, minIs, p, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover } from \"@sdxc/u/state\";\nimport { leading, tabularNums, text, textAlign, weight } from \"@sdxc/u/typography\";\n\nimport { Popover } from \"@sdxc/ui/popover\";\n\n/** Container the list names, so its rows stack against the list's own width. */\nconst PROPERTY_LIST_CONTAINER = \"ui-property-list\";\n\n/** Layout a list takes when `variant` is left unset. */\nconst DEFAULT_VARIANT: PropertyList.Variant = \"rows\";\n\n/** Shown for a value the caller leaves empty and names no empty text for. */\nconst DEFAULT_EMPTY = \"—\";\n\n/**\n * Prop types for {@link PropertyList} and its compound parts.\n */\nexport namespace PropertyList {\n\t/**\n\t * `\"rows\"` sets each label beside its value in a ruled-free column; `\"tiles\"` sets each\n\t * property in its own bordered tile, two to a row, for a record's headline figures.\n\t */\n\texport type Variant = \"rows\" | \"tiles\";\n\n\t/** What {@link PropertyList} shares with its items. */\n\texport interface Context {\n\t\tvariant: Variant;\n\t}\n\n\t/** Every native `<dl>` attribute, plus the layout variant. */\n\texport interface Props extends TagProps<\"dl\"> {\n\t\t/** @default {@link DEFAULT_VARIANT} */\n\t\tvariant?: Variant;\n\t}\n\n\t/**\n\t * Makes a row editable in place: its value becomes a button that opens a popover\n\t * anchored under it, holding whatever form the app renders as `content`.\n\t */\n\texport interface Edit {\n\t\t/** Id of the popover, which the value button targets. */\n\t\tid: string;\n\t\t/** What the button does, read before the current value, such as \"Edit assignee\". */\n\t\tlabel: string;\n\t\t/** The popover's content: the app's form, its described options and its submit. */\n\t\tcontent: RemixNode;\n\t}\n\n\t/** Every native `<div>` attribute the row's group accepts, plus its label and value. */\n\texport interface ItemProps extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** The property's name, rendered in the `<dt>`. */\n\t\tlabel: RemixNode;\n\t\t/**\n\t\t * What the row says when `children` is empty, such as \"None\" or \"No reviews\".\n\t\t *\n\t\t * @default \"—\"\n\t\t */\n\t\tempty?: RemixNode;\n\t\t/** Turns the value into a button opening an anchored edit popover. */\n\t\tedit?: Edit;\n\t\t/** The value: text, a link, a badge, an avatar with a name. */\n\t\tchildren?: RemixNode;\n\t}\n}\n\n/**\n * Whether `node` renders nothing a reader would see, which is when the row shows its\n * named empty value instead.\n *\n * @param node The value a row was given.\n * @returns `true` for `null`, `undefined`, `false`, `\"\"` and a list of those.\n */\nfunction isEmptyValue(node: RemixNode | undefined): boolean {\n\tif (node === null || node === undefined || node === false || node === \"\") return true;\n\tif (Array.isArray(node)) return node.every((child) => isEmptyValue(child));\n\treturn false;\n}\n\n/**\n * Renders the `<dl>`. Each item is a `<div>` grouping one `<dt>` and one `<dd>`, which\n * keeps the label/value pairing in the accessibility tree; the list measures itself as a\n * container, so rows stack in a narrow side pane at any viewport width.\n *\n * @param handle Runtime handle carrying the `<dl>`'s props and providing the variant.\n * @returns The render function producing the list's markup.\n * @example\n * <PropertyList>\n * \t<PropertyList.Item label=\"Status\"><Badge color=\"success\">Up</Badge></PropertyList.Item>\n * \t<PropertyList.Item label=\"Reviewers\" empty=\"No reviews\" />\n * </PropertyList>\n * @example\n * <PropertyList variant=\"tiles\">\n * \t<PropertyList.Item label=\"Uptime\">99.98%</PropertyList.Item>\n * </PropertyList>\n */\nexport function PropertyList(handle: Handle<PropertyList.Props, PropertyList.Context>) {\n\treturn () => {\n\t\tlet { variant, mix, ...rest } = handle.props;\n\t\tlet resolved = variant ?? DEFAULT_VARIANT;\n\t\thandle.context.set({ variant: resolved });\n\n\t\treturn (\n\t\t\t<dl\n\t\t\t\tdata-slot=\"property-list\"\n\t\t\t\tdata-variant={resolved}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tm(0),\n\t\t\t\t\t\tis(\"100%\"),\n\t\t\t\t\t\tcontainer(PROPERTY_LIST_CONTAINER),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\tresolved === \"tiles\"\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\tgrid(),\n\t\t\t\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * Each tile claims at least half the row, so two fit side by side once\n\t\t\t\t\t\t\t\t\t * both reach 9rem and a narrower list falls back to one column.\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\t\tgridTemplateColumns:\n\t\t\t\t\t\t\t\t\t\t\t\"repeat(auto-fit, minmax(max(9rem, calc(50% - 0.25rem)), 1fr))\",\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: vstack({ gap: 0 }),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders one property. In the rows variant the label column holds\n * `--ui-property-list-label-width` (9rem) from a 22rem container up and stacks above the\n * value below it; a value-less row names its emptiness in muted text.\n *\n * @param handle Runtime handle carrying the group `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <PropertyList.Item label=\"Owner\"><a href=\"/people/ana\">Ana Souza</a></PropertyList.Item>\n * @example\n * <PropertyList.Item\n * \tlabel=\"Assignee\"\n * \tempty=\"No one\"\n * \tedit={{ id: \"edit-assignee\", label: \"Edit assignee\", content: <AssigneeForm /> }}\n * >\n * \t{assignee?.name}\n * </PropertyList.Item>\n */\nPropertyList.Item = function PropertyListItem(handle: Handle<PropertyList.ItemProps>) {\n\treturn () => {\n\t\tlet { label, empty, edit, children, mix, ...rest } = handle.props;\n\t\tlet { variant } = handle.context.get(PropertyList);\n\t\tlet tiles = variant === \"tiles\";\n\t\tlet isEmpty = isEmptyValue(children);\n\n\t\tlet value = isEmpty ? (\n\t\t\t<span data-slot=\"property-empty\" mix={[fg(\"neutral.muted\")]}>\n\t\t\t\t{empty ?? DEFAULT_EMPTY}\n\t\t\t</span>\n\t\t) : (\n\t\t\tchildren\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"property\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\ttiles\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\tvstack({ gap: 1 }),\n\t\t\t\t\t\t\t\tp(3),\n\t\t\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\t\t\tborder({ color: \"neutral.border\", width: 1 }),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\tgrid(),\n\t\t\t\t\t\t\t\tpb(1),\n\t\t\t\t\t\t\t\titems(\"baseline\"),\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * The stacked and side-by-side tracks live in one rule, so the label column\n\t\t\t\t\t\t\t\t * holds at its width whatever order the stylesheet layers land in.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\tgridTemplateColumns: \"minmax(0, 1fr)\",\n\t\t\t\t\t\t\t\t\trowGap: \"0.125rem\",\n\t\t\t\t\t\t\t\t\t[`@container ${PROPERTY_LIST_CONTAINER} (min-width: 22rem)`]: {\n\t\t\t\t\t\t\t\t\t\tgridTemplateColumns: \"var(--ui-property-list-label-width, 9rem) minmax(0, 1fr)\",\n\t\t\t\t\t\t\t\t\t\tcolumnGap: \"1rem\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<dt\n\t\t\t\t\tdata-slot=\"property-label\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tm(0),\n\t\t\t\t\t\tminIs(0),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\ttiles ? text(\"xs\") : text(\"sm\"),\n\t\t\t\t\t\tleading(\"1.25rem\"),\n\t\t\t\t\t\tpb(tiles ? 0 : 1.5),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</dt>\n\t\t\t\t<dd\n\t\t\t\t\tdata-slot=\"property-value\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tm(0),\n\t\t\t\t\t\tminIs(0),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tgap(1.5),\n\t\t\t\t\t\traw({ flexWrap: \"wrap\" }),\n\t\t\t\t\t\tminBs(\"2rem\"),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\ttiles ? [text(\"lg\"), weight(\"semibold\")] : null,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{edit ? (\n\t\t\t\t\t\t<PropertyEdit edit={edit} empty={isEmpty}>\n\t\t\t\t\t\t\t{value}\n\t\t\t\t\t\t</PropertyEdit>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tvalue\n\t\t\t\t\t)}\n\t\t\t\t</dd>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/** Props {@link PropertyEdit} reads. */\ninterface PropertyEditProps {\n\tedit: PropertyList.Edit;\n\tempty: boolean;\n\tchildren: RemixNode;\n}\n\n/**\n * The editable value: a full-width button naming its action before the current value,\n * and the popover it opens. The button is the popover's invoker, which makes it the\n * popover's implicit anchor, so the form opens directly under its row.\n *\n * @param handle Runtime handle carrying the edit description and the rendered value.\n * @returns The render function producing the button and its popover.\n */\nfunction PropertyEdit(handle: Handle<PropertyEditProps>) {\n\treturn () => {\n\t\tlet { edit, children } = handle.props;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tdata-slot=\"property-edit\"\n\t\t\t\t\tpopovertarget={edit.id}\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\t\tgap(1.5),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tminBs(\"2rem\"),\n\t\t\t\t\t\tpi(2),\n\t\t\t\t\t\traw({ marginInline: \"-0.5rem\", inlineSize: \"calc(100% + 1rem)\" }),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"transparent\", width: 0 }),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tfg(),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\ttextAlign(\"start\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\ttransition(\"background-color\"),\n\t\t\t\t\t\thover(bg(\"neutral.tint\")),\n\t\t\t\t\t\tfocusVisible(outline({ color: \"brand.ring\", width: 2, offset: -2 })),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t<span mix={[flex(), items(\"center\"), gap(1.5), raw({ flexWrap: \"wrap\" }), minIs(0)]}>\n\t\t\t\t\t\t<span mix={[visuallyHidden()]}>{`${edit.label}: `}</span>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</span>\n\t\t\t\t\t<ChevronDownIcon size={14} aria-hidden=\"true\" mix={[shrink(0), fg(\"neutral.muted\")]} />\n\t\t\t\t</button>\n\t\t\t\t<Popover\n\t\t\t\t\tid={edit.id}\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-label={edit.label}\n\t\t\t\t\tdata-slot=\"property-popover\"\n\t\t\t\t\tmix={[p(3), is(\"min(20rem, calc(100vw - 2rem))\"), text(\"sm\")]}\n\t\t\t\t>\n\t\t\t\t\t{edit.content}\n\t\t\t\t</Popover>\n\t\t\t</>\n\t\t);\n\t};\n}\n"
13
+ },
14
+ "test": {
15
+ "path": "property-list.browser.test.tsx",
16
+ "content": "/**\n * Lays PropertyList out in a real browser: the label column holds one width down every\n * row and stacks in a narrow container, an empty value reads its name, the edit popover\n * opens under its own row, and the tiles variant goes two-up only where it fits.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, beforeEach, describe, expect, test } from \"vitest\";\nimport { page, userEvent } from \"vitest/browser\";\n\nimport { PropertyList } from \"@sdxc/ui/property-list\";\n\n/** Mounts `node` in a host `width` pixels wide and returns the host. */\nfunction mount(node: JSX.Element, width = 480): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.width = `${width}px`;\n\tdocument.body.appendChild(host);\n\trender(node, { container: host });\n\treturn host;\n}\n\n/** A monitor's properties, one of them editable and one of them empty. */\nfunction Monitor() {\n\treturn () => (\n\t\t<PropertyList>\n\t\t\t<PropertyList.Item label=\"Status\">Up</PropertyList.Item>\n\t\t\t<PropertyList.Item label=\"Region\">Frankfurt, São Paulo and Singapore</PropertyList.Item>\n\t\t\t<PropertyList.Item label=\"Reviewers\" empty=\"No reviews\" />\n\t\t\t<PropertyList.Item\n\t\t\t\tlabel=\"Owner\"\n\t\t\t\tedit={{\n\t\t\t\t\tid: \"edit-owner\",\n\t\t\t\t\tlabel: \"Edit owner\",\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t<input type=\"radio\" name=\"owner\" value=\"ana\" /> Ana\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tAna Souza\n\t\t\t</PropertyList.Item>\n\t\t</PropertyList>\n\t);\n}\n\n/** The value cells, in source order. */\nfunction values(host: HTMLElement): HTMLElement[] {\n\treturn [...host.querySelectorAll<HTMLElement>(\"dd\")];\n}\n\nbeforeEach(async () => {\n\tawait page.viewport(1280, 800);\n});\n\nafterEach(() => {\n\tdocument.body.replaceChildren();\n});\n\ndescribe(\"PropertyList\", () => {\n\ttest(\"fills a flex row it sits in, though it measures its own width\", () => {\n\t\tlet host = mount(<Monitor />);\n\t\thost.style.display = \"flex\";\n\n\t\texpect(host.querySelector(\"dl\")!.getBoundingClientRect().width).toBeCloseTo(480, 0);\n\t});\n\n\ttest(\"pairs each label and value in a description list\", () => {\n\t\tlet host = mount(<Monitor />);\n\t\tlet list = host.querySelector(\"dl\")!;\n\n\t\texpect(list.querySelectorAll(\":scope > div > dt\")).toHaveLength(4);\n\t\texpect(list.querySelectorAll(\":scope > div > dd\")).toHaveLength(4);\n\t});\n\n\ttest(\"starts every value at the same inline offset beside a fixed label column\", () => {\n\t\tlet host = mount(<Monitor />);\n\t\tlet lefts = values(host).map((dd) => Math.round(dd.getBoundingClientRect().left));\n\t\tlet label = host.querySelector(\"dt\")!.getBoundingClientRect();\n\t\tlet row = host.querySelector(\"dt\")!.parentElement!.getBoundingClientRect();\n\n\t\texpect(new Set(lefts).size).toBe(1);\n\t\texpect(label.width).toBeCloseTo(144, 0);\n\t\texpect(lefts[0]! - row.left).toBeCloseTo(144 + 16, 0);\n\t});\n\n\ttest(\"stacks each label above its value in a narrow container\", () => {\n\t\tlet host = mount(<Monitor />, 300);\n\t\tlet label = host.querySelector(\"dt\")!.getBoundingClientRect();\n\t\tlet value = host.querySelector(\"dd\")!.getBoundingClientRect();\n\n\t\texpect(value.top).toBeGreaterThanOrEqual(label.bottom - 1);\n\t\texpect(value.left).toBeCloseTo(label.left, 0);\n\t\texpect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth);\n\t});\n\n\ttest(\"names an empty value in muted words\", () => {\n\t\tlet host = mount(<Monitor />);\n\t\tlet empty = host.querySelector('[data-slot=\"property-empty\"]')!;\n\n\t\texpect(empty.textContent).toBe(\"No reviews\");\n\t\texpect(empty.closest(\"dd\")?.previousElementSibling?.textContent).toBe(\"Reviewers\");\n\t});\n\n\ttest(\"falls back to an em dash for an empty value with no name\", () => {\n\t\tlet host = mount(\n\t\t\t<PropertyList>\n\t\t\t\t<PropertyList.Item label=\"Last check\">{null}</PropertyList.Item>\n\t\t\t</PropertyList>,\n\t\t);\n\n\t\texpect(host.querySelector(\"dd\")?.textContent).toBe(\"—\");\n\t});\n\n\ttest(\"opens the edit popover anchored under its own row\", async () => {\n\t\tlet host = mount(<Monitor />);\n\t\tlet button = host.querySelector<HTMLButtonElement>('[data-slot=\"property-edit\"]')!;\n\t\tlet popover = host.querySelector<HTMLElement>(\"#edit-owner\")!;\n\n\t\texpect(button.getAttribute(\"popovertarget\")).toBe(\"edit-owner\");\n\t\texpect(button.textContent).toContain(\"Edit owner: Ana Souza\");\n\n\t\tawait userEvent.click(button);\n\t\texpect(popover.matches(\":popover-open\")).toBe(true);\n\n\t\tlet anchor = button.getBoundingClientRect();\n\t\tlet box = popover.getBoundingClientRect();\n\t\texpect(box.top).toBeGreaterThanOrEqual(anchor.bottom);\n\t\texpect(box.top - anchor.bottom).toBeLessThan(12);\n\t\texpect(box.left).toBeCloseTo(anchor.left, 0);\n\t\texpect(popover.getAttribute(\"aria-label\")).toBe(\"Edit owner\");\n\t});\n\n\ttest(\"sets tiles two to a row only where two fit\", () => {\n\t\tlet tiles = (\n\t\t\t<PropertyList variant=\"tiles\">\n\t\t\t\t<PropertyList.Item label=\"Uptime\">99.98%</PropertyList.Item>\n\t\t\t\t<PropertyList.Item label=\"Response\">212 ms</PropertyList.Item>\n\t\t\t</PropertyList>\n\t\t);\n\t\tlet wide = mount(tiles, 480);\n\t\tlet [first, second] = [...wide.querySelectorAll(\"dl > div\")].map((tile) =>\n\t\t\ttile.getBoundingClientRect(),\n\t\t);\n\t\texpect(second!.top).toBeCloseTo(first!.top, 0);\n\t\texpect(second!.left).toBeGreaterThan(first!.right);\n\n\t\tdocument.body.replaceChildren();\n\t\tlet narrow = mount(tiles, 280);\n\t\tlet [top, bottom] = [...narrow.querySelectorAll(\"dl > div\")].map((tile) =>\n\t\t\ttile.getBoundingClientRect(),\n\t\t);\n\t\texpect(bottom!.top).toBeGreaterThan(top!.bottom - 1);\n\t});\n});\n"
17
+ }
18
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "relative-time",
3
+ "changedIn": "2026.11.3",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "RelativeTime",
7
+ "RelativeTimeLocal"
8
+ ],
9
+ "source": {
10
+ "path": "relative-time.tsx",
11
+ "content": "/**\n * A `<time>` that reads \"2m ago\" for the last week and a date after it, with the absolute local\n * time and UTC in its title. The server renders it from an explicit `now` and zone, and an\n * optional island rewrites it in the viewer's own zone, the one thing a server cannot know.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { EntryComponent, Handle, Props as TagProps } from \"remix/component\";\n\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { tabularNums } from \"@sdxc/u/typography\";\nimport { clientEntry } from \"remix/component\";\n\nimport type { RelativeTimeFormat } from \"@sdxc/ui/utils\";\n\nimport { viewerTime } from \"@sdxc/ui/mixins\";\nimport { formatRelativeTime } from \"@sdxc/ui/utils\";\n\nexport { formatRelativeTime } from \"@sdxc/ui/utils\";\n\n/**\n * Prop types for {@link RelativeTime} and its island.\n */\nexport namespace RelativeTime {\n\t/** A moment as a `Date`, an ISO 8601 string or epoch milliseconds. */\n\texport type DateInput = RelativeTimeFormat.DateInput;\n\n\t/**\n\t * Every native `<time>` attribute but `dateTime`, which the component writes, plus the\n\t * moment and how to format it.\n\t */\n\texport interface Props extends Omit<TagProps<\"time\">, \"dateTime\" | \"children\"> {\n\t\t/** The moment to show. */\n\t\tdate: DateInput;\n\t\t/** The reference moment; pass the request's time so server and tests render the same text. */\n\t\tnow?: DateInput;\n\t\t/** BCP 47 locale for the text and the title. */\n\t\tlocale?: string;\n\t\t/** IANA zone the server formats in. Defaults to UTC. */\n\t\ttimeZone?: string;\n\t\t/**\n\t\t * Hydrates the {@link RelativeTimeLocal} island, which rewrites the date and title in the\n\t\t * viewer's zone and locale, counting from `now` when given and their clock otherwise.\n\t\t * Needs `@sdxc/ui/relative-time#RelativeTimeLocal` in the app's browser entry.\n\t\t */\n\t\tlocal?: boolean;\n\t}\n\n\t/** Props {@link RelativeTimeLocal} serializes for hydration, so they stay plain JSON. */\n\texport type LocalProps = {\n\t\t/** The moment, as an ISO 8601 string or epoch milliseconds. */\n\t\tdate: string | number;\n\t\t/** The reference moment the text counts from; unset counts from the viewer's clock. */\n\t\tnow?: string | number;\n\t\t/** BCP 47 locale for the text and the title. */\n\t\tlocale?: string;\n\t\t/** IANA zone the server rendered in. */\n\t\ttimeZone?: string;\n\t\t/** Accessible description, passed through to the `<time>`. */\n\t\t\"aria-label\"?: string;\n\t\t/** Element id, passed through to the `<time>`. */\n\t\tid?: string;\n\t};\n}\n\n/**\n * Renders the moment as `<time datetime>` with its text and absolute title. With `local` it\n * hands the same props to {@link RelativeTimeLocal}, so the server HTML is identical and the\n * viewer's zone replaces the server's once the island hydrates.\n *\n * @param handle Runtime handle carrying the `<time>`'s props.\n * @returns The render function producing the element.\n * @example <RelativeTime date={check.at} now={ctx.requestTime} locale={locale} />\n * @example <RelativeTime date={deploy.createdAt} now={now} locale={locale} local />\n */\nexport function RelativeTime(handle: Handle<RelativeTime.Props>) {\n\treturn () => {\n\t\tlet { date, now, locale, timeZone, local, mix, ...rest } = handle.props;\n\n\t\tif (local) {\n\t\t\treturn (\n\t\t\t\t<RelativeTimeLocal\n\t\t\t\t\tdate={serializable(date)}\n\t\t\t\t\tnow={now === undefined ? undefined : serializable(now)}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t\ttimeZone={timeZone}\n\t\t\t\t\taria-label={rest[\"aria-label\"]}\n\t\t\t\t\tid={rest.id}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tlet formatted = formatRelativeTime(date, { now, locale, timeZone });\n\n\t\treturn (\n\t\t\t<time\n\t\t\t\ttitle={formatted.title || undefined}\n\t\t\t\t{...rest}\n\t\t\t\tdateTime={formatted.dateTime || undefined}\n\t\t\t\tdata-slot=\"relative-time\"\n\t\t\t\tmix={mergeMix(tabularNums(), mix)}\n\t\t\t>\n\t\t\t\t{formatted.text}\n\t\t\t</time>\n\t\t);\n\t};\n}\n\n/** Turns a `Date` into its ISO string so an island prop survives serialization. */\nfunction serializable(value: RelativeTime.DateInput): string | number {\n\treturn value instanceof Date ? value.toISOString() : value;\n}\n\n/**\n * Client island behind {@link RelativeTime}'s `local` prop: the same `<time>` the server renders,\n * rewritten in the viewer's zone on hydration, still counting from `now` when one is given.\n * Until the island loads the server's text stands, so the moment is always readable.\n *\n * @example <RelativeTimeLocal date=\"2026-10-30T14:00:00Z\" locale=\"en\" />\n */\nexport const RelativeTimeLocal: EntryComponent<RelativeTime.LocalProps> = clientEntry(\n\t\"@sdxc/ui/relative-time#RelativeTimeLocal\",\n\tfunction RelativeTimeLocal(handle: Handle<RelativeTime.LocalProps>) {\n\t\treturn () => {\n\t\t\tlet { date, now, locale, timeZone, ...rest } = handle.props;\n\t\t\tlet formatted = formatRelativeTime(date, { now, locale, timeZone });\n\n\t\t\treturn (\n\t\t\t\t<time\n\t\t\t\t\t{...rest}\n\t\t\t\t\ttitle={formatted.title || undefined}\n\t\t\t\t\tdateTime={formatted.dateTime || undefined}\n\t\t\t\t\tdata-slot=\"relative-time\"\n\t\t\t\t\tmix={[tabularNums(), viewerTime(locale, now)]}\n\t\t\t\t>\n\t\t\t\t\t{formatted.text}\n\t\t\t\t</time>\n\t\t\t);\n\t\t};\n\t},\n);\n"
12
+ },
13
+ "test": {
14
+ "path": "relative-time.browser.test.tsx",
15
+ "content": "/**\n * Renders relative times in a real browser: the text steps through seconds, minutes, hours and\n * days and turns into a date at seven days, `datetime` carries the instant, the title names local\n * and UTC time, and the island rewrites both in the viewer's zone.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { cdp } from \"vitest/browser\";\n\nimport { formatRelativeTime, RelativeTime, RelativeTimeLocal } from \"@sdxc/ui/relative-time\";\n\nconst NOW = \"2026-11-01T12:00:00.000Z\";\n\n/** Mounts `node` in a fresh host and returns its `<time>`. */\nfunction mount(node: JSX.Element): HTMLTimeElement {\n\tlet host = document.createElement(\"div\");\n\tdocument.body.appendChild(host);\n\trender(node, { container: host });\n\treturn host.querySelector(\"time\")!;\n}\n\n/** The instant `ms` milliseconds before {@link NOW}. */\nfunction before(ms: number): string {\n\treturn new Date(Date.parse(NOW) - ms).toISOString();\n}\n\nafterEach(async () => {\n\tdocument.body.replaceChildren();\n\tawait cdp().send(\"Emulation.setTimezoneOverride\", { timezoneId: \"\" });\n});\n\ndescribe(\"RelativeTime\", () => {\n\tfor (let [ago, text] of [\n\t\t[0, \"now\"],\n\t\t[30 * 1000, \"30s ago\"],\n\t\t[2 * 60 * 1000, \"2m ago\"],\n\t\t[59 * 60 * 1000 + 59 * 1000, \"59m ago\"],\n\t\t[3 * 60 * 60 * 1000, \"3h ago\"],\n\t\t[2 * 24 * 60 * 60 * 1000, \"2d ago\"],\n\t\t[7 * 24 * 60 * 60 * 1000 - 1000, \"6d ago\"],\n\t\t[7 * 24 * 60 * 60 * 1000, \"Oct 25, 2026\"],\n\t] as const) {\n\t\ttest(`reads ${text} for a moment ${ago}ms before now`, () => {\n\t\t\tlet time = mount(<RelativeTime date={before(ago)} now={NOW} locale=\"en\" />);\n\t\t\texpect(time.textContent).toBe(text);\n\t\t});\n\t}\n\n\ttest(\"reads future moments forward\", () => {\n\t\tlet time = mount(<RelativeTime date=\"2026-11-01T12:05:00Z\" now={NOW} locale=\"en\" />);\n\t\texpect(time.textContent).toBe(\"in 5m\");\n\t});\n\n\ttest(\"carries the instant in datetime and the absolute time in the title\", () => {\n\t\tlet time = mount(<RelativeTime date=\"2026-11-01T11:58:00Z\" now={NOW} locale=\"en\" />);\n\n\t\texpect(time.dateTime).toBe(\"2026-11-01T11:58:00.000Z\");\n\t\texpect(time.title).toBe(\"Nov 1, 2026, 11:58:00 AM UTC\");\n\t});\n\n\ttest(\"names the server's zone and UTC on two lines when they differ\", () => {\n\t\tlet time = mount(\n\t\t\t<RelativeTime date=\"2026-10-01T02:00:00Z\" now={NOW} locale=\"en\" timeZone=\"America/Lima\" />,\n\t\t);\n\n\t\texpect(time.textContent).toBe(\"Sep 30, 2026\");\n\t\texpect(time.title.split(\"\\n\")).toEqual([\n\t\t\t\"Sep 30, 2026, 9:00:00 PM GMT-5\",\n\t\t\t\"Oct 1, 2026, 2:00:00 AM UTC\",\n\t\t]);\n\t});\n\n\ttest(\"renders a dash for a date that does not parse\", () => {\n\t\tlet time = mount(<RelativeTime date=\"not a date\" now={NOW} />);\n\n\t\texpect(time.textContent).toBe(\"—\");\n\t\texpect(time.hasAttribute(\"datetime\")).toBe(false);\n\t});\n\n\ttest(\"formats in the locale it is given\", () => {\n\t\texpect(formatRelativeTime(before(2 * 60 * 60 * 1000), { now: NOW, locale: \"es\" }).text).toBe(\n\t\t\t\"hace 2 h\",\n\t\t);\n\t});\n});\n\ndescribe(\"RelativeTimeLocal\", () => {\n\ttest(\"rewrites the date and title in the viewer's zone\", async () => {\n\t\tawait cdp().send(\"Emulation.setTimezoneOverride\", { timezoneId: \"America/Lima\" });\n\t\tlet time = mount(<RelativeTimeLocal date=\"2020-03-01T02:00:00Z\" locale=\"en\" />);\n\n\t\tawait expect.poll(() => time.textContent).toBe(\"Feb 29, 2020\");\n\t\texpect(time.title.split(\"\\n\")).toEqual([\n\t\t\t\"Feb 29, 2020, 9:00:00 PM GMT-5\",\n\t\t\t\"Mar 1, 2020, 2:00:00 AM UTC\",\n\t\t]);\n\t\texpect(time.dateTime).toBe(\"2020-03-01T02:00:00.000Z\");\n\t});\n\n\ttest(\"counts from the given now while formatting in the viewer's zone\", async () => {\n\t\tawait cdp().send(\"Emulation.setTimezoneOverride\", { timezoneId: \"America/Lima\" });\n\t\tlet past = mount(\n\t\t\t<RelativeTimeLocal date=\"2020-03-01T02:00:00Z\" now=\"2020-03-01T04:00:00Z\" locale=\"en\" />,\n\t\t);\n\n\t\tawait expect.poll(() => past.title.split(\"\\n\")[0]).toBe(\"Feb 29, 2020, 9:00:00 PM GMT-5\");\n\t\texpect(past.textContent).toBe(\"2h ago\");\n\n\t\tlet future = mount(\n\t\t\t<RelativeTime date=\"2020-03-01T06:00:00Z\" now=\"2020-03-01T04:00:00Z\" locale=\"en\" local />,\n\t\t);\n\t\tawait expect.poll(() => future.title.split(\"\\n\")[0]).toBe(\"Mar 1, 2020, 1:00:00 AM GMT-5\");\n\t\texpect(future.textContent).toBe(\"in 2h\");\n\t});\n\n\ttest(\"is what RelativeTime renders with local\", async () => {\n\t\tawait cdp().send(\"Emulation.setTimezoneOverride\", { timezoneId: \"Asia/Tokyo\" });\n\t\tlet time = mount(<RelativeTime date=\"2020-03-01T20:00:00Z\" locale=\"en\" local />);\n\n\t\tawait expect.poll(() => time.textContent).toBe(\"Mar 2, 2020\");\n\t});\n});\n"
16
+ }
17
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "status-dot",
3
+ "changedIn": "2026.11.3",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "StatusDot"
7
+ ],
8
+ "source": {
9
+ "path": "status-dot.tsx",
10
+ "content": "/**\n * A small coloured dot that names a record's state beside its label, plus a dot cluster that\n * summarises a set of states as `n/N`. The tone comes from a semantic role, and only an\n * in-progress state pulses, so a list polled every few seconds stays still between changes.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { animationHost, keyframes } from \"@sdxc/u/animation\";\nimport { bg, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { mergeMix, raw } from \"@sdxc/u/general\";\nimport { inlineFlex, items, relative, shrink } from \"@sdxc/u/layout\";\nimport { motionSafe } from \"@sdxc/u/responsive\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { fontSize, nowrap, tabularNums } from \"@sdxc/u/typography\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\n/** Semantic role a dot takes when `color` is omitted: a state the page cannot name yet. */\nconst DEFAULT_COLOR: StatusDot.Color = \"neutral\";\n\n/** Dot diameter, overridable through `--ui-status-dot-size`. */\nconst DOT_SIZE = \"var(--ui-status-dot-size, 0.5rem)\";\n\n/**\n * Prop types for {@link StatusDot} and its compound parts.\n */\nexport namespace StatusDot {\n\t/**\n\t * The role a state reads in: up or ok is `success`, degraded or pending is `warning`, down\n\t * or failed is `danger`, paused or unknown is `neutral`, in progress is `brand`.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Every native `<span>` attribute plus the dot's tone. Children are the visible label; a dot\n\t * without one needs `aria-label` naming the state.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** Semantic role of the state. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Marks a state still in progress (queued, deploying, checking): the dot pulses until the\n\t\t * state settles, and holds still for visitors who prefer reduced motion.\n\t\t */\n\t\tpulse?: boolean;\n\t\t/** The state's name, such as \"Up\" or \"Deploying\". */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<span>` attribute plus the states to draw and the count they summarise.\n\t */\n\texport interface SummaryProps extends TagProps<\"span\"> {\n\t\t/** One dot per chosen state, drawn overlapping in this order; an empty list shows `n/N` alone. */\n\t\tcolors?: Color[];\n\t\t/** How many states are chosen, the `n` of `n/N`. */\n\t\tcount: number;\n\t\t/** How many states exist, the `N` of `n/N`. */\n\t\ttotal: number;\n\t\t/** What the summary announces in full, such as \"4 of 5 statuses shown\". */\n\t\tlabel: string;\n\t}\n}\n\n/**\n * Renders a dot and its label. With a label the dot is `aria-hidden`, since the text already\n * names the state; without one the host becomes `role=\"img\"` and its `aria-label` is the name.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the dot's markup.\n * @example <StatusDot color=\"success\">{t(\"monitor.up\")}</StatusDot>\n * @example <StatusDot color=\"brand\" pulse>{t(\"deploy.building\")}</StatusDot>\n * @example <StatusDot color=\"danger\" aria-label={t(\"monitor.down\")} />\n */\nexport function StatusDot(handle: Handle<StatusDot.Props>) {\n\treturn () => {\n\t\tlet { color, pulse, children, mix, ...rest } = handle.props;\n\t\tlet labelled = children !== undefined && children !== null && children !== false;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\trole={labelled ? undefined : \"img\"}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"status-dot\"\n\t\t\t\tdata-color={color ?? DEFAULT_COLOR}\n\t\t\t\tdata-pulse={pulse ? \"\" : undefined}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[inlineFlex(), items(\"center\"), raw({ gap: \"0.5em\" }), fontSize(\"sm\"), nowrap()],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<Dot pulse={pulse} />\n\t\t\t\t{labelled ? <span data-slot=\"status-dot-label\">{children}</span> : null}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Props for {@link Dot}, the one circle every status part draws.\n */\ninterface DotProps {\n\t/** Whether the circle pulses while its state is in progress. */\n\tpulse?: boolean;\n\t/** Overlap offset for a dot inside a cluster. */\n\toverlap?: boolean;\n\t/** Tone when the dot stands outside a coloured host. */\n\tcolor?: StatusDot.Color;\n}\n\n/**\n * Draws one `aria-hidden` circle coloured by the nearest `data-color`, its own or its host's.\n * The pulse is a ring that grows and fades from the dot, so the dot itself keeps its colour\n * steady for anyone reading it.\n *\n * @param handle Runtime handle carrying the dot's tone and motion.\n * @returns The render function producing the circle.\n */\nfunction Dot(handle: Handle<DotProps>) {\n\treturn () => {\n\t\tlet { pulse, overlap, color } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tdata-slot=\"status-dot-dot\"\n\t\t\t\tdata-color={color}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tshrink(0),\n\t\t\t\t\tis(DOT_SIZE),\n\t\t\t\t\tbs(DOT_SIZE),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tbg(\"neutral.strong\"),\n\t\t\t\t\twhen(':is([data-color=\"success\"] > &, &[data-color=\"success\"])', bg(\"success.solid\")),\n\t\t\t\t\twhen(':is([data-color=\"warning\"] > &, &[data-color=\"warning\"])', bg(\"warning.solid\")),\n\t\t\t\t\twhen(':is([data-color=\"danger\"] > &, &[data-color=\"danger\"])', bg(\"danger.solid\")),\n\t\t\t\t\twhen(':is([data-color=\"brand\"] > &, &[data-color=\"brand\"])', bg(\"brand.solid\")),\n\t\t\t\t\toverlap\n\t\t\t\t\t\t? raw({\n\t\t\t\t\t\t\t\tboxShadow: \"0 0 0 2px var(--ui-bg, Canvas)\",\n\t\t\t\t\t\t\t\t\"&:not(:first-child)\": { marginInlineStart: \"-0.1875rem\" },\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tpulse\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\tkeyframes(\"ui-status-dot-pulse\", {\n\t\t\t\t\t\t\t\t\tfrom: { opacity: 0.6, transform: \"scale(1)\" },\n\t\t\t\t\t\t\t\t\tto: { opacity: 0, transform: \"scale(2.5)\" },\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t\t\t\"&::after\",\n\t\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\t\tcontent: '\"\"',\n\t\t\t\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\t\t\t\t\tborderRadius: \"inherit\",\n\t\t\t\t\t\t\t\t\t\tbackgroundColor: \"inherit\",\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmotionSafe(\n\t\t\t\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t\t\t\t\"&::after\",\n\t\t\t\t\t\t\t\t\t\tanimationHost(\"ui-status-dot-pulse\", {\n\t\t\t\t\t\t\t\t\t\t\tduration: \"1.6s\",\n\t\t\t\t\t\t\t\t\t\t\teasing: \"cubic-bezier(0, 0, 0.2, 1)\",\n\t\t\t\t\t\t\t\t\t\t\titerationCount: \"infinite\",\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders a compact summary of several states, overlapping dots followed by `n/N`, for a\n * filter trigger that shows which statuses are on. The figures are visual; `label` is what\n * assistive technology reads.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the summary's markup.\n * @example <StatusDot.Summary colors={[\"success\", \"warning\"]} count={2} total={5} label={t(\"filters.statusCount\", { count: 2, total: 5 })} />\n */\nStatusDot.Summary = function StatusDotSummary(handle: Handle<StatusDot.SummaryProps>) {\n\treturn () => {\n\t\tlet { colors, count, total, label, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"status-dot-summary\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[inlineFlex(), items(\"center\"), raw({ gap: \"0.375em\" }), fontSize(\"sm\"), nowrap()],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<span aria-hidden=\"true\" mix={[inlineFlex(), items(\"center\")]}>\n\t\t\t\t\t{(colors ?? []).map((color, index) => (\n\t\t\t\t\t\t<Dot key={index} color={color} overlap />\n\t\t\t\t\t))}\n\t\t\t\t</span>\n\t\t\t\t<span aria-hidden=\"true\" mix={[tabularNums(), fg(\"neutral.muted\")]}>\n\t\t\t\t\t{count}/{total}\n\t\t\t\t</span>\n\t\t\t\t<span mix={[visuallyHidden()]}>{label}</span>\n\t\t\t</span>\n\t\t);\n\t};\n};\n"
11
+ },
12
+ "test": {
13
+ "path": "status-dot.browser.test.tsx",
14
+ "content": "/**\n * Draws status dots in a real browser: each tone resolves to its role's colour, a labelled dot\n * hides itself from assistive technology while a bare one is named, only an in-progress dot\n * pulses and it holds still under reduced motion, and the summary reads its label.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { cdp } from \"vitest/browser\";\n\nimport { StatusDot } from \"@sdxc/ui/status-dot\";\n\n/** Mounts `node` in a fresh host appended to the page and returns the host. */\nfunction mount(node: JSX.Element): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.setProperty(\"--ui-success-bg-solid\", \"rgb(0, 128, 0)\");\n\thost.style.setProperty(\"--ui-warning-bg-solid\", \"rgb(200, 150, 0)\");\n\thost.style.setProperty(\"--ui-danger-bg-solid\", \"rgb(200, 0, 0)\");\n\thost.style.setProperty(\"--ui-brand-bg-solid\", \"rgb(0, 0, 200)\");\n\thost.style.setProperty(\"--ui-neutral-border-strong\", \"rgb(120, 120, 120)\");\n\tdocument.body.appendChild(host);\n\trender(node, { container: host });\n\treturn host;\n}\n\n/** The circle inside the first status dot in `host`. */\nfunction dotOf(host: HTMLElement): HTMLElement {\n\treturn host.querySelector<HTMLElement>('[data-slot=\"status-dot-dot\"]')!;\n}\n\nafterEach(async () => {\n\tdocument.body.replaceChildren();\n\tawait cdp().send(\"Emulation.setEmulatedMedia\", { features: [] });\n});\n\ndescribe(\"StatusDot\", () => {\n\tfor (let [color, rgb] of [\n\t\t[\"success\", \"rgb(0, 128, 0)\"],\n\t\t[\"warning\", \"rgb(200, 150, 0)\"],\n\t\t[\"danger\", \"rgb(200, 0, 0)\"],\n\t\t[\"brand\", \"rgb(0, 0, 200)\"],\n\t\t[\"neutral\", \"rgb(120, 120, 120)\"],\n\t] as const) {\n\t\ttest(`paints a ${color} dot in its role's solid colour`, () => {\n\t\t\tlet host = mount(<StatusDot color={color}>State</StatusDot>);\n\t\t\texpect(getComputedStyle(dotOf(host)).backgroundColor).toBe(rgb);\n\t\t});\n\t}\n\n\ttest(\"draws an 8px circle\", () => {\n\t\tlet box = dotOf(mount(<StatusDot color=\"success\">Up</StatusDot>)).getBoundingClientRect();\n\t\texpect(box.width).toBe(8);\n\t\texpect(box.height).toBe(8);\n\t});\n\n\ttest(\"hides the dot when the label names the state\", () => {\n\t\tlet host = mount(<StatusDot color=\"success\">Up</StatusDot>);\n\t\tlet root = host.querySelector('[data-slot=\"status-dot\"]')!;\n\n\t\texpect(dotOf(host).getAttribute(\"aria-hidden\")).toBe(\"true\");\n\t\texpect(root.getAttribute(\"role\")).toBeNull();\n\t\texpect(root.textContent).toBe(\"Up\");\n\t});\n\n\ttest(\"names a label-less dot through aria-label as an image\", () => {\n\t\tlet host = mount(<StatusDot color=\"danger\" aria-label=\"Down\" />);\n\t\tlet root = host.querySelector('[data-slot=\"status-dot\"]')!;\n\n\t\texpect(root.getAttribute(\"role\")).toBe(\"img\");\n\t\texpect(root.getAttribute(\"aria-label\")).toBe(\"Down\");\n\t});\n\n\ttest(\"pulses only while in progress\", () => {\n\t\tlet still = mount(<StatusDot color=\"success\">Up</StatusDot>);\n\t\tlet busy = mount(\n\t\t\t<StatusDot color=\"brand\" pulse>\n\t\t\t\tDeploying\n\t\t\t</StatusDot>,\n\t\t);\n\n\t\texpect(getComputedStyle(dotOf(still), \"::after\").animationName).toBe(\"none\");\n\t\texpect(getComputedStyle(dotOf(busy), \"::after\").animationName).toBe(\"ui-status-dot-pulse\");\n\t});\n\n\ttest(\"holds the in-progress dot still under reduced motion\", async () => {\n\t\tawait cdp().send(\"Emulation.setEmulatedMedia\", {\n\t\t\tfeatures: [{ name: \"prefers-reduced-motion\", value: \"reduce\" }],\n\t\t});\n\t\tlet host = mount(\n\t\t\t<StatusDot color=\"brand\" pulse>\n\t\t\t\tDeploying\n\t\t\t</StatusDot>,\n\t\t);\n\n\t\texpect(getComputedStyle(dotOf(host), \"::after\").animationName).toBe(\"none\");\n\t});\n});\n\ndescribe(\"StatusDot.Summary\", () => {\n\ttest(\"shows one dot per state and n/N, and reads its label\", () => {\n\t\tlet host = mount(\n\t\t\t<StatusDot.Summary colors={[\"success\", \"danger\"]} count={2} total={5} label=\"2 of 5\" />,\n\t\t);\n\t\tlet root = host.querySelector('[data-slot=\"status-dot-summary\"]')!;\n\t\tlet dots = root.querySelectorAll<HTMLElement>('[data-slot=\"status-dot-dot\"]');\n\n\t\texpect(dots).toHaveLength(2);\n\t\texpect(getComputedStyle(dots[1]!).backgroundColor).toBe(\"rgb(200, 0, 0)\");\n\t\texpect(root.textContent).toContain(\"2/5\");\n\t\texpect(root.querySelector(':not([aria-hidden=\"true\"]) > span:last-child')?.textContent).toBe(\n\t\t\t\"2 of 5\",\n\t\t);\n\t});\n});\n"
15
+ }
16
+ }
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "text-field",
3
- "changedIn": "2026.11.1",
3
+ "changedIn": "2026.11.3",
4
4
  "dependencies": [
5
5
  "description",
6
6
  "field-error",
7
7
  "form",
8
+ "group",
8
9
  "input",
9
10
  "label"
10
11
  ],
@@ -13,7 +14,10 @@
13
14
  ],
14
15
  "source": {
15
16
  "path": "text-field.tsx",
16
- "content": "/**\n * A convenience wrapper composing a labeled, described, and validated field\n * in one call: a caption through {@link Label}, the control through\n * {@link Input}, an optional supporting passage through {@link Description},\n * and an optional validation message through {@link FieldError}. Every id\n * and `aria-describedby` relationship between the parts is computed from\n * this instance's own stable identifier, leaving no id bookkeeping to the\n * consumer.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { mergeMix } from \"@sdxc/u/general\";\n\nimport type { FieldPartsProps } from \"@sdxc/ui/utils\";\n\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\nimport { resolveFieldWiring } from \"@sdxc/ui/utils\";\n\nimport { Description } from \"@sdxc/ui/description\";\nimport { FieldError } from \"@sdxc/ui/field-error\";\nimport { resolveFieldIssue } from \"@sdxc/ui/form\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { Label } from \"@sdxc/ui/label\";\n\n/** Native `<input>` `type` {@link TextField} falls back to when `type` is omitted. */\nconst DEFAULT_TYPE: TextField.Type = \"text\";\n\n/**\n * Prop types for {@link TextField}.\n */\nexport namespace TextField {\n\t/**\n\t * Semantic color role for the control's keyboard focus ring, each mapped\n\t * to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Native `<input>` `type` this wrapper renders a single-line, text-like\n\t * control for. A checkbox, radio, or file control each has its own\n\t * dedicated component instead of a `type` value here.\n\t */\n\texport type Type = \"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\";\n\n\t/**\n\t * Per-part styling for the elements this convenience wrapper composes in\n\t * one call, layered after each part's own built-in styling.\n\t */\n\texport type PartsProps = FieldPartsProps;\n\n\t/**\n\t * Props accepted by {@link TextField}. `mix` styles the root element\n\t * grouping the field's parts; style the composed label, control,\n\t * description, and error individually through `parts` instead.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\"> {\n\t\t/** Semantic color role for the control's focus ring. Defaults to `\"neutral\"` when omitted. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * The field's caption, rendered through {@link Label} and associated\n\t\t * with the control through a native `for`/`id` relationship computed\n\t\t * from this instance's own identifier.\n\t\t */\n\t\tlabel: RemixNode;\n\t\t/**\n\t\t * Supporting copy rendered through {@link Description} beneath the\n\t\t * control and referenced by the control's `aria-describedby`. Omit to\n\t\t * render no description.\n\t\t */\n\t\tdescription?: RemixNode;\n\t\t/**\n\t\t * Validation message rendered through {@link FieldError} beneath the\n\t\t * control, marking `aria-invalid` unless set explicitly. Falls back to\n\t\t * a {@link Form}'s own `issues` message by `name`; an explicit value wins.\n\t\t */\n\t\terrorMessage?: RemixNode;\n\t\t/**\n\t\t * Native `autofocus`. Defaults to `true` for the first invalid field of\n\t\t * an enclosing {@link Form}'s `issues`, landing keyboard focus on the\n\t\t * problem with no client JavaScript; pass explicitly to override.\n\t\t */\n\t\tautoFocus?: boolean;\n\t\t/** Native `<input>` `type`. Defaults to {@link DEFAULT_TYPE}. */\n\t\ttype?: Type;\n\t\t/** Native `name` submitted with an enclosing form. */\n\t\tname?: string;\n\t\t/** Current value, for a control a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, for a control left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Placeholder copy shown while the control is empty. */\n\t\tplaceholder?: string;\n\t\t/** Marks the control required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the control inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the control's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint, e.g. `\"email\"` or `\"current-password\"`. */\n\t\tautoComplete?: string;\n\t\t/** Native validation pattern the control's value must match. */\n\t\tpattern?: string;\n\t\t/** Minimum accepted value length. */\n\t\tminLength?: number;\n\t\t/** Maximum accepted value length. */\n\t\tmaxLength?: number;\n\t\t/** Per-part styling for this wrapper's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Composes {@link Label}, {@link Input}, {@link Description}, and\n * {@link FieldError} into one field, computing every id and\n * `aria-describedby` link from this instance's own stable identifier.\n *\n * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.\n * @returns The render function producing the field's markup.\n * @example\n * <TextField label={t(\"form.email.label\")} type=\"email\" name=\"email\" required />\n * @example\n * <TextField\n * \tlabel={t(\"form.password.label\")}\n * \ttype=\"password\"\n * \tname=\"password\"\n * \tdescription={t(\"form.password.hint\")}\n * />\n * @example\n * <TextField\n * \tlabel={t(\"form.username.label\")}\n * \tname=\"username\"\n * \tdefaultValue=\"ab\"\n * \terrorMessage={t(\"form.username.tooShort\")}\n * />\n */\nexport function TextField(handle: Handle<TextField.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\terrorMessage: errorMessageProp,\n\t\t\tautoFocus,\n\t\t\ttype,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tpattern,\n\t\t\tminLength,\n\t\t\tmaxLength,\n\t\t\t\"aria-invalid\": ariaInvalidProp,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet resolvedType = type ?? DEFAULT_TYPE;\n\t\tlet { errorMessage, isFirstInvalid } = resolveFieldIssue(handle, name, errorMessageProp);\n\t\tlet resolvedAutoFocus = autoFocus ?? (isFirstInvalid || undefined);\n\t\tlet { resolvedColor, resolvedInvalid, descriptionId, errorId, describedBy } =\n\t\t\tresolveFieldWiring(handle.id, {\n\t\t\t\tcolor,\n\t\t\t\terrorMessage,\n\t\t\t\tdescription,\n\t\t\t\tariaInvalid: ariaInvalidProp,\n\t\t\t});\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"text-field\" mix={mergeMix(fieldStackLayout(), mix)}>\n\t\t\t\t<Label htmlFor={handle.id} mix={parts?.label}>\n\t\t\t\t\t{label}\n\t\t\t\t</Label>\n\t\t\t\t<Input\n\t\t\t\t\tid={handle.id}\n\t\t\t\t\ttype={resolvedType as never}\n\t\t\t\t\tname={name}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\tpattern={pattern}\n\t\t\t\t\tminLength={minLength}\n\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t\t// oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.\n\t\t\t\t\tautoFocus={resolvedAutoFocus}\n\t\t\t\t\taria-invalid={resolvedInvalid}\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\tcolor={resolvedColor}\n\t\t\t\t\tmix={parts?.input}\n\t\t\t\t/>\n\t\t\t\t{description ? (\n\t\t\t\t\t<Description id={descriptionId} mix={parts?.description}>\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</Description>\n\t\t\t\t) : null}\n\t\t\t\t{errorMessage ? (\n\t\t\t\t\t<FieldError id={errorId} mix={parts?.error}>\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</FieldError>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t};\n}\n"
17
+ "content": "/**\n * A convenience wrapper composing a labeled, described, and validated field\n * in one call: a caption through {@link Label}, the control through\n * {@link Input}, an optional supporting passage through {@link Description},\n * and an optional validation message through {@link FieldError}. Every id\n * and `aria-describedby` relationship between the parts is computed from\n * this instance's own stable identifier, leaving no id bookkeeping to the\n * consumer.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { mergeMix } from \"@sdxc/u/general\";\n\nimport type { FieldPartsProps } from \"@sdxc/ui/utils\";\n\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\nimport { resolveFieldWiring } from \"@sdxc/ui/utils\";\n\nimport { Description } from \"@sdxc/ui/description\";\nimport { FieldError } from \"@sdxc/ui/field-error\";\nimport { resolveFieldIssue } from \"@sdxc/ui/form\";\nimport { Group } from \"@sdxc/ui/group\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { Label } from \"@sdxc/ui/label\";\n\n/** Native `<input>` `type` {@link TextField} falls back to when `type` is omitted. */\nconst DEFAULT_TYPE: TextField.Type = \"text\";\n\n/**\n * Prop types for {@link TextField}.\n */\nexport namespace TextField {\n\t/**\n\t * Semantic color role for the control's keyboard focus ring, each mapped\n\t * to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Native `<input>` `type` this wrapper renders a single-line, text-like\n\t * control for. A checkbox, radio, or file control each has its own\n\t * dedicated component instead of a `type` value here.\n\t */\n\texport type Type = \"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\";\n\n\t/**\n\t * Per-part styling for the elements this convenience wrapper composes in\n\t * one call, layered after each part's own built-in styling.\n\t */\n\texport interface PartsProps extends FieldPartsProps {\n\t\t/** Styling for the row joining the control to its addons, rendered only with a `prefix` or `suffix`. */\n\t\tgroup?: TagProps<\"div\">[\"mix\"];\n\t\tprefix?: TagProps<\"label\">[\"mix\"];\n\t\tsuffix?: TagProps<\"label\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link TextField}. `mix` styles the root element\n\t * grouping the field's parts; style the composed label, control,\n\t * description, and error individually through `parts` instead.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"children\" | \"prefix\"> {\n\t\t/** Semantic color role for the control's focus ring. Defaults to `\"neutral\"` when omitted. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * The field's caption, rendered through {@link Label} and associated\n\t\t * with the control through a native `for`/`id` relationship computed\n\t\t * from this instance's own identifier.\n\t\t */\n\t\tlabel: RemixNode;\n\t\t/**\n\t\t * Supporting copy rendered through {@link Description} beneath the\n\t\t * control and referenced by the control's `aria-describedby`. Omit to\n\t\t * render no description.\n\t\t */\n\t\tdescription?: RemixNode;\n\t\t/**\n\t\t * Static text joined to the control's leading edge as one field — a currency, a\n\t\t * domain. It describes the control through `aria-describedby`, stays out of its\n\t\t * name, and focuses the control when clicked.\n\t\t */\n\t\tprefix?: RemixNode;\n\t\t/** Static text joined to the control's trailing edge as one field — a unit, a domain suffix. */\n\t\tsuffix?: RemixNode;\n\t\t/**\n\t\t * Validation message rendered through {@link FieldError} beneath the\n\t\t * control, marking `aria-invalid` unless set explicitly. Falls back to\n\t\t * a {@link Form}'s own `issues` message by `name`; an explicit value wins.\n\t\t */\n\t\terrorMessage?: RemixNode;\n\t\t/**\n\t\t * Native `autofocus`. Defaults to `true` for the first invalid field of\n\t\t * an enclosing {@link Form}'s `issues`, landing keyboard focus on the\n\t\t * problem with no client JavaScript; pass explicitly to override.\n\t\t */\n\t\tautoFocus?: boolean;\n\t\t/** Native `<input>` `type`. Defaults to {@link DEFAULT_TYPE}. */\n\t\ttype?: Type;\n\t\t/** Native `name` submitted with an enclosing form. */\n\t\tname?: string;\n\t\t/** Current value, for a control a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, for a control left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Placeholder copy shown while the control is empty. */\n\t\tplaceholder?: string;\n\t\t/** Marks the control required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the control inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the control's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint, e.g. `\"email\"` or `\"current-password\"`. */\n\t\tautoComplete?: string;\n\t\t/** Native validation pattern the control's value must match. */\n\t\tpattern?: string;\n\t\t/** Minimum accepted value length. */\n\t\tminLength?: number;\n\t\t/** Maximum accepted value length. */\n\t\tmaxLength?: number;\n\t\t/** Per-part styling for this wrapper's internally composed elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Composes {@link Label}, {@link Input}, {@link Description}, and\n * {@link FieldError} into one field, computing every id and\n * `aria-describedby` link from this instance's own stable identifier.\n *\n * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.\n * @returns The render function producing the field's markup.\n * @example\n * <TextField label={t(\"form.email.label\")} type=\"email\" name=\"email\" required />\n * @example\n * <TextField\n * \tlabel={t(\"form.password.label\")}\n * \ttype=\"password\"\n * \tname=\"password\"\n * \tdescription={t(\"form.password.hint\")}\n * />\n * @example\n * <TextField label={t(\"settings.slug.label\")} name=\"slug\" prefix=\"pulse.dev/\" />\n * @example\n * <TextField\n * \tlabel={t(\"form.username.label\")}\n * \tname=\"username\"\n * \tdefaultValue=\"ab\"\n * \terrorMessage={t(\"form.username.tooShort\")}\n * />\n */\nexport function TextField(handle: Handle<TextField.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\tprefix,\n\t\t\tsuffix,\n\t\t\terrorMessage: errorMessageProp,\n\t\t\tautoFocus,\n\t\t\ttype,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tpattern,\n\t\t\tminLength,\n\t\t\tmaxLength,\n\t\t\t\"aria-invalid\": ariaInvalidProp,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet resolvedType = type ?? DEFAULT_TYPE;\n\t\tlet { errorMessage, isFirstInvalid } = resolveFieldIssue(handle, name, errorMessageProp);\n\t\tlet resolvedAutoFocus = autoFocus ?? (isFirstInvalid || undefined);\n\t\tlet { resolvedColor, resolvedInvalid, descriptionId, errorId, describedBy } =\n\t\t\tresolveFieldWiring(handle.id, {\n\t\t\t\tcolor,\n\t\t\t\terrorMessage,\n\t\t\t\tdescription,\n\t\t\t\tariaInvalid: ariaInvalidProp,\n\t\t\t});\n\t\tlet hasAddon = Boolean(prefix || suffix);\n\t\tlet labelId = hasAddon ? `${handle.id}-label` : undefined;\n\t\tlet prefixId = prefix ? `${handle.id}-prefix` : undefined;\n\t\tlet suffixId = suffix ? `${handle.id}-suffix` : undefined;\n\t\tlet controlDescribedBy =\n\t\t\t[prefixId, suffixId, describedBy].filter(Boolean).join(\" \") || undefined;\n\n\t\tlet control = (\n\t\t\t<Input\n\t\t\t\tid={handle.id}\n\t\t\t\ttype={resolvedType as never}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\trequired={required}\n\t\t\t\tdisabled={disabled}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tautoComplete={autoComplete}\n\t\t\t\tpattern={pattern}\n\t\t\t\tminLength={minLength}\n\t\t\t\tmaxLength={maxLength}\n\t\t\t\t// oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.\n\t\t\t\tautoFocus={resolvedAutoFocus}\n\t\t\t\taria-invalid={resolvedInvalid}\n\t\t\t\taria-labelledby={labelId}\n\t\t\t\taria-describedby={controlDescribedBy}\n\t\t\t\tcolor={resolvedColor}\n\t\t\t\tmix={parts?.input}\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"text-field\" mix={mergeMix(fieldStackLayout(), mix)}>\n\t\t\t\t<Label id={labelId} htmlFor={handle.id} mix={parts?.label}>\n\t\t\t\t\t{label}\n\t\t\t\t</Label>\n\t\t\t\t{hasAddon ? (\n\t\t\t\t\t<Group role=\"presentation\" mix={parts?.group}>\n\t\t\t\t\t\t{prefix ? (\n\t\t\t\t\t\t\t<Group.Text id={prefixId} htmlFor={handle.id} mix={parts?.prefix}>\n\t\t\t\t\t\t\t\t{prefix}\n\t\t\t\t\t\t\t</Group.Text>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{control}\n\t\t\t\t\t\t{suffix ? (\n\t\t\t\t\t\t\t<Group.Text id={suffixId} htmlFor={handle.id} mix={parts?.suffix}>\n\t\t\t\t\t\t\t\t{suffix}\n\t\t\t\t\t\t\t</Group.Text>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</Group>\n\t\t\t\t) : (\n\t\t\t\t\tcontrol\n\t\t\t\t)}\n\t\t\t\t{description ? (\n\t\t\t\t\t<Description id={descriptionId} mix={parts?.description}>\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</Description>\n\t\t\t\t) : null}\n\t\t\t\t{errorMessage ? (\n\t\t\t\t\t<FieldError id={errorId} mix={parts?.error}>\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</FieldError>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t};\n}\n"
17
18
  },
18
- "test": null
19
+ "test": {
20
+ "path": "text-field.browser.test.tsx",
21
+ "content": "/**\n * Lays a text field with a prefix or suffix out in a real browser: the addon and the\n * input share one border with rounding on the outer corners only, the addon describes\n * the input and focuses it when clicked, and the field's rings wrap the whole group.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\nimport type { RenderResult } from \"remix/component/test\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { page, userEvent } from \"vitest/browser\";\n\nimport { Group } from \"@sdxc/ui/group\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { TextField } from \"@sdxc/ui/text-field\";\n\nimport \"@sdxc/ui/reset.css\";\nimport \"@sdxc/ui/theme.css\";\n\nlet mounted: RenderResult | undefined;\n\nafterEach(async () => {\n\tmounted?.cleanup();\n\tmounted = undefined;\n\tdocument.body.replaceChildren();\n\tawait page.viewport(1280, 800);\n});\n\n/** Mounts `node` in a host `width` pixels wide and returns the host. */\nfunction mount(node: JSX.Element, width = 480): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.width = `${width}px`;\n\thost.style.padding = \"8px\";\n\tdocument.body.appendChild(host);\n\tmounted = render(node, { container: host });\n\treturn host;\n}\n\n/** The parts of the one field rendered in `host`. */\nfunction parts(host: HTMLElement) {\n\tlet input = host.querySelector<HTMLInputElement>(\"input\")!;\n\tlet addons = [...host.querySelectorAll<HTMLElement>('[data-slot=\"group-text\"]')];\n\tlet group = input.parentElement!;\n\treturn { input, addons, group };\n}\n\n/** Whether an element's computed outline is drawn. */\nfunction hasOutline(element: Element): boolean {\n\tlet style = getComputedStyle(element);\n\treturn style.outlineStyle !== \"none\" && Number.parseFloat(style.outlineWidth) > 0;\n}\n\ndescribe(\"TextField with a prefix or suffix\", () => {\n\ttest(\"joins the prefix to the input as one bordered field, rounded on the outer corners only\", () => {\n\t\tlet host = mount(<TextField label=\"Workspace URL\" name=\"slug\" prefix=\"pulse.dev/\" />);\n\t\tlet { input, addons } = parts(host);\n\t\tlet [prefix] = addons;\n\t\tlet prefixStyle = getComputedStyle(prefix!);\n\t\tlet inputStyle = getComputedStyle(input);\n\n\t\texpect(addons).toHaveLength(1);\n\t\texpect(prefix!.textContent).toBe(\"pulse.dev/\");\n\t\texpect(prefixStyle.borderTopWidth).toBe(\"1px\");\n\t\texpect(\n\t\t\tMath.abs(prefix!.getBoundingClientRect().right - input.getBoundingClientRect().left),\n\t\t).toBeLessThanOrEqual(1);\n\t\texpect(prefix!.getBoundingClientRect().height).toBeCloseTo(\n\t\t\tinput.getBoundingClientRect().height,\n\t\t\t0,\n\t\t);\n\n\t\texpect(Number.parseFloat(prefixStyle.borderStartStartRadius)).toBeGreaterThan(0);\n\t\texpect(Number.parseFloat(prefixStyle.borderEndStartRadius)).toBeGreaterThan(0);\n\t\texpect(prefixStyle.borderStartEndRadius).toBe(\"0px\");\n\t\texpect(prefixStyle.borderEndEndRadius).toBe(\"0px\");\n\t\texpect(inputStyle.borderStartStartRadius).toBe(\"0px\");\n\t\texpect(inputStyle.borderEndStartRadius).toBe(\"0px\");\n\t\texpect(Number.parseFloat(inputStyle.borderStartEndRadius)).toBeGreaterThan(0);\n\t\texpect(Number.parseFloat(inputStyle.borderEndEndRadius)).toBeGreaterThan(0);\n\t});\n\n\ttest(\"rounds a suffix on its trailing corners and the input on its leading ones\", () => {\n\t\tlet host = mount(<TextField label=\"Timeout\" name=\"timeout\" type=\"number\" suffix=\"ms\" />);\n\t\tlet { input, addons } = parts(host);\n\t\tlet [suffix] = addons;\n\t\tlet suffixStyle = getComputedStyle(suffix!);\n\t\tlet inputStyle = getComputedStyle(input);\n\n\t\texpect(\n\t\t\tMath.abs(input.getBoundingClientRect().right - suffix!.getBoundingClientRect().left),\n\t\t).toBeLessThanOrEqual(1);\n\t\texpect(suffixStyle.borderStartStartRadius).toBe(\"0px\");\n\t\texpect(Number.parseFloat(suffixStyle.borderStartEndRadius)).toBeGreaterThan(0);\n\t\texpect(Number.parseFloat(inputStyle.borderStartStartRadius)).toBeGreaterThan(0);\n\t\texpect(inputStyle.borderStartEndRadius).toBe(\"0px\");\n\t});\n\n\ttest(\"describes the input with its addons and keeps its name to the label\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField\n\t\t\t\tlabel=\"Price\"\n\t\t\t\tname=\"price\"\n\t\t\t\tprefix=\"$\"\n\t\t\t\tsuffix=\"USD\"\n\t\t\t\tdescription=\"Charged monthly.\"\n\t\t\t/>,\n\t\t);\n\t\tlet { input, addons } = parts(host);\n\t\tlet describedBy = input.getAttribute(\"aria-describedby\")!.split(\" \");\n\n\t\tfor (let addon of addons) expect(describedBy).toContain(addon.id);\n\t\texpect(describedBy).toHaveLength(3);\n\t\tlet labelledBy = input.getAttribute(\"aria-labelledby\")!;\n\t\texpect(document.getElementById(labelledBy)!.textContent).toBe(\"Price\");\n\t\tfor (let addon of addons) expect(addon.tabIndex).toBeLessThan(0);\n\t});\n\n\ttest(\"focuses the input when the addon is clicked\", async () => {\n\t\tlet host = mount(<TextField label=\"Workspace URL\" name=\"slug\" prefix=\"pulse.dev/\" />);\n\t\tlet { input, addons } = parts(host);\n\n\t\tawait userEvent.click(addons[0]!);\n\n\t\texpect(document.activeElement).toBe(input);\n\t});\n\n\ttest(\"draws the focus ring around the whole group, not the input\", async () => {\n\t\tlet host = mount(<TextField label=\"Workspace URL\" name=\"slug\" prefix=\"pulse.dev/\" />);\n\t\tlet { input, group } = parts(host);\n\n\t\tawait userEvent.click(input);\n\n\t\texpect(hasOutline(group)).toBe(true);\n\t\texpect(hasOutline(input)).toBe(false);\n\t});\n\n\ttest(\"draws the invalid ring around the whole group, not the input\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField label=\"Workspace URL\" name=\"slug\" prefix=\"pulse.dev/\" errorMessage=\"Taken.\" />,\n\t\t);\n\t\tlet { input, group, addons } = parts(host);\n\n\t\texpect(input.getAttribute(\"aria-invalid\")).toBe(\"true\");\n\t\texpect(hasOutline(group)).toBe(true);\n\t\texpect(hasOutline(input)).toBe(false);\n\t\texpect(getComputedStyle(addons[0]!).borderTopColor).toBe(\n\t\t\tgetComputedStyle(input).borderTopColor,\n\t\t);\n\t});\n\n\ttest(\"dims the addon with a disabled field\", () => {\n\t\tlet host = mount(<TextField label=\"Amount\" name=\"amount\" prefix=\"$\" disabled />);\n\t\tlet { addons } = parts(host);\n\n\t\texpect(Number(getComputedStyle(addons[0]!).opacity)).toBeLessThan(1);\n\t});\n\n\ttest(\"shrinks the input and keeps a long addon on one line at 320px\", async () => {\n\t\tawait page.viewport(320, 640);\n\t\tlet host = mount(\n\t\t\t<TextField label=\"Subdomain\" name=\"subdomain\" suffix=\".northwind.example.com\" />,\n\t\t\t304,\n\t\t);\n\t\tlet { input, addons, group } = parts(host);\n\t\tlet [suffix] = addons;\n\n\t\texpect(document.documentElement.scrollWidth).toBeLessThanOrEqual(320);\n\t\texpect(group.getBoundingClientRect().right).toBeLessThanOrEqual(\n\t\t\thost.getBoundingClientRect().right,\n\t\t);\n\t\texpect(suffix!.getBoundingClientRect().height).toBeCloseTo(\n\t\t\tinput.getBoundingClientRect().height,\n\t\t\t0,\n\t\t);\n\t\texpect(suffix!.scrollWidth).toBeLessThanOrEqual(suffix!.clientWidth);\n\t});\n});\n\ndescribe(\"Group.Text\", () => {\n\ttest(\"composes an addon onto an Input by hand\", async () => {\n\t\tlet host = mount(\n\t\t\t<Group>\n\t\t\t\t<Group.Text id=\"slug-prefix\" htmlFor=\"slug\">\n\t\t\t\t\tpulse.dev/\n\t\t\t\t</Group.Text>\n\t\t\t\t<Input id=\"slug\" aria-label=\"Workspace URL\" aria-describedby=\"slug-prefix\" />\n\t\t\t</Group>,\n\t\t);\n\t\tlet { input, addons, group } = parts(host);\n\n\t\tawait userEvent.click(addons[0]!);\n\n\t\texpect(document.activeElement).toBe(input);\n\t\texpect(hasOutline(group)).toBe(true);\n\t\texpect(hasOutline(input)).toBe(false);\n\t});\n});\n"
22
+ }
19
23
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "timeline",
3
+ "changedIn": "2026.11.3",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "Timeline"
7
+ ],
8
+ "source": {
9
+ "path": "timeline.tsx",
10
+ "content": "/**\n * A record's activity as an ordered list: a 2px rail threading 16px event icons toned by\n * what happened, one line per event (avatar, bold actor, muted verb, time), an optional\n * comment card, and a native `<details>` folding a run of quiet events into \"N more\".\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { EllipsisIcon } from \"@sdxc/icons\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { cursor, listStyle, pseudoContent, raw, mergeMix } from \"@sdxc/u/general\";\nimport { flex, gap, grid, inlineFlex, items, justify, relative, vstack } from \"@sdxc/u/layout\";\nimport { bs, is, m, minIs, p } from \"@sdxc/u/size\";\nimport { before, data, focusVisible, hover, when } from \"@sdxc/u/state\";\nimport { leading, text, weight } from \"@sdxc/u/typography\";\n\n/** The side of the square each event's icon sits centred in; the rail runs through its middle. */\nconst ICON_BOX = \"var(--ui-timeline-icon-box, 1.5rem)\";\n\n/** Tone an event's icon takes when `tone` is left unset. */\nconst DEFAULT_TONE: Timeline.Tone = \"neutral\";\n\n/**\n * Prop types for {@link Timeline} and its compound parts.\n */\nexport namespace Timeline {\n\t/** The semantic role an event's icon is drawn in. */\n\texport type Tone = \"neutral\" | \"brand\" | \"success\" | \"warning\" | \"danger\";\n\n\t/** Every native `<ol>` attribute. */\n\texport interface Props extends TagProps<\"ol\"> {}\n\n\t/** Every native `<li>` attribute, plus the event's parts. */\n\texport interface EventProps extends Omit<TagProps<\"li\">, \"children\"> {\n\t\t/** A 16px glyph naming the kind of event, decorative beside the line's words. */\n\t\ticon: RemixNode;\n\t\t/** @default {@link DEFAULT_TONE} */\n\t\ttone?: Tone;\n\t\t/** A small avatar of the actor, shown before the name. */\n\t\tavatar?: RemixNode;\n\t\t/** Who did it, set in bold. */\n\t\tactor?: RemixNode;\n\t\t/** When it happened: a `RelativeTime` or plain text. */\n\t\ttime?: RemixNode;\n\t\t/** A comment or other body, set as a card under the line. */\n\t\tbody?: RemixNode;\n\t\t/** What happened, in muted text after the actor: \"resolved the incident\". */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/** Every native `<li>` attribute, plus the folded events. */\n\texport interface MoreProps extends Omit<TagProps<\"li\">, \"children\"> {\n\t\t/** The disclosure's label, such as \"4 more events\". */\n\t\tsummary: RemixNode;\n\t\t/** Starts unfolded. */\n\t\topen?: boolean;\n\t\t/** The folded {@link Timeline.Event} items. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * The two-column track every row shares: the icon box, then the line. Folded events use\n * it too, so their icons stay on the one rail the list draws.\n */\nfunction rowTrack() {\n\treturn [\n\t\tgrid(),\n\t\traw({ gridTemplateColumns: `${ICON_BOX} minmax(0, 1fr)` }),\n\t\tgap(3),\n\t\traw({ rowGap: \"0.5rem\" }),\n\t\titems(\"start\"),\n\t];\n}\n\n/**\n * Renders the `<ol>` and its rail. The rail is drawn once, behind every icon from the\n * first to the last, so a folded run keeps the line continuous when it opens; icons sit on\n * the page's background, `--ui-timeline-surface`, which masks the rail where they meet it.\n *\n * @param handle Runtime handle carrying the `<ol>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Timeline>\n * \t<Timeline.Event icon={<CircleDotIcon />} tone=\"danger\" actor=\"Uptime\" time={<RelativeTime date={opened} />}>\n * \t\topened the incident\n * \t</Timeline.Event>\n * \t<Timeline.Event icon={<MessageSquareIcon />} avatar={<Avatar size=\"xs\" />} actor=\"Ana\" body={<p>Rolling back.</p>}>\n * \t\tcommented\n * \t</Timeline.Event>\n * </Timeline>\n */\nexport function Timeline(handle: Handle<Timeline.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ol\n\t\t\t\tdata-slot=\"timeline\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tm(0),\n\t\t\t\t\t\tp(0),\n\t\t\t\t\t\tlistStyle(\"none\"),\n\t\t\t\t\t\tvstack({ gap: 3 }),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\tbefore([\n\t\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\t\tinsetBlock: `calc(${ICON_BOX} / 2)`,\n\t\t\t\t\t\t\t\tinsetInlineStart: `calc(${ICON_BOX} / 2 - 1px)`,\n\t\t\t\t\t\t\t\tinlineSize: \"2px\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tbg(\"neutral.border\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders one event: its toned icon on the rail, then a single wrapping line of avatar,\n * actor, description and time, then the body card when one is given.\n *\n * @param handle Runtime handle carrying the `<li>`'s props.\n * @returns The render function producing the event's markup.\n * @example\n * <Timeline.Event icon={<RocketIcon />} tone=\"brand\" actor=\"deploy-bot\" time=\"2m ago\">\n * \tdeployed v4.2.1\n * </Timeline.Event>\n */\nTimeline.Event = function TimelineEvent(handle: Handle<Timeline.EventProps>) {\n\treturn () => {\n\t\tlet { icon, tone, avatar, actor, time, body, children, mix, ...rest } = handle.props;\n\t\tlet resolvedTone = tone ?? DEFAULT_TONE;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\tdata-slot=\"timeline-event\"\n\t\t\t\tdata-tone={resolvedTone}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(rowTrack(), mix)}\n\t\t\t>\n\t\t\t\t<TimelineIcon tone={resolvedTone}>{icon}</TimelineIcon>\n\t\t\t\t<div mix={[vstack({ gap: 2 }), minIs(0)]}>\n\t\t\t\t\t<p\n\t\t\t\t\t\tdata-slot=\"timeline-line\"\n\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\tm(0),\n\t\t\t\t\t\t\tflex(),\n\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\traw({ flexWrap: \"wrap\", minBlockSize: ICON_BOX }),\n\t\t\t\t\t\t\tgap(1.5),\n\t\t\t\t\t\t\tleading(\"1.25rem\"),\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t{avatar ? <span mix={[inlineFlex()]}>{avatar}</span> : null}\n\t\t\t\t\t\t{actor ? (\n\t\t\t\t\t\t\t<span data-slot=\"timeline-actor\" mix={[weight(\"semibold\")]}>\n\t\t\t\t\t\t\t\t{actor}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{children ? (\n\t\t\t\t\t\t\t<span data-slot=\"timeline-description\" mix={[fg(\"neutral.muted\")]}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{time ? (\n\t\t\t\t\t\t\t<span data-slot=\"timeline-time\" mix={[fg(\"neutral.muted\"), text(\"xs\")]}>\n\t\t\t\t\t\t\t\t{time}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</p>\n\t\t\t\t\t{body ? (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tdata-slot=\"timeline-body\"\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tp(3),\n\t\t\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\t\t\tborder({ color: \"neutral.border\", width: 1 }),\n\t\t\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\t\"& > :first-child\": { marginBlockStart: 0 },\n\t\t\t\t\t\t\t\t\t\"& > :last-child\": { marginBlockEnd: 0 },\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t);\n\t};\n};\n\n/**\n * Renders a run of events folded behind a `<details>`: its summary sits on the rail with\n * an ellipsis glyph, and its events open in place, in the same list and on the same rail.\n *\n * @param handle Runtime handle carrying the `<li>`'s props.\n * @returns The render function producing the folded run's markup.\n * @example\n * <Timeline.More summary=\"4 more events\">\n * \t{checks.map((check) => <Timeline.Event icon={<CheckIcon />} actor=\"Uptime\">{check.text}</Timeline.Event>)}\n * </Timeline.More>\n */\nTimeline.More = function TimelineMore(handle: Handle<Timeline.MoreProps>) {\n\treturn () => {\n\t\tlet { summary, open, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li data-slot=\"timeline-more\" {...rest} mix={mergeMix([], mix)}>\n\t\t\t\t<details open={open} mix={[raw({ \"&[open] > summary\": { display: \"none\" } })]}>\n\t\t\t\t\t<summary\n\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t...rowTrack(),\n\t\t\t\t\t\t\tlistStyle(\"none\"),\n\t\t\t\t\t\t\traw({ \"&::-webkit-details-marker\": { display: \"none\" } }),\n\t\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\t\tfocusVisible(outline({ color: \"brand.ring\", width: 2, offset: 2 })),\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TimelineIcon tone=\"neutral\">\n\t\t\t\t\t\t\t<EllipsisIcon size={16} aria-hidden=\"true\" />\n\t\t\t\t\t\t</TimelineIcon>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tflex(),\n\t\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\t\tbs(ICON_BOX),\n\t\t\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\t\t\thover(fg(\"neutral.emphasis\")),\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{summary}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</summary>\n\t\t\t\t\t<ol mix={[m(0), p(0), listStyle(\"none\"), vstack({ gap: 3 })]}>{children}</ol>\n\t\t\t\t</details>\n\t\t\t</li>\n\t\t);\n\t};\n};\n\n/** Props {@link TimelineIcon} reads. */\ninterface TimelineIconProps {\n\ttone: Timeline.Tone;\n\tchildren: RemixNode;\n}\n\n/**\n * The icon box on the rail: the glyph in its tone, on the surface colour so the rail\n * reads as passing behind it.\n *\n * @param handle Runtime handle carrying the tone and glyph.\n * @returns The render function producing the icon box.\n */\nfunction TimelineIcon(handle: Handle<TimelineIconProps>) {\n\treturn () => {\n\t\tlet { tone, children } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"timeline-icon\"\n\t\t\t\tdata-tone={tone}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tis(ICON_BOX),\n\t\t\t\t\tbs(ICON_BOX),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tbg(\"var(--ui-timeline-surface, var(--ui-bg, Canvas))\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\tdata(\"tone\", \"brand\", fg(\"brand\")),\n\t\t\t\t\tdata(\"tone\", \"success\", fg(\"success\")),\n\t\t\t\t\tdata(\"tone\", \"warning\", fg(\"warning\")),\n\t\t\t\t\tdata(\"tone\", \"danger\", fg(\"danger\")),\n\t\t\t\t\twhen(\"& > svg\", raw({ inlineSize: \"1rem\", blockSize: \"1rem\" })),\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n"
11
+ },
12
+ "test": {
13
+ "path": "timeline.browser.test.tsx",
14
+ "content": "/**\n * Lays Timeline out in a real browser: an ordered list whose rail runs through the centre\n * of every icon, a line per event, a comment card in the text column, and a \"N more\"\n * disclosure whose folded events open on the same rail.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { userEvent } from \"vitest/browser\";\n\nimport { Timeline } from \"@sdxc/ui/timeline\";\n\nimport \"@sdxc/ui/theme.css\";\n\n/** A 16px stand-in glyph. */\nfunction Glyph() {\n\treturn () => (\n\t\t<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n\t\t\t<circle cx=\"8\" cy=\"8\" r=\"6\" fill=\"currentColor\" />\n\t\t</svg>\n\t);\n}\n\n/** An incident's activity: opened, a folded run of checks, a comment, resolved. */\nfunction Incident() {\n\treturn () => (\n\t\t<Timeline aria-label=\"Activity\">\n\t\t\t<Timeline.Event icon={<Glyph />} tone=\"danger\" actor=\"Uptime\" time=\"12m ago\">\n\t\t\t\topened the incident\n\t\t\t</Timeline.Event>\n\t\t\t<Timeline.More summary=\"2 more events\">\n\t\t\t\t<Timeline.Event icon={<Glyph />} actor=\"Uptime\" time=\"11m ago\">\n\t\t\t\t\tchecked from Frankfurt\n\t\t\t\t</Timeline.Event>\n\t\t\t\t<Timeline.Event icon={<Glyph />} actor=\"Uptime\" time=\"10m ago\">\n\t\t\t\t\tchecked from Singapore\n\t\t\t\t</Timeline.Event>\n\t\t\t</Timeline.More>\n\t\t\t<Timeline.Event\n\t\t\t\ticon={<Glyph />}\n\t\t\t\tactor=\"Ana Souza\"\n\t\t\t\ttime=\"8m ago\"\n\t\t\t\tbody={<p>Rolling back the 14:02 deploy.</p>}\n\t\t\t>\n\t\t\t\tcommented\n\t\t\t</Timeline.Event>\n\t\t\t<Timeline.Event icon={<Glyph />} tone=\"success\" actor=\"Ana Souza\" time=\"2m ago\">\n\t\t\t\tresolved the incident\n\t\t\t</Timeline.Event>\n\t\t</Timeline>\n\t);\n}\n\n/** Mounts the incident timeline in a 480px host. */\nfunction mount(): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.width = \"480px\";\n\tdocument.body.appendChild(host);\n\trender(<Incident />, { container: host });\n\treturn host;\n}\n\n/** Horizontal centre of a box. */\nfunction centerX(element: Element): number {\n\tlet box = element.getBoundingClientRect();\n\treturn box.left + box.width / 2;\n}\n\nafterEach(() => {\n\tdocument.body.replaceChildren();\n});\n\ndescribe(\"Timeline\", () => {\n\ttest(\"is an ordered list of events\", () => {\n\t\tlet host = mount();\n\t\tlet list = host.querySelector(\"ol\")!;\n\n\t\texpect(list.getAttribute(\"aria-label\")).toBe(\"Activity\");\n\t\texpect(list.querySelectorAll(\":scope > li\")).toHaveLength(4);\n\t});\n\n\ttest(\"runs a 2px rail through the centre of every 16px icon\", () => {\n\t\tlet host = mount();\n\t\tlet list = host.querySelector(\"ol\")!;\n\t\tlet rail = getComputedStyle(list, \"::before\");\n\t\tlet railCenter = list.getBoundingClientRect().left + parseFloat(rail.left) + 1;\n\n\t\texpect(rail.width).toBe(\"2px\");\n\t\tfor (let icon of host.querySelectorAll('[data-slot=\"timeline-icon\"]')) {\n\t\t\tif (icon.getClientRects().length === 0) continue;\n\t\t\texpect(centerX(icon)).toBeCloseTo(railCenter, 0);\n\t\t\texpect(icon.querySelector(\"svg\")!.getBoundingClientRect().width).toBe(16);\n\t\t}\n\t});\n\n\ttest(\"tones each icon by what happened\", () => {\n\t\tdocument.documentElement.style.setProperty(\"--ui-color-danger-600\", \"rgb(220, 38, 38)\");\n\t\tdocument.documentElement.style.setProperty(\"--ui-color-success-600\", \"rgb(22, 163, 74)\");\n\t\tlet host = mount();\n\t\tlet [opened] = host.querySelectorAll<HTMLElement>('[data-slot=\"timeline-icon\"]');\n\t\tlet resolved = [...host.querySelectorAll<HTMLElement>('[data-slot=\"timeline-icon\"]')].at(-1)!;\n\n\t\texpect(getComputedStyle(opened!).color).toBe(\"rgb(220, 38, 38)\");\n\t\texpect(getComputedStyle(resolved).color).toBe(\"rgb(22, 163, 74)\");\n\t});\n\n\ttest(\"keeps each event on one line with the actor in bold\", () => {\n\t\tlet host = mount();\n\t\tlet line = host.querySelector<HTMLElement>('[data-slot=\"timeline-line\"]')!;\n\t\tlet actor = line.querySelector('[data-slot=\"timeline-actor\"]')!;\n\n\t\texpect(line.getBoundingClientRect().height).toBeLessThanOrEqual(24);\n\t\texpect(Number(getComputedStyle(actor).fontWeight)).toBeGreaterThanOrEqual(600);\n\t});\n\n\ttest(\"sets a comment as a card in the text column\", () => {\n\t\tlet host = mount();\n\t\tlet body = host.querySelector<HTMLElement>('[data-slot=\"timeline-body\"]')!;\n\t\tlet line = body.parentElement!.querySelector('[data-slot=\"timeline-line\"]')!;\n\n\t\texpect(body.getBoundingClientRect().left).toBeCloseTo(line.getBoundingClientRect().left, 0);\n\t\texpect(getComputedStyle(body).borderTopWidth).toBe(\"1px\");\n\t});\n\n\ttest(\"folds quiet events behind a disclosure that opens them on the same rail\", async () => {\n\t\tlet host = mount();\n\t\tlet details = host.querySelector(\"details\")!;\n\t\tlet summary = details.querySelector(\"summary\")!;\n\t\tlet folded = details.querySelectorAll<HTMLElement>('[data-slot=\"timeline-event\"]');\n\t\tlet first = host.querySelector('[data-slot=\"timeline-icon\"]')!;\n\n\t\texpect(summary.textContent).toBe(\"2 more events\");\n\t\texpect(folded[0]!.checkVisibility()).toBe(false);\n\n\t\tawait userEvent.click(summary);\n\n\t\texpect(details.open).toBe(true);\n\t\texpect(folded[0]!.checkVisibility()).toBe(true);\n\t\tlet icon = folded[0]!.querySelector('[data-slot=\"timeline-icon\"]')!;\n\t\texpect(centerX(icon)).toBeCloseTo(centerX(first), 0);\n\t});\n});\n"
15
+ }
16
+ }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "typeset",
3
- "changedIn": "2026.11.1",
3
+ "changedIn": "2026.11.3",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Typeset"
7
7
  ],
8
8
  "source": {
9
9
  "path": "typeset.tsx",
10
- "content": "/**\n * A typography layer wrapping already-rendered markdown or HTML content and\n * supplying every size, weight, spacing, and color decision through three\n * custom properties: `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`. `data-preset` swaps all three for a different rhythm\n * context; `data-not-typeset` opts a subtree out of the whole layer.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { keyframes } from \"@sdxc/u/animation\";\nimport { bg, border, borderEdge, fg, outline } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { raw, mergeMix } from \"@sdxc/u/general\";\nimport { block, container } from \"@sdxc/u/layout\";\nimport { overflow, overflowBlock, overflowInline } from \"@sdxc/u/overflow\";\nimport { at } from \"@sdxc/u/responsive\";\nimport { is, maxIs, pb, pi, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport {\n\tbalance,\n\tleading,\n\tpretty,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttracking,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { css } from \"remix/component\";\n\nimport { easings } from \"@sdxc/ui/animations\";\n\n/**\n * Named container {@link Typeset} declares on its own host, so its wide-table\n * handling can grant roomier cell and code-block padding once there's enough\n * space, instead of reading the viewport.\n */\nconst CONTAINER_NAME = \"ui-typeset\";\n\n/** Matches an element that is neither a `data-not-typeset` subtree's root nor inside one. */\nconst OUTSIDE_OPT_OUT = \":not(:where([data-not-typeset], [data-not-typeset] *))\";\n\n/** Rhythm context {@link Typeset} falls back to when `preset` is omitted. */\nconst DEFAULT_PRESET: Typeset.Preset = \"docs\";\n\n/**\n * Body size each preset writes to `--ui-typeset-size`. On a 16px root, `docs`\n * is 18px and `reading` is 20px, so long-form copy is large enough to read;\n * `chat` is 15px for a turn taken in a denser column.\n */\nconst PRESET_BODY_SIZE: Record<Typeset.Preset, string> = {\n\tdocs: \"1.125rem\",\n\tchat: \"0.9375rem\",\n\treading: \"1.25rem\",\n};\n\n/**\n * Size body copy and headings compute from. Clearing `--ui-typeset-size`\n * still leaves the docs body, which is the preset a host uses by default.\n */\nconst TYPESET_SIZE = `var(--ui-typeset-size, ${PRESET_BODY_SIZE.docs})`;\n\n/** CSS length each edge of a wide table's own fade tapers over. */\nconst TABLE_FADE_SIZE = \"2.5rem\";\n\n/**\n * Custom property carrying the gradient direction a wide table's edge fade\n * paints along, mirrored under `:dir(rtl)` so the same mask string works in\n * both writing directions without a second, mirrored gradient.\n */\nconst TABLE_FADE_DIRECTION_PROPERTY = \"--ui-typeset-table-fade-direction\";\n\n/**\n * `@keyframes` name backing a wide table's scroll-linked edge fade; the\n * `keyframes()` call using it must stay a top-level mixin rather than nested\n * under the table selector, since the serializer only recognizes stops there.\n */\nconst TABLE_FADE_KEYFRAMES_NAME = \"ui-typeset-table-fade\";\n\n/** Proportion of a wide table's own scroll range its edge fade ramps across. */\nconst TABLE_FADE_RAMP_PERCENT = 10;\n\n/** The style shape {@link css} accepts, reused so a keyframes block can be built ahead of the call. */\ntype Styles = Parameters<typeof css>[0];\n\n/**\n * Builds the four-stop mask-image gradient a wide table's edge fade paints:\n * a leading stop, two middle stops marking where the faded band meets the\n * fully opaque middle, and a trailing stop; only the middle stops move.\n */\nfunction tableFadeMask(startStop: string, endStop: string): string {\n\treturn `linear-gradient(to var(${TABLE_FADE_DIRECTION_PROPERTY}, right), transparent 0%, black ${startStop}, black ${endStop}, transparent 100%)`;\n}\n\nconst TABLE_FADE_SETTLED_STOP = `calc(100% - ${TABLE_FADE_SIZE})`;\nconst TABLE_FADE_SETTLED_MASK = tableFadeMask(TABLE_FADE_SIZE, TABLE_FADE_SETTLED_STOP);\n\n/**\n * Stops the wide-table edge fade animates through: fully faded on the leading\n * edge at rest, settled on both edges across the long middle of the scroll\n * range, and fully faded on the trailing edge at the end.\n */\nconst TABLE_FADE_KEYFRAMES: Record<string, Styles> = {\n\t\"0%\": { maskImage: tableFadeMask(\"0%\", TABLE_FADE_SETTLED_STOP) },\n\t[`${TABLE_FADE_RAMP_PERCENT}%, ${100 - TABLE_FADE_RAMP_PERCENT}%`]: {\n\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t},\n\t\"100%\": { maskImage: tableFadeMask(TABLE_FADE_SIZE, \"100%\") },\n};\n\n/**\n * Prop types for {@link Typeset}.\n */\nexport namespace Typeset {\n\t/**\n\t * Rhythm context. `\"docs\"` sets the body at 18px, the size for a page meant\n\t * to be read. `\"reading\"` sets it at 20px for a long-form article. `\"chat\"`\n\t * sets it at 15px for a turn in a denser column.\n\t */\n\texport type Preset = \"docs\" | \"chat\" | \"reading\";\n\n\t/**\n\t * Every native `<div>` attribute plus `mix`. `preset` defaults to\n\t * {@link DEFAULT_PRESET}; setting a `--ui-typeset-*` property directly\n\t * overrides it, and `data-not-typeset` opts a subtree out entirely.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Rhythm context. Defaults to {@link DEFAULT_PRESET}. */\n\t\tpreset?: Preset;\n\t}\n}\n\n/**\n * Narrows a descendant rule to elements outside every `data-not-typeset` subtree. Each rule\n * the layer writes lands in a cascade layer of its own, so an opt-out has to be part of the\n * rule's selector; the exclusion adds no specificity, and it sits ahead of a pseudo-element.\n */\nfunction prose(selector: `&${string}`): `&${string}` {\n\tlet pseudoElement = selector.indexOf(\"::\");\n\tif (pseudoElement === -1) return `${selector}${OUTSIDE_OPT_OUT}`;\n\treturn `&${selector.slice(1, pseudoElement)}${OUTSIDE_OPT_OUT}${selector.slice(pseudoElement)}`;\n}\n\n/**\n * Renders a `<div>` that sizes and colors already-rendered markdown or HTML\n * content through `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`, computing heading sizes via `calc()` off one shared value.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the typeset layer's markup.\n * @example\n * <Typeset preset=\"reading\">{renderedArticleHtml}</Typeset>\n * @example\n * <Typeset preset=\"chat\">\n * \t<p>{t(\"assistant.reply\")}</p>\n * </Typeset>\n * @example\n * <Typeset>\n * \t<p>{t(\"docs.intro\")}</p>\n * \t<div data-not-typeset>\n * \t\t<EmbeddedWidget />\n * \t</div>\n * </Typeset>\n */\nexport function Typeset(handle: Handle<Typeset.Props>) {\n\treturn () => {\n\t\tlet { preset, mix, ...rest } = handle.props;\n\t\tlet resolvedPreset = preset ?? DEFAULT_PRESET;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-preset={resolvedPreset}\n\t\t\t\tdata-slot=\"typeset\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\t\tkeyframes(TABLE_FADE_KEYFRAMES_NAME, TABLE_FADE_KEYFRAMES),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tfontSize: TYPESET_SIZE,\n\t\t\t\t\t\t\tlineHeight: \"var(--ui-typeset-leading, 1.75)\",\n\n\t\t\t\t\t\t\t'&[data-preset=\"docs\"]': {\n\t\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.docs,\n\t\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.75\",\n\t\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.25em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'&[data-preset=\"chat\"]': {\n\t\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.chat,\n\t\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.5\",\n\t\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"0.75em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'&[data-preset=\"reading\"]': {\n\t\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.reading,\n\t\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.8\",\n\t\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.5em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& > * + *\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(blockquote, li) > * + *\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h1)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 2)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h2)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.5)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h3)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.25)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h4)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.125)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h5)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: TYPESET_SIZE,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h6)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 0.875)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(ul)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tlistStyleType: \"disc\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(ol)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tlistStyleType: \"decimal\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(ul, ol) :where(ul)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tlistStyleType: \"circle\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(blockquote)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(a)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextUnderlineOffset: \"0.15em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(a):hover\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationThickness: \"2px\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(em, i)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(code)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(pre)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(pre code)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tpadding: \"0\",\n\t\t\t\t\t\t\t\tfontSize: \"1em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(table)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tborderCollapse: \"collapse\",\n\t\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\t\tscrollbarWidth: \"thin\",\n\t\t\t\t\t\t\t\tscrollbarGutter: \"stable\",\n\n\t\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"right\",\n\t\t\t\t\t\t\t\tmaskImage: \"none\",\n\t\t\t\t\t\t\t\t\"-webkit-mask-image\": \"none\",\n\n\t\t\t\t\t\t\t\t\"&:dir(rtl)\": {\n\t\t\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"left\",\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar\": {\n\t\t\t\t\t\t\t\t\twidth: \"0.75rem\",\n\t\t\t\t\t\t\t\t\theight: \"0.75rem\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar-track\": {\n\t\t\t\t\t\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb\": {\n\t\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-radius-full, 9999px)\",\n\t\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border)\",\n\t\t\t\t\t\t\t\t\tborderWidth: \"3px\",\n\t\t\t\t\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\t\t\t\t\tborderColor: \"transparent\",\n\t\t\t\t\t\t\t\t\tbackgroundClip: \"content-box\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb:hover\": {\n\t\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border-strong)\",\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\"@supports (animation-timeline: scroll())\": {\n\t\t\t\t\t\t\t\t\tanimationName: TABLE_FADE_KEYFRAMES_NAME,\n\t\t\t\t\t\t\t\t\tanimationDuration: \"auto\",\n\t\t\t\t\t\t\t\t\tanimationTimingFunction: easings.linear,\n\t\t\t\t\t\t\t\t\tanimationFillMode: \"both\",\n\t\t\t\t\t\t\t\t\tanimationTimeline: \"scroll(self inline)\",\n\t\t\t\t\t\t\t\t\t\"@media (prefers-reduced-motion: reduce)\": {\n\t\t\t\t\t\t\t\t\t\tanimationName: \"none\",\n\t\t\t\t\t\t\t\t\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t\t\t\"-webkit-mask-image\": TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\tat(\"30rem\", CONTAINER_NAME, [\n\t\t\t\t\t\t\twhen(prose(\"& :where(th, td)\"), raw({ paddingInline: \"1em\" })),\n\t\t\t\t\t\t\twhen(prose(\"& :where(pre)\"), raw({ paddingInline: \"1.25em\" })),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(pre)\"), leading(1.6)),\n\n\t\t\t\t\t\twhen(prose(\"& :where(h1, h2, h3, h4, h5, h6)\"), [\n\t\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\t\tleading(1.25),\n\t\t\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tbalance(),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(prose(\"& :where(h6)\"), fg(\"neutral\")),\n\n\t\t\t\t\t\twhen(prose(\"& :where(p, li, blockquote, dd)\"), pretty()),\n\n\t\t\t\t\t\twhen(prose(\"& :where(ul, ol)\"), pis(\"1.5em\")),\n\t\t\t\t\t\twhen(prose(\"& :where(li)::marker\"), fg(\"neutral.muted\")),\n\n\t\t\t\t\t\twhen(prose(\"& :where(blockquote)\"), [\n\t\t\t\t\t\t\tpis(\"1em\"),\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\tborderEdge(\"inline-start\", { color: \"neutral\", width: \"0.25em\" }),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(hr)\"),\n\t\t\t\t\t\t\tborderEdge(\"block-start\", { color: \"neutral\", width: \"1px\" }),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\twhen(prose(\"& :where(a)\"), [fg(\"brand\"), textDecoration(\"underline\")]),\n\t\t\t\t\t\twhen(prose(\"& :where(a):focus-visible\"), [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\trounded(\"xs\"),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(strong, b)\"), [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(code)\"), [\n\t\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tpi(\"0.3em\"),\n\t\t\t\t\t\t\tpb(\"0.15em\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(prose(\"& :where(pre)\"), [\n\t\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\t\tborder({ color: \"neutral.border\", width: 1 }),\n\t\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tpi(\"1em\"),\n\t\t\t\t\t\t\tpb(\"0.875em\"),\n\t\t\t\t\t\t\toverflowInline(\"auto\"),\n\t\t\t\t\t\t\toverflowBlock(\"hidden\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\t\t\toverscrollBehaviorX: \"contain\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A fenced block's `code` is an inline box, so the chip padding above would\n\t\t\t\t\t\t * apply at the start of the box alone and indent the block's first line\n\t\t\t\t\t\t * past every line under it. The block's own padding is the `pre`'s.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(prose(\"& :where(pre code)\"), [\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\t\tpi(0),\n\t\t\t\t\t\t\tpb(0),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(table)\"), [\n\t\t\t\t\t\t\tblock(),\n\t\t\t\t\t\t\tis(\"max(100%, max-content)\"),\n\t\t\t\t\t\t\tmaxIs(\"full\"),\n\t\t\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(prose(\"& :where(th, td):not([align])\"), textAlign(\"start\")),\n\t\t\t\t\t\twhen(prose(\"& :where(th)\"), [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\t\twhen(prose(\"& :where(th, td)\"), [\n\t\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\t\tpi(\"0.75em\"),\n\t\t\t\t\t\t\tpb(\"0.5em\"),\n\t\t\t\t\t\t\tborderEdge(\"block-end\", { color: \"neutral\", width: \"1px\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A typography layer wrapping already-rendered markdown or HTML content and\n * supplying every size, weight, spacing, and color decision through three\n * custom properties: `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`. `data-preset` swaps all three for a different rhythm\n * context; `data-not-typeset` opts a subtree out of the whole layer. Flow spacing reaches\n * through a `HeadingScope` wrapper and leaves a component's `data-slot` list items to it.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { keyframes } from \"@sdxc/u/animation\";\nimport { bg, border, borderEdge, fg, outline } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { raw, mergeMix } from \"@sdxc/u/general\";\nimport { block, container } from \"@sdxc/u/layout\";\nimport { overflow, overflowBlock, overflowInline } from \"@sdxc/u/overflow\";\nimport { at } from \"@sdxc/u/responsive\";\nimport { is, maxIs, pb, pi, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport {\n\tbalance,\n\tleading,\n\tpretty,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttracking,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { css } from \"remix/component\";\n\nimport { easings } from \"@sdxc/ui/animations\";\n\n/**\n * Named container {@link Typeset} declares on its own host, so its wide-table\n * handling can grant roomier cell and code-block padding once there's enough\n * space, instead of reading the viewport.\n */\nconst CONTAINER_NAME = \"ui-typeset\";\n\n/** Matches an element that is neither a `data-not-typeset` subtree's root nor inside one. */\nconst OUTSIDE_OPT_OUT = \":not(:where([data-not-typeset], [data-not-typeset] *))\";\n\n/** Rhythm context {@link Typeset} falls back to when `preset` is omitted. */\nconst DEFAULT_PRESET: Typeset.Preset = \"docs\";\n\n/**\n * Body size each preset writes to `--ui-typeset-size`. On a 16px root, `docs`\n * is 18px and `reading` is 20px, so long-form copy is large enough to read;\n * `chat` is 15px for a turn taken in a denser column.\n */\nconst PRESET_BODY_SIZE: Record<Typeset.Preset, string> = {\n\tdocs: \"1.125rem\",\n\tchat: \"0.9375rem\",\n\treading: \"1.25rem\",\n};\n\n/**\n * Size body copy and headings compute from. Clearing `--ui-typeset-size`\n * still leaves the docs body, which is the preset a host uses by default.\n */\nconst TYPESET_SIZE = `var(--ui-typeset-size, ${PRESET_BODY_SIZE.docs})`;\n\n/** CSS length each edge of a wide table's own fade tapers over. */\nconst TABLE_FADE_SIZE = \"2.5rem\";\n\n/**\n * Custom property carrying the gradient direction a wide table's edge fade\n * paints along, mirrored under `:dir(rtl)` so the same mask string works in\n * both writing directions without a second, mirrored gradient.\n */\nconst TABLE_FADE_DIRECTION_PROPERTY = \"--ui-typeset-table-fade-direction\";\n\n/**\n * `@keyframes` name backing a wide table's scroll-linked edge fade; the\n * `keyframes()` call using it must stay a top-level mixin rather than nested\n * under the table selector, since the serializer only recognizes stops there.\n */\nconst TABLE_FADE_KEYFRAMES_NAME = \"ui-typeset-table-fade\";\n\n/** Proportion of a wide table's own scroll range its edge fade ramps across. */\nconst TABLE_FADE_RAMP_PERCENT = 10;\n\n/** The style shape {@link css} accepts, reused so a keyframes block can be built ahead of the call. */\ntype Styles = Parameters<typeof css>[0];\n\n/**\n * Builds the four-stop mask-image gradient a wide table's edge fade paints:\n * a leading stop, two middle stops marking where the faded band meets the\n * fully opaque middle, and a trailing stop; only the middle stops move.\n */\nfunction tableFadeMask(startStop: string, endStop: string): string {\n\treturn `linear-gradient(to var(${TABLE_FADE_DIRECTION_PROPERTY}, right), transparent 0%, black ${startStop}, black ${endStop}, transparent 100%)`;\n}\n\nconst TABLE_FADE_SETTLED_STOP = `calc(100% - ${TABLE_FADE_SIZE})`;\nconst TABLE_FADE_SETTLED_MASK = tableFadeMask(TABLE_FADE_SIZE, TABLE_FADE_SETTLED_STOP);\n\n/**\n * Stops the wide-table edge fade animates through: fully faded on the leading\n * edge at rest, settled on both edges across the long middle of the scroll\n * range, and fully faded on the trailing edge at the end.\n */\nconst TABLE_FADE_KEYFRAMES: Record<string, Styles> = {\n\t\"0%\": { maskImage: tableFadeMask(\"0%\", TABLE_FADE_SETTLED_STOP) },\n\t[`${TABLE_FADE_RAMP_PERCENT}%, ${100 - TABLE_FADE_RAMP_PERCENT}%`]: {\n\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t},\n\t\"100%\": { maskImage: tableFadeMask(TABLE_FADE_SIZE, \"100%\") },\n};\n\n/**\n * Prop types for {@link Typeset}.\n */\nexport namespace Typeset {\n\t/**\n\t * Rhythm context. `\"docs\"` sets the body at 18px, the size for a page meant\n\t * to be read. `\"reading\"` sets it at 20px for a long-form article. `\"chat\"`\n\t * sets it at 15px for a turn in a denser column.\n\t */\n\texport type Preset = \"docs\" | \"chat\" | \"reading\";\n\n\t/**\n\t * Every native `<div>` attribute plus `mix`. `preset` defaults to\n\t * {@link DEFAULT_PRESET}; setting a `--ui-typeset-*` property directly\n\t * overrides it, and `data-not-typeset` opts a subtree out entirely.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Rhythm context. Defaults to {@link DEFAULT_PRESET}. */\n\t\tpreset?: Preset;\n\t}\n}\n\n/**\n * Narrows a descendant rule to elements outside every `data-not-typeset` subtree. Each rule\n * the layer writes lands in a cascade layer of its own, so an opt-out has to be part of the\n * rule's selector; the exclusion adds no specificity, and it sits ahead of a pseudo-element.\n */\nfunction prose(selector: `&${string}`): `&${string}` {\n\tlet pseudoElement = selector.indexOf(\"::\");\n\tif (pseudoElement === -1) return `${selector}${OUTSIDE_OPT_OUT}`;\n\treturn `&${selector.slice(1, pseudoElement)}${OUTSIDE_OPT_OUT}${selector.slice(pseudoElement)}`;\n}\n\n/**\n * Renders a `<div>` that sizes and colors already-rendered markdown or HTML\n * content through `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`, computing heading sizes via `calc()` off one shared value.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the typeset layer's markup.\n * @example\n * <Typeset preset=\"reading\">{renderedArticleHtml}</Typeset>\n * @example\n * <Typeset preset=\"chat\">\n * \t<p>{t(\"assistant.reply\")}</p>\n * </Typeset>\n * @example\n * <Typeset>\n * \t<p>{t(\"docs.intro\")}</p>\n * \t<div data-not-typeset>\n * \t\t<EmbeddedWidget />\n * \t</div>\n * </Typeset>\n */\nexport function Typeset(handle: Handle<Typeset.Props>) {\n\treturn () => {\n\t\tlet { preset, mix, ...rest } = handle.props;\n\t\tlet resolvedPreset = preset ?? DEFAULT_PRESET;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-preset={resolvedPreset}\n\t\t\t\tdata-slot=\"typeset\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\t\tkeyframes(TABLE_FADE_KEYFRAMES_NAME, TABLE_FADE_KEYFRAMES),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tfontSize: TYPESET_SIZE,\n\t\t\t\t\t\t\tlineHeight: \"var(--ui-typeset-leading, 1.75)\",\n\n\t\t\t\t\t\t\t'&[data-preset=\"docs\"]': {\n\t\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.docs,\n\t\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.75\",\n\t\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.25em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'&[data-preset=\"chat\"]': {\n\t\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.chat,\n\t\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.5\",\n\t\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"0.75em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'&[data-preset=\"reading\"]': {\n\t\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.reading,\n\t\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.8\",\n\t\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.5em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& > * + *\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& > * + div[data-heading-level] > :first-child\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(blockquote, li:not([data-slot])) > * + *\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h1)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 2)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h2)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.5)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h3)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.25)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h4)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.125)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h5)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: TYPESET_SIZE,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(h6)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 0.875)`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(ul)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tlistStyleType: \"disc\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(ol)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tlistStyleType: \"decimal\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(ul, ol) :where(ul)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tlistStyleType: \"circle\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(blockquote)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(a)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextUnderlineOffset: \"0.15em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(a):hover\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationThickness: \"2px\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(em, i)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(code)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(pre)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(pre code)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tpadding: \"0\",\n\t\t\t\t\t\t\t\tfontSize: \"1em\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(table)\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tborderCollapse: \"collapse\",\n\t\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\t\tscrollbarWidth: \"thin\",\n\t\t\t\t\t\t\t\tscrollbarGutter: \"stable\",\n\n\t\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"right\",\n\t\t\t\t\t\t\t\tmaskImage: \"none\",\n\t\t\t\t\t\t\t\t\"-webkit-mask-image\": \"none\",\n\n\t\t\t\t\t\t\t\t\"&:dir(rtl)\": {\n\t\t\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"left\",\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar\": {\n\t\t\t\t\t\t\t\t\twidth: \"0.75rem\",\n\t\t\t\t\t\t\t\t\theight: \"0.75rem\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar-track\": {\n\t\t\t\t\t\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb\": {\n\t\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-radius-full, 9999px)\",\n\t\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border)\",\n\t\t\t\t\t\t\t\t\tborderWidth: \"3px\",\n\t\t\t\t\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\t\t\t\t\tborderColor: \"transparent\",\n\t\t\t\t\t\t\t\t\tbackgroundClip: \"content-box\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb:hover\": {\n\t\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border-strong)\",\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\"@supports (animation-timeline: scroll())\": {\n\t\t\t\t\t\t\t\t\tanimationName: TABLE_FADE_KEYFRAMES_NAME,\n\t\t\t\t\t\t\t\t\tanimationDuration: \"auto\",\n\t\t\t\t\t\t\t\t\tanimationTimingFunction: easings.linear,\n\t\t\t\t\t\t\t\t\tanimationFillMode: \"both\",\n\t\t\t\t\t\t\t\t\tanimationTimeline: \"scroll(self inline)\",\n\t\t\t\t\t\t\t\t\t\"@media (prefers-reduced-motion: reduce)\": {\n\t\t\t\t\t\t\t\t\t\tanimationName: \"none\",\n\t\t\t\t\t\t\t\t\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t\t\t\"-webkit-mask-image\": TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\tat(\"30rem\", CONTAINER_NAME, [\n\t\t\t\t\t\t\twhen(prose(\"& :where(th, td)\"), raw({ paddingInline: \"1em\" })),\n\t\t\t\t\t\t\twhen(prose(\"& :where(pre)\"), raw({ paddingInline: \"1.25em\" })),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(pre)\"), leading(1.6)),\n\n\t\t\t\t\t\twhen(prose(\"& :where(h1, h2, h3, h4, h5, h6)\"), [\n\t\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\t\tleading(1.25),\n\t\t\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tbalance(),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(prose(\"& :where(h6)\"), fg(\"neutral\")),\n\n\t\t\t\t\t\twhen(prose(\"& :where(p, li, blockquote, dd)\"), pretty()),\n\n\t\t\t\t\t\twhen(prose(\"& :where(ul, ol)\"), pis(\"1.5em\")),\n\t\t\t\t\t\twhen(prose(\"& :where(li)::marker\"), fg(\"neutral.muted\")),\n\n\t\t\t\t\t\twhen(prose(\"& :where(blockquote)\"), [\n\t\t\t\t\t\t\tpis(\"1em\"),\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\tborderEdge(\"inline-start\", { color: \"neutral\", width: \"0.25em\" }),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\tprose(\"& :where(hr)\"),\n\t\t\t\t\t\t\tborderEdge(\"block-start\", { color: \"neutral\", width: \"1px\" }),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\twhen(prose(\"& :where(a)\"), [fg(\"brand\"), textDecoration(\"underline\")]),\n\t\t\t\t\t\twhen(prose(\"& :where(a):focus-visible\"), [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\trounded(\"xs\"),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(strong, b)\"), [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(code)\"), [\n\t\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tpi(\"0.3em\"),\n\t\t\t\t\t\t\tpb(\"0.15em\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(prose(\"& :where(pre)\"), [\n\t\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\t\tborder({ color: \"neutral.border\", width: 1 }),\n\t\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tpi(\"1em\"),\n\t\t\t\t\t\t\tpb(\"0.875em\"),\n\t\t\t\t\t\t\toverflowInline(\"auto\"),\n\t\t\t\t\t\t\toverflowBlock(\"hidden\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\t\t\toverscrollBehaviorX: \"contain\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A fenced block's `code` is an inline box, so the chip padding above would\n\t\t\t\t\t\t * apply at the start of the box alone and indent the block's first line\n\t\t\t\t\t\t * past every line under it. The block's own padding is the `pre`'s.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(prose(\"& :where(pre code)\"), [\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\t\tpi(0),\n\t\t\t\t\t\t\tpb(0),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen(prose(\"& :where(table)\"), [\n\t\t\t\t\t\t\tblock(),\n\t\t\t\t\t\t\tis(\"max(100%, max-content)\"),\n\t\t\t\t\t\t\tmaxIs(\"full\"),\n\t\t\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(prose(\"& :where(th, td):not([align])\"), textAlign(\"start\")),\n\t\t\t\t\t\twhen(prose(\"& :where(th)\"), [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\t\twhen(prose(\"& :where(th, td)\"), [\n\t\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\t\tpi(\"0.75em\"),\n\t\t\t\t\t\t\tpb(\"0.5em\"),\n\t\t\t\t\t\t\tborderEdge(\"block-end\", { color: \"neutral\", width: \"1px\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
11
11
  },
12
12
  "test": {
13
13
  "path": "typeset.test.tsx",
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The app's CI, run by `sdxc ci` on a laptop and on GitHub Actions alike: the kit's checks,
3
+ * formatting, lint and types, then the build and the tests. A green local run signs the commit
4
+ * off, and GitHub Actions skips its own run for a commit a contributor signed off.
5
+ */
6
+
7
+ import { defineCI } from "@sdxc/ci";
8
+
9
+ export default defineCI(async (ci) => {
10
+ if (ci.runner === "remote") {
11
+ await ci.step("Example secrets", ["cp", ".env.example", ".dev.vars"], { halt: true });
12
+ }
13
+
14
+ await ci.parallel("Checks", [
15
+ () => ci.step("Doctor", "bunx sdxc doctor"),
16
+ () => ci.step("Format, lint and types", "bun run check"),
17
+ ]);
18
+
19
+ await ci.parallel("Build and test", [
20
+ () => ci.step("Build", "bun run build"),
21
+ () => ci.step("Test", "bun run test", { cache: true }),
22
+ ]);
23
+
24
+ if (ci.status === "passing") await ci.signoff("All systems go.");
25
+ else ci.failure("CI failed. Do not push.", "Fix the steps above and run `sdxc ci` again.");
26
+ });