@btst/stack 1.10.0 → 1.12.0

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 (237) hide show
  1. package/dist/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.cjs +1 -1
  2. package/dist/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.mjs +1 -1
  3. package/dist/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.cjs +77 -0
  4. package/dist/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs +79 -3
  5. package/dist/node_modules/.pnpm/@radix-ui_react-avatar@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_850cfbef1935a6e49a6ad6c93c7ca70d/node_modules/@radix-ui/react-avatar/dist/index.cjs +140 -0
  6. package/dist/node_modules/.pnpm/@radix-ui_react-avatar@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_850cfbef1935a6e49a6ad6c93c7ca70d/node_modules/@radix-ui/react-avatar/dist/index.mjs +119 -0
  7. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs +80 -0
  8. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.mjs +64 -0
  9. package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs +18 -0
  10. package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs +16 -0
  11. package/dist/packages/better-stack/src/plugins/kanban/api/plugin.cjs +846 -0
  12. package/dist/packages/better-stack/src/plugins/kanban/api/plugin.mjs +844 -0
  13. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/board-form.cjs +85 -0
  14. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/board-form.mjs +83 -0
  15. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/column-form.cjs +72 -0
  16. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/column-form.mjs +70 -0
  17. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/task-form.cjs +200 -0
  18. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/task-form.mjs +198 -0
  19. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/board-skeleton.cjs +47 -0
  20. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/board-skeleton.mjs +45 -0
  21. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/boards-list-skeleton.cjs +30 -0
  22. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/boards-list-skeleton.mjs +28 -0
  23. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/404-page.cjs +27 -0
  24. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/404-page.mjs +25 -0
  25. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.cjs +31 -0
  26. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.internal.cjs +458 -0
  27. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.internal.mjs +456 -0
  28. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.mjs +29 -0
  29. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.cjs +30 -0
  30. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.internal.cjs +72 -0
  31. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.internal.mjs +70 -0
  32. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.mjs +28 -0
  33. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.cjs +30 -0
  34. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.internal.cjs +51 -0
  35. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.internal.mjs +49 -0
  36. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.mjs +28 -0
  37. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/column-content.cjs +76 -0
  38. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/column-content.mjs +74 -0
  39. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/default-error.cjs +27 -0
  40. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/default-error.mjs +25 -0
  41. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/empty-state.cjs +32 -0
  42. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/empty-state.mjs +30 -0
  43. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/kanban-board.cjs +78 -0
  44. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/kanban-board.mjs +76 -0
  45. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/page-wrapper.cjs +15 -0
  46. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/page-wrapper.mjs +13 -0
  47. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/task-card.cjs +68 -0
  48. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/task-card.mjs +66 -0
  49. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/user-avatar.cjs +32 -0
  50. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/user-avatar.mjs +30 -0
  51. package/dist/packages/better-stack/src/plugins/kanban/client/hooks/kanban-hooks.cjs +391 -0
  52. package/dist/packages/better-stack/src/plugins/kanban/client/hooks/kanban-hooks.mjs +381 -0
  53. package/dist/packages/better-stack/src/plugins/kanban/client/plugin.cjs +290 -0
  54. package/dist/packages/better-stack/src/plugins/kanban/client/plugin.mjs +288 -0
  55. package/dist/packages/better-stack/src/plugins/kanban/db.cjs +125 -0
  56. package/dist/packages/better-stack/src/plugins/kanban/db.mjs +123 -0
  57. package/dist/packages/better-stack/src/plugins/kanban/schemas.cjs +117 -0
  58. package/dist/packages/better-stack/src/plugins/kanban/schemas.mjs +102 -0
  59. package/dist/packages/better-stack/src/plugins/kanban/utils.cjs +49 -0
  60. package/dist/packages/better-stack/src/plugins/kanban/utils.mjs +45 -0
  61. package/dist/packages/ui/src/components/avatar.cjs +58 -0
  62. package/dist/packages/ui/src/components/avatar.mjs +54 -0
  63. package/dist/packages/ui/src/components/command.cjs +3 -3
  64. package/dist/packages/ui/src/components/command.mjs +3 -3
  65. package/dist/packages/ui/src/components/form-builder/index.mjs +2 -2
  66. package/dist/packages/ui/src/components/kanban.cjs +835 -0
  67. package/dist/packages/ui/src/components/kanban.mjs +805 -0
  68. package/dist/packages/ui/src/components/minimal-tiptap/utils.cjs +15 -11
  69. package/dist/packages/ui/src/components/minimal-tiptap/utils.mjs +15 -11
  70. package/dist/packages/ui/src/components/popover.cjs +8 -3
  71. package/dist/packages/ui/src/components/popover.mjs +9 -4
  72. package/dist/packages/ui/src/components/search-select.cjs +75 -0
  73. package/dist/packages/ui/src/components/search-select.mjs +73 -0
  74. package/dist/packages/ui/src/components/ui-builder/index.cjs +9 -7
  75. package/dist/packages/ui/src/components/ui-builder/index.mjs +9 -7
  76. package/dist/packages/ui/src/components/ui-builder/internal/canvas/auto-frame.cjs +6 -3
  77. package/dist/packages/ui/src/components/ui-builder/internal/canvas/auto-frame.mjs +6 -3
  78. package/dist/packages/ui/src/components/ui-builder/internal/components/add-component-popover.cjs +228 -48
  79. package/dist/packages/ui/src/components/ui-builder/internal/components/add-component-popover.mjs +228 -48
  80. package/dist/packages/ui/src/components/ui-builder/internal/components/element-selector.cjs +1 -1
  81. package/dist/packages/ui/src/components/ui-builder/internal/components/element-selector.mjs +1 -1
  82. package/dist/packages/ui/src/components/ui-builder/internal/components/error-fallback.cjs +4 -2
  83. package/dist/packages/ui/src/components/ui-builder/internal/components/error-fallback.mjs +4 -2
  84. package/dist/packages/ui/src/components/ui-builder/internal/components/multi-select.cjs +6 -3
  85. package/dist/packages/ui/src/components/ui-builder/internal/components/multi-select.mjs +6 -3
  86. package/dist/packages/ui/src/components/ui-builder/internal/dnd/draggable-new-component.cjs +67 -0
  87. package/dist/packages/ui/src/components/ui-builder/internal/dnd/draggable-new-component.mjs +62 -0
  88. package/dist/packages/ui/src/components/ui-builder/internal/dnd/drop-zone.cjs +181 -37
  89. package/dist/packages/ui/src/components/ui-builder/internal/dnd/drop-zone.mjs +181 -38
  90. package/dist/packages/ui/src/components/ui-builder/internal/editor-panel.cjs +1 -1
  91. package/dist/packages/ui/src/components/ui-builder/internal/editor-panel.mjs +1 -1
  92. package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-group-control.cjs +1 -1
  93. package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-group-control.mjs +1 -1
  94. package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-item-control.cjs +9 -2
  95. package/dist/packages/ui/src/components/ui-builder/internal/form-fields/classname-control/classname-item-control.mjs +9 -2
  96. package/dist/packages/ui/src/components/ui-builder/internal/form-fields/iconname-field.cjs +3 -2
  97. package/dist/packages/ui/src/components/ui-builder/internal/form-fields/iconname-field.mjs +3 -2
  98. package/dist/packages/ui/src/components/ui-builder/internal/layers-panel.cjs +1 -1
  99. package/dist/packages/ui/src/components/ui-builder/internal/layers-panel.mjs +1 -1
  100. package/dist/packages/ui/src/components/ui-builder/internal/props-panel.cjs +17 -5
  101. package/dist/packages/ui/src/components/ui-builder/internal/props-panel.mjs +17 -5
  102. package/dist/packages/ui/src/components/ui-builder/internal/utils/render-utils.cjs +70 -16
  103. package/dist/packages/ui/src/components/ui-builder/internal/utils/render-utils.mjs +73 -20
  104. package/dist/packages/ui/src/lib/compose-refs.cjs +56 -0
  105. package/dist/packages/ui/src/lib/compose-refs.mjs +39 -0
  106. package/dist/packages/ui/src/lib/ui-builder/context/dnd-context-colission-utils.cjs +14 -9
  107. package/dist/packages/ui/src/lib/ui-builder/context/dnd-context-colission-utils.mjs +14 -9
  108. package/dist/packages/ui/src/lib/ui-builder/context/dnd-context.cjs +38 -10
  109. package/dist/packages/ui/src/lib/ui-builder/context/dnd-context.mjs +35 -11
  110. package/dist/packages/ui/src/lib/ui-builder/context/dnd-contexts.cjs +1 -0
  111. package/dist/packages/ui/src/lib/ui-builder/context/dnd-contexts.mjs +1 -0
  112. package/dist/packages/ui/src/lib/ui-builder/context/drag-overlay.cjs +7 -4
  113. package/dist/packages/ui/src/lib/ui-builder/context/drag-overlay.mjs +7 -4
  114. package/dist/packages/ui/src/lib/ui-builder/hooks/use-auto-scroll.cjs +4 -4
  115. package/dist/packages/ui/src/lib/ui-builder/hooks/use-auto-scroll.mjs +4 -4
  116. package/dist/packages/ui/src/lib/ui-builder/hooks/use-dnd-event-handlers.cjs +53 -16
  117. package/dist/packages/ui/src/lib/ui-builder/hooks/use-dnd-event-handlers.mjs +53 -16
  118. package/dist/packages/ui/src/lib/ui-builder/hooks/use-drop-validation.cjs +23 -7
  119. package/dist/packages/ui/src/lib/ui-builder/hooks/use-drop-validation.mjs +23 -7
  120. package/dist/packages/ui/src/lib/ui-builder/registry/form-field-overrides.cjs +110 -11
  121. package/dist/packages/ui/src/lib/ui-builder/registry/form-field-overrides.mjs +111 -13
  122. package/dist/packages/ui/src/lib/ui-builder/store/editor-store.cjs +3 -2
  123. package/dist/packages/ui/src/lib/ui-builder/store/editor-store.mjs +3 -2
  124. package/dist/packages/ui/src/lib/ui-builder/store/layer-store.cjs +53 -7
  125. package/dist/packages/ui/src/lib/ui-builder/store/layer-store.mjs +54 -8
  126. package/dist/packages/ui/src/lib/ui-builder/store/layer-utils.cjs +4 -3
  127. package/dist/packages/ui/src/lib/ui-builder/store/layer-utils.mjs +4 -3
  128. package/dist/packages/ui/src/lib/ui-builder/utils/variable-resolver.cjs +12 -0
  129. package/dist/packages/ui/src/lib/ui-builder/utils/variable-resolver.mjs +12 -1
  130. package/dist/plugins/blog/api/index.d.cts +1 -1
  131. package/dist/plugins/blog/api/index.d.mts +1 -1
  132. package/dist/plugins/blog/api/index.d.ts +1 -1
  133. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  134. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  135. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  136. package/dist/plugins/blog/client/index.d.cts +1 -1
  137. package/dist/plugins/blog/client/index.d.mts +1 -1
  138. package/dist/plugins/blog/client/index.d.ts +1 -1
  139. package/dist/plugins/blog/query-keys.d.cts +2 -2
  140. package/dist/plugins/blog/query-keys.d.mts +2 -2
  141. package/dist/plugins/blog/query-keys.d.ts +2 -2
  142. package/dist/plugins/kanban/api/index.cjs +7 -0
  143. package/dist/plugins/kanban/api/index.d.cts +403 -0
  144. package/dist/plugins/kanban/api/index.d.mts +403 -0
  145. package/dist/plugins/kanban/api/index.d.ts +403 -0
  146. package/dist/plugins/kanban/api/index.mjs +1 -0
  147. package/dist/plugins/kanban/client/components/index.cjs +35 -0
  148. package/dist/plugins/kanban/client/components/index.d.cts +102 -0
  149. package/dist/plugins/kanban/client/components/index.d.mts +102 -0
  150. package/dist/plugins/kanban/client/components/index.d.ts +102 -0
  151. package/dist/plugins/kanban/client/components/index.mjs +15 -0
  152. package/dist/plugins/kanban/client/hooks/index.cjs +15 -0
  153. package/dist/plugins/kanban/client/hooks/index.d.cts +143 -0
  154. package/dist/plugins/kanban/client/hooks/index.d.mts +143 -0
  155. package/dist/plugins/kanban/client/hooks/index.d.ts +143 -0
  156. package/dist/plugins/kanban/client/hooks/index.mjs +1 -0
  157. package/dist/plugins/kanban/client/index.cjs +7 -0
  158. package/dist/plugins/kanban/client/index.d.cts +196 -0
  159. package/dist/plugins/kanban/client/index.d.mts +196 -0
  160. package/dist/plugins/kanban/client/index.d.ts +196 -0
  161. package/dist/plugins/kanban/client/index.mjs +1 -0
  162. package/dist/plugins/kanban/client.css +68 -0
  163. package/dist/plugins/kanban/query-keys.cjs +105 -0
  164. package/dist/plugins/kanban/query-keys.d.cts +59 -0
  165. package/dist/plugins/kanban/query-keys.d.mts +59 -0
  166. package/dist/plugins/kanban/query-keys.d.ts +59 -0
  167. package/dist/plugins/kanban/query-keys.mjs +103 -0
  168. package/dist/plugins/kanban/style.css +7 -0
  169. package/dist/plugins/ui-builder/client/components/index.d.cts +1 -1
  170. package/dist/plugins/ui-builder/client/components/index.d.mts +1 -1
  171. package/dist/plugins/ui-builder/client/components/index.d.ts +1 -1
  172. package/dist/plugins/ui-builder/client/hooks/index.d.cts +2 -2
  173. package/dist/plugins/ui-builder/client/hooks/index.d.mts +2 -2
  174. package/dist/plugins/ui-builder/client/hooks/index.d.ts +2 -2
  175. package/dist/plugins/ui-builder/client/index.d.cts +17 -7
  176. package/dist/plugins/ui-builder/client/index.d.mts +17 -7
  177. package/dist/plugins/ui-builder/client/index.d.ts +17 -7
  178. package/dist/plugins/ui-builder/index.d.cts +2 -2
  179. package/dist/plugins/ui-builder/index.d.mts +2 -2
  180. package/dist/plugins/ui-builder/index.d.ts +2 -2
  181. package/dist/plugins/ui-builder/style.css +6 -0
  182. package/dist/shared/{stack.BSM2cgoq.d.cts → stack.BYysGdHl.d.cts} +1 -1
  183. package/dist/shared/{stack.CqfZWfjJ.d.cts → stack.BdJFrdyt.d.cts} +8 -2
  184. package/dist/shared/{stack.e1FN86dE.d.mts → stack.ChVuHi5e.d.mts} +8 -2
  185. package/dist/shared/stack.DKDMI-QO.d.cts +70 -0
  186. package/dist/shared/stack.DKDMI-QO.d.mts +70 -0
  187. package/dist/shared/stack.DKDMI-QO.d.ts +70 -0
  188. package/dist/shared/{stack.CLtOoAqF.d.mts → stack.DYCFcnkL.d.mts} +1 -1
  189. package/dist/shared/{stack.MMntCVZZ.d.ts → stack.EhM4pmtN.d.ts} +8 -2
  190. package/dist/shared/stack.FeaWkglm.d.cts +190 -0
  191. package/dist/shared/stack.FeaWkglm.d.mts +190 -0
  192. package/dist/shared/stack.FeaWkglm.d.ts +190 -0
  193. package/dist/shared/{stack.BD1m-4yB.d.ts → stack.kFbDspnF.d.ts} +1 -1
  194. package/package.json +56 -2
  195. package/src/plugins/kanban/api/index.ts +6 -0
  196. package/src/plugins/kanban/api/plugin.ts +1245 -0
  197. package/src/plugins/kanban/client/components/forms/board-form.tsx +108 -0
  198. package/src/plugins/kanban/client/components/forms/column-form.tsx +97 -0
  199. package/src/plugins/kanban/client/components/forms/task-form.tsx +274 -0
  200. package/src/plugins/kanban/client/components/index.tsx +21 -0
  201. package/src/plugins/kanban/client/components/loading/board-skeleton.tsx +49 -0
  202. package/src/plugins/kanban/client/components/loading/boards-list-skeleton.tsx +34 -0
  203. package/src/plugins/kanban/client/components/loading/index.tsx +2 -0
  204. package/src/plugins/kanban/client/components/pages/404-page.tsx +28 -0
  205. package/src/plugins/kanban/client/components/pages/board-page.internal.tsx +575 -0
  206. package/src/plugins/kanban/client/components/pages/board-page.tsx +31 -0
  207. package/src/plugins/kanban/client/components/pages/boards-list-page.internal.tsx +101 -0
  208. package/src/plugins/kanban/client/components/pages/boards-list-page.tsx +26 -0
  209. package/src/plugins/kanban/client/components/pages/new-board-page.internal.tsx +65 -0
  210. package/src/plugins/kanban/client/components/pages/new-board-page.tsx +26 -0
  211. package/src/plugins/kanban/client/components/shared/column-content.tsx +108 -0
  212. package/src/plugins/kanban/client/components/shared/default-error.tsx +32 -0
  213. package/src/plugins/kanban/client/components/shared/empty-state.tsx +37 -0
  214. package/src/plugins/kanban/client/components/shared/kanban-board.tsx +87 -0
  215. package/src/plugins/kanban/client/components/shared/page-wrapper.tsx +20 -0
  216. package/src/plugins/kanban/client/components/shared/task-card.tsx +79 -0
  217. package/src/plugins/kanban/client/components/shared/user-avatar.tsx +63 -0
  218. package/src/plugins/kanban/client/hooks/index.tsx +11 -0
  219. package/src/plugins/kanban/client/hooks/kanban-hooks.tsx +560 -0
  220. package/src/plugins/kanban/client/index.ts +8 -0
  221. package/src/plugins/kanban/client/localization/index.ts +28 -0
  222. package/src/plugins/kanban/client/localization/kanban-common.ts +69 -0
  223. package/src/plugins/kanban/client/localization/kanban-forms.ts +70 -0
  224. package/src/plugins/kanban/client/localization/kanban-list.ts +36 -0
  225. package/src/plugins/kanban/client/overrides.ts +145 -0
  226. package/src/plugins/kanban/client/plugin.tsx +463 -0
  227. package/src/plugins/kanban/client.css +68 -0
  228. package/src/plugins/kanban/db.ts +125 -0
  229. package/src/plugins/kanban/query-keys.ts +154 -0
  230. package/src/plugins/kanban/schemas.ts +143 -0
  231. package/src/plugins/kanban/style.css +7 -0
  232. package/src/plugins/kanban/types.ts +106 -0
  233. package/src/plugins/kanban/utils.ts +107 -0
  234. package/src/plugins/ui-builder/style.css +6 -0
  235. package/dist/shared/{stack.DLhzx1-D.d.mts → stack.CcI4sYJP.d.cts} +1 -1
  236. package/dist/shared/{stack.DLhzx1-D.d.ts → stack.CcI4sYJP.d.mts} +1 -1
  237. package/dist/shared/{stack.DLhzx1-D.d.cts → stack.CcI4sYJP.d.ts} +1 -1
@@ -0,0 +1,381 @@
1
+ "use client";
2
+ import { useQuery, useSuspenseQuery, useQueryClient, useMutation } from '@tanstack/react-query';
3
+ import { createApiClient } from '@btst/stack/plugins/client';
4
+ import { usePluginOverrides } from '@btst/stack/context';
5
+ import { createKanbanQueryKeys } from '../../../../../../../plugins/kanban/query-keys.mjs';
6
+
7
+ function isErrorResponse(response) {
8
+ return typeof response === "object" && response !== null && "error" in response && response.error !== null && response.error !== void 0;
9
+ }
10
+ function toError(error) {
11
+ if (error instanceof Error) {
12
+ return error;
13
+ }
14
+ if (typeof error === "object" && error !== null) {
15
+ const errorObj = error;
16
+ const message = (typeof errorObj.message === "string" ? errorObj.message : null) || (typeof errorObj.error === "string" ? errorObj.error : null) || JSON.stringify(error);
17
+ const err = new Error(message);
18
+ Object.assign(err, error);
19
+ return err;
20
+ }
21
+ return new Error(String(error));
22
+ }
23
+ function useKanbanClient() {
24
+ const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("kanban");
25
+ const client = createApiClient({
26
+ baseURL: apiBaseURL,
27
+ basePath: apiBasePath
28
+ });
29
+ return { client, headers };
30
+ }
31
+ function useBoards(params) {
32
+ const { client, headers } = useKanbanClient();
33
+ const queries = createKanbanQueryKeys(client, headers);
34
+ return useQuery({
35
+ ...queries.boards.list(params),
36
+ staleTime: 3e4
37
+ });
38
+ }
39
+ function useSuspenseBoards(params) {
40
+ const { client, headers } = useKanbanClient();
41
+ const queries = createKanbanQueryKeys(client, headers);
42
+ const result = useSuspenseQuery({
43
+ ...queries.boards.list(params),
44
+ staleTime: 3e4
45
+ });
46
+ if (result.error && !result.isFetching) {
47
+ throw result.error;
48
+ }
49
+ return result;
50
+ }
51
+ function useBoard(boardId) {
52
+ const { client, headers } = useKanbanClient();
53
+ const queries = createKanbanQueryKeys(client, headers);
54
+ return useQuery({
55
+ ...queries.boards.detail(boardId),
56
+ staleTime: 3e4,
57
+ enabled: !!boardId
58
+ });
59
+ }
60
+ function useSuspenseBoard(boardId) {
61
+ const { client, headers } = useKanbanClient();
62
+ const queries = createKanbanQueryKeys(client, headers);
63
+ const result = useSuspenseQuery({
64
+ ...queries.boards.detail(boardId),
65
+ staleTime: 3e4
66
+ });
67
+ if (result.error && !result.isFetching) {
68
+ throw result.error;
69
+ }
70
+ return result;
71
+ }
72
+ function useBoardMutations() {
73
+ const { client, headers } = useKanbanClient();
74
+ const queryClient = useQueryClient();
75
+ const createMutation = useMutation({
76
+ mutationFn: async (data) => {
77
+ const response = await client("@post/boards", {
78
+ method: "POST",
79
+ body: data,
80
+ headers
81
+ });
82
+ if (isErrorResponse(response)) {
83
+ const errorResponse = response;
84
+ throw toError(errorResponse.error);
85
+ }
86
+ return response.data;
87
+ },
88
+ onSuccess: () => {
89
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
90
+ }
91
+ });
92
+ const updateMutation = useMutation({
93
+ mutationFn: async ({
94
+ id,
95
+ data
96
+ }) => {
97
+ const response = await client("@put/boards/:id", {
98
+ method: "PUT",
99
+ params: { id },
100
+ body: data,
101
+ headers
102
+ });
103
+ if (isErrorResponse(response)) {
104
+ const errorResponse = response;
105
+ throw toError(errorResponse.error);
106
+ }
107
+ return response.data;
108
+ },
109
+ onSuccess: () => {
110
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
111
+ }
112
+ });
113
+ const deleteMutation = useMutation({
114
+ mutationFn: async (id) => {
115
+ const response = await client("@delete/boards/:id", {
116
+ method: "DELETE",
117
+ params: { id },
118
+ headers
119
+ });
120
+ if (isErrorResponse(response)) {
121
+ const errorResponse = response;
122
+ throw toError(errorResponse.error);
123
+ }
124
+ return response.data;
125
+ },
126
+ onSuccess: () => {
127
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
128
+ }
129
+ });
130
+ return {
131
+ createBoard: createMutation.mutateAsync,
132
+ updateBoard: (id, data) => updateMutation.mutateAsync({ id, data }),
133
+ deleteBoard: deleteMutation.mutateAsync,
134
+ isCreating: createMutation.isPending,
135
+ isUpdating: updateMutation.isPending,
136
+ isDeleting: deleteMutation.isPending,
137
+ createError: createMutation.error,
138
+ updateError: updateMutation.error,
139
+ deleteError: deleteMutation.error
140
+ };
141
+ }
142
+ function useColumnMutations() {
143
+ const { client, headers } = useKanbanClient();
144
+ const queryClient = useQueryClient();
145
+ const createMutation = useMutation({
146
+ mutationFn: async (data) => {
147
+ const response = await client("@post/columns", {
148
+ method: "POST",
149
+ body: data,
150
+ headers
151
+ });
152
+ if (isErrorResponse(response)) {
153
+ const errorResponse = response;
154
+ throw toError(errorResponse.error);
155
+ }
156
+ return response.data;
157
+ },
158
+ onSuccess: () => {
159
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
160
+ }
161
+ });
162
+ const updateMutation = useMutation({
163
+ mutationFn: async ({
164
+ id,
165
+ data
166
+ }) => {
167
+ const response = await client("@put/columns/:id", {
168
+ method: "PUT",
169
+ params: { id },
170
+ body: data,
171
+ headers
172
+ });
173
+ if (isErrorResponse(response)) {
174
+ const errorResponse = response;
175
+ throw toError(errorResponse.error);
176
+ }
177
+ return response.data;
178
+ },
179
+ onSuccess: () => {
180
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
181
+ }
182
+ });
183
+ const deleteMutation = useMutation({
184
+ mutationFn: async (id) => {
185
+ const response = await client("@delete/columns/:id", {
186
+ method: "DELETE",
187
+ params: { id },
188
+ headers
189
+ });
190
+ if (isErrorResponse(response)) {
191
+ const errorResponse = response;
192
+ throw toError(errorResponse.error);
193
+ }
194
+ return response.data;
195
+ },
196
+ onSuccess: () => {
197
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
198
+ }
199
+ });
200
+ const reorderMutation = useMutation({
201
+ mutationFn: async ({
202
+ boardId,
203
+ columnIds
204
+ }) => {
205
+ const response = await client("@post/columns/reorder", {
206
+ method: "POST",
207
+ body: { boardId, columnIds },
208
+ headers
209
+ });
210
+ if (isErrorResponse(response)) {
211
+ const errorResponse = response;
212
+ throw toError(errorResponse.error);
213
+ }
214
+ return response.data;
215
+ },
216
+ onSuccess: () => {
217
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
218
+ }
219
+ });
220
+ return {
221
+ createColumn: createMutation.mutateAsync,
222
+ updateColumn: (id, data) => updateMutation.mutateAsync({ id, data }),
223
+ deleteColumn: deleteMutation.mutateAsync,
224
+ reorderColumns: (boardId, columnIds) => reorderMutation.mutateAsync({ boardId, columnIds }),
225
+ isCreating: createMutation.isPending,
226
+ isUpdating: updateMutation.isPending,
227
+ isDeleting: deleteMutation.isPending,
228
+ isReordering: reorderMutation.isPending,
229
+ createError: createMutation.error,
230
+ updateError: updateMutation.error,
231
+ deleteError: deleteMutation.error,
232
+ reorderError: reorderMutation.error
233
+ };
234
+ }
235
+ function useTaskMutations() {
236
+ const { client, headers } = useKanbanClient();
237
+ const queryClient = useQueryClient();
238
+ const createMutation = useMutation({
239
+ mutationFn: async (data) => {
240
+ const response = await client("@post/tasks", {
241
+ method: "POST",
242
+ body: data,
243
+ headers
244
+ });
245
+ if (isErrorResponse(response)) {
246
+ const errorResponse = response;
247
+ throw toError(errorResponse.error);
248
+ }
249
+ return response.data;
250
+ },
251
+ onSuccess: () => {
252
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
253
+ }
254
+ });
255
+ const updateMutation = useMutation({
256
+ mutationFn: async ({
257
+ id,
258
+ data
259
+ }) => {
260
+ const response = await client("@put/tasks/:id", {
261
+ method: "PUT",
262
+ params: { id },
263
+ body: data,
264
+ headers
265
+ });
266
+ if (isErrorResponse(response)) {
267
+ const errorResponse = response;
268
+ throw toError(errorResponse.error);
269
+ }
270
+ return response.data;
271
+ },
272
+ onSuccess: () => {
273
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
274
+ }
275
+ });
276
+ const deleteMutation = useMutation({
277
+ mutationFn: async (id) => {
278
+ const response = await client("@delete/tasks/:id", {
279
+ method: "DELETE",
280
+ params: { id },
281
+ headers
282
+ });
283
+ if (isErrorResponse(response)) {
284
+ const errorResponse = response;
285
+ throw toError(errorResponse.error);
286
+ }
287
+ return response.data;
288
+ },
289
+ onSuccess: () => {
290
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
291
+ }
292
+ });
293
+ const moveMutation = useMutation({
294
+ mutationFn: async ({
295
+ taskId,
296
+ targetColumnId,
297
+ targetOrder
298
+ }) => {
299
+ const response = await client("@post/tasks/move", {
300
+ method: "POST",
301
+ body: { taskId, targetColumnId, targetOrder },
302
+ headers
303
+ });
304
+ if (isErrorResponse(response)) {
305
+ const errorResponse = response;
306
+ throw toError(errorResponse.error);
307
+ }
308
+ return response.data;
309
+ },
310
+ onSuccess: () => {
311
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
312
+ }
313
+ });
314
+ const reorderMutation = useMutation({
315
+ mutationFn: async ({
316
+ columnId,
317
+ taskIds
318
+ }) => {
319
+ const response = await client("@post/tasks/reorder", {
320
+ method: "POST",
321
+ body: { columnId, taskIds },
322
+ headers
323
+ });
324
+ if (isErrorResponse(response)) {
325
+ const errorResponse = response;
326
+ throw toError(errorResponse.error);
327
+ }
328
+ return response.data;
329
+ },
330
+ onSuccess: () => {
331
+ queryClient.invalidateQueries({ queryKey: ["boards"] });
332
+ }
333
+ });
334
+ return {
335
+ createTask: createMutation.mutateAsync,
336
+ updateTask: (id, data) => updateMutation.mutateAsync({ id, data }),
337
+ deleteTask: deleteMutation.mutateAsync,
338
+ moveTask: (taskId, targetColumnId, targetOrder) => moveMutation.mutateAsync({ taskId, targetColumnId, targetOrder }),
339
+ reorderTasks: (columnId, taskIds) => reorderMutation.mutateAsync({ columnId, taskIds }),
340
+ isCreating: createMutation.isPending,
341
+ isUpdating: updateMutation.isPending,
342
+ isDeleting: deleteMutation.isPending,
343
+ isMoving: moveMutation.isPending,
344
+ isReordering: reorderMutation.isPending,
345
+ createError: createMutation.error,
346
+ updateError: updateMutation.error,
347
+ deleteError: deleteMutation.error,
348
+ moveError: moveMutation.error,
349
+ reorderError: reorderMutation.error
350
+ };
351
+ }
352
+ function useResolveUser(userId) {
353
+ const { resolveUser } = usePluginOverrides("kanban");
354
+ return useQuery({
355
+ queryKey: ["kanban", "users", userId],
356
+ queryFn: async () => {
357
+ if (!userId) return null;
358
+ const result = await resolveUser(userId);
359
+ return result;
360
+ },
361
+ enabled: !!userId,
362
+ staleTime: 5 * 60 * 1e3,
363
+ // Cache user info for 5 minutes
364
+ gcTime: 10 * 60 * 1e3
365
+ // Keep in cache for 10 minutes
366
+ });
367
+ }
368
+ function useSearchUsers(query, boardId) {
369
+ const { searchUsers } = usePluginOverrides("kanban");
370
+ return useQuery({
371
+ queryKey: ["kanban", "users", "search", query, boardId],
372
+ queryFn: async () => {
373
+ const result = await searchUsers(query, boardId);
374
+ return result;
375
+ },
376
+ staleTime: 3e4
377
+ // Cache search results for 30 seconds
378
+ });
379
+ }
380
+
381
+ export { useBoard, useBoardMutations, useBoards, useColumnMutations, useResolveUser, useSearchUsers, useSuspenseBoard, useSuspenseBoards, useTaskMutations };
@@ -0,0 +1,290 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const client = require('@btst/stack/plugins/client');
5
+ const yar = require('@btst/yar');
6
+ const plugins_kanban_queryKeys = require('../../../../../../plugins/kanban/query-keys.cjs');
7
+ const boardsListPage = require('./components/pages/boards-list-page.cjs');
8
+ const newBoardPage = require('./components/pages/new-board-page.cjs');
9
+ const boardPage = require('./components/pages/board-page.cjs');
10
+
11
+ function createBoardsLoader(config) {
12
+ return async () => {
13
+ if (typeof window === "undefined") {
14
+ const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
15
+ const context = {
16
+ path: "/kanban",
17
+ isSSR: true,
18
+ apiBaseURL,
19
+ apiBasePath,
20
+ headers
21
+ };
22
+ try {
23
+ if (hooks?.beforeLoadBoards) {
24
+ const canLoad = await hooks.beforeLoadBoards(context);
25
+ if (!canLoad) {
26
+ throw new Error("Load prevented by beforeLoadBoards hook");
27
+ }
28
+ }
29
+ const client$1 = client.createApiClient({
30
+ baseURL: apiBaseURL,
31
+ basePath: apiBasePath
32
+ });
33
+ const queries = plugins_kanban_queryKeys.createKanbanQueryKeys(client$1, headers);
34
+ const listQuery = queries.boards.list({});
35
+ await queryClient.prefetchQuery(listQuery);
36
+ if (hooks?.afterLoadBoards) {
37
+ const boards = queryClient.getQueryData(
38
+ listQuery.queryKey
39
+ );
40
+ const canContinue = await hooks.afterLoadBoards(
41
+ boards || null,
42
+ context
43
+ );
44
+ if (canContinue === false) {
45
+ throw new Error("Load prevented by afterLoadBoards hook");
46
+ }
47
+ }
48
+ const queryState = queryClient.getQueryState(listQuery.queryKey);
49
+ if (queryState?.error && hooks?.onLoadError) {
50
+ const error = queryState.error instanceof Error ? queryState.error : new Error(String(queryState.error));
51
+ await hooks.onLoadError(error, context);
52
+ }
53
+ } catch (error) {
54
+ if (hooks?.onLoadError) {
55
+ await hooks.onLoadError(error, context);
56
+ }
57
+ }
58
+ }
59
+ };
60
+ }
61
+ function createBoardLoader(boardId, config) {
62
+ return async () => {
63
+ if (typeof window === "undefined") {
64
+ const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
65
+ const context = {
66
+ path: `/kanban/${boardId}`,
67
+ params: { boardId },
68
+ isSSR: true,
69
+ apiBaseURL,
70
+ apiBasePath,
71
+ headers
72
+ };
73
+ try {
74
+ if (hooks?.beforeLoadBoard) {
75
+ const canLoad = await hooks.beforeLoadBoard(boardId, context);
76
+ if (!canLoad) {
77
+ throw new Error("Load prevented by beforeLoadBoard hook");
78
+ }
79
+ }
80
+ const client$1 = client.createApiClient({
81
+ baseURL: apiBaseURL,
82
+ basePath: apiBasePath
83
+ });
84
+ const queries = plugins_kanban_queryKeys.createKanbanQueryKeys(client$1, headers);
85
+ const boardQuery = queries.boards.detail(boardId);
86
+ await queryClient.prefetchQuery(boardQuery);
87
+ if (hooks?.afterLoadBoard) {
88
+ const board = queryClient.getQueryData(
89
+ boardQuery.queryKey
90
+ );
91
+ const canContinue = await hooks.afterLoadBoard(
92
+ board || null,
93
+ boardId,
94
+ context
95
+ );
96
+ if (canContinue === false) {
97
+ throw new Error("Load prevented by afterLoadBoard hook");
98
+ }
99
+ }
100
+ const queryState = queryClient.getQueryState(boardQuery.queryKey);
101
+ if (queryState?.error && hooks?.onLoadError) {
102
+ const error = queryState.error instanceof Error ? queryState.error : new Error(String(queryState.error));
103
+ await hooks.onLoadError(error, context);
104
+ }
105
+ } catch (error) {
106
+ if (hooks?.onLoadError) {
107
+ await hooks.onLoadError(error, context);
108
+ }
109
+ }
110
+ }
111
+ };
112
+ }
113
+ function createNewBoardLoader(config) {
114
+ return async () => {
115
+ if (typeof window === "undefined") {
116
+ const { apiBasePath, apiBaseURL, hooks, headers } = config;
117
+ const context = {
118
+ path: "/kanban/new",
119
+ isSSR: true,
120
+ apiBaseURL,
121
+ apiBasePath,
122
+ headers
123
+ };
124
+ try {
125
+ if (hooks?.beforeLoadNewBoard) {
126
+ const canLoad = await hooks.beforeLoadNewBoard(context);
127
+ if (!canLoad) {
128
+ throw new Error("Load prevented by beforeLoadNewBoard hook");
129
+ }
130
+ }
131
+ if (hooks?.afterLoadNewBoard) {
132
+ const canContinue = await hooks.afterLoadNewBoard(context);
133
+ if (canContinue === false) {
134
+ throw new Error("Load prevented by afterLoadNewBoard hook");
135
+ }
136
+ }
137
+ } catch (error) {
138
+ if (hooks?.onLoadError) {
139
+ await hooks.onLoadError(error, context);
140
+ }
141
+ }
142
+ }
143
+ };
144
+ }
145
+ function createBoardsListMeta(config) {
146
+ return () => {
147
+ const { siteBaseURL, siteBasePath, seo } = config;
148
+ const fullUrl = `${siteBaseURL}${siteBasePath}/kanban`;
149
+ const title = "Kanban Boards";
150
+ const description = seo?.description || "Manage your projects with kanban boards";
151
+ return [
152
+ { title },
153
+ { name: "title", content: title },
154
+ { name: "description", content: description },
155
+ { name: "robots", content: "index, follow" },
156
+ { property: "og:type", content: "website" },
157
+ { property: "og:title", content: title },
158
+ { property: "og:description", content: description },
159
+ { property: "og:url", content: fullUrl },
160
+ ...seo?.siteName ? [{ property: "og:site_name", content: seo.siteName }] : [],
161
+ ...seo?.locale ? [{ property: "og:locale", content: seo.locale }] : [],
162
+ ...seo?.defaultImage ? [{ property: "og:image", content: seo.defaultImage }] : [],
163
+ { name: "twitter:card", content: "summary" },
164
+ { name: "twitter:title", content: title },
165
+ { name: "twitter:description", content: description }
166
+ ];
167
+ };
168
+ }
169
+ function createBoardMeta(boardId, config) {
170
+ return () => {
171
+ const {
172
+ queryClient,
173
+ apiBaseURL,
174
+ apiBasePath,
175
+ siteBaseURL,
176
+ siteBasePath,
177
+ seo
178
+ } = config;
179
+ const queries = plugins_kanban_queryKeys.createKanbanQueryKeys(
180
+ client.createApiClient({
181
+ baseURL: apiBaseURL,
182
+ basePath: apiBasePath
183
+ })
184
+ );
185
+ const board = queryClient.getQueryData(
186
+ queries.boards.detail(boardId).queryKey
187
+ );
188
+ if (!board) {
189
+ return [
190
+ { title: "Board Not Found" },
191
+ { name: "robots", content: "noindex" }
192
+ ];
193
+ }
194
+ const fullUrl = `${siteBaseURL}${siteBasePath}/kanban/${board.id}`;
195
+ const title = board.name;
196
+ const description = board.description || `Kanban board: ${board.name}`;
197
+ return [
198
+ { title },
199
+ { name: "title", content: title },
200
+ { name: "description", content: description },
201
+ { name: "robots", content: "index, follow" },
202
+ { property: "og:type", content: "website" },
203
+ { property: "og:title", content: title },
204
+ { property: "og:description", content: description },
205
+ { property: "og:url", content: fullUrl },
206
+ ...seo?.siteName ? [{ property: "og:site_name", content: seo.siteName }] : [],
207
+ ...seo?.defaultImage ? [{ property: "og:image", content: seo.defaultImage }] : [],
208
+ { name: "twitter:card", content: "summary" },
209
+ { name: "twitter:title", content: title }
210
+ ];
211
+ };
212
+ }
213
+ function createNewBoardMeta(config) {
214
+ return () => {
215
+ const { siteBaseURL, siteBasePath } = config;
216
+ const fullUrl = `${siteBaseURL}${siteBasePath}/kanban/new`;
217
+ const title = "Create New Board";
218
+ return [
219
+ { title },
220
+ { name: "title", content: title },
221
+ { name: "description", content: "Create a new kanban board" },
222
+ { name: "robots", content: "noindex, nofollow" },
223
+ { property: "og:type", content: "website" },
224
+ { property: "og:title", content: title },
225
+ { property: "og:url", content: fullUrl },
226
+ { name: "twitter:card", content: "summary" },
227
+ { name: "twitter:title", content: title }
228
+ ];
229
+ };
230
+ }
231
+ const kanbanClientPlugin = (config) => client.defineClientPlugin({
232
+ name: "kanban",
233
+ routes: () => ({
234
+ boards: yar.createRoute("/kanban", () => {
235
+ return {
236
+ PageComponent: () => /* @__PURE__ */ jsxRuntime.jsx(boardsListPage.BoardsListPageComponent, {}),
237
+ loader: createBoardsLoader(config),
238
+ meta: createBoardsListMeta(config)
239
+ };
240
+ }),
241
+ newBoard: yar.createRoute("/kanban/new", () => {
242
+ return {
243
+ PageComponent: newBoardPage.NewBoardPageComponent,
244
+ loader: createNewBoardLoader(config),
245
+ meta: createNewBoardMeta(config)
246
+ };
247
+ }),
248
+ board: yar.createRoute("/kanban/:boardId", ({ params: { boardId } }) => {
249
+ return {
250
+ PageComponent: () => /* @__PURE__ */ jsxRuntime.jsx(boardPage.BoardPageComponent, { boardId }),
251
+ loader: createBoardLoader(boardId, config),
252
+ meta: createBoardMeta(boardId, config)
253
+ };
254
+ })
255
+ }),
256
+ sitemap: async () => {
257
+ const origin = `${config.siteBaseURL}${config.siteBasePath}`;
258
+ const indexUrl = `${origin}/kanban`;
259
+ const client$1 = client.createApiClient({
260
+ baseURL: config.apiBaseURL,
261
+ basePath: config.apiBasePath
262
+ });
263
+ let boards = [];
264
+ try {
265
+ const res = await client$1("/boards", {
266
+ method: "GET",
267
+ query: { limit: 100 }
268
+ });
269
+ boards = res.data ?? [];
270
+ } catch {
271
+ }
272
+ const entries = [
273
+ {
274
+ url: indexUrl,
275
+ lastModified: /* @__PURE__ */ new Date(),
276
+ changeFrequency: "daily",
277
+ priority: 0.7
278
+ },
279
+ ...boards.map((b) => ({
280
+ url: `${origin}/kanban/${b.id}`,
281
+ lastModified: b.updatedAt ? new Date(b.updatedAt) : void 0,
282
+ changeFrequency: "weekly",
283
+ priority: 0.6
284
+ }))
285
+ ];
286
+ return entries;
287
+ }
288
+ });
289
+
290
+ exports.kanbanClientPlugin = kanbanClientPlugin;