@astryxdesign/cli 0.7.11-canary.ec945c9 → 0.7.11
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/CHANGELOG.md +51 -0
- package/api/build/kit/rank.mjs +4 -21
- package/api/build/kit/words.d.mts +0 -1
- package/api/build/kit/words.mjs +1 -1
- package/api/icon/_adapter.d.mts +2 -3
- package/api/icon/_adapter.mjs +2 -8
- package/api/icon/_authoring.d.mts +0 -1
- package/api/icon/_authoring.mjs +66 -586
- package/api/icon/_records.d.mts +1 -1
- package/api/icon/_records.mjs +0 -1
- package/api/icon/add/add.mjs +38 -224
- package/api/icon/icon.type.d.mts +2 -22
- package/api/icon/icon.type.mjs +2 -6
- package/api/icon/iconAdd.doc.mjs +2 -2
- package/api/icon/iconNewDefinition.doc.mjs +2 -3
- package/api/icon/iconNewSet.doc.mjs +4 -4
- package/api/icon/search/search.mjs +9 -10
- package/api/integration/add-helpers.d.mts +1 -11
- package/api/integration/add-helpers.mjs +2 -5
- package/api/integration/authoring-checks.d.mts +2 -0
- package/api/integration/authoring-checks.mjs +6 -1
- package/api/logger.mjs +1 -2
- package/api/swizzle/_adapter.d.mts +0 -1
- package/api/swizzle/_adapter.mjs +1 -4
- package/api/swizzle/copy/copy.d.mts +43 -2
- package/api/swizzle/copy/copy.mjs +314 -194
- package/api/swizzle/swizzle.d.mts +2 -0
- package/api/swizzle/swizzle.doc.mjs +4 -8
- package/api/swizzle/swizzle.mjs +7 -3
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/assets/discover/official-packages.json +0 -12
- package/assets/docs/tree/icon-sets.doc.mjs +5 -11
- package/assets/templates/pages/file-explorer/page.tsx +79 -103
- package/assets/templates/pages/table-grouped/page.tsx +232 -160
- package/assets/templates/pages/table-grouped/template.doc.mjs +2 -0
- package/assets/templates/pages/theme-showcase/page.tsx +792 -724
- package/assets/templates/pages/theme-showcase/template.doc.mjs +5 -4
- package/clients/cli/commands/experimental/icon.mjs +10 -31
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +1 -2
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
- package/clients/cli/commands/swizzle.doc.mjs +3 -6
- package/clients/cli/commands/swizzle.mjs +9 -8
- package/foundation/discovery/component-loader.d.mts +1 -1
- package/foundation/discovery/doc-types.mjs +2 -9
- package/foundation/discovery/icon-ranking.d.mts +3 -27
- package/foundation/discovery/icon-ranking.mjs +8 -125
- package/foundation/discovery/icon-set-checks.mjs +35 -44
- package/foundation/discovery/icon-set-discovery.d.mts +0 -13
- package/foundation/discovery/icon-set-discovery.mjs +0 -25
- package/foundation/discovery/icon-set-writer.d.mts +16 -238
- package/foundation/discovery/icon-set-writer.mjs +79 -676
- package/foundation/discovery/module-exports.d.mts +2 -3
- package/foundation/discovery/module-exports.mjs +37 -167
- package/foundation/fs/paths.d.mts +1 -2
- package/foundation/fs/paths.mjs +4 -3
- package/package.json +6 -6
- package/api/icon/_default-look.d.mts +0 -155
- package/api/icon/_default-look.mjs +0 -474
- package/api/swizzle/_moduleGraph.d.mts +0 -162
- package/api/swizzle/_moduleGraph.mjs +0 -754
- package/foundation/text/shell-arg.d.mts +0 -14
- package/foundation/text/shell-arg.mjs +0 -17
|
@@ -44,9 +44,8 @@ import * as path from 'node:path';
|
|
|
44
44
|
import {findInstalledPackage} from '../fs/paths.mjs';
|
|
45
45
|
import {satisfiesRange} from '../env/semver.mjs';
|
|
46
46
|
import {
|
|
47
|
+
NOTICE_FILE_RE,
|
|
47
48
|
discoverIconSetDirectory,
|
|
48
|
-
hasLicenseNotice,
|
|
49
|
-
licenseNoticeFix,
|
|
50
49
|
resolveIconModule,
|
|
51
50
|
splitSpecifier,
|
|
52
51
|
} from './icon-set-discovery.mjs';
|
|
@@ -58,7 +57,6 @@ import {
|
|
|
58
57
|
otherNamesOf,
|
|
59
58
|
generatedTypesText,
|
|
60
59
|
readGeneratedStatements,
|
|
61
|
-
generatedTypesMatch,
|
|
62
60
|
} from './icon-set-writer.mjs';
|
|
63
61
|
import {
|
|
64
62
|
exportValueKind,
|
|
@@ -69,7 +67,6 @@ import {
|
|
|
69
67
|
} from './module-exports.mjs';
|
|
70
68
|
import {astryxIconDefinitions} from './icon-definition-discovery.mjs';
|
|
71
69
|
import {rankIcons} from './icon-ranking.mjs';
|
|
72
|
-
import {shellArg} from '../text/shell-arg.mjs';
|
|
73
70
|
import {
|
|
74
71
|
issueError,
|
|
75
72
|
issueWarning,
|
|
@@ -279,17 +276,16 @@ function checkContract(set, packageName, pkg, unchecked) {
|
|
|
279
276
|
const actual = fs.existsSync(typesFile)
|
|
280
277
|
? fs.readFileSync(typesFile, 'utf-8')
|
|
281
278
|
: null;
|
|
282
|
-
// The
|
|
283
|
-
//
|
|
284
|
-
|
|
279
|
+
// The header comment is the writer's, and changes between releases;
|
|
280
|
+
// the declarations are what must match.
|
|
281
|
+
const code = (/** @type {string} */ text) =>
|
|
282
|
+
text
|
|
283
|
+
.split('\n')
|
|
284
|
+
.filter(line => !line.startsWith('//'))
|
|
285
|
+
.join('\n');
|
|
285
286
|
if (
|
|
286
287
|
expected != null &&
|
|
287
|
-
(actual == null ||
|
|
288
|
-
!generatedTypesMatch(
|
|
289
|
-
actual,
|
|
290
|
-
expected,
|
|
291
|
-
/** @type {string} */ (typesRel),
|
|
292
|
-
))
|
|
288
|
+
(actual == null || code(actual) !== code(expected))
|
|
293
289
|
) {
|
|
294
290
|
issues.push(
|
|
295
291
|
issueError(
|
|
@@ -363,12 +359,12 @@ function checkDefinitions(set) {
|
|
|
363
359
|
if (mapped.has(doc.name) || !doc.builtIn) continue;
|
|
364
360
|
const suggestion = suggestIcon(set, doc);
|
|
365
361
|
const hint = suggestion
|
|
366
|
-
? ` Suggested: astryx experimental icon map ${doc.name} ${suggestion.icon}
|
|
362
|
+
? ` Suggested: astryx experimental icon map ${doc.name} ${suggestion.icon}.`
|
|
367
363
|
: '';
|
|
368
364
|
issues.push(
|
|
369
365
|
issueError(
|
|
370
366
|
ICON_BUILTIN_DEFINITION_MISSING,
|
|
371
|
-
`${label} maps no icon to the built-in icon definition "${doc.name}" (${doc.description} Words: ${doc.words.join(', ')}.). Every set maps every built-in definition: run \`astryx experimental icon map ${doc.name} <icon id
|
|
367
|
+
`${label} maps no icon to the built-in icon definition "${doc.name}" (${doc.description} Words: ${doc.words.join(', ')}.). Every set maps every built-in definition: run \`astryx experimental icon map ${doc.name} <icon id>\` with the icon that draws it${findHint(set, doc)}.${hint}`,
|
|
372
368
|
),
|
|
373
369
|
);
|
|
374
370
|
}
|
|
@@ -386,7 +382,7 @@ function checkDefinitions(set) {
|
|
|
386
382
|
issues.push(
|
|
387
383
|
issueWarning(
|
|
388
384
|
ICON_DEFINITION_UNUSED,
|
|
389
|
-
`${label} declares the icon definition "${doc.name}", but "map" names no icon for it. Map it with \`astryx experimental icon map ${doc.name} <icon id
|
|
385
|
+
`${label} declares the icon definition "${doc.name}", but "map" names no icon for it. Map it with \`astryx experimental icon map ${doc.name} <icon id>\`, or remove definitions/${doc.name}.doc.mjs.${suggestion ? ` Suggested: astryx experimental icon map ${doc.name} ${suggestion.icon}.` : ''}`,
|
|
390
386
|
),
|
|
391
387
|
);
|
|
392
388
|
}
|
|
@@ -542,7 +538,13 @@ export function suggestedIcons(set, doc) {
|
|
|
542
538
|
...nameWords,
|
|
543
539
|
...wordIds.flatMap(id => id.split('-')).map(stem),
|
|
544
540
|
]);
|
|
545
|
-
const icons =
|
|
541
|
+
const icons = set.data.icons.map(icon => ({
|
|
542
|
+
id: icon.id,
|
|
543
|
+
words: icon.id.split('-').map(stem),
|
|
544
|
+
raw: icon.id.split('-'),
|
|
545
|
+
// The library's other names for it, the same ones `map` accepts.
|
|
546
|
+
other: otherNamesOf(icon),
|
|
547
|
+
}));
|
|
546
548
|
/** How many of the definition's words an id has: more is a better fit. */
|
|
547
549
|
const fit = (/** @type {string[]} */ words) =>
|
|
548
550
|
words.filter(word => meaning.has(word)).length;
|
|
@@ -634,29 +636,6 @@ export function suggestedIcons(set, doc) {
|
|
|
634
636
|
return found.slice(0, SUGGESTIONS_PER_DEFINITION);
|
|
635
637
|
}
|
|
636
638
|
|
|
637
|
-
/**
|
|
638
|
-
* Each icon as the suggestion rules read it: its id's words as written and
|
|
639
|
-
* in singular form, and the library's other names for it (the same ones
|
|
640
|
-
* `map` accepts). Built once per list of icons, so suggesting for every
|
|
641
|
-
* definition of a large library reads each icon once.
|
|
642
|
-
* @type {WeakMap<object, Array<{id: string, words: string[], raw: string[], other: string[]}>>}
|
|
643
|
-
*/
|
|
644
|
-
const suggestionIndexes = new WeakMap();
|
|
645
|
-
|
|
646
|
-
/** @param {Array<{id: string, words?: string[]}>} list */
|
|
647
|
-
function suggestionIndex(list) {
|
|
648
|
-
const cached = suggestionIndexes.get(list);
|
|
649
|
-
if (cached) return cached;
|
|
650
|
-
const index = list.map(icon => ({
|
|
651
|
-
id: icon.id,
|
|
652
|
-
words: icon.id.split('-').map(stem),
|
|
653
|
-
raw: icon.id.split('-'),
|
|
654
|
-
other: otherNamesOf(icon),
|
|
655
|
-
}));
|
|
656
|
-
suggestionIndexes.set(list, index);
|
|
657
|
-
return index;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
639
|
/**
|
|
661
640
|
* A word in its singular form, so a plural meets its singular and nothing
|
|
662
641
|
* else: `languages` meets `language`, `arrows` meets `arrow`. Only a
|
|
@@ -955,10 +934,10 @@ function findHint(set, doc) {
|
|
|
955
934
|
each => each.score >= FIND_FLOOR,
|
|
956
935
|
);
|
|
957
936
|
if (found.length > 0) {
|
|
958
|
-
return ` (icons matching "${query}": \`astryx experimental icon ${
|
|
937
|
+
return ` (icons matching "${query}": \`astryx experimental icon ${query} --set ${set.name}\`)`;
|
|
959
938
|
}
|
|
960
939
|
}
|
|
961
|
-
return
|
|
940
|
+
return ' (no icon in the set has its name or words: pick the library icon that draws it; if the library has none, map the closest, or add your own artwork with `astryx experimental icon add <Name> --from ./src/icons/<name>.js --definition <definition>`)';
|
|
962
941
|
}
|
|
963
942
|
|
|
964
943
|
/**
|
|
@@ -1004,11 +983,14 @@ function checkUpstream(set, packageDir, pkg) {
|
|
|
1004
983
|
),
|
|
1005
984
|
);
|
|
1006
985
|
}
|
|
1007
|
-
|
|
986
|
+
const rootNotices = safeList(packageDir).filter(name =>
|
|
987
|
+
NOTICE_FILE_RE.test(name),
|
|
988
|
+
);
|
|
989
|
+
if (set.notices.length === 0 && rootNotices.length === 0) {
|
|
1008
990
|
issues.push(
|
|
1009
991
|
issueWarning(
|
|
1010
992
|
ICON_LICENSE_NOTICE_MISSING,
|
|
1011
|
-
`${label} is generated from ${source.package}
|
|
993
|
+
`${label} is generated from ${source.package} but ships no license notice. Copy the library's LICENSE (and NOTICE, if any) into the set directory or the package root.`,
|
|
1012
994
|
),
|
|
1013
995
|
);
|
|
1014
996
|
}
|
|
@@ -1024,3 +1006,12 @@ function safeSatisfies(version, range) {
|
|
|
1024
1006
|
return true;
|
|
1025
1007
|
}
|
|
1026
1008
|
}
|
|
1009
|
+
|
|
1010
|
+
/** @param {string} dir */
|
|
1011
|
+
function safeList(dir) {
|
|
1012
|
+
try {
|
|
1013
|
+
return fs.readdirSync(dir);
|
|
1014
|
+
} catch {
|
|
1015
|
+
return [];
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* What to add when a set wraps a library and has no license notice: a
|
|
6
|
-
* NOTICE file in the set directory, with the file names that count. The
|
|
7
|
-
* CLI never writes it, because the license text is the author's to state.
|
|
8
|
-
* @param {string} setDir the set directory, from the package root
|
|
9
|
-
* @param {string} library the library as `name@version`
|
|
10
|
-
*/
|
|
11
|
-
export function licenseNoticeFix(setDir: string, library: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Whether a directory has a license or notice file ({@link NOTICE_FILE_RE}).
|
|
14
|
-
* @param {string} dir
|
|
15
|
-
*/
|
|
16
|
-
export function hasLicenseNotice(dir: string): boolean;
|
|
17
4
|
/**
|
|
18
5
|
* One installed icon set: its descriptor, its data, and where it came from.
|
|
19
6
|
* @typedef {object} DiscoveredIconSet
|
|
@@ -43,31 +43,6 @@ const SET_NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
|
43
43
|
/** A license or notice file a set ships beside its data (FR15). */
|
|
44
44
|
export const NOTICE_FILE_RE = /^(?:licen[cs]e|notice|copying)(?:[.-].*)?$/iu;
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* What to add when a set wraps a library and has no license notice: a
|
|
48
|
-
* NOTICE file in the set directory, with the file names that count. The
|
|
49
|
-
* CLI never writes it, because the license text is the author's to state.
|
|
50
|
-
* @param {string} setDir the set directory, from the package root
|
|
51
|
-
* @param {string} library the library as `name@version`
|
|
52
|
-
*/
|
|
53
|
-
export function licenseNoticeFix(setDir, library) {
|
|
54
|
-
return `Add a NOTICE (or LICENSE) file to ${setDir} that names ${library} and its license: \`${setDir}/NOTICE\`. A file named LICENSE, LICENCE, NOTICE, or COPYING, in any case and with an optional suffix such as NOTICE.md or LICENSE-MIT, counts in the set directory or the package root.`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Whether a directory has a license or notice file ({@link NOTICE_FILE_RE}).
|
|
59
|
-
* @param {string} dir
|
|
60
|
-
*/
|
|
61
|
-
export function hasLicenseNotice(dir) {
|
|
62
|
-
try {
|
|
63
|
-
return fs
|
|
64
|
-
.readdirSync(dir, {withFileTypes: true})
|
|
65
|
-
.some(file => file.isFile() && NOTICE_FILE_RE.test(file.name));
|
|
66
|
-
} catch {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
46
|
/**
|
|
72
47
|
* One installed icon set: its descriptor, its data, and where it came from.
|
|
73
48
|
* @typedef {object} DiscoveredIconSet
|
|
@@ -166,158 +166,29 @@ export function modulePrefix(file: string, options?: {
|
|
|
166
166
|
adapter?: boolean;
|
|
167
167
|
exclude?: string[];
|
|
168
168
|
}): string[];
|
|
169
|
-
/**
|
|
170
|
-
* How a module names its icons: the library prefix every icon export shares
|
|
171
|
-
* ({@link modulePrefix}) and the look words its names end in
|
|
172
|
-
* ({@link lookPositions}), read from its icon exports once. A large module
|
|
173
|
-
* reports its reading, as {@link libraryIcons} does.
|
|
174
|
-
* @param {string} file
|
|
175
|
-
* @param {{adapter?: boolean, module?: string, progress?: (line: string) => void}} [options]
|
|
176
|
-
* `module`: the module as the author named it, for progress; `progress`:
|
|
177
|
-
* hears the reading of a large module
|
|
178
|
-
* @returns {{prefix: string[], positions: Array<Set<string>>}}
|
|
179
|
-
*/
|
|
180
|
-
export function moduleNaming(file: string, options?: {
|
|
181
|
-
adapter?: boolean;
|
|
182
|
-
module?: string;
|
|
183
|
-
progress?: (line: string) => void;
|
|
184
|
-
}): {
|
|
185
|
-
prefix: string[];
|
|
186
|
-
positions: Array<Set<string>>;
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* An export's id and set name ({@link iconNaming}) without the look words
|
|
190
|
-
* its library's names end in ({@link lookPositions}):
|
|
191
|
-
* `XOutline24WGHT500Icon` is `x`, `XIcon`.
|
|
192
|
-
* @param {string} name
|
|
193
|
-
* @param {{prefix: string[], positions: Array<Set<string>>}} naming
|
|
194
|
-
* @returns {{id: string, name: string}}
|
|
195
|
-
*/
|
|
196
|
-
export function iconNamingWithoutLook(name: string, { prefix, positions }: {
|
|
197
|
-
prefix: string[];
|
|
198
|
-
positions: Array<Set<string>>;
|
|
199
|
-
}): {
|
|
200
|
-
id: string;
|
|
201
|
-
name: string;
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
204
|
-
* The trailing words a library encodes its looks with: a style, a size, a
|
|
205
|
-
* weight (`XOutline24WGHT500Icon` is `x` in the `outline`, `24`, `wght500`
|
|
206
|
-
* look). A trailing position is a look position when, across at least
|
|
207
|
-
* {@link LOOK_MIN_ICONS} icons, at most {@link LOOK_MAX_VALUES} words fill
|
|
208
|
-
* it, each on at least 5% of the icons and together on at least 90%, and
|
|
209
|
-
* those words name a look ({@link namesLook}); the positions are read from
|
|
210
|
-
* the end while they hold. Glyph names never meet that bar (`trash-2` and
|
|
211
|
-
* `clock-10` are a few icons each, and `up` and `down` are directions), so
|
|
212
|
-
* a library that encodes no looks has none. Reads each id once per
|
|
213
|
-
* position and keeps only counts.
|
|
214
|
-
* @param {string[]} ids every icon's id
|
|
215
|
-
* @returns {Array<Set<string>>} the look positions, the last word first
|
|
216
|
-
*/
|
|
217
|
-
export function lookPositions(ids: string[]): Array<Set<string>>;
|
|
218
|
-
/**
|
|
219
|
-
* An id's glyph words and its look words, by {@link lookPositions}:
|
|
220
|
-
* `x-outline-24-wght500` is `x` with `[wght500, 24, outline]`, null where
|
|
221
|
-
* the id has no look word.
|
|
222
|
-
* @param {string[]} words
|
|
223
|
-
* @param {Array<Set<string>>} positions
|
|
224
|
-
* @returns {{base: string[], look: Array<string | null>}}
|
|
225
|
-
*/
|
|
226
|
-
export function splitLook(words: string[], positions: Array<Set<string>>): {
|
|
227
|
-
base: string[];
|
|
228
|
-
look: Array<string | null>;
|
|
229
|
-
};
|
|
230
|
-
/**
|
|
231
|
-
* The word each look position prefers: a word of `prefer` it has (the set's
|
|
232
|
-
* default variant), else a usual default style word, else the middle of a
|
|
233
|
-
* series of numbered words (`wght300` … `wght700` gives `wght500`), else
|
|
234
|
-
* its first word in order.
|
|
235
|
-
* @param {Array<Set<string>>} positions
|
|
236
|
-
* @param {string[]} [prefer]
|
|
237
|
-
* @returns {string[]}
|
|
238
|
-
*/
|
|
239
|
-
export function preferredLook(positions: Array<Set<string>>, prefer?: string[]): string[];
|
|
240
|
-
/**
|
|
241
|
-
* One icon a library gives.
|
|
242
|
-
* @typedef {object} LibraryIcon
|
|
243
|
-
* @property {string} export the library export it reads
|
|
244
|
-
* @property {string} id
|
|
245
|
-
* @property {string} name the name the set exports it as
|
|
246
|
-
* @property {boolean} adapt
|
|
247
|
-
* @property {string[]} aliases the ids of the other names the library
|
|
248
|
-
* exports the icon as, leaving out the library's own name (`lucide-trash`)
|
|
249
|
-
* @property {Array<string | null>} [look] in a library that encodes looks:
|
|
250
|
-
* this export's look words by position, the last word first
|
|
251
|
-
* @property {string[]} [looks] in a library that encodes looks: every
|
|
252
|
-
* export that draws the glyph, this one included
|
|
253
|
-
*/
|
|
254
|
-
/**
|
|
255
|
-
* The words a library's looks are named by, and the look a set takes from
|
|
256
|
-
* it: what {@link libraryIcons} found, for the receipt.
|
|
257
|
-
* @typedef {object} LibraryLookSummary
|
|
258
|
-
* @property {string[][]} positions each position's words, sorted, the last
|
|
259
|
-
* word of a name first
|
|
260
|
-
* @property {string[]} preferred the word taken in each position
|
|
261
|
-
* @property {number} exports how many exports draw the icons
|
|
262
|
-
*/
|
|
263
169
|
/**
|
|
264
170
|
* Every icon a whole library exports, for wrapping it at once: one entry per
|
|
265
171
|
* component (and, with an adapter, per data export), read by its `…Icon`
|
|
266
172
|
* export when it has one (an alias of the same value is recorded once), with
|
|
267
173
|
* its id and the name the set exports it as from the name, the library
|
|
268
174
|
* prefix left out ({@link libraryPrefix}).
|
|
269
|
-
*
|
|
270
|
-
* A library that encodes looks in its export names ({@link lookPositions})
|
|
271
|
-
* gives one icon per glyph: the look {@link preferredLook} prefers, its id
|
|
272
|
-
* and name without the look words (`XOutline24WGHT500Icon` is `x`,
|
|
273
|
-
* `XIcon`), and its `looks`, every export that draws the glyph.
|
|
274
175
|
* @param {string} file
|
|
275
|
-
* @param {{adapter?: boolean, exclude?: string[]
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* `progress`: hears the reading of a large module;
|
|
281
|
-
* `summary`: hears the looks found, when the library has any
|
|
282
|
-
* @returns {LibraryIcon[]}
|
|
176
|
+
* @param {{adapter?: boolean, exclude?: string[]}} [options] `adapter`:
|
|
177
|
+
* whether the set declares one; `exclude`: export names that are not icons
|
|
178
|
+
* @returns {Array<{export: string, id: string, name: string, adapt: boolean, aliases: string[]}>}
|
|
179
|
+
* `aliases`: the ids of the other names the library exports the icon as,
|
|
180
|
+
* leaving out the library's own name (`lucide-trash`)
|
|
283
181
|
*/
|
|
284
182
|
export function libraryIcons(file: string, options?: {
|
|
285
183
|
adapter?: boolean;
|
|
286
184
|
exclude?: string[];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
* ({@link libraryIcons}), with the look positions and the words preferred.
|
|
295
|
-
* Without look positions the icons are returned as they are.
|
|
296
|
-
* @param {LibraryIcon[]} all every icon, one per export
|
|
297
|
-
* @param {string[]} [prefer]
|
|
298
|
-
* @returns {{icons: LibraryIcon[], positions: Array<Set<string>>, preferred: string[]}}
|
|
299
|
-
*/
|
|
300
|
-
export function libraryLooks(all: LibraryIcon[], prefer?: string[]): {
|
|
301
|
-
icons: LibraryIcon[];
|
|
302
|
-
positions: Array<Set<string>>;
|
|
303
|
-
preferred: string[];
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* Every icon a library exports, one per export: {@link libraryIcons} before
|
|
307
|
-
* looks are grouped. A large module reports its reading, as
|
|
308
|
-
* {@link libraryIcons} does.
|
|
309
|
-
* @param {string} file
|
|
310
|
-
* @param {{adapter?: boolean, exclude?: string[], module?: string, progress?: (line: string) => void}} [options]
|
|
311
|
-
* `module`: the module as the author named it, for progress; `progress`:
|
|
312
|
-
* hears the reading of a large module
|
|
313
|
-
* @returns {LibraryIcon[]}
|
|
314
|
-
*/
|
|
315
|
-
export function everyLibraryIcon(file: string, options?: {
|
|
316
|
-
adapter?: boolean;
|
|
317
|
-
exclude?: string[];
|
|
318
|
-
module?: string;
|
|
319
|
-
progress?: (line: string) => void;
|
|
320
|
-
}): LibraryIcon[];
|
|
185
|
+
}): Array<{
|
|
186
|
+
export: string;
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
adapt: boolean;
|
|
190
|
+
aliases: string[];
|
|
191
|
+
}>;
|
|
321
192
|
/**
|
|
322
193
|
* The source of one icon definition file, typed IconDefinitionDoc.
|
|
323
194
|
* @param {{name: string, description: string, words: string[]}} doc
|
|
@@ -328,20 +199,13 @@ export function iconDefinitionSource(doc: {
|
|
|
328
199
|
words: string[];
|
|
329
200
|
}): string;
|
|
330
201
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* @param {string} name
|
|
334
|
-
*/
|
|
335
|
-
export function definitionNameFromInput(name: string): string;
|
|
336
|
-
/**
|
|
337
|
-
* Check a new icon definition for a set: a camelCase name (or its kebab-case
|
|
338
|
-
* form, {@link definitionNameFromInput}) no Astryx definition has, a
|
|
339
|
-
* description, and at least one lower-case word.
|
|
202
|
+
* Check a new icon definition for a set: a camelCase name no Astryx
|
|
203
|
+
* definition has, a description, and at least one lower-case word.
|
|
340
204
|
* @param {DiscoveredIconSet} set
|
|
341
|
-
* @param {{name: string, description?: string, words?: string[]}}
|
|
205
|
+
* @param {{name: string, description?: string, words?: string[]}} doc
|
|
342
206
|
* @returns {{name: string, description: string, words: string[]}}
|
|
343
207
|
*/
|
|
344
|
-
export function checkNewDefinition(set: DiscoveredIconSet,
|
|
208
|
+
export function checkNewDefinition(set: DiscoveredIconSet, doc: {
|
|
345
209
|
name: string;
|
|
346
210
|
description?: string;
|
|
347
211
|
words?: string[];
|
|
@@ -368,15 +232,6 @@ export function writeDefinitionFile(set: DiscoveredIconSet, doc: {
|
|
|
368
232
|
description: string;
|
|
369
233
|
words: string[];
|
|
370
234
|
}): () => void;
|
|
371
|
-
/**
|
|
372
|
-
* Whether a generated declaration file declares what its generated module
|
|
373
|
-
* gives, statement by statement however a formatter left either file
|
|
374
|
-
* ({@link generatedStatements}); the header comment is ignored.
|
|
375
|
-
* @param {string} actual the declaration file as it is
|
|
376
|
-
* @param {string} expected {@link generatedTypesText} for the module
|
|
377
|
-
* @param {string} label the declaration file's path, for a parse error
|
|
378
|
-
*/
|
|
379
|
-
export function generatedTypesMatch(actual: string, expected: string, label: string): boolean;
|
|
380
235
|
/**
|
|
381
236
|
* The generated icons module of a set, from the package root: `generated`
|
|
382
237
|
* in its data file, else `<set directory>/<set>.generated.js`.
|
|
@@ -461,34 +316,6 @@ export function sameIconModule(a: string, b: string): boolean;
|
|
|
461
316
|
* @param {string} specifier
|
|
462
317
|
*/
|
|
463
318
|
export function iconModulePackage(specifier: string): string;
|
|
464
|
-
/**
|
|
465
|
-
* The set's exports that read one file of a package, where a refresh from
|
|
466
|
-
* that package's root can read them from the root instead. An export moves
|
|
467
|
-
* when the root exports the same icon: an export that resolves to the same
|
|
468
|
-
* file and binding. When the subpath export cannot be resolved, a root
|
|
469
|
-
* export of the same name counts. Each maps to the root's
|
|
470
|
-
* export and the module it reads now. Empty unless `root` is a package
|
|
471
|
-
* root, not a subpath or a ./ path.
|
|
472
|
-
* @param {Map<string, {module: string, source: string}>} origins the
|
|
473
|
-
* set's exports ({@link generatedOrigins})
|
|
474
|
-
* @param {{file: string, module: string}} root the refreshed module
|
|
475
|
-
* @param {string[]} rootExports the root's icon exports
|
|
476
|
-
* @param {{packageDir: string, pkg: Record<string, any>}} where
|
|
477
|
-
* @returns {Map<string, {source: string, from: string}>}
|
|
478
|
-
*/
|
|
479
|
-
export function packageRootMoves(origins: Map<string, {
|
|
480
|
-
module: string;
|
|
481
|
-
source: string;
|
|
482
|
-
}>, root: {
|
|
483
|
-
file: string;
|
|
484
|
-
module: string;
|
|
485
|
-
}, rootExports: string[], where: {
|
|
486
|
-
packageDir: string;
|
|
487
|
-
pkg: Record<string, any>;
|
|
488
|
-
}): Map<string, {
|
|
489
|
-
source: string;
|
|
490
|
-
from: string;
|
|
491
|
-
}>;
|
|
492
319
|
/**
|
|
493
320
|
* Write the set's generated module and its declaration file
|
|
494
321
|
* ({@link generatedModuleText}). Returns whether either changed, and a
|
|
@@ -642,55 +469,6 @@ export class IconSetAuthoringError extends Error {
|
|
|
642
469
|
}
|
|
643
470
|
/** The theme map the generated module writes. */
|
|
644
471
|
export const THEME_MAP_NAME: "themeIcons";
|
|
645
|
-
/**
|
|
646
|
-
* One icon a library gives.
|
|
647
|
-
*/
|
|
648
|
-
export type LibraryIcon = {
|
|
649
|
-
/**
|
|
650
|
-
* the library export it reads
|
|
651
|
-
*/
|
|
652
|
-
export: string;
|
|
653
|
-
id: string;
|
|
654
|
-
/**
|
|
655
|
-
* the name the set exports it as
|
|
656
|
-
*/
|
|
657
|
-
name: string;
|
|
658
|
-
adapt: boolean;
|
|
659
|
-
/**
|
|
660
|
-
* the ids of the other names the library
|
|
661
|
-
* exports the icon as, leaving out the library's own name (`lucide-trash`)
|
|
662
|
-
*/
|
|
663
|
-
aliases: string[];
|
|
664
|
-
/**
|
|
665
|
-
* in a library that encodes looks:
|
|
666
|
-
* this export's look words by position, the last word first
|
|
667
|
-
*/
|
|
668
|
-
look?: (string | null)[] | undefined;
|
|
669
|
-
/**
|
|
670
|
-
* in a library that encodes looks: every
|
|
671
|
-
* export that draws the glyph, this one included
|
|
672
|
-
*/
|
|
673
|
-
looks?: string[] | undefined;
|
|
674
|
-
};
|
|
675
|
-
/**
|
|
676
|
-
* The words a library's looks are named by, and the look a set takes from
|
|
677
|
-
* it: what {@link libraryIcons} found, for the receipt.
|
|
678
|
-
*/
|
|
679
|
-
export type LibraryLookSummary = {
|
|
680
|
-
/**
|
|
681
|
-
* each position's words, sorted, the last
|
|
682
|
-
* word of a name first
|
|
683
|
-
*/
|
|
684
|
-
positions: string[][];
|
|
685
|
-
/**
|
|
686
|
-
* the word taken in each position
|
|
687
|
-
*/
|
|
688
|
-
preferred: string[];
|
|
689
|
-
/**
|
|
690
|
-
* how many exports draw the icons
|
|
691
|
-
*/
|
|
692
|
-
exports: number;
|
|
693
|
-
};
|
|
694
472
|
export type DiscoveredIconSet = import("./icon-set-discovery.mjs").DiscoveredIconSet;
|
|
695
473
|
export type IconSetData = import("../../authoring/doctypes/icon-set/type").IconSetData;
|
|
696
474
|
/**
|