@yahoo/uds-v5-wip 1.41.0 → 1.42.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 +0 -5
- package/dist/config/dist/component-config.d.ts +0 -14
- 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 +1 -13
- package/dist/config/dist/createConfig.js +1 -1
- package/dist/config/dist/defineComponent.d.ts +0 -7
- package/dist/config/dist/defineStyleProp.d.ts +2 -21
- package/dist/config/dist/defineStyleProp.js +11 -2
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/config/dist/resolveStyleProp.d.ts +6 -8
- package/dist/config/dist/resolveStyleProp.js +4 -3
- 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/config.d.ts +2 -2
- package/dist/foundational-presets/dist/boldVibrant.d.ts +4 -4
- package/dist/foundational-presets/dist/brutalist.d.ts +4 -4
- package/dist/foundational-presets/dist/candy.d.ts +4 -4
- package/dist/foundational-presets/dist/cleanMinimalist.d.ts +4 -4
- package/dist/foundational-presets/dist/corporate.d.ts +4 -4
- package/dist/foundational-presets/dist/darkMoody.d.ts +4 -4
- package/dist/foundational-presets/dist/defaultPreset.d.ts +2 -2
- package/dist/foundational-presets/dist/forest.d.ts +4 -4
- package/dist/foundational-presets/dist/highContrast.d.ts +4 -4
- package/dist/foundational-presets/dist/lavender.d.ts +4 -4
- package/dist/foundational-presets/dist/luxury.d.ts +4 -4
- package/dist/foundational-presets/dist/monochrome.d.ts +4 -4
- package/dist/foundational-presets/dist/neonCyber.d.ts +4 -4
- package/dist/foundational-presets/dist/newspaper.d.ts +4 -4
- package/dist/foundational-presets/dist/ocean.d.ts +4 -4
- package/dist/foundational-presets/dist/slate.d.ts +4 -4
- package/dist/foundational-presets/dist/style-props.js +4 -4
- package/dist/foundational-presets/dist/sunset.d.ts +4 -4
- package/dist/foundational-presets/dist/terminal.d.ts +4 -4
- package/dist/foundational-presets/dist/warmOrganic.d.ts +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,6 @@ 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
|
|
7
6
|
/**
|
|
8
7
|
* Resolve the native HTML-attribute surface for the config's root tag.
|
|
9
8
|
*
|
|
@@ -66,9 +65,5 @@ interface DataAttrs {
|
|
|
66
65
|
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 & {
|
|
67
66
|
as?: string;
|
|
68
67
|
}> : 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
|
-
*/
|
|
73
68
|
//#endregion
|
|
74
69
|
export { Props };
|
|
@@ -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, ...)`.
|
|
@@ -159,14 +158,6 @@ type PrimitivePropBinding = StylePropShorthand | VerbosePropBinding;
|
|
|
159
158
|
* tighter `VerbosePropBinding`.
|
|
160
159
|
*/
|
|
161
160
|
type PropBinding = PrimitivePropBinding;
|
|
162
|
-
/**
|
|
163
|
-
* Marker for a boolean JSX prop. Use inside the `props` block:
|
|
164
|
-
*
|
|
165
|
-
* props: {
|
|
166
|
-
* loading: bool(),
|
|
167
|
-
* disabled: bool(),
|
|
168
|
-
* }
|
|
169
|
-
*/
|
|
170
161
|
/**
|
|
171
162
|
* Branded shape returned by `defineComponent({...})`. Carries `layers`,
|
|
172
163
|
* `props`, AND a phantom `__tag` slot as const-narrowed types so
|
|
@@ -192,10 +183,5 @@ interface ComponentConfigValue<TLayers extends Record<string, LayerInput>, TProp
|
|
|
192
183
|
readonly props?: TProps;
|
|
193
184
|
readonly defaultProps?: Record<string, unknown>;
|
|
194
185
|
}
|
|
195
|
-
/**
|
|
196
|
-
* The bundle passed to the render function for each layer — a ready-to-
|
|
197
|
-
* spread object with `className` and any forwarded attrs. The render
|
|
198
|
-
* function destructures `props.<layerName>` into the JSX position.
|
|
199
|
-
*/
|
|
200
186
|
//#endregion
|
|
201
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,12 +1,11 @@
|
|
|
1
1
|
import { ComponentConfigValue } from "./component-config.js";
|
|
2
2
|
import { BoundComponent } from "./defineComponent.js";
|
|
3
3
|
import { AnyStyleProp } from "./defineStyleProp.js";
|
|
4
|
-
import { TokenType, VarsConfig } from "./types.js";
|
|
5
4
|
import { ResolvedStyleProp } from "./resolveStyleProp.js";
|
|
5
|
+
import { TokenType, VarsConfig } from "./types.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
|
|
10
9
|
type MotionPresetsDef = Record<string, MotionPreset>;
|
|
11
10
|
type MotionAliasValue<TMotion> = TMotion extends Record<string, infer V> ? Extract<V, string> : never;
|
|
12
11
|
type EmptyMotion = {};
|
|
@@ -79,12 +78,6 @@ type GetModifierFromInput<I extends ModesInput> = { [SetKey in keyof I]: { [OptK
|
|
|
79
78
|
} ? M extends ModifierNameShape ? M : never : OptKey extends string ? `_${OptKey}` : never }[keyof I[SetKey]['options']] }[keyof I];
|
|
80
79
|
/** Reject any input whose derived/explicit modifiers collide with reserved names. */
|
|
81
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;
|
|
82
|
-
/**
|
|
83
|
-
* Convert the authored object-keyed input into the internal `ModeGroup[]` shape.
|
|
84
|
-
* Derives `_${optionKey}` modifiers when no explicit `modifier` is provided.
|
|
85
|
-
* Never sets `default: true` — the new API has no concept of a default option;
|
|
86
|
-
* downstream consumers treat "no option active" as the implicit default.
|
|
87
|
-
*/
|
|
88
81
|
interface ModifierDef {
|
|
89
82
|
modifier: ModifierNameShape;
|
|
90
83
|
selector: string;
|
|
@@ -164,7 +157,6 @@ type VarsToTokens<TVars extends VarsConfig> = { [K in keyof TVars]: { [T in Excl
|
|
|
164
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 };
|
|
165
158
|
/** Build a structured token reference object from atomic tokens */
|
|
166
159
|
declare function buildTokenReference(atomic: AtomicToken<ModifierNameShape>[], configPrefix: string): Record<string, Record<string, string>>;
|
|
167
|
-
/** Build a structured composite-styles reference object for use in defineModifiers context */
|
|
168
160
|
/** Global styles definition — CSS selector → style props */
|
|
169
161
|
type GlobalStylesDef = Record<string, Record<string, any>>;
|
|
170
162
|
/** CSS properties for the example wrapper element */
|
|
@@ -357,10 +349,6 @@ interface UdsConfig<TModifier extends ModifierNameShape = ModifierProp, TTokens
|
|
|
357
349
|
type AnyUdsConfig = UdsConfig<ModifierNameShape, any, any, any, any, any, any>;
|
|
358
350
|
/** Extract the raw config data from a builder instance */
|
|
359
351
|
declare function resolveConfig(config: AnyUdsConfig): UdsConfigData;
|
|
360
|
-
/**
|
|
361
|
-
* Resolve configuration with all token references replaced by their raw values.
|
|
362
|
-
* Useful for tools that need the actual values (e.g. anatomy generation).
|
|
363
|
-
*/
|
|
364
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;
|
|
365
353
|
interface InterpolateMarker {
|
|
366
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
|
/**
|
|
@@ -3,7 +3,6 @@ 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
|
|
7
6
|
/**
|
|
8
7
|
* A React component bound to a `defineComponent` config, with the
|
|
9
8
|
* source config attached as a phantom type slot. Tools (codegen,
|
|
@@ -14,11 +13,5 @@ import { ReactNode } from "react";
|
|
|
14
13
|
type BoundComponent<TConfig extends ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined>, TExtra extends Record<string, unknown> = {}> = React.FC<Props<TConfig> & TExtra> & {
|
|
15
14
|
readonly __config: TConfig;
|
|
16
15
|
};
|
|
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
|
-
*/
|
|
23
16
|
//#endregion
|
|
24
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
|
|
@@ -44,21 +34,12 @@ type StylePropMetadata = {
|
|
|
44
34
|
*/
|
|
45
35
|
interface AnyStyleProp {
|
|
46
36
|
readonly kind: 'styleProp';
|
|
47
|
-
readonly cssProperty: string;
|
|
37
|
+
readonly cssProperty: string | readonly string[];
|
|
48
38
|
readonly classPrefix: string;
|
|
49
39
|
readonly values: readonly unknown[];
|
|
50
40
|
readonly arbitrary?: ArbitrarySpec;
|
|
51
41
|
readonly cssType?: CssValueTypeName;
|
|
52
42
|
readonly metadata: StylePropMetadata;
|
|
53
43
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Return shape of {@link defineStyleProp}. The `metadata` field doubles as
|
|
56
|
-
* a callable chain: read it to access `{ label?, description? }` (both
|
|
57
|
-
* optional, so an unset metadata reads `undefined` for either field) or
|
|
58
|
-
* call it as `.metadata({ label, description })` to attach metadata and
|
|
59
|
-
* get back a plain {@link StyleProp}. A function satisfies the
|
|
60
|
-
* {@link StylePropMetadata} structural shape because both fields are
|
|
61
|
-
* optional, so the dual nature is type-safe.
|
|
62
|
-
*/
|
|
63
44
|
//#endregion
|
|
64
45
|
export { AnyStyleProp, ArbitraryEntry, ArbitrarySpec, StylePropMetadata };
|
|
@@ -14,8 +14,17 @@ const CUSTOM_PROPERTY_PREFIX = "--";
|
|
|
14
14
|
* registration.
|
|
15
15
|
*/
|
|
16
16
|
function defineStyleProp(spec) {
|
|
17
|
-
const { cssProperty, classPrefix, values, arbitrary, cssType } = spec;
|
|
18
|
-
|
|
17
|
+
const { cssProperty: cssPropertyInput, classPrefix, values, arbitrary, cssType } = spec;
|
|
18
|
+
let cssProperty;
|
|
19
|
+
if (Array.isArray(cssPropertyInput)) {
|
|
20
|
+
const deduped = Array.from(new Set(cssPropertyInput));
|
|
21
|
+
if (deduped.length === 0) throw new Error("defineStyleProp: `cssProperty` array must contain at least one CSS property.");
|
|
22
|
+
cssProperty = deduped;
|
|
23
|
+
} else cssProperty = cssPropertyInput;
|
|
24
|
+
const allProperties = Array.isArray(cssProperty) ? cssProperty : [cssProperty];
|
|
25
|
+
const hasCustom = allProperties.some((p) => p.startsWith(CUSTOM_PROPERTY_PREFIX));
|
|
26
|
+
if (allProperties.length > 1 && hasCustom) throw new Error(`defineStyleProp: \`cssProperty\` arrays must be standard CSS properties only; custom (\`--*\`) properties must use the single-string form. Got ${JSON.stringify(cssProperty)}.`);
|
|
27
|
+
const isCustomProperty = hasCustom;
|
|
19
28
|
if (isCustomProperty && cssType === void 0) throw new Error(`defineStyleProp: cssType is required for custom CSS properties (got cssProperty=${JSON.stringify(cssProperty)}).`);
|
|
20
29
|
if (!isCustomProperty && cssType !== void 0) throw new Error(`defineStyleProp: cssType is only allowed for custom CSS properties (--*). Got cssProperty=${JSON.stringify(cssProperty)} with cssType=${JSON.stringify(cssType)}.`);
|
|
21
30
|
const baseFields = {
|
|
@@ -4,9 +4,9 @@ import { Props } from "./Props.js";
|
|
|
4
4
|
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
|
+
import { ResolvedStyleProp, ResolvedToken } from "./resolveStyleProp.js";
|
|
7
8
|
import { TokenType, VarGroupDef, VarTokenDef, VarsConfig } from "./types.js";
|
|
8
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";
|
|
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,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;
|
|
@@ -45,7 +44,12 @@ interface ResolvedToken {
|
|
|
45
44
|
interface ResolvedStyleProp {
|
|
46
45
|
/** The JSX prop name — the map key from `registerStyleProps({...})`. */
|
|
47
46
|
readonly propName: string;
|
|
48
|
-
|
|
47
|
+
/** The CSS property (or properties) this prop writes — passed through
|
|
48
|
+
* verbatim from the source `defineStyleProp` input. Single string for
|
|
49
|
+
* direct props, array for fan-out props (e.g. `borderRadiusStart` →
|
|
50
|
+
* both start-side corners). Readers normalize at the call site
|
|
51
|
+
* (`Array.isArray(p) ? p : [p]`) when iteration matters. */
|
|
52
|
+
readonly cssProperty: string | readonly string[];
|
|
49
53
|
readonly classPrefix: string;
|
|
50
54
|
readonly tokens: readonly ResolvedToken[];
|
|
51
55
|
readonly literals: readonly (string | number | boolean)[];
|
|
@@ -59,11 +63,5 @@ interface ResolvedStyleProp {
|
|
|
59
63
|
readonly arbitrary: ArbitrarySpec | undefined;
|
|
60
64
|
readonly metadata: StylePropMetadata;
|
|
61
65
|
}
|
|
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
66
|
//#endregion
|
|
69
67
|
export { ResolvedStyleProp, ResolvedToken };
|
|
@@ -144,6 +144,7 @@ function resolveGroupTokens(group, cssProperty, configPrefix, namespace) {
|
|
|
144
144
|
*/
|
|
145
145
|
function resolveStyleProp(propName, styleProp, config) {
|
|
146
146
|
const { cssProperty, classPrefix, values, arbitrary, metadata } = styleProp;
|
|
147
|
+
const primaryCssProperty = Array.isArray(cssProperty) ? cssProperty[0] : cssProperty;
|
|
147
148
|
const configPrefix = config.prefix;
|
|
148
149
|
const tokens = [];
|
|
149
150
|
const literals = [];
|
|
@@ -166,7 +167,7 @@ function resolveStyleProp(propName, styleProp, config) {
|
|
|
166
167
|
const token = group.tokens.find((t) => t.name === parsed.key);
|
|
167
168
|
if (!token) continue;
|
|
168
169
|
const valueType = detectTokenValueType(token, group);
|
|
169
|
-
if (!isTokenAcceptedByProperty(
|
|
170
|
+
if (!isTokenAcceptedByProperty(primaryCssProperty, valueType, token.value)) continue;
|
|
170
171
|
const safeName = safeTokenName(token.name);
|
|
171
172
|
const varPrefix = group.cssPrefix ?? group.namespace ?? parsed.group;
|
|
172
173
|
tokens.push({
|
|
@@ -179,7 +180,7 @@ function resolveStyleProp(propName, styleProp, config) {
|
|
|
179
180
|
cssVar: buildCssVar(configPrefix, varPrefix, safeName),
|
|
180
181
|
modifiers: token.modifiers
|
|
181
182
|
});
|
|
182
|
-
} else tokens.push(...resolveGroupTokens(group,
|
|
183
|
+
} else tokens.push(...resolveGroupTokens(group, primaryCssProperty, configPrefix));
|
|
183
184
|
continue;
|
|
184
185
|
}
|
|
185
186
|
if (isNamespacedRef(entry)) {
|
|
@@ -187,7 +188,7 @@ function resolveStyleProp(propName, styleProp, config) {
|
|
|
187
188
|
if (!parsed || parsed.key !== void 0) continue;
|
|
188
189
|
const group = findGroup(config.atomic, parsed.group);
|
|
189
190
|
if (!group) continue;
|
|
190
|
-
tokens.push(...resolveGroupTokens(group,
|
|
191
|
+
tokens.push(...resolveGroupTokens(group, primaryCssProperty, configPrefix, entry.namespace));
|
|
191
192
|
continue;
|
|
192
193
|
}
|
|
193
194
|
if (typeof entry === "object" && entry !== null && "alias" in entry && "value" in entry) {
|
|
@@ -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 };
|
package/dist/config.d.ts
CHANGED
|
@@ -223,8 +223,8 @@ declare const defaultPreset: UdsConfig<_$_uds_types0.ModifierProp | GetModifierF
|
|
|
223
223
|
0: string;
|
|
224
224
|
4: string;
|
|
225
225
|
1: string;
|
|
226
|
-
px: string;
|
|
227
226
|
2: string;
|
|
227
|
+
px: string;
|
|
228
228
|
8: string;
|
|
229
229
|
0.5: string;
|
|
230
230
|
1.5: string;
|
|
@@ -359,12 +359,12 @@ declare const defaultPreset: UdsConfig<_$_uds_types0.ModifierProp | GetModifierF
|
|
|
359
359
|
4: string;
|
|
360
360
|
full: string;
|
|
361
361
|
1: string;
|
|
362
|
+
2: string;
|
|
362
363
|
"1/2": string;
|
|
363
364
|
"1/3": string;
|
|
364
365
|
"2/3": string;
|
|
365
366
|
"1/4": string;
|
|
366
367
|
"3/4": string;
|
|
367
|
-
2: string;
|
|
368
368
|
8: string;
|
|
369
369
|
0.5: string;
|
|
370
370
|
1.5: string;
|
|
@@ -387,8 +387,8 @@ declare const boldVibrantFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp
|
|
|
387
387
|
0: string;
|
|
388
388
|
4: string;
|
|
389
389
|
1: string;
|
|
390
|
-
px: string;
|
|
391
390
|
2: string;
|
|
391
|
+
px: string;
|
|
392
392
|
8: string;
|
|
393
393
|
0.5: string;
|
|
394
394
|
1.5: string;
|
|
@@ -423,8 +423,8 @@ declare const boldVibrantFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp
|
|
|
423
423
|
0: string;
|
|
424
424
|
4: string;
|
|
425
425
|
1: string;
|
|
426
|
-
px: string;
|
|
427
426
|
2: string;
|
|
427
|
+
px: string;
|
|
428
428
|
8: string;
|
|
429
429
|
0.5: string;
|
|
430
430
|
1.5: string;
|
|
@@ -644,12 +644,12 @@ declare const boldVibrantFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp
|
|
|
644
644
|
4: string;
|
|
645
645
|
full: string;
|
|
646
646
|
1: string;
|
|
647
|
+
2: string;
|
|
647
648
|
"1/2": string;
|
|
648
649
|
"1/3": string;
|
|
649
650
|
"2/3": string;
|
|
650
651
|
"1/4": string;
|
|
651
652
|
"3/4": string;
|
|
652
|
-
2: string;
|
|
653
653
|
8: string;
|
|
654
654
|
0.5: string;
|
|
655
655
|
1.5: string;
|
|
@@ -685,12 +685,12 @@ declare const boldVibrantFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp
|
|
|
685
685
|
4: string;
|
|
686
686
|
full: string;
|
|
687
687
|
1: string;
|
|
688
|
+
2: string;
|
|
688
689
|
"1/2": string;
|
|
689
690
|
"1/3": string;
|
|
690
691
|
"2/3": string;
|
|
691
692
|
"1/4": string;
|
|
692
693
|
"3/4": string;
|
|
693
|
-
2: string;
|
|
694
694
|
8: string;
|
|
695
695
|
0.5: string;
|
|
696
696
|
1.5: string;
|
|
@@ -387,8 +387,8 @@ declare const brutalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
387
387
|
0: string;
|
|
388
388
|
4: string;
|
|
389
389
|
1: string;
|
|
390
|
-
px: string;
|
|
391
390
|
2: string;
|
|
391
|
+
px: string;
|
|
392
392
|
8: string;
|
|
393
393
|
0.5: string;
|
|
394
394
|
1.5: string;
|
|
@@ -423,8 +423,8 @@ declare const brutalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
423
423
|
0: string;
|
|
424
424
|
4: string;
|
|
425
425
|
1: string;
|
|
426
|
-
px: string;
|
|
427
426
|
2: string;
|
|
427
|
+
px: string;
|
|
428
428
|
8: string;
|
|
429
429
|
0.5: string;
|
|
430
430
|
1.5: string;
|
|
@@ -644,12 +644,12 @@ declare const brutalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
644
644
|
4: string;
|
|
645
645
|
full: string;
|
|
646
646
|
1: string;
|
|
647
|
+
2: string;
|
|
647
648
|
"1/2": string;
|
|
648
649
|
"1/3": string;
|
|
649
650
|
"2/3": string;
|
|
650
651
|
"1/4": string;
|
|
651
652
|
"3/4": string;
|
|
652
|
-
2: string;
|
|
653
653
|
8: string;
|
|
654
654
|
0.5: string;
|
|
655
655
|
1.5: string;
|
|
@@ -685,12 +685,12 @@ declare const brutalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
685
685
|
4: string;
|
|
686
686
|
full: string;
|
|
687
687
|
1: string;
|
|
688
|
+
2: string;
|
|
688
689
|
"1/2": string;
|
|
689
690
|
"1/3": string;
|
|
690
691
|
"2/3": string;
|
|
691
692
|
"1/4": string;
|
|
692
693
|
"3/4": string;
|
|
693
|
-
2: string;
|
|
694
694
|
8: string;
|
|
695
695
|
0.5: string;
|
|
696
696
|
1.5: string;
|
|
@@ -387,8 +387,8 @@ declare const candyFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp | GetM
|
|
|
387
387
|
0: string;
|
|
388
388
|
4: string;
|
|
389
389
|
1: string;
|
|
390
|
-
px: string;
|
|
391
390
|
2: string;
|
|
391
|
+
px: string;
|
|
392
392
|
8: string;
|
|
393
393
|
0.5: string;
|
|
394
394
|
1.5: string;
|
|
@@ -423,8 +423,8 @@ declare const candyFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp | GetM
|
|
|
423
423
|
0: string;
|
|
424
424
|
4: string;
|
|
425
425
|
1: string;
|
|
426
|
-
px: string;
|
|
427
426
|
2: string;
|
|
427
|
+
px: string;
|
|
428
428
|
8: string;
|
|
429
429
|
0.5: string;
|
|
430
430
|
1.5: string;
|
|
@@ -644,12 +644,12 @@ declare const candyFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp | GetM
|
|
|
644
644
|
4: string;
|
|
645
645
|
full: string;
|
|
646
646
|
1: string;
|
|
647
|
+
2: string;
|
|
647
648
|
"1/2": string;
|
|
648
649
|
"1/3": string;
|
|
649
650
|
"2/3": string;
|
|
650
651
|
"1/4": string;
|
|
651
652
|
"3/4": string;
|
|
652
|
-
2: string;
|
|
653
653
|
8: string;
|
|
654
654
|
0.5: string;
|
|
655
655
|
1.5: string;
|
|
@@ -685,12 +685,12 @@ declare const candyFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp | GetM
|
|
|
685
685
|
4: string;
|
|
686
686
|
full: string;
|
|
687
687
|
1: string;
|
|
688
|
+
2: string;
|
|
688
689
|
"1/2": string;
|
|
689
690
|
"1/3": string;
|
|
690
691
|
"2/3": string;
|
|
691
692
|
"1/4": string;
|
|
692
693
|
"3/4": string;
|
|
693
|
-
2: string;
|
|
694
694
|
8: string;
|
|
695
695
|
0.5: string;
|
|
696
696
|
1.5: string;
|
|
@@ -387,8 +387,8 @@ declare const cleanMinimalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierP
|
|
|
387
387
|
0: string;
|
|
388
388
|
4: string;
|
|
389
389
|
1: string;
|
|
390
|
-
px: string;
|
|
391
390
|
2: string;
|
|
391
|
+
px: string;
|
|
392
392
|
8: string;
|
|
393
393
|
0.5: string;
|
|
394
394
|
1.5: string;
|
|
@@ -423,8 +423,8 @@ declare const cleanMinimalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierP
|
|
|
423
423
|
0: string;
|
|
424
424
|
4: string;
|
|
425
425
|
1: string;
|
|
426
|
-
px: string;
|
|
427
426
|
2: string;
|
|
427
|
+
px: string;
|
|
428
428
|
8: string;
|
|
429
429
|
0.5: string;
|
|
430
430
|
1.5: string;
|
|
@@ -644,12 +644,12 @@ declare const cleanMinimalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierP
|
|
|
644
644
|
4: string;
|
|
645
645
|
full: string;
|
|
646
646
|
1: string;
|
|
647
|
+
2: string;
|
|
647
648
|
"1/2": string;
|
|
648
649
|
"1/3": string;
|
|
649
650
|
"2/3": string;
|
|
650
651
|
"1/4": string;
|
|
651
652
|
"3/4": string;
|
|
652
|
-
2: string;
|
|
653
653
|
8: string;
|
|
654
654
|
0.5: string;
|
|
655
655
|
1.5: string;
|
|
@@ -685,12 +685,12 @@ declare const cleanMinimalistFoundationPreset: UdsConfig<_$_uds_types0.ModifierP
|
|
|
685
685
|
4: string;
|
|
686
686
|
full: string;
|
|
687
687
|
1: string;
|
|
688
|
+
2: string;
|
|
688
689
|
"1/2": string;
|
|
689
690
|
"1/3": string;
|
|
690
691
|
"2/3": string;
|
|
691
692
|
"1/4": string;
|
|
692
693
|
"3/4": string;
|
|
693
|
-
2: string;
|
|
694
694
|
8: string;
|
|
695
695
|
0.5: string;
|
|
696
696
|
1.5: string;
|
|
@@ -387,8 +387,8 @@ declare const corporateFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
387
387
|
0: string;
|
|
388
388
|
4: string;
|
|
389
389
|
1: string;
|
|
390
|
-
px: string;
|
|
391
390
|
2: string;
|
|
391
|
+
px: string;
|
|
392
392
|
8: string;
|
|
393
393
|
0.5: string;
|
|
394
394
|
1.5: string;
|
|
@@ -423,8 +423,8 @@ declare const corporateFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
423
423
|
0: string;
|
|
424
424
|
4: string;
|
|
425
425
|
1: string;
|
|
426
|
-
px: string;
|
|
427
426
|
2: string;
|
|
427
|
+
px: string;
|
|
428
428
|
8: string;
|
|
429
429
|
0.5: string;
|
|
430
430
|
1.5: string;
|
|
@@ -644,12 +644,12 @@ declare const corporateFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
644
644
|
4: string;
|
|
645
645
|
full: string;
|
|
646
646
|
1: string;
|
|
647
|
+
2: string;
|
|
647
648
|
"1/2": string;
|
|
648
649
|
"1/3": string;
|
|
649
650
|
"2/3": string;
|
|
650
651
|
"1/4": string;
|
|
651
652
|
"3/4": string;
|
|
652
|
-
2: string;
|
|
653
653
|
8: string;
|
|
654
654
|
0.5: string;
|
|
655
655
|
1.5: string;
|
|
@@ -685,12 +685,12 @@ declare const corporateFoundationPreset: UdsConfig<_$_uds_types0.ModifierProp |
|
|
|
685
685
|
4: string;
|
|
686
686
|
full: string;
|
|
687
687
|
1: string;
|
|
688
|
+
2: string;
|
|
688
689
|
"1/2": string;
|
|
689
690
|
"1/3": string;
|
|
690
691
|
"2/3": string;
|
|
691
692
|
"1/4": string;
|
|
692
693
|
"3/4": string;
|
|
693
|
-
2: string;
|
|
694
694
|
8: string;
|
|
695
695
|
0.5: string;
|
|
696
696
|
1.5: string;
|