@katlux/toolkit 0.1.0-beta.84 → 0.1.1-alpha.100

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 (118) hide show
  1. package/README.md +9 -4
  2. package/bin/add-ai-reference.mjs +84 -0
  3. package/dist/compiled/composables/locales.mjs +554 -0
  4. package/dist/compiled/composables/useKatluxI18n.mjs +56 -0
  5. package/dist/compiled/composables/useKatluxI18n.spec.mjs +10 -0
  6. package/dist/compiled/composables/usePresetComponent.mjs +22 -13
  7. package/dist/module.cjs +70 -1
  8. package/dist/module.json +1 -1
  9. package/dist/module.mjs +71 -2
  10. package/dist/runtime/app.config.d.ts +2 -1
  11. package/dist/runtime/components/KAccordion/KAccordion.logic.d.ts +5 -1
  12. package/dist/runtime/components/KAccordion/KAccordion.logic.js +11 -4
  13. package/dist/runtime/components/KAlert/KAlert.global.d.vue.ts +10 -1
  14. package/dist/runtime/components/KAlert/KAlert.global.vue +9 -1
  15. package/dist/runtime/components/KAlert/KAlert.global.vue.d.ts +10 -1
  16. package/dist/runtime/components/KAlert/KAlert.logic.d.ts +10 -2
  17. package/dist/runtime/components/KAlert/KAlert.logic.js +18 -3
  18. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  19. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  20. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  21. package/dist/runtime/components/KCalendar/KCalendar.global.vue +5 -0
  22. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +3 -1
  23. package/dist/runtime/components/KCalendar/KCalendar.logic.js +37 -10
  24. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
  25. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
  26. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +3 -3
  27. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
  28. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +1 -1
  29. package/dist/runtime/components/KCombobox/KCombobox.logic.js +1 -1
  30. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +7 -7
  31. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +7 -7
  32. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
  33. package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +1 -1
  34. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +1 -1
  35. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +6 -6
  36. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -6
  37. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +2 -2
  38. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +6 -6
  39. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +6 -6
  40. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +2 -2
  41. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +9 -9
  42. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +9 -9
  43. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +4 -4
  44. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
  45. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
  46. package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +6 -6
  47. package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +6 -6
  48. package/dist/runtime/components/KIcon/KIcon.logic.d.ts +3 -3
  49. package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +1 -1
  50. package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +1 -1
  51. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
  52. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
  53. package/dist/runtime/components/KModal/KModal.logic.js +4 -1
  54. package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
  55. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
  56. package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
  57. package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
  58. package/dist/runtime/components/KTabs/KTabs.logic.js +12 -5
  59. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
  60. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
  61. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +2 -2
  62. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +2 -2
  63. package/dist/runtime/components/KToast/KToast.global.d.vue.ts +1 -1
  64. package/dist/runtime/components/KToast/KToast.global.vue.d.ts +1 -1
  65. package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
  66. package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
  67. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +3 -3
  68. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +3 -3
  69. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
  70. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
  71. package/dist/runtime/composables/locales.d.ts +28 -0
  72. package/dist/runtime/composables/locales.js +554 -0
  73. package/dist/runtime/composables/useKatluxI18n.d.ts +15 -0
  74. package/dist/runtime/composables/useKatluxI18n.js +56 -0
  75. package/dist/runtime/composables/usePresetComponent.d.ts +3 -8
  76. package/dist/runtime/composables/usePresetComponent.js +22 -13
  77. package/dist/runtime/plugins/PresetPlugin.d.ts +2 -3
  78. package/dist/runtime/plugins/PresetPlugin.js +11 -15
  79. package/dist/runtime/presets/default/components/KAccordion/KAccordionItem.vue +18 -1
  80. package/dist/runtime/presets/default/components/KAlert/KAlert.d.vue.ts +6 -1
  81. package/dist/runtime/presets/default/components/KAlert/KAlert.vue +112 -3
  82. package/dist/runtime/presets/default/components/KAlert/KAlert.vue.d.ts +6 -1
  83. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +6 -3
  84. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
  85. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +17 -1
  86. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
  87. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +8 -1
  88. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +302 -2
  89. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +8 -1
  90. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +15 -3
  91. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +12 -1
  92. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +7 -0
  93. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +7 -4
  94. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +7 -2
  95. package/dist/runtime/presets/default/components/KModal/KModal.vue +4 -1
  96. package/dist/runtime/presets/default/components/KPagination/KPagination.vue +16 -6
  97. package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +15 -3
  98. package/dist/runtime/presets/default/components/KTabs/KTabs.vue +9 -3
  99. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +4 -1
  100. package/dist/runtime/presets/default/components/KTree/KTree.vue +13 -1
  101. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +5 -1
  102. package/package.json +7 -2
  103. package/dist/runtime/components/KSearchTree/KSearchTree.global.d.vue.ts +0 -3
  104. package/dist/runtime/components/KSearchTree/KSearchTree.global.vue +0 -9
  105. package/dist/runtime/components/KSearchTree/KSearchTree.global.vue.d.ts +0 -3
  106. package/dist/runtime/components/KSearchTree/KSearchTree.logic.d.ts +0 -10
  107. package/dist/runtime/components/KSearchTree/KSearchTree.logic.js +0 -9
  108. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.d.vue.ts +0 -3
  109. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue +0 -9
  110. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue.d.ts +0 -3
  111. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.d.ts +0 -10
  112. package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.js +0 -9
  113. package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.d.vue.ts +0 -6
  114. package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue +0 -13
  115. package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue.d.ts +0 -6
  116. package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.d.vue.ts +0 -6
  117. package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue +0 -13
  118. 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];
@@ -23,18 +23,27 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
23
23
  if (!loader) {
24
24
  const internalLoaders = import.meta.glob([
25
25
  "../presets/**/*.vue",
26
- "../../runtime/presets/**/*.vue"
26
+ "../../runtime/presets/**/*.vue",
27
+ "~/presets/**/*.vue",
28
+ "@/presets/**/*.vue"
27
29
  ]);
28
- const internalKey = `../presets/${presetName}/components/${componentBaseName}/${componentBaseName}.vue`;
29
- loader = internalLoaders[internalKey];
30
- if (!loader) {
31
- const altKey = `../../runtime/presets/${presetName}/components/${componentBaseName}/${componentBaseName}.vue`;
32
- loader = internalLoaders[altKey];
30
+ const candidateKeys = [
31
+ `../presets/${presetName}/components/${componentBaseName}/${componentBaseName}.vue`,
32
+ `../../runtime/presets/${presetName}/components/${componentBaseName}/${componentBaseName}.vue`,
33
+ `/app/presets/${presetName}/components/${componentBaseName}/${componentBaseName}.vue`,
34
+ `/presets/${presetName}/components/${componentBaseName}/${componentBaseName}.vue`
35
+ ];
36
+ for (const [key, importFn] of Object.entries(internalLoaders)) {
37
+ for (const candidate of candidateKeys) {
38
+ if (key.endsWith(candidate)) {
39
+ loader = importFn;
40
+ break;
41
+ }
42
+ }
43
+ if (loader) break;
33
44
  }
34
45
  }
35
- if (loader) {
36
- break;
37
- }
46
+ if (loader) break;
38
47
  }
39
48
  if (!loader) {
40
49
  return defaultComponent;
package/dist/module.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const kit = require('@nuxt/kit');
4
4
  const node_fs = require('node:fs');
5
+ const node_module = require('node:module');
5
6
 
6
7
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
8
  const module$1 = kit.defineNuxtModule({
@@ -9,7 +10,7 @@ const module$1 = kit.defineNuxtModule({
9
10
  name: "@katlux/toolkit",
10
11
  configKey: "katluxToolkit"
11
12
  },
12
- setup(options, nuxt) {
13
+ async setup(options, nuxt) {
13
14
  const { resolve } = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
14
15
  const runtimePath = resolve("./runtime");
15
16
  nuxt.options.build.transpile.push(runtimePath);
@@ -72,6 +73,74 @@ const module$1 = kit.defineNuxtModule({
72
73
  kit.addPlugin(resolve("./runtime/plugins/registerDirectives"));
73
74
  kit.addPlugin(resolve("./runtime/plugins/PresetPlugin"));
74
75
  nuxt.options.alias["#toolkit"] = resolve("./runtime");
76
+ nuxt.options.alias["#toolkit/*"] = resolve("./runtime/*");
77
+ const userSrcDir = nuxt.options.srcDir || nuxt.options.rootDir;
78
+ const possiblePresetsDirs = [
79
+ resolve(userSrcDir, "presets"),
80
+ resolve(nuxt.options.rootDir, "presets")
81
+ ];
82
+ let foundPresetsDir = null;
83
+ for (const pDir of possiblePresetsDirs) {
84
+ if (node_fs.existsSync(pDir)) {
85
+ foundPresetsDir = pDir;
86
+ break;
87
+ }
88
+ }
89
+ if (foundPresetsDir) {
90
+ const fs = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)))("fs");
91
+ try {
92
+ const presets = fs.readdirSync(foundPresetsDir, { withFileTypes: true });
93
+ for (const presetItem of presets) {
94
+ if (presetItem.isDirectory()) {
95
+ const presetName = presetItem.name;
96
+ const cssCandidates = [
97
+ resolve(foundPresetsDir, presetName, "assets/css-variables.css"),
98
+ resolve(foundPresetsDir, presetName, "assets/css-variables.scss"),
99
+ resolve(foundPresetsDir, presetName, "assets/scss/index.scss"),
100
+ resolve(foundPresetsDir, presetName, "assets/scss/index.css")
101
+ ];
102
+ for (const candidate of cssCandidates) {
103
+ if (node_fs.existsSync(candidate) && !nuxt.options.css.includes(candidate)) {
104
+ nuxt.options.css.push(candidate);
105
+ break;
106
+ }
107
+ }
108
+ }
109
+ }
110
+ } catch (e) {
111
+ console.warn("[Katlux] Failed to auto-scan user presets directory:", e);
112
+ }
113
+ kit.addPluginTemplate({
114
+ filename: "katlux-user-presets-plugin.mjs",
115
+ getContents() {
116
+ return `
117
+ import { defineNuxtPlugin } from '#app'
118
+ import { registerPresetComponents } from '#imports'
119
+
120
+ export default defineNuxtPlugin(() => {
121
+ const userPresetLoaders = import.meta.glob([
122
+ '~/presets/**/components/*/*.vue',
123
+ '~/app/presets/**/components/*/*.vue'
124
+ ])
125
+
126
+ const loadersByPreset = {}
127
+ for (const [path, loader] of Object.entries(userPresetLoaders)) {
128
+ const match = path.match(/presets\\/([^/]+)\\/components\\/([^/]+)\\/([^/]+)\\.vue$/)
129
+ if (match) {
130
+ const [, presetName, componentDir, componentFile] = match
131
+ if (!loadersByPreset[presetName]) loadersByPreset[presetName] = {}
132
+ loadersByPreset[presetName][\`./components/\${componentDir}/\${componentFile}.vue\`] = loader
133
+ }
134
+ }
135
+
136
+ for (const [presetName, loaders] of Object.entries(loadersByPreset)) {
137
+ registerPresetComponents(presetName, loaders)
138
+ }
139
+ })
140
+ `;
141
+ }
142
+ });
143
+ }
75
144
  nuxt.hook("prepare:types", (options2) => {
76
145
  options2.tsConfig.compilerOptions = options2.tsConfig.compilerOptions || {};
77
146
  options2.tsConfig.compilerOptions.allowArbitraryExtensions = true;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
3
  "configKey": "katluxToolkit",
4
- "version": "0.1.0-beta.84",
4
+ "version": "0.1.1-alpha.100",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,12 +1,13 @@
1
- import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin, addPluginTemplate } from '@nuxt/kit';
2
2
  import { existsSync } from 'node:fs';
3
+ import { createRequire } from 'node:module';
3
4
 
4
5
  const module$1 = defineNuxtModule({
5
6
  meta: {
6
7
  name: "@katlux/toolkit",
7
8
  configKey: "katluxToolkit"
8
9
  },
9
- setup(options, nuxt) {
10
+ async setup(options, nuxt) {
10
11
  const { resolve } = createResolver(import.meta.url);
11
12
  const runtimePath = resolve("./runtime");
12
13
  nuxt.options.build.transpile.push(runtimePath);
@@ -69,6 +70,74 @@ const module$1 = defineNuxtModule({
69
70
  addPlugin(resolve("./runtime/plugins/registerDirectives"));
70
71
  addPlugin(resolve("./runtime/plugins/PresetPlugin"));
71
72
  nuxt.options.alias["#toolkit"] = resolve("./runtime");
73
+ nuxt.options.alias["#toolkit/*"] = resolve("./runtime/*");
74
+ const userSrcDir = nuxt.options.srcDir || nuxt.options.rootDir;
75
+ const possiblePresetsDirs = [
76
+ resolve(userSrcDir, "presets"),
77
+ resolve(nuxt.options.rootDir, "presets")
78
+ ];
79
+ let foundPresetsDir = null;
80
+ for (const pDir of possiblePresetsDirs) {
81
+ if (existsSync(pDir)) {
82
+ foundPresetsDir = pDir;
83
+ break;
84
+ }
85
+ }
86
+ if (foundPresetsDir) {
87
+ const fs = createRequire(import.meta.url)("fs");
88
+ try {
89
+ const presets = fs.readdirSync(foundPresetsDir, { withFileTypes: true });
90
+ for (const presetItem of presets) {
91
+ if (presetItem.isDirectory()) {
92
+ const presetName = presetItem.name;
93
+ const cssCandidates = [
94
+ resolve(foundPresetsDir, presetName, "assets/css-variables.css"),
95
+ resolve(foundPresetsDir, presetName, "assets/css-variables.scss"),
96
+ resolve(foundPresetsDir, presetName, "assets/scss/index.scss"),
97
+ resolve(foundPresetsDir, presetName, "assets/scss/index.css")
98
+ ];
99
+ for (const candidate of cssCandidates) {
100
+ if (existsSync(candidate) && !nuxt.options.css.includes(candidate)) {
101
+ nuxt.options.css.push(candidate);
102
+ break;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ } catch (e) {
108
+ console.warn("[Katlux] Failed to auto-scan user presets directory:", e);
109
+ }
110
+ addPluginTemplate({
111
+ filename: "katlux-user-presets-plugin.mjs",
112
+ getContents() {
113
+ return `
114
+ import { defineNuxtPlugin } from '#app'
115
+ import { registerPresetComponents } from '#imports'
116
+
117
+ export default defineNuxtPlugin(() => {
118
+ const userPresetLoaders = import.meta.glob([
119
+ '~/presets/**/components/*/*.vue',
120
+ '~/app/presets/**/components/*/*.vue'
121
+ ])
122
+
123
+ const loadersByPreset = {}
124
+ for (const [path, loader] of Object.entries(userPresetLoaders)) {
125
+ const match = path.match(/presets\\/([^/]+)\\/components\\/([^/]+)\\/([^/]+)\\.vue$/)
126
+ if (match) {
127
+ const [, presetName, componentDir, componentFile] = match
128
+ if (!loadersByPreset[presetName]) loadersByPreset[presetName] = {}
129
+ loadersByPreset[presetName][\`./components/\${componentDir}/\${componentFile}.vue\`] = loader
130
+ }
131
+ }
132
+
133
+ for (const [presetName, loaders] of Object.entries(loadersByPreset)) {
134
+ registerPresetComponents(presetName, loaders)
135
+ }
136
+ })
137
+ `;
138
+ }
139
+ });
140
+ }
72
141
  nuxt.hook("prepare:types", (options2) => {
73
142
  options2.tsConfig.compilerOptions = options2.tsConfig.compilerOptions || {};
74
143
  options2.tsConfig.compilerOptions.allowArbitraryExtensions = true;
@@ -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: "default" | "info" | "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: "default" | "info" | "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<("default" | "info" | "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,
@@ -55,10 +55,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
55
55
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
56
56
  }>, {
57
57
  label: string;
58
- value: any;
59
58
  disabled: boolean;
60
- validation: "error" | "success" | "warning" | null | undefined;
59
+ validation: "success" | "warning" | "error" | null | undefined;
61
60
  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;
@@ -55,10 +55,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
55
55
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
56
56
  }>, {
57
57
  label: string;
58
- value: any;
59
58
  disabled: boolean;
60
- validation: "error" | "success" | "warning" | null | undefined;
59
+ validation: "success" | "warning" | "error" | null | undefined;
61
60
  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;
@@ -21,7 +21,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
21
21
  default: boolean;
22
22
  };
23
23
  maxSelectedDisplay: {
24
- type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
24
+ type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
25
25
  default: boolean;
26
26
  };
27
27
  placeholder: {
@@ -98,7 +98,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
98
98
  default: boolean;
99
99
  };
100
100
  maxSelectedDisplay: {
101
- type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
101
+ type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
102
102
  default: boolean;
103
103
  };
104
104
  placeholder: {
@@ -156,7 +156,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
156
156
  }>, {
157
157
  label: string;
158
158
  disabled: boolean;
159
- validation: "error" | "success" | "warning" | null | undefined;
159
+ validation: "success" | "warning" | "error" | null | undefined;
160
160
  validationText: string;
161
161
  modelValue: any;
162
162
  searchbox: boolean;
@@ -21,7 +21,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
21
21
  default: boolean;
22
22
  };
23
23
  maxSelectedDisplay: {
24
- type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
24
+ type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
25
25
  default: boolean;
26
26
  };
27
27
  placeholder: {
@@ -98,7 +98,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
98
98
  default: boolean;
99
99
  };
100
100
  maxSelectedDisplay: {
101
- type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
101
+ type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
102
102
  default: boolean;
103
103
  };
104
104
  placeholder: {
@@ -156,7 +156,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
156
156
  }>, {
157
157
  label: string;
158
158
  disabled: boolean;
159
- validation: "error" | "success" | "warning" | null | undefined;
159
+ validation: "success" | "warning" | "error" | null | undefined;
160
160
  validationText: string;
161
161
  modelValue: any;
162
162
  searchbox: boolean;
@@ -48,7 +48,7 @@ export declare const KComboboxDefaultProps: {
48
48
  default: boolean;
49
49
  };
50
50
  maxSelectedDisplay: {
51
- type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
51
+ type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
52
52
  default: boolean;
53
53
  };
54
54
  placeholder: {
@@ -177,8 +177,8 @@ export function useKComboboxLogic(props, emit) {
177
177
  selectedItems.value = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
178
178
  }
179
179
  }
180
+ resolveSelectedFromValue();
180
181
  onMounted(() => {
181
- resolveSelectedFromValue();
182
182
  if (props.searchbox && props.dataProvider?.filter) {
183
183
  props.dataProvider.setFilter(null);
184
184
  }