@katlux/toolkit 0.1.1-alpha.113 → 0.1.1-alpha.114
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/compiled/utils/PresetResolver.mjs +10 -0
- package/dist/compiled/utils/PresetResolver.spec.mjs +68 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KToast/KToast.global.d.vue.ts +1 -1
- package/dist/runtime/components/KToast/KToast.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +2 -2
- package/dist/runtime/plugins/PresetPlugin.js +13 -2
- package/dist/runtime/utils/PresetResolver.js +10 -0
- package/package.json +1 -1
|
@@ -22,6 +22,9 @@ export class PresetResolver {
|
|
|
22
22
|
} catch {
|
|
23
23
|
this.activePreset = presetCookie.value;
|
|
24
24
|
}
|
|
25
|
+
if (appConfig.katluxToolkit) {
|
|
26
|
+
appConfig.katluxToolkit.activePreset = this.activePreset;
|
|
27
|
+
}
|
|
25
28
|
} else if (appConfig.katluxToolkit?.activePreset) {
|
|
26
29
|
this.activePreset = appConfig.katluxToolkit.activePreset;
|
|
27
30
|
}
|
|
@@ -76,6 +79,13 @@ export class PresetResolver {
|
|
|
76
79
|
if (JSON.stringify(this.activePreset) !== JSON.stringify(presetName)) {
|
|
77
80
|
this.activePreset = presetName;
|
|
78
81
|
this.clearCache();
|
|
82
|
+
try {
|
|
83
|
+
const appConfig = useAppConfig();
|
|
84
|
+
if (appConfig?.katluxToolkit) {
|
|
85
|
+
appConfig.katluxToolkit.activePreset = presetName;
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
79
89
|
try {
|
|
80
90
|
const activePresetState = useState("katlux-active-preset-state");
|
|
81
91
|
activePresetState.value = presetName;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi } from "vitest";
|
|
2
|
+
import * as appMock from "#app";
|
|
3
|
+
import { PresetResolver } from "./PresetResolver.mjs";
|
|
4
|
+
describe("PresetResolver Unit Tests", () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.restoreAllMocks();
|
|
7
|
+
});
|
|
8
|
+
it("initializes from appConfig when no cookie is set", () => {
|
|
9
|
+
vi.spyOn(appMock, "useCookie").mockReturnValue({ value: "" });
|
|
10
|
+
vi.spyOn(appMock, "useAppConfig").mockReturnValue({
|
|
11
|
+
katluxToolkit: {
|
|
12
|
+
activePreset: "default"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const resolver = new PresetResolver();
|
|
16
|
+
expect(resolver.getActivePreset()).toBe("default");
|
|
17
|
+
});
|
|
18
|
+
it("initializes from cookie and synchronizes appConfig when cookie is present", () => {
|
|
19
|
+
const appConfigObj = {
|
|
20
|
+
katluxToolkit: {
|
|
21
|
+
activePreset: "default"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
vi.spyOn(appMock, "useCookie").mockReturnValue({ value: "modern" });
|
|
25
|
+
vi.spyOn(appMock, "useAppConfig").mockReturnValue(appConfigObj);
|
|
26
|
+
const resolver = new PresetResolver();
|
|
27
|
+
expect(resolver.getActivePreset()).toBe("modern");
|
|
28
|
+
expect(appConfigObj.katluxToolkit.activePreset).toBe("modern");
|
|
29
|
+
});
|
|
30
|
+
it("parses JSON stringified array preset from cookie", () => {
|
|
31
|
+
const appConfigObj = {
|
|
32
|
+
katluxToolkit: {
|
|
33
|
+
activePreset: "default"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
vi.spyOn(appMock, "useCookie").mockReturnValue({ value: JSON.stringify(["dark", "modern"]) });
|
|
37
|
+
vi.spyOn(appMock, "useAppConfig").mockReturnValue(appConfigObj);
|
|
38
|
+
const resolver = new PresetResolver();
|
|
39
|
+
expect(resolver.getActivePreset()).toEqual(["dark", "modern"]);
|
|
40
|
+
expect(appConfigObj.katluxToolkit.activePreset).toEqual(["dark", "modern"]);
|
|
41
|
+
});
|
|
42
|
+
it("setActivePreset updates state, cookie, appConfig, and invalidates cache", () => {
|
|
43
|
+
const appConfigObj = {
|
|
44
|
+
katluxToolkit: {
|
|
45
|
+
activePreset: "default"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const cookieObj = { value: "default" };
|
|
49
|
+
const stateObj = { value: "default" };
|
|
50
|
+
vi.spyOn(appMock, "useCookie").mockReturnValue(cookieObj);
|
|
51
|
+
vi.spyOn(appMock, "useAppConfig").mockReturnValue(appConfigObj);
|
|
52
|
+
vi.spyOn(appMock, "useState").mockReturnValue(stateObj);
|
|
53
|
+
const resolver = new PresetResolver();
|
|
54
|
+
expect(resolver.getActivePreset()).toBe("default");
|
|
55
|
+
const meta1 = resolver.resolvePreset("KButton");
|
|
56
|
+
expect(meta1.hasCustomPreset).toBe(false);
|
|
57
|
+
expect(resolver.getCachedPresets()["default:KButton"]).toBeDefined();
|
|
58
|
+
resolver.setActivePreset("modern");
|
|
59
|
+
expect(resolver.getActivePreset()).toBe("modern");
|
|
60
|
+
expect(appConfigObj.katluxToolkit.activePreset).toBe("modern");
|
|
61
|
+
expect(stateObj.value).toBe("modern");
|
|
62
|
+
expect(cookieObj.value).toBe("modern");
|
|
63
|
+
expect(resolver.getCachedPresets()["default:KButton"]).toBeUndefined();
|
|
64
|
+
const meta2 = resolver.resolvePreset("KButton");
|
|
65
|
+
expect(meta2.hasCustomPreset).toBe(true);
|
|
66
|
+
expect(meta2.presetPath).toBe("~/presets/modern/KButton.pug");
|
|
67
|
+
});
|
|
68
|
+
});
|
package/dist/module.json
CHANGED
|
@@ -56,9 +56,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
56
56
|
}>, {
|
|
57
57
|
label: string;
|
|
58
58
|
disabled: boolean;
|
|
59
|
+
value: any;
|
|
59
60
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
60
61
|
validationText: string;
|
|
61
|
-
value: any;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
63
|
declare const _default: typeof __VLS_export;
|
|
64
64
|
export default _default;
|
|
@@ -56,9 +56,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
56
56
|
}>, {
|
|
57
57
|
label: string;
|
|
58
58
|
disabled: boolean;
|
|
59
|
+
value: any;
|
|
59
60
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
60
61
|
validationText: string;
|
|
61
|
-
value: any;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
63
|
declare const _default: typeof __VLS_export;
|
|
64
64
|
export default _default;
|
|
@@ -181,8 +181,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
181
181
|
label: string;
|
|
182
182
|
disabled: boolean;
|
|
183
183
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
184
|
-
validationText: string;
|
|
185
|
-
modelValue: any;
|
|
186
184
|
searchbox: boolean;
|
|
187
185
|
searchPlaceholder: string;
|
|
188
186
|
virtualScroll: boolean;
|
|
@@ -192,11 +190,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
192
190
|
placeholder: string;
|
|
193
191
|
teleportTo: string;
|
|
194
192
|
fullWidth: boolean;
|
|
193
|
+
validationText: string;
|
|
195
194
|
closeOnSelect: boolean;
|
|
196
195
|
multiSelect: boolean;
|
|
197
196
|
maxSelectedDisplay: string | number | boolean;
|
|
198
197
|
visibleFields: String[];
|
|
199
198
|
valueField: string;
|
|
199
|
+
modelValue: any;
|
|
200
200
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
201
201
|
declare const _default: typeof __VLS_export;
|
|
202
202
|
export default _default;
|
|
@@ -181,8 +181,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
181
181
|
label: string;
|
|
182
182
|
disabled: boolean;
|
|
183
183
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
184
|
-
validationText: string;
|
|
185
|
-
modelValue: any;
|
|
186
184
|
searchbox: boolean;
|
|
187
185
|
searchPlaceholder: string;
|
|
188
186
|
virtualScroll: boolean;
|
|
@@ -192,11 +190,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
192
190
|
placeholder: string;
|
|
193
191
|
teleportTo: string;
|
|
194
192
|
fullWidth: boolean;
|
|
193
|
+
validationText: string;
|
|
195
194
|
closeOnSelect: boolean;
|
|
196
195
|
multiSelect: boolean;
|
|
197
196
|
maxSelectedDisplay: string | number | boolean;
|
|
198
197
|
visibleFields: String[];
|
|
199
198
|
valueField: string;
|
|
199
|
+
modelValue: any;
|
|
200
200
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
201
201
|
declare const _default: typeof __VLS_export;
|
|
202
202
|
export default _default;
|
|
@@ -191,14 +191,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
192
192
|
label: string;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
-
validationText: string;
|
|
195
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
196
194
|
searchbox: boolean;
|
|
197
195
|
labelField: string;
|
|
198
196
|
placeholder: string;
|
|
199
197
|
teleportTo: string;
|
|
198
|
+
validationText: string;
|
|
200
199
|
mask: string;
|
|
201
200
|
valueField: string;
|
|
201
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
202
202
|
inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
203
203
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
204
204
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
@@ -191,14 +191,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
192
192
|
label: string;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
-
validationText: string;
|
|
195
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
196
194
|
searchbox: boolean;
|
|
197
195
|
labelField: string;
|
|
198
196
|
placeholder: string;
|
|
199
197
|
teleportTo: string;
|
|
198
|
+
validationText: string;
|
|
200
199
|
mask: string;
|
|
201
200
|
valueField: string;
|
|
201
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
202
202
|
inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
203
203
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
204
204
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
@@ -126,10 +126,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
126
126
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
127
127
|
day: string | Date;
|
|
128
128
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
129
|
-
validationText: string;
|
|
130
|
-
modelValue: string | Date;
|
|
131
129
|
placeholder: string;
|
|
132
130
|
teleportTo: string;
|
|
131
|
+
validationText: string;
|
|
132
|
+
modelValue: string | Date;
|
|
133
133
|
showClear: boolean;
|
|
134
134
|
align: "left" | "right" | undefined;
|
|
135
135
|
format: string;
|
|
@@ -126,10 +126,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
126
126
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
127
127
|
day: string | Date;
|
|
128
128
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
129
|
-
validationText: string;
|
|
130
|
-
modelValue: string | Date;
|
|
131
129
|
placeholder: string;
|
|
132
130
|
teleportTo: string;
|
|
131
|
+
validationText: string;
|
|
132
|
+
modelValue: string | Date;
|
|
133
133
|
showClear: boolean;
|
|
134
134
|
align: "left" | "right" | undefined;
|
|
135
135
|
format: string;
|
|
@@ -132,10 +132,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
132
132
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
133
133
|
day: string | Date;
|
|
134
134
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
135
|
-
validationText: string;
|
|
136
|
-
modelValue: string | Date;
|
|
137
135
|
placeholder: string;
|
|
138
136
|
teleportTo: string;
|
|
137
|
+
validationText: string;
|
|
138
|
+
modelValue: string | Date;
|
|
139
139
|
showClear: boolean;
|
|
140
140
|
format: string;
|
|
141
141
|
timeFormat: string;
|
|
@@ -132,10 +132,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
132
132
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
133
133
|
day: string | Date;
|
|
134
134
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
135
|
-
validationText: string;
|
|
136
|
-
modelValue: string | Date;
|
|
137
135
|
placeholder: string;
|
|
138
136
|
teleportTo: string;
|
|
137
|
+
validationText: string;
|
|
138
|
+
modelValue: string | Date;
|
|
139
139
|
showClear: boolean;
|
|
140
140
|
format: string;
|
|
141
141
|
timeFormat: string;
|
|
@@ -110,9 +110,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
label: string;
|
|
111
111
|
disabled: boolean;
|
|
112
112
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
|
+
placeholder: string;
|
|
113
114
|
validationText: string;
|
|
114
115
|
modelValue: string;
|
|
115
|
-
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
117
117
|
format: string;
|
|
118
118
|
step: number;
|
|
@@ -110,9 +110,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
label: string;
|
|
111
111
|
disabled: boolean;
|
|
112
112
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
|
+
placeholder: string;
|
|
113
114
|
validationText: string;
|
|
114
115
|
modelValue: string;
|
|
115
|
-
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
117
117
|
format: string;
|
|
118
118
|
step: number;
|
|
@@ -66,9 +66,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
label: string;
|
|
68
68
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
69
|
+
placeholder: string;
|
|
69
70
|
validationText: string;
|
|
70
71
|
modelValue: string;
|
|
71
|
-
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
declare const _default: typeof __VLS_export;
|
|
@@ -66,9 +66,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
label: string;
|
|
68
68
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
69
|
+
placeholder: string;
|
|
69
70
|
validationText: string;
|
|
70
71
|
modelValue: string;
|
|
71
|
-
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
declare const _default: typeof __VLS_export;
|
|
@@ -58,8 +58,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
58
58
|
}>, {
|
|
59
59
|
label: string;
|
|
60
60
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
61
|
-
validationText: string;
|
|
62
61
|
placeholder: string;
|
|
62
|
+
validationText: string;
|
|
63
63
|
rows: number;
|
|
64
64
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
@@ -58,8 +58,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
58
58
|
}>, {
|
|
59
59
|
label: string;
|
|
60
60
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
61
|
-
validationText: string;
|
|
62
61
|
placeholder: string;
|
|
62
|
+
validationText: string;
|
|
63
63
|
rows: number;
|
|
64
64
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
@@ -69,9 +69,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
70
70
|
label: string;
|
|
71
71
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
72
|
+
placeholder: string;
|
|
72
73
|
validationText: string;
|
|
73
74
|
modelValue: string;
|
|
74
|
-
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
76
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
declare const _default: typeof __VLS_export;
|
|
@@ -69,9 +69,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
70
70
|
label: string;
|
|
71
71
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
72
|
+
placeholder: string;
|
|
72
73
|
validationText: string;
|
|
73
74
|
modelValue: string;
|
|
74
|
-
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
76
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
declare const _default: typeof __VLS_export;
|
|
@@ -48,8 +48,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
48
48
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
49
49
|
}>, {
|
|
50
50
|
type: import("./KToast.logic.js").KToastType;
|
|
51
|
-
modelValue: boolean;
|
|
52
51
|
text: string;
|
|
52
|
+
modelValue: boolean;
|
|
53
53
|
timeout: number;
|
|
54
54
|
teleport: boolean;
|
|
55
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -48,8 +48,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
48
48
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
49
49
|
}>, {
|
|
50
50
|
type: import("./KToast.logic.js").KToastType;
|
|
51
|
-
modelValue: boolean;
|
|
52
51
|
text: string;
|
|
52
|
+
modelValue: boolean;
|
|
53
53
|
timeout: number;
|
|
54
54
|
teleport: boolean;
|
|
55
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -168,16 +168,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
168
168
|
disabled: boolean;
|
|
169
169
|
loading: boolean;
|
|
170
170
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
171
|
-
validationText: string;
|
|
172
|
-
modelValue: any;
|
|
173
171
|
searchbox: boolean;
|
|
174
172
|
searchPlaceholder: string;
|
|
175
173
|
isOptionsOpen: boolean;
|
|
176
174
|
placeholder: string;
|
|
177
175
|
fullWidth: boolean;
|
|
176
|
+
validationText: string;
|
|
178
177
|
closeOnSelect: boolean;
|
|
179
178
|
multiSelect: boolean;
|
|
180
179
|
valueField: string;
|
|
180
|
+
modelValue: any;
|
|
181
181
|
parentKey: string;
|
|
182
182
|
iconField: string;
|
|
183
183
|
idKey: string;
|
|
@@ -168,16 +168,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
168
168
|
disabled: boolean;
|
|
169
169
|
loading: boolean;
|
|
170
170
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
171
|
-
validationText: string;
|
|
172
|
-
modelValue: any;
|
|
173
171
|
searchbox: boolean;
|
|
174
172
|
searchPlaceholder: string;
|
|
175
173
|
isOptionsOpen: boolean;
|
|
176
174
|
placeholder: string;
|
|
177
175
|
fullWidth: boolean;
|
|
176
|
+
validationText: string;
|
|
178
177
|
closeOnSelect: boolean;
|
|
179
178
|
multiSelect: boolean;
|
|
180
179
|
valueField: string;
|
|
180
|
+
modelValue: any;
|
|
181
181
|
parentKey: string;
|
|
182
182
|
iconField: string;
|
|
183
183
|
idKey: string;
|
|
@@ -5,6 +5,9 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
5
5
|
const resolver = new PresetResolver();
|
|
6
6
|
const appConfig = useAppConfig();
|
|
7
7
|
const activePresetState = useState("katlux-active-preset-state", () => resolver.getActivePreset());
|
|
8
|
+
if (appConfig?.katluxToolkit && activePresetState.value) {
|
|
9
|
+
appConfig.katluxToolkit.activePreset = activePresetState.value;
|
|
10
|
+
}
|
|
8
11
|
const resolvePresetString = (val) => Array.isArray(val) ? val[0] ?? "default" : val;
|
|
9
12
|
const currentPreset = ref(resolvePresetString(activePresetState.value));
|
|
10
13
|
useHead({
|
|
@@ -15,13 +18,21 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
15
18
|
watch(activePresetState, (newPreset) => {
|
|
16
19
|
if (newPreset) {
|
|
17
20
|
currentPreset.value = resolvePresetString(newPreset);
|
|
21
|
+
if (appConfig?.katluxToolkit && JSON.stringify(appConfig.katluxToolkit.activePreset) !== JSON.stringify(newPreset)) {
|
|
22
|
+
appConfig.katluxToolkit.activePreset = newPreset;
|
|
23
|
+
}
|
|
24
|
+
nuxtApp.runWithContext(() => {
|
|
25
|
+
resolver.setActivePreset(newPreset);
|
|
26
|
+
});
|
|
18
27
|
}
|
|
19
28
|
});
|
|
20
|
-
if (appConfig
|
|
29
|
+
if (appConfig?.katluxToolkit) {
|
|
21
30
|
watch(() => appConfig.katluxToolkit?.activePreset, (newPreset) => {
|
|
22
31
|
if (newPreset) {
|
|
23
32
|
currentPreset.value = resolvePresetString(newPreset);
|
|
24
|
-
activePresetState.value
|
|
33
|
+
if (JSON.stringify(activePresetState.value) !== JSON.stringify(newPreset)) {
|
|
34
|
+
activePresetState.value = newPreset;
|
|
35
|
+
}
|
|
25
36
|
nuxtApp.runWithContext(() => {
|
|
26
37
|
resolver.setActivePreset(newPreset);
|
|
27
38
|
});
|
|
@@ -22,6 +22,9 @@ export class PresetResolver {
|
|
|
22
22
|
} catch {
|
|
23
23
|
this.activePreset = presetCookie.value;
|
|
24
24
|
}
|
|
25
|
+
if (appConfig.katluxToolkit) {
|
|
26
|
+
appConfig.katluxToolkit.activePreset = this.activePreset;
|
|
27
|
+
}
|
|
25
28
|
} else if (appConfig.katluxToolkit?.activePreset) {
|
|
26
29
|
this.activePreset = appConfig.katluxToolkit.activePreset;
|
|
27
30
|
}
|
|
@@ -76,6 +79,13 @@ export class PresetResolver {
|
|
|
76
79
|
if (JSON.stringify(this.activePreset) !== JSON.stringify(presetName)) {
|
|
77
80
|
this.activePreset = presetName;
|
|
78
81
|
this.clearCache();
|
|
82
|
+
try {
|
|
83
|
+
const appConfig = useAppConfig();
|
|
84
|
+
if (appConfig?.katluxToolkit) {
|
|
85
|
+
appConfig.katluxToolkit.activePreset = presetName;
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
79
89
|
try {
|
|
80
90
|
const activePresetState = useState("katlux-active-preset-state");
|
|
81
91
|
activePresetState.value = presetName;
|