@astryxdesign/cli 0.7.11 → 0.7.12-canary.0840fcc

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 (160) hide show
  1. package/api/build/blocks/blocks.d.mts +41 -0
  2. package/api/build/blocks/blocks.mjs +118 -68
  3. package/api/build/kit/rank.mjs +21 -4
  4. package/api/build/kit/words.d.mts +1 -0
  5. package/api/build/kit/words.mjs +1 -1
  6. package/api/component/__fixtures__/resolutions/modules.txt +5 -5
  7. package/api/docs/_adapter.d.mts +22 -0
  8. package/api/docs/_adapter.mjs +81 -3
  9. package/api/docs/docs.doc.mjs +5 -5
  10. package/api/docs/docs.type.d.mts +21 -0
  11. package/api/docs/docs.type.mjs +11 -0
  12. package/api/docs/list/list.d.mts +5 -1
  13. package/api/docs/list/list.mjs +72 -6
  14. package/api/docs/node/node.mjs +2 -40
  15. package/api/icon/_adapter.d.mts +3 -2
  16. package/api/icon/_adapter.mjs +8 -2
  17. package/api/icon/_authoring.d.mts +1 -0
  18. package/api/icon/_authoring.mjs +594 -67
  19. package/api/icon/_default-look.d.mts +155 -0
  20. package/api/icon/_default-look.mjs +474 -0
  21. package/api/icon/_records.d.mts +1 -1
  22. package/api/icon/_records.mjs +1 -0
  23. package/api/icon/add/add.mjs +269 -43
  24. package/api/icon/icon.type.d.mts +46 -2
  25. package/api/icon/icon.type.mjs +12 -2
  26. package/api/icon/iconAdd.doc.mjs +2 -2
  27. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  28. package/api/icon/iconNewSet.doc.mjs +4 -4
  29. package/api/icon/map/map.mjs +11 -4
  30. package/api/icon/search/search.mjs +10 -9
  31. package/api/index.d.mts +1 -0
  32. package/api/index.mjs +1 -0
  33. package/api/integration/add-helpers.d.mts +15 -1
  34. package/api/integration/add-helpers.mjs +5 -2
  35. package/api/integration/authoring-checks.d.mts +0 -2
  36. package/api/integration/authoring-checks.mjs +1 -6
  37. package/api/logger.mjs +2 -1
  38. package/api/render/_adapter.mjs +9 -0
  39. package/api/render/render.doc.mjs +3 -3
  40. package/api/render/render.type.d.mts +1 -1
  41. package/api/render/render.type.mjs +1 -1
  42. package/api/search/ORDERING.md +3 -0
  43. package/api/search/_adapter.d.mts +32 -3
  44. package/api/search/_adapter.mjs +50 -22
  45. package/api/search/_fit-order.d.mts +47 -0
  46. package/api/search/_fit-order.mjs +257 -0
  47. package/api/search/_main-searcher.mjs +15 -5
  48. package/api/search/exportSearchIndex.doc.d.mts +10 -0
  49. package/api/search/exportSearchIndex.doc.mjs +58 -0
  50. package/api/search/rankSearchIndex.doc.d.mts +10 -0
  51. package/api/search/rankSearchIndex.doc.mjs +79 -0
  52. package/api/search/search-index.d.mts +44 -0
  53. package/api/search/search-index.mjs +270 -0
  54. package/api/search/search.type.d.mts +28 -0
  55. package/api/search/search.type.mjs +17 -0
  56. package/api/swizzle/_adapter.d.mts +1 -0
  57. package/api/swizzle/_adapter.mjs +4 -1
  58. package/api/swizzle/_moduleGraph.d.mts +178 -0
  59. package/api/swizzle/_moduleGraph.mjs +903 -0
  60. package/api/swizzle/copy/copy.d.mts +2 -43
  61. package/api/swizzle/copy/copy.mjs +287 -315
  62. package/api/swizzle/swizzle.d.mts +0 -2
  63. package/api/swizzle/swizzle.doc.mjs +13 -4
  64. package/api/swizzle/swizzle.mjs +3 -7
  65. package/api/swizzle/swizzle.type.d.mts +7 -1
  66. package/api/swizzle/swizzle.type.mjs +4 -2
  67. package/api/template/template.mjs +1 -0
  68. package/assets/discover/official-packages.json +36 -0
  69. package/assets/docs/browser-support.doc.mjs +2 -2
  70. package/assets/docs/styling-overview.doc.mjs +6 -2
  71. package/assets/docs/tree/icon-sets.doc.mjs +13 -7
  72. package/assets/docs/tree/render-pages.doc.mjs +3 -3
  73. package/assets/docs/tree/tailwind.doc.mjs +41 -1
  74. package/assets/docs/tree/type-scale.doc.mjs +19 -2
  75. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
  76. package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
  77. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
  78. package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
  79. package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
  80. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.doc.mjs +14 -0
  81. package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.tsx +56 -0
  82. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.doc.mjs +2 -2
  83. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +66 -10
  84. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.doc.mjs +14 -0
  85. package/assets/templates/blocks/components/Link/useLinkifyHookUsage.tsx +39 -0
  86. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.doc.mjs +14 -0
  87. package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.tsx +83 -0
  88. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
  89. package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +41 -0
  90. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  91. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  92. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
  93. package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
  94. package/assets/templates/pages/course-detail/page.tsx +699 -0
  95. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  96. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  97. package/assets/templates/pages/table-filter/page.tsx +15 -23
  98. package/assets/templates/pages/table-grouped/page.tsx +160 -232
  99. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  100. package/assets/templates/pages/table-inbox/page.tsx +3 -6
  101. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  102. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  103. package/assets/templates/themes/butter/butterTheme.ts +2 -2
  104. package/assets/templates/themes/gothic/gothicTheme.ts +16 -0
  105. package/assets/templates/themes/matcha/matchaTheme.ts +1 -1
  106. package/assets/templates/themes/neutral/neutralTheme.ts +6 -0
  107. package/assets/templates/themes/stone/stoneTheme.ts +1 -1
  108. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
  109. package/assets/templates/themes/y2k/y2kTheme.ts +2 -2
  110. package/authoring/doctypes/template/type.ts +1 -0
  111. package/clients/cli/commands/docs.doc.mjs +5 -1
  112. package/clients/cli/commands/docs.mjs +30 -2
  113. package/clients/cli/commands/experimental/icon.mjs +56 -14
  114. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  115. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  116. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  117. package/clients/cli/commands/experimental-render.doc.mjs +1 -1
  118. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  119. package/clients/cli/commands/swizzle.mjs +33 -9
  120. package/clients/cli/lib/resolve-theme.mjs +16 -7
  121. package/foundation/discovery/component-loader.d.mts +1 -1
  122. package/foundation/discovery/doc-types.mjs +9 -2
  123. package/foundation/discovery/hook-discovery.mjs +31 -8
  124. package/foundation/discovery/icon-ranking.d.mts +27 -3
  125. package/foundation/discovery/icon-ranking.mjs +125 -8
  126. package/foundation/discovery/icon-set-checks.mjs +44 -35
  127. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  128. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  129. package/foundation/discovery/icon-set-writer.d.mts +258 -20
  130. package/foundation/discovery/icon-set-writer.mjs +785 -87
  131. package/foundation/discovery/module-exports.d.mts +3 -2
  132. package/foundation/discovery/module-exports.mjs +167 -37
  133. package/foundation/doc-compiler/import.d.mts +5 -1
  134. package/foundation/doc-compiler/import.mjs +40 -6
  135. package/foundation/fs/import-url.d.mts +20 -0
  136. package/foundation/fs/import-url.mjs +22 -0
  137. package/foundation/fs/module-loader.d.mts +24 -3
  138. package/foundation/fs/module-loader.mjs +69 -47
  139. package/foundation/fs/paths.d.mts +2 -1
  140. package/foundation/fs/paths.mjs +3 -4
  141. package/foundation/render/charts.d.mts +59 -0
  142. package/foundation/render/charts.mjs +216 -0
  143. package/foundation/render/embedded-imports.d.mts +7 -7
  144. package/foundation/render/embedded-imports.mjs +63 -54
  145. package/foundation/render/page-host.d.mts +4 -0
  146. package/foundation/render/page-host.mjs +45 -0
  147. package/foundation/render/page-worker.mjs +350 -57
  148. package/foundation/render/render-page.d.mts +11 -6
  149. package/foundation/render/render-page.mjs +164 -54
  150. package/foundation/render/ts-paths.d.mts +63 -0
  151. package/foundation/render/ts-paths.mjs +138 -0
  152. package/foundation/response/error-codes.doc.mjs +3 -3
  153. package/foundation/response/error-codes.mjs +3 -2
  154. package/foundation/text/levenshtein.d.mts +6 -1
  155. package/foundation/text/levenshtein.mjs +25 -9
  156. package/foundation/text/shell-arg.d.mts +14 -0
  157. package/foundation/text/shell-arg.mjs +17 -0
  158. package/foundation/text/suggest-order.d.mts +8 -1
  159. package/foundation/text/suggest-order.mjs +72 -6
  160. 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 {};
@@ -193,6 +193,7 @@ export async function template(name, options = {}) {
193
193
  `Unknown template "${name}"`,
194
194
  orderByAffinity(name, templates, t => [t.dirName, t.name], {
195
195
  closest: true,
196
+ typos: true,
196
197
  }).map(t => ({
197
198
  name: t.dirName,
198
199
  reason: `${t.type} template`,
@@ -100,6 +100,10 @@
100
100
  "kind": "component",
101
101
  "name": "ChatUnreadDivider"
102
102
  },
103
+ {
104
+ "kind": "component",
105
+ "name": "ChatVirtualizer"
106
+ },
103
107
  {
104
108
  "kind": "component",
105
109
  "name": "CircleCheckIndicator"
@@ -128,6 +132,10 @@
128
132
  "kind": "component",
129
133
  "name": "CommentThread"
130
134
  },
135
+ {
136
+ "kind": "component",
137
+ "name": "DialogHeroHeader"
138
+ },
131
139
  {
132
140
  "kind": "component",
133
141
  "name": "DiffViewer"
@@ -136,6 +144,10 @@
136
144
  "kind": "component",
137
145
  "name": "EmojiPicker"
138
146
  },
147
+ {
148
+ "kind": "component",
149
+ "name": "LineClamp"
150
+ },
139
151
  {
140
152
  "kind": "component",
141
153
  "name": "ListInput"
@@ -180,6 +192,14 @@
180
192
  "kind": "component",
181
193
  "name": "SVGIcon"
182
194
  },
195
+ {
196
+ "kind": "component",
197
+ "name": "TabBar"
198
+ },
199
+ {
200
+ "kind": "component",
201
+ "name": "TabBarItem"
202
+ },
183
203
  {
184
204
  "kind": "component",
185
205
  "name": "ThreeDBar"
@@ -244,6 +264,10 @@
244
264
  "kind": "template",
245
265
  "name": "CommentThreadShowcase"
246
266
  },
267
+ {
268
+ "kind": "template",
269
+ "name": "DialogHeroHeaderShowcase"
270
+ },
247
271
  {
248
272
  "kind": "template",
249
273
  "name": "DiffViewerShowcase"
@@ -283,6 +307,18 @@
283
307
  "kind": "component",
284
308
  "name": "RichTextEditor"
285
309
  },
310
+ {
311
+ "kind": "component",
312
+ "name": "RichTextEditorAutoLinkPlugin"
313
+ },
314
+ {
315
+ "kind": "component",
316
+ "name": "RichTextEditorToolbar"
317
+ },
318
+ {
319
+ "kind": "component",
320
+ "name": "RichTextView"
321
+ },
286
322
  {
287
323
  "kind": "template",
288
324
  "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',
@@ -90,7 +90,7 @@ export const docs = {
90
90
  {
91
91
  type: 'code',
92
92
  lang: 'bash',
93
- label: 'Install (add to an existing Tailwind v4 app)',
93
+ label: 'Install',
94
94
  code: '{@pm install @astryxdesign/core @stylexjs/stylex @astryxdesign/theme-neutral}',
95
95
  },
96
96
  {
@@ -113,7 +113,7 @@ export const docs = {
113
113
  },
114
114
  {
115
115
  type: 'prose',
116
- text: 'For Tailwind v3, see the layer workaround in {@link generic:migration-setup}.',
116
+ text: 'A project with Tailwind already set up needs a smaller change, which {@link generic:tailwind} shows. For Tailwind v3, see the layer workaround in {@link generic:migration-setup}.',
117
117
  },
118
118
  ],
119
119
  },
@@ -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
  {
@@ -61,7 +61,7 @@ export const docs = {
61
61
  },
62
62
  {
63
63
  type: 'prose',
64
- text: "`outline.doc.mjs` is the descriptor: name, display name and description (`--display-name`, `--description`), and `license`, the SPDX license of the artwork (it starts as your package's own). `outline.icons.json` starts with no icons and an empty `map`; its `module` is your package name. `outline.generated.js` is the set's generated module, with its declaration file `outline.generated.d.ts`: the CLI writes both, and every icon and the theme map are exports of it. Every field is in {@link schema:icon-set-doc} and {@link schema:icon-set-data}.",
64
+ text: "`outline.doc.mjs` is the descriptor: name, display name and description (`--display-name`, `--description`), and `license`, the SPDX license of the artwork (it starts as your package's own). `outline.icons.json` starts with no icons and an empty `map`; its `module` is your package name. After you rename the package, the next command that writes the data file (`new-set` on the existing set, with or without `--from`, `add`, `map`, or `new-definition --icon`) writes the new name and keeps any subpath (`@acme/old-icons/outline` becomes `@acme/new-icons/outline`), and its receipt says so. `outline.generated.js` is the set's generated module, with its declaration file `outline.generated.d.ts`: the CLI writes both, and every icon and the theme map are exports of it. Every field is in {@link schema:icon-set-doc} and {@link schema:icon-set-data}.",
65
65
  },
66
66
  {
67
67
  type: 'prose',
@@ -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). An export name cannot start with a digit, so an icon whose id would start with one once the library prefix comes off keeps the prefix (`fa0` is id `fa-0`, exported as `Fa0Icon`), and an id you give with `--id` must start with a letter. `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,11 +139,11 @@ 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. A library may ship each look as its own package (Font Awesome's solid and regular packages): `--from` may then name the other package, and an icon gains the variant from the export of the same name there; the receipt lists the icons that package has no export for. Running it again changes nothing.",
143
143
  },
144
144
  {
145
145
  type: 'prose',
146
- text: 'A library whose icons are data (objects or SVG strings) has no components to find: create the set, declare an `adapter` in its data file (see library shapes), and run the command again; every data export then becomes an icon through the adapter. When every icon export shares a leading word, such as `feather` in `featherEye` and `featherSun`, ids and export names leave it out: `featherEye` becomes id `eye`, exported as `EyeIcon`. The prefix is read over icon-like exports only: SCREAMING_CASE constants (`README`, `VERSION`), number and boolean exports, and, next to components or icon objects, plain strings are never icons. Components named `…Provider` or `…Context` are never icons either. Leave out any other export that is not an icon with `--exclude meta,version`: the data file keeps the list in `exclude`, so a refresh leaves them out too. When a library exports one icon under several names (`Trash2` and `Trash`), the icon is recorded once and its other names become words, so `experimental icon trash-2` finds it and `experimental icon map delete trash-2` maps it. `experimental icon add` reads the prefix the same way, and reuses the icon an export already has, so its commands need no `--id`.',
146
+ text: 'A library whose icons are data (objects or SVG strings) has no components to find: create the set, declare an `adapter` in its data file (see library shapes), and run the command again; every data export then becomes an icon through the adapter. When every icon export shares a leading word, such as `feather` in `featherEye` and `featherSun`, ids and export names leave it out: `featherEye` becomes id `eye`, exported as `EyeIcon`. The prefix is read over icon-like exports only: SCREAMING_CASE constants (`README`, `VERSION`), number and boolean exports, and, next to components or icon objects, plain strings are never icons. Components named `…Provider` or `…Context` are never icons either, and neither is a pack: an object whose keys are all other exports of the module, such as `fas` next to `faXmark`. Leave out any other export that is not an icon with `--exclude meta,version`: the data file keeps the list in `exclude`, so a refresh leaves them out too. When a library exports one icon under several names (`Trash2` and `Trash`), the icon is recorded once and its other names become words, so `experimental icon trash-2` finds it and `experimental icon map delete trash-2` maps it. `experimental icon add` reads the prefix the same way, and reuses the icon an export already has, so its commands need no `--id`.',
147
147
  },
148
148
  ],
149
149
  },
@@ -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
  },
@@ -67,7 +67,7 @@ export const docs = {
67
67
  content: [
68
68
  {
69
69
  type: 'prose',
70
- text: 'Each warning names something that may look different from what you meant, and what to change. The most common is a component that ignores its children: `<ListItem>Save</ListItem>` renders an empty row because ListItem takes `label="Save"`. Others flag remote images (a sandboxed viewer cannot load them; save the image next to the page and import it), a `<script>`, `<link>` or `<iframe>` the page itself renders (the file promises to run and load nothing, so remove them), missing images, and output the page printed while rendering.',
70
+ text: 'Each warning names something that may look different from what you meant, and what to change. The most common is a component that ignores its children: `<ListItem>Save</ListItem>` renders an empty row because ListItem takes `label="Save"`. Others flag remote images (a sandboxed viewer cannot load them; save the image next to the page and import it), a `<script>`, `<link>` or `<iframe>` the page itself renders (the file promises to run and load nothing, so remove them), missing images, and output the page printed while rendering. A `node-crash` warning names a Node build that crashes in `Intl.Segmenter` (its version and path). The page rendered without it, so the output may differ slightly: initials and character counts (such as Avatar initials) can split a joined emoji, a flag, or a letter written with a separate accent mark. Names in ordinary composed letters (`José`, `Zoë`, `李小龙`) come out the same. Render with an official Node.js build to remove the difference.',
71
71
  },
72
72
  ],
73
73
  },
@@ -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
  },
@@ -19,6 +19,8 @@ export const docs = {
19
19
  'tailwind-theme.css',
20
20
  'utility classes',
21
21
  'preflight',
22
+ 'existing Tailwind app',
23
+ 'cascade layer order',
22
24
  ],
23
25
 
24
26
  sections: [
@@ -69,7 +71,45 @@ import {themes, defaultThemeSlug} from './astryx-themes';`,
69
71
  },
70
72
  {
71
73
  type: 'prose',
72
- text: 'The Tailwind bridge is the concrete example of the general interop pattern: expose another library\'s semantic API, but point the values at system token variables.',
74
+ text: "The Tailwind bridge is the concrete example of the general interop pattern: expose another library's semantic API, but point the values at system token variables.",
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ title: 'Add Astryx to an app that already uses Tailwind',
80
+ content: [
81
+ {
82
+ type: 'prose',
83
+ text: 'The recipe in the Tailwind section is a whole `globals.css` for a new app. An app that already uses Tailwind keeps its own file: its `@import "tailwindcss"`, its `@theme` mapping, and its `:root` variables stay as they are. Add one `@layer` line above the Tailwind import and the Astryx stylesheets below it.',
84
+ },
85
+ {
86
+ type: 'code',
87
+ lang: 'css',
88
+ label: 'globals.css (existing Tailwind app)',
89
+ code: `@layer reset, theme, base, astryx-base, astryx-theme, components, utilities;
90
+
91
+ @import "tailwindcss"; /* the app's own entry, unchanged */
92
+ @import "@astryxdesign/core/reset.css";
93
+ @import "@astryxdesign/core/astryx.css";
94
+ @import "@astryxdesign/theme-neutral/theme.css";
95
+
96
+ /* The app's own @theme and :root rules stay below, unchanged. */`,
97
+ },
98
+ {
99
+ type: 'prose',
100
+ text: "This recipe leaves out `tailwind-theme.css`. The bridge maps Tailwind theme names to system tokens, including Tailwind's own defaults such as `rounded-lg` and `shadow-md`, so in an existing app it changes what the app's own classes paint. Add it only when the app does not use the names it maps.",
101
+ },
102
+ {
103
+ type: 'prose',
104
+ text: "Astryx's theme defines its own CSS custom properties (color, spacing, radius, shadow, font, motion and more), and {@link namespace:tokens} has the full list. An app token with one of those names collides in one of two ways. An app `@theme` key takes Astryx's value, because `astryx.css` sets the tokens on `:root` above Tailwind's `theme` layer: with `@theme { --spacing-4: 1.5rem }`, the app's `gap-4` stays 16px. Marking the block `@theme inline` keeps the app's value in its utilities. An app `:root` variable replaces Astryx's value, so Astryx's own components change: `:root { --spacing-4: 1.5rem }` widens Astryx's spacing step 4 from 16px to 24px. Where the root Theme component sets a token again, such as `--color-warning`, the app's own rules inside it read Astryx's value instead. Rename any app token that shares a name.",
105
+ },
106
+ {
107
+ type: 'prose',
108
+ text: "Put the `@layer` line above the app's `@import \"tailwindcss\"`, never below it. A `@layer` statement orders only the layer names the page has not seen yet, and the Tailwind import names `theme`, `base`, `components`, and `utilities` as it loads. Below that import, the statement can only add `reset`, `astryx-base`, and `astryx-theme` after Tailwind's `utilities`. That inverts the cascade: the Astryx reset then outranks every utility class in the app, and, for example, removes the borders and padding the app's utilities give its controls. Nothing reports it: the build and the browser console stay clean, and the `@layer` line still looks right in the source, so only the rendered page shows the problem.",
109
+ },
110
+ {
111
+ type: 'prose',
112
+ text: 'The load-order rule from the Tailwind section still applies: `globals.css` must be the first stylesheet the page loads, so its `@layer` line names the layers first.',
73
113
  },
74
114
  ],
75
115
  },
@@ -2,7 +2,8 @@
2
2
 
3
3
  /**
4
4
  * @file `astryx docs typography/type-scale`: line height, semantic type scale,
5
- * display text, headings and text components, and custom type scales.
5
+ * display text, headings and text components, custom type scales, and the
6
+ * reader's text size on iOS.
6
7
  */
7
8
 
8
9
  /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
@@ -14,13 +15,15 @@ export const docs = {
14
15
  placement: {parent: 'namespace:typography', slot: 'guides', order: 20},
15
16
  category: 'foundations',
16
17
  description:
17
- 'Line height, semantic type scale tokens, display text, Heading and Text components, and custom type scales via defineTheme.',
18
+ "Line height, semantic type scale tokens, display text, Heading and Text components, custom type scales via defineTheme, and following the reader's text size on iOS.",
18
19
  keywords: [
19
20
  'line height',
20
21
  'leading',
21
22
  'defineTheme',
22
23
  'base',
23
24
  'ratio',
25
+ 'dynamic type',
26
+ 'text size',
24
27
  ],
25
28
 
26
29
  sections: [
@@ -143,5 +146,19 @@ const denseTheme = defineTheme({
143
146
  },
144
147
  ],
145
148
  },
149
+ {
150
+ id: 'dynamic-type',
151
+ title: "Following the reader's text size on iOS",
152
+ content: [
153
+ {
154
+ type: 'prose',
155
+ text: "On iPhone, readers pick a text size in Settings (Display & Text Size, then Larger Text), and native apps grow or shrink their text with it. Every theme does the same in Safari on iPhone, which exposes that choice through `font: -apple-system-body`: each font size follows the reader's choice on the curve of the iOS text style it plays, so body text scales like Body, `heading-1` like Title 1 and display text like Large Title, and every role keeps its order. A size the theme fixes at a length, such as a 12px supporting size, scales on the curve of the step it reads by default; a size in `em` or `%` follows its parent, and one that reads a variable follows that variable. At the default size every font size is the theme's own. The family, spacing, radius and the root font size never change, line heights keep their ratios, text inputs keep their 16px floor on iOS, and on Android the system font scale grows every font size through `env(preferred-text-scale)` where the browser reports it; browsers with neither see no change. There is nothing to turn on: no theme option, prop or document attribute.",
156
+ },
157
+ {
158
+ type: 'prose',
159
+ text: 'Fixed-height controls such as the text inputs keep their height, so their text can overflow at the accessibility sizes. A labelled `Button` grows with its label.',
160
+ },
161
+ ],
162
+ },
146
163
  ],
147
164
  };
@@ -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
+ };