@yahoo/uds-create-config 1.9.0 → 1.11.0-v3-import.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Component.d.ts +11 -1
- package/dist/Component.js +14 -0
- package/dist/Props.d.ts +18 -5
- package/dist/StyleProp.js +1 -0
- package/dist/asset-value.d.ts +23 -0
- package/dist/asset-value.js +40 -0
- package/dist/defineAssetGroup.d.ts +7 -0
- package/dist/defineAssetGroup.js +19 -1
- package/dist/factories.d.ts +103 -11
- package/dist/factories.js +25 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -3
- package/dist/refs.d.ts +25 -2
- package/dist/refs.js +10 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/css-properties.d.ts +1 -0
- package/dist/types.d.ts +43 -7
- package/package.json +2 -2
package/dist/Component.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseStyles, ComponentDefinition, ComponentMetadata, ComponentMotionValue, CompoundPropsEntry, LayerInput, PreviewDefinition, PropBinding, SerializedComponent } from "./types.js";
|
|
1
|
+
import { BaseStyles, ComponentDefinition, ComponentMetadata, ComponentMotionValue, CompoundPropsEntry, LayerInput, PreviewDefinition, PropBinding, RefTag, SerializedComponent } from "./types.js";
|
|
2
2
|
import { SlotValueType } from "./markers.js";
|
|
3
3
|
import { ComponentClassNames } from "@yahoo/uds-create-utils";
|
|
4
4
|
|
|
@@ -164,6 +164,9 @@ declare class Component {
|
|
|
164
164
|
readonly defaultProps?: Record<string, unknown>;
|
|
165
165
|
readonly compoundProps?: readonly CompoundPropsEntry[];
|
|
166
166
|
readonly motion?: ComponentMotionValue;
|
|
167
|
+
/** Opt-in forwarded-ref target tag (`.config({ ref: 'button' })`). Drives the
|
|
168
|
+
* typed `ref` prop in `@yahoo/uds-create-config` and the codegen forwardRef wrapper. */
|
|
169
|
+
readonly ref?: RefTag;
|
|
167
170
|
readonly preview?: PreviewDefinition;
|
|
168
171
|
readonly metadata?: ComponentMetadata;
|
|
169
172
|
/**
|
|
@@ -194,6 +197,13 @@ declare class Component {
|
|
|
194
197
|
* that path.
|
|
195
198
|
*/
|
|
196
199
|
readonly renderFn?: unknown;
|
|
200
|
+
/** `true` when the authored definition chained `.renderCanvas(fn)` — the
|
|
201
|
+
* non-enumerable `__hasRenderCanvasFn` flag. Codegen emits a canvas-only
|
|
202
|
+
* overlay artifact for these; spec extraction prefers the canvas fn. */
|
|
203
|
+
readonly hasCanvasRenderFn: boolean;
|
|
204
|
+
/** The `.renderCanvas(fn)` callback when `hasCanvasRenderFn` is `true`.
|
|
205
|
+
* In-memory only (functions never serialize). */
|
|
206
|
+
readonly canvasRenderFn?: unknown;
|
|
197
207
|
/**
|
|
198
208
|
* Name of the component this one value-extends from
|
|
199
209
|
* (`defineComponent(Box)` → `'Box'`). Resolved from the non-
|
package/dist/Component.js
CHANGED
|
@@ -135,6 +135,9 @@ var Component = class {
|
|
|
135
135
|
defaultProps;
|
|
136
136
|
compoundProps;
|
|
137
137
|
motion;
|
|
138
|
+
/** Opt-in forwarded-ref target tag (`.config({ ref: 'button' })`). Drives the
|
|
139
|
+
* typed `ref` prop in `@yahoo/uds-create-config` and the codegen forwardRef wrapper. */
|
|
140
|
+
ref;
|
|
138
141
|
preview;
|
|
139
142
|
metadata;
|
|
140
143
|
/**
|
|
@@ -165,6 +168,13 @@ var Component = class {
|
|
|
165
168
|
* that path.
|
|
166
169
|
*/
|
|
167
170
|
renderFn;
|
|
171
|
+
/** `true` when the authored definition chained `.renderCanvas(fn)` — the
|
|
172
|
+
* non-enumerable `__hasRenderCanvasFn` flag. Codegen emits a canvas-only
|
|
173
|
+
* overlay artifact for these; spec extraction prefers the canvas fn. */
|
|
174
|
+
hasCanvasRenderFn;
|
|
175
|
+
/** The `.renderCanvas(fn)` callback when `hasCanvasRenderFn` is `true`.
|
|
176
|
+
* In-memory only (functions never serialize). */
|
|
177
|
+
canvasRenderFn;
|
|
168
178
|
/**
|
|
169
179
|
* Name of the component this one value-extends from
|
|
170
180
|
* (`defineComponent(Box)` → `'Box'`). Resolved from the non-
|
|
@@ -239,6 +249,7 @@ var Component = class {
|
|
|
239
249
|
this.defaultProps = args.definition.defaultProps;
|
|
240
250
|
this.compoundProps = args.definition.compoundProps;
|
|
241
251
|
this.motion = args.definition.motion;
|
|
252
|
+
this.ref = args.definition.ref;
|
|
242
253
|
const def = args.definition;
|
|
243
254
|
const previewField = typeof def.preview === "function" ? void 0 : def.preview;
|
|
244
255
|
this.preview = def.__preview ?? previewField;
|
|
@@ -250,6 +261,8 @@ var Component = class {
|
|
|
250
261
|
this.sourceFilePath = readSourcePath(args.definition);
|
|
251
262
|
this.hasRenderFn = args.definition.__hasRenderFn === true;
|
|
252
263
|
this.renderFn = args.definition.__renderFn;
|
|
264
|
+
this.hasCanvasRenderFn = args.definition.__hasRenderCanvasFn === true;
|
|
265
|
+
this.canvasRenderFn = args.definition.__renderCanvasFn;
|
|
253
266
|
const extendsFromSeed = args.definition.__extendsFrom;
|
|
254
267
|
const extendsFromName = extendsFromSeed && typeof extendsFromSeed === "object" && typeof extendsFromSeed.__componentName === "string" ? extendsFromSeed.__componentName : void 0;
|
|
255
268
|
this.extendsFrom = extendsFromName ?? args.definition.extendsFrom;
|
|
@@ -317,6 +330,7 @@ var Component = class {
|
|
|
317
330
|
defaultProps: this.defaultProps,
|
|
318
331
|
compoundProps: this.compoundProps,
|
|
319
332
|
motion: this.motion,
|
|
333
|
+
ref: this.ref,
|
|
320
334
|
preview: this.preview ? serializeElementsDeep(this.preview) : void 0,
|
|
321
335
|
metadata: this.metadata,
|
|
322
336
|
sourceFilePath,
|
package/dist/Props.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RegisteredCompositeStyles, RegisteredModifiers, RegisteredStyleProps, TagRef } from "./refs.js";
|
|
2
2
|
import { ColorExpression } from "./colorExpressions.js";
|
|
3
|
-
import { ComponentDefinition, LayerInput, PropBinding, RootTag } from "./types.js";
|
|
4
|
-
import { ComponentPropsWithRef, HTMLAttributes, JSX, ReactNode } from "react";
|
|
3
|
+
import { ComponentDefinition, LayerInput, PropBinding, RefElement, RootTag } from "./types.js";
|
|
4
|
+
import { ComponentPropsWithRef, ElementType, HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/Props.d.ts
|
|
7
7
|
/**
|
|
@@ -270,7 +270,7 @@ type EffectiveTag<TDef, TTag, TLayers> = TDef extends {
|
|
|
270
270
|
};
|
|
271
271
|
} ? A : string extends TTag ? RootTag<TLayers> : [TTag] extends [undefined] ? RootTag<TLayers> : TTag extends string ? TTag : RootTag<TLayers>;
|
|
272
272
|
type PropsBase<TDef extends ComponentDefinition<Record<string, LayerInput>, Record<string, PropBinding>, string | undefined>> = TDef extends ComponentDefinition<infer TLayers extends Record<string, LayerInput>, infer TProps extends Record<string, PropBinding>, infer TTag extends string | undefined> ? PropsFromBindings<TProps, TLayers> & Omit<ComposedRootProps<TLayers>, keyof TProps | 'children'> & Omit<ElementProps<EffectiveTag<TDef, TTag, TLayers>>, keyof TProps | keyof ComposedRootProps<TLayers>> & DataAttrs & {
|
|
273
|
-
as?:
|
|
273
|
+
as?: ElementType;
|
|
274
274
|
layerProps?: LayerPropsMap<TLayers>;
|
|
275
275
|
} : never;
|
|
276
276
|
/**
|
|
@@ -298,16 +298,29 @@ type PropsBase<TDef extends ComponentDefinition<Record<string, LayerInput>, Reco
|
|
|
298
298
|
* during package-wide typechecks (`@yahoo/uds-create-codegen` builds saw this
|
|
299
299
|
* at `factories.ts:853`).
|
|
300
300
|
*/
|
|
301
|
+
/**
|
|
302
|
+
* Opt-in forwarded-ref prop. A component declares its ref target via
|
|
303
|
+
* `.config({ ref: 'button' })`; that tag is captured on the definition's `ref`
|
|
304
|
+
* field and mapped here to `ref?: Ref<HTMLButtonElement>`. When declared and
|
|
305
|
+
* resolvable, it *overrides* the element's natural ref (see `Props`, which omits
|
|
306
|
+
* exactly `keyof RefProp` before re-adding this). When it can't resolve to a
|
|
307
|
+
* tag, it contributes nothing and the natural ref is left intact.
|
|
308
|
+
*/
|
|
309
|
+
type RefProp<TDef> = TDef extends {
|
|
310
|
+
ref: infer Tag extends string;
|
|
311
|
+
} ? {
|
|
312
|
+
ref?: Ref<RefElement<Tag>>;
|
|
313
|
+
} : Record<never, never>;
|
|
301
314
|
type Props<TDef extends ComponentDefinition<Record<string, LayerInput>, Record<string, PropBinding>, string | undefined>> = TDef extends {
|
|
302
315
|
layers: Record<string, LayerInput>;
|
|
303
|
-
} ? Record<string, LayerInput> extends TDef['layers'] ? PermissiveProps : Prettify<PropsBase<TDef> & RegisteredModifiers<PropsBase<TDef
|
|
316
|
+
} ? Record<string, LayerInput> extends TDef['layers'] ? PermissiveProps : Prettify<Omit<PropsBase<TDef> & RegisteredModifiers<PropsBase<TDef>>, keyof RefProp<TDef>> & RefProp<TDef>> : PermissiveProps;
|
|
304
317
|
/**
|
|
305
318
|
* Permissive prop bag used as the bail-out shape when `Props<TDef>`
|
|
306
319
|
* can't narrow against a concrete `layers` map (mirrors the
|
|
307
320
|
* `FC<any>` slot the pre-Props builder used to carry).
|
|
308
321
|
*/
|
|
309
322
|
type PermissiveProps = HTMLAttributes<HTMLElement> & DataAttrs & Record<string, any> & {
|
|
310
|
-
as?:
|
|
323
|
+
as?: ElementType;
|
|
311
324
|
};
|
|
312
325
|
/**
|
|
313
326
|
* `Props<typeof boxConfig>` for the common 'use the definition's inferred
|
package/dist/StyleProp.js
CHANGED
|
@@ -116,6 +116,7 @@ var StyleProp = class StyleProp {
|
|
|
116
116
|
const keywords = /* @__PURE__ */ new Map();
|
|
117
117
|
for (const entry of values) if (typeof entry === "string") keywords.set(entry, this.transform ? this.transform(entry) : entry);
|
|
118
118
|
else if (typeof entry === "number") keywords.set(entry, this.transform ? this.transform(entry) : String(entry));
|
|
119
|
+
else if (typeof entry === "boolean") keywords.set(entry, String(entry));
|
|
119
120
|
else if (typeof entry === "object" && entry !== null && "alias" in entry && "value" in entry) keywords.set(entry.alias, entry.value);
|
|
120
121
|
this.#derived = {
|
|
121
122
|
keywords,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FontAssetMember } from "./types.js";
|
|
2
|
+
import { AssetGroup } from "./AssetGroup.js";
|
|
3
|
+
|
|
4
|
+
//#region src/asset-value.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Assemble a `font-family` CSS value from a font member — the primary
|
|
7
|
+
* family (always double-quoted, so multi-word names are valid) followed by
|
|
8
|
+
* its fallback stack. `fallback` rides `FontAssetMember`'s open index as
|
|
9
|
+
* `unknown`, so read it defensively: a `string` is appended verbatim (it
|
|
10
|
+
* may itself be a comma list), a `string[]` is joined, anything else is
|
|
11
|
+
* ignored. Fallback entries are emitted verbatim — they're generic keywords
|
|
12
|
+
* (`sans-serif`) or already-formatted names.
|
|
13
|
+
*/
|
|
14
|
+
declare function resolveFontStack(member: FontAssetMember): string;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a `<slug>/<member>` asset ref to its `font-family` CSS stack.
|
|
17
|
+
* Every failure is a named throw (no silent string fallthrough): a
|
|
18
|
+
* malformed ref, an unregistered group, a non-font group, or a missing
|
|
19
|
+
* member each name the offending ref so config load fails loudly.
|
|
20
|
+
*/
|
|
21
|
+
declare function resolveAssetRefCss(ref: string, assetGroups: ReadonlyMap<string, AssetGroup>): string;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { resolveAssetRefCss, resolveFontStack };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/asset-value.ts
|
|
2
|
+
/**
|
|
3
|
+
* Assemble a `font-family` CSS value from a font member — the primary
|
|
4
|
+
* family (always double-quoted, so multi-word names are valid) followed by
|
|
5
|
+
* its fallback stack. `fallback` rides `FontAssetMember`'s open index as
|
|
6
|
+
* `unknown`, so read it defensively: a `string` is appended verbatim (it
|
|
7
|
+
* may itself be a comma list), a `string[]` is joined, anything else is
|
|
8
|
+
* ignored. Fallback entries are emitted verbatim — they're generic keywords
|
|
9
|
+
* (`sans-serif`) or already-formatted names.
|
|
10
|
+
*/
|
|
11
|
+
function resolveFontStack(member) {
|
|
12
|
+
const primary = `"${member.fontFamily}"`;
|
|
13
|
+
const { fallback } = member;
|
|
14
|
+
if (typeof fallback === "string" && fallback.length > 0) return `${primary}, ${fallback}`;
|
|
15
|
+
if (Array.isArray(fallback) && fallback.every((entry) => typeof entry === "string")) {
|
|
16
|
+
const stack = fallback.filter((entry) => entry.length > 0);
|
|
17
|
+
return stack.length > 0 ? `${primary}, ${stack.join(", ")}` : primary;
|
|
18
|
+
}
|
|
19
|
+
return primary;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a `<slug>/<member>` asset ref to its `font-family` CSS stack.
|
|
23
|
+
* Every failure is a named throw (no silent string fallthrough): a
|
|
24
|
+
* malformed ref, an unregistered group, a non-font group, or a missing
|
|
25
|
+
* member each name the offending ref so config load fails loudly.
|
|
26
|
+
*/
|
|
27
|
+
function resolveAssetRefCss(ref, assetGroups) {
|
|
28
|
+
const slash = ref.indexOf("/");
|
|
29
|
+
if (slash <= 0 || slash === ref.length - 1) throw new Error(`asset('${ref}') is malformed — expected a '<group>/<member>' ref.`);
|
|
30
|
+
const slug = ref.slice(0, slash);
|
|
31
|
+
const memberName = ref.slice(slash + 1);
|
|
32
|
+
const group = assetGroups.get(slug);
|
|
33
|
+
if (!group) throw new Error(`asset('${ref}') — no asset group is registered under slug '${slug}'.`);
|
|
34
|
+
if (group.assetKind !== "font") throw new Error(`asset('${ref}') — group '${slug}' is a '${group.assetKind}' group; only font groups can be referenced as a token value.`);
|
|
35
|
+
const member = group.members?.[memberName];
|
|
36
|
+
if (!member) throw new Error(`asset('${ref}') — member '${memberName}' is not registered in font group '${slug}'.`);
|
|
37
|
+
return resolveFontStack(member);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { resolveAssetRefCss, resolveFontStack };
|
|
@@ -99,6 +99,13 @@ interface FontAssetGroupConfig {
|
|
|
99
99
|
/** Source-library version shown in the Assets UI (e.g. `2.1.1`). */
|
|
100
100
|
version?: string;
|
|
101
101
|
description?: string;
|
|
102
|
+
/**
|
|
103
|
+
* FontIDs to fold in as deprecated at registration — each listed
|
|
104
|
+
* member is stamped `deprecated: true`. Deprecated fonts stay fully
|
|
105
|
+
* selectable (no hard block); the flag only lets the picker badge them.
|
|
106
|
+
* An id not present in the member map is ignored.
|
|
107
|
+
*/
|
|
108
|
+
deprecated?: readonly string[];
|
|
102
109
|
/** Icon-class prop — excluded on the font branch at the type level. */
|
|
103
110
|
sizes?: never;
|
|
104
111
|
/** Icon-class prop — excluded on the font branch at the type level. */
|
package/dist/defineAssetGroup.js
CHANGED
|
@@ -130,6 +130,24 @@ function guardFontMembers(raw) {
|
|
|
130
130
|
return members;
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
+
* Stamp `deprecated: true` on each member named in the `deprecated` list.
|
|
134
|
+
* Shallow-copies only the affected records so the caller's source map is
|
|
135
|
+
* never mutated; ids not in the member map are ignored (governance lists
|
|
136
|
+
* routinely outlive the fonts they name).
|
|
137
|
+
*/
|
|
138
|
+
function foldInDeprecated(members, deprecated) {
|
|
139
|
+
if (!deprecated?.length) return members;
|
|
140
|
+
const flagged = new Set(deprecated);
|
|
141
|
+
for (const id of flagged) {
|
|
142
|
+
const member = members[id];
|
|
143
|
+
if (member) members[id] = {
|
|
144
|
+
...member,
|
|
145
|
+
deprecated: true
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return members;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
133
151
|
* Variant superset when `config.variants` is omitted: the harvested
|
|
134
152
|
* union of members' `.metadata.variants`, first-seen order.
|
|
135
153
|
*/
|
|
@@ -218,7 +236,7 @@ function defineAssetGroup(members) {
|
|
|
218
236
|
if (config.version !== void 0) out.version = config.version;
|
|
219
237
|
if (config.description !== void 0) out.description = config.description;
|
|
220
238
|
if (config.type === "font") {
|
|
221
|
-
const fontMembers = guardFontMembers(members);
|
|
239
|
+
const fontMembers = foldInDeprecated(guardFontMembers(members), config.deprecated);
|
|
222
240
|
out.assetKind = "font";
|
|
223
241
|
defineHidden(out, "members", fontMembers);
|
|
224
242
|
stampRefTag(out);
|
package/dist/factories.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RegisteredModifiers, TagRef, TokenGroupRef, composite, styleProp, token } from "./refs.js";
|
|
1
|
+
import { RegisteredModifiers, TagRef, TokenGroupRef, TokenRawNameRegistry, composite, styleProp, token } from "./refs.js";
|
|
2
2
|
import { darken, lighten } from "./colorExpressions.js";
|
|
3
|
-
import { ComponentDefinition, ComponentGroupDefinition, ComponentMetadata, CompositeStyleDefinition, LayerInput, ModeDefinition, ModifierDefinition, MotionDefinitionInput, PreviewDefinition, StylePropDefinition, StylePropMetadata, StylePropProperty, TokenDefinition } from "./types.js";
|
|
3
|
+
import { ComponentDefinition, ComponentGroupDefinition, ComponentMetadata, CompositeStyleDefinition, LayerInput, ModeDefinition, ModifierDefinition, MotionDefinitionInput, PreviewDefinition, RefElement, StylePropDefinition, StylePropMetadata, StylePropProperty, TokenDefinition } from "./types.js";
|
|
4
4
|
import { BooleanMarker, ComponentSlotMarker, LayerMarker, NumberMarker, PreviewAxisMarker, PreviewPropsRule, RequiredBrand, SlotMarker, SlotRef, SlotValueType, StringMarker, VariantMarker, VariantMarkerArray, VariantMarkerObject } from "./markers.js";
|
|
5
5
|
import { BaseLayerStyles, LayerPropsMap, LayerTag, Props, PropsFromBindings, SlotPropValue } from "./Props.js";
|
|
6
6
|
import { defineProvider } from "./defineProvider.js";
|
|
7
|
-
import { ComponentPropsWithRef, ComponentType, FC, HTMLAttributes, JSX, ReactNode } from "react";
|
|
7
|
+
import { ComponentPropsWithRef, ComponentRef, ComponentType, ElementType, FC, HTMLAttributes, JSX, ReactElement, ReactNode, Ref } from "react";
|
|
8
8
|
|
|
9
9
|
//#region src/factories.d.ts
|
|
10
10
|
/**
|
|
@@ -140,6 +140,19 @@ declare function boolean(values?: {
|
|
|
140
140
|
true?: Record<string, Record<string, unknown>>;
|
|
141
141
|
false?: Record<string, Record<string, unknown>>;
|
|
142
142
|
}): Chainable<BooleanMarker>;
|
|
143
|
+
/**
|
|
144
|
+
* `asChild()` — opt a **single-layer** component into the polymorphic-child
|
|
145
|
+
* Slot pattern. Declare it as a prop (`props: { asChild: asChild() }`); when a
|
|
146
|
+
* consumer passes `asChild`, the component merges its computed props (className,
|
|
147
|
+
* style props, handlers) onto its single child element instead of rendering its
|
|
148
|
+
* own tag — codegen wires the `_renderAsChild` Slot. Typed as a boolean prop
|
|
149
|
+
* (`asChild?: boolean`), so no extra type plumbing.
|
|
150
|
+
*
|
|
151
|
+
* Opt-in only and single-layer only: multi-layer composites render multiple
|
|
152
|
+
* children and can't slot a single child, so the codegen Slot branch is emitted
|
|
153
|
+
* solely for inline single-layer FCs.
|
|
154
|
+
*/
|
|
155
|
+
declare function asChild(): BooleanMarker;
|
|
143
156
|
/**
|
|
144
157
|
* Cross-layer style override — `_hover: layer('close', { opacity: 1 })`
|
|
145
158
|
* declares "when this layer is hovered, apply these styles to the
|
|
@@ -199,6 +212,7 @@ interface ConfigCallbackHelpers {
|
|
|
199
212
|
readonly slot: typeof slot;
|
|
200
213
|
readonly variant: typeof variant;
|
|
201
214
|
readonly boolean: typeof boolean;
|
|
215
|
+
readonly asChild: typeof asChild;
|
|
202
216
|
readonly string: typeof string;
|
|
203
217
|
readonly number: typeof number;
|
|
204
218
|
readonly layer: typeof layer;
|
|
@@ -348,6 +362,7 @@ type TypedConfigHelpers<T extends ComponentDefinition> = T extends ComponentDefi
|
|
|
348
362
|
readonly slot: TypedSlotHelper<TLayers>;
|
|
349
363
|
readonly variant: TypedVariantHelper<TLayers>;
|
|
350
364
|
readonly boolean: TypedBooleanHelper<TLayers>;
|
|
365
|
+
readonly asChild: typeof asChild;
|
|
351
366
|
readonly layer: TypedLayerHelper<TLayers>;
|
|
352
367
|
readonly string: typeof string;
|
|
353
368
|
readonly number: typeof number;
|
|
@@ -457,13 +472,28 @@ type ConfigCallbackResultFor<T extends ComponentDefinition> = Omit<ConfigCallbac
|
|
|
457
472
|
* key is omitted.
|
|
458
473
|
*/
|
|
459
474
|
type MergeNested<T, C, K extends string> = C extends Record<K, infer CV> ? T extends Record<K, infer TV> ? Record<K, Omit<TV, keyof CV> & CV> : Record<K, CV> : T extends Record<K, infer TV> ? Record<K, TV> : {};
|
|
475
|
+
/**
|
|
476
|
+
* `ref` is a scalar tag, so a value-extend that re-declares it must *override*
|
|
477
|
+
* the inherited tag (Pressable's `'button'` over Box's `'div'`). A plain
|
|
478
|
+
* intersection would collapse `'div' & 'button'` to `never` — poisoning the
|
|
479
|
+
* whole merged definition. C wins; falls back to T's tag when C omits `ref`.
|
|
480
|
+
*/
|
|
481
|
+
type MergeRef<T, C> = C extends {
|
|
482
|
+
ref: infer CR;
|
|
483
|
+
} ? {
|
|
484
|
+
ref: CR;
|
|
485
|
+
} : T extends {
|
|
486
|
+
ref: infer TR;
|
|
487
|
+
} ? {
|
|
488
|
+
ref: TR;
|
|
489
|
+
} : Record<never, never>;
|
|
460
490
|
/**
|
|
461
491
|
* Merge a `.config(cb)` callback result `C` over the chain seed `T`.
|
|
462
492
|
* Nested fields (`props`, `defaultProps`, `base`) merge per-key (C
|
|
463
|
-
* overrides T at the leaf level);
|
|
464
|
-
* historic `T & C` intersection.
|
|
493
|
+
* overrides T at the leaf level); `ref` overrides as a scalar; other fields
|
|
494
|
+
* fall back to the historic `T & C` intersection.
|
|
465
495
|
*/
|
|
466
|
-
type MergeChainConfig<T, C> = Omit<T, 'props' | 'defaultProps' | 'base'> & Omit<C, 'props' | 'defaultProps' | 'base'> & MergeNested<T, C, 'props'> & MergeNested<T, C, 'defaultProps'> & MergeNested<T, C, 'base'>;
|
|
496
|
+
type MergeChainConfig<T, C> = Omit<T, 'props' | 'defaultProps' | 'base' | 'ref'> & Omit<C, 'props' | 'defaultProps' | 'base' | 'ref'> & MergeRef<T, C> & MergeNested<T, C, 'props'> & MergeNested<T, C, 'defaultProps'> & MergeNested<T, C, 'base'>;
|
|
467
497
|
/**
|
|
468
498
|
* Per-config slot-prop map: walk a `props` block, pick out every
|
|
469
499
|
* `slot()`-marked entry, and surface it as `ReactNode | undefined` on
|
|
@@ -525,6 +555,41 @@ type RenderPropsFromConfig<TProps, TDefaultKeys extends PropertyKey = never> = {
|
|
|
525
555
|
* render fn just spreads them with `{...props.<layer>}`.
|
|
526
556
|
*/
|
|
527
557
|
type LayerPropsBundle<TLayers> = { [K in keyof TLayers]: Record<string, unknown> };
|
|
558
|
+
/**
|
|
559
|
+
* Resolved value object for a single token. `value` is the
|
|
560
|
+
* light-mode (or single-mode) CSS value string. Any `_${string}` key
|
|
561
|
+
* (e.g. `_dark`) holds the override for that mode. `type` is an
|
|
562
|
+
* optional token-category hint (e.g. `'color'`, `'dimension'`).
|
|
563
|
+
*
|
|
564
|
+
* The precise qualified-name union for `tokenRaw`'s `name` parameter
|
|
565
|
+
* is layered on at the call site via codegen's `uds-env.d.ts`
|
|
566
|
+
* augmentation — keep this type config-agnostic.
|
|
567
|
+
*/
|
|
568
|
+
type RawToken = {
|
|
569
|
+
value: string;
|
|
570
|
+
type?: string;
|
|
571
|
+
} & { [K in `_${string}`]?: string };
|
|
572
|
+
/** The accepted `name` argument for `tokenRaw`. Narrows to the
|
|
573
|
+
* config's registered `'<group>/<token>'` union when codegen has
|
|
574
|
+
* augmented `TokenRawNameRegistry`; falls back to `string` in
|
|
575
|
+
* un-augmented contexts (this package's own tests, fresh consumers
|
|
576
|
+
* before the first build). */
|
|
577
|
+
type TokenRawName = [keyof TokenRawNameRegistry] extends [never] ? string : keyof TokenRawNameRegistry;
|
|
578
|
+
/**
|
|
579
|
+
* Resolved return shape of `tokenRaw(name)` for a specific `name`. Once codegen
|
|
580
|
+
* has augmented `TokenRawNameRegistry`, each registered name maps to its own
|
|
581
|
+
* per-token shape — `{ value: string; _dark: string }` for a themed token,
|
|
582
|
+
* `{ value: string }` for one with no mode overrides. A finite template/union
|
|
583
|
+
* name (e.g. `` `spectrum/blue/${step}` `` with `step` a finite union) resolves
|
|
584
|
+
* to the union of the matching tokens' shapes, which collapses to a single type
|
|
585
|
+
* when they share one. Falls back to the open `RawToken` in un-augmented
|
|
586
|
+
* contexts (this package's own tests, fresh consumers before the first build).
|
|
587
|
+
*
|
|
588
|
+
* Values are `string`, not literals: token values are indirection by design and
|
|
589
|
+
* change with theming, so a baked-in literal would go stale — the stable,
|
|
590
|
+
* useful information a name carries is which keys it has.
|
|
591
|
+
*/
|
|
592
|
+
type TokenRawValue<N extends TokenRawName> = N extends keyof TokenRawNameRegistry ? TokenRawNameRegistry[N] : RawToken;
|
|
528
593
|
/**
|
|
529
594
|
* Shape of the render fn passed to `.render<TExtra>(fn)`. `props` is
|
|
530
595
|
* the per-layer bundle injected by the codegen-emitted wrapper FC,
|
|
@@ -535,10 +600,22 @@ type LayerPropsBundle<TLayers> = { [K in keyof TLayers]: Record<string, unknown>
|
|
|
535
600
|
* (function-typed handlers, complex object pass-throughs) that the
|
|
536
601
|
* marker system doesn't express yet.
|
|
537
602
|
*/
|
|
538
|
-
|
|
603
|
+
/**
|
|
604
|
+
* The render fn's `ref` arg, present only when the component declares
|
|
605
|
+
* `.config({ ref: 'tag' })`. The author attaches it to the real root element
|
|
606
|
+
* (`<svg ref={ref} {...props.root} />`), so TS checks the attachment against
|
|
607
|
+
* the declared element. No declaration → no `ref` arg (empty intersection).
|
|
608
|
+
*/
|
|
609
|
+
type RefArgFor<TDef> = TDef extends {
|
|
610
|
+
ref: infer Tag extends string;
|
|
611
|
+
} ? {
|
|
612
|
+
ref?: Ref<RefElement<Tag>>;
|
|
613
|
+
} : Record<never, never>;
|
|
614
|
+
type ComponentRenderFn<TExtra = unknown, TConfigProps = unknown, TLayers = Record<string, unknown>, TRefArg = Record<never, never>> = (args: {
|
|
539
615
|
props: LayerPropsBundle<TLayers>;
|
|
540
616
|
children?: ReactNode;
|
|
541
|
-
|
|
617
|
+
tokenRaw: <N extends TokenRawName>(name: N) => TokenRawValue<N>;
|
|
618
|
+
} & TConfigProps & TExtra & TRefArg) => ReactNode;
|
|
542
619
|
/**
|
|
543
620
|
* Chain methods attached to every `defineComponent` result. The
|
|
544
621
|
* builder type intersects with the underlying `ComponentDefinition`
|
|
@@ -573,7 +650,7 @@ interface ComponentBuilderMethods<T extends ComponentDefinition> {
|
|
|
573
650
|
defaultProps: infer D;
|
|
574
651
|
} ? keyof D : never> : unknown, T extends {
|
|
575
652
|
layers: infer L;
|
|
576
|
-
} ? L : Record<string, unknown>>): BoundComponent<T, TExtra>;
|
|
653
|
+
} ? L : Record<string, unknown>, RefArgFor<T>>): BoundComponent<T, TExtra>;
|
|
577
654
|
/**
|
|
578
655
|
* Attach a declarative preview spec — stored under non-enumerable
|
|
579
656
|
* `__preview` so the authored builder stays JSON-clean. Callback
|
|
@@ -620,7 +697,15 @@ interface ComponentBuilderMethods<T extends ComponentDefinition> {
|
|
|
620
697
|
* concession that keeps source files typechecking against this
|
|
621
698
|
* value as if it were the rewritten artifact.
|
|
622
699
|
*/
|
|
623
|
-
|
|
700
|
+
interface UdsComponent<P> {
|
|
701
|
+
<C extends ElementType, TExtra = {}>(props: Omit<P, 'ref'> & {
|
|
702
|
+
as: C;
|
|
703
|
+
ref?: Ref<ComponentRef<C>>;
|
|
704
|
+
} & NoInfer<TExtra>): ReactElement | null;
|
|
705
|
+
<TExtra = {}>(props: P & NoInfer<TExtra>): ReactElement | null;
|
|
706
|
+
readonly displayName?: string;
|
|
707
|
+
}
|
|
708
|
+
type ComponentBuilder<T extends ComponentDefinition> = T & ComponentBuilderMethods<T> & UdsComponent<Props<T>>;
|
|
624
709
|
/**
|
|
625
710
|
* Bound component returned by `.render<TExtra>(fn)`. Mirrors main's
|
|
626
711
|
* `BoundComponent`: an `FC` whose JSX props are
|
|
@@ -645,6 +730,13 @@ interface BoundComponentMethods<T extends ComponentDefinition, TExtra extends Re
|
|
|
645
730
|
preview(spec: PreviewDefinition<Omit<DefaultPropsFor<T>, keyof TExtra> & TExtra> | ((helpers: TypedPreviewHelpers<T>) => PreviewDefinition<Omit<DefaultPropsFor<T>, keyof TExtra> & TExtra>)): BoundComponent<T, TExtra>;
|
|
646
731
|
subcomponents(children: Record<string, ComponentDefinition>): BoundComponent<T, TExtra>;
|
|
647
732
|
metadata(meta: ComponentMetadata): BoundComponent<T, TExtra>;
|
|
733
|
+
renderCanvas<TCanvasExtra extends Record<string, unknown> = TExtra>(fn: ComponentRenderFn<TCanvasExtra, T extends {
|
|
734
|
+
props: infer P;
|
|
735
|
+
} ? RenderPropsFromConfig<P, T extends {
|
|
736
|
+
defaultProps: infer D;
|
|
737
|
+
} ? keyof D : never> : unknown, T extends {
|
|
738
|
+
layers: infer L;
|
|
739
|
+
} ? L : Record<string, unknown>, RefArgFor<T>>): BoundComponent<T, TExtra>;
|
|
648
740
|
}
|
|
649
741
|
type BoundComponent<T extends ComponentDefinition, TExtra extends Record<string, unknown> = {}> = T & FC<Omit<Props<T>, keyof TExtra> & TExtra> & BoundComponentMethods<T, TExtra> & {
|
|
650
742
|
readonly __config: T;
|
|
@@ -717,4 +809,4 @@ type ProviderComponent<TProps = Record<never, never>> = FC<{
|
|
|
717
809
|
*/
|
|
718
810
|
type DefinedProvider<TContext = unknown, TProps = Record<never, never>> = readonly [ProviderComponent<TProps>, () => TContext];
|
|
719
811
|
//#endregion
|
|
720
|
-
export { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, PreviewCallbackHelpers, ProviderComponent, ProviderRenderFn, TokenGroupMetadata, TypedSlotRef, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant };
|
|
812
|
+
export { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, PreviewCallbackHelpers, ProviderComponent, ProviderRenderFn, RawToken, TokenGroupMetadata, TokenRawValue, TypedSlotRef, asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant };
|
package/dist/factories.js
CHANGED
|
@@ -192,6 +192,24 @@ function boolean(values) {
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
+
* `asChild()` — opt a **single-layer** component into the polymorphic-child
|
|
196
|
+
* Slot pattern. Declare it as a prop (`props: { asChild: asChild() }`); when a
|
|
197
|
+
* consumer passes `asChild`, the component merges its computed props (className,
|
|
198
|
+
* style props, handlers) onto its single child element instead of rendering its
|
|
199
|
+
* own tag — codegen wires the `_renderAsChild` Slot. Typed as a boolean prop
|
|
200
|
+
* (`asChild?: boolean`), so no extra type plumbing.
|
|
201
|
+
*
|
|
202
|
+
* Opt-in only and single-layer only: multi-layer composites render multiple
|
|
203
|
+
* children and can't slot a single child, so the codegen Slot branch is emitted
|
|
204
|
+
* solely for inline single-layer FCs.
|
|
205
|
+
*/
|
|
206
|
+
function asChild() {
|
|
207
|
+
return {
|
|
208
|
+
__kind: "boolean",
|
|
209
|
+
__asChild: true
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
195
213
|
* Cross-layer style override — `_hover: layer('close', { opacity: 1 })`
|
|
196
214
|
* declares "when this layer is hovered, apply these styles to the
|
|
197
215
|
* named layer". Codegen emits a descendant-combinator rule pointing
|
|
@@ -259,6 +277,7 @@ const configHelpers = {
|
|
|
259
277
|
slot,
|
|
260
278
|
variant,
|
|
261
279
|
boolean,
|
|
280
|
+
asChild,
|
|
262
281
|
string,
|
|
263
282
|
number,
|
|
264
283
|
layer,
|
|
@@ -352,6 +371,11 @@ function attachChainMethods(seed) {
|
|
|
352
371
|
def("__hasRenderFn", true);
|
|
353
372
|
return seed;
|
|
354
373
|
});
|
|
374
|
+
def("renderCanvas", function renderCanvasMethod(fn) {
|
|
375
|
+
def("__renderCanvasFn", fn);
|
|
376
|
+
def("__hasRenderCanvasFn", true);
|
|
377
|
+
return seed;
|
|
378
|
+
});
|
|
355
379
|
def("preview", function previewMethod(spec) {
|
|
356
380
|
def("__preview", typeof spec === "function" ? spec(previewHelpers) : spec);
|
|
357
381
|
return seed;
|
|
@@ -396,4 +420,4 @@ defineComponentImpl.layers = function layersEntry(layers) {
|
|
|
396
420
|
};
|
|
397
421
|
const defineComponent = defineComponentImpl;
|
|
398
422
|
//#endregion
|
|
399
|
-
export { boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant };
|
|
423
|
+
export { asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ASSET_CLASS_CAPABILITIES, AssetKind, isPlaceable } from "./asset-kind.js";
|
|
2
|
-
import { AnyRef, AssetGroupName, AssetGroupRef, ComponentName, ComponentRef, CompositeName, CompositeRef, CompositeRefBuilder, ModeName, ModeRef, RegisteredAssetGroups, RegisteredComponents, RegisteredCompositeStyles, RegisteredModes, RegisteredModifiers, RegisteredMotionDefs, RegisteredStyleProps, RegisteredTokenGroups, StylePropName, StylePropRef, TagName, TagRef, TokenGroupName, TokenGroupRef, TokenName, TokenQualifiedName, TokenRef, assetGroup, component, composite, isAssetGroupRef, isComponentRef, isCompositeRef, isModeRef, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, mode, styleProp, tag, token, tokenGroup } from "./refs.js";
|
|
2
|
+
import { AnyRef, AssetGroupName, AssetGroupRef, AssetName, AssetRef, ComponentName, ComponentRef, CompositeName, CompositeRef, CompositeRefBuilder, ModeName, ModeRef, RegisteredAssetGroups, RegisteredComponents, RegisteredCompositeStyles, RegisteredModes, RegisteredModifiers, RegisteredMotionDefs, RegisteredStyleProps, RegisteredTokenGroups, StylePropName, StylePropRef, TagName, TagRef, TokenGroupName, TokenGroupRef, TokenName, TokenQualifiedName, TokenRawNameRegistry, TokenRef, asset, assetGroup, component, composite, isAssetGroupRef, isAssetRef, isComponentRef, isCompositeRef, isModeRef, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, mode, styleProp, tag, token, tokenGroup } from "./refs.js";
|
|
3
3
|
import { ColorFn, ColorKeyword, CssAngle, CssColor, CssLength, CssPercentage, CssRatio, CssTime, CssValue, CssValueTypeName, CssVarRef, HexColor, HslColor, RgbColor } from "./types/css-values.js";
|
|
4
4
|
import { ColorExpression, ColorSpace, ColorValue, GradientStop, GradientValue, LengthOrPercent, LineDirection, LinearGradientExpr, MixExpr, RadialGradientExpr, RadialSize, TokenRefToCss, alpha, isColorExpression, isLinearGradientExpr, isMixExpr, isRadialGradientExpr, linearGradient, mix, radialGradient, resolveColorExpression } from "./colorExpressions.js";
|
|
5
5
|
import { CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, CssPropertyWithKeywords } from "./types/css-property-keywords.js";
|
|
@@ -7,15 +7,16 @@ import { ColorCssProperty, CssGlobalKeyword, CssPropertyName, CssPropertyValues
|
|
|
7
7
|
import { AnyStylePropDefinition, ArbitrarySpec, BaseStyles, BuildOptions, ComponentDefinition, ComponentGroupDefinition, ComponentMetadata, CompositeStyleDefinition, CompositeStyleObject, CompoundPropsEntry, CssMotionDefinition, FontAssetMember, GlobalStylesDef, JsMotionDefinition, LayerInput, LiteralFor, ModeDefinition, ModeOptionDefinition, ModifierDefinition, MotionDefinitionInput, MotionKeyframes, MotionStateKeyframe, MotionTransition, OpacityPairSpec, PreviewDefinition, PropBinding, SerializedAssetGroup, SerializedComponentGroup, SerializedConfig, SerializedFontAssetGroup, SerializedIconAssetGroup, SerializedTokenGroup, SlotMotion, StylePropDefinition, StylePropMetadata, StylePropProperty, TokenDefinition, TokenGroupDefinition, TokenModifierKey, TokenModifierValue, TokenType, TokenValue, ValuesEntry } from "./types.js";
|
|
8
8
|
import { AssetGroupBuilder, AssetGroupConfig, AssetGroupDefinition, FontAssetGroupConfig, FontAssetGroupDefinition, IconAssetGroupConfig, IconAssetGroupDefinition, IconAssetMember, IconAssetMetadata, defineAssetGroup, defineAssetIcon } from "./defineAssetGroup.js";
|
|
9
9
|
import { AssetGroup } from "./AssetGroup.js";
|
|
10
|
+
import { resolveAssetRefCss, resolveFontStack } from "./asset-value.js";
|
|
10
11
|
import { Css, CssClassName, CssDeclaration, CssSelector, CssVar, cssClassName, cssDeclaration, cssSelector, cssVar } from "./brands.js";
|
|
11
12
|
import { BooleanMarker, LayerMarker, NumberMarker, PREVIEW_SEED_KEY, PreviewAxisMarker, PreviewPropsRule, RequiredBrand, SlotMarker, SlotRef, SlotValueType, StringMarker, VariantMarker, VariantMarkerArray, VariantMarkerObject, isBoolMarker, isLayerMarker, isNumberMarker, isPreviewAxisMarker, isSlotMarker, isStringMarker, isVariantArrayMarker, isVariantMarker, matchesPreviewWhen, resolvePreviewRules } from "./markers.js";
|
|
12
13
|
import { Component, ComponentKind, CompositeInfo, FunctionInfo, Layer, PrimitivePropKind, PropBase, PropInfo, PropKind, ResolvedCompoundOverrides, SlotInfo, SlotValueKind, StylePropInfo, StylePropKeyword, StylePropTokenUsage, VariantInfo } from "./Component.js";
|
|
13
14
|
import { ComponentGroup } from "./ComponentGroup.js";
|
|
14
15
|
import { CompositeStyle } from "./CompositeStyle.js";
|
|
15
16
|
import { makeTokenRefToCss } from "./entity-utils.js";
|
|
16
|
-
import { DataAttrs } from "./Props.js";
|
|
17
|
+
import { DataAttrs, LayerPropsMap } from "./Props.js";
|
|
17
18
|
import { defineProvider } from "./defineProvider.js";
|
|
18
|
-
import { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, PreviewCallbackHelpers, TokenGroupMetadata, TypedSlotRef, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant } from "./factories.js";
|
|
19
|
+
import { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, PreviewCallbackHelpers, RawToken, TokenGroupMetadata, TokenRawValue, TypedSlotRef, asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant } from "./factories.js";
|
|
19
20
|
import { Mode, ModeOption } from "./Mode.js";
|
|
20
21
|
import { Modifier } from "./Modifier.js";
|
|
21
22
|
import { CssMotionDef, JsMotionDef, MotionDef } from "./MotionDef.js";
|
|
@@ -30,4 +31,4 @@ import { ELEMENT_MARKER_KIND, ElementMarker, OpaqueLeafPredicate, hasElementMark
|
|
|
30
31
|
import { interpolate } from "./interpolate.js";
|
|
31
32
|
import { ModeBackedModifierDefinition, ModeBackedModifierInput, ModeBackedModifierLookup, OverrideModeRef, OverrideRow, buildModeBackedModifierLookup, buildNestedModifierUpdate, createModeBackedModifierLookup, mergeModifierUpdates, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, overrideRowsToModifierTree, resolveOverrideRowValue } from "./token-override-rows.js";
|
|
32
33
|
import { rem } from "./units.js";
|
|
33
|
-
export { ASSET_CLASS_CAPABILITIES, type AnyRef, type AnyStylePropDefinition, type ArbitrarySpec, AssetGroup, type AssetGroupBuilder, type AssetGroupConfig, type AssetGroupDefinition, type AssetGroupName, type AssetGroupRef, type AssetKind, type BaseStyles, type BooleanMarker, type BoundComponent, type BuildOptions, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, type ColorCssProperty, type ColorExpression, type ColorFn, type ColorKeyword, type ColorSpace, type ColorValue, Component, type ComponentBuilder, type ComponentBuilderMethods, type ComponentDefinition, ComponentGroup, type ComponentGroupDefinition, type ComponentKind, type ComponentMetadata, type ComponentName, type ComponentRef, type ComponentRenderFn, type CompositeInfo, type CompositeName, type CompositeRef, type CompositeRefBuilder, CompositeStyle, type CompositeStyleDefinition, type CompositeStyleObject, type CompoundPropsEntry, Config, type ConfigCallbackHelpers, type Css, type CssAngle, type CssClassName, type CssColor, type CssDeclaration, type CssGlobalKeyword, type CssLength, CssMotionDef, type CssMotionDefinition, type CssPercentage, type CssPropertyName, type CssPropertyValues, type CssPropertyWithKeywords, type CssRatio, type CssSelector, type CssTime, type CssValue, type CssValueTypeName, type CssVar, type CssVarRef, type DataAttrs, type DefineComponentFn, type DefinedComponent, type DefinedProvider, type DefinedStyleProp, type DefinedTokenGroup, type DependenciesQuery, type DependencyKind, type DependencyRef, type DependentsQuery, ELEMENT_MARKER_KIND, type ElementMarker, type FontAssetGroupConfig, type FontAssetGroupDefinition, type FontAssetMember, type FunctionInfo, type GlobalStylesDef, type GradientStop, type GradientValue, type HexColor, type HslColor, type IconAssetGroupConfig, type IconAssetGroupDefinition, type IconAssetMember, type IconAssetMetadata, JsMotionDef, type JsMotionDefinition, Layer, type LayerInput, type LayerMarker, type LengthOrPercent, type LineDirection, type LinearGradientExpr, type LiteralFor, type MixExpr, Mode, type ModeBackedModifierDefinition, type ModeBackedModifierInput, type ModeBackedModifierLookup, type ModeDefinition, type ModeName, ModeOption, type ModeOptionDefinition, type ModeRef, Modifier, type ModifierDefinition, type MotionDef, type MotionDefinitionInput, type MotionKeyframes, type MotionStateKeyframe, type MotionTransition, type NumberMarker, type OpacityPairSpec, type OpaqueLeafPredicate, type OverrideModeRef, type OverrideRow, PREVIEW_SEED_KEY, type PreviewAxisMarker, type PreviewCallbackHelpers, type PreviewDefinition, type PreviewPropsRule, type PrimitivePropKind, type PropBase, type PropBinding, type PropInfo, type PropKind, Provider, type RadialGradientExpr, type RadialSize, type RegisteredAssetGroups, type RegisteredComponents, type RegisteredCompositeStyles, type RegisteredModes, type RegisteredModifiers, type RegisteredMotionDefs, type RegisteredStyleProps, type RegisteredTokenGroups, type RequiredBrand, type ResolvedCompoundOverrides, type ResolvedTokenLiteral, type RgbColor, SOURCE_PATH_KEY, type SerializedAssetGroup, type SerializedComponentGroup, type SerializedConfig, type SerializedFontAssetGroup, type SerializedIconAssetGroup, type SerializedTokenGroup, type SlotInfo, type SlotMarker, type SlotMotion, type SlotRef, type SlotValueKind, type SlotValueType, type StringMarker, StyleProp, type StylePropDefinition, type StylePropInfo, type StylePropKeyword, type StylePropMetadata, type StylePropName, type StylePropProperty, type StylePropRef, type StylePropTokenUsage, type TagName, type TagRef, Token, type TokenDefinition, TokenGroup, type TokenGroupDefinition, type TokenGroupMetadata, type TokenGroupName, type TokenGroupRef, type TokenModifierKey, type TokenModifierValue, type TokenName, type TokenQualifiedName, type TokenRef, type TokenRefToCss, type TokenType, type TokenValue, type TypedSlotRef, type ValuesEntry, type VariantInfo, type VariantMarker, type VariantMarkerArray, type VariantMarkerObject, alpha, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveColorExpression, resolveOverrideRowValue, resolvePreviewRules, reviveElementMarkersDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
|
34
|
+
export { ASSET_CLASS_CAPABILITIES, type AnyRef, type AnyStylePropDefinition, type ArbitrarySpec, AssetGroup, type AssetGroupBuilder, type AssetGroupConfig, type AssetGroupDefinition, type AssetGroupName, type AssetGroupRef, type AssetKind, type AssetName, type AssetRef, type BaseStyles, type BooleanMarker, type BoundComponent, type BuildOptions, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, type ColorCssProperty, type ColorExpression, type ColorFn, type ColorKeyword, type ColorSpace, type ColorValue, Component, type ComponentBuilder, type ComponentBuilderMethods, type ComponentDefinition, ComponentGroup, type ComponentGroupDefinition, type ComponentKind, type ComponentMetadata, type ComponentName, type ComponentRef, type ComponentRenderFn, type CompositeInfo, type CompositeName, type CompositeRef, type CompositeRefBuilder, CompositeStyle, type CompositeStyleDefinition, type CompositeStyleObject, type CompoundPropsEntry, Config, type ConfigCallbackHelpers, type Css, type CssAngle, type CssClassName, type CssColor, type CssDeclaration, type CssGlobalKeyword, type CssLength, CssMotionDef, type CssMotionDefinition, type CssPercentage, type CssPropertyName, type CssPropertyValues, type CssPropertyWithKeywords, type CssRatio, type CssSelector, type CssTime, type CssValue, type CssValueTypeName, type CssVar, type CssVarRef, type DataAttrs, type DefineComponentFn, type DefinedComponent, type DefinedProvider, type DefinedStyleProp, type DefinedTokenGroup, type DependenciesQuery, type DependencyKind, type DependencyRef, type DependentsQuery, ELEMENT_MARKER_KIND, type ElementMarker, type FontAssetGroupConfig, type FontAssetGroupDefinition, type FontAssetMember, type FunctionInfo, type GlobalStylesDef, type GradientStop, type GradientValue, type HexColor, type HslColor, type IconAssetGroupConfig, type IconAssetGroupDefinition, type IconAssetMember, type IconAssetMetadata, JsMotionDef, type JsMotionDefinition, Layer, type LayerInput, type LayerMarker, type LayerPropsMap, type LengthOrPercent, type LineDirection, type LinearGradientExpr, type LiteralFor, type MixExpr, Mode, type ModeBackedModifierDefinition, type ModeBackedModifierInput, type ModeBackedModifierLookup, type ModeDefinition, type ModeName, ModeOption, type ModeOptionDefinition, type ModeRef, Modifier, type ModifierDefinition, type MotionDef, type MotionDefinitionInput, type MotionKeyframes, type MotionStateKeyframe, type MotionTransition, type NumberMarker, type OpacityPairSpec, type OpaqueLeafPredicate, type OverrideModeRef, type OverrideRow, PREVIEW_SEED_KEY, type PreviewAxisMarker, type PreviewCallbackHelpers, type PreviewDefinition, type PreviewPropsRule, type PrimitivePropKind, type PropBase, type PropBinding, type PropInfo, type PropKind, Provider, type RadialGradientExpr, type RadialSize, type RawToken, type RegisteredAssetGroups, type RegisteredComponents, type RegisteredCompositeStyles, type RegisteredModes, type RegisteredModifiers, type RegisteredMotionDefs, type RegisteredStyleProps, type RegisteredTokenGroups, type RequiredBrand, type ResolvedCompoundOverrides, type ResolvedTokenLiteral, type RgbColor, SOURCE_PATH_KEY, type SerializedAssetGroup, type SerializedComponentGroup, type SerializedConfig, type SerializedFontAssetGroup, type SerializedIconAssetGroup, type SerializedTokenGroup, type SlotInfo, type SlotMarker, type SlotMotion, type SlotRef, type SlotValueKind, type SlotValueType, type StringMarker, StyleProp, type StylePropDefinition, type StylePropInfo, type StylePropKeyword, type StylePropMetadata, type StylePropName, type StylePropProperty, type StylePropRef, type StylePropTokenUsage, type TagName, type TagRef, Token, type TokenDefinition, TokenGroup, type TokenGroupDefinition, type TokenGroupMetadata, type TokenGroupName, type TokenGroupRef, type TokenModifierKey, type TokenModifierValue, type TokenName, type TokenQualifiedName, type TokenRawNameRegistry, type TokenRawValue, type TokenRef, type TokenRefToCss, type TokenType, type TokenValue, type TypedSlotRef, type ValuesEntry, type VariantInfo, type VariantMarker, type VariantMarkerArray, type VariantMarkerObject, alpha, asChild, asset, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isAssetRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveAssetRefCss, resolveColorExpression, resolveFontStack, resolveOverrideRowValue, resolvePreviewRules, reviveElementMarkersDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import { cssClassName, cssDeclaration, cssSelector, cssVar } from "./brands.js";
|
|
|
2
2
|
import { makeTokenRefToCss } from "./entity-utils.js";
|
|
3
3
|
import { AssetGroup } from "./AssetGroup.js";
|
|
4
4
|
import { ASSET_CLASS_CAPABILITIES, isPlaceable } from "./asset-kind.js";
|
|
5
|
+
import { resolveAssetRefCss, resolveFontStack } from "./asset-value.js";
|
|
5
6
|
import { SOURCE_PATH_KEY, attachSourcePath, captureCallerPath, readSourcePath } from "./captureCallerPath.js";
|
|
6
|
-
import { assetGroup, component, composite, isAssetGroupRef, isComponentRef, isCompositeRef, isModeRef, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, mode, styleProp, tag, token, tokenGroup } from "./refs.js";
|
|
7
|
+
import { asset, assetGroup, component, composite, isAssetGroupRef, isAssetRef, isComponentRef, isCompositeRef, isModeRef, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, mode, styleProp, tag, token, tokenGroup } from "./refs.js";
|
|
7
8
|
import { alpha, isColorExpression, isLinearGradientExpr, isMixExpr, isRadialGradientExpr, linearGradient, mix, radialGradient, resolveColorExpression } from "./colorExpressions.js";
|
|
8
9
|
import { defineAssetGroup, defineAssetIcon } from "./defineAssetGroup.js";
|
|
9
10
|
import { ELEMENT_MARKER_KIND, hasElementMarkerDeep, isElementLikeValue, isElementMarker, reviveElementMarkersDeep } from "./element-marker.js";
|
|
@@ -21,9 +22,9 @@ import { TokenGroup } from "./TokenGroup.js";
|
|
|
21
22
|
import { Config, parseRegistryKey } from "./Config.js";
|
|
22
23
|
import { findComponentReferrers } from "./component-referrers.js";
|
|
23
24
|
import { defineProvider } from "./defineProvider.js";
|
|
24
|
-
import { boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant } from "./factories.js";
|
|
25
|
+
import { asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant } from "./factories.js";
|
|
25
26
|
import { interpolate } from "./interpolate.js";
|
|
26
27
|
import { buildModeBackedModifierLookup, buildNestedModifierUpdate, createModeBackedModifierLookup, mergeModifierUpdates, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, overrideRowsToModifierTree, resolveOverrideRowValue } from "./token-override-rows.js";
|
|
27
28
|
import { CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS } from "./types/css-property-keywords.js";
|
|
28
29
|
import { rem } from "./units.js";
|
|
29
|
-
export { ASSET_CLASS_CAPABILITIES, AssetGroup, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, Component, ComponentGroup, CompositeStyle, Config, CssMotionDef, ELEMENT_MARKER_KIND, JsMotionDef, Layer, Mode, ModeOption, Modifier, PREVIEW_SEED_KEY, Provider, SOURCE_PATH_KEY, StyleProp, Token, TokenGroup, alpha, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveColorExpression, resolveOverrideRowValue, resolvePreviewRules, reviveElementMarkersDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
|
30
|
+
export { ASSET_CLASS_CAPABILITIES, AssetGroup, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, Component, ComponentGroup, CompositeStyle, Config, CssMotionDef, ELEMENT_MARKER_KIND, JsMotionDef, Layer, Mode, ModeOption, Modifier, PREVIEW_SEED_KEY, Provider, SOURCE_PATH_KEY, StyleProp, Token, TokenGroup, alpha, asChild, asset, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isAssetRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveAssetRefCss, resolveColorExpression, resolveFontStack, resolveOverrideRowValue, resolvePreviewRules, reviveElementMarkersDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|