vunor 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -280,7 +280,7 @@ Button and clickable element design variants:
280
280
  | `c8-outlined` | Border + colored text, transparent fill |
281
281
  | `c8-light` | Light tinted background, colored text |
282
282
 
283
- Each includes hover, active, focus, and disabled states. Apply on any element alongside `scope-{color}`:
283
+ Each includes hover, active, and focus states. Hover and press do not paint on a disabled element: `disabled`, `aria-disabled="true"` or `data-disabled` (the same definition the `disabled-soft` shortcut uses to fade a disabled element). Keyboard focus still paints, so an `aria-disabled` control stays visibly focusable. Apply on any element alongside `scope-{color}`:
284
284
 
285
285
  ```html
286
286
  <button class="scope-primary c8-filled">Save</button>
package/dist/theme.mjs CHANGED
@@ -29,6 +29,13 @@ const toastShortcuts = defineShortcuts({
29
29
  }
30
30
  });
31
31
  //#endregion
32
+ //#region src/theme/utils/disabled.ts
33
+ const disabledSelectors = ":disabled,[disabled],[aria-disabled=true],[data-disabled]";
34
+ /** Variant prefix that matches while the element is disabled. */
35
+ const whenDisabled = `[&:is(${disabledSelectors})]:`;
36
+ /** Variant prefix that matches only while the element is not disabled. */
37
+ const whenEnabled = `[&:not(${disabledSelectors})]:`;
38
+ //#endregion
32
39
  //#region src/components/Calendar/shortcuts.ts
33
40
  const calendarShortcuts = defineShortcuts({
34
41
  "calendar-root": "inline-block",
@@ -42,7 +49,7 @@ const calendarShortcuts = defineShortcuts({
42
49
  "before:": "absolute bottom-[0.6em] w-[1.5em] h-[2px] bg-scope-color-500/75 block",
43
50
  "[&[data-today]::before]:": "content-['']",
44
51
  "[&[data-today][data-selected]::before]:": "bg-white",
45
- "hover:": {
52
+ [`${whenEnabled}hover:`]: {
46
53
  "": "bg-scope-color-200",
47
54
  "dark:": "bg-scope-color-700"
48
55
  },
@@ -82,8 +89,8 @@ const checkboxShortcuts = defineShortcuts({
82
89
  },
83
90
  "checkbox": {
84
91
  "": "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",
85
- "group-active/cb:enabled:": "current-bg-scope-color-500 bg-current/20 current-icon-scope-color-500",
86
- "disabled:": "cursor-not-allowed border-1px",
92
+ [`group-active/cb:${whenEnabled}`]: "current-bg-scope-color-500 bg-current/20 current-icon-scope-color-500",
93
+ [whenDisabled]: "cursor-not-allowed border-1px",
87
94
  "group-[[data-error=true]]/cb:enabled:": "current-border-error-500 border-current",
88
95
  "data-[state=unchecked]": "current-border-grey-500 border-current/40"
89
96
  },
@@ -168,7 +175,7 @@ const shortcuts = [
168
175
  "": "disabled-soft select-none shrink-0 current-bg-scope-color-500 bg-current/0 size-1.25em rounded-full cursor-default current-border-grey-500 border-current/40 border-[0.16em] transition-none",
169
176
  "data-[state=checked]:not-[[data-error='true']]:": "current-border-scope-color-500 border-current",
170
177
  "data-[state=checked]:": "bg-current",
171
- "active:enabled:": "bg-current/20",
178
+ [`${whenEnabled}active:`]: "bg-current/20",
172
179
  "aria-[disabled=true]:": "scope-grey",
173
180
  "data-[error=true]:": "current-border-error-500 current-bg-error-500"
174
181
  },
@@ -209,7 +216,7 @@ const shortcuts = [
209
216
  "slider-thumb": {
210
217
  "": "block w-[1.5em] h-[1.5em] bg-scope-color-500 rounded-full border-scope-light-0 border-[3px] outline-scope-color-500/10 outline-0px outline-solid",
211
218
  "dark:": "border-scope-dark-0",
212
- "not-[[disabled]]:": {
219
+ [whenEnabled]: {
213
220
  "": "cursor-grab",
214
221
  "hover:": "shadow-md",
215
222
  "active:": "cursor-grabbing",
@@ -237,7 +244,7 @@ const btn = defineShortcuts({
237
244
  "[&.btn-round]:": btnRound,
238
245
  "[&.btn-square]:": btnSquare,
239
246
  "[&.btn-round.btn-square]:": "px-0 [--btn-icon-pull:0]",
240
- "disabled:": "opacity-80 cursor-not-allowed",
247
+ [`${whenDisabled}[&:where(:not(.disabled-soft))]:`]: "opacity-80 cursor-not-allowed",
241
248
  "[&>span]:data-[loading]:": "opacity-0 pointer-events-none",
242
249
  "[&>div:not(.loading-indicator-wrapper)]:data-[loading]:": "opacity-0 pointer-events-none",
243
250
  "[&>.loading-indicator-wrapper]:": "absolute left-0 top-0 right-0 bottom-0 flex items-center justify-center cursor-wait"
@@ -254,35 +261,39 @@ const btn = defineShortcuts({
254
261
  const c8 = defineShortcuts({
255
262
  "c8-filled": {
256
263
  "": "current-bg-scope-color-500 rounded-r1 current-text-white current-icon-white icon-current/100 bg-current text-current",
257
- "hover:": "c8-filled-hover",
258
264
  "focus-visible:": "c8-filled-hover",
259
- "data-[highlighted]:": "c8-filled-hover",
260
- "active:": "c8-filled-active",
261
- "data-[active]:": "c8-filled-active"
265
+ [whenEnabled]: {
266
+ "hover:": "c8-filled-hover",
267
+ "data-[highlighted]:": "c8-filled-hover",
268
+ "active:": "c8-filled-active",
269
+ "data-[active]:": "c8-filled-active"
270
+ }
262
271
  },
263
272
  "c8-filled-hover": {
264
- "not-([disabled]):": "current-bg-scope-color-600",
265
- "dark:not-([disabled]):": "current-bg-scope-color-400"
273
+ "": "current-bg-scope-color-600",
274
+ "dark:": "current-bg-scope-color-400"
266
275
  },
267
276
  "c8-filled-active": {
268
- "not-([disabled]):": "current-bg-scope-color-700",
269
- "dark:not-([disabled]):": "current-bg-scope-color-300"
277
+ "": "current-bg-scope-color-700",
278
+ "dark:": "current-bg-scope-color-300"
270
279
  },
271
280
  "c8-flat": {
272
281
  "": "current-bg-scope-color-500 rounded-r1 current-text-black current-icon-black bg-current/0 text-current/80 icon-current/50",
273
282
  "dark:": "current-text-white current-icon-white",
274
- "hover:": "c8-flat-hover",
275
283
  "focus-visible:": "c8-flat-hover",
276
- "data-[highlighted]:": "c8-flat-hover",
277
- "active:": "c8-flat-active",
278
- "data-[active]:": "c8-flat-active",
284
+ [whenEnabled]: {
285
+ "hover:": "c8-flat-hover",
286
+ "data-[highlighted]:": "c8-flat-hover",
287
+ "active:": "c8-flat-active",
288
+ "data-[active]:": "c8-flat-active"
289
+ },
279
290
  "data-[selected=true]:": "c8-flat-selected",
280
291
  "data-[on=true]:": "c8-flat-selected",
281
292
  "aria-[selected=true]:": "c8-flat-selected",
282
293
  "aria-[pressed=true]:": "c8-flat-selected"
283
294
  },
284
- "c8-flat-hover": { "not-([disabled]):": "bg-current/10" },
285
- "c8-flat-active": { "not-([disabled]):": "bg-current/15" },
295
+ "c8-flat-hover": "bg-current/10",
296
+ "c8-flat-active": "bg-current/15",
286
297
  "c8-flat-selected": {
287
298
  "": "c8-flat-hover current-text-scope-color-500 text-current current-icon-scope-color-500 icon-current/100",
288
299
  "dark:": "current-text-scope-color-400 current-icon-scope-color-400"
@@ -290,33 +301,37 @@ const c8 = defineShortcuts({
290
301
  "c8-outlined": {
291
302
  "": "c8-flat border-scope-color-500 rounded-r1 border current-text-scope-color-500 current-icon-scope-color-500 icon-current/100",
292
303
  "dark:": "current-text-scope-color-400 current-icon-scope-color-400",
293
- "hover:": "c8-outlined-hover",
294
304
  "focus-visible:": "c8-outlined-hover",
295
- "data-[highlighted]:": "c8-outlined-hover",
296
- "active:": "c8-outlined-active",
297
- "data-[active]:": "c8-outlined-active"
305
+ [whenEnabled]: {
306
+ "hover:": "c8-outlined-hover",
307
+ "data-[highlighted]:": "c8-outlined-hover",
308
+ "active:": "c8-outlined-active",
309
+ "data-[active]:": "c8-outlined-active"
310
+ }
298
311
  },
299
312
  "c8-outlined-hover": "c8-flat-hover",
300
313
  "c8-outlined-active": "c8-flat-active",
301
314
  "c8-chrome": {
302
315
  "": "surface-0 rounded-r1 border",
303
- "hover:": "c8-chrome-hover",
304
316
  "focus-visible:": "c8-chrome-hover",
305
- "data-[highlighted]:": "c8-chrome-hover",
306
- "active:": "c8-chrome-active",
307
- "data-[active]:": "c8-chrome-active",
317
+ [whenEnabled]: {
318
+ "hover:": "c8-chrome-hover",
319
+ "data-[highlighted]:": "c8-chrome-hover",
320
+ "active:": "c8-chrome-active",
321
+ "data-[active]:": "c8-chrome-active"
322
+ },
308
323
  "data-[selected=true]:": "c8-chrome-selected",
309
324
  "data-[on=true]:": "c8-chrome-selected",
310
325
  "aria-[selected=true]:": "c8-chrome-selected",
311
326
  "aria-[pressed=true]:": "c8-chrome-selected"
312
327
  },
313
328
  "c8-chrome-hover": {
314
- "not-([disabled]):": "current-bg-scope-light-1 bg-current",
315
- "dark:not-([disabled]):": "current-bg-scope-dark-1"
329
+ "": "current-bg-scope-light-1 bg-current",
330
+ "dark:": "current-bg-scope-dark-1"
316
331
  },
317
332
  "c8-chrome-active": {
318
- "not-([disabled]):": "current-bg-scope-light-2 bg-current",
319
- "dark:not-([disabled]):": "current-bg-scope-dark-2"
333
+ "": "current-bg-scope-light-2 bg-current",
334
+ "dark:": "current-bg-scope-dark-2"
320
335
  },
321
336
  "c8-chrome-selected": {
322
337
  "": "current-bg-scope-light-1 bg-current current-text-scope-color-500 text-current current-icon-scope-color-500 icon-current/100",
@@ -325,18 +340,20 @@ const c8 = defineShortcuts({
325
340
  "c8-light": {
326
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",
327
342
  "dark:": "current-text-scope-color-400 current-icon-scope-color-400",
328
- "hover:": "c8-light-hover",
329
343
  "focus-visible:": "c8-light-hover",
330
- "data-[highlighted]:": "c8-light-hover",
331
- "active:": "c8-light-active",
332
- "data-[active]:": "c8-light-active",
344
+ [whenEnabled]: {
345
+ "hover:": "c8-light-hover",
346
+ "data-[highlighted]:": "c8-light-hover",
347
+ "active:": "c8-light-active",
348
+ "data-[active]:": "c8-light-active"
349
+ },
333
350
  "data-[selected=true]:": "c8-light-hover",
334
351
  "data-[on=true]:": "c8-light-hover",
335
352
  "aria-[selected=true]:": "c8-light-hover",
336
353
  "aria-[pressed=true]:": "c8-light-hover"
337
354
  },
338
- "c8-light-hover": { "not-([disabled]):": "bg-current/20" },
339
- "c8-light-active": { "not-([disabled]):": "bg-current/30" }
355
+ "c8-light-hover": "bg-current/20",
356
+ "c8-light-active": "bg-current/30"
340
357
  });
341
358
  //#endregion
342
359
  //#region src/theme/shortcuts/extras.ts
@@ -344,12 +361,7 @@ const popupCard = defineShortcuts({
344
361
  "shadow-popup": "shadow-[0_0_10px_rgba(0,0,0,0.1),0_4px_20px_rgba(0,0,0,0.15)]",
345
362
  "popup-card": { "": "surface-0 bg-current rounded-r2 overflow-hidden shadow-popup z-[100] border current-border-grey-400 border-current/20" }
346
363
  });
347
- const disabledPaint = "opacity-40 cursor-not-allowed";
348
- const disabledSoft = defineShortcuts({ "disabled-soft": {
349
- "disabled:": disabledPaint,
350
- "aria-[disabled=true]:": disabledPaint,
351
- "data-[disabled]:": disabledPaint
352
- } });
364
+ const disabledSoft = defineShortcuts({ "disabled-soft": { [whenDisabled]: "opacity-40 cursor-not-allowed" } });
353
365
  //#endregion
354
366
  //#region src/theme/shortcuts/i8.ts
355
367
  const M = "1em";
@@ -386,7 +398,7 @@ const rawVunorShortcuts = [
386
398
  "i8-transparent": "bg-transparent!",
387
399
  "i8-bare": {
388
400
  "": "i8-apply-bg i8-apply-border current-outline-hl rounded-r1 outline-none text-current placeholder:text-current/50 disabled-soft",
389
- "hover:": "border-current-hover",
401
+ [`${whenEnabled}hover:`]: "border-current-hover",
390
402
  "focus:": "current-border-hl outline i8-apply-outline",
391
403
  "data-[error=true]:": "current-border-error-500 current-outline-error-500 border-current"
392
404
  },
@@ -874,6 +886,7 @@ const componentClasses = {
874
886
  "h6",
875
887
  "i8",
876
888
  "i8-append",
889
+ "i8-filled",
877
890
  "i8-icon-clickable",
878
891
  "i8-icon-wrap",
879
892
  "i8-input",
@@ -882,6 +895,7 @@ const componentClasses = {
882
895
  "i8-label-wrapper",
883
896
  "i8-loading",
884
897
  "i8-prepend",
898
+ "i8-round",
885
899
  "i8-ta-wrapper",
886
900
  "i8-textarea",
887
901
  "i8-underline",
@@ -1288,6 +1302,7 @@ const componentClasses = {
1288
1302
  "btn-icon-left",
1289
1303
  "btn-square",
1290
1304
  "c8-flat",
1305
+ "disabled-soft",
1291
1306
  "flex",
1292
1307
  "gap-1",
1293
1308
  "icon-color",
@@ -1735,13 +1750,13 @@ function multiplySaturation(colors, m = .5) {
1735
1750
  return newObj;
1736
1751
  }
1737
1752
  const layerN = (n, reverse) => reverse ? 4 - n : n;
1753
+ const sideTemplate = (bg, n) => {
1754
+ const fg = bg === "light" ? "dark" : "light";
1755
+ return `current-bg-scope-${bg}-${n} current-text-scope-${fg}-0 current-icon-scope-${fg}-0 current-text-muted-scope-${fg}-2 current-icon-muted-scope-${fg}-2 current-bg-hover-scope-${bg}-${Math.min(n + 1, 4)} current-border-hover-scope-${bg}-3 current-text-hover-scope-${fg}-0`;
1756
+ };
1738
1757
  function getPaletteShortcuts() {
1739
1758
  return [
1740
1759
  [/^layer-([0-4])$/, ([, a], { theme }) => {
1741
- const sideTemplate = (bg, n) => {
1742
- const fg = bg === "light" ? "dark" : "light";
1743
- return `current-bg-scope-${bg}-${n} current-text-scope-${fg}-0 current-icon-scope-${fg}-0 current-text-muted-scope-${fg}-2 current-icon-muted-scope-${fg}-2 current-bg-hover-scope-${bg}-${Math.min(n + 1, 4)} current-border-hover-scope-${bg}-3 current-text-hover-scope-${fg}-0`;
1744
- };
1745
1760
  const d = layerN(Number(a), theme.reverseDarkLayers);
1746
1761
  const l = layerN(Number(a), theme.reverseLightLayers);
1747
1762
  const dark = sideTemplate("dark", d);
@@ -2442,6 +2457,13 @@ const defaultOptions = {
2442
2457
  }
2443
2458
  }
2444
2459
  };
2460
+ const DISABLED_SOFT = "disabled-soft";
2461
+ const DISABLED_SOFT_LITERAL = "__vunor-disabled-soft";
2462
+ const disabledSoftLiteral = {
2463
+ name: "vunor:disabled-soft-literal",
2464
+ order: -1e3,
2465
+ match: (matcher, { generator }) => matcher === DISABLED_SOFT && generator.config.shortcuts.some((sc) => sc[0] === DISABLED_SOFT) ? { matcher: DISABLED_SOFT_LITERAL } : void 0
2466
+ };
2445
2467
  const presetVunor = (_opts) => {
2446
2468
  const opts = defu(_opts, defaultOptions);
2447
2469
  const wind = getFixedWind();
@@ -2460,7 +2482,8 @@ const presetVunor = (_opts) => {
2460
2482
  ...wind,
2461
2483
  name: "vunor",
2462
2484
  theme: defu(theme.theme, wind.theme),
2463
- shortcuts: paletteShortcuts,
2485
+ variants: [disabledSoftLiteral, ...wind.variants ?? []],
2486
+ shortcuts: [...paletteShortcuts, [DISABLED_SOFT_LITERAL, DISABLED_SOFT]],
2464
2487
  extractors: [createVunorExtractor()],
2465
2488
  layers: {
2466
2489
  preflights: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vunor",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -215,4 +215,4 @@
215
215
  "vue-router": "^5.0.4",
216
216
  "vue-tsc": "^3.2.6"
217
217
  }
218
- }
218
+ }