@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.
- package/CHANGELOG.md +87 -0
- package/README.md +172 -732
- package/SECURITY.md +24 -14
- package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
- package/dist/npm/chunks/Guest-CKoV6pEK.js +157 -0
- package/dist/npm/chunks/MarkupEditor-DAo4qppg.js +199 -0
- package/dist/npm/chunks/Panel-BRBDHlGg.js +399 -0
- package/dist/npm/chunks/Shortcuts-CHMcrjAM.js +56 -0
- package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +570 -0
- package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
- package/dist/npm/chunks/ar-D3SPpN1T.js +195 -0
- package/dist/npm/chunks/client-D1NizpDK.js +627 -0
- package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
- package/dist/npm/chunks/de-C8eC6c6f.js +187 -0
- package/dist/npm/chunks/es-Bczf42tm.js +187 -0
- package/dist/npm/chunks/extension--it1LAj-.js +54 -0
- package/dist/npm/chunks/extension-XfuRGu2o.js +26 -0
- package/dist/npm/chunks/format-Bw_tNOh9.js +524 -0
- package/dist/npm/chunks/fr-BaQw-v2e.js +187 -0
- package/dist/npm/chunks/hi-BamV-yXv.js +187 -0
- package/dist/npm/chunks/html2canvas-DfGb8yka.js +4024 -0
- package/dist/npm/chunks/it-DC14_EjN.js +187 -0
- package/dist/npm/chunks/ja-B1mmTN7Y.js +187 -0
- package/dist/npm/chunks/mount-5fFig0k6.js +1447 -0
- package/dist/npm/chunks/nl-BfhqUsmX.js +187 -0
- package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
- package/dist/npm/chunks/pt-BR-CEPu4W5U.js +187 -0
- package/dist/{shared/pusher-CnhQgAvF.js → npm/chunks/pusher-BSsQoE1K.js} +224 -222
- package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
- package/dist/npm/chunks/report-Dh4fxd4J.js +27 -0
- package/dist/npm/chunks/rolldown-runtime-Y_bBpyJl.js +20 -0
- package/dist/npm/chunks/src-DujplxfI.js +517 -0
- package/dist/npm/chunks/zh-CN-kgqjYwHQ.js +187 -0
- package/dist/npm/element.js +41 -0
- package/dist/npm/headless.js +3 -0
- package/dist/npm/index.js +3 -0
- package/dist/npm/react.js +26 -0
- package/dist/npm/svelte.js +17 -0
- package/dist/npm/types/adapters/react.d.ts +11 -0
- package/dist/npm/types/adapters/svelte.d.ts +9 -0
- package/dist/npm/types/adapters/vue.d.ts +118 -0
- package/dist/npm/types/anchor/index.d.ts +49 -0
- package/dist/npm/types/core/api.d.ts +31 -0
- package/dist/npm/types/core/auth.d.ts +87 -0
- package/dist/npm/types/core/client.d.ts +114 -0
- package/dist/npm/types/core/store.d.ts +7 -0
- package/dist/npm/types/core/types.d.ts +303 -0
- package/dist/npm/types/element.d.ts +13 -0
- package/dist/npm/types/headless.d.ts +7 -0
- package/dist/npm/types/index.d.ts +32 -0
- package/dist/npm/vue.js +71 -0
- package/package.json +71 -173
- package/dist/THIRD_PARTY_NOTICES.txt +0 -284
- package/dist/angular.es.js +0 -321
- package/dist/comment-kit.es.js +0 -218
- package/dist/demo.es.js +0 -483
- package/dist/headless.es.js +0 -4
- package/dist/preact.es.js +0 -117
- package/dist/qwik.es.js +0 -1
- package/dist/qwik.qwik.mjs +0 -114
- package/dist/react.es.js +0 -98
- package/dist/shared/ShadowRootContext-DD6a0QaI.js +0 -11
- package/dist/shared/annotation-icons-Dh-bmNYK.js +0 -172
- package/dist/shared/annotation-toolbar-zeiCmKIr.js +0 -1086
- package/dist/shared/attachment-refresh-DAacLaRu.js +0 -94
- package/dist/shared/bridge-CJoGYngu.js +0 -177
- package/dist/shared/button-D4GHW6oZ.js +0 -474
- package/dist/shared/button-group-BVR7iT-S.js +0 -91
- package/dist/shared/capture-privacy-CiOrcAlt.js +0 -101
- package/dist/shared/comment-drawing-canvas-Btc12IsS.js +0 -124
- package/dist/shared/comment-icon-D8JTCEJ7.js +0 -607
- package/dist/shared/comment-image-lightbox--QpbcAtH.js +0 -190
- package/dist/shared/comment-images-content-C_r4SHM-.js +0 -214
- package/dist/shared/comment-kit-core-CmLUFujd.js +0 -3682
- package/dist/shared/comment-kit-ui-BHwYuSIi.js +0 -19391
- package/dist/shared/comment-screenshot-annotator-zJZyO-XM.js +0 -151
- package/dist/shared/comment-screenshot-overlay-CoKTYB0J.js +0 -205
- package/dist/shared/comment-shortcut-groups-CfEmkitU.js +0 -153
- package/dist/shared/createReactComponent-BZHeRbD0.js +0 -45
- package/dist/shared/dev-export-panel-Cnt6oCZU.js +0 -207
- package/dist/shared/dev-grab-B85jo9AS.js +0 -197
- package/dist/shared/dist-D9A5k-N4.js +0 -617
- package/dist/shared/dom-Bhf4WFtY.js +0 -223
- package/dist/shared/element-selector-Cng84xC7.js +0 -902
- package/dist/shared/error-boundary-D3PD74vI.js +0 -21
- package/dist/shared/errors-Bu5ajEmB.js +0 -22
- package/dist/shared/icons-nzMOLzrm.js +0 -266
- package/dist/shared/input-UPtAj0M6.js +0 -111
- package/dist/shared/mount-ui-Dz7FB_Ak.js +0 -208
- package/dist/shared/realtime-recovery-BjlV-ewc.js +0 -162
- package/dist/shared/realtime-yGLX4wMK.js +0 -334
- package/dist/shared/request-activity-DQrAUwfA.js +0 -11
- package/dist/shared/screenshot-B5-hwpmt.js +0 -199
- package/dist/shared/separator-UhJb0Row.js +0 -3955
- package/dist/shared/shadow-root-B58ZI2yz.js +0 -133
- package/dist/shared/styles-CnYsLS2f.js +0 -2
- package/dist/shared/text-B4HHZNaa.js +0 -23
- package/dist/shared/token-session-D92MYbNu.js +0 -25
- package/dist/shared/useLabelableId-8n0QmH8N.js +0 -154
- package/dist/shared/useRender-Uxk1OPK-.js +0 -5
- package/dist/shared/useValueChanged-DKq5cMot.js +0 -92
- package/dist/shared/validation-3wbbbuX0.js +0 -70
- package/dist/shared/websocket-manager-KhH4hL0Q.js +0 -381
- package/dist/solid.es.js +0 -98
- package/dist/svelte.es.js +0 -130
- package/dist/types/adapters/bridge.d.ts +0 -122
- package/dist/types/angular/index.d.ts +0 -145
- package/dist/types/core/agent-context.d.ts +0 -17
- package/dist/types/core/api-client.d.ts +0 -155
- package/dist/types/core/comment-kit-core.d.ts +0 -254
- package/dist/types/core/local-demo.d.ts +0 -60
- package/dist/types/core/types.d.ts +0 -770
- package/dist/types/core/websocket-manager.d.ts +0 -125
- package/dist/types/core/write-access.d.ts +0 -11
- package/dist/types/demo.d.ts +0 -17
- package/dist/types/headless.d.ts +0 -8
- package/dist/types/index.d.ts +0 -87
- package/dist/types/preact/index.d.ts +0 -25
- package/dist/types/qwik/index.d.ts +0 -73
- package/dist/types/react/client.d.ts +0 -31
- package/dist/types/react/index.d.ts +0 -4
- package/dist/types/solid/index.d.ts +0 -37
- package/dist/types/svelte/index.d.ts +0 -55
- package/dist/types/utils/dom.d.ts +0 -59
- package/dist/types/utils/event-emitter.d.ts +0 -11
- package/dist/types/vue/index.d.ts +0 -87
- package/dist/vue.es.js +0 -148
- package/docs/api-reference.md +0 -405
- package/docs/local-demo.md +0 -60
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { a as e, n as t, o as n, t as r } from "./validation-3wbbbuX0.js";
|
|
2
|
-
import { r as i } from "./comment-kit-core-CmLUFujd.js";
|
|
3
|
-
import { o as a, r as o } from "./dom-Bhf4WFtY.js";
|
|
4
|
-
import { t as s } from "./capture-privacy-CiOrcAlt.js";
|
|
5
|
-
var c = /* @__PURE__ */ new WeakMap(), l = 1e4, u = 2048, d = 10485760, f = 20971520, p = 16384, m = 32e6, h = 10, g = 10485760, _ = 26214400, v = /* @__PURE__ */ new Set([
|
|
6
|
-
"jpg",
|
|
7
|
-
"jpeg",
|
|
8
|
-
"png",
|
|
9
|
-
"gif",
|
|
10
|
-
"webp",
|
|
11
|
-
"pdf",
|
|
12
|
-
"doc",
|
|
13
|
-
"docx",
|
|
14
|
-
"txt",
|
|
15
|
-
"csv"
|
|
16
|
-
]), y = 15e3, b = 1e4, x = {
|
|
17
|
-
"image/gif": "gif",
|
|
18
|
-
"image/jpeg": "jpg",
|
|
19
|
-
"image/png": "png",
|
|
20
|
-
"image/webp": "webp"
|
|
21
|
-
};
|
|
22
|
-
function S(e, t) {
|
|
23
|
-
let n = Error(t);
|
|
24
|
-
return n.error = e, n.code = 400, n;
|
|
25
|
-
}
|
|
26
|
-
function C(e) {
|
|
27
|
-
if (typeof e != "string") throw S("invalid_position", "Invalid position");
|
|
28
|
-
let n = e.trim();
|
|
29
|
-
if (!n || n.length > u || t(n)) throw S("invalid_position", "Invalid position");
|
|
30
|
-
return n;
|
|
31
|
-
}
|
|
32
|
-
function w(t) {
|
|
33
|
-
if (!n(t) || !e(t.x) || !e(t.y)) throw S("invalid_position", "Invalid position");
|
|
34
|
-
return {
|
|
35
|
-
x: t.x,
|
|
36
|
-
y: t.y,
|
|
37
|
-
...t.element === void 0 ? {} : { element: C(t.element) },
|
|
38
|
-
...t.xpath === void 0 ? {} : { xpath: C(t.xpath) }
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function T(e) {
|
|
42
|
-
if (typeof e != "string") throw S("invalid_content", "Screenshot comment is required");
|
|
43
|
-
let n = e.trim();
|
|
44
|
-
if (!n || n.length > l || t(n)) throw S("invalid_content", "Screenshot comment is required");
|
|
45
|
-
return n;
|
|
46
|
-
}
|
|
47
|
-
function E(e) {
|
|
48
|
-
return typeof Blob < "u" && e instanceof Blob;
|
|
49
|
-
}
|
|
50
|
-
function D(e) {
|
|
51
|
-
return typeof File < "u" && e instanceof File;
|
|
52
|
-
}
|
|
53
|
-
function O(e) {
|
|
54
|
-
return typeof HTMLElement < "u" && e instanceof HTMLElement;
|
|
55
|
-
}
|
|
56
|
-
function k(e) {
|
|
57
|
-
if (e !== void 0) {
|
|
58
|
-
if (!O(e)) throw S("invalid_element", "Invalid screenshot target");
|
|
59
|
-
return e;
|
|
60
|
-
}
|
|
61
|
-
if (typeof document > "u" || !document.body) throw S("invalid_element", "A browser document is required to capture screenshots");
|
|
62
|
-
return document.body;
|
|
63
|
-
}
|
|
64
|
-
function A(e) {
|
|
65
|
-
let t = /^data:(image\/(?:png|jpeg|gif|webp));base64,/i.exec(e)?.[1];
|
|
66
|
-
return t ? t.toLowerCase() : null;
|
|
67
|
-
}
|
|
68
|
-
function j(e) {
|
|
69
|
-
if (!n(e)) throw S("invalid_screenshot", "Invalid screenshot result");
|
|
70
|
-
let t = typeof e.dataUrl == "string" ? e.dataUrl.trim() : "", r = e.blob, i = e.dimensions;
|
|
71
|
-
if (!A(t) || t.length > f || !E(r) || r.size <= 0 || r.size > d || r.type && !Object.prototype.hasOwnProperty.call(x, r.type)) throw S("invalid_screenshot", "Invalid screenshot result");
|
|
72
|
-
if (!n(i)) throw S("invalid_screenshot", "Invalid screenshot dimensions");
|
|
73
|
-
let { width: a, height: o } = i;
|
|
74
|
-
if (typeof a != "number" || typeof o != "number" || !Number.isFinite(a) || !Number.isFinite(o) || a <= 0 || o <= 0 || a > p || o > p) throw S("invalid_screenshot", "Invalid screenshot dimensions");
|
|
75
|
-
return {
|
|
76
|
-
dataUrl: t,
|
|
77
|
-
blob: r,
|
|
78
|
-
dimensions: {
|
|
79
|
-
width: a,
|
|
80
|
-
height: o
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function M(e) {
|
|
85
|
-
let t = A(e.dataUrl);
|
|
86
|
-
return e.blob.type || t;
|
|
87
|
-
}
|
|
88
|
-
function N(e) {
|
|
89
|
-
return `screenshot.${x[M(e)]}`;
|
|
90
|
-
}
|
|
91
|
-
function P(e, t, n) {
|
|
92
|
-
let r = null;
|
|
93
|
-
return new Promise((i, a) => {
|
|
94
|
-
r = setTimeout(() => {
|
|
95
|
-
r = null, a(Error(n));
|
|
96
|
-
}, t), e.then((e) => {
|
|
97
|
-
r && clearTimeout(r), r = null, i(e);
|
|
98
|
-
}, (e) => {
|
|
99
|
-
r && clearTimeout(r), r = null, a(e);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function F(e) {
|
|
104
|
-
return new Promise((t, n) => {
|
|
105
|
-
let r = !1, i = setTimeout(() => {
|
|
106
|
-
r = !0, n(/* @__PURE__ */ Error("toBlob timed out"));
|
|
107
|
-
}, b);
|
|
108
|
-
e.toBlob((e) => {
|
|
109
|
-
r || (r = !0, clearTimeout(i), e ? t(e) : n(/* @__PURE__ */ Error("toBlob returned null")));
|
|
110
|
-
}, "image/png");
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function I(e) {
|
|
114
|
-
let t = e.lastIndexOf(".");
|
|
115
|
-
return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
116
|
-
}
|
|
117
|
-
function L(e) {
|
|
118
|
-
if (!Array.isArray(e)) throw S("invalid_files", "Files must be an array");
|
|
119
|
-
if (e.length > h) throw S("too_many_files", `Cannot upload more than ${h} files at once`);
|
|
120
|
-
let n = 0;
|
|
121
|
-
for (let i of e) {
|
|
122
|
-
if (!D(i)) throw S("invalid_files", "Invalid file upload");
|
|
123
|
-
if (i.size > g) throw S("file_too_large", `File "${i.name}" exceeds the ${g / 1024 / 1024}MB limit`);
|
|
124
|
-
if (n += i.size, n > _) throw S("upload_too_large", `Total upload size exceeds the ${_ / 1024 / 1024}MB limit`);
|
|
125
|
-
if (t(i.name) || i.name.includes("/") || i.name.includes("\\")) throw S("invalid_filename", "Filename contains invalid characters");
|
|
126
|
-
if (r(i.name)) throw S("invalid_file_type", `File type ".${I(i.name)}" is not allowed`);
|
|
127
|
-
if (!v.has(I(i.name))) throw S("invalid_file_type", `File type ".${I(i.name)}" is not supported. Allowed: ${[...v].map((e) => `.${e}`).join(", ")}`);
|
|
128
|
-
}
|
|
129
|
-
return e;
|
|
130
|
-
}
|
|
131
|
-
async function R(e, t, n, r = {}) {
|
|
132
|
-
if (e.isLocalDemo) return null;
|
|
133
|
-
try {
|
|
134
|
-
let e = k(n);
|
|
135
|
-
if (s(e)) return null;
|
|
136
|
-
if (t) return j(await t(e));
|
|
137
|
-
let r;
|
|
138
|
-
try {
|
|
139
|
-
r = (await import("html2canvas")).default;
|
|
140
|
-
} catch {
|
|
141
|
-
/* v8 ignore next 3 -- dynamic import() can't be intercepted by vi.mock */
|
|
142
|
-
throw Error("Screenshot requires either a custom screenshotProvider in config or html2canvas installed. Install html2canvas: npm install html2canvas — or provide config.screenshotProvider.");
|
|
143
|
-
}
|
|
144
|
-
let i = await P(r(e, {
|
|
145
|
-
useCORS: !0,
|
|
146
|
-
allowTaint: !1,
|
|
147
|
-
scale: 2,
|
|
148
|
-
logging: !1,
|
|
149
|
-
ignoreElements: s,
|
|
150
|
-
onclone: (e) => import("./capture-colors-D0uLr-vZ.js").then(({ normalizeCaptureColors: t }) => t(e))
|
|
151
|
-
}), y, "html2canvas timed out after 15s");
|
|
152
|
-
if (i.width > p || i.height > p || i.width * i.height > m) throw S("screenshot_too_large", "Captured area is too large to screenshot");
|
|
153
|
-
return j({
|
|
154
|
-
dataUrl: i.toDataURL("image/png"),
|
|
155
|
-
blob: await F(i),
|
|
156
|
-
dimensions: {
|
|
157
|
-
width: i.width,
|
|
158
|
-
height: i.height
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
} catch (t) {
|
|
162
|
-
return r.reportErrors !== !1 && (console.error("[CommentKit] Screenshot failed:", t), e.handleError({
|
|
163
|
-
error: "screenshot_failed",
|
|
164
|
-
message: "Failed to capture screenshot",
|
|
165
|
-
code: 500
|
|
166
|
-
})), null;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async function z(e, t, n, r) {
|
|
170
|
-
try {
|
|
171
|
-
let s = j(t), l = T(n), u = w(r);
|
|
172
|
-
e.setState({ isLoading: !0 });
|
|
173
|
-
let d = new File([s.blob], N(s), { type: M(s) }), f = a(), p = i(e), m = c.get(s.blob) ?? o("screenshot");
|
|
174
|
-
c.set(s.blob, m);
|
|
175
|
-
let h = await e.apiClient.uploadScreenshot(d, {
|
|
176
|
-
content: l,
|
|
177
|
-
idempotencyKey: m,
|
|
178
|
-
position: u,
|
|
179
|
-
page: f,
|
|
180
|
-
...p ? { branch: p } : {}
|
|
181
|
-
});
|
|
182
|
-
return e.setState({
|
|
183
|
-
comments: !e.getState().activeBranch || e.getState().activeBranch === h.branch ? [...e.getState().comments.filter((e) => e.id !== h.id), h] : e.getState().comments,
|
|
184
|
-
isLoading: !1,
|
|
185
|
-
activeScreenshot: null
|
|
186
|
-
}), e.emit("comment:created", h), c.delete(s.blob), h;
|
|
187
|
-
} catch (t) {
|
|
188
|
-
return e.setState({ isLoading: !1 }), e.handleError(t), null;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
async function B(e, t, n) {
|
|
192
|
-
try {
|
|
193
|
-
let r = L(t);
|
|
194
|
-
return r.length === 0 ? [] : await e.apiClient.uploadFiles(r, n);
|
|
195
|
-
} catch (t) {
|
|
196
|
-
return e.handleError(t), [];
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
export { R as captureScreenshot, B as uploadFiles, z as uploadScreenshot };
|