@yahoo/uds-create-config 4.36.0 → 4.36.1
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 +68 -5167
- package/dist/configs/CanvasConfig.js +0 -76
- package/dist/configs/documentation.d.ts +11 -251
- package/dist/configs/documentation.js +0 -1
- package/dist/configs/react-native-system.d.ts +39 -4239
- package/dist/configs/react-native-system.js +0 -11
- package/dist/configs/system.d.ts +44 -4209
- package/dist/configs/system.js +0 -9
- package/dist/entities/documentation/Documentation.d.ts +5 -18
- package/dist/entities/documentation/Documentation.js +0 -1
- package/dist/entities/native/NativeModifier.d.ts +6 -3
- package/dist/entities/native/NativeSettings.d.ts +6 -3
- package/dist/entities/native/NativeSettings.js +0 -1
- package/dist/entities/native/NativeStyleProperty.d.ts +1 -20
- package/dist/entities/native/NativeToken.d.ts +2 -6
- package/dist/entities/system/CanvasRole.d.ts +6 -7
- package/dist/entities/system/Component.d.ts +86 -1588
- package/dist/entities/system/Component.js +0 -9
- package/dist/entities/system/Composite.d.ts +8 -6
- package/dist/entities/system/Composite.js +0 -1
- package/dist/entities/system/Device.d.ts +6 -3
- package/dist/entities/system/Device.js +0 -6
- package/dist/entities/system/File.d.ts +43 -8
- package/dist/entities/system/File.js +0 -51
- package/dist/entities/system/Font.d.ts +10 -11
- package/dist/entities/system/Font.js +0 -21
- package/dist/entities/system/GlobalStyle.d.ts +6 -3
- package/dist/entities/system/Guidance.d.ts +6 -3
- package/dist/entities/system/GuidanceStyle.d.ts +6 -3
- package/dist/entities/system/Icon.d.ts +8 -8
- package/dist/entities/system/Icon.js +0 -16
- package/dist/entities/system/LinkedSystem.d.ts +5 -155
- package/dist/entities/system/Modifier.d.ts +8 -8
- package/dist/entities/system/Motion.d.ts +6 -3
- package/dist/entities/system/Operation.d.ts +5 -2
- package/dist/entities/system/Package.d.ts +24 -4
- package/dist/entities/system/Package.js +0 -46
- package/dist/entities/system/Settings.d.ts +18 -7
- package/dist/entities/system/Settings.js +0 -6
- package/dist/entities/system/StyleProperty.d.ts +14 -27
- package/dist/entities/system/StyleProperty.js +0 -6
- package/dist/entities/system/Token.d.ts +12 -9
- package/dist/entities/system/Tool.d.ts +7 -90
- package/dist/entities/system/composed-values.d.ts +1 -1
- package/dist/entities/system/copy-plan.d.ts +2 -2
- package/dist/entities/system/copy-plan.js +31 -8
- package/dist/entities/system/defineComponent.d.ts +1 -1
- package/dist/entities/system/icon-metadata.d.ts +2 -6
- package/dist/entities/system/link-plan.d.ts +2 -0
- package/dist/entities/system/link-plan.js +1 -0
- package/dist/entities/system/style-bag.d.ts +27 -1
- package/dist/entities/system/style-bag.js +0 -10
- package/dist/framework/Config.d.ts +18 -2
- package/dist/framework/Config.js +70 -15
- package/dist/framework/class-names.js +1 -0
- package/dist/framework/defineConfig.d.ts +2 -2
- package/dist/framework/defineEntity.d.ts +27 -7
- package/dist/framework/named.d.ts +9 -0
- package/dist/framework/plan.d.ts +3 -0
- package/dist/framework/plan.js +4 -1
- package/dist/framework/utils/group.d.ts +15 -5
- package/dist/index.d.ts +46 -45
- package/dist/migrations/2.0.0/v1-artifact.d.ts +38 -2109
- package/dist/renderer/wrappers/html-aliases.js +1 -0
- package/dist/spec/cell.d.ts +1 -1
- package/dist/spec/preview-content.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -61,11 +61,7 @@ declare const TokenEntity: EntityClass<z.ZodObject<{
|
|
|
61
61
|
}, z.core.$strip>>>;
|
|
62
62
|
}, z.core.$strip>, z.ZodObject<{
|
|
63
63
|
cssPrefix: z.ZodOptional<z.ZodString>;
|
|
64
|
-
}, z.core.$strip>, "token", {
|
|
65
|
-
readonly create: {
|
|
66
|
-
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.`;
|
|
67
|
-
};
|
|
68
|
-
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
64
|
+
}, z.core.$strip>, "token", {}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
69
65
|
/** A token ref as an authoring file holds it: the marker, `extend`, and the value readers. */
|
|
70
66
|
type TokenReference<Path extends string> = KindRef<typeof tokenFields, 'token', Path> & TokenReaders<Path>;
|
|
71
67
|
/**
|
|
@@ -73,9 +69,16 @@ type TokenReference<Path extends string> = KindRef<typeof tokenFields, 'token',
|
|
|
73
69
|
* registered group — `` `spacing/${gutter}` `` — whose readers stay open since no one token is named.
|
|
74
70
|
*/
|
|
75
71
|
type TokenRefPath = PathOf<'token'> | `${PathOf<'token'>}/${string}`;
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
/**
|
|
73
|
+
* `Path` when `Token.ref` should take it, else `never`. A completion under a registered path is only
|
|
74
|
+
* open when it is known at runtime alone: `` `spacing/${gutter}` `` passes, and a literal
|
|
75
|
+
* `'color/nope'` doesn't, since a literal names one token and that token has to be registered.
|
|
76
|
+
*/
|
|
77
|
+
type CheckedTokenRefPath<Path extends string> = Path extends PathOf<'token'> ? Path : Path extends `${PathOf<'token'>}/${infer Rest}` ? Record<never, never> extends Record<Rest, unknown> ? Path : never : never;
|
|
78
|
+
declare function tokenRef<const Path extends TokenRefPath>(path: Path & CheckedTokenRefPath<Path>): TokenReference<Path>;
|
|
79
|
+
declare const Token: TokenClass;
|
|
80
|
+
interface TokenClass extends Omit<typeof TokenEntity, 'ref'> {
|
|
78
81
|
readonly ref: typeof tokenRef;
|
|
79
|
-
}
|
|
82
|
+
}
|
|
80
83
|
//#endregion
|
|
81
|
-
export { OverrideCondition, Token, TokenBody, TokenRefPath, TokenReference, defineOverride, overrideCondition, overrideKey, overrideKeyModifiers, overrideModifiers };
|
|
84
|
+
export { CheckedTokenRefPath, OverrideCondition, Token, TokenBody, TokenClass, TokenRefPath, TokenReference, defineOverride, overrideCondition, overrideKey, overrideKeyModifiers, overrideModifiers };
|
|
@@ -1,98 +1,13 @@
|
|
|
1
1
|
import { ComputedInput } from "../../framework/registry.js";
|
|
2
2
|
import { DerivedEntityClass } from "../../framework/defineDerivedEntity.js";
|
|
3
|
+
import { Named } from "../../framework/named.js";
|
|
3
4
|
import { Config } from "../../framework/Config.js";
|
|
5
|
+
import { OperationClass } from "./Operation.js";
|
|
4
6
|
import { z } from "zod";
|
|
5
7
|
|
|
6
8
|
//#region src/entities/system/Tool.d.ts
|
|
7
|
-
declare const
|
|
8
|
-
operation:
|
|
9
|
-
kind: z.ZodString;
|
|
10
|
-
verb: z.ZodString;
|
|
11
|
-
readOnly: z.ZodBoolean;
|
|
12
|
-
label: z.ZodString;
|
|
13
|
-
description: z.ZodString;
|
|
14
|
-
scope: z.ZodString;
|
|
15
|
-
creates: z.ZodBoolean;
|
|
16
|
-
approval: z.ZodOptional<z.ZodEnum<{
|
|
17
|
-
destructive: "destructive";
|
|
18
|
-
"reference-change": "reference-change";
|
|
19
|
-
}>>;
|
|
20
|
-
}, z.core.$strip>, {
|
|
21
|
-
inputSchema: ({
|
|
22
|
-
member: op,
|
|
23
|
-
config
|
|
24
|
-
}: Omit<ComputedInput, "member"> & {
|
|
25
|
-
member: {
|
|
26
|
-
kind: string;
|
|
27
|
-
verb: string;
|
|
28
|
-
readOnly: boolean;
|
|
29
|
-
label: string;
|
|
30
|
-
description: string;
|
|
31
|
-
scope: string;
|
|
32
|
-
creates: boolean;
|
|
33
|
-
approval?: "destructive" | "reference-change" | undefined;
|
|
34
|
-
};
|
|
35
|
-
}) => z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | undefined;
|
|
36
|
-
execute: ({
|
|
37
|
-
member: op,
|
|
38
|
-
config: declaring
|
|
39
|
-
}: Omit<ComputedInput, "member"> & {
|
|
40
|
-
member: {
|
|
41
|
-
kind: string;
|
|
42
|
-
verb: string;
|
|
43
|
-
readOnly: boolean;
|
|
44
|
-
label: string;
|
|
45
|
-
description: string;
|
|
46
|
-
scope: string;
|
|
47
|
-
creates: boolean;
|
|
48
|
-
approval?: "destructive" | "reference-change" | undefined;
|
|
49
|
-
};
|
|
50
|
-
}) => ((input: Record<string, unknown>, config: Config) => unknown) | undefined;
|
|
51
|
-
field: ({
|
|
52
|
-
member: op
|
|
53
|
-
}: Omit<ComputedInput, "member"> & {
|
|
54
|
-
member: {
|
|
55
|
-
kind: string;
|
|
56
|
-
verb: string;
|
|
57
|
-
readOnly: boolean;
|
|
58
|
-
label: string;
|
|
59
|
-
description: string;
|
|
60
|
-
scope: string;
|
|
61
|
-
creates: boolean;
|
|
62
|
-
approval?: "destructive" | "reference-change" | undefined;
|
|
63
|
-
};
|
|
64
|
-
}) => string | undefined;
|
|
65
|
-
title: ({
|
|
66
|
-
member: op,
|
|
67
|
-
config
|
|
68
|
-
}: Omit<ComputedInput, "member"> & {
|
|
69
|
-
member: {
|
|
70
|
-
kind: string;
|
|
71
|
-
verb: string;
|
|
72
|
-
readOnly: boolean;
|
|
73
|
-
label: string;
|
|
74
|
-
description: string;
|
|
75
|
-
scope: string;
|
|
76
|
-
creates: boolean;
|
|
77
|
-
approval?: "destructive" | "reference-change" | undefined;
|
|
78
|
-
};
|
|
79
|
-
}) => ((entity: string) => string) | undefined;
|
|
80
|
-
example: ({
|
|
81
|
-
member: op,
|
|
82
|
-
config
|
|
83
|
-
}: Omit<ComputedInput, "member"> & {
|
|
84
|
-
member: {
|
|
85
|
-
kind: string;
|
|
86
|
-
verb: string;
|
|
87
|
-
readOnly: boolean;
|
|
88
|
-
label: string;
|
|
89
|
-
description: string;
|
|
90
|
-
scope: string;
|
|
91
|
-
creates: boolean;
|
|
92
|
-
approval?: "destructive" | "reference-change" | undefined;
|
|
93
|
-
};
|
|
94
|
-
}) => Record<string, unknown> | undefined;
|
|
95
|
-
}>;
|
|
9
|
+
declare const ToolDefinition: DerivedEntityClass<z.ZodObject<{
|
|
10
|
+
operation: OperationClass;
|
|
96
11
|
name: z.ZodString;
|
|
97
12
|
description: z.ZodString;
|
|
98
13
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -130,5 +45,7 @@ declare const Tool: DerivedEntityClass<z.ZodObject<{
|
|
|
130
45
|
shortLabel: (input: ComputedInput) => string | undefined; /** Bound to a real entity in this config — built by the op from its own input shape. */
|
|
131
46
|
example: (input: ComputedInput) => Record<string, unknown> | undefined;
|
|
132
47
|
}>;
|
|
48
|
+
interface ToolClass extends Named<typeof ToolDefinition> {}
|
|
49
|
+
declare const Tool: ToolClass;
|
|
133
50
|
//#endregion
|
|
134
|
-
export { Tool };
|
|
51
|
+
export { Tool, ToolClass };
|
|
@@ -42,8 +42,8 @@ interface CopyPlanRow {
|
|
|
42
42
|
/** Where it lands here, which is also the path the source spells. */
|
|
43
43
|
readonly path: string;
|
|
44
44
|
/**
|
|
45
|
-
* `create` for a path nothing of yours holds
|
|
46
|
-
*
|
|
45
|
+
* `create` for a path nothing of yours holds; `replace` for a pointer at the path, authored or minted
|
|
46
|
+
* by the link, which becomes the literal it stood for; `overwrite` for a row of
|
|
47
47
|
* yours, or one held through another pin, that the call asked to write over (`onConflict: 'replace'`).
|
|
48
48
|
*/
|
|
49
49
|
readonly status: 'create' | 'replace' | 'overwrite';
|
|
@@ -98,6 +98,7 @@ function planCopy({ config, input }) {
|
|
|
98
98
|
const reused = [];
|
|
99
99
|
/** Every `kind:path` `take` has answered, whichever way, so the walk below visits each once. */
|
|
100
100
|
const seen = /* @__PURE__ */ new Set();
|
|
101
|
+
const declared = declarationOf(config, slug);
|
|
101
102
|
const folder = (kind, path) => {
|
|
102
103
|
if (!folders.some((f) => f.kind === kind && f.path === path)) folders.push({
|
|
103
104
|
kind,
|
|
@@ -110,7 +111,7 @@ function planCopy({ config, input }) {
|
|
|
110
111
|
* about this source's values and neither is one of them. `replace` writes theirs over a row of
|
|
111
112
|
* yours, and over a row held through another pin when the call named it; a row reached only through
|
|
112
113
|
* a ref stays that pin's, since the person pointed at what named it. A pointer through this pin is
|
|
113
|
-
* replaced by the literal it stood for.
|
|
114
|
+
* replaced by the literal it stood for, and a row its declaration minted is reused unless named.
|
|
114
115
|
*/
|
|
115
116
|
const take = ({ kind, theirs, at, named }) => {
|
|
116
117
|
const key = `${kind}:${at}`;
|
|
@@ -151,13 +152,26 @@ function planCopy({ config, input }) {
|
|
|
151
152
|
});
|
|
152
153
|
if (!fit.ok) return fit;
|
|
153
154
|
const stored = held ? config.storedBody(kind, at) : void 0;
|
|
155
|
+
const minted = stored !== void 0 && isMintedRow(stored);
|
|
156
|
+
if (!named && minted && covers({
|
|
157
|
+
declared,
|
|
158
|
+
accessor: config.accessorOf(kind) ?? kind,
|
|
159
|
+
path: at
|
|
160
|
+
})) {
|
|
161
|
+
reused.push({
|
|
162
|
+
kind,
|
|
163
|
+
path: at
|
|
164
|
+
});
|
|
165
|
+
return { ok: true };
|
|
166
|
+
}
|
|
154
167
|
const extend = stored ? stored.extend : void 0;
|
|
155
168
|
taking.push({
|
|
156
169
|
kind,
|
|
157
170
|
theirs,
|
|
158
171
|
at,
|
|
159
172
|
named,
|
|
160
|
-
...stored ? { extend: extend ?? {} } : {}
|
|
173
|
+
...stored ? { extend: extend ?? {} } : {},
|
|
174
|
+
...minted ? { minted } : {}
|
|
161
175
|
});
|
|
162
176
|
return { ok: true };
|
|
163
177
|
};
|
|
@@ -244,9 +258,8 @@ function planCopy({ config, input }) {
|
|
|
244
258
|
}
|
|
245
259
|
}
|
|
246
260
|
if (taking.length === 0 && wholesale) rejectData(`"${slug}" has nothing to copy.`);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const body = source.resolve(row.kind, row.theirs)?.toJSON();
|
|
261
|
+
/** Take what `body` points at by ref. */
|
|
262
|
+
const follow = (body) => {
|
|
250
263
|
for (const target of collectRefs(body)) {
|
|
251
264
|
if (sourceOf(target) !== void 0) continue;
|
|
252
265
|
const depKind = kindOf(target);
|
|
@@ -275,6 +288,17 @@ function planCopy({ config, input }) {
|
|
|
275
288
|
});
|
|
276
289
|
folder(depKind, depPath);
|
|
277
290
|
}
|
|
291
|
+
};
|
|
292
|
+
let walkedFolders = 0;
|
|
293
|
+
for (let index = 0; index < taking.length || walkedFolders < folders.length;) {
|
|
294
|
+
if (walkedFolders < folders.length) {
|
|
295
|
+
const { kind, path } = folders[walkedFolders++];
|
|
296
|
+
follow(ownMeta(source.groups(kind).find((group) => group.path === path)?.meta ?? {}));
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const row = taking[index++];
|
|
300
|
+
const body = source.resolve(row.kind, row.theirs)?.toJSON();
|
|
301
|
+
follow(body);
|
|
278
302
|
for (const named of source.entityOf(row.kind)?.nameEdges?.(body) ?? []) {
|
|
279
303
|
const depKind = kindOf(named);
|
|
280
304
|
const dep = source.resolve(depKind, pathOf(named));
|
|
@@ -358,7 +382,7 @@ function planCopy({ config, input }) {
|
|
|
358
382
|
taking,
|
|
359
383
|
source
|
|
360
384
|
});
|
|
361
|
-
for (const { kind, theirs, at, extend } of ordered) {
|
|
385
|
+
for (const { kind, theirs, at, extend, minted } of ordered) {
|
|
362
386
|
const body = config.copyOf({
|
|
363
387
|
slug,
|
|
364
388
|
kind,
|
|
@@ -371,7 +395,7 @@ function planCopy({ config, input }) {
|
|
|
371
395
|
...body,
|
|
372
396
|
copiedFrom: `${theirs}@${slug}`
|
|
373
397
|
};
|
|
374
|
-
patches.push(extend === void 0 ? {
|
|
398
|
+
patches.push(extend === void 0 || minted ? {
|
|
375
399
|
kind,
|
|
376
400
|
operation: "create",
|
|
377
401
|
path: at,
|
|
@@ -385,7 +409,6 @@ function planCopy({ config, input }) {
|
|
|
385
409
|
}
|
|
386
410
|
for (const { kind, theirs, at } of taking) respell(`${kind}:${theirs}@${slug}`, `${kind}:${at}`);
|
|
387
411
|
for (const { kind, path } of folders) respell(`${kind}:${path}@${slug}`, `${kind}:${path}`);
|
|
388
|
-
const declared = declarationOf(config, slug);
|
|
389
412
|
if (declared !== void 0) {
|
|
390
413
|
const removal = /* @__PURE__ */ new Map();
|
|
391
414
|
for (const { kind, at, named } of taking) {
|
|
@@ -777,4 +777,4 @@ interface DefineComponent {
|
|
|
777
777
|
declare function definePropsFirst<const P extends PropMap<LayerPath>>(props: P & NoInfer<{ [K in keyof P]: Exact<P[K], AuthoredProp<LayerPath>> }>): ComponentBuilder<LayerMap, P>;
|
|
778
778
|
declare const defineComponent: DefineComponent;
|
|
779
779
|
//#endregion
|
|
780
|
-
export { AsInput, AuthoredComponent, AuthoredProp, ComponentBuilder, ComponentPropsOf, GlyphComponent, GlyphValue, LayerElement, LayerMap, PhantomCallProps, PhantomReadProps, PropCondition, PropDecl, PropMap, RegisteredMembers, RenderArgs, SlotCodeForm, SlotDecl, StyleRuleInput, defineComponent };
|
|
780
|
+
export { AsInput, AuthoredComponent, AuthoredProp, ComponentBuilder, ComponentPropsOf, DefaultsOf, GlyphComponent, GlyphValue, LayerElement, LayerMap, PhantomCallProps, PhantomReadProps, PropCondition, PropDecl, PropMap, RegisteredMembers, RenderArgs, SlotCodeForm, SlotDecl, StyleRuleInput, defineComponent };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EntityClass } from "../../framework/defineEntity.js";
|
|
1
|
+
import { PackageClass } from "./Package.js";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
|
|
5
4
|
//#region src/entities/system/icon-metadata.d.ts
|
|
@@ -41,10 +40,7 @@ type IconMemberMetadata = z.infer<typeof iconMemberMetadata>;
|
|
|
41
40
|
* kind that exists; when `File`/`Url` land, `from` widens to a union — the shape stays.
|
|
42
41
|
*/
|
|
43
42
|
declare const iconMetadataDeclaration: z.ZodObject<{
|
|
44
|
-
from:
|
|
45
|
-
version: z.ZodOptional<z.ZodString>;
|
|
46
|
-
exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
|
|
47
|
-
}, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
43
|
+
from: PackageClass;
|
|
48
44
|
format: z.ZodEnum<{
|
|
49
45
|
uds: "uds";
|
|
50
46
|
phosphor: "phosphor";
|
|
@@ -79,6 +79,8 @@ interface SourceRowState {
|
|
|
79
79
|
readonly name: string;
|
|
80
80
|
/** Members this config can hold. A folder counts its leaves, an item counts one. */
|
|
81
81
|
readonly members: number;
|
|
82
|
+
/** Members held through this pin, whether linked by name or come along with another link. */
|
|
83
|
+
readonly held: number;
|
|
82
84
|
/** Every member is held through this pin. */
|
|
83
85
|
readonly linked: boolean;
|
|
84
86
|
/** Rows of this config's own a `link` would write over. */
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { SubEntityClass } from "../../framework/defineSubEntity.js";
|
|
2
|
+
import { RegisteredModifiers, RegisteredStyleProps } from "../../framework/registered.js";
|
|
3
|
+
import { Named } from "../../framework/named.js";
|
|
1
4
|
import { ComposedValue } from "./composed-values.js";
|
|
2
5
|
import { z } from "zod";
|
|
3
6
|
|
|
@@ -16,5 +19,28 @@ type StyleValue = string | number | boolean | {
|
|
|
16
19
|
} | ComposedValue | {
|
|
17
20
|
readonly [key: string]: StyleValue;
|
|
18
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* A style bag as a keyed COLLECTION — style-prop key → {@link styleValue}, with each key a member
|
|
24
|
+
* in its own right.
|
|
25
|
+
*
|
|
26
|
+
* Being a sub-entity is what makes a per-declaration edit addressable: setting `boxShadow` names
|
|
27
|
+
* `boxShadow`, rather than being an update of the whole bag that first has to read the current one
|
|
28
|
+
* to avoid erasing its siblings. It also gives the bag a rename that keeps a key's position, which
|
|
29
|
+
* matters because key order is declaration order in the emitted rule — for a shorthand/longhand
|
|
30
|
+
* pair, moving one changes what gets painted.
|
|
31
|
+
*/
|
|
32
|
+
declare const StyleDefinition: SubEntityClass<z.ZodType<StyleValue, unknown, z.core.$ZodTypeInternals<StyleValue, unknown>>>;
|
|
33
|
+
interface StyleClass extends Named<typeof StyleDefinition> {}
|
|
34
|
+
/** The style props the system registers, each taking any value a bag stores. */
|
|
35
|
+
type RegisteredStyleBag = { [K in keyof RegisteredStyleProps]?: StyleValue };
|
|
36
|
+
/**
|
|
37
|
+
* A bag as a config file writes one when nothing but style props and modifiers may key it: the style
|
|
38
|
+
* props the system registers, and a `_modifier` block of the same. Open until the build has filled
|
|
39
|
+
* `RegisteredStyleProps`, since before that no key can be told from a style prop.
|
|
40
|
+
*/
|
|
41
|
+
type AuthoredStyleBag = [keyof RegisteredStyleProps] extends [never] ? Record<string, StyleValue> : RegisteredStyleBag & { [M in keyof RegisteredModifiers]?: RegisteredStyleBag };
|
|
42
|
+
/** {@link Style} as a field whose authored input is an {@link AuthoredStyleBag}. The stored value is
|
|
43
|
+
* unchanged. */
|
|
44
|
+
type AuthoredStyleField = z.ZodType<z.output<StyleClass>, AuthoredStyleBag>;
|
|
19
45
|
//#endregion
|
|
20
|
-
export { StyleValue };
|
|
46
|
+
export { AuthoredStyleBag, AuthoredStyleField, RegisteredStyleBag, StyleClass, StyleValue };
|
|
@@ -32,16 +32,6 @@ const anatomyPropValue = z.lazy(() => z.union([
|
|
|
32
32
|
])),
|
|
33
33
|
z.record(z.string(), anatomyPropValue)
|
|
34
34
|
]));
|
|
35
|
-
/**
|
|
36
|
-
* A style bag as a keyed COLLECTION — style-prop key → {@link styleValue}, with each key a member
|
|
37
|
-
* in its own right.
|
|
38
|
-
*
|
|
39
|
-
* Being a sub-entity is what makes a per-declaration edit addressable: setting `boxShadow` names
|
|
40
|
-
* `boxShadow`, rather than being an update of the whole bag that first has to read the current one
|
|
41
|
-
* to avoid erasing its siblings. It also gives the bag a rename that keeps a key's position, which
|
|
42
|
-
* matters because key order is declaration order in the emitted rule — for a shorthand/longhand
|
|
43
|
-
* pair, moving one changes what gets painted.
|
|
44
|
-
*/
|
|
45
35
|
const Style = defineSubEntity({
|
|
46
36
|
name: "style",
|
|
47
37
|
label: "Style",
|
|
@@ -2056,9 +2056,12 @@ declare class Config {
|
|
|
2056
2056
|
*/
|
|
2057
2057
|
private computeSourceClosure;
|
|
2058
2058
|
/**
|
|
2059
|
-
* A refusal for a
|
|
2060
|
-
*
|
|
2059
|
+
* A refusal for a patch whose derive pass would retire a minted row that something authored here
|
|
2060
|
+
* still points at. A minted row has no body of its own, so once it goes the referrer dangles;
|
|
2061
2061
|
* copying what is used, or breaking the link with `keep`, is how the value stays.
|
|
2062
|
+
*
|
|
2063
|
+
* `action` names what is refused, after "Cannot": a pin patch removes the link, and any other patch
|
|
2064
|
+
* that reaches derivation — a deleted extension whose source reached the row — says what it did.
|
|
2062
2065
|
*/
|
|
2063
2066
|
private assertDerivedDropsUnreferenced;
|
|
2064
2067
|
/**
|
|
@@ -2089,6 +2092,8 @@ declare class Config {
|
|
|
2089
2092
|
* system's namespace, which this config has no `@slug` for and no claim on.
|
|
2090
2093
|
*/
|
|
2091
2094
|
withDerivedRows(): this;
|
|
2095
|
+
/** {@link withDerivedRows} for a derivation already in hand. */
|
|
2096
|
+
private withRowsOf;
|
|
2092
2097
|
/**
|
|
2093
2098
|
* The rows an edit changes, derived inside that edit's own apply.
|
|
2094
2099
|
*
|
|
@@ -2411,6 +2416,17 @@ declare class Config {
|
|
|
2411
2416
|
/** Every `kind:path` whose definition references the given entity — the reverse
|
|
2412
2417
|
* dependency graph, harvested generically from refs in each item's data. */
|
|
2413
2418
|
dependentsOf(kind: string, path: string, opts?: TraverseOptions): string[];
|
|
2419
|
+
/**
|
|
2420
|
+
* The dependents of `kind:path` that use it only through a source: rows here that point whole at a
|
|
2421
|
+
* source entity which, in that source, points at `kind:path`. A rename's cascade can't rewrite
|
|
2422
|
+
* them, since the body that names the path is the source's.
|
|
2423
|
+
*
|
|
2424
|
+
* A pointer row's body lives in its source, so the index here holds only the pointer. Each source's
|
|
2425
|
+
* own index answers what its bodies name, and a source's bare ref means the path here, so each
|
|
2426
|
+
* referrer there comes back as the rows here pointing at it: the row the link minted, or an
|
|
2427
|
+
* extension of it. A source's pins are its own, so a pin here has none of these.
|
|
2428
|
+
*/
|
|
2429
|
+
sourceDependentsOf(kind: string, path: string, opts?: TraverseOptions): string[];
|
|
2414
2430
|
/** The inverse: what `kind:path` needs in order to resolve. `{ transitive: true }` returns the
|
|
2415
2431
|
* whole closure — what a sealed/exported copy would have to carry along with it. */
|
|
2416
2432
|
dependenciesOf(kind: string, path: string, opts?: TraverseOptions): string[];
|
package/dist/framework/Config.js
CHANGED
|
@@ -564,6 +564,15 @@ function rekeyAt(node, path, from, to) {
|
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
566
|
/** Whether `ref` names a row or folder the build minted, at the item or group the snapshot holds. */
|
|
567
|
+
/** What a refused edit of several patches is called. */
|
|
568
|
+
const EDIT_ACTION = "make this edit";
|
|
569
|
+
/** What an edit does, for a refusal that begins "Cannot": `delete component:Mine` for one patch. */
|
|
570
|
+
function actionOf(patches) {
|
|
571
|
+
const list = Array.isArray(patches) ? patches : [patches];
|
|
572
|
+
const [only] = list;
|
|
573
|
+
if (list.length !== 1 || !only || !("path" in only)) return EDIT_ACTION;
|
|
574
|
+
return `${only.operation} ${only.kind}:${only.path}`;
|
|
575
|
+
}
|
|
567
576
|
function isMintedAt(snapshot, ref) {
|
|
568
577
|
const kind = kindOf(ref);
|
|
569
578
|
const path = pathOf(ref);
|
|
@@ -1218,7 +1227,7 @@ var Config = class Config {
|
|
|
1218
1227
|
deferred.reached = true;
|
|
1219
1228
|
return applied;
|
|
1220
1229
|
}
|
|
1221
|
-
return applied.derivedForEdit();
|
|
1230
|
+
return applied.derivedForEdit(actionOf(patch));
|
|
1222
1231
|
}
|
|
1223
1232
|
/**
|
|
1224
1233
|
* `run` with each kind's invariants judged once, on the config it returns, rather than after every
|
|
@@ -1245,7 +1254,8 @@ var Config = class Config {
|
|
|
1245
1254
|
deferred.open = false;
|
|
1246
1255
|
const settled = result.derive({ deferredInvariants: void 0 });
|
|
1247
1256
|
settled.assertInvariantsOf(settled.state.snapshot, deferred.kinds);
|
|
1248
|
-
|
|
1257
|
+
if (!deferred.reached) return settled;
|
|
1258
|
+
return settled.derivedForEdit(EDIT_ACTION);
|
|
1249
1259
|
} catch {
|
|
1250
1260
|
deferred.open = false;
|
|
1251
1261
|
return run(this);
|
|
@@ -1319,11 +1329,12 @@ var Config = class Config {
|
|
|
1319
1329
|
};
|
|
1320
1330
|
const landed = settled();
|
|
1321
1331
|
const edits = patches.filter((patch) => !this.entityOf(patch.kind)?.sourceIdentity);
|
|
1322
|
-
|
|
1332
|
+
if (!(edits.length > 0 && this.reachesDerivation({
|
|
1323
1333
|
patches: edits,
|
|
1324
1334
|
before: this.state.snapshot,
|
|
1325
1335
|
after: landed.state.snapshot
|
|
1326
|
-
})
|
|
1336
|
+
}))) return landed;
|
|
1337
|
+
return landed.derivedForEdit(actionOf(edits));
|
|
1327
1338
|
}
|
|
1328
1339
|
const land = (checked) => {
|
|
1329
1340
|
let config = checked ? this : this.derive({ snapshot: this.state.snapshot.drafting() });
|
|
@@ -1340,11 +1351,12 @@ var Config = class Config {
|
|
|
1340
1351
|
}
|
|
1341
1352
|
};
|
|
1342
1353
|
const config = settle().derive({ pending: [...this.state.pending, ...patches.map(stampOf)] });
|
|
1343
|
-
|
|
1354
|
+
if (!this.reachesDerivation({
|
|
1344
1355
|
patches,
|
|
1345
1356
|
before: this.state.snapshot,
|
|
1346
1357
|
after: config.state.snapshot
|
|
1347
|
-
})
|
|
1358
|
+
})) return config;
|
|
1359
|
+
return config.derivedForEdit(actionOf(patches));
|
|
1348
1360
|
}
|
|
1349
1361
|
/**
|
|
1350
1362
|
* Whether patches on kinds that name no source can change the rows a derive mints between `before`
|
|
@@ -3932,20 +3944,23 @@ var Config = class Config {
|
|
|
3932
3944
|
return [...reached].sort();
|
|
3933
3945
|
}
|
|
3934
3946
|
/**
|
|
3935
|
-
* A refusal for a
|
|
3936
|
-
*
|
|
3947
|
+
* A refusal for a patch whose derive pass would retire a minted row that something authored here
|
|
3948
|
+
* still points at. A minted row has no body of its own, so once it goes the referrer dangles;
|
|
3937
3949
|
* copying what is used, or breaking the link with `keep`, is how the value stays.
|
|
3950
|
+
*
|
|
3951
|
+
* `action` names what is refused, after "Cannot": a pin patch removes the link, and any other patch
|
|
3952
|
+
* that reaches derivation — a deleted extension whose source reached the row — says what it did.
|
|
3938
3953
|
*/
|
|
3939
|
-
assertDerivedDropsUnreferenced() {
|
|
3954
|
+
assertDerivedDropsUnreferenced({ action = "remove the link", derivation = this.rowDerivation() } = {}) {
|
|
3940
3955
|
const { snapshot } = this.state;
|
|
3941
3956
|
const stranded = [];
|
|
3942
|
-
for (const change of
|
|
3957
|
+
for (const change of derivation.changes) {
|
|
3943
3958
|
if (change.value !== void 0) continue;
|
|
3944
3959
|
const referrers = this.referrersOf(snapshot, change.kind, change.path).filter((referrer) => !isMintedAt(snapshot, referrer));
|
|
3945
3960
|
if (referrers.length > 0) stranded.push(`${change.kind}:${change.path} (used by ${referrers.join(", ")})`);
|
|
3946
3961
|
}
|
|
3947
3962
|
if (stranded.length === 0) return;
|
|
3948
|
-
reject("REFERRERS_BLOCK", `Cannot
|
|
3963
|
+
reject("REFERRERS_BLOCK", `Cannot ${action} — it would take away ${stranded.join("; ")}. Copy what is used first (\`linked-system/copy\`), or break the link keeping its values (\`linked-system/break\` with \`keep: true\`).`);
|
|
3949
3964
|
}
|
|
3950
3965
|
/**
|
|
3951
3966
|
* This config with a row for every entity it inherits — the build's output. A pin patch runs this
|
|
@@ -3976,7 +3991,11 @@ var Config = class Config {
|
|
|
3976
3991
|
*/
|
|
3977
3992
|
withDerivedRows() {
|
|
3978
3993
|
if (derivedInEdit.has(this)) return this;
|
|
3979
|
-
|
|
3994
|
+
return this.withRowsOf(this.rowDerivation());
|
|
3995
|
+
}
|
|
3996
|
+
/** {@link withDerivedRows} for a derivation already in hand. */
|
|
3997
|
+
withRowsOf(derived) {
|
|
3998
|
+
const moved = derived.changes.filter((change) => !this.holdsDerivedRow(change));
|
|
3980
3999
|
if (moved.length === 0) return this;
|
|
3981
4000
|
return this.derive({ snapshot: this.state.snapshot.withChanges(moved) });
|
|
3982
4001
|
}
|
|
@@ -3987,8 +4006,14 @@ var Config = class Config {
|
|
|
3987
4006
|
* derive passes: this one and the session's. The mark covers this instance only, and any later
|
|
3988
4007
|
* write is a new config, so each edit still gets exactly one pass, as it did from the session alone.
|
|
3989
4008
|
*/
|
|
3990
|
-
derivedForEdit() {
|
|
3991
|
-
|
|
4009
|
+
derivedForEdit(action) {
|
|
4010
|
+
if (derivedInEdit.has(this)) return this;
|
|
4011
|
+
const derivation = this.rowDerivation();
|
|
4012
|
+
this.assertDerivedDropsUnreferenced({
|
|
4013
|
+
action,
|
|
4014
|
+
derivation
|
|
4015
|
+
});
|
|
4016
|
+
const derived = this.withRowsOf(derivation);
|
|
3992
4017
|
derivedInEdit.add(derived);
|
|
3993
4018
|
return derived;
|
|
3994
4019
|
}
|
|
@@ -4819,7 +4844,37 @@ var Config = class Config {
|
|
|
4819
4844
|
/** Every `kind:path` whose definition references the given entity — the reverse
|
|
4820
4845
|
* dependency graph, harvested generically from refs in each item's data. */
|
|
4821
4846
|
dependentsOf(kind, path, opts) {
|
|
4822
|
-
|
|
4847
|
+
const own = this.referrersOf(this.state.snapshot, kind, path, opts);
|
|
4848
|
+
const drawn = this.sourceDependentsOf(kind, path, opts);
|
|
4849
|
+
return drawn.length === 0 ? own : [...own, ...drawn];
|
|
4850
|
+
}
|
|
4851
|
+
/**
|
|
4852
|
+
* The dependents of `kind:path` that use it only through a source: rows here that point whole at a
|
|
4853
|
+
* source entity which, in that source, points at `kind:path`. A rename's cascade can't rewrite
|
|
4854
|
+
* them, since the body that names the path is the source's.
|
|
4855
|
+
*
|
|
4856
|
+
* A pointer row's body lives in its source, so the index here holds only the pointer. Each source's
|
|
4857
|
+
* own index answers what its bodies name, and a source's bare ref means the path here, so each
|
|
4858
|
+
* referrer there comes back as the rows here pointing at it: the row the link minted, or an
|
|
4859
|
+
* extension of it. A source's pins are its own, so a pin here has none of these.
|
|
4860
|
+
*/
|
|
4861
|
+
sourceDependentsOf(kind, path, opts) {
|
|
4862
|
+
if (this.entityOf(kind)?.sourceIdentity !== void 0) return [];
|
|
4863
|
+
const { snapshot } = this.state;
|
|
4864
|
+
const own = new Set(this.referrersOf(snapshot, kind, path, opts));
|
|
4865
|
+
const found = /* @__PURE__ */ new Set();
|
|
4866
|
+
for (const slug of this.sourceSlugs()) {
|
|
4867
|
+
const source = this.sourceFor(slug);
|
|
4868
|
+
if (!source) continue;
|
|
4869
|
+
for (const referrer of source.dependentsOf(kind, path, opts)) {
|
|
4870
|
+
const pointer = ref(kindOf(referrer), pathOf(referrer), slug).__ref;
|
|
4871
|
+
for (const row of snapshot.refs.dependents(pointer)) {
|
|
4872
|
+
const body = snapshot.get(kindOf(row), pathOf(row))?.toJSON();
|
|
4873
|
+
if (isRef(body) && body.__ref === pointer && !own.has(row)) found.add(row);
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4876
|
+
}
|
|
4877
|
+
return [...found];
|
|
4823
4878
|
}
|
|
4824
4879
|
/** The inverse: what `kind:path` needs in order to resolve. `{ transitive: true }` returns the
|
|
4825
4880
|
* whole closure — what a sealed/exported copy would have to carry along with it. */
|
|
@@ -44,7 +44,7 @@ type ConfigKind<C> = C extends {
|
|
|
44
44
|
* elements describes no gesture anyone makes, and a caller replacing one writes the whole list.
|
|
45
45
|
*/
|
|
46
46
|
type Matched = any;
|
|
47
|
-
type PartialBodyOf<E> = E extends EntityClass<infer F extends FieldsSchema, FieldsSchema, infer _K, Matched, Matched, Matched> ? DeepPartial<CreateInput<F>> : never;
|
|
47
|
+
type PartialBodyOf<E> = E extends Omit<EntityClass<infer F extends FieldsSchema, FieldsSchema, infer _K, Matched, Matched, Matched>, 'ref'> ? DeepPartial<CreateInput<F>> : never;
|
|
48
48
|
/** Optional at every depth, stopping at refs, arrays and primitives. */
|
|
49
49
|
type DeepPartial<T> = T extends Ref | readonly unknown[] ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
50
50
|
/**
|
|
@@ -68,7 +68,7 @@ declare function kindsOf<T extends readonly {
|
|
|
68
68
|
* mean. */
|
|
69
69
|
type RecordFor<E> = E extends {
|
|
70
70
|
readonly singleton: true;
|
|
71
|
-
} ? E extends EntityClass<infer F, FieldsSchema, infer _K, Matched, Matched, true> ? Partial<z.input<F>> : never : E extends EntityClass<infer F, infer G, infer _K, Matched, Matched, Matched> ? Record<string, AuthoredEntry<F, G>> : never;
|
|
71
|
+
} ? E extends Omit<EntityClass<infer F, FieldsSchema, infer _K, Matched, Matched, true>, 'ref'> ? Partial<z.input<F>> : never : E extends Omit<EntityClass<infer F, infer G, infer _K, Matched, Matched, Matched>, 'ref'> ? Record<string, AuthoredEntry<F, G>> : never;
|
|
72
72
|
/**
|
|
73
73
|
* What a config DRAWS ON — keyed by the accessor name of the kind whose items ARE the sources, valued
|
|
74
74
|
* by a thunk yielding the config type each one resolves to.
|