@yahoo/uds-v5-wip 1.55.0 → 1.56.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/config/dist/Props.d.ts +5 -0
- package/dist/config/dist/component-config.d.ts +34 -0
- package/dist/config/dist/component-refs.d.ts +13 -0
- package/dist/config/dist/component-resolution.d.ts +1 -1
- package/dist/config/dist/consts/defaultColors.d.ts +2 -1
- package/dist/config/dist/createConfig.d.ts +25 -1
- package/dist/config/dist/createConfig.js +27 -4
- package/dist/config/dist/defineComponent.d.ts +7 -0
- package/dist/config/dist/defineStyleProp.d.ts +31 -1
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/config/dist/resolveStyleProp.d.ts +7 -0
- package/dist/config/dist/serialize.d.ts +2 -1
- package/dist/config/dist/types/css-values.d.ts +2 -1
- package/dist/config/dist/types.d.ts +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -3,6 +3,7 @@ import { ComponentConfigValue, HtmlTag, LayerInput, PropBinding } from "./compon
|
|
|
3
3
|
import { ComponentPropsWithoutRef, HTMLAttributes, JSX } from "react";
|
|
4
4
|
|
|
5
5
|
//#region ../config/dist/Props.d.ts
|
|
6
|
+
//#region src/Props.d.ts
|
|
6
7
|
/**
|
|
7
8
|
* Resolve the native HTML-attribute surface for the config's root tag.
|
|
8
9
|
*
|
|
@@ -65,5 +66,9 @@ interface DataAttrs {
|
|
|
65
66
|
type Props<TConfig extends ComponentConfigValue<Record<string, LayerInput>, Record<string, PropBinding>, HtmlTag | undefined>> = TConfig extends ComponentConfigValue<Record<string, LayerInput>, infer TProps extends Record<string, PropBinding>, infer TTag extends HtmlTag | undefined> ? Prettify<PropsFromConfig<TProps> & Omit<ElementProps<TTag>, keyof TProps> & DataAttrs & {
|
|
66
67
|
as?: string;
|
|
67
68
|
}> : never;
|
|
69
|
+
/**
|
|
70
|
+
* `Props<typeof boxConfig>` for the common 'use the config's inferred
|
|
71
|
+
* type' invocation. Keeps `box.tsx` from having to repeat the generic.
|
|
72
|
+
*/
|
|
68
73
|
//#endregion
|
|
69
74
|
export { Props };
|
|
@@ -3,6 +3,7 @@ import * as React$1 from "react";
|
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region ../config/dist/component-config.d.ts
|
|
6
|
+
//#region src/component-config.d.ts
|
|
6
7
|
/**
|
|
7
8
|
* HTML tag literal. The TypeScript type is `string` (any tag name);
|
|
8
9
|
* runtime renders it via `React.createElement(tag, ...)`.
|
|
@@ -108,6 +109,17 @@ interface CompositeBinding {
|
|
|
108
109
|
composite: CompositeRef;
|
|
109
110
|
layers: Record<string, string>;
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Forward a JSX prop value to one of the component's layers as an
|
|
114
|
+
* existing surface key. The runtime-side / read-side shape — `layer`
|
|
115
|
+
* and `from` are bare strings. Type-guards in `bindRender` use the
|
|
116
|
+
* absence of `styleProp` / `composite` keys to discriminate this shape
|
|
117
|
+
* from the registered-binding shapes.
|
|
118
|
+
*
|
|
119
|
+
* Authoring sites get the narrower `TypedForwardBinding<TLayers>`
|
|
120
|
+
* (below) via `VerbosePropBinding<TLayers>`, which structurally
|
|
121
|
+
* extends this loose form.
|
|
122
|
+
*/
|
|
111
123
|
/**
|
|
112
124
|
* Authoring-site form of `ForwardBinding`, narrowed against the
|
|
113
125
|
* component's own layer map. Distributes over `keyof TLayers` so:
|
|
@@ -188,6 +200,14 @@ type PrimitivePropBinding<TLayers extends Record<string, LayerInput> = Record<st
|
|
|
188
200
|
* tighter `VerbosePropBinding`.
|
|
189
201
|
*/
|
|
190
202
|
type PropBinding<TLayers extends Record<string, LayerInput> = Record<string, LayerInput>> = PrimitivePropBinding<TLayers>;
|
|
203
|
+
/**
|
|
204
|
+
* Marker for a boolean JSX prop. Use inside the `props` block:
|
|
205
|
+
*
|
|
206
|
+
* props: {
|
|
207
|
+
* loading: bool(),
|
|
208
|
+
* disabled: bool(),
|
|
209
|
+
* }
|
|
210
|
+
*/
|
|
191
211
|
/**
|
|
192
212
|
* Names of prop bindings that participate in matrix/strip iteration —
|
|
193
213
|
* i.e. props authored as `enums({...})` or `bool()`. Other prop bindings
|
|
@@ -275,6 +295,15 @@ interface CompoundVariant {
|
|
|
275
295
|
conditions: Record<string, string>;
|
|
276
296
|
styles: Record<string, Record<string, unknown>>;
|
|
277
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* The architecture-doc-target component config. Distinct from today's
|
|
300
|
+
* `SingleComponentDef` (`base` + `variants` shape) — this is the
|
|
301
|
+
* pure-data, layers-first shape the new `defineComponent` accepts.
|
|
302
|
+
*
|
|
303
|
+
* `TLayers` is inferred from the `layers` block so prop bindings can
|
|
304
|
+
* narrow their `layer` field against the component's actual layer
|
|
305
|
+
* names; typos surface at the authoring site.
|
|
306
|
+
*/
|
|
278
307
|
/**
|
|
279
308
|
* Branded shape returned by `defineComponent({...})`. Carries `layers`,
|
|
280
309
|
* `props`, AND a phantom `__tag` slot as const-narrowed types so
|
|
@@ -311,5 +340,10 @@ interface ComponentConfigValue<TLayers extends Record<string, LayerInput>, TProp
|
|
|
311
340
|
*/
|
|
312
341
|
readonly examples?: Examples<TProps>;
|
|
313
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* The bundle passed to the render function for each layer — a ready-to-
|
|
345
|
+
* spread object with `className` and any forwarded attrs. The render
|
|
346
|
+
* function destructures `props.<layerName>` into the JSX position.
|
|
347
|
+
*/
|
|
314
348
|
//#endregion
|
|
315
349
|
export { BoolMarker, ComponentConfigValue, ComposedLayer, CompositeBinding, CompoundVariant, EnumMarker, HtmlTag, LayerInput, PrimitiveLayer, PrimitivePropBinding, PropBinding, RootTag, SingleLayerCompositeBinding, StylePropBinding, StylePropShorthand, VerbosePropBinding };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region ../config/dist/component-refs.d.ts
|
|
2
|
+
//#region src/component-refs.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* Augmentable registries + template-literal ref types for the
|
|
4
5
|
* component-API surface.
|
|
@@ -63,6 +64,14 @@ interface RegisteredStyleProps {}
|
|
|
63
64
|
* call.
|
|
64
65
|
*/
|
|
65
66
|
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
|
+
*/
|
|
66
75
|
/**
|
|
67
76
|
* Brace-wrapped reference to a registered React component. Falls open
|
|
68
77
|
* to `'{${string}}'` when the registry is unaugmented (e.g. inside
|
|
@@ -81,5 +90,9 @@ type StylePropRef = [keyof RegisteredStyleProps] extends [never] ? `{${string}}`
|
|
|
81
90
|
* when unaugmented.
|
|
82
91
|
*/
|
|
83
92
|
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
|
+
*/
|
|
84
97
|
//#endregion
|
|
85
98
|
export { ComponentRef, CompositeRef, RegisteredComponents, RegisteredComposites, RegisteredStyleProps, StylePropRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region ../config/dist/consts/defaultColors.d.ts
|
|
2
|
+
//#region src/consts/defaultColors.d.ts
|
|
2
3
|
declare const defaultColors: {
|
|
3
4
|
inherit: string;
|
|
4
5
|
current: string;
|
|
@@ -247,6 +248,6 @@ declare const defaultColors: {
|
|
|
247
248
|
'rose-800': string;
|
|
248
249
|
'rose-900': string;
|
|
249
250
|
'rose-950': string;
|
|
250
|
-
};
|
|
251
|
+
}; //#endregion
|
|
251
252
|
//#endregion
|
|
252
253
|
export { defaultColors };
|
|
@@ -6,14 +6,27 @@ import { ResolvedStyleProp } from "./resolveStyleProp.js";
|
|
|
6
6
|
import { BaseModifierProp, ComponentsConfig, CompositeStylesConfig, ConfigurableProp, ModifierProp, MotionPreset, RemotionComponentDef, RemotionConfig, RemotionTransitionDef } from "@uds/types";
|
|
7
7
|
|
|
8
8
|
//#region ../config/dist/createConfig.d.ts
|
|
9
|
+
//#region src/createConfig.d.ts
|
|
9
10
|
type MotionPresetsDef = Record<string, MotionPreset>;
|
|
10
11
|
type MotionAliasValue<TMotion> = TMotion extends Record<string, infer V> ? Extract<V, string> : never;
|
|
11
12
|
type EmptyMotion = {};
|
|
12
13
|
type EmptyCompositeStyles = {};
|
|
13
14
|
/**
|
|
14
15
|
* Transform composite-styles config type into the reference shape passed to
|
|
15
|
-
* defineModifiers
|
|
16
|
+
* `defineModifiers`. Walks `T[K]['styles'][V]` so the modifier callback can
|
|
16
17
|
* write `compositeStyles.elevation['1'].className` (flat for ergonomics).
|
|
18
|
+
*
|
|
19
|
+
* Kept for the legacy callback API. New code should prefer the brace-ref
|
|
20
|
+
* form for selector authoring:
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* .defineModifiers([
|
|
24
|
+
* { modifier: '_onElevated', selector: '{composite/elevation/1}' },
|
|
25
|
+
* ])
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* The `{composite/<group>/<value>}` ref expands to a container style query
|
|
29
|
+
* at `defineModifiers` time. See [[UDS-1644]].
|
|
17
30
|
*/
|
|
18
31
|
type CompositeStylesReference<T> = { [K in keyof T]: T[K] extends {
|
|
19
32
|
styles: infer S;
|
|
@@ -78,6 +91,12 @@ type GetModifierFromInput<I extends ModesInput> = { [SetKey in keyof I]: { [OptK
|
|
|
78
91
|
} ? M extends ModifierNameShape ? M : never : OptKey extends string ? `_${OptKey}` : never }[keyof I[SetKey]['options']] }[keyof I];
|
|
79
92
|
/** Reject any input whose derived/explicit modifiers collide with reserved names. */
|
|
80
93
|
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;
|
|
94
|
+
/**
|
|
95
|
+
* Convert the authored object-keyed input into the internal `ModeGroup[]` shape.
|
|
96
|
+
* Derives `_${optionKey}` modifiers when no explicit `modifier` is provided.
|
|
97
|
+
* Never sets `default: true` — the new API has no concept of a default option;
|
|
98
|
+
* downstream consumers treat "no option active" as the implicit default.
|
|
99
|
+
*/
|
|
81
100
|
interface ModifierDef {
|
|
82
101
|
modifier: ModifierNameShape;
|
|
83
102
|
selector: string;
|
|
@@ -157,6 +176,7 @@ type VarsToTokens<TVars extends VarsConfig> = { [K in keyof TVars]: { [T in Excl
|
|
|
157
176
|
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 };
|
|
158
177
|
/** Build a structured token reference object from atomic tokens */
|
|
159
178
|
declare function buildTokenReference(atomic: AtomicToken<ModifierNameShape>[], configPrefix: string): Record<string, Record<string, string>>;
|
|
179
|
+
/** Build a structured composite-styles reference object for use in defineModifiers context */
|
|
160
180
|
/** Global styles definition — CSS selector → style props */
|
|
161
181
|
type GlobalStylesDef = Record<string, Record<string, any>>;
|
|
162
182
|
/** CSS properties for the example wrapper element */
|
|
@@ -360,6 +380,10 @@ interface UdsConfig<TModifier extends ModifierNameShape = ModifierProp, TTokens
|
|
|
360
380
|
type AnyUdsConfig = UdsConfig<ModifierNameShape, any, any, any, any, any, any>;
|
|
361
381
|
/** Extract the raw config data from a builder instance */
|
|
362
382
|
declare function resolveConfig(config: AnyUdsConfig): UdsConfigData;
|
|
383
|
+
/**
|
|
384
|
+
* Resolve configuration with all token references replaced by their raw values.
|
|
385
|
+
* Useful for tools that need the actual values (e.g. anatomy generation).
|
|
386
|
+
*/
|
|
363
387
|
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;
|
|
364
388
|
interface InterpolateMarker {
|
|
365
389
|
__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";
|
|
8
7
|
import { resolveTokenType, sniffTokenTypeFromValue } from "./resolveTokenTypes.js";
|
|
9
8
|
import { resolveStyleProp } from "./resolveStyleProp.js";
|
|
9
|
+
import { applyPresetToData, deepMerge, mergeAtomic } from "./preset-merge.js";
|
|
10
10
|
import { setRegisteredStyleProps } from "./runtime-registry.js";
|
|
11
11
|
//#region ../config/dist/createConfig.js
|
|
12
12
|
/** biome-ignore-all lint/suspicious/noExplicitAny: necessary for dynamic builder to work correctly */
|
|
@@ -75,6 +75,26 @@ function buildCompositeStylesReference(compositeStyles) {
|
|
|
75
75
|
return result;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
+
* Resolve `{composite/<group>/<value>}` brace-refs in a modifier `selector`
|
|
79
|
+
* string. Each ref expands to a CSS container style query targeting the
|
|
80
|
+
* composite's custom-property marker:
|
|
81
|
+
*
|
|
82
|
+
* `{composite/elevation/1}`
|
|
83
|
+
* → `@container style(--uds-composite-elevation: 1)`
|
|
84
|
+
*
|
|
85
|
+
* Multiple refs in the same string are supported. Unknown refs (composite
|
|
86
|
+
* group not in config, or value not in that group's styles) pass through
|
|
87
|
+
* unchanged so the caller can spot the typo at use time. See [[UDS-1644]].
|
|
88
|
+
*/
|
|
89
|
+
const COMPOSITE_REF_PATTERN = /\{composite\/([^/{}]+)\/([^/{}]+)\}/g;
|
|
90
|
+
function resolveCompositeRefsInSelector(selector, compositeStyles) {
|
|
91
|
+
return selector.replace(COMPOSITE_REF_PATTERN, (raw, groupName, valueName) => {
|
|
92
|
+
const def = compositeStyles[groupName];
|
|
93
|
+
if (!def || !def.styles[valueName]) return raw;
|
|
94
|
+
return `@container style(--uds-composite-${safeTokenName(groupName)}: ${safeTokenName(valueName)})`;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
78
98
|
* Migrate legacy `macros` JSON (the pre-rename shape) into the new
|
|
79
99
|
* `compositeStyles` shape. Each old key (`elevation`) becomes a `{ label,
|
|
80
100
|
* styles }` def so older serialized configs (in `uds.config.json`,
|
|
@@ -370,13 +390,16 @@ function createConfigBuilder(data, extensions) {
|
|
|
370
390
|
}, extensions);
|
|
371
391
|
},
|
|
372
392
|
defineModifiers(params) {
|
|
373
|
-
const
|
|
393
|
+
const resolvedWithComposites = (typeof params === "function" ? params({
|
|
374
394
|
tokens: buildTokenReference(data.atomic, data.prefix),
|
|
375
395
|
compositeStyles: buildCompositeStylesReference(data.compositeStyles)
|
|
376
|
-
}) : params
|
|
396
|
+
}) : params).map((def) => ({
|
|
397
|
+
...def,
|
|
398
|
+
selector: resolveCompositeRefsInSelector(def.selector, data.compositeStyles)
|
|
399
|
+
}));
|
|
377
400
|
return createConfigBuilder({
|
|
378
401
|
...data,
|
|
379
|
-
modifiers: [...data.modifiers, ...
|
|
402
|
+
modifiers: [...data.modifiers, ...resolvedWithComposites]
|
|
380
403
|
}, extensions);
|
|
381
404
|
},
|
|
382
405
|
defineCompositeStyles(params) {
|
|
@@ -3,6 +3,7 @@ import { Props } from "./Props.js";
|
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region ../config/dist/defineComponent.d.ts
|
|
6
|
+
//#region src/defineComponent.d.ts
|
|
6
7
|
/**
|
|
7
8
|
* A React component bound to a `defineComponent` config, with the
|
|
8
9
|
* source config attached as a phantom type slot. Tools (codegen,
|
|
@@ -13,5 +14,11 @@ import { ReactNode } from "react";
|
|
|
13
14
|
type BoundComponent<TConfig extends ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined>, TExtra extends Record<string, unknown> = {}> = React.FC<Props<TConfig> & TExtra> & {
|
|
14
15
|
readonly __config: TConfig;
|
|
15
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* A `defineComponent({...})` config value with a `.render(fn)` builder
|
|
19
|
+
* method bolted on. The builder is non-enumerable so JSON serialization
|
|
20
|
+
* still produces pure data — codegen can read `__kind`, `layers`,
|
|
21
|
+
* `props`, and `defaultProps` without seeing the render hook.
|
|
22
|
+
*/
|
|
16
23
|
//#endregion
|
|
17
24
|
export { BoundComponent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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,10 +22,31 @@ 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
|
+
*/
|
|
25
31
|
type StylePropMetadata = {
|
|
26
32
|
label?: string;
|
|
27
33
|
description?: string;
|
|
28
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* A finalized style prop. Returned by `defineStyleProp(spec)` (or the
|
|
37
|
+
* `.metadata({...})` chain). Consumers wrap these in
|
|
38
|
+
* `uds.registerStyleProps({ <propName>: ... })`.
|
|
39
|
+
*
|
|
40
|
+
* `cssProperty` is passed through verbatim from the authored input:
|
|
41
|
+
* - **string** — a direct prop writing one CSS property.
|
|
42
|
+
* - **`readonly string[]`** — a fan-out prop writing every CSS
|
|
43
|
+
* property in the list (e.g. `borderRadiusStart` covering both
|
|
44
|
+
* start-side corners).
|
|
45
|
+
*
|
|
46
|
+
* Readers that need iteration normalize at the call site
|
|
47
|
+
* (`Array.isArray(p) ? p : [p]`); readers that only need the primary
|
|
48
|
+
* use the string directly or `Array.isArray(p) ? p[0] : p`.
|
|
49
|
+
*/
|
|
29
50
|
/**
|
|
30
51
|
* Internal shape attached to a {@link StyleProp} by `.withOpacity()`.
|
|
31
52
|
* The resolver inspects this at `resolveConfig` time to synthesize a
|
|
@@ -59,5 +80,14 @@ interface AnyStyleProp {
|
|
|
59
80
|
readonly metadata: StylePropMetadata;
|
|
60
81
|
readonly opacityPair?: OpacityPairSpec;
|
|
61
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Return shape of {@link defineStyleProp}. The `metadata` field doubles as
|
|
85
|
+
* a callable chain: read it to access `{ label?, description? }` (both
|
|
86
|
+
* optional, so an unset metadata reads `undefined` for either field) or
|
|
87
|
+
* call it as `.metadata({ label, description })` to attach metadata and
|
|
88
|
+
* get back a plain {@link StyleProp}. A function satisfies the
|
|
89
|
+
* {@link StylePropMetadata} structural shape because both fields are
|
|
90
|
+
* optional, so the dual nature is type-safe.
|
|
91
|
+
*/
|
|
62
92
|
//#endregion
|
|
63
93
|
export { AnyStyleProp, ArbitraryEntry, ArbitrarySpec, StylePropMetadata };
|
|
@@ -5,8 +5,8 @@ import { BoundComponent } from "./defineComponent.js";
|
|
|
5
5
|
import { ColorFn, ColorKeyword, CssAngle, CssColor, CssLength, CssPercentage, CssRatio, CssTime, CssValue, CssValueTypeName, HexColor, HslColor, RgbColor } from "./types/css-values.js";
|
|
6
6
|
import { AnyStyleProp, ArbitraryEntry, ArbitrarySpec, StylePropMetadata } from "./defineStyleProp.js";
|
|
7
7
|
import { TokenType, VarGroupDef, VarTokenDef, VarsConfig } from "./types.js";
|
|
8
|
-
import { ResolvedStyleProp, ResolvedToken } from "./resolveStyleProp.js";
|
|
9
8
|
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";
|
|
9
|
+
import { ResolvedStyleProp, ResolvedToken } from "./resolveStyleProp.js";
|
|
10
10
|
import { defaultColors } from "./consts/defaultColors.js";
|
|
11
11
|
import { SerializedConfig, TokenRef, buildReverseMap, deserializeConfig, serializeConfig } from "./serialize.js";
|
|
12
12
|
import { ComponentsConfig as ComponentsConfig$1 } from "@uds/types";
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
|
4
5
|
interface ResolvedToken {
|
|
5
6
|
/** The token's raw key, e.g. `'brand'`. */
|
|
6
7
|
readonly name: string;
|
|
@@ -77,5 +78,11 @@ interface ResolvedStyleProp {
|
|
|
77
78
|
readonly arbitrary: ArbitrarySpec | undefined;
|
|
78
79
|
readonly metadata: StylePropMetadata;
|
|
79
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Structurally-loose input shape for the resolver. Any `StyleProp<P>` from
|
|
83
|
+
* `defineStyleProp` is assignable to this. Defined locally so the
|
|
84
|
+
* resolver's signature doesn't expand `ValuesEntry<P>` over the full CSS
|
|
85
|
+
* property union (TS2590).
|
|
86
|
+
*/
|
|
80
87
|
//#endregion
|
|
81
88
|
export { ResolvedStyleProp, ResolvedToken };
|
|
@@ -3,6 +3,7 @@ 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
|
|
6
7
|
type ModifierNameShape = `_${string}`;
|
|
7
8
|
type TokenRef = {
|
|
8
9
|
$ref: string;
|
|
@@ -67,6 +68,6 @@ declare function serializeConfig(config: UdsConfig): SerializedConfig;
|
|
|
67
68
|
* Resolves `$ref` markers back to `var()` strings using the atomic token
|
|
68
69
|
* definitions, then reconstructs the builder chain.
|
|
69
70
|
*/
|
|
70
|
-
declare function deserializeConfig(data: SerializedConfig): UdsConfig;
|
|
71
|
+
declare function deserializeConfig(data: SerializedConfig): UdsConfig; //#endregion
|
|
71
72
|
//#endregion
|
|
72
73
|
export { SerializedConfig, TokenRef, buildReverseMap, deserializeConfig, serializeConfig };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region ../config/dist/types/css-values.d.ts
|
|
2
|
+
//#region src/types/css-values.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* CSS value-type primitives — building blocks used by {@link CssPropertyValues}
|
|
4
5
|
* in `./css-properties` and by `defineStyleProp` to constrain authored values.
|
|
@@ -55,6 +56,6 @@ type CssValue = {
|
|
|
55
56
|
ident: string;
|
|
56
57
|
string: string;
|
|
57
58
|
};
|
|
58
|
-
type CssValueTypeName = keyof CssValue;
|
|
59
|
+
type CssValueTypeName = keyof CssValue; //#endregion
|
|
59
60
|
//#endregion
|
|
60
61
|
export { ColorFn, ColorKeyword, CssAngle, CssColor, CssLength, CssPercentage, CssRatio, CssTime, CssValue, CssValueTypeName, HexColor, HslColor, RgbColor };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region ../config/dist/types.d.ts
|
|
2
|
+
//#region src/types.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* Scalar DTCG-aligned token types. Composite types (shadow, gradient,
|
|
4
5
|
* typography, border, transition, cubicBezier) are intentionally deferred
|
|
@@ -66,6 +67,6 @@ type VarGroupDef<M extends `_${string}` = `_${string}`> = {
|
|
|
66
67
|
* spacing: { $type: 'dimension', 1: { value: '0.25rem' }, 2: { value: '0.5rem' } },
|
|
67
68
|
* }
|
|
68
69
|
*/
|
|
69
|
-
type VarsConfig<M extends `_${string}` = `_${string}`> = Record<string, VarGroupDef<M>>;
|
|
70
|
+
type VarsConfig<M extends `_${string}` = `_${string}`> = Record<string, VarGroupDef<M>>; //#endregion
|
|
70
71
|
//#endregion
|
|
71
72
|
export { TokenType, VarGroupDef, VarTokenDef, VarsConfig };
|