vueless 0.0.523 → 0.0.525

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.523",
3
+ "version": "0.0.525",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -422,82 +422,120 @@ defineExpose({
422
422
  <template>
423
423
  <div v-bind="wrapperAttrs" :data-test="dataTest">
424
424
  <div
425
- v-show="isHeaderSticky || isShownActionsHeader"
425
+ v-show="isHeaderSticky && !isShownActionsHeader"
426
426
  ref="sticky-header-row"
427
427
  :style="tableRowWidthStyle"
428
428
  v-bind="stickyHeaderAttrs"
429
429
  >
430
- <template v-if="isShownActionsHeader">
431
- <div v-bind="stickyHeaderCellAttrs">
432
- <UCheckbox
433
- v-if="selectable"
434
- v-model="selectAll"
435
- size="md"
436
- :partial="!isSelectedAllRows"
437
- v-bind="stickyHeaderActionsCheckboxAttrs"
438
- :data-test="`${dataTest}-select-all`"
439
- />
440
- </div>
430
+ <div v-bind="stickyHeaderCellAttrs">
431
+ <UCheckbox
432
+ v-if="selectable"
433
+ v-model="selectAll"
434
+ size="md"
435
+ :partial="!isSelectedAllRows"
436
+ v-bind="stickyHeaderCheckboxAttrs"
437
+ :data-test="`${dataTest}-select-all`"
438
+ />
441
439
 
442
440
  <div
443
441
  v-if="selectedRows.length"
444
- v-bind="stickyHeaderActionsCounterAttrs"
442
+ v-bind="stickyHeaderCounterAttrs"
445
443
  v-text="selectedRows.length"
446
444
  />
447
-
448
- <!--
449
- @slot Use it to add action buttons within the actions header, which appear when rows are selected.
450
- @binding {array} selected-rows
451
- -->
452
- <slot name="header-actions" :selected-rows="selectedRows" />
453
- </template>
454
-
455
- <template v-else>
456
- <div v-bind="stickyHeaderCellAttrs">
457
- <UCheckbox
458
- v-if="selectable"
459
- v-model="selectAll"
460
- size="md"
461
- :partial="!isSelectedAllRows"
462
- v-bind="stickyHeaderCheckboxAttrs"
463
- :data-test="`${dataTest}-select-all`"
464
- />
465
-
466
- <div
467
- v-if="selectedRows.length"
468
- v-bind="stickyHeaderCounterAttrs"
469
- v-text="selectedRows.length"
470
- />
471
- </div>
472
-
473
- <!-- TODO: Remove any when key attrs are typed-->
474
- <div
475
- v-for="(column, index) in normalizedColumns"
476
- :key="index"
477
- v-bind="stickyHeaderCellAttrs"
478
- :class="cx([(stickyHeaderCellAttrs as any).class, column.thClass])"
479
- >
480
- <template v-if="hasSlotContent($slots[`header-${column.key}`])">
481
- <!--
445
+ </div>
446
+
447
+ <!-- TODO: Remove any when key attrs are typed-->
448
+ <div
449
+ v-for="(column, index) in normalizedColumns"
450
+ :key="index"
451
+ v-bind="stickyHeaderCellAttrs"
452
+ :class="cx([(stickyHeaderCellAttrs as any).class, column.thClass])"
453
+ >
454
+ <template v-if="hasSlotContent($slots[`header-${column.key}`])">
455
+ <!--
482
456
  @slot Use it to customise needed header cell.
483
457
  @binding {object} column
484
458
  @binding {number} index
485
459
  -->
486
- <slot :name="`header-${column.key}`" :column="column" :index="index" />
487
- </template>
460
+ <slot :name="`header-${column.key}`" :column="column" :index="index" />
461
+ </template>
488
462
 
489
- <template v-else>
490
- {{ column.label }}
491
- </template>
463
+ <template v-else>
464
+ {{ column.label }}
465
+ </template>
492
466
 
493
- <!--
467
+ <!--
494
468
  @slot Use it to add something after the needed header cell.
495
469
  @binding {object} column
496
470
  @binding {number} index
497
471
  -->
498
- <slot :name="`header-${column.key}-after`" :column="column" :index="index" />
499
- </div>
500
- </template>
472
+ <slot :name="`header-${column.key}-after`" :column="column" :index="index" />
473
+ </div>
474
+
475
+ <ULoaderProgress v-if="isHeaderSticky" :loading="loading" v-bind="stickyHeaderLoaderAttrs" />
476
+ </div>
477
+
478
+ <div
479
+ v-show="isShownActionsHeader && isHeaderSticky"
480
+ ref="sticky-header-row"
481
+ :style="tableRowWidthStyle"
482
+ v-bind="stickyHeaderAttrs"
483
+ >
484
+ <div v-bind="stickyHeaderCellAttrs">
485
+ <UCheckbox
486
+ v-if="selectable"
487
+ v-model="selectAll"
488
+ size="md"
489
+ :partial="!isSelectedAllRows"
490
+ v-bind="stickyHeaderActionsCheckboxAttrs"
491
+ :data-test="`${dataTest}-select-all`"
492
+ />
493
+ </div>
494
+
495
+ <div
496
+ v-if="selectedRows.length"
497
+ v-bind="stickyHeaderActionsCounterAttrs"
498
+ v-text="selectedRows.length"
499
+ />
500
+
501
+ <!--
502
+ @slot Use it to add action buttons within the actions header, which appear when rows are selected.
503
+ @binding {array} selected-rows
504
+ -->
505
+ <slot name="header-actions" :selected-rows="selectedRows" />
506
+
507
+ <ULoaderProgress v-if="isHeaderSticky" :loading="loading" v-bind="stickyHeaderLoaderAttrs" />
508
+ </div>
509
+
510
+ <div
511
+ v-show="isShownActionsHeader && !isHeaderSticky"
512
+ ref="sticky-header-row"
513
+ :style="tableRowWidthStyle"
514
+ v-bind="stickyHeaderAttrs"
515
+ class="absolute"
516
+ >
517
+ <div v-bind="stickyHeaderCellAttrs">
518
+ <UCheckbox
519
+ v-if="selectable"
520
+ v-model="selectAll"
521
+ size="md"
522
+ :partial="!isSelectedAllRows"
523
+ v-bind="stickyHeaderActionsCheckboxAttrs"
524
+ :data-test="`${dataTest}-select-all`"
525
+ />
526
+ </div>
527
+
528
+ <div
529
+ v-if="selectedRows.length"
530
+ v-bind="stickyHeaderActionsCounterAttrs"
531
+ v-text="selectedRows.length"
532
+ />
533
+
534
+ <!--
535
+ @slot Use it to add action buttons within the actions header, which appear when rows are selected.
536
+ @binding {array} selected-rows
537
+ -->
538
+ <slot name="header-actions" :selected-rows="selectedRows" />
501
539
 
502
540
  <ULoaderProgress v-if="isHeaderSticky" :loading="loading" v-bind="stickyHeaderLoaderAttrs" />
503
541
  </div>
package/utils/theme.ts CHANGED
@@ -38,23 +38,12 @@ type DefaultColors = typeof tailwindColors;
38
38
  export function themeInit() {
39
39
  if (isSSR) return;
40
40
 
41
- const themeSettings = {
42
- colorMode: vuelessConfig.colorMode,
43
- ringOffsetColorLight: vuelessConfig.ringOffsetColorLight,
44
- ringOffsetColorDark: vuelessConfig.ringOffsetColorDark,
45
- ringOffset: vuelessConfig.ringOffset,
46
- ring: vuelessConfig.ring,
47
- gray: vuelessConfig.gray,
48
- brand: vuelessConfig.brand,
49
- rounding: vuelessConfig.rounding,
50
- } as Config;
51
-
52
- setTheme(themeSettings);
41
+ setTheme();
53
42
 
54
43
  const prefersColorSchemeDark = window.matchMedia("(prefers-color-scheme: dark)");
55
44
 
56
45
  prefersColorSchemeDark.addEventListener("change", (event) =>
57
- setTheme({ ...themeSettings, colorMode: event.matches ? ColorMode.Dark : ColorMode.Light }),
46
+ setTheme({ colorMode: event.matches ? ColorMode.Dark : ColorMode.Light }),
58
47
  );
59
48
  }
60
49
 
@@ -73,6 +62,10 @@ export function setColorMode(colorMode: `${ColorMode}`) {
73
62
  newColorMode = isSystemDark ? ColorMode.Dark : ColorMode.Light;
74
63
  }
75
64
 
65
+ if (cashedColorMode !== null) {
66
+ newColorMode = cashedColorMode;
67
+ }
68
+
76
69
  if (isLight) {
77
70
  newColorMode = ColorMode.Light;
78
71
  }
@@ -81,9 +74,11 @@ export function setColorMode(colorMode: `${ColorMode}`) {
81
74
  newColorMode = ColorMode.Dark;
82
75
  }
83
76
 
84
- if (cashedColorMode !== null) {
85
- newColorMode = cashedColorMode;
86
- }
77
+ const darkModeChangeEvent = new CustomEvent("darkModeChange", {
78
+ detail: newColorMode === ColorMode.Dark,
79
+ });
80
+
81
+ if (isSSR) return;
87
82
 
88
83
  if (newColorMode === ColorMode.Dark) {
89
84
  document.documentElement.classList.remove(LIGHT_MODE_SELECTOR);
@@ -93,13 +88,15 @@ export function setColorMode(colorMode: `${ColorMode}`) {
93
88
  document.documentElement.classList.add(LIGHT_MODE_SELECTOR);
94
89
  }
95
90
 
96
- isAuto
97
- ? localStorage.removeItem(COLOR_MODE_KEY)
98
- : localStorage.setItem(COLOR_MODE_KEY, newColorMode);
91
+ window.dispatchEvent(darkModeChangeEvent);
92
+
93
+ if (!isAuto) {
94
+ localStorage.setItem(COLOR_MODE_KEY, newColorMode);
95
+ }
99
96
  }
100
97
 
101
98
  export function setTheme(config: Config = {}) {
102
- setColorMode(config.colorMode || ColorMode.Auto);
99
+ setColorMode(config?.colorMode || vuelessConfig?.colorMode || ColorMode.Auto);
103
100
 
104
101
  const rounding = config?.rounding ?? vuelessConfig.rounding ?? DEFAULT_ROUNDING;
105
102
  const isDarkMode = document.documentElement.classList.contains(DARK_MODE_SELECTOR);
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.523",
4
+ "version": "0.0.525",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -10373,17 +10373,6 @@
10373
10373
  }
10374
10374
  ],
10375
10375
  "slots": [
10376
- {
10377
- "name": "header-actions",
10378
- "scoped": true,
10379
- "description": "Use it to add action buttons within the actions header, which appear when rows are selected.",
10380
- "bindings": [
10381
- {
10382
- "type": "array",
10383
- "name": "selected-rows"
10384
- }
10385
- ]
10386
- },
10387
10376
  {
10388
10377
  "name": "`header-${column.key}`",
10389
10378
  "scoped": true,
@@ -10420,6 +10409,17 @@
10420
10409
  }
10421
10410
  ]
10422
10411
  },
10412
+ {
10413
+ "name": "header-actions",
10414
+ "scoped": true,
10415
+ "description": "Use it to add action buttons within the actions header, which appear when rows are selected.",
10416
+ "bindings": [
10417
+ {
10418
+ "type": "array",
10419
+ "name": "selected-rows"
10420
+ }
10421
+ ]
10422
+ },
10423
10423
  {
10424
10424
  "name": "before-header",
10425
10425
  "scoped": true,