@astryxdesign/cli 0.7.13 → 0.7.14-canary.108f354

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 (164) hide show
  1. package/README.md +18 -18
  2. package/api/component/__fixtures__/resolutions/modules.txt +1 -1
  3. package/api/doctor/doctor.mjs +3 -7
  4. package/api/experimental.d.mts +2 -0
  5. package/api/experimental.mjs +12 -0
  6. package/api/icon/_adapter.d.mts +10 -0
  7. package/api/icon/_adapter.mjs +31 -2
  8. package/api/icon/_authoring.d.mts +2 -1
  9. package/api/icon/_authoring.mjs +91 -6
  10. package/api/icon/_options.mjs +1 -0
  11. package/api/icon/_records.d.mts +18 -0
  12. package/api/icon/_records.mjs +26 -0
  13. package/api/icon/add/add.mjs +7 -1
  14. package/api/icon/definitions/definitions.d.mts +12 -0
  15. package/api/icon/definitions/definitions.mjs +83 -0
  16. package/api/icon/icon.doc.mjs +5 -4
  17. package/api/icon/icon.mjs +5 -16
  18. package/api/icon/icon.type.d.mts +29 -2
  19. package/api/icon/icon.type.mjs +17 -3
  20. package/api/icon/iconAdd.doc.mjs +1 -1
  21. package/api/icon/iconMap.doc.mjs +2 -2
  22. package/api/icon/iconNewSet.doc.mjs +8 -2
  23. package/api/icon/map/map.mjs +21 -2
  24. package/api/icon/new-set/new-set.mjs +14 -2
  25. package/api/icon/search/search.mjs +2 -15
  26. package/api/icon/use/use.mjs +4 -3
  27. package/api/integration/validate-integration.mjs +6 -1
  28. package/api/integration/validate-integration.type.d.mts +12 -0
  29. package/api/integration/validate-integration.type.mjs +5 -0
  30. package/api/theme-edit/_adapter.d.mts +116 -0
  31. package/api/theme-edit/_adapter.mjs +1683 -0
  32. package/api/theme-edit/_catalog.d.mts +59 -0
  33. package/api/theme-edit/_catalog.mjs +564 -0
  34. package/api/theme-edit/_check.d.mts +49 -0
  35. package/api/theme-edit/_check.mjs +845 -0
  36. package/api/theme-edit/_color.d.mts +29 -0
  37. package/api/theme-edit/_color.mjs +300 -0
  38. package/api/theme-edit/_compiler.d.mts +61 -0
  39. package/api/theme-edit/_compiler.mjs +522 -0
  40. package/api/theme-edit/_css-properties.d.mts +10 -0
  41. package/api/theme-edit/_css-properties.mjs +556 -0
  42. package/api/theme-edit/_parts.d.mts +111 -0
  43. package/api/theme-edit/_parts.mjs +409 -0
  44. package/api/theme-edit/_png.d.mts +40 -0
  45. package/api/theme-edit/_png.mjs +187 -0
  46. package/api/theme-edit/_preview.d.mts +121 -0
  47. package/api/theme-edit/_preview.mjs +720 -0
  48. package/api/theme-edit/_project.d.mts +83 -0
  49. package/api/theme-edit/_project.mjs +289 -0
  50. package/api/theme-edit/_settings.d.mts +222 -0
  51. package/api/theme-edit/_settings.mjs +861 -0
  52. package/api/theme-edit/_tables.d.mts +132 -0
  53. package/api/theme-edit/_tables.mjs +700 -0
  54. package/api/theme-edit/theme-edit.d.mts +93 -0
  55. package/api/theme-edit/theme-edit.mjs +145 -0
  56. package/api/theme-edit/theme-edit.type.d.mts +413 -0
  57. package/api/theme-edit/theme-edit.type.mjs +233 -0
  58. package/api/theme-edit/themeEditHow.doc.d.mts +6 -0
  59. package/api/theme-edit/themeEditHow.doc.mjs +88 -0
  60. package/api/theme-edit/themeEditNew.doc.d.mts +6 -0
  61. package/api/theme-edit/themeEditNew.doc.mjs +89 -0
  62. package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +6 -0
  63. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +100 -0
  64. package/api/theme-edit/themeEditPreviewApp.doc.d.mts +6 -0
  65. package/api/theme-edit/themeEditPreviewApp.doc.mjs +84 -0
  66. package/api/theme-edit/themeEditPreviewList.doc.d.mts +6 -0
  67. package/api/theme-edit/themeEditPreviewList.doc.mjs +53 -0
  68. package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +6 -0
  69. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +66 -0
  70. package/api/theme-edit/themeEditSet.doc.d.mts +6 -0
  71. package/api/theme-edit/themeEditSet.doc.mjs +165 -0
  72. package/api/theme-edit/themeEditShow.doc.d.mts +6 -0
  73. package/api/theme-edit/themeEditShow.doc.mjs +86 -0
  74. package/api/theme-edit/themeEditUndo.doc.d.mts +6 -0
  75. package/api/theme-edit/themeEditUndo.doc.mjs +124 -0
  76. package/assets/docs/color.doc.mjs +5 -5
  77. package/assets/docs/tree/icon-sets.doc.mjs +6 -2
  78. package/assets/docs/tree/tokens-border.doc.mjs +1 -1
  79. package/assets/docs/tree/tokens-color.doc.mjs +2 -2
  80. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  81. package/assets/docs/tree/tokens-duration.doc.mjs +1 -1
  82. package/assets/docs/tree/tokens-ease.doc.mjs +1 -1
  83. package/assets/docs/tree/tokens-focus.doc.mjs +1 -1
  84. package/assets/docs/tree/tokens-font-weight.doc.mjs +1 -1
  85. package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
  86. package/assets/docs/tree/tokens-shadow.doc.mjs +1 -1
  87. package/assets/docs/tree/tokens-size.doc.mjs +1 -1
  88. package/assets/docs/tree/tokens-spacing.doc.mjs +1 -1
  89. package/assets/docs/tree/tokens-syntax.doc.mjs +1 -1
  90. package/assets/docs/tree/tokens-text-size.doc.mjs +1 -1
  91. package/assets/docs/tree/tokens-type-scale.doc.mjs +1 -1
  92. package/assets/docs/tree/tokens-typography.doc.mjs +1 -1
  93. package/assets/icons/definitions/bank.doc.mjs +1 -1
  94. package/assets/icons/definitions/save.doc.mjs +1 -1
  95. package/assets/preview-app/README.md +6 -0
  96. package/assets/preview-app/css.d.ts +5 -0
  97. package/assets/preview-app/gitignore +1 -0
  98. package/assets/preview-app/next.config.mjs +6 -0
  99. package/assets/preview-app/package.json +23 -0
  100. package/assets/preview-app/src/app/globals.css +5 -0
  101. package/assets/preview-app/src/app/layout.tsx +21 -0
  102. package/assets/preview-app/src/app/page.tsx +94 -0
  103. package/assets/preview-app/src/app/providers.tsx +16 -0
  104. package/assets/preview-app/tsconfig.json +27 -0
  105. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +2 -1
  106. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +2 -1
  107. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider03RtlDirection.doc.mjs +2 -1
  108. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +2 -1
  109. package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
  110. package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
  111. package/authoring/doctypes/_schema.d.mts +1 -0
  112. package/authoring/doctypes/_schema.mjs +1 -0
  113. package/authoring/doctypes/command/command.doc.mjs +7 -0
  114. package/authoring/doctypes/command/type.ts +3 -0
  115. package/authoring/doctypes/icon-set/parse.d.mts +7 -0
  116. package/authoring/doctypes/icon-set/parse.mjs +18 -8
  117. package/clients/cli/commands/doctor.mjs +33 -3
  118. package/clients/cli/commands/experimental/icon.mjs +67 -14
  119. package/clients/cli/commands/experimental/index.mjs +2 -0
  120. package/clients/cli/commands/experimental/theme.mjs +684 -0
  121. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +7 -1
  122. package/clients/cli/commands/experimental-icon.doc.mjs +3 -2
  123. package/clients/cli/commands/experimental-theme-add.doc.mjs +78 -0
  124. package/clients/cli/commands/experimental-theme-compile.doc.mjs +97 -0
  125. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +84 -0
  126. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +66 -0
  127. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +121 -0
  128. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +66 -0
  129. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +104 -0
  130. package/clients/cli/commands/experimental-theme-editor.doc.mjs +49 -0
  131. package/clients/cli/commands/experimental-theme-eject.doc.mjs +71 -0
  132. package/clients/cli/commands/experimental-theme-list.doc.mjs +49 -0
  133. package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +73 -0
  134. package/clients/cli/commands/experimental-theme-palette.doc.mjs +37 -0
  135. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +86 -0
  136. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +66 -0
  137. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +48 -0
  138. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +59 -0
  139. package/clients/cli/commands/experimental-theme-preview.doc.mjs +40 -0
  140. package/clients/cli/commands/experimental-theme-remove.doc.mjs +55 -0
  141. package/clients/cli/commands/experimental-theme-targets.doc.mjs +61 -0
  142. package/clients/cli/commands/experimental-theme-template.doc.mjs +61 -0
  143. package/clients/cli/commands/experimental-theme-use.doc.mjs +55 -0
  144. package/clients/cli/commands/experimental-theme.doc.mjs +57 -0
  145. package/clients/cli/commands/experimental.doc.mjs +10 -3
  146. package/clients/cli/commands/theme.mjs +101 -34
  147. package/clients/cli/index.mjs +18 -0
  148. package/clients/cli/lib/define-command.mjs +3 -0
  149. package/foundation/discovery/icon-set-checks.d.mts +16 -1
  150. package/foundation/discovery/icon-set-checks.mjs +68 -7
  151. package/foundation/discovery/icon-set-discovery.d.mts +21 -6
  152. package/foundation/discovery/icon-set-discovery.mjs +17 -8
  153. package/foundation/discovery/template-icon-meanings.d.mts +39 -0
  154. package/foundation/discovery/template-icon-meanings.mjs +95 -0
  155. package/foundation/discovery/theming-targets.d.mts +6 -0
  156. package/foundation/discovery/theming-targets.mjs +33 -0
  157. package/foundation/response/error-codes.d.mts +12 -1
  158. package/foundation/response/error-codes.doc.mjs +66 -0
  159. package/foundation/response/error-codes.mjs +55 -0
  160. package/foundation/response/response-types.doc.mjs +55 -0
  161. package/foundation/text/template-meanings-line.d.mts +16 -0
  162. package/foundation/text/template-meanings-line.mjs +37 -0
  163. package/foundation/xle/browser.d.mts +2 -2
  164. package/package.json +6 -6
@@ -0,0 +1,49 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for the `astryx experimental theme editor` group: make and
5
+ * change a theme one checked change at a time.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme editor',
12
+ displayName: 'astryx experimental theme editor',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary:
16
+ 'Make and change a theme one checked change at a time (dials, tokens, part styles), with previews',
17
+ description:
18
+ "A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it by the same build as `astryx theme build` (`experimental theme compile`). Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, accent, font, headings, text-size, base, mode), a design token by name, or a CSS property on a part. Where it applies: --on <part|family>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. `how` answers everything else: what a part, family, setting or aspect does, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
19
+ subcommands: ['new', 'set', 'undo', 'show', 'how'],
20
+ examples: [
21
+ {
22
+ label: 'Start a theme',
23
+ cli: 'astryx experimental theme editor new brand --like neutral',
24
+ },
25
+ {
26
+ label: 'Round everything',
27
+ cli: 'astryx experimental theme editor set brand corners pill',
28
+ },
29
+ {
30
+ label: 'Ask how',
31
+ cli: 'astryx experimental theme editor how "white text in the banner"',
32
+ },
33
+ {
34
+ label: 'See it all',
35
+ cli: 'astryx experimental theme editor show brand',
36
+ },
37
+ ],
38
+ exitCodes: [
39
+ {
40
+ code: 0,
41
+ when: 'help is shown or a subcommand succeeds',
42
+ },
43
+ {
44
+ code: 1,
45
+ when: 'an unknown subcommand, a refused change, or a subcommand failure',
46
+ },
47
+ ],
48
+ related: ['experimental theme', 'theme build'],
49
+ };
@@ -0,0 +1,71 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme eject`: the experimental
5
+ * copy of `astryx theme eject`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme eject',
12
+ displayName: 'astryx experimental theme eject',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Fork a theme as editable local source',
16
+ description:
17
+ "Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Use --package when package themes share a slug.",
18
+ fn: 'themeEject',
19
+ args: [
20
+ {
21
+ name: 'slug',
22
+ param: 'slug',
23
+ required: true,
24
+ },
25
+ {
26
+ name: 'path',
27
+ param: 'options.targetPath',
28
+ required: false,
29
+ },
30
+ ],
31
+ options: [
32
+ {
33
+ flag: '-f, --overwrite',
34
+ param: 'options.overwrite',
35
+ description:
36
+ 'Replace existing files. Without it, an existing file fails with ERR_FILE_EXISTS and nothing is written',
37
+ },
38
+ {
39
+ flag: '--package <package>',
40
+ param: 'options.package',
41
+ description: 'Select the package that owns the theme',
42
+ },
43
+ ],
44
+ examples: [
45
+ {
46
+ label: 'Fork a theme into the local root',
47
+ cli: 'astryx experimental theme eject ocean',
48
+ },
49
+ {
50
+ label: 'Fork one package theme elsewhere',
51
+ cli: 'astryx experimental theme eject ocean src/themes/my-ocean --package @acme/themes',
52
+ },
53
+ ],
54
+ outsideProject: 'same',
55
+ exitCodes: [
56
+ {
57
+ code: 0,
58
+ when: 'all source and descriptor files are written',
59
+ },
60
+ {
61
+ code: 1,
62
+ when: 'the theme is unknown or ambiguous, a path escapes, a source file is missing, or a destination exists',
63
+ },
64
+ ],
65
+ related: [
66
+ 'experimental theme add',
67
+ 'experimental theme compile',
68
+ 'experimental theme list',
69
+ ],
70
+ replaces: ['theme eject'],
71
+ };
@@ -0,0 +1,49 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme list`: the experimental
5
+ * copy of `astryx theme list`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme list',
12
+ displayName: 'astryx experimental theme list',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'List themes available to add',
16
+ description:
17
+ 'Lists bundled, package, and local themes with their owner, source, added state, and default state. Earlier descriptor-less copies are not listed as themes; the receipt names them with the upgrade command.',
18
+ fn: 'themeListAvailable',
19
+ options: [
20
+ {
21
+ flag: '--package <package>',
22
+ param: 'options.package',
23
+ description: 'Show only themes owned by this package',
24
+ },
25
+ ],
26
+ examples: [
27
+ {
28
+ label: 'List available themes',
29
+ cli: 'astryx experimental theme list --json',
30
+ },
31
+ {
32
+ label: 'List one integration package',
33
+ cli: 'astryx experimental theme list --package @acme/themes',
34
+ },
35
+ ],
36
+ outsideProject: 'same',
37
+ exitCodes: [
38
+ {
39
+ code: 0,
40
+ when: 'success',
41
+ },
42
+ {
43
+ code: 1,
44
+ when: 'a bundled or installed theme descriptor cannot be read',
45
+ },
46
+ ],
47
+ related: ['experimental theme add', 'experimental theme compile'],
48
+ replaces: ['theme list'],
49
+ };
@@ -0,0 +1,73 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme palette generate`: the experimental
5
+ * copy of `astryx theme palette generate`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme palette generate',
12
+ displayName: 'astryx experimental theme palette generate',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Generate an OKLCH palette candidate for human review',
16
+ description:
17
+ 'Reads an explicit JSON request and runs the versioned astryx-oklch-v1 recipe. The command defaults to 21 stops (0 through 100) but accepts any non-empty ordered numeric stop list, including decimals. Stops apply to every family in the request. Authors may omit the repeated endpoints with a custom list; standalone exact black and white values remain available in every candidate. For anchors, exact preserves the chosen color at its mode and stop; bounded allows movement within maxDeltaE; flexible uses the color as guidance. Without --out it prints a preview. With --out it writes a candidate file and detached receipt. --preview writes a standardized, self-contained HTML review artifact. TypeScript output is directly importable and contains no generator dependency. JSON is also supported. Existing author-owned files are left untouched unless --overwrite is explicit. When used in a theme integration, keep the palette request under the theme slug, write the candidate and receipt under that same slug, import the candidate from the theme source, and keep all three inside the theme directory. The package ships that directory as one source unit for discovery and explicit eject, while apps use its built exports.',
18
+ fn: 'themePaletteGenerate',
19
+ args: [
20
+ {
21
+ name: 'config',
22
+ param: 'configPath',
23
+ required: true,
24
+ },
25
+ ],
26
+ options: [
27
+ {
28
+ flag: '-o, --out <path>',
29
+ param: 'options.out',
30
+ description:
31
+ 'Write a candidate TypeScript or JSON file and a sibling receipt',
32
+ },
33
+ {
34
+ flag: '--preview <path>',
35
+ param: 'options.preview',
36
+ description:
37
+ 'Write a self-contained HTML preview page; the path must end in .html',
38
+ },
39
+ {
40
+ flag: '-f, --overwrite',
41
+ param: 'options.overwrite',
42
+ description:
43
+ 'Replace existing candidate, receipt, and preview files. Without it, if any of them exists, nothing is written',
44
+ },
45
+ ],
46
+ examples: [
47
+ {
48
+ label: 'Preview candidate JSON',
49
+ cli: 'astryx experimental theme palette generate themes/ocean/palette.config.json',
50
+ },
51
+ {
52
+ label: 'Write candidate and receipt',
53
+ cli: 'astryx experimental theme palette generate themes/ocean/palette.config.json --out themes/ocean/tokens/ocean.palette.ts',
54
+ },
55
+ {
56
+ label: 'Write candidate, receipt, and review preview',
57
+ cli: 'astryx experimental theme palette generate themes/ocean/palette.config.json --out themes/ocean/tokens/ocean.palette.ts --preview themes/ocean/tokens/ocean.palette.html',
58
+ },
59
+ ],
60
+ outsideProject: 'same',
61
+ exitCodes: [
62
+ {
63
+ code: 0,
64
+ when: 'a candidate is produced or existing output is left untouched',
65
+ },
66
+ {
67
+ code: 1,
68
+ when: 'the request is invalid or output cannot be written safely',
69
+ },
70
+ ],
71
+ related: ['experimental theme compile', 'experimental theme template'],
72
+ replaces: ['theme palette generate'],
73
+ };
@@ -0,0 +1,37 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme palette`: the experimental
5
+ * copy of `astryx theme palette`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme palette',
12
+ displayName: 'astryx experimental theme palette',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Create and work with theme-owned color palettes',
16
+ description:
17
+ 'Palette authoring tools. generate writes a palette candidate for you to review before a theme uses it.',
18
+ subcommands: ['generate'],
19
+ examples: [
20
+ {
21
+ label: 'Generate a candidate',
22
+ cli: 'astryx experimental theme palette generate palette.config.json',
23
+ },
24
+ ],
25
+ exitCodes: [
26
+ {
27
+ code: 0,
28
+ when: 'help is shown or a subcommand succeeds',
29
+ },
30
+ {
31
+ code: 1,
32
+ when: 'an unknown subcommand is provided',
33
+ },
34
+ ],
35
+ related: ['experimental theme compile', 'experimental theme template'],
36
+ replaces: ['theme palette'],
37
+ };
@@ -0,0 +1,86 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme preview add`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme preview add',
9
+ displayName: 'astryx experimental theme preview add',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary:
13
+ 'Add pages to the theme preview in the app: the default pages, the best template pages for a description, or one template',
14
+ description:
15
+ 'Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description ("a sales dashboard") asks the same page ranking `build` uses for the template pages that fit it best (--top of them, default 1), and adds each as a page; --template names one page template instead; with neither, it adds the default pages: the sample app page and every component grouped. The route goes in theme-preview/ in the app\'s routes folder (app/ or src/app/), or in --path; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no --path, it refuses and names both ways on: --path, or `experimental theme preview app <dir>`, which makes a new starter app with the preview in it. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks is not added: the result names it and the command that installs it. A file the preview did not write is never replaced. The pages wear --theme (default: the only theme under themes/; with none or several, the app\'s own theme). Experimental: it may change or be removed in a patch release.',
16
+ fn: 'themeEditPreviewAdd',
17
+ args: [
18
+ {
19
+ name: 'description',
20
+ param: 'description',
21
+ required: false,
22
+ },
23
+ ],
24
+ options: [
25
+ {
26
+ flag: '--theme <name>',
27
+ param: 'options.theme',
28
+ description:
29
+ "The theme the pages wear: a theme made by experimental theme editor (default: the only one under themes/; with none or several, the app's own theme)",
30
+ },
31
+ {
32
+ flag: '--template <id>',
33
+ param: 'options.template',
34
+ description:
35
+ 'Add this page template (astryx template --list --type page) instead of ranking one from a description',
36
+ },
37
+ {
38
+ flag: '--top <n>',
39
+ param: 'options.top',
40
+ description:
41
+ 'With a description: how many of the best-fitting page templates to add, 1 to 3 (default 1)',
42
+ },
43
+ {
44
+ flag: '--path <dir>',
45
+ param: 'options.path',
46
+ description:
47
+ "The folder of the preview route, inside the project. Default: theme-preview/ in the app's routes folder (app/ or src/app/); later commands find it there, or take the same --path",
48
+ },
49
+ ],
50
+ examples: [
51
+ {
52
+ label: 'The default pages',
53
+ cli: 'astryx experimental theme preview add',
54
+ },
55
+ {
56
+ label: 'The best page for an idea',
57
+ cli: 'astryx experimental theme preview add "a sales dashboard" --top 2',
58
+ },
59
+ {
60
+ label: 'One template',
61
+ cli: 'astryx experimental theme preview add --template dashboard',
62
+ },
63
+ ],
64
+ outsideProject: 'refuse',
65
+ notes: [
66
+ {
67
+ type: 'prose',
68
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme preview add writes nothing and stops with `ERR_PROJECT_REQUIRED`; run it in the app project, or make a new app with `experimental theme preview app <dir>`. In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.",
69
+ },
70
+ ],
71
+ exitCodes: [
72
+ {
73
+ code: 0,
74
+ when: 'the pages are added',
75
+ },
76
+ {
77
+ code: 1,
78
+ when: 'outside a project, no routes folder and no --path, a file there that the preview did not write, a path outside the project, an unknown theme or template, no template page whose packages the app has, or a bad --top',
79
+ },
80
+ ],
81
+ related: [
82
+ 'experimental theme preview',
83
+ 'experimental theme preview app',
84
+ 'experimental theme editor show',
85
+ ],
86
+ };
@@ -0,0 +1,66 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme preview app`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme preview app',
9
+ displayName: 'astryx experimental theme preview app',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary:
13
+ 'Make a new starter app with the theme preview inside, ready to install and run',
14
+ description:
15
+ "Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the current folder; --overwrite uses a folder that is not empty, but never replaces a protected file there, and keeps its own package.json and .gitignore. Every check runs before the first write, so a refusal changes nothing. Later pages go in with `experimental theme preview add`, run in the new app. Experimental: it may change or be removed in a patch release.",
16
+ fn: 'themeEditPreviewApp',
17
+ args: [
18
+ {
19
+ name: 'dir',
20
+ param: 'dir',
21
+ required: true,
22
+ },
23
+ ],
24
+ options: [
25
+ {
26
+ flag: '--theme <name>',
27
+ param: 'options.theme',
28
+ description:
29
+ "A theme made by experimental theme editor here: copied into the app, and the pages wear it (default: the app's own neutral theme)",
30
+ },
31
+ {
32
+ flag: '--overwrite',
33
+ param: 'options.overwrite',
34
+ description:
35
+ 'Write into a folder that is not empty; a protected file is never replaced, and its own package.json and .gitignore are kept',
36
+ },
37
+ ],
38
+ examples: [
39
+ {
40
+ label: 'A new app',
41
+ cli: 'astryx experimental theme preview app theme-app',
42
+ },
43
+ {
44
+ label: 'A new app wearing a theme',
45
+ cli: 'astryx experimental theme preview app theme-app --theme brand',
46
+ },
47
+ ],
48
+ outsideProject: 'own',
49
+ notes: [
50
+ {
51
+ type: 'prose',
52
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme preview app works the same: it makes the new app, with its pages from this CLI's own Core. In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.",
53
+ },
54
+ ],
55
+ exitCodes: [
56
+ {
57
+ code: 0,
58
+ when: 'the app is written',
59
+ },
60
+ {
61
+ code: 1,
62
+ when: 'no <dir>, a folder that is not empty without --overwrite or a protected file in it, a folder outside the current one, or an unknown theme',
63
+ },
64
+ ],
65
+ related: ['experimental theme preview', 'experimental theme preview add'],
66
+ };
@@ -0,0 +1,48 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme preview list`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme preview list',
9
+ displayName: 'astryx experimental theme preview list',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary: 'The pages of the theme preview in the app',
13
+ description:
14
+ 'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder for one, it says so and how to add one (the JSON list is empty). Experimental: it may change or be removed in a patch release.',
15
+ fn: 'themeEditPreviewList',
16
+ options: [
17
+ {
18
+ flag: '--path <dir>',
19
+ param: 'options.path',
20
+ description:
21
+ 'The folder of the preview route, when it is not in the default place',
22
+ },
23
+ ],
24
+ examples: [
25
+ {
26
+ label: 'Every page',
27
+ cli: 'astryx experimental theme preview list',
28
+ },
29
+ ],
30
+ outsideProject: 'refuse',
31
+ notes: [
32
+ {
33
+ type: 'prose',
34
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme preview list writes nothing and stops with `ERR_PROJECT_REQUIRED`; run it in the app project. In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.",
35
+ },
36
+ ],
37
+ exitCodes: [
38
+ {
39
+ code: 0,
40
+ when: 'the pages are listed (none included)',
41
+ },
42
+ {
43
+ code: 1,
44
+ when: 'outside a project',
45
+ },
46
+ ],
47
+ related: ['experimental theme preview'],
48
+ };
@@ -0,0 +1,59 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme preview remove`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme preview remove',
9
+ displayName: 'astryx experimental theme preview remove',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary: 'Remove one page from the theme preview, or the whole preview',
13
+ description:
14
+ 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Experimental: it may change or be removed in a patch release.',
15
+ fn: 'themeEditPreviewRemove',
16
+ args: [
17
+ {
18
+ name: 'page',
19
+ param: 'page',
20
+ required: false,
21
+ },
22
+ ],
23
+ options: [
24
+ {
25
+ flag: '--path <dir>',
26
+ param: 'options.path',
27
+ description:
28
+ 'The folder of the preview route, when it is not in the default place',
29
+ },
30
+ ],
31
+ examples: [
32
+ {
33
+ label: 'One page',
34
+ cli: 'astryx experimental theme preview remove components',
35
+ },
36
+ {
37
+ label: 'The whole preview',
38
+ cli: 'astryx experimental theme preview remove',
39
+ },
40
+ ],
41
+ outsideProject: 'refuse',
42
+ notes: [
43
+ {
44
+ type: 'prose',
45
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme preview remove writes nothing and stops with `ERR_PROJECT_REQUIRED`; run it in the app project. In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.",
46
+ },
47
+ ],
48
+ exitCodes: [
49
+ {
50
+ code: 0,
51
+ when: 'the page or the preview is removed',
52
+ },
53
+ {
54
+ code: 1,
55
+ when: 'there is no preview, it has no such page, theme-preview.json names a file outside the route folder, or outside a project',
56
+ },
57
+ ],
58
+ related: ['experimental theme preview'],
59
+ };
@@ -0,0 +1,40 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for the `astryx experimental theme preview` group: the
5
+ * theme preview page in the app.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme preview',
12
+ displayName: 'astryx experimental theme preview',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'A page in your app that shows the theme on real pages',
16
+ description:
17
+ "One route in the app, a normal page that keeps the app's layout, global CSS and providers: an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. `add` adds pages (the default pages, the best template pages for a description, or one template) and writes the route the first time; `list` lists them; `remove` removes one, or the whole preview. With no app, `app <dir>` makes a starter app with the preview in it. Pictures of a theme are on `experimental theme editor show`. Experimental: it may change or be removed in a patch release.",
18
+ subcommands: ['add', 'app', 'list', 'remove'],
19
+ examples: [
20
+ {
21
+ label: 'The default pages',
22
+ cli: 'astryx experimental theme preview add',
23
+ },
24
+ {
25
+ label: 'Every page',
26
+ cli: 'astryx experimental theme preview list',
27
+ },
28
+ ],
29
+ exitCodes: [
30
+ {
31
+ code: 0,
32
+ when: 'help is shown or a subcommand succeeds',
33
+ },
34
+ {
35
+ code: 1,
36
+ when: 'an unknown subcommand or a subcommand failure',
37
+ },
38
+ ],
39
+ related: ['experimental theme', 'experimental theme editor show'],
40
+ };
@@ -0,0 +1,55 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme remove`: the experimental
5
+ * copy of `astryx theme remove`, with the same function, flags and output.
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
9
+ export const doc = {
10
+ type: 'command',
11
+ name: 'experimental theme remove',
12
+ displayName: 'astryx experimental theme remove',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Remove a non-default theme from the app',
16
+ description:
17
+ 'Removes one added theme from the generated module and regenerates the whole module. Choose another default with theme use before removing the current default.',
18
+ fn: 'themeRemove',
19
+ args: [
20
+ {
21
+ name: 'slug',
22
+ param: 'slug',
23
+ required: true,
24
+ },
25
+ ],
26
+ examples: [
27
+ {
28
+ label: 'Remove an added theme',
29
+ cli: 'astryx experimental theme remove ocean',
30
+ },
31
+ ],
32
+ outsideProject: 'refuse',
33
+ exitCodes: [
34
+ {
35
+ code: 0,
36
+ when: 'the module is regenerated without the theme',
37
+ },
38
+ {
39
+ code: 1,
40
+ when: 'the theme is not added, is the default, or state is invalid',
41
+ },
42
+ ],
43
+ related: [
44
+ 'experimental theme add',
45
+ 'experimental theme use',
46
+ 'experimental theme list',
47
+ ],
48
+ notes: [
49
+ {
50
+ type: 'prose',
51
+ text: 'In global mode: outside a project, experimental theme remove writes nothing and stops with `ERR_THEME_INVALID`: "No package.json found. Run this command inside an app project." In a project, the project\'s version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.',
52
+ },
53
+ ],
54
+ replaces: ['theme remove'],
55
+ };