@astryxdesign/cli 0.7.11 → 0.7.12-canary.0f28099

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 (115) hide show
  1. package/api/build/kit/rank.mjs +21 -4
  2. package/api/build/kit/words.d.mts +1 -0
  3. package/api/build/kit/words.mjs +1 -1
  4. package/api/component/__fixtures__/resolutions/modules.txt +2 -2
  5. package/api/docs/_adapter.d.mts +22 -0
  6. package/api/docs/_adapter.mjs +81 -3
  7. package/api/docs/docs.doc.mjs +5 -5
  8. package/api/docs/docs.type.d.mts +21 -0
  9. package/api/docs/docs.type.mjs +11 -0
  10. package/api/docs/list/list.d.mts +5 -1
  11. package/api/docs/list/list.mjs +72 -6
  12. package/api/docs/node/node.mjs +2 -40
  13. package/api/icon/_adapter.d.mts +3 -2
  14. package/api/icon/_adapter.mjs +8 -2
  15. package/api/icon/_authoring.d.mts +1 -0
  16. package/api/icon/_authoring.mjs +586 -66
  17. package/api/icon/_default-look.d.mts +155 -0
  18. package/api/icon/_default-look.mjs +474 -0
  19. package/api/icon/_records.d.mts +1 -1
  20. package/api/icon/_records.mjs +1 -0
  21. package/api/icon/add/add.mjs +224 -38
  22. package/api/icon/icon.type.d.mts +22 -2
  23. package/api/icon/icon.type.mjs +6 -2
  24. package/api/icon/iconAdd.doc.mjs +2 -2
  25. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  26. package/api/icon/iconNewSet.doc.mjs +4 -4
  27. package/api/icon/search/search.mjs +10 -9
  28. package/api/index.d.mts +1 -0
  29. package/api/index.mjs +1 -0
  30. package/api/integration/add-helpers.d.mts +11 -1
  31. package/api/integration/add-helpers.mjs +5 -2
  32. package/api/integration/authoring-checks.d.mts +0 -2
  33. package/api/integration/authoring-checks.mjs +1 -6
  34. package/api/logger.mjs +2 -1
  35. package/api/render/_adapter.mjs +9 -0
  36. package/api/render/render.doc.mjs +2 -2
  37. package/api/search/_adapter.d.mts +22 -1
  38. package/api/search/_adapter.mjs +37 -20
  39. package/api/search/exportSearchIndex.doc.d.mts +10 -0
  40. package/api/search/exportSearchIndex.doc.mjs +58 -0
  41. package/api/search/rankSearchIndex.doc.d.mts +10 -0
  42. package/api/search/rankSearchIndex.doc.mjs +79 -0
  43. package/api/search/search-index.d.mts +44 -0
  44. package/api/search/search-index.mjs +270 -0
  45. package/api/search/search.type.d.mts +28 -0
  46. package/api/search/search.type.mjs +17 -0
  47. package/api/swizzle/_adapter.d.mts +1 -0
  48. package/api/swizzle/_adapter.mjs +4 -1
  49. package/api/swizzle/_moduleGraph.d.mts +178 -0
  50. package/api/swizzle/_moduleGraph.mjs +903 -0
  51. package/api/swizzle/copy/copy.d.mts +2 -43
  52. package/api/swizzle/copy/copy.mjs +287 -315
  53. package/api/swizzle/swizzle.d.mts +0 -2
  54. package/api/swizzle/swizzle.doc.mjs +13 -4
  55. package/api/swizzle/swizzle.mjs +3 -7
  56. package/api/swizzle/swizzle.type.d.mts +7 -1
  57. package/api/swizzle/swizzle.type.mjs +4 -2
  58. package/assets/discover/official-packages.json +20 -0
  59. package/assets/docs/browser-support.doc.mjs +2 -2
  60. package/assets/docs/styling-overview.doc.mjs +4 -0
  61. package/assets/docs/tree/icon-sets.doc.mjs +11 -5
  62. package/assets/docs/tree/render-pages.doc.mjs +2 -2
  63. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
  64. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
  65. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
  66. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
  67. package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
  68. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  69. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  70. package/assets/templates/pages/course-detail/page.tsx +699 -0
  71. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  72. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  73. package/assets/templates/pages/table-filter/page.tsx +1 -0
  74. package/assets/templates/pages/table-grouped/page.tsx +160 -232
  75. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  76. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  77. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  78. package/assets/templates/themes/butter/butterTheme.ts +3 -2
  79. package/assets/templates/themes/stone/stoneTheme.ts +1 -1
  80. package/assets/templates/themes/y2k/y2kTheme.ts +1 -1
  81. package/authoring/doctypes/template/type.ts +1 -0
  82. package/clients/cli/commands/docs.doc.mjs +5 -1
  83. package/clients/cli/commands/docs.mjs +30 -2
  84. package/clients/cli/commands/experimental/icon.mjs +31 -10
  85. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  86. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  87. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  88. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  89. package/clients/cli/commands/swizzle.mjs +33 -9
  90. package/foundation/discovery/component-loader.d.mts +1 -1
  91. package/foundation/discovery/doc-types.mjs +9 -2
  92. package/foundation/discovery/icon-ranking.d.mts +27 -3
  93. package/foundation/discovery/icon-ranking.mjs +125 -8
  94. package/foundation/discovery/icon-set-checks.mjs +44 -35
  95. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  96. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  97. package/foundation/discovery/icon-set-writer.d.mts +238 -16
  98. package/foundation/discovery/icon-set-writer.mjs +676 -79
  99. package/foundation/discovery/module-exports.d.mts +3 -2
  100. package/foundation/discovery/module-exports.mjs +167 -37
  101. package/foundation/fs/paths.d.mts +2 -1
  102. package/foundation/fs/paths.mjs +3 -4
  103. package/foundation/render/charts.d.mts +59 -0
  104. package/foundation/render/charts.mjs +216 -0
  105. package/foundation/render/embedded-imports.d.mts +7 -7
  106. package/foundation/render/embedded-imports.mjs +63 -54
  107. package/foundation/render/page-worker.mjs +339 -52
  108. package/foundation/render/render-page.mjs +26 -10
  109. package/foundation/render/ts-paths.d.mts +63 -0
  110. package/foundation/render/ts-paths.mjs +138 -0
  111. package/foundation/response/error-codes.doc.mjs +2 -2
  112. package/foundation/response/error-codes.mjs +3 -2
  113. package/foundation/text/shell-arg.d.mts +14 -0
  114. package/foundation/text/shell-arg.mjs +17 -0
  115. package/package.json +7 -6
@@ -15,5 +15,3 @@ export function swizzle(component?: string, options?: {
15
15
  list?: boolean;
16
16
  overwrite?: boolean;
17
17
  }): Promise<import("./swizzle.type.mjs").SwizzleListResponse | import("./swizzle.type.mjs").SwizzleCopyResponse>;
18
- export { rewriteImports };
19
- import { rewriteImports } from './copy/copy.mjs';
@@ -17,8 +17,16 @@ export const doc = {
17
17
  description:
18
18
  "Ejects a component's source into the consumer project for deep customization. " +
19
19
  'It copies from the locally resolved @astryxdesign/core (or the owning integration) ' +
20
- 'package source, rewriting imports that escape the component directory to the owner ' +
21
- "package's subpaths and flagging whether any copied file uses StyleX. With no name " +
20
+ 'package source. Every import in the copy names a file the copy holds or a path ' +
21
+ 'the owner package exports: names the package exports are imported from its ' +
22
+ 'public paths, and every internal module the component needs is ' +
23
+ "copied beside it in the package's folder layout. Tests, stories and docs are not " +
24
+ 'copied. An output folder swizzle owns (one the copy creates, an empty one, or one it ' +
25
+ 'marked before) gets an astryx-swizzle.json marker naming each package its copies came from, ' +
26
+ "with its version, so @astryxdesign/build's Babel, PostCSS and Vite integrations, and " +
27
+ 'withAstryx() under webpack, compile the copy below the theme. The receipt flags whether ' +
28
+ 'any copied file uses StyleX and lists each npm package the copy imports with the range ' +
29
+ 'the owner package declares. With no name ' +
22
30
  '(or list) it returns the swizzlable component names instead. An integration ' +
23
31
  'component that replaces a Core component is what that Core name copies; ' +
24
32
  "options.package '@astryxdesign/core' copies the original. The list names Core " +
@@ -63,7 +71,8 @@ export const doc = {
63
71
  {
64
72
  name: 'options.overwrite',
65
73
  type: 'boolean',
66
- description: 'Overwrite existing files instead of erroring.',
74
+ description:
75
+ "Replace the component's existing files instead of erroring. A helper an earlier swizzle wrote is never replaced by a copy that carries it: a different one stays, and the new copy writes its own under a version-suffixed name. Swizzling the component whose folder holds that helper counts it as one of that component's own files. A changed private attribute owner module, or a style module it imports, throws ERR_FILE_EXISTS without overwrite and is replaced with it.",
67
76
  default: 'false',
68
77
  },
69
78
  ],
@@ -76,7 +85,7 @@ export const doc = {
76
85
  {
77
86
  type: 'swizzle.copy',
78
87
  description:
79
- 'A receipt after copying the component into the project: the component name, owning package, output directory, files-copied count, the copied file names (relative to the component folder, including the private attribute owner modules and their unexported style modules copied beside it, e.g. `../privateAttributes/press.stylex.ts`), whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling.',
88
+ 'A receipt after copying the component into the project: the component name, owning package, output directory, files-copied count, the copied file names (relative to the component folder; the internal modules copied beside it start with `../`, e.g. `../InputGroup/groupStyles.ts`), whether any file uses StyleX, the npm packages the copy imports with the ranges the owner declares (dependencies), the output folder\'s astryx-swizzle.json (marker: {path, written, found?}; written is false for a folder swizzle does not own, and found names up to five entries it already holds), and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling.',
80
89
  },
81
90
  ],
82
91
  throws: [
@@ -9,16 +9,12 @@
9
9
  * - a component name -> api/swizzle/copy -> `swizzle.copy` receipt
10
10
  *
11
11
  * Errors throw AstryxError (stable code + suggestions). All human prose /
12
- * package-manager prefixing lives in the CLI renderer. Re-exports the copy
13
- * leaf's `rewriteImports` so existing importers keep this module as their entry
14
- * point (api/index.mjs, the CLI command, and the unit tests all import from
15
- * here).
12
+ * package-manager prefixing lives in the CLI renderer. api/index.mjs, the CLI
13
+ * command, and the unit tests import `swizzle` from here.
16
14
  */
17
15
 
18
16
  import {swizzleList} from './list/list.mjs';
19
- import {swizzleCopy, rewriteImports} from './copy/copy.mjs';
20
-
21
- export {rewriteImports};
17
+ import {swizzleCopy} from './copy/copy.mjs';
22
18
 
23
19
  /**
24
20
  * List swizzlable components, or copy one component's source for customization.
@@ -41,6 +41,12 @@ export type SwizzleCopyResponse = {
41
41
  filesCopied: number;
42
42
  files: string[];
43
43
  usesStyleX: boolean;
44
+ dependencies: Record<string, string>;
45
+ marker?: {
46
+ path: string;
47
+ written: boolean;
48
+ found?: string[];
49
+ } | undefined;
44
50
  feedback?: SwizzleFeedback | undefined;
45
51
  };
46
52
  };
@@ -62,7 +68,7 @@ export type SwizzleOptions = {
62
68
  */
63
69
  list?: boolean | undefined;
64
70
  /**
65
- * Overwrite existing files instead of erroring.
71
+ * Replace the component's existing files instead of erroring. A copy that carries a helper an earlier swizzle wrote never replaces it, except a changed private attribute owner module and the style modules it imports; swizzling the component whose folder holds the helper counts it as that component's own file.
66
72
  */
67
73
  overwrite?: boolean | undefined;
68
74
  };
@@ -34,8 +34,10 @@
34
34
  * @property {string} data.package Owner package the component source was copied from.
35
35
  * @property {string} data.outputDir
36
36
  * @property {number} data.filesCopied
37
- * @property {string[]} data.files Copied file names, relative to the component folder; owner modules and their unexported style modules copied beside it start with `../` (spec:AST-110 FR4).
37
+ * @property {string[]} data.files Copied file names, relative to the component folder; the internal modules copied beside it start with `../` (spec:AST-110 FR2).
38
38
  * @property {boolean} data.usesStyleX Whether any copied file uses StyleX (requires build-time setup).
39
+ * @property {Record<string, string>} data.dependencies Each npm package the copied files import, other than the owner package, with the version range the owner package declares (`*` when it declares none). The copy builds once the product installs them (spec:AST-110 FR1).
40
+ * @property {{path: string, written: boolean, found?: string[]}} [data.marker] The output folder's astryx-swizzle.json, relative to the project (spec:AST-110 FR5). Swizzle writes it only into a folder it owns: one the copy creates, an empty one, or one it marked before. When it does not, `written` is false and `found` names up to five entries already in the folder.
39
41
  * @property {SwizzleFeedback} [data.feedback]
40
42
  */
41
43
 
@@ -46,7 +48,7 @@
46
48
  * @property {string} [output] Output directory (must resolve inside cwd). Defaults to ./components/astryx.
47
49
  * @property {string} [package] Scope to a specific owning package when a name is ambiguous.
48
50
  * @property {boolean} [list] Force the list response even with a component argument.
49
- * @property {boolean} [overwrite] Overwrite existing files instead of erroring.
51
+ * @property {boolean} [overwrite] Replace the component's existing files instead of erroring. A copy that carries a helper an earlier swizzle wrote never replaces it, except a changed private attribute owner module and the style modules it imports; swizzling the component whose folder holds the helper counts it as that component's own file.
50
52
  */
51
53
 
52
54
  export {};
@@ -180,6 +180,14 @@
180
180
  "kind": "component",
181
181
  "name": "SVGIcon"
182
182
  },
183
+ {
184
+ "kind": "component",
185
+ "name": "TabBar"
186
+ },
187
+ {
188
+ "kind": "component",
189
+ "name": "TabBarItem"
190
+ },
183
191
  {
184
192
  "kind": "component",
185
193
  "name": "ThreeDBar"
@@ -283,6 +291,18 @@
283
291
  "kind": "component",
284
292
  "name": "RichTextEditor"
285
293
  },
294
+ {
295
+ "kind": "component",
296
+ "name": "RichTextEditorAutoLinkPlugin"
297
+ },
298
+ {
299
+ "kind": "component",
300
+ "name": "RichTextEditorToolbar"
301
+ },
302
+ {
303
+ "kind": "component",
304
+ "name": "RichTextView"
305
+ },
286
306
  {
287
307
  "kind": "template",
288
308
  "name": "RichTextEditorShowcase"
@@ -148,11 +148,11 @@ export const docs = {
148
148
  content: [
149
149
  {
150
150
  type: 'prose',
151
- text: "On a phone, a fully expanded `height='tall'` BottomSheet responds to the on-screen keyboard: it measures the keyboard as the layout viewport's height minus the visual viewport's height times its scale. Where the visual viewport shrinks for the keyboard, as in Safari on iOS in the browser and as a home-screen app, in Firefox for Android and in Chrome on Android, it keeps the focused field above the keyboard and leaves the page where it was. If Firefox for Android pans to the field, the sheet puts the page back within a couple of frames.",
151
+ text: "On a phone, the components that respond to the on-screen keyboard, a fully expanded `height='tall'` BottomSheet and ChatLayout's composer, measure it the same way: the layout viewport's height minus the visual viewport's height times its scale. Where the visual viewport shrinks for the keyboard, as in Safari on iOS in the browser and as a home-screen app, in Firefox for Android and in Chrome on Android, they keep the focused field and the surface around it above the keyboard and leave the page where it was. If Firefox for Android pans to the field, they put the page back within a couple of frames.",
152
152
  },
153
153
  {
154
154
  type: 'prose',
155
- text: 'In Chrome on Android, a Tall BottomSheet\u2019s focused field rides the keyboard as Gboard slides it up, and as Gboard slides it down after the field loses focus. The scroll room stays until the keyboard is down. A hide Chrome reports late, such as Back, which keeps the focus, rides down from Chrome\u2019s report. When the keyboard is reported, the sheet places the field just above it in that same frame, so Chrome has no covered field to pan to; if Chrome pans anyway, the sheet puts the page back when that pan ends. Chrome follows your viewport setting, which Astryx documents and never sets: your app owns its viewport `<meta>` element. By default (`interactive-widget=resizes-visual`) Chrome lays the keyboard over the page and pans to a focused field elsewhere on the page. With `interactive-widget=resizes-content` it shrinks the layout viewport instead, so content anchored to the bottom sits above the keyboard, and the sheet measures no keyboard and changes nothing: the browser has already made the room.',
155
+ text: 'In Chrome on Android, ChatLayout\u2019s composer rides the keyboard as Gboard slides it up and down. A Tall BottomSheet\u2019s focused field rides the keyboard as Gboard slides it up, and as Gboard slides it down after the field loses focus. The scroll room stays until the keyboard is down. A hide Chrome reports late, such as Back, which keeps the focus, rides down from Chrome\u2019s report. When the keyboard is reported, the sheet places the field just above it in that same frame, so Chrome has no covered field to pan to; if Chrome pans anyway, the sheet puts the page back when that pan ends. Chrome follows your viewport setting, which Astryx documents and never sets: your app owns its viewport `<meta>` element. By default (`interactive-widget=resizes-visual`) Chrome lays the keyboard over the page and pans to a focused field elsewhere on the page. With `interactive-widget=resizes-content` it shrinks the layout viewport instead, so content anchored to the bottom sits above the keyboard, and those components measure no keyboard and change nothing: the browser has already made the room.',
156
156
  },
157
157
  {
158
158
  type: 'code',
@@ -160,6 +160,10 @@ export const docs = {
160
160
  type: 'prose',
161
161
  text: 'If a swizzled component fails at runtime with a `stylex.create` error, the app is missing a StyleX compiler: see the StyleX Build Setup section of {@link generic:tokens-and-setup}.',
162
162
  },
163
+ {
164
+ type: 'prose',
165
+ text: '`{@command swizzle <Component>}` writes an `astryx-swizzle.json` marker into an output folder it owns (one the copy creates, an empty one, or one it marked before); every module under that folder then compiles as Astryx source, so keep copies in a folder of their own, such as the default `components/astryx`. For a folder that already holds other files it writes no marker and says how to add one by hand. With `@astryxdesign/build`\'s Babel, PostCSS and Vite integrations, or `withAstryx()` under webpack, a copy under that folder compiles into `astryx-base`, below `astryx-theme`, so theme component overrides reach it as they reach the package component. Under Turbopack, and with the stock StyleX plugins above, a copy\'s rules land in your own styles, above `astryx-theme`, and theme component overrides do not reach it.',
166
+ },
163
167
  ],
164
168
  },
165
169
  {
@@ -121,11 +121,11 @@ export const docs = {
121
121
  },
122
122
  {
123
123
  type: 'prose',
124
- text: "Every component the library exports becomes an icon (an alias of one component is recorded once), named `<Name>Icon`, with an id from its name (`Squares2X2Icon` is `squares-2x2`: a dimension stays one word). `map` is filled only where a definition's name is an icon's id (`delete` → icon `delete`), and the receipt lists those entries under Mapped by name: a library can draw another meaning under the same name (one library's `delete` is a backspace key), so check each. An icon whose id is only one of a definition's words (`trash` for `delete`) may mean something else in this library, so the receipt lists it under Suggestions, with the `experimental icon map <definition> <icon>` command for each, and writes nothing for it: check the meaning, then run the ones that fit. Run it again after a library release to refresh the icons that library supplies; `map` entries whose icon still exists are kept, and the receipt names any icon the library dropped, any icon `--exclude` left out, and the `map` entries each took with it. Icons you added from your own files or another library are left as they are. An icon you already have is known by the library export it re-exports, so it keeps its export name exactly, its `map` entries, variants, and words, even when a newer CLI spells its id differently or your `--exclude` lets a library prefix come off new ids; the receipt lists each changed id under `renamed`. A refresh with `--dry-run` writes nothing and prints the Mapped by name and Suggestions lists again; `--display-name` and `--description` on a refresh rewrite the descriptor. Variants added with `add --variant … --all` are kept too; run that `add` again to pick up icons the release added. `experimental icon --list` shows how many definitions the set maps.",
124
+ text: "Every component the library exports becomes an icon (an alias of one component is recorded once), named `<Name>Icon`, with an id from its name (`Squares2X2Icon` is `squares-2x2`: a dimension stays one word). `map` is filled only where a definition's name is an icon's id (`delete` → icon `delete`), and the receipt lists those entries under Mapped by name: a library can draw another meaning under the same name (one library's `delete` is a backspace key), so check each. An icon whose id is only one of a definition's words (`trash` for `delete`) may mean something else in this library, so the receipt lists it under Suggestions, with the `experimental icon map <definition> <icon>` command for each, and writes nothing for it: check the meaning, then run the ones that fit. Run it again after a library release to refresh the icons that library supplies; `map` entries whose icon still exists are kept, and the receipt names any icon the library dropped, any icon `--exclude` left out, and the `map` entries each took with it. Icons you added from your own files or another library are left as they are. Icons you added one file at a time from the same package (`--from <package>/dist/XIcon`) move to the root import when you refresh from the package root and the root exports the same icon; each keeps its id, export, `map` entries, variants, and words on that refresh and every later one, and the receipt lists it under `moved`. A library icon whose id or name a moved icon already has is left out. When another icon of the set already reads the same root export, the icon stays on its own file, and the receipt says why. An icon you already have is known by the library export it re-exports, so it keeps its export name exactly, its `map` entries, variants, and words, even when a newer CLI spells its id differently or your `--exclude` lets a library prefix come off new ids; the receipt lists each changed id under `renamed`. An id you chose that is not a spelling of the library name (`dismiss` for `XIcon`) is kept. A refresh with `--dry-run` writes nothing and prints the Mapped by name and Suggestions lists again; `--display-name` and `--description` on a refresh rewrite the descriptor. Variants added with `add --variant … --all` are kept too; run that `add` again to pick up icons the release added. `experimental icon --list` shows how many definitions the set maps.",
125
125
  },
126
126
  {
127
127
  type: 'prose',
128
- text: "With a package or package subpath, it also records the installed library and version as the data file's `source`, so `integration check` warns when your dependency moves to another version; copies the library's LICENSE (and NOTICE) files into the set directory; and sets the descriptor's `license` to the library's. A set you started without `--from` gets the same the first time a refresh records its source, unless you already changed `license`: a `license` you set is kept (the receipt names the library's), and every later refresh keeps it too. Your package.json `license` is never changed. Edit `license` when the artwork's license differs from the library's package license.",
128
+ text: "With a package or package subpath, it also records the installed library and version as the data file's `source`, so `integration check` warns when your dependency moves to another version; copies the library's LICENSE (and NOTICE) files into the set directory; and sets the descriptor's `license` to the library's. A set you started without `--from` gets the same the first time a refresh records its source, unless you already changed `license`: a `license` you set is kept (the receipt names the library's), and every later refresh keeps it too. Your package.json `license` is never changed. Edit `license` when the artwork's license differs from the library's package license. When the library ships no license file to copy, the receipt says so under `licenseNoticeMissing` and in its notes, and the CLI writes nothing: add a `NOTICE` file to the set directory (`icon-sets/<set>/NOTICE`) that names the library, its version, and its license. `integration check` accepts a file named `LICENSE`, `LICENCE`, `NOTICE`, or `COPYING`, in any case and with an optional suffix such as `NOTICE.md` or `LICENSE-MIT`, in the set directory or the package root; without one it reports `icon_license_notice_missing`.",
129
129
  },
130
130
  {
131
131
  type: 'prose',
@@ -139,7 +139,7 @@ astryx experimental icon add --variant solid --from @heroicons/react/24/solid --
139
139
  },
140
140
  {
141
141
  type: 'prose',
142
- text: "A library that redraws its artwork for small sizes (Heroicons' 20px mini and 16px micro) ships each of those as its own set in its own package (their export names match the 24px ones), not as variants: a variant's size comes from CSS. `--variants` lists the variants; `--default-variant` names the one each icon's own export draws (the first variant when omitted). `--all` adds the variant for every icon whose id an export of `--from` has (`TrashIcon` in the solid module becomes `TrashSolidIcon`, the solid variant of `trash`), and the receipt lists the icons the module has no export for. Running it again changes nothing.",
142
+ text: "A library that redraws its artwork for small sizes (Heroicons' 20px mini and 16px micro) ships each of those as its own set in its own package (their export names match the 24px ones), not as variants: a variant's size comes from CSS. `--variants` lists the variants; `--default-variant` names the one each icon's own export draws (when omitted, the look a library that names its looks draws; otherwise the set's current default, else, on a set without icons, the first variant; a set with icons changes it only with `--from`, and only in a library that names its looks). `--all` adds the variant for every icon whose id an export of `--from` has (`TrashIcon` in the solid module becomes `TrashSolidIcon`, the solid variant of `trash`), and the receipt lists the icons the module has no export for. Running it again changes nothing.",
143
143
  },
144
144
  {
145
145
  type: 'prose',
@@ -177,7 +177,7 @@ astryx experimental icon add --variant solid --from @heroicons/react/24/solid --
177
177
  },
178
178
  {
179
179
  type: 'prose',
180
- text: "An optional render test you can copy. Save it inside your package directory and run it there, since it imports your package by name through its `exports`, and install `react-dom` first (`npm install -D react-dom`). A library may add its own classes beside yours, so it checks the class list. A library that sets `width` and `height` attributes (24, say) still fills its box: CSS sizing, such as the `Icon` component's, overrides SVG size attributes.",
180
+ text: 'An optional render test you can copy. Save it inside your package directory and run it there, since it imports your package by name through its `exports`, and install `react-dom` first (`npm install -D react-dom`). A library may add its own classes beside yours, so it checks the class list. A component that writes its own `width` and `height` attributes (24, from a `size` prop, say) still fills its box when it passes `style` through to its svg: the `Icon` component and `themeIcons` size the svg with CSS, which overrides size attributes. The test checks that too.',
181
181
  },
182
182
  {
183
183
  type: 'code',
@@ -191,6 +191,8 @@ for (const [name, Icon] of Object.entries(icons)) {
191
191
  const html = renderToStaticMarkup(createElement(Icon, {className: 'x'}));
192
192
  if (!/class="([^"]* )?x( [^"]*)?"/.test(html)) throw new Error(\`\${name} drops className\`);
193
193
  if (!html.includes('currentColor')) throw new Error(\`\${name} has a fixed color\`);
194
+ const styled = renderToStaticMarkup(createElement(Icon, {style: {width: '1em'}}));
195
+ if (!styled.includes('width:1em')) throw new Error(\`\${name} drops style, so CSS cannot size it\`);
194
196
  }`,
195
197
  },
196
198
  ],
@@ -215,6 +217,10 @@ for (const [name, Icon] of Object.entries(icons)) {
215
217
  'A subpath per style',
216
218
  '`experimental icon add --variant solid --from @acme/glyph-library/solid --all` for every icon at once, or `experimental icon add Bin --from @acme/glyph-library/solid --id bin --variant solid` for one (the set must declare the variant: `new-set --variants`)',
217
219
  ],
220
+ [
221
+ 'Every look in its export names (`XOutline24WGHT500Icon`, `XFilled24WGHT500Icon`)',
222
+ "`experimental icon new-set meta --from @acme/vector-icons` wraps each glyph once as `x` (`XIcon`), in the look `--default-variant` names or the library's usual default (outline, the middle weight). For another look: `experimental icon new-set meta --variants outline,filled` declares it in place, then `experimental icon add --variant filled --from @acme/vector-icons --all`",
223
+ ],
218
224
  [
219
225
  'One file per icon, default export',
220
226
  '`experimental icon add Rocket --from @acme/glyph-library/rocket --default --definition rocket`',
@@ -262,7 +268,7 @@ export function adapt(data) {
262
268
  content: [
263
269
  {
264
270
  type: 'prose',
265
- text: 'The generated module also exports `themeIcons`: one entry per built-in definition in `map`, each an element of your own icon, hidden from assistive technology and sized `1em`. The CLI rewrites it on every `experimental icon add` and `experimental icon map`, so you never write it by hand, and `integration check` proves it matches `map`. A theme uses it in one line:',
271
+ text: "The generated module also exports `themeIcons`: one entry per built-in definition in `map`, each an element of your own icon, hidden from assistive technology and sized `1em` by its attributes and by CSS (its `style`), so it fills the theme's icon box even when your component writes its own size attributes. The CLI rewrites it on every `experimental icon add` and `experimental icon map`, so you never write it by hand, and `integration check` proves it matches `map`. A theme uses it in one line:",
266
272
  },
267
273
  {
268
274
  type: 'code',
@@ -57,7 +57,7 @@ export const docs = {
57
57
  },
58
58
  {
59
59
  type: 'prose',
60
- text: 'What it cannot keep: anything that needs a browser while running. State, effects, click handlers and data loaded after the first paint are gone, and a chart sized by its container is empty, so give charts a fixed size. Read browser-only values such as window inside an effect, or the render stops with ERR_RENDER_BROWSER_API.',
60
+ text: 'What it cannot keep: anything that needs a browser while running. State, effects, click handlers and data loaded after the first paint are gone. Charts made with recharts are the exception: the render draws each chart and ResponsiveContainer a module of the page (not an installed package) imports from recharts by name (`import {LineChart} from \'recharts\'`), inside the page, so a custom tick, label or shape sees the page\'s React context. A chart sized by its container scales to the width the page gives it, and its legend stays out of the picture: a horizontal legend takes its own row under it (above it when the legend asks for the top), and a vertical legend on one side sits beside it, on that side; in a chart of fixed size, a legend keeps the place its props give it. Charts show the data and props of the page\'s first render, before its effects run: when the page cannot be drawn again without a browser, or its effects change its charts or re-render the component that makes them, each chart is drawn by itself and its parts see React context defaults. A value a chart\'s parts read from a React context that an effect changes may still show its later value. A `chart-size` warning counts the charts the render cannot draw (one used through `import * as R`, say), and says when charts were drawn by themselves. Read browser-only values such as window inside an effect, or the render stops with ERR_RENDER_BROWSER_API.',
61
61
  },
62
62
  ],
63
63
  },
@@ -86,7 +86,7 @@ export const docs = {
86
86
  },
87
87
  {
88
88
  type: 'prose',
89
- text: 'It writes the page, the modules, stylesheets and JSON files the page reaches through its own imports, and the images, fonts and media the render carried (however the page named them, as long as their bytes really are one): each goes where the page\'s relative imports find it from wherever you put the page, and a file the page imports through a path alias (`@/components/Header`) goes where your project\'s `tsconfig.json` or `jsconfig.json` alias points. Every file but the page goes inside the one new folder the restore creates (the topmost folder on the page\'s path that does not exist yet), never into a folder that already exists: a page that imports other files comes back into a new folder (`--out restored/app/page.tsx`), and a file it imports through a path alias comes back only when that alias points inside the new folder. Nor does it write a file that a test, story or benchmark runner would run by its default patterns (Jest, Vitest, Bun, AVA, Playwright, Storybook, Cypress and `node --test`: names such as `*.test.*`, `*.spec.*`, `*_test.*`, `*-test.*`, `*.bench.*`, `*.stories.*`, `*.cy.*`, and anything under `test/`, `tests/` or `__tests__/`), judged from the repository root (every folder above the file up to it), else the topmost folder with a package.json. Restored files are the sender\'s code: read them before you run or import them. Without `--out`, everything comes back into a new folder beside the HTML file, named after it (`page.html` comes back into `page-restored/`). A received file that carries anything else (a file the page never imports, a dotfile, `package.json`, a tool configuration, a path that leaves the folder) is refused with nothing written. An existing file is never replaced unless you pass `--overwrite`, and the refusal names every one; a generated, vendored or ignored file, and any path through a symbolic link, is not written even then. Add `--json` for the result as data: what was written, how big it is, and every warning.',
89
+ text: 'It writes the page, the modules, stylesheets and JSON files the page reaches through its own imports, and the images, fonts and media the render carried (however the page named them, as long as their bytes really are one): each goes where the page\'s relative imports find it from wherever you put the page, and a file the page imports through a path alias (`@/components/Header`) goes where your project\'s `tsconfig.json` or `jsconfig.json` alias points. Every file but the page goes inside the one new folder the restore creates (the topmost folder on the page\'s path that does not exist yet), never into a folder that already exists: a page that imports other files comes back into a new folder (`--out restored/app/page.tsx`), and a file it imports through a path alias comes back only when that alias points inside the new folder. Nor does it write a file that a test, story or benchmark runner would run by its default patterns (Jest, Vitest, Bun, AVA, Playwright, Storybook, Cypress and `node --test`: names such as `*.test.*`, `*.spec.*`, `*_test.*`, `*-test.*`, `*.bench.*`, `*.stories.*`, `*.cy.*`, and anything under `test/`, `tests/` or `__tests__/`), judged from the repository root (every folder above the file up to it), else the topmost folder with a package.json. Restored files are the sender\'s code: read them before you run or import them. Without `--out`, everything comes back into a new folder beside the HTML file, named after it (`page.html` comes back into `page-restored/`). A received file that carries anything else (a file the page never imports, a dotfile, `package.json`, a tool configuration, a path that leaves the folder) is refused with nothing written. A rendered file that lost its embedded source on the way (a sanitizer or an editor strips `<script>` blocks) and has no Astryx components to rebuild from is refused with `ERR_RENDER_SOURCE_DAMAGED`. An existing file is never replaced unless you pass `--overwrite`, and the refusal names every one; a generated, vendored or ignored file, and any path through a symbolic link, is not written even then. Add `--json` for the result as data: what was written, how big it is, and every warning.',
90
90
  },
91
91
  ],
92
92
  },
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'useCalendarConstraints',
7
+ name: 'useCalendarConstraints — Hotel Booking Range',
8
+ displayName: 'useCalendarConstraints — Hotel Booking Range',
9
+ description:
10
+ 'A hotel booking range picker enforcing season min/max dates, a 7-night maximum stay once check-in is picked, and a custom rule disabling closed Mondays.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: ['Button', 'Layout', 'Text'],
14
+ };
@@ -0,0 +1,146 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {
7
+ useCalendarConstraints,
8
+ useCalendarDays,
9
+ type CalendarDay,
10
+ } from '@astryxdesign/core/Calendar';
11
+ import {Button} from '@astryxdesign/core/Button';
12
+ import {HStack, VStack} from '@astryxdesign/core/Layout';
13
+ import {Text} from '@astryxdesign/core/Text';
14
+
15
+ // Hotel closed on Mondays (day === 1)
16
+ const isNotMonday = (date: Date) => date.getDay() !== 1;
17
+
18
+ export default function UseCalendarConstraintsHookUsage() {
19
+ const [checkIn, setCheckIn] = useState<CalendarDay['date'] | null>(null);
20
+ const [checkOut, setCheckOut] = useState<CalendarDay['date'] | null>(null);
21
+
22
+ // June 2026 season: open Jun 5 – Jun 25, max 7 nights (8-day span), closed Mondays.
23
+ // When checkOut is already chosen, clear rangeAnchor so full season remains viewable without lingering span restrictions.
24
+ const {isDateDisabled} = useCalendarConstraints({
25
+ min: '2026-06-05',
26
+ max: '2026-06-25',
27
+ maxRangeSpan: 8,
28
+ rangeAnchor: checkOut ? null : checkIn,
29
+ dateConstraints: [isNotMonday],
30
+ });
31
+
32
+ const {weeks, dayNames} = useCalendarDays({
33
+ year: 2026,
34
+ month: 6,
35
+ weekStartsOn: 0,
36
+ hasVariableRowCount: true,
37
+ });
38
+
39
+ const handleSelect = (day: CalendarDay) => {
40
+ if (day.isOutside || isDateDisabled(day.date)) {
41
+ return;
42
+ }
43
+ // If no check-in yet, or already booked, or clicking on/before current check-in: start new check-in
44
+ if (!checkIn || checkOut || day.date.day <= checkIn.day) {
45
+ setCheckIn(day.date);
46
+ setCheckOut(null);
47
+ } else {
48
+ // Pick is after checkIn: set as check-out
49
+ setCheckOut(day.date);
50
+ }
51
+ };
52
+
53
+ const handleReset = () => {
54
+ setCheckIn(null);
55
+ setCheckOut(null);
56
+ };
57
+
58
+ return (
59
+ <VStack gap={3}>
60
+ <VStack gap={1}>
61
+ <Text type="body" weight="bold">
62
+ Hotel Booking — June 2026
63
+ </Text>
64
+ <Text type="supporting" color="secondary">
65
+ Season: Jun 5 – Jun 25 · Max stay: 7 nights · Closed Mondays
66
+ </Text>
67
+ </VStack>
68
+ <HStack gap={2} vAlign="center">
69
+ <Text type="supporting">
70
+ {checkIn
71
+ ? checkOut
72
+ ? `Booked: Jun ${checkIn.day} – Jun ${checkOut.day}`
73
+ : `Check-in: Jun ${checkIn.day} (pick check-out)`
74
+ : 'Pick a check-in date'}
75
+ </Text>
76
+ {checkIn && (
77
+ <Button
78
+ label="Reset"
79
+ size="sm"
80
+ variant="secondary"
81
+ onClick={handleReset}
82
+ />
83
+ )}
84
+ </HStack>
85
+ <table style={{tableLayout: 'fixed', width: 280}}>
86
+ <thead>
87
+ <tr>
88
+ {dayNames.map((name, i) => (
89
+ <th key={i} scope="col">
90
+ <Text type="supporting" color="secondary">
91
+ {name}
92
+ </Text>
93
+ </th>
94
+ ))}
95
+ </tr>
96
+ </thead>
97
+ <tbody>
98
+ {weeks.map(week => (
99
+ <tr key={week[0].iso}>
100
+ {week.map(day => {
101
+ if (day.isOutside) {
102
+ return <td key={day.iso} align="center" />;
103
+ }
104
+
105
+ const disabled = isDateDisabled(day.date);
106
+ const isSelected =
107
+ (checkIn &&
108
+ checkIn.day === day.date.day &&
109
+ checkIn.month === day.date.month) ||
110
+ (checkOut &&
111
+ checkOut.day === day.date.day &&
112
+ checkOut.month === day.date.month);
113
+
114
+ return (
115
+ <td key={day.iso} align="center">
116
+ <button
117
+ type="button"
118
+ disabled={disabled}
119
+ onClick={() => handleSelect(day)}
120
+ aria-pressed={isSelected ? 'true' : 'false'}
121
+ aria-label={`June ${day.dayNumber}`}
122
+ style={{
123
+ width: 32,
124
+ height: 32,
125
+ borderRadius: 6,
126
+ border: isSelected ? '1px solid currentColor' : 'none',
127
+ background: 'transparent',
128
+ opacity: disabled ? 0.35 : 1,
129
+ cursor: disabled ? 'not-allowed' : 'pointer',
130
+ }}>
131
+ <Text
132
+ type="body"
133
+ color={disabled ? 'secondary' : 'primary'}>
134
+ {day.dayNumber}
135
+ </Text>
136
+ </button>
137
+ </td>
138
+ );
139
+ })}
140
+ </tr>
141
+ ))}
142
+ </tbody>
143
+ </table>
144
+ </VStack>
145
+ );
146
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'useCalendarNavigation',
7
+ name: 'useCalendarNavigation — Month Pager',
8
+ displayName: 'useCalendarNavigation — Month Pager',
9
+ description:
10
+ 'A calendar month pager with previous/next navigation buttons, localized month-year label, and cross-month arrow key navigation using pendingFocus.',
11
+ isReady: true,
12
+ aspectRatio: 4 / 3,
13
+ componentsUsed: ['Button', 'Layout', 'Text'],
14
+ };
@@ -0,0 +1,173 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useEffect, useRef, useState} from 'react';
6
+ import {
7
+ useCalendarDays,
8
+ useCalendarNavigation,
9
+ type CalendarDay,
10
+ type ISODateString,
11
+ } from '@astryxdesign/core/Calendar';
12
+ import {Button} from '@astryxdesign/core/Button';
13
+ import {HStack, VStack} from '@astryxdesign/core/Layout';
14
+ import {Text} from '@astryxdesign/core/Text';
15
+
16
+ export default function UseCalendarNavigationHookUsage() {
17
+ const [focusDate, setFocusDate] = useState<ISODateString>(
18
+ '2026-06-01' as ISODateString,
19
+ );
20
+
21
+ const {
22
+ monthYearLabel,
23
+ visibleCalendarMonths,
24
+ navigateMonth,
25
+ pendingFocus,
26
+ clearPendingFocus,
27
+ } = useCalendarNavigation({
28
+ focusDate,
29
+ onFocusDateChange: setFocusDate,
30
+ numberOfMonths: 1,
31
+ });
32
+
33
+ const {weeks, dayNames} = useCalendarDays({
34
+ ...visibleCalendarMonths[0],
35
+ weekStartsOn: 0,
36
+ hasVariableRowCount: true,
37
+ });
38
+
39
+ const dayButtonRefs = useRef<Map<string, HTMLButtonElement>>(new Map());
40
+
41
+ // Move focus to target date when navigating across month boundaries
42
+ useEffect(() => {
43
+ if (pendingFocus) {
44
+ const el = dayButtonRefs.current.get(pendingFocus);
45
+ if (el) {
46
+ el.focus();
47
+ clearPendingFocus();
48
+ }
49
+ }
50
+ }, [pendingFocus, clearPendingFocus, weeks]);
51
+
52
+ // Arrow key navigation moving across days and month boundaries with RTL awareness (DR6, DR11)
53
+ const handleKeyDown = (
54
+ e: React.KeyboardEvent<HTMLButtonElement>,
55
+ day: CalendarDay,
56
+ ) => {
57
+ if (day.isOutside) {
58
+ return;
59
+ }
60
+
61
+ const isRtl =
62
+ typeof window !== 'undefined' &&
63
+ getComputedStyle(e.currentTarget).direction === 'rtl';
64
+
65
+ const isNext = isRtl ? e.key === 'ArrowLeft' : e.key === 'ArrowRight';
66
+ const isPrev = isRtl ? e.key === 'ArrowRight' : e.key === 'ArrowLeft';
67
+
68
+ if (isNext) {
69
+ e.preventDefault();
70
+ const inMonthDays = weeks.flatMap(w => w.filter(d => !d.isOutside));
71
+ const currentIndex = inMonthDays.findIndex(d => d.iso === day.iso);
72
+ if (currentIndex === inMonthDays.length - 1) {
73
+ // Last day of month: advance month and focus next day across boundary
74
+ navigateMonth(1, day.iso, 1);
75
+ } else {
76
+ const nextDay = inMonthDays[currentIndex + 1];
77
+ dayButtonRefs.current.get(nextDay.iso)?.focus();
78
+ }
79
+ } else if (isPrev) {
80
+ e.preventDefault();
81
+ const inMonthDays = weeks.flatMap(w => w.filter(d => !d.isOutside));
82
+ const currentIndex = inMonthDays.findIndex(d => d.iso === day.iso);
83
+ if (currentIndex === 0) {
84
+ // First day of month: step back month and focus previous day across boundary
85
+ navigateMonth(-1, day.iso, 1);
86
+ } else {
87
+ const prevDay = inMonthDays[currentIndex - 1];
88
+ dayButtonRefs.current.get(prevDay.iso)?.focus();
89
+ }
90
+ }
91
+ };
92
+
93
+ return (
94
+ <VStack gap={3} style={{width: 280}}>
95
+ <HStack gap={2} vAlign="center" hAlign="between">
96
+ <Button
97
+ label="Previous"
98
+ size="sm"
99
+ variant="secondary"
100
+ onClick={() => navigateMonth(-1)}
101
+ aria-label="Previous month"
102
+ />
103
+ <Text type="body" weight="bold">
104
+ {monthYearLabel}
105
+ </Text>
106
+ <Button
107
+ label="Next"
108
+ size="sm"
109
+ variant="secondary"
110
+ onClick={() => navigateMonth(1)}
111
+ aria-label="Next month"
112
+ />
113
+ </HStack>
114
+
115
+ <table style={{tableLayout: 'fixed', width: 280}}>
116
+ <thead>
117
+ <tr>
118
+ {dayNames.map((name, i) => (
119
+ <th key={i} scope="col">
120
+ <Text type="supporting" color="secondary">
121
+ {name}
122
+ </Text>
123
+ </th>
124
+ ))}
125
+ </tr>
126
+ </thead>
127
+ <tbody>
128
+ {weeks.map(week => (
129
+ <tr key={week[0].iso}>
130
+ {week.map(day => (
131
+ <td key={day.iso} align="center">
132
+ <button
133
+ type="button"
134
+ ref={el => {
135
+ if (el) {
136
+ dayButtonRefs.current.set(day.iso, el);
137
+ } else {
138
+ dayButtonRefs.current.delete(day.iso);
139
+ }
140
+ }}
141
+ disabled={day.isOutside}
142
+ aria-hidden={day.isOutside || undefined}
143
+ onKeyDown={e => handleKeyDown(e, day)}
144
+ aria-label={
145
+ day.isOutside
146
+ ? undefined
147
+ : `${monthYearLabel} ${day.dayNumber}`
148
+ }
149
+ tabIndex={day.isOutside ? -1 : 0}
150
+ style={{
151
+ width: 32,
152
+ height: 32,
153
+ borderRadius: 6,
154
+ border: 'none',
155
+ background: 'transparent',
156
+ opacity: day.isOutside ? 0.35 : 1,
157
+ cursor: day.isOutside ? 'not-allowed' : 'pointer',
158
+ }}>
159
+ <Text
160
+ type="body"
161
+ color={day.isOutside ? 'secondary' : 'primary'}>
162
+ {day.dayNumber}
163
+ </Text>
164
+ </button>
165
+ </td>
166
+ ))}
167
+ </tr>
168
+ ))}
169
+ </tbody>
170
+ </table>
171
+ </VStack>
172
+ );
173
+ }
@@ -74,6 +74,7 @@ function CouponField({statusVariant}: {statusVariant: FieldStatusPlacement}) {
74
74
  <div
75
75
  {...stylex.props(
76
76
  inputWrapperStyles.base,
77
+ inputWrapperStyles.textField,
77
78
  styles.field,
78
79
  status && inputStatusBorderStyles[status.type],
79
80
  )}>