@tamagui/get-font-sized 1.116.1 → 1.116.3

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.
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var src_exports = {};
16
+ __export(src_exports, {
17
+ getFontSized: () => getFontSized
18
+ });
19
+ module.exports = __toCommonJS(src_exports);
20
+ var import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core");
21
+ const getFontSized = (sizeTokenIn = "$true", { font, fontFamily, props }) => {
22
+ if (!font)
23
+ return {
24
+ fontSize: sizeTokenIn
25
+ };
26
+ const sizeToken = sizeTokenIn === "$true" ? getDefaultSizeToken(font) : sizeTokenIn, style = {}, fontSize = font.size[sizeToken], lineHeight = font.lineHeight?.[sizeToken], fontWeight = font.weight?.[sizeToken], letterSpacing = font.letterSpacing?.[sizeToken], textTransform = font.transform?.[sizeToken], fontStyle = props.fontStyle ?? font.style?.[sizeToken], color = props.color ?? font.color?.[sizeToken];
27
+ return fontStyle && (style.fontStyle = fontStyle), textTransform && (style.textTransform = textTransform), fontFamily && (style.fontFamily = fontFamily), fontWeight && (style.fontWeight = fontWeight), letterSpacing && (style.letterSpacing = letterSpacing), fontSize && (style.fontSize = fontSize), lineHeight && (style.lineHeight = lineHeight), color && (style.color = color), process.env.NODE_ENV === "development" && props.debug && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} getFontSized", sizeTokenIn, sizeToken), import_constants.isClient && console.info({ style, props, font }), console.groupEnd()), style;
28
+ }, cache = /* @__PURE__ */ new WeakMap();
29
+ function getDefaultSizeToken(font) {
30
+ if (typeof font == "object" && cache.has(font))
31
+ return cache.get(font);
32
+ const sizeTokens = "$true" in font.size ? font.size : (0, import_core.getTokens)().size, sizeDefault = sizeTokens.$true, sizeDefaultSpecific = sizeDefault ? Object.keys(sizeTokens).find(
33
+ (x) => x !== "$true" && sizeTokens[x].val === sizeDefault.val
34
+ ) : null;
35
+ return !sizeDefault || !sizeDefaultSpecific ? (process.env.NODE_ENV === "development" && console.warn(`No default size is set in your tokens for the "true" key, fonts will be inconsistent.
36
+
37
+ Fix this by having consistent tokens across fonts and sizes and setting a true key for your size tokens, or
38
+ set true keys for all your font tokens: "size", "lineHeight", "fontStyle", etc.`), Object.keys(font.size)[3]) : (cache.set(font, sizeDefaultSpecific), sizeDefaultSpecific);
39
+ }
40
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/get-font-sized",
3
- "version": "1.116.1",
3
+ "version": "1.116.3",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@tamagui/constants": "1.116.1",
33
- "@tamagui/core": "1.116.1"
32
+ "@tamagui/constants": "1.116.3",
33
+ "@tamagui/core": "1.116.3"
34
34
  },
35
35
  "devDependencies": {
36
- "@tamagui/build": "1.116.1",
36
+ "@tamagui/build": "1.116.3",
37
37
  "react": "^18.2.0 || ^19.0.0"
38
38
  },
39
39
  "publishConfig": {
File without changes