@katlux/toolkit 0.1.1-alpha.91 → 0.1.1-alpha.93

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.
Files changed (59) hide show
  1. package/dist/compiled/composables/usePresetComponent.mjs +5 -7
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/app.config.d.ts +2 -1
  4. package/dist/runtime/components/KAccordion/KAccordion.logic.d.ts +5 -1
  5. package/dist/runtime/components/KAccordion/KAccordion.logic.js +11 -4
  6. package/dist/runtime/components/KAlert/KAlert.global.d.vue.ts +10 -1
  7. package/dist/runtime/components/KAlert/KAlert.global.vue +9 -1
  8. package/dist/runtime/components/KAlert/KAlert.global.vue.d.ts +10 -1
  9. package/dist/runtime/components/KAlert/KAlert.logic.d.ts +10 -2
  10. package/dist/runtime/components/KAlert/KAlert.logic.js +18 -3
  11. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  12. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  13. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  14. package/dist/runtime/components/KCalendar/KCalendar.global.vue +5 -0
  15. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +3 -1
  16. package/dist/runtime/components/KCalendar/KCalendar.logic.js +37 -10
  17. package/dist/runtime/components/KModal/KModal.logic.js +4 -1
  18. package/dist/runtime/components/KTabs/KTabs.logic.js +12 -5
  19. package/dist/runtime/composables/usePresetComponent.d.ts +3 -8
  20. package/dist/runtime/composables/usePresetComponent.js +5 -7
  21. package/dist/runtime/plugins/PresetPlugin.d.ts +2 -3
  22. package/dist/runtime/plugins/PresetPlugin.js +11 -15
  23. package/dist/runtime/presets/default/components/KAccordion/KAccordionItem.vue +18 -1
  24. package/dist/runtime/presets/default/components/KAlert/KAlert.d.vue.ts +6 -1
  25. package/dist/runtime/presets/default/components/KAlert/KAlert.vue +113 -3
  26. package/dist/runtime/presets/default/components/KAlert/KAlert.vue.d.ts +6 -1
  27. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +6 -3
  28. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
  29. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +17 -1
  30. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
  31. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +8 -1
  32. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +302 -2
  33. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +8 -1
  34. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +15 -3
  35. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +12 -1
  36. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +7 -4
  37. package/dist/runtime/presets/default/components/KModal/KModal.vue +4 -1
  38. package/dist/runtime/presets/default/components/KPagination/KPagination.vue +16 -6
  39. package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +15 -3
  40. package/dist/runtime/presets/default/components/KTabs/KTabs.vue +9 -3
  41. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +4 -1
  42. package/dist/runtime/presets/default/components/KTree/KTree.vue +13 -1
  43. package/package.json +1 -1
  44. package/dist/runtime/components/KSearchTree/KSearchTree.global.d.vue.ts +0 -3
  45. package/dist/runtime/components/KSearchTree/KSearchTree.global.vue +0 -9
  46. package/dist/runtime/components/KSearchTree/KSearchTree.global.vue.d.ts +0 -3
  47. package/dist/runtime/components/KSearchTree/KSearchTree.logic.d.ts +0 -10
  48. package/dist/runtime/components/KSearchTree/KSearchTree.logic.js +0 -9
  49. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.d.vue.ts +0 -3
  50. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue +0 -9
  51. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue.d.ts +0 -3
  52. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.d.ts +0 -10
  53. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.js +0 -9
  54. package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.d.vue.ts +0 -6
  55. package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue +0 -13
  56. package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue.d.ts +0 -6
  57. package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.d.vue.ts +0 -6
  58. package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue +0 -13
  59. package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue.d.ts +0 -6
@@ -1,8 +1,8 @@
1
- import { computed, defineAsyncComponent } from "vue";
1
+ import { computed, defineAsyncComponent, shallowReactive } from "vue";
2
2
  import { useAppConfig } from "#app";
3
- export const presetLoadersRegistry = /* @__PURE__ */ new Map();
3
+ const _loadersRegistry = shallowReactive({});
4
4
  export function registerPresetComponents(presetName, loaders) {
5
- presetLoadersRegistry.set(presetName, loaders);
5
+ _loadersRegistry[presetName] = loaders;
6
6
  }
7
7
  export function usePresetComponent(componentBaseName, defaultComponent) {
8
8
  const appConfig = useAppConfig();
@@ -15,7 +15,7 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
15
15
  let loader;
16
16
  for (const presetName of presetStack.value) {
17
17
  if (presetName === "default") break;
18
- const externalLoaders = presetLoadersRegistry.get(presetName);
18
+ const externalLoaders = _loadersRegistry[presetName];
19
19
  if (externalLoaders) {
20
20
  const key = `./components/${componentBaseName}/${componentBaseName}.vue`;
21
21
  loader = externalLoaders[key];
@@ -43,9 +43,7 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
43
43
  if (loader) break;
44
44
  }
45
45
  }
46
- if (loader) {
47
- break;
48
- }
46
+ if (loader) break;
49
47
  }
50
48
  if (!loader) {
51
49
  return defaultComponent;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
3
  "configKey": "katluxToolkit",
4
- "version": "0.1.1-alpha.91",
4
+ "version": "0.1.1-alpha.93",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -3,7 +3,8 @@ export { }
3
3
  declare module '@nuxt/schema' {
4
4
  interface AppConfig {
5
5
  katluxToolkit?: {
6
- activePreset?: string
6
+ activePreset?: string | string[]
7
+ presetList?: Array<{ name: string; value: string | string[] }>
7
8
  }
8
9
  }
9
10
  }
@@ -6,4 +6,8 @@ export declare const KAccordionDefaultProps: {
6
6
  type: BooleanConstructor;
7
7
  };
8
8
  };
9
- export declare function useKAccordionLogic(props: KAccordionProps): {};
9
+ export declare function useKAccordionLogic(props: KAccordionProps): {
10
+ openIds: import("vue").Ref<string[], string[]>;
11
+ toggleItem: (id: string) => void;
12
+ isOpen: (id: string) => boolean;
13
+ };
@@ -31,8 +31,15 @@ export function useKAccordionLogic(props) {
31
31
  function isOpen(id) {
32
32
  return openIds.value.includes(id);
33
33
  }
34
- provide("accordionRegister", registerItem);
35
- provide("accordionToggle", toggleItem);
36
- provide("accordionIsOpen", isOpen);
37
- return {};
34
+ try {
35
+ provide("accordionRegister", registerItem);
36
+ provide("accordionToggle", toggleItem);
37
+ provide("accordionIsOpen", isOpen);
38
+ } catch (e) {
39
+ }
40
+ return {
41
+ openIds,
42
+ toggleItem,
43
+ isOpen
44
+ };
38
45
  }
@@ -1,3 +1,12 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ import type { KAlertProps } from './KAlert.logic.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<KAlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ dismiss: () => any;
4
+ }, string, import("vue").PublicProps, Readonly<KAlertProps> & Readonly<{
5
+ onDismiss?: (() => any) | undefined;
6
+ }>, {
7
+ type: import("./KAlert.logic.js").KAlertType;
8
+ title: string;
9
+ dismissible: boolean;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
11
  declare const _default: typeof __VLS_export;
3
12
  export default _default;
@@ -1,9 +1,17 @@
1
1
  <script setup>
2
2
  import { usePresetComponent } from "../../composables/usePresetComponent";
3
3
  import KAlertDefault from "../../presets/default/components/KAlert/KAlert.vue";
4
+ import { KAlertDefaultProps } from "./KAlert.logic";
5
+ const props = defineProps(/* @__PURE__ */ _mergeDefaults({
6
+ type: { type: String, required: false },
7
+ title: { type: String, required: false },
8
+ dismissible: { type: Boolean, required: false }
9
+ }, KAlertDefaultProps));
10
+ const emit = defineEmits(["dismiss"]);
4
11
  const presetComponent = usePresetComponent("KAlert", KAlertDefault);
5
12
  </script>
6
13
 
7
14
  <template lang="pug">
8
- component(:is="presetComponent")
15
+ component(:is="presetComponent" v-bind="props" @dismiss="emit('dismiss')")
16
+ slot
9
17
  </template>
@@ -1,3 +1,12 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ import type { KAlertProps } from './KAlert.logic.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<KAlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ dismiss: () => any;
4
+ }, string, import("vue").PublicProps, Readonly<KAlertProps> & Readonly<{
5
+ onDismiss?: (() => any) | undefined;
6
+ }>, {
7
+ type: import("./KAlert.logic.js").KAlertType;
8
+ title: string;
9
+ dismissible: boolean;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
11
  declare const _default: typeof __VLS_export;
3
12
  export default _default;
@@ -1,4 +1,12 @@
1
+ export type KAlertType = 'info' | 'success' | 'warning' | 'danger';
1
2
  export interface KAlertProps {
3
+ type?: KAlertType;
4
+ title?: string;
5
+ dismissible?: boolean;
2
6
  }
3
- export declare const KAlertDefaultProps: {};
4
- export declare function useKAlertLogic(): {};
7
+ export declare const KAlertDefaultProps: KAlertProps;
8
+ export declare function useKAlertLogic(props: KAlertProps, emit: (event: 'dismiss') => void): {
9
+ visible: any;
10
+ dismiss: () => void;
11
+ icon: any;
12
+ };
@@ -1,4 +1,19 @@
1
- export const KAlertDefaultProps = {};
2
- export function useKAlertLogic() {
3
- return {};
1
+ export const KAlertDefaultProps = {
2
+ type: "info",
3
+ dismissible: false
4
+ };
5
+ export function useKAlertLogic(props, emit) {
6
+ const visible = ref(true);
7
+ function dismiss() {
8
+ visible.value = false;
9
+ emit("dismiss");
10
+ }
11
+ const iconMap = {
12
+ info: "\u2139\uFE0F",
13
+ success: "\u2705",
14
+ warning: "\u26A0\uFE0F",
15
+ danger: "\u274C"
16
+ };
17
+ const icon = computed(() => iconMap[props.type ?? "info"]);
18
+ return { visible, dismiss, icon };
4
19
  }
@@ -55,7 +55,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
55
55
  onClick?: (() => any) | undefined;
56
56
  }>, {
57
57
  size: "small" | "large" | "medium" | undefined;
58
- type: "info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | undefined;
58
+ type: "info" | "default" | "success" | "warning" | "danger" | "primary" | "light" | "dark" | undefined;
59
59
  iconOnly: boolean;
60
60
  disabled: boolean;
61
61
  href: string;
@@ -55,7 +55,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
55
55
  onClick?: (() => any) | undefined;
56
56
  }>, {
57
57
  size: "small" | "large" | "medium" | undefined;
58
- type: "info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | undefined;
58
+ type: "info" | "default" | "success" | "warning" | "danger" | "primary" | "light" | "dark" | undefined;
59
59
  iconOnly: boolean;
60
60
  disabled: boolean;
61
61
  href: string;
@@ -23,7 +23,7 @@ export interface KButtonEmits {
23
23
  export declare function useKButtonLogic(props: KButtonProps, emit: KButtonEmits): {
24
24
  isLink: import("vue").ComputedRef<boolean>;
25
25
  isDisabled: import("vue").ComputedRef<boolean | undefined>;
26
- buttonClasses: import("vue").ComputedRef<("info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "small" | "large" | "medium" | {
26
+ buttonClasses: import("vue").ComputedRef<("info" | "default" | "success" | "warning" | "danger" | "small" | "primary" | "light" | "dark" | "large" | "medium" | {
27
27
  disabled: boolean | undefined;
28
28
  'icon-only': boolean | undefined;
29
29
  })[]>;
@@ -8,6 +8,8 @@ const emit = defineEmits(["update:selectedDay", "dayClicked"]);
8
8
  const {
9
9
  monthSelectedDay,
10
10
  actualYear,
11
+ actualMonth,
12
+ activeDate,
11
13
  goToPrev,
12
14
  goToNext,
13
15
  getMonthName,
@@ -22,7 +24,10 @@ const templateProps = computed(() => ({
22
24
  view: props.view,
23
25
  viewCount: props.viewCount,
24
26
  actualYear: actualYear.value,
27
+ actualMonth: actualMonth.value,
28
+ activeDate: activeDate.value,
25
29
  monthSelectedDay: monthSelectedDay.value,
30
+ rawMarkedDays: props.markedDays,
26
31
  goToPrev,
27
32
  goToNext,
28
33
  getMonthName,
@@ -236,10 +236,12 @@ export declare function useKCalendarLogic(props: KCalendarProps, emit: KCalendar
236
236
  [Symbol.iterator]: () => StringIterator<string>;
237
237
  }>;
238
238
  actualYear: import("vue").Ref<any, any>;
239
+ actualMonth: import("vue").Ref<any, any>;
240
+ activeDate: import("vue").Ref<Date, Date>;
239
241
  goToPrev: () => void;
240
242
  goToNext: () => void;
241
243
  getMonthName: (monthIndex: number) => string;
242
- showingMonth: (monthIndex: number) => number;
244
+ showingMonth: (monthIndex: number) => any;
243
245
  showingYear: (monthIndex: number) => any;
244
246
  getExpandedDefinedDays: (monthIndex: number) => IDefinedDay[];
245
247
  getExpandedMarkedDays: (monthIndex: number) => IMarkedDay[];
@@ -33,12 +33,14 @@ export function useKCalendarLogic(props, emit) {
33
33
  const actualWeek = ref();
34
34
  const actualYear = ref();
35
35
  const currentView = computed(() => props.view ?? "month");
36
+ const activeDate = ref(/* @__PURE__ */ new Date());
36
37
  function initViewFromDate(dateInput) {
37
38
  if (!dateInput) return false;
38
39
  const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
39
40
  if (!isNaN(date.getTime())) {
40
41
  actualMonth.value = date.getMonth() + 1;
41
42
  actualYear.value = date.getFullYear();
43
+ activeDate.value = new Date(date);
42
44
  return true;
43
45
  }
44
46
  return false;
@@ -74,6 +76,7 @@ export function useKCalendarLogic(props, emit) {
74
76
  const now = /* @__PURE__ */ new Date();
75
77
  actualMonth.value = now.getMonth() + 1;
76
78
  actualYear.value = now.getFullYear();
79
+ activeDate.value = now;
77
80
  }
78
81
  });
79
82
  const months = [
@@ -91,7 +94,7 @@ export function useKCalendarLogic(props, emit) {
91
94
  "December"
92
95
  ];
93
96
  function showingMonth(monthIndex) {
94
- let month = actualMonth.value + monthIndex - Math.round((props.viewCount || 1) / 2);
97
+ let month = actualMonth.value + (monthIndex - 1);
95
98
  if (month > 12) {
96
99
  month = (month - 1) % 12 + 1;
97
100
  } else if (month < 1) {
@@ -101,7 +104,7 @@ export function useKCalendarLogic(props, emit) {
101
104
  }
102
105
  function showingYear(monthIndex) {
103
106
  let year = actualYear.value;
104
- let month = actualMonth.value + monthIndex - Math.round((props.viewCount || 1) / 2);
107
+ let month = actualMonth.value + (monthIndex - 1);
105
108
  if (month > 12) {
106
109
  year += Math.floor((month - 1) / 12);
107
110
  } else if (month < 1) {
@@ -148,18 +151,40 @@ export function useKCalendarLogic(props, emit) {
148
151
  emit("dayClicked", date, getDayMark(date));
149
152
  }
150
153
  function goToPrev() {
151
- actualMonth.value -= props.viewCount || 1;
152
- if (actualMonth.value <= 1) {
153
- actualMonth.value = actualMonth.value + 12;
154
- actualYear.value--;
154
+ if (props.view === "week") {
155
+ const d = new Date(activeDate.value);
156
+ d.setDate(d.getDate() - 7);
157
+ activeDate.value = d;
158
+ actualMonth.value = d.getMonth() + 1;
159
+ actualYear.value = d.getFullYear();
160
+ return;
155
161
  }
162
+ let newMonth = actualMonth.value - (props.viewCount || 1);
163
+ let newYear = actualYear.value;
164
+ while (newMonth < 1) {
165
+ newMonth += 12;
166
+ newYear--;
167
+ }
168
+ actualMonth.value = newMonth;
169
+ actualYear.value = newYear;
156
170
  }
157
171
  function goToNext() {
158
- actualMonth.value += props.viewCount || 1;
159
- if (actualMonth.value >= 12) {
160
- actualMonth.value = actualMonth.value - 12;
161
- actualYear.value++;
172
+ if (props.view === "week") {
173
+ const d = new Date(activeDate.value);
174
+ d.setDate(d.getDate() + 7);
175
+ activeDate.value = d;
176
+ actualMonth.value = d.getMonth() + 1;
177
+ actualYear.value = d.getFullYear();
178
+ return;
179
+ }
180
+ let newMonth = actualMonth.value + (props.viewCount || 1);
181
+ let newYear = actualYear.value;
182
+ while (newMonth > 12) {
183
+ newMonth -= 12;
184
+ newYear++;
162
185
  }
186
+ actualMonth.value = newMonth;
187
+ actualYear.value = newYear;
163
188
  }
164
189
  function getMonthName(monthIndex) {
165
190
  if ((props.viewCount || 1) <= 12) return months[showingMonth(monthIndex) - 1];
@@ -169,6 +194,8 @@ export function useKCalendarLogic(props, emit) {
169
194
  return {
170
195
  monthSelectedDay,
171
196
  actualYear,
197
+ actualMonth,
198
+ activeDate,
172
199
  goToPrev,
173
200
  goToNext,
174
201
  getMonthName,
@@ -8,7 +8,10 @@ export const KModalDefaultProps = {
8
8
  };
9
9
  export function useKModalLogic(props, stableId) {
10
10
  const modalId = computed(() => stableId);
11
- provide(KMODAL_PORTAL_ID_KEY, modalId);
11
+ try {
12
+ provide(KMODAL_PORTAL_ID_KEY, modalId);
13
+ } catch (e) {
14
+ }
12
15
  const opened = ref(false);
13
16
  function openModal() {
14
17
  opened.value = true;
@@ -2,9 +2,13 @@ import { ref, provide, useSlots, computed, Fragment, isVNode, watch } from "vue"
2
2
  export const KTabsDefaultProps = {};
3
3
  export function useKTabsLogic() {
4
4
  const openIndexes = ref([]);
5
- const slots = useSlots();
5
+ let slots = null;
6
+ try {
7
+ slots = useSlots();
8
+ } catch (e) {
9
+ }
6
10
  const items = computed(() => {
7
- if (!slots.default) return [];
11
+ if (!slots?.default) return [];
8
12
  const vnodes = slots.default();
9
13
  const tabs = [];
10
14
  const processVNode = (vnode) => {
@@ -38,9 +42,12 @@ export function useKTabsLogic() {
38
42
  function isOpen(index) {
39
43
  return openIndexes.value.includes(index);
40
44
  }
41
- provide("tabRegister", registerItem);
42
- provide("tabToggle", toggleItem);
43
- provide("tabIsOpen", isOpen);
45
+ try {
46
+ provide("tabRegister", registerItem);
47
+ provide("tabToggle", toggleItem);
48
+ provide("tabIsOpen", isOpen);
49
+ } catch (e) {
50
+ }
44
51
  return {
45
52
  items,
46
53
  toggleItem,
@@ -1,18 +1,13 @@
1
1
  import { type Component } from 'vue';
2
2
  /**
3
- * Registry mapping preset names to their respective module loaders (via import.meta.glob).
4
- * Preset modules must inject their components here via a Nuxt Plugin.
5
- */
6
- export declare const presetLoadersRegistry: Map<string, Record<string, () => Promise<any>>>;
7
- /**
8
- * API for Nuxt modules to dynamically map their generated components
3
+ * API for Nuxt preset plugins to register their component loaders.
9
4
  */
10
5
  export declare function registerPresetComponents(presetName: string, loaders: Record<string, () => Promise<any>>): void;
11
6
  /**
12
- * Composable for dynamically loading preset components across a cascade of active presets
7
+ * Composable for dynamically loading preset components across a cascade of active presets.
13
8
  *
14
9
  * @param componentBaseName - Base name of the component (e.g., 'KButton')
15
10
  * @param defaultComponent - The default preset component to fall back to
16
- * @returns The resolved Async Component
11
+ * @returns A computed ref resolving to the correct Component for the active preset stack
17
12
  */
18
13
  export declare function usePresetComponent(componentBaseName: string, defaultComponent: Component): import("vue").ComputedRef<any>;
@@ -1,8 +1,8 @@
1
- import { computed, defineAsyncComponent } from "vue";
1
+ import { computed, defineAsyncComponent, shallowReactive } from "vue";
2
2
  import { useAppConfig } from "#app";
3
- export const presetLoadersRegistry = /* @__PURE__ */ new Map();
3
+ const _loadersRegistry = shallowReactive({});
4
4
  export function registerPresetComponents(presetName, loaders) {
5
- presetLoadersRegistry.set(presetName, loaders);
5
+ _loadersRegistry[presetName] = loaders;
6
6
  }
7
7
  export function usePresetComponent(componentBaseName, defaultComponent) {
8
8
  const appConfig = useAppConfig();
@@ -15,7 +15,7 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
15
15
  let loader;
16
16
  for (const presetName of presetStack.value) {
17
17
  if (presetName === "default") break;
18
- const externalLoaders = presetLoadersRegistry.get(presetName);
18
+ const externalLoaders = _loadersRegistry[presetName];
19
19
  if (externalLoaders) {
20
20
  const key = `./components/${componentBaseName}/${componentBaseName}.vue`;
21
21
  loader = externalLoaders[key];
@@ -43,9 +43,7 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
43
43
  if (loader) break;
44
44
  }
45
45
  }
46
- if (loader) {
47
- break;
48
- }
46
+ if (loader) break;
49
47
  }
50
48
  if (!loader) {
51
49
  return defaultComponent;
@@ -2,10 +2,9 @@
2
2
  * Katlux Preset Plugin
3
3
  *
4
4
  * This plugin initializes the preset system on app startup:
5
- * - Creates the PresetResolver singleton
5
+ * - Creates the PresetResolver singleton per-request
6
6
  * - Discovers available presets
7
- * - Sets up preset watchers in dev mode
8
- * - Provides global preset utilities
7
+ * - Provides global preset utilities with SSR request isolation
9
8
  */
10
9
  declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
11
10
  export default _default;
@@ -1,25 +1,21 @@
1
- import { defineNuxtPlugin, useHead, useAppConfig } from "#app";
2
- import { watch } from "vue";
1
+ import { defineNuxtPlugin, useHead, useAppConfig, useState } from "#app";
2
+ import { ref, watch } from "vue";
3
3
  import { PresetResolver } from "../utils/PresetResolver.js";
4
4
  export default defineNuxtPlugin((nuxtApp) => {
5
5
  const resolver = new PresetResolver();
6
- const activePreset = resolver.getActivePreset();
7
6
  const appConfig = useAppConfig();
8
- if (activePreset && appConfig.katluxToolkit) {
9
- appConfig.katluxToolkit.activePreset = activePreset;
10
- }
11
- const updateRootAttribute = (preset) => {
12
- useHead({
13
- htmlAttrs: {
14
- "data-template": preset
15
- }
16
- });
17
- };
18
- updateRootAttribute(activePreset);
7
+ const activePresetState = useState("katlux-active-preset-state", () => resolver.getActivePreset());
8
+ const resolvePresetString = (val) => Array.isArray(val) ? val[0] ?? "default" : val;
9
+ const currentPreset = ref(resolvePresetString(activePresetState.value));
10
+ useHead({
11
+ htmlAttrs: {
12
+ "data-template": currentPreset
13
+ }
14
+ });
19
15
  if (appConfig.katluxToolkit) {
20
16
  watch(() => appConfig.katluxToolkit?.activePreset, (newPreset) => {
21
17
  if (newPreset) {
22
- updateRootAttribute(newPreset);
18
+ currentPreset.value = resolvePresetString(newPreset);
23
19
  resolver.setActivePreset(newPreset);
24
20
  }
25
21
  });
@@ -1,6 +1,16 @@
1
1
  <template lang="pug">
2
2
  .accordion-item(:class="{'isOpen': isOpen}")
3
- KGrid.accordion-item__header(align="center" justify="space-between" noGap @click="toggleAccordion")
3
+ KGrid.accordion-item__header(
4
+ align="center"
5
+ justify="space-between"
6
+ noGap
7
+ @click="toggleAccordion"
8
+ @keydown.enter.prevent="toggleAccordion"
9
+ @keydown.space.prevent="toggleAccordion"
10
+ role="button"
11
+ :aria-expanded="isOpen"
12
+ tabindex="0"
13
+ )
4
14
  .accordion-item__title {{title}}
5
15
  KIcon.accordion-item__chevron(iconname="chevron", :class="{'open': isOpen}")
6
16
  .accordion-item__content(:class="{'open': isOpen}")
@@ -17,6 +27,10 @@ const props = defineProps<{
17
27
 
18
28
  <style lang="scss" scoped>
19
29
  .accordion-item {
30
+ width: 100%;
31
+ min-width: 0;
32
+ box-sizing: border-box;
33
+ overflow: hidden;
20
34
  &__header {
21
35
  padding: var(--component-gap);
22
36
  background-color: var(--background-color-medium);
@@ -42,6 +56,9 @@ const props = defineProps<{
42
56
  display: none;
43
57
  padding-top: var(--box-padding);
44
58
  padding-bottom: var(--box-padding);
59
+ width: 100%;
60
+ box-sizing: border-box;
61
+ overflow: hidden;
45
62
  &.open {
46
63
  border-bottom: var(--box-border);
47
64
  }
@@ -1,3 +1,8 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ import type { KAlertProps } from '../../../../components/KAlert/KAlert.logic.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<KAlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ dismiss: () => any;
4
+ }, string, import("vue").PublicProps, Readonly<KAlertProps> & Readonly<{
5
+ onDismiss?: (() => any) | undefined;
6
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
7
  declare const _default: typeof __VLS_export;
3
8
  export default _default;