@xleddyl/443-components-vue 0.16.55 → 0.16.56

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/CATALOG.md CHANGED
@@ -281,7 +281,7 @@ Templates combine core parts into whole pages and layouts. Start from them for n
281
281
  | `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`. | `templates/settings-page.vue` |
282
282
  | `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`. | `templates/settings-page.vue` |
283
283
  | `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`. | `templates/settings-modal.vue` |
284
- | `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer), `account-start` (above the profile card), `account-fields`. | `templates/settings-modal.vue` |
284
+ | `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`. | `templates/settings-modal.vue` |
285
285
  | `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`. | `presets.vue` (pages root) |
286
286
  | `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`. | `templates/settings-page.vue` |
287
287
  | `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `secondaryLabel`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`. | `templates/empty-page.vue` |
@@ -327,7 +327,7 @@ Chart helpers: `useChartColors`, `readChartColors`, `withAlpha`, `registerChartM
327
327
 
328
328
  ## Palette
329
329
 
330
- `PALETTE_COLORS` is a categorical palette of 12 colors, `isPaletteColor(value)` checks a value, `PaletteSelect` chooses one (`--k-palette-<name>` tokens, light and dark). `paletteColor(key)` gives a stable color for a string, `paletteClass(color)` the class that sets `--k-palette` and `--k-palette-text` on your own elements. `paletteClass('muted')` (class `k-palette-muted`) is a grey for an empty or missing state, outside the palette. `k-palette-dot` with that class draws a small dot of the color.
330
+ `@xleddyl/443-components-vue/palette` exports the palette without components (`PALETTE_COLORS`, `isPaletteColor`, `paletteColor`, `paletteClass`, types), safe for shared and server code. `PALETTE_COLORS` is a categorical palette of 12 colors, `isPaletteColor(value)` checks a value, `PaletteSelect` chooses one (`--k-palette-<name>` tokens, light and dark). `paletteColor(key)` gives a stable color for a string, `paletteClass(color)` the class that sets `--k-palette` and `--k-palette-text` on your own elements. `paletteClass('muted')` (class `k-palette-muted`) is a grey for an empty or missing state, outside the palette. `k-palette-dot` with that class draws a small dot of the color.
331
331
 
332
332
  ## Composables
333
333
 
@@ -96,10 +96,7 @@
96
96
  class="k-settings-modal-content"
97
97
  :aria-labelledby="`${baseId}-title`"
98
98
  >
99
- <header
100
- class="k-settings-modal-header"
101
- :class="{ 'has-tabs': !!$slots[`tabs-${active.id}`] }"
102
- >
99
+ <header class="k-settings-modal-header">
103
100
  <div class="k-settings-modal-heading">
104
101
  <h2 :id="`${baseId}-title`" class="k-settings-modal-title">
105
102
  <template v-if="currentPage">
@@ -139,9 +136,11 @@
139
136
  </Button>
140
137
  <slot :name="`actions-${active.id}`" v-bind="slotProps(active, close)" />
141
138
  </div>
142
- <div v-if="$slots[`tabs-${active.id}`]" class="k-settings-modal-tabs">
143
- <slot :name="`tabs-${active.id}`" v-bind="slotProps(active, close)" />
144
- </div>
139
+ <template v-for="tabs in [tabsContent(active, close)]" :key="active.id">
140
+ <div v-if="tabs.length" class="k-settings-modal-tabs">
141
+ <component :is="() => tabs" />
142
+ </div>
143
+ </template>
145
144
  </header>
146
145
  <div
147
146
  ref="contentBody"
@@ -206,7 +205,17 @@
206
205
  </template>
207
206
 
208
207
  <script setup>
209
- import { computed, nextTick, onMounted, useId, useTemplateRef, watch } from "vue";
208
+ import {
209
+ Comment,
210
+ Fragment,
211
+ Text,
212
+ computed,
213
+ nextTick,
214
+ onMounted,
215
+ useId,
216
+ useTemplateRef,
217
+ watch
218
+ } from "vue";
210
219
  import { THEME_PRESETS } from "../../composables/usePreset";
211
220
  import { useLocale } from "../../composables/useLocale";
212
221
  import { useLinkResolver } from "../../internal/core/link";
@@ -251,7 +260,7 @@ const props = defineProps({
251
260
  accountSection: { type: String, required: false, default: "account" },
252
261
  resolvePage: { type: Function, required: false }
253
262
  });
254
- defineSlots();
263
+ const slots = defineSlots();
255
264
  const emit = defineEmits(["open", "close", "afterLeave"]);
256
265
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
257
266
  const section = defineModel("section", { type: String });
@@ -321,6 +330,18 @@ const trail = computed(() => [
321
330
  active.value?.label ?? "",
322
331
  ...pages.value.slice(0, -1).map((page) => page.label)
323
332
  ]);
333
+ function hasContent(node) {
334
+ if (node.type === Comment) return false;
335
+ if (node.type === Text) return String(node.children ?? "").trim() !== "";
336
+ if (node.type === Fragment) {
337
+ return Array.isArray(node.children) && node.children.some(hasContent);
338
+ }
339
+ return true;
340
+ }
341
+ function tabsContent(item, close) {
342
+ const nodes = slots[`tabs-${item.id}`]?.(slotProps(item, close));
343
+ return (nodes ?? []).some(hasContent) ? nodes : [];
344
+ }
324
345
  function slotProps(item, close) {
325
346
  return { section: item, close, page: currentPage.value, pages: pages.value, openPage, back };
326
347
  }
@@ -1,3 +1,4 @@
1
+ import type { VNode } from 'vue';
1
2
  import type { ThemePreset } from '../../composables/usePreset';
2
3
  import type { RouteLocation } from '../../internal/layout/query';
3
4
  import type { DialogBeforeClose } from '../overlays/types';
@@ -245,12 +246,12 @@ declare const __VLS_base: import("vue").DefineComponent<{
245
246
  part?: string;
246
247
  popover?: import("../../index.ts").PopoverMode | "" | boolean;
247
248
  dismissible?: boolean | undefined;
248
- onVnodeBeforeMount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
249
- onVnodeMounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
250
- onVnodeBeforeUpdate?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
251
- onVnodeUpdated?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
252
- onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
253
- onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
249
+ onVnodeBeforeMount?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
250
+ onVnodeMounted?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
251
+ onVnodeBeforeUpdate?: (((vnode: VNode, oldVNode: VNode) => void) | ((vnode: VNode, oldVNode: VNode) => void)[]) | undefined;
252
+ onVnodeUpdated?: (((vnode: VNode, oldVNode: VNode) => void) | ((vnode: VNode, oldVNode: VNode) => void)[]) | undefined;
253
+ onVnodeBeforeUnmount?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
254
+ onVnodeUnmounted?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
254
255
  sheet?: boolean;
255
256
  tab?: import("../layout/types.ts").TabItem["value"];
256
257
  onCancel?: ((payload: Event) => void) | undefined;
@@ -497,12 +498,12 @@ declare const __VLS_base: import("vue").DefineComponent<{
497
498
  part?: string;
498
499
  popover?: import("../../index.ts").PopoverMode | "" | boolean;
499
500
  dismissible?: boolean | undefined;
500
- onVnodeBeforeMount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
501
- onVnodeMounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
502
- onVnodeBeforeUpdate?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
503
- onVnodeUpdated?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
504
- onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
505
- onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
501
+ onVnodeBeforeMount?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
502
+ onVnodeMounted?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
503
+ onVnodeBeforeUpdate?: (((vnode: VNode, oldVNode: VNode) => void) | ((vnode: VNode, oldVNode: VNode) => void)[]) | undefined;
504
+ onVnodeUpdated?: (((vnode: VNode, oldVNode: VNode) => void) | ((vnode: VNode, oldVNode: VNode) => void)[]) | undefined;
505
+ onVnodeBeforeUnmount?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
506
+ onVnodeUnmounted?: (((vnode: VNode) => void) | ((vnode: VNode) => void)[]) | undefined;
506
507
  sheet?: boolean;
507
508
  tab?: import("../layout/types.ts").TabItem["value"];
508
509
  onCancel?: ((payload: Event) => void) | undefined;
@@ -0,0 +1,2 @@
1
+ export { PALETTE_COLORS, isPaletteColor, paletteClass, paletteColor, } from './components/core/palette';
2
+ export type { DotColor, PaletteColor } from './components/core/types';
@@ -0,0 +1,6 @@
1
+ export {
2
+ PALETTE_COLORS,
3
+ isPaletteColor,
4
+ paletteClass,
5
+ paletteColor
6
+ } from "./components/core/palette.mjs";
@@ -155,7 +155,7 @@
155
155
  padding: 1.25rem 1.5rem 0.875rem;
156
156
  }
157
157
 
158
- .k-settings-modal-header.has-tabs {
158
+ .k-settings-modal-header:has(> .k-settings-modal-tabs) {
159
159
  row-gap: 0.5rem;
160
160
  padding-bottom: 0;
161
161
  }
@@ -530,7 +530,7 @@
530
530
  padding: 1rem 1rem 0.75rem;
531
531
  }
532
532
 
533
- .k-settings-modal-header.has-tabs {
533
+ .k-settings-modal-header:has(> .k-settings-modal-tabs) {
534
534
  padding-bottom: 0;
535
535
  }
536
536
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/443-components-vue",
3
- "version": "0.16.55",
3
+ "version": "0.16.56",
4
4
  "description": "Compact, scoped dashboard components for Vue and Nuxt",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",
@@ -39,6 +39,10 @@
39
39
  "types": "./dist/chart/index.d.ts",
40
40
  "import": "./dist/chart/index.mjs"
41
41
  },
42
+ "./palette": {
43
+ "types": "./dist/palette.d.ts",
44
+ "import": "./dist/palette.mjs"
45
+ },
42
46
  "./grid/style.css": "./dist/grid/style.css",
43
47
  "./editor/style.css": "./dist/editor/style.css",
44
48
  "./chart/style.css": "./dist/chart/style.css",