@tamagui/core 1.0.0-alpha.12 → 1.0.0-alpha.13
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/createComponent.js.map +1 -1
- package/dist/cjs/createTamagui.js +2 -0
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createVariable.js +1 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/views/Text.js +2 -2
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createTamagui.js +2 -0
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createVariable.js +1 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/views/Text.js +1 -1
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/jsx/createTamagui.js +2 -0
- package/dist/jsx/createVariable.js +1 -1
- package/dist/jsx/views/Text.js +1 -1
- package/package.json +3 -3
- package/src/createTamagui.ts +1 -0
- package/src/createVariable.ts +1 -1
- package/types/createTamagui.d.ts +16 -0
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createVariable.d.ts +1 -1
- package/types/helpers/createMediaStyle.d.ts +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/dist/constants/constants.js +0 -14
- package/dist/constants/constants.js.map +0 -7
- package/dist/constants/platform.js +0 -19
- package/dist/constants/platform.js.map +0 -7
- package/dist/constants/pseudos.js +0 -18
- package/dist/constants/pseudos.js.map +0 -7
- package/dist/constants/rnw.js +0 -22
- package/dist/constants/rnw.js.map +0 -7
- package/dist/constants/styleConstants.js +0 -46
- package/dist/constants/styleConstants.js.map +0 -7
- package/dist/createComponent.js +0 -464
- package/dist/createComponent.js.map +0 -7
- package/dist/createFont.js +0 -28
- package/dist/createFont.js.map +0 -7
- package/dist/createShorthands.js +0 -10
- package/dist/createShorthands.js.map +0 -7
- package/dist/createTamagui.js +0 -168
- package/dist/createTamagui.js.map +0 -7
- package/dist/createTheme.js +0 -20
- package/dist/createTheme.js.map +0 -7
- package/dist/createTokens.js +0 -33
- package/dist/createTokens.js.map +0 -7
- package/dist/createVariable.js +0 -25
- package/dist/createVariable.js.map +0 -7
- package/dist/helpers/addStylesUsingClassname.js +0 -57
- package/dist/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/helpers/createMediaStyle.js +0 -34
- package/dist/helpers/createMediaStyle.js.map +0 -7
- package/dist/helpers/createPropMapper.js +0 -160
- package/dist/helpers/createPropMapper.js.map +0 -7
- package/dist/helpers/createTamaguiProvider.js +0 -25
- package/dist/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/helpers/extendStaticConfig.js +0 -59
- package/dist/helpers/extendStaticConfig.js.map +0 -7
- package/dist/helpers/fixNativeShadow.js +0 -8
- package/dist/helpers/fixNativeShadow.js.map +0 -7
- package/dist/helpers/fixNativeShadow.native.js +0 -30
- package/dist/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/helpers/getSplitStyles.js +0 -150
- package/dist/helpers/getSplitStyles.js.map +0 -7
- package/dist/helpers/getStylesAtomic.js +0 -83
- package/dist/helpers/getStylesAtomic.js.map +0 -7
- package/dist/helpers/getStylesAtomic.native.js +0 -10
- package/dist/helpers/getStylesAtomic.native.js.map +0 -7
- package/dist/helpers/insertStyleRule.js +0 -24
- package/dist/helpers/insertStyleRule.js.map +0 -7
- package/dist/helpers/isComponent.js +0 -10
- package/dist/helpers/isComponent.js.map +0 -7
- package/dist/helpers/isObj.js +0 -7
- package/dist/helpers/isObj.js.map +0 -7
- package/dist/helpers/isTamaguiComponent.js +0 -10
- package/dist/helpers/isTamaguiComponent.js.map +0 -7
- package/dist/helpers/isTamaguiElement.js +0 -10
- package/dist/helpers/isTamaguiElement.js.map +0 -7
- package/dist/helpers/matchMedia.js +0 -18
- package/dist/helpers/matchMedia.js.map +0 -7
- package/dist/helpers/matchMedia.native.js +0 -9
- package/dist/helpers/matchMedia.native.js.map +0 -7
- package/dist/helpers/pseudos.js +0 -1
- package/dist/helpers/pseudos.js.map +0 -7
- package/dist/helpers/themeable.js +0 -26
- package/dist/helpers/themeable.js.map +0 -7
- package/dist/helpers/validate.js +0 -60
- package/dist/helpers/validate.js.map +0 -7
- package/dist/helpers/validateConfig.js +0 -46
- package/dist/helpers/validateConfig.js.map +0 -7
- package/dist/helpers/validateTokens.js +0 -29
- package/dist/helpers/validateTokens.js.map +0 -7
- package/dist/hooks/useConstant.js +0 -15
- package/dist/hooks/useConstant.js.map +0 -7
- package/dist/hooks/useFeatures.js +0 -63
- package/dist/hooks/useFeatures.js.map +0 -7
- package/dist/hooks/useForceUpdate.js +0 -28
- package/dist/hooks/useForceUpdate.js.map +0 -7
- package/dist/hooks/useMedia.js +0 -173
- package/dist/hooks/useMedia.js.map +0 -7
- package/dist/hooks/usePressable.js +0 -13
- package/dist/hooks/usePressable.js.map +0 -7
- package/dist/hooks/useTheme.js +0 -89
- package/dist/hooks/useTheme.js.map +0 -7
- package/dist/index.cjs +0 -2202
- package/dist/index.cjs.map +0 -7
- package/dist/index.js +0 -32
- package/dist/index.js.map +0 -7
- package/dist/packages/core/src/constants/constants.d.ts +0 -8
- package/dist/packages/core/src/constants/constants.d.ts.map +0 -1
- package/dist/packages/core/src/constants/platform.d.ts +0 -9
- package/dist/packages/core/src/constants/platform.d.ts.map +0 -1
- package/dist/packages/core/src/constants/pseudos.d.ts +0 -15
- package/dist/packages/core/src/constants/pseudos.d.ts.map +0 -1
- package/dist/packages/core/src/constants/rnw.d.ts +0 -2
- package/dist/packages/core/src/constants/rnw.d.ts.map +0 -1
- package/dist/packages/core/src/createComponent.d.ts +0 -16
- package/dist/packages/core/src/createComponent.d.ts.map +0 -1
- package/dist/packages/core/src/createShorthands.d.ts +0 -2
- package/dist/packages/core/src/createShorthands.d.ts.map +0 -1
- package/dist/packages/core/src/createTamagui.d.ts +0 -37
- package/dist/packages/core/src/createTamagui.d.ts.map +0 -1
- package/dist/packages/core/src/createTheme.d.ts +0 -5
- package/dist/packages/core/src/createTheme.d.ts.map +0 -1
- package/dist/packages/core/src/createTokens.d.ts +0 -45
- package/dist/packages/core/src/createTokens.d.ts.map +0 -1
- package/dist/packages/core/src/createVariable.d.ts +0 -14
- package/dist/packages/core/src/createVariable.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts +0 -2
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts +0 -8
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts +0 -5
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts +0 -5
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts +0 -2
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts +0 -2
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts +0 -15
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts +0 -3
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts +0 -2
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts +0 -2
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.d.ts +0 -2
- package/dist/packages/core/src/helpers/matchMedia.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts +0 -3
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/themeable.d.ts +0 -10
- package/dist/packages/core/src/helpers/themeable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useConstant.d.ts +0 -2
- package/dist/packages/core/src/hooks/useConstant.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useFeatures.d.ts +0 -5
- package/dist/packages/core/src/hooks/useFeatures.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts +0 -2
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useMedia.d.ts +0 -16
- package/dist/packages/core/src/hooks/useMedia.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/usePressable.d.ts +0 -3
- package/dist/packages/core/src/hooks/usePressable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useTheme.d.ts +0 -18
- package/dist/packages/core/src/hooks/useTheme.d.ts.map +0 -1
- package/dist/packages/core/src/index.d.ts +0 -27
- package/dist/packages/core/src/index.d.ts.map +0 -1
- package/dist/packages/core/src/static/postProcessStyles.d.ts +0 -7
- package/dist/packages/core/src/static/postProcessStyles.d.ts.map +0 -1
- package/dist/packages/core/src/static.d.ts +0 -12
- package/dist/packages/core/src/static.d.ts.map +0 -1
- package/dist/packages/core/src/styled.d.ts +0 -16
- package/dist/packages/core/src/styled.d.ts.map +0 -1
- package/dist/packages/core/src/types.d.ts +0 -305
- package/dist/packages/core/src/types.d.ts.map +0 -1
- package/dist/packages/core/src/views/Animated.d.ts +0 -15
- package/dist/packages/core/src/views/Animated.d.ts.map +0 -1
- package/dist/packages/core/src/views/Stack.d.ts +0 -3
- package/dist/packages/core/src/views/Stack.d.ts.map +0 -1
- package/dist/packages/core/src/views/Text.d.ts +0 -3
- package/dist/packages/core/src/views/Text.d.ts.map +0 -1
- package/dist/packages/core/src/views/TextAncestorContext.d.ts +0 -3
- package/dist/packages/core/src/views/TextAncestorContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/Theme.d.ts +0 -8
- package/dist/packages/core/src/views/Theme.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeContext.d.ts +0 -18
- package/dist/packages/core/src/views/ThemeContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeInverse.d.ts +0 -10
- package/dist/packages/core/src/views/ThemeInverse.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts +0 -15
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeProvider.d.ts +0 -10
- package/dist/packages/core/src/views/ThemeProvider.d.ts.map +0 -1
- package/dist/packages/helpers/src/AllRules.d.ts +0 -3
- package/dist/packages/helpers/src/AllRules.d.ts.map +0 -1
- package/dist/packages/helpers/src/concatClassName.d.ts +0 -2
- package/dist/packages/helpers/src/concatClassName.d.ts.map +0 -1
- package/dist/packages/helpers/src/index.d.ts +0 -5
- package/dist/packages/helpers/src/index.d.ts.map +0 -1
- package/dist/packages/helpers/src/types.d.ts +0 -8
- package/dist/packages/helpers/src/types.d.ts.map +0 -1
- package/dist/packages/helpers/src/validStyleProps.d.ts +0 -475
- package/dist/packages/helpers/src/validStyleProps.d.ts.map +0 -1
- package/dist/static/postProcessStyles.js +0 -18
- package/dist/static/postProcessStyles.js.map +0 -7
- package/dist/static.js +0 -15
- package/dist/static.js.map +0 -7
- package/dist/styled.js +0 -21
- package/dist/styled.js.map +0 -7
- package/dist/types.js +0 -1
- package/dist/types.js.map +0 -7
- package/dist/views/Animated.js +0 -79
- package/dist/views/Animated.js.map +0 -7
- package/dist/views/SafeAreaProvider.js +0 -30
- package/dist/views/SafeAreaProvider.js.map +0 -7
- package/dist/views/Stack.js +0 -12
- package/dist/views/Stack.js.map +0 -7
- package/dist/views/Text.js +0 -60
- package/dist/views/Text.js.map +0 -7
- package/dist/views/TextAncestorContext.js +0 -18
- package/dist/views/TextAncestorContext.js.map +0 -7
- package/dist/views/Theme.js +0 -68
- package/dist/views/Theme.js.map +0 -7
- package/dist/views/ThemeContext.js +0 -6
- package/dist/views/ThemeContext.js.map +0 -7
- package/dist/views/ThemeInverse.js +0 -26
- package/dist/views/ThemeInverse.js.map +0 -7
- package/dist/views/ThemeManagerContext.js +0 -61
- package/dist/views/ThemeManagerContext.js.map +0 -7
- package/dist/views/ThemeProvider.js +0 -45
- package/dist/views/ThemeProvider.js.map +0 -7
package/dist/static.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/static.ts"],
|
|
4
|
-
"sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createTamagui'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/isObj'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/pseudos'\n\n// -- below exports are only bundled compile-time --\n\nexport * from './static/postProcessStyles'\n"],
|
|
5
|
-
"mappings": "AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAIA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/styled.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { createComponent } from "./createComponent";
|
|
4
|
-
import { extendStaticConfig } from "./helpers/extendStaticConfig";
|
|
5
|
-
function styled(Component, options, staticExtractionOptions) {
|
|
6
|
-
const staticConfigProps = (() => {
|
|
7
|
-
if (options) {
|
|
8
|
-
const { variants, ...defaultProps } = options;
|
|
9
|
-
return { ...staticExtractionOptions, variants, defaultProps };
|
|
10
|
-
}
|
|
11
|
-
return {};
|
|
12
|
-
})();
|
|
13
|
-
const config = extendStaticConfig(Component, staticConfigProps);
|
|
14
|
-
const component = createComponent(config);
|
|
15
|
-
return component;
|
|
16
|
-
}
|
|
17
|
-
__name(styled, "styled");
|
|
18
|
-
export {
|
|
19
|
-
styled
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=styled.js.map
|
package/dist/styled.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/styled.ts"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { MediaProps, StaticComponent, StaticConfig, TamaguiConfig, Themes, Tokens } from './types'\n\nexport function styled<\n ParentComponent extends StaticComponent | React.Component<any>,\n Variants extends GetVariants<ParentComponent>\n>(\n Component: ParentComponent,\n options?: GetProps<ParentComponent> & {\n variants?: Variants\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps: StaticConfig = (() => {\n if (options) {\n const { variants, ...defaultProps } = options\n return { ...staticExtractionOptions, variants, defaultProps }\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n type VariantProps = GetVariantProps<Variants>\n return component as StaticComponent<\n Omit<GetProps<ParentComponent>, keyof VariantProps> & VariantProps & MediaProps<VariantProps>\n // leave this out it was causing infinite recursion type issues\n // VariantProps\n >\n}\n\n// type ParentVariants = A extends StaticComponent<any, infer Variants> ? Variants : {}\n\nexport type GetProps<A> = A extends StaticComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? Props\n : {}\n\nexport type GetVariants<ParentComponent extends StaticComponent | React.Component<any>> = void | {\n [key: string]: {\n [key: string]:\n | Partial<GetProps<ParentComponent>>\n | ((\n val: any,\n config: {\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: GetProps<ParentComponent>\n }\n ) => Partial<GetProps<ParentComponent>>)\n }\n}\n\nexport type GetVariantProps<Variants> = Variants extends void\n ? {}\n : {\n // ensure variants actually defined\n [Key in keyof Variants]?: keyof Variants[Key] extends `...${infer VariantSpread}`\n ? VariantSpread extends keyof Tokens\n ? keyof Tokens[VariantSpread] extends string | number\n ? `$${keyof Tokens[VariantSpread]}`\n : unknown\n : unknown\n : keyof Variants[Key] extends 'true'\n ? boolean\n : keyof Exclude<Variants[Key], undefined>\n }\n\n// type X = { ok: 1 }\n// type Y = { okk: 2; ok: 3 }\n// type Z = X & Y\n// type Z2 = Z\n\n// TODO get name\n// const displayName = `styled(Component)`\n// Object.defineProperty(component, 'name', {\n// value: displayName,\n// writable: false,\n// })\n"],
|
|
5
|
-
"mappings": ";;AAEA;AACA;AAGO,gBAIL,WACA,SAGA,yBACA;AACA,QAAM,oBAAmC,OAAM;AAC7C,QAAI,SAAS;AACX,YAAM,EAAE,aAAa,iBAAiB;AACtC,aAAO,KAAK,yBAAyB,UAAU;AAAA;AAEjD,WAAO;AAAA;AAET,QAAM,SAAS,mBAAmB,WAAW;AAC7C,QAAM,YAAY,gBAAgB;AAElC,SAAO;AAAA;AApBO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
package/dist/views/Animated.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import React, { useMemo } from "react";
|
|
4
|
-
import {
|
|
5
|
-
Animated
|
|
6
|
-
} from "react-native";
|
|
7
|
-
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
8
|
-
import { useConstant } from "../hooks/useConstant";
|
|
9
|
-
import { Stack } from "./Stack";
|
|
10
|
-
const defaultAnimation = {
|
|
11
|
-
from: {
|
|
12
|
-
opacity: 0,
|
|
13
|
-
translateY: 12
|
|
14
|
-
},
|
|
15
|
-
to: {
|
|
16
|
-
opacity: 1,
|
|
17
|
-
translateY: 0
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const styleKeys = {
|
|
21
|
-
opacity: true,
|
|
22
|
-
backgroundColor: true,
|
|
23
|
-
borderColor: true
|
|
24
|
-
};
|
|
25
|
-
const AnimatedStack = /* @__PURE__ */ __name(({
|
|
26
|
-
animateState = "in",
|
|
27
|
-
animation = defaultAnimation,
|
|
28
|
-
velocity = 6,
|
|
29
|
-
children,
|
|
30
|
-
animated,
|
|
31
|
-
...props
|
|
32
|
-
}) => {
|
|
33
|
-
const driver = useConstant(() => {
|
|
34
|
-
return new Animated.Value(0);
|
|
35
|
-
});
|
|
36
|
-
const animatedProps = useMemo(() => {
|
|
37
|
-
if (!animated) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const styleProps = {};
|
|
41
|
-
const transform = [];
|
|
42
|
-
for (const key in animation.from) {
|
|
43
|
-
const fromVal = animation.from[key];
|
|
44
|
-
const toVal = animation.to[key];
|
|
45
|
-
const interpolatedVal = driver.interpolate({
|
|
46
|
-
inputRange: [0, 1],
|
|
47
|
-
outputRange: [fromVal, toVal]
|
|
48
|
-
});
|
|
49
|
-
if (styleKeys[key]) {
|
|
50
|
-
styleProps[key] = interpolatedVal;
|
|
51
|
-
} else {
|
|
52
|
-
transform.push({
|
|
53
|
-
[key]: interpolatedVal
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return { transform, ...styleProps };
|
|
58
|
-
}, [animated, animateState]);
|
|
59
|
-
useIsomorphicLayoutEffect(() => {
|
|
60
|
-
if (!animated) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
Animated.spring(driver, {
|
|
64
|
-
useNativeDriver: true,
|
|
65
|
-
velocity,
|
|
66
|
-
toValue: animateState === "in" ? 1 : 0
|
|
67
|
-
}).start();
|
|
68
|
-
}, [animated, animateState]);
|
|
69
|
-
const childrenMemo = useMemo(() => children, [children]);
|
|
70
|
-
return /* @__PURE__ */ React.createElement(Stack, {
|
|
71
|
-
animated,
|
|
72
|
-
...props,
|
|
73
|
-
...animatedProps
|
|
74
|
-
}, childrenMemo);
|
|
75
|
-
}, "AnimatedStack");
|
|
76
|
-
export {
|
|
77
|
-
AnimatedStack
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=Animated.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/Animated.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\nimport {\n Animated,\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useConstant } from '../hooks/useConstant'\nimport { StackProps } from '../types'\nimport { Stack } from './Stack'\n\nconst defaultAnimation = {\n from: {\n opacity: 0,\n translateY: 12,\n },\n to: {\n opacity: 1,\n translateY: 0,\n },\n}\n\ntype AnimatableProps = Partial<\n Pick<StackProps, 'backgroundColor' | 'borderColor' | 'opacity'> &\n PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\n>\n\nconst styleKeys = {\n opacity: true,\n backgroundColor: true,\n borderColor: true,\n}\n\nexport type AnimatedStackProps = StackProps & {\n animateState?: 'in' | 'out'\n velocity?: number\n animation?: {\n from: AnimatableProps\n to: AnimatableProps\n }\n}\n\nexport const AnimatedStack = ({\n animateState = 'in',\n animation = defaultAnimation,\n velocity = 6,\n children,\n animated,\n ...props\n}: AnimatedStackProps) => {\n const driver = useConstant(() => {\n return new Animated.Value(0)\n })\n\n const animatedProps = useMemo(() => {\n if (!animated) {\n return null\n }\n\n const styleProps = {}\n const transform: any = []\n\n for (const key in animation.from) {\n const fromVal = animation.from[key]\n const toVal = animation.to[key]\n const interpolatedVal = driver.interpolate({\n inputRange: [0, 1],\n outputRange: [fromVal, toVal],\n })\n if (styleKeys[key]) {\n styleProps[key] = interpolatedVal\n } else {\n transform.push({\n [key]: interpolatedVal,\n })\n }\n }\n return { transform, ...styleProps }\n }, [animated, animateState])\n\n useIsomorphicLayoutEffect(() => {\n if (!animated) {\n return\n }\n Animated.spring(driver, {\n useNativeDriver: true,\n velocity,\n toValue: animateState === 'in' ? 1 : 0,\n }).start()\n }, [animated, animateState])\n\n const childrenMemo = useMemo(() => children, [children])\n\n return (\n <Stack animated={animated} {...props} {...animatedProps}>\n {childrenMemo}\n </Stack>\n )\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA;AACA;AAAA;AAAA;AAgBA;AACA;AAEA;AAEA,MAAM,mBAAmB;AAAA,EACvB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,EAEd,IAAI;AAAA,IACF,SAAS;AAAA,IACT,YAAY;AAAA;AAAA;AAoBhB,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,aAAa;AAAA;AAYR,MAAM,gBAAgB,wBAAC;AAAA,EAC5B,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AAAA,KACG;AAAA,MACqB;AACxB,QAAM,SAAS,YAAY,MAAM;AAC/B,WAAO,IAAI,SAAS,MAAM;AAAA;AAG5B,QAAM,gBAAgB,QAAQ,MAAM;AAClC,QAAI,CAAC,UAAU;AACb,aAAO;AAAA;AAGT,UAAM,aAAa;AACnB,UAAM,YAAiB;AAEvB,eAAW,OAAO,UAAU,MAAM;AAChC,YAAM,UAAU,UAAU,KAAK;AAC/B,YAAM,QAAQ,UAAU,GAAG;AAC3B,YAAM,kBAAkB,OAAO,YAAY;AAAA,QACzC,YAAY,CAAC,GAAG;AAAA,QAChB,aAAa,CAAC,SAAS;AAAA;AAEzB,UAAI,UAAU,MAAM;AAClB,mBAAW,OAAO;AAAA,aACb;AACL,kBAAU,KAAK;AAAA,WACZ,MAAM;AAAA;AAAA;AAAA;AAIb,WAAO,EAAE,cAAc;AAAA,KACtB,CAAC,UAAU;AAEd,4BAA0B,MAAM;AAC9B,QAAI,CAAC,UAAU;AACb;AAAA;AAEF,aAAS,OAAO,QAAQ;AAAA,MACtB,iBAAiB;AAAA,MACjB;AAAA,MACA,SAAS,iBAAiB,OAAO,IAAI;AAAA,OACpC;AAAA,KACF,CAAC,UAAU;AAEd,QAAM,eAAe,QAAQ,MAAM,UAAU,CAAC;AAE9C,SACE,oCAAC,OAAD;AAAA,IAAO;AAAA,OAAwB;AAAA,OAAW;AAAA,KACvC;AAAA,GArDsB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Platform } from "react-native";
|
|
5
|
-
import {
|
|
6
|
-
SafeAreaProvider as RNSafeAreaProvider,
|
|
7
|
-
initialWindowMetrics as defaultInitialWindowMetrics
|
|
8
|
-
} from "react-native-safe-area-context";
|
|
9
|
-
let defaultMetrics = null;
|
|
10
|
-
const SafeAreaProvider = /* @__PURE__ */ __name(({
|
|
11
|
-
initialWindowMetrics,
|
|
12
|
-
children
|
|
13
|
-
}) => {
|
|
14
|
-
if (!initialWindowMetrics && !defaultMetrics) {
|
|
15
|
-
defaultMetrics = Platform.select({
|
|
16
|
-
web: {
|
|
17
|
-
frame: { x: 0, y: 0, width: 0, height: 0 },
|
|
18
|
-
insets: { top: 0, left: 0, right: 0, bottom: 0 }
|
|
19
|
-
},
|
|
20
|
-
default: defaultInitialWindowMetrics
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return /* @__PURE__ */ React.createElement(RNSafeAreaProvider, {
|
|
24
|
-
initialMetrics: initialWindowMetrics ?? defaultMetrics
|
|
25
|
-
}, children);
|
|
26
|
-
}, "SafeAreaProvider");
|
|
27
|
-
export {
|
|
28
|
-
SafeAreaProvider
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=SafeAreaProvider.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/SafeAreaProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\nimport { Platform } from 'react-native'\nimport {\n Metrics,\n SafeAreaProvider as RNSafeAreaProvider,\n initialWindowMetrics as defaultInitialWindowMetrics,\n} from 'react-native-safe-area-context'\n\nlet defaultMetrics: Metrics | null = null\n\nexport const SafeAreaProvider = ({\n initialWindowMetrics,\n children,\n}: {\n children?: any\n initialWindowMetrics?: any\n}) => {\n if (!initialWindowMetrics && !defaultMetrics) {\n defaultMetrics = Platform.select({\n web: {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n },\n default: defaultInitialWindowMetrics,\n })\n }\n\n return (\n <RNSafeAreaProvider initialMetrics={initialWindowMetrics ?? defaultMetrics}>\n {children}\n </RNSafeAreaProvider>\n )\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAMA,IAAI,iBAAiC;AAE9B,MAAM,mBAAmB,wBAAC;AAAA,EAC/B;AAAA,EACA;AAAA,MAII;AACJ,MAAI,CAAC,wBAAwB,CAAC,gBAAgB;AAC5C,qBAAiB,SAAS,OAAO;AAAA,MAC/B,KAAK;AAAA,QACH,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ;AAAA,QACvC,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;AAAA;AAAA,MAE/C,SAAS;AAAA;AAAA;AAIb,SACE,oCAAC,oBAAD;AAAA,IAAoB,gBAAgB,wBAAwB;AAAA,KACzD;AAAA,GAnByB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/views/Stack.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { stackDefaultStyles } from "../constants/constants";
|
|
2
|
-
import { createComponent } from "../createComponent";
|
|
3
|
-
const Stack = createComponent({
|
|
4
|
-
defaultProps: {
|
|
5
|
-
...stackDefaultStyles,
|
|
6
|
-
flexDirection: "column"
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
export {
|
|
10
|
-
Stack
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=Stack.js.map
|
package/dist/views/Stack.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/Stack.tsx"],
|
|
4
|
-
"sourcesContent": ["import { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps } from '../types'\n\nexport const Stack = createComponent<StackProps>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AAGO,MAAM,QAAQ,gBAA4B;AAAA,EAC/C,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/views/Text.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { isWeb } from "../constants/platform";
|
|
2
|
-
import { createComponent } from "../createComponent";
|
|
3
|
-
import { stylePropsTextOnly, validStyles } from "../static";
|
|
4
|
-
const ellipseStyle = {
|
|
5
|
-
maxWidth: "100%",
|
|
6
|
-
overflow: "hidden",
|
|
7
|
-
textOverflow: "ellipsis",
|
|
8
|
-
whiteSpace: "nowrap"
|
|
9
|
-
};
|
|
10
|
-
const Text = createComponent({
|
|
11
|
-
isText: true,
|
|
12
|
-
defaultProps: {
|
|
13
|
-
display: isWeb ? "inline" : "inline-flex",
|
|
14
|
-
boxSizing: "border-box",
|
|
15
|
-
fontFamily: "System",
|
|
16
|
-
wordWrap: "break-word"
|
|
17
|
-
},
|
|
18
|
-
variants: {
|
|
19
|
-
numberOfLines: {
|
|
20
|
-
1: ellipseStyle,
|
|
21
|
-
"[number]": (lines) => lines > 1 ? { WebkitLineClamp: 1 } : null
|
|
22
|
-
},
|
|
23
|
-
selectable: {
|
|
24
|
-
true: {
|
|
25
|
-
userSelect: "text"
|
|
26
|
-
},
|
|
27
|
-
false: {
|
|
28
|
-
userSelect: "none"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
pressable: {
|
|
32
|
-
true: {
|
|
33
|
-
cursor: "pointer"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
ellipse: {
|
|
37
|
-
true: isWeb ? ellipseStyle : {
|
|
38
|
-
numberOfLines: 1,
|
|
39
|
-
lineBreakMode: "clip"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
deoptProps: new Set(isWeb ? [] : ["ellipse"]),
|
|
44
|
-
validStyles: {
|
|
45
|
-
...validStyles,
|
|
46
|
-
...stylePropsTextOnly,
|
|
47
|
-
...isWeb && {
|
|
48
|
-
userSelect: true,
|
|
49
|
-
textOverflow: true,
|
|
50
|
-
whiteSpace: true,
|
|
51
|
-
wordWrap: true,
|
|
52
|
-
selectable: true,
|
|
53
|
-
cursor: true
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
export {
|
|
58
|
-
Text
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=Text.js.map
|
package/dist/views/Text.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/Text.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { stylePropsTextOnly, validStyles } from '../static'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'inline-flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n '[number]': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n },\n false: {\n userSelect: 'none',\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 // TODO document\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA;AAGP,MAAM,OAAO,gBAA2B;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,EAEZ,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,YAAY,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,MAAM;AAAA;AAAA,IAG/D,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA;AAAA,MAEd,OAAO;AAAA,QACL,YAAY;AAAA;AAAA;AAAA,IAIhB,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA;AAAA;AAAA,IAIZ,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA;AAAA;AAAA;AAAA,EAKzB,YAAY,IAAI,IAAI,QAAQ,KAAK,CAAC;AAAA,EAClC,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { rnw } from "../constants/rnw";
|
|
5
|
-
const TextAncestorContext = rnw?.TextAncestorContext;
|
|
6
|
-
const TextAncestorProvider = /* @__PURE__ */ __name((props) => {
|
|
7
|
-
if (TextAncestorContext) {
|
|
8
|
-
return /* @__PURE__ */ React.createElement(TextAncestorContext.Provider, {
|
|
9
|
-
value: false
|
|
10
|
-
}, props.children);
|
|
11
|
-
}
|
|
12
|
-
return props.children;
|
|
13
|
-
}, "TextAncestorProvider");
|
|
14
|
-
export {
|
|
15
|
-
TextAncestorContext,
|
|
16
|
-
TextAncestorProvider
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=TextAncestorContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/TextAncestorContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\n\nimport { rnw } from '../constants/rnw'\n\nexport const TextAncestorContext = rnw?.TextAncestorContext\n\nexport const TextAncestorProvider = (props) => {\n if (TextAncestorContext) {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n }\n return props.children\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AAEO,MAAM,sBAAsB,KAAK;AAEjC,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,MAAI,qBAAqB;AACvB,WAAO,oCAAC,oBAAoB,UAArB;AAAA,MAA8B,OAAO;AAAA,OAAQ,MAAM;AAAA;AAE5D,SAAO,MAAM;AAAA,GAJqB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/views/Theme.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import React, { useContext, useState } from "react";
|
|
4
|
-
import { isWeb, useIsomorphicLayoutEffect } from "../constants/platform";
|
|
5
|
-
import { getThemeParentClassName } from "../createTamagui";
|
|
6
|
-
import { useConstant } from "../hooks/useConstant";
|
|
7
|
-
import { ThemeContext } from "./ThemeContext";
|
|
8
|
-
import { ThemeManager, ThemeManagerContext } from "./ThemeManagerContext";
|
|
9
|
-
const Theme = /* @__PURE__ */ __name((props) => {
|
|
10
|
-
const parent = useContext(ThemeManagerContext);
|
|
11
|
-
const themes = useContext(ThemeContext);
|
|
12
|
-
const [parentName, setParentName] = useState(parent.name || "light");
|
|
13
|
-
if (!themes) {
|
|
14
|
-
console.warn("Error, no themes in context", props);
|
|
15
|
-
return props.children;
|
|
16
|
-
}
|
|
17
|
-
const nextNameParent = `${props.name}-${parentName}`;
|
|
18
|
-
const nextNameParentParent = `${props.name}-${parent.parentName}`;
|
|
19
|
-
const name = !props.name ? null : props.name in themes ? props.name : nextNameParent in themes ? nextNameParent : nextNameParentParent in themes ? nextNameParentParent : null;
|
|
20
|
-
const theme = name ? themes[name] : null;
|
|
21
|
-
const themeManager = useConstant(() => {
|
|
22
|
-
if (!theme) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const manager = new ThemeManager();
|
|
26
|
-
if (name) {
|
|
27
|
-
manager.setActiveTheme({ name, theme: themes[name], parentName });
|
|
28
|
-
}
|
|
29
|
-
return manager;
|
|
30
|
-
});
|
|
31
|
-
useIsomorphicLayoutEffect(() => {
|
|
32
|
-
if (!themeManager) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (name) {
|
|
36
|
-
themeManager.setActiveTheme({ name, theme, parentName });
|
|
37
|
-
}
|
|
38
|
-
return parent.onChangeTheme((next) => {
|
|
39
|
-
if (next) {
|
|
40
|
-
themeManager.setActiveTheme({ name: next, theme: themes[next], parentName });
|
|
41
|
-
setParentName(next);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}, [themes, name, parentName]);
|
|
45
|
-
if (!name || !theme) {
|
|
46
|
-
return props.children;
|
|
47
|
-
}
|
|
48
|
-
const contents = themeManager ? /* @__PURE__ */ React.createElement(ThemeManagerContext.Provider, {
|
|
49
|
-
value: themeManager
|
|
50
|
-
}, props.children) : props.children;
|
|
51
|
-
if (isWeb) {
|
|
52
|
-
if (props.disableThemeClass) {
|
|
53
|
-
return contents;
|
|
54
|
-
}
|
|
55
|
-
if (name) {
|
|
56
|
-
const color = themes[name]?.["color"]?.["variable"];
|
|
57
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
58
|
-
className: getThemeParentClassName(props.name),
|
|
59
|
-
style: { display: "contents", color }
|
|
60
|
-
}, contents);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return contents;
|
|
64
|
-
}, "Theme");
|
|
65
|
-
export {
|
|
66
|
-
Theme
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=Theme.js.map
|
package/dist/views/Theme.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/Theme.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('Error, no themes in context', props)\n return props.children\n }\n\n const nextNameParent = `${props.name}-${parentName}`\n const nextNameParentParent = `${props.name}-${parent.parentName}`\n const name = !props.name\n ? null\n : props.name in themes\n ? props.name\n : nextNameParent in themes\n ? nextNameParent\n : nextNameParentParent in themes\n ? nextNameParentParent\n : null\n const theme = name ? themes[name] : null\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!theme) {\n return null\n }\n const manager = new ThemeManager()\n if (name) {\n manager.setActiveTheme({ name, theme: themes[name], parentName })\n }\n return manager\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!themeManager) {\n return\n }\n if (name) {\n themeManager.setActiveTheme({ name, theme, parentName })\n }\n return parent.onChangeTheme((next) => {\n if (next) {\n themeManager.setActiveTheme({ name: next, theme: themes[next], parentName })\n setParentName(next)\n }\n })\n }, [themes, name, parentName])\n\n if (!name || !theme) {\n return props.children\n }\n\n const contents = themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {props.children}\n </ThemeManagerContext.Provider>\n ) : (\n props.children\n )\n\n if (isWeb) {\n if (props.disableThemeClass) {\n return contents\n }\n if (name) {\n const color = themes[name]?.['color']?.['variable']\n return (\n <div\n className={getThemeParentClassName(props.name)}\n // in order to provide currentColor, set color by default\n style={{ display: 'contents', color }}\n >\n {contents}\n </div>\n )\n }\n }\n\n return contents\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAC1C,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,+BAA+B;AAC5C,WAAO,MAAM;AAAA;AAGf,QAAM,iBAAiB,GAAG,MAAM,QAAQ;AACxC,QAAM,uBAAuB,GAAG,MAAM,QAAQ,OAAO;AACrD,QAAM,OAAO,CAAC,MAAM,OAChB,OACA,MAAM,QAAQ,SACd,MAAM,OACN,kBAAkB,SAClB,iBACA,wBAAwB,SACxB,uBACA;AACJ,QAAM,QAAQ,OAAO,OAAO,QAAQ;AACpC,QAAM,eAAe,YAAiC,MAAM;AAC1D,QAAI,CAAC,OAAO;AACV,aAAO;AAAA;AAET,UAAM,UAAU,IAAI;AACpB,QAAI,MAAM;AACR,cAAQ,eAAe,EAAE,MAAM,OAAO,OAAO,OAAO;AAAA;AAEtD,WAAO;AAAA;AAGT,4BAA0B,MAAM;AAC9B,QAAI,CAAC,cAAc;AACjB;AAAA;AAEF,QAAI,MAAM;AACR,mBAAa,eAAe,EAAE,MAAM,OAAO;AAAA;AAE7C,WAAO,OAAO,cAAc,CAAC,SAAS;AACpC,UAAI,MAAM;AACR,qBAAa,eAAe,EAAE,MAAM,MAAM,OAAO,OAAO,OAAO;AAC/D,sBAAc;AAAA;AAAA;AAAA,KAGjB,CAAC,QAAQ,MAAM;AAElB,MAAI,CAAC,QAAQ,CAAC,OAAO;AACnB,WAAO,MAAM;AAAA;AAGf,QAAM,WAAW,eACf,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAClC,MAAM,YAGT,MAAM;AAGR,MAAI,OAAO;AACT,QAAI,MAAM,mBAAmB;AAC3B,aAAO;AAAA;AAET,QAAI,MAAM;AACR,YAAM,QAAQ,OAAO,QAAQ,WAAW;AACxC,aACE,oCAAC,OAAD;AAAA,QACE,WAAW,wBAAwB,MAAM;AAAA,QAEzC,OAAO,EAAE,SAAS,YAAY;AAAA,SAE7B;AAAA;AAAA;AAMT,SAAO;AAAA,GA7EY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/ThemeContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react'\n\nimport { Themes } from '../types'\n\nexport const ThemeContext = createContext<Themes>(null as any)\n"],
|
|
5
|
-
"mappings": "AAAA;AAIO,MAAM,eAAe,cAAsB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
|
|
5
|
-
import { Theme } from "./Theme";
|
|
6
|
-
let inversions = {
|
|
7
|
-
light: "dark",
|
|
8
|
-
dark: "light"
|
|
9
|
-
};
|
|
10
|
-
function setThemeInversions(next) {
|
|
11
|
-
inversions = next;
|
|
12
|
-
}
|
|
13
|
-
__name(setThemeInversions, "setThemeInversions");
|
|
14
|
-
const ThemeInverse = /* @__PURE__ */ __name((props) => {
|
|
15
|
-
const themeName = useThemeName();
|
|
16
|
-
const defaultTheme = useDefaultThemeName();
|
|
17
|
-
const name = inversions[themeName] || inversions[defaultTheme] || null;
|
|
18
|
-
return /* @__PURE__ */ React.createElement(Theme, {
|
|
19
|
-
name
|
|
20
|
-
}, props.children);
|
|
21
|
-
}, "ThemeInverse");
|
|
22
|
-
export {
|
|
23
|
-
ThemeInverse,
|
|
24
|
-
setThemeInversions
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=ThemeInverse.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/ThemeInverse.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme] || null\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,4BAA4B,MAAoB;AACrD,eAAa;AAAA;AADC;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY;AAClB,QAAM,eAAe;AACrB,QAAM,OAAO,WAAW,cAAc,WAAW,iBAAiB;AAClE,SAAO,oCAAC,OAAD;AAAA,IAAO;AAAA,KAAa,MAAM;AAAA,GAJP;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { createContext } from "react";
|
|
4
|
-
class ThemeManager {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = "light";
|
|
7
|
-
this.parentName = null;
|
|
8
|
-
this.keys = new Map();
|
|
9
|
-
this.listeners = new Map();
|
|
10
|
-
this.themeListeners = new Set();
|
|
11
|
-
this.theme = null;
|
|
12
|
-
}
|
|
13
|
-
setActiveTheme({
|
|
14
|
-
name,
|
|
15
|
-
theme,
|
|
16
|
-
parentName
|
|
17
|
-
}) {
|
|
18
|
-
if (name === this.name)
|
|
19
|
-
return;
|
|
20
|
-
this.name = name;
|
|
21
|
-
this.theme = theme;
|
|
22
|
-
this.parentName = parentName || null;
|
|
23
|
-
this.update();
|
|
24
|
-
}
|
|
25
|
-
track(uuid, keys) {
|
|
26
|
-
if (!this.name)
|
|
27
|
-
return;
|
|
28
|
-
this.keys.set(uuid, keys);
|
|
29
|
-
}
|
|
30
|
-
update() {
|
|
31
|
-
if (!this.name) {
|
|
32
|
-
this.keys.clear();
|
|
33
|
-
}
|
|
34
|
-
for (const [uuid, keys] of this.keys.entries()) {
|
|
35
|
-
if (keys.size) {
|
|
36
|
-
this.listeners.get(uuid)?.();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
this.themeListeners.forEach((cb) => cb(this.name, this));
|
|
40
|
-
}
|
|
41
|
-
onChangeTheme(cb) {
|
|
42
|
-
this.themeListeners.add(cb);
|
|
43
|
-
return () => {
|
|
44
|
-
this.themeListeners.delete(cb);
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
onUpdate(uuid, cb) {
|
|
48
|
-
this.listeners.set(uuid, cb);
|
|
49
|
-
return () => {
|
|
50
|
-
this.listeners.delete(uuid);
|
|
51
|
-
this.keys.delete(uuid);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
__name(ThemeManager, "ThemeManager");
|
|
56
|
-
const ThemeManagerContext = createContext(new ThemeManager());
|
|
57
|
-
export {
|
|
58
|
-
ThemeManager,
|
|
59
|
-
ThemeManagerContext
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=ThemeManagerContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/ThemeManagerContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport class ThemeManager {\n name: string | null = 'light'\n parentName: string | null = null\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n theme = null\n\n setActiveTheme({\n name,\n theme,\n parentName,\n }: {\n parentName?: string | null\n name: string | null\n theme?: any\n }) {\n if (name === this.name) return\n this.name = name\n this.theme = theme\n this.parentName = parentName || null\n this.update()\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n update() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager>(new ThemeManager())\n"],
|
|
5
|
-
"mappings": ";;AAAA;AAIO,mBAAmB;AAAA,EAAnB,cAJP;AAKE,gBAAsB;AACtB,sBAA4B;AAC5B,gBAAO,IAAI;AACX,qBAAY,IAAI;AAChB,0BAAiB,IAAI;AACrB,iBAAQ;AAAA;AAAA,EAER,eAAe;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,KAKC;AACD,QAAI,SAAS,KAAK;AAAM;AACxB,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,aAAa,cAAc;AAChC,SAAK;AAAA;AAAA,EAGP,MAAM,MAAW,MAAmB;AAClC,QAAI,CAAC,KAAK;AAAM;AAChB,SAAK,KAAK,IAAI,MAAM;AAAA;AAAA,EAGtB,SAAS;AACP,QAAI,CAAC,KAAK,MAAM;AACd,WAAK,KAAK;AAAA;AAEZ,eAAW,CAAC,MAAM,SAAS,KAAK,KAAK,WAAW;AAC9C,UAAI,KAAK,MAAM;AACb,aAAK,UAAU,IAAI;AAAA;AAAA;AAGvB,SAAK,eAAe,QAAQ,CAAC,OAAO,GAAG,KAAK,MAAM;AAAA;AAAA,EAGpD,cAAc,IAAmB;AAC/B,SAAK,eAAe,IAAI;AACxB,WAAO,MAAM;AACX,WAAK,eAAe,OAAO;AAAA;AAAA;AAAA,EAI/B,SAAS,MAAW,IAAc;AAChC,SAAK,UAAU,IAAI,MAAM;AACzB,WAAO,MAAM;AACX,WAAK,UAAU,OAAO;AACtB,WAAK,KAAK,OAAO;AAAA;AAAA;AAAA;AApDhB;AAyDA,MAAM,sBAAsB,cAA4B,IAAI;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import React, { useMemo } from "react";
|
|
4
|
-
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
5
|
-
import { getHasConfigured, getThemeParentClassName } from "../createTamagui";
|
|
6
|
-
import { Theme } from "./Theme";
|
|
7
|
-
import { ThemeContext } from "./ThemeContext";
|
|
8
|
-
const GET_DEFAULT_THEME = "___TGUI";
|
|
9
|
-
const ThemeProvider = /* @__PURE__ */ __name((props) => {
|
|
10
|
-
if (!getHasConfigured()) {
|
|
11
|
-
throw new Error(`Missing configureThemes() call, add to your root file`);
|
|
12
|
-
}
|
|
13
|
-
useIsomorphicLayoutEffect(() => {
|
|
14
|
-
if (props.disableRootThemeClass) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (typeof document !== "undefined") {
|
|
18
|
-
const cns = getThemeParentClassName(`${props.defaultTheme}`).split(" ");
|
|
19
|
-
cns.forEach((cn) => document.body.classList.add(cn));
|
|
20
|
-
return () => {
|
|
21
|
-
cns.forEach((cn) => document.body.classList.remove(cn));
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}, []);
|
|
25
|
-
const themeContext = useMemo(() => {
|
|
26
|
-
return new Proxy(props.themes, {
|
|
27
|
-
get(target, key) {
|
|
28
|
-
if (key === GET_DEFAULT_THEME)
|
|
29
|
-
return props.defaultTheme;
|
|
30
|
-
return Reflect.get(target, key);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}, [props.themes]);
|
|
34
|
-
return /* @__PURE__ */ React.createElement(ThemeContext.Provider, {
|
|
35
|
-
value: themeContext
|
|
36
|
-
}, /* @__PURE__ */ React.createElement(Theme, {
|
|
37
|
-
name: props.defaultTheme,
|
|
38
|
-
disableThemeClass: props.disableRootThemeClass
|
|
39
|
-
}, props.children));
|
|
40
|
-
}, "ThemeProvider");
|
|
41
|
-
export {
|
|
42
|
-
GET_DEFAULT_THEME,
|
|
43
|
-
ThemeProvider
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/views/ThemeProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getHasConfigured, getThemeParentClassName } from '../createTamagui'\nimport { Theme } from './Theme'\nimport { ThemeContext } from './ThemeContext'\n\nexport type ThemeProviderProps = {\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const GET_DEFAULT_THEME = '___TGUI'\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n useIsomorphicLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n if (typeof document !== 'undefined') {\n const cns = getThemeParentClassName(`${props.defaultTheme}`).split(' ')\n cns.forEach((cn) => document.body.classList.add(cn))\n return () => {\n cns.forEach((cn) => document.body.classList.remove(cn))\n }\n }\n }, [])\n\n const themeContext = useMemo(() => {\n return new Proxy(props.themes, {\n get(target, key) {\n if (key === GET_DEFAULT_THEME) return props.defaultTheme\n return Reflect.get(target, key)\n },\n })\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AASO,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,oBAAoB;AACvB,UAAM,IAAI,MAAM;AAAA;AAIlB,4BAA0B,MAAM;AAC9B,QAAI,MAAM,uBAAuB;AAC/B;AAAA;AAEF,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,MAAM,wBAAwB,GAAG,MAAM,gBAAgB,MAAM;AACnE,UAAI,QAAQ,CAAC,OAAO,SAAS,KAAK,UAAU,IAAI;AAChD,aAAO,MAAM;AACX,YAAI,QAAQ,CAAC,OAAO,SAAS,KAAK,UAAU,OAAO;AAAA;AAAA;AAAA,KAGtD;AAEH,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO,IAAI,MAAM,MAAM,QAAQ;AAAA,MAC7B,IAAI,QAAQ,KAAK;AACf,YAAI,QAAQ;AAAmB,iBAAO,MAAM;AAC5C,eAAO,QAAQ,IAAI,QAAQ;AAAA;AAAA;AAAA,KAG9B,CAAC,MAAM;AAEV,SACE,oCAAC,aAAa,UAAd;AAAA,IAAuB,OAAO;AAAA,KAC5B,oCAAC,OAAD;AAAA,IAAO,MAAM,MAAM;AAAA,IAAc,mBAAmB,MAAM;AAAA,KACvD,MAAM;AAAA,GA/Bc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|