@tamagui/core 1.126.15 → 1.126.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hooks/useElementLayout.cjs +5 -1
- package/dist/cjs/hooks/useElementLayout.js +4 -1
- package/dist/cjs/hooks/useElementLayout.js.map +1 -1
- package/dist/cjs/hooks/useElementLayout.native.js +7 -2
- package/dist/cjs/hooks/useElementLayout.native.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +4 -1
- package/dist/esm/hooks/useElementLayout.js.map +1 -1
- package/dist/esm/hooks/useElementLayout.mjs +5 -1
- package/dist/esm/hooks/useElementLayout.mjs.map +1 -1
- package/dist/esm/hooks/useElementLayout.native.js +11 -2
- package/dist/esm/hooks/useElementLayout.native.js.map +1 -1
- package/dist/native.js +53 -52
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +42 -39
- package/dist/test.native.js.map +2 -2
- package/package.json +7 -7
- package/src/hooks/useElementLayout.tsx +16 -1
- package/types/hooks/useElementLayout.d.ts.map +1 -1
package/dist/test.native.js
CHANGED
|
@@ -1472,39 +1472,36 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1472
1472
|
}
|
|
1473
1473
|
var bailAfterEnv = process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES, bailAfter = bailAfterEnv ? +bailAfterEnv : 700, sheet = null;
|
|
1474
1474
|
function updateRules(identifier, rules) {
|
|
1475
|
-
|
|
1475
|
+
return identifier in allRules ? !1 : (allRules[identifier] = rules.join(" "), identifier.startsWith("_transform-") ? addTransform(identifier, rules[0]) : !0);
|
|
1476
1476
|
}
|
|
1477
1477
|
var nonce = "";
|
|
1478
1478
|
function setNonce2(_) {
|
|
1479
1479
|
nonce = _;
|
|
1480
1480
|
}
|
|
1481
1481
|
function insertStyleRules(rulesToInsert) {
|
|
1482
|
-
if (!
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
var
|
|
1490
|
-
|
|
1491
|
-
var rules = styleObject[import_helpers2.StyleObjectRules];
|
|
1492
|
-
allSelectors[identifier] = rules.join(`
|
|
1482
|
+
if (!sheet && import_constants2.isClient && document.head) {
|
|
1483
|
+
var styleTag = document.createElement("style");
|
|
1484
|
+
nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
|
|
1485
|
+
}
|
|
1486
|
+
if (sheet) for (var key in rulesToInsert) {
|
|
1487
|
+
var styleObject = rulesToInsert[key], identifier = styleObject[import_helpers2.StyleObjectIdentifier];
|
|
1488
|
+
if (shouldInsertStyleRules(identifier)) {
|
|
1489
|
+
var rules = styleObject[import_helpers2.StyleObjectRules];
|
|
1490
|
+
allSelectors[identifier] = rules.join(`
|
|
1493
1491
|
`), track(identifier), updateRules(identifier, rules);
|
|
1494
|
-
|
|
1492
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
1493
|
+
try {
|
|
1494
|
+
for (var _iterator = rules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
1495
|
+
var rule = _step.value;
|
|
1496
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
1497
|
+
}
|
|
1498
|
+
} catch (err) {
|
|
1499
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
1500
|
+
} finally {
|
|
1495
1501
|
try {
|
|
1496
|
-
|
|
1497
|
-
var rule = _step.value;
|
|
1498
|
-
sheet.insertRule(rule, sheet.cssRules.length);
|
|
1499
|
-
}
|
|
1500
|
-
} catch (err) {
|
|
1501
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
1502
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
1502
1503
|
} finally {
|
|
1503
|
-
|
|
1504
|
-
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
1505
|
-
} finally {
|
|
1506
|
-
if (_didIteratorError) throw _iteratorError;
|
|
1507
|
-
}
|
|
1504
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1508
1505
|
}
|
|
1509
1506
|
}
|
|
1510
1507
|
}
|
|
@@ -1512,7 +1509,7 @@ var require_insertStyleRule_native = __commonJS({
|
|
|
1512
1509
|
}
|
|
1513
1510
|
var minInsertAmt = process.env.TAMAGUI_INSERT_SELECTOR_TRIES ? +process.env.TAMAGUI_INSERT_SELECTOR_TRIES : 1;
|
|
1514
1511
|
function shouldInsertStyleRules(identifier) {
|
|
1515
|
-
if (process.env.
|
|
1512
|
+
if (process.env.IS_STATIC === "is_static") return !0;
|
|
1516
1513
|
var total = totalSelectorsInserted.get(identifier);
|
|
1517
1514
|
return total === void 0 || total < minInsertAmt;
|
|
1518
1515
|
}
|
|
@@ -5023,7 +5020,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
5023
5020
|
function isValidStyleKey(key, validStyles2, accept) {
|
|
5024
5021
|
return key in validStyles2 ? !0 : accept && key in accept;
|
|
5025
5022
|
}
|
|
5026
|
-
var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) {
|
|
5023
|
+
var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, startedUnhydrated, debug) {
|
|
5027
5024
|
var _loop = function(keyOg2) {
|
|
5028
5025
|
var keyInit = keyOg2, valInit = props[keyInit];
|
|
5029
5026
|
if (keyInit === "children") return viewProps[keyInit] = valInit, "continue";
|
|
@@ -5406,12 +5403,13 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
5406
5403
|
}
|
|
5407
5404
|
return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
|
|
5408
5405
|
}, useInsertEffectCompat = import_constants2.isWeb ? import_react3.default.useInsertionEffect || import_constants2.useIsomorphicLayoutEffect : function() {
|
|
5409
|
-
}, useSplitStyles = function(a, b, c, d, e, f, g, h, i, j) {
|
|
5406
|
+
}, useSplitStyles = function(a, b, c, d, e, f, g, h, i, j, k) {
|
|
5410
5407
|
conf = conf || (0, import_config.getConfig)();
|
|
5411
|
-
var res = getSplitStyles(a, b, c, d, e, f, g, h, i, j);
|
|
5408
|
+
var res = getSplitStyles(a, b, c, d, e, f, g, h, i, j, k);
|
|
5412
5409
|
return res;
|
|
5413
5410
|
};
|
|
5414
5411
|
function addStyleToInsertRules(rulesToInsert, styleObject) {
|
|
5412
|
+
var startedUnhydrated = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
5415
5413
|
if (0) var identifier;
|
|
5416
5414
|
}
|
|
5417
5415
|
var defaultColor = process.env.TAMAGUI_DEFAULT_COLOR || "rgba(0,0,0,0)", animatableDefaults = {
|
|
@@ -6520,9 +6518,9 @@ var require_wrapStyleTags_native = __commonJS({
|
|
|
6520
6518
|
}
|
|
6521
6519
|
});
|
|
6522
6520
|
module2.exports = __toCommonJS2(wrapStyleTags_exports);
|
|
6523
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_helpers2 = require_index_native3();
|
|
6521
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_helpers2 = require_index_native3(), import_constants2 = require_index_native2();
|
|
6524
6522
|
function wrapStyleTags(styles, content) {
|
|
6525
|
-
return
|
|
6523
|
+
return import_constants2.IS_REACT_19, content;
|
|
6526
6524
|
}
|
|
6527
6525
|
}
|
|
6528
6526
|
});
|
|
@@ -6640,7 +6638,7 @@ var require_useComponentState_native = __commonJS({
|
|
|
6640
6638
|
});
|
|
6641
6639
|
module2.exports = __toCommonJS2(useComponentState_exports);
|
|
6642
6640
|
var import_constants2 = require_index_native2(), import_use_did_finish_ssr = require_index_native6(), import_react3 = require("react"), import_defaultComponentState = require_defaultComponentState_native(), import_createShallowSetState = require_createShallowSetState_native(), import_isObj = require_isObj_native(), import_log = require_log_native(), useComponentState = function(props, param, staticConfig, config) {
|
|
6643
|
-
var { animationDriver } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
|
|
6641
|
+
var { animationDriver } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), [startedUnhydrated] = (0, import_react3.useState)(import_constants2.IS_REACT_19 ? !isHydrated : !1), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
|
|
6644
6642
|
stateRef.current || (stateRef.current = {});
|
|
6645
6643
|
var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = function() {
|
|
6646
6644
|
var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
|
|
@@ -6700,6 +6698,7 @@ var require_useComponentState_native = __commonJS({
|
|
|
6700
6698
|
};
|
|
6701
6699
|
}
|
|
6702
6700
|
return {
|
|
6701
|
+
startedUnhydrated,
|
|
6703
6702
|
curStateRef,
|
|
6704
6703
|
disabled,
|
|
6705
6704
|
groupName,
|
|
@@ -7011,7 +7010,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7011
7010
|
...styledContextProps
|
|
7012
7011
|
} : defaultProps, props = propsIn;
|
|
7013
7012
|
curDefaultProps && (props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn));
|
|
7014
|
-
var componentName2 = props.componentName || staticConfig.componentName, animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, { curStateRef, disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, setStateShallow, noClass, state, stateRef, supportsCSSVars, willBeAnimated, willBeAnimatedClient } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, config), hasTextAncestor = !!(import_constants2.isWeb && isText && componentContext.inText), isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = import_constants2.isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
|
|
7013
|
+
var componentName2 = props.componentName || staticConfig.componentName, animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, { curStateRef, disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, setStateShallow, noClass, state, stateRef, supportsCSSVars, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, config), hasTextAncestor = !!(import_constants2.isWeb && isText && componentContext.inText), isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = import_constants2.isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
|
|
7015
7014
|
animationDriver && isAnimated && (elementType = animationDriver[isText ? "Text" : "View"] || elementType);
|
|
7016
7015
|
var disableThemeProp = !1, disableTheme = disableThemeProp || isHOC;
|
|
7017
7016
|
props.themeShallow && (curStateRef.themeShallow = !0);
|
|
@@ -7042,7 +7041,7 @@ var require_createComponent_native = __commonJS({
|
|
|
7042
7041
|
isAnimated,
|
|
7043
7042
|
willBeAnimated,
|
|
7044
7043
|
styledContextProps
|
|
7045
|
-
}, themeName = (themeState == null ? void 0 : themeState.name) || "", splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, elementType, debugProp);
|
|
7044
|
+
}, themeName = (themeState == null ? void 0 : themeState.name) || "", splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, elementType, startedUnhydrated, debugProp);
|
|
7046
7045
|
if (props.group && props.untilMeasured === "hide" && !curStateRef.hasMeasured) {
|
|
7047
7046
|
var _splitStyles;
|
|
7048
7047
|
(_splitStyles = splitStyles).style || (_splitStyles.style = {}), splitStyles.style.opacity = 0;
|
|
@@ -7304,7 +7303,6 @@ var require_createComponent_native = __commonJS({
|
|
|
7304
7303
|
children: content
|
|
7305
7304
|
});
|
|
7306
7305
|
}
|
|
7307
|
-
var { rulesToInsert } = splitStyles;
|
|
7308
7306
|
if (0) {
|
|
7309
7307
|
var element1, title;
|
|
7310
7308
|
if (!import_constants2.isWeb)
|
|
@@ -8165,7 +8163,7 @@ var require_createTamagui_native = __commonJS({
|
|
|
8165
8163
|
var foundThemes;
|
|
8166
8164
|
if (configIn.themes) {
|
|
8167
8165
|
var noThemes = Object.keys(configIn.themes).length === 0;
|
|
8168
|
-
noThemes && (foundThemes = (0, import_insertStyleRule.scanAllSheets)(noThemes, tokensParsed)),
|
|
8166
|
+
noThemes && (foundThemes = (0, import_insertStyleRule.scanAllSheets)(noThemes, tokensParsed)), import_constants2.IS_REACT_19 && process.env.TAMAGUI_SKIP_THEME_OPTIMIZATION || noThemes && (0, import_insertStyleRule.listenForSheetChanges)();
|
|
8169
8167
|
}
|
|
8170
8168
|
var fontSizeTokens = null, fontsParsed;
|
|
8171
8169
|
if (configIn.fonts) {
|
|
@@ -9638,7 +9636,7 @@ var require_TamaguiProvider_native = __commonJS({
|
|
|
9638
9636
|
}), didRender = !0, function() {
|
|
9639
9637
|
didRender = !1;
|
|
9640
9638
|
};
|
|
9641
|
-
}, []),
|
|
9639
|
+
}, []), import_constants2.IS_REACT_19 || import_constants2.isClient && (0, import_constants2.useIsomorphicLayoutEffect)(function() {
|
|
9642
9640
|
if (config && !disableInjectCSS) {
|
|
9643
9641
|
var style = document.createElement("style");
|
|
9644
9642
|
return style.appendChild(document.createTextNode(config.getCSS())), document.head.appendChild(style), function() {
|
|
@@ -11793,15 +11791,20 @@ if (import_constants.isClient && rAF) {
|
|
|
11793
11791
|
}
|
|
11794
11792
|
}
|
|
11795
11793
|
}, layoutOnAnimationFrame = function() {
|
|
11796
|
-
|
|
11794
|
+
var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
|
|
11795
|
+
if (lastFrameAt = now, status !== "inactive") {
|
|
11796
|
+
var expectedFrameTime = 16.67, hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
|
|
11797
|
+
hasRecentSyncWork || Nodes.forEach(updateLayoutIfChanged);
|
|
11798
|
+
}
|
|
11799
|
+
rAF(layoutOnAnimationFrame);
|
|
11797
11800
|
};
|
|
11798
|
-
updateLayoutIfChanged2 = updateLayoutIfChanged, layoutOnAnimationFrame2 = layoutOnAnimationFrame, avoidUpdates = !0, queuedUpdates = /* @__PURE__ */ new Map(), (0, import_web.___onDidFinishClientRender)(function() {
|
|
11801
|
+
updateLayoutIfChanged2 = updateLayoutIfChanged, layoutOnAnimationFrame2 = layoutOnAnimationFrame, avoidUpdates = !0, queuedUpdates = /* @__PURE__ */ new Map(), lastFrameAt = Date.now(), numDroppedFramesUntilPause = 2, (0, import_web.___onDidFinishClientRender)(function() {
|
|
11799
11802
|
avoidUpdates = !1, queuedUpdates && (queuedUpdates.forEach(function(cb) {
|
|
11800
11803
|
return cb();
|
|
11801
11804
|
}), queuedUpdates.clear());
|
|
11802
11805
|
}), rAF(layoutOnAnimationFrame);
|
|
11803
11806
|
}
|
|
11804
|
-
var avoidUpdates, queuedUpdates, updateLayoutIfChanged2, layoutOnAnimationFrame2, getElementLayoutEvent = function(target) {
|
|
11807
|
+
var avoidUpdates, queuedUpdates, lastFrameAt, numDroppedFramesUntilPause, updateLayoutIfChanged2, layoutOnAnimationFrame2, getElementLayoutEvent = function(target) {
|
|
11805
11808
|
var res = null;
|
|
11806
11809
|
if (measureLayout(target, null, function(x, y, width, height, left, top) {
|
|
11807
11810
|
res = {
|