@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
@@ -1,254 +0,0 @@
1
- import { type CommentWriteAccess } from "./write-access";
2
- import { EventEmitter } from "../utils/event-emitter";
3
- import type { LocalDemoStore } from "./local-demo";
4
- import type { AgentContextExport, AgentContextOptions, Comment, CommentUpdate, CommentQuery, CommentCreateOptions, ReplyOptions, CommentKitConfig, CommentKitState, DevGrabBundle, DevGrabOptions, DevGrabResult, DrawingData, DrawingPath, Position, ResolvedConfig, ScreenshotResult, StateSlice, TextSelection, ToolType, Unsubscribe, User } from "./types";
5
- /**
6
- * Current SDK version — compared against the backend's sdkLatestVersion on
7
- * init. Injected from package.json at build time (vite `define`) so it can't
8
- * drift; the literal fallback keeps tsc/test runs (which don't apply the
9
- * define) working.
10
- */
11
- export declare const SDK_VERSION: string;
12
- export declare class CommentKitCore extends EventEmitter {
13
- private state;
14
- private apiClient;
15
- private readonly localDemo;
16
- private wsManager;
17
- private wsUnsubscribers;
18
- private config;
19
- private initialAuthToken;
20
- private keyboardHandler;
21
- private holdActivationHandler;
22
- private holdBlurHandler;
23
- private toggleHandler;
24
- private mouseMoveHandler;
25
- private hashChangeHandler;
26
- private onlineHandler;
27
- private offlineHandler;
28
- private initialized;
29
- private destroyed;
30
- private sessionRevision;
31
- private writeRestriction;
32
- private authRequestRevision;
33
- private commentsFetchRevision;
34
- private contextFetchRevision;
35
- private deepLinkRequest;
36
- private reactionRequests;
37
- private draftUploads;
38
- private attachmentRefreshes;
39
- private screenshotProvider;
40
- private bootRetryTimer;
41
- private bootAttempts;
42
- private pendingStateUpdates;
43
- private flushScheduled;
44
- private isFlushing;
45
- private readonly queueGuard;
46
- private get isProcessingQueue();
47
- private set isProcessingQueue(value);
48
- private activeMutations;
49
- private get isLoadingMore();
50
- private set isLoadingMore(value);
51
- private sliceSubscribers;
52
- private readonly retryTimerRef;
53
- private get retryTimer();
54
- private set retryTimer(value);
55
- private ctx;
56
- private kbdCallbacks;
57
- private commentCb;
58
- private realtimeRefs;
59
- constructor(config: CommentKitConfig | ResolvedConfig, localDemo?: LocalDemoStore);
60
- /** True only for a separately constructed, browser-local sandbox. */
61
- isLocalDemo(): boolean;
62
- private restoreDemoState;
63
- /** Reveal the local sandbox with the pin tool. Normal instances are unaffected. */
64
- startLocalDemo(): void;
65
- private detectEnvironment;
66
- private boot;
67
- /**
68
- * Auto-detect member invite token from URL query params.
69
- * Param: ?ck_invite=<token>
70
- *
71
- * The token is validated at capture time (64 chars of [A-Za-z0-9_-]) and
72
- * stripped from the address bar immediately so the credential doesn't
73
- * persist in browser history, Referer headers, or analytics URL logs.
74
- */
75
- private autoDetectInviteToken;
76
- private initialize;
77
- private setState;
78
- private getInternalState;
79
- private cloneStateSnapshot;
80
- private flushState;
81
- private notifySubscribers;
82
- /**
83
- * Force-flush any batched state updates synchronously.
84
- * Useful in tests or when you need immediate state propagation.
85
- */
86
- flushStateSync(): void;
87
- getState(): CommentKitState;
88
- /**
89
- * Get the resolved feature flags for this instance.
90
- * Use this instead of accessing config directly.
91
- */
92
- getFeatures(): NonNullable<ResolvedConfig["features"]>;
93
- /** Whether this project currently permits comment mutations (independent of login). */
94
- canWriteComments(): boolean;
95
- getWriteAccess(): CommentWriteAccess;
96
- private requireCommentWrite;
97
- /**
98
- * Get the public configuration (excludes internal auto-detected fields
99
- * such as projectId and reverb connection details).
100
- */
101
- getConfig(): Readonly<CommentKitConfig>;
102
- /**
103
- * Validate a member invite token + email against the backend.
104
- * Validation prepares the invitation challenge; OTP and enrolled MFA must
105
- * still complete before the backend grants access.
106
- */
107
- validateInvite(email: string): Promise<void>;
108
- /**
109
- * Subscribe to changes in a specific state slice.
110
- * The callback only fires when keys in that slice actually change.
111
- */
112
- onSlice(slice: StateSlice, callback: (state: CommentKitState) => void): Unsubscribe;
113
- /**
114
- * Subscribe with a selector. Callback only fires when the selected value changes.
115
- * The selector receives the live state object — by convention, do not mutate it.
116
- */
117
- select<T>(selector: (state: CommentKitState) => T, callback: (value: T) => void): Unsubscribe;
118
- private handleError;
119
- /** Verify a supplied bearer or a saved in-tab session after key validation. */
120
- private restorePersistedSession;
121
- /** Shared post-auth path used by OTP verify and session restore. */
122
- private afterAuthenticated;
123
- private beginAuthRequest;
124
- login(email: string): Promise<void>;
125
- private otpFailedAttempts;
126
- private otpCooldownUntil;
127
- verifyOtp(otp: string): Promise<void>;
128
- cancelOtp(): void;
129
- resendOtp(): Promise<void>;
130
- logout(): void;
131
- private handleAuthExpired;
132
- toggleLoginModal(): void;
133
- /**
134
- * Production, staging, and preview hosts keep the toolbar and comments
135
- * hidden until the keyboard shortcut and a successful login.
136
- */
137
- requiresShortcut(): boolean;
138
- toggleOverlay(): void;
139
- toggleSidebar(): void;
140
- private overlayBeforeTool;
141
- setTool(tool: ToolType): void;
142
- private operationContext;
143
- private operationCallbacks;
144
- private loadMoreGuard;
145
- private commentsRequestContext;
146
- private loadComments;
147
- loadMoreComments(): Promise<void>;
148
- /**
149
- * Re-fetch the current page's comments from the server (page 1). Unlike
150
- * `loadMoreComments`, which paginates forward and no-ops once everything is
151
- * loaded, this refreshes existing data — e.g. to pick up remote edits.
152
- */
153
- setCommentQuery(query: CommentQuery): Promise<void>;
154
- loadEarlierReplies(): Promise<void>;
155
- reloadComments(): Promise<void>;
156
- /** @internal Refresh signed attachment links without discarding pagination or local edits. */
157
- refreshAttachmentUrl(attachmentId: string): Promise<string | null>;
158
- /** Refresh authenticated member, plan and usage data without fabricating demo values. */
159
- reloadProjectContext(): Promise<void>;
160
- setBranch(branch: string | null): Promise<void>;
161
- /** Upload drafts before creating their record. Reuse successful uploads if saving is retried. */
162
- uploadDraftFiles(files: File[]): Promise<string[]>;
163
- createComment(type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: CommentCreateOptions): Promise<void>;
164
- updateComment(commentId: string, updates: CommentUpdate): Promise<void>;
165
- deleteComment(commentId: string): Promise<void>;
166
- addReply(commentId: string, content: string, options?: ReplyOptions): Promise<void>;
167
- updateReply(commentId: string, replyId: string, content: string, options?: ReplyOptions): Promise<void>;
168
- deleteReply(commentId: string, replyId: string): Promise<void>;
169
- private requireThreadStatus;
170
- resolveComment(commentId: string): Promise<void>;
171
- unresolveComment(commentId: string): Promise<void>;
172
- selectComment(comment: Comment | null): void;
173
- completeComment(commentId: string): Promise<void>;
174
- reactToComment(commentId: string, emoji: string, replyId?: string): Promise<void>;
175
- updateCommentPosition(commentId: string, x: number, y: number): Promise<void>;
176
- private offlinePersistUnsub;
177
- /**
178
- * Restore any offline mutations persisted from a previous session (keyed by
179
- * project) and wire up auto-persistence so the queue survives reloads. Called
180
- * once, after the projectId is known.
181
- */
182
- private hydrateOfflineQueue;
183
- private shouldQueueMutation;
184
- private queueMutation;
185
- private scheduleRetry;
186
- private processOfflineQueue;
187
- private executeMutation;
188
- getPendingMutationCount(): number;
189
- /** Clear the last published error so a dismissed banner does not stick. */
190
- clearError(): void;
191
- /**
192
- * Retry the realtime socket. Safe to call when realtime was never started:
193
- * authenticated sessions initialize it, everyone else is ignored.
194
- */
195
- retryConnection(): void;
196
- markThreadSeen(threadId: string): void;
197
- isThreadNew(threadId: string): boolean;
198
- setPanelView(view: CommentKitState["panelView"]): void;
199
- toggleShortcutsOverlay(): void;
200
- private addActivity;
201
- markAllActivitiesRead(): void;
202
- getUnreadActivityCount(): number;
203
- private handleDeepLink;
204
- createHighlight(textSelection: TextSelection, content: string): Promise<void>;
205
- createDrawing(drawingData: DrawingData, position: Position, content: string): Promise<void>;
206
- setActiveDrawing(drawing: DrawingData | null): void;
207
- sendDrawingStroke(path: DrawingPath): void;
208
- captureScreenshot(element?: HTMLElement): Promise<ScreenshotResult | null>;
209
- uploadScreenshot(screenshot: ScreenshotResult, content: string, position: Position): Promise<Comment | null>;
210
- setActiveScreenshot(screenshot: ScreenshotResult | null): void;
211
- uploadFiles(files: File[], options?: {
212
- commentId?: string;
213
- replyId?: string;
214
- }): Promise<string[]>;
215
- /**
216
- * Build a comments-only export. Synchronous — uses selector + XPath only.
217
- * For source-resolved output (file:line:col + component stack), use
218
- * `getAgentContextAsync` instead, which awaits source resolution when available.
219
- */
220
- private requireAgentExport;
221
- getAgentContext(options?: AgentContextOptions): AgentContextExport;
222
- /**
223
- * Same as `getAgentContext` but also resolves each comment's element to a
224
- * source-file location when the optional source-resolver peer is installed. Resolves to the
225
- * sync export when the peer dep is absent or no element can be resolved.
226
- */
227
- getAgentContextAsync(options?: AgentContextOptions): Promise<AgentContextExport>;
228
- formatAgentContext(options?: AgentContextOptions): string;
229
- formatAgentContextAsync(options?: AgentContextOptions): Promise<string>;
230
- copyAgentContext(options?: AgentContextOptions): Promise<string>;
231
- /** Single-element grab — see core/dev-grab.ts. Dev-mode element-tool entry. */
232
- grabElement(element: Element, options?: DevGrabOptions): Promise<DevGrabResult | null>;
233
- /** Multi-element grab — bundles N elements into one clipboard payload. */
234
- grabElements(elements: Element[], options?: DevGrabOptions): Promise<DevGrabBundle | null>;
235
- getProjectMembers(): Promise<User[]>;
236
- private handleToggleRequest;
237
- private handleKeyboardShortcuts;
238
- private readonly escapeBlockers;
239
- private matchesHoldKey;
240
- /**
241
- * Block the core's Escape chain. Used by overlay UIs (context menus,
242
- * dropdowns) that want Escape to dismiss their own surface first instead of
243
- * walking the core's chain (which would otherwise also clear the tool).
244
- * Returns a release function — call it to unregister the blocker.
245
- */
246
- blockEscape(): () => void;
247
- private initializeWebSocket;
248
- getOnlineUsers(): User[];
249
- private syncRealtimeRefs;
250
- private syncFromRealtimeRefs;
251
- private removeMouseMoveListener;
252
- private disconnectRealtime;
253
- destroy(): void;
254
- }
@@ -1,60 +0,0 @@
1
- import type { ApiClient } from "./api-client";
2
- import type { Comment, CommentKitConfig } from "./types";
3
- /** A demo window is fixed at creation; reading or editing never extends it. */
4
- export declare const LOCAL_DEMO_TTL: number;
5
- export interface CommentKitDemoOptions {
6
- /** A name scoped below commentkit:demo:. Never used for production sessions. */
7
- storageKey?: string;
8
- ui?: Pick<NonNullable<CommentKitConfig["ui"]>, "theme" | "position">;
9
- }
10
- export interface CommentKitDemoSession {
11
- expiresAt: number;
12
- persistence: "localStorage" | "memory";
13
- commentCount: number;
14
- expired: boolean;
15
- }
16
- type ChangeReason = "persist" | "reset" | "expired" | "storage";
17
- type PublicApiClient = Pick<ApiClient, keyof ApiClient>;
18
- /** A closed local store: it has no fetch, token, websocket, upload, or queue dependency. */
19
- export declare class LocalDemoStore {
20
- readonly user: {
21
- id: string;
22
- name: string;
23
- email: string;
24
- avatar?: string;
25
- organizationId?: string;
26
- };
27
- readonly storageKey: string;
28
- private storage;
29
- private data;
30
- private timer;
31
- private destroyed;
32
- private expiryNotified;
33
- private revision;
34
- private listeners;
35
- private lastSerialized;
36
- constructor(options?: CommentKitDemoOptions);
37
- private hydrate;
38
- private persist;
39
- private armExpiry;
40
- private onFocus;
41
- private onStorage;
42
- private sync;
43
- checkExpiry(): boolean;
44
- getSession(): CommentKitDemoSession;
45
- getComments(): Comment[];
46
- subscribe(listener: (reason: ChangeReason) => void): () => void;
47
- refresh(): void;
48
- getRevision(): number;
49
- private notify;
50
- reset(): void;
51
- activate(): void;
52
- private write;
53
- private find;
54
- private modify;
55
- private quote;
56
- readonly client: PublicApiClient;
57
- private unavailable;
58
- destroy(): void;
59
- }
60
- export {};