@katlux/toolkit 0.1.1-alpha.146 → 0.1.1-alpha.148

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 (228) hide show
  1. package/README.md +32 -22
  2. package/bin/ai-init.mjs +71 -13
  3. package/bin/ai-tokens/adapters/antigravityAdapter.mjs +22 -0
  4. package/bin/ai-tokens/adapters/claudeCodeAdapter.mjs +192 -0
  5. package/bin/ai-tokens/adapters/codexAdapter.mjs +176 -0
  6. package/bin/ai-tokens/adapters/cursorAdapter.mjs +202 -0
  7. package/bin/ai-tokens/adapters/index.mjs +30 -0
  8. package/bin/ai-tokens/cliViews.mjs +301 -0
  9. package/bin/ai-tokens/formatAndDates.mjs +89 -0
  10. package/bin/ai-tokens/reportGenerator.mjs +232 -0
  11. package/bin/ai-tokens/transcriptParser.mjs +299 -0
  12. package/bin/ai-tokens.mjs +38 -1030
  13. package/bin/cli.mjs +14 -10
  14. package/bin/preset-contracts.json +66 -10
  15. package/dist/compiled/composables/locales/asianAndPacific.mjs +296 -0
  16. package/dist/compiled/composables/locales/northernAndEasternEuropean.mjs +342 -0
  17. package/dist/compiled/composables/locales/westernEuropean.mjs +268 -0
  18. package/dist/compiled/composables/locales.mjs +28 -895
  19. package/dist/compiled/composables/useDataProvider.mjs +3 -1
  20. package/dist/compiled/composables/useKatluxForm.mjs +7 -7
  21. package/dist/compiled/composables/usePresetComponent.mjs +2 -0
  22. package/dist/compiled/composables/useRequestQueue.mjs +3 -1
  23. package/dist/compiled/composables/useVirtualDataset.mjs +322 -354
  24. package/dist/compiled/composables/useVirtualScroll.mjs +69 -62
  25. package/dist/compiled/composables/virtualDataset/cacheStateHelpers.mjs +76 -0
  26. package/dist/compiled/composables/virtualDataset/keyboardNavHelpers.mjs +60 -0
  27. package/dist/compiled/composables/virtualDataset/treeSelectionHelpers.mjs +103 -0
  28. package/dist/compiled/composables/virtualDataset/types.mjs +0 -0
  29. package/dist/compiled/utils/deprecation.mjs +44 -0
  30. package/dist/compiled/utils/dom.mjs +124 -0
  31. package/dist/module.cjs +0 -5
  32. package/dist/module.json +1 -1
  33. package/dist/module.mjs +1 -6
  34. package/dist/runtime/app.config.d.ts +3 -0
  35. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +8 -0
  36. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +21 -55
  37. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  38. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  39. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  40. package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +4 -4
  41. package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +4 -4
  42. package/dist/runtime/components/KCalendar/KCalendar.logic.js +8 -4
  43. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +4 -0
  44. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +2 -0
  45. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +41 -26
  46. package/dist/runtime/components/KCalendar/recurringUtils.js +6 -5
  47. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
  48. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
  49. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +17 -2
  50. package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -4
  51. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +17 -2
  52. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +10 -2
  53. package/dist/runtime/components/KCombobox/KCombobox.logic.js +32 -13
  54. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +1 -1
  55. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +1 -1
  56. package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +3 -3
  57. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue +4 -1
  58. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +3 -3
  59. package/dist/runtime/components/KContextMenu/KContextMenu.logic.d.ts +24 -4
  60. package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +43 -27
  61. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +24 -1
  62. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +19 -7
  63. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +24 -1
  64. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +20 -0
  65. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +54 -14
  66. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +1 -1
  67. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +1 -1
  68. package/dist/runtime/components/KDatatable/KDatatable.logic.js +6 -5
  69. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +6 -4
  70. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +45 -26
  71. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -4
  72. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +2 -0
  73. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +66 -20
  74. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +3 -3
  75. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +3 -3
  76. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +4 -4
  77. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +4 -4
  78. package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +3 -2
  79. package/dist/runtime/components/KDropdown/KDropdown.logic.js +14 -13
  80. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +3 -1
  81. package/dist/runtime/components/KGantt/KGantt.global.vue +7 -1
  82. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +3 -1
  83. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
  84. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
  85. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
  86. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
  87. package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
  88. package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
  89. package/dist/runtime/components/KLayout/KLayout.global.d.vue.ts +4 -1
  90. package/dist/runtime/components/KLayout/KLayout.global.vue +4 -1
  91. package/dist/runtime/components/KLayout/KLayout.global.vue.d.ts +4 -1
  92. package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +9 -0
  93. package/dist/runtime/components/KLoader/KLoader.global.vue +1 -0
  94. package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +9 -0
  95. package/dist/runtime/components/KLoader/KLoader.logic.d.ts +5 -0
  96. package/dist/runtime/components/KLoader/KLoader.logic.js +4 -0
  97. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +30 -7
  98. package/dist/runtime/components/KMultiTabs/KMultiTabs.logic.d.ts +1 -0
  99. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +6 -4
  100. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -1
  101. package/dist/runtime/components/KPagination/KPagination.logic.js +17 -9
  102. package/dist/runtime/components/KRangeSlider/KRangeSlider.global.d.vue.ts +1 -1
  103. package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue.d.ts +1 -1
  104. package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
  105. package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
  106. package/dist/runtime/components/KTabs/KTabs.logic.js +33 -11
  107. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
  108. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
  109. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +12 -1
  110. package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
  111. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +12 -1
  112. package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +5 -0
  113. package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -0
  114. package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
  115. package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
  116. package/dist/runtime/components/KTooltip/KTooltip.logic.d.ts +11 -2
  117. package/dist/runtime/components/KTooltip/KTooltip.logic.js +7 -5
  118. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +1 -1
  119. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
  120. package/dist/runtime/components/KTree/KTree.logic.js +21 -1
  121. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +8 -4
  122. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +4 -2
  123. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +8 -4
  124. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -2
  125. package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +10 -1
  126. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
  127. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
  128. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +1 -1
  129. package/dist/runtime/components/KTreeView/KTreeView.logic.js +36 -12
  130. package/dist/runtime/composables/locales/asianAndPacific.d.ts +11 -0
  131. package/dist/runtime/composables/locales/asianAndPacific.js +296 -0
  132. package/dist/runtime/composables/locales/northernAndEasternEuropean.d.ts +12 -0
  133. package/dist/runtime/composables/locales/northernAndEasternEuropean.js +342 -0
  134. package/dist/runtime/composables/locales/westernEuropean.d.ts +10 -0
  135. package/dist/runtime/composables/locales/westernEuropean.js +268 -0
  136. package/dist/runtime/composables/locales.d.ts +4 -24
  137. package/dist/runtime/composables/locales.js +28 -895
  138. package/dist/runtime/composables/useDataProvider.js +3 -1
  139. package/dist/runtime/composables/useKatluxForm.js +7 -7
  140. package/dist/runtime/composables/usePresetComponent.js +2 -0
  141. package/dist/runtime/composables/useRequestQueue.d.ts +2 -0
  142. package/dist/runtime/composables/useRequestQueue.js +3 -1
  143. package/dist/runtime/composables/useVirtualDataset.d.ts +6 -118
  144. package/dist/runtime/composables/useVirtualDataset.js +322 -354
  145. package/dist/runtime/composables/useVirtualScroll.d.ts +9 -9
  146. package/dist/runtime/composables/useVirtualScroll.js +69 -62
  147. package/dist/runtime/composables/virtualDataset/cacheStateHelpers.d.ts +49 -0
  148. package/dist/runtime/composables/virtualDataset/cacheStateHelpers.js +76 -0
  149. package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.d.ts +26 -0
  150. package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.js +60 -0
  151. package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.d.ts +24 -0
  152. package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.js +103 -0
  153. package/dist/runtime/composables/virtualDataset/types.d.ts +113 -0
  154. package/dist/runtime/composables/virtualDataset/types.js +0 -0
  155. package/dist/runtime/directives/clickOutside.d.ts +1 -1
  156. package/dist/runtime/directives/clickOutside.js +41 -13
  157. package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -1
  158. package/dist/runtime/plugins/nuxtCompatPlugin.js +7 -0
  159. package/dist/runtime/plugins/toastPlugin.client.js +2 -2
  160. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +2 -0
  161. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +24 -0
  162. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +2 -0
  163. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +6 -5
  164. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
  165. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +27 -17
  166. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
  167. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -1
  168. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +10 -10
  169. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -1
  170. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.d.vue.ts +2 -0
  171. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +60 -21
  172. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +2 -0
  173. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +12 -1
  174. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +109 -15
  175. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +12 -1
  176. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +1 -1
  177. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +14 -0
  178. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +1 -1
  179. package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +5 -2
  180. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +15 -12
  181. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +5 -2
  182. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +10 -0
  183. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +23 -69
  184. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +10 -0
  185. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.d.vue.ts +6 -2
  186. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +22 -8
  187. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue.d.ts +6 -2
  188. package/dist/runtime/presets/default/components/KLayout/KLayout.vue +2 -2
  189. package/dist/runtime/presets/default/components/KLoader/KLoader.d.vue.ts +1 -0
  190. package/dist/runtime/presets/default/components/KLoader/KLoader.vue +13 -2
  191. package/dist/runtime/presets/default/components/KLoader/KLoader.vue.d.ts +1 -0
  192. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -94
  193. package/dist/runtime/presets/default/components/KMultiTabs/KMultiTabs.vue +69 -4
  194. package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +18 -46
  195. package/dist/runtime/presets/default/components/KSlider/KSlider.vue +11 -23
  196. package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
  197. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +24 -8
  198. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
  199. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +1 -1
  200. package/dist/runtime/presets/default/components/KTree/KTree.vue +51 -80
  201. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +1 -1
  202. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +1 -0
  203. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +12 -2
  204. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +1 -0
  205. package/dist/runtime/server/middleware/session.js +7 -0
  206. package/dist/runtime/utils/deprecation.d.ts +14 -0
  207. package/dist/runtime/utils/deprecation.js +44 -0
  208. package/dist/runtime/utils/dom.d.ts +31 -0
  209. package/dist/runtime/utils/dom.js +124 -0
  210. package/dist/skills/KATLUX_INDEX.md +15 -19
  211. package/dist/skills/katlux-components/components/KBulkActions.md +1 -1
  212. package/dist/skills/katlux-components/components/KDataIterator.md +5 -0
  213. package/dist/skills/katlux-components/components/KLayout.md +4 -0
  214. package/dist/skills/katlux-components/components/KLoader.md +3 -0
  215. package/dist/skills/katlux-components/components/KTextbox.md +1 -0
  216. package/dist/skills/katlux-config/SKILL.md +15 -7
  217. package/dist/skills/katlux-presets/SKILL.md +42 -2
  218. package/dist/skills/katlux-providers/SKILL.md +12 -0
  219. package/dist/skills/katlux-providers/providers/ADataProvider.md +1 -0
  220. package/dist/skills/katlux-providers/providers/CAPITreeServerDataProvider.md +13 -0
  221. package/dist/skills/katlux-providers/providers/RequestProvider.md +2 -2
  222. package/dist/skills/katlux-providers/providers/encryption-field-level.md +5 -2
  223. package/dist/skills/katlux-providers/providers/encryption-key-management.md +5 -2
  224. package/dist/skills/katlux-providers/providers/encryption-searchable.md +150 -27
  225. package/dist/skills/katlux-providers/providers/encryption-symmetric.md +4 -1
  226. package/dist/skills/katlux-providers/providers/encryption-threat-model.md +12 -6
  227. package/dist/skills/katlux-providers/providers/encryption.md +1 -1
  228. package/package.json +3 -3
@@ -0,0 +1,124 @@
1
+ import { unref } from "vue";
2
+ function collectVNodeElements(vnode, out) {
3
+ if (!vnode) return;
4
+ if (vnode.el && vnode.anchor && vnode.el.parentNode && vnode.el.parentNode === vnode.anchor.parentNode) {
5
+ let cur = vnode.el;
6
+ while (cur) {
7
+ if (cur.nodeType === 1) {
8
+ out.push(cur);
9
+ }
10
+ if (cur === vnode.anchor) break;
11
+ cur = cur.nextSibling;
12
+ }
13
+ return;
14
+ }
15
+ if (vnode.el && vnode.el.nodeType === 1) {
16
+ out.push(vnode.el);
17
+ return;
18
+ }
19
+ if (vnode.component?.subTree) {
20
+ collectVNodeElements(vnode.component.subTree, out);
21
+ return;
22
+ }
23
+ if (Array.isArray(vnode.children)) {
24
+ for (const child of vnode.children) {
25
+ if (child && typeof child === "object") {
26
+ collectVNodeElements(child, out);
27
+ }
28
+ }
29
+ }
30
+ }
31
+ export function resolveElements(target) {
32
+ const raw = unref(target);
33
+ if (!raw) return [];
34
+ if (Array.isArray(raw)) {
35
+ const collected = [];
36
+ for (const item of raw) {
37
+ collected.push(...resolveElements(item));
38
+ }
39
+ return collected;
40
+ }
41
+ if (typeof Element !== "undefined" && raw instanceof Element) {
42
+ return [raw];
43
+ }
44
+ if (typeof Node !== "undefined" && raw instanceof Node) {
45
+ return raw.nodeType === 1 ? [raw] : [];
46
+ }
47
+ if (typeof raw === "object") {
48
+ const obj = raw;
49
+ if (obj.$el) {
50
+ if (obj.$el.nodeType === 1) {
51
+ return [obj.$el];
52
+ }
53
+ if (obj.$?.subTree) {
54
+ const out = [];
55
+ collectVNodeElements(obj.$.subTree, out);
56
+ if (out.length > 0) return out;
57
+ }
58
+ }
59
+ if (obj.$?.subTree) {
60
+ const out = [];
61
+ collectVNodeElements(obj.$.subTree, out);
62
+ if (out.length > 0) return out;
63
+ }
64
+ }
65
+ return [];
66
+ }
67
+ export function resolveElement(target) {
68
+ const raw = unref(target);
69
+ if (!raw) return null;
70
+ if (typeof raw === "object" && typeof raw.getBoundingClientRect === "function" && !("$el" in raw)) {
71
+ return raw;
72
+ }
73
+ const elements = resolveElements(raw);
74
+ if (elements.length > 0) {
75
+ return elements[0];
76
+ }
77
+ return null;
78
+ }
79
+ export function focusTarget(target) {
80
+ const raw = unref(target);
81
+ if (!raw) return false;
82
+ const isDomNode = typeof Node !== "undefined" && raw instanceof Node;
83
+ if (!isDomNode && typeof raw.focus === "function") {
84
+ ;
85
+ raw.focus();
86
+ return true;
87
+ }
88
+ const elements = resolveElements(raw);
89
+ for (const el of elements) {
90
+ const focusableEl = el;
91
+ if (typeof focusableEl.focus === "function" && (focusableEl.matches?.('input, select, textarea, button, a[href], [tabindex]:not([tabindex="-1"])') || typeof focusableEl.tabIndex === "number" && focusableEl.tabIndex >= 0)) {
92
+ focusableEl.focus();
93
+ return true;
94
+ }
95
+ const nested = el.querySelector?.(
96
+ 'input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])'
97
+ );
98
+ if (nested && typeof nested.focus === "function") {
99
+ nested.focus();
100
+ return true;
101
+ }
102
+ }
103
+ if (elements.length > 0 && typeof elements[0].focus === "function") {
104
+ ;
105
+ elements[0].focus?.();
106
+ return true;
107
+ }
108
+ return false;
109
+ }
110
+ export function resolveModalTeleportTarget(explicitTeleportTo, modalPortalId) {
111
+ if (explicitTeleportTo) return explicitTeleportTo;
112
+ const resolvedId = unref(modalPortalId);
113
+ if (typeof resolvedId === "string" && resolvedId.length > 0) {
114
+ if (typeof document !== "undefined") {
115
+ if (document.getElementById(resolvedId)) {
116
+ const escapedId = typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(resolvedId) : resolvedId;
117
+ return `#${escapedId}`;
118
+ }
119
+ return "body";
120
+ }
121
+ return "body";
122
+ }
123
+ return "body";
124
+ }
@@ -6,22 +6,18 @@
6
6
 
7
7
  ## Katlux MCP Server (Recommended for AI Agents)
8
8
 
9
- When the **Katlux MCP Server** (`katlux` / `@katlux/mcp`) is configured in your agent environment, **always call MCP tools first** instead of loading full `SKILL.md` reference files. MCP tools return exact, atomic schemas on demand, saving up to ~93% context tokens and preventing hallucinations.
10
-
11
- | MCP Tool | Purpose & Usage | Token Advantage |
12
- | --- | --- | --- |
13
- | `katlux_inspect_project` | Fast read-only project introspection and bidirectional cross-stack map (Page ↔ Component ↔ Provider ↔ API Route ↔ Database/ORM ↔ Types/Services ↔ Styles/Tokens ↔ Tasks). Scopes: `overview`, `stats`, `components`, `providers`, `presets`, `types`, `sql`, `slice`. Call before running grep or reading multiple project files | ~200-500 tokens vs 20k+ reading multiple project files |
14
- | `katlux_get_component` | Exact API schema (props, slots, events, examples) for any component. Supports optional `filter: "keyword"` to return only matching props/events | ~100-300 tokens vs 28k in `katlux-components` |
15
- | `katlux_lookup_prop` | Ultra-compact atomic lookup for a single prop, event, or slot on a component (e.g. `component: 'KDatatable', prop: 'selectAllScope'`) | **~40 tokens** (ideal for micro-edits & single property checks) |
16
- | `katlux_list_components` | Discover components filtered by category (`form`, `data`, `layout`, `navigation`, `feedback`, `charts`, `ecommerce`) or search query | ~150 tokens vs reading entire docs |
17
- | `katlux_get_provider` | Data provider architecture, constructor options, caching, encryption, and recipes for `ADataProvider`, `CFlatClientDataProvider`, `CAPIFlatServerDataProvider` | ~400 tokens vs 15k in `katlux-providers` |
18
- | `katlux_get_encryption` | Cryptographic architectures, cipher provider APIs, E2EE recipes, field-level encryption, tenant key wrapping, blind search indexing, and security instructions | ~200-500 tokens vs 14k in encryption spec |
19
- | `katlux_list_icons` | Fuzzy search available SVG icons for `KIcon` and `icon` props | ~100 tokens vs guessing icon names |
20
- | `katlux_get_tokens` | CSS design tokens by category (`color`, `surface`, `border`, `typography`, `button`, `input`, `table`, `other`) | ~300 tokens vs 6k in `katlux-tokens` |
21
- | `katlux_scaffold` | Boilerplate code generator for common patterns (`datatable-page`, `form-with-validation`, `tree-explorer`, `chart-dashboard`) | Clean boilerplate with zero prompt bloat |
22
- | `katlux_validate_code` | Self-correction linter validating snippets (`code`) or workspace files (`filePath`) against component APIs, preset contracts, tokens, and deprecated symbols with line-numbered compact diagnostics | Catches errors before user sees them without token bloat |
23
- | `katlux_create_preset` | Scaffolds a new visual theme preset with directory structure and CSS token overrides | Automates theming setup |
24
- | `katlux_scaffold_preset_component` | Scaffolds an atomic component override inside a preset with exact typed internal contracts | ~250 tokens vs 8k reading canonical source |
9
+ When the **Katlux MCP Server** (`katlux` / `@katlux/mcp-core` host auto-discovering installed `@katlux/mcp-helper` and opt-in `@katlux/mcp-workflow` plugins) is configured in your agent environment, **always call MCP tools first** instead of loading full `SKILL.md` reference files. MCP tools return exact, atomic schemas on demand, saving up to ~93% context tokens and preventing hallucinations.
10
+
11
+ | MCP Tool | Provider Plugin | Purpose & Usage | Token Advantage |
12
+ | --- | --- | --- | --- |
13
+ | `katlux_inspect_project` | `@katlux/mcp-core` (+ enriches from active plugins) | Fast read-only project introspection and bidirectional cross-stack map. Core scopes: `overview`, `stats`, `components`, `types`, `sql`, `slice`, `diff`, `tests`. Helper plugin adds `providers` and `presets` when `@katlux/*` is detected | ~200-500 tokens vs 20k+ reading multiple project files |
14
+ | `katlux_batch` | `@katlux/mcp-core` | Executes multiple MCP tool calls across Core and active plugins in one round-trip | Eliminates redundant turns |
15
+ | `katlux_query` | `@katlux/mcp-helper` | Unified compact lookup (`component:Name`, `component:all`, `prop:Comp.prop`, `provider:Name`, `type:Name`, `token:cat`, `icon:kw`, `crypto:topic`) | ~40-400 tokens vs 28k in skill docs |
16
+ | `katlux_scaffold` | `@katlux/mcp-helper` | Generates clean Pug components, providers, pages, presets, or preset-component overrides | Clean boilerplate with zero prompt bloat |
17
+ | `katlux_validate_code` | `@katlux/mcp-helper` | Self-correction linter checking snippets or workspace files against component APIs, preset contracts, tokens, and deprecated symbols | Catches errors before user sees them |
18
+ | `katlux_workflow_init` | `@katlux/mcp-workflow` (opt-in) | Idempotently bootstraps `todo/tasks/`, `todo/archive/`, and `todo/INDEX.md` | Schema-safe workspace setup |
19
+ | `katlux_workflow_task` | `@katlux/mcp-workflow` (opt-in) | Schema-enforced `create`, `update`, `transition` (with close gate), and `archive` over `todo/` | Zero manual markdown corruption |
20
+ | `katlux_workflow_inspect` | `@katlux/mcp-workflow` (opt-in) | Compact `list` (ID + Title only, with `status`, `priority`, `milestone`, `relatedTask`, `component` filters & `sortBy: "priority"`), full single-task `get`, `archive` history, and `doctor` (`repair: true`) | Automated index & token-lean task discovery |
25
21
 
26
22
  ## Available Skills (Fallback & Deep Architectural Context)
27
23
 
@@ -37,9 +33,9 @@ If the Katlux MCP server is unavailable in the environment, or when deep archite
37
33
 
38
34
  ## How to Work Efficiently
39
35
 
40
- 1. **Project Introspection First**: Call `katlux_inspect_project` (`scope: 'slice'`, `'overview'`, `'presets'`, `'types'`, or `'sql'`) **before** running `grep` or reading multiple workspace files to understand how pages, components, providers, server API routes, database models, and types are wired in the consumer app.
41
- 2. **MCP Tools First**: Query `katlux_get_component` or `katlux_get_provider` to verify prop types, slots, and events before writing or editing code.
42
- 3. **Icon & Token Lookup**: Use `katlux_list_icons` to verify icon names and `katlux_get_tokens` for theme variables instead of guessing or hardcoding styles.
36
+ 1. **Project Introspection First**: Call `katlux_inspect_project` (`scope: 'slice'`, `'overview'`, `'stats'`, `'components'`, `'types'`, `'sql'`, `'diff'`, `'tests'`, `'providers'`, or `'presets'`) **before** running `grep` or reading multiple workspace files to understand how pages, components, providers, server API routes, database models, and types are wired in the consumer app.
37
+ 2. **MCP Tools First**: Query `katlux_query` (`component:Name`, `provider:Name`, `prop:Comp.Prop`, `type:Name`) to verify prop types, slots, and events before writing or editing code.
38
+ 3. **Icon & Token Lookup**: Use `katlux_query` (`icon:Name`, `token:Category`) to verify icon names and theme variables instead of guessing or hardcoding styles.
43
39
  4. **Self-Validation**: Run `katlux_validate_code` (via `code` snippet or workspace `filePath`) on newly generated or modified Vue/Pug templates, preset components, and stylesheets to self-correct issues with line-numbered diagnostics before delivering code.
44
40
  5. **Atomic Skills**: Component and Provider skills are divided into atomic, per-component and per-provider markdown files under `components/` and `providers/`. Read only the specific atomic spec required for your task to preserve tokens.
45
41
  6. **Never Inspect node_modules**: Never search or open files in `node_modules/@katlux/*` or `node_modules/`. All component APIs, props, slots, events, providers, and types are documented in Katlux MCP tools and atomic skill files.
@@ -11,7 +11,7 @@
11
11
  | `idKey` | `string` | `'id'` | Unique identifier field for row key extraction |
12
12
 
13
13
  - **Feature — Interchangeable Row & Bulk Actions & Rich Context**:
14
- `IKDatatableAction` definitions are interchangeable between row-level actions and bulk actions. When invoked via `KBulkActions`, the callback receives `(payload, selectAll, filter)` where `payload` is the array of applicable rows, augmented with context properties `isAllSelected`, `selectedRows`, `selectedRowKeys`, `unselectedRows`, `unselectedRowKeys`, and `filter`.
14
+ `IKDatatableAction` definitions are interchangeable between row-level actions and bulk actions (`:rowActions` vs. `:bulkActions` on `KDatatable`). For `visible` predicates inside `KBulkActions`, no extra action props are needed: `(rows, selectAll) => boolean` and array-only checks (`rows.length > 0`, `Array.isArray(rows)`, `rows.some(...)`) evaluate against the whole selection, while predicates accessing row fields (`row.status === 'active'`) filter `selectedRows` per-row via minification-safe `Array` Proxy detection. When invoked via `KBulkActions`, the callback receives `(payload, selectAll, filter)` where `payload` is the array of applicable rows, augmented with context properties `isAllSelected`, `selectedRows`, `selectedRowKeys`, `unselectedRows`, `unselectedRowKeys`, and `filter`.
15
15
 
16
16
  - **Architectural Principle — Client/Server Parity & Developer Responsibility**:
17
17
  Katlux components are simple, flexible, and free of arbitrary exceptions. Data providers behave identically whether running on client-side or server-side:
@@ -16,6 +16,9 @@
16
16
  | `v-model:unselectedRows` / `unselectedRows` | `Record<string, unknown>[]` | `[]` | Excluded row objects when `selectAll: true` in dataset scope |
17
17
  | `selectAllScope` | `'page' \| 'dataset'` | `'page'` | Scope for select-all toggle. Defaults to `'dataset'` when `virtualScroll: true` |
18
18
  | `v-model:filter` / `filter` | `IDataFilter \| null` | `undefined` | Active data provider filter with two-way sync |
19
+ | `v-model:layout` / `layout` | `'list' \| 'grid'` | `'list'` | Item layout mode with two-way sync |
20
+ | `v-model:columns` / `columns` | `number \| string` | `3` | Number of grid columns when `layout` is `'grid'` |
21
+ | `showLayoutToggle` | `boolean` | `false` | Renders built-in List / Grid layout switcher controls |
19
22
 
20
23
  - **Events / Emits**:
21
24
  | Event | Payload | Description |
@@ -28,6 +31,8 @@
28
31
  | `@update:selectAllScope`| `(scope: 'page' \| 'dataset')` | Emitted when selectAllScope changes |
29
32
  | `@update:unselectedRows`| `(rows: any[])` | Emitted when unselectedRows changes |
30
33
  | `@update:filter` | `(filter: IDataFilter \| null)` | Emitted when filter changes |
34
+ | `@update:layout` | `(layout: 'list' \| 'grid')` | Emitted when layout switches between `'list'` and `'grid'` |
35
+ | `@update:columns` | `(columns: number)` | Emitted when grid column count changes |
31
36
 
32
37
  - **Selection Contract & Filter Boundary**:
33
38
  - Bulk actions receive `(selectedRows, isAllSelected, filter)`. When `isAllSelected` is true, `selectedRows` is `[]`, and the developer is responsible for executing query-level operations using `filter` and `unselectedRows`.
@@ -1,5 +1,9 @@
1
1
  ### `KLayout`
2
2
  - **Purpose**: Unified, slot-driven top-level application layout container. Adapts automatically based on slot presence (`header`, `aside`, `main`, `footer`) and dynamically forwards all slots to preset implementations.
3
+ - **Props**:
4
+ | Prop | Type | Default | Description |
5
+ | --- | --- | --- | --- |
6
+ | `scrollMode` | `'window' \| 'container'` | `'window'` | Controls scrolling behavior. `'window'` uses normal document/window scrolling; `'container'` locks the layout to `100dvh` and scrolls `.KLayout__main` internally. |
3
7
  - **Slots**:
4
8
  | Slot | Scope | Description |
5
9
  | --- | --- | --- |
@@ -5,3 +5,6 @@
5
5
  | `loading` | `boolean` | `false` | `true`, `false` | Toggle visibility |
6
6
  | `overlay` | `boolean` | `false` | `true`, `false` | Cover parent container |
7
7
  | `size` | `string` | `'medium'` | `'small'`, `'medium'`, `'large'` | Spinner dimensions |
8
+ | `label` | `string` | `undefined` | Any string | Optional status text rendered below the spinner |
9
+ - **Slots**:
10
+ - `default`: Optional custom content rendered below the spinner (overrides `label` prop)
@@ -7,6 +7,7 @@
7
7
  | `type` | `string` | `'text'` | Input type (`text`, `password`, `email`, etc.) |
8
8
  | `placeholder` | `string` | `''` | Ghost text |
9
9
  | `showClear` | `boolean` | `false` | (**Textbox only**) Show clear icon |
10
+ | `loading` | `boolean` | `false` | (**Textbox only**) Display inline loading spinner inside the input |
10
11
  | `disabled` | `boolean` | `false` | Disable interactions |
11
12
  | `readonly` | `boolean` | `false` | Make input read-only |
12
13
  | `maxlength` | `number` | `undefined` | Character count limit |
@@ -69,6 +69,11 @@ export default defineAppConfig({
69
69
  // Priority order: Dark overrides Modern, which overrides Default fallback
70
70
  activePreset: ['dark', 'modern'],
71
71
  },
72
+ katluxProviders: {
73
+ // Project-level default locale for all ADataProvider instances (Tier 2 in locale resolution)
74
+ // Precedence: instance option/runtime -> app.config.ts / global config -> $i18n.locale -> undefined
75
+ locale: 'en-US',
76
+ },
72
77
  })
73
78
  ```
74
79
 
@@ -115,13 +120,15 @@ export default defineAppConfig({
115
120
 
116
121
  | Package Name | Current Version | Description | Installation Command |
117
122
  | --- | --- | --- | --- |
118
- | `@katlux/toolkit` | `0.1.1-alpha.145` | Core Nuxt module, UI toolkit, presets, and components | `npm install @katlux/toolkit@alpha` |
119
- | `@katlux/providers` | `0.1.1-alpha.132` | Core data providers, client caching, and state structures | `npm install @katlux/providers@alpha` |
120
- | `@katlux/preset-modern` | `0.1.1-alpha.119` | Modern design preset and styling variables | `npm install @katlux/preset-modern@alpha` |
121
- | `@katlux/preset-dark` | `0.1.1-alpha.50` | Sleek Dark Mode design preset | `npm install @katlux/preset-dark@alpha` |
122
- | `@katlux/block-charts` | `0.1.1-alpha.119` | Pre-built charting block components | `npm install @katlux/block-charts@alpha` |
123
- | `@katlux/block-ecommerce` | `0.1.1-alpha.119` | Pre-built eCommerce block components | `npm install @katlux/block-ecommerce@alpha` |
124
- | `@katlux/mcp` | `0.1.0-alpha.24` | Model Context Protocol server for AI assistant integration | `npm install @katlux/mcp@alpha` |
123
+ | `@katlux/toolkit` | `0.1.1-alpha.147` | Core Nuxt module, UI toolkit, presets, and components | `npm install @katlux/toolkit@alpha` |
124
+ | `@katlux/providers` | `0.1.1-alpha.134` | Core data providers, client caching, and state structures | `npm install @katlux/providers@alpha` |
125
+ | `@katlux/preset-modern` | `0.1.1-alpha.121` | Modern design preset and styling variables | `npm install @katlux/preset-modern@alpha` |
126
+ | `@katlux/preset-dark` | `0.1.1-alpha.52` | Sleek Dark Mode design preset | `npm install @katlux/preset-dark@alpha` |
127
+ | `@katlux/block-charts` | `0.1.1-alpha.121` | Pre-built charting block components | `npm install @katlux/block-charts@alpha` |
128
+ | `@katlux/block-ecommerce` | `0.1.1-alpha.121` | Pre-built eCommerce block components | `npm install @katlux/block-ecommerce@alpha` |
129
+ | `@katlux/mcp-core` | `0.1.0-alpha.26` | Katlux-agnostic MCP server host, plugin auto-discovery loader, `katlux_batch`, and workspace introspection | `npm install -D @katlux/mcp-core@alpha` |
130
+ | `@katlux/mcp-helper` | `0.1.0-alpha.26` | Katlux UI & DataProvider MCP plugin (automatically depends on `@katlux/mcp-core`) | `npm install -D @katlux/mcp-helper@alpha` |
131
+ | `@katlux/mcp-workflow` | `0.1.0-alpha.26` | Optional Katlux-agnostic AI `todo/` task & workflow plugin for `@katlux/mcp-core` | `npm install -D @katlux/mcp-workflow@alpha` |
125
132
 
126
133
  > [!NOTE]
127
134
  > Katlux packages are currently published under the `@alpha` tag on NPM. Always append `@alpha` or the specific version tag when adding dependencies.
@@ -162,6 +169,7 @@ The repository enforces three distinct typecheck scopes to guarantee type safety
162
169
  | :--- | :--- | :--- | :--- |
163
170
  | **Root (Packages & Tests)** | `npm run typecheck` | `vue-tsc --noEmit` | Validates all packages (`packages/**`) and integration tests (`tests/**`), excluding `apps/**`. |
164
171
  | **Strict Providers Package** | `npm run typecheck:providers` | `tsc -p packages/katlux-providers/tsconfig.json --noEmit` | Strict mode check on `@katlux/providers` source and unit specs. |
172
+ | **MCP Packages Suite** | `npm run typecheck:mcp` | `tsc` across `katlux-mcp-core`, `katlux-mcp-helper`, `katlux-mcp-workflow` | Strict mode check on the 3-package MCP suite and specs. |
165
173
  | **Showcase Application** | `npm run typecheck:showcase` | `npx nuxi prepare apps/showcase && vue-tsc --noEmit -p apps/showcase/tsconfig.json` | Validates the showcase Nuxt app including layouts, pages, and components using generated `.nuxt` types. |
166
174
  | **Complete Monorepo Suite** | `npm run typecheck:all` | Runs all three scopes sequentially | Enforced in GitHub Actions CI (`.github/workflows/ci.yml`) on every push and PR. |
167
175
 
@@ -9,6 +9,18 @@ Katlux uses a unified **preset** system to allow full visual customization witho
9
9
 
10
10
  - [Step-by-step: Creating a Preset from Scratch](creating-a-preset.md)
11
11
 
12
+ ## Project-Level Configuration
13
+
14
+ Preset selection and available presets are registered in the global `app.config.ts` under `katluxToolkit` (see [katlux-config](../katlux-config/SKILL.md#appconfigts)):
15
+
16
+ ```typescript
17
+ // app.config.ts
18
+ katluxToolkit: {
19
+ presetList: [{ name: 'Default', value: 'default' }],
20
+ activePreset: 'default', // Single preset string or priority array ['dark', 'modern']
21
+ }
22
+ ```
23
+
12
24
  ## Unified Preset Architecture
13
25
 
14
26
  > [!IMPORTANT]
@@ -33,10 +45,11 @@ npx @katlux/toolkit create-preset cyber-brand --base=modern
33
45
  npx @katlux/toolkit create-preset cyber-brand
34
46
  ```
35
47
 
36
- ### Option B: Model Context Protocol (MCP) Tool (`katlux_create_preset`)
48
+ ### Option B: Model Context Protocol (MCP) Tool (`katlux_scaffold`)
37
49
  ```json
38
- // Call katlux_create_preset tool on @katlux/mcp server:
50
+ // Call katlux_scaffold tool on katlux MCP server:
39
51
  {
52
+ "kind": "preset",
40
53
  "name": "cyber-brand",
41
54
  "base": "modern"
42
55
  }
@@ -476,3 +489,30 @@ const { metadata, isCustomTemplate, templateName, refreshTemplate } = useTemplat
476
489
  })
477
490
  ```
478
491
 
492
+ ---
493
+
494
+ ## Preset DOM & Component Integration Contracts
495
+
496
+ Custom preset components (`.vue`) are free to use any HTML structure, custom element tags, Tailwind/utility classes, or multi-root fragments without keeping default CSS classes (e.g., `.modal-portal`, `.KCalendarMonth`, `.KTextbox`). To integrate cleanly with `@katlux/toolkit` logic layers (`*.logic.ts`) and form helpers (`useKatluxForm`), custom presets should observe the following component contracts:
497
+
498
+ ### 1. Imperative Focus Exposure (`defineExpose({ focus })`)
499
+ - **`KTextbox` / `KCombobox`**: Expose `focus()` via `defineExpose({ focus })` on preset templates so parent components (such as `KComboboxList` focusing its filter `KTextbox`) and `useKatluxForm` (`focusTarget()`) can move focus without querying internal `<input>` elements or relying on single-root `.$el`.
500
+ - When a custom preset does not expose `focus()`, `focusTarget()` falls back safely across single-root and multi-root fragment DOM nodes.
501
+
502
+ ### 2. Modal Teleport Host (`KModal` & `modalId`)
503
+ - **`KModal`** injects/provides a unique `modalPortalId` string to descendants and passes `modalId` as a prop to its preset template.
504
+ - Render an element with `:id="modalId"` (no `.modal-portal` CSS class required) inside custom `KModal` templates so nested overlays (`KDropdown`, `KContextMenu`) teleport inside the modal's top-layer `<dialog>` stacking context.
505
+ - If a custom `KModal` omits an element with `id === modalId`, `resolveModalTeleportTarget()` automatically falls back to `'body'` rather than mounting into a missing selector.
506
+
507
+ ### 3. Overlay Geometry & Event Fallbacks (`KDropdown`, `KContextMenu`, `KTooltip`)
508
+ - **`KDropdown` (`anchorEl`)** & **`KContextMenu` (`target`)**: Accept a raw `Element`, `Ref`, or Vue `ComponentPublicInstance` (single-root or multi-root fragment); `resolveElement()` / `resolveElements()` unwraps all roots cleanly and guards missing elements or SSR environments (`typeof document === 'undefined'`).
509
+ - **`KContextMenu`**: Bind `@contextmenu="onContextMenu"` in custom presets directly (emitting `registerSourceRef` is optional). Intentional dismissals (`closeMenu()`) increment the reactive `focusRequestId` prop so presets restore focus without inspecting `document.activeElement` containment on outside clicks.
510
+ - **`KTooltip`**: Bind `@mouseenter="showTooltip($event)"` / `@mouseleave="hideTooltip"` in custom presets; omitting `registerWrapperRef` falls back safely to `event.currentTarget`.
511
+
512
+ ### 4. Reactive Composite & Input Controls (`KCalendarMonth`, `KGantt`, `KTree`, `KMaskTextbox`, `KSlider`, `KRangeSlider`)
513
+ - **`KCalendarMonth`**: `KCalendarMonth.logic.ts` updates reactive `focusedDay` and increments `focusRequestId` on arrow key navigation without querying DOM nodes; presets watch `focusRequestId` to focus their own day elements across any table/grid nesting.
514
+ - **`KGantt` (`KGanttTimeline`)**: `KGanttTimeline` emits `@timeline-panstart` on cell mousedown (with `.stop` on task bars), passes `wrapperWidth` as a number in `@task-dragstart`, and passes the click event in `@task-click`, eliminating `.closest()` DOM queries and capture-phase DOM click listeners in `KGantt`.
515
+ - **`KTree` (`KTreeNodeItem`)**: `KTree` increments reactive `focusRequestId` and passes it to `KTreeNodeItem` (which focuses its own node ref when `isFocused` is true) instead of querying `.tree-node[data-node-id="..."]`.
516
+ - **`KMaskTextbox`, `KSlider`, `KRangeSlider`**: `KMaskTextbox.logic.ts` validates date/time pattern segments (`DD`, `MM`, `HH`, `mm`, `ss`) purely on string values without `@beforeinput` / `HTMLInputElement` inspection; `KSlider` and `KRangeSlider` use `v-model.number` computed bindings without `HTMLElement` track-click or `HTMLInputElement` casts.
517
+
518
+
@@ -7,6 +7,17 @@ description: Complete reference and atomic index for Katlux data management arch
7
7
 
8
8
  > **Atomic Architecture**: Data providers and architectural subsystems are divided into atomic, focused specification files under [`providers/`](providers/). To minimize token consumption and avoid context bloat, read **only** the atomic provider file needed for your task.
9
9
 
10
+ ## Project-Level Configuration
11
+
12
+ Provider defaults are registered in the global `app.config.ts` under `katluxProviders` (see [katlux-config](../katlux-config/SKILL.md#appconfigts)) or programmatically via `setGlobalDataProviderConfig({ locale })`:
13
+
14
+ ```typescript
15
+ // app.config.ts
16
+ katluxProviders: {
17
+ locale: 'en-US', // Tier 2 fallback: instance locale -> project config -> $i18n.locale -> undefined
18
+ }
19
+ ```
20
+
10
21
  ---
11
22
 
12
23
  ## 1. Core Architecture & Base Engine
@@ -39,6 +50,7 @@ description: Complete reference and atomic index for Katlux data management arch
39
50
  | `CAPIFlatServerDataProvider` | Remote HTTP REST flat server provider | Offloads pagination, sorting, and filter AST to backend endpoints via HTTP GET/POST | [CAPIFlatServerDataProvider.md](providers/CAPIFlatServerDataProvider.md) |
40
51
  | `CFlatServerDataProvider` | Base remote server data provider | Generic server provider extensible for custom network layers (GraphQL, gRPC, RPC) | [CFlatServerDataProvider.md](providers/CFlatServerDataProvider.md) |
41
52
  | `CTreeServerDataProvider` | Remote hierarchical tree server provider | Server-side lazy loading of child tree nodes and sub-branches | [CTreeServerDataProvider.md](providers/CTreeServerDataProvider.md) |
53
+ | `CAPITreeServerDataProvider` | Remote HTTP REST hierarchical tree server provider | Extends `CTreeServerDataProvider` with `RequestProvider` (API URL, caching, deduplication, `expandedNodes` query serialization) | [CAPITreeServerDataProvider.md](providers/CAPITreeServerDataProvider.md) |
42
54
  | API Communication Protocol | Standard query params & filter JSON AST | Specification for backend developers to implement Katlux-compatible endpoints | [api-protocol.md](providers/api-protocol.md) |
43
55
  | Provider Testing Isolation | Test patterns & `nuxtAppCompat` | Safe unit testing of server providers without full Nuxt runtime overhead | [testing-isolation.md](providers/testing-isolation.md) |
44
56
 
@@ -22,6 +22,7 @@
22
22
  | `cacheLifetime` | `number` | `undefined` | Cache expiration in milliseconds |
23
23
  | `filterDebounce` | `number` | `300` | Debounce time in ms for `setFilter` |
24
24
  | `sortDebounce` | `number` | `200` | Debounce time in ms for `setSortList` |
25
+ | `locale` | `string` | `undefined` | BCP 47 locale tag for `Intl.Collator` string sorting (numeric collation enabled) |
25
26
  | `context` | `Record<string, unknown>` | `undefined` | Framework-agnostic SSR context (React SSR state, Next.js context, or Nuxt app instance) |
26
27
  | `nuxtApp` | `unknown` | `undefined` | *(Deprecated, use `context`)* Nuxt app instance for backward compatibility |
27
28
  | `refreshOnMutation` | `boolean` | `true` | Reload data after `create`/`update`/`delete` |
@@ -0,0 +1,13 @@
1
+ ### `CAPITreeServerDataProvider`
2
+ API-based Server-side Tree Data Provider extending `CTreeServerDataProvider` and implementing `AAPIDataProvider`.
3
+ - **Purpose**: Connects server-side tree logic with `RequestProvider` for remote HTTP endpoints expecting node expansion queries (`expandedNodes`).
4
+ - **Features**: API URL configuration (`setAPIUrl(url)`), request caching/deduplication, stale response discarding, and field-level/payload encryption (`setEncryption()`, `clearEncryption()`).
5
+
6
+ ```typescript
7
+ const provider = new CAPITreeServerDataProvider({
8
+ cacheStrategy: ECacheStrategy.Memory,
9
+ cacheLifetime: 30000
10
+ })
11
+ provider.setAPIUrl('/api/v1/taxonomy')
12
+ ```
13
+
@@ -40,10 +40,10 @@ The core engine for all HTTP communication, supporting deduplication, tag-based
40
40
  | `_generation` | `number` | Internal request generation counter to discard stale responses |
41
41
 
42
42
  - **Static Context Resolution & Multi-Subscriber Abort Bridge**:
43
- - `RequestProvider.setContextResolver(fn)`: Pluggable resolver returning `{ event }` for SSR environments (e.g. Nuxt `useRequestEvent()`).
43
+ - `RequestProvider.setContextResolver(fn)`: Pluggable resolver returning `{ event, headers }` for SSR environments (e.g. Nuxt `useRequestEvent()` and `useRequestHeaders(['cookie'])`).
44
44
  - **Multi-Subscriber Abort Bridge**: Concurrent GET requests joining an in-flight deduplication promise register independent subscriber listeners. The underlying network request is only aborted when **all** active subscribers have aborted their signals.
45
45
  - **Offline Queue Binary Encryption**: When `encryption.enabled = true` and `encryption.encryptBinary = true`, binary payloads (`FormData`, `Blob`, `File`, `ArrayBuffer`) are encrypted into ciphertext envelopes before persistence into IndexedDB, and transparently decrypted on flush.
46
- - **SSR Cache & Tenant Isolation**: On SSR (`isServer`), when request context is uncontextualized (`!event`) and per-tenant encryption key ID is missing, shared server cache reads and writes are automatically bypassed to prevent cross-tenant data leaks. A developer warning is logged if relative same-origin requests lack event context to forward Cookies.
46
+ - **SSR Cache & Tenant Isolation**: On SSR (`isServer`), when request context is uncontextualized (`!event`) and per-tenant encryption key ID is missing, shared server cache reads and writes are automatically bypassed to prevent cross-tenant data leaks. When inside a Nuxt SSR context, cookies are automatically forwarded on same-origin requests via `event` or `useRequestHeaders(['cookie'])`. A developer warning is logged only if relative same-origin requests lack both event context and Nuxt request headers to forward cookies.
47
47
 
48
48
  ### `RequestProviderRegistry`
49
49
  Framework-agnostic static registry mapping active `RequestProvider` instances to tag arrays. When mutations complete (or offline queues flush), `RequestProviderRegistry` automatically triggers `refresh(true)` on all matching registered GET providers.
@@ -86,9 +86,12 @@ Enables fast exact match (`==`, `!=`) and substring search (`in`) over encrypted
86
86
 
87
87
  ### Ingestion Pipeline
88
88
  1. **Normalization**: Normalize plaintext (`NFKC` + lowercase).
89
- 2. **Blind Index Token**: Generate exact blind index token via `CKeyManager.computeBlindIndex(plain, hmacKey)`.
89
+ 2. **Blind Index Token**: Generate exact blind index token via `CKeyManager.computeBlindIndex(plain, hmacKey)` (deriving string `hmacKey` material via `CKeyManager.deriveBlindIndexHmacKey(keyMaterial, { kdfIterations })`, defaulting to `310,000` PBKDF2 iterations).
90
90
  3. **Trigram Slices**: Extract 3-character slices via `extractTrigrams(plain)` and hash each trigram with `searchIndex.computeTrigramTokens(plain)`.
91
91
 
92
+ > [!WARNING]
93
+ > **Cloud / Edge Runtime PBKDF2 Cap (`kdfIterations: 100_000`)**: `CKeyManager.deriveBlindIndexHmacKey`, `CSearchIndex`, and `IProviderEncryptionOptions` default to `310,000` PBKDF2 iterations for browser E2EE. When deriving blind-index HMAC keys from string passphrases in serverless/edge environments (e.g., **Cloudflare Workers** `workerd`, which caps WebCrypto PBKDF2 at `100,000` iterations and throws `NotSupportedError` above that), explicitly configure `kdfIterations: 100_000` on `CSearchIndex`, `CKeyManager.deriveBlindIndexHmacKey`, or `IProviderEncryptionOptions` (or pass a pre-imported `CryptoKey` / `Uint8Array`). Ensure client and server share the same `kdfIterations` value if tokens are compared across boundaries.
94
+
92
95
  ### Client Filtering & Sorting on Encrypted Envelopes (`decryptedCache` & Sort Guards)
93
96
  In client-side data providers (`CFlatClientDataProvider` and `CTreeClientDataProvider`), data records in `allData` remain encrypted at rest as ciphertext envelopes (`{ __encrypted: true, ciphertext, iv }`).
94
97
 
@@ -292,7 +295,7 @@ Selecting an appropriate cryptographic representation for data fields requires b
292
295
  | **Standard AES-256-GCM Envelope Encryption** | Highly sensitive PII, passwords, private keys, medical notes, credit card CVVs, rich text payloads (e.g. `medical_notes`, `api_secret`, `cvv`) | High or Low | None (direct ciphertext storage only; decrypted in client memory or authorized application layer) | Zero index leakage. Randomized IV/nonce ensures identical plaintexts yield completely different ciphertexts. Immune to frequency analysis. | **Gold standard for confidential data**. Use whenever fields do not require server-side filtering, searching, or indexing. |
293
296
  | **Blind Index Equality Token (HMAC-SHA256)** | High-entropy unique / semi-unique identifiers: `email`, `ssn`, `tax_id`, `phone_number`, `national_id`, `uuid` | **High Entropy Only** | Exact match (`==`, `!=`, `IN`, `NOT IN`) via B-Tree index on `*_bidx` column | Deterministic token preserves equality and frequency distributions. Duplicates and recurring values are observable. | **Use strictly for exact lookups of high-entropy identifiers**. Always use a dedicated HMAC key separated from the DEK. Never apply to low-cardinality fields. |
294
297
  | **Trigram Substring Search** | Long, high-entropy textual strings requiring substring/contains queries: `full_name`, `address_line`, `company_name` | **High to Medium Entropy** | Substring / Contains search via GIN inverted index (`@>` array containment) on `*_trigrams` | Leaks approximate string length and character co-occurrence frequencies. | **Use with caution on high-entropy text**. Enforce 3+ character minimum query length in client UI. Do not apply to small discrete enum sets. |
295
- | **Shadow Bucketing / Range Tokens (RFC-001 / TASK-031)** | Numeric ranges, dates, monetary amounts, age groups, salaries (e.g. `salary_bucket`, `created_date_bucket`, `credit_score_range`) | Low to Medium | Range queries (`>`, `<`, `>=`, `<=`, `BETWEEN`) on discretized bucket values | Coarse range leakage. Reveals which discrete bucket (e.g. `$50k-$75k`, `2026-Q1`) a record falls into. | **Recommended when range search is strictly necessary**. Tune bucket granularity to balance query precision against distribution leakage. |
298
+ | **Deterministic Shadow-Bucket Range Index (`RFC-001` / `TASK-031` / `DEBT-042`)** | Coarse dates (`created_at` by year/quarter), non-PII metrics, or broad compliant financial bands | Low to Medium | Range queries (`>`, `<`, `>=`, `<=`, `BETWEEN`) on discretized bucket tokens | **Not zero-leakage.** Reveals value frequency distributions, bucket order relations, and empirical distribution profiles. | **DO NOT USE narrow buckets on high-sensitivity PII** (`salary`, `age`, `birthDate`, `creditScore`). Leave sensitive attributes unindexed (`AES-256-GCM`) or restrict strictly to broad tiers (`$25,000+` salary bands, `'year'` dates); enforce minimum width (`ERR_BUCKET_STEP_TOO_NARROW`). |
296
299
 
297
300
  ### Low-Cardinality Column Warning & Frequency Analysis Attacks
298
301
  > [!CAUTION]
@@ -110,6 +110,9 @@ const authKey = derived.authKey
110
110
  const dataKey = derived.encryptionKey
111
111
  ```
112
112
 
113
+ > [!WARNING]
114
+ > **Edge / Serverless PBKDF2 Ceiling (`100,000` on Cloudflare Workers)**: Both `deriveAuthAndEncryptionKeys` and `deriveBlindIndexHmacKey` default to `310,000` PBKDF2 iterations for browser E2EE. On serverless/edge runtimes such as Cloudflare Workers (`workerd`), WebCrypto `crypto.subtle` caps PBKDF2 at `100,000` iterations and throws `NotSupportedError` above `100,000`. Pass `{ iterations: 100_000 }` / `{ kdfIterations: 100_000 }` when deriving keys on edge servers.
115
+
113
116
  ---
114
117
 
115
118
  ## 5. Master Passphrase Re-Keying & Keypair Lifecycle (`rekeyUserKeypair`)
@@ -205,8 +208,8 @@ const summary = await reencryptDataset({
205
208
  - **Blind Index Synchronization**: Simultaneously generates fresh blind index tokens using `computeWriteBlindIndex` from the active HMAC key and updates `<field>_bidx`.
206
209
  - **Bounded Memory & Resumability**: Cursor pagination guarantees flat memory footprint even over millions of rows. Supports `AbortSignal` for graceful pause and resume from `lastProcessedCursor`.
207
210
  - **Dry-Run Mode (`dryRun: true`)**: Validates key availability, decodes headers, and simulates re-encryption without invoking `updateRow`.
208
- - **Resilient Error Strategies (`onRowError`)**: Configure `'abort'` (default), `'skip'`, or `'record'`. In `'skip'` and `'record'` modes, decryption failures on corrupted rows are collected into `failedRows: Array<{ id, field, error }>` without terminating batch processing.
209
- - **Native Provider AAD Protocol Alignment**: Automatically reconstructs Katlux provider field envelopes (`aad:<base>|record:<id>|ctx:<fields>|field:<name>`) with lexicographically sorted `aadFields`, allowing migration without manual `buildAad` callback glue. Automatically retries with `aad: undefined` for legacy unbound envelopes.
211
+ - **Resilient Error Strategies (`onRowError` / `abortOnError`)**: `reencryptDataset` defaults `onRowError` to `'record'` so corrupted rows are logged and collected into `failedRows` / `failedRowIds` without halting batch processing (pass `abortOnError: true` or `onRowError: 'abort'` for fail-fast semantics; `reencryptBatch` defaults to `'abort'` unless `onRowError` or `abortOnError: false` is set).
212
+ - **Native Provider AAD Protocol Alignment**: Automatically reconstructs Katlux provider field envelopes (`aad:<base>|record:<id>|ctx:<fields>|field:<name>`) using `getRowId` or standard primary key fallbacks (`id`, `_id`, `uuid`, `key`) with lexicographically sorted `aadFields`, allowing migration without manual `buildAad` callback glue. Automatically retries with `aad: undefined` for legacy unbound envelopes.
210
213
  - **Blind Index & Trigram Synchronization**: Simultaneously generates fresh blind index tokens (`computeWriteBlindIndex`) and trigram substring search token arrays (`trigramFields?: string[]`, `<field>_trigrams`) from the active HMAC key in `blindIndexKeyring`.
211
214
  - **Standard PBKDF2 / HKDF Derivation for Passphrases**: When string passphrases are provided in the keyring, keys are derived using PBKDF2 (310,000 iterations with cryptographic salt) matching provider standards, and newly re-encrypted envelopes retain valid KDF metadata (`kdf: 'pbkdf2'`, `iter: 310000`, `salt`). Legacy unsalted envelopes (`kdf: 'none'`) are smoothly decrypted and upgraded.
212
215
  - **KDF DoS & Iteration Guards**: Enforces `maxAllowedIterations` (default 350,000 ceiling) to prevent iteration amplification attacks from modified envelopes.