@katlux/toolkit 0.1.1-alpha.145 → 0.1.1-alpha.147

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 (298) hide show
  1. package/README.md +32 -22
  2. package/bin/ai-init.mjs +575 -0
  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 -872
  13. package/bin/cli.mjs +81 -48
  14. package/bin/create-preset.mjs +1 -0
  15. package/bin/preset-contracts.json +2997 -0
  16. package/dist/compiled/composables/locales/asianAndPacific.mjs +296 -0
  17. package/dist/compiled/composables/locales/northernAndEasternEuropean.mjs +342 -0
  18. package/dist/compiled/composables/locales/westernEuropean.mjs +268 -0
  19. package/dist/compiled/composables/locales.mjs +32 -720
  20. package/dist/compiled/composables/useDataProvider.mjs +39 -26
  21. package/dist/compiled/composables/useFilterLogic.mjs +10 -2
  22. package/dist/compiled/composables/useKatluxForm.mjs +13 -11
  23. package/dist/compiled/composables/usePresetComponent.mjs +2 -0
  24. package/dist/compiled/composables/useRequestQueue.mjs +3 -1
  25. package/dist/compiled/composables/useVirtualDataset.mjs +657 -0
  26. package/dist/compiled/composables/useVirtualScroll.mjs +93 -66
  27. package/dist/compiled/composables/virtualDataset/cacheStateHelpers.mjs +76 -0
  28. package/dist/compiled/composables/virtualDataset/keyboardNavHelpers.mjs +60 -0
  29. package/dist/compiled/composables/virtualDataset/treeSelectionHelpers.mjs +103 -0
  30. package/dist/compiled/composables/virtualDataset/types.mjs +0 -0
  31. package/dist/compiled/utils/deprecation.mjs +44 -0
  32. package/dist/compiled/utils/dom.mjs +124 -0
  33. package/dist/module.cjs +58 -77
  34. package/dist/module.d.cts +5 -0
  35. package/dist/module.d.mts +4 -1
  36. package/dist/module.json +1 -1
  37. package/dist/module.mjs +54 -77
  38. package/dist/runtime/app.config.d.ts +3 -0
  39. package/dist/runtime/components/KAccordion/KAccordion.global.d.vue.ts +1 -1
  40. package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +1 -1
  41. package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +7 -3
  42. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
  43. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
  44. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +12 -2
  45. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +40 -41
  46. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  47. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  48. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  49. package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +19 -10
  50. package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
  51. package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
  52. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
  53. package/dist/runtime/components/KCalendar/KCalendar.logic.js +67 -14
  54. package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
  55. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +15 -1
  56. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
  57. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +21 -3
  58. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +136 -7
  59. package/dist/runtime/components/KCalendar/recurringUtils.js +6 -5
  60. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
  61. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
  62. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +18 -3
  63. package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -4
  64. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +18 -3
  65. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +16 -2
  66. package/dist/runtime/components/KCombobox/KCombobox.logic.js +32 -13
  67. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +8 -8
  68. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +8 -8
  69. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
  70. package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +3 -3
  71. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue +4 -1
  72. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +3 -3
  73. package/dist/runtime/components/KContextMenu/KContextMenu.logic.d.ts +24 -4
  74. package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +43 -22
  75. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +38 -11
  76. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +39 -20
  77. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +38 -11
  78. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +31 -8
  79. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +69 -24
  80. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +10 -14
  81. package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
  82. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +10 -14
  83. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
  84. package/dist/runtime/components/KDatatable/KDatatable.logic.js +32 -24
  85. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +33 -15
  86. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +60 -16
  87. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +33 -15
  88. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +30 -6
  89. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +249 -59
  90. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
  91. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
  92. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -0
  93. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +4 -4
  94. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +4 -4
  95. package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +3 -2
  96. package/dist/runtime/components/KDropdown/KDropdown.logic.js +14 -13
  97. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +55 -4
  98. package/dist/runtime/components/KGantt/KGantt.global.vue +18 -3
  99. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -4
  100. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
  101. package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
  102. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
  103. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
  104. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
  105. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
  106. package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
  107. package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
  108. package/dist/runtime/components/KLayout/KLayout.global.d.vue.ts +4 -1
  109. package/dist/runtime/components/KLayout/KLayout.global.vue +4 -1
  110. package/dist/runtime/components/KLayout/KLayout.global.vue.d.ts +4 -1
  111. package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +9 -0
  112. package/dist/runtime/components/KLoader/KLoader.global.vue +3 -0
  113. package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +9 -0
  114. package/dist/runtime/components/KLoader/KLoader.logic.d.ts +5 -0
  115. package/dist/runtime/components/KLoader/KLoader.logic.js +4 -0
  116. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +2 -2
  117. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
  118. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +30 -7
  119. package/dist/runtime/components/KMultiTabs/KMultiTabs.logic.d.ts +1 -0
  120. package/dist/runtime/components/KMultiTabs/MultiTabs.global.d.vue.ts +23 -0
  121. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +24 -0
  122. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
  123. package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +3 -1
  124. package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
  125. package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +3 -1
  126. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
  127. package/dist/runtime/components/KPagination/KPagination.logic.js +74 -14
  128. package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
  129. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
  130. package/dist/runtime/components/KTabs/KTabs.logic.js +33 -11
  131. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
  132. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
  133. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +15 -4
  134. package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
  135. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +15 -4
  136. package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +5 -0
  137. package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -0
  138. package/dist/runtime/components/KTooltip/KTooltip.logic.d.ts +11 -2
  139. package/dist/runtime/components/KTooltip/KTooltip.logic.js +7 -5
  140. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +4 -4
  141. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +4 -4
  142. package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
  143. package/dist/runtime/components/KTree/KTree.logic.js +37 -13
  144. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +7 -5
  145. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +4 -6
  146. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +7 -5
  147. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -2
  148. package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +10 -1
  149. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +40 -6
  150. package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
  151. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +40 -6
  152. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +24 -4
  153. package/dist/runtime/components/KTreeView/KTreeView.logic.js +105 -11
  154. package/dist/runtime/composables/locales/asianAndPacific.d.ts +11 -0
  155. package/dist/runtime/composables/locales/asianAndPacific.js +296 -0
  156. package/dist/runtime/composables/locales/northernAndEasternEuropean.d.ts +12 -0
  157. package/dist/runtime/composables/locales/northernAndEasternEuropean.js +342 -0
  158. package/dist/runtime/composables/locales/westernEuropean.d.ts +10 -0
  159. package/dist/runtime/composables/locales/westernEuropean.js +268 -0
  160. package/dist/runtime/composables/locales.d.ts +4 -24
  161. package/dist/runtime/composables/locales.js +32 -720
  162. package/dist/runtime/composables/useDataProvider.d.ts +5 -3
  163. package/dist/runtime/composables/useDataProvider.js +39 -26
  164. package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
  165. package/dist/runtime/composables/useFilterLogic.js +10 -2
  166. package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
  167. package/dist/runtime/composables/useKatluxForm.js +13 -11
  168. package/dist/runtime/composables/usePresetComponent.js +2 -0
  169. package/dist/runtime/composables/useRequestQueue.d.ts +2 -0
  170. package/dist/runtime/composables/useRequestQueue.js +3 -1
  171. package/dist/runtime/composables/useSortLogic.d.ts +1 -1
  172. package/dist/runtime/composables/useVirtualDataset.d.ts +9 -0
  173. package/dist/runtime/composables/useVirtualDataset.js +657 -0
  174. package/dist/runtime/composables/useVirtualScroll.d.ts +14 -10
  175. package/dist/runtime/composables/useVirtualScroll.js +93 -66
  176. package/dist/runtime/composables/virtualDataset/cacheStateHelpers.d.ts +49 -0
  177. package/dist/runtime/composables/virtualDataset/cacheStateHelpers.js +76 -0
  178. package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.d.ts +26 -0
  179. package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.js +60 -0
  180. package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.d.ts +24 -0
  181. package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.js +103 -0
  182. package/dist/runtime/composables/virtualDataset/types.d.ts +113 -0
  183. package/dist/runtime/composables/virtualDataset/types.js +0 -0
  184. package/dist/runtime/directives/clickOutside.d.ts +1 -1
  185. package/dist/runtime/directives/clickOutside.js +41 -13
  186. package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -1
  187. package/dist/runtime/plugins/nuxtCompatPlugin.js +16 -1
  188. package/dist/runtime/plugins/toastPlugin.client.js +2 -2
  189. package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
  190. package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
  191. package/dist/runtime/presets/default/assets/scss/index.css +3 -0
  192. package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
  193. package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
  194. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
  195. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
  196. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
  197. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
  198. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
  199. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
  200. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +7 -0
  201. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +57 -2
  202. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +7 -0
  203. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +6 -5
  204. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
  205. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +27 -17
  206. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
  207. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -1
  208. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +10 -10
  209. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -1
  210. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.d.vue.ts +2 -0
  211. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +67 -22
  212. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +2 -0
  213. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +41 -8
  214. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +184 -174
  215. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +41 -8
  216. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +17 -10
  217. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +113 -394
  218. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +17 -10
  219. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
  220. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
  221. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
  222. package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +5 -2
  223. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +15 -12
  224. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +5 -2
  225. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -2
  226. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +46 -29
  227. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -2
  228. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.d.vue.ts +6 -2
  229. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +23 -8
  230. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue.d.ts +6 -2
  231. package/dist/runtime/presets/default/components/KLayout/KLayout.vue +2 -2
  232. package/dist/runtime/presets/default/components/KLoader/KLoader.d.vue.ts +1 -0
  233. package/dist/runtime/presets/default/components/KLoader/KLoader.vue +13 -2
  234. package/dist/runtime/presets/default/components/KLoader/KLoader.vue.d.ts +1 -0
  235. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -94
  236. package/dist/runtime/presets/default/components/KMultiTabs/KMultiTabs.vue +69 -4
  237. package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +18 -46
  238. package/dist/runtime/presets/default/components/KSlider/KSlider.vue +11 -23
  239. package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
  240. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +24 -8
  241. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
  242. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
  243. package/dist/runtime/presets/default/components/KTree/KTree.vue +61 -56
  244. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
  245. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +1 -0
  246. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +12 -2
  247. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +1 -0
  248. package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
  249. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
  250. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
  251. package/dist/runtime/server/middleware/session.js +7 -0
  252. package/dist/runtime/utils/deprecation.d.ts +14 -0
  253. package/dist/runtime/utils/deprecation.js +44 -0
  254. package/dist/runtime/utils/dom.d.ts +31 -0
  255. package/dist/runtime/utils/dom.js +124 -0
  256. package/dist/skills/KATLUX_INDEX.md +18 -19
  257. package/dist/skills/katlux-components/SKILL.md +2 -0
  258. package/dist/skills/katlux-components/components/KBulkActions.md +26 -2
  259. package/dist/skills/katlux-components/components/KCombobox.md +2 -2
  260. package/dist/skills/katlux-components/components/KDataIterator.md +17 -4
  261. package/dist/skills/katlux-components/components/KDatatable.md +38 -0
  262. package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
  263. package/dist/skills/katlux-components/components/KGantt.md +9 -0
  264. package/dist/skills/katlux-components/components/KIcon.md +1 -1
  265. package/dist/skills/katlux-components/components/KLayout.md +4 -0
  266. package/dist/skills/katlux-components/components/KLineChart.md +3 -0
  267. package/dist/skills/katlux-components/components/KLoader.md +3 -0
  268. package/dist/skills/katlux-components/components/KProductList.md +0 -1
  269. package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
  270. package/dist/skills/katlux-components/components/KTextbox.md +1 -0
  271. package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
  272. package/dist/skills/katlux-components/components/KTreeView.md +12 -0
  273. package/dist/skills/katlux-config/SKILL.md +27 -8
  274. package/dist/skills/katlux-presets/SKILL.md +163 -3
  275. package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
  276. package/dist/skills/katlux-providers/SKILL.md +19 -5
  277. package/dist/skills/katlux-providers/providers/ADataProvider.md +17 -9
  278. package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
  279. package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
  280. package/dist/skills/katlux-providers/providers/CAPITreeServerDataProvider.md +13 -0
  281. package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
  282. package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
  283. package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
  284. package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
  285. package/dist/skills/katlux-providers/providers/encryption-field-level.md +67 -20
  286. package/dist/skills/katlux-providers/providers/encryption-key-management.md +23 -2
  287. package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
  288. package/dist/skills/katlux-providers/providers/encryption-searchable.md +341 -0
  289. package/dist/skills/katlux-providers/providers/encryption-symmetric.md +29 -2
  290. package/dist/skills/katlux-providers/providers/encryption-threat-model.md +70 -1
  291. package/dist/skills/katlux-providers/providers/encryption.md +26 -1
  292. package/dist/skills/katlux-providers/providers/types.md +3 -1
  293. package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
  294. package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
  295. package/dist/skills/katlux-tokens/SKILL.md +2 -1
  296. package/dist/types.d.mts +1 -1
  297. package/package.json +7 -3
  298. package/bin/add-ai-reference.mjs +0 -259
@@ -1,45 +1,55 @@
1
- import { ref, computed, unref, watch, getCurrentScope, onScopeDispose } from "vue";
1
+ import { ref, computed, unref, toValue, watch, getCurrentScope, onScopeDispose } from "vue";
2
+ import { resolveElement } from "../utils/dom";
2
3
  export function useVirtualScroll(options) {
3
4
  const containerRef = ref(null);
4
5
  const scrollTop = ref(0);
5
6
  const resolveItems = () => {
6
- if (typeof options.items === "function") {
7
- return options.items();
8
- }
9
- return unref(options.items) || [];
7
+ return toValue(options.items) || [];
10
8
  };
11
9
  const allItems = computed(() => resolveItems());
12
- const totalCount = computed(() => allItems.value.length);
10
+ const resolveTotalCount = () => {
11
+ if (options.totalCount !== void 0) {
12
+ const val = toValue(options.totalCount);
13
+ return typeof val === "number" && val >= 0 ? val : 0;
14
+ }
15
+ return allItems.value.length;
16
+ };
17
+ const totalCount = computed(() => resolveTotalCount());
13
18
  const isVirtual = computed(() => {
14
19
  if (options.virtualScroll === void 0) return false;
15
- return unref(options.virtualScroll) === true;
20
+ return toValue(options.virtualScroll) === true;
16
21
  });
17
22
  const colCount = computed(() => {
18
- const c = unref(options.columns);
23
+ const c = toValue(options.columns);
19
24
  return typeof c === "number" && c > 1 ? c : 1;
20
25
  });
21
26
  const buf = computed(() => {
22
- const b = unref(options.buffer);
23
- return typeof b === "number" ? b : 5;
27
+ const b = toValue(options.buffer);
28
+ return typeof b === "number" && Number.isFinite(b) && b >= 0 ? b : 5;
24
29
  });
25
30
  const defaultHeight = 40;
31
+ const resolveItemHeightOption = () => {
32
+ const raw = unref(options.itemHeight);
33
+ if (typeof raw === "function" && raw.length === 0) {
34
+ return raw();
35
+ }
36
+ return raw;
37
+ };
26
38
  const getItemHeight = (item, index) => {
27
- if (typeof options.itemHeight === "function") {
28
- return options.itemHeight(item, index);
39
+ const raw = resolveItemHeightOption();
40
+ if (typeof raw === "function") {
41
+ const h = raw(item, index);
42
+ return typeof h === "number" && Number.isFinite(h) && h > 0 ? h : defaultHeight;
29
43
  }
30
- const h = unref(options.itemHeight);
31
- return typeof h === "number" && h > 0 ? h : defaultHeight;
44
+ return typeof raw === "number" && raw > 0 ? raw : defaultHeight;
32
45
  };
33
46
  const baseItemHeight = computed(() => {
34
- const h = unref(options.itemHeight);
47
+ const h = resolveItemHeightOption();
35
48
  if (typeof h === "number" && h > 0) return h;
36
49
  return defaultHeight;
37
50
  });
38
51
  const resolveContainerHeight = () => {
39
- if (typeof options.containerHeight === "function") {
40
- return options.containerHeight() || 400;
41
- }
42
- const val = unref(options.containerHeight);
52
+ const val = toValue(options.containerHeight);
43
53
  return typeof val === "number" && val > 0 ? val : 400;
44
54
  };
45
55
  const configuredContainerHeight = computed(() => resolveContainerHeight());
@@ -54,40 +64,47 @@ export function useVirtualScroll(options) {
54
64
  );
55
65
  watch([containerRef, isVirtual], ([el, virtual], [oldEl]) => {
56
66
  if (typeof window === "undefined" || typeof ResizeObserver === "undefined") return;
57
- if (oldEl && oldEl.__vsObserver) {
58
- oldEl.__vsObserver.disconnect();
59
- delete oldEl.__vsObserver;
67
+ const prevEl = resolveElement(oldEl) ?? oldEl;
68
+ if (prevEl && prevEl.__vsObserver) {
69
+ ;
70
+ prevEl.__vsObserver.disconnect();
71
+ delete prevEl.__vsObserver;
60
72
  }
61
- if (el && virtual) {
73
+ const targetEl = resolveElement(el) ?? el;
74
+ if (targetEl && virtual && typeof Element !== "undefined" && targetEl instanceof Element) {
62
75
  const ro = new ResizeObserver((entries) => {
63
76
  for (const entry of entries) {
64
- const h = Math.round(entry.contentRect.height || el.clientHeight);
77
+ const h = Math.round(entry.contentRect.height || targetEl.clientHeight);
65
78
  if (h > 0 && h !== viewportHeight.value) {
66
79
  viewportHeight.value = h;
67
80
  }
68
81
  }
69
82
  });
70
- ro.observe(el);
71
- el.__vsObserver = ro;
83
+ ro.observe(targetEl);
84
+ targetEl.__vsObserver = ro;
72
85
  }
73
86
  });
74
87
  if (getCurrentScope()) {
75
88
  onScopeDispose(() => {
76
- if (containerRef.value && containerRef.value.__vsObserver) {
77
- containerRef.value.__vsObserver.disconnect();
78
- delete containerRef.value.__vsObserver;
89
+ const targetEl = resolveElement(containerRef.value) ?? containerRef.value;
90
+ if (targetEl && targetEl.__vsObserver) {
91
+ ;
92
+ targetEl.__vsObserver.disconnect();
93
+ delete targetEl.__vsObserver;
79
94
  }
80
95
  });
81
96
  }
82
- const isDynamicHeight = computed(() => typeof options.itemHeight === "function");
97
+ const isDynamicHeight = computed(() => typeof resolveItemHeightOption() === "function");
83
98
  const rowOffsets = computed(() => {
84
99
  if (!isDynamicHeight.value || colCount.value > 1) return [];
100
+ const count = totalCount.value;
85
101
  const items = allItems.value;
86
- const offsets = new Array(items.length + 1);
102
+ const offsets = new Array(count + 1);
87
103
  offsets[0] = 0;
88
104
  let current = 0;
89
- for (let i = 0; i < items.length; i++) {
90
- current += getItemHeight(items[i], i);
105
+ for (let i = 0; i < count; i++) {
106
+ const item = items[i] ?? (typeof options.getItem === "function" ? options.getItem(i) : void 0);
107
+ current += getItemHeight(item, i);
91
108
  offsets[i + 1] = current;
92
109
  }
93
110
  return offsets;
@@ -154,6 +171,16 @@ export function useVirtualScroll(options) {
154
171
  });
155
172
  const visibleItems = computed(() => {
156
173
  if (!isVirtual.value) return allItems.value;
174
+ if (typeof options.getItem === "function") {
175
+ const start = startIndex.value;
176
+ const end = endIndex.value;
177
+ const count = Math.max(0, end - start);
178
+ const res = new Array(count);
179
+ for (let i = 0; i < count; i++) {
180
+ res[i] = options.getItem(start + i);
181
+ }
182
+ return res;
183
+ }
157
184
  return allItems.value.slice(startIndex.value, endIndex.value);
158
185
  });
159
186
  const topSpacerHeight = computed(() => {
@@ -188,14 +215,22 @@ export function useVirtualScroll(options) {
188
215
  }
189
216
  }
190
217
  });
191
- const containerCssVars = computed(() => ({
192
- "--virtual-spacer-top": `${topSpacerHeight.value}px`,
193
- "--virtual-spacer-bottom": `${bottomSpacerHeight.value}px`,
194
- "--virtual-total-height": `${totalHeight.value}px`,
195
- "--virtual-item-height": `${baseItemHeight.value}px`,
196
- "--virtual-container-height": `${configuredContainerHeight.value}px`
197
- }));
198
- const scrollThreshold = options.scrollThreshold ?? 100;
218
+ const containerCssVars = computed(() => {
219
+ const vars = {
220
+ "--virtual-spacer-top": `${topSpacerHeight.value}px`,
221
+ "--virtual-spacer-bottom": `${bottomSpacerHeight.value}px`,
222
+ "--virtual-total-height": `${totalHeight.value}px`,
223
+ "--virtual-container-height": `${configuredContainerHeight.value}px`
224
+ };
225
+ if (!isDynamicHeight.value) {
226
+ vars["--virtual-item-height"] = `${baseItemHeight.value}px`;
227
+ }
228
+ return vars;
229
+ });
230
+ const scrollThreshold = computed(() => {
231
+ const val = toValue(options.scrollThreshold);
232
+ return typeof val === "number" && Number.isFinite(val) && val >= 0 ? val : 100;
233
+ });
199
234
  const onScroll = (e) => {
200
235
  const target = e.target;
201
236
  if (!target) return;
@@ -204,43 +239,35 @@ export function useVirtualScroll(options) {
204
239
  viewportHeight.value = target.clientHeight;
205
240
  }
206
241
  const distanceToBottom = target.scrollHeight - (target.scrollTop + target.clientHeight);
207
- if (distanceToBottom <= scrollThreshold && typeof options.onThresholdReach === "function") {
242
+ if (distanceToBottom <= scrollThreshold.value && typeof options.onThresholdReach === "function") {
208
243
  options.onThresholdReach();
209
244
  }
210
245
  };
246
+ const applyScrollTop = (targetScrollTop, behavior) => {
247
+ const el = resolveElement(containerRef.value) ?? containerRef.value;
248
+ if (!el) return;
249
+ el.scrollTop = targetScrollTop;
250
+ if (typeof el.scrollTo === "function") {
251
+ try {
252
+ el.scrollTo({
253
+ top: targetScrollTop,
254
+ behavior
255
+ });
256
+ } catch {
257
+ }
258
+ }
259
+ };
211
260
  const scrollToIndex = (index, behavior = "auto", offset = 0) => {
212
261
  if (isDynamicHeight.value && colCount.value <= 1) {
213
262
  const targetScrollTop2 = Math.max(0, (rowOffsets.value[index] || 0) - offset);
214
263
  scrollTop.value = targetScrollTop2;
215
- if (containerRef.value) {
216
- containerRef.value.scrollTop = targetScrollTop2;
217
- if (typeof containerRef.value.scrollTo === "function") {
218
- try {
219
- containerRef.value.scrollTo({
220
- top: targetScrollTop2,
221
- behavior
222
- });
223
- } catch {
224
- }
225
- }
226
- }
264
+ applyScrollTop(targetScrollTop2, behavior);
227
265
  return;
228
266
  }
229
267
  const targetRow = colCount.value <= 1 ? index : Math.floor(index / colCount.value);
230
268
  const targetScrollTop = Math.max(0, targetRow * baseItemHeight.value - offset);
231
269
  scrollTop.value = targetScrollTop;
232
- if (containerRef.value) {
233
- containerRef.value.scrollTop = targetScrollTop;
234
- if (typeof containerRef.value.scrollTo === "function") {
235
- try {
236
- containerRef.value.scrollTo({
237
- top: targetScrollTop,
238
- behavior
239
- });
240
- } catch {
241
- }
242
- }
243
- }
270
+ applyScrollTop(targetScrollTop, behavior);
244
271
  };
245
272
  return {
246
273
  startIndex,
@@ -0,0 +1,76 @@
1
+ import { isRef, unref } from "vue";
2
+ export function isUseDataProviderReturn(val) {
3
+ return val !== null && typeof val === "object" && "pageData" in val && isRef(val.pageData) && "stateVersion" in val && isRef(val.stateVersion);
4
+ }
5
+ export function resolveProviderAllDataRef(dp) {
6
+ if (!dp) return void 0;
7
+ return dp.allData?.value ?? dp.allData ?? dp.rowMap?.value ?? dp.rowMap ?? dp.data;
8
+ }
9
+ export function resolveVirtualItemsArray(dp, fallbackPageRows, isVirtual) {
10
+ if (isVirtual && dp) {
11
+ const candidates = [
12
+ dp.rowMap,
13
+ dp.rowMap?.value,
14
+ dp.allVisibleRows,
15
+ dp.allVisibleRows?.value,
16
+ dp.allVisibleNodes,
17
+ dp.allVisibleNodes?.value,
18
+ dp.visibleRows,
19
+ dp.visibleRows?.value,
20
+ dp.filteredData?.value,
21
+ dp.filteredData,
22
+ dp.allData?.value,
23
+ dp.allData,
24
+ dp.data
25
+ ];
26
+ for (const candidate of candidates) {
27
+ if (Array.isArray(candidate)) return candidate;
28
+ }
29
+ }
30
+ return fallbackPageRows;
31
+ }
32
+ export function resolveVirtualTotalCount(dp, bridgeRowCount, datasetItems, pageRowsLength, isVirtual) {
33
+ if (!isVirtual) return pageRowsLength;
34
+ if (dp?.paginateBy === "root" && Array.isArray(dp.allVisibleRows)) {
35
+ return dp.allVisibleRows.length;
36
+ }
37
+ const rc = bridgeRowCount ?? dp?.rowCount;
38
+ const count = typeof rc === "number" ? rc : unref(rc);
39
+ if (typeof count === "number" && (count > 0 || datasetItems.length === 0)) return count;
40
+ if (Array.isArray(dp?.rowMap)) {
41
+ return dp.rowMap.length;
42
+ }
43
+ return datasetItems.length;
44
+ }
45
+ export function classifyVirtualStateChange(params) {
46
+ const { dp, snapshot } = params;
47
+ if (dp !== snapshot.provider) {
48
+ return "invalidate";
49
+ }
50
+ const stateChanged = params.dpBridgeStateVersion !== snapshot.stateVersion;
51
+ const pageChanged = params.pageRowsRef !== snapshot.pageRowsRef;
52
+ const allDataChanged = resolveProviderAllDataRef(dp) !== snapshot.allDataRef;
53
+ const customChanged = params.customChangeCount !== snapshot.customChangeCount;
54
+ if (!stateChanged && !pageChanged && !allDataChanged && !customChanged) {
55
+ return "none";
56
+ }
57
+ const batchGenNow = dp?._batchGeneration;
58
+ const loadedBatchesSizeNow = dp?.loadedBatches instanceof Set ? dp.loadedBatches.size : 0;
59
+ const isIncrementalBatchAppend = Boolean(
60
+ dp && dp.batchLoad === "onDemand" && dp.loadedBatches instanceof Set && batchGenNow === snapshot.batchGeneration && loadedBatchesSizeNow > snapshot.loadedBatchesSize
61
+ );
62
+ if (isIncrementalBatchAppend && !customChanged) {
63
+ return "skip";
64
+ }
65
+ if (params.currentPage !== snapshot.currentPage && !allDataChanged && !customChanged) {
66
+ return "pageSwitch";
67
+ }
68
+ if (pageChanged || allDataChanged || customChanged) {
69
+ return "invalidate";
70
+ }
71
+ const loadingChanged = params.loading !== snapshot.loading || params.initialLoad !== snapshot.initialLoad || params.error !== snapshot.error || dp?.batchProgress !== snapshot.batchProgress || Boolean(dp?.isBatchLoading) !== snapshot.isBatchLoading;
72
+ if (loadingChanged || params.isFetchingPage) {
73
+ return "skip";
74
+ }
75
+ return "invalidate";
76
+ }
@@ -0,0 +1,60 @@
1
+ export function resolveDomTheadOffset(container, fallbackOffset) {
2
+ if (container) {
3
+ const thead = container.querySelector("thead");
4
+ if (thead && thead.offsetHeight > 0) {
5
+ return thead.offsetHeight;
6
+ }
7
+ }
8
+ return fallbackOffset;
9
+ }
10
+ export function resolveDomItemHeight(container, optionHeight) {
11
+ if (container) {
12
+ const rowEl = container.querySelector('tbody tr, [role="row"]');
13
+ if (rowEl && rowEl.offsetHeight > 0) {
14
+ return rowEl.offsetHeight;
15
+ }
16
+ }
17
+ if (typeof optionHeight === "function") return 40;
18
+ return typeof optionHeight === "number" && optionHeight > 0 ? optionHeight : 40;
19
+ }
20
+ export function resolveDomViewportHeight(container, measuredHeight, optionHeight) {
21
+ if (container && container.clientHeight > 0) {
22
+ return container.clientHeight;
23
+ }
24
+ if (measuredHeight > 0) {
25
+ return measuredHeight;
26
+ }
27
+ return typeof optionHeight === "number" && optionHeight > 0 ? optionHeight : 500;
28
+ }
29
+ export function computeNextKeyboardFocusIndex(params) {
30
+ const { key, currentFocus, total, firstInView, lastInView, pageStep } = params;
31
+ const outOfView = currentFocus < firstInView || currentFocus > lastInView;
32
+ switch (key) {
33
+ case "ArrowDown":
34
+ return {
35
+ nextIndex: outOfView ? Math.min(total - 1, firstInView) : Math.min(total - 1, currentFocus + 1),
36
+ scrollMode: "ensureVisible"
37
+ };
38
+ case "ArrowUp":
39
+ return {
40
+ nextIndex: outOfView ? Math.max(0, lastInView) : Math.max(0, currentFocus - 1),
41
+ scrollMode: "ensureVisible"
42
+ };
43
+ case "PageDown":
44
+ return {
45
+ nextIndex: outOfView ? Math.min(total - 1, firstInView + pageStep) : Math.min(total - 1, currentFocus + pageStep),
46
+ scrollMode: "ensureVisible"
47
+ };
48
+ case "PageUp":
49
+ return {
50
+ nextIndex: outOfView ? Math.max(0, lastInView - pageStep) : Math.max(0, currentFocus - pageStep),
51
+ scrollMode: "ensureVisible"
52
+ };
53
+ case "Home":
54
+ return { nextIndex: 0, scrollMode: "home" };
55
+ case "End":
56
+ return { nextIndex: total - 1, scrollMode: "end" };
57
+ default:
58
+ return null;
59
+ }
60
+ }
@@ -0,0 +1,103 @@
1
+ import { unref } from "vue";
2
+ import { isEncrypted } from "@katlux/providers";
3
+ export function extractVirtualRowId(row, idKey) {
4
+ return row?.[idKey] ?? row?.id ?? row?._id ?? row?.__treeNode?.id;
5
+ }
6
+ export function getTreeBranchRows(row, dp, fallbackRows, idKey) {
7
+ if (!dp || !("parentKey" in dp) && typeof dp.toggleNode !== "function") {
8
+ return [row];
9
+ }
10
+ const parentKey = dp.parentKey || "parentId";
11
+ const sourceRows = unref(dp.allData) || fallbackRows || [];
12
+ const rootId = extractVirtualRowId(row, idKey);
13
+ if (rootId === null || rootId === void 0) return [row];
14
+ const childrenByParent = /* @__PURE__ */ new Map();
15
+ for (const r of sourceRows) {
16
+ const pId = r?.__treeNode?.parentId ?? r?.[parentKey];
17
+ if (pId === null || pId === void 0) continue;
18
+ let list = childrenByParent.get(pId);
19
+ if (!list) {
20
+ list = [];
21
+ childrenByParent.set(pId, list);
22
+ }
23
+ list.push(r);
24
+ }
25
+ const result = [row];
26
+ const visited = /* @__PURE__ */ new Set([rootId]);
27
+ const queue = [rootId];
28
+ while (queue.length > 0) {
29
+ const curr = queue.shift();
30
+ for (const child of childrenByParent.get(curr) || []) {
31
+ const cId = extractVirtualRowId(child, idKey);
32
+ if (cId !== null && cId !== void 0 && !visited.has(cId)) {
33
+ visited.add(cId);
34
+ result.push(child);
35
+ queue.push(cId);
36
+ }
37
+ }
38
+ }
39
+ return result;
40
+ }
41
+ export function getTreeAncestorIds(row, dp, fallbackRows, idKey) {
42
+ if (!dp || !("parentKey" in dp) && typeof dp.toggleNode !== "function") return [];
43
+ const parentKey = dp.parentKey || "parentId";
44
+ const sourceRows = unref(dp.allData) || fallbackRows || [];
45
+ const parentById = /* @__PURE__ */ new Map();
46
+ for (const r of sourceRows) {
47
+ const id = extractVirtualRowId(r, idKey);
48
+ if (id !== null && id !== void 0) parentById.set(id, r?.__treeNode?.parentId ?? r?.[parentKey] ?? null);
49
+ }
50
+ const ancestors = [];
51
+ const startId = extractVirtualRowId(row, idKey);
52
+ const visited = /* @__PURE__ */ new Set([startId]);
53
+ let currParent = row?.__treeNode?.parentId ?? row?.[parentKey] ?? parentById.get(startId) ?? null;
54
+ while (currParent !== null && currParent !== void 0 && !visited.has(currParent)) {
55
+ visited.add(currParent);
56
+ ancestors.push(currParent);
57
+ currParent = parentById.get(currParent) ?? null;
58
+ }
59
+ return ancestors;
60
+ }
61
+ export function buildSelectionIdSet(rows, idKey) {
62
+ const set = /* @__PURE__ */ new Set();
63
+ for (const r of rows || []) {
64
+ const id = r?.[idKey] ?? r?.id ?? r?._id ?? r;
65
+ set.add(id);
66
+ set.add(r);
67
+ }
68
+ return set;
69
+ }
70
+ export function detectEncryptedCellValue(val, rawProvider) {
71
+ if (!val || typeof val !== "object") return false;
72
+ if (val.__encrypted === true) return true;
73
+ const cipher = rawProvider?.cipherProvider;
74
+ if (cipher && typeof cipher.isEncrypted === "function") {
75
+ return cipher.isEncrypted(val);
76
+ }
77
+ return typeof isEncrypted === "function" ? isEncrypted(val) : false;
78
+ }
79
+ export function computePageScopedSelectAllRows(datasetItems, currentSelected, selectedRowIds, dp, idKey, allSelected) {
80
+ if (allSelected) {
81
+ const pageIdSet = new Set(
82
+ datasetItems.flatMap(
83
+ (r) => getTreeBranchRows(r, dp, datasetItems, idKey).map((b) => b?.[idKey] ?? b?.id ?? b?._id ?? b)
84
+ )
85
+ );
86
+ return currentSelected.filter((r) => {
87
+ const id = r?.[idKey] ?? r?.id ?? r?._id ?? r;
88
+ return !pageIdSet.has(id) && !pageIdSet.has(r);
89
+ });
90
+ }
91
+ const existingIds = new Set(selectedRowIds);
92
+ const toAdd = [];
93
+ for (const r of datasetItems) {
94
+ for (const item of getTreeBranchRows(r, dp, datasetItems, idKey)) {
95
+ const id = item?.[idKey] ?? item?.id ?? item?._id ?? item;
96
+ if (!existingIds.has(id) && !existingIds.has(item)) {
97
+ existingIds.add(id);
98
+ toAdd.push(item);
99
+ }
100
+ }
101
+ }
102
+ return [...currentSelected, ...toAdd];
103
+ }
@@ -0,0 +1,44 @@
1
+ import { getCurrentInstance } from "vue";
2
+ const warnedDeprecations = /* @__PURE__ */ new Set();
3
+ function isProductionEnv() {
4
+ return typeof process !== "undefined" && process.env?.NODE_ENV === "production";
5
+ }
6
+ function toCamelCase(eventName) {
7
+ return eventName.replace(/-([a-z])/g, (_, ch) => ch.toUpperCase());
8
+ }
9
+ function capitalize(str) {
10
+ return str ? str.charAt(0).toUpperCase() + str.slice(1) : "";
11
+ }
12
+ function hasLegacyListener(vnodeProps, eventName) {
13
+ if (!vnodeProps) return false;
14
+ const exactKey = `on${capitalize(eventName)}`;
15
+ const camelKey = `on${capitalize(toCamelCase(eventName))}`;
16
+ return typeof vnodeProps[exactKey] === "function" || typeof vnodeProps[camelKey] === "function";
17
+ }
18
+ export function warnDeprecatedOnce(key, message) {
19
+ if (isProductionEnv() || warnedDeprecations.has(key)) {
20
+ return;
21
+ }
22
+ warnedDeprecations.add(key);
23
+ console.warn(`[Katlux Toolkit]: ${message}`);
24
+ }
25
+ export function clearDeprecationWarnings() {
26
+ warnedDeprecations.clear();
27
+ }
28
+ export function createLegacyEventEmitter(componentName, emit) {
29
+ const instance = getCurrentInstance();
30
+ return (canonicalEvent, legacyEvents, payload) => {
31
+ if (!emit) return;
32
+ emit(canonicalEvent, payload);
33
+ const vnodeProps = instance?.vnode?.props;
34
+ for (const legacyEvent of legacyEvents) {
35
+ if (!instance || hasLegacyListener(vnodeProps, legacyEvent)) {
36
+ warnDeprecatedOnce(
37
+ `${componentName}:${legacyEvent}`,
38
+ `<${componentName}> event "@${legacyEvent}" is deprecated and will be removed in a future release. Use "@${canonicalEvent}" instead.`
39
+ );
40
+ }
41
+ emit(legacyEvent, payload);
42
+ }
43
+ };
44
+ }
@@ -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
+ }