@tamagui/web 3.0.3 → 3.0.4

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.
Files changed (36) hide show
  1. package/dist/cjs/_withNativeStyle.cjs +85 -46
  2. package/dist/cjs/_withNativeStyle.native.cjs +91 -41
  3. package/dist/cjs/_withNativeStyle.native.js +91 -41
  4. package/dist/cjs/_withNativeStyle.native.js.map +1 -1
  5. package/dist/cjs/helpers/nativeStyleEngine.cjs +140 -69
  6. package/dist/cjs/helpers/nativeStyleEngine.native.cjs +177 -118
  7. package/dist/cjs/helpers/nativeStyleEngine.native.js +177 -118
  8. package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +1 -0
  10. package/dist/cjs/index.native.cjs +1 -0
  11. package/dist/cjs/index.native.js +1 -0
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/esm/_withNativeStyle.mjs +85 -40
  14. package/dist/esm/_withNativeStyle.mjs.map +1 -1
  15. package/dist/esm/_withNativeStyle.native.js +92 -42
  16. package/dist/esm/_withNativeStyle.native.js.map +1 -1
  17. package/dist/esm/helpers/nativeStyleEngine.mjs +141 -71
  18. package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
  19. package/dist/esm/helpers/nativeStyleEngine.native.js +177 -119
  20. package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
  21. package/dist/esm/index.js +2 -2
  22. package/dist/esm/index.mjs +2 -2
  23. package/dist/esm/index.native.js +2 -2
  24. package/package.json +17 -17
  25. package/src/_withNativeStyle.tsx +141 -55
  26. package/src/helpers/nativeStyleEngine.ts +230 -101
  27. package/src/index.ts +1 -0
  28. package/src/setupHooks.ts +1 -0
  29. package/types/_withNativeStyle.d.ts +22 -2
  30. package/types/_withNativeStyle.d.ts.map +1 -1
  31. package/types/helpers/nativeStyleEngine.d.ts +24 -9
  32. package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
  33. package/types/index.d.ts +1 -1
  34. package/types/index.d.ts.map +1 -1
  35. package/types/setupHooks.d.ts +1 -0
  36. package/types/setupHooks.d.ts.map +1 -1
@@ -1,11 +1,18 @@
1
1
  import { setRef } from "@tamagui/compose-refs";
2
- import React, { useCallback, useContext, useRef, useState } from "react";
2
+ import { isAndroid, isIos } from "@tamagui/constants";
3
+ import { use } from "react";
3
4
  import { _withStableStyle } from "./_withStableStyle.mjs";
4
5
  import { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from "./helpers/nativeStyleEngine.mjs";
5
6
  import { ThemeStateContext, getThemeState } from "./hooks/useThemeState.mjs";
7
+ import { hooks } from "./setupHooks.mjs";
6
8
  import { jsx } from "react/jsx-runtime";
7
9
 
8
- const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
10
+ const hostTextProps = {
11
+ accessible: isAndroid ? false : isIos ? true : void 0,
12
+ allowFontScaling: true,
13
+ ellipsizeMode: "tail"
14
+ };
15
+ const _withNativeStyle = (Component, baseStyle, themeStyleKeys, host) => {
9
16
  const Fallback = _withStableStyle(Component, (theme) => {
10
17
  const themedStyle = {};
11
18
  for (const styleKey in themeStyleKeys) {
@@ -13,46 +20,84 @@ const _withNativeStyle = (Component, baseStyle, themeStyleKeys) => {
13
20
  }
14
21
  return [baseStyle, themedStyle];
15
22
  }, true, false);
16
- const Native = React.memo(function NativeStyleView({ _scopeId, ...props }) {
17
- const { ref, _expressions: _ignoredExpressions, ...rest } = props;
18
- const link = useRef(null);
19
- const [refused, setRefused] = useState(false);
20
- const themeState = getThemeState(_scopeId);
21
- const stateName = themeState?.name;
22
- const theme = themeState?.theme;
23
- const hostRef = useCallback((host) => {
24
- link.current?.unlink();
25
- link.current = null;
26
- setRef(ref, host);
27
- if (host && stateName && theme) {
28
- link.current = linkNativeStyleMapping(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
29
- if (!link.current) setRefused(true);
30
- }
31
- }, [
32
- ref,
33
- _scopeId,
34
- stateName,
35
- theme
36
- ]);
37
- if (refused) return /* @__PURE__ */ jsx(Fallback, { ...props });
38
- const stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;
39
- if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
40
- throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
23
+ const baseViews = host ? hooks.getBaseViews?.() : void 0;
24
+ const TextAncestor = baseViews?.TextAncestor;
25
+ const TextAncestorProvider = TextAncestor?.Provider;
26
+ const HostText = host === "text" && !("userSelect" in baseStyle) && !("verticalAlign" in baseStyle) ? baseViews?.NativeText : void 0;
27
+ const hostTextBase = HostText ? {
28
+ overflow: "hidden",
29
+ ...baseStyle,
30
+ ...typeof baseStyle.fontWeight === "number" && { fontWeight: String(baseStyle.fontWeight) }
31
+ } : baseStyle;
32
+ const styles = /* @__PURE__ */ new Map();
33
+ const hostTextStyles = /* @__PURE__ */ new Map();
34
+ const ScopeContext = ThemeStateContext;
35
+ const engineOf = getNativeStyleEngine;
36
+ const scopeState = getThemeState;
37
+ const resolve = resolveNativeStyleMapping;
38
+ const linkMapping = linkNativeStyleMapping;
39
+ const assignRef = setRef;
40
+ const render = (props, key) => {
41
+ const scopeId = use(ScopeContext);
42
+ const inText = TextAncestor ? use(TextAncestor) : false;
43
+ const themeState = scopeId && engineOf() ? scopeState(scopeId) : void 0;
44
+ const resetsText = inText && host === "view";
45
+ if (!themeState) {
46
+ return resetsText ? /* @__PURE__ */ jsx(TextAncestorProvider, {
47
+ value: false,
48
+ children: /* @__PURE__ */ jsx(Fallback, { ...props })
49
+ }, key) : /* @__PURE__ */ jsx(Fallback, { ...props }, key);
50
+ }
51
+ let rest = props;
52
+ if (props._expressions !== void 0) {
53
+ const { _expressions: _ignoredExpressions, ...withoutExpressions } = props;
54
+ rest = withoutExpressions;
55
+ }
56
+ const ref = props.ref;
57
+ const { name, theme } = themeState;
58
+ const asHostText = HostText && !inText;
59
+ const Rendered = asHostText ? HostText : Component;
60
+ const cache = asHostText ? hostTextStyles : styles;
61
+ let style = cache.get(scopeId);
62
+ if (!style) {
63
+ style = [asHostText ? hostTextBase : baseStyle, null];
64
+ cache.set(scopeId, style);
41
65
  }
42
- return /* @__PURE__ */ jsx(Component, {
43
- ref: hostRef,
44
- style: [baseStyle, stateStyle],
45
- ...rest
46
- });
47
- });
48
- return React.memo(function NativeStyleBoundary(props) {
49
- const scopeId = useContext(ThemeStateContext);
50
- return getNativeStyleEngine() && scopeId ? /* @__PURE__ */ jsx(Native, {
51
- ...props,
52
- _scopeId: scopeId
53
- }) : /* @__PURE__ */ jsx(Fallback, { ...props });
54
- });
66
+ style[1] = resolve(themeStyleKeys, name, theme);
67
+ const wrapped = resetsText || asHostText && mayRenderText(rest.children);
68
+ const element = /* @__PURE__ */ jsx(Rendered, {
69
+ ...asHostText && hostTextProps,
70
+ ...rest,
71
+ ref: (node) => {
72
+ let refCleanup;
73
+ if (typeof ref === "function") refCleanup = ref(node);
74
+ else assignRef(ref, node);
75
+ const link = linkMapping(node, themeStyleKeys, scopeId, name, theme);
76
+ return () => {
77
+ link?.unlink();
78
+ if (typeof refCleanup === "function") refCleanup();
79
+ else assignRef(ref, null);
80
+ };
81
+ },
82
+ style
83
+ }, wrapped ? void 0 : key);
84
+ if (!wrapped) return element;
85
+ return /* @__PURE__ */ jsx(TextAncestorProvider, {
86
+ value: !resetsText,
87
+ children: element
88
+ }, key);
89
+ };
90
+ const NativeStyleView = (props) => render(props);
91
+ NativeStyleView.inline = (element) => render(element.props, element.key);
92
+ return NativeStyleView;
55
93
  };
94
+ function mayRenderText(children) {
95
+ if (children == null) return false;
96
+ if (Array.isArray(children) && children.length <= 3) {
97
+ return children.some((child) => child != null && typeof child === "object");
98
+ }
99
+ return typeof children === "object";
100
+ }
56
101
 
57
102
  export { _withNativeStyle };
58
103
  //# sourceMappingURL=_withNativeStyle.mjs.map
@@ -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, 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 }) :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AK,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
+ {"version":3,"file":"_withNativeStyle.js","names":[],"sources":["esm/_withNativeStyle.js"],"sourcesContent":["import { setRef } from \"@tamagui/compose-refs\";\nimport { isAndroid, isIos } from \"@tamagui/constants\";\nimport { use } from \"react\";\nimport { _withStableStyle } from \"./_withStableStyle\";\nimport {\n getNativeStyleEngine,\n linkNativeStyleMapping,\n resolveNativeStyleMapping\n} from \"./helpers/nativeStyleEngine\";\nimport { getThemeState, ThemeStateContext } from \"./hooks/useThemeState\";\nimport { hooks } from \"./setupHooks\";\nimport { jsx } from \"react/jsx-runtime\";\nconst hostTextProps = {\n accessible: isAndroid ? false : isIos ? true : void 0,\n allowFontScaling: true,\n ellipsizeMode: \"tail\"\n};\nconst _withNativeStyle = (Component, baseStyle, themeStyleKeys, host) => {\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 baseViews = host ? hooks.getBaseViews?.() : void 0;\n const TextAncestor = baseViews?.TextAncestor;\n const TextAncestorProvider = TextAncestor?.Provider;\n const HostText = host === \"text\" && !(\"userSelect\" in baseStyle) && !(\"verticalAlign\" in baseStyle) ? baseViews?.NativeText : void 0;\n const hostTextBase = HostText ? {\n overflow: \"hidden\",\n ...baseStyle,\n ...typeof baseStyle.fontWeight === \"number\" && {\n fontWeight: String(baseStyle.fontWeight)\n }\n } : baseStyle;\n const styles = /* @__PURE__ */ new Map();\n const hostTextStyles = /* @__PURE__ */ new Map();\n const ScopeContext = ThemeStateContext;\n const engineOf = getNativeStyleEngine;\n const scopeState = getThemeState;\n const resolve = resolveNativeStyleMapping;\n const linkMapping = linkNativeStyleMapping;\n const assignRef = setRef;\n const render = (props, key) => {\n const scopeId = use(ScopeContext);\n const inText = TextAncestor ? use(TextAncestor) : false;\n const themeState = scopeId && engineOf() ? scopeState(scopeId) : void 0;\n const resetsText = inText && host === \"view\";\n if (!themeState) {\n return resetsText ? /* @__PURE__ */ jsx(TextAncestorProvider, { value: false, children: /* @__PURE__ */ jsx(Fallback, { ...props }) }, key) : /* @__PURE__ */ jsx(Fallback, { ...props }, key);\n }\n let rest = props;\n if (props._expressions !== void 0) {\n const { _expressions: _ignoredExpressions, ...withoutExpressions } = props;\n rest = withoutExpressions;\n }\n const ref = props.ref;\n const { name, theme } = themeState;\n const asHostText = HostText && !inText;\n const Rendered = asHostText ? HostText : Component;\n const cache = asHostText ? hostTextStyles : styles;\n let style = cache.get(scopeId);\n if (!style) {\n style = [asHostText ? hostTextBase : baseStyle, null];\n cache.set(scopeId, style);\n }\n style[1] = resolve(themeStyleKeys, name, theme);\n const wrapped = resetsText || asHostText && mayRenderText(rest.children);\n const element = /* @__PURE__ */ jsx(\n Rendered,\n {\n ...asHostText && hostTextProps,\n ...rest,\n ref: (node) => {\n let refCleanup;\n if (typeof ref === \"function\") refCleanup = ref(node);\n else assignRef(ref, node);\n const link = linkMapping(node, themeStyleKeys, scopeId, name, theme);\n return () => {\n link?.unlink();\n if (typeof refCleanup === \"function\") refCleanup();\n else assignRef(ref, null);\n };\n },\n style\n },\n wrapped ? void 0 : key\n );\n if (!wrapped) return element;\n return /* @__PURE__ */ jsx(TextAncestorProvider, { value: !resetsText, children: element }, key);\n };\n const NativeStyleView = (props) => render(props);\n NativeStyleView.inline = (element) => render(element.props, element.key);\n return NativeStyleView;\n};\nfunction mayRenderText(children) {\n if (children == null) return false;\n if (Array.isArray(children) && children.length <= 3) {\n return children.some((child) => child != null && typeof child === \"object\");\n }\n return typeof children === \"object\";\n}\nexport {\n _withNativeStyle\n};\n//# sourceMappingURL=_withNativeStyle.js.map\n"],"mappings":";;;;;;;;;;AAYA,MAAM,gBAAgB;CACpB,YAAY,YAAY,QAAQ,QAAQ,OAAO,KAAK;CACpD,kBAAkB;CAClB,eAAe;AACjB;AACA,MAAM,oBAAoB,WAAW,WAAW,gBAAgB,SAAS;CACvE,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,YAAY,OAAO,MAAM,eAAe,IAAI,KAAK;CACvD,MAAM,eAAe,WAAW;CAChC,MAAM,uBAAuB,cAAc;CAC3C,MAAM,WAAW,SAAS,UAAU,EAAE,gBAAgB,cAAc,EAAE,mBAAmB,aAAa,WAAW,aAAa,KAAK;CACnI,MAAM,eAAe,WAAW;EAC9B,UAAU;EACV,GAAG;EACH,GAAG,OAAO,UAAU,eAAe,YAAY,EAC7C,YAAY,OAAO,UAAU,UAAU,EACzC;CACF,IAAI;CACJ,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,iCAAiC,IAAI,IAAI;CAC/C,MAAM,eAAe;CACrB,MAAM,WAAW;CACjB,MAAM,aAAa;CACnB,MAAM,UAAU;CAChB,MAAM,cAAc;CACpB,MAAM,YAAY;CAClB,MAAM,UAAU,OAAO,QAAQ;EAC7B,MAAM,UAAU,IAAI,YAAY;EAChC,MAAM,SAAS,eAAe,IAAI,YAAY,IAAI;EAClD,MAAM,aAAa,WAAW,SAAS,IAAI,WAAW,OAAO,IAAI,KAAK;EACtE,MAAM,aAAa,UAAU,SAAS;EACtC,IAAI,CAAC,YAAY;GACf,OAAO,aAA6B,oBAAI,sBAAsB;IAAE,OAAO;IAAO,UAA0B,oBAAI,UAAU,EAAE,GAAG,M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AC7B,IAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS,UAAU,GAAG;EACnD,OAAO,SAAS,MAAM,UAAU,SAAS,QAAQ,OAAO,UAAU,QAAQ;CAC5E;CACA,OAAO,OAAO,aAAa;AAC7B"}
@@ -1,11 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { setRef } from "@tamagui/compose-refs";
3
- import React, { useCallback, useContext, useRef, useState } from "react";
3
+ import { isAndroid, isIos } from "@tamagui/constants";
4
+ import { use } from "react";
4
5
  import { _withStableStyle } from "./_withStableStyle.native.js";
5
6
  import { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from "./helpers/nativeStyleEngine.native.js";
6
7
  import { ThemeStateContext, getThemeState } from "./hooks/useThemeState.native.js";
8
+ import { hooks } from "./setupHooks.native.js";
7
9
 
8
- var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
10
+ var hostTextProps = {
11
+ accessible: isAndroid ? false : isIos ? true : void 0,
12
+ allowFontScaling: true,
13
+ ellipsizeMode: "tail"
14
+ };
15
+ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys, host) {
16
+ var _hooks_getBaseViews;
9
17
  var Fallback = _withStableStyle(Component, function(theme) {
10
18
  var themedStyle = {};
11
19
  for (var styleKey in themeStyleKeys) {
@@ -14,48 +22,90 @@ var _withNativeStyle = function(Component, baseStyle, themeStyleKeys) {
14
22
  }
15
23
  return [baseStyle, themedStyle];
16
24
  }, true, false);
17
- var Native = /* @__PURE__ */ React.memo(function NativeStyleView(param) {
18
- var { _scopeId, ...props } = param;
19
- var { ref, _expressions: _ignoredExpressions, ...rest } = props;
20
- var link = useRef(null);
21
- var [refused, setRefused] = useState(false);
22
- var themeState = getThemeState(_scopeId);
23
- var stateName = themeState === null || themeState === void 0 ? void 0 : themeState.name;
24
- var theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme;
25
- var hostRef = useCallback(function(host) {
26
- var _link_current;
27
- (_link_current = link.current) === null || _link_current === void 0 ? void 0 : _link_current.unlink();
28
- link.current = null;
29
- setRef(ref, host);
30
- if (host && stateName && theme) {
31
- link.current = linkNativeStyleMapping(host, baseStyle, themeStyleKeys, _scopeId, stateName, theme);
32
- if (!link.current) setRefused(true);
33
- }
34
- }, [
35
- ref,
36
- _scopeId,
37
- stateName,
38
- theme
39
- ]);
40
- if (refused) return /* @__PURE__ */ jsx(Fallback, { ...props });
41
- var stateStyle = stateName && theme ? resolveNativeStyleMapping(themeStyleKeys, stateName, theme) : void 0;
42
- if (process.env.NODE_ENV === "development" && (!stateName || !theme)) {
43
- throw new Error(`[@tamagui/core] native fast path cannot resolve theme ${JSON.stringify(stateName)}`);
25
+ var baseViews = host ? (_hooks_getBaseViews = hooks.getBaseViews) === null || _hooks_getBaseViews === void 0 ? void 0 : _hooks_getBaseViews.call(hooks) : void 0;
26
+ var TextAncestor = baseViews === null || baseViews === void 0 ? void 0 : baseViews.TextAncestor;
27
+ var TextAncestorProvider = TextAncestor === null || TextAncestor === void 0 ? void 0 : TextAncestor.Provider;
28
+ var HostText = host === "text" && !("userSelect" in baseStyle) && !("verticalAlign" in baseStyle) ? baseViews === null || baseViews === void 0 ? void 0 : baseViews.NativeText : void 0;
29
+ var hostTextBase = HostText ? {
30
+ overflow: "hidden",
31
+ ...baseStyle,
32
+ ...typeof baseStyle.fontWeight === "number" && { fontWeight: String(baseStyle.fontWeight) }
33
+ } : baseStyle;
34
+ var styles = /* @__PURE__ */ new Map();
35
+ var hostTextStyles = /* @__PURE__ */ new Map();
36
+ var ScopeContext = ThemeStateContext;
37
+ var engineOf = getNativeStyleEngine;
38
+ var scopeState = getThemeState;
39
+ var resolve = resolveNativeStyleMapping;
40
+ var linkMapping = linkNativeStyleMapping;
41
+ var assignRef = setRef;
42
+ var render = function(props, key) {
43
+ var scopeId = use(ScopeContext);
44
+ var inText = TextAncestor ? use(TextAncestor) : false;
45
+ var themeState = scopeId && engineOf() ? scopeState(scopeId) : void 0;
46
+ var resetsText = inText && host === "view";
47
+ if (!themeState) {
48
+ return resetsText ? /* @__PURE__ */ jsx(TextAncestorProvider, {
49
+ value: false,
50
+ children: /* @__PURE__ */ jsx(Fallback, { ...props })
51
+ }, key) : /* @__PURE__ */ jsx(Fallback, { ...props }, key);
44
52
  }
45
- return /* @__PURE__ */ jsx(Component, {
46
- ref: hostRef,
47
- style: [baseStyle, stateStyle],
48
- ...rest
49
- });
50
- });
51
- return /* @__PURE__ */ React.memo(function NativeStyleBoundary(props) {
52
- var scopeId = useContext(ThemeStateContext);
53
- return getNativeStyleEngine() && scopeId ? /* @__PURE__ */ jsx(Native, {
54
- ...props,
55
- _scopeId: scopeId
56
- }) : /* @__PURE__ */ jsx(Fallback, { ...props });
57
- });
53
+ var rest = props;
54
+ if (props._expressions !== void 0) {
55
+ var { _expressions: _ignoredExpressions, ...withoutExpressions } = props;
56
+ rest = withoutExpressions;
57
+ }
58
+ var ref = props.ref;
59
+ var { name, theme } = themeState;
60
+ var asHostText = HostText && !inText;
61
+ var Rendered = asHostText ? HostText : Component;
62
+ var cache = asHostText ? hostTextStyles : styles;
63
+ var style = cache.get(scopeId);
64
+ if (!style) {
65
+ style = [asHostText ? hostTextBase : baseStyle, null];
66
+ cache.set(scopeId, style);
67
+ }
68
+ style[1] = resolve(themeStyleKeys, name, theme);
69
+ var wrapped = resetsText || asHostText && mayRenderText(rest.children);
70
+ var element = /* @__PURE__ */ jsx(Rendered, {
71
+ ...asHostText && hostTextProps,
72
+ ...rest,
73
+ ref: function(node) {
74
+ var refCleanup;
75
+ if (typeof ref === "function") refCleanup = ref(node);
76
+ else assignRef(ref, node);
77
+ var link = linkMapping(node, themeStyleKeys, scopeId, name, theme);
78
+ return function() {
79
+ link === null || link === void 0 ? void 0 : link.unlink();
80
+ if (typeof refCleanup === "function") refCleanup();
81
+ else assignRef(ref, null);
82
+ };
83
+ },
84
+ style
85
+ }, wrapped ? void 0 : key);
86
+ if (!wrapped) return element;
87
+ return /* @__PURE__ */ jsx(TextAncestorProvider, {
88
+ value: !resetsText,
89
+ children: element
90
+ }, key);
91
+ };
92
+ var NativeStyleView = function(props) {
93
+ return render(props);
94
+ };
95
+ NativeStyleView.inline = function(element) {
96
+ return render(element.props, element.key);
97
+ };
98
+ return NativeStyleView;
58
99
  };
100
+ function mayRenderText(children) {
101
+ if (children == null) return false;
102
+ if (Array.isArray(children) && children.length <= 3) {
103
+ return children.some(function(child) {
104
+ return child != null && typeof child === "object";
105
+ });
106
+ }
107
+ return typeof children === "object";
108
+ }
59
109
 
60
110
  export { _withNativeStyle };
61
111
  //# sourceMappingURL=_withNativeStyle.native.js.map
@@ -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, 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"],"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,cAA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.js","names":[],"sources":["esm/_withNativeStyle.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { setRef } from \"@tamagui/compose-refs\";\nimport { isAndroid, isIos } from \"@tamagui/constants\";\nimport React, { use } from \"react\";\nimport { _withStableStyle } from \"./_withStableStyle\";\nimport { getNativeStyleEngine, linkNativeStyleMapping, resolveNativeStyleMapping } from \"./helpers/nativeStyleEngine\";\nimport { getThemeState, ThemeStateContext } from \"./hooks/useThemeState\";\nimport { hooks } from \"./setupHooks\";\nvar hostTextProps = {\n accessible: isAndroid ? false : isIos ? true : void 0,\n allowFontScaling: true,\n ellipsizeMode: \"tail\"\n};\nvar _withNativeStyle = function(Component, baseStyle, themeStyleKeys, host) {\n var _hooks_getBaseViews;\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 baseViews = host ? (_hooks_getBaseViews = hooks.getBaseViews) === null || _hooks_getBaseViews === void 0 ? void 0 : _hooks_getBaseViews.call(hooks) : void 0;\n var TextAncestor = baseViews === null || baseViews === void 0 ? void 0 : baseViews.TextAncestor;\n var TextAncestorProvider = TextAncestor === null || TextAncestor === void 0 ? void 0 : TextAncestor.Provider;\n var HostText = host === \"text\" && !(\"userSelect\" in baseStyle) && !(\"verticalAlign\" in baseStyle) ? baseViews === null || baseViews === void 0 ? void 0 : baseViews.NativeText : void 0;\n var hostTextBase = HostText ? {\n overflow: \"hidden\",\n ...baseStyle,\n ...typeof baseStyle.fontWeight === \"number\" && {\n fontWeight: String(baseStyle.fontWeight)\n }\n } : baseStyle;\n var styles = /* @__PURE__ */ new Map();\n var hostTextStyles = /* @__PURE__ */ new Map();\n var ScopeContext = ThemeStateContext;\n var engineOf = getNativeStyleEngine;\n var scopeState = getThemeState;\n var resolve = resolveNativeStyleMapping;\n var linkMapping = linkNativeStyleMapping;\n var assignRef = setRef;\n var render = function(props, key) {\n var scopeId = use(ScopeContext);\n var inText = TextAncestor ? use(TextAncestor) : false;\n var themeState = scopeId && engineOf() ? scopeState(scopeId) : void 0;\n var resetsText = inText && host === \"view\";\n if (!themeState) {\n return resetsText ? /* @__PURE__ */ _jsx(TextAncestorProvider, {\n value: false,\n children: /* @__PURE__ */ _jsx(Fallback, {\n ...props\n })\n }, key) : /* @__PURE__ */ _jsx(Fallback, {\n ...props\n }, key);\n }\n var rest = props;\n if (props._expressions !== void 0) {\n var { _expressions: _ignoredExpressions, ...withoutExpressions } = props;\n rest = withoutExpressions;\n }\n var ref = props.ref;\n var { name, theme } = themeState;\n var asHostText = HostText && !inText;\n var Rendered = asHostText ? HostText : Component;\n var cache = asHostText ? hostTextStyles : styles;\n var style = cache.get(scopeId);\n if (!style) {\n style = [\n asHostText ? hostTextBase : baseStyle,\n null\n ];\n cache.set(scopeId, style);\n }\n style[1] = resolve(themeStyleKeys, name, theme);\n var wrapped = resetsText || asHostText && mayRenderText(rest.children);\n var element = /* @__PURE__ */ _jsx(Rendered, {\n ...asHostText && hostTextProps,\n ...rest,\n ref: function(node) {\n var refCleanup;\n if (typeof ref === \"function\") refCleanup = ref(node);\n else assignRef(ref, node);\n var link = linkMapping(node, themeStyleKeys, scopeId, name, theme);\n return function() {\n link === null || link === void 0 ? void 0 : link.unlink();\n if (typeof refCleanup === \"function\") refCleanup();\n else assignRef(ref, null);\n };\n },\n style\n }, wrapped ? void 0 : key);\n if (!wrapped) return element;\n return /* @__PURE__ */ _jsx(TextAncestorProvider, {\n value: !resetsText,\n children: element\n }, key);\n };\n var NativeStyleView = function(props) {\n return render(props);\n };\n NativeStyleView.inline = function(element) {\n return render(element.props, element.key);\n };\n return NativeStyleView;\n};\nfunction mayRenderText(children) {\n if (children == null) return false;\n if (Array.isArray(children) && children.length <= 3) {\n return children.some(function(child) {\n return child != null && typeof child === \"object\";\n });\n }\n return typeof children === \"object\";\n}\nexport {\n _withNativeStyle\n};\n//# sourceMappingURL=_withNativeStyle.js.map\n"],"mappings":";;;;;;;;;;AAQA,IAAI,gBAAgB;CAClB,YAAY,YAAY,QAAQ,QAAQ,OAAO,KAAK;CACpD,kBAAkB;CAClB,eAAe;AACjB;AACA,IAAI,mBAAmB,SAAS,WAAW,WAAW,gBAAgB,MAAM;CAC1E,IAAI;CACJ,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,YAAY,QAAQ,sBAAsB,MAAM,kBAAkB,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB,KAAK,KAAK,IAAI,KAAK;CAC/J,IAAI,eAAe,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;CACnF,IAAI,uBAAuB,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa;CACpG,IAAI,WAAW,SAAS,UAAU,EAAE,gBAAgB,cAAc,EAAE,mBAAmB,aAAa,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU,aAAa,KAAK;CACtL,IAAI,eAAe,WAAW;EAC5B,UAAU;EACV,GAAG;EACH,GAAG,OAAO,UAAU,eAAe,YAAY,EAC7C,YAAY,OAAO,UAAU,UAAU,EACzC;CACF,IAAI;CACJ,IAAI,yBAAyB,IAAI,IAAI;CACrC,IAAI,iCAAiC,IAAI,IAAI;CAC7C,IAAI,eAAe;CACnB,IAAI,WAAW;CACf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