@tamagui/core 1.88.12 → 1.88.14
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/LICENSE +21 -0
- package/dist/esm/createOptimizedView.mjs +2 -0
- package/dist/esm/getBaseViews.mjs +4 -0
- package/dist/esm/helpers/getBoundingClientRect.mjs +4 -0
- package/dist/esm/helpers/getRect.mjs +20 -0
- package/dist/esm/hooks/useElementLayout.mjs +87 -0
- package/dist/esm/hooks/usePlatformMethods.mjs +20 -0
- package/dist/esm/index.mjs +90 -0
- package/dist/esm/inject-styles.mjs +13 -0
- package/dist/esm/reactNativeTypes.mjs +0 -0
- package/dist/esm/vendor/Pressability.mjs +3 -0
- package/dist/native.js +29 -29
- package/dist/native.js.map +1 -1
- package/dist/test.native.js +25 -27
- package/dist/test.native.js.map +1 -1
- package/package.json +6 -6
- package/src/hooks/useElementLayout.tsx +1 -1
- package/src/hooks/usePlatformMethods.ts +1 -1
- package/types/hooks/useElementLayout.d.ts +1 -1
- package/types/hooks/useElementLayout.d.ts.map +1 -1
- package/types/hooks/usePlatformMethods.d.ts +1 -1
- package/types/hooks/usePlatformMethods.d.ts.map +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nate Wienert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getBoundingClientRect } from "./getBoundingClientRect.mjs";
|
|
2
|
+
const getRect = node => {
|
|
3
|
+
const rect = getBoundingClientRect(node);
|
|
4
|
+
if (!rect) return;
|
|
5
|
+
const {
|
|
6
|
+
x,
|
|
7
|
+
y,
|
|
8
|
+
top,
|
|
9
|
+
left
|
|
10
|
+
} = rect;
|
|
11
|
+
return {
|
|
12
|
+
x,
|
|
13
|
+
y,
|
|
14
|
+
width: node.offsetWidth,
|
|
15
|
+
height: node.offsetHeight,
|
|
16
|
+
top,
|
|
17
|
+
left
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { getRect };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { getBoundingClientRect } from "../helpers/getBoundingClientRect.mjs";
|
|
3
|
+
const LayoutHandlers = /* @__PURE__ */new WeakMap();
|
|
4
|
+
let resizeObserver = null;
|
|
5
|
+
typeof window < "u" && "ResizeObserver" in window && (resizeObserver = new ResizeObserver(entries => {
|
|
6
|
+
for (const {
|
|
7
|
+
target
|
|
8
|
+
} of entries) {
|
|
9
|
+
const onLayout = LayoutHandlers.get(target);
|
|
10
|
+
if (typeof onLayout != "function") return;
|
|
11
|
+
measureLayout(target, null, (x, y, width, height, left, top) => {
|
|
12
|
+
onLayout({
|
|
13
|
+
nativeEvent: {
|
|
14
|
+
layout: {
|
|
15
|
+
x,
|
|
16
|
+
y,
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
left,
|
|
20
|
+
top
|
|
21
|
+
},
|
|
22
|
+
target
|
|
23
|
+
},
|
|
24
|
+
timeStamp: Date.now()
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
const cache = /* @__PURE__ */new WeakMap(),
|
|
30
|
+
measureLayout = (node, relativeTo, callback) => {
|
|
31
|
+
const relativeNode = relativeTo || node?.parentNode;
|
|
32
|
+
if (relativeNode instanceof HTMLElement) {
|
|
33
|
+
const now = Date.now();
|
|
34
|
+
cache.set(node, now), Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]).then(([nodeDim, relativeNodeDim]) => {
|
|
35
|
+
if (relativeNodeDim && nodeDim && cache.get(node) === now) {
|
|
36
|
+
const {
|
|
37
|
+
x,
|
|
38
|
+
y,
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
left,
|
|
42
|
+
top
|
|
43
|
+
} = getRelativeDimensions(nodeDim, relativeNodeDim);
|
|
44
|
+
callback(x, y, width, height, left, top);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
getRelativeDimensions = (a, b) => {
|
|
50
|
+
const {
|
|
51
|
+
height,
|
|
52
|
+
left,
|
|
53
|
+
top,
|
|
54
|
+
width
|
|
55
|
+
} = a,
|
|
56
|
+
x = left - b.left,
|
|
57
|
+
y = top - b.top;
|
|
58
|
+
return {
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
width,
|
|
62
|
+
height,
|
|
63
|
+
left,
|
|
64
|
+
top
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
getBoundingClientRectAsync = element => new Promise(resolve => {
|
|
68
|
+
function fallbackToSync() {
|
|
69
|
+
resolve(getBoundingClientRect(element));
|
|
70
|
+
}
|
|
71
|
+
const tm = setTimeout(fallbackToSync, 10);
|
|
72
|
+
new IntersectionObserver((entries, ob) => {
|
|
73
|
+
clearTimeout(tm), ob.disconnect(), resolve(entries[0]?.boundingClientRect);
|
|
74
|
+
}, {
|
|
75
|
+
threshold: 1e-4
|
|
76
|
+
}).observe(element);
|
|
77
|
+
});
|
|
78
|
+
function useElementLayout(ref, onLayout) {
|
|
79
|
+
useIsomorphicLayoutEffect(() => {
|
|
80
|
+
if (!resizeObserver || !onLayout) return;
|
|
81
|
+
const node = ref.current;
|
|
82
|
+
if (node) return LayoutHandlers.set(node, onLayout), resizeObserver.observe(node), () => {
|
|
83
|
+
resizeObserver?.unobserve(node);
|
|
84
|
+
};
|
|
85
|
+
}, [ref, onLayout]);
|
|
86
|
+
}
|
|
87
|
+
export { measureLayout, useElementLayout };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { getRect } from "../helpers/getRect.mjs";
|
|
3
|
+
import { measureLayout } from "./useElementLayout.mjs";
|
|
4
|
+
function usePlatformMethods(hostRef) {
|
|
5
|
+
useIsomorphicLayoutEffect(() => {
|
|
6
|
+
const node = hostRef.current;
|
|
7
|
+
node && (node.measure ||= callback => measureLayout(node, null, callback), node.measureLayout ||= (relativeToNode, success) => measureLayout(node, relativeToNode, success), node.measureInWindow ||= callback => {
|
|
8
|
+
node && setTimeout(() => {
|
|
9
|
+
const {
|
|
10
|
+
height,
|
|
11
|
+
left,
|
|
12
|
+
top,
|
|
13
|
+
width
|
|
14
|
+
} = getRect(node);
|
|
15
|
+
callback(left, top, width, height);
|
|
16
|
+
}, 0);
|
|
17
|
+
});
|
|
18
|
+
}, [hostRef]);
|
|
19
|
+
}
|
|
20
|
+
export { usePlatformMethods };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useResponderEvents } from "@tamagui/react-native-use-responder-events";
|
|
2
|
+
import { Stack as WebStack, Text as WebText, View as WebView, setupHooks } from "@tamagui/web";
|
|
3
|
+
import "react";
|
|
4
|
+
import "./createOptimizedView.mjs";
|
|
5
|
+
import { getBaseViews } from "./getBaseViews.mjs";
|
|
6
|
+
import { useElementLayout } from "./hooks/useElementLayout.mjs";
|
|
7
|
+
import { usePlatformMethods } from "./hooks/usePlatformMethods.mjs";
|
|
8
|
+
import "./vendor/Pressability.mjs";
|
|
9
|
+
export * from "@tamagui/web";
|
|
10
|
+
export * from "./reactNativeTypes.mjs";
|
|
11
|
+
const baseViews = getBaseViews();
|
|
12
|
+
setupHooks({
|
|
13
|
+
getBaseViews,
|
|
14
|
+
usePropsTransform(elementType, propsIn, stateRef, willHydrate) {
|
|
15
|
+
{
|
|
16
|
+
const isDOM = typeof elementType == "string",
|
|
17
|
+
{
|
|
18
|
+
// event props
|
|
19
|
+
onMoveShouldSetResponder,
|
|
20
|
+
onMoveShouldSetResponderCapture,
|
|
21
|
+
onResponderEnd,
|
|
22
|
+
onResponderGrant,
|
|
23
|
+
onResponderMove,
|
|
24
|
+
onResponderReject,
|
|
25
|
+
onResponderRelease,
|
|
26
|
+
onResponderStart,
|
|
27
|
+
onResponderTerminate,
|
|
28
|
+
onResponderTerminationRequest,
|
|
29
|
+
onScrollShouldSetResponder,
|
|
30
|
+
onScrollShouldSetResponderCapture,
|
|
31
|
+
onSelectionChangeShouldSetResponder,
|
|
32
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
33
|
+
onStartShouldSetResponder,
|
|
34
|
+
onStartShouldSetResponderCapture,
|
|
35
|
+
// android
|
|
36
|
+
collapsable,
|
|
37
|
+
focusable,
|
|
38
|
+
// deprecated,
|
|
39
|
+
accessible,
|
|
40
|
+
accessibilityDisabled,
|
|
41
|
+
onLayout,
|
|
42
|
+
hrefAttrs,
|
|
43
|
+
...plainDOMProps
|
|
44
|
+
} = propsIn;
|
|
45
|
+
if (willHydrate || isDOM) {
|
|
46
|
+
const hostRef = {
|
|
47
|
+
get current() {
|
|
48
|
+
return stateRef.current.host;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
usePlatformMethods(hostRef), useElementLayout(hostRef, isDOM ? onLayout : void 0), useResponderEvents(hostRef, isDOM ? {
|
|
52
|
+
onMoveShouldSetResponder,
|
|
53
|
+
onMoveShouldSetResponderCapture,
|
|
54
|
+
onResponderEnd,
|
|
55
|
+
onResponderGrant,
|
|
56
|
+
onResponderMove,
|
|
57
|
+
onResponderReject,
|
|
58
|
+
onResponderRelease,
|
|
59
|
+
onResponderStart,
|
|
60
|
+
onResponderTerminate,
|
|
61
|
+
onResponderTerminationRequest,
|
|
62
|
+
onScrollShouldSetResponder,
|
|
63
|
+
onScrollShouldSetResponderCapture,
|
|
64
|
+
onSelectionChangeShouldSetResponder,
|
|
65
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
66
|
+
onStartShouldSetResponder,
|
|
67
|
+
onStartShouldSetResponderCapture
|
|
68
|
+
} : void 0);
|
|
69
|
+
}
|
|
70
|
+
if (isDOM) {
|
|
71
|
+
if (plainDOMProps.href && hrefAttrs) {
|
|
72
|
+
const {
|
|
73
|
+
download,
|
|
74
|
+
rel,
|
|
75
|
+
target
|
|
76
|
+
} = hrefAttrs;
|
|
77
|
+
download != null && (plainDOMProps.download = download), rel && (plainDOMProps.rel = rel), typeof target == "string" && (plainDOMProps.target = target.charAt(0) !== "_" ? `_${target}` : target);
|
|
78
|
+
}
|
|
79
|
+
return plainDOMProps;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
useEvents(viewProps, events, {
|
|
84
|
+
pseudos
|
|
85
|
+
}, setStateShallow, staticConfig) {}
|
|
86
|
+
});
|
|
87
|
+
const View = WebView,
|
|
88
|
+
Stack = WebStack,
|
|
89
|
+
Text = WebText;
|
|
90
|
+
export { Stack, Text, View };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const stylesheets = {},
|
|
2
|
+
injectStyles = ({
|
|
3
|
+
filePath,
|
|
4
|
+
css
|
|
5
|
+
}) => {
|
|
6
|
+
let stylesheet = stylesheets[filePath];
|
|
7
|
+
if (!stylesheet) {
|
|
8
|
+
const styleEl = document.createElement("style");
|
|
9
|
+
styleEl.setAttribute("data-file", filePath), styleEl.setAttribute("type", "text/css"), stylesheet = stylesheets[filePath] = styleEl, document.head.appendChild(styleEl);
|
|
10
|
+
}
|
|
11
|
+
stylesheet.innerHTML = css;
|
|
12
|
+
};
|
|
13
|
+
export { injectStyles };
|
|
File without changes
|
package/dist/native.js
CHANGED
|
@@ -1461,7 +1461,7 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1461
1461
|
continue;
|
|
1462
1462
|
}
|
|
1463
1463
|
let total = track(identifier, remove);
|
|
1464
|
-
remove ? total === 0 && delete allSelectors[identifier] : identifier in allSelectors || (!identifier.startsWith("_transform") || addTransform(identifier, cssRule.cssText, cssRule)) && (allSelectors[identifier] = cssRule.cssText);
|
|
1464
|
+
remove ? total === 0 && delete allSelectors[identifier] : identifier in allSelectors || (!identifier.startsWith("_transform-") || addTransform(identifier, cssRule.cssText, cssRule)) && (allSelectors[identifier] = cssRule.cssText);
|
|
1465
1465
|
}
|
|
1466
1466
|
return scannedCache.set(sheet2, cacheKey), dedupedThemes;
|
|
1467
1467
|
}
|
|
@@ -1503,7 +1503,7 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1503
1503
|
};
|
|
1504
1504
|
for (let selector of selectors) {
|
|
1505
1505
|
let matches = selector.match(/(.t_(light|dark))?[\s]?(.t_([a-z0-9_]+))[\s]*$/i) || [], [_0, _1, scheme, _2, name] = matches, themeName = name && scheme && scheme !== name ? `${scheme}_${name}` : name || scheme;
|
|
1506
|
-
dedupedEntry.names.includes(themeName) || themeName === "light_dark" || dedupedEntry.names.push(themeName);
|
|
1506
|
+
!themeName || dedupedEntry.names.includes(themeName) || themeName === "light_dark" || themeName === "dark_light" || dedupedEntry.names.push(themeName);
|
|
1507
1507
|
}
|
|
1508
1508
|
return dedupedEntry;
|
|
1509
1509
|
}
|
|
@@ -1529,7 +1529,7 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1529
1529
|
return selector.includes(":") ? res.replace(/:[a-z]+$/, "") : res;
|
|
1530
1530
|
}, sheet = import_constants.isClient ? document.head.appendChild(document.createElement("style")).sheet : null;
|
|
1531
1531
|
function updateRules(identifier, rules) {
|
|
1532
|
-
return identifier in allRules ? !1 : (allRules[identifier] = rules.join(" "), identifier.startsWith("_transform") ? addTransform(identifier, rules[0]) : !0);
|
|
1532
|
+
return identifier in allRules ? !1 : (allRules[identifier] = rules.join(" "), identifier.startsWith("_transform-") ? addTransform(identifier, rules[0]) : !0);
|
|
1533
1533
|
}
|
|
1534
1534
|
function insertStyleRules(rulesToInsert) {
|
|
1535
1535
|
if (!(!rulesToInsert.length || !sheet)) {
|
|
@@ -3976,7 +3976,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
3976
3976
|
useSplitStyles: () => useSplitStyles
|
|
3977
3977
|
});
|
|
3978
3978
|
module2.exports = __toCommonJS2(getSplitStyles_exports);
|
|
3979
|
-
var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
|
|
3979
|
+
var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), import_isObj = require_isObj_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
|
|
3980
3980
|
function isValidStyleKey(key, staticConfig) {
|
|
3981
3981
|
return (staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles))[key] || staticConfig.acceptTokens && staticConfig.acceptTokens[key];
|
|
3982
3982
|
}
|
|
@@ -4055,8 +4055,8 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
4055
4055
|
viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
|
|
4056
4056
|
continue;
|
|
4057
4057
|
}
|
|
4058
|
-
if (keyInit
|
|
4059
|
-
|
|
4058
|
+
if (keyInit.startsWith("_style") && (0, import_isObj.isObj)(valInit)) {
|
|
4059
|
+
Object.assign(styleState.style, valInit);
|
|
4060
4060
|
continue;
|
|
4061
4061
|
}
|
|
4062
4062
|
if (0)
|
|
@@ -4077,7 +4077,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
4077
4077
|
continue;
|
|
4078
4078
|
let shouldPassProp = !isStyleProp || // is in parent variants
|
|
4079
4079
|
isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = (_a = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _a[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
4080
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(
|
|
4080
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupEnd(), console.groupEnd(), console.groupCollapsed(
|
|
4081
4081
|
` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`
|
|
4082
4082
|
), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
|
|
4083
4083
|
variants,
|
|
@@ -4301,7 +4301,13 @@ current`, {
|
|
|
4301
4301
|
}
|
|
4302
4302
|
}
|
|
4303
4303
|
}
|
|
4304
|
-
if (process.env.NODE_ENV === "development" && console.groupEnd(), props.style
|
|
4304
|
+
if (process.env.NODE_ENV === "development" && console.groupEnd(), props.style)
|
|
4305
|
+
if (isHOC)
|
|
4306
|
+
viewProps.style = props.style;
|
|
4307
|
+
else
|
|
4308
|
+
for (let style2 of [].concat(props.style))
|
|
4309
|
+
style2 && (style2.$$css ? Object.assign(styleState.classNames, style2) : Object.assign(styleState.style, style2));
|
|
4310
|
+
if (styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
|
|
4305
4311
|
mergeTransform(style, key, val, !0);
|
|
4306
4312
|
}), parentSplitStyles && !shouldDoClasses))
|
|
4307
4313
|
for (let key in parentSplitStyles.style)
|
|
@@ -4371,19 +4377,7 @@ current`, {
|
|
|
4371
4377
|
!avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
|
|
4372
4378
|
}
|
|
4373
4379
|
return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
|
|
4374
|
-
}
|
|
4375
|
-
function mergeStylePropIntoStyle(styleState, cur) {
|
|
4376
|
-
if (!cur)
|
|
4377
|
-
return;
|
|
4378
|
-
let styles = Array.isArray(cur) ? cur : [cur];
|
|
4379
|
-
for (let style of styles) {
|
|
4380
|
-
if (!style)
|
|
4381
|
-
continue;
|
|
4382
|
-
let isRNW = style.$$css;
|
|
4383
|
-
Object.assign(isRNW ? styleState.classNames : styleState.style, style);
|
|
4384
|
-
}
|
|
4385
|
-
}
|
|
4386
|
-
var useInsertEffectCompat = import_constants.isWeb ? import_react3.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
|
|
4380
|
+
}, useInsertEffectCompat = import_constants.isWeb ? import_react3.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
|
|
4387
4381
|
}, useSplitStyles = (...args) => {
|
|
4388
4382
|
let res = getSplitStyles(...args);
|
|
4389
4383
|
return useInsertEffectCompat(() => {
|
|
@@ -4862,7 +4856,11 @@ var require_createComponent_native = __commonJS({
|
|
|
4862
4856
|
let exv = exitVariant ?? enterExitVariant, env = enterVariant ?? enterExitVariant;
|
|
4863
4857
|
state.unmounted && env && staticConfig.variants[env] ? (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence ENTER "${env}"`), props[env] = !0) : isExiting && exv && (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence EXIT "${exv}"`), props[exv] = exitVariant !== enterExitVariant);
|
|
4864
4858
|
}
|
|
4865
|
-
let shouldAvoidClasses = !!(!import_constants.isWeb || isAnimated && !supportsCSSVars || !staticConfig.acceptsClassName ||
|
|
4859
|
+
let shouldAvoidClasses = !!(!import_constants.isWeb || isAnimated && !supportsCSSVars || !staticConfig.acceptsClassName || // on server for SSR and animation compat added the && isHydrated but perhaps we want
|
|
4860
|
+
// disableClassName="until-hydrated" to be more straightforward
|
|
4861
|
+
// see issue if not, Button sets disableClassName to true <Button animation="" /> with
|
|
4862
|
+
// the react-native driver errors because it tries to animate var(--color) to rbga(..)
|
|
4863
|
+
propsIn.disableClassName && isHydrated), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, groupName = props.group, groupClassName = groupName ? `t_group_${props.group}` : "";
|
|
4866
4864
|
if (groupName && !curState.group) {
|
|
4867
4865
|
let listeners = /* @__PURE__ */ new Set();
|
|
4868
4866
|
curState.group = {
|
|
@@ -4910,7 +4908,9 @@ var require_createComponent_native = __commonJS({
|
|
|
4910
4908
|
if (console.info(
|
|
4911
4909
|
`%c ${banner} (hydrated: ${isHydrated}) (unmounted: ${state.unmounted})`,
|
|
4912
4910
|
"background: green; color: white;"
|
|
4913
|
-
),
|
|
4911
|
+
), import_constants.isServer)
|
|
4912
|
+
(0, import_log.log)({ noClassNames, isAnimated, shouldAvoidClasses, isWeb: import_constants.isWeb, supportsCSSVars });
|
|
4913
|
+
else {
|
|
4914
4914
|
console.groupEnd();
|
|
4915
4915
|
let stateLog = `${`${state.press || state.pressIn ? " PRESS " : ""}`}${state.hover ? " HOVER " : ""}${state.focus ? " FOCUS" : " "}`, ch = propsIn.children, childLog = typeof ch == "string" ? ch.length > 4 ? ch.slice(0, 4) + "..." : ch : "";
|
|
4916
4916
|
childLog.length && (childLog = `(children: ${childLog})`), console.groupCollapsed(`${childLog}${stateLog}Props:`), (0, import_log.log)("props in:", propsIn), (0, import_log.log)("final props:", props), (0, import_log.log)({ state, staticConfig, elementType, themeStateProps }), (0, import_log.log)({ contextProps: styledContextProps, overriddenContextProps }), (0, import_log.log)({ presence, isAnimated, isHOC, hasAnimationProp, useAnimations }), console.groupEnd();
|
|
@@ -5078,7 +5078,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
5078
5078
|
fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
|
|
5079
5079
|
let fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", style = animationStyles || splitStyles.style, className;
|
|
5080
5080
|
asChild === "except-style" || asChild === "except-style-web" || (viewProps.style = style);
|
|
5081
|
-
let runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = runtimeHoverStyle || onHoverIn || onHoverOut, isHoverable = import_constants.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !!(attachFocus || attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
5081
|
+
let runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = runtimeHoverStyle || onHoverIn || onHoverOut, isHoverable = import_constants.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !!(attachFocus || attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
5082
5082
|
process.env.NODE_ENV === "development" && time && time`events-setup`;
|
|
5083
5083
|
let events = shouldAttach && !isDisabled && !props.asChild ? {
|
|
5084
5084
|
onPressOut: attachPress ? (e) => {
|
|
@@ -6564,19 +6564,19 @@ var require_TamaguiProvider_native = __commonJS({
|
|
|
6564
6564
|
...themePropsProvider
|
|
6565
6565
|
}) {
|
|
6566
6566
|
return (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && React.useLayoutEffect(() => {
|
|
6567
|
-
if (config.disableSSR || document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), !disableInjectCSS) {
|
|
6567
|
+
if (config && (config.disableSSR || document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), !disableInjectCSS)) {
|
|
6568
6568
|
let style = document.createElement("style");
|
|
6569
6569
|
return style.appendChild(document.createTextNode(config.getCSS())), document.head.appendChild(style), () => {
|
|
6570
6570
|
document.head.removeChild(style);
|
|
6571
6571
|
};
|
|
6572
6572
|
}
|
|
6573
|
-
}, [config, disableInjectCSS]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { animationDriver: config.animations, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
6573
|
+
}, [config, disableInjectCSS]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { animationDriver: config == null ? void 0 : config.animations, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
6574
6574
|
import_ThemeProvider.ThemeProvider,
|
|
6575
6575
|
{
|
|
6576
|
-
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
6577
|
-
disableRootThemeClass: config.disableRootThemeClass,
|
|
6576
|
+
themeClassNameOnRoot: config == null ? void 0 : config.themeClassNameOnRoot,
|
|
6577
|
+
disableRootThemeClass: config == null ? void 0 : config.disableRootThemeClass,
|
|
6578
6578
|
...themePropsProvider,
|
|
6579
|
-
defaultTheme: themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0],
|
|
6579
|
+
defaultTheme: themePropsProvider.defaultTheme ?? (config ? Object.keys(config.themes)[0] : ""),
|
|
6580
6580
|
children
|
|
6581
6581
|
}
|
|
6582
6582
|
) });
|