@tamagui/core 1.0.1-beta.137 → 1.0.1-beta.140
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 +8 -15
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +0 -3
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/assignNativePropsToWeb.js +1 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +2 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createTamaguiProvider.js +4 -0
- package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +11 -2
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getVariantExtras.js +6 -6
- package/dist/cjs/helpers/getVariantExtras.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +6 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js +18 -14
- package/dist/cjs/helpers/mergeProps.js.map +2 -2
- package/dist/cjs/hooks/useId.js +2 -32
- package/dist/cjs/hooks/useId.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +75 -92
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useSafeRef.js +60 -0
- package/dist/cjs/hooks/useSafeRef.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +2 -2
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +20 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +2 -2
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/esm/createComponent.js +8 -15
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +0 -3
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/assignNativePropsToWeb.js +1 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +2 -3
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createTamaguiProvider.js +5 -1
- package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +11 -2
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getVariantExtras.js +6 -6
- package/dist/esm/helpers/getVariantExtras.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +6 -1
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/mergeProps.js +18 -14
- package/dist/esm/helpers/mergeProps.js.map +2 -2
- package/dist/esm/hooks/useId.js +1 -28
- package/dist/esm/hooks/useId.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +74 -92
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useSafeRef.js +36 -0
- package/dist/esm/hooks/useSafeRef.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +2 -2
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +20 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/views/Slot.js +2 -2
- package/dist/esm/views/Slot.js.map +2 -2
- package/package.json +8 -8
- package/types/Tamagui.d.ts +0 -0
- package/types/addTheme.d.ts +0 -0
- package/types/conf.d.ts +0 -0
- package/types/constants/constants.d.ts +0 -0
- package/types/constants/platform.d.ts +2 -2
- package/types/contexts/ButtonInsideButtonContext.d.ts +0 -0
- package/types/contexts/FontLanguageContext.d.ts +0 -0
- package/types/contexts/TextAncestorContext.d.ts +0 -0
- package/types/contexts/ThemeContext.d.ts +0 -0
- package/types/createComponent.d.ts +0 -0
- package/types/createFont.d.ts +0 -0
- package/types/createShorthands.d.ts +0 -0
- package/types/createTamagui.d.ts +0 -0
- package/types/createTheme.d.ts +0 -0
- package/types/createTokens.d.ts +0 -0
- package/types/createVariable.d.ts +0 -0
- package/types/createVariables.d.ts +0 -0
- package/types/helpers/RNComponents.d.ts +0 -0
- package/types/helpers/ThemeManager.d.ts +0 -0
- package/types/helpers/areEqualSets.d.ts +0 -0
- package/types/helpers/assignNativePropsToWeb.d.ts +0 -0
- package/types/helpers/assignNativePropsToWeb.native.d.ts +0 -0
- package/types/helpers/calc.d.ts +0 -0
- package/types/helpers/createMediaStyle.d.ts +0 -0
- package/types/helpers/createPropMapper.d.ts +0 -0
- package/types/helpers/createShallowUpdate.d.ts +0 -0
- package/types/helpers/createTamaguiProvider.d.ts +0 -1
- package/types/helpers/cssHash.d.ts +0 -0
- package/types/helpers/expandStyle.d.ts +0 -0
- package/types/helpers/expandStyles.d.ts +0 -0
- package/types/helpers/extendStaticConfig.d.ts +0 -0
- package/types/helpers/fixNativeShadow.d.ts +0 -0
- package/types/helpers/getExpandedShorthands.d.ts +0 -0
- package/types/helpers/getFont.d.ts +0 -0
- package/types/helpers/getFontLanguage.d.ts +0 -0
- package/types/helpers/getSize.d.ts +0 -0
- package/types/helpers/getSplitStyles.d.ts +1 -0
- package/types/helpers/getStackSize.d.ts +0 -0
- package/types/helpers/getStylesAtomic.d.ts +0 -0
- package/types/helpers/getStylesAtomic.native.d.ts +0 -0
- package/types/helpers/getThemeCSSRules.d.ts +0 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +0 -0
- package/types/helpers/getVariantExtras.d.ts +0 -0
- package/types/helpers/insertStyleRule.d.ts +0 -0
- package/types/helpers/isObj.d.ts +0 -0
- package/types/helpers/isTamaguiComponent.d.ts +0 -0
- package/types/helpers/isTamaguiElement.d.ts +0 -0
- package/types/helpers/matchMedia.d.ts +0 -0
- package/types/helpers/matchMedia.native.d.ts +0 -0
- package/types/helpers/mergeProps.d.ts +3 -1
- package/types/helpers/mergeTransform.d.ts +0 -0
- package/types/helpers/normalizeColor.d.ts +0 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +0 -0
- package/types/helpers/proxyThemeVariables.d.ts +0 -0
- package/types/helpers/pseudoDescriptors.d.ts +0 -0
- package/types/helpers/registerCSSVariable.d.ts +0 -0
- package/types/helpers/startTransition.d.ts +0 -0
- package/types/helpers/themeable.d.ts +0 -0
- package/types/helpers/themes.d.ts +0 -0
- package/types/helpers/validate.d.ts +0 -0
- package/types/helpers/withStaticProperties.d.ts +0 -0
- package/types/hooks/getThemeUnwrapped.d.ts +0 -0
- package/types/hooks/useConstant.d.ts +0 -0
- package/types/hooks/useFeatures.d.ts +0 -0
- package/types/hooks/useId.d.ts +1 -8
- package/types/hooks/useIsMounted.d.ts +0 -0
- package/types/hooks/useIsSSR.d.ts +0 -0
- package/types/hooks/useIsTouchDevice.d.ts +0 -0
- package/types/hooks/useMedia.d.ts +2 -1
- package/types/hooks/usePressable.d.ts +0 -0
- package/types/hooks/useSafeRef.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +0 -0
- package/types/hooks/useUnmountEffect.d.ts +0 -0
- package/types/index.d.ts +2 -1
- package/types/insertFont.d.ts +0 -0
- package/types/static.d.ts +0 -0
- package/types/styled.d.ts +0 -0
- package/types/types-rnw.d.ts +0 -0
- package/types/types.d.ts +2 -2
- package/types/updateTheme.d.ts +0 -0
- package/types/vendor/Pressability.d.ts +0 -0
- package/types/vendor/Pressability.native.d.ts +0 -0
- package/types/views/FontLanguage.d.ts +0 -0
- package/types/views/FontLanguage.native.d.ts +0 -0
- package/types/views/FontLanguage.types.d.ts +0 -0
- package/types/views/Slot.d.ts +0 -0
- package/types/views/Stack.d.ts +0 -0
- package/types/views/Text.d.ts +0 -0
- package/types/views/Theme.d.ts +0 -0
- package/types/views/ThemeInverse.d.ts +0 -0
- package/types/views/ThemeProvider.d.ts +0 -0
- package/types/views/ThemeReset.d.ts +0 -0
- package/types/helpers/nativeGestureHandler.native.d.ts +0 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
3
2
|
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
4
3
|
import { matchMedia } from "../helpers/matchMedia";
|
|
5
|
-
import {
|
|
4
|
+
import { useSafeRef } from "./useSafeRef";
|
|
6
5
|
const mediaState = {};
|
|
7
6
|
const mediaQueryListeners = {};
|
|
8
7
|
function addMediaQueryListener(key, cb) {
|
|
9
8
|
mediaQueryListeners[key] = mediaQueryListeners[key] || /* @__PURE__ */ new Set();
|
|
10
9
|
mediaQueryListeners[key].add(cb);
|
|
10
|
+
return () => removeMediaQueryListener(key, cb);
|
|
11
11
|
}
|
|
12
12
|
function removeMediaQueryListener(key, cb) {
|
|
13
13
|
var _a;
|
|
@@ -18,114 +18,95 @@ const getMedia = () => {
|
|
|
18
18
|
return mediaState;
|
|
19
19
|
};
|
|
20
20
|
const dispose = /* @__PURE__ */ new Set();
|
|
21
|
+
let initialMediaState;
|
|
21
22
|
const configureMedia = ({
|
|
22
23
|
queries,
|
|
23
|
-
defaultActive =
|
|
24
|
+
defaultActive = {}
|
|
24
25
|
} = {}) => {
|
|
25
26
|
if (!queries)
|
|
26
27
|
return;
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (initialMediaState) {
|
|
29
|
+
if (process.env.NODE_ENV === "development") {
|
|
30
|
+
if (JSON.stringify(queries) === JSON.stringify(mediaQueryConfig)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
dispose.clear();
|
|
34
|
+
setupMediaListeners();
|
|
33
35
|
}
|
|
34
36
|
Object.assign(mediaQueryConfig, queries);
|
|
35
37
|
for (const key in queries) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
mediaState[key] = defaultActive[key] || false;
|
|
39
|
+
}
|
|
40
|
+
initialMediaState = { ...mediaState };
|
|
41
|
+
};
|
|
42
|
+
function unlisten() {
|
|
43
|
+
dispose.forEach((cb) => cb());
|
|
44
|
+
dispose.clear();
|
|
45
|
+
}
|
|
46
|
+
function setupMediaListeners() {
|
|
47
|
+
unlisten();
|
|
48
|
+
for (const key in mediaQueryConfig) {
|
|
49
|
+
let update2 = function() {
|
|
50
|
+
const next = !!getMatch().matches;
|
|
51
|
+
if (next === mediaState[key])
|
|
52
|
+
return;
|
|
53
|
+
mediaState[key] = next;
|
|
54
|
+
const listeners = mediaQueryListeners[key];
|
|
55
|
+
if (listeners == null ? void 0 : listeners.size) {
|
|
56
|
+
for (const cb of [...listeners]) {
|
|
57
|
+
cb();
|
|
49
58
|
}
|
|
50
|
-
};
|
|
51
|
-
var update = update2;
|
|
52
|
-
const getMatch = () => matchMedia(str);
|
|
53
|
-
const match = getMatch();
|
|
54
|
-
if (!match || typeof match.addListener !== "function") {
|
|
55
|
-
throw new Error("\u26A0\uFE0F No match (seeing this in RN sometimes)");
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
mediaState[propKey] = isDefaultActive;
|
|
60
|
+
};
|
|
61
|
+
var update = update2;
|
|
62
|
+
const str = mediaObjectToString(mediaQueryConfig[key]);
|
|
63
|
+
const getMatch = () => matchMedia(str);
|
|
64
|
+
const match = getMatch();
|
|
65
|
+
if (!match) {
|
|
66
|
+
throw new Error("\u26A0\uFE0F No match");
|
|
65
67
|
}
|
|
68
|
+
match.addListener(update2);
|
|
69
|
+
dispose.add(() => match.removeListener(update2));
|
|
70
|
+
update2();
|
|
66
71
|
}
|
|
67
|
-
}
|
|
72
|
+
}
|
|
73
|
+
function useMediaQueryListeners() {
|
|
74
|
+
useIsomorphicLayoutEffect(() => {
|
|
75
|
+
setupMediaListeners();
|
|
76
|
+
return unlisten;
|
|
77
|
+
}, []);
|
|
78
|
+
}
|
|
68
79
|
function useMedia() {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
const [state, setState] = useState(initialMediaState);
|
|
81
|
+
const keys = useSafeRef({});
|
|
82
|
+
function updateState() {
|
|
83
|
+
setState((prev) => {
|
|
84
|
+
for (const key in keys.current) {
|
|
85
|
+
if (prev[key] !== mediaState[key]) {
|
|
86
|
+
return { ...mediaState };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return prev;
|
|
90
|
+
});
|
|
78
91
|
}
|
|
79
|
-
state.current.isRendering = true;
|
|
80
92
|
useIsomorphicLayoutEffect(() => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (!(key in st.nextSelections)) {
|
|
85
|
-
removeMediaQueryListener(key, forceUpdate);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
for (const key in st.nextSelections) {
|
|
89
|
-
if (!(key in st.selections)) {
|
|
90
|
-
addMediaQueryListener(key, forceUpdate);
|
|
91
|
-
}
|
|
93
|
+
const listeners = [];
|
|
94
|
+
for (const key in keys.current) {
|
|
95
|
+
listeners.push(addMediaQueryListener(key, updateState));
|
|
92
96
|
}
|
|
93
|
-
|
|
94
|
-
useEffect(() => {
|
|
97
|
+
updateState();
|
|
95
98
|
return () => {
|
|
96
|
-
|
|
97
|
-
st.isUnmounted = true;
|
|
98
|
-
const allKeys = {
|
|
99
|
-
...st.selections,
|
|
100
|
-
...st.nextSelections
|
|
101
|
-
};
|
|
102
|
-
for (const key in allKeys) {
|
|
103
|
-
removeMediaQueryListener(key, forceUpdate);
|
|
104
|
-
}
|
|
99
|
+
listeners.forEach((cb) => cb());
|
|
105
100
|
};
|
|
106
|
-
}, []);
|
|
107
|
-
return useConstant(() => {
|
|
108
|
-
const st = state.current;
|
|
109
|
-
return new Proxy(mediaState, {
|
|
110
|
-
get(target, key) {
|
|
111
|
-
if (key[0] !== "$") {
|
|
112
|
-
key = `$${key}`;
|
|
113
|
-
}
|
|
114
|
-
if (!(key in mediaState)) {
|
|
115
|
-
return Reflect.get(target, key);
|
|
116
|
-
}
|
|
117
|
-
if (!st.isUnmounted) {
|
|
118
|
-
if (st.isRendering) {
|
|
119
|
-
st.nextSelections[key] = true;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (key in mediaState) {
|
|
123
|
-
return mediaState[key];
|
|
124
|
-
}
|
|
125
|
-
return Reflect.get(mediaState, key);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
101
|
});
|
|
102
|
+
return useMemo(() => new Proxy(state, {
|
|
103
|
+
get(_, key) {
|
|
104
|
+
if (!keys.current[key]) {
|
|
105
|
+
keys.current = { ...keys.current, [key]: true };
|
|
106
|
+
}
|
|
107
|
+
return Reflect.get(state, key);
|
|
108
|
+
}
|
|
109
|
+
}), [state, keys]);
|
|
129
110
|
}
|
|
130
111
|
function camelToHyphen(str) {
|
|
131
112
|
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).toLowerCase();
|
|
@@ -153,6 +134,7 @@ export {
|
|
|
153
134
|
mediaQueryConfig,
|
|
154
135
|
mediaState,
|
|
155
136
|
removeMediaQueryListener,
|
|
156
|
-
useMedia
|
|
137
|
+
useMedia,
|
|
138
|
+
useMediaQueryListeners
|
|
157
139
|
};
|
|
158
140
|
//# sourceMappingURL=useMedia.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useMedia.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA;
|
|
4
|
+
"sourcesContent": ["import { useMemo, useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { matchMedia } from '../helpers/matchMedia'\nimport {\n ConfigureMediaQueryOptions,\n MediaQueries,\n MediaQueryKey,\n MediaQueryObject,\n MediaQueryState,\n} from '../types'\nimport { useSafeRef } from './useSafeRef'\n\nexport const mediaState: MediaQueryState = {} as any\nconst mediaQueryListeners: { [key: string]: Set<Function> } = {}\n\nexport function addMediaQueryListener(key: MediaQueryKey, cb: any) {\n mediaQueryListeners[key] = mediaQueryListeners[key] || new Set()\n mediaQueryListeners[key].add(cb)\n return () => removeMediaQueryListener(key, cb)\n}\n\nexport function removeMediaQueryListener(key: MediaQueryKey, cb: any) {\n mediaQueryListeners[key]?.delete(cb)\n}\n\nexport const mediaQueryConfig: MediaQueries = {}\n\nexport const getMedia = () => {\n return mediaState\n}\n\nconst dispose = new Set<Function>()\n\n// for SSR capture it at time of startup\nlet initialMediaState: MediaQueryState | null\n\nexport const configureMedia = ({\n queries,\n defaultActive = {},\n}: ConfigureMediaQueryOptions = {}) => {\n if (!queries) return\n\n // support hot reload\n if (initialMediaState) {\n if (process.env.NODE_ENV === 'development') {\n if (JSON.stringify(queries) === JSON.stringify(mediaQueryConfig)) {\n // hmr avoid update\n return\n }\n }\n setupMediaListeners()\n }\n\n Object.assign(mediaQueryConfig, queries)\n // start in the initial state\n for (const key in queries) {\n mediaState[key] = defaultActive[key] || false\n }\n initialMediaState = { ...mediaState }\n}\n\nfunction unlisten() {\n dispose.forEach((cb) => cb())\n dispose.clear()\n}\n\nfunction setupMediaListeners() {\n // hmr, undo existing before re-binding\n unlisten()\n\n for (const key in mediaQueryConfig) {\n const str = mediaObjectToString(mediaQueryConfig[key])\n const getMatch = () => matchMedia(str)\n const match = getMatch()\n if (!match) {\n throw new Error('\u26A0\uFE0F No match')\n }\n // react native needs these deprecated apis for now\n match.addListener(update)\n dispose.add(() => match.removeListener(update))\n update()\n\n function update() {\n const next = !!getMatch().matches\n if (next === mediaState[key]) return\n mediaState[key] = next\n const listeners = mediaQueryListeners[key]\n if (listeners?.size) {\n for (const cb of [...listeners]) {\n cb()\n }\n }\n }\n }\n}\n\nexport function useMediaQueryListeners() {\n useIsomorphicLayoutEffect(() => {\n setupMediaListeners()\n return unlisten\n }, [])\n}\n\nexport function useMedia(): {\n [key in MediaQueryKey]: boolean\n} {\n const [state, setState] = useState(initialMediaState!)\n const keys = useSafeRef({} as Record<string, boolean>)\n\n function updateState() {\n setState((prev) => {\n for (const key in keys.current) {\n if (prev[key] !== mediaState[key]) {\n return { ...mediaState }\n }\n }\n return prev\n })\n }\n\n useIsomorphicLayoutEffect(() => {\n const listeners: Function[] = []\n for (const key in keys.current) {\n listeners.push(addMediaQueryListener(key, updateState))\n }\n updateState()\n return () => {\n listeners.forEach((cb) => cb())\n }\n })\n\n return useMemo(\n () =>\n new Proxy(state, {\n get(_, key: string) {\n if (!keys.current[key]) {\n keys.current = { ...keys.current, [key]: true }\n }\n return Reflect.get(state, key)\n },\n }),\n [state, keys]\n )\n}\n\nfunction camelToHyphen(str: string) {\n return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).toLowerCase()\n}\n\nexport function mediaObjectToString(query: string | MediaQueryObject) {\n if (typeof query === 'string') {\n return query\n }\n return Object.entries(query)\n .map(([feature, value]) => {\n feature = camelToHyphen(feature)\n if (typeof value === 'string') {\n return `(${feature}: ${value})`\n }\n if (typeof value === 'number' && /[height|width]$/.test(feature)) {\n value = `${value}px`\n }\n return `(${feature}: ${value})`\n })\n .join(' and ')\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AACA;AAQA;AAEO,MAAM,aAA8B,CAAC;AAC5C,MAAM,sBAAwD,CAAC;AAExD,+BAA+B,KAAoB,IAAS;AACjE,sBAAoB,OAAO,oBAAoB,QAAQ,oBAAI,IAAI;AAC/D,sBAAoB,KAAK,IAAI,EAAE;AAC/B,SAAO,MAAM,yBAAyB,KAAK,EAAE;AAC/C;AAEO,kCAAkC,KAAoB,IAAS;AAtBtE;AAuBE,4BAAoB,SAApB,mBA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AAY;AAAA,IACzB;AACA,QAAI,OAAO,UAAU,YAAY,kBAAkB,KAAK,OAAO,GAAG;AAChE,cAAQ,GAAG;AAAA,IACb;AACA,WAAO,IAAI,YAAY;AAAA,EACzB,CAAC,EACA,KAAK,OAAO;AACjB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
3
|
+
const useSafeRef = (initialValue) => {
|
|
4
|
+
const rawRef = useRef();
|
|
5
|
+
const raw = rawRef.current ?? (rawRef.current = {
|
|
6
|
+
isRendering: true,
|
|
7
|
+
comittedValue: initialValue,
|
|
8
|
+
currentValue: initialValue,
|
|
9
|
+
ref: {
|
|
10
|
+
get current() {
|
|
11
|
+
if (raw.isRendering) {
|
|
12
|
+
return raw.currentValue;
|
|
13
|
+
} else {
|
|
14
|
+
return raw.comittedValue;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
set current(v) {
|
|
18
|
+
if (!raw.isRendering) {
|
|
19
|
+
raw.comittedValue = v;
|
|
20
|
+
}
|
|
21
|
+
raw.currentValue = v;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
raw.isRendering = true;
|
|
26
|
+
Promise.resolve().then(() => raw.isRendering = false);
|
|
27
|
+
raw.currentValue = raw.comittedValue;
|
|
28
|
+
useIsomorphicLayoutEffect(() => {
|
|
29
|
+
raw.comittedValue = raw.currentValue;
|
|
30
|
+
});
|
|
31
|
+
return raw.ref;
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
useSafeRef
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useSafeRef.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useSafeRef.ts"],
|
|
4
|
+
"sourcesContent": ["import { useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\n\n// dai-shi \uD83D\uDE4F\n// https://dev.to/uhyo_/a-concurrent-mode-safe-version-of-useref-1325\n\ntype Raw<T> = {\n isRendering: boolean\n comittedValue: T\n currentValue: T\n ref: { current: T }\n}\n\nexport const useSafeRef = <T>(initialValue: T) => {\n const rawRef = useRef<Raw<T>>()\n\n const raw: Raw<T> =\n rawRef.current ??\n (rawRef.current = {\n isRendering: true,\n comittedValue: initialValue,\n currentValue: initialValue,\n ref: {\n get current() {\n if (raw.isRendering) {\n return raw.currentValue\n } else {\n return raw.comittedValue\n }\n },\n set current(v) {\n if (!raw.isRendering) {\n raw.comittedValue = v\n }\n raw.currentValue = v\n },\n },\n })\n\n raw.isRendering = true\n Promise.resolve().then(() => (raw.isRendering = false))\n raw.currentValue = raw.comittedValue\n\n useIsomorphicLayoutEffect(() => {\n raw.comittedValue = raw.currentValue\n })\n\n return raw.ref\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AAYO,MAAM,aAAa,CAAI,iBAAoB;AAChD,QAAM,SAAS,OAAe;AAE9B,QAAM,MACJ,OAAO,WACN,QAAO,UAAU;AAAA,IAChB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,cAAc;AAAA,IACd,KAAK;AAAA,MACH,IAAI,UAAU;AACZ,YAAI,IAAI,aAAa;AACnB,iBAAO,IAAI;AAAA,QACb,OAAO;AACL,iBAAO,IAAI;AAAA,QACb;AAAA,MACF;AAAA,MACA,IAAI,QAAQ,GAAG;AACb,YAAI,CAAC,IAAI,aAAa;AACpB,cAAI,gBAAgB;AAAA,QACtB;AACA,YAAI,eAAe;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAEF,MAAI,cAAc;AAClB,UAAQ,QAAQ,EAAE,KAAK,MAAO,IAAI,cAAc,KAAM;AACtD,MAAI,eAAe,IAAI;AAEvB,4BAA0B,MAAM;AAC9B,QAAI,gBAAgB,IAAI;AAAA,EAC1B,CAAC;AAED,SAAO,IAAI;AACb;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -38,9 +38,9 @@ const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
|
38
38
|
const debugProp = props && props["debug"];
|
|
39
39
|
if (!theme) {
|
|
40
40
|
if (process.env.NODE_ENV === "development") {
|
|
41
|
-
console.warn("No theme",
|
|
41
|
+
console.warn("No theme with name", themeName);
|
|
42
42
|
}
|
|
43
|
-
return themes[getConfig().defaultTheme ||
|
|
43
|
+
return themes[getConfig().defaultTheme || "light"];
|
|
44
44
|
}
|
|
45
45
|
return useMemo(() => {
|
|
46
46
|
return new Proxy(theme, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useTheme.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport {\n GetNextThemeProps,\n ThemeManager,\n ThemeManagerContext,\n emptyManager,\n} from '../helpers/ThemeManager'\nimport { ThemeName, ThemeObject } from '../types'\nimport { GetThemeUnwrapped } from './getThemeUnwrapped'\nimport { useConstant } from './useConstant'\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n console.log(' \uD83D\uDD39 useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n const debugProp = props && props['debug']\n\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('No theme',
|
|
5
|
-
"mappings": "AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAOA;AACA;AAkBO,MAAM,WAAW,CACtB,WACA,eACA,OACA,gBACgB;AAChB,QAAM,EAAE,MAAM,OAAO,QAAQ,cAAc,cAAc,qBACvD,WACA,eACA,OACA,WACF;AAEA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,gCAAO,WAAU,WAAW;
|
|
4
|
+
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../conf'\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport {\n GetNextThemeProps,\n ThemeManager,\n ThemeManagerContext,\n emptyManager,\n} from '../helpers/ThemeManager'\nimport { ThemeName, ThemeObject } from '../types'\nimport { GetThemeUnwrapped } from './getThemeUnwrapped'\nimport { useConstant } from './useConstant'\n\nexport type ThemeProps = {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeObject => {\n const { name, theme, themes, themeManager, className } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n // eslint-disable-next-line no-console\n console.log(' \uD83D\uDD39 useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n const debugProp = props && props['debug']\n\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('No theme with name', themeName)\n }\n return themes[getConfig().defaultTheme || 'light']\n }\n\n return useMemo(() => {\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string') {\n if (key[0] === '$') {\n key = key.slice(1)\n }\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (key === GetThemeUnwrapped) {\n return theme\n }\n if (key === GetThemeManager) {\n return themeManager\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!name || key === '__proto__' || typeof key === 'symbol' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n if (!themeManager) {\n console.error('No themeManager')\n return\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n if (state.current.isRendering && !state.current.keys.has(key)) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development' && debugProp === 'verbose') {\n console.log(' \uD83D\uDD38 tracking theme', key)\n }\n }\n return themeManager.getValue(key)\n },\n })\n }, [name, theme, componentName, className, debugProp])\n}\n\nconst GetThemeManager = Symbol()\n\nexport const getThemeManager = (theme: any): ThemeManager | undefined => {\n if (!theme) return\n return theme[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const activeThemeManagers = new Set<ThemeManager>()\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdateProp?: any\n) => {\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const { themes } = useContext(ThemeContext)!\n const reset = props?.reset || false\n const getThemeProps: GetNextThemeProps = { name, componentName, themes, reset }\n const next = parentManager.getNextTheme(getThemeProps, debug)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const forceUpdate = forceUpdateProp || useForceUpdate()\n\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!next) return null\n return new ThemeManager(next.name, next.theme, parentManager, reset)\n })\n\n // if not SSR\n if (!isWeb || typeof document !== 'undefined') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n if (!themeManager) return\n\n activeThemeManagers.add(themeManager)\n\n if (next?.name) {\n themeManager.update(next)\n }\n\n const disposeParentOnChange = parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme(getThemeProps, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n\n return () => {\n activeThemeManagers.delete(themeManager)\n disposeParentOnChange()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [themes, name, componentName, debug, next?.name])\n }\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n themes,\n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iBAAiB;AAAA,MACnB,MAAM,cAAc;AAAA,MACpB,OAAO,cAAc;AAAA,IACvB;AAAA,IACA,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -40,11 +40,21 @@ export * from "./hooks/useConstant";
|
|
|
40
40
|
export * from "./hooks/useId";
|
|
41
41
|
export * from "./hooks/useIsMounted";
|
|
42
42
|
export * from "./hooks/useIsTouchDevice";
|
|
43
|
-
|
|
43
|
+
import {
|
|
44
|
+
configureMedia,
|
|
45
|
+
getMedia,
|
|
46
|
+
mediaState,
|
|
47
|
+
useMedia,
|
|
48
|
+
mediaObjectToString,
|
|
49
|
+
addMediaQueryListener,
|
|
50
|
+
removeMediaQueryListener,
|
|
51
|
+
mediaQueryConfig
|
|
52
|
+
} from "./hooks/useMedia";
|
|
44
53
|
export * from "./hooks/usePressable";
|
|
45
54
|
export * from "./hooks/useTheme";
|
|
46
55
|
export * from "./hooks/useIsSSR";
|
|
47
56
|
export * from "./hooks/useUnmountEffect";
|
|
57
|
+
export * from "./hooks/useSafeRef";
|
|
48
58
|
export * from "./views/Slot";
|
|
49
59
|
export * from "./views/Stack";
|
|
50
60
|
export * from "./views/Text";
|
|
@@ -60,11 +70,19 @@ export * from "@tamagui/helpers";
|
|
|
60
70
|
export {
|
|
61
71
|
TextAncestorContext,
|
|
62
72
|
TextAncestorProvider,
|
|
73
|
+
addMediaQueryListener,
|
|
74
|
+
configureMedia,
|
|
63
75
|
createDOMProps,
|
|
64
76
|
getConfig,
|
|
65
77
|
getHasConfigured,
|
|
78
|
+
getMedia,
|
|
66
79
|
getThemes,
|
|
67
80
|
getTokens,
|
|
68
|
-
|
|
81
|
+
mediaObjectToString,
|
|
82
|
+
mediaQueryConfig,
|
|
83
|
+
mediaState,
|
|
84
|
+
onConfiguredOnce,
|
|
85
|
+
removeMediaQueryListener,
|
|
86
|
+
useMedia
|
|
69
87
|
};
|
|
70
88
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './addTheme'\nexport * from './updateTheme'\nexport * from './styled'\nexport * from './types'\n\n// for type portability\nexport type { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport { createDOMProps } from '@tamagui/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors'\nexport * from './helpers/mergeProps'\nexport * from './helpers/expandStyles'\nexport * from './helpers/getFont'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/startTransition'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport
|
|
5
|
-
"mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;",
|
|
4
|
+
"sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './addTheme'\nexport * from './updateTheme'\nexport * from './styled'\nexport * from './types'\n\n// for type portability\nexport type { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './conf'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport { createDOMProps } from '@tamagui/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors'\nexport * from './helpers/mergeProps'\nexport * from './helpers/expandStyles'\nexport * from './helpers/getFont'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/startTransition'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport {\n configureMedia,\n getMedia,\n mediaState,\n useMedia,\n mediaObjectToString,\n addMediaQueryListener,\n removeMediaQueryListener,\n mediaQueryConfig,\n} from './hooks/useMedia'\nexport * from './hooks/usePressable'\nexport * from './hooks/useTheme'\nexport * from './hooks/useIsSSR'\nexport * from './hooks/useUnmountEffect'\nexport * from './hooks/useSafeRef'\n\nexport * from './views/Slot'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport { TextAncestorProvider, TextAncestorContext } from './contexts/TextAncestorContext'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/ThemeReset'\nexport * from './views/FontLanguage'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/use-event'\nexport * from '@tamagui/helpers'\n"],
|
|
5
|
+
"mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/views/Slot.js
CHANGED
|
@@ -31,7 +31,7 @@ const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
|
31
31
|
const { children, ...slotProps } = props;
|
|
32
32
|
if (React.isValidElement(children)) {
|
|
33
33
|
const childProps = {
|
|
34
|
-
...
|
|
34
|
+
...mergeSlotProps(children, slotProps),
|
|
35
35
|
ref: composeRefs(forwardedRef, children.ref)
|
|
36
36
|
};
|
|
37
37
|
return React.cloneElement(children, childProps);
|
|
@@ -50,7 +50,7 @@ const pressMap = isWeb ? {
|
|
|
50
50
|
onPressOut: "onMouseUp",
|
|
51
51
|
onPressIn: "onMouseDown"
|
|
52
52
|
} : {};
|
|
53
|
-
function
|
|
53
|
+
function mergeSlotProps(child, slotProps) {
|
|
54
54
|
const childProps = child.props;
|
|
55
55
|
const overrideProps = { ...childProps };
|
|
56
56
|
const isHTMLChild = typeof child.type === "string";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Slot.tsx"],
|
|
4
|
-
"sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\nimport { isWeb } from '../constants/platform'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n const childrenArray = React.Children.toArray(children)\n const slottable = childrenArray.find(isSlottable)\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children as React.ReactNode\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null)\n return React.isValidElement(newElement)\n ? (newElement.props.children as React.ReactNode)\n : null\n } else {\n return child\n }\n })\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n )\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n const childProps = {\n ...
|
|
5
|
-
"mappings": "AAEA;AACA;AAEA;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;AACnC,QAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;AACrD,QAAM,YAAY,cAAc,KAAK,WAAW;AAEhD,MAAI,WAAW;AAEb,UAAM,aAAa,UAAU,MAAM;AAEnC,UAAM,cAAc,cAAc,IAAI,CAAC,UAAU;AAC/C,UAAI,UAAU,WAAW;AAGvB,YAAI,MAAM,SAAS,MAAM,UAAU,IAAI;AAAG,iBAAO,MAAM,SAAS,KAAK,IAAI;AACzE,eAAO,MAAM,eAAe,UAAU,IACjC,WAAW,MAAM,WAClB;AAAA,MACN,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,WACE,oCAAC;AAAA,MAAW,GAAG;AAAA,MAAW,KAAK;AAAA,OAC5B,MAAM,eAAe,UAAU,IAC5B,MAAM,aAAa,YAAY,QAAW,WAAW,IACrD,IACN;AAAA,EAEJ;AAEA,SACE,oCAAC;AAAA,IAAW,GAAG;AAAA,IAAW,KAAK;AAAA,KAC5B,QACH;AAEJ,CAAC;AAED,KAAK,cAAc;AAUnB,MAAM,YAAY,MAAM,WAAgC,CAAC,OAAO,iBAAiB;AAC/E,QAAM,EAAE,aAAa,cAAc;AAEnC,MAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,UAAM,aAAa;AAAA,MACjB,GAAG,
|
|
4
|
+
"sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\nimport { isWeb } from '../constants/platform'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n const childrenArray = React.Children.toArray(children)\n const slottable = childrenArray.find(isSlottable)\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children as React.ReactNode\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null)\n return React.isValidElement(newElement)\n ? (newElement.props.children as React.ReactNode)\n : null\n } else {\n return child\n }\n })\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n )\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n const childProps = {\n ...mergeSlotProps(children, slotProps),\n ref: composeRefs(forwardedRef, (children as any).ref),\n }\n return React.cloneElement(children, childProps)\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null\n})\n\nSlotClone.displayName = 'SlotClone'\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Slottable = ({ children }: { children: React.ReactNode }) => {\n return <>{children}</>\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>\n\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n return React.isValidElement(child) && child.type === Slottable\n}\n\nconst pressMap = isWeb\n ? {\n onPress: 'onClick',\n onPressOut: 'onMouseUp',\n onPressIn: 'onMouseDown',\n }\n : {}\n\nfunction mergeSlotProps(child: any, slotProps: AnyProps) {\n const childProps = child.props\n\n // all child props should override\n const overrideProps = { ...childProps }\n const isHTMLChild = typeof child.type === 'string'\n\n if (isHTMLChild) {\n for (const key in pressMap) {\n if (key in slotProps) {\n slotProps[pressMap[key]] = slotProps[key]\n delete slotProps[key]\n }\n }\n }\n\n for (let propName in childProps) {\n const slotPropValue = slotProps[propName]\n const childPropValue = childProps[propName]\n\n if (isHTMLChild && pressMap[propName]) {\n propName = pressMap[propName]\n delete overrideProps[propName]\n }\n\n const isHandler = handleRegex.test(propName)\n // if it's a handler, modify the override by composing the base handler\n if (isHandler) {\n overrideProps[propName] = mergeEvent(childPropValue, slotPropValue)\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue }\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ')\n }\n }\n\n return { ...slotProps, ...overrideProps }\n}\n\nconst handleRegex = /^on[A-Z]/\n\nexport function mergeEvent(a?: Function, b?: Function) {\n return (...args: unknown[]) => {\n a?.(...args)\n b?.(...args)\n }\n}\n"],
|
|
5
|
+
"mappings": "AAEA;AACA;AAEA;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;AACnC,QAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;AACrD,QAAM,YAAY,cAAc,KAAK,WAAW;AAEhD,MAAI,WAAW;AAEb,UAAM,aAAa,UAAU,MAAM;AAEnC,UAAM,cAAc,cAAc,IAAI,CAAC,UAAU;AAC/C,UAAI,UAAU,WAAW;AAGvB,YAAI,MAAM,SAAS,MAAM,UAAU,IAAI;AAAG,iBAAO,MAAM,SAAS,KAAK,IAAI;AACzE,eAAO,MAAM,eAAe,UAAU,IACjC,WAAW,MAAM,WAClB;AAAA,MACN,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,WACE,oCAAC;AAAA,MAAW,GAAG;AAAA,MAAW,KAAK;AAAA,OAC5B,MAAM,eAAe,UAAU,IAC5B,MAAM,aAAa,YAAY,QAAW,WAAW,IACrD,IACN;AAAA,EAEJ;AAEA,SACE,oCAAC;AAAA,IAAW,GAAG;AAAA,IAAW,KAAK;AAAA,KAC5B,QAC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YAAY,EAAE,GAAG,eAAe,GAAG,eAAe;AAAA,IAClE,WAAW,aAAa,aAAa;AACnC,oBAAc,YAAY,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,WAAW,GAAG,cAAc;AAC1C;AAEA,MAAM,cAAc;AAEb,oBAAoB,GAAc,GAAc;AACrD,SAAO,IAAI,SAAoB;AAC7B,2BAAI,GAAG;AACP,2BAAI,GAAG;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.140",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@expo/match-media": "^0.3.0",
|
|
25
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
26
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
27
|
-
"@tamagui/rnw": "^1.0.1-beta.
|
|
28
|
-
"@tamagui/use-debounce": "^1.0.1-beta.
|
|
29
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
30
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
25
|
+
"@tamagui/compose-refs": "^1.0.1-beta.140",
|
|
26
|
+
"@tamagui/helpers": "^1.0.1-beta.140",
|
|
27
|
+
"@tamagui/rnw": "^1.0.1-beta.140",
|
|
28
|
+
"@tamagui/use-debounce": "^1.0.1-beta.140",
|
|
29
|
+
"@tamagui/use-event": "^1.0.1-beta.140",
|
|
30
|
+
"@tamagui/use-force-update": "^1.0.1-beta.140",
|
|
31
31
|
"expo-screen-orientation": "^4.3.0",
|
|
32
32
|
"hyphenate-style-name": "^1.0.4",
|
|
33
33
|
"normalize-css-color": "^1.0.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-native-web": "*"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
41
|
+
"@tamagui/build": "^1.0.1-beta.140",
|
|
42
42
|
"@types/react": "^18.0.15",
|
|
43
43
|
"csstype": "^3.0.10",
|
|
44
44
|
"esbuild": "^0.14.49",
|
package/types/Tamagui.d.ts
CHANGED
|
File without changes
|
package/types/addTheme.d.ts
CHANGED
|
File without changes
|
package/types/conf.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
2
|
export declare const isAndroid: boolean;
|
|
3
3
|
export declare const isIOS: boolean;
|
|
4
4
|
export declare const isWeb: boolean;
|
|
5
5
|
export declare const isWindowDefined: boolean;
|
|
6
6
|
export declare const isSSR: boolean;
|
|
7
7
|
export declare const isClient: boolean;
|
|
8
|
-
export declare const useIsomorphicLayoutEffect: typeof
|
|
8
|
+
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
9
9
|
export declare const isChrome: boolean;
|
|
10
10
|
export declare const isWebTouchable: boolean;
|
|
11
11
|
export declare const isTouchable: boolean;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/types/createFont.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/types/createTamagui.d.ts
CHANGED
|
File without changes
|
package/types/createTheme.d.ts
CHANGED
|
File without changes
|
package/types/createTokens.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/types/helpers/calc.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|