@commentkit/comment-kit 0.7.3 → 0.7.5
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 +19 -0
- package/README.md +2 -2
- 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-DgqxkHy8.js +1085 -0
- package/dist/shared/{attachment-refresh-agUheZPF.js → attachment-refresh-DRX7dKDI.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/{capture-colors-CxSLsU5-.js → capture-colors-D0uLr-vZ.js} +12 -2
- package/dist/shared/{comment-drawing-canvas-B3zqdIZH.js → comment-drawing-canvas-hSdcLShI.js} +2 -2
- package/dist/shared/{comment-icon-4SQd3nlz.js → comment-icon-D8JTCEJ7.js} +109 -110
- package/dist/shared/{comment-image-lightbox-j9y3Klh6.js → comment-image-lightbox-4zroOCCG.js} +7 -7
- package/dist/shared/{comment-images-content-aJrMaOi9.js → comment-images-content-D4hTya6e.js} +28 -28
- package/dist/shared/{comment-kit-core-Bsyydwpk.js → comment-kit-core-D068rcdY.js} +467 -503
- package/dist/shared/{comment-kit-ui-qKjCHHOy.js → comment-kit-ui-BDzNt0jv.js} +5078 -5254
- package/dist/shared/{comment-screenshot-annotator-aDtgMbBF.js → comment-screenshot-annotator-BGnu_NgP.js} +2 -2
- package/dist/shared/{comment-screenshot-overlay-B-rAubia.js → comment-screenshot-overlay-BCRmojWB.js} +17 -14
- package/dist/shared/{dev-export-panel-mrxmtzei.js → dev-export-panel-CYmUKmIV.js} +3 -3
- package/dist/shared/{dev-grab-Cc-lJYBv.js → dev-grab-BYsCpsGI.js} +48 -47
- package/dist/shared/dist-D9A5k-N4.js +617 -0
- package/dist/shared/{element-selector-4TxTAXHK.js → element-selector-79Oo5pit.js} +4 -4
- package/dist/shared/{mount-ui-Dbqe5VsO.js → mount-ui-DuHk132g.js} +4 -4
- package/dist/shared/{pusher-zAMukOay.js → pusher-3jyUauYd.js} +1 -1
- package/dist/shared/{realtime-t5o6fk6w.js → realtime-DspH16g5.js} +41 -28
- package/dist/shared/{realtime-recovery-BSVMwsXJ.js → realtime-recovery-BjlV-ewc.js} +57 -30
- package/dist/shared/screenshot-BIuEaRiu.js +199 -0
- package/dist/shared/{separator-aphZiRoJ.js → separator-UhJb0Row.js} +1222 -1288
- package/dist/shared/{shadow-root-DlfbvZF9.js → shadow-root-3-yGIhMs.js} +3 -5
- package/dist/shared/{token-session-ZzSO1tEl.js → token-session-_Pi4fOEi.js} +1 -1
- 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-DGN8T9mq.js → websocket-manager-CvgZSo_L.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 +17 -9
- package/dist/types/core/comment-kit-core.d.ts +4 -2
- package/dist/types/core/types.d.ts +37 -4
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +29 -17
- package/package.json +1 -1
- package/dist/shared/ShadowRootContext-CjciYxVN.js +0 -13
- package/dist/shared/annotation-toolbar-XpqojzM2.js +0 -1094
- package/dist/shared/dist-De294MVF.js +0 -623
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./annotation-toolbar-
|
|
2
|
-
import { N as r, _ as i, a, g as o, i as s } from "./comment-kit-ui-
|
|
1
|
+
import { n as e, r as t, t as n } from "./annotation-toolbar-DgqxkHy8.js";
|
|
2
|
+
import { N as r, _ as i, a, g as o, i as s } from "./comment-kit-ui-BDzNt0jv.js";
|
|
3
3
|
import * as c from "react";
|
|
4
4
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
5
|
function d(e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as e } from "./comment-kit-core-
|
|
1
|
+
import { u as e } from "./comment-kit-core-D068rcdY.js";
|
|
2
2
|
import { t } from "./capture-privacy-DUROnio5.js";
|
|
3
|
-
import { t as n } from "./button-
|
|
4
|
-
import { g as r, j as i, v as a } from "./comment-kit-ui-
|
|
3
|
+
import { t as n } from "./button-D4GHW6oZ.js";
|
|
4
|
+
import { g as r, j as i, v as a } from "./comment-kit-ui-BDzNt0jv.js";
|
|
5
5
|
import { d as o, i as s } from "./annotation-icons-Dh-bmNYK.js";
|
|
6
6
|
import * as c from "react";
|
|
7
7
|
import { useCallback as l, useEffect as u, useRef as d, useState as f } from "react";
|
|
@@ -33,11 +33,14 @@ function b(e) {
|
|
|
33
33
|
a(!0), s(null);
|
|
34
34
|
try {
|
|
35
35
|
let a = await Promise.race([(async () => {
|
|
36
|
+
if (t(document.body)) throw Error("Page capture is disabled");
|
|
36
37
|
let r = {
|
|
37
38
|
width: Math.max(document.documentElement.scrollWidth, document.body?.scrollWidth ?? 0, window.innerWidth),
|
|
38
39
|
height: Math.max(document.documentElement.scrollHeight, document.body?.scrollHeight ?? 0, window.innerHeight),
|
|
39
40
|
scrollX: window.scrollX,
|
|
40
|
-
scrollY: window.scrollY
|
|
41
|
+
scrollY: window.scrollY,
|
|
42
|
+
windowWidth: window.innerWidth,
|
|
43
|
+
windowHeight: window.innerHeight
|
|
41
44
|
};
|
|
42
45
|
if (e) {
|
|
43
46
|
let t = await e();
|
|
@@ -51,23 +54,23 @@ function b(e) {
|
|
|
51
54
|
throw Error("Screenshot requires either a custom screenshotProvider in config or html2canvas installed. Install html2canvas: npm install html2canvas — or provide config.screenshotProvider.");
|
|
52
55
|
}
|
|
53
56
|
if (i !== c.current) return null;
|
|
54
|
-
let o =
|
|
55
|
-
if (
|
|
57
|
+
let o = n?.width ?? r.width, s = n?.height ?? r.height;
|
|
58
|
+
if (o > 16384 || s > 16384 || o * s > v) throw Error("Selected area is too large to capture");
|
|
56
59
|
return (await a(document.body, {
|
|
57
60
|
useCORS: !0,
|
|
58
61
|
allowTaint: !1,
|
|
59
62
|
scale: 1,
|
|
60
63
|
logging: !1,
|
|
61
64
|
ignoreElements: t,
|
|
62
|
-
onclone: (e) => import("./capture-colors-
|
|
65
|
+
onclone: (e) => import("./capture-colors-D0uLr-vZ.js").then(({ normalizeCaptureColors: t }) => t(e)),
|
|
63
66
|
x: n ? n.x + r.scrollX : 0,
|
|
64
67
|
y: n ? n.y + r.scrollY : 0,
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
67
|
-
windowWidth:
|
|
68
|
-
windowHeight:
|
|
69
|
-
scrollX:
|
|
70
|
-
scrollY:
|
|
68
|
+
width: o,
|
|
69
|
+
height: s,
|
|
70
|
+
windowWidth: r.windowWidth,
|
|
71
|
+
windowHeight: r.windowHeight,
|
|
72
|
+
scrollX: r.scrollX,
|
|
73
|
+
scrollY: r.scrollY
|
|
71
74
|
})).toDataURL("image/png");
|
|
72
75
|
})(), new Promise((e, t) => {
|
|
73
76
|
m.current = setTimeout(() => t(/* @__PURE__ */ Error("Screenshot timed out")), _);
|
|
@@ -85,7 +88,7 @@ function b(e) {
|
|
|
85
88
|
}, [])
|
|
86
89
|
};
|
|
87
90
|
}
|
|
88
|
-
var x = () => import("./comment-screenshot-annotator-
|
|
91
|
+
var x = () => import("./comment-screenshot-annotator-BGnu_NgP.js");
|
|
89
92
|
function S({ capturePage: t, availableUsers: l = [], onSave: u, onCancel: d }) {
|
|
90
93
|
let { imageUrl: f, capturing: p, error: g, capture: _, reset: v } = b(t), y = c.useRef(null), [S, C] = c.useState(null), [w, T] = c.useState(null), E = S !== null, D = c.useMemo(() => !S || !w ? null : {
|
|
91
94
|
x: Math.min(S.x, w.x),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "./button-
|
|
2
|
-
import { i as t, o as n, r, t as i } from "./separator-
|
|
1
|
+
import { t as e } from "./button-D4GHW6oZ.js";
|
|
2
|
+
import { i as t, o as n, r, t as i } from "./separator-UhJb0Row.js";
|
|
3
3
|
import { t as a } from "./createReactComponent-BZHeRbD0.js";
|
|
4
|
-
import { C as o, H as s, U as c, W as l, u } from "./comment-kit-ui-
|
|
4
|
+
import { C as o, H as s, U as c, W as l, u } from "./comment-kit-ui-BDzNt0jv.js";
|
|
5
5
|
import * as d from "react";
|
|
6
6
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
7
|
var h = a("outline", "refresh", "Refresh", [["path", {
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { f as e, g as t, p as n
|
|
2
|
-
import { a as
|
|
3
|
-
import { n as
|
|
4
|
-
import { a as
|
|
1
|
+
import { f as e, g as t, p as n } from "./comment-kit-core-D068rcdY.js";
|
|
2
|
+
import { a as r, i, o as a } from "./dom-Bhf4WFtY.js";
|
|
3
|
+
import { n as o, t as s } from "./capture-privacy-DUROnio5.js";
|
|
4
|
+
import { a as c, n as l, t as u } from "./text-B4HHZNaa.js";
|
|
5
|
+
import { captureScreenshot as d } from "./screenshot-BIuEaRiu.js";
|
|
5
6
|
var f = 4e3, p = 500, m = 2e3, h = 1e3, g = 5, _ = 25, v = 3145728;
|
|
6
7
|
function y() {
|
|
7
|
-
let { url: e, path: t, title: n } =
|
|
8
|
+
let { url: e, path: t, title: n } = a();
|
|
8
9
|
return {
|
|
9
|
-
url:
|
|
10
|
-
path:
|
|
10
|
+
url: c(e),
|
|
11
|
+
path: c(t),
|
|
11
12
|
title: n
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
function b(e) {
|
|
15
|
-
let t =
|
|
16
|
+
let t = l(e?.comment, m);
|
|
16
17
|
return t.length > 0 ? t : null;
|
|
17
18
|
}
|
|
18
19
|
function x(e) {
|
|
19
20
|
return (e?.attachments ?? []).slice(0, g).flatMap((e) => {
|
|
20
|
-
let t =
|
|
21
|
+
let t = l(e.name, h), n = l(e.path, h);
|
|
21
22
|
return !t || !n ? [] : [{
|
|
22
23
|
name: t,
|
|
23
24
|
path: n,
|
|
24
25
|
...e.pathSource ? { pathSource: e.pathSource } : {},
|
|
25
|
-
...e.type ? { type:
|
|
26
|
+
...e.type ? { type: l(e.type, h) } : {},
|
|
26
27
|
...typeof e.size == "number" ? { size: e.size } : {},
|
|
27
28
|
...typeof e.lastModified == "number" ? { lastModified: e.lastModified } : {}
|
|
28
29
|
}];
|
|
@@ -31,8 +32,8 @@ function x(e) {
|
|
|
31
32
|
function S(e) {
|
|
32
33
|
return typeof HTMLElement < "u" && e instanceof HTMLElement;
|
|
33
34
|
}
|
|
34
|
-
function C(e, t, n,
|
|
35
|
-
let
|
|
35
|
+
function C(e, t, n, a) {
|
|
36
|
+
let s = e.getBoundingClientRect(), c = i(e), u = r(e), d = e.getAttribute("class"), m = e.getAttribute("role"), h = e.getAttribute("aria-label"), g = o(e), _ = l(g.text, p), v = l(g.html, f);
|
|
36
37
|
return {
|
|
37
38
|
found: !0,
|
|
38
39
|
tagName: e.tagName.toLowerCase(),
|
|
@@ -42,19 +43,19 @@ function C(e, t, n, r) {
|
|
|
42
43
|
...h ? { ariaLabel: h } : {},
|
|
43
44
|
..._ ? { text: _ } : {},
|
|
44
45
|
rect: {
|
|
45
|
-
top:
|
|
46
|
-
left:
|
|
47
|
-
width:
|
|
48
|
-
height:
|
|
46
|
+
top: s.top,
|
|
47
|
+
left: s.left,
|
|
48
|
+
width: s.width,
|
|
49
|
+
height: s.height
|
|
49
50
|
},
|
|
50
51
|
...v ? { htmlPreview: v } : {},
|
|
51
52
|
...c ? { selector: c } : {},
|
|
52
|
-
...
|
|
53
|
+
...u ? { xpath: u } : {},
|
|
53
54
|
...t ? {
|
|
54
55
|
source: w(t),
|
|
55
56
|
stack: n.map(w)
|
|
56
57
|
} : {},
|
|
57
|
-
...
|
|
58
|
+
...a ? { componentName: a } : {}
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
function w(e) {
|
|
@@ -66,16 +67,16 @@ function w(e) {
|
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
69
|
function T(e) {
|
|
69
|
-
let t = `${
|
|
70
|
-
return e.componentName ? `${
|
|
70
|
+
let t = `${l(e.filePath, 2e3)}${e.lineNumber === null ? "" : `:${e.lineNumber}`}${e.columnNumber === null ? "" : `:${e.columnNumber}`}`;
|
|
71
|
+
return e.componentName ? `${l(e.componentName, 300)} (${t})` : t;
|
|
71
72
|
}
|
|
72
73
|
function E(e, t, n, r, i, a) {
|
|
73
74
|
let o = [
|
|
74
75
|
"# CommentKit Element Grab",
|
|
75
76
|
"",
|
|
76
|
-
|
|
77
|
+
u,
|
|
77
78
|
""
|
|
78
|
-
], s =
|
|
79
|
+
], s = l(t.tagName ?? "element", 100), c = t.id ? `#${l(t.id, 300)}` : "";
|
|
79
80
|
if (o.push(`**Tag:** \`${s}${c}\``), i && o.push(`**Comment:** ${i}`), a.length > 0) {
|
|
80
81
|
o.push("", "**Attachments:**");
|
|
81
82
|
for (let e of a) {
|
|
@@ -87,11 +88,11 @@ function E(e, t, n, r, i, a) {
|
|
|
87
88
|
o.push(`- \`${e.name}\` - path: \`${e.path}\`${t ? ` (${t})` : ""}`);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
if (t.componentName && o.push(`**Component:** \`${
|
|
91
|
+
if (t.componentName && o.push(`**Component:** \`${l(t.componentName, 300)}\``), t.source && o.push(`**Source:** ${T(t.source)}`), t.stack && t.stack.length > 1) {
|
|
91
92
|
o.push("", "**Stack:**");
|
|
92
93
|
for (let e of t.stack) o.push(`- ${T(e)}`);
|
|
93
94
|
}
|
|
94
|
-
return t.source || (t.selector && o.push(`**Selector:** \`${
|
|
95
|
+
return t.source || (t.selector && o.push(`**Selector:** \`${l(t.selector, 2e3)}\``), t.xpath && o.push(`**XPath:** \`${l(t.xpath, 2e3)}\``)), o.push(`**Page:** ${l(e.title || "Untitled", 300)} — ${l(e.url || e.path, 4e3)}`), o.push(""), o.push("**HTML:**", "```html", n, "```", ""), r && o.push("**Screenshot:** captured. If no image accompanies this paste, attach it from the export preview.", ""), o.join("\n");
|
|
95
96
|
}
|
|
96
97
|
function D(e) {
|
|
97
98
|
let t = e.element;
|
|
@@ -119,9 +120,9 @@ function O(e) {
|
|
|
119
120
|
elements: e.map(D)
|
|
120
121
|
} }));
|
|
121
122
|
}
|
|
122
|
-
async function k(i, a, o
|
|
123
|
-
if (!
|
|
124
|
-
let
|
|
123
|
+
async function k(r, i, a, o) {
|
|
124
|
+
if (!r || typeof Element > "u" || !(r instanceof Element) || typeof r.getBoundingClientRect != "function" || s(r)) return null;
|
|
125
|
+
let c = (S(r), r), l = await t(r), u = l?.source ?? null, f = l?.stack ?? [], p = l?.componentName ?? null, m = await d(i, a, c, { reportErrors: !1 }), h = m?.dataUrl ?? null, g = m?.blob ?? null, _ = C(r, u, f, p), v = _.htmlPreview ?? "", w = y(), T = b(o), D = x(o), k = E(w, _, v, h, T, D);
|
|
125
126
|
try {
|
|
126
127
|
g ? await e(k, g) : await n(k);
|
|
127
128
|
} catch {}
|
|
@@ -141,34 +142,34 @@ function A(e, t, n, r) {
|
|
|
141
142
|
let i = [
|
|
142
143
|
"# CommentKit Element Grab",
|
|
143
144
|
"",
|
|
144
|
-
|
|
145
|
+
u,
|
|
145
146
|
"",
|
|
146
147
|
`**Elements:** ${t.length}`,
|
|
147
|
-
`**Page:** ${
|
|
148
|
+
`**Page:** ${l(e.title || "Untitled", 300)} — ${l(e.url || e.path, 4e3)}`
|
|
148
149
|
];
|
|
149
150
|
if (n && i.push(`**Comment:** ${n}`), r.length > 0) {
|
|
150
151
|
i.push("", "**Attachments:**");
|
|
151
152
|
for (let e of r) i.push(`- \`${e.name}\` - path: \`${e.path}\`${e.pathSource ? ` (path source: ${e.pathSource})` : ""}`);
|
|
152
153
|
}
|
|
153
154
|
return i.push(""), t.forEach((e, t) => {
|
|
154
|
-
let { element: n } = e, r =
|
|
155
|
-
i.push(`## [${t + 1}] \`${r}${a}\``), n.componentName && i.push(`- Component: \`${
|
|
155
|
+
let { element: n } = e, r = l(n.tagName ?? "element", 100), a = n.id ? `#${l(n.id, 300)}` : "";
|
|
156
|
+
i.push(`## [${t + 1}] \`${r}${a}\``), n.componentName && i.push(`- Component: \`${l(n.componentName, 300)}\``), n.source && i.push(`- Source: ${T(n.source)}`), n.stack && n.stack.length > 1 && i.push(`- Stack: ${n.stack.map((e) => l(e.componentName ?? e.filePath, 2e3)).join(" → ")}`), n.source || (n.selector && i.push(`- Selector: \`${l(n.selector, 2e3)}\``), n.xpath && i.push(`- XPath: \`${l(n.xpath, 2e3)}\``)), i.push("", "```html", e.html, "```", ""), e.screenshotDataUrl && i.push(``, "");
|
|
156
157
|
}), i.join("\n");
|
|
157
158
|
}
|
|
158
|
-
async function j(e, i, a
|
|
159
|
-
let
|
|
160
|
-
if (
|
|
161
|
-
let
|
|
162
|
-
|
|
163
|
-
let
|
|
164
|
-
for (let e of
|
|
165
|
-
let n = (S(e), e),
|
|
166
|
-
if (
|
|
167
|
-
let e = (await r
|
|
168
|
-
e &&
|
|
159
|
+
async function j(e, r, i, a) {
|
|
160
|
+
let o = e.filter((e) => !!e && typeof Element < "u" && e instanceof Element && typeof e.getBoundingClientRect == "function" && !s(e));
|
|
161
|
+
if (o.length === 0) return null;
|
|
162
|
+
let c = o.slice(0, _);
|
|
163
|
+
o.length > _ && typeof console < "u" && console.warn(`[CommentKit] grabElements was called with ${o.length} elements — capped to ${_} for clipboard size. Pass fewer elements to avoid truncation.`);
|
|
164
|
+
let l = [], u = 0, f = 0, p = b(a), m = x(a);
|
|
165
|
+
for (let e of c) {
|
|
166
|
+
let n = (S(e), e), a = await t(e), o = a?.source ?? null, s = a?.stack ?? [], c = a?.componentName ?? null, h = null;
|
|
167
|
+
if (u < v) {
|
|
168
|
+
let e = (await d(r, i, n, { reportErrors: !1 }))?.dataUrl ?? null;
|
|
169
|
+
e && u + e.length <= v ? (h = e, u += e.length) : e && f++;
|
|
169
170
|
} else f++;
|
|
170
|
-
let g = C(e, s, c
|
|
171
|
-
|
|
171
|
+
let g = C(e, o, s, c), _ = g.htmlPreview ?? "", b = y(), x = E(b, g, _, h, p, m);
|
|
172
|
+
l.push({
|
|
172
173
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
173
174
|
page: b,
|
|
174
175
|
element: g,
|
|
@@ -180,17 +181,17 @@ async function j(e, i, a, o) {
|
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
f > 0 && typeof console < "u" && console.warn(`[CommentKit] grabElements dropped ${f} screenshot${f === 1 ? "" : "s"} to stay under the ${Math.round(v / 1024 / 1024)}MB clipboard budget.`);
|
|
183
|
-
let h = y(), g = A(h,
|
|
184
|
+
let h = y(), g = A(h, l, p, m);
|
|
184
185
|
try {
|
|
185
186
|
await n(g);
|
|
186
187
|
} catch {}
|
|
187
188
|
let w = {
|
|
188
189
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
189
190
|
page: h,
|
|
190
|
-
results:
|
|
191
|
+
results: l,
|
|
191
192
|
attachments: m,
|
|
192
193
|
markdown: g
|
|
193
194
|
};
|
|
194
|
-
return O(
|
|
195
|
+
return O(l), w;
|
|
195
196
|
}
|
|
196
197
|
export { k as grabElement, j as grabElements };
|