@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
@@ -11,7 +11,7 @@ export const doc = {
11
11
  stability: 'experimental',
12
12
  summary: 'Start an icon set in your integration package',
13
13
  description:
14
- "Run inside an integration package. Writes the set's folder with its descriptor, its data file, and its generated module, and declares the manifest's `experimental.iconSets` root on first use. With --from it wraps every icon component of a library, records the library and its version as the set's source, copies its license notice, and maps each Astryx icon definition whose name is an icon's id; definitions an icon only shares a word with are listed as suggestions, never written. A library whose export names end in looks (XOutline24WGHT500Icon) gives one icon per glyph, by its glyph id (x), in the look the default variant names, else the library's usual default. Run it again with --from to refresh. --variants and --default-variant declare the set's variants; over an existing set without --from, they, --display-name and --description update the set in place and leave its icons as they are; a set with icons changes its default variant only with --from, and only in a library whose export names encode looks. Experimental: it may change or be removed in a patch release.",
14
+ "Run inside an integration package. Writes the set's folder with its descriptor, its data file, and its generated module, and declares the manifest's `experimental.iconSets` root on first use. With --from it wraps every icon component of a library, records the library and its version as the set's source, copies its license notice, and maps each Astryx icon definition whose name is an icon's id; definitions an icon only shares a word with are listed as suggestions, never written. A library whose export names end in looks (XOutline24WGHT500Icon) gives one icon per glyph, by its glyph id (x), in the look the default variant names, else the library's usual default. Run it again with --from to refresh. A library whose icons are data objects or SVG strings needs --adapter, a function in your package that turns one into a component. --variants and --default-variant declare the set's variants; over an existing set without --from, they, --display-name and --description update the set in place and leave its icons as they are; a set with icons changes its default variant only with --from, and only in a library whose export names encode looks. Experimental: it may change or be removed in a patch release.",
15
15
  fn: 'iconNewSet',
16
16
  args: [
17
17
  {
@@ -39,6 +39,12 @@ export const doc = {
39
39
  description:
40
40
  'With --from: comma-separated export names of the library that are not icons',
41
41
  },
42
+ {
43
+ flag: '--adapter <module>#<export>',
44
+ param: 'options.adapter',
45
+ description:
46
+ "A function in your package that turns one icon export that is not a component (an icon data object, an SVG string) into one, as ./<path>#<export>; it is declared in the set's data file, and with --from every data export of the library becomes an icon through it",
47
+ },
42
48
  {
43
49
  flag: '--variants <list>',
44
50
  param: 'options.variants',
@@ -36,7 +36,8 @@ export const doc = {
36
36
  {
37
37
  flag: '--set <name>',
38
38
  param: 'options.set',
39
- description: 'Search one set, by name or <package>/<set>',
39
+ description:
40
+ 'Search one set, by name or <package>/<set>; with --definitions, the set to check them against',
40
41
  },
41
42
  {
42
43
  flag: '--limit <n>',
@@ -47,7 +48,7 @@ export const doc = {
47
48
  flag: '--definitions',
48
49
  param: 'options.definitions',
49
50
  description:
50
- 'Every Astryx icon definition, one line each: name, built in or not, description, words',
51
+ "Every Astryx icon definition, one line each: name, built in or not, how many bundled templates use it, whether the set maps it (--set, else the project's main set, else the package's only set), description, words",
51
52
  },
52
53
  {
53
54
  flag: '--all-icons',
@@ -0,0 +1,78 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme add`: the experimental
5
+ * copy of `astryx theme add`, 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 add',
12
+ displayName: 'astryx experimental theme add',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary:
16
+ "Add a built theme to the app. To copy a theme's source as an editable fork, run `experimental theme eject <slug> [path] [--overwrite]`.",
17
+ description:
18
+ "Records the theme in the generated app module and imports its built module and stylesheets. --import remains accepted as a compatibility no-op. To copy a theme's source as an editable fork, run `experimental theme eject <slug> [path] [--overwrite]`. A bare command or --list delegates to themeListCopySources(), whose released JSON bytes stay unchanged while its text names the current add and eject commands; use --package when owners share a slug. Outside a project, a bare command or --list lists the available themes as in a new project; given a slug it writes nothing and fails, naming the app project it needs (ERR_THEME_INVALID), or with ERR_UNKNOWN_THEME when no theme has that slug.",
19
+ fn: 'themeAdd',
20
+ args: [
21
+ {
22
+ name: 'slug',
23
+ param: 'slug',
24
+ required: false,
25
+ },
26
+ ],
27
+ options: [
28
+ {
29
+ flag: '--list',
30
+ description: 'List available themes',
31
+ },
32
+ {
33
+ flag: '--import',
34
+ param: 'options.import',
35
+ description:
36
+ 'Compatibility no-op; the built theme is added with or without this flag',
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: 'Add a built theme to the app',
47
+ cli: 'astryx experimental theme add ocean',
48
+ },
49
+ {
50
+ label: 'Select a package theme over a local theme',
51
+ cli: 'astryx experimental theme add ocean --package @acme/themes',
52
+ },
53
+ ],
54
+ outsideProject: 'own',
55
+ exitCodes: [
56
+ {
57
+ code: 0,
58
+ when: 'the theme is listed or added',
59
+ },
60
+ {
61
+ code: 1,
62
+ when: 'the theme, its built imports, its record, or the option combination is invalid',
63
+ },
64
+ ],
65
+ related: [
66
+ 'experimental theme list',
67
+ 'experimental theme remove',
68
+ 'experimental theme use',
69
+ 'experimental theme eject',
70
+ ],
71
+ notes: [
72
+ {
73
+ type: 'prose',
74
+ text: 'In global mode: outside a project, experimental theme add with no slug lists the themes available, as in a new project; with a slug it 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}.',
75
+ },
76
+ ],
77
+ replaces: ['theme add'],
78
+ };
@@ -0,0 +1,97 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandDoc for `astryx experimental theme compile`: the experimental
5
+ * copy of `astryx theme build`, 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 compile',
12
+ displayName: 'astryx experimental theme compile',
13
+ namespace: 'cli/commands',
14
+ stability: 'experimental',
15
+ summary: 'Compile standalone themes or one keyed theme family',
16
+ description:
17
+ 'Compiles defineTheme() sources through the same theme pipeline into scoped CSS, standard ESM, and type declarations. Ordinary mode writes one complete set per theme. --family combines one selected extension tree into the three files named by the required --family-key, ready for one CSS load and identity-only switching. With --check it writes nothing and reports source drift. --icons-specifier keeps its existing generated-module behavior. It prints one line per built theme and one line naming fonts the themes do not load; --detail full adds the install example and the font recipe, once for a batch.',
18
+ fn: 'themeBuild',
19
+ args: [
20
+ {
21
+ name: 'files',
22
+ param: 'file',
23
+ required: true,
24
+ variadic: true,
25
+ },
26
+ ],
27
+ options: [
28
+ {
29
+ flag: '--family',
30
+ description:
31
+ 'Build the selected extension family into one keyed CSS, JS, and declaration set, written beside the family root theme file, which must be inside the working directory to build (ERR_PATH_TRAVERSAL); --check only reads, so it compares outputs anywhere. Requires --family-key; refused with --out or --watch (ERR_THEME_INVALID)',
32
+ },
33
+ {
34
+ flag: '--family-key <key>',
35
+ description:
36
+ 'Lower-kebab filename stem required with --family and refused without it; must differ from every member name (ERR_THEME_INVALID)',
37
+ },
38
+ {
39
+ flag: '-o, --out <path>',
40
+ param: 'options.out',
41
+ description:
42
+ 'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
43
+ },
44
+ {
45
+ flag: '--icons-specifier <specifier>',
46
+ param: 'options.iconsSpecifier',
47
+ description:
48
+ "Override the icon-registry import in the generated JS module, for example ./icons.mjs (default: the specifier in the theme source's own import). With --family it applies to every member's icon import",
49
+ },
50
+ {
51
+ flag: '-w, --watch',
52
+ description:
53
+ 'Rebuild automatically when a theme file changes (Ctrl-C to stop). Refused with --check, --family, or --json (ERR_THEME_INVALID)',
54
+ },
55
+ {
56
+ flag: '-c, --check',
57
+ param: 'options.check',
58
+ description:
59
+ 'Verify the committed outputs match the source without writing; exit non-zero if stale. Composes with --family and several files; refused with --watch (ERR_THEME_INVALID)',
60
+ },
61
+ ],
62
+ examples: [
63
+ {
64
+ label: 'Build to a CSS file',
65
+ cli: 'astryx experimental theme compile ./src/themes/ocean.ts --out ./dist/ocean.css',
66
+ },
67
+ {
68
+ label: 'Build one related family for attribute-only switching',
69
+ cli: 'astryx experimental theme compile --family ./themes/ocean.mjs ./themes/ocean-calm.mjs --family-key ocean-family',
70
+ },
71
+ {
72
+ label: 'Build every theme in a directory',
73
+ cli: 'astryx experimental theme compile ./src/themes/*.ts',
74
+ },
75
+ {
76
+ label: 'Check for drift (CI)',
77
+ cli: 'astryx experimental theme compile ./src/themes/ocean.ts --check',
78
+ },
79
+ {
80
+ label: 'Build against a separately compiled icon registry',
81
+ cli: 'astryx experimental theme compile ./src/themes/ocean.ts --icons-specifier ./icons.mjs',
82
+ },
83
+ ],
84
+ outsideProject: 'same',
85
+ exitCodes: [
86
+ {
87
+ code: 0,
88
+ when: 'the theme builds, or --check finds the outputs up to date',
89
+ },
90
+ {
91
+ code: 1,
92
+ when: 'a build or validation error, or --check finds stale or missing outputs',
93
+ },
94
+ ],
95
+ related: ['experimental theme add', 'experimental theme list'],
96
+ replaces: ['theme build'],
97
+ };
@@ -0,0 +1,84 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme editor how`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme editor how',
9
+ displayName: 'astryx experimental theme editor how',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary:
13
+ "Look up a part, family, setting or aspect; answer a question in plain words; read a picture's colors; or list what you can set",
14
+ description:
15
+ 'One command for every question. With nothing named, it prints its usage and examples. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size) and under which variant or state, its variants (--when) and states (--state), the parts inside it (a token set --on the part reaches them), and its family. A family (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it, or a CSS property and the parts that set it. An aspect (colors, text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. A question in plain words ("bold white text in the header", "glossy gradient header"): it finds the parts (header, nav links, banner, cards, inputs, buttons and their variants...) and aspects (text color, background, gradient, corners, border, shadow or bevel, spacing, font, bold, letter spacing) and answers with exact commands from what each part really reads: the direct property (always works) and the token route; a part with variants says a change without --when reaches every variant. A PNG picture: its main colors, biggest share first, with where each sits (a number after the file sets how many, default 14), or with --at the exact color at pixel points (no browser needed). --list dials|tokens|parts|families|properties lists what a change can name; a subject then filters the list. Experimental: it may change or be removed in a patch release.',
16
+ fn: 'themeEditHow',
17
+ args: [
18
+ {
19
+ name: 'subject',
20
+ param: 'subject',
21
+ required: false,
22
+ variadic: true,
23
+ },
24
+ ],
25
+ options: [
26
+ {
27
+ flag: '--list <kind>',
28
+ param: 'options.list',
29
+ description:
30
+ 'List what a change can name: dials, tokens (with type, default and how many parts read each), parts (with component, family, variants and states), families, or properties (the common CSS properties; a filter searches every standard one). The subject, if any, filters the list',
31
+ },
32
+ {
33
+ flag: '--at <points...>',
34
+ param: 'options.at',
35
+ description:
36
+ 'With a PNG picture: the exact color at pixel points x,y, given as "40,20;300,180", "40,20 300,180", a repeated --at, or a flat "40,20,300,180"',
37
+ },
38
+ ],
39
+ examples: [
40
+ {
41
+ label: 'A part',
42
+ cli: 'astryx experimental theme editor how banner',
43
+ },
44
+ {
45
+ label: 'A question',
46
+ cli: 'astryx experimental theme editor how "bold white text in the header"',
47
+ },
48
+ {
49
+ label: 'A setting',
50
+ cli: 'astryx experimental theme editor how --color-accent',
51
+ },
52
+ {
53
+ label: 'Colors in a picture',
54
+ cli: 'astryx experimental theme editor how target.png --at "40,20;300,180"',
55
+ },
56
+ {
57
+ label: 'Every dial',
58
+ cli: 'astryx experimental theme editor how --list dials',
59
+ },
60
+ {
61
+ label: 'Accent tokens',
62
+ cli: 'astryx experimental theme editor how accent --list tokens',
63
+ },
64
+ ],
65
+ outsideProject: 'refuse',
66
+ notes: [
67
+ {
68
+ type: 'prose',
69
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme editor how 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}.",
70
+ },
71
+ ],
72
+ exitCodes: [
73
+ {
74
+ code: 0,
75
+ when: 'the usage (nothing named) or the answer (an empty answer or list included)',
76
+ },
77
+ {
78
+ code: 1,
79
+ when: 'an unknown option, an unknown --list kind, --at without a picture, a missing or unreadable PNG file, or an odd count of numbers in --at',
80
+ },
81
+ ],
82
+ related: ['experimental theme editor', 'experimental theme targets'],
83
+ replaces: ['theme targets'],
84
+ };
@@ -0,0 +1,66 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme editor new`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme editor new',
9
+ displayName: 'astryx experimental theme editor new',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary: 'Start a theme in themes/<theme>/, optionally on a built-in theme',
13
+ description:
14
+ 'Makes themes/<theme>/ with <theme>.settings.json (the settings this command owns), the generated <theme>.settings.ts, <theme>.theme.ts (which extends it and is yours), and the built <theme>.css and <theme>.js (the same build as `astryx theme build`), then writes preview.html, the sample app page with the theme. --like builds on a built-in theme (neutral, stone, matcha, y2k, gothic, chocolate, butter; its package must be installed); without it the theme starts from Astryx defaults. Change the base later with `astryx experimental theme editor set <theme> base <theme|none>`. Afterwards, <theme>.theme.ts is yours: it extends the generated <theme>.settings.ts, and every later change rewrites only the settings files, so your own edits in <theme>.theme.ts survive. A theme name is lowercase letters, digits and dashes. Experimental: it may change or be removed in a patch release.',
15
+ fn: 'themeEditNew',
16
+ args: [
17
+ {
18
+ name: 'theme',
19
+ param: 'theme',
20
+ required: true,
21
+ },
22
+ ],
23
+ options: [
24
+ {
25
+ flag: '--like <theme>',
26
+ param: 'options.like',
27
+ description:
28
+ 'A built-in theme to build on: neutral, stone, matcha, y2k, gothic, chocolate, or butter',
29
+ },
30
+ {
31
+ flag: '--png',
32
+ param: 'options.png',
33
+ description:
34
+ 'Also take PNG pictures of the previews (light and dark), with a Playwright installed in the project or a Chrome or Chromium found on the machine; without one, the result says how to get it. Nothing else changes',
35
+ },
36
+ ],
37
+ examples: [
38
+ {
39
+ label: 'Start on a built-in theme',
40
+ cli: 'astryx experimental theme editor new brand --like neutral',
41
+ },
42
+ {
43
+ label: 'Start from Astryx defaults',
44
+ cli: 'astryx experimental theme editor new brand',
45
+ },
46
+ ],
47
+ outsideProject: 'refuse',
48
+ notes: [
49
+ {
50
+ type: 'prose',
51
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme editor new 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}.",
52
+ },
53
+ ],
54
+ exitCodes: [
55
+ {
56
+ code: 0,
57
+ when: 'the theme is made and built, and its preview is written',
58
+ },
59
+ {
60
+ code: 1,
61
+ when: 'a name that is not lowercase letters, digits and dashes, a theme that already exists, a --like that is not a built-in theme or is not installed, no Core installed in the folder, or a build failure (nothing is left behind)',
62
+ },
63
+ ],
64
+ related: ['experimental theme editor', 'experimental theme compile'],
65
+ replaces: ['theme template', 'theme eject'],
66
+ };
@@ -0,0 +1,121 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme editor set`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme editor set',
9
+ displayName: 'astryx experimental theme editor set',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary:
13
+ 'Change one thing in a theme: checked against what the components read, built, previewed',
14
+ description:
15
+ "Changes one thing. The thing is a dial (corners, spacing, accent, font, headings, surfaces, buttons, type, text-size, base, mode: big moves with named rungs; `more`/`less` step a rung), a design token by name (--color-background-body; `how --list tokens`), or a CSS property on a part (background --on card; needs --on). Every change is CHECKED first against the installed Core: the part, the --when variant and value, the --state, the token's type (color, size, number, font, shadow; only colors and shadows may differ by mode), and whether the part, or a part inside it, actually reads the token for what you mean. A change that cannot take effect is REFUSED: exit 1, an error code, nothing written, and the suggestions lead with the command that works (the token the part really reads, or the property that sets it directly). Families: --on <family> styles every member; styling one member of an always-alike family (inputs, checks) styles the whole family unless --only. A setting on a part beats a whole-theme dial, and a dial never overwrites one. After building, a plain part setting that a more specific base-theme rule would beat (such as a heading level) is repeated on those variant keys, and the result says so. The result lists resolved token changes, part styles written, contrast problems this theme caused versus its base (text below 4.5:1), notes (accent text per mode, font loading), and writes themes/<theme>/preview.html. Values with spaces go in quotes: gradients, several shadows, font stacks. Dials: corners square|small|medium|large|round|pill|more|less|<size>; spacing tight|compact|medium|roomy|spacious|more|less; accent <color> (kept exact; accent text is made readable per mode); font <preset, open font, family or stack>; headings light|regular|medium|semibold|bold|heavy or tight|tighter|normal|wide; surfaces flat|outlined|raised|glass; buttons solid|outline|soft|caps; type compact|standard|editorial|display; text-size small|medium|large|larger|more|less|<number>; base <built-in theme>|none; mode both|light-only|dark-only. `astryx experimental theme editor how --list dials` explains each. Experimental: it may change or be removed in a patch release.",
16
+ fn: 'themeEditSet',
17
+ args: [
18
+ {
19
+ name: 'theme',
20
+ param: 'theme',
21
+ required: true,
22
+ },
23
+ {
24
+ name: 'thing',
25
+ param: 'thing',
26
+ required: true,
27
+ },
28
+ {
29
+ name: 'value',
30
+ param: 'value',
31
+ required: true,
32
+ variadic: true,
33
+ },
34
+ ],
35
+ options: [
36
+ {
37
+ flag: '--on <where>',
38
+ param: 'options.on',
39
+ description:
40
+ 'Where it applies (default: the whole theme): a part (button, card, app-shell-header; how --list parts), a family (inputs, containers, checks, menus; how --list families), or for font a role (body, heading, code)',
41
+ },
42
+ {
43
+ flag: '--when <prop:value>',
44
+ param: 'options.when',
45
+ description:
46
+ 'Only that variant of the part, such as variant:primary or status:error (how <part> lists them); needs --on',
47
+ },
48
+ {
49
+ flag: '--state <state>',
50
+ param: 'options.state',
51
+ description:
52
+ 'Only that state of the part: hover, active, focus-visible, disabled, or a state the part lists (selected...); needs --on',
53
+ },
54
+ {
55
+ flag: '--mode <mode>',
56
+ param: 'options.mode',
57
+ description:
58
+ 'light or dark: only that color mode. Colors and shadows only; sizes, numbers and fonts are the same in both modes, and a light-only or dark-only theme takes no --mode',
59
+ },
60
+ {
61
+ flag: '--only',
62
+ param: 'options.only',
63
+ description:
64
+ 'With one member of an always-alike family (inputs, checks), style just that part instead of the whole family',
65
+ },
66
+ {
67
+ flag: '--png',
68
+ param: 'options.png',
69
+ description:
70
+ 'Also take PNG pictures of the previews (light and dark), with a Playwright installed in the project or a Chrome or Chromium found on the machine; without one, the result says how to get it. Nothing else changes',
71
+ },
72
+ ],
73
+ examples: [
74
+ {
75
+ label: 'A big move with a dial',
76
+ cli: 'astryx experimental theme editor set brand corners pill',
77
+ },
78
+ {
79
+ label: 'Step a dial',
80
+ cli: 'astryx experimental theme editor set brand spacing more',
81
+ },
82
+ {
83
+ label: 'The brand color',
84
+ cli: 'astryx experimental theme editor set brand accent "#7c3aed"',
85
+ },
86
+ {
87
+ label: 'A token, dark mode only',
88
+ cli: 'astryx experimental theme editor set brand --color-text-primary "#e5e7eb" --mode dark',
89
+ },
90
+ {
91
+ label: 'A CSS property on a part',
92
+ cli: 'astryx experimental theme editor set brand background "linear-gradient(#f6d365, #fda085)" --on app-shell-header',
93
+ },
94
+ {
95
+ label: 'One variant in one state',
96
+ cli: 'astryx experimental theme editor set brand background-color "#f3e8ff" --on button --when variant:ghost --state hover',
97
+ },
98
+ {
99
+ label: 'Every input',
100
+ cli: 'astryx experimental theme editor set brand border "1px solid #9ca3af" --on inputs',
101
+ },
102
+ ],
103
+ outsideProject: 'refuse',
104
+ notes: [
105
+ {
106
+ type: 'prose',
107
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme editor set 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}.",
108
+ },
109
+ ],
110
+ exitCodes: [
111
+ {
112
+ code: 0,
113
+ when: 'the change is written, built and previewed (notes and contrast problems included)',
114
+ },
115
+ {
116
+ code: 1,
117
+ when: 'an unknown option, a refused change (an unknown part, variant, state, token or thing; a value of the wrong type; --mode on something that has no mode; a token the part never reads for that; corners on a part that shows no edge), a theme that does not exist, or a build failure; nothing is written',
118
+ },
119
+ ],
120
+ related: ['experimental theme editor', 'experimental theme compile'],
121
+ };
@@ -0,0 +1,66 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme editor show`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme editor show',
9
+ displayName: 'astryx experimental theme editor show',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary:
13
+ 'Every setting, key values, problems the theme caused, and the theme-building page with every component',
14
+ description:
15
+ 'Lists every setting with where it applies and its source (dial, token or property), the resolved value of key tokens in each mode, contrast problems this theme caused versus its base, and font notes. Writes two self-contained HTML files: preview.html (the sample app page) and sheet.html (the theme-building page: every component grouped, each variant side by side, overlays open, and real template pages, with an auto/light/dark switch; the same page `preview` makes). --group limits the sheet to one group. Experimental: it may change or be removed in a patch release.',
16
+ fn: 'themeEditShow',
17
+ args: [
18
+ {
19
+ name: 'theme',
20
+ param: 'theme',
21
+ required: true,
22
+ },
23
+ ],
24
+ options: [
25
+ {
26
+ flag: '--group <name>',
27
+ param: 'options.group',
28
+ description:
29
+ 'Only one group on the sheet: actions, inputs, selection, navigation, feedback, data, containers, overlays, or pages',
30
+ },
31
+ {
32
+ flag: '--png',
33
+ param: 'options.png',
34
+ description:
35
+ 'Also take PNG pictures of the previews (light and dark), with a Playwright installed in the project or a Chrome or Chromium found on the machine; without one, the result says how to get it. Nothing else changes',
36
+ },
37
+ ],
38
+ examples: [
39
+ {
40
+ label: 'Everything',
41
+ cli: 'astryx experimental theme editor show brand',
42
+ },
43
+ {
44
+ label: 'With pictures',
45
+ cli: 'astryx experimental theme editor show brand --png',
46
+ },
47
+ ],
48
+ outsideProject: 'refuse',
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 editor show 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}.",
53
+ },
54
+ ],
55
+ exitCodes: [
56
+ {
57
+ code: 0,
58
+ when: 'the settings are listed and both pages are written',
59
+ },
60
+ {
61
+ code: 1,
62
+ when: 'the theme does not exist, an unknown --group, or a page that does not render',
63
+ },
64
+ ],
65
+ related: ['experimental theme editor', 'experimental theme compile'],
66
+ };
@@ -0,0 +1,104 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx experimental theme editor undo`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'experimental theme editor undo',
9
+ displayName: 'astryx experimental theme editor undo',
10
+ namespace: 'cli/commands',
11
+ stability: 'experimental',
12
+ summary:
13
+ 'Step back one change, or remove one setting so it goes back to the base theme',
14
+ description:
15
+ "With only the theme, it steps back one change: the settings file, the theme source and the build go back to how they were before the last change, and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With a thing, it removes that one setting wherever it is in the settings, so it goes back to the base theme's value, and the theme is rebuilt and previewed. Name the setting the way it was set: the same thing and the same --on, --when, --state, --mode and --only (`show` lists every setting that way). For the headings dial, name which half: weight or tracking (default weight). A setting the theme does not have is refused and the error lists the settings it has for that thing. Experimental: it may change or be removed in a patch release.",
16
+ fn: 'themeEditUndo',
17
+ args: [
18
+ {
19
+ name: 'theme',
20
+ param: 'theme',
21
+ required: true,
22
+ },
23
+ {
24
+ name: 'thing',
25
+ param: 'options.thing',
26
+ required: false,
27
+ },
28
+ {
29
+ name: 'which',
30
+ param: 'options.value',
31
+ required: false,
32
+ },
33
+ ],
34
+ options: [
35
+ {
36
+ flag: '--on <where>',
37
+ param: 'options.on',
38
+ description:
39
+ 'Where it applies (default: the whole theme): a part (button, card, app-shell-header; how --list parts), a family (inputs, containers, checks, menus; how --list families), or for font a role (body, heading, code)',
40
+ },
41
+ {
42
+ flag: '--when <prop:value>',
43
+ param: 'options.when',
44
+ description:
45
+ 'Only that variant of the part, such as variant:primary or status:error (how <part> lists them); needs --on',
46
+ },
47
+ {
48
+ flag: '--state <state>',
49
+ param: 'options.state',
50
+ description:
51
+ 'Only that state of the part: hover, active, focus-visible, disabled, or a state the part lists (selected...); needs --on',
52
+ },
53
+ {
54
+ flag: '--mode <mode>',
55
+ param: 'options.mode',
56
+ description:
57
+ 'light or dark: only that color mode. Colors and shadows only; sizes, numbers and fonts are the same in both modes, and a light-only or dark-only theme takes no --mode',
58
+ },
59
+ {
60
+ flag: '--only',
61
+ param: 'options.only',
62
+ description:
63
+ 'With one member of an always-alike family (inputs, checks), style just that part instead of the whole family',
64
+ },
65
+ {
66
+ flag: '--png',
67
+ param: 'options.png',
68
+ description:
69
+ 'Also take PNG pictures of the previews (light and dark), with a Playwright installed in the project or a Chrome or Chromium found on the machine; without one, the result says how to get it. Nothing else changes',
70
+ },
71
+ ],
72
+ examples: [
73
+ {
74
+ label: 'Step back',
75
+ cli: 'astryx experimental theme editor undo brand',
76
+ },
77
+ {
78
+ label: 'Remove a whole-theme dial',
79
+ cli: 'astryx experimental theme editor undo brand corners',
80
+ },
81
+ {
82
+ label: 'Remove a part setting',
83
+ cli: 'astryx experimental theme editor undo brand background --on app-shell-header',
84
+ },
85
+ ],
86
+ outsideProject: 'refuse',
87
+ notes: [
88
+ {
89
+ type: 'prose',
90
+ text: "In global mode: outside a project, with no package.json in the folder or above it, experimental theme editor undo 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}.",
91
+ },
92
+ ],
93
+ exitCodes: [
94
+ {
95
+ code: 0,
96
+ when: 'the last change is undone, or the setting is removed',
97
+ },
98
+ {
99
+ code: 1,
100
+ when: 'an unknown option, there is no earlier change, the theme does not set the thing, or the theme does not exist',
101
+ },
102
+ ],
103
+ related: ['experimental theme editor', 'experimental theme editor show'],
104
+ };