@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.
package/dist/native.js CHANGED
@@ -1320,6 +1320,9 @@ var require_createVariable_native = __commonJS({
1320
1320
  isVariable: function() {
1321
1321
  return isVariable;
1322
1322
  },
1323
+ px: function() {
1324
+ return px;
1325
+ },
1323
1326
  setDidGetVariableValue: function() {
1324
1327
  return setDidGetVariableValue;
1325
1328
  },
@@ -1383,6 +1386,12 @@ var require_createVariable_native = __commonJS({
1383
1386
  var name = (0, import_helpers2.simpleHash)(nameProp, 60);
1384
1387
  return includeVar ? constructCSSVariableName(name) : name;
1385
1388
  };
1389
+ function px(value) {
1390
+ return {
1391
+ val: value,
1392
+ needsPx: !0
1393
+ };
1394
+ }
1386
1395
  }
1387
1396
  });
1388
1397
 
@@ -7939,7 +7948,12 @@ If you meant to do this, you can disable this warning - either change untilMeasu
7939
7948
  return Component2.staticConfig = extendStyledConfig(extended), Component2.styleable = styleable, Component2;
7940
7949
  }
7941
7950
  function styleable(Component2, options) {
7942
- 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);
7951
+ 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) {
7952
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component2, {
7953
+ ...props,
7954
+ ref
7955
+ });
7956
+ }), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig);
7943
7957
  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;
7944
7958
  }
7945
7959
  return res.extractable = extractable, res.styleable = styleable, res;
@@ -8215,7 +8229,7 @@ var require_createVariables_native = __commonJS({
8215
8229
  }
8216
8230
  });
8217
8231
  module2.exports = __toCommonJS2(createVariables_exports);
8218
- var import_helpers2 = require_index_native3(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
8232
+ var import_constants2 = require_index_native2(), import_helpers2 = require_index_native3(), import_createVariable = require_createVariable_native(), cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
8219
8233
  var parentPath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", isFont = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
8220
8234
  if (cache.has(tokens)) return tokens;
8221
8235
  var res = {}, i = 0;
@@ -8227,16 +8241,25 @@ var require_createVariables_native = __commonJS({
8227
8241
  continue;
8228
8242
  }
8229
8243
  var niceKey = (0, import_helpers2.simpleHash)(key, 1e3), name = parentPath && parentPath !== "t-color" ? `${parentPath}-${niceKey}` : `c-${niceKey}`;
8244
+ if (val && typeof val == "object" && "needsPx" in val && "val" in val) {
8245
+ var finalValue = (0, import_createVariable.createVariable)({
8246
+ val: val.val,
8247
+ name,
8248
+ key: keyWithPrefix
8249
+ });
8250
+ import_constants2.isWeb && (finalValue.needsPx = val.needsPx), res[key] = finalValue;
8251
+ continue;
8252
+ }
8230
8253
  if (val && typeof val == "object") {
8231
8254
  res[key] = createVariables(tokens[key], name, !1);
8232
8255
  continue;
8233
8256
  }
8234
- var finalValue = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
8257
+ var finalValue1 = (0, import_createVariable.isVariable)(val) ? val : (0, import_createVariable.createVariable)({
8235
8258
  val,
8236
8259
  name,
8237
8260
  key: keyWithPrefix
8238
8261
  });
8239
- res[key] = finalValue;
8262
+ res[key] = finalValue1;
8240
8263
  }
8241
8264
  return cache.set(res, !0), res;
8242
8265
  };
@@ -8756,6 +8779,14 @@ var require_createTamagui_native = __commonJS({
8756
8779
  });
8757
8780
  module2.exports = __toCommonJS2(createTamagui_exports);
8758
8781
  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();
8782
+ function shouldTokenCategoryHaveUnits(category) {
8783
+ var UNIT_CATEGORIES = /* @__PURE__ */ new Set([
8784
+ "size",
8785
+ "space",
8786
+ "radius"
8787
+ ]);
8788
+ return UNIT_CATEGORIES.has(category);
8789
+ }
8759
8790
  function createTamagui2(configIn) {
8760
8791
  var _configIn_settings;
8761
8792
  if (process.env.NODE_ENV === "test" && 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;
@@ -8802,7 +8833,11 @@ var require_createTamagui_native = __commonJS({
8802
8833
  var variable = tokens[key2][skey];
8803
8834
  if (specificTokens[`$${key2}.${skey}`] = variable, process.env.NODE_ENV === "development" && typeof variable > "u") throw new Error(`No value for tokens.${key2}.${skey}:
8804
8835
  ${JSON.stringify(variable, null, 2)}`);
8805
- import_constants2.isWeb && ((0, import_registerCSSVariable.registerCSSVariable)(variable), declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, key2 === "zIndex")));
8836
+ if (import_constants2.isWeb) {
8837
+ (0, import_registerCSSVariable.registerCSSVariable)(variable);
8838
+ var variableNeedsPx = variable.needsPx === !0, categoryNeedsPx = shouldTokenCategoryHaveUnits(key2), shouldBeUnitless = !(variableNeedsPx || categoryNeedsPx);
8839
+ declarations.push((0, import_registerCSSVariable.variableToCSS)(variable, shouldBeUnitless));
8840
+ }
8806
8841
  }
8807
8842
  if (0) {
8808
8843
  var declarationsToRuleSet;