@yahoo/uds-v5-wip 1.38.0 → 1.40.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/components/dist/accordion.js +9 -9
- package/dist/components/dist/alert.js +2 -2
- package/dist/components/dist/avatar-group.js +6 -6
- package/dist/components/dist/avatar.js +3 -3
- package/dist/components/dist/badge.js +2 -2
- package/dist/components/dist/breadcrumb.js +17 -17
- package/dist/components/dist/button.js +5 -5
- package/dist/components/dist/card.js +4 -4
- package/dist/components/dist/collapsible.js +3 -3
- package/dist/components/dist/command.js +21 -21
- package/dist/components/dist/control-color.js +6 -6
- package/dist/components/dist/control-curve.js +4 -4
- package/dist/components/dist/control-folder.js +6 -6
- package/dist/components/dist/control-group.js +3 -3
- package/dist/components/dist/control-knob.js +8 -8
- package/dist/components/dist/control-panel.js +3 -3
- package/dist/components/dist/control-select.js +8 -8
- package/dist/components/dist/control-slider.js +8 -8
- package/dist/components/dist/control-spring.js +12 -12
- package/dist/components/dist/control-stepper.js +6 -6
- package/dist/components/dist/control-toggle.js +3 -3
- package/dist/components/dist/dropdown.js +10 -10
- package/dist/components/dist/empty-state.js +6 -6
- package/dist/components/dist/grid.js +2 -2
- package/dist/components/dist/hstack.js +1 -1
- package/dist/components/dist/input.js +1 -1
- package/dist/components/dist/item.js +8 -8
- package/dist/components/dist/list.js +1 -1
- package/dist/components/dist/modal.js +8 -8
- package/dist/components/dist/nav-header.js +3 -3
- package/dist/components/dist/preset-bar.js +10 -10
- package/dist/components/dist/presets/index.js +1 -1
- package/dist/components/dist/progress.js +6 -6
- package/dist/components/dist/sheet.js +8 -8
- package/dist/components/dist/sidebar.js +42 -42
- package/dist/components/dist/skeleton.js +1 -1
- package/dist/components/dist/slider.js +5 -5
- package/dist/components/dist/spinner.js +2 -2
- package/dist/components/dist/switch.js +5 -5
- package/dist/components/dist/tabs.js +8 -8
- package/dist/components/dist/toast.js +7 -7
- package/dist/components/dist/tooltip.js +3 -3
- package/dist/components/dist/vstack.js +1 -1
- package/dist/components/presets/index.js +1 -1
- package/dist/config/dist/Props.d.ts +69 -1
- package/dist/config/dist/component-config.d.ts +60 -32
- package/dist/config/dist/component-refs.d.ts +0 -13
- package/dist/config/dist/component-resolution.d.ts +1 -1
- package/dist/config/dist/consts/defaultColors.d.ts +1 -2
- package/dist/config/dist/createConfig.d.ts +19 -26
- package/dist/config/dist/createConfig.js +5 -2
- package/dist/config/dist/defineComponent.d.ts +17 -1
- package/dist/config/dist/defineComponent.js +2 -0
- package/dist/config/dist/defineStyleProp.d.ts +1 -12
- package/dist/config/dist/index.d.ts +4 -2
- package/dist/config/dist/index.js +1 -0
- package/dist/config/dist/resolveStyleProp.d.ts +0 -7
- package/dist/config/dist/serialize.d.ts +1 -2
- package/dist/config/dist/types/css-values.d.ts +1 -2
- package/dist/config/dist/types.d.ts +1 -2
- package/dist/foundational-presets/dist/corporate.d.ts +353 -352
- package/dist/foundational-presets/dist/darkMoody.d.ts +353 -352
- package/dist/foundational-presets/dist/forest.d.ts +353 -352
- package/dist/foundational-presets/dist/highContrast.d.ts +353 -352
- package/dist/foundational-presets/dist/lavender.d.ts +353 -352
- package/dist/foundational-presets/dist/luxury.d.ts +353 -352
- package/dist/foundational-presets/dist/monochrome.d.ts +353 -352
- package/dist/foundational-presets/dist/motion.d.ts +2 -1
- package/dist/foundational-presets/dist/neonCyber.d.ts +353 -352
- package/dist/foundational-presets/dist/newspaper.d.ts +353 -352
- package/dist/foundational-presets/dist/ocean.d.ts +353 -352
- package/dist/foundational-presets/dist/slate.d.ts +353 -352
- package/dist/foundational-presets/dist/sunset.d.ts +353 -352
- package/dist/foundational-presets/dist/terminal.d.ts +353 -352
- package/dist/foundational-presets/dist/warmOrganic.d.ts +353 -352
- package/dist/loader/dist/_virtual/_rolldown/runtime.js +2 -1
- package/dist/loader/dist/loader/create-component-lowering.js +1 -1
- package/dist/loader/dist/loader/data-attr-transform.js +1 -1
- package/dist/loader/dist/loader/style-transform.js +5 -5
- package/dist/loader/dist/loader.js +3 -3
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.development.js +203 -0
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.production.js +25 -0
- package/dist/loader/dist/node_modules/react/cjs/react.development.js +762 -0
- package/dist/loader/dist/node_modules/react/cjs/react.production.js +351 -0
- package/dist/loader/dist/node_modules/react/index.js +10 -0
- package/dist/loader/dist/node_modules/react/jsx-runtime.js +10 -0
- package/dist/loader/dist/packages/core/dist/color-opacity-map.js +33 -0
- package/dist/loader/dist/packages/core/dist/compositeStyles.js +43 -0
- package/dist/loader/dist/packages/core/dist/createComponent.js +6 -0
- package/dist/loader/dist/packages/core/dist/createProvider.js +7 -0
- package/dist/loader/dist/packages/core/dist/generated/stylePropsTwMap.js +570 -0
- package/dist/loader/dist/packages/core/dist/getComponentStyles.js +2 -0
- package/dist/loader/dist/packages/core/dist/getStyles.js +60 -0
- package/dist/loader/dist/packages/core/dist/index.js +6 -0
- package/dist/loader/dist/packages/core/dist/modifier-mappings.js +61 -0
- package/dist/loader/dist/packages/core/dist/style-prop-data.js +1257 -0
- package/dist/loader/dist/packages/core/dist/withDefaultStyleProps.js +1 -0
- package/dist/loader.js +1 -1
- package/dist/presets/dist/boldVibrant.d.ts +2 -1
- package/dist/presets/dist/brutalist.d.ts +2 -1
- package/dist/presets/dist/candy.d.ts +2 -1
- package/dist/presets/dist/cleanMinimalist.d.ts +2 -1
- package/dist/presets/dist/corporate.d.ts +2 -1
- package/dist/presets/dist/darkMoody.d.ts +2 -1
- package/dist/presets/dist/defaultPreset.d.ts +2 -1
- package/dist/presets/dist/defaultPreset.js +1 -1
- package/dist/presets/dist/forest.d.ts +2 -1
- package/dist/presets/dist/highContrast.d.ts +2 -1
- package/dist/presets/dist/lavender.d.ts +2 -1
- package/dist/presets/dist/luxury.d.ts +2 -1
- package/dist/presets/dist/monochrome.d.ts +2 -1
- package/dist/presets/dist/neonCyber.d.ts +2 -1
- package/dist/presets/dist/newspaper.d.ts +2 -1
- package/dist/presets/dist/ocean.d.ts +2 -1
- package/dist/presets/dist/slate.d.ts +2 -1
- package/dist/presets/dist/sunset.d.ts +2 -1
- package/dist/presets/dist/terminal.d.ts +2 -1
- package/dist/presets/dist/warmOrganic.d.ts +2 -1
- package/dist/remotion/dist/components/image-slide.d.ts +2 -1
- package/dist/remotion/dist/components/lower-third.d.ts +2 -1
- package/dist/remotion/dist/components/quote-card.d.ts +2 -1
- package/dist/remotion/dist/components/split-screen.d.ts +2 -1
- package/dist/remotion/dist/components/stat-card.d.ts +2 -1
- package/dist/remotion/dist/components/text-overlay.d.ts +2 -1
- package/dist/remotion/dist/components/title-card.d.ts +2 -1
- package/dist/remotion/dist/components/typing-text.d.ts +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,6 @@ import { ComponentRef, CompositeRef, RegisteredComponents, StylePropRef } from "
|
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region ../config/dist/component-config.d.ts
|
|
5
|
-
//#region src/component-config.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* HTML tag literal. The TypeScript type is `string` (any tag name);
|
|
8
7
|
* runtime renders it via `React.createElement(tag, ...)`.
|
|
@@ -59,6 +58,23 @@ interface StylePropBinding {
|
|
|
59
58
|
layer: string;
|
|
60
59
|
styleProp: StylePropRef;
|
|
61
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Extract the root tag literal from a `layers` map when it can be read
|
|
63
|
+
* statically. Returns the string literal `'a' | 'div' | …` when:
|
|
64
|
+
*
|
|
65
|
+
* - `layers.root` is a bare tag string (`'a'`), or
|
|
66
|
+
* - `layers.root` is `{ tag: 'a', attrs?: … }`.
|
|
67
|
+
*
|
|
68
|
+
* Returns `undefined` when `layers.root` is a brace-ref (`'{Box}'`), a
|
|
69
|
+
* `{ component: '{Box}' }` form, or not present. `Props<TConfig>` reads
|
|
70
|
+
* this and substitutes `React.ComponentPropsWithoutRef<TTag>` for the
|
|
71
|
+
* generic `HTMLAttributes<HTMLElement>` when narrowable.
|
|
72
|
+
*/
|
|
73
|
+
type RootTag<TLayers> = TLayers extends {
|
|
74
|
+
root: infer R;
|
|
75
|
+
} ? R extends HtmlTag ? R extends `{${string}}` ? undefined : R : R extends {
|
|
76
|
+
tag: infer T extends HtmlTag;
|
|
77
|
+
} ? T : undefined : undefined;
|
|
62
78
|
/**
|
|
63
79
|
* Bind a registered composite to a single layer. Multi-layer composites
|
|
64
80
|
* use the `CompositeBinding` shape instead (see below).
|
|
@@ -111,49 +127,61 @@ interface EnumMarker<TValues extends Record<string, unknown>> {
|
|
|
111
127
|
/**
|
|
112
128
|
* Shorthand binding form — a brace-ref string standing in for the
|
|
113
129
|
* verbose object. `'{bg}'` means "bind the registered style prop `bg`
|
|
114
|
-
* to the
|
|
115
|
-
* declared)". Use the long-form `{ layer, styleProp }` shape when the
|
|
116
|
-
* target layer isn't the default, or when the JSX-prop key differs
|
|
117
|
-
* from the style-prop name.
|
|
130
|
+
* to the *root* layer".
|
|
118
131
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
132
|
+
* Only legal in the primitive form `defineComponent('div', { props: { bg: '{bg}' } })`,
|
|
133
|
+
* where the root layer is unambiguous. In the verbose form
|
|
134
|
+
* `defineComponent({ layers: {...}, props: {...} })` authors must use
|
|
135
|
+
* the explicit long-form `{ layer, styleProp: '{bg}' }` binding so
|
|
136
|
+
* the target layer is named at the call site.
|
|
124
137
|
*/
|
|
125
138
|
type StylePropShorthand = StylePropRef;
|
|
126
139
|
/**
|
|
127
|
-
* All allowed shapes for a single entry in the `props`
|
|
140
|
+
* All allowed shapes for a single entry in the verbose form's `props`
|
|
141
|
+
* block. Verbose form (with explicit `layers`) requires the long-form
|
|
142
|
+
* `{ layer, styleProp }` binding — no shorthand. The shorthand
|
|
143
|
+
* `'{bg}'` is allowed only in the primitive form's props (see
|
|
144
|
+
* `PrimitivePropBinding`).
|
|
128
145
|
*/
|
|
129
|
-
type
|
|
146
|
+
type VerbosePropBinding = StylePropBinding | SingleLayerCompositeBinding | CompositeBinding | SurfaceForward | BoolMarker | EnumMarker<any>;
|
|
130
147
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* disabled: bool(),
|
|
136
|
-
* }
|
|
148
|
+
* All allowed shapes for a single entry in the primitive form's `props`
|
|
149
|
+
* block. Primitive form adds the `StylePropShorthand` brace-ref
|
|
150
|
+
* (`'{bg}'`) on top of every verbose form — the root layer is
|
|
151
|
+
* unambiguous so the shorthand resolves trivially.
|
|
137
152
|
*/
|
|
153
|
+
type PrimitivePropBinding = StylePropShorthand | VerbosePropBinding;
|
|
138
154
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* binding values (e.g. `'{bg}'`) survive for `Props<TConfig>` to
|
|
144
|
-
* resolve against `RegisteredStyleProps`. The component name is
|
|
145
|
-
* supplied at registration time, not here.
|
|
155
|
+
* Union of every legal prop-binding shape across both forms. Read-side
|
|
156
|
+
* helpers (`Props<TConfig>`, runtime resolution) accept this widest
|
|
157
|
+
* union; authoring-side input types (`ComponentConfigInput`) take the
|
|
158
|
+
* tighter `VerbosePropBinding`.
|
|
146
159
|
*/
|
|
147
|
-
|
|
160
|
+
type PropBinding = PrimitivePropBinding;
|
|
161
|
+
/**
|
|
162
|
+
* Branded shape returned by `defineComponent({...})`. Carries `layers`,
|
|
163
|
+
* `props`, AND a phantom `__tag` slot as const-narrowed types so
|
|
164
|
+
* downstream type-only imports (`import type { AlertConfig } from
|
|
165
|
+
* './alert.config'`) thread the full shape through to
|
|
166
|
+
* `Props<typeof config>` — per-prop literal binding values (e.g.
|
|
167
|
+
* `'{bg}'`) survive for `Props<TConfig>` to resolve against
|
|
168
|
+
* `RegisteredStyleProps`, and the root tag survives for HTML-attribute
|
|
169
|
+
* narrowing via `React.ComponentPropsWithoutRef<TTag>`.
|
|
170
|
+
*
|
|
171
|
+
* `__tag` is a *phantom* type slot — there is no runtime field. It's
|
|
172
|
+
* derived from either the primitive-form first arg (`defineComponent('a',
|
|
173
|
+
* …)`) or from `layers.root` via `RootTag<TLayers>` for the verbose form.
|
|
174
|
+
* When the root isn't a literal tag (brace-ref / composed layer), it's
|
|
175
|
+
* `undefined` and `Props<TConfig>` falls back to `HTMLAttributes<HTMLElement>`.
|
|
176
|
+
*
|
|
177
|
+
* The component's name is supplied at registration time, not here.
|
|
178
|
+
*/
|
|
179
|
+
interface ComponentConfigValue<TLayers extends Record<string, LayerInput>, TProps extends Record<string, PropBinding> = Record<string, PropBinding>, TTag extends HtmlTag | undefined = RootTag<TLayers>> {
|
|
148
180
|
readonly __kind: 'componentConfig';
|
|
181
|
+
readonly __tag?: TTag;
|
|
149
182
|
readonly layers: TLayers;
|
|
150
183
|
readonly props?: TProps;
|
|
151
184
|
readonly defaultProps?: Record<string, unknown>;
|
|
152
185
|
}
|
|
153
|
-
/**
|
|
154
|
-
* The bundle passed to the render function for each layer — a ready-to-
|
|
155
|
-
* spread object with `className` and any forwarded attrs. The render
|
|
156
|
-
* function destructures `props.<layerName>` into the JSX position.
|
|
157
|
-
*/
|
|
158
186
|
//#endregion
|
|
159
|
-
export { BoolMarker, ComponentConfigValue, ComposedLayer, CompositeBinding, EnumMarker, HtmlTag, LayerInput, PrimitiveLayer, PropBinding, SingleLayerCompositeBinding, StylePropBinding, SurfaceForward };
|
|
187
|
+
export { BoolMarker, ComponentConfigValue, ComposedLayer, CompositeBinding, EnumMarker, HtmlTag, LayerInput, PrimitiveLayer, PrimitivePropBinding, PropBinding, RootTag, SingleLayerCompositeBinding, StylePropBinding, StylePropShorthand, SurfaceForward, VerbosePropBinding };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region ../config/dist/component-refs.d.ts
|
|
2
|
-
//#region src/component-refs.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Augmentable registries + template-literal ref types for the
|
|
5
4
|
* component-API surface.
|
|
@@ -64,14 +63,6 @@ interface RegisteredStyleProps {}
|
|
|
64
63
|
* call.
|
|
65
64
|
*/
|
|
66
65
|
interface RegisteredComposites {}
|
|
67
|
-
/**
|
|
68
|
-
* Registered motion-preset names. Each key is the preset identifier
|
|
69
|
-
* (`'{fadeIn}'`); value is `void`.
|
|
70
|
-
*
|
|
71
|
-
* Populated by codegen from `uds.config.ts`'s `.defineMotion({...})`
|
|
72
|
-
* (motion has no separate `.registerMotion` step today; the entries
|
|
73
|
-
* come directly from `defineMotion` keys).
|
|
74
|
-
*/
|
|
75
66
|
/**
|
|
76
67
|
* Brace-wrapped reference to a registered React component. Falls open
|
|
77
68
|
* to `'{${string}}'` when the registry is unaugmented (e.g. inside
|
|
@@ -90,9 +81,5 @@ type StylePropRef = [keyof RegisteredStyleProps] extends [never] ? `{${string}}`
|
|
|
90
81
|
* when unaugmented.
|
|
91
82
|
*/
|
|
92
83
|
type CompositeRef = [keyof RegisteredComposites] extends [never] ? `{${string}}` : `{${Extract<keyof RegisteredComposites, string>}}`;
|
|
93
|
-
/**
|
|
94
|
-
* Brace-wrapped reference to a registered motion preset. Falls open
|
|
95
|
-
* when unaugmented.
|
|
96
|
-
*/
|
|
97
84
|
//#endregion
|
|
98
85
|
export { ComponentRef, CompositeRef, RegisteredComponents, RegisteredComposites, RegisteredStyleProps, StylePropRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentsConfig } from "@uds/types";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region ../config/dist/consts/defaultColors.d.ts
|
|
2
|
-
//#region src/consts/defaultColors.d.ts
|
|
3
2
|
declare const defaultColors: {
|
|
4
3
|
inherit: string;
|
|
5
4
|
current: string;
|
|
@@ -248,6 +247,6 @@ declare const defaultColors: {
|
|
|
248
247
|
'rose-800': string;
|
|
249
248
|
'rose-900': string;
|
|
250
249
|
'rose-950': string;
|
|
251
|
-
};
|
|
250
|
+
};
|
|
252
251
|
//#endregion
|
|
253
252
|
export { defaultColors };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ComponentConfigValue } from "./component-config.js";
|
|
2
|
+
import { BoundComponent } from "./defineComponent.js";
|
|
2
3
|
import { AnyStyleProp } from "./defineStyleProp.js";
|
|
3
|
-
import { TokenType, VarsConfig } from "./types.js";
|
|
4
4
|
import { ResolvedStyleProp } from "./resolveStyleProp.js";
|
|
5
|
+
import { TokenType, VarsConfig } from "./types.js";
|
|
5
6
|
import { BaseModifierProp, ComponentsConfig, CompositeStylesConfig, ConfigurableProp, ModifierProp, MotionPreset, RemotionComponentDef, RemotionConfig, RemotionTransitionDef } from "@uds/types";
|
|
6
7
|
|
|
7
8
|
//#region ../config/dist/createConfig.d.ts
|
|
8
|
-
//#region src/createConfig.d.ts
|
|
9
9
|
type MotionPresetsDef = Record<string, MotionPreset>;
|
|
10
10
|
type MotionAliasValue<TMotion> = TMotion extends Record<string, infer V> ? Extract<V, string> : never;
|
|
11
11
|
type EmptyMotion = {};
|
|
@@ -78,12 +78,6 @@ type GetModifierFromInput<I extends ModesInput> = { [SetKey in keyof I]: { [OptK
|
|
|
78
78
|
} ? M extends ModifierNameShape ? M : never : OptKey extends string ? `_${OptKey}` : never }[keyof I[SetKey]['options']] }[keyof I];
|
|
79
79
|
/** Reject any input whose derived/explicit modifiers collide with reserved names. */
|
|
80
80
|
type CheckForReservedModifiersInput<I extends ModesInput> = true extends HasReservedModifier<GetModifierFromInput<I>> ? 'ERROR: Cannot use reserved modifier names from ModifierProp. Please use a different modifier name.' : I;
|
|
81
|
-
/**
|
|
82
|
-
* Convert the authored object-keyed input into the internal `ModeGroup[]` shape.
|
|
83
|
-
* Derives `_${optionKey}` modifiers when no explicit `modifier` is provided.
|
|
84
|
-
* Never sets `default: true` — the new API has no concept of a default option;
|
|
85
|
-
* downstream consumers treat "no option active" as the implicit default.
|
|
86
|
-
*/
|
|
87
81
|
interface ModifierDef {
|
|
88
82
|
modifier: ModifierNameShape;
|
|
89
83
|
selector: string;
|
|
@@ -163,7 +157,6 @@ type VarsToTokens<TVars extends VarsConfig> = { [K in keyof TVars]: { [T in Excl
|
|
|
163
157
|
type MergeTokens<A, B> = { [K in keyof A | keyof B]: K extends keyof B ? K extends keyof A ? A[K] & B[K] : B[K] : K extends keyof A ? A[K] : never };
|
|
164
158
|
/** Build a structured token reference object from atomic tokens */
|
|
165
159
|
declare function buildTokenReference(atomic: AtomicToken<ModifierNameShape>[], configPrefix: string): Record<string, Record<string, string>>;
|
|
166
|
-
/** Build a structured composite-styles reference object for use in defineModifiers context */
|
|
167
160
|
/** Global styles definition — CSS selector → style props */
|
|
168
161
|
type GlobalStylesDef = Record<string, Record<string, any>>;
|
|
169
162
|
/** CSS properties for the example wrapper element */
|
|
@@ -236,7 +229,7 @@ interface UdsConfigData {
|
|
|
236
229
|
* `ComponentConfigValue` branded record carrying `layers`, `props`,
|
|
237
230
|
* `defaultProps`.
|
|
238
231
|
*/
|
|
239
|
-
componentConfigs?: Record<string, ComponentConfigValue<any, any>>;
|
|
232
|
+
componentConfigs?: Record<string, ComponentConfigValue<any, any, any>>;
|
|
240
233
|
}
|
|
241
234
|
interface ComponentConfig<TComponents extends ComponentsConfig<string> = ComponentsConfig<string>, TMotion extends MotionPresetsDef | undefined = MotionPresetsDef | undefined> {
|
|
242
235
|
name?: string;
|
|
@@ -304,24 +297,28 @@ interface UdsConfig<TModifier extends ModifierNameShape = ModifierProp, TTokens
|
|
|
304
297
|
*/
|
|
305
298
|
registerStyleProps<const Props extends Record<string, AnyStyleProp>>(props: Props): ConfigResult<TModifier, TTokens, TMotion, TExt, TCompositeStyles, TModeModifiers, TVars>;
|
|
306
299
|
/**
|
|
307
|
-
* Register `defineComponent(
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
300
|
+
* Register components authored with `defineComponent(...)`. Calls
|
|
301
|
+
* accumulate — later `.registerComponents({...})` calls merge into
|
|
302
|
+
* the existing map (later keys overwrite earlier ones with the same
|
|
303
|
+
* name).
|
|
304
|
+
*
|
|
305
|
+
* Accepts either form returned by `defineComponent`:
|
|
306
|
+
* - The pure-data config value from the bare verbose form
|
|
307
|
+
* (`defineComponent({ layers, props })`).
|
|
308
|
+
* - A bound component from the primitive form
|
|
309
|
+
* (`defineComponent('div', { props })`) or the chained
|
|
310
|
+
* `.render(fn)` builder — the framework extracts the underlying
|
|
311
|
+
* config from the non-enumerable `__config` slot.
|
|
311
312
|
*
|
|
312
313
|
* @example
|
|
313
314
|
* ```ts
|
|
314
|
-
* import { Box
|
|
315
|
+
* import { Box } from './src/uds/components/box'; // primitive
|
|
316
|
+
* import { alertConfig } from './src/uds/components/alert.config'; // verbose pure-data
|
|
315
317
|
*
|
|
316
|
-
* uds.registerComponents({ Box, Alert });
|
|
318
|
+
* uds.registerComponents({ Box, Alert: alertConfig });
|
|
317
319
|
* ```
|
|
318
|
-
*
|
|
319
|
-
* The value side of each map entry is the `ComponentConfigValue`
|
|
320
|
-
* returned by `defineComponent`. (Apps pass the React component value
|
|
321
|
-
* — `Box` — and the framework reads its attached config via the
|
|
322
|
-
* registry populated as a side effect of importing the config file.)
|
|
323
320
|
*/
|
|
324
|
-
registerComponents<const TConfigs extends Record<string, ComponentConfigValue<any, any>>>(configs: TConfigs): ConfigResult<TModifier, TTokens, TMotion, TExt, TCompositeStyles, TModeModifiers, TVars>;
|
|
321
|
+
registerComponents<const TConfigs extends Record<string, ComponentConfigValue<any, any, any> | BoundComponent<ComponentConfigValue<any, any, any>, any>>>(configs: TConfigs): ConfigResult<TModifier, TTokens, TMotion, TExt, TCompositeStyles, TModeModifiers, TVars>;
|
|
325
322
|
defineMotion<const M extends MotionPresetsDef>(presets: M | ((tokens: TTokens) => M)): ConfigResult<TModifier, TTokens, { [K in keyof M]: string }, TExt, TCompositeStyles, TModeModifiers, TVars>;
|
|
326
323
|
defineComponents(params: ComponentsConfig<MotionAliasValue<TMotion> | string> | ((ctx: {
|
|
327
324
|
tokens: TTokens;
|
|
@@ -352,10 +349,6 @@ interface UdsConfig<TModifier extends ModifierNameShape = ModifierProp, TTokens
|
|
|
352
349
|
type AnyUdsConfig = UdsConfig<ModifierNameShape, any, any, any, any, any, any>;
|
|
353
350
|
/** Extract the raw config data from a builder instance */
|
|
354
351
|
declare function resolveConfig(config: AnyUdsConfig): UdsConfigData;
|
|
355
|
-
/**
|
|
356
|
-
* Resolve configuration with all token references replaced by their raw values.
|
|
357
|
-
* Useful for tools that need the actual values (e.g. anatomy generation).
|
|
358
|
-
*/
|
|
359
352
|
declare function createConfigBuilder<TModifier extends ModifierNameShape = ModifierProp, TTokens = EmptyTokens, TMotion = EmptyMotion, TExt extends Record<string, any> = {}, TCompositeStyles = EmptyCompositeStyles, TModeModifiers extends ModifierNameShape = never, TVars extends VarsConfig = EmptyVars>(data: UdsConfigData, extensions?: TExt): UdsConfig<TModifier, TTokens, TMotion, TExt, TCompositeStyles, TModeModifiers, TVars> & TExt;
|
|
360
353
|
interface InterpolateMarker {
|
|
361
354
|
__type: 'interpolate';
|
|
@@ -4,9 +4,9 @@ import "../../utils/dist/index.js";
|
|
|
4
4
|
import { getConfigurablePropMapping } from "../../core/dist/configurable-prop-helpers.js";
|
|
5
5
|
import "../../core/dist/index.js";
|
|
6
6
|
import { buildMotionReference, resolveComponentMotionAliases, validateComponentVariants } from "./component-resolution.js";
|
|
7
|
+
import { applyPresetToData, deepMerge, mergeAtomic } from "./preset-merge.js";
|
|
7
8
|
import { resolveTokenType, sniffTokenTypeFromValue } from "./resolveTokenTypes.js";
|
|
8
9
|
import { resolveStyleProp } from "./resolveStyleProp.js";
|
|
9
|
-
import { applyPresetToData, deepMerge, mergeAtomic } from "./preset-merge.js";
|
|
10
10
|
//#region ../config/dist/createConfig.js
|
|
11
11
|
/** biome-ignore-all lint/suspicious/noExplicitAny: necessary for dynamic builder to work correctly */
|
|
12
12
|
/**
|
|
@@ -428,9 +428,12 @@ function createConfigBuilder(data, extensions) {
|
|
|
428
428
|
return next(updates);
|
|
429
429
|
},
|
|
430
430
|
registerComponents(configs) {
|
|
431
|
+
const normalized = {};
|
|
432
|
+
for (const [name, entry] of Object.entries(configs)) if (typeof entry === "function" && "__config" in entry) normalized[name] = entry.__config;
|
|
433
|
+
else normalized[name] = entry;
|
|
431
434
|
return next({ componentConfigs: {
|
|
432
435
|
...data.componentConfigs ?? {},
|
|
433
|
-
...
|
|
436
|
+
...normalized
|
|
434
437
|
} });
|
|
435
438
|
},
|
|
436
439
|
defineMotion(presets) {
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentConfigValue, HtmlTag, LayerInput } from "./component-config.js";
|
|
2
|
+
import { Props } from "./Props.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
//#region ../config/dist/defineComponent.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A React component bound to a `defineComponent` config, with the
|
|
8
|
+
* source config attached as a phantom type slot. Tools (codegen,
|
|
9
|
+
* devtools) recover the config at runtime via the non-enumerable
|
|
10
|
+
* `__config` property; the type slot lets consumers read it at the
|
|
11
|
+
* type level too — `Props<typeof Box['__config']>`.
|
|
12
|
+
*/
|
|
13
|
+
type BoundComponent<TConfig extends ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined>, TExtra extends Record<string, unknown> = {}> = React.FC<Props<TConfig> & TExtra> & {
|
|
14
|
+
readonly __config: TConfig;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { BoundComponent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssValueTypeName } from "./types/css-values.js";
|
|
1
|
+
import { CssValue, CssValueTypeName } from "./types/css-values.js";
|
|
2
2
|
|
|
3
3
|
//#region ../config/dist/defineStyleProp.d.ts
|
|
4
4
|
/** Runtime input type for `toCss` based on the entry's `type`. */
|
|
@@ -22,20 +22,10 @@ type ArbitraryEntry = { [T in CssValueTypeName]: {
|
|
|
22
22
|
* - An array of {@link ArbitraryEntry} for multi-shape acceptance.
|
|
23
23
|
*/
|
|
24
24
|
type ArbitrarySpec = CssValueTypeName | readonly ArbitraryEntry[];
|
|
25
|
-
/**
|
|
26
|
-
* The literal-keyword subset of values a property accepts, derived from
|
|
27
|
-
* {@link CssPropertyValues}[P]. For custom CSS properties (`--*`) the value
|
|
28
|
-
* type is governed by the required `cssType` field instead, so any string
|
|
29
|
-
* is accepted at the type level.
|
|
30
|
-
*/
|
|
31
25
|
type StylePropMetadata = {
|
|
32
26
|
label?: string;
|
|
33
27
|
description?: string;
|
|
34
28
|
};
|
|
35
|
-
/**
|
|
36
|
-
* A finalized style prop. Returned by `defineStyleProp(spec).metadata(meta)`.
|
|
37
|
-
* Consumers wrap these in `uds.registerStyleProps({ <propName>: ... })`.
|
|
38
|
-
*/
|
|
39
29
|
/**
|
|
40
30
|
* Structurally-loose form of {@link StyleProp}. Any concrete `StyleProp<P>`
|
|
41
31
|
* is assignable to this. Used at registration / resolution boundaries where
|
|
@@ -51,6 +41,5 @@ interface AnyStyleProp {
|
|
|
51
41
|
readonly cssType?: CssValueTypeName;
|
|
52
42
|
readonly metadata: StylePropMetadata;
|
|
53
43
|
}
|
|
54
|
-
/** Intermediate builder — the only callable method is `.metadata()`. */
|
|
55
44
|
//#endregion
|
|
56
45
|
export { AnyStyleProp, ArbitraryEntry, ArbitrarySpec, StylePropMetadata };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ComponentRef, CompositeRef, RegisteredComponents, RegisteredComposites, RegisteredStyleProps, StylePropRef } from "./component-refs.js";
|
|
2
|
-
import { BoolMarker, ComponentConfigValue, ComposedLayer, CompositeBinding, EnumMarker, HtmlTag, LayerInput, PrimitiveLayer, PropBinding, SingleLayerCompositeBinding, StylePropBinding, SurfaceForward } from "./component-config.js";
|
|
2
|
+
import { BoolMarker, ComponentConfigValue, ComposedLayer, CompositeBinding, EnumMarker, HtmlTag, LayerInput, PrimitiveLayer, PrimitivePropBinding, PropBinding, RootTag, SingleLayerCompositeBinding, StylePropBinding, StylePropShorthand, SurfaceForward, VerbosePropBinding } from "./component-config.js";
|
|
3
|
+
import { Props } from "./Props.js";
|
|
4
|
+
import { BoundComponent } from "./defineComponent.js";
|
|
3
5
|
import { ColorFn, ColorKeyword, CssAngle, CssColor, CssLength, CssPercentage, CssRatio, CssTime, CssValue, CssValueTypeName, HexColor, HslColor, RgbColor } from "./types/css-values.js";
|
|
4
6
|
import { AnyStyleProp, ArbitraryEntry, ArbitrarySpec, StylePropMetadata } from "./defineStyleProp.js";
|
|
7
|
+
import { ResolvedStyleProp, ResolvedToken } from "./resolveStyleProp.js";
|
|
5
8
|
import { TokenType, VarGroupDef, VarTokenDef, VarsConfig } from "./types.js";
|
|
6
9
|
import { AtomicToken, BuildOptions, CheckForReservedModifiersInput, ComponentConfig, DefineComponentInput, DefineComponentMotionInput, ExampleDef, ExampleEntryDef, ExampleLayoutStyles, GetModifierFromInput, GlobalStylesDef, InterpolateMarker, ModeGroup, ModeOption, ModeOptionInput, ModeSetInput, ModesInput, ModifierDef, MotionPresetsDef, SingleComponentDef, UdsConfig, UdsConfigData, buildTokenReference, createConfigBuilder, darker, lighter, resolveConfig } from "./createConfig.js";
|
|
7
|
-
import { ResolvedStyleProp, ResolvedToken } from "./resolveStyleProp.js";
|
|
8
10
|
import { defaultColors } from "./consts/defaultColors.js";
|
|
9
11
|
import { SerializedConfig, TokenRef, buildReverseMap, deserializeConfig, serializeConfig } from "./serialize.js";
|
|
10
12
|
import { ComponentsConfig as ComponentsConfig$1 } from "@uds/types";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CssValueTypeName } from "./types/css-values.js";
|
|
2
2
|
import { ArbitrarySpec, StylePropMetadata } from "./defineStyleProp.js";
|
|
3
3
|
//#region ../config/dist/resolveStyleProp.d.ts
|
|
4
|
-
//#region src/resolveStyleProp.d.ts
|
|
5
4
|
interface ResolvedToken {
|
|
6
5
|
/** The token's raw key, e.g. `'brand'`. */
|
|
7
6
|
readonly name: string;
|
|
@@ -59,11 +58,5 @@ interface ResolvedStyleProp {
|
|
|
59
58
|
readonly arbitrary: ArbitrarySpec | undefined;
|
|
60
59
|
readonly metadata: StylePropMetadata;
|
|
61
60
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Structurally-loose input shape for the resolver. Any `StyleProp<P>` from
|
|
64
|
-
* `defineStyleProp` is assignable to this. Defined locally so the
|
|
65
|
-
* resolver's signature doesn't expand `ValuesEntry<P>` over the full CSS
|
|
66
|
-
* property union (TS2590).
|
|
67
|
-
*/
|
|
68
61
|
//#endregion
|
|
69
62
|
export { ResolvedStyleProp, ResolvedToken };
|
|
@@ -3,7 +3,6 @@ import { AtomicToken, ExampleDef, ModeGroup, ModifierDef, MotionPresetsDef, UdsC
|
|
|
3
3
|
import { CompositeStylesConfig } from "@uds/types";
|
|
4
4
|
|
|
5
5
|
//#region ../config/dist/serialize.d.ts
|
|
6
|
-
//#region src/serialize.d.ts
|
|
7
6
|
type ModifierNameShape = `_${string}`;
|
|
8
7
|
type TokenRef = {
|
|
9
8
|
$ref: string;
|
|
@@ -68,6 +67,6 @@ declare function serializeConfig(config: UdsConfig): SerializedConfig;
|
|
|
68
67
|
* Resolves `$ref` markers back to `var()` strings using the atomic token
|
|
69
68
|
* definitions, then reconstructs the builder chain.
|
|
70
69
|
*/
|
|
71
|
-
declare function deserializeConfig(data: SerializedConfig): UdsConfig;
|
|
70
|
+
declare function deserializeConfig(data: SerializedConfig): UdsConfig;
|
|
72
71
|
//#endregion
|
|
73
72
|
export { SerializedConfig, TokenRef, buildReverseMap, deserializeConfig, serializeConfig };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region ../config/dist/types/css-values.d.ts
|
|
2
|
-
//#region src/types/css-values.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* CSS value-type primitives — building blocks used by {@link CssPropertyValues}
|
|
5
4
|
* in `./css-properties` and by `defineStyleProp` to constrain authored values.
|
|
@@ -56,6 +55,6 @@ type CssValue = {
|
|
|
56
55
|
ident: string;
|
|
57
56
|
string: string;
|
|
58
57
|
};
|
|
59
|
-
type CssValueTypeName = keyof CssValue;
|
|
58
|
+
type CssValueTypeName = keyof CssValue;
|
|
60
59
|
//#endregion
|
|
61
60
|
export { ColorFn, ColorKeyword, CssAngle, CssColor, CssLength, CssPercentage, CssRatio, CssTime, CssValue, CssValueTypeName, HexColor, HslColor, RgbColor };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region ../config/dist/types.d.ts
|
|
2
|
-
//#region src/types.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Scalar DTCG-aligned token types. Composite types (shadow, gradient,
|
|
5
4
|
* typography, border, transition, cubicBezier) are intentionally deferred
|
|
@@ -60,6 +59,6 @@ type VarGroupDef<M extends `_${string}` = `_${string}`> = {
|
|
|
60
59
|
* spacing: { $type: 'dimension', 1: { value: '0.25rem' }, 2: { value: '0.5rem' } },
|
|
61
60
|
* }
|
|
62
61
|
*/
|
|
63
|
-
type VarsConfig<M extends `_${string}` = `_${string}`> = Record<string, VarGroupDef<M>>;
|
|
62
|
+
type VarsConfig<M extends `_${string}` = `_${string}`> = Record<string, VarGroupDef<M>>;
|
|
64
63
|
//#endregion
|
|
65
64
|
export { TokenType, VarGroupDef, VarTokenDef, VarsConfig };
|