@yahoo/uds-create-config 3.0.8 → 3.0.10
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/entities/system/Component.d.ts +4 -3
- package/dist/entities/system/defineComponent.d.ts +72 -18
- package/dist/framework/class-names.js +53 -9
- package/dist/framework/memo.js +5 -1
- package/dist/framework/projections.js +26 -0
- package/dist/framework/render-spec.js +40 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { EntityClass } from "../../framework/defineEntity.js";
|
|
|
5
5
|
import { Config } from "../../framework/Config.js";
|
|
6
6
|
import { ComputedInput } from "../../framework/registry.js";
|
|
7
7
|
import { StyleValue } from "./style-bag.js";
|
|
8
|
-
import { ComponentPropsOf, LayerMap, PropMap, RenderArgs, StyleRuleInput } from "./defineComponent.js";
|
|
8
|
+
import { AsInput, ComponentPropsOf, LayerMap, PropMap, RenderArgs, StyleRuleInput } from "./defineComponent.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
|
|
11
11
|
//#region src/entities/system/Component.d.ts
|
|
@@ -1272,8 +1272,9 @@ type ForwardedLayerNames<Contract, Delta> = ResolvedForwards<Contract, Delta> ex
|
|
|
1272
1272
|
* only `{ __ref, extend }`. */
|
|
1273
1273
|
type ExtendedComponentRef<Contract = ComponentContractOf<string>, Delta extends ComponentRefDelta = ComponentRefDelta, Extra = Record<never, never>> = ExtendedRef<Delta> & {
|
|
1274
1274
|
/** Phantom component signature: codegen replaces the authoring value before it is rendered, but
|
|
1275
|
-
* this lets `ComponentProps<typeof Button>` see the inherited and locally replaced contract.
|
|
1276
|
-
|
|
1275
|
+
* this lets `ComponentProps<typeof Button>` see the inherited and locally replaced contract. Generic
|
|
1276
|
+
* over a call site's `as`, the same way `ComponentBuilder`'s is. */
|
|
1277
|
+
<As extends AsInput = never>(props: ComponentPropsOf<ResolvedLayers<Contract, Delta>, ResolvedProps<Contract, Delta>, ResolvedDefaults<Contract, Delta>, Extra, ForwardedLayerNames<Contract, Delta>, As>): null;
|
|
1277
1278
|
render<E = Extra>(fn: (args: RenderArgs<ResolvedLayers<Contract, Delta>, ResolvedProps<Contract, Delta>> & E) => unknown): ExtendedComponentRef<Contract, Delta, E>;
|
|
1278
1279
|
/**
|
|
1279
1280
|
* Style rules for the extension, typed against the layers it ends up with — the linked contract's,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Ref as Ref$1 } from "../../framework/utils/refs.js";
|
|
2
|
+
import { RegisteredStyleProps } from "../../framework/registered.js";
|
|
2
3
|
import { Authored } from "../../framework/authoring.js";
|
|
3
4
|
import { StyleValue } from "./style-bag.js";
|
|
4
5
|
import { VariantValues } from "./Component.js";
|
|
5
|
-
import {
|
|
6
|
+
import { AllHTMLAttributes, ComponentPropsWithRef, ElementType, JSX, ReactNode, Ref } from "react";
|
|
6
7
|
|
|
7
8
|
//#region src/entities/system/defineComponent.d.ts
|
|
8
9
|
/**
|
|
@@ -248,14 +249,15 @@ type Declared<T> = { [K in keyof T as string extends K ? never : number extends
|
|
|
248
249
|
* props it DROPS from what it inherits — gone from the surface entirely. */
|
|
249
250
|
type DeclaredProps<P> = { [K in keyof P as P[K] extends null ? never : K]: ValueOf<P[K]> };
|
|
250
251
|
/**
|
|
251
|
-
* The props the rendered ELEMENT contributes.
|
|
252
|
+
* The props the rendered ELEMENT contributes, `ref` included.
|
|
252
253
|
*
|
|
253
254
|
* That element's React props are part of the component's surface — `<Pressable onClick={e => …}>`
|
|
254
255
|
* types `e` because `Pressable` renders a `button`. Left out, every handler a consumer passed fell
|
|
255
256
|
* into the open index signature and its parameter had no contextual type, which turned ~75 untouched
|
|
256
|
-
* call sites into implicit-`any` errors.
|
|
257
|
+
* call sites into implicit-`any` errors. The `ref` is the element's for the same reason: a
|
|
258
|
+
* `useRef<HTMLDivElement>` handed to an `<Box as="img">` is a mistake the element can name.
|
|
257
259
|
*/
|
|
258
|
-
type ElementPropsOf<Element> = Element extends keyof JSX.IntrinsicElements ?
|
|
260
|
+
type ElementPropsOf<Element> = Element extends keyof JSX.IntrinsicElements ? ComponentPropsWithRef<Element> : Element extends ((props: infer PropsOfComponent) => unknown) ? Declared<PropsOfComponent> : Record<never, never>;
|
|
259
261
|
/**
|
|
260
262
|
* Which element that is: the one a `defaultProps.as` FIXES, else the root layer.
|
|
261
263
|
*
|
|
@@ -264,10 +266,39 @@ type ElementPropsOf<Element> = Element extends keyof JSX.IntrinsicElements ? Com
|
|
|
264
266
|
* `as` is what a component PINS: `Input` is a Box in every other respect and an `<input>` in this
|
|
265
267
|
* one, so the layer stays the component it extends while `as` names the tag. Reading only the layer
|
|
266
268
|
* typed `Input`'s `onChange` against a `div` and lost `event.target.value` at every call site.
|
|
269
|
+
*
|
|
270
|
+
* A call site's own `as` outranks both — see {@link RenderedElementOf}.
|
|
267
271
|
*/
|
|
268
272
|
type ElementOf<L extends LayerMap, D> = D extends {
|
|
269
273
|
as: infer As;
|
|
270
274
|
} ? As : L['root'];
|
|
275
|
+
/**
|
|
276
|
+
* Whether an `as` names an element at all. `never` is a call that wrote none, and a `string` is a tag
|
|
277
|
+
* computed at runtime, which could be any of them. An `as` as wide as `ElementType` says nothing
|
|
278
|
+
* either: `React.ComponentProps<typeof Box>` reads the phantom signature with every type parameter
|
|
279
|
+
* at its constraint, and a consumer's `BoxProps` has to come out as the fixed element's surface, not
|
|
280
|
+
* a union over every tag.
|
|
281
|
+
*/
|
|
282
|
+
type NamesNoElement<As> = [As] extends [never] ? true : string extends As ? true : [ElementType] extends [As] ? true : false;
|
|
283
|
+
/**
|
|
284
|
+
* What a call site may write as `as`: a tag, a component, or a `string` it computes. A computed tag
|
|
285
|
+
* names no element in particular, so the surface stays the fixed element's.
|
|
286
|
+
*/
|
|
287
|
+
type AsInput = ElementType | string;
|
|
288
|
+
/**
|
|
289
|
+
* A union folded into one object type, so a union of tags contributes every member's props at once.
|
|
290
|
+
* Distributed, `<Box as={tag}>` with `tag: 'p' | 'span'` would type `onClick` as one of two handlers,
|
|
291
|
+
* and a union of function types gives the handler's parameter no contextual type at all.
|
|
292
|
+
*/
|
|
293
|
+
type UnionToIntersection<U> = (U extends unknown ? (member: U) => void : never) extends ((member: infer I) => void) ? I : never;
|
|
294
|
+
/**
|
|
295
|
+
* The element one call renders: what its `as` names, else what the component fixes.
|
|
296
|
+
*
|
|
297
|
+
* The call site's `as` replaces the fixed element rather than adding to it. Intersected instead, a
|
|
298
|
+
* handler on `<Box as="button">` would be typed against `HTMLButtonElement | HTMLDivElement` and
|
|
299
|
+
* `ref` against both, though the div is never rendered.
|
|
300
|
+
*/
|
|
301
|
+
type RenderedElementOf<L extends LayerMap, D, As> = NamesNoElement<As> extends true ? ElementOf<L, D> : As;
|
|
271
302
|
/**
|
|
272
303
|
* The props a consumer may pass — the declared ones, the rendered element's, and the style props.
|
|
273
304
|
*
|
|
@@ -277,19 +308,41 @@ type ElementOf<L extends LayerMap, D> = D extends {
|
|
|
277
308
|
* `size="sm"` failed with "string is not assignable to undefined" — an empty intersection, which is
|
|
278
309
|
* the type saying no value could ever satisfy both.
|
|
279
310
|
*
|
|
311
|
+
* `As` is the element a call site picks (`never` when it picks none), see {@link AsPropsOf}.
|
|
312
|
+
*
|
|
280
313
|
* Open at the end on purpose: a component's style-prop surface is the system's, not this file's.
|
|
281
314
|
*/
|
|
282
|
-
type ComponentPropsOf<L extends LayerMap, P extends PropMap, D = Record<never, never>, E = Record<never, never>, F extends string = never> = Without<Partial<DeclaredProps<P>>, keyof E> & Partial<E> & Omit<ElementPropsOf<
|
|
315
|
+
type ComponentPropsOf<L extends LayerMap, P extends PropMap, D = Record<never, never>, E = Record<never, never>, F extends string = never, As = never> = Without<Partial<DeclaredProps<P>>, keyof E> & Partial<E> & Omit<UnionToIntersection<ElementPropsOf<RenderedElementOf<L, D, As>>>, keyof P | keyof E> & Omit<ForwardedPropsOf<L, F>, keyof P | keyof E> & AsPropsOf<As, P, E> & Record<string, unknown>;
|
|
283
316
|
/**
|
|
284
|
-
* The
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
317
|
+
* The polymorphic half of the phantom signature: `as` itself, plus the refusal of attributes that
|
|
318
|
+
* belong to some other element.
|
|
319
|
+
*
|
|
320
|
+
* `As` is inferred from the `as` a call site writes, so `<Box as="img" src alt ref>` types `src`,
|
|
321
|
+
* `alt` and `ref` as an image's with no type argument. It may still be given one —
|
|
322
|
+
* `<Box<'img', ImgHTMLAttributes<HTMLImageElement>>>` is how v1's generated components took it.
|
|
323
|
+
*
|
|
324
|
+
* With no `as` there is nothing here, and `ComponentProps<typeof Box>` reads the fixed element alone.
|
|
289
325
|
*/
|
|
290
326
|
type AsPropsOf<As, P, E> = [As] extends [never] ? Record<never, never> : {
|
|
291
327
|
as?: As;
|
|
292
|
-
} &
|
|
328
|
+
} & ForeignAttributesOf<As, P, E>;
|
|
329
|
+
/** The attribute names across a union of tags — distributed, so `'a' | 'button'` keeps `href`. */
|
|
330
|
+
type IntrinsicAttributeNames<As> = As extends keyof JSX.IntrinsicElements ? keyof JSX.IntrinsicElements[As] : never;
|
|
331
|
+
/**
|
|
332
|
+
* The HTML attributes the element named by `as` does NOT take, each typed `never`.
|
|
333
|
+
*
|
|
334
|
+
* The surface is open at the end, so `<Box as="img" href>` would otherwise pass with `href: unknown`
|
|
335
|
+
* and reach the `<img>` as an attribute nothing reads. Refusing an attribute is only right when it
|
|
336
|
+
* is one — a name the component declares, a render extra, and a style prop the system registers are
|
|
337
|
+
* all excluded, since `width` on a `<span>` is a style prop the consumer meant, not a stray
|
|
338
|
+
* attribute. So is `as` itself, which `<link>` happens to take as an attribute. A component `as` is
|
|
339
|
+
* left alone: its props are its own to name.
|
|
340
|
+
*
|
|
341
|
+
* Nothing is refused until the system's build has filled {@link RegisteredStyleProps}: before that
|
|
342
|
+
* there is no telling a stray attribute from a style prop, and an unbuilt consumer compiles the way
|
|
343
|
+
* the registry promises.
|
|
344
|
+
*/
|
|
345
|
+
type ForeignAttributesOf<As, P, E> = [keyof RegisteredStyleProps] extends [never] ? Record<never, never> : [As] extends [keyof JSX.IntrinsicElements] ? { [K in Exclude<keyof AllHTMLAttributes<HTMLElement>, 'as' | IntrinsicAttributeNames<As> | keyof P | keyof E | keyof RegisteredStyleProps>]?: never } : Record<never, never>;
|
|
293
346
|
/**
|
|
294
347
|
* The props a component picks up from the layers it FORWARDS.
|
|
295
348
|
*
|
|
@@ -353,13 +406,14 @@ F extends string = never> extends Authored {
|
|
|
353
406
|
* emitted module), but `export type ButtonProps = ComponentProps<typeof Button>` is how a consumer
|
|
354
407
|
* names its props, and that reads this type.
|
|
355
408
|
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
409
|
+
* One signature, generic over the element a call site picks with `as` — see {@link AsPropsOf}.
|
|
410
|
+
* A second, plain overload would take every call the generic one refuses: the surface is open at
|
|
411
|
+
* the end, so `<Box as="img" src={3}>` would compile through it with `src: unknown`.
|
|
412
|
+
*
|
|
413
|
+
* `Extra` is only ever given as a type argument. Inferred from the call, a spread of a union of
|
|
414
|
+
* prop bags would make it one member of the union, and the other member would then fail against it.
|
|
360
415
|
*/
|
|
361
|
-
<As extends
|
|
362
|
-
(props: ComponentPropsOf<L, P, D, E, F>): null;
|
|
416
|
+
<As extends AsInput = never, Extra = Record<never, never>>(props: ComponentPropsOf<L, P, D, E, F, As> & Partial<NoInfer<Extra>>): null;
|
|
363
417
|
readonly kind: 'component';
|
|
364
418
|
/** The authored body, readable so codegen can pair it with the render found in the source. */
|
|
365
419
|
readonly body: Record<string, unknown>;
|
|
@@ -471,4 +525,4 @@ interface DefineComponent {
|
|
|
471
525
|
}
|
|
472
526
|
declare const defineComponent: DefineComponent;
|
|
473
527
|
//#endregion
|
|
474
|
-
export { AuthoredComponent, AuthoredProp, ComponentBuilder, ComponentPropsOf, LayerElement, LayerMap, PropDecl, PropMap, RenderArgs, StyleRuleInput, defineComponent };
|
|
528
|
+
export { AsInput, AuthoredComponent, AuthoredProp, ComponentBuilder, ComponentPropsOf, LayerElement, LayerMap, PropDecl, PropMap, RenderArgs, StyleRuleInput, defineComponent };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isRef, kindOf, pathOf, refLeaf } from "./utils/refs.js";
|
|
2
2
|
import { rootLayerOf } from "../entities/system/element.js";
|
|
3
3
|
import { classPrefixOf } from "../entities/system/Settings.js";
|
|
4
|
+
import { createSliceMemo } from "./memo.js";
|
|
4
5
|
import { authoredValue, className, negatedCssValue, renderStyleValue, resolveComponentProps, stylePropLeafForToken, stylePropValueLeaves, stylePropertyPathFor } from "./projections.js";
|
|
5
6
|
import { ruleApplies } from "./layer-styles.js";
|
|
6
|
-
import { createSliceMemo } from "./memo.js";
|
|
7
7
|
//#region src/framework/class-names.ts
|
|
8
8
|
/**
|
|
9
9
|
* What a class is CALLED — the one answer, for everything that has to agree about it.
|
|
@@ -141,6 +141,24 @@ function ruleCondition(when) {
|
|
|
141
141
|
* ({@link componentLayerClass}), which every element already wears with nothing to test.
|
|
142
142
|
*/
|
|
143
143
|
function componentRuleClasses(config, path) {
|
|
144
|
+
const cache = ruleClassCache(config);
|
|
145
|
+
const hit = cache.get(path);
|
|
146
|
+
if (hit) return hit;
|
|
147
|
+
const classes = computeRuleClasses(config, path);
|
|
148
|
+
cache.set(path, classes);
|
|
149
|
+
return classes;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Per component slice, the rule classes of each component asked for so far. An expansion asks this
|
|
153
|
+
* once per element it paints, for the element's own class list and again for the props its rules
|
|
154
|
+
* consume; a stylesheet asks once per component. The class prefix comes from settings, which is why
|
|
155
|
+
* that slice is part of the key.
|
|
156
|
+
*/
|
|
157
|
+
const ruleClassCache = createSliceMemo({
|
|
158
|
+
kinds: ["component", "settings"],
|
|
159
|
+
compute: (_config) => /* @__PURE__ */ new Map()
|
|
160
|
+
});
|
|
161
|
+
function computeRuleClasses(config, path) {
|
|
144
162
|
const component = config.resolve("component", path);
|
|
145
163
|
if (!component) return [];
|
|
146
164
|
const { layers = {}, styles = {} } = component.toJSON();
|
|
@@ -275,20 +293,17 @@ function componentMotionClasses(config, path) {
|
|
|
275
293
|
* about which layer that is: an instance's own props land where its own props land.
|
|
276
294
|
*/
|
|
277
295
|
function componentPropClasses(config, path, state = {}) {
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
const {
|
|
281
|
-
|
|
296
|
+
const declared = compositePropsOf(config, path);
|
|
297
|
+
if (!declared) return {};
|
|
298
|
+
const { root, groups, defaultProps } = declared;
|
|
299
|
+
if (groups.length === 0) return {};
|
|
282
300
|
const resolved = {
|
|
283
301
|
...defaultProps,
|
|
284
302
|
...state
|
|
285
303
|
};
|
|
286
304
|
const classes = [];
|
|
287
|
-
for (const [prop,
|
|
288
|
-
if (decl?.type !== "composite") continue;
|
|
289
|
-
const group = isRef(decl.value) ? decl.value.__ref : void 0;
|
|
305
|
+
for (const [prop, group] of groups) {
|
|
290
306
|
const value = resolved[prop];
|
|
291
|
-
if (!group) continue;
|
|
292
307
|
const target = memberNamed(group, value);
|
|
293
308
|
if (target === void 0) continue;
|
|
294
309
|
if (!config.resolve("composite", target)) continue;
|
|
@@ -296,6 +311,35 @@ function componentPropClasses(config, path, state = {}) {
|
|
|
296
311
|
}
|
|
297
312
|
return classes.length > 0 ? { [root]: classes } : {};
|
|
298
313
|
}
|
|
314
|
+
/** The part of {@link componentPropClasses} that depends on the component alone, once per slice:
|
|
315
|
+
* an expansion asks it for every instance it paints. `undefined` for a path no component answers. */
|
|
316
|
+
function compositePropsOf(config, path) {
|
|
317
|
+
const cache = compositePropsCache(config);
|
|
318
|
+
if (cache.has(path)) return cache.get(path);
|
|
319
|
+
const component = config.resolve("component", path);
|
|
320
|
+
let declared;
|
|
321
|
+
if (component) {
|
|
322
|
+
const { layers = {}, props = {}, defaultProps = {} } = component.toJSON();
|
|
323
|
+
const [root] = rootLayerOf(layers);
|
|
324
|
+
const groups = [];
|
|
325
|
+
for (const [prop, decl] of Object.entries(props)) {
|
|
326
|
+
if (decl?.type !== "composite") continue;
|
|
327
|
+
const group = isRef(decl.value) ? decl.value.__ref : void 0;
|
|
328
|
+
if (group) groups.push([prop, group]);
|
|
329
|
+
}
|
|
330
|
+
declared = {
|
|
331
|
+
root,
|
|
332
|
+
groups,
|
|
333
|
+
defaultProps
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
cache.set(path, declared);
|
|
337
|
+
return declared;
|
|
338
|
+
}
|
|
339
|
+
const compositePropsCache = createSliceMemo({
|
|
340
|
+
kinds: ["component"],
|
|
341
|
+
compute: (_config) => /* @__PURE__ */ new Map()
|
|
342
|
+
});
|
|
299
343
|
/**
|
|
300
344
|
* The COMPOSITE a style rule sets on each layer, for one instance — forwarded to the layer as a prop.
|
|
301
345
|
*
|
package/dist/framework/memo.js
CHANGED
|
@@ -19,10 +19,14 @@ const RESULT = Object.freeze({});
|
|
|
19
19
|
function sliceChain(config, kind, acc, seen) {
|
|
20
20
|
if (seen.has(config)) return;
|
|
21
21
|
seen.add(config);
|
|
22
|
-
|
|
22
|
+
const own = config.snapshot.slice(kind);
|
|
23
|
+
if (!((config.attachedSources?.().length ?? 0) > 0 && isEmptySlice(own))) acc.push(own);
|
|
23
24
|
const source = config.linkedSource?.(kind)?.config;
|
|
24
25
|
if (source) sliceChain(source, kind, acc, seen);
|
|
25
26
|
}
|
|
27
|
+
function isEmptySlice(slice) {
|
|
28
|
+
return slice.items.size === 0 && slice.groups.size === 0 && slice.overrides.size === 0;
|
|
29
|
+
}
|
|
26
30
|
/**
|
|
27
31
|
* The identity of the data a computation over `kinds` reads: every attached source, then each kind's
|
|
28
32
|
* slice chain.
|
|
@@ -6,6 +6,7 @@ import { listedIn } from "./utils/enumerated.js";
|
|
|
6
6
|
import { modifierCategory } from "../entities/system/Modifier.js";
|
|
7
7
|
import { classPrefixOf, varPrefixOf } from "../entities/system/Settings.js";
|
|
8
8
|
import { StyleProperty, leavesOfStylePropValue } from "../entities/system/StyleProperty.js";
|
|
9
|
+
import { createSliceMemo } from "./memo.js";
|
|
9
10
|
//#region src/framework/projections.ts
|
|
10
11
|
/**
|
|
11
12
|
* Expanded value domains, cached per config instance.
|
|
@@ -540,6 +541,18 @@ function negatedCssValue(value) {
|
|
|
540
541
|
* it is destructured out like any other. It writes nothing and does not fall through.
|
|
541
542
|
*/
|
|
542
543
|
function declaredPropRouting(config, path) {
|
|
544
|
+
const cache = propRoutingCache(config);
|
|
545
|
+
const hit = cache.get(path);
|
|
546
|
+
if (hit) return hit;
|
|
547
|
+
const routing = computePropRouting(config, path);
|
|
548
|
+
cache.set(path, routing);
|
|
549
|
+
return routing;
|
|
550
|
+
}
|
|
551
|
+
const propRoutingCache = createSliceMemo({
|
|
552
|
+
kinds: ["component"],
|
|
553
|
+
compute: (_config) => /* @__PURE__ */ new Map()
|
|
554
|
+
});
|
|
555
|
+
function computePropRouting(config, path) {
|
|
543
556
|
const { props = {} } = config.resolve("component", path)?.toJSON() ?? {};
|
|
544
557
|
const routing = /* @__PURE__ */ new Map();
|
|
545
558
|
for (const [name, declaration] of Object.entries(props)) {
|
|
@@ -756,6 +769,19 @@ function opacityPercentage(value) {
|
|
|
756
769
|
* chain (transitive inheritance), cycle-guarded.
|
|
757
770
|
*/
|
|
758
771
|
function resolveComponentProps(config, path, seen = /* @__PURE__ */ new Set()) {
|
|
772
|
+
if (seen.size > 0) return computeComponentProps(config, path, seen);
|
|
773
|
+
const cache = componentPropsCache(config);
|
|
774
|
+
const hit = cache.get(path);
|
|
775
|
+
if (hit) return hit;
|
|
776
|
+
const value = computeComponentProps(config, path, seen);
|
|
777
|
+
cache.set(path, value);
|
|
778
|
+
return value;
|
|
779
|
+
}
|
|
780
|
+
const componentPropsCache = createSliceMemo({
|
|
781
|
+
kinds: ["component"],
|
|
782
|
+
compute: (_config) => /* @__PURE__ */ new Map()
|
|
783
|
+
});
|
|
784
|
+
function computeComponentProps(config, path, seen) {
|
|
759
785
|
if (seen.has(path)) return {};
|
|
760
786
|
seen.add(path);
|
|
761
787
|
const comp = config.resolve("component", path);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { kindOf, memberOf, pathOf, ref, splitRef } from "./utils/refs.js";
|
|
2
|
+
import { createSliceMemo } from "./memo.js";
|
|
2
3
|
import { authoredBag, memberFromLeaf, resolveComponentProps } from "./projections.js";
|
|
3
4
|
import { intoName, routesContent } from "./prop-surface.js";
|
|
4
5
|
import { graftPreviewElements } from "../spec/preview-elements.js";
|
|
@@ -25,7 +26,26 @@ const slotAnatomyPropOf = (node) => {
|
|
|
25
26
|
const name = node.props?.name;
|
|
26
27
|
return typeof name === "string" ? name : void 0;
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Per component slice, the facts of one component an expansion reads for every instance of it: its
|
|
31
|
+
* serialized body, the props it consumes, and where its slots route. A canvas asks these once per
|
|
32
|
+
* element it paints, and a page of screens paints thousands, so each is answered once per slice.
|
|
33
|
+
*/
|
|
34
|
+
const componentFactsCache = createSliceMemo({
|
|
35
|
+
kinds: ["component"],
|
|
36
|
+
compute: (_config) => ({
|
|
37
|
+
bodies: /* @__PURE__ */ new Map(),
|
|
38
|
+
consumed: /* @__PURE__ */ new Map(),
|
|
39
|
+
slots: /* @__PURE__ */ new Map()
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
function bodyOf(config, path) {
|
|
43
|
+
const { bodies } = componentFactsCache(config);
|
|
44
|
+
if (bodies.has(path)) return bodies.get(path);
|
|
45
|
+
const body = config.resolve("component", path)?.toJSON();
|
|
46
|
+
bodies.set(path, body);
|
|
47
|
+
return body;
|
|
48
|
+
}
|
|
29
49
|
/** The node a tree is rooted at — the one named `root`, else the first declared. The same rule
|
|
30
50
|
* `rootLayerOf` uses for layers, which is why neither is stored. */
|
|
31
51
|
function rootKeyOf(nodes) {
|
|
@@ -534,6 +554,14 @@ function boundElementType(config, componentPath, prop, value) {
|
|
|
534
554
|
* (`disabled` on a Pressable) means it for the element.
|
|
535
555
|
*/
|
|
536
556
|
function consumedProps(config, path, body) {
|
|
557
|
+
const cache = componentFactsCache(config).consumed;
|
|
558
|
+
const hit = cache.get(path);
|
|
559
|
+
if (hit) return hit;
|
|
560
|
+
const consumed = computeConsumedProps(config, path, body);
|
|
561
|
+
cache.set(path, consumed);
|
|
562
|
+
return consumed;
|
|
563
|
+
}
|
|
564
|
+
function computeConsumedProps(config, path, body) {
|
|
537
565
|
const consumed = new Set(["className", "layerProps"]);
|
|
538
566
|
const declared = body.props ?? {};
|
|
539
567
|
for (const [name, decl] of Object.entries(declared)) if (decl?.type === "variant" || decl?.type === "slot" || decl?.type === "forward" || decl?.type === "composite") consumed.add(name);
|
|
@@ -544,7 +572,15 @@ function consumedProps(config, path, body) {
|
|
|
544
572
|
* `childrenPolicy` reads to answer whether a component accepts any. Not a system-defined name: a
|
|
545
573
|
* design system names its components and tokens, and this one names the channel. */
|
|
546
574
|
const CONTENT_PROP = "children";
|
|
547
|
-
function slotTargets(config, body) {
|
|
575
|
+
function slotTargets(config, path, body) {
|
|
576
|
+
const cache = componentFactsCache(config).slots;
|
|
577
|
+
const hit = cache.get(path);
|
|
578
|
+
if (hit) return hit;
|
|
579
|
+
const routing = computeSlotTargets(config, body);
|
|
580
|
+
cache.set(path, routing);
|
|
581
|
+
return routing;
|
|
582
|
+
}
|
|
583
|
+
function computeSlotTargets(config, body) {
|
|
548
584
|
const byLayer = /* @__PURE__ */ new Map();
|
|
549
585
|
const untargeted = [];
|
|
550
586
|
for (const [from, decl] of Object.entries(body.props ?? {})) {
|
|
@@ -594,7 +630,7 @@ function slotTargets(config, body) {
|
|
|
594
630
|
function slotTargetsOf(config, path) {
|
|
595
631
|
const body = bodyOf(config, path);
|
|
596
632
|
if (!body) return [];
|
|
597
|
-
const { byLayer, untargeted } = slotTargets(config, body);
|
|
633
|
+
const { byLayer, untargeted } = slotTargets(config, path, body);
|
|
598
634
|
const root = rootKeyOf(body.layers ?? {});
|
|
599
635
|
return [...[...byLayer].filter(([, decl]) => !decl.untargeted).map(([layer, decl]) => ({
|
|
600
636
|
layer,
|
|
@@ -661,7 +697,7 @@ function expandInstance(sink, path, instanceProps, content, hint, instanceSlots)
|
|
|
661
697
|
...instanceProps
|
|
662
698
|
};
|
|
663
699
|
const consumed = consumedProps(config, path, body);
|
|
664
|
-
const { byLayer: targets } = slotTargets(config, body);
|
|
700
|
+
const { byLayer: targets } = slotTargets(config, path, body);
|
|
665
701
|
const supplied = {
|
|
666
702
|
...body.defaultProps ?? {},
|
|
667
703
|
...instanceProps
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ import { ColorValue, DerivedColor, Gradient, alpha, darken, isDerivedColor, isGr
|
|
|
37
37
|
import { NativeToken, nativeTokenValue } from "./entities/native/NativeToken.js";
|
|
38
38
|
import { CANVAS_ROLES, CanvasRole, CanvasRoleName } from "./entities/system/CanvasRole.js";
|
|
39
39
|
import { StyleValue } from "./entities/system/style-bag.js";
|
|
40
|
-
import { AuthoredComponent, AuthoredProp, ComponentBuilder, ComponentPropsOf, LayerElement, LayerMap, PropDecl, PropMap, RenderArgs, StyleRuleInput, defineComponent } from "./entities/system/defineComponent.js";
|
|
40
|
+
import { AsInput, AuthoredComponent, AuthoredProp, ComponentBuilder, ComponentPropsOf, LayerElement, LayerMap, PropDecl, PropMap, RenderArgs, StyleRuleInput, defineComponent } from "./entities/system/defineComponent.js";
|
|
41
41
|
import { AuthoredPropBody, Component, ComponentBody, ComponentElementBody, ComponentPropBody, ComponentReference, ComponentStyleBody, ElementVisibility, ElementVisibilityInput, ExtendedComponentRef, ProjectedVisibility, VariantValueBody, VariantValues, canonicalWhen, forwardedNames, layerRef, ownValues, ownsItsValues, valueRef } from "./entities/system/Component.js";
|
|
42
42
|
import { Composite } from "./entities/system/Composite.js";
|
|
43
43
|
import { ComponentModuleSource, ComponentRegistryImport, ComponentRegistryImportBinding, componentModuleFilePaths, componentModuleKey, componentModuleSource, componentRegistryImports } from "./entities/system/component-module.js";
|
|
@@ -87,4 +87,4 @@ import { valueLeavesOf, valueSchemaOf } from "./framework/value-domain.js";
|
|
|
87
87
|
import { views } from "./framework/views-facade.js";
|
|
88
88
|
import { RN_STYLE_KEYS } from "./react-native/style-keys.generated.js";
|
|
89
89
|
import { namedSlotTargets } from "./spec/empty-node-slots.js";
|
|
90
|
-
export { AI_LANES, AiChat, AiFlow, type AiFlowOrigin, AiGeneration, type AiLane, AiMessage, type AiMultiAgentMode, type AnySystemConfig, type AttachedSources, type Authored, type AuthoredComponent, type AuthoredProp, type AuthoredPropBody, type AuthoringSignatureOptions, BUILD_DEFAULTS, type BreakOutcome, type BreakPlan, type BreakPlanInput, type BreakPlanRow, type BreakReach, BuildSection, CANVAS_ROLES, CONFIG_OPERATION_KIND, CSS_DEFAULTS, CSS_PROPERTY_NAMES, CSS_WIDE_KEYWORDS, CURRENT_SCHEMA_VERSION, Canvas, CanvasConfig, CanvasRole, type CanvasRoleName, CanvasSection, type Change, type ChangeHook, type ChangeTarget, type ChildrenPolicy, type Collection, type ColorValue, Component, type ComponentBody, type ComponentBuilder, type ComponentContractOf, type ComponentElementBody, type ComponentModuleSource, type ComponentPropBody, type ComponentPropsOf, type ComponentReference, type ComponentRegistryImport, type ComponentRegistryImportBinding, type ComponentRuleClass, type ComponentSpec, type ComponentSpecs, type ComponentStyleBody, Composite, type ComputedFields, type ComputedInput, type ComputedMap, Config, type ConfigClass, type ConfigEdit, ConfigFormatError, type ConfigInstance, type ConfigIssue, type ConfigIssueCode, type ConfigKind, type ConfigOp, ConfigRejection, ConfigSession, type ConfigSessionOptions, type ConfigSink, type ConfigSource, type CopyPlan, type CopyPlanInput, type CopyPlanRow, type CreateInput, type CssGrammar, type CssPrefix, type CssPropertyEntry, CssSection, DERIVED_MUTATIONS, type DanglingDirective, type DanglingLocalRef, type DanglingRef, type DeclaredRuntimeModule, type DeletePlan, type DeriveMembers, type DerivedColor, type DerivedEntityClass, type DerivedOp, Device, type DraftSource, ENTITY_PATH_MESSAGE, EXPORT_MEMBER, type Edition, type ElementVisibility, type ElementVisibilityInput, Entity, type EntityAddress, type EntityChange, type EntityClass, type EntityKind, type EntityMap, type ExpandOptions, type ExpansionResult, type ExtendedComponentRef, type ExtendedRef, type FieldsSchema, File, Font, FontFile, type ForwardClaims, GROUP, GUIDANCE_LANES, GlobalStyle, type Gradient, type GroupBody, Guidance, type GuidanceLane, type GuidanceScope, type GuidanceSegment, GuidanceStyle, type GuidanceStyleBody, type HasSnapshot, type HydrationOptions, ICON_METADATA_FORMATS, Icon, type IconLibrary, type IconMemberMetadata, type IconMetadataAdapter, type IconMetadataDeclaration, type IconMetadataFile, type IconMetadataFormat, type IdentifiedOp, type InferredRename, type ItemOf, type KindSignature, type KindSlice, LINK_SLUG, LINK_SLUG_MESSAGE, type LayerElement, type LayerMap, type LayerStyleOptions, type LeafAddress, type LinkArrival, type LinkDeclaration, type LinkPaths, type LinkPlan, type LinkPlanInput, LinkedSystem, type LinkedSystemResolver, type LinkedSystemState, type ListOptions, type LiveConfig, type LocalOverlay, MINTED, MODIFIER_CATEGORIES, type MisdeclaredOverlay, Modifier, type ModifierCategory, type ModifierGroupMeta, Motion, NATIVE_ACTIVATIONS, type NativeActivation, NativeModifier, NativeSettings, NativeStyleProperty, NativeToken, Node, type OpHandler, type OpInput, Operation, type OverlayVerb, type OverrideCondition, type OwnedRecords, PLAYGROUND_DEFAULTS, Package, Page, type Patch, type PathOf, type PinDirective, type PinOptions, type PinOptionsField, type Plan, type PlanImpact, type PlanOp, PlaygroundSection, type PreviewMatrix, type ProjectedVisibility, type PropDecl, type PropDeclaration, type PropMap, RN_STYLE_KEYS, ReactNativeSystem, type ReactNativeSystemConfig, type RebaseConflict, type RebaseOrigin, type RebaseResult, type RecordedSource, type RedundantQualifier, type Ref, type RefGraph, type RefGraphEntry, type RefIndex, type RefIndexChange, type RefMember, type RefTarget, type RegisteredComponentContracts, type RegisteredEntities, type RegisteredPaths, type RegisteredStyleProps, type RenamePlan, type RenderArgs, type RenderElement, type RenderSpec, type RenderedTarget, type ResolveValueTypeInput, type ResolvedSource, SCRIPT_EXTENSIONS, SERIALIZED_CONFIG_VERSION, STYLE_PROP_VALUE_FORMS, STYLE_PROP_VALUE_LEAVES, type SchemaEntry, type SchemaMigration, SchemaVersionTooNew, type SerializedConfig, type SerializedSourceAnswer, Settings, type SignatureOptions, type SkippedOp, type SlotTarget, Snapshot, type Source, type SourceAnswer, type SourceChange, type SourceMap, type SourceResolution, type SourceResolutionSchemas, type SourceResolver, type SourceRowState, type SourceState, type SourceUnavailable, type SourcesBySlug, type SourcesOf, type SpecNode, type SplitStyleProps, type StampedPatch, type StoredConfig, type StoredPreviewCondition, type StylePropEntry, type StylePropLeaf, type StylePropValue, type StylePropValueCtx, type StylePropValueKind, StyleProperty, type StylePropertyItem, type StyleRuleInput, type StyleValue, type SubEntityClass, type SubPatch, type SurfaceCompositeProp, type SurfaceProp, type SurfacePropKind, type SurfaceScalarProp, type SurfaceSlotProp, type SurfaceStylePropertyProp, type SurfaceVariantProp, System, type SystemConfig, SystemSection, SystemSource, Token, type TokenBinding, type TokenBody, type TokenMatch, Tool, type TraverseOptions, type TreeNode, UNREACHABLE, type UnadoptedDirective, type UnknownStyleLeaf, type UnlinkPlan, type UnlinkPlanInput, type UnreadableBorrow, type UnstatableCondition, type UpgradedDraft, type UserSchemas, VOID_ELEMENTS, type ValueOf, type ValueType, type VariantValueBody, type VariantValues, type VisibilityOperator, type VisibilityTerm, WEB_ACTIVATIONS, type WalkOptions, type WebActivation, addressOf, alpha, applyPathDelta, assetType, authoredBag, authoredValue, authoringSignatures, baseOf, borrowedGroup, borrowedItem, boundElementType, brandGroup, buildRefGraph, buildRefIndex, canonicalWhen, changeOf, changeValueAt, changesOf, childrenPolicy, className, classPrefixOf, classifyStylePropValue, collectRefs, componentClassBase, componentCompositeClasses, componentLayerClass, componentModuleFilePaths, componentModuleKey, componentModuleSource, componentMotionClasses, componentPropClasses, componentRegistryImports, componentRuleClasses, componentSpec, createCanvasConfig, createSliceMemo, cssPrefixes, cssPropValue, cssProperty, cssPropertyNames, cssValueIssue, cssVar, cssVarRef, danglingDirectives, danglingLocalRefs, danglingSourcedRefs, darken, declaredField, declaredPropRouting, declaredRuntimeModules, defineComponent, defineConfig, defineDerivedEntity, defineEntity, defineOverride, defineSubEntity, deriveCreateSchema, deriveSpec, deriveUpdateSchema, describeBody, describePatch, detectedWireVersion, editOp, entityRefOf, entryKeyOf, expandComponent, expandSpec, fieldKeys, fontFamilyStack, forceModeAttribute, forceModeAttributeOf, forceModeProp, forceModePropGroup, forceModePropValue, forceModeProps, forceStateAttribute, forwardClaims, forwardedLayers, forwardedNames, forwardsOf, globalStyleName, guidanceReaches, guidanceScopeOf, guidanceTextOf, iconCategories, iconLibraries, iconLibrary, iconMemberMetadata, iconMetadata, iconMetadataDeclaration, iconMetadataFile, iconMetadataFileJsonSchema, iconMetadataFormat, inferredRenames, inputOf, instanceSpec, intoName, isAuthored, isBinaryAsset, isConfigFormatError, isConfigRejection, isCssProperty, isDeclaredElementProp, isDerivedColor, isEntityPath, isExtendedRef, isForceModeProp, isGradient, isGroupBody, isLinkSlug, isMintedRow, isNativeConfig, isPlainObject, isRef, isSystemConfig, kebabComponent, kindOf, kindsOf, layerCompositeProps, layerRef, layerStyles, leafAddresses, leafVerb, leavesOfStylePropValue, lighten, linearGradient, matchEntities, matchTokens, memberFromLeaf, memberLeaves, memberOf, memberRef, memberVariantOptions, memoryConfigSource, misdeclaredOverlays, mix, modeAxes, modifierAxes, modifierAxis, modifierCategory, modifierGroupFields, modifierInvariants, modifierLeaf, modifierUtilitiesUsed, motionClassName, namedFields, namedSlotTargets, nativeTokenValue, negatedCssValue, normalizeName, opOf, opVerb, opacityPercentage, opsForKind, orRef, overlayVerb, overrideCondition, overrideKey, overrideKeyModifiers, overrideModifiers, ownValues, ownerOf, ownsItsValues, packageKey, packageName, partsOf, pathDelta, pathOf, pathSegments, planBreak, planCopy, planLink, planUnlink, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, previewSpec, propOwner, propValueDomain, propValueFromAxis, redundantQualifiers, ref, refGraphOf, refLeaf, refSchema, registerSchemaMigrations, renderDerivedColor, renderGradient, renderSignature, renderStyleValue, renderedElement, renderedTarget, resolutionSchema, resolveComponentProps, resolveFieldValue, resolveIconLibrary, resolveInputDir, resolveOutDir, resolveRegistryDir, resolveTokenValue, resolveTokenValueUnder, resolveValueType, resolveVisibility, resolvedSource, rewriteRefNamespace, rewriteRefSource, rewriteRefs, rnStyleKey, rootLayerOf, routedBag, routedProp, routedPropIn, routesContent, ruleApplies, ruleCondition, runChangeHooks, schemaVersionOf, searchEntities, searchTokens, setAtPath, signatureOf, slotTargetsOf, sniffValueType, sourceEntries, sourceOf, sourceOfGroup, sourceOfItem, sourceRowStates, sourceSlugFor, sourceUnavailable, sourceUnreachable, sourceVarPrefix, specWithResolvedVisibility, splitRef, splitStyleProps, stamp, styleAliasesOf, styleDeclarations, stylePropClassBase, stylePropClassName, stylePropClasses, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFormOf, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValueSchema, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, styleRuleMotionClasses, suggestLinkSlug, summarizeChanges, surfaceProp, surfaceProps, toCssPropertyName, tokenBinding, touchedFields, unadoptedDirectives, unknownStyleLeaves, unreadableBorrows, unstatableConditions, updateRefIndex, upgradeDraftEntries, upgradePatch, upgradeSerializedConfig, validateComponentProps, validateSpec, valueAt, valueLeavesOf, valueRef, valueSchemaOf, varPrefixOf, views, visibilityStateProps, visibilityTerms, withoutTruthyTerm };
|
|
90
|
+
export { AI_LANES, AiChat, AiFlow, type AiFlowOrigin, AiGeneration, type AiLane, AiMessage, type AiMultiAgentMode, type AnySystemConfig, type AsInput, type AttachedSources, type Authored, type AuthoredComponent, type AuthoredProp, type AuthoredPropBody, type AuthoringSignatureOptions, BUILD_DEFAULTS, type BreakOutcome, type BreakPlan, type BreakPlanInput, type BreakPlanRow, type BreakReach, BuildSection, CANVAS_ROLES, CONFIG_OPERATION_KIND, CSS_DEFAULTS, CSS_PROPERTY_NAMES, CSS_WIDE_KEYWORDS, CURRENT_SCHEMA_VERSION, Canvas, CanvasConfig, CanvasRole, type CanvasRoleName, CanvasSection, type Change, type ChangeHook, type ChangeTarget, type ChildrenPolicy, type Collection, type ColorValue, Component, type ComponentBody, type ComponentBuilder, type ComponentContractOf, type ComponentElementBody, type ComponentModuleSource, type ComponentPropBody, type ComponentPropsOf, type ComponentReference, type ComponentRegistryImport, type ComponentRegistryImportBinding, type ComponentRuleClass, type ComponentSpec, type ComponentSpecs, type ComponentStyleBody, Composite, type ComputedFields, type ComputedInput, type ComputedMap, Config, type ConfigClass, type ConfigEdit, ConfigFormatError, type ConfigInstance, type ConfigIssue, type ConfigIssueCode, type ConfigKind, type ConfigOp, ConfigRejection, ConfigSession, type ConfigSessionOptions, type ConfigSink, type ConfigSource, type CopyPlan, type CopyPlanInput, type CopyPlanRow, type CreateInput, type CssGrammar, type CssPrefix, type CssPropertyEntry, CssSection, DERIVED_MUTATIONS, type DanglingDirective, type DanglingLocalRef, type DanglingRef, type DeclaredRuntimeModule, type DeletePlan, type DeriveMembers, type DerivedColor, type DerivedEntityClass, type DerivedOp, Device, type DraftSource, ENTITY_PATH_MESSAGE, EXPORT_MEMBER, type Edition, type ElementVisibility, type ElementVisibilityInput, Entity, type EntityAddress, type EntityChange, type EntityClass, type EntityKind, type EntityMap, type ExpandOptions, type ExpansionResult, type ExtendedComponentRef, type ExtendedRef, type FieldsSchema, File, Font, FontFile, type ForwardClaims, GROUP, GUIDANCE_LANES, GlobalStyle, type Gradient, type GroupBody, Guidance, type GuidanceLane, type GuidanceScope, type GuidanceSegment, GuidanceStyle, type GuidanceStyleBody, type HasSnapshot, type HydrationOptions, ICON_METADATA_FORMATS, Icon, type IconLibrary, type IconMemberMetadata, type IconMetadataAdapter, type IconMetadataDeclaration, type IconMetadataFile, type IconMetadataFormat, type IdentifiedOp, type InferredRename, type ItemOf, type KindSignature, type KindSlice, LINK_SLUG, LINK_SLUG_MESSAGE, type LayerElement, type LayerMap, type LayerStyleOptions, type LeafAddress, type LinkArrival, type LinkDeclaration, type LinkPaths, type LinkPlan, type LinkPlanInput, LinkedSystem, type LinkedSystemResolver, type LinkedSystemState, type ListOptions, type LiveConfig, type LocalOverlay, MINTED, MODIFIER_CATEGORIES, type MisdeclaredOverlay, Modifier, type ModifierCategory, type ModifierGroupMeta, Motion, NATIVE_ACTIVATIONS, type NativeActivation, NativeModifier, NativeSettings, NativeStyleProperty, NativeToken, Node, type OpHandler, type OpInput, Operation, type OverlayVerb, type OverrideCondition, type OwnedRecords, PLAYGROUND_DEFAULTS, Package, Page, type Patch, type PathOf, type PinDirective, type PinOptions, type PinOptionsField, type Plan, type PlanImpact, type PlanOp, PlaygroundSection, type PreviewMatrix, type ProjectedVisibility, type PropDecl, type PropDeclaration, type PropMap, RN_STYLE_KEYS, ReactNativeSystem, type ReactNativeSystemConfig, type RebaseConflict, type RebaseOrigin, type RebaseResult, type RecordedSource, type RedundantQualifier, type Ref, type RefGraph, type RefGraphEntry, type RefIndex, type RefIndexChange, type RefMember, type RefTarget, type RegisteredComponentContracts, type RegisteredEntities, type RegisteredPaths, type RegisteredStyleProps, type RenamePlan, type RenderArgs, type RenderElement, type RenderSpec, type RenderedTarget, type ResolveValueTypeInput, type ResolvedSource, SCRIPT_EXTENSIONS, SERIALIZED_CONFIG_VERSION, STYLE_PROP_VALUE_FORMS, STYLE_PROP_VALUE_LEAVES, type SchemaEntry, type SchemaMigration, SchemaVersionTooNew, type SerializedConfig, type SerializedSourceAnswer, Settings, type SignatureOptions, type SkippedOp, type SlotTarget, Snapshot, type Source, type SourceAnswer, type SourceChange, type SourceMap, type SourceResolution, type SourceResolutionSchemas, type SourceResolver, type SourceRowState, type SourceState, type SourceUnavailable, type SourcesBySlug, type SourcesOf, type SpecNode, type SplitStyleProps, type StampedPatch, type StoredConfig, type StoredPreviewCondition, type StylePropEntry, type StylePropLeaf, type StylePropValue, type StylePropValueCtx, type StylePropValueKind, StyleProperty, type StylePropertyItem, type StyleRuleInput, type StyleValue, type SubEntityClass, type SubPatch, type SurfaceCompositeProp, type SurfaceProp, type SurfacePropKind, type SurfaceScalarProp, type SurfaceSlotProp, type SurfaceStylePropertyProp, type SurfaceVariantProp, System, type SystemConfig, SystemSection, SystemSource, Token, type TokenBinding, type TokenBody, type TokenMatch, Tool, type TraverseOptions, type TreeNode, UNREACHABLE, type UnadoptedDirective, type UnknownStyleLeaf, type UnlinkPlan, type UnlinkPlanInput, type UnreadableBorrow, type UnstatableCondition, type UpgradedDraft, type UserSchemas, VOID_ELEMENTS, type ValueOf, type ValueType, type VariantValueBody, type VariantValues, type VisibilityOperator, type VisibilityTerm, WEB_ACTIVATIONS, type WalkOptions, type WebActivation, addressOf, alpha, applyPathDelta, assetType, authoredBag, authoredValue, authoringSignatures, baseOf, borrowedGroup, borrowedItem, boundElementType, brandGroup, buildRefGraph, buildRefIndex, canonicalWhen, changeOf, changeValueAt, changesOf, childrenPolicy, className, classPrefixOf, classifyStylePropValue, collectRefs, componentClassBase, componentCompositeClasses, componentLayerClass, componentModuleFilePaths, componentModuleKey, componentModuleSource, componentMotionClasses, componentPropClasses, componentRegistryImports, componentRuleClasses, componentSpec, createCanvasConfig, createSliceMemo, cssPrefixes, cssPropValue, cssProperty, cssPropertyNames, cssValueIssue, cssVar, cssVarRef, danglingDirectives, danglingLocalRefs, danglingSourcedRefs, darken, declaredField, declaredPropRouting, declaredRuntimeModules, defineComponent, defineConfig, defineDerivedEntity, defineEntity, defineOverride, defineSubEntity, deriveCreateSchema, deriveSpec, deriveUpdateSchema, describeBody, describePatch, detectedWireVersion, editOp, entityRefOf, entryKeyOf, expandComponent, expandSpec, fieldKeys, fontFamilyStack, forceModeAttribute, forceModeAttributeOf, forceModeProp, forceModePropGroup, forceModePropValue, forceModeProps, forceStateAttribute, forwardClaims, forwardedLayers, forwardedNames, forwardsOf, globalStyleName, guidanceReaches, guidanceScopeOf, guidanceTextOf, iconCategories, iconLibraries, iconLibrary, iconMemberMetadata, iconMetadata, iconMetadataDeclaration, iconMetadataFile, iconMetadataFileJsonSchema, iconMetadataFormat, inferredRenames, inputOf, instanceSpec, intoName, isAuthored, isBinaryAsset, isConfigFormatError, isConfigRejection, isCssProperty, isDeclaredElementProp, isDerivedColor, isEntityPath, isExtendedRef, isForceModeProp, isGradient, isGroupBody, isLinkSlug, isMintedRow, isNativeConfig, isPlainObject, isRef, isSystemConfig, kebabComponent, kindOf, kindsOf, layerCompositeProps, layerRef, layerStyles, leafAddresses, leafVerb, leavesOfStylePropValue, lighten, linearGradient, matchEntities, matchTokens, memberFromLeaf, memberLeaves, memberOf, memberRef, memberVariantOptions, memoryConfigSource, misdeclaredOverlays, mix, modeAxes, modifierAxes, modifierAxis, modifierCategory, modifierGroupFields, modifierInvariants, modifierLeaf, modifierUtilitiesUsed, motionClassName, namedFields, namedSlotTargets, nativeTokenValue, negatedCssValue, normalizeName, opOf, opVerb, opacityPercentage, opsForKind, orRef, overlayVerb, overrideCondition, overrideKey, overrideKeyModifiers, overrideModifiers, ownValues, ownerOf, ownsItsValues, packageKey, packageName, partsOf, pathDelta, pathOf, pathSegments, planBreak, planCopy, planLink, planUnlink, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, previewSpec, propOwner, propValueDomain, propValueFromAxis, redundantQualifiers, ref, refGraphOf, refLeaf, refSchema, registerSchemaMigrations, renderDerivedColor, renderGradient, renderSignature, renderStyleValue, renderedElement, renderedTarget, resolutionSchema, resolveComponentProps, resolveFieldValue, resolveIconLibrary, resolveInputDir, resolveOutDir, resolveRegistryDir, resolveTokenValue, resolveTokenValueUnder, resolveValueType, resolveVisibility, resolvedSource, rewriteRefNamespace, rewriteRefSource, rewriteRefs, rnStyleKey, rootLayerOf, routedBag, routedProp, routedPropIn, routesContent, ruleApplies, ruleCondition, runChangeHooks, schemaVersionOf, searchEntities, searchTokens, setAtPath, signatureOf, slotTargetsOf, sniffValueType, sourceEntries, sourceOf, sourceOfGroup, sourceOfItem, sourceRowStates, sourceSlugFor, sourceUnavailable, sourceUnreachable, sourceVarPrefix, specWithResolvedVisibility, splitRef, splitStyleProps, stamp, styleAliasesOf, styleDeclarations, stylePropClassBase, stylePropClassName, stylePropClasses, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFormOf, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValueSchema, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, styleRuleMotionClasses, suggestLinkSlug, summarizeChanges, surfaceProp, surfaceProps, toCssPropertyName, tokenBinding, touchedFields, unadoptedDirectives, unknownStyleLeaves, unreadableBorrows, unstatableConditions, updateRefIndex, upgradeDraftEntries, upgradePatch, upgradeSerializedConfig, validateComponentProps, validateSpec, valueAt, valueLeavesOf, valueRef, valueSchemaOf, varPrefixOf, views, visibilityStateProps, visibilityTerms, withoutTruthyTerm };
|
package/dist/index.js
CHANGED
|
@@ -20,10 +20,10 @@ import { Composite } from "./entities/system/Composite.js";
|
|
|
20
20
|
import { MODIFIER_CATEGORIES, Modifier, WEB_ACTIVATIONS, modeAxes, modifierAxes, modifierAxis, modifierCategory, modifierGroupFields, modifierInvariants, modifierLeaf } from "./entities/system/Modifier.js";
|
|
21
21
|
import { BuildSection, CSS_DEFAULTS, CssSection, PLAYGROUND_DEFAULTS, PlaygroundSection, Settings, SystemSection, classPrefixOf, cssPrefixes, varPrefixOf } from "./entities/system/Settings.js";
|
|
22
22
|
import { STYLE_PROP_VALUE_FORMS, STYLE_PROP_VALUE_LEAVES, StyleProperty, classifyStylePropValue, cssPropertyNames, leavesOfStylePropValue, stylePropValueFormOf, stylePropValueSchema, toCssPropertyName } from "./entities/system/StyleProperty.js";
|
|
23
|
+
import { createSliceMemo } from "./framework/memo.js";
|
|
23
24
|
import { authoredBag, authoredValue, className, cssPropValue, cssVar, cssVarRef, declaredPropRouting, memberFromLeaf, memberLeaves, negatedCssValue, opacityPercentage, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propOwner, propValueDomain, propValueFromAxis, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarations, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, validateComponentProps } from "./framework/projections.js";
|
|
24
25
|
import { forwardClaims, forwardedLayers, intoName, routedProp, routedPropIn, routesContent, surfaceProp, surfaceProps } from "./framework/prop-surface.js";
|
|
25
26
|
import { layerStyles, ruleApplies } from "./framework/layer-styles.js";
|
|
26
|
-
import { createSliceMemo } from "./framework/memo.js";
|
|
27
27
|
import { componentClassBase, componentCompositeClasses, componentLayerClass, componentMotionClasses, componentPropClasses, componentRuleClasses, forceModeAttribute, forceModeAttributeOf, forceModeProp, forceModePropGroup, forceModePropValue, forceModeProps, forceStateAttribute, isForceModeProp, kebabComponent, layerCompositeProps, modifierUtilitiesUsed, motionClassName, ruleCondition, splitStyleProps, stylePropClassBase, stylePropClassName, stylePropClasses, styleRuleMotionClasses } from "./framework/class-names.js";
|
|
28
28
|
import { boundElementType, componentSpec, deriveSpec, entryKeyOf, expandComponent, expandSpec, instanceSpec, previewSpec, resolveVisibility, slotTargetsOf, specWithResolvedVisibility, visibilityStateProps, visibilityTerms, withoutTruthyTerm } from "./framework/render-spec.js";
|
|
29
29
|
import { Package } from "./entities/system/Package.js";
|