tamagui 1.129.11-1751338700427 → 1.129.12-1751358691172

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.
@@ -2542,6 +2542,9 @@ var require_insertStyleRule_native = __commonJS({
2542
2542
  shouldInsertStyleRules: function() {
2543
2543
  return shouldInsertStyleRules;
2544
2544
  },
2545
+ stopAccumulatingRules: function() {
2546
+ return stopAccumulatingRules;
2547
+ },
2545
2548
  updateRules: function() {
2546
2549
  return updateRules;
2547
2550
  }
@@ -2612,52 +2615,61 @@ var require_insertStyleRule_native = __commonJS({
2612
2615
  }
2613
2616
  }
2614
2617
  }
2615
- function track(id) {
2618
+ function trackInsertedStyle(id) {
2616
2619
  var remove = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, next = (totalSelectorsInserted.get(id) || 0) + (remove ? -1 : 1);
2617
2620
  return totalSelectorsInserted.set(id, next), next;
2618
2621
  }
2619
- var bailAfterEnv = process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES, bailAfter = bailAfterEnv ? +bailAfterEnv : 700, sheet = null;
2622
+ var bailAfterEnv = process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES, bailAfter = bailAfterEnv ? +bailAfterEnv : 700, sheet = null, trackAllRules = !0;
2623
+ function stopAccumulatingRules() {
2624
+ trackAllRules = !0;
2625
+ }
2620
2626
  function updateRules(identifier, rules) {
2621
- return identifier in allRules ? !1 : (allRules[identifier] = rules.join(" "), identifier.startsWith("_transform-") ? addTransform(identifier, rules[0]) : !0);
2627
+ return trackAllRules && (allRules[identifier] = rules.join(" ")), identifier.startsWith("_transform-") ? addTransform(identifier, rules[0]) : !0;
2622
2628
  }
2623
2629
  var nonce = "";
2624
2630
  function setNonce2(_) {
2625
2631
  nonce = _;
2626
2632
  }
2627
2633
  function insertStyleRules2(rulesToInsert) {
2628
- if (!sheet && import_constants4.isClient && document.head) {
2629
- var styleTag = document.createElement("style");
2630
- nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
2631
- }
2632
- if (sheet) for (var key in rulesToInsert) {
2633
- var styleObject = rulesToInsert[key], identifier = styleObject[import_helpers.StyleObjectIdentifier];
2634
- if (shouldInsertStyleRules(identifier)) {
2635
- var rules = styleObject[import_helpers.StyleObjectRules];
2636
- allSelectors[identifier] = rules.join(`
2637
- `), track(identifier), updateRules(identifier, rules);
2638
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
2639
- try {
2640
- for (var _iterator = rules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
2641
- var rule = _step.value;
2642
- sheet.insertRule(rule, sheet.cssRules.length);
2643
- }
2644
- } catch (err) {
2645
- _didIteratorError = !0, _iteratorError = err;
2646
- } finally {
2634
+ if (import_constants4.isClient) {
2635
+ if (!sheet && document.head) {
2636
+ var styleTag = document.createElement("style");
2637
+ nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
2638
+ }
2639
+ if (!sheet) {
2640
+ console.warn("[tamagui] no sheet");
2641
+ return;
2642
+ }
2643
+ for (var key in rulesToInsert) {
2644
+ var styleObject = rulesToInsert[key], identifier = styleObject[import_helpers.StyleObjectIdentifier];
2645
+ if (shouldInsertStyleRules(identifier)) {
2646
+ var rules = styleObject[import_helpers.StyleObjectRules];
2647
+ allSelectors[identifier] = rules.join(`
2648
+ `), updateRules(identifier, rules), trackInsertedStyle(identifier);
2649
+ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
2647
2650
  try {
2648
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
2651
+ for (var _iterator = rules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
2652
+ var rule = _step.value;
2653
+ sheet.insertRule(rule, sheet.cssRules.length);
2654
+ }
2655
+ } catch (err) {
2656
+ _didIteratorError = !0, _iteratorError = err;
2649
2657
  } finally {
2650
- if (_didIteratorError) throw _iteratorError;
2658
+ try {
2659
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
2660
+ } finally {
2661
+ if (_didIteratorError) throw _iteratorError;
2662
+ }
2651
2663
  }
2652
2664
  }
2653
2665
  }
2654
2666
  }
2655
2667
  }
2656
- var minInsertAmt = process.env.TAMAGUI_INSERT_SELECTOR_TRIES ? +process.env.TAMAGUI_INSERT_SELECTOR_TRIES : 1;
2668
+ var maxToInsert = process.env.TAMAGUI_INSERT_SELECTOR_TRIES ? +process.env.TAMAGUI_INSERT_SELECTOR_TRIES : 1;
2657
2669
  function shouldInsertStyleRules(identifier) {
2658
2670
  if (process.env.IS_STATIC === "is_static") return !0;
2659
- var total = totalSelectorsInserted.get(identifier);
2660
- return total === void 0 || total < minInsertAmt;
2671
+ var total = totalSelectorsInserted.get(identifier) || 0;
2672
+ return total < maxToInsert;
2661
2673
  }
2662
2674
  }
2663
2675
  });
@@ -6200,7 +6212,7 @@ var require_getSplitStyles_native = __commonJS({
6200
6212
  try {
6201
6213
  for (var _iterator2 = pseudoStyles[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
6202
6214
  var psuedoStyle = _step2.value, fullKey = `${psuedoStyle[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
6203
- fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle, startedUnhydrated), classNames[fullKey] = psuedoStyle[import_helpers.StyleObjectIdentifier]);
6215
+ fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle), classNames[fullKey] = psuedoStyle[import_helpers.StyleObjectIdentifier]);
6204
6216
  }
6205
6217
  } catch (err) {
6206
6218
  _didIteratorError2 = !0, _iteratorError2 = err;
@@ -6255,7 +6267,7 @@ var require_getSplitStyles_native = __commonJS({
6255
6267
  var style3 = _step12.value, property = style3[import_helpers.StyleObjectProperty], isSubStyle = property[0] === "$";
6256
6268
  if (!(isSubStyle && !(0, import_isActivePlatform.isActivePlatform)(property))) {
6257
6269
  var out = (0, import_createMediaStyle.createMediaStyle)(style3, mediaKeyShort, import_useMedia.mediaQueryConfig, isMedia, !1, priority), subKey = isSubStyle ? style3[2] : "", fullKey1 = `${style3[import_helpers.StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style3[import_helpers.StyleObjectPseudo] || ""}`;
6258
- fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out, startedUnhydrated), classNames[fullKey1] = out[import_helpers.StyleObjectIdentifier]);
6270
+ fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out), classNames[fullKey1] = out[import_helpers.StyleObjectIdentifier]);
6259
6271
  }
6260
6272
  }
6261
6273
  } catch (err) {
@@ -6505,7 +6517,6 @@ var require_getSplitStyles_native = __commonJS({
6505
6517
  return res;
6506
6518
  };
6507
6519
  function addStyleToInsertRules(rulesToInsert, styleObject) {
6508
- var startedUnhydrated = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
6509
6520
  if (0) var identifier;
6510
6521
  }
6511
6522
  var defaultColor = process.env.TAMAGUI_DEFAULT_COLOR || "rgba(0,0,0,0)", animatableDefaults = {
@@ -7792,14 +7803,14 @@ var require_useComponentState_native = __commonJS({
7792
7803
  var import_constants4 = require_index_native6(), import_is_equal_shallow = require_index_native13(), import_use_did_finish_ssr = require_index_native14(), import_react3 = require("react"), import_defaultComponentState = require_defaultComponentState_native(), import_isObj = require_isObj_native(), import_log = require_log_native(), useComponentState = function(props, param, staticConfig, config) {
7793
7804
  var { animationDriver } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), needsHydration = !(0, import_use_did_finish_ssr.useIsClientOnly)(), [startedUnhydrated] = (0, import_react3.useState)(needsHydration && !isHydrated), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
7794
7805
  stateRef.current || (stateRef.current = {});
7795
- var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current;
7806
+ var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSS = animationDriver == null ? void 0 : animationDriver.supportsCSS, curStateRef = stateRef.current;
7796
7807
  !needsHydration && hasAnimationProp && (curStateRef.hasAnimated = !0);
7797
7808
  var willBeAnimatedClient = function() {
7798
7809
  var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
7799
7810
  return !!(next || curStateRef.hasAnimated);
7800
7811
  }(), willBeAnimated = !import_constants4.isServer && willBeAnimatedClient;
7801
7812
  willBeAnimated && !curStateRef.hasAnimated && (curStateRef.hasAnimated = !0);
7802
- var { disableClassName } = props, presence = willBeAnimated && props.animatePresence !== !1 && (animationDriver == null || (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null, presenceState = presence == null ? void 0 : presence[2], isExiting = (presenceState == null ? void 0 : presenceState.isPresent) === !1, isEntering = (presenceState == null ? void 0 : presenceState.isPresent) === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver == null ? void 0 : animationDriver.isReactNative) || !supportsCSSVars), hasEnterState = hasEnterStyle || isEntering, shouldEnter = hasEnterState || hasAnimationThatNeedsHydrate || // disableClassName doesnt work server side, only client, so needs hydrate
7813
+ var { disableClassName } = props, presence = willBeAnimated && props.animatePresence !== !1 && (animationDriver == null || (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null, presenceState = presence == null ? void 0 : presence[2], isExiting = (presenceState == null ? void 0 : presenceState.isPresent) === !1, isEntering = (presenceState == null ? void 0 : presenceState.isPresent) === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver == null ? void 0 : animationDriver.isReactNative) || !supportsCSS), hasEnterState = hasEnterStyle || isEntering, shouldEnter = hasEnterState || hasAnimationThatNeedsHydrate || // disableClassName doesnt work server side, only client, so needs hydrate
7803
7814
  // this is just for a better ux, supports css variables for light/dark, media queries, etc
7804
7815
  disableClassName, initialState = shouldEnter ? (
7805
7816
  // on the very first render we switch all spring animation drivers to css rendering
@@ -7830,7 +7841,7 @@ var require_useComponentState_native = __commonJS({
7830
7841
  }
7831
7842
  var noClass = !import_constants4.isWeb || !!props.forceStyle || isAnimated && (animationDriver == null ? void 0 : animationDriver.needsWebStyles);
7832
7843
  if (import_constants4.isWeb && (!import_constants4.isServer || isHydrated)) {
7833
- var isAnimatedAndHydrated = isAnimated && !supportsCSSVars, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || !state.unmounted), isDisabledManually = disableClassName && !state.unmounted;
7844
+ var isAnimatedAndHydrated = isAnimated && !supportsCSS, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || !state.unmounted), isDisabledManually = disableClassName && !state.unmounted;
7834
7845
  (isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (noClass = !0);
7835
7846
  }
7836
7847
  if (groupName && !curStateRef.group) {
@@ -7890,7 +7901,7 @@ var require_useComponentState_native = __commonJS({
7890
7901
  noClass,
7891
7902
  state,
7892
7903
  stateRef,
7893
- supportsCSSVars,
7904
+ supportsCSS,
7894
7905
  willBeAnimated,
7895
7906
  willBeAnimatedClient
7896
7907
  };
@@ -8176,7 +8187,7 @@ var require_createComponent_native = __commonJS({
8176
8187
  ...styledContextProps
8177
8188
  } : defaultProps, props = propsIn;
8178
8189
  curDefaultProps && (props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn));
8179
- var componentName2 = props.componentName || staticConfig.componentName, animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, config), { curStateRef, disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, supportsCSSVars, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState, setStateShallow = componentState.setStateShallow, hasTextAncestor = !!(import_constants4.isWeb && isText && componentContext.inText), isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = import_constants4.isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
8190
+ var componentName2 = props.componentName || staticConfig.componentName, animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, config), { curStateRef, disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, supportsCSS, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState, setStateShallow = componentState.setStateShallow, hasTextAncestor = !!(import_constants4.isWeb && isText && componentContext.inText), isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = import_constants4.isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
8180
8191
  animationDriver && isAnimated && // this should really be behind another prop as it's not really related to
8181
8192
  // "needsWebStyles" basically with motion we just animate a plain div, but
8182
8193
  // we still have animated.View/Text for Sheet which wants to control
@@ -8202,7 +8213,7 @@ var require_createComponent_native = __commonJS({
8202
8213
  (0, import_createVariable.setDidGetVariableValue)(!1);
8203
8214
  var resolveValues = (
8204
8215
  // if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
8205
- isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
8216
+ isAnimated && !supportsCSS || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
8206
8217
  ), styleProps = {
8207
8218
  mediaState: mediaState3,
8208
8219
  noClass,
@@ -8269,7 +8280,7 @@ var require_createComponent_native = __commonJS({
8269
8280
  !isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), tagProp && elementType.acceptTagProp && (viewProps.tag = tagProp);
8270
8281
  var animationStyles, shouldUseAnimation = (
8271
8282
  // if it supports css vars we run it on server too to get matching initial style
8272
- (supportsCSSVars ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC
8283
+ (supportsCSS ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC
8273
8284
  ), animatedRef;
8274
8285
  if (shouldUseAnimation) {
8275
8286
  var useStyleEmitter = animationDriver != null && animationDriver.avoidReRenders ? function(listener) {
@@ -8318,8 +8329,7 @@ var require_createComponent_native = __commonJS({
8318
8329
  }
8319
8330
  var tm;
8320
8331
  if (state.unmounted) {
8321
- var _config_animations2, _animationDriver_supportsCSSVars;
8322
- if (((_animationDriver_supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars) !== null && _animationDriver_supportsCSSVars !== void 0 ? _animationDriver_supportsCSSVars : !(config == null || (_config_animations2 = config.animations) === null || _config_animations2 === void 0) && _config_animations2.supportsCSSVars) || import_constants4.isAndroid) return tm = setTimeout(function() {
8332
+ if (animationDriver != null && animationDriver.supportsCSS || import_constants4.isAndroid) return tm = setTimeout(function() {
8323
8333
  setStateShallow({
8324
8334
  unmounted: !1
8325
8335
  });
@@ -10841,7 +10851,7 @@ var require_TamaguiProvider_native = __commonJS({
10841
10851
  }
10842
10852
  });
10843
10853
  module2.exports = __toCommonJS2(TamaguiProvider_exports);
10844
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_use_did_finish_ssr = require_index_native14(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native(), import_useMedia = require_useMedia_native(), import_ThemeProvider = require_ThemeProvider_native();
10854
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_use_did_finish_ssr = require_index_native14(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native(), import_useMedia = require_useMedia_native(), import_ThemeProvider = require_ThemeProvider_native(), import_insertStyleRule = require_insertStyleRule_native();
10845
10855
  function TamaguiProvider2(param) {
10846
10856
  var { children, disableInjectCSS, config, className, defaultTheme, disableRootThemeClass, reset, themeClassNameOnRoot } = param;
10847
10857
  import_constants4.IS_REACT_19 || import_constants4.isClient && (0, import_constants4.useIsomorphicLayoutEffect)(function() {
@@ -10855,7 +10865,7 @@ var require_TamaguiProvider_native = __commonJS({
10855
10865
  config,
10856
10866
  disableInjectCSS
10857
10867
  ]), (0, import_constants4.useIsomorphicLayoutEffect)(function() {
10858
- (0, import_useMedia.updateMediaListeners)();
10868
+ (0, import_insertStyleRule.stopAccumulatingRules)(), (0, import_useMedia.updateMediaListeners)();
10859
10869
  }, []);
10860
10870
  var contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UnmountedClassName, {
10861
10871
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ComponentContext.ComponentContext.Provider, {
@@ -17857,7 +17867,7 @@ var require_SheetImplementationCustom_native = __commonJS({
17857
17867
  var parentSheet = import_react3.default.useContext(import_contexts.ParentSheetContext), { animation, animationConfig: animationConfigProp, modal = !1, zIndex = parentSheet.zIndex + 1, moveOnKeyboardChange = !1, unmountChildrenWhenHidden = !1, portalProps, containerComponent: ContainerComponent = import_react3.default.Fragment } = props, state = (0, import_useSheetOpenState.useSheetOpenState)(props), [overlayComponent, setOverlayComponent] = import_react3.default.useState(null), providerProps = (0, import_useSheetProviderProps.useSheetProviderProps)(props, state, {
17858
17868
  onOverlayComponent: setOverlayComponent
17859
17869
  }), { frameSize, setFrameSize, snapPoints, snapPointsMode, hasFit, position, setPosition, scrollBridge, screenSize, setMaxContentSize, maxSnapPoint } = providerProps, { open, controller, isHidden } = state, sheetRef = import_react3.default.useRef(void 0), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, sheetRef, providerProps.contentRef), { animationDriver } = (0, import_core12.useConfiguration)(), animationConfig = function() {
17860
- if (animationDriver.supportsCSSVars) return {};
17870
+ if (animationDriver.supportsCSS) return {};
17861
17871
  var [animationProp, animationPropConfig] = animation ? Array.isArray(animation) ? animation : [
17862
17872
  animation
17863
17873
  ] : [];