@katlux/toolkit 0.1.0-alpha.85 → 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.
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * katlux-add-ref
4
+ * Downloads the Katlux AI Reference Guide from the official showcase and installs
5
+ * it into the current project at .agents/skills/KATLUX_AI_REFERENCE.md.
6
+ *
7
+ * Usage:
8
+ * npx @katlux/toolkit katlux-add-ref
9
+ */
10
+
11
+ import { existsSync, mkdirSync, writeFileSync } from 'fs'
12
+ import { resolve, join } from 'path'
13
+
14
+ // Official showcase endpoint — always serves the latest reference guide.
15
+ // ⚠️ Update this URL to your actual deployed showcase domain before publishing.
16
+ const REFERENCE_URL = 'https://alpha.katlux.dev/ai-reference.md'
17
+
18
+ // Target: project root / .agents/skills/KATLUX_AI_REFERENCE.md
19
+ const targetDir = resolve(process.cwd(), '.agents', 'skills')
20
+ const targetFile = join(targetDir, 'KATLUX_AI_REFERENCE.md')
21
+
22
+ const RESET = '\x1b[0m'
23
+ const GREEN = '\x1b[32m'
24
+ const CYAN = '\x1b[36m'
25
+ const YELLOW = '\x1b[33m'
26
+ const RED = '\x1b[31m'
27
+ const BOLD = '\x1b[1m'
28
+ const DIM = '\x1b[2m'
29
+
30
+ function log(color, prefix, message) {
31
+ console.log(`${color}${BOLD}${prefix}${RESET} ${message}`)
32
+ }
33
+
34
+ // ── Fetch the reference file ────────────────────────────────────────────────
35
+ console.log()
36
+ log(CYAN, '[katlux-add-ref]', `Fetching reference guide from showcase...`)
37
+ console.log(` ${DIM}${REFERENCE_URL}${RESET}`)
38
+ console.log()
39
+
40
+ let content
41
+ try {
42
+ const response = await fetch(REFERENCE_URL)
43
+ if (!response.ok) {
44
+ log(RED, '[katlux-add-ref] ✖', `Server responded with ${response.status} ${response.statusText}`)
45
+ console.log(`\n Make sure the Katlux Showcase is reachable:\n ${REFERENCE_URL}`)
46
+ process.exit(1)
47
+ }
48
+ content = await response.text()
49
+ } catch (err) {
50
+ log(RED, '[katlux-add-ref] ✖', `Network error — could not reach the showcase:`)
51
+ console.log(` ${err.message}`)
52
+ console.log(`\n Check your internet connection and try again.`)
53
+ process.exit(1)
54
+ }
55
+
56
+ // ── Create target directory if needed ──────────────────────────────────────
57
+ const isUpdate = existsSync(targetFile)
58
+ if (!existsSync(targetDir)) {
59
+ mkdirSync(targetDir, { recursive: true })
60
+ }
61
+
62
+ // ── Write the file ──────────────────────────────────────────────────────────
63
+ try {
64
+ writeFileSync(targetFile, content, 'utf-8')
65
+ } catch (err) {
66
+ log(RED, '[katlux-add-ref] ✖', `Failed to write the reference file:`)
67
+ console.log(` ${err.message}`)
68
+ process.exit(1)
69
+ }
70
+
71
+ // ── Success output ──────────────────────────────────────────────────────────
72
+ if (isUpdate) {
73
+ log(GREEN, '[katlux-add-ref] ✔', `Reference guide updated successfully!`)
74
+ } else {
75
+ log(GREEN, '[katlux-add-ref] ✔', `Reference guide installed successfully!`)
76
+ }
77
+ console.log()
78
+ console.log(` ${CYAN}Location:${RESET} ${targetFile}`)
79
+ console.log()
80
+ console.log(` ${YELLOW}Tip:${RESET} If you use an AI assistant (Cursor, Copilot, Antigravity, etc.),`)
81
+ console.log(` point it to this file so it understands the full Katlux component API.`)
82
+ console.log()
83
+ console.log(` Re-run this command any time to get the latest version:`)
84
+ console.log(` ${CYAN}npx @katlux/toolkit katlux-add-ref${RESET}`)
85
+ console.log()
@@ -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.85",
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
  })[]>;
@@ -198,11 +198,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
198
198
  placeholder: string;
199
199
  teleportTo: string;
200
200
  valueField: string;
201
- mask: string;
202
201
  inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
203
202
  selectionValue: string | number | Record<string, any> | unknown[];
204
203
  inputValue: string | number | Record<string, any> | unknown[];
205
204
  selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
205
+ mask: string;
206
206
  inputPlaceholder: string;
207
207
  showClear: boolean;
208
208
  inputConfigField: string;
@@ -198,11 +198,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
198
198
  placeholder: string;
199
199
  teleportTo: string;
200
200
  valueField: string;
201
- mask: string;
202
201
  inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
203
202
  selectionValue: string | number | Record<string, any> | unknown[];
204
203
  inputValue: string | number | Record<string, any> | unknown[];
205
204
  selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
205
+ mask: string;
206
206
  inputPlaceholder: string;
207
207
  showClear: boolean;
208
208
  inputConfigField: string;
@@ -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[];
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
27
27
  }>> & Readonly<{}>, {
28
28
  text: string;
29
29
  disabled: boolean;
30
- position: "top" | "left" | "right" | "bottom";
30
+ position: "left" | "right" | "top" | "bottom";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
32
  declare const _default: typeof __VLS_export;
33
33
  export default _default;
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
27
27
  }>> & Readonly<{}>, {
28
28
  text: string;
29
29
  disabled: boolean;
30
- position: "top" | "left" | "right" | "bottom";
30
+ position: "left" | "right" | "top" | "bottom";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
32
  declare const _default: typeof __VLS_export;
33
33
  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;
@@ -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.85",
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",
@@ -8,6 +8,9 @@
8
8
  "access": "public"
9
9
  },
10
10
  "main": "./dist/module.mjs",
11
+ "bin": {
12
+ "katlux-add-ref": "./bin/add-ai-reference.mjs"
13
+ },
11
14
  "scripts": {
12
15
  "build": "nuxt-module-build build && unbuild && mkdir -p dist/runtime && cp -r src/runtime/presets dist/runtime/",
13
16
  "dev": "nuxt-module-build build --stub",
@@ -41,6 +44,7 @@
41
44
  "sass": "^1.80.0"
42
45
  },
43
46
  "files": [
44
- "dist"
47
+ "dist",
48
+ "bin"
45
49
  ]
46
50
  }