@tamagui/core 1.0.1-beta.101 → 1.0.1-beta.104
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/ThemeManager.js +9 -3
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/constants/platform.js +7 -7
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/createComponent.js +16 -16
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +14 -2
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +5 -2
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/helpers/calc.js.map +2 -2
- package/dist/cjs/helpers/createMediaStyle.js +3 -2
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +27 -29
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +7 -7
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +15 -11
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js +6 -5
- package/dist/cjs/helpers/matchMedia.js.map +2 -2
- package/dist/cjs/helpers/startTransition.js +32 -0
- package/dist/cjs/helpers/startTransition.js.map +7 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js +5 -2
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +2 -2
- package/dist/cjs/hooks/getThemeUnwrapped.js +36 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/cjs/hooks/useIsSSR.js +41 -0
- package/dist/cjs/hooks/useIsSSR.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +8 -6
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +17 -21
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/startTransition.js +32 -0
- package/dist/cjs/startTransition.js.map +7 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +20 -0
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/esm/ThemeManager.js +9 -3
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/constants/platform.js +6 -6
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/createComponent.js +17 -17
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +14 -2
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +3 -1
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/helpers/calc.js.map +1 -1
- package/dist/esm/helpers/createMediaStyle.js +3 -2
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +34 -31
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +7 -7
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +14 -10
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js +6 -5
- package/dist/esm/helpers/matchMedia.js.map +2 -2
- package/dist/esm/helpers/startTransition.js +6 -0
- package/dist/esm/helpers/startTransition.js.map +7 -0
- package/dist/esm/helpers/wrapThemeManagerContext.js +5 -2
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +2 -2
- package/dist/esm/hooks/getThemeUnwrapped.js +12 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/esm/hooks/useIsSSR.js +18 -0
- package/dist/esm/hooks/useIsSSR.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +9 -7
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +16 -20
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/startTransition.js +6 -0
- package/dist/esm/startTransition.js.map +7 -0
- package/dist/esm/views/Slot.js +20 -0
- package/dist/esm/views/Slot.js.map +2 -2
- package/package.json +8 -8
- package/types/ThemeManager.d.ts +5 -6
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/constants/platform.d.ts +3 -3
- package/types/constants/platform.d.ts.map +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createTheme.d.ts +1 -0
- package/types/createTheme.d.ts.map +1 -1
- package/types/helpers/createMediaStyle.d.ts +2 -4
- package/types/helpers/createMediaStyle.d.ts.map +1 -1
- package/types/helpers/createShallowUpdate.d.ts.map +1 -1
- package/types/helpers/createTamaguiProvider.d.ts +0 -1
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +2 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +5 -2
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/matchMedia.d.ts +1 -1
- package/types/helpers/matchMedia.d.ts.map +1 -1
- package/types/helpers/startTransition.d.ts +3 -0
- package/types/helpers/startTransition.d.ts.map +1 -0
- package/types/helpers/wrapThemeManagerContext.d.ts +1 -1
- package/types/helpers/wrapThemeManagerContext.d.ts.map +1 -1
- package/types/hooks/getThemeUnwrapped.d.ts +3 -0
- package/types/hooks/getThemeUnwrapped.d.ts.map +1 -0
- package/types/hooks/useIsSSR.d.ts +2 -0
- package/types/hooks/useIsSSR.d.ts.map +1 -0
- package/types/hooks/useIsTouchDevice.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +6 -10
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +3 -2
- package/types/index.d.ts.map +1 -1
- package/types/startTransition.d.ts +3 -0
- package/types/startTransition.d.ts.map +1 -0
- package/types/types.d.ts +1 -0
- package/types/types.d.ts.map +1 -1
- package/types/views/Slot.d.ts.map +1 -1
- package/types/views/ThemeProvider.d.ts +0 -1
- package/types/views/ThemeProvider.d.ts.map +1 -1
|
@@ -20,7 +20,7 @@ __export(insertStyleRule_exports, {
|
|
|
20
20
|
getAllSelectors: () => getAllSelectors,
|
|
21
21
|
getAllTransforms: () => getAllTransforms,
|
|
22
22
|
getInsertedRules: () => getInsertedRules,
|
|
23
|
-
|
|
23
|
+
insertStyleRules: () => insertStyleRules,
|
|
24
24
|
insertedTransforms: () => insertedTransforms,
|
|
25
25
|
updateInserted: () => updateInserted,
|
|
26
26
|
updateInsertedCache: () => updateInsertedCache
|
|
@@ -112,28 +112,32 @@ function getTamaguiSelector(rule) {
|
|
|
112
112
|
const getIdentifierFromTamaguiSelector = (selector) => selector.replace(/(:root)+\s+/, "").replace(/:[a-z]+$/, "").slice(1);
|
|
113
113
|
updateInserted();
|
|
114
114
|
const sheet = isClient ? document.head.appendChild(document.createElement("style")).sheet : null;
|
|
115
|
-
function updateInsertedCache(identifier,
|
|
115
|
+
function updateInsertedCache(identifier, rules) {
|
|
116
116
|
if (insertedSelectors[identifier])
|
|
117
117
|
return false;
|
|
118
|
-
insertedSelectors[identifier] =
|
|
118
|
+
insertedSelectors[identifier] = rules;
|
|
119
119
|
if (identifier.startsWith("_transform")) {
|
|
120
|
-
return addTransform(identifier,
|
|
120
|
+
return addTransform(identifier, rules[0]);
|
|
121
121
|
}
|
|
122
122
|
return true;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
function insertStyleRules(rulesToInsert) {
|
|
125
|
+
for (const { identifier, rules } of rulesToInsert) {
|
|
126
|
+
if (allSelectors[identifier] || !sheet)
|
|
127
|
+
return;
|
|
128
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rules : true;
|
|
129
|
+
updateInsertedCache(identifier, rules);
|
|
130
|
+
for (const rule of rules) {
|
|
131
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
130
134
|
}
|
|
131
135
|
// Annotate the CommonJS export names for ESM import in node:
|
|
132
136
|
0 && (module.exports = {
|
|
133
137
|
getAllSelectors,
|
|
134
138
|
getAllTransforms,
|
|
135
139
|
getInsertedRules,
|
|
136
|
-
|
|
140
|
+
insertStyleRules,
|
|
137
141
|
insertedTransforms,
|
|
138
142
|
updateInserted,
|
|
139
143
|
updateInsertedCache
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/insertStyleRule.tsx"],
|
|
4
|
-
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n // sometimes getting empty style rules from webpack... :/ only in dev\n if (css.indexOf('{ }')) {\n console.log('wah wah')\n return false\n }\n console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.warn(`Missing transform`, identifier, css, rule)\n }\n return false\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n if (!insertedTransforms[identifier]) {\n insertedTransforms[identifier] = value\n return true\n }\n return false\n}\n\nconst isClient = typeof document !== 'undefined'\n\n// gets existing ones (client side)\n// takes ~0.1ms for a fairly large page\n// used now for three things:\n// 1. debugging at dev time\n// 2. avoid duplicate insert styles at runtime\n// 3. used now for merging transforms atomically\nconst scannedNum = new WeakMap<CSSStyleSheet, number>()\n\nexport function updateInserted() {\n if (process.env.NODE_ENV === 'test') return\n if (!isClient) return\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const sheet = sheets[i]\n const rules = sheet.cssRules\n const len = rules.length\n const lastScanned = scannedNum.get(sheet) ?? 0\n if (lastScanned === len) {\n continue\n }\n for (let i = lastScanned; i < len; i++) {\n const rule = rules[i]\n const response = getTamaguiSelector(rule)\n if (!response) {\n continue\n }\n const [identifier, cssRule] = response\n if (!allSelectors[identifier]) {\n const isTransform = identifier.startsWith('_transform')\n const shouldInsert = isTransform ? addTransform(identifier, cssRule.cssText, cssRule) : true\n if (shouldInsert) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? cssRule.cssText : true\n }\n }\n }\n scannedNum.set(sheet, i)\n }\n}\n\nfunction getTamaguiSelector(rule: CSSRule | null): readonly [string, CSSStyleRule] | null {\n if (rule instanceof CSSStyleRule) {\n if (rule.selectorText.startsWith('._')) {\n return [rule.selectorText.slice(1), rule]\n }\n if (rule.selectorText.startsWith(':root') && rule.selectorText.includes('._')) {\n return [getIdentifierFromTamaguiSelector(rule.selectorText), rule]\n }\n } else if (rule instanceof CSSMediaRule) {\n // tamagui only ever inserts 1 rule per media\n if (rule.cssRules.length > 1) return null\n return getTamaguiSelector(rule.cssRules[0])\n }\n return null\n}\n\nconst getIdentifierFromTamaguiSelector = (selector: string) =>\n selector\n .replace(/(:root)+\\s+/, '')\n .replace(/:[a-z]+$/, '')\n .slice(1)\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nimport { StyleObject } from '@tamagui/helpers'\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n // sometimes getting empty style rules from webpack... :/ only in dev\n if (css.indexOf('{ }')) {\n console.log('wah wah')\n return false\n }\n console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.warn(`Missing transform`, identifier, css, rule)\n }\n return false\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n if (!insertedTransforms[identifier]) {\n insertedTransforms[identifier] = value\n return true\n }\n return false\n}\n\nconst isClient = typeof document !== 'undefined'\n\n// gets existing ones (client side)\n// takes ~0.1ms for a fairly large page\n// used now for three things:\n// 1. debugging at dev time\n// 2. avoid duplicate insert styles at runtime\n// 3. used now for merging transforms atomically\nconst scannedNum = new WeakMap<CSSStyleSheet, number>()\n\nexport function updateInserted() {\n if (process.env.NODE_ENV === 'test') return\n if (!isClient) return\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const sheet = sheets[i]\n const rules = sheet.cssRules\n const len = rules.length\n const lastScanned = scannedNum.get(sheet) ?? 0\n if (lastScanned === len) {\n continue\n }\n for (let i = lastScanned; i < len; i++) {\n const rule = rules[i]\n const response = getTamaguiSelector(rule)\n if (!response) {\n continue\n }\n const [identifier, cssRule] = response\n if (!allSelectors[identifier]) {\n const isTransform = identifier.startsWith('_transform')\n const shouldInsert = isTransform ? addTransform(identifier, cssRule.cssText, cssRule) : true\n if (shouldInsert) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? cssRule.cssText : true\n }\n }\n }\n scannedNum.set(sheet, i)\n }\n}\n\nfunction getTamaguiSelector(rule: CSSRule | null): readonly [string, CSSStyleRule] | null {\n if (rule instanceof CSSStyleRule) {\n if (rule.selectorText.startsWith('._')) {\n return [rule.selectorText.slice(1), rule]\n }\n if (rule.selectorText.startsWith(':root') && rule.selectorText.includes('._')) {\n return [getIdentifierFromTamaguiSelector(rule.selectorText), rule]\n }\n } else if (rule instanceof CSSMediaRule) {\n // tamagui only ever inserts 1 rule per media\n if (rule.cssRules.length > 1) return null\n return getTamaguiSelector(rule.cssRules[0])\n }\n return null\n}\n\nconst getIdentifierFromTamaguiSelector = (selector: string) =>\n selector\n .replace(/(:root)+\\s+/, '')\n .replace(/:[a-z]+$/, '')\n .slice(1)\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rules: string[]) {\n if (insertedSelectors[identifier]) return false\n insertedSelectors[identifier] = rules\n if (identifier.startsWith('_transform')) {\n return addTransform(identifier, rules[0])\n }\n return true\n}\n\n// [property, identifier, rules]\nexport type PartialStyleObject = Pick<StyleObject, 'identifier' | 'property' | 'rules'>\nexport type RulesToInsert = PartialStyleObject[]\n\nexport function insertStyleRules(rulesToInsert: RulesToInsert) {\n // // pointerevents can have more than one, others could to needs some refactor\n for (const { identifier, rules } of rulesToInsert) {\n if (allSelectors[identifier] || !sheet) return\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rules : true\n updateInsertedCache(identifier, rules)\n for (const rule of rules) {\n sheet.insertRule(rule, sheet.cssRules.length)\n }\n }\n}\n"],
|
|
5
|
+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AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,WAAO,aAAa,YAAY,MAAM,EAAE;AAAA,EAC1C;AACA,SAAO;AACT;AAMO,0BAA0B,eAA8B;AAE7D,aAAW,EAAE,YAAY,WAAW,eAAe;AACjD,QAAI,aAAa,eAAe,CAAC;AAAO;AACxC,iBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,QAAQ;AAC5E,wBAAoB,YAAY,KAAK;AACrC,eAAW,QAAQ,OAAO;AACxB,YAAM,WAAW,MAAM,MAAM,SAAS,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,18 +20,19 @@ __export(matchMedia_exports, {
|
|
|
20
20
|
matchMedia: () => matchMedia
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(matchMedia_exports);
|
|
23
|
-
const matchMedia = typeof window !== "undefined" && window.matchMedia ||
|
|
23
|
+
const matchMedia = typeof window !== "undefined" && window.matchMedia || matchMediaFallback;
|
|
24
|
+
function matchMediaFallback(query) {
|
|
25
|
+
if (process.env.NODE_ENV === "development" && !process.env.IS_STATIC && process.env.TAMAGUI_TARGET !== "web") {
|
|
26
|
+
console.log("warning: matchMedia not loading! Native not picking up .native.js files?");
|
|
27
|
+
}
|
|
24
28
|
return {
|
|
25
29
|
addListener() {
|
|
26
|
-
if (process.env.NODE_ENV === "development" && !process.env.IS_STATIC && process.env.TAMAGUI_TARGET !== "web") {
|
|
27
|
-
console.log("warning: matchMedia not loading! Is native picking up .native.js files?");
|
|
28
|
-
}
|
|
29
30
|
},
|
|
30
31
|
removeListener() {
|
|
31
32
|
},
|
|
32
33
|
matches: false
|
|
33
34
|
};
|
|
34
|
-
}
|
|
35
|
+
}
|
|
35
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
37
|
0 && (module.exports = {
|
|
37
38
|
matchMedia
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/matchMedia.ts"],
|
|
4
|
-
"sourcesContent": ["export const matchMedia
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,
|
|
4
|
+
"sourcesContent": ["export const matchMedia = (typeof window !== 'undefined' && window.matchMedia) || matchMediaFallback\n\nfunction matchMediaFallback(query: string): MediaQueryList {\n if (\n process.env.NODE_ENV === 'development' &&\n !process.env.IS_STATIC &&\n process.env.TAMAGUI_TARGET !== 'web'\n ) {\n console.log('warning: matchMedia not loading! Native not picking up .native.js files?')\n }\n return {\n addListener() {},\n removeListener() {},\n matches: false,\n } as any\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAc,OAAO,WAAW,eAAe,OAAO,cAAe;AAElF,4BAA4B,OAA+B;AACzD,MACE,QAAQ,IAAI,aAAa,iBACzB,CAAC,QAAQ,IAAI,aACb,QAAQ,IAAI,mBAAmB,OAC/B;AACA,YAAQ,IAAI,0EAA0E;AAAA,EACxF;AACA,SAAO;AAAA,IACL,cAAc;AAAA,IAAC;AAAA,IACf,iBAAiB;AAAA,IAAC;AAAA,IAClB,SAAS;AAAA,EACX;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var startTransition_exports = {};
|
|
22
|
+
__export(startTransition_exports, {
|
|
23
|
+
startTransition: () => startTransition
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(startTransition_exports);
|
|
26
|
+
var import_react = __toESM(require("react"));
|
|
27
|
+
const startTransition = import_react.default.startTransition || ((cb) => cb());
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
startTransition
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=startTransition.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/startTransition.ts"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\n// backwards compat\nexport const startTransition = React.startTransition || ((cb) => cb())\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGX,MAAM,kBAAkB,qBAAM,mBAAoB,EAAC,OAAO,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -25,10 +25,13 @@ __export(wrapThemeManagerContext_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(wrapThemeManagerContext_exports);
|
|
26
26
|
var import_react = __toESM(require("react"));
|
|
27
27
|
var import_ThemeManager = require("../ThemeManager");
|
|
28
|
-
|
|
28
|
+
var import_Theme = require("../views/Theme");
|
|
29
|
+
function wrapThemeManagerContext(children, themeManager, shouldSetChildrenThemeToParent) {
|
|
29
30
|
return themeManager ? /* @__PURE__ */ import_react.default.createElement(import_ThemeManager.ThemeManagerContext.Provider, {
|
|
30
31
|
value: themeManager
|
|
31
|
-
},
|
|
32
|
+
}, shouldSetChildrenThemeToParent ? /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
|
|
33
|
+
name: themeManager.parentName
|
|
34
|
+
}, children) : children) : children;
|
|
32
35
|
}
|
|
33
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
37
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/wrapThemeManagerContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import React
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\nimport { ThemeManager, ThemeManagerContext } from '../ThemeManager'\nimport { Theme } from '../views/Theme'\n\nexport function wrapThemeManagerContext(\n children: any,\n themeManager?: ThemeManager | null,\n shouldSetChildrenThemeToParent?: boolean\n) {\n return themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {shouldSetChildrenThemeToParent ? (\n <Theme name={themeManager.parentName}>{children}</Theme>\n ) : (\n children\n )}\n </ThemeManagerContext.Provider>\n ) : (\n children\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,0BAAkD;AAClD,mBAAsB;AAEf,iCACL,UACA,cACA,gCACA;AACA,SAAO,eACL,mDAAC,wCAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAClC,iCACC,mDAAC;AAAA,IAAM,MAAM,aAAa;AAAA,KAAa,QAAS,IAEhD,QAEJ,IAEA;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var getThemeUnwrapped_exports = {};
|
|
19
|
+
__export(getThemeUnwrapped_exports, {
|
|
20
|
+
GetThemeUnwrapped: () => GetThemeUnwrapped,
|
|
21
|
+
getThemeUnwrapped: () => getThemeUnwrapped
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getThemeUnwrapped_exports);
|
|
24
|
+
const getThemeUnwrapped = (theme) => {
|
|
25
|
+
const first = theme[GetThemeUnwrapped];
|
|
26
|
+
if (first)
|
|
27
|
+
return first[GetThemeUnwrapped] || first;
|
|
28
|
+
return theme;
|
|
29
|
+
};
|
|
30
|
+
const GetThemeUnwrapped = Symbol();
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
GetThemeUnwrapped,
|
|
34
|
+
getThemeUnwrapped
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=getThemeUnwrapped.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/getThemeUnwrapped.tsx"],
|
|
4
|
+
"sourcesContent": ["export const getThemeUnwrapped = (theme: any) => {\n const first = theme[GetThemeUnwrapped]\n if (first) return first[GetThemeUnwrapped] || first\n return theme\n}\n\nexport const GetThemeUnwrapped = Symbol()\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,oBAAoB,CAAC,UAAe;AAC/C,QAAM,QAAQ,MAAM;AACpB,MAAI;AAAO,WAAO,MAAM,sBAAsB;AAC9C,SAAO;AACT;AAEO,MAAM,oBAAoB,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var useIsSSR_exports = {};
|
|
19
|
+
__export(useIsSSR_exports, {
|
|
20
|
+
useIsSSR: () => useIsSSR
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(useIsSSR_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
var import_platform = require("../constants/platform");
|
|
25
|
+
var import_startTransition = require("../helpers/startTransition");
|
|
26
|
+
const useIsSSR = () => {
|
|
27
|
+
const [val, setVal] = (0, import_react.useState)(import_platform.isSSR);
|
|
28
|
+
(0, import_react.useEffect)(() => {
|
|
29
|
+
if (import_platform.isWeb && !import_platform.isSSR) {
|
|
30
|
+
(0, import_startTransition.startTransition)(() => {
|
|
31
|
+
setVal(false);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
return val;
|
|
36
|
+
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
useIsSSR
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=useIsSSR.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useIsSSR.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useState } from 'react'\n\nimport { isSSR, isWeb } from '../constants/platform'\nimport { startTransition } from '../helpers/startTransition'\n\n// because any change before first useEffect causes hydration / mismatch issues\n\nexport const useIsSSR = () => {\n const [val, setVal] = useState(isSSR)\n\n useEffect(() => {\n if (isWeb && !isSSR) {\n startTransition(() => {\n setVal(false)\n })\n }\n }, [])\n\n return val\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAEpC,sBAA6B;AAC7B,6BAAgC;AAIzB,MAAM,WAAW,MAAM;AAC5B,QAAM,CAAC,KAAK,UAAU,2BAAS,qBAAK;AAEpC,8BAAU,MAAM;AACd,QAAI,yBAAS,CAAC,uBAAO;AACnB,kDAAgB,MAAM;AACpB,eAAO,KAAK;AAAA,MACd,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -23,12 +23,14 @@ module.exports = __toCommonJS(useIsTouchDevice_exports);
|
|
|
23
23
|
var import_react = require("react");
|
|
24
24
|
var import_platform = require("../constants/platform");
|
|
25
25
|
const useIsTouchDevice = () => {
|
|
26
|
-
const [touchOnly, setTouchOnly] = (0, import_react.useState)(
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const [touchOnly, setTouchOnly] = (0, import_react.useState)(import_platform.isTouchable);
|
|
27
|
+
if (import_platform.isWeb && !import_platform.isSSR) {
|
|
28
|
+
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
29
|
+
if (import_platform.isTouchable) {
|
|
30
|
+
setTouchOnly(true);
|
|
31
|
+
}
|
|
32
|
+
}, []);
|
|
33
|
+
}
|
|
32
34
|
return touchOnly;
|
|
33
35
|
};
|
|
34
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useIsTouchDevice.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useState } from 'react'\n\nimport { isTouchable, useIsomorphicLayoutEffect } from '../constants/platform'\n\n// ssr friendly\n\nexport const useIsTouchDevice = () => {\n const [touchOnly, setTouchOnly] = useState(false)\n\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyB;AAEzB,
|
|
4
|
+
"sourcesContent": ["import { useState } from 'react'\n\nimport { isSSR, isTouchable, isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\n\n// ssr friendly\n\nexport const useIsTouchDevice = () => {\n const [touchOnly, setTouchOnly] = useState(isTouchable)\n\n if (isWeb && !isSSR) {\n // only ever false on web SSR (env), so run effect conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useIsomorphicLayoutEffect(() => {\n if (isTouchable) {\n setTouchOnly(true)\n }\n }, [])\n }\n\n return touchOnly\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyB;AAEzB,sBAAqE;AAI9D,MAAM,mBAAmB,MAAM;AACpC,QAAM,CAAC,WAAW,gBAAgB,2BAAS,2BAAW;AAEtD,MAAI,yBAAS,CAAC,uBAAO;AAGnB,mDAA0B,MAAM;AAC9B,UAAI,6BAAa;AACf,qBAAa,IAAI;AAAA,MACnB;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
var useTheme_exports = {};
|
|
36
36
|
__export(useTheme_exports, {
|
|
37
|
-
|
|
37
|
+
getThemeManager: () => getThemeManager,
|
|
38
38
|
useChangeThemeEffect: () => useChangeThemeEffect,
|
|
39
39
|
useDefaultThemeName: () => useDefaultThemeName,
|
|
40
40
|
useTheme: () => useTheme,
|
|
@@ -48,9 +48,10 @@ var import_platform = require("../constants/platform");
|
|
|
48
48
|
var import_areEqualSets = require("../helpers/areEqualSets");
|
|
49
49
|
var import_ThemeContext = require("../ThemeContext");
|
|
50
50
|
var import_ThemeManager = require("../ThemeManager");
|
|
51
|
+
var import_getThemeUnwrapped = require("./getThemeUnwrapped");
|
|
51
52
|
var import_useConstant = require("./useConstant");
|
|
52
53
|
const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
53
|
-
const { name, theme, themes, themeManager, className
|
|
54
|
+
const { name, theme, themes, themeManager, className } = useChangeThemeEffect(themeName, componentName, props, forceUpdate);
|
|
54
55
|
if (process.env.NODE_ENV === "development") {
|
|
55
56
|
if ((props == null ? void 0 : props.debug) === "verbose") {
|
|
56
57
|
console.log(" \xBB useTheme", { themeName, componentName, name, className });
|
|
@@ -90,19 +91,11 @@ const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
|
90
91
|
return Reflect.has(theme, key);
|
|
91
92
|
},
|
|
92
93
|
get(_, key) {
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
if (process.env.NODE_ENV === "development" && (props == null ? void 0 : props.debug) && typeof window !== "undefined") {
|
|
96
|
-
console.log(">>", { themeName, didChangeTheme, name, componentName }, themeManager);
|
|
97
|
-
}
|
|
98
|
-
if (!didChangeTheme)
|
|
99
|
-
return null;
|
|
100
|
-
return themeManager;
|
|
101
|
-
}
|
|
102
|
-
return Reflect.get(_, key);
|
|
94
|
+
if (key === import_getThemeUnwrapped.GetThemeUnwrapped) {
|
|
95
|
+
return theme;
|
|
103
96
|
}
|
|
104
|
-
if (
|
|
105
|
-
return
|
|
97
|
+
if (key === GetThemeManager) {
|
|
98
|
+
return themeManager;
|
|
106
99
|
}
|
|
107
100
|
if (key === "name") {
|
|
108
101
|
return name;
|
|
@@ -110,6 +103,9 @@ const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
|
110
103
|
if (key === "className") {
|
|
111
104
|
return className;
|
|
112
105
|
}
|
|
106
|
+
if (!name || key === "__proto__" || typeof key === "symbol" || key === "$typeof") {
|
|
107
|
+
return Reflect.get(_, key);
|
|
108
|
+
}
|
|
113
109
|
if (!themeManager) {
|
|
114
110
|
console.error("No themeManager");
|
|
115
111
|
return;
|
|
@@ -131,11 +127,13 @@ const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
|
131
127
|
}
|
|
132
128
|
}
|
|
133
129
|
});
|
|
134
|
-
}, [name, theme, className
|
|
130
|
+
}, [name, theme, className]);
|
|
135
131
|
};
|
|
136
|
-
const GetThemeManager = Symbol(
|
|
137
|
-
const
|
|
138
|
-
|
|
132
|
+
const GetThemeManager = Symbol();
|
|
133
|
+
const getThemeManager = (theme) => {
|
|
134
|
+
if (!theme)
|
|
135
|
+
return;
|
|
136
|
+
return theme[GetThemeManager];
|
|
139
137
|
};
|
|
140
138
|
const useThemeName = (opts) => {
|
|
141
139
|
const parent = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
|
|
@@ -186,19 +184,17 @@ const useChangeThemeEffect = (name, componentName, props, forceUpdateProp) => {
|
|
|
186
184
|
});
|
|
187
185
|
}, [themes, name, componentName, debug, next == null ? void 0 : next.name]);
|
|
188
186
|
}
|
|
189
|
-
const didChangeTheme = next && parentManager && next.name !== parentManager.fullName;
|
|
190
187
|
return __spreadProps(__spreadValues(__spreadValues({}, parentManager && {
|
|
191
188
|
name: parentManager.name,
|
|
192
189
|
theme: parentManager.theme
|
|
193
190
|
}), next), {
|
|
194
|
-
didChangeTheme,
|
|
195
191
|
themes,
|
|
196
192
|
themeManager
|
|
197
193
|
});
|
|
198
194
|
};
|
|
199
195
|
// Annotate the CommonJS export names for ESM import in node:
|
|
200
196
|
0 && (module.exports = {
|
|
201
|
-
|
|
197
|
+
getThemeManager,
|
|
202
198
|
useChangeThemeEffect,
|
|
203
199
|
useDefaultThemeName,
|
|
204
200
|
useTheme,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useTheme.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { ThemeContext } from '../ThemeContext'\nimport { GetNextThemeProps, ThemeManager, ThemeManagerContext, emptyManager } from '../ThemeManager'\nimport { ThemeName, ThemeObject } from '../types'\nimport { useConstant } from './useConstant'\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA+B;AAC/B,mBAA8E;AAE9E,kBAA0B;AAC1B,sBAAiD;AACjD,0BAA6B;AAC7B,0BAA6B;AAC7B,0BAAmF;AAEnF,yBAA4B;AAkBrB,MAAM,WAAW,CACtB,WACA,eACA,OACA,gBACgB;AAChB,QAAM,EAAE,MAAM,OAAO,QAAQ,cAAc,
|
|
4
|
+
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { ThemeContext } from '../ThemeContext'\nimport { GetNextThemeProps, ThemeManager, ThemeManagerContext, emptyManager } from '../ThemeManager'\nimport { ThemeName, ThemeObject } from '../types'\nimport { GetThemeUnwrapped } from './getThemeUnwrapped'\nimport { useConstant } from './useConstant'\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n console.log(' \u00BB useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n return useMemo(() => {\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('No theme', { themeName, theme, componentName, className })\n }\n return themes[getConfig().defaultTheme || 'light' || Object.keys(themes)[0]]\n }\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string') {\n if (key[0] === '$') {\n key = key.slice(1)\n }\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (key === GetThemeUnwrapped) {\n return theme\n }\n if (key === GetThemeManager) {\n return themeManager\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!name || key === '__proto__' || typeof key === 'symbol' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n if (!themeManager) {\n console.error('No themeManager')\n return\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n const val = themeManager.getValue(key)\n if (val) {\n if (state.current.isRendering) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development') {\n if (props?.['debug'] === 'verbose') {\n console.log(' \u00BB tracking theme key', key)\n }\n }\n }\n return val\n }\n },\n })\n }, [name, theme, className])\n}\n\nconst GetThemeManager = Symbol()\n\nexport const getThemeManager = (theme: any): ThemeManager | undefined => {\n if (!theme) return\n return theme[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdateProp?: any\n) => {\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const { themes } = useContext(ThemeContext)!\n const reset = props?.reset || false\n const getThemeProps: GetNextThemeProps = { name, componentName, themes, reset }\n const next = parentManager.getNextTheme(getThemeProps, debug)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const forceUpdate = forceUpdateProp || useForceUpdate()\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!next) return null\n return new ThemeManager(next.name, next.theme, parentManager, reset)\n })\n\n if (!isWeb || typeof document !== 'undefined') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n if (!themeManager) return\n if (next?.name) {\n themeManager.update(next)\n }\n return parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme(getThemeProps, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n }, [themes, name, componentName, debug, next?.name])\n }\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n themes,\n themeManager,\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA+B;AAC/B,mBAA8E;AAE9E,kBAA0B;AAC1B,sBAAiD;AACjD,0BAA6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.js
CHANGED
|
@@ -60,6 +60,7 @@ __reExport(src_exports, require("./helpers/isObj"), module.exports);
|
|
|
60
60
|
__reExport(src_exports, require("./helpers/isTamaguiElement"), module.exports);
|
|
61
61
|
__reExport(src_exports, require("./helpers/isTamaguiComponent"), module.exports);
|
|
62
62
|
__reExport(src_exports, require("./helpers/matchMedia"), module.exports);
|
|
63
|
+
__reExport(src_exports, require("./helpers/startTransition"), module.exports);
|
|
63
64
|
__reExport(src_exports, require("./helpers/themeable"), module.exports);
|
|
64
65
|
__reExport(src_exports, require("./helpers/withStaticProperties"), module.exports);
|
|
65
66
|
__reExport(src_exports, require("./contexts/ButtonInsideButtonContext"), module.exports);
|
|
@@ -70,9 +71,8 @@ __reExport(src_exports, require("./hooks/useIsTouchDevice"), module.exports);
|
|
|
70
71
|
__reExport(src_exports, require("./hooks/useMedia"), module.exports);
|
|
71
72
|
__reExport(src_exports, require("./hooks/usePressable"), module.exports);
|
|
72
73
|
__reExport(src_exports, require("./hooks/useTheme"), module.exports);
|
|
73
|
-
__reExport(src_exports, require("./hooks/
|
|
74
|
+
__reExport(src_exports, require("./hooks/useIsSSR"), module.exports);
|
|
74
75
|
__reExport(src_exports, require("./hooks/useUnmountEffect"), module.exports);
|
|
75
|
-
__reExport(src_exports, require("./hooks/useEvent"), module.exports);
|
|
76
76
|
__reExport(src_exports, require("./views/Slot"), module.exports);
|
|
77
77
|
__reExport(src_exports, require("./views/Stack"), module.exports);
|
|
78
78
|
__reExport(src_exports, require("./views/Text"), module.exports);
|
|
@@ -82,6 +82,7 @@ __reExport(src_exports, require("./views/ThemeInverse"), module.exports);
|
|
|
82
82
|
__reExport(src_exports, require("./views/ThemeProvider"), module.exports);
|
|
83
83
|
__reExport(src_exports, require("./views/ThemeReset"), module.exports);
|
|
84
84
|
__reExport(src_exports, require("@tamagui/use-force-update"), module.exports);
|
|
85
|
+
__reExport(src_exports, require("@tamagui/use-event"), module.exports);
|
|
85
86
|
__reExport(src_exports, require("@tamagui/helpers"), module.exports);
|
|
86
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
88
|
0 && (module.exports = {
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './styled'\nexport * from './types'\n// for type portability\nexport type { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport { createDOMProps } from '@tamagui/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors'\nexport * from './helpers/mergeProps'\nexport * from './helpers/expandStyles'\nexport * from './helpers/getFont'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport * from './hooks/useMedia'\nexport * from './hooks/usePressable'\nexport * from './hooks/useTheme'\nexport * from './hooks/
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,sBAAd;AACA,wBAAc,8BADd;AAEA,wBAAc,+BAFd;AAGA,wBAAc,0BAHd;AAIA,wBAAc,4BAJd;AAKA,wBAAc,yBALd;AAMA,wBAAc,2BANd;AAOA,wBAAc,6BAPd;AAQA,wBAAc,8BARd;AASA,wBAAc,yBATd;AAUA,wBAAc,qBAVd;AAWA,wBAAc,oBAXd;AAcA,kBAAoF;AAEpF,wBAAc,kCAhBd;AAiBA,wBAAc,iCAjBd;AAkBA,iBAA+B;AAE/B,wBAAc,2BApBd;AAqBA,wBAAc,0CArBd;AAsBA,wBAAc,mCAtBd;AAuBA,wBAAc,uCAvBd;AAwBA,wBAAc,4CAxBd;AAyBA,wBAAc,8BAzBd;AA0BA,wBAAc,qCA1Bd;AA2BA,wBAAc,sCA3Bd;AA4BA,wBAAc,wCA5Bd;AA6BA,wBAAc,iCA7Bd;AA8BA,wBAAc,mCA9Bd;AA+BA,wBAAc,8BA/Bd;AAgCA,wBAAc,4BAhCd;AAiCA,wBAAc,uCAjCd;AAkCA,wBAAc,yCAlCd;AAmCA,wBAAc,iCAnCd;AAoCA,wBAAc,
|
|
4
|
+
"sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './styled'\nexport * from './types'\n// for type portability\nexport type { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport { createDOMProps } from '@tamagui/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors'\nexport * from './helpers/mergeProps'\nexport * from './helpers/expandStyles'\nexport * from './helpers/getFont'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/startTransition'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport * from './hooks/useMedia'\nexport * from './hooks/usePressable'\nexport * from './hooks/useTheme'\nexport * from './hooks/useIsSSR'\nexport * from './hooks/useUnmountEffect'\n\nexport * from './views/Slot'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport { TextAncestorProvider, TextAncestorContext } from './views/TextAncestorContext'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/ThemeReset'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/use-event'\nexport * from '@tamagui/helpers'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,sBAAd;AACA,wBAAc,8BADd;AAEA,wBAAc,+BAFd;AAGA,wBAAc,0BAHd;AAIA,wBAAc,4BAJd;AAKA,wBAAc,yBALd;AAMA,wBAAc,2BANd;AAOA,wBAAc,6BAPd;AAQA,wBAAc,8BARd;AASA,wBAAc,yBATd;AAUA,wBAAc,qBAVd;AAWA,wBAAc,oBAXd;AAcA,kBAAoF;AAEpF,wBAAc,kCAhBd;AAiBA,wBAAc,iCAjBd;AAkBA,iBAA+B;AAE/B,wBAAc,2BApBd;AAqBA,wBAAc,0CArBd;AAsBA,wBAAc,mCAtBd;AAuBA,wBAAc,uCAvBd;AAwBA,wBAAc,4CAxBd;AAyBA,wBAAc,8BAzBd;AA0BA,wBAAc,qCA1Bd;AA2BA,wBAAc,sCA3Bd;AA4BA,wBAAc,wCA5Bd;AA6BA,wBAAc,iCA7Bd;AA8BA,wBAAc,mCA9Bd;AA+BA,wBAAc,8BA/Bd;AAgCA,wBAAc,4BAhCd;AAiCA,wBAAc,uCAjCd;AAkCA,wBAAc,yCAlCd;AAmCA,wBAAc,iCAnCd;AAoCA,wBAAc,sCApCd;AAqCA,wBAAc,gCArCd;AAsCA,wBAAc,2CAtCd;AAwCA,wBAAc,iDAxCd;AA0CA,wBAAc,gCA1Cd;AA2CA,wBAAc,0BA3Cd;AA4CA,wBAAc,iCA5Cd;AA6CA,wBAAc,qCA7Cd;AA8CA,wBAAc,6BA9Cd;AA+CA,wBAAc,iCA/Cd;AAgDA,wBAAc,6BAhDd;AAiDA,wBAAc,6BAjDd;AAkDA,wBAAc,qCAlDd;AAoDA,wBAAc,yBApDd;AAqDA,wBAAc,0BArDd;AAsDA,wBAAc,yBAtDd;AAuDA,iCAA0D;AAC1D,wBAAc,0BAxDd;AAyDA,wBAAc,iCAzDd;AA0DA,wBAAc,kCA1Dd;AA2DA,wBAAc,+BA3Dd;AA6DA,wBAAc,sCA7Dd;AA8DA,wBAAc,+BA9Dd;AA+DA,wBAAc,6BA/Dd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var startTransition_exports = {};
|
|
22
|
+
__export(startTransition_exports, {
|
|
23
|
+
startTransition: () => startTransition
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(startTransition_exports);
|
|
26
|
+
var import_react = __toESM(require("react"));
|
|
27
|
+
const startTransition = import_react.default.startTransition || ((cb) => cb());
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
startTransition
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=startTransition.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/startTransition.ts"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\n// backwards compat\nexport const startTransition = React.startTransition || ((cb) => cb())\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGX,MAAM,kBAAkB,qBAAM,mBAAoB,EAAC,OAAO,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|