@commentkit/comment-kit 0.7.7 → 1.0.0-beta.2

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 (129) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +172 -732
  3. package/SECURITY.md +24 -14
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
  5. package/dist/npm/chunks/Guest-CKoV6pEK.js +157 -0
  6. package/dist/npm/chunks/MarkupEditor-DAo4qppg.js +199 -0
  7. package/dist/npm/chunks/Panel-BRBDHlGg.js +399 -0
  8. package/dist/npm/chunks/Shortcuts-CHMcrjAM.js +56 -0
  9. package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +570 -0
  10. package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
  11. package/dist/npm/chunks/ar-D3SPpN1T.js +195 -0
  12. package/dist/npm/chunks/client-D1NizpDK.js +627 -0
  13. package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
  14. package/dist/npm/chunks/de-C8eC6c6f.js +187 -0
  15. package/dist/npm/chunks/es-Bczf42tm.js +187 -0
  16. package/dist/npm/chunks/extension--it1LAj-.js +54 -0
  17. package/dist/npm/chunks/extension-XfuRGu2o.js +26 -0
  18. package/dist/npm/chunks/format-Bw_tNOh9.js +524 -0
  19. package/dist/npm/chunks/fr-BaQw-v2e.js +187 -0
  20. package/dist/npm/chunks/hi-BamV-yXv.js +187 -0
  21. package/dist/npm/chunks/html2canvas-DfGb8yka.js +4024 -0
  22. package/dist/npm/chunks/it-DC14_EjN.js +187 -0
  23. package/dist/npm/chunks/ja-B1mmTN7Y.js +187 -0
  24. package/dist/npm/chunks/mount-5fFig0k6.js +1447 -0
  25. package/dist/npm/chunks/nl-BfhqUsmX.js +187 -0
  26. package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
  27. package/dist/npm/chunks/pt-BR-CEPu4W5U.js +187 -0
  28. package/dist/{shared/pusher-CnhQgAvF.js → npm/chunks/pusher-BSsQoE1K.js} +224 -222
  29. package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
  30. package/dist/npm/chunks/report-Dh4fxd4J.js +27 -0
  31. package/dist/npm/chunks/rolldown-runtime-Y_bBpyJl.js +20 -0
  32. package/dist/npm/chunks/src-DujplxfI.js +517 -0
  33. package/dist/npm/chunks/zh-CN-kgqjYwHQ.js +187 -0
  34. package/dist/npm/element.js +41 -0
  35. package/dist/npm/headless.js +3 -0
  36. package/dist/npm/index.js +3 -0
  37. package/dist/npm/react.js +26 -0
  38. package/dist/npm/svelte.js +17 -0
  39. package/dist/npm/types/adapters/react.d.ts +11 -0
  40. package/dist/npm/types/adapters/svelte.d.ts +9 -0
  41. package/dist/npm/types/adapters/vue.d.ts +118 -0
  42. package/dist/npm/types/anchor/index.d.ts +49 -0
  43. package/dist/npm/types/core/api.d.ts +31 -0
  44. package/dist/npm/types/core/auth.d.ts +87 -0
  45. package/dist/npm/types/core/client.d.ts +114 -0
  46. package/dist/npm/types/core/store.d.ts +7 -0
  47. package/dist/npm/types/core/types.d.ts +303 -0
  48. package/dist/npm/types/element.d.ts +13 -0
  49. package/dist/npm/types/headless.d.ts +7 -0
  50. package/dist/npm/types/index.d.ts +32 -0
  51. package/dist/npm/vue.js +71 -0
  52. package/package.json +71 -173
  53. package/dist/THIRD_PARTY_NOTICES.txt +0 -284
  54. package/dist/angular.es.js +0 -321
  55. package/dist/comment-kit.es.js +0 -218
  56. package/dist/demo.es.js +0 -483
  57. package/dist/headless.es.js +0 -4
  58. package/dist/preact.es.js +0 -117
  59. package/dist/qwik.es.js +0 -1
  60. package/dist/qwik.qwik.mjs +0 -114
  61. package/dist/react.es.js +0 -98
  62. package/dist/shared/ShadowRootContext-DD6a0QaI.js +0 -11
  63. package/dist/shared/annotation-icons-Dh-bmNYK.js +0 -172
  64. package/dist/shared/annotation-toolbar-zeiCmKIr.js +0 -1086
  65. package/dist/shared/attachment-refresh-DAacLaRu.js +0 -94
  66. package/dist/shared/bridge-CJoGYngu.js +0 -177
  67. package/dist/shared/button-D4GHW6oZ.js +0 -474
  68. package/dist/shared/button-group-BVR7iT-S.js +0 -91
  69. package/dist/shared/capture-privacy-CiOrcAlt.js +0 -101
  70. package/dist/shared/comment-drawing-canvas-Btc12IsS.js +0 -124
  71. package/dist/shared/comment-icon-D8JTCEJ7.js +0 -607
  72. package/dist/shared/comment-image-lightbox--QpbcAtH.js +0 -190
  73. package/dist/shared/comment-images-content-C_r4SHM-.js +0 -214
  74. package/dist/shared/comment-kit-core-CmLUFujd.js +0 -3682
  75. package/dist/shared/comment-kit-ui-BHwYuSIi.js +0 -19391
  76. package/dist/shared/comment-screenshot-annotator-zJZyO-XM.js +0 -151
  77. package/dist/shared/comment-screenshot-overlay-CoKTYB0J.js +0 -205
  78. package/dist/shared/comment-shortcut-groups-CfEmkitU.js +0 -153
  79. package/dist/shared/createReactComponent-BZHeRbD0.js +0 -45
  80. package/dist/shared/dev-export-panel-Cnt6oCZU.js +0 -207
  81. package/dist/shared/dev-grab-B85jo9AS.js +0 -197
  82. package/dist/shared/dist-D9A5k-N4.js +0 -617
  83. package/dist/shared/dom-Bhf4WFtY.js +0 -223
  84. package/dist/shared/element-selector-Cng84xC7.js +0 -902
  85. package/dist/shared/error-boundary-D3PD74vI.js +0 -21
  86. package/dist/shared/errors-Bu5ajEmB.js +0 -22
  87. package/dist/shared/icons-nzMOLzrm.js +0 -266
  88. package/dist/shared/input-UPtAj0M6.js +0 -111
  89. package/dist/shared/mount-ui-Dz7FB_Ak.js +0 -208
  90. package/dist/shared/realtime-recovery-BjlV-ewc.js +0 -162
  91. package/dist/shared/realtime-yGLX4wMK.js +0 -334
  92. package/dist/shared/request-activity-DQrAUwfA.js +0 -11
  93. package/dist/shared/screenshot-B5-hwpmt.js +0 -199
  94. package/dist/shared/separator-UhJb0Row.js +0 -3955
  95. package/dist/shared/shadow-root-B58ZI2yz.js +0 -133
  96. package/dist/shared/styles-CnYsLS2f.js +0 -2
  97. package/dist/shared/text-B4HHZNaa.js +0 -23
  98. package/dist/shared/token-session-D92MYbNu.js +0 -25
  99. package/dist/shared/useLabelableId-8n0QmH8N.js +0 -154
  100. package/dist/shared/useRender-Uxk1OPK-.js +0 -5
  101. package/dist/shared/useValueChanged-DKq5cMot.js +0 -92
  102. package/dist/shared/validation-3wbbbuX0.js +0 -70
  103. package/dist/shared/websocket-manager-KhH4hL0Q.js +0 -381
  104. package/dist/solid.es.js +0 -98
  105. package/dist/svelte.es.js +0 -130
  106. package/dist/types/adapters/bridge.d.ts +0 -122
  107. package/dist/types/angular/index.d.ts +0 -145
  108. package/dist/types/core/agent-context.d.ts +0 -17
  109. package/dist/types/core/api-client.d.ts +0 -155
  110. package/dist/types/core/comment-kit-core.d.ts +0 -254
  111. package/dist/types/core/local-demo.d.ts +0 -60
  112. package/dist/types/core/types.d.ts +0 -770
  113. package/dist/types/core/websocket-manager.d.ts +0 -125
  114. package/dist/types/core/write-access.d.ts +0 -11
  115. package/dist/types/demo.d.ts +0 -17
  116. package/dist/types/headless.d.ts +0 -8
  117. package/dist/types/index.d.ts +0 -87
  118. package/dist/types/preact/index.d.ts +0 -25
  119. package/dist/types/qwik/index.d.ts +0 -73
  120. package/dist/types/react/client.d.ts +0 -31
  121. package/dist/types/react/index.d.ts +0 -4
  122. package/dist/types/solid/index.d.ts +0 -37
  123. package/dist/types/svelte/index.d.ts +0 -55
  124. package/dist/types/utils/dom.d.ts +0 -59
  125. package/dist/types/utils/event-emitter.d.ts +0 -11
  126. package/dist/types/vue/index.d.ts +0 -87
  127. package/dist/vue.es.js +0 -148
  128. package/docs/api-reference.md +0 -405
  129. package/docs/local-demo.md +0 -60
package/dist/solid.es.js DELETED
@@ -1,98 +0,0 @@
1
- import { t as e } from "./shared/comment-kit-core-CmLUFujd.js";
2
- import { n as t, r as n, t as r } from "./shared/bridge-CJoGYngu.js";
3
- import { n as i, t as a } from "./shared/errors-Bu5ajEmB.js";
4
- import { createMemo as o, createSignal as s, onCleanup as c, onMount as l } from "solid-js";
5
- function u(u) {
6
- let [d, f] = s(null), [p, m] = s(!1), [h, g] = s(!0), [_, v] = s(null), [y, b] = s(null), x = null, S = null, C = [], w = !1, T = !1, E = o(() => r.isAuthenticated(d())), D = o(() => r.isOverlayVisible(d())), O = o(() => r.isSidebarVisible(d())), k = o(() => r.currentUser(d())), A = o(() => r.comments(d())), j = o(() => r.activeTool(d())), M = o(() => r.otpStep(d())), N = o(() => r.otpEmail(d())), P = o(() => r.pendingMutationCount(d())), F = o(() => r.isOnline(d())), I = o(() => r.selectedComment(d())), L = o(() => r.connectionStatus(d())), R = o(() => r.panelView(d())), z = o(() => r.isShortcutsOverlayVisible(d())), B = o(() => r.activeDrawing(d())), V = o(() => r.activeScreenshot(d())), H = t(() => x, (e) => v(a(e))), U = () => {
7
- if (!T) {
8
- T = !0;
9
- try {
10
- u.onReady?.();
11
- } catch {}
12
- }
13
- }, W = (e) => {
14
- v(e);
15
- try {
16
- u.onError?.(e);
17
- } catch {}
18
- }, G = () => {
19
- for (; C.length > 0;) {
20
- let e = C.pop();
21
- try {
22
- e?.();
23
- } catch {}
24
- }
25
- }, K = async (e) => {
26
- try {
27
- let { mountCommentKitUI: t } = await import("./shared/mount-ui-Dz7FB_Ak.js").then((e) => e.n);
28
- if (w || x !== e) return;
29
- let n = await t(e);
30
- if (w || x !== e) {
31
- try {
32
- n.unmount();
33
- } catch {}
34
- return;
35
- }
36
- S = n;
37
- } catch (t) {
38
- !w && x === e && W(i(t));
39
- }
40
- };
41
- return l(() => {
42
- if (w) return;
43
- let t = null;
44
- try {
45
- g(!0), v(null), t = new e(u), x = t, b(t), n(H), u.enabled !== !1 && K(t), C.push(t.on("state:changed", (e) => {
46
- w || x !== t || (f(e), e.isAuthenticated && U());
47
- }), t.on("error", (e) => {
48
- w || x !== t || W(e);
49
- }));
50
- let r = t.getState();
51
- f(r), m(!0), g(!1), r.isAuthenticated && U();
52
- } catch (e) {
53
- let n = a(e);
54
- if (t && x === t) {
55
- x = null, b(null), G();
56
- try {
57
- t.destroy();
58
- } catch {}
59
- }
60
- g(!1), W(n);
61
- }
62
- }), c(() => {
63
- w = !0, G();
64
- try {
65
- S?.unmount();
66
- } catch {}
67
- S = null;
68
- let e = x;
69
- if (x = null, b(null), e) try {
70
- e.destroy();
71
- } catch {}
72
- f(null), m(!1), g(!0), v(null);
73
- }), {
74
- state: d,
75
- isReady: p,
76
- isLoading: h,
77
- error: _,
78
- core: y,
79
- isAuthenticated: E,
80
- isOverlayVisible: D,
81
- isSidebarVisible: O,
82
- currentUser: k,
83
- comments: A,
84
- activeTool: j,
85
- otpStep: M,
86
- otpEmail: N,
87
- pendingMutationCount: P,
88
- isOnline: F,
89
- selectedComment: I,
90
- connectionStatus: L,
91
- panelView: R,
92
- isShortcutsOverlayVisible: z,
93
- activeDrawing: B,
94
- activeScreenshot: V,
95
- ...H
96
- };
97
- }
98
- export { u as useCommentKit };
package/dist/svelte.es.js DELETED
@@ -1,130 +0,0 @@
1
- import { t as e } from "./shared/comment-kit-core-CmLUFujd.js";
2
- import { n as t, r as n, t as r } from "./shared/bridge-CJoGYngu.js";
3
- import { n as i, t as a } from "./shared/errors-Bu5ajEmB.js";
4
- import { onDestroy as o } from "svelte";
5
- import { derived as s, get as c, writable as l } from "svelte/store";
6
- function u(e) {
7
- return { subscribe: e.subscribe };
8
- }
9
- function d(o) {
10
- let d = l(null), f = l(null), p = l(!1), m = l(!0), h = l(null), g = [], _ = s(f, (e) => r.isAuthenticated(e)), v = s(f, (e) => r.isOverlayVisible(e)), y = s(f, (e) => r.isSidebarVisible(e)), b = s(f, (e) => r.currentUser(e)), x = s(f, (e) => r.comments(e)), S = s(f, (e) => r.activeTool(e)), C = s(f, (e) => r.otpStep(e)), w = s(f, (e) => r.otpEmail(e)), T = s(f, (e) => r.pendingMutationCount(e)), E = s(f, (e) => r.isOnline(e)), D = s(f, (e) => r.selectedComment(e)), O = s(f, (e) => r.connectionStatus(e)), k = s(f, (e) => r.panelView(e)), A = s(f, (e) => r.isShortcutsOverlayVisible(e)), j = s(f, (e) => r.activeDrawing(e)), M = s(f, (e) => r.activeScreenshot(e)), N = t(() => c(d), (e) => {
11
- h.set(a(e));
12
- }), P = !1, F = null, I = !1, L = !1, R = () => {
13
- if (!L) {
14
- L = !0;
15
- try {
16
- o.onReady?.();
17
- } catch {}
18
- }
19
- }, z = (e) => {
20
- h.set(e);
21
- try {
22
- o.onError?.(e);
23
- } catch {}
24
- }, B = async (e) => {
25
- try {
26
- let { mountCommentKitUI: t } = await import("./shared/mount-ui-Dz7FB_Ak.js").then((e) => e.n);
27
- if (I || c(d) !== e) return;
28
- let n = await t(e);
29
- if (I || c(d) !== e) {
30
- try {
31
- n.unmount();
32
- } catch {}
33
- return;
34
- }
35
- F = n;
36
- } catch (t) {
37
- !I && c(d) === e && z(i(t));
38
- }
39
- };
40
- return typeof document < "u" && (() => {
41
- /* v8 ignore start -- double-init guard, never triggered in normal usage */
42
- if (P) return c(d);
43
- /* v8 ignore stop */
44
- P = !0;
45
- let t = null;
46
- try {
47
- m.set(!0), h.set(null), t = new e(o), d.set(t), n(N), o.enabled !== !1 && B(t), g = [t.on("state:changed", (e) => {
48
- I || c(d) !== t || (f.set(e), e.isAuthenticated && R());
49
- }), t.on("error", (e) => {
50
- I || c(d) !== t || z(e);
51
- })];
52
- let r = t.getState();
53
- return f.set(r), p.set(!0), m.set(!1), r.isAuthenticated && R(), t;
54
- } catch (e) {
55
- if (t && c(d) === t) {
56
- d.set(null);
57
- try {
58
- t.destroy();
59
- } catch {}
60
- }
61
- return m.set(!1), z(a(e)), null;
62
- }
63
- })(), {
64
- core: u(d),
65
- state: u(f),
66
- isReady: u(p),
67
- isLoading: u(m),
68
- error: u(h),
69
- isAuthenticated: _,
70
- isOverlayVisible: v,
71
- isSidebarVisible: y,
72
- currentUser: b,
73
- comments: x,
74
- activeTool: S,
75
- otpStep: C,
76
- otpEmail: w,
77
- pendingMutationCount: T,
78
- isOnline: E,
79
- selectedComment: D,
80
- connectionStatus: O,
81
- panelView: k,
82
- isShortcutsOverlayVisible: A,
83
- activeDrawing: j,
84
- activeScreenshot: M,
85
- destroy: () => {
86
- for (I = !0; g.length > 0;) {
87
- let e = g.pop();
88
- try {
89
- e?.();
90
- } catch {}
91
- }
92
- try {
93
- F?.unmount();
94
- } catch {}
95
- F = null;
96
- let e = c(d);
97
- if (d.set(null), e) try {
98
- e.destroy();
99
- } catch {}
100
- f.set(null), p.set(!1), m.set(!0), h.set(null);
101
- },
102
- ...N
103
- };
104
- }
105
- function f(e) {
106
- let t = d(e);
107
- return o(() => {
108
- t.destroy();
109
- }), t;
110
- }
111
- function p(e, t) {
112
- let n = d(t);
113
- return {
114
- getStore() {
115
- return n;
116
- },
117
- destroy() {
118
- n.destroy();
119
- },
120
- update(e) {
121
- n.destroy(), n = d(e);
122
- }
123
- };
124
- }
125
- var m = {
126
- createCommentKitStore: d,
127
- useCommentKit: f,
128
- commentKitAction: p
129
- };
130
- export { p as commentKitAction, d as createCommentKitStore, m as default, f as useCommentKit };
@@ -1,122 +0,0 @@
1
- /**
2
- * Shared adapter bridge for framework integrations.
3
- *
4
- * Generates the full public API method surface from a core getter function.
5
- * Every framework adapter (React, Vue, Svelte, Angular, Solid, Qwik, Preact)
6
- * uses this bridge to avoid duplicating ~50 method delegations.
7
- * Framework-specific code only handles reactivity wiring (ref/computed,
8
- * writable/derived, BehaviorSubject, signals, etc.).
9
- */
10
- import type { CommentKitCore } from "../core/comment-kit-core";
11
- import type { ApiError, AgentContextExport, AgentContextOptions, Comment, ReplyOptions, CommentCreateOptions, DevGrabBundle, DevGrabOptions, DevGrabResult, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User } from "../core/types";
12
- export interface AdapterMethods {
13
- validateInvite: (email: string) => Promise<void>;
14
- login: (email: string) => Promise<void>;
15
- verifyOtp: (otp: string) => Promise<void>;
16
- cancelOtp: () => void;
17
- resendOtp: () => Promise<void>;
18
- logout: () => void;
19
- toggleLoginModal: () => void;
20
- toggleOverlay: () => void;
21
- toggleSidebar: () => void;
22
- setTool: (tool: CommentKitState["activeTool"]) => void;
23
- toggleShortcutsOverlay: () => void;
24
- setPanelView: (view: PanelView) => void;
25
- loadMoreComments: () => Promise<void>;
26
- reloadComments: () => Promise<void>;
27
- setBranch: (branch: string | null) => Promise<void>;
28
- reloadProjectContext: () => Promise<void>;
29
- getProjectMembers: () => Promise<User[]>;
30
- createComment: (type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: CommentCreateOptions) => Promise<void>;
31
- updateComment: (commentId: string, updates: Partial<Comment>) => Promise<void>;
32
- deleteComment: (id: string) => Promise<void>;
33
- resolveComment: (id: string) => Promise<void>;
34
- unresolveComment: (id: string) => Promise<void>;
35
- completeComment: (id: string) => Promise<void>;
36
- selectComment: (comment: Comment | null) => void;
37
- addReply: (commentId: string, content: string, options?: ReplyOptions) => Promise<void>;
38
- updateReply: (commentId: string, replyId: string, content: string, options?: ReplyOptions) => Promise<void>;
39
- deleteReply: (commentId: string, replyId: string) => Promise<void>;
40
- reactToComment: (commentId: string, emoji: string, replyId?: string) => Promise<void>;
41
- updateCommentPosition: (commentId: string, x: number, y: number) => Promise<void>;
42
- createHighlight: (textSelection: TextSelection, content: string) => Promise<void>;
43
- createDrawing: (drawingData: DrawingData, position: Position, content: string) => Promise<void>;
44
- setActiveDrawing: (drawing: DrawingData | null) => void;
45
- sendDrawingStroke: (path: DrawingPath) => void;
46
- captureScreenshot: (element?: HTMLElement) => Promise<ScreenshotResult | null>;
47
- uploadScreenshot: (screenshot: ScreenshotResult, content: string, position: Position) => Promise<Comment | null>;
48
- setActiveScreenshot: (screenshot: ScreenshotResult | null) => void;
49
- uploadFiles: (files: File[], options?: {
50
- commentId?: string;
51
- replyId?: string;
52
- }) => Promise<string[]>;
53
- markThreadSeen: (threadId: string) => void;
54
- isThreadNew: (threadId: string) => boolean;
55
- markAllActivitiesRead: () => void;
56
- getUnreadActivityCount: () => number;
57
- getPendingMutationCount: () => number;
58
- getOnlineUsers: () => User[];
59
- getAgentContext: (options?: AgentContextOptions) => AgentContextExport;
60
- getAgentContextAsync: (options?: AgentContextOptions) => Promise<AgentContextExport>;
61
- formatAgentContext: (options?: AgentContextOptions) => string;
62
- formatAgentContextAsync: (options?: AgentContextOptions) => Promise<string>;
63
- copyAgentContext: (options?: AgentContextOptions) => Promise<string>;
64
- /** Single-element grab — screenshot + source + clipboard. Returns null if no core. */
65
- grabElement: (element: Element, options?: DevGrabOptions) => Promise<DevGrabResult | null>;
66
- /** Multi-element grab — bundles N elements into one clipboard payload. */
67
- grabElements: (elements: Element[], options?: DevGrabOptions) => Promise<DevGrabBundle | null>;
68
- onSlice: (slice: StateSlice, callback: (state: CommentKitState) => void) => Unsubscribe;
69
- select: <T>(selector: (state: CommentKitState) => T, callback: (value: T) => void) => Unsubscribe;
70
- on: <K extends keyof CommentKitEvents>(event: K, listener: EventListener<CommentKitEvents[K]>) => Unsubscribe;
71
- off: <K extends keyof CommentKitEvents>(event: K, listener: EventListener<CommentKitEvents[K]>) => void;
72
- }
73
- /**
74
- * Tell a bridge that its core now exists so buffered pre-init event
75
- * subscriptions (`on`/`onSlice`/`select`) get attached. Safe to call multiple
76
- * times; a no-op for bridges with nothing buffered.
77
- */
78
- export declare function notifyBridgeCoreReady(bridge: AdapterMethods): void;
79
- /**
80
- * Create all adapter method delegations from a core getter.
81
- *
82
- * Error contract: a delegated mutation that fails is BOTH reported via `onError`
83
- * (so the adapter's reactive error state updates) AND re-thrown, so the returned
84
- * promise also rejects. Callers that `await` a bridge mutation must still wrap it
85
- * in try/catch (or attach `.catch`) — the reactive `onError` channel does not
86
- * suppress the rejection.
87
- *
88
- * Pre-init contract: mutations called before the adapter's mount lifecycle has
89
- * created the core REJECT with a "not initialized" error (previously they
90
- * silently resolved while doing nothing — silent data loss). Read helpers
91
- * return a safe fallback, and subscriptions (`on`/`onSlice`/`select`) are
92
- * buffered and attached once the core appears.
93
- *
94
- * @param getCore - Function that returns the current CommentKitCore instance or null.
95
- * Each framework provides its own getter (e.g. get(core), core.value, this.core).
96
- * @param onError - Optional error handler for delegated operation failures. Frameworks can use this
97
- * to update their error state (e.g. error.set(), errorSubject.next()).
98
- */
99
- export declare function createAdapterBridge(getCore: () => CommentKitCore | null, onError?: (error: unknown) => void): AdapterMethods;
100
- /**
101
- * Derived state selectors common to all framework adapters.
102
- * Each framework maps these to its own reactivity primitive.
103
- */
104
- export declare const STATE_SELECTORS: {
105
- readonly isAuthenticated: (s: CommentKitState | null) => boolean;
106
- readonly isOverlayVisible: (s: CommentKitState | null) => boolean;
107
- readonly isSidebarVisible: (s: CommentKitState | null) => boolean;
108
- readonly currentUser: (s: CommentKitState | null) => User | null;
109
- readonly comments: (s: CommentKitState | null) => Comment[];
110
- readonly activeTool: (s: CommentKitState | null) => "comment" | "draw" | "highlight" | "screenshot" | "select" | null;
111
- readonly otpStep: (s: CommentKitState | null) => import("..").OtpStep;
112
- readonly otpEmail: (s: CommentKitState | null) => string | null;
113
- readonly pendingMutationCount: (s: CommentKitState | null) => number;
114
- readonly isOnline: (s: CommentKitState | null) => boolean;
115
- readonly selectedComment: (s: CommentKitState | null) => Comment | null;
116
- readonly connectionStatus: (s: CommentKitState | null) => ConnectionStatus;
117
- readonly panelView: (s: CommentKitState | null) => PanelView;
118
- readonly isShortcutsOverlayVisible: (s: CommentKitState | null) => boolean;
119
- readonly activeDrawing: (s: CommentKitState | null) => DrawingData | null;
120
- readonly activeScreenshot: (s: CommentKitState | null) => ScreenshotResult | null;
121
- };
122
- export type { ApiError, Comment, ReplyOptions, CommentCreateOptions, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User, };
@@ -1,145 +0,0 @@
1
- /**
2
- * Angular integration for CommentKit
3
- * Provides services, components, and dependency injection support.
4
- *
5
- * All action methods are delegated through the shared adapter bridge,
6
- * while RxJS observables use STATE_SELECTORS for derived state.
7
- */
8
- import type { OnDestroy } from "@angular/core";
9
- import { InjectionToken } from "@angular/core";
10
- import { type AdapterMethods } from "../adapters/bridge";
11
- import { CommentKitCore } from "../core/comment-kit-core";
12
- import type { ApiError, CommentKitConfig, CommentKitState, Unsubscribe } from "../core/types";
13
- export declare const COMMENT_KIT_CONFIG: InjectionToken<CommentKitConfig>;
14
- export interface AngularCommentKitConfig extends CommentKitConfig {
15
- onReady?: () => void;
16
- onError?: (error: ApiError) => void;
17
- }
18
- export declare class CommentKitService implements OnDestroy {
19
- private config?;
20
- private core;
21
- private unsubscribers;
22
- private mountedUI;
23
- private lifecycleId;
24
- private coreSubject;
25
- private stateSubject;
26
- private isReadySubject;
27
- private isLoadingSubject;
28
- private errorSubject;
29
- private bridge;
30
- readonly core$: import("rxjs").Observable<CommentKitCore | null>;
31
- readonly state$: import("rxjs").Observable<CommentKitState | null>;
32
- readonly isReady$: import("rxjs").Observable<boolean>;
33
- readonly isLoading$: import("rxjs").Observable<boolean>;
34
- readonly error$: import("rxjs").Observable<ApiError | null>;
35
- readonly isAuthenticated$: import("rxjs").Observable<boolean>;
36
- readonly isOverlayVisible$: import("rxjs").Observable<boolean>;
37
- readonly isSidebarVisible$: import("rxjs").Observable<boolean>;
38
- readonly currentUser$: import("rxjs").Observable<import("./index.ts").User | null>;
39
- readonly comments$: import("rxjs").Observable<import("./index.ts").Comment[]>;
40
- readonly activeTool$: import("rxjs").Observable<"comment" | "draw" | "highlight" | "screenshot" | "select" | null>;
41
- readonly otpStep$: import("rxjs").Observable<import("../headless.ts").OtpStep>;
42
- readonly otpEmail$: import("rxjs").Observable<string | null>;
43
- readonly pendingMutationCount$: import("rxjs").Observable<number>;
44
- readonly isOnline$: import("rxjs").Observable<boolean>;
45
- readonly selectedComment$: import("rxjs").Observable<import("./index.ts").Comment | null>;
46
- readonly connectionStatus$: import("rxjs").Observable<import("./index.ts").ConnectionStatus>;
47
- readonly panelView$: import("rxjs").Observable<import("./index.ts").PanelView>;
48
- readonly isShortcutsOverlayVisible$: import("rxjs").Observable<boolean>;
49
- readonly activeDrawing$: import("rxjs").Observable<import("./index.ts").DrawingData | null>;
50
- readonly activeScreenshot$: import("rxjs").Observable<import("./index.ts").ScreenshotResult | null>;
51
- constructor(config?: AngularCommentKitConfig | undefined);
52
- initialize(config: AngularCommentKitConfig): Promise<void>;
53
- /** Throws synchronously if core is not initialized. Used for sync methods. */
54
- private assertReady;
55
- /** Returns a rejected promise if core is not initialized. Used for async methods. */
56
- private assertReadyAsync;
57
- validateInvite(email: string): Promise<void>;
58
- login(email: string): Promise<void>;
59
- verifyOtp(otp: string): Promise<void>;
60
- cancelOtp(): void;
61
- resendOtp(): Promise<void>;
62
- logout(): void;
63
- toggleLoginModal(): void;
64
- toggleOverlay(): void;
65
- toggleSidebar(): void;
66
- setTool(tool: CommentKitState["activeTool"]): void;
67
- toggleShortcutsOverlay(): void;
68
- setPanelView(view: CommentKitState["panelView"]): void;
69
- loadMoreComments(): Promise<void>;
70
- reloadComments(): Promise<void>;
71
- setBranch(...args: Parameters<AdapterMethods["setBranch"]>): Promise<void>;
72
- reloadProjectContext(): Promise<void>;
73
- getProjectMembers(): Promise<import("./index.ts").User[]>;
74
- createComment(...args: Parameters<AdapterMethods["createComment"]>): Promise<void>;
75
- updateComment(...args: Parameters<AdapterMethods["updateComment"]>): Promise<void>;
76
- deleteComment(id: string): Promise<void>;
77
- resolveComment(id: string): Promise<void>;
78
- unresolveComment(id: string): Promise<void>;
79
- completeComment(id: string): Promise<void>;
80
- selectComment(...args: Parameters<AdapterMethods["selectComment"]>): void;
81
- addReply(...args: Parameters<AdapterMethods["addReply"]>): Promise<void>;
82
- updateReply(...args: Parameters<AdapterMethods["updateReply"]>): Promise<void>;
83
- deleteReply(commentId: string, replyId: string): Promise<void>;
84
- reactToComment(...args: Parameters<AdapterMethods["reactToComment"]>): Promise<void>;
85
- updateCommentPosition(commentId: string, x: number, y: number): Promise<void>;
86
- createHighlight(...args: Parameters<AdapterMethods["createHighlight"]>): Promise<void>;
87
- createDrawing(...args: Parameters<AdapterMethods["createDrawing"]>): Promise<void>;
88
- setActiveDrawing(...args: Parameters<AdapterMethods["setActiveDrawing"]>): void;
89
- sendDrawingStroke(...args: Parameters<AdapterMethods["sendDrawingStroke"]>): void;
90
- captureScreenshot(...args: Parameters<AdapterMethods["captureScreenshot"]>): Promise<import("./index.ts").ScreenshotResult | null>;
91
- uploadScreenshot(...args: Parameters<AdapterMethods["uploadScreenshot"]>): Promise<import("./index.ts").Comment | null>;
92
- setActiveScreenshot(...args: Parameters<AdapterMethods["setActiveScreenshot"]>): void;
93
- uploadFiles(...args: Parameters<AdapterMethods["uploadFiles"]>): Promise<string[]>;
94
- markThreadSeen(threadId: string): void;
95
- isThreadNew(threadId: string): boolean;
96
- markAllActivitiesRead(): void;
97
- getUnreadActivityCount(): number;
98
- getPendingMutationCount(): number;
99
- getOnlineUsers(): import("./index.ts").User[];
100
- getAgentContext(...args: Parameters<AdapterMethods["getAgentContext"]>): import("./index.ts").AgentContextExport;
101
- getAgentContextAsync(...args: Parameters<AdapterMethods["getAgentContextAsync"]>): Promise<import("./index.ts").AgentContextExport>;
102
- formatAgentContext(...args: Parameters<AdapterMethods["formatAgentContext"]>): string;
103
- formatAgentContextAsync(...args: Parameters<AdapterMethods["formatAgentContextAsync"]>): Promise<string>;
104
- copyAgentContext(...args: Parameters<AdapterMethods["copyAgentContext"]>): Promise<string>;
105
- grabElement(...args: Parameters<AdapterMethods["grabElement"]>): Promise<import("../core/types").DevGrabResult | null>;
106
- grabElements(...args: Parameters<AdapterMethods["grabElements"]>): Promise<import("../core/types").DevGrabBundle | null>;
107
- onSlice(...args: Parameters<AdapterMethods["onSlice"]>): Unsubscribe;
108
- select(...args: Parameters<AdapterMethods["select"]>): Unsubscribe;
109
- on(...args: Parameters<AdapterMethods["on"]>): Unsubscribe;
110
- off(...args: Parameters<AdapterMethods["off"]>): void;
111
- getCurrentState(): CommentKitState | null;
112
- private setupEventListeners;
113
- private clearSubscriptions;
114
- private readyNotified;
115
- private notifyAuthenticated;
116
- private reportError;
117
- private mountSharedUI;
118
- ngOnDestroy(): void;
119
- destroy(): void;
120
- }
121
- export declare function createCommentKitService(): CommentKitService;
122
- export declare function provideCommentKit(config: AngularCommentKitConfig): ({
123
- provide: typeof CommentKitService;
124
- useFactory: (options: AngularCommentKitConfig) => CommentKitService;
125
- deps: InjectionToken<CommentKitConfig>[];
126
- useValue?: undefined;
127
- } | {
128
- useFactory?: undefined;
129
- deps?: undefined;
130
- provide: InjectionToken<CommentKitConfig>;
131
- useValue: AngularCommentKitConfig;
132
- })[];
133
- export declare function commentKitDirective(_element: HTMLElement, config: AngularCommentKitConfig): {
134
- destroy(): void;
135
- update(newConfig: AngularCommentKitConfig): void;
136
- };
137
- export type { AgentCommentContext, AgentContextExport, AgentContextOptions, AgentElementContext, ApiError, Comment, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DevGrabAttachment, DevGrabAttachmentPathSource, DevGrabOptions, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User, } from "../core/types";
138
- declare const _default: {
139
- CommentKitService: typeof CommentKitService;
140
- commentKitDirective: typeof commentKitDirective;
141
- createCommentKitService: typeof createCommentKitService;
142
- provideCommentKit: typeof provideCommentKit;
143
- COMMENT_KIT_CONFIG: InjectionToken<CommentKitConfig>;
144
- };
145
- export default _default;
@@ -1,17 +0,0 @@
1
- import type { AgentContextExport, AgentContextOptions, CommentKitState } from "./types";
2
- export declare function createAgentContext(state: CommentKitState, options?: AgentContextOptions): AgentContextExport;
3
- /**
4
- * Resolve and attach source-file locations to each comment's element context
5
- * when the optional source-resolver peer dep is installed. Returns a new export with
6
- * `sourceResolved` flipped to true if at least one comment was resolved.
7
- */
8
- export declare function enrichAgentContextWithSource(context: AgentContextExport): Promise<AgentContextExport>;
9
- export declare function formatAgentContext(context: AgentContextExport): string;
10
- /**
11
- * Copy markdown + an optional element screenshot to the clipboard. Used by
12
- * the dev-grab flow so the agent paste also carries the image, not just text.
13
- * Returns true if the image actually made it onto the clipboard, false if we
14
- * had to fall back to text-only.
15
- */
16
- export declare function copyTextAndImageToClipboard(text: string, imageBlob: Blob | null): Promise<boolean>;
17
- export declare function copyTextToClipboard(text: string, context?: AgentContextExport | null): Promise<void>;
@@ -1,155 +0,0 @@
1
- import type { AuthResponse, Comment, CommentQuery, PaginationInfo, CommentEnvironment, CommentCreateOptions, CommentDeviceInfo, ProjectContext, ReplyOptions, DrawingData, InviteValidationResponse, Mention, OtpResponse, OtpVerifyResponse, SessionVerificationResponse, Position, ResolvedConfig, TextSelection, User } from "./types";
2
- export declare class ApiClient {
3
- private baseUrl;
4
- private apiKey;
5
- private projectId;
6
- private channelProjectId;
7
- private userEmail;
8
- private authToken;
9
- private authRevision;
10
- private pendingInvite;
11
- private inviteRevision;
12
- private environment;
13
- private onAuthExpired;
14
- constructor(config: ResolvedConfig);
15
- /** HTTP routes may use a slug while presence channels always use the project ID. */
16
- setProject(projectId: string, channelProjectId?: string): void;
17
- setUserEmail(email: string | null): void;
18
- setAuthToken(token: string | null): void;
19
- setEnvironment(environment: CommentEnvironment | null): void;
20
- setOnAuthExpired(callback: (() => void) | null): void;
21
- private buildHeaders;
22
- private executeRequest;
23
- private parseResponseBody;
24
- private request;
25
- private requestFormData;
26
- private requireProjectId;
27
- validateApiKey(): Promise<AuthResponse>;
28
- /** Resolve a bearer to its server-authorized member and project. */
29
- verifySession(): Promise<SessionVerificationResponse>;
30
- /** Authorize presence using the current SDK session, never a copied bearer token. */
31
- authorizeChannel(socketId: string, channelName: string): Promise<{
32
- auth: string;
33
- channel_data: string;
34
- }>;
35
- requestOtp(email: string): Promise<OtpResponse>;
36
- verifyOtp(email: string, otp: string): Promise<OtpVerifyResponse>;
37
- verifyMfa(challenge: string, code: string): Promise<OtpVerifyResponse>;
38
- validateInvite(token: string, email: string): Promise<InviteValidationResponse>;
39
- getComments(pagePath?: string, status?: "open" | "resolved" | "complete" | "all", page?: number, limit?: number, environment?: CommentEnvironment, branch?: string | null, options?: CommentQuery & {
40
- cursor?: string | null;
41
- view?: "summary";
42
- pagination?: "cursor";
43
- }): Promise<{
44
- comments: Comment[];
45
- pagination: PaginationInfo;
46
- }>;
47
- getComment(commentId: string, options?: {
48
- repliesLimit?: number;
49
- repliesBefore?: string;
50
- }): Promise<Comment>;
51
- /**
52
- * Build an Idempotency-Key header from a client-supplied key. The backend
53
- * dedups retried creates/replies on this key, so an offline-queue replay (or
54
- * a lost-response retry) can't produce a duplicate row. Keys are bounded and
55
- * control-char-free; an unsafe key is simply omitted.
56
- */
57
- private idempotencyHeaders;
58
- createComment(type: "pin" | "highlight" | "drawing", content: string, position: Position, page: {
59
- url: string;
60
- path: string;
61
- title: string;
62
- }, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: CommentCreateOptions, idempotencyKey?: string): Promise<Comment>;
63
- updateComment(commentId: string, updates: Partial<Pick<Comment, "content" | "status" | "priority" | "description" | "assignees" | "checklist" | "textSelection" | "drawingData" | "mentions"> & {
64
- attachmentIds?: Array<string | number>;
65
- checklistPatch?: {
66
- id: string;
67
- done: boolean;
68
- };
69
- }>): Promise<Comment>;
70
- deleteComment(commentId: string): Promise<void>;
71
- addReply(commentId: string, content: string, idempotencyKey?: string, options?: ReplyOptions): Promise<Comment["replies"][0]>;
72
- updateReply(commentId: string, replyId: string, content: string, options?: ReplyOptions): Promise<Comment["replies"][0]>;
73
- deleteReply(commentId: string, replyId: string): Promise<void>;
74
- resolveComment(commentId: string): Promise<Comment>;
75
- unresolveComment(commentId: string): Promise<Comment>;
76
- markComplete(commentId: string): Promise<Comment>;
77
- addReaction(commentId: string, emoji: string, replyId?: string): Promise<void>;
78
- removeReaction(commentId: string, emoji: string, replyId?: string): Promise<void>;
79
- updatePosition(commentId: string, position: Position): Promise<Comment>;
80
- createHighlight(content: string, textSelection: TextSelection, page: {
81
- url: string;
82
- path: string;
83
- title: string;
84
- }, priority?: "low" | "medium" | "high" | "urgent", idempotencyKey?: string, options?: CommentCreateOptions): Promise<Comment>;
85
- createDrawing(content: string, drawingData: DrawingData, position: Position, page: {
86
- url: string;
87
- path: string;
88
- title: string;
89
- }, idempotencyKey?: string, options?: CommentCreateOptions): Promise<Comment>;
90
- private validateFile;
91
- /**
92
- * Upload a file. Pass `commentId` (and optionally `replyId`) so the backend
93
- * links the attachment; uploads without a comment/reply FK are orphaned.
94
- * `type` is sent on the wire for forward-compat (backend currently stores
95
- * attachments as `file` regardless).
96
- */
97
- uploadFile(file: File, type: "screenshot" | "drawing" | "attachment", options?: {
98
- commentId?: string;
99
- replyId?: string;
100
- }): Promise<{
101
- id: string;
102
- type: string;
103
- url: string;
104
- thumbnail?: string;
105
- filename?: string;
106
- mimeType?: string;
107
- size: number;
108
- }>;
109
- uploadScreenshot(file: File, metadata: {
110
- content: string;
111
- idempotencyKey?: string;
112
- position: Position;
113
- page: {
114
- url: string;
115
- path: string;
116
- title: string;
117
- };
118
- branch?: string;
119
- deviceInfo?: CommentDeviceInfo;
120
- }): Promise<Comment>;
121
- uploadFiles(files: File[], options?: {
122
- commentId?: string;
123
- replyId?: string;
124
- }): Promise<string[]>;
125
- getProjectContext(): Promise<ProjectContext>;
126
- getProjectMembers(): Promise<User[]>;
127
- }
128
- /**
129
- * Parse @mentions from content string.
130
- * Format: @[Display Name](userId)
131
- * Example: "Hey @[John Doe](user-123), check this out"
132
- */
133
- export declare function parseMentions(content: string): Mention[];
134
- /**
135
- * Format a mention for insertion into content.
136
- * Strips `]` from name and `)` from id to keep the mention format parseable
137
- * by {@link parseMentions}. User IDs are validated as `[\w-]+` on parse,
138
- * so `)` in an ID would already be rejected.
139
- */
140
- export declare function formatMention(user: User): string;
141
- /**
142
- * Strip mention markup from content for display.
143
- * Converts @[Display Name](userId) to @Display Name
144
- */
145
- export declare function stripMentionMarkup(content: string): string;
146
- export declare class ApiClientError extends Error {
147
- readonly code: number;
148
- readonly error: string;
149
- readonly details?: Record<string, unknown>;
150
- constructor(error: string, message: string, code: number, details?: Record<string, unknown>);
151
- isAuthError(): boolean;
152
- isNetworkError(): boolean;
153
- isRateLimitError(): boolean;
154
- isPremiumFeatureError(): boolean;
155
- }