@tamagui/core 1.0.1-beta.131 → 1.0.1-beta.132
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.
|
@@ -36,16 +36,22 @@ let inversions = {
|
|
|
36
36
|
function setThemeInversions(next) {
|
|
37
37
|
inversions = next;
|
|
38
38
|
}
|
|
39
|
-
const ThemeInverse = (
|
|
39
|
+
const ThemeInverse = ({
|
|
40
|
+
children,
|
|
41
|
+
disable
|
|
42
|
+
}) => {
|
|
40
43
|
const themeName = (0, import_useTheme.useThemeName)();
|
|
41
44
|
const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
|
|
42
45
|
const [name, setName] = (0, import_react.useState)(null);
|
|
43
46
|
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
44
47
|
setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
|
|
45
48
|
}, [defaultTheme, themeName]);
|
|
49
|
+
if (disable) {
|
|
50
|
+
return children;
|
|
51
|
+
}
|
|
46
52
|
return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
|
|
47
53
|
name
|
|
48
|
-
},
|
|
54
|
+
}, children);
|
|
49
55
|
};
|
|
50
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
57
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeInverse.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAEhC,sBAA0C;AAC1C,sBAAkD;AAClD,mBAAsB;AAItB,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAEO,MAAM,eAAe,CAAC,
|
|
4
|
+
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = ({\n children,\n disable,\n}: {\n children: React.ReactNode\n disable?: boolean\n}) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n setName(inversions[themeName] || inversions[defaultTheme || ''] || null)\n }, [defaultTheme, themeName])\n\n if (disable) {\n return children as JSX.Element\n }\n\n return <Theme name={name}>{children}</Theme>\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAEhC,sBAA0C;AAC1C,sBAAkD;AAClD,mBAAsB;AAItB,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAEO,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,YAAY,kCAAa;AAC/B,QAAM,eAAe,yCAAoB;AACzC,QAAM,CAAC,MAAM,WAAW,2BAAwB,IAAI;AAGpD,iDAA0B,MAAM;AAC9B,YAAQ,WAAW,cAAc,WAAW,gBAAgB,OAAO,IAAI;AAAA,EACzE,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,SAAO,mDAAC;AAAA,IAAM;AAAA,KAAa,QAAS;AACtC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,16 +9,22 @@ let inversions = {
|
|
|
9
9
|
function setThemeInversions(next) {
|
|
10
10
|
inversions = next;
|
|
11
11
|
}
|
|
12
|
-
const ThemeInverse = (
|
|
12
|
+
const ThemeInverse = ({
|
|
13
|
+
children,
|
|
14
|
+
disable
|
|
15
|
+
}) => {
|
|
13
16
|
const themeName = useThemeName();
|
|
14
17
|
const defaultTheme = useDefaultThemeName();
|
|
15
18
|
const [name, setName] = useState(null);
|
|
16
19
|
useIsomorphicLayoutEffect(() => {
|
|
17
20
|
setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
|
|
18
21
|
}, [defaultTheme, themeName]);
|
|
22
|
+
if (disable) {
|
|
23
|
+
return children;
|
|
24
|
+
}
|
|
19
25
|
return /* @__PURE__ */ React.createElement(Theme, {
|
|
20
26
|
name
|
|
21
|
-
},
|
|
27
|
+
}, children);
|
|
22
28
|
};
|
|
23
29
|
export {
|
|
24
30
|
ThemeInverse,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeInverse.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (
|
|
5
|
-
"mappings": "AAAA;AAEA;AACA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAEO,MAAM,eAAe,CAAC,
|
|
4
|
+
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = ({\n children,\n disable,\n}: {\n children: React.ReactNode\n disable?: boolean\n}) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n setName(inversions[themeName] || inversions[defaultTheme || ''] || null)\n }, [defaultTheme, themeName])\n\n if (disable) {\n return children as JSX.Element\n }\n\n return <Theme name={name}>{children}</Theme>\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AACA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR;AAEO,4BAA4B,MAAoB;AACrD,eAAa;AACf;AAEO,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,YAAY,aAAa;AAC/B,QAAM,eAAe,oBAAoB;AACzC,QAAM,CAAC,MAAM,WAAW,SAAwB,IAAI;AAGpD,4BAA0B,MAAM;AAC9B,YAAQ,WAAW,cAAc,WAAW,gBAAgB,OAAO,IAAI;AAAA,EACzE,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,SAAO,oCAAC;AAAA,IAAM;AAAA,KAAa,QAAS;AACtC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.132",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@expo/match-media": "^0.3.0",
|
|
25
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
26
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
27
|
-
"@tamagui/rnw": "^1.0.1-beta.
|
|
28
|
-
"@tamagui/use-debounce": "^1.0.1-beta.
|
|
29
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
30
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
25
|
+
"@tamagui/compose-refs": "^1.0.1-beta.132",
|
|
26
|
+
"@tamagui/helpers": "^1.0.1-beta.132",
|
|
27
|
+
"@tamagui/rnw": "^1.0.1-beta.132",
|
|
28
|
+
"@tamagui/use-debounce": "^1.0.1-beta.132",
|
|
29
|
+
"@tamagui/use-event": "^1.0.1-beta.132",
|
|
30
|
+
"@tamagui/use-force-update": "^1.0.1-beta.132",
|
|
31
31
|
"expo-screen-orientation": "^4.2.0",
|
|
32
32
|
"hyphenate-style-name": "^1.0.4",
|
|
33
33
|
"normalize-css-color": "^1.0.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-native-web": "*"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
41
|
+
"@tamagui/build": "^1.0.1-beta.132",
|
|
42
42
|
"@types/react": "^17.0.21",
|
|
43
43
|
"csstype": "^3.0.10",
|
|
44
44
|
"esbuild": "^0.14.49",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare type StringRecord = {
|
|
3
3
|
[key: string]: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function setThemeInversions(next: StringRecord): void;
|
|
6
|
-
export declare const ThemeInverse: (
|
|
7
|
-
children:
|
|
6
|
+
export declare const ThemeInverse: ({ children, disable, }: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
disable?: boolean | undefined;
|
|
8
9
|
}) => JSX.Element;
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=ThemeInverse.d.ts.map
|