Socket
Socket
Sign inDemoInstall

@tamagui/get-font-sized

Package Overview
Dependencies
Maintainers
1
Versions
902
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tamagui/get-font-sized - npm Package Compare versions

Comparing version 1.113.1 to 1.113.2

60

dist/esm/index.native.js
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.

@@ -48,3 +26,5 @@

}
export { getFontSized };
//# sourceMappingURL=index.native.js.map
export {
getFontSized
};
//# sourceMappingURL=index.js.map
{
"name": "@tamagui/get-font-sized",
"version": "1.113.1",
"version": "1.113.2",
"types": "./types/index.d.ts",

@@ -31,6 +31,6 @@ "main": "dist/cjs",

"dependencies": {
"@tamagui/core": "1.113.1"
"@tamagui/core": "1.113.2"
},
"devDependencies": {
"@tamagui/build": "1.113.1",
"@tamagui/build": "1.113.2",
"react": "^18.2.0 || ^19.0.0"

@@ -37,0 +37,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc