@astryxdesign/cli 0.7.12-canary.670aada → 0.7.12-canary.6c5c460
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/component/__fixtures__/resolutions/modules.txt +3 -3
- package/api/icon/_authoring.mjs +8 -1
- package/api/icon/add/add.mjs +45 -5
- package/api/icon/icon.type.d.mts +24 -0
- package/api/icon/icon.type.mjs +6 -0
- package/api/icon/iconAdd.doc.mjs +1 -1
- package/api/icon/map/map.mjs +11 -4
- package/api/integration/add-helpers.d.mts +5 -1
- package/api/integration/add-helpers.mjs +1 -1
- package/api/render/render.doc.mjs +1 -1
- package/api/render/render.type.d.mts +1 -1
- package/api/render/render.type.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/assets/discover/official-packages.json +16 -0
- package/assets/docs/styling-overview.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +4 -4
- package/assets/docs/tree/render-pages.doc.mjs +1 -1
- package/assets/docs/tree/tailwind.doc.mjs +41 -1
- package/assets/docs/tree/type-scale.doc.mjs +19 -2
- package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.tsx +56 -0
- package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.doc.mjs +2 -2
- package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +66 -10
- package/assets/templates/blocks/components/Link/useLinkifyHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Link/useLinkifyHookUsage.tsx +39 -0
- package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.tsx +83 -0
- package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +35 -0
- package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
- package/assets/templates/pages/table-filter/page.tsx +15 -23
- package/assets/templates/pages/table-inbox/page.tsx +3 -6
- package/assets/templates/themes/butter/butterTheme.ts +1 -1
- package/assets/templates/themes/gothic/gothicTheme.ts +16 -0
- package/assets/templates/themes/neutral/neutralTheme.ts +6 -0
- package/clients/cli/commands/experimental/icon.mjs +25 -4
- package/clients/cli/commands/experimental-render.doc.mjs +1 -1
- package/clients/cli/lib/resolve-theme.mjs +16 -7
- package/foundation/discovery/hook-discovery.mjs +31 -8
- package/foundation/discovery/icon-set-writer.d.mts +21 -5
- package/foundation/discovery/icon-set-writer.mjs +114 -13
- package/foundation/doc-compiler/import.d.mts +5 -1
- package/foundation/doc-compiler/import.mjs +40 -6
- package/foundation/fs/import-url.d.mts +20 -0
- package/foundation/fs/import-url.mjs +22 -0
- package/foundation/fs/module-loader.d.mts +24 -3
- package/foundation/fs/module-loader.mjs +69 -47
- package/foundation/render/page-host.d.mts +4 -0
- package/foundation/render/page-host.mjs +45 -0
- package/foundation/render/page-worker.mjs +11 -5
- package/foundation/render/render-page.d.mts +11 -6
- package/foundation/render/render-page.mjs +138 -44
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/text/levenshtein.d.mts +6 -1
- package/foundation/text/levenshtein.mjs +25 -9
- package/foundation/text/suggest-order.d.mts +8 -1
- package/foundation/text/suggest-order.mjs +72 -6
- package/package.json +6 -6
|
@@ -271,7 +271,7 @@ useIsomorphicLayoutEffect useIsomorphicLayoutEffect hooks/useAnimatedLayout.doc.
|
|
|
271
271
|
useLayerDismissal useLayerDismissal Layer/Layer.doc.mjs Layer/useLayerDismissal.ts
|
|
272
272
|
useLightbox useLightbox Lightbox/useLightbox.doc.mjs Lightbox/useLightbox.tsx
|
|
273
273
|
useLinkComponent useLinkComponent Link/useLinkComponent.doc.mjs Link/useLinkComponent.ts
|
|
274
|
-
useLinkify useLinkify Link/
|
|
274
|
+
useLinkify useLinkify Link/useLinkify.doc.mjs Link/useLinkify.tsx
|
|
275
275
|
useListFormatter useListFormatter i18n/InternationalizationProvider.doc.mjs i18n/useListFormatter.ts
|
|
276
276
|
useMenuDrillIn useMenuDrillIn DropdownMenu/DropdownMenu.doc.mjs DropdownMenu/useMenuDrillIn.tsx
|
|
277
277
|
useMenuHover useMenuHover hooks/useAnimatedLayout.doc.mjs hooks/useMenuHover.ts
|
|
@@ -282,7 +282,7 @@ useOverlay useOverlay Overlay/useOverlay.doc.mjs Overlay/useOverlay.tsx
|
|
|
282
282
|
useOwnScrollGesture useOwnScrollGesture DateInput/DateInput.doc.mjs DateInput/useOwnScrollGesture.ts
|
|
283
283
|
usePager usePager hooks/useAnimatedLayout.doc.mjs hooks/usePager.ts
|
|
284
284
|
usePointerDragScroll usePointerDragScroll DateInput/DateInput.doc.mjs DateInput/usePointerDragScroll.ts
|
|
285
|
-
usePowerSearchConfig usePowerSearchConfig PowerSearch/
|
|
285
|
+
usePowerSearchConfig usePowerSearchConfig PowerSearch/usePowerSearchConfig.doc.mjs PowerSearch/usePowerSearchConfig.ts
|
|
286
286
|
usePowerSearchSource usePowerSearchSource PowerSearch/PowerSearch.doc.mjs PowerSearch/usePowerSearchSource.ts
|
|
287
287
|
useRenamedProp useRenamedProp hooks/useAnimatedLayout.doc.mjs hooks/useRenamedProp.ts
|
|
288
288
|
useResolvedRequired useResolvedRequired hooks/useAnimatedLayout.doc.mjs hooks/useResolvedRequired.ts
|
|
@@ -298,7 +298,7 @@ useSpeechRecognition useSpeechRecognition Chat/Chat.doc.mjs Chat/useSpeechRecogn
|
|
|
298
298
|
useSwipeAction useSwipeAction Item/Item.doc.mjs Item/useSwipeAction.ts
|
|
299
299
|
useSwitchTouch useSwitchTouch Switch/Switch.doc.mjs Switch/useSwitchTouch.ts
|
|
300
300
|
useTableCellStyles useTableCellStyles Table/Table.doc.mjs Table/useTableCellStyles.ts
|
|
301
|
-
useTableColumnSettingsState useTableColumnSettingsState Table/
|
|
301
|
+
useTableColumnSettingsState useTableColumnSettingsState Table/plugins/columnSettings/useTableColumnSettingsState.doc.mjs Table/plugins/columnSettings/useTableColumnSettingsState.tsx
|
|
302
302
|
useTableSortableState useTableSortableState Table/plugins/sortable/useTableSortableState.doc.mjs Table/plugins/sortable/useTableSortableState.tsx
|
|
303
303
|
useToastGesture useToastGesture Toast/Toast.doc.mjs Toast/useToastGesture.ts
|
|
304
304
|
useTouchTrigger useTouchTrigger Layer/Layer.doc.mjs Layer/useTouchTrigger.ts
|
package/api/icon/_authoring.mjs
CHANGED
|
@@ -691,6 +691,7 @@ async function redeclareIconSet(
|
|
|
691
691
|
);
|
|
692
692
|
result.data.icons = set.data.icons.length;
|
|
693
693
|
result.data.updated = true;
|
|
694
|
+
if (where.moduleUpdate) result.data.moduleUpdate = where.moduleUpdate;
|
|
694
695
|
// A look the icons' own library draws comes from that library, so its
|
|
695
696
|
// command runs as printed; any other look comes from a module the
|
|
696
697
|
// author names.
|
|
@@ -1388,6 +1389,7 @@ async function refreshIconSet(
|
|
|
1388
1389
|
);
|
|
1389
1390
|
result.data.icons = icons.length;
|
|
1390
1391
|
result.data.refreshed = true;
|
|
1392
|
+
if (where.moduleUpdate) result.data.moduleUpdate = where.moduleUpdate;
|
|
1391
1393
|
// Every entry an exact name gives, kept or new, so a refresh lists
|
|
1392
1394
|
// them for review again.
|
|
1393
1395
|
const byName = Object.fromEntries(
|
|
@@ -1542,7 +1544,7 @@ export async function addIconDefinition(name, options) {
|
|
|
1542
1544
|
throw error;
|
|
1543
1545
|
}
|
|
1544
1546
|
}
|
|
1545
|
-
|
|
1547
|
+
const result = receipt(
|
|
1546
1548
|
'icon-definition',
|
|
1547
1549
|
doc.name,
|
|
1548
1550
|
{
|
|
@@ -1559,5 +1561,10 @@ export async function addIconDefinition(name, options) {
|
|
|
1559
1561
|
files,
|
|
1560
1562
|
dryRun,
|
|
1561
1563
|
);
|
|
1564
|
+
// Only a new definition with an icon writes the data file.
|
|
1565
|
+
if (icon != null && where.moduleUpdate) {
|
|
1566
|
+
result.data.moduleUpdate = where.moduleUpdate;
|
|
1567
|
+
}
|
|
1568
|
+
return result;
|
|
1562
1569
|
});
|
|
1563
1570
|
}
|
package/api/icon/add/add.mjs
CHANGED
|
@@ -147,6 +147,15 @@ export async function iconAdd(exportName, options) {
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
+
// An export name cannot start with a digit, and an id the author gives has
|
|
151
|
+
// no library prefix to keep.
|
|
152
|
+
if (givenId != null && /^[0-9]/u.test(givenId)) {
|
|
153
|
+
throw new AstryxError(
|
|
154
|
+
`The icon id "${givenId}" starts with a digit, and an export name cannot. Pass --id with an id that starts with a letter.`,
|
|
155
|
+
undefined,
|
|
156
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
150
159
|
if (all) {
|
|
151
160
|
return authoring(() => addVariantForAll({cwd, from, selector, variant}));
|
|
152
161
|
}
|
|
@@ -386,6 +395,8 @@ export async function iconAdd(exportName, options) {
|
|
|
386
395
|
map,
|
|
387
396
|
icons,
|
|
388
397
|
};
|
|
398
|
+
const dataChanged =
|
|
399
|
+
JSON.stringify(next) !== JSON.stringify(set.data) || where.moduleRenamed;
|
|
389
400
|
/** @type {string[]} */
|
|
390
401
|
const files = [];
|
|
391
402
|
// Every write happens inside this try, so any failure undoes the ones
|
|
@@ -413,7 +424,7 @@ export async function iconAdd(exportName, options) {
|
|
|
413
424
|
.join('/'),
|
|
414
425
|
);
|
|
415
426
|
}
|
|
416
|
-
if (
|
|
427
|
+
if (dataChanged) {
|
|
417
428
|
writeIconSetData(set, next, {
|
|
418
429
|
extraDefinitions: created ? [created.name] : [],
|
|
419
430
|
});
|
|
@@ -433,10 +444,12 @@ export async function iconAdd(exportName, options) {
|
|
|
433
444
|
}
|
|
434
445
|
throw error;
|
|
435
446
|
}
|
|
436
|
-
|
|
447
|
+
// A renamed package's new name alone is not an added icon.
|
|
448
|
+
const added =
|
|
437
449
|
JSON.stringify(next) !== JSON.stringify(set.data) ||
|
|
438
450
|
created != null ||
|
|
439
451
|
generatedChanged;
|
|
452
|
+
const changed = dataChanged || added;
|
|
440
453
|
// A ./ file publishes only when package.json `files` lists it; the
|
|
441
454
|
// author adds it (architecture:cli-surface INV16).
|
|
442
455
|
const note =
|
|
@@ -457,6 +470,8 @@ export async function iconAdd(exportName, options) {
|
|
|
457
470
|
...(created ? {newDefinition: created.name} : {}),
|
|
458
471
|
files,
|
|
459
472
|
changed,
|
|
473
|
+
added,
|
|
474
|
+
...(where.moduleUpdate ? {moduleUpdate: where.moduleUpdate} : {}),
|
|
460
475
|
...(note ? {note} : {}),
|
|
461
476
|
},
|
|
462
477
|
};
|
|
@@ -638,8 +653,27 @@ async function addVariantForAll({cwd, from, selector, variant}) {
|
|
|
638
653
|
);
|
|
639
654
|
// Only icons from the same package as the variant module can have a
|
|
640
655
|
// variant there: an icon from your own `./` file, or from another library,
|
|
641
|
-
// is left as it is and never listed as missing.
|
|
656
|
+
// is left as it is and never listed as missing. Some libraries ship each
|
|
657
|
+
// look as its own package (Font Awesome's solid and regular packages): an
|
|
658
|
+
// icon from another package meets its variant only under the same export
|
|
659
|
+
// name and of the same kind, a component or data for the adapter. Once
|
|
660
|
+
// one icon of a package meets its twin, that package is a look package of
|
|
661
|
+
// the variant module, so its other icons are listed as missing.
|
|
642
662
|
const variantPackage = iconModulePackage(source.module);
|
|
663
|
+
/** @param {{module: string, source: string, adapt: boolean}} origin */
|
|
664
|
+
const otherPackageTwin = origin => {
|
|
665
|
+
if (origin.module.startsWith('.')) return false;
|
|
666
|
+
const twin = byLibraryExport.get(origin.source);
|
|
667
|
+
return twin != null && twin.adapt === origin.adapt;
|
|
668
|
+
};
|
|
669
|
+
const lookPackages = new Set(
|
|
670
|
+
set.data.icons.flatMap(icon => {
|
|
671
|
+
const origin = origins.get(icon.export);
|
|
672
|
+
return origin && otherPackageTwin(origin)
|
|
673
|
+
? [iconModulePackage(origin.module)]
|
|
674
|
+
: [];
|
|
675
|
+
}),
|
|
676
|
+
);
|
|
643
677
|
const generated = generatedModulePath(set, packageDir);
|
|
644
678
|
/** @type {import('../../../foundation/discovery/icon-set-writer.mjs').GeneratedIcon[]} */
|
|
645
679
|
const toWrite = [];
|
|
@@ -653,7 +687,11 @@ async function addVariantForAll({cwd, from, selector, variant}) {
|
|
|
653
687
|
const own = [];
|
|
654
688
|
const icons = set.data.icons.map(icon => {
|
|
655
689
|
const origin = origins.get(icon.export);
|
|
656
|
-
if (
|
|
690
|
+
if (
|
|
691
|
+
origin &&
|
|
692
|
+
iconModulePackage(origin.module) !== variantPackage &&
|
|
693
|
+
!lookPackages.has(iconModulePackage(origin.module))
|
|
694
|
+
) {
|
|
657
695
|
return icon;
|
|
658
696
|
}
|
|
659
697
|
const librarySource =
|
|
@@ -742,7 +780,8 @@ async function addVariantForAll({cwd, from, selector, variant}) {
|
|
|
742
780
|
const files = [];
|
|
743
781
|
const written = writeGeneratedIcons(packageDir, generated, next, toWrite);
|
|
744
782
|
files.push(...written.files);
|
|
745
|
-
const dataChanged =
|
|
783
|
+
const dataChanged =
|
|
784
|
+
JSON.stringify(next) !== JSON.stringify(set.data) || where.moduleRenamed;
|
|
746
785
|
if (dataChanged) {
|
|
747
786
|
try {
|
|
748
787
|
writeIconSetData(set, next);
|
|
@@ -766,6 +805,7 @@ async function addVariantForAll({cwd, from, selector, variant}) {
|
|
|
766
805
|
missing,
|
|
767
806
|
files,
|
|
768
807
|
changed: dataChanged || written.changed,
|
|
808
|
+
...(where.moduleUpdate ? {moduleUpdate: where.moduleUpdate} : {}),
|
|
769
809
|
},
|
|
770
810
|
};
|
|
771
811
|
}
|
package/api/icon/icon.type.d.mts
CHANGED
|
@@ -223,6 +223,10 @@ export type IconMapManyResponse = {
|
|
|
223
223
|
changed: boolean;
|
|
224
224
|
}>;
|
|
225
225
|
changed: boolean;
|
|
226
|
+
moduleUpdate?: {
|
|
227
|
+
previous: string;
|
|
228
|
+
module: string;
|
|
229
|
+
} | undefined;
|
|
226
230
|
files?: string[] | undefined;
|
|
227
231
|
};
|
|
228
232
|
};
|
|
@@ -239,6 +243,10 @@ export type IconMapResponse = {
|
|
|
239
243
|
icon: string | null;
|
|
240
244
|
previous: string | null;
|
|
241
245
|
changed: boolean;
|
|
246
|
+
moduleUpdate?: {
|
|
247
|
+
previous: string;
|
|
248
|
+
module: string;
|
|
249
|
+
} | undefined;
|
|
242
250
|
files?: string[] | undefined;
|
|
243
251
|
};
|
|
244
252
|
};
|
|
@@ -303,6 +311,10 @@ export type IconAddVariantsResponse = {
|
|
|
303
311
|
missing: string[];
|
|
304
312
|
files: string[];
|
|
305
313
|
changed: boolean;
|
|
314
|
+
moduleUpdate?: {
|
|
315
|
+
previous: string;
|
|
316
|
+
module: string;
|
|
317
|
+
} | undefined;
|
|
306
318
|
};
|
|
307
319
|
};
|
|
308
320
|
/**
|
|
@@ -323,6 +335,11 @@ export type IconAddResponse = {
|
|
|
323
335
|
newDefinition?: string | undefined;
|
|
324
336
|
files: string[];
|
|
325
337
|
changed: boolean;
|
|
338
|
+
added: boolean;
|
|
339
|
+
moduleUpdate?: {
|
|
340
|
+
previous: string;
|
|
341
|
+
module: string;
|
|
342
|
+
} | undefined;
|
|
326
343
|
note?: string | undefined;
|
|
327
344
|
};
|
|
328
345
|
};
|
|
@@ -557,6 +574,13 @@ export type IconNewData = {
|
|
|
557
574
|
* - What the author does next, including each change the package needs that the CLI never makes itself (its entry, peers, scripts), as text to copy.
|
|
558
575
|
*/
|
|
559
576
|
notes?: string[] | undefined;
|
|
577
|
+
/**
|
|
578
|
+
* - On a refresh, an update, or a new definition with `icon`: the data file's `module` before and after this command, when the package was renamed and the command writes its new name.
|
|
579
|
+
*/
|
|
580
|
+
moduleUpdate?: {
|
|
581
|
+
previous: string;
|
|
582
|
+
module: string;
|
|
583
|
+
} | undefined;
|
|
560
584
|
};
|
|
561
585
|
/**
|
|
562
586
|
* `astryx --json experimental icon new-set <name>`.
|
package/api/icon/icon.type.mjs
CHANGED
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
* @property {string} data.file - The data file, relative to the package.
|
|
157
157
|
* @property {Array<{definition: string, icon: string, previous: string | null, changed: boolean}>} data.entries - Each pair, in order, and what it replaced.
|
|
158
158
|
* @property {boolean} data.changed - Whether the file was written.
|
|
159
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
159
160
|
* @property {string[]} [data.files] - The generated module and its types, when its theme map was rewritten.
|
|
160
161
|
*/
|
|
161
162
|
|
|
@@ -172,6 +173,7 @@
|
|
|
172
173
|
* @property {string | null} data.icon - The id of the icon now mapped (the icon may be named by any name `map` accepts); null after `remove`.
|
|
173
174
|
* @property {string | null} data.previous - The icon id it replaced.
|
|
174
175
|
* @property {boolean} data.changed - Whether the file was written.
|
|
176
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
175
177
|
* @property {string[]} [data.files] - The generated module and its types, when its theme map was rewritten.
|
|
176
178
|
*/
|
|
177
179
|
|
|
@@ -207,6 +209,7 @@
|
|
|
207
209
|
* @property {string[]} data.missing - Ids of icons `from` has no export for; they keep no such variant.
|
|
208
210
|
* @property {string[]} data.files - Files written, relative to the package.
|
|
209
211
|
* @property {boolean} data.changed
|
|
212
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
210
213
|
*/
|
|
211
214
|
|
|
212
215
|
/**
|
|
@@ -223,6 +226,8 @@
|
|
|
223
226
|
* @property {string} [data.newDefinition] - The set's own definition the command wrote.
|
|
224
227
|
* @property {string[]} data.files - Files written, relative to the package.
|
|
225
228
|
* @property {boolean} data.changed - Whether anything was written.
|
|
229
|
+
* @property {boolean} data.added - Whether the icon, its variant, its `map` entry, or a new definition was added. False when the set already had them, even when `changed` is true because the command wrote a renamed package's new name.
|
|
230
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
226
231
|
* @property {string} [data.note] - What the package still needs, as text to copy: the entry line that exports the icon from the set's module, and the package.json `files` that publishes a `./` source.
|
|
227
232
|
*/
|
|
228
233
|
|
|
@@ -332,6 +337,7 @@
|
|
|
332
337
|
* @property {Array<{definition: string, icon: string}>} [mapped] - With `from`: the `map` entries an icon with the definition's exact name gives (on a refresh, every such entry, kept or new); check each.
|
|
333
338
|
* @property {Array<{definition: string, icon: string, word: string}>} [suggestions] - With `from`: for each unmapped Astryx definition, up to three icons it might map to, best first: the definition's name in another spelling or as another name of an icon, ids that start with it, an id or another name that is one of its words, then two-word ids that are a one-word word sized, shaped, or numbered (`grid-2x2`); never a negated form, the opposite direction, or an icon already mapped. `word` is the name or word that matched. Never written.
|
|
334
339
|
* @property {string[]} [notes] - What the author does next, including each change the package needs that the CLI never makes itself (its entry, peers, scripts), as text to copy.
|
|
340
|
+
* @property {{previous: string, module: string}} [moduleUpdate] - On a refresh, an update, or a new definition with `icon`: the data file's `module` before and after this command, when the package was renamed and the command writes its new name.
|
|
335
341
|
*/
|
|
336
342
|
|
|
337
343
|
/**
|
package/api/icon/iconAdd.doc.mjs
CHANGED
|
@@ -119,7 +119,7 @@ export const doc = {
|
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
code: 'ERR_INVALID_ARGUMENT',
|
|
122
|
-
when: "the export is data rather than a component, a new definition is named like an Astryx one, or the variant is not one the set declares, is the look each icon's own export already draws, or is no look word of a library whose export names encode looks",
|
|
122
|
+
when: "the export is data rather than a component, a new definition is named like an Astryx one, or the variant is not one the set declares, is the look each icon's own export already draws, or is no look word of a library whose export names encode looks, or `id` starts with a digit",
|
|
123
123
|
},
|
|
124
124
|
{code: 'ERR_FILE_EXISTS', when: 'another icon already has the id'},
|
|
125
125
|
{
|
package/api/icon/map/map.mjs
CHANGED
|
@@ -77,7 +77,8 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
77
77
|
ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
-
const {packageDir, set} =
|
|
80
|
+
const {packageDir, set, moduleRenamed, moduleUpdate} =
|
|
81
|
+
await findLocalIconSet(cwd, selector);
|
|
81
82
|
// The docs' kebab id (`eye-slash`) names the same definition, and a
|
|
82
83
|
// library's other name for an icon (`trash-2`) names the same icon.
|
|
83
84
|
definition = definitionNameOf(definition, mappableDefinitions(set));
|
|
@@ -112,7 +113,8 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
112
113
|
}
|
|
113
114
|
map[definition] = /** @type {string} */ (icon);
|
|
114
115
|
}
|
|
115
|
-
const changed =
|
|
116
|
+
const changed =
|
|
117
|
+
(remove ? previous != null : previous !== icon) || moduleRenamed;
|
|
116
118
|
/** @type {string[]} */
|
|
117
119
|
const files = [];
|
|
118
120
|
if (changed) {
|
|
@@ -139,6 +141,7 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
139
141
|
icon: remove ? null : /** @type {string} */ (icon),
|
|
140
142
|
previous,
|
|
141
143
|
changed,
|
|
144
|
+
...(moduleUpdate ? {moduleUpdate} : {}),
|
|
142
145
|
...(files.length > 0 ? {files} : {}),
|
|
143
146
|
},
|
|
144
147
|
};
|
|
@@ -161,7 +164,10 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
161
164
|
ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
162
165
|
);
|
|
163
166
|
}
|
|
164
|
-
const {packageDir, set} = await findLocalIconSet(
|
|
167
|
+
const {packageDir, set, moduleRenamed, moduleUpdate} = await findLocalIconSet(
|
|
168
|
+
cwd,
|
|
169
|
+
selector,
|
|
170
|
+
);
|
|
165
171
|
const known = mappableDefinitions(set);
|
|
166
172
|
const ids = set.data.icons.map(each => each.id);
|
|
167
173
|
const map = {...(set.data.map ?? {})};
|
|
@@ -204,7 +210,7 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
204
210
|
changed: previous !== id,
|
|
205
211
|
});
|
|
206
212
|
}
|
|
207
|
-
const changed = entries.some(each => each.changed);
|
|
213
|
+
const changed = entries.some(each => each.changed) || moduleRenamed;
|
|
208
214
|
/** @type {string[]} */
|
|
209
215
|
const files = [];
|
|
210
216
|
if (changed) {
|
|
@@ -228,6 +234,7 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
228
234
|
file: path.relative(packageDir, set.dataPath).split(path.sep).join('/'),
|
|
229
235
|
entries,
|
|
230
236
|
changed,
|
|
237
|
+
...(moduleUpdate ? {moduleUpdate} : {}),
|
|
231
238
|
...(files.length > 0 ? {files} : {}),
|
|
232
239
|
},
|
|
233
240
|
};
|
|
@@ -92,7 +92,7 @@ export function loadCurrentManifest(manifestFile: string, manifestExists: boolea
|
|
|
92
92
|
* @param {string} manifestPath
|
|
93
93
|
* @param {string[]} files
|
|
94
94
|
* @param {boolean} dryRun
|
|
95
|
-
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[]}}}
|
|
95
|
+
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[], moduleUpdate?: {previous: string, module: string}}}}
|
|
96
96
|
*/
|
|
97
97
|
export function receipt<K extends import("./integration-authoring.type.mjs").IntegrationAddData["kind"] | import("../icon/icon.type.mjs").IconNewData["kind"]>(kind: K, name: string, root: {
|
|
98
98
|
path: string;
|
|
@@ -127,6 +127,10 @@ export function receipt<K extends import("./integration-authoring.type.mjs").Int
|
|
|
127
127
|
word: string;
|
|
128
128
|
}>;
|
|
129
129
|
notes?: string[];
|
|
130
|
+
moduleUpdate?: {
|
|
131
|
+
previous: string;
|
|
132
|
+
module: string;
|
|
133
|
+
};
|
|
130
134
|
};
|
|
131
135
|
};
|
|
132
136
|
/** @param {string} slug */
|
|
@@ -486,7 +486,7 @@ export async function loadCurrentManifest(manifestFile, manifestExists) {
|
|
|
486
486
|
* @param {string} manifestPath
|
|
487
487
|
* @param {string[]} files
|
|
488
488
|
* @param {boolean} dryRun
|
|
489
|
-
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[]}}}
|
|
489
|
+
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[], moduleUpdate?: {previous: string, module: string}}}}
|
|
490
490
|
*/
|
|
491
491
|
export function receipt(kind, name, root, manifestPath, files, dryRun) {
|
|
492
492
|
return {
|
|
@@ -96,7 +96,7 @@ export const doc = {
|
|
|
96
96
|
{code: 'ERR_RENDER_BROWSER_API', when: 'the page reads a browser-only API, such as window or document, while rendering'},
|
|
97
97
|
{code: 'ERR_RENDER_ASSET_TOO_LARGE', when: 'a local file the page uses is over 8 MB'},
|
|
98
98
|
{code: 'ERR_RENDER_TIMEOUT', when: 'the page does not finish rendering within 60 seconds'},
|
|
99
|
-
{code: 'ERR_RENDER_FAILED', when: 'the page throws while rendering for any other reason'},
|
|
99
|
+
{code: 'ERR_RENDER_FAILED', when: 'the page throws while rendering for any other reason, or Node itself crashes (a crash signal, or a crash status on Windows) or is stopped by a signal while it renders the page (the message names the Node version and path)'},
|
|
100
100
|
{
|
|
101
101
|
code: 'ERR_RENDER_NOT_ASTRYX',
|
|
102
102
|
when: 'reversing a file a render did not write, with no embedded source and no Astryx markup; the suggestion is `astryx build "<what the page is>"`',
|
|
@@ -31,7 +31,7 @@ export type RenderWarning = {
|
|
|
31
31
|
/**
|
|
32
32
|
* - What kind of problem.
|
|
33
33
|
*/
|
|
34
|
-
code: "dropped-children" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "not-embedded";
|
|
34
|
+
code: "dropped-children" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "not-embedded" | "node-crash";
|
|
35
35
|
/**
|
|
36
36
|
* - What happened and what to do, in one sentence.
|
|
37
37
|
*/
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* author meant.
|
|
23
23
|
* @experimental May change or be removed in a patch release.
|
|
24
24
|
* @typedef {object} RenderWarning
|
|
25
|
-
* @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'not-embedded'} code - What kind of problem.
|
|
25
|
+
* @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'not-embedded' | 'node-crash'} code - What kind of problem.
|
|
26
26
|
* @property {string} message - What happened and what to do, in one sentence.
|
|
27
27
|
*/
|
|
28
28
|
|
|
@@ -193,6 +193,7 @@ export async function template(name, options = {}) {
|
|
|
193
193
|
`Unknown template "${name}"`,
|
|
194
194
|
orderByAffinity(name, templates, t => [t.dirName, t.name], {
|
|
195
195
|
closest: true,
|
|
196
|
+
typos: true,
|
|
196
197
|
}).map(t => ({
|
|
197
198
|
name: t.dirName,
|
|
198
199
|
reason: `${t.type} template`,
|
|
@@ -100,6 +100,10 @@
|
|
|
100
100
|
"kind": "component",
|
|
101
101
|
"name": "ChatUnreadDivider"
|
|
102
102
|
},
|
|
103
|
+
{
|
|
104
|
+
"kind": "component",
|
|
105
|
+
"name": "ChatVirtualizer"
|
|
106
|
+
},
|
|
103
107
|
{
|
|
104
108
|
"kind": "component",
|
|
105
109
|
"name": "CircleCheckIndicator"
|
|
@@ -128,6 +132,10 @@
|
|
|
128
132
|
"kind": "component",
|
|
129
133
|
"name": "CommentThread"
|
|
130
134
|
},
|
|
135
|
+
{
|
|
136
|
+
"kind": "component",
|
|
137
|
+
"name": "DialogHeroHeader"
|
|
138
|
+
},
|
|
131
139
|
{
|
|
132
140
|
"kind": "component",
|
|
133
141
|
"name": "DiffViewer"
|
|
@@ -136,6 +144,10 @@
|
|
|
136
144
|
"kind": "component",
|
|
137
145
|
"name": "EmojiPicker"
|
|
138
146
|
},
|
|
147
|
+
{
|
|
148
|
+
"kind": "component",
|
|
149
|
+
"name": "LineClamp"
|
|
150
|
+
},
|
|
139
151
|
{
|
|
140
152
|
"kind": "component",
|
|
141
153
|
"name": "ListInput"
|
|
@@ -252,6 +264,10 @@
|
|
|
252
264
|
"kind": "template",
|
|
253
265
|
"name": "CommentThreadShowcase"
|
|
254
266
|
},
|
|
267
|
+
{
|
|
268
|
+
"kind": "template",
|
|
269
|
+
"name": "DialogHeroHeaderShowcase"
|
|
270
|
+
},
|
|
255
271
|
{
|
|
256
272
|
"kind": "template",
|
|
257
273
|
"name": "DiffViewerShowcase"
|
|
@@ -90,7 +90,7 @@ export const docs = {
|
|
|
90
90
|
{
|
|
91
91
|
type: 'code',
|
|
92
92
|
lang: 'bash',
|
|
93
|
-
label: 'Install
|
|
93
|
+
label: 'Install',
|
|
94
94
|
code: '{@pm install @astryxdesign/core @stylexjs/stylex @astryxdesign/theme-neutral}',
|
|
95
95
|
},
|
|
96
96
|
{
|
|
@@ -113,7 +113,7 @@ export const docs = {
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
type: 'prose',
|
|
116
|
-
text: 'For Tailwind v3, see the layer workaround in {@link generic:migration-setup}.',
|
|
116
|
+
text: 'A project with Tailwind already set up needs a smaller change, which {@link generic:tailwind} shows. For Tailwind v3, see the layer workaround in {@link generic:migration-setup}.',
|
|
117
117
|
},
|
|
118
118
|
],
|
|
119
119
|
},
|
|
@@ -162,7 +162,7 @@ export const docs = {
|
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
type: 'prose',
|
|
165
|
-
text:
|
|
165
|
+
text: "`{@command swizzle <Component>}` writes an `astryx-swizzle.json` marker into an output folder it owns (one the copy creates, an empty one, or one it marked before); every module under that folder then compiles as Astryx source, so keep copies in a folder of their own, such as the default `components/astryx`. For a folder that already holds other files it writes no marker and says how to add one by hand. With `@astryxdesign/build`'s Babel, PostCSS and Vite integrations, or `withAstryx()` under webpack, a copy under that folder compiles into `astryx-base`, below `astryx-theme`, so theme component overrides reach it as they reach the package component. Under Turbopack, and with the stock StyleX plugins above, a copy's rules land in your own styles, above `astryx-theme`, and theme component overrides do not reach it.",
|
|
166
166
|
},
|
|
167
167
|
],
|
|
168
168
|
},
|
|
@@ -61,7 +61,7 @@ export const docs = {
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
type: 'prose',
|
|
64
|
-
text: "`outline.doc.mjs` is the descriptor: name, display name and description (`--display-name`, `--description`), and `license`, the SPDX license of the artwork (it starts as your package's own). `outline.icons.json` starts with no icons and an empty `map`; its `module` is your package name. `outline.generated.js` is the set's generated module, with its declaration file `outline.generated.d.ts`: the CLI writes both, and every icon and the theme map are exports of it. Every field is in {@link schema:icon-set-doc} and {@link schema:icon-set-data}.",
|
|
64
|
+
text: "`outline.doc.mjs` is the descriptor: name, display name and description (`--display-name`, `--description`), and `license`, the SPDX license of the artwork (it starts as your package's own). `outline.icons.json` starts with no icons and an empty `map`; its `module` is your package name. After you rename the package, the next command that writes the data file (`new-set` on the existing set, with or without `--from`, `add`, `map`, or `new-definition --icon`) writes the new name and keeps any subpath (`@acme/old-icons/outline` becomes `@acme/new-icons/outline`), and its receipt says so. `outline.generated.js` is the set's generated module, with its declaration file `outline.generated.d.ts`: the CLI writes both, and every icon and the theme map are exports of it. Every field is in {@link schema:icon-set-doc} and {@link schema:icon-set-data}.",
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
type: 'prose',
|
|
@@ -121,7 +121,7 @@ export const docs = {
|
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
type: 'prose',
|
|
124
|
-
text: "Every component the library exports becomes an icon (an alias of one component is recorded once), named `<Name>Icon`, with an id from its name (`Squares2X2Icon` is `squares-2x2`: a dimension stays one word). `map` is filled only where a definition's name is an icon's id (`delete` → icon `delete`), and the receipt lists those entries under Mapped by name: a library can draw another meaning under the same name (one library's `delete` is a backspace key), so check each. An icon whose id is only one of a definition's words (`trash` for `delete`) may mean something else in this library, so the receipt lists it under Suggestions, with the `experimental icon map <definition> <icon>` command for each, and writes nothing for it: check the meaning, then run the ones that fit. Run it again after a library release to refresh the icons that library supplies; `map` entries whose icon still exists are kept, and the receipt names any icon the library dropped, any icon `--exclude` left out, and the `map` entries each took with it. Icons you added from your own files or another library are left as they are. Icons you added one file at a time from the same package (`--from <package>/dist/XIcon`) move to the root import when you refresh from the package root and the root exports the same icon; each keeps its id, export, `map` entries, variants, and words on that refresh and every later one, and the receipt lists it under `moved`. A library icon whose id or name a moved icon already has is left out. When another icon of the set already reads the same root export, the icon stays on its own file, and the receipt says why. An icon you already have is known by the library export it re-exports, so it keeps its export name exactly, its `map` entries, variants, and words, even when a newer CLI spells its id differently or your `--exclude` lets a library prefix come off new ids; the receipt lists each changed id under `renamed`. An id you chose that is not a spelling of the library name (`dismiss` for `XIcon`) is kept. A refresh with `--dry-run` writes nothing and prints the Mapped by name and Suggestions lists again; `--display-name` and `--description` on a refresh rewrite the descriptor. Variants added with `add --variant … --all` are kept too; run that `add` again to pick up icons the release added. `experimental icon --list` shows how many definitions the set maps.",
|
|
124
|
+
text: "Every component the library exports becomes an icon (an alias of one component is recorded once), named `<Name>Icon`, with an id from its name (`Squares2X2Icon` is `squares-2x2`: a dimension stays one word). An export name cannot start with a digit, so an icon whose id would start with one once the library prefix comes off keeps the prefix (`fa0` is id `fa-0`, exported as `Fa0Icon`), and an id you give with `--id` must start with a letter. `map` is filled only where a definition's name is an icon's id (`delete` → icon `delete`), and the receipt lists those entries under Mapped by name: a library can draw another meaning under the same name (one library's `delete` is a backspace key), so check each. An icon whose id is only one of a definition's words (`trash` for `delete`) may mean something else in this library, so the receipt lists it under Suggestions, with the `experimental icon map <definition> <icon>` command for each, and writes nothing for it: check the meaning, then run the ones that fit. Run it again after a library release to refresh the icons that library supplies; `map` entries whose icon still exists are kept, and the receipt names any icon the library dropped, any icon `--exclude` left out, and the `map` entries each took with it. Icons you added from your own files or another library are left as they are. Icons you added one file at a time from the same package (`--from <package>/dist/XIcon`) move to the root import when you refresh from the package root and the root exports the same icon; each keeps its id, export, `map` entries, variants, and words on that refresh and every later one, and the receipt lists it under `moved`. A library icon whose id or name a moved icon already has is left out. When another icon of the set already reads the same root export, the icon stays on its own file, and the receipt says why. An icon you already have is known by the library export it re-exports, so it keeps its export name exactly, its `map` entries, variants, and words, even when a newer CLI spells its id differently or your `--exclude` lets a library prefix come off new ids; the receipt lists each changed id under `renamed`. An id you chose that is not a spelling of the library name (`dismiss` for `XIcon`) is kept. A refresh with `--dry-run` writes nothing and prints the Mapped by name and Suggestions lists again; `--display-name` and `--description` on a refresh rewrite the descriptor. Variants added with `add --variant … --all` are kept too; run that `add` again to pick up icons the release added. `experimental icon --list` shows how many definitions the set maps.",
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
type: 'prose',
|
|
@@ -139,11 +139,11 @@ astryx experimental icon add --variant solid --from @heroicons/react/24/solid --
|
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
type: 'prose',
|
|
142
|
-
text: "A library that redraws its artwork for small sizes (Heroicons' 20px mini and 16px micro) ships each of those as its own set in its own package (their export names match the 24px ones), not as variants: a variant's size comes from CSS. `--variants` lists the variants; `--default-variant` names the one each icon's own export draws (when omitted, the look a library that names its looks draws; otherwise the set's current default, else, on a set without icons, the first variant; a set with icons changes it only with `--from`, and only in a library that names its looks). `--all` adds the variant for every icon whose id an export of `--from` has (`TrashIcon` in the solid module becomes `TrashSolidIcon`, the solid variant of `trash`), and the receipt lists the icons the module has no export for. Running it again changes nothing.",
|
|
142
|
+
text: "A library that redraws its artwork for small sizes (Heroicons' 20px mini and 16px micro) ships each of those as its own set in its own package (their export names match the 24px ones), not as variants: a variant's size comes from CSS. `--variants` lists the variants; `--default-variant` names the one each icon's own export draws (when omitted, the look a library that names its looks draws; otherwise the set's current default, else, on a set without icons, the first variant; a set with icons changes it only with `--from`, and only in a library that names its looks). `--all` adds the variant for every icon whose id an export of `--from` has (`TrashIcon` in the solid module becomes `TrashSolidIcon`, the solid variant of `trash`), and the receipt lists the icons the module has no export for. A library may ship each look as its own package (Font Awesome's solid and regular packages): `--from` may then name the other package, and an icon gains the variant from the export of the same name there; the receipt lists the icons that package has no export for. Running it again changes nothing.",
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
type: 'prose',
|
|
146
|
-
text: 'A library whose icons are data (objects or SVG strings) has no components to find: create the set, declare an `adapter` in its data file (see library shapes), and run the command again; every data export then becomes an icon through the adapter. When every icon export shares a leading word, such as `feather` in `featherEye` and `featherSun`, ids and export names leave it out: `featherEye` becomes id `eye`, exported as `EyeIcon`. The prefix is read over icon-like exports only: SCREAMING_CASE constants (`README`, `VERSION`), number and boolean exports, and, next to components or icon objects, plain strings are never icons. Components named `…Provider` or `…Context` are never icons either
|
|
146
|
+
text: 'A library whose icons are data (objects or SVG strings) has no components to find: create the set, declare an `adapter` in its data file (see library shapes), and run the command again; every data export then becomes an icon through the adapter. When every icon export shares a leading word, such as `feather` in `featherEye` and `featherSun`, ids and export names leave it out: `featherEye` becomes id `eye`, exported as `EyeIcon`. The prefix is read over icon-like exports only: SCREAMING_CASE constants (`README`, `VERSION`), number and boolean exports, and, next to components or icon objects, plain strings are never icons. Components named `…Provider` or `…Context` are never icons either, and neither is a pack: an object whose keys are all other exports of the module, such as `fas` next to `faXmark`. Leave out any other export that is not an icon with `--exclude meta,version`: the data file keeps the list in `exclude`, so a refresh leaves them out too. When a library exports one icon under several names (`Trash2` and `Trash`), the icon is recorded once and its other names become words, so `experimental icon trash-2` finds it and `experimental icon map delete trash-2` maps it. `experimental icon add` reads the prefix the same way, and reuses the icon an export already has, so its commands need no `--id`.',
|
|
147
147
|
},
|
|
148
148
|
],
|
|
149
149
|
},
|
|
@@ -67,7 +67,7 @@ export const docs = {
|
|
|
67
67
|
content: [
|
|
68
68
|
{
|
|
69
69
|
type: 'prose',
|
|
70
|
-
text: 'Each warning names something that may look different from what you meant, and what to change. The most common is a component that ignores its children: `<ListItem>Save</ListItem>` renders an empty row because ListItem takes `label="Save"`. Others flag remote images (a sandboxed viewer cannot load them; save the image next to the page and import it), a `<script>`, `<link>` or `<iframe>` the page itself renders (the file promises to run and load nothing, so remove them), missing images, and output the page printed while rendering.',
|
|
70
|
+
text: 'Each warning names something that may look different from what you meant, and what to change. The most common is a component that ignores its children: `<ListItem>Save</ListItem>` renders an empty row because ListItem takes `label="Save"`. Others flag remote images (a sandboxed viewer cannot load them; save the image next to the page and import it), a `<script>`, `<link>` or `<iframe>` the page itself renders (the file promises to run and load nothing, so remove them), missing images, and output the page printed while rendering. A `node-crash` warning names a Node build that crashes in `Intl.Segmenter` (its version and path). The page rendered without it, so the output may differ slightly: initials and character counts (such as Avatar initials) can split a joined emoji, a flag, or a letter written with a separate accent mark. Names in ordinary composed letters (`José`, `Zoë`, `李小龙`) come out the same. Render with an official Node.js build to remove the difference.',
|
|
71
71
|
},
|
|
72
72
|
],
|
|
73
73
|
},
|
|
@@ -19,6 +19,8 @@ export const docs = {
|
|
|
19
19
|
'tailwind-theme.css',
|
|
20
20
|
'utility classes',
|
|
21
21
|
'preflight',
|
|
22
|
+
'existing Tailwind app',
|
|
23
|
+
'cascade layer order',
|
|
22
24
|
],
|
|
23
25
|
|
|
24
26
|
sections: [
|
|
@@ -69,7 +71,45 @@ import {themes, defaultThemeSlug} from './astryx-themes';`,
|
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
73
|
type: 'prose',
|
|
72
|
-
text:
|
|
74
|
+
text: "The Tailwind bridge is the concrete example of the general interop pattern: expose another library's semantic API, but point the values at system token variables.",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: 'Add Astryx to an app that already uses Tailwind',
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: 'prose',
|
|
83
|
+
text: 'The recipe in the Tailwind section is a whole `globals.css` for a new app. An app that already uses Tailwind keeps its own file: its `@import "tailwindcss"`, its `@theme` mapping, and its `:root` variables stay as they are. Add one `@layer` line above the Tailwind import and the Astryx stylesheets below it.',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'code',
|
|
87
|
+
lang: 'css',
|
|
88
|
+
label: 'globals.css (existing Tailwind app)',
|
|
89
|
+
code: `@layer reset, theme, base, astryx-base, astryx-theme, components, utilities;
|
|
90
|
+
|
|
91
|
+
@import "tailwindcss"; /* the app's own entry, unchanged */
|
|
92
|
+
@import "@astryxdesign/core/reset.css";
|
|
93
|
+
@import "@astryxdesign/core/astryx.css";
|
|
94
|
+
@import "@astryxdesign/theme-neutral/theme.css";
|
|
95
|
+
|
|
96
|
+
/* The app's own @theme and :root rules stay below, unchanged. */`,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'prose',
|
|
100
|
+
text: "This recipe leaves out `tailwind-theme.css`. The bridge maps Tailwind theme names to system tokens, including Tailwind's own defaults such as `rounded-lg` and `shadow-md`, so in an existing app it changes what the app's own classes paint. Add it only when the app does not use the names it maps.",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: 'prose',
|
|
104
|
+
text: "Astryx's theme defines its own CSS custom properties (color, spacing, radius, shadow, font, motion and more), and {@link namespace:tokens} has the full list. An app token with one of those names collides in one of two ways. An app `@theme` key takes Astryx's value, because `astryx.css` sets the tokens on `:root` above Tailwind's `theme` layer: with `@theme { --spacing-4: 1.5rem }`, the app's `gap-4` stays 16px. Marking the block `@theme inline` keeps the app's value in its utilities. An app `:root` variable replaces Astryx's value, so Astryx's own components change: `:root { --spacing-4: 1.5rem }` widens Astryx's spacing step 4 from 16px to 24px. Where the root Theme component sets a token again, such as `--color-warning`, the app's own rules inside it read Astryx's value instead. Rename any app token that shares a name.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'prose',
|
|
108
|
+
text: "Put the `@layer` line above the app's `@import \"tailwindcss\"`, never below it. A `@layer` statement orders only the layer names the page has not seen yet, and the Tailwind import names `theme`, `base`, `components`, and `utilities` as it loads. Below that import, the statement can only add `reset`, `astryx-base`, and `astryx-theme` after Tailwind's `utilities`. That inverts the cascade: the Astryx reset then outranks every utility class in the app, and, for example, removes the borders and padding the app's utilities give its controls. Nothing reports it: the build and the browser console stay clean, and the `@layer` line still looks right in the source, so only the rendered page shows the problem.",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'prose',
|
|
112
|
+
text: 'The load-order rule from the Tailwind section still applies: `globals.css` must be the first stylesheet the page loads, so its `@layer` line names the layers first.',
|
|
73
113
|
},
|
|
74
114
|
],
|
|
75
115
|
},
|