@tamagui/web 1.9.15 → 1.9.17
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/contexts/AnimationDriverContext.js +30 -0
- package/dist/cjs/contexts/AnimationDriverContext.js.map +7 -0
- package/dist/cjs/createComponent.js +35 -36
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/getAnimationDriver.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +2 -2
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/hooks/useAnimationDriver.js +33 -0
- package/dist/cjs/hooks/useAnimationDriver.js.map +7 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/AnimationDriverProvider.js +33 -0
- package/dist/cjs/views/AnimationDriverProvider.js.map +7 -0
- package/dist/cjs/views/TamaguiProvider.js +3 -2
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/contexts/AnimationDriverContext.js +6 -0
- package/dist/esm/contexts/AnimationDriverContext.js.map +7 -0
- package/dist/esm/contexts/AnimationDriverContext.mjs +6 -0
- package/dist/esm/contexts/AnimationDriverContext.mjs.map +7 -0
- package/dist/esm/createComponent.js +35 -36
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.mjs +35 -36
- package/dist/esm/createComponent.mjs.map +2 -2
- package/dist/esm/helpers/getAnimationDriver.js.map +2 -2
- package/dist/esm/helpers/getAnimationDriver.mjs.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +2 -2
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.js +9 -0
- package/dist/esm/hooks/useAnimationDriver.js.map +7 -0
- package/dist/esm/hooks/useAnimationDriver.mjs +9 -0
- package/dist/esm/hooks/useAnimationDriver.mjs.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +2 -2
- package/dist/esm/views/AnimationDriverProvider.js +9 -0
- package/dist/esm/views/AnimationDriverProvider.js.map +7 -0
- package/dist/esm/views/AnimationDriverProvider.mjs +9 -0
- package/dist/esm/views/AnimationDriverProvider.mjs.map +7 -0
- package/dist/esm/views/TamaguiProvider.js +3 -2
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.mjs +3 -2
- package/dist/esm/views/TamaguiProvider.mjs.map +2 -2
- package/package.json +9 -9
- package/src/contexts/AnimationDriverContext.tsx +5 -0
- package/src/createComponent.tsx +52 -51
- package/src/helpers/getAnimationDriver.tsx +3 -0
- package/src/helpers/getSplitStyles.tsx +2 -2
- package/src/hooks/useAnimationDriver.tsx +7 -0
- package/src/index.ts +2 -0
- package/src/types.tsx +6 -2
- package/src/views/AnimationDriverProvider.tsx +16 -0
- package/src/views/TamaguiProvider.tsx +13 -8
- package/types/contexts/AnimationDriverContext.d.ts +6 -0
- package/types/contexts/AnimationDriverContext.d.ts.map +1 -0
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getAnimationDriver.d.ts +3 -0
- package/types/helpers/getAnimationDriver.d.ts.map +1 -1
- package/types/hooks/useAnimationDriver.d.ts +4 -0
- package/types/hooks/useAnimationDriver.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +4 -1
- package/types/types.d.ts.map +1 -1
- package/types/views/AnimationDriverProvider.d.ts +9 -0
- package/types/views/AnimationDriverProvider.d.ts.map +1 -0
- package/types/views/TamaguiProvider.d.ts.map +1 -1
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Tamagui.js'\nexport * from './createComponent.js'\nexport * from './createShorthands.js'\nexport * from './createTheme.js'\nexport * from './createTamagui.js'\nexport * from './createFont.js'\nexport * from './createTokens.js'\nexport * from './createVariable.js'\nexport * from './createVariables.js'\nexport * from './insertFont.js'\nexport * from './addTheme.js'\nexport * from './updateTheme.js'\nexport * from './styled.js'\nexport * from './types.js'\nexport * from './setupReactNative.js'\n\nexport { getConfig, getThemes, getTokens, onConfiguredOnce } from './config.js'\n\nexport * from './constants/constants.js'\n\nexport * from './helpers/useShallowSetState.js'\nexport * from './helpers/getVariantExtras.js'\nexport * from './helpers/getAnimationDriver.js'\nexport * from './helpers/getExpandedShorthands.js'\nexport * from './helpers/getSplitStyles.js'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors.js'\nexport * from './helpers/mergeProps.js'\nexport * from './helpers/expandStyles.js'\nexport * from './helpers/isTamaguiElement.js'\nexport * from './helpers/isTamaguiComponent.js'\nexport * from './helpers/matchMedia'\nexport * from './helpers/proxyThemeVariables.js'\nexport * from './helpers/themeable.js'\nexport * from './helpers/withStaticProperties.js'\nexport * from './helpers/normalizeColor.js'\n\nexport * from './contexts/ButtonNestingContext.js'\n\nexport * from './hooks/useId.js'\nexport * from './hooks/useIsTouchDevice.js'\n\nexport {\n configureMedia,\n getMedia,\n mediaState,\n useMedia,\n useMediaPropsActive,\n mediaObjectToString,\n mediaQueryConfig,\n} from './hooks/useMedia.js'\nexport * from './hooks/useTheme.js'\nexport * from './hooks/useThemeName.js'\nexport * from './hooks/useSafeRef.js'\nexport * from './hooks/useStyle.js'\n\nexport * from './views/Slot.js'\nexport * from './views/Stack.js'\nexport * from './views/Text.js'\nexport * from './contexts/TextAncestorContext.js'\nexport * from './views/Theme.js'\nexport * from './views/ThemeProvider.js'\nexport * from './views/FontLanguage'\nexport * from './views/TamaguiProvider.js'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/use-did-finish-ssr'\nexport * from '@tamagui/use-event'\nexport * from '@tamagui/compose-refs'\nexport * from '@tamagui/helpers'\nexport * from '@tamagui/constants'\n\nexport * from './setupHooks.js'\n"],
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,WAAW,WAAW,WAAW,wBAAwB;AAElE,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;AACd,cAAc;AAEd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './Tamagui.js'\nexport * from './createComponent.js'\nexport * from './createShorthands.js'\nexport * from './createTheme.js'\nexport * from './createTamagui.js'\nexport * from './createFont.js'\nexport * from './createTokens.js'\nexport * from './createVariable.js'\nexport * from './createVariables.js'\nexport * from './insertFont.js'\nexport * from './addTheme.js'\nexport * from './updateTheme.js'\nexport * from './styled.js'\nexport * from './types.js'\nexport * from './setupReactNative.js'\n\nexport { getConfig, getThemes, getTokens, onConfiguredOnce } from './config.js'\n\nexport * from './constants/constants.js'\n\nexport * from './helpers/useShallowSetState.js'\nexport * from './helpers/getVariantExtras.js'\nexport * from './helpers/getAnimationDriver.js'\nexport * from './helpers/getExpandedShorthands.js'\nexport * from './helpers/getSplitStyles.js'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors.js'\nexport * from './helpers/mergeProps.js'\nexport * from './helpers/expandStyles.js'\nexport * from './helpers/isTamaguiElement.js'\nexport * from './helpers/isTamaguiComponent.js'\nexport * from './helpers/matchMedia'\nexport * from './helpers/proxyThemeVariables.js'\nexport * from './helpers/themeable.js'\nexport * from './helpers/withStaticProperties.js'\nexport * from './helpers/normalizeColor.js'\n\nexport * from './contexts/ButtonNestingContext.js'\n\nexport * from './hooks/useId.js'\nexport * from './hooks/useIsTouchDevice.js'\n\nexport {\n configureMedia,\n getMedia,\n mediaState,\n useMedia,\n useMediaPropsActive,\n mediaObjectToString,\n mediaQueryConfig,\n} from './hooks/useMedia.js'\nexport * from './hooks/useTheme.js'\nexport * from './hooks/useThemeName.js'\nexport * from './hooks/useSafeRef.js'\nexport * from './hooks/useStyle.js'\nexport * from './hooks/useAnimationDriver.js'\n\nexport * from './views/Slot.js'\nexport * from './views/Stack.js'\nexport * from './views/Text.js'\nexport * from './contexts/TextAncestorContext.js'\nexport * from './views/Theme.js'\nexport * from './views/ThemeProvider.js'\nexport * from './views/FontLanguage'\nexport * from './views/TamaguiProvider.js'\nexport * from './views/AnimationDriverProvider.js'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/use-did-finish-ssr'\nexport * from '@tamagui/use-event'\nexport * from '@tamagui/compose-refs'\nexport * from '@tamagui/helpers'\nexport * from '@tamagui/constants'\n\nexport * from './setupHooks.js'\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,WAAW,WAAW,WAAW,wBAAwB;AAElE,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;AACd,cAAc;AAEd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AnimationDriverContext } from "../contexts/AnimationDriverContext";
|
|
3
|
+
const AnimationDriverProvider = (props) => {
|
|
4
|
+
return /* @__PURE__ */ jsx(AnimationDriverContext.Provider, { value: props.driver, children: props.children });
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
AnimationDriverProvider
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=AnimationDriverProvider.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/AnimationDriverProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["import { AnimationDriverContext } from '../contexts/AnimationDriverContext'\nimport type { AnimationDriver } from '../types'\n\ninterface AnimationDriverProviderProps {\n driver: AnimationDriver | null\n children: React.ReactNode\n}\n\n// the public provider for users\nexport const AnimationDriverProvider = (props: AnimationDriverProviderProps) => {\n return (\n <AnimationDriverContext.Provider value={props.driver}>\n {props.children}\n </AnimationDriverContext.Provider>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAWI;AAXJ,SAAS,8BAA8B;AAShC,MAAM,0BAA0B,CAAC,UAAwC;AAC9E,SACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,MAAM,QAC3C,gBAAM,UACT;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AnimationDriverContext } from "../contexts/AnimationDriverContext";
|
|
3
|
+
const AnimationDriverProvider = (props) => {
|
|
4
|
+
return /* @__PURE__ */ jsx(AnimationDriverContext.Provider, { value: props.driver, children: props.children });
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
AnimationDriverProvider
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=AnimationDriverProvider.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/AnimationDriverProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["import { AnimationDriverContext } from '../contexts/AnimationDriverContext'\nimport type { AnimationDriver } from '../types'\n\ninterface AnimationDriverProviderProps {\n driver: AnimationDriver | null\n children: React.ReactNode\n}\n\n// the public provider for users\nexport const AnimationDriverProvider = (props: AnimationDriverProviderProps) => {\n return (\n <AnimationDriverContext.Provider value={props.driver}>\n {props.children}\n </AnimationDriverContext.Provider>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAWI;AAXJ,SAAS,8BAA8B;AAShC,MAAM,0BAA0B,CAAC,UAAwC;AAC9E,SACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,MAAM,QAC3C,gBAAM,UACT;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -5,6 +5,7 @@ import { ButtonNestingContext } from "../contexts/ButtonNestingContext.js";
|
|
|
5
5
|
import { TextAncestorContext } from "../contexts/TextAncestorContext.js";
|
|
6
6
|
import { useMediaListeners } from "../hooks/useMedia.js";
|
|
7
7
|
import { ThemeProvider } from "./ThemeProvider.js";
|
|
8
|
+
import { AnimationDriverContext } from "../contexts/AnimationDriverContext.js";
|
|
8
9
|
function TamaguiProvider({
|
|
9
10
|
children,
|
|
10
11
|
disableInjectCSS,
|
|
@@ -39,7 +40,7 @@ function TamaguiProvider({
|
|
|
39
40
|
};
|
|
40
41
|
}, [config, disableInjectCSS]);
|
|
41
42
|
}
|
|
42
|
-
return /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: false, children: /* @__PURE__ */ jsx(TextAncestorContext.Provider, { value: false, children: /* @__PURE__ */ jsx(
|
|
43
|
+
return /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: false, children: /* @__PURE__ */ jsx(TextAncestorContext.Provider, { value: false, children: /* @__PURE__ */ jsx(AnimationDriverContext.Provider, { value: config.animations, children: /* @__PURE__ */ jsx(
|
|
43
44
|
ThemeProvider,
|
|
44
45
|
{
|
|
45
46
|
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
@@ -48,7 +49,7 @@ function TamaguiProvider({
|
|
|
48
49
|
defaultTheme: themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0],
|
|
49
50
|
children
|
|
50
51
|
}
|
|
51
|
-
) }) });
|
|
52
|
+
) }) }) });
|
|
52
53
|
}
|
|
53
54
|
export {
|
|
54
55
|
TamaguiProvider
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/TamaguiProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport * as React from 'react'\n\nimport { ButtonNestingContext } from '../contexts/ButtonNestingContext.js'\nimport { TextAncestorContext } from '../contexts/TextAncestorContext.js'\nimport { useMediaListeners } from '../hooks/useMedia.js'\nimport type { TamaguiProviderProps } from '../types.js'\nimport { ThemeProvider } from './ThemeProvider.js'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n return (\n <span\n style={{ display: 'contents' }}\n className={`t_${Object.keys(config.themes)[0] || 'light'}`}\n >\n {children}\n </span>\n )\n }\n\n if (!(isWeb && isServer)) {\n useMediaListeners(config)\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 // for easier support of hidden-until-js mount animations\n // user must set t_unmounted on documentElement from SSR\n if (document.documentElement.classList.contains('t_unmounted')) {\n document.documentElement.classList.remove('t_unmounted')\n }\n\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 <ButtonNestingContext.Provider value={false}>\n <TextAncestorContext.Provider value={false}>\n <ThemeProvider\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport * as React from 'react'\n\nimport { ButtonNestingContext } from '../contexts/ButtonNestingContext.js'\nimport { TextAncestorContext } from '../contexts/TextAncestorContext.js'\nimport { useMediaListeners } from '../hooks/useMedia.js'\nimport type { TamaguiProviderProps } from '../types.js'\nimport { ThemeProvider } from './ThemeProvider.js'\nimport { AnimationDriverContext } from '../contexts/AnimationDriverContext.js'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n return (\n <span\n style={{ display: 'contents' }}\n className={`t_${Object.keys(config.themes)[0] || 'light'}`}\n >\n {children}\n </span>\n )\n }\n\n if (!(isWeb && isServer)) {\n useMediaListeners(config)\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 // for easier support of hidden-until-js mount animations\n // user must set t_unmounted on documentElement from SSR\n if (document.documentElement.classList.contains('t_unmounted')) {\n document.documentElement.classList.remove('t_unmounted')\n }\n\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 <ButtonNestingContext.Provider value={false}>\n <TextAncestorContext.Provider value={false}>\n <AnimationDriverContext.Provider value={config.animations}>\n <ThemeProvider\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n defaultTheme={\n themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0]\n }\n >\n {children}\n </ThemeProvider>\n </AnimationDriverContext.Provider>\n </TextAncestorContext.Provider>\n </ButtonNestingContext.Provider>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAkBM;AAlBN,SAAS,UAAU,OAAO,UAAU,aAAa;AACjD,YAAY,WAAW;AAEvB,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAElC,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAEhC,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,MAAI,OAAO;AACT,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,SAAS,WAAW;AAAA,QAC7B,WAAW,KAAK,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC,KAAK;AAAA,QAEhD;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,MAAI,EAAE,SAAS,WAAW;AACxB,sBAAkB,MAAM;AAAA,EAC1B;AAEA,MAAI,UAAU;AAGZ,UAAM,gBAAgB,MAAM;AAG1B,UAAI,SAAS,gBAAgB,UAAU,SAAS,aAAa,GAAG;AAC9D,iBAAS,gBAAgB,UAAU,OAAO,aAAa;AAAA,MACzD;AAEA,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,qBAAqB,UAArB,EAA8B,OAAO,OACpC,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,OACnC,8BAAC,uBAAuB,UAAvB,EAAgC,OAAO,OAAO,YAC7C;AAAA,IAAC;AAAA;AAAA,MACC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,MAC7B,GAAG;AAAA,MACJ,cACE,mBAAmB,gBAAgB,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC;AAAA,MAGhE;AAAA;AAAA,EACH,GACF,GACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,6 +5,7 @@ import { ButtonNestingContext } from "../contexts/ButtonNestingContext.js";
|
|
|
5
5
|
import { TextAncestorContext } from "../contexts/TextAncestorContext.js";
|
|
6
6
|
import { useMediaListeners } from "../hooks/useMedia.js";
|
|
7
7
|
import { ThemeProvider } from "./ThemeProvider.js";
|
|
8
|
+
import { AnimationDriverContext } from "../contexts/AnimationDriverContext.js";
|
|
8
9
|
function TamaguiProvider({
|
|
9
10
|
children,
|
|
10
11
|
disableInjectCSS,
|
|
@@ -39,7 +40,7 @@ function TamaguiProvider({
|
|
|
39
40
|
};
|
|
40
41
|
}, [config, disableInjectCSS]);
|
|
41
42
|
}
|
|
42
|
-
return /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: false, children: /* @__PURE__ */ jsx(TextAncestorContext.Provider, { value: false, children: /* @__PURE__ */ jsx(
|
|
43
|
+
return /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: false, children: /* @__PURE__ */ jsx(TextAncestorContext.Provider, { value: false, children: /* @__PURE__ */ jsx(AnimationDriverContext.Provider, { value: config.animations, children: /* @__PURE__ */ jsx(
|
|
43
44
|
ThemeProvider,
|
|
44
45
|
{
|
|
45
46
|
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
@@ -48,7 +49,7 @@ function TamaguiProvider({
|
|
|
48
49
|
defaultTheme: themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0],
|
|
49
50
|
children
|
|
50
51
|
}
|
|
51
|
-
) }) });
|
|
52
|
+
) }) }) });
|
|
52
53
|
}
|
|
53
54
|
export {
|
|
54
55
|
TamaguiProvider
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/TamaguiProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport * as React from 'react'\n\nimport { ButtonNestingContext } from '../contexts/ButtonNestingContext.js'\nimport { TextAncestorContext } from '../contexts/TextAncestorContext.js'\nimport { useMediaListeners } from '../hooks/useMedia.js'\nimport type { TamaguiProviderProps } from '../types.js'\nimport { ThemeProvider } from './ThemeProvider.js'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n return (\n <span\n style={{ display: 'contents' }}\n className={`t_${Object.keys(config.themes)[0] || 'light'}`}\n >\n {children}\n </span>\n )\n }\n\n if (!(isWeb && isServer)) {\n useMediaListeners(config)\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 // for easier support of hidden-until-js mount animations\n // user must set t_unmounted on documentElement from SSR\n if (document.documentElement.classList.contains('t_unmounted')) {\n document.documentElement.classList.remove('t_unmounted')\n }\n\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 <ButtonNestingContext.Provider value={false}>\n <TextAncestorContext.Provider value={false}>\n <ThemeProvider\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport * as React from 'react'\n\nimport { ButtonNestingContext } from '../contexts/ButtonNestingContext.js'\nimport { TextAncestorContext } from '../contexts/TextAncestorContext.js'\nimport { useMediaListeners } from '../hooks/useMedia.js'\nimport type { TamaguiProviderProps } from '../types.js'\nimport { ThemeProvider } from './ThemeProvider.js'\nimport { AnimationDriverContext } from '../contexts/AnimationDriverContext.js'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n return (\n <span\n style={{ display: 'contents' }}\n className={`t_${Object.keys(config.themes)[0] || 'light'}`}\n >\n {children}\n </span>\n )\n }\n\n if (!(isWeb && isServer)) {\n useMediaListeners(config)\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 // for easier support of hidden-until-js mount animations\n // user must set t_unmounted on documentElement from SSR\n if (document.documentElement.classList.contains('t_unmounted')) {\n document.documentElement.classList.remove('t_unmounted')\n }\n\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 <ButtonNestingContext.Provider value={false}>\n <TextAncestorContext.Provider value={false}>\n <AnimationDriverContext.Provider value={config.animations}>\n <ThemeProvider\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n defaultTheme={\n themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0]\n }\n >\n {children}\n </ThemeProvider>\n </AnimationDriverContext.Provider>\n </TextAncestorContext.Provider>\n </ButtonNestingContext.Provider>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAkBM;AAlBN,SAAS,UAAU,OAAO,UAAU,aAAa;AACjD,YAAY,WAAW;AAEvB,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAElC,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAEhC,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,MAAI,OAAO;AACT,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,SAAS,WAAW;AAAA,QAC7B,WAAW,KAAK,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC,KAAK;AAAA,QAEhD;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,MAAI,EAAE,SAAS,WAAW;AACxB,sBAAkB,MAAM;AAAA,EAC1B;AAEA,MAAI,UAAU;AAGZ,UAAM,gBAAgB,MAAM;AAG1B,UAAI,SAAS,gBAAgB,UAAU,SAAS,aAAa,GAAG;AAC9D,iBAAS,gBAAgB,UAAU,OAAO,aAAa;AAAA,MACzD;AAEA,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,qBAAqB,UAArB,EAA8B,OAAO,OACpC,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,OACnC,8BAAC,uBAAuB,UAAvB,EAAgC,OAAO,OAAO,YAC7C;AAAA,IAAC;AAAA;AAAA,MACC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,MAC7B,GAAG;AAAA,MACJ,cACE,mBAAmB,gBAAgB,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC;AAAA,MAGhE;AAAA;AAAA,EACH,GACF,GACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.17",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.9.
|
|
31
|
-
"@tamagui/constants": "1.9.
|
|
32
|
-
"@tamagui/helpers": "1.9.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.9.
|
|
34
|
-
"@tamagui/use-did-finish-ssr": "1.9.
|
|
35
|
-
"@tamagui/use-event": "1.9.
|
|
36
|
-
"@tamagui/use-force-update": "1.9.
|
|
30
|
+
"@tamagui/compose-refs": "1.9.17",
|
|
31
|
+
"@tamagui/constants": "1.9.17",
|
|
32
|
+
"@tamagui/helpers": "1.9.17",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.9.17",
|
|
34
|
+
"@tamagui/use-did-finish-ssr": "1.9.17",
|
|
35
|
+
"@tamagui/use-event": "1.9.17",
|
|
36
|
+
"@tamagui/use-force-update": "1.9.17"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "1.9.
|
|
42
|
+
"@tamagui/build": "1.9.17",
|
|
43
43
|
"@testing-library/react": "^13.4.0",
|
|
44
44
|
"csstype": "^3.0.10",
|
|
45
45
|
"react": "^18.2.0",
|
package/src/createComponent.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import { getAllSelectors } from './helpers/insertStyleRule.js'
|
|
|
24
24
|
import { mergeProps } from './helpers/mergeProps.js'
|
|
25
25
|
import { proxyThemeVariables } from './helpers/proxyThemeVariables.js'
|
|
26
26
|
import { useShallowSetState } from './helpers/useShallowSetState.js'
|
|
27
|
+
import { useAnimationDriver } from './hooks/useAnimationDriver.js'
|
|
27
28
|
import { setMediaShouldUpdate, useMedia } from './hooks/useMedia.js'
|
|
28
29
|
import { useServerRef, useServerState } from './hooks/useServerHooks.js'
|
|
29
30
|
import { useThemeWithState } from './hooks/useTheme.js'
|
|
@@ -46,6 +47,8 @@ import {
|
|
|
46
47
|
UseAnimationProps,
|
|
47
48
|
} from './types'
|
|
48
49
|
import { Slot } from './views/Slot.js'
|
|
50
|
+
import { Stack } from './views/Stack.js'
|
|
51
|
+
import { Text } from './views/Text.js'
|
|
49
52
|
import { useThemedChildren } from './views/Theme.js'
|
|
50
53
|
|
|
51
54
|
// let t
|
|
@@ -170,31 +173,6 @@ export function createComponent<
|
|
|
170
173
|
const debugProp = props['debug'] as DebugProp
|
|
171
174
|
const { Component, isText, isZStack } = staticConfig
|
|
172
175
|
const componentName = props.componentName || staticConfig.componentName
|
|
173
|
-
const componentClassName = props.asChild
|
|
174
|
-
? ''
|
|
175
|
-
: props.componentName
|
|
176
|
-
? `is_${props.componentName}`
|
|
177
|
-
: defaultComponentClassName
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Component state for tracking animations, pseudos
|
|
181
|
-
*/
|
|
182
|
-
const animationsConfig = tamaguiConfig.animations
|
|
183
|
-
const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined
|
|
184
|
-
const avoidClassesWhileAnimating = animationsConfig.isReactNative
|
|
185
|
-
const hasEnterStyle = !!props.enterStyle
|
|
186
|
-
const needsMount = Boolean(
|
|
187
|
-
(isWeb ? isClient : true) && (hasEnterStyle || props.animation)
|
|
188
|
-
)
|
|
189
|
-
const states = useServerState<TamaguiComponentState>(
|
|
190
|
-
needsMount ? defaultComponentState! : defaultComponentStateMounted!
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
const state = propsIn.forceStyle
|
|
194
|
-
? { ...states[0], [propsIn.forceStyle]: true }
|
|
195
|
-
: states[0]
|
|
196
|
-
const setState = states[1]
|
|
197
|
-
const setStateShallow = useShallowSetState(setState, debugProp, componentName)
|
|
198
176
|
|
|
199
177
|
// conditional but if ever true stays true
|
|
200
178
|
// [animated, inversed]
|
|
@@ -207,6 +185,11 @@ export function createComponent<
|
|
|
207
185
|
)
|
|
208
186
|
stateRef.current ??= {}
|
|
209
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Component state for tracking animations, pseudos
|
|
190
|
+
*/
|
|
191
|
+
const animationsConfig = useAnimationDriver()
|
|
192
|
+
const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined
|
|
210
193
|
const isAnimated = (() => {
|
|
211
194
|
const next = !!(
|
|
212
195
|
!staticConfig.isHOC &&
|
|
@@ -218,9 +201,50 @@ export function createComponent<
|
|
|
218
201
|
}
|
|
219
202
|
return next || stateRef.current.hasAnimated
|
|
220
203
|
})()
|
|
204
|
+
const componentClassName = props.asChild
|
|
205
|
+
? ''
|
|
206
|
+
: props.componentName
|
|
207
|
+
? `is_${props.componentName}`
|
|
208
|
+
: defaultComponentClassName
|
|
209
|
+
const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false)
|
|
210
|
+
const languageContext = isRSC ? null : useContext(FontLanguageContext)
|
|
211
|
+
const isDisabled = props.disabled ?? props.accessibilityState?.disabled
|
|
221
212
|
|
|
222
|
-
const
|
|
223
|
-
|
|
213
|
+
const isTaggable = !Component || typeof Component === 'string'
|
|
214
|
+
// default to tag, fallback to component (when both strings)
|
|
215
|
+
const element = isWeb
|
|
216
|
+
? isTaggable
|
|
217
|
+
? props.tag || defaultTag || Component
|
|
218
|
+
: Component
|
|
219
|
+
: Component
|
|
220
|
+
|
|
221
|
+
const BaseTextComponent = BaseText || element || 'span'
|
|
222
|
+
const BaseViewComponent = BaseView || element || (hasTextAncestor ? 'span' : 'div')
|
|
223
|
+
|
|
224
|
+
AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent
|
|
225
|
+
AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent
|
|
226
|
+
|
|
227
|
+
let elementType = isText
|
|
228
|
+
? (isAnimated ? AnimatedText : null) || BaseTextComponent
|
|
229
|
+
: (isAnimated ? AnimatedView : null) || BaseViewComponent
|
|
230
|
+
|
|
231
|
+
const avoidClassesWhileAnimating = animationsConfig?.isReactNative
|
|
232
|
+
const hasEnterStyle = !!props.enterStyle
|
|
233
|
+
const needsMount = Boolean(
|
|
234
|
+
(isWeb ? isClient : true) && (hasEnterStyle || props.animation)
|
|
235
|
+
)
|
|
236
|
+
const states = useServerState<TamaguiComponentState>(
|
|
237
|
+
needsMount ? defaultComponentState! : defaultComponentStateMounted!
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
const state = propsIn.forceStyle
|
|
241
|
+
? { ...states[0], [propsIn.forceStyle]: true }
|
|
242
|
+
: states[0]
|
|
243
|
+
const setState = states[1]
|
|
244
|
+
const setStateShallow = useShallowSetState(setState, debugProp, componentName)
|
|
245
|
+
|
|
246
|
+
const usePresence = animationsConfig?.usePresence
|
|
247
|
+
const presence = !isRSC && isAnimated && usePresence ? usePresence() : null
|
|
224
248
|
|
|
225
249
|
// set enter/exit variants onto our new props object
|
|
226
250
|
if (isAnimated && presence) {
|
|
@@ -235,7 +259,7 @@ export function createComponent<
|
|
|
235
259
|
}
|
|
236
260
|
}
|
|
237
261
|
|
|
238
|
-
const isAnimatedReactNative = isAnimated &&
|
|
262
|
+
const isAnimatedReactNative = isAnimated && animationsConfig?.isReactNative
|
|
239
263
|
const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative)
|
|
240
264
|
|
|
241
265
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -270,24 +294,6 @@ export function createComponent<
|
|
|
270
294
|
shouldUpdate: () => !!stateRef.current.didAccessThemeVariableValue,
|
|
271
295
|
})!
|
|
272
296
|
|
|
273
|
-
const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false)
|
|
274
|
-
const languageContext = isRSC ? null : useContext(FontLanguageContext)
|
|
275
|
-
const isDisabled = props.disabled ?? props.accessibilityState?.disabled
|
|
276
|
-
|
|
277
|
-
const isTaggable = !Component || typeof Component === 'string'
|
|
278
|
-
// default to tag, fallback to component (when both strings)
|
|
279
|
-
const element = isWeb
|
|
280
|
-
? isTaggable
|
|
281
|
-
? props.tag || defaultTag || Component
|
|
282
|
-
: Component
|
|
283
|
-
: Component
|
|
284
|
-
|
|
285
|
-
const BaseTextComponent = BaseText || element || 'span'
|
|
286
|
-
const BaseViewComponent = BaseView || element || (hasTextAncestor ? 'span' : 'div')
|
|
287
|
-
let elementType = isText
|
|
288
|
-
? (isAnimated ? AnimatedText : null) || BaseTextComponent
|
|
289
|
-
: (isAnimated ? AnimatedView : null) || BaseViewComponent
|
|
290
|
-
|
|
291
297
|
elementType = Component || elementType
|
|
292
298
|
const isStringElement = typeof elementType === 'string'
|
|
293
299
|
|
|
@@ -772,11 +778,6 @@ export function createComponent<
|
|
|
772
778
|
if (!tamaguiConfig) {
|
|
773
779
|
tamaguiConfig = conf
|
|
774
780
|
|
|
775
|
-
if (tamaguiConfig.animations) {
|
|
776
|
-
AnimatedText = tamaguiConfig.animations.Text
|
|
777
|
-
AnimatedView = tamaguiConfig.animations.View
|
|
778
|
-
}
|
|
779
|
-
|
|
780
781
|
if (!initialTheme) {
|
|
781
782
|
const next = conf.themes[Object.keys(conf.themes)[0]]
|
|
782
783
|
initialTheme = proxyThemeVariables(next)
|
|
@@ -362,10 +362,10 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
362
362
|
const styleLen = styles.length
|
|
363
363
|
for (let j = styleLen; j >= 0; j--) {
|
|
364
364
|
const cur = styles[j]
|
|
365
|
-
if (!cur)
|
|
365
|
+
if (!cur) continue
|
|
366
366
|
for (const key in cur) {
|
|
367
367
|
if (!isMainStyle && usedKeys[key]) {
|
|
368
|
-
|
|
368
|
+
continue
|
|
369
369
|
}
|
|
370
370
|
usedKeys[key] = 1
|
|
371
371
|
style[key] = cur[key]
|
package/src/index.ts
CHANGED
|
@@ -53,6 +53,7 @@ export * from './hooks/useTheme.js'
|
|
|
53
53
|
export * from './hooks/useThemeName.js'
|
|
54
54
|
export * from './hooks/useSafeRef.js'
|
|
55
55
|
export * from './hooks/useStyle.js'
|
|
56
|
+
export * from './hooks/useAnimationDriver.js'
|
|
56
57
|
|
|
57
58
|
export * from './views/Slot.js'
|
|
58
59
|
export * from './views/Stack.js'
|
|
@@ -62,6 +63,7 @@ export * from './views/Theme.js'
|
|
|
62
63
|
export * from './views/ThemeProvider.js'
|
|
63
64
|
export * from './views/FontLanguage'
|
|
64
65
|
export * from './views/TamaguiProvider.js'
|
|
66
|
+
export * from './views/AnimationDriverProvider.js'
|
|
65
67
|
|
|
66
68
|
export * from '@tamagui/use-force-update'
|
|
67
69
|
export * from '@tamagui/use-did-finish-ssr'
|
package/src/types.tsx
CHANGED
|
@@ -1414,6 +1414,7 @@ type AnimationConfig = {
|
|
|
1414
1414
|
|
|
1415
1415
|
// includes a very limited adapter between various impls for number => style
|
|
1416
1416
|
// this is useful only in limited scenarios like `Sheet`, but necessary in those cases
|
|
1417
|
+
// TODO: make css driver compatible with this?
|
|
1417
1418
|
|
|
1418
1419
|
export type AnimatedNumberStrategy =
|
|
1419
1420
|
// only values shared between reanimated/react-native for now
|
|
@@ -1445,8 +1446,11 @@ export type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
|
|
|
1445
1446
|
val: V,
|
|
1446
1447
|
getStyle: (current: any) => any
|
|
1447
1448
|
) => any
|
|
1448
|
-
useAnimatedNumberReaction: (
|
|
1449
|
-
|
|
1449
|
+
useAnimatedNumberReaction: <V extends UniversalAnimatedNumber<any>>(
|
|
1450
|
+
opts: {
|
|
1451
|
+
value: V
|
|
1452
|
+
hostRef: RefObject<HTMLElement | View>
|
|
1453
|
+
},
|
|
1450
1454
|
onValue: (current: number) => void
|
|
1451
1455
|
) => void
|
|
1452
1456
|
animations: A
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AnimationDriverContext } from '../contexts/AnimationDriverContext'
|
|
2
|
+
import type { AnimationDriver } from '../types'
|
|
3
|
+
|
|
4
|
+
interface AnimationDriverProviderProps {
|
|
5
|
+
driver: AnimationDriver | null
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// the public provider for users
|
|
10
|
+
export const AnimationDriverProvider = (props: AnimationDriverProviderProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<AnimationDriverContext.Provider value={props.driver}>
|
|
13
|
+
{props.children}
|
|
14
|
+
</AnimationDriverContext.Provider>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -6,6 +6,7 @@ import { TextAncestorContext } from '../contexts/TextAncestorContext.js'
|
|
|
6
6
|
import { useMediaListeners } from '../hooks/useMedia.js'
|
|
7
7
|
import type { TamaguiProviderProps } from '../types.js'
|
|
8
8
|
import { ThemeProvider } from './ThemeProvider.js'
|
|
9
|
+
import { AnimationDriverContext } from '../contexts/AnimationDriverContext.js'
|
|
9
10
|
|
|
10
11
|
export function TamaguiProvider({
|
|
11
12
|
children,
|
|
@@ -51,14 +52,18 @@ export function TamaguiProvider({
|
|
|
51
52
|
return (
|
|
52
53
|
<ButtonNestingContext.Provider value={false}>
|
|
53
54
|
<TextAncestorContext.Provider value={false}>
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
<AnimationDriverContext.Provider value={config.animations}>
|
|
56
|
+
<ThemeProvider
|
|
57
|
+
themeClassNameOnRoot={config.themeClassNameOnRoot}
|
|
58
|
+
disableRootThemeClass={config.disableRootThemeClass}
|
|
59
|
+
{...themePropsProvider}
|
|
60
|
+
defaultTheme={
|
|
61
|
+
themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0]
|
|
62
|
+
}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</ThemeProvider>
|
|
66
|
+
</AnimationDriverContext.Provider>
|
|
62
67
|
</TextAncestorContext.Provider>
|
|
63
68
|
</ButtonNestingContext.Provider>
|
|
64
69
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationDriverContext.d.ts","sourceRoot":"","sources":["../../src/contexts/AnimationDriverContext.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,sBAAsB;;UAA8C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAUN,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAUN,MAAM,OAAO,CAAA;AAkBd,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAEhB,qBAAqB,EAErB,cAAc,EAIf,MAAM,SAAS,CAAA;AAqBhB,eAAO,MAAM,qBAAqB,EAAE,qBAMnC,CAAA;AAeD,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA8B3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EAEjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EACpD,eAAe,CAAC,EAAE,iBAAiB,4DAowBpC;AAGD,eAAO,MAAM,QAAQ;YAAW;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;;CAAmB,CAAA;AAMrE,eAAO,MAAM,MAAM,0DA8CjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAiGxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAnimationDriver.d.ts","sourceRoot":"","sources":["../../src/helpers/getAnimationDriver.tsx"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB;;;;GAEjC"}
|
|
1
|
+
{"version":3,"file":"getAnimationDriver.d.ts","sourceRoot":"","sources":["../../src/helpers/getAnimationDriver.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,kBAAkB;;;;GAEjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimationDriver.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnimationDriver.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;SAE9B,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from './hooks/useTheme.js';
|
|
|
39
39
|
export * from './hooks/useThemeName.js';
|
|
40
40
|
export * from './hooks/useSafeRef.js';
|
|
41
41
|
export * from './hooks/useStyle.js';
|
|
42
|
+
export * from './hooks/useAnimationDriver.js';
|
|
42
43
|
export * from './views/Slot.js';
|
|
43
44
|
export * from './views/Stack.js';
|
|
44
45
|
export * from './views/Text.js';
|
|
@@ -47,6 +48,7 @@ export * from './views/Theme.js';
|
|
|
47
48
|
export * from './views/ThemeProvider.js';
|
|
48
49
|
export * from './views/FontLanguage';
|
|
49
50
|
export * from './views/TamaguiProvider.js';
|
|
51
|
+
export * from './views/AnimationDriverProvider.js';
|
|
50
52
|
export * from '@tamagui/use-force-update';
|
|
51
53
|
export * from '@tamagui/use-did-finish-ssr';
|
|
52
54
|
export * from '@tamagui/use-event';
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/E,cAAc,0BAA0B,CAAA;AAExC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAE3C,cAAc,oCAAoC,CAAA;AAElD,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAE3C,OAAO,EACL,cAAc,EACd,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/E,cAAc,0BAA0B,CAAA;AAExC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAE3C,cAAc,oCAAoC,CAAA;AAElD,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAE3C,OAAO,EACL,cAAc,EACd,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAE7C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mCAAmC,CAAA;AACjD,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oCAAoC,CAAA;AAElD,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAElC,cAAc,iBAAiB,CAAA"}
|
package/types/types.d.ts
CHANGED
|
@@ -697,7 +697,10 @@ export type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
|
|
|
697
697
|
usePresence: () => UsePresenceResult;
|
|
698
698
|
useAnimatedNumber: (initial: number) => UniversalAnimatedNumber<any>;
|
|
699
699
|
useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(val: V, getStyle: (current: any) => any) => any;
|
|
700
|
-
useAnimatedNumberReaction:
|
|
700
|
+
useAnimatedNumberReaction: <V extends UniversalAnimatedNumber<any>>(opts: {
|
|
701
|
+
value: V;
|
|
702
|
+
hostRef: RefObject<HTMLElement | View>;
|
|
703
|
+
}, onValue: (current: number) => void) => void;
|
|
701
704
|
animations: A;
|
|
702
705
|
View?: any;
|
|
703
706
|
Text?: any;
|