@tamagui/get-font-sized
Advanced tools
Comparing version 1.111.8 to 1.111.9
import { getTokens } from "@tamagui/core"; | ||
var getFontSized = function() { | ||
var sizeTokenIn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", { font, fontFamily, props } = arguments.length > 1 ? arguments[1] : void 0, _font_lineHeight, _font_weight, _font_letterSpacing, _font_transform, _font_style, _font_color; | ||
if (!font) | ||
return { | ||
var getFontSized = function () { | ||
var sizeTokenIn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", | ||
{ | ||
font, | ||
fontFamily, | ||
props | ||
} = arguments.length > 1 ? arguments[1] : void 0, | ||
_font_lineHeight, | ||
_font_weight, | ||
_font_letterSpacing, | ||
_font_transform, | ||
_font_style, | ||
_font_color; | ||
if (!font) return { | ||
fontSize: sizeTokenIn | ||
}; | ||
var sizeToken = sizeTokenIn === "$true" ? getDefaultSizeToken(font) : sizeTokenIn, style = {}, fontSize = font.size[sizeToken], lineHeight = (_font_lineHeight = font.lineHeight) === null || _font_lineHeight === void 0 ? void 0 : _font_lineHeight[sizeToken], fontWeight = (_font_weight = font.weight) === null || _font_weight === void 0 ? void 0 : _font_weight[sizeToken], letterSpacing = (_font_letterSpacing = font.letterSpacing) === null || _font_letterSpacing === void 0 ? void 0 : _font_letterSpacing[sizeToken], textTransform = (_font_transform = font.transform) === null || _font_transform === void 0 ? void 0 : _font_transform[sizeToken], _props_fontStyle, fontStyle = (_props_fontStyle = props.fontStyle) !== null && _props_fontStyle !== void 0 ? _props_fontStyle : (_font_style = font.style) === null || _font_style === void 0 ? void 0 : _font_style[sizeToken], _props_color, color = (_props_color = props.color) !== null && _props_color !== void 0 ? _props_color : (_font_color = font.color) === null || _font_color === void 0 ? void 0 : _font_color[sizeToken]; | ||
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), console.info({ | ||
style, | ||
props, | ||
font | ||
}), console.groupEnd()), style; | ||
}, cache = /* @__PURE__ */ new WeakMap(); | ||
var sizeToken = sizeTokenIn === "$true" ? getDefaultSizeToken(font) : sizeTokenIn, | ||
style = {}, | ||
fontSize = font.size[sizeToken], | ||
lineHeight = (_font_lineHeight = font.lineHeight) === null || _font_lineHeight === void 0 ? void 0 : _font_lineHeight[sizeToken], | ||
fontWeight = (_font_weight = font.weight) === null || _font_weight === void 0 ? void 0 : _font_weight[sizeToken], | ||
letterSpacing = (_font_letterSpacing = font.letterSpacing) === null || _font_letterSpacing === void 0 ? void 0 : _font_letterSpacing[sizeToken], | ||
textTransform = (_font_transform = font.transform) === null || _font_transform === void 0 ? void 0 : _font_transform[sizeToken], | ||
_props_fontStyle, | ||
fontStyle = (_props_fontStyle = props.fontStyle) !== null && _props_fontStyle !== void 0 ? _props_fontStyle : (_font_style = font.style) === null || _font_style === void 0 ? void 0 : _font_style[sizeToken], | ||
_props_color, | ||
color = (_props_color = props.color) !== null && _props_color !== void 0 ? _props_color : (_font_color = font.color) === null || _font_color === void 0 ? void 0 : _font_color[sizeToken]; | ||
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), console.info({ | ||
style, | ||
props, | ||
font | ||
}), console.groupEnd()), style; | ||
}, | ||
cache = /* @__PURE__ */new WeakMap(); | ||
function getDefaultSizeToken(font) { | ||
if (typeof font == "object" && cache.has(font)) | ||
return cache.get(font); | ||
var sizeTokens = "$true" in font.size ? font.size : getTokens().size, sizeDefault = sizeTokens.$true, sizeDefaultSpecific = sizeDefault ? Object.keys(sizeTokens).find(function(x) { | ||
return x !== "$true" && sizeTokens[x].val === sizeDefault.val; | ||
}) : null; | ||
if (typeof font == "object" && cache.has(font)) return cache.get(font); | ||
var sizeTokens = "$true" in font.size ? font.size : getTokens().size, | ||
sizeDefault = sizeTokens.$true, | ||
sizeDefaultSpecific = sizeDefault ? Object.keys(sizeTokens).find(function (x) { | ||
return x !== "$true" && sizeTokens[x].val === sizeDefault.val; | ||
}) : null; | ||
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. | ||
@@ -26,5 +48,3 @@ | ||
} | ||
export { | ||
getFontSized | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
export { getFontSized }; | ||
//# sourceMappingURL=index.native.js.map |
{ | ||
"name": "@tamagui/get-font-sized", | ||
"version": "1.111.8", | ||
"version": "1.111.9", | ||
"types": "./types/index.d.ts", | ||
@@ -23,3 +23,3 @@ "main": "dist/cjs", | ||
".": { | ||
"react-native-import": "./dist/esm/index.native.mjs", | ||
"react-native-import": "./dist/esm/index.native.js", | ||
"react-native": "./dist/cjs/index.native.js", | ||
@@ -32,6 +32,6 @@ "types": "./types/index.d.ts", | ||
"dependencies": { | ||
"@tamagui/core": "1.111.8" | ||
"@tamagui/core": "1.111.9" | ||
}, | ||
"devDependencies": { | ||
"@tamagui/build": "1.111.8", | ||
"@tamagui/build": "1.111.9", | ||
"react": "^18.2.0 || ^19.0.0" | ||
@@ -38,0 +38,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11
30208
15
276
+ Added@tamagui/compose-refs@1.111.9(transitive)
+ Added@tamagui/constants@1.111.9(transitive)
+ Added@tamagui/core@1.111.9(transitive)
+ Added@tamagui/helpers@1.111.9(transitive)
+ Added@tamagui/normalize-css-color@1.111.9(transitive)
+ Added@tamagui/react-native-use-pressable@1.111.9(transitive)
+ Added@tamagui/react-native-use-responder-events@1.111.9(transitive)
+ Added@tamagui/simple-hash@1.111.9(transitive)
+ Added@tamagui/timer@1.111.9(transitive)
+ Added@tamagui/types@1.111.9(transitive)
+ Added@tamagui/use-did-finish-ssr@1.111.9(transitive)
+ Added@tamagui/use-event@1.111.9(transitive)
+ Added@tamagui/use-force-update@1.111.9(transitive)
+ Added@tamagui/web@1.111.9(transitive)
- Removed@tamagui/compose-refs@1.111.8(transitive)
- Removed@tamagui/constants@1.111.8(transitive)
- Removed@tamagui/core@1.111.8(transitive)
- Removed@tamagui/helpers@1.111.8(transitive)
- Removed@tamagui/normalize-css-color@1.111.8(transitive)
- Removed@tamagui/react-native-use-pressable@1.111.8(transitive)
- Removed@tamagui/react-native-use-responder-events@1.111.8(transitive)
- Removed@tamagui/simple-hash@1.111.8(transitive)
- Removed@tamagui/timer@1.111.8(transitive)
- Removed@tamagui/types@1.111.8(transitive)
- Removed@tamagui/use-did-finish-ssr@1.111.8(transitive)
- Removed@tamagui/use-event@1.111.8(transitive)
- Removed@tamagui/use-force-update@1.111.8(transitive)
- Removed@tamagui/web@1.111.8(transitive)
Updated@tamagui/core@1.111.9