@astryxdesign/cli 0.7.14-canary.gfb823d9 → 0.7.14

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 (135) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/api/component/_adapter.d.mts +15 -0
  3. package/api/component/_adapter.mjs +76 -0
  4. package/api/component/component.mjs +8 -1
  5. package/api/search/_named-keywords.d.mts +31 -0
  6. package/api/search/_named-keywords.mjs +177 -0
  7. package/api/search/search-index.mjs +8 -1
  8. package/api/search/search.d.mts +6 -1
  9. package/api/search/search.mjs +49 -8
  10. package/api/theme/_adapter.d.mts +33 -0
  11. package/api/theme/_adapter.mjs +352 -16
  12. package/api/theme/build/build.mjs +261 -10
  13. package/api/theme/eject/eject.mjs +13 -1
  14. package/api/theme/list/list.mjs +11 -2
  15. package/api/theme/palette/generate/color.d.mts +2 -0
  16. package/api/theme/palette/generate/color.mjs +1 -1
  17. package/api/theme/template/template.mjs +139 -6
  18. package/api/theme/theme.type.d.mts +15 -1
  19. package/api/theme/theme.type.mjs +9 -3
  20. package/api/theme/themeAdd.doc.mjs +1 -1
  21. package/api/theme/themeBuild.doc.mjs +10 -2
  22. package/api/theme/themeEject.doc.mjs +2 -2
  23. package/api/theme/themeListAvailable.doc.mjs +1 -1
  24. package/api/theme/themeRemove.doc.mjs +1 -1
  25. package/api/theme/themeTemplate.doc.mjs +8 -0
  26. package/api/theme/themeUse.doc.mjs +1 -1
  27. package/api/theme-edit/_adapter.d.mts +36 -2
  28. package/api/theme-edit/_adapter.mjs +340 -12
  29. package/api/theme-edit/_check.d.mts +28 -25
  30. package/api/theme-edit/_check.mjs +876 -308
  31. package/api/theme-edit/_color.d.mts +53 -4
  32. package/api/theme-edit/_color.mjs +406 -79
  33. package/api/theme-edit/_compiler.d.mts +14 -6
  34. package/api/theme-edit/_compiler.mjs +89 -59
  35. package/api/theme-edit/_context.d.mts +28 -8
  36. package/api/theme-edit/_context.mjs +142 -19
  37. package/api/theme-edit/_edit.d.mts +3 -1
  38. package/api/theme-edit/_edit.mjs +746 -76
  39. package/api/theme-edit/_how-commands.d.mts +91 -0
  40. package/api/theme-edit/_how-commands.mjs +269 -0
  41. package/api/theme-edit/_how-question.d.mts +57 -0
  42. package/api/theme-edit/_how-question.mjs +2574 -0
  43. package/api/theme-edit/_how.d.mts +27 -8
  44. package/api/theme-edit/_how.mjs +776 -175
  45. package/api/theme-edit/_overview.d.mts +9 -0
  46. package/api/theme-edit/_overview.mjs +296 -0
  47. package/api/theme-edit/_palette.d.mts +155 -15
  48. package/api/theme-edit/_palette.mjs +1446 -262
  49. package/api/theme-edit/_parts.mjs +61 -5
  50. package/api/theme-edit/_png.d.mts +18 -6
  51. package/api/theme-edit/_png.mjs +135 -25
  52. package/api/theme-edit/_preview-app.d.mts +32 -11
  53. package/api/theme-edit/_preview-app.mjs +1976 -285
  54. package/api/theme-edit/_preview.d.mts +39 -8
  55. package/api/theme-edit/_preview.mjs +367 -41
  56. package/api/theme-edit/_settings.d.mts +147 -11
  57. package/api/theme-edit/_settings.mjs +908 -99
  58. package/api/theme-edit/_tables.d.mts +4 -16
  59. package/api/theme-edit/_tables.mjs +51 -117
  60. package/api/theme-edit/theme-edit.type.d.mts +102 -66
  61. package/api/theme-edit/theme-edit.type.mjs +58 -40
  62. package/api/theme-edit/themeEditHow.doc.mjs +17 -6
  63. package/api/theme-edit/themeEditNew.doc.mjs +21 -5
  64. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +18 -5
  65. package/api/theme-edit/themeEditPreviewApp.doc.mjs +12 -9
  66. package/api/theme-edit/themeEditPreviewList.doc.mjs +11 -2
  67. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +29 -3
  68. package/api/theme-edit/themeEditSet.doc.mjs +14 -8
  69. package/api/theme-edit/themeEditShow.doc.mjs +10 -5
  70. package/api/theme-edit/themeEditUndo.doc.mjs +9 -4
  71. package/assets/discover/official-packages.json +4 -0
  72. package/assets/docs/tree/icon-sets.doc.mjs +3 -3
  73. package/assets/docs.generated.json +1 -0
  74. package/assets/icons/definitions/bookmarkAdd.doc.mjs +9 -0
  75. package/assets/icons/definitions/documentSearch.doc.mjs +9 -0
  76. package/assets/icons/definitions/keyboard.doc.mjs +9 -0
  77. package/assets/icons/definitions/paintBrush.doc.mjs +9 -0
  78. package/assets/icons/definitions/wallet.doc.mjs +9 -0
  79. package/assets/preview-app/gitignore +3 -0
  80. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +1 -1
  81. package/assets/templates/blocks/components/Lightbox/LightboxGallery.tsx +1 -1
  82. package/assets/templates/components.generated.json +1 -0
  83. package/assets/templates/pages/gallery-hero/page.tsx +8 -2
  84. package/assets/templates/pages/settings-dialog/template.doc.mjs +3 -3
  85. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  86. package/assets/templates/pages/table-filter/template.doc.mjs +2 -2
  87. package/assets/templates/pages/theme-showcase/template.doc.mjs +1 -1
  88. package/clients/cli/bin/astryx.mjs +37 -5
  89. package/clients/cli/commands/experimental/theme.mjs +422 -57
  90. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +22 -9
  91. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +103 -4
  92. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +13 -8
  93. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +5 -5
  94. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +5 -5
  95. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  96. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +3 -2
  97. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +2 -8
  98. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +2 -2
  99. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  100. package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -1
  101. package/clients/cli/commands/experimental-theme.doc.mjs +3 -4
  102. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  103. package/clients/cli/commands/theme-eject.doc.mjs +3 -3
  104. package/clients/cli/commands/theme-remove.doc.mjs +2 -2
  105. package/clients/cli/commands/theme-template.doc.mjs +11 -4
  106. package/clients/cli/commands/theme.mjs +145 -46
  107. package/clients/cli/commands.generated.json +1 -0
  108. package/clients/cli/index.mjs +96 -5
  109. package/clients/cli/lib/json-shim.mjs +29 -1
  110. package/foundation/config/project.d.mts +16 -2
  111. package/foundation/config/project.mjs +40 -6
  112. package/foundation/config/theme-state.d.mts +9 -0
  113. package/foundation/config/theme-state.mjs +20 -1
  114. package/foundation/discovery/template-adapter.d.mts +12 -1
  115. package/foundation/discovery/template-adapter.mjs +29 -4
  116. package/foundation/discovery/template-icons.d.mts +13 -0
  117. package/foundation/discovery/template-icons.mjs +76 -0
  118. package/foundation/discovery/template-needs.d.mts +7 -0
  119. package/foundation/discovery/template-needs.mjs +117 -8
  120. package/foundation/discovery/template-source-tree.d.mts +5 -1
  121. package/foundation/discovery/template-source-tree.mjs +6 -4
  122. package/foundation/discovery/theme-discovery.d.mts +14 -3
  123. package/foundation/discovery/theme-discovery.mjs +45 -12
  124. package/foundation/doc-compiler/import.mjs +68 -3
  125. package/foundation/doc-compiler/stored-docs.d.mts +27 -0
  126. package/foundation/doc-compiler/stored-docs.mjs +65 -0
  127. package/foundation/fs/fs-error.d.mts +17 -0
  128. package/foundation/fs/fs-error.mjs +34 -0
  129. package/foundation/response/error-codes.d.mts +3 -1
  130. package/foundation/response/error-codes.doc.mjs +13 -1
  131. package/foundation/response/error-codes.mjs +11 -1
  132. package/foundation/response/response-types.doc.mjs +6 -6
  133. package/package.json +6 -7
  134. package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +0 -73
  135. package/clients/cli/commands/experimental-theme-palette.doc.mjs +0 -37
@@ -22,14 +22,19 @@ export function search(query: string, options?: {
22
22
  * same way. A later query in the same folder, for the same `type`, gathers
23
23
  * again only when an input changed.
24
24
  *
25
+ * `ownKeywords` ranks as `search` reads keywords: a doc keyword that is
26
+ * another entry's name is not a match (_named-keywords.mjs). Only search's own
27
+ * comparisons set it; build never does, so build reads every keyword.
28
+ *
25
29
  * @param {string} query
26
- * @param {{cwd?: string, type?: 'component'|'hook'|'doc'|'template'|'theme', limit?: number}} [options]
30
+ * @param {{cwd?: string, type?: 'component'|'hook'|'doc'|'template'|'theme', limit?: number, ownKeywords?: boolean}} [options]
27
31
  * @returns {Promise<import('./search.type.mjs').SearchResponse>}
28
32
  */
29
33
  export function searchCore(query: string, options?: {
30
34
  cwd?: string;
31
35
  type?: "component" | "hook" | "doc" | "template" | "theme";
32
36
  limit?: number;
37
+ ownKeywords?: boolean;
33
38
  }): Promise<import("./search.type.mjs").SearchResponse>;
34
39
  export { scoreCandidate } from "./_candidate-score.mjs";
35
40
  export { scoreQuery } from "./_score.mjs";
@@ -11,7 +11,11 @@
11
11
  * block), and themes. The adapter gathers every candidate (_adapter.mjs),
12
12
  * and search's tree (tree.mjs) picks the searcher that answers.
13
13
  * `searchCore(query)` is the lexical ranker alone (_lexical.mjs); `build`
14
- * reads it, so build's output does not move when search's tree does.
14
+ * reads it, so build's output does not move when search's tree does. A doc
15
+ * keyword that is another entry's name is not a match (_named-keywords.mjs)
16
+ * in three places: `search`, `rankSearchIndex` (search-index.mjs), and
17
+ * `searchCore` with `ownKeywords`. `searchCore` without it, which build
18
+ * reads, reads every keyword as gathered.
15
19
  */
16
20
 
17
21
  import {
@@ -21,6 +25,7 @@ import {
21
25
  import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
22
26
  import {gatherCandidatesReused, loadSearchData} from './_adapter.mjs';
23
27
  import {rankLexical} from './_lexical.mjs';
28
+ import {searchView} from './_named-keywords.mjs';
24
29
  import {checkSearchArgs} from './_result.mjs';
25
30
  import {runTree} from '../../foundation/route/route.mjs';
26
31
  import {SEARCH_TREE} from './tree.mjs';
@@ -73,7 +78,10 @@ async function searchRead(query, options) {
73
78
  SEARCH_TREE,
74
79
  {query, options},
75
80
  {
76
- ...(await gatherCandidatesReused(options)),
81
+ // A keyword that names another entry is not a match here
82
+ // (_named-keywords.mjs); searchCore, which build reads,
83
+ // keeps every keyword.
84
+ ...(await searchCatalog(options)),
77
85
  data: loadSearchData(),
78
86
  },
79
87
  )
@@ -84,14 +92,41 @@ async function searchRead(query, options) {
84
92
  );
85
93
  }
86
94
 
95
+ /**
96
+ * The other declaring domain, whose names a search for one `type` still reads.
97
+ * @type {Record<string, string>}
98
+ */
99
+ const NAMING_DOMAIN = {component: 'hook', hook: 'component'};
100
+
101
+ /**
102
+ * The gathered catalog for `options`, with keywords as search reads them
103
+ * (_named-keywords.mjs). The names come from every component and hook, so a
104
+ * search for one `type` keeps and drops the keywords an open search does.
105
+ * @param {{cwd?: string, type?: string}} options
106
+ */
107
+ async function searchCatalog(options) {
108
+ const gathered = await gatherCandidatesReused(options);
109
+ const other = options.type == null ? null : NAMING_DOMAIN[options.type];
110
+ return searchView(
111
+ gathered,
112
+ other == null
113
+ ? []
114
+ : [await gatherCandidatesReused({cwd: options.cwd, type: other})],
115
+ );
116
+ }
117
+
87
118
  /**
88
119
  * The lexical ranker alone: keyword and fuzzy scoring of every candidate.
89
120
  * `build` ranks from it. It ranks the candidates search gathers, reused the
90
121
  * same way. A later query in the same folder, for the same `type`, gathers
91
122
  * again only when an input changed.
92
123
  *
124
+ * `ownKeywords` ranks as `search` reads keywords: a doc keyword that is
125
+ * another entry's name is not a match (_named-keywords.mjs). Only search's own
126
+ * comparisons set it; build never does, so build reads every keyword.
127
+ *
93
128
  * @param {string} query
94
- * @param {{cwd?: string, type?: 'component'|'hook'|'doc'|'template'|'theme', limit?: number}} [options]
129
+ * @param {{cwd?: string, type?: 'component'|'hook'|'doc'|'template'|'theme', limit?: number, ownKeywords?: boolean}} [options]
95
130
  * @returns {Promise<import('./search.type.mjs').SearchResponse>}
96
131
  */
97
132
  export async function searchCore(query, options = {}) {
@@ -108,10 +143,16 @@ export async function searchCore(query, options = {}) {
108
143
  * @param {any} options
109
144
  */
110
145
  async function searchCoreRead(query, options) {
111
- return withListingCache(async () =>
112
- linkSearchResponse(
113
- rankLexical(query, options, await gatherCandidatesReused(options)),
146
+ return withListingCache(async () => {
147
+ return linkSearchResponse(
148
+ rankLexical(
149
+ query,
150
+ options,
151
+ options.ownKeywords
152
+ ? await searchCatalog(options)
153
+ : await gatherCandidatesReused(options),
154
+ ),
114
155
  options.cwd ?? process.cwd(),
115
- ),
116
- );
156
+ );
157
+ });
117
158
  }
@@ -16,6 +16,19 @@ export function themeRecordOwner(theme: import("../../foundation/discovery/theme
16
16
  * @returns {BundledTheme[]}
17
17
  */
18
18
  export function listThemes(): BundledTheme[];
19
+ /**
20
+ * A local theme folder that failed validation and was left out.
21
+ * @typedef {{slug: string, path: string, reason: string}} SkippedLocalTheme
22
+ */
23
+ /**
24
+ * Available themes, and the local folders left out because they are broken.
25
+ * @param {string} [cwd]
26
+ * @returns {Promise<{themes: import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme[], skipped: SkippedLocalTheme[]}>}
27
+ */
28
+ export function listAvailableThemeState(cwd?: string): Promise<{
29
+ themes: import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme[];
30
+ skipped: SkippedLocalTheme[];
31
+ }>;
19
32
  /**
20
33
  * Bundled themes plus local and installed integration themes available to the
21
34
  * project.
@@ -61,6 +74,18 @@ export function ejectThemeFiles(theme: import("../../foundation/discovery/theme-
61
74
  targetPath?: string;
62
75
  overwrite?: boolean;
63
76
  }): string;
77
+ /**
78
+ * The packages the fork imports that the app does not declare. A fork that
79
+ * imports a missing package (bundled icon sets use `lucide-react`) fails to
80
+ * build, so the receipt names them with an install command.
81
+ * @param {string} outputDir fork folder, relative to cwd
82
+ * @param {string[]} files
83
+ * @param {string} cwd
84
+ */
85
+ export function forkNeeds(outputDir: string, files: string[], cwd: string): {
86
+ missingPackages: string[];
87
+ installCommand: string | null;
88
+ };
64
89
  /**
65
90
  * Resolve an available theme by case-insensitive slug and optional owner package.
66
91
  * Without an explicit package, a local theme shadows package themes that share
@@ -149,6 +174,14 @@ export function fetchCarriedThemeCoreDir(cwd: string): string | null;
149
174
  * A bundled theme entry kept for the historical public `listThemes()` helper.
150
175
  */
151
176
  export type BundledTheme = Pick<import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme, "slug" | "displayName" | "description" | "maintained" | "entry" | "exportName" | "files">;
177
+ /**
178
+ * A local theme folder that failed validation and was left out.
179
+ */
180
+ export type SkippedLocalTheme = {
181
+ slug: string;
182
+ path: string;
183
+ reason: string;
184
+ };
152
185
  import { readThemeState } from '../../foundation/config/theme-state.mjs';
153
186
  import { BUNDLED_THEME_PACKAGE } from '../../foundation/discovery/theme-discovery.mjs';
154
187
  import { THEMES_DIR } from '../../foundation/discovery/theme-discovery.mjs';