@tamagui/font-size
Advanced tools
Comparing version 1.111.8 to 1.111.9
import { getConfig, isVariable } from "@tamagui/core"; | ||
var getFontSize = function(inSize, opts) { | ||
var res = getFontSizeVariable(inSize, opts); | ||
return isVariable(res) ? +res.val : res ? +res : 16; | ||
}, getFontSizeVariable = function(inSize, opts) { | ||
var token = getFontSizeToken(inSize, opts); | ||
if (!token) | ||
return inSize; | ||
var conf = getConfig(); | ||
return conf.fontsParsed[opts?.font || conf.defaultFontToken].size[token]; | ||
}, getFontSizeToken = function(inSize, opts) { | ||
if (typeof inSize == "number") | ||
return null; | ||
var relativeSize = opts?.relativeSize || 0, conf = getConfig(), fontSize = conf.fontsParsed[opts?.font || conf.defaultFontToken].size, _ref, size = (_ref = inSize === "$true" && !("$true" in fontSize) ? "$4" : inSize) !== null && _ref !== void 0 ? _ref : "$true" in fontSize ? "$true" : "$4", sizeTokens = Object.keys(fontSize), foundIndex = sizeTokens.indexOf(size); | ||
foundIndex === -1 && size.endsWith(".5") && (foundIndex = sizeTokens.indexOf(size.replace(".5", ""))), process.env.NODE_ENV === "development" && foundIndex === -1 && console.warn("No font size found", size, opts, "in size tokens", sizeTokens); | ||
var tokenIndex = Math.min(Math.max(0, foundIndex + relativeSize), sizeTokens.length - 1), _sizeTokens_tokenIndex; | ||
return (_sizeTokens_tokenIndex = sizeTokens[tokenIndex]) !== null && _sizeTokens_tokenIndex !== void 0 ? _sizeTokens_tokenIndex : size; | ||
}; | ||
export { | ||
getFontSize, | ||
getFontSizeToken, | ||
getFontSizeVariable | ||
}; | ||
//# sourceMappingURL=getFontSize.js.map | ||
var getFontSize = function (inSize, opts) { | ||
var res = getFontSizeVariable(inSize, opts); | ||
return isVariable(res) ? +res.val : res ? +res : 16; | ||
}, | ||
getFontSizeVariable = function (inSize, opts) { | ||
var token = getFontSizeToken(inSize, opts); | ||
if (!token) return inSize; | ||
var conf = getConfig(); | ||
return conf.fontsParsed[opts?.font || conf.defaultFontToken].size[token]; | ||
}, | ||
getFontSizeToken = function (inSize, opts) { | ||
if (typeof inSize == "number") return null; | ||
var relativeSize = opts?.relativeSize || 0, | ||
conf = getConfig(), | ||
fontSize = conf.fontsParsed[opts?.font || conf.defaultFontToken].size, | ||
_ref, | ||
size = (_ref = inSize === "$true" && !("$true" in fontSize) ? "$4" : inSize) !== null && _ref !== void 0 ? _ref : "$true" in fontSize ? "$true" : "$4", | ||
sizeTokens = Object.keys(fontSize), | ||
foundIndex = sizeTokens.indexOf(size); | ||
foundIndex === -1 && size.endsWith(".5") && (foundIndex = sizeTokens.indexOf(size.replace(".5", ""))), process.env.NODE_ENV === "development" && foundIndex === -1 && console.warn("No font size found", size, opts, "in size tokens", sizeTokens); | ||
var tokenIndex = Math.min(Math.max(0, foundIndex + relativeSize), sizeTokens.length - 1), | ||
_sizeTokens_tokenIndex; | ||
return (_sizeTokens_tokenIndex = sizeTokens[tokenIndex]) !== null && _sizeTokens_tokenIndex !== void 0 ? _sizeTokens_tokenIndex : size; | ||
}; | ||
export { getFontSize, getFontSizeToken, getFontSizeVariable }; | ||
//# sourceMappingURL=getFontSize.native.js.map |
@@ -1,2 +0,2 @@ | ||
export * from "./getFontSize"; | ||
//# sourceMappingURL=index.js.map | ||
export * from "./getFontSize.native.js"; | ||
//# sourceMappingURL=index.native.js.map |
{ | ||
"name": "@tamagui/font-size", | ||
"version": "1.111.8", | ||
"version": "1.111.9", | ||
"sideEffects": false, | ||
@@ -18,3 +18,3 @@ "source": "src/index.ts", | ||
".": { | ||
"react-native-import": "./dist/esm/index.native.mjs", | ||
"react-native-import": "./dist/esm/index.native.js", | ||
"react-native": "./dist/cjs/index.native.js", | ||
@@ -34,6 +34,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" | ||
@@ -40,0 +40,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
37848
396
+ 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