@yahoo/uds-create-config 5.62.6 → 5.62.12
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/native/NativeToken.js +3 -1
- package/dist/entities/system/component-module.js +1 -1
- package/dist/entities/system/icon-library.js +5 -0
- package/dist/entities/system/linked-style-values.js +26 -4
- package/dist/native/index.d.ts +3 -3
- package/dist/native/index.js +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ import { z } from "zod";
|
|
|
28
28
|
*/
|
|
29
29
|
const colorNumber = "[+-]?(?:\\d*\\.)?\\d+";
|
|
30
30
|
const rgbColor = new RegExp(`^rgba?\\(\\s*(?:${colorNumber}\\s*,\\s*${colorNumber}\\s*,\\s*${colorNumber}(?:\\s*,\\s*${colorNumber})?|${colorNumber}\\s+${colorNumber}\\s+${colorNumber}(?:\\s*/\\s*${colorNumber})?)\\s*\\)$`);
|
|
31
|
-
/**
|
|
31
|
+
/** Native literals and foreground markers resolved by UDS native render adapters. Deliberately no
|
|
32
32
|
* bare `z.string()` arm: that is exactly where every web-ism would leak through. Widen only with
|
|
33
33
|
* evidence from a real system's port. */
|
|
34
34
|
const nativeTokenString = z.union([
|
|
@@ -37,6 +37,8 @@ const nativeTokenString = z.union([
|
|
|
37
37
|
z.string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/),
|
|
38
38
|
z.string().regex(rgbColor),
|
|
39
39
|
z.literal("transparent"),
|
|
40
|
+
z.literal("inherit"),
|
|
41
|
+
z.literal("currentColor"),
|
|
40
42
|
z.literal("auto"),
|
|
41
43
|
z.literal("none")
|
|
42
44
|
]);
|
|
@@ -17,7 +17,7 @@ import { contentKey } from "../../framework/utils/content-key.js";
|
|
|
17
17
|
* The shared compiler/runtime contract. Bump whenever codegen can produce different module bytes
|
|
18
18
|
* from identical config-visible inputs (shim contracts, entry shape, transforms, and so on).
|
|
19
19
|
*/
|
|
20
|
-
const COMPONENT_MODULE_BUILD_VERSION =
|
|
20
|
+
const COMPONENT_MODULE_BUILD_VERSION = 9;
|
|
21
21
|
/**
|
|
22
22
|
* Generated web runtime inputs shared by every component module. These are intentionally separate
|
|
23
23
|
* from the per-file closure: editing an unrelated component should not invalidate this module, but
|
|
@@ -280,6 +280,7 @@ function memberVariantOptions(library, member) {
|
|
|
280
280
|
const narrowed = library.variants.filter((variant) => own.includes(variant));
|
|
281
281
|
return narrowed.length > 0 ? narrowed : library.variants;
|
|
282
282
|
}
|
|
283
|
+
const INTRINSIC_TAG = /^[a-z][a-zA-Z0-9-]*$/;
|
|
283
284
|
/**
|
|
284
285
|
* Whether an element type declares a prop that may survive layer-style projection. A placed
|
|
285
286
|
* glyph's type isn't a component, so its prop surface comes from its library instead: the
|
|
@@ -293,6 +294,10 @@ function isDeclaredElementProp(config, elementType, propName) {
|
|
|
293
294
|
if (isCustomPropertyKey(propName)) return false;
|
|
294
295
|
return config.resolve("style-property", propName) === void 0;
|
|
295
296
|
}
|
|
297
|
+
if (INTRINSIC_TAG.test(elementType)) {
|
|
298
|
+
if (isCustomPropertyKey(propName)) return false;
|
|
299
|
+
return config.resolve("style-property", propName) === void 0;
|
|
300
|
+
}
|
|
296
301
|
const parsed = parseGlyphType(elementType);
|
|
297
302
|
if (!parsed) return false;
|
|
298
303
|
const library = iconLibrary(config, parsed.slug);
|
|
@@ -12,12 +12,34 @@ function translateLinkedStyleBags({ body, source, config, bags, owner }) {
|
|
|
12
12
|
if (!["system-config", "react-native-system"].includes(source.name)) return body;
|
|
13
13
|
if (!["system-config", "react-native-system"].includes(config.name)) return body;
|
|
14
14
|
const native = config.name === NATIVE_CONFIG_NAME;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const sourceProperty = ({ key, element }) => {
|
|
16
|
+
let receiver;
|
|
17
|
+
if (isRef(element)) receiver = pathOf(element);
|
|
18
|
+
else if (typeof element === "string") receiver = element;
|
|
19
|
+
return stylePropertyPathFor({
|
|
18
20
|
config: source,
|
|
19
21
|
key,
|
|
20
|
-
through: [
|
|
22
|
+
through: [owner, receiver]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const enabledStyles = ({ bag, element }) => Object.fromEntries(Object.entries(bag).filter(([key]) => {
|
|
26
|
+
if (!native || key.startsWith("_")) return true;
|
|
27
|
+
const property = sourceProperty({
|
|
28
|
+
key,
|
|
29
|
+
element
|
|
30
|
+
});
|
|
31
|
+
if (!property) return true;
|
|
32
|
+
const mapping = config.resolve("style-property", property)?.toJSON();
|
|
33
|
+
return !mapping || !Array.isArray(mapping.properties) || mapping.properties.length > 0 || !!mapping.opacityOf || stylePropEntries(config, property).some((entry) => entry.declarations);
|
|
34
|
+
}));
|
|
35
|
+
const translate = (bag, element) => Object.fromEntries(Object.entries(enabledStyles({
|
|
36
|
+
bag,
|
|
37
|
+
element
|
|
38
|
+
})).map(([key, raw]) => {
|
|
39
|
+
if (key.startsWith("_")) return [key, raw];
|
|
40
|
+
const propPath = sourceProperty({
|
|
41
|
+
key,
|
|
42
|
+
element
|
|
21
43
|
});
|
|
22
44
|
const properties = propPath ? source.resolve("style-property", propPath)?.toJSON().properties : void 0;
|
|
23
45
|
if (!propPath || !Array.isArray(properties) || properties.length !== 1 || isRef(raw)) return [key, raw];
|
package/dist/native/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ColorValue } from "react-native";
|
|
|
4
4
|
|
|
5
5
|
//#region src/native/index.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* Publish a container's final, resolved foreground. An absent color or `
|
|
7
|
+
* Publish a container's final, resolved foreground. An absent color, `inherit`, or `currentColor` passes through
|
|
8
8
|
* the enclosing foreground. Resolve style arrays and interaction callbacks before calling this;
|
|
9
9
|
* the provider does not select tokens, modes or states, or add a native host element.
|
|
10
10
|
*/
|
|
@@ -16,9 +16,9 @@ declare function NativeForegroundProvider({
|
|
|
16
16
|
children?: ReactNode;
|
|
17
17
|
}): _$react.FunctionComponentElement<_$react.ProviderProps<ColorValue | undefined>>;
|
|
18
18
|
/**
|
|
19
|
-
* Resolve
|
|
19
|
+
* Resolve explicit foreground inheritance markers. Defaults, explicit colors and native opaque colors retain
|
|
20
20
|
* their identity. Without a provider, inheritance becomes undefined (never an invalid native
|
|
21
|
-
*
|
|
21
|
+
* inheritance marker). Call this in a component, not inside a Pressable render callback.
|
|
22
22
|
*/
|
|
23
23
|
declare function useNativeForeground(color: ColorValue | undefined): ColorValue | undefined;
|
|
24
24
|
//#endregion
|
package/dist/native/index.js
CHANGED
|
@@ -2,22 +2,22 @@ import { createContext, createElement, useContext } from "react";
|
|
|
2
2
|
//#region src/native/index.ts
|
|
3
3
|
const ForegroundContext = createContext(void 0);
|
|
4
4
|
/**
|
|
5
|
-
* Publish a container's final, resolved foreground. An absent color or `
|
|
5
|
+
* Publish a container's final, resolved foreground. An absent color, `inherit`, or `currentColor` passes through
|
|
6
6
|
* the enclosing foreground. Resolve style arrays and interaction callbacks before calling this;
|
|
7
7
|
* the provider does not select tokens, modes or states, or add a native host element.
|
|
8
8
|
*/
|
|
9
9
|
function NativeForegroundProvider({ color, children }) {
|
|
10
10
|
const parent = useContext(ForegroundContext);
|
|
11
|
-
return createElement(ForegroundContext.Provider, { value: color == null || color === "inherit" ? parent : color }, children);
|
|
11
|
+
return createElement(ForegroundContext.Provider, { value: color == null || color === "inherit" || color === "currentColor" ? parent : color }, children);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Resolve
|
|
14
|
+
* Resolve explicit foreground inheritance markers. Defaults, explicit colors and native opaque colors retain
|
|
15
15
|
* their identity. Without a provider, inheritance becomes undefined (never an invalid native
|
|
16
|
-
*
|
|
16
|
+
* inheritance marker). Call this in a component, not inside a Pressable render callback.
|
|
17
17
|
*/
|
|
18
18
|
function useNativeForeground(color) {
|
|
19
19
|
const parent = useContext(ForegroundContext);
|
|
20
|
-
return color === "inherit" ? parent : color;
|
|
20
|
+
return color === "inherit" || color === "currentColor" ? parent : color;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { NativeForegroundProvider, useNativeForeground };
|