@katlux/toolkit 0.1.0-alpha.86 → 0.1.0-alpha.87

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.
File without changes
@@ -23,13 +23,24 @@ 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
46
  if (loader) {
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({
@@ -72,6 +73,43 @@ 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
+ const userSrcDir = nuxt.options.srcDir || nuxt.options.rootDir;
77
+ const possiblePresetsDirs = [
78
+ resolve(userSrcDir, "presets"),
79
+ resolve(nuxt.options.rootDir, "presets")
80
+ ];
81
+ let foundPresetsDir = null;
82
+ for (const pDir of possiblePresetsDirs) {
83
+ if (node_fs.existsSync(pDir)) {
84
+ foundPresetsDir = pDir;
85
+ break;
86
+ }
87
+ }
88
+ if (foundPresetsDir) {
89
+ 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");
90
+ try {
91
+ const presets = fs.readdirSync(foundPresetsDir, { withFileTypes: true });
92
+ for (const presetItem of presets) {
93
+ if (presetItem.isDirectory()) {
94
+ const presetName = presetItem.name;
95
+ const cssCandidates = [
96
+ resolve(foundPresetsDir, presetName, "assets/css-variables.css"),
97
+ resolve(foundPresetsDir, presetName, "assets/css-variables.scss"),
98
+ resolve(foundPresetsDir, presetName, "assets/scss/index.scss"),
99
+ resolve(foundPresetsDir, presetName, "assets/scss/index.css")
100
+ ];
101
+ for (const candidate of cssCandidates) {
102
+ if (node_fs.existsSync(candidate) && !nuxt.options.css.includes(candidate)) {
103
+ nuxt.options.css.push(candidate);
104
+ break;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ } catch (e) {
110
+ console.warn("[Katlux] Failed to auto-scan user presets directory:", e);
111
+ }
112
+ }
75
113
  nuxt.hook("prepare:types", (options2) => {
76
114
  options2.tsConfig.compilerOptions = options2.tsConfig.compilerOptions || {};
77
115
  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-alpha.86",
4
+ "version": "0.1.0-alpha.87",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin } 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: {
@@ -69,6 +70,43 @@ 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
+ const userSrcDir = nuxt.options.srcDir || nuxt.options.rootDir;
74
+ const possiblePresetsDirs = [
75
+ resolve(userSrcDir, "presets"),
76
+ resolve(nuxt.options.rootDir, "presets")
77
+ ];
78
+ let foundPresetsDir = null;
79
+ for (const pDir of possiblePresetsDirs) {
80
+ if (existsSync(pDir)) {
81
+ foundPresetsDir = pDir;
82
+ break;
83
+ }
84
+ }
85
+ if (foundPresetsDir) {
86
+ const fs = createRequire(import.meta.url)("fs");
87
+ try {
88
+ const presets = fs.readdirSync(foundPresetsDir, { withFileTypes: true });
89
+ for (const presetItem of presets) {
90
+ if (presetItem.isDirectory()) {
91
+ const presetName = presetItem.name;
92
+ const cssCandidates = [
93
+ resolve(foundPresetsDir, presetName, "assets/css-variables.css"),
94
+ resolve(foundPresetsDir, presetName, "assets/css-variables.scss"),
95
+ resolve(foundPresetsDir, presetName, "assets/scss/index.scss"),
96
+ resolve(foundPresetsDir, presetName, "assets/scss/index.css")
97
+ ];
98
+ for (const candidate of cssCandidates) {
99
+ if (existsSync(candidate) && !nuxt.options.css.includes(candidate)) {
100
+ nuxt.options.css.push(candidate);
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ }
106
+ } catch (e) {
107
+ console.warn("[Katlux] Failed to auto-scan user presets directory:", e);
108
+ }
109
+ }
72
110
  nuxt.hook("prepare:types", (options2) => {
73
111
  options2.tsConfig.compilerOptions = options2.tsConfig.compilerOptions || {};
74
112
  options2.tsConfig.compilerOptions.allowArbitraryExtensions = true;
@@ -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" | "small" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "large" | "medium" | {
27
27
  disabled: boolean | undefined;
28
28
  'icon-only': boolean | undefined;
29
29
  })[]>;
@@ -46,8 +46,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
46
46
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
47
47
  }>, {
48
48
  isOpen: boolean;
49
- x: number;
50
49
  teleportTo: string;
50
+ x: number;
51
51
  y: number;
52
52
  target: string | HTMLElement;
53
53
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -46,8 +46,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
46
46
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
47
47
  }>, {
48
48
  isOpen: boolean;
49
- x: number;
50
49
  teleportTo: string;
50
+ x: number;
51
51
  y: number;
52
52
  target: string | HTMLElement;
53
53
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -11,8 +11,8 @@ interface Props {
11
11
  page?: number;
12
12
  }
13
13
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
- search: string;
15
14
  bulkActions: IKDatatableAction[];
15
+ search: string;
16
16
  loading: boolean;
17
17
  visibleFields: Array<string> | null;
18
18
  rowActions: IKDatatableAction[];
@@ -11,8 +11,8 @@ interface Props {
11
11
  page?: number;
12
12
  }
13
13
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
- search: string;
15
14
  bulkActions: IKDatatableAction[];
15
+ search: string;
16
16
  loading: boolean;
17
17
  visibleFields: Array<string> | null;
18
18
  rowActions: IKDatatableAction[];
@@ -165,8 +165,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
165
165
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
166
166
  }>, {
167
167
  label: string;
168
- parentKey: string;
169
- idKey: string;
170
168
  disabled: boolean;
171
169
  loading: boolean;
172
170
  validation: "error" | "success" | "warning" | null | undefined;
@@ -181,6 +179,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
181
179
  multiSelect: boolean;
182
180
  valueField: string;
183
181
  iconField: string;
182
+ idKey: string;
183
+ parentKey: string;
184
184
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
185
185
  declare const _default: typeof __VLS_export;
186
186
  export default _default;
@@ -165,8 +165,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
165
165
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
166
166
  }>, {
167
167
  label: string;
168
- parentKey: string;
169
- idKey: string;
170
168
  disabled: boolean;
171
169
  loading: boolean;
172
170
  validation: "error" | "success" | "warning" | null | undefined;
@@ -181,6 +179,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
181
179
  multiSelect: boolean;
182
180
  valueField: string;
183
181
  iconField: string;
182
+ idKey: string;
183
+ parentKey: string;
184
184
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
185
185
  declare const _default: typeof __VLS_export;
186
186
  export default _default;
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  default: () => {};
82
82
  };
83
83
  }>> & Readonly<{}>, {
84
- parentKey: string;
85
- idKey: string;
86
- expandedByDefault: boolean;
87
84
  bulkActions: import("@katlux/providers").IKDatatableAction[];
88
85
  rowActions: import("@katlux/providers").IKDatatableAction[];
89
86
  cellSlots: Record<string, any>;
90
87
  headerSlots: Record<string, any>;
91
88
  treeColumnIndex: number;
89
+ idKey: string;
90
+ parentKey: string;
91
+ expandedByDefault: boolean;
92
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
93
93
  declare const _default: typeof __VLS_export;
94
94
  export default _default;
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  default: () => {};
82
82
  };
83
83
  }>> & Readonly<{}>, {
84
- parentKey: string;
85
- idKey: string;
86
- expandedByDefault: boolean;
87
84
  bulkActions: import("@katlux/providers").IKDatatableAction[];
88
85
  rowActions: import("@katlux/providers").IKDatatableAction[];
89
86
  cellSlots: Record<string, any>;
90
87
  headerSlots: Record<string, any>;
91
88
  treeColumnIndex: number;
89
+ idKey: string;
90
+ parentKey: string;
91
+ expandedByDefault: boolean;
92
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
93
93
  declare const _default: typeof __VLS_export;
94
94
  export default _default;
@@ -23,13 +23,24 @@ 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
46
  if (loader) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
- "version": "0.1.0-alpha.86",
3
+ "version": "0.1.0-alpha.87",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "Apache-2.0",