@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,4 +1,11 @@
1
1
  import { ref, watch, onMounted, computed } from "vue";
2
+ export const defaultQuickPresets = [
3
+ { id: "today", label: "Today" },
4
+ { id: "yesterday", label: "Yesterday" },
5
+ { id: "last7Days", label: "Last 7 Days" },
6
+ { id: "last30Days", label: "Last 30 Days" },
7
+ { id: "thisMonth", label: "This Month" }
8
+ ];
2
9
  export const KDatePickerDefaultProps = {
3
10
  label: {
4
11
  type: String,
@@ -9,11 +16,11 @@ export const KDatePickerDefaultProps = {
9
16
  default: "MM-DD-YYYY"
10
17
  },
11
18
  day: {
12
- type: [Date, String],
19
+ type: [Date, String, Array],
13
20
  default: void 0
14
21
  },
15
22
  modelValue: {
16
- type: [Date, String],
23
+ type: [Date, String, Array],
17
24
  default: void 0
18
25
  },
19
26
  isOpen: {
@@ -52,38 +59,117 @@ export const KDatePickerDefaultProps = {
52
59
  align: {
53
60
  type: String,
54
61
  default: "left"
62
+ },
63
+ range: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ viewCount: {
68
+ type: Number,
69
+ default: void 0
55
70
  }
56
71
  };
72
+ export function parseSingleDate(str, format) {
73
+ if (!str || !format) return null;
74
+ let day = "", month = "", year = "";
75
+ for (let i = 0; i < format.length; i++) {
76
+ const char = format[i];
77
+ if (char === "M") {
78
+ month += str[i] || "";
79
+ } else if (char === "D") {
80
+ day += str[i] || "";
81
+ } else if (char === "Y") {
82
+ year += str[i] || "";
83
+ }
84
+ }
85
+ if (month.length === 2 && day.length === 2 && year.length === 4) {
86
+ const d = new Date(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10));
87
+ if (!isNaN(d.getTime())) {
88
+ return d;
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ export function parseDateValue(val) {
94
+ if (!val) return null;
95
+ if (val instanceof Date) return isNaN(val.getTime()) ? null : val;
96
+ if (typeof val === "string" || val instanceof String) {
97
+ const str = val.toString().trim();
98
+ const isoMatch = str.match(/^(\d{4})-(\d{2})-(\d{2})$/);
99
+ if (isoMatch) {
100
+ const d2 = new Date(parseInt(isoMatch[1], 10), parseInt(isoMatch[2], 10) - 1, parseInt(isoMatch[3], 10));
101
+ return isNaN(d2.getTime()) ? null : d2;
102
+ }
103
+ }
104
+ const d = new Date(val);
105
+ return isNaN(d.getTime()) ? null : d;
106
+ }
107
+ export function areDateValuesEqual(a, b) {
108
+ if (Array.isArray(a) && Array.isArray(b)) {
109
+ if (a.length !== b.length) return false;
110
+ return a.every((item, i) => areDateValuesEqual(item, b[i]));
111
+ }
112
+ if (!a && !b) return true;
113
+ if (!a || !b) return false;
114
+ const d1 = parseDateValue(a);
115
+ const d2 = parseDateValue(b);
116
+ if (d1 && d2) return d1.getTime() === d2.getTime();
117
+ return false;
118
+ }
57
119
  export function useKDatePickerLogic(props) {
58
- const _date = ref("");
120
+ const _date = ref(props.range ? [] : "");
59
121
  const maskedModel = ref("");
60
122
  const calendarShow = ref(false);
123
+ const effectiveMask = computed(() => {
124
+ return props.range ? `${props.format} - ${props.format}` : props.format;
125
+ });
126
+ const effectivePlaceholder = computed(() => {
127
+ return props.placeholder || (props.range ? `${props.format} - ${props.format}` : props.format);
128
+ });
129
+ const formatDate = (date) => {
130
+ const day = date.getDate().toString().padStart(2, "0");
131
+ const month = (date.getMonth() + 1).toString().padStart(2, "0");
132
+ const year = date.getFullYear();
133
+ let formattedDate = props.format;
134
+ formattedDate = formattedDate.replace("DD", day);
135
+ formattedDate = formattedDate.replace("MM", month);
136
+ formattedDate = formattedDate.replace("YYYY", year.toString());
137
+ return formattedDate;
138
+ };
61
139
  watch(maskedModel, (newVal) => {
62
- if (newVal === "") {
63
- if (_date.value !== "") {
64
- _date.value = "";
140
+ if (!newVal || newVal.trim() === "") {
141
+ if (props.range) {
142
+ if (!Array.isArray(_date.value) || _date.value.length > 0) {
143
+ _date.value = [];
144
+ }
145
+ } else {
146
+ if (_date.value !== "") {
147
+ _date.value = "";
148
+ }
65
149
  }
66
150
  return;
67
151
  }
68
- const format = props.format;
69
- let day = "", month = "", year = "";
70
- for (let i = 0; i < format.length; i++) {
71
- const char = format[i];
72
- if (char === "M") {
73
- month += newVal[i] || "";
74
- } else if (char === "D") {
75
- day += newVal[i] || "";
76
- } else if (char === "Y") {
77
- year += newVal[i] || "";
152
+ if (props.range) {
153
+ const parts = newVal.split(/\s+-\s+/);
154
+ if (parts.length === 2 && parts[0] && parts[1]) {
155
+ const d1 = parseSingleDate(parts[0].trim(), props.format);
156
+ const d2 = parseSingleDate(parts[1].trim(), props.format);
157
+ if (d1 && d2) {
158
+ const start = d1.getTime() <= d2.getTime() ? d1 : d2;
159
+ const end = d1.getTime() <= d2.getTime() ? d2 : d1;
160
+ if (!areDateValuesEqual(_date.value, [start, end])) {
161
+ _date.value = [start, end];
162
+ }
163
+ }
78
164
  }
165
+ return;
79
166
  }
80
- if (month.length === 2 && day.length === 2 && year.length === 4) {
81
- const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
82
- if (!isNaN(d.getTime())) {
83
- const oldTime = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value).getTime();
84
- if (d.getTime() !== oldTime) {
85
- _date.value = d;
86
- }
167
+ const d = parseSingleDate(newVal, props.format);
168
+ if (d) {
169
+ const oldParsed = parseDateValue(_date.value);
170
+ const oldTime = oldParsed ? oldParsed.getTime() : NaN;
171
+ if (d.getTime() !== oldTime) {
172
+ _date.value = d;
87
173
  }
88
174
  }
89
175
  });
@@ -91,29 +177,97 @@ export function useKDatePickerLogic(props) {
91
177
  calendarShow.value = true;
92
178
  };
93
179
  const dateSelected = (date) => {
94
- _date.value = date;
95
- const formatted = formatDate(date);
96
- maskedModel.value = formatted;
97
- calendarShow.value = false;
180
+ if (props.range) {
181
+ if (!Array.isArray(_date.value) || _date.value.length === 0 || _date.value.length === 2 && _date.value[0] && _date.value[1]) {
182
+ _date.value = [date, null];
183
+ maskedModel.value = `${formatDate(date)} - `;
184
+ calendarShow.value = true;
185
+ } else {
186
+ let start = _date.value[0];
187
+ let end = date;
188
+ if (end.getTime() < start.getTime()) {
189
+ const temp = start;
190
+ start = end;
191
+ end = temp;
192
+ }
193
+ const rangeResult = [start, end];
194
+ _date.value = rangeResult;
195
+ maskedModel.value = `${formatDate(start)} - ${formatDate(end)}`;
196
+ calendarShow.value = false;
197
+ }
198
+ } else {
199
+ _date.value = date;
200
+ const formatted = formatDate(date);
201
+ maskedModel.value = formatted;
202
+ calendarShow.value = false;
203
+ }
98
204
  };
99
- const formatDate = (date) => {
100
- const day = date.getDate().toString().padStart(2, "0");
101
- const month = (date.getMonth() + 1).toString().padStart(2, "0");
102
- const year = date.getFullYear();
103
- let formattedDate = props.format;
104
- formattedDate = formattedDate.replace("DD", day);
105
- formattedDate = formattedDate.replace("MM", month);
106
- formattedDate = formattedDate.replace("YYYY", year.toString());
107
- return formattedDate;
205
+ const applyQuickPreset = (presetId) => {
206
+ const now = /* @__PURE__ */ new Date();
207
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
208
+ let start;
209
+ let end;
210
+ switch (presetId) {
211
+ case "today":
212
+ start = today;
213
+ end = today;
214
+ break;
215
+ case "yesterday": {
216
+ const yest = new Date(today);
217
+ yest.setDate(yest.getDate() - 1);
218
+ start = yest;
219
+ end = yest;
220
+ break;
221
+ }
222
+ case "last7Days": {
223
+ const past7 = new Date(today);
224
+ past7.setDate(past7.getDate() - 6);
225
+ start = past7;
226
+ end = today;
227
+ break;
228
+ }
229
+ case "last30Days": {
230
+ const past30 = new Date(today);
231
+ past30.setDate(past30.getDate() - 29);
232
+ start = past30;
233
+ end = today;
234
+ break;
235
+ }
236
+ case "thisMonth": {
237
+ start = new Date(today.getFullYear(), today.getMonth(), 1);
238
+ end = new Date(today.getFullYear(), today.getMonth() + 1, 0);
239
+ break;
240
+ }
241
+ default:
242
+ return;
243
+ }
244
+ const rangeResult = [start, end];
245
+ _date.value = rangeResult;
246
+ maskedModel.value = `${formatDate(start)} - ${formatDate(end)}`;
247
+ calendarShow.value = false;
108
248
  };
109
249
  const syncValue = (val) => {
110
250
  if (val === void 0 || val === null || val === "") {
111
- _date.value = "";
251
+ _date.value = props.range ? [] : "";
112
252
  maskedModel.value = "";
113
253
  return;
114
254
  }
115
- const d = val instanceof Date ? val : new Date(val);
116
- if (!isNaN(d.getTime())) {
255
+ if (props.range) {
256
+ if (Array.isArray(val) && val.length >= 2 && val[0] && val[1]) {
257
+ const d1 = parseDateValue(val[0]);
258
+ const d2 = parseDateValue(val[1]);
259
+ if (d1 && d2) {
260
+ _date.value = [d1, d2];
261
+ maskedModel.value = `${formatDate(d1)} - ${formatDate(d2)}`;
262
+ return;
263
+ }
264
+ }
265
+ _date.value = [];
266
+ maskedModel.value = "";
267
+ return;
268
+ }
269
+ const d = parseDateValue(val);
270
+ if (d) {
117
271
  _date.value = val;
118
272
  maskedModel.value = formatDate(d);
119
273
  } else {
@@ -121,46 +275,76 @@ export function useKDatePickerLogic(props) {
121
275
  maskedModel.value = "";
122
276
  }
123
277
  };
124
- syncValue(props.modelValue || props.day);
278
+ syncValue(props.modelValue !== void 0 ? props.modelValue : props.day);
125
279
  onMounted(() => {
126
- syncValue(props.modelValue || props.day);
280
+ const initVal = props.modelValue !== void 0 ? props.modelValue : props.day;
281
+ if (!areDateValuesEqual(initVal, _date.value)) {
282
+ syncValue(initVal);
283
+ }
127
284
  if (props.isOpen) {
128
285
  calendarShow.value = props.isOpen;
129
286
  }
130
287
  });
131
288
  watch(() => props.day, (newDay) => {
132
- if (newDay !== void 0) {
133
- const d1 = newDay && (newDay instanceof Date || typeof newDay === "string") ? newDay instanceof Date ? newDay.getTime() : new Date(newDay).getTime() : 0;
134
- const d2 = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value || "").getTime();
135
- if (d1 !== d2 || !newDay && _date.value) {
136
- syncValue(newDay);
137
- }
289
+ if (newDay !== void 0 && !areDateValuesEqual(newDay, _date.value)) {
290
+ syncValue(newDay);
138
291
  }
139
292
  });
140
293
  watch(() => props.modelValue, (newVal) => {
141
- if (newVal !== void 0) {
142
- const d1 = newVal && (newVal instanceof Date || typeof newVal === "string") ? newVal instanceof Date ? newVal.getTime() : new Date(newVal).getTime() : 0;
143
- const d2 = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value || "").getTime();
144
- if (d1 !== d2 || !newVal && _date.value) {
145
- syncValue(newVal);
146
- }
294
+ if (newVal !== void 0 && !areDateValuesEqual(newVal, _date.value)) {
295
+ syncValue(newVal);
147
296
  }
148
297
  });
149
298
  watch(() => props.isOpen, (newVal) => {
150
299
  calendarShow.value = !!newVal;
151
300
  });
301
+ const reconcileIncompleteRange = () => {
302
+ if (!props.range) return;
303
+ const isIncompleteDate = Array.isArray(_date.value) && _date.value.length === 2 && (!_date.value[0] || !_date.value[1]);
304
+ let expectedMasked = "";
305
+ if (Array.isArray(_date.value) && _date.value.length === 2 && _date.value[0] && _date.value[1]) {
306
+ const d1 = parseDateValue(_date.value[0]);
307
+ const d2 = parseDateValue(_date.value[1]);
308
+ if (d1 && d2) {
309
+ expectedMasked = `${formatDate(d1)} - ${formatDate(d2)}`;
310
+ }
311
+ }
312
+ if (isIncompleteDate || maskedModel.value !== expectedMasked) {
313
+ syncValue(props.modelValue !== void 0 ? props.modelValue : props.day);
314
+ }
315
+ };
316
+ watch(calendarShow, (newVal, oldVal) => {
317
+ if (oldVal === true && newVal === false) {
318
+ reconcileIncompleteRange();
319
+ }
320
+ });
152
321
  watch(() => props.format, () => {
153
- if (_date.value && _date.value !== "") {
154
- const d = _date.value instanceof Date ? _date.value : new Date(_date.value);
155
- if (!isNaN(d.getTime())) {
322
+ if (props.range) {
323
+ if (Array.isArray(_date.value) && _date.value.length === 2 && _date.value[0] && _date.value[1]) {
324
+ const d1 = parseDateValue(_date.value[0]);
325
+ const d2 = parseDateValue(_date.value[1]);
326
+ if (d1 && d2) {
327
+ maskedModel.value = `${formatDate(d1)} - ${formatDate(d2)}`;
328
+ }
329
+ }
330
+ } else if (_date.value && _date.value !== "") {
331
+ const d = parseDateValue(_date.value);
332
+ if (d) {
156
333
  maskedModel.value = formatDate(d);
157
334
  }
158
335
  }
159
336
  });
160
337
  const calendarDay = computed(() => {
161
- const val = props.modelValue || props.day;
338
+ const val = props.modelValue !== void 0 ? props.modelValue : props.day;
162
339
  if (val) {
163
- return val;
340
+ if (Array.isArray(val)) {
341
+ if (val[0]) return val[0];
342
+ } else {
343
+ return val;
344
+ }
345
+ }
346
+ if (Array.isArray(_date.value) && _date.value[0]) {
347
+ return _date.value[0];
164
348
  }
165
349
  return /* @__PURE__ */ new Date();
166
350
  });
@@ -169,7 +353,13 @@ export function useKDatePickerLogic(props) {
169
353
  maskedModel,
170
354
  calendarShow,
171
355
  calendarDay,
356
+ effectiveMask,
357
+ effectivePlaceholder,
358
+ quickPresets: defaultQuickPresets,
359
+ applyQuickPreset,
172
360
  textboxClicked,
173
- dateSelected
361
+ dateSelected,
362
+ reconcileIncompleteRange,
363
+ formatDate
174
364
  };
175
365
  }
@@ -129,13 +129,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
129
129
  modelValue: string | Date;
130
130
  isOpen: boolean;
131
131
  label: string;
132
+ validation: "success" | "warning" | "error" | null | undefined;
132
133
  definedDays: import("../KCalendar/types.js").IDefinedDay[];
133
134
  markedDays: import("../KCalendar/types.js").IMarkedDay[];
134
135
  day: string | Date;
135
- validation: "error" | "success" | "warning" | null | undefined;
136
+ validationText: string;
136
137
  placeholder: string;
137
138
  teleportTo: string;
138
- validationText: string;
139
139
  showClear: boolean;
140
140
  format: string;
141
141
  timeFormat: string;
@@ -129,13 +129,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
129
129
  modelValue: string | Date;
130
130
  isOpen: boolean;
131
131
  label: string;
132
+ validation: "success" | "warning" | "error" | null | undefined;
132
133
  definedDays: import("../KCalendar/types.js").IDefinedDay[];
133
134
  markedDays: import("../KCalendar/types.js").IMarkedDay[];
134
135
  day: string | Date;
135
- validation: "error" | "success" | "warning" | null | undefined;
136
+ validationText: string;
136
137
  placeholder: string;
137
138
  teleportTo: string;
138
- validationText: string;
139
139
  showClear: boolean;
140
140
  format: string;
141
141
  timeFormat: string;
@@ -91,6 +91,8 @@ export function useKDateTimePickerLogic(props) {
91
91
  } else if (char === "m") {
92
92
  minutes += newVal[rawIdx] || "";
93
93
  rawIdx++;
94
+ } else {
95
+ rawIdx++;
94
96
  }
95
97
  }
96
98
  if (month.length === 2 && day.length === 2 && year.length === 4) {
@@ -8,7 +8,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
8
8
  default: boolean;
9
9
  };
10
10
  anchorEl: {
11
- type: import("vue").PropType<HTMLElement>;
11
+ type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
12
12
  default: undefined;
13
13
  };
14
14
  teleportTo: {
@@ -39,7 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
39
39
  default: boolean;
40
40
  };
41
41
  anchorEl: {
42
- type: import("vue").PropType<HTMLElement>;
42
+ type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
43
43
  default: undefined;
44
44
  };
45
45
  teleportTo: {
@@ -62,12 +62,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
62
62
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
63
63
  }>, {
64
64
  isOpen: boolean;
65
+ align: import("./KDropdown.logic.js").KDropdownAlign;
65
66
  direction: import("./KDropdown.logic.js").KDropdownDirection;
66
67
  teleportTo: string;
67
68
  fullWidth: boolean;
68
69
  maxHeight: number;
69
- align: import("./KDropdown.logic.js").KDropdownAlign;
70
- anchorEl: HTMLElement;
70
+ anchorEl: import("../../utils/dom.js").DomTargetLike;
71
71
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
72
72
  declare const _default: typeof __VLS_export;
73
73
  export default _default;
@@ -8,7 +8,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
8
8
  default: boolean;
9
9
  };
10
10
  anchorEl: {
11
- type: import("vue").PropType<HTMLElement>;
11
+ type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
12
12
  default: undefined;
13
13
  };
14
14
  teleportTo: {
@@ -39,7 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
39
39
  default: boolean;
40
40
  };
41
41
  anchorEl: {
42
- type: import("vue").PropType<HTMLElement>;
42
+ type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
43
43
  default: undefined;
44
44
  };
45
45
  teleportTo: {
@@ -62,12 +62,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
62
62
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
63
63
  }>, {
64
64
  isOpen: boolean;
65
+ align: import("./KDropdown.logic.js").KDropdownAlign;
65
66
  direction: import("./KDropdown.logic.js").KDropdownDirection;
66
67
  teleportTo: string;
67
68
  fullWidth: boolean;
68
69
  maxHeight: number;
69
- align: import("./KDropdown.logic.js").KDropdownAlign;
70
- anchorEl: HTMLElement;
70
+ anchorEl: import("../../utils/dom.js").DomTargetLike;
71
71
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
72
72
  declare const _default: typeof __VLS_export;
73
73
  export default _default;
@@ -1,10 +1,11 @@
1
1
  import { type PropType, type Ref } from 'vue';
2
+ import { type DomTargetLike } from '../../utils/dom.js';
2
3
  export type KDropdownDirection = 'auto' | 'bottom' | 'top' | 'left' | 'right';
3
4
  export type KDropdownAlign = 'left' | 'right' | 'top' | 'bottom';
4
5
  export interface KDropdownProps {
5
6
  isOpen: boolean;
6
7
  fullWidth: boolean;
7
- anchorEl?: HTMLElement;
8
+ anchorEl?: DomTargetLike;
8
9
  teleportTo?: string;
9
10
  align?: KDropdownAlign;
10
11
  direction?: KDropdownDirection;
@@ -23,7 +24,7 @@ export declare const KDropdownDefaultProps: {
23
24
  default: boolean;
24
25
  };
25
26
  anchorEl: {
26
- type: PropType<HTMLElement>;
27
+ type: PropType<DomTargetLike>;
27
28
  default: undefined;
28
29
  };
29
30
  teleportTo: {
@@ -1,5 +1,6 @@
1
1
  import { ref, watch, onMounted, onUnmounted, nextTick, inject, computed } from "vue";
2
2
  import { KMODAL_PORTAL_ID_KEY } from "../KModal/KModal.logic.js";
3
+ import { resolveElement, resolveModalTeleportTarget } from "../../utils/dom.js";
3
4
  export const KDropdownDefaultProps = {
4
5
  isOpen: {
5
6
  type: Boolean,
@@ -33,19 +34,13 @@ export const KDropdownDefaultProps = {
33
34
  export function useKDropdownLogic(props, emit) {
34
35
  const modalPortalId = inject(KMODAL_PORTAL_ID_KEY, null);
35
36
  const isInModal = computed(() => !!modalPortalId?.value);
37
+ const isMounted = ref(false);
38
+ const open = ref(false);
36
39
  const teleportTarget = computed(() => {
37
- if (props.teleportTo) return props.teleportTo;
38
- if (isInModal.value && modalPortalId?.value) {
39
- const targetId = `#${modalPortalId.value}`;
40
- if (typeof document !== "undefined" && !document.querySelector(targetId)) {
41
- const activePortal = document.querySelector(".modal-portal");
42
- if (activePortal && activePortal.id) return `#${activePortal.id}`;
43
- }
44
- return targetId;
45
- }
46
- return "body";
40
+ void isMounted.value;
41
+ void open.value;
42
+ return resolveModalTeleportTarget(props.teleportTo, modalPortalId);
47
43
  });
48
- const open = ref(false);
49
44
  const dropdownRect = ref({
50
45
  top: 0,
51
46
  left: 0,
@@ -57,7 +52,9 @@ export function useKDropdownLogic(props, emit) {
57
52
  resolvedDirection: "bottom",
58
53
  resolvedAlign: "left"
59
54
  });
55
+ let openRequestId = 0;
60
56
  const clickoutside = () => {
57
+ openRequestId++;
61
58
  open.value = false;
62
59
  emit("update:isOpen", open.value);
63
60
  };
@@ -100,7 +97,7 @@ export function useKDropdownLogic(props, emit) {
100
97
  const updatePosition = () => {
101
98
  try {
102
99
  if (props.anchorEl) {
103
- const el = props.anchorEl.$el || props.anchorEl;
100
+ const el = resolveElement(props.anchorEl);
104
101
  if (el && typeof el.getBoundingClientRect === "function") {
105
102
  const rect = el.getBoundingClientRect();
106
103
  const viewportWidth = document.documentElement.clientWidth;
@@ -144,10 +141,13 @@ export function useKDropdownLogic(props, emit) {
144
141
  watch(
145
142
  () => props.isOpen,
146
143
  (newValue) => {
144
+ const requestId = ++openRequestId;
147
145
  if (newValue) {
148
146
  updatePosition();
149
147
  nextTick(() => {
150
- open.value = true;
148
+ if (requestId === openRequestId && props.isOpen) {
149
+ open.value = true;
150
+ }
151
151
  });
152
152
  } else {
153
153
  open.value = false;
@@ -164,6 +164,7 @@ export function useKDropdownLogic(props, emit) {
164
164
  }
165
165
  );
166
166
  onMounted(() => {
167
+ isMounted.value = true;
167
168
  window.addEventListener("scroll", repositionOnScroll, true);
168
169
  window.addEventListener("resize", repositionOnScroll);
169
170
  });