@tamagui/core 1.0.1-beta.76 → 1.0.1-beta.79

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.
Files changed (126) hide show
  1. package/dist/cjs/ThemeManager.js +6 -22
  2. package/dist/cjs/ThemeManager.js.map +2 -2
  3. package/dist/cjs/constants/rnw.js +5 -7
  4. package/dist/cjs/constants/rnw.js.map +2 -2
  5. package/dist/cjs/createComponent.js +4 -3
  6. package/dist/cjs/createComponent.js.map +2 -2
  7. package/dist/cjs/helpers/createPropMapper.js +1 -15
  8. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  9. package/dist/cjs/helpers/getSplitStyles.js +3 -0
  10. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  11. package/dist/cjs/helpers/validate.js +33 -30
  12. package/dist/cjs/helpers/validate.js.map +2 -2
  13. package/dist/cjs/index.js +0 -5
  14. package/dist/cjs/index.js.map +2 -2
  15. package/dist/cjs/insertFont.js +1 -2
  16. package/dist/cjs/insertFont.js.map +2 -2
  17. package/dist/esm/ThemeManager.js +4 -4
  18. package/dist/esm/ThemeManager.js.map +2 -2
  19. package/dist/esm/constants/rnw.js +2 -7
  20. package/dist/esm/constants/rnw.js.map +2 -2
  21. package/dist/esm/createComponent.js +4 -3
  22. package/dist/esm/createComponent.js.map +2 -2
  23. package/dist/esm/helpers/createPropMapper.js +1 -17
  24. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  25. package/dist/esm/helpers/getSplitStyles.js +3 -0
  26. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  27. package/dist/esm/helpers/validate.js +1 -1
  28. package/dist/esm/helpers/validate.js.map +2 -2
  29. package/dist/esm/index.js +0 -3
  30. package/dist/esm/index.js.map +2 -2
  31. package/dist/esm/insertFont.js +1 -2
  32. package/dist/esm/insertFont.js.map +2 -2
  33. package/package.json +7 -7
  34. package/types/ThemeManager.d.ts +1 -1
  35. package/types/ThemeManager.d.ts.map +1 -1
  36. package/types/constants/rnw.d.ts.map +1 -1
  37. package/types/createComponent.d.ts.map +1 -1
  38. package/types/helpers/createTamaguiProvider.d.ts +1 -0
  39. package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
  40. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  41. package/types/index.d.ts +1 -1
  42. package/types/index.d.ts.map +1 -1
  43. package/dist/cjs/helpers/pseudos.js +0 -41
  44. package/dist/cjs/helpers/pseudos.js.map +0 -7
  45. package/dist/esm/helpers/pseudos.js +0 -18
  46. package/dist/esm/helpers/pseudos.js.map +0 -7
  47. package/dist/jsx/Pressability.js +0 -4
  48. package/dist/jsx/Pressability.native.js +0 -4
  49. package/dist/jsx/Tamagui.js +0 -38
  50. package/dist/jsx/ThemeContext.js +0 -5
  51. package/dist/jsx/ThemeManager.js +0 -194
  52. package/dist/jsx/conf.js +0 -38
  53. package/dist/jsx/constants/constants.js +0 -17
  54. package/dist/jsx/constants/platform.js +0 -25
  55. package/dist/jsx/constants/rnw.js +0 -10
  56. package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
  57. package/dist/jsx/createComponent.js +0 -1036
  58. package/dist/jsx/createFont.js +0 -25
  59. package/dist/jsx/createShorthands.js +0 -6
  60. package/dist/jsx/createTamagui.js +0 -245
  61. package/dist/jsx/createTheme.js +0 -6
  62. package/dist/jsx/createTokens.js +0 -11
  63. package/dist/jsx/createVariable.js +0 -64
  64. package/dist/jsx/createVariables.js +0 -31
  65. package/dist/jsx/defaultComponentState.js +0 -0
  66. package/dist/jsx/helpers/RNComponents.js +0 -11
  67. package/dist/jsx/helpers/areEqualSets.js +0 -13
  68. package/dist/jsx/helpers/calc.js +0 -46
  69. package/dist/jsx/helpers/createMediaStyle.js +0 -29
  70. package/dist/jsx/helpers/createPropMapper.js +0 -243
  71. package/dist/jsx/helpers/createShallowUpdate.js +0 -16
  72. package/dist/jsx/helpers/createTamaguiProvider.js +0 -28
  73. package/dist/jsx/helpers/extendStaticConfig.js +0 -62
  74. package/dist/jsx/helpers/fixNativeShadow.js +0 -5
  75. package/dist/jsx/helpers/fixNativeShadow.native.js +0 -28
  76. package/dist/jsx/helpers/generateAtomicStyles.js +0 -410
  77. package/dist/jsx/helpers/getExpandedShorthands.js +0 -15
  78. package/dist/jsx/helpers/getSize.js +0 -19
  79. package/dist/jsx/helpers/getSplitStyles.js +0 -380
  80. package/dist/jsx/helpers/getStackSize.js +0 -15
  81. package/dist/jsx/helpers/getStylesAtomic.js +0 -61
  82. package/dist/jsx/helpers/getStylesAtomic.native.js +0 -6
  83. package/dist/jsx/helpers/getTextSize.js +0 -31
  84. package/dist/jsx/helpers/getVariantExtras.js +0 -22
  85. package/dist/jsx/helpers/insertStyleRule.js +0 -91
  86. package/dist/jsx/helpers/isObj.js +0 -4
  87. package/dist/jsx/helpers/isTamaguiComponent.js +0 -12
  88. package/dist/jsx/helpers/isTamaguiElement.js +0 -8
  89. package/dist/jsx/helpers/matchMedia.js +0 -15
  90. package/dist/jsx/helpers/matchMedia.native.js +0 -6
  91. package/dist/jsx/helpers/mergeProps.js +0 -15
  92. package/dist/jsx/helpers/mergeTransform.js +0 -16
  93. package/dist/jsx/helpers/nativeGestureHandler.native.js +0 -1
  94. package/dist/jsx/helpers/proxyThemeVariables.js +0 -14
  95. package/dist/jsx/helpers/pseudos.js +0 -17
  96. package/dist/jsx/helpers/registerCSSVariable.js +0 -14
  97. package/dist/jsx/helpers/themeable.js +0 -22
  98. package/dist/jsx/helpers/validate.js +0 -73
  99. package/dist/jsx/helpers/withStaticProperties.js +0 -7
  100. package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -7
  101. package/dist/jsx/hooks/useConstant.js +0 -11
  102. package/dist/jsx/hooks/useFeatures.js +0 -165
  103. package/dist/jsx/hooks/useId.js +0 -32
  104. package/dist/jsx/hooks/useIsMounted.js +0 -15
  105. package/dist/jsx/hooks/useIsTouchDevice.js +0 -14
  106. package/dist/jsx/hooks/useMedia.js +0 -153
  107. package/dist/jsx/hooks/usePressable.js +0 -11
  108. package/dist/jsx/hooks/usePrevious.js +0 -0
  109. package/dist/jsx/hooks/useTheme.js +0 -164
  110. package/dist/jsx/hooks/useUnmountEffect.js +0 -7
  111. package/dist/jsx/index.js +0 -64
  112. package/dist/jsx/insertFont.js +0 -64
  113. package/dist/jsx/static.js +0 -18
  114. package/dist/jsx/styled.js +0 -49
  115. package/dist/jsx/types-rnw.js +0 -0
  116. package/dist/jsx/types.js +0 -0
  117. package/dist/jsx/views/Slot.js +0 -70
  118. package/dist/jsx/views/Stack.js +0 -12
  119. package/dist/jsx/views/Text.js +0 -57
  120. package/dist/jsx/views/TextAncestorContext.js +0 -13
  121. package/dist/jsx/views/Theme.js +0 -27
  122. package/dist/jsx/views/ThemeInverse.js +0 -24
  123. package/dist/jsx/views/ThemeProvider.js +0 -34
  124. package/dist/jsx/views/ThemeReset.js +0 -32
  125. package/types/helpers/pseudos.d.ts +0 -16
  126. package/types/helpers/pseudos.d.ts.map +0 -1
@@ -1,164 +0,0 @@
1
- import { useForceUpdate } from "@tamagui/use-force-update";
2
- import { useContext, useLayoutEffect, useMemo, useRef, useState } from "react";
3
- import { getConfig } from "../conf";
4
- import { isWeb, useIsomorphicLayoutEffect } from "../constants/platform";
5
- import { areEqualSets } from "../helpers/areEqualSets";
6
- import { ThemeContext } from "../ThemeContext";
7
- import { ThemeManager, ThemeManagerContext, emptyManager } from "../ThemeManager";
8
- import { useConstant } from "./useConstant";
9
- const useTheme = (themeName, componentName, props, forceUpdate) => {
10
- const { name, theme, themes, themeManager, className, didChangeTheme } = useChangeThemeEffect(themeName, componentName, props, forceUpdate);
11
- if (process.env.NODE_ENV === "development") {
12
- if ((props == null ? void 0 : props.debug) === "verbose") {
13
- console.log(" \xBB useTheme", { themeName, componentName, name, className });
14
- }
15
- }
16
- const state = useRef();
17
- if (!state.current) {
18
- state.current = {
19
- uuid: {},
20
- keys: /* @__PURE__ */ new Set(),
21
- isRendering: true
22
- };
23
- }
24
- state.current.isRendering = true;
25
- useIsomorphicLayoutEffect(() => {
26
- const st = state.current;
27
- st.isRendering = false;
28
- const cur = themeManager == null ? void 0 : themeManager.keys.get(st.uuid);
29
- if (!cur || !areEqualSets(st.keys, cur)) {
30
- themeManager == null ? void 0 : themeManager.track(st.uuid, st.keys);
31
- }
32
- });
33
- return useMemo(() => {
34
- if (!theme) {
35
- if (process.env.NODE_ENV === "development") {
36
- console.warn("No theme", { themeName, theme, componentName, className });
37
- }
38
- return themes[getConfig().defaultTheme || "light"];
39
- }
40
- return new Proxy(theme, {
41
- has(_, key) {
42
- if (typeof key === "string") {
43
- if (key[0] === "$") {
44
- key = key.slice(1);
45
- }
46
- }
47
- return Reflect.has(theme, key);
48
- },
49
- get(_, key) {
50
- if (!name || key === "__proto__" || typeof key === "symbol") {
51
- if (key === GetThemeManager) {
52
- if (process.env.NODE_ENV === "development" && (props == null ? void 0 : props.debug)) {
53
- console.log(">>", { themeName, didChangeTheme, name, componentName }, themeManager);
54
- }
55
- if (!didChangeTheme)
56
- return null;
57
- return themeManager;
58
- }
59
- return Reflect.get(_, key);
60
- }
61
- if (typeof key !== "string" || key === "$typeof") {
62
- return Reflect.get(_, key);
63
- }
64
- if (key === "name") {
65
- return name;
66
- }
67
- if (key === "className") {
68
- return className;
69
- }
70
- if (!themeManager) {
71
- console.error("No themeManager");
72
- return;
73
- }
74
- if (key[0] === "$") {
75
- key = key.slice(1);
76
- }
77
- const val = themeManager.getValue(key);
78
- if (val) {
79
- if (state.current.isRendering) {
80
- state.current.keys.add(key);
81
- if (process.env.NODE_ENV === "development") {
82
- if ((props == null ? void 0 : props["debug"]) === "verbose") {
83
- console.log(" \xBB tracking theme key", key);
84
- }
85
- }
86
- }
87
- return val;
88
- }
89
- }
90
- });
91
- }, [name, theme, className, didChangeTheme]);
92
- };
93
- const GetThemeManager = Symbol("GetThemeManager");
94
- const getThemeManagerIfChanged = (theme) => {
95
- return theme == null ? void 0 : theme[GetThemeManager];
96
- };
97
- const useThemeName = (opts) => {
98
- const parent = useContext(ThemeManagerContext);
99
- const [name, setName] = useState((parent == null ? void 0 : parent.name) || "");
100
- useIsomorphicLayoutEffect(() => {
101
- if (!parent)
102
- return;
103
- return parent.onChangeTheme((next, manager) => {
104
- const name2 = (opts == null ? void 0 : opts.parent) ? manager.parentName || next : next;
105
- if (!name2)
106
- return;
107
- setName(name2);
108
- });
109
- }, [parent]);
110
- return name;
111
- };
112
- const useDefaultThemeName = () => {
113
- var _a;
114
- return (_a = useContext(ThemeContext)) == null ? void 0 : _a.defaultTheme;
115
- };
116
- const useChangeThemeEffect = (name, componentName, props, forceUpdateProp) => {
117
- const debug = props && props["debug"];
118
- const parentManager = useContext(ThemeManagerContext) || emptyManager;
119
- const { themes } = useContext(ThemeContext);
120
- const reset = (props == null ? void 0 : props.reset) || false;
121
- const getThemeProps = { name, componentName, themes, reset };
122
- const next = parentManager.getNextTheme(getThemeProps, debug);
123
- const forceUpdate = forceUpdateProp || useForceUpdate();
124
- const themeManager = useConstant(() => {
125
- if (!next)
126
- return null;
127
- return new ThemeManager(next.name, next.theme, parentManager, reset);
128
- });
129
- if (!isWeb || typeof document !== "undefined") {
130
- useLayoutEffect(() => {
131
- if (!themeManager)
132
- return;
133
- if (next == null ? void 0 : next.name) {
134
- themeManager.update(next);
135
- }
136
- return parentManager.onChangeTheme(() => {
137
- const next2 = parentManager.getNextTheme(getThemeProps, debug);
138
- if (!next2)
139
- return;
140
- if (themeManager.update(next2)) {
141
- forceUpdate();
142
- }
143
- });
144
- }, [themes, name, componentName, debug, next == null ? void 0 : next.name]);
145
- }
146
- const didChangeTheme = next && parentManager && next.name !== parentManager.fullName;
147
- return {
148
- ...parentManager && {
149
- name: parentManager.name,
150
- theme: parentManager.theme
151
- },
152
- ...next,
153
- didChangeTheme,
154
- themes,
155
- themeManager
156
- };
157
- };
158
- export {
159
- getThemeManagerIfChanged,
160
- useChangeThemeEffect,
161
- useDefaultThemeName,
162
- useTheme,
163
- useThemeName
164
- };
@@ -1,7 +0,0 @@
1
- import { useEffect } from "react";
2
- function useUnmountEffect(callback) {
3
- return useEffect(() => () => callback(), []);
4
- }
5
- export {
6
- useUnmountEffect
7
- };
package/dist/jsx/index.js DELETED
@@ -1,64 +0,0 @@
1
- export * from "./Tamagui";
2
- export * from "./createComponent";
3
- export * from "./createShorthands";
4
- export * from "./createTheme";
5
- export * from "./createTamagui";
6
- export * from "./createFont";
7
- export * from "./createTokens";
8
- export * from "./createVariable";
9
- export * from "./createVariables";
10
- export * from "./insertFont";
11
- export * from "./styled";
12
- export * from "./types";
13
- import { RNWTextProps, RNWViewProps } from "./types-rnw";
14
- import { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from "./conf";
15
- export * from "./constants/constants";
16
- export * from "./constants/platform";
17
- export * from "./constants/rnw";
18
- export * from "./helpers/calc";
19
- export * from "./helpers/createShallowUpdate";
20
- export * from "./helpers/getStackSize";
21
- export * from "./helpers/getVariantExtras";
22
- export * from "./helpers/getExpandedShorthands";
23
- export * from "./helpers/getSize";
24
- export * from "./helpers/getSplitStyles";
25
- export * from "./helpers/getStylesAtomic";
26
- export * from "./helpers/pseudos";
27
- export * from "./helpers/mergeProps";
28
- import { expandStyles } from "./helpers/generateAtomicStyles";
29
- export * from "./helpers/getTextSize";
30
- export * from "./helpers/isObj";
31
- export * from "./helpers/isTamaguiElement";
32
- export * from "./helpers/isTamaguiComponent";
33
- export * from "./helpers/matchMedia";
34
- export * from "./helpers/themeable";
35
- export * from "./helpers/withStaticProperties";
36
- export * from "./contexts/ButtonInsideButtonContext";
37
- export * from "./hooks/useConstant";
38
- export * from "./hooks/useId";
39
- export * from "./hooks/useIsMounted";
40
- export * from "./hooks/useIsTouchDevice";
41
- export * from "./hooks/useMedia";
42
- export * from "./hooks/usePressable";
43
- export * from "./hooks/useTheme";
44
- export * from "./hooks/useUnmountEffect";
45
- export * from "./views/Slot";
46
- export * from "./views/Stack";
47
- export * from "./views/Text";
48
- export * from "./views/TextAncestorContext";
49
- export * from "./views/Theme";
50
- export * from "./views/ThemeInverse";
51
- export * from "./views/ThemeProvider";
52
- export * from "./views/ThemeReset";
53
- export * from "@tamagui/use-force-update";
54
- export * from "@tamagui/helpers";
55
- export {
56
- RNWTextProps,
57
- RNWViewProps,
58
- expandStyles,
59
- getConfig,
60
- getHasConfigured,
61
- getThemes,
62
- getTokens,
63
- onConfiguredOnce
64
- };
@@ -1,64 +0,0 @@
1
- import { isWeb } from "@tamagui/core";
2
- import { setConfigFont } from "./conf";
3
- import { createFont } from "./createFont";
4
- import { createVariables } from "./createVariables";
5
- import { registerCSSVariable } from "./helpers/registerCSSVariable";
6
- function insertFont(name, fontIn) {
7
- const font = createFont(fontIn);
8
- const tokened = createVariables(font, name);
9
- const parsed = parseFont(tokened);
10
- if (isWeb && typeof document !== "undefined") {
11
- const css = registerFontVariables(parsed, true);
12
- const style = document.createElement("style");
13
- style.innerText = `:root {${css}}`;
14
- style.setAttribute("data-tamagui-font", name);
15
- document.head.appendChild(style);
16
- }
17
- setConfigFont(name, tokened, parsed);
18
- return parsed;
19
- }
20
- function parseFont(definition) {
21
- const parsed = {};
22
- for (const attrKey in definition) {
23
- const attr = definition[attrKey];
24
- if (attrKey === "family") {
25
- parsed[attrKey] = attr;
26
- continue;
27
- }
28
- parsed[attrKey] = {};
29
- for (const key in attr) {
30
- let val = attr[key];
31
- if (val.val[0] === "$") {
32
- val = val.val;
33
- }
34
- parsed[attrKey][`$${key}`] = val;
35
- }
36
- }
37
- return parsed;
38
- }
39
- function registerFontVariables(parsedFont, collect = false) {
40
- let vals = "";
41
- for (const fkey in parsedFont) {
42
- if (fkey === "family") {
43
- const val = registerCSSVariable(parsedFont[fkey]);
44
- if (collect)
45
- vals += val + ";";
46
- } else {
47
- for (const fskey in parsedFont[fkey]) {
48
- const fval = parsedFont[fkey][fskey];
49
- if (typeof fval === "string") {
50
- } else {
51
- const val = registerCSSVariable(parsedFont[fkey][fskey]);
52
- if (collect)
53
- vals += val + ";";
54
- }
55
- }
56
- }
57
- }
58
- return vals;
59
- }
60
- export {
61
- insertFont,
62
- parseFont,
63
- registerFontVariables
64
- };
@@ -1,18 +0,0 @@
1
- export * from "./styled";
2
- export * from "./createComponent";
3
- export * from "./createFont";
4
- export * from "./createTokens";
5
- export * from "./createTamagui";
6
- export * from "./createVariable";
7
- export * from "./constants/constants";
8
- export * from "./hooks/useMedia";
9
- export * from "./hooks/useTheme";
10
- export * from "./helpers/isObj";
11
- export * from "./helpers/getStylesAtomic";
12
- export * from "./helpers/generateAtomicStyles";
13
- export * from "./helpers/pseudos";
14
- export * from "./helpers/proxyThemeVariables";
15
- export * from "./helpers/getSplitStyles";
16
- export * from "@tamagui/helpers";
17
- export * from "./constants/rnw";
18
- export * from "./types";
@@ -1,49 +0,0 @@
1
- import { Image, Text, TextInput } from "react-native";
2
- import { createComponent } from "./createComponent";
3
- import { RNComponents } from "./helpers/RNComponents";
4
- function styled(Component, options, staticExtractionOptions) {
5
- if (process.env.NODE_ENV === "development") {
6
- if (Component["staticConfig"] && Component["staticConfig"].isExtractable) {
7
- console.warn(`Warning: Wrapping styled() around an extractable HOC component isn't allowed yet. Support for this is on the roadmap, see: https://github.com/tamagui/tamagui/issues/88.`);
8
- }
9
- }
10
- const staticConfigProps = (() => {
11
- var _a;
12
- if (options) {
13
- const { variants, name, defaultVariants, ...defaultProps } = options;
14
- if (defaultVariants) {
15
- Object.assign(defaultProps, defaultVariants);
16
- }
17
- const isReactNativeWeb = "staticConfig" in Component ? Component.staticConfig.isReactNativeWeb : RNComponents.has(Component);
18
- const reactNativeWebComponent = isReactNativeWeb ? ((_a = Component["staticConfig"]) == null ? void 0 : _a.reactNativeWebComponent) || Component : null;
19
- const isTamagui = !isReactNativeWeb && "staticConfig" in Component;
20
- const Comp = reactNativeWebComponent || Component;
21
- const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false));
22
- const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false));
23
- const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false));
24
- const conf = {
25
- ...staticExtractionOptions,
26
- ...!isTamagui && {
27
- Component: Comp
28
- },
29
- isTamagui,
30
- variants,
31
- defaultProps,
32
- defaultVariants,
33
- componentName: name,
34
- isReactNativeWeb,
35
- reactNativeWebComponent,
36
- isInput,
37
- isText,
38
- isImage
39
- };
40
- return conf;
41
- }
42
- return {};
43
- })();
44
- const component = createComponent(staticConfigProps, Component);
45
- return component;
46
- }
47
- export {
48
- styled
49
- };
File without changes
package/dist/jsx/types.js DELETED
File without changes
@@ -1,70 +0,0 @@
1
- import { composeRefs } from "@tamagui/compose-refs";
2
- import * as React from "react";
3
- import { isWeb } from "../constants/platform";
4
- const Slot = React.forwardRef((props, forwardedRef) => {
5
- const { children, ...slotProps } = props;
6
- return <SlotClone {...slotProps} ref={forwardedRef}>{children}</SlotClone>;
7
- });
8
- Slot.displayName = "Slot";
9
- const SlotClone = React.forwardRef((props, forwardedRef) => {
10
- const { children, ...slotProps } = props;
11
- if (React.isValidElement(children)) {
12
- const childProps = {
13
- ...mergeProps(children, slotProps),
14
- ref: composeRefs(forwardedRef, children.ref)
15
- };
16
- return React.cloneElement(children, childProps);
17
- }
18
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
19
- });
20
- SlotClone.displayName = "SlotClone";
21
- const Slottable = ({ children }) => {
22
- return <>{children}</>;
23
- };
24
- const pressMap = isWeb ? {
25
- onPress: "onClick",
26
- onPressOut: "onMouseUp",
27
- onPressIn: "onMouseDown"
28
- } : {};
29
- function mergeProps(child, slotProps) {
30
- const childProps = child.props;
31
- const overrideProps = { ...childProps };
32
- const isHTMLChild = typeof child.type === "string";
33
- if (isHTMLChild) {
34
- for (const key in pressMap) {
35
- if (key in slotProps) {
36
- slotProps[pressMap[key]] = slotProps[key];
37
- delete slotProps[key];
38
- }
39
- }
40
- }
41
- for (let propName in childProps) {
42
- const slotPropValue = slotProps[propName];
43
- const childPropValue = childProps[propName];
44
- if (isHTMLChild && pressMap[propName]) {
45
- propName = pressMap[propName];
46
- delete overrideProps[propName];
47
- }
48
- const isHandler = handleRegex.test(propName);
49
- if (isHandler) {
50
- overrideProps[propName] = mergeEvent(childPropValue, slotPropValue);
51
- } else if (propName === "style") {
52
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
53
- } else if (propName === "className") {
54
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
55
- }
56
- }
57
- return { ...slotProps, ...overrideProps };
58
- }
59
- const handleRegex = /^on[A-Z]/;
60
- function mergeEvent(a, b) {
61
- return (...args) => {
62
- a == null ? void 0 : a(...args);
63
- b == null ? void 0 : b(...args);
64
- };
65
- }
66
- export {
67
- Slot,
68
- Slottable,
69
- mergeEvent
70
- };
@@ -1,12 +0,0 @@
1
- import { stackDefaultStyles } from "../constants/constants";
2
- import { createComponent } from "../createComponent";
3
- const Stack = createComponent({
4
- componentName: "Stack",
5
- defaultProps: {
6
- ...stackDefaultStyles,
7
- flexDirection: "column"
8
- }
9
- });
10
- export {
11
- Stack
12
- };
@@ -1,57 +0,0 @@
1
- import { stylePropsTextOnly, validStyles } from "@tamagui/helpers";
2
- import { isWeb } from "../constants/platform";
3
- import { createComponent } from "../createComponent";
4
- const ellipseStyle = {
5
- maxWidth: "100%",
6
- overflow: "hidden",
7
- textOverflow: "ellipsis",
8
- whiteSpace: "nowrap"
9
- };
10
- const Text = createComponent({
11
- componentName: "Text",
12
- isText: true,
13
- defaultProps: {
14
- display: "flex",
15
- fontFamily: "System",
16
- ...isWeb && {
17
- display: "inline",
18
- boxSizing: "border-box",
19
- wordWrap: "break-word"
20
- }
21
- },
22
- variants: {
23
- numberOfLines: {
24
- 1: isWeb ? ellipseStyle : { numberOfLines: 1 },
25
- ":number": (numberOfLines) => isWeb ? numberOfLines >= 1 ? { WebkitLineClamp: numberOfLines } : null : { numberOfLines }
26
- },
27
- selectable: {
28
- true: {
29
- userSelect: "text",
30
- cursor: "text"
31
- },
32
- false: {
33
- userSelect: "none",
34
- cursor: "inherit"
35
- }
36
- },
37
- pressable: {
38
- true: {
39
- cursor: "pointer"
40
- }
41
- },
42
- ellipse: {
43
- true: isWeb ? ellipseStyle : {
44
- numberOfLines: 1,
45
- lineBreakMode: "clip"
46
- }
47
- }
48
- },
49
- deoptProps: new Set(isWeb ? [] : ["ellipse"]),
50
- validStyles: {
51
- ...validStyles,
52
- ...stylePropsTextOnly
53
- }
54
- });
55
- export {
56
- Text
57
- };
@@ -1,13 +0,0 @@
1
- var _a, _b;
2
- import { createContext } from "react";
3
- import { rnw } from "../constants/rnw";
4
- const FallbackNativeContext = createContext(false);
5
- const TextAncestorContext = (_b = (_a = rnw) == null ? void 0 : _a.TextAncestorContext) != null ? _b : FallbackNativeContext;
6
- const TextAncestorProvider = (props) => {
7
- return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>;
8
- };
9
- export {
10
- FallbackNativeContext,
11
- TextAncestorContext,
12
- TextAncestorProvider
13
- };
@@ -1,27 +0,0 @@
1
- import React, { memo, useMemo } from "react";
2
- import { isWeb } from "../constants/platform";
3
- import { wrapThemeManagerContext } from "../helpers/wrapThemeManagerContext";
4
- import { useChangeThemeEffect } from "../hooks/useTheme";
5
- React["createElement"];
6
- const Theme = memo(function Theme2(props) {
7
- var _a, _b;
8
- const { name, theme, themeManager, themes, className } = useChangeThemeEffect(props.name, props.componentName, props);
9
- const missingTheme = !themes || !name || !theme;
10
- const contents = useMemo(() => missingTheme ? null : wrapThemeManagerContext(props.children, themeManager), [props.children, themeManager]);
11
- if (missingTheme) {
12
- if (name && !theme && process.env.NODE_ENV === "development") {
13
- console.warn(`No theme found by name ${name}`);
14
- }
15
- return props.children;
16
- }
17
- if (isWeb) {
18
- return <span className={(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []).join(" ")} style={{
19
- display: "contents",
20
- color: (_b = (_a = themes[name]) == null ? void 0 : _a.color) == null ? void 0 : _b.toString()
21
- }}>{contents}</span>;
22
- }
23
- return contents;
24
- });
25
- export {
26
- Theme
27
- };
@@ -1,24 +0,0 @@
1
- import { useState } from "react";
2
- import { useIsomorphicLayoutEffect } from "../constants/platform";
3
- import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
4
- import { Theme } from "./Theme";
5
- let inversions = {
6
- light: "dark",
7
- dark: "light"
8
- };
9
- function setThemeInversions(next) {
10
- inversions = next;
11
- }
12
- const ThemeInverse = (props) => {
13
- const themeName = useThemeName();
14
- const defaultTheme = useDefaultThemeName();
15
- const [name, setName] = useState(null);
16
- useIsomorphicLayoutEffect(() => {
17
- setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
18
- }, [defaultTheme, themeName]);
19
- return <Theme name={name}>{props.children}</Theme>;
20
- };
21
- export {
22
- ThemeInverse,
23
- setThemeInversions
24
- };
@@ -1,34 +0,0 @@
1
- import React, { useLayoutEffect, useMemo } from "react";
2
- import { getHasConfigured } from "../conf";
3
- import { THEME_CLASSNAME_PREFIX } from "../constants/constants";
4
- import { ThemeContext } from "../ThemeContext";
5
- import { Theme } from "./Theme";
6
- React["createElement"];
7
- const ThemeProvider = (props) => {
8
- if (!getHasConfigured()) {
9
- throw new Error(`Missing configureThemes() call, add to your root file`);
10
- }
11
- if (typeof document !== "undefined") {
12
- useLayoutEffect(() => {
13
- if (props.disableRootThemeClass) {
14
- return;
15
- }
16
- const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`;
17
- const target = props.themeClassNameOnRoot ? document.documentElement : document.body;
18
- target.classList.add(cn);
19
- return () => {
20
- target.classList.remove(cn);
21
- };
22
- }, [props.defaultTheme, props.disableRootThemeClass]);
23
- }
24
- const themeContext = useMemo(() => {
25
- return {
26
- themes: props.themes,
27
- defaultTheme: props.defaultTheme
28
- };
29
- }, [props.themes]);
30
- return <ThemeContext.Provider value={themeContext}><Theme className={props.className} name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>{props.children}</Theme></ThemeContext.Provider>;
31
- };
32
- export {
33
- ThemeProvider
34
- };
@@ -1,32 +0,0 @@
1
- import React, { useContext, useLayoutEffect, useState } from "react";
2
- import { isWeb } from "../constants/platform";
3
- import { ThemeManagerContext } from "../ThemeManager";
4
- import { Theme } from "./Theme";
5
- React["createElement"];
6
- const ThemeReset = (props) => {
7
- const themeManager = useContext(ThemeManagerContext);
8
- const [name, setName] = useState(null);
9
- if (!isWeb || typeof document !== "undefined") {
10
- useLayoutEffect(() => {
11
- if (!themeManager)
12
- return;
13
- if (name !== themeManager.parentName) {
14
- setName(themeManager.parentName);
15
- }
16
- }, [themeManager == null ? void 0 : themeManager.parentName]);
17
- useLayoutEffect(() => {
18
- if (!themeManager)
19
- return;
20
- return themeManager.onChangeTheme(() => {
21
- setName(themeManager.parentName);
22
- });
23
- }, []);
24
- }
25
- if (!themeManager || !props.children) {
26
- return props.children || null;
27
- }
28
- return <Theme className="tui-theme-reset" reset name={name}>{props.children}</Theme>;
29
- };
30
- export {
31
- ThemeReset
32
- };
@@ -1,16 +0,0 @@
1
- export declare const pseudoDescriptors: {
2
- readonly hoverStyle: {
3
- readonly name: "hover";
4
- readonly priority: 1;
5
- };
6
- readonly pressStyle: {
7
- readonly name: "active";
8
- readonly priority: 2;
9
- };
10
- readonly focusStyle: {
11
- readonly name: "focus";
12
- readonly priority: 3;
13
- };
14
- };
15
- export declare type PseudoDescriptor = typeof pseudoDescriptors[keyof typeof pseudoDescriptors];
16
- //# sourceMappingURL=pseudos.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pseudos.d.ts","sourceRoot":"","sources":["../../src/helpers/pseudos.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;CAapB,CAAA;AAEV,oBAAY,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA"}