@commentkit/comment-kit 0.7.4 → 0.7.6
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.
- package/CHANGELOG.md +26 -0
- package/README.md +3 -3
- package/SECURITY.md +1 -1
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +3 -3
- package/dist/demo.es.js +24 -15
- package/dist/headless.es.js +2 -2
- package/dist/preact.es.js +2 -2
- package/dist/qwik.qwik.mjs +2 -2
- package/dist/react.es.js +2 -2
- package/dist/shared/ShadowRootContext-DD6a0QaI.js +11 -0
- package/dist/shared/annotation-toolbar-RSrb0Nku.js +1086 -0
- package/dist/shared/{attachment-refresh-DmVkfPtl.js → attachment-refresh-CSTYwRW-.js} +3 -3
- package/dist/shared/{button-By0hGrJK.js → button-D4GHW6oZ.js} +133 -164
- package/dist/shared/{button-group-C285iSkZ.js → button-group-BVR7iT-S.js} +13 -13
- package/dist/shared/{comment-drawing-canvas-zIPS1dnW.js → comment-drawing-canvas-DbuXP54N.js} +2 -2
- package/dist/shared/{comment-icon-4SQd3nlz.js → comment-icon-D8JTCEJ7.js} +109 -110
- package/dist/shared/{comment-image-lightbox-CdMNf0_y.js → comment-image-lightbox-zlIGEVA-.js} +7 -7
- package/dist/shared/{comment-images-content-DqeqmQnb.js → comment-images-content-aYbJb79_.js} +38 -38
- package/dist/shared/{comment-kit-core-C-0JJS2i.js → comment-kit-core-B0k7XsMz.js} +742 -746
- package/dist/shared/{comment-kit-ui-CBaz7L3u.js → comment-kit-ui-BXLJcZYQ.js} +5310 -5718
- package/dist/shared/{comment-screenshot-annotator-CuYmKafz.js → comment-screenshot-annotator-ChWwYJzO.js} +2 -2
- package/dist/shared/{comment-screenshot-overlay-Dw81osel.js → comment-screenshot-overlay-Bufg3rHz.js} +6 -6
- package/dist/shared/{dev-export-panel-D08M2LKD.js → dev-export-panel-DAZenvgD.js} +6 -6
- package/dist/shared/{dev-grab-BJLZZ2xU.js → dev-grab-O8q25zar.js} +48 -47
- package/dist/shared/dist-D9A5k-N4.js +617 -0
- package/dist/shared/{element-selector-Biyn2cpR.js → element-selector-CYkwzfEr.js} +349 -347
- package/dist/shared/input-UPtAj0M6.js +111 -0
- package/dist/shared/{mount-ui-DXdL3p9b.js → mount-ui-BKaWBhKq.js} +4 -4
- package/dist/shared/{pusher-D4M5K6Dk.js → pusher-BUaiCkDJ.js} +1 -1
- package/dist/shared/{realtime-BTqYEy8s.js → realtime-C0Z8dXXH.js} +41 -28
- package/dist/shared/{realtime-recovery-BSVMwsXJ.js → realtime-recovery-BjlV-ewc.js} +57 -30
- package/dist/shared/screenshot-B-ZfFItT.js +199 -0
- package/dist/shared/{separator-aphZiRoJ.js → separator-UhJb0Row.js} +1222 -1288
- package/dist/shared/{shadow-root-C58Ap5Nu.js → shadow-root-Cd3SLHyj.js} +3 -5
- package/dist/shared/{token-session-D0Y_HZw0.js → token-session-DplW5QDx.js} +2 -2
- package/dist/shared/useLabelableId-8n0QmH8N.js +154 -0
- package/dist/shared/{useRender-D1z_X_BY.js → useRender-Uxk1OPK-.js} +1 -1
- package/dist/shared/{useValueChanged-CrzfD8l-.js → useValueChanged-DKq5cMot.js} +13 -13
- package/dist/shared/{websocket-manager-BFKa95TO.js → websocket-manager-798cRDyL.js} +2 -2
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +19 -9
- package/dist/types/core/comment-kit-core.d.ts +8 -4
- package/dist/types/core/types.d.ts +49 -9
- package/dist/types/core/write-access.d.ts +2 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +30 -18
- package/package.json +1 -1
- package/dist/shared/ShadowRootContext-CjciYxVN.js +0 -13
- package/dist/shared/annotation-toolbar-CpPKy0oq.js +0 -1094
- package/dist/shared/dist-De294MVF.js +0 -623
package/docs/api-reference.md
CHANGED
|
@@ -14,14 +14,18 @@ Qwik uses `useCommentKit` from `@commentkit/comment-kit/qwik` inside `component$
|
|
|
14
14
|
|
|
15
15
|
### Authentication
|
|
16
16
|
|
|
17
|
-
| Method | Returns | Description
|
|
18
|
-
| ----------------------- | --------------- |
|
|
19
|
-
| `validateInvite(email)` | `Promise<void>` | Validate a member invite token + email, then auto-trigger OTP flow
|
|
20
|
-
| `login(email)` | `Promise<void>` | Request OTP code sent to the given email
|
|
21
|
-
| `verifyOtp(code)` | `Promise<void>` | Verify the
|
|
22
|
-
| `cancelOtp()` | `void` | Cancel the OTP flow and return to email entry
|
|
23
|
-
| `resendOtp()` | `Promise<void>` | Resend OTP to the same email
|
|
24
|
-
| `logout()` | `void` | Clear authentication and disconnect real-time
|
|
17
|
+
| Method | Returns | Description |
|
|
18
|
+
| ----------------------- | --------------- | ----------------------------------------------------------------------- |
|
|
19
|
+
| `validateInvite(email)` | `Promise<void>` | Validate a member invite token + email, then auto-trigger OTP flow |
|
|
20
|
+
| `login(email)` | `Promise<void>` | Request OTP code sent to the given email |
|
|
21
|
+
| `verifyOtp(code)` | `Promise<void>` | Verify the email code, then the authenticator/recovery code if required |
|
|
22
|
+
| `cancelOtp()` | `void` | Cancel the OTP flow and return to email entry |
|
|
23
|
+
| `resendOtp()` | `Promise<void>` | Resend OTP to the same email |
|
|
24
|
+
| `logout()` | `void` | Clear authentication and disconnect real-time |
|
|
25
|
+
|
|
26
|
+
For accounts with two-factor authentication enabled, the email code advances `otpStep` to `"mfa"`; it does **not** authenticate the user or issue a bearer token. The built-in widget asks for an authenticator or unused recovery code. Headless/custom UIs should render that second step and call `verifyOtp(code)` again. Treat only `isAuthenticated`/`auth:login` as completed sign-in. The short-lived `otpMfaChallenge` stays in memory and is cleared on cancellation, logout, or successful sign-in. Closing the login modal also cancels pending authentication responses.
|
|
27
|
+
|
|
28
|
+
The backend binds this challenge to the account, project, current email and enrolled factor, expires it after five minutes, limits guesses, and consumes successful challenges and recovery codes once. Older SDKs fail closed when the API requires MFA; upgrade the widget to complete that flow.
|
|
25
29
|
|
|
26
30
|
### UI Controls
|
|
27
31
|
|
|
@@ -53,6 +57,8 @@ Qwik uses `useCommentKit` from `@commentkit/comment-kit/qwik` inside `component$
|
|
|
53
57
|
| `deleteReply(commentId, replyId)` | `Promise<void>` | Delete a reply |
|
|
54
58
|
| `reactToComment(commentId, emoji, replyId?)` | `Promise<void>` | Toggle a parent reaction, or a specific reply reaction when `replyId` is supplied |
|
|
55
59
|
| `updateCommentPosition(commentId, x, y)` | `Promise<void>` | Move a comment pin to new coordinates |
|
|
60
|
+
| `loadEarlierReplies()` | `Promise<void>` | Prepend the next page of replies for the selected thread |
|
|
61
|
+
| `setCommentQuery(query)` | `Promise<void>` | Change server search/filters and reset the list cursor |
|
|
56
62
|
| `loadMoreComments()` | `Promise<void>` | Load the next page of comments (pagination) |
|
|
57
63
|
|
|
58
64
|
### Project context, branches and retrieval
|
|
@@ -63,13 +69,19 @@ Qwik uses `useCommentKit` from `@commentkit/comment-kit/qwik` inside `component$
|
|
|
63
69
|
| `setBranch(branch)` | `Promise<void>` | Select a nonempty branch name or `null` for all branches; clear the current selection/list and load that branch’s first page. |
|
|
64
70
|
| `reloadProjectContext()` | `Promise<void>` | Refresh authenticated project, organization, member, usage, branch and permission context. |
|
|
65
71
|
|
|
72
|
+
Use `updateComment(id, { checklistPatch: { id: taskId, done: true } })` to toggle one checklist task without replacing another reviewer’s task state. The whole `checklist` array remains available for editing labels and ordering. Never send both in one request.
|
|
73
|
+
|
|
66
74
|
Read `getState().projectContext`, `getState().activeBranch`, `getState().comments` and `getState().pagination` for the results. Context is null until an authenticated response is available. A missing context route on an older API is tolerated; it does not enable new server features. `loadMoreComments()` appends another page and becomes a no-op when there are no more pages.
|
|
67
75
|
|
|
68
76
|
Set `config.branch` to the branch actually deployed on the host, such as `main`. This controls the branch recorded on new pins, highlights, drawings and screenshots, including offline replay. `setBranch()` changes the viewing filter; selecting another branch or **All branches** does not relabel feedback created on a configured deployment. A caller can explicitly override the branch of `createComment` through `CommentCreateOptions.branch`. For older integrations without `config.branch`, creation retains the selected branch as its fallback.
|
|
69
77
|
|
|
70
|
-
The API fetches across project pages. The built-in **Page** tab
|
|
78
|
+
The API fetches across project pages. The built-in **Page** tab requests the current path from the server; **All** includes other pages. A `#comment-ID` link retrieves its authorized target even beyond the first loaded page. The engine resolves this internally after authentication; do not call a private loader. Cross-page links retain the comment’s original page URL, and markers only target the current page’s DOM.
|
|
79
|
+
|
|
80
|
+
The built-in panel sends text search (up to 200 characters), status, priority, assignee, author, page and sort filters to the backend. Search covers authorized thread and reply content and author names across the project, not only loaded threads. Changing filters resets the cursor and invalidates older requests. `core.setCommentQuery({ search, status, priority, assignee, user: "me", pagePath, sort, excludeComplete })` exposes this behavior to custom UIs.
|
|
81
|
+
|
|
82
|
+
Lists use stable cursor pagination and compact thread summaries (`detailLoaded: false`, `repliesCount`, empty `replies`). Selecting a summary fetches the newest 50 replies. `core.loadEarlierReplies()` prepends the next bounded history page; the built-in panel exposes **Load earlier replies**. Replies remain chronologically ordered. Async agent copy hydrates at most 12 recent replies per selected summary, discloses omitted replies, and keeps private signed URLs out of the payload. The synchronous export describes only its loaded snapshot.
|
|
71
83
|
|
|
72
|
-
|
|
84
|
+
Deploy the matching backend API before this SDK. The backend retains the full, offset-based response for older SDKs that do not request the new read contract. The separate local-browser demo continues to filter its local data.
|
|
73
85
|
|
|
74
86
|
`projectContext.permissions.canWriteComments` and `writeRestriction` describe the current backend write capability. An expired paid plan keeps authenticated viewing and export, while creation, replies, edits, deletion, reactions, status changes, pin moves and uploads are disabled. A project-level disabled-comments setting is shown separately from a missing paid plan. The backend enforces these rules; hiding UI controls is not authorization. Storage or individual tool limits do not disable ordinary text feedback. The public browser-local demo is a separate sandbox and does not grant access to production projects.
|
|
75
87
|
|
|
@@ -185,12 +197,12 @@ unsub();
|
|
|
185
197
|
|
|
186
198
|
### Auth Events
|
|
187
199
|
|
|
188
|
-
| Event | Payload | When
|
|
189
|
-
| -------------------- | ----------------------- |
|
|
190
|
-
| `auth:login` | `User` | User authenticated successfully
|
|
191
|
-
| `auth:logout` | `void` | User logged out
|
|
192
|
-
| `auth:otp-requested` | `{ email, expiresIn? }` | OTP was sent to email
|
|
193
|
-
| `auth:otp-verified` | `User` |
|
|
200
|
+
| Event | Payload | When |
|
|
201
|
+
| -------------------- | ----------------------- | -------------------------------------------------- |
|
|
202
|
+
| `auth:login` | `User` | User authenticated successfully |
|
|
203
|
+
| `auth:logout` | `void` | User logged out |
|
|
204
|
+
| `auth:otp-requested` | `{ email, expiresIn? }` | OTP was sent to email |
|
|
205
|
+
| `auth:otp-verified` | `User` | Email and any required second factor were verified |
|
|
194
206
|
|
|
195
207
|
### UI Events
|
|
196
208
|
|
|
@@ -257,7 +269,7 @@ Available slices:
|
|
|
257
269
|
|
|
258
270
|
| Slice | Keys |
|
|
259
271
|
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
260
|
-
| `auth` | `isAuthenticated`, `currentUser`, `project`, `projectContext`, `isLoginModalVisible`, `otpStep`, `otpEmail`
|
|
272
|
+
| `auth` | `isAuthenticated`, `currentUser`, `project`, `projectContext`, `isLoginModalVisible`, `otpStep`, `otpEmail`, `otpMfaChallenge` |
|
|
261
273
|
| `ui` | `isOverlayVisible`, `isSidebarVisible`, `isShortcutsOverlayVisible`, `activeTool`, `isCommentModeActive`, `isDrawingModeActive`, `isHighlightModeActive`, `isScreenshotModeActive`, `selectedComment`, `activeComment`, `activeDrawing`, `activeScreenshot`, `panelView`, `activities`, `isLoading`, `error` |
|
|
262
274
|
| `comments` | `comments`, `pagination`, `seenThreadIds`, `activeBranch` |
|
|
263
275
|
| `realtime` | `onlineUsers`, `connectionStatus`, `pendingMutations`, `isOnline` |
|
|
@@ -355,7 +367,7 @@ import type {
|
|
|
355
367
|
|
|
356
368
|
**`Comment`** — A comment thread with author, position, replies, reactions, attachments, and task metadata.
|
|
357
369
|
|
|
358
|
-
**`ProjectContext`** — Authenticated project/organization identity, members and roles, storage usage (`limit: null` for unlimited), branch names and `canManageComments
|
|
370
|
+
**`ProjectContext`** — Authenticated project/organization identity, members and roles, storage usage (`limit: null` for unlimited), branch names and permissions. `canManageComments` identifies owner/admin moderation; `canTriage`, `canComplete`, `canExportAgentContext`, `canUseMcp` and `accessScope` distinguish internal members from project reviewers. External reviewers receive `organization.plan: null`, `usage: null` and no participant email directory. These optional capabilities preserve compatibility with earlier servers. `project.isPlayground` is a server-owned presentation flag; it never grants permissions.
|
|
359
371
|
|
|
360
372
|
**`ReplyOptions`** — Optional attachment IDs, mentions and a typed quote target for reply creation/editing.
|
|
361
373
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commentkit/comment-kit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Figma-style collaborative commenting, drawing, and feedback tools for any website. Works with React, Vue, Svelte, Angular, and Vanilla JS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as e from "react";
|
|
2
|
-
import { createContext as t, useContext as n } from "react";
|
|
3
|
-
var r = /*#__PURE__*/ e.createContext(void 0);
|
|
4
|
-
process.env.NODE_ENV !== "production" && (r.displayName = "DirectionContext");
|
|
5
|
-
function i() {
|
|
6
|
-
return e.useContext(r)?.direction ?? "ltr";
|
|
7
|
-
}
|
|
8
|
-
var a = t(null), o = t(!1), s = !1;
|
|
9
|
-
function c() {
|
|
10
|
-
let e = n(a);
|
|
11
|
-
return e === null && !s && typeof process < "u" && process.env.NODE_ENV !== "production" && (s = !0, console.warn("[CommentKit] useShadowRoot() returned null — a portal primitive (Popover/Dialog/Select/etc.) is rendering outside <ShadowRootContext.Provider>. Portalled content will fall back to document.body, where ck-* styles are not present.")), e;
|
|
12
|
-
}
|
|
13
|
-
export { i as a, r as i, a as n, c as r, o as t };
|