@yahoo/uds-create-config 4.10.2 → 4.10.4
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/dist/configs/CanvasConfig.d.ts +165 -77
- package/dist/configs/documentation.d.ts +1 -1
- package/dist/configs/react-native-system.d.ts +111 -52
- package/dist/configs/system.d.ts +121 -87
- package/dist/configs/system.js +4 -0
- package/dist/entities/documentation/Documentation.d.ts +1 -1
- package/dist/entities/native/NativeModifier.d.ts +1 -1
- package/dist/entities/native/NativeSettings.d.ts +1 -1
- package/dist/entities/native/NativeStyleProperty.d.ts +2 -2
- package/dist/entities/native/NativeToken.d.ts +4 -3
- package/dist/entities/system/CanvasRole.d.ts +1 -1
- package/dist/entities/system/Component.d.ts +23 -13
- package/dist/entities/system/Component.js +41 -15
- package/dist/entities/system/Composite.d.ts +1 -1
- package/dist/entities/system/Device.d.ts +1 -1
- package/dist/entities/system/File.d.ts +2 -2
- package/dist/entities/system/Font.d.ts +1 -1
- package/dist/entities/system/GlobalStyle.d.ts +1 -1
- package/dist/entities/system/Guidance.d.ts +1 -1
- package/dist/entities/system/GuidanceStyle.d.ts +1 -1
- package/dist/entities/system/Icon.d.ts +63 -11
- package/dist/entities/system/Icon.js +70 -14
- package/dist/entities/system/LinkedSystem.d.ts +1 -1
- package/dist/entities/system/Modifier.d.ts +2 -2
- package/dist/entities/system/Motion.d.ts +1 -1
- package/dist/entities/system/Package.d.ts +1 -1
- package/dist/entities/system/Settings.d.ts +1 -1
- package/dist/entities/system/StyleProperty.d.ts +12 -19
- package/dist/entities/system/StyleProperty.js +7 -10
- package/dist/entities/system/Token.d.ts +4 -3
- package/dist/entities/system/defineComponent.d.ts +21 -6
- package/dist/entities/system/defineComponent.js +7 -12
- package/dist/entities/system/glyph-identity.d.ts +7 -0
- package/dist/entities/system/glyph-identity.js +153 -0
- package/dist/entities/system/icon-domain-invariants.d.ts +11 -0
- package/dist/entities/system/icon-domain-invariants.js +178 -0
- package/dist/entities/system/icon-library.d.ts +93 -34
- package/dist/entities/system/icon-library.js +218 -50
- package/dist/entities/system/icon-metadata.d.ts +10 -4
- package/dist/entities/system/icon-metadata.js +45 -5
- package/dist/entities/system/runtime-modules.js +5 -5
- package/dist/entities/system/style-bag.js +14 -2
- package/dist/framework/Config.d.ts +1 -1
- package/dist/framework/Config.js +34 -5
- package/dist/framework/defineConfig.d.ts +6 -3
- package/dist/framework/defineEntity.d.ts +54 -15
- package/dist/framework/defineEntity.js +56 -2
- package/dist/framework/projections.d.ts +40 -2
- package/dist/framework/projections.js +99 -5
- package/dist/framework/prop-surface.d.ts +6 -5
- package/dist/framework/prop-surface.js +12 -14
- package/dist/framework/registry.d.ts +17 -1
- package/dist/framework/registry.js +2 -1
- package/dist/framework/render-spec.d.ts +6 -5
- package/dist/framework/render-spec.js +16 -11
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/signature.js +5 -1
- package/dist/framework/utils/group.d.ts +15 -1
- package/dist/framework/utils/ref-grammar.d.ts +35 -0
- package/dist/framework/utils/ref-grammar.js +76 -0
- package/dist/framework/utils/refs.d.ts +13 -45
- package/dist/framework/utils/refs.js +31 -94
- package/dist/framework/value-domain.js +53 -8
- package/dist/index.d.ts +6 -6
- package/dist/index.js +5 -5
- package/dist/migrations/2.0.0/v1-artifact.d.ts +62 -45
- package/dist/migrations/2.0.0/v1-artifact.js +5 -7
- package/dist/migrations/20260921044042_icon_library_without_component.d.ts +19 -0
- package/dist/migrations/20260921044042_icon_library_without_component.js +86 -0
- package/dist/migrations/20260922013625_icon_libraries.d.ts +18 -0
- package/dist/migrations/20260922013625_icon_libraries.js +8 -0
- package/dist/renderer/UdsRenderer.d.ts +8 -1
- package/dist/renderer/UdsRenderer.js +7 -3
- package/dist/renderer/glyphEntries.d.ts +32 -0
- package/dist/renderer/glyphEntries.js +48 -0
- package/dist/renderer/glyphRenderable.d.ts +10 -0
- package/dist/renderer/glyphRenderable.js +40 -0
- package/dist/renderer/icon-library.d.ts +18 -11
- package/dist/renderer/index.d.ts +4 -2
- package/dist/renderer/index.js +4 -2
- package/dist/renderer/resolveGlyph.d.ts +47 -0
- package/dist/renderer/resolveGlyph.js +78 -0
- package/dist/renderer/wrapRegistry.d.ts +13 -4
- package/dist/renderer/wrapRegistry.js +7 -5
- package/dist/renderer/wrappers/component-refs.js +6 -2
- package/dist/renderer/wrappers/glyph-props.d.ts +15 -0
- package/dist/renderer/wrappers/glyph-props.js +65 -0
- package/dist/spec/glyph-jsx.d.ts +41 -0
- package/dist/spec/{asset-jsx.js → glyph-jsx.js} +7 -25
- package/dist/spec/index.d.ts +2 -2
- package/dist/spec/index.js +2 -2
- package/dist/spec/jsxToSpec.d.ts +10 -4
- package/dist/spec/jsxToSpec.js +21 -4
- package/dist/spec/specToJsx.d.ts +20 -9
- package/dist/spec/specToJsx.js +77 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/renderer/assetEntries.d.ts +0 -37
- package/dist/renderer/assetEntries.js +0 -38
- package/dist/renderer/assetRenderable.d.ts +0 -25
- package/dist/renderer/assetRenderable.js +0 -19
- package/dist/spec/asset-jsx.d.ts +0 -61
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { Ref } from "../../framework/utils/ref-grammar.js";
|
|
1
2
|
import { CopyPlan } from "../../entities/system/copy-plan.js";
|
|
2
|
-
import { ExtendableRef, Ref } from "../../framework/utils/refs.js";
|
|
3
|
-
import { CreateInput } from "../../framework/utils/field-schema.js";
|
|
4
3
|
import { SubEntityClass } from "../../framework/defineSubEntity.js";
|
|
5
4
|
import { ComputedInput } from "../../framework/registry.js";
|
|
6
5
|
import { DerivedEntityClass } from "../../framework/defineDerivedEntity.js";
|
|
7
6
|
import { ComponentContractOf, PathOf } from "../../framework/registered.js";
|
|
8
|
-
import { EntityClass } from "../../framework/defineEntity.js";
|
|
7
|
+
import { EntityClass, GroupComputedInput } from "../../framework/defineEntity.js";
|
|
9
8
|
import { ConfigInstance } from "../../framework/defineConfig.js";
|
|
10
9
|
import { PinOptionsField } from "../../entities/system/LinkedSystem.js";
|
|
11
10
|
import { BreakPlan, LinkPlan, SourceRowState, UnlinkPlan } from "../../entities/system/link-plan.js";
|
|
@@ -15,6 +14,7 @@ import { StoredPreviewCondition } from "../../framework/preview-store.js";
|
|
|
15
14
|
import { listSlots, namedSlots, slotHostedBy, slotOf } from "../../spec/slot.js";
|
|
16
15
|
import { cellAt } from "../../spec/cell.js";
|
|
17
16
|
import { instanceAt } from "../../spec/instance.js";
|
|
17
|
+
import { GlyphNamespace } from "../../entities/system/glyph-identity.js";
|
|
18
18
|
import { DerivedColor, Gradient } from "../../entities/system/color.js";
|
|
19
19
|
import { StyleValue } from "../../entities/system/style-bag.js";
|
|
20
20
|
import { ComponentElementBody, ComponentReference, ComponentStyleBody } from "../../entities/system/Component.js";
|
|
@@ -228,7 +228,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
228
228
|
pagesDir: _$zod.ZodOptional<_$zod.ZodString>;
|
|
229
229
|
port: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
230
230
|
}, _$zod_v4_core0.$strict>>;
|
|
231
|
-
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "settings", Record<never, never>, Record<never, never>, true
|
|
231
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "settings", Record<never, never>, Record<never, never>, true, Record<never, never>, Record<never, never>>;
|
|
232
232
|
tokens: EntityClass<_$zod.ZodObject<{
|
|
233
233
|
value: _$zod.ZodType<string | number | Ref | DerivedColor | Gradient, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | Ref | DerivedColor | Gradient, unknown>>;
|
|
234
234
|
type: _$zod.ZodOptional<_$zod.ZodString>;
|
|
@@ -242,12 +242,12 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
242
242
|
readonly create: {
|
|
243
243
|
readonly description: `Create a token at \`<group>/<name>\` \u2014 \`data.value\` is the CSS value. The first path segment is its group, and a style property takes a whole group as one ref (\`${string}\`), so put the tokens one prop should offer in one group rather than listing values on the prop.`;
|
|
244
244
|
};
|
|
245
|
-
}, Record<never, never>, false
|
|
245
|
+
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
246
246
|
components: Omit<EntityClass<_$zod.ZodObject<{
|
|
247
247
|
layers: SubEntityClass<_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodLazy<_$zod.ZodType<Ref, unknown, _$zod_v4_core0.$ZodTypeInternals<Ref, unknown>>>, EntityClass<_$zod.ZodObject<{
|
|
248
248
|
version: _$zod.ZodOptional<_$zod.ZodString>;
|
|
249
249
|
exports: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{}, _$zod_v4_core0.$strict>>>;
|
|
250
|
-
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false
|
|
250
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>]>>;
|
|
251
251
|
props: _$zod.ZodOptional<SubEntityClass<_$zod.ZodNullable<_$zod.ZodDiscriminatedUnion<[_$zod.ZodObject<{
|
|
252
252
|
type: _$zod.ZodLiteral<"slot">;
|
|
253
253
|
text: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
@@ -266,7 +266,9 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
266
266
|
type: _$zod.ZodLiteral<"variant">;
|
|
267
267
|
value: _$zod.ZodUnion<readonly [_$zod.ZodPipe<_$zod.ZodArray<_$zod.ZodString>, _$zod.ZodTransform<{
|
|
268
268
|
[k: string]: {};
|
|
269
|
-
}, string[]>>, _$zod.ZodObject<{
|
|
269
|
+
}, string[]>>, _$zod.ZodArray<_$zod.ZodObject<{
|
|
270
|
+
__ref: _$zod.ZodString;
|
|
271
|
+
}, _$zod_v4_core0.$strip>>, _$zod.ZodObject<{
|
|
270
272
|
__ref: _$zod.ZodString;
|
|
271
273
|
}, _$zod_v4_core0.$strip>, SubEntityClass<_$zod.ZodObject<{
|
|
272
274
|
label: _$zod.ZodOptional<_$zod.ZodString>;
|
|
@@ -417,7 +419,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
417
419
|
layers: SubEntityClass<_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodLazy<_$zod.ZodType<Ref, unknown, _$zod_v4_core0.$ZodTypeInternals<Ref, unknown>>>, EntityClass<_$zod.ZodObject<{
|
|
418
420
|
version: _$zod.ZodOptional<_$zod.ZodString>;
|
|
419
421
|
exports: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{}, _$zod_v4_core0.$strict>>>;
|
|
420
|
-
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false
|
|
422
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>]>>;
|
|
421
423
|
props: _$zod.ZodOptional<SubEntityClass<_$zod.ZodNullable<_$zod.ZodDiscriminatedUnion<[_$zod.ZodObject<{
|
|
422
424
|
type: _$zod.ZodLiteral<"slot">;
|
|
423
425
|
text: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
@@ -436,7 +438,9 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
436
438
|
type: _$zod.ZodLiteral<"variant">;
|
|
437
439
|
value: _$zod.ZodUnion<readonly [_$zod.ZodPipe<_$zod.ZodArray<_$zod.ZodString>, _$zod.ZodTransform<{
|
|
438
440
|
[k: string]: {};
|
|
439
|
-
}, string[]>>, _$zod.ZodObject<{
|
|
441
|
+
}, string[]>>, _$zod.ZodArray<_$zod.ZodObject<{
|
|
442
|
+
__ref: _$zod.ZodString;
|
|
443
|
+
}, _$zod_v4_core0.$strip>>, _$zod.ZodObject<{
|
|
440
444
|
__ref: _$zod.ZodString;
|
|
441
445
|
}, _$zod_v4_core0.$strip>, SubEntityClass<_$zod.ZodObject<{
|
|
442
446
|
label: _$zod.ZodOptional<_$zod.ZodString>;
|
|
@@ -1283,8 +1287,8 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1283
1287
|
path,
|
|
1284
1288
|
member
|
|
1285
1289
|
}: ComputedInput) => string[];
|
|
1286
|
-
}, false>, "ref"> & {
|
|
1287
|
-
ref<const Path extends PathOf<"component">>(path: Path): ComponentReference<ComponentContractOf<Path
|
|
1290
|
+
}, false, Record<never, never>, Record<never, never>>, "ref"> & {
|
|
1291
|
+
ref<const Path extends PathOf<"component">>(path: Path): ComponentReference<ComponentContractOf<Path>, Path>;
|
|
1288
1292
|
slots: typeof listSlots;
|
|
1289
1293
|
slot: typeof slotOf;
|
|
1290
1294
|
slotHostedBy: typeof slotHostedBy;
|
|
@@ -1300,7 +1304,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1300
1304
|
}>;
|
|
1301
1305
|
value: _$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodLazy<EntityClass<_$zod.ZodObject<{
|
|
1302
1306
|
styles: SubEntityClass<_$zod.ZodType<StyleValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StyleValue, unknown>>>;
|
|
1303
|
-
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "composite", Record<never, never>, Record<never, never>, false
|
|
1307
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "composite", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>>]>;
|
|
1304
1308
|
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<{
|
|
1305
1309
|
type: _$zod.ZodOptional<_$zod.ZodEnum<{
|
|
1306
1310
|
mode: "mode";
|
|
@@ -1309,8 +1313,8 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1309
1313
|
default: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
1310
1314
|
__ref: _$zod.ZodString;
|
|
1311
1315
|
}, _$zod_v4_core0.$strip>>;
|
|
1312
|
-
}, _$zod_v4_core0.$strip>, "modifier", Record<never, never>, Record<never, never>, false
|
|
1313
|
-
styleProps:
|
|
1316
|
+
}, _$zod_v4_core0.$strip>, "modifier", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1317
|
+
styleProps: EntityClass<_$zod.ZodObject<{
|
|
1314
1318
|
properties: _$zod.ZodArray<_$zod.ZodString>;
|
|
1315
1319
|
values: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodType<StylePropValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StylePropValue, unknown>>>>;
|
|
1316
1320
|
responsive: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
@@ -1336,22 +1340,10 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1336
1340
|
data: Record<string, unknown>;
|
|
1337
1341
|
} | undefined;
|
|
1338
1342
|
};
|
|
1339
|
-
}, Record<never, never>, false>,
|
|
1340
|
-
ref<const Path extends PathOf<"style-property">>(path: Path): ReturnType<(path: string) => ExtendableRef<Partial<CreateInput<_$zod.ZodObject<{
|
|
1341
|
-
properties: _$zod.ZodArray<_$zod.ZodString>;
|
|
1342
|
-
values: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodType<StylePropValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StylePropValue, unknown>>>>;
|
|
1343
|
-
responsive: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
1344
|
-
classPrefix: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1345
|
-
arbitrary: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
1346
|
-
negates: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
1347
|
-
opacityOf: _$zod.ZodOptional<_$zod.ZodLazy<_$zod.ZodType<Ref, unknown, _$zod_v4_core0.$ZodTypeInternals<Ref, unknown>>>>;
|
|
1348
|
-
}, _$zod_v4_core0.$strip>>>>> & {
|
|
1349
|
-
readonly __ref: `style-property:${Path}`;
|
|
1350
|
-
};
|
|
1351
|
-
};
|
|
1343
|
+
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1352
1344
|
composites: EntityClass<_$zod.ZodObject<{
|
|
1353
1345
|
styles: SubEntityClass<_$zod.ZodType<StyleValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StyleValue, unknown>>>;
|
|
1354
|
-
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "composite", Record<never, never>, Record<never, never>, false
|
|
1346
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "composite", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1355
1347
|
motion: EntityClass<_$zod.ZodDiscriminatedUnion<[_$zod.ZodObject<{
|
|
1356
1348
|
runtime: _$zod.ZodLiteral<"css">;
|
|
1357
1349
|
keyframes: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>>;
|
|
@@ -1373,7 +1365,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1373
1365
|
drag: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodBoolean, _$zod.ZodString]>>;
|
|
1374
1366
|
dragConstraints: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodNumber>>;
|
|
1375
1367
|
dragElastic: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
1376
|
-
}, _$zod_v4_core0.$strict>], "runtime">, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "motion", Record<never, never>, Record<never, never>, false
|
|
1368
|
+
}, _$zod_v4_core0.$strict>], "runtime">, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "motion", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1377
1369
|
fonts: EntityClass<_$zod.ZodObject<{
|
|
1378
1370
|
fontFamily: _$zod.ZodString;
|
|
1379
1371
|
files: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{
|
|
@@ -1388,35 +1380,60 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1388
1380
|
isVariableFont: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
1389
1381
|
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<{
|
|
1390
1382
|
version: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1391
|
-
}, _$zod_v4_core0.$strict>, "font", Record<never, never>, Record<never, never>, false
|
|
1383
|
+
}, _$zod_v4_core0.$strict>, "font", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1392
1384
|
icons: EntityClass<_$zod.ZodObject<{
|
|
1393
1385
|
categories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
1394
1386
|
tags: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
1395
1387
|
codepoint: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
1388
|
+
variants: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
1396
1389
|
knockoutVariants: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
1397
1390
|
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<{
|
|
1398
|
-
|
|
1399
|
-
|
|
1391
|
+
package: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
1392
|
+
__ref: _$zod.ZodString;
|
|
1393
|
+
}, _$zod_v4_core0.$strip>>;
|
|
1400
1394
|
metadata: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
1401
1395
|
from: EntityClass<_$zod.ZodObject<{
|
|
1402
1396
|
version: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1403
1397
|
exports: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{}, _$zod_v4_core0.$strict>>>;
|
|
1404
|
-
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false
|
|
1398
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1405
1399
|
format: _$zod.ZodEnum<{
|
|
1406
1400
|
uds: "uds";
|
|
1407
1401
|
phosphor: "phosphor";
|
|
1402
|
+
tabler: "tabler";
|
|
1408
1403
|
}>;
|
|
1409
1404
|
}, _$zod_v4_core0.$strict>>;
|
|
1410
1405
|
sizes: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodNumber>>;
|
|
1411
1406
|
variants: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
}, _$zod_v4_core0.$
|
|
1415
|
-
|
|
1407
|
+
variantAs: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodObject<{
|
|
1408
|
+
prop: _$zod.ZodString;
|
|
1409
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<{
|
|
1410
|
+
export: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodString>;
|
|
1411
|
+
}, _$zod_v4_core0.$strict>]>>;
|
|
1412
|
+
}, _$zod_v4_core0.$strict>, "icon", Record<never, never>, Record<never, never>, false, {
|
|
1413
|
+
readonly members: ({
|
|
1414
|
+
config,
|
|
1415
|
+
path
|
|
1416
|
+
}: GroupComputedInput) => string[];
|
|
1417
|
+
readonly module: ({
|
|
1418
|
+
meta
|
|
1419
|
+
}: GroupComputedInput) => string | undefined;
|
|
1420
|
+
readonly version: ({
|
|
1421
|
+
config,
|
|
1422
|
+
meta
|
|
1423
|
+
}: GroupComputedInput) => string | undefined;
|
|
1424
|
+
}, {
|
|
1425
|
+
readonly glyphs: ({
|
|
1426
|
+
input,
|
|
1427
|
+
body
|
|
1428
|
+
}: {
|
|
1429
|
+
input: GlyphNamespace;
|
|
1430
|
+
body: Readonly<Record<string, unknown>>;
|
|
1431
|
+
}) => void;
|
|
1432
|
+
}>;
|
|
1416
1433
|
packages: EntityClass<_$zod.ZodObject<{
|
|
1417
1434
|
version: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1418
1435
|
exports: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{}, _$zod_v4_core0.$strict>>>;
|
|
1419
|
-
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false
|
|
1436
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1420
1437
|
files: EntityClass<_$zod.ZodObject<{
|
|
1421
1438
|
hash: _$zod.ZodString;
|
|
1422
1439
|
imports: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{
|
|
@@ -1428,7 +1445,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1428
1445
|
readonly binary: ({
|
|
1429
1446
|
path
|
|
1430
1447
|
}: ComputedInput) => boolean;
|
|
1431
|
-
}, false
|
|
1448
|
+
}, false, Record<never, never>, Record<never, never>>;
|
|
1432
1449
|
guidance: EntityClass<_$zod.ZodObject<{
|
|
1433
1450
|
text: _$zod.ZodArray<_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodObject<{
|
|
1434
1451
|
__ref: _$zod.ZodString;
|
|
@@ -1442,10 +1459,10 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1442
1459
|
"paint-style": "paint-style";
|
|
1443
1460
|
"figma-import": "figma-import";
|
|
1444
1461
|
}>>>;
|
|
1445
|
-
}, _$zod_v4_core0.$strict>, "guidance", Record<never, never>, Record<never, never>, false
|
|
1462
|
+
}, _$zod_v4_core0.$strict>, "guidance", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1446
1463
|
guidanceStyles: EntityClass<_$zod.ZodObject<{
|
|
1447
1464
|
text: _$zod.ZodString;
|
|
1448
|
-
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "guidance-style", Record<never, never>, Record<never, never>, false
|
|
1465
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "guidance-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1449
1466
|
canvasRoles: EntityClass<_$zod.ZodObject<{
|
|
1450
1467
|
entries: _$zod.ZodArray<_$zod.ZodObject<{
|
|
1451
1468
|
component: _$zod.ZodObject<{
|
|
@@ -1458,7 +1475,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1458
1475
|
readonly create: {
|
|
1459
1476
|
readonly description: `Register a canvas insert tool for this system. \`path\` is the role, one of ${string}; \`data.entries\` names the components that tool inserts, one marked \`default\`. A system whose roles are unregistered has those canvas tools disabled, so register \`frame\` and \`text\` once a layout primitive and a text primitive exist.`;
|
|
1460
1477
|
};
|
|
1461
|
-
}, Record<never, never>, false
|
|
1478
|
+
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1462
1479
|
globalStyles: EntityClass<_$zod.ZodObject<{
|
|
1463
1480
|
selector: _$zod.ZodString;
|
|
1464
1481
|
declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | {
|
|
@@ -1474,12 +1491,12 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1474
1491
|
__ref: string;
|
|
1475
1492
|
} | /*elided*/any;
|
|
1476
1493
|
}, unknown>>>;
|
|
1477
|
-
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "global-style", Record<never, never>, Record<never, never>, false
|
|
1494
|
+
}, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "global-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1478
1495
|
devices: EntityClass<_$zod.ZodObject<{
|
|
1479
1496
|
width: _$zod.ZodNumber;
|
|
1480
1497
|
height: _$zod.ZodNumber;
|
|
1481
1498
|
name: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1482
|
-
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "device", Record<never, never>, Record<never, never>, false
|
|
1499
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "device", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
1483
1500
|
linkedSystems: EntityClass<_$zod.ZodObject<{
|
|
1484
1501
|
configPath: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1485
1502
|
link: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodLiteral<"*">, _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnion<readonly [_$zod.ZodLiteral<"*">, _$zod.ZodArray<_$zod.ZodString>]>>]>>;
|
|
@@ -1677,7 +1694,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1677
1694
|
member,
|
|
1678
1695
|
path
|
|
1679
1696
|
}: ComputedInput) => string;
|
|
1680
|
-
}, false
|
|
1697
|
+
}, false, Record<never, never>, Record<never, never>>;
|
|
1681
1698
|
}, {
|
|
1682
1699
|
operations: DerivedEntityClass<_$zod.ZodObject<{
|
|
1683
1700
|
kind: _$zod.ZodString;
|
|
@@ -82,7 +82,7 @@ const REF_KIND = {
|
|
|
82
82
|
tokenGroup: "token",
|
|
83
83
|
styleProperty: "style-property",
|
|
84
84
|
composite: "composite",
|
|
85
|
-
|
|
85
|
+
glyphLibrary: "font",
|
|
86
86
|
component: "component",
|
|
87
87
|
mode: "mode"
|
|
88
88
|
};
|
|
@@ -97,7 +97,7 @@ const isMarker = (v) => typeof v === "object" && v !== null && "__kind" in v;
|
|
|
97
97
|
*
|
|
98
98
|
* Module-scoped because `convertValue` is called from a dozen places and threading a resolver
|
|
99
99
|
* through all of them would obscure them; a load is synchronous, so the map is only ever the one in
|
|
100
|
-
* flight. Without it every `
|
|
100
|
+
* flight. Without it every `glyphLibrary('icons')` marker resolved to `font:icons` — a slot that
|
|
101
101
|
* accepts an ICON library, typed as a font.
|
|
102
102
|
*/
|
|
103
103
|
let assetKinds = {};
|
|
@@ -149,7 +149,7 @@ function report(code, path, detail) {
|
|
|
149
149
|
/**
|
|
150
150
|
* The config-v2 kind an asset marker fronts, or `undefined` when it isn't one.
|
|
151
151
|
*
|
|
152
|
-
* v1 had two spellings for the same split-in-two model: `
|
|
152
|
+
* v1 had two spellings for the same split-in-two model: `glyphLibrary` names a whole LIBRARY (its ref
|
|
153
153
|
* IS the library), `asset` names one MEMBER of one (`fonts/yas`), and neither says which class it
|
|
154
154
|
* holds — that lived on the group's `assetKind`. So both resolve through the same lookup, differing
|
|
155
155
|
* only in where the library name sits in the ref.
|
|
@@ -161,10 +161,10 @@ function report(code, path, detail) {
|
|
|
161
161
|
*/
|
|
162
162
|
function assetLibraryKind(value) {
|
|
163
163
|
if (!value.ref) return void 0;
|
|
164
|
-
if (value.__kind === "
|
|
164
|
+
if (value.__kind === "glyphLibrary") return assetKinds[value.ref] ?? REF_KIND.glyphLibrary;
|
|
165
165
|
if (value.__kind === "asset") {
|
|
166
166
|
const library = value.ref.slice(0, value.ref.indexOf("/"));
|
|
167
|
-
return assetKinds[library] ?? REF_KIND.
|
|
167
|
+
return assetKinds[library] ?? REF_KIND.glyphLibrary;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -868,10 +868,8 @@ function convert(studio, options) {
|
|
|
868
868
|
label: meta.label
|
|
869
869
|
});
|
|
870
870
|
else iconRecord[group] = Icon.group({
|
|
871
|
-
version: meta.version,
|
|
872
871
|
sizes: meta.sizes,
|
|
873
872
|
variants: meta.variants,
|
|
874
|
-
...meta.component ? { component: Component.ref(meta.component) } : {},
|
|
875
873
|
label: meta.label
|
|
876
874
|
});
|
|
877
875
|
const members = meta.members;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An icon library names its package and nothing about its renderers.
|
|
3
|
+
*
|
|
4
|
+
* Before, the group node carried `module` and `version` of its own and a `component` ref to the
|
|
5
|
+
* component a placed glyph rendered through. Now `package` is a ref to the `Package` item, which
|
|
6
|
+
* owns the module specifier (its path) and the pinned version, and no renderer is named: a
|
|
7
|
+
* component that draws glyphs points at the library through its own prop's domain
|
|
8
|
+
* (`Icon.ref('phosphor')`), so the edge runs from the component to the set.
|
|
9
|
+
*
|
|
10
|
+
* `up` moves `module`/`version` onto the package item (minted when the config has none) and drops
|
|
11
|
+
* `component`. Stored draft patches are `group-update` writes of whole metas, so `upPatch` reshapes
|
|
12
|
+
* their `data` the same way.
|
|
13
|
+
*
|
|
14
|
+
* Deletable once no stored artifact predates it.
|
|
15
|
+
*/
|
|
16
|
+
import type { RawWireConfig, SchemaMigration } from '../framework/schema-version';
|
|
17
|
+
export declare const ICON_LIBRARY_WITHOUT_COMPONENT_VERSION = 20260921044042;
|
|
18
|
+
export declare function iconLibrariesNamePackages(json: RawWireConfig): RawWireConfig;
|
|
19
|
+
export declare const iconLibraryWithoutComponentMigration: SchemaMigration;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { isPlainObject } from "../framework/utils/field-path.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/migrations/20260921044042_icon_library_without_component.ts
|
|
4
|
+
/**
|
|
5
|
+
* An icon library names its package and nothing about its renderers.
|
|
6
|
+
*
|
|
7
|
+
* Before, the group node carried `module` and `version` of its own and a `component` ref to the
|
|
8
|
+
* component a placed glyph rendered through. Now `package` is a ref to the `Package` item, which
|
|
9
|
+
* owns the module specifier (its path) and the pinned version, and no renderer is named: a
|
|
10
|
+
* component that draws glyphs points at the library through its own prop's domain
|
|
11
|
+
* (`Icon.ref('phosphor')`), so the edge runs from the component to the set.
|
|
12
|
+
*
|
|
13
|
+
* `up` moves `module`/`version` onto the package item (minted when the config has none) and drops
|
|
14
|
+
* `component`. Stored draft patches are `group-update` writes of whole metas, so `upPatch` reshapes
|
|
15
|
+
* their `data` the same way.
|
|
16
|
+
*
|
|
17
|
+
* Deletable once no stored artifact predates it.
|
|
18
|
+
*/
|
|
19
|
+
const ICON_LIBRARY_WITHOUT_COMPONENT_VERSION = 20260921044042;
|
|
20
|
+
/** An icon group's meta as stored before: module, version and component of its own. */
|
|
21
|
+
const iconMetaBefore = z.looseObject({
|
|
22
|
+
module: z.string().optional(),
|
|
23
|
+
version: z.string().optional(),
|
|
24
|
+
component: z.unknown().optional()
|
|
25
|
+
});
|
|
26
|
+
/** An icon group's meta as stored now: the package it names, and no renderer. */
|
|
27
|
+
const iconMetaAfter = z.looseObject({ package: z.object({ __ref: z.string() }).optional() }).refine((meta) => !("module" in meta) && !("version" in meta) && !("component" in meta), { message: "an icon library names its package; module, version and component are gone" });
|
|
28
|
+
/** The envelope, loose but for the icon groups this migration touches. */
|
|
29
|
+
const before = z.looseObject({ groups: z.looseObject({ icon: z.record(z.string(), iconMetaBefore).optional() }).optional() });
|
|
30
|
+
const after = z.looseObject({ groups: z.looseObject({ icon: z.record(z.string(), iconMetaAfter).optional() }).optional() });
|
|
31
|
+
/** One icon group's meta, reshaped; the package item the module needs, when the config lacks it. */
|
|
32
|
+
function reshapeIconGroup(meta, packages) {
|
|
33
|
+
const { module, version, component: _component, ...kept } = meta;
|
|
34
|
+
if (typeof module !== "string") return kept;
|
|
35
|
+
const existing = packages[module];
|
|
36
|
+
if (!isPlainObject(existing)) packages[module] = typeof version === "string" ? { version } : {};
|
|
37
|
+
else if (typeof version === "string" && existing.version === void 0) packages[module] = {
|
|
38
|
+
...existing,
|
|
39
|
+
version
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
...kept,
|
|
43
|
+
package: { __ref: `package:${module}` }
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function iconLibrariesNamePackages(json) {
|
|
47
|
+
const groups = json.groups;
|
|
48
|
+
if (!isPlainObject(groups) || !isPlainObject(groups.icon)) return json;
|
|
49
|
+
if (!Object.values(groups.icon).some((meta) => isPlainObject(meta) && ("module" in meta || "version" in meta || "component" in meta))) return json;
|
|
50
|
+
const items = isPlainObject(json.items) ? json.items : {};
|
|
51
|
+
const packages = isPlainObject(items.package) ? { ...items.package } : {};
|
|
52
|
+
const icon = {};
|
|
53
|
+
for (const [path, meta] of Object.entries(groups.icon)) icon[path] = isPlainObject(meta) ? reshapeIconGroup(meta, packages) : meta;
|
|
54
|
+
return {
|
|
55
|
+
...json,
|
|
56
|
+
items: {
|
|
57
|
+
...items,
|
|
58
|
+
...Object.keys(packages).length ? { package: packages } : {}
|
|
59
|
+
},
|
|
60
|
+
groups: {
|
|
61
|
+
...groups,
|
|
62
|
+
icon
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const iconLibraryWithoutComponentMigration = {
|
|
67
|
+
version: ICON_LIBRARY_WITHOUT_COMPONENT_VERSION,
|
|
68
|
+
up: iconLibrariesNamePackages,
|
|
69
|
+
upPatch(patch) {
|
|
70
|
+
const op = patch;
|
|
71
|
+
if (op.kind !== "icon" || op.operation !== "group-update" || !isPlainObject(op.data)) return patch;
|
|
72
|
+
const { module, version: _version, component: _component, ...kept } = op.data;
|
|
73
|
+
const data = typeof module === "string" ? {
|
|
74
|
+
...kept,
|
|
75
|
+
package: { __ref: `package:${module}` }
|
|
76
|
+
} : kept;
|
|
77
|
+
return {
|
|
78
|
+
...patch,
|
|
79
|
+
data
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
fromSchema: before,
|
|
83
|
+
toSchema: after
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { ICON_LIBRARY_WITHOUT_COMPONENT_VERSION, iconLibraryWithoutComponentMigration };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An additive fence: one component draws the glyphs of several icon libraries. Three schema
|
|
3
|
+
* changes, none of which moves a stored byte.
|
|
4
|
+
*
|
|
5
|
+
* - A component's `variant` prop may bind a list of refs (`[icon:phosphor, icon:tabler]`), whose
|
|
6
|
+
* leaves are unioned. A single ref and an enumerated list read as before.
|
|
7
|
+
* - An icon group gains an optional `variantAs`, how a `variant` reaches the glyph (`{ prop }` or
|
|
8
|
+
* `{ export }`), and `metadata.format` admits `tabler`.
|
|
9
|
+
* - An icon member gains an optional `variants` list, the subset of the set's variants it ships.
|
|
10
|
+
*
|
|
11
|
+
* Identity, so a stamp below this version means "may lack these fields" and one at it means they
|
|
12
|
+
* are understood, which is what lets the pull gate keep an older client from stripping them.
|
|
13
|
+
*
|
|
14
|
+
* Deletable once no stored config artifact is below this version.
|
|
15
|
+
*/
|
|
16
|
+
import type { SchemaMigration } from '../framework/schema-version';
|
|
17
|
+
export declare const ICON_LIBRARIES_VERSION = 20260922013625;
|
|
18
|
+
export declare const iconLibrariesMigration: SchemaMigration;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/migrations/20260922013625_icon_libraries.ts
|
|
2
|
+
const ICON_LIBRARIES_VERSION = 20260922013625;
|
|
3
|
+
const iconLibrariesMigration = {
|
|
4
|
+
version: ICON_LIBRARIES_VERSION,
|
|
5
|
+
up: (json) => json
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ICON_LIBRARIES_VERSION, iconLibrariesMigration };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { GlyphMembers } from "./glyphEntries.js";
|
|
1
2
|
import { RegistryDescriptor } from "./wrapRegistry.js";
|
|
2
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
5
|
import { ComponentRegistry, JSONUIProviderProps } from "@json-render/react";
|
|
5
6
|
import { Spec } from "@json-render/core";
|
|
6
7
|
|
|
@@ -48,6 +49,11 @@ interface UdsRendererProps {
|
|
|
48
49
|
* normalisation.
|
|
49
50
|
*/
|
|
50
51
|
registryDescriptor?: RegistryDescriptor;
|
|
52
|
+
/**
|
|
53
|
+
* The icon libraries' members, by library and name, for the descriptor's glyph props to resolve
|
|
54
|
+
* through. The emitted bundle exports them beside its registry.
|
|
55
|
+
*/
|
|
56
|
+
iconMembers?: GlyphMembers;
|
|
51
57
|
/**
|
|
52
58
|
* @deprecated Ignored here. The bundle's own renderer shell (`.uds/react-renderer.tsx`) takes
|
|
53
59
|
* this prop and routes it to the system's `motion/react`; this package carries no motion.
|
|
@@ -80,6 +86,7 @@ declare function UdsRenderer({
|
|
|
80
86
|
directives,
|
|
81
87
|
fallback,
|
|
82
88
|
registryDescriptor,
|
|
89
|
+
iconMembers,
|
|
83
90
|
children
|
|
84
91
|
}: UdsRendererProps): _$react_jsx_runtime0.JSX.Element;
|
|
85
92
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { wrapRegistry } from "./wrapRegistry.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { useMemo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { JSONUIProvider, Renderer } from "@json-render/react";
|
|
6
6
|
//#region src/renderer/UdsRenderer.tsx
|
|
7
7
|
/**
|
|
@@ -9,8 +9,12 @@ import { JSONUIProvider, Renderer } from "@json-render/react";
|
|
|
9
9
|
* a `JSONUIProvider` + the standard wrapper stack on top of the
|
|
10
10
|
* supplied registry.
|
|
11
11
|
*/
|
|
12
|
-
function UdsRenderer({ spec, loading, registry, handlers, initialState, onStateChange, store, navigate, validationFunctions, functions, directives, fallback, registryDescriptor, children }) {
|
|
13
|
-
const wrapped = useMemo(() => wrapRegistry(registry, registryDescriptor), [
|
|
12
|
+
function UdsRenderer({ spec, loading, registry, handlers, initialState, onStateChange, store, navigate, validationFunctions, functions, directives, fallback, registryDescriptor, iconMembers, children }) {
|
|
13
|
+
const wrapped = useMemo(() => wrapRegistry(registry, registryDescriptor, iconMembers), [
|
|
14
|
+
registry,
|
|
15
|
+
registryDescriptor,
|
|
16
|
+
iconMembers
|
|
17
|
+
]);
|
|
14
18
|
return /* @__PURE__ */ jsxs(JSONUIProvider, {
|
|
15
19
|
registry: wrapped,
|
|
16
20
|
handlers,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentEntry } from "./componentEntry.js";
|
|
2
|
+
import { IconLibrary } from "./icon-library.js";
|
|
3
|
+
import { GlyphRenderProps } from "./glyphRenderable.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/renderer/glyphEntries.d.ts
|
|
7
|
+
/** Library name → member name → the member as a renderable. What resolves a stored glyph ref. */
|
|
8
|
+
type GlyphMembers = ReadonlyMap<string, ReadonlyMap<string, React.ComponentType<GlyphRenderProps>>>;
|
|
9
|
+
interface GlyphEntriesResult {
|
|
10
|
+
/** One ctx-shaped registry entry per placed glyph type (`icon:<library>/<Member>`). */
|
|
11
|
+
entries: Record<string, ComponentEntry>;
|
|
12
|
+
/** Each member as the glyph itself, by library and name: what a drawer's glyph prop receives. */
|
|
13
|
+
glyphMembers: GlyphMembers;
|
|
14
|
+
/** Each member the way a placed glyph paints, through the set's drawer when the registry holds
|
|
15
|
+
* one: what a browsing surface shows for it. */
|
|
16
|
+
drawnMembers: GlyphMembers;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The registry entries an icon library contributes: every member the set ships, keyed by the type a
|
|
20
|
+
* placed glyph node carries, and the same renderables by library and name for a prop that holds a
|
|
21
|
+
* glyph ref to resolve through. `components` holds the registry's raw components by key, where a
|
|
22
|
+
* library's drawing component is looked up.
|
|
23
|
+
*/
|
|
24
|
+
declare function glyphRegistryEntries({
|
|
25
|
+
libraries,
|
|
26
|
+
components
|
|
27
|
+
}: {
|
|
28
|
+
libraries: Iterable<IconLibrary>;
|
|
29
|
+
components?: Readonly<Record<string, React.ComponentType<Record<string, unknown>> | undefined>>;
|
|
30
|
+
}): GlyphEntriesResult;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { GlyphEntriesResult, GlyphMembers, glyphRegistryEntries };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { makeComponentEntry } from "./componentEntry.js";
|
|
2
|
+
import { makeGlyphRenderable } from "./glyphRenderable.js";
|
|
3
|
+
//#region src/renderer/glyphEntries.ts
|
|
4
|
+
/**
|
|
5
|
+
* The registry entries an icon library contributes: every member the set ships, keyed by the type a
|
|
6
|
+
* placed glyph node carries, and the same renderables by library and name for a prop that holds a
|
|
7
|
+
* glyph ref to resolve through. `components` holds the registry's raw components by key, where a
|
|
8
|
+
* library's drawing component is looked up.
|
|
9
|
+
*/
|
|
10
|
+
function glyphRegistryEntries({ libraries, components = {} }) {
|
|
11
|
+
const entries = {};
|
|
12
|
+
const glyphMembers = /* @__PURE__ */ new Map();
|
|
13
|
+
const drawnMembers = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const group of libraries) {
|
|
15
|
+
const members = group.members;
|
|
16
|
+
if (!members) continue;
|
|
17
|
+
const Drawer = group.component ? components[group.component] : void 0;
|
|
18
|
+
const bySlug = /* @__PURE__ */ new Map();
|
|
19
|
+
const drawnBySlug = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const name of group.glyphNames) {
|
|
21
|
+
const member = members[name];
|
|
22
|
+
if (member === void 0) continue;
|
|
23
|
+
const drawn = makeGlyphRenderable({
|
|
24
|
+
member,
|
|
25
|
+
library: group,
|
|
26
|
+
Drawer
|
|
27
|
+
});
|
|
28
|
+
entries[group.glyphType(name)] = makeComponentEntry({
|
|
29
|
+
component: drawn,
|
|
30
|
+
name: group.glyphType(name)
|
|
31
|
+
});
|
|
32
|
+
bySlug.set(name, makeGlyphRenderable({
|
|
33
|
+
member,
|
|
34
|
+
library: group
|
|
35
|
+
}));
|
|
36
|
+
drawnBySlug.set(name, drawn);
|
|
37
|
+
}
|
|
38
|
+
glyphMembers.set(group.name, bySlug);
|
|
39
|
+
drawnMembers.set(group.name, drawnBySlug);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
entries,
|
|
43
|
+
glyphMembers,
|
|
44
|
+
drawnMembers
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { glyphRegistryEntries };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/renderer/glyphRenderable.d.ts
|
|
4
|
+
/** What a placed glyph node carries: the set's own axes. */
|
|
5
|
+
type GlyphRenderProps = {
|
|
6
|
+
variant?: string;
|
|
7
|
+
size?: string | number;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { GlyphRenderProps };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { resolveGlyph } from "./resolveGlyph.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/renderer/glyphRenderable.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A library member as a registry renderable.
|
|
6
|
+
*
|
|
7
|
+
* Through the set's drawing component when the registry has one: the member lands on the
|
|
8
|
+
* component's glyph prop and `size`/`variant` stay the component's own props, so a placed glyph
|
|
9
|
+
* paints exactly as the component would. Otherwise the member draws itself through `resolveGlyph`,
|
|
10
|
+
* which turns the set's `sizes` and `variantAs` into the props the glyph takes.
|
|
11
|
+
*/
|
|
12
|
+
function makeGlyphRenderable({ member, library, Drawer }) {
|
|
13
|
+
const Member = member;
|
|
14
|
+
const { members, sizes, variantAs, glyphProp } = library;
|
|
15
|
+
if (Drawer && glyphProp) return function DrawnGlyph(props) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Drawer, {
|
|
17
|
+
...props,
|
|
18
|
+
[glyphProp]: Member
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const facts = {
|
|
22
|
+
glyphs: members ?? {},
|
|
23
|
+
sizes,
|
|
24
|
+
variantAs
|
|
25
|
+
};
|
|
26
|
+
return function RawGlyph({ size, variant, ...props }) {
|
|
27
|
+
const { Glyph, props: glyphProps } = resolveGlyph({
|
|
28
|
+
library: facts,
|
|
29
|
+
glyph: Member,
|
|
30
|
+
size,
|
|
31
|
+
variant
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
34
|
+
...props,
|
|
35
|
+
...glyphProps
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { makeGlyphRenderable };
|