@yahoo/uds-create-config 3.0.10 → 3.2.0
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 +66 -3
- package/dist/configs/react-native-system.d.ts +44 -2
- package/dist/configs/react-native-system.js +2 -0
- package/dist/configs/system.d.ts +74 -7
- package/dist/configs/system.js +2 -0
- package/dist/entities/system/Component.d.ts +40 -2
- package/dist/entities/system/Component.js +40 -2
- package/dist/entities/system/StyleProperty.d.ts +13 -1
- package/dist/entities/system/StyleProperty.js +8 -1
- package/dist/entities/system/defineComponent.d.ts +101 -6
- package/dist/entities/system/defineComponent.js +12 -1
- package/dist/framework/Config.d.ts +1 -1
- package/dist/framework/Config.js +1 -1
- package/dist/framework/registered.d.ts +9 -1
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/utils/refs.d.ts +9 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/migrations/2.0.0/v1-artifact.d.ts +38 -4
- package/dist/migrations/20260914155048_component_create_blank_op.d.ts +13 -0
- package/dist/migrations/20260914155048_component_create_blank_op.js +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CopyPlan } from "../../entities/system/copy-plan.js";
|
|
2
|
-
import { Ref } from "../../framework/utils/refs.js";
|
|
2
|
+
import { ExtendableRef, Ref } from "../../framework/utils/refs.js";
|
|
3
|
+
import { CreateInput } from "../../framework/utils/field-schema.js";
|
|
3
4
|
import { DerivedEntityClass } from "../../framework/defineDerivedEntity.js";
|
|
4
5
|
import { SubEntityClass } from "../../framework/defineSubEntity.js";
|
|
5
6
|
import { ComponentContractOf, PathOf } from "../../framework/registered.js";
|
|
@@ -471,7 +472,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
471
472
|
}, _$zod_v4_core0.$strip>>;
|
|
472
473
|
export: _$zod.ZodOptional<_$zod.ZodString>;
|
|
473
474
|
}, _$zod_v4_core0.$strict>;
|
|
474
|
-
readonly description: "Create a component at a new qualified `path`. When its complete body is known, include all layers, anatomy, props, defaults, and styles in this one operation. `data.layers` maps each stable layer name to the element it renders and must include `root` — a tag for a primitive (`{ \"layers\": { \"root\": \"div\" } }`), and for anything built on top, a ref to a primitive (`{ \"root\": { \"__ref\": \"component:Box\" }, \"label\": { \"__ref\": \"component:Text\" } }`), which is what lets the layer take that primitive's style props. A primitive exposes style props as `{ \"type\": \"styleProperty\", \"value\": { \"__ref\": \"style-property:bg\" } }` and declares `children: { \"type\": \"slot\", \"text\": true }` when it holds content — without the slot, nothing nested inside it renders. A composed component exposes a layer's props at its own top level through `forwards`, keyed by layer: `{ \"forwards\": { \"root\": \"*\" } }` passes every prop the root's element takes (so `<Button width=\"full\">` reaches the root's `width`), and a list of member refs (`[{ \"__ref\": \"component:Box#props/width\" }]`, each naming the component that declares the prop) passes only those. A prop a layer already exposes is forwarded, never redeclared in `props`; a `props` entry of `{ \"type\": \"forward\" }` is the reverse route, one of this component's props into a layer's. `anatomy` is the tree the build would read off a render: each node renders a layer (`{ \"__ref\": \"layer:<name>\" }`), an intrinsic tag, or `Slot` (`{ \"element\": \"Slot\", \"props\": { \"name\": \"children\" } }`, where a slot prop's content lands — but a declared slot fills `root` by default, so a primitive still declares its `children` slot prop yet needs no `Slot` node or `children` entry for it, and a `Slot` node is only for landing that content in a nested layer); `children` lists sibling node keys from the `root` node, never a prop name; `text` is a fixed string; `visible` is a condition on a prop (`{ \"$state\": \"<prop>\" }`, or with `eq`); content shown in a nested layer is a route, `children: { \"type\": \"forward\", \"target\": \"label/children\" }`. `$state` appears only in `visible` and in an `element` a prop chooses, never as a prop value. A glyph is a node of its own, `{ \"element\": { \"__ref\": \"icon:<library>/<Name>\" } }`, listed in the `children` of the layer node that holds it, never a prop value. Text a prop supplies to a text layer is never a node either: declare the prop `{ \"type\": \"forward\", \"target\": \"<layer>/children\" }` and the layer shows it; a `Slot` node goes only under a layer that takes nodes. A style rule is `\"styles\": { \"*\": { \"when\": null, \"layers\": { \"root\": { \"bg\": \"surface\" } } } }`, keyed by a name, with each layer's bag under `layers`. A composed component carries its own styles: give it an unconditional (`\"*\"`) rule that lays out and surfaces it through the system's style properties — spacing, alignment and gap on the container, a background and color where it has one — rather than leaning on the bare primitives, which paint flat. Style a layer only with the style props the primitive it renders exposes, set to the values those props accept: `component/get` on the primitive lists both, so read it and choose from that rather than reaching for a CSS name or value the system has no style property for. Set `previewProps` (or `defaultProps`) so the component previews with content; a root that takes children renders empty otherwise. A style rule's layer bag is keyed by style-prop name (`fontWeight`, `color`), never by CSS property name, and each value is one of that prop's values.";
|
|
475
|
+
readonly description: "Create a component at a new qualified `path`. For a component with nothing in it yet, one to design on the canvas before it has props or variants, use `create-blank` with only a `path` instead of authoring a minimal body here. When its complete body is known, include all layers, anatomy, props, defaults, and styles in this one operation. `data.layers` maps each stable layer name to the element it renders and must include `root` — a tag for a primitive (`{ \"layers\": { \"root\": \"div\" } }`), and for anything built on top, a ref to a primitive (`{ \"root\": { \"__ref\": \"component:Box\" }, \"label\": { \"__ref\": \"component:Text\" } }`), which is what lets the layer take that primitive's style props. A primitive exposes style props as `{ \"type\": \"styleProperty\", \"value\": { \"__ref\": \"style-property:bg\" } }` and declares `children: { \"type\": \"slot\", \"text\": true }` when it holds content — without the slot, nothing nested inside it renders. A composed component exposes a layer's props at its own top level through `forwards`, keyed by layer: `{ \"forwards\": { \"root\": \"*\" } }` passes every prop the root's element takes (so `<Button width=\"full\">` reaches the root's `width`), and a list of member refs (`[{ \"__ref\": \"component:Box#props/width\" }]`, each naming the component that declares the prop) passes only those. A prop a layer already exposes is forwarded, never redeclared in `props`; a `props` entry of `{ \"type\": \"forward\" }` is the reverse route, one of this component's props into a layer's. `anatomy` is the tree the build would read off a render: each node renders a layer (`{ \"__ref\": \"layer:<name>\" }`), an intrinsic tag, or `Slot` (`{ \"element\": \"Slot\", \"props\": { \"name\": \"children\" } }`, where a slot prop's content lands — but a declared slot fills `root` by default, so a primitive still declares its `children` slot prop yet needs no `Slot` node or `children` entry for it, and a `Slot` node is only for landing that content in a nested layer); `children` lists sibling node keys from the `root` node, never a prop name; `text` is a fixed string; `visible` is a condition on a prop (`{ \"$state\": \"<prop>\" }`, or with `eq`); content shown in a nested layer is a route, `children: { \"type\": \"forward\", \"target\": \"label/children\" }`. `$state` appears only in `visible` and in an `element` a prop chooses, never as a prop value. A glyph is a node of its own, `{ \"element\": { \"__ref\": \"icon:<library>/<Name>\" } }`, listed in the `children` of the layer node that holds it, never a prop value. Text a prop supplies to a text layer is never a node either: declare the prop `{ \"type\": \"forward\", \"target\": \"<layer>/children\" }` and the layer shows it; a `Slot` node goes only under a layer that takes nodes. A style rule is `\"styles\": { \"*\": { \"when\": null, \"layers\": { \"root\": { \"bg\": \"surface\" } } } }`, keyed by a name, with each layer's bag under `layers`. A composed component carries its own styles: give it an unconditional (`\"*\"`) rule that lays out and surfaces it through the system's style properties — spacing, alignment and gap on the container, a background and color where it has one — rather than leaning on the bare primitives, which paint flat. Style a layer only with the style props the primitive it renders exposes, set to the values those props accept: `component/get` on the primitive lists both, so read it and choose from that rather than reaching for a CSS name or value the system has no style property for. Set `previewProps` (or `defaultProps`) so the component previews with content; a root that takes children renders empty otherwise. A style rule's layer bag is keyed by style-prop name (`fontWeight`, `color`), never by CSS property name, and each value is one of that prop's values.";
|
|
475
476
|
readonly example: ({
|
|
476
477
|
config
|
|
477
478
|
}: {
|
|
@@ -483,6 +484,27 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
483
484
|
data: Record<string, unknown>;
|
|
484
485
|
};
|
|
485
486
|
};
|
|
487
|
+
readonly 'create-blank': {
|
|
488
|
+
readonly input: _$zod.ZodObject<{
|
|
489
|
+
path: _$zod.ZodType<string, string | undefined, _$zod_v4_core0.$ZodTypeInternals<string, string | undefined>>;
|
|
490
|
+
}, _$zod_v4_core0.$strip>;
|
|
491
|
+
readonly readOnly: false;
|
|
492
|
+
readonly label: "Create blank";
|
|
493
|
+
readonly description: "Create an empty component at a new qualified `path`, to design on the canvas first: one `div` root layer and the node that renders it, with no props, no variants, no slot, no styles and no preview content. This is exactly what Studio's \"+\" creates. Takes only `path`. Use it for \"a new component\", \"a blank component\" or \"start a component from nothing\"; `create` is for a component whose body is already known.";
|
|
494
|
+
readonly scope: "item";
|
|
495
|
+
readonly creates: true;
|
|
496
|
+
readonly title: (entity: string) => string;
|
|
497
|
+
readonly example: ({
|
|
498
|
+
config
|
|
499
|
+
}: {
|
|
500
|
+
config: Config;
|
|
501
|
+
kind: string;
|
|
502
|
+
path: string;
|
|
503
|
+
}) => {
|
|
504
|
+
path: string;
|
|
505
|
+
};
|
|
506
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Config;
|
|
507
|
+
};
|
|
486
508
|
readonly 'sub-create/anatomy': {
|
|
487
509
|
readonly description: "Add one anatomy node (`key` + `data`) to a component. In a batch, create child nodes before a parent whose `children` or `slots` names them; each referenced node must already exist when this operation runs.";
|
|
488
510
|
};
|
|
@@ -1012,7 +1034,7 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1012
1034
|
__ref: _$zod.ZodString;
|
|
1013
1035
|
}, _$zod_v4_core0.$strip>>;
|
|
1014
1036
|
}, _$zod_v4_core0.$strip>, "modifier", Record<never, never>, Record<never, never>, false>;
|
|
1015
|
-
styleProps: EntityClass<_$zod.ZodObject<{
|
|
1037
|
+
styleProps: Omit<EntityClass<_$zod.ZodObject<{
|
|
1016
1038
|
properties: _$zod.ZodArray<_$zod.ZodString>;
|
|
1017
1039
|
values: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodType<StylePropValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StylePropValue, unknown>>>>;
|
|
1018
1040
|
responsive: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
@@ -1038,7 +1060,19 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
|
|
|
1038
1060
|
data: Record<string, unknown>;
|
|
1039
1061
|
} | undefined;
|
|
1040
1062
|
};
|
|
1041
|
-
}, Record<never, never>, false
|
|
1063
|
+
}, Record<never, never>, false>, "ref"> & {
|
|
1064
|
+
ref<const Path extends PathOf<"style-property">>(path: Path): ReturnType<(path: string) => ExtendableRef<Partial<CreateInput<_$zod.ZodObject<{
|
|
1065
|
+
properties: _$zod.ZodArray<_$zod.ZodString>;
|
|
1066
|
+
values: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodType<StylePropValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StylePropValue, unknown>>>>;
|
|
1067
|
+
responsive: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
1068
|
+
classPrefix: _$zod.ZodOptional<_$zod.ZodString>;
|
|
1069
|
+
arbitrary: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
1070
|
+
negates: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
1071
|
+
opacityOf: _$zod.ZodOptional<_$zod.ZodLazy<_$zod.ZodType<Ref, unknown, _$zod_v4_core0.$ZodTypeInternals<Ref, unknown>>>>;
|
|
1072
|
+
}, _$zod_v4_core0.$strip>>>>> & {
|
|
1073
|
+
readonly __ref: `style-property:${Path}`;
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1042
1076
|
composites: EntityClass<_$zod.ZodObject<{
|
|
1043
1077
|
styles: SubEntityClass<_$zod.ZodType<StyleValue, unknown, _$zod_v4_core0.$ZodTypeInternals<StyleValue, unknown>>>;
|
|
1044
1078
|
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "composite", Record<never, never>, Record<never, never>, false>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An additive fence: the `component` kind gains the op `create-blank`, so the operation catalogue's
|
|
3
|
+
* fingerprint moves. No stored byte changes — the op is stored as the ordinary `component/create`
|
|
4
|
+
* patch it delegates to.
|
|
5
|
+
*
|
|
6
|
+
* Identity, so a stamp below this version means "does not know `create-blank`" and one at it means
|
|
7
|
+
* the catalogue is understood.
|
|
8
|
+
*
|
|
9
|
+
* Deletable once no stored config artifact is below this version.
|
|
10
|
+
*/
|
|
11
|
+
import type { SchemaMigration } from '../framework/schema-version';
|
|
12
|
+
export declare const COMPONENT_CREATE_BLANK_OP_VERSION = 20260914155048;
|
|
13
|
+
export declare const componentCreateBlankOpMigration: SchemaMigration;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/migrations/20260914155048_component_create_blank_op.ts
|
|
2
|
+
const COMPONENT_CREATE_BLANK_OP_VERSION = 20260914155048;
|
|
3
|
+
const componentCreateBlankOpMigration = {
|
|
4
|
+
version: COMPONENT_CREATE_BLANK_OP_VERSION,
|
|
5
|
+
up: (json) => json
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { COMPONENT_CREATE_BLANK_OP_VERSION, componentCreateBlankOpMigration };
|