@yahoo/uds-create-config 5.99.1 → 5.99.3
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.
|
@@ -10,6 +10,7 @@ import { defineEntity } from "../../framework/defineEntity.js";
|
|
|
10
10
|
import { defineSubEntity, orList } from "../../framework/defineSubEntity.js";
|
|
11
11
|
import { childrenPolicy, forwardedPropName } from "./element.js";
|
|
12
12
|
import { interactionKey, interactionModifiers, isInteractionModifier } from "../../framework/interaction-conditions.js";
|
|
13
|
+
import { nativeFlexValue } from "./linked-flex-values.js";
|
|
13
14
|
import { Package } from "./Package.js";
|
|
14
15
|
import { File } from "./File.js";
|
|
15
16
|
import { translateLinkedStyleBags } from "./linked-style-values.js";
|
|
@@ -768,6 +769,8 @@ function styleBagValue({ config, declaration, name = "<prop>", glyphLibraries })
|
|
|
768
769
|
if (declaration?.type === "slot" && !isValueSlot(declaration)) return z.union([domain, z.never()], { error: () => `\`${name}\` is a slot, so a rule may set it to a string of content and nothing else. A glyph or a nested element is an anatomy node under the layer's node — \`{ "element": { "__ref": "icon:<library>/<Name>" }, "visible": { "$state": "<prop>", "eq": "<value>" } }\` to show one per variant value — and the instance's own content arrives through the prop.` });
|
|
769
770
|
if (!isRef(bound) || kindOf(bound.__ref) !== "style-property") return domain;
|
|
770
771
|
const property = pathOf(bound.__ref);
|
|
772
|
+
const properties = config.resolve("style-property", property)?.toJSON().properties;
|
|
773
|
+
const nativeFlex = config.name === "react-native-system" && Array.isArray(properties) && properties.length === 1 && properties[0] === "flex";
|
|
771
774
|
return z.union([
|
|
772
775
|
domain,
|
|
773
776
|
oklchColor,
|
|
@@ -775,7 +778,8 @@ function styleBagValue({ config, declaration, name = "<prop>", glyphLibraries })
|
|
|
775
778
|
gradient,
|
|
776
779
|
shadowValue,
|
|
777
780
|
refSchema,
|
|
778
|
-
...config.name === "react-native-system" ? [nativeStyleArray] : []
|
|
781
|
+
...config.name === "react-native-system" ? [nativeStyleArray] : [],
|
|
782
|
+
...nativeFlex ? [nativeFlexValue] : []
|
|
779
783
|
], { error: (issue) => {
|
|
780
784
|
const leaves = stylePropValueLeaves(config, property);
|
|
781
785
|
if (typeof issue.input === "number" && leaves.includes(String(issue.input))) return `\`${name}\`: \`${issue.input}\` names a value as a string, so write \`'${issue.input}'\`. A number names only a value the style property declares as a number.`;
|
|
@@ -250,7 +250,7 @@ function bagKeyIssue(config, key, declared, { cssBehind = true } = {}) {
|
|
|
250
250
|
if (!cssBehind || declared?.has(key) || config.resolve("style-property", key)) return;
|
|
251
251
|
const behind = stylePropertyBehind(config, key);
|
|
252
252
|
if (behind) return `\`${key}\` is the CSS property behind the style property \`${behind}\`; a layer key is the style-prop name, \`${behind}\`.`;
|
|
253
|
-
if (isCssProperty(key)) return `\`${key}\` is a CSS property, and this system has no style property that sets it, so it would be passed to the element as an attribute and paint nothing. Declare one — \`{ "kind": "style-property", "operation": "create", "path": "${key}", "data": { "properties": ["${kebabCase(key)}"], "values": [] } }\` with keywords or a token group ref in \`values\` — expose it on the primitive as \`{ "type": "styleProperty", "value": { "__ref": "style-property:${key}" } }\`, then set it here by one of its values.`;
|
|
253
|
+
if (config.name !== "react-native-system" && isCssProperty(key)) return `\`${key}\` is a CSS property, and this system has no style property that sets it, so it would be passed to the element as an attribute and paint nothing. Declare one — \`{ "kind": "style-property", "operation": "create", "path": "${key}", "data": { "properties": ["${kebabCase(key)}"], "values": [] } }\` with keywords or a token group ref in \`values\` — expose it on the primitive as \`{ "type": "styleProperty", "value": { "__ref": "style-property:${key}" } }\`, then set it here by one of its values.`;
|
|
254
254
|
}
|
|
255
255
|
/** A registered modifier's block, which holds a bag of the same shape. */
|
|
256
256
|
function isModifierBlock(config, key, value) {
|