vunor 0.1.4 → 0.1.6
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/theme.d.mts +5 -0
- package/dist/theme.mjs +64 -20
- package/package.json +1 -1
package/dist/theme.d.mts
CHANGED
|
@@ -86,6 +86,11 @@ declare const themeFactory: (opts: Required<TVunorUnoPresetOpts> & {
|
|
|
86
86
|
minWidth: Record<string, string>;
|
|
87
87
|
minHeight: Record<string, string>;
|
|
88
88
|
borderRadius: {
|
|
89
|
+
r0: string;
|
|
90
|
+
r1: string;
|
|
91
|
+
r2: string;
|
|
92
|
+
r3: string;
|
|
93
|
+
r4: string;
|
|
89
94
|
base: string;
|
|
90
95
|
};
|
|
91
96
|
animation: {
|
package/dist/theme.mjs
CHANGED
|
@@ -11,7 +11,7 @@ const toastShortcuts = defineShortcuts({
|
|
|
11
11
|
"": [
|
|
12
12
|
"bg-current",
|
|
13
13
|
"p-$m",
|
|
14
|
-
"rounded
|
|
14
|
+
"rounded-r2",
|
|
15
15
|
"border",
|
|
16
16
|
"grid",
|
|
17
17
|
"[grid-template-areas:_'title_action'_'description_action']",
|
|
@@ -62,7 +62,7 @@ const calendarShortcuts = defineShortcuts({
|
|
|
62
62
|
"calendar-grid-row": "grid grid-cols-7 text-body-s",
|
|
63
63
|
"calendar-month-grid": "flex flex-col gap-$m sm:flex-row flex-wrap sm:gap-$m",
|
|
64
64
|
"calendar-cell": {
|
|
65
|
-
"": "c8-flat relative flex items-center justify-center lh-1em rounded whitespace-nowrap font-normal size-3em outline-none",
|
|
65
|
+
"": "c8-flat relative flex items-center justify-center lh-1em rounded-r0 whitespace-nowrap font-normal size-3em outline-none",
|
|
66
66
|
"focus-visible:": "shadow-[0_0_0_2px] shadow-black",
|
|
67
67
|
"data-[disabled]:": "opacity-30",
|
|
68
68
|
"data-[unavailable]:": "pointer-events-none opacity-50 line-through",
|
|
@@ -78,7 +78,7 @@ const calendarShortcuts = defineShortcuts({
|
|
|
78
78
|
"date-picker-root": "inline-block layer-0 shadow-popup animate-easy-zoom-in",
|
|
79
79
|
"date-picker-literal": "opacity-75 cursor-text",
|
|
80
80
|
"date-picker-input": {
|
|
81
|
-
"": "cursor-text rounded-
|
|
81
|
+
"": "cursor-text rounded-r1 p-0.5 text-current",
|
|
82
82
|
"focus:": "outline-none current-text-hl underline animate-blinking animate-count-infinite",
|
|
83
83
|
"data-[placeholder]:": {
|
|
84
84
|
"": "text-current/40",
|
|
@@ -108,7 +108,7 @@ const checkboxShortcuts = defineShortcuts({
|
|
|
108
108
|
"aria-[disabled=true]:": "scope-grey opacity-50 cursor-not-allowed"
|
|
109
109
|
},
|
|
110
110
|
"checkbox": {
|
|
111
|
-
"": "cursor-default shrink-0 select-none rounded-
|
|
111
|
+
"": "cursor-default shrink-0 select-none rounded-r0 transition-all transition-duration-100 flex size-1.5em appearance-none items-center justify-center bg-current/0 border-current border-[0.16em] current-icon-white",
|
|
112
112
|
"group-active/cb:enabled:": "current-bg-scope-color-500 bg-current/20 current-icon-scope-color-500",
|
|
113
113
|
"disabled:": "cursor-not-allowed border-1px",
|
|
114
114
|
"group-[[data-error=true]]/cb:enabled:": "current-border-error-500 border-current",
|
|
@@ -218,7 +218,7 @@ const shortcuts = [
|
|
|
218
218
|
}),
|
|
219
219
|
defineShortcuts({
|
|
220
220
|
"select-content": {
|
|
221
|
-
"": "min-w-[60px] rounded-
|
|
221
|
+
"": "min-w-[60px] rounded-r1 surface-0 bg-current overflow-hidden shadow-popup z-[100] current-border-grey-400 border-current/20 ",
|
|
222
222
|
"data-[design=round]:": "rounded-fingertip-half",
|
|
223
223
|
"[&>div[data-reka-combobox-viewport]]:": "max-h-[var(--reka-popper-available-height)] [scrollbar-width:auto]",
|
|
224
224
|
"[&>div[data-reka-combobox-viewport]::-webkit-scrollbar]:": "block"
|
|
@@ -270,7 +270,7 @@ const shortcuts = [
|
|
|
270
270
|
//#region src/theme/shortcuts/c8.ts
|
|
271
271
|
const c8 = defineShortcuts({
|
|
272
272
|
"c8-filled": {
|
|
273
|
-
"": "current-bg-scope-color-500 rounded-
|
|
273
|
+
"": "current-bg-scope-color-500 rounded-r1 current-text-white current-icon-white icon-current/100 bg-current text-current",
|
|
274
274
|
"hover:": "c8-filled-hover",
|
|
275
275
|
"focus-visible:": "c8-filled-hover",
|
|
276
276
|
"data-[highlighted]:": "c8-filled-hover",
|
|
@@ -278,30 +278,33 @@ const c8 = defineShortcuts({
|
|
|
278
278
|
"data-[active]:": "c8-filled-active"
|
|
279
279
|
},
|
|
280
280
|
"c8-filled-hover": {
|
|
281
|
-
"not-([disabled]):": "current-bg-scope-color-400",
|
|
282
|
-
"dark:not-([disabled]):": "current-bg-scope-color-600"
|
|
283
|
-
},
|
|
284
|
-
"c8-filled-active": {
|
|
285
281
|
"not-([disabled]):": "current-bg-scope-color-600",
|
|
286
282
|
"dark:not-([disabled]):": "current-bg-scope-color-400"
|
|
287
283
|
},
|
|
284
|
+
"c8-filled-active": {
|
|
285
|
+
"not-([disabled]):": "current-bg-scope-color-700",
|
|
286
|
+
"dark:not-([disabled]):": "current-bg-scope-color-300"
|
|
287
|
+
},
|
|
288
288
|
"c8-flat": {
|
|
289
|
-
"": "current-bg-scope-color-500 rounded-
|
|
289
|
+
"": "current-bg-scope-color-500 rounded-r1 current-text-black current-icon-black bg-current/0 text-current/80 icon-current/50",
|
|
290
290
|
"dark:": "current-text-white current-icon-white",
|
|
291
291
|
"hover:": "c8-flat-hover",
|
|
292
292
|
"focus-visible:": "c8-flat-hover",
|
|
293
293
|
"data-[highlighted]:": "c8-flat-hover",
|
|
294
|
+
"active:": "c8-flat-active",
|
|
295
|
+
"data-[active]:": "c8-flat-active",
|
|
294
296
|
"data-[selected=true]:": "c8-flat-selected",
|
|
295
297
|
"aria-[selected=true]:": "c8-flat-selected",
|
|
296
298
|
"aria-[pressed=true]:": "c8-flat-selected"
|
|
297
299
|
},
|
|
298
|
-
"c8-flat-hover": { "not-([disabled]):": "bg-current/
|
|
300
|
+
"c8-flat-hover": { "not-([disabled]):": "bg-current/10" },
|
|
301
|
+
"c8-flat-active": { "not-([disabled]):": "bg-current/15" },
|
|
299
302
|
"c8-flat-selected": {
|
|
300
303
|
"": "c8-flat-hover current-text-scope-color-500 text-current current-icon-scope-color-500 icon-current/100",
|
|
301
304
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400"
|
|
302
305
|
},
|
|
303
306
|
"c8-outlined": {
|
|
304
|
-
"": "c8-flat border-scope-color-500 rounded-
|
|
307
|
+
"": "c8-flat border-scope-color-500 rounded-r1 border current-text-scope-color-500 current-icon-scope-color-500 icon-current/100",
|
|
305
308
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400",
|
|
306
309
|
"hover:": "c8-outlined-hover",
|
|
307
310
|
"focus-visible:": "c8-outlined-hover",
|
|
@@ -312,8 +315,7 @@ const c8 = defineShortcuts({
|
|
|
312
315
|
"c8-outlined-hover": "c8-flat-hover",
|
|
313
316
|
"c8-outlined-active": "c8-flat-active",
|
|
314
317
|
"c8-chrome": {
|
|
315
|
-
"": "
|
|
316
|
-
"dark:": "current-text-scope-light-2 current-icon-scope-light-2",
|
|
318
|
+
"": "surface-0 rounded-r1 border",
|
|
317
319
|
"hover:": "c8-chrome-hover",
|
|
318
320
|
"focus-visible:": "c8-chrome-hover",
|
|
319
321
|
"data-[highlighted]:": "c8-chrome-hover",
|
|
@@ -336,7 +338,7 @@ const c8 = defineShortcuts({
|
|
|
336
338
|
"dark:": "current-bg-scope-dark-1 current-text-scope-color-400 current-icon-scope-color-400"
|
|
337
339
|
},
|
|
338
340
|
"c8-light": {
|
|
339
|
-
"": "current-bg-scope-color-500 rounded-
|
|
341
|
+
"": "current-bg-scope-color-500 rounded-r1 current-text-scope-color-500 current-icon-scope-color-500 bg-current/10 text-current icon-current/80",
|
|
340
342
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400",
|
|
341
343
|
"hover:": "c8-light-hover",
|
|
342
344
|
"focus-visible:": "c8-light-hover",
|
|
@@ -347,8 +349,8 @@ const c8 = defineShortcuts({
|
|
|
347
349
|
"aria-[selected=true]:": "c8-light-hover",
|
|
348
350
|
"aria-[pressed=true]:": "c8-light-hover"
|
|
349
351
|
},
|
|
350
|
-
"c8-light-hover": { "not-([disabled]):": "bg-current/
|
|
351
|
-
"c8-light-active": { "not-([disabled]):": "bg-current/
|
|
352
|
+
"c8-light-hover": { "not-([disabled]):": "bg-current/20" },
|
|
353
|
+
"c8-light-active": { "not-([disabled]):": "bg-current/30" }
|
|
352
354
|
});
|
|
353
355
|
//#endregion
|
|
354
356
|
//#region src/theme/shortcuts/i8.ts
|
|
@@ -360,7 +362,7 @@ const i8 = defineShortcuts({
|
|
|
360
362
|
"focus-within:": "icon-current-hl",
|
|
361
363
|
"[&.i8-flat]:": { "": "border-b-width-[var(--i8-border-width,1px)]" },
|
|
362
364
|
"[&.i8-filled]:": {
|
|
363
|
-
"": "i8-apply-bg current-outline-hl i8-apply-border rounded-
|
|
365
|
+
"": "i8-apply-bg current-outline-hl i8-apply-border rounded-r1 i8-apply-border",
|
|
364
366
|
"data-[active=true]:": "current-border-hl outline i8-apply-outline",
|
|
365
367
|
"focus-within:": "current-border-hl outline i8-apply-outline"
|
|
366
368
|
},
|
|
@@ -1219,6 +1221,47 @@ function buildFontTheme(size, w, wBold, lh, ls, actualFontHeightFactor = 1, actu
|
|
|
1219
1221
|
};
|
|
1220
1222
|
}
|
|
1221
1223
|
//#endregion
|
|
1224
|
+
//#region src/theme/utils/radius-scale.ts
|
|
1225
|
+
const ROOT_FONT_PX = 16;
|
|
1226
|
+
function parseRadius(input) {
|
|
1227
|
+
const m = input.trim().match(/^(-?\d*\.?\d+)(px|em|rem)?$/);
|
|
1228
|
+
if (!m) return null;
|
|
1229
|
+
const n = Number.parseFloat(m[1]);
|
|
1230
|
+
if (!Number.isFinite(n)) return null;
|
|
1231
|
+
return {
|
|
1232
|
+
n,
|
|
1233
|
+
unit: m[2] ?? ""
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
function computeRadiusScale(baseRadius) {
|
|
1237
|
+
const parsed = parseRadius(baseRadius);
|
|
1238
|
+
if (!parsed) return {
|
|
1239
|
+
r0: `min(${baseRadius}, clamp(2px, calc(${baseRadius} / 2), 4px))`,
|
|
1240
|
+
r1: baseRadius,
|
|
1241
|
+
r2: `calc(${baseRadius} * 1.5)`,
|
|
1242
|
+
r3: `calc(${baseRadius} * 2)`,
|
|
1243
|
+
r4: `calc(${baseRadius} * 2.5)`
|
|
1244
|
+
};
|
|
1245
|
+
const { n, unit } = parsed;
|
|
1246
|
+
if (n === 0) return {
|
|
1247
|
+
r0: "0",
|
|
1248
|
+
r1: "0",
|
|
1249
|
+
r2: "0",
|
|
1250
|
+
r3: "0",
|
|
1251
|
+
r4: "0"
|
|
1252
|
+
};
|
|
1253
|
+
const basePx = unit === "em" || unit === "rem" ? n * ROOT_FONT_PX : n;
|
|
1254
|
+
const r0Px = Math.min(basePx, Math.max(2, Math.min(basePx / 2, 4)));
|
|
1255
|
+
const scaled = unit ? baseRadius : `${n}px`;
|
|
1256
|
+
return {
|
|
1257
|
+
r0: `${round(r0Px, 3)}px`,
|
|
1258
|
+
r1: baseRadius,
|
|
1259
|
+
r2: unitBy(scaled, 1.5),
|
|
1260
|
+
r3: unitBy(scaled, 2),
|
|
1261
|
+
r4: unitBy(scaled, 2.5)
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
//#endregion
|
|
1222
1265
|
//#region src/theme/theme.ts
|
|
1223
1266
|
const themeFactory = (opts) => {
|
|
1224
1267
|
/**
|
|
@@ -1260,7 +1303,8 @@ const themeFactory = (opts) => {
|
|
|
1260
1303
|
};
|
|
1261
1304
|
const borderRadius = {
|
|
1262
1305
|
...spacing,
|
|
1263
|
-
base: opts.baseRadius
|
|
1306
|
+
base: opts.baseRadius,
|
|
1307
|
+
...computeRadiusScale(opts.baseRadius)
|
|
1264
1308
|
};
|
|
1265
1309
|
/**
|
|
1266
1310
|
* Typography
|