@yahoo/uds-create-config 5.96.6 → 5.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/system.js +2 -0
- package/dist/entities/system/Source.d.ts +1 -0
- package/dist/entities/system/Source.js +39 -3
- package/dist/entities/system/component-module.d.ts +15 -1
- package/dist/entities/system/component-module.js +76 -5
- package/dist/entities/system/copy-plan.js +2 -1
- package/dist/entities/system/defineComponent.d.ts +7 -1
- package/dist/entities/system/icon-library.js +9 -0
- package/dist/entities/system/vendor-conditions.d.ts +123 -0
- package/dist/entities/system/vendor-conditions.js +324 -0
- package/dist/framework/Config.d.ts +24 -2
- package/dist/framework/Config.js +44 -6
- package/dist/framework/class-names.js +7 -4
- package/dist/framework/module-views.d.ts +9 -1
- package/dist/framework/projections.js +56 -10
- package/dist/framework/prop-surface.d.ts +7 -1
- package/dist/framework/prop-surface.js +140 -37
- package/dist/framework/ref-integrity.js +1 -0
- package/dist/framework/registry.d.ts +3 -1
- package/dist/framework/render-spec.js +6 -0
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/source-integrity.js +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -4
- package/dist/lint/rules.d.ts +6 -0
- package/dist/lint/rules.js +6 -0
- package/dist/migrations/20261112163439_vendor_link_type.d.ts +8 -0
- package/dist/migrations/20261112163439_vendor_link_type.js +10 -0
- package/dist/spec/glyph-jsx.js +4 -2
- package/dist/spec/glyph-members.js +3 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { declarationText, hasRefMarker, isRef, kindOf, memberOf, pathOf, ref, refLeaf, refOfKey, replaceRefMarkers, routedSource, sourceHops, sourceOf, splitRef, whenLeaves } from "./utils/refs.js";
|
|
1
|
+
import { declarationText, hasRefMarker, isRef, kindOf, memberOf, pathOf, qualifyRefs, ref, refLeaf, refOfKey, replaceRefMarkers, routedSource, sourceHops, sourceOf, splitRef, whenLeaves } from "./utils/refs.js";
|
|
2
2
|
import { defaultsFor, holdingDefaultConditions } from "./default-conditions.js";
|
|
3
3
|
import { evaluateCalc, isCalc, leadingNumber } from "../entities/system/calc.js";
|
|
4
4
|
import { isOklchColor, renderOklch } from "../entities/system/color.js";
|
|
@@ -462,7 +462,8 @@ function expandMemberEntries(config, target, opts) {
|
|
|
462
462
|
leaf: leafOf(member.path),
|
|
463
463
|
path: member.path
|
|
464
464
|
}));
|
|
465
|
-
const
|
|
465
|
+
const vendor = config.sourceTypeOf(source) === "vendor";
|
|
466
|
+
const ours = config.members(kind, path).filter((member) => !vendor || member.source === source);
|
|
466
467
|
const held = new Set(ours.map((member) => member.path));
|
|
467
468
|
const covered = new Set(theirs.map((member) => member.path));
|
|
468
469
|
return [...theirs.filter((member) => offered(held.has(member.path) ? config : owner, member.path)).map((member) => ({
|
|
@@ -1612,7 +1613,11 @@ function computeComponentProps(config, path, seen) {
|
|
|
1612
1613
|
for (const [layer, entry] of Object.entries(forwardsOf(body))) {
|
|
1613
1614
|
const element = body.layers?.[layer];
|
|
1614
1615
|
if (!isRef(element)) continue;
|
|
1615
|
-
const exposed =
|
|
1616
|
+
const exposed = elementProps({
|
|
1617
|
+
config,
|
|
1618
|
+
element,
|
|
1619
|
+
seen: new Set(seen)
|
|
1620
|
+
});
|
|
1616
1621
|
for (const [name, decl] of Object.entries(takenByForward({
|
|
1617
1622
|
entry,
|
|
1618
1623
|
exposed
|
|
@@ -1622,6 +1627,25 @@ function computeComponentProps(config, path, seen) {
|
|
|
1622
1627
|
else merged[name] = prop;
|
|
1623
1628
|
return merged;
|
|
1624
1629
|
}
|
|
1630
|
+
/**
|
|
1631
|
+
* The props a layer's element exposes, as this config reads them.
|
|
1632
|
+
*
|
|
1633
|
+
* An element named through a pin (`primitives/Box@acme`, which a `vendor` link's component keeps) is
|
|
1634
|
+
* read in that pin's source, and what it exposes is qualified with the pin, so it reads here as the
|
|
1635
|
+
* source's own rather than as this config's entity of the same name, or as nothing where this config
|
|
1636
|
+
* has none.
|
|
1637
|
+
*/
|
|
1638
|
+
function elementProps({ config, element, seen = /* @__PURE__ */ new Set() }) {
|
|
1639
|
+
const slug = sourceOf(element.__ref);
|
|
1640
|
+
if (slug === void 0) return resolveComponentProps(config, pathOf(element.__ref), seen);
|
|
1641
|
+
const owner = config.configFor(element);
|
|
1642
|
+
if (!owner) return {};
|
|
1643
|
+
return qualifyRefs({
|
|
1644
|
+
value: resolveComponentProps(owner, pathOf(element.__ref)),
|
|
1645
|
+
source: slug,
|
|
1646
|
+
owns: (kind) => owner.ownedKinds().includes(kind)
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1625
1649
|
/** The props a `forwards` entry takes from what its element exposes: `'*'` is the whole surface, a
|
|
1626
1650
|
* list is an allowlist of the names it spells. A list never subtracts, which is what a `null` own
|
|
1627
1651
|
* prop is for. */
|
|
@@ -1691,12 +1715,15 @@ function propValueDomain(config, decl) {
|
|
|
1691
1715
|
if (decl.type === "styleProperty") {
|
|
1692
1716
|
const target = domainRef();
|
|
1693
1717
|
if (!target) return null;
|
|
1694
|
-
const
|
|
1695
|
-
const
|
|
1718
|
+
const local = splitRef(target).qualifiedPath;
|
|
1719
|
+
const here = config.resolve("style-property", local) !== void 0;
|
|
1720
|
+
const owner = here ? config : config.configFor(target) ?? config;
|
|
1721
|
+
const path = here ? local : pathOf(target);
|
|
1722
|
+
const leaves = stylePropValueLeaves(owner, path);
|
|
1696
1723
|
if (leaves.length === 0) return null;
|
|
1697
1724
|
return {
|
|
1698
1725
|
leaves,
|
|
1699
|
-
accepts: (v) => stylePropValueFromLeaf(
|
|
1726
|
+
accepts: (v) => stylePropValueFromLeaf(owner, path, v) !== void 0
|
|
1700
1727
|
};
|
|
1701
1728
|
}
|
|
1702
1729
|
if (decl.type === "composite") {
|
|
@@ -1738,6 +1765,17 @@ function glyphLibrariesOf(domain) {
|
|
|
1738
1765
|
return (refListOf(domain) ?? (isRef(domain) ? [domain.__ref] : [])).filter((ref) => kindOf(ref) === "icon" && memberOf(ref) === void 0).map(pathOf);
|
|
1739
1766
|
}
|
|
1740
1767
|
/**
|
|
1768
|
+
* An icon library a component named through a pin draws from, as this config names it: the bare path
|
|
1769
|
+
* where the library's members are rows drawn through that pin, and the path qualified with the pin
|
|
1770
|
+
* (`phosphor@acme`) otherwise. A `vendor` link mints no row for a library its components draw from,
|
|
1771
|
+
* and a library of this config's own under the same name is a different one.
|
|
1772
|
+
*/
|
|
1773
|
+
function libraryThroughPin({ config, slug, library }) {
|
|
1774
|
+
if (library.includes("@")) return library;
|
|
1775
|
+
const held = config.members("icon", library);
|
|
1776
|
+
return held.length > 0 && held.every((member) => member.source === slug) ? library : `${library}@${slug}`;
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1741
1779
|
* The props of a component that hold a glyph, each mapped to the icon libraries that are its
|
|
1742
1780
|
* domain, in declaration order (`{ name: ['phosphor'] }` for a component whose `name` declares
|
|
1743
1781
|
* `Icon.ref('phosphor')`; two entries when it declares a list). A forward onto a layer component's
|
|
@@ -1776,10 +1814,18 @@ function glyphPropsOfBody({ config, body, seen = /* @__PURE__ */ new Set() }) {
|
|
|
1776
1814
|
if (declaration?.type !== "forward" || !isRef(target) || kindOf(target) !== "layer") continue;
|
|
1777
1815
|
const element = layers[pathOf(target)];
|
|
1778
1816
|
if (!isRef(element) || kindOf(element) !== "component") continue;
|
|
1817
|
+
const slug = sourceOf(element.__ref);
|
|
1818
|
+
const owner = slug === void 0 ? config : config.configFor(element);
|
|
1819
|
+
if (!owner) continue;
|
|
1779
1820
|
const receiver = pathOf(element);
|
|
1780
|
-
if (seen.has(receiver)) continue;
|
|
1781
|
-
const libraries = glyphPropsOf(
|
|
1782
|
-
if (libraries)
|
|
1821
|
+
if (slug === void 0 && seen.has(receiver)) continue;
|
|
1822
|
+
const libraries = glyphPropsOf(owner, receiver, slug === void 0 ? seen : /* @__PURE__ */ new Set())[forwardIntoName(declaration.into, prop)];
|
|
1823
|
+
if (!libraries) continue;
|
|
1824
|
+
out[prop] = slug === void 0 ? libraries : libraries.map((library) => libraryThroughPin({
|
|
1825
|
+
config,
|
|
1826
|
+
slug,
|
|
1827
|
+
library
|
|
1828
|
+
}));
|
|
1783
1829
|
}
|
|
1784
1830
|
const [, rootElement] = rootLayerOf(layers);
|
|
1785
1831
|
if (isRef(rootElement) && kindOf(rootElement) === "component") {
|
|
@@ -2274,4 +2320,4 @@ function declaredPropDefaults(props) {
|
|
|
2274
2320
|
return out;
|
|
2275
2321
|
}
|
|
2276
2322
|
//#endregion
|
|
2277
|
-
export { LAYER_PROPS, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, defaultSources, fontStackOf, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, glyphPropsOfBody, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, layerPropsErrors, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinBodyStyleNumbers, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propAcceptsValue, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, takenByForward, tokenConditions, tokenReference, validateComponentProps };
|
|
2323
|
+
export { LAYER_PROPS, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, defaultSources, elementProps, fontStackOf, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, glyphPropsOfBody, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, layerPropsErrors, libraryThroughPin, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinBodyStyleNumbers, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propAcceptsValue, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, takenByForward, tokenConditions, tokenReference, validateComponentProps };
|
|
@@ -174,6 +174,12 @@ declare function routesContent(config: Config, layers: Readonly<Record<string, u
|
|
|
174
174
|
*/
|
|
175
175
|
declare function surfaceProps(config: Config, componentPath: string, /** Forwards already followed, so a routing loop terminates. Internal — callers pass nothing. */
|
|
176
176
|
seen?: ReadonlySet<string>): SurfaceProp[];
|
|
177
|
+
/**
|
|
178
|
+
* The style-property props a component takes none of at its call site because a `vendor` pin draws
|
|
179
|
+
* it: its own and the ones a forwarded layer exposes. Its values are its source's, and a style prop
|
|
180
|
+
* passed to it would be read in this config's vocabulary. Empty for any other component.
|
|
181
|
+
*/
|
|
182
|
+
declare function withheldStyleProps(config: Config, componentPath: string): readonly string[];
|
|
177
183
|
/** One prop by name, or `undefined` when the component doesn't expose it. */
|
|
178
184
|
declare function surfaceProp(config: Config, componentPath: string, name: string): SurfaceProp | undefined;
|
|
179
185
|
/**
|
|
@@ -244,4 +250,4 @@ interface PropRoute {
|
|
|
244
250
|
*/
|
|
245
251
|
declare function renderBindingsOf(config: Config, componentPath: string): PropRoute[];
|
|
246
252
|
//#endregion
|
|
247
|
-
export { BindingKind, CodeSlot, ForwardClaims, PropRoute, SurfaceCompositeProp, SurfaceProp, SurfacePropCondition, SurfacePropKind, SurfaceScalarProp, SurfaceSlotProp, SurfaceStylePropertyProp, SurfaceVariantProp, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, routedProp, routedPropIn, routesContent, slotCodeForms, standsInForCode, surfaceProp, surfaceProps };
|
|
253
|
+
export { BindingKind, CodeSlot, ForwardClaims, PropRoute, SurfaceCompositeProp, SurfaceProp, SurfacePropCondition, SurfacePropKind, SurfaceScalarProp, SurfaceSlotProp, SurfaceStylePropertyProp, SurfaceVariantProp, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, routedProp, routedPropIn, routesContent, slotCodeForms, standsInForCode, surfaceProp, surfaceProps, withheldStyleProps };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isRef, kindOf, memberOf, pathOf,
|
|
1
|
+
import { isRef, kindOf, memberOf, pathOf, ref, refLeaf, sourceOf } from "./utils/refs.js";
|
|
2
2
|
import { forwardsOf, rootLayerOf } from "../entities/system/element.js";
|
|
3
|
+
import { moduleViewOf } from "./module-views.js";
|
|
3
4
|
import { booleanValuesIn } from "./utils/enumerated.js";
|
|
4
|
-
import { propValueDomain, refListOf, resolveComponentProps, takenByForward } from "./projections.js";
|
|
5
|
+
import { elementProps, libraryThroughPin, propValueDomain, refListOf, resolveComponentProps, takenByForward } from "./projections.js";
|
|
5
6
|
import { layerOfElement, slotHostLayer } from "./slot-host.js";
|
|
6
7
|
import { Component } from "../entities/system/Component.js";
|
|
7
8
|
//#region src/framework/prop-surface.ts
|
|
@@ -95,6 +96,63 @@ function propApplies(prop, values) {
|
|
|
95
96
|
function refPath(value) {
|
|
96
97
|
return isRef(value) ? pathOf(value.__ref) : void 0;
|
|
97
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* A prop surfaced at a route's far end, named for this config. Through a pin (`primitives/Icon@acme`)
|
|
101
|
+
* the far end is the source's, so the icon libraries its value is drawn from are named as this config
|
|
102
|
+
* reaches them ({@link libraryThroughPin}).
|
|
103
|
+
*/
|
|
104
|
+
function throughPin({ config, prop, layers, decl }) {
|
|
105
|
+
const element = layers?.[refPath(decl.target) ?? ""];
|
|
106
|
+
const slug = isRef(element) ? sourceOf(element.__ref) : void 0;
|
|
107
|
+
const libraries = prop.iconLibraries;
|
|
108
|
+
if (slug === void 0 || !libraries) return prop;
|
|
109
|
+
return {
|
|
110
|
+
...prop,
|
|
111
|
+
iconLibraries: libraries.map((library) => libraryThroughPin({
|
|
112
|
+
config,
|
|
113
|
+
slug,
|
|
114
|
+
library
|
|
115
|
+
}))
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** The cycle guard's key for a route's far end: `Pressable#tone`, or `Icon@acme#name` through a pin. */
|
|
119
|
+
function routeKey({ named, prop }) {
|
|
120
|
+
const slug = sourceOf(named.__ref);
|
|
121
|
+
const path = pathOf(named.__ref);
|
|
122
|
+
return `${slug === void 0 ? path : `${path}@${slug}`}#${prop}`;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The component a route's far end names, and the config that holds it. One named through a pin
|
|
126
|
+
* (`primitives/Icon@acme`, which a `vendor` link's component keeps) is the pin's source's, read by its
|
|
127
|
+
* own path there, since this config may have no component at that path or a different one.
|
|
128
|
+
*/
|
|
129
|
+
function farEnd(config, named) {
|
|
130
|
+
const path = pathOf(named.__ref);
|
|
131
|
+
const slug = sourceOf(named.__ref);
|
|
132
|
+
if (slug === void 0) return {
|
|
133
|
+
config,
|
|
134
|
+
path
|
|
135
|
+
};
|
|
136
|
+
const owner = config.configFor(ref(Component.kind, path, slug));
|
|
137
|
+
return owner ? {
|
|
138
|
+
config: owner,
|
|
139
|
+
path
|
|
140
|
+
} : void 0;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A composite prop's group as this config reads it: the bare path where the group's members are rows
|
|
144
|
+
* drawn through the pin the ref names, and the path qualified with that pin (`surface@acme`)
|
|
145
|
+
* otherwise. A `vendor` link's component reaches its groups only through its pin, and a group of this
|
|
146
|
+
* config's own under the same name is a different one.
|
|
147
|
+
*/
|
|
148
|
+
function compositeNameOf(config, value) {
|
|
149
|
+
if (!isRef(value)) return void 0;
|
|
150
|
+
const path = pathOf(value.__ref);
|
|
151
|
+
const slug = sourceOf(value.__ref);
|
|
152
|
+
if (slug === void 0) return path;
|
|
153
|
+
const held = config.members(kindOf(value.__ref), path);
|
|
154
|
+
return held.length > 0 && held.every((member) => member.source === slug) ? path : `${path}@${slug}`;
|
|
155
|
+
}
|
|
98
156
|
/** Every ref in an `accepts` declaration (one, or a list). */
|
|
99
157
|
function acceptsRefs(accepts) {
|
|
100
158
|
return (Array.isArray(accepts) ? accepts : [accepts]).filter(isRef).map((ref) => ref.__ref);
|
|
@@ -159,15 +217,10 @@ function routedPropIn(config, layers, decl) {
|
|
|
159
217
|
if (!layerKey) return void 0;
|
|
160
218
|
const element = layers?.[layerKey];
|
|
161
219
|
if (!isRef(element) || kindOf(element) !== "component") return void 0;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return source === void 0 ? landed : qualifyRefs({
|
|
167
|
-
value: landed,
|
|
168
|
-
source,
|
|
169
|
-
owns: (kind) => owner.ownedKinds().includes(kind)
|
|
170
|
-
});
|
|
220
|
+
return elementProps({
|
|
221
|
+
config,
|
|
222
|
+
element
|
|
223
|
+
})[intoName(decl.into)];
|
|
171
224
|
}
|
|
172
225
|
/** {@link routedPropIn} for a component the config already holds. The layers are what the resolution
|
|
173
226
|
* needs; a path is the convenience for a caller that has one instead. */
|
|
@@ -236,15 +289,23 @@ function routeEnd(config, layers, decl, seen = /* @__PURE__ */ new Set()) {
|
|
|
236
289
|
route: decl
|
|
237
290
|
};
|
|
238
291
|
const layerKey = refPath(decl.target);
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
292
|
+
const element = layerKey ? layers?.[layerKey] : void 0;
|
|
293
|
+
if (!isRef(element)) return {
|
|
241
294
|
decl: landed,
|
|
242
295
|
route: decl
|
|
243
296
|
};
|
|
244
|
-
const
|
|
297
|
+
const far = farEnd(config, element);
|
|
298
|
+
if (!far) return {
|
|
299
|
+
decl: landed,
|
|
300
|
+
route: decl
|
|
301
|
+
};
|
|
302
|
+
const key = routeKey({
|
|
303
|
+
named: element,
|
|
304
|
+
prop: intoName(decl.into)
|
|
305
|
+
});
|
|
245
306
|
if (seen.has(key)) return void 0;
|
|
246
|
-
const farLayers = (Component.get(config,
|
|
247
|
-
return routeEnd(config, farLayers, landed, new Set([...seen, key]));
|
|
307
|
+
const farLayers = (Component.get(far.config, far.path)?.toJSON())?.layers;
|
|
308
|
+
return routeEnd(far.config, farLayers, landed, new Set([...seen, key]));
|
|
248
309
|
}
|
|
249
310
|
function slotProp(config, componentPath, name, decl) {
|
|
250
311
|
if (isValueSlot(decl)) {
|
|
@@ -283,7 +344,7 @@ function slotProp(config, componentPath, name, decl) {
|
|
|
283
344
|
...icons.length > 0 ? { acceptsIconLibraries: icons } : {},
|
|
284
345
|
...routedKind ? { valueKind: routedKind } : {},
|
|
285
346
|
...routed ? { valueOptions: propValueDomain(config, routed)?.leaves } : {},
|
|
286
|
-
...routedKind === "composite" ? { compositeName:
|
|
347
|
+
...routedKind === "composite" ? { compositeName: compositeNameOf(config, routed?.value) } : {}
|
|
287
348
|
};
|
|
288
349
|
}
|
|
289
350
|
const surfaces = /* @__PURE__ */ new WeakMap();
|
|
@@ -295,16 +356,44 @@ const surfaces = /* @__PURE__ */ new WeakMap();
|
|
|
295
356
|
* what a component accepts; a caller with no editor for it can fall back to a generic one.
|
|
296
357
|
*/
|
|
297
358
|
function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
surfaces.set(config, cache);
|
|
304
|
-
}
|
|
305
|
-
const cached = cache.get(componentPath);
|
|
306
|
-
if (cached) return cached;
|
|
359
|
+
if (seen.size > 0) return collectSurfaceProps(config, componentPath, seen);
|
|
360
|
+
let cache = surfaces.get(config);
|
|
361
|
+
if (!cache) {
|
|
362
|
+
cache = /* @__PURE__ */ new Map();
|
|
363
|
+
surfaces.set(config, cache);
|
|
307
364
|
}
|
|
365
|
+
const cached = cache.get(componentPath);
|
|
366
|
+
if (cached) return cached;
|
|
367
|
+
const all = collectSurfaceProps(config, componentPath, seen);
|
|
368
|
+
const props = drawnByVendor(config, componentPath) ? all.filter((prop) => prop.kind !== "styleProperty") : all;
|
|
369
|
+
cache.set(componentPath, props);
|
|
370
|
+
return props;
|
|
371
|
+
}
|
|
372
|
+
const NO_NAMES = [];
|
|
373
|
+
/**
|
|
374
|
+
* The style-property props a component takes none of at its call site because a `vendor` pin draws
|
|
375
|
+
* it: its own and the ones a forwarded layer exposes. Its values are its source's, and a style prop
|
|
376
|
+
* passed to it would be read in this config's vocabulary. Empty for any other component.
|
|
377
|
+
*/
|
|
378
|
+
function withheldStyleProps(config, componentPath) {
|
|
379
|
+
if (!drawnByVendor(config, componentPath)) return NO_NAMES;
|
|
380
|
+
return collectSurfaceProps(config, componentPath, /* @__PURE__ */ new Set()).filter((prop) => prop.kind === "styleProperty").map((prop) => prop.name);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Whether a `vendor` pin draws the component at `componentPath`: a row of this config's, or, read in a
|
|
384
|
+
* module view (the source's own config, as a consumer converts its files), one the consumer takes.
|
|
385
|
+
*/
|
|
386
|
+
function drawnByVendor(config, componentPath) {
|
|
387
|
+
if (config.vendorOf(Component.kind, componentPath) !== void 0) return true;
|
|
388
|
+
const view = moduleViewOf(config);
|
|
389
|
+
if (view?.consumer.sourceTypeOf(view.slug) !== "vendor") return false;
|
|
390
|
+
const taken = `${Component.kind}:${componentPath}@${view.slug}`;
|
|
391
|
+
return view.consumer.list(Component.kind).some((item) => {
|
|
392
|
+
const stored = view.consumer.storedBody(Component.kind, item.path);
|
|
393
|
+
return isRef(stored) && stored.__ref === taken;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
function collectSurfaceProps(config, componentPath, seen) {
|
|
308
397
|
const declared = resolveComponentProps(config, componentPath);
|
|
309
398
|
const layers = (Component.get(config, componentPath)?.toJSON())?.layers;
|
|
310
399
|
const props = [];
|
|
@@ -318,7 +407,12 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
|
|
|
318
407
|
}
|
|
319
408
|
const routed = boundProp(config, layers, decl, seen);
|
|
320
409
|
if (routed) props.push(conditioned({
|
|
321
|
-
...
|
|
410
|
+
...throughPin({
|
|
411
|
+
config,
|
|
412
|
+
prop: routed,
|
|
413
|
+
layers,
|
|
414
|
+
decl
|
|
415
|
+
}),
|
|
322
416
|
name,
|
|
323
417
|
required
|
|
324
418
|
}, when));
|
|
@@ -353,7 +447,7 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
|
|
|
353
447
|
continue;
|
|
354
448
|
}
|
|
355
449
|
if (decl.type === "composite") {
|
|
356
|
-
const compositeName =
|
|
450
|
+
const compositeName = compositeNameOf(config, decl.value);
|
|
357
451
|
if (!compositeName) continue;
|
|
358
452
|
props.push(conditioned({
|
|
359
453
|
name,
|
|
@@ -369,7 +463,6 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
|
|
|
369
463
|
required
|
|
370
464
|
}, when));
|
|
371
465
|
}
|
|
372
|
-
cache?.set(componentPath, props);
|
|
373
466
|
return props;
|
|
374
467
|
}
|
|
375
468
|
/**
|
|
@@ -391,15 +484,22 @@ function boundProp(config, layers, decl, seen) {
|
|
|
391
484
|
kind: "string",
|
|
392
485
|
required: false
|
|
393
486
|
};
|
|
394
|
-
|
|
395
|
-
if (
|
|
396
|
-
|
|
487
|
+
let named;
|
|
488
|
+
if (isRef(decl.into)) named = decl.into;
|
|
489
|
+
else if (isRef(element)) named = element;
|
|
490
|
+
if (!named) return typeof element === "string" ? undeclared : void 0;
|
|
491
|
+
const end = farEnd(config, named);
|
|
492
|
+
if (!end) return void 0;
|
|
493
|
+
const key = routeKey({
|
|
494
|
+
named,
|
|
495
|
+
prop: propName
|
|
496
|
+
});
|
|
397
497
|
if (seen.has(key)) return void 0;
|
|
398
|
-
const far = surfaceProps(config,
|
|
498
|
+
const far = surfaceProps(end.config, end.path, new Set([...seen, key])).find((prop) => prop.name === propName);
|
|
399
499
|
if (far) return far;
|
|
400
|
-
const farBody = Component.get(config,
|
|
500
|
+
const farBody = Component.get(end.config, end.path)?.toJSON();
|
|
401
501
|
if (!farBody) return void 0;
|
|
402
|
-
return propName in resolveComponentProps(config,
|
|
502
|
+
return propName in resolveComponentProps(end.config, end.path) || propName in (farBody.props ?? {}) ? void 0 : undeclared;
|
|
403
503
|
}
|
|
404
504
|
/** One prop by name, or `undefined` when the component doesn't expose it. */
|
|
405
505
|
function surfaceProp(config, componentPath, name) {
|
|
@@ -470,7 +570,10 @@ function computeForwardClaims(config, componentPath) {
|
|
|
470
570
|
if (!isRef(element)) continue;
|
|
471
571
|
const taken = takenByForward({
|
|
472
572
|
entry,
|
|
473
|
-
exposed:
|
|
573
|
+
exposed: elementProps({
|
|
574
|
+
config,
|
|
575
|
+
element
|
|
576
|
+
})
|
|
474
577
|
});
|
|
475
578
|
for (const name of Object.keys(taken)) {
|
|
476
579
|
if (own.has(name)) continue;
|
|
@@ -583,4 +686,4 @@ function renderBoundProp(value) {
|
|
|
583
686
|
return name.length > 0 && !name.includes("/") ? name : void 0;
|
|
584
687
|
}
|
|
585
688
|
//#endregion
|
|
586
|
-
export { carriesContent, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, renderBoundProp, routeEnd, routedProp, routedPropIn, routesContent, routesIntoText, slotCodeForms, standsInForCode, surfaceProp, surfaceProps };
|
|
689
|
+
export { carriesContent, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, renderBoundProp, routeEnd, routedProp, routedPropIn, routesContent, routesIntoText, slotCodeForms, standsInForCode, surfaceProp, surfaceProps, withheldStyleProps };
|
|
@@ -156,6 +156,7 @@ function unknownStyleLeaves(config) {
|
|
|
156
156
|
const sites = config.entityOf(kind)?.styleBags;
|
|
157
157
|
if (!sites) continue;
|
|
158
158
|
for (const item of config.list(kind)) {
|
|
159
|
+
if (config.vendorOf(kind, item.path) !== void 0) continue;
|
|
159
160
|
const body = item.toJSON();
|
|
160
161
|
for (const { bag, element } of sites(body)) {
|
|
161
162
|
const own = bag === body.defaultProps ? body.props : element !== void 0 ? renderedProps(config, element, body.layers) : void 0;
|
|
@@ -428,8 +428,10 @@ interface EntityKind {
|
|
|
428
428
|
* pin offers as a different entity is a collision.
|
|
429
429
|
* - `hybrid`: it brings in only what no other pin offers. Where another pin offers a path, that pin's
|
|
430
430
|
* row stands, and what this pin brings uses it; a component it renders stays its own source's.
|
|
431
|
+
* - `vendor`: only what the pin declares lands as a row. Everything those entities reference is read
|
|
432
|
+
* through the source and drawn under the pin's names, never bound to a row of this config's.
|
|
431
433
|
*/
|
|
432
|
-
type SourceType = 'linked' | 'hybrid';
|
|
434
|
+
type SourceType = 'linked' | 'hybrid' | 'vendor';
|
|
433
435
|
/** Every operation a kind exposes — its merged `schemas` map, flattened to `{ kind, verb, ... }`.
|
|
434
436
|
* The single derivation the Operation entity maps over; nothing hardcodes a CRUD list. Reads the
|
|
435
437
|
* kind def a `Config` holds (`config.entityOf(kind)`); `undefined` → no ops. */
|
|
@@ -523,6 +523,12 @@ function componentSpec(config, path) {
|
|
|
523
523
|
return built;
|
|
524
524
|
}
|
|
525
525
|
function buildComponentSpec(config, path) {
|
|
526
|
+
const vendor = config.vendorOf("component", path);
|
|
527
|
+
if (vendor !== void 0) return {
|
|
528
|
+
spec: instanceSpec(path),
|
|
529
|
+
kind: "leaf",
|
|
530
|
+
reason: `"${path}" comes from the vendor source "${vendor}", which is used as shipped, so it renders as itself.`
|
|
531
|
+
};
|
|
526
532
|
const derived = projectSpec(config, path);
|
|
527
533
|
if (derived) return {
|
|
528
534
|
spec: derived,
|
|
@@ -15,7 +15,7 @@ import { Patch, SerializedConfig } from "./Config.js";
|
|
|
15
15
|
* sets this constant to its own older timestamp; the merge ref then carries a registered migration
|
|
16
16
|
* newer than the constant, and the assertion fails until the author re-mints.
|
|
17
17
|
*/
|
|
18
|
-
declare const CURRENT_SCHEMA_VERSION =
|
|
18
|
+
declare const CURRENT_SCHEMA_VERSION = 20261112163439;
|
|
19
19
|
/** What the walkers need to see of an envelope — loose on purpose, so a typed `SerializedConfig`
|
|
20
20
|
* and a raw old-shape record both flow in without casts. */
|
|
21
21
|
interface VersionStamped {
|
|
@@ -13,7 +13,7 @@ import { ConfigFormatError } from "./rejection.js";
|
|
|
13
13
|
* sets this constant to its own older timestamp; the merge ref then carries a registered migration
|
|
14
14
|
* newer than the constant, and the assertion fails until the author re-mints.
|
|
15
15
|
*/
|
|
16
|
-
const CURRENT_SCHEMA_VERSION =
|
|
16
|
+
const CURRENT_SCHEMA_VERSION = 20261112163439;
|
|
17
17
|
/** The mint that moved `options` into the `settings` kind — restated here, rather than imported
|
|
18
18
|
* from the migration that owns it, because that migration imports this module. */
|
|
19
19
|
const SETTINGS_AS_KIND_VERSION = 20260908171448;
|
|
@@ -45,7 +45,7 @@ function registerSchemaMigrations(...migrations) {
|
|
|
45
45
|
for (const migration of migrations) {
|
|
46
46
|
if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp — mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
|
|
47
47
|
if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
|
|
48
|
-
if (migration.version >
|
|
48
|
+
if (migration.version > 20261112163439) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
|
|
49
49
|
REGISTERED.set(migration.version, migration);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -102,7 +102,7 @@ function pendingFor(version, target, options) {
|
|
|
102
102
|
* Already-current input passes through untouched — same reference, so hot paths pay nothing.
|
|
103
103
|
*/
|
|
104
104
|
function upgradeSerializedConfig(json, options) {
|
|
105
|
-
const target = options?.target ??
|
|
105
|
+
const target = options?.target ?? 20261112163439;
|
|
106
106
|
const version = detectedWireVersion(json);
|
|
107
107
|
if (version > target) throw new SchemaVersionTooNew(version, target);
|
|
108
108
|
const raw = json;
|
|
@@ -160,7 +160,7 @@ function upgradedSources(json, options) {
|
|
|
160
160
|
* meaning under the current schema and replay skips it — reported by the caller, not swallowed here.
|
|
161
161
|
*/
|
|
162
162
|
function upgradePatch(patch, writtenAt, options) {
|
|
163
|
-
const target = options?.target ??
|
|
163
|
+
const target = options?.target ?? 20261112163439;
|
|
164
164
|
if (writtenAt > target) throw new SchemaVersionTooNew(writtenAt, target);
|
|
165
165
|
let current = patch;
|
|
166
166
|
for (const migration of pendingFor(writtenAt, target, options)) {
|
|
@@ -179,7 +179,7 @@ function upgradePatch(patch, writtenAt, options) {
|
|
|
179
179
|
* stamp would cause.
|
|
180
180
|
*/
|
|
181
181
|
function upgradeDraftEntries(draft, options) {
|
|
182
|
-
const target = options?.target ??
|
|
182
|
+
const target = options?.target ?? 20261112163439;
|
|
183
183
|
const entries = [];
|
|
184
184
|
const held = [];
|
|
185
185
|
const retired = [];
|
|
@@ -670,6 +670,7 @@ function excludedCondition(config, on) {
|
|
|
670
670
|
function unstatableConditions(config) {
|
|
671
671
|
const found = [];
|
|
672
672
|
for (const slug of config.sourceSlugs()) {
|
|
673
|
+
if (config.sourceTypeOf(slug) === "vendor") continue;
|
|
673
674
|
const source = config.sourceFor(slug);
|
|
674
675
|
if (!source) continue;
|
|
675
676
|
for (const target of config.runtimeSourceClosure({
|