tamagui 1.128.1 → 1.129.1

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.
@@ -2404,6 +2404,9 @@ var require_createVariable_native = __commonJS({
2404
2404
  isVariable: function() {
2405
2405
  return isVariable2;
2406
2406
  },
2407
+ px: function() {
2408
+ return px;
2409
+ },
2407
2410
  setDidGetVariableValue: function() {
2408
2411
  return setDidGetVariableValue;
2409
2412
  },
@@ -2465,6 +2468,12 @@ var require_createVariable_native = __commonJS({
2465
2468
  var includeVar = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, name = (0, import_helpers.simpleHash)(nameProp, 60);
2466
2469
  return includeVar ? constructCSSVariableName(name) : name;
2467
2470
  };
2471
+ function px(value) {
2472
+ return {
2473
+ val: value,
2474
+ needsPx: !0
2475
+ };
2476
+ }
2468
2477
  }
2469
2478
  });
2470
2479
 
@@ -8745,7 +8754,7 @@ var require_createVariables_native = __commonJS({
8745
8754
  }
8746
8755
  });
8747
8756
  module2.exports = __toCommonJS2(createVariables_exports);
8748
- var import_helpers = require_index_native7(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
8757
+ var import_constants4 = require_index_native6(), import_helpers = require_index_native7(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
8749
8758
  var parentPath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", isFont = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
8750
8759
  if (cache.has(tokens)) return tokens;
8751
8760
  var res = {}, i = 0;
@@ -8757,16 +8766,25 @@ var require_createVariables_native = __commonJS({
8757
8766
  continue;
8758
8767
  }
8759
8768
  var niceKey = (0, import_helpers.simpleHash)(key, 1e3), name = parentPath && parentPath !== "t-color" ? `${parentPath}-${niceKey}` : `c-${niceKey}`;
8769
+ if (val && typeof val == "object" && "needsPx" in val && "val" in val) {
8770
+ var finalValue = (0, import_createVariable.createVariable)({
8771
+ val: val.val,
8772
+ name,
8773
+ key: keyWithPrefix
8774
+ });
8775
+ import_constants4.isWeb && (finalValue.needsPx = val.needsPx), res[key] = finalValue;
8776
+ continue;
8777
+ }
8760
8778
  if (val && typeof val == "object") {
8761
8779
  res[key] = createVariables(tokens[key], name, !1);
8762
8780
  continue;
8763
8781
  }
8764
- var finalValue = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
8782
+ var finalValue1 = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
8765
8783
  val,
8766
8784
  name,
8767
8785
  key: keyWithPrefix
8768
8786
  });
8769
- res[key] = finalValue;
8787
+ res[key] = finalValue1;
8770
8788
  }
8771
8789
  return cache.set(res, !0), res;
8772
8790
  };
@@ -9286,6 +9304,14 @@ var require_createTamagui_native = __commonJS({
9286
9304
  });
9287
9305
  module2.exports = __toCommonJS2(createTamagui_exports);
9288
9306
  var import_constants4 = require_index_native6(), import_config = require_config_native(), import_createVariables = require_createVariables_native(), import_getThemeCSSRules = require_getThemeCSSRules_native(), import_insertStyleRule = require_insertStyleRule_native(), import_proxyThemeToParents = require_proxyThemeToParents_native(), import_registerCSSVariable = require_registerCSSVariable_native(), import_themes = require_themes_native(), import_useMedia = require_useMedia_native(), import_insertFont = require_insertFont_native(), import_Tamagui = require_Tamagui_native(), createdConfigs = /* @__PURE__ */ new WeakMap();
9307
+ function shouldTokenCategoryHaveUnits(category) {
9308
+ var UNIT_CATEGORIES = /* @__PURE__ */ new Set([
9309
+ "size",
9310
+ "space",
9311
+ "radius"
9312
+ ]);
9313
+ return UNIT_CATEGORIES.has(category);
9314
+ }
9289
9315
  function createTamagui2(configIn) {
9290
9316
  var _configIn_settings;
9291
9317
  if (globalThis.__tamaguiConfig) return console.warn("Warning: You somehow have duplicate Tamagui dependencies, this can cause issues. Tamagui is working around this by loading a previously loaded config in test mode. "), globalThis.__tamaguiConfig;
@@ -9330,7 +9356,11 @@ var require_createTamagui_native = __commonJS({
9330
9356
  var cssRuleSets = [], declarations = [], fontDeclarations = {};
9331
9357
  for (var key2 in tokens) for (var skey in tokens[key2]) {
9332
9358
  var variable = tokens[key2][skey];
9333
- specificTokens[`$${key2}.${skey}`] = variable, import_constants4.isWeb && ((0, import_registerCSSVariable.registerCSSVariable)(variable), declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, key2 === "zIndex")));
9359
+ if (specificTokens[`$${key2}.${skey}`] = variable, import_constants4.isWeb) {
9360
+ (0, import_registerCSSVariable.registerCSSVariable)(variable);
9361
+ var variableNeedsPx = variable.needsPx === !0, categoryNeedsPx = shouldTokenCategoryHaveUnits(key2), shouldBeUnitless = !(variableNeedsPx || categoryNeedsPx);
9362
+ declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, shouldBeUnitless));
9363
+ }
9334
9364
  }
9335
9365
  if (0) {
9336
9366
  var declarationsToRuleSet;
@@ -23299,9 +23329,18 @@ var require_Animate_native = __commonJS({
23299
23329
  }
23300
23330
  });
23301
23331
  module2.exports = __toCommonJS2(Animate_exports);
23302
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_animate_presence = require_index_native4();
23332
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_animate_presence = require_index_native4(), import_react3 = require("react");
23303
23333
  function Animate(param) {
23304
- var { children, type, ...props } = param;
23334
+ var { children, lazyMount, type, present, ...props } = param, [lazyMounted, setLazyMounted] = (0, import_react3.useState)(lazyMount ? !1 : present);
23335
+ (0, import_react3.useEffect)(function() {
23336
+ lazyMount && present && (0, import_react3.startTransition)(function() {
23337
+ setLazyMounted(present);
23338
+ });
23339
+ }, [
23340
+ lazyMount,
23341
+ present
23342
+ ]);
23343
+ var mounted = present ? lazyMount ? lazyMounted : present : !1;
23305
23344
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.PresenceChild, {
23306
23345
  initial: props.initial ? void 0 : !1,
23307
23346
  onExitComplete: props.onExitComplete,
@@ -23311,12 +23350,12 @@ var require_Animate_native = __commonJS({
23311
23350
  // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
23312
23351
  // but since we always re-render this component on open changes this should be fine to leave off?
23313
23352
  presenceAffectsLayout: !1,
23314
- isPresent: props.present,
23353
+ isPresent: present,
23315
23354
  custom: props.custom,
23316
23355
  children
23317
23356
  }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.AnimatePresence, {
23318
23357
  ...props,
23319
- children: props.present ? children : null
23358
+ children: mounted ? children : null
23320
23359
  }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {
23321
23360
  children
23322
23361
  });
@@ -23764,21 +23803,21 @@ var require_Popper_native = __commonJS({
23764
23803
  x,
23765
23804
  y
23766
23805
  ]);
23767
- var show = !0, frameProps = {
23806
+ var hide2 = x === 0 && y === 0, frameProps = {
23768
23807
  ref: contentRefs,
23769
23808
  x: x || 0,
23770
23809
  y: y || 0,
23771
23810
  top: 0,
23772
23811
  left: 0,
23773
23812
  position: strategy,
23774
- opacity: show ? 1 : 0,
23813
+ opacity: 1,
23775
23814
  ...enableAnimationForPositionChange && {
23776
23815
  // apply animation but disable it on initial render to avoid animating from 0 to the first position
23777
23816
  animation: rest.animation,
23778
23817
  animateOnly: needsMeasure ? [] : rest.animateOnly,
23779
23818
  animatePresence: !1
23780
23819
  },
23781
- ...x === 0 && y === 0 && {
23820
+ ...hide2 && {
23782
23821
  opacity: 0,
23783
23822
  animateOnly: []
23784
23823
  }
@@ -24211,7 +24250,7 @@ var require_Popover_native = __commonJS({
24211
24250
  });
24212
24251
  }
24213
24252
  var PopoverContentImpl = /* @__PURE__ */ React4.forwardRef(function(props, forwardedRef) {
24214
- var { trapFocus, __scopePopover, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, disableFocusScope, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, children, disableRemoveScroll, freezeContentsWhenHidden, setIsFullyHidden, ...contentProps } = props, context = usePopoverContext(__scopePopover), { open, keepChildrenMounted } = context, popperContext = (0, import_popper.usePopperContext)(__scopePopover || POPOVER_SCOPE), handleExitComplete = React4.useCallback(function() {
24253
+ var { trapFocus, __scopePopover, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, disableFocusScope, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, children, disableRemoveScroll, freezeContentsWhenHidden, setIsFullyHidden, lazyMount, ...contentProps } = props, context = usePopoverContext(__scopePopover), { open, keepChildrenMounted } = context, popperContext = (0, import_popper.usePopperContext)(__scopePopover || POPOVER_SCOPE), handleExitComplete = React4.useCallback(function() {
24215
24254
  setIsFullyHidden == null || setIsFullyHidden(!0);
24216
24255
  }, [
24217
24256
  setIsFullyHidden
@@ -24229,6 +24268,7 @@ var require_Popover_native = __commonJS({
24229
24268
  present: !!open,
24230
24269
  keepChildrenMounted,
24231
24270
  onExitComplete: handleExitComplete,
24271
+ lazyMount,
24232
24272
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_popper.PopperContent, {
24233
24273
  __scopePopper: __scopePopover || POPOVER_SCOPE,
24234
24274
  "data-state": getState(open),