@sdxc/kit 2026.10.23 → 2026.10.25

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.
@@ -15,6 +15,7 @@ import { missingDependencies } from "../dependencies.js";
15
15
  import { unifiedDiff } from "../diff.js";
16
16
  import { formatFiles } from "../format.js";
17
17
  import { declare, declaresAbilities } from "../make/declare.js";
18
+ import { ensureImport } from "../make/imports.js";
18
19
  import { SCAFFOLD_PIECES } from "../make/kinds.js";
19
20
  import { chainFolder, nextMigrationFile } from "../make/migrations.js";
20
21
  import { parseName } from "../make/names.js";
@@ -500,8 +501,8 @@ async function stageDeclarations(root, requests, planned) {
500
501
  /**
501
502
  * `edits` with the resource's OpenAPI operations appended to `routes/api.ts`, after the routes
502
503
  * the staged declarations added, and added to the document `app/initializers/openapi.ts` builds.
503
- * A file laid out otherwise, such as one with no `@sdxc/json-schema` import, gets the code
504
- * printed for the user to place instead.
504
+ * A contract missing `@sdxc/json-schema` gets the import; one laid out otherwise, with no
505
+ * `defineOperation` or default export, gets the code printed for the user to place instead.
505
506
  */
506
507
  async function operationEdits(root, resource, edits) {
507
508
  let result = [...edits];
@@ -528,18 +529,18 @@ async function operationEdits(root, resource, edits) {
528
529
  let contract = `routes/${API_CONTRACT}.ts`;
529
530
  let names = apiOperationNames(resource);
530
531
  let source = await current(contract);
531
- let locals = source === null ? null : operationLocals(source);
532
- let code = apiOperations(resource, locals ?? { s: "s", defineOperation: "defineOperation", routes: "ROUTES" });
533
- if (source === null || locals === null) {
532
+ let operations = source === null ? null : operationLocals(contract, source);
533
+ let code = apiOperations(resource, operations?.locals ?? { s: "s", defineOperation: "defineOperation", routes: "ROUTES" });
534
+ if (operations === null) {
534
535
  manual.push({
535
536
  path: contract,
536
- reason: `${contract} does not import @sdxc/json-schema, defineOperation and a default export the operations can use`,
537
+ reason: `${contract} does not import defineOperation and a default export the operations can use`,
537
538
  instructions: `At the end of ${contract}:
538
539
  ${code}`,
539
540
  });
540
541
  }
541
542
  else {
542
- await write(contract, `${source.trimEnd()}
543
+ await write(contract, `${operations.source.trimEnd()}
543
544
 
544
545
  ${code}
545
546
  `);
@@ -560,16 +561,26 @@ ${code}
560
561
  }
561
562
  /**
562
563
  * The names `source` imports `@sdxc/json-schema`'s namespace, `defineOperation` and its own
563
- * default export under, or `null` when it lacks one of them.
564
+ * default export under, with `source` importing the namespace as `s` when it lacked it, or
565
+ * `null` when it lacks `defineOperation` or the default export.
564
566
  */
565
- function operationLocals(source) {
566
- let s = /import \* as (\w+) from "@sdxc\/json-schema";/.exec(source)?.[1];
567
+ function operationLocals(filename, source) {
567
568
  let imported = /import \{([^}]*)\} from "@sdxc\/openapi";/.exec(source)?.[1] ?? "";
568
569
  let defineOperation = /\bdefineOperation(?:\s+as\s+(\w+))?\b/.exec(imported);
569
570
  let routes = /export default (\w+);/.exec(source)?.[1];
570
- if (s === undefined || defineOperation === null || routes === undefined)
571
+ if (defineOperation === null || routes === undefined)
571
572
  return null;
572
- return { s, defineOperation: defineOperation[1] ?? "defineOperation", routes };
573
+ let schema = ensureImport(filename, source, { kind: "namespace" }, (specifier) => specifier === "@sdxc/json-schema", "@sdxc/json-schema", "s");
574
+ if (isFailure(schema))
575
+ return null;
576
+ return {
577
+ source: schema.data.source,
578
+ locals: {
579
+ s: schema.data.local,
580
+ defineOperation: defineOperation[1] ?? "defineOperation",
581
+ routes,
582
+ },
583
+ };
573
584
  }
574
585
  /**
575
586
  * `source` with `names` imported from the API contract and passed to its document's `.add(…)`,
@@ -15,7 +15,7 @@ import { failure, isFailure, success, wrap } from "@sdxc/result";
15
15
  export const REGISTRY_DIR = "registry/ui";
16
16
  /** A file the registry ships, named as its copy is named in the app: one path segment. */
17
17
  const REGISTRY_FILE = s.object({
18
- path: s.string().pipe(checks.pattern(/^[a-z0-9][a-z0-9-]*(?:\.test)?\.tsx?$/)),
18
+ path: s.string().pipe(checks.pattern(/^[a-z0-9][a-z0-9-]*(?:(?:\.browser)?\.test)?\.tsx?$/)),
19
19
  content: s.string(),
20
20
  });
21
21
  /** One `registry/ui/<name>.json`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdxc/kit",
3
- "version": "2026.10.23",
3
+ "version": "2026.10.25",
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,22 +14,22 @@
14
14
  "./lock.schema.json": "./lock.schema.json"
15
15
  },
16
16
  "dependencies": {
17
- "@sdxc/cli": "2026.10.23",
17
+ "@sdxc/cli": "2026.10.24",
18
18
  "@sdxc/codemod": "2026.10.23",
19
- "@sdxc/cron": "2026.10.23",
20
- "@sdxc/diagram": "2026.10.23",
19
+ "@sdxc/cron": "2026.10.25",
20
+ "@sdxc/diagram": "2026.10.24",
21
21
  "@sdxc/iife": "2026.10.23",
22
- "@sdxc/json-schema": "2026.10.23",
22
+ "@sdxc/json-schema": "2026.10.24",
23
23
  "@sdxc/jsonc": "2026.10.16",
24
- "@sdxc/jsonl": "2026.10.16",
24
+ "@sdxc/jsonl": "2026.10.25",
25
25
  "@sdxc/result": "2026.10.13",
26
26
  "@sdxc/semver": "2026.10.13",
27
27
  "oxc-parser": "^0.154.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "remix": "3.0.0"
30
+ "remix": "3.1.0"
31
31
  },
32
- "gitHead": "8e428ddf15290d44500a9618ec4d04bd7629fa99",
32
+ "gitHead": "1440b969c0a3e3808dfcee3f17d2ef43915f32a8",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
@@ -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
  }
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "nav-link",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "NavLink"
7
7
  ],
8
8
  "source": {
9
9
  "path": "nav-link.tsx",
10
- "content": "/**\n * An inline text link for site navigation, colored through a semantic color\n * role and underlined to read as a link among surrounding prose. Its\n * current-page state comes straight from `aria-current` set on the host\n * server-side, rendering the emphasized, non-underlined treatment directly\n * from that attribute.\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 { rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { textDecoration, weight } 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 NavLink} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: NavLink.Color = \"neutral\";\n\n/**\n * Prop types for {@link NavLink}.\n */\nexport namespace NavLink {\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 NavLink}, built as an intersection: the\n\t * underlying anchor prop type is a union keyed on `href`, since the\n\t * accessible-anchor contract restricts `role` once `href` is present.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Marks the link as sitting over its own colored background: drops the\n\t\t * underline entirely, since the background fill already sets it apart\n\t\t * from surrounding text.\n\t\t */\n\t\thasBackground?: boolean;\n\t};\n}\n\n/**\n * Renders a native `<a>`, colored via `data-color` and underlined with a\n * translucent decoration that solidifies on hover. Setting `aria-current`\n * server-side renders the current-page treatment; the focus-visible ring always reads in the primary color.\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 * <NavLink href=\"/dashboard\" color=\"brand\">{t(\"nav.dashboard\")}</NavLink>\n * @example\n * <NavLink href=\"/settings\" aria-current={pathname === \"/settings\" ? \"page\" : undefined}>{t(\"nav.settings\")}</NavLink>\n * @example\n * <NavLink href=\"/settings\" hasBackground mix={css({ paddingInline: \"0.75rem\", paddingBlock: \"0.5rem\" })}>{t(\"nav.settings\")}</NavLink>\n */\nexport function NavLink(handle: Handle<NavLink.Props>) {\n\treturn () => {\n\t\tlet { color, hasBackground, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\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-has-background={hasBackground || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\ttextDecoration(\"underline\"),\n\t\t\t\t\traw({\n\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"currentcolor\", weight: 60 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttextUnderlineOffset: \"4px\",\n\t\t\t\t\t}),\n\t\t\t\t\thover(raw({ textDecorationColor: \"currentcolor\" })),\n\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\tfg(\"brand.emphasis\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\tfg(\"success.emphasis\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\tfg(\"warning.emphasis\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\tfg(\"danger.emphasis\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\traw({ textDecorationThickness: \"2px\", textDecorationColor: \"currentcolor\" }),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"has-background\", textDecoration(\"none\")),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-has-background]:hover, &[data-has-background][aria-current]:not([aria-current=\"false\"])',\n\t\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\t),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * An inline text link for site navigation, colored through a semantic color\n * role and underlined to read as a link among surrounding prose. Its\n * current-page state comes straight from `aria-current` set on the host\n * server-side, rendering the emphasized, non-underlined treatment directly\n * from that attribute.\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 { rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { textDecoration, weight } 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 NavLink} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: NavLink.Color = \"neutral\";\n\n/** Prefetch mode {@link NavLink} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: NavLink.Prefetch = \"none\";\n\n/**\n * Prop types for {@link NavLink}.\n */\nexport namespace NavLink {\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 NavLink}, built as an intersection: the\n\t * underlying anchor prop type is a union keyed on `href`, since the\n\t * accessible-anchor contract restricts `role` once `href` is present.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Marks the link as sitting over its own colored background: drops the\n\t\t * underline entirely, since the background fill already sets it apart\n\t\t * from surrounding text.\n\t\t */\n\t\thasBackground?: boolean;\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 menu 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>`, colored via `data-color` and underlined with a\n * translucent decoration that solidifies on hover. Setting `aria-current`\n * server-side renders the current-page treatment; the focus-visible ring always reads in the primary color.\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 * <NavLink href=\"/dashboard\" color=\"brand\" prefetch=\"render\">{t(\"nav.dashboard\")}</NavLink>\n * @example\n * <NavLink href=\"/settings\" aria-current={pathname === \"/settings\" ? \"page\" : undefined}>{t(\"nav.settings\")}</NavLink>\n * @example\n * <NavLink href=\"/settings\" hasBackground mix={css({ paddingInline: \"0.75rem\", paddingBlock: \"0.5rem\" })}>{t(\"nav.settings\")}</NavLink>\n */\nexport function NavLink(handle: Handle<NavLink.Props>) {\n\treturn () => {\n\t\tlet { color, hasBackground, 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\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-has-background={hasBackground || undefined}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\ttextDecoration(\"underline\"),\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\"oklab\",\n\t\t\t\t\t\t\t\t{ color: \"currentcolor\", 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\ttextUnderlineOffset: \"4px\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t\thover(raw({ textDecorationColor: \"currentcolor\" })),\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\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\t\tfg(\"brand.emphasis\"),\n\t\t\t\t\t\t\t]),\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\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t]),\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\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\t\tfg(\"success.emphasis\"),\n\t\t\t\t\t\t\t]),\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\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\t\tfg(\"warning.emphasis\"),\n\t\t\t\t\t\t\t]),\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\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\t\tfg(\"danger.emphasis\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\t\traw({ textDecorationThickness: \"2px\", textDecorationColor: \"currentcolor\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"has-background\", textDecoration(\"none\")),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-has-background]:hover, &[data-has-background][aria-current]:not([aria-current=\"false\"])',\n\t\t\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t\t{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": "nav-link.test.tsx",
14
+ "content": "/**\n * Tests for {@link NavLink}: 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 { NavLink } from \"@sdxc/ui/nav-link\";\n\ndescribe(NavLink.name, () => {\n\ttest(\"leaves prefetching off unless a mode is chosen\", async () => {\n\t\tlet html = await renderToString(<NavLink href=\"/settings\">Settings</NavLink>);\n\t\tlet none = await renderToString(\n\t\t\t<NavLink href=\"/settings\" prefetch=\"none\">\n\t\t\t\tSettings\n\t\t\t</NavLink>,\n\t\t);\n\n\t\texpect(html).toMatch(/<a [^>]*href=\"\\/settings\"[^>]*>Settings<\\/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<NavLink href=\"/settings\" prefetch={prefetch}>\n\t\t\t\tSettings\n\t\t\t</NavLink>,\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<NavLink href=\"/settings\" prefetch=\"render\">\n\t\t\t\tSettings\n\t\t\t</NavLink>,\n\t\t);\n\n\t\texpect(html).toMatch(/Settings<\\/a><link rel=\"prefetch\" href=\"\\/settings\"/);\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<NavLink href=\"\" prefetch=\"render\">\n\t\t\t\tSettings\n\t\t\t</NavLink>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"<link\");\n\t});\n});\n"
15
+ }
13
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "navigation-menu",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [
5
5
  "popover"
6
6
  ],
@@ -9,7 +9,10 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "navigation-menu.tsx",
12
- "content": "/**\n * A row of top-level navigation triggers, each either a plain link or a\n * button that opens a floating panel of related links. `NavigationMenu.Item`\n * hands its own stable id to whichever `NavigationMenu.Trigger` and\n * `NavigationMenu.Content` nest inside it through component context, so the\n * two pair up automatically — a consumer never wires a `commandfor`/`id`\n * pair by hand for the common case.\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, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport {\n\topacity,\n\trounded,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionProperty,\n} from \"@sdxc/u/effects\";\nimport { cursor, raw, userSelect } from \"@sdxc/u/general\";\nimport {\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrid,\n\tgridTemplate,\n\tinlineFlex,\n\titems,\n\tjustify,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { at, media, startingStyle } from \"@sdxc/u/responsive\";\nimport { bs, is, maxIs, mbs, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { data, disabled, hover, when } from \"@sdxc/u/state\";\nimport { scaleProperty } from \"@sdxc/u/transform\";\nimport { fontSize, leading, text, textDecoration, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport {\n\tconcentricRadius,\n\tfloatingSurface,\n\tsurfaceInset,\n\tsurfacePadding,\n} from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\nimport { Popover } from \"@sdxc/ui/popover\";\n\n/**\n * Named container {@link NavigationMenu.Content} declares on its own host, so\n * {@link NavigationMenu.ContentGrid} can adapt to the panel's own width\n * instead of the page's.\n */\nconst CONTAINER_NAME = \"ui-navigation-menu-content\";\n\n/**\n * `role=\"list\"` applied to {@link NavigationMenu.List} through {@link attrs}\n * unless a consumer supplies its own `role`, restoring list semantics that a\n * stylesheet clearing `list-style` otherwise drops for assistive technology.\n */\nconst DEFAULT_LIST_ROLE = \"list\";\n\n/**\n * Default {@link NavigationMenu.ListProps} orientation, applied when\n * `orientation` is omitted, laying triggers out in a single row.\n */\nconst DEFAULT_ORIENTATION: NavigationMenu.Orientation = \"horizontal\";\n\n/**\n * `type` {@link NavigationMenu.TriggerProps.type} falls back to when a\n * consumer doesn't supply one, keeping a click on the trigger from\n * submitting a surrounding `<form>`.\n */\nconst DEFAULT_TRIGGER_TYPE: NonNullable<NavigationMenu.TriggerProps[\"type\"]> = \"button\";\n\n/**\n * Invoker Commands verb {@link NavigationMenu.TriggerProps.command} falls\n * back to when omitted, showing the paired {@link NavigationMenu.Content} if\n * it's hidden and hiding it again if it's already showing.\n */\nconst DEFAULT_TRIGGER_COMMAND = \"toggle-popover\";\n\n/**\n * Side of the trigger {@link NavigationMenu.Content} renders against when\n * `placement` is left unset, matching a dropdown reading down and start-ward\n * from its trigger.\n */\nconst DEFAULT_CONTENT_PLACEMENT: NavigationMenu.ContentProps[\"placement\"] = \"bottom-start\";\n\n/**\n * {@link NavigationMenu.ContentProps.size} falls back to when omitted,\n * sizing the panel to its own content instead of a fixed wide measure.\n */\nconst DEFAULT_CONTENT_SIZE: NavigationMenu.ContentSize = \"default\";\n\n/**\n * Prop types for {@link NavigationMenu} and its compound parts.\n */\nexport namespace NavigationMenu {\n\t/**\n\t * Axis {@link NavigationMenu.List} lays its triggers out along: a single\n\t * row, or a single column.\n\t */\n\texport type Orientation = \"horizontal\" | \"vertical\";\n\n\t/**\n\t * Panel width {@link NavigationMenu.Content} renders at: sized to its own\n\t * content (`\"default\"`), or a fixed, generously wide measure that still\n\t * clamps to the viewport on narrow screens (`\"wide\"`).\n\t */\n\texport type ContentSize = \"default\" | \"wide\";\n\n\t/**\n\t * Value {@link NavigationMenu.Item} stores in component context so the\n\t * {@link NavigationMenu.Trigger} and {@link NavigationMenu.Content} nested\n\t * inside it pair up automatically.\n\t */\n\texport interface Context {\n\t\t/** Stable id the enclosing {@link NavigationMenu.Item} generated for its {@link NavigationMenu.Content}. */\n\t\tcontentId: string;\n\t}\n\n\t/**\n\t * Every native `<nav>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"nav\"> {\n\t\t/** The menu's own {@link NavigationMenu.List}, and anything else rendered alongside it (a {@link NavigationMenu.Viewport}, for instance). */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ListProps extends TagProps<\"ul\"> {\n\t\t/** Layout axis. Defaults to {@link DEFAULT_ORIENTATION}. */\n\t\torientation?: Orientation;\n\t\t/** One or more {@link NavigationMenu.Item}s. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"li\"> {\n\t\t/**\n\t\t * Either a standalone {@link NavigationMenu.Link}, or a\n\t\t * {@link NavigationMenu.Trigger} followed by the\n\t\t * {@link NavigationMenu.Content} it opens.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<button>` attribute, plus the `mix` passthrough.\n\t * `commandfor` and `command` both default from the enclosing\n\t * {@link NavigationMenu.Item}'s context.\n\t */\n\texport interface TriggerProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every prop {@link Popover.Props} accepts except `id`, which becomes\n\t * optional here since it defaults from the enclosing\n\t * {@link NavigationMenu.Item}'s context, plus `size`.\n\t */\n\texport interface ContentProps extends Omit<Popover.Props, \"id\" | \"placement\"> {\n\t\t/** Stable id matched against a {@link NavigationMenu.Trigger}'s `commandfor`. Defaults to the enclosing {@link NavigationMenu.Item}'s generated id. */\n\t\tid?: string;\n\t\t/** Side of the trigger to render against. Defaults to {@link DEFAULT_CONTENT_PLACEMENT}. */\n\t\tplacement?: Popover.Placement;\n\t\t/** Panel width. Defaults to {@link DEFAULT_CONTENT_SIZE}. */\n\t\tsize?: ContentSize;\n\t}\n\n\t/**\n\t * Every native `<a>` attribute, plus the `mix` passthrough. Uses an\n\t * intersection because the underlying anchor prop type is a union keyed on\n\t * `href`, narrowed here to required since a link needs a destination.\n\t */\n\texport type LinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t};\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ViewportProps extends TagProps<\"div\"> {\n\t\t/** The currently active item's content, mirrored in from wherever it actually renders. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ContentListProps extends TagProps<\"div\"> {\n\t\t/** One or more {@link NavigationMenu.Link}s. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ContentGridProps extends TagProps<\"div\"> {\n\t\t/** Two or more {@link NavigationMenu.ContentColumn}s. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ContentColumnProps extends TagProps<\"div\"> {\n\t\t/** One or more {@link NavigationMenu.Link}s. */\n\t\tchildren?: RemixNode;\n\t}\n}\n\n/**\n * Renders the menu's root host: a native `<nav>` landmark establishing a\n * positioning context for whatever floating panels its\n * {@link NavigationMenu.Content} instances anchor against.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the menu's markup.\n * @example\n * <NavigationMenu aria-label={t(\"nav.primary\")}>\n * \t<NavigationMenu.List>\n * \t\t<NavigationMenu.Item>\n * \t\t\t<NavigationMenu.Link href=\"/\">{t(\"nav.home\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.Item>\n * \t</NavigationMenu.List>\n * </NavigationMenu>\n */\nexport function NavigationMenu(handle: Handle<NavigationMenu.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <nav {...rest} mix={[relative(), mix]} />;\n\t};\n}\n\n/**\n * Renders the row of top-level triggers: a native `<ul>` laying its\n * {@link NavigationMenu.Item}s out horizontally by default, switching to a\n * single start-aligned column when `orientation` is `\"vertical\"`.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <NavigationMenu.List>\n * \t<NavigationMenu.Item>\n * \t\t<NavigationMenu.Link href=\"/pricing\">{t(\"nav.pricing\")}</NavigationMenu.Link>\n * \t</NavigationMenu.Item>\n * </NavigationMenu.List>\n * @example\n * <NavigationMenu.List orientation=\"vertical\">\n * \t<NavigationMenu.Item>\n * \t\t<NavigationMenu.Link href=\"/settings/profile\">{t(\"nav.profile\")}</NavigationMenu.Link>\n * \t</NavigationMenu.Item>\n * </NavigationMenu.List>\n */\nNavigationMenu.List = function NavigationMenuList(handle: Handle<NavigationMenu.ListProps>) {\n\treturn () => {\n\t\tlet { orientation, mix, ...rest } = handle.props;\n\t\tlet resolvedOrientation = orientation ?? DEFAULT_ORIENTATION;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\tdata-orientation={resolvedOrientation}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_LIST_ROLE }),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(1),\n\t\t\t\t\twhen('&[data-orientation=\"vertical\"]', [flexCol(), items(\"start\")]),\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 a single top-level entry: a native `<li>` holding either a\n * standalone {@link NavigationMenu.Link} or a {@link NavigationMenu.Trigger}\n * paired with the {@link NavigationMenu.Content} it opens.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props and providing {@link NavigationMenu.Context}.\n * @returns The render function producing the item's markup.\n * @example\n * <NavigationMenu.Item>\n * \t<NavigationMenu.Trigger>{t(\"nav.products\")}</NavigationMenu.Trigger>\n * \t<NavigationMenu.Content>\n * \t\t<NavigationMenu.ContentList>\n * \t\t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t\t\t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentList>\n * \t</NavigationMenu.Content>\n * </NavigationMenu.Item>\n */\nNavigationMenu.Item = function NavigationMenuItem(\n\thandle: Handle<NavigationMenu.ItemProps, NavigationMenu.Context>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\thandle.context.set({ contentId: handle.id });\n\n\t\treturn <li {...rest} mix={[relative(), flex(), items(\"center\"), mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<button>` that opens the enclosing\n * {@link NavigationMenu.Item}'s {@link NavigationMenu.Content} through the\n * Invoker Commands API, so `aria-expanded` reflects the panel automatically.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <NavigationMenu.Trigger>{t(\"nav.products\")}</NavigationMenu.Trigger>\n * @example\n * <NavigationMenu.Trigger aria-disabled=\"true\">{t(\"nav.archived\")}</NavigationMenu.Trigger>\n */\nNavigationMenu.Trigger = function NavigationMenuTrigger(\n\thandle: Handle<NavigationMenu.TriggerProps>,\n) {\n\treturn () => {\n\t\tlet { type, commandfor, command, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(NavigationMenu.Item);\n\t\tlet resolvedType = type ?? DEFAULT_TRIGGER_TYPE;\n\t\tlet resolvedCommandfor = commandfor ?? context.contentId;\n\t\tlet resolvedCommand = command ?? DEFAULT_TRIGGER_COMMAND;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={resolvedType}\n\t\t\t\tcommandfor={resolvedCommandfor}\n\t\t\t\tcommand={resolvedCommand}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\tdisabled(opacity(50)),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen('&[aria-expanded=\"true\"]', [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\tdisabled(cursor(\"not-allowed\")),\n\t\t\t\t\ttext(\"sm\"),\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 {@link NavigationMenu.Content}, the floating panel a\n * {@link NavigationMenu.Trigger} opens: a {@link Popover} that fades and\n * scales itself using the platform's own `:popover-open` state.\n *\n * @param handle Runtime handle carrying the host's {@link Popover} props.\n * @returns The render function producing the panel's markup.\n * @example\n * <NavigationMenu.Content>\n * \t<NavigationMenu.ContentList>\n * \t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t</NavigationMenu.ContentList>\n * </NavigationMenu.Content>\n * @example\n * <NavigationMenu.Content size=\"wide\">\n * \t<NavigationMenu.ContentGrid>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t</NavigationMenu.ContentGrid>\n * </NavigationMenu.Content>\n */\nNavigationMenu.Content = function NavigationMenuContent(\n\thandle: Handle<NavigationMenu.ContentProps>,\n) {\n\treturn () => {\n\t\tlet { id, placement, size, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(NavigationMenu.Item);\n\t\tlet resolvedId = id ?? context.contentId;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_CONTENT_PLACEMENT;\n\t\tlet resolvedSize = size ?? DEFAULT_CONTENT_SIZE;\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tid={resolvedId}\n\t\t\t\tplacement={resolvedPlacement}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tis(\"max-content\"),\n\t\t\t\t\tminIs(\"11rem\"),\n\t\t\t\t\tsurfaceInset({ scale: 2 }),\n\t\t\t\t\tz(50),\n\t\t\t\t\topacity(0),\n\t\t\t\t\twhen('& [data-slot=\"link\"]', [is(\"full\"), justify(\"start\")]),\n\t\t\t\t\twhen('&[data-size=\"wide\"]', [is(\"28rem\"), maxIs(\"calc(100vw - 2rem)\")]),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\ttransition(\"opacity, scale, display, overlay\", {\n\t\t\t\t\t\tduration: durations.fast,\n\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t}),\n\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\tscaleProperty(\"0.95\"),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\twhen(\"&:popover-open\", [opacity(100), scaleProperty(\"none\")]),\n\t\t\t\t\tstartingStyle(when(\"&:popover-open\", [opacity(0), scaleProperty(\"0.95\")])),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\tscaleProperty(\"none\"),\n\t\t\t\t\t\ttransitionProperty(\"opacity, display, overlay\"),\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 {@link NavigationMenu.LinkProps.children} as a native `<a>`.\n * `aria-current` marks the active page; `aria-disabled=\"true\"` only mutes it\n * visually, since a plain `<a>` has no native disabled state to block clicks.\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 * <NavigationMenu.Link href=\"/pricing\">{t(\"nav.pricing\")}</NavigationMenu.Link>\n * @example\n * <NavigationMenu.Link href=\"/dashboard\" aria-current={pathname === \"/dashboard\" ? \"page\" : undefined}>\n * \t{t(\"nav.dashboard\")}\n * </NavigationMenu.Link>\n */\nNavigationMenu.Link = function NavigationMenuLink(handle: Handle<NavigationMenu.LinkProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\tdata-slot=\"link\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tleading(1),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [opacity(50), cursor(\"not-allowed\")]),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\tfontSize(\"sm\"),\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 a shared, animated surface that swaps in the active\n * {@link NavigationMenu.Item}'s content, sized by the custom properties a\n * pairing mixin writes as it measures the active panel and toggles visibility.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the shared frame's markup.\n * @example\n * <NavigationMenu.Viewport data-visible={isMenuOpen || undefined} />\n */\nNavigationMenu.Viewport = function NavigationMenuViewport(\n\thandle: Handle<NavigationMenu.ViewportProps>,\n) {\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\tfloatingSurface(),\n\t\t\t\t\traw({ borderRadius: concentricRadius(surfacePadding(2)) }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tmbs(2),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tis(\"var(--ui-navigation-menu-viewport-inline-size, auto)\"),\n\t\t\t\t\tbs(\"var(--ui-navigation-menu-viewport-block-size, auto)\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\ttransition(\"inline-size, block-size, opacity, scale\", {\n\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\teasing: easings.decelerate,\n\t\t\t\t\t}),\n\t\t\t\t\tscaleProperty(\"0.95\"),\n\t\t\t\t\tdata(\"visible\", [opacity(100), scaleProperty(\"none\")]),\n\t\t\t\t\tstartingStyle(data(\"visible\", [opacity(0), scaleProperty(\"0.95\")])),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\tscaleProperty(\"none\"),\n\t\t\t\t\t\ttransitionProperty(\"inline-size, block-size, opacity\"),\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 {@link NavigationMenu.ContentListProps.children} as a plain\n * vertical run of {@link NavigationMenu.Link}s inside\n * {@link NavigationMenu.Content}, for a dropdown that's just a short list.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <NavigationMenu.ContentList>\n * \t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * </NavigationMenu.ContentList>\n */\nNavigationMenu.ContentList = function NavigationMenuContentList(\n\thandle: Handle<NavigationMenu.ContentListProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} mix={[grid(), gap(1), mix]} />;\n\t};\n};\n\n/**\n * Renders {@link NavigationMenu.ContentGridProps.children} as a\n * multi-column layout inside {@link NavigationMenu.Content}: a single column\n * while the panel's own container is narrower than `40rem`, else two columns.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the grid's markup.\n * @example\n * <NavigationMenu.Content size=\"wide\">\n * \t<NavigationMenu.ContentGrid>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t</NavigationMenu.ContentGrid>\n * </NavigationMenu.Content>\n */\nNavigationMenu.ContentGrid = function NavigationMenuContentGrid(\n\thandle: Handle<NavigationMenu.ContentGridProps>,\n) {\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\tgrid(),\n\t\t\t\t\tgap(4),\n\t\t\t\t\tat(\"40rem\", CONTAINER_NAME, gridTemplate({ columns: \"repeat(2, minmax(0, 1fr))\" })),\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 {@link NavigationMenu.ContentColumnProps.children} as one column of\n * stacked {@link NavigationMenu.Link}s inside a\n * {@link NavigationMenu.ContentGrid}.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the column's markup.\n * @example\n * <NavigationMenu.ContentColumn>\n * \t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * </NavigationMenu.ContentColumn>\n */\nNavigationMenu.ContentColumn = function NavigationMenuContentColumn(\n\thandle: Handle<NavigationMenu.ContentColumnProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} mix={[grid(), gap(1), mix]} />;\n\t};\n};\n"
12
+ "content": "/**\n * A row of top-level navigation triggers, each either a plain link or a\n * button that opens a floating panel of related links. `NavigationMenu.Item`\n * hands its own stable id to whichever `NavigationMenu.Trigger` and\n * `NavigationMenu.Content` nest inside it through component context, so the\n * two pair up automatically — a consumer never wires a `commandfor`/`id`\n * pair by hand for the common case.\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, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport {\n\topacity,\n\trounded,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionProperty,\n} from \"@sdxc/u/effects\";\nimport { cursor, raw, userSelect } from \"@sdxc/u/general\";\nimport {\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrid,\n\tgridTemplate,\n\tinlineFlex,\n\titems,\n\tjustify,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { at, media, startingStyle } from \"@sdxc/u/responsive\";\nimport { bs, is, maxIs, mbs, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { data, disabled, hover, when } from \"@sdxc/u/state\";\nimport { scaleProperty } from \"@sdxc/u/transform\";\nimport { fontSize, leading, text, textDecoration, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport {\n\tconcentricRadius,\n\tfloatingSurface,\n\tsurfaceInset,\n\tsurfacePadding,\n} from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\nimport { Popover } from \"@sdxc/ui/popover\";\n\n/**\n * Named container {@link NavigationMenu.Content} declares on its own host, so\n * {@link NavigationMenu.ContentGrid} can adapt to the panel's own width\n * instead of the page's.\n */\nconst CONTAINER_NAME = \"ui-navigation-menu-content\";\n\n/**\n * `role=\"list\"` applied to {@link NavigationMenu.List} through {@link attrs}\n * unless a consumer supplies its own `role`, restoring list semantics that a\n * stylesheet clearing `list-style` otherwise drops for assistive technology.\n */\nconst DEFAULT_LIST_ROLE = \"list\";\n\n/**\n * Default {@link NavigationMenu.ListProps} orientation, applied when\n * `orientation` is omitted, laying triggers out in a single row.\n */\nconst DEFAULT_ORIENTATION: NavigationMenu.Orientation = \"horizontal\";\n\n/**\n * `type` {@link NavigationMenu.TriggerProps.type} falls back to when a\n * consumer doesn't supply one, keeping a click on the trigger from\n * submitting a surrounding `<form>`.\n */\nconst DEFAULT_TRIGGER_TYPE: NonNullable<NavigationMenu.TriggerProps[\"type\"]> = \"button\";\n\n/**\n * Invoker Commands verb {@link NavigationMenu.TriggerProps.command} falls\n * back to when omitted, showing the paired {@link NavigationMenu.Content} if\n * it's hidden and hiding it again if it's already showing.\n */\nconst DEFAULT_TRIGGER_COMMAND = \"toggle-popover\";\n\n/**\n * Side of the trigger {@link NavigationMenu.Content} renders against when\n * `placement` is left unset, matching a dropdown reading down and start-ward\n * from its trigger.\n */\nconst DEFAULT_CONTENT_PLACEMENT: NavigationMenu.ContentProps[\"placement\"] = \"bottom-start\";\n\n/**\n * {@link NavigationMenu.ContentProps.size} falls back to when omitted,\n * sizing the panel to its own content instead of a fixed wide measure.\n */\nconst DEFAULT_CONTENT_SIZE: NavigationMenu.ContentSize = \"default\";\n\n/** Prefetch mode {@link NavigationMenu.Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: NavigationMenu.Prefetch = \"none\";\n\n/**\n * Prop types for {@link NavigationMenu} and its compound parts.\n */\nexport namespace NavigationMenu {\n\t/**\n\t * Axis {@link NavigationMenu.List} lays its triggers out along: a single\n\t * row, or a single column.\n\t */\n\texport type Orientation = \"horizontal\" | \"vertical\";\n\n\t/**\n\t * Panel width {@link NavigationMenu.Content} renders at: sized to its own\n\t * content (`\"default\"`), or a fixed, generously wide measure that still\n\t * clamps to the viewport on narrow screens (`\"wide\"`).\n\t */\n\texport type ContentSize = \"default\" | \"wide\";\n\n\t/**\n\t * Value {@link NavigationMenu.Item} stores in component context so the\n\t * {@link NavigationMenu.Trigger} and {@link NavigationMenu.Content} nested\n\t * inside it pair up automatically.\n\t */\n\texport interface Context {\n\t\t/** Stable id the enclosing {@link NavigationMenu.Item} generated for its {@link NavigationMenu.Content}. */\n\t\tcontentId: string;\n\t}\n\n\t/**\n\t * Every native `<nav>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"nav\"> {\n\t\t/** The menu's own {@link NavigationMenu.List}, and anything else rendered alongside it (a {@link NavigationMenu.Viewport}, for instance). */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ListProps extends TagProps<\"ul\"> {\n\t\t/** Layout axis. Defaults to {@link DEFAULT_ORIENTATION}. */\n\t\torientation?: Orientation;\n\t\t/** One or more {@link NavigationMenu.Item}s. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"li\"> {\n\t\t/**\n\t\t * Either a standalone {@link NavigationMenu.Link}, or a\n\t\t * {@link NavigationMenu.Trigger} followed by the\n\t\t * {@link NavigationMenu.Content} it opens.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<button>` attribute, plus the `mix` passthrough.\n\t * `commandfor` and `command` both default from the enclosing\n\t * {@link NavigationMenu.Item}'s context.\n\t */\n\texport interface TriggerProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every prop {@link Popover.Props} accepts except `id`, which becomes\n\t * optional here since it defaults from the enclosing\n\t * {@link NavigationMenu.Item}'s context, plus `size`.\n\t */\n\texport interface ContentProps extends Omit<Popover.Props, \"id\" | \"placement\"> {\n\t\t/** Stable id matched against a {@link NavigationMenu.Trigger}'s `commandfor`. Defaults to the enclosing {@link NavigationMenu.Item}'s generated id. */\n\t\tid?: string;\n\t\t/** Side of the trigger to render against. Defaults to {@link DEFAULT_CONTENT_PLACEMENT}. */\n\t\tplacement?: Popover.Placement;\n\t\t/** Panel width. Defaults to {@link DEFAULT_CONTENT_SIZE}. */\n\t\tsize?: ContentSize;\n\t}\n\n\t/**\n\t * Every native `<a>` attribute, plus the `mix` passthrough. Uses an\n\t * intersection because the underlying anchor prop type is a union keyed on\n\t * `href`, narrowed here to required since a link needs a destination.\n\t */\n\texport type LinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/**\n\t\t * `\"intent\"`/`\"viewport\"` write `data-rmx-prefetch`; `\"render\"` adds a `<link rel=\"prefetch\">`\n\t\t * that also serves full-document navigations, so keep it to the first few links, 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\t/**\n\t * When a {@link NavigationMenu.Link}'s destination starts loading, the same\n\t * modes every link component in this library accepts.\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ViewportProps extends TagProps<\"div\"> {\n\t\t/** The currently active item's content, mirrored in from wherever it actually renders. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ContentListProps extends TagProps<\"div\"> {\n\t\t/** One or more {@link NavigationMenu.Link}s. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ContentGridProps extends TagProps<\"div\"> {\n\t\t/** Two or more {@link NavigationMenu.ContentColumn}s. */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface ContentColumnProps extends TagProps<\"div\"> {\n\t\t/** One or more {@link NavigationMenu.Link}s. */\n\t\tchildren?: RemixNode;\n\t}\n}\n\n/**\n * Renders the menu's root host: a native `<nav>` landmark establishing a\n * positioning context for whatever floating panels its\n * {@link NavigationMenu.Content} instances anchor against.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the menu's markup.\n * @example\n * <NavigationMenu aria-label={t(\"nav.primary\")}>\n * \t<NavigationMenu.List>\n * \t\t<NavigationMenu.Item>\n * \t\t\t<NavigationMenu.Link href=\"/\">{t(\"nav.home\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.Item>\n * \t</NavigationMenu.List>\n * </NavigationMenu>\n */\nexport function NavigationMenu(handle: Handle<NavigationMenu.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <nav {...rest} mix={[relative(), mix]} />;\n\t};\n}\n\n/**\n * Renders the row of top-level triggers: a native `<ul>` laying its\n * {@link NavigationMenu.Item}s out horizontally by default, switching to a\n * single start-aligned column when `orientation` is `\"vertical\"`.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <NavigationMenu.List>\n * \t<NavigationMenu.Item>\n * \t\t<NavigationMenu.Link href=\"/pricing\">{t(\"nav.pricing\")}</NavigationMenu.Link>\n * \t</NavigationMenu.Item>\n * </NavigationMenu.List>\n * @example\n * <NavigationMenu.List orientation=\"vertical\">\n * \t<NavigationMenu.Item>\n * \t\t<NavigationMenu.Link href=\"/settings/profile\">{t(\"nav.profile\")}</NavigationMenu.Link>\n * \t</NavigationMenu.Item>\n * </NavigationMenu.List>\n */\nNavigationMenu.List = function NavigationMenuList(handle: Handle<NavigationMenu.ListProps>) {\n\treturn () => {\n\t\tlet { orientation, mix, ...rest } = handle.props;\n\t\tlet resolvedOrientation = orientation ?? DEFAULT_ORIENTATION;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\tdata-orientation={resolvedOrientation}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_LIST_ROLE }),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(1),\n\t\t\t\t\twhen('&[data-orientation=\"vertical\"]', [flexCol(), items(\"start\")]),\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 a single top-level entry: a native `<li>` holding either a\n * standalone {@link NavigationMenu.Link} or a {@link NavigationMenu.Trigger}\n * paired with the {@link NavigationMenu.Content} it opens.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props and providing {@link NavigationMenu.Context}.\n * @returns The render function producing the item's markup.\n * @example\n * <NavigationMenu.Item>\n * \t<NavigationMenu.Trigger>{t(\"nav.products\")}</NavigationMenu.Trigger>\n * \t<NavigationMenu.Content>\n * \t\t<NavigationMenu.ContentList>\n * \t\t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t\t\t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentList>\n * \t</NavigationMenu.Content>\n * </NavigationMenu.Item>\n */\nNavigationMenu.Item = function NavigationMenuItem(\n\thandle: Handle<NavigationMenu.ItemProps, NavigationMenu.Context>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\thandle.context.set({ contentId: handle.id });\n\n\t\treturn <li {...rest} mix={[relative(), flex(), items(\"center\"), mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<button>` that opens the enclosing\n * {@link NavigationMenu.Item}'s {@link NavigationMenu.Content} through the\n * Invoker Commands API, so `aria-expanded` reflects the panel automatically.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <NavigationMenu.Trigger>{t(\"nav.products\")}</NavigationMenu.Trigger>\n * @example\n * <NavigationMenu.Trigger aria-disabled=\"true\">{t(\"nav.archived\")}</NavigationMenu.Trigger>\n */\nNavigationMenu.Trigger = function NavigationMenuTrigger(\n\thandle: Handle<NavigationMenu.TriggerProps>,\n) {\n\treturn () => {\n\t\tlet { type, commandfor, command, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(NavigationMenu.Item);\n\t\tlet resolvedType = type ?? DEFAULT_TRIGGER_TYPE;\n\t\tlet resolvedCommandfor = commandfor ?? context.contentId;\n\t\tlet resolvedCommand = command ?? DEFAULT_TRIGGER_COMMAND;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={resolvedType}\n\t\t\t\tcommandfor={resolvedCommandfor}\n\t\t\t\tcommand={resolvedCommand}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\tdisabled(opacity(50)),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen('&[aria-expanded=\"true\"]', [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\tdisabled(cursor(\"not-allowed\")),\n\t\t\t\t\ttext(\"sm\"),\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 {@link NavigationMenu.Content}, the floating panel a\n * {@link NavigationMenu.Trigger} opens: a {@link Popover} that fades and\n * scales itself using the platform's own `:popover-open` state.\n *\n * @param handle Runtime handle carrying the host's {@link Popover} props.\n * @returns The render function producing the panel's markup.\n * @example\n * <NavigationMenu.Content>\n * \t<NavigationMenu.ContentList>\n * \t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t</NavigationMenu.ContentList>\n * </NavigationMenu.Content>\n * @example\n * <NavigationMenu.Content size=\"wide\">\n * \t<NavigationMenu.ContentGrid>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t</NavigationMenu.ContentGrid>\n * </NavigationMenu.Content>\n */\nNavigationMenu.Content = function NavigationMenuContent(\n\thandle: Handle<NavigationMenu.ContentProps>,\n) {\n\treturn () => {\n\t\tlet { id, placement, size, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(NavigationMenu.Item);\n\t\tlet resolvedId = id ?? context.contentId;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_CONTENT_PLACEMENT;\n\t\tlet resolvedSize = size ?? DEFAULT_CONTENT_SIZE;\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tid={resolvedId}\n\t\t\t\tplacement={resolvedPlacement}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tis(\"max-content\"),\n\t\t\t\t\tminIs(\"11rem\"),\n\t\t\t\t\tsurfaceInset({ scale: 2 }),\n\t\t\t\t\tz(50),\n\t\t\t\t\topacity(0),\n\t\t\t\t\twhen('& [data-slot=\"link\"]', [is(\"full\"), justify(\"start\")]),\n\t\t\t\t\twhen('&[data-size=\"wide\"]', [is(\"28rem\"), maxIs(\"calc(100vw - 2rem)\")]),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\ttransition(\"opacity, scale, display, overlay\", {\n\t\t\t\t\t\tduration: durations.fast,\n\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t}),\n\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\tscaleProperty(\"0.95\"),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\twhen(\"&:popover-open\", [opacity(100), scaleProperty(\"none\")]),\n\t\t\t\t\tstartingStyle(when(\"&:popover-open\", [opacity(0), scaleProperty(\"0.95\")])),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\tscaleProperty(\"none\"),\n\t\t\t\t\t\ttransitionProperty(\"opacity, display, overlay\"),\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 {@link NavigationMenu.LinkProps.children} as a native `<a>`, followed\n * by its `<link rel=\"prefetch\">` when `prefetch=\"render\"`. `aria-current` marks\n * the active page; `aria-disabled=\"true\"` only mutes it visually.\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 * <NavigationMenu.Link href=\"/pricing\">{t(\"nav.pricing\")}</NavigationMenu.Link>\n * @example\n * <NavigationMenu.Link href=\"/docs\" prefetch=\"intent\">{t(\"nav.docs\")}</NavigationMenu.Link>\n * @example\n * <NavigationMenu.Link href=\"/dashboard\" aria-current={pathname === \"/dashboard\" ? \"page\" : undefined}>\n * \t{t(\"nav.dashboard\")}\n * </NavigationMenu.Link>\n */\nNavigationMenu.Link = function NavigationMenuLink(handle: Handle<NavigationMenu.LinkProps>) {\n\treturn () => {\n\t\tlet { prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\n\t\tlet anchor = (\n\t\t\t<a\n\t\t\t\tdata-slot=\"link\"\n\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tleading(1),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [opacity(50), cursor(\"not-allowed\")]),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\n\t\tif (!rendersPrefetchHint(resolvedPrefetch, rest.href)) return anchor;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{anchor}\n\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t</>\n\t\t);\n\t};\n};\n\n/**\n * Renders a shared, animated surface that swaps in the active\n * {@link NavigationMenu.Item}'s content, sized by the custom properties a\n * pairing mixin writes as it measures the active panel and toggles visibility.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the shared frame's markup.\n * @example\n * <NavigationMenu.Viewport data-visible={isMenuOpen || undefined} />\n */\nNavigationMenu.Viewport = function NavigationMenuViewport(\n\thandle: Handle<NavigationMenu.ViewportProps>,\n) {\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\tfloatingSurface(),\n\t\t\t\t\traw({ borderRadius: concentricRadius(surfacePadding(2)) }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tmbs(2),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tis(\"var(--ui-navigation-menu-viewport-inline-size, auto)\"),\n\t\t\t\t\tbs(\"var(--ui-navigation-menu-viewport-block-size, auto)\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\ttransition(\"inline-size, block-size, opacity, scale\", {\n\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\teasing: easings.decelerate,\n\t\t\t\t\t}),\n\t\t\t\t\tscaleProperty(\"0.95\"),\n\t\t\t\t\tdata(\"visible\", [opacity(100), scaleProperty(\"none\")]),\n\t\t\t\t\tstartingStyle(data(\"visible\", [opacity(0), scaleProperty(\"0.95\")])),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\tscaleProperty(\"none\"),\n\t\t\t\t\t\ttransitionProperty(\"inline-size, block-size, opacity\"),\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 {@link NavigationMenu.ContentListProps.children} as a plain\n * vertical run of {@link NavigationMenu.Link}s inside\n * {@link NavigationMenu.Content}, for a dropdown that's just a short list.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <NavigationMenu.ContentList>\n * \t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * </NavigationMenu.ContentList>\n */\nNavigationMenu.ContentList = function NavigationMenuContentList(\n\thandle: Handle<NavigationMenu.ContentListProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} mix={[grid(), gap(1), mix]} />;\n\t};\n};\n\n/**\n * Renders {@link NavigationMenu.ContentGridProps.children} as a\n * multi-column layout inside {@link NavigationMenu.Content}: a single column\n * while the panel's own container is narrower than `40rem`, else two columns.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the grid's markup.\n * @example\n * <NavigationMenu.Content size=\"wide\">\n * \t<NavigationMenu.ContentGrid>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t\t<NavigationMenu.ContentColumn>\n * \t\t\t<NavigationMenu.Link href=\"/products/two\">{t(\"products.two\")}</NavigationMenu.Link>\n * \t\t</NavigationMenu.ContentColumn>\n * \t</NavigationMenu.ContentGrid>\n * </NavigationMenu.Content>\n */\nNavigationMenu.ContentGrid = function NavigationMenuContentGrid(\n\thandle: Handle<NavigationMenu.ContentGridProps>,\n) {\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\tgrid(),\n\t\t\t\t\tgap(4),\n\t\t\t\t\tat(\"40rem\", CONTAINER_NAME, gridTemplate({ columns: \"repeat(2, minmax(0, 1fr))\" })),\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 {@link NavigationMenu.ContentColumnProps.children} as one column of\n * stacked {@link NavigationMenu.Link}s inside a\n * {@link NavigationMenu.ContentGrid}.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the column's markup.\n * @example\n * <NavigationMenu.ContentColumn>\n * \t<NavigationMenu.Link href=\"/products/one\">{t(\"products.one\")}</NavigationMenu.Link>\n * </NavigationMenu.ContentColumn>\n */\nNavigationMenu.ContentColumn = function NavigationMenuContentColumn(\n\thandle: Handle<NavigationMenu.ContentColumnProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} mix={[grid(), gap(1), mix]} />;\n\t};\n};\n"
13
13
  },
14
- "test": null
14
+ "test": {
15
+ "path": "navigation-menu.test.tsx",
16
+ "content": "/**\n * Tests for the markup each {@link NavigationMenu.Link} prefetch mode writes:\n * runtime-read modes land on the anchor as `data-rmx-prefetch`, and `\"render\"`\n * places a `<link rel=\"prefetch\">` right after it.\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 { NavigationMenu } from \"@sdxc/ui/navigation-menu\";\n\ndescribe(\"NavigationMenu.Link prefetch\", () => {\n\ttest(\"writes neither the attribute nor a hint by default\", async () => {\n\t\tlet html = await renderToString(<NavigationMenu.Link href=\"/next\">Docs</NavigationMenu.Link>);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t});\n\n\ttest.each([\"intent\", \"viewport\"] as const)(\n\t\t'writes data-rmx-prefetch=\"%s\" on the anchor and renders no hint',\n\t\tasync (mode) => {\n\t\t\tlet html = await renderToString(\n\t\t\t\t<NavigationMenu.Link href=\"/next\" prefetch={mode}>\n\t\t\t\t\tDocs\n\t\t\t\t</NavigationMenu.Link>,\n\t\t\t);\n\n\t\t\texpect(html).toMatch(new RegExp(`<a[^>]*data-rmx-prefetch=\"${mode}\"`));\n\t\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t\t},\n\t);\n\n\ttest('renders a prefetch hint after the anchor, without the attribute, for \"render\"', async () => {\n\t\tlet html = await renderToString(\n\t\t\t<NavigationMenu.Link href=\"/next\" prefetch=\"render\">\n\t\t\t\tDocs\n\t\t\t</NavigationMenu.Link>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).toMatch(/<\\/a><link rel=\"prefetch\" href=\"\\/next\"\\s*\\/?>/);\n\t});\n\n\ttest('renders no hint for \"render\" when the anchor has no destination', async () => {\n\t\tlet html = await renderToString(\n\t\t\t<NavigationMenu.Link href=\"\" prefetch=\"render\">\n\t\t\t\tDocs\n\t\t\t</NavigationMenu.Link>,\n\t\t);\n\n\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t});\n});\n"
17
+ }
15
18
  }