@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.
- package/README.md +18 -18
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/api/doctor/doctor.mjs +3 -7
- package/api/experimental.d.mts +2 -0
- package/api/experimental.mjs +12 -0
- package/api/icon/_adapter.d.mts +10 -0
- package/api/icon/_adapter.mjs +31 -2
- package/api/icon/_authoring.d.mts +2 -1
- package/api/icon/_authoring.mjs +91 -6
- package/api/icon/_options.mjs +1 -0
- package/api/icon/_records.d.mts +18 -0
- package/api/icon/_records.mjs +26 -0
- package/api/icon/add/add.mjs +7 -1
- package/api/icon/definitions/definitions.d.mts +12 -0
- package/api/icon/definitions/definitions.mjs +83 -0
- package/api/icon/icon.doc.mjs +5 -4
- package/api/icon/icon.mjs +5 -16
- package/api/icon/icon.type.d.mts +29 -2
- package/api/icon/icon.type.mjs +17 -3
- package/api/icon/iconAdd.doc.mjs +1 -1
- package/api/icon/iconMap.doc.mjs +2 -2
- package/api/icon/iconNewSet.doc.mjs +8 -2
- package/api/icon/map/map.mjs +21 -2
- package/api/icon/new-set/new-set.mjs +14 -2
- package/api/icon/search/search.mjs +2 -15
- package/api/icon/use/use.mjs +4 -3
- package/api/integration/validate-integration.mjs +6 -1
- package/api/integration/validate-integration.type.d.mts +12 -0
- package/api/integration/validate-integration.type.mjs +5 -0
- package/api/theme-edit/_adapter.d.mts +116 -0
- package/api/theme-edit/_adapter.mjs +1683 -0
- package/api/theme-edit/_catalog.d.mts +59 -0
- package/api/theme-edit/_catalog.mjs +564 -0
- package/api/theme-edit/_check.d.mts +49 -0
- package/api/theme-edit/_check.mjs +845 -0
- package/api/theme-edit/_color.d.mts +29 -0
- package/api/theme-edit/_color.mjs +300 -0
- package/api/theme-edit/_compiler.d.mts +61 -0
- package/api/theme-edit/_compiler.mjs +522 -0
- package/api/theme-edit/_css-properties.d.mts +10 -0
- package/api/theme-edit/_css-properties.mjs +556 -0
- package/api/theme-edit/_parts.d.mts +111 -0
- package/api/theme-edit/_parts.mjs +409 -0
- package/api/theme-edit/_png.d.mts +40 -0
- package/api/theme-edit/_png.mjs +187 -0
- package/api/theme-edit/_preview.d.mts +121 -0
- package/api/theme-edit/_preview.mjs +720 -0
- package/api/theme-edit/_project.d.mts +83 -0
- package/api/theme-edit/_project.mjs +289 -0
- package/api/theme-edit/_settings.d.mts +222 -0
- package/api/theme-edit/_settings.mjs +861 -0
- package/api/theme-edit/_tables.d.mts +132 -0
- package/api/theme-edit/_tables.mjs +700 -0
- package/api/theme-edit/theme-edit.d.mts +93 -0
- package/api/theme-edit/theme-edit.mjs +145 -0
- package/api/theme-edit/theme-edit.type.d.mts +413 -0
- package/api/theme-edit/theme-edit.type.mjs +233 -0
- package/api/theme-edit/themeEditHow.doc.d.mts +6 -0
- package/api/theme-edit/themeEditHow.doc.mjs +88 -0
- package/api/theme-edit/themeEditNew.doc.d.mts +6 -0
- package/api/theme-edit/themeEditNew.doc.mjs +89 -0
- package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +100 -0
- package/api/theme-edit/themeEditPreviewApp.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +84 -0
- package/api/theme-edit/themeEditPreviewList.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewList.doc.mjs +53 -0
- package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +6 -0
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +66 -0
- package/api/theme-edit/themeEditSet.doc.d.mts +6 -0
- package/api/theme-edit/themeEditSet.doc.mjs +165 -0
- package/api/theme-edit/themeEditShow.doc.d.mts +6 -0
- package/api/theme-edit/themeEditShow.doc.mjs +86 -0
- package/api/theme-edit/themeEditUndo.doc.d.mts +6 -0
- package/api/theme-edit/themeEditUndo.doc.mjs +124 -0
- package/assets/docs/color.doc.mjs +5 -5
- package/assets/docs/tree/icon-sets.doc.mjs +6 -2
- package/assets/docs/tree/tokens-border.doc.mjs +1 -1
- package/assets/docs/tree/tokens-color.doc.mjs +2 -2
- package/assets/docs/tree/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/tokens-duration.doc.mjs +1 -1
- package/assets/docs/tree/tokens-ease.doc.mjs +1 -1
- package/assets/docs/tree/tokens-focus.doc.mjs +1 -1
- package/assets/docs/tree/tokens-font-weight.doc.mjs +1 -1
- package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
- package/assets/docs/tree/tokens-shadow.doc.mjs +1 -1
- package/assets/docs/tree/tokens-size.doc.mjs +1 -1
- package/assets/docs/tree/tokens-spacing.doc.mjs +1 -1
- package/assets/docs/tree/tokens-syntax.doc.mjs +1 -1
- package/assets/docs/tree/tokens-text-size.doc.mjs +1 -1
- package/assets/docs/tree/tokens-type-scale.doc.mjs +1 -1
- package/assets/docs/tree/tokens-typography.doc.mjs +1 -1
- package/assets/icons/definitions/bank.doc.mjs +1 -1
- package/assets/icons/definitions/save.doc.mjs +1 -1
- package/assets/preview-app/README.md +6 -0
- package/assets/preview-app/css.d.ts +5 -0
- package/assets/preview-app/gitignore +1 -0
- package/assets/preview-app/next.config.mjs +6 -0
- package/assets/preview-app/package.json +23 -0
- package/assets/preview-app/src/app/globals.css +5 -0
- package/assets/preview-app/src/app/layout.tsx +21 -0
- package/assets/preview-app/src/app/page.tsx +94 -0
- package/assets/preview-app/src/app/providers.tsx +16 -0
- package/assets/preview-app/tsconfig.json +27 -0
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +2 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +2 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider03RtlDirection.doc.mjs +2 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider04Calendar.doc.mjs +2 -1
- package/assets/templates/blocks/components/Text/useTruncationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Text/useTruncationHookUsage.tsx +112 -0
- package/authoring/doctypes/_schema.d.mts +1 -0
- package/authoring/doctypes/_schema.mjs +1 -0
- package/authoring/doctypes/command/command.doc.mjs +7 -0
- package/authoring/doctypes/command/type.ts +3 -0
- package/authoring/doctypes/icon-set/parse.d.mts +7 -0
- package/authoring/doctypes/icon-set/parse.mjs +18 -8
- package/clients/cli/commands/doctor.mjs +33 -3
- package/clients/cli/commands/experimental/icon.mjs +67 -14
- package/clients/cli/commands/experimental/index.mjs +2 -0
- package/clients/cli/commands/experimental/theme.mjs +684 -0
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +7 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-add.doc.mjs +78 -0
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +97 -0
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +84 -0
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +66 -0
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +121 -0
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +66 -0
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +104 -0
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +49 -0
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +71 -0
- package/clients/cli/commands/experimental-theme-list.doc.mjs +49 -0
- package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +73 -0
- package/clients/cli/commands/experimental-theme-palette.doc.mjs +37 -0
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +86 -0
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +66 -0
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +48 -0
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +59 -0
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +40 -0
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme-targets.doc.mjs +61 -0
- package/clients/cli/commands/experimental-theme-template.doc.mjs +61 -0
- package/clients/cli/commands/experimental-theme-use.doc.mjs +55 -0
- package/clients/cli/commands/experimental-theme.doc.mjs +57 -0
- package/clients/cli/commands/experimental.doc.mjs +10 -3
- package/clients/cli/commands/theme.mjs +101 -34
- package/clients/cli/index.mjs +18 -0
- package/clients/cli/lib/define-command.mjs +3 -0
- package/foundation/discovery/icon-set-checks.d.mts +16 -1
- package/foundation/discovery/icon-set-checks.mjs +68 -7
- package/foundation/discovery/icon-set-discovery.d.mts +21 -6
- package/foundation/discovery/icon-set-discovery.mjs +17 -8
- package/foundation/discovery/template-icon-meanings.d.mts +39 -0
- package/foundation/discovery/template-icon-meanings.mjs +95 -0
- package/foundation/discovery/theming-targets.d.mts +6 -0
- package/foundation/discovery/theming-targets.mjs +33 -0
- package/foundation/response/error-codes.d.mts +12 -1
- package/foundation/response/error-codes.doc.mjs +66 -0
- package/foundation/response/error-codes.mjs +55 -0
- package/foundation/response/response-types.doc.mjs +55 -0
- package/foundation/text/template-meanings-line.d.mts +16 -0
- package/foundation/text/template-meanings-line.mjs +37 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -96,24 +96,24 @@ Each command declares what it does in a folder outside any project, and `astryx
|
|
|
96
96
|
|
|
97
97
|
<!-- BEGIN GENERATED: commands -->
|
|
98
98
|
|
|
99
|
-
| Command | Description
|
|
100
|
-
| -------------- |
|
|
101
|
-
| `blog` | Read the Astryx blog from the published feed
|
|
102
|
-
| `build` | Build a page: the template to start from, or the workflow playbook (no query)
|
|
103
|
-
| `component` | List components or print component docs
|
|
104
|
-
| `discover` | Browse and search integrations: the ones you have and the ones you could add
|
|
105
|
-
| `docs` | Print reference docs
|
|
106
|
-
| `doctor` | Diagnose Astryx projects and integration packages
|
|
107
|
-
| `experimental` | [experimental] Try features that may change in a patch release: icon sets
|
|
108
|
-
| `gap-report` | Report a missing component or feature to the package that owns it
|
|
109
|
-
| `hook` | List hooks or print hook docs
|
|
110
|
-
| `init` | Initialize the design system in your project
|
|
111
|
-
| `integration` | Author and verify an Astryx integration package
|
|
112
|
-
| `search` | Search components, hooks, docs, templates, and themes in one ranked list
|
|
113
|
-
| `swizzle` | Copy component source for customization
|
|
114
|
-
| `template` | List, show, or scaffold page and block templates
|
|
115
|
-
| `theme` | Add, switch, build, and author themes
|
|
116
|
-
| `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components
|
|
99
|
+
| Command | Description | Outside a project |
|
|
100
|
+
| -------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------- |
|
|
101
|
+
| `blog` | Read the Astryx blog from the published feed | `same` |
|
|
102
|
+
| `build` | Build a page: the template to start from, or the workflow playbook (no query) | `same` |
|
|
103
|
+
| `component` | List components or print component docs | `same` |
|
|
104
|
+
| `discover` | Browse and search integrations: the ones you have and the ones you could add | `same` |
|
|
105
|
+
| `docs` | Print reference docs | `same` |
|
|
106
|
+
| `doctor` | Diagnose Astryx projects and integration packages | `own` |
|
|
107
|
+
| `experimental` | [experimental] Try features that may change in a patch release: icon sets, page rendering, checked theme editing | by subcommand |
|
|
108
|
+
| `gap-report` | Report a missing component or feature to the package that owns it | `same` |
|
|
109
|
+
| `hook` | List hooks or print hook docs | `same` |
|
|
110
|
+
| `init` | Initialize the design system in your project | `own` |
|
|
111
|
+
| `integration` | Author and verify an Astryx integration package | by subcommand |
|
|
112
|
+
| `search` | Search components, hooks, docs, templates, and themes in one ranked list | `same` |
|
|
113
|
+
| `swizzle` | Copy component source for customization | `refuse` |
|
|
114
|
+
| `template` | List, show, or scaffold page and block templates | `same` |
|
|
115
|
+
| `theme` | Add, switch, build, and author themes | by subcommand |
|
|
116
|
+
| `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components | `own` |
|
|
117
117
|
|
|
118
118
|
<!-- END GENERATED: commands -->
|
|
119
119
|
<!-- Generated by scripts/generate-cli-readme.mjs from `astryx manifest`. Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
@@ -303,5 +303,5 @@ useTableSortableState useTableSortableState Table/plugins/sortable/useTableSorta
|
|
|
303
303
|
useToastGesture useToastGesture Toast/Toast.doc.mjs Toast/useToastGesture.ts
|
|
304
304
|
useTouchTrigger useTouchTrigger Layer/Layer.doc.mjs Layer/useTouchTrigger.ts
|
|
305
305
|
useTriggerMenu useTriggerMenu Chat/Chat.doc.mjs Chat/useTriggerMenu.tsx
|
|
306
|
-
useTruncation useTruncation Text/
|
|
306
|
+
useTruncation useTruncation Text/useTruncation.doc.mjs Text/useTruncation.ts
|
|
307
307
|
utils utils Calendar/Calendar.doc.mjs Calendar/utils.ts
|
package/api/doctor/doctor.mjs
CHANGED
|
@@ -1061,13 +1061,9 @@ export function checkIconSets(ctx) {
|
|
|
1061
1061
|
}
|
|
1062
1062
|
const order = choice.order ?? [];
|
|
1063
1063
|
const unlisted = sets.filter(set => !order.includes(set));
|
|
1064
|
-
if (sets.length > 1 && unlisted.length > 0) {
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
list[0].selector,
|
|
1068
|
-
list.slice(1).map(each => each.selector),
|
|
1069
|
-
unlisted.map(set => `${set.package}/${set.name}`),
|
|
1070
|
-
);
|
|
1064
|
+
if (sets.length > 1 && unlisted.length > 0 && order.length > 0) {
|
|
1065
|
+
const [main, ...backups] = order;
|
|
1066
|
+
const {problem, fix} = unlistedIconSets(sets, main, backups, unlisted);
|
|
1071
1067
|
return {
|
|
1072
1068
|
id,
|
|
1073
1069
|
label,
|
package/api/experimental.d.mts
CHANGED
|
@@ -3,3 +3,5 @@
|
|
|
3
3
|
|
|
4
4
|
export { render } from "./render/render.mjs";
|
|
5
5
|
export * from "./render/render.type.mjs";
|
|
6
|
+
export * from "./theme-edit/theme-edit.type.mjs";
|
|
7
|
+
export { themeEditNew, themeEditSet, themeEditShow, themeEditUndo, themeEditPreviewAdd, themeEditPreviewApp, themeEditPreviewList, themeEditPreviewRemove, themeEditHow } from "./theme-edit/theme-edit.mjs";
|
package/api/experimental.mjs
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
export {render} from './render/render.mjs';
|
|
13
|
+
export {
|
|
14
|
+
themeEditNew,
|
|
15
|
+
themeEditSet,
|
|
16
|
+
themeEditShow,
|
|
17
|
+
themeEditUndo,
|
|
18
|
+
themeEditPreviewAdd,
|
|
19
|
+
themeEditPreviewApp,
|
|
20
|
+
themeEditPreviewList,
|
|
21
|
+
themeEditPreviewRemove,
|
|
22
|
+
themeEditHow,
|
|
23
|
+
} from './theme-edit/theme-edit.mjs';
|
|
13
24
|
|
|
14
25
|
// Types (runtime no-ops; tsc carries them into api/experimental.d.mts).
|
|
15
26
|
export * from './render/render.type.mjs';
|
|
27
|
+
export * from './theme-edit/theme-edit.type.mjs';
|
package/api/icon/_adapter.d.mts
CHANGED
|
@@ -49,8 +49,18 @@ export function loadIconProject(cwd: string): Promise<{
|
|
|
49
49
|
export function iconSetConfigCliWarning(projectDir: string, options?: {
|
|
50
50
|
list?: boolean;
|
|
51
51
|
}): string | null;
|
|
52
|
+
/**
|
|
53
|
+
* The icon definitions the bundled templates use that a set of the local
|
|
54
|
+
* icon-set package leaves unmapped, read from the set's files as they are
|
|
55
|
+
* now; null when the package has no such set.
|
|
56
|
+
* @param {string} cwd
|
|
57
|
+
* @param {string | undefined} selector the set's name
|
|
58
|
+
* @returns {Promise<import('./icon.type.mjs').IconTemplateMeanings | null>}
|
|
59
|
+
*/
|
|
60
|
+
export function templateMeaningsOf(cwd: string, selector: string | undefined): Promise<import("./icon.type.mjs").IconTemplateMeanings | null>;
|
|
52
61
|
export { astryxIconDefinitions } from "../../foundation/discovery/icon-definition-discovery.mjs";
|
|
53
62
|
export { exportValueKind } from "../../foundation/discovery/module-exports.mjs";
|
|
63
|
+
export { templateIconMeanings } from "../../foundation/discovery/template-icon-meanings.mjs";
|
|
54
64
|
export { iconRecord, importLine, leadingReading, matchIcon, answeringMatches, rankIcons, scoreIcon } from "../../foundation/discovery/icon-ranking.mjs";
|
|
55
65
|
export { iconSetKey, ICON_USE_ORDER_COMMAND, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
|
|
56
66
|
export { setConfigString, setConfigValue } from "../../foundation/config/config-writer.mjs";
|
package/api/icon/_adapter.mjs
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @file The `icon` subject's adapter: its only access to the environment.
|
|
5
5
|
* Loads the project and reads its icon sets through the `Project` seam.
|
|
6
6
|
*
|
|
7
|
-
* @position api/icon — adapter for api/icon/{search,detail,list,
|
|
8
|
-
* new-set,new-definition}; it also carries the icon ranking, the icon-set
|
|
7
|
+
* @position api/icon — adapter for api/icon/{search,detail,list,definitions,
|
|
8
|
+
* use,map,add,new-set,new-definition}; it also carries the icon ranking, the icon-set
|
|
9
9
|
* writer, the set and definition authoring writes, the default-look
|
|
10
10
|
* rule, and the config writer the leaves use
|
|
11
11
|
*/
|
|
@@ -22,6 +22,11 @@ import {
|
|
|
22
22
|
import {PathSafetyError} from '../../foundation/fs/path-safety.mjs';
|
|
23
23
|
import {isOutsideProject} from '../../foundation/env/project-scope.mjs';
|
|
24
24
|
import {projectIconSetCliWarning} from '../../foundation/integrations/cli-requirement.mjs';
|
|
25
|
+
import {findLocalIconSet} from '../../foundation/discovery/icon-set-writer.mjs';
|
|
26
|
+
import {
|
|
27
|
+
templateIconMeanings,
|
|
28
|
+
unmappedTemplateMeanings,
|
|
29
|
+
} from '../../foundation/discovery/template-icon-meanings.mjs';
|
|
25
30
|
|
|
26
31
|
export {
|
|
27
32
|
iconRecord,
|
|
@@ -76,6 +81,7 @@ export {
|
|
|
76
81
|
THEME_MAP_NAME,
|
|
77
82
|
} from '../../foundation/discovery/icon-set-writer.mjs';
|
|
78
83
|
export {exportValueKind} from '../../foundation/discovery/module-exports.mjs';
|
|
84
|
+
export {templateIconMeanings} from '../../foundation/discovery/template-icon-meanings.mjs';
|
|
79
85
|
export {addIconDefinition, addIconSet} from './_authoring.mjs';
|
|
80
86
|
export {checkVariantLook, drawnLooks} from './_default-look.mjs';
|
|
81
87
|
|
|
@@ -198,3 +204,26 @@ export function iconSetConfigCliWarning(projectDir, options = {}) {
|
|
|
198
204
|
}
|
|
199
205
|
return projectIconSetCliWarning(pkg, options);
|
|
200
206
|
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The icon definitions the bundled templates use that a set of the local
|
|
210
|
+
* icon-set package leaves unmapped, read from the set's files as they are
|
|
211
|
+
* now; null when the package has no such set.
|
|
212
|
+
* @param {string} cwd
|
|
213
|
+
* @param {string | undefined} selector the set's name
|
|
214
|
+
* @returns {Promise<import('./icon.type.mjs').IconTemplateMeanings | null>}
|
|
215
|
+
*/
|
|
216
|
+
export async function templateMeaningsOf(cwd, selector) {
|
|
217
|
+
let set;
|
|
218
|
+
try {
|
|
219
|
+
({set} = await findLocalIconSet(cwd, selector));
|
|
220
|
+
} catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
unmapped: unmappedTemplateMeanings(
|
|
225
|
+
await templateIconMeanings(),
|
|
226
|
+
set.data.map,
|
|
227
|
+
),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* discoverable; `integration check` then names every built-in icon
|
|
9
9
|
* definition it still has to map.
|
|
10
10
|
* @param {string} name icon set name (kebab-case)
|
|
11
|
-
* @param {{cwd?: string, dryRun?: boolean, from?: string, exclude?: string[] | string, variants?: string[] | string, defaultVariant?: string, displayName?: string, description?: string}} options
|
|
11
|
+
* @param {{cwd?: string, dryRun?: boolean, from?: string, exclude?: string[] | string, adapter?: string, variants?: string[] | string, defaultVariant?: string, displayName?: string, description?: string}} options
|
|
12
12
|
* @returns {Promise<{type: 'integration.add', data: import('./icon.type.mjs').IconNewData}>}
|
|
13
13
|
*/
|
|
14
14
|
export function addIconSet(name: string, options: {
|
|
@@ -16,6 +16,7 @@ export function addIconSet(name: string, options: {
|
|
|
16
16
|
dryRun?: boolean;
|
|
17
17
|
from?: string;
|
|
18
18
|
exclude?: string[] | string;
|
|
19
|
+
adapter?: string;
|
|
19
20
|
variants?: string[] | string;
|
|
20
21
|
defaultVariant?: string;
|
|
21
22
|
displayName?: string;
|
package/api/icon/_authoring.mjs
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
resolveDefaultLook,
|
|
63
63
|
} from './_default-look.mjs';
|
|
64
64
|
import {shellArg} from '../../foundation/text/shell-arg.mjs';
|
|
65
|
+
import {isPackagePath} from '../../authoring/doctypes/icon-set/parse.mjs';
|
|
65
66
|
import {
|
|
66
67
|
hasLicenseNotice,
|
|
67
68
|
licenseNoticeFix,
|
|
@@ -91,6 +92,45 @@ const ICON_SETS_ROOT_KEY = 'experimental.iconSets';
|
|
|
91
92
|
|
|
92
93
|
// ── Icon set ────────────────────────────────────────────────────────
|
|
93
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Read `--adapter <module>#<export>`: a `./` path from the package root and
|
|
97
|
+
* a named export. Null when it is not given.
|
|
98
|
+
* @param {unknown} value
|
|
99
|
+
* @returns {{module: string, export: string} | null}
|
|
100
|
+
*/
|
|
101
|
+
function adapterOption(value) {
|
|
102
|
+
if (value == null || value === '') return null;
|
|
103
|
+
const match =
|
|
104
|
+
typeof value === 'string'
|
|
105
|
+
? /^(\.\/[^#\s]+)#([$A-Z_a-z][$\w]*)$/u.exec(value.trim())
|
|
106
|
+
: null;
|
|
107
|
+
if (!match || !isPackagePath(match[1])) {
|
|
108
|
+
throw new AstryxError(
|
|
109
|
+
`Invalid --adapter "${String(value)}": name a file in your package and its named export, as ./<path>#<export>, such as ./src/adapt.js#adaptIcon.`,
|
|
110
|
+
undefined,
|
|
111
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return {module: match[1], export: match[2]};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The adapter, once its file is known to be in the package and to exist.
|
|
119
|
+
* @param {{module: string, export: string}} adapter
|
|
120
|
+
* @param {string} packageDir
|
|
121
|
+
*/
|
|
122
|
+
function checkedAdapter(adapter, packageDir) {
|
|
123
|
+
const file = assertWithin(adapter.module, packageDir, {label: 'adapter'});
|
|
124
|
+
if (!fs.existsSync(file)) {
|
|
125
|
+
throw new AstryxError(
|
|
126
|
+
`The adapter module ${adapter.module} does not exist. Write the function that turns one icon export into a component there, export it as ${adapter.export}, and run this command again.`,
|
|
127
|
+
undefined,
|
|
128
|
+
ERROR_CODES.ERR_NOT_FOUND,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
return adapter;
|
|
132
|
+
}
|
|
133
|
+
|
|
94
134
|
/**
|
|
95
135
|
* A single-quoted JavaScript string literal for any text.
|
|
96
136
|
* @param {string} value
|
|
@@ -110,7 +150,7 @@ function quoteJs(value) {
|
|
|
110
150
|
* discoverable; `integration check` then names every built-in icon
|
|
111
151
|
* definition it still has to map.
|
|
112
152
|
* @param {string} name icon set name (kebab-case)
|
|
113
|
-
* @param {{cwd?: string, dryRun?: boolean, from?: string, exclude?: string[] | string, variants?: string[] | string, defaultVariant?: string, displayName?: string, description?: string}} options
|
|
153
|
+
* @param {{cwd?: string, dryRun?: boolean, from?: string, exclude?: string[] | string, adapter?: string, variants?: string[] | string, defaultVariant?: string, displayName?: string, description?: string}} options
|
|
114
154
|
* @returns {Promise<{type: 'integration.add', data: import('./icon.type.mjs').IconNewData}>}
|
|
115
155
|
*/
|
|
116
156
|
export async function addIconSet(name, options) {
|
|
@@ -130,6 +170,7 @@ export async function addIconSet(name, options) {
|
|
|
130
170
|
ERROR_CODES.ERR_INVALID_OPTION,
|
|
131
171
|
);
|
|
132
172
|
}
|
|
173
|
+
const adapterSpec = adapterOption(options.adapter);
|
|
133
174
|
if (!KEBAB_NAME_RE.test(name)) {
|
|
134
175
|
throw new AstryxError(
|
|
135
176
|
`Invalid icon set name "${name}": use lowercase kebab-case starting with a letter.`,
|
|
@@ -194,6 +235,9 @@ export async function addIconSet(name, options) {
|
|
|
194
235
|
throw error;
|
|
195
236
|
}
|
|
196
237
|
|
|
238
|
+
const adapter = adapterSpec
|
|
239
|
+
? checkedAdapter(adapterSpec, packageDir)
|
|
240
|
+
: undefined;
|
|
197
241
|
const setDir = assertWithin(name, root, {label: 'icon set directory'});
|
|
198
242
|
const docFile = assertWithin(`${name}.doc.mjs`, setDir, {
|
|
199
243
|
label: 'icon set descriptor',
|
|
@@ -208,6 +252,7 @@ export async function addIconSet(name, options) {
|
|
|
208
252
|
dryRun,
|
|
209
253
|
from,
|
|
210
254
|
exclude,
|
|
255
|
+
adapter,
|
|
211
256
|
looks: given,
|
|
212
257
|
describe: {
|
|
213
258
|
displayName: options.displayName,
|
|
@@ -225,6 +270,7 @@ export async function addIconSet(name, options) {
|
|
|
225
270
|
fs.existsSync(docFile) &&
|
|
226
271
|
fs.existsSync(dataFile) &&
|
|
227
272
|
(given != null ||
|
|
273
|
+
adapter != null ||
|
|
228
274
|
options.displayName?.trim() ||
|
|
229
275
|
options.description?.trim())
|
|
230
276
|
) {
|
|
@@ -232,6 +278,7 @@ export async function addIconSet(name, options) {
|
|
|
232
278
|
cwd,
|
|
233
279
|
dryRun,
|
|
234
280
|
looks: given,
|
|
281
|
+
adapter,
|
|
235
282
|
describe: {
|
|
236
283
|
displayName: options.displayName,
|
|
237
284
|
description: options.description,
|
|
@@ -285,6 +332,7 @@ export async function addIconSet(name, options) {
|
|
|
285
332
|
resolveIconSource(from, {packageDir, pkg}),
|
|
286
333
|
);
|
|
287
334
|
const found = libraryIcons(source.file, {
|
|
335
|
+
adapter: adapter != null,
|
|
288
336
|
exclude,
|
|
289
337
|
// The library's look words decide the default before any glyph is
|
|
290
338
|
// picked, so each icon's export draws it.
|
|
@@ -307,7 +355,7 @@ export async function addIconSet(name, options) {
|
|
|
307
355
|
});
|
|
308
356
|
if (found.length === 0) {
|
|
309
357
|
throw new AstryxError(
|
|
310
|
-
`"${from}" exports no icon components this command can read. If its icons are data (objects or SVG strings),
|
|
358
|
+
`"${from}" exports no icon components this command can read. If its icons are data (objects or SVG strings), write a function in your package that turns one into a component and run this command again with \`--adapter ./<path>#<export>\`; or add icons one at a time with \`astryx experimental icon add <Export> --from ${from} --set ${name}\`.`,
|
|
311
359
|
undefined,
|
|
312
360
|
ERROR_CODES.ERR_NOT_FOUND,
|
|
313
361
|
);
|
|
@@ -336,6 +384,7 @@ export async function addIconSet(name, options) {
|
|
|
336
384
|
: {}),
|
|
337
385
|
...(exclude.length > 0 ? {exclude: [...new Set(exclude)].sort()} : {}),
|
|
338
386
|
generated,
|
|
387
|
+
...(adapter ? {adapter} : {}),
|
|
339
388
|
...(looks
|
|
340
389
|
? {variants: looks.variants, default: {variant: looks.default}}
|
|
341
390
|
: {}),
|
|
@@ -599,15 +648,43 @@ function describedDoc(source, describe) {
|
|
|
599
648
|
* name its looks moves it. With none declared,
|
|
600
649
|
* its default is the look its icons' exports draw.
|
|
601
650
|
* @param {string} name
|
|
602
|
-
* @param {{cwd: string, dryRun: boolean, looks: Looks | null, describe: {displayName?: string, description?: string}, packageDir: string, rootPath: string, manifestPath: string}} options
|
|
651
|
+
* @param {{cwd: string, dryRun: boolean, looks: Looks | null, adapter?: {module: string, export: string}, describe: {displayName?: string, description?: string}, packageDir: string, rootPath: string, manifestPath: string}} options
|
|
603
652
|
*/
|
|
604
653
|
async function redeclareIconSet(
|
|
605
654
|
name,
|
|
606
|
-
{
|
|
655
|
+
{
|
|
656
|
+
cwd,
|
|
657
|
+
dryRun,
|
|
658
|
+
looks: given,
|
|
659
|
+
adapter,
|
|
660
|
+
describe,
|
|
661
|
+
packageDir,
|
|
662
|
+
rootPath,
|
|
663
|
+
manifestPath,
|
|
664
|
+
},
|
|
607
665
|
) {
|
|
608
666
|
return iconAuthoring(async () => {
|
|
609
667
|
const where = await findLocalIconSet(cwd, name);
|
|
610
668
|
const {set} = where;
|
|
669
|
+
// The generated module already adapts the set's icons with the declared
|
|
670
|
+
// adapter: another one takes effect only when the icons are wrapped
|
|
671
|
+
// again.
|
|
672
|
+
if (
|
|
673
|
+
adapter &&
|
|
674
|
+
set.data.icons.length > 0 &&
|
|
675
|
+
JSON.stringify(adapter) !== JSON.stringify(set.data.adapter ?? null)
|
|
676
|
+
) {
|
|
677
|
+
throw new AstryxError(
|
|
678
|
+
`Icon set "${name}" already has icons. Pass --adapter with --from to wrap the library again through it.`,
|
|
679
|
+
[
|
|
680
|
+
{
|
|
681
|
+
name: `astryx experimental icon new-set ${name} --from <module> --adapter ${adapter.module}#${adapter.export}`,
|
|
682
|
+
reason: 'wrap the library again through the adapter',
|
|
683
|
+
},
|
|
684
|
+
],
|
|
685
|
+
ERROR_CODES.ERR_INVALID_OPTION,
|
|
686
|
+
);
|
|
687
|
+
}
|
|
611
688
|
const current = set.data.default?.variant;
|
|
612
689
|
const drawn =
|
|
613
690
|
given && set.data.icons.length > 0
|
|
@@ -657,6 +734,7 @@ async function redeclareIconSet(
|
|
|
657
734
|
}
|
|
658
735
|
const next = {
|
|
659
736
|
...set.data,
|
|
737
|
+
...(adapter ? {adapter} : {}),
|
|
660
738
|
...(looks
|
|
661
739
|
? {variants: looks.variants, default: {variant: looks.default}}
|
|
662
740
|
: {}),
|
|
@@ -1006,7 +1084,7 @@ function claimRootMoves(set, origins, root, moves) {
|
|
|
1006
1084
|
* them), the generated module gains the new exports, `map` keeps every entry
|
|
1007
1085
|
* whose icon still exists, and the receipt names the entries that lost theirs.
|
|
1008
1086
|
* @param {string} name
|
|
1009
|
-
* @param {{cwd: string, dryRun: boolean, from: string, exclude: string[], looks: Looks | null, describe: {displayName?: string, description?: string}, packageDir: string, rootPath: string, manifestPath: string}} options
|
|
1087
|
+
* @param {{cwd: string, dryRun: boolean, from: string, exclude: string[], adapter?: {module: string, export: string}, looks: Looks | null, describe: {displayName?: string, description?: string}, packageDir: string, rootPath: string, manifestPath: string}} options
|
|
1010
1088
|
*/
|
|
1011
1089
|
async function refreshIconSet(
|
|
1012
1090
|
name,
|
|
@@ -1015,6 +1093,7 @@ async function refreshIconSet(
|
|
|
1015
1093
|
dryRun,
|
|
1016
1094
|
from,
|
|
1017
1095
|
exclude,
|
|
1096
|
+
adapter,
|
|
1018
1097
|
looks: given,
|
|
1019
1098
|
describe,
|
|
1020
1099
|
packageDir,
|
|
@@ -1025,6 +1104,12 @@ async function refreshIconSet(
|
|
|
1025
1104
|
return iconAuthoring(async () => {
|
|
1026
1105
|
const where = await findLocalIconSet(cwd, name);
|
|
1027
1106
|
const {set} = where;
|
|
1107
|
+
// A given adapter replaces the declared one before the library is read,
|
|
1108
|
+
// so its data exports become icons through it.
|
|
1109
|
+
if (adapter) set.data = {...set.data, adapter};
|
|
1110
|
+
// Wrapping a library into a set with no icons yet creates its icons:
|
|
1111
|
+
// the receipt says so, not that it refreshed them.
|
|
1112
|
+
const hadIcons = set.data.icons.length > 0;
|
|
1028
1113
|
const current = set.data.default?.variant;
|
|
1029
1114
|
const source = resolveIconSource(from, where);
|
|
1030
1115
|
// Exports left out before stay out; --exclude adds to them.
|
|
@@ -1388,7 +1473,7 @@ async function refreshIconSet(
|
|
|
1388
1473
|
dryRun,
|
|
1389
1474
|
);
|
|
1390
1475
|
result.data.icons = icons.length;
|
|
1391
|
-
result.data.refreshed = true;
|
|
1476
|
+
if (hadIcons) result.data.refreshed = true;
|
|
1392
1477
|
if (where.moduleUpdate) result.data.moduleUpdate = where.moduleUpdate;
|
|
1393
1478
|
// Every entry an exact name gives, kept or new, so a refresh lists
|
|
1394
1479
|
// them for review again.
|
package/api/icon/_options.mjs
CHANGED
package/api/icon/_records.d.mts
CHANGED
|
@@ -47,6 +47,24 @@ export function unusableSet(sets: Array<{
|
|
|
47
47
|
package: string;
|
|
48
48
|
reason: string;
|
|
49
49
|
}>, selector: string): AstryxError;
|
|
50
|
+
/**
|
|
51
|
+
* The one valid installed set a selector names. Throws `ERR_NOT_FOUND` when
|
|
52
|
+
* it names none (see `unusableSet`), and `ERR_INVALID_ARGUMENT` when it names
|
|
53
|
+
* more than one, so the caller names the package too.
|
|
54
|
+
* @template {{name: string, package: string}} T
|
|
55
|
+
* @param {T[]} sets the valid sets
|
|
56
|
+
* @param {Array<{name: string, package: string, reason: string}>} withdrawn
|
|
57
|
+
* @param {string} selector
|
|
58
|
+
* @returns {T}
|
|
59
|
+
*/
|
|
60
|
+
export function oneNamedSet<T extends {
|
|
61
|
+
name: string;
|
|
62
|
+
package: string;
|
|
63
|
+
}>(sets: T[], withdrawn: Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
package: string;
|
|
66
|
+
reason: string;
|
|
67
|
+
}>, selector: string): T;
|
|
50
68
|
/**
|
|
51
69
|
* Suggestions for a name that matched nothing: the closest candidates first.
|
|
52
70
|
* @param {string} wanted
|
package/api/icon/_records.mjs
CHANGED
|
@@ -79,6 +79,32 @@ export function unusableSet(sets, withdrawn, selector) {
|
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* The one valid installed set a selector names. Throws `ERR_NOT_FOUND` when
|
|
84
|
+
* it names none (see `unusableSet`), and `ERR_INVALID_ARGUMENT` when it names
|
|
85
|
+
* more than one, so the caller names the package too.
|
|
86
|
+
* @template {{name: string, package: string}} T
|
|
87
|
+
* @param {T[]} sets the valid sets
|
|
88
|
+
* @param {Array<{name: string, package: string, reason: string}>} withdrawn
|
|
89
|
+
* @param {string} selector
|
|
90
|
+
* @returns {T}
|
|
91
|
+
*/
|
|
92
|
+
export function oneNamedSet(sets, withdrawn, selector) {
|
|
93
|
+
const named = setsNamed(sets, selector);
|
|
94
|
+
if (named.length === 0) throw unusableSet(sets, withdrawn, selector);
|
|
95
|
+
if (named.length > 1) {
|
|
96
|
+
throw new AstryxError(
|
|
97
|
+
`"${selector}" names ${named.length} sets; name one as <package>/<set>`,
|
|
98
|
+
named.map(each => ({
|
|
99
|
+
name: `${each.package}/${each.name}`,
|
|
100
|
+
reason: 'name the package',
|
|
101
|
+
})),
|
|
102
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
return named[0];
|
|
106
|
+
}
|
|
107
|
+
|
|
82
108
|
/**
|
|
83
109
|
* Suggestions for a name that matched nothing: the closest candidates first.
|
|
84
110
|
* @param {string} wanted
|
package/api/icon/add/add.mjs
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
writeDefinitionFile,
|
|
63
63
|
writeIconSetData,
|
|
64
64
|
refuseOutsideProject,
|
|
65
|
+
templateMeaningsOf,
|
|
65
66
|
} from '../_adapter.mjs';
|
|
66
67
|
import {passed, refuseIgnoredPairs} from '../_options.mjs';
|
|
67
68
|
import {logger} from '../../logger.mjs';
|
|
@@ -159,7 +160,7 @@ export async function iconAdd(exportName, options) {
|
|
|
159
160
|
if (all) {
|
|
160
161
|
return authoring(() => addVariantForAll({cwd, from, selector, variant}));
|
|
161
162
|
}
|
|
162
|
-
|
|
163
|
+
const result = await authoring(async () => {
|
|
163
164
|
if (
|
|
164
165
|
typeof exportName !== 'string' ||
|
|
165
166
|
!/^[$A-Z_a-z][$\w]*$/u.test(exportName)
|
|
@@ -476,6 +477,11 @@ export async function iconAdd(exportName, options) {
|
|
|
476
477
|
},
|
|
477
478
|
};
|
|
478
479
|
});
|
|
480
|
+
if (result.type !== 'icon.add') return result;
|
|
481
|
+
const templateMeanings = await templateMeaningsOf(cwd, result.data.set);
|
|
482
|
+
return templateMeanings
|
|
483
|
+
? {...result, data: {...result.data, templateMeanings}}
|
|
484
|
+
: result;
|
|
479
485
|
}
|
|
480
486
|
|
|
481
487
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* List every Astryx icon definition.
|
|
6
|
+
* @param {{cwd: string, set?: string}} options
|
|
7
|
+
* @returns {Promise<import('../icon.type.mjs').IconDefinitionsResponse>}
|
|
8
|
+
*/
|
|
9
|
+
export function iconDefinitions({ cwd, set: selector }: {
|
|
10
|
+
cwd: string;
|
|
11
|
+
set?: string;
|
|
12
|
+
}): Promise<import("../icon.type.mjs").IconDefinitionsResponse>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `icon.definitions` leaf (AST-084 FR6): every Astryx icon definition,
|
|
5
|
+
* with how many bundled templates use it and whether a set maps it.
|
|
6
|
+
*
|
|
7
|
+
* @output the `icon.definitions` envelope
|
|
8
|
+
* @position api/icon/definitions — dispatched by ../icon.mjs
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
astryxIconDefinitions,
|
|
13
|
+
findLocalIconSet,
|
|
14
|
+
loadIconSets,
|
|
15
|
+
templateIconMeanings,
|
|
16
|
+
} from '../_adapter.mjs';
|
|
17
|
+
import {oneNamedSet} from '../_records.mjs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* List every Astryx icon definition.
|
|
21
|
+
* @param {{cwd: string, set?: string}} options
|
|
22
|
+
* @returns {Promise<import('../icon.type.mjs').IconDefinitionsResponse>}
|
|
23
|
+
*/
|
|
24
|
+
export async function iconDefinitions({cwd, set: selector}) {
|
|
25
|
+
const [checked, meanings] = await Promise.all([
|
|
26
|
+
checkedSet(cwd, selector),
|
|
27
|
+
templateIconMeanings(),
|
|
28
|
+
]);
|
|
29
|
+
const templates = new Map(
|
|
30
|
+
meanings.map(each => [each.definition, each.templates]),
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
type: 'icon.definitions',
|
|
34
|
+
data: {
|
|
35
|
+
set: checked?.key ?? null,
|
|
36
|
+
definitions: astryxIconDefinitions().definitions.map(({doc}) => ({
|
|
37
|
+
name: doc.name,
|
|
38
|
+
builtIn: doc.builtIn === true,
|
|
39
|
+
description: doc.description,
|
|
40
|
+
words: doc.words,
|
|
41
|
+
templates: templates.get(doc.name) ?? 0,
|
|
42
|
+
...(checked
|
|
43
|
+
? {
|
|
44
|
+
mapped: Object.prototype.hasOwnProperty.call(
|
|
45
|
+
checked.map,
|
|
46
|
+
doc.name,
|
|
47
|
+
),
|
|
48
|
+
}
|
|
49
|
+
: {}),
|
|
50
|
+
})),
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The set the definitions are checked against: the one `selector` names, in
|
|
57
|
+
* the icon-set package the command runs in and then among the installed
|
|
58
|
+
* sets; else the project's main set; else the only set of the icon-set
|
|
59
|
+
* package. Null when there is none, or when the project config does not
|
|
60
|
+
* load and the command runs outside an icon-set package.
|
|
61
|
+
* @param {string} cwd
|
|
62
|
+
* @param {string | undefined} selector
|
|
63
|
+
* @returns {Promise<{key: string, map: Record<string, string>} | null>}
|
|
64
|
+
*/
|
|
65
|
+
async function checkedSet(cwd, selector) {
|
|
66
|
+
/** @param {{package: string, name: string, data: {map?: Record<string, string>}}} set */
|
|
67
|
+
const entry = set => ({
|
|
68
|
+
key: `${set.package}/${set.name}`,
|
|
69
|
+
map: set.data.map ?? {},
|
|
70
|
+
});
|
|
71
|
+
const local = await findLocalIconSet(cwd, selector).catch(() => null);
|
|
72
|
+
if (selector != null && local) return entry(local.set);
|
|
73
|
+
if (selector != null) {
|
|
74
|
+
const {sets, withdrawn} = await loadIconSets(cwd);
|
|
75
|
+
return entry(oneNamedSet(sets, withdrawn, selector));
|
|
76
|
+
}
|
|
77
|
+
// A project config this CLI cannot load names no set: the list still
|
|
78
|
+
// answers, unchecked or checked against the local set.
|
|
79
|
+
const loaded = await loadIconSets(cwd).catch(() => null);
|
|
80
|
+
const choice = loaded?.choice;
|
|
81
|
+
if (choice?.status === 'selected' && choice.set) return entry(choice.set);
|
|
82
|
+
return local ? entry(local.set) : null;
|
|
83
|
+
}
|
package/api/icon/icon.doc.mjs
CHANGED
|
@@ -36,7 +36,8 @@ export const doc = {
|
|
|
36
36
|
{
|
|
37
37
|
name: 'options.set',
|
|
38
38
|
type: 'string',
|
|
39
|
-
description:
|
|
39
|
+
description:
|
|
40
|
+
'Search one set, by name or `<package>/<set>`. With options.definitions: the set to check the definitions against.',
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
name: 'options.limit',
|
|
@@ -55,7 +56,7 @@ export const doc = {
|
|
|
55
56
|
name: 'options.definitions',
|
|
56
57
|
type: 'boolean',
|
|
57
58
|
description:
|
|
58
|
-
|
|
59
|
+
"Every Astryx icon definition: name, whether it is built in, how many bundled templates use it, description, and words, and whether a set's `map` names it: options.set, else the project's main set, else the only set of the icon-set package at `cwd`. Takes no query or other option except options.set.",
|
|
59
60
|
default: 'false',
|
|
60
61
|
},
|
|
61
62
|
{
|
|
@@ -78,7 +79,7 @@ export const doc = {
|
|
|
78
79
|
{
|
|
79
80
|
type: 'icon.definitions',
|
|
80
81
|
description:
|
|
81
|
-
|
|
82
|
+
"With definitions: every Astryx icon definition, with whether it is built in, its description, its words, how many bundled templates use it (`templates`), and, when `set` names the set checked, whether that set's `map` names it (`mapped`).",
|
|
82
83
|
},
|
|
83
84
|
{
|
|
84
85
|
type: 'icon.setIcons',
|
|
@@ -102,7 +103,7 @@ export const doc = {
|
|
|
102
103
|
},
|
|
103
104
|
{
|
|
104
105
|
code: 'ERR_INVALID_OPTION',
|
|
105
|
-
when: 'two options are given that the call cannot both honor: `list`, `definitions`, or `allIcons` with any other listing, a query, `set` (not `allIcons`), or `limit`; or a `<set>/<id>` query with `set` or `limit`',
|
|
106
|
+
when: 'two options are given that the call cannot both honor: `list`, `definitions`, or `allIcons` with any other listing, a query, `set` (not `allIcons` or `definitions`), or `limit`; or a `<set>/<id>` query with `set` or `limit`',
|
|
106
107
|
},
|
|
107
108
|
{
|
|
108
109
|
code: 'ERR_NOT_FOUND',
|