@tamagui/core 1.0.0-alpha.1 → 1.0.0-alpha.6
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/LICENSE +21 -0
- package/dist/createComponent.js +43 -29
- package/dist/createComponent.js.map +2 -2
- package/dist/createVariable.js +3 -0
- package/dist/createVariable.js.map +2 -2
- package/dist/helpers/getSplitStyles.js +1 -13
- package/dist/helpers/getSplitStyles.js.map +2 -2
- package/dist/helpers/isComponent.js +10 -0
- package/dist/helpers/isComponent.js.map +7 -0
- package/dist/helpers/isTamaguiComponent.js +10 -0
- package/dist/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/helpers/isTamaguiElement.js +10 -0
- package/dist/helpers/isTamaguiElement.js.map +7 -0
- package/dist/hooks/useMedia.js +1 -1
- package/dist/hooks/useMedia.js.map +2 -2
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTheme.js.map +2 -2
- package/dist/index.cjs +145 -133
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +1 -2
- package/dist/index.js.map +2 -2
- package/dist/views/Theme.js +11 -4
- package/dist/views/Theme.js.map +2 -2
- package/dist/views/ThemeInverse.js +0 -1
- package/dist/views/ThemeInverse.js.map +2 -2
- package/package.json +13 -6
- package/src/createComponent.tsx +50 -38
- package/src/createVariable.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +3 -16
- package/src/helpers/isTamaguiElement.tsx +5 -0
- package/src/hooks/useMedia.tsx +1 -1
- package/src/hooks/useTheme.tsx +1 -1
- package/src/index.ts +1 -2
- package/src/views/Theme.tsx +12 -5
- package/src/views/ThemeInverse.tsx +0 -1
- package/types.d.ts +2 -5
- package/.ultra.cache.json +0 -1
- package/_/constants/constants.js +0 -14
- package/_/constants/constants.js.map +0 -7
- package/_/constants/platform.js +0 -20
- package/_/constants/platform.js.map +0 -7
- package/_/constants/pseudos.js +0 -18
- package/_/constants/pseudos.js.map +0 -7
- package/_/constants/rnw.js +0 -22
- package/_/constants/rnw.js.map +0 -7
- package/_/createComponent.js +0 -427
- package/_/createComponent.js.map +0 -7
- package/_/createShorthands.js +0 -10
- package/_/createShorthands.js.map +0 -7
- package/_/createTamagui.js +0 -122
- package/_/createTamagui.js.map +0 -7
- package/_/createTheme.js +0 -20
- package/_/createTheme.js.map +0 -7
- package/_/createTokens.js +0 -29
- package/_/createTokens.js.map +0 -7
- package/_/createVariable.js +0 -22
- package/_/createVariable.js.map +0 -7
- package/_/helpers/addStylesUsingClassname.js +0 -32
- package/_/helpers/addStylesUsingClassname.js.map +0 -7
- package/_/helpers/createMediaStyle.js +0 -34
- package/_/helpers/createMediaStyle.js.map +0 -7
- package/_/helpers/createTamaguiProvider.js +0 -42
- package/_/helpers/createTamaguiProvider.js.map +0 -7
- package/_/helpers/extendStaticConfig.js +0 -176
- package/_/helpers/extendStaticConfig.js.map +0 -7
- package/_/helpers/fixNativeShadow.js +0 -8
- package/_/helpers/fixNativeShadow.js.map +0 -7
- package/_/helpers/fixNativeShadow.native.js +0 -30
- package/_/helpers/fixNativeShadow.native.js.map +0 -7
- package/_/helpers/getSplitStyles.js +0 -160
- package/_/helpers/getSplitStyles.js.map +0 -7
- package/_/helpers/getStylesAtomic.js +0 -84
- package/_/helpers/getStylesAtomic.js.map +0 -7
- package/_/helpers/getStylesAtomic.native.js +0 -10
- package/_/helpers/getStylesAtomic.native.js.map +0 -7
- package/_/helpers/insertStyleRule.js +0 -24
- package/_/helpers/insertStyleRule.js.map +0 -7
- package/_/helpers/matchMedia.js +0 -15
- package/_/helpers/matchMedia.js.map +0 -7
- package/_/helpers/matchMedia.native.js +0 -8
- package/_/helpers/matchMedia.native.js.map +0 -7
- package/_/helpers/themeable.js +0 -26
- package/_/helpers/themeable.js.map +0 -7
- package/_/hooks/useConstant.js +0 -15
- package/_/hooks/useConstant.js.map +0 -7
- package/_/hooks/useFeatures.js +0 -75
- package/_/hooks/useFeatures.js.map +0 -7
- package/_/hooks/useForceUpdate.js +0 -28
- package/_/hooks/useForceUpdate.js.map +0 -7
- package/_/hooks/useMedia.js +0 -173
- package/_/hooks/useMedia.js.map +0 -7
- package/_/hooks/usePressable.js +0 -14
- package/_/hooks/usePressable.js.map +0 -7
- package/_/hooks/useTheme.js +0 -94
- package/_/hooks/useTheme.js.map +0 -7
- package/_/index.js +0 -30
- package/_/index.js.map +0 -7
- package/_/static/postProcessStyles.js +0 -18
- package/_/static/postProcessStyles.js.map +0 -7
- package/_/static.js +0 -12
- package/_/static.js.map +0 -7
- package/_/styled.js +0 -21
- package/_/styled.js.map +0 -7
- package/_/types.js +0 -1
- package/_/types.js.map +0 -7
- package/_/views/Animated.js +0 -79
- package/_/views/Animated.js.map +0 -7
- package/_/views/Stack.js +0 -12
- package/_/views/Stack.js.map +0 -7
- package/_/views/Text.js +0 -60
- package/_/views/Text.js.map +0 -7
- package/_/views/TextAncestorContext.js +0 -19
- package/_/views/TextAncestorContext.js.map +0 -7
- package/_/views/Theme.js +0 -57
- package/_/views/Theme.js.map +0 -7
- package/_/views/ThemeContext.js +0 -6
- package/_/views/ThemeContext.js.map +0 -7
- package/_/views/ThemeInverse.js +0 -27
- package/_/views/ThemeInverse.js.map +0 -7
- package/_/views/ThemeManagerContext.js +0 -56
- package/_/views/ThemeManagerContext.js.map +0 -7
- package/_/views/ThemeProvider.js +0 -45
- package/_/views/ThemeProvider.js.map +0 -7
- package/src/hooks/useForceUpdate.tsx +0 -26
- package/src/views/SafeAreaProvider.tsx +0 -33
- package/tsconfig.json +0 -8
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ export * from "./helpers/isObj";
|
|
|
15
15
|
export * from "./helpers/getStylesAtomic";
|
|
16
16
|
export * from "./helpers/matchMedia";
|
|
17
17
|
export * from "./helpers/themeable";
|
|
18
|
+
export * from "./helpers/isTamaguiElement";
|
|
18
19
|
export * from "./hooks/useConstant";
|
|
19
|
-
export * from "./hooks/useForceUpdate";
|
|
20
20
|
export * from "./hooks/useMedia";
|
|
21
21
|
export * from "./hooks/useTheme";
|
|
22
22
|
export * from "./views/Animated";
|
|
@@ -26,7 +26,6 @@ export * from "./views/Theme";
|
|
|
26
26
|
export * from "./views/ThemeInverse";
|
|
27
27
|
export * from "./views/ThemeProvider";
|
|
28
28
|
export * from "./views/TextAncestorContext";
|
|
29
|
-
export * from "./views/SafeAreaProvider";
|
|
30
29
|
export {
|
|
31
30
|
createTokens
|
|
32
31
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport { createTokens } from './createTokens'\nexport * from './createVariable'\nexport * from './styled'\nexport * from './types'\n\nexport * from './constants/pseudos'\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\
|
|
5
|
-
"mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;
|
|
4
|
+
"sourcesContent": ["export * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport { createTokens } from './createTokens'\nexport * from './createVariable'\nexport * from './styled'\nexport * from './types'\n\nexport * from './constants/pseudos'\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\nexport * from './helpers/isTamaguiElement'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './views/Animated'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/TextAncestorContext'\n"],
|
|
5
|
+
"mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/views/Theme.js
CHANGED
|
@@ -15,8 +15,12 @@ const Theme = /* @__PURE__ */ __name((props) => {
|
|
|
15
15
|
return props.children;
|
|
16
16
|
}
|
|
17
17
|
const name = props.name;
|
|
18
|
-
const
|
|
18
|
+
const activeName = !name ? null : name in themes ? name : `${name}-${parentName}`;
|
|
19
|
+
const theme = activeName ? themes[activeName] : null;
|
|
19
20
|
const themeManager = useConstant(() => {
|
|
21
|
+
if (!theme) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
20
24
|
const manager = new ThemeManager();
|
|
21
25
|
if (name) {
|
|
22
26
|
manager.setActiveTheme(name, themes[name]);
|
|
@@ -24,15 +28,18 @@ const Theme = /* @__PURE__ */ __name((props) => {
|
|
|
24
28
|
return manager;
|
|
25
29
|
});
|
|
26
30
|
useIsomorphicLayoutEffect(() => {
|
|
27
|
-
themeManager
|
|
31
|
+
if (!themeManager) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
themeManager.setActiveTheme(activeName, theme);
|
|
28
35
|
return parent.onChangeTheme((next) => {
|
|
29
36
|
if (next) {
|
|
30
37
|
themeManager.setActiveTheme(next, themes[next]);
|
|
31
38
|
setParentName(next);
|
|
32
39
|
}
|
|
33
40
|
});
|
|
34
|
-
}, [themes,
|
|
35
|
-
if (!name) {
|
|
41
|
+
}, [themes, activeName]);
|
|
42
|
+
if (!name || !theme) {
|
|
36
43
|
return props.children;
|
|
37
44
|
}
|
|
38
45
|
const contents = themeManager ? /* @__PURE__ */ React.createElement(ThemeManagerContext.Provider, {
|
package/dist/views/Theme.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/views/Theme.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName, Themes } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: ThemeName | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('no themes???', props)\n return props.children\n }\n const name = props.name as string\n const
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAC1C,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,gBAAgB;AAC7B,WAAO,MAAM;AAAA;AAEf,QAAM,OAAO,MAAM;AACnB,QAAM,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName, Themes } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: ThemeName | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('no themes???', props)\n return props.children\n }\n const name = props.name as string\n const activeName = !name ? null : name in themes ? name : `${name}-${parentName}`\n const theme = activeName ? themes[activeName] : null\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!theme) {\n return null\n }\n const manager = new ThemeManager()\n if (name) {\n manager.setActiveTheme(name, themes[name])\n }\n return manager\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!themeManager) {\n return\n }\n themeManager.setActiveTheme(activeName, theme)\n return parent.onChangeTheme((next) => {\n if (next) {\n themeManager.setActiveTheme(next, themes[next])\n setParentName(next)\n }\n })\n }, [themes, activeName])\n\n if (!name || !theme) {\n return props.children\n }\n\n const contents = themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {props.children}\n </ThemeManagerContext.Provider>\n ) : (\n props.children\n )\n\n if (isWeb) {\n if (props.disableThemeClass) {\n return contents\n }\n const color = themes[name]?.['color']?.['variable']\n return (\n <div\n className={getThemeParentClassName(name)}\n // in order to provide currentColor, set color by default\n style={{ display: 'contents', color }}\n >\n {contents}\n </div>\n )\n }\n\n return contents\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAC1C,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,gBAAgB;AAC7B,WAAO,MAAM;AAAA;AAEf,QAAM,OAAO,MAAM;AACnB,QAAM,aAAa,CAAC,OAAO,OAAO,QAAQ,SAAS,OAAO,GAAG,QAAQ;AACrE,QAAM,QAAQ,aAAa,OAAO,cAAc;AAChD,QAAM,eAAe,YAAiC,MAAM;AAC1D,QAAI,CAAC,OAAO;AACV,aAAO;AAAA;AAET,UAAM,UAAU,IAAI;AACpB,QAAI,MAAM;AACR,cAAQ,eAAe,MAAM,OAAO;AAAA;AAEtC,WAAO;AAAA;AAGT,4BAA0B,MAAM;AAC9B,QAAI,CAAC,cAAc;AACjB;AAAA;AAEF,iBAAa,eAAe,YAAY;AACxC,WAAO,OAAO,cAAc,CAAC,SAAS;AACpC,UAAI,MAAM;AACR,qBAAa,eAAe,MAAM,OAAO;AACzC,sBAAc;AAAA;AAAA;AAAA,KAGjB,CAAC,QAAQ;AAEZ,MAAI,CAAC,QAAQ,CAAC,OAAO;AACnB,WAAO,MAAM;AAAA;AAGf,QAAM,WAAW,eACf,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAClC,MAAM,YAGT,MAAM;AAGR,MAAI,OAAO;AACT,QAAI,MAAM,mBAAmB;AAC3B,aAAO;AAAA;AAET,UAAM,QAAQ,OAAO,QAAQ,WAAW;AACxC,WACE,oCAAC,OAAD;AAAA,MACE,WAAW,wBAAwB;AAAA,MAEnC,OAAO,EAAE,SAAS,YAAY;AAAA,OAE7B;AAAA;AAKP,SAAO;AAAA,GA/DY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,7 +15,6 @@ const ThemeInverse = /* @__PURE__ */ __name((props) => {
|
|
|
15
15
|
const themeName = useThemeName();
|
|
16
16
|
const defaultTheme = useDefaultThemeName();
|
|
17
17
|
const name = inversions[themeName] || inversions[defaultTheme] || null;
|
|
18
|
-
console.log("todo fixme invert", { themeName, defaultTheme, next: name });
|
|
19
18
|
return /* @__PURE__ */ React.createElement(Theme, {
|
|
20
19
|
name
|
|
21
20
|
}, props.children);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/views/ThemeInverse.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\n\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 = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme] || null\n
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,4BAA4B,MAAoB;AACrD,eAAa;AAAA;AADC;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY;AAClB,QAAM,eAAe;AACrB,QAAM,OAAO,WAAW,cAAc,WAAW,iBAAiB;AAClE,
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\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 = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme] || null\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAEA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,4BAA4B,MAAoB;AACrD,eAAa;AAAA;AADC;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY;AAClB,QAAM,eAAe;AACrB,QAAM,OAAO,WAAW,cAAc,WAAW,iBAAiB;AAClE,SAAO,oCAAC,OAAD;AAAA,IAAO;AAAA,KAAa,MAAM;AAAA,GAJP;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -9,17 +9,23 @@
|
|
|
9
9
|
"build": "tamagui-build",
|
|
10
10
|
"watch": "tamagui-build --watch"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"types.d.ts",
|
|
14
|
+
"dist",
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
12
17
|
"dependencies": {
|
|
13
|
-
"@tamagui/helpers": "^1.0.0-alpha.
|
|
18
|
+
"@tamagui/helpers": "^1.0.0-alpha.5",
|
|
19
|
+
"@tamagui/use-debounce": "^1.0.0-alpha.6",
|
|
20
|
+
"@tamagui/use-force-update": "^1.0.0-alpha.5",
|
|
14
21
|
"react": "*",
|
|
15
|
-
"react-dom": "*"
|
|
16
|
-
"react-native-safe-area-context": "^3.3.0"
|
|
22
|
+
"react-dom": "*"
|
|
17
23
|
},
|
|
18
24
|
"peerDependencies": {
|
|
19
25
|
"react-native-web": "*"
|
|
20
26
|
},
|
|
21
27
|
"devDependencies": {
|
|
22
|
-
"@tamagui/build": "^1.0.0-alpha.
|
|
28
|
+
"@tamagui/build": "^1.0.0-alpha.2",
|
|
23
29
|
"@types/react": "^17.0.35",
|
|
24
30
|
"esbuild": "^0.11.20",
|
|
25
31
|
"typescript": "^4.4.4"
|
|
@@ -29,5 +35,6 @@
|
|
|
29
35
|
},
|
|
30
36
|
"engines": {
|
|
31
37
|
"node": ">=16"
|
|
32
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "18a942d7a08109c8f5b8692a2adb20c69d56a7e1"
|
|
33
40
|
}
|
package/src/createComponent.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { concatClassName, stylePropsView } from '@tamagui/helpers'
|
|
2
|
+
import { useForceUpdate } from '@tamagui/use-force-update'
|
|
2
3
|
import React, {
|
|
3
4
|
Children,
|
|
4
5
|
Fragment,
|
|
@@ -20,7 +21,6 @@ import { addStylesUsingClassname, useStylesAsClassname } from './helpers/addStyl
|
|
|
20
21
|
import { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig'
|
|
21
22
|
import { getSplitStyles } from './helpers/getSplitStyles'
|
|
22
23
|
import { useFeatures } from './hooks/useFeatures'
|
|
23
|
-
import { useForceUpdate } from './hooks/useForceUpdate'
|
|
24
24
|
import { usePressable } from './hooks/usePressable'
|
|
25
25
|
import {
|
|
26
26
|
SpaceTokens,
|
|
@@ -68,6 +68,44 @@ export function createComponent<A extends Object = DefaultProps>(
|
|
|
68
68
|
// see onConfiguredOnce below which attaches a name then to this component
|
|
69
69
|
|
|
70
70
|
const component = forwardRef<View, A>((props: any, forwardedRef) => {
|
|
71
|
+
const forceUpdate = useForceUpdate()
|
|
72
|
+
const features = useFeatures(props, { forceUpdate })
|
|
73
|
+
const manager = useContext(ThemeManagerContext)
|
|
74
|
+
const [state, set_] = useState(() => ({
|
|
75
|
+
hover: false,
|
|
76
|
+
press: false,
|
|
77
|
+
pressIn: false,
|
|
78
|
+
theme: manager.name,
|
|
79
|
+
}))
|
|
80
|
+
const set = (next: Partial<typeof state>) =>
|
|
81
|
+
set_((prev) => {
|
|
82
|
+
for (const key in next) {
|
|
83
|
+
if (prev[key] !== next[key]) {
|
|
84
|
+
return { ...prev, ...next }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return prev
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// from react-native-web
|
|
91
|
+
if (process.env.NODE_ENV === 'development' && !isText && isWeb) {
|
|
92
|
+
Children.toArray(props.children).forEach((item) => {
|
|
93
|
+
if (typeof item === 'string') {
|
|
94
|
+
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`)
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false
|
|
100
|
+
const hostRef = useRef(null)
|
|
101
|
+
|
|
102
|
+
const {
|
|
103
|
+
viewProps: viewPropsIn,
|
|
104
|
+
pseudos,
|
|
105
|
+
style,
|
|
106
|
+
classNames,
|
|
107
|
+
} = getSplitStyles(props, staticConfig, (manager.theme as any) || initialTheme)
|
|
108
|
+
|
|
71
109
|
const {
|
|
72
110
|
tag,
|
|
73
111
|
hitSlop,
|
|
@@ -101,40 +139,19 @@ export function createComponent<A extends Object = DefaultProps>(
|
|
|
101
139
|
onStartShouldSetResponderCapture,
|
|
102
140
|
onMouseDown,
|
|
103
141
|
onClick,
|
|
104
|
-
// TODO feature load layou hook
|
|
105
|
-
onLayout,
|
|
106
|
-
} = props
|
|
107
142
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const manager = useContext(ThemeManagerContext)
|
|
111
|
-
const [state, set_] = useState(() => ({
|
|
112
|
-
hover: false,
|
|
113
|
-
press: false,
|
|
114
|
-
pressIn: false,
|
|
115
|
-
theme: manager.name,
|
|
116
|
-
}))
|
|
117
|
-
const set = (next: Partial<typeof state>) =>
|
|
118
|
-
set_((prev) => {
|
|
119
|
-
for (const key in next) {
|
|
120
|
-
if (prev[key] !== next[key]) {
|
|
121
|
-
return { ...prev, ...next }
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return prev
|
|
125
|
-
})
|
|
143
|
+
accessible,
|
|
144
|
+
accessibilityRole,
|
|
126
145
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`)
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
}
|
|
146
|
+
// TODO feature load layout hook
|
|
147
|
+
onLayout,
|
|
148
|
+
...viewProps
|
|
149
|
+
} = viewPropsIn
|
|
135
150
|
|
|
136
|
-
|
|
137
|
-
|
|
151
|
+
if (!isWeb) {
|
|
152
|
+
if (accessible) viewProps.accessible = accessible
|
|
153
|
+
if (accessibilityRole) viewProps.accessibilityRole = accessibilityRole
|
|
154
|
+
}
|
|
138
155
|
|
|
139
156
|
if (isWeb) {
|
|
140
157
|
// from react-native-web
|
|
@@ -160,12 +177,6 @@ export function createComponent<A extends Object = DefaultProps>(
|
|
|
160
177
|
|
|
161
178
|
const isTracking = useRef(false)
|
|
162
179
|
|
|
163
|
-
const { viewProps, pseudos, style, classNames } = getSplitStyles(
|
|
164
|
-
props,
|
|
165
|
-
staticConfig,
|
|
166
|
-
(manager.theme as any) || initialTheme
|
|
167
|
-
)
|
|
168
|
-
|
|
169
180
|
// hasEverHadEvents prevents repareting if you remove onPress or similar...
|
|
170
181
|
const internal = useRef<{ isMounted: boolean; hasEverHadEvents?: boolean }>()
|
|
171
182
|
if (!internal.current) {
|
|
@@ -228,6 +239,7 @@ export function createComponent<A extends Object = DefaultProps>(
|
|
|
228
239
|
]
|
|
229
240
|
: [defaultsClassName, props.className, classNames, stylesClassNames]
|
|
230
241
|
|
|
242
|
+
// @ts-expect-error
|
|
231
243
|
const className = concatClassName(...classList)
|
|
232
244
|
if (process.env.NODE_ENV === 'development') {
|
|
233
245
|
if (props['debug']) {
|
package/src/createVariable.ts
CHANGED
|
@@ -28,7 +28,6 @@ export const getSplitStyles = (
|
|
|
28
28
|
const validStyleProps = staticConfig.isText ? stylePropsText : validStyles
|
|
29
29
|
const viewProps: Record<string, any> = {}
|
|
30
30
|
const style: any[] = []
|
|
31
|
-
const blacklistProps = isSplittingDefaultProps ? blacklistDefaultProps : blacklistFinalProps
|
|
32
31
|
|
|
33
32
|
let pseudos: { hoverStyle?: ViewStyle; pressStyle?: ViewStyle } | null = null
|
|
34
33
|
let cur: ViewStyle | null = null
|
|
@@ -130,8 +129,9 @@ export const getSplitStyles = (
|
|
|
130
129
|
cur[key] = val
|
|
131
130
|
continue
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
|
|
133
|
+
// pass to view props
|
|
134
|
+
if (!staticConfig.variants || !(key in staticConfig.variants)) {
|
|
135
135
|
viewProps[key] = val
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -181,19 +181,6 @@ const getSubStyle = (
|
|
|
181
181
|
return styleOut
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
const blacklistDefaultProps = {
|
|
185
|
-
...validStyles,
|
|
186
|
-
...stylePropsText,
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const blacklistFinalProps = {
|
|
190
|
-
...blacklistDefaultProps,
|
|
191
|
-
tag: true,
|
|
192
|
-
debug: true,
|
|
193
|
-
space: true,
|
|
194
|
-
hitSlop: true,
|
|
195
|
-
}
|
|
196
|
-
|
|
197
184
|
const mapTransformKeys = {
|
|
198
185
|
x: 'translateX',
|
|
199
186
|
y: 'translateY',
|
package/src/hooks/useMedia.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useForceUpdate } from '@tamagui/use-force-update'
|
|
1
2
|
import { useRef } from 'react'
|
|
2
3
|
|
|
3
4
|
import { useIsomorphicLayoutEffect } from '../constants/platform'
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
MediaQueryState,
|
|
10
11
|
} from '../types'
|
|
11
12
|
import { useConstant } from './useConstant'
|
|
12
|
-
import { useForceUpdate } from './useForceUpdate'
|
|
13
13
|
|
|
14
14
|
export const mediaState: { [key in keyof MediaQueryState]: boolean } = {} as any
|
|
15
15
|
const mediaQueryListeners: { [key: string]: Set<Function> } = {}
|
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useForceUpdate } from '@tamagui/use-force-update'
|
|
1
2
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
3
|
|
|
3
4
|
import { useIsomorphicLayoutEffect } from '../constants/platform'
|
|
@@ -6,7 +7,6 @@ import { ThemeName } from '../types'
|
|
|
6
7
|
import { ThemeContext } from '../views/ThemeContext'
|
|
7
8
|
import { ThemeManagerContext } from '../views/ThemeManagerContext'
|
|
8
9
|
import { GET_DEFAULT_THEME } from '../views/ThemeProvider'
|
|
9
|
-
import { useForceUpdate } from './useForceUpdate'
|
|
10
10
|
|
|
11
11
|
type UseThemeState = {
|
|
12
12
|
uuid: Object
|
package/src/index.ts
CHANGED
|
@@ -17,9 +17,9 @@ export * from './helpers/isObj'
|
|
|
17
17
|
export * from './helpers/getStylesAtomic'
|
|
18
18
|
export * from './helpers/matchMedia'
|
|
19
19
|
export * from './helpers/themeable'
|
|
20
|
+
export * from './helpers/isTamaguiElement'
|
|
20
21
|
|
|
21
22
|
export * from './hooks/useConstant'
|
|
22
|
-
export * from './hooks/useForceUpdate'
|
|
23
23
|
export * from './hooks/useMedia'
|
|
24
24
|
export * from './hooks/useTheme'
|
|
25
25
|
|
|
@@ -30,4 +30,3 @@ export * from './views/Theme'
|
|
|
30
30
|
export * from './views/ThemeInverse'
|
|
31
31
|
export * from './views/ThemeProvider'
|
|
32
32
|
export * from './views/TextAncestorContext'
|
|
33
|
-
export * from './views/SafeAreaProvider'
|
package/src/views/Theme.tsx
CHANGED
|
@@ -22,8 +22,12 @@ export const Theme = (props: ThemeProps) => {
|
|
|
22
22
|
return props.children
|
|
23
23
|
}
|
|
24
24
|
const name = props.name as string
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const activeName = !name ? null : name in themes ? name : `${name}-${parentName}`
|
|
26
|
+
const theme = activeName ? themes[activeName] : null
|
|
27
|
+
const themeManager = useConstant<ThemeManager | null>(() => {
|
|
28
|
+
if (!theme) {
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
27
31
|
const manager = new ThemeManager()
|
|
28
32
|
if (name) {
|
|
29
33
|
manager.setActiveTheme(name, themes[name])
|
|
@@ -32,16 +36,19 @@ export const Theme = (props: ThemeProps) => {
|
|
|
32
36
|
})
|
|
33
37
|
|
|
34
38
|
useIsomorphicLayoutEffect(() => {
|
|
35
|
-
themeManager
|
|
39
|
+
if (!themeManager) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
themeManager.setActiveTheme(activeName, theme)
|
|
36
43
|
return parent.onChangeTheme((next) => {
|
|
37
44
|
if (next) {
|
|
38
45
|
themeManager.setActiveTheme(next, themes[next])
|
|
39
46
|
setParentName(next)
|
|
40
47
|
}
|
|
41
48
|
})
|
|
42
|
-
}, [themes,
|
|
49
|
+
}, [themes, activeName])
|
|
43
50
|
|
|
44
|
-
if (!name) {
|
|
51
|
+
if (!name || !theme) {
|
|
45
52
|
return props.children
|
|
46
53
|
}
|
|
47
54
|
|
|
@@ -18,6 +18,5 @@ export const ThemeInverse = (props: { children: any }) => {
|
|
|
18
18
|
const themeName = useThemeName()
|
|
19
19
|
const defaultTheme = useDefaultThemeName()
|
|
20
20
|
const name = inversions[themeName] || inversions[defaultTheme] || null
|
|
21
|
-
console.log('todo fixme invert', { themeName, defaultTheme, next: name })
|
|
22
21
|
return <Theme name={name}>{props.children}</Theme>
|
|
23
22
|
}
|
package/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class Variable {
|
|
|
11
11
|
val: string | number;
|
|
12
12
|
variable: string | number;
|
|
13
13
|
constructor({ val, name }: VariableIn);
|
|
14
|
+
toString(): string | number;
|
|
14
15
|
}
|
|
15
16
|
export declare type VariableIn = {
|
|
16
17
|
val: string | number;
|
|
@@ -491,8 +492,8 @@ export declare const themeable: ThemeableHOC;
|
|
|
491
492
|
export interface ThemeableHOC {
|
|
492
493
|
<R extends ReactElement<any, any> | null, P extends ThemeableProps = {}>(component: (props: P) => R): (props: P) => R;
|
|
493
494
|
}
|
|
495
|
+
export declare const isTamaguiElement: (child: any) => child is React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
494
496
|
export declare function useConstant<T>(fn: () => T): T;
|
|
495
|
-
export declare function useForceUpdate(): Function;
|
|
496
497
|
export declare const mediaState: {
|
|
497
498
|
[key in keyof MediaQueryState]: boolean;
|
|
498
499
|
};
|
|
@@ -550,9 +551,5 @@ export declare const ThemeInverse: (props: {
|
|
|
550
551
|
}) => JSX.Element;
|
|
551
552
|
export declare const TextAncestorContext: any;
|
|
552
553
|
export declare const TextAncestorProvider: (props: any) => any;
|
|
553
|
-
export declare const SafeAreaProvider: ({ initialWindowMetrics, children, }: {
|
|
554
|
-
children?: any;
|
|
555
|
-
initialWindowMetrics?: any;
|
|
556
|
-
}) => JSX.Element;
|
|
557
554
|
|
|
558
555
|
export {};
|
package/.ultra.cache.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"files":{"_":"1637340237894.082","dist":"1637479554052.672",".npmignore":"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391","package.json":"adf7cec75fc901122883d8d6a4cd32b04d410467","src/constants/constants.ts":"557e9930ddfa8fad6d74219ae7245c80551b8794","src/constants/platform.ts":"f6c5d92ce473942bb07bd3e799255dacbf88fe04","src/constants/pseudos.ts":"52c7655f92eaa265601eaf4a31b6db1688875321","src/constants/rnw.tsx":"ebc4ce292c30d344945b75e151a272023461f784","src/createComponent.tsx":"cccfd41966f4dde4e4c62e7b7d38f658088b7f01","src/createFont.ts":"819966bc37e24da3fe2d8c06a68520f0fe5d125e","src/createShorthands.ts":"7b5ce250bc5d049fcf9f5898efc60fdc91f2988d","src/createTamagui.ts":"6e79d67d36eac7a4f5edc8b97e3914eea89ee593","src/createTheme.ts":"aa9b7c08901c1dff621a371912f3cbf1c2507301","src/createTokens.ts":"e5b1ac5cc0a68ca0ec3753a1a0bd5a4af9b825b3","src/createVariable.ts":"da248891d943b04d940205762b1239751af6c7cc","src/helpers/addStylesUsingClassname.tsx":"eab83e8172210b5cea57a408f13cd20e6152d752","src/helpers/createMediaStyle.ts":"3c5ff33628b5cc8de55bdcedc3133b968b5fb210","src/helpers/createPropMapper.ts":"8c4cad2720fd04054a1bea055b674017ba4b0a22","src/helpers/createTamaguiProvider.tsx":"2b6006e2bf3140184789a8f13d3e138ebc22d7b7","src/helpers/extendStaticConfig.ts":"7402dca37f1de440471e3ac83ca6ab8eb4373dc3","src/helpers/fixNativeShadow.native.tsx":"ff1ed30ed9ace81433046e719939a04190b477cc","src/helpers/fixNativeShadow.tsx":"7fb6e7d9604025d2023469f23aab7280244bbb03","src/helpers/getSplitStyles.tsx":"fa6ce2cb0449918a575f02ac179d83de3637c0c6","src/helpers/getStylesAtomic.native.ts":"9054085df65d873432d974b369ac9dcb80f387ff","src/helpers/getStylesAtomic.ts":"e85e8ae07227d5b05f0f1aad7fae77b40e30c09d","src/helpers/insertStyleRule.tsx":"2fe177cb7efe1b2fb5b38c57835a6a3ea5e35443","src/helpers/isObj.ts":"8243865ff1705b549e1a10b398f45048709e2360","src/helpers/matchMedia.native.ts":"7e28a480a564ba5d341d5d559cf1ddcaf5f0b76b","src/helpers/matchMedia.ts":"071b4358b4a141c8f55645e478af1e2527e88b67","src/helpers/themeable.tsx":"16e605a7ae27cec3e4d725817370ac3c250c52a4","src/hooks/useConstant.tsx":"f23ca6031dd13f73f4c5eb7089b5745dc2cdaedd","src/hooks/useFeatures.tsx":"3b917df55d6478ef6f3b9c21d7bef3e5bdcefe1b","src/hooks/useForceUpdate.tsx":"bd991b41de300151e93b2d7e8cdca6a0accefacc","src/hooks/useMedia.tsx":"c50e9180f17ef1839875869eef071bf8a7965dae","src/hooks/usePressable.tsx":"4f55bdca7250e2d22d88f3578d8c8e62ce5c8453","src/hooks/useTheme.tsx":"9c11c3a5da0844cfb93ccbbfa861aedbe10b2552","src/index.ts":"9799059148a6bf1c14fd61120145f10cc40b1fcd","src/static.ts":"8023a4f2d9ee432df4084cc69260c01892f6dff8","src/static/postProcessStyles.tsx":"5e5579249eb99caab9f406af6ec801b7ff1db830","src/styled.ts":"6ccd48505b8118ac393344f475084c528ab83c94","src/types.tsx":"a80d45d21a1b69e54d00226b8f9f1f5de945f1cd","src/views/Animated.tsx":"eac498149091b087c84a5d92c4a9b57bafd6c149","src/views/SafeAreaProvider.tsx":"501c04bc1cb00c2a70ab4f13c5d9510b1f9245b8","src/views/Stack.tsx":"62ef6b9307bb434ad08f4ab7f3f6d0ccb975a359","src/views/Text.tsx":"476bdde93a89840681bf981cfc06e10fc0bc837d","src/views/TextAncestorContext.tsx":"73b13b84778bddb2b4198d32daf1de668132b0bb","src/views/Theme.tsx":"4e9357aac5fc201f2dc359a8f6fd4a8581ceb9bf","src/views/ThemeContext.tsx":"788e2d26d8727dd9493944b5ae9c7ea241fd7ed4","src/views/ThemeInverse.tsx":"614b626451a57955e896cc709d28043bc9bbf391","src/views/ThemeManagerContext.tsx":"30f5f195c2d4b326c5b44f587ff88a1dd1a848ff","src/views/ThemeProvider.tsx":"dcdd80d625e61e9598baf4cb10fc7921962efb50","tsconfig.json":"d3effa0a1380f9664793b92aefd77a1bc96ce071","types.d.ts":"ae74d3379aca7fc09fafc830bdbbc644fb099553"},"deps":{"@tamagui/helpers":1637643436658.3892,"@tamagui/build":1637643433595.8828}}
|
package/_/constants/constants.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { isWeb } from "./platform";
|
|
2
|
-
const stackDefaultStyles = {
|
|
3
|
-
alignItems: "stretch",
|
|
4
|
-
flexShrink: 0,
|
|
5
|
-
...isWeb && {
|
|
6
|
-
display: "flex",
|
|
7
|
-
flexBasis: "auto",
|
|
8
|
-
boxSizing: "border-box"
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
stackDefaultStyles
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/constants/constants.ts"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from './platform'\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n // more accurately match react-native defaults on web\n ...(isWeb && {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n }),\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAEO,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,KAER,SAAS;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/_/constants/platform.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import { useEffect, useLayoutEffect } from "react";
|
|
3
|
-
import { Platform } from "react-native";
|
|
4
|
-
const isWeb = process.env.TAMAGUI_TARGET === "web" || ((_a = Platform) == null ? void 0 : _a.OS) === "web";
|
|
5
|
-
const isSSR = isWeb && typeof window === "undefined";
|
|
6
|
-
const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
7
|
-
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
8
|
-
const supportsTouchWeb = typeof window !== "undefined" && "ontouchstart" in window;
|
|
9
|
-
const isTouchDevice = !isWeb || supportsTouchWeb;
|
|
10
|
-
const isWebIOS = isWeb && typeof navigator !== "undefined" && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window["MSStream"];
|
|
11
|
-
export {
|
|
12
|
-
isChrome,
|
|
13
|
-
isSSR,
|
|
14
|
-
isTouchDevice,
|
|
15
|
-
isWeb,
|
|
16
|
-
isWebIOS,
|
|
17
|
-
supportsTouchWeb,
|
|
18
|
-
useIsomorphicLayoutEffect
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=platform.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/constants/platform.ts"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web' || Platform?.OS === 'web'\nexport const isSSR = isWeb && typeof window === 'undefined'\nexport const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const supportsTouchWeb = typeof window !== 'undefined' && 'ontouchstart' in window\nexport const isTouchDevice = !isWeb || supportsTouchWeb\nexport const isWebIOS =\n isWeb &&\n typeof navigator !== 'undefined' &&\n (/iPad|iPhone|iPod/.test(navigator.platform) ||\n (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&\n !window['MSStream']\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA;AACA;AAEO,MAAM,QAAQ,QAAQ,IAAI,mBAAmB,SAAS,uCAAU,QAAO;AACvE,MAAM,QAAQ,SAAS,OAAO,WAAW;AACzC,MAAM,4BAA4B,QAAQ,YAAY;AACtD,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa;AAC1F,MAAM,mBAAmB,OAAO,WAAW,eAAe,kBAAkB;AAC5E,MAAM,gBAAgB,CAAC,SAAS;AAChC,MAAM,WACX,SACA,OAAO,cAAc,eACpB,oBAAmB,KAAK,UAAU,aAChC,UAAU,aAAa,cAAc,UAAU,iBAAiB,MACnE,CAAC,OAAO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/_/constants/pseudos.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const pseudos = {
|
|
2
|
-
focusStyle: {
|
|
3
|
-
name: "focus",
|
|
4
|
-
priority: 3
|
|
5
|
-
},
|
|
6
|
-
pressStyle: {
|
|
7
|
-
name: "active",
|
|
8
|
-
priority: 2
|
|
9
|
-
},
|
|
10
|
-
hoverStyle: {
|
|
11
|
-
name: "hover",
|
|
12
|
-
priority: 1
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
pseudos
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=pseudos.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/constants/pseudos.ts"],
|
|
4
|
-
"sourcesContent": ["export const pseudos = {\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n}\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA;AAAA,EAEZ,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA;AAAA,EAEZ,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/_/constants/rnw.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const interopRequire = /* @__PURE__ */ __name((src) => "default" in src ? src.default : src, "interopRequire");
|
|
4
|
-
const rnw = {};
|
|
5
|
-
if (process.env.IS_STATIC === "is_static") {
|
|
6
|
-
const createCompileableStyle = require("react-native-web/dist/cjs/exports/StyleSheet/createCompileableStyle");
|
|
7
|
-
const createReactDOMStyle = require("react-native-web/dist/cjs/exports/StyleSheet/createReactDOMStyle");
|
|
8
|
-
const i18Style = require("react-native-web/dist/cjs/exports/StyleSheet/i18nStyle");
|
|
9
|
-
const atomic = require("react-native-web/dist/cjs/exports/StyleSheet/compile").atomic;
|
|
10
|
-
Object.assign(rnw, {
|
|
11
|
-
createCompileableStyle,
|
|
12
|
-
createReactDOMStyle,
|
|
13
|
-
i18Style,
|
|
14
|
-
atomic
|
|
15
|
-
});
|
|
16
|
-
} else if (process.env.TAMAGUI_TARGET === "web") {
|
|
17
|
-
Object.assign(rnw, interopRequire(require("react-native-web").TamaguiExports));
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
rnw
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=rnw.js.map
|
package/_/constants/rnw.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/constants/rnw.tsx"],
|
|
4
|
-
"sourcesContent": ["const interopRequire = (src: any) => ('default' in src ? src.default : src)\n\nexport const rnw: Record<string, any> = {}\n\n// in static mode, require them directly since we can't import react-native-web at all (it has flow stuff in it)\nif (process.env.IS_STATIC === 'is_static') {\n const createCompileableStyle = require('react-native-web/dist/cjs/exports/StyleSheet/createCompileableStyle')\n const createReactDOMStyle = require('react-native-web/dist/cjs/exports/StyleSheet/createReactDOMStyle')\n const i18Style = require('react-native-web/dist/cjs/exports/StyleSheet/i18nStyle')\n const atomic = require('react-native-web/dist/cjs/exports/StyleSheet/compile').atomic\n Object.assign(rnw, {\n createCompileableStyle,\n createReactDOMStyle,\n i18Style,\n atomic,\n })\n} else if (process.env.TAMAGUI_TARGET === 'web') {\n // when targeting web (client) import it like so\n Object.assign(rnw, interopRequire(require('react-native-web').TamaguiExports))\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA,MAAM,iBAAiB,wBAAC,QAAc,aAAa,MAAM,IAAI,UAAU,KAAhD;AAEhB,MAAM,MAA2B;AAGxC,IAAI,QAAQ,IAAI,cAAc,aAAa;AACzC,QAAM,yBAAyB,QAAQ;AACvC,QAAM,sBAAsB,QAAQ;AACpC,QAAM,WAAW,QAAQ;AACzB,QAAM,SAAS,QAAQ,wDAAwD;AAC/E,SAAO,OAAO,KAAK;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,WAEO,QAAQ,IAAI,mBAAmB,OAAO;AAE/C,SAAO,OAAO,KAAK,eAAe,QAAQ,oBAAoB;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|