@tamagui/core 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.
@@ -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
 
@@ -7646,7 +7655,7 @@ var require_createVariables_native = __commonJS({
7646
7655
  }
7647
7656
  });
7648
7657
  module2.exports = __toCommonJS2(createVariables_exports);
7649
- var import_helpers2 = require_index_native3(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
7658
+ var import_constants2 = require_index_native2(), import_helpers2 = require_index_native3(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
7650
7659
  var parentPath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", isFont = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
7651
7660
  if (cache.has(tokens)) return tokens;
7652
7661
  var res = {}, i = 0;
@@ -7658,16 +7667,25 @@ var require_createVariables_native = __commonJS({
7658
7667
  continue;
7659
7668
  }
7660
7669
  var niceKey = (0, import_helpers2.simpleHash)(key, 1e3), name = parentPath && parentPath !== "t-color" ? `${parentPath}-${niceKey}` : `c-${niceKey}`;
7670
+ if (val && typeof val == "object" && "needsPx" in val && "val" in val) {
7671
+ var finalValue = (0, import_createVariable.createVariable)({
7672
+ val: val.val,
7673
+ name,
7674
+ key: keyWithPrefix
7675
+ });
7676
+ import_constants2.isWeb && (finalValue.needsPx = val.needsPx), res[key] = finalValue;
7677
+ continue;
7678
+ }
7661
7679
  if (val && typeof val == "object") {
7662
7680
  res[key] = createVariables(tokens[key], name, !1);
7663
7681
  continue;
7664
7682
  }
7665
- var finalValue = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
7683
+ var finalValue1 = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
7666
7684
  val,
7667
7685
  name,
7668
7686
  key: keyWithPrefix
7669
7687
  });
7670
- res[key] = finalValue;
7688
+ res[key] = finalValue1;
7671
7689
  }
7672
7690
  return cache.set(res, !0), res;
7673
7691
  };
@@ -8187,6 +8205,14 @@ var require_createTamagui_native = __commonJS({
8187
8205
  });
8188
8206
  module2.exports = __toCommonJS2(createTamagui_exports);
8189
8207
  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();
8208
+ function shouldTokenCategoryHaveUnits(category) {
8209
+ var UNIT_CATEGORIES = /* @__PURE__ */ new Set([
8210
+ "size",
8211
+ "space",
8212
+ "radius"
8213
+ ]);
8214
+ return UNIT_CATEGORIES.has(category);
8215
+ }
8190
8216
  function createTamagui2(configIn) {
8191
8217
  var _configIn_settings;
8192
8218
  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 +8257,11 @@ var require_createTamagui_native = __commonJS({
8231
8257
  var cssRuleSets = [], declarations = [], fontDeclarations = {};
8232
8258
  for (var key2 in tokens) for (var skey in tokens[key2]) {
8233
8259
  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")));
8260
+ if (specificTokens[`$${key2}.${skey}`] = variable, import_constants2.isWeb) {
8261
+ (0, import_registerCSSVariable.registerCSSVariable)(variable);
8262
+ var variableNeedsPx = variable.needsPx === !0, categoryNeedsPx = shouldTokenCategoryHaveUnits(key2), shouldBeUnitless = !(variableNeedsPx || categoryNeedsPx);
8263
+ declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, shouldBeUnitless));
8264
+ }
8235
8265
  }
8236
8266
  if (0) {
8237
8267
  var declarationsToRuleSet;