vunor 0.1.5 → 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 +54 -12
- 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",
|
|
@@ -286,7 +286,7 @@ const c8 = defineShortcuts({
|
|
|
286
286
|
"dark:not-([disabled]):": "current-bg-scope-color-300"
|
|
287
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",
|
|
@@ -304,7 +304,7 @@ const c8 = defineShortcuts({
|
|
|
304
304
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400"
|
|
305
305
|
},
|
|
306
306
|
"c8-outlined": {
|
|
307
|
-
"": "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",
|
|
308
308
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400",
|
|
309
309
|
"hover:": "c8-outlined-hover",
|
|
310
310
|
"focus-visible:": "c8-outlined-hover",
|
|
@@ -315,7 +315,7 @@ const c8 = defineShortcuts({
|
|
|
315
315
|
"c8-outlined-hover": "c8-flat-hover",
|
|
316
316
|
"c8-outlined-active": "c8-flat-active",
|
|
317
317
|
"c8-chrome": {
|
|
318
|
-
"": "surface-0 rounded-
|
|
318
|
+
"": "surface-0 rounded-r1 border",
|
|
319
319
|
"hover:": "c8-chrome-hover",
|
|
320
320
|
"focus-visible:": "c8-chrome-hover",
|
|
321
321
|
"data-[highlighted]:": "c8-chrome-hover",
|
|
@@ -338,7 +338,7 @@ const c8 = defineShortcuts({
|
|
|
338
338
|
"dark:": "current-bg-scope-dark-1 current-text-scope-color-400 current-icon-scope-color-400"
|
|
339
339
|
},
|
|
340
340
|
"c8-light": {
|
|
341
|
-
"": "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",
|
|
342
342
|
"dark:": "current-text-scope-color-400 current-icon-scope-color-400",
|
|
343
343
|
"hover:": "c8-light-hover",
|
|
344
344
|
"focus-visible:": "c8-light-hover",
|
|
@@ -362,7 +362,7 @@ const i8 = defineShortcuts({
|
|
|
362
362
|
"focus-within:": "icon-current-hl",
|
|
363
363
|
"[&.i8-flat]:": { "": "border-b-width-[var(--i8-border-width,1px)]" },
|
|
364
364
|
"[&.i8-filled]:": {
|
|
365
|
-
"": "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",
|
|
366
366
|
"data-[active=true]:": "current-border-hl outline i8-apply-outline",
|
|
367
367
|
"focus-within:": "current-border-hl outline i8-apply-outline"
|
|
368
368
|
},
|
|
@@ -1221,6 +1221,47 @@ function buildFontTheme(size, w, wBold, lh, ls, actualFontHeightFactor = 1, actu
|
|
|
1221
1221
|
};
|
|
1222
1222
|
}
|
|
1223
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
|
|
1224
1265
|
//#region src/theme/theme.ts
|
|
1225
1266
|
const themeFactory = (opts) => {
|
|
1226
1267
|
/**
|
|
@@ -1262,7 +1303,8 @@ const themeFactory = (opts) => {
|
|
|
1262
1303
|
};
|
|
1263
1304
|
const borderRadius = {
|
|
1264
1305
|
...spacing,
|
|
1265
|
-
base: opts.baseRadius
|
|
1306
|
+
base: opts.baseRadius,
|
|
1307
|
+
...computeRadiusScale(opts.baseRadius)
|
|
1266
1308
|
};
|
|
1267
1309
|
/**
|
|
1268
1310
|
* Typography
|