@passui/tokens 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accent.d.ts +28 -0
- package/dist/accent.js +127 -0
- package/dist/color.d.ts +56 -0
- package/dist/color.js +63 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/layout.d.ts +33 -0
- package/dist/layout.js +35 -0
- package/dist/motion.d.ts +65 -0
- package/dist/motion.js +90 -0
- package/dist/theme-css.d.ts +10 -0
- package/dist/theme-css.js +92 -0
- package/dist/typography.d.ts +94 -0
- package/dist/typography.js +89 -0
- package/package.json +61 -56
- package/styles/base.css +94 -77
- package/styles/globals.css +5 -0
- package/styles/styles.css +40 -35
- package/styles/typeset.css +896 -681
- package/styles/utilities.css +362 -140
- package/theme.css +8 -0
- package/src/accent.ts +0 -157
- package/src/color.ts +0 -113
- package/src/index.ts +0 -6
- package/src/layout.ts +0 -34
- package/src/motion.ts +0 -31
- package/src/theme-css.ts +0 -101
- package/src/typography.ts +0 -99
package/src/accent.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accent colors people can choose. Blush, the soft pink of the iPhone 15,
|
|
3
|
-
* is the default and Passui's own color; the others are calm, slightly
|
|
4
|
-
* muted tones that sit well on warm paper.
|
|
5
|
-
* Each sets the four accent roles for light and dark schemes.
|
|
6
|
-
*/
|
|
7
|
-
export interface AccentColors {
|
|
8
|
-
accent: string
|
|
9
|
-
onAccent: string
|
|
10
|
-
accentText: string
|
|
11
|
-
accentSoft: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type AccentId = "blush" | "honey" | "sage" | "ocean" | "lavender" | "rose" | "graphite"
|
|
15
|
-
|
|
16
|
-
export interface Accent {
|
|
17
|
-
id: AccentId
|
|
18
|
-
name: string
|
|
19
|
-
/**
|
|
20
|
-
* The color that stands for this accent in pickers and on the brand. Usually
|
|
21
|
-
* the fill itself; Blush keeps its soft pink here while controls use a
|
|
22
|
-
* deeper shade that can be seen against white.
|
|
23
|
-
*/
|
|
24
|
-
swatch: string
|
|
25
|
-
light: AccentColors
|
|
26
|
-
dark: AccentColors
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const accents: Record<AccentId, Accent> = {
|
|
30
|
-
blush: {
|
|
31
|
-
id: "blush",
|
|
32
|
-
name: "Blush",
|
|
33
|
-
swatch: "#f2d4d7",
|
|
34
|
-
// The soft pink is too pale for a switched-on toggle (1.4:1); rose pink
|
|
35
|
-
// reaches 3:1 on every light ground, the warm sidebar included.
|
|
36
|
-
light: {
|
|
37
|
-
accent: "#d16988",
|
|
38
|
-
onAccent: "#1c1c1e",
|
|
39
|
-
accentText: "#9e3b4f",
|
|
40
|
-
accentSoft: "#fbeff0",
|
|
41
|
-
},
|
|
42
|
-
dark: {
|
|
43
|
-
accent: "#e8b4bb",
|
|
44
|
-
onAccent: "#22131a",
|
|
45
|
-
accentText: "#efb3bc",
|
|
46
|
-
accentSoft: "#36242a",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
honey: {
|
|
50
|
-
id: "honey",
|
|
51
|
-
name: "Honey",
|
|
52
|
-
swatch: "#efbd52",
|
|
53
|
-
light: {
|
|
54
|
-
accent: "#efbd52",
|
|
55
|
-
onAccent: "#1c1c1e",
|
|
56
|
-
accentText: "#835608",
|
|
57
|
-
accentSoft: "#f8eed6",
|
|
58
|
-
},
|
|
59
|
-
dark: {
|
|
60
|
-
accent: "#e2b04f",
|
|
61
|
-
onAccent: "#1c1c1e",
|
|
62
|
-
accentText: "#e8bf6c",
|
|
63
|
-
accentSoft: "#342b1a",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
sage: {
|
|
67
|
-
id: "sage",
|
|
68
|
-
name: "Sage",
|
|
69
|
-
swatch: "#a9c29b",
|
|
70
|
-
light: {
|
|
71
|
-
accent: "#a9c29b",
|
|
72
|
-
onAccent: "#1c1c1e",
|
|
73
|
-
accentText: "#46653b",
|
|
74
|
-
accentSoft: "#e6ede0",
|
|
75
|
-
},
|
|
76
|
-
dark: {
|
|
77
|
-
accent: "#93b285",
|
|
78
|
-
onAccent: "#141812",
|
|
79
|
-
accentText: "#a9c79c",
|
|
80
|
-
accentSoft: "#232b20",
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
ocean: {
|
|
84
|
-
id: "ocean",
|
|
85
|
-
name: "Ocean",
|
|
86
|
-
swatch: "#9cc3e6",
|
|
87
|
-
light: {
|
|
88
|
-
accent: "#9cc3e6",
|
|
89
|
-
onAccent: "#1c1c1e",
|
|
90
|
-
accentText: "#2c6193",
|
|
91
|
-
accentSoft: "#e2ecf6",
|
|
92
|
-
},
|
|
93
|
-
dark: {
|
|
94
|
-
accent: "#79acdb",
|
|
95
|
-
onAccent: "#0f1720",
|
|
96
|
-
accentText: "#93bde4",
|
|
97
|
-
accentSoft: "#1d2834",
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
lavender: {
|
|
101
|
-
id: "lavender",
|
|
102
|
-
name: "Lavender",
|
|
103
|
-
swatch: "#c3b8ea",
|
|
104
|
-
light: {
|
|
105
|
-
accent: "#c3b8ea",
|
|
106
|
-
onAccent: "#1c1c1e",
|
|
107
|
-
accentText: "#5d4f9e",
|
|
108
|
-
accentSoft: "#ece8f7",
|
|
109
|
-
},
|
|
110
|
-
dark: {
|
|
111
|
-
accent: "#a99cdf",
|
|
112
|
-
onAccent: "#16131f",
|
|
113
|
-
accentText: "#bdb3ea",
|
|
114
|
-
accentSoft: "#282435",
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
rose: {
|
|
118
|
-
id: "rose",
|
|
119
|
-
name: "Rose",
|
|
120
|
-
swatch: "#efb3bb",
|
|
121
|
-
light: {
|
|
122
|
-
accent: "#efb3bb",
|
|
123
|
-
onAccent: "#1c1c1e",
|
|
124
|
-
accentText: "#a23f51",
|
|
125
|
-
accentSoft: "#f8e6e9",
|
|
126
|
-
},
|
|
127
|
-
dark: {
|
|
128
|
-
accent: "#e5949f",
|
|
129
|
-
onAccent: "#22131a",
|
|
130
|
-
accentText: "#efadb6",
|
|
131
|
-
accentSoft: "#36232a",
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
graphite: {
|
|
135
|
-
id: "graphite",
|
|
136
|
-
name: "Graphite",
|
|
137
|
-
swatch: "#3a3936",
|
|
138
|
-
light: {
|
|
139
|
-
accent: "#3a3936",
|
|
140
|
-
onAccent: "#ffffff",
|
|
141
|
-
accentText: "#4a4844",
|
|
142
|
-
accentSoft: "#ebe8e2",
|
|
143
|
-
},
|
|
144
|
-
dark: {
|
|
145
|
-
accent: "#d6d2ca",
|
|
146
|
-
onAccent: "#151413",
|
|
147
|
-
accentText: "#cfcbc3",
|
|
148
|
-
accentSoft: "#2e2c29",
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export const defaultAccent: AccentId = "blush"
|
|
154
|
-
|
|
155
|
-
export function isAccentId(value: unknown): value is AccentId {
|
|
156
|
-
return typeof value === "string" && value in accents
|
|
157
|
-
}
|
package/src/color.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { accents, defaultAccent } from "./accent"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Semantic color roles. Warm "paper" neutrals with a blush accent: the feel
|
|
5
|
-
* of a well-made notebook, tuned to sit naturally beside Apple's system UI.
|
|
6
|
-
*/
|
|
7
|
-
export interface ColorScheme {
|
|
8
|
-
/** Window background. */
|
|
9
|
-
background: string
|
|
10
|
-
/** Sidebar and toolbars. */
|
|
11
|
-
sidebar: string
|
|
12
|
-
/** Lists and secondary panes. */
|
|
13
|
-
surface: string
|
|
14
|
-
/** Writing and reading surface. */
|
|
15
|
-
paper: string
|
|
16
|
-
/** Cards, popovers and sheets. */
|
|
17
|
-
elevated: string
|
|
18
|
-
/** Inputs, chips and pressed states. */
|
|
19
|
-
fill: string
|
|
20
|
-
separator: string
|
|
21
|
-
label: string
|
|
22
|
-
labelSecondary: string
|
|
23
|
-
labelTertiary: string
|
|
24
|
-
/** Body text on paper. */
|
|
25
|
-
ink: string
|
|
26
|
-
/** Selection, active items and primary fills. */
|
|
27
|
-
accent: string
|
|
28
|
-
/** Text and icons placed on `accent`. */
|
|
29
|
-
onAccent: string
|
|
30
|
-
/** Accent-colored text and icons on neutral backgrounds (AA contrast). */
|
|
31
|
-
accentText: string
|
|
32
|
-
/** Subtle accent tint for selected rows. */
|
|
33
|
-
accentSoft: string
|
|
34
|
-
highlight: string
|
|
35
|
-
heart: string
|
|
36
|
-
/** Floating toolbars and primary buttons. */
|
|
37
|
-
inverse: string
|
|
38
|
-
onInverse: string
|
|
39
|
-
success: string
|
|
40
|
-
warning: string
|
|
41
|
-
danger: string
|
|
42
|
-
/** Glass materials: the lit top edge and the hairline rim. */
|
|
43
|
-
glassHighlight: string
|
|
44
|
-
glassRim: string
|
|
45
|
-
/** Clear glass: its faint tint, the specular edge light and the sheen across it. */
|
|
46
|
-
glassTint: string
|
|
47
|
-
glassSpecular: string
|
|
48
|
-
glassSheen: string
|
|
49
|
-
/** Shadows under floating glass, and the deeper one under menus. */
|
|
50
|
-
shadowFloating: string
|
|
51
|
-
shadowMenu: string
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const light: ColorScheme = {
|
|
55
|
-
background: "#ffffff",
|
|
56
|
-
sidebar: "#f3efe6",
|
|
57
|
-
surface: "#fdfcf9",
|
|
58
|
-
paper: "#fffdf8",
|
|
59
|
-
elevated: "#ffffff",
|
|
60
|
-
fill: "#efebe2",
|
|
61
|
-
separator: "#e3dccb",
|
|
62
|
-
label: "#1c1c1e",
|
|
63
|
-
labelSecondary: "#6b6458",
|
|
64
|
-
labelTertiary: "#8b8478",
|
|
65
|
-
ink: "#24221f",
|
|
66
|
-
...accents[defaultAccent].light,
|
|
67
|
-
highlight: "#ffe58a",
|
|
68
|
-
heart: "#ff375f",
|
|
69
|
-
inverse: "#1c1c1e",
|
|
70
|
-
onInverse: "#ffffff",
|
|
71
|
-
success: "#248a3d",
|
|
72
|
-
warning: "#c93400",
|
|
73
|
-
danger: "#d70015",
|
|
74
|
-
glassHighlight: "rgb(255 255 255 / 0.55)",
|
|
75
|
-
glassRim: "rgb(118 108 92 / 0.22)",
|
|
76
|
-
// Clear, but in the sidebar's own warm paper, so it belongs to the app.
|
|
77
|
-
glassTint: "rgb(243 239 230 / 0.42)",
|
|
78
|
-
glassSpecular: "rgb(255 255 255 / 0.85)",
|
|
79
|
-
glassSheen: "rgb(255 255 255 / 0.32)",
|
|
80
|
-
shadowFloating: "rgb(40 30 0 / 0.18)",
|
|
81
|
-
shadowMenu: "rgb(40 30 0 / 0.24)",
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const dark: ColorScheme = {
|
|
85
|
-
background: "#121110",
|
|
86
|
-
sidebar: "#1a1917",
|
|
87
|
-
surface: "#161514",
|
|
88
|
-
paper: "#1a1917",
|
|
89
|
-
elevated: "#24221f",
|
|
90
|
-
fill: "#2c2a26",
|
|
91
|
-
separator: "#3a3732",
|
|
92
|
-
label: "#f5f2ec",
|
|
93
|
-
labelSecondary: "#b5aea2",
|
|
94
|
-
labelTertiary: "#8f887b",
|
|
95
|
-
ink: "#ece6da",
|
|
96
|
-
...accents[defaultAccent].dark,
|
|
97
|
-
highlight: "#7a5c00",
|
|
98
|
-
heart: "#ff375f",
|
|
99
|
-
inverse: "#f5f2ec",
|
|
100
|
-
onInverse: "#1c1c1e",
|
|
101
|
-
success: "#30d158",
|
|
102
|
-
warning: "#ff9f0a",
|
|
103
|
-
danger: "#ff453a",
|
|
104
|
-
glassHighlight: "rgb(255 255 255 / 0.1)",
|
|
105
|
-
glassRim: "rgb(255 250 240 / 0.06)",
|
|
106
|
-
glassTint: "rgb(26 25 23 / 0.5)",
|
|
107
|
-
glassSpecular: "rgb(255 250 240 / 0.12)",
|
|
108
|
-
glassSheen: "rgb(255 255 255 / 0.1)",
|
|
109
|
-
shadowFloating: "rgb(0 0 0 / 0.5)",
|
|
110
|
-
shadowMenu: "rgb(0 0 0 / 0.55)",
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const colors = { light, dark } as const
|
package/src/index.ts
DELETED
package/src/layout.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/** 4-point spacing grid. */
|
|
2
|
-
export const space = {
|
|
3
|
-
0: 0,
|
|
4
|
-
1: 4,
|
|
5
|
-
2: 8,
|
|
6
|
-
3: 12,
|
|
7
|
-
4: 16,
|
|
8
|
-
5: 20,
|
|
9
|
-
6: 24,
|
|
10
|
-
8: 32,
|
|
11
|
-
10: 40,
|
|
12
|
-
12: 48,
|
|
13
|
-
16: 64,
|
|
14
|
-
} as const
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Corner radii, in 2 px steps while small (the eye notices every pixel
|
|
18
|
-
* there) and 4 px steps beyond. Nested shapes stay concentric: an inner
|
|
19
|
-
* radius is the outer radius minus the padding between them. Pair with
|
|
20
|
-
* `borderCurve: "continuous"` on iOS.
|
|
21
|
-
*/
|
|
22
|
-
export const radius = {
|
|
23
|
-
xs: 4,
|
|
24
|
-
sm: 6,
|
|
25
|
-
md: 8,
|
|
26
|
-
lg: 10,
|
|
27
|
-
xl: 12,
|
|
28
|
-
"2xl": 14,
|
|
29
|
-
"3xl": 16,
|
|
30
|
-
"4xl": 20,
|
|
31
|
-
"5xl": 24,
|
|
32
|
-
sheet: 28,
|
|
33
|
-
full: 9999,
|
|
34
|
-
} as const
|
package/src/motion.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spring presets shared by motion/react and CSS so interactions feel the
|
|
3
|
-
* same on every platform. Values follow SwiftUI's defaults.
|
|
4
|
-
*/
|
|
5
|
-
export interface Spring {
|
|
6
|
-
damping: number
|
|
7
|
-
stiffness: number
|
|
8
|
-
mass: number
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const springs = {
|
|
12
|
-
/** Default UI transitions. */
|
|
13
|
-
smooth: { damping: 26, stiffness: 240, mass: 1 },
|
|
14
|
-
/** Buttons, toggles and small feedback. */
|
|
15
|
-
snappy: { damping: 22, stiffness: 380, mass: 1 },
|
|
16
|
-
/** Sheets, cards and playful moments. */
|
|
17
|
-
bouncy: { damping: 14, stiffness: 220, mass: 1 },
|
|
18
|
-
} as const satisfies Record<string, Spring>
|
|
19
|
-
|
|
20
|
-
export const duration = {
|
|
21
|
-
instant: 100,
|
|
22
|
-
fast: 200,
|
|
23
|
-
normal: 300,
|
|
24
|
-
slow: 450,
|
|
25
|
-
} as const
|
|
26
|
-
|
|
27
|
-
/** CSS easing approximating the `smooth` spring for non-spring contexts. */
|
|
28
|
-
export const easing = {
|
|
29
|
-
standard: "cubic-bezier(0.2, 0.8, 0.2, 1)",
|
|
30
|
-
emphasized: "cubic-bezier(0.3, 1.3, 0.4, 1)",
|
|
31
|
-
} as const
|
package/src/theme-css.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { type AccentColors, accents, defaultAccent } from "./accent"
|
|
2
|
-
import { type ColorScheme, dark, light } from "./color"
|
|
3
|
-
import { radius, space } from "./layout"
|
|
4
|
-
import { duration, easing } from "./motion"
|
|
5
|
-
import { fontFamily, minimumTextSize, textStyles } from "./typography"
|
|
6
|
-
|
|
7
|
-
const kebab = (key: string) => key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Text styles scale together with `--type-scale` (set from the reader's text
|
|
11
|
-
* size), never below the smallest style. Line heights are separate
|
|
12
|
-
* `leading-*` utilities, so adopting a size never moves existing leading.
|
|
13
|
-
*/
|
|
14
|
-
function textStyleVars(): string[] {
|
|
15
|
-
return Object.entries(textStyles).flatMap(([name, style]) => {
|
|
16
|
-
const scaled = (px: number) =>
|
|
17
|
-
`max(${Math.min(px, minimumTextSize)}px, calc(${px}px * var(--type-scale, 1)))`
|
|
18
|
-
return [
|
|
19
|
-
` --text-${kebab(name)}: ${scaled(style.size)};`,
|
|
20
|
-
` --leading-${kebab(name)}: ${scaled(style.lineHeight)};`,
|
|
21
|
-
]
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function colorVars(scheme: ColorScheme | AccentColors, backgroundShare = 0): string {
|
|
26
|
-
return Object.entries(scheme)
|
|
27
|
-
.map(([key, value]) => {
|
|
28
|
-
// The window ground keeps a whisper of the accent's own tint,
|
|
29
|
-
// so each choice colors the whole app the way iOS's does. The
|
|
30
|
-
// reference resolves per element, so `data-accent` retints it.
|
|
31
|
-
if (key === "background" && backgroundShare) {
|
|
32
|
-
return ` --color-background: color-mix(in srgb, var(--color-accent-soft) ${backgroundShare}%, ${value});`
|
|
33
|
-
}
|
|
34
|
-
return ` --color-${kebab(key)}: ${value};`
|
|
35
|
-
})
|
|
36
|
-
.join("\n")
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Renders the tokens as a Tailwind v4 compatible stylesheet. Light values
|
|
41
|
-
* live in `@theme`; dark values apply with the system's dark appearance, or
|
|
42
|
-
* through `data-theme`. Like SwiftUI's `colorScheme` environment,
|
|
43
|
-
* `data-theme="dark"` or `"light"` works on any element, not only the root,
|
|
44
|
-
* so one part of a screen can keep its own appearance (an always-dark
|
|
45
|
-
* recorder, an always-white invoice). Accents other than the default apply
|
|
46
|
-
* through `data-accent` on the root element.
|
|
47
|
-
*/
|
|
48
|
-
export function renderThemeCss(): string {
|
|
49
|
-
const others = Object.values(accents).filter((accent) => accent.id !== defaultAccent)
|
|
50
|
-
const lines = [
|
|
51
|
-
"/* Generated by @passui/tokens. Do not edit by hand. */",
|
|
52
|
-
"@theme static {",
|
|
53
|
-
colorVars(light, 6),
|
|
54
|
-
...Object.entries(fontFamily).map(([k, v]) => ` --font-${k}: ${v};`),
|
|
55
|
-
...textStyleVars(),
|
|
56
|
-
...Object.entries(radius).map(([k, v]) => ` --radius-${k}: ${v}px;`),
|
|
57
|
-
...Object.entries(space).map(([k, v]) => ` --space-${k}: ${v}px;`),
|
|
58
|
-
...Object.entries(duration).map(([k, v]) => ` --duration-${k}: ${v}ms;`),
|
|
59
|
-
...Object.entries(easing).map(([k, v]) => ` --ease-${k}: ${v};`),
|
|
60
|
-
"}",
|
|
61
|
-
"",
|
|
62
|
-
// Native controls, scrollbars and form fills follow the same appearance.
|
|
63
|
-
":root { color-scheme: light dark; }",
|
|
64
|
-
'[data-theme="light"] { color-scheme: light; }',
|
|
65
|
-
'[data-theme="dark"] { color-scheme: dark; }',
|
|
66
|
-
"",
|
|
67
|
-
"@media (prefers-color-scheme: dark) {",
|
|
68
|
-
' :root:not([data-theme="light"]) {',
|
|
69
|
-
colorVars(dark, 4).replace(/^/gm, " "),
|
|
70
|
-
" }",
|
|
71
|
-
"}",
|
|
72
|
-
"",
|
|
73
|
-
'[data-theme="dark"] {',
|
|
74
|
-
colorVars(dark, 4),
|
|
75
|
-
"}",
|
|
76
|
-
"",
|
|
77
|
-
// A light part inside a dark screen needs the light values back.
|
|
78
|
-
':root [data-theme="light"] {',
|
|
79
|
-
colorVars(light, 6),
|
|
80
|
-
"}",
|
|
81
|
-
"",
|
|
82
|
-
...others.flatMap((accent) => {
|
|
83
|
-
const root = `:root[data-accent="${accent.id}"]`
|
|
84
|
-
return [
|
|
85
|
-
`${root}, ${root} [data-theme="light"] {`,
|
|
86
|
-
colorVars(accent.light),
|
|
87
|
-
"}",
|
|
88
|
-
"@media (prefers-color-scheme: dark) {",
|
|
89
|
-
` ${root}:not([data-theme="light"]) {`,
|
|
90
|
-
colorVars(accent.dark).replace(/^/gm, " "),
|
|
91
|
-
" }",
|
|
92
|
-
"}",
|
|
93
|
-
`${root}[data-theme="dark"], ${root} [data-theme="dark"] {`,
|
|
94
|
-
colorVars(accent.dark),
|
|
95
|
-
"}",
|
|
96
|
-
"",
|
|
97
|
-
]
|
|
98
|
-
}),
|
|
99
|
-
]
|
|
100
|
-
return lines.join("\n")
|
|
101
|
-
}
|
package/src/typography.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
export const fontFamily = {
|
|
2
|
-
sans: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif',
|
|
3
|
-
display:
|
|
4
|
-
'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif',
|
|
5
|
-
/** Reading and writing. Newsreader is bundled; New York is used where present. */
|
|
6
|
-
serif: '"Newsreader", "New York", "Iowan Old Style", Georgia, serif',
|
|
7
|
-
/** Handwriting, for notes and books written in a script hand. */
|
|
8
|
-
script: '"Caveat Variable", "Caveat", "Bradley Hand", "Segoe Print", cursive',
|
|
9
|
-
/** Neat printed handwriting. */
|
|
10
|
-
print: '"Patrick Hand", "Chalkboard SE", "Segoe Print", cursive',
|
|
11
|
-
mono: 'ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace',
|
|
12
|
-
} as const
|
|
13
|
-
|
|
14
|
-
export interface TextStyle {
|
|
15
|
-
size: number
|
|
16
|
-
lineHeight: number
|
|
17
|
-
weight: 400 | 600
|
|
18
|
-
tracking: number
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The text styles of Apple's Dynamic Type at its default ("Large") size, in
|
|
23
|
-
* points, which are CSS pixels. Names follow SwiftUI's `Font.TextStyle`.
|
|
24
|
-
* In CSS each is a `text-*` utility (`text-footnote`) with a matching
|
|
25
|
-
* `leading-*`, and all of them grow and shrink with `--type-scale`.
|
|
26
|
-
*/
|
|
27
|
-
export const textStyles = {
|
|
28
|
-
largeTitle: {
|
|
29
|
-
size: 34,
|
|
30
|
-
lineHeight: 41,
|
|
31
|
-
weight: 400,
|
|
32
|
-
tracking: 0.4,
|
|
33
|
-
},
|
|
34
|
-
title: {
|
|
35
|
-
size: 28,
|
|
36
|
-
lineHeight: 34,
|
|
37
|
-
weight: 400,
|
|
38
|
-
tracking: 0.38,
|
|
39
|
-
},
|
|
40
|
-
title2: {
|
|
41
|
-
size: 22,
|
|
42
|
-
lineHeight: 28,
|
|
43
|
-
weight: 400,
|
|
44
|
-
tracking: -0.26,
|
|
45
|
-
},
|
|
46
|
-
title3: {
|
|
47
|
-
size: 20,
|
|
48
|
-
lineHeight: 25,
|
|
49
|
-
weight: 400,
|
|
50
|
-
tracking: -0.45,
|
|
51
|
-
},
|
|
52
|
-
headline: {
|
|
53
|
-
size: 17,
|
|
54
|
-
lineHeight: 22,
|
|
55
|
-
weight: 600,
|
|
56
|
-
tracking: -0.43,
|
|
57
|
-
},
|
|
58
|
-
body: {
|
|
59
|
-
size: 17,
|
|
60
|
-
lineHeight: 22,
|
|
61
|
-
weight: 400,
|
|
62
|
-
tracking: -0.43,
|
|
63
|
-
},
|
|
64
|
-
callout: {
|
|
65
|
-
size: 16,
|
|
66
|
-
lineHeight: 21,
|
|
67
|
-
weight: 400,
|
|
68
|
-
tracking: -0.31,
|
|
69
|
-
},
|
|
70
|
-
subheadline: {
|
|
71
|
-
size: 15,
|
|
72
|
-
lineHeight: 20,
|
|
73
|
-
weight: 400,
|
|
74
|
-
tracking: -0.23,
|
|
75
|
-
},
|
|
76
|
-
footnote: {
|
|
77
|
-
size: 13,
|
|
78
|
-
lineHeight: 18,
|
|
79
|
-
weight: 400,
|
|
80
|
-
tracking: -0.08,
|
|
81
|
-
},
|
|
82
|
-
caption: {
|
|
83
|
-
size: 12,
|
|
84
|
-
lineHeight: 16,
|
|
85
|
-
weight: 400,
|
|
86
|
-
tracking: 0,
|
|
87
|
-
},
|
|
88
|
-
caption2: {
|
|
89
|
-
size: 11,
|
|
90
|
-
lineHeight: 13,
|
|
91
|
-
weight: 400,
|
|
92
|
-
tracking: 0.06,
|
|
93
|
-
},
|
|
94
|
-
} as const satisfies Record<string, TextStyle>
|
|
95
|
-
|
|
96
|
-
export type TextStyleName = keyof typeof textStyles
|
|
97
|
-
|
|
98
|
-
/** Like Dynamic Type, scaled text never drops below the smallest style. */
|
|
99
|
-
export const minimumTextSize = textStyles.caption2.size
|