@yahoo/uds-v5-wip 1.61.0 → 1.62.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/config/dist/AssetGroup.d.ts +75 -0
- package/dist/config/dist/AssetGroup.js +114 -0
- package/dist/config/dist/Component.d.ts +309 -0
- package/dist/config/dist/Component.js +897 -0
- package/dist/config/dist/ComponentGroup.d.ts +21 -0
- package/dist/config/dist/ComponentGroup.js +46 -0
- package/dist/config/dist/CompositeStyle.d.ts +28 -0
- package/dist/config/dist/CompositeStyle.js +52 -0
- package/dist/config/dist/Config.d.ts +422 -0
- package/dist/config/dist/Config.js +1426 -0
- package/dist/config/dist/Mode.d.ts +42 -0
- package/dist/config/dist/Mode.js +81 -0
- package/dist/config/dist/Modifier.d.ts +52 -0
- package/dist/config/dist/Modifier.js +97 -0
- package/dist/config/dist/MotionDef.d.ts +50 -0
- package/dist/config/dist/MotionDef.js +97 -0
- package/dist/config/dist/Props.d.ts +235 -126
- package/dist/config/dist/Provider.d.ts +21 -0
- package/dist/config/dist/Provider.js +14 -0
- package/dist/config/dist/StyleProp.d.ts +113 -0
- package/dist/config/dist/StyleProp.js +197 -0
- package/dist/config/dist/Token.d.ts +56 -0
- package/dist/config/dist/Token.js +112 -0
- package/dist/config/dist/TokenGroup.d.ts +33 -0
- package/dist/config/dist/TokenGroup.js +68 -0
- package/dist/config/dist/asset-kind.d.ts +56 -0
- package/dist/config/dist/asset-kind.js +29 -0
- package/dist/config/dist/brands.d.ts +31 -0
- package/dist/config/dist/brands.js +20 -0
- package/dist/config/dist/captureCallerPath.d.ts +49 -0
- package/dist/config/dist/captureCallerPath.js +95 -0
- package/dist/config/dist/colorExpressions.d.ts +132 -0
- package/dist/config/dist/colorExpressions.js +148 -0
- package/dist/config/dist/defineAssetGroup.d.ts +158 -0
- package/dist/config/dist/defineAssetGroup.js +263 -0
- package/dist/config/dist/defineProvider.d.ts +30 -0
- package/dist/config/dist/defineProvider.js +60 -0
- package/dist/config/dist/element-marker.d.ts +55 -0
- package/dist/config/dist/element-marker.js +113 -0
- package/dist/config/dist/entity-utils.d.ts +27 -0
- package/dist/config/dist/entity-utils.js +105 -0
- package/dist/config/dist/factories.d.ts +707 -0
- package/dist/config/dist/factories.js +393 -0
- package/dist/config/dist/foreign-component-name.js +42 -0
- package/dist/config/dist/index.d.ts +30 -21
- package/dist/config/dist/index.js +26 -14
- package/dist/config/dist/interpolate.d.ts +21 -0
- package/dist/config/dist/interpolate.js +10 -0
- package/dist/config/dist/markers.d.ts +218 -0
- package/dist/config/dist/markers.js +67 -0
- package/dist/config/dist/refs.d.ts +143 -69
- package/dist/config/dist/refs.js +95 -113
- package/dist/config/dist/token-override-rows.d.ts +67 -0
- package/dist/config/dist/token-override-rows.js +223 -0
- package/dist/config/dist/tokenValueType.js +138 -0
- package/dist/config/dist/types/css-properties.d.ts +132 -122
- package/dist/config/dist/types/css-property-keywords.d.ts +157 -0
- package/dist/config/dist/types/css-property-keywords.js +616 -0
- package/dist/config/dist/types/css-values.d.ts +18 -16
- package/dist/config/dist/types.d.ts +688 -66
- package/dist/config/dist/units.d.ts +15 -0
- package/dist/config/dist/units.js +16 -0
- package/dist/config.d.ts +31 -22
- package/dist/config.js +28 -16
- package/dist/loader/dist/loader/artifacts.js +26 -9
- package/dist/loader/dist/loader.d.ts +11 -23
- package/dist/loader/dist/loader.js +54 -99
- package/dist/loader/dist/next.js +3 -3
- package/dist/loader/dist/transform-runner.js +1 -8
- package/dist/loader/dist/unplugin.d.ts +2 -2
- package/dist/loader/dist/unplugin.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/dist/index.js +1 -0
- package/dist/utils/dist/motion-utils/resolveMotionState.d.ts +35 -0
- package/dist/utils/dist/motion-utils/resolveMotionState.js +33 -0
- package/dist/utils/dist/string-utils/componentClassName.d.ts +41 -8
- package/dist/utils/dist/string-utils/componentClassName.js +48 -11
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +3 -2
- package/package.json +3 -3
- package/dist/codegen/dist/loader/getLoaderArtifacts.js +0 -2
- package/dist/config/dist/bindRender.d.ts +0 -16
- package/dist/config/dist/bindRender.js +0 -310
- package/dist/config/dist/className.d.ts +0 -54
- package/dist/config/dist/className.js +0 -77
- package/dist/config/dist/component-config.d.ts +0 -862
- package/dist/config/dist/component-config.js +0 -163
- package/dist/config/dist/component-refs.d.ts +0 -121
- package/dist/config/dist/createConfig.d.ts +0 -456
- package/dist/config/dist/createConfig.js +0 -503
- package/dist/config/dist/createStyler.d.ts +0 -35
- package/dist/config/dist/createStyler.js +0 -93
- package/dist/config/dist/defineComponent.d.ts +0 -317
- package/dist/config/dist/defineComponent.js +0 -264
- package/dist/config/dist/defineCompositeStyle.d.ts +0 -93
- package/dist/config/dist/defineCompositeStyle.js +0 -18
- package/dist/config/dist/defineMotionConfig.d.ts +0 -152
- package/dist/config/dist/definePreview.d.ts +0 -45
- package/dist/config/dist/definePreview.js +0 -35
- package/dist/config/dist/defineStyleProp.d.ts +0 -289
- package/dist/config/dist/defineStyleProp.js +0 -61
- package/dist/config/dist/merge-utils.js +0 -51
- package/dist/config/dist/propertyAcceptedTypes.d.ts +0 -19
- package/dist/config/dist/propertyAcceptedTypes.js +0 -220
- package/dist/config/dist/resolveCompoundProps.d.ts +0 -65
- package/dist/config/dist/resolveCompoundProps.js +0 -120
- package/dist/config/dist/resolveStyleProp.d.ts +0 -157
- package/dist/config/dist/resolveStyleProp.js +0 -260
- package/dist/config/dist/runtime-registry.js +0 -37
- package/dist/config/dist/serialize.d.ts +0 -47
- package/dist/config/dist/serialize.js +0 -111
- package/dist/config/dist/sniffTokenType.d.ts +0 -7
- package/dist/config/dist/sniffTokenType.js +0 -67
- package/dist/config/dist/style-prop-runtime.d.ts +0 -75
- package/dist/config/dist/style-prop-runtime.js +0 -390
- package/dist/loader/dist/loader/internal-meta.js +0 -59
- package/dist/loader/dist/loader/lower-new-api-primitive.js +0 -252
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AssetKind } from "./asset-kind.js";
|
|
2
|
+
import { IconAssetMember, IconAssetMetadata } from "./defineAssetGroup.js";
|
|
3
|
+
import { FontAssetMember, SerializedAssetGroup } from "./types.js";
|
|
4
|
+
|
|
5
|
+
//#region ../config/dist/AssetGroup.d.ts
|
|
6
|
+
//#region src/AssetGroup.d.ts
|
|
7
|
+
declare class AssetGroup {
|
|
8
|
+
#private;
|
|
9
|
+
/** The slug — the `registerAssetGroups` record key. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly label: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly assetKind: AssetKind;
|
|
14
|
+
/** Member names — the `${assetName}` segment of each asset's id. */
|
|
15
|
+
readonly assetNames: readonly string[];
|
|
16
|
+
/** Icon class only — named size → px (picker options = keys). */
|
|
17
|
+
readonly sizes?: Readonly<Record<string, number>>;
|
|
18
|
+
/** Icon class only — group-level variant superset. */
|
|
19
|
+
readonly variants?: readonly string[];
|
|
20
|
+
/**
|
|
21
|
+
* Icon class only — the component that authors this group's members
|
|
22
|
+
* (`'Icon'`). One declaration covers both rendering and export: a placed
|
|
23
|
+
* member draws on the canvas by rendering through this component, and a
|
|
24
|
+
* placed asset node serializes to `<Icon name="Trophy" … />` and
|
|
25
|
+
* round-trips back. Absent for a component-less group, whose members
|
|
26
|
+
* render bare and export to the bare member tag.
|
|
27
|
+
*/
|
|
28
|
+
readonly component?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Live members keyed by asset name. Present when registered from
|
|
31
|
+
* code; absent on icon groups hydrated from JSON (the serialized
|
|
32
|
+
* icon form is a name list).
|
|
33
|
+
*/
|
|
34
|
+
readonly members?: Readonly<Record<string, IconAssetMember | FontAssetMember>>;
|
|
35
|
+
/** Icon class only — per-member harvested `.metadata`. Not serialized (yet). */
|
|
36
|
+
readonly memberMetadata?: Readonly<Record<string, IconAssetMetadata>>;
|
|
37
|
+
constructor(args: {
|
|
38
|
+
name: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
assetKind: AssetKind;
|
|
42
|
+
assetNames: readonly string[];
|
|
43
|
+
sizes?: Readonly<Record<string, number>>;
|
|
44
|
+
variants?: readonly string[];
|
|
45
|
+
component?: string;
|
|
46
|
+
members?: Readonly<Record<string, IconAssetMember | FontAssetMember>>;
|
|
47
|
+
memberMetadata?: Readonly<Record<string, IconAssetMetadata>>;
|
|
48
|
+
/** Live getter so the namespace resolves correctly regardless of
|
|
49
|
+
* `configure({ namespace })` / registration ordering. */
|
|
50
|
+
namespaceGetter?: () => string | undefined;
|
|
51
|
+
});
|
|
52
|
+
/** The owning system's registry namespace at read time. */
|
|
53
|
+
get namespace(): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Per-asset identity — `${namespace}:asset:${slug}/${assetName}`
|
|
56
|
+
* (`uds:asset:icons/Trophy`). Mirrors `Component.registryKey`: an
|
|
57
|
+
* un-namespaced config produces the bare `asset:${slug}/${name}`
|
|
58
|
+
* form. This string is the spec `type` and the render-registry key;
|
|
59
|
+
* it must NEVER route through `Config.getComponent` (which splits on
|
|
60
|
+
* the first `:` and would silently miss) — resolution is
|
|
61
|
+
* registry-key lookup only.
|
|
62
|
+
*/
|
|
63
|
+
assetType(assetName: string): string;
|
|
64
|
+
toJSON(): SerializedAssetGroup & {
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Rebuild from the wire format. Icon groups hydrate without live
|
|
69
|
+
* members (names only); font groups hydrate with their full records
|
|
70
|
+
* — they are the serialized form.
|
|
71
|
+
*/
|
|
72
|
+
static fromJSON(name: string, json: SerializedAssetGroup, namespaceGetter?: () => string | undefined): AssetGroup;
|
|
73
|
+
} //#endregion
|
|
74
|
+
//#endregion
|
|
75
|
+
export { AssetGroup };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { compact } from "./entity-utils.js";
|
|
2
|
+
//#region ../config/dist/AssetGroup.js
|
|
3
|
+
var AssetGroup = class AssetGroup {
|
|
4
|
+
/** The slug — the `registerAssetGroups` record key. */
|
|
5
|
+
name;
|
|
6
|
+
label;
|
|
7
|
+
description;
|
|
8
|
+
assetKind;
|
|
9
|
+
/** Member names — the `${assetName}` segment of each asset's id. */
|
|
10
|
+
assetNames;
|
|
11
|
+
/** Icon class only — named size → px (picker options = keys). */
|
|
12
|
+
sizes;
|
|
13
|
+
/** Icon class only — group-level variant superset. */
|
|
14
|
+
variants;
|
|
15
|
+
/**
|
|
16
|
+
* Icon class only — the component that authors this group's members
|
|
17
|
+
* (`'Icon'`). One declaration covers both rendering and export: a placed
|
|
18
|
+
* member draws on the canvas by rendering through this component, and a
|
|
19
|
+
* placed asset node serializes to `<Icon name="Trophy" … />` and
|
|
20
|
+
* round-trips back. Absent for a component-less group, whose members
|
|
21
|
+
* render bare and export to the bare member tag.
|
|
22
|
+
*/
|
|
23
|
+
component;
|
|
24
|
+
/**
|
|
25
|
+
* Live members keyed by asset name. Present when registered from
|
|
26
|
+
* code; absent on icon groups hydrated from JSON (the serialized
|
|
27
|
+
* icon form is a name list).
|
|
28
|
+
*/
|
|
29
|
+
members;
|
|
30
|
+
/** Icon class only — per-member harvested `.metadata`. Not serialized (yet). */
|
|
31
|
+
memberMetadata;
|
|
32
|
+
#namespaceGetter;
|
|
33
|
+
constructor(args) {
|
|
34
|
+
this.name = args.name;
|
|
35
|
+
this.label = args.label;
|
|
36
|
+
this.description = args.description;
|
|
37
|
+
this.assetKind = args.assetKind;
|
|
38
|
+
this.assetNames = args.assetNames;
|
|
39
|
+
this.sizes = args.sizes;
|
|
40
|
+
this.variants = args.variants;
|
|
41
|
+
this.component = args.component;
|
|
42
|
+
this.members = args.members;
|
|
43
|
+
this.memberMetadata = args.memberMetadata;
|
|
44
|
+
this.#namespaceGetter = args.namespaceGetter;
|
|
45
|
+
}
|
|
46
|
+
/** The owning system's registry namespace at read time. */
|
|
47
|
+
get namespace() {
|
|
48
|
+
return this.#namespaceGetter?.();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Per-asset identity — `${namespace}:asset:${slug}/${assetName}`
|
|
52
|
+
* (`uds:asset:icons/Trophy`). Mirrors `Component.registryKey`: an
|
|
53
|
+
* un-namespaced config produces the bare `asset:${slug}/${name}`
|
|
54
|
+
* form. This string is the spec `type` and the render-registry key;
|
|
55
|
+
* it must NEVER route through `Config.getComponent` (which splits on
|
|
56
|
+
* the first `:` and would silently miss) — resolution is
|
|
57
|
+
* registry-key lookup only.
|
|
58
|
+
*/
|
|
59
|
+
assetType(assetName) {
|
|
60
|
+
const bare = `asset:${this.name}/${assetName}`;
|
|
61
|
+
const namespace = this.namespace;
|
|
62
|
+
return namespace === void 0 ? bare : `${namespace}:${bare}`;
|
|
63
|
+
}
|
|
64
|
+
toJSON() {
|
|
65
|
+
if (this.assetKind === "font") return {
|
|
66
|
+
name: this.name,
|
|
67
|
+
assetKind: "font",
|
|
68
|
+
label: this.label,
|
|
69
|
+
...compact({ description: this.description }),
|
|
70
|
+
members: this.members ?? {}
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
name: this.name,
|
|
74
|
+
assetKind: "icon",
|
|
75
|
+
label: this.label,
|
|
76
|
+
...compact({ description: this.description }),
|
|
77
|
+
sizes: this.sizes ?? {},
|
|
78
|
+
variants: this.variants ?? [],
|
|
79
|
+
members: this.assetNames,
|
|
80
|
+
...compact({ component: this.component }),
|
|
81
|
+
...compact({ memberMetadata: this.memberMetadata && Object.keys(this.memberMetadata).length > 0 ? this.memberMetadata : void 0 })
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Rebuild from the wire format. Icon groups hydrate without live
|
|
86
|
+
* members (names only); font groups hydrate with their full records
|
|
87
|
+
* — they are the serialized form.
|
|
88
|
+
*/
|
|
89
|
+
static fromJSON(name, json, namespaceGetter) {
|
|
90
|
+
if (json.assetKind === "font") return new AssetGroup({
|
|
91
|
+
name,
|
|
92
|
+
label: json.label,
|
|
93
|
+
description: json.description,
|
|
94
|
+
assetKind: "font",
|
|
95
|
+
assetNames: Object.keys(json.members),
|
|
96
|
+
members: json.members,
|
|
97
|
+
namespaceGetter
|
|
98
|
+
});
|
|
99
|
+
return new AssetGroup({
|
|
100
|
+
name,
|
|
101
|
+
label: json.label,
|
|
102
|
+
description: json.description,
|
|
103
|
+
assetKind: "icon",
|
|
104
|
+
assetNames: json.members,
|
|
105
|
+
sizes: json.sizes,
|
|
106
|
+
variants: json.variants,
|
|
107
|
+
component: json.component,
|
|
108
|
+
memberMetadata: json.memberMetadata,
|
|
109
|
+
namespaceGetter
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { AssetGroup };
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { BaseStyles, ComponentDefinition, ComponentMetadata, ComponentMotionValue, CompoundPropsEntry, LayerInput, PreviewDefinition, PropBinding, SerializedComponent } from "./types.js";
|
|
2
|
+
import { SlotValueType } from "./markers.js";
|
|
3
|
+
import { ComponentClassNames } from "../../utils/dist/string-utils/componentClassName.js";
|
|
4
|
+
|
|
5
|
+
//#region ../config/dist/Component.d.ts
|
|
6
|
+
//#region src/Component.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Terminal prop value kinds — what a JSX value actually resolves to at
|
|
9
|
+
* render time. Used both as the discriminant of non-slot `PropInfo`
|
|
10
|
+
* variants and as a slot's `valueType` after walking its forward chain
|
|
11
|
+
* to the terminal binding.
|
|
12
|
+
*/
|
|
13
|
+
type PrimitivePropKind = 'string' | 'number' | 'boolean' | 'variant' | 'function';
|
|
14
|
+
/**
|
|
15
|
+
* Slot value kinds — primitives, `'ReactNode'` for children-style slots, and
|
|
16
|
+
* `'composite'` when the forward chain bottoms out at a `composite(...)` ref
|
|
17
|
+
* (so a slot forwarding to a layer's composite prop renders like one).
|
|
18
|
+
*/
|
|
19
|
+
type SlotValueKind = PrimitivePropKind | 'ReactNode' | 'composite';
|
|
20
|
+
/** Discriminant for top-level prop bindings (the `kind` field of `PropInfo`). */
|
|
21
|
+
type PropKind = PrimitivePropKind | 'styleProp' | 'slot';
|
|
22
|
+
/**
|
|
23
|
+
* Authoring shape of a component — how it was built, which decides how to
|
|
24
|
+
* author a new one like it:
|
|
25
|
+
* - `primitive` — single layer, no `extendsFrom`, no render fn (`Box`).
|
|
26
|
+
* - `extends` — value-extends another component via `defineComponent(Parent)`
|
|
27
|
+
* (`extendsFrom` is set); inherits the parent's prop surface (`Text`).
|
|
28
|
+
* - `multi-layer` — composed from `.layers({...})` and/or a custom `.render`
|
|
29
|
+
* (more than one layer, or a render fn) (`StudioListItem`, `Accordion`).
|
|
30
|
+
*/
|
|
31
|
+
type ComponentKind = 'primitive' | 'extends' | 'multi-layer';
|
|
32
|
+
/** Common fields every `PropInfo` variant carries. */
|
|
33
|
+
interface PropBase {
|
|
34
|
+
/** JSX prop name. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Authored marker had `.required()` (slot/variant markers only carry this). */
|
|
37
|
+
required: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Payload for `kind: 'variant'` props. */
|
|
40
|
+
interface VariantInfo {
|
|
41
|
+
/** Declared variant values in authored order. */
|
|
42
|
+
values: readonly (string | number | boolean)[];
|
|
43
|
+
}
|
|
44
|
+
/** Payload for `kind: 'styleProp'` props. */
|
|
45
|
+
interface StylePropInfo {
|
|
46
|
+
/** Style-prop registry key — `'bg'`, `'padding'`, etc. */
|
|
47
|
+
stylePropName: string;
|
|
48
|
+
}
|
|
49
|
+
/** Payload for `kind: 'function'` props. */
|
|
50
|
+
interface FunctionInfo {
|
|
51
|
+
/** Function is an event handler (forwards to an `on*` prop). */
|
|
52
|
+
isEventHandler: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Payload for `kind: 'composite'` props — bound via `composite('elevation')`. */
|
|
55
|
+
interface CompositeInfo {
|
|
56
|
+
/** Composite-style registry key — `'elevation'`, `'textVariant'`, etc. */
|
|
57
|
+
compositeName: string;
|
|
58
|
+
/** Target layer (defaults to `'root'`). */
|
|
59
|
+
layer?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Payload for `kind: 'slot'` props. `layer` undefined ⇒ open slot
|
|
63
|
+
* (`slot()` with no path). `layerProp` defaults to `'children'` when
|
|
64
|
+
* only a layer name is given. `accepts` is inherited through the
|
|
65
|
+
* forward chain — outer `.accepts()` wins; otherwise the innermost
|
|
66
|
+
* descendant slot's accepts is adopted. `valueType` reports what the
|
|
67
|
+
* JSX value resolves to at render time after walking the forward chain
|
|
68
|
+
* to a non-slot binding.
|
|
69
|
+
*
|
|
70
|
+
* `authoredType` is the kind the author declared via `slot({ type })`
|
|
71
|
+
* (absent when undeclared). It records intent independent of resolution:
|
|
72
|
+
* `derived.acceptsChildNodes` keys on it (a `children` slot the author
|
|
73
|
+
* tagged `'string'` is a text label, not a node-drop target), and it holds
|
|
74
|
+
* even when the forward chain can't resolve `valueType` to a primitive.
|
|
75
|
+
* `valueType` itself now follows a `children` ref into its target and reports
|
|
76
|
+
* what that resolves to — a Text leaf's `'string'`, a node container's
|
|
77
|
+
* `'ReactNode'`. Codegen-emitted prop types come from the JSX markers, not
|
|
78
|
+
* `valueType`, so they never narrow.
|
|
79
|
+
*/
|
|
80
|
+
interface SlotInfo {
|
|
81
|
+
layer?: string;
|
|
82
|
+
layerProp: string;
|
|
83
|
+
accepts?: readonly string[];
|
|
84
|
+
/**
|
|
85
|
+
* Slug of the placeable asset group this slot accepts (`slot().accepts(icons)`
|
|
86
|
+
* → `'icons'`), kept separate from the component-name `accepts` list so the
|
|
87
|
+
* designer panel can look the group up in `Config.assetGroups` and show its
|
|
88
|
+
* picker (an icon picker for icon-class groups) instead of the generic
|
|
89
|
+
* component picker. Absent for component-only slots. The config-load guard
|
|
90
|
+
* rejects non-placeable groups, so a slug here is always placeable.
|
|
91
|
+
*/
|
|
92
|
+
acceptsAssetGroup?: string;
|
|
93
|
+
valueType: SlotValueKind;
|
|
94
|
+
authoredType?: SlotValueType;
|
|
95
|
+
/**
|
|
96
|
+
* Selectable values when the forward chain bottoms out at a `variant`
|
|
97
|
+
* binding (e.g. forwarding to an inner component's `variant` prop). Lets
|
|
98
|
+
* editing tools render the forwarded prop as a dropdown of the target's
|
|
99
|
+
* variant values instead of a bare string input. Absent for non-variant
|
|
100
|
+
* terminals.
|
|
101
|
+
*/
|
|
102
|
+
valueOptions?: readonly (string | number | boolean)[];
|
|
103
|
+
/**
|
|
104
|
+
* Composite-style registry key when the forward chain bottoms out at a
|
|
105
|
+
* `composite(...)` ref (e.g. `slot('root/textVariant')` → an `Anchor` layer's
|
|
106
|
+
* `textVariant: composite('textVariant')`). Mirrors a directly-authored
|
|
107
|
+
* `kind: 'composite'` prop's `compositeName`, so editing tools render the
|
|
108
|
+
* same composite control (and the `textVariant` typography special-case)
|
|
109
|
+
* for the forwarded prop. Absent for non-composite terminals.
|
|
110
|
+
*/
|
|
111
|
+
compositeName?: string;
|
|
112
|
+
}
|
|
113
|
+
type PropInfo = (PropBase & {
|
|
114
|
+
kind: 'variant';
|
|
115
|
+
} & VariantInfo) | (PropBase & {
|
|
116
|
+
kind: 'boolean';
|
|
117
|
+
}) | (PropBase & {
|
|
118
|
+
kind: 'string';
|
|
119
|
+
}) | (PropBase & {
|
|
120
|
+
kind: 'number';
|
|
121
|
+
}) | (PropBase & {
|
|
122
|
+
kind: 'styleProp';
|
|
123
|
+
} & StylePropInfo) | (PropBase & {
|
|
124
|
+
kind: 'composite';
|
|
125
|
+
} & CompositeInfo) | (PropBase & {
|
|
126
|
+
kind: 'function';
|
|
127
|
+
} & FunctionInfo) | (PropBase & {
|
|
128
|
+
kind: 'slot';
|
|
129
|
+
} & SlotInfo);
|
|
130
|
+
type ResolvedCompoundOverrides = Record<string, Record<string, unknown>>;
|
|
131
|
+
declare class Layer {
|
|
132
|
+
readonly name: string;
|
|
133
|
+
readonly tag?: LayerInput;
|
|
134
|
+
readonly base?: BaseStyles;
|
|
135
|
+
constructor(args: {
|
|
136
|
+
name: string;
|
|
137
|
+
tag?: LayerInput;
|
|
138
|
+
base?: BaseStyles;
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* What this layer renders, normalized across the tag's representations:
|
|
142
|
+
* - `{ kind: 'component', ref }` — renders a registered component (`Box`,
|
|
143
|
+
* `Text`), so the layer takes that component's prop surface. The identity
|
|
144
|
+
* survives both in memory (a non-enumerable `__componentName` stamp on the
|
|
145
|
+
* builder) and on the wire (`{ __kind: 'component', ref }` from `fromJSON`).
|
|
146
|
+
* - `{ kind: 'tag', ref }` — renders a bare HTML element (`'div'`).
|
|
147
|
+
* - `undefined` — an inline anonymous builder with no registered identity.
|
|
148
|
+
*/
|
|
149
|
+
get renders(): {
|
|
150
|
+
kind: 'component' | 'tag';
|
|
151
|
+
ref: string;
|
|
152
|
+
} | undefined;
|
|
153
|
+
toJSON(): {
|
|
154
|
+
name: string;
|
|
155
|
+
tag?: LayerInput;
|
|
156
|
+
base?: BaseStyles;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
declare class Component {
|
|
160
|
+
#private;
|
|
161
|
+
readonly name: string;
|
|
162
|
+
readonly layers: ReadonlyMap<string, Layer>;
|
|
163
|
+
readonly props: Readonly<Record<string, PropBinding>>;
|
|
164
|
+
readonly base?: BaseStyles;
|
|
165
|
+
readonly defaultProps?: Record<string, unknown>;
|
|
166
|
+
readonly compoundProps?: readonly CompoundPropsEntry[];
|
|
167
|
+
readonly motion?: ComponentMotionValue;
|
|
168
|
+
readonly preview?: PreviewDefinition;
|
|
169
|
+
readonly metadata?: ComponentMetadata;
|
|
170
|
+
/**
|
|
171
|
+
* Absolute path of the file that called `defineComponent('Name', …)`.
|
|
172
|
+
* Captured via the stack walk in `captureCallerPath` and stashed
|
|
173
|
+
* non-enumerably on the authored definition; lifted onto the class
|
|
174
|
+
* here so codegen consumers don't have to thread a separate
|
|
175
|
+
* `componentSourceMap`. `undefined` when the component was hydrated
|
|
176
|
+
* from JSON (no original define call) or built outside the `define*`
|
|
177
|
+
* helpers.
|
|
178
|
+
*/
|
|
179
|
+
readonly sourceFilePath?: string;
|
|
180
|
+
/**
|
|
181
|
+
* `true` when the authored definition chained `.render(fn)` — the
|
|
182
|
+
* non-enumerable `__hasRenderFn` flag set by the builder. Codegen
|
|
183
|
+
* needs this to classify single-layer components that ship a custom
|
|
184
|
+
* render fn (e.g. Accordion) into the transform path rather than
|
|
185
|
+
* the inline primitive emitter, so the two paths don't both emit a
|
|
186
|
+
* wrapper FC with the same name.
|
|
187
|
+
*/
|
|
188
|
+
readonly hasRenderFn: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* The actual `.render(fn)` callback when `hasRenderFn` is `true`.
|
|
191
|
+
* Lifted from the seed's non-enumerable `__renderFn` so the spec
|
|
192
|
+
* extractor can invoke it under the mock-react plugin to capture
|
|
193
|
+
* the component's internal structure as a Spec. Not used at
|
|
194
|
+
* production render time — the codegen-emitted per-file FC handles
|
|
195
|
+
* that path.
|
|
196
|
+
*/
|
|
197
|
+
readonly renderFn?: unknown;
|
|
198
|
+
/**
|
|
199
|
+
* Name of the component this one value-extends from
|
|
200
|
+
* (`defineComponent(Box)` → `'Box'`). Resolved from the non-
|
|
201
|
+
* enumerable `__extendsFrom.__componentName` chain stamped by
|
|
202
|
+
* `defineComponent`'s value-extend branch and `Config.registerComponents`'
|
|
203
|
+
* registration loop. `undefined` for primitives, brace-ref shorthand
|
|
204
|
+
* forms, and JSON-hydrated configs (the wire format doesn't carry
|
|
205
|
+
* this relationship).
|
|
206
|
+
*/
|
|
207
|
+
readonly extendsFrom?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Globally-unique lookup key — the spec `type` string a renderer
|
|
210
|
+
* resolves against the registry. When the owning `Config` has a
|
|
211
|
+
* namespace set (`Config.configure({ namespace: 'uds' })`), this is
|
|
212
|
+
* `<namespace>:<name>` (`uds:Badge`); otherwise it's the bare `name`
|
|
213
|
+
* (un-namespaced configs). Read live via a getter so it reflects the
|
|
214
|
+
* namespace regardless of whether `configure` ran before or after the
|
|
215
|
+
* component was registered — mirrors the lazy `prefixGetter` pattern
|
|
216
|
+
* used for token CSS vars.
|
|
217
|
+
*
|
|
218
|
+
* `name` stays the bare authored/display/export identifier; codegen
|
|
219
|
+
* emits a bare-name alias alongside the canonical key so existing
|
|
220
|
+
* specs referencing the bare `name` keep resolving.
|
|
221
|
+
*/
|
|
222
|
+
get registryKey(): string;
|
|
223
|
+
constructor(args: {
|
|
224
|
+
name: string;
|
|
225
|
+
definition: ComponentDefinition;
|
|
226
|
+
componentGroup?: string;
|
|
227
|
+
subcomponentOf?: string;
|
|
228
|
+
subcomponents?: readonly string[];
|
|
229
|
+
/** Live getter for the owning Config's namespace — keeps
|
|
230
|
+
* `registryKey` correct regardless of chain-method ordering. */
|
|
231
|
+
namespaceGetter?: () => string | undefined;
|
|
232
|
+
/** Live getter for the owning Config's class-name prefix — feeds
|
|
233
|
+
* `derived.classNames` so emitted CSS selectors + generated TSX
|
|
234
|
+
* classNames share the config's namespace. Read lazily so it
|
|
235
|
+
* reflects `configure({ prefix })` regardless of chain ordering. */
|
|
236
|
+
prefixGetter?: () => string;
|
|
237
|
+
/** Resolves a registered component by name against the owning Config.
|
|
238
|
+
* Lets a slot's forward chain follow a layer that renders another
|
|
239
|
+
* registered component (`{ __kind: 'component', ref }`) into that
|
|
240
|
+
* component's prop surface — without it, the chain can't see the
|
|
241
|
+
* inner props (e.g. after a `fromJSON` round-trip, where layer tags
|
|
242
|
+
* are component refs) and falls back to a `string` value type. */
|
|
243
|
+
componentResolver?: (ref: string) => Component | undefined;
|
|
244
|
+
/** Resolves a `(styleProp, value)` shorthand to a qualified token name
|
|
245
|
+
* (`bg`, `'tertiary'` → `'bg/tertiary'`) against the owning Config's
|
|
246
|
+
* style-prop registry + token groups, or `undefined` when the value
|
|
247
|
+
* isn't a token of one of that prop's groups (a keyword or arbitrary
|
|
248
|
+
* literal). Lets `derived.tokenRefs` capture shorthand token usage
|
|
249
|
+
* structurally — the component knows its style props, but the
|
|
250
|
+
* prop→token-group link lives on the registry. */
|
|
251
|
+
resolveStylePropValueToken?: (styleProp: string, value: string) => string | undefined;
|
|
252
|
+
/** Whether a style key names a registered style prop — gates
|
|
253
|
+
* `derived.stylePropKeywords` so layer keys and marker internals don't
|
|
254
|
+
* read as style-prop keyword values. */
|
|
255
|
+
isStyleProp?: (name: string) => boolean;
|
|
256
|
+
});
|
|
257
|
+
get derived(): {
|
|
258
|
+
readonly layers: readonly Layer[];
|
|
259
|
+
readonly classNames: ComponentClassNames;
|
|
260
|
+
readonly compoundOverrides: ResolvedCompoundOverrides;
|
|
261
|
+
readonly componentGroup?: string;
|
|
262
|
+
readonly subcomponentOf?: string;
|
|
263
|
+
readonly subcomponents?: readonly string[];
|
|
264
|
+
readonly props: readonly PropInfo[];
|
|
265
|
+
readonly stylePropNames: readonly string[];
|
|
266
|
+
/** Qualified token names (`bg/tertiary`, `color/brand`) this component
|
|
267
|
+
* references anywhere in its styling — base, variant styles, and
|
|
268
|
+
* compound overrides, recursing modifier sub-objects and color
|
|
269
|
+
* expressions. Both structured `token(...)` refs and shorthand
|
|
270
|
+
* style-prop values (`bg: 'tertiary'`) are captured, resolved through
|
|
271
|
+
* the registry, so the edge is structural — no CSS-var/string matching.
|
|
272
|
+
* The reverse direction is `Config.getTokenDependents`. */
|
|
273
|
+
readonly tokenRefs: readonly string[];
|
|
274
|
+
/** `(styleProp, token)` pairs — which style prop a referenced token sits
|
|
275
|
+
* under (`bg` → `color/brand`, including refs nested in a color
|
|
276
|
+
* expression). The "actually used with a value from this group" edge that
|
|
277
|
+
* `Config.getTokenGroupUsage` reads, distinct from the registry "allowed
|
|
278
|
+
* in" relation (`getTokenGroupDependents`). */
|
|
279
|
+
readonly stylePropTokenUsages: readonly StylePropTokenUsage[];
|
|
280
|
+
/** The non-token keyword values this component uses (`display`/`flex`,
|
|
281
|
+
* `flexDirection`/`col`) — disjoint from `tokenRefs`, excluding arbitrary
|
|
282
|
+
* bracket literals. Tracks keyword removal-impact; the reverse direction
|
|
283
|
+
* is `dependentsOf({ kind: 'styleProp', name, value })`. */
|
|
284
|
+
readonly stylePropKeywords: readonly StylePropKeyword[];
|
|
285
|
+
readonly kind: ComponentKind;
|
|
286
|
+
readonly acceptsChildren: boolean;
|
|
287
|
+
readonly acceptsChildNodes: boolean;
|
|
288
|
+
prop(propName: string): PropInfo | undefined;
|
|
289
|
+
};
|
|
290
|
+
toJSON(opts?: {
|
|
291
|
+
projectRoot?: string;
|
|
292
|
+
}): SerializedComponent & {
|
|
293
|
+
name: string;
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/** Which style prop a referenced token sits under — `{ styleProp: 'bg',
|
|
297
|
+
* token: 'color/brand' }`. See `Component.derived.stylePropTokenUsages`. */
|
|
298
|
+
interface StylePropTokenUsage {
|
|
299
|
+
readonly styleProp: string;
|
|
300
|
+
readonly token: string;
|
|
301
|
+
}
|
|
302
|
+
/** A non-token keyword value a style prop carries — `{ styleProp: 'display',
|
|
303
|
+
* value: 'flex' }`. See `Component.derived.stylePropKeywords`. */
|
|
304
|
+
interface StylePropKeyword {
|
|
305
|
+
readonly styleProp: string;
|
|
306
|
+
readonly value: string;
|
|
307
|
+
} //#endregion
|
|
308
|
+
//#endregion
|
|
309
|
+
export { Component, ComponentKind, CompositeInfo, FunctionInfo, Layer, PrimitivePropKind, PropBase, PropInfo, PropKind, ResolvedCompoundOverrides, SlotInfo, SlotValueKind, StylePropInfo, StylePropKeyword, StylePropTokenUsage, VariantInfo };
|