@tamagui/native-registry 3.0.13 → 3.0.15
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/cpp/HybridTamaguiRegistry.cpp +5 -32
- package/cpp/HybridTamaguiRegistry.hpp +2 -2
- package/dist/cjs/processStyleColors.native.cjs +26 -15
- package/dist/cjs/processStyleColors.native.js +26 -15
- package/dist/cjs/processStyleColors.native.js.map +1 -1
- package/dist/esm/processStyleColors.native.js +26 -15
- package/dist/esm/processStyleColors.native.js.map +1 -1
- package/package.json +3 -3
- package/src/processStyleColors.native.ts +22 -8
- package/src/reactNativeStyleAttributes.d.ts +10 -0
- package/src/types.ts +1 -1
- package/types/processStyleColors.native.d.ts.map +2 -2
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
- package/src/processBackgroundImage.d.ts +0 -6
|
@@ -536,9 +536,7 @@ class MountThread {
|
|
|
536
536
|
|
|
537
537
|
} // namespace
|
|
538
538
|
|
|
539
|
-
// merge base + the named state's props for one view into `out`.
|
|
540
|
-
// view also syncs its family's native props so React re-commits of unchanged
|
|
541
|
-
// children merge our values instead of resurrecting a stale absorbed node.
|
|
539
|
+
// merge base + the named state's props for one view into `out`.
|
|
542
540
|
// returns false on a state miss.
|
|
543
541
|
bool HybridTamaguiRegistry::buildViewUpdate(LinkedView& view,
|
|
544
542
|
const std::string& stateName,
|
|
@@ -572,35 +570,10 @@ bool HybridTamaguiRegistry::buildViewUpdate(LinkedView& view,
|
|
|
572
570
|
return false;
|
|
573
571
|
}
|
|
574
572
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
// no ancestors during the transaction and are skipped safely
|
|
580
|
-
if (view.table) {
|
|
581
|
-
// React renders a table view with its scope's current state and the
|
|
582
|
-
// engine's clones take over React's handles, so nothing goes stale. a
|
|
583
|
-
// sticky copy would make RN re-parse the view's props on every clone
|
|
584
|
-
out[&family] = std::move(update);
|
|
585
|
-
return true;
|
|
586
|
-
}
|
|
587
|
-
std::lock_guard<std::mutex> lock(family.nativePropsMutex);
|
|
588
|
-
if (family.nativeProps_DEPRECATED) {
|
|
589
|
-
family.nativeProps_DEPRECATED->update(props);
|
|
590
|
-
} else {
|
|
591
|
-
family.nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(props);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// a null value means reset-to-default (a style key dropped by a media
|
|
595
|
-
// change): it must COMMIT as null so RawProps clears the prop, but must not
|
|
596
|
-
// stick in nativeProps_DEPRECATED or every future React render would keep
|
|
597
|
-
// re-clearing a key the render may now legitimately set
|
|
598
|
-
auto& sticky = *family.nativeProps_DEPRECATED;
|
|
599
|
-
for (const auto& item : props.items()) {
|
|
600
|
-
if (item.second.isNull()) sticky.erase(item.first.asString());
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
out[&family] = std::move(update);
|
|
573
|
+
// commitUpdates transfers the updated nodes to React's handles for both
|
|
574
|
+
// runtime and table links. sticky native props would make RN re-parse
|
|
575
|
+
// unchanged props on every state/children-only clone, including scrolls.
|
|
576
|
+
out[view.family.get()] = std::move(update);
|
|
604
577
|
return true;
|
|
605
578
|
}
|
|
606
579
|
|
|
@@ -144,8 +144,8 @@ class HybridTamaguiRegistry : public HybridTamaguiRegistrySpec {
|
|
|
144
144
|
// resolve the active state name for a scope: scope entry, else root
|
|
145
145
|
const std::string* activeStateName(const std::string& scopeId) const;
|
|
146
146
|
|
|
147
|
-
// merge base + named state props for one view into `out
|
|
148
|
-
//
|
|
147
|
+
// merge base + named state props for one view into `out`;
|
|
148
|
+
// returns false on a state miss
|
|
149
149
|
bool buildViewUpdate(LinkedView& view, const std::string& stateName,
|
|
150
150
|
LeafUpdates& out);
|
|
151
151
|
|
|
@@ -30,7 +30,7 @@ var processStyleColors_native_exports = {};
|
|
|
30
30
|
__export(processStyleColors_native_exports, { processStyleColors: () => processStyleColors });
|
|
31
31
|
module.exports = __toCommonJS(processStyleColors_native_exports);
|
|
32
32
|
var import_react_native = require("react-native");
|
|
33
|
-
var
|
|
33
|
+
var import_ReactNativeStyleAttributes = __toESM(require("react-native/Libraries/Components/View/ReactNativeStyleAttributes"), 1);
|
|
34
34
|
var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
35
35
|
"color",
|
|
36
36
|
"backgroundColor",
|
|
@@ -44,6 +44,7 @@ var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
|
44
44
|
"borderBlockColor",
|
|
45
45
|
"borderBlockStartColor",
|
|
46
46
|
"borderBlockEndColor",
|
|
47
|
+
"outlineColor",
|
|
47
48
|
"shadowColor",
|
|
48
49
|
"textShadowColor",
|
|
49
50
|
"textDecorationColor",
|
|
@@ -53,22 +54,32 @@ var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
|
53
54
|
function processStyleColors(props) {
|
|
54
55
|
var out = null;
|
|
55
56
|
for (var key in props) {
|
|
57
|
+
var _ReactNativeStyleAttributes_key;
|
|
56
58
|
var value = props[key];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
var process = COLOR_PROPS.has(key) ? void 0 : (_ReactNativeStyleAttributes_key = import_ReactNativeStyleAttributes.default[key]) === null || _ReactNativeStyleAttributes_key === void 0 ? void 0 : _ReactNativeStyleAttributes_key.process;
|
|
60
|
+
if (process && value != null) {
|
|
61
|
+
value = process(value);
|
|
59
62
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
60
63
|
out[key] = value;
|
|
61
64
|
}
|
|
62
|
-
if (
|
|
65
|
+
if (key === "dropShadow" && value != null && typeof value === "object") {
|
|
66
|
+
var processed = processStyleColors(value);
|
|
67
|
+
if (processed !== value) {
|
|
68
|
+
out !== null && out !== void 0 ? out : out = { ...props };
|
|
69
|
+
out[key] = processed;
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if ((key === "boxShadow" || key === "filter" || key === "experimental_backgroundImage" || key === "colorStops") && Array.isArray(value)) {
|
|
63
74
|
var changed = false;
|
|
64
75
|
var next = [];
|
|
65
76
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
66
77
|
try {
|
|
67
78
|
for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
68
79
|
var entry = _step.value;
|
|
69
|
-
var
|
|
70
|
-
if (
|
|
71
|
-
next.push(
|
|
80
|
+
var processed1 = processStyleColors(entry);
|
|
81
|
+
if (processed1 !== entry) changed = true;
|
|
82
|
+
next.push(processed1);
|
|
72
83
|
}
|
|
73
84
|
} catch (err) {
|
|
74
85
|
_didIteratorError = true;
|
|
@@ -91,19 +102,19 @@ function processStyleColors(props) {
|
|
|
91
102
|
continue;
|
|
92
103
|
}
|
|
93
104
|
if (!COLOR_PROPS.has(key)) continue;
|
|
94
|
-
var
|
|
95
|
-
if (typeof
|
|
105
|
+
var processed2 = typeof value === "string" || typeof value === "object" && value !== null ? (0, import_react_native.processColor)(value) : value;
|
|
106
|
+
if (typeof processed2 === "number") {
|
|
96
107
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
97
108
|
out[key] = {
|
|
98
109
|
space: "srgb",
|
|
99
|
-
r: (
|
|
100
|
-
g: (
|
|
101
|
-
b: (
|
|
102
|
-
a: (
|
|
110
|
+
r: (processed2 >>> 16 & 255) / 255,
|
|
111
|
+
g: (processed2 >>> 8 & 255) / 255,
|
|
112
|
+
b: (processed2 & 255) / 255,
|
|
113
|
+
a: (processed2 >>> 24 & 255) / 255
|
|
103
114
|
};
|
|
104
|
-
} else if (
|
|
115
|
+
} else if (processed2 != null && typeof processed2 === "object") {
|
|
105
116
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
106
|
-
out[key] =
|
|
117
|
+
out[key] = processed2;
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
return out !== null && out !== void 0 ? out : props;
|
|
@@ -30,7 +30,7 @@ var processStyleColors_native_exports = {};
|
|
|
30
30
|
__export(processStyleColors_native_exports, { processStyleColors: () => processStyleColors });
|
|
31
31
|
module.exports = __toCommonJS(processStyleColors_native_exports);
|
|
32
32
|
var import_react_native = require("react-native");
|
|
33
|
-
var
|
|
33
|
+
var import_ReactNativeStyleAttributes = __toESM(require("react-native/Libraries/Components/View/ReactNativeStyleAttributes"), 1);
|
|
34
34
|
var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
35
35
|
"color",
|
|
36
36
|
"backgroundColor",
|
|
@@ -44,6 +44,7 @@ var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
|
44
44
|
"borderBlockColor",
|
|
45
45
|
"borderBlockStartColor",
|
|
46
46
|
"borderBlockEndColor",
|
|
47
|
+
"outlineColor",
|
|
47
48
|
"shadowColor",
|
|
48
49
|
"textShadowColor",
|
|
49
50
|
"textDecorationColor",
|
|
@@ -53,22 +54,32 @@ var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
|
53
54
|
function processStyleColors(props) {
|
|
54
55
|
var out = null;
|
|
55
56
|
for (var key in props) {
|
|
57
|
+
var _ReactNativeStyleAttributes_key;
|
|
56
58
|
var value = props[key];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
var process = COLOR_PROPS.has(key) ? void 0 : (_ReactNativeStyleAttributes_key = import_ReactNativeStyleAttributes.default[key]) === null || _ReactNativeStyleAttributes_key === void 0 ? void 0 : _ReactNativeStyleAttributes_key.process;
|
|
60
|
+
if (process && value != null) {
|
|
61
|
+
value = process(value);
|
|
59
62
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
60
63
|
out[key] = value;
|
|
61
64
|
}
|
|
62
|
-
if (
|
|
65
|
+
if (key === "dropShadow" && value != null && typeof value === "object") {
|
|
66
|
+
var processed = processStyleColors(value);
|
|
67
|
+
if (processed !== value) {
|
|
68
|
+
out !== null && out !== void 0 ? out : out = { ...props };
|
|
69
|
+
out[key] = processed;
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if ((key === "boxShadow" || key === "filter" || key === "experimental_backgroundImage" || key === "colorStops") && Array.isArray(value)) {
|
|
63
74
|
var changed = false;
|
|
64
75
|
var next = [];
|
|
65
76
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
66
77
|
try {
|
|
67
78
|
for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
68
79
|
var entry = _step.value;
|
|
69
|
-
var
|
|
70
|
-
if (
|
|
71
|
-
next.push(
|
|
80
|
+
var processed1 = processStyleColors(entry);
|
|
81
|
+
if (processed1 !== entry) changed = true;
|
|
82
|
+
next.push(processed1);
|
|
72
83
|
}
|
|
73
84
|
} catch (err) {
|
|
74
85
|
_didIteratorError = true;
|
|
@@ -91,19 +102,19 @@ function processStyleColors(props) {
|
|
|
91
102
|
continue;
|
|
92
103
|
}
|
|
93
104
|
if (!COLOR_PROPS.has(key)) continue;
|
|
94
|
-
var
|
|
95
|
-
if (typeof
|
|
105
|
+
var processed2 = typeof value === "string" || typeof value === "object" && value !== null ? (0, import_react_native.processColor)(value) : value;
|
|
106
|
+
if (typeof processed2 === "number") {
|
|
96
107
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
97
108
|
out[key] = {
|
|
98
109
|
space: "srgb",
|
|
99
|
-
r: (
|
|
100
|
-
g: (
|
|
101
|
-
b: (
|
|
102
|
-
a: (
|
|
110
|
+
r: (processed2 >>> 16 & 255) / 255,
|
|
111
|
+
g: (processed2 >>> 8 & 255) / 255,
|
|
112
|
+
b: (processed2 & 255) / 255,
|
|
113
|
+
a: (processed2 >>> 24 & 255) / 255
|
|
103
114
|
};
|
|
104
|
-
} else if (
|
|
115
|
+
} else if (processed2 != null && typeof processed2 === "object") {
|
|
105
116
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
106
|
-
out[key] =
|
|
117
|
+
out[key] = processed2;
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
return out !== null && out !== void 0 ? out : props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["cjs/processStyleColors.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar processStyleColors_native_exports = {};\n__export(processStyleColors_native_exports, {\n processStyleColors: () => processStyleColors\n});\nmodule.exports = __toCommonJS(processStyleColors_native_exports);\nvar import_react_native = require(\"react-native\");\nvar
|
|
1
|
+
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["cjs/processStyleColors.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar processStyleColors_native_exports = {};\n__export(processStyleColors_native_exports, {\n processStyleColors: () => processStyleColors\n});\nmodule.exports = __toCommonJS(processStyleColors_native_exports);\nvar import_react_native = require(\"react-native\");\nvar import_ReactNativeStyleAttributes = __toESM(require(\"react-native/Libraries/Components/View/ReactNativeStyleAttributes\"), 1);\nvar COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"outlineColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n var out = null;\n for (var key in props) {\n var _ReactNativeStyleAttributes_key;\n var value = props[key];\n var process = COLOR_PROPS.has(key) ? void 0 : (_ReactNativeStyleAttributes_key = import_ReactNativeStyleAttributes.default[key]) === null || _ReactNativeStyleAttributes_key === void 0 ? void 0 : _ReactNativeStyleAttributes_key.process;\n if (process && value != null) {\n value = process(value);\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = value;\n }\n if (key === \"dropShadow\" && value != null && typeof value === \"object\") {\n var processed = processStyleColors(value);\n if (processed !== value) {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = processed;\n }\n continue;\n }\n if ((key === \"boxShadow\" || key === \"filter\" || key === \"experimental_backgroundImage\" || key === \"colorStops\") && Array.isArray(value)) {\n var changed = false;\n var next = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var entry = _step.value;\n var processed1 = processStyleColors(entry);\n if (processed1 !== entry) changed = true;\n next.push(processed1);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (changed) {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = next;\n }\n continue;\n }\n if (!COLOR_PROPS.has(key)) continue;\n var processed2 = typeof value === \"string\" || typeof value === \"object\" && value !== null ? (0, import_react_native.processColor)(value) : value;\n if (typeof processed2 === \"number\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = {\n space: \"srgb\",\n r: (processed2 >>> 16 & 255) / 255,\n g: (processed2 >>> 8 & 255) / 255,\n b: (processed2 & 255) / 255,\n a: (processed2 >>> 24 & 255) / 255\n };\n } else if (processed2 != null && typeof processed2 === \"object\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = processed2;\n }\n }\n return out !== null && out !== void 0 ? out : props;\n}\n//# sourceMappingURL=processStyleColors.native.js.map\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { processColor } from "react-native";
|
|
2
|
-
import
|
|
2
|
+
import ReactNativeStyleAttributes from "react-native/Libraries/Components/View/ReactNativeStyleAttributes";
|
|
3
3
|
|
|
4
4
|
var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
5
5
|
"color",
|
|
@@ -14,6 +14,7 @@ var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
|
14
14
|
"borderBlockColor",
|
|
15
15
|
"borderBlockStartColor",
|
|
16
16
|
"borderBlockEndColor",
|
|
17
|
+
"outlineColor",
|
|
17
18
|
"shadowColor",
|
|
18
19
|
"textShadowColor",
|
|
19
20
|
"textDecorationColor",
|
|
@@ -23,22 +24,32 @@ var COLOR_PROPS = /* @__PURE__ */ new Set([
|
|
|
23
24
|
function processStyleColors(props) {
|
|
24
25
|
var out = null;
|
|
25
26
|
for (var key in props) {
|
|
27
|
+
var _ReactNativeStyleAttributes_key;
|
|
26
28
|
var value = props[key];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
var process = COLOR_PROPS.has(key) ? void 0 : (_ReactNativeStyleAttributes_key = ReactNativeStyleAttributes[key]) === null || _ReactNativeStyleAttributes_key === void 0 ? void 0 : _ReactNativeStyleAttributes_key.process;
|
|
30
|
+
if (process && value != null) {
|
|
31
|
+
value = process(value);
|
|
29
32
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
30
33
|
out[key] = value;
|
|
31
34
|
}
|
|
32
|
-
if (
|
|
35
|
+
if (key === "dropShadow" && value != null && typeof value === "object") {
|
|
36
|
+
var processed = processStyleColors(value);
|
|
37
|
+
if (processed !== value) {
|
|
38
|
+
out !== null && out !== void 0 ? out : out = { ...props };
|
|
39
|
+
out[key] = processed;
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if ((key === "boxShadow" || key === "filter" || key === "experimental_backgroundImage" || key === "colorStops") && Array.isArray(value)) {
|
|
33
44
|
var changed = false;
|
|
34
45
|
var next = [];
|
|
35
46
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
36
47
|
try {
|
|
37
48
|
for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
38
49
|
var entry = _step.value;
|
|
39
|
-
var
|
|
40
|
-
if (
|
|
41
|
-
next.push(
|
|
50
|
+
var processed1 = processStyleColors(entry);
|
|
51
|
+
if (processed1 !== entry) changed = true;
|
|
52
|
+
next.push(processed1);
|
|
42
53
|
}
|
|
43
54
|
} catch (err) {
|
|
44
55
|
_didIteratorError = true;
|
|
@@ -61,19 +72,19 @@ function processStyleColors(props) {
|
|
|
61
72
|
continue;
|
|
62
73
|
}
|
|
63
74
|
if (!COLOR_PROPS.has(key)) continue;
|
|
64
|
-
var
|
|
65
|
-
if (typeof
|
|
75
|
+
var processed2 = typeof value === "string" || typeof value === "object" && value !== null ? processColor(value) : value;
|
|
76
|
+
if (typeof processed2 === "number") {
|
|
66
77
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
67
78
|
out[key] = {
|
|
68
79
|
space: "srgb",
|
|
69
|
-
r: (
|
|
70
|
-
g: (
|
|
71
|
-
b: (
|
|
72
|
-
a: (
|
|
80
|
+
r: (processed2 >>> 16 & 255) / 255,
|
|
81
|
+
g: (processed2 >>> 8 & 255) / 255,
|
|
82
|
+
b: (processed2 & 255) / 255,
|
|
83
|
+
a: (processed2 >>> 24 & 255) / 255
|
|
73
84
|
};
|
|
74
|
-
} else if (
|
|
85
|
+
} else if (processed2 != null && typeof processed2 === "object") {
|
|
75
86
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
76
|
-
out[key] =
|
|
87
|
+
out[key] = processed2;
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
90
|
return out !== null && out !== void 0 ? out : props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["esm/processStyleColors.native.js"],"sourcesContent":["import { processColor } from \"react-native\";\nimport
|
|
1
|
+
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["esm/processStyleColors.native.js"],"sourcesContent":["import { processColor } from \"react-native\";\nimport ReactNativeStyleAttributes from \"react-native/Libraries/Components/View/ReactNativeStyleAttributes\";\nvar COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"outlineColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n var out = null;\n for (var key in props) {\n var _ReactNativeStyleAttributes_key;\n var value = props[key];\n var process = COLOR_PROPS.has(key) ? void 0 : (_ReactNativeStyleAttributes_key = ReactNativeStyleAttributes[key]) === null || _ReactNativeStyleAttributes_key === void 0 ? void 0 : _ReactNativeStyleAttributes_key.process;\n if (process && value != null) {\n value = process(value);\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = value;\n }\n if (key === \"dropShadow\" && value != null && typeof value === \"object\") {\n var processed = processStyleColors(value);\n if (processed !== value) {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = processed;\n }\n continue;\n }\n if ((key === \"boxShadow\" || key === \"filter\" || key === \"experimental_backgroundImage\" || key === \"colorStops\") && Array.isArray(value)) {\n var changed = false;\n var next = [];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var entry = _step.value;\n var processed1 = processStyleColors(entry);\n if (processed1 !== entry) changed = true;\n next.push(processed1);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (changed) {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = next;\n }\n continue;\n }\n if (!COLOR_PROPS.has(key)) continue;\n var processed2 = typeof value === \"string\" || typeof value === \"object\" && value !== null ? processColor(value) : value;\n if (typeof processed2 === \"number\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = {\n space: \"srgb\",\n r: (processed2 >>> 16 & 255) / 255,\n g: (processed2 >>> 8 & 255) / 255,\n b: (processed2 & 255) / 255,\n a: (processed2 >>> 24 & 255) / 255\n };\n } else if (processed2 != null && typeof processed2 === \"object\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n out[key] = processed2;\n }\n }\n return out !== null && out !== void 0 ? out : props;\n}\nexport {\n processStyleColors\n};\n//# sourceMappingURL=processStyleColors.native.js.map\n"],"mappings":";;;;AAEA,IAAI,8BAA8B,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,mBAAmB,OAAO;CACjC,IAAI,MAAM;CACV,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI;EACJ,IAAI,QAAQ,MAAM;EAClB,IAAI,UAAU,YAAY,IAAI,GAAG,IAAI,KAAK,KAAK,kCAAkC,2BAA2B,UAAU,QAAQ,oCAAoC,KAAK,IAAI,KAAK,IAAI,gCAAgC;EACpN,IAAI,WAAW,SAAS,MAAM;GAC5B,QAAQ,QAAQ,KAAK;GACrB,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;GACA,IAAI,OAAO;EACb;EACA,IAAI,QAAQ,gBAAgB,SAAS,QAAQ,OAAO,UAAU,UAAU;GACtE,IAAI,YAAY,mBAAmB,KAAK;GACxC,IAAI,cAAc,OAAO;IACvB,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;IACA,IAAI,OAAO;GACb;GACA;EACF;EACA,KAAK,QAAQ,eAAe,QAAQ,YAAY,QAAQ,kCAAkC,QAAQ,iBAAiB,MAAM,QAAQ,KAAK,GAAG;GACvI,IAAI,UAAU;GACd,IAAI,OAAO,CAAC;GACZ,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;GACvF,IAAI;IACF,KAAK,IAAI,YAAY,MAAM,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;KACtJ,IAAI,QAAQ,MAAM;KAClB,IAAI,aAAa,mBAAmB,KAAK;KACzC,IAAI,eAAe,OAAO,UAAU;KACpC,KAAK,KAAK,UAAU;IACtB;GACF,SAAS,KAAK;IACZ,oBAAoB;IACpB,iBAAiB;GACnB,UAAU;IACR,IAAI;KACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;MAC1D,UAAU,OAAO;KACnB;IACF,UAAU;KACR,IAAI,mBAAmB;MACrB,MAAM;KACR;IACF;GACF;GACA,IAAI,SAAS;IACX,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;IACA,IAAI,OAAO;GACb;GACA;EACF;EACA,IAAI,CAAC,YAAY,IAAI,GAAG,GAAG;EAC3B,IAAI,aAAa,OAAO,UAAU,YAAY,OAAO,UAAU,YAAY,UAAU,OAAO,aAAa,KAAK,IAAI;EAClH,IAAI,OAAO,eAAe,UAAU;GAClC,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;GACA,IAAI,OAAO;IACT,OAAO;IACP,IAAI,eAAe,KAAK,OAAO;IAC/B,IAAI,eAAe,IAAI,OAAO;IAC9B,IAAI,aAAa,OAAO;IACxB,IAAI,eAAe,KAAK,OAAO;GACjC;EACF,OAAO,IAAI,cAAc,QAAQ,OAAO,eAAe,UAAU;GAC/D,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;GACA,IAAI,OAAO;EACb;CACF;CACA,OAAO,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM;AAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/native-registry",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15",
|
|
4
4
|
"description": "Generic native style registry: zero-re-render style updates via Fabric ShadowTree commits",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@tamagui/build": "3.0.
|
|
49
|
+
"@tamagui/build": "3.0.15",
|
|
50
50
|
"react": "19.2.3",
|
|
51
51
|
"react-native": "0.87.1",
|
|
52
52
|
"react-native-nitro-modules": "0.37.1",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"releaseSourceCommit": "
|
|
80
|
+
"releaseSourceCommit": "181782eb92d59e1a0c5b235070f58003af6a1280"
|
|
81
81
|
}
|
|
@@ -19,14 +19,15 @@
|
|
|
19
19
|
* parser but not this one, and the throw kills the mount-item dispatch and
|
|
20
20
|
* tears the whole React surface down.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* Every other style first goes through React Native's own processor for its
|
|
23
|
+
* key, as React's style diff does for a rendered view: Fabric reads only the
|
|
24
|
+
* processed form, so a gradient keeps its angle and stops, and Android's view
|
|
25
|
+
* manager gets the array it casts `transformOrigin` to instead of throwing on
|
|
26
|
+
* the authored string. Some processors throw on their own output, so a value
|
|
27
|
+
* crosses this boundary once.
|
|
27
28
|
*/
|
|
28
29
|
import { processColor, type ColorValue } from 'react-native'
|
|
29
|
-
import
|
|
30
|
+
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes'
|
|
30
31
|
|
|
31
32
|
const COLOR_PROPS = new Set([
|
|
32
33
|
'color',
|
|
@@ -41,6 +42,7 @@ const COLOR_PROPS = new Set([
|
|
|
41
42
|
'borderBlockColor',
|
|
42
43
|
'borderBlockStartColor',
|
|
43
44
|
'borderBlockEndColor',
|
|
45
|
+
'outlineColor',
|
|
44
46
|
'shadowColor',
|
|
45
47
|
'textShadowColor',
|
|
46
48
|
'textDecorationColor',
|
|
@@ -54,13 +56,25 @@ export function processStyleColors(
|
|
|
54
56
|
let out: Record<string, unknown> | null = null
|
|
55
57
|
for (const key in props) {
|
|
56
58
|
let value = props[key]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const process = COLOR_PROPS.has(key)
|
|
60
|
+
? undefined
|
|
61
|
+
: ReactNativeStyleAttributes[key]?.process
|
|
62
|
+
if (process && value != null) {
|
|
63
|
+
value = process(value)
|
|
59
64
|
out ??= { ...props }
|
|
60
65
|
out[key] = value
|
|
61
66
|
}
|
|
67
|
+
if (key === 'dropShadow' && value != null && typeof value === 'object') {
|
|
68
|
+
const processed = processStyleColors(value as Record<string, unknown>)
|
|
69
|
+
if (processed !== value) {
|
|
70
|
+
out ??= { ...props }
|
|
71
|
+
out[key] = processed
|
|
72
|
+
}
|
|
73
|
+
continue
|
|
74
|
+
}
|
|
62
75
|
if (
|
|
63
76
|
(key === 'boxShadow' ||
|
|
77
|
+
key === 'filter' ||
|
|
64
78
|
key === 'experimental_backgroundImage' ||
|
|
65
79
|
key === 'colorStops') &&
|
|
66
80
|
Array.isArray(value)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// react-native ships its style attribute table untyped. a key with a processor
|
|
2
|
+
// maps to `{ process }`, which turns the authored value into fabric's form; the
|
|
3
|
+
// rest map to `true`, whose `process` reads as undefined
|
|
4
|
+
declare module 'react-native/Libraries/Components/View/ReactNativeStyleAttributes' {
|
|
5
|
+
const ReactNativeStyleAttributes: Record<
|
|
6
|
+
string,
|
|
7
|
+
{ process?: (value: unknown) => unknown } | undefined
|
|
8
|
+
>
|
|
9
|
+
export default ReactNativeStyleAttributes
|
|
10
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -53,6 +53,6 @@ export interface ViewStateSnapshot {
|
|
|
53
53
|
activeState: string
|
|
54
54
|
base: Record<string, unknown> | null
|
|
55
55
|
states: Record<string, Record<string, unknown>> | null
|
|
56
|
-
/** the family's
|
|
56
|
+
/** the family's nativeProps_DEPRECATED, which only RN's setNativeProps writes; null when unset */
|
|
57
57
|
nativeProps: Record<string, unknown> | null
|
|
58
58
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "
|
|
2
|
+
"mappings": "AAoDA,OAAO,iBAAS,mBACd,OAAO,0BACN",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/processStyleColors.native.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"/**\n * Fabric's C++ prop parser cannot take colors as CSS strings, so every color\n * prop must be converted before props reach the engine. The compiler mappings\n * and runtime-mode pushes both use this exact runtime processor before props\n * cross into the engine.\n *\n * Colors go over as `{ space: 'srgb', r, g, b, a }` with each channel a float\n * in 0..1. That shape is the only one both prop parsers a themed view can reach\n * will accept:\n *\n * - C++ `fromRawValueShared` reads it through its `space` branch. The packed\n * ARGB int `processColor` returns is misread here: an opaque grey\n * `0xFFE3E3E3` rendered as `rgb(254, 229, 229)`, taking `0xFF` as red and\n * the real red as alpha, so every themed surface came out tinted pink.\n * - Android additionally mounts some of these props through Java\n * `SurfaceMountingManager.updateProps` -> `ColorPropConverter`, which takes\n * a number or a map and throws `ColorValue: the value must be a number or\n * Object` on anything else. A plain `[r, g, b, a]` array satisfies the C++\n * parser but not this one, and the throw kills the mount-item dispatch and\n * tears the whole React surface down.\n *\n *
|
|
9
|
+
"/**\n * Fabric's C++ prop parser cannot take colors as CSS strings, so every color\n * prop must be converted before props reach the engine. The compiler mappings\n * and runtime-mode pushes both use this exact runtime processor before props\n * cross into the engine.\n *\n * Colors go over as `{ space: 'srgb', r, g, b, a }` with each channel a float\n * in 0..1. That shape is the only one both prop parsers a themed view can reach\n * will accept:\n *\n * - C++ `fromRawValueShared` reads it through its `space` branch. The packed\n * ARGB int `processColor` returns is misread here: an opaque grey\n * `0xFFE3E3E3` rendered as `rgb(254, 229, 229)`, taking `0xFF` as red and\n * the real red as alpha, so every themed surface came out tinted pink.\n * - Android additionally mounts some of these props through Java\n * `SurfaceMountingManager.updateProps` -> `ColorPropConverter`, which takes\n * a number or a map and throws `ColorValue: the value must be a number or\n * Object` on anything else. A plain `[r, g, b, a]` array satisfies the C++\n * parser but not this one, and the throw kills the mount-item dispatch and\n * tears the whole React surface down.\n *\n * Every other style first goes through React Native's own processor for its\n * key, as React's style diff does for a rendered view: Fabric reads only the\n * processed form, so a gradient keeps its angle and stops, and Android's view\n * manager gets the array it casts `transformOrigin` to instead of throwing on\n * the authored string. Some processors throw on their own output, so a value\n * crosses this boundary once.\n */\nimport { processColor, type ColorValue } from 'react-native'\nimport ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes'\n\nconst COLOR_PROPS = new Set([\n 'color',\n 'backgroundColor',\n 'borderColor',\n 'borderTopColor',\n 'borderBottomColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderEndColor',\n 'borderBlockColor',\n 'borderBlockStartColor',\n 'borderBlockEndColor',\n 'outlineColor',\n 'shadowColor',\n 'textShadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'overlayColor',\n])\n\nexport function processStyleColors(\n props: Record<string, unknown>\n): Record<string, unknown> {\n let out: Record<string, unknown> | null = null\n for (const key in props) {\n let value = props[key]\n const process = COLOR_PROPS.has(key)\n ? undefined\n : ReactNativeStyleAttributes[key]?.process\n if (process && value != null) {\n value = process(value)\n out ??= { ...props }\n out[key] = value\n }\n if (key === 'dropShadow' && value != null && typeof value === 'object') {\n const processed = processStyleColors(value as Record<string, unknown>)\n if (processed !== value) {\n out ??= { ...props }\n out[key] = processed\n }\n continue\n }\n if (\n (key === 'boxShadow' ||\n key === 'filter' ||\n key === 'experimental_backgroundImage' ||\n key === 'colorStops') &&\n Array.isArray(value)\n ) {\n let changed = false\n const next: Record<string, unknown>[] = []\n for (const entry of value) {\n const processed = processStyleColors(entry)\n if (processed !== entry) changed = true\n next.push(processed)\n }\n if (changed) {\n out ??= { ...props }\n out[key] = next\n }\n continue\n }\n if (!COLOR_PROPS.has(key)) continue\n // a style may already carry the packed int form RN accepts (`processColor`\n // output written straight into a style), and that form is misread the same\n // way, so it converts here too rather than only css strings\n const processed =\n typeof value === 'string' || (typeof value === 'object' && value !== null)\n ? processColor(value as ColorValue)\n : value\n if (typeof processed === 'number') {\n out ??= { ...props }\n // processColor packs ARGB, and is signed on Android, hence >>>\n out[key] = {\n space: 'srgb',\n r: ((processed >>> 16) & 0xff) / 255,\n g: ((processed >>> 8) & 0xff) / 255,\n b: (processed & 0xff) / 255,\n a: ((processed >>> 24) & 0xff) / 255,\n }\n } else if (processed != null && typeof processed === 'object') {\n // platform and dynamic colors resolve to opaque objects. processColor\n // normalizes their color branches before Fabric unpacks the shape.\n out ??= { ...props }\n out[key] = processed\n }\n }\n return out ?? props\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
package/types/types.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface ViewStateSnapshot {
|
|
|
48
48
|
activeState: string;
|
|
49
49
|
base: Record<string, unknown> | null;
|
|
50
50
|
states: Record<string, Record<string, unknown>> | null;
|
|
51
|
-
/** the family's
|
|
51
|
+
/** the family's nativeProps_DEPRECATED, which only RN's setNativeProps writes; null when unset */
|
|
52
52
|
nativeProps: Record<string, unknown> | null;
|
|
53
53
|
}
|
|
54
54
|
|
package/types/types.d.ts.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"/**\n * Slot props for one linked view.\n *\n * v1 implements two slot kinds: `base` (state-independent props, applied\n * under every state) and `state` (props keyed by state name, e.g. theme\n * name; the scope's active name selects which entry applies). Future kinds\n * (media, press, group, container) extend this shape; the engine merge\n * order is fixed: base, then state, then future kinds.\n *\n * Keys must be exhaustive for every state name the scope can take. The\n * engine does exact lookups only: no fallback chains, no name parsing. A\n * miss increments the engine's miss counter and is a bug in the emitter.\n */\nexport interface ViewSlots {\n base?: Record<string, unknown>\n state?: Record<string, Record<string, unknown>>\n}\n\nexport interface RegistryStats {\n viewCount: number\n commitCount: number\n missCount: number\n}\n\n/** Returned by link(); call to unlink. Safe to call more than once. */\nexport type Unlink = () => void\n\n/**\n * Handle for a linked view. `id` addresses the view in batched per-view\n * operations (applyViewStates); `unlink` removes it. null when the ref had\n * no shadow node (never mounted) or the engine is unavailable (web).\n */\nexport interface LinkHandle {\n id: number\n unlink: Unlink\n}\n\n/**\n * One entry of a batched per-view state update. When `props` is present it\n * is merged into the view's state table under `state` first (lazy warm-up\n * for runtime integrations); the view's active state then becomes `state`\n * and all entries commit natively in one transaction.\n */\nexport interface ViewStateUpdate {\n id: number\n state: string\n props?: Record<string, unknown>\n}\n\n/** Debug/test snapshot of a linked view's engine tables (getViewState). */\nexport interface ViewStateSnapshot {\n scopeId: string\n activeState: string\n base: Record<string, unknown> | null\n states: Record<string, Record<string, unknown>> | null\n /** the family's
|
|
9
|
+
"/**\n * Slot props for one linked view.\n *\n * v1 implements two slot kinds: `base` (state-independent props, applied\n * under every state) and `state` (props keyed by state name, e.g. theme\n * name; the scope's active name selects which entry applies). Future kinds\n * (media, press, group, container) extend this shape; the engine merge\n * order is fixed: base, then state, then future kinds.\n *\n * Keys must be exhaustive for every state name the scope can take. The\n * engine does exact lookups only: no fallback chains, no name parsing. A\n * miss increments the engine's miss counter and is a bug in the emitter.\n */\nexport interface ViewSlots {\n base?: Record<string, unknown>\n state?: Record<string, Record<string, unknown>>\n}\n\nexport interface RegistryStats {\n viewCount: number\n commitCount: number\n missCount: number\n}\n\n/** Returned by link(); call to unlink. Safe to call more than once. */\nexport type Unlink = () => void\n\n/**\n * Handle for a linked view. `id` addresses the view in batched per-view\n * operations (applyViewStates); `unlink` removes it. null when the ref had\n * no shadow node (never mounted) or the engine is unavailable (web).\n */\nexport interface LinkHandle {\n id: number\n unlink: Unlink\n}\n\n/**\n * One entry of a batched per-view state update. When `props` is present it\n * is merged into the view's state table under `state` first (lazy warm-up\n * for runtime integrations); the view's active state then becomes `state`\n * and all entries commit natively in one transaction.\n */\nexport interface ViewStateUpdate {\n id: number\n state: string\n props?: Record<string, unknown>\n}\n\n/** Debug/test snapshot of a linked view's engine tables (getViewState). */\nexport interface ViewStateSnapshot {\n scopeId: string\n activeState: string\n base: Record<string, unknown> | null\n states: Record<string, Record<string, unknown>> | null\n /** the family's nativeProps_DEPRECATED, which only RN's setNativeProps writes; null when unset */\n nativeProps: Record<string, unknown> | null\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// react-native ships this processor untyped; it returns the parsed gradient list
|
|
2
|
-
declare module 'react-native/Libraries/StyleSheet/processBackgroundImage' {
|
|
3
|
-
export default function processBackgroundImage(
|
|
4
|
-
backgroundImage: unknown
|
|
5
|
-
): ReadonlyArray<Record<string, unknown>>
|
|
6
|
-
}
|