@tamagui/web 3.0.0-beta.1604.1 → 3.0.0-beta.1670.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.native.cjs +1 -1
- package/dist/cjs/createComponent.native.js +1 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createTamagui.cjs +10 -8
- package/dist/cjs/createTamagui.native.cjs +10 -8
- package/dist/cjs/createTamagui.native.js +10 -8
- package/dist/cjs/createTamagui.native.js.map +1 -1
- package/dist/cjs/eventHandling.native.cjs +28 -4
- package/dist/cjs/eventHandling.native.js +28 -4
- package/dist/cjs/eventHandling.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +5 -7
- package/dist/cjs/helpers/getSplitStyles.native.cjs +6 -8
- package/dist/cjs/helpers/getSplitStyles.native.js +6 -8
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeToParents.cjs +2 -1
- package/dist/cjs/helpers/proxyThemeToParents.native.cjs +2 -1
- package/dist/cjs/helpers/proxyThemeToParents.native.js +2 -1
- package/dist/cjs/helpers/proxyThemeToParents.native.js.map +1 -1
- package/dist/cjs/helpers/themes.cjs +19 -11
- package/dist/cjs/helpers/themes.native.cjs +19 -11
- package/dist/cjs/helpers/themes.native.js +19 -11
- package/dist/cjs/helpers/themes.native.js.map +1 -1
- package/dist/cjs/hooks/useThemeState.cjs +9 -19
- package/dist/cjs/hooks/useThemeState.native.cjs +16 -22
- package/dist/cjs/hooks/useThemeState.native.js +16 -22
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +2 -0
- package/dist/cjs/internal-runtime.native.cjs +2 -0
- package/dist/cjs/internal-runtime.native.js +2 -0
- package/dist/cjs/internal-runtime.native.js.map +1 -1
- package/dist/esm/createComponent.native.js +1 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createTamagui.mjs +11 -9
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +11 -9
- package/dist/esm/createTamagui.native.js.map +1 -1
- package/dist/esm/eventHandling.native.js +28 -4
- package/dist/esm/eventHandling.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +5 -7
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +6 -8
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/proxyThemeToParents.mjs +3 -1
- package/dist/esm/helpers/proxyThemeToParents.mjs.map +1 -1
- package/dist/esm/helpers/proxyThemeToParents.native.js +3 -1
- package/dist/esm/helpers/proxyThemeToParents.native.js.map +1 -1
- package/dist/esm/helpers/themes.mjs +15 -11
- package/dist/esm/helpers/themes.mjs.map +1 -1
- package/dist/esm/helpers/themes.native.js +15 -11
- package/dist/esm/helpers/themes.native.js.map +1 -1
- package/dist/esm/hooks/useThemeState.mjs +8 -20
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +16 -22
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/internal-runtime.mjs +3 -2
- package/dist/esm/internal-runtime.mjs.map +1 -1
- package/dist/esm/internal-runtime.native.js +3 -2
- package/dist/esm/internal-runtime.native.js.map +1 -1
- package/package.json +17 -17
- package/src/createComponent.tsx +1 -1
- package/src/createTamagui.ts +17 -21
- package/src/eventHandling.native.ts +24 -3
- package/src/helpers/getSplitStyles.tsx +13 -8
- package/src/helpers/proxyThemeToParents.ts +2 -1
- package/src/helpers/themes.ts +17 -11
- package/src/hooks/useThemeState.ts +15 -35
- package/src/internal-runtime.ts +6 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/eventHandling.native.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/proxyThemeToParents.d.ts.map +1 -1
- package/types/helpers/themes.d.ts +2 -0
- package/types/helpers/themes.d.ts.map +1 -1
- package/types/hooks/useThemeState.d.ts.map +1 -1
- package/types/internal-runtime.d.ts +1 -0
- package/types/internal-runtime.d.ts.map +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { copyAuthoredThemeScheme } from "./themes.mjs";
|
|
2
|
+
|
|
1
3
|
const themesRaw = {};
|
|
2
4
|
function proxyThemesToParents(dedupedThemes, declarationOrder) {
|
|
3
5
|
for (const { names, theme } of dedupedThemes) {
|
|
@@ -31,7 +33,7 @@ function proxyThemeToParents(themeName, theme) {
|
|
|
31
33
|
Object.assign(out, themesRaw[parent]);
|
|
32
34
|
}
|
|
33
35
|
Object.assign(out, theme);
|
|
34
|
-
return out;
|
|
36
|
+
return copyAuthoredThemeScheme(out, theme);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export { proxyThemeToParents, proxyThemesToParents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyThemeToParents.js","names":[],"sources":["esm/helpers/proxyThemeToParents.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"proxyThemeToParents.js","names":[],"sources":["esm/helpers/proxyThemeToParents.js"],"sourcesContent":["import { copyAuthoredThemeScheme } from \"./themes\";\nconst themesRaw = {};\nfunction proxyThemesToParents(dedupedThemes, declarationOrder) {\n for (const { names, theme } of dedupedThemes) {\n for (const name of names) {\n themesRaw[name] = theme;\n }\n }\n const themes = {};\n for (const { names, theme } of dedupedThemes) {\n for (const themeName of names) {\n const proxiedTheme = proxyThemeToParents(themeName, theme);\n themes[themeName] = proxiedTheme;\n }\n }\n if (declarationOrder) {\n const ordered = {};\n for (const k of declarationOrder) if (k in themes) ordered[k] = themes[k];\n for (const k in themes) if (!(k in ordered)) ordered[k] = themes[k];\n return ordered;\n }\n return themes;\n}\nfunction proxyThemeToParents(themeName, theme) {\n const out = {};\n const cur = [];\n const parents = themeName.split(\"_\").slice(0, -1).map((part) => {\n cur.push(part);\n return cur.join(\"_\");\n });\n for (const parent of parents) {\n Object.assign(out, themesRaw[parent]);\n }\n Object.assign(out, theme);\n return copyAuthoredThemeScheme(out, theme);\n}\nexport {\n proxyThemeToParents,\n proxyThemesToParents\n};\n//# sourceMappingURL=proxyThemeToParents.js.map\n"],"mappings":";;;AACA,MAAM,YAAY,CAAC;AACnB,SAAS,qBAAqB,eAAe,kBAAkB;CAC7D,KAAK,MAAM,EAAE,OAAO,WAAW,eAAe;EAC5C,KAAK,MAAM,QAAQ,OAAO;GACxB,UAAU,QAAQ;EACpB;CACF;CACA,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,EAAE,OAAO,WAAW,eAAe;EAC5C,KAAK,MAAM,aAAa,OAAO;GAC7B,MAAM,eAAe,oBAAoB,WAAW,KAAK;GACzD,OAAO,aAAa;EACtB;CACF;CACA,IAAI,kBAAkB;EACpB,MAAM,UAAU,CAAC;EACjB,KAAK,MAAM,KAAK,kBAAkB,IAAI,KAAK,QAAQ,QAAQ,KAAK,OAAO;EACvE,KAAK,MAAM,KAAK,QAAQ,IAAI,EAAE,KAAK,UAAU,QAAQ,KAAK,OAAO;EACjE,OAAO;CACT;CACA,OAAO;AACT;AACA,SAAS,oBAAoB,WAAW,OAAO;CAC7C,MAAM,MAAM,CAAC;CACb,MAAM,MAAM,CAAC;CACb,MAAM,UAAU,UAAU,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS;EAC9D,IAAI,KAAK,IAAI;EACb,OAAO,IAAI,KAAK,GAAG;CACrB,CAAC;CACD,KAAK,MAAM,UAAU,SAAS;EAC5B,OAAO,OAAO,KAAK,UAAU,OAAO;CACtC;CACA,OAAO,OAAO,KAAK,KAAK;CACxB,OAAO,wBAAwB,KAAK,KAAK;AAC3C"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { copyAuthoredThemeScheme } from "./themes.native.js";
|
|
2
|
+
|
|
1
3
|
var themesRaw = {};
|
|
2
4
|
function proxyThemesToParents(dedupedThemes, declarationOrder) {
|
|
3
5
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
@@ -135,7 +137,7 @@ function proxyThemeToParents(themeName, theme) {
|
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
Object.assign(out, theme);
|
|
138
|
-
return out;
|
|
140
|
+
return copyAuthoredThemeScheme(out, theme);
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
export { proxyThemeToParents, proxyThemesToParents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyThemeToParents.native.js","names":[],"sources":["esm/helpers/proxyThemeToParents.native.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"proxyThemeToParents.native.js","names":[],"sources":["esm/helpers/proxyThemeToParents.native.js"],"sourcesContent":["import { copyAuthoredThemeScheme } from \"./themes\";\nvar themesRaw = {};\nfunction proxyThemesToParents(dedupedThemes, declarationOrder) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = dedupedThemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var { names, theme } = _step.value;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = names[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var name = _step1.value;\n themesRaw[name] = theme;\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var themes = {};\n var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n try {\n for (var _iterator2 = dedupedThemes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var { names: names1, theme: theme1 } = _step2.value;\n var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;\n try {\n for (var _iterator3 = names1[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var themeName = _step3.value;\n var proxiedTheme = proxyThemeToParents(themeName, theme1);\n themes[themeName] = proxiedTheme;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n if (declarationOrder) {\n var ordered = {};\n var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;\n try {\n for (var _iterator4 = declarationOrder[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var k = _step4.value;\n if (k in themes) ordered[k] = themes[k];\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n for (var k1 in themes) if (!(k1 in ordered)) ordered[k1] = themes[k1];\n return ordered;\n }\n return themes;\n}\nfunction proxyThemeToParents(themeName, theme) {\n var out = {};\n var cur = [];\n var parents = themeName.split(\"_\").slice(0, -1).map(function(part) {\n cur.push(part);\n return cur.join(\"_\");\n });\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = parents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var parent = _step.value;\n Object.assign(out, themesRaw[parent]);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n Object.assign(out, theme);\n return copyAuthoredThemeScheme(out, theme);\n}\nexport {\n proxyThemeToParents,\n proxyThemesToParents\n};\n//# sourceMappingURL=proxyThemeToParents.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,CAAC;AACjB,SAAS,qBAAqB,eAAe,kBAAkB;CAC7D,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,YAAY,cAAc,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GAC9J,IAAI,EAAE,OAAO,UAAU,MAAM;GAC7B,IAAI,6BAA6B,MAAM,qBAAqB,OAAO,kBAAkB,KAAK;GAC1F,IAAI;IACF,KAAK,IAAI,aAAa,MAAM,OAAO,SAAS,CAAC,GAAG,QAAQ,EAAE,8BAA8B,SAAS,WAAW,KAAK,EAAC,CAAE,OAAO,6BAA6B,MAAM;KAC5J,IAAI,OAAO,OAAO;KAClB,UAAU,QAAQ;IACpB;GACF,SAAS,KAAK;IACZ,qBAAqB;IACrB,kBAAkB;GACpB,UAAU;IACR,IAAI;KACF,IAAI,CAAC,8BAA8B,WAAW,UAAU,MAAM;MAC5D,W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;EACF,UAAU;GACR,IAAI,mBAAmB;IACrB,MAAM;GACR;EACF;CACF;CACA,OAAO,OAAO,KAAK,KAAK;CACxB,OAAO,wBAAwB,KAAK,KAAK;AAC3C"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { createVariable, isVariable } from "../createVariable.mjs";
|
|
2
2
|
|
|
3
|
+
const schemeKey = /* @__PURE__ */ Symbol.for("tamagui.theme.scheme");
|
|
4
|
+
function getAuthoredThemeScheme(theme) {
|
|
5
|
+
const scheme = theme[schemeKey];
|
|
6
|
+
return scheme === "light" || scheme === "dark" ? scheme : void 0;
|
|
7
|
+
}
|
|
8
|
+
function copyAuthoredThemeScheme(target, source) {
|
|
9
|
+
const scheme = getAuthoredThemeScheme(source);
|
|
10
|
+
if (scheme) Object.defineProperty(target, schemeKey, { value: scheme });
|
|
11
|
+
return target;
|
|
12
|
+
}
|
|
3
13
|
function ensureThemeVariable(theme, key) {
|
|
4
14
|
const val = theme[key];
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
7
|
-
theme[key] = createVariable({
|
|
8
|
-
key,
|
|
9
|
-
name: key,
|
|
10
|
-
val: value
|
|
11
|
-
});
|
|
12
|
-
} else if (val.name !== key) {
|
|
15
|
+
const variable = isVariable(val);
|
|
16
|
+
if (!variable || val.name !== key) {
|
|
13
17
|
theme[key] = createVariable({
|
|
14
|
-
key: val.name,
|
|
18
|
+
key: variable ? val.name : key,
|
|
15
19
|
name: key,
|
|
16
|
-
val:
|
|
20
|
+
val: variable ? val.val : val
|
|
17
21
|
});
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export { ensureThemeVariable };
|
|
25
|
+
export { copyAuthoredThemeScheme, ensureThemeVariable, getAuthoredThemeScheme };
|
|
22
26
|
//# sourceMappingURL=themes.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","names":[],"sources":["esm/helpers/themes.js"],"sourcesContent":["import { createVariable, isVariable } from \"../createVariable\";\nfunction
|
|
1
|
+
{"version":3,"file":"themes.js","names":[],"sources":["esm/helpers/themes.js"],"sourcesContent":["import { createVariable, isVariable } from \"../createVariable\";\nconst schemeKey = /* @__PURE__ */ Symbol.for(\"tamagui.theme.scheme\");\nfunction getAuthoredThemeScheme(theme) {\n const scheme = theme[schemeKey];\n return scheme === \"light\" || scheme === \"dark\" ? scheme : void 0;\n}\nfunction copyAuthoredThemeScheme(target, source) {\n const scheme = getAuthoredThemeScheme(source);\n if (scheme) Object.defineProperty(target, schemeKey, { value: scheme });\n return target;\n}\nfunction ensureThemeVariable(theme, key) {\n const val = theme[key];\n const variable = isVariable(val);\n if (!variable || val.name !== key) {\n theme[key] = createVariable({\n key: variable ? val.name : key,\n name: key,\n val: variable ? val.val : val\n });\n }\n}\nexport {\n copyAuthoredThemeScheme,\n ensureThemeVariable,\n getAuthoredThemeScheme\n};\n//# sourceMappingURL=themes.js.map\n"],"mappings":";;;AACA,MAAM,YAA4B,uBAAO,IAAI,sBAAsB;AACnE,SAAS,uBAAuB,OAAO;CACrC,MAAM,SAAS,MAAM;CACrB,OAAO,WAAW,WAAW,WAAW,SAAS,SAAS,KAAK;AACjE;AACA,SAAS,wBAAwB,QAAQ,QAAQ;CAC/C,MAAM,SAAS,uBAAuB,MAAM;CAC5C,IAAI,QAAQ,OAAO,eAAe,QAAQ,WAAW,EAAE,OAAO,OAAO,CAAC;CACtE,OAAO;AACT;AACA,SAAS,oBAAoB,OAAO,KAAK;CACvC,MAAM,MAAM,MAAM;CAClB,MAAM,WAAW,WAAW,GAAG;CAC/B,IAAI,CAAC,YAAY,IAAI,SAAS,KAAK;EACjC,MAAM,OAAO,eAAe;GAC1B,KAAK,WAAW,IAAI,OAAO;GAC3B,MAAM;GACN,KAAK,WAAW,IAAI,MAAM;EAC5B,CAAC;CACH;AACF"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { createVariable, isVariable } from "../createVariable.native.js";
|
|
2
2
|
|
|
3
|
+
var schemeKey = /* @__PURE__ */ Symbol.for("tamagui.theme.scheme");
|
|
4
|
+
function getAuthoredThemeScheme(theme) {
|
|
5
|
+
var scheme = theme[schemeKey];
|
|
6
|
+
return scheme === "light" || scheme === "dark" ? scheme : void 0;
|
|
7
|
+
}
|
|
8
|
+
function copyAuthoredThemeScheme(target, source) {
|
|
9
|
+
var scheme = getAuthoredThemeScheme(source);
|
|
10
|
+
if (scheme) Object.defineProperty(target, schemeKey, { value: scheme });
|
|
11
|
+
return target;
|
|
12
|
+
}
|
|
3
13
|
function ensureThemeVariable(theme, key) {
|
|
4
14
|
var val = theme[key];
|
|
5
|
-
var
|
|
6
|
-
if (!
|
|
7
|
-
theme[key] = createVariable({
|
|
8
|
-
key,
|
|
9
|
-
name: key,
|
|
10
|
-
val: value
|
|
11
|
-
});
|
|
12
|
-
} else if (val.name !== key) {
|
|
15
|
+
var variable = isVariable(val);
|
|
16
|
+
if (!variable || val.name !== key) {
|
|
13
17
|
theme[key] = createVariable({
|
|
14
|
-
key: val.name,
|
|
18
|
+
key: variable ? val.name : key,
|
|
15
19
|
name: key,
|
|
16
|
-
val:
|
|
20
|
+
val: variable ? val.val : val
|
|
17
21
|
});
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export { ensureThemeVariable };
|
|
25
|
+
export { copyAuthoredThemeScheme, ensureThemeVariable, getAuthoredThemeScheme };
|
|
22
26
|
//# sourceMappingURL=themes.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.native.js","names":[],"sources":["esm/helpers/themes.native.js"],"sourcesContent":["import { createVariable, isVariable } from \"../createVariable\";\nfunction
|
|
1
|
+
{"version":3,"file":"themes.native.js","names":[],"sources":["esm/helpers/themes.native.js"],"sourcesContent":["import { createVariable, isVariable } from \"../createVariable\";\nvar schemeKey = /* @__PURE__ */ Symbol.for(\"tamagui.theme.scheme\");\nfunction getAuthoredThemeScheme(theme) {\n var scheme = theme[schemeKey];\n return scheme === \"light\" || scheme === \"dark\" ? scheme : void 0;\n}\nfunction copyAuthoredThemeScheme(target, source) {\n var scheme = getAuthoredThemeScheme(source);\n if (scheme) Object.defineProperty(target, schemeKey, {\n value: scheme\n });\n return target;\n}\nfunction ensureThemeVariable(theme, key) {\n var val = theme[key];\n var variable = isVariable(val);\n if (!variable || val.name !== key) {\n theme[key] = createVariable({\n key: variable ? val.name : key,\n name: key,\n val: variable ? val.val : val\n });\n }\n}\nexport {\n copyAuthoredThemeScheme,\n ensureThemeVariable,\n getAuthoredThemeScheme\n};\n//# sourceMappingURL=themes.js.map\n"],"mappings":";;;AACA,IAAI,YAA4B,uBAAO,IAAI,sBAAsB;AACjE,SAAS,uBAAuB,OAAO;CACrC,IAAI,SAAS,MAAM;CACnB,OAAO,WAAW,WAAW,WAAW,SAAS,SAAS,KAAK;AACjE;AACA,SAAS,wBAAwB,QAAQ,QAAQ;CAC/C,IAAI,SAAS,uBAAuB,MAAM;CAC1C,IAAI,QAAQ,OAAO,eAAe,QAAQ,WAAW,EACnD,OAAO,OACT,CAAC;CACD,OAAO;AACT;AACA,SAAS,oBAAoB,OAAO,KAAK;CACvC,IAAI,MAAM,MAAM;CAChB,IAAI,WAAW,WAAW,GAAG;CAC7B,IAAI,CAAC,YAAY,IAAI,SAAS,KAAK;EACjC,MAAM,OAAO,eAAe;GAC1B,KAAK,WAAW,IAAI,OAAO;GAC3B,MAAM;GACN,KAAK,WAAW,IAAI,MAAM;EAC5B,CAAC;CACH;AACF"}
|
|
@@ -3,6 +3,7 @@ import { createContext, useContext, useEffect, useId, useReducer, useRef } from
|
|
|
3
3
|
import { getThemeScheme } from "@tamagui/helpers";
|
|
4
4
|
import { getConfig } from "../config.mjs";
|
|
5
5
|
import { MISSING_THEME_MESSAGE } from "../constants/constants.mjs";
|
|
6
|
+
import { getAuthoredThemeScheme } from "../helpers/themes.mjs";
|
|
6
7
|
|
|
7
8
|
const ThemeStateContext = createContext("");
|
|
8
9
|
const allListeners = /* @__PURE__ */ new Map();
|
|
@@ -52,17 +53,11 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
52
53
|
theme: getConfig().themes.light
|
|
53
54
|
};
|
|
54
55
|
const id = useId();
|
|
55
|
-
const propsKey =
|
|
56
|
+
const propsKey = `${props.name || ""}${props.forceClassName || ""}${props._themeUpdate?.key || ""}`;
|
|
56
57
|
if (cascadeOnChange) registerThemeProviderChain(id, parentId, props);
|
|
57
58
|
const ref = useRef(null);
|
|
58
59
|
const r = ref.current ||= {
|
|
59
60
|
id,
|
|
60
|
-
parentId,
|
|
61
|
-
props,
|
|
62
|
-
propsKey,
|
|
63
|
-
isRoot,
|
|
64
|
-
keys,
|
|
65
|
-
schemeKeys,
|
|
66
61
|
optimizeForFirstRender,
|
|
67
62
|
renderVersion: 0
|
|
68
63
|
};
|
|
@@ -70,7 +65,6 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
70
65
|
r.propsKey = propsKey;
|
|
71
66
|
r.isRoot = isRoot;
|
|
72
67
|
r.keys = keys;
|
|
73
|
-
r.schemeKeys = schemeKeys;
|
|
74
68
|
r.parentId = parentId;
|
|
75
69
|
r.renderVersion++;
|
|
76
70
|
const [, forceUpdate] = useReducer(incReducer, 0);
|
|
@@ -83,7 +77,7 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
83
77
|
r.state = r.lastSnap;
|
|
84
78
|
}
|
|
85
79
|
if (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);
|
|
86
|
-
if (r.unsubscribe && r.subscribedTo !== r.parentId)
|
|
80
|
+
if (r.unsubscribe && r.subscribedTo !== r.parentId) r.unsubscribe?.();
|
|
87
81
|
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
88
82
|
if (!r.unsubscribe) {
|
|
89
83
|
const pid = r.parentId;
|
|
@@ -113,7 +107,7 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
113
107
|
r.subscribedTo = void 0;
|
|
114
108
|
};
|
|
115
109
|
}
|
|
116
|
-
} else if (r.unsubscribe)
|
|
110
|
+
} else if (r.unsubscribe) r.unsubscribe?.();
|
|
117
111
|
return () => {
|
|
118
112
|
if (r.renderVersion === renderVersion) cleanupThemeState(r);
|
|
119
113
|
};
|
|
@@ -134,11 +128,8 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
134
128
|
return state;
|
|
135
129
|
};
|
|
136
130
|
const shouldSubscribeToTheme = (r, cascadeOnChange) => Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || r.keys.current?.size || r.props.needsUpdate?.());
|
|
137
|
-
function cleanupThemeSubscription(r) {
|
|
138
|
-
r.unsubscribe?.();
|
|
139
|
-
}
|
|
140
131
|
function cleanupThemeState(r) {
|
|
141
|
-
if (r.unsubscribe)
|
|
132
|
+
if (r.unsubscribe) r.unsubscribe();
|
|
142
133
|
else {
|
|
143
134
|
r.state = void 0;
|
|
144
135
|
states.delete(r.id);
|
|
@@ -148,15 +139,13 @@ function cleanupThemeState(r) {
|
|
|
148
139
|
themeProviderParents.delete(r.id);
|
|
149
140
|
}
|
|
150
141
|
const getSnapshotImpl = (r) => {
|
|
151
|
-
const { id, parentId, props, propsKey, isRoot, keys,
|
|
142
|
+
const { id, parentId, props, propsKey, isRoot, keys, optimizeForFirstRender } = r;
|
|
152
143
|
let local = r.state;
|
|
153
144
|
const parentState = states.get(parentId);
|
|
154
145
|
if (local && !PendingUpdate.has(id)) {
|
|
155
146
|
if (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;
|
|
156
147
|
}
|
|
157
|
-
const
|
|
158
|
-
const allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(keys.current?.size && schemeKeys?.current?.size === keys.current.size);
|
|
159
|
-
const canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);
|
|
148
|
+
const canSkipForSchemeChange = Boolean(!optimizeForFirstRender && false);
|
|
160
149
|
const needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();
|
|
161
150
|
const [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
162
151
|
let next = nextRaw;
|
|
@@ -212,7 +201,7 @@ const getNextState = (lastState, props, propsKey, isRoot = false, id, parentId,
|
|
|
212
201
|
if (shouldRerender) return [true, { ...parentState || lastState || next }];
|
|
213
202
|
return [false, next];
|
|
214
203
|
}
|
|
215
|
-
const scheme = getThemeScheme(resolvedName);
|
|
204
|
+
const scheme = getAuthoredThemeScheme(themes[resolvedName]) || getThemeScheme(resolvedName);
|
|
216
205
|
const parentInverses = parentState?.inverses ?? 0;
|
|
217
206
|
const isInverse = Boolean(parentState && scheme !== parentState.scheme);
|
|
218
207
|
const inverses = parentInverses + (isInverse ? 1 : 0);
|
|
@@ -281,7 +270,6 @@ function resolveThemeName(parentName, name, themes2, forceUpdate = false) {
|
|
|
281
270
|
if (!forceUpdate && found === parentName && found !== "light" && found !== "dark") return null;
|
|
282
271
|
return found;
|
|
283
272
|
}
|
|
284
|
-
const getPropsKey = ({ name, forceClassName, _themeUpdate }) => `${name || ""}${forceClassName || ""}${_themeUpdate?.key || ""}`;
|
|
285
273
|
const hasThemeUpdatingProps = (props) => "name" in props || "forceClassName" in props || "_themeUpdate" in props;
|
|
286
274
|
|
|
287
275
|
export { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeState.js","names":[],"sources":["esm/hooks/useThemeState.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\n\nconst ThemeStateContext = createContext(\"\");\nconst allListeners = /* @__PURE__ */ new Map();\nconst listenersByParent = {};\nconst HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nconst HadTheme = /* @__PURE__ */ new WeakMap();\nconst PendingUpdate = /* @__PURE__ */ new Map();\nconst states = /* @__PURE__ */ new Map();\nlet shouldForce = false;\nconst forceUpdateThemes = () => {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach((cb) => cb());\n\tshouldForce = false;\n};\nconst getThemeState = (id) => states.get(id);\nconst themeUpdateLayers = /* @__PURE__ */ new Map();\nconst themeProviderParents = /* @__PURE__ */ new Map();\nconst getThemeUpdateLayer = (id) => themeUpdateLayers.get(id);\nconst getThemeProviderParent = (id) => themeProviderParents.get(id);\nconst getThemeProviderChainSizes = () => ({\n\tlayers: themeUpdateLayers.size,\n\tparents: themeProviderParents.size\n});\nconst registerThemeProviderChain = (id, parentId, props) => {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nlet cacheVersion = 0;\nconst themeNameCache = /* @__PURE__ */ new Map();\nlet themeNameCacheVer = -1;\nlet themes = null;\nlet rootThemeState = null;\nconst getRootThemeState = () => rootThemeState;\nconst incReducer = (c) => c + 1;\nconst useThemeState = (props, isRoot = false, keys, schemeKeys, cascadeOnChange = false, optimizeForFirstRender = false) => {\n\t\"use no memo\";\n\tconst { disable } = props;\n\tconst parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tconst id = useId();\n\tconst propsKey = getPropsKey(props);\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tconst ref = useRef(null);\n\tconst r = ref.current ||= {\n\t\tid,\n\t\tparentId,\n\t\tprops,\n\t\tpropsKey,\n\t\tisRoot,\n\t\tkeys,\n\t\tschemeKeys,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t};\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tconst [, forceUpdate] = useReducer(incReducer, 0);\n\tconst state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(() => {\n\t\tconst renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tr.state = r.lastSnap;\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedTo !== r.parentId) cleanupThemeSubscription(r);\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tconst pid = r.parentId;\n\t\t\t\tconst sid = r.id;\n\t\t\t\tconst cb = (forced) => {\n\t\t\t\t\tconst next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && r.props.nativeUpdate?.(next)) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t(listenersByParent[pid] ||= /* @__PURE__ */ new Set()).add(sid);\n\t\t\t\tallListeners.set(sid, () => {\n\t\t\t\t\tconst forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedTo = pid;\n\t\t\t\tr.unsubscribe = () => {\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\tlistenersByParent[pid]?.delete(sid);\n\t\t\t\t\tr.state = void 0;\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedTo = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) cleanupThemeSubscription(r);\n\t\treturn () => {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(() => {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nconst shouldSubscribeToTheme = (r, cascadeOnChange) => Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || r.keys.current?.size || r.props.needsUpdate?.());\nfunction cleanupThemeSubscription(r) {\n\tr.unsubscribe?.();\n}\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) cleanupThemeSubscription(r);\n\telse {\n\t\tr.state = void 0;\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nconst getSnapshotImpl = (r) => {\n\tconst { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;\n\tlet local = r.state;\n\tconst parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tconst isSchemeOnlyChange = !optimizeForFirstRender && false;\n\tconst allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(keys.current?.size && schemeKeys?.current?.size === keys.current.size);\n\tconst canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);\n\tconst needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();\n\tconst [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tlet next = nextRaw;\n\tif (props._themeUpdate && nextRaw?.theme) {\n\t\tconst parentTheme = states.get(parentId)?.theme || nextRaw.theme;\n\t\tconst merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tr.state = local;\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState?.name;\n\tlocal._parentSchemeAuthored = parentState?.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nconst getNextState = (lastState, props, propsKey, isRoot = false, id, parentId, needsUpdate, pendingUpdate) => {\n\tconst parentState = states.get(parentId);\n\tif (props.passThrough) return [false, parentState || lastState || { name: \"\" }];\n\tthemes ||= getConfig().themes;\n\tconst name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState?.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tconst authoredName = props.name;\n\tconst parentSchemeAuthored = !!parentState?.schemeAuthored;\n\tconst schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tconst intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tconst resolvedName = name || parentState?.name;\n\tconst sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tconst isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tconst shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || lastState?.name !== parentState?.name || !!lastState?.schemeAuthored !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tconst next = lastState ?? parentState ?? rootThemeState ?? {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tconst scheme = getThemeScheme(resolvedName);\n\tconst parentInverses = parentState?.inverses ?? 0;\n\tconst isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tconst inverses = parentInverses + (isInverse ? 1 : 0);\n\tconst nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState?.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tconst queue = [id];\n\tconst visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tconst children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tfor (const childId of children) if (!visited.has(childId)) {\n\t\t\t\tvisited.add(childId);\n\t\t\t\tqueue.push(childId);\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach((childId) => {\n\t\tallListeners.get(childId)?.();\n\t});\n}\nfunction getNewThemeName(parentName = \"\", props, forceUpdate = false) {\n\tconst { name } = props;\n\tconst cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tconst cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tconst result = resolveThemeName(parentName, name ?? void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nconst getThemeNameCacheSize = () => themeNameCache.size;\nfunction resolveThemeName(parentName, name, themes2, forceUpdate = false) {\n\tconst parentParts = parentName ? parentName.split(\"_\") : [];\n\tlet found = null;\n\tif (name) {\n\t\tconst nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (let i = parentParts.length; i >= 0; i--) {\n\t\t\tconst base = parentParts.slice(0, i).join(\"_\");\n\t\t\tconst potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nconst getPropsKey = ({ name, forceClassName, _themeUpdate }) => `${name || \"\"}${forceClassName || \"\"}${_themeUpdate?.key || \"\"}`;\nconst hasThemeUpdatingProps = (props) => \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;AAMA,MAAM,oBAAoB,cAAc,EAAE;AAC1C,MAAM,+BAA+B,IAAI,IAAI;AAC7C,MAAM,oBAAoB,CAAC;AAC3B,MAAM,kCAAkC,IAAI,QAAQ;AACpD,MAAM,2BAA2B,IAAI,QAAQ;AAC7C,MAAM,gCAAgC,IAAI,IAAI;AAC9C,MAAM,yBAAyB,IAAI,IAAI;AACvC,IAAI,cAAc;AAClB,MAAM,0BAA0B;CAC/B;CACA,cAAc;CACd,aAAa,SAAS,OAAO,GAAG,CAAC;CACjC,cAAc;AACf;AACA,MAAM,iBAAiB,OAAO,OAAO,IAAI,EAAE;AAC3C,MAAM,oCAAoC,IAAI,IAAI;AAClD,MAAM,uCAAuC,IAAI,IAAI;AACrD,MAAM,uBAAuB,OAAO,kBAAkB,IAAI,EAAE;AAC5D,MAAM,0BAA0B,OAAO,qBAAqB,IAAI,EAAE;AAClE,MAAM,oCAAoC;CACzC,QAAQ,kBAAkB;CAC1B,SAAS,qBAAqB;AAC/B;AACA,MAAM,8BAA8B,IAAI,UAAU,UAAU;CAC3D,qBAAqB,IAAI,IAAI,QAAQ;CACrC,IAAI,MAAM,cAAc,kBAAkB,IAAI,IAAI,MAAM,YAAY;MAC/D,kBAAkB,OAAO,EAAE;AACjC;AACA,IAAI,eAAe;AACnB,MAAM,iCAAiC,IAAI,IAAI;AAC/C,IAAI,oBAAoB,CAAC;AACzB,IAAI,SAAS;AACb,IAAI,iBAAiB;AACrB,MAAM,0BAA0B;AAChC,MAAM,cAAc,MAAM,IAAI;AAC9B,MAAM,iBAAiB,OAAO,SAAS,OAAO,MAAM,YAAY,kBAAkB,OAAO,yBAAyB,UAAU;CA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,GAAG,cAAc,IAAI;CAClE,IAAI,sBAAsB,cAAc;EACvC,eAAe,MAAM;EACrB,oBAAoB;CACrB,OAAO;EACN,MAAM,SAAS,eAAe,IAAI,QAAQ;EAC1C,IAAI,WAAW,KAAK,GAAG,OAAO;CAC/B;CACA,MAAM,SAAS,iBAAiB,YAAY,QAAQ,KAAK,GAAG,UAAU,CAAC,CAAC,QAAQ,WAAW;CAC3F,IAAI,eAAe,QAAQ,KAAK,eAAe,MAAM;CACrD,eAAe,IAAI,UAAU,MAAM;CACnC,OAAO;AACR;AACA,MAAM,8BAA8B,eAAe;AACnD,SAAS,iBAAiB,YAAY,MAAM,SAAS,cAAc,OAAO;CACzE,MAAM,cAAc,aAAa,WAAW,MAAM,GAAG,IAAI,CAAC;CAC1D,IAAI,QAAQ;CACZ,IAAI,MAAM;EACT,MAAM,gBAAgB,eAAe,IAAI;EACzC,IAAI,iBAAiB,QAAQ,SAAS,QAAQ;EAC9C,IAAI,CAAC,SAAS,CAAC,eAAe,KAAK,IAAI,IAAI,YAAY,QAAQ,KAAK,GAAG,KAAK;GAC3E,MAAM,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;GAC7C,MAAM,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;GAC7C,IAAI,aAAa,SAAS;IACzB,QAAQ;IACR;GACD;EACD;CACD;CACA,IAAI,CAAC,eAAe,UAAU,cAAc,UAAU,WAAW,UAAU,QAAQ,OAAO;CAC1F,OAAO;AACR;AACA,MAAM,eAAe,EAAE,MAAM,gBAAgB,mBAAmB,GAAG,QAAQ,KAAK,kBAAkB,KAAK,cAAc,OAAO;AAC5H,MAAM,yBAAyB,UAAU,UAAU,SAAS,oBAAoB,SAAS,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"useThemeState.js","names":[],"sources":["esm/hooks/useThemeState.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\nimport { getAuthoredThemeScheme } from \"../helpers/themes\";\n\nconst ThemeStateContext = createContext(\"\");\nconst allListeners = /* @__PURE__ */ new Map();\nconst listenersByParent = {};\nconst HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nconst HadTheme = /* @__PURE__ */ new WeakMap();\nconst PendingUpdate = /* @__PURE__ */ new Map();\nconst states = /* @__PURE__ */ new Map();\nlet shouldForce = false;\nconst forceUpdateThemes = () => {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach((cb) => cb());\n\tshouldForce = false;\n};\nconst getThemeState = (id) => states.get(id);\nconst themeUpdateLayers = /* @__PURE__ */ new Map();\nconst themeProviderParents = /* @__PURE__ */ new Map();\nconst getThemeUpdateLayer = (id) => themeUpdateLayers.get(id);\nconst getThemeProviderParent = (id) => themeProviderParents.get(id);\nconst getThemeProviderChainSizes = () => ({\n\tlayers: themeUpdateLayers.size,\n\tparents: themeProviderParents.size\n});\nconst registerThemeProviderChain = (id, parentId, props) => {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nlet cacheVersion = 0;\nconst themeNameCache = /* @__PURE__ */ new Map();\nlet themeNameCacheVer = -1;\nlet themes = null;\nlet rootThemeState = null;\nconst getRootThemeState = () => rootThemeState;\nconst incReducer = (c) => c + 1;\nconst useThemeState = (props, isRoot = false, keys, schemeKeys, cascadeOnChange = false, optimizeForFirstRender = false) => {\n\t\"use no memo\";\n\tconst { disable } = props;\n\tconst parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tconst id = useId();\n\tconst propsKey = `${props.name || \"\"}${props.forceClassName || \"\"}${props._themeUpdate?.key || \"\"}`;\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tconst ref = useRef(null);\n\tconst r = ref.current ||= {\n\t\tid,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t};\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tconst [, forceUpdate] = useReducer(incReducer, 0);\n\tconst state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(() => {\n\t\tconst renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tr.state = r.lastSnap;\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedTo !== r.parentId) r.unsubscribe?.();\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tconst pid = r.parentId;\n\t\t\t\tconst sid = r.id;\n\t\t\t\tconst cb = (forced) => {\n\t\t\t\t\tconst next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && r.props.nativeUpdate?.(next)) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t(listenersByParent[pid] ||= /* @__PURE__ */ new Set()).add(sid);\n\t\t\t\tallListeners.set(sid, () => {\n\t\t\t\t\tconst forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedTo = pid;\n\t\t\t\tr.unsubscribe = () => {\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\tlistenersByParent[pid]?.delete(sid);\n\t\t\t\t\tr.state = void 0;\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedTo = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) r.unsubscribe?.();\n\t\treturn () => {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(() => {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nconst shouldSubscribeToTheme = (r, cascadeOnChange) => Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || r.keys.current?.size || r.props.needsUpdate?.());\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) r.unsubscribe();\n\telse {\n\t\tr.state = void 0;\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nconst getSnapshotImpl = (r) => {\n\tconst { id, parentId, props, propsKey, isRoot, keys, optimizeForFirstRender } = r;\n\tlet local = r.state;\n\tconst parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tconst canSkipForSchemeChange = Boolean(!optimizeForFirstRender && false);\n\tconst needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();\n\tconst [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tlet next = nextRaw;\n\tif (props._themeUpdate && nextRaw?.theme) {\n\t\tconst parentTheme = states.get(parentId)?.theme || nextRaw.theme;\n\t\tconst merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tr.state = local;\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState?.name;\n\tlocal._parentSchemeAuthored = parentState?.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nconst getNextState = (lastState, props, propsKey, isRoot = false, id, parentId, needsUpdate, pendingUpdate) => {\n\tconst parentState = states.get(parentId);\n\tif (props.passThrough) return [false, parentState || lastState || { name: \"\" }];\n\tthemes ||= getConfig().themes;\n\tconst name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState?.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tconst authoredName = props.name;\n\tconst parentSchemeAuthored = !!parentState?.schemeAuthored;\n\tconst schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tconst intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tconst resolvedName = name || parentState?.name;\n\tconst sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tconst isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tconst shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || lastState?.name !== parentState?.name || !!lastState?.schemeAuthored !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tconst next = lastState ?? parentState ?? rootThemeState ?? {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tconst scheme = getAuthoredThemeScheme(themes[resolvedName]) || getThemeScheme(resolvedName);\n\tconst parentInverses = parentState?.inverses ?? 0;\n\tconst isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tconst inverses = parentInverses + (isInverse ? 1 : 0);\n\tconst nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState?.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tconst queue = [id];\n\tconst visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tconst children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tfor (const childId of children) if (!visited.has(childId)) {\n\t\t\t\tvisited.add(childId);\n\t\t\t\tqueue.push(childId);\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach((childId) => {\n\t\tallListeners.get(childId)?.();\n\t});\n}\nfunction getNewThemeName(parentName = \"\", props, forceUpdate = false) {\n\tconst { name } = props;\n\tconst cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tconst cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tconst result = resolveThemeName(parentName, name ?? void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nconst getThemeNameCacheSize = () => themeNameCache.size;\nfunction resolveThemeName(parentName, name, themes2, forceUpdate = false) {\n\tconst parentParts = parentName ? parentName.split(\"_\") : [];\n\tlet found = null;\n\tif (name) {\n\t\tconst nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (let i = parentParts.length; i >= 0; i--) {\n\t\t\tconst base = parentParts.slice(0, i).join(\"_\");\n\t\t\tconst potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nconst hasThemeUpdatingProps = (props) => \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;;AAOA,MAAM,oBAAoB,cAAc,EAAE;AAC1C,MAAM,+BAA+B,IAAI,IAAI;AAC7C,MAAM,oBAAoB,CAAC;AAC3B,MAAM,kCAAkC,IAAI,QAAQ;AACpD,MAAM,2BAA2B,IAAI,QAAQ;AAC7C,MAAM,gCAAgC,IAAI,IAAI;AAC9C,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,SAAS,QAAQ;EAC9C,IAAI,CAAC,SAAS,CAAC,eAAe,KAAK,IAAI,IAAI,YAAY,QAAQ,KAAK,GAAG,KAAK;GAC3E,MAAM,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;GAC7C,MAAM,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;GAC7C,IAAI,aAAa,SAAS;IACzB,QAAQ;IACR;GACD;EACD;CACD;CACA,IAAI,CAAC,eAAe,UAAU,cAAc,UAAU,WAAW,UAAU,QAAQ,OAAO;CAC1F,OAAO;AACR;AACA,MAAM,yBAAyB,UAAU,UAAU,SAAS,oBAAoB,SAAS,kBAAkB"}
|
|
@@ -3,6 +3,7 @@ import { createContext, useContext, useEffect, useId, useReducer, useRef } from
|
|
|
3
3
|
import { getThemeScheme } from "@tamagui/helpers";
|
|
4
4
|
import { getConfig, getSetting } from "../config.native.js";
|
|
5
5
|
import { MISSING_THEME_MESSAGE } from "../constants/constants.native.js";
|
|
6
|
+
import { getAuthoredThemeScheme } from "../helpers/themes.native.js";
|
|
6
7
|
|
|
7
8
|
var ThemeStateContext = createContext("");
|
|
8
9
|
var allListeners = /* @__PURE__ */ new Map();
|
|
@@ -59,6 +60,7 @@ var incReducer = function(c) {
|
|
|
59
60
|
var useThemeState = function(props) {
|
|
60
61
|
"use no memo";
|
|
61
62
|
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;
|
|
63
|
+
var _props__themeUpdate;
|
|
62
64
|
var _ref;
|
|
63
65
|
var { disable } = props;
|
|
64
66
|
var parentId = useContext(ThemeStateContext);
|
|
@@ -71,16 +73,10 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
71
73
|
theme: getConfig().themes.light
|
|
72
74
|
};
|
|
73
75
|
var id = useId();
|
|
74
|
-
var propsKey =
|
|
76
|
+
var propsKey = `${props.name || ""}${props.forceClassName || ""}${((_props__themeUpdate = props._themeUpdate) === null || _props__themeUpdate === void 0 ? void 0 : _props__themeUpdate.key) || ""}`;
|
|
75
77
|
if (cascadeOnChange) registerThemeProviderChain(id, parentId, props);
|
|
76
78
|
var r = (_ref = useRef(null)).current || (_ref.current = {
|
|
77
79
|
id,
|
|
78
|
-
parentId,
|
|
79
|
-
props,
|
|
80
|
-
propsKey,
|
|
81
|
-
isRoot,
|
|
82
|
-
keys,
|
|
83
|
-
schemeKeys,
|
|
84
80
|
optimizeForFirstRender,
|
|
85
81
|
renderVersion: 0
|
|
86
82
|
});
|
|
@@ -101,7 +97,10 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
101
97
|
r.state = r.lastSnap;
|
|
102
98
|
}
|
|
103
99
|
if (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);
|
|
104
|
-
if (r.unsubscribe && r.subscribedTo !== r.parentId)
|
|
100
|
+
if (r.unsubscribe && r.subscribedTo !== r.parentId) {
|
|
101
|
+
var _r_unsubscribe;
|
|
102
|
+
(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
|
|
103
|
+
}
|
|
105
104
|
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
106
105
|
if (!r.unsubscribe) {
|
|
107
106
|
var _listenersByParent, _pid;
|
|
@@ -134,7 +133,10 @@ Looked for theme${props.name ? ` "${props.name}"` : ""}, but no parent theme con
|
|
|
134
133
|
r.subscribedTo = void 0;
|
|
135
134
|
};
|
|
136
135
|
}
|
|
137
|
-
} else if (r.unsubscribe)
|
|
136
|
+
} else if (r.unsubscribe) {
|
|
137
|
+
var _r_unsubscribe1;
|
|
138
|
+
(_r_unsubscribe1 = r.unsubscribe) === null || _r_unsubscribe1 === void 0 || _r_unsubscribe1.call(r);
|
|
139
|
+
}
|
|
138
140
|
return function() {
|
|
139
141
|
if (r.renderVersion === renderVersion) cleanupThemeState(r);
|
|
140
142
|
};
|
|
@@ -158,12 +160,8 @@ var shouldSubscribeToTheme = function(r, cascadeOnChange) {
|
|
|
158
160
|
var _r_keys_current, _r_props_needsUpdate, _r_props;
|
|
159
161
|
return Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));
|
|
160
162
|
};
|
|
161
|
-
function cleanupThemeSubscription(r) {
|
|
162
|
-
var _r_unsubscribe;
|
|
163
|
-
(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
|
|
164
|
-
}
|
|
165
163
|
function cleanupThemeState(r) {
|
|
166
|
-
if (r.unsubscribe)
|
|
164
|
+
if (r.unsubscribe) r.unsubscribe();
|
|
167
165
|
else {
|
|
168
166
|
r.state = void 0;
|
|
169
167
|
states.delete(r.id);
|
|
@@ -174,15 +172,15 @@ function cleanupThemeState(r) {
|
|
|
174
172
|
}
|
|
175
173
|
var getSnapshotImpl = function(r) {
|
|
176
174
|
var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
|
|
177
|
-
var { id, parentId, props, propsKey, isRoot, keys,
|
|
175
|
+
var { id, parentId, props, propsKey, isRoot, keys, optimizeForFirstRender } = r;
|
|
176
|
+
var schemeKeys = r.schemeKeys;
|
|
178
177
|
var local = r.state;
|
|
179
178
|
var parentState = states.get(parentId);
|
|
180
179
|
if (local && !PendingUpdate.has(id)) {
|
|
181
180
|
if (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;
|
|
182
181
|
}
|
|
183
182
|
var isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
|
|
184
|
-
var
|
|
185
|
-
var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);
|
|
183
|
+
var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && ((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);
|
|
186
184
|
var needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
|
|
187
185
|
var [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
188
186
|
var next = nextRaw;
|
|
@@ -241,7 +239,7 @@ var getNextState = function(lastState, props, propsKey) {
|
|
|
241
239
|
if (shouldRerender) return [true, { ...parentState || lastState || next }];
|
|
242
240
|
return [false, next];
|
|
243
241
|
}
|
|
244
|
-
var scheme = getThemeScheme(resolvedName);
|
|
242
|
+
var scheme = getAuthoredThemeScheme(themes[resolvedName]) || getThemeScheme(resolvedName);
|
|
245
243
|
var _parentState_inverses;
|
|
246
244
|
var parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;
|
|
247
245
|
var isInverse = Boolean(parentState && scheme !== parentState.scheme);
|
|
@@ -331,10 +329,6 @@ function resolveThemeName(parentName, name, themes2) {
|
|
|
331
329
|
if (!forceUpdate && found === parentName && found !== "light" && found !== "dark") return null;
|
|
332
330
|
return found;
|
|
333
331
|
}
|
|
334
|
-
var getPropsKey = function(param) {
|
|
335
|
-
var { name, forceClassName, _themeUpdate } = param;
|
|
336
|
-
return `${name || ""}${forceClassName || ""}${(_themeUpdate === null || _themeUpdate === void 0 ? void 0 : _themeUpdate.key) || ""}`;
|
|
337
|
-
};
|
|
338
332
|
var hasThemeUpdatingProps = function(props) {
|
|
339
333
|
return "name" in props || "forceClassName" in props || "_themeUpdate" in props;
|
|
340
334
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeState.native.js","names":[],"sources":["esm/hooks/useThemeState.native.js"],"sourcesContent":["import { supportsDynamicColorIOS, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig, getSetting } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\n\nvar ThemeStateContext = createContext(\"\");\nvar allListeners = /* @__PURE__ */ new Map();\nvar listenersByParent = {};\nvar HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nvar HadTheme = /* @__PURE__ */ new WeakMap();\nvar PendingUpdate = /* @__PURE__ */ new Map();\nvar states = /* @__PURE__ */ new Map();\nvar shouldForce = false;\nvar forceUpdateThemes = function() {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach(function(cb) {\n\t\treturn cb();\n\t});\n\tshouldForce = false;\n};\nvar getThemeState = function(id) {\n\treturn states.get(id);\n};\nvar themeUpdateLayers = /* @__PURE__ */ new Map();\nvar themeProviderParents = /* @__PURE__ */ new Map();\nvar getThemeUpdateLayer = function(id) {\n\treturn themeUpdateLayers.get(id);\n};\nvar getThemeProviderParent = function(id) {\n\treturn themeProviderParents.get(id);\n};\nvar getThemeProviderChainSizes = function() {\n\treturn {\n\t\tlayers: themeUpdateLayers.size,\n\t\tparents: themeProviderParents.size\n\t};\n};\nvar registerThemeProviderChain = function(id, parentId, props) {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nvar cacheVersion = 0;\nvar themeNameCache = /* @__PURE__ */ new Map();\nvar themeNameCacheVer = -1;\nvar themes = null;\nvar rootThemeState = null;\nvar getRootThemeState = function() {\n\treturn rootThemeState;\n};\nvar getThemeBaseName = function(name) {\n\treturn name.replace(/^(light|dark)_/, \"\");\n};\nvar incReducer = function(c) {\n\treturn c + 1;\n};\nvar useThemeState = function(props) {\n\t\"use no memo\";\n\tvar isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;\n\tvar _ref;\n\tvar { disable } = props;\n\tvar parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tvar id = useId();\n\tvar propsKey = getPropsKey(props);\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tvar r = (_ref = useRef(null)).current || (_ref.current = {\n\t\tid,\n\t\tparentId,\n\t\tprops,\n\t\tpropsKey,\n\t\tisRoot,\n\t\tkeys,\n\t\tschemeKeys,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t});\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tvar [, forceUpdate] = useReducer(incReducer, 0);\n\tvar state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(function() {\n\t\tvar renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tr.state = r.lastSnap;\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedTo !== r.parentId) cleanupThemeSubscription(r);\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tvar _listenersByParent, _pid;\n\t\t\t\tvar pid = r.parentId;\n\t\t\t\tvar sid = r.id;\n\t\t\t\tvar cb = function(forced) {\n\t\t\t\t\tvar next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tvar _r_props_nativeUpdate, _r_props;\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && ((_r_props_nativeUpdate = (_r_props = r.props).nativeUpdate) === null || _r_props_nativeUpdate === void 0 ? void 0 : _r_props_nativeUpdate.call(_r_props, next))) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t((_listenersByParent = listenersByParent)[_pid = pid] || (_listenersByParent[_pid] = /* @__PURE__ */ new Set())).add(sid);\n\t\t\t\tallListeners.set(sid, function() {\n\t\t\t\t\tvar forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedTo = pid;\n\t\t\t\tr.unsubscribe = function() {\n\t\t\t\t\tvar _listenersByParent_pid;\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\t(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);\n\t\t\t\t\tr.state = void 0;\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedTo = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) cleanupThemeSubscription(r);\n\t\treturn function() {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(function() {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nvar shouldSubscribeToTheme = function(r, cascadeOnChange) {\n\tvar _r_keys_current, _r_props_needsUpdate, _r_props;\n\treturn Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));\n};\nfunction cleanupThemeSubscription(r) {\n\tvar _r_unsubscribe;\n\t(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);\n}\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) cleanupThemeSubscription(r);\n\telse {\n\t\tr.state = void 0;\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nvar getSnapshotImpl = function(r) {\n\tvar _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;\n\tvar { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;\n\tvar local = r.state;\n\tvar parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tvar isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting(\"fastSchemeChange\") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);\n\tvar allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);\n\tvar canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);\n\tvar needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);\n\tvar [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tvar next = nextRaw;\n\tif (props._themeUpdate && (nextRaw === null || nextRaw === void 0 ? void 0 : nextRaw.theme)) {\n\t\tvar _states_get;\n\t\tvar parentTheme = ((_states_get = states.get(parentId)) === null || _states_get === void 0 ? void 0 : _states_get.theme) || nextRaw.theme;\n\t\tvar merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tr.state = local;\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;\n\tlocal._parentSchemeAuthored = parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nvar getNextState = function(lastState, props, propsKey) {\n\tvar isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0;\n\tvar parentState = states.get(parentId);\n\tif (props.passThrough) return [false, parentState || lastState || { name: \"\" }];\n\tthemes || (themes = getConfig().themes);\n\tvar name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState === null || parentState === void 0 ? void 0 : parentState.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tvar authoredName = props.name;\n\tvar parentSchemeAuthored = !!(parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored);\n\tvar schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tvar intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tvar resolvedName = name || (parentState === null || parentState === void 0 ? void 0 : parentState.name);\n\tvar sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tvar isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tvar shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || (lastState === null || lastState === void 0 ? void 0 : lastState.name) !== (parentState === null || parentState === void 0 ? void 0 : parentState.name) || !!(lastState === null || lastState === void 0 ? void 0 : lastState.schemeAuthored) !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tvar _ref, _ref1;\n\t\tvar next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tvar scheme = getThemeScheme(resolvedName);\n\tvar _parentState_inverses;\n\tvar parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;\n\tvar isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tvar inverses = parentInverses + (isInverse ? 1 : 0);\n\tvar nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState === null || parentState === void 0 ? void 0 : parentState.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tvar queue = [id];\n\tvar visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tvar children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar childId = _step.value;\n\t\t\t\t\tif (!visited.has(childId)) {\n\t\t\t\t\t\tvisited.add(childId);\n\t\t\t\t\t\tqueue.push(childId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach(function(childId2) {\n\t\tvar _allListeners_get;\n\t\t(_allListeners_get = allListeners.get(childId2)) === null || _allListeners_get === void 0 || _allListeners_get();\n\t});\n}\nfunction getNewThemeName() {\n\tvar parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"\", props = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n\tvar { name } = props;\n\tvar cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tvar cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tvar result = resolveThemeName(parentName, name !== null && name !== void 0 ? name : void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nvar getThemeNameCacheSize = function() {\n\treturn themeNameCache.size;\n};\nfunction resolveThemeName(parentName, name, themes2) {\n\tvar forceUpdate = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;\n\tvar parentParts = parentName ? parentName.split(\"_\") : [];\n\tvar found = null;\n\tif (name) {\n\t\tvar nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (var i = parentParts.length; i >= 0; i--) {\n\t\t\tvar base = parentParts.slice(0, i).join(\"_\");\n\t\t\tvar potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nvar getPropsKey = function(param) {\n\tvar { name, forceClassName, _themeUpdate } = param;\n\treturn `${name || \"\"}${forceClassName || \"\"}${(_themeUpdate === null || _themeUpdate === void 0 ? void 0 : _themeUpdate.key) || \"\"}`;\n};\nvar hasThemeUpdatingProps = function(props) {\n\treturn \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n};\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;AAMA,IAAI,oBAAoB,cAAc,EAAE;AACxC,IAAI,+BAA+B,IAAI,IAAI;AAC3C,IAAI,oBAAoB,CAAC;AACzB,IAAI,kCAAkC,IAAI,QAAQ;AAClD,IAAI,2BAA2B,IAAI,QAAQ;AAC3C,IAAI,gCAAgC,IAAI,IAAI;AAC5C,IAAI,yBAAyB,IAAI,IAAI;AACrC,IAAI,cAAc;AAClB,IAAI,oBAAoB,WAAW;CAClC;CACA,cAAc;CACd,aAAa,QAAQ,SAAS,IAAI;EACjC,OAAO,GAAG;CACX,CAAC;CACD,cAAc;AAC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,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa,QAAQ;AACjI;AACA,IAAI,wBAAwB,SAAS,OAAO;CAC3C,OAAO,UAAU,SAAS,oBAAoB,SAAS,kBAAkB;AAC1E"}
|
|
1
|
+
{"version":3,"file":"useThemeState.native.js","names":[],"sources":["esm/hooks/useThemeState.native.js"],"sourcesContent":["import { supportsDynamicColorIOS, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig, getSetting } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\nimport { getAuthoredThemeScheme } from \"../helpers/themes\";\n\nvar ThemeStateContext = createContext(\"\");\nvar allListeners = /* @__PURE__ */ new Map();\nvar listenersByParent = {};\nvar HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nvar HadTheme = /* @__PURE__ */ new WeakMap();\nvar PendingUpdate = /* @__PURE__ */ new Map();\nvar states = /* @__PURE__ */ new Map();\nvar shouldForce = false;\nvar forceUpdateThemes = function() {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach(function(cb) {\n\t\treturn cb();\n\t});\n\tshouldForce = false;\n};\nvar getThemeState = function(id) {\n\treturn states.get(id);\n};\nvar themeUpdateLayers = /* @__PURE__ */ new Map();\nvar themeProviderParents = /* @__PURE__ */ new Map();\nvar getThemeUpdateLayer = function(id) {\n\treturn themeUpdateLayers.get(id);\n};\nvar getThemeProviderParent = function(id) {\n\treturn themeProviderParents.get(id);\n};\nvar getThemeProviderChainSizes = function() {\n\treturn {\n\t\tlayers: themeUpdateLayers.size,\n\t\tparents: themeProviderParents.size\n\t};\n};\nvar registerThemeProviderChain = function(id, parentId, props) {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nvar cacheVersion = 0;\nvar themeNameCache = /* @__PURE__ */ new Map();\nvar themeNameCacheVer = -1;\nvar themes = null;\nvar rootThemeState = null;\nvar getRootThemeState = function() {\n\treturn rootThemeState;\n};\nvar getThemeBaseName = function(name) {\n\treturn name.replace(/^(light|dark)_/, \"\");\n};\nvar incReducer = function(c) {\n\treturn c + 1;\n};\nvar useThemeState = function(props) {\n\t\"use no memo\";\n\tvar isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;\n\tvar _props__themeUpdate;\n\tvar _ref;\n\tvar { disable } = props;\n\tvar parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tvar id = useId();\n\tvar propsKey = `${props.name || \"\"}${props.forceClassName || \"\"}${((_props__themeUpdate = props._themeUpdate) === null || _props__themeUpdate === void 0 ? void 0 : _props__themeUpdate.key) || \"\"}`;\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tvar r = (_ref = useRef(null)).current || (_ref.current = {\n\t\tid,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t});\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tvar [, forceUpdate] = useReducer(incReducer, 0);\n\tvar state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(function() {\n\t\tvar renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tr.state = r.lastSnap;\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedTo !== r.parentId) {\n\t\t\tvar _r_unsubscribe;\n\t\t\t(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);\n\t\t}\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tvar _listenersByParent, _pid;\n\t\t\t\tvar pid = r.parentId;\n\t\t\t\tvar sid = r.id;\n\t\t\t\tvar cb = function(forced) {\n\t\t\t\t\tvar next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tvar _r_props_nativeUpdate, _r_props;\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && ((_r_props_nativeUpdate = (_r_props = r.props).nativeUpdate) === null || _r_props_nativeUpdate === void 0 ? void 0 : _r_props_nativeUpdate.call(_r_props, next))) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t((_listenersByParent = listenersByParent)[_pid = pid] || (_listenersByParent[_pid] = /* @__PURE__ */ new Set())).add(sid);\n\t\t\t\tallListeners.set(sid, function() {\n\t\t\t\t\tvar forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedTo = pid;\n\t\t\t\tr.unsubscribe = function() {\n\t\t\t\t\tvar _listenersByParent_pid;\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\t(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);\n\t\t\t\t\tr.state = void 0;\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedTo = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) {\n\t\t\tvar _r_unsubscribe1;\n\t\t\t(_r_unsubscribe1 = r.unsubscribe) === null || _r_unsubscribe1 === void 0 || _r_unsubscribe1.call(r);\n\t\t}\n\t\treturn function() {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(function() {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nvar shouldSubscribeToTheme = function(r, cascadeOnChange) {\n\tvar _r_keys_current, _r_props_needsUpdate, _r_props;\n\treturn Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));\n};\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) r.unsubscribe();\n\telse {\n\t\tr.state = void 0;\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nvar getSnapshotImpl = function(r) {\n\tvar _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;\n\tvar { id, parentId, props, propsKey, isRoot, keys, optimizeForFirstRender } = r;\n\tvar schemeKeys = r.schemeKeys;\n\tvar local = r.state;\n\tvar parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tvar isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting(\"fastSchemeChange\") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);\n\tvar canSkipForSchemeChange = Boolean(isSchemeOnlyChange && ((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);\n\tvar needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);\n\tvar [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tvar next = nextRaw;\n\tif (props._themeUpdate && (nextRaw === null || nextRaw === void 0 ? void 0 : nextRaw.theme)) {\n\t\tvar _states_get;\n\t\tvar parentTheme = ((_states_get = states.get(parentId)) === null || _states_get === void 0 ? void 0 : _states_get.theme) || nextRaw.theme;\n\t\tvar merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tr.state = local;\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;\n\tlocal._parentSchemeAuthored = parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nvar getNextState = function(lastState, props, propsKey) {\n\tvar isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0;\n\tvar parentState = states.get(parentId);\n\tif (props.passThrough) return [false, parentState || lastState || { name: \"\" }];\n\tthemes || (themes = getConfig().themes);\n\tvar name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState === null || parentState === void 0 ? void 0 : parentState.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tvar authoredName = props.name;\n\tvar parentSchemeAuthored = !!(parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored);\n\tvar schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tvar intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tvar resolvedName = name || (parentState === null || parentState === void 0 ? void 0 : parentState.name);\n\tvar sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tvar isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tvar shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || (lastState === null || lastState === void 0 ? void 0 : lastState.name) !== (parentState === null || parentState === void 0 ? void 0 : parentState.name) || !!(lastState === null || lastState === void 0 ? void 0 : lastState.schemeAuthored) !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tvar _ref, _ref1;\n\t\tvar next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tvar scheme = getAuthoredThemeScheme(themes[resolvedName]) || getThemeScheme(resolvedName);\n\tvar _parentState_inverses;\n\tvar parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;\n\tvar isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tvar inverses = parentInverses + (isInverse ? 1 : 0);\n\tvar nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState === null || parentState === void 0 ? void 0 : parentState.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tvar queue = [id];\n\tvar visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tvar children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar childId = _step.value;\n\t\t\t\t\tif (!visited.has(childId)) {\n\t\t\t\t\t\tvisited.add(childId);\n\t\t\t\t\t\tqueue.push(childId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach(function(childId2) {\n\t\tvar _allListeners_get;\n\t\t(_allListeners_get = allListeners.get(childId2)) === null || _allListeners_get === void 0 || _allListeners_get();\n\t});\n}\nfunction getNewThemeName() {\n\tvar parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"\", props = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n\tvar { name } = props;\n\tvar cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tvar cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tvar result = resolveThemeName(parentName, name !== null && name !== void 0 ? name : void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nvar getThemeNameCacheSize = function() {\n\treturn themeNameCache.size;\n};\nfunction resolveThemeName(parentName, name, themes2) {\n\tvar forceUpdate = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;\n\tvar parentParts = parentName ? parentName.split(\"_\") : [];\n\tvar found = null;\n\tif (name) {\n\t\tvar nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (var i = parentParts.length; i >= 0; i--) {\n\t\t\tvar base = parentParts.slice(0, i).join(\"_\");\n\t\t\tvar potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nvar hasThemeUpdatingProps = function(props) {\n\treturn \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n};\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;;AAOA,IAAI,oBAAoB,cAAc,EAAE;AACxC,IAAI,+BAA+B,IAAI,IAAI;AAC3C,IAAI,oBAAoB,CAAC;AACzB,IAAI,kCAAkC,IAAI,QAAQ;AAClD,IAAI,2BAA2B,IAAI,QAAQ;AAC3C,IAAI,gCAAgC,IAAI,IAAI;AAC5C,IAAI,yBAAyB,IAAI,IAAI;AACrC,IAAI,cAAc;AAClB,IAAI,oBAAoB,WAAW;CAClC;CACA,cAAc;CACd,aAAa,QAAQ,SAAS,IAAI;EACjC,OAAO,GAAG;CACX,CAAC;CACD,cAAc;AACf;AACA,IAAI,gBAAgB,SAAS,IAAI;CAChC,OAAO,OAAO,IAAI,EAAE;AACrB;AACA,IAAI,oCAAoC,IAAI,IAAI;AAChD,IAAI,uCAAuC,IAAI,IAAI;AACnD,IAAI,sBAAsB,SAAS,IAAI;CACtC,OAAO,kBAAkB,IAAI,EAAE;AAChC;AACA,IAAI,yBAAyB,SAAS,IAAI;CACzC,OAAO,qBAAqB,IAAI,EAAE;AACnC;AACA,IAAI,6BAA6B,WAAW;CAC3C,OAAO;EACN,QAAQ,kBAAkB;EAC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