@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
|
@@ -69,6 +69,7 @@ import {
|
|
|
69
69
|
} from './module-exports.mjs';
|
|
70
70
|
import {astryxIconDefinitions} from './icon-definition-discovery.mjs';
|
|
71
71
|
import {rankIcons} from './icon-ranking.mjs';
|
|
72
|
+
import {unmappedTemplateMeanings} from './template-icon-meanings.mjs';
|
|
72
73
|
import {shellArg} from '../text/shell-arg.mjs';
|
|
73
74
|
import {
|
|
74
75
|
issueError,
|
|
@@ -405,6 +406,10 @@ function checkDefinitions(set) {
|
|
|
405
406
|
* {@link suggestedIcons} gives, if any
|
|
406
407
|
* @property {IconSetUnchecked[]} unchecked what the checks could not judge:
|
|
407
408
|
* never counted, never failing, even under `--strict`
|
|
409
|
+
* @property {{unmapped: import('./template-icon-meanings.mjs').TemplateMeaning[]}} [templateMeanings]
|
|
410
|
+
* the icon definitions the bundled templates use that the set's `map` does
|
|
411
|
+
* not name, most used first: a copied template renders a placeholder for
|
|
412
|
+
* each. Never counted, never failing
|
|
408
413
|
*/
|
|
409
414
|
|
|
410
415
|
/**
|
|
@@ -414,9 +419,16 @@ function checkDefinitions(set) {
|
|
|
414
419
|
* @param {{name: string, iconSets?: string}} loaded
|
|
415
420
|
* @param {Map<string, IconSetUnchecked[]>} [unchecked] what
|
|
416
421
|
* {@link iconSetIssues} could not judge, by set name
|
|
422
|
+
* @param {import('./template-icon-meanings.mjs').TemplateMeaning[]} [templateMeanings]
|
|
423
|
+
* the definitions the bundled templates use; each set lists the ones it
|
|
424
|
+
* leaves unmapped
|
|
417
425
|
* @returns {IconSetCoverage[]}
|
|
418
426
|
*/
|
|
419
|
-
export function iconSetCoverage(
|
|
427
|
+
export function iconSetCoverage(
|
|
428
|
+
loaded,
|
|
429
|
+
unchecked = new Map(),
|
|
430
|
+
templateMeanings,
|
|
431
|
+
) {
|
|
420
432
|
if (!loaded.iconSets) return [];
|
|
421
433
|
const found = discoverIconSetDirectory(loaded.iconSets, loaded.name);
|
|
422
434
|
const astryx = astryxIconDefinitions().definitions.map(each => each.doc);
|
|
@@ -445,6 +457,16 @@ export function iconSetCoverage(loaded, unchecked = new Map()) {
|
|
|
445
457
|
: [];
|
|
446
458
|
}),
|
|
447
459
|
unchecked: unchecked.get(set.name) ?? [],
|
|
460
|
+
...(templateMeanings
|
|
461
|
+
? {
|
|
462
|
+
templateMeanings: {
|
|
463
|
+
unmapped: unmappedTemplateMeanings(
|
|
464
|
+
templateMeanings,
|
|
465
|
+
set.data.map,
|
|
466
|
+
),
|
|
467
|
+
},
|
|
468
|
+
}
|
|
469
|
+
: {}),
|
|
448
470
|
};
|
|
449
471
|
});
|
|
450
472
|
}
|
|
@@ -592,27 +614,47 @@ export function suggestedIcons(set, doc) {
|
|
|
592
614
|
}
|
|
593
615
|
// 3. Ids that start with the name as written (`video` → `video-camera`),
|
|
594
616
|
// never a negated form. A plural is not the same start: `users` is not
|
|
595
|
-
// `user-plus`, and `apps` is not `app-window`.
|
|
617
|
+
// `user-plus`, and `apps` is not `app-window`. Only an id whose other
|
|
618
|
+
// words are the definition's words, or a size, shape, or number, comes
|
|
619
|
+
// here; one whose other words name something else (`delete-left`, a
|
|
620
|
+
// key) comes after the icons the definition's words name.
|
|
596
621
|
const nameRaw = nameId.split('-');
|
|
597
|
-
ranked(
|
|
622
|
+
const startsWithName = ranked(
|
|
598
623
|
icons.filter(
|
|
599
624
|
icon =>
|
|
600
625
|
icon.raw.length > nameRaw.length &&
|
|
601
626
|
nameRaw.every((word, index) => icon.raw[index] === word) &&
|
|
602
627
|
!negated(icon.raw.slice(nameRaw.length)),
|
|
603
628
|
),
|
|
604
|
-
)
|
|
629
|
+
);
|
|
630
|
+
const onlyMeaning = (/** @type {{raw: string[]}} */ icon) =>
|
|
631
|
+
icon.raw
|
|
632
|
+
.slice(nameRaw.length)
|
|
633
|
+
.every(word => meaning.has(stem(word)) || QUALIFIER_RE.test(word));
|
|
634
|
+
startsWithName.filter(onlyMeaning).forEach(icon => add(icon.id, nameId));
|
|
635
|
+
// A word another Astryx definition also has (`store` for save and for a
|
|
636
|
+
// shopping bag) does not say which one an icon draws: the words only this
|
|
637
|
+
// definition has come first.
|
|
638
|
+
const shared = sharedWords(doc.name);
|
|
639
|
+
const wordOrder = [
|
|
640
|
+
...[...wordIds.keys()].filter(index => !shared.has(wordIds[index])),
|
|
641
|
+
...[...wordIds.keys()].filter(index => shared.has(wordIds[index])),
|
|
642
|
+
];
|
|
605
643
|
// 4. An icon whose whole id is one of the definition's words.
|
|
606
|
-
for (const
|
|
644
|
+
for (const index of wordOrder) {
|
|
645
|
+
const id = wordIds[index];
|
|
607
646
|
if (icons.some(icon => icon.id === id)) add(id, id.replace(/-/gu, ' '));
|
|
608
647
|
}
|
|
609
648
|
// 5. Another name the library gives an icon that is one of the
|
|
610
649
|
// definition's words (Lucide's `smile` on `face-slightly-smiling`).
|
|
611
|
-
for (const
|
|
650
|
+
for (const index of wordOrder) {
|
|
612
651
|
for (const icon of icons) {
|
|
613
|
-
if (icon.other.includes(
|
|
652
|
+
if (icon.other.includes(wordIds[index])) add(icon.id, doc.words[index]);
|
|
614
653
|
}
|
|
615
654
|
}
|
|
655
|
+
startsWithName
|
|
656
|
+
.filter(icon => !onlyMeaning(icon))
|
|
657
|
+
.forEach(icon => add(icon.id, nameId));
|
|
616
658
|
// 6. Last, two-word ids that are a one-word word with only a size, shape,
|
|
617
659
|
// or number after it (`columns` → `columns-3`, `plus` → `plus-circle`,
|
|
618
660
|
// `grid` → `grid-2x2`), best fit first. Any other second word names
|
|
@@ -634,6 +676,25 @@ export function suggestedIcons(set, doc) {
|
|
|
634
676
|
return found.slice(0, SUGGESTIONS_PER_DEFINITION);
|
|
635
677
|
}
|
|
636
678
|
|
|
679
|
+
/**
|
|
680
|
+
* The words, written as ids, that another Astryx definition than `name` also
|
|
681
|
+
* has as its name or one of its words.
|
|
682
|
+
* @param {string} name
|
|
683
|
+
* @returns {Set<string>}
|
|
684
|
+
*/
|
|
685
|
+
function sharedWords(name) {
|
|
686
|
+
/** @type {Set<string>} */
|
|
687
|
+
const shared = new Set();
|
|
688
|
+
for (const {doc} of astryxIconDefinitions().definitions) {
|
|
689
|
+
if (doc.name === name) continue;
|
|
690
|
+
shared.add(doc.name.replace(/([a-z0-9])([A-Z])/gu, '$1-$2').toLowerCase());
|
|
691
|
+
for (const word of doc.words) {
|
|
692
|
+
shared.add(word.trim().toLowerCase().replace(/\s+/gu, '-'));
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return shared;
|
|
696
|
+
}
|
|
697
|
+
|
|
637
698
|
/**
|
|
638
699
|
* Each icon as the suggestion rules read it: its id's words as written and
|
|
639
700
|
* in singular form, and the library's other names for it (the same ones
|
|
@@ -143,14 +143,29 @@ export function iconSetList(configured: string | readonly string[] | undefined):
|
|
|
143
143
|
/**
|
|
144
144
|
* Installed sets the project's list leaves out: the problem, and the fix that
|
|
145
145
|
* adds them as backups after the list's own. Doctor and `experimental icon
|
|
146
|
-
* use` print the same words.
|
|
147
|
-
*
|
|
148
|
-
* @param {string}
|
|
149
|
-
* @param {string
|
|
150
|
-
* @param {string
|
|
146
|
+
* use` print the same words. Every set is named the same way: by its name
|
|
147
|
+
* when no other installed set has that name, else as `<package>/<set>`.
|
|
148
|
+
* @param {Array<{package: string, name: string}>} installed every installed set
|
|
149
|
+
* @param {{package: string, name: string}} main the list's main set
|
|
150
|
+
* @param {Array<{package: string, name: string}>} backups the list's
|
|
151
|
+
* backups, in order
|
|
152
|
+
* @param {Array<{package: string, name: string}>} unlisted the installed
|
|
153
|
+
* sets the list leaves out
|
|
151
154
|
* @returns {{problem: string, command: string, fix: string}}
|
|
152
155
|
*/
|
|
153
|
-
export function unlistedIconSets(installed:
|
|
156
|
+
export function unlistedIconSets(installed: Array<{
|
|
157
|
+
package: string;
|
|
158
|
+
name: string;
|
|
159
|
+
}>, main: {
|
|
160
|
+
package: string;
|
|
161
|
+
name: string;
|
|
162
|
+
}, backups: Array<{
|
|
163
|
+
package: string;
|
|
164
|
+
name: string;
|
|
165
|
+
}>, unlisted: Array<{
|
|
166
|
+
package: string;
|
|
167
|
+
name: string;
|
|
168
|
+
}>): {
|
|
154
169
|
problem: string;
|
|
155
170
|
command: string;
|
|
156
171
|
fix: string;
|
|
@@ -476,18 +476,27 @@ export const ICON_USE_ORDER_COMMAND =
|
|
|
476
476
|
/**
|
|
477
477
|
* Installed sets the project's list leaves out: the problem, and the fix that
|
|
478
478
|
* adds them as backups after the list's own. Doctor and `experimental icon
|
|
479
|
-
* use` print the same words.
|
|
480
|
-
*
|
|
481
|
-
* @param {string}
|
|
482
|
-
* @param {string
|
|
483
|
-
* @param {string
|
|
479
|
+
* use` print the same words. Every set is named the same way: by its name
|
|
480
|
+
* when no other installed set has that name, else as `<package>/<set>`.
|
|
481
|
+
* @param {Array<{package: string, name: string}>} installed every installed set
|
|
482
|
+
* @param {{package: string, name: string}} main the list's main set
|
|
483
|
+
* @param {Array<{package: string, name: string}>} backups the list's
|
|
484
|
+
* backups, in order
|
|
485
|
+
* @param {Array<{package: string, name: string}>} unlisted the installed
|
|
486
|
+
* sets the list leaves out
|
|
484
487
|
* @returns {{problem: string, command: string, fix: string}}
|
|
485
488
|
*/
|
|
486
489
|
export function unlistedIconSets(installed, main, backups, unlisted) {
|
|
487
|
-
|
|
488
|
-
const
|
|
490
|
+
/** @param {{package: string, name: string}} set */
|
|
491
|
+
const named = set =>
|
|
492
|
+
installed.filter(each => each.name === set.name).length > 1
|
|
493
|
+
? iconSetKey(set)
|
|
494
|
+
: set.name;
|
|
495
|
+
const left = unlisted.map(named);
|
|
496
|
+
const them = left.length === 1 ? 'it' : 'them';
|
|
497
|
+
const command = `astryx experimental icon use ${named(main)}${[...backups.map(named), ...left].map(each => ` --backup ${each}`).join('')}`;
|
|
489
498
|
return {
|
|
490
|
-
problem: `${installed} icon sets are installed and ${
|
|
499
|
+
problem: `${installed.length} icon sets are installed and ${left.join(', ')} ${left.length === 1 ? 'is' : 'are'} not in your list`,
|
|
491
500
|
command,
|
|
492
501
|
fix: `Add ${them} as backup with \`${command}\`, or uninstall ${them}.`,
|
|
493
502
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Count the definitions some templates declare in `icons`, most used first,
|
|
6
|
+
* then by name.
|
|
7
|
+
* @param {Array<{icons?: Record<string, unknown>}>} templates
|
|
8
|
+
* @param {Set<string> | Map<string, unknown>} known the definitions that count
|
|
9
|
+
* @returns {TemplateMeaning[]}
|
|
10
|
+
*/
|
|
11
|
+
export function countTemplateMeanings(templates: Array<{
|
|
12
|
+
icons?: Record<string, unknown>;
|
|
13
|
+
}>, known: Set<string> | Map<string, unknown>): TemplateMeaning[];
|
|
14
|
+
/**
|
|
15
|
+
* Every Astryx icon definition the bundled templates use, with how many
|
|
16
|
+
* templates use it, most used first. Read once per process.
|
|
17
|
+
* @returns {Promise<TemplateMeaning[]>}
|
|
18
|
+
*/
|
|
19
|
+
export function templateIconMeanings(): Promise<TemplateMeaning[]>;
|
|
20
|
+
/**
|
|
21
|
+
* The template meanings a set's `map` does not name, most used first.
|
|
22
|
+
* @param {TemplateMeaning[]} meanings
|
|
23
|
+
* @param {Record<string, string> | undefined} map
|
|
24
|
+
* @returns {TemplateMeaning[]}
|
|
25
|
+
*/
|
|
26
|
+
export function unmappedTemplateMeanings(meanings: TemplateMeaning[], map: Record<string, string> | undefined): TemplateMeaning[];
|
|
27
|
+
/**
|
|
28
|
+
* One icon definition templates use.
|
|
29
|
+
*/
|
|
30
|
+
export type TemplateMeaning = {
|
|
31
|
+
/**
|
|
32
|
+
* the definition's name
|
|
33
|
+
*/
|
|
34
|
+
definition: string;
|
|
35
|
+
/**
|
|
36
|
+
* how many bundled templates use it
|
|
37
|
+
*/
|
|
38
|
+
templates: number;
|
|
39
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The icon definitions the bundled templates use (AST-084 FR15), and
|
|
5
|
+
* the ones an icon set leaves unmapped.
|
|
6
|
+
*
|
|
7
|
+
* A bundled page or block template names, in its descriptor's `icons`, the
|
|
8
|
+
* icon definition each icon it imports draws. A copied template renders a
|
|
9
|
+
* placeholder for a definition the project's sets do not map, so an icon-set
|
|
10
|
+
* author needs to know which definitions templates use beyond the built-in
|
|
11
|
+
* ones. Each definition counts the templates that use it, once per template.
|
|
12
|
+
* Only Astryx's own definitions count: a name that is not one is a template
|
|
13
|
+
* error, which other checks report.
|
|
14
|
+
*
|
|
15
|
+
* @input The bundled templates, through template discovery
|
|
16
|
+
* @output Each definition templates use, with its template count, most used
|
|
17
|
+
* first; and the ones a set's `map` leaves out. The one-line summary is in
|
|
18
|
+
* foundation/text/template-meanings-line.mjs
|
|
19
|
+
* @position packages/cli/foundation/discovery — read by the icon authoring
|
|
20
|
+
* receipts, `experimental icon --definitions`, and `integration check`
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import {discoverCoreTemplates} from './template-adapter.mjs';
|
|
24
|
+
import {astryxDefinitionsByName} from './icon-definition-discovery.mjs';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One icon definition templates use.
|
|
28
|
+
* @typedef {object} TemplateMeaning
|
|
29
|
+
* @property {string} definition the definition's name
|
|
30
|
+
* @property {number} templates how many bundled templates use it
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** @type {Promise<TemplateMeaning[]> | null} */
|
|
34
|
+
let cached = null;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Count the definitions some templates declare in `icons`, most used first,
|
|
38
|
+
* then by name.
|
|
39
|
+
* @param {Array<{icons?: Record<string, unknown>}>} templates
|
|
40
|
+
* @param {Set<string> | Map<string, unknown>} known the definitions that count
|
|
41
|
+
* @returns {TemplateMeaning[]}
|
|
42
|
+
*/
|
|
43
|
+
export function countTemplateMeanings(templates, known) {
|
|
44
|
+
/** @type {Map<string, number>} */
|
|
45
|
+
const counts = new Map();
|
|
46
|
+
for (const template of templates) {
|
|
47
|
+
const icons = template.icons;
|
|
48
|
+
if (icons == null || typeof icons !== 'object') continue;
|
|
49
|
+
const used = new Set(
|
|
50
|
+
Object.values(icons).filter(
|
|
51
|
+
/** @returns {value is string} */
|
|
52
|
+
value => typeof value === 'string' && known.has(value),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
for (const definition of used) {
|
|
56
|
+
counts.set(definition, (counts.get(definition) ?? 0) + 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return [...counts]
|
|
60
|
+
.map(([definition, templates]) => ({definition, templates}))
|
|
61
|
+
.sort(
|
|
62
|
+
(a, b) =>
|
|
63
|
+
b.templates - a.templates ||
|
|
64
|
+
(a.definition < b.definition
|
|
65
|
+
? -1
|
|
66
|
+
: a.definition > b.definition
|
|
67
|
+
? 1
|
|
68
|
+
: 0),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Every Astryx icon definition the bundled templates use, with how many
|
|
74
|
+
* templates use it, most used first. Read once per process.
|
|
75
|
+
* @returns {Promise<TemplateMeaning[]>}
|
|
76
|
+
*/
|
|
77
|
+
export function templateIconMeanings() {
|
|
78
|
+
cached ??= discoverCoreTemplates().then(templates =>
|
|
79
|
+
countTemplateMeanings(templates, astryxDefinitionsByName()),
|
|
80
|
+
);
|
|
81
|
+
return cached;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The template meanings a set's `map` does not name, most used first.
|
|
86
|
+
* @param {TemplateMeaning[]} meanings
|
|
87
|
+
* @param {Record<string, string> | undefined} map
|
|
88
|
+
* @returns {TemplateMeaning[]}
|
|
89
|
+
*/
|
|
90
|
+
export function unmappedTemplateMeanings(meanings, map) {
|
|
91
|
+
const mapped = map ?? {};
|
|
92
|
+
return meanings.filter(
|
|
93
|
+
each => !Object.prototype.hasOwnProperty.call(mapped, each.definition),
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* Unreadable docs are skipped rather than fatal — a single malformed doc must
|
|
12
12
|
* not take out theme validation or the listing.
|
|
13
13
|
*
|
|
14
|
+
* The scan walks every folder under `src` and reads every component doc. A
|
|
15
|
+
* process scans each Core once. It reuses that scan while every folder and
|
|
16
|
+
* doc it read is unchanged, as the docs and search catalogs do. A `src`
|
|
17
|
+
* reached through a symlink, as a project's node_modules reaches Core, shares
|
|
18
|
+
* the scan of its real path. Each call gets its own copy of the rows.
|
|
19
|
+
*
|
|
14
20
|
* @param {string} coreSrc - absolute path to `<core>/src`
|
|
15
21
|
* @returns {Promise<ThemingTarget[]>}
|
|
16
22
|
*/
|
|
@@ -12,10 +12,13 @@
|
|
|
12
12
|
* <Name>` prints; nothing here is a second registry, so the list a
|
|
13
13
|
* theme author can enumerate and the set the compiler accepts cannot
|
|
14
14
|
* drift from the components or from each other.
|
|
15
|
+
* A process reuses its target scan of a Core while the folders and
|
|
16
|
+
* docs it read are unchanged.
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
import * as fs from 'node:fs';
|
|
18
20
|
import * as path from 'node:path';
|
|
21
|
+
import {reusedWhileUnchanged} from '../fs/read-record.mjs';
|
|
19
22
|
import {loadComponentDoc} from './component-loader.mjs';
|
|
20
23
|
|
|
21
24
|
const SKIP_DIRS = new Set(['node_modules', '__tests__']);
|
|
@@ -53,12 +56,42 @@ function targetKey(className) {
|
|
|
53
56
|
* Unreadable docs are skipped rather than fatal — a single malformed doc must
|
|
54
57
|
* not take out theme validation or the listing.
|
|
55
58
|
*
|
|
59
|
+
* The scan walks every folder under `src` and reads every component doc. A
|
|
60
|
+
* process scans each Core once. It reuses that scan while every folder and
|
|
61
|
+
* doc it read is unchanged, as the docs and search catalogs do. A `src`
|
|
62
|
+
* reached through a symlink, as a project's node_modules reaches Core, shares
|
|
63
|
+
* the scan of its real path. Each call gets its own copy of the rows.
|
|
64
|
+
*
|
|
56
65
|
* @param {string} coreSrc - absolute path to `<core>/src`
|
|
57
66
|
* @returns {Promise<ThemingTarget[]>}
|
|
58
67
|
*/
|
|
59
68
|
export async function collectThemingTargets(coreSrc) {
|
|
60
69
|
if (!coreSrc || !fs.existsSync(coreSrc)) return [];
|
|
70
|
+
const real = fs.realpathSync(coreSrc);
|
|
71
|
+
let scan = targetScans.get(real);
|
|
72
|
+
if (scan == null) {
|
|
73
|
+
scan = reusedWhileUnchanged(() => scanThemingTargets(real));
|
|
74
|
+
targetScans.set(real, scan);
|
|
75
|
+
}
|
|
76
|
+
return (await scan()).map(target => ({
|
|
77
|
+
...target,
|
|
78
|
+
props: [...target.props],
|
|
79
|
+
states: [...target.states],
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
61
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The target scan of each Core `src`, by its real path.
|
|
85
|
+
* @type {Map<string, () => Promise<ThemingTarget[]>>}
|
|
86
|
+
*/
|
|
87
|
+
const targetScans = new Map();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Every theming target under `coreSrc`, read from its component docs.
|
|
91
|
+
* @param {string} coreSrc - real path to `<core>/src`
|
|
92
|
+
* @returns {Promise<ThemingTarget[]>}
|
|
93
|
+
*/
|
|
94
|
+
async function scanThemingTargets(coreSrc) {
|
|
62
95
|
/** @type {Array<ThemingTarget & {parent: string|null}>} */
|
|
63
96
|
const targets = [];
|
|
64
97
|
|
|
@@ -110,6 +110,17 @@ export function allErrorCodes(): string[];
|
|
|
110
110
|
* | 'ERR_RENDER_FAILED'
|
|
111
111
|
* | 'ERR_RENDER_NOT_ASTRYX'
|
|
112
112
|
* | 'ERR_RENDER_SOURCE_DAMAGED'
|
|
113
|
+
* | 'ERR_THEME_BAD_VALUE'
|
|
114
|
+
* | 'ERR_THEME_NO_MODE'
|
|
115
|
+
* | 'ERR_THEME_UNKNOWN_PART'
|
|
116
|
+
* | 'ERR_THEME_UNKNOWN_VARIANT'
|
|
117
|
+
* | 'ERR_THEME_UNKNOWN_STATE'
|
|
118
|
+
* | 'ERR_THEME_PRIVATE_TOKEN'
|
|
119
|
+
* | 'ERR_THEME_UNKNOWN_TOKEN'
|
|
120
|
+
* | 'ERR_THEME_NO_EFFECT'
|
|
121
|
+
* | 'ERR_THEME_UNKNOWN_THING'
|
|
122
|
+
* | 'ERR_THEME_NOT_SET'
|
|
123
|
+
* | 'ERR_THEME_NOTHING_TO_UNDO'
|
|
113
124
|
* )} ErrorCode
|
|
114
125
|
*/
|
|
115
126
|
/**
|
|
@@ -120,4 +131,4 @@ export const ERROR_CODES: Readonly<Record<ErrorCode, ErrorCode>>;
|
|
|
120
131
|
/**
|
|
121
132
|
* Stable error-code string union. Append-only.
|
|
122
133
|
*/
|
|
123
|
-
export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED" | "ERR_VERSIONS_UNAVAILABLE" | "ERR_PROJECT_REQUIRED" | "ERR_RENDER_COMPILE" | "ERR_RENDER_NO_DEFAULT_EXPORT" | "ERR_RENDER_MISSING_DEPENDENCY" | "ERR_RENDER_BROWSER_API" | "ERR_RENDER_ASSET_TOO_LARGE" | "ERR_RENDER_TIMEOUT" | "ERR_RENDER_FAILED" | "ERR_RENDER_NOT_ASTRYX" | "ERR_RENDER_SOURCE_DAMAGED");
|
|
134
|
+
export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED" | "ERR_VERSIONS_UNAVAILABLE" | "ERR_PROJECT_REQUIRED" | "ERR_RENDER_COMPILE" | "ERR_RENDER_NO_DEFAULT_EXPORT" | "ERR_RENDER_MISSING_DEPENDENCY" | "ERR_RENDER_BROWSER_API" | "ERR_RENDER_ASSET_TOO_LARGE" | "ERR_RENDER_TIMEOUT" | "ERR_RENDER_FAILED" | "ERR_RENDER_NOT_ASTRYX" | "ERR_RENDER_SOURCE_DAMAGED" | "ERR_THEME_BAD_VALUE" | "ERR_THEME_NO_MODE" | "ERR_THEME_UNKNOWN_PART" | "ERR_THEME_UNKNOWN_VARIANT" | "ERR_THEME_UNKNOWN_STATE" | "ERR_THEME_PRIVATE_TOKEN" | "ERR_THEME_UNKNOWN_TOKEN" | "ERR_THEME_NO_EFFECT" | "ERR_THEME_UNKNOWN_THING" | "ERR_THEME_NOT_SET" | "ERR_THEME_NOTHING_TO_UNDO");
|
|
@@ -346,5 +346,71 @@ export const doc = {
|
|
|
346
346
|
description:
|
|
347
347
|
'`render --reverse` refused the received file, and nothing was written: its embedded source was removed (a file a render wrote, with no Astryx components left to rebuild from) or is damaged (not valid, or a file does not match its checksum), lists a path twice, carries a module, stylesheet or JSON file the page does not reach through its own imports, or an image, font or media file whose bytes are not one, or carries a file a render never embeds: a dotfile or dot-folder, anything under node_modules, a package manifest, lockfile or tool configuration, a file a test, story or benchmark runner would run, or any kind but a page module, stylesheet, JSON file or image. Raised only by the experimental render command.',
|
|
348
348
|
},
|
|
349
|
+
{
|
|
350
|
+
value: 'ERR_THEME_BAD_VALUE',
|
|
351
|
+
stability: 'experimental',
|
|
352
|
+
description:
|
|
353
|
+
'A value does not fit what it sets: not a color for a color token, not a size for a size, a step (`more`/`less`) on something that is not a dial, or a word a dial does not take. Nothing was changed. Raised only by the experimental theme command.',
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
value: 'ERR_THEME_NO_MODE',
|
|
357
|
+
stability: 'experimental',
|
|
358
|
+
description:
|
|
359
|
+
'`--mode light|dark` was given for something that cannot differ between light and dark: a size, a number, a font, or a property that is not a plain color, or a theme that has only one mode. Nothing was changed. Raised only by the experimental theme command.',
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
value: 'ERR_THEME_UNKNOWN_PART',
|
|
363
|
+
stability: 'experimental',
|
|
364
|
+
description:
|
|
365
|
+
'`--on` names something that is not a themeable part or a family. Nothing was changed. Raised only by the experimental theme command.',
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
value: 'ERR_THEME_UNKNOWN_VARIANT',
|
|
369
|
+
stability: 'experimental',
|
|
370
|
+
description:
|
|
371
|
+
'`--when` names a prop the part does not have, or a value that prop does not take. Nothing was changed. Raised only by the experimental theme command.',
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
value: 'ERR_THEME_UNKNOWN_STATE',
|
|
375
|
+
stability: 'experimental',
|
|
376
|
+
description:
|
|
377
|
+
'`--state` names a state the part does not have. Nothing was changed. Raised only by the experimental theme command.',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
value: 'ERR_THEME_PRIVATE_TOKEN',
|
|
381
|
+
stability: 'experimental',
|
|
382
|
+
description:
|
|
383
|
+
'The setting names a variable private to a component (`--_...`), which a theme cannot set. Nothing was changed. Raised only by the experimental theme command.',
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
value: 'ERR_THEME_UNKNOWN_TOKEN',
|
|
387
|
+
stability: 'experimental',
|
|
388
|
+
description:
|
|
389
|
+
'The setting names a design token that does not exist. Nothing was changed. Raised only by the experimental theme command.',
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
value: 'ERR_THEME_NO_EFFECT',
|
|
393
|
+
stability: 'experimental',
|
|
394
|
+
description:
|
|
395
|
+
'The change could not take effect: neither the part nor any part inside it reads the token (or, for the whole theme, no part reads it). The suggestions name the token the part really reads and the property that sets it directly. Nothing was changed. Raised only by the experimental theme command.',
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
value: 'ERR_THEME_UNKNOWN_THING',
|
|
399
|
+
stability: 'experimental',
|
|
400
|
+
description:
|
|
401
|
+
'The thing to change is not a dial, a design token, or a CSS property. Nothing was changed. Raised only by the experimental theme command.',
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
value: 'ERR_THEME_NOT_SET',
|
|
405
|
+
stability: 'experimental',
|
|
406
|
+
description:
|
|
407
|
+
'`reset` names a setting the theme does not have (with those `--on`, `--when`, `--state` and `--mode`). Nothing was changed. Raised only by the experimental theme command.',
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
value: 'ERR_THEME_NOTHING_TO_UNDO',
|
|
411
|
+
stability: 'experimental',
|
|
412
|
+
description:
|
|
413
|
+
'`undo` found no earlier change to step back to. Nothing was changed. Raised only by the experimental theme command.',
|
|
414
|
+
},
|
|
349
415
|
],
|
|
350
416
|
};
|
|
@@ -99,6 +99,17 @@
|
|
|
99
99
|
* | 'ERR_RENDER_FAILED'
|
|
100
100
|
* | 'ERR_RENDER_NOT_ASTRYX'
|
|
101
101
|
* | 'ERR_RENDER_SOURCE_DAMAGED'
|
|
102
|
+
* | 'ERR_THEME_BAD_VALUE'
|
|
103
|
+
* | 'ERR_THEME_NO_MODE'
|
|
104
|
+
* | 'ERR_THEME_UNKNOWN_PART'
|
|
105
|
+
* | 'ERR_THEME_UNKNOWN_VARIANT'
|
|
106
|
+
* | 'ERR_THEME_UNKNOWN_STATE'
|
|
107
|
+
* | 'ERR_THEME_PRIVATE_TOKEN'
|
|
108
|
+
* | 'ERR_THEME_UNKNOWN_TOKEN'
|
|
109
|
+
* | 'ERR_THEME_NO_EFFECT'
|
|
110
|
+
* | 'ERR_THEME_UNKNOWN_THING'
|
|
111
|
+
* | 'ERR_THEME_NOT_SET'
|
|
112
|
+
* | 'ERR_THEME_NOTHING_TO_UNDO'
|
|
102
113
|
* )} ErrorCode
|
|
103
114
|
*/
|
|
104
115
|
|
|
@@ -315,6 +326,50 @@ export const ERROR_CODES = Object.freeze({
|
|
|
315
326
|
* was written.
|
|
316
327
|
*/
|
|
317
328
|
ERR_RENDER_SOURCE_DAMAGED: 'ERR_RENDER_SOURCE_DAMAGED',
|
|
329
|
+
/**
|
|
330
|
+
* A value does not fit what it sets: not a color for a color token, not a size for a size, a step (`more`/`less`) on something that is not a dial, or a word a dial does not take. Nothing was changed. Raised only by `experimental theme`.
|
|
331
|
+
*/
|
|
332
|
+
ERR_THEME_BAD_VALUE: 'ERR_THEME_BAD_VALUE',
|
|
333
|
+
/**
|
|
334
|
+
* `--mode light|dark` was given for something that cannot differ between light and dark: a size, a number, a font, or a property that is not a plain color, or a theme that has only one mode. Nothing was changed. Raised only by `experimental theme`.
|
|
335
|
+
*/
|
|
336
|
+
ERR_THEME_NO_MODE: 'ERR_THEME_NO_MODE',
|
|
337
|
+
/**
|
|
338
|
+
* `--on` names something that is not a themeable part or a family. Nothing was changed. Raised only by `experimental theme`.
|
|
339
|
+
*/
|
|
340
|
+
ERR_THEME_UNKNOWN_PART: 'ERR_THEME_UNKNOWN_PART',
|
|
341
|
+
/**
|
|
342
|
+
* `--when` names a prop the part does not have, or a value that prop does not take. Nothing was changed. Raised only by `experimental theme`.
|
|
343
|
+
*/
|
|
344
|
+
ERR_THEME_UNKNOWN_VARIANT: 'ERR_THEME_UNKNOWN_VARIANT',
|
|
345
|
+
/**
|
|
346
|
+
* `--state` names a state the part does not have. Nothing was changed. Raised only by `experimental theme`.
|
|
347
|
+
*/
|
|
348
|
+
ERR_THEME_UNKNOWN_STATE: 'ERR_THEME_UNKNOWN_STATE',
|
|
349
|
+
/**
|
|
350
|
+
* The setting names a variable private to a component (`--_...`), which a theme cannot set. Nothing was changed. Raised only by `experimental theme`.
|
|
351
|
+
*/
|
|
352
|
+
ERR_THEME_PRIVATE_TOKEN: 'ERR_THEME_PRIVATE_TOKEN',
|
|
353
|
+
/**
|
|
354
|
+
* The setting names a design token that does not exist. Nothing was changed. Raised only by `experimental theme`.
|
|
355
|
+
*/
|
|
356
|
+
ERR_THEME_UNKNOWN_TOKEN: 'ERR_THEME_UNKNOWN_TOKEN',
|
|
357
|
+
/**
|
|
358
|
+
* The change could not take effect: neither the part nor any part inside it reads the token (or, for the whole theme, no part reads it). The suggestions name the token the part really reads and the property that sets it directly. Nothing was changed. Raised only by `experimental theme`.
|
|
359
|
+
*/
|
|
360
|
+
ERR_THEME_NO_EFFECT: 'ERR_THEME_NO_EFFECT',
|
|
361
|
+
/**
|
|
362
|
+
* The thing to change is not a dial, a design token, or a CSS property. Nothing was changed. Raised only by `experimental theme`.
|
|
363
|
+
*/
|
|
364
|
+
ERR_THEME_UNKNOWN_THING: 'ERR_THEME_UNKNOWN_THING',
|
|
365
|
+
/**
|
|
366
|
+
* `reset` names a setting the theme does not have (with those `--on`, `--when`, `--state` and `--mode`). Nothing was changed. Raised only by `experimental theme`.
|
|
367
|
+
*/
|
|
368
|
+
ERR_THEME_NOT_SET: 'ERR_THEME_NOT_SET',
|
|
369
|
+
/**
|
|
370
|
+
* `undo` found no earlier change to step back to. Nothing was changed. Raised only by `experimental theme`.
|
|
371
|
+
*/
|
|
372
|
+
ERR_THEME_NOTHING_TO_UNDO: 'ERR_THEME_NOTHING_TO_UNDO',
|
|
318
373
|
});
|
|
319
374
|
|
|
320
375
|
/**
|
|
@@ -112,6 +112,61 @@ export const doc = {
|
|
|
112
112
|
description:
|
|
113
113
|
"One post's metadata plus the feed URL and the post's full plaintext body.",
|
|
114
114
|
},
|
|
115
|
+
// experimental theme editor and preview (experimental: may change or be removed in a patch release)
|
|
116
|
+
{
|
|
117
|
+
value: 'themeEdit.new',
|
|
118
|
+
stability: 'experimental',
|
|
119
|
+
description:
|
|
120
|
+
'A theme made by `experimental theme editor new`: `theme`, `like` (the built-in theme it builds on, or null), the `files` written (settings, source, css, module), contrast `problems`, the `preview` page, and any `pictures` (with `pictureProblem` when none could be taken). Experimental: may change or be removed in a patch release.',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: 'themeEdit.set',
|
|
124
|
+
stability: 'experimental',
|
|
125
|
+
description:
|
|
126
|
+
'One checked change written: the `setting`, the one it `replaced`, `was` (for base and mode), the `parts` and `family` it styles, resolved `changedTokens`, part styles written (`styled`), part settings a dial `kept`, newly `lifted` variant keys, `notes`, contrast `problems`, build `warnings`, the `preview` page and any `pictures`. Experimental: may change or be removed in a patch release.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: 'themeEdit.show',
|
|
130
|
+
stability: 'experimental',
|
|
131
|
+
description:
|
|
132
|
+
'Every `settings` entry with the `parts` it styles, key `resolved` token values per mode, contrast `problems`, font `notes`, the `preview` and `sheet` pages, the `sheetComponents` count, template pages `skipped`, and any `pictures`. Experimental: may change or be removed in a patch release.',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: 'themeEdit.undo',
|
|
136
|
+
stability: 'experimental',
|
|
137
|
+
description:
|
|
138
|
+
"An undo. One step back (`action` `step`): what was `undone`, the `settings` count now, the `stepsLeft`, the `preview` page and any `pictures`. One setting removed (`action` `undo`): the same fields as `themeEdit.set`, with `setting` naming the one removed, which is back to the base theme's value. Experimental: may change or be removed in a patch release.",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
value: 'themeEdit.previewAdd',
|
|
142
|
+
stability: 'experimental',
|
|
143
|
+
description:
|
|
144
|
+
"Pages added to the theme preview in the app: the route `folder`, the `theme` the pages wear (null for the app's own), the pages `added` and every page (`pages`), the template pages `skipped` because the app lacks packages they import (each with its `missingPackages` and `installCommand`), the `files` the preview wrote, `notes`, and how to `open` it. Experimental: may change or be removed in a patch release.",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
value: 'themeEdit.previewApp',
|
|
148
|
+
stability: 'experimental',
|
|
149
|
+
description:
|
|
150
|
+
'A new starter app with the theme preview inside: the app `folder`, the `theme` copied into it that the pages wear (null for its own neutral theme), the preview `pages`, the `files` written, `notes`, and how to `open` it (install, run, then the page). Experimental: may change or be removed in a patch release.',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
value: 'themeEdit.previewList',
|
|
154
|
+
stability: 'experimental',
|
|
155
|
+
description:
|
|
156
|
+
'The pages of the theme preview: the route `folder` (null with no preview), the `theme`, and the `pages` (`id`, `label`). Experimental: may change or be removed in a patch release.',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: 'themeEdit.previewRemove',
|
|
160
|
+
stability: 'experimental',
|
|
161
|
+
description:
|
|
162
|
+
'A page or the whole theme preview removed: the route `folder`, the files `removed`, and the `pages` left (empty when the whole preview went). Experimental: may change or be removed in a patch release.',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
value: 'themeEdit.how',
|
|
166
|
+
stability: 'experimental',
|
|
167
|
+
description:
|
|
168
|
+
'A how answer; `kind` says which: `part`, `family`, `setting`, `aspect`, `question` (answers with commands), `picture` (main colors or the color at points) or `list` (the items). Experimental: may change or be removed in a patch release.',
|
|
169
|
+
},
|
|
115
170
|
// render (experimental: may change or be removed in a patch release)
|
|
116
171
|
{
|
|
117
172
|
value: 'render.page',
|