@btst/stack 2.7.0 → 2.8.1

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 (181) hide show
  1. package/README.md +1 -0
  2. package/dist/packages/stack/src/plugins/blog/client/components/loading/post-navigation-skeleton.cjs +13 -0
  3. package/dist/packages/stack/src/plugins/blog/client/components/loading/post-navigation-skeleton.mjs +11 -0
  4. package/dist/packages/stack/src/plugins/blog/client/components/loading/recent-posts-carousel-skeleton.cjs +17 -0
  5. package/dist/packages/stack/src/plugins/blog/client/components/loading/recent-posts-carousel-skeleton.mjs +15 -0
  6. package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +18 -7
  7. package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +18 -7
  8. package/dist/packages/stack/src/plugins/blog/client/components/shared/post-navigation.cjs +48 -52
  9. package/dist/packages/stack/src/plugins/blog/client/components/shared/post-navigation.mjs +49 -53
  10. package/dist/packages/stack/src/plugins/blog/client/components/shared/recent-posts-carousel.cjs +34 -37
  11. package/dist/packages/stack/src/plugins/blog/client/components/shared/recent-posts-carousel.mjs +35 -38
  12. package/dist/packages/stack/src/plugins/blog/client/hooks/blog-hooks.cjs +4 -21
  13. package/dist/packages/stack/src/plugins/blog/client/hooks/blog-hooks.mjs +4 -21
  14. package/dist/packages/stack/src/plugins/comments/api/getters.cjs +284 -0
  15. package/dist/packages/stack/src/plugins/comments/api/getters.mjs +280 -0
  16. package/dist/packages/stack/src/plugins/comments/api/mutations.cjs +118 -0
  17. package/dist/packages/stack/src/plugins/comments/api/mutations.mjs +112 -0
  18. package/dist/packages/stack/src/plugins/comments/api/plugin.cjs +335 -0
  19. package/dist/packages/stack/src/plugins/comments/api/plugin.mjs +333 -0
  20. package/dist/packages/stack/src/plugins/comments/api/query-key-defs.cjs +60 -0
  21. package/dist/packages/stack/src/plugins/comments/api/query-key-defs.mjs +55 -0
  22. package/dist/packages/stack/src/plugins/comments/api/serializers.cjs +23 -0
  23. package/dist/packages/stack/src/plugins/comments/api/serializers.mjs +21 -0
  24. package/dist/packages/stack/src/plugins/comments/client/components/comment-count.cjs +46 -0
  25. package/dist/packages/stack/src/plugins/comments/client/components/comment-count.mjs +44 -0
  26. package/dist/packages/stack/src/plugins/comments/client/components/comment-form.cjs +86 -0
  27. package/dist/packages/stack/src/plugins/comments/client/components/comment-form.mjs +84 -0
  28. package/dist/packages/stack/src/plugins/comments/client/components/comment-thread.cjs +540 -0
  29. package/dist/packages/stack/src/plugins/comments/client/components/comment-thread.mjs +538 -0
  30. package/dist/packages/stack/src/plugins/comments/client/components/pages/moderation-page.cjs +64 -0
  31. package/dist/packages/stack/src/plugins/comments/client/components/pages/moderation-page.internal.cjs +426 -0
  32. package/dist/packages/stack/src/plugins/comments/client/components/pages/moderation-page.internal.mjs +424 -0
  33. package/dist/packages/stack/src/plugins/comments/client/components/pages/moderation-page.mjs +62 -0
  34. package/dist/packages/stack/src/plugins/comments/client/components/pages/my-comments-page.cjs +66 -0
  35. package/dist/packages/stack/src/plugins/comments/client/components/pages/my-comments-page.internal.cjs +256 -0
  36. package/dist/packages/stack/src/plugins/comments/client/components/pages/my-comments-page.internal.mjs +254 -0
  37. package/dist/packages/stack/src/plugins/comments/client/components/pages/my-comments-page.mjs +64 -0
  38. package/dist/packages/stack/src/plugins/comments/client/components/pages/resource-comments-page.cjs +86 -0
  39. package/dist/packages/stack/src/plugins/comments/client/components/pages/resource-comments-page.internal.cjs +191 -0
  40. package/dist/packages/stack/src/plugins/comments/client/components/pages/resource-comments-page.internal.mjs +189 -0
  41. package/dist/packages/stack/src/plugins/comments/client/components/pages/resource-comments-page.mjs +84 -0
  42. package/dist/packages/stack/src/plugins/comments/client/components/shared/page-wrapper.cjs +27 -0
  43. package/dist/packages/stack/src/plugins/comments/client/components/shared/page-wrapper.mjs +25 -0
  44. package/dist/packages/stack/src/plugins/comments/client/components/shared/pagination.cjs +37 -0
  45. package/dist/packages/stack/src/plugins/comments/client/components/shared/pagination.mjs +35 -0
  46. package/dist/packages/stack/src/plugins/comments/client/hooks/use-comments.cjs +476 -0
  47. package/dist/packages/stack/src/plugins/comments/client/hooks/use-comments.mjs +464 -0
  48. package/dist/packages/stack/src/plugins/comments/client/localization/comments-moderation.cjs +67 -0
  49. package/dist/packages/stack/src/plugins/comments/client/localization/comments-moderation.mjs +65 -0
  50. package/dist/packages/stack/src/plugins/comments/client/localization/comments-my.cjs +27 -0
  51. package/dist/packages/stack/src/plugins/comments/client/localization/comments-my.mjs +25 -0
  52. package/dist/packages/stack/src/plugins/comments/client/localization/comments-thread.cjs +30 -0
  53. package/dist/packages/stack/src/plugins/comments/client/localization/comments-thread.mjs +28 -0
  54. package/dist/packages/stack/src/plugins/comments/client/localization/index.cjs +13 -0
  55. package/dist/packages/stack/src/plugins/comments/client/localization/index.mjs +11 -0
  56. package/dist/packages/stack/src/plugins/comments/client/plugin.cjs +116 -0
  57. package/dist/packages/stack/src/plugins/comments/client/plugin.mjs +114 -0
  58. package/dist/packages/stack/src/plugins/comments/client/utils.cjs +41 -0
  59. package/dist/packages/stack/src/plugins/comments/client/utils.mjs +37 -0
  60. package/dist/packages/stack/src/plugins/comments/db.cjs +75 -0
  61. package/dist/packages/stack/src/plugins/comments/db.mjs +73 -0
  62. package/dist/packages/stack/src/plugins/comments/schemas.cjs +45 -0
  63. package/dist/packages/stack/src/plugins/comments/schemas.mjs +38 -0
  64. package/dist/packages/stack/src/plugins/kanban/client/components/forms/task-form.cjs +0 -1
  65. package/dist/packages/stack/src/plugins/kanban/client/components/forms/task-form.mjs +0 -1
  66. package/dist/packages/stack/src/plugins/kanban/client/components/pages/board-page.internal.cjs +39 -22
  67. package/dist/packages/stack/src/plugins/kanban/client/components/pages/board-page.internal.mjs +40 -23
  68. package/dist/packages/ui/src/components/avatar.mjs +1 -1
  69. package/dist/packages/ui/src/components/pagination-controls.cjs +64 -0
  70. package/dist/packages/ui/src/components/pagination-controls.mjs +62 -0
  71. package/dist/packages/ui/src/components/when-visible.cjs +39 -0
  72. package/dist/packages/ui/src/components/when-visible.mjs +37 -0
  73. package/dist/plugins/blog/client/hooks/index.d.cts +1 -1
  74. package/dist/plugins/blog/client/hooks/index.d.mts +1 -1
  75. package/dist/plugins/blog/client/hooks/index.d.ts +1 -1
  76. package/dist/plugins/blog/client/index.d.cts +24 -2
  77. package/dist/plugins/blog/client/index.d.mts +24 -2
  78. package/dist/plugins/blog/client/index.d.ts +24 -2
  79. package/dist/plugins/comments/api/index.cjs +21 -0
  80. package/dist/plugins/comments/api/index.d.cts +126 -0
  81. package/dist/plugins/comments/api/index.d.mts +126 -0
  82. package/dist/plugins/comments/api/index.d.ts +126 -0
  83. package/dist/plugins/comments/api/index.mjs +5 -0
  84. package/dist/plugins/comments/client/components/index.cjs +15 -0
  85. package/dist/plugins/comments/client/components/index.d.cts +125 -0
  86. package/dist/plugins/comments/client/components/index.d.mts +125 -0
  87. package/dist/plugins/comments/client/components/index.d.ts +125 -0
  88. package/dist/plugins/comments/client/components/index.mjs +5 -0
  89. package/dist/plugins/comments/client/hooks/index.cjs +17 -0
  90. package/dist/plugins/comments/client/hooks/index.d.cts +200 -0
  91. package/dist/plugins/comments/client/hooks/index.d.mts +200 -0
  92. package/dist/plugins/comments/client/hooks/index.d.ts +200 -0
  93. package/dist/plugins/comments/client/hooks/index.mjs +1 -0
  94. package/dist/plugins/comments/client/index.cjs +9 -0
  95. package/dist/plugins/comments/client/index.d.cts +262 -0
  96. package/dist/plugins/comments/client/index.d.mts +262 -0
  97. package/dist/plugins/comments/client/index.d.ts +262 -0
  98. package/dist/plugins/comments/client/index.mjs +2 -0
  99. package/dist/plugins/comments/client.css +2 -0
  100. package/dist/plugins/comments/query-keys.cjs +113 -0
  101. package/dist/plugins/comments/query-keys.d.cts +71 -0
  102. package/dist/plugins/comments/query-keys.d.mts +71 -0
  103. package/dist/plugins/comments/query-keys.d.ts +71 -0
  104. package/dist/plugins/comments/query-keys.mjs +111 -0
  105. package/dist/plugins/comments/style.css +15 -0
  106. package/dist/plugins/kanban/api/index.d.cts +1 -1
  107. package/dist/plugins/kanban/api/index.d.mts +1 -1
  108. package/dist/plugins/kanban/api/index.d.ts +1 -1
  109. package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
  110. package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
  111. package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
  112. package/dist/plugins/kanban/client/index.d.cts +1 -1
  113. package/dist/plugins/kanban/client/index.d.mts +1 -1
  114. package/dist/plugins/kanban/client/index.d.ts +1 -1
  115. package/dist/plugins/kanban/query-keys.d.cts +1 -1
  116. package/dist/plugins/kanban/query-keys.d.mts +1 -1
  117. package/dist/plugins/kanban/query-keys.d.ts +1 -1
  118. package/dist/shared/{stack.FeaWkglm.d.ts → stack.BxFl46lB.d.cts} +24 -1
  119. package/dist/shared/stack.C-b3Sn8j.d.cts +142 -0
  120. package/dist/shared/stack.C-b3Sn8j.d.mts +142 -0
  121. package/dist/shared/stack.C-b3Sn8j.d.ts +142 -0
  122. package/dist/shared/stack.CJE9sAjV.d.ts +335 -0
  123. package/dist/shared/stack.CmHRdhl8.d.cts +335 -0
  124. package/dist/shared/{stack.CNLHlv7r.d.mts → stack.DOZ1EXjM.d.mts} +6 -12
  125. package/dist/shared/{stack.FeaWkglm.d.mts → stack.DRpeDS6X.d.ts} +24 -1
  126. package/dist/shared/{stack.CQAZwXhV.d.cts → stack.DX-tQ93o.d.cts} +6 -12
  127. package/dist/shared/stack.Dcz6636A.d.mts +335 -0
  128. package/dist/shared/{stack.FeaWkglm.d.cts → stack.Jb0kQDJC.d.mts} +24 -1
  129. package/dist/shared/stack.Ldfkr5b2.d.cts +112 -0
  130. package/dist/shared/stack.Ldfkr5b2.d.mts +112 -0
  131. package/dist/shared/stack.Ldfkr5b2.d.ts +112 -0
  132. package/dist/shared/{stack.D3BsrpAz.d.ts → stack.VF6FhyZw.d.ts} +6 -12
  133. package/package.json +69 -4
  134. package/src/plugins/blog/client/components/loading/post-navigation-skeleton.tsx +10 -0
  135. package/src/plugins/blog/client/components/loading/recent-posts-carousel-skeleton.tsx +18 -0
  136. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +23 -8
  137. package/src/plugins/blog/client/components/shared/post-navigation.tsx +0 -5
  138. package/src/plugins/blog/client/components/shared/recent-posts-carousel.tsx +1 -5
  139. package/src/plugins/blog/client/hooks/blog-hooks.tsx +8 -33
  140. package/src/plugins/blog/client/overrides.ts +26 -1
  141. package/src/plugins/cms/client/components/shared/pagination.tsx +14 -42
  142. package/src/plugins/comments/api/getters.ts +444 -0
  143. package/src/plugins/comments/api/index.ts +21 -0
  144. package/src/plugins/comments/api/mutations.ts +206 -0
  145. package/src/plugins/comments/api/plugin.ts +628 -0
  146. package/src/plugins/comments/api/query-key-defs.ts +143 -0
  147. package/src/plugins/comments/api/serializers.ts +37 -0
  148. package/src/plugins/comments/client/components/comment-count.tsx +66 -0
  149. package/src/plugins/comments/client/components/comment-form.tsx +112 -0
  150. package/src/plugins/comments/client/components/comment-thread.tsx +799 -0
  151. package/src/plugins/comments/client/components/index.tsx +11 -0
  152. package/src/plugins/comments/client/components/pages/moderation-page.internal.tsx +550 -0
  153. package/src/plugins/comments/client/components/pages/moderation-page.tsx +70 -0
  154. package/src/plugins/comments/client/components/pages/my-comments-page.internal.tsx +367 -0
  155. package/src/plugins/comments/client/components/pages/my-comments-page.tsx +72 -0
  156. package/src/plugins/comments/client/components/pages/resource-comments-page.internal.tsx +225 -0
  157. package/src/plugins/comments/client/components/pages/resource-comments-page.tsx +97 -0
  158. package/src/plugins/comments/client/components/shared/page-wrapper.tsx +32 -0
  159. package/src/plugins/comments/client/components/shared/pagination.tsx +44 -0
  160. package/src/plugins/comments/client/hooks/index.tsx +13 -0
  161. package/src/plugins/comments/client/hooks/use-comments.tsx +717 -0
  162. package/src/plugins/comments/client/index.ts +14 -0
  163. package/src/plugins/comments/client/localization/comments-moderation.ts +75 -0
  164. package/src/plugins/comments/client/localization/comments-my.ts +32 -0
  165. package/src/plugins/comments/client/localization/comments-thread.ts +32 -0
  166. package/src/plugins/comments/client/localization/index.ts +11 -0
  167. package/src/plugins/comments/client/overrides.ts +164 -0
  168. package/src/plugins/comments/client/plugin.tsx +195 -0
  169. package/src/plugins/comments/client/utils.ts +67 -0
  170. package/src/plugins/comments/client.css +2 -0
  171. package/src/plugins/comments/db.ts +77 -0
  172. package/src/plugins/comments/query-keys.ts +189 -0
  173. package/src/plugins/comments/schemas.ts +72 -0
  174. package/src/plugins/comments/style.css +15 -0
  175. package/src/plugins/comments/types.ts +73 -0
  176. package/src/plugins/kanban/client/components/forms/task-form.tsx +0 -1
  177. package/src/plugins/kanban/client/components/pages/board-page.internal.tsx +46 -27
  178. package/src/plugins/kanban/client/overrides.ts +27 -1
  179. package/dist/shared/{stack.Rtcvl8sS.d.cts → stack.BOokfhZD.d.cts} +3 -3
  180. package/dist/shared/{stack.D4Cea8II.d.ts → stack.BvCR4-9H.d.ts} +3 -3
  181. package/dist/shared/{stack.HE_IvqV5.d.mts → stack.CWxAl9K3.d.mts} +3 -3
@@ -23,7 +23,11 @@ function BoardPage({ boardId }) {
23
23
  if (error && !isFetching) {
24
24
  throw error;
25
25
  }
26
- const { Link: OverrideLink, navigate: overrideNavigate } = context.usePluginOverrides("kanban");
26
+ const {
27
+ Link: OverrideLink,
28
+ navigate: overrideNavigate,
29
+ taskDetailBottomSlot
30
+ } = context.usePluginOverrides("kanban");
27
31
  const navigate = overrideNavigate || ((path) => {
28
32
  window.location.href = path;
29
33
  });
@@ -422,31 +426,44 @@ function BoardPage({ boardId }) {
422
426
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { children: "Edit Task" }),
423
427
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogDescription, { children: "Update task details." })
424
428
  ] }),
425
- modalState.type === "editTask" && /* @__PURE__ */ jsxRuntime.jsx(
426
- taskForm.TaskForm,
427
- {
428
- columnId: modalState.columnId,
429
- boardId,
430
- taskId: modalState.taskId,
431
- task: board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId),
432
- columns: board.columns || [],
433
- onClose: closeModal,
434
- onSuccess: () => {
435
- closeModal();
436
- refetch();
437
- },
438
- onDelete: async () => {
439
- try {
440
- await deleteTask(modalState.taskId);
429
+ modalState.type === "editTask" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
430
+ /* @__PURE__ */ jsxRuntime.jsx(
431
+ taskForm.TaskForm,
432
+ {
433
+ columnId: modalState.columnId,
434
+ boardId,
435
+ taskId: modalState.taskId,
436
+ task: board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId),
437
+ columns: board.columns || [],
438
+ onClose: closeModal,
439
+ onSuccess: () => {
441
440
  closeModal();
442
441
  refetch();
443
- } catch (error2) {
444
- const message = error2 instanceof Error ? error2.message : "Failed to delete task";
445
- sonner.toast.error(message);
442
+ },
443
+ onDelete: async () => {
444
+ try {
445
+ await deleteTask(modalState.taskId);
446
+ closeModal();
447
+ refetch();
448
+ } catch (error2) {
449
+ const message = error2 instanceof Error ? error2.message : "Failed to delete task";
450
+ sonner.toast.error(message);
451
+ }
446
452
  }
447
453
  }
448
- }
449
- )
454
+ ),
455
+ taskDetailBottomSlot && (() => {
456
+ const task = board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId);
457
+ return task ? /* @__PURE__ */ jsxRuntime.jsx(
458
+ "div",
459
+ {
460
+ className: "mt-4 pt-4 border-t",
461
+ "data-testid": "task-detail-bottom-slot",
462
+ children: taskDetailBottomSlot(task)
463
+ }
464
+ ) : null;
465
+ })()
466
+ ] })
450
467
  ] })
451
468
  }
452
469
  )
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { useState, useCallback, useMemo, useEffect } from 'react';
4
4
  import { ArrowLeft, Settings, Plus, Pencil, Trash2 } from 'lucide-react';
5
5
  import { toast } from 'sonner';
@@ -21,7 +21,11 @@ function BoardPage({ boardId }) {
21
21
  if (error && !isFetching) {
22
22
  throw error;
23
23
  }
24
- const { Link: OverrideLink, navigate: overrideNavigate } = usePluginOverrides("kanban");
24
+ const {
25
+ Link: OverrideLink,
26
+ navigate: overrideNavigate,
27
+ taskDetailBottomSlot
28
+ } = usePluginOverrides("kanban");
25
29
  const navigate = overrideNavigate || ((path) => {
26
30
  window.location.href = path;
27
31
  });
@@ -420,31 +424,44 @@ function BoardPage({ boardId }) {
420
424
  /* @__PURE__ */ jsx(DialogTitle, { children: "Edit Task" }),
421
425
  /* @__PURE__ */ jsx(DialogDescription, { children: "Update task details." })
422
426
  ] }),
423
- modalState.type === "editTask" && /* @__PURE__ */ jsx(
424
- TaskForm,
425
- {
426
- columnId: modalState.columnId,
427
- boardId,
428
- taskId: modalState.taskId,
429
- task: board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId),
430
- columns: board.columns || [],
431
- onClose: closeModal,
432
- onSuccess: () => {
433
- closeModal();
434
- refetch();
435
- },
436
- onDelete: async () => {
437
- try {
438
- await deleteTask(modalState.taskId);
427
+ modalState.type === "editTask" && /* @__PURE__ */ jsxs(Fragment, { children: [
428
+ /* @__PURE__ */ jsx(
429
+ TaskForm,
430
+ {
431
+ columnId: modalState.columnId,
432
+ boardId,
433
+ taskId: modalState.taskId,
434
+ task: board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId),
435
+ columns: board.columns || [],
436
+ onClose: closeModal,
437
+ onSuccess: () => {
439
438
  closeModal();
440
439
  refetch();
441
- } catch (error2) {
442
- const message = error2 instanceof Error ? error2.message : "Failed to delete task";
443
- toast.error(message);
440
+ },
441
+ onDelete: async () => {
442
+ try {
443
+ await deleteTask(modalState.taskId);
444
+ closeModal();
445
+ refetch();
446
+ } catch (error2) {
447
+ const message = error2 instanceof Error ? error2.message : "Failed to delete task";
448
+ toast.error(message);
449
+ }
444
450
  }
445
451
  }
446
- }
447
- )
452
+ ),
453
+ taskDetailBottomSlot && (() => {
454
+ const task = board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId);
455
+ return task ? /* @__PURE__ */ jsx(
456
+ "div",
457
+ {
458
+ className: "mt-4 pt-4 border-t",
459
+ "data-testid": "task-detail-bottom-slot",
460
+ children: taskDetailBottomSlot(task)
461
+ }
462
+ ) : null;
463
+ })()
464
+ ] })
448
465
  ] })
449
466
  }
450
467
  )
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { Root, Fallback, Image } from '../../../../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';
3
+ import { Root, Image, Fallback } from '../../../../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';
4
4
  import { cn } from '../lib/utils.mjs';
5
5
 
6
6
  function Avatar({
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const button = require('./button.cjs');
6
+ const LucideIcons = require('lucide-react');
7
+
8
+ function PaginationControls({
9
+ currentPage,
10
+ totalPages,
11
+ total,
12
+ limit,
13
+ offset,
14
+ onPageChange,
15
+ labels
16
+ }) {
17
+ const previous = labels?.previous ?? "Previous";
18
+ const next = labels?.next ?? "Next";
19
+ const showingTemplate = labels?.showing ?? "Showing {from}\u2013{to} of {total}";
20
+ const from = offset + 1;
21
+ const to = Math.min(offset + limit, total);
22
+ const showingText = showingTemplate.replace("{from}", String(from)).replace("{to}", String(to)).replace("{total}", String(total));
23
+ if (totalPages <= 1) {
24
+ return null;
25
+ }
26
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-t", children: [
27
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: showingText }),
28
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
29
+ /* @__PURE__ */ jsxRuntime.jsxs(
30
+ button.Button,
31
+ {
32
+ variant: "outline",
33
+ size: "sm",
34
+ onClick: () => onPageChange(currentPage - 1),
35
+ disabled: currentPage === 1,
36
+ children: [
37
+ /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronLeft, { className: "h-4 w-4 mr-1" }),
38
+ previous
39
+ ]
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [
43
+ currentPage,
44
+ " / ",
45
+ totalPages
46
+ ] }),
47
+ /* @__PURE__ */ jsxRuntime.jsxs(
48
+ button.Button,
49
+ {
50
+ variant: "outline",
51
+ size: "sm",
52
+ onClick: () => onPageChange(currentPage + 1),
53
+ disabled: currentPage === totalPages,
54
+ children: [
55
+ next,
56
+ /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronRight, { className: "h-4 w-4 ml-1" })
57
+ ]
58
+ }
59
+ )
60
+ ] })
61
+ ] });
62
+ }
63
+
64
+ exports.PaginationControls = PaginationControls;
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { Button } from './button.mjs';
4
+ import { ChevronLeft, ChevronRight } from 'lucide-react';
5
+
6
+ function PaginationControls({
7
+ currentPage,
8
+ totalPages,
9
+ total,
10
+ limit,
11
+ offset,
12
+ onPageChange,
13
+ labels
14
+ }) {
15
+ const previous = labels?.previous ?? "Previous";
16
+ const next = labels?.next ?? "Next";
17
+ const showingTemplate = labels?.showing ?? "Showing {from}\u2013{to} of {total}";
18
+ const from = offset + 1;
19
+ const to = Math.min(offset + limit, total);
20
+ const showingText = showingTemplate.replace("{from}", String(from)).replace("{to}", String(to)).replace("{total}", String(total));
21
+ if (totalPages <= 1) {
22
+ return null;
23
+ }
24
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-t", children: [
25
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: showingText }),
26
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
27
+ /* @__PURE__ */ jsxs(
28
+ Button,
29
+ {
30
+ variant: "outline",
31
+ size: "sm",
32
+ onClick: () => onPageChange(currentPage - 1),
33
+ disabled: currentPage === 1,
34
+ children: [
35
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4 mr-1" }),
36
+ previous
37
+ ]
38
+ }
39
+ ),
40
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
41
+ currentPage,
42
+ " / ",
43
+ totalPages
44
+ ] }),
45
+ /* @__PURE__ */ jsxs(
46
+ Button,
47
+ {
48
+ variant: "outline",
49
+ size: "sm",
50
+ onClick: () => onPageChange(currentPage + 1),
51
+ disabled: currentPage === totalPages,
52
+ children: [
53
+ next,
54
+ /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 ml-1" })
55
+ ]
56
+ }
57
+ )
58
+ ] })
59
+ ] });
60
+ }
61
+
62
+ export { PaginationControls };
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const React = require('react');
6
+
7
+ function WhenVisible({
8
+ children,
9
+ fallback = null,
10
+ threshold = 0,
11
+ rootMargin = "200px",
12
+ className
13
+ }) {
14
+ const [isVisible, setIsVisible] = React.useState(false);
15
+ const sentinelRef = React.useRef(null);
16
+ React.useEffect(() => {
17
+ const el = sentinelRef.current;
18
+ if (!el) return;
19
+ if (typeof IntersectionObserver === "undefined") {
20
+ setIsVisible(true);
21
+ return;
22
+ }
23
+ const observer = new IntersectionObserver(
24
+ (entries) => {
25
+ const entry = entries[0];
26
+ if (entry?.isIntersecting) {
27
+ setIsVisible(true);
28
+ observer.disconnect();
29
+ }
30
+ },
31
+ { threshold, rootMargin }
32
+ );
33
+ observer.observe(el);
34
+ return () => observer.disconnect();
35
+ }, [threshold, rootMargin]);
36
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: sentinelRef, className, children: isVisible ? children : fallback });
37
+ }
38
+
39
+ exports.WhenVisible = WhenVisible;
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useState, useRef, useEffect } from 'react';
4
+
5
+ function WhenVisible({
6
+ children,
7
+ fallback = null,
8
+ threshold = 0,
9
+ rootMargin = "200px",
10
+ className
11
+ }) {
12
+ const [isVisible, setIsVisible] = useState(false);
13
+ const sentinelRef = useRef(null);
14
+ useEffect(() => {
15
+ const el = sentinelRef.current;
16
+ if (!el) return;
17
+ if (typeof IntersectionObserver === "undefined") {
18
+ setIsVisible(true);
19
+ return;
20
+ }
21
+ const observer = new IntersectionObserver(
22
+ (entries) => {
23
+ const entry = entries[0];
24
+ if (entry?.isIntersecting) {
25
+ setIsVisible(true);
26
+ observer.disconnect();
27
+ }
28
+ },
29
+ { threshold, rootMargin }
30
+ );
31
+ observer.observe(el);
32
+ return () => observer.disconnect();
33
+ }, [threshold, rootMargin]);
34
+ return /* @__PURE__ */ jsx("div", { ref: sentinelRef, className, children: isVisible ? children : fallback });
35
+ }
36
+
37
+ export { WhenVisible };
@@ -1,4 +1,4 @@
1
- export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.CQAZwXhV.cjs';
1
+ export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.DX-tQ93o.cjs';
2
2
  import '@tanstack/react-query';
3
3
  import '../../../../shared/stack.BWp0hcm9.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.CNLHlv7r.mjs';
1
+ export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.DOZ1EXjM.mjs';
2
2
  import '@tanstack/react-query';
3
3
  import '../../../../shared/stack.BWp0hcm9.mjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.D3BsrpAz.js';
1
+ export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.VF6FhyZw.js';
2
2
  import '@tanstack/react-query';
3
3
  import '../../../../shared/stack.BWp0hcm9.js';
4
4
  import 'zod';
@@ -1,9 +1,9 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as _btst_yar from '@btst/yar';
3
- import { ComponentType } from 'react';
3
+ import { ComponentType, ReactNode } from 'react';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import { P as Post, S as SerializedPost } from '../../../shared/stack.BWp0hcm9.cjs';
6
- export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.CQAZwXhV.cjs';
6
+ export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.DX-tQ93o.cjs';
7
7
  import 'zod';
8
8
 
9
9
  /**
@@ -503,6 +503,28 @@ interface BlogPluginOverrides {
503
503
  * @param context - Route context
504
504
  */
505
505
  onBeforeDraftsPageRendered?: (context: RouteContext) => boolean;
506
+ /**
507
+ * Optional slot rendered below the blog post body.
508
+ * Use this to inject a comment thread or any custom content without
509
+ * coupling the blog plugin to the comments plugin.
510
+ *
511
+ * @example
512
+ * ```tsx
513
+ * blog: {
514
+ * postBottomSlot: (post) => (
515
+ * <CommentThread
516
+ * resourceId={post.slug}
517
+ * resourceType="blog-post"
518
+ * apiBaseURL={apiBaseURL}
519
+ * apiBasePath="/api/data"
520
+ * currentUserId={session?.userId}
521
+ * loginHref="/login"
522
+ * />
523
+ * ),
524
+ * }
525
+ * ```
526
+ */
527
+ postBottomSlot?: (post: SerializedPost) => ReactNode;
506
528
  }
507
529
 
508
530
  export { blogClientPlugin };
@@ -1,9 +1,9 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as _btst_yar from '@btst/yar';
3
- import { ComponentType } from 'react';
3
+ import { ComponentType, ReactNode } from 'react';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import { P as Post, S as SerializedPost } from '../../../shared/stack.BWp0hcm9.mjs';
6
- export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.CNLHlv7r.mjs';
6
+ export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.DOZ1EXjM.mjs';
7
7
  import 'zod';
8
8
 
9
9
  /**
@@ -503,6 +503,28 @@ interface BlogPluginOverrides {
503
503
  * @param context - Route context
504
504
  */
505
505
  onBeforeDraftsPageRendered?: (context: RouteContext) => boolean;
506
+ /**
507
+ * Optional slot rendered below the blog post body.
508
+ * Use this to inject a comment thread or any custom content without
509
+ * coupling the blog plugin to the comments plugin.
510
+ *
511
+ * @example
512
+ * ```tsx
513
+ * blog: {
514
+ * postBottomSlot: (post) => (
515
+ * <CommentThread
516
+ * resourceId={post.slug}
517
+ * resourceType="blog-post"
518
+ * apiBaseURL={apiBaseURL}
519
+ * apiBasePath="/api/data"
520
+ * currentUserId={session?.userId}
521
+ * loginHref="/login"
522
+ * />
523
+ * ),
524
+ * }
525
+ * ```
526
+ */
527
+ postBottomSlot?: (post: SerializedPost) => ReactNode;
506
528
  }
507
529
 
508
530
  export { blogClientPlugin };
@@ -1,9 +1,9 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as _btst_yar from '@btst/yar';
3
- import { ComponentType } from 'react';
3
+ import { ComponentType, ReactNode } from 'react';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import { P as Post, S as SerializedPost } from '../../../shared/stack.BWp0hcm9.js';
6
- export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.D3BsrpAz.js';
6
+ export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.VF6FhyZw.js';
7
7
  import 'zod';
8
8
 
9
9
  /**
@@ -503,6 +503,28 @@ interface BlogPluginOverrides {
503
503
  * @param context - Route context
504
504
  */
505
505
  onBeforeDraftsPageRendered?: (context: RouteContext) => boolean;
506
+ /**
507
+ * Optional slot rendered below the blog post body.
508
+ * Use this to inject a comment thread or any custom content without
509
+ * coupling the blog plugin to the comments plugin.
510
+ *
511
+ * @example
512
+ * ```tsx
513
+ * blog: {
514
+ * postBottomSlot: (post) => (
515
+ * <CommentThread
516
+ * resourceId={post.slug}
517
+ * resourceType="blog-post"
518
+ * apiBaseURL={apiBaseURL}
519
+ * apiBasePath="/api/data"
520
+ * currentUserId={session?.userId}
521
+ * loginHref="/login"
522
+ * />
523
+ * ),
524
+ * }
525
+ * ```
526
+ */
527
+ postBottomSlot?: (post: SerializedPost) => ReactNode;
506
528
  }
507
529
 
508
530
  export { blogClientPlugin };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ const plugin = require('../../../packages/stack/src/plugins/comments/api/plugin.cjs');
4
+ const getters = require('../../../packages/stack/src/plugins/comments/api/getters.cjs');
5
+ const mutations = require('../../../packages/stack/src/plugins/comments/api/mutations.cjs');
6
+ const serializers = require('../../../packages/stack/src/plugins/comments/api/serializers.cjs');
7
+ const queryKeyDefs = require('../../../packages/stack/src/plugins/comments/api/query-key-defs.cjs');
8
+
9
+
10
+
11
+ exports.commentsBackendPlugin = plugin.commentsBackendPlugin;
12
+ exports.getCommentById = getters.getCommentById;
13
+ exports.getCommentCount = getters.getCommentCount;
14
+ exports.listComments = getters.listComments;
15
+ exports.createComment = mutations.createComment;
16
+ exports.deleteComment = mutations.deleteComment;
17
+ exports.toggleCommentLike = mutations.toggleCommentLike;
18
+ exports.updateComment = mutations.updateComment;
19
+ exports.updateCommentStatus = mutations.updateCommentStatus;
20
+ exports.serializeComment = serializers.serializeComment;
21
+ exports.COMMENTS_QUERY_KEYS = queryKeyDefs.COMMENTS_QUERY_KEYS;