@tamagui/core 1.0.1-beta.151 → 1.0.1-beta.154
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/Tamagui.js +4 -1
- package/dist/cjs/Tamagui.js.map +1 -1
- package/dist/cjs/addTheme.js.map +1 -1
- package/dist/cjs/constants/platform.js.map +1 -1
- package/dist/cjs/constants/platform.native.js.map +1 -1
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/cjs/contexts/FontLanguageContext.js.map +1 -1
- package/dist/cjs/contexts/TextAncestorContext.js +6 -7
- package/dist/cjs/contexts/TextAncestorContext.js.map +2 -2
- package/dist/cjs/contexts/ThemeContext.js.map +1 -1
- package/dist/cjs/createComponent.js +178 -93
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createFont.js.map +1 -1
- package/dist/cjs/createShorthands.js.map +1 -1
- package/dist/cjs/createTamagui.js +5 -3
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTokens.js.map +1 -1
- package/dist/cjs/createVariable.js +3 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +1 -1
- package/dist/cjs/helpers/calc.js.map +2 -2
- package/dist/cjs/helpers/createMediaStyle.js +10 -4
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +89 -9
- package/dist/cjs/helpers/createPropMapper.js.map +1 -1
- package/dist/cjs/helpers/createShallowUpdate.js +12 -9
- package/dist/cjs/helpers/createShallowUpdate.js.map +1 -1
- package/dist/cjs/helpers/expandStyle.js.map +2 -2
- package/dist/cjs/helpers/expandStyles.js.map +1 -1
- package/dist/cjs/helpers/extendStaticConfig.js +10 -7
- package/dist/cjs/helpers/extendStaticConfig.js.map +1 -1
- package/dist/cjs/helpers/getAnimationDriver.js.map +1 -1
- package/dist/cjs/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/cjs/helpers/getFont.js.map +1 -1
- package/dist/cjs/helpers/getSize.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +40 -4
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getStackSize.js.map +1 -1
- package/dist/cjs/helpers/getStylesAtomic.js +8 -2
- package/dist/cjs/helpers/getStylesAtomic.js.map +3 -3
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +9 -4
- package/dist/cjs/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.js +9 -7
- package/dist/cjs/helpers/getVariantExtras.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/isTamaguiComponent.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiElement.js.map +1 -1
- package/dist/cjs/helpers/matchMedia.js.map +1 -1
- package/dist/cjs/helpers/matchMedia.native.js +4 -1
- package/dist/cjs/helpers/matchMedia.native.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js.map +1 -1
- package/dist/cjs/helpers/mergeTransform.js.map +2 -2
- package/dist/cjs/helpers/normalizeColor.js +4 -1
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/cjs/helpers/registerCSSVariable.js.map +1 -1
- package/dist/cjs/helpers/startTransition.js +4 -1
- package/dist/cjs/helpers/startTransition.js.map +2 -2
- package/dist/cjs/helpers/themeable.js +12 -5
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/themes.js.map +1 -1
- package/dist/cjs/hooks/useConstant.js.map +1 -1
- package/dist/cjs/hooks/useIsMounted.js.map +1 -1
- package/dist/cjs/hooks/useIsSSR.js.map +1 -1
- package/dist/cjs/hooks/useIsTouchDevice.js.map +1 -1
- package/dist/cjs/hooks/useMedia.js +10 -7
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePressable.js.map +1 -1
- package/dist/cjs/hooks/useSafeRef.js.map +1 -1
- package/dist/cjs/hooks/useServerHooks.js.map +1 -1
- package/dist/cjs/hooks/useTheme.js +6 -1
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
- package/dist/cjs/injectStyles.js.map +1 -1
- package/dist/cjs/insertFont.js +2 -0
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/styled.js +8 -5
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/updateTheme.js +7 -4
- package/dist/cjs/updateTheme.js.map +1 -1
- package/dist/cjs/views/FontLanguage.js +5 -7
- package/dist/cjs/views/FontLanguage.js.map +1 -1
- package/dist/cjs/views/FontLanguage.native.js +6 -7
- package/dist/cjs/views/FontLanguage.native.js.map +1 -1
- package/dist/cjs/views/Slot.js +16 -8
- package/dist/cjs/views/Slot.js.map +1 -1
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +21 -12
- package/dist/cjs/views/TamaguiProvider.js.map +1 -1
- package/dist/cjs/views/Text.js.map +1 -1
- package/dist/cjs/views/Theme.js +25 -11
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +6 -7
- package/dist/cjs/views/ThemeInverse.js.map +1 -1
- package/dist/cjs/views/ThemeProvider.js +14 -8
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +9 -4
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/Tamagui.js.map +1 -1
- package/dist/esm/addTheme.js.map +1 -1
- package/dist/esm/constants/constants.js.map +1 -1
- package/dist/esm/constants/platform.js.map +1 -1
- package/dist/esm/constants/platform.native.js.map +1 -1
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/esm/contexts/FontLanguageContext.js.map +1 -1
- package/dist/esm/contexts/TextAncestorContext.js +6 -4
- package/dist/esm/contexts/TextAncestorContext.js.map +1 -1
- package/dist/esm/contexts/ThemeContext.js.map +1 -1
- package/dist/esm/createComponent.js +175 -93
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createFont.js.map +1 -1
- package/dist/esm/createShorthands.js.map +1 -1
- package/dist/esm/createTamagui.js +5 -3
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js.map +1 -1
- package/dist/esm/createVariable.js +3 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js.map +1 -1
- package/dist/esm/helpers/RNComponents.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +1 -1
- package/dist/esm/helpers/calc.js.map +2 -2
- package/dist/esm/helpers/createMediaStyle.js +10 -4
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +89 -9
- package/dist/esm/helpers/createPropMapper.js.map +1 -1
- package/dist/esm/helpers/createShallowUpdate.js +12 -9
- package/dist/esm/helpers/createShallowUpdate.js.map +1 -1
- package/dist/esm/helpers/expandStyle.js.map +2 -2
- package/dist/esm/helpers/expandStyles.js.map +1 -1
- package/dist/esm/helpers/extendStaticConfig.js +10 -7
- package/dist/esm/helpers/extendStaticConfig.js.map +1 -1
- package/dist/esm/helpers/getAnimationDriver.js.map +1 -1
- package/dist/esm/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/esm/helpers/getFont.js.map +1 -1
- package/dist/esm/helpers/getSize.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +40 -4
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getStackSize.js.map +1 -1
- package/dist/esm/helpers/getStylesAtomic.js +4 -1
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +9 -4
- package/dist/esm/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.js +9 -7
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/isTamaguiComponent.js.map +1 -1
- package/dist/esm/helpers/isTamaguiElement.js.map +1 -1
- package/dist/esm/helpers/matchMedia.js.map +1 -1
- package/dist/esm/helpers/matchMedia.native.js.map +1 -1
- package/dist/esm/helpers/mergeProps.js.map +1 -1
- package/dist/esm/helpers/mergeTransform.js.map +1 -1
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/esm/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/esm/helpers/registerCSSVariable.js.map +1 -1
- package/dist/esm/helpers/startTransition.js.map +1 -1
- package/dist/esm/helpers/themeable.js +8 -4
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/themes.js.map +1 -1
- package/dist/esm/hooks/useConstant.js.map +1 -1
- package/dist/esm/hooks/useId.js.map +1 -1
- package/dist/esm/hooks/useIsMounted.js.map +1 -1
- package/dist/esm/hooks/useIsSSR.js.map +1 -1
- package/dist/esm/hooks/useIsTouchDevice.js.map +1 -1
- package/dist/esm/hooks/useMedia.js +10 -7
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/useSafeRef.js.map +1 -1
- package/dist/esm/hooks/useServerHooks.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +6 -1
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/injectStyles.js.map +1 -1
- package/dist/esm/insertFont.js +2 -0
- package/dist/esm/insertFont.js.map +2 -2
- package/dist/esm/static.js.map +1 -1
- package/dist/esm/styled.js +8 -5
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/updateTheme.js +7 -4
- package/dist/esm/updateTheme.js.map +1 -1
- package/dist/esm/views/FontLanguage.js +5 -4
- package/dist/esm/views/FontLanguage.js.map +1 -1
- package/dist/esm/views/FontLanguage.native.js +6 -4
- package/dist/esm/views/FontLanguage.native.js.map +1 -1
- package/dist/esm/views/Slot.js +12 -7
- package/dist/esm/views/Slot.js.map +1 -1
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +17 -11
- package/dist/esm/views/TamaguiProvider.js.map +1 -1
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/Theme.js +21 -10
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +6 -4
- package/dist/esm/views/ThemeInverse.js.map +1 -1
- package/dist/esm/views/ThemeProvider.js +10 -7
- package/dist/esm/views/ThemeProvider.js.map +1 -1
- package/dist/esm/views/ThemeReset.js +5 -3
- package/dist/esm/views/ThemeReset.js.map +1 -1
- package/package.json +11 -11
- package/src/createComponent.tsx +17 -14
- package/src/createVariable.ts +2 -1
- package/src/helpers/createMediaStyle.ts +2 -2
- package/src/helpers/getSplitStyles.tsx +1 -1
- package/src/helpers/getStylesAtomic.ts +1 -1
- package/src/helpers/getThemeCSSRules.ts +2 -2
- package/src/helpers/mergeTransform.ts +1 -1
- package/src/insertFont.ts +1 -0
- package/src/styled.tsx +5 -5
- package/types/createVariable.d.ts +1 -1
- package/types/helpers/getSplitStyles.d.ts +1 -1
- package/types/helpers/getStylesAtomic.d.ts +1 -1
- package/types/helpers/mergeTransform.d.ts +1 -1
- package/dist/cjs/conf.js +0 -70
- package/dist/cjs/conf.js.map +0 -7
- package/dist/cjs/createComponent.server.js +0 -431
- package/dist/cjs/createComponent.server.js.map +0 -7
- package/dist/cjs/helpers/cssHash.js +0 -51
- package/dist/cjs/helpers/cssHash.js.map +0 -7
- package/dist/cjs/helpers/useAnimationDriver.js +0 -2
- package/dist/cjs/helpers/useAnimationDriver.js.map +0 -7
- package/dist/cjs/hooks/useAnimationDriver.js +0 -2
- package/dist/cjs/hooks/useAnimationDriver.js.map +0 -7
- package/dist/cjs/hooks/useFeatures.js +0 -89
- package/dist/cjs/hooks/useFeatures.js.map +0 -7
- package/dist/cjs/hooks/useServerContext.js +0 -21
- package/dist/cjs/hooks/useServerContext.js.map +0 -7
- package/dist/esm/conf.js +0 -39
- package/dist/esm/conf.js.map +0 -7
- package/dist/esm/createComponent.server.js +0 -408
- package/dist/esm/createComponent.server.js.map +0 -7
- package/dist/esm/helpers/cssHash.js +0 -27
- package/dist/esm/helpers/cssHash.js.map +0 -7
- package/dist/esm/helpers/useAnimationDriver.js +0 -1
- package/dist/esm/helpers/useAnimationDriver.js.map +0 -7
- package/dist/esm/hooks/useAnimationDriver.js +0 -1
- package/dist/esm/hooks/useAnimationDriver.js.map +0 -7
- package/dist/esm/hooks/useFeatures.js +0 -62
- package/dist/esm/hooks/useFeatures.js.map +0 -7
- package/dist/esm/hooks/useServerContext.js +0 -4
- package/dist/esm/hooks/useServerContext.js.map +0 -7
- package/src/helpers/cssHash.ts +0 -28
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { isClient, isRSC, isSSR } from "../constants/platform";
|
|
3
4
|
import { ButtonInsideButtonContext } from "../contexts/ButtonInsideButtonContext";
|
|
@@ -11,10 +12,11 @@ function TamaguiProvider({
|
|
|
11
12
|
...themePropsProvider
|
|
12
13
|
}) {
|
|
13
14
|
if (isRSC) {
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsx("span", {
|
|
15
16
|
style: { display: "contents" },
|
|
16
|
-
className: `t_${config.defaultTheme || "light"}
|
|
17
|
-
|
|
17
|
+
className: `t_${config.defaultTheme || "light"}`,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
18
20
|
}
|
|
19
21
|
if (!isSSR) {
|
|
20
22
|
useMediaQueryListeners();
|
|
@@ -31,14 +33,18 @@ function TamaguiProvider({
|
|
|
31
33
|
};
|
|
32
34
|
}, [config, disableInjectCSS]);
|
|
33
35
|
}
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
value: false
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
return /* @__PURE__ */ jsx(ButtonInsideButtonContext.Provider, {
|
|
37
|
+
value: false,
|
|
38
|
+
children: /* @__PURE__ */ jsx(TextAncestorProvider, {
|
|
39
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, {
|
|
40
|
+
defaultTheme: config.defaultTheme || "light",
|
|
41
|
+
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
42
|
+
disableRootThemeClass: config.disableRootThemeClass,
|
|
43
|
+
...themePropsProvider,
|
|
44
|
+
children
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
});
|
|
42
48
|
}
|
|
43
49
|
export {
|
|
44
50
|
TamaguiProvider
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/TamaguiProvider.tsx"],
|
|
4
4
|
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport * as React from 'react'\n\nimport { isClient, isRSC, isSSR } from '../constants/platform'\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TextAncestorProvider } from '../contexts/TextAncestorContext'\nimport { useMediaQueryListeners } from '../hooks/useMedia'\nimport type { TamaguiProviderProps } from '../types'\nimport { ThemeProvider } from './ThemeProvider'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n return (\n <span style={{ display: 'contents' }} className={`t_${config.defaultTheme || 'light'}`}>\n {children}\n </span>\n )\n }\n\n if (!isSSR) {\n useMediaQueryListeners()\n }\n\n if (isClient) {\n // inject CSS if asked to (not SSR compliant)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(config.getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [config, disableInjectCSS])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider\n defaultTheme={config.defaultTheme || 'light'}\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n >\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAkBM;AAjBN,YAAY,WAAW;AAEvB,SAAS,UAAU,OAAO,aAAa;AACvC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,8BAA8B;AAEvC,SAAS,qBAAqB;AAEvB,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,KACG;AACL,GAAyB;AACvB,MAAI,OAAO;AACT,WACE,oBAAC;AAAA,MAAK,OAAO,EAAE,SAAS,WAAW;AAAA,MAAG,WAAW,KAAK,OAAO,gBAAgB;AAAA,MAC1E;AAAA,KACH;AAAA,EAEJ;AAEA,MAAI,CAAC,OAAO;AACV,2BAAuB;AAAA,EACzB;AAEA,MAAI,UAAU;AAGZ,UAAM,gBAAgB,MAAM;AAC1B,UAAI;AAAkB;AACtB,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC;AAC1D,eAAS,KAAK,YAAY,KAAK;AAC/B,aAAO,MAAM;AACX,iBAAS,KAAK,YAAY,KAAK;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,QAAQ,gBAAgB,CAAC;AAAA,EAC/B;AAEA,SACE,oBAAC,0BAA0B,UAA1B;AAAA,IAAmC,OAAO;AAAA,IACzC,8BAAC;AAAA,MACC,8BAAC;AAAA,QACC,cAAc,OAAO,gBAAgB;AAAA,QACrC,sBAAsB,OAAO;AAAA,QAC7B,uBAAuB,OAAO;AAAA,QAC7B,GAAG;AAAA,QAEH;AAAA,OACH;AAAA,KACF;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Text.tsx"],
|
|
4
4
|
"sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport { Text as TextView } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n }),\n },\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'inherit',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB,mBAAmB;AAGhD,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,SAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAEA,UAAU;AAAA,IACR,GAAI,SAAS;AAAA,MACX,eAAe;AAAA,QACb,GAAG;AAAA,QAEH,WAAW,CAAC,kBACV,iBAAiB,IACb;AAAA,UACE,iBAAiB;AAAA,UACjB,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,UAAU;AAAA,QACZ,IACA;AAAA,MACR;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EAEA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAE5C,aAAa;AAAA,IACX,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/views/Theme.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { memo, useMemo } from "react";
|
|
2
3
|
import { isWeb } from "../constants/platform";
|
|
3
4
|
import { variableToString } from "../createVariable";
|
|
@@ -6,9 +7,16 @@ import { useChangeThemeEffect } from "../hooks/useTheme";
|
|
|
6
7
|
React["createElement"];
|
|
7
8
|
const Theme = memo(function Theme2(props) {
|
|
8
9
|
var _a;
|
|
9
|
-
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(
|
|
10
|
+
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(
|
|
11
|
+
props.name,
|
|
12
|
+
props.componentName,
|
|
13
|
+
props
|
|
14
|
+
);
|
|
10
15
|
const missingTheme = !themes || !name || !theme;
|
|
11
|
-
const contents = useMemo(
|
|
16
|
+
const contents = useMemo(
|
|
17
|
+
() => missingTheme ? null : wrapThemeManagerContext(props.children, themeManager),
|
|
18
|
+
[missingTheme, props.children, themeManager]
|
|
19
|
+
);
|
|
12
20
|
if (missingTheme) {
|
|
13
21
|
if (name && !theme && process.env.NODE_ENV === "development") {
|
|
14
22
|
console.warn(`No theme found by name ${name}`);
|
|
@@ -16,22 +24,25 @@ const Theme = memo(function Theme2(props) {
|
|
|
16
24
|
return props.children;
|
|
17
25
|
}
|
|
18
26
|
if (isWeb) {
|
|
19
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ jsx("span", {
|
|
20
28
|
className: (!props.disableThemeClass ? [props.className, className].filter(Boolean) : []).join(" "),
|
|
21
29
|
style: {
|
|
22
30
|
display: "contents",
|
|
23
31
|
color: variableToString((_a = themes[name]) == null ? void 0 : _a.color)
|
|
24
|
-
}
|
|
25
|
-
|
|
32
|
+
},
|
|
33
|
+
children: contents
|
|
34
|
+
});
|
|
26
35
|
}
|
|
27
36
|
return contents;
|
|
28
37
|
});
|
|
29
38
|
function wrapThemeManagerContext(children, themeManager, shouldSetChildrenThemeToParent) {
|
|
30
|
-
return themeManager ? /* @__PURE__ */
|
|
31
|
-
value: themeManager
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
return themeManager ? /* @__PURE__ */ jsx(ThemeManagerContext.Provider, {
|
|
40
|
+
value: themeManager,
|
|
41
|
+
children: shouldSetChildrenThemeToParent ? /* @__PURE__ */ jsx(Theme, {
|
|
42
|
+
name: themeManager.parentName,
|
|
43
|
+
children
|
|
44
|
+
}) : children
|
|
45
|
+
}) : children;
|
|
35
46
|
}
|
|
36
47
|
export {
|
|
37
48
|
Theme,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Theme.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { variableToString } from '../createVariable'\nimport { ThemeManager, ThemeManagerContext } from '../helpers/ThemeManager'\nimport { ThemeProps, useChangeThemeEffect } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [missingTheme, props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={(!props.disableThemeClass\n ? [props.className, className].filter(Boolean)\n : []\n ).join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: variableToString(themes[name]?.color),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAoCM;AApCN,OAAO,SAAS,MAAM,eAAe;AAErC,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAuB,2BAA2B;AAClD,SAAqB,4BAA4B;AAGjD,MAAM;AAEC,MAAM,QAAQ,KAAK,SAASA,OAAM,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,UAAU,IAAI;AAAA,IACvD,MAAM;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW;AAAA,IACf,MAAO,eAAe,OAAO,wBAAwB,MAAM,UAAU,YAAY;AAAA,IACjF,CAAC,cAAc,MAAM,UAAU,YAAY;AAAA,EAC7C;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAE5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,OAAO;AACT,WACE,oBAAC;AAAA,MACC,YAAY,CAAC,MAAM,oBACf,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAC3C,CAAC,GACH,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,kBAAiB,YAAO,UAAP,mBAAc,KAAK;AAAA,MAC7C;AAAA,MAEC;AAAA,KACH;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;AAEM,SAAS,wBACd,UACA,cACA,gCACA;AACA,SAAO,eACL,oBAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,IAClC,2CACC,oBAAC;AAAA,MAAM,MAAM,aAAa;AAAA,MAAa;AAAA,KAAS,IAEhD;AAAA,GAEJ,IAEA;AAEJ;",
|
|
6
|
+
"names": ["Theme"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
3
4
|
import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
|
|
4
5
|
import { Theme } from "./Theme";
|
|
@@ -20,9 +21,10 @@ const ThemeInverse = ({
|
|
|
20
21
|
if (disable) {
|
|
21
22
|
return children;
|
|
22
23
|
}
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
name
|
|
25
|
-
|
|
24
|
+
return /* @__PURE__ */ jsx(Theme, {
|
|
25
|
+
name,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
26
28
|
};
|
|
27
29
|
export {
|
|
28
30
|
ThemeInverse
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeInverse.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\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 if (themeName.startsWith('dark')) {\n setName('light')\n }\n if (themeName.startsWith('light')) {\n setName('dark')\n }\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": "
|
|
5
|
+
"mappings": "AA+BS;AA/BT,SAAgB,gBAAgB;AAEhC,SAAS,iCAAiC;AAC1C,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,aAAa;AAEf,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,YAAY,aAAa;AAC/B,QAAM,eAAe,oBAAoB;AACzC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAwB,IAAI;AAGpD,4BAA0B,MAAM;AAC9B,QAAI,UAAU,WAAW,MAAM,GAAG;AAChC,cAAQ,OAAO;AAAA,IACjB;AACA,QAAI,UAAU,WAAW,OAAO,GAAG;AACjC,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,SAAO,oBAAC;AAAA,IAAM;AAAA,IAAa;AAAA,GAAS;AACtC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { useLayoutEffect, useMemo } from "react";
|
|
2
3
|
import { getConfig, getHasConfigured } from "../config";
|
|
3
4
|
import { THEME_CLASSNAME_PREFIX } from "../constants/constants";
|
|
@@ -31,13 +32,15 @@ const ThemeProvider = (props) => {
|
|
|
31
32
|
defaultTheme: props.defaultTheme
|
|
32
33
|
};
|
|
33
34
|
}, [props.defaultTheme]);
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
value: themeContext
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
36
|
+
value: themeContext,
|
|
37
|
+
children: /* @__PURE__ */ jsx(Theme, {
|
|
38
|
+
className: props.className,
|
|
39
|
+
name: props.defaultTheme,
|
|
40
|
+
disableThemeClass: props.disableRootThemeClass,
|
|
41
|
+
children: props.children
|
|
42
|
+
})
|
|
43
|
+
});
|
|
41
44
|
};
|
|
42
45
|
export {
|
|
43
46
|
ThemeProvider
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getConfig, getHasConfigured } from '../config'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (process.env.NODE_ENV === 'development') {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot])\n }\n\n const themeContext = useMemo(() => {\n return {\n get themes() {\n return getConfig().themes\n },\n defaultTheme: props.defaultTheme,\n }\n }, [props.defaultTheme])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAoDM;AApDN,OAAO,SAAS,iBAAiB,eAAe;AAEhD,SAAS,WAAW,wBAAwB;AAC5C,SAAS,8BAA8B;AACvC,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AAGtB,MAAM;AAWC,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,iBAAiB,GAAG;AACvB,YAAM,IAAI,MAAM,uDAAuD;AAAA,IACzE;AAAA,EACF;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,uBAAuB,MAAM,oBAAoB,CAAC;AAAA,EAClF;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,IAAI,SAAS;AACX,eAAO,UAAU,EAAE;AAAA,MACrB;AAAA,MACA,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,YAAY,CAAC;AAEvB,SACE,oBAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,IAC5B,8BAAC;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MACZ,mBAAmB,MAAM;AAAA,MAExB,gBAAM;AAAA,KACT;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { useContext, useLayoutEffect, useState } from "react";
|
|
2
3
|
import { isWeb } from "../constants/platform";
|
|
3
4
|
import { ThemeManagerContext } from "../helpers/ThemeManager";
|
|
@@ -25,11 +26,12 @@ const ThemeReset = (props) => {
|
|
|
25
26
|
if (!themeManager || !props.children) {
|
|
26
27
|
return props.children || null;
|
|
27
28
|
}
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(Theme, {
|
|
29
30
|
className: "tui-theme-reset",
|
|
30
31
|
reset: true,
|
|
31
|
-
name
|
|
32
|
-
|
|
32
|
+
name,
|
|
33
|
+
children: props.children
|
|
34
|
+
});
|
|
33
35
|
};
|
|
34
36
|
export {
|
|
35
37
|
ThemeReset
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeReset.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (!isWeb || typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAsCI;AAtCJ,OAAO,SAAS,YAAY,iBAAiB,gBAAgB;AAE7D,SAAS,aAAa;AACtB,SAAS,2BAA2B;AACpC,SAAS,aAAa;AAGtB,MAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,eAAe,WAAW,mBAAmB;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAwB,IAAI;AAKpD,MAAI,CAAC,SAAS,OAAO,aAAa,aAAa;AAC7C,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,6CAAc,UAAU,CAAC;AAE7B,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,oBAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
|
|
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.154",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"watch": "tamagui-build --watch",
|
|
18
18
|
"clean": "tamagui-build clean",
|
|
19
19
|
"clean:build": "tamagui-build clean:build",
|
|
20
|
-
"test": "vitest --run --config ../vite-plugin-internal/vite.config.ts"
|
|
20
|
+
"test": "vitest --run --config ../vite-plugin-internal/src/vite.config.ts"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"types",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@expo/match-media": "^0.3.0",
|
|
30
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
31
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/rnw": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/rnw-lite": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/use-debounce": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
37
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
30
|
+
"@tamagui/compose-refs": "^1.0.1-beta.154",
|
|
31
|
+
"@tamagui/helpers": "^1.0.1-beta.154",
|
|
32
|
+
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.154",
|
|
33
|
+
"@tamagui/rnw": "^1.0.1-beta.154",
|
|
34
|
+
"@tamagui/rnw-lite": "^1.0.1-beta.154",
|
|
35
|
+
"@tamagui/use-debounce": "^1.0.1-beta.154",
|
|
36
|
+
"@tamagui/use-event": "^1.0.1-beta.154",
|
|
37
|
+
"@tamagui/use-force-update": "^1.0.1-beta.154",
|
|
38
38
|
"expo-screen-orientation": "^4.3.0",
|
|
39
39
|
"hyphenate-style-name": "^1.0.4"
|
|
40
40
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-dom": "*"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
46
|
+
"@tamagui/build": "^1.0.1-beta.154",
|
|
47
47
|
"@types/react": "^18.0.15",
|
|
48
48
|
"csstype": "^3.0.10",
|
|
49
49
|
"esbuild": "^0.14.49",
|
package/src/createComponent.tsx
CHANGED
|
@@ -22,7 +22,7 @@ import React, {
|
|
|
22
22
|
useContext,
|
|
23
23
|
useEffect,
|
|
24
24
|
} from 'react'
|
|
25
|
-
import {
|
|
25
|
+
import { Text, View, ViewStyle } from 'react-native'
|
|
26
26
|
|
|
27
27
|
import { getConfig, onConfiguredOnce } from './config'
|
|
28
28
|
import { stackDefaultStyles } from './constants/constants'
|
|
@@ -98,7 +98,7 @@ function mergeShorthands({ defaultProps }: StaticConfigParsed, { shorthands }: T
|
|
|
98
98
|
|
|
99
99
|
let initialTheme: any
|
|
100
100
|
let config: TamaguiInternalConfig
|
|
101
|
-
|
|
101
|
+
const mediaPropNames: string[] = []
|
|
102
102
|
|
|
103
103
|
export function createComponent<
|
|
104
104
|
ComponentPropTypes extends Object = {},
|
|
@@ -120,7 +120,6 @@ export function createComponent<
|
|
|
120
120
|
let AnimatedView: any
|
|
121
121
|
let avoidClasses = true
|
|
122
122
|
let defaultNativeStyle: any
|
|
123
|
-
let defaultNativeStyleSheet: StyleSheet.NamedStyles<{ base: {} }>
|
|
124
123
|
let tamaguiDefaultProps: any
|
|
125
124
|
let initialSplitStyles: SplitStyleResult
|
|
126
125
|
|
|
@@ -180,7 +179,7 @@ export function createComponent<
|
|
|
180
179
|
props['debug']
|
|
181
180
|
)
|
|
182
181
|
|
|
183
|
-
const hostRef = useServerRef<
|
|
182
|
+
const hostRef = useServerRef<TamaguiElement>(null)
|
|
184
183
|
const setState = states[1]
|
|
185
184
|
const setStateShallow = createShallowUpdate(setState)
|
|
186
185
|
|
|
@@ -638,11 +637,7 @@ export function createComponent<
|
|
|
638
637
|
...medias,
|
|
639
638
|
}
|
|
640
639
|
} else {
|
|
641
|
-
styles = [
|
|
642
|
-
isWeb ? null : defaultNativeStyleSheet ? (defaultNativeStyleSheet.base as ViewStyle) : null,
|
|
643
|
-
animationStyles ?? style,
|
|
644
|
-
medias,
|
|
645
|
-
]
|
|
640
|
+
styles = [isWeb ? null : defaultNativeStyle, animationStyles ?? style, medias]
|
|
646
641
|
if (!animationStyles && initialSplitStyles) {
|
|
647
642
|
const initPseudos = initialSplitStyles.pseudos
|
|
648
643
|
!state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, 'enterStyle')
|
|
@@ -674,6 +669,10 @@ export function createComponent<
|
|
|
674
669
|
fontFamily = fontFamily.slice(1)
|
|
675
670
|
}
|
|
676
671
|
|
|
672
|
+
if (props['debug']) {
|
|
673
|
+
console.log('???', fontFamily, isText)
|
|
674
|
+
}
|
|
675
|
+
|
|
677
676
|
const classList = [
|
|
678
677
|
componentName ? componentClassName : '',
|
|
679
678
|
fontFamily ? `font_${fontFamily}` : '',
|
|
@@ -1142,10 +1141,6 @@ export function createComponent<
|
|
|
1142
1141
|
}
|
|
1143
1142
|
}
|
|
1144
1143
|
|
|
1145
|
-
defaultNativeStyleSheet = StyleSheet.create({
|
|
1146
|
-
base: defaultNativeStyle,
|
|
1147
|
-
})
|
|
1148
|
-
|
|
1149
1144
|
if (Object.keys(defaults).length) {
|
|
1150
1145
|
tamaguiDefaultProps = defaults
|
|
1151
1146
|
}
|
|
@@ -1372,12 +1367,20 @@ function isUnspaced(child: React.ReactNode) {
|
|
|
1372
1367
|
|
|
1373
1368
|
function AbsoluteFill(props: { children?: any }) {
|
|
1374
1369
|
return (
|
|
1375
|
-
<View pointerEvents="box-none" style={
|
|
1370
|
+
<View pointerEvents="box-none" style={absoluteFill}>
|
|
1376
1371
|
{props.children}
|
|
1377
1372
|
</View>
|
|
1378
1373
|
)
|
|
1379
1374
|
}
|
|
1380
1375
|
|
|
1376
|
+
const absoluteFill = {
|
|
1377
|
+
position: 'absolute',
|
|
1378
|
+
top: 0,
|
|
1379
|
+
left: 0,
|
|
1380
|
+
right: 0,
|
|
1381
|
+
bottom: 0,
|
|
1382
|
+
} as const
|
|
1383
|
+
|
|
1381
1384
|
// this can be done with CSS entirely right?
|
|
1382
1385
|
// const shouldWrapTextAncestor = isWeb && isText && !hasTextAncestor
|
|
1383
1386
|
// if (shouldWrapTextAncestor) {
|
package/src/createVariable.ts
CHANGED
|
@@ -36,9 +36,10 @@ export const createVariable = <A extends string | number = any>(props: VariableI
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// on the client maybe we can change the prototype of variable object toString to keep backwards compat
|
|
39
|
-
export function variableToString(vrble?: any) {
|
|
39
|
+
export function variableToString(vrble?: any, getValue = false) {
|
|
40
40
|
if (!vrble) return ''
|
|
41
41
|
if (isVariable(vrble)) {
|
|
42
|
+
if (getValue) return `${vrble.val}`
|
|
42
43
|
return `${isWeb ? vrble.variable : vrble.val}`
|
|
43
44
|
}
|
|
44
45
|
return `${vrble}`
|
|
@@ -27,9 +27,9 @@ export const createMediaStyle = (
|
|
|
27
27
|
ogPrefix,
|
|
28
28
|
`${ogPrefix}${MEDIA_SEP}${mediaKey}${negKey}${MEDIA_SEP}`
|
|
29
29
|
)}`
|
|
30
|
-
const screenStr = negate ? 'not all' : '
|
|
30
|
+
const screenStr = negate ? 'not all and' : ''
|
|
31
31
|
const mediaSelector = mediaObjectToString(mediaQueries[mediaKey])
|
|
32
|
-
const mediaQuery = `${screenStr}
|
|
32
|
+
const mediaQuery = `${screenStr} ${mediaSelector}`
|
|
33
33
|
const styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(';')
|
|
34
34
|
// combines media queries if they already exist
|
|
35
35
|
let styleRule = ''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stylePropsText, stylePropsTransform, validPseudoKeys, validStyles } from '@tamagui/helpers'
|
|
2
2
|
import { useInsertionEffect } from 'react'
|
|
3
|
-
import { ViewStyle } from 'react-native'
|
|
3
|
+
import type { ViewStyle } from 'react-native'
|
|
4
4
|
|
|
5
5
|
import { getConfig } from '../config'
|
|
6
6
|
import { isClient, isRSC, isWeb, useIsomorphicLayoutEffect } from '../constants/platform'
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { StyleObject, simpleHash } from '@tamagui/helpers'
|
|
7
7
|
import hyphenateStyleName from 'hyphenate-style-name'
|
|
8
|
-
import { TextStyle, ViewStyle } from 'react-native'
|
|
8
|
+
import type { TextStyle, ViewStyle } from 'react-native'
|
|
9
9
|
|
|
10
10
|
import { getConfig } from '../config'
|
|
11
11
|
import { TamaguiInternalConfig } from '../types'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { THEME_CLASSNAME_PREFIX } from '../constants/constants'
|
|
2
|
-
import { Variable } from '../createVariable'
|
|
2
|
+
import { Variable, variableToString } from '../createVariable'
|
|
3
3
|
import { CreateTamaguiProps, ThemeObject } from '../types'
|
|
4
4
|
import { tokensValueToVariable } from './registerCSSVariable'
|
|
5
5
|
|
|
@@ -95,7 +95,7 @@ export function getThemeCSSRules({
|
|
|
95
95
|
const isDark = themeName.startsWith('dark')
|
|
96
96
|
cssRuleSets.push(
|
|
97
97
|
`@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {
|
|
98
|
-
body { background:${theme.background}; color: ${theme.color} }
|
|
98
|
+
body { background:${variableToString(theme.background)}; color: ${variableToString(theme.color)} }
|
|
99
99
|
:root {${vars} }
|
|
100
100
|
}`
|
|
101
101
|
)
|
package/src/insertFont.ts
CHANGED
package/src/styled.tsx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Image, Text, TextInput } from 'react-native'
|
|
2
|
-
|
|
3
1
|
import { createComponent } from './createComponent'
|
|
4
2
|
import { RNComponents } from './helpers/RNComponents'
|
|
5
3
|
import {
|
|
@@ -63,9 +61,11 @@ export function styled<
|
|
|
63
61
|
: null
|
|
64
62
|
const isTamagui = !isReactNativeWeb && !!parentStaticConfig
|
|
65
63
|
const Comp = reactNativeWebComponent || (Component as any)
|
|
66
|
-
const isImage =
|
|
67
|
-
const isInput =
|
|
68
|
-
const isText =
|
|
64
|
+
const isImage = Boolean(staticExtractionOptions?.isImage ?? parentStaticConfig?.isImage)
|
|
65
|
+
const isInput = Boolean(staticExtractionOptions?.isInput ?? parentStaticConfig?.isInput)
|
|
66
|
+
const isText = Boolean(
|
|
67
|
+
isInput || (staticExtractionOptions?.isText ?? parentStaticConfig?.isText)
|
|
68
|
+
)
|
|
69
69
|
|
|
70
70
|
const conf: Partial<StaticConfig> = {
|
|
71
71
|
...staticExtractionOptions,
|
|
@@ -18,7 +18,7 @@ export declare const createVariable: <A extends string | number = any>(props: Va
|
|
|
18
18
|
isFloating?: boolean | undefined;
|
|
19
19
|
__isVar__: boolean;
|
|
20
20
|
};
|
|
21
|
-
export declare function variableToString(vrble?: any): string;
|
|
21
|
+
export declare function variableToString(vrble?: any, getValue?: boolean): string;
|
|
22
22
|
export declare function isVariable(v: Variable | any): v is Variable;
|
|
23
23
|
export declare function getVariableValue(v: Variable | any): any;
|
|
24
24
|
export declare function getVariableName(v: Variable | any): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewStyle } from 'react-native';
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
2
|
import type { DebugProp, MediaQueryKey, PseudoStyles, SplitStyleState, StackProps, StaticConfigParsed, TamaguiInternalConfig, ThemeObject } from '../types';
|
|
3
3
|
import { FontLanguageProps, LanguageContextType } from '../views/FontLanguage.types';
|
|
4
4
|
import { RulesToInsert } from './insertStyleRule';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleObject } from '@tamagui/helpers';
|
|
2
|
-
import { TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
import type { TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { PseudoDescriptor } from './pseudoDescriptors';
|
|
4
4
|
declare type ViewOrTextStyle = ViewStyle | TextStyle;
|
|
5
5
|
export declare type ViewStyleWithPseudos = ViewOrTextStyle & {
|
package/dist/cjs/conf.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var conf_exports = {};
|
|
20
|
-
__export(conf_exports, {
|
|
21
|
-
configListeners: () => configListeners,
|
|
22
|
-
getConfig: () => getConfig,
|
|
23
|
-
getHasConfigured: () => getHasConfigured,
|
|
24
|
-
getThemes: () => getThemes,
|
|
25
|
-
getTokens: () => getTokens,
|
|
26
|
-
onConfiguredOnce: () => onConfiguredOnce,
|
|
27
|
-
setConfig: () => setConfig,
|
|
28
|
-
setConfigFont: () => setConfigFont
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(conf_exports);
|
|
31
|
-
let conf;
|
|
32
|
-
const setConfig = (next) => {
|
|
33
|
-
conf = next;
|
|
34
|
-
if (configListeners.size) {
|
|
35
|
-
configListeners.forEach((cb) => cb(conf));
|
|
36
|
-
configListeners.clear();
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const setConfigFont = (name, font, fontParsed) => {
|
|
40
|
-
if (process.env.NODE_ENV === "development") {
|
|
41
|
-
if (!conf)
|
|
42
|
-
throw new Error(`Haven't called createTamagui yet`);
|
|
43
|
-
}
|
|
44
|
-
Object.assign(conf.fonts, { [name]: font });
|
|
45
|
-
Object.assign(conf.fontsParsed, { [`$${name}`]: fontParsed });
|
|
46
|
-
};
|
|
47
|
-
const getHasConfigured = () => !!conf;
|
|
48
|
-
const getConfig = () => conf;
|
|
49
|
-
const getTokens = () => conf.tokensParsed;
|
|
50
|
-
const getThemes = () => conf.themes;
|
|
51
|
-
const configListeners = /* @__PURE__ */ new Set();
|
|
52
|
-
const onConfiguredOnce = (cb) => {
|
|
53
|
-
if (conf) {
|
|
54
|
-
cb(conf);
|
|
55
|
-
} else {
|
|
56
|
-
configListeners.add(cb);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
configListeners,
|
|
62
|
-
getConfig,
|
|
63
|
-
getHasConfigured,
|
|
64
|
-
getThemes,
|
|
65
|
-
getTokens,
|
|
66
|
-
onConfiguredOnce,
|
|
67
|
-
setConfig,
|
|
68
|
-
setConfigFont
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=conf.js.map
|
package/dist/cjs/conf.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/conf.ts"],
|
|
4
|
-
"sourcesContent": ["import { ConfigListener, TamaguiInternalConfig } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(conf!))\n configListeners.clear()\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const getHasConfigured = () => !!conf\nexport const getConfig = () => conf!\nexport const getTokens = () => conf!.tokensParsed\nexport const getThemes = () => conf!.themes\n\nexport const configListeners = new Set<ConfigListener>()\n\nexport const onConfiguredOnce = (cb: ConfigListener) => {\n if (conf) {\n cb(conf!)\n } else {\n configListeners.add(cb)\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAI;AAEG,MAAM,YAAY,CAAC,SAAgC;AACxD,SAAO;AACP,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAK,CAAC;AACzC,oBAAgB,MAAM;AAAA,EACxB;AACF;AAEO,MAAM,gBAAgB,CAAC,MAAc,MAAW,eAAoB;AACzE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC;AAAM,YAAM,IAAI,MAAM,kCAAkC;AAAA,EAC/D;AACA,SAAO,OAAO,KAAM,OAAO,EAAE,CAAC,OAAO,KAAK,CAAC;AAC3C,SAAO,OAAO,KAAM,aAAa,EAAE,CAAC,IAAI,SAAS,WAAW,CAAC;AAC/D;AAEO,MAAM,mBAAmB,MAAM,CAAC,CAAC;AACjC,MAAM,YAAY,MAAM;AACxB,MAAM,YAAY,MAAM,KAAM;AAC9B,MAAM,YAAY,MAAM,KAAM;AAE9B,MAAM,kBAAkB,oBAAI,IAAoB;AAEhD,MAAM,mBAAmB,CAAC,OAAuB;AACtD,MAAI,MAAM;AACR,OAAG,IAAK;AAAA,EACV,OAAO;AACL,oBAAgB,IAAI,EAAE;AAAA,EACxB;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|