tamagui 1.85.5 → 1.85.7

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/native.js CHANGED
@@ -1329,7 +1329,7 @@ var require_insertStyleRule_native = __commonJS({
1329
1329
  }
1330
1330
  return scannedCache.set(sheet2, cacheKey), dedupedThemes;
1331
1331
  }
1332
- var colorVarToVal, rootComputedStyle = null;
1332
+ var colorVarToVal, rootComputedStyle = null, schemes = { dark: !0, light: !0 };
1333
1333
  function addThemesFromCSS(cssStyleRule, tokens) {
1334
1334
  let selectors = cssStyleRule.selectorText.split(",");
1335
1335
  if (!selectors.length)
@@ -1361,17 +1361,20 @@ var require_insertStyleRule_native = __commonJS({
1361
1361
  !0
1362
1362
  );
1363
1363
  }
1364
- let dedupedEntry = {
1365
- names: [],
1364
+ return {
1365
+ names: [
1366
+ ...new Set(
1367
+ selectors.map((selector) => {
1368
+ let parts = selector.replace(/(.t_|:root)/g, "").trim().split(" "), secondToLast = parts[parts.length - 2] || "", scheme = secondToLast.includes("dark") ? "dark" : secondToLast.includes("light") ? "light" : "", name = (() => {
1369
+ let _ = parts[parts.length - 1];
1370
+ return scheme && _.startsWith(scheme) && (_ = _.slice(scheme.length + 1)), _;
1371
+ })();
1372
+ return scheme === name || schemes[name] ? scheme : `${scheme}${scheme && name ? "_" : ""}${name}`;
1373
+ })
1374
+ )
1375
+ ],
1366
1376
  theme: values
1367
1377
  };
1368
- for (let selector of selectors) {
1369
- let di = selector.indexOf("t_dark"), li = selector.indexOf("t_light"), scheme = di && li ? di < li ? "dark" : "light" : "", name = selector.slice(selector.lastIndexOf(".t_") + 3);
1370
- name.startsWith(scheme) && (name = name.slice(scheme.length + 1)), scheme === name && (scheme = "");
1371
- let themeName = `${scheme}${scheme && name ? "_" : ""}${name}`;
1372
- dedupedEntry.names.includes(themeName) || dedupedEntry.names.push(themeName);
1373
- }
1374
- return dedupedEntry;
1375
1378
  }
1376
1379
  function getTamaguiSelector(rule, collectThemes = !1) {
1377
1380
  if (rule instanceof CSSStyleRule) {
@@ -1703,65 +1706,11 @@ var require_useMedia_native = __commonJS({
1703
1706
  }
1704
1707
  });
1705
1708
 
1706
- // ../web/dist/cjs/Tamagui.native.js
1707
- var require_Tamagui_native = __commonJS({
1708
- "../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
1709
- "use strict";
1710
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1711
- for (var name in all)
1712
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1713
- }, __copyProps2 = (to, from, except, desc) => {
1714
- if (from && typeof from == "object" || typeof from == "function")
1715
- for (let key of __getOwnPropNames2(from))
1716
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1717
- return to;
1718
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1719
- // If the importer is in node compatibility mode or this is not an ESM
1720
- // file that has been converted to a CommonJS file using a Babel-
1721
- // compatible transform (i.e. "__esModule" has not been set), then set
1722
- // "default" to the CommonJS "module.exports" for node compatibility.
1723
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
1724
- mod
1725
- )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
1726
- __export2(Tamagui_exports, {
1727
- Tamagui: () => Tamagui,
1728
- getValueFromIdentifier: () => getValueFromIdentifier,
1729
- setIdentifierValue: () => setIdentifierValue
1730
- });
1731
- module2.exports = __toCommonJS2(Tamagui_exports);
1732
- var Helpers = __toESM2(require_index_native7()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), TamaguiManager = class {
1733
- constructor() {
1734
- this.Helpers = Helpers;
1735
- }
1736
- get mediaState() {
1737
- return { ...import_useMedia.mediaState };
1738
- }
1739
- get config() {
1740
- return (0, import_config.getConfig)();
1741
- }
1742
- get insertedRules() {
1743
- return (0, import_insertStyleRule.getAllRules)();
1744
- }
1745
- get allSelectors() {
1746
- return (0, import_insertStyleRule.getAllSelectors)();
1747
- }
1748
- get allTransforms() {
1749
- return (0, import_insertStyleRule.getAllTransforms)();
1750
- }
1751
- get identifierToValue() {
1752
- return identifierToValue;
1753
- }
1754
- }, Tamagui = new TamaguiManager(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
1755
- identifierToValue.set(identifier, value);
1756
- };
1757
- }
1758
- });
1759
-
1760
- // ../compose-refs/dist/cjs/compose-refs.native.js
1761
- var require_compose_refs_native = __commonJS({
1762
- "../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
1709
+ // ../web/dist/cjs/helpers/createShallowSetState.native.js
1710
+ var require_createShallowSetState_native = __commonJS({
1711
+ "../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
1763
1712
  "use strict";
1764
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1713
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1765
1714
  for (var name in all)
1766
1715
  __defProp2(target, name, { get: all[name], enumerable: !0 });
1767
1716
  }, __copyProps2 = (to, from, except, desc) => {
@@ -1769,47 +1718,28 @@ var require_compose_refs_native = __commonJS({
1769
1718
  for (let key of __getOwnPropNames2(from))
1770
1719
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1771
1720
  return to;
1772
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1773
- // If the importer is in node compatibility mode or this is not an ESM
1774
- // file that has been converted to a CommonJS file using a Babel-
1775
- // compatible transform (i.e. "__esModule" has not been set), then set
1776
- // "default" to the CommonJS "module.exports" for node compatibility.
1777
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
1778
- mod
1779
- )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
1780
- __export2(compose_refs_exports, {
1781
- composeRefs: () => composeRefs,
1782
- useComposedRefs: () => useComposedRefs
1721
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
1722
+ __export2(createShallowSetState_exports, {
1723
+ createShallowSetState: () => createShallowSetState,
1724
+ isEqualShallow: () => isEqualShallow,
1725
+ mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
1783
1726
  });
1784
- module2.exports = __toCommonJS2(compose_refs_exports);
1785
- var React2 = __toESM2(require("react"));
1786
- function setRef(ref, value) {
1787
- typeof ref == "function" ? ref(value) : ref && (ref.current = value);
1727
+ module2.exports = __toCommonJS2(createShallowSetState_exports);
1728
+ function createShallowSetState(setter, debug) {
1729
+ return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
1788
1730
  }
1789
- function composeRefs(...refs) {
1790
- return (node) => refs.forEach((ref) => setRef(ref, node));
1731
+ function mergeIfNotShallowEqual(prev, next, debug) {
1732
+ return isEqualShallow(prev, next) ? prev : (process.env.NODE_ENV === "development" && debug && console.warn("setStateShallow CHANGE", { prev, next }), { ...prev, ...next });
1791
1733
  }
1792
- function useComposedRefs(...refs) {
1793
- return React2.useCallback(composeRefs(...refs), refs);
1734
+ function isEqualShallow(prev, next) {
1735
+ for (let key in next)
1736
+ if (prev[key] !== next[key])
1737
+ return !1;
1738
+ return !0;
1794
1739
  }
1795
1740
  }
1796
1741
  });
1797
1742
 
1798
- // ../compose-refs/dist/cjs/index.native.js
1799
- var require_index_native10 = __commonJS({
1800
- "../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
1801
- "use strict";
1802
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
1803
- if (from && typeof from == "object" || typeof from == "function")
1804
- for (let key of __getOwnPropNames2(from))
1805
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1806
- return to;
1807
- }, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
1808
- module2.exports = __toCommonJS2(src_exports2);
1809
- __reExport2(src_exports2, require_compose_refs_native(), module2.exports);
1810
- }
1811
- });
1812
-
1813
1743
  // ../web/dist/cjs/constants/constants.native.js
1814
1744
  var require_constants_native2 = __commonJS({
1815
1745
  "../web/dist/cjs/constants/constants.native.js"(exports2, module2) {
@@ -1844,9 +1774,9 @@ var require_constants_native2 = __commonJS({
1844
1774
  }
1845
1775
  });
1846
1776
 
1847
- // ../web/dist/cjs/helpers/objectIdentityKey.native.js
1848
- var require_objectIdentityKey_native = __commonJS({
1849
- "../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
1777
+ // ../web/dist/cjs/helpers/ThemeManager.native.js
1778
+ var require_ThemeManager_native = __commonJS({
1779
+ "../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
1850
1780
  "use strict";
1851
1781
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1852
1782
  for (var name in all)
@@ -1856,177 +1786,149 @@ var require_objectIdentityKey_native = __commonJS({
1856
1786
  for (let key of __getOwnPropNames2(from))
1857
1787
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1858
1788
  return to;
1859
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
1860
- __export2(objectIdentityKey_exports, {
1861
- objectIdentityKey: () => objectIdentityKey
1789
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
1790
+ __export2(ThemeManager_exports, {
1791
+ ThemeManager: () => ThemeManager,
1792
+ getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
1793
+ getManagers: () => getManagers
1862
1794
  });
1863
- module2.exports = __toCommonJS2(objectIdentityKey_exports);
1864
- function objectIdentityKey(obj) {
1865
- let k = "";
1866
- for (let key in obj) {
1867
- k += key;
1868
- let arg = obj[key], type = typeof arg;
1869
- if (!arg || type !== "object" && type !== "function")
1870
- k += type + arg;
1871
- else if (cache.has(arg))
1872
- k += cache.get(arg);
1873
- else {
1874
- let v = Math.random();
1875
- cache.set(arg, v), k += v;
1876
- }
1877
- }
1878
- return k;
1795
+ module2.exports = __toCommonJS2(ThemeManager_exports);
1796
+ var import_constants4 = require_index_native(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
1797
+ function getHasThemeUpdatingProps(props) {
1798
+ return !!(props.name || props.componentName || props.inverse || props.reset);
1879
1799
  }
1880
- var cache = /* @__PURE__ */ new WeakMap();
1881
- }
1882
- });
1883
-
1884
- // ../web/dist/cjs/helpers/createStyledContext.native.js
1885
- var require_createStyledContext_native = __commonJS({
1886
- "../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
1887
- "use strict";
1888
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1889
- for (var name in all)
1890
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1891
- }, __copyProps2 = (to, from, except, desc) => {
1892
- if (from && typeof from == "object" || typeof from == "function")
1893
- for (let key of __getOwnPropNames2(from))
1894
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1895
- return to;
1896
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
1897
- __export2(createStyledContext_exports, {
1898
- createStyledContext: () => createStyledContext2
1899
- });
1900
- module2.exports = __toCommonJS2(createStyledContext_exports);
1901
- var import_react2 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime6 = require("react/jsx-runtime");
1902
- function createStyledContext2(defaultValues) {
1903
- let OGContext = (0, import_react2.createContext)(defaultValues), OGProvider2 = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
1904
- children,
1905
- scope,
1906
- ...values
1907
- }) => {
1908
- let next = (0, import_react2.useMemo)(() => ({
1909
- // this ! is a workaround for ts error
1910
- ...defaultValues,
1911
- ...values
1912
- }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider2;
1913
- if (scope) {
1914
- let ScopedContext = scopedContexts.get(scope);
1915
- ScopedContext || (ScopedContext = (0, import_react2.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1800
+ var uid = 0, ThemeManager = class {
1801
+ constructor(props = {}, parentManager) {
1802
+ if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
1803
+ this.updateStateFromProps(props, !1);
1804
+ return;
1916
1805
  }
1917
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Provider2, { value: next, children });
1918
- }, useStyledContext = (scope) => {
1919
- let context = scope ? scopedContexts.get(scope) : OGContext;
1920
- return (0, import_react2.useContext)(context);
1921
- };
1922
- return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
1923
- }
1924
- }
1925
- });
1926
-
1927
- // ../web/dist/cjs/contexts/ComponentContext.native.js
1928
- var require_ComponentContext_native = __commonJS({
1929
- "../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
1930
- "use strict";
1931
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1932
- for (var name in all)
1933
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1934
- }, __copyProps2 = (to, from, except, desc) => {
1935
- if (from && typeof from == "object" || typeof from == "function")
1936
- for (let key of __getOwnPropNames2(from))
1937
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1938
- return to;
1939
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
1940
- __export2(ComponentContext_exports, {
1941
- ComponentContext: () => ComponentContext2
1942
- });
1943
- module2.exports = __toCommonJS2(ComponentContext_exports);
1944
- var import_createStyledContext = require_createStyledContext_native(), ComponentContext2 = (0, import_createStyledContext.createStyledContext)({
1945
- disableSSR: void 0,
1946
- inText: !1,
1947
- language: null,
1948
- animationDriver: null,
1949
- groups: {
1950
- emit: null,
1951
- subscribe: null,
1952
- state: {}
1806
+ if (!parentManager)
1807
+ throw process.env.NODE_ENV !== "production" ? new Error(
1808
+ "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
1809
+ ) : "\u274C 000";
1810
+ if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
1811
+ return parentManager;
1953
1812
  }
1954
- });
1955
- }
1956
- });
1957
-
1958
- // ../web/dist/cjs/defaultComponentState.native.js
1959
- var require_defaultComponentState_native = __commonJS({
1960
- "../web/dist/cjs/defaultComponentState.native.js"(exports2, module2) {
1961
- "use strict";
1962
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1963
- for (var name in all)
1964
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1965
- }, __copyProps2 = (to, from, except, desc) => {
1966
- if (from && typeof from == "object" || typeof from == "function")
1967
- for (let key of __getOwnPropNames2(from))
1968
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1969
- return to;
1970
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), defaultComponentState_exports = {};
1971
- __export2(defaultComponentState_exports, {
1972
- defaultComponentState: () => defaultComponentState,
1973
- defaultComponentStateMounted: () => defaultComponentStateMounted,
1974
- defaultComponentStateShouldEnter: () => defaultComponentStateShouldEnter
1975
- });
1976
- module2.exports = __toCommonJS2(defaultComponentState_exports);
1977
- var defaultComponentState = {
1978
- hover: !1,
1979
- press: !1,
1980
- pressIn: !1,
1981
- focus: !1,
1982
- unmounted: !0
1983
- }, defaultComponentStateMounted = {
1984
- ...defaultComponentState,
1985
- unmounted: !1
1986
- }, defaultComponentStateShouldEnter = {
1987
- ...defaultComponentState,
1988
- unmounted: "should-enter"
1989
- };
1990
- }
1991
- });
1992
-
1993
- // ../web/dist/cjs/helpers/createShallowSetState.native.js
1994
- var require_createShallowSetState_native = __commonJS({
1995
- "../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
1996
- "use strict";
1997
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1998
- for (var name in all)
1999
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2000
- }, __copyProps2 = (to, from, except, desc) => {
2001
- if (from && typeof from == "object" || typeof from == "function")
2002
- for (let key of __getOwnPropNames2(from))
2003
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2004
- return to;
2005
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
2006
- __export2(createShallowSetState_exports, {
2007
- createShallowSetState: () => createShallowSetState,
2008
- isEqualShallow: () => isEqualShallow,
2009
- mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
2010
- });
2011
- module2.exports = __toCommonJS2(createShallowSetState_exports);
2012
- function createShallowSetState(setter, debug) {
2013
- return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
2014
- }
2015
- function mergeIfNotShallowEqual(prev, next, debug) {
2016
- return isEqualShallow(prev, next) ? prev : (process.env.NODE_ENV === "development" && debug && console.warn("setStateShallow CHANGE", { prev, next }), { ...prev, ...next });
1813
+ updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
1814
+ if (this.props = props, props.forceTheme)
1815
+ return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
1816
+ let nextState = this.getStateIfChanged(props);
1817
+ if (nextState)
1818
+ return this.updateState(nextState, shouldNotify), nextState;
1819
+ }
1820
+ updateState(nextState, shouldNotify = !0) {
1821
+ this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && this.notify();
1822
+ }
1823
+ getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
1824
+ let _ = this.getState(props, parentManager);
1825
+ if (state && state !== emptyState && !_)
1826
+ return parentManager == null ? void 0 : parentManager.state;
1827
+ if (this.getStateShouldChange(_, state))
1828
+ return _;
1829
+ }
1830
+ getStateShouldChange(nextState, state = this.state) {
1831
+ return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
1832
+ }
1833
+ getState(props = this.props, parentManager = this.parentManager) {
1834
+ return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
1835
+ }
1836
+ get allKeys() {
1837
+ var _a;
1838
+ return this._allKeys ||= /* @__PURE__ */ new Set([
1839
+ ...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
1840
+ ...Object.keys(this.state.theme || {})
1841
+ ]), this._allKeys;
1842
+ }
1843
+ notify(forced = !1) {
1844
+ this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
1845
+ }
1846
+ onChangeTheme(cb, debugId) {
1847
+ return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
1848
+ this.themeListeners.delete(cb);
1849
+ };
1850
+ }
1851
+ };
1852
+ function getState(props, manager) {
1853
+ var _a;
1854
+ if (props.name && props.reset)
1855
+ throw new Error(
1856
+ process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
1857
+ );
1858
+ if (!getHasThemeUpdatingProps(props))
1859
+ return null;
1860
+ let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
1861
+ if (!baseManager && props.reset)
1862
+ return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
1863
+ let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
1864
+ baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
1865
+ let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
1866
+ isDirectParentAComponentTheme && allComponentThemes.shift();
1867
+ let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max2 = base.length, min2 = props.componentName && !nextName ? max2 : 0;
1868
+ for (let i = max2; i >= min2; i--) {
1869
+ let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
1870
+ props.inverse && (prefix = inverseThemeName(prefix));
1871
+ let potentials = [];
1872
+ if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
1873
+ let lastSegment = potentials.findIndex((x) => !x.includes("_"));
1874
+ lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
1875
+ }
1876
+ if (componentName && !props.reset) {
1877
+ let baseLen = base.length, componentPotentials = [];
1878
+ if (nextName && baseLen > 1) {
1879
+ let beforeSeparator = base[0];
1880
+ componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
1881
+ }
1882
+ if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
1883
+ if (i > baseLen) {
1884
+ let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
1885
+ if (prefixLessOne) {
1886
+ let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
1887
+ componentPotentials.unshift(lessSpecific);
1888
+ }
1889
+ }
1890
+ let moreSpecific = `${prefix}_${nextName}_${componentName}`;
1891
+ componentPotentials.unshift(moreSpecific);
1892
+ }
1893
+ potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
1894
+ }
1895
+ let found = potentials.find((t) => t in themes);
1896
+ if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
1897
+ props,
1898
+ found,
1899
+ potentials,
1900
+ baseManager,
1901
+ nextName,
1902
+ baseName,
1903
+ prefix
1904
+ }), found) {
1905
+ let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants22.THEME_CLASSNAME_PREFIX, className = import_constants4.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
1906
+ result = {
1907
+ name: found,
1908
+ parentName,
1909
+ theme: themes[found],
1910
+ className,
1911
+ isComponent,
1912
+ scheme
1913
+ };
1914
+ break;
1915
+ }
1916
+ }
1917
+ return process.env.NODE_ENV !== "production" && props.debug === "verbose" && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min: min2, max: max2 }), console.warn("result", { result }), console.trace(), console.groupEnd()), result;
2017
1918
  }
2018
- function isEqualShallow(prev, next) {
2019
- for (let key in next)
2020
- if (prev[key] !== next[key])
2021
- return !1;
2022
- return !0;
1919
+ var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
1920
+ function getManagers(themeManager) {
1921
+ let comp = [], all = [], cur = themeManager;
1922
+ for (; cur; )
1923
+ all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
1924
+ return [all, comp];
2023
1925
  }
2024
1926
  }
2025
1927
  });
2026
1928
 
2027
- // ../web/dist/cjs/constants/accessibilityDirectMap.native.js
2028
- var require_accessibilityDirectMap_native = __commonJS({
2029
- "../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
1929
+ // ../web/dist/cjs/helpers/ThemeManagerContext.native.js
1930
+ var require_ThemeManagerContext_native = __commonJS({
1931
+ "../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
2030
1932
  "use strict";
2031
1933
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2032
1934
  for (var name in all)
@@ -2036,72 +1938,18 @@ var require_accessibilityDirectMap_native = __commonJS({
2036
1938
  for (let key of __getOwnPropNames2(from))
2037
1939
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2038
1940
  return to;
2039
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), accessibilityDirectMap_native_exports = {};
2040
- __export2(accessibilityDirectMap_native_exports, {
2041
- accessibilityDirectMap: () => accessibilityDirectMap,
2042
- accessibilityWebRoleToNativeRole: () => accessibilityWebRoleToNativeRole,
2043
- nativeAccessibilityState: () => nativeAccessibilityState,
2044
- nativeAccessibilityValue: () => nativeAccessibilityValue,
2045
- webToNativeAccessibilityDirectMap: () => webToNativeAccessibilityDirectMap
1941
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
1942
+ __export2(ThemeManagerContext_exports, {
1943
+ ThemeManagerIDContext: () => ThemeManagerIDContext
2046
1944
  });
2047
- module2.exports = __toCommonJS2(accessibilityDirectMap_native_exports);
2048
- var accessibilityDirectMap = {}, webToNativeAccessibilityDirectMap = {
2049
- "aria-label": "accessibilityLabel",
2050
- "aria-labelledby": "accessibilityLabelledBy",
2051
- "aria-live": "accessibilityLiveRegion",
2052
- "aria-modal": "accessibilityViewIsModal",
2053
- "aria-hidden": "accessibilityElementsHidden"
2054
- }, nativeAccessibilityValue = {
2055
- "aria-valuemin": "min",
2056
- "aria-valuemax": "max",
2057
- "aria-valuenow": "now",
2058
- "aria-valuetext": "text"
2059
- }, nativeAccessibilityState = {
2060
- "aria-disabled": "disabled",
2061
- "aria-selected": "selected",
2062
- "aria-checked": "checked",
2063
- "aria-busy": "busy",
2064
- "aria-expanded": "expanded"
2065
- }, accessibilityWebRoleToNativeRole = {
2066
- alert: "alert",
2067
- button: "button",
2068
- checkbox: "checkbox",
2069
- combobox: "combobox",
2070
- grid: "grid",
2071
- group: "none",
2072
- heading: "header",
2073
- imagebutton: "imagebutton",
2074
- img: "image",
2075
- keyboardkey: "keyboardkey",
2076
- link: "link",
2077
- menu: "menu",
2078
- menubar: "menubar",
2079
- menuitem: "menuitem",
2080
- none: "none",
2081
- presentation: "none",
2082
- progressbar: "progressbar",
2083
- radio: "radio",
2084
- radiogroup: "radiogroup",
2085
- region: "summary",
2086
- scrollbar: "scrollbar",
2087
- searchbox: "search",
2088
- slider: "adjustable",
2089
- spinbutton: "spinbutton",
2090
- summary: "summary",
2091
- switch: "switch",
2092
- tab: "tab",
2093
- tablist: "tablist",
2094
- text: "text",
2095
- timer: "timer",
2096
- togglebutton: "togglebutton",
2097
- toolbar: "toolbar"
2098
- };
1945
+ module2.exports = __toCommonJS2(ThemeManagerContext_exports);
1946
+ var import_react2 = require("react"), ThemeManagerIDContext = (0, import_react2.createContext)(1);
2099
1947
  }
2100
1948
  });
2101
1949
 
2102
- // ../web/dist/cjs/constants/isDevTools.native.js
2103
- var require_isDevTools_native = __commonJS({
2104
- "../web/dist/cjs/constants/isDevTools.native.js"(exports2, module2) {
1950
+ // ../web/dist/cjs/hooks/useTheme.native.js
1951
+ var require_useTheme_native = __commonJS({
1952
+ "../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
2105
1953
  "use strict";
2106
1954
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2107
1955
  for (var name in all)
@@ -2111,27 +1959,260 @@ var require_isDevTools_native = __commonJS({
2111
1959
  for (let key of __getOwnPropNames2(from))
2112
1960
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2113
1961
  return to;
2114
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), isDevTools_exports = {};
2115
- __export2(isDevTools_exports, {
2116
- isDevTools: () => isDevTools
1962
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
1963
+ __export2(useTheme_exports, {
1964
+ activeThemeManagers: () => activeThemeManagers,
1965
+ getThemeManager: () => getThemeManager,
1966
+ getThemeProxied: () => getThemeProxied,
1967
+ useChangeThemeEffect: () => useChangeThemeEffect,
1968
+ useTheme: () => useTheme4,
1969
+ useThemeWithState: () => useThemeWithState
2117
1970
  });
2118
- module2.exports = __toCommonJS2(isDevTools_exports);
2119
- var isDevTools = (() => {
2120
- if (process.env.NODE_ENV === "development")
2121
- try {
2122
- return new Function("try {return this===window;}catch(e){ return false;}")();
2123
- } catch {
1971
+ module2.exports = __toCommonJS2(useTheme_exports);
1972
+ var import_constants4 = require_index_native(), import_react2 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), emptyProps = { name: null }, cached;
1973
+ function getDefaultThemeProxied() {
1974
+ if (cached)
1975
+ return cached;
1976
+ let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
1977
+ return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
1978
+ }
1979
+ var useTheme4 = (props = emptyProps) => {
1980
+ let [_, theme] = useThemeWithState(props);
1981
+ return theme || getDefaultThemeProxied();
1982
+ }, useThemeWithState = (props) => {
1983
+ let keys = (0, import_react2.useRef)([]), changedThemeState = useChangeThemeEffect(
1984
+ props,
1985
+ !1,
1986
+ keys.current,
1987
+ import_constants4.isServer ? void 0 : () => {
1988
+ var _a, _b;
1989
+ let next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
1990
+ return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
1991
+ shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
1992
+ keys: [...keys.current]
1993
+ }), next;
2124
1994
  }
1995
+ ), { themeManager, state } = changedThemeState;
1996
+ process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
1997
+ `[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
1998
+ props
1999
+ )}).
2000
+
2001
+ If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
2002
+ ));
2003
+ let themeProxied = (0, import_react2.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
2004
+ return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
2005
+ };
2006
+ function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
2007
+ if (!theme)
2008
+ return {};
2009
+ let config = (0, import_config.getConfig)();
2010
+ function track(key) {
2011
+ keys && !keys.includes(key) && (keys.push(key), process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`));
2012
+ }
2013
+ return new Proxy(theme, {
2014
+ has(_, key) {
2015
+ if (Reflect.has(theme, key))
2016
+ return !0;
2017
+ if (typeof key == "string")
2018
+ return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
2019
+ },
2020
+ get(_, key) {
2021
+ if (
2022
+ // dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
2023
+ // if someone is crazy enough to use "undefined" as a theme key then this not working is on them
2024
+ key !== "undefined" && typeof key == "string"
2025
+ ) {
2026
+ let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
2027
+ if (val && typeof val == "object")
2028
+ return new Proxy(val, {
2029
+ // when they touch the actual value we only track it
2030
+ // if its a variable (web), its ignored!
2031
+ get(_2, subkey) {
2032
+ if (subkey === "val")
2033
+ track(keyString);
2034
+ else if (subkey === "get")
2035
+ return (platform) => {
2036
+ let outVal = (0, import_createVariable.getVariable)(val);
2037
+ if (platform !== "web" && import_constants4.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
2038
+ let oppositeThemeName = name.replace(
2039
+ scheme === "dark" ? "dark" : "light",
2040
+ scheme === "dark" ? "light" : "dark"
2041
+ ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
2042
+ if (oppositeVal)
2043
+ return {
2044
+ dynamic: {
2045
+ dark: scheme === "dark" ? outVal : oppositeVal,
2046
+ light: scheme === "light" ? outVal : oppositeVal
2047
+ }
2048
+ };
2049
+ }
2050
+ return track(keyString), outVal;
2051
+ };
2052
+ return Reflect.get(val, subkey);
2053
+ }
2054
+ });
2055
+ if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_FEAT_THROW_ON_MISSING_THEME_VALUE === "1")
2056
+ throw new Error(
2057
+ `[tamagui] No theme key "${key}" found in theme ${name}.
2058
+ Keys in theme: ${Object.keys(
2059
+ theme
2060
+ ).join(", ")}`
2061
+ );
2062
+ }
2063
+ return Reflect.get(_, key);
2064
+ }
2065
+ });
2066
+ }
2067
+ function someParentIsInversed(manager) {
2068
+ {
2069
+ let cur = manager;
2070
+ for (; cur; ) {
2071
+ if (!cur.parentManager)
2072
+ return !1;
2073
+ if (cur.parentManager.state.scheme !== cur.state.scheme)
2074
+ return !0;
2075
+ cur = cur.parentManager;
2076
+ }
2077
+ }
2125
2078
  return !1;
2126
- })();
2079
+ }
2080
+ var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
2081
+ if (!_idToUID[t.id]) {
2082
+ let id = _idToUID[t.id] = {};
2083
+ _uidToManager.set(id, t);
2084
+ }
2085
+ }, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
2086
+ let { disable } = props, parentManagerId = (0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
2087
+ if (!isRoot && !parentManager || disable)
2088
+ return {
2089
+ isNewTheme: !1,
2090
+ state: parentManager == null ? void 0 : parentManager.state,
2091
+ themeManager: parentManager
2092
+ };
2093
+ let [themeState, setThemeState] = (0, import_react2.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
2094
+ function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
2095
+ let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
2096
+ if (!manager || !forceShouldChange && forceUpdate === !1)
2097
+ return;
2098
+ let next = nextState || manager.getState(props, parentManager);
2099
+ if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
2100
+ return next;
2101
+ }
2102
+ if (import_constants4.isServer || ((0, import_react2.useEffect)(() => {
2103
+ if (!themeManager)
2104
+ return;
2105
+ if (props.inverse && !mounted) {
2106
+ setThemeState((prev) => createState({
2107
+ ...prev,
2108
+ mounted: !0
2109
+ }));
2110
+ return;
2111
+ }
2112
+ (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
2113
+ let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
2114
+ forced && setThemeState((prev) => createState(prev, !0));
2115
+ }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
2116
+ (name, manager, forced) => {
2117
+ let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
2118
+ process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, {
2119
+ force,
2120
+ shouldTryUpdate,
2121
+ props,
2122
+ name,
2123
+ manager,
2124
+ keys
2125
+ }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
2126
+ },
2127
+ themeManager.id
2128
+ );
2129
+ return () => {
2130
+ selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
2131
+ };
2132
+ }, [
2133
+ themeManager,
2134
+ parentManager,
2135
+ isNewTheme,
2136
+ props.componentName,
2137
+ props.inverse,
2138
+ props.name,
2139
+ props.reset,
2140
+ mounted
2141
+ ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react2.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
2142
+ globalThis.TamaguiThemeManagers.delete(themeManager);
2143
+ }), [themeManager])), isInversingOnMount)
2144
+ return {
2145
+ isNewTheme: !1,
2146
+ inversed: !1,
2147
+ themeManager: parentManager,
2148
+ state: {
2149
+ name: "",
2150
+ ...parentManager == null ? void 0 : parentManager.state,
2151
+ className: ""
2152
+ }
2153
+ };
2154
+ return {
2155
+ state,
2156
+ isNewTheme,
2157
+ inversed,
2158
+ themeManager
2159
+ };
2160
+ function createState(prev, force = !1) {
2161
+ if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
2162
+ return prev;
2163
+ let themeManager2 = parentManager, state2;
2164
+ if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
2165
+ let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
2166
+ if (prev != null && prev.themeManager) {
2167
+ themeManager2 = prev.themeManager;
2168
+ let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
2169
+ themeManager2,
2170
+ next,
2171
+ prev.state,
2172
+ forceChange
2173
+ );
2174
+ nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
2175
+ } else
2176
+ themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
2177
+ }
2178
+ let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
2179
+ isNewTheme2 && registerThemeManager(themeManager2);
2180
+ let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
2181
+ state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
2182
+ let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
2183
+ themeManager: themeManager2,
2184
+ isNewTheme: isNewTheme2,
2185
+ mounted: mounted2,
2186
+ inversed: inversed2
2187
+ }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
2188
+ (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
2189
+ (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
2190
+ if (prev && shouldReturnPrev)
2191
+ return prev;
2192
+ if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants4.isClient) {
2193
+ console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
2194
+ let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
2195
+ console.info({
2196
+ props,
2197
+ parentState,
2198
+ parentId,
2199
+ themeManager: themeManager2,
2200
+ prev,
2201
+ response,
2202
+ themeManagerState
2203
+ }), console.groupEnd();
2204
+ }
2205
+ return response;
2206
+ }
2207
+ };
2127
2208
  }
2128
2209
  });
2129
2210
 
2130
- // ../web/dist/cjs/helpers/getGroupPropParts.native.js
2131
- var require_getGroupPropParts_native = __commonJS({
2132
- "../web/dist/cjs/helpers/getGroupPropParts.native.js"(exports2, module2) {
2211
+ // ../web/dist/cjs/Tamagui.native.js
2212
+ var require_Tamagui_native = __commonJS({
2213
+ "../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
2133
2214
  "use strict";
2134
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2215
+ var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2135
2216
  for (var name in all)
2136
2217
  __defProp2(target, name, { get: all[name], enumerable: !0 });
2137
2218
  }, __copyProps2 = (to, from, except, desc) => {
@@ -2139,22 +2220,112 @@ var require_getGroupPropParts_native = __commonJS({
2139
2220
  for (let key of __getOwnPropNames2(from))
2140
2221
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2141
2222
  return to;
2142
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getGroupPropParts_exports = {};
2143
- __export2(getGroupPropParts_exports, {
2144
- getGroupPropParts: () => getGroupPropParts
2223
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
2224
+ // If the importer is in node compatibility mode or this is not an ESM
2225
+ // file that has been converted to a CommonJS file using a Babel-
2226
+ // compatible transform (i.e. "__esModule" has not been set), then set
2227
+ // "default" to the CommonJS "module.exports" for node compatibility.
2228
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
2229
+ mod
2230
+ )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
2231
+ __export2(Tamagui_exports, {
2232
+ Tamagui: () => Tamagui,
2233
+ getValueFromIdentifier: () => getValueFromIdentifier,
2234
+ setIdentifierValue: () => setIdentifierValue
2145
2235
  });
2146
- module2.exports = __toCommonJS2(getGroupPropParts_exports);
2147
- var import_useMedia = require_useMedia_native();
2148
- function getGroupPropParts(groupProp) {
2149
- let mediaQueries = (0, import_useMedia.getMedia)(), [_, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
2150
- return media ? pseudo = part4 : pseudo = part3, { name, pseudo, media };
2151
- }
2236
+ module2.exports = __toCommonJS2(Tamagui_exports);
2237
+ var Helpers = __toESM2(require_index_native7()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), Tamagui = (() => {
2238
+ if (process.env.NODE_ENV === "development") {
2239
+ class TamaguiManager {
2240
+ constructor() {
2241
+ this.Helpers = Helpers, this.getThemeManager = import_useTheme.getThemeManager;
2242
+ }
2243
+ get activeThemeManagers() {
2244
+ return import_useTheme.activeThemeManagers;
2245
+ }
2246
+ get mediaState() {
2247
+ return { ...import_useMedia.mediaState };
2248
+ }
2249
+ get config() {
2250
+ return (0, import_config.getConfig)();
2251
+ }
2252
+ get insertedRules() {
2253
+ return (0, import_insertStyleRule.getAllRules)();
2254
+ }
2255
+ get allSelectors() {
2256
+ return (0, import_insertStyleRule.getAllSelectors)();
2257
+ }
2258
+ get allTransforms() {
2259
+ return (0, import_insertStyleRule.getAllTransforms)();
2260
+ }
2261
+ get identifierToValue() {
2262
+ return identifierToValue;
2263
+ }
2264
+ }
2265
+ return new TamaguiManager();
2266
+ }
2267
+ })(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
2268
+ identifierToValue.set(identifier, value);
2269
+ };
2152
2270
  }
2153
2271
  });
2154
2272
 
2155
- // ../web/dist/cjs/helpers/createMediaStyle.native.js
2156
- var require_createMediaStyle_native = __commonJS({
2157
- "../web/dist/cjs/helpers/createMediaStyle.native.js"(exports2, module2) {
2273
+ // ../compose-refs/dist/cjs/compose-refs.native.js
2274
+ var require_compose_refs_native = __commonJS({
2275
+ "../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
2276
+ "use strict";
2277
+ var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2278
+ for (var name in all)
2279
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2280
+ }, __copyProps2 = (to, from, except, desc) => {
2281
+ if (from && typeof from == "object" || typeof from == "function")
2282
+ for (let key of __getOwnPropNames2(from))
2283
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2284
+ return to;
2285
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
2286
+ // If the importer is in node compatibility mode or this is not an ESM
2287
+ // file that has been converted to a CommonJS file using a Babel-
2288
+ // compatible transform (i.e. "__esModule" has not been set), then set
2289
+ // "default" to the CommonJS "module.exports" for node compatibility.
2290
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
2291
+ mod
2292
+ )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
2293
+ __export2(compose_refs_exports, {
2294
+ composeRefs: () => composeRefs,
2295
+ useComposedRefs: () => useComposedRefs
2296
+ });
2297
+ module2.exports = __toCommonJS2(compose_refs_exports);
2298
+ var React2 = __toESM2(require("react"));
2299
+ function setRef(ref, value) {
2300
+ typeof ref == "function" ? ref(value) : ref && (ref.current = value);
2301
+ }
2302
+ function composeRefs(...refs) {
2303
+ return (node) => refs.forEach((ref) => setRef(ref, node));
2304
+ }
2305
+ function useComposedRefs(...refs) {
2306
+ return React2.useCallback(composeRefs(...refs), refs);
2307
+ }
2308
+ }
2309
+ });
2310
+
2311
+ // ../compose-refs/dist/cjs/index.native.js
2312
+ var require_index_native10 = __commonJS({
2313
+ "../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
2314
+ "use strict";
2315
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
2316
+ if (from && typeof from == "object" || typeof from == "function")
2317
+ for (let key of __getOwnPropNames2(from))
2318
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2319
+ return to;
2320
+ }, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
2321
+ module2.exports = __toCommonJS2(src_exports2);
2322
+ __reExport2(src_exports2, require_compose_refs_native(), module2.exports);
2323
+ }
2324
+ });
2325
+
2326
+ // ../web/dist/cjs/helpers/objectIdentityKey.native.js
2327
+ var require_objectIdentityKey_native = __commonJS({
2328
+ "../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
2158
2329
  "use strict";
2159
2330
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2160
2331
  for (var name in all)
@@ -2164,83 +2335,357 @@ var require_createMediaStyle_native = __commonJS({
2164
2335
  for (let key of __getOwnPropNames2(from))
2165
2336
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2166
2337
  return to;
2167
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createMediaStyle_exports = {};
2168
- __export2(createMediaStyle_exports, {
2169
- MEDIA_SEP: () => MEDIA_SEP,
2170
- createMediaStyle: () => createMediaStyle
2338
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
2339
+ __export2(objectIdentityKey_exports, {
2340
+ objectIdentityKey: () => objectIdentityKey
2171
2341
  });
2172
- module2.exports = __toCommonJS2(createMediaStyle_exports);
2173
- var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
2174
- press: "active"
2175
- }, createMediaStyle = (styleObject, mediaKeyIn, mediaQueries, type, negate, priority) => {
2176
- let { property, identifier, rules } = styleObject, conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.mediaPropOrder, isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
2177
- if (isNonWindowMedia) {
2178
- let precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
2179
- if (isTheme || isGroup) {
2180
- let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
2181
- groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
2182
- let name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = conf.themeClassNameOnRoot && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? `:${pseudoSelectorName}` : "", presedencePrefix = `:root${precedenceImportancePrefix}${precedenceSpace}`, mediaSelector = `.t_${name}${pseudoSelector}`, nextSelector = `${presedencePrefix}${mediaSelector} ${selector.replace(
2183
- ":root",
2184
- ""
2185
- )}`;
2186
- styleRule = styleInner.replace(selector, nextSelector);
2187
- } else
2188
- styleRule = `${precedenceImportancePrefix}${styleInner}`;
2189
- }
2190
- if (!isNonWindowMedia || groupMediaKey) {
2191
- if (!selectors) {
2192
- let mediaKeys = Object.keys(mediaQueries);
2193
- selectors = Object.fromEntries(
2194
- mediaKeys.map((key) => [key, (0, import_useMedia.mediaObjectToString)(mediaQueries[key])])
2195
- ), enableMediaPropOrder || (prefixes = Object.fromEntries(
2196
- mediaKeys.map((k, index) => [k, new Array(index + 1).fill(":root").join("")])
2197
- ));
2342
+ module2.exports = __toCommonJS2(objectIdentityKey_exports);
2343
+ function objectIdentityKey(obj) {
2344
+ let k = "";
2345
+ for (let key in obj) {
2346
+ k += key;
2347
+ let arg = obj[key], type = typeof arg;
2348
+ if (!arg || type !== "object" && type !== "function")
2349
+ k += type + arg;
2350
+ else if (cache.has(arg))
2351
+ k += cache.get(arg);
2352
+ else {
2353
+ let v = Math.random();
2354
+ cache.set(arg, v), k += v;
2198
2355
  }
2199
- let mediaKey = groupMediaKey || mediaKeyIn, mediaSelector = selectors[mediaKey], mediaQuery = `${negate ? "not all and " : ""}${mediaSelector}`, precedenceImportancePrefix = groupMediaKey ? "" : enableMediaPropOrder ? (
2200
- // this new array should be cached
2201
- new Array(priority).fill(":root").join("")
2202
- ) : (
2203
- // @ts-ignore
2204
- prefixes[mediaKey]
2205
- ), prefix = groupMediaKey ? `@container ${containerName}` : "@media";
2206
- groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", ` and ${mediaQuery} {`).replace("and screen and", "and") : styleRule = `${prefix} ${mediaQuery}{${precedenceImportancePrefix}${styleInner}}`, groupMediaKey && (styleRule = `@supports (contain: ${conf.settings.webContainerType || "inline-size"}) {${styleRule}}`);
2207
2356
  }
2208
- return {
2209
- property,
2210
- rules: [styleRule],
2211
- identifier: nextIdentifier
2357
+ return k;
2358
+ }
2359
+ var cache = /* @__PURE__ */ new WeakMap();
2360
+ }
2361
+ });
2362
+
2363
+ // ../web/dist/cjs/helpers/createStyledContext.native.js
2364
+ var require_createStyledContext_native = __commonJS({
2365
+ "../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
2366
+ "use strict";
2367
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2368
+ for (var name in all)
2369
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2370
+ }, __copyProps2 = (to, from, except, desc) => {
2371
+ if (from && typeof from == "object" || typeof from == "function")
2372
+ for (let key of __getOwnPropNames2(from))
2373
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2374
+ return to;
2375
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
2376
+ __export2(createStyledContext_exports, {
2377
+ createStyledContext: () => createStyledContext2
2378
+ });
2379
+ module2.exports = __toCommonJS2(createStyledContext_exports);
2380
+ var import_react2 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime6 = require("react/jsx-runtime");
2381
+ function createStyledContext2(defaultValues) {
2382
+ let OGContext = (0, import_react2.createContext)(defaultValues), OGProvider2 = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
2383
+ children,
2384
+ scope,
2385
+ ...values
2386
+ }) => {
2387
+ let next = (0, import_react2.useMemo)(() => ({
2388
+ // this ! is a workaround for ts error
2389
+ ...defaultValues,
2390
+ ...values
2391
+ }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider2;
2392
+ if (scope) {
2393
+ let ScopedContext = scopedContexts.get(scope);
2394
+ ScopedContext || (ScopedContext = (0, import_react2.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
2395
+ }
2396
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Provider2, { value: next, children });
2397
+ }, useStyledContext = (scope) => {
2398
+ let context = scope ? scopedContexts.get(scope) : OGContext;
2399
+ return (0, import_react2.useContext)(context);
2212
2400
  };
2401
+ return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
2402
+ }
2403
+ }
2404
+ });
2405
+
2406
+ // ../web/dist/cjs/contexts/ComponentContext.native.js
2407
+ var require_ComponentContext_native = __commonJS({
2408
+ "../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
2409
+ "use strict";
2410
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2411
+ for (var name in all)
2412
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2413
+ }, __copyProps2 = (to, from, except, desc) => {
2414
+ if (from && typeof from == "object" || typeof from == "function")
2415
+ for (let key of __getOwnPropNames2(from))
2416
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2417
+ return to;
2418
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
2419
+ __export2(ComponentContext_exports, {
2420
+ ComponentContext: () => ComponentContext2
2421
+ });
2422
+ module2.exports = __toCommonJS2(ComponentContext_exports);
2423
+ var import_createStyledContext = require_createStyledContext_native(), ComponentContext2 = (0, import_createStyledContext.createStyledContext)({
2424
+ disableSSR: void 0,
2425
+ inText: !1,
2426
+ language: null,
2427
+ animationDriver: null,
2428
+ groups: {
2429
+ emit: null,
2430
+ subscribe: null,
2431
+ state: {}
2432
+ }
2433
+ });
2434
+ }
2435
+ });
2436
+
2437
+ // ../web/dist/cjs/defaultComponentState.native.js
2438
+ var require_defaultComponentState_native = __commonJS({
2439
+ "../web/dist/cjs/defaultComponentState.native.js"(exports2, module2) {
2440
+ "use strict";
2441
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2442
+ for (var name in all)
2443
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2444
+ }, __copyProps2 = (to, from, except, desc) => {
2445
+ if (from && typeof from == "object" || typeof from == "function")
2446
+ for (let key of __getOwnPropNames2(from))
2447
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2448
+ return to;
2449
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), defaultComponentState_exports = {};
2450
+ __export2(defaultComponentState_exports, {
2451
+ defaultComponentState: () => defaultComponentState,
2452
+ defaultComponentStateMounted: () => defaultComponentStateMounted,
2453
+ defaultComponentStateShouldEnter: () => defaultComponentStateShouldEnter
2454
+ });
2455
+ module2.exports = __toCommonJS2(defaultComponentState_exports);
2456
+ var defaultComponentState = {
2457
+ hover: !1,
2458
+ press: !1,
2459
+ pressIn: !1,
2460
+ focus: !1,
2461
+ unmounted: !0
2462
+ }, defaultComponentStateMounted = {
2463
+ ...defaultComponentState,
2464
+ unmounted: !1
2465
+ }, defaultComponentStateShouldEnter = {
2466
+ ...defaultComponentState,
2467
+ unmounted: "should-enter"
2213
2468
  };
2214
2469
  }
2215
2470
  });
2216
2471
 
2217
- // ../../node_modules/@react-native/normalize-color/index.js
2218
- var require_normalize_color = __commonJS({
2219
- "../../node_modules/@react-native/normalize-color/index.js"(exports2, module2) {
2472
+ // ../web/dist/cjs/constants/accessibilityDirectMap.native.js
2473
+ var require_accessibilityDirectMap_native = __commonJS({
2474
+ "../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
2220
2475
  "use strict";
2221
- function normalizeColor(color) {
2222
- if (typeof color == "number")
2223
- return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
2224
- if (typeof color != "string")
2225
- return null;
2226
- let matchers = getMatchers(), match;
2227
- if (match = matchers.hex6.exec(color))
2228
- return parseInt(match[1] + "ff", 16) >>> 0;
2229
- let colorFromKeyword = normalizeKeyword(color);
2230
- return colorFromKeyword ?? ((match = matchers.rgb.exec(color)) ? (parse255(match[1]) << 24 | // r
2231
- parse255(match[2]) << 16 | // g
2232
- parse255(match[3]) << 8 | // b
2233
- 255) >>> // a
2234
- 0 : (match = matchers.rgba.exec(color)) ? match[6] !== void 0 ? (parse255(match[6]) << 24 | // r
2235
- parse255(match[7]) << 16 | // g
2236
- parse255(match[8]) << 8 | // b
2237
- parse1(match[9])) >>> // a
2238
- 0 : (parse255(match[2]) << 24 | // r
2239
- parse255(match[3]) << 16 | // g
2240
- parse255(match[4]) << 8 | // b
2241
- parse1(match[5])) >>> // a
2242
- 0 : (match = matchers.hex3.exec(color)) ? parseInt(
2243
- match[1] + match[1] + // r
2476
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2477
+ for (var name in all)
2478
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2479
+ }, __copyProps2 = (to, from, except, desc) => {
2480
+ if (from && typeof from == "object" || typeof from == "function")
2481
+ for (let key of __getOwnPropNames2(from))
2482
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2483
+ return to;
2484
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), accessibilityDirectMap_native_exports = {};
2485
+ __export2(accessibilityDirectMap_native_exports, {
2486
+ accessibilityDirectMap: () => accessibilityDirectMap,
2487
+ accessibilityWebRoleToNativeRole: () => accessibilityWebRoleToNativeRole,
2488
+ nativeAccessibilityState: () => nativeAccessibilityState,
2489
+ nativeAccessibilityValue: () => nativeAccessibilityValue,
2490
+ webToNativeAccessibilityDirectMap: () => webToNativeAccessibilityDirectMap
2491
+ });
2492
+ module2.exports = __toCommonJS2(accessibilityDirectMap_native_exports);
2493
+ var accessibilityDirectMap = {}, webToNativeAccessibilityDirectMap = {
2494
+ "aria-label": "accessibilityLabel",
2495
+ "aria-labelledby": "accessibilityLabelledBy",
2496
+ "aria-live": "accessibilityLiveRegion",
2497
+ "aria-modal": "accessibilityViewIsModal",
2498
+ "aria-hidden": "accessibilityElementsHidden"
2499
+ }, nativeAccessibilityValue = {
2500
+ "aria-valuemin": "min",
2501
+ "aria-valuemax": "max",
2502
+ "aria-valuenow": "now",
2503
+ "aria-valuetext": "text"
2504
+ }, nativeAccessibilityState = {
2505
+ "aria-disabled": "disabled",
2506
+ "aria-selected": "selected",
2507
+ "aria-checked": "checked",
2508
+ "aria-busy": "busy",
2509
+ "aria-expanded": "expanded"
2510
+ }, accessibilityWebRoleToNativeRole = {
2511
+ alert: "alert",
2512
+ button: "button",
2513
+ checkbox: "checkbox",
2514
+ combobox: "combobox",
2515
+ grid: "grid",
2516
+ group: "none",
2517
+ heading: "header",
2518
+ imagebutton: "imagebutton",
2519
+ img: "image",
2520
+ keyboardkey: "keyboardkey",
2521
+ link: "link",
2522
+ menu: "menu",
2523
+ menubar: "menubar",
2524
+ menuitem: "menuitem",
2525
+ none: "none",
2526
+ presentation: "none",
2527
+ progressbar: "progressbar",
2528
+ radio: "radio",
2529
+ radiogroup: "radiogroup",
2530
+ region: "summary",
2531
+ scrollbar: "scrollbar",
2532
+ searchbox: "search",
2533
+ slider: "adjustable",
2534
+ spinbutton: "spinbutton",
2535
+ summary: "summary",
2536
+ switch: "switch",
2537
+ tab: "tab",
2538
+ tablist: "tablist",
2539
+ text: "text",
2540
+ timer: "timer",
2541
+ togglebutton: "togglebutton",
2542
+ toolbar: "toolbar"
2543
+ };
2544
+ }
2545
+ });
2546
+
2547
+ // ../web/dist/cjs/constants/isDevTools.native.js
2548
+ var require_isDevTools_native = __commonJS({
2549
+ "../web/dist/cjs/constants/isDevTools.native.js"(exports2, module2) {
2550
+ "use strict";
2551
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2552
+ for (var name in all)
2553
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2554
+ }, __copyProps2 = (to, from, except, desc) => {
2555
+ if (from && typeof from == "object" || typeof from == "function")
2556
+ for (let key of __getOwnPropNames2(from))
2557
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2558
+ return to;
2559
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), isDevTools_exports = {};
2560
+ __export2(isDevTools_exports, {
2561
+ isDevTools: () => isDevTools
2562
+ });
2563
+ module2.exports = __toCommonJS2(isDevTools_exports);
2564
+ var isDevTools = (() => {
2565
+ if (process.env.NODE_ENV === "development")
2566
+ try {
2567
+ return new Function("try {return this===window;}catch(e){ return false;}")();
2568
+ } catch {
2569
+ }
2570
+ return !1;
2571
+ })();
2572
+ }
2573
+ });
2574
+
2575
+ // ../web/dist/cjs/helpers/getGroupPropParts.native.js
2576
+ var require_getGroupPropParts_native = __commonJS({
2577
+ "../web/dist/cjs/helpers/getGroupPropParts.native.js"(exports2, module2) {
2578
+ "use strict";
2579
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2580
+ for (var name in all)
2581
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2582
+ }, __copyProps2 = (to, from, except, desc) => {
2583
+ if (from && typeof from == "object" || typeof from == "function")
2584
+ for (let key of __getOwnPropNames2(from))
2585
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2586
+ return to;
2587
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getGroupPropParts_exports = {};
2588
+ __export2(getGroupPropParts_exports, {
2589
+ getGroupPropParts: () => getGroupPropParts
2590
+ });
2591
+ module2.exports = __toCommonJS2(getGroupPropParts_exports);
2592
+ var import_useMedia = require_useMedia_native();
2593
+ function getGroupPropParts(groupProp) {
2594
+ let mediaQueries = (0, import_useMedia.getMedia)(), [_, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
2595
+ return media ? pseudo = part4 : pseudo = part3, { name, pseudo, media };
2596
+ }
2597
+ }
2598
+ });
2599
+
2600
+ // ../web/dist/cjs/helpers/createMediaStyle.native.js
2601
+ var require_createMediaStyle_native = __commonJS({
2602
+ "../web/dist/cjs/helpers/createMediaStyle.native.js"(exports2, module2) {
2603
+ "use strict";
2604
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2605
+ for (var name in all)
2606
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2607
+ }, __copyProps2 = (to, from, except, desc) => {
2608
+ if (from && typeof from == "object" || typeof from == "function")
2609
+ for (let key of __getOwnPropNames2(from))
2610
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2611
+ return to;
2612
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createMediaStyle_exports = {};
2613
+ __export2(createMediaStyle_exports, {
2614
+ MEDIA_SEP: () => MEDIA_SEP,
2615
+ createMediaStyle: () => createMediaStyle
2616
+ });
2617
+ module2.exports = __toCommonJS2(createMediaStyle_exports);
2618
+ var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
2619
+ press: "active"
2620
+ }, createMediaStyle = (styleObject, mediaKeyIn, mediaQueries, type, negate, priority) => {
2621
+ let { property, identifier, rules } = styleObject, conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.mediaPropOrder, isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
2622
+ if (isNonWindowMedia) {
2623
+ let precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
2624
+ if (isTheme || isGroup) {
2625
+ let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
2626
+ groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
2627
+ let name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = conf.themeClassNameOnRoot && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? `:${pseudoSelectorName}` : "", presedencePrefix = `:root${precedenceImportancePrefix}${precedenceSpace}`, mediaSelector = `.t_${name}${pseudoSelector}`, nextSelector = `${presedencePrefix}${mediaSelector} ${selector.replace(
2628
+ ":root",
2629
+ ""
2630
+ )}`;
2631
+ styleRule = styleInner.replace(selector, nextSelector);
2632
+ } else
2633
+ styleRule = `${precedenceImportancePrefix}${styleInner}`;
2634
+ }
2635
+ if (!isNonWindowMedia || groupMediaKey) {
2636
+ if (!selectors) {
2637
+ let mediaKeys = Object.keys(mediaQueries);
2638
+ selectors = Object.fromEntries(
2639
+ mediaKeys.map((key) => [key, (0, import_useMedia.mediaObjectToString)(mediaQueries[key])])
2640
+ ), enableMediaPropOrder || (prefixes = Object.fromEntries(
2641
+ mediaKeys.map((k, index) => [k, new Array(index + 1).fill(":root").join("")])
2642
+ ));
2643
+ }
2644
+ let mediaKey = groupMediaKey || mediaKeyIn, mediaSelector = selectors[mediaKey], mediaQuery = `${negate ? "not all and " : ""}${mediaSelector}`, precedenceImportancePrefix = groupMediaKey ? "" : enableMediaPropOrder ? (
2645
+ // this new array should be cached
2646
+ new Array(priority).fill(":root").join("")
2647
+ ) : (
2648
+ // @ts-ignore
2649
+ prefixes[mediaKey]
2650
+ ), prefix = groupMediaKey ? `@container ${containerName}` : "@media";
2651
+ groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", ` and ${mediaQuery} {`).replace("and screen and", "and") : styleRule = `${prefix} ${mediaQuery}{${precedenceImportancePrefix}${styleInner}}`, groupMediaKey && (styleRule = `@supports (contain: ${conf.settings.webContainerType || "inline-size"}) {${styleRule}}`);
2652
+ }
2653
+ return {
2654
+ property,
2655
+ rules: [styleRule],
2656
+ identifier: nextIdentifier
2657
+ };
2658
+ };
2659
+ }
2660
+ });
2661
+
2662
+ // ../../node_modules/@react-native/normalize-color/index.js
2663
+ var require_normalize_color = __commonJS({
2664
+ "../../node_modules/@react-native/normalize-color/index.js"(exports2, module2) {
2665
+ "use strict";
2666
+ function normalizeColor(color) {
2667
+ if (typeof color == "number")
2668
+ return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
2669
+ if (typeof color != "string")
2670
+ return null;
2671
+ let matchers = getMatchers(), match;
2672
+ if (match = matchers.hex6.exec(color))
2673
+ return parseInt(match[1] + "ff", 16) >>> 0;
2674
+ let colorFromKeyword = normalizeKeyword(color);
2675
+ return colorFromKeyword ?? ((match = matchers.rgb.exec(color)) ? (parse255(match[1]) << 24 | // r
2676
+ parse255(match[2]) << 16 | // g
2677
+ parse255(match[3]) << 8 | // b
2678
+ 255) >>> // a
2679
+ 0 : (match = matchers.rgba.exec(color)) ? match[6] !== void 0 ? (parse255(match[6]) << 24 | // r
2680
+ parse255(match[7]) << 16 | // g
2681
+ parse255(match[8]) << 8 | // b
2682
+ parse1(match[9])) >>> // a
2683
+ 0 : (parse255(match[2]) << 24 | // r
2684
+ parse255(match[3]) << 16 | // g
2685
+ parse255(match[4]) << 8 | // b
2686
+ parse1(match[5])) >>> // a
2687
+ 0 : (match = matchers.hex3.exec(color)) ? parseInt(
2688
+ match[1] + match[1] + // r
2244
2689
  match[2] + match[2] + // g
2245
2690
  match[3] + match[3] + // b
2246
2691
  "ff",
@@ -3877,440 +4322,6 @@ var require_mergeProps_native = __commonJS({
3877
4322
  }
3878
4323
  });
3879
4324
 
3880
- // ../web/dist/cjs/helpers/ThemeManagerContext.native.js
3881
- var require_ThemeManagerContext_native = __commonJS({
3882
- "../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
3883
- "use strict";
3884
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
3885
- for (var name in all)
3886
- __defProp2(target, name, { get: all[name], enumerable: !0 });
3887
- }, __copyProps2 = (to, from, except, desc) => {
3888
- if (from && typeof from == "object" || typeof from == "function")
3889
- for (let key of __getOwnPropNames2(from))
3890
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
3891
- return to;
3892
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
3893
- __export2(ThemeManagerContext_exports, {
3894
- ThemeManagerIDContext: () => ThemeManagerIDContext
3895
- });
3896
- module2.exports = __toCommonJS2(ThemeManagerContext_exports);
3897
- var import_react2 = require("react"), ThemeManagerIDContext = (0, import_react2.createContext)(1);
3898
- }
3899
- });
3900
-
3901
- // ../web/dist/cjs/helpers/ThemeManager.native.js
3902
- var require_ThemeManager_native = __commonJS({
3903
- "../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
3904
- "use strict";
3905
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
3906
- for (var name in all)
3907
- __defProp2(target, name, { get: all[name], enumerable: !0 });
3908
- }, __copyProps2 = (to, from, except, desc) => {
3909
- if (from && typeof from == "object" || typeof from == "function")
3910
- for (let key of __getOwnPropNames2(from))
3911
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
3912
- return to;
3913
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
3914
- __export2(ThemeManager_exports, {
3915
- ThemeManager: () => ThemeManager,
3916
- getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
3917
- getManagers: () => getManagers
3918
- });
3919
- module2.exports = __toCommonJS2(ThemeManager_exports);
3920
- var import_constants4 = require_index_native(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
3921
- function getHasThemeUpdatingProps(props) {
3922
- return !!(props.name || props.componentName || props.inverse || props.reset);
3923
- }
3924
- var uid = 0, ThemeManager = class {
3925
- constructor(props = {}, parentManager) {
3926
- if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
3927
- this.updateStateFromProps(props, !1);
3928
- return;
3929
- }
3930
- if (!parentManager)
3931
- throw process.env.NODE_ENV !== "production" ? new Error(
3932
- "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
3933
- ) : "\u274C 000";
3934
- if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
3935
- return parentManager;
3936
- }
3937
- updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
3938
- if (this.props = props, props.forceTheme)
3939
- return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
3940
- let nextState = this.getStateIfChanged(props);
3941
- if (nextState)
3942
- return this.updateState(nextState, shouldNotify), nextState;
3943
- }
3944
- updateState(nextState, shouldNotify = !0) {
3945
- this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && this.notify();
3946
- }
3947
- getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
3948
- let _ = this.getState(props, parentManager);
3949
- if (state && state !== emptyState && !_)
3950
- return parentManager == null ? void 0 : parentManager.state;
3951
- if (this.getStateShouldChange(_, state))
3952
- return _;
3953
- }
3954
- getStateShouldChange(nextState, state = this.state) {
3955
- return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
3956
- }
3957
- getState(props = this.props, parentManager = this.parentManager) {
3958
- return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
3959
- }
3960
- get allKeys() {
3961
- var _a;
3962
- return this._allKeys ||= /* @__PURE__ */ new Set([
3963
- ...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
3964
- ...Object.keys(this.state.theme || {})
3965
- ]), this._allKeys;
3966
- }
3967
- notify(forced = !1) {
3968
- this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
3969
- }
3970
- onChangeTheme(cb, debugId) {
3971
- return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
3972
- this.themeListeners.delete(cb);
3973
- };
3974
- }
3975
- };
3976
- function getState(props, manager) {
3977
- var _a;
3978
- if (props.name && props.reset)
3979
- throw new Error(
3980
- process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
3981
- );
3982
- if (!getHasThemeUpdatingProps(props))
3983
- return null;
3984
- let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
3985
- if (!baseManager && props.reset)
3986
- return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
3987
- let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
3988
- baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
3989
- let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
3990
- isDirectParentAComponentTheme && allComponentThemes.shift();
3991
- let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max2 = base.length, min2 = props.componentName && !nextName ? max2 : 0;
3992
- for (let i = max2; i >= min2; i--) {
3993
- let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
3994
- props.inverse && (prefix = inverseThemeName(prefix));
3995
- let potentials = [];
3996
- if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
3997
- let lastSegment = potentials.findIndex((x) => !x.includes("_"));
3998
- lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
3999
- }
4000
- if (componentName && !props.reset) {
4001
- let baseLen = base.length, componentPotentials = [];
4002
- if (nextName && baseLen > 1) {
4003
- let beforeSeparator = base[0];
4004
- componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
4005
- }
4006
- if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
4007
- if (i > baseLen) {
4008
- let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
4009
- if (prefixLessOne) {
4010
- let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
4011
- componentPotentials.unshift(lessSpecific);
4012
- }
4013
- }
4014
- let moreSpecific = `${prefix}_${nextName}_${componentName}`;
4015
- componentPotentials.unshift(moreSpecific);
4016
- }
4017
- potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
4018
- }
4019
- let found = potentials.find((t) => t in themes);
4020
- if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
4021
- props,
4022
- found,
4023
- potentials,
4024
- baseManager,
4025
- nextName,
4026
- baseName,
4027
- prefix
4028
- }), found) {
4029
- let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants22.THEME_CLASSNAME_PREFIX, className = import_constants4.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
4030
- result = {
4031
- name: found,
4032
- parentName,
4033
- theme: themes[found],
4034
- className,
4035
- isComponent,
4036
- scheme
4037
- };
4038
- break;
4039
- }
4040
- }
4041
- return process.env.NODE_ENV !== "production" && props.debug === "verbose" && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min: min2, max: max2 }), console.warn("result", { result }), console.trace(), console.groupEnd()), result;
4042
- }
4043
- var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
4044
- function getManagers(themeManager) {
4045
- let comp = [], all = [], cur = themeManager;
4046
- for (; cur; )
4047
- all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
4048
- return [all, comp];
4049
- }
4050
- }
4051
- });
4052
-
4053
- // ../web/dist/cjs/hooks/useTheme.native.js
4054
- var require_useTheme_native = __commonJS({
4055
- "../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
4056
- "use strict";
4057
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4058
- for (var name in all)
4059
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4060
- }, __copyProps2 = (to, from, except, desc) => {
4061
- if (from && typeof from == "object" || typeof from == "function")
4062
- for (let key of __getOwnPropNames2(from))
4063
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4064
- return to;
4065
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
4066
- __export2(useTheme_exports, {
4067
- activeThemeManagers: () => activeThemeManagers,
4068
- getThemeManager: () => getThemeManager,
4069
- getThemeProxied: () => getThemeProxied,
4070
- useChangeThemeEffect: () => useChangeThemeEffect,
4071
- useTheme: () => useTheme4,
4072
- useThemeWithState: () => useThemeWithState
4073
- });
4074
- module2.exports = __toCommonJS2(useTheme_exports);
4075
- var import_constants4 = require_index_native(), import_react2 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), emptyProps = { name: null }, cached;
4076
- function getDefaultThemeProxied() {
4077
- if (cached)
4078
- return cached;
4079
- let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
4080
- return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
4081
- }
4082
- var useTheme4 = (props = emptyProps) => {
4083
- let [_, theme] = useThemeWithState(props);
4084
- return theme || getDefaultThemeProxied();
4085
- }, useThemeWithState = (props) => {
4086
- let keys = (0, import_react2.useRef)([]), changedThemeState = useChangeThemeEffect(
4087
- props,
4088
- !1,
4089
- keys.current,
4090
- import_constants4.isServer ? void 0 : () => {
4091
- var _a, _b;
4092
- let next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
4093
- return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
4094
- shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
4095
- keys: [...keys.current]
4096
- }), next;
4097
- }
4098
- ), { themeManager, state } = changedThemeState;
4099
- process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
4100
- `[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
4101
- props
4102
- )}).
4103
-
4104
- If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
4105
- ));
4106
- let themeProxied = (0, import_react2.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
4107
- return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
4108
- };
4109
- function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
4110
- if (!theme)
4111
- return {};
4112
- let config = (0, import_config.getConfig)();
4113
- function track(key) {
4114
- keys && !keys.includes(key) && (keys.push(key), process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`));
4115
- }
4116
- return new Proxy(theme, {
4117
- has(_, key) {
4118
- if (Reflect.has(theme, key))
4119
- return !0;
4120
- if (typeof key == "string")
4121
- return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
4122
- },
4123
- get(_, key) {
4124
- if (
4125
- // dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
4126
- // if someone is crazy enough to use "undefined" as a theme key then this not working is on them
4127
- key !== "undefined" && typeof key == "string"
4128
- ) {
4129
- let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
4130
- if (val && typeof val == "object")
4131
- return new Proxy(val, {
4132
- // when they touch the actual value we only track it
4133
- // if its a variable (web), its ignored!
4134
- get(_2, subkey) {
4135
- if (subkey === "val")
4136
- track(keyString);
4137
- else if (subkey === "get")
4138
- return (platform) => {
4139
- let outVal = (0, import_createVariable.getVariable)(val);
4140
- if (platform !== "web" && import_constants4.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
4141
- let oppositeThemeName = name.replace(
4142
- scheme === "dark" ? "dark" : "light",
4143
- scheme === "dark" ? "light" : "dark"
4144
- ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
4145
- if (oppositeVal)
4146
- return {
4147
- dynamic: {
4148
- dark: scheme === "dark" ? outVal : oppositeVal,
4149
- light: scheme === "light" ? outVal : oppositeVal
4150
- }
4151
- };
4152
- }
4153
- return track(keyString), outVal;
4154
- };
4155
- return Reflect.get(val, subkey);
4156
- }
4157
- });
4158
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_FEAT_THROW_ON_MISSING_THEME_VALUE === "1")
4159
- throw new Error(
4160
- `[tamagui] No theme key "${key}" found in theme ${name}.
4161
- Keys in theme: ${Object.keys(
4162
- theme
4163
- ).join(", ")}`
4164
- );
4165
- }
4166
- return Reflect.get(_, key);
4167
- }
4168
- });
4169
- }
4170
- function someParentIsInversed(manager) {
4171
- {
4172
- let cur = manager;
4173
- for (; cur; ) {
4174
- if (!cur.parentManager)
4175
- return !1;
4176
- if (cur.parentManager.state.scheme !== cur.state.scheme)
4177
- return !0;
4178
- cur = cur.parentManager;
4179
- }
4180
- }
4181
- return !1;
4182
- }
4183
- var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
4184
- if (!_idToUID[t.id]) {
4185
- let id = _idToUID[t.id] = {};
4186
- _uidToManager.set(id, t);
4187
- }
4188
- }, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
4189
- let { disable } = props, parentManagerId = (0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
4190
- if (!isRoot && !parentManager || disable)
4191
- return {
4192
- isNewTheme: !1,
4193
- state: parentManager == null ? void 0 : parentManager.state,
4194
- themeManager: parentManager
4195
- };
4196
- let [themeState, setThemeState] = (0, import_react2.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
4197
- function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
4198
- let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
4199
- if (!manager || !forceShouldChange && forceUpdate === !1)
4200
- return;
4201
- let next = nextState || manager.getState(props, parentManager);
4202
- if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
4203
- return next;
4204
- }
4205
- if (import_constants4.isServer || ((0, import_react2.useEffect)(() => {
4206
- if (!themeManager)
4207
- return;
4208
- if (props.inverse && !mounted) {
4209
- setThemeState((prev) => createState({
4210
- ...prev,
4211
- mounted: !0
4212
- }));
4213
- return;
4214
- }
4215
- (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
4216
- let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
4217
- forced && setThemeState((prev) => createState(prev, !0));
4218
- }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
4219
- (name, manager, forced) => {
4220
- let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
4221
- process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, {
4222
- force,
4223
- shouldTryUpdate,
4224
- props,
4225
- name,
4226
- manager,
4227
- keys
4228
- }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
4229
- },
4230
- themeManager.id
4231
- );
4232
- return () => {
4233
- selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
4234
- };
4235
- }, [
4236
- themeManager,
4237
- parentManager,
4238
- isNewTheme,
4239
- props.componentName,
4240
- props.inverse,
4241
- props.name,
4242
- props.reset,
4243
- mounted
4244
- ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react2.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
4245
- globalThis.TamaguiThemeManagers.delete(themeManager);
4246
- }), [themeManager])), isInversingOnMount)
4247
- return {
4248
- isNewTheme: !1,
4249
- inversed: !1,
4250
- themeManager: parentManager,
4251
- state: {
4252
- name: "",
4253
- ...parentManager == null ? void 0 : parentManager.state,
4254
- className: ""
4255
- }
4256
- };
4257
- return {
4258
- state,
4259
- isNewTheme,
4260
- inversed,
4261
- themeManager
4262
- };
4263
- function createState(prev, force = !1) {
4264
- if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
4265
- return prev;
4266
- let themeManager2 = parentManager, state2;
4267
- if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
4268
- let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
4269
- if (prev != null && prev.themeManager) {
4270
- themeManager2 = prev.themeManager;
4271
- let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
4272
- themeManager2,
4273
- next,
4274
- prev.state,
4275
- forceChange
4276
- );
4277
- nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
4278
- } else
4279
- themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
4280
- }
4281
- let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
4282
- isNewTheme2 && registerThemeManager(themeManager2);
4283
- let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4284
- state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
4285
- let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
4286
- themeManager: themeManager2,
4287
- isNewTheme: isNewTheme2,
4288
- mounted: mounted2,
4289
- inversed: inversed2
4290
- }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
4291
- (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
4292
- (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
4293
- if (prev && shouldReturnPrev)
4294
- return prev;
4295
- if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants4.isClient) {
4296
- console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
4297
- let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
4298
- console.info({
4299
- props,
4300
- parentState,
4301
- parentId,
4302
- themeManager: themeManager2,
4303
- prev,
4304
- response,
4305
- themeManagerState
4306
- }), console.groupEnd();
4307
- }
4308
- return response;
4309
- }
4310
- };
4311
- }
4312
- });
4313
-
4314
4325
  // ../web/dist/cjs/views/ThemeDebug.native.js
4315
4326
  var require_ThemeDebug_native = __commonJS({
4316
4327
  "../web/dist/cjs/views/ThemeDebug.native.js"(exports2, module2) {