@astryxdesign/cli 0.7.18-canary.gee79b85 → 0.7.18-canary.gfca8508
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/api/doctor/doctor.mjs +3 -3
- package/api/icon/_adapter.d.mts +1 -1
- package/api/icon/_adapter.mjs +5 -2
- package/api/icon/_authoring.mjs +5 -5
- package/api/icon/add/add.mjs +5 -5
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +7 -7
- package/api/icon/iconAdd.doc.mjs +9 -10
- package/api/icon/iconMap.doc.mjs +11 -12
- package/api/icon/iconNewDefinition.doc.mjs +8 -8
- package/api/icon/iconNewSet.doc.mjs +5 -5
- package/api/icon/iconUse.doc.mjs +5 -5
- package/api/icon/map/map.mjs +7 -7
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/integration/validate-integration.type.d.mts +6 -6
- package/api/integration/validate-integration.type.mjs +6 -6
- package/api/render/_adapter.d.mts +5 -3
- package/api/render/_adapter.mjs +58 -4
- package/api/render/render.doc.mjs +9 -2
- package/api/render/render.mjs +5 -2
- package/api/render/render.type.d.mts +17 -0
- package/api/render/render.type.mjs +10 -0
- package/api/theme-edit/_how-question.d.mts +29 -29
- package/api/theme-edit/_how-question.mjs +51 -3
- package/api/theme-edit/_preview.d.mts +10 -75
- package/api/theme-edit/_preview.mjs +27 -516
- package/api/theme-edit/_settings.mjs +22 -8
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +1 -1
- package/assets/docs/tree/share-a-page.doc.mjs +1 -1
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/doctor.mjs +2 -2
- package/clients/cli/commands/experimental/export.mjs +2 -1
- package/clients/cli/commands/experimental/icon.mjs +10 -10
- package/clients/cli/commands/experimental/render-output.mjs +9 -0
- package/clients/cli/commands/experimental-export.doc.mjs +6 -0
- package/clients/cli/commands/experimental-icon-add.doc.mjs +8 -8
- package/clients/cli/commands/experimental-icon-map.doc.mjs +6 -6
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +6 -6
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +3 -3
- package/clients/cli/commands/experimental-icon-use.doc.mjs +4 -4
- package/clients/cli/commands/experimental-icon.doc.mjs +6 -6
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/discovery/cli-self-docs.mjs +4 -4
- package/foundation/discovery/icon-definition-discovery.mjs +6 -6
- package/foundation/discovery/icon-set-checks.mjs +5 -5
- package/foundation/discovery/icon-set-discovery.mjs +1 -1
- package/foundation/discovery/icon-set-writer.mjs +9 -9
- package/foundation/doc-compiler/bundle.mjs +2 -2
- package/foundation/pictures/pictures.d.mts +196 -0
- package/foundation/pictures/pictures.mjs +565 -0
- package/foundation/render/picture-chrome.mjs +13 -15
- package/foundation/render/picture-playwright.mjs +10 -7
- package/foundation/render/picture-window.d.mts +13 -0
- package/foundation/render/picture-window.mjs +31 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +7 -7
package/api/doctor/doctor.mjs
CHANGED
|
@@ -1730,8 +1730,8 @@ export function checkIconSets(ctx) {
|
|
|
1730
1730
|
id,
|
|
1731
1731
|
label,
|
|
1732
1732
|
status: 'warn',
|
|
1733
|
-
message: `${renamed.join(' | ')}. Each entry maps the
|
|
1734
|
-
fix: 'In the package that ships the set, rename each map key to the
|
|
1733
|
+
message: `${renamed.join(' | ')}. Each entry maps the meaning that replaced it.`,
|
|
1734
|
+
fix: 'In the package that ships the set, rename each map key to the meaning that replaced it (any `astryx experimental icon map` run there writes it), or install a release of the package that has.',
|
|
1735
1735
|
};
|
|
1736
1736
|
}
|
|
1737
1737
|
return {
|
|
@@ -1812,7 +1812,7 @@ export function checkIconPlaceholders(ctx) {
|
|
|
1812
1812
|
label,
|
|
1813
1813
|
status: 'warn',
|
|
1814
1814
|
message: `${uses} placeholder icon${uses === 1 ? '' : 's'} in copied code: no set in your list has ${meanings.length > 0 ? `"${meanings.join('", "')}"` : 'these icons'}. ${where}.`,
|
|
1815
|
-
fix: `Add a backup set that has each meaning (\`astryx discover --type icon-set\` lists sets and the
|
|
1815
|
+
fix: `Add a backup set that has each meaning (\`astryx discover --type icon-set\` lists sets and the meanings they map): \`${backupFix}\`; or, if you author your main set, map it there: \`${mapFix}\`. Then copy the template again, or replace each use of the placeholder (\`${found[0].local}\`) with the icon \`astryx experimental icon <meaning>\` prints, and delete its declaration. A built-in meaning (\`astryx experimental icon --definitions\` marks them) also renders from the theme by name: \`<Icon icon="<name>" />\`. Otherwise, use your own icon component (\`astryx docs icons custom-icons\`).`,
|
|
1816
1816
|
};
|
|
1817
1817
|
}
|
|
1818
1818
|
|
package/api/icon/_adapter.d.mts
CHANGED
|
@@ -40,7 +40,7 @@ export function discoverListsIconSet(cwd: string): Promise<boolean>;
|
|
|
40
40
|
/**
|
|
41
41
|
* The names of the components of the Core the project in `cwd` reads: an
|
|
42
42
|
* icon query's words that name one say where the icon goes (spec:AST-084
|
|
43
|
-
* FR6). Empty when there is no Core.
|
|
43
|
+
* FR6). Empty when there is no Core, or when its components cannot be read.
|
|
44
44
|
* @param {string} cwd
|
|
45
45
|
* @returns {string[]}
|
|
46
46
|
*/
|
package/api/icon/_adapter.mjs
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* @position api/icon — adapter for api/icon/{search,detail,list,definitions,
|
|
8
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
|
-
* rule, and the config writer the leaves use
|
|
10
|
+
* rule, and the config writer the leaves use; search's adapter reads the
|
|
11
|
+
* Core component names from it
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import * as fs from 'node:fs';
|
|
@@ -182,7 +183,7 @@ export async function discoverListsIconSet(cwd) {
|
|
|
182
183
|
/**
|
|
183
184
|
* The names of the components of the Core the project in `cwd` reads: an
|
|
184
185
|
* icon query's words that name one say where the icon goes (spec:AST-084
|
|
185
|
-
* FR6). Empty when there is no Core.
|
|
186
|
+
* FR6). Empty when there is no Core, or when its components cannot be read.
|
|
186
187
|
* @param {string} cwd
|
|
187
188
|
* @returns {string[]}
|
|
188
189
|
*/
|
|
@@ -191,6 +192,8 @@ export function coreComponentNames(cwd) {
|
|
|
191
192
|
try {
|
|
192
193
|
return Object.values(discoverComponents(project?.coreDir() ?? null)).flat();
|
|
193
194
|
} catch {
|
|
195
|
+
// The names only break ties, so a Core that cannot be read leaves every
|
|
196
|
+
// word its full weight and the icon answer still comes.
|
|
194
197
|
return [];
|
|
195
198
|
}
|
|
196
199
|
}
|
package/api/icon/_authoring.mjs
CHANGED
|
@@ -594,7 +594,7 @@ export async function addIconSet(name, options) {
|
|
|
594
594
|
...(missingNotice ? [missingNotice.note] : []),
|
|
595
595
|
...mappedNotes(map, name),
|
|
596
596
|
...suggestionNotes(suggestions, name),
|
|
597
|
-
'Run `astryx integration check` to see the icon
|
|
597
|
+
'Run `astryx integration check` to see the icon meanings still to map.',
|
|
598
598
|
...(isPrivate
|
|
599
599
|
? [
|
|
600
600
|
`When \`integration check\` passes, turn the set on in the app: \`astryx experimental icon use ${name}\`. Run it in the app's folder; when this package is not the app, install it in the app first.`,
|
|
@@ -900,7 +900,7 @@ function suggestionNotes(suggestions, name) {
|
|
|
900
900
|
if (suggestions.length === 0) return [];
|
|
901
901
|
const count = new Set(suggestions.map(each => each.definition)).size;
|
|
902
902
|
return [
|
|
903
|
-
`${count} unmapped icon
|
|
903
|
+
`${count} unmapped icon meanings have possible icons (listed under Suggestions; nothing was written for them). Check each meaning, then map the ones that fit: \`astryx experimental icon map <definition> <icon> --set ${name}\`.`,
|
|
904
904
|
];
|
|
905
905
|
}
|
|
906
906
|
|
|
@@ -913,7 +913,7 @@ function mappedNotes(map, name) {
|
|
|
913
913
|
const count = Object.keys(map).length;
|
|
914
914
|
if (count === 0) return [];
|
|
915
915
|
return [
|
|
916
|
-
`${count} icon
|
|
916
|
+
`${count} icon meanings were mapped because an icon has their exact name (listed under Mapped by name). A library can draw another meaning under the same name, such as a backspace key named delete: check each, and remap with \`astryx experimental icon map <definition> <icon> --set ${name}\`.`,
|
|
917
917
|
];
|
|
918
918
|
}
|
|
919
919
|
|
|
@@ -1562,8 +1562,8 @@ async function refreshIconSet(
|
|
|
1562
1562
|
]
|
|
1563
1563
|
: []),
|
|
1564
1564
|
astryxIconDefinitions().definitions.every(({doc}) => map[doc.name])
|
|
1565
|
-
? 'Every Astryx icon
|
|
1566
|
-
: 'Run `astryx integration check` to see the icon
|
|
1565
|
+
? 'Every Astryx icon meaning is mapped.'
|
|
1566
|
+
: 'Run `astryx integration check` to see the icon meanings still to map.',
|
|
1567
1567
|
];
|
|
1568
1568
|
return result;
|
|
1569
1569
|
});
|
package/api/icon/add/add.mjs
CHANGED
|
@@ -137,11 +137,11 @@ export async function iconAdd(exportName, options) {
|
|
|
137
137
|
])) {
|
|
138
138
|
if (passed(value) && !passed(newDefinition)) {
|
|
139
139
|
throw new AstryxError(
|
|
140
|
-
`${flag} describes a new
|
|
140
|
+
`${flag} describes a new meaning, so it needs --new-definition`,
|
|
141
141
|
[
|
|
142
142
|
{
|
|
143
143
|
name: `--new-definition <name> --description '<what it is for>' --words a,b`,
|
|
144
|
-
reason: 'add your own
|
|
144
|
+
reason: 'add your own meaning',
|
|
145
145
|
},
|
|
146
146
|
],
|
|
147
147
|
ERROR_CODES.ERR_INVALID_OPTION,
|
|
@@ -307,17 +307,17 @@ export async function iconAdd(exportName, options) {
|
|
|
307
307
|
!mappableDefinitions(set).has(definition)
|
|
308
308
|
) {
|
|
309
309
|
throw new AstryxError(
|
|
310
|
-
`"${definition}" is not an icon
|
|
310
|
+
`"${definition}" is not an icon meaning.`,
|
|
311
311
|
[
|
|
312
312
|
...closestNames(definition, [...mappableDefinitions(set)]).map(
|
|
313
313
|
name => ({
|
|
314
314
|
name: `--definition ${name}`,
|
|
315
|
-
reason: 'a known icon
|
|
315
|
+
reason: 'a known icon meaning',
|
|
316
316
|
}),
|
|
317
317
|
),
|
|
318
318
|
{
|
|
319
319
|
name: `--new-definition ${definitionNameFromInput(definition)} --description '<what it is for>' --words a,b`,
|
|
320
|
-
reason: 'add it as your own
|
|
320
|
+
reason: 'add it as your own meaning',
|
|
321
321
|
},
|
|
322
322
|
],
|
|
323
323
|
ERROR_CODES.ERR_NOT_FOUND,
|
|
@@ -17,7 +17,7 @@ export const doc = {
|
|
|
17
17
|
summary:
|
|
18
18
|
'The icon sets icon() searches in a folder, as plain JSON to store and rank later with rankIconIndex().',
|
|
19
19
|
description:
|
|
20
|
-
"Reads the icon sets `icon()` would search in `cwd` and returns them as `{version, sets, withdrawn, components}`. Reading them loads each installed package's integration manifest, which runs that package's code, so a catalog that lists packages it must not load makes the index where loading is safe (a folder with those packages installed), stores it, and ranks it with {@link function:rankIconIndex}. With `package`, the index keeps only the sets that package ships, for a catalog that stores one index per package. Paths into the folder are left out, so an index reads the same wherever it was made. A set in the list of the folder's project carries the
|
|
20
|
+
"Reads the icon sets `icon()` would search in `cwd` and returns them as `{version, sets, withdrawn, components}`. Reading them loads each installed package's integration manifest, which runs that package's code, so a catalog that lists packages it must not load makes the index where loading is safe (a folder with those packages installed), stores it, and ranks it with {@link function:rankIconIndex}. With `package`, the index keeps only the sets that package ships, for a catalog that stores one index per package. Paths into the folder are left out, so an index reads the same wherever it was made. A set in the list of the folder's project carries the variant that project picks (`look`), so its matches draw that variant as `icon()` draws it there. The sets are the ranker's input, not a stable shape: an index is ranked only by the CLI version that made it. Experimental: it may change or be removed in a patch release.",
|
|
21
21
|
importPath: '@astryxdesign/cli/api',
|
|
22
22
|
signature:
|
|
23
23
|
'exportIconIndex(options?: {cwd?: string, package?: string}): Promise<IconIndex>',
|
package/api/icon/icon.doc.mjs
CHANGED
|
@@ -16,7 +16,7 @@ export const doc = {
|
|
|
16
16
|
summary:
|
|
17
17
|
'Find an icon by meaning in the installed icon sets, read one icon, or list the sets.',
|
|
18
18
|
description:
|
|
19
|
-
"Reads every installed icon set's data file, never the icon modules. With words it ranks icons by meaning: an icon
|
|
19
|
+
"Reads every installed icon set's data file, never the icon modules. With words it ranks icons by meaning: an icon meaning the set's `map` names the icon for, then exact matches on its id or words, then a word that starts with the query, then partial matches, and for a query of several words that none of those answer, the icons that carry some of its words, rarer words counting more within a set and the words after the icon word that name a component of the project's Core (`information icon popover links`) counting only to break a tie. A word written as an export name (`SearchIcon`) also reads as its words, and the reading with the better match answers. Equal scores keep the project's set first, then integration load order; within a set, a whole-id name match before an id-part one and a meaning match by its tag position; then an icon whose id the query names in full; then id order. With `<set>/<id>` it reads one icon with every variant's import line. With `list` it lists the installed sets, how many icon meanings each one's `map` covers (built-in and all of Astryx's) and its own meanings, and any set withdrawn and why. `search()` and `astryx search` with no `type` answer from the same ranking when a query asks for an icon (one word as typed is `icon` or `icons`, an installed set's name, or an icon export name such as `SearchIcon`, and is not the name of a component or hook; an `icon` or `icons` right after `with`, with only `a`, `an` or `the` between, that no `of` or `for` follows names a feature of an answered component or template, as in `card with an icon`, and asks for none, while `card with an icon of a star` still asks): after `results` they return `icons`, `{matchCount, results}`, with at most 3 icons (fewer when `limit` is smaller), each with `domain: 'icon'`, `name` (`<set>/<id>`), `set`, `id`, `package`, `score`, `reason`, `import` and `command`; text mode lists them last, one line each. It never changes search's `results` or `matchCount`, and it is absent when no icon answers. Experimental: it may change or be removed in a patch release.",
|
|
20
20
|
importPath: '@astryxdesign/cli/api',
|
|
21
21
|
signature:
|
|
22
22
|
'icon(query?: string, options?: IconOptions): Promise<IconSearchResponse | IconDetailResponse | IconListResponse>',
|
|
@@ -37,7 +37,7 @@ export const doc = {
|
|
|
37
37
|
name: 'options.set',
|
|
38
38
|
type: 'string',
|
|
39
39
|
description:
|
|
40
|
-
'Search one set, by name or `<package>/<set>`. With options.definitions: the set to check the
|
|
40
|
+
'Search one set, by name or `<package>/<set>`. With options.definitions: the set to check the meanings against.',
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
name: 'options.limit',
|
|
@@ -56,7 +56,7 @@ export const doc = {
|
|
|
56
56
|
name: 'options.definitions',
|
|
57
57
|
type: 'boolean',
|
|
58
58
|
description:
|
|
59
|
-
"Every Astryx icon
|
|
59
|
+
"Every Astryx icon meaning: 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.",
|
|
60
60
|
default: 'false',
|
|
61
61
|
},
|
|
62
62
|
{
|
|
@@ -69,7 +69,7 @@ export const doc = {
|
|
|
69
69
|
{
|
|
70
70
|
type: 'icon.search',
|
|
71
71
|
description:
|
|
72
|
-
"The query, how many icons matched, and the ranked matches, each with its set, id, package, module, export, import line, words, filled names, variants, reason, and score, plus `relatives` (the other
|
|
72
|
+
"The query, how many icons matched, and the ranked matches, each with its set, id, package, module, export, import line, words, filled names, variants, reason, and score, plus `relatives` (the other meanings in the groups of the ones it draws) when there are any. A replaced meaning's old name answers like its successor's name. A match that a meaning names also has `meaningImport`: the import line that names the icon by that meaning (`import {TrashIcon as DeleteIcon} from '…'`), so app code keeps the name when another set draws it. No match is an empty list. When the project picks a variant (`experimental.iconVariant`), a match from a set in the project's list has the module, export, and import of that variant; one whose icon lacks the variant keeps its own and names both variants in `look` ({asked, used}). With no icon set installed, `reason` says so, `definitions` lists the Astryx icon meanings that match ({name, builtIn, description}, plus `group` and `relatives` for a meaning in a group), built-in ones first, since Core draws those by name; a matching meaning that Core does not draw brings the built-in that draws in its place (`help` brings `info`) unless a match ranked above it has none, and `next` says how to get a set.",
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
type: 'icon.detail',
|
|
@@ -79,17 +79,17 @@ export const doc = {
|
|
|
79
79
|
{
|
|
80
80
|
type: 'icon.definitions',
|
|
81
81
|
description:
|
|
82
|
-
"With definitions
|
|
82
|
+
"With `definitions`: every Astryx icon meaning, with whether it is built in, its description, its words, its `group` and the meaning it `replaces` when it has them, how many bundled templates use it (`templates`), and, when `set` names the set checked, whether that set's `map` names it (`mapped`).",
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
type: 'icon.setIcons',
|
|
86
86
|
description:
|
|
87
|
-
'With set and all: every icon of that set by id, with its export, words, and the
|
|
87
|
+
'With set and all: every icon of that set by id, with its export, words, and the meanings it draws.',
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
type: 'icon.list',
|
|
91
91
|
description:
|
|
92
|
-
"The project's icon-set state, each installed set with its package, license, icon count, default variant, declared variants, and the icon
|
|
92
|
+
"The project's icon-set state, each installed set with its package, license, icon count, default variant, declared variants, and the icon meanings its `map` covers, and each withdrawn set with its reason. `next` is present when two or more sets are installed and none is the main set, with the command that chooses one, or when no set is installed, with how to get one.",
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
throws: [
|
package/api/icon/iconAdd.doc.mjs
CHANGED
|
@@ -10,10 +10,9 @@ export const doc = {
|
|
|
10
10
|
namespace: 'cli/api',
|
|
11
11
|
stability: 'experimental',
|
|
12
12
|
displayName: 'iconAdd()',
|
|
13
|
-
summary:
|
|
14
|
-
'Register one icon you chose from a library in the set being authored.',
|
|
13
|
+
summary: 'Add one icon you chose from a library to the set being authored.',
|
|
15
14
|
description:
|
|
16
|
-
"Run inside an icon-set package. The caller picks the export; the CLI never searches the library. It proves the export is a runtime component of `from` (a package, a package subpath, or a ./ path to a file inside this package), read without running it. With no
|
|
15
|
+
"Run inside an icon-set package. The caller picks the export; the CLI never searches the library. It proves the export is a runtime component of `from` (a package, a package subpath, or a ./ path to a file inside this package), read without running it. With no meaning it answers the icon meanings that fit the export, Astryx's and the set's own, and writes nothing. With `definition` it adds the icon (id from its name, `module` the source unless the set's own module already exports it, words from its name and the meaning) and maps the meaning to it. With `newDefinition` it first writes the set's own meaning file. A `variant` adds the export as that declared variant of an existing icon. With `variant`, `from`, and `all` and no export name, it adds that variant for every icon of the set whose id an export of `from` has, in one write. Running it again changes nothing. Experimental: it may change or be removed in a patch release.",
|
|
17
16
|
importPath: '@astryxdesign/cli/api',
|
|
18
17
|
signature:
|
|
19
18
|
'iconAdd(exportName: string | undefined, options: IconAddOptions): Promise<IconAddResponse | IconDefinitionMatchesResponse | IconAddVariantsResponse>',
|
|
@@ -47,13 +46,13 @@ export const doc = {
|
|
|
47
46
|
{
|
|
48
47
|
name: 'options.definition',
|
|
49
48
|
type: 'string',
|
|
50
|
-
description: 'The icon
|
|
49
|
+
description: 'The icon meaning to map the icon to.',
|
|
51
50
|
},
|
|
52
51
|
{
|
|
53
52
|
name: 'options.newDefinition',
|
|
54
53
|
type: 'string',
|
|
55
54
|
description:
|
|
56
|
-
"Add the set's own
|
|
55
|
+
"Add the set's own meaning with this name, in camelCase (`aiHelper`) or kebab-case (`ai-helper`), then map the icon to it.",
|
|
57
56
|
},
|
|
58
57
|
{
|
|
59
58
|
name: 'options.description',
|
|
@@ -99,7 +98,7 @@ export const doc = {
|
|
|
99
98
|
{
|
|
100
99
|
type: 'icon.add',
|
|
101
100
|
description:
|
|
102
|
-
"The icon
|
|
101
|
+
"The icon added, the meaning mapped, and the files written. `templateMeanings.unmapped` lists the icon meanings the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
|
|
103
102
|
},
|
|
104
103
|
{
|
|
105
104
|
type: 'icon.addVariants',
|
|
@@ -109,17 +108,17 @@ export const doc = {
|
|
|
109
108
|
{
|
|
110
109
|
type: 'icon.definitionMatches',
|
|
111
110
|
description:
|
|
112
|
-
'Without a
|
|
111
|
+
'Without a meaning: the meanings that fit the export, and the commands that add it.',
|
|
113
112
|
},
|
|
114
113
|
],
|
|
115
114
|
throws: [
|
|
116
115
|
{
|
|
117
116
|
code: 'ERR_NOT_FOUND',
|
|
118
|
-
when: 'the module does not export the name, the
|
|
117
|
+
when: 'the module does not export the name, the meaning is unknown, or `set` names no set in the package or one that is withdrawn (with why)',
|
|
119
118
|
},
|
|
120
119
|
{
|
|
121
120
|
code: 'ERR_INVALID_ARGUMENT',
|
|
122
|
-
when: "the export is data rather than a component, a new
|
|
121
|
+
when: "the export is data rather than a component, a new meaning is named like an Astryx one, or the variant is not one the set declares, is the variant each icon's own export already draws, or is no look word of a library whose export names carry look words, or `id` starts with a digit",
|
|
123
122
|
},
|
|
124
123
|
{code: 'ERR_FILE_EXISTS', when: 'another icon already has the id'},
|
|
125
124
|
{
|
|
@@ -149,7 +148,7 @@ export const doc = {
|
|
|
149
148
|
],
|
|
150
149
|
examples: [
|
|
151
150
|
{
|
|
152
|
-
label: 'Which
|
|
151
|
+
label: 'Which meanings fit',
|
|
153
152
|
code: "await iconAdd('Bin', {from: '@acme/glyph-library'});",
|
|
154
153
|
},
|
|
155
154
|
{
|
package/api/icon/iconMap.doc.mjs
CHANGED
|
@@ -10,10 +10,9 @@ export const doc = {
|
|
|
10
10
|
namespace: 'cli/api',
|
|
11
11
|
stability: 'experimental',
|
|
12
12
|
displayName: 'iconMap()',
|
|
13
|
-
summary:
|
|
14
|
-
'Register which icon of the set being authored draws an icon definition.',
|
|
13
|
+
summary: 'Map an icon meaning to an icon of the set being authored.',
|
|
15
14
|
description:
|
|
16
|
-
"Run inside an icon-set package. Sets `map[definition] = icon` in the set's data file, or removes the entry. The
|
|
15
|
+
"Run inside an icon-set package. Sets `map[definition] = icon` in the set's data file, or removes the entry. The meaning must be Astryx's or one the set declares, named by its name or kebab id. The icon must be in the set, named by its id, its export name in any case, or another name its library exports it as (`trash-2` or `Trash2`), never by one word of its id; the entry records its id. The file is written in one fixed shape, `map` keys sorted. `integration check` suggests these commands for meanings the set has a fitting icon for. Experimental: it may change or be removed in a patch release.",
|
|
17
16
|
importPath: '@astryxdesign/cli/api',
|
|
18
17
|
signature:
|
|
19
18
|
'iconMap(definition: string | undefined, icon?: string, options?: IconMapOptions): Promise<IconMapResponse | IconMapManyResponse>',
|
|
@@ -22,7 +21,7 @@ export const doc = {
|
|
|
22
21
|
{
|
|
23
22
|
name: 'definition',
|
|
24
23
|
type: 'string | undefined',
|
|
25
|
-
description: 'The icon
|
|
24
|
+
description: 'The icon meaning. Omit with `options.pairs`.',
|
|
26
25
|
required: false,
|
|
27
26
|
},
|
|
28
27
|
{
|
|
@@ -44,32 +43,32 @@ export const doc = {
|
|
|
44
43
|
{
|
|
45
44
|
name: 'options.remove',
|
|
46
45
|
type: 'boolean',
|
|
47
|
-
description: "Remove the
|
|
46
|
+
description: "Remove the meaning's entry.",
|
|
48
47
|
default: 'false',
|
|
49
48
|
},
|
|
50
49
|
{
|
|
51
50
|
name: 'options.pairs',
|
|
52
51
|
type: 'string | string[]',
|
|
53
52
|
description:
|
|
54
|
-
'Many entries at once: `<definition>=<icon>` pairs separated by commas or spaces, with no
|
|
53
|
+
'Many entries at once: `<definition>=<icon>` pairs separated by commas or spaces, with no meaning or icon argument; each icon is named as the icon argument is. Every pair is checked before any is written.',
|
|
55
54
|
},
|
|
56
55
|
],
|
|
57
56
|
returns: [
|
|
58
57
|
{
|
|
59
58
|
type: 'icon.mapMany',
|
|
60
59
|
description:
|
|
61
|
-
"With pairs: the set, the data file, each entry with the icon it replaced, and whether the file changed; `replacedKeys` lists each `map` key that named a replaced
|
|
60
|
+
"With pairs: the set, the data file, each entry with the icon it replaced, and whether the file changed; `replacedKeys` lists each `map` key that named a replaced meaning and was written under its successor's name. `templateMeanings.unmapped` lists the icon meanings the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
|
|
62
61
|
},
|
|
63
62
|
{
|
|
64
63
|
type: 'icon.map',
|
|
65
64
|
description:
|
|
66
|
-
"The set, the data file, the
|
|
65
|
+
"The set, the data file, the meaning, the icon now mapped, the icon it replaced, and whether the file changed; `replacedKeys` lists each `map` key that named a replaced meaning and was written under its successor's name. `templateMeanings.unmapped` lists the icon meanings the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
|
|
67
66
|
},
|
|
68
67
|
],
|
|
69
68
|
throws: [
|
|
70
69
|
{
|
|
71
70
|
code: 'ERR_NOT_FOUND',
|
|
72
|
-
when: 'the
|
|
71
|
+
when: 'the meaning is unknown, the set has no such icon, or `set` names no set in the package or one that is withdrawn (with why)',
|
|
73
72
|
},
|
|
74
73
|
{
|
|
75
74
|
code: 'ERR_INVALID_ARGUMENT',
|
|
@@ -77,7 +76,7 @@ export const doc = {
|
|
|
77
76
|
},
|
|
78
77
|
{
|
|
79
78
|
code: 'ERR_INVALID_OPTION',
|
|
80
|
-
when: '`pairs` is given with a
|
|
79
|
+
when: '`pairs` is given with a meaning, an icon, or `remove`, or `remove` with an icon',
|
|
81
80
|
},
|
|
82
81
|
{
|
|
83
82
|
code: 'ERR_PROJECT_REQUIRED',
|
|
@@ -85,7 +84,7 @@ export const doc = {
|
|
|
85
84
|
},
|
|
86
85
|
{
|
|
87
86
|
code: 'ERR_MISSING_ARGUMENT',
|
|
88
|
-
when: 'the
|
|
87
|
+
when: 'the meaning is missing, or the icon without `remove`',
|
|
89
88
|
},
|
|
90
89
|
{
|
|
91
90
|
code: 'ERR_PATH_TRAVERSAL',
|
|
@@ -97,7 +96,7 @@ export const doc = {
|
|
|
97
96
|
},
|
|
98
97
|
],
|
|
99
98
|
examples: [
|
|
100
|
-
{label: 'Map a
|
|
99
|
+
{label: 'Map a meaning', code: "await iconMap('delete', 'trash');"},
|
|
101
100
|
{
|
|
102
101
|
label: 'Remove an entry',
|
|
103
102
|
code: "await iconMap('delete', undefined, {remove: true});",
|
|
@@ -8,9 +8,9 @@ export const doc = {
|
|
|
8
8
|
namespace: 'cli/api',
|
|
9
9
|
stability: 'experimental',
|
|
10
10
|
displayName: 'iconNewDefinition()',
|
|
11
|
-
summary: "Add one of an icon set's own icon
|
|
11
|
+
summary: "Add one of an icon set's own icon meanings.",
|
|
12
12
|
description:
|
|
13
|
-
"Run inside an icon-set package. Writes `<set>/definitions/<name>.doc.mjs`, a strongly typed IconDefinitionDoc with the description and words, and, with `icon`, the set's `map` entry for it. A name Astryx already has is refused: map to Astryx's
|
|
13
|
+
"Run inside an icon-set package. Writes `<set>/definitions/<name>.doc.mjs`, a strongly typed IconDefinitionDoc with the description and words, and, with `icon`, the set's `map` entry for it. A name Astryx already has is refused: map to Astryx's icon meaning instead. The file is never overwritten, and a write that fails is undone. Experimental: it may change or be removed in a patch release.",
|
|
14
14
|
importPath: '@astryxdesign/cli/api',
|
|
15
15
|
signature:
|
|
16
16
|
'iconNewDefinition(name: string, options?: IconNewDefinitionOptions): Promise<IconNewDefinitionResponse>',
|
|
@@ -20,13 +20,13 @@ export const doc = {
|
|
|
20
20
|
name: 'name',
|
|
21
21
|
type: 'string',
|
|
22
22
|
description:
|
|
23
|
-
'The
|
|
23
|
+
'The meaning name, in camelCase (`rocketLaunch`) or kebab-case (`rocket-launch`); it is written in camelCase.',
|
|
24
24
|
required: true,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: 'options.description',
|
|
28
28
|
type: 'string',
|
|
29
|
-
description: 'One sentence on what an icon with this
|
|
29
|
+
description: 'One sentence on what an icon with this meaning is for.',
|
|
30
30
|
required: true,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -38,7 +38,7 @@ export const doc = {
|
|
|
38
38
|
{
|
|
39
39
|
name: 'options.icon',
|
|
40
40
|
type: 'string',
|
|
41
|
-
description: 'An icon id in the set to map the
|
|
41
|
+
description: 'An icon id in the set to map the meaning to.',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
name: 'options.set',
|
|
@@ -73,7 +73,7 @@ export const doc = {
|
|
|
73
73
|
code: 'ERR_MISSING_ARGUMENT',
|
|
74
74
|
when: 'the description or words are missing',
|
|
75
75
|
},
|
|
76
|
-
{code: 'ERR_FILE_EXISTS', when:
|
|
76
|
+
{code: 'ERR_FILE_EXISTS', when: "the icon meaning's file already exists"},
|
|
77
77
|
{
|
|
78
78
|
code: 'ERR_NOT_FOUND',
|
|
79
79
|
when: 'the package ships no icon set, `set` names no set in it or one that is withdrawn (with why), or the set has no such icon',
|
|
@@ -88,12 +88,12 @@ export const doc = {
|
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
code: 'ERR_WRITE_FAILED',
|
|
91
|
-
when:
|
|
91
|
+
when: "the icon meaning's file or the data file cannot be written; every write before it is undone",
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
94
|
examples: [
|
|
95
95
|
{
|
|
96
|
-
label: 'Add and map a
|
|
96
|
+
label: 'Add and map a meaning',
|
|
97
97
|
code: "await iconNewDefinition('random', {description: 'Pick something at random.', words: ['dice', 'shuffle', 'chance'], icon: 'dice-5'});",
|
|
98
98
|
},
|
|
99
99
|
],
|
|
@@ -10,7 +10,7 @@ export const doc = {
|
|
|
10
10
|
displayName: 'iconNewSet()',
|
|
11
11
|
summary: 'Add an icon set to an integration package.',
|
|
12
12
|
description:
|
|
13
|
-
"Creates an integration manifest when the package has none, writes the set directory with its strongly typed same-stem IconSetDoc and a starter data file (schemaVersion 1, module set to the package name, no icons and an empty map yet), and the set's generated module with its declaration file and an empty themeIcons theme map; with from, it wraps a library's icons into them, records the installed library and version as the data file's source, copies the library's license notices into the set, uses the library's license, maps each Astryx
|
|
13
|
+
"Creates an integration manifest when the package has none, writes the set directory with its strongly typed same-stem IconSetDoc and a starter data file (schemaVersion 1, module set to the package name, no icons and an empty map yet), and the set's generated module with its declaration file and an empty themeIcons theme map; with from, it wraps a library's icons into them, records the installed library and version as the data file's source, copies the library's license notices into the set, uses the library's license, maps each Astryx meaning whose name is an icon id, and returns up to three likely icons for each other meaning as suggestions (by its name, its words, and the other names the library gives an icon; never a part of a word, a negated form, or the opposite direction), never written. A library whose export names end in style, size and weight words gives one icon per glyph, named without those words, in the variant the set's default variant names, else the library's usual default (outline, regular, the middle weight). With adapter, it declares the data file's adapter, so `from` also wraps a library's data exports through it. Over an existing set with icons, `from` refreshes it (the first `from` into a set with no icons creates them); without `from`, `variants`, `defaultVariant`, `displayName` and `description` update it in place and leave its icons, map and generated module unchanged (a variant an icon has must stay declared, and a set with icons keeps its default variant). It declares the manifest's `experimental.iconSets` root on first use, and includes the manifest and root in package.json files when the package already uses an allowlist. It never writes the package's entry, exports, main, types, files list, peers, or scripts: its notes name each change the package needs as text to copy. Every path is confined to the package, and an existing set is changed only as above. Experimental: it may change or be removed in a patch release.",
|
|
14
14
|
importPath: '@astryxdesign/cli/api',
|
|
15
15
|
signature:
|
|
16
16
|
'iconNewSet(name: string, options?: IconNewSetOptions): Promise<IconNewSetResponse>',
|
|
@@ -62,7 +62,7 @@ export const doc = {
|
|
|
62
62
|
name: 'options.defaultVariant',
|
|
63
63
|
type: 'string',
|
|
64
64
|
description:
|
|
65
|
-
"With variants: the variant each icon's own export draws, written to the data file's default. In a library whose export names
|
|
65
|
+
"With variants: the variant each icon's own export draws, written to the data file's default. In a library whose export names carry look words, it must be one of the library's look words, and when absent it is the variant the icons' exports draw (with from and no icons yet, the library's usual default), which variants must list. Otherwise, when absent, an existing set keeps its default while variants declares it; a set without icons takes the first variant, and a set with icons and none declared needs it. Without from, a set with icons refuses a default other than the variant they draw; when its icons' export names carry no look words, it refuses one other than its declared default with from too.",
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
name: 'options.displayName',
|
|
@@ -81,17 +81,17 @@ export const doc = {
|
|
|
81
81
|
{
|
|
82
82
|
type: 'icon.newSet',
|
|
83
83
|
description:
|
|
84
|
-
"What it wrote: the manifest root, the files, and what to do next. Except in a dry run, `templateMeanings.unmapped` lists the icon
|
|
84
|
+
"What it wrote: the manifest root, the files, and what to do next. Except in a dry run, `templateMeanings.unmapped` lists the icon meanings the bundled templates use that the set's `map` does not name, each with its template count, most used first.",
|
|
85
85
|
},
|
|
86
86
|
],
|
|
87
87
|
throws: [
|
|
88
88
|
{
|
|
89
89
|
code: 'ERR_INVALID_ARGUMENT',
|
|
90
|
-
when: 'the name is not lowercase kebab-case, package.json has no name, or a variant name or the default variant is invalid; the default variant is no look word of a library whose export names
|
|
90
|
+
when: 'the name is not lowercase kebab-case, package.json has no name, or a variant name or the default variant is invalid; the default variant is no look word of a library whose export names carry look words; or the default variant would change on a set that has icons: without `from` (wrap the library again with `from` and `defaultVariant`), or with or without it when the export names of its icons carry no look words (add it as a variant instead)',
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
code: 'ERR_INVALID_OPTION',
|
|
94
|
-
when: '`exclude` is given without `from`, or `defaultVariant` without `variants`; `variants` leave out the default variant: the
|
|
94
|
+
when: '`exclude` is given without `from`, or `defaultVariant` without `variants`; `variants` leave out the default variant: the variant the icons draw in a library whose export names carry look words, or the declared default of a set with icons whose export names carry no look words; or such a set declares no default and `defaultVariant` names none',
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
code: 'ERR_FILE_EXISTS',
|
package/api/icon/iconUse.doc.mjs
CHANGED
|
@@ -10,9 +10,9 @@ export const doc = {
|
|
|
10
10
|
namespace: 'cli/api',
|
|
11
11
|
stability: 'experimental',
|
|
12
12
|
displayName: 'iconUse()',
|
|
13
|
-
summary: "Choose the project's main icon set, backups, and
|
|
13
|
+
summary: "Choose the project's main icon set, backups, and variant.",
|
|
14
14
|
description:
|
|
15
|
-
"Writes `experimental.iconSet` in the project's astryx.config (creating astryx.config.mjs when there is none), so templates and blocks the project copies use that set's icons. With no backups it writes the set name as a string. With backups it writes a list, the main set first and then each backup in order: a copied template takes each icon from the first set in the list that has its meaning, and draws a placeholder the copied file declares when none has it. With `variant`, it writes `experimental.iconVariant` in the same write: the
|
|
15
|
+
"Writes `experimental.iconSet` in the project's astryx.config (creating astryx.config.mjs when there is none), so templates and blocks the project copies use that set's icons. With no backups it writes the set name as a string. With backups it writes a list, the main set first and then each backup in order: a copied template takes each icon from the first set in the list that has its meaning, and draws a placeholder the copied file declares when none has it. With `variant`, it writes `experimental.iconVariant` in the same write: the variant every icon draws, one of the main set's variants. Each set in the list draws its variant of that name, or its default variant when it declares none (`looks`), and `themeMap` names the export a theme sets as `icons` to draw the built-in icons in that variant. Without `variant`, it removes `experimental.iconVariant`, so each set draws its default variant. Every set must be installed; a name two installed packages both ship is refused with each `<package>/<set>` form. The receipt lists installed sets the list leaves out (`unlisted`), which Doctor fails, with the command that adds them. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
importPath: '@astryxdesign/cli/api',
|
|
17
17
|
signature:
|
|
18
18
|
'iconUse(set: string, options?: {cwd?: string, backups?: string[], variant?: string}): Promise<IconUseResponse>',
|
|
@@ -51,14 +51,14 @@ export const doc = {
|
|
|
51
51
|
name: 'options.variant',
|
|
52
52
|
type: 'string',
|
|
53
53
|
description:
|
|
54
|
-
"The
|
|
54
|
+
"The variant every icon draws, such as `outline` or `filled`: one of the main set's variants. Leave it out to remove `experimental.iconVariant`, so each set draws its default variant.",
|
|
55
55
|
},
|
|
56
56
|
],
|
|
57
57
|
returns: [
|
|
58
58
|
{
|
|
59
59
|
type: 'icon.use',
|
|
60
60
|
description:
|
|
61
|
-
"The main set and the backups written, the sets they name, the variant written (`variant`, or null), the config file, whether it was created, the values it replaced (`previous`, `previousVariant`), the installed sets the list leaves out (`unlisted`, with a `next` command), with
|
|
61
|
+
"The main set and the backups written, the sets they name, the variant written (`variant`, or null), the config file, whether it was created, the values it replaced (`previous`, `previousVariant`), the installed sets the list leaves out (`unlisted`, with a `next` command), with `variant`, the variant each listed set draws (`looks`) and the main set's theme map for that variant (`themeMap`), and a `warning` when the project's @astryxdesign/cli range admits a release that refuses the config: before 0.7.4 for a string, before 0.7.12 for a list, before 0.7.16 for a variant.",
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
64
|
throws: [
|
|
@@ -98,7 +98,7 @@ export const doc = {
|
|
|
98
98
|
code: "await iconUse('outline', {backups: ['@acme/brand-icons/brand']});",
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
label: 'Draw every icon in one
|
|
101
|
+
label: 'Draw every icon in one variant',
|
|
102
102
|
code: "await iconUse('brand', {variant: 'filled'});",
|
|
103
103
|
},
|
|
104
104
|
],
|
package/api/icon/map/map.mjs
CHANGED
|
@@ -64,11 +64,11 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
64
64
|
const result = await authoring(async () => {
|
|
65
65
|
if (typeof definition !== 'string' || definition.trim() === '') {
|
|
66
66
|
throw new AstryxError(
|
|
67
|
-
'Name the icon
|
|
67
|
+
'Name the icon meaning to map',
|
|
68
68
|
[
|
|
69
69
|
{
|
|
70
70
|
name: 'astryx docs cli/experimental/icon-definitions',
|
|
71
|
-
reason: 'every icon
|
|
71
|
+
reason: 'every icon meaning',
|
|
72
72
|
},
|
|
73
73
|
],
|
|
74
74
|
ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
@@ -94,14 +94,14 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
94
94
|
} else {
|
|
95
95
|
if (!mappableDefinitions(set).has(definition)) {
|
|
96
96
|
throw new AstryxError(
|
|
97
|
-
`"${definition}" is not an icon
|
|
97
|
+
`"${definition}" is not an icon meaning.`,
|
|
98
98
|
[
|
|
99
99
|
...closestNames(definition, [...mappableDefinitions(set)]).map(
|
|
100
|
-
name => ({name, reason: 'a known icon
|
|
100
|
+
name => ({name, reason: 'a known icon meaning'}),
|
|
101
101
|
),
|
|
102
102
|
{
|
|
103
103
|
name: `astryx experimental icon new-definition ${definition} --set ${set.name}`,
|
|
104
|
-
reason: 'add it as your own
|
|
104
|
+
reason: 'add it as your own meaning',
|
|
105
105
|
},
|
|
106
106
|
],
|
|
107
107
|
ERROR_CODES.ERR_NOT_FOUND,
|
|
@@ -210,10 +210,10 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
210
210
|
const id = iconIdIn(set, match[2]) ?? match[2];
|
|
211
211
|
if (!known.has(name)) {
|
|
212
212
|
throw new AstryxError(
|
|
213
|
-
`"${name}" is not an icon
|
|
213
|
+
`"${name}" is not an icon meaning. Nothing was written.`,
|
|
214
214
|
closestNames(name, [...known]).map(each => ({
|
|
215
215
|
name: each,
|
|
216
|
-
reason: 'a known icon
|
|
216
|
+
reason: 'a known icon meaning',
|
|
217
217
|
})),
|
|
218
218
|
ERROR_CODES.ERR_NOT_FOUND,
|
|
219
219
|
);
|
|
@@ -17,7 +17,7 @@ export const doc = {
|
|
|
17
17
|
summary:
|
|
18
18
|
"Ranks stored icon indexes with icon()'s own ranking: an index made in one folder answers as icon() does there.",
|
|
19
19
|
description:
|
|
20
|
-
"Ranks the sets of every index together, with the same ranking as {@link function:icon}. An index made with `exportIconIndex()` in one folder answers a word search exactly as `icon(query)` does in that folder: the same matches, order, scores, and `matchCount`. A `<set>/<id>` query, which `icon()` reads as one icon, is refused. Indexes made in separate folders are ranked as one list, in the order they are given: equal scores keep that order, as `icon()` keeps a project's set order. An index holds no project order, so no set leads unless its index comes first; each set draws the
|
|
20
|
+
"Ranks the sets of every index together, with the same ranking as {@link function:icon}. An index made with `exportIconIndex()` in one folder answers a word search exactly as `icon(query)` does in that folder: the same matches, order, scores, and `matchCount`. A `<set>/<id>` query, which `icon()` reads as one icon, is refused. Indexes made in separate folders are ranked as one list, in the order they are given: equal scores keep that order, as `icon()` keeps a project's set order. An index holds no project order, so no set leads unless its index comes first; each set draws the variant its index carries. `set` keeps one set, by name or `<package>/<set>`, with the errors `icon()` gives. Every index must come from this CLI's version, because the sets' shape is the ranker's input. Experimental: it may change or be removed in a patch release.",
|
|
21
21
|
importPath: '@astryxdesign/cli/api',
|
|
22
22
|
signature:
|
|
23
23
|
'rankIconIndex(query: string, indexes: IconIndex | IconIndex[], options?: {set?: string, limit?: number}): Promise<IconSearchResponse>',
|