@tamagui/font-size 1.27.2 → 1.28.0
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/package.json +3 -3
- package/dist/esm/getFontSize.mjs +0 -48
- package/dist/esm/index.mjs +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/font-size",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"lint:fix": "../../node_modules/.bin/rome check --apply src"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tamagui/core": "1.
|
|
22
|
+
"@tamagui/core": "1.28.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "*"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tamagui/build": "1.
|
|
28
|
+
"@tamagui/build": "1.28.0",
|
|
29
29
|
"react": "^18.2.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
package/dist/esm/getFontSize.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { getConfig, isVariable } from "@tamagui/core";
|
|
2
|
-
const getFontSize = (inSize, opts) => {
|
|
3
|
-
const res = getFontSizeVariable(inSize, opts);
|
|
4
|
-
if (isVariable(res)) {
|
|
5
|
-
return +res.val;
|
|
6
|
-
}
|
|
7
|
-
return res ? +res : 16;
|
|
8
|
-
};
|
|
9
|
-
const getFontSizeVariable = (inSize, opts) => {
|
|
10
|
-
const token = getFontSizeToken(inSize, opts);
|
|
11
|
-
if (!token) {
|
|
12
|
-
return inSize;
|
|
13
|
-
}
|
|
14
|
-
const conf = getConfig();
|
|
15
|
-
return conf.fontsParsed[(opts == null ? void 0 : opts.font) || "$body"].size[token];
|
|
16
|
-
};
|
|
17
|
-
const getFontSizeToken = (inSize, opts) => {
|
|
18
|
-
if (typeof inSize === "number") {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
const relativeSize = (opts == null ? void 0 : opts.relativeSize) || 0;
|
|
22
|
-
const conf = getConfig();
|
|
23
|
-
const fontSize = conf.fontsParsed[(opts == null ? void 0 : opts.font) || "$body"].size;
|
|
24
|
-
const size = inSize || ("$true" in fontSize ? "$true" : "$4");
|
|
25
|
-
const sizeTokens = Object.keys(fontSize);
|
|
26
|
-
let foundIndex = sizeTokens.indexOf(size);
|
|
27
|
-
if (foundIndex === -1) {
|
|
28
|
-
if (size.endsWith(".5")) {
|
|
29
|
-
foundIndex = sizeTokens.indexOf(size.replace(".5", ""));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (process.env.NODE_ENV === "development") {
|
|
33
|
-
if (foundIndex === -1) {
|
|
34
|
-
console.warn("No font size found", size, opts, "in size tokens", sizeTokens);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const tokenIndex = Math.min(
|
|
38
|
-
Math.max(0, foundIndex + relativeSize),
|
|
39
|
-
sizeTokens.length - 1
|
|
40
|
-
);
|
|
41
|
-
return sizeTokens[tokenIndex] ?? size;
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
getFontSize,
|
|
45
|
-
getFontSizeToken,
|
|
46
|
-
getFontSizeVariable
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=getFontSize.mjs.map
|
package/dist/esm/index.mjs
DELETED