@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.
- package/CHANGELOG.md +276 -0
- package/LICENSE +18 -0
- package/README.md +766 -2
- package/dist/angular/ShadowRootContext-2BrAO1qU.js +7 -0
- package/dist/angular/chunk-Cyg4N8Ue.js +11 -0
- package/dist/angular/comment-kit-ui-wEJfMh4T.js +9483 -0
- package/dist/angular/dom-ON-u4y6t.js +97 -0
- package/dist/angular/error-boundary-CxhCm8iF.js +21 -0
- package/dist/angular/limits-AEqOBweE.js +71 -0
- package/dist/angular/mount-ui-CxChSb8B.js +55 -0
- package/dist/angular/pusher-Vs-W-c8I.js +2504 -0
- package/dist/angular/realtime-CfJZMEAi.js +558 -0
- package/dist/angular/shadow-root-C7wgghDv.js +86 -0
- package/dist/angular/styles-CvndAWRF.js +2 -0
- package/dist/angular.es.js +3656 -0
- package/dist/comment-kit.es.js +3361 -0
- package/dist/core/ShadowRootContext--ArKkwbH.js +7 -0
- package/dist/core/chunk-t7YoJN_i.js +11 -0
- package/dist/core/comment-kit-ui-DjWARy4X.js +9483 -0
- package/dist/core/dom-x9svfpMk.js +223 -0
- package/dist/core/error-boundary-CN_BGsYl.js +21 -0
- package/dist/core/mount-ui-DrFjMJJu.js +55 -0
- package/dist/core/pusher-CizoY5NA.js +2504 -0
- package/dist/core/realtime-DYf6E_sN.js +278 -0
- package/dist/core/shadow-root-09zwHxly.js +86 -0
- package/dist/core/styles-D19zARBi.js +2 -0
- package/dist/core/websocket-manager-DorGPjR4.js +351 -0
- package/dist/preact/ShadowRootContext-CJWLIRy4.js +7 -0
- package/dist/preact/chunk-CZ0PdaaN.js +11 -0
- package/dist/preact/comment-kit-ui-BKi15Z4Q.js +9483 -0
- package/dist/preact/dom-BAV8grk_.js +97 -0
- package/dist/preact/error-boundary-B4-Bfy3g.js +21 -0
- package/dist/preact/limits-C3ZEKcL_.js +71 -0
- package/dist/preact/mount-ui-b9JcJQYE.js +55 -0
- package/dist/preact/pusher-BP4kCufH.js +2504 -0
- package/dist/preact/realtime-BFgP4BlB.js +558 -0
- package/dist/preact/shadow-root-DAhpHo_W.js +86 -0
- package/dist/preact/styles-Dwd4AJR8.js +2 -0
- package/dist/preact.es.js +3465 -0
- package/dist/qwik/ShadowRootContext-CTbULRKq.js +7 -0
- package/dist/qwik/chunk-CKKKzG2Q.js +11 -0
- package/dist/qwik/comment-kit-ui-CRmJhZlX.js +9483 -0
- package/dist/qwik/dom-BjJ-QroQ.js +97 -0
- package/dist/qwik/error-boundary-C4hlYQwS.js +21 -0
- package/dist/qwik/limits-DK35yjGY.js +71 -0
- package/dist/qwik/mount-ui-CaRrLb9u.js +55 -0
- package/dist/qwik/pusher-B1KgC4iB.js +2504 -0
- package/dist/qwik/realtime-DUhkZAVc.js +558 -0
- package/dist/qwik/shadow-root-tLjXys-_.js +86 -0
- package/dist/qwik/styles-BB1B91hh.js +2 -0
- package/dist/qwik.es.js +3458 -0
- package/dist/react/chunk--MHYZ-zp.js +12 -0
- package/dist/react/limits-Dflmuf1P.js +168 -0
- package/dist/react/pusher-3dki8s2l.js +2505 -0
- package/dist/react/realtime-C7h-Agwo.js +558 -0
- package/dist/react.es.js +13010 -0
- package/dist/solid/ShadowRootContext-BS6MCclL.js +7 -0
- package/dist/solid/chunk-B2NCWFvW.js +11 -0
- package/dist/solid/comment-kit-ui-Dw_67h_e.js +9483 -0
- package/dist/solid/dom-Bpw1A0oz.js +97 -0
- package/dist/solid/error-boundary-9mimpbZA.js +21 -0
- package/dist/solid/limits-B_69IbLl.js +71 -0
- package/dist/solid/mount-ui-bPWYgjmm.js +55 -0
- package/dist/solid/pusher-_RVNpj1f.js +2504 -0
- package/dist/solid/realtime-DK86zDCJ.js +558 -0
- package/dist/solid/shadow-root-D5nErAFI.js +86 -0
- package/dist/solid/styles-CtYBghRP.js +2 -0
- package/dist/solid.es.js +3446 -0
- package/dist/svelte/ShadowRootContext-DhByMr-q.js +7 -0
- package/dist/svelte/chunk-Pi70BKld.js +11 -0
- package/dist/svelte/comment-kit-ui-DhCWlEd8.js +9483 -0
- package/dist/svelte/dom-mfioQqLy.js +97 -0
- package/dist/svelte/error-boundary-C3GWI_IX.js +21 -0
- package/dist/svelte/limits-CURF22v3.js +71 -0
- package/dist/svelte/mount-ui-DtXWMEYn.js +55 -0
- package/dist/svelte/pusher-DN1BiUDw.js +2504 -0
- package/dist/svelte/realtime-zYOctwRk.js +558 -0
- package/dist/svelte/shadow-root-Cz-v-rYe.js +86 -0
- package/dist/svelte/styles-DKCGeARl.js +2 -0
- package/dist/svelte.es.js +3478 -0
- package/dist/types/adapters/bridge.d.ts +125 -0
- package/dist/types/adapters/errors.d.ts +3 -0
- package/dist/types/angular/index.d.ts +135 -0
- package/dist/types/core/agent-context.d.ts +17 -0
- package/dist/types/core/api-client.d.ts +137 -0
- package/dist/types/core/auth.d.ts +18 -0
- package/dist/types/core/comment-kit-core.d.ts +215 -0
- package/dist/types/core/comments.d.ts +43 -0
- package/dist/types/core/dev-grab.d.ts +14 -0
- package/dist/types/core/keyboard.d.ts +12 -0
- package/dist/types/core/limits.d.ts +52 -0
- package/dist/types/core/offline-queue.d.ts +23 -0
- package/dist/types/core/realtime.d.ts +9 -0
- package/dist/types/core/screenshot.d.ts +12 -0
- package/dist/types/core/session.d.ts +9 -0
- package/dist/types/core/source-resolver.d.ts +19 -0
- package/dist/types/core/state.d.ts +24 -0
- package/dist/types/core/types.d.ts +610 -0
- package/dist/types/core/websocket-manager.d.ts +107 -0
- package/dist/types/index.d.ts +85 -0
- package/dist/types/preact/index.d.ts +25 -0
- package/dist/types/qwik/index.d.ts +70 -0
- package/dist/types/react/client.d.ts +31 -0
- package/dist/types/react/comment-kit-ui.d.ts +9 -0
- package/dist/types/react/components/comment-fab.d.ts +34 -0
- package/dist/types/react/components/dev-export-panel.d.ts +10 -0
- package/dist/types/react/components/element-selector.d.ts +11 -0
- package/dist/types/react/components/live-region.d.ts +16 -0
- package/dist/types/react/components/screenshot-capture.d.ts +17 -0
- package/dist/types/react/components/status-indicator.d.ts +43 -0
- package/dist/types/react/error-boundary.d.ts +25 -0
- package/dist/types/react/index.d.ts +4 -0
- package/dist/types/react/is-local-host.d.ts +2 -0
- package/dist/types/react/mount-ui.d.ts +19 -0
- package/dist/types/react/shadow-root.d.ts +23 -0
- package/dist/types/react/shims/use-sync-external-store-with-selector.d.ts +4 -0
- package/dist/types/react/shims/use-sync-external-store.d.ts +1 -0
- package/dist/types/react/ui/lib/ShadowRootContext.d.ts +10 -0
- package/dist/types/react/ui/lib/cn.d.ts +12 -0
- package/dist/types/react/ui/primitives/alert-dialog/alert-dialog.d.ts +23 -0
- package/dist/types/react/ui/primitives/alert-dialog/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/avatar/avatar.d.ts +10 -0
- package/dist/types/react/ui/primitives/avatar/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/badge/badge.d.ts +5 -0
- package/dist/types/react/ui/primitives/badge/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/button/button.d.ts +6 -0
- package/dist/types/react/ui/primitives/button/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/card/card.d.ts +11 -0
- package/dist/types/react/ui/primitives/card/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/checkbox/checkbox.d.ts +3 -0
- package/dist/types/react/ui/primitives/checkbox/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/dialog/dialog.d.ts +17 -0
- package/dist/types/react/ui/primitives/dialog/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/dropdown-menu/dropdown-menu.d.ts +29 -0
- package/dist/types/react/ui/primitives/dropdown-menu/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/empty/empty.d.ts +10 -0
- package/dist/types/react/ui/primitives/empty/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/field/field.d.ts +22 -0
- package/dist/types/react/ui/primitives/field/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/hover-card/hover-card.d.ts +6 -0
- package/dist/types/react/ui/primitives/hover-card/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/input/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/input/input.d.ts +3 -0
- package/dist/types/react/ui/primitives/input-group/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/input-group/input-group.d.ts +16 -0
- package/dist/types/react/ui/primitives/kbd/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/kbd/kbd.d.ts +4 -0
- package/dist/types/react/ui/primitives/label/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/label/label.d.ts +3 -0
- package/dist/types/react/ui/primitives/native-select/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/native-select/native-select.d.ts +7 -0
- package/dist/types/react/ui/primitives/popover/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/popover/popover.d.ts +9 -0
- package/dist/types/react/ui/primitives/preview/component-preview.d.ts +8 -0
- package/dist/types/react/ui/primitives/progress/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/progress/progress.d.ts +7 -0
- package/dist/types/react/ui/primitives/radio-group/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/radio-group/radio-group.d.ts +6 -0
- package/dist/types/react/ui/primitives/scroll-area/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/scroll-area/scroll-area.d.ts +6 -0
- package/dist/types/react/ui/primitives/select/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/select/select.d.ts +15 -0
- package/dist/types/react/ui/primitives/separator/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/separator/separator.d.ts +3 -0
- package/dist/types/react/ui/primitives/sheet/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/sheet/sheet.d.ts +14 -0
- package/dist/types/react/ui/primitives/skeleton/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/skeleton/skeleton.d.ts +3 -0
- package/dist/types/react/ui/primitives/slider/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/slider/slider.d.ts +7 -0
- package/dist/types/react/ui/primitives/sonner/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/sonner/sonner.d.ts +4 -0
- package/dist/types/react/ui/primitives/spinner/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/spinner/spinner.d.ts +3 -0
- package/dist/types/react/ui/primitives/switch/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/switch/switch.d.ts +5 -0
- package/dist/types/react/ui/primitives/tabs/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/tabs/tabs.d.ts +8 -0
- package/dist/types/react/ui/primitives/textarea/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/textarea/textarea.d.ts +3 -0
- package/dist/types/react/ui/primitives/toggle/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/toggle/toggle.d.ts +7 -0
- package/dist/types/react/ui/primitives/toggle-group/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/toggle-group/toggle-group.d.ts +14 -0
- package/dist/types/react/ui/primitives/tooltip/index.d.ts +1 -0
- package/dist/types/react/ui/primitives/tooltip/tooltip.d.ts +7 -0
- package/dist/types/solid/index.d.ts +37 -0
- package/dist/types/svelte/index.d.ts +55 -0
- package/dist/types/utils/dom.d.ts +59 -0
- package/dist/types/utils/event-emitter.d.ts +11 -0
- package/dist/types/utils/freeze-animations.d.ts +8 -0
- package/dist/types/utils/text.d.ts +9 -0
- package/dist/types/utils/validation.d.ts +10 -0
- package/dist/types/vue/index.d.ts +87 -0
- package/dist/vue/ShadowRootContext-BQTcHNil.js +7 -0
- package/dist/vue/chunk-DHrubWSL.js +11 -0
- package/dist/vue/comment-kit-ui-BX1wDZ2c.js +9483 -0
- package/dist/vue/dom-eo0P9Z6Z.js +97 -0
- package/dist/vue/error-boundary-DW6uGR8U.js +21 -0
- package/dist/vue/limits-B6csdQeI.js +71 -0
- package/dist/vue/mount-ui-DdTYzv6J.js +55 -0
- package/dist/vue/pusher-cmjNbW6a.js +2504 -0
- package/dist/vue/realtime-YJKvS2eB.js +558 -0
- package/dist/vue/shadow-root-SLTVf5yk.js +86 -0
- package/dist/vue/styles-BrHt1-ia.js +2 -0
- package/dist/vue.es.js +3495 -0
- package/package.json +205 -4
package/README.md
CHANGED
|
@@ -1,3 +1,767 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CommentKit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Figma-style comments, drawing, and feedback for any website.**
|
|
4
|
+
Drop-in SDK for React, Vue, Svelte, Angular, Solid.js, Qwik, Preact, and vanilla JavaScript.
|
|
5
|
+
|
|
6
|
+
[npm version](https://www.npmjs.com/package/comment-kit)
|
|
7
|
+
[downloads](https://www.npmjs.com/package/comment-kit)
|
|
8
|
+
[license](https://github.com/commentkit/comment-kit/blob/main/LICENSE)
|
|
9
|
+
[docs](https://commentkit.com/docs)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
| Feature | Description |
|
|
16
|
+
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| **Pin Comments** | Click anywhere on a page to leave a comment pin |
|
|
18
|
+
| **Element Comments** | Select a real DOM element, comment on it, and keep it marked until resolved |
|
|
19
|
+
| **Text Highlighting** | Select text to annotate with contextual feedback |
|
|
20
|
+
| **Drawing Tools** | Freehand draw, shapes, and arrows overlaid on the page |
|
|
21
|
+
| **Screenshots** | Capture annotated screenshots with one click |
|
|
22
|
+
| **Real-Time Collaboration** | See live cursors, presence indicators, and instant updates |
|
|
23
|
+
| **Offline Support** | Mutations queue automatically and retry when back online |
|
|
24
|
+
| **OTP Authentication** | Built-in passwordless email authentication |
|
|
25
|
+
| **Member Invite Links** | Invite members by email — they verify via OTP to join |
|
|
26
|
+
| **Task Workflows** | Assign, prioritize, resolve, and track comments as tasks |
|
|
27
|
+
| **@Mentions** | Tag team members with autocomplete from your project roster |
|
|
28
|
+
| **Reactions** | Emoji reactions on comments and replies |
|
|
29
|
+
| **Deep Linking** | Link directly to any comment via URL hash |
|
|
30
|
+
| **Agent Handoff** | Copy unresolved comments + element source + screenshot to Claude Desktop, Cursor, Codex, Continue, Zed AI, or any clipboard-aware agent |
|
|
31
|
+
| **Source-Resolved Output** | When the `element-source` peer is installed, agent context includes `file:line:col` and the component stack for each element |
|
|
32
|
+
| **Dev Grab** | One-click capture: any element on your localhost site → clipboard with Markdown + `image/png` screenshot for direct paste into your agent |
|
|
33
|
+
| **Dev Export Panel** | On localhost, bulk-select stakeholder comments from production/staging and copy them as one bundled agent payload |
|
|
34
|
+
| **Multi-Select** | Shift+click or drag a marquee to grab multiple elements at once |
|
|
35
|
+
| **Context Menu** | Right-click any element while in select mode: grab, comment, copy selector, copy XPath, inspect |
|
|
36
|
+
| **Hold-to-Activate** | Configure select mode to be active only while a modifier key is held (`Alt`, `Meta`, `Control`, `Shift`) |
|
|
37
|
+
| **Animation Freeze** | While selecting, all host-page CSS animations, transitions, and Web Animations API tweens pause |
|
|
38
|
+
| **Touch Mode** | Long-press opens the context menu on touch devices |
|
|
39
|
+
| **MCP Server** | The `comment-kit-mcp` sibling package lets agents read comments over Model Context Protocol — no clipboard needed |
|
|
40
|
+
| **Keyboard Shortcuts** | Full keyboard navigation and tool shortcuts |
|
|
41
|
+
| **Shadow DOM Isolation** | UI is fully isolated from your app's styles |
|
|
42
|
+
| **Environment Scoping** | New comments are tagged to production, staging, preview, or dev |
|
|
43
|
+
| **Auto-Configuration** | SDK auto-detects projectId, WebSocket config, and invite tokens |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
### 1. Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install comment-kit
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Get Your API Key
|
|
56
|
+
|
|
57
|
+
1. Sign up at [commentkit.com](https://commentkit.com)
|
|
58
|
+
2. Create an organization
|
|
59
|
+
3. Create a project inside the organization
|
|
60
|
+
4. Copy the **API key** from the project dashboard
|
|
61
|
+
|
|
62
|
+
Each project gets its own API key. The SDK reads everything else (project ID, WebSocket config, features) from the API automatically.
|
|
63
|
+
|
|
64
|
+
### 3. Add to Your App
|
|
65
|
+
|
|
66
|
+
**Next.js (App Router)**
|
|
67
|
+
|
|
68
|
+
Next.js 16 with Turbopack prerenders `/_not-found` during `next build`. CommentKit is browser-only (Shadow DOM, `self`), so import it through `next/dynamic` with `{ ssr: false }` and consume the wrapper inside the server layout.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
// app/comment-kit-client.tsx
|
|
72
|
+
"use client";
|
|
73
|
+
import dynamic from "next/dynamic";
|
|
74
|
+
|
|
75
|
+
const CommentKit = dynamic(() => import("comment-kit/react").then((m) => m.CommentKit), {
|
|
76
|
+
ssr: false,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export function CommentKitClient(props: { apiKey: string }) {
|
|
80
|
+
return <CommentKit apiKey={props.apiKey} />;
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
// app/layout.tsx
|
|
86
|
+
import { CommentKitClient } from "./comment-kit-client";
|
|
87
|
+
|
|
88
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
89
|
+
return (
|
|
90
|
+
<html lang="en">
|
|
91
|
+
<body>
|
|
92
|
+
{children}
|
|
93
|
+
<CommentKitClient apiKey="your-api-key" />
|
|
94
|
+
</body>
|
|
95
|
+
</html>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Next.js (Pages Router)**
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
// pages/_app.tsx
|
|
104
|
+
import { CommentKit } from "comment-kit/react";
|
|
105
|
+
import type { AppProps } from "next/app";
|
|
106
|
+
|
|
107
|
+
export default function App({ Component, pageProps }: AppProps) {
|
|
108
|
+
return (
|
|
109
|
+
// Works with any CSS setup — Tailwind, CSS Modules, styled-components.
|
|
110
|
+
// CommentKit UI is fully isolated inside Shadow DOM.
|
|
111
|
+
<CommentKit
|
|
112
|
+
apiKey="your-api-key"
|
|
113
|
+
// onReady={() => console.log("CommentKit loaded")}
|
|
114
|
+
// onError={(err) => console.error(err)}
|
|
115
|
+
>
|
|
116
|
+
<Component {...pageProps} />
|
|
117
|
+
</CommentKit>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Remix**
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
// app/root.tsx
|
|
126
|
+
import { CommentKit } from "comment-kit/react";
|
|
127
|
+
|
|
128
|
+
export default function App() {
|
|
129
|
+
return (
|
|
130
|
+
<html lang="en">
|
|
131
|
+
<head>
|
|
132
|
+
<Meta />
|
|
133
|
+
<Links />
|
|
134
|
+
</head>
|
|
135
|
+
<body>
|
|
136
|
+
<Outlet />
|
|
137
|
+
{/* Same as Next.js — sits outside your providers, fully self-contained */}
|
|
138
|
+
<CommentKit apiKey="your-api-key" />
|
|
139
|
+
<Scripts />
|
|
140
|
+
</body>
|
|
141
|
+
</html>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**React (Vite / CRA)**
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
// main.tsx or App.tsx
|
|
150
|
+
import { CommentKit } from "comment-kit/react";
|
|
151
|
+
|
|
152
|
+
export default function App() {
|
|
153
|
+
return (
|
|
154
|
+
// Drop-in: renders a floating toolbar with comment, draw,
|
|
155
|
+
// highlight, and screenshot tools. Tooltips built-in.
|
|
156
|
+
// Theme follows .dark/.light class or system preference.
|
|
157
|
+
<CommentKit apiKey="your-api-key">{/* Your app content */}</CommentKit>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Vue 3**
|
|
163
|
+
|
|
164
|
+
```vue
|
|
165
|
+
<script setup>
|
|
166
|
+
import { useCommentKit } from "comment-kit/vue";
|
|
167
|
+
|
|
168
|
+
// Reactive refs — auto-update when state changes.
|
|
169
|
+
// Theme auto-detects. Tooltips built into the toolbar.
|
|
170
|
+
const { isAuthenticated, comments, toggleOverlay } = useCommentKit({
|
|
171
|
+
apiKey: "your-api-key",
|
|
172
|
+
// ui: { theme: "dark", position: "bottom-left" },
|
|
173
|
+
});
|
|
174
|
+
</script>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Or register as a plugin:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
// main.ts — makes useCommentKit available app-wide via provide/inject
|
|
181
|
+
import { CommentKitPlugin } from "comment-kit/vue";
|
|
182
|
+
|
|
183
|
+
app.use(CommentKitPlugin);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Nuxt 3 / Nuxt 4**
|
|
187
|
+
|
|
188
|
+
CommentKit must never load on the Nitro server. The cleanest pattern is a component whose filename ends in `.client.vue` — Nuxt strips it from the SSR bundle entirely.
|
|
189
|
+
|
|
190
|
+
```vue
|
|
191
|
+
<!-- components/CommentKitClient.client.vue -->
|
|
192
|
+
<script setup lang="ts">
|
|
193
|
+
import { onMounted } from "vue";
|
|
194
|
+
import { useCommentKit } from "comment-kit/vue";
|
|
195
|
+
|
|
196
|
+
onMounted(() => {
|
|
197
|
+
useCommentKit({ apiKey: "your-api-key" });
|
|
198
|
+
});
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<template><div /></template>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```vue
|
|
205
|
+
<!-- app.vue -->
|
|
206
|
+
<template>
|
|
207
|
+
<div>
|
|
208
|
+
<NuxtPage />
|
|
209
|
+
<CommentKitClient />
|
|
210
|
+
</div>
|
|
211
|
+
</template>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Svelte**
|
|
215
|
+
|
|
216
|
+
```svelte
|
|
217
|
+
<script>
|
|
218
|
+
import { useCommentKit } from "comment-kit/svelte";
|
|
219
|
+
|
|
220
|
+
// Svelte stores — use $store syntax for reactivity.
|
|
221
|
+
// Theme auto-detects. Tooltips built into the toolbar.
|
|
222
|
+
const { comments, isAuthenticated, toggleOverlay } = useCommentKit({
|
|
223
|
+
apiKey: "your-api-key",
|
|
224
|
+
// ui: { theme: "dark" },
|
|
225
|
+
});
|
|
226
|
+
</script>
|
|
227
|
+
|
|
228
|
+
<button on:click={toggleOverlay}>Toggle Comments</button>
|
|
229
|
+
<p>Comments: {$comments.length}</p>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**SvelteKit**
|
|
233
|
+
|
|
234
|
+
SvelteKit prerenders pages on the server, so dynamic-import inside `onMount` (which is client-only by definition) keeps `comment-kit/svelte` off the SSR module graph entirely.
|
|
235
|
+
|
|
236
|
+
```svelte
|
|
237
|
+
<!-- src/routes/+layout.svelte -->
|
|
238
|
+
<script lang="ts">
|
|
239
|
+
import { onMount } from "svelte";
|
|
240
|
+
import { browser } from "$app/environment";
|
|
241
|
+
|
|
242
|
+
onMount(async () => {
|
|
243
|
+
if (!browser) return;
|
|
244
|
+
const { useCommentKit } = await import("comment-kit/svelte");
|
|
245
|
+
useCommentKit({ apiKey: "your-api-key" });
|
|
246
|
+
});
|
|
247
|
+
</script>
|
|
248
|
+
|
|
249
|
+
<slot />
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Angular**
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// app.config.ts
|
|
256
|
+
import { provideCommentKit } from "comment-kit/angular";
|
|
257
|
+
|
|
258
|
+
export const appConfig = {
|
|
259
|
+
providers: [
|
|
260
|
+
// Registers CommentKitService with DI.
|
|
261
|
+
// Theme auto-detects. All UI isolated in Shadow DOM.
|
|
262
|
+
provideCommentKit({
|
|
263
|
+
apiKey: "your-api-key",
|
|
264
|
+
// ui: { theme: "dark", position: "bottom-left" },
|
|
265
|
+
}),
|
|
266
|
+
],
|
|
267
|
+
};
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
// app.component.ts
|
|
272
|
+
import { CommentKitService } from "comment-kit/angular";
|
|
273
|
+
|
|
274
|
+
@Component({ ... })
|
|
275
|
+
export class AppComponent {
|
|
276
|
+
constructor(private commentKit: CommentKitService) {}
|
|
277
|
+
|
|
278
|
+
// RxJS observables — auto-emit on state changes
|
|
279
|
+
comments$ = this.commentKit.comments$;
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Solid.js / SolidStart**
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
import { useCommentKit } from "comment-kit/solid";
|
|
287
|
+
|
|
288
|
+
function App() {
|
|
289
|
+
// Solid signals — auto-track dependencies, fine-grained reactivity.
|
|
290
|
+
// Full UI mounts in Shadow DOM automatically.
|
|
291
|
+
const { comments, isAuthenticated, toggleOverlay } = useCommentKit({
|
|
292
|
+
apiKey: "your-api-key",
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
return <p>Comments: {comments().length}</p>;
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Qwik / QwikCity**
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
import { component$ } from "@builder.io/qwik";
|
|
303
|
+
import { useCommentKit$ } from "comment-kit/qwik";
|
|
304
|
+
|
|
305
|
+
export default component$(() => {
|
|
306
|
+
// Qwik signals — serializable, resumable.
|
|
307
|
+
// Full UI mounts in Shadow DOM on the client (useVisibleTask$).
|
|
308
|
+
const { state, isReady } = useCommentKit$({
|
|
309
|
+
apiKey: "your-api-key",
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
return <p>Ready: {isReady.value}</p>;
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Preact**
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
import { useCommentKit } from "comment-kit/preact";
|
|
320
|
+
|
|
321
|
+
function App() {
|
|
322
|
+
// Preact hooks — lightweight React alternative.
|
|
323
|
+
// Full UI mounts in Shadow DOM via React (required peer dep).
|
|
324
|
+
const { state, core } = useCommentKit({
|
|
325
|
+
apiKey: "your-api-key",
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
return <p>Comments: {state?.comments.length ?? 0}</p>;
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Astro**
|
|
333
|
+
|
|
334
|
+
Astro needs the React integration installed (`npx astro add react`). Wrap the import in a tiny React component so `client:only="react"` keeps CommentKit out of the server bundle.
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
// src/components/CommentKitClient.tsx
|
|
338
|
+
import { useEffect, useState } from "react";
|
|
339
|
+
|
|
340
|
+
export default function CommentKitClient({ apiKey }: { apiKey: string }) {
|
|
341
|
+
const [Cmp, setCmp] = useState<React.ComponentType<{ apiKey: string }> | null>(null);
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
import("comment-kit/react").then((m) => setCmp(() => m.CommentKit));
|
|
344
|
+
}, []);
|
|
345
|
+
return Cmp ? <Cmp apiKey={apiKey} /> : null;
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
```astro
|
|
350
|
+
---
|
|
351
|
+
// src/layouts/Layout.astro
|
|
352
|
+
import CommentKitClient from "../components/CommentKitClient";
|
|
353
|
+
---
|
|
354
|
+
<html lang="en">
|
|
355
|
+
<body>
|
|
356
|
+
<slot />
|
|
357
|
+
<CommentKitClient client:only="react" apiKey="your-api-key" />
|
|
358
|
+
</body>
|
|
359
|
+
</html>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Or use vanilla JS in any `.astro` page:
|
|
363
|
+
|
|
364
|
+
```html
|
|
365
|
+
<script>
|
|
366
|
+
import { CommentKit } from "comment-kit";
|
|
367
|
+
new CommentKit({ apiKey: "your-api-key" });
|
|
368
|
+
</script>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Vanilla JavaScript**
|
|
372
|
+
|
|
373
|
+
```html
|
|
374
|
+
<!-- CommentKit auto-mounts a floating toolbar on your page.
|
|
375
|
+
Theme follows .dark class on <html> or system preference.
|
|
376
|
+
Tooltips, dialogs, and panels are built-in. -->
|
|
377
|
+
<script type="module">
|
|
378
|
+
import { CommentKit } from "comment-kit";
|
|
379
|
+
|
|
380
|
+
const ck = new CommentKit({
|
|
381
|
+
apiKey: "your-api-key",
|
|
382
|
+
// ui: { theme: "dark", position: "bottom-left" },
|
|
383
|
+
});
|
|
384
|
+
</script>
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Member Invite Links
|
|
390
|
+
|
|
391
|
+
Invite external collaborators by email — they verify via OTP before they can comment:
|
|
392
|
+
|
|
393
|
+
1. **Dashboard:** Enter the member's email and create an invite link
|
|
394
|
+
2. **Share:** Send the link (e.g. `https://yoursite.com?ck_invite=token`) to the member
|
|
395
|
+
3. **Verify:** When they visit, the SDK detects the invite token and prompts for their email
|
|
396
|
+
4. **OTP:** If the email matches the invite, an OTP is sent for verification
|
|
397
|
+
5. **Collaborate:** After verification, they're a full member and can comment
|
|
398
|
+
|
|
399
|
+
The SDK auto-detects `?ck_invite=` from the URL — no code changes needed.
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Works With
|
|
404
|
+
|
|
405
|
+
Every framework and meta-framework gets the full CommentKit UI — identical toolbar, sidebar, login, and comments panel rendered in Shadow DOM.
|
|
406
|
+
|
|
407
|
+
**React family** — `comment-kit/react`
|
|
408
|
+
|
|
409
|
+
| Framework / Tool | Notes |
|
|
410
|
+
| ----------------------- | --------------------------------------------------------------------- |
|
|
411
|
+
| React | Vite, CRA, esbuild, Rollup, Parcel, plain webpack — same import |
|
|
412
|
+
| Next.js (App Router) | `<CommentKit>` is `"use client"` — works inside a server `layout.tsx` |
|
|
413
|
+
| Next.js (Pages Router) | Mount once in `_app.tsx` |
|
|
414
|
+
| Remix / React Router v7 | Mount in `root.tsx` |
|
|
415
|
+
| Gatsby | Mount in `gatsby-browser.js` or any page |
|
|
416
|
+
| RedwoodJS | Mount in `App.tsx` |
|
|
417
|
+
| TanStack Start | Mount in `app/client.tsx` |
|
|
418
|
+
| Vinxi | Same as TanStack Start |
|
|
419
|
+
| Million.js | React-compatible; same import |
|
|
420
|
+
| Blitz.js | Next.js underneath; same as Next |
|
|
421
|
+
| Modern.js | React-based; same import |
|
|
422
|
+
| Refine | React-based; mount alongside `<Refine>` |
|
|
423
|
+
| Docusaurus | Drop into `swizzled` `Root` component |
|
|
424
|
+
| Nextra | Drop into `theme.config.tsx` layout |
|
|
425
|
+
| Laravel Inertia (React) | Mount in `app.tsx` |
|
|
426
|
+
|
|
427
|
+
**Vue family** — `comment-kit/vue`
|
|
428
|
+
|
|
429
|
+
| Framework / Tool | Notes |
|
|
430
|
+
| --------------------- | ------------------------------------------------------------------ |
|
|
431
|
+
| Vue 3 | Vite, CLI, esbuild, Rollup — same import |
|
|
432
|
+
| Nuxt 3 / Nuxt 4 | Client-only — wrap in `<ClientOnly>` or check `import.meta.client` |
|
|
433
|
+
| Quasar | Mount in `boot/commentkit.ts` |
|
|
434
|
+
| VitePress / VuePress | Mount in `.vitepress/theme/index.ts` |
|
|
435
|
+
| Vike-Vue | Mount in `_default.page.client.ts` |
|
|
436
|
+
| Laravel Inertia (Vue) | Mount in `app.ts` |
|
|
437
|
+
|
|
438
|
+
**Svelte family** — `comment-kit/svelte`
|
|
439
|
+
|
|
440
|
+
| Framework / Tool | Notes |
|
|
441
|
+
| ------------------------ | ------------------------------------------------------- |
|
|
442
|
+
| Svelte 5 | Vite, esbuild — same import |
|
|
443
|
+
| SvelteKit | Gate on `browser` from `$app/environment` (see snippet) |
|
|
444
|
+
| Laravel Inertia (Svelte) | Mount in `app.ts` |
|
|
445
|
+
|
|
446
|
+
**Angular family** — `comment-kit/angular`
|
|
447
|
+
|
|
448
|
+
| Framework / Tool | Notes |
|
|
449
|
+
| ------------------------ | -------------------------------------------------- |
|
|
450
|
+
| Angular 17+ (standalone) | `provideCommentKit({ apiKey })` in `app.config.ts` |
|
|
451
|
+
| Analog | Angular-based meta-framework; same provider |
|
|
452
|
+
| Angular Universal | Provider is browser-only-safe (SSR-aware) |
|
|
453
|
+
|
|
454
|
+
**Solid family** — `comment-kit/solid`
|
|
455
|
+
|
|
456
|
+
| Framework / Tool | Notes |
|
|
457
|
+
| ---------------- | ------------------------------------ |
|
|
458
|
+
| Solid.js | Vite, esbuild — same import |
|
|
459
|
+
| SolidStart | Use inside a `<ClientOnly>` boundary |
|
|
460
|
+
| Vike-Solid | Same as SolidStart |
|
|
461
|
+
|
|
462
|
+
**Qwik family** — `comment-kit/qwik`
|
|
463
|
+
|
|
464
|
+
| Framework / Tool | Notes |
|
|
465
|
+
| ---------------- | ---------------------------------------------------- |
|
|
466
|
+
| Qwik | Inside `useVisibleTask$` (client-only by definition) |
|
|
467
|
+
| QwikCity | Same; mount in `root.tsx` |
|
|
468
|
+
|
|
469
|
+
**Preact family** — `comment-kit/preact`
|
|
470
|
+
|
|
471
|
+
| Framework / Tool | Notes |
|
|
472
|
+
| ---------------- | ------------------------------ |
|
|
473
|
+
| Preact | Vite, esbuild — same import |
|
|
474
|
+
| Fresh (Deno) | Use in an `islands/` component |
|
|
475
|
+
|
|
476
|
+
**Multi-framework / unified** — `comment-kit/react`, `comment-kit/vue`, `comment-kit/svelte`, `comment-kit/preact`, or `comment-kit/solid` depending on island
|
|
477
|
+
|
|
478
|
+
| Framework / Tool | Notes |
|
|
479
|
+
| ---------------------- | ------------------------------------------------------- |
|
|
480
|
+
| Astro | Use any adapter under `client:only` matching the island |
|
|
481
|
+
| Vike (multi-framework) | Pick adapter matching your selected framework |
|
|
482
|
+
|
|
483
|
+
**Vanilla / Web Components / HTML-first** — `comment-kit`
|
|
484
|
+
|
|
485
|
+
| Framework / Tool | Notes |
|
|
486
|
+
| -------------------------- | ------------------------------------------------------- |
|
|
487
|
+
| Plain HTML (no framework) | `<script type="module">` + `new CommentKit({ apiKey })` |
|
|
488
|
+
| Web Components / Lit | Mount in `connectedCallback` of a host component |
|
|
489
|
+
| Stencil | Mount in `componentDidLoad` |
|
|
490
|
+
| Marko (eBay) | Mount in client init |
|
|
491
|
+
| Alpine.js / Petite-Vue | `<script>` tag at end of `<body>` |
|
|
492
|
+
| htmx | Same as plain HTML |
|
|
493
|
+
| Stimulus / Hotwire (Rails) | Mount in a Stimulus controller's `connect()` |
|
|
494
|
+
| Phoenix LiveView | Mount in a `hook.mounted()` |
|
|
495
|
+
| Laravel Livewire | Mount in Livewire hook |
|
|
496
|
+
| Laravel Filament | Drop the `<script>` into a custom page layout |
|
|
497
|
+
| Mitosis | Mount in the compiled framework's init |
|
|
498
|
+
|
|
499
|
+
**WebView / hybrid shells** — `comment-kit` (vanilla), works the same as a normal page
|
|
500
|
+
|
|
501
|
+
| Shell | Notes |
|
|
502
|
+
| ----------------- | ---------------------------------------------- |
|
|
503
|
+
| Electron | Renderer process — like a normal Chromium page |
|
|
504
|
+
| Tauri | Like a normal WebView |
|
|
505
|
+
| Capacitor (Ionic) | Use inside the WebView; `html2canvas` works |
|
|
506
|
+
| Cordova | Same as Capacitor |
|
|
507
|
+
| Neutralinojs | Same |
|
|
508
|
+
|
|
509
|
+
**Not supported** — these runtimes have no DOM, and CommentKit's UI is a Shadow DOM widget. Hosting it elsewhere is not on the roadmap.
|
|
510
|
+
|
|
511
|
+
| Runtime | Why |
|
|
512
|
+
| ------------------------ | ---------------------------------------------- |
|
|
513
|
+
| React Native / Expo | No DOM; needs a separate native commenting SDK |
|
|
514
|
+
| NativeScript | No DOM |
|
|
515
|
+
| Ink (terminal UIs) | No DOM |
|
|
516
|
+
| Server-only (Hono, etc.) | Server framework, not a client target |
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## Keyboard Shortcuts
|
|
521
|
+
|
|
522
|
+
| Shortcut | Action |
|
|
523
|
+
| -------------------- | --------------------------------------------------------------------------------------------- |
|
|
524
|
+
| Cmd/Ctrl + Shift + K | Toggle overlay |
|
|
525
|
+
| C | Comment (pin) mode |
|
|
526
|
+
| E | Element selector mode |
|
|
527
|
+
| D | Drawing mode |
|
|
528
|
+
| H | Highlight mode |
|
|
529
|
+
| S | Screenshot mode |
|
|
530
|
+
| Cmd/Ctrl + C | While in select mode: grab the hovered (or selected) element to the clipboard with screenshot |
|
|
531
|
+
| Shift + click | While in select mode: add an element to the multi-select bucket |
|
|
532
|
+
| Right-click | While in select mode: open context menu (grab, comment, copy selector, copy XPath, inspect) |
|
|
533
|
+
| Long-press (touch) | While in select mode: open context menu on touch devices |
|
|
534
|
+
| ? | Show shortcuts overlay |
|
|
535
|
+
| Esc | Close / deselect / exit mode |
|
|
536
|
+
|
|
537
|
+
> Shortcuts only activate when the overlay is visible and no input is focused. Cmd/Ctrl + C respects active text selections — system copy still wins when text is highlighted.
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## Peer Dependencies
|
|
542
|
+
|
|
543
|
+
| Package | Required | Min Version |
|
|
544
|
+
| ----------------------------------- | ----------------------------------------------------------------------------- | ----------- |
|
|
545
|
+
| `react` + `react-dom` | Yes | `>=18.0.0` |
|
|
546
|
+
| `vue` | Only for Vue apps | `>=3.0.0` |
|
|
547
|
+
| `svelte` | Only for Svelte apps | `>=4.0.0` |
|
|
548
|
+
| `@angular/core` + `@angular/common` | Only for Angular apps | `>=17.0.0` |
|
|
549
|
+
| `rxjs` | Only for Angular apps | `>=7.0.0` |
|
|
550
|
+
| `solid-js` | Only for Solid.js apps | `>=1.0.0` |
|
|
551
|
+
| `@builder.io/qwik` | Only for Qwik apps | `>=1.0.0` |
|
|
552
|
+
| `preact` | Only for Preact apps | `>=10.0.0` |
|
|
553
|
+
| `html2canvas` | Only for screenshots | `>=1.4.0` |
|
|
554
|
+
| `pusher-js` | Bundled — no install needed (inlined into the SDK for real-time) | — |
|
|
555
|
+
| `element-source` | Optional — enables file:line + component stack in agent context and dev grabs | `>=0.0.5` |
|
|
556
|
+
|
|
557
|
+
> `react` and `react-dom` are always required — the vanilla JS wrapper mounts React internally.
|
|
558
|
+
|
|
559
|
+
## Agent Handoff
|
|
560
|
+
|
|
561
|
+
CommentKit was designed for the loop where stakeholders leave feedback on a live site and developers feed that feedback — plus the elements behind it — straight into Claude Desktop, Cursor, Codex, Continue, Zed AI, or any clipboard-aware coding agent.
|
|
562
|
+
|
|
563
|
+
There are three integration paths.
|
|
564
|
+
|
|
565
|
+
### 1. Element selector (toolbar)
|
|
566
|
+
|
|
567
|
+
The toolbar's **Element** tool (`E`) lets anyone — stakeholder or developer — click a page element, write a short comment, and save. CommentKit persists a viewport position plus `position.element` and `position.xpath`. Anchored comments render a persistent outline that re-resolves on scroll, resize, and DOM mutations.
|
|
568
|
+
|
|
569
|
+
### 2. Dev grab (developer, local)
|
|
570
|
+
|
|
571
|
+
In the same Element-tool composer, a **Grab for agent** button copies the selected element directly to the clipboard — no backend save. ⌘C / Ctrl+C on the hovered element does the same. The clipboard payload includes:
|
|
572
|
+
|
|
573
|
+
- A Markdown summary with tag name, component name (when resolved), source file location (`file:line:col`), component stack, the element's `outerHTML`, and the page URL.
|
|
574
|
+
- An `image/png` clipboard MIME carrying the rendered element screenshot. Agents that accept image pastes (Claude Desktop, Cursor, Codex) drop both the text and the image in one paste.
|
|
575
|
+
|
|
576
|
+
```ts
|
|
577
|
+
const result = await commentKit.grabElement(document.querySelector("#checkout-btn")!);
|
|
578
|
+
// result.markdown — Markdown payload now on the clipboard
|
|
579
|
+
// result.screenshotDataUrl — base64 PNG, also attached to the clipboard
|
|
580
|
+
// result.element.source — { filePath, lineNumber, columnNumber, componentName } when resolved
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
For multiple elements, hold Shift while clicking (or drag a marquee) and call:
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
const bundle = await commentKit.grabElements([el1, el2, el3]);
|
|
587
|
+
// bundle.markdown — single bundled payload, each entry with its own screenshot inlined as a data URL
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
Source resolution kicks in when the optional `element-source` peer dep is installed. Without it, the output falls back to `selector` + `xpath`.
|
|
591
|
+
|
|
592
|
+
### 3. Bulk export of stakeholder comments (developer, local)
|
|
593
|
+
|
|
594
|
+
The toolbar's **Dev export** button (visible only on localhost) opens a side panel listing every open stakeholder comment from production / staging / preview. Select N comments, click **Copy N for agent**, and the clipboard receives one bundled Markdown payload — each comment's content, replies, author, page URL, the stakeholder's screenshot, the element's resolved source location (looked up against the developer's local build), and the selector / XPath fallback.
|
|
595
|
+
|
|
596
|
+
```ts
|
|
597
|
+
await commentKit.copyAgentContext({
|
|
598
|
+
includeResolved: false,
|
|
599
|
+
currentPageOnly: true,
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
const prompt = await commentKit.formatAgentContextAsync({ includeResolved: false });
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
### MCP server
|
|
606
|
+
|
|
607
|
+
The [`comment-kit-mcp`](./mcp/README.md) sibling package exposes `list_comments`, `get_comment`, and `search_comments` as MCP tools. Agents that speak Model Context Protocol (Claude Desktop, Cursor, Claude Code, Codex CLI, Continue, Zed AI) can pull stakeholder feedback for the page they're working on without leaving the editor.
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
npx -y comment-kit-mcp
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## Configuration
|
|
616
|
+
|
|
617
|
+
Most apps only need `apiKey`. Everything else is auto-configured.
|
|
618
|
+
|
|
619
|
+
```typescript
|
|
620
|
+
{
|
|
621
|
+
apiKey: "your-api-key", // required — from dashboard
|
|
622
|
+
enabled: true, // optional — set false to disable completely
|
|
623
|
+
screenshotProvider: async (el) => {...}, // optional — replaces html2canvas
|
|
624
|
+
ui: {
|
|
625
|
+
theme: "auto", // "light" | "dark" | "auto"
|
|
626
|
+
position: "bottom-right", // "bottom-right" | "bottom-left" | "top-right" | "top-left"
|
|
627
|
+
activation: {
|
|
628
|
+
mode: "toggle", // "toggle" (default) | "hold"
|
|
629
|
+
key: "Alt", // "Alt" | "Meta" | "Control" | "Shift" — used by hold mode
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
realtime: { // optional — collaboration tuning
|
|
633
|
+
cursors: true, // live peer cursors (default true; set false on high-concurrency projects)
|
|
634
|
+
presence: true, // online-users list (default true)
|
|
635
|
+
maxRenderedCursors: 24, // cap on distinct remote cursors rendered at once
|
|
636
|
+
},
|
|
637
|
+
}
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
### Realtime at scale
|
|
641
|
+
|
|
642
|
+
Live cursors are the one realtime feature whose cost grows with the number of
|
|
643
|
+
simultaneous viewers — each client can receive up to _(online peers × ~30fps)_
|
|
644
|
+
cursor events. The SDK keeps this flat regardless of project size with three
|
|
645
|
+
inbound bounds (per-peer ~30fps throttle, a distinct-cursor cap, and a global
|
|
646
|
+
per-second emit budget), and the online-users roster is capped at 500. For very
|
|
647
|
+
high-concurrency projects where cursor sharing isn't worth the bandwidth, set
|
|
648
|
+
`realtime.cursors: false` (stops outbound cursor whispers and drops inbound
|
|
649
|
+
cursor events) and/or `realtime.presence: false`. Comment/reply/reaction
|
|
650
|
+
broadcasts are unaffected by these knobs.
|
|
651
|
+
|
|
652
|
+
To disable in production:
|
|
653
|
+
|
|
654
|
+
```tsx
|
|
655
|
+
<CommentKit apiKey="your-api-key" enabled={process.env.NODE_ENV !== "production"} />
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## Privacy & Security
|
|
661
|
+
|
|
662
|
+
CommentKit is designed to be safe for production use on customer-facing websites.
|
|
663
|
+
|
|
664
|
+
| Concern | How CommentKit handles it |
|
|
665
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
666
|
+
| **No telemetry** | The SDK sends zero analytics, tracking, or telemetry data. No data is collected from your users. |
|
|
667
|
+
| **No phone-home** | The SDK only communicates with `api.commentkit.com` (your backend) by default. Google Fonts (`fonts.googleapis.com`) is contacted only when you opt in via `ui.loadRemoteFonts: true`. No other third-party services. |
|
|
668
|
+
| **No install scripts** | `npm install` runs zero code. No `postinstall`, `preinstall`, or lifecycle scripts. |
|
|
669
|
+
| **No dynamic code execution** | Zero `eval()`, `new Function()`, `innerHTML`, or `document.write`. |
|
|
670
|
+
| **Shadow DOM isolation** | All UI renders inside Shadow DOM. CommentKit cannot read or modify your page's DOM, CSS, or JavaScript. Your page cannot interfere with CommentKit. |
|
|
671
|
+
| **Source maps disabled** | No `.map` files ship. No `sourceMappingURL` in built files. |
|
|
672
|
+
| **OTP authentication** | All commenters verify via email OTP. No passwords stored. |
|
|
673
|
+
| **Session persistence** | Sanctum Bearer token is kept in **sessionStorage** (tab-scoped) so in-tab refresh keeps auth and the offline queue can drain. Closing the tab clears the session; logout / auth-expiry also clear the offline queue. Prefer Bearer over `X-User-Email` (spoofable). |
|
|
674
|
+
| **Origin allowlist** | Browser requests must match the project's `allowed_domains` (wildcards like `*.example.com` supported). Empty allowlists deny browser traffic unless the backend enables `COMMENTKIT_ALLOW_EMPTY_ALLOWED_DOMAINS`. Server/MCP clients may omit `Origin`. |
|
|
675
|
+
| **GDPR** | CommentKit stores only email and display name for authenticated commenters. No cookies. No fingerprinting. No cross-site tracking. |
|
|
676
|
+
|
|
677
|
+
### Backend API contract (SDK ↔ backend-v2)
|
|
678
|
+
|
|
679
|
+
- Base path is `/api` (not `/api/v1`). Default host: `https://api.commentkit.com/api`.
|
|
680
|
+
- Auth: `X-API-Key` on every route; user identity via `Authorization: Bearer` (Sanctum ability `sdk`). Prefer Bearer over `X-User-Email` (only honored when `COMMENTKIT_ALLOW_EMAIL_AUTH=true`).
|
|
681
|
+
- Attachments: create a comment then `POST .../files` with `comment_id`, **or** upload first and pass `attachment_ids` on create/update. Unlinked orphans do not appear on comments.
|
|
682
|
+
- MCP comment reads may use API key only when `COMMENTKIT_MACHINE_READ_ENABLED` is on; mutations still need Bearer.
|
|
683
|
+
- Realtime: bind `comment_completed` separately from `comment_updated`.
|
|
684
|
+
|
|
685
|
+
### Screenshot redaction
|
|
686
|
+
|
|
687
|
+
Screenshots mask `input[type="password"]` fields by default. To exclude any other sensitive element from capture, mark it with the `data-commentkit-redact` attribute — redacted elements are blanked out before the image leaves the browser.
|
|
688
|
+
|
|
689
|
+
### Backend identity contract
|
|
690
|
+
|
|
691
|
+
Your realtime channel-auth endpoint must derive user identity from the authenticated session token and ignore any client-supplied `user_id` / `user_name` / `user_email` parameters. Client-supplied identity is spoofable by anyone who can run JavaScript on the page — never trust it for presence, authorship, or channel authorization.
|
|
692
|
+
|
|
693
|
+
### Host-page XSS
|
|
694
|
+
|
|
695
|
+
The widget runs in the host page's JavaScript context. Shadow DOM isolates **styles**, not JS — an XSS vulnerability on the host page can access the widget's session. Harden your site with a strict Content Security Policy (CSP) and Subresource Integrity (SRI) for third-party scripts.
|
|
696
|
+
|
|
697
|
+
### Reporting vulnerabilities
|
|
698
|
+
|
|
699
|
+
See [SECURITY.md](./SECURITY.md) for how to report security issues and our supported-versions policy.
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
## Bundle Size
|
|
704
|
+
|
|
705
|
+
| Entry | Raw | Gzipped |
|
|
706
|
+
| ------------------------------- | ------ | ------- |
|
|
707
|
+
| Core (`comment-kit`) | 101 KB | ~25 KB |
|
|
708
|
+
| React (`comment-kit/react`) | 450 KB | ~117 KB |
|
|
709
|
+
| Vue (`comment-kit/vue`) | 104 KB | ~25 KB |
|
|
710
|
+
| Svelte (`comment-kit/svelte`) | 104 KB | ~25 KB |
|
|
711
|
+
| Angular (`comment-kit/angular`) | 111 KB | ~26 KB |
|
|
712
|
+
| Solid.js (`comment-kit/solid`) | 103 KB | ~25 KB |
|
|
713
|
+
| Qwik (`comment-kit/qwik`) | 102 KB | ~25 KB |
|
|
714
|
+
| Preact (`comment-kit/preact`) | 102 KB | ~25 KB |
|
|
715
|
+
|
|
716
|
+
Tree-shakeable ESM. Only the entry point you import is bundled.
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
## Tech Stack
|
|
721
|
+
|
|
722
|
+
| Layer | Technology |
|
|
723
|
+
| ------------- | ------------------------------------------------------------------------------------------- |
|
|
724
|
+
| Language | TypeScript (strict mode) |
|
|
725
|
+
| UI Framework | React 19 + Base UI primitives |
|
|
726
|
+
| CSS Isolation | Shadow DOM with scoped CSS custom properties |
|
|
727
|
+
| Real-Time | Pusher.js / Laravel Reverb (WebSocket) |
|
|
728
|
+
| Bundler | Vite+ (Rolldown) |
|
|
729
|
+
| Testing | Vitest (1,600+ unit tests, 99%+ coverage) + Playwright (75 e2e specs against real Chromium) |
|
|
730
|
+
| Linting | OXC (oxlint) |
|
|
731
|
+
| Formatting | OXC (oxfmt) |
|
|
732
|
+
|
|
733
|
+
---
|
|
734
|
+
|
|
735
|
+
## Browser Support
|
|
736
|
+
|
|
737
|
+
| Browser | Version |
|
|
738
|
+
| ------------- | ------- |
|
|
739
|
+
| Chrome / Edge | 80+ |
|
|
740
|
+
| Firefox | 80+ |
|
|
741
|
+
| Safari | 14+ |
|
|
742
|
+
|
|
743
|
+
Requires **Node.js >= 18** for build tooling.
|
|
744
|
+
|
|
745
|
+
---
|
|
746
|
+
|
|
747
|
+
## Advanced Usage
|
|
748
|
+
|
|
749
|
+
For custom integrations, events, selective subscriptions, and TypeScript types, see the [API Reference](./docs/api-reference.md).
|
|
750
|
+
|
|
751
|
+
---
|
|
752
|
+
|
|
753
|
+
## License
|
|
754
|
+
|
|
755
|
+
CommentKit is proprietary software. See [LICENSE](./LICENSE) for details.
|
|
756
|
+
|
|
757
|
+
---
|
|
758
|
+
|
|
759
|
+
## Links
|
|
760
|
+
|
|
761
|
+
- [Documentation](https://commentkit.com/docs)
|
|
762
|
+
- [Dashboard](https://commentkit.com/dashboard)
|
|
763
|
+
- [Changelog](./CHANGELOG.md)
|
|
764
|
+
- [GitHub](https://github.com/commentkit/comment-kit)
|
|
765
|
+
- [npm](https://www.npmjs.com/package/comment-kit)
|
|
766
|
+
- [Twitter / X](https://x.com/commentkit)
|
|
767
|
+
- [Discord](https://discord.gg/commentkit)
|