@tamagui/create-system-font 0.0.0-bootstrap.0 → 3.0.0-beta.637.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,95 @@
1
+
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ createSystemFont: () => createSystemFont,
25
+ defaultSystemFontLineHeight: () => defaultSystemFontLineHeight,
26
+ defaultSystemFontSizes: () => defaultSystemFontSizes,
27
+ nativeSystemFontSizes: () => nativeSystemFontSizes,
28
+ systemFontFamily: () => systemFontFamily,
29
+ webSystemFontSizes: () => webSystemFontSizes
30
+ });
31
+ module.exports = __toCommonJS(index_exports);
32
+ var import_core = require("@tamagui/core");
33
+ const systemFontFamily = {
34
+ web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
35
+ native: "System"
36
+ };
37
+ const webSystemFontSizes = {
38
+ 1: 12,
39
+ 2: 13,
40
+ 3: 14,
41
+ 4: 15,
42
+ 5: 16,
43
+ 6: 18,
44
+ 7: 22,
45
+ 8: 26,
46
+ 9: 30,
47
+ 10: 40,
48
+ 11: 46,
49
+ 12: 52,
50
+ 13: 60,
51
+ 14: 70,
52
+ 15: 85,
53
+ 16: 100
54
+ };
55
+ const nativeSystemFontSizes = {
56
+ 1: 11,
57
+ 2: 12,
58
+ 3: 15,
59
+ 4: 17,
60
+ 5: 20,
61
+ 6: 22,
62
+ 7: 24,
63
+ 8: 28,
64
+ 9: 32,
65
+ 10: 40,
66
+ 11: 46,
67
+ 12: 52,
68
+ 13: 60,
69
+ 14: 70,
70
+ 15: 85,
71
+ 16: 100
72
+ };
73
+ const defaultSystemFontSizes = webSystemFontSizes;
74
+ const defaultSystemFontLineHeight = (size) => {
75
+ const ratio = 1.5 - Math.max(0, (size - 20) * .004);
76
+ return Math.round(size * ratio);
77
+ };
78
+ const createSystemFont = (options = {}) => {
79
+ const { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = (size2) => Math.round(size2), family = systemFontFamily.web, weight = { 1: "400" }, letterSpacing = { 4: 0 } } = options;
80
+ const font = options.font;
81
+ const sizes = options.sizes ?? defaultSystemFontSizes;
82
+ const fontSizes = font?.size ?? {};
83
+ const size = Object.fromEntries(Object.entries({
84
+ ...sizes,
85
+ ...fontSizes
86
+ }).map(([key, value]) => [key, sizeSize(+value)]));
87
+ return (0, import_core.createFont)({
88
+ family,
89
+ lineHeight: Object.fromEntries(Object.entries(size).map(([key, value]) => [key, sizeLineHeight((0, import_core.getVariableValue)(value))])),
90
+ weight,
91
+ letterSpacing,
92
+ ...font,
93
+ size
94
+ });
95
+ };
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var index_exports = {};
25
+ __export(index_exports, {
26
+ createSystemFont: () => createSystemFont,
27
+ defaultSystemFontLineHeight: () => defaultSystemFontLineHeight,
28
+ defaultSystemFontSizes: () => defaultSystemFontSizes,
29
+ nativeSystemFontSizes: () => nativeSystemFontSizes,
30
+ systemFontFamily: () => systemFontFamily,
31
+ webSystemFontSizes: () => webSystemFontSizes
32
+ });
33
+ module.exports = __toCommonJS(index_exports);
34
+ var import_core = require("@tamagui/core");
35
+ var isWeb = false;
36
+ var isNative = true;
37
+ var systemFontFamily = {
38
+ web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
39
+ native: "System"
40
+ };
41
+ var webSystemFontSizes = {
42
+ 1: 12,
43
+ 2: 13,
44
+ 3: 14,
45
+ 4: 15,
46
+ 5: 16,
47
+ 6: 18,
48
+ 7: 22,
49
+ 8: 26,
50
+ 9: 30,
51
+ 10: 40,
52
+ 11: 46,
53
+ 12: 52,
54
+ 13: 60,
55
+ 14: 70,
56
+ 15: 85,
57
+ 16: 100
58
+ };
59
+ var nativeSystemFontSizes = {
60
+ 1: 11,
61
+ 2: 12,
62
+ 3: 15,
63
+ 4: 17,
64
+ 5: 20,
65
+ 6: 22,
66
+ 7: 24,
67
+ 8: 28,
68
+ 9: 32,
69
+ 10: 40,
70
+ 11: 46,
71
+ 12: 52,
72
+ 13: 60,
73
+ 14: 70,
74
+ 15: 85,
75
+ 16: 100
76
+ };
77
+ var defaultSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes;
78
+ var defaultSystemFontLineHeight = function(size) {
79
+ if (isNative) return Math.round(size + 5);
80
+ var ratio = 1.5 - Math.max(0, (size - 20) * .004);
81
+ return Math.round(size * ratio);
82
+ };
83
+ var createSystemFont = function() {
84
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
85
+ var { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = function(size2) {
86
+ return Math.round(size2);
87
+ }, family = isWeb ? systemFontFamily.web : systemFontFamily.native, weight = { 1: "400" }, letterSpacing = { 4: 0 } } = options;
88
+ var font = options.font;
89
+ var _options_sizes;
90
+ var sizes = (_options_sizes = options.sizes) !== null && _options_sizes !== void 0 ? _options_sizes : defaultSystemFontSizes;
91
+ var _font_size;
92
+ var fontSizes = (_font_size = font === null || font === void 0 ? void 0 : font.size) !== null && _font_size !== void 0 ? _font_size : {};
93
+ var size = Object.fromEntries(Object.entries({
94
+ ...sizes,
95
+ ...fontSizes
96
+ }).map(function(param) {
97
+ var [key, value] = param;
98
+ return [key, sizeSize(+value)];
99
+ }));
100
+ return (0, import_core.createFont)({
101
+ family,
102
+ lineHeight: Object.fromEntries(Object.entries(size).map(function(param) {
103
+ var [key, value] = param;
104
+ return [key, sizeLineHeight((0, import_core.getVariableValue)(value))];
105
+ })),
106
+ weight,
107
+ letterSpacing,
108
+ ...font,
109
+ size
110
+ });
111
+ };
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var index_exports = {};
25
+ __export(index_exports, {
26
+ createSystemFont: () => createSystemFont,
27
+ defaultSystemFontLineHeight: () => defaultSystemFontLineHeight,
28
+ defaultSystemFontSizes: () => defaultSystemFontSizes,
29
+ nativeSystemFontSizes: () => nativeSystemFontSizes,
30
+ systemFontFamily: () => systemFontFamily,
31
+ webSystemFontSizes: () => webSystemFontSizes
32
+ });
33
+ module.exports = __toCommonJS(index_exports);
34
+ var import_core = require("@tamagui/core");
35
+ var isWeb = false;
36
+ var isNative = true;
37
+ var systemFontFamily = {
38
+ web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
39
+ native: "System"
40
+ };
41
+ var webSystemFontSizes = {
42
+ 1: 12,
43
+ 2: 13,
44
+ 3: 14,
45
+ 4: 15,
46
+ 5: 16,
47
+ 6: 18,
48
+ 7: 22,
49
+ 8: 26,
50
+ 9: 30,
51
+ 10: 40,
52
+ 11: 46,
53
+ 12: 52,
54
+ 13: 60,
55
+ 14: 70,
56
+ 15: 85,
57
+ 16: 100
58
+ };
59
+ var nativeSystemFontSizes = {
60
+ 1: 11,
61
+ 2: 12,
62
+ 3: 15,
63
+ 4: 17,
64
+ 5: 20,
65
+ 6: 22,
66
+ 7: 24,
67
+ 8: 28,
68
+ 9: 32,
69
+ 10: 40,
70
+ 11: 46,
71
+ 12: 52,
72
+ 13: 60,
73
+ 14: 70,
74
+ 15: 85,
75
+ 16: 100
76
+ };
77
+ var defaultSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes;
78
+ var defaultSystemFontLineHeight = function(size) {
79
+ if (isNative) return Math.round(size + 5);
80
+ var ratio = 1.5 - Math.max(0, (size - 20) * .004);
81
+ return Math.round(size * ratio);
82
+ };
83
+ var createSystemFont = function() {
84
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
85
+ var { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = function(size2) {
86
+ return Math.round(size2);
87
+ }, family = isWeb ? systemFontFamily.web : systemFontFamily.native, weight = { 1: "400" }, letterSpacing = { 4: 0 } } = options;
88
+ var font = options.font;
89
+ var _options_sizes;
90
+ var sizes = (_options_sizes = options.sizes) !== null && _options_sizes !== void 0 ? _options_sizes : defaultSystemFontSizes;
91
+ var _font_size;
92
+ var fontSizes = (_font_size = font === null || font === void 0 ? void 0 : font.size) !== null && _font_size !== void 0 ? _font_size : {};
93
+ var size = Object.fromEntries(Object.entries({
94
+ ...sizes,
95
+ ...fontSizes
96
+ }).map(function(param) {
97
+ var [key, value] = param;
98
+ return [key, sizeSize(+value)];
99
+ }));
100
+ return (0, import_core.createFont)({
101
+ family,
102
+ lineHeight: Object.fromEntries(Object.entries(size).map(function(param) {
103
+ var [key, value] = param;
104
+ return [key, sizeLineHeight((0, import_core.getVariableValue)(value))];
105
+ })),
106
+ weight,
107
+ letterSpacing,
108
+ ...font,
109
+ size
110
+ });
111
+ };
112
+
113
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n\tcreateSystemFont: () => createSystemFont,\n\tdefaultSystemFontLineHeight: () => defaultSystemFontLineHeight,\n\tdefaultSystemFontSizes: () => defaultSystemFontSizes,\n\tnativeSystemFontSizes: () => nativeSystemFontSizes,\n\tsystemFontFamily: () => systemFontFamily,\n\twebSystemFontSizes: () => webSystemFontSizes\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_core = require(\"@tamagui/core\");\nvar isWeb = false;\nvar isNative = true;\nvar systemFontFamily = {\n\tweb: \"-apple-system, system-ui, BlinkMacSystemFont, \\\"Segoe UI\\\", Roboto, Helvetica, Arial, sans-serif\",\n\tnative: \"System\"\n};\nvar webSystemFontSizes = {\n\t1: 12,\n\t2: 13,\n\t3: 14,\n\t4: 15,\n\t5: 16,\n\t6: 18,\n\t7: 22,\n\t8: 26,\n\t9: 30,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nvar nativeSystemFontSizes = {\n\t1: 11,\n\t2: 12,\n\t3: 15,\n\t4: 17,\n\t5: 20,\n\t6: 22,\n\t7: 24,\n\t8: 28,\n\t9: 32,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nvar defaultSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes;\nvar defaultSystemFontLineHeight = function(size) {\n\tif (isNative) return Math.round(size + 5);\n\tvar ratio = 1.5 - Math.max(0, (size - 20) * .004);\n\treturn Math.round(size * ratio);\n};\nvar createSystemFont = function() {\n\tvar options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n\tvar { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = function(size2) {\n\t\treturn Math.round(size2);\n\t}, family = isWeb ? systemFontFamily.web : systemFontFamily.native, weight = { 1: \"400\" }, letterSpacing = { 4: 0 } } = options;\n\tvar font = options.font;\n\tvar _options_sizes;\n\tvar sizes = (_options_sizes = options.sizes) !== null && _options_sizes !== void 0 ? _options_sizes : defaultSystemFontSizes;\n\tvar _font_size;\n\tvar fontSizes = (_font_size = font === null || font === void 0 ? void 0 : font.size) !== null && _font_size !== void 0 ? _font_size : {};\n\tvar size = Object.fromEntries(Object.entries({\n\t\t...sizes,\n\t\t...fontSizes\n\t}).map(function(param) {\n\t\tvar [key, value] = param;\n\t\treturn [key, sizeSize(+value)];\n\t}));\n\treturn (0, import_core.createFont)({\n\t\tfamily,\n\t\tlineHeight: Object.fromEntries(Object.entries(size).map(function(param) {\n\t\t\tvar [key, value] = param;\n\t\t\treturn [key, sizeLineHeight((0, import_core.getVariableValue)(value))];\n\t\t})),\n\t\tweight,\n\t\tletterSpacing,\n\t\t...font,\n\t\tsize\n\t});\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":"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"}
@@ -0,0 +1,68 @@
1
+ import { createFont, getVariableValue } from "@tamagui/core";
2
+
3
+ const systemFontFamily = {
4
+ web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
5
+ native: "System"
6
+ };
7
+ const webSystemFontSizes = {
8
+ 1: 12,
9
+ 2: 13,
10
+ 3: 14,
11
+ 4: 15,
12
+ 5: 16,
13
+ 6: 18,
14
+ 7: 22,
15
+ 8: 26,
16
+ 9: 30,
17
+ 10: 40,
18
+ 11: 46,
19
+ 12: 52,
20
+ 13: 60,
21
+ 14: 70,
22
+ 15: 85,
23
+ 16: 100
24
+ };
25
+ const nativeSystemFontSizes = {
26
+ 1: 11,
27
+ 2: 12,
28
+ 3: 15,
29
+ 4: 17,
30
+ 5: 20,
31
+ 6: 22,
32
+ 7: 24,
33
+ 8: 28,
34
+ 9: 32,
35
+ 10: 40,
36
+ 11: 46,
37
+ 12: 52,
38
+ 13: 60,
39
+ 14: 70,
40
+ 15: 85,
41
+ 16: 100
42
+ };
43
+ const defaultSystemFontSizes = webSystemFontSizes;
44
+ const defaultSystemFontLineHeight = (size) => {
45
+ const ratio = 1.5 - Math.max(0, (size - 20) * .004);
46
+ return Math.round(size * ratio);
47
+ };
48
+ const createSystemFont = (options = {}) => {
49
+ const { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = (size2) => Math.round(size2), family = systemFontFamily.web, weight = { 1: "400" }, letterSpacing = { 4: 0 } } = options;
50
+ const font = options.font;
51
+ const sizes = options.sizes ?? defaultSystemFontSizes;
52
+ const fontSizes = font?.size ?? {};
53
+ const size = Object.fromEntries(Object.entries({
54
+ ...sizes,
55
+ ...fontSizes
56
+ }).map(([key, value]) => [key, sizeSize(+value)]));
57
+ return createFont({
58
+ family,
59
+ lineHeight: Object.fromEntries(Object.entries(size).map(([key, value]) => [key, sizeLineHeight(getVariableValue(value))])),
60
+ weight,
61
+ letterSpacing,
62
+ ...font,
63
+ size
64
+ });
65
+ };
66
+
67
+ export { createSystemFont, defaultSystemFontLineHeight, defaultSystemFontSizes, nativeSystemFontSizes, systemFontFamily, webSystemFontSizes };
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { createFont, getVariableValue } from \"@tamagui/core\";\n\nconst systemFontFamily = {\n\tweb: \"-apple-system, system-ui, BlinkMacSystemFont, \\\"Segoe UI\\\", Roboto, Helvetica, Arial, sans-serif\",\n\tnative: \"System\"\n};\nconst webSystemFontSizes = {\n\t1: 12,\n\t2: 13,\n\t3: 14,\n\t4: 15,\n\t5: 16,\n\t6: 18,\n\t7: 22,\n\t8: 26,\n\t9: 30,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nconst nativeSystemFontSizes = {\n\t1: 11,\n\t2: 12,\n\t3: 15,\n\t4: 17,\n\t5: 20,\n\t6: 22,\n\t7: 24,\n\t8: 28,\n\t9: 32,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nconst defaultSystemFontSizes = webSystemFontSizes;\nconst defaultSystemFontLineHeight = (size) => {\n\tconst ratio = 1.5 - Math.max(0, (size - 20) * .004);\n\treturn Math.round(size * ratio);\n};\nconst createSystemFont = (options = {}) => {\n\tconst { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = (size2) => Math.round(size2), family = systemFontFamily.web, weight = { 1: \"400\" }, letterSpacing = { 4: 0 } } = options;\n\tconst font = options.font;\n\tconst sizes = options.sizes ?? defaultSystemFontSizes;\n\tconst fontSizes = font?.size ?? {};\n\tconst size = Object.fromEntries(Object.entries({\n\t\t...sizes,\n\t\t...fontSizes\n\t}).map(([key, value]) => [key, sizeSize(+value)]));\n\treturn createFont({\n\t\tfamily,\n\t\tlineHeight: Object.fromEntries(Object.entries(size).map(([key, value]) => [key, sizeLineHeight(getVariableValue(value))])),\n\t\tweight,\n\t\tletterSpacing,\n\t\t...font,\n\t\tsize\n\t});\n};\n\nexport { createSystemFont, defaultSystemFontLineHeight, defaultSystemFontSizes, nativeSystemFontSizes, systemFontFamily, webSystemFontSizes };"],"mappings":";;;AAEA,MAAM,mBAAmB;CACxB,KAAK;CACL,QAAQ;AACT;AACA,MAAM,qBAAqB;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;AACA,MAAM,wBAAwB;CAC7B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;AACA,MAAM,yBAAyB;AAC/B,MAAM,+BAA+B,SAAS;CAC7C,MAAM,QAAQ,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI;CAClD,OAAO,KAAK,MAAM,OAAO,KAAK;AAC/B;AACA,MAAM,oBAAoB,UAAU,CAAC,MAAM;CAC1C,MAAM,EAAE,iBAAiB,6BAA6B,YAAY,UAAU,KAAK,MAAM,KAAK,GAAG,SAAS,iBAAiB,KAAK,SAAS,EAAE,GAAG,MAAM,GAAG,gBAAgB,EAAE,GAAG,EAAE,MAAM;CAClL,MAAM,OAAO,QAAQ;CACrB,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,YAAY,MAAM,QAAQ,CAAC;CACjC,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ;EAC9C,GAAG;EACH,GAAG;CACJ,CAAC,EAAE,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;CACjD,OAAO,WAAW;EACjB;EACA,YAAY,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,eAAe,iBAAiB,KAAK,CAAC,CAAC,CAAC,CAAC;EACzH;EACA;EACA,GAAG;EACH;CACD,CAAC;AACF"}
@@ -0,0 +1,68 @@
1
+ import { createFont, getVariableValue } from "@tamagui/core";
2
+
3
+ const systemFontFamily = {
4
+ web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
5
+ native: "System"
6
+ };
7
+ const webSystemFontSizes = {
8
+ 1: 12,
9
+ 2: 13,
10
+ 3: 14,
11
+ 4: 15,
12
+ 5: 16,
13
+ 6: 18,
14
+ 7: 22,
15
+ 8: 26,
16
+ 9: 30,
17
+ 10: 40,
18
+ 11: 46,
19
+ 12: 52,
20
+ 13: 60,
21
+ 14: 70,
22
+ 15: 85,
23
+ 16: 100
24
+ };
25
+ const nativeSystemFontSizes = {
26
+ 1: 11,
27
+ 2: 12,
28
+ 3: 15,
29
+ 4: 17,
30
+ 5: 20,
31
+ 6: 22,
32
+ 7: 24,
33
+ 8: 28,
34
+ 9: 32,
35
+ 10: 40,
36
+ 11: 46,
37
+ 12: 52,
38
+ 13: 60,
39
+ 14: 70,
40
+ 15: 85,
41
+ 16: 100
42
+ };
43
+ const defaultSystemFontSizes = webSystemFontSizes;
44
+ const defaultSystemFontLineHeight = (size) => {
45
+ const ratio = 1.5 - Math.max(0, (size - 20) * .004);
46
+ return Math.round(size * ratio);
47
+ };
48
+ const createSystemFont = (options = {}) => {
49
+ const { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = (size2) => Math.round(size2), family = systemFontFamily.web, weight = { 1: "400" }, letterSpacing = { 4: 0 } } = options;
50
+ const font = options.font;
51
+ const sizes = options.sizes ?? defaultSystemFontSizes;
52
+ const fontSizes = font?.size ?? {};
53
+ const size = Object.fromEntries(Object.entries({
54
+ ...sizes,
55
+ ...fontSizes
56
+ }).map(([key, value]) => [key, sizeSize(+value)]));
57
+ return createFont({
58
+ family,
59
+ lineHeight: Object.fromEntries(Object.entries(size).map(([key, value]) => [key, sizeLineHeight(getVariableValue(value))])),
60
+ weight,
61
+ letterSpacing,
62
+ ...font,
63
+ size
64
+ });
65
+ };
66
+
67
+ export { createSystemFont, defaultSystemFontLineHeight, defaultSystemFontSizes, nativeSystemFontSizes, systemFontFamily, webSystemFontSizes };
68
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { createFont, getVariableValue } from \"@tamagui/core\";\n\nconst systemFontFamily = {\n\tweb: \"-apple-system, system-ui, BlinkMacSystemFont, \\\"Segoe UI\\\", Roboto, Helvetica, Arial, sans-serif\",\n\tnative: \"System\"\n};\nconst webSystemFontSizes = {\n\t1: 12,\n\t2: 13,\n\t3: 14,\n\t4: 15,\n\t5: 16,\n\t6: 18,\n\t7: 22,\n\t8: 26,\n\t9: 30,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nconst nativeSystemFontSizes = {\n\t1: 11,\n\t2: 12,\n\t3: 15,\n\t4: 17,\n\t5: 20,\n\t6: 22,\n\t7: 24,\n\t8: 28,\n\t9: 32,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nconst defaultSystemFontSizes = webSystemFontSizes;\nconst defaultSystemFontLineHeight = (size) => {\n\tconst ratio = 1.5 - Math.max(0, (size - 20) * .004);\n\treturn Math.round(size * ratio);\n};\nconst createSystemFont = (options = {}) => {\n\tconst { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = (size2) => Math.round(size2), family = systemFontFamily.web, weight = { 1: \"400\" }, letterSpacing = { 4: 0 } } = options;\n\tconst font = options.font;\n\tconst sizes = options.sizes ?? defaultSystemFontSizes;\n\tconst fontSizes = font?.size ?? {};\n\tconst size = Object.fromEntries(Object.entries({\n\t\t...sizes,\n\t\t...fontSizes\n\t}).map(([key, value]) => [key, sizeSize(+value)]));\n\treturn createFont({\n\t\tfamily,\n\t\tlineHeight: Object.fromEntries(Object.entries(size).map(([key, value]) => [key, sizeLineHeight(getVariableValue(value))])),\n\t\tweight,\n\t\tletterSpacing,\n\t\t...font,\n\t\tsize\n\t});\n};\n\nexport { createSystemFont, defaultSystemFontLineHeight, defaultSystemFontSizes, nativeSystemFontSizes, systemFontFamily, webSystemFontSizes };"],"mappings":";;;AAEA,MAAM,mBAAmB;CACxB,KAAK;CACL,QAAQ;AACT;AACA,MAAM,qBAAqB;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;AACA,MAAM,wBAAwB;CAC7B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;AACA,MAAM,yBAAyB;AAC/B,MAAM,+BAA+B,SAAS;CAC7C,MAAM,QAAQ,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI;CAClD,OAAO,KAAK,MAAM,OAAO,KAAK;AAC/B;AACA,MAAM,oBAAoB,UAAU,CAAC,MAAM;CAC1C,MAAM,EAAE,iBAAiB,6BAA6B,YAAY,UAAU,KAAK,MAAM,KAAK,GAAG,SAAS,iBAAiB,KAAK,SAAS,EAAE,GAAG,MAAM,GAAG,gBAAgB,EAAE,GAAG,EAAE,MAAM;CAClL,MAAM,OAAO,QAAQ;CACrB,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,YAAY,MAAM,QAAQ,CAAC;CACjC,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ;EAC9C,GAAG;EACH,GAAG;CACJ,CAAC,EAAE,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;CACjD,OAAO,WAAW;EACjB;EACA,YAAY,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,eAAe,iBAAiB,KAAK,CAAC,CAAC,CAAC,CAAC;EACzH;EACA;EACA,GAAG;EACH;CACD,CAAC;AACF"}
@@ -0,0 +1,82 @@
1
+ import { createFont, getVariableValue } from "@tamagui/core";
2
+
3
+ var isWeb = false;
4
+ var isNative = true;
5
+ var systemFontFamily = {
6
+ web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
7
+ native: "System"
8
+ };
9
+ var webSystemFontSizes = {
10
+ 1: 12,
11
+ 2: 13,
12
+ 3: 14,
13
+ 4: 15,
14
+ 5: 16,
15
+ 6: 18,
16
+ 7: 22,
17
+ 8: 26,
18
+ 9: 30,
19
+ 10: 40,
20
+ 11: 46,
21
+ 12: 52,
22
+ 13: 60,
23
+ 14: 70,
24
+ 15: 85,
25
+ 16: 100
26
+ };
27
+ var nativeSystemFontSizes = {
28
+ 1: 11,
29
+ 2: 12,
30
+ 3: 15,
31
+ 4: 17,
32
+ 5: 20,
33
+ 6: 22,
34
+ 7: 24,
35
+ 8: 28,
36
+ 9: 32,
37
+ 10: 40,
38
+ 11: 46,
39
+ 12: 52,
40
+ 13: 60,
41
+ 14: 70,
42
+ 15: 85,
43
+ 16: 100
44
+ };
45
+ var defaultSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes;
46
+ var defaultSystemFontLineHeight = function(size) {
47
+ if (isNative) return Math.round(size + 5);
48
+ var ratio = 1.5 - Math.max(0, (size - 20) * .004);
49
+ return Math.round(size * ratio);
50
+ };
51
+ var createSystemFont = function() {
52
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
53
+ var { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = function(size2) {
54
+ return Math.round(size2);
55
+ }, family = isWeb ? systemFontFamily.web : systemFontFamily.native, weight = { 1: "400" }, letterSpacing = { 4: 0 } } = options;
56
+ var font = options.font;
57
+ var _options_sizes;
58
+ var sizes = (_options_sizes = options.sizes) !== null && _options_sizes !== void 0 ? _options_sizes : defaultSystemFontSizes;
59
+ var _font_size;
60
+ var fontSizes = (_font_size = font === null || font === void 0 ? void 0 : font.size) !== null && _font_size !== void 0 ? _font_size : {};
61
+ var size = Object.fromEntries(Object.entries({
62
+ ...sizes,
63
+ ...fontSizes
64
+ }).map(function(param) {
65
+ var [key, value] = param;
66
+ return [key, sizeSize(+value)];
67
+ }));
68
+ return createFont({
69
+ family,
70
+ lineHeight: Object.fromEntries(Object.entries(size).map(function(param) {
71
+ var [key, value] = param;
72
+ return [key, sizeLineHeight(getVariableValue(value))];
73
+ })),
74
+ weight,
75
+ letterSpacing,
76
+ ...font,
77
+ size
78
+ });
79
+ };
80
+
81
+ export { createSystemFont, defaultSystemFontLineHeight, defaultSystemFontSizes, nativeSystemFontSizes, systemFontFamily, webSystemFontSizes };
82
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["esm/index.native.js"],"sourcesContent":["import { createFont, getVariableValue } from \"@tamagui/core\";\n\nvar isWeb = false;\nvar isNative = true;\nvar systemFontFamily = {\n\tweb: \"-apple-system, system-ui, BlinkMacSystemFont, \\\"Segoe UI\\\", Roboto, Helvetica, Arial, sans-serif\",\n\tnative: \"System\"\n};\nvar webSystemFontSizes = {\n\t1: 12,\n\t2: 13,\n\t3: 14,\n\t4: 15,\n\t5: 16,\n\t6: 18,\n\t7: 22,\n\t8: 26,\n\t9: 30,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nvar nativeSystemFontSizes = {\n\t1: 11,\n\t2: 12,\n\t3: 15,\n\t4: 17,\n\t5: 20,\n\t6: 22,\n\t7: 24,\n\t8: 28,\n\t9: 32,\n\t10: 40,\n\t11: 46,\n\t12: 52,\n\t13: 60,\n\t14: 70,\n\t15: 85,\n\t16: 100\n};\nvar defaultSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes;\nvar defaultSystemFontLineHeight = function(size) {\n\tif (isNative) return Math.round(size + 5);\n\tvar ratio = 1.5 - Math.max(0, (size - 20) * .004);\n\treturn Math.round(size * ratio);\n};\nvar createSystemFont = function() {\n\tvar options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n\tvar { sizeLineHeight = defaultSystemFontLineHeight, sizeSize = function(size2) {\n\t\treturn Math.round(size2);\n\t}, family = isWeb ? systemFontFamily.web : systemFontFamily.native, weight = { 1: \"400\" }, letterSpacing = { 4: 0 } } = options;\n\tvar font = options.font;\n\tvar _options_sizes;\n\tvar sizes = (_options_sizes = options.sizes) !== null && _options_sizes !== void 0 ? _options_sizes : defaultSystemFontSizes;\n\tvar _font_size;\n\tvar fontSizes = (_font_size = font === null || font === void 0 ? void 0 : font.size) !== null && _font_size !== void 0 ? _font_size : {};\n\tvar size = Object.fromEntries(Object.entries({\n\t\t...sizes,\n\t\t...fontSizes\n\t}).map(function(param) {\n\t\tvar [key, value] = param;\n\t\treturn [key, sizeSize(+value)];\n\t}));\n\treturn createFont({\n\t\tfamily,\n\t\tlineHeight: Object.fromEntries(Object.entries(size).map(function(param) {\n\t\t\tvar [key, value] = param;\n\t\t\treturn [key, sizeLineHeight(getVariableValue(value))];\n\t\t})),\n\t\tweight,\n\t\tletterSpacing,\n\t\t...font,\n\t\tsize\n\t});\n};\n\nexport { createSystemFont, defaultSystemFontLineHeight, defaultSystemFontSizes, nativeSystemFontSizes, systemFontFamily, webSystemFontSizes };"],"mappings":";;;AAEA,IAAI,QAAQ;AACZ,IAAI,WAAW;AACf,IAAI,mBAAmB;CACtB,KAAK;CACL,QAAQ;AACT;AACA,IAAI,qBAAqB;CACxB,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;AACA,IAAI,wBAAwB;CAC3B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;AACA,IAAI,yBAAyB,WAAW,wBAAwB;AAChE,IAAI,8BAA8B,SAAS,MAAM;CAChD,IAAI,UAAU,OAAO,KAAK,MAAM,OAAO,CAAC;CACxC,IAAI,QAAQ,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI;CAChD,OAAO,KAAK,MAAM,OAAO,KAAK;AAC/B;AACA,IAAI,mBAAmB,WAAW;CACjC,IAAI,UAAU,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAChF,IAAI,EAAE,iBAAiB,6BAA6B,WAAW,SAAS,OAAO;EAC9E,OAAO,KAAK,MAAM,KAAK;CACxB,GAAG,SAAS,QAAQ,iBAAiB,MAAM,iBAAiB,QAAQ,SAAS,EAAE,GAAG,MAAM,GAAG,gBAAgB,EAAE,GAAG,EAAE,MAAM;CACxH,IAAI,OAAO,QAAQ;CACnB,IAAI;CACJ,IAAI,SAAS,iBAAiB,QAAQ,WAAW,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB;CACtG,IAAI;CACJ,IAAI,aAAa,aAAa,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,UAAU,QAAQ,eAAe,KAAK,IAAI,aAAa,CAAC;CACvI,IAAI,OAAO,OAAO,YAAY,OAAO,QAAQ;EAC5C,GAAG;EACH,GAAG;CACJ,CAAC,EAAE,IAAI,SAAS,OAAO;EACtB,IAAI,CAAC,KAAK,SAAS;EACnB,OAAO,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC;CAC9B,CAAC,CAAC;CACF,OAAO,WAAW;EACjB;EACA,YAAY,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,IAAI,SAAS,OAAO;GACvE,IAAI,CAAC,KAAK,SAAS;GACnB,OAAO,CAAC,KAAK,eAAe,iBAAiB,KAAK,CAAC,CAAC;EACrD,CAAC,CAAC;EACF;EACA;EACA,GAAG;EACH;CACD,CAAC;AACF"}
package/package.json CHANGED
@@ -1,13 +1,53 @@
1
1
  {
2
2
  "name": "@tamagui/create-system-font",
3
- "version": "0.0.0-bootstrap.0",
4
- "description": "Tamagui v3 package bootstrap",
5
- "repository": "https://github.com/tamagui/tamagui",
6
- "license": "MIT",
3
+ "version": "3.0.0-beta.637.1",
7
4
  "files": [
8
- "README.md"
5
+ "src",
6
+ "types",
7
+ "dist"
9
8
  ],
9
+ "type": "module",
10
+ "sideEffects": false,
11
+ "main": "dist/cjs",
12
+ "module": "dist/esm",
13
+ "types": "./types/index.d.ts",
14
+ "exports": {
15
+ "./package.json": "./package.json",
16
+ ".": {
17
+ "types": "./types/index.d.ts",
18
+ "react-native": "./dist/esm/index.native.js",
19
+ "browser": "./dist/esm/index.mjs",
20
+ "module": "./dist/esm/index.mjs",
21
+ "import": "./dist/esm/index.mjs",
22
+ "require": "./dist/cjs/index.cjs",
23
+ "default": "./dist/esm/index.mjs"
24
+ }
25
+ },
10
26
  "publishConfig": {
11
27
  "access": "public"
28
+ },
29
+ "scripts": {
30
+ "build": "tamagui-build",
31
+ "watch": "tamagui-build --watch",
32
+ "clean": "tamagui-build clean",
33
+ "clean:build": "tamagui-build clean:build",
34
+ "test": "vitest --run tests",
35
+ "test:web": "bun run test"
36
+ },
37
+ "dependencies": {
38
+ "@tamagui/core": "3.0.0-beta.637.1"
39
+ },
40
+ "devDependencies": {
41
+ "@tamagui/build": "3.0.0-beta.637.1",
42
+ "react": ">=19",
43
+ "vitest": "4.0.4"
44
+ },
45
+ "peerDependencies": {
46
+ "react": ">=19"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/tamagui/tamagui.git",
51
+ "directory": "code/core/create-system-font"
12
52
  }
13
53
  }
package/src/index.ts ADDED
@@ -0,0 +1,114 @@
1
+ import type { FillInFont, GenericFont } from '@tamagui/core'
2
+ import { createFont, getVariableValue } from '@tamagui/core'
3
+
4
+ type SystemFontSizes = Record<string | number, number>
5
+ type SystemFontKeys<Sizes extends SystemFontSizes> = keyof Sizes & (string | number)
6
+
7
+ type CreateSystemFontOptions<A extends GenericFont, Sizes extends SystemFontSizes> = {
8
+ font?: Partial<A>
9
+ sizes?: Sizes
10
+ sizeLineHeight?: (fontSize: number) => number
11
+ sizeSize?: (size: number) => number
12
+ family?: string
13
+ weight?: GenericFont['weight']
14
+ letterSpacing?: GenericFont['letterSpacing']
15
+ }
16
+
17
+ const isWeb = process.env.TAMAGUI_TARGET === 'web'
18
+ const isNative = process.env.TAMAGUI_TARGET === 'native'
19
+
20
+ export const systemFontFamily = {
21
+ web: '-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
22
+ native: 'System',
23
+ } as const
24
+
25
+ export const webSystemFontSizes = {
26
+ 1: 12,
27
+ 2: 13,
28
+ 3: 14,
29
+ 4: 15,
30
+ 5: 16,
31
+ 6: 18,
32
+ 7: 22,
33
+ 8: 26,
34
+ 9: 30,
35
+ 10: 40,
36
+ 11: 46,
37
+ 12: 52,
38
+ 13: 60,
39
+ 14: 70,
40
+ 15: 85,
41
+ 16: 100,
42
+ } as const
43
+
44
+ export const nativeSystemFontSizes = {
45
+ 1: 11,
46
+ 2: 12,
47
+ 3: 15,
48
+ 4: 17,
49
+ 5: 20,
50
+ 6: 22,
51
+ 7: 24,
52
+ 8: 28,
53
+ 9: 32,
54
+ 10: 40,
55
+ 11: 46,
56
+ 12: 52,
57
+ 13: 60,
58
+ 14: 70,
59
+ 15: 85,
60
+ 16: 100,
61
+ } as const
62
+
63
+ export const defaultSystemFontSizes:
64
+ | typeof nativeSystemFontSizes
65
+ | typeof webSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes
66
+
67
+ export const defaultSystemFontLineHeight = (size: number): number => {
68
+ if (isNative) return Math.round(size + 5)
69
+ const ratio = 1.5 - Math.max(0, (size - 20) * 0.004)
70
+ return Math.round(size * ratio)
71
+ }
72
+
73
+ export const createSystemFont = <
74
+ A extends GenericFont,
75
+ Sizes extends SystemFontSizes = typeof webSystemFontSizes,
76
+ >(
77
+ options: CreateSystemFontOptions<A, Sizes> = {}
78
+ ): FillInFont<A, SystemFontKeys<Sizes>> => {
79
+ const {
80
+ sizeLineHeight = defaultSystemFontLineHeight,
81
+ sizeSize = (size) => Math.round(size),
82
+ family = isWeb ? systemFontFamily.web : systemFontFamily.native,
83
+ weight = {
84
+ 1: '400',
85
+ },
86
+ letterSpacing = {
87
+ 4: 0,
88
+ },
89
+ } = options
90
+ const font = options.font
91
+ const sizes = options.sizes ?? defaultSystemFontSizes
92
+ const fontSizes = font?.size ?? {}
93
+
94
+ const size = Object.fromEntries(
95
+ Object.entries({
96
+ ...sizes,
97
+ ...fontSizes,
98
+ }).map(([key, value]) => [key, sizeSize(+value)])
99
+ )
100
+
101
+ return createFont({
102
+ family,
103
+ lineHeight: Object.fromEntries(
104
+ Object.entries(size).map(([key, value]) => [
105
+ key,
106
+ sizeLineHeight(getVariableValue(value)),
107
+ ])
108
+ ),
109
+ weight,
110
+ letterSpacing,
111
+ ...(font as any),
112
+ size,
113
+ }) as FillInFont<A, SystemFontKeys<Sizes>>
114
+ }
@@ -0,0 +1,64 @@
1
+ import type { FillInFont, GenericFont } from "@tamagui/core";
2
+ type SystemFontSizes = Record<string | number, number>;
3
+ type SystemFontKeys<Sizes extends SystemFontSizes> = keyof Sizes & (string | number);
4
+ type CreateSystemFontOptions<
5
+ A extends GenericFont,
6
+ Sizes extends SystemFontSizes
7
+ > = {
8
+ font?: Partial<A>;
9
+ sizes?: Sizes;
10
+ sizeLineHeight?: (fontSize: number) => number;
11
+ sizeSize?: (size: number) => number;
12
+ family?: string;
13
+ weight?: GenericFont["weight"];
14
+ letterSpacing?: GenericFont["letterSpacing"];
15
+ };
16
+ export declare const systemFontFamily: {
17
+ readonly web: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif";
18
+ readonly native: "System";
19
+ };
20
+ export declare const webSystemFontSizes: {
21
+ readonly 1: 12;
22
+ readonly 2: 13;
23
+ readonly 3: 14;
24
+ readonly 4: 15;
25
+ readonly 5: 16;
26
+ readonly 6: 18;
27
+ readonly 7: 22;
28
+ readonly 8: 26;
29
+ readonly 9: 30;
30
+ readonly 10: 40;
31
+ readonly 11: 46;
32
+ readonly 12: 52;
33
+ readonly 13: 60;
34
+ readonly 14: 70;
35
+ readonly 15: 85;
36
+ readonly 16: 100;
37
+ };
38
+ export declare const nativeSystemFontSizes: {
39
+ readonly 1: 11;
40
+ readonly 2: 12;
41
+ readonly 3: 15;
42
+ readonly 4: 17;
43
+ readonly 5: 20;
44
+ readonly 6: 22;
45
+ readonly 7: 24;
46
+ readonly 8: 28;
47
+ readonly 9: 32;
48
+ readonly 10: 40;
49
+ readonly 11: 46;
50
+ readonly 12: 52;
51
+ readonly 13: 60;
52
+ readonly 14: 70;
53
+ readonly 15: 85;
54
+ readonly 16: 100;
55
+ };
56
+ export declare const defaultSystemFontSizes: typeof nativeSystemFontSizes | typeof webSystemFontSizes;
57
+ export declare const defaultSystemFontLineHeight: (size: number) => number;
58
+ export declare const createSystemFont: <
59
+ A extends GenericFont,
60
+ Sizes extends SystemFontSizes = typeof webSystemFontSizes
61
+ >(options?: CreateSystemFontOptions<A, Sizes>) => FillInFont<A, SystemFontKeys<Sizes>>;
62
+ export {};
63
+
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,cAAc,YAAY,mBAAmB;KAGxC,kBAAkB;KAClB,eAAe,cAAc,yBAAyB;KAEtD;CAAwB,UAAU;CAAa,cAAc;IAAmB;CACnF,OAAO,QAAQ;CACf,QAAQ;CACR,kBAAkB;CAClB,YAAY;CACZ;CACA,SAAS,YAAY;CACrB,gBAAgB,YAAY;;AAM9B,OAAO,cAAM;UACX,KAAK;UACL,QAAQ;;AAGV,OAAO,cAAM;UACX,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;;AAGN,OAAO,cAAM;UACX,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;;AAGN,OAAO,cAAM,+BACF,+BACA;AAEX,OAAO,cAAM,8BAA+B;AAM5C,OAAO,cAAM;CACX,UAAU;CACV,cAAc,yBAAyB;EAEvC,UAAS,wBAAwB,GAAG,WACnC,WAAW,GAAG,eAAe",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "import type { FillInFont, GenericFont } from '@tamagui/core'\nimport { createFont, getVariableValue } from '@tamagui/core'\n\ntype SystemFontSizes = Record<string | number, number>\ntype SystemFontKeys<Sizes extends SystemFontSizes> = keyof Sizes & (string | number)\n\ntype CreateSystemFontOptions<A extends GenericFont, Sizes extends SystemFontSizes> = {\n font?: Partial<A>\n sizes?: Sizes\n sizeLineHeight?: (fontSize: number) => number\n sizeSize?: (size: number) => number\n family?: string\n weight?: GenericFont['weight']\n letterSpacing?: GenericFont['letterSpacing']\n}\n\nconst isWeb = process.env.TAMAGUI_TARGET === 'web'\nconst isNative = process.env.TAMAGUI_TARGET === 'native'\n\nexport const systemFontFamily = {\n web: '-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif',\n native: 'System',\n} as const\n\nexport const webSystemFontSizes = {\n 1: 12,\n 2: 13,\n 3: 14,\n 4: 15,\n 5: 16,\n 6: 18,\n 7: 22,\n 8: 26,\n 9: 30,\n 10: 40,\n 11: 46,\n 12: 52,\n 13: 60,\n 14: 70,\n 15: 85,\n 16: 100,\n} as const\n\nexport const nativeSystemFontSizes = {\n 1: 11,\n 2: 12,\n 3: 15,\n 4: 17,\n 5: 20,\n 6: 22,\n 7: 24,\n 8: 28,\n 9: 32,\n 10: 40,\n 11: 46,\n 12: 52,\n 13: 60,\n 14: 70,\n 15: 85,\n 16: 100,\n} as const\n\nexport const defaultSystemFontSizes:\n | typeof nativeSystemFontSizes\n | typeof webSystemFontSizes = isNative ? nativeSystemFontSizes : webSystemFontSizes\n\nexport const defaultSystemFontLineHeight = (size: number): number => {\n if (isNative) return Math.round(size + 5)\n const ratio = 1.5 - Math.max(0, (size - 20) * 0.004)\n return Math.round(size * ratio)\n}\n\nexport const createSystemFont = <\n A extends GenericFont,\n Sizes extends SystemFontSizes = typeof webSystemFontSizes,\n>(\n options: CreateSystemFontOptions<A, Sizes> = {}\n): FillInFont<A, SystemFontKeys<Sizes>> => {\n const {\n sizeLineHeight = defaultSystemFontLineHeight,\n sizeSize = (size) => Math.round(size),\n family = isWeb ? systemFontFamily.web : systemFontFamily.native,\n weight = {\n 1: '400',\n },\n letterSpacing = {\n 4: 0,\n },\n } = options\n const font = options.font\n const sizes = options.sizes ?? defaultSystemFontSizes\n const fontSizes = font?.size ?? {}\n\n const size = Object.fromEntries(\n Object.entries({\n ...sizes,\n ...fontSizes,\n }).map(([key, value]) => [key, sizeSize(+value)])\n )\n\n return createFont({\n family,\n lineHeight: Object.fromEntries(\n Object.entries(size).map(([key, value]) => [\n key,\n sizeLineHeight(getVariableValue(value)),\n ])\n ),\n weight,\n letterSpacing,\n ...(font as any),\n size,\n }) as FillInFont<A, SystemFontKeys<Sizes>>\n}\n"
10
+ ]
11
+ }
package/README.md DELETED
@@ -1 +0,0 @@
1
- # @tamagui/create-system-font