@yahoo/uds-v5-wip 1.21.0 → 1.23.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/component-resolution.d.ts +1 -1
- package/dist/config/dist/consts/defaultColors.d.ts +1 -2
- package/dist/config/dist/createConfig.d.ts +12 -6
- package/dist/config/dist/createConfig.js +6 -3
- package/dist/config/dist/preset-merge.js +34 -1
- package/dist/config/dist/propertyGroups.d.ts +0 -5
- package/dist/config/dist/serialize.d.ts +2 -2
- package/dist/config/dist/serialize.js +4 -2
- package/dist/config/dist/types.d.ts +1 -2
- package/dist/config.d.ts +197 -197
- package/dist/foundational-presets/dist/boldVibrant.d.ts +197 -198
- package/dist/foundational-presets/dist/brutalist.d.ts +197 -198
- package/dist/foundational-presets/dist/candy.d.ts +197 -198
- package/dist/foundational-presets/dist/cleanMinimalist.d.ts +197 -198
- package/dist/foundational-presets/dist/corporate.d.ts +197 -198
- package/dist/foundational-presets/dist/darkMoody.d.ts +197 -198
- package/dist/foundational-presets/dist/defaultPreset.d.ts +197 -198
- package/dist/foundational-presets/dist/forest.d.ts +197 -198
- package/dist/foundational-presets/dist/highContrast.d.ts +197 -198
- package/dist/foundational-presets/dist/lavender.d.ts +197 -198
- package/dist/foundational-presets/dist/luxury.d.ts +197 -198
- package/dist/foundational-presets/dist/monochrome.d.ts +197 -198
- package/dist/foundational-presets/dist/motion.d.ts +1 -2
- package/dist/foundational-presets/dist/neonCyber.d.ts +197 -198
- package/dist/foundational-presets/dist/newspaper.d.ts +197 -198
- package/dist/foundational-presets/dist/ocean.d.ts +197 -198
- package/dist/foundational-presets/dist/slate.d.ts +197 -198
- package/dist/foundational-presets/dist/sunset.d.ts +197 -198
- package/dist/foundational-presets/dist/terminal.d.ts +197 -198
- package/dist/foundational-presets/dist/warmOrganic.d.ts +197 -198
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -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 };
|
|
@@ -3,7 +3,6 @@ import { TokenType, VarsConfig } from "./types.js";
|
|
|
3
3
|
import { BaseModifierProp, ComponentsConfig, ConfigurableProp, MacroConfig, ModifierProp, MotionPreset, RemotionComponentDef, RemotionConfig, RemotionTransitionDef, StyleProp } from "@uds/types";
|
|
4
4
|
|
|
5
5
|
//#region ../config/dist/createConfig.d.ts
|
|
6
|
-
//#region src/createConfig.d.ts
|
|
7
6
|
type MotionPresetsDef = Record<string, MotionPreset>;
|
|
8
7
|
type MotionAliasValue<TMotion> = TMotion extends Record<string, infer V> ? Extract<V, string> : never;
|
|
9
8
|
type EmptyMotion = {};
|
|
@@ -114,7 +113,6 @@ type EmptyTokens = {};
|
|
|
114
113
|
type EmptyVars = {};
|
|
115
114
|
/** Build a structured token reference object from atomic tokens */
|
|
116
115
|
declare function buildTokenReference(atomic: AtomicToken<ModifierNameShape>[], configPrefix: string): Record<string, Record<string, string>>;
|
|
117
|
-
/** Build a structured macro reference object for use in defineModifiers context */
|
|
118
116
|
/** Extract all modifiers from mode groups and check if any are reserved */
|
|
119
117
|
type CheckForReservedModifiers<T extends readonly ModeGroup[]> = true extends HasReservedModifier<GetModifierName<T>> ? 'ERROR: Cannot use reserved modifier names from ModifierProp. Please use a different modifier name.' : T;
|
|
120
118
|
/** Global styles definition — CSS selector → style props */
|
|
@@ -163,6 +161,18 @@ interface UdsConfigData {
|
|
|
163
161
|
* edits this via draft patches.
|
|
164
162
|
*/
|
|
165
163
|
scopes?: Record<string, string[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Token names contributed by any composed preset, keyed by namespace.
|
|
166
|
+
*
|
|
167
|
+
* Populated during `.compose()` — every token seen in the preset's `vars`
|
|
168
|
+
* or `atomic` is added to the set. A later local `.defineVars()` does NOT
|
|
169
|
+
* remove entries, so preset-overridden tokens remain marked as preset.
|
|
170
|
+
*
|
|
171
|
+
* Read by the rename path (MCP tool, canvas preview, CLI pull) to reject
|
|
172
|
+
* renames of preset tokens — they are read-only from the consumer's
|
|
173
|
+
* perspective.
|
|
174
|
+
*/
|
|
175
|
+
presetTokenNames?: Record<string, string[]>;
|
|
166
176
|
}
|
|
167
177
|
interface ComponentConfig<TComponents extends ComponentsConfig<string> = ComponentsConfig<string>, TMotion extends MotionPresetsDef | undefined = MotionPresetsDef | undefined> {
|
|
168
178
|
name?: string;
|
|
@@ -272,10 +282,6 @@ interface UdsConfig<TModifier extends ModifierNameShape = ModifierProp, TTokens
|
|
|
272
282
|
type AnyUdsConfig = UdsConfig<ModifierNameShape, any, any, any, any, any, any>;
|
|
273
283
|
/** Extract the raw config data from a builder instance */
|
|
274
284
|
declare function resolveConfig(config: AnyUdsConfig): UdsConfigData;
|
|
275
|
-
/**
|
|
276
|
-
* Resolve configuration with all token references replaced by their raw values.
|
|
277
|
-
* Useful for tools that need the actual values (e.g. anatomy generation).
|
|
278
|
-
*/
|
|
279
285
|
declare function createConfigBuilder<TModifier extends ModifierNameShape = ModifierProp, TTokens = EmptyTokens, TMotion = EmptyMotion, TExt extends Record<string, any> = {}, TMacros = EmptyMacros, TModeModifiers extends ModifierNameShape = never, TVars extends VarsConfig = EmptyVars>(data: UdsConfigData, extensions?: TExt): UdsConfig<TModifier, TTokens, TMotion, TExt, TMacros, TModeModifiers, TVars> & TExt;
|
|
280
286
|
interface InterpolateMarker {
|
|
281
287
|
__type: 'interpolate';
|
|
@@ -210,7 +210,8 @@ function resolveConfig(config) {
|
|
|
210
210
|
designPrinciples: config.designPrinciples,
|
|
211
211
|
vars: config.vars,
|
|
212
212
|
classNames: config.classNames,
|
|
213
|
-
scopes: config.scopes
|
|
213
|
+
scopes: config.scopes,
|
|
214
|
+
presetTokenNames: config.presetTokenNames
|
|
214
215
|
};
|
|
215
216
|
if (configData.vars && configData.scopes) {
|
|
216
217
|
const synthesized = synthesizeAtomicFromScopesAndVars(configData.vars, configData.scopes, configData.modes);
|
|
@@ -271,7 +272,8 @@ function resolvePresetData(input) {
|
|
|
271
272
|
designPrinciples: input.designPrinciples,
|
|
272
273
|
vars: input.vars,
|
|
273
274
|
classNames: input.classNames,
|
|
274
|
-
scopes: input.scopes
|
|
275
|
+
scopes: input.scopes,
|
|
276
|
+
presetTokenNames: input.presetTokenNames
|
|
275
277
|
};
|
|
276
278
|
}
|
|
277
279
|
function extractVarReferences(value) {
|
|
@@ -516,7 +518,8 @@ function createConfigBuilder(data, extensions) {
|
|
|
516
518
|
arbitraryTokens: input.arbitraryTokens ?? data.arbitraryTokens,
|
|
517
519
|
examples: input.examples ?? data.examples,
|
|
518
520
|
designPrinciples: input.designPrinciples ?? data.designPrinciples,
|
|
519
|
-
vars: input.vars ?? data.vars
|
|
521
|
+
vars: input.vars ?? data.vars,
|
|
522
|
+
presetTokenNames: input.presetTokenNames ?? data.presetTokenNames
|
|
520
523
|
}, extensions);
|
|
521
524
|
},
|
|
522
525
|
extend(ext) {
|
|
@@ -174,10 +174,43 @@ function applyPresetToData(base, preset, strategy) {
|
|
|
174
174
|
designPrinciples: mergedPrinciples,
|
|
175
175
|
vars: mergedVars,
|
|
176
176
|
classNames: mergedClassNames,
|
|
177
|
-
scopes: mergedScopes
|
|
177
|
+
scopes: mergedScopes,
|
|
178
|
+
presetTokenNames: mergePresetTokenNames(base, preset)
|
|
178
179
|
};
|
|
179
180
|
validateComponentVariants(merged.components);
|
|
180
181
|
return merged;
|
|
181
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Union preset-contributed token names by namespace.
|
|
185
|
+
*
|
|
186
|
+
* Every token in `preset.vars`, `preset.atomic`, and `preset.presetTokenNames`
|
|
187
|
+
* (from a nested compose) is added to the set. The set only grows — a later
|
|
188
|
+
* local `.defineVars()` does NOT remove entries, which is what gives preset
|
|
189
|
+
* tokens their read-only identity even when locally overridden.
|
|
190
|
+
*/
|
|
191
|
+
function mergePresetTokenNames(base, preset) {
|
|
192
|
+
const result = {};
|
|
193
|
+
for (const [ns, names] of Object.entries(base.presetTokenNames ?? {})) result[ns] = new Set(names);
|
|
194
|
+
const add = (ns, name) => {
|
|
195
|
+
if (name.startsWith("$")) return;
|
|
196
|
+
let set = result[ns];
|
|
197
|
+
if (!set) {
|
|
198
|
+
set = /* @__PURE__ */ new Set();
|
|
199
|
+
result[ns] = set;
|
|
200
|
+
}
|
|
201
|
+
set.add(name);
|
|
202
|
+
};
|
|
203
|
+
if (preset.vars) for (const [ns, group] of Object.entries(preset.vars)) for (const name of Object.keys(group)) add(ns, name);
|
|
204
|
+
if (preset.presetTokenNames) for (const [ns, names] of Object.entries(preset.presetTokenNames)) for (const name of names) add(ns, name);
|
|
205
|
+
if (preset.atomic) for (const group of preset.atomic) {
|
|
206
|
+
const ns = group.cssPrefix;
|
|
207
|
+
if (!ns) continue;
|
|
208
|
+
for (const token of group.tokens) add(ns, token.name);
|
|
209
|
+
}
|
|
210
|
+
if (Object.keys(result).length === 0) return void 0;
|
|
211
|
+
const out = {};
|
|
212
|
+
for (const [ns, set] of Object.entries(result)) out[ns] = [...set];
|
|
213
|
+
return out;
|
|
214
|
+
}
|
|
182
215
|
//#endregion
|
|
183
216
|
export { applyPresetToData, deepMerge, mergeAtomic };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { ConfigurableProp } from "@uds/types";
|
|
2
2
|
|
|
3
3
|
//#region ../config/dist/propertyGroups.d.ts
|
|
4
|
-
//#region src/propertyGroups.d.ts
|
|
5
4
|
type PropertyGroupId = 'textColor' | 'background' | 'borderColor' | 'outlineColor' | 'ringColor' | 'divideColor' | 'shadowColor' | 'svgFill' | 'svgStroke' | 'caretColor' | 'textDecorationColor' | 'opacity' | 'colorOpacity' | 'bgOpacity' | 'borderColorOpacity' | 'divideColorOpacity' | 'outlineColorOpacity' | 'ringColorOpacity' | 'textDecorationColorOpacity' | 'svgFillOpacity' | 'svgStrokeOpacity' | 'shadowColorOpacity' | 'caretColorOpacity' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'blur' | 'backdropBlur' | 'animation' | 'shadow' | 'textShadow' | 'zIndex' | 'borderWidth' | 'borderRadius' | 'outlineWidth' | 'divideWidth' | 'ringWidth' | 'padding' | 'margin' | 'offset' | 'gap' | 'indent' | 'scrollSnapGap' | 'scrollSnapSpacing' | 'tableBorderSpacing' | 'width' | 'height' | 'aspectRatio' | 'positionPlacement' | 'flex' | 'transform' | 'strokeWidth';
|
|
6
|
-
/**
|
|
7
|
-
* A logical grouping of ConfigurableProps with a human-readable label.
|
|
8
|
-
* Used by the Studio UI to let users scope token groups to specific properties.
|
|
9
|
-
*/
|
|
10
5
|
//#endregion
|
|
11
6
|
export { PropertyGroupId };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ArbitraryTokenGroup, AtomicToken, ExampleDef, ModeGroup, ModifierDef, MotionPresetsDef, UdsConfig } from "./createConfig.js";
|
|
2
2
|
|
|
3
3
|
//#region ../config/dist/serialize.d.ts
|
|
4
|
-
//#region src/serialize.d.ts
|
|
5
4
|
type ModifierNameShape = `_${string}`;
|
|
6
5
|
type TokenRef = {
|
|
7
6
|
$ref: string;
|
|
@@ -18,6 +17,7 @@ interface SerializedConfig {
|
|
|
18
17
|
examples?: Record<string, ExampleDef>;
|
|
19
18
|
preflight: boolean;
|
|
20
19
|
prefix: string;
|
|
20
|
+
presetTokenNames?: Record<string, string[]>;
|
|
21
21
|
}
|
|
22
22
|
type SerializedValue = string | TokenRef | {
|
|
23
23
|
[key: string]: SerializedValue;
|
|
@@ -52,6 +52,6 @@ declare function serializeConfig(config: UdsConfig): SerializedConfig;
|
|
|
52
52
|
* Resolves `$ref` markers back to `var()` strings using the atomic token
|
|
53
53
|
* definitions, then reconstructs the builder chain.
|
|
54
54
|
*/
|
|
55
|
-
declare function deserializeConfig(data: SerializedConfig): UdsConfig;
|
|
55
|
+
declare function deserializeConfig(data: SerializedConfig): UdsConfig;
|
|
56
56
|
//#endregion
|
|
57
57
|
export { SerializedConfig, TokenRef, buildReverseMap, deserializeConfig, serializeConfig };
|
|
@@ -100,7 +100,8 @@ function serializeConfig(config) {
|
|
|
100
100
|
globalStyles: Object.keys(globalStyles).length > 0 ? globalStyles : void 0,
|
|
101
101
|
examples: data.examples && Object.keys(data.examples).length > 0 ? data.examples : void 0,
|
|
102
102
|
preflight: data.preflight,
|
|
103
|
-
prefix: data.prefix
|
|
103
|
+
prefix: data.prefix,
|
|
104
|
+
presetTokenNames: data.presetTokenNames && Object.keys(data.presetTokenNames).length > 0 ? data.presetTokenNames : void 0
|
|
104
105
|
};
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
@@ -142,7 +143,8 @@ function deserializeConfig(data) {
|
|
|
142
143
|
prefix: data.prefix ?? "uds",
|
|
143
144
|
arbitraryTokens: data.arbitraryTokens,
|
|
144
145
|
remotion: void 0,
|
|
145
|
-
globalStyles: {}
|
|
146
|
+
globalStyles: {},
|
|
147
|
+
presetTokenNames: data.presetTokenNames
|
|
146
148
|
});
|
|
147
149
|
if (data.globalStyles && Object.keys(data.globalStyles).length > 0) {
|
|
148
150
|
const globalStyles = {};
|
|
@@ -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 };
|