@tamagui/core 3.0.0-beta.1352.1 → 3.0.0-beta.1358.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.
package/dist/native.cjs CHANGED
@@ -14058,6 +14058,97 @@ function mergeFrontendCondition(previous, value, condition) {
14058
14058
  };
14059
14059
  }
14060
14060
  //#endregion
14061
+ //#region ../web/dist/esm/helpers/resolveSizing.native.js
14062
+ var defaultSizing = {
14063
+ default: "md",
14064
+ sizes: {
14065
+ xs: {
14066
+ fontSize: "xs",
14067
+ controlFontSize: "xs",
14068
+ paddingInline: "2",
14069
+ paddingBlock: "1",
14070
+ gap: "1",
14071
+ radius: "sm"
14072
+ },
14073
+ sm: {
14074
+ fontSize: "sm",
14075
+ controlFontSize: "sm",
14076
+ paddingInline: "3",
14077
+ paddingBlock: "1.5",
14078
+ gap: "1.5",
14079
+ radius: "md"
14080
+ },
14081
+ md: {
14082
+ fontSize: "sm",
14083
+ controlFontSize: "base",
14084
+ paddingInline: "4",
14085
+ paddingBlock: "2",
14086
+ gap: "2",
14087
+ radius: "md"
14088
+ },
14089
+ lg: {
14090
+ fontSize: "base",
14091
+ controlFontSize: "lg",
14092
+ paddingInline: "6",
14093
+ paddingBlock: "2",
14094
+ gap: "2",
14095
+ radius: "md"
14096
+ },
14097
+ xl: {
14098
+ fontSize: "lg",
14099
+ controlFontSize: "xl",
14100
+ paddingInline: "8",
14101
+ paddingBlock: "2.5",
14102
+ gap: "2.5",
14103
+ radius: "lg"
14104
+ }
14105
+ }
14106
+ };
14107
+ var toPx$1 = function(value) {
14108
+ return typeof value === "number" ? value : Number.parseFloat(value);
14109
+ };
14110
+ function resolveSizing(size, env) {
14111
+ var _font_size, _font_size1, _font_lineHeight, _tokens_space;
14112
+ if (size === false) return void 0;
14113
+ var conf = (env === null || env === void 0 ? void 0 : env.fonts) && (env === null || env === void 0 ? void 0 : env.tokens) ? void 0 : getConfig();
14114
+ var _env_sizing;
14115
+ var sizing = _objectSpread2(_objectSpread2({}, defaultSizing), (_env_sizing = env === null || env === void 0 ? void 0 : env.sizing) !== null && _env_sizing !== void 0 ? _env_sizing : conf === null || conf === void 0 ? void 0 : conf.sizing);
14116
+ var name = size === true || size == null ? sizing.default : size;
14117
+ var rung = sizing.sizes[name];
14118
+ if (!rung) return void 0;
14119
+ var keys = {
14120
+ fontSize: rung.fontSize,
14121
+ lineHeight: rung.fontSize,
14122
+ paddingInline: rung.paddingInline,
14123
+ paddingBlock: rung.paddingBlock,
14124
+ gap: rung.gap,
14125
+ radius: rung.radius
14126
+ };
14127
+ if (rung.px) return _objectSpread2(_objectSpread2({ name }, keys), {}, {
14128
+ height: rung.px.height,
14129
+ icon: rung.px.icon,
14130
+ square: rung.px.square
14131
+ });
14132
+ var _env_fonts;
14133
+ var fonts = (_env_fonts = env === null || env === void 0 ? void 0 : env.fonts) !== null && _env_fonts !== void 0 ? _env_fonts : conf === null || conf === void 0 ? void 0 : conf.fontsParsed;
14134
+ var _env_tokens;
14135
+ var tokens = (_env_tokens = env === null || env === void 0 ? void 0 : env.tokens) !== null && _env_tokens !== void 0 ? _env_tokens : conf === null || conf === void 0 ? void 0 : conf.tokensParsed;
14136
+ var _conf_defaultFontToken, _env_font;
14137
+ var font = (_env_font = env === null || env === void 0 ? void 0 : env.font) !== null && _env_font !== void 0 ? _env_font : fonts === null || fonts === void 0 ? void 0 : fonts[(_conf_defaultFontToken = conf === null || conf === void 0 ? void 0 : conf.defaultFontToken) !== null && _conf_defaultFontToken !== void 0 ? _conf_defaultFontToken : "body"];
14138
+ var px = {
14139
+ fontSize: toPx$1(getVariableValue(font === null || font === void 0 ? void 0 : (_font_size = font.size) === null || _font_size === void 0 ? void 0 : _font_size[rung.fontSize])),
14140
+ control: toPx$1(getVariableValue(font === null || font === void 0 ? void 0 : (_font_size1 = font.size) === null || _font_size1 === void 0 ? void 0 : _font_size1[rung.controlFontSize])),
14141
+ lineHeight: toPx$1(getVariableValue(font === null || font === void 0 ? void 0 : (_font_lineHeight = font.lineHeight) === null || _font_lineHeight === void 0 ? void 0 : _font_lineHeight[rung.fontSize])),
14142
+ paddingBlock: toPx$1(getVariableValue(tokens === null || tokens === void 0 ? void 0 : (_tokens_space = tokens.space) === null || _tokens_space === void 0 ? void 0 : _tokens_space[rung.paddingBlock]))
14143
+ };
14144
+ if (!Object.values(px).every(Number.isFinite)) return;
14145
+ return _objectSpread2(_objectSpread2({ name }, keys), {}, {
14146
+ height: px.lineHeight + px.paddingBlock * 2,
14147
+ icon: Math.ceil(px.fontSize / 4) * 4,
14148
+ square: Math.round(px.control * 1.4)
14149
+ });
14150
+ }
14151
+ //#endregion
14061
14152
  //#region ../web/dist/esm/helpers/styledDynamic.native.js
14062
14153
  var fontLanguageCache = /* @__PURE__ */ new WeakMap();
14063
14154
  function getFontsForLanguage(fonts, language) {
@@ -14089,6 +14180,7 @@ function getDynamicEnv(styleState) {
14089
14180
  fonts,
14090
14181
  tokens: conf.tokensParsed,
14091
14182
  theme,
14183
+ sizing: _objectSpread2(_objectSpread2({}, defaultSizing), conf.sizing),
14092
14184
  get fontFamily() {
14093
14185
  return getVariableValue(styleState.fontFamily || props.fontFamily) || props.fontFamily || getVariableValue(getSetting("defaultFont"));
14094
14186
  },
@@ -18654,6 +18746,7 @@ function createTamagui$2(configIn) {
18654
18746
  animations: resolvedDriver !== null && resolvedDriver !== void 0 ? resolvedDriver : defaultAnimationDriver,
18655
18747
  animationDrivers,
18656
18748
  settings: settingsIn,
18749
+ sizing: _objectSpread2(_objectSpread2({}, defaultSizing), configIn.sizing),
18657
18750
  tokens,
18658
18751
  shorthands,
18659
18752
  userShorthands,
@@ -21269,6 +21362,7 @@ exports.createTokens = createTokens;
21269
21362
  exports.createVariable = createVariable;
21270
21363
  exports.cssShorthandLonghands = cssShorthandLonghands;
21271
21364
  exports.currentPlatform = currentPlatform;
21365
+ exports.defaultSizing = defaultSizing;
21272
21366
  exports.fluid = fluid;
21273
21367
  exports.forceUpdateThemes = forceUpdateThemes;
21274
21368
  exports.formatDiagnostic = formatDiagnostic;
@@ -21338,6 +21432,7 @@ exports.px = px;
21338
21432
  exports.registerLayoutNode = registerLayoutNode;
21339
21433
  exports.removeNativeStyleScope = removeNativeStyleScope;
21340
21434
  exports.reservedThemeProps = reservedThemeProps;
21435
+ exports.resolveSizing = resolveSizing;
21341
21436
  exports.resolveTextMetrics = resolveTextMetrics;
21342
21437
  exports.resolveThemeName = resolveThemeName;
21343
21438
  exports.setConfig = setConfig;
@@ -4603,6 +4603,100 @@ function mergeFrontendCondition(previous, value, condition) {
4603
4603
  };
4604
4604
  }
4605
4605
  //#endregion
4606
+ //#region ../web/dist/esm/helpers/resolveSizing.native.js
4607
+ var defaultSizing = {
4608
+ default: "md",
4609
+ sizes: {
4610
+ xs: {
4611
+ fontSize: "xs",
4612
+ controlFontSize: "xs",
4613
+ paddingInline: "2",
4614
+ paddingBlock: "1",
4615
+ gap: "1",
4616
+ radius: "sm"
4617
+ },
4618
+ sm: {
4619
+ fontSize: "sm",
4620
+ controlFontSize: "sm",
4621
+ paddingInline: "3",
4622
+ paddingBlock: "1.5",
4623
+ gap: "1.5",
4624
+ radius: "md"
4625
+ },
4626
+ md: {
4627
+ fontSize: "sm",
4628
+ controlFontSize: "base",
4629
+ paddingInline: "4",
4630
+ paddingBlock: "2",
4631
+ gap: "2",
4632
+ radius: "md"
4633
+ },
4634
+ lg: {
4635
+ fontSize: "base",
4636
+ controlFontSize: "lg",
4637
+ paddingInline: "6",
4638
+ paddingBlock: "2",
4639
+ gap: "2",
4640
+ radius: "md"
4641
+ },
4642
+ xl: {
4643
+ fontSize: "lg",
4644
+ controlFontSize: "xl",
4645
+ paddingInline: "8",
4646
+ paddingBlock: "2.5",
4647
+ gap: "2.5",
4648
+ radius: "lg"
4649
+ }
4650
+ }
4651
+ };
4652
+ var toPx$1 = function(value) {
4653
+ return typeof value === "number" ? value : Number.parseFloat(value);
4654
+ };
4655
+ function resolveSizing(size, env) {
4656
+ var _font_size, _font_size1, _font_lineHeight, _tokens_space;
4657
+ if (size === false) return void 0;
4658
+ var conf = (env === null || env === void 0 ? void 0 : env.fonts) && (env === null || env === void 0 ? void 0 : env.tokens) ? void 0 : getConfig();
4659
+ var _env_sizing;
4660
+ var sizing = _objectSpread2(_objectSpread2({}, defaultSizing), (_env_sizing = env === null || env === void 0 ? void 0 : env.sizing) !== null && _env_sizing !== void 0 ? _env_sizing : conf === null || conf === void 0 ? void 0 : conf.sizing);
4661
+ var name = size === true || size == null ? sizing.default : size;
4662
+ var rung = sizing.sizes[name];
4663
+ if (!rung) return void 0;
4664
+ var keys = {
4665
+ fontSize: rung.fontSize,
4666
+ lineHeight: rung.fontSize,
4667
+ paddingInline: rung.paddingInline,
4668
+ paddingBlock: rung.paddingBlock,
4669
+ gap: rung.gap,
4670
+ radius: rung.radius
4671
+ };
4672
+ if (rung.px) return _objectSpread2(_objectSpread2({ name }, keys), {}, {
4673
+ height: rung.px.height,
4674
+ icon: rung.px.icon,
4675
+ square: rung.px.square
4676
+ });
4677
+ var _env_fonts;
4678
+ var fonts = (_env_fonts = env === null || env === void 0 ? void 0 : env.fonts) !== null && _env_fonts !== void 0 ? _env_fonts : conf === null || conf === void 0 ? void 0 : conf.fontsParsed;
4679
+ var _env_tokens;
4680
+ var tokens = (_env_tokens = env === null || env === void 0 ? void 0 : env.tokens) !== null && _env_tokens !== void 0 ? _env_tokens : conf === null || conf === void 0 ? void 0 : conf.tokensParsed;
4681
+ var _conf_defaultFontToken, _env_font;
4682
+ var font = (_env_font = env === null || env === void 0 ? void 0 : env.font) !== null && _env_font !== void 0 ? _env_font : fonts === null || fonts === void 0 ? void 0 : fonts[(_conf_defaultFontToken = conf === null || conf === void 0 ? void 0 : conf.defaultFontToken) !== null && _conf_defaultFontToken !== void 0 ? _conf_defaultFontToken : "body"];
4683
+ var px = {
4684
+ fontSize: toPx$1(getVariableValue(font === null || font === void 0 ? void 0 : (_font_size = font.size) === null || _font_size === void 0 ? void 0 : _font_size[rung.fontSize])),
4685
+ control: toPx$1(getVariableValue(font === null || font === void 0 ? void 0 : (_font_size1 = font.size) === null || _font_size1 === void 0 ? void 0 : _font_size1[rung.controlFontSize])),
4686
+ lineHeight: toPx$1(getVariableValue(font === null || font === void 0 ? void 0 : (_font_lineHeight = font.lineHeight) === null || _font_lineHeight === void 0 ? void 0 : _font_lineHeight[rung.fontSize])),
4687
+ paddingBlock: toPx$1(getVariableValue(tokens === null || tokens === void 0 ? void 0 : (_tokens_space = tokens.space) === null || _tokens_space === void 0 ? void 0 : _tokens_space[rung.paddingBlock]))
4688
+ };
4689
+ if (!Object.values(px).every(Number.isFinite)) {
4690
+ if (globalThis.process.env.NODE_ENV === "development") console.warn(`[tamagui] size "${name}" references a missing token (fontSize "${rung.fontSize}", controlFontSize "${rung.controlFontSize}", paddingBlock "${rung.paddingBlock}"); resolving to no styles`);
4691
+ return;
4692
+ }
4693
+ return _objectSpread2(_objectSpread2({ name }, keys), {}, {
4694
+ height: px.lineHeight + px.paddingBlock * 2,
4695
+ icon: Math.ceil(px.fontSize / 4) * 4,
4696
+ square: Math.round(px.control * 1.4)
4697
+ });
4698
+ }
4699
+ //#endregion
4606
4700
  //#region ../web/dist/esm/helpers/styledDynamic.native.js
4607
4701
  var fontLanguageCache = /* @__PURE__ */ new WeakMap();
4608
4702
  function getFontsForLanguage(fonts, language) {
@@ -4729,6 +4823,7 @@ function getDynamicEnv(styleState) {
4729
4823
  fonts,
4730
4824
  tokens: conf.tokensParsed,
4731
4825
  theme,
4826
+ sizing: _objectSpread2(_objectSpread2({}, defaultSizing), conf.sizing),
4732
4827
  get fontFamily() {
4733
4828
  return getVariableValue(styleState.fontFamily || props.fontFamily) || props.fontFamily || getVariableValue(getSetting("defaultFont"));
4734
4829
  },
@@ -9873,6 +9968,7 @@ function createTamagui$2(configIn) {
9873
9968
  animations: resolvedDriver !== null && resolvedDriver !== void 0 ? resolvedDriver : defaultAnimationDriver,
9874
9969
  animationDrivers,
9875
9970
  settings: settingsIn,
9971
+ sizing: _objectSpread2(_objectSpread2({}, defaultSizing), configIn.sizing),
9876
9972
  tokens,
9877
9973
  shorthands,
9878
9974
  userShorthands,
@@ -12781,6 +12877,7 @@ exports.createTokens = createTokens;
12781
12877
  exports.createVariable = createVariable;
12782
12878
  exports.cssShorthandLonghands = cssShorthandLonghands;
12783
12879
  exports.currentPlatform = currentPlatform;
12880
+ exports.defaultSizing = defaultSizing;
12784
12881
  exports.fluid = fluid;
12785
12882
  exports.forceUpdateThemes = forceUpdateThemes;
12786
12883
  exports.formatDiagnostic = formatDiagnostic;
@@ -12850,6 +12947,7 @@ exports.px = px;
12850
12947
  exports.registerLayoutNode = registerLayoutNode;
12851
12948
  exports.removeNativeStyleScope = removeNativeStyleScope;
12852
12949
  exports.reservedThemeProps = reservedThemeProps;
12950
+ exports.resolveSizing = resolveSizing;
12853
12951
  exports.resolveTextMetrics = resolveTextMetrics;
12854
12952
  exports.resolveThemeName = resolveThemeName;
12855
12953
  exports.setConfig = setConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "3.0.0-beta.1352.1",
3
+ "version": "3.0.0-beta.1358.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -137,19 +137,19 @@
137
137
  "clean:build": "tamagui-build clean:build"
138
138
  },
139
139
  "dependencies": {
140
- "@tamagui/compose-refs": "3.0.0-beta.1352.1",
141
- "@tamagui/constants": "3.0.0-beta.1352.1",
142
- "@tamagui/helpers": "3.0.0-beta.1352.1",
143
- "@tamagui/react-native-media-driver": "3.0.0-beta.1352.1",
144
- "@tamagui/react-native-use-pressable": "3.0.0-beta.1352.1",
145
- "@tamagui/use-element-layout": "3.0.0-beta.1352.1",
146
- "@tamagui/use-event": "3.0.0-beta.1352.1",
147
- "@tamagui/web": "3.0.0-beta.1352.1"
140
+ "@tamagui/compose-refs": "3.0.0-beta.1358.1",
141
+ "@tamagui/constants": "3.0.0-beta.1358.1",
142
+ "@tamagui/helpers": "3.0.0-beta.1358.1",
143
+ "@tamagui/react-native-media-driver": "3.0.0-beta.1358.1",
144
+ "@tamagui/react-native-use-pressable": "3.0.0-beta.1358.1",
145
+ "@tamagui/use-element-layout": "3.0.0-beta.1358.1",
146
+ "@tamagui/use-event": "3.0.0-beta.1358.1",
147
+ "@tamagui/web": "3.0.0-beta.1358.1"
148
148
  },
149
149
  "devDependencies": {
150
- "@tamagui/build": "3.0.0-beta.1352.1",
151
- "@tamagui/native-bundle": "3.0.0-beta.1352.1",
152
- "@tamagui/react-native-web-lite": "3.0.0-beta.1352.1",
150
+ "@tamagui/build": "3.0.0-beta.1358.1",
151
+ "@tamagui/native-bundle": "3.0.0-beta.1358.1",
152
+ "@tamagui/react-native-web-lite": "3.0.0-beta.1358.1",
153
153
  "@testing-library/react": "^16.1.0",
154
154
  "csstype": "^3.0.10",
155
155
  "react": "19.2.3",