@sdxc/kit 2026.10.21 → 2026.10.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +84 -4
  2. package/changelog.jsonl +86 -0
  3. package/config.schema.json +154 -0
  4. package/dist/architecture/complexity.d.ts +73 -0
  5. package/dist/architecture/complexity.js +185 -0
  6. package/dist/architecture/crap.d.ts +62 -0
  7. package/dist/architecture/crap.js +121 -0
  8. package/dist/architecture/graph.d.ts +55 -0
  9. package/dist/architecture/graph.js +194 -0
  10. package/dist/architecture/layers.d.ts +29 -0
  11. package/dist/architecture/layers.js +81 -0
  12. package/dist/architecture/mermaid.d.ts +20 -0
  13. package/dist/architecture/mermaid.js +51 -0
  14. package/dist/cli.js +9 -0
  15. package/dist/commands/create.js +4 -3
  16. package/dist/commands/deploy.js +10 -9
  17. package/dist/commands/destroy.d.ts +1 -1
  18. package/dist/commands/diagram.d.ts +17 -0
  19. package/dist/commands/diagram.js +45 -0
  20. package/dist/commands/fix.d.ts +69 -0
  21. package/dist/commands/fix.js +102 -0
  22. package/dist/commands/make.d.ts +71 -2
  23. package/dist/commands/make.js +46 -0
  24. package/dist/commands/run.d.ts +15 -11
  25. package/dist/commands/run.js +21 -16
  26. package/dist/commands/scaffold.d.ts +1 -1
  27. package/dist/commands/setup.d.ts +26 -0
  28. package/dist/commands/setup.js +33 -0
  29. package/dist/config.d.ts +52 -0
  30. package/dist/config.js +88 -1
  31. package/dist/contract.d.ts +52 -3
  32. package/dist/contract.js +124 -2
  33. package/dist/dependencies.js +7 -1
  34. package/dist/deploy/plan.d.ts +5 -0
  35. package/dist/deploy/plan.js +10 -0
  36. package/dist/destroy.js +13 -6
  37. package/dist/diagram.d.ts +32 -0
  38. package/dist/diagram.js +47 -0
  39. package/dist/doctor/checks.d.ts +2 -1
  40. package/dist/doctor/checks.js +24 -1
  41. package/dist/doctor/complexity.d.ts +13 -0
  42. package/dist/doctor/complexity.js +52 -0
  43. package/dist/doctor/crap.d.ts +14 -0
  44. package/dist/doctor/crap.js +67 -0
  45. package/dist/doctor/dependencies.d.ts +13 -0
  46. package/dist/doctor/dependencies.js +42 -0
  47. package/dist/doctor/duplication.d.ts +19 -0
  48. package/dist/doctor/duplication.js +106 -0
  49. package/dist/doctor/fan-out.d.ts +12 -0
  50. package/dist/doctor/fan-out.js +42 -0
  51. package/dist/doctor/feature-scatter.d.ts +15 -0
  52. package/dist/doctor/feature-scatter.js +84 -0
  53. package/dist/doctor/module-size.d.ts +13 -0
  54. package/dist/doctor/module-size.js +50 -0
  55. package/dist/doctor/mutation.d.ts +20 -0
  56. package/dist/doctor/mutation.js +97 -0
  57. package/dist/doctor/orphans.d.ts +13 -0
  58. package/dist/doctor/orphans.js +50 -0
  59. package/dist/doctor/project.js +8 -5
  60. package/dist/doctor/result-throws.d.ts +17 -0
  61. package/dist/doctor/result-throws.js +72 -0
  62. package/dist/doctor/test-ratio.d.ts +12 -0
  63. package/dist/doctor/test-ratio.js +31 -0
  64. package/dist/fix/commands.d.ts +37 -0
  65. package/dist/fix/commands.js +63 -0
  66. package/dist/fix/emails.d.ts +21 -0
  67. package/dist/fix/emails.js +159 -0
  68. package/dist/fix/env.d.ts +29 -0
  69. package/dist/fix/env.js +58 -0
  70. package/dist/fix/index.d.ts +11 -0
  71. package/dist/fix/index.js +11 -0
  72. package/dist/fix/models.d.ts +20 -0
  73. package/dist/fix/models.js +95 -0
  74. package/dist/lock.js +12 -2
  75. package/dist/make/binding.d.ts +42 -0
  76. package/dist/make/binding.js +237 -0
  77. package/dist/make/imports.js +7 -5
  78. package/dist/make/schema-diff.js +8 -1
  79. package/dist/models.js +7 -7
  80. package/dist/routes/modules.js +8 -5
  81. package/dist/routes/parse.js +8 -7
  82. package/dist/routes/routers.js +9 -5
  83. package/dist/setup/auth.d.ts +12 -0
  84. package/dist/setup/auth.js +209 -0
  85. package/dist/setup/billing.d.ts +11 -0
  86. package/dist/setup/billing.js +116 -0
  87. package/dist/setup/catalog.d.ts +25 -0
  88. package/dist/setup/catalog.js +34 -0
  89. package/dist/setup/credit.d.ts +13 -0
  90. package/dist/setup/credit.js +21 -0
  91. package/dist/setup/flags.d.ts +11 -0
  92. package/dist/setup/flags.js +62 -0
  93. package/dist/setup/index.d.ts +25 -0
  94. package/dist/setup/index.js +53 -0
  95. package/dist/setup/plan.d.ts +38 -0
  96. package/dist/setup/plan.js +62 -0
  97. package/dist/testing.js +3 -3
  98. package/dist/ui/layout.js +1 -1
  99. package/dist/ui/registry.d.ts +2 -2
  100. package/dist/upgrade/project.d.ts +2 -2
  101. package/dist/upgrade/prompt.js +7 -5
  102. package/package.json +10 -7
  103. package/registry/ui/attachment.json +2 -2
  104. package/templates/app/AGENTS.md +14 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attachment",
3
- "changedIn": "2026.10.20",
3
+ "changedIn": "2026.10.23",
4
4
  "dependencies": [
5
5
  "button"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "attachment.tsx",
12
- "content": "/**\n * A compound card presenting one attached file or image — media preview, name,\n * supporting details, actions — plus a horizontally scrolling row for several\n * cards side by side. Every part styles itself off the card's own `state`, and\n * whole-card click-through stays an opt-in wrapper a consumer mixes in.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded, transition } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tblock,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thstack,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow, overflowX } from \"@sdxc/u/overflow\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { aspect, bs, fit, is, minIs, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, textAlign, truncate, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { shimmer } from \"@sdxc/ui/animations\";\nimport { scrollFade } from \"@sdxc/ui/animations\";\n\nimport { Button } from \"@sdxc/ui/button\";\n\nconst DEFAULT_STATE: Attachment.State = \"idle\";\n\n/**\n * Named container {@link Attachment} declares on its own host, so\n * {@link Attachment.Media}, {@link Attachment.Content}, and the inner layout\n * wrapper resolve their width queries against the card itself.\n */\nconst CONTAINER_NAME = \"ui-attachment\";\n\n/**\n * `@container` query every width-adapting part below the root shares: at or\n * under this width the card reflows into a taller tile, the shape\n * {@link Attachment.Group}'s narrow, fixed-width cards need.\n */\nconst NARROW_CONTAINER_QUERY = `@container ${CONTAINER_NAME} (max-width: 12rem)`;\n\n/**\n * Selector fragment gating {@link Attachment.Title}'s shimmer: it matches the\n * title's own `data-state` attribute while that reads `\"uploading\"` or\n * `\"processing\"`, so a title in any other state renders as plain text.\n */\nconst TITLE_SHIMMER_WHEN = ':is([data-state=\"uploading\"], [data-state=\"processing\"])';\n\nconst DEFAULT_ACTION_VARIANT: Button.Variant = \"ghost\";\n\nconst DEFAULT_ACTION_SIZE: Button.Size = \"sm\";\n\nconst DEFAULT_ACTION_COLOR: Button.Color = \"neutral\";\n\n/**\n * Tab-stop order {@link attrs} applies to {@link Attachment.Group} when a\n * consumer supplies no `tabIndex`, so the row itself stays keyboard-reachable\n * and scrollable whatever its cards contain.\n */\nconst DEFAULT_GROUP_TAB_INDEX = 0;\n\nconst GROUP_SCROLL_FADE_SIZE = \"2rem\";\n\n/**\n * Prop types for {@link Attachment} and its compound parts.\n */\nexport namespace Attachment {\n\t/**\n\t * Lifecycle state of a card's file or image. `\"idle\"` and `\"done\"` both\n\t * render as a settled card — `\"idle\"` for a file already on the server,\n\t * `\"done\"` for one whose transfer finished. A consumer owns every transition.\n\t */\n\texport type State = \"idle\" | \"uploading\" | \"processing\" | \"error\" | \"done\";\n\n\t/**\n\t * Props accepted by {@link Attachment}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Lifecycle state of the file or image the card represents. Defaults to `\"idle\"`. */\n\t\tstate?: State;\n\t\t/** The card's compound parts: {@link Attachment.Media}, {@link Attachment.Content}, and {@link Attachment.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The preview itself: an `<img>`, or a decorative icon standing in for the file's type. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Attachment.Title} and, optionally, {@link Attachment.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"p\"> {\n\t\t/**\n\t\t * The ancestor {@link Attachment}'s own `state`, repeated here because a\n\t\t * component reads only its own props; passing the same value to both is\n\t\t * what keeps them in sync. Left unset, the title renders plain.\n\t\t */\n\t\tstate?: Attachment.State;\n\t\t/** The file or image name. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail — a file size, a page count, an error message. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment.Action} controls. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Action}: every {@link Button.Props}\n\t * field, unchanged, so an action keeps the same color, weight, and size\n\t * contract as every other button in the catalog.\n\t */\n\texport interface ActionProps extends Button.Props {}\n\n\t/**\n\t * Props accepted by {@link Attachment.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Destination the whole card follows once `attachmentTrigger()` is mixed\n\t\t * in, opened in place unless the activation asks for a new tab. It rides on\n\t\t * a `<div>` so a nested {@link Attachment.Action} stays valid markup.\n\t\t */\n\t\thref?: string;\n\t\t/**\n\t\t * `id` of a `<dialog>` element the whole card opens once\n\t\t * `attachmentTrigger()` is mixed in, instead of following `href`.\n\t\t */\n\t\tcommandfor?: string;\n\t\t/** Invoker Commands verb dispatched to `commandfor`'s dialog. Defaults to `\"show-modal\"`. */\n\t\tcommand?: \"show-modal\";\n\t\t/** Where `href` opens: a window/frame name, or `\"_blank\"` for a new tab. Meaningful only alongside `href`. */\n\t\ttarget?: string;\n\t\t/** The card's own markup — typically an {@link Attachment}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment} or {@link Attachment.Trigger} cards. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * The card's outer host, recolored to the danger tint at `state=\"error\"` and\n * declaring the `ui-attachment` named container so nested parts reflow at the\n * card's width. A busy state sets `aria-busy` to the token ARIA recognizes.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the card's markup.\n * @example\n * <Attachment state=\"uploading\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title state=\"uploading\">quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploading\")}</Attachment.Description>\n * \t</Attachment.Content>\n * </Attachment>\n * @example\n * <Attachment state=\"error\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n * \t</Attachment.Content>\n * \t<Attachment.Actions>\n * \t\t<Attachment.Action aria-label={t(\"attachment.retry\")}><RotateCwIcon /></Attachment.Action>\n * \t</Attachment.Actions>\n * </Attachment>\n */\nexport function Attachment(handle: Handle<Attachment.Props>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\t\tlet resolvedState = state ?? DEFAULT_STATE;\n\t\tlet isBusy = resolvedState === \"uploading\" || resolvedState === \"processing\";\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"attachment\"\n\t\t\t\tdata-state={resolvedState}\n\t\t\t\taria-busy={isBusy ? \"true\" : undefined}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tp(3),\n\t\t\t\t\ttransition(\"border-color, background-color\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\twhen('&[data-state=\"error\"]', [\n\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\tfg(\"danger.emphasis\"),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"body\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\thstack({ gap: 3, align: \"center\" }),\n\t\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [flexCol(), items(\"stretch\")]),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * The card's media well: a fixed-size, rounded box clipping the preview a\n * consumer nests inside. Inside a narrow container it grows to the card's own\n * inline size at a wider aspect ratio, reading as a thumbnail tile.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media well's markup.\n * @example\n * <Attachment.Media><img src={file.thumbnailUrl} alt=\"\" /></Attachment.Media>\n * @example\n * <Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n */\nAttachment.Media = function AttachmentMedia(handle: Handle<Attachment.MediaProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"media\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(0),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tis(10),\n\t\t\t\t\tbs(10),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\twhen(\"& > img\", [is(\"full\"), bs(\"full\"), fit(\"cover\")]),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [is(\"full\"), bs(\"auto\"), aspect(4, 3), rounded(\"lg\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The card's text column, growing into whatever inline space\n * {@link Attachment.Media} and {@link Attachment.Actions} leave it. Its minimum\n * inline size collapses to `0`, which is what lets its children truncate.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Attachment.Content>\n * \t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t<Attachment.Description>2.4 MB</Attachment.Description>\n * </Attachment.Content>\n */\nAttachment.Content = function AttachmentContent(handle: Handle<Attachment.ContentProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tvstack({ gap: 0.5 }),\n\t\t\t\t\tminIs(0),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, textAlign(\"center\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The file or image name in a native `<p>`, truncated to a single line with an\n * ellipsis. Given the same `state` as the ancestor {@link Attachment}, it\n * shimmers while that reads `\"uploading\"` or `\"processing\"`, then settles.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * @example\n * <Attachment.Title state={attachment.state}>{attachment.name}</Attachment.Title>\n */\nAttachment.Title = function AttachmentTitle(handle: Handle<Attachment.TitleProps>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tdata-state={state}\n\t\t\t\tmix={[\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The loop settles visible, because this host carries the file's name: a gated\n\t\t\t\t\t * loop rests hidden outside its gate, which suits an element that exists only\n\t\t\t\t\t * as a loading cue and would leave every finished upload unnamed.\n\t\t\t\t\t */\n\t\t\t\t\tshimmer({ when: TITLE_SHIMMER_WHEN, outsideGate: \"visible\" }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's supporting detail line: a muted, single-line `<p>` carrying a file\n * size, a page count, or the explanation of what went wrong once the ancestor\n * {@link Attachment}'s `state` reads `\"error\"`.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Attachment.Description>2.4 MB</Attachment.Description>\n * @example\n * <Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n */\nAttachment.Description = function AttachmentDescription(\n\thandle: Handle<Attachment.DescriptionProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p {...rest} data-slot=\"description\" mix={[truncate(), fg(\"neutral.muted\"), text(\"xs\"), mix]}>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's action row, shrink-proof so a narrow card's width is absorbed by\n * {@link Attachment.Content}'s own truncation while the actions keep their\n * size.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Attachment.Actions>\n * \t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t<Attachment.Action aria-label={t(\"attachment.remove\")}><XIcon /></Attachment.Action>\n * </Attachment.Actions>\n */\nAttachment.Actions = function AttachmentActions(handle: Handle<Attachment.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"actions\" mix={[flex(), shrink(0), items(\"center\"), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A single card action as a {@link Button}, defaulting to a compact, `\"ghost\"`,\n * neutral control so a row of actions reads as secondary to the card's title.\n * Every {@link Button} prop stays available, `type` included.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the action's markup.\n * @example\n * <Attachment.Action aria-label={t(\"attachment.download\")}>\n * \t<DownloadIcon />\n * </Attachment.Action>\n * @example\n * <Attachment.Action type=\"submit\" name=\"intent\" value=\"retry\" aria-label={t(\"attachment.retry\")}>\n * \t<RotateCwIcon />\n * </Attachment.Action>\n */\nAttachment.Action = function AttachmentAction(handle: Handle<Attachment.ActionProps>) {\n\treturn () => {\n\t\tlet { color, variant, size, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tcolor={color ?? DEFAULT_ACTION_COLOR}\n\t\t\t\tvariant={variant ?? DEFAULT_ACTION_VARIANT}\n\t\t\t\tsize={size ?? DEFAULT_ACTION_SIZE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"action\"\n\t\t\t\tmix={[shrink(0), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * A wrapper `<div>` whose `href` or `commandfor` stays an inert attribute until\n * a consumer mixes in `attachmentTrigger()`. Either one also derives a `role`\n * and `tabIndex`, so whole-card activation is announced and keyboard-reachable.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the wrapper's markup.\n * @example\n * <Attachment.Trigger href=\"/files/quarterly-report.pdf\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">\n * \t\t<Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n * \t\t<Attachment.Content>\n * \t\t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t</Attachment.Content>\n * \t\t<Attachment.Actions>\n * \t\t\t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t\t</Attachment.Actions>\n * \t</Attachment>\n * </Attachment.Trigger>\n * @example\n * <Attachment.Trigger commandfor=\"quarterly-report-preview\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">…</Attachment>\n * </Attachment.Trigger>\n * <Dialog id=\"quarterly-report-preview\">…</Dialog>\n */\nAttachment.Trigger = function AttachmentTrigger(handle: Handle<Attachment.TriggerProps>) {\n\treturn () => {\n\t\tlet { href, commandfor, command, target, role, tabIndex, children, mix, ...rest } =\n\t\t\thandle.props;\n\t\tlet isConfigured = href !== undefined || commandfor !== undefined;\n\t\tlet resolvedRole = role ?? (href !== undefined ? \"link\" : isConfigured ? \"button\" : undefined);\n\t\tlet resolvedTabIndex = tabIndex ?? (isConfigured ? 0 : undefined);\n\n\t\tif (import.meta.env?.DEV && !isConfigured) {\n\t\t\tconsole.warn(\n\t\t\t\t'Attachment.Trigger: rendered with neither \"href\" nor \"commandfor\" — nothing will happen once `attachmentTrigger()` handles an activation.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\trole={resolvedRole}\n\t\t\t\ttabIndex={resolvedTabIndex}\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ href, commandfor, command, target }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tblock(),\n\t\t\t\t\trounded(\"inherit\"),\n\t\t\t\t\twhen(\"&[role]:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&[role]:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A horizontally scroll-snapping row of cards, faded at both inline edges to\n * hint at cards beyond the current view. The row itself carries the tab stop,\n * since the row is what scrolls.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Attachment.Group aria-label={t(\"thread.attachments\")}>\n * \t{attachments.map((attachment) => (\n * \t\t<Attachment key={attachment.id} state={attachment.state}>…</Attachment>\n * \t))}\n * </Attachment.Group>\n */\nAttachment.Group = function AttachmentGroup(handle: Handle<Attachment.GroupProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ tabIndex: DEFAULT_GROUP_TAB_INDEX }),\n\t\t\t\t\tflex(),\n\t\t\t\t\tgap(3),\n\t\t\t\t\toverflowX(\"auto\"),\n\t\t\t\t\traw({\n\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\tscrollSnapType: \"inline mandatory\",\n\t\t\t\t\t\tscrollPaddingInline: \"0.75rem\",\n\t\t\t\t\t\tscrollBehavior: \"auto\",\n\t\t\t\t\t}),\n\t\t\t\t\twhen(\"& > *\", [shrink(0), raw({ scrollSnapAlign: \"start\" })]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: no-preference)\", raw({ scrollBehavior: \"smooth\" })),\n\t\t\t\t\tscrollFade({ axis: \"inline\", size: GROUP_SCROLL_FADE_SIZE }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
12
+ "content": "/**\n * A compound card presenting one attached file or image — media preview, name,\n * supporting details, actions — plus a horizontally scrolling row for several\n * cards side by side. Every part styles itself off the card's own `state`, and\n * whole-card click-through stays an opt-in wrapper a consumer mixes in.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { iife } from \"@sdxc/iife\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded, transition } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tblock,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thstack,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow, overflowX } from \"@sdxc/u/overflow\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { aspect, bs, fit, is, minIs, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, textAlign, truncate, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { shimmer } from \"@sdxc/ui/animations\";\nimport { scrollFade } from \"@sdxc/ui/animations\";\n\nimport { Button } from \"@sdxc/ui/button\";\n\nconst DEFAULT_STATE: Attachment.State = \"idle\";\n\n/**\n * Named container {@link Attachment} declares on its own host, so\n * {@link Attachment.Media}, {@link Attachment.Content}, and the inner layout\n * wrapper resolve their width queries against the card itself.\n */\nconst CONTAINER_NAME = \"ui-attachment\";\n\n/**\n * `@container` query every width-adapting part below the root shares: at or\n * under this width the card reflows into a taller tile, the shape\n * {@link Attachment.Group}'s narrow, fixed-width cards need.\n */\nconst NARROW_CONTAINER_QUERY = `@container ${CONTAINER_NAME} (max-width: 12rem)`;\n\n/**\n * Selector fragment gating {@link Attachment.Title}'s shimmer: it matches the\n * title's own `data-state` attribute while that reads `\"uploading\"` or\n * `\"processing\"`, so a title in any other state renders as plain text.\n */\nconst TITLE_SHIMMER_WHEN = ':is([data-state=\"uploading\"], [data-state=\"processing\"])';\n\nconst DEFAULT_ACTION_VARIANT: Button.Variant = \"ghost\";\n\nconst DEFAULT_ACTION_SIZE: Button.Size = \"sm\";\n\nconst DEFAULT_ACTION_COLOR: Button.Color = \"neutral\";\n\n/**\n * Tab-stop order {@link attrs} applies to {@link Attachment.Group} when a\n * consumer supplies no `tabIndex`, so the row itself stays keyboard-reachable\n * and scrollable whatever its cards contain.\n */\nconst DEFAULT_GROUP_TAB_INDEX = 0;\n\nconst GROUP_SCROLL_FADE_SIZE = \"2rem\";\n\n/**\n * Prop types for {@link Attachment} and its compound parts.\n */\nexport namespace Attachment {\n\t/**\n\t * Lifecycle state of a card's file or image. `\"idle\"` and `\"done\"` both\n\t * render as a settled card — `\"idle\"` for a file already on the server,\n\t * `\"done\"` for one whose transfer finished. A consumer owns every transition.\n\t */\n\texport type State = \"idle\" | \"uploading\" | \"processing\" | \"error\" | \"done\";\n\n\t/**\n\t * Props accepted by {@link Attachment}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Lifecycle state of the file or image the card represents. Defaults to `\"idle\"`. */\n\t\tstate?: State;\n\t\t/** The card's compound parts: {@link Attachment.Media}, {@link Attachment.Content}, and {@link Attachment.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The preview itself: an `<img>`, or a decorative icon standing in for the file's type. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Attachment.Title} and, optionally, {@link Attachment.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"p\"> {\n\t\t/**\n\t\t * The ancestor {@link Attachment}'s own `state`, repeated here because a\n\t\t * component reads only its own props; passing the same value to both is\n\t\t * what keeps them in sync. Left unset, the title renders plain.\n\t\t */\n\t\tstate?: Attachment.State;\n\t\t/** The file or image name. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail — a file size, a page count, an error message. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment.Action} controls. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Action}: every {@link Button.Props}\n\t * field, unchanged, so an action keeps the same color, weight, and size\n\t * contract as every other button in the catalog.\n\t */\n\texport interface ActionProps extends Button.Props {}\n\n\t/**\n\t * Props accepted by {@link Attachment.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Destination the whole card follows once `attachmentTrigger()` is mixed\n\t\t * in, opened in place unless the activation asks for a new tab. It rides on\n\t\t * a `<div>` so a nested {@link Attachment.Action} stays valid markup.\n\t\t */\n\t\thref?: string;\n\t\t/**\n\t\t * `id` of a `<dialog>` element the whole card opens once\n\t\t * `attachmentTrigger()` is mixed in, instead of following `href`.\n\t\t */\n\t\tcommandfor?: string;\n\t\t/** Invoker Commands verb dispatched to `commandfor`'s dialog. Defaults to `\"show-modal\"`. */\n\t\tcommand?: \"show-modal\";\n\t\t/** Where `href` opens: a window/frame name, or `\"_blank\"` for a new tab. Meaningful only alongside `href`. */\n\t\ttarget?: string;\n\t\t/** The card's own markup — typically an {@link Attachment}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Attachment.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link Attachment} or {@link Attachment.Trigger} cards. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * The card's outer host, recolored to the danger tint at `state=\"error\"` and\n * declaring the `ui-attachment` named container so nested parts reflow at the\n * card's width. A busy state sets `aria-busy` to the token ARIA recognizes.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the card's markup.\n * @example\n * <Attachment state=\"uploading\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title state=\"uploading\">quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploading\")}</Attachment.Description>\n * \t</Attachment.Content>\n * </Attachment>\n * @example\n * <Attachment state=\"error\">\n * \t<Attachment.Media><FileIcon aria-hidden /></Attachment.Media>\n * \t<Attachment.Content>\n * \t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t<Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n * \t</Attachment.Content>\n * \t<Attachment.Actions>\n * \t\t<Attachment.Action aria-label={t(\"attachment.retry\")}><RotateCwIcon /></Attachment.Action>\n * \t</Attachment.Actions>\n * </Attachment>\n */\nexport function Attachment(handle: Handle<Attachment.Props>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\t\tlet resolvedState = state ?? DEFAULT_STATE;\n\t\tlet isBusy = resolvedState === \"uploading\" || resolvedState === \"processing\";\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"attachment\"\n\t\t\t\tdata-state={resolvedState}\n\t\t\t\taria-busy={isBusy ? \"true\" : undefined}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tp(3),\n\t\t\t\t\ttransition(\"border-color, background-color\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\twhen('&[data-state=\"error\"]', [\n\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\tfg(\"danger.emphasis\"),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"body\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\thstack({ gap: 3, align: \"center\" }),\n\t\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [flexCol(), items(\"stretch\")]),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * The card's media well: a fixed-size, rounded box clipping the preview a\n * consumer nests inside. Inside a narrow container it grows to the card's own\n * inline size at a wider aspect ratio, reading as a thumbnail tile.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media well's markup.\n * @example\n * <Attachment.Media><img src={file.thumbnailUrl} alt=\"\" /></Attachment.Media>\n * @example\n * <Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n */\nAttachment.Media = function AttachmentMedia(handle: Handle<Attachment.MediaProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"media\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(0),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\toverflow(),\n\t\t\t\t\tis(10),\n\t\t\t\t\tbs(10),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\twhen(\"& > img\", [is(\"full\"), bs(\"full\"), fit(\"cover\")]),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, [is(\"full\"), bs(\"auto\"), aspect(4, 3), rounded(\"lg\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The card's text column, growing into whatever inline space\n * {@link Attachment.Media} and {@link Attachment.Actions} leave it. Its minimum\n * inline size collapses to `0`, which is what lets its children truncate.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Attachment.Content>\n * \t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t<Attachment.Description>2.4 MB</Attachment.Description>\n * </Attachment.Content>\n */\nAttachment.Content = function AttachmentContent(handle: Handle<Attachment.ContentProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tvstack({ gap: 0.5 }),\n\t\t\t\t\tminIs(0),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\twhen(NARROW_CONTAINER_QUERY, textAlign(\"center\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * The file or image name in a native `<p>`, truncated to a single line with an\n * ellipsis. Given the same `state` as the ancestor {@link Attachment}, it\n * shimmers while that reads `\"uploading\"` or `\"processing\"`, then settles.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * @example\n * <Attachment.Title state={attachment.state}>{attachment.name}</Attachment.Title>\n */\nAttachment.Title = function AttachmentTitle(handle: Handle<Attachment.TitleProps>) {\n\treturn () => {\n\t\tlet { state, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tdata-state={state}\n\t\t\t\tmix={[\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The loop settles visible, because this host carries the file's name: a gated\n\t\t\t\t\t * loop rests hidden outside its gate, which suits an element that exists only\n\t\t\t\t\t * as a loading cue and would leave every finished upload unnamed.\n\t\t\t\t\t */\n\t\t\t\t\tshimmer({ when: TITLE_SHIMMER_WHEN, outsideGate: \"visible\" }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's supporting detail line: a muted, single-line `<p>` carrying a file\n * size, a page count, or the explanation of what went wrong once the ancestor\n * {@link Attachment}'s `state` reads `\"error\"`.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Attachment.Description>2.4 MB</Attachment.Description>\n * @example\n * <Attachment.Description>{t(\"attachment.uploadFailed\")}</Attachment.Description>\n */\nAttachment.Description = function AttachmentDescription(\n\thandle: Handle<Attachment.DescriptionProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p {...rest} data-slot=\"description\" mix={[truncate(), fg(\"neutral.muted\"), text(\"xs\"), mix]}>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * The card's action row, shrink-proof so a narrow card's width is absorbed by\n * {@link Attachment.Content}'s own truncation while the actions keep their\n * size.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Attachment.Actions>\n * \t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t<Attachment.Action aria-label={t(\"attachment.remove\")}><XIcon /></Attachment.Action>\n * </Attachment.Actions>\n */\nAttachment.Actions = function AttachmentActions(handle: Handle<Attachment.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"actions\" mix={[flex(), shrink(0), items(\"center\"), gap(1), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A single card action as a {@link Button}, defaulting to a compact, `\"ghost\"`,\n * neutral control so a row of actions reads as secondary to the card's title.\n * Every {@link Button} prop stays available, `type` included.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the action's markup.\n * @example\n * <Attachment.Action aria-label={t(\"attachment.download\")}>\n * \t<DownloadIcon />\n * </Attachment.Action>\n * @example\n * <Attachment.Action type=\"submit\" name=\"intent\" value=\"retry\" aria-label={t(\"attachment.retry\")}>\n * \t<RotateCwIcon />\n * </Attachment.Action>\n */\nAttachment.Action = function AttachmentAction(handle: Handle<Attachment.ActionProps>) {\n\treturn () => {\n\t\tlet { color, variant, size, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tcolor={color ?? DEFAULT_ACTION_COLOR}\n\t\t\t\tvariant={variant ?? DEFAULT_ACTION_VARIANT}\n\t\t\t\tsize={size ?? DEFAULT_ACTION_SIZE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"action\"\n\t\t\t\tmix={[shrink(0), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * A wrapper `<div>` whose `href` or `commandfor` stays an inert attribute until\n * a consumer mixes in `attachmentTrigger()`. Either one also derives a `role`\n * and `tabIndex`, so whole-card activation is announced and keyboard-reachable.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the wrapper's markup.\n * @example\n * <Attachment.Trigger href=\"/files/quarterly-report.pdf\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">\n * \t\t<Attachment.Media><FileTextIcon aria-hidden /></Attachment.Media>\n * \t\t<Attachment.Content>\n * \t\t\t<Attachment.Title>quarterly-report.pdf</Attachment.Title>\n * \t\t</Attachment.Content>\n * \t\t<Attachment.Actions>\n * \t\t\t<Attachment.Action aria-label={t(\"attachment.download\")}><DownloadIcon /></Attachment.Action>\n * \t\t</Attachment.Actions>\n * \t</Attachment>\n * </Attachment.Trigger>\n * @example\n * <Attachment.Trigger commandfor=\"quarterly-report-preview\" mix={attachmentTrigger()}>\n * \t<Attachment state=\"done\">…</Attachment>\n * </Attachment.Trigger>\n * <Dialog id=\"quarterly-report-preview\">…</Dialog>\n */\nAttachment.Trigger = function AttachmentTrigger(handle: Handle<Attachment.TriggerProps>) {\n\treturn () => {\n\t\tlet { href, commandfor, command, target, role, tabIndex, children, mix, ...rest } =\n\t\t\thandle.props;\n\t\tlet isConfigured = href !== undefined || commandfor !== undefined;\n\t\tlet inferredRole = iife((): \"link\" | \"button\" | undefined => {\n\t\t\tif (href !== undefined) return \"link\";\n\t\t\tif (isConfigured) return \"button\";\n\t\t\treturn undefined;\n\t\t});\n\t\tlet resolvedRole = role ?? inferredRole;\n\t\tlet resolvedTabIndex = tabIndex ?? (isConfigured ? 0 : undefined);\n\n\t\tif (import.meta.env?.DEV && !isConfigured) {\n\t\t\tconsole.warn(\n\t\t\t\t'Attachment.Trigger: rendered with neither \"href\" nor \"commandfor\" — nothing will happen once `attachmentTrigger()` handles an activation.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\trole={resolvedRole}\n\t\t\t\ttabIndex={resolvedTabIndex}\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ href, commandfor, command, target }),\n\t\t\t\t\trelative(),\n\t\t\t\t\tblock(),\n\t\t\t\t\trounded(\"inherit\"),\n\t\t\t\t\twhen(\"&[role]:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&[role]:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * A horizontally scroll-snapping row of cards, faded at both inline edges to\n * hint at cards beyond the current view. The row itself carries the tab stop,\n * since the row is what scrolls.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Attachment.Group aria-label={t(\"thread.attachments\")}>\n * \t{attachments.map((attachment) => (\n * \t\t<Attachment key={attachment.id} state={attachment.state}>…</Attachment>\n * \t))}\n * </Attachment.Group>\n */\nAttachment.Group = function AttachmentGroup(handle: Handle<Attachment.GroupProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ tabIndex: DEFAULT_GROUP_TAB_INDEX }),\n\t\t\t\t\tflex(),\n\t\t\t\t\tgap(3),\n\t\t\t\t\toverflowX(\"auto\"),\n\t\t\t\t\traw({\n\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\tscrollSnapType: \"inline mandatory\",\n\t\t\t\t\t\tscrollPaddingInline: \"0.75rem\",\n\t\t\t\t\t\tscrollBehavior: \"auto\",\n\t\t\t\t\t}),\n\t\t\t\t\twhen(\"& > *\", [shrink(0), raw({ scrollSnapAlign: \"start\" })]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: no-preference)\", raw({ scrollBehavior: \"smooth\" })),\n\t\t\t\t\tscrollFade({ axis: \"inline\", size: GROUP_SCROLL_FADE_SIZE }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
13
13
  },
14
14
  "test": null
15
15
  }
@@ -18,7 +18,16 @@ https://sdxc.dev/docs/getting-started/the-sdxc-command.
18
18
  sdxc make <kind> <name> # write a file where the layout puts it, with its test
19
19
  sdxc make <kind> <name> --dry-run # print what it would write, and write nothing
20
20
  sdxc make model <name> [field...] # a model, the migration creating its table, and its factory
21
+ sdxc make secret <NAME> # declare bindings.secret() and append .env.example
22
+ sdxc make binding <kind> <NAME> # declare a Cloudflare binding in cloudflare.config.ts
23
+ sdxc make do <Name> [--role …] # Durable Object class, worker re-export and binding
21
24
  sdxc scaffold <name> [field:type] # model, migration, pages, tests and a feature .spec
25
+ sdxc setup # list installable features (auth, billing, flags)
26
+ sdxc setup auth [-y] # OIDC relying party; prints a plan unless -y writes it
27
+ sdxc fix # re-run command-shaped doctor repairs (typegen, ui, …)
28
+ sdxc fix env # append missing secrets to .env.example
29
+ sdxc fix models # register unmapped createModel modules
30
+ sdxc fix emails # map unmapped emails in the mail initializer
22
31
  sdxc ui add <component> # copy an @sdxc/ui component into the app to edit it
23
32
  sdxc routes --json # every route, its controller and the middleware it runs
24
33
  sdxc doctor --json # release drift, installs, secrets, migrations and wiring
@@ -40,7 +49,11 @@ bun run test # every test, under Vitest
40
49
  once. Controllers, commands and MCP tools also get a pairing `.spec` under `spec/` (pages use
41
50
  `browser`, API routes use `http`, commands use `cli`, MCP tools use `mcp`); `--no-spec` or
42
51
  `make.specs: false` skips it. `sdxc make email <name> field ...` takes fields as `make model`
43
- does; they become the email's props.
52
+ does; they become the email's props. Bindings and Durable Objects use `sdxc make secret`,
53
+ `sdxc make binding` and `sdxc make do` instead of hand-editing `cloudflare.config.ts`.
54
+ - Install a multi-file feature with `sdxc setup <feature>` (`auth`, `billing`, `flags`). Without
55
+ `-y` it prints the plan and writes nothing; `-y` applies it. Prefer `sdxc fix` over re-typing
56
+ a doctor finding's fix string when the repair is command-shaped, env, models or emails.
44
57
  - For a resource people list, show, create, edit and delete, start from
45
58
  `sdxc scaffold <name> title body:text` (`--mcp` and `--command` add its tools and commands, and
46
59
  one feature `.spec` mixes the surfaces the scaffold wrote).