@sdxc/kit 2026.10.21 → 2026.10.24

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 (113) hide show
  1. package/README.md +84 -4
  2. package/changelog.jsonl +168 -0
  3. package/config.schema.json +154 -0
  4. package/dist/architecture/complexity.d.ts +73 -0
  5. package/dist/architecture/complexity.js +185 -0
  6. package/dist/architecture/crap.d.ts +62 -0
  7. package/dist/architecture/crap.js +121 -0
  8. package/dist/architecture/graph.d.ts +55 -0
  9. package/dist/architecture/graph.js +194 -0
  10. package/dist/architecture/layers.d.ts +29 -0
  11. package/dist/architecture/layers.js +81 -0
  12. package/dist/architecture/mermaid.d.ts +20 -0
  13. package/dist/architecture/mermaid.js +51 -0
  14. package/dist/cli.js +9 -0
  15. package/dist/commands/create.js +4 -3
  16. package/dist/commands/deploy.js +10 -9
  17. package/dist/commands/destroy.d.ts +1 -1
  18. package/dist/commands/diagram.d.ts +17 -0
  19. package/dist/commands/diagram.js +45 -0
  20. package/dist/commands/fix.d.ts +69 -0
  21. package/dist/commands/fix.js +102 -0
  22. package/dist/commands/make.d.ts +71 -2
  23. package/dist/commands/make.js +46 -0
  24. package/dist/commands/run.d.ts +15 -11
  25. package/dist/commands/run.js +21 -16
  26. package/dist/commands/scaffold.d.ts +1 -1
  27. package/dist/commands/setup.d.ts +26 -0
  28. package/dist/commands/setup.js +33 -0
  29. package/dist/config.d.ts +52 -0
  30. package/dist/config.js +88 -1
  31. package/dist/contract.d.ts +52 -3
  32. package/dist/contract.js +124 -2
  33. package/dist/dependencies.js +7 -1
  34. package/dist/deploy/plan.d.ts +5 -0
  35. package/dist/deploy/plan.js +10 -0
  36. package/dist/destroy.js +13 -6
  37. package/dist/diagram.d.ts +32 -0
  38. package/dist/diagram.js +47 -0
  39. package/dist/doctor/checks.d.ts +2 -1
  40. package/dist/doctor/checks.js +24 -1
  41. package/dist/doctor/complexity.d.ts +13 -0
  42. package/dist/doctor/complexity.js +52 -0
  43. package/dist/doctor/crap.d.ts +14 -0
  44. package/dist/doctor/crap.js +67 -0
  45. package/dist/doctor/dependencies.d.ts +13 -0
  46. package/dist/doctor/dependencies.js +42 -0
  47. package/dist/doctor/duplication.d.ts +19 -0
  48. package/dist/doctor/duplication.js +106 -0
  49. package/dist/doctor/fan-out.d.ts +12 -0
  50. package/dist/doctor/fan-out.js +42 -0
  51. package/dist/doctor/feature-scatter.d.ts +15 -0
  52. package/dist/doctor/feature-scatter.js +84 -0
  53. package/dist/doctor/module-size.d.ts +13 -0
  54. package/dist/doctor/module-size.js +50 -0
  55. package/dist/doctor/mutation.d.ts +20 -0
  56. package/dist/doctor/mutation.js +97 -0
  57. package/dist/doctor/orphans.d.ts +13 -0
  58. package/dist/doctor/orphans.js +50 -0
  59. package/dist/doctor/project.js +8 -5
  60. package/dist/doctor/result-throws.d.ts +17 -0
  61. package/dist/doctor/result-throws.js +72 -0
  62. package/dist/doctor/test-ratio.d.ts +12 -0
  63. package/dist/doctor/test-ratio.js +31 -0
  64. package/dist/fix/commands.d.ts +37 -0
  65. package/dist/fix/commands.js +63 -0
  66. package/dist/fix/emails.d.ts +21 -0
  67. package/dist/fix/emails.js +159 -0
  68. package/dist/fix/env.d.ts +29 -0
  69. package/dist/fix/env.js +58 -0
  70. package/dist/fix/index.d.ts +11 -0
  71. package/dist/fix/index.js +11 -0
  72. package/dist/fix/models.d.ts +20 -0
  73. package/dist/fix/models.js +95 -0
  74. package/dist/lock.js +12 -2
  75. package/dist/make/binding.d.ts +42 -0
  76. package/dist/make/binding.js +237 -0
  77. package/dist/make/imports.js +7 -5
  78. package/dist/make/schema-diff.js +8 -1
  79. package/dist/models.js +7 -7
  80. package/dist/routes/modules.js +8 -5
  81. package/dist/routes/parse.js +8 -7
  82. package/dist/routes/routers.js +9 -5
  83. package/dist/setup/auth.d.ts +12 -0
  84. package/dist/setup/auth.js +209 -0
  85. package/dist/setup/billing.d.ts +11 -0
  86. package/dist/setup/billing.js +116 -0
  87. package/dist/setup/catalog.d.ts +25 -0
  88. package/dist/setup/catalog.js +34 -0
  89. package/dist/setup/credit.d.ts +13 -0
  90. package/dist/setup/credit.js +21 -0
  91. package/dist/setup/flags.d.ts +11 -0
  92. package/dist/setup/flags.js +62 -0
  93. package/dist/setup/index.d.ts +25 -0
  94. package/dist/setup/index.js +53 -0
  95. package/dist/setup/plan.d.ts +38 -0
  96. package/dist/setup/plan.js +62 -0
  97. package/dist/testing.js +3 -3
  98. package/dist/ui/layout.js +1 -1
  99. package/dist/ui/registry.d.ts +2 -2
  100. package/dist/upgrade/project.d.ts +2 -2
  101. package/dist/upgrade/prompt.js +7 -5
  102. package/package.json +11 -8
  103. package/registry/ui/attachment.json +2 -2
  104. package/registry/ui/breadcrumbs.json +6 -3
  105. package/registry/ui/group.json +6 -3
  106. package/registry/ui/link-button.json +3 -3
  107. package/registry/ui/link.json +6 -3
  108. package/registry/ui/nav-link.json +6 -3
  109. package/registry/ui/navigation-menu.json +6 -3
  110. package/registry/ui/pagination.json +3 -3
  111. package/registry/ui/sidebar.json +3 -3
  112. package/templates/app/AGENTS.md +14 -1
  113. package/templates/app/package.json +1 -1
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Shared setup plan: every path a feature will write or edit, printed before confirmation so
3
+ * `--dry-run` is the default agent path until `-y` asks to write.
4
+ *
5
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
6
+ * @copyright Sergio Xalambrí 2026
7
+ */
8
+ import { access, mkdir, readFile, writeFile } from "node:fs/promises";
9
+ import { dirname, join } from "node:path";
10
+ import { failure, isFailure, isSuccess, success, wrap } from "@sdxc/result";
11
+ import { unifiedDiff } from "../diff.js";
12
+ /** Prints the plan as the operator and agent read it. */
13
+ export function formatPlan(plan) {
14
+ let lines = [
15
+ `setup ${plan.feature}${plan.provider === null ? "" : ` --provider ${plan.provider}`}`,
16
+ ];
17
+ for (let file of plan.files)
18
+ lines.push(` write ${file.path}`);
19
+ for (let edit of plan.edits)
20
+ lines.push(` edit ${edit.path}`);
21
+ for (let dependency of plan.dependencies)
22
+ lines.push(` depend ${dependency}`);
23
+ for (let note of plan.notes)
24
+ lines.push(` note ${note}`);
25
+ return `${lines.join("\n")}\n`;
26
+ }
27
+ /** Writes the plan's files and edits; under `dryRun` prints diffs and changes nothing. */
28
+ export async function applyPlan(root, plan, options) {
29
+ if (options.dryRun) {
30
+ options.stdout(formatPlan(plan));
31
+ for (let file of plan.files) {
32
+ options.stdout(unifiedDiff(file.path, null, file.content));
33
+ }
34
+ for (let edit of plan.edits) {
35
+ options.stdout(unifiedDiff(edit.path, edit.before, edit.after));
36
+ }
37
+ return success(undefined);
38
+ }
39
+ for (let file of plan.files) {
40
+ let target = join(root, file.path);
41
+ if (isSuccess(await wrap(() => access(target)))) {
42
+ return failure(new Error(`${file.path} already exists; refuse to overwrite a hand-edited file`));
43
+ }
44
+ await mkdir(dirname(target), { recursive: true });
45
+ await writeFile(target, file.content);
46
+ options.stdout(`wrote ${file.path}\n`);
47
+ }
48
+ for (let edit of plan.edits) {
49
+ await writeFile(join(root, edit.path), edit.after);
50
+ options.stdout(`edited ${edit.path}\n`);
51
+ }
52
+ for (let note of plan.notes)
53
+ options.stdout(`${note}\n`);
54
+ return success(undefined);
55
+ }
56
+ /** Reads a project file, or fails naming the path. */
57
+ export async function readProjectFile(root, path) {
58
+ let source = await wrap(() => readFile(join(root, path), "utf8"));
59
+ if (isFailure(source))
60
+ return failure(new Error(`No ${path} in the project`));
61
+ return success(source.data);
62
+ }
package/dist/testing.js CHANGED
@@ -133,7 +133,7 @@ async function installed(packageRoot, dependency) {
133
133
  }
134
134
  /** Runs a script with `args` in `cwd` under `runtime`, Node by default, collecting both output streams. */
135
135
  function run(args, cwd, runtime = process.execPath) {
136
- return new Promise((settle) => {
136
+ return new Promise((resolve) => {
137
137
  let output = "";
138
138
  let child = spawn(runtime, args, { cwd, shell: false });
139
139
  child.stdout.on("data", (chunk) => {
@@ -142,7 +142,7 @@ function run(args, cwd, runtime = process.execPath) {
142
142
  child.stderr.on("data", (chunk) => {
143
143
  output += chunk.toString();
144
144
  });
145
- child.once("error", (error) => settle({ code: null, output: error.message }));
146
- child.once("close", (code) => settle({ code, output }));
145
+ child.once("error", (error) => resolve({ code: null, output: error.message }));
146
+ child.once("close", (code) => resolve({ code, output }));
147
147
  });
148
148
  }
package/dist/ui/layout.js CHANGED
@@ -111,7 +111,7 @@ async function readCompilerOptions(path, depth) {
111
111
  let options = await readCompilerOptions(file, depth + 1);
112
112
  if (isFailure(options))
113
113
  return options;
114
- inherited = { ...inherited, ...options.data };
114
+ Object.assign(inherited, options.data);
115
115
  }
116
116
  }
117
117
  let own = config.compilerOptions ?? {};
@@ -18,12 +18,12 @@ export declare const REGISTRY_ENTRY: s.Schema<{
18
18
  path: string;
19
19
  content: string;
20
20
  };
21
+ exports: string[];
21
22
  test: {
22
23
  path: string;
23
24
  content: string;
24
25
  } | null;
25
26
  changedIn: string;
26
- exports: string[];
27
27
  }, {
28
28
  name: string;
29
29
  dependencies: string[];
@@ -31,12 +31,12 @@ export declare const REGISTRY_ENTRY: s.Schema<{
31
31
  path: string;
32
32
  content: string;
33
33
  };
34
+ exports: string[];
34
35
  test: {
35
36
  path: string;
36
37
  content: string;
37
38
  } | null;
38
39
  changedIn: string;
39
- exports: string[];
40
40
  }>;
41
41
  /** A component as the installed release ships it. */
42
42
  export type RegistryEntry = s.InferOutput<typeof REGISTRY_ENTRY>;
@@ -12,16 +12,16 @@ declare const MANIFEST_SCHEMA: s.Schema<{
12
12
  name?: string | undefined;
13
13
  dependencies?: Record<string, string> | undefined;
14
14
  devDependencies?: Record<string, string> | undefined;
15
+ optionalDependencies?: Record<string, string> | undefined;
15
16
  packageManager?: string | undefined;
16
17
  scripts?: Record<string, string> | undefined;
17
- optionalDependencies?: Record<string, string> | undefined;
18
18
  }, {
19
19
  name?: string | undefined;
20
20
  dependencies?: Record<string, string> | undefined;
21
21
  devDependencies?: Record<string, string> | undefined;
22
+ optionalDependencies?: Record<string, string> | undefined;
22
23
  packageManager?: string | undefined;
23
24
  scripts?: Record<string, string> | undefined;
24
- optionalDependencies?: Record<string, string> | undefined;
25
25
  }>;
26
26
  /** The project's `package.json` fields the upgrade reads. */
27
27
  export type Manifest = s.InferOutput<typeof MANIFEST_SCHEMA>;
@@ -225,11 +225,13 @@ function agentsNote(input) {
225
225
  }
226
226
  let url = `${PACKAGE_FILES}/${RELEASE_PACKAGE}@${input.to}/${AGENTS_TEMPLATE}`;
227
227
  let markers = "`<!-- sdxc:start …-->` and `<!-- sdxc:end -->`";
228
- let state = input.agents === "missing"
229
- ? `This project has no \`${AGENTS_FILE}\`.`
230
- : input.agents === "unmarked"
231
- ? `\`${AGENTS_FILE}\` has no sdxc section, so the upgrade left it as it is.`
232
- : `\`${AGENTS_FILE}\` needs exactly one ${markers} line pair, so the upgrade left it as it is.`;
228
+ let state;
229
+ if (input.agents === "missing")
230
+ state = `This project has no \`${AGENTS_FILE}\`.`;
231
+ else if (input.agents === "unmarked")
232
+ state = `\`${AGENTS_FILE}\` has no sdxc section, so the upgrade left it as it is.`;
233
+ else
234
+ state = `\`${AGENTS_FILE}\` needs exactly one ${markers} line pair, so the upgrade left it as it is.`;
233
235
  let action = input.agents === "unbalanced"
234
236
  ? `Restore one pair around the sdxc section, which for release ${input.to} is in ${url}.`
235
237
  : `When this project is an app in the sdxc layout (it has \`bootstrap/worker.ts\`), add the section from ${url}, ${markers} lines included, to \`${AGENTS_FILE}\`, creating the file if needed; \`sdxc upgrade\` then keeps it current.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdxc/kit",
3
- "version": "2026.10.21",
3
+ "version": "2026.10.24",
4
4
  "description": "The sdxc command line: start a Remix v3 app, generate its files, copy UI components into it and upgrade it",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -14,19 +14,22 @@
14
14
  "./lock.schema.json": "./lock.schema.json"
15
15
  },
16
16
  "dependencies": {
17
- "@sdxc/cli": "2026.10.20",
18
- "@sdxc/codemod": "2026.10.20",
19
- "@sdxc/cron": "2026.10.13",
20
- "@sdxc/json-schema": "2026.10.16",
17
+ "@sdxc/cli": "2026.10.24",
18
+ "@sdxc/codemod": "2026.10.23",
19
+ "@sdxc/cron": "2026.10.23",
20
+ "@sdxc/diagram": "2026.10.24",
21
+ "@sdxc/iife": "2026.10.23",
22
+ "@sdxc/json-schema": "2026.10.24",
21
23
  "@sdxc/jsonc": "2026.10.16",
22
24
  "@sdxc/jsonl": "2026.10.16",
23
25
  "@sdxc/result": "2026.10.13",
24
- "@sdxc/semver": "2026.10.13"
26
+ "@sdxc/semver": "2026.10.13",
27
+ "oxc-parser": "^0.154.0"
25
28
  },
26
29
  "peerDependencies": {
27
- "remix": "3.0.0"
30
+ "remix": "3.1.0"
28
31
  },
29
- "gitHead": "b64617ec8a697696a1fe6fb0f704fb9017b6a7a0",
32
+ "gitHead": "f9db0f8f1f51a256e74b94b0f4b1db4be9880370",
30
33
  "publishConfig": {
31
34
  "access": "public"
32
35
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attachment",
3
- "changedIn": "2026.10.20",
3
+ "changedIn": "2026.10.23",
4
4
  "dependencies": [
5
5
  "button"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "attachment.tsx",
12
- "content": "/**\n * A compound card presenting one attached file or image — media preview, name,\n * supporting details, actions — plus a horizontally scrolling row for several\n * cards side by side. Every part styles itself off the card's own `state`, and\n * whole-card click-through stays an opt-in wrapper a consumer mixes in.\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 { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded, transition } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tblock,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thstack,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow, overflowX } from \"@sdxc/u/overflow\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { aspect, bs, fit, is, minIs, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, textAlign, truncate, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { shimmer } from \"@sdxc/ui/animations\";\nimport { scrollFade } from \"@sdxc/ui/animations\";\n\nimport { Button } from \"@sdxc/ui/button\";\n\nconst DEFAULT_STATE: Attachment.State = \"idle\";\n\n/**\n * Named container {@link Attachment} declares on its own host, so\n * {@link Attachment.Media}, {@link Attachment.Content}, and the inner layout\n * wrapper resolve their width queries against the card itself.\n */\nconst CONTAINER_NAME = \"ui-attachment\";\n\n/**\n * `@container` query every width-adapting part below the root shares: at or\n * under this width the card reflows into a taller tile, the shape\n * {@link Attachment.Group}'s narrow, fixed-width cards need.\n */\nconst NARROW_CONTAINER_QUERY = `@container ${CONTAINER_NAME} (max-width: 12rem)`;\n\n/**\n * Selector fragment gating {@link Attachment.Title}'s shimmer: it matches the\n * title's own `data-state` attribute while that reads `\"uploading\"` or\n * `\"processing\"`, so a title in any other state renders as plain text.\n */\nconst TITLE_SHIMMER_WHEN = ':is([data-state=\"uploading\"], [data-state=\"processing\"])';\n\nconst DEFAULT_ACTION_VARIANT: Button.Variant = \"ghost\";\n\nconst DEFAULT_ACTION_SIZE: Button.Size = \"sm\";\n\nconst DEFAULT_ACTION_COLOR: Button.Color = \"neutral\";\n\n/**\n * Tab-stop order {@link attrs} applies to {@link Attachment.Group} when a\n * consumer supplies no `tabIndex`, so the row itself stays keyboard-reachable\n * and scrollable whatever its cards contain.\n */\nconst DEFAULT_GROUP_TAB_INDEX = 0;\n\nconst GROUP_SCROLL_FADE_SIZE = \"2rem\";\n\n/**\n * Prop types for {@link Attachment} and its compound parts.\n */\nexport namespace Attachment {\n\t/**\n\t * Lifecycle state of a card's file or image. `\"idle\"` and `\"done\"` both\n\t * render as a settled card — `\"idle\"` for a file already on the server,\n\t * `\"done\"` for one whose transfer finished. A consumer owns every transition.\n\t */\n\texport type State = \"idle\" | \"uploading\" | \"processing\" | \"error\" | \"done\";\n\n\t/**\n\t * Props accepted by {@link Attachment}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Lifecycle state of the file or image the card represents. Defaults to `\"idle\"`. */\n\t\tstate?: State;\n\t\t/** The card's compound parts: {@link Attachment.Media}, {@link Attachment.Content}, and {@link Attachment.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The preview itself: an `<img>`, or a decorative icon standing in for the file's type. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Attachment.Title} and, optionally, {@link Attachment.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"p\"> {\n\t\t/**\n\t\t * The ancestor {@link Attachment}'s own `state`, repeated here because a\n\t\t * component reads only its own props; passing the same value to both is\n\t\t * what keeps them in sync. Left unset, the title renders plain.\n\t\t */\n\t\tstate?: Attachment.State;\n\t\t/** The file or image name. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail — a file size, a page count, an error message. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment.Action} controls. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Action}: every {@link Button.Props}\n\t * field, unchanged, so an action keeps the same color, weight, and size\n\t * contract as every other button in the catalog.\n\t */\n\texport interface ActionProps extends Button.Props {}\n\n\t/**\n\t * Props accepted by {@link Attachment.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Destination the whole card follows once `attachmentTrigger()` is mixed\n\t\t * in, opened in place unless the activation asks for a new tab. It rides on\n\t\t * a `<div>` so a nested {@link Attachment.Action} stays valid markup.\n\t\t */\n\t\thref?: string;\n\t\t/**\n\t\t * `id` of a `<dialog>` element the whole card opens once\n\t\t * `attachmentTrigger()` is mixed in, instead of following `href`.\n\t\t */\n\t\tcommandfor?: string;\n\t\t/** Invoker Commands verb dispatched to `commandfor`'s dialog. Defaults to `\"show-modal\"`. */\n\t\tcommand?: \"show-modal\";\n\t\t/** Where `href` opens: a window/frame name, or `\"_blank\"` for a new tab. Meaningful only alongside `href`. */\n\t\ttarget?: string;\n\t\t/** The card's own markup — typically an {@link Attachment}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment} or {@link Attachment.Trigger} cards. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * The card's outer host, recolored to the danger tint at `state=\"error\"` and\n * declaring the `ui-attachment` named container so nested parts reflow at the\n * card's width. A busy state sets `aria-busy` to the token ARIA recognizes.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the card's markup.\n * @example\n * <Attachment state=\"uploading\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title state=\"uploading\">quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploading\")}</Attachment.Description>\n * \t</Attachment.Content>\n * </Attachment>\n * @example\n * <Attachment state=\"error\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n * \t</Attachment.Content>\n * \t<Attachment.Actions>\n * \t\t<Attachment.Action aria-label={t(\"attachment.retry\")}><RotateCwIcon /></Attachment.Action>\n * \t</Attachment.Actions>\n * </Attachment>\n */\nexport function Attachment(handle: Handle<Attachment.Props>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\t\tlet resolvedState = state ?? DEFAULT_STATE;\n\t\tlet isBusy = resolvedState === \"uploading\" || resolvedState === \"processing\";\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"attachment\"\n\t\t\t\tdata-state={resolvedState}\n\t\t\t\taria-busy={isBusy ? \"true\" : undefined}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tp(3),\n\t\t\t\t\ttransition(\"border-color, background-color\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\twhen('&[data-state=\"error\"]', [\n\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\tfg(\"danger.emphasis\"),\n\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<div\n\t\t\t\t\tdata-slot=\"body\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\thstack({ gap: 3, align: \"center\" }),\n\t\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [flexCol(), items(\"stretch\")]),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * The card's media well: a fixed-size, rounded box clipping the preview a\n * consumer nests inside. Inside a narrow container it grows to the card's own\n * inline size at a wider aspect ratio, reading as a thumbnail tile.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media well's markup.\n * @example\n * <Attachment.Media><img src={file.thumbnailUrl} alt=\"\" /></Attachment.Media>\n * @example\n * <Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n */\nAttachment.Media = function AttachmentMedia(handle: Handle<Attachment.MediaProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"media\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(0),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tis(10),\n\t\t\t\t\tbs(10),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\twhen(\"& > img\", [is(\"full\"), bs(\"full\"), fit(\"cover\")]),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [is(\"full\"), bs(\"auto\"), aspect(4, 3), rounded(\"lg\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The card's text column, growing into whatever inline space\n * {@link Attachment.Media} and {@link Attachment.Actions} leave it. Its minimum\n * inline size collapses to `0`, which is what lets its children truncate.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Attachment.Content>\n * \t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t<Attachment.Description>2.4 MB</Attachment.Description>\n * </Attachment.Content>\n */\nAttachment.Content = function AttachmentContent(handle: Handle<Attachment.ContentProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tvstack({ gap: 0.5 }),\n\t\t\t\t\tminIs(0),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, textAlign(\"center\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The file or image name in a native `<p>`, truncated to a single line with an\n * ellipsis. Given the same `state` as the ancestor {@link Attachment}, it\n * shimmers while that reads `\"uploading\"` or `\"processing\"`, then settles.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * @example\n * <Attachment.Title state={attachment.state}>{attachment.name}</Attachment.Title>\n */\nAttachment.Title = function AttachmentTitle(handle: Handle<Attachment.TitleProps>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tdata-state={state}\n\t\t\t\tmix={[\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The loop settles visible, because this host carries the file's name: a gated\n\t\t\t\t\t * loop rests hidden outside its gate, which suits an element that exists only\n\t\t\t\t\t * as a loading cue and would leave every finished upload unnamed.\n\t\t\t\t\t */\n\t\t\t\t\tshimmer({ when: TITLE_SHIMMER_WHEN, outsideGate: \"visible\" }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's supporting detail line: a muted, single-line `<p>` carrying a file\n * size, a page count, or the explanation of what went wrong once the ancestor\n * {@link Attachment}'s `state` reads `\"error\"`.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Attachment.Description>2.4 MB</Attachment.Description>\n * @example\n * <Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n */\nAttachment.Description = function AttachmentDescription(\n\thandle: Handle<Attachment.DescriptionProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p {...rest} data-slot=\"description\" mix={[truncate(), fg(\"neutral.muted\"), text(\"xs\"), mix]}>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's action row, shrink-proof so a narrow card's width is absorbed by\n * {@link Attachment.Content}'s own truncation while the actions keep their\n * size.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Attachment.Actions>\n * \t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t<Attachment.Action aria-label={t(\"attachment.remove\")}><XIcon /></Attachment.Action>\n * </Attachment.Actions>\n */\nAttachment.Actions = function AttachmentActions(handle: Handle<Attachment.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"actions\" mix={[flex(), shrink(0), items(\"center\"), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A single card action as a {@link Button}, defaulting to a compact, `\"ghost\"`,\n * neutral control so a row of actions reads as secondary to the card's title.\n * Every {@link Button} prop stays available, `type` included.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the action's markup.\n * @example\n * <Attachment.Action aria-label={t(\"attachment.download\")}>\n * \t<DownloadIcon />\n * </Attachment.Action>\n * @example\n * <Attachment.Action type=\"submit\" name=\"intent\" value=\"retry\" aria-label={t(\"attachment.retry\")}>\n * \t<RotateCwIcon />\n * </Attachment.Action>\n */\nAttachment.Action = function AttachmentAction(handle: Handle<Attachment.ActionProps>) {\n\treturn () => {\n\t\tlet { color, variant, size, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tcolor={color ?? DEFAULT_ACTION_COLOR}\n\t\t\t\tvariant={variant ?? DEFAULT_ACTION_VARIANT}\n\t\t\t\tsize={size ?? DEFAULT_ACTION_SIZE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"action\"\n\t\t\t\tmix={[shrink(0), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * A wrapper `<div>` whose `href` or `commandfor` stays an inert attribute until\n * a consumer mixes in `attachmentTrigger()`. Either one also derives a `role`\n * and `tabIndex`, so whole-card activation is announced and keyboard-reachable.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the wrapper's markup.\n * @example\n * <Attachment.Trigger href=\"/files/quarterly-report.pdf\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">\n * \t\t<Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n * \t\t<Attachment.Content>\n * \t\t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t</Attachment.Content>\n * \t\t<Attachment.Actions>\n * \t\t\t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t\t</Attachment.Actions>\n * \t</Attachment>\n * </Attachment.Trigger>\n * @example\n * <Attachment.Trigger commandfor=\"quarterly-report-preview\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">…</Attachment>\n * </Attachment.Trigger>\n * <Dialog id=\"quarterly-report-preview\">…</Dialog>\n */\nAttachment.Trigger = function AttachmentTrigger(handle: Handle<Attachment.TriggerProps>) {\n\treturn () => {\n\t\tlet { href, commandfor, command, target, role, tabIndex, children, mix, ...rest } =\n\t\t\thandle.props;\n\t\tlet isConfigured = href !== undefined || commandfor !== undefined;\n\t\tlet resolvedRole = role ?? (href !== undefined ? \"link\" : isConfigured ? \"button\" : undefined);\n\t\tlet resolvedTabIndex = tabIndex ?? (isConfigured ? 0 : undefined);\n\n\t\tif (import.meta.env?.DEV && !isConfigured) {\n\t\t\tconsole.warn(\n\t\t\t\t'Attachment.Trigger: rendered with neither \"href\" nor \"commandfor\" — nothing will happen once `attachmentTrigger()` handles an activation.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\trole={resolvedRole}\n\t\t\t\ttabIndex={resolvedTabIndex}\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ href, commandfor, command, target }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tblock(),\n\t\t\t\t\trounded(\"inherit\"),\n\t\t\t\t\twhen(\"&[role]:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&[role]:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A horizontally scroll-snapping row of cards, faded at both inline edges to\n * hint at cards beyond the current view. The row itself carries the tab stop,\n * since the row is what scrolls.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Attachment.Group aria-label={t(\"thread.attachments\")}>\n * \t{attachments.map((attachment) => (\n * \t\t<Attachment key={attachment.id} state={attachment.state}>…</Attachment>\n * \t))}\n * </Attachment.Group>\n */\nAttachment.Group = function AttachmentGroup(handle: Handle<Attachment.GroupProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ tabIndex: DEFAULT_GROUP_TAB_INDEX }),\n\t\t\t\t\tflex(),\n\t\t\t\t\tgap(3),\n\t\t\t\t\toverflowX(\"auto\"),\n\t\t\t\t\traw({\n\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\tscrollSnapType: \"inline mandatory\",\n\t\t\t\t\t\tscrollPaddingInline: \"0.75rem\",\n\t\t\t\t\t\tscrollBehavior: \"auto\",\n\t\t\t\t\t}),\n\t\t\t\t\twhen(\"& > *\", [shrink(0), raw({ scrollSnapAlign: \"start\" })]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: no-preference)\", raw({ scrollBehavior: \"smooth\" })),\n\t\t\t\t\tscrollFade({ axis: \"inline\", size: GROUP_SCROLL_FADE_SIZE }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
12
+ "content": "/**\n * A compound card presenting one attached file or image — media preview, name,\n * supporting details, actions — plus a horizontally scrolling row for several\n * cards side by side. Every part styles itself off the card's own `state`, and\n * whole-card click-through stays an opt-in wrapper a consumer mixes in.\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 { iife } from \"@sdxc/iife\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded, transition } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tblock,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thstack,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow, overflowX } from \"@sdxc/u/overflow\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { aspect, bs, fit, is, minIs, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, textAlign, truncate, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { shimmer } from \"@sdxc/ui/animations\";\nimport { scrollFade } from \"@sdxc/ui/animations\";\n\nimport { Button } from \"@sdxc/ui/button\";\n\nconst DEFAULT_STATE: Attachment.State = \"idle\";\n\n/**\n * Named container {@link Attachment} declares on its own host, so\n * {@link Attachment.Media}, {@link Attachment.Content}, and the inner layout\n * wrapper resolve their width queries against the card itself.\n */\nconst CONTAINER_NAME = \"ui-attachment\";\n\n/**\n * `@container` query every width-adapting part below the root shares: at or\n * under this width the card reflows into a taller tile, the shape\n * {@link Attachment.Group}'s narrow, fixed-width cards need.\n */\nconst NARROW_CONTAINER_QUERY = `@container ${CONTAINER_NAME} (max-width: 12rem)`;\n\n/**\n * Selector fragment gating {@link Attachment.Title}'s shimmer: it matches the\n * title's own `data-state` attribute while that reads `\"uploading\"` or\n * `\"processing\"`, so a title in any other state renders as plain text.\n */\nconst TITLE_SHIMMER_WHEN = ':is([data-state=\"uploading\"], [data-state=\"processing\"])';\n\nconst DEFAULT_ACTION_VARIANT: Button.Variant = \"ghost\";\n\nconst DEFAULT_ACTION_SIZE: Button.Size = \"sm\";\n\nconst DEFAULT_ACTION_COLOR: Button.Color = \"neutral\";\n\n/**\n * Tab-stop order {@link attrs} applies to {@link Attachment.Group} when a\n * consumer supplies no `tabIndex`, so the row itself stays keyboard-reachable\n * and scrollable whatever its cards contain.\n */\nconst DEFAULT_GROUP_TAB_INDEX = 0;\n\nconst GROUP_SCROLL_FADE_SIZE = \"2rem\";\n\n/**\n * Prop types for {@link Attachment} and its compound parts.\n */\nexport namespace Attachment {\n\t/**\n\t * Lifecycle state of a card's file or image. `\"idle\"` and `\"done\"` both\n\t * render as a settled card — `\"idle\"` for a file already on the server,\n\t * `\"done\"` for one whose transfer finished. A consumer owns every transition.\n\t */\n\texport type State = \"idle\" | \"uploading\" | \"processing\" | \"error\" | \"done\";\n\n\t/**\n\t * Props accepted by {@link Attachment}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Lifecycle state of the file or image the card represents. Defaults to `\"idle\"`. */\n\t\tstate?: State;\n\t\t/** The card's compound parts: {@link Attachment.Media}, {@link Attachment.Content}, and {@link Attachment.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The preview itself: an `<img>`, or a decorative icon standing in for the file's type. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Attachment.Title} and, optionally, {@link Attachment.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"p\"> {\n\t\t/**\n\t\t * The ancestor {@link Attachment}'s own `state`, repeated here because a\n\t\t * component reads only its own props; passing the same value to both is\n\t\t * what keeps them in sync. Left unset, the title renders plain.\n\t\t */\n\t\tstate?: Attachment.State;\n\t\t/** The file or image name. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail — a file size, a page count, an error message. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment.Action} controls. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Action}: every {@link Button.Props}\n\t * field, unchanged, so an action keeps the same color, weight, and size\n\t * contract as every other button in the catalog.\n\t */\n\texport interface ActionProps extends Button.Props {}\n\n\t/**\n\t * Props accepted by {@link Attachment.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Destination the whole card follows once `attachmentTrigger()` is mixed\n\t\t * in, opened in place unless the activation asks for a new tab. It rides on\n\t\t * a `<div>` so a nested {@link Attachment.Action} stays valid markup.\n\t\t */\n\t\thref?: string;\n\t\t/**\n\t\t * `id` of a `<dialog>` element the whole card opens once\n\t\t * `attachmentTrigger()` is mixed in, instead of following `href`.\n\t\t */\n\t\tcommandfor?: string;\n\t\t/** Invoker Commands verb dispatched to `commandfor`'s dialog. Defaults to `\"show-modal\"`. */\n\t\tcommand?: \"show-modal\";\n\t\t/** Where `href` opens: a window/frame name, or `\"_blank\"` for a new tab. Meaningful only alongside `href`. */\n\t\ttarget?: string;\n\t\t/** The card's own markup — typically an {@link Attachment}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment} or {@link Attachment.Trigger} cards. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * The card's outer host, recolored to the danger tint at `state=\"error\"` and\n * declaring the `ui-attachment` named container so nested parts reflow at the\n * card's width. A busy state sets `aria-busy` to the token ARIA recognizes.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the card's markup.\n * @example\n * <Attachment state=\"uploading\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title state=\"uploading\">quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploading\")}</Attachment.Description>\n * \t</Attachment.Content>\n * </Attachment>\n * @example\n * <Attachment state=\"error\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n * \t</Attachment.Content>\n * \t<Attachment.Actions>\n * \t\t<Attachment.Action aria-label={t(\"attachment.retry\")}><RotateCwIcon /></Attachment.Action>\n * \t</Attachment.Actions>\n * </Attachment>\n */\nexport function Attachment(handle: Handle<Attachment.Props>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\t\tlet resolvedState = state ?? DEFAULT_STATE;\n\t\tlet isBusy = resolvedState === \"uploading\" || resolvedState === \"processing\";\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"attachment\"\n\t\t\t\tdata-state={resolvedState}\n\t\t\t\taria-busy={isBusy ? \"true\" : undefined}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tp(3),\n\t\t\t\t\ttransition(\"border-color, background-color\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\twhen('&[data-state=\"error\"]', [\n\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\tfg(\"danger.emphasis\"),\n\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<div\n\t\t\t\t\tdata-slot=\"body\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\thstack({ gap: 3, align: \"center\" }),\n\t\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [flexCol(), items(\"stretch\")]),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * The card's media well: a fixed-size, rounded box clipping the preview a\n * consumer nests inside. Inside a narrow container it grows to the card's own\n * inline size at a wider aspect ratio, reading as a thumbnail tile.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media well's markup.\n * @example\n * <Attachment.Media><img src={file.thumbnailUrl} alt=\"\" /></Attachment.Media>\n * @example\n * <Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n */\nAttachment.Media = function AttachmentMedia(handle: Handle<Attachment.MediaProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"media\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(0),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tis(10),\n\t\t\t\t\tbs(10),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\twhen(\"& > img\", [is(\"full\"), bs(\"full\"), fit(\"cover\")]),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [is(\"full\"), bs(\"auto\"), aspect(4, 3), rounded(\"lg\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The card's text column, growing into whatever inline space\n * {@link Attachment.Media} and {@link Attachment.Actions} leave it. Its minimum\n * inline size collapses to `0`, which is what lets its children truncate.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Attachment.Content>\n * \t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t<Attachment.Description>2.4 MB</Attachment.Description>\n * </Attachment.Content>\n */\nAttachment.Content = function AttachmentContent(handle: Handle<Attachment.ContentProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tvstack({ gap: 0.5 }),\n\t\t\t\t\tminIs(0),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, textAlign(\"center\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The file or image name in a native `<p>`, truncated to a single line with an\n * ellipsis. Given the same `state` as the ancestor {@link Attachment}, it\n * shimmers while that reads `\"uploading\"` or `\"processing\"`, then settles.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * @example\n * <Attachment.Title state={attachment.state}>{attachment.name}</Attachment.Title>\n */\nAttachment.Title = function AttachmentTitle(handle: Handle<Attachment.TitleProps>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tdata-state={state}\n\t\t\t\tmix={[\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The loop settles visible, because this host carries the file's name: a gated\n\t\t\t\t\t * loop rests hidden outside its gate, which suits an element that exists only\n\t\t\t\t\t * as a loading cue and would leave every finished upload unnamed.\n\t\t\t\t\t */\n\t\t\t\t\tshimmer({ when: TITLE_SHIMMER_WHEN, outsideGate: \"visible\" }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's supporting detail line: a muted, single-line `<p>` carrying a file\n * size, a page count, or the explanation of what went wrong once the ancestor\n * {@link Attachment}'s `state` reads `\"error\"`.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Attachment.Description>2.4 MB</Attachment.Description>\n * @example\n * <Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n */\nAttachment.Description = function AttachmentDescription(\n\thandle: Handle<Attachment.DescriptionProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p {...rest} data-slot=\"description\" mix={[truncate(), fg(\"neutral.muted\"), text(\"xs\"), mix]}>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's action row, shrink-proof so a narrow card's width is absorbed by\n * {@link Attachment.Content}'s own truncation while the actions keep their\n * size.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Attachment.Actions>\n * \t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t<Attachment.Action aria-label={t(\"attachment.remove\")}><XIcon /></Attachment.Action>\n * </Attachment.Actions>\n */\nAttachment.Actions = function AttachmentActions(handle: Handle<Attachment.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"actions\" mix={[flex(), shrink(0), items(\"center\"), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A single card action as a {@link Button}, defaulting to a compact, `\"ghost\"`,\n * neutral control so a row of actions reads as secondary to the card's title.\n * Every {@link Button} prop stays available, `type` included.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the action's markup.\n * @example\n * <Attachment.Action aria-label={t(\"attachment.download\")}>\n * \t<DownloadIcon />\n * </Attachment.Action>\n * @example\n * <Attachment.Action type=\"submit\" name=\"intent\" value=\"retry\" aria-label={t(\"attachment.retry\")}>\n * \t<RotateCwIcon />\n * </Attachment.Action>\n */\nAttachment.Action = function AttachmentAction(handle: Handle<Attachment.ActionProps>) {\n\treturn () => {\n\t\tlet { color, variant, size, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tcolor={color ?? DEFAULT_ACTION_COLOR}\n\t\t\t\tvariant={variant ?? DEFAULT_ACTION_VARIANT}\n\t\t\t\tsize={size ?? DEFAULT_ACTION_SIZE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"action\"\n\t\t\t\tmix={[shrink(0), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * A wrapper `<div>` whose `href` or `commandfor` stays an inert attribute until\n * a consumer mixes in `attachmentTrigger()`. Either one also derives a `role`\n * and `tabIndex`, so whole-card activation is announced and keyboard-reachable.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the wrapper's markup.\n * @example\n * <Attachment.Trigger href=\"/files/quarterly-report.pdf\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">\n * \t\t<Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n * \t\t<Attachment.Content>\n * \t\t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t</Attachment.Content>\n * \t\t<Attachment.Actions>\n * \t\t\t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t\t</Attachment.Actions>\n * \t</Attachment>\n * </Attachment.Trigger>\n * @example\n * <Attachment.Trigger commandfor=\"quarterly-report-preview\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">…</Attachment>\n * </Attachment.Trigger>\n * <Dialog id=\"quarterly-report-preview\">…</Dialog>\n */\nAttachment.Trigger = function AttachmentTrigger(handle: Handle<Attachment.TriggerProps>) {\n\treturn () => {\n\t\tlet { href, commandfor, command, target, role, tabIndex, children, mix, ...rest } =\n\t\t\thandle.props;\n\t\tlet isConfigured = href !== undefined || commandfor !== undefined;\n\t\tlet inferredRole = iife((): \"link\" | \"button\" | undefined => {\n\t\t\tif (href !== undefined) return \"link\";\n\t\t\tif (isConfigured) return \"button\";\n\t\t\treturn undefined;\n\t\t});\n\t\tlet resolvedRole = role ?? inferredRole;\n\t\tlet resolvedTabIndex = tabIndex ?? (isConfigured ? 0 : undefined);\n\n\t\tif (import.meta.env?.DEV && !isConfigured) {\n\t\t\tconsole.warn(\n\t\t\t\t'Attachment.Trigger: rendered with neither \"href\" nor \"commandfor\" — nothing will happen once `attachmentTrigger()` handles an activation.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\trole={resolvedRole}\n\t\t\t\ttabIndex={resolvedTabIndex}\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ href, commandfor, command, target }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tblock(),\n\t\t\t\t\trounded(\"inherit\"),\n\t\t\t\t\twhen(\"&[role]:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&[role]:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A horizontally scroll-snapping row of cards, faded at both inline edges to\n * hint at cards beyond the current view. The row itself carries the tab stop,\n * since the row is what scrolls.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Attachment.Group aria-label={t(\"thread.attachments\")}>\n * \t{attachments.map((attachment) => (\n * \t\t<Attachment key={attachment.id} state={attachment.state}>…</Attachment>\n * \t))}\n * </Attachment.Group>\n */\nAttachment.Group = function AttachmentGroup(handle: Handle<Attachment.GroupProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ tabIndex: DEFAULT_GROUP_TAB_INDEX }),\n\t\t\t\t\tflex(),\n\t\t\t\t\tgap(3),\n\t\t\t\t\toverflowX(\"auto\"),\n\t\t\t\t\traw({\n\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\tscrollSnapType: \"inline mandatory\",\n\t\t\t\t\t\tscrollPaddingInline: \"0.75rem\",\n\t\t\t\t\t\tscrollBehavior: \"auto\",\n\t\t\t\t\t}),\n\t\t\t\t\twhen(\"& > *\", [shrink(0), raw({ scrollSnapAlign: \"start\" })]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: no-preference)\", raw({ scrollBehavior: \"smooth\" })),\n\t\t\t\t\tscrollFade({ axis: \"inline\", size: GROUP_SCROLL_FADE_SIZE }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
13
13
  },
14
14
  "test": null
15
15
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breadcrumbs",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [
5
5
  "link"
6
6
  ],
@@ -9,7 +9,10 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "breadcrumbs.tsx",
12
- "content": "/**\n * A trail of links marking the page's position within a hierarchy of parent\n * sections, composing a `<nav>` root, an `<ol>` list, and `<li>` items around\n * {@link Breadcrumbs.Link}, a restyled {@link Link}. Every item but the last\n * draws its separator through a CSS `::after` pseudo-element, keeping it\n * purely presentational, and the trail's current segment reads straight from\n * the native `aria-current` attribute a consumer sets while rendering the\n * page it currently occupies.\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 { fg } from \"@sdxc/u/color\";\nimport { listStyle, pseudoContent } from \"@sdxc/u/general\";\nimport { flex, items } from \"@sdxc/u/layout\";\nimport { m, mb, mis, p, pb, pi } from \"@sdxc/u/size\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { fontSize, textDecoration, weight } from \"@sdxc/u/typography\";\n\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\nimport { Link } from \"@sdxc/ui/link\";\n\n/** Semantic color role {@link Breadcrumbs.Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"neutral\";\n\n/**\n * Prop types for {@link Breadcrumbs} and its compound parts.\n */\nexport namespace Breadcrumbs {\n\t/**\n\t * Every native `<nav>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Every native `<ol>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ListProps extends TagProps<\"ol\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Every prop {@link Link.Props} accepts, unchanged. A type alias rather than\n\t * an interface, since {@link Link.Props} resolves through a conditional type\n\t * that an `interface extends` clause can't statically extend.\n\t */\n\texport type LinkProps = Link.Props;\n}\n\n/**\n * Renders the trail's `<nav>` root, laying {@link Breadcrumbs.List} as a row.\n * A root missing `aria-label` or `aria-labelledby` logs a dev-mode\n * `console.warn`, since assistive technology needs one to identify this landmark.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the trail's markup.\n * @example\n * <Breadcrumbs aria-label={t(\"breadcrumbs.label\")}>\n * \t<Breadcrumbs.List>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/projects\" aria-current=\"page\">\n * \t\t\t\t{t(\"nav.projects\")}\n * \t\t\t</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t</Breadcrumbs.List>\n * </Breadcrumbs>\n */\nexport function Breadcrumbs(handle: Handle<Breadcrumbs.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t'Breadcrumbs: needs an \"aria-label\" or \"aria-labelledby\" identifying this navigation landmark for assistive technology.',\n\t\t);\n\n\t\treturn <nav {...rest} data-slot=\"breadcrumbs\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n}\n\n/**\n * Renders the trail's `<ol>` list, resetting native list markers and spacing\n * and laying {@link Breadcrumbs.Item} children out in a row whose spacing\n * comes from each {@link Breadcrumbs.Link}'s padding, so the gaps stay clickable.\n *\n * @param handle Runtime handle carrying the host `<ol>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Breadcrumbs.List>\n * \t<Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t</Breadcrumbs.Item>\n * </Breadcrumbs.List>\n */\nBreadcrumbs.List = function BreadcrumbsList(handle: Handle<Breadcrumbs.ListProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ol\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"list\"\n\t\t\t\tmix={[flex(), items(\"center\"), m(0), p(0), listStyle(), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single `<li>` wrapping one {@link Breadcrumbs.Link}. Every item\n * but the last draws a `›` separator glyph via a CSS `::after`\n * pseudo-element, keeping the divider purely presentational.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the item's markup.\n * @example\n * <Breadcrumbs.Item>\n * \t<Breadcrumbs.Link href=\"/projects\">{t(\"nav.projects\")}</Breadcrumbs.Link>\n * </Breadcrumbs.Item>\n */\nBreadcrumbs.Item = function BreadcrumbsItem(handle: Handle<Breadcrumbs.ItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\twhen(\"&:not(:last-child)::after\", [\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\tpseudoContent('\"›\"'),\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 trail segment as a restyled {@link Link}: sized to `0.875rem`\n * with its underline dropped, defaulting to a quiet neutral color role that\n * brightens on hover and bolds when `aria-current=\"page\"` is set.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the segment's markup.\n * @example\n * <Breadcrumbs.Link href=\"/settings\">{t(\"nav.settings\")}</Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link href=\"/settings/profile\" aria-current=\"page\">\n * \t{t(\"nav.profile\")}\n * </Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link aria-disabled=\"true\">{t(\"nav.archived\")}</Breadcrumbs.Link>\n */\nBreadcrumbs.Link = function BreadcrumbsLink(handle: Handle<Breadcrumbs.LinkProps>) {\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<Link\n\t\t\t\tcolor={resolvedColor}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"link\"\n\t\t\t\tmix={[\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The space around each separator lives in the link's own padding, so the\n\t\t\t\t\t * whole gap is clickable; the block padding reaches a 24px target and its\n\t\t\t\t\t * negative margin keeps the row at the text's height. The trail's first link\n\t\t\t\t\t * pulls back by its padding so the trail stays flush with its container.\n\t\t\t\t\t */\n\t\t\t\t\tpi(2),\n\t\t\t\t\tpb(0.5),\n\t\t\t\t\tmb(-0.5),\n\t\t\t\t\twhen('[data-slot=\"item\"]:first-child > &', mis(-2)),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\thover(textDecoration(\"none\")),\n\t\t\t\t\tdata(\"color\", \"neutral\", [fg(\"neutral.muted\"), hover(fg(\"neutral\"))]),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\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"
12
+ "content": "/**\n * A trail of links marking the page's position within a hierarchy of parent\n * sections, composing a `<nav>` root, an `<ol>` list, and `<li>` items around\n * {@link Breadcrumbs.Link}, a restyled {@link Link}. Every item but the last\n * draws its separator through a CSS `::after` pseudo-element, keeping it\n * purely presentational, and the trail's current segment reads straight from\n * the native `aria-current` attribute a consumer sets while rendering the\n * page it currently occupies.\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 { fg } from \"@sdxc/u/color\";\nimport { listStyle, pseudoContent } from \"@sdxc/u/general\";\nimport { flex, items } from \"@sdxc/u/layout\";\nimport { m, mb, mis, p, pb, pi } from \"@sdxc/u/size\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { fontSize, textDecoration, weight } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\n\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\nimport { Link } from \"@sdxc/ui/link\";\n\n/** Semantic color role {@link Breadcrumbs.Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"neutral\";\n\n/** Prefetch mode {@link Breadcrumbs.Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Breadcrumbs.Prefetch = \"none\";\n\n/**\n * Prop types for {@link Breadcrumbs} and its compound parts.\n */\nexport namespace Breadcrumbs {\n\t/**\n\t * Every native `<nav>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Every native `<ol>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ListProps extends TagProps<\"ol\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * When a segment's destination starts loading: on intent, once in the\n\t * viewport, on render through a `<link rel=\"prefetch\">` that also serves\n\t * full-document navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Every prop {@link Link.Props} accepts. A type alias rather than an\n\t * interface, since {@link Link.Props} resolves through a conditional type\n\t * that an `interface extends` clause can't statically extend.\n\t */\n\texport type LinkProps = Link.Props & {\n\t\t/**\n\t\t * Prefetch mode, for segments whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a long trail keeps it to its nearest parents, since\n\t\t * each 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 the trail's `<nav>` root, laying {@link Breadcrumbs.List} as a row.\n * A root missing `aria-label` or `aria-labelledby` logs a dev-mode\n * `console.warn`, since assistive technology needs one to identify this landmark.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the trail's markup.\n * @example\n * <Breadcrumbs aria-label={t(\"breadcrumbs.label\")}>\n * \t<Breadcrumbs.List>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/projects\" aria-current=\"page\">\n * \t\t\t\t{t(\"nav.projects\")}\n * \t\t\t</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t</Breadcrumbs.List>\n * </Breadcrumbs>\n */\nexport function Breadcrumbs(handle: Handle<Breadcrumbs.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t'Breadcrumbs: needs an \"aria-label\" or \"aria-labelledby\" identifying this navigation landmark for assistive technology.',\n\t\t);\n\n\t\treturn <nav {...rest} data-slot=\"breadcrumbs\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n}\n\n/**\n * Renders the trail's `<ol>` list, resetting native list markers and spacing\n * and laying {@link Breadcrumbs.Item} children out in a row whose spacing\n * comes from each {@link Breadcrumbs.Link}'s padding, so the gaps stay clickable.\n *\n * @param handle Runtime handle carrying the host `<ol>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Breadcrumbs.List>\n * \t<Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t</Breadcrumbs.Item>\n * </Breadcrumbs.List>\n */\nBreadcrumbs.List = function BreadcrumbsList(handle: Handle<Breadcrumbs.ListProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ol\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"list\"\n\t\t\t\tmix={[flex(), items(\"center\"), m(0), p(0), listStyle(), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single `<li>` wrapping one {@link Breadcrumbs.Link}. Every item\n * but the last draws a `›` separator glyph via a CSS `::after`\n * pseudo-element, keeping the divider purely presentational.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the item's markup.\n * @example\n * <Breadcrumbs.Item>\n * \t<Breadcrumbs.Link href=\"/projects\">{t(\"nav.projects\")}</Breadcrumbs.Link>\n * </Breadcrumbs.Item>\n */\nBreadcrumbs.Item = function BreadcrumbsItem(handle: Handle<Breadcrumbs.ItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\twhen(\"&:not(:last-child)::after\", [\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\tpseudoContent('\"›\"'),\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 trail segment as a restyled {@link Link}: sized to `0.875rem`\n * with its underline dropped, defaulting to a quiet neutral color role that\n * brightens on hover and bolds when `aria-current=\"page\"` is set.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the segment's markup.\n * @example\n * <Breadcrumbs.Link href=\"/settings\" prefetch=\"render\">{t(\"nav.settings\")}</Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link href=\"/settings/profile\" aria-current=\"page\">\n * \t{t(\"nav.profile\")}\n * </Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link aria-disabled=\"true\">{t(\"nav.archived\")}</Breadcrumbs.Link>\n */\nBreadcrumbs.Link = function BreadcrumbsLink(handle: Handle<Breadcrumbs.LinkProps>) {\n\treturn () => {\n\t\tlet { color, prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<Link\n\t\t\t\tcolor={resolvedColor}\n\t\t\t\tprefetch={prefetch ?? DEFAULT_PREFETCH}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"link\"\n\t\t\t\tmix={[\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The space around each separator lives in the link's own padding, so the\n\t\t\t\t\t * whole gap is clickable; the block padding reaches a 24px target and its\n\t\t\t\t\t * negative margin keeps the row at the text's height. The trail's first link\n\t\t\t\t\t * pulls back by its padding so the trail stays flush with its container.\n\t\t\t\t\t */\n\t\t\t\t\tpi(2),\n\t\t\t\t\tpb(0.5),\n\t\t\t\t\tmb(-0.5),\n\t\t\t\t\twhen('[data-slot=\"item\"]:first-child > &', mis(-2)),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\thover(textDecoration(\"none\")),\n\t\t\t\t\tdata(\"color\", \"neutral\", [fg(\"neutral.muted\"), hover(fg(\"neutral\"))]),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\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"
13
13
  },
14
- "test": null
14
+ "test": {
15
+ "path": "breadcrumbs.test.tsx",
16
+ "content": "/**\n * Tests for {@link Breadcrumbs.Link}: a segment carries `data-rmx-prefetch` only for\n * the runtime's modes, and `\"render\"` adds a `<link rel=\"prefetch\">` after it instead.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Breadcrumbs } from \"@sdxc/ui/breadcrumbs\";\n\ndescribe(\"Breadcrumbs.Link\", () => {\n\ttest(\"leaves prefetching off unless a mode is chosen\", async () => {\n\t\tlet html = await renderToString(<Breadcrumbs.Link href=\"/projects\">Projects</Breadcrumbs.Link>);\n\t\tlet none = await renderToString(\n\t\t\t<Breadcrumbs.Link href=\"/projects\" prefetch=\"none\">\n\t\t\t\tProjects\n\t\t\t</Breadcrumbs.Link>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*href=\"\\/projects\"[^>]*>Projects<\\/a>/);\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(none).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).not.toContain(\"<link\");\n\t\texpect(none).not.toContain(\"<link\");\n\t});\n\n\ttest.each([\"intent\", \"viewport\"] as const)(\"prefetches on %s\", async (prefetch) => {\n\t\tlet html = await renderToString(\n\t\t\t<Breadcrumbs.Link href=\"/projects\" prefetch={prefetch}>\n\t\t\t\tProjects\n\t\t\t</Breadcrumbs.Link>,\n\t\t);\n\n\t\texpect(html).toMatch(new RegExp(`<a [^>]*data-rmx-prefetch=\"${prefetch}\"`));\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n\n\ttest(\"renders a prefetch hint after the segment's anchor on render\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Breadcrumbs.Item>\n\t\t\t\t<Breadcrumbs.Link href=\"/projects\" prefetch=\"render\">\n\t\t\t\t\tProjects\n\t\t\t\t</Breadcrumbs.Link>\n\t\t\t</Breadcrumbs.Item>,\n\t\t);\n\n\t\texpect(html).toMatch(/Projects<\\/a><link rel=\"prefetch\" href=\"\\/projects\"\\s*\\/?><\\/li>/);\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t});\n\n\ttest(\"renders no prefetch hint without a destination\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Breadcrumbs.Link prefetch=\"render\">Projects</Breadcrumbs.Link>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n});\n"
17
+ }
15
18
  }
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "group",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Group"
7
7
  ],
8
8
  "source": {
9
9
  "path": "group.tsx",
10
- "content": "/**\n * A visual and semantic wrapper binding a cluster of related controls into\n * one unit — a text input paired with its clear button, a row of segmented\n * buttons, a search field with a trailing submit action. The host lays its\n * children out in a single row, joining their edges so the cluster reads as one\n * control, with the seam between two of them drawn structurally rather than\n * through any tracked state.\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 { outlineColor } from \"@sdxc/u/color\";\nimport { roundedCorner } from \"@sdxc/u/effects\";\nimport { flex, items } from \"@sdxc/u/layout\";\nimport { mis } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\n/**\n * Default ARIA role applied through {@link attrs} unless a consumer\n * overrides `role`; pass `\"region\"` for landmark-worthy content or\n * `\"presentation\"` for purely visual grouping.\n */\nconst DEFAULT_ROLE = \"group\";\n\n/**\n * Prop types for {@link Group}.\n */\nexport namespace Group {\n\t/**\n\t * Native `<div>` attributes plus `mix`. `role` defaults to\n\t * {@link DEFAULT_ROLE} (or `\"region\"`/`\"presentation\"`); `aria-invalid`\n\t * gives the focus ring the danger tone, `aria-disabled` marks it disabled.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Lays children out in a centered flex row with no border, background, or gap, joining\n * their edges into one shape: only the cluster's outer corners stay round, and the seam\n * two controls share is drawn once. Focus is shown by whichever control holds it.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Group>\n * \t<Button>{t(\"stepper.decrement\")}</Button>\n * \t<Button>{t(\"stepper.increment\")}</Button>\n * </Group>\n * @example\n * <Group aria-invalid=\"true\">\n * \t<input aria-label={t(\"form.email\")} />\n * \t<Button aria-label={t(\"form.clear\")}>\n * \t\t<XIcon />\n * \t</Button>\n * </Group>\n */\nexport function Group(handle: Handle<Group.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE }),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The controls compose into one shape, so the cluster keeps the rounding on\n\t\t\t\t\t * its own outer corners and the seam where two of them meet is drawn once.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:not(:first-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-start\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-start\", \"none\"),\n\t\t\t\t\t\tmis(\"-1px\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& > *:not(:last-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-end\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-end\", \"none\"),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\t\t\t\t\t * Focus shows on the control holding it, naming which control has it where a ring\n\t\t\t\t\t * around the cluster names only the group. That control is raised so its ring\n\t\t\t\t\t * crosses the seam it shares with a neighbour.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:focus-visible\", z(1)),\n\t\t\t\t\twhen('&[aria-invalid=\"true\"] > *:focus-visible', outlineColor(\"danger\")),\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 visual and semantic wrapper binding a cluster of related controls into\n * one unit — a text input paired with its clear button, a row of segmented\n * buttons, a search field with a trailing submit action. The host lays its\n * children out in a single row, joining their edges so the cluster reads as one\n * control, with the seam between two of them drawn structurally rather than\n * through any tracked state.\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 { outlineColor } from \"@sdxc/u/color\";\nimport { roundedCorner } from \"@sdxc/u/effects\";\nimport { flex, items } from \"@sdxc/u/layout\";\nimport { mis } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\n/**\n * Default ARIA role applied through {@link attrs} unless a consumer\n * overrides `role`; pass `\"region\"` for landmark-worthy content or\n * `\"presentation\"` for purely visual grouping.\n */\nconst DEFAULT_ROLE = \"group\";\n\n/**\n * Prop types for {@link Group}.\n */\nexport namespace Group {\n\t/**\n\t * Native `<div>` attributes plus `mix`. `role` defaults to\n\t * {@link DEFAULT_ROLE} (or `\"region\"`/`\"presentation\"`); `aria-invalid`\n\t * gives the focus ring the danger tone, `aria-disabled` marks it disabled.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Lays children out in a centered flex row with no border, background, or gap, joining\n * their edges into one shape: only the cluster's outer corners stay round, and the seam\n * two controls share is drawn once. Focus is shown by whichever control holds it.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Group>\n * \t<Button>{t(\"stepper.decrement\")}</Button>\n * \t<Button>{t(\"stepper.increment\")}</Button>\n * </Group>\n * @example\n * <Group aria-invalid=\"true\">\n * \t<input aria-label={t(\"form.email\")} />\n * \t<Button aria-label={t(\"form.clear\")}>\n * \t\t<XIcon />\n * \t</Button>\n * </Group>\n */\nexport function Group(handle: Handle<Group.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE }),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The controls compose into one shape, so the cluster keeps the rounding on\n\t\t\t\t\t * its own outer corners and the seam where two of them meet is drawn once; the\n\t\t\t\t\t * last control before a trailing `<link rel=\"prefetch\">` hint keeps its corners.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:not(:first-child)\", [\n\t\t\t\t\t\troundedCorner(\"start-start\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-start\", \"none\"),\n\t\t\t\t\t\tmis(\"-1px\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& > *:has(~ :not(link))\", [\n\t\t\t\t\t\troundedCorner(\"start-end\", \"none\"),\n\t\t\t\t\t\troundedCorner(\"end-end\", \"none\"),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\t\t\t\t\t * Focus shows on the control holding it, naming which control has it where a ring\n\t\t\t\t\t * around the cluster names only the group. That control is raised so its ring\n\t\t\t\t\t * crosses the seam it shares with a neighbour.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > *:focus-visible\", z(1)),\n\t\t\t\t\twhen('&[aria-invalid=\"true\"] > *:focus-visible', outlineColor(\"danger\")),\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
- "test": null
12
+ "test": {
13
+ "path": "group.test.tsx",
14
+ "content": "/**\n * Tests for {@link Group}: a control flattens its end corners only when another\n * control follows it, so a trailing `<link rel=\"prefetch\">` hint leaves the\n * cluster's last control rounded.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Group } from \"@sdxc/ui/group\";\n\ndescribe(Group.name, () => {\n\ttest(\"flattens end corners only before a following control\", async () => {\n\t\tlet html = await renderToString(<Group />);\n\n\t\texpect(html).toContain(\"& > *:has(~ :not(link))\");\n\t\texpect(html).not.toContain(\"& > *:not(:last-child)\");\n\t});\n});\n"
15
+ }
13
16
  }
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "link-button",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "LinkButton"
7
7
  ],
8
8
  "source": {
9
9
  "path": "link-button.tsx",
10
- "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, rounded } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, userSelect } 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, weight } from \"@sdxc/u/typography\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\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/**\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, or a fully\n\t * transparent fill with just a colored label.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\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};\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\">{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, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tinteractiveTransition(),\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\tgap(2),\n\t\t\t\t\t/**\n\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 * `Button` states, for the same reasons: it is sized against the label beside\n\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 * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\tpi(4),\n\t\t\t\t\tpb(2),\n\t\t\t\t\t/**\n\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t */\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t/**\n\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 * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t */\n\t\t\t\t\tminBs(\"2.5rem\"),\n\n\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\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\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 * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"outline\", bg(\"transparent\")),\n\n\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"ghost\", [bg(\"transparent\"), border(\"transparent\")]),\n\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</a>\n\t\t);\n\t};\n}\n"
10
+ "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, rounded } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, userSelect } 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, weight } 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 { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\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, or a fully\n\t * transparent fill with just a colored label.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\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 resolvedSize = 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={[\n\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t/**\n\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 * `Button` states, for the same reasons: it is sized against the label beside\n\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 * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\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 */\n\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t/**\n\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 * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\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\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t/**\n\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 * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\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\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\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\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\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\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\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\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\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\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"outline\", bg(\"transparent\")),\n\n\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"ghost\", [bg(\"transparent\"), border(\"transparent\")]),\n\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\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"
11
11
  },
12
12
  "test": {
13
13
  "path": "link-button.test.tsx",
14
- "content": "/**\n * Tests for {@link LinkButton}: its children still render inside the anchor, a glyph at\n * either edge of a label is marked so that side's padding drops a step, and the anchor\n * carries an inset-free pointer target box.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { LinkButton } from \"@sdxc/ui/link-button\";\n\ndescribe(LinkButton.name, () => {\n\ttest(\"renders its label inside the anchor\", async () => {\n\t\tlet html = await renderToString(<LinkButton href=\"/new\">Create</LinkButton>);\n\n\t\texpect(html).toMatch(/<a [^>]*href=\"\\/new\"[^>]*>Create<\\/a>/);\n\t});\n\n\ttest(\"marks a leading glyph and leaves the trailing edge alone\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<LinkButton href=\"/new\">\n\t\t\t\t<svg />\n\t\t\t\tCreate\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*data-glyph-start/);\n\t\texpect(html).not.toMatch(/<a [^>]*data-glyph-end/);\n\t});\n\n\ttest(\"marks a trailing glyph after a label\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<LinkButton href=\"/next\">\n\t\t\t\tNext\n\t\t\t\t<svg />\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*data-glyph-end/);\n\t\texpect(html).not.toMatch(/<a [^>]*data-glyph-start/);\n\t});\n\n\ttest(\"draws a target-size box that holds however the anchor is positioned\", async () => {\n\t\tlet html = await renderToString(<LinkButton href=\"/new\">Create</LinkButton>);\n\n\t\texpect(html).toMatch(\n\t\t\t/&::after \\{[^}]*position: absolute;[^}]*inline-size: var\\(--ui-target-size, 1\\.5rem\\);/,\n\t\t);\n\t});\n});\n"
14
+ "content": "/**\n * Tests for {@link LinkButton}: its children still render inside the anchor, a glyph at\n * either edge of a label is marked so that side's padding drops a step, and the anchor\n * carries an inset-free pointer target box.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { LinkButton } from \"@sdxc/ui/link-button\";\n\ndescribe(LinkButton.name, () => {\n\ttest(\"renders its label inside the anchor\", async () => {\n\t\tlet html = await renderToString(<LinkButton href=\"/new\">Create</LinkButton>);\n\n\t\texpect(html).toMatch(/<a [^>]*href=\"\\/new\"[^>]*>Create<\\/a>/);\n\t});\n\n\ttest(\"marks a leading glyph and leaves the trailing edge alone\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<LinkButton href=\"/new\">\n\t\t\t\t<svg />\n\t\t\t\tCreate\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*data-glyph-start/);\n\t\texpect(html).not.toMatch(/<a [^>]*data-glyph-end/);\n\t});\n\n\ttest(\"marks a trailing glyph after a label\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<LinkButton href=\"/next\">\n\t\t\t\tNext\n\t\t\t\t<svg />\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*data-glyph-end/);\n\t\texpect(html).not.toMatch(/<a [^>]*data-glyph-start/);\n\t});\n\n\ttest(\"draws a target-size box that holds however the anchor is positioned\", async () => {\n\t\tlet html = await renderToString(<LinkButton href=\"/new\">Create</LinkButton>);\n\n\t\texpect(html).toMatch(\n\t\t\t/&::after \\{[^}]*position: absolute;[^}]*inline-size: var\\(--ui-target-size, 1\\.5rem\\);/,\n\t\t);\n\t});\n\n\ttest(\"leaves prefetching off unless a mode is chosen\", async () => {\n\t\tlet html = await renderToString(<LinkButton href=\"/new\">Create</LinkButton>);\n\t\tlet none = await renderToString(\n\t\t\t<LinkButton href=\"/new\" prefetch=\"none\">\n\t\t\t\tCreate\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(none).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).not.toContain(\"<link\");\n\t\texpect(none).not.toContain(\"<link\");\n\t});\n\n\ttest.each([\"intent\", \"viewport\"] as const)(\"prefetches on %s\", async (prefetch) => {\n\t\tlet html = await renderToString(\n\t\t\t<LinkButton href=\"/new\" prefetch={prefetch}>\n\t\t\t\tCreate\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).toMatch(new RegExp(`<a [^>]*data-rmx-prefetch=\"${prefetch}\"`));\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n\n\ttest(\"renders a prefetch hint after the anchor on render\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<LinkButton href=\"/new\" prefetch=\"render\">\n\t\t\t\tCreate\n\t\t\t</LinkButton>,\n\t\t);\n\n\t\texpect(html).toMatch(/Create<\\/a><link rel=\"prefetch\" href=\"\\/new\"/);\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t});\n\n\ttest(\"renders no prefetch hint without a destination\", async () => {\n\t\tlet html = await renderToString(<LinkButton prefetch=\"render\">Create</LinkButton>);\n\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n});\n"
15
15
  }
16
16
  }
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "link",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Link"
7
7
  ],
8
8
  "source": {
9
9
  "path": "link.tsx",
10
- "content": "/**\n * A native anchor for inline navigation, always underlined so its\n * affordance never rests on color alone, and colored through a semantic\n * color role that also drives its focus ring and disabled state.\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 { colorMix, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw, var as varUtility } from \"@sdxc/u/general\";\nimport { data, when } from \"@sdxc/u/state\";\nimport { textDecoration } from \"@sdxc/u/typography\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"brand\";\n\n/**\n * Prop types for {@link Link}.\n */\nexport namespace Link {\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 * Props accepted by {@link Link}. A type alias rather than an interface,\n\t * since the native anchor props resolve through a conditional type that an\n\t * `interface extends` clause can't statically extend.\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};\n}\n\n/**\n * Renders a native `<a>` host, colored through the `data-color` attribute\n * contract and underlined unconditionally. `aria-disabled=\"true\"` mutes the\n * link, but only removing or neutralizing `href` actually stops navigation.\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 * <Link href=\"/about\">{t(\"nav.about\")}</Link>\n * @example\n * <Link href=\"/delete\" color=\"danger\">{t(\"actions.delete\")}</Link>\n * @example\n * <Link href=\"/settings\" aria-disabled=\"true\">{t(\"nav.settings\")}</Link>\n */\nexport function Link(handle: Handle<Link.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<a\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tdata(\"color\", \"brand\", fg(\"brand\")),\n\t\t\t\t\tdata(\"color\", \"neutral\", fg(\"neutral\")),\n\t\t\t\t\tdata(\"color\", \"success\", fg(\"success\")),\n\t\t\t\t\tdata(\"color\", \"danger\", fg(\"danger\")),\n\t\t\t\t\tdata(\"color\", \"warning\", fg(\"warning\")),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\ttextDecoration(\"underline\"),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * `color-mix()`'s color argument needs the raw CSS variable\n\t\t\t\t\t\t * (`var(--ui-brand-fg)`), so the property stays `raw()` while\n\t\t\t\t\t\t * the literal string becomes a builder call.\n\t\t\t\t\t\t */\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-brand-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-brand-fg\") })),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-neutral-fg\"), weight: 50 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-neutral-fg\") })),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-success-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-success-fg\") })),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-danger-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-danger-fg\") })),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-warning-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-warning-fg\") })),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), textDecoration(\"none\")]),\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 native anchor for inline navigation, always underlined so its\n * affordance never rests on color alone, and colored through a semantic\n * color role that also drives its focus ring and disabled state.\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 { colorMix, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw, var as varUtility } from \"@sdxc/u/general\";\nimport { data, when } from \"@sdxc/u/state\";\nimport { textDecoration } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"brand\";\n\n/** Prefetch mode {@link Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Link.Prefetch = \"none\";\n\n/**\n * Prop types for {@link Link}.\n */\nexport namespace Link {\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 * 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 Link}. A type alias rather than an interface,\n\t * since the native anchor props resolve through a conditional type that an\n\t * `interface extends` clause can't statically extend.\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/**\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 through the `data-color` attribute\n * contract and underlined unconditionally. `aria-disabled=\"true\"` mutes the\n * link, but only removing or neutralizing `href` actually stops navigation.\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 * <Link href=\"/about\">{t(\"nav.about\")}</Link>\n * @example\n * <Link href=\"/products/shirt\" prefetch=\"render\">{t(\"products.shirt\")}</Link>\n * @example\n * <Link href=\"/settings\" aria-disabled=\"true\">{t(\"nav.settings\")}</Link>\n */\nexport function Link(handle: Handle<Link.Props>) {\n\treturn () => {\n\t\tlet { color, prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\t{...rest}\n\t\t\t\t\tmix={[\n\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", fg(\"brand\")),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", fg(\"neutral\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", fg(\"success\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", fg(\"danger\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", fg(\"warning\")),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\ttextDecoration(\"underline\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * `color-mix()`'s color argument needs the raw CSS variable\n\t\t\t\t\t\t\t * (`var(--ui-brand-fg)`), so the property stays `raw()` while\n\t\t\t\t\t\t\t * the literal string becomes a builder call.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-brand-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-brand-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-neutral-fg\"), weight: 50 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-neutral-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-success-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-success-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-danger-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-danger-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-warning-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-warning-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), textDecoration(\"none\")]),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t/>\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"
11
11
  },
12
- "test": null
12
+ "test": {
13
+ "path": "link.test.tsx",
14
+ "content": "/**\n * Tests for {@link Link}: the anchor carries `data-rmx-prefetch` only for the\n * runtime's modes, and `\"render\"` adds a `<link rel=\"prefetch\">` after it instead.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Link } from \"@sdxc/ui/link\";\n\ndescribe(Link.name, () => {\n\ttest(\"leaves prefetching off unless a mode is chosen\", async () => {\n\t\tlet html = await renderToString(<Link href=\"/about\">About</Link>);\n\t\tlet none = await renderToString(\n\t\t\t<Link href=\"/about\" prefetch=\"none\">\n\t\t\t\tAbout\n\t\t\t</Link>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*href=\"\\/about\"[^>]*>About<\\/a>/);\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(none).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).not.toContain(\"<link\");\n\t\texpect(none).not.toContain(\"<link\");\n\t});\n\n\ttest.each([\"intent\", \"viewport\"] as const)(\"prefetches on %s\", async (prefetch) => {\n\t\tlet html = await renderToString(\n\t\t\t<Link href=\"/about\" prefetch={prefetch}>\n\t\t\t\tAbout\n\t\t\t</Link>,\n\t\t);\n\n\t\texpect(html).toMatch(new RegExp(`<a [^>]*data-rmx-prefetch=\"${prefetch}\"`));\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n\n\ttest(\"renders a prefetch hint after the anchor on render\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Link href=\"/about\" prefetch=\"render\">\n\t\t\t\tAbout\n\t\t\t</Link>,\n\t\t);\n\n\t\texpect(html).toMatch(/About<\\/a><link rel=\"prefetch\" href=\"\\/about\"/);\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t});\n\n\ttest(\"renders no prefetch hint without a destination\", async () => {\n\t\tlet html = await renderToString(<Link prefetch=\"render\">About</Link>);\n\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n});\n"
15
+ }
13
16
  }