uniskin 0.0.1 → 0.2.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/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +9 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/css.d.ts +25 -0
- package/dist/cli/css.d.ts.map +1 -0
- package/dist/cli/css.js +68 -0
- package/dist/cli/css.js.map +1 -0
- package/dist/cli/init.d.ts +20 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +92 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/main.d.ts +5 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +85 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/new-adapter.d.ts +11 -0
- package/dist/cli/new-adapter.d.ts.map +1 -0
- package/dist/cli/new-adapter.js +66 -0
- package/dist/cli/new-adapter.js.map +1 -0
- package/dist/cli/project.d.ts +30 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +158 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/default-theme.d.ts +693 -0
- package/dist/default-theme.d.ts.map +1 -0
- package/dist/default-theme.js +719 -0
- package/dist/default-theme.js.map +1 -0
- package/dist/emit.d.ts +23 -0
- package/dist/emit.d.ts.map +1 -0
- package/dist/emit.js +105 -0
- package/dist/emit.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/merge.d.ts +42 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +177 -0
- package/dist/merge.js.map +1 -0
- package/dist/types.d.ts +94 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +38 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -4
- package/README.md +0 -3
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
import { INTENTS, defineAdapter } from "./types.js";
|
|
2
|
+
/** [soft tint %, soft text darkening %] per intent. */
|
|
3
|
+
const INTENT_MIX = {
|
|
4
|
+
primary: [14, 80],
|
|
5
|
+
secondary: [14, 80],
|
|
6
|
+
success: [16, 55],
|
|
7
|
+
warning: [22, 45],
|
|
8
|
+
danger: [12, 70],
|
|
9
|
+
};
|
|
10
|
+
/** Share of the intent colour kept when it is used as text (rest = surface text).
|
|
11
|
+
* Only warning is too light to read on a light surface at full strength. */
|
|
12
|
+
const INTENT_TEXT_MIX = { warning: 55 };
|
|
13
|
+
/** The five per-element variables an intent sets (see composition model). */
|
|
14
|
+
function intentVars(intent) {
|
|
15
|
+
const [soft, fg] = INTENT_MIX[intent];
|
|
16
|
+
return {
|
|
17
|
+
"--ui-c": `var(--ui-${intent})`,
|
|
18
|
+
/* adapters can pin the text colour with --ui-<intent>-text */
|
|
19
|
+
"--ui-c-text": `var(--ui-${intent}-text, ${INTENT_TEXT_MIX[intent]
|
|
20
|
+
? `color-mix(in oklab, var(--ui-${intent}) ${INTENT_TEXT_MIX[intent]}%, var(--ui-surface-fg))`
|
|
21
|
+
: `var(--ui-${intent})`})`,
|
|
22
|
+
"--ui-on-c": `var(--ui-${intent}-fg)`,
|
|
23
|
+
/* mixed with the surface (not white/black) so soft looks stay legible in dark themes */
|
|
24
|
+
/* adapters can pin exact soft colors with --ui-<intent>-soft / -soft-fg */
|
|
25
|
+
"--ui-c-soft": `var(--ui-${intent}-soft, color-mix(in oklab, var(--ui-${intent}) ${soft}%, var(--ui-surface)))`,
|
|
26
|
+
"--ui-c-soft-fg": `var(--ui-${intent}-soft-fg, color-mix(in oklab, var(--ui-${intent}) ${fg}%, var(--ui-surface-fg)))`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Build a full intent map, optionally adding extra declarations per intent. */
|
|
30
|
+
function intentMap(extra) {
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const i of INTENTS)
|
|
33
|
+
out[i] = { ...intentVars(i), ...extra?.(i) };
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
const intents = intentMap();
|
|
37
|
+
/** Variables for the neutral (no intent) look. */
|
|
38
|
+
const neutralVars = {
|
|
39
|
+
"--ui-c": "var(--ui-neutral)",
|
|
40
|
+
"--ui-c-text": "var(--ui-surface-fg)",
|
|
41
|
+
"--ui-on-c": "var(--ui-neutral-fg)",
|
|
42
|
+
"--ui-c-soft": "var(--ui-neutral-soft)",
|
|
43
|
+
"--ui-c-soft-fg": "var(--ui-neutral-soft-fg)",
|
|
44
|
+
};
|
|
45
|
+
const transition = (props) => props.map((p) => `${p} 0.15s ease`).join(", ");
|
|
46
|
+
const focusRing = {
|
|
47
|
+
outline: "2px solid var(--ui-ring)",
|
|
48
|
+
"outline-offset": "2px",
|
|
49
|
+
};
|
|
50
|
+
/* ---- text fields (input / textarea / select) ---- */
|
|
51
|
+
const fieldBase = {
|
|
52
|
+
/* focus/accent color; intents re-point it, --ui-field-c also tints the border */
|
|
53
|
+
"--ui-c": "var(--ui-ring)",
|
|
54
|
+
"--ui-c-text": "var(--ui-ring)",
|
|
55
|
+
display: "block",
|
|
56
|
+
width: "100%",
|
|
57
|
+
"box-sizing": "border-box",
|
|
58
|
+
margin: "0",
|
|
59
|
+
"font-family": "var(--ui-font-sans)",
|
|
60
|
+
"font-size": "var(--ui-text-md)",
|
|
61
|
+
"line-height": "1.25",
|
|
62
|
+
padding: "0.5rem 0.75rem",
|
|
63
|
+
color: "var(--ui-surface-fg)",
|
|
64
|
+
"background-color": "var(--ui-surface)",
|
|
65
|
+
border: "1px solid var(--ui-field-c, var(--ui-border))",
|
|
66
|
+
"border-radius": "var(--ui-radius)",
|
|
67
|
+
transition: transition(["background-color", "border-color", "box-shadow"]),
|
|
68
|
+
"&::placeholder": {
|
|
69
|
+
color: "color-mix(in oklab, var(--ui-surface-fg) 45%, transparent)",
|
|
70
|
+
},
|
|
71
|
+
"&:hover": {
|
|
72
|
+
"border-color": "var(--ui-field-c, color-mix(in oklab, var(--ui-border) 65%, var(--ui-surface-fg)))",
|
|
73
|
+
},
|
|
74
|
+
"&:focus-visible": {
|
|
75
|
+
outline: "2px solid var(--ui-ring)",
|
|
76
|
+
"outline-offset": "1px",
|
|
77
|
+
"border-color": "var(--ui-c)",
|
|
78
|
+
"box-shadow": "none",
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const fieldIntents = intentMap((i) => ({ "--ui-field-c": `var(--ui-${i})` }));
|
|
82
|
+
const fieldStyles = {
|
|
83
|
+
outline: {
|
|
84
|
+
"border-color": "var(--ui-c)",
|
|
85
|
+
"&:hover": { "border-color": "var(--ui-c)" },
|
|
86
|
+
},
|
|
87
|
+
ghost: {
|
|
88
|
+
"background-color": "transparent",
|
|
89
|
+
"border-color": "transparent",
|
|
90
|
+
"&:hover": { "background-color": "var(--ui-surface-muted)", "border-color": "transparent" },
|
|
91
|
+
"&:focus-visible": {
|
|
92
|
+
"background-color": "var(--ui-surface)",
|
|
93
|
+
"border-color": "var(--ui-c)",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
soft: {
|
|
97
|
+
"background-color": "var(--ui-surface-muted)",
|
|
98
|
+
"border-color": "transparent",
|
|
99
|
+
"&:hover": { "border-color": "var(--ui-c)" },
|
|
100
|
+
"&:focus-visible": {
|
|
101
|
+
"background-color": "var(--ui-surface)",
|
|
102
|
+
"border-color": "var(--ui-c)",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
const fieldSizes = {
|
|
107
|
+
sm: { "font-size": "var(--ui-text-sm)", padding: "0.375rem 0.625rem" },
|
|
108
|
+
lg: { "font-size": "var(--ui-text-lg)", padding: "0.75rem 1rem" },
|
|
109
|
+
};
|
|
110
|
+
const fieldStates = {
|
|
111
|
+
disabled: {
|
|
112
|
+
opacity: "0.5",
|
|
113
|
+
cursor: "not-allowed",
|
|
114
|
+
"background-color": "var(--ui-surface-muted)",
|
|
115
|
+
},
|
|
116
|
+
loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
|
|
117
|
+
active: {
|
|
118
|
+
"border-color": "var(--ui-c)",
|
|
119
|
+
"box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 25%, transparent)",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
const chevron = "linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)";
|
|
123
|
+
/* ---- shared status states (badge / alert) ---- */
|
|
124
|
+
const statusStates = {
|
|
125
|
+
disabled: { opacity: "0.5", cursor: "not-allowed" },
|
|
126
|
+
loading: { animation: "ui-pulse 1.2s ease-in-out infinite" },
|
|
127
|
+
active: { "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 30%, transparent)" },
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Built-in default skin. Every Uniskin class has a complete style here;
|
|
131
|
+
* adapters deep-merge over this object, so anything they omit falls back
|
|
132
|
+
* to these rules.
|
|
133
|
+
*
|
|
134
|
+
* Composition model: every intent sets five per-element variables
|
|
135
|
+
* (`--ui-c`, `--ui-on-c`, `--ui-c-hover`, `--ui-c-soft`,
|
|
136
|
+
* `--ui-c-soft-fg`) and every style maps those variables onto real
|
|
137
|
+
* properties. That is why intents and styles combine freely
|
|
138
|
+
* (`ui-danger ui-outline`) without 5×4 hand-written rules.
|
|
139
|
+
*/
|
|
140
|
+
export const defaultAdapter = defineAdapter({
|
|
141
|
+
name: "default",
|
|
142
|
+
tokens: {
|
|
143
|
+
"--ui-font-sans": 'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
|
|
144
|
+
/* neutral (no intent) */
|
|
145
|
+
"--ui-neutral": "oklch(0.28 0.02 265)",
|
|
146
|
+
"--ui-neutral-fg": "oklch(0.98 0 0)",
|
|
147
|
+
"--ui-neutral-soft": "oklch(0.94 0.01 265)",
|
|
148
|
+
"--ui-neutral-soft-fg": "oklch(0.32 0.02 265)",
|
|
149
|
+
/* intents — *-hover and *-soft derive from the base color, so an
|
|
150
|
+
adapter that only remaps --ui-<intent> still gets matching states */
|
|
151
|
+
"--ui-primary": "oklch(0.55 0.21 267)",
|
|
152
|
+
"--ui-primary-fg": "oklch(0.98 0 0)",
|
|
153
|
+
"--ui-secondary": "oklch(0.55 0.05 285)",
|
|
154
|
+
"--ui-secondary-fg": "oklch(0.98 0 0)",
|
|
155
|
+
"--ui-success": "oklch(0.5 0.14 163)",
|
|
156
|
+
"--ui-success-fg": "oklch(0.98 0 0)",
|
|
157
|
+
"--ui-warning": "oklch(0.78 0.15 85)",
|
|
158
|
+
"--ui-warning-fg": "oklch(0.28 0.04 90)",
|
|
159
|
+
"--ui-danger": "oklch(0.56 0.2 27)",
|
|
160
|
+
"--ui-danger-fg": "oklch(0.98 0 0)",
|
|
161
|
+
/* surfaces */
|
|
162
|
+
"--ui-surface": "oklch(1 0 0)",
|
|
163
|
+
"--ui-surface-fg": "oklch(0.24 0.02 265)",
|
|
164
|
+
"--ui-surface-muted": "oklch(0.96 0.005 265)",
|
|
165
|
+
"--ui-border": "oklch(0.89 0.008 265)",
|
|
166
|
+
"--ui-ring": "oklch(0.62 0.18 262)",
|
|
167
|
+
/* shape & type */
|
|
168
|
+
"--ui-radius": "0.5rem",
|
|
169
|
+
"--ui-text-sm": "0.8125rem",
|
|
170
|
+
"--ui-text-md": "0.9375rem",
|
|
171
|
+
"--ui-text-lg": "1.0625rem",
|
|
172
|
+
},
|
|
173
|
+
darkTokens: {
|
|
174
|
+
"--ui-neutral": "oklch(0.92 0.01 265)",
|
|
175
|
+
"--ui-neutral-fg": "oklch(0.2 0.02 265)",
|
|
176
|
+
"--ui-neutral-soft": "oklch(0.3 0.015 265)",
|
|
177
|
+
"--ui-neutral-soft-fg": "oklch(0.92 0.01 265)",
|
|
178
|
+
"--ui-primary": "oklch(0.68 0.17 267)",
|
|
179
|
+
"--ui-primary-fg": "oklch(0.15 0.02 265)",
|
|
180
|
+
"--ui-secondary": "oklch(0.7 0.07 285)",
|
|
181
|
+
"--ui-secondary-fg": "oklch(0.15 0.02 285)",
|
|
182
|
+
"--ui-success": "oklch(0.72 0.15 163)",
|
|
183
|
+
"--ui-success-fg": "oklch(0.15 0.03 163)",
|
|
184
|
+
"--ui-warning": "oklch(0.82 0.15 85)",
|
|
185
|
+
"--ui-warning-fg": "oklch(0.2 0.04 90)",
|
|
186
|
+
"--ui-danger": "oklch(0.68 0.19 27)",
|
|
187
|
+
"--ui-danger-fg": "oklch(0.15 0.03 27)",
|
|
188
|
+
"--ui-surface": "oklch(0.21 0.015 265)",
|
|
189
|
+
"--ui-surface-fg": "oklch(0.95 0.005 265)",
|
|
190
|
+
"--ui-surface-muted": "oklch(0.26 0.015 265)",
|
|
191
|
+
"--ui-border": "oklch(0.34 0.015 265)",
|
|
192
|
+
"--ui-ring": "oklch(0.7 0.15 262)",
|
|
193
|
+
},
|
|
194
|
+
components: {
|
|
195
|
+
button: {
|
|
196
|
+
base: {
|
|
197
|
+
/* default = neutral intent; intents below override these vars */
|
|
198
|
+
"--ui-c": "var(--ui-neutral)",
|
|
199
|
+
"--ui-c-text": "var(--ui-surface-fg)",
|
|
200
|
+
"--ui-on-c": "var(--ui-neutral-fg)",
|
|
201
|
+
"--ui-c-hover": "color-mix(in oklab, var(--ui-c) 85%, black)",
|
|
202
|
+
"--ui-c-soft": "var(--ui-neutral-soft)",
|
|
203
|
+
"--ui-c-soft-fg": "var(--ui-neutral-soft-fg)",
|
|
204
|
+
display: "inline-flex",
|
|
205
|
+
"align-items": "center",
|
|
206
|
+
"justify-content": "center",
|
|
207
|
+
gap: "0.5rem",
|
|
208
|
+
"font-family": "var(--ui-font-sans)",
|
|
209
|
+
"font-weight": "500",
|
|
210
|
+
"font-size": "var(--ui-text-md)",
|
|
211
|
+
"line-height": "1.25",
|
|
212
|
+
padding: "0.5rem 1rem",
|
|
213
|
+
"border-radius": "var(--ui-radius)",
|
|
214
|
+
border: "1px solid transparent",
|
|
215
|
+
"background-color": "var(--ui-c)",
|
|
216
|
+
color: "var(--ui-on-c)",
|
|
217
|
+
"border-color": "var(--ui-c)",
|
|
218
|
+
cursor: "pointer",
|
|
219
|
+
"user-select": "none",
|
|
220
|
+
"text-decoration": "none",
|
|
221
|
+
transition: "background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease",
|
|
222
|
+
"&:hover": {
|
|
223
|
+
"background-color": "var(--ui-c-hover)",
|
|
224
|
+
"border-color": "var(--ui-c-hover)",
|
|
225
|
+
},
|
|
226
|
+
"&:focus-visible": {
|
|
227
|
+
outline: "2px solid var(--ui-ring)",
|
|
228
|
+
"outline-offset": "2px",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
intents,
|
|
232
|
+
styles: {
|
|
233
|
+
outline: {
|
|
234
|
+
"background-color": "transparent",
|
|
235
|
+
color: "var(--ui-c-text)",
|
|
236
|
+
"border-color": "var(--ui-c)",
|
|
237
|
+
"&:hover": {
|
|
238
|
+
"background-color": "var(--ui-c)",
|
|
239
|
+
"border-color": "var(--ui-c)",
|
|
240
|
+
color: "var(--ui-on-c)",
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
ghost: {
|
|
244
|
+
"background-color": "transparent",
|
|
245
|
+
"border-color": "transparent",
|
|
246
|
+
color: "var(--ui-c-text)",
|
|
247
|
+
"&:hover": {
|
|
248
|
+
"background-color": "var(--ui-c-soft)",
|
|
249
|
+
"border-color": "transparent",
|
|
250
|
+
color: "var(--ui-c-soft-fg)",
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
soft: {
|
|
254
|
+
"background-color": "var(--ui-c-soft)",
|
|
255
|
+
"border-color": "transparent",
|
|
256
|
+
color: "var(--ui-c-soft-fg)",
|
|
257
|
+
"&:hover": {
|
|
258
|
+
"background-color": "var(--ui-c)",
|
|
259
|
+
"border-color": "var(--ui-c)",
|
|
260
|
+
color: "var(--ui-on-c)",
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
sizes: {
|
|
265
|
+
sm: {
|
|
266
|
+
"font-size": "var(--ui-text-sm)",
|
|
267
|
+
padding: "0.375rem 0.75rem",
|
|
268
|
+
},
|
|
269
|
+
lg: {
|
|
270
|
+
"font-size": "var(--ui-text-lg)",
|
|
271
|
+
padding: "0.75rem 1.5rem",
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
states: {
|
|
275
|
+
disabled: {
|
|
276
|
+
opacity: "0.5",
|
|
277
|
+
cursor: "not-allowed",
|
|
278
|
+
"pointer-events": "none",
|
|
279
|
+
},
|
|
280
|
+
loading: {
|
|
281
|
+
cursor: "progress",
|
|
282
|
+
"pointer-events": "none",
|
|
283
|
+
"&::after": {
|
|
284
|
+
content: '""',
|
|
285
|
+
width: "1em",
|
|
286
|
+
height: "1em",
|
|
287
|
+
"flex-shrink": "0",
|
|
288
|
+
"border-radius": "9999px",
|
|
289
|
+
border: "2px solid currentColor",
|
|
290
|
+
"border-top-color": "transparent",
|
|
291
|
+
animation: "ui-spin 0.6s linear infinite",
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
active: {
|
|
295
|
+
"box-shadow": "inset 0 2px 4px rgb(0 0 0 / 0.2)",
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
input: {
|
|
300
|
+
base: { ...fieldBase },
|
|
301
|
+
intents: fieldIntents,
|
|
302
|
+
styles: fieldStyles,
|
|
303
|
+
sizes: fieldSizes,
|
|
304
|
+
states: fieldStates,
|
|
305
|
+
},
|
|
306
|
+
textarea: {
|
|
307
|
+
base: { ...fieldBase, "line-height": "1.5", "min-height": "5rem", resize: "vertical" },
|
|
308
|
+
intents: fieldIntents,
|
|
309
|
+
styles: fieldStyles,
|
|
310
|
+
sizes: fieldSizes,
|
|
311
|
+
states: fieldStates,
|
|
312
|
+
},
|
|
313
|
+
select: {
|
|
314
|
+
base: {
|
|
315
|
+
...fieldBase,
|
|
316
|
+
appearance: "none",
|
|
317
|
+
cursor: "pointer",
|
|
318
|
+
"padding-right": "2.25rem",
|
|
319
|
+
"background-image": chevron,
|
|
320
|
+
"background-position": "calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%",
|
|
321
|
+
"background-size": "0.35rem 0.35rem, 0.35rem 0.35rem",
|
|
322
|
+
"background-repeat": "no-repeat",
|
|
323
|
+
},
|
|
324
|
+
intents: fieldIntents,
|
|
325
|
+
styles: fieldStyles,
|
|
326
|
+
sizes: {
|
|
327
|
+
sm: { ...fieldSizes.sm, "padding-right": "2rem" },
|
|
328
|
+
lg: { ...fieldSizes.lg, "padding-right": "2.5rem" },
|
|
329
|
+
},
|
|
330
|
+
states: fieldStates,
|
|
331
|
+
},
|
|
332
|
+
checkbox: {
|
|
333
|
+
base: {
|
|
334
|
+
...neutralVars,
|
|
335
|
+
appearance: "none",
|
|
336
|
+
display: "inline-grid",
|
|
337
|
+
"place-content": "center",
|
|
338
|
+
"flex-shrink": "0",
|
|
339
|
+
"box-sizing": "border-box",
|
|
340
|
+
width: "var(--ui-check-size, 1.125rem)",
|
|
341
|
+
height: "var(--ui-check-size, 1.125rem)",
|
|
342
|
+
margin: "0",
|
|
343
|
+
"vertical-align": "middle",
|
|
344
|
+
cursor: "pointer",
|
|
345
|
+
"background-color": "var(--ui-surface)",
|
|
346
|
+
border: "1px solid color-mix(in oklab, var(--ui-border) 55%, var(--ui-surface-fg))",
|
|
347
|
+
"border-radius": "calc(var(--ui-radius) * 0.5)",
|
|
348
|
+
transition: transition(["background-color", "border-color", "box-shadow"]),
|
|
349
|
+
"&::after": {
|
|
350
|
+
content: '""',
|
|
351
|
+
width: "0.3125em",
|
|
352
|
+
height: "0.5625em",
|
|
353
|
+
"box-sizing": "border-box",
|
|
354
|
+
border: "solid var(--ui-check-mark, var(--ui-on-c))",
|
|
355
|
+
"border-width": "0 2px 2px 0",
|
|
356
|
+
transform: "translateY(-8%) rotate(45deg) scale(0)",
|
|
357
|
+
transition: "transform 0.12s ease",
|
|
358
|
+
"font-size": "var(--ui-check-size, 1.125rem)",
|
|
359
|
+
},
|
|
360
|
+
"&:hover": { "border-color": "var(--ui-c)" },
|
|
361
|
+
"&:checked, &:indeterminate": {
|
|
362
|
+
"background-color": "var(--ui-c)",
|
|
363
|
+
"border-color": "var(--ui-c)",
|
|
364
|
+
},
|
|
365
|
+
"&:checked::after": {
|
|
366
|
+
transform: "translateY(-8%) rotate(45deg) scale(1)",
|
|
367
|
+
},
|
|
368
|
+
"&:indeterminate::after": {
|
|
369
|
+
width: "0.55em",
|
|
370
|
+
height: "2px",
|
|
371
|
+
"border-width": "0",
|
|
372
|
+
"background-color": "var(--ui-check-mark, var(--ui-on-c))",
|
|
373
|
+
transform: "scale(1)",
|
|
374
|
+
},
|
|
375
|
+
"&:focus-visible": focusRing,
|
|
376
|
+
},
|
|
377
|
+
intents,
|
|
378
|
+
styles: {
|
|
379
|
+
outline: {
|
|
380
|
+
"--ui-check-mark": "var(--ui-c)",
|
|
381
|
+
"border-color": "var(--ui-c)",
|
|
382
|
+
"&:checked, &:indeterminate": { "background-color": "transparent" },
|
|
383
|
+
},
|
|
384
|
+
ghost: {
|
|
385
|
+
"--ui-check-mark": "var(--ui-c-soft-fg)",
|
|
386
|
+
"background-color": "var(--ui-surface-muted)",
|
|
387
|
+
"border-color": "transparent",
|
|
388
|
+
"&:checked, &:indeterminate": {
|
|
389
|
+
"background-color": "var(--ui-c-soft)",
|
|
390
|
+
"border-color": "transparent",
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
soft: {
|
|
394
|
+
"--ui-check-mark": "var(--ui-c-soft-fg)",
|
|
395
|
+
"&:checked, &:indeterminate": {
|
|
396
|
+
"background-color": "var(--ui-c-soft)",
|
|
397
|
+
"border-color": "var(--ui-c)",
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
sizes: {
|
|
402
|
+
sm: { "--ui-check-size": "0.9375rem" },
|
|
403
|
+
lg: { "--ui-check-size": "1.5rem" },
|
|
404
|
+
},
|
|
405
|
+
states: {
|
|
406
|
+
disabled: { opacity: "0.5", cursor: "not-allowed" },
|
|
407
|
+
loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
|
|
408
|
+
active: { "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 30%, transparent)" },
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
card: {
|
|
412
|
+
base: {
|
|
413
|
+
...neutralVars,
|
|
414
|
+
display: "flex",
|
|
415
|
+
"flex-direction": "column",
|
|
416
|
+
"box-sizing": "border-box",
|
|
417
|
+
"font-family": "var(--ui-font-sans)",
|
|
418
|
+
"font-size": "var(--ui-text-md)",
|
|
419
|
+
color: "var(--ui-surface-fg)",
|
|
420
|
+
"background-color": "var(--ui-surface)",
|
|
421
|
+
border: "1px solid var(--ui-card-border, var(--ui-border))",
|
|
422
|
+
"border-radius": "calc(var(--ui-radius) * 1.5)",
|
|
423
|
+
"box-shadow": "0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px rgb(0 0 0 / 0.04)",
|
|
424
|
+
overflow: "hidden",
|
|
425
|
+
transition: transition(["box-shadow", "border-color", "background-color"]),
|
|
426
|
+
},
|
|
427
|
+
intents: intentMap((i) => ({
|
|
428
|
+
"--ui-card-border": `color-mix(in oklab, var(--ui-${i}) 45%, var(--ui-border))`,
|
|
429
|
+
})),
|
|
430
|
+
styles: {
|
|
431
|
+
outline: { "box-shadow": "none", "border-color": "var(--ui-c)" },
|
|
432
|
+
ghost: {
|
|
433
|
+
"box-shadow": "none",
|
|
434
|
+
"background-color": "transparent",
|
|
435
|
+
"border-color": "transparent",
|
|
436
|
+
},
|
|
437
|
+
soft: {
|
|
438
|
+
"box-shadow": "none",
|
|
439
|
+
"background-color": "var(--ui-c-soft)",
|
|
440
|
+
color: "var(--ui-c-soft-fg)",
|
|
441
|
+
"border-color": "transparent",
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
sizes: {
|
|
445
|
+
sm: { "--ui-card-pad": "0.75rem", "font-size": "var(--ui-text-sm)" },
|
|
446
|
+
lg: { "--ui-card-pad": "1.75rem", "font-size": "var(--ui-text-lg)" },
|
|
447
|
+
},
|
|
448
|
+
states: {
|
|
449
|
+
disabled: { opacity: "0.5", "pointer-events": "none" },
|
|
450
|
+
loading: { "pointer-events": "none", animation: "ui-pulse 1.2s ease-in-out infinite" },
|
|
451
|
+
active: {
|
|
452
|
+
"border-color": "var(--ui-c)",
|
|
453
|
+
"box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 25%, transparent)",
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
"card-header": {
|
|
458
|
+
base: {
|
|
459
|
+
padding: "calc(var(--ui-card-pad, 1.25rem) * 0.8) var(--ui-card-pad, 1.25rem)",
|
|
460
|
+
"font-weight": "600",
|
|
461
|
+
"border-bottom": "1px solid var(--ui-border)",
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
"card-body": {
|
|
465
|
+
base: { flex: "1 1 auto", padding: "var(--ui-card-pad, 1.25rem)" },
|
|
466
|
+
},
|
|
467
|
+
"card-footer": {
|
|
468
|
+
base: {
|
|
469
|
+
display: "flex",
|
|
470
|
+
"align-items": "center",
|
|
471
|
+
"justify-content": "flex-end",
|
|
472
|
+
gap: "0.5rem",
|
|
473
|
+
padding: "calc(var(--ui-card-pad, 1.25rem) * 0.8) var(--ui-card-pad, 1.25rem)",
|
|
474
|
+
"border-top": "1px solid var(--ui-border)",
|
|
475
|
+
"background-color": "var(--ui-surface-muted)",
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
badge: {
|
|
479
|
+
base: {
|
|
480
|
+
...neutralVars,
|
|
481
|
+
display: "inline-flex",
|
|
482
|
+
"align-items": "center",
|
|
483
|
+
gap: "0.25rem",
|
|
484
|
+
"box-sizing": "border-box",
|
|
485
|
+
"font-family": "var(--ui-font-sans)",
|
|
486
|
+
"font-size": "0.75rem",
|
|
487
|
+
"font-weight": "600",
|
|
488
|
+
"line-height": "1",
|
|
489
|
+
padding: "0.3125rem 0.625rem",
|
|
490
|
+
"border-radius": "9999px",
|
|
491
|
+
border: "1px solid var(--ui-c)",
|
|
492
|
+
"background-color": "var(--ui-c)",
|
|
493
|
+
color: "var(--ui-on-c)",
|
|
494
|
+
"white-space": "nowrap",
|
|
495
|
+
},
|
|
496
|
+
intents,
|
|
497
|
+
styles: {
|
|
498
|
+
outline: { "background-color": "transparent", color: "var(--ui-c-text)" },
|
|
499
|
+
ghost: {
|
|
500
|
+
"background-color": "transparent",
|
|
501
|
+
"border-color": "transparent",
|
|
502
|
+
color: "var(--ui-c-text)",
|
|
503
|
+
},
|
|
504
|
+
soft: {
|
|
505
|
+
"background-color": "var(--ui-c-soft)",
|
|
506
|
+
"border-color": "transparent",
|
|
507
|
+
color: "var(--ui-c-soft-fg)",
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
sizes: {
|
|
511
|
+
sm: { "font-size": "0.6875rem", padding: "0.1875rem 0.5rem" },
|
|
512
|
+
lg: { "font-size": "0.875rem", padding: "0.4375rem 0.875rem" },
|
|
513
|
+
},
|
|
514
|
+
states: statusStates,
|
|
515
|
+
},
|
|
516
|
+
alert: {
|
|
517
|
+
base: {
|
|
518
|
+
...neutralVars,
|
|
519
|
+
display: "flex",
|
|
520
|
+
"align-items": "flex-start",
|
|
521
|
+
gap: "0.75rem",
|
|
522
|
+
"box-sizing": "border-box",
|
|
523
|
+
"font-family": "var(--ui-font-sans)",
|
|
524
|
+
"font-size": "var(--ui-text-md)",
|
|
525
|
+
"line-height": "1.4",
|
|
526
|
+
padding: "0.875rem 1rem",
|
|
527
|
+
"border-radius": "var(--ui-radius)",
|
|
528
|
+
border: "1px solid var(--ui-c)",
|
|
529
|
+
"background-color": "var(--ui-c)",
|
|
530
|
+
color: "var(--ui-on-c)",
|
|
531
|
+
},
|
|
532
|
+
intents,
|
|
533
|
+
styles: {
|
|
534
|
+
outline: { "background-color": "var(--ui-surface)", color: "var(--ui-surface-fg)" },
|
|
535
|
+
ghost: {
|
|
536
|
+
"background-color": "transparent",
|
|
537
|
+
"border-color": "transparent",
|
|
538
|
+
color: "var(--ui-c-text)",
|
|
539
|
+
},
|
|
540
|
+
soft: {
|
|
541
|
+
"background-color": "var(--ui-c-soft)",
|
|
542
|
+
"border-color": "color-mix(in oklab, var(--ui-c) 28%, transparent)",
|
|
543
|
+
color: "var(--ui-c-soft-fg)",
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
sizes: {
|
|
547
|
+
sm: { "font-size": "var(--ui-text-sm)", padding: "0.5rem 0.75rem" },
|
|
548
|
+
lg: { "font-size": "var(--ui-text-lg)", padding: "1.125rem 1.375rem" },
|
|
549
|
+
},
|
|
550
|
+
states: statusStates,
|
|
551
|
+
},
|
|
552
|
+
modal: {
|
|
553
|
+
base: {
|
|
554
|
+
/* works as a <div>, a <dialog> (open / showModal) or a :target */
|
|
555
|
+
position: "fixed",
|
|
556
|
+
inset: "0",
|
|
557
|
+
"z-index": "1000",
|
|
558
|
+
display: "flex",
|
|
559
|
+
"align-items": "center",
|
|
560
|
+
"justify-content": "center",
|
|
561
|
+
"box-sizing": "border-box",
|
|
562
|
+
width: "100%",
|
|
563
|
+
height: "100%",
|
|
564
|
+
"max-width": "none",
|
|
565
|
+
"max-height": "none",
|
|
566
|
+
margin: "0",
|
|
567
|
+
padding: "1rem",
|
|
568
|
+
border: "0",
|
|
569
|
+
"background-color": "rgb(0 0 0 / 0.5)",
|
|
570
|
+
visibility: "hidden",
|
|
571
|
+
opacity: "0",
|
|
572
|
+
"pointer-events": "none",
|
|
573
|
+
transition: "opacity 0.2s ease, visibility 0s linear 0.2s",
|
|
574
|
+
"&[open], &:target": {
|
|
575
|
+
visibility: "visible",
|
|
576
|
+
opacity: "1",
|
|
577
|
+
"pointer-events": "auto",
|
|
578
|
+
"transition-delay": "0s",
|
|
579
|
+
},
|
|
580
|
+
"&::backdrop": { background: "transparent" },
|
|
581
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" },
|
|
582
|
+
},
|
|
583
|
+
styles: {
|
|
584
|
+
ghost: { "background-color": "transparent" },
|
|
585
|
+
soft: {
|
|
586
|
+
"background-color": "rgb(255 255 255 / 0.6)",
|
|
587
|
+
"backdrop-filter": "blur(6px)",
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
sizes: {
|
|
591
|
+
sm: { "--ui-modal-w": "24rem" },
|
|
592
|
+
lg: { "--ui-modal-w": "48rem" },
|
|
593
|
+
},
|
|
594
|
+
states: {
|
|
595
|
+
active: {
|
|
596
|
+
visibility: "visible",
|
|
597
|
+
opacity: "1",
|
|
598
|
+
"pointer-events": "auto",
|
|
599
|
+
"transition-delay": "0s",
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
},
|
|
603
|
+
"modal-box": {
|
|
604
|
+
base: {
|
|
605
|
+
...neutralVars,
|
|
606
|
+
"box-sizing": "border-box",
|
|
607
|
+
width: "min(var(--ui-modal-w, 32rem), 100%)",
|
|
608
|
+
"max-height": "100%",
|
|
609
|
+
overflow: "auto",
|
|
610
|
+
padding: "1.5rem",
|
|
611
|
+
"font-family": "var(--ui-font-sans)",
|
|
612
|
+
"font-size": "var(--ui-text-md)",
|
|
613
|
+
color: "var(--ui-surface-fg)",
|
|
614
|
+
"background-color": "var(--ui-surface)",
|
|
615
|
+
"border-radius": "calc(var(--ui-radius) * 1.5)",
|
|
616
|
+
"border-top": "3px solid transparent",
|
|
617
|
+
"box-shadow": "0 20px 40px -8px rgb(0 0 0 / 0.3), 0 4px 10px rgb(0 0 0 / 0.1)",
|
|
618
|
+
},
|
|
619
|
+
intents: intentMap((i) => ({ "border-top-color": `var(--ui-${i})` })),
|
|
620
|
+
sizes: {
|
|
621
|
+
sm: { padding: "1rem", "font-size": "var(--ui-text-sm)" },
|
|
622
|
+
lg: { padding: "2rem", "font-size": "var(--ui-text-lg)" },
|
|
623
|
+
},
|
|
624
|
+
},
|
|
625
|
+
tabs: {
|
|
626
|
+
base: {
|
|
627
|
+
...neutralVars,
|
|
628
|
+
display: "flex",
|
|
629
|
+
"flex-wrap": "wrap",
|
|
630
|
+
gap: "0.25rem",
|
|
631
|
+
"font-family": "var(--ui-font-sans)",
|
|
632
|
+
"border-bottom": "1px solid var(--ui-border)",
|
|
633
|
+
},
|
|
634
|
+
intents,
|
|
635
|
+
styles: {
|
|
636
|
+
/* boxed active tab */
|
|
637
|
+
outline: {
|
|
638
|
+
"--ui-tab-active-line": "transparent",
|
|
639
|
+
"--ui-tab-active-shadow": "inset 0 0 0 1px var(--ui-c)",
|
|
640
|
+
"--ui-tab-radius": "var(--ui-radius)",
|
|
641
|
+
"border-bottom-color": "transparent",
|
|
642
|
+
},
|
|
643
|
+
/* bare text, color only */
|
|
644
|
+
ghost: {
|
|
645
|
+
"--ui-tab-active-line": "transparent",
|
|
646
|
+
"--ui-tab-hover-bg": "var(--ui-surface-muted)",
|
|
647
|
+
"--ui-tab-radius": "var(--ui-radius)",
|
|
648
|
+
"border-bottom-color": "transparent",
|
|
649
|
+
},
|
|
650
|
+
/* pill with tinted background */
|
|
651
|
+
soft: {
|
|
652
|
+
"--ui-tab-active-line": "transparent",
|
|
653
|
+
"--ui-tab-active-bg": "var(--ui-c-soft)",
|
|
654
|
+
"--ui-tab-active-fg": "var(--ui-c-soft-fg)",
|
|
655
|
+
"--ui-tab-hover-bg": "var(--ui-surface-muted)",
|
|
656
|
+
"--ui-tab-radius": "var(--ui-radius)",
|
|
657
|
+
"border-bottom-color": "transparent",
|
|
658
|
+
},
|
|
659
|
+
},
|
|
660
|
+
sizes: {
|
|
661
|
+
sm: { "--ui-tab-fs": "var(--ui-text-sm)", "--ui-tab-px": "0.75rem", "--ui-tab-py": "0.375rem" },
|
|
662
|
+
lg: { "--ui-tab-fs": "var(--ui-text-lg)", "--ui-tab-px": "1.25rem", "--ui-tab-py": "0.75rem" },
|
|
663
|
+
},
|
|
664
|
+
},
|
|
665
|
+
tab: {
|
|
666
|
+
base: {
|
|
667
|
+
appearance: "none",
|
|
668
|
+
margin: "0 0 -1px",
|
|
669
|
+
padding: "var(--ui-tab-py, 0.5rem) var(--ui-tab-px, 1rem)",
|
|
670
|
+
"font-family": "inherit",
|
|
671
|
+
"font-size": "var(--ui-tab-fs, var(--ui-text-md))",
|
|
672
|
+
"font-weight": "500",
|
|
673
|
+
"line-height": "1.25",
|
|
674
|
+
color: "color-mix(in oklab, var(--ui-surface-fg) 62%, transparent)",
|
|
675
|
+
"background-color": "transparent",
|
|
676
|
+
border: "0",
|
|
677
|
+
"border-bottom": "2px solid transparent",
|
|
678
|
+
"border-radius": "var(--ui-tab-radius, 0)",
|
|
679
|
+
cursor: "pointer",
|
|
680
|
+
"white-space": "nowrap",
|
|
681
|
+
transition: transition(["color", "background-color", "border-color", "box-shadow"]),
|
|
682
|
+
"&:hover": {
|
|
683
|
+
color: "var(--ui-surface-fg)",
|
|
684
|
+
"background-color": "var(--ui-tab-hover-bg, transparent)",
|
|
685
|
+
},
|
|
686
|
+
"&:focus-visible": { ...focusRing, "outline-offset": "-2px" },
|
|
687
|
+
},
|
|
688
|
+
intents,
|
|
689
|
+
sizes: {
|
|
690
|
+
sm: { "font-size": "var(--ui-text-sm)", padding: "0.375rem 0.75rem" },
|
|
691
|
+
lg: { "font-size": "var(--ui-text-lg)", padding: "0.75rem 1.25rem" },
|
|
692
|
+
},
|
|
693
|
+
states: {
|
|
694
|
+
disabled: { opacity: "0.45", cursor: "not-allowed", "pointer-events": "none" },
|
|
695
|
+
loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
|
|
696
|
+
active: {
|
|
697
|
+
color: "var(--ui-tab-active-fg, var(--ui-c-text, var(--ui-surface-fg)))",
|
|
698
|
+
"background-color": "var(--ui-tab-active-bg, transparent)",
|
|
699
|
+
"border-bottom-color": "var(--ui-tab-active-line, var(--ui-c, var(--ui-surface-fg)))",
|
|
700
|
+
"box-shadow": "var(--ui-tab-active-shadow, none)",
|
|
701
|
+
"&:hover": {
|
|
702
|
+
color: "var(--ui-tab-active-fg, var(--ui-c-text, var(--ui-surface-fg)))",
|
|
703
|
+
"background-color": "var(--ui-tab-active-bg, transparent)",
|
|
704
|
+
},
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
});
|
|
710
|
+
/**
|
|
711
|
+
* Base-layer keyframes that can't live inside a component rule.
|
|
712
|
+
* Emitted as `@keyframes <prefix>-<name>`; `animation:` values in this
|
|
713
|
+
* theme reference them as `ui-<name>` and are re-prefixed in buildRules.
|
|
714
|
+
*/
|
|
715
|
+
export const defaultKeyframes = {
|
|
716
|
+
spin: { to: { transform: "rotate(360deg)" } },
|
|
717
|
+
pulse: { "50%": { opacity: "0.55" } },
|
|
718
|
+
};
|
|
719
|
+
//# sourceMappingURL=default-theme.js.map
|