@tamagui/web 3.0.0-beta.1451.1 → 3.0.0-beta.1459.1
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/cjs/_withNativeStyle.cjs +3 -0
- package/dist/cjs/_withNativeStyle.native.cjs +3 -0
- package/dist/cjs/_withNativeStyle.native.js +3 -0
- package/dist/cjs/_withNativeStyle.native.js.map +1 -1
- package/dist/esm/_withNativeStyle.mjs +4 -1
- package/dist/esm/_withNativeStyle.mjs.map +1 -1
- package/dist/esm/_withNativeStyle.native.js +4 -1
- package/dist/esm/_withNativeStyle.native.js.map +1 -1
- package/package.json +16 -16
- package/src/_withNativeStyle.tsx +6 -1
- package/types/_withNativeStyle.d.ts.map +1 -1
|
@@ -44,6 +44,7 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
|
|
|
44
44
|
const Native = import_react.default.memo(function NativeStyleView({ _scopeId, ...props }) {
|
|
45
45
|
const { ref, _expressions: _ignoredExpressions, ...rest } = props;
|
|
46
46
|
const link = (0, import_react.useRef)(null);
|
|
47
|
+
const [refused, setRefused] = (0, import_react.useState)(false);
|
|
47
48
|
const themeState = (0, import_useThemeState.getThemeState)(_scopeId);
|
|
48
49
|
const stateName = themeState?.name;
|
|
49
50
|
const theme = themeState?.theme;
|
|
@@ -53,6 +54,7 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
|
|
|
53
54
|
(0, import_compose_refs.setRef)(ref, host);
|
|
54
55
|
if (host && stateName && theme) {
|
|
55
56
|
link.current = (0, import_nativeStyleEngine.linkNativeStyleMapping)(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
|
|
57
|
+
if (!link.current) setRefused(true);
|
|
56
58
|
}
|
|
57
59
|
}, [
|
|
58
60
|
ref,
|
|
@@ -60,6 +62,7 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
|
|
|
60
62
|
stateName,
|
|
61
63
|
theme
|
|
62
64
|
]);
|
|
65
|
+
if (refused) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fallback, { ...props });
|
|
63
66
|
const stateStyle = stateName && theme ? (0, import_nativeStyleEngine.resolveNativeStyleMapping)(themeStyleKeys, stateName, theme) : void 0;
|
|
64
67
|
if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
|
|
65
68
|
throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
|
|
@@ -48,6 +48,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
48
48
|
var { _scopeId, ...props } = param;
|
|
49
49
|
var { ref, _expressions: _ignoredExpressions, ...rest } = props;
|
|
50
50
|
var link = (0, import_react.useRef)(null);
|
|
51
|
+
var [refused, setRefused] = (0, import_react.useState)(false);
|
|
51
52
|
var themeState = (0, import_useThemeState.getThemeState)(_scopeId);
|
|
52
53
|
var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;
|
|
53
54
|
var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;
|
|
@@ -58,6 +59,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
58
59
|
(0, import_compose_refs.setRef)(ref, host);
|
|
59
60
|
if (host && stateName && theme) {
|
|
60
61
|
link.current = (0, import_nativeStyleEngine.linkNativeStyleMapping)(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
|
|
62
|
+
if (!link.current) setRefused(true);
|
|
61
63
|
}
|
|
62
64
|
}, [
|
|
63
65
|
ref,
|
|
@@ -65,6 +67,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
65
67
|
stateName,
|
|
66
68
|
theme
|
|
67
69
|
]);
|
|
70
|
+
if (refused) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fallback, { ...props });
|
|
68
71
|
var stateStyle = stateName && theme ? (0, import_nativeStyleEngine.resolveNativeStyleMapping)(themeStyleKeys, stateName, theme) : void 0;
|
|
69
72
|
if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
|
|
70
73
|
throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
|
|
@@ -48,6 +48,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
48
48
|
var { _scopeId, ...props } = param;
|
|
49
49
|
var { ref, _expressions: _ignoredExpressions, ...rest } = props;
|
|
50
50
|
var link = (0, import_react.useRef)(null);
|
|
51
|
+
var [refused, setRefused] = (0, import_react.useState)(false);
|
|
51
52
|
var themeState = (0, import_useThemeState.getThemeState)(_scopeId);
|
|
52
53
|
var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;
|
|
53
54
|
var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;
|
|
@@ -58,6 +59,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
58
59
|
(0, import_compose_refs.setRef)(ref, host);
|
|
59
60
|
if (host && stateName && theme) {
|
|
60
61
|
link.current = (0, import_nativeStyleEngine.linkNativeStyleMapping)(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
|
|
62
|
+
if (!link.current) setRefused(true);
|
|
61
63
|
}
|
|
62
64
|
}, [
|
|
63
65
|
ref,
|
|
@@ -65,6 +67,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
65
67
|
stateName,
|
|
66
68
|
theme
|
|
67
69
|
]);
|
|
70
|
+
if (refused) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fallback, { ...props });
|
|
68
71
|
var stateStyle = stateName && theme ? (0, import_nativeStyleEngine.resolveNativeStyleMapping)(themeStyleKeys, stateName, theme) : void 0;
|
|
69
72
|
if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
|
|
70
73
|
throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_withNativeStyle.native.js","names":[],"sources":["cjs/_withNativeStyle.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 withNativeStyle_exports = {};\n__export(withNativeStyle_exports, {\n _withNativeStyle: () => _withNativeStyle\n});\nmodule.exports = __toCommonJS(withNativeStyle_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_withStableStyle = require(\"./_withStableStyle\");\nvar import_nativeStyleEngine = require(\"./helpers/nativeStyleEngine\");\nvar import_useThemeState = require(\"./hooks/useThemeState\");\nvar _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {\n var Fallback = (0, import_withStableStyle._withStableStyle)(Component, function(theme) {\n var themedStyle = {};\n for (var styleKey in themeStyleKeys) {\n var _theme_themeStyleKeys_styleKey;\n themedStyle[styleKey] = (_theme_themeStyleKeys_styleKey = theme[themeStyleKeys[styleKey]]) === null || _theme_themeStyleKeys_styleKey === void 0 ? void 0 : _theme_themeStyleKeys_styleKey.get();\n }\n return [\n baseStyle,\n themedStyle\n ];\n }, true, false);\n var Native = /* @__PURE__ */ import_react.default.memo(function NativeStyleView(param) {\n var { _scopeId, ...props } = param;\n var { ref, _expressions: _ignoredExpressions, ...rest } = props;\n var link = (0, import_react.useRef)(null);\n var themeState = (0, import_useThemeState.getThemeState)(_scopeId);\n var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;\n var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;\n var hostRef = (0, import_react.useCallback)(function(host) {\n var _link_current;\n (_link_current = link.current) === null || _link_current === void 0 ? void 0 : _link_current.unlink();\n link.current = null;\n (0, import_compose_refs.setRef)(ref, host);\n if (host && stateName && theme) {\n link.current = (0, import_nativeStyleEngine.linkNativeStyleMapping)(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);\n }\n }, [\n ref,\n _scopeId,\n stateName,\n theme\n ]);\n var stateStyle = stateName && theme ? (0, import_nativeStyleEngine.resolveNativeStyleMapping)(themeStyleKeys, stateName, theme) : void 0;\n if (process.env.NODE_ENV === \"development\" && (!stateName || !theme)) {\n throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {\n ref: hostRef,\n style: [\n baseStyle,\n stateStyle\n ],\n ...rest\n });\n });\n return /* @__PURE__ */ import_react.default.memo(function NativeStyleBoundary(props) {\n var scopeId = (0, import_react.useContext)(import_useThemeState.ThemeStateContext);\n return (0, import_nativeStyleEngine.getNativeStyleEngine)() && scopeId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Native, {\n ...props,\n _scopeId: scopeId\n }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fallback, {\n ...props\n });\n });\n};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.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 withNativeStyle_exports = {};\n__export(withNativeStyle_exports, {\n _withNativeStyle: () => _withNativeStyle\n});\nmodule.exports = __toCommonJS(withNativeStyle_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_withStableStyle = require(\"./_withStableStyle\");\nvar import_nativeStyleEngine = require(\"./helpers/nativeStyleEngine\");\nvar import_useThemeState = require(\"./hooks/useThemeState\");\nvar _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {\n var Fallback = (0, import_withStableStyle._withStableStyle)(Component, function(theme) {\n var themedStyle = {};\n for (var styleKey in themeStyleKeys) {\n var _theme_themeStyleKeys_styleKey;\n themedStyle[styleKey] = (_theme_themeStyleKeys_styleKey = theme[themeStyleKeys[styleKey]]) === null || _theme_themeStyleKeys_styleKey === void 0 ? void 0 : _theme_themeStyleKeys_styleKey.get();\n }\n return [\n baseStyle,\n themedStyle\n ];\n }, true, false);\n var Native = /* @__PURE__ */ import_react.default.memo(function NativeStyleView(param) {\n var { _scopeId, ...props } = param;\n var { ref, _expressions: _ignoredExpressions, ...rest } = props;\n var link = (0, import_react.useRef)(null);\n var [refused, setRefused] = (0, import_react.useState)(false);\n var themeState = (0, import_useThemeState.getThemeState)(_scopeId);\n var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;\n var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;\n var hostRef = (0, import_react.useCallback)(function(host) {\n var _link_current;\n (_link_current = link.current) === null || _link_current === void 0 ? void 0 : _link_current.unlink();\n link.current = null;\n (0, import_compose_refs.setRef)(ref, host);\n if (host && stateName && theme) {\n link.current = (0, import_nativeStyleEngine.linkNativeStyleMapping)(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);\n if (!link.current) setRefused(true);\n }\n }, [\n ref,\n _scopeId,\n stateName,\n theme\n ]);\n if (refused) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fallback, {\n ...props\n });\n var stateStyle = stateName && theme ? (0, import_nativeStyleEngine.resolveNativeStyleMapping)(themeStyleKeys, stateName, theme) : void 0;\n if (process.env.NODE_ENV === \"development\" && (!stateName || !theme)) {\n throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {\n ref: hostRef,\n style: [\n baseStyle,\n stateStyle\n ],\n ...rest\n });\n });\n return /* @__PURE__ */ import_react.default.memo(function NativeStyleBoundary(props) {\n var scopeId = (0, import_react.useContext)(import_useThemeState.ThemeStateContext);\n return (0, import_nativeStyleEngine.getNativeStyleEngine)() && scopeId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Native, {\n ...props,\n _scopeId: scopeId\n }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B,UAAU,WAAW,KAAK;IAC/H,IAAI,CAAC,KAAK,SAAS,WAAW,IAAI;GACpC;EACF,GAAG;GACD;GACA;GACA;GACA;EACF,CAAC;EACD,IAAI,SAAS,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,UAAU,EACxE,GAAG,MACL,CAAC;EACD,IAAI,aAAa,aAAa,SAAS,GAAG,yBAAyB,0BAAyB,CAAE,gBAAgB,WAAW,KAAK,IAAI,KAAK;EACvI,IAAI,QAAQ,IAAI,aAAa,kBAAkB,CAAC,aAAa,CAAC,QAAQ;GACpE,MAAM,IAAI,MAAM,yDAAyD,KAAK,UAAU,SAAS,GAAG;EACtG;EACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,WAAW;GAC5D,KAAK;GACL,OAAO,CACL,WACA,UACF;GACA,GAAG;EACL,CAAC;CACH,CAAC;CACD,OAAuB,6BAAa,QAAQ,KAAK,SAAS,oBAAoB,OAAO;EACnF,IAAI,WAAW,GAAG,aAAa,WAAU,CAAE,qBAAqB,iBAAiB;EACjF,QAAQ,GAAG,yBAAyB,qBAAoB,CAAE,KAAK,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,QAAQ;GAC3H,GAAG;GACH,UAAU;EACZ,CAAC,IAAoB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,UAAU,EACzD,GAAG,MACL,CAAC;CACH,CAAC;AACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setRef } from "@tamagui/compose-refs";
|
|
2
|
-
import React, { useCallback, useContext, useRef } from "react";
|
|
2
|
+
import React, { useCallback, useContext, useRef, useState } from "react";
|
|
3
3
|
import { _withStableStyle } from "./_withStableStyle.mjs";
|
|
4
4
|
import { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from "./helpers/nativeStyleEngine.mjs";
|
|
5
5
|
import { ThemeStateContext, getThemeState } from "./hooks/useThemeState.mjs";
|
|
@@ -16,6 +16,7 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
|
|
|
16
16
|
const Native = React.memo(function NativeStyleView({ _scopeId, ...props }) {
|
|
17
17
|
const { ref, _expressions: _ignoredExpressions, ...rest } = props;
|
|
18
18
|
const link = useRef(null);
|
|
19
|
+
const [refused, setRefused] = useState(false);
|
|
19
20
|
const themeState = getThemeState(_scopeId);
|
|
20
21
|
const stateName = themeState?.name;
|
|
21
22
|
const theme = themeState?.theme;
|
|
@@ -25,6 +26,7 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
|
|
|
25
26
|
setRef(ref, host);
|
|
26
27
|
if (host && stateName && theme) {
|
|
27
28
|
link.current = linkNativeStyleMapping(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
|
|
29
|
+
if (!link.current) setRefused(true);
|
|
28
30
|
}
|
|
29
31
|
}, [
|
|
30
32
|
ref,
|
|
@@ -32,6 +34,7 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
|
|
|
32
34
|
stateName,
|
|
33
35
|
theme
|
|
34
36
|
]);
|
|
37
|
+
if (refused) return /* @__PURE__ */ jsx(Fallback, { ...props });
|
|
35
38
|
const stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;
|
|
36
39
|
if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
|
|
37
40
|
throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_withNativeStyle.js","names":[],"sources":["esm/_withNativeStyle.js"],"sourcesContent":["import { setRef } from \"@tamagui/compose-refs\";\nimport React, { useCallback, useContext, useRef } from \"react\";\nimport { _withStableStyle } from \"./_withStableStyle\";\nimport {\n getNativeStyleEngine,\n linkNativeStyleMapping,\n resolveNativeStyleMapping\n} from \"./helpers/nativeStyleEngine\";\nimport { getThemeState, ThemeStateContext } from \"./hooks/useThemeState\";\nimport { jsx } from \"react/jsx-runtime\";\nconst _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {\n const Fallback = _withStableStyle(\n Component,\n (theme) => {\n const themedStyle = {};\n for (const styleKey in themeStyleKeys) {\n themedStyle[styleKey] = theme[themeStyleKeys[styleKey]]?.get();\n }\n return [baseStyle, themedStyle];\n },\n true,\n false\n );\n const Native = React.memo(function NativeStyleView({\n _scopeId,\n ...props\n }) {\n const { ref, _expressions: _ignoredExpressions, ...rest } = props;\n const link = useRef(null);\n const themeState = getThemeState(_scopeId);\n const stateName = themeState?.name;\n const theme = themeState?.theme;\n const hostRef = useCallback(\n (host) => {\n link.current?.unlink();\n link.current = null;\n setRef(ref, host);\n if (host && stateName && theme) {\n link.current = linkNativeStyleMapping(\n host,\n baseStyle,\n themeStyleKeys,\n _scopeId,\n stateName,\n theme\n );\n }\n },\n [ref, _scopeId, stateName, theme]\n );\n const stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;\n if (process.env.NODE_ENV === \"development\" && (!stateName || !theme)) {\n throw new Error(\n `[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`\n );\n }\n return /* @__PURE__ */ jsx(Component, { ref: hostRef, style: [baseStyle, stateStyle], ...rest });\n });\n return React.memo(function NativeStyleBoundary(props) {\n const scopeId = useContext(ThemeStateContext);\n return getNativeStyleEngine() && scopeId ? /* @__PURE__ */ jsx(Native, { ...props, _scopeId: scopeId }) : /* @__PURE__ */ jsx(Fallback, { ...props });\n });\n};\nexport {\n _withNativeStyle\n};\n//# sourceMappingURL=_withNativeStyle.js.map\n"],"mappings":";;;;;;;;AAUA,MAAM,oBAAoB,WAAW,WAAW,mBAAmB;CACjE,MAAM,WAAW,iBACf,YACC,UAAU;EACT,MAAM,cAAc,CAAC;EACrB,KAAK,MAAM,YAAY,gBAAgB;GACrC,YAAY,YAAY,MAAM,eAAe,UAAU,EAAE,IAAI;EAC/D;EACA,OAAO,CAAC,WAAW,WAAW;CAChC,GACA,MACA,KACF;CACA,MAAM,SAAS,MAAM,KAAK,SAAS,gBAAgB,EACjD,UACA,GAAG,SACF;EACD,MAAM,EAAE,KAAK,cAAc,qBAAqB,GAAG,SAAS;EAC5D,MAAM,OAAO,OAAO,IAAI;EACxB,MAAM,aAAa,cAAc,QAAQ;EACzC,MAAM,YAAY,YAAY;EAC9B,MAAM,QAAQ,YAAY;EAC1B,MAAM,UAAU,aACb,SAAS;GACR,KAAK,SAAS,OAAO;GACrB,KAAK,UAAU;GACf,OAAO,KAAK,IAAI;GAChB,IAAI,QAAQ,aAAa,OAAO;IAC9B,KAAK,UAAU,uBACb,MACA,WACA,gBACA,UACA,WACA,KACF;
|
|
1
|
+
{"version":3,"file":"_withNativeStyle.js","names":[],"sources":["esm/_withNativeStyle.js"],"sourcesContent":["import { setRef } from \"@tamagui/compose-refs\";\nimport React, { useCallback, useContext, useRef, useState } from \"react\";\nimport { _withStableStyle } from \"./_withStableStyle\";\nimport {\n getNativeStyleEngine,\n linkNativeStyleMapping,\n resolveNativeStyleMapping\n} from \"./helpers/nativeStyleEngine\";\nimport { getThemeState, ThemeStateContext } from \"./hooks/useThemeState\";\nimport { jsx } from \"react/jsx-runtime\";\nconst _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {\n const Fallback = _withStableStyle(\n Component,\n (theme) => {\n const themedStyle = {};\n for (const styleKey in themeStyleKeys) {\n themedStyle[styleKey] = theme[themeStyleKeys[styleKey]]?.get();\n }\n return [baseStyle, themedStyle];\n },\n true,\n false\n );\n const Native = React.memo(function NativeStyleView({\n _scopeId,\n ...props\n }) {\n const { ref, _expressions: _ignoredExpressions, ...rest } = props;\n const link = useRef(null);\n const [refused, setRefused] = useState(false);\n const themeState = getThemeState(_scopeId);\n const stateName = themeState?.name;\n const theme = themeState?.theme;\n const hostRef = useCallback(\n (host) => {\n link.current?.unlink();\n link.current = null;\n setRef(ref, host);\n if (host && stateName && theme) {\n link.current = linkNativeStyleMapping(\n host,\n baseStyle,\n themeStyleKeys,\n _scopeId,\n stateName,\n theme\n );\n if (!link.current) setRefused(true);\n }\n },\n [ref, _scopeId, stateName, theme]\n );\n if (refused) return /* @__PURE__ */ jsx(Fallback, { ...props });\n const stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;\n if (process.env.NODE_ENV === \"development\" && (!stateName || !theme)) {\n throw new Error(\n `[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`\n );\n }\n return /* @__PURE__ */ jsx(Component, { ref: hostRef, style: [baseStyle, stateStyle], ...rest });\n });\n return React.memo(function NativeStyleBoundary(props) {\n const scopeId = useContext(ThemeStateContext);\n return getNativeStyleEngine() && scopeId ? /* @__PURE__ */ jsx(Native, { ...props, _scopeId: scopeId }) : /* @__PURE__ */ jsx(Fallback, { ...props });\n });\n};\nexport {\n _withNativeStyle\n};\n//# sourceMappingURL=_withNativeStyle.js.map\n"],"mappings":";;;;;;;;AAUA,MAAM,oBAAoB,WAAW,WAAW,mBAAmB;CACjE,MAAM,WAAW,iBACf,YACC,UAAU;EACT,MAAM,cAAc,CAAC;EACrB,KAAK,MAAM,YAAY,gBAAgB;GACrC,YAAY,YAAY,MAAM,eAAe,UAAU,EAAE,IAAI;EAC/D;EACA,OAAO,CAAC,WAAW,WAAW;CAChC,GACA,MACA,KACF;CACA,MAAM,SAAS,MAAM,KAAK,SAAS,gBAAgB,EACjD,UACA,GAAG,SACF;EACD,MAAM,EAAE,KAAK,cAAc,qBAAqB,GAAG,SAAS;EAC5D,MAAM,OAAO,OAAO,IAAI;EACxB,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;EAC5C,MAAM,aAAa,cAAc,QAAQ;EACzC,MAAM,YAAY,YAAY;EAC9B,MAAM,QAAQ,YAAY;EAC1B,MAAM,UAAU,aACb,SAAS;GACR,KAAK,SAAS,OAAO;GACrB,KAAK,UAAU;GACf,OAAO,KAAK,IAAI;GAChB,IAAI,QAAQ,aAAa,OAAO;IAC9B,KAAK,UAAU,uBACb,MACA,WACA,gBACA,UACA,WACA,KACF;IACA,IAAI,CAAC,KAAK,SAAS,WAAW,IAAI;GACpC;EACF,GACA;GAAC;GAAK;GAAU;GAAW;EAAK,CAClC;EACA,IAAI,SAAS,OAAuB,oBAAI,UAAU,EAAE,GAAG,MAAM,CAAC;EAC9D,MAAM,aAAa,aAAa,QAAQ,0BAA0B,gBAAgB,WAAW,KAAK,IAAI,KAAK;EAC3G,IAAI,QAAQ,IAAI,aAAa,kBAAkB,CAAC,aAAa,CAAC,QAAQ;GACpE,MAAM,IAAI,MACR,yDAAyD,KAAK,UAAU,SAAS,GACnF;EACF;EACA,OAAuB,oBAAI,WAAW;GAAE,KAAK;GAAS,OAAO,CAAC,WAAW,UAAU;GAAG,GAAG;EAAK,CAAC;CACjG,CAAC;CACD,OAAO,MAAM,KAAK,SAAS,oBAAoB,OAAO;EACpD,MAAM,UAAU,WAAW,iBAAiB;EAC5C,OAAO,qBAAqB,KAAK,UAA0B,oBAAI,QAAQ;GAAE,GAAG;GAAO,UAAU;EAAQ,CAAC,IAAoB,oBAAI,UAAU,EAAE,GAAG,MAAM,CAAC;CACtJ,CAAC;AACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { setRef } from "@tamagui/compose-refs";
|
|
3
|
-
import React, { useCallback, useContext, useRef } from "react";
|
|
3
|
+
import React, { useCallback, useContext, useRef, useState } from "react";
|
|
4
4
|
import { _withStableStyle } from "./_withStableStyle.native.js";
|
|
5
5
|
import { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from "./helpers/nativeStyleEngine.native.js";
|
|
6
6
|
import { ThemeStateContext, getThemeState } from "./hooks/useThemeState.native.js";
|
|
@@ -18,6 +18,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
18
18
|
var { _scopeId, ...props } = param;
|
|
19
19
|
var { ref, _expressions: _ignoredExpressions, ...rest } = props;
|
|
20
20
|
var link = useRef(null);
|
|
21
|
+
var [refused, setRefused] = useState(false);
|
|
21
22
|
var themeState = getThemeState(_scopeId);
|
|
22
23
|
var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;
|
|
23
24
|
var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;
|
|
@@ -28,6 +29,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
28
29
|
setRef(ref, host);
|
|
29
30
|
if (host && stateName && theme) {
|
|
30
31
|
link.current = linkNativeStyleMapping(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
|
|
32
|
+
if (!link.current) setRefused(true);
|
|
31
33
|
}
|
|
32
34
|
}, [
|
|
33
35
|
ref,
|
|
@@ -35,6 +37,7 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
|
|
|
35
37
|
stateName,
|
|
36
38
|
theme
|
|
37
39
|
]);
|
|
40
|
+
if (refused) return /* @__PURE__ */ jsx(Fallback, { ...props });
|
|
38
41
|
var stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;
|
|
39
42
|
if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
|
|
40
43
|
throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_withNativeStyle.native.js","names":[],"sources":["esm/_withNativeStyle.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { setRef } from \"@tamagui/compose-refs\";\nimport React, { useCallback, useContext, useRef } from \"react\";\nimport { _withStableStyle } from \"./_withStableStyle\";\nimport { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from \"./helpers/nativeStyleEngine\";\nimport { getThemeState, ThemeStateContext } from \"./hooks/useThemeState\";\nvar _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {\n var Fallback = _withStableStyle(Component, function(theme) {\n var themedStyle = {};\n for (var styleKey in themeStyleKeys) {\n var _theme_themeStyleKeys_styleKey;\n themedStyle[styleKey] = (_theme_themeStyleKeys_styleKey = theme[themeStyleKeys[styleKey]]) === null || _theme_themeStyleKeys_styleKey === void 0 ? void 0 : _theme_themeStyleKeys_styleKey.get();\n }\n return [\n baseStyle,\n themedStyle\n ];\n }, true, false);\n var Native = /* @__PURE__ */ React.memo(function NativeStyleView(param) {\n var { _scopeId, ...props } = param;\n var { ref, _expressions: _ignoredExpressions, ...rest } = props;\n var link = useRef(null);\n var themeState = getThemeState(_scopeId);\n var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;\n var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;\n var hostRef = useCallback(function(host) {\n var _link_current;\n (_link_current = link.current) === null || _link_current === void 0 ? void 0 : _link_current.unlink();\n link.current = null;\n setRef(ref, host);\n if (host && stateName && theme) {\n link.current = linkNativeStyleMapping(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);\n }\n }, [\n ref,\n _scopeId,\n stateName,\n theme\n ]);\n var stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;\n if (process.env.NODE_ENV === \"development\" && (!stateName || !theme)) {\n throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);\n }\n return /* @__PURE__ */ _jsx(Component, {\n ref: hostRef,\n style: [\n baseStyle,\n stateStyle\n ],\n ...rest\n });\n });\n return /* @__PURE__ */ React.memo(function NativeStyleBoundary(props) {\n var scopeId = useContext(ThemeStateContext);\n return getNativeStyleEngine() && scopeId ? /* @__PURE__ */ _jsx(Native, {\n ...props,\n _scopeId: scopeId\n }) : /* @__PURE__ */ _jsx(Fallback, {\n ...props\n });\n });\n};\nexport {\n _withNativeStyle\n};\n//# sourceMappingURL=_withNativeStyle.js.map\n"],"mappings":";;;;;;;;AAMA,IAAI,mBAAmB,SAAS,WAAW,WAAW,gBAAgB;CACpE,IAAI,WAAW,iBAAiB,WAAW,SAAS,OAAO;EACzD,IAAI,cAAc,CAAC;EACnB,KAAK,IAAI,YAAY,gBAAgB;GACnC,IAAI;GACJ,YAAY,aAAa,iCAAiC,MAAM,eAAe,gBAAgB,QAAQ,mCAAmC,KAAK,IAAI,KAAK,IAAI,+BAA+B,IAAI;EACjM;EACA,OAAO,CACL,WACA,WACF;CACF,GAAG,MAAM,KAAK;CACd,IAAI,SAAyB,sBAAM,KAAK,SAAS,gBAAgB,OAAO;EACtE,IAAI,EAAE,UAAU,GAAG,UAAU;EAC7B,IAAI,EAAE,KAAK,cAAc,qBAAqB,GAAG,SAAS;EAC1D,IAAI,OAAO,OAAO,IAAI;EACtB,IAAI,aAAa,cAAc,QAAQ;EACvC,IAAI,YAAY,eAAe,QAAQ,eAAe,KAAK,IAAI,KAAK,IAAI,WAAW;EACnF,IAAI,QAAQ,eAAe,QAAQ,eAAe,KAAK,IAAI,KAAK,IAAI,WAAW;EAC/E,IAAI,UAAU,YAAY,SAAS,MAAM;GACvC,IAAI;GACJ,CAAC,gBAAgB,KAAK,aAAa,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,OAAO;GACpG,KAAK,UAAU;GACf,OAAO,KAAK,IAAI;GAChB,IAAI,QAAQ,aAAa,OAAO;IAC9B,KAAK,UAAU,uBAAuB,MAAM,WAAW,gBAAgB,UAAU,WAAW,KAAK;
|
|
1
|
+
{"version":3,"file":"_withNativeStyle.native.js","names":[],"sources":["esm/_withNativeStyle.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { setRef } from \"@tamagui/compose-refs\";\nimport React, { useCallback, useContext, useRef, useState } from \"react\";\nimport { _withStableStyle } from \"./_withStableStyle\";\nimport { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from \"./helpers/nativeStyleEngine\";\nimport { getThemeState, ThemeStateContext } from \"./hooks/useThemeState\";\nvar _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {\n var Fallback = _withStableStyle(Component, function(theme) {\n var themedStyle = {};\n for (var styleKey in themeStyleKeys) {\n var _theme_themeStyleKeys_styleKey;\n themedStyle[styleKey] = (_theme_themeStyleKeys_styleKey = theme[themeStyleKeys[styleKey]]) === null || _theme_themeStyleKeys_styleKey === void 0 ? void 0 : _theme_themeStyleKeys_styleKey.get();\n }\n return [\n baseStyle,\n themedStyle\n ];\n }, true, false);\n var Native = /* @__PURE__ */ React.memo(function NativeStyleView(param) {\n var { _scopeId, ...props } = param;\n var { ref, _expressions: _ignoredExpressions, ...rest } = props;\n var link = useRef(null);\n var [refused, setRefused] = useState(false);\n var themeState = getThemeState(_scopeId);\n var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;\n var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;\n var hostRef = useCallback(function(host) {\n var _link_current;\n (_link_current = link.current) === null || _link_current === void 0 ? void 0 : _link_current.unlink();\n link.current = null;\n setRef(ref, host);\n if (host && stateName && theme) {\n link.current = linkNativeStyleMapping(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);\n if (!link.current) setRefused(true);\n }\n }, [\n ref,\n _scopeId,\n stateName,\n theme\n ]);\n if (refused) return /* @__PURE__ */ _jsx(Fallback, {\n ...props\n });\n var stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;\n if (process.env.NODE_ENV === \"development\" && (!stateName || !theme)) {\n throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);\n }\n return /* @__PURE__ */ _jsx(Component, {\n ref: hostRef,\n style: [\n baseStyle,\n stateStyle\n ],\n ...rest\n });\n });\n return /* @__PURE__ */ React.memo(function NativeStyleBoundary(props) {\n var scopeId = useContext(ThemeStateContext);\n return getNativeStyleEngine() && scopeId ? /* @__PURE__ */ _jsx(Native, {\n ...props,\n _scopeId: scopeId\n }) : /* @__PURE__ */ _jsx(Fallback, {\n ...props\n });\n });\n};\nexport {\n _withNativeStyle\n};\n//# sourceMappingURL=_withNativeStyle.js.map\n"],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Aa,kBAAkB,CAAC,aAAa,CAAC,QAAQ;GACpE,MAAM,IAAI,MAAM,yDAAyD,KAAK,UAAU,SAAS,GAAG;EACtG;EACA,OAAuB,oBAAK,WAAW;GACrC,KAAK;GACL,OAAO,CACL,WACA,UACF;GACA,GAAG;EACL,CAAC;CACH,CAAC;CACD,OAAuB,sBAAM,KAAK,SAAS,oBAAoB,OAAO;EACpE,IAAI,UAAU,WAAW,iBAAiB;EAC1C,OAAO,qBAAqB,KAAK,UAA0B,oBAAK,QAAQ;GACtE,GAAG;GACH,UAAU;EACZ,CAAC,IAAoB,oBAAK,UAAU,EAClC,GAAG,MACL,CAAC;CACH,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1459.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nate Wienert"
|
|
@@ -100,23 +100,23 @@
|
|
|
100
100
|
"test:web": "vitest --typecheck --run"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tamagui/animation-helpers": "3.0.0-beta.
|
|
104
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
105
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
106
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
107
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
108
|
-
"@tamagui/is-equal-shallow": "3.0.0-beta.
|
|
109
|
-
"@tamagui/native": "3.0.0-beta.
|
|
110
|
-
"@tamagui/normalize-css-color": "3.0.0-beta.
|
|
111
|
-
"@tamagui/react-native-types": "3.0.0-beta.
|
|
112
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
113
|
-
"@tamagui/types": "3.0.0-beta.
|
|
114
|
-
"@tamagui/use-did-finish-ssr": "3.0.0-beta.
|
|
115
|
-
"@tamagui/use-event": "3.0.0-beta.
|
|
116
|
-
"@tamagui/use-force-update": "3.0.0-beta.
|
|
103
|
+
"@tamagui/animation-helpers": "3.0.0-beta.1459.1",
|
|
104
|
+
"@tamagui/compose-refs": "3.0.0-beta.1459.1",
|
|
105
|
+
"@tamagui/constants": "3.0.0-beta.1459.1",
|
|
106
|
+
"@tamagui/dom": "3.0.0-beta.1459.1",
|
|
107
|
+
"@tamagui/helpers": "3.0.0-beta.1459.1",
|
|
108
|
+
"@tamagui/is-equal-shallow": "3.0.0-beta.1459.1",
|
|
109
|
+
"@tamagui/native": "3.0.0-beta.1459.1",
|
|
110
|
+
"@tamagui/normalize-css-color": "3.0.0-beta.1459.1",
|
|
111
|
+
"@tamagui/react-native-types": "3.0.0-beta.1459.1",
|
|
112
|
+
"@tamagui/style-grammar": "3.0.0-beta.1459.1",
|
|
113
|
+
"@tamagui/types": "3.0.0-beta.1459.1",
|
|
114
|
+
"@tamagui/use-did-finish-ssr": "3.0.0-beta.1459.1",
|
|
115
|
+
"@tamagui/use-event": "3.0.0-beta.1459.1",
|
|
116
|
+
"@tamagui/use-force-update": "3.0.0-beta.1459.1"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
|
-
"@tamagui/build": "3.0.0-beta.
|
|
119
|
+
"@tamagui/build": "3.0.0-beta.1459.1",
|
|
120
120
|
"@testing-library/react": "^16.1.0",
|
|
121
121
|
"csstype": "^3.0.10",
|
|
122
122
|
"react": "19.2.3",
|
package/src/_withNativeStyle.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setRef } from '@tamagui/compose-refs'
|
|
2
|
-
import React, { useCallback, useContext, useRef } from 'react'
|
|
2
|
+
import React, { useCallback, useContext, useRef, useState } from 'react'
|
|
3
3
|
import { _withStableStyle } from './_withStableStyle'
|
|
4
4
|
import {
|
|
5
5
|
getNativeStyleEngine,
|
|
@@ -38,6 +38,9 @@ export const _withNativeStyle = (
|
|
|
38
38
|
}) {
|
|
39
39
|
const { ref, _expressions: _ignoredExpressions, ...rest } = props
|
|
40
40
|
const link = useRef<NativeStyleEngineLinkHandle | null>(null)
|
|
41
|
+
// a host the engine refuses (a nitro view) never gets theme pushes, so
|
|
42
|
+
// this view renders through the theme-subscribed fallback instead
|
|
43
|
+
const [refused, setRefused] = useState(false)
|
|
41
44
|
const themeState = getThemeState(_scopeId)
|
|
42
45
|
const stateName = themeState?.name
|
|
43
46
|
const theme = themeState?.theme
|
|
@@ -55,10 +58,12 @@ export const _withNativeStyle = (
|
|
|
55
58
|
stateName,
|
|
56
59
|
theme
|
|
57
60
|
)
|
|
61
|
+
if (!link.current) setRefused(true)
|
|
58
62
|
}
|
|
59
63
|
},
|
|
60
64
|
[ref, _scopeId, stateName, theme]
|
|
61
65
|
)
|
|
66
|
+
if (refused) return <Fallback {...props} />
|
|
62
67
|
const stateStyle =
|
|
63
68
|
stateName && theme
|
|
64
69
|
? resolveNativeStyleMapping(themeStyleKeys, stateName, theme)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_withNativeStyle.d.ts","sourceRoot":"","sources":["../src/_withNativeStyle.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"_withNativeStyle.d.ts","sourceRoot":"","sources":["../src/_withNativeStyle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAKL,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAA;AAGpC,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,cAChB,GAAG,aACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAClB,uBAAuB,uCAgEe,GAAG,uBAQ1D,CAAA"}
|