@commentkit/comment-kit 0.7.1 → 0.7.3
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 +22 -0
- package/README.md +10 -6
- package/SECURITY.md +14 -6
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +5 -5
- package/dist/demo.es.js +35 -34
- package/dist/headless.es.js +3 -3
- 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-Bv-4aElu.js → ShadowRootContext-CjciYxVN.js} +4 -4
- package/dist/shared/annotation-toolbar-XpqojzM2.js +1094 -0
- package/dist/shared/{attachment-refresh-CzQFXHkL.js → attachment-refresh-agUheZPF.js} +2 -2
- package/dist/shared/{button-group-CWdKaOlC.js → button-group-C285iSkZ.js} +1 -1
- package/dist/shared/capture-privacy-DUROnio5.js +77 -0
- package/dist/shared/{comment-drawing-canvas-DdXlMgbF.js → comment-drawing-canvas-B3zqdIZH.js} +2 -2
- package/dist/shared/{comment-icon-Dg9ZWpz-.js → comment-icon-4SQd3nlz.js} +1 -1
- package/dist/shared/{comment-image-lightbox-B7iHjnAz.js → comment-image-lightbox-j9y3Klh6.js} +5 -5
- package/dist/shared/{comment-images-content-D7YNUgo5.js → comment-images-content-aJrMaOi9.js} +3 -3
- package/dist/shared/{comment-kit-core-C862uNAm.js → comment-kit-core-Bsyydwpk.js} +786 -703
- package/dist/shared/{comment-kit-ui-0vd-DY4S.js → comment-kit-ui-qKjCHHOy.js} +4642 -4820
- package/dist/shared/{comment-screenshot-annotator-DcaSSuWB.js → comment-screenshot-annotator-aDtgMbBF.js} +2 -2
- package/dist/shared/{comment-screenshot-overlay-D_nFoJmM.js → comment-screenshot-overlay-B-rAubia.js} +113 -118
- package/dist/shared/comment-shortcut-groups-CfEmkitU.js +153 -0
- package/dist/shared/{dev-export-panel-pWBlhlse.js → dev-export-panel-mrxmtzei.js} +3 -4
- package/dist/shared/dev-grab-Cc-lJYBv.js +196 -0
- package/dist/shared/{element-selector-DC-_XJ0k.js → element-selector-4TxTAXHK.js} +408 -405
- package/dist/shared/{mount-ui-B68j8r6I.js → mount-ui-Dbqe5VsO.js} +121 -106
- package/dist/shared/{pusher-C1FHQGXV.js → pusher-zAMukOay.js} +1 -1
- package/dist/shared/{realtime-recovery-DJ_adc-H.js → realtime-recovery-BSVMwsXJ.js} +1 -1
- package/dist/shared/realtime-t5o6fk6w.js +321 -0
- package/dist/shared/request-activity-DQrAUwfA.js +11 -0
- package/dist/shared/{separator-XDBsaWyw.js → separator-aphZiRoJ.js} +1 -1
- package/dist/shared/{shadow-root-CrO75sED.js → shadow-root-DlfbvZF9.js} +31 -31
- package/dist/shared/{styles-C9Jwvm0Q.js → styles-CnYsLS2f.js} +1 -1
- package/dist/shared/text-B4HHZNaa.js +23 -0
- package/dist/shared/token-session-ZzSO1tEl.js +25 -0
- package/dist/shared/{validation-D-8u4M7I.js → validation-3wbbbuX0.js} +14 -2
- package/dist/shared/{websocket-manager-CFak_YHy.js → websocket-manager-DGN8T9mq.js} +136 -116
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +3 -1
- package/dist/types/core/comment-kit-core.d.ts +2 -5
- package/dist/types/core/types.d.ts +22 -5
- package/dist/types/core/websocket-manager.d.ts +1 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +19 -4
- package/package.json +1 -1
- package/dist/shared/annotation-toolbar-cGC1p-SP.js +0 -1093
- package/dist/shared/dev-grab-eQ9EgEGY.js +0 -210
- package/dist/shared/realtime-Diqz7G_y.js +0 -317
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { f as e, g as t, p as n, r } from "./comment-kit-core-Bsyydwpk.js";
|
|
2
|
+
import { a as i, i as a, o } from "./dom-Bhf4WFtY.js";
|
|
3
|
+
import { n as s, t as c } from "./capture-privacy-DUROnio5.js";
|
|
4
|
+
import { a as l, n as u, t as d } from "./text-B4HHZNaa.js";
|
|
5
|
+
var f = 4e3, p = 500, m = 2e3, h = 1e3, g = 5, _ = 25, v = 3145728;
|
|
6
|
+
function y() {
|
|
7
|
+
let { url: e, path: t, title: n } = o();
|
|
8
|
+
return {
|
|
9
|
+
url: l(e),
|
|
10
|
+
path: l(t),
|
|
11
|
+
title: n
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function b(e) {
|
|
15
|
+
let t = u(e?.comment, m);
|
|
16
|
+
return t.length > 0 ? t : null;
|
|
17
|
+
}
|
|
18
|
+
function x(e) {
|
|
19
|
+
return (e?.attachments ?? []).slice(0, g).flatMap((e) => {
|
|
20
|
+
let t = u(e.name, h), n = u(e.path, h);
|
|
21
|
+
return !t || !n ? [] : [{
|
|
22
|
+
name: t,
|
|
23
|
+
path: n,
|
|
24
|
+
...e.pathSource ? { pathSource: e.pathSource } : {},
|
|
25
|
+
...e.type ? { type: u(e.type, h) } : {},
|
|
26
|
+
...typeof e.size == "number" ? { size: e.size } : {},
|
|
27
|
+
...typeof e.lastModified == "number" ? { lastModified: e.lastModified } : {}
|
|
28
|
+
}];
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function S(e) {
|
|
32
|
+
return typeof HTMLElement < "u" && e instanceof HTMLElement;
|
|
33
|
+
}
|
|
34
|
+
function C(e, t, n, r) {
|
|
35
|
+
let o = e.getBoundingClientRect(), c = a(e), l = i(e), d = e.getAttribute("class"), m = e.getAttribute("role"), h = e.getAttribute("aria-label"), g = s(e), _ = u(g.text, p), v = u(g.html, f);
|
|
36
|
+
return {
|
|
37
|
+
found: !0,
|
|
38
|
+
tagName: e.tagName.toLowerCase(),
|
|
39
|
+
...e.id ? { id: e.id } : {},
|
|
40
|
+
...d ? { className: d } : {},
|
|
41
|
+
...m ? { role: m } : {},
|
|
42
|
+
...h ? { ariaLabel: h } : {},
|
|
43
|
+
..._ ? { text: _ } : {},
|
|
44
|
+
rect: {
|
|
45
|
+
top: o.top,
|
|
46
|
+
left: o.left,
|
|
47
|
+
width: o.width,
|
|
48
|
+
height: o.height
|
|
49
|
+
},
|
|
50
|
+
...v ? { htmlPreview: v } : {},
|
|
51
|
+
...c ? { selector: c } : {},
|
|
52
|
+
...l ? { xpath: l } : {},
|
|
53
|
+
...t ? {
|
|
54
|
+
source: w(t),
|
|
55
|
+
stack: n.map(w)
|
|
56
|
+
} : {},
|
|
57
|
+
...r ? { componentName: r } : {}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function w(e) {
|
|
61
|
+
return {
|
|
62
|
+
filePath: e.filePath,
|
|
63
|
+
lineNumber: e.lineNumber,
|
|
64
|
+
columnNumber: e.columnNumber,
|
|
65
|
+
componentName: e.componentName
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function T(e) {
|
|
69
|
+
let t = `${u(e.filePath, 2e3)}${e.lineNumber === null ? "" : `:${e.lineNumber}`}${e.columnNumber === null ? "" : `:${e.columnNumber}`}`;
|
|
70
|
+
return e.componentName ? `${u(e.componentName, 300)} (${t})` : t;
|
|
71
|
+
}
|
|
72
|
+
function E(e, t, n, r, i, a) {
|
|
73
|
+
let o = [
|
|
74
|
+
"# CommentKit Element Grab",
|
|
75
|
+
"",
|
|
76
|
+
d,
|
|
77
|
+
""
|
|
78
|
+
], s = u(t.tagName ?? "element", 100), c = t.id ? `#${u(t.id, 300)}` : "";
|
|
79
|
+
if (o.push(`**Tag:** \`${s}${c}\``), i && o.push(`**Comment:** ${i}`), a.length > 0) {
|
|
80
|
+
o.push("", "**Attachments:**");
|
|
81
|
+
for (let e of a) {
|
|
82
|
+
let t = [
|
|
83
|
+
e.type ? `type: \`${e.type}\`` : null,
|
|
84
|
+
typeof e.size == "number" ? `size: ${e.size} bytes` : null,
|
|
85
|
+
e.pathSource ? `path source: ${e.pathSource}` : null
|
|
86
|
+
].filter(Boolean).join(", ");
|
|
87
|
+
o.push(`- \`${e.name}\` - path: \`${e.path}\`${t ? ` (${t})` : ""}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (t.componentName && o.push(`**Component:** \`${u(t.componentName, 300)}\``), t.source && o.push(`**Source:** ${T(t.source)}`), t.stack && t.stack.length > 1) {
|
|
91
|
+
o.push("", "**Stack:**");
|
|
92
|
+
for (let e of t.stack) o.push(`- ${T(e)}`);
|
|
93
|
+
}
|
|
94
|
+
return t.source || (t.selector && o.push(`**Selector:** \`${u(t.selector, 2e3)}\``), t.xpath && o.push(`**XPath:** \`${u(t.xpath, 2e3)}\``)), o.push(`**Page:** ${u(e.title || "Untitled", 300)} — ${u(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
|
+
function D(e) {
|
|
97
|
+
let t = e.element;
|
|
98
|
+
return {
|
|
99
|
+
tagName: t.tagName,
|
|
100
|
+
id: t.id,
|
|
101
|
+
className: t.className,
|
|
102
|
+
textContent: t.text,
|
|
103
|
+
componentName: t.componentName,
|
|
104
|
+
filePath: t.source?.filePath,
|
|
105
|
+
lineNumber: t.source?.lineNumber ?? void 0,
|
|
106
|
+
columnNumber: t.source?.columnNumber ?? void 0,
|
|
107
|
+
comment: e.comment ?? void 0,
|
|
108
|
+
attachments: e.attachments,
|
|
109
|
+
selector: t.selector,
|
|
110
|
+
xpath: t.xpath
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function O(e) {
|
|
114
|
+
if (typeof window > "u" || typeof window.dispatchEvent != "function") return;
|
|
115
|
+
let t = e[0];
|
|
116
|
+
t && window.dispatchEvent(new CustomEvent("commentkit:element-selected", { detail: {
|
|
117
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
118
|
+
page: t.page,
|
|
119
|
+
elements: e.map(D)
|
|
120
|
+
} }));
|
|
121
|
+
}
|
|
122
|
+
async function k(i, a, o, s) {
|
|
123
|
+
if (!i || typeof Element > "u" || !(i instanceof Element) || typeof i.getBoundingClientRect != "function" || c(i)) return null;
|
|
124
|
+
let l = (S(i), i), u = await t(i), d = u?.source ?? null, f = u?.stack ?? [], p = u?.componentName ?? null, m = await r(a, o, l, { reportErrors: !1 }), h = m?.dataUrl ?? null, g = m?.blob ?? null, _ = C(i, d, f, p), v = _.htmlPreview ?? "", w = y(), T = b(s), D = x(s), k = E(w, _, v, h, T, D);
|
|
125
|
+
try {
|
|
126
|
+
g ? await e(k, g) : await n(k);
|
|
127
|
+
} catch {}
|
|
128
|
+
let A = {
|
|
129
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
130
|
+
page: w,
|
|
131
|
+
element: _,
|
|
132
|
+
comment: T,
|
|
133
|
+
attachments: D,
|
|
134
|
+
html: v,
|
|
135
|
+
screenshotDataUrl: h,
|
|
136
|
+
markdown: k
|
|
137
|
+
};
|
|
138
|
+
return O([A]), A;
|
|
139
|
+
}
|
|
140
|
+
function A(e, t, n, r) {
|
|
141
|
+
let i = [
|
|
142
|
+
"# CommentKit Element Grab",
|
|
143
|
+
"",
|
|
144
|
+
d,
|
|
145
|
+
"",
|
|
146
|
+
`**Elements:** ${t.length}`,
|
|
147
|
+
`**Page:** ${u(e.title || "Untitled", 300)} — ${u(e.url || e.path, 4e3)}`
|
|
148
|
+
];
|
|
149
|
+
if (n && i.push(`**Comment:** ${n}`), r.length > 0) {
|
|
150
|
+
i.push("", "**Attachments:**");
|
|
151
|
+
for (let e of r) i.push(`- \`${e.name}\` - path: \`${e.path}\`${e.pathSource ? ` (path source: ${e.pathSource})` : ""}`);
|
|
152
|
+
}
|
|
153
|
+
return i.push(""), t.forEach((e, t) => {
|
|
154
|
+
let { element: n } = e, r = u(n.tagName ?? "element", 100), a = n.id ? `#${u(n.id, 300)}` : "";
|
|
155
|
+
i.push(`## [${t + 1}] \`${r}${a}\``), n.componentName && i.push(`- Component: \`${u(n.componentName, 300)}\``), n.source && i.push(`- Source: ${T(n.source)}`), n.stack && n.stack.length > 1 && i.push(`- Stack: ${n.stack.map((e) => u(e.componentName ?? e.filePath, 2e3)).join(" → ")}`), n.source || (n.selector && i.push(`- Selector: \`${u(n.selector, 2e3)}\``), n.xpath && i.push(`- XPath: \`${u(n.xpath, 2e3)}\``)), i.push("", "```html", e.html, "```", ""), e.screenshotDataUrl && i.push(``, "");
|
|
156
|
+
}), i.join("\n");
|
|
157
|
+
}
|
|
158
|
+
async function j(e, i, a, o) {
|
|
159
|
+
let s = e.filter((e) => !!e && typeof Element < "u" && e instanceof Element && typeof e.getBoundingClientRect == "function" && !c(e));
|
|
160
|
+
if (s.length === 0) return null;
|
|
161
|
+
let l = s.slice(0, _);
|
|
162
|
+
s.length > _ && typeof console < "u" && console.warn(`[CommentKit] grabElements was called with ${s.length} elements — capped to ${_} for clipboard size. Pass fewer elements to avoid truncation.`);
|
|
163
|
+
let u = [], d = 0, f = 0, p = b(o), m = x(o);
|
|
164
|
+
for (let e of l) {
|
|
165
|
+
let n = (S(e), e), o = await t(e), s = o?.source ?? null, c = o?.stack ?? [], l = o?.componentName ?? null, h = null;
|
|
166
|
+
if (d < v) {
|
|
167
|
+
let e = (await r(i, a, n, { reportErrors: !1 }))?.dataUrl ?? null;
|
|
168
|
+
e && d + e.length <= v ? (h = e, d += e.length) : e && f++;
|
|
169
|
+
} else f++;
|
|
170
|
+
let g = C(e, s, c, l), _ = g.htmlPreview ?? "", b = y(), x = E(b, g, _, h, p, m);
|
|
171
|
+
u.push({
|
|
172
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
173
|
+
page: b,
|
|
174
|
+
element: g,
|
|
175
|
+
comment: p,
|
|
176
|
+
attachments: m,
|
|
177
|
+
html: _,
|
|
178
|
+
screenshotDataUrl: h,
|
|
179
|
+
markdown: x
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
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, u, p, m);
|
|
184
|
+
try {
|
|
185
|
+
await n(g);
|
|
186
|
+
} catch {}
|
|
187
|
+
let w = {
|
|
188
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
189
|
+
page: h,
|
|
190
|
+
results: u,
|
|
191
|
+
attachments: m,
|
|
192
|
+
markdown: g
|
|
193
|
+
};
|
|
194
|
+
return O(u), w;
|
|
195
|
+
}
|
|
196
|
+
export { k as grabElement, j as grabElements };
|