tamagui 1.85.6 → 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 +2402 -2394
- package/dist/native.js.map +3 -3
- package/dist/test.native.js +566 -588
- package/dist/test.native.js.map +3 -3
- package/package.json +52 -52
package/dist/test.native.js
CHANGED
|
@@ -1304,7 +1304,7 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1304
1304
|
}
|
|
1305
1305
|
return scannedCache.set(sheet2, cacheKey), dedupedThemes;
|
|
1306
1306
|
}
|
|
1307
|
-
var colorVarToVal, rootComputedStyle = null;
|
|
1307
|
+
var colorVarToVal, rootComputedStyle = null, schemes = { dark: !0, light: !0 };
|
|
1308
1308
|
function addThemesFromCSS(cssStyleRule, tokens) {
|
|
1309
1309
|
let selectors = cssStyleRule.selectorText.split(",");
|
|
1310
1310
|
if (!selectors.length)
|
|
@@ -1340,11 +1340,11 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1340
1340
|
names: [
|
|
1341
1341
|
...new Set(
|
|
1342
1342
|
selectors.map((selector) => {
|
|
1343
|
-
let parts = selector.replace(/(.t_|:root)/g, "").trim().split(" "), [
|
|
1343
|
+
let parts = selector.replace(/(.t_|:root)/g, "").trim().split(" "), secondToLast = parts[parts.length - 2] || "", scheme = secondToLast.includes("dark") ? "dark" : secondToLast.includes("light") ? "light" : "", name = (() => {
|
|
1344
1344
|
let _ = parts[parts.length - 1];
|
|
1345
1345
|
return scheme && _.startsWith(scheme) && (_ = _.slice(scheme.length + 1)), _;
|
|
1346
1346
|
})();
|
|
1347
|
-
return `${scheme}${scheme && name ? "_" : ""}${name}`;
|
|
1347
|
+
return scheme === name || schemes[name] ? scheme : `${scheme}${scheme && name ? "_" : ""}${name}`;
|
|
1348
1348
|
})
|
|
1349
1349
|
)
|
|
1350
1350
|
],
|
|
@@ -1659,65 +1659,11 @@ var require_useMedia_native = __commonJS({
|
|
|
1659
1659
|
}
|
|
1660
1660
|
});
|
|
1661
1661
|
|
|
1662
|
-
// ../web/dist/cjs/
|
|
1663
|
-
var
|
|
1664
|
-
"../web/dist/cjs/
|
|
1665
|
-
"use strict";
|
|
1666
|
-
var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
1667
|
-
for (var name in all)
|
|
1668
|
-
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
1669
|
-
}, __copyProps2 = (to, from, except, desc) => {
|
|
1670
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
1671
|
-
for (let key of __getOwnPropNames2(from))
|
|
1672
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1673
|
-
return to;
|
|
1674
|
-
}, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
1675
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
1676
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
1677
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
1678
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
1679
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
1680
|
-
mod
|
|
1681
|
-
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
|
|
1682
|
-
__export2(Tamagui_exports, {
|
|
1683
|
-
Tamagui: () => Tamagui,
|
|
1684
|
-
getValueFromIdentifier: () => getValueFromIdentifier,
|
|
1685
|
-
setIdentifierValue: () => setIdentifierValue
|
|
1686
|
-
});
|
|
1687
|
-
module2.exports = __toCommonJS2(Tamagui_exports);
|
|
1688
|
-
var Helpers = __toESM2(require_index_native7()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), TamaguiManager = class {
|
|
1689
|
-
constructor() {
|
|
1690
|
-
this.Helpers = Helpers;
|
|
1691
|
-
}
|
|
1692
|
-
get mediaState() {
|
|
1693
|
-
return { ...import_useMedia.mediaState };
|
|
1694
|
-
}
|
|
1695
|
-
get config() {
|
|
1696
|
-
return (0, import_config.getConfig)();
|
|
1697
|
-
}
|
|
1698
|
-
get insertedRules() {
|
|
1699
|
-
return (0, import_insertStyleRule.getAllRules)();
|
|
1700
|
-
}
|
|
1701
|
-
get allSelectors() {
|
|
1702
|
-
return (0, import_insertStyleRule.getAllSelectors)();
|
|
1703
|
-
}
|
|
1704
|
-
get allTransforms() {
|
|
1705
|
-
return (0, import_insertStyleRule.getAllTransforms)();
|
|
1706
|
-
}
|
|
1707
|
-
get identifierToValue() {
|
|
1708
|
-
return identifierToValue;
|
|
1709
|
-
}
|
|
1710
|
-
}, Tamagui = new TamaguiManager(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
|
|
1711
|
-
identifierToValue.set(identifier, value);
|
|
1712
|
-
};
|
|
1713
|
-
}
|
|
1714
|
-
});
|
|
1715
|
-
|
|
1716
|
-
// ../compose-refs/dist/cjs/compose-refs.native.js
|
|
1717
|
-
var require_compose_refs_native = __commonJS({
|
|
1718
|
-
"../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
|
|
1662
|
+
// ../web/dist/cjs/helpers/createShallowSetState.native.js
|
|
1663
|
+
var require_createShallowSetState_native = __commonJS({
|
|
1664
|
+
"../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
|
|
1719
1665
|
"use strict";
|
|
1720
|
-
var
|
|
1666
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
1721
1667
|
for (var name in all)
|
|
1722
1668
|
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
1723
1669
|
}, __copyProps2 = (to, from, except, desc) => {
|
|
@@ -1725,47 +1671,28 @@ var require_compose_refs_native = __commonJS({
|
|
|
1725
1671
|
for (let key of __getOwnPropNames2(from))
|
|
1726
1672
|
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1727
1673
|
return to;
|
|
1728
|
-
},
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
1734
|
-
mod
|
|
1735
|
-
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
|
|
1736
|
-
__export2(compose_refs_exports, {
|
|
1737
|
-
composeRefs: () => composeRefs,
|
|
1738
|
-
useComposedRefs: () => useComposedRefs
|
|
1674
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
|
|
1675
|
+
__export2(createShallowSetState_exports, {
|
|
1676
|
+
createShallowSetState: () => createShallowSetState,
|
|
1677
|
+
isEqualShallow: () => isEqualShallow,
|
|
1678
|
+
mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
|
|
1739
1679
|
});
|
|
1740
|
-
module2.exports = __toCommonJS2(
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
typeof ref == "function" ? ref(value) : ref && (ref.current = value);
|
|
1680
|
+
module2.exports = __toCommonJS2(createShallowSetState_exports);
|
|
1681
|
+
function createShallowSetState(setter, debug) {
|
|
1682
|
+
return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
|
|
1744
1683
|
}
|
|
1745
|
-
function
|
|
1746
|
-
return (
|
|
1684
|
+
function mergeIfNotShallowEqual(prev, next, debug) {
|
|
1685
|
+
return isEqualShallow(prev, next) ? prev : { ...prev, ...next };
|
|
1747
1686
|
}
|
|
1748
|
-
function
|
|
1749
|
-
|
|
1687
|
+
function isEqualShallow(prev, next) {
|
|
1688
|
+
for (let key in next)
|
|
1689
|
+
if (prev[key] !== next[key])
|
|
1690
|
+
return !1;
|
|
1691
|
+
return !0;
|
|
1750
1692
|
}
|
|
1751
1693
|
}
|
|
1752
1694
|
});
|
|
1753
1695
|
|
|
1754
|
-
// ../compose-refs/dist/cjs/index.native.js
|
|
1755
|
-
var require_index_native10 = __commonJS({
|
|
1756
|
-
"../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
|
|
1757
|
-
"use strict";
|
|
1758
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
|
|
1759
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
1760
|
-
for (let key of __getOwnPropNames2(from))
|
|
1761
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1762
|
-
return to;
|
|
1763
|
-
}, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
|
|
1764
|
-
module2.exports = __toCommonJS2(src_exports2);
|
|
1765
|
-
__reExport2(src_exports2, require_compose_refs_native(), module2.exports);
|
|
1766
|
-
}
|
|
1767
|
-
});
|
|
1768
|
-
|
|
1769
1696
|
// ../web/dist/cjs/constants/constants.native.js
|
|
1770
1697
|
var require_constants_native2 = __commonJS({
|
|
1771
1698
|
"../web/dist/cjs/constants/constants.native.js"(exports2, module2) {
|
|
@@ -1800,9 +1727,9 @@ var require_constants_native2 = __commonJS({
|
|
|
1800
1727
|
}
|
|
1801
1728
|
});
|
|
1802
1729
|
|
|
1803
|
-
// ../web/dist/cjs/helpers/
|
|
1804
|
-
var
|
|
1805
|
-
"../web/dist/cjs/helpers/
|
|
1730
|
+
// ../web/dist/cjs/helpers/ThemeManager.native.js
|
|
1731
|
+
var require_ThemeManager_native = __commonJS({
|
|
1732
|
+
"../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
|
|
1806
1733
|
"use strict";
|
|
1807
1734
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
1808
1735
|
for (var name in all)
|
|
@@ -1812,34 +1739,149 @@ var require_objectIdentityKey_native = __commonJS({
|
|
|
1812
1739
|
for (let key of __getOwnPropNames2(from))
|
|
1813
1740
|
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1814
1741
|
return to;
|
|
1815
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod),
|
|
1816
|
-
__export2(
|
|
1817
|
-
|
|
1742
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
|
|
1743
|
+
__export2(ThemeManager_exports, {
|
|
1744
|
+
ThemeManager: () => ThemeManager,
|
|
1745
|
+
getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
|
|
1746
|
+
getManagers: () => getManagers
|
|
1818
1747
|
});
|
|
1819
|
-
module2.exports = __toCommonJS2(
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
else {
|
|
1830
|
-
let v = Math.random();
|
|
1831
|
-
cache.set(arg, v), k += v;
|
|
1748
|
+
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
1749
|
+
var import_constants4 = require_index_native(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
1750
|
+
function getHasThemeUpdatingProps(props) {
|
|
1751
|
+
return !!(props.name || props.componentName || props.inverse || props.reset);
|
|
1752
|
+
}
|
|
1753
|
+
var uid = 0, ThemeManager = class {
|
|
1754
|
+
constructor(props = {}, parentManager) {
|
|
1755
|
+
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") {
|
|
1756
|
+
this.updateStateFromProps(props, !1);
|
|
1757
|
+
return;
|
|
1832
1758
|
}
|
|
1759
|
+
if (!parentManager)
|
|
1760
|
+
throw new Error(
|
|
1761
|
+
"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."
|
|
1762
|
+
);
|
|
1763
|
+
if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
|
|
1764
|
+
return parentManager;
|
|
1833
1765
|
}
|
|
1834
|
-
|
|
1766
|
+
updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
|
|
1767
|
+
if (this.props = props, props.forceTheme)
|
|
1768
|
+
return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
|
|
1769
|
+
let nextState = this.getStateIfChanged(props);
|
|
1770
|
+
if (nextState)
|
|
1771
|
+
return this.updateState(nextState, shouldNotify), nextState;
|
|
1772
|
+
}
|
|
1773
|
+
updateState(nextState, shouldNotify = !0) {
|
|
1774
|
+
this.state = nextState, this._allKeys = null, this._numChangeEventsSent ??= 0, this._numChangeEventsSent++, shouldNotify && this.notify();
|
|
1775
|
+
}
|
|
1776
|
+
getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
|
|
1777
|
+
let _ = this.getState(props, parentManager);
|
|
1778
|
+
if (state && state !== emptyState && !_)
|
|
1779
|
+
return parentManager == null ? void 0 : parentManager.state;
|
|
1780
|
+
if (this.getStateShouldChange(_, state))
|
|
1781
|
+
return _;
|
|
1782
|
+
}
|
|
1783
|
+
getStateShouldChange(nextState, state = this.state) {
|
|
1784
|
+
return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
|
|
1785
|
+
}
|
|
1786
|
+
getState(props = this.props, parentManager = this.parentManager) {
|
|
1787
|
+
return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
|
|
1788
|
+
}
|
|
1789
|
+
get allKeys() {
|
|
1790
|
+
var _a;
|
|
1791
|
+
return this._allKeys ||= /* @__PURE__ */ new Set([
|
|
1792
|
+
...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
|
|
1793
|
+
...Object.keys(this.state.theme || {})
|
|
1794
|
+
]), this._allKeys;
|
|
1795
|
+
}
|
|
1796
|
+
notify(forced = !1) {
|
|
1797
|
+
this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
|
|
1798
|
+
}
|
|
1799
|
+
onChangeTheme(cb, debugId) {
|
|
1800
|
+
return debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
|
|
1801
|
+
this.themeListeners.delete(cb);
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
function getState(props, manager) {
|
|
1806
|
+
var _a;
|
|
1807
|
+
if (props.name && props.reset)
|
|
1808
|
+
throw new Error(
|
|
1809
|
+
"Cannot reset and set a new name at the same time."
|
|
1810
|
+
);
|
|
1811
|
+
if (!getHasThemeUpdatingProps(props))
|
|
1812
|
+
return null;
|
|
1813
|
+
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];
|
|
1814
|
+
if (!baseManager && props.reset)
|
|
1815
|
+
return console.warn("Cannot reset, no parent theme exists"), null;
|
|
1816
|
+
let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
|
|
1817
|
+
baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
|
|
1818
|
+
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
1819
|
+
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
1820
|
+
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max2 = base.length, min2 = props.componentName && !nextName ? max2 : 0;
|
|
1821
|
+
for (let i = max2; i >= min2; i--) {
|
|
1822
|
+
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
1823
|
+
props.inverse && (prefix = inverseThemeName(prefix));
|
|
1824
|
+
let potentials = [];
|
|
1825
|
+
if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
|
|
1826
|
+
let lastSegment = potentials.findIndex((x) => !x.includes("_"));
|
|
1827
|
+
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
1828
|
+
}
|
|
1829
|
+
if (componentName && !props.reset) {
|
|
1830
|
+
let baseLen = base.length, componentPotentials = [];
|
|
1831
|
+
if (nextName && baseLen > 1) {
|
|
1832
|
+
let beforeSeparator = base[0];
|
|
1833
|
+
componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
|
|
1834
|
+
}
|
|
1835
|
+
if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
|
|
1836
|
+
if (i > baseLen) {
|
|
1837
|
+
let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
1838
|
+
if (prefixLessOne) {
|
|
1839
|
+
let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
|
|
1840
|
+
componentPotentials.unshift(lessSpecific);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
let moreSpecific = `${prefix}_${nextName}_${componentName}`;
|
|
1844
|
+
componentPotentials.unshift(moreSpecific);
|
|
1845
|
+
}
|
|
1846
|
+
potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
|
|
1847
|
+
}
|
|
1848
|
+
let found = potentials.find((t) => t in themes);
|
|
1849
|
+
if (typeof props.debug == "string" && console.info(" getState ", {
|
|
1850
|
+
props,
|
|
1851
|
+
found,
|
|
1852
|
+
potentials,
|
|
1853
|
+
baseManager,
|
|
1854
|
+
nextName,
|
|
1855
|
+
baseName,
|
|
1856
|
+
prefix
|
|
1857
|
+
}), found) {
|
|
1858
|
+
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;
|
|
1859
|
+
result = {
|
|
1860
|
+
name: found,
|
|
1861
|
+
parentName,
|
|
1862
|
+
theme: themes[found],
|
|
1863
|
+
className,
|
|
1864
|
+
isComponent,
|
|
1865
|
+
scheme
|
|
1866
|
+
};
|
|
1867
|
+
break;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
return 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;
|
|
1871
|
+
}
|
|
1872
|
+
var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
|
|
1873
|
+
function getManagers(themeManager) {
|
|
1874
|
+
let comp = [], all = [], cur = themeManager;
|
|
1875
|
+
for (; cur; )
|
|
1876
|
+
all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
|
|
1877
|
+
return [all, comp];
|
|
1835
1878
|
}
|
|
1836
|
-
var cache = /* @__PURE__ */ new WeakMap();
|
|
1837
1879
|
}
|
|
1838
1880
|
});
|
|
1839
1881
|
|
|
1840
|
-
// ../web/dist/cjs/helpers/
|
|
1841
|
-
var
|
|
1842
|
-
"../web/dist/cjs/helpers/
|
|
1882
|
+
// ../web/dist/cjs/helpers/ThemeManagerContext.native.js
|
|
1883
|
+
var require_ThemeManagerContext_native = __commonJS({
|
|
1884
|
+
"../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
|
|
1843
1885
|
"use strict";
|
|
1844
1886
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
1845
1887
|
for (var name in all)
|
|
@@ -1849,40 +1891,18 @@ var require_createStyledContext_native = __commonJS({
|
|
|
1849
1891
|
for (let key of __getOwnPropNames2(from))
|
|
1850
1892
|
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1851
1893
|
return to;
|
|
1852
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod),
|
|
1853
|
-
__export2(
|
|
1854
|
-
|
|
1894
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
|
|
1895
|
+
__export2(ThemeManagerContext_exports, {
|
|
1896
|
+
ThemeManagerIDContext: () => ThemeManagerIDContext
|
|
1855
1897
|
});
|
|
1856
|
-
module2.exports = __toCommonJS2(
|
|
1857
|
-
var import_react2 = require("react"),
|
|
1858
|
-
function createStyledContext2(defaultValues) {
|
|
1859
|
-
let OGContext = (0, import_react2.createContext)(defaultValues), OGProvider2 = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
|
|
1860
|
-
children,
|
|
1861
|
-
scope,
|
|
1862
|
-
...values
|
|
1863
|
-
}) => {
|
|
1864
|
-
let next = (0, import_react2.useMemo)(() => ({
|
|
1865
|
-
// this ! is a workaround for ts error
|
|
1866
|
-
...defaultValues,
|
|
1867
|
-
...values
|
|
1868
|
-
}), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider2;
|
|
1869
|
-
if (scope) {
|
|
1870
|
-
let ScopedContext = scopedContexts.get(scope);
|
|
1871
|
-
ScopedContext || (ScopedContext = (0, import_react2.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
1872
|
-
}
|
|
1873
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Provider2, { value: next, children });
|
|
1874
|
-
}, useStyledContext = (scope) => {
|
|
1875
|
-
let context = scope ? scopedContexts.get(scope) : OGContext;
|
|
1876
|
-
return (0, import_react2.useContext)(context);
|
|
1877
|
-
};
|
|
1878
|
-
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
1879
|
-
}
|
|
1898
|
+
module2.exports = __toCommonJS2(ThemeManagerContext_exports);
|
|
1899
|
+
var import_react2 = require("react"), ThemeManagerIDContext = (0, import_react2.createContext)(1);
|
|
1880
1900
|
}
|
|
1881
1901
|
});
|
|
1882
1902
|
|
|
1883
|
-
// ../web/dist/cjs/
|
|
1884
|
-
var
|
|
1885
|
-
"../web/dist/cjs/
|
|
1903
|
+
// ../web/dist/cjs/hooks/useTheme.native.js
|
|
1904
|
+
var require_useTheme_native = __commonJS({
|
|
1905
|
+
"../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
|
|
1886
1906
|
"use strict";
|
|
1887
1907
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
1888
1908
|
for (var name in all)
|
|
@@ -1892,22 +1912,405 @@ var require_ComponentContext_native = __commonJS({
|
|
|
1892
1912
|
for (let key of __getOwnPropNames2(from))
|
|
1893
1913
|
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1894
1914
|
return to;
|
|
1895
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod),
|
|
1896
|
-
__export2(
|
|
1897
|
-
|
|
1915
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
|
|
1916
|
+
__export2(useTheme_exports, {
|
|
1917
|
+
activeThemeManagers: () => activeThemeManagers,
|
|
1918
|
+
getThemeManager: () => getThemeManager,
|
|
1919
|
+
getThemeProxied: () => getThemeProxied,
|
|
1920
|
+
useChangeThemeEffect: () => useChangeThemeEffect,
|
|
1921
|
+
useTheme: () => useTheme4,
|
|
1922
|
+
useThemeWithState: () => useThemeWithState
|
|
1898
1923
|
});
|
|
1899
|
-
module2.exports = __toCommonJS2(
|
|
1900
|
-
var
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1924
|
+
module2.exports = __toCommonJS2(useTheme_exports);
|
|
1925
|
+
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;
|
|
1926
|
+
function getDefaultThemeProxied() {
|
|
1927
|
+
if (cached)
|
|
1928
|
+
return cached;
|
|
1929
|
+
let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
|
|
1930
|
+
return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
|
|
1931
|
+
}
|
|
1932
|
+
var useTheme4 = (props = emptyProps) => {
|
|
1933
|
+
let [_, theme] = useThemeWithState(props);
|
|
1934
|
+
return theme || getDefaultThemeProxied();
|
|
1935
|
+
}, useThemeWithState = (props) => {
|
|
1936
|
+
let keys = (0, import_react2.useRef)([]), changedThemeState = useChangeThemeEffect(
|
|
1937
|
+
props,
|
|
1938
|
+
!1,
|
|
1939
|
+
keys.current,
|
|
1940
|
+
import_constants4.isServer ? void 0 : () => {
|
|
1941
|
+
var _a, _b;
|
|
1942
|
+
return ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
|
|
1943
|
+
}
|
|
1944
|
+
), { themeManager, state } = changedThemeState, 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]);
|
|
1945
|
+
return [changedThemeState, themeProxied];
|
|
1946
|
+
};
|
|
1947
|
+
function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
|
|
1948
|
+
if (!theme)
|
|
1949
|
+
return {};
|
|
1950
|
+
let config = (0, import_config.getConfig)();
|
|
1951
|
+
function track(key) {
|
|
1952
|
+
keys && !keys.includes(key) && keys.push(key);
|
|
1909
1953
|
}
|
|
1910
|
-
|
|
1954
|
+
return new Proxy(theme, {
|
|
1955
|
+
has(_, key) {
|
|
1956
|
+
if (Reflect.has(theme, key))
|
|
1957
|
+
return !0;
|
|
1958
|
+
if (typeof key == "string")
|
|
1959
|
+
return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
|
|
1960
|
+
},
|
|
1961
|
+
get(_, key) {
|
|
1962
|
+
if (
|
|
1963
|
+
// dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
|
|
1964
|
+
// if someone is crazy enough to use "undefined" as a theme key then this not working is on them
|
|
1965
|
+
key !== "undefined" && typeof key == "string"
|
|
1966
|
+
) {
|
|
1967
|
+
let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
|
|
1968
|
+
if (val && typeof val == "object")
|
|
1969
|
+
return new Proxy(val, {
|
|
1970
|
+
// when they touch the actual value we only track it
|
|
1971
|
+
// if its a variable (web), its ignored!
|
|
1972
|
+
get(_2, subkey) {
|
|
1973
|
+
if (subkey === "val")
|
|
1974
|
+
track(keyString);
|
|
1975
|
+
else if (subkey === "get")
|
|
1976
|
+
return (platform) => {
|
|
1977
|
+
let outVal = (0, import_createVariable.getVariable)(val);
|
|
1978
|
+
if (platform !== "web" && import_constants4.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
|
|
1979
|
+
let oppositeThemeName = name.replace(
|
|
1980
|
+
scheme === "dark" ? "dark" : "light",
|
|
1981
|
+
scheme === "dark" ? "light" : "dark"
|
|
1982
|
+
), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
|
|
1983
|
+
if (oppositeVal)
|
|
1984
|
+
return {
|
|
1985
|
+
dynamic: {
|
|
1986
|
+
dark: scheme === "dark" ? outVal : oppositeVal,
|
|
1987
|
+
light: scheme === "light" ? outVal : oppositeVal
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
return track(keyString), outVal;
|
|
1992
|
+
};
|
|
1993
|
+
return Reflect.get(val, subkey);
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
return Reflect.get(_, key);
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
function someParentIsInversed(manager) {
|
|
2002
|
+
{
|
|
2003
|
+
let cur = manager;
|
|
2004
|
+
for (; cur; ) {
|
|
2005
|
+
if (!cur.parentManager)
|
|
2006
|
+
return !1;
|
|
2007
|
+
if (cur.parentManager.state.scheme !== cur.state.scheme)
|
|
2008
|
+
return !0;
|
|
2009
|
+
cur = cur.parentManager;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
return !1;
|
|
2013
|
+
}
|
|
2014
|
+
var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
|
|
2015
|
+
if (!_idToUID[t.id]) {
|
|
2016
|
+
let id = _idToUID[t.id] = {};
|
|
2017
|
+
_uidToManager.set(id, t);
|
|
2018
|
+
}
|
|
2019
|
+
}, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
|
|
2020
|
+
let { disable } = props, parentManagerId = (0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
|
|
2021
|
+
if (!isRoot && !parentManager || disable)
|
|
2022
|
+
return {
|
|
2023
|
+
isNewTheme: !1,
|
|
2024
|
+
state: parentManager == null ? void 0 : parentManager.state,
|
|
2025
|
+
themeManager: parentManager
|
|
2026
|
+
};
|
|
2027
|
+
let [themeState, setThemeState] = (0, import_react2.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
|
|
2028
|
+
function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
|
|
2029
|
+
let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
|
|
2030
|
+
if (!manager || !forceShouldChange && forceUpdate === !1)
|
|
2031
|
+
return;
|
|
2032
|
+
let next = nextState || manager.getState(props, parentManager);
|
|
2033
|
+
if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
|
|
2034
|
+
return next;
|
|
2035
|
+
}
|
|
2036
|
+
if (import_constants4.isServer || (0, import_react2.useEffect)(() => {
|
|
2037
|
+
if (!themeManager)
|
|
2038
|
+
return;
|
|
2039
|
+
if (props.inverse && !mounted) {
|
|
2040
|
+
setThemeState((prev) => createState({
|
|
2041
|
+
...prev,
|
|
2042
|
+
mounted: !0
|
|
2043
|
+
}));
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
(isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
|
|
2047
|
+
let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
|
|
2048
|
+
forced && setThemeState((prev) => createState(prev, !0));
|
|
2049
|
+
}), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
|
|
2050
|
+
(name, manager, forced) => {
|
|
2051
|
+
let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"];
|
|
2052
|
+
(force ?? !!(keys != null && keys.length || isNewTheme)) && setThemeState((prev) => createState(prev, force));
|
|
2053
|
+
},
|
|
2054
|
+
themeManager.id
|
|
2055
|
+
);
|
|
2056
|
+
return () => {
|
|
2057
|
+
selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
|
|
2058
|
+
};
|
|
2059
|
+
}, [
|
|
2060
|
+
themeManager,
|
|
2061
|
+
parentManager,
|
|
2062
|
+
isNewTheme,
|
|
2063
|
+
props.componentName,
|
|
2064
|
+
props.inverse,
|
|
2065
|
+
props.name,
|
|
2066
|
+
props.reset,
|
|
2067
|
+
mounted
|
|
2068
|
+
]), isInversingOnMount)
|
|
2069
|
+
return {
|
|
2070
|
+
isNewTheme: !1,
|
|
2071
|
+
inversed: !1,
|
|
2072
|
+
themeManager: parentManager,
|
|
2073
|
+
state: {
|
|
2074
|
+
name: "",
|
|
2075
|
+
...parentManager == null ? void 0 : parentManager.state,
|
|
2076
|
+
className: ""
|
|
2077
|
+
}
|
|
2078
|
+
};
|
|
2079
|
+
return {
|
|
2080
|
+
state,
|
|
2081
|
+
isNewTheme,
|
|
2082
|
+
inversed,
|
|
2083
|
+
themeManager
|
|
2084
|
+
};
|
|
2085
|
+
function createState(prev, force = !1) {
|
|
2086
|
+
if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
|
|
2087
|
+
return prev;
|
|
2088
|
+
let themeManager2 = parentManager, state2;
|
|
2089
|
+
if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
|
|
2090
|
+
let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
|
|
2091
|
+
if (prev != null && prev.themeManager) {
|
|
2092
|
+
themeManager2 = prev.themeManager;
|
|
2093
|
+
let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
|
|
2094
|
+
themeManager2,
|
|
2095
|
+
next,
|
|
2096
|
+
prev.state,
|
|
2097
|
+
forceChange
|
|
2098
|
+
);
|
|
2099
|
+
nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
|
|
2100
|
+
} else
|
|
2101
|
+
themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
|
|
2102
|
+
}
|
|
2103
|
+
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
|
|
2104
|
+
isNewTheme2 && registerThemeManager(themeManager2);
|
|
2105
|
+
let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
2106
|
+
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
2107
|
+
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 = {
|
|
2108
|
+
themeManager: themeManager2,
|
|
2109
|
+
isNewTheme: isNewTheme2,
|
|
2110
|
+
mounted: mounted2,
|
|
2111
|
+
inversed: inversed2
|
|
2112
|
+
}, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
|
|
2113
|
+
(0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
|
|
2114
|
+
(0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
|
|
2115
|
+
return prev && shouldReturnPrev ? prev : (response.state = state2, response);
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2119
|
+
});
|
|
2120
|
+
|
|
2121
|
+
// ../web/dist/cjs/Tamagui.native.js
|
|
2122
|
+
var require_Tamagui_native = __commonJS({
|
|
2123
|
+
"../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
|
|
2124
|
+
"use strict";
|
|
2125
|
+
var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
2126
|
+
for (var name in all)
|
|
2127
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
2128
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
2129
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
2130
|
+
for (let key of __getOwnPropNames2(from))
|
|
2131
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2132
|
+
return to;
|
|
2133
|
+
}, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
2134
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
2135
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
2136
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
2137
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
2138
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
2139
|
+
mod
|
|
2140
|
+
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
|
|
2141
|
+
__export2(Tamagui_exports, {
|
|
2142
|
+
Tamagui: () => Tamagui,
|
|
2143
|
+
getValueFromIdentifier: () => getValueFromIdentifier,
|
|
2144
|
+
setIdentifierValue: () => setIdentifierValue
|
|
2145
|
+
});
|
|
2146
|
+
module2.exports = __toCommonJS2(Tamagui_exports);
|
|
2147
|
+
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 = void 0, identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
|
|
2148
|
+
identifierToValue.set(identifier, value);
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
|
|
2153
|
+
// ../compose-refs/dist/cjs/compose-refs.native.js
|
|
2154
|
+
var require_compose_refs_native = __commonJS({
|
|
2155
|
+
"../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
|
|
2156
|
+
"use strict";
|
|
2157
|
+
var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
2158
|
+
for (var name in all)
|
|
2159
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
2160
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
2161
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
2162
|
+
for (let key of __getOwnPropNames2(from))
|
|
2163
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2164
|
+
return to;
|
|
2165
|
+
}, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
2166
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
2167
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
2168
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
2169
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
2170
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
2171
|
+
mod
|
|
2172
|
+
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
|
|
2173
|
+
__export2(compose_refs_exports, {
|
|
2174
|
+
composeRefs: () => composeRefs,
|
|
2175
|
+
useComposedRefs: () => useComposedRefs
|
|
2176
|
+
});
|
|
2177
|
+
module2.exports = __toCommonJS2(compose_refs_exports);
|
|
2178
|
+
var React2 = __toESM2(require("react"));
|
|
2179
|
+
function setRef(ref, value) {
|
|
2180
|
+
typeof ref == "function" ? ref(value) : ref && (ref.current = value);
|
|
2181
|
+
}
|
|
2182
|
+
function composeRefs(...refs) {
|
|
2183
|
+
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
2184
|
+
}
|
|
2185
|
+
function useComposedRefs(...refs) {
|
|
2186
|
+
return React2.useCallback(composeRefs(...refs), refs);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
|
|
2191
|
+
// ../compose-refs/dist/cjs/index.native.js
|
|
2192
|
+
var require_index_native10 = __commonJS({
|
|
2193
|
+
"../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
|
|
2194
|
+
"use strict";
|
|
2195
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
|
|
2196
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
2197
|
+
for (let key of __getOwnPropNames2(from))
|
|
2198
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2199
|
+
return to;
|
|
2200
|
+
}, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
|
|
2201
|
+
module2.exports = __toCommonJS2(src_exports2);
|
|
2202
|
+
__reExport2(src_exports2, require_compose_refs_native(), module2.exports);
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
|
|
2206
|
+
// ../web/dist/cjs/helpers/objectIdentityKey.native.js
|
|
2207
|
+
var require_objectIdentityKey_native = __commonJS({
|
|
2208
|
+
"../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
|
|
2209
|
+
"use strict";
|
|
2210
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
2211
|
+
for (var name in all)
|
|
2212
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
2213
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
2214
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
2215
|
+
for (let key of __getOwnPropNames2(from))
|
|
2216
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2217
|
+
return to;
|
|
2218
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
|
|
2219
|
+
__export2(objectIdentityKey_exports, {
|
|
2220
|
+
objectIdentityKey: () => objectIdentityKey
|
|
2221
|
+
});
|
|
2222
|
+
module2.exports = __toCommonJS2(objectIdentityKey_exports);
|
|
2223
|
+
function objectIdentityKey(obj) {
|
|
2224
|
+
let k = "";
|
|
2225
|
+
for (let key in obj) {
|
|
2226
|
+
k += key;
|
|
2227
|
+
let arg = obj[key], type = typeof arg;
|
|
2228
|
+
if (!arg || type !== "object" && type !== "function")
|
|
2229
|
+
k += type + arg;
|
|
2230
|
+
else if (cache.has(arg))
|
|
2231
|
+
k += cache.get(arg);
|
|
2232
|
+
else {
|
|
2233
|
+
let v = Math.random();
|
|
2234
|
+
cache.set(arg, v), k += v;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
return k;
|
|
2238
|
+
}
|
|
2239
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
|
2240
|
+
}
|
|
2241
|
+
});
|
|
2242
|
+
|
|
2243
|
+
// ../web/dist/cjs/helpers/createStyledContext.native.js
|
|
2244
|
+
var require_createStyledContext_native = __commonJS({
|
|
2245
|
+
"../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
|
|
2246
|
+
"use strict";
|
|
2247
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
2248
|
+
for (var name in all)
|
|
2249
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
2250
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
2251
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
2252
|
+
for (let key of __getOwnPropNames2(from))
|
|
2253
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2254
|
+
return to;
|
|
2255
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
|
|
2256
|
+
__export2(createStyledContext_exports, {
|
|
2257
|
+
createStyledContext: () => createStyledContext2
|
|
2258
|
+
});
|
|
2259
|
+
module2.exports = __toCommonJS2(createStyledContext_exports);
|
|
2260
|
+
var import_react2 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2261
|
+
function createStyledContext2(defaultValues) {
|
|
2262
|
+
let OGContext = (0, import_react2.createContext)(defaultValues), OGProvider2 = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
|
|
2263
|
+
children,
|
|
2264
|
+
scope,
|
|
2265
|
+
...values
|
|
2266
|
+
}) => {
|
|
2267
|
+
let next = (0, import_react2.useMemo)(() => ({
|
|
2268
|
+
// this ! is a workaround for ts error
|
|
2269
|
+
...defaultValues,
|
|
2270
|
+
...values
|
|
2271
|
+
}), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider2;
|
|
2272
|
+
if (scope) {
|
|
2273
|
+
let ScopedContext = scopedContexts.get(scope);
|
|
2274
|
+
ScopedContext || (ScopedContext = (0, import_react2.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
2275
|
+
}
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Provider2, { value: next, children });
|
|
2277
|
+
}, useStyledContext = (scope) => {
|
|
2278
|
+
let context = scope ? scopedContexts.get(scope) : OGContext;
|
|
2279
|
+
return (0, import_react2.useContext)(context);
|
|
2280
|
+
};
|
|
2281
|
+
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
|
|
2286
|
+
// ../web/dist/cjs/contexts/ComponentContext.native.js
|
|
2287
|
+
var require_ComponentContext_native = __commonJS({
|
|
2288
|
+
"../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
|
|
2289
|
+
"use strict";
|
|
2290
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
2291
|
+
for (var name in all)
|
|
2292
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
2293
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
2294
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
2295
|
+
for (let key of __getOwnPropNames2(from))
|
|
2296
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
2297
|
+
return to;
|
|
2298
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
|
|
2299
|
+
__export2(ComponentContext_exports, {
|
|
2300
|
+
ComponentContext: () => ComponentContext2
|
|
2301
|
+
});
|
|
2302
|
+
module2.exports = __toCommonJS2(ComponentContext_exports);
|
|
2303
|
+
var import_createStyledContext = require_createStyledContext_native(), ComponentContext2 = (0, import_createStyledContext.createStyledContext)({
|
|
2304
|
+
disableSSR: void 0,
|
|
2305
|
+
inText: !1,
|
|
2306
|
+
language: null,
|
|
2307
|
+
animationDriver: null,
|
|
2308
|
+
groups: {
|
|
2309
|
+
emit: null,
|
|
2310
|
+
subscribe: null,
|
|
2311
|
+
state: {}
|
|
2312
|
+
}
|
|
2313
|
+
});
|
|
1911
2314
|
}
|
|
1912
2315
|
});
|
|
1913
2316
|
|
|
@@ -1946,40 +2349,6 @@ var require_defaultComponentState_native = __commonJS({
|
|
|
1946
2349
|
}
|
|
1947
2350
|
});
|
|
1948
2351
|
|
|
1949
|
-
// ../web/dist/cjs/helpers/createShallowSetState.native.js
|
|
1950
|
-
var require_createShallowSetState_native = __commonJS({
|
|
1951
|
-
"../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
|
|
1952
|
-
"use strict";
|
|
1953
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
1954
|
-
for (var name in all)
|
|
1955
|
-
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
1956
|
-
}, __copyProps2 = (to, from, except, desc) => {
|
|
1957
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
1958
|
-
for (let key of __getOwnPropNames2(from))
|
|
1959
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1960
|
-
return to;
|
|
1961
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
|
|
1962
|
-
__export2(createShallowSetState_exports, {
|
|
1963
|
-
createShallowSetState: () => createShallowSetState,
|
|
1964
|
-
isEqualShallow: () => isEqualShallow,
|
|
1965
|
-
mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
|
|
1966
|
-
});
|
|
1967
|
-
module2.exports = __toCommonJS2(createShallowSetState_exports);
|
|
1968
|
-
function createShallowSetState(setter, debug) {
|
|
1969
|
-
return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
|
|
1970
|
-
}
|
|
1971
|
-
function mergeIfNotShallowEqual(prev, next, debug) {
|
|
1972
|
-
return isEqualShallow(prev, next) ? prev : { ...prev, ...next };
|
|
1973
|
-
}
|
|
1974
|
-
function isEqualShallow(prev, next) {
|
|
1975
|
-
for (let key in next)
|
|
1976
|
-
if (prev[key] !== next[key])
|
|
1977
|
-
return !1;
|
|
1978
|
-
return !0;
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
});
|
|
1982
|
-
|
|
1983
2352
|
// ../web/dist/cjs/constants/accessibilityDirectMap.native.js
|
|
1984
2353
|
var require_accessibilityDirectMap_native = __commonJS({
|
|
1985
2354
|
"../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
|
|
@@ -3722,397 +4091,6 @@ var require_mergeProps_native = __commonJS({
|
|
|
3722
4091
|
}
|
|
3723
4092
|
});
|
|
3724
4093
|
|
|
3725
|
-
// ../web/dist/cjs/helpers/ThemeManagerContext.native.js
|
|
3726
|
-
var require_ThemeManagerContext_native = __commonJS({
|
|
3727
|
-
"../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
|
|
3728
|
-
"use strict";
|
|
3729
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
3730
|
-
for (var name in all)
|
|
3731
|
-
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
3732
|
-
}, __copyProps2 = (to, from, except, desc) => {
|
|
3733
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
3734
|
-
for (let key of __getOwnPropNames2(from))
|
|
3735
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
3736
|
-
return to;
|
|
3737
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
|
|
3738
|
-
__export2(ThemeManagerContext_exports, {
|
|
3739
|
-
ThemeManagerIDContext: () => ThemeManagerIDContext
|
|
3740
|
-
});
|
|
3741
|
-
module2.exports = __toCommonJS2(ThemeManagerContext_exports);
|
|
3742
|
-
var import_react2 = require("react"), ThemeManagerIDContext = (0, import_react2.createContext)(1);
|
|
3743
|
-
}
|
|
3744
|
-
});
|
|
3745
|
-
|
|
3746
|
-
// ../web/dist/cjs/helpers/ThemeManager.native.js
|
|
3747
|
-
var require_ThemeManager_native = __commonJS({
|
|
3748
|
-
"../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
|
|
3749
|
-
"use strict";
|
|
3750
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
3751
|
-
for (var name in all)
|
|
3752
|
-
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
3753
|
-
}, __copyProps2 = (to, from, except, desc) => {
|
|
3754
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
3755
|
-
for (let key of __getOwnPropNames2(from))
|
|
3756
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
3757
|
-
return to;
|
|
3758
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
|
|
3759
|
-
__export2(ThemeManager_exports, {
|
|
3760
|
-
ThemeManager: () => ThemeManager,
|
|
3761
|
-
getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
|
|
3762
|
-
getManagers: () => getManagers
|
|
3763
|
-
});
|
|
3764
|
-
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
3765
|
-
var import_constants4 = require_index_native(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
3766
|
-
function getHasThemeUpdatingProps(props) {
|
|
3767
|
-
return !!(props.name || props.componentName || props.inverse || props.reset);
|
|
3768
|
-
}
|
|
3769
|
-
var uid = 0, ThemeManager = class {
|
|
3770
|
-
constructor(props = {}, parentManager) {
|
|
3771
|
-
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") {
|
|
3772
|
-
this.updateStateFromProps(props, !1);
|
|
3773
|
-
return;
|
|
3774
|
-
}
|
|
3775
|
-
if (!parentManager)
|
|
3776
|
-
throw new Error(
|
|
3777
|
-
"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."
|
|
3778
|
-
);
|
|
3779
|
-
if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
|
|
3780
|
-
return parentManager;
|
|
3781
|
-
}
|
|
3782
|
-
updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
|
|
3783
|
-
if (this.props = props, props.forceTheme)
|
|
3784
|
-
return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
|
|
3785
|
-
let nextState = this.getStateIfChanged(props);
|
|
3786
|
-
if (nextState)
|
|
3787
|
-
return this.updateState(nextState, shouldNotify), nextState;
|
|
3788
|
-
}
|
|
3789
|
-
updateState(nextState, shouldNotify = !0) {
|
|
3790
|
-
this.state = nextState, this._allKeys = null, this._numChangeEventsSent ??= 0, this._numChangeEventsSent++, shouldNotify && this.notify();
|
|
3791
|
-
}
|
|
3792
|
-
getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
|
|
3793
|
-
let _ = this.getState(props, parentManager);
|
|
3794
|
-
if (state && state !== emptyState && !_)
|
|
3795
|
-
return parentManager == null ? void 0 : parentManager.state;
|
|
3796
|
-
if (this.getStateShouldChange(_, state))
|
|
3797
|
-
return _;
|
|
3798
|
-
}
|
|
3799
|
-
getStateShouldChange(nextState, state = this.state) {
|
|
3800
|
-
return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
|
|
3801
|
-
}
|
|
3802
|
-
getState(props = this.props, parentManager = this.parentManager) {
|
|
3803
|
-
return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
|
|
3804
|
-
}
|
|
3805
|
-
get allKeys() {
|
|
3806
|
-
var _a;
|
|
3807
|
-
return this._allKeys ||= /* @__PURE__ */ new Set([
|
|
3808
|
-
...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
|
|
3809
|
-
...Object.keys(this.state.theme || {})
|
|
3810
|
-
]), this._allKeys;
|
|
3811
|
-
}
|
|
3812
|
-
notify(forced = !1) {
|
|
3813
|
-
this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
|
|
3814
|
-
}
|
|
3815
|
-
onChangeTheme(cb, debugId) {
|
|
3816
|
-
return debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
|
|
3817
|
-
this.themeListeners.delete(cb);
|
|
3818
|
-
};
|
|
3819
|
-
}
|
|
3820
|
-
};
|
|
3821
|
-
function getState(props, manager) {
|
|
3822
|
-
var _a;
|
|
3823
|
-
if (props.name && props.reset)
|
|
3824
|
-
throw new Error(
|
|
3825
|
-
"Cannot reset and set a new name at the same time."
|
|
3826
|
-
);
|
|
3827
|
-
if (!getHasThemeUpdatingProps(props))
|
|
3828
|
-
return null;
|
|
3829
|
-
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];
|
|
3830
|
-
if (!baseManager && props.reset)
|
|
3831
|
-
return console.warn("Cannot reset, no parent theme exists"), null;
|
|
3832
|
-
let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
|
|
3833
|
-
baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
|
|
3834
|
-
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
3835
|
-
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
3836
|
-
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max2 = base.length, min2 = props.componentName && !nextName ? max2 : 0;
|
|
3837
|
-
for (let i = max2; i >= min2; i--) {
|
|
3838
|
-
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
3839
|
-
props.inverse && (prefix = inverseThemeName(prefix));
|
|
3840
|
-
let potentials = [];
|
|
3841
|
-
if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
|
|
3842
|
-
let lastSegment = potentials.findIndex((x) => !x.includes("_"));
|
|
3843
|
-
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
3844
|
-
}
|
|
3845
|
-
if (componentName && !props.reset) {
|
|
3846
|
-
let baseLen = base.length, componentPotentials = [];
|
|
3847
|
-
if (nextName && baseLen > 1) {
|
|
3848
|
-
let beforeSeparator = base[0];
|
|
3849
|
-
componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
|
|
3850
|
-
}
|
|
3851
|
-
if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
|
|
3852
|
-
if (i > baseLen) {
|
|
3853
|
-
let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
3854
|
-
if (prefixLessOne) {
|
|
3855
|
-
let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
|
|
3856
|
-
componentPotentials.unshift(lessSpecific);
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
let moreSpecific = `${prefix}_${nextName}_${componentName}`;
|
|
3860
|
-
componentPotentials.unshift(moreSpecific);
|
|
3861
|
-
}
|
|
3862
|
-
potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
|
|
3863
|
-
}
|
|
3864
|
-
let found = potentials.find((t) => t in themes);
|
|
3865
|
-
if (typeof props.debug == "string" && console.info(" getState ", {
|
|
3866
|
-
props,
|
|
3867
|
-
found,
|
|
3868
|
-
potentials,
|
|
3869
|
-
baseManager,
|
|
3870
|
-
nextName,
|
|
3871
|
-
baseName,
|
|
3872
|
-
prefix
|
|
3873
|
-
}), found) {
|
|
3874
|
-
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;
|
|
3875
|
-
result = {
|
|
3876
|
-
name: found,
|
|
3877
|
-
parentName,
|
|
3878
|
-
theme: themes[found],
|
|
3879
|
-
className,
|
|
3880
|
-
isComponent,
|
|
3881
|
-
scheme
|
|
3882
|
-
};
|
|
3883
|
-
break;
|
|
3884
|
-
}
|
|
3885
|
-
}
|
|
3886
|
-
return 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;
|
|
3887
|
-
}
|
|
3888
|
-
var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
|
|
3889
|
-
function getManagers(themeManager) {
|
|
3890
|
-
let comp = [], all = [], cur = themeManager;
|
|
3891
|
-
for (; cur; )
|
|
3892
|
-
all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
|
|
3893
|
-
return [all, comp];
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
|
-
});
|
|
3897
|
-
|
|
3898
|
-
// ../web/dist/cjs/hooks/useTheme.native.js
|
|
3899
|
-
var require_useTheme_native = __commonJS({
|
|
3900
|
-
"../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
|
|
3901
|
-
"use strict";
|
|
3902
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
3903
|
-
for (var name in all)
|
|
3904
|
-
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
3905
|
-
}, __copyProps2 = (to, from, except, desc) => {
|
|
3906
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
3907
|
-
for (let key of __getOwnPropNames2(from))
|
|
3908
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
3909
|
-
return to;
|
|
3910
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
|
|
3911
|
-
__export2(useTheme_exports, {
|
|
3912
|
-
activeThemeManagers: () => activeThemeManagers,
|
|
3913
|
-
getThemeManager: () => getThemeManager,
|
|
3914
|
-
getThemeProxied: () => getThemeProxied,
|
|
3915
|
-
useChangeThemeEffect: () => useChangeThemeEffect,
|
|
3916
|
-
useTheme: () => useTheme4,
|
|
3917
|
-
useThemeWithState: () => useThemeWithState
|
|
3918
|
-
});
|
|
3919
|
-
module2.exports = __toCommonJS2(useTheme_exports);
|
|
3920
|
-
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;
|
|
3921
|
-
function getDefaultThemeProxied() {
|
|
3922
|
-
if (cached)
|
|
3923
|
-
return cached;
|
|
3924
|
-
let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
|
|
3925
|
-
return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
|
|
3926
|
-
}
|
|
3927
|
-
var useTheme4 = (props = emptyProps) => {
|
|
3928
|
-
let [_, theme] = useThemeWithState(props);
|
|
3929
|
-
return theme || getDefaultThemeProxied();
|
|
3930
|
-
}, useThemeWithState = (props) => {
|
|
3931
|
-
let keys = (0, import_react2.useRef)([]), changedThemeState = useChangeThemeEffect(
|
|
3932
|
-
props,
|
|
3933
|
-
!1,
|
|
3934
|
-
keys.current,
|
|
3935
|
-
import_constants4.isServer ? void 0 : () => {
|
|
3936
|
-
var _a, _b;
|
|
3937
|
-
return ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
|
|
3938
|
-
}
|
|
3939
|
-
), { themeManager, state } = changedThemeState, 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]);
|
|
3940
|
-
return [changedThemeState, themeProxied];
|
|
3941
|
-
};
|
|
3942
|
-
function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
|
|
3943
|
-
if (!theme)
|
|
3944
|
-
return {};
|
|
3945
|
-
let config = (0, import_config.getConfig)();
|
|
3946
|
-
function track(key) {
|
|
3947
|
-
keys && !keys.includes(key) && keys.push(key);
|
|
3948
|
-
}
|
|
3949
|
-
return new Proxy(theme, {
|
|
3950
|
-
has(_, key) {
|
|
3951
|
-
if (Reflect.has(theme, key))
|
|
3952
|
-
return !0;
|
|
3953
|
-
if (typeof key == "string")
|
|
3954
|
-
return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
|
|
3955
|
-
},
|
|
3956
|
-
get(_, key) {
|
|
3957
|
-
if (
|
|
3958
|
-
// dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
|
|
3959
|
-
// if someone is crazy enough to use "undefined" as a theme key then this not working is on them
|
|
3960
|
-
key !== "undefined" && typeof key == "string"
|
|
3961
|
-
) {
|
|
3962
|
-
let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
|
|
3963
|
-
if (val && typeof val == "object")
|
|
3964
|
-
return new Proxy(val, {
|
|
3965
|
-
// when they touch the actual value we only track it
|
|
3966
|
-
// if its a variable (web), its ignored!
|
|
3967
|
-
get(_2, subkey) {
|
|
3968
|
-
if (subkey === "val")
|
|
3969
|
-
track(keyString);
|
|
3970
|
-
else if (subkey === "get")
|
|
3971
|
-
return (platform) => {
|
|
3972
|
-
let outVal = (0, import_createVariable.getVariable)(val);
|
|
3973
|
-
if (platform !== "web" && import_constants4.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
|
|
3974
|
-
let oppositeThemeName = name.replace(
|
|
3975
|
-
scheme === "dark" ? "dark" : "light",
|
|
3976
|
-
scheme === "dark" ? "light" : "dark"
|
|
3977
|
-
), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
|
|
3978
|
-
if (oppositeVal)
|
|
3979
|
-
return {
|
|
3980
|
-
dynamic: {
|
|
3981
|
-
dark: scheme === "dark" ? outVal : oppositeVal,
|
|
3982
|
-
light: scheme === "light" ? outVal : oppositeVal
|
|
3983
|
-
}
|
|
3984
|
-
};
|
|
3985
|
-
}
|
|
3986
|
-
return track(keyString), outVal;
|
|
3987
|
-
};
|
|
3988
|
-
return Reflect.get(val, subkey);
|
|
3989
|
-
}
|
|
3990
|
-
});
|
|
3991
|
-
}
|
|
3992
|
-
return Reflect.get(_, key);
|
|
3993
|
-
}
|
|
3994
|
-
});
|
|
3995
|
-
}
|
|
3996
|
-
function someParentIsInversed(manager) {
|
|
3997
|
-
{
|
|
3998
|
-
let cur = manager;
|
|
3999
|
-
for (; cur; ) {
|
|
4000
|
-
if (!cur.parentManager)
|
|
4001
|
-
return !1;
|
|
4002
|
-
if (cur.parentManager.state.scheme !== cur.state.scheme)
|
|
4003
|
-
return !0;
|
|
4004
|
-
cur = cur.parentManager;
|
|
4005
|
-
}
|
|
4006
|
-
}
|
|
4007
|
-
return !1;
|
|
4008
|
-
}
|
|
4009
|
-
var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
|
|
4010
|
-
if (!_idToUID[t.id]) {
|
|
4011
|
-
let id = _idToUID[t.id] = {};
|
|
4012
|
-
_uidToManager.set(id, t);
|
|
4013
|
-
}
|
|
4014
|
-
}, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
|
|
4015
|
-
let { disable } = props, parentManagerId = (0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
|
|
4016
|
-
if (!isRoot && !parentManager || disable)
|
|
4017
|
-
return {
|
|
4018
|
-
isNewTheme: !1,
|
|
4019
|
-
state: parentManager == null ? void 0 : parentManager.state,
|
|
4020
|
-
themeManager: parentManager
|
|
4021
|
-
};
|
|
4022
|
-
let [themeState, setThemeState] = (0, import_react2.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
|
|
4023
|
-
function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
|
|
4024
|
-
let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
|
|
4025
|
-
if (!manager || !forceShouldChange && forceUpdate === !1)
|
|
4026
|
-
return;
|
|
4027
|
-
let next = nextState || manager.getState(props, parentManager);
|
|
4028
|
-
if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
|
|
4029
|
-
return next;
|
|
4030
|
-
}
|
|
4031
|
-
if (import_constants4.isServer || (0, import_react2.useEffect)(() => {
|
|
4032
|
-
if (!themeManager)
|
|
4033
|
-
return;
|
|
4034
|
-
if (props.inverse && !mounted) {
|
|
4035
|
-
setThemeState((prev) => createState({
|
|
4036
|
-
...prev,
|
|
4037
|
-
mounted: !0
|
|
4038
|
-
}));
|
|
4039
|
-
return;
|
|
4040
|
-
}
|
|
4041
|
-
(isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
|
|
4042
|
-
let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
|
|
4043
|
-
forced && setThemeState((prev) => createState(prev, !0));
|
|
4044
|
-
}), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
|
|
4045
|
-
(name, manager, forced) => {
|
|
4046
|
-
let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"];
|
|
4047
|
-
(force ?? !!(keys != null && keys.length || isNewTheme)) && setThemeState((prev) => createState(prev, force));
|
|
4048
|
-
},
|
|
4049
|
-
themeManager.id
|
|
4050
|
-
);
|
|
4051
|
-
return () => {
|
|
4052
|
-
selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
|
|
4053
|
-
};
|
|
4054
|
-
}, [
|
|
4055
|
-
themeManager,
|
|
4056
|
-
parentManager,
|
|
4057
|
-
isNewTheme,
|
|
4058
|
-
props.componentName,
|
|
4059
|
-
props.inverse,
|
|
4060
|
-
props.name,
|
|
4061
|
-
props.reset,
|
|
4062
|
-
mounted
|
|
4063
|
-
]), isInversingOnMount)
|
|
4064
|
-
return {
|
|
4065
|
-
isNewTheme: !1,
|
|
4066
|
-
inversed: !1,
|
|
4067
|
-
themeManager: parentManager,
|
|
4068
|
-
state: {
|
|
4069
|
-
name: "",
|
|
4070
|
-
...parentManager == null ? void 0 : parentManager.state,
|
|
4071
|
-
className: ""
|
|
4072
|
-
}
|
|
4073
|
-
};
|
|
4074
|
-
return {
|
|
4075
|
-
state,
|
|
4076
|
-
isNewTheme,
|
|
4077
|
-
inversed,
|
|
4078
|
-
themeManager
|
|
4079
|
-
};
|
|
4080
|
-
function createState(prev, force = !1) {
|
|
4081
|
-
if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
|
|
4082
|
-
return prev;
|
|
4083
|
-
let themeManager2 = parentManager, state2;
|
|
4084
|
-
if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
|
|
4085
|
-
let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
|
|
4086
|
-
if (prev != null && prev.themeManager) {
|
|
4087
|
-
themeManager2 = prev.themeManager;
|
|
4088
|
-
let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
|
|
4089
|
-
themeManager2,
|
|
4090
|
-
next,
|
|
4091
|
-
prev.state,
|
|
4092
|
-
forceChange
|
|
4093
|
-
);
|
|
4094
|
-
nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
|
|
4095
|
-
} else
|
|
4096
|
-
themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
|
|
4097
|
-
}
|
|
4098
|
-
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
|
|
4099
|
-
isNewTheme2 && registerThemeManager(themeManager2);
|
|
4100
|
-
let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
4101
|
-
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
4102
|
-
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 = {
|
|
4103
|
-
themeManager: themeManager2,
|
|
4104
|
-
isNewTheme: isNewTheme2,
|
|
4105
|
-
mounted: mounted2,
|
|
4106
|
-
inversed: inversed2
|
|
4107
|
-
}, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
|
|
4108
|
-
(0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
|
|
4109
|
-
(0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
|
|
4110
|
-
return prev && shouldReturnPrev ? prev : (response.state = state2, response);
|
|
4111
|
-
}
|
|
4112
|
-
};
|
|
4113
|
-
}
|
|
4114
|
-
});
|
|
4115
|
-
|
|
4116
4094
|
// ../web/dist/cjs/views/ThemeDebug.native.js
|
|
4117
4095
|
var require_ThemeDebug_native = __commonJS({
|
|
4118
4096
|
"../web/dist/cjs/views/ThemeDebug.native.js"(exports2, module2) {
|