@yahoo/uds-create-config 3.1.0 → 3.3.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 +66 -3
- package/dist/configs/react-native-system.d.ts +46 -2
- package/dist/configs/react-native-system.js +4 -0
- package/dist/configs/system.d.ts +46 -2
- package/dist/configs/system.js +4 -0
- package/dist/entities/system/Component.d.ts +40 -2
- package/dist/entities/system/Component.js +74 -9
- package/dist/entities/system/File.d.ts +1 -0
- package/dist/entities/system/File.js +27 -2
- package/dist/entities/system/style-bag.js +24 -5
- package/dist/framework/Config.d.ts +1 -1
- package/dist/framework/Config.js +1 -1
- package/dist/framework/anatomy-check.d.ts +99 -0
- package/dist/framework/anatomy-check.js +337 -0
- package/dist/framework/class-names.js +6 -2
- package/dist/framework/defineEntity.d.ts +1 -0
- package/dist/framework/ref-integrity.js +17 -3
- package/dist/framework/registry.d.ts +1 -0
- package/dist/framework/render-spec.d.ts +12 -1
- package/dist/framework/render-spec.js +122 -28
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -3
- package/dist/migrations/2.0.0/v1-artifact.d.ts +23 -1
- package/dist/migrations/20260914155048_component_create_blank_op.d.ts +13 -0
- package/dist/migrations/20260914155048_component_create_blank_op.js +8 -0
- package/dist/migrations/20260914181845_anatomy_harness.d.ts +23 -0
- package/dist/migrations/20260914181845_anatomy_harness.js +10 -0
- package/dist/renderer/assetEntries.js +2 -3
- package/dist/renderer/spec-content.js +1 -1
- package/dist/renderer/wrappers/inline-styles.js +21 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/specToJsx.js +26 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { kindOf } from "../../framework/utils/refs.js";
|
|
1
2
|
import React from "react";
|
|
2
3
|
//#region src/renderer/wrappers/inline-styles.tsx
|
|
3
4
|
const HEX_RE = /^#[0-9a-fA-F]{3,8}$/;
|
|
@@ -68,6 +69,7 @@ function wrapInlineStyleProps(reg, config = {}) {
|
|
|
68
69
|
const elementType = renderProps.element.type;
|
|
69
70
|
const rawStyle = props?.style;
|
|
70
71
|
if (!props || rawStyle == null) return React.createElement(Comp, renderProps);
|
|
72
|
+
if (props["data-uds-layer"] !== void 0) return React.createElement(Comp, renderProps);
|
|
71
73
|
let style;
|
|
72
74
|
if (typeof rawStyle === "string") style = parseCssDeclarationString(rawStyle);
|
|
73
75
|
else if (typeof rawStyle === "object" && !Array.isArray(rawStyle)) style = rawStyle;
|
|
@@ -98,8 +100,26 @@ function wrapInlineStyleProps(reg, config = {}) {
|
|
|
98
100
|
}
|
|
99
101
|
});
|
|
100
102
|
};
|
|
101
|
-
for (const [name, Comp] of Object.entries(reg))
|
|
103
|
+
for (const [name, Comp] of Object.entries(reg)) {
|
|
104
|
+
if (takesNoStyleProps(name)) {
|
|
105
|
+
wrapped[name] = Comp;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
wrapped[name] = makeInlineStylePropsWrapper(Comp);
|
|
109
|
+
}
|
|
102
110
|
return wrapped;
|
|
103
111
|
}
|
|
112
|
+
/** Whether a registry key names something that cannot resolve a style prop — see the loop above. */
|
|
113
|
+
function takesNoStyleProps(registryKey) {
|
|
114
|
+
if (!registryKey.includes(":")) return false;
|
|
115
|
+
const open = registryKey.indexOf("(");
|
|
116
|
+
const kind = kindOf(open !== -1 && registryKey.endsWith(")") ? registryKey.slice(0, open) : registryKey);
|
|
117
|
+
if (kind !== "package" && kind !== "file") return false;
|
|
118
|
+
if (open !== -1 && registryKey.endsWith(")")) {
|
|
119
|
+
const target = registryKey.slice(open + 1, -1);
|
|
120
|
+
return !(target.includes(":") && kindOf(target) === "component");
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
104
124
|
//#endregion
|
|
105
125
|
export { wrapInlineStyleProps };
|
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AcceptsChildNodes, ChildNodesClassification, ClassifyChildNodes, buildAcceptsChildNodes, buildClassifyChildNodes, namedSlotTargets, stripInjectedSlots, withContainerChildSlots, withEmptyNodeSlots, withRenderSlots } from "./empty-node-slots.js";
|
|
2
|
+
import { GraftableElement, GraftableSpec, PreviewElement, PreviewSpecNode, PreviewValue, graftPreviewElements, hasPreviewElementDeep, isPreviewElement, previewElementNodes, previewElementType } from "./preview-elements.js";
|
|
2
3
|
import { DocumentRename, RewritableSpec, SpecRewrite, rewriteSpecRefs } from "./rewrite-refs.js";
|
|
3
4
|
import { applyForcedModifiers, collectForcedModifierProps } from "./apply-forced-modifiers.js";
|
|
4
5
|
import { AssetComponentMap, AssetJsxForm, AssetNodeResolver, assetJsxForm, jsxIdentifier, parseAssetType } from "./asset-jsx.js";
|
|
5
6
|
import { CollapseTextLabelsResult, CollapsedTextLabel, collapseWrappedTextLabels } from "./collapse-text-labels.js";
|
|
6
7
|
import { JsxToSpecOptions, UNRESOLVED, hasUnresolvedProps, jsxToSpec, stripUnresolvedProps } from "./jsxToSpec.js";
|
|
7
|
-
import { GraftableElement, GraftableSpec, PreviewElement, PreviewSpecNode, PreviewValue, graftPreviewElements, hasPreviewElementDeep, isPreviewElement, previewElementNodes, previewElementType } from "./preview-elements.js";
|
|
8
8
|
import { SpecToJsxOptions, SpecToJsxResult, specToJsx } from "./specToJsx.js";
|
|
9
9
|
|
|
10
10
|
//#region src/spec/index.d.ts
|
package/dist/spec/specToJsx.js
CHANGED
|
@@ -4,9 +4,26 @@ import { serializeProps } from "@json-render/codegen";
|
|
|
4
4
|
function statePathToExpression(path) {
|
|
5
5
|
return `state${path.split("/").filter(Boolean).map((s) => `.${s}`).join("")}`;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function isStateValue(value) {
|
|
8
8
|
return typeof value === "object" && value !== null && "$state" in value && typeof value.$state === "string";
|
|
9
9
|
}
|
|
10
|
+
/** `{ $cond, $then, $else }` — a value the anatomy chooses by a condition on state. */
|
|
11
|
+
function isConditionalValue(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && "$cond" in value && "$then" in value && "$else" in value && isStateValue(value.$cond);
|
|
13
|
+
}
|
|
14
|
+
/** A `$state` binding or a `$cond` choice — anything written as an expression rather than a literal. */
|
|
15
|
+
function isDynamicValue(value) {
|
|
16
|
+
return isStateValue(value) || isConditionalValue(value);
|
|
17
|
+
}
|
|
18
|
+
/** The test of a `$cond`, as the expression the render would have written. */
|
|
19
|
+
function conditionExpression(condition) {
|
|
20
|
+
const subject = statePathToExpression(condition.$state);
|
|
21
|
+
let test;
|
|
22
|
+
if (condition.eq !== void 0) test = `${subject} === ${JSON.stringify(condition.eq)}`;
|
|
23
|
+
else if (condition.neq !== void 0) test = `${subject} !== ${JSON.stringify(condition.neq)}`;
|
|
24
|
+
else test = subject;
|
|
25
|
+
return condition.not ? `!(${test})` : test;
|
|
26
|
+
}
|
|
10
27
|
/** All element keys an element's `slots` record pulls in. */
|
|
11
28
|
function collectSlotKeys(slots) {
|
|
12
29
|
const keys = /* @__PURE__ */ new Set();
|
|
@@ -14,9 +31,16 @@ function collectSlotKeys(slots) {
|
|
|
14
31
|
return keys;
|
|
15
32
|
}
|
|
16
33
|
function resolveDynamicValue(value) {
|
|
17
|
-
if (
|
|
34
|
+
if (isConditionalValue(value)) return `${conditionExpression(value.$cond)} ? ${armExpression(value.$then)} : ${armExpression(value.$else)}`;
|
|
35
|
+
if (isStateValue(value)) return statePathToExpression(value.$state);
|
|
18
36
|
return String(value);
|
|
19
37
|
}
|
|
38
|
+
/** One arm of a written-back choice: a nested choice in parentheses, a binding, or a literal. */
|
|
39
|
+
function armExpression(value) {
|
|
40
|
+
if (isConditionalValue(value)) return `(${resolveDynamicValue(value)})`;
|
|
41
|
+
if (isStateValue(value)) return statePathToExpression(value.$state);
|
|
42
|
+
return JSON.stringify(value);
|
|
43
|
+
}
|
|
20
44
|
function renderActionBinding(binding) {
|
|
21
45
|
if (Array.isArray(binding)) return `{() => { ${binding.map((b) => b.action).map((a) => `${a}()`).join("; ")} }}`;
|
|
22
46
|
return `{${binding.action}}`;
|