@commentkit/comment-kit 0.0.0-stage → 0.6.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 (207) hide show
  1. package/CHANGELOG.md +276 -0
  2. package/LICENSE +18 -0
  3. package/README.md +766 -2
  4. package/dist/angular/ShadowRootContext-2BrAO1qU.js +7 -0
  5. package/dist/angular/chunk-Cyg4N8Ue.js +11 -0
  6. package/dist/angular/comment-kit-ui-wEJfMh4T.js +9483 -0
  7. package/dist/angular/dom-ON-u4y6t.js +97 -0
  8. package/dist/angular/error-boundary-CxhCm8iF.js +21 -0
  9. package/dist/angular/limits-AEqOBweE.js +71 -0
  10. package/dist/angular/mount-ui-CxChSb8B.js +55 -0
  11. package/dist/angular/pusher-Vs-W-c8I.js +2504 -0
  12. package/dist/angular/realtime-CfJZMEAi.js +558 -0
  13. package/dist/angular/shadow-root-C7wgghDv.js +86 -0
  14. package/dist/angular/styles-CvndAWRF.js +2 -0
  15. package/dist/angular.es.js +3656 -0
  16. package/dist/comment-kit.es.js +3361 -0
  17. package/dist/core/ShadowRootContext--ArKkwbH.js +7 -0
  18. package/dist/core/chunk-t7YoJN_i.js +11 -0
  19. package/dist/core/comment-kit-ui-DjWARy4X.js +9483 -0
  20. package/dist/core/dom-x9svfpMk.js +223 -0
  21. package/dist/core/error-boundary-CN_BGsYl.js +21 -0
  22. package/dist/core/mount-ui-DrFjMJJu.js +55 -0
  23. package/dist/core/pusher-CizoY5NA.js +2504 -0
  24. package/dist/core/realtime-DYf6E_sN.js +278 -0
  25. package/dist/core/shadow-root-09zwHxly.js +86 -0
  26. package/dist/core/styles-D19zARBi.js +2 -0
  27. package/dist/core/websocket-manager-DorGPjR4.js +351 -0
  28. package/dist/preact/ShadowRootContext-CJWLIRy4.js +7 -0
  29. package/dist/preact/chunk-CZ0PdaaN.js +11 -0
  30. package/dist/preact/comment-kit-ui-BKi15Z4Q.js +9483 -0
  31. package/dist/preact/dom-BAV8grk_.js +97 -0
  32. package/dist/preact/error-boundary-B4-Bfy3g.js +21 -0
  33. package/dist/preact/limits-C3ZEKcL_.js +71 -0
  34. package/dist/preact/mount-ui-b9JcJQYE.js +55 -0
  35. package/dist/preact/pusher-BP4kCufH.js +2504 -0
  36. package/dist/preact/realtime-BFgP4BlB.js +558 -0
  37. package/dist/preact/shadow-root-DAhpHo_W.js +86 -0
  38. package/dist/preact/styles-Dwd4AJR8.js +2 -0
  39. package/dist/preact.es.js +3465 -0
  40. package/dist/qwik/ShadowRootContext-CTbULRKq.js +7 -0
  41. package/dist/qwik/chunk-CKKKzG2Q.js +11 -0
  42. package/dist/qwik/comment-kit-ui-CRmJhZlX.js +9483 -0
  43. package/dist/qwik/dom-BjJ-QroQ.js +97 -0
  44. package/dist/qwik/error-boundary-C4hlYQwS.js +21 -0
  45. package/dist/qwik/limits-DK35yjGY.js +71 -0
  46. package/dist/qwik/mount-ui-CaRrLb9u.js +55 -0
  47. package/dist/qwik/pusher-B1KgC4iB.js +2504 -0
  48. package/dist/qwik/realtime-DUhkZAVc.js +558 -0
  49. package/dist/qwik/shadow-root-tLjXys-_.js +86 -0
  50. package/dist/qwik/styles-BB1B91hh.js +2 -0
  51. package/dist/qwik.es.js +3458 -0
  52. package/dist/react/chunk--MHYZ-zp.js +12 -0
  53. package/dist/react/limits-Dflmuf1P.js +168 -0
  54. package/dist/react/pusher-3dki8s2l.js +2505 -0
  55. package/dist/react/realtime-C7h-Agwo.js +558 -0
  56. package/dist/react.es.js +13010 -0
  57. package/dist/solid/ShadowRootContext-BS6MCclL.js +7 -0
  58. package/dist/solid/chunk-B2NCWFvW.js +11 -0
  59. package/dist/solid/comment-kit-ui-Dw_67h_e.js +9483 -0
  60. package/dist/solid/dom-Bpw1A0oz.js +97 -0
  61. package/dist/solid/error-boundary-9mimpbZA.js +21 -0
  62. package/dist/solid/limits-B_69IbLl.js +71 -0
  63. package/dist/solid/mount-ui-bPWYgjmm.js +55 -0
  64. package/dist/solid/pusher-_RVNpj1f.js +2504 -0
  65. package/dist/solid/realtime-DK86zDCJ.js +558 -0
  66. package/dist/solid/shadow-root-D5nErAFI.js +86 -0
  67. package/dist/solid/styles-CtYBghRP.js +2 -0
  68. package/dist/solid.es.js +3446 -0
  69. package/dist/svelte/ShadowRootContext-DhByMr-q.js +7 -0
  70. package/dist/svelte/chunk-Pi70BKld.js +11 -0
  71. package/dist/svelte/comment-kit-ui-DhCWlEd8.js +9483 -0
  72. package/dist/svelte/dom-mfioQqLy.js +97 -0
  73. package/dist/svelte/error-boundary-C3GWI_IX.js +21 -0
  74. package/dist/svelte/limits-CURF22v3.js +71 -0
  75. package/dist/svelte/mount-ui-DtXWMEYn.js +55 -0
  76. package/dist/svelte/pusher-DN1BiUDw.js +2504 -0
  77. package/dist/svelte/realtime-zYOctwRk.js +558 -0
  78. package/dist/svelte/shadow-root-Cz-v-rYe.js +86 -0
  79. package/dist/svelte/styles-DKCGeARl.js +2 -0
  80. package/dist/svelte.es.js +3478 -0
  81. package/dist/types/adapters/bridge.d.ts +125 -0
  82. package/dist/types/adapters/errors.d.ts +3 -0
  83. package/dist/types/angular/index.d.ts +135 -0
  84. package/dist/types/core/agent-context.d.ts +17 -0
  85. package/dist/types/core/api-client.d.ts +137 -0
  86. package/dist/types/core/auth.d.ts +18 -0
  87. package/dist/types/core/comment-kit-core.d.ts +215 -0
  88. package/dist/types/core/comments.d.ts +43 -0
  89. package/dist/types/core/dev-grab.d.ts +14 -0
  90. package/dist/types/core/keyboard.d.ts +12 -0
  91. package/dist/types/core/limits.d.ts +52 -0
  92. package/dist/types/core/offline-queue.d.ts +23 -0
  93. package/dist/types/core/realtime.d.ts +9 -0
  94. package/dist/types/core/screenshot.d.ts +12 -0
  95. package/dist/types/core/session.d.ts +9 -0
  96. package/dist/types/core/source-resolver.d.ts +19 -0
  97. package/dist/types/core/state.d.ts +24 -0
  98. package/dist/types/core/types.d.ts +610 -0
  99. package/dist/types/core/websocket-manager.d.ts +107 -0
  100. package/dist/types/index.d.ts +85 -0
  101. package/dist/types/preact/index.d.ts +25 -0
  102. package/dist/types/qwik/index.d.ts +70 -0
  103. package/dist/types/react/client.d.ts +31 -0
  104. package/dist/types/react/comment-kit-ui.d.ts +9 -0
  105. package/dist/types/react/components/comment-fab.d.ts +34 -0
  106. package/dist/types/react/components/dev-export-panel.d.ts +10 -0
  107. package/dist/types/react/components/element-selector.d.ts +11 -0
  108. package/dist/types/react/components/live-region.d.ts +16 -0
  109. package/dist/types/react/components/screenshot-capture.d.ts +17 -0
  110. package/dist/types/react/components/status-indicator.d.ts +43 -0
  111. package/dist/types/react/error-boundary.d.ts +25 -0
  112. package/dist/types/react/index.d.ts +4 -0
  113. package/dist/types/react/is-local-host.d.ts +2 -0
  114. package/dist/types/react/mount-ui.d.ts +19 -0
  115. package/dist/types/react/shadow-root.d.ts +23 -0
  116. package/dist/types/react/shims/use-sync-external-store-with-selector.d.ts +4 -0
  117. package/dist/types/react/shims/use-sync-external-store.d.ts +1 -0
  118. package/dist/types/react/ui/lib/ShadowRootContext.d.ts +10 -0
  119. package/dist/types/react/ui/lib/cn.d.ts +12 -0
  120. package/dist/types/react/ui/primitives/alert-dialog/alert-dialog.d.ts +23 -0
  121. package/dist/types/react/ui/primitives/alert-dialog/index.d.ts +1 -0
  122. package/dist/types/react/ui/primitives/avatar/avatar.d.ts +10 -0
  123. package/dist/types/react/ui/primitives/avatar/index.d.ts +1 -0
  124. package/dist/types/react/ui/primitives/badge/badge.d.ts +5 -0
  125. package/dist/types/react/ui/primitives/badge/index.d.ts +1 -0
  126. package/dist/types/react/ui/primitives/button/button.d.ts +6 -0
  127. package/dist/types/react/ui/primitives/button/index.d.ts +1 -0
  128. package/dist/types/react/ui/primitives/card/card.d.ts +11 -0
  129. package/dist/types/react/ui/primitives/card/index.d.ts +1 -0
  130. package/dist/types/react/ui/primitives/checkbox/checkbox.d.ts +3 -0
  131. package/dist/types/react/ui/primitives/checkbox/index.d.ts +1 -0
  132. package/dist/types/react/ui/primitives/dialog/dialog.d.ts +17 -0
  133. package/dist/types/react/ui/primitives/dialog/index.d.ts +1 -0
  134. package/dist/types/react/ui/primitives/dropdown-menu/dropdown-menu.d.ts +29 -0
  135. package/dist/types/react/ui/primitives/dropdown-menu/index.d.ts +1 -0
  136. package/dist/types/react/ui/primitives/empty/empty.d.ts +10 -0
  137. package/dist/types/react/ui/primitives/empty/index.d.ts +1 -0
  138. package/dist/types/react/ui/primitives/field/field.d.ts +22 -0
  139. package/dist/types/react/ui/primitives/field/index.d.ts +1 -0
  140. package/dist/types/react/ui/primitives/hover-card/hover-card.d.ts +6 -0
  141. package/dist/types/react/ui/primitives/hover-card/index.d.ts +1 -0
  142. package/dist/types/react/ui/primitives/input/index.d.ts +1 -0
  143. package/dist/types/react/ui/primitives/input/input.d.ts +3 -0
  144. package/dist/types/react/ui/primitives/input-group/index.d.ts +1 -0
  145. package/dist/types/react/ui/primitives/input-group/input-group.d.ts +16 -0
  146. package/dist/types/react/ui/primitives/kbd/index.d.ts +1 -0
  147. package/dist/types/react/ui/primitives/kbd/kbd.d.ts +4 -0
  148. package/dist/types/react/ui/primitives/label/index.d.ts +1 -0
  149. package/dist/types/react/ui/primitives/label/label.d.ts +3 -0
  150. package/dist/types/react/ui/primitives/native-select/index.d.ts +1 -0
  151. package/dist/types/react/ui/primitives/native-select/native-select.d.ts +7 -0
  152. package/dist/types/react/ui/primitives/popover/index.d.ts +1 -0
  153. package/dist/types/react/ui/primitives/popover/popover.d.ts +9 -0
  154. package/dist/types/react/ui/primitives/preview/component-preview.d.ts +8 -0
  155. package/dist/types/react/ui/primitives/progress/index.d.ts +1 -0
  156. package/dist/types/react/ui/primitives/progress/progress.d.ts +7 -0
  157. package/dist/types/react/ui/primitives/radio-group/index.d.ts +1 -0
  158. package/dist/types/react/ui/primitives/radio-group/radio-group.d.ts +6 -0
  159. package/dist/types/react/ui/primitives/scroll-area/index.d.ts +1 -0
  160. package/dist/types/react/ui/primitives/scroll-area/scroll-area.d.ts +6 -0
  161. package/dist/types/react/ui/primitives/select/index.d.ts +1 -0
  162. package/dist/types/react/ui/primitives/select/select.d.ts +15 -0
  163. package/dist/types/react/ui/primitives/separator/index.d.ts +1 -0
  164. package/dist/types/react/ui/primitives/separator/separator.d.ts +3 -0
  165. package/dist/types/react/ui/primitives/sheet/index.d.ts +1 -0
  166. package/dist/types/react/ui/primitives/sheet/sheet.d.ts +14 -0
  167. package/dist/types/react/ui/primitives/skeleton/index.d.ts +1 -0
  168. package/dist/types/react/ui/primitives/skeleton/skeleton.d.ts +3 -0
  169. package/dist/types/react/ui/primitives/slider/index.d.ts +1 -0
  170. package/dist/types/react/ui/primitives/slider/slider.d.ts +7 -0
  171. package/dist/types/react/ui/primitives/sonner/index.d.ts +1 -0
  172. package/dist/types/react/ui/primitives/sonner/sonner.d.ts +4 -0
  173. package/dist/types/react/ui/primitives/spinner/index.d.ts +1 -0
  174. package/dist/types/react/ui/primitives/spinner/spinner.d.ts +3 -0
  175. package/dist/types/react/ui/primitives/switch/index.d.ts +1 -0
  176. package/dist/types/react/ui/primitives/switch/switch.d.ts +5 -0
  177. package/dist/types/react/ui/primitives/tabs/index.d.ts +1 -0
  178. package/dist/types/react/ui/primitives/tabs/tabs.d.ts +8 -0
  179. package/dist/types/react/ui/primitives/textarea/index.d.ts +1 -0
  180. package/dist/types/react/ui/primitives/textarea/textarea.d.ts +3 -0
  181. package/dist/types/react/ui/primitives/toggle/index.d.ts +1 -0
  182. package/dist/types/react/ui/primitives/toggle/toggle.d.ts +7 -0
  183. package/dist/types/react/ui/primitives/toggle-group/index.d.ts +1 -0
  184. package/dist/types/react/ui/primitives/toggle-group/toggle-group.d.ts +14 -0
  185. package/dist/types/react/ui/primitives/tooltip/index.d.ts +1 -0
  186. package/dist/types/react/ui/primitives/tooltip/tooltip.d.ts +7 -0
  187. package/dist/types/solid/index.d.ts +37 -0
  188. package/dist/types/svelte/index.d.ts +55 -0
  189. package/dist/types/utils/dom.d.ts +59 -0
  190. package/dist/types/utils/event-emitter.d.ts +11 -0
  191. package/dist/types/utils/freeze-animations.d.ts +8 -0
  192. package/dist/types/utils/text.d.ts +9 -0
  193. package/dist/types/utils/validation.d.ts +10 -0
  194. package/dist/types/vue/index.d.ts +87 -0
  195. package/dist/vue/ShadowRootContext-BQTcHNil.js +7 -0
  196. package/dist/vue/chunk-DHrubWSL.js +11 -0
  197. package/dist/vue/comment-kit-ui-BX1wDZ2c.js +9483 -0
  198. package/dist/vue/dom-eo0P9Z6Z.js +97 -0
  199. package/dist/vue/error-boundary-DW6uGR8U.js +21 -0
  200. package/dist/vue/limits-B6csdQeI.js +71 -0
  201. package/dist/vue/mount-ui-DdTYzv6J.js +55 -0
  202. package/dist/vue/pusher-cmjNbW6a.js +2504 -0
  203. package/dist/vue/realtime-YJKvS2eB.js +558 -0
  204. package/dist/vue/shadow-root-SLTVf5yk.js +86 -0
  205. package/dist/vue/styles-BrHt1-ia.js +2 -0
  206. package/dist/vue.es.js +3495 -0
  207. package/package.json +205 -4
@@ -0,0 +1,43 @@
1
+ import type { CoreContext } from "./state";
2
+ import type { ActivityItem, Comment, DrawingData, Position, QueuedMutation, Reply, TaskChecklistItem, TextSelection, User } from "./types";
3
+ /** Callbacks for offline queue integration and side effects */
4
+ export interface CommentCallbacks {
5
+ shouldQueueMutation: (error: unknown) => boolean;
6
+ /** Returns false when the mutation couldn't be queued (invalid args / full
7
+ * queue) — callers must then roll back their optimistic update. */
8
+ queueMutation: (type: QueuedMutation["type"], args: any[], tempId?: string) => boolean;
9
+ addActivity: (partial: Omit<ActivityItem, "id" | "user" | "timestamp" | "read">) => void;
10
+ }
11
+ /**
12
+ * Replace an optimistic temp comment with the server copy, guaranteeing
13
+ * exactly one entry per id. A realtime echo of our own create can land
14
+ * before the HTTP response — drop that duplicate before substituting.
15
+ * Exported for the offline queue's replay reconciliation.
16
+ */
17
+ export declare function reconcileServerComment(ctx: CoreContext, tempId: string, comment: Comment): void;
18
+ /** Reply-level twin of {@link reconcileServerComment}. */
19
+ export declare function reconcileServerReply(ctx: CoreContext, commentId: string, tempReplyId: string, reply: Reply): void;
20
+ export declare function loadComments(ctx: CoreContext): Promise<void>;
21
+ export declare function loadMoreComments(ctx: CoreContext, loadingGuard: {
22
+ current: boolean;
23
+ }): Promise<void>;
24
+ export declare function createComment(ctx: CoreContext, cb: CommentCallbacks, activeMutations: Set<string>, type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: {
25
+ description?: string;
26
+ assignees?: User[];
27
+ checklist?: TaskChecklistItem[];
28
+ files?: File[];
29
+ attachmentIds?: Array<string | number>;
30
+ }): Promise<void>;
31
+ export declare function updateComment(ctx: CoreContext, cb: CommentCallbacks, commentId: string, updates: Partial<Comment>): Promise<void>;
32
+ export declare function deleteComment(ctx: CoreContext, cb: CommentCallbacks, commentId: string): Promise<void>;
33
+ export declare function addReply(ctx: CoreContext, cb: CommentCallbacks, commentId: string, content: string): Promise<void>;
34
+ export declare function updateReply(ctx: CoreContext, commentId: string, replyId: string, content: string): Promise<void>;
35
+ export declare function deleteReply(ctx: CoreContext, commentId: string, replyId: string): Promise<void>;
36
+ export declare function resolveComment(ctx: CoreContext, cb: CommentCallbacks, commentId: string): Promise<void>;
37
+ export declare function unresolveComment(ctx: CoreContext, cb: CommentCallbacks, commentId: string): Promise<void>;
38
+ export declare function completeComment(ctx: CoreContext, cb: CommentCallbacks, commentId: string): Promise<void>;
39
+ export declare function reactToComment(ctx: CoreContext, cb: CommentCallbacks, commentId: string, emoji: string): Promise<void>;
40
+ export declare function updateCommentPosition(ctx: CoreContext, cb: CommentCallbacks, commentId: string, x: number, y: number): Promise<void>;
41
+ export declare function selectComment(ctx: CoreContext, comment: Comment | null): void;
42
+ export declare function createHighlight(ctx: CoreContext, cb: CommentCallbacks, activeMutations: Set<string>, textSelection: TextSelection, content: string): Promise<void>;
43
+ export declare function createDrawing(ctx: CoreContext, cb: CommentCallbacks, activeMutations: Set<string>, drawingData: DrawingData, position: Position, content: string): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import type { CoreContext } from "./state";
2
+ import type { DevGrabResult, DevGrabBundle, DevGrabOptions, ScreenshotProvider } from "./types";
3
+ /**
4
+ * Capture a single element for direct agent handoff: screenshot + source info +
5
+ * HTML + selector/XPath, formatted as Markdown and copied to the clipboard.
6
+ * Returns the result so the caller can also keep it for in-app preview.
7
+ */
8
+ export declare function grabElement(element: Element, ctx: CoreContext, screenshotProvider: ScreenshotProvider | null, options?: DevGrabOptions): Promise<DevGrabResult | null>;
9
+ /**
10
+ * Multi-element grab — produces individual results AND a single bundled
11
+ * Markdown payload that is copied to the clipboard. Used by shift+click and
12
+ * drag-rect multi-select flows.
13
+ */
14
+ export declare function grabElements(elements: Element[], ctx: CoreContext, screenshotProvider: ScreenshotProvider | null, options?: DevGrabOptions): Promise<DevGrabBundle | null>;
@@ -0,0 +1,12 @@
1
+ import type { Comment, CommentKitState, ToolType } from "./types";
2
+ export interface KeyboardCallbacks {
3
+ toggleLoginModal: () => void;
4
+ toggleOverlay: () => void;
5
+ toggleSidebar: () => void;
6
+ toggleShortcutsOverlay: () => void;
7
+ setTool: (tool: ToolType) => void;
8
+ selectComment: (comment: Comment | null) => void;
9
+ setState: (updates: Partial<CommentKitState>) => void;
10
+ }
11
+ export declare function handleToggleRequest(state: CommentKitState, callbacks: KeyboardCallbacks): void;
12
+ export declare function handleKeyboardShortcuts(event: KeyboardEvent, state: CommentKitState, callbacks: KeyboardCallbacks): void;
@@ -0,0 +1,52 @@
1
+ export declare const LIMITS: Readonly<{
2
+ /** Max length for entity ids (comment/reply/user/project). */
3
+ ID: 256;
4
+ /** Max length for comment text content. */
5
+ CONTENT: 10000;
6
+ /** Max length for reply text content (backend validates replies at 5k). */
7
+ REPLY_CONTENT: 5000;
8
+ /** Max length for a user display name. */
9
+ NAME: 500;
10
+ /** Max email length (RFC 5321). */
11
+ EMAIL: 254;
12
+ /** Max length for page url/path/title (backend columns/validation: 2000). */
13
+ PAGE: 2000;
14
+ /** Max length for a CSS selector / XPath. */
15
+ SELECTOR: 2048;
16
+ /** Max emoji string length. */
17
+ EMOJI: 32;
18
+ /** Max length for a color string (e.g. stroke/fill). */
19
+ COLOR: 128;
20
+ /** Max length of an SVG path `d` attribute. */
21
+ DRAWING_PATH_DATA: 50000;
22
+ /** Max length of drawing text annotations. */
23
+ DRAWING_TEXT: 5000;
24
+ /** Max length of a drawing path `type` discriminator. */
25
+ DRAWING_TYPE: 20;
26
+ /** Max paths in one drawing. */
27
+ DRAWING_PATHS: 1000;
28
+ /** Max length of selected text in a text-selection comment. */
29
+ TEXT_SELECTION: 20000;
30
+ /** Max length of a comment description. */
31
+ DESCRIPTION: 10000;
32
+ /** Max assignees per comment. */
33
+ ASSIGNEES: 100;
34
+ /** Max checklist items per comment. */
35
+ CHECKLIST_ITEMS: 100;
36
+ /** Max length of a checklist item label (backend column: varchar(500)). */
37
+ CHECKLIST_LABEL: 500;
38
+ /** Cap on tracked online/presence users. */
39
+ ONLINE_USERS: 500;
40
+ /** Default max DISTINCT remote cursors rendered at once (config-overridable).
41
+ * Bounds inbound cursor processing independent of project size. */
42
+ RENDERED_CURSORS: 24;
43
+ /** Global ceiling on cursor:move events emitted to the host per second,
44
+ * across ALL peers — a hard backstop on the cursor firehose. */
45
+ CURSOR_EMITS_PER_SEC: 240;
46
+ /** Sanity cap on a reaction count. */
47
+ REACTION_COUNT: 1000000;
48
+ /** Cap on the offline mutation queue. */
49
+ PENDING_MUTATIONS: 1000;
50
+ /** Max backoff between offline-queue retries (ms). */
51
+ RETRY_DELAY: 30000;
52
+ }>;
@@ -0,0 +1,23 @@
1
+ import type { CoreContext } from "./state";
2
+ import type { CommentKitState, QueuedMutation } from "./types";
3
+ export declare function savePendingMutations(projectId: string | undefined, mutations: QueuedMutation[]): void;
4
+ export declare function loadPersistedMutations(projectId: string | undefined): QueuedMutation[];
5
+ export declare function shouldQueueMutation(state: CommentKitState, error: unknown): boolean;
6
+ /**
7
+ * Enqueue a mutation for offline replay. Returns `false` when the mutation
8
+ * could not be queued (invalid args or full queue) so callers can roll back
9
+ * their optimistic update instead of leaving phantom state behind.
10
+ */
11
+ export declare function queueMutation(ctx: CoreContext, scheduleRetryFn: () => void, type: QueuedMutation["type"], args: any[], tempId?: string): boolean;
12
+ export declare function scheduleRetry(ctx: CoreContext, retryTimerRef: {
13
+ current: ReturnType<typeof setTimeout> | null;
14
+ }, processQueue: () => Promise<void>): void;
15
+ export interface QueueProcessingGuard {
16
+ current: boolean;
17
+ /** Set when a permanent failure occurred while other mutations were still
18
+ * queued — the reconciling reload is deferred until the queue drains so it
19
+ * can't clobber the remaining mutations' optimistic entries. */
20
+ reconcileAfterDrain?: boolean;
21
+ }
22
+ export declare function processOfflineQueue(ctx: CoreContext, processingGuard: QueueProcessingGuard, scheduleRetryFn: () => void, executeMutationFn?: (mutation: QueuedMutation) => Promise<void>): Promise<void>;
23
+ export declare function executeMutation(ctx: CoreContext, mutation: QueuedMutation): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import type { CoreContext } from "./state";
2
+ import { WebSocketManager } from "./websocket-manager";
3
+ export interface RealtimeRefs {
4
+ wsManager: WebSocketManager | null;
5
+ wsUnsubscribers: Array<() => void>;
6
+ mouseMoveHandler: ((e: MouseEvent) => void) | null;
7
+ }
8
+ export declare function initializeWebSocket(ctx: CoreContext, refs: RealtimeRefs): void;
9
+ export declare function removeMouseMoveListener(refs: RealtimeRefs): void;
@@ -0,0 +1,12 @@
1
+ import type { CoreContext } from "./state";
2
+ import type { Comment, Position, ScreenshotProvider, ScreenshotResult } from "./types";
3
+ interface CaptureScreenshotBehavior {
4
+ reportErrors?: boolean;
5
+ }
6
+ export declare function captureScreenshot(ctx: CoreContext, screenshotProvider: ScreenshotProvider | null, element?: HTMLElement, behavior?: CaptureScreenshotBehavior): Promise<ScreenshotResult | null>;
7
+ export declare function uploadScreenshot(ctx: CoreContext, screenshot: ScreenshotResult, content: string, position: Position): Promise<Comment | null>;
8
+ export declare function uploadFiles(ctx: CoreContext, files: File[], options?: {
9
+ commentId?: string;
10
+ replyId?: string;
11
+ }): Promise<string[]>;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { User } from "./types";
2
+ export interface PersistedSession {
3
+ token: string;
4
+ email: string;
5
+ user: User;
6
+ }
7
+ export declare function saveSession(projectId: string | undefined, session: PersistedSession): void;
8
+ export declare function loadSession(projectId: string | undefined): PersistedSession | null;
9
+ export declare function clearSession(projectId: string | undefined): void;
@@ -0,0 +1,19 @@
1
+ export interface ResolvedSourceFrame {
2
+ filePath: string;
3
+ lineNumber: number | null;
4
+ columnNumber: number | null;
5
+ componentName: string | null;
6
+ }
7
+ export interface ResolvedSource {
8
+ tagName: string;
9
+ componentName: string | null;
10
+ source: ResolvedSourceFrame | null;
11
+ stack: ResolvedSourceFrame[];
12
+ }
13
+ type Resolver = (element: Element) => Promise<ResolvedSource | null>;
14
+ export declare function resolveSource(element: Element): Promise<ResolvedSource | null>;
15
+ /** Test/e2e helper — install a synthetic resolver so specs can drive the source-resolved path. */
16
+ export declare function __setResolverForTests(resolver: Resolver | null): void;
17
+ export declare function isSourceResolutionAvailable(): Promise<boolean>;
18
+ export declare function __resetForTests(): void;
19
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { ApiClient } from "./api-client";
2
+ import type { CommentKitEvents, CommentKitState, ResolvedConfig, StateSlice } from "./types";
3
+ export declare const SLICE_KEYS: Readonly<Record<StateSlice, ReadonlyArray<keyof CommentKitState>>>;
4
+ export declare const MAX_MUTATION_RETRIES = 5;
5
+ export declare const RETRY_BASE_DELAY = 2000;
6
+ export declare function createInitialState(): CommentKitState;
7
+ /**
8
+ * Dependency bag passed to domain module functions.
9
+ * Created once by CommentKitCore and shared with all extracted modules.
10
+ */
11
+ export interface CoreContext {
12
+ /** Returns the internal mutable state (not deep-copied). */
13
+ getState: () => CommentKitState;
14
+ /** Batched state update (microtask flush). */
15
+ setState: (updates: Partial<CommentKitState>) => void;
16
+ /** HTTP client for API calls. */
17
+ apiClient: ApiClient;
18
+ /** Emit a typed event. */
19
+ emit: <K extends keyof CommentKitEvents>(event: K, data: CommentKitEvents[K]) => void;
20
+ /** Centralized error handler. */
21
+ handleError: (error: unknown) => void;
22
+ /** Resolved runtime config. */
23
+ config: ResolvedConfig;
24
+ }