@tamagui/core 1.128.1 → 1.129.0

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.
@@ -1305,6 +1305,9 @@ var require_createVariable_native = __commonJS({
1305
1305
  isVariable: function() {
1306
1306
  return isVariable;
1307
1307
  },
1308
+ px: function() {
1309
+ return px;
1310
+ },
1308
1311
  setDidGetVariableValue: function() {
1309
1312
  return setDidGetVariableValue;
1310
1313
  },
@@ -1366,6 +1369,12 @@ var require_createVariable_native = __commonJS({
1366
1369
  var includeVar = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, name = (0, import_helpers2.simpleHash)(nameProp, 60);
1367
1370
  return includeVar ? constructCSSVariableName(name) : name;
1368
1371
  };
1372
+ function px(value) {
1373
+ return {
1374
+ val: value,
1375
+ needsPx: !0
1376
+ };
1377
+ }
1369
1378
  }
1370
1379
  });
1371
1380
 
@@ -7370,7 +7379,12 @@ var require_createComponent_native = __commonJS({
7370
7379
  return Component2.staticConfig = extendStyledConfig(extended), Component2.styleable = styleable, Component2;
7371
7380
  }
7372
7381
  function styleable(Component2, options) {
7373
- var _Component_render, isForwardedRefAlready = ((_Component_render = Component2.render) === null || _Component_render === void 0 ? void 0 : _Component_render.length) === 2, out = isForwardedRefAlready ? Component2 : /* @__PURE__ */ import_react3.default.forwardRef(Component2), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig);
7382
+ var _Component_render, isForwardedRefAlready = ((_Component_render = Component2.render) === null || _Component_render === void 0 ? void 0 : _Component_render.length) === 2 || Component2.length === 2, out = isForwardedRefAlready ? Component2 : /* @__PURE__ */ import_react3.default.forwardRef(function(props, ref) {
7383
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component2, {
7384
+ ...props,
7385
+ ref
7386
+ });
7387
+ }), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig);
7374
7388
  return out = options != null && options.disableTheme ? out : (0, import_themeable.themeable)(out, extendedConfig, !0), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */ import_react3.default.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
7375
7389
  }
7376
7390
  return res.extractable = extractable, res.styleable = styleable, res;
@@ -7646,7 +7660,7 @@ var require_createVariables_native = __commonJS({
7646
7660
  }
7647
7661
  });
7648
7662
  module2.exports = __toCommonJS2(createVariables_exports);
7649
- var import_helpers2 = require_index_native3(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
7663
+ var import_constants2 = require_index_native2(), import_helpers2 = require_index_native3(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
7650
7664
  var parentPath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", isFont = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
7651
7665
  if (cache.has(tokens)) return tokens;
7652
7666
  var res = {}, i = 0;
@@ -7658,16 +7672,25 @@ var require_createVariables_native = __commonJS({
7658
7672
  continue;
7659
7673
  }
7660
7674
  var niceKey = (0, import_helpers2.simpleHash)(key, 1e3), name = parentPath && parentPath !== "t-color" ? `${parentPath}-${niceKey}` : `c-${niceKey}`;
7675
+ if (val && typeof val == "object" && "needsPx" in val && "val" in val) {
7676
+ var finalValue = (0, import_createVariable.createVariable)({
7677
+ val: val.val,
7678
+ name,
7679
+ key: keyWithPrefix
7680
+ });
7681
+ import_constants2.isWeb && (finalValue.needsPx = val.needsPx), res[key] = finalValue;
7682
+ continue;
7683
+ }
7661
7684
  if (val && typeof val == "object") {
7662
7685
  res[key] = createVariables(tokens[key], name, !1);
7663
7686
  continue;
7664
7687
  }
7665
- var finalValue = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
7688
+ var finalValue1 = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
7666
7689
  val,
7667
7690
  name,
7668
7691
  key: keyWithPrefix
7669
7692
  });
7670
- res[key] = finalValue;
7693
+ res[key] = finalValue1;
7671
7694
  }
7672
7695
  return cache.set(res, !0), res;
7673
7696
  };
@@ -8187,6 +8210,14 @@ var require_createTamagui_native = __commonJS({
8187
8210
  });
8188
8211
  module2.exports = __toCommonJS2(createTamagui_exports);
8189
8212
  var import_constants2 = require_index_native2(), 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();
8213
+ function shouldTokenCategoryHaveUnits(category) {
8214
+ var UNIT_CATEGORIES = /* @__PURE__ */ new Set([
8215
+ "size",
8216
+ "space",
8217
+ "radius"
8218
+ ]);
8219
+ return UNIT_CATEGORIES.has(category);
8220
+ }
8190
8221
  function createTamagui2(configIn) {
8191
8222
  var _configIn_settings;
8192
8223
  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;
@@ -8231,7 +8262,11 @@ var require_createTamagui_native = __commonJS({
8231
8262
  var cssRuleSets = [], declarations = [], fontDeclarations = {};
8232
8263
  for (var key2 in tokens) for (var skey in tokens[key2]) {
8233
8264
  var variable = tokens[key2][skey];
8234
- specificTokens[`$${key2}.${skey}`] = variable, import_constants2.isWeb && ((0, import_registerCSSVariable.registerCSSVariable)(variable), declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, key2 === "zIndex")));
8265
+ if (specificTokens[`$${key2}.${skey}`] = variable, import_constants2.isWeb) {
8266
+ (0, import_registerCSSVariable.registerCSSVariable)(variable);
8267
+ var variableNeedsPx = variable.needsPx === !0, categoryNeedsPx = shouldTokenCategoryHaveUnits(key2), shouldBeUnitless = !(variableNeedsPx || categoryNeedsPx);
8268
+ declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, shouldBeUnitless));
8269
+ }
8235
8270
  }
8236
8271
  if (0) {
8237
8272
  var declarationsToRuleSet;