@tamagui/font-size 1.0.1-beta.78 → 1.0.1-beta.79
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/jsx/getFontSize.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/getFontSize.ts"],
|
|
4
|
+
"sourcesContent": ["import { FontSizeTokens, FontTokens, getConfig, getTokens, isVariable } from '@tamagui/core'\n\ntype GetFontSizeOpts = {\n relativeSize?: number\n font?: FontTokens\n}\n\nexport const getFontSize = (\n inSize: FontSizeTokens | null | undefined,\n opts?: GetFontSizeOpts\n): number => {\n const res = getFontSizeVariable(inSize, opts)\n if (isVariable(res)) {\n return +res.val\n }\n return res ? +res : 16\n}\n\nexport const getFontSizeVariable = (\n inSize: FontSizeTokens | null | undefined,\n opts?: GetFontSizeOpts\n) => {\n const token = getFontSizeToken(inSize, opts)\n if (!token) {\n return inSize\n }\n const conf = getConfig()\n return conf.fontsParsed[opts?.font || '$body'].size[token]\n}\n\nexport const getFontSizeToken = (\n inSize: FontSizeTokens | null | undefined,\n opts?: GetFontSizeOpts\n): FontSizeTokens | null => {\n if (typeof inSize === 'number') {\n return null\n }\n const size = inSize || '$4'\n const relativeSize = opts?.relativeSize || 0\n const conf = getConfig()\n const fontSize = conf.fontsParsed[opts?.font || '$body'].size\n const sizeTokens = Object.keys(fontSize)\n let foundIndex = sizeTokens.indexOf(size)\n if (foundIndex === -1) {\n if (size.endsWith('.5')) {\n foundIndex = sizeTokens.indexOf(size.replace('.5', ''))\n }\n }\n if (process.env.NODE_ENV === 'development') {\n if (foundIndex === -1) {\n console.warn('No font size found', inSize, opts, 'in size tokens', sizeTokens)\n }\n }\n const tokenIndex = Math.min(Math.max(0, foundIndex + relativeSize), sizeTokens.length - 1)\n return (sizeTokens[tokenIndex] ?? size) as FontSizeTokens\n}\n"],
|
|
5
|
+
"mappings": "AAAA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size",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.79",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"watch": "tamagui-build --watch"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
20
|
+
"@tamagui/core": "^1.0.1-beta.79"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": "*",
|
|
24
24
|
"react-dom": "*"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
27
|
+
"@tamagui/build": "^1.0.1-beta.79",
|
|
28
28
|
"react": "*",
|
|
29
29
|
"react-dom": "*"
|
|
30
30
|
},
|