@arnilo/liveframe-starter 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -2
- package/dist/catalog.d.ts +4 -0
- package/dist/catalog.js +9 -0
- package/dist/catalog.json +1897 -0
- package/dist/design-system.d.ts +3 -0
- package/dist/design-system.js +276 -0
- package/dist/implementations.d.ts +3 -0
- package/dist/implementations.js +153 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/styles.d.ts +12 -0
- package/dist/styles.js +50 -0
- package/dist/themes.d.ts +3 -0
- package/dist/themes.js +138 -0
- package/dist/ui.definitions.gen.d.ts +855 -0
- package/dist/ui.definitions.gen.js +1545 -0
- package/dist/ui.gen.d.ts +1018 -0
- package/dist/ui.gen.js +102 -0
- package/package.json +55 -4
package/dist/themes.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { validateTheme } from "@arnilo/liveframe";
|
|
2
|
+
import { catalog, valid } from "./catalog.js";
|
|
3
|
+
const px = (value) => ({ value, unit: "px" });
|
|
4
|
+
const sans = ["system-ui", "-apple-system", "Segoe UI", "Roboto", "Helvetica Neue", "Arial", "sans-serif"];
|
|
5
|
+
const mono = ["ui-monospace", "SFMono-Regular", "Menlo", "Consolas", "monospace"];
|
|
6
|
+
const text = (fontFamily, size, fontWeight, lineHeight) => ({
|
|
7
|
+
fontFamily,
|
|
8
|
+
fontSize: px(size),
|
|
9
|
+
fontWeight,
|
|
10
|
+
lineHeight,
|
|
11
|
+
});
|
|
12
|
+
// The type scale does not change between themes: contrast, not size, is what a high-contrast theme changes.
|
|
13
|
+
const typography = {
|
|
14
|
+
body: text(sans, 14, 400, 1.5),
|
|
15
|
+
caption: text(sans, 12, 400, 1.5),
|
|
16
|
+
label: text(sans, 13, 500, 1.25),
|
|
17
|
+
"label.strong": text(sans, 13, 600, 1.25),
|
|
18
|
+
"heading.1": text(sans, 28, 700, 1.15),
|
|
19
|
+
"heading.2": text(sans, 20, 650, 1.25),
|
|
20
|
+
"heading.3": text(sans, 16, 600, 1.3),
|
|
21
|
+
mono: text(mono, 12.5, 400, 1.5),
|
|
22
|
+
};
|
|
23
|
+
const light = {
|
|
24
|
+
"surface.base": [0.985, 0.003, 250],
|
|
25
|
+
"surface.raised": [1, 0, 0],
|
|
26
|
+
"surface.well": [0.955, 0.006, 250],
|
|
27
|
+
"surface.hover": [0.25, 0.03, 250, 0.07],
|
|
28
|
+
"surface.active": [0.25, 0.03, 250, 0.13],
|
|
29
|
+
"surface.selected": [0.5, 0.15, 255, 0.16],
|
|
30
|
+
"surface.scrim": [0.2, 0.02, 250],
|
|
31
|
+
"surface.scrollbar": [0.3, 0.02, 250, 0.4],
|
|
32
|
+
"text.primary": [0.22, 0.02, 250],
|
|
33
|
+
"text.muted": [0.44, 0.02, 250],
|
|
34
|
+
"text.disabled": [0.5, 0.015, 250],
|
|
35
|
+
"text.on-accent": [0.99, 0, 0],
|
|
36
|
+
"border.subtle": [0.25, 0.03, 250, 0.2],
|
|
37
|
+
"border.strong": [0.52, 0.02, 250],
|
|
38
|
+
"focus.ring": [0.5, 0.17, 255],
|
|
39
|
+
"accent.fill": [0.53, 0.17, 255],
|
|
40
|
+
"accent.fill.hover": [0.46, 0.17, 255],
|
|
41
|
+
"accent.text": [0.45, 0.17, 255],
|
|
42
|
+
"accent.edge": [0.5, 0.1, 255],
|
|
43
|
+
"accent.soft": [0.55, 0.14, 255, 0.14],
|
|
44
|
+
"status.critical.fill": [0.56, 0.19, 25],
|
|
45
|
+
"status.critical.fill.hover": [0.49, 0.19, 25],
|
|
46
|
+
"status.critical.text": [0.48, 0.19, 25],
|
|
47
|
+
"status.critical.edge": [0.52, 0.15, 25],
|
|
48
|
+
"diagnostic.error": [0.5, 0.19, 25],
|
|
49
|
+
"diagnostic.warning": [0.5, 0.12, 70],
|
|
50
|
+
"diagnostic.success": [0.5, 0.12, 150],
|
|
51
|
+
"diagnostic.info": [0.5, 0.12, 240],
|
|
52
|
+
"shadow.ambient": [0.25, 0.03, 250],
|
|
53
|
+
"shadow.highlight": [1, 0, 0, 0.5],
|
|
54
|
+
};
|
|
55
|
+
const dark = {
|
|
56
|
+
"surface.base": [0.18, 0.01, 250],
|
|
57
|
+
"surface.raised": [0.22, 0.012, 250],
|
|
58
|
+
"surface.well": [0.15, 0.01, 250],
|
|
59
|
+
"surface.hover": [1, 0, 0, 0.07],
|
|
60
|
+
"surface.active": [1, 0, 0, 0.13],
|
|
61
|
+
"surface.selected": [0.7, 0.12, 255, 0.22],
|
|
62
|
+
"surface.scrim": [0.05, 0.01, 250],
|
|
63
|
+
"surface.scrollbar": [1, 0, 0, 0.3],
|
|
64
|
+
"text.primary": [0.95, 0.005, 250],
|
|
65
|
+
"text.muted": [0.76, 0.01, 250],
|
|
66
|
+
"text.disabled": [0.68, 0.01, 250],
|
|
67
|
+
"text.on-accent": [0.14, 0.02, 250],
|
|
68
|
+
"border.subtle": [1, 0, 0, 0.16],
|
|
69
|
+
"border.strong": [0.66, 0.02, 250],
|
|
70
|
+
"focus.ring": [0.78, 0.13, 255],
|
|
71
|
+
"accent.fill": [0.6, 0.14, 255],
|
|
72
|
+
"accent.fill.hover": [0.66, 0.13, 255],
|
|
73
|
+
"accent.text": [0.8, 0.11, 255],
|
|
74
|
+
"accent.edge": [0.7, 0.1, 255],
|
|
75
|
+
"accent.soft": [0.7, 0.12, 255, 0.18],
|
|
76
|
+
"status.critical.fill": [0.6, 0.17, 25],
|
|
77
|
+
"status.critical.fill.hover": [0.66, 0.15, 25],
|
|
78
|
+
"status.critical.text": [0.78, 0.13, 25],
|
|
79
|
+
"status.critical.edge": [0.7, 0.14, 25],
|
|
80
|
+
"diagnostic.error": [0.74, 0.14, 25],
|
|
81
|
+
"diagnostic.warning": [0.8, 0.12, 80],
|
|
82
|
+
"diagnostic.success": [0.76, 0.13, 150],
|
|
83
|
+
"diagnostic.info": [0.76, 0.1, 235],
|
|
84
|
+
"shadow.ambient": [0, 0, 0],
|
|
85
|
+
"shadow.highlight": [1, 0, 0, 0.12],
|
|
86
|
+
};
|
|
87
|
+
// Black on white, solid edges, no translucent ink: every pair clears 7:1 and every border 4.5:1.
|
|
88
|
+
const highContrast = {
|
|
89
|
+
"surface.base": [1, 0, 0],
|
|
90
|
+
"surface.raised": [1, 0, 0],
|
|
91
|
+
"surface.well": [0.95, 0, 0],
|
|
92
|
+
"surface.hover": [0.9, 0, 0],
|
|
93
|
+
"surface.active": [0.82, 0, 0],
|
|
94
|
+
"surface.selected": [0.85, 0.06, 255],
|
|
95
|
+
"surface.scrim": [0, 0, 0],
|
|
96
|
+
"surface.scrollbar": [0.3, 0, 0],
|
|
97
|
+
"text.primary": [0, 0, 0],
|
|
98
|
+
"text.muted": [0.3, 0, 0],
|
|
99
|
+
"text.disabled": [0.4, 0, 0],
|
|
100
|
+
"text.on-accent": [1, 0, 0],
|
|
101
|
+
"border.subtle": [0.55, 0, 0],
|
|
102
|
+
"border.strong": [0.2, 0, 0],
|
|
103
|
+
"focus.ring": [0.35, 0.2, 260],
|
|
104
|
+
"accent.fill": [0.5, 0.16, 260],
|
|
105
|
+
"accent.fill.hover": [0.4, 0.14, 260],
|
|
106
|
+
"accent.text": [0.32, 0.15, 260],
|
|
107
|
+
"accent.edge": [0.32, 0.15, 260],
|
|
108
|
+
"accent.soft": [0.9, 0.05, 260],
|
|
109
|
+
"status.critical.fill": [0.5, 0.18, 25],
|
|
110
|
+
"status.critical.fill.hover": [0.4, 0.16, 25],
|
|
111
|
+
"status.critical.text": [0.38, 0.17, 25],
|
|
112
|
+
"status.critical.edge": [0.38, 0.17, 25],
|
|
113
|
+
"diagnostic.error": [0.38, 0.17, 25],
|
|
114
|
+
"diagnostic.warning": [0.4, 0.1, 70],
|
|
115
|
+
"diagnostic.success": [0.36, 0.1, 150],
|
|
116
|
+
"diagnostic.info": [0.36, 0.1, 240],
|
|
117
|
+
"shadow.ambient": [0, 0, 0],
|
|
118
|
+
"shadow.highlight": [1, 0, 0, 0],
|
|
119
|
+
};
|
|
120
|
+
function theme(id, colorScheme, roles) {
|
|
121
|
+
return {
|
|
122
|
+
format: "liveframe-theme/1",
|
|
123
|
+
id,
|
|
124
|
+
version: "1.0.0",
|
|
125
|
+
colorScheme,
|
|
126
|
+
colours: Object.fromEntries(Object.entries(roles).map(([role, [l, c, h, alpha]]) => [
|
|
127
|
+
role,
|
|
128
|
+
{ colorSpace: "oklch", components: [l, c, h], ...(alpha === undefined ? {} : { alpha }) },
|
|
129
|
+
])),
|
|
130
|
+
typography,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** The light, dark and high-contrast themes, validated against the starter vocabulary. */
|
|
134
|
+
export const themes = [
|
|
135
|
+
valid("light theme", validateTheme(theme("starter-light", "light", light), catalog.vocabulary)),
|
|
136
|
+
valid("dark theme", validateTheme(theme("starter-dark", "dark", dark), catalog.vocabulary)),
|
|
137
|
+
valid("high-contrast theme", validateTheme(theme("starter-high-contrast", "light", highContrast), catalog.vocabulary)),
|
|
138
|
+
];
|