@yahoo/uds-create-config 4.6.0 → 4.8.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/CanvasConfig.d.ts +900 -80
- package/dist/configs/react-native-system.d.ts +603 -55
- package/dist/configs/system.d.ts +603 -55
- package/dist/configs/system.js +7 -1
- package/dist/entities/system/Component.d.ts +480 -39
- package/dist/entities/system/Component.js +264 -93
- package/dist/entities/system/File.d.ts +1 -1
- package/dist/entities/system/LinkedSystem.d.ts +2 -2
- package/dist/entities/system/Operation.d.ts +1 -1
- package/dist/entities/system/StyleProperty.d.ts +8 -0
- package/dist/entities/system/StyleProperty.js +12 -1
- package/dist/entities/system/Tool.d.ts +1 -1
- package/dist/entities/system/component-module.js +1 -1
- package/dist/entities/system/defineComponent.d.ts +45 -7
- package/dist/entities/system/defineComponent.js +52 -25
- package/dist/framework/Config.d.ts +2 -2
- package/dist/framework/Config.js +59 -7
- package/dist/framework/class-names.d.ts +4 -2
- package/dist/framework/class-names.js +56 -17
- package/dist/framework/defineDerivedEntity.d.ts +1 -1
- package/dist/framework/defineEntity.d.ts +2 -2
- package/dist/framework/defineSubEntity.d.ts +3 -2
- package/dist/framework/preview-store.d.ts +19 -0
- package/dist/framework/preview-store.js +18 -0
- package/dist/framework/projections.d.ts +28 -8
- package/dist/framework/projections.js +50 -16
- package/dist/framework/prop-surface.d.ts +21 -1
- package/dist/framework/prop-surface.js +99 -21
- package/dist/framework/render-spec.d.ts +103 -3
- package/dist/framework/render-spec.js +285 -37
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/utils/refs.js +10 -1
- package/dist/framework/validate-spec.d.ts +2 -0
- package/dist/framework/validate-spec.js +13 -0
- package/dist/index.d.ts +14 -11
- package/dist/index.js +6 -5
- package/dist/migrations/2.0.0/v1-artifact.d.ts +305 -29
- package/dist/migrations/20260919051027_prop_conditions_and_anatomy_positions_at_rest.d.ts +22 -0
- package/dist/migrations/20260919051027_prop_conditions_and_anatomy_positions_at_rest.js +10 -0
- package/dist/migrations/20260920004019_preview_conditions_keyed.d.ts +27 -0
- package/dist/migrations/20260920004019_preview_conditions_keyed.js +148 -0
- package/dist/migrations/20260920161309_prefixed_token_group.d.ts +12 -0
- package/dist/migrations/20260920161309_prefixed_token_group.js +10 -0
- package/dist/renderer/wrapRegistry.js +8 -2
- package/dist/renderer/wrappers/component-refs.d.ts +14 -0
- package/dist/renderer/wrappers/component-refs.js +79 -0
- package/dist/renderer/wrappers/hex-normalize.d.ts +5 -7
- package/dist/renderer/wrappers/hex-normalize.js +11 -10
- package/dist/spec/cell.d.ts +171 -0
- package/dist/spec/cell.js +361 -0
- package/dist/spec/detach.d.ts +125 -0
- package/dist/spec/detach.js +511 -0
- package/dist/spec/empty-node-slots.d.ts +11 -23
- package/dist/spec/empty-node-slots.js +12 -39
- package/dist/spec/index.d.ts +5 -3
- package/dist/spec/index.js +3 -3
- package/dist/spec/instance.d.ts +77 -0
- package/dist/spec/instance.js +80 -0
- package/dist/spec/preview-content.d.ts +95 -0
- package/dist/spec/preview-content.js +149 -0
- package/dist/spec/preview-elements.d.ts +54 -15
- package/dist/spec/preview-elements.js +109 -29
- package/dist/spec/prop-conditions.d.ts +28 -0
- package/dist/spec/prop-conditions.js +39 -0
- package/dist/spec/slot.d.ts +206 -0
- package/dist/spec/slot.js +542 -0
- package/dist/spec/visibility.d.ts +82 -0
- package/dist/spec/visibility.js +109 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -2
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { refLeaf } from "../framework/utils/refs.js";
|
|
2
|
+
import { ruleApplies } from "../framework/layer-styles.js";
|
|
3
|
+
import { andListOf, spelled, statePointerProp } from "../framework/render-spec.js";
|
|
4
|
+
//#region src/spec/visibility.ts
|
|
5
|
+
function isOr(clause) {
|
|
6
|
+
return typeof clause === "object" && clause !== null && Array.isArray(clause.$or);
|
|
7
|
+
}
|
|
8
|
+
function isTest(clause) {
|
|
9
|
+
return typeof clause === "object" && clause !== null && typeof clause.$state === "string";
|
|
10
|
+
}
|
|
11
|
+
/** The tests of the clause that excludes `cellProps`, one per pinned axis, in axis order. */
|
|
12
|
+
function exclusionTests(cellProps) {
|
|
13
|
+
return Object.keys(cellProps).sort((a, b) => a.localeCompare(b)).map((axis) => ({
|
|
14
|
+
$state: `/${axis}`,
|
|
15
|
+
neq: refLeaf(cellProps[axis])
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The clause that hides a layer at one coordinate, or `null` for a cell that pins nothing: a
|
|
20
|
+
* zero-axis component has one cell, and hiding the layer there is deleting it.
|
|
21
|
+
*/
|
|
22
|
+
function variantExclusion(cellProps) {
|
|
23
|
+
const tests = exclusionTests(cellProps);
|
|
24
|
+
if (tests.length === 0) return null;
|
|
25
|
+
return tests.length === 1 ? tests[0] : { $or: tests };
|
|
26
|
+
}
|
|
27
|
+
/** Whether a stored test is exactly `axis differs from value`: a `neq` on that prop and nothing more. */
|
|
28
|
+
function sameTest(stored, wanted) {
|
|
29
|
+
if (!isExclusionTest(stored)) return false;
|
|
30
|
+
if (statePointerProp(stored.$state) !== statePointerProp(wanted.$state)) return false;
|
|
31
|
+
return refLeaf(stored.neq) === refLeaf(wanted.neq);
|
|
32
|
+
}
|
|
33
|
+
function sameClause(stored, wanted) {
|
|
34
|
+
if (isOr(wanted)) {
|
|
35
|
+
if (!isOr(stored) || stored.$or.length !== wanted.$or.length) return false;
|
|
36
|
+
return wanted.$or.every((test) => stored.$or.some((candidate) => sameTest(candidate, test)));
|
|
37
|
+
}
|
|
38
|
+
return sameTest(stored, wanted);
|
|
39
|
+
}
|
|
40
|
+
/** Whether a clause is an exclusion of some coordinate: a bare `neq` test, or an `$or` of only those. */
|
|
41
|
+
function isExclusion(clause) {
|
|
42
|
+
if (isOr(clause)) return clause.$or.every((test) => isExclusionTest(test));
|
|
43
|
+
return isExclusionTest(clause);
|
|
44
|
+
}
|
|
45
|
+
/** A `neq` test and nothing beside it: `not`, `eq` or a second operator makes it somebody else's. */
|
|
46
|
+
function isExclusionTest(test) {
|
|
47
|
+
return isTest(test) && "neq" in test && Object.keys(test).every((key) => key === "$state" || key === "neq");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A condition split into the clauses the eye writes, one per variant a layer is hidden in, and the
|
|
51
|
+
* rest, which is what a boolean binding reads and edits. A surface that rewrites the rest puts the
|
|
52
|
+
* exclusions back with `spelledWith`, so a hide in one variant survives a change of binding.
|
|
53
|
+
*/
|
|
54
|
+
function splitVariantExclusions(visible) {
|
|
55
|
+
const exclusions = [];
|
|
56
|
+
const rest = [];
|
|
57
|
+
for (const member of andListOf(visible)) if (isExclusion(member)) exclusions.push(member);
|
|
58
|
+
else rest.push(member);
|
|
59
|
+
return {
|
|
60
|
+
exclusions,
|
|
61
|
+
rest
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** The stored spelling of `clauses` followed by `exclusions`: `null` for none, a bare clause for one,
|
|
65
|
+
* the and-list for several. */
|
|
66
|
+
function spelledWith({ clauses, exclusions }) {
|
|
67
|
+
return spelled([...clauses, ...exclusions]);
|
|
68
|
+
}
|
|
69
|
+
/** Whether the node's condition carries the eye's exclusion for this cell. */
|
|
70
|
+
function excludesVariant({ visible, cellProps }) {
|
|
71
|
+
const clause = variantExclusion(cellProps);
|
|
72
|
+
if (!clause) return false;
|
|
73
|
+
return andListOf(visible).some((member) => sameClause(member, clause));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The condition with this cell excluded: the stored one plus the clause, or unchanged when the
|
|
77
|
+
* clause is already there. `undefined` when the cell pins nothing, since there is no coordinate to
|
|
78
|
+
* exclude.
|
|
79
|
+
*/
|
|
80
|
+
function withVariantHidden({ visible, cellProps }) {
|
|
81
|
+
const clause = variantExclusion(cellProps);
|
|
82
|
+
if (!clause) return void 0;
|
|
83
|
+
if (visible === false) return false;
|
|
84
|
+
const list = andListOf(visible);
|
|
85
|
+
if (list.some((member) => sameClause(member, clause))) return spelled(list);
|
|
86
|
+
return spelled([...list, clause]);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The condition with this cell's exclusion taken out, `null` when nothing is left (which clears the
|
|
90
|
+
* field), or `undefined` when the condition never excluded it.
|
|
91
|
+
*/
|
|
92
|
+
function withVariantShown({ visible, cellProps }) {
|
|
93
|
+
const clause = variantExclusion(cellProps);
|
|
94
|
+
if (!clause) return void 0;
|
|
95
|
+
const list = andListOf(visible);
|
|
96
|
+
const kept = list.filter((member) => !sameClause(member, clause));
|
|
97
|
+
if (kept.length === list.length) return void 0;
|
|
98
|
+
return spelled(kept);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The style rules that hide `layer` with `display: none` under `state`, in stored order. The
|
|
102
|
+
* projection keeps no source for a hidden layer, so a surface asking which rule hid it reads them
|
|
103
|
+
* here.
|
|
104
|
+
*/
|
|
105
|
+
function layerHidingRules({ component, layer, state }) {
|
|
106
|
+
return Object.values(component.styles ?? {}).filter((rule) => rule.layers?.[layer]?.display === "none" && ruleApplies(rule.when, state));
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { excludesVariant, layerHidingRules, spelledWith, splitVariantExclusions, variantExclusion, withVariantHidden, withVariantShown };
|