@commentkit/comment-kit 0.7.4 → 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.
Files changed (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/SECURITY.md +1 -1
  4. package/dist/angular.es.js +2 -2
  5. package/dist/comment-kit.es.js +3 -3
  6. package/dist/demo.es.js +24 -15
  7. package/dist/headless.es.js +2 -2
  8. package/dist/preact.es.js +2 -2
  9. package/dist/qwik.qwik.mjs +2 -2
  10. package/dist/react.es.js +2 -2
  11. package/dist/shared/ShadowRootContext-DD6a0QaI.js +11 -0
  12. package/dist/shared/annotation-toolbar-DgqxkHy8.js +1085 -0
  13. package/dist/shared/{attachment-refresh-DmVkfPtl.js → attachment-refresh-DRX7dKDI.js} +3 -3
  14. package/dist/shared/{button-By0hGrJK.js → button-D4GHW6oZ.js} +133 -164
  15. package/dist/shared/{button-group-C285iSkZ.js → button-group-BVR7iT-S.js} +13 -13
  16. package/dist/shared/{comment-drawing-canvas-zIPS1dnW.js → comment-drawing-canvas-hSdcLShI.js} +2 -2
  17. package/dist/shared/{comment-icon-4SQd3nlz.js → comment-icon-D8JTCEJ7.js} +109 -110
  18. package/dist/shared/{comment-image-lightbox-CdMNf0_y.js → comment-image-lightbox-4zroOCCG.js} +7 -7
  19. package/dist/shared/{comment-images-content-DqeqmQnb.js → comment-images-content-D4hTya6e.js} +28 -28
  20. package/dist/shared/{comment-kit-core-C-0JJS2i.js → comment-kit-core-D068rcdY.js} +467 -503
  21. package/dist/shared/{comment-kit-ui-CBaz7L3u.js → comment-kit-ui-BDzNt0jv.js} +5077 -5253
  22. package/dist/shared/{comment-screenshot-annotator-CuYmKafz.js → comment-screenshot-annotator-BGnu_NgP.js} +2 -2
  23. package/dist/shared/{comment-screenshot-overlay-Dw81osel.js → comment-screenshot-overlay-BCRmojWB.js} +4 -4
  24. package/dist/shared/{dev-export-panel-D08M2LKD.js → dev-export-panel-CYmUKmIV.js} +3 -3
  25. package/dist/shared/{dev-grab-BJLZZ2xU.js → dev-grab-BYsCpsGI.js} +48 -47
  26. package/dist/shared/dist-D9A5k-N4.js +617 -0
  27. package/dist/shared/{element-selector-Biyn2cpR.js → element-selector-79Oo5pit.js} +4 -4
  28. package/dist/shared/{mount-ui-DXdL3p9b.js → mount-ui-DuHk132g.js} +4 -4
  29. package/dist/shared/{pusher-D4M5K6Dk.js → pusher-3jyUauYd.js} +1 -1
  30. package/dist/shared/{realtime-BTqYEy8s.js → realtime-DspH16g5.js} +41 -28
  31. package/dist/shared/{realtime-recovery-BSVMwsXJ.js → realtime-recovery-BjlV-ewc.js} +57 -30
  32. package/dist/shared/screenshot-BIuEaRiu.js +199 -0
  33. package/dist/shared/{separator-aphZiRoJ.js → separator-UhJb0Row.js} +1222 -1288
  34. package/dist/shared/{shadow-root-C58Ap5Nu.js → shadow-root-3-yGIhMs.js} +3 -5
  35. package/dist/shared/{token-session-D0Y_HZw0.js → token-session-_Pi4fOEi.js} +1 -1
  36. package/dist/shared/{useRender-D1z_X_BY.js → useRender-Uxk1OPK-.js} +1 -1
  37. package/dist/shared/{useValueChanged-CrzfD8l-.js → useValueChanged-DKq5cMot.js} +13 -13
  38. package/dist/shared/{websocket-manager-BFKa95TO.js → websocket-manager-CvgZSo_L.js} +2 -2
  39. package/dist/solid.es.js +2 -2
  40. package/dist/svelte.es.js +2 -2
  41. package/dist/types/core/api-client.d.ts +17 -9
  42. package/dist/types/core/comment-kit-core.d.ts +4 -2
  43. package/dist/types/core/types.d.ts +37 -4
  44. package/dist/vue.es.js +2 -2
  45. package/docs/api-reference.md +29 -17
  46. package/package.json +1 -1
  47. package/dist/shared/ShadowRootContext-CjciYxVN.js +0 -13
  48. package/dist/shared/annotation-toolbar-CpPKy0oq.js +0 -1094
  49. 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-CpPKy0oq.js";
2
- import { N as r, _ as i, a, g as o, i as s } from "./comment-kit-ui-CBaz7L3u.js";
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-C-0JJS2i.js";
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-By0hGrJK.js";
4
- import { g as r, j as i, v as a } from "./comment-kit-ui-CBaz7L3u.js";
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";
@@ -88,7 +88,7 @@ function b(e) {
88
88
  }, [])
89
89
  };
90
90
  }
91
- var x = () => import("./comment-screenshot-annotator-CuYmKafz.js");
91
+ var x = () => import("./comment-screenshot-annotator-BGnu_NgP.js");
92
92
  function S({ capturePage: t, availableUsers: l = [], onSave: u, onCancel: d }) {
93
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 : {
94
94
  x: Math.min(S.x, w.x),
@@ -1,7 +1,7 @@
1
- import { t as e } from "./button-By0hGrJK.js";
2
- import { i as t, o as n, r, t as i } from "./separator-aphZiRoJ.js";
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-CBaz7L3u.js";
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, r } from "./comment-kit-core-C-0JJS2i.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";
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 } = o();
8
+ let { url: e, path: t, title: n } = a();
8
9
  return {
9
- url: l(e),
10
- path: l(t),
10
+ url: c(e),
11
+ path: c(t),
11
12
  title: n
12
13
  };
13
14
  }
14
15
  function b(e) {
15
- let t = u(e?.comment, m);
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 = u(e.name, h), n = u(e.path, h);
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: u(e.type, h) } : {},
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, 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);
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: o.top,
46
- left: o.left,
47
- width: o.width,
48
- height: o.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
- ...l ? { xpath: l } : {},
53
+ ...u ? { xpath: u } : {},
53
54
  ...t ? {
54
55
  source: w(t),
55
56
  stack: n.map(w)
56
57
  } : {},
57
- ...r ? { componentName: r } : {}
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 = `${u(e.filePath, 2e3)}${e.lineNumber === null ? "" : `:${e.lineNumber}`}${e.columnNumber === null ? "" : `:${e.columnNumber}`}`;
70
- return e.componentName ? `${u(e.componentName, 300)} (${t})` : t;
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
- d,
77
+ u,
77
78
  ""
78
- ], s = u(t.tagName ?? "element", 100), c = t.id ? `#${u(t.id, 300)}` : "";
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:** \`${u(t.componentName, 300)}\``), t.source && o.push(`**Source:** ${T(t.source)}`), t.stack && t.stack.length > 1) {
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:** \`${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
+ 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, 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);
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
- d,
145
+ u,
145
146
  "",
146
147
  `**Elements:** ${t.length}`,
147
- `**Page:** ${u(e.title || "Untitled", 300)} — ${u(e.url || e.path, 4e3)}`
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 = 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(`![screenshot](${e.screenshotDataUrl})`, "");
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(`![screenshot](${e.screenshotDataUrl})`, "");
156
157
  }), i.join("\n");
157
158
  }
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++;
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, l), _ = g.htmlPreview ?? "", b = y(), x = E(b, g, _, h, p, m);
171
- u.push({
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, u, p, m);
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: u,
191
+ results: l,
191
192
  attachments: m,
192
193
  markdown: g
193
194
  };
194
- return O(u), w;
195
+ return O(l), w;
195
196
  }
196
197
  export { k as grabElement, j as grabElements };