@tamagui/web 1.122.7 → 1.122.8
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/views/ThemeProvider.cjs +18 -14
- package/dist/cjs/views/ThemeProvider.js +19 -16
- package/dist/cjs/views/ThemeProvider.js.map +1 -1
- package/dist/cjs/views/ThemeProvider.native.js +6 -5
- package/dist/cjs/views/ThemeProvider.native.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +19 -16
- package/dist/esm/views/ThemeProvider.js.map +1 -1
- package/dist/esm/views/ThemeProvider.mjs +18 -14
- package/dist/esm/views/ThemeProvider.mjs.map +1 -1
- package/dist/esm/views/ThemeProvider.native.js +6 -5
- package/dist/esm/views/ThemeProvider.native.js.map +2 -2
- package/package.json +11 -11
- package/src/views/ThemeProvider.tsx +9 -7
- package/types/views/ThemeProvider.d.ts.map +1 -1
|
@@ -40,17 +40,21 @@ var import_react = __toESM(require("react")),
|
|
|
40
40
|
import_Theme = require("./Theme.cjs"),
|
|
41
41
|
import_config = require("../config.cjs"),
|
|
42
42
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
-
const ThemeProvider = props =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
const ThemeProvider = props => {
|
|
44
|
+
const disableRootThemeClass = props.disableRootThemeClass ?? (0, import_config.getSetting)("disableRootThemeClass"),
|
|
45
|
+
themeClassNameOnRoot = props.themeClassNameOnRoot ?? (0, import_config.getSetting)("themeClassNameOnRoot");
|
|
46
|
+
return import_constants.isClient && import_react.default.useLayoutEffect(() => {
|
|
47
|
+
if (disableRootThemeClass) return;
|
|
48
|
+
const cn = `${import_constants2.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`,
|
|
49
|
+
target = themeClassNameOnRoot ? document.documentElement : document.body;
|
|
50
|
+
return target.classList.add(cn), () => {
|
|
51
|
+
target.classList.remove(cn);
|
|
52
|
+
};
|
|
53
|
+
}, [props.defaultTheme, disableRootThemeClass, themeClassNameOnRoot]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Theme.Theme, {
|
|
54
|
+
className: props.className,
|
|
55
|
+
name: props.defaultTheme,
|
|
56
|
+
forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
|
|
57
|
+
_isRoot: !0,
|
|
58
|
+
children: props.children
|
|
59
|
+
});
|
|
60
|
+
};
|
|
@@ -26,20 +26,23 @@ __export(ThemeProvider_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(ThemeProvider_exports);
|
|
28
28
|
var import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_constants2 = require("../constants/constants"), import_Theme = require("./Theme"), import_config = require("../config"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
-
const ThemeProvider = (props) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
target.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
const ThemeProvider = (props) => {
|
|
30
|
+
const disableRootThemeClass = props.disableRootThemeClass ?? (0, import_config.getSetting)("disableRootThemeClass"), themeClassNameOnRoot = props.themeClassNameOnRoot ?? (0, import_config.getSetting)("themeClassNameOnRoot");
|
|
31
|
+
return import_constants.isClient && import_react.default.useLayoutEffect(() => {
|
|
32
|
+
if (disableRootThemeClass) return;
|
|
33
|
+
const cn = `${import_constants2.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`, target = themeClassNameOnRoot ? document.documentElement : document.body;
|
|
34
|
+
return target.classList.add(cn), () => {
|
|
35
|
+
target.classList.remove(cn);
|
|
36
|
+
};
|
|
37
|
+
}, [props.defaultTheme, disableRootThemeClass, themeClassNameOnRoot]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
38
|
+
import_Theme.Theme,
|
|
39
|
+
{
|
|
40
|
+
className: props.className,
|
|
41
|
+
name: props.defaultTheme,
|
|
42
|
+
forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
|
|
43
|
+
_isRoot: !0,
|
|
44
|
+
children: props.children
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
};
|
|
45
48
|
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,mBAAyB,+BAEzBA,oBAAuC,mCACvC,eAAsB,oBACtB,gBAA2B,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,mBAAyB,+BAEzBA,oBAAuC,mCACvC,eAAsB,oBACtB,gBAA2B,sBAiCvB;AApBG,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,wBACJ,MAAM,6BAAyB,0BAAW,uBAAuB,GAC7D,uBACJ,MAAM,4BAAwB,0BAAW,sBAAsB;AAGjE,SAAI,6BACF,aAAAC,QAAM,gBAAgB,MAAM;AAC1B,QAAI,sBAAuB;AAC3B,UAAM,KAAK,GAAG,wCAAsB,GAAG,MAAM,YAAY,IACnD,SAAS,uBAAuB,SAAS,kBAAkB,SAAS;AAC1E,kBAAO,UAAU,IAAI,EAAE,GAChB,MAAM;AACX,aAAO,UAAU,OAAO,EAAE;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,MAAM,cAAc,uBAAuB,oBAAoB,CAAC,GAIpE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MAEZ,gBAAgB,CAAC,yBAAyB,CAAC;AAAA,MAE3C,SAAO;AAAA,MAEN,gBAAM;AAAA;AAAA,EACT;AAEJ;",
|
|
5
5
|
"names": ["import_constants", "React"]
|
|
6
6
|
}
|
|
@@ -27,22 +27,23 @@ __export(ThemeProvider_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(ThemeProvider_exports);
|
|
29
29
|
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_constants2 = require("../constants/constants"), import_Theme = require("./Theme"), import_config = require("../config"), ThemeProvider = function(props) {
|
|
30
|
+
var _props_disableRootThemeClass, disableRootThemeClass = (_props_disableRootThemeClass = props.disableRootThemeClass) !== null && _props_disableRootThemeClass !== void 0 ? _props_disableRootThemeClass : (0, import_config.getSetting)("disableRootThemeClass"), _props_themeClassNameOnRoot, themeClassNameOnRoot = (_props_themeClassNameOnRoot = props.themeClassNameOnRoot) !== null && _props_themeClassNameOnRoot !== void 0 ? _props_themeClassNameOnRoot : (0, import_config.getSetting)("themeClassNameOnRoot");
|
|
30
31
|
return import_constants.isClient && import_react.default.useLayoutEffect(function() {
|
|
31
|
-
if (!
|
|
32
|
-
var cn = `${import_constants2.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`,
|
|
32
|
+
if (!disableRootThemeClass) {
|
|
33
|
+
var cn = `${import_constants2.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`, target = themeClassNameOnRoot ? document.documentElement : document.body;
|
|
33
34
|
return target.classList.add(cn), function() {
|
|
34
35
|
target.classList.remove(cn);
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
}, [
|
|
38
39
|
props.defaultTheme,
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
disableRootThemeClass,
|
|
41
|
+
themeClassNameOnRoot
|
|
41
42
|
]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
|
|
42
43
|
className: props.className,
|
|
43
44
|
name: props.defaultTheme,
|
|
44
45
|
// if root class disabled, force class here
|
|
45
|
-
forceClassName: !
|
|
46
|
+
forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
|
|
46
47
|
// @ts-expect-error
|
|
47
48
|
_isRoot: !0,
|
|
48
49
|
children: props.children
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Users/n8/tamagui/code/core/web/src/views/ThemeProvider.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,mBAAyB,+BAEzBA,oBAAuC,mCACvC,eAAsB,oBACtB,gBAA2B,sBAadC,gBAAgB,SAACC,OAAAA;
|
|
5
|
-
"names": ["import_constants", "ThemeProvider", "props", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,mBAAyB,+BAEzBA,oBAAuC,mCACvC,eAAsB,oBACtB,gBAA2B,sBAadC,gBAAgB,SAACC,OAAAA;MAE1BA,8BADIC,yBACJD,+BAAAA,MAAMC,2BAAqB,QAA3BD,iCAAAA,SAAAA,mCAA+BE,0BAAW,uBAAA,GAE1CF,6BADIG,wBACJH,8BAAAA,MAAMG,0BAAoB,QAA1BH,gCAAAA,SAAAA,kCAA8BE,0BAAW,sBAAA;AAG3C,SAAIE,6BACFC,aAAAA,QAAMC,gBAAgB,WAAA;AACpB,QAAIL,wBACJ;UAAMM,KAAK,GAAGC,wCAAAA,GAAyBR,MAAMS,YAAY,IACnDC,SAASP,uBAAuBQ,SAASC,kBAAkBD,SAASE;AAC1EH,oBAAOI,UAAUC,IAAIR,EAAAA,GACd,WAAA;AACLG,eAAOI,UAAUE,OAAOT,EAAAA;MAC1B;;EACF,GAAG;IAACP,MAAMS;IAAcR;IAAuBE;GAAqB,GAIpE,uCAAAc,KAACC,oBAAAA;IACCC,WAAWnB,MAAMmB;IACjBC,MAAMpB,MAAMS;;IAEZY,gBAAgB,CAACpB,yBAAyB,CAACE;;IAE3CmB,SAAO;cAENtB,MAAMuB;;AAGb;",
|
|
5
|
+
"names": ["import_constants", "ThemeProvider", "props", "disableRootThemeClass", "getSetting", "themeClassNameOnRoot", "isClient", "React", "useLayoutEffect", "cn", "THEME_CLASSNAME_PREFIX", "defaultTheme", "target", "document", "documentElement", "body", "classList", "add", "remove", "_jsx", "Theme", "className", "name", "forceClassName", "_isRoot", "children"]
|
|
6
6
|
}
|
|
@@ -4,22 +4,25 @@ import { THEME_CLASSNAME_PREFIX } from "../constants/constants";
|
|
|
4
4
|
import { Theme } from "./Theme";
|
|
5
5
|
import { getSetting } from "../config";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
const ThemeProvider = (props) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
target.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const ThemeProvider = (props) => {
|
|
8
|
+
const disableRootThemeClass = props.disableRootThemeClass ?? getSetting("disableRootThemeClass"), themeClassNameOnRoot = props.themeClassNameOnRoot ?? getSetting("themeClassNameOnRoot");
|
|
9
|
+
return isClient && React.useLayoutEffect(() => {
|
|
10
|
+
if (disableRootThemeClass) return;
|
|
11
|
+
const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`, target = themeClassNameOnRoot ? document.documentElement : document.body;
|
|
12
|
+
return target.classList.add(cn), () => {
|
|
13
|
+
target.classList.remove(cn);
|
|
14
|
+
};
|
|
15
|
+
}, [props.defaultTheme, disableRootThemeClass, themeClassNameOnRoot]), /* @__PURE__ */ jsx(
|
|
16
|
+
Theme,
|
|
17
|
+
{
|
|
18
|
+
className: props.className,
|
|
19
|
+
name: props.defaultTheme,
|
|
20
|
+
forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
|
|
21
|
+
_isRoot: !0,
|
|
22
|
+
children: props.children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
23
26
|
export {
|
|
24
27
|
ThemeProvider
|
|
25
28
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAEzB,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,kBAAkB;
|
|
4
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAEzB,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAiCvB;AApBG,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,wBACJ,MAAM,yBAAyB,WAAW,uBAAuB,GAC7D,uBACJ,MAAM,wBAAwB,WAAW,sBAAsB;AAGjE,SAAI,YACF,MAAM,gBAAgB,MAAM;AAC1B,QAAI,sBAAuB;AAC3B,UAAM,KAAK,GAAG,sBAAsB,GAAG,MAAM,YAAY,IACnD,SAAS,uBAAuB,SAAS,kBAAkB,SAAS;AAC1E,kBAAO,UAAU,IAAI,EAAE,GAChB,MAAM;AACX,aAAO,UAAU,OAAO,EAAE;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,MAAM,cAAc,uBAAuB,oBAAoB,CAAC,GAIpE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MAEZ,gBAAgB,CAAC,yBAAyB,CAAC;AAAA,MAE3C,SAAO;AAAA,MAEN,gBAAM;AAAA;AAAA,EACT;AAEJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -4,19 +4,23 @@ import { THEME_CLASSNAME_PREFIX } from "../constants/constants.mjs";
|
|
|
4
4
|
import { Theme } from "./Theme.mjs";
|
|
5
5
|
import { getSetting } from "../config.mjs";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
const ThemeProvider = props =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
const ThemeProvider = props => {
|
|
8
|
+
const disableRootThemeClass = props.disableRootThemeClass ?? getSetting("disableRootThemeClass"),
|
|
9
|
+
themeClassNameOnRoot = props.themeClassNameOnRoot ?? getSetting("themeClassNameOnRoot");
|
|
10
|
+
return isClient && React.useLayoutEffect(() => {
|
|
11
|
+
if (disableRootThemeClass) return;
|
|
12
|
+
const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`,
|
|
13
|
+
target = themeClassNameOnRoot ? document.documentElement : document.body;
|
|
14
|
+
return target.classList.add(cn), () => {
|
|
15
|
+
target.classList.remove(cn);
|
|
16
|
+
};
|
|
17
|
+
}, [props.defaultTheme, disableRootThemeClass, themeClassNameOnRoot]), /* @__PURE__ */jsx(Theme, {
|
|
18
|
+
className: props.className,
|
|
19
|
+
name: props.defaultTheme,
|
|
20
|
+
forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
|
|
21
|
+
_isRoot: !0,
|
|
22
|
+
children: props.children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
21
25
|
export { ThemeProvider };
|
|
22
26
|
//# sourceMappingURL=ThemeProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","isClient","THEME_CLASSNAME_PREFIX","Theme","getSetting","jsx","ThemeProvider","props","
|
|
1
|
+
{"version":3,"names":["React","isClient","THEME_CLASSNAME_PREFIX","Theme","getSetting","jsx","ThemeProvider","props","disableRootThemeClass","themeClassNameOnRoot","useLayoutEffect","cn","defaultTheme","target","document","documentElement","body","classList","add","remove","className","name","forceClassName","_isRoot","children"],"sources":["../../../src/views/ThemeProvider.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,QAAA,QAAgB;AAEzB,SAASC,sBAAA,QAA8B;AACvC,SAASC,KAAA,QAAa;AACtB,SAASC,UAAA,QAAkB;AAiCvB,SAAAC,GAAA;AApBG,MAAMC,aAAA,GAAiBC,KAAA,IAA8B;EAC1D,MAAMC,qBAAA,GACJD,KAAA,CAAMC,qBAAA,IAAyBJ,UAAA,CAAW,uBAAuB;IAC7DK,oBAAA,GACJF,KAAA,CAAME,oBAAA,IAAwBL,UAAA,CAAW,sBAAsB;EAGjE,OAAIH,QAAA,IACFD,KAAA,CAAMU,eAAA,CAAgB,MAAM;IAC1B,IAAIF,qBAAA,EAAuB;IAC3B,MAAMG,EAAA,GAAK,GAAGT,sBAAsB,GAAGK,KAAA,CAAMK,YAAY;MACnDC,MAAA,GAASJ,oBAAA,GAAuBK,QAAA,CAASC,eAAA,GAAkBD,QAAA,CAASE,IAAA;IAC1E,OAAAH,MAAA,CAAOI,SAAA,CAAUC,GAAA,CAAIP,EAAE,GAChB,MAAM;MACXE,MAAA,CAAOI,SAAA,CAAUE,MAAA,CAAOR,EAAE;IAC5B;EACF,GAAG,CAACJ,KAAA,CAAMK,YAAA,EAAcJ,qBAAA,EAAuBC,oBAAoB,CAAC,GAIpE,eAAAJ,GAAA,CAACF,KAAA;IACCiB,SAAA,EAAWb,KAAA,CAAMa,SAAA;IACjBC,IAAA,EAAMd,KAAA,CAAMK,YAAA;IAEZU,cAAA,EAAgB,CAACd,qBAAA,IAAyB,CAACC,oBAAA;IAE3Cc,OAAA,EAAO;IAENC,QAAA,EAAAjB,KAAA,CAAMiB;EAAA,CACT;AAEJ","ignoreList":[]}
|
|
@@ -5,22 +5,23 @@ import { THEME_CLASSNAME_PREFIX } from "../constants/constants";
|
|
|
5
5
|
import { Theme } from "./Theme";
|
|
6
6
|
import { getSetting } from "../config";
|
|
7
7
|
var ThemeProvider = function(props) {
|
|
8
|
+
var _props_disableRootThemeClass, disableRootThemeClass = (_props_disableRootThemeClass = props.disableRootThemeClass) !== null && _props_disableRootThemeClass !== void 0 ? _props_disableRootThemeClass : getSetting("disableRootThemeClass"), _props_themeClassNameOnRoot, themeClassNameOnRoot = (_props_themeClassNameOnRoot = props.themeClassNameOnRoot) !== null && _props_themeClassNameOnRoot !== void 0 ? _props_themeClassNameOnRoot : getSetting("themeClassNameOnRoot");
|
|
8
9
|
return isClient && React.useLayoutEffect(function() {
|
|
9
|
-
if (!
|
|
10
|
-
var cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`,
|
|
10
|
+
if (!disableRootThemeClass) {
|
|
11
|
+
var cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`, target = themeClassNameOnRoot ? document.documentElement : document.body;
|
|
11
12
|
return target.classList.add(cn), function() {
|
|
12
13
|
target.classList.remove(cn);
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
}, [
|
|
16
17
|
props.defaultTheme,
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
disableRootThemeClass,
|
|
19
|
+
themeClassNameOnRoot
|
|
19
20
|
]), /* @__PURE__ */ _jsx(Theme, {
|
|
20
21
|
className: props.className,
|
|
21
22
|
name: props.defaultTheme,
|
|
22
23
|
// if root class disabled, force class here
|
|
23
|
-
forceClassName: !
|
|
24
|
+
forceClassName: !disableRootThemeClass && !themeClassNameOnRoot,
|
|
24
25
|
// @ts-expect-error
|
|
25
26
|
_isRoot: !0,
|
|
26
27
|
children: props.children
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Users/n8/tamagui/code/core/web/src/views/ThemeProvider.tsx"],
|
|
4
|
-
"mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,gBAAgB;AAEzB,SAASC,8BAA8B;AACvC,SAASC,aAAa;AACtB,SAASC,kBAAkB;AAapB,IAAMC,gBAAgB,SAACC,OAAAA;
|
|
5
|
-
"names": ["React", "isClient", "THEME_CLASSNAME_PREFIX", "Theme", "getSetting", "ThemeProvider", "props", "
|
|
4
|
+
"mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,gBAAgB;AAEzB,SAASC,8BAA8B;AACvC,SAASC,aAAa;AACtB,SAASC,kBAAkB;AAapB,IAAMC,gBAAgB,SAACC,OAAAA;MAE1BA,8BADIC,yBACJD,+BAAAA,MAAMC,2BAAqB,QAA3BD,iCAAAA,SAAAA,+BAA+BF,WAAW,uBAAA,GAE1CE,6BADIE,wBACJF,8BAAAA,MAAME,0BAAoB,QAA1BF,gCAAAA,SAAAA,8BAA8BF,WAAW,sBAAA;AAG3C,SAAIH,YACFD,MAAMS,gBAAgB,WAAA;AACpB,QAAIF,wBACJ;UAAMG,KAAK,GAAGR,sBAAAA,GAAyBI,MAAMK,YAAY,IACnDC,SAASJ,uBAAuBK,SAASC,kBAAkBD,SAASE;AAC1EH,oBAAOI,UAAUC,IAAIP,EAAAA,GACd,WAAA;AACLE,eAAOI,UAAUE,OAAOR,EAAAA;MAC1B;;EACF,GAAG;IAACJ,MAAMK;IAAcJ;IAAuBC;GAAqB,GAIpE,qBAACL,OAAAA;IACCgB,WAAWb,MAAMa;IACjBC,MAAMd,MAAMK;;IAEZU,gBAAgB,CAACd,yBAAyB,CAACC;;IAE3Cc,SAAO;cAENhB,MAAMiB;;AAGb;",
|
|
5
|
+
"names": ["React", "isClient", "THEME_CLASSNAME_PREFIX", "Theme", "getSetting", "ThemeProvider", "props", "disableRootThemeClass", "themeClassNameOnRoot", "useLayoutEffect", "cn", "defaultTheme", "target", "document", "documentElement", "body", "classList", "add", "remove", "className", "name", "forceClassName", "_isRoot", "children"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.122.
|
|
3
|
+
"version": "1.122.8",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.122.
|
|
31
|
-
"@tamagui/constants": "1.122.
|
|
32
|
-
"@tamagui/helpers": "1.122.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.122.
|
|
34
|
-
"@tamagui/timer": "1.122.
|
|
35
|
-
"@tamagui/types": "1.122.
|
|
36
|
-
"@tamagui/use-did-finish-ssr": "1.122.
|
|
37
|
-
"@tamagui/use-event": "1.122.
|
|
38
|
-
"@tamagui/use-force-update": "1.122.
|
|
30
|
+
"@tamagui/compose-refs": "1.122.8",
|
|
31
|
+
"@tamagui/constants": "1.122.8",
|
|
32
|
+
"@tamagui/helpers": "1.122.8",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.122.8",
|
|
34
|
+
"@tamagui/timer": "1.122.8",
|
|
35
|
+
"@tamagui/types": "1.122.8",
|
|
36
|
+
"@tamagui/use-did-finish-ssr": "1.122.8",
|
|
37
|
+
"@tamagui/use-event": "1.122.8",
|
|
38
|
+
"@tamagui/use-force-update": "1.122.8"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "*",
|
|
42
42
|
"react-dom": "*"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tamagui/build": "1.122.
|
|
45
|
+
"@tamagui/build": "1.122.8",
|
|
46
46
|
"@testing-library/react": "^16.1.0",
|
|
47
47
|
"csstype": "^3.0.10",
|
|
48
48
|
"react": "*",
|
|
@@ -17,20 +17,22 @@ export type ThemeProviderProps = {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
20
|
+
const disableRootThemeClass =
|
|
21
|
+
props.disableRootThemeClass ?? getSetting('disableRootThemeClass')
|
|
22
|
+
const themeClassNameOnRoot =
|
|
23
|
+
props.themeClassNameOnRoot ?? getSetting('themeClassNameOnRoot')
|
|
24
|
+
|
|
20
25
|
// ensure theme is attached to root body node as well to work with modals by default
|
|
21
26
|
if (isClient) {
|
|
22
27
|
React.useLayoutEffect(() => {
|
|
23
|
-
if (
|
|
28
|
+
if (disableRootThemeClass) return
|
|
24
29
|
const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`
|
|
25
|
-
const target =
|
|
26
|
-
(props.themeClassNameOnRoot ?? getSetting('themeClassNameOnRoot'))
|
|
27
|
-
? document.documentElement
|
|
28
|
-
: document.body
|
|
30
|
+
const target = themeClassNameOnRoot ? document.documentElement : document.body
|
|
29
31
|
target.classList.add(cn)
|
|
30
32
|
return () => {
|
|
31
33
|
target.classList.remove(cn)
|
|
32
34
|
}
|
|
33
|
-
}, [props.defaultTheme,
|
|
35
|
+
}, [props.defaultTheme, disableRootThemeClass, themeClassNameOnRoot])
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
return (
|
|
@@ -38,7 +40,7 @@ export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
|
38
40
|
className={props.className}
|
|
39
41
|
name={props.defaultTheme}
|
|
40
42
|
// if root class disabled, force class here
|
|
41
|
-
forceClassName={!
|
|
43
|
+
forceClassName={!disableRootThemeClass && !themeClassNameOnRoot}
|
|
42
44
|
// @ts-expect-error
|
|
43
45
|
_isRoot
|
|
44
46
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/views/ThemeProvider.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,kFAAkF;IAClF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,iFAAiF;IACjF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/views/ThemeProvider.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,kFAAkF;IAClF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,iFAAiF;IACjF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,kBAAkB,4CA+BtD,CAAA"}
|