@hanzogui/font-zen 8.3.1 → 8.3.2

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.
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createZenMonoFont = exports.createZenPixelFont = exports.createZenSansFont = exports.zenPixelFamily = exports.zenMonoFamily = exports.zenSansFamily = exports.zenPixel = exports.zenMono = exports.zenSans = exports.ZEN_PIXEL_FAMILY = exports.ZEN_MONO_FAMILY = exports.ZEN_SANS_FAMILY = void 0;
4
+ const core_1 = require("@hanzogui/core");
5
+ /**
6
+ * Zen is the Hanzo typeface: Zen for the UI, Zen Mono for anything monospaced.
7
+ * This module is the single place either one is named — the family stacks the
8
+ * tokens bind to, and the kit fonts built on them. An app that states a family
9
+ * of its own is a second source of truth and will drift from the rest of the
10
+ * fleet.
11
+ *
12
+ * THE BYTES COME FROM `@hanzo/font`, which ships the woff2 files and the
13
+ * @font-face that reaches them:
14
+ *
15
+ * import '@hanzo/font/css' // once, at the app's entry
16
+ *
17
+ * That package owns the faces; this one owns the names the kit binds. This
18
+ * module used to carry a second copy of the @font-face rules pointed at a
19
+ * versioned CDN path, so the family name and the file behind it were two
20
+ * decisions that could disagree — and for Zen they did: nothing is served under
21
+ * that path, so every rule it emitted would have 404'd.
22
+ */
23
+ /**
24
+ * The two family names, exactly as `@hanzo/font` registers them.
25
+ *
26
+ * Everything else here is derived from these, so a stack and a native face can
27
+ * never name the typeface differently. Spelling the name a second time anywhere
28
+ * is how a font silently stops resolving.
29
+ */
30
+ exports.ZEN_SANS_FAMILY = 'Zen';
31
+ exports.ZEN_MONO_FAMILY = 'Zen Mono';
32
+ /**
33
+ * The pixel face. `@hanzo/font` ships five cuts — Square, Grid, Line, Circle,
34
+ * Triangle — and Square is the one a UI reaches for; the others are display.
35
+ * This is the face that replaced Silkscreen, so the kit keeps a pixel ROLE
36
+ * without naming somebody else's typeface to fill it.
37
+ */
38
+ exports.ZEN_PIXEL_FAMILY = 'Zen Pixel Square';
39
+ /**
40
+ * The UI face.
41
+ *
42
+ * Everything after Zen is a system face, and the list ends in `sans-serif`: a
43
+ * font that fails to load must never leave the browser on its default, which is
44
+ * a serif.
45
+ */
46
+ exports.zenSans = `"${exports.ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
47
+ /** The monospace face, ending in `monospace` for the same reason. */
48
+ exports.zenMono = `"${exports.ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
49
+ /** The pixel face, falling back through mono — a pixel face that fails to load
50
+ * should land on something monospaced, not on a proportional sans. */
51
+ exports.zenPixel = `"${exports.ZEN_PIXEL_FAMILY}", "${exports.ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
52
+ /** The family names as the platform resolves them: a stack on web, a registered face on native. */
53
+ exports.zenSansFamily = core_1.isWeb ? exports.zenSans : exports.ZEN_SANS_FAMILY;
54
+ exports.zenMonoFamily = core_1.isWeb ? exports.zenMono : exports.ZEN_MONO_FAMILY;
55
+ exports.zenPixelFamily = core_1.isWeb ? exports.zenPixel : exports.ZEN_PIXEL_FAMILY;
56
+ const defaultSizes = {
57
+ 1: 11,
58
+ 2: 12,
59
+ 3: 13,
60
+ 4: 14,
61
+ true: 14,
62
+ 5: 16,
63
+ 6: 18,
64
+ 7: 20,
65
+ 8: 23,
66
+ 9: 30,
67
+ 10: 46,
68
+ 11: 55,
69
+ 12: 62,
70
+ 13: 72,
71
+ 14: 92,
72
+ 15: 114,
73
+ 16: 134,
74
+ };
75
+ const createZenFont = (family, font, sizeLineHeight, sizeSize) => {
76
+ const size = Object.fromEntries(Object.entries({ ...defaultSizes, ...font.size }).map(([k, v]) => [k, sizeSize(+v)]));
77
+ return (0, core_1.createFont)({
78
+ family,
79
+ lineHeight: Object.fromEntries(Object.entries(size).map(([k, v]) => [k, sizeLineHeight((0, core_1.getVariableValue)(v))])),
80
+ weight: { 4: '400' },
81
+ letterSpacing: { 4: 0 },
82
+ ...font,
83
+ size,
84
+ });
85
+ };
86
+ const createZenSansFont = (font = {}, { sizeLineHeight = (size) => Math.round(size * 1.5), sizeSize = (size) => size * 1, } = {}) => createZenFont(exports.zenSansFamily, font, sizeLineHeight, sizeSize);
87
+ exports.createZenSansFont = createZenSansFont;
88
+ const createZenPixelFont = (font = {}, { sizeLineHeight = (size) => Math.round(size * 1.5), sizeSize = (size) => size * 1, } = {}) => createZenFont(exports.zenPixelFamily, font, sizeLineHeight, sizeSize);
89
+ exports.createZenPixelFont = createZenPixelFont;
90
+ const createZenMonoFont = (font = {}, { sizeLineHeight = (size) => Math.round(size * 1.5), sizeSize = (size) => size * 1, } = {}) => createZenFont(exports.zenMonoFamily, font, sizeLineHeight, sizeSize);
91
+ exports.createZenMonoFont = createZenMonoFont;
92
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoE;AAIpE;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACU,QAAA,eAAe,GAAW,KAAK,CAAA;AAC/B,QAAA,eAAe,GAAW,UAAU,CAAA;AAEjD;;;;;GAKG;AACU,QAAA,gBAAgB,GAAW,kBAAkB,CAAA;AAE1D;;;;;;GAMG;AACU,QAAA,OAAO,GAAW,IAAI,QAAA,eAAe,kHAAkH,CAAA;AAEpK,qEAAqE;AACxD,QAAA,OAAO,GAAW,IAAI,QAAA,eAAe,2FAA2F,CAAA;AAE7I;uEACuE;AAC1D,QAAA,QAAQ,GAAW,IAAI,QAAA,gBAAgB,OAAO,QAAA,eAAe,6DAA6D,CAAA;AAEvI,mGAAmG;AACtF,QAAA,aAAa,GAAW,YAAK,CAAC,CAAC,CAAC,QAAA,OAAO,CAAC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AE,CAC5C,aAAa,CAAC,QAAA,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,CAG1D,CAAA;AAVU,QAAA,iBAAiB,GAAjB,iBAAiB,CAU3B"}
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }
package/dist/esm/index.js CHANGED
@@ -1,61 +1,86 @@
1
- import { createFont, getVariableValue, isWeb } from "@hanzogui/core";
2
- const ZEN_SANS_FAMILY = "Zen";
3
- const ZEN_MONO_FAMILY = "Zen Mono";
4
- const ZEN_PIXEL_FAMILY = "Zen Pixel Square";
5
- const zenSans = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
6
- const zenMono = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
7
- const zenPixel = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
8
- const zenSansFamily = isWeb ? zenSans : ZEN_SANS_FAMILY;
9
- const zenMonoFamily = isWeb ? zenMono : ZEN_MONO_FAMILY;
10
- const zenPixelFamily = isWeb ? zenPixel : ZEN_PIXEL_FAMILY;
1
+ import { createFont, getVariableValue, isWeb } from '@hanzogui/core';
2
+ /**
3
+ * Zen is the Hanzo typeface: Zen for the UI, Zen Mono for anything monospaced.
4
+ * This module is the single place either one is named — the family stacks the
5
+ * tokens bind to, and the kit fonts built on them. An app that states a family
6
+ * of its own is a second source of truth and will drift from the rest of the
7
+ * fleet.
8
+ *
9
+ * THE BYTES COME FROM `@hanzo/font`, which ships the woff2 files and the
10
+ * @font-face that reaches them:
11
+ *
12
+ * import '@hanzo/font/css' // once, at the app's entry
13
+ *
14
+ * That package owns the faces; this one owns the names the kit binds. This
15
+ * module used to carry a second copy of the @font-face rules pointed at a
16
+ * versioned CDN path, so the family name and the file behind it were two
17
+ * decisions that could disagree — and for Zen they did: nothing is served under
18
+ * that path, so every rule it emitted would have 404'd.
19
+ */
20
+ /**
21
+ * The two family names, exactly as `@hanzo/font` registers them.
22
+ *
23
+ * Everything else here is derived from these, so a stack and a native face can
24
+ * never name the typeface differently. Spelling the name a second time anywhere
25
+ * is how a font silently stops resolving.
26
+ */
27
+ export const ZEN_SANS_FAMILY = 'Zen';
28
+ export const ZEN_MONO_FAMILY = 'Zen Mono';
29
+ /**
30
+ * The pixel face. `@hanzo/font` ships five cuts — Square, Grid, Line, Circle,
31
+ * Triangle — and Square is the one a UI reaches for; the others are display.
32
+ * This is the face that replaced Silkscreen, so the kit keeps a pixel ROLE
33
+ * without naming somebody else's typeface to fill it.
34
+ */
35
+ export const ZEN_PIXEL_FAMILY = 'Zen Pixel Square';
36
+ /**
37
+ * The UI face.
38
+ *
39
+ * Everything after Zen is a system face, and the list ends in `sans-serif`: a
40
+ * font that fails to load must never leave the browser on its default, which is
41
+ * a serif.
42
+ */
43
+ export const zenSans = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
44
+ /** The monospace face, ending in `monospace` for the same reason. */
45
+ export const zenMono = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
46
+ /** The pixel face, falling back through mono — a pixel face that fails to load
47
+ * should land on something monospaced, not on a proportional sans. */
48
+ export const zenPixel = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
49
+ /** The family names as the platform resolves them: a stack on web, a registered face on native. */
50
+ export const zenSansFamily = isWeb ? zenSans : ZEN_SANS_FAMILY;
51
+ export const zenMonoFamily = isWeb ? zenMono : ZEN_MONO_FAMILY;
52
+ export const zenPixelFamily = isWeb ? zenPixel : ZEN_PIXEL_FAMILY;
11
53
  const defaultSizes = {
12
- 1: 11,
13
- 2: 12,
14
- 3: 13,
15
- 4: 14,
16
- true: 14,
17
- 5: 16,
18
- 6: 18,
19
- 7: 20,
20
- 8: 23,
21
- 9: 30,
22
- 10: 46,
23
- 11: 55,
24
- 12: 62,
25
- 13: 72,
26
- 14: 92,
27
- 15: 114,
28
- 16: 134
54
+ 1: 11,
55
+ 2: 12,
56
+ 3: 13,
57
+ 4: 14,
58
+ true: 14,
59
+ 5: 16,
60
+ 6: 18,
61
+ 7: 20,
62
+ 8: 23,
63
+ 9: 30,
64
+ 10: 46,
65
+ 11: 55,
66
+ 12: 62,
67
+ 13: 72,
68
+ 14: 92,
69
+ 15: 114,
70
+ 16: 134,
29
71
  };
30
72
  const createZenFont = (family, font, sizeLineHeight, sizeSize) => {
31
- const size = Object.fromEntries(Object.entries({
32
- ...defaultSizes,
33
- ...font.size
34
- }).map(([k, v]) => [k, sizeSize(+v)]));
35
- return createFont({
36
- family,
37
- lineHeight: Object.fromEntries(Object.entries(size).map(([k, v]) => [k, sizeLineHeight(getVariableValue(v))])),
38
- weight: {
39
- 4: "400"
40
- },
41
- letterSpacing: {
42
- 4: 0
43
- },
44
- ...font,
45
- size
46
- });
73
+ const size = Object.fromEntries(Object.entries({ ...defaultSizes, ...font.size }).map(([k, v]) => [k, sizeSize(+v)]));
74
+ return createFont({
75
+ family,
76
+ lineHeight: Object.fromEntries(Object.entries(size).map(([k, v]) => [k, sizeLineHeight(getVariableValue(v))])),
77
+ weight: { 4: '400' },
78
+ letterSpacing: { 4: 0 },
79
+ ...font,
80
+ size,
81
+ });
47
82
  };
48
- const createZenSansFont = (font = {}, {
49
- sizeLineHeight = size => Math.round(size * 1.5),
50
- sizeSize = size => size * 1
51
- } = {}) => createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize);
52
- const createZenPixelFont = (font = {}, {
53
- sizeLineHeight = size => Math.round(size * 1.5),
54
- sizeSize = size => size * 1
55
- } = {}) => createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize);
56
- const createZenMonoFont = (font = {}, {
57
- sizeLineHeight = size => Math.round(size * 1.5),
58
- sizeSize = size => size * 1
59
- } = {}) => createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize);
60
- export { ZEN_MONO_FAMILY, ZEN_PIXEL_FAMILY, ZEN_SANS_FAMILY, createZenMonoFont, createZenPixelFont, createZenSansFont, zenMono, zenMonoFamily, zenPixel, zenPixelFamily, zenSans, zenSansFamily };
61
- //# sourceMappingURL=index.js.map
83
+ export const createZenSansFont = (font = {}, { sizeLineHeight = (size) => Math.round(size * 1.5), sizeSize = (size) => size * 1, } = {}) => createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize);
84
+ export const createZenPixelFont = (font = {}, { sizeLineHeight = (size) => Math.round(size * 1.5), sizeSize = (size) => size * 1, } = {}) => createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize);
85
+ export const createZenMonoFont = (font = {}, { sizeLineHeight = (size) => Math.round(size * 1.5), sizeSize = (size) => size * 1, } = {}) => createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize);
86
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFont","getVariableValue","isWeb","ZEN_SANS_FAMILY","ZEN_MONO_FAMILY","ZEN_PIXEL_FAMILY","zenSans","zenMono","zenPixel","zenSansFamily","zenMonoFamily","zenPixelFamily","defaultSizes","true","createZenFont","family","font","sizeLineHeight","sizeSize","size","Object","fromEntries","entries","map","k","v","lineHeight","weight","letterSpacing","createZenSansFont","Math","round","createZenPixelFont","createZenMonoFont"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,UAAA,EAAYC,gBAAA,EAAkBC,KAAA,QAAa;AA8B7C,MAAMC,eAAA,GAA0B;AAChC,MAAMC,eAAA,GAA0B;AAQhC,MAAMC,gBAAA,GAA2B;AASjC,MAAMC,OAAA,GAAkB,IAAIH,eAAe;AAG3C,MAAMI,OAAA,GAAkB,IAAIH,eAAe;AAI3C,MAAMI,QAAA,G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I,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,EACjD,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,GAC9B,GAAa,EAAE,EAC0B,EAAE,CAC5C,aAAa,CAAC,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,CAG1D,CAAA"}
package/package.json CHANGED
@@ -1,42 +1,48 @@
1
1
  {
2
2
  "name": "@hanzogui/font-zen",
3
- "version": "8.3.1",
3
+ "version": "8.3.2",
4
4
  "files": [
5
5
  "types",
6
- "dist"
6
+ "dist",
7
+ "src"
7
8
  ],
8
9
  "type": "module",
9
10
  "sideEffects": false,
10
- "main": "dist/cjs",
11
- "module": "dist/esm",
11
+ "main": "./dist/cjs/index.js",
12
+ "module": "./dist/esm/index.js",
12
13
  "types": "./types/index.d.ts",
13
14
  "exports": {
14
15
  "./package.json": "./package.json",
15
16
  ".": {
16
17
  "types": "./types/index.d.ts",
17
- "react-native": "./dist/esm/index.native.js",
18
- "browser": "./dist/esm/index.mjs",
19
- "module": "./dist/esm/index.mjs",
20
- "import": "./dist/esm/index.mjs",
21
- "require": "./dist/cjs/index.cjs",
22
- "default": "./dist/esm/index.mjs"
18
+ "react-native": "./dist/esm/index.js",
19
+ "browser": "./dist/esm/index.js",
20
+ "module": "./dist/esm/index.js",
21
+ "import": "./dist/esm/index.js",
22
+ "require": "./dist/cjs/index.js",
23
+ "default": "./dist/esm/index.js"
23
24
  }
24
25
  },
25
26
  "publishConfig": {
26
27
  "access": "public"
27
28
  },
28
29
  "scripts": {
29
- "build": "hanzogui-build",
30
+ "build": "hanzogui-build --skip-native",
30
31
  "watch": "hanzogui-build --watch",
31
32
  "clean": "hanzogui-build clean",
32
33
  "clean:build": "hanzogui-build clean:build",
33
34
  "test": "vitest run"
34
35
  },
35
36
  "dependencies": {
36
- "@hanzogui/core": "8.3.1"
37
+ "@hanzogui/core": "8.3.2"
37
38
  },
38
39
  "devDependencies": {
39
- "@hanzogui/build": "8.3.1"
40
+ "@hanzogui/build": "8.3.2"
40
41
  },
41
- "skipPublishIfUnchanged": false
42
+ "skipPublishIfUnchanged": false,
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/hanzoai/gui.git",
46
+ "directory": "pkgs/core/font-zen"
47
+ }
42
48
  }
package/src/index.ts ADDED
@@ -0,0 +1,144 @@
1
+ import type { FillInFont, GenericFont } from '@hanzogui/core'
2
+ import { createFont, getVariableValue, isWeb } from '@hanzogui/core'
3
+
4
+ export type { GenericFont, FillInFont } from '@hanzogui/core'
5
+
6
+ /**
7
+ * Zen is the Hanzo typeface: Zen for the UI, Zen Mono for anything monospaced.
8
+ * This module is the single place either one is named — the family stacks the
9
+ * tokens bind to, and the kit fonts built on them. An app that states a family
10
+ * of its own is a second source of truth and will drift from the rest of the
11
+ * fleet.
12
+ *
13
+ * THE BYTES COME FROM `@hanzo/font`, which ships the woff2 files and the
14
+ * @font-face that reaches them:
15
+ *
16
+ * import '@hanzo/font/css' // once, at the app's entry
17
+ *
18
+ * That package owns the faces; this one owns the names the kit binds. This
19
+ * module used to carry a second copy of the @font-face rules pointed at a
20
+ * versioned CDN path, so the family name and the file behind it were two
21
+ * decisions that could disagree — and for Zen they did: nothing is served under
22
+ * that path, so every rule it emitted would have 404'd.
23
+ */
24
+
25
+ /**
26
+ * The two family names, exactly as `@hanzo/font` registers them.
27
+ *
28
+ * Everything else here is derived from these, so a stack and a native face can
29
+ * never name the typeface differently. Spelling the name a second time anywhere
30
+ * is how a font silently stops resolving.
31
+ */
32
+ export const ZEN_SANS_FAMILY: string = 'Zen'
33
+ export const ZEN_MONO_FAMILY: string = 'Zen Mono'
34
+
35
+ /**
36
+ * The pixel face. `@hanzo/font` ships five cuts — Square, Grid, Line, Circle,
37
+ * Triangle — and Square is the one a UI reaches for; the others are display.
38
+ * This is the face that replaced Silkscreen, so the kit keeps a pixel ROLE
39
+ * without naming somebody else's typeface to fill it.
40
+ */
41
+ export const ZEN_PIXEL_FAMILY: string = 'Zen Pixel Square'
42
+
43
+ /**
44
+ * The UI face.
45
+ *
46
+ * Everything after Zen is a system face, and the list ends in `sans-serif`: a
47
+ * font that fails to load must never leave the browser on its default, which is
48
+ * a serif.
49
+ */
50
+ export const zenSans: string = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`
51
+
52
+ /** The monospace face, ending in `monospace` for the same reason. */
53
+ export const zenMono: string = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`
54
+
55
+ /** The pixel face, falling back through mono — a pixel face that fails to load
56
+ * should land on something monospaced, not on a proportional sans. */
57
+ export const zenPixel: string = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`
58
+
59
+ /** The family names as the platform resolves them: a stack on web, a registered face on native. */
60
+ export const zenSansFamily: string = isWeb ? zenSans : ZEN_SANS_FAMILY
61
+ export const zenMonoFamily: string = isWeb ? zenMono : ZEN_MONO_FAMILY
62
+ export const zenPixelFamily: string = isWeb ? zenPixel : ZEN_PIXEL_FAMILY
63
+
64
+ const defaultSizes = {
65
+ 1: 11,
66
+ 2: 12,
67
+ 3: 13,
68
+ 4: 14,
69
+ true: 14,
70
+ 5: 16,
71
+ 6: 18,
72
+ 7: 20,
73
+ 8: 23,
74
+ 9: 30,
75
+ 10: 46,
76
+ 11: 55,
77
+ 12: 62,
78
+ 13: 72,
79
+ 14: 92,
80
+ 15: 114,
81
+ 16: 134,
82
+ } as const
83
+
84
+ const createZenFont = (
85
+ family: string,
86
+ font: Partial<GenericFont>,
87
+ sizeLineHeight: (fontSize: number) => number,
88
+ sizeSize: (size: number) => number
89
+ ) => {
90
+ const size = Object.fromEntries(
91
+ Object.entries({ ...defaultSizes, ...font.size }).map(([k, v]) => [k, sizeSize(+v)])
92
+ )
93
+ return createFont({
94
+ family,
95
+ lineHeight: Object.fromEntries(
96
+ Object.entries(size).map(([k, v]) => [k, sizeLineHeight(getVariableValue(v))])
97
+ ),
98
+ weight: { 4: '400' },
99
+ letterSpacing: { 4: 0 },
100
+ ...(font as any),
101
+ size,
102
+ })
103
+ }
104
+
105
+ type SizeOpts = {
106
+ sizeLineHeight?: (fontSize: number) => number
107
+ sizeSize?: (size: number) => number
108
+ }
109
+
110
+ export const createZenSansFont = <A extends GenericFont>(
111
+ font: Partial<A> = {},
112
+ {
113
+ sizeLineHeight = (size) => Math.round(size * 1.5),
114
+ sizeSize = (size) => size * 1,
115
+ }: SizeOpts = {}
116
+ ): FillInFont<A, keyof typeof defaultSizes> =>
117
+ createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize) as FillInFont<
118
+ A,
119
+ keyof typeof defaultSizes
120
+ >
121
+
122
+ export const createZenPixelFont = <A extends GenericFont>(
123
+ font: Partial<A> = {},
124
+ {
125
+ sizeLineHeight = (size) => Math.round(size * 1.5),
126
+ sizeSize = (size) => size * 1,
127
+ }: SizeOpts = {}
128
+ ): FillInFont<A, keyof typeof defaultSizes> =>
129
+ createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize) as FillInFont<
130
+ A,
131
+ keyof typeof defaultSizes
132
+ >
133
+
134
+ export const createZenMonoFont = <A extends GenericFont>(
135
+ font: Partial<A> = {},
136
+ {
137
+ sizeLineHeight = (size) => Math.round(size * 1.5),
138
+ sizeSize = (size) => size * 1,
139
+ }: SizeOpts = {}
140
+ ): FillInFont<A, keyof typeof defaultSizes> =>
141
+ createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize) as FillInFont<
142
+ A,
143
+ keyof typeof defaultSizes
144
+ >
package/types/index.d.ts CHANGED
@@ -1,81 +1,80 @@
1
- import type { FillInFont, GenericFont } from "@hanzogui/core";
2
- export type { GenericFont, FillInFont } from "@hanzogui/core";
1
+ import type { FillInFont, GenericFont } from '@hanzogui/core';
2
+ export type { GenericFont, FillInFont } from '@hanzogui/core';
3
3
  /**
4
- * Zen is the Hanzo typeface: Zen for the UI, Zen Mono for anything monospaced.
5
- * This module is the single place either one is named — the family stacks the
6
- * tokens bind to, and the kit fonts built on them. An app that states a family
7
- * of its own is a second source of truth and will drift from the rest of the
8
- * fleet.
9
- *
10
- * THE BYTES COME FROM `@hanzo/font`, which ships the woff2 files and the
11
- * @font-face that reaches them:
12
- *
13
- * import '@hanzo/font/css' // once, at the app's entry
14
- *
15
- * That package owns the faces; this one owns the names the kit binds. This
16
- * module used to carry a second copy of the @font-face rules pointed at a
17
- * versioned CDN path, so the family name and the file behind it were two
18
- * decisions that could disagree — and for Zen they did: nothing is served under
19
- * that path, so every rule it emitted would have 404'd.
20
- */
4
+ * Zen is the Hanzo typeface: Zen for the UI, Zen Mono for anything monospaced.
5
+ * This module is the single place either one is named — the family stacks the
6
+ * tokens bind to, and the kit fonts built on them. An app that states a family
7
+ * of its own is a second source of truth and will drift from the rest of the
8
+ * fleet.
9
+ *
10
+ * THE BYTES COME FROM `@hanzo/font`, which ships the woff2 files and the
11
+ * @font-face that reaches them:
12
+ *
13
+ * import '@hanzo/font/css' // once, at the app's entry
14
+ *
15
+ * That package owns the faces; this one owns the names the kit binds. This
16
+ * module used to carry a second copy of the @font-face rules pointed at a
17
+ * versioned CDN path, so the family name and the file behind it were two
18
+ * decisions that could disagree — and for Zen they did: nothing is served under
19
+ * that path, so every rule it emitted would have 404'd.
20
+ */
21
21
  /**
22
- * The two family names, exactly as `@hanzo/font` registers them.
23
- *
24
- * Everything else here is derived from these, so a stack and a native face can
25
- * never name the typeface differently. Spelling the name a second time anywhere
26
- * is how a font silently stops resolving.
27
- */
22
+ * The two family names, exactly as `@hanzo/font` registers them.
23
+ *
24
+ * Everything else here is derived from these, so a stack and a native face can
25
+ * never name the typeface differently. Spelling the name a second time anywhere
26
+ * is how a font silently stops resolving.
27
+ */
28
28
  export declare const ZEN_SANS_FAMILY: string;
29
29
  export declare const ZEN_MONO_FAMILY: string;
30
30
  /**
31
- * The pixel face. `@hanzo/font` ships five cuts — Square, Grid, Line, Circle,
32
- * Triangle — and Square is the one a UI reaches for; the others are display.
33
- * This is the face that replaced Silkscreen, so the kit keeps a pixel ROLE
34
- * without naming somebody else's typeface to fill it.
35
- */
31
+ * The pixel face. `@hanzo/font` ships five cuts — Square, Grid, Line, Circle,
32
+ * Triangle — and Square is the one a UI reaches for; the others are display.
33
+ * This is the face that replaced Silkscreen, so the kit keeps a pixel ROLE
34
+ * without naming somebody else's typeface to fill it.
35
+ */
36
36
  export declare const ZEN_PIXEL_FAMILY: string;
37
37
  /**
38
- * The UI face.
39
- *
40
- * Everything after Zen is a system face, and the list ends in `sans-serif`: a
41
- * font that fails to load must never leave the browser on its default, which is
42
- * a serif.
43
- */
38
+ * The UI face.
39
+ *
40
+ * Everything after Zen is a system face, and the list ends in `sans-serif`: a
41
+ * font that fails to load must never leave the browser on its default, which is
42
+ * a serif.
43
+ */
44
44
  export declare const zenSans: string;
45
45
  /** The monospace face, ending in `monospace` for the same reason. */
46
46
  export declare const zenMono: string;
47
47
  /** The pixel face, falling back through mono — a pixel face that fails to load
48
- * should land on something monospaced, not on a proportional sans. */
48
+ * should land on something monospaced, not on a proportional sans. */
49
49
  export declare const zenPixel: string;
50
50
  /** The family names as the platform resolves them: a stack on web, a registered face on native. */
51
51
  export declare const zenSansFamily: string;
52
52
  export declare const zenMonoFamily: string;
53
53
  export declare const zenPixelFamily: string;
54
54
  declare const defaultSizes: {
55
- readonly 1: 11;
56
- readonly 2: 12;
57
- readonly 3: 13;
58
- readonly 4: 14;
59
- readonly true: 14;
60
- readonly 5: 16;
61
- readonly 6: 18;
62
- readonly 7: 20;
63
- readonly 8: 23;
64
- readonly 9: 30;
65
- readonly 10: 46;
66
- readonly 11: 55;
67
- readonly 12: 62;
68
- readonly 13: 72;
69
- readonly 14: 92;
70
- readonly 15: 114;
71
- readonly 16: 134;
55
+ readonly 1: 11;
56
+ readonly 2: 12;
57
+ readonly 3: 13;
58
+ readonly 4: 14;
59
+ readonly true: 14;
60
+ readonly 5: 16;
61
+ readonly 6: 18;
62
+ readonly 7: 20;
63
+ readonly 8: 23;
64
+ readonly 9: 30;
65
+ readonly 10: 46;
66
+ readonly 11: 55;
67
+ readonly 12: 62;
68
+ readonly 13: 72;
69
+ readonly 14: 92;
70
+ readonly 15: 114;
71
+ readonly 16: 134;
72
72
  };
73
73
  type SizeOpts = {
74
- sizeLineHeight?: (fontSize: number) => number;
75
- sizeSize?: (size: number) => number;
74
+ sizeLineHeight?: (fontSize: number) => number;
75
+ sizeSize?: (size: number) => number;
76
76
  };
77
- export declare const createZenSansFont: <A extends GenericFont>(font?: Partial<A>, { sizeLineHeight, sizeSize }?: SizeOpts) => FillInFont<A, keyof typeof defaultSizes>;
78
- export declare const createZenPixelFont: <A extends GenericFont>(font?: Partial<A>, { sizeLineHeight, sizeSize }?: SizeOpts) => FillInFont<A, keyof typeof defaultSizes>;
79
- export declare const createZenMonoFont: <A extends GenericFont>(font?: Partial<A>, { sizeLineHeight, sizeSize }?: SizeOpts) => FillInFont<A, keyof typeof defaultSizes>;
80
-
77
+ export declare const createZenSansFont: <A extends GenericFont>(font?: Partial<A>, { sizeLineHeight, sizeSize, }?: SizeOpts) => FillInFont<A, keyof typeof defaultSizes>;
78
+ export declare const createZenPixelFont: <A extends GenericFont>(font?: Partial<A>, { sizeLineHeight, sizeSize, }?: SizeOpts) => FillInFont<A, keyof typeof defaultSizes>;
79
+ export declare const createZenMonoFont: <A extends GenericFont>(font?: Partial<A>, { sizeLineHeight, sizeSize, }?: SizeOpts) => FillInFont<A, keyof typeof defaultSizes>;
81
80
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1 @@
1
- {
2
- "mappings": "AAAA,cAAc,YAAY,mBAAmB;AAG7C,cAAc,aAAa,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B7C,OAAO,cAAM;AACb,OAAO,cAAM;;;;;;;AAQb,OAAO,cAAM;;;;;;;;AASb,OAAO,cAAM;;AAGb,OAAO,cAAM;;;AAIb,OAAO,cAAM;;AAGb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AAEb,cAAM;UACJ,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,MAAM;UACN,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,GAAG;UACH,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;UACJ,IAAI;;KAwBD,WAAW;CACd,kBAAkB;CAClB,YAAY;;AAGd,OAAO,cAAM,oBAAqB,UAAU,aAC1C,OAAM,QAAQ,IACd,EACE,gBACA,aACC,aACF,WAAW,gBAAgB;AAM9B,OAAO,cAAM,qBAAsB,UAAU,aAC3C,OAAM,QAAQ,IACd,EACE,gBACA,aACC,aACF,WAAW,gBAAgB;AAM9B,OAAO,cAAM,oBAAqB,UAAU,aAC1C,OAAM,QAAQ,IACd,EACE,gBACA,aACC,aACF,WAAW,gBAAgB",
3
- "names": [],
4
- "sources": [
5
- "src/index.ts"
6
- ],
7
- "version": 3,
8
- "sourcesContent": [
9
- "import type { FillInFont, GenericFont } from '@hanzogui/core'\nimport { createFont, getVariableValue, isWeb } from '@hanzogui/core'\n\nexport type { GenericFont, FillInFont } from '@hanzogui/core'\n\n/**\n * Zen is the Hanzo typeface: Zen for the UI, Zen Mono for anything monospaced.\n * This module is the single place either one is named — the family stacks the\n * tokens bind to, and the kit fonts built on them. An app that states a family\n * of its own is a second source of truth and will drift from the rest of the\n * fleet.\n *\n * THE BYTES COME FROM `@hanzo/font`, which ships the woff2 files and the\n * @font-face that reaches them:\n *\n * import '@hanzo/font/css' // once, at the app's entry\n *\n * That package owns the faces; this one owns the names the kit binds. This\n * module used to carry a second copy of the @font-face rules pointed at a\n * versioned CDN path, so the family name and the file behind it were two\n * decisions that could disagree — and for Zen they did: nothing is served under\n * that path, so every rule it emitted would have 404'd.\n */\n\n/**\n * The two family names, exactly as `@hanzo/font` registers them.\n *\n * Everything else here is derived from these, so a stack and a native face can\n * never name the typeface differently. Spelling the name a second time anywhere\n * is how a font silently stops resolving.\n */\nexport const ZEN_SANS_FAMILY: string = 'Zen'\nexport const ZEN_MONO_FAMILY: string = 'Zen Mono'\n\n/**\n * The pixel face. `@hanzo/font` ships five cuts — Square, Grid, Line, Circle,\n * Triangle — and Square is the one a UI reaches for; the others are display.\n * This is the face that replaced Silkscreen, so the kit keeps a pixel ROLE\n * without naming somebody else's typeface to fill it.\n */\nexport const ZEN_PIXEL_FAMILY: string = 'Zen Pixel Square'\n\n/**\n * The UI face.\n *\n * Everything after Zen is a system face, and the list ends in `sans-serif`: a\n * font that fails to load must never leave the browser on its default, which is\n * a serif.\n */\nexport const zenSans: string = `\"${ZEN_SANS_FAMILY}\", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif`\n\n/** The monospace face, ending in `monospace` for the same reason. */\nexport const zenMono: string = `\"${ZEN_MONO_FAMILY}\", ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace`\n\n/** The pixel face, falling back through mono — a pixel face that fails to load\n * should land on something monospaced, not on a proportional sans. */\nexport const zenPixel: string = `\"${ZEN_PIXEL_FAMILY}\", \"${ZEN_MONO_FAMILY}\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`\n\n/** The family names as the platform resolves them: a stack on web, a registered face on native. */\nexport const zenSansFamily: string = isWeb ? zenSans : ZEN_SANS_FAMILY\nexport const zenMonoFamily: string = isWeb ? zenMono : ZEN_MONO_FAMILY\nexport const zenPixelFamily: string = isWeb ? zenPixel : ZEN_PIXEL_FAMILY\n\nconst defaultSizes = {\n 1: 11,\n 2: 12,\n 3: 13,\n 4: 14,\n true: 14,\n 5: 16,\n 6: 18,\n 7: 20,\n 8: 23,\n 9: 30,\n 10: 46,\n 11: 55,\n 12: 62,\n 13: 72,\n 14: 92,\n 15: 114,\n 16: 134,\n} as const\n\nconst createZenFont = (\n family: string,\n font: Partial<GenericFont>,\n sizeLineHeight: (fontSize: number) => number,\n sizeSize: (size: number) => number\n) => {\n const size = Object.fromEntries(\n Object.entries({ ...defaultSizes, ...font.size }).map(([k, v]) => [k, sizeSize(+v)])\n )\n return createFont({\n family,\n lineHeight: Object.fromEntries(\n Object.entries(size).map(([k, v]) => [k, sizeLineHeight(getVariableValue(v))])\n ),\n weight: { 4: '400' },\n letterSpacing: { 4: 0 },\n ...(font as any),\n size,\n })\n}\n\ntype SizeOpts = {\n sizeLineHeight?: (fontSize: number) => number\n sizeSize?: (size: number) => number\n}\n\nexport const createZenSansFont = <A extends GenericFont>(\n font: Partial<A> = {},\n {\n sizeLineHeight = (size) => Math.round(size * 1.5),\n sizeSize = (size) => size * 1,\n }: SizeOpts = {}\n): FillInFont<A, keyof typeof defaultSizes> =>\n createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize) as FillInFont<\n A,\n keyof typeof defaultSizes\n >\n\nexport const createZenPixelFont = <A extends GenericFont>(\n font: Partial<A> = {},\n {\n sizeLineHeight = (size) => Math.round(size * 1.5),\n sizeSize = (size) => size * 1,\n }: SizeOpts = {}\n): FillInFont<A, keyof typeof defaultSizes> =>\n createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize) as FillInFont<\n A,\n keyof typeof defaultSizes\n >\n\nexport const createZenMonoFont = <A extends GenericFont>(\n font: Partial<A> = {},\n {\n sizeLineHeight = (size) => Math.round(size * 1.5),\n sizeSize = (size) => size * 1,\n }: SizeOpts = {}\n): FillInFont<A, keyof typeof defaultSizes> =>\n createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize) as FillInFont<\n A,\n keyof typeof defaultSizes\n >\n"
10
- ]
11
- }
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG7D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AC/C,OAAO,CAAC,CAAC,CAAC,kCAIb,QAAQ,KACV,UAAU,CAAC,CAAC,EAAE,MAAM,OAAO,YAAY,CAIvC,CAAA;AAEH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,WAAW,SAChD,OAAO,CAAC,CAAC,CAAC,kCAIb,QAAQ,KACV,UAAU,CAAC,CAAC,EAAE,MAAM,OAAO,YAAY,CAIvC,CAAA;AAEH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,WAAW,SAC/C,OAAO,CAAC,CAAC,CAAC,kCAIb,QAAQ,KACV,UAAU,CAAC,CAAC,EAAE,MAAM,OAAO,YAAY,CAIvC,CAAA"}
@@ -1,97 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
23
- var index_exports = {};
24
- __export(index_exports, {
25
- ZEN_MONO_FAMILY: () => ZEN_MONO_FAMILY,
26
- ZEN_PIXEL_FAMILY: () => ZEN_PIXEL_FAMILY,
27
- ZEN_SANS_FAMILY: () => ZEN_SANS_FAMILY,
28
- createZenMonoFont: () => createZenMonoFont,
29
- createZenPixelFont: () => createZenPixelFont,
30
- createZenSansFont: () => createZenSansFont,
31
- zenMono: () => zenMono,
32
- zenMonoFamily: () => zenMonoFamily,
33
- zenPixel: () => zenPixel,
34
- zenPixelFamily: () => zenPixelFamily,
35
- zenSans: () => zenSans,
36
- zenSansFamily: () => zenSansFamily
37
- });
38
- module.exports = __toCommonJS(index_exports);
39
- var import_core = require("@hanzogui/core");
40
- const ZEN_SANS_FAMILY = "Zen";
41
- const ZEN_MONO_FAMILY = "Zen Mono";
42
- const ZEN_PIXEL_FAMILY = "Zen Pixel Square";
43
- const zenSans = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
44
- const zenMono = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
45
- const zenPixel = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
46
- const zenSansFamily = import_core.isWeb ? zenSans : ZEN_SANS_FAMILY;
47
- const zenMonoFamily = import_core.isWeb ? zenMono : ZEN_MONO_FAMILY;
48
- const zenPixelFamily = import_core.isWeb ? zenPixel : ZEN_PIXEL_FAMILY;
49
- const defaultSizes = {
50
- 1: 11,
51
- 2: 12,
52
- 3: 13,
53
- 4: 14,
54
- true: 14,
55
- 5: 16,
56
- 6: 18,
57
- 7: 20,
58
- 8: 23,
59
- 9: 30,
60
- 10: 46,
61
- 11: 55,
62
- 12: 62,
63
- 13: 72,
64
- 14: 92,
65
- 15: 114,
66
- 16: 134
67
- };
68
- const createZenFont = (family, font, sizeLineHeight, sizeSize) => {
69
- const size = Object.fromEntries(Object.entries({
70
- ...defaultSizes,
71
- ...font.size
72
- }).map(([k, v]) => [k, sizeSize(+v)]));
73
- return (0, import_core.createFont)({
74
- family,
75
- lineHeight: Object.fromEntries(Object.entries(size).map(([k, v]) => [k, sizeLineHeight((0, import_core.getVariableValue)(v))])),
76
- weight: {
77
- 4: "400"
78
- },
79
- letterSpacing: {
80
- 4: 0
81
- },
82
- ...font,
83
- size
84
- });
85
- };
86
- const createZenSansFont = (font = {}, {
87
- sizeLineHeight = size => Math.round(size * 1.5),
88
- sizeSize = size => size * 1
89
- } = {}) => createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize);
90
- const createZenPixelFont = (font = {}, {
91
- sizeLineHeight = size => Math.round(size * 1.5),
92
- sizeSize = size => size * 1
93
- } = {}) => createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize);
94
- const createZenMonoFont = (font = {}, {
95
- sizeLineHeight = size => Math.round(size * 1.5),
96
- sizeSize = size => size * 1
97
- } = {}) => createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize);
@@ -1,130 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
25
- var index_exports = {};
26
- __export(index_exports, {
27
- ZEN_MONO_FAMILY: () => ZEN_MONO_FAMILY,
28
- ZEN_PIXEL_FAMILY: () => ZEN_PIXEL_FAMILY,
29
- ZEN_SANS_FAMILY: () => ZEN_SANS_FAMILY,
30
- createZenMonoFont: () => createZenMonoFont,
31
- createZenPixelFont: () => createZenPixelFont,
32
- createZenSansFont: () => createZenSansFont,
33
- zenMono: () => zenMono,
34
- zenMonoFamily: () => zenMonoFamily,
35
- zenPixel: () => zenPixel,
36
- zenPixelFamily: () => zenPixelFamily,
37
- zenSans: () => zenSans,
38
- zenSansFamily: () => zenSansFamily
39
- });
40
- module.exports = __toCommonJS(index_exports);
41
- var import_core = require("@hanzogui/core");
42
- var ZEN_SANS_FAMILY = "Zen";
43
- var ZEN_MONO_FAMILY = "Zen Mono";
44
- var ZEN_PIXEL_FAMILY = "Zen Pixel Square";
45
- var zenSans = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
46
- var zenMono = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
47
- var zenPixel = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
48
- var zenSansFamily = import_core.isWeb ? zenSans : ZEN_SANS_FAMILY;
49
- var zenMonoFamily = import_core.isWeb ? zenMono : ZEN_MONO_FAMILY;
50
- var zenPixelFamily = import_core.isWeb ? zenPixel : ZEN_PIXEL_FAMILY;
51
- var defaultSizes = {
52
- 1: 11,
53
- 2: 12,
54
- 3: 13,
55
- 4: 14,
56
- true: 14,
57
- 5: 16,
58
- 6: 18,
59
- 7: 20,
60
- 8: 23,
61
- 9: 30,
62
- 10: 46,
63
- 11: 55,
64
- 12: 62,
65
- 13: 72,
66
- 14: 92,
67
- 15: 114,
68
- 16: 134
69
- };
70
- var createZenFont = function (family, font, sizeLineHeight, sizeSize) {
71
- var size = Object.fromEntries(Object.entries({
72
- ...defaultSizes,
73
- ...font.size
74
- }).map(function (param) {
75
- var [k, v] = param;
76
- return [k, sizeSize(+v)];
77
- }));
78
- return (0, import_core.createFont)({
79
- family,
80
- lineHeight: Object.fromEntries(Object.entries(size).map(function (param) {
81
- var [k, v] = param;
82
- return [k, sizeLineHeight((0, import_core.getVariableValue)(v))];
83
- })),
84
- weight: {
85
- 4: "400"
86
- },
87
- letterSpacing: {
88
- 4: 0
89
- },
90
- ...font,
91
- size
92
- });
93
- };
94
- var createZenSansFont = function () {
95
- var font = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
96
- {
97
- sizeLineHeight = function (size) {
98
- return Math.round(size * 1.5);
99
- },
100
- sizeSize = function (size) {
101
- return size * 1;
102
- }
103
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
104
- return createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize);
105
- };
106
- var createZenPixelFont = function () {
107
- var font = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
108
- {
109
- sizeLineHeight = function (size) {
110
- return Math.round(size * 1.5);
111
- },
112
- sizeSize = function (size) {
113
- return size * 1;
114
- }
115
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
116
- return createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize);
117
- };
118
- var createZenMonoFont = function () {
119
- var font = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
120
- {
121
- sizeLineHeight = function (size) {
122
- return Math.round(size * 1.5);
123
- },
124
- sizeSize = function (size) {
125
- return size * 1;
126
- }
127
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
128
- return createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize);
129
- };
130
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","ZEN_MONO_FAMILY","ZEN_PIXEL_FAMILY","ZEN_SANS_FAMILY","createZenMonoFont","createZenPixelFont","createZenSansFont","zenMono","zenMonoFamily","zenPixel","zenPixelFamily","zenSans","zenSansFamily","module","exports","import_core","require","isWeb","defaultSizes","true","createZenFont","family","font","sizeLineHeight","sizeSize","size","Object","fromEntries","entries","map","param","k","v","createFont","lineHeight","getVariableValue","weight","letterSpacing"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;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;EACAC,IAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,KAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACN;AAEA;AAME,IAAAC,aAAa,YAAAA,CAAOC,MAAA,EAAAC,IAAA,EAAAC,cAAA,EAAAC,QAAA;EAAA,IAClBC,IAAA,GAAOC,MAAQ,CAAAC,WAAK,CAAAD,MAAc,CAAAE,OAAQ;IAC5C,GAAAV,YAAA;IACA,GAAAI,IAAA,CAAAG;EAAkB,EAChB,CAAAI,GAAA,WAAAC,KAAA;IACA,KAAAC,CAAA,EAAAC,CAAA,IAAYF,KAAA;IAAO,OACjB,CACFC,CAAA,EACAP,QAAU,EAAAQ,CAAG,EACb;EAAsB,EACtB;EAAI,OACJ,IAAAjB,WAAA,CAAAkB,UAAA;IACDZ,MAAA;IACHa,UAAA,EAAAR,MAAA,CAAAC,WAAA,CAAAD,MAAA,CAAAE,OAAA,CAAAH,IAAA,EAAAI,GAAA,WAAAC,KAAA;MAOa,KAAAC,CAAA,EAAAC,CAAA,IAAAF,KAAA;MAGT,QACAC,CAAA,EACaR,cAEf,GAAc,EAAAR,WAAA,CAAAoB,gBAAqB,EAAAH,CAAA,GAKxB;IAGT;IACAI,MAAA;MACa;IAOV;IAGHC,aAAA,EAAiB;MACjB;IACY,CAAC","ignoreList":[]}
@@ -1,61 +0,0 @@
1
- import { createFont, getVariableValue, isWeb } from "@hanzogui/core";
2
- const ZEN_SANS_FAMILY = "Zen";
3
- const ZEN_MONO_FAMILY = "Zen Mono";
4
- const ZEN_PIXEL_FAMILY = "Zen Pixel Square";
5
- const zenSans = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
6
- const zenMono = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
7
- const zenPixel = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
8
- const zenSansFamily = isWeb ? zenSans : ZEN_SANS_FAMILY;
9
- const zenMonoFamily = isWeb ? zenMono : ZEN_MONO_FAMILY;
10
- const zenPixelFamily = isWeb ? zenPixel : ZEN_PIXEL_FAMILY;
11
- const defaultSizes = {
12
- 1: 11,
13
- 2: 12,
14
- 3: 13,
15
- 4: 14,
16
- true: 14,
17
- 5: 16,
18
- 6: 18,
19
- 7: 20,
20
- 8: 23,
21
- 9: 30,
22
- 10: 46,
23
- 11: 55,
24
- 12: 62,
25
- 13: 72,
26
- 14: 92,
27
- 15: 114,
28
- 16: 134
29
- };
30
- const createZenFont = (family, font, sizeLineHeight, sizeSize) => {
31
- const size = Object.fromEntries(Object.entries({
32
- ...defaultSizes,
33
- ...font.size
34
- }).map(([k, v]) => [k, sizeSize(+v)]));
35
- return createFont({
36
- family,
37
- lineHeight: Object.fromEntries(Object.entries(size).map(([k, v]) => [k, sizeLineHeight(getVariableValue(v))])),
38
- weight: {
39
- 4: "400"
40
- },
41
- letterSpacing: {
42
- 4: 0
43
- },
44
- ...font,
45
- size
46
- });
47
- };
48
- const createZenSansFont = (font = {}, {
49
- sizeLineHeight = size => Math.round(size * 1.5),
50
- sizeSize = size => size * 1
51
- } = {}) => createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize);
52
- const createZenPixelFont = (font = {}, {
53
- sizeLineHeight = size => Math.round(size * 1.5),
54
- sizeSize = size => size * 1
55
- } = {}) => createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize);
56
- const createZenMonoFont = (font = {}, {
57
- sizeLineHeight = size => Math.round(size * 1.5),
58
- sizeSize = size => size * 1
59
- } = {}) => createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize);
60
- export { ZEN_MONO_FAMILY, ZEN_PIXEL_FAMILY, ZEN_SANS_FAMILY, createZenMonoFont, createZenPixelFont, createZenSansFont, zenMono, zenMonoFamily, zenPixel, zenPixelFamily, zenSans, zenSansFamily };
61
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createFont","getVariableValue","isWeb","ZEN_SANS_FAMILY","ZEN_MONO_FAMILY","ZEN_PIXEL_FAMILY","zenSans","zenMono","zenPixel","zenSansFamily","zenMonoFamily","zenPixelFamily","defaultSizes","true","createZenFont","family","font","sizeLineHeight","sizeSize","size","Object","fromEntries","entries","map","k","v","lineHeight","weight","letterSpacing","createZenSansFont","Math","round","createZenPixelFont","createZenMonoFont"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,UAAA,EAAYC,gBAAA,EAAkBC,KAAA,QAAa;AA8B7C,MAAMC,eAAA,GAA0B;AAChC,MAAMC,eAAA,GAA0B;AAQhC,MAAMC,gBAAA,GAA2B;AASjC,MAAMC,OAAA,GAAkB,IAAIH,eAAe;AAG3C,MAAMI,OAAA,GAAkB,IAAIH,eAAe;AAI3C,MAAMI,QAAA,GAAmB,IAAIH,gBAAgB,OAAOD,eAAe;AAGnE,MAAMK,aAAA,GAAwBP,KAAA,GAAQI,OAAA,GAAUH,eAAA;AAChD,MAAMO,aAAA,GAAwBR,KAAA,GAAQK,OAAA,GAAUH,eAAA;AAChD,MAAMO,cAAA,GAAyBT,KAAA,GAAQM,QAAA,GAAWH,gBAAA;AAEzD,MAAMO,YAAA,GAAe;EACnB,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACHC,IAAA,EAAM;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;AACN;AAEA,MAAMC,aAAA,GAAgBA,CACpBC,MAAA,EACAC,IAAA,EACAC,cAAA,EACAC,QAAA,KACG;EACH,MAAMC,IAAA,GAAOC,MAAA,CAAOC,WAAA,CAClB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C,KAAA,CAAMZ,IAAA,GAAO,GAAG;EAChDD,QAAA,GAAYC,IAAA,IAASA,IAAA,GAAO;AAC9B,IAAc,CAAC,MAEfL,aAAA,CAAcJ,aAAA,EAAeM,IAAA,EAAMC,cAAA,EAAgBC,QAAQ","ignoreList":[]}
@@ -1,91 +0,0 @@
1
- import { createFont, getVariableValue, isWeb } from "@hanzogui/core";
2
- var ZEN_SANS_FAMILY = "Zen";
3
- var ZEN_MONO_FAMILY = "Zen Mono";
4
- var ZEN_PIXEL_FAMILY = "Zen Pixel Square";
5
- var zenSans = `"${ZEN_SANS_FAMILY}", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`;
6
- var zenMono = `"${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`;
7
- var zenPixel = `"${ZEN_PIXEL_FAMILY}", "${ZEN_MONO_FAMILY}", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`;
8
- var zenSansFamily = isWeb ? zenSans : ZEN_SANS_FAMILY;
9
- var zenMonoFamily = isWeb ? zenMono : ZEN_MONO_FAMILY;
10
- var zenPixelFamily = isWeb ? zenPixel : ZEN_PIXEL_FAMILY;
11
- var defaultSizes = {
12
- 1: 11,
13
- 2: 12,
14
- 3: 13,
15
- 4: 14,
16
- true: 14,
17
- 5: 16,
18
- 6: 18,
19
- 7: 20,
20
- 8: 23,
21
- 9: 30,
22
- 10: 46,
23
- 11: 55,
24
- 12: 62,
25
- 13: 72,
26
- 14: 92,
27
- 15: 114,
28
- 16: 134
29
- };
30
- var createZenFont = function (family, font, sizeLineHeight, sizeSize) {
31
- var size = Object.fromEntries(Object.entries({
32
- ...defaultSizes,
33
- ...font.size
34
- }).map(function (param) {
35
- var [k, v] = param;
36
- return [k, sizeSize(+v)];
37
- }));
38
- return createFont({
39
- family,
40
- lineHeight: Object.fromEntries(Object.entries(size).map(function (param) {
41
- var [k, v] = param;
42
- return [k, sizeLineHeight(getVariableValue(v))];
43
- })),
44
- weight: {
45
- 4: "400"
46
- },
47
- letterSpacing: {
48
- 4: 0
49
- },
50
- ...font,
51
- size
52
- });
53
- };
54
- var createZenSansFont = function () {
55
- var font = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
56
- {
57
- sizeLineHeight = function (size) {
58
- return Math.round(size * 1.5);
59
- },
60
- sizeSize = function (size) {
61
- return size * 1;
62
- }
63
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
64
- return createZenFont(zenSansFamily, font, sizeLineHeight, sizeSize);
65
- };
66
- var createZenPixelFont = function () {
67
- var font = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
68
- {
69
- sizeLineHeight = function (size) {
70
- return Math.round(size * 1.5);
71
- },
72
- sizeSize = function (size) {
73
- return size * 1;
74
- }
75
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
76
- return createZenFont(zenPixelFamily, font, sizeLineHeight, sizeSize);
77
- };
78
- var createZenMonoFont = function () {
79
- var font = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
80
- {
81
- sizeLineHeight = function (size) {
82
- return Math.round(size * 1.5);
83
- },
84
- sizeSize = function (size) {
85
- return size * 1;
86
- }
87
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
88
- return createZenFont(zenMonoFamily, font, sizeLineHeight, sizeSize);
89
- };
90
- export { ZEN_MONO_FAMILY, ZEN_PIXEL_FAMILY, ZEN_SANS_FAMILY, createZenMonoFont, createZenPixelFont, createZenSansFont, zenMono, zenMonoFamily, zenPixel, zenPixelFamily, zenSans, zenSansFamily };
91
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createFont","getVariableValue","isWeb","ZEN_SANS_FAMILY","ZEN_MONO_FAMILY","ZEN_PIXEL_FAMILY","zenSans","zenMono","zenPixel","zenSansFamily","zenMonoFamily","zenPixelFamily","defaultSizes","true","createZenFont","family","font","sizeLineHeight","sizeSize","size","Object","fromEntries","entries","map","param","k","v","lineHeight","weight","letterSpacing"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,UAAA,EAAYC,gBAAA,EAAkBC,KAAA,QAAa;AA8B7C,IAAAC,eAAM,QAA0B;AAChC,IAAAC,eAAM,aAA0B;AAQhC,IAAAC,gBAAM,qBAA2B;AASjC,IAAAC,OAAM,OAAkBH,eAAI,kHAAe;AAG3C,IAAAI,OAAM,OAAkBH,eAAI,2FAAe;AAI3C,IAAAI,QAAM,OAAmBH,gBAAI,OAAgBD,eAAO,6DAAe;AAGnE,IAAAK,aAAM,GAAAP,KAAwB,GAAAI,OAAQ,GAAAH,eAAU;AAChD,IAAAO,aAAM,GAAAR,KAAwB,GAAAK,OAAQ,GAAAH,eAAU;AAChD,IAAAO,cAAM,GAAAT,KAAyB,GAAAM,QAAQ,GAAAH,gBAAW;AAEzD,IAAAO,YAAM;EACJ,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACHC,IAAA,EAAM;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;AACN;AAEA,IAAAC,aAAM,YAAAA,CACJC,MACA,EACAC,IAAA,EAAAC,cACA,EAAAC,QACG;EACH,IAAAC,IAAM,GAAAC,MAAO,CAAAC,WAAO,CAAAD,MAAA,CAAAE,OAAA;IAClB,GAAAV,YAAe;IACjB,GAAAI,IAAA,CAAAG;EACA,GAAAI,GAAA,CAAO,UAAAC,KAAW;IAChB,KAAAC,CAAA,EAAAC,CAAA,IAAAF,KAAA;IACA,QACEC,CAAA,EACFP,QAAA,EAAAQ,CAAA,EACA;EAAmB,EACnB;EAAsB,OAClB1B,UAAA;IACJe,MAAA;IACDY,UAAA,EAAAP,MAAA,CAAAC,WAAA,CAAAD,MAA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