@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +10 -6
  3. package/SECURITY.md +14 -6
  4. package/dist/angular.es.js +2 -2
  5. package/dist/comment-kit.es.js +5 -5
  6. package/dist/demo.es.js +35 -34
  7. package/dist/headless.es.js +3 -3
  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-Bv-4aElu.js → ShadowRootContext-CjciYxVN.js} +4 -4
  12. package/dist/shared/annotation-toolbar-XpqojzM2.js +1094 -0
  13. package/dist/shared/{attachment-refresh-CzQFXHkL.js → attachment-refresh-agUheZPF.js} +2 -2
  14. package/dist/shared/{button-group-CWdKaOlC.js → button-group-C285iSkZ.js} +1 -1
  15. package/dist/shared/capture-privacy-DUROnio5.js +77 -0
  16. package/dist/shared/{comment-drawing-canvas-DdXlMgbF.js → comment-drawing-canvas-B3zqdIZH.js} +2 -2
  17. package/dist/shared/{comment-icon-Dg9ZWpz-.js → comment-icon-4SQd3nlz.js} +1 -1
  18. package/dist/shared/{comment-image-lightbox-B7iHjnAz.js → comment-image-lightbox-j9y3Klh6.js} +5 -5
  19. package/dist/shared/{comment-images-content-D7YNUgo5.js → comment-images-content-aJrMaOi9.js} +3 -3
  20. package/dist/shared/{comment-kit-core-C862uNAm.js → comment-kit-core-Bsyydwpk.js} +786 -703
  21. package/dist/shared/{comment-kit-ui-0vd-DY4S.js → comment-kit-ui-qKjCHHOy.js} +4642 -4820
  22. package/dist/shared/{comment-screenshot-annotator-DcaSSuWB.js → comment-screenshot-annotator-aDtgMbBF.js} +2 -2
  23. package/dist/shared/{comment-screenshot-overlay-D_nFoJmM.js → comment-screenshot-overlay-B-rAubia.js} +113 -118
  24. package/dist/shared/comment-shortcut-groups-CfEmkitU.js +153 -0
  25. package/dist/shared/{dev-export-panel-pWBlhlse.js → dev-export-panel-mrxmtzei.js} +3 -4
  26. package/dist/shared/dev-grab-Cc-lJYBv.js +196 -0
  27. package/dist/shared/{element-selector-DC-_XJ0k.js → element-selector-4TxTAXHK.js} +408 -405
  28. package/dist/shared/{mount-ui-B68j8r6I.js → mount-ui-Dbqe5VsO.js} +121 -106
  29. package/dist/shared/{pusher-C1FHQGXV.js → pusher-zAMukOay.js} +1 -1
  30. package/dist/shared/{realtime-recovery-DJ_adc-H.js → realtime-recovery-BSVMwsXJ.js} +1 -1
  31. package/dist/shared/realtime-t5o6fk6w.js +321 -0
  32. package/dist/shared/request-activity-DQrAUwfA.js +11 -0
  33. package/dist/shared/{separator-XDBsaWyw.js → separator-aphZiRoJ.js} +1 -1
  34. package/dist/shared/{shadow-root-CrO75sED.js → shadow-root-DlfbvZF9.js} +31 -31
  35. package/dist/shared/{styles-C9Jwvm0Q.js → styles-CnYsLS2f.js} +1 -1
  36. package/dist/shared/text-B4HHZNaa.js +23 -0
  37. package/dist/shared/token-session-ZzSO1tEl.js +25 -0
  38. package/dist/shared/{validation-D-8u4M7I.js → validation-3wbbbuX0.js} +14 -2
  39. package/dist/shared/{websocket-manager-CFak_YHy.js → websocket-manager-DGN8T9mq.js} +136 -116
  40. package/dist/solid.es.js +2 -2
  41. package/dist/svelte.es.js +2 -2
  42. package/dist/types/core/api-client.d.ts +3 -1
  43. package/dist/types/core/comment-kit-core.d.ts +2 -5
  44. package/dist/types/core/types.d.ts +22 -5
  45. package/dist/types/core/websocket-manager.d.ts +1 -0
  46. package/dist/vue.es.js +2 -2
  47. package/docs/api-reference.md +19 -4
  48. package/package.json +1 -1
  49. package/dist/shared/annotation-toolbar-cGC1p-SP.js +0 -1093
  50. package/dist/shared/dev-grab-eQ9EgEGY.js +0 -210
  51. package/dist/shared/realtime-Diqz7G_y.js +0 -317
@@ -1,5 +1,5 @@
1
- import { n as e, r as t, t as n } from "./annotation-toolbar-cGC1p-SP.js";
2
- import { N as r, _ as i, a, g as o, i as s } from "./comment-kit-ui-0vd-DY4S.js";
1
+ import { n as e, r as t, t as n } from "./annotation-toolbar-XpqojzM2.js";
2
+ import { N as r, _ as i, a, g as o, i as s } from "./comment-kit-ui-qKjCHHOy.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,207 +1,202 @@
1
- import { t as e } from "./button-By0hGrJK.js";
2
- import { g as t, j as n, v as r } from "./comment-kit-ui-0vd-DY4S.js";
3
- import { d as i, i as a } from "./annotation-icons-Dh-bmNYK.js";
4
- import * as o from "react";
5
- import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
6
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
7
- var m = ".ck-annotation-toolbar{background-color:var(--background);width:100%;max-width:100%;box-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a, 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);border-radius:2rem;flex-wrap:wrap;justify-content:center;align-items:center;gap:.375rem .5rem;margin-inline:auto;padding:.375rem;display:flex}@media (width>=1024px){.ck-annotation-toolbar{width:fit-content}}.ck-annotation-separator.ck-separator[data-orientation=vertical]{height:1rem;display:none}@media (width>=1024px){.ck-annotation-separator.ck-separator[data-orientation=vertical]{display:block}}.ck-annotation-stroke{align-items:center;gap:.5rem;width:7rem;padding-inline:.25rem;display:flex}@media (width>=1024px){.ck-annotation-stroke{width:12rem}}.ck-annotation-slider{flex:auto;min-width:0}.ck-annotation-stroke-label{color:var(--muted-foreground);font-variant-numeric:tabular-nums;flex-shrink:0;font-size:.75rem;line-height:1rem}.ck-annotation-swatch{background-color:var(--ck-bg);width:.875rem;height:.875rem;box-shadow:0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);border-radius:999px}.ck-annotation-tooltip{align-items:center;gap:.375rem;display:inline-flex}.ck-annotation-save--disabled{opacity:.5}.ck-screenshot-overlay{z-index:var(--z-ck-overlay);cursor:none;pointer-events:auto;touch-action:none;outline:none;position:fixed;inset:0}.ck-screenshot-selection{pointer-events:none;inset-inline-start:var(--ck-x);top:var(--ck-y);width:var(--ck-w);height:var(--ck-h);box-shadow:0 0 0 2px var(--primary);background:color-mix(in oklch, var(--primary) 10%, transparent);position:fixed}.ck-screenshot-overlay-bar{inset-inline-start:50%;z-index:10;background:var(--background);max-width:calc(100vw - 1.5rem);color:var(--foreground);box-shadow:var(--shadow-lg), 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);cursor:auto;border-radius:2rem;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;display:flex;position:fixed;top:1rem;transform:translate(-50%)}.ck-screenshot-overlay-bar>svg{flex-shrink:0;width:1rem;height:1rem}.ck-screenshot-overlay-bar>button{margin-inline-start:.25rem}.ck-screenshot-overlay-error{border-radius:var(--radius-md);background:var(--background);width:max-content;max-width:calc(100vw - 1.5rem);color:var(--destructive);margin:.75rem auto;padding:.75rem;font-size:.875rem;position:absolute;top:5rem;left:50%;transform:translate(-50%)}.ck-screenshot-overlay-bar>span,.ck-screenshot-overlay-bar>svg{color:var(--muted-foreground)}@media (width<=767px){.ck-screenshot-overlay-bar{width:max-content}}.ck-screenshot-annotator{z-index:var(--z-ck-overlay);pointer-events:auto;background:#0000004d;position:fixed;inset:0;overflow-y:auto}@supports ((-webkit-backdrop-filter:blur(4px)) or (backdrop-filter:blur(4px))){.ck-screenshot-annotator{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}}.ck-screenshot-annotator-layout{justify-content:center;align-items:flex-start;width:100%;min-height:100%;padding:.75rem;display:flex}.ck-screenshot-annotator-stage{flex-direction:column;align-items:stretch;gap:.75rem;width:100%;max-width:100%;display:flex}.ck-screenshot-annotator-media{flex-direction:column;align-items:center;gap:.75rem;width:100%;min-width:0;display:flex}.ck-screenshot-annotator-toolbar{width:100%;min-width:0}.ck-screenshot-annotator-canvas{width:100%;max-width:100%;max-height:var(--ck-frame);box-shadow:var(--shadow-xl), 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);position:relative;overflow:auto}.ck-screenshot-annotator-image{width:var(--ck-w);height:var(--ck-h);-webkit-user-select:none;user-select:none;max-width:none;display:block}.ck-screenshot-annotator-strokes{cursor:none;touch-action:none;position:absolute;inset:0}.ck-screenshot-annotator-composer{flex-direction:column;width:100%;min-width:0;display:flex}@media (width>=1024px){.ck-screenshot-annotator-layout{align-items:center;padding:1rem}.ck-screenshot-annotator-stage{flex-direction:row;align-items:flex-start;gap:1.5rem;width:auto}.ck-screenshot-annotator-media{width:auto}.ck-screenshot-annotator-canvas{width:var(--ck-w);height:var(--ck-h);max-height:none;overflow:hidden}.ck-screenshot-annotator-composer{flex-shrink:0;width:380px}}", h = 15e3, g = 32e6;
8
- async function _(e, t, n) {
1
+ import { u as e } from "./comment-kit-core-Bsyydwpk.js";
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-qKjCHHOy.js";
5
+ import { d as o, i as s } from "./annotation-icons-Dh-bmNYK.js";
6
+ import * as c from "react";
7
+ import { useCallback as l, useEffect as u, useRef as d, useState as f } from "react";
8
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ var g = ".ck-annotation-toolbar{background-color:var(--background);width:100%;max-width:100%;box-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a, 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);border-radius:2rem;flex-wrap:wrap;justify-content:center;align-items:center;gap:.375rem .5rem;margin-inline:auto;padding:.375rem;display:flex}@media (width>=1024px){.ck-annotation-toolbar{width:fit-content}}.ck-annotation-separator.ck-separator[data-orientation=vertical]{height:1rem;display:none}@media (width>=1024px){.ck-annotation-separator.ck-separator[data-orientation=vertical]{display:block}}.ck-annotation-stroke{align-items:center;gap:.5rem;width:7rem;padding-inline:.25rem;display:flex}@media (width>=1024px){.ck-annotation-stroke{width:12rem}}.ck-annotation-slider{flex:auto;min-width:0}.ck-annotation-stroke-label{color:var(--muted-foreground);font-variant-numeric:tabular-nums;flex-shrink:0;font-size:.75rem;line-height:1rem}.ck-annotation-swatch{background-color:var(--ck-bg);width:.875rem;height:.875rem;box-shadow:0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);border-radius:999px}.ck-annotation-tooltip{align-items:center;gap:.375rem;display:inline-flex}.ck-annotation-save--disabled{opacity:.5}.ck-screenshot-overlay{z-index:var(--z-ck-overlay);cursor:none;pointer-events:auto;touch-action:none;outline:none;position:fixed;inset:0}.ck-screenshot-selection{pointer-events:none;inset-inline-start:var(--ck-x);top:var(--ck-y);width:var(--ck-w);height:var(--ck-h);box-shadow:0 0 0 2px var(--primary);background:color-mix(in oklch, var(--primary) 10%, transparent);position:fixed}.ck-screenshot-overlay-bar{inset-inline-start:50%;z-index:10;background:var(--background);max-width:calc(100vw - 1.5rem);color:var(--foreground);box-shadow:var(--shadow-lg), 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);cursor:auto;border-radius:2rem;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;display:flex;position:fixed;top:1rem;transform:translate(-50%)}.ck-screenshot-overlay-bar>svg{flex-shrink:0;width:1rem;height:1rem}.ck-screenshot-overlay-bar>button{margin-inline-start:.25rem}.ck-screenshot-overlay-error{border-radius:var(--radius-md);background:var(--background);width:max-content;max-width:calc(100vw - 1.5rem);color:var(--destructive);margin:.75rem auto;padding:.75rem;font-size:.875rem;position:absolute;top:5rem;left:50%;transform:translate(-50%)}.ck-screenshot-overlay-bar>span,.ck-screenshot-overlay-bar>svg{color:var(--muted-foreground)}@media (width<=767px){.ck-screenshot-overlay-bar{width:max-content}}.ck-screenshot-annotator{z-index:var(--z-ck-overlay);pointer-events:auto;background:#0000004d;position:fixed;inset:0;overflow-y:auto}@supports ((-webkit-backdrop-filter:blur(4px)) or (backdrop-filter:blur(4px))){.ck-screenshot-annotator{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}}.ck-screenshot-annotator-layout{justify-content:center;align-items:flex-start;width:100%;min-height:100%;padding:.75rem;display:flex}.ck-screenshot-annotator-stage{flex-direction:column;align-items:stretch;gap:.75rem;width:100%;max-width:100%;display:flex}.ck-screenshot-annotator-media{flex-direction:column;align-items:center;gap:.75rem;width:100%;min-width:0;display:flex}.ck-screenshot-annotator-toolbar{width:100%;min-width:0}.ck-screenshot-annotator-canvas{width:100%;max-width:100%;max-height:var(--ck-frame);box-shadow:var(--shadow-xl), 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);position:relative;overflow:auto}.ck-screenshot-annotator-image{width:var(--ck-w);height:var(--ck-h);-webkit-user-select:none;user-select:none;max-width:none;display:block}.ck-screenshot-annotator-strokes{cursor:none;touch-action:none;position:absolute;inset:0}.ck-screenshot-annotator-composer{flex-direction:column;width:100%;min-width:0;display:flex}@media (width>=1024px){.ck-screenshot-annotator-layout{align-items:center;padding:1rem}.ck-screenshot-annotator-stage{flex-direction:row;align-items:flex-start;gap:1.5rem;width:auto}.ck-screenshot-annotator-media{width:auto}.ck-screenshot-annotator-canvas{width:var(--ck-w);height:var(--ck-h);max-height:none;overflow:hidden}.ck-screenshot-annotator-composer{flex-shrink:0;width:380px}}", _ = 15e3, v = 32e6;
10
+ async function y(e, t, n) {
9
11
  let r = e.dimensions.width / n.width, i = e.dimensions.height / n.height, a = new Image(), o = new Promise((e, t) => {
10
12
  a.onload = () => e(), a.onerror = () => t(/* @__PURE__ */ Error("Could not load captured screenshot"));
11
13
  });
12
14
  a.src = e.dataUrl, await o;
13
15
  let s = document.createElement("canvas");
14
- if (s.width = Math.max(1, Math.round(t.width * r)), s.height = Math.max(1, Math.round(t.height * i)), s.width > 16384 || s.height > 16384 || s.width * s.height > g) throw Error("Selected area is too large to capture");
16
+ if (s.width = Math.max(1, Math.round(t.width * r)), s.height = Math.max(1, Math.round(t.height * i)), s.width > 16384 || s.height > 16384 || s.width * s.height > v) throw Error("Selected area is too large to capture");
15
17
  let c = s.getContext("2d");
16
18
  if (!c) throw Error("Screenshot cropping is unavailable in this browser");
17
19
  return c.drawImage(a, (t.x + n.scrollX) * r, (t.y + n.scrollY) * i, s.width, s.height, 0, 0, s.width, s.height), s.toDataURL("image/png");
18
20
  }
19
- function v(e) {
20
- try {
21
- return e.matches?.("[data-commentkit],[data-commentkit-host],[data-commentkit-ui],[data-commentkit-panel],input[type=\"password\"],[data-commentkit-redact],[data-html2canvas-ignore]") ?? !1;
22
- } catch {
23
- return !1;
24
- }
25
- }
26
- function y(e) {
27
- let [t, n] = u(null), [r, i] = u(!1), [a, o] = u(null), d = l(0), f = l(!1), p = l(void 0);
28
- return c(() => () => {
29
- d.current += 1, clearTimeout(p.current);
21
+ function b(e) {
22
+ let [n, r] = f(null), [i, a] = f(!1), [o, s] = f(null), c = d(0), p = d(!1), m = d(void 0);
23
+ return u(() => () => {
24
+ c.current += 1, clearTimeout(m.current);
30
25
  }, []), {
31
- imageUrl: t,
32
- capturing: r,
33
- error: a,
34
- capture: s(async (t) => {
35
- if (f.current) return;
36
- f.current = !0;
37
- let r = ++d.current;
38
- i(!0), o(null);
26
+ imageUrl: n,
27
+ capturing: i,
28
+ error: o,
29
+ capture: l(async (n) => {
30
+ if (p.current) return;
31
+ p.current = !0;
32
+ let i = ++c.current;
33
+ a(!0), s(null);
39
34
  try {
40
- let i = await Promise.race([(async () => {
41
- let n = {
35
+ let a = await Promise.race([(async () => {
36
+ let r = {
42
37
  width: Math.max(document.documentElement.scrollWidth, document.body?.scrollWidth ?? 0, window.innerWidth),
43
38
  height: Math.max(document.documentElement.scrollHeight, document.body?.scrollHeight ?? 0, window.innerHeight),
44
39
  scrollX: window.scrollX,
45
40
  scrollY: window.scrollY
46
41
  };
47
42
  if (e) {
48
- let r = await e();
49
- if (!r) throw Error("Screenshot provider could not capture this page");
50
- return t ? _(r, t, n) : r.dataUrl;
43
+ let t = await e();
44
+ if (!t) throw Error("Screenshot provider could not capture this page");
45
+ return n ? y(t, n, r) : t.dataUrl;
51
46
  }
52
- let i;
47
+ let a;
53
48
  try {
54
- i = (await import("html2canvas")).default;
49
+ a = (await import("html2canvas")).default;
55
50
  } catch {
56
51
  throw Error("Screenshot requires either a custom screenshotProvider in config or html2canvas installed. Install html2canvas: npm install html2canvas — or provide config.screenshotProvider.");
57
52
  }
58
- if (r !== d.current) return null;
59
- let a = n.width, o = n.height, s = t?.width ?? a, c = t?.height ?? o;
60
- if (s > 16384 || c > 16384 || s * c > g) throw Error("Selected area is too large to capture");
61
- return (await i(document.body, {
53
+ if (i !== c.current) return null;
54
+ let o = r.width, s = r.height, l = n?.width ?? o, u = n?.height ?? s;
55
+ if (l > 16384 || u > 16384 || l * u > v) throw Error("Selected area is too large to capture");
56
+ return (await a(document.body, {
62
57
  useCORS: !0,
63
58
  allowTaint: !1,
64
59
  scale: 1,
65
60
  logging: !1,
66
- ignoreElements: v,
61
+ ignoreElements: t,
67
62
  onclone: (e) => import("./capture-colors-CxSLsU5-.js").then(({ normalizeCaptureColors: t }) => t(e)),
68
- x: t ? t.x + n.scrollX : 0,
69
- y: t ? t.y + n.scrollY : 0,
70
- width: t?.width ?? a,
71
- height: t?.height ?? o,
72
- windowWidth: a,
73
- windowHeight: o,
63
+ x: n ? n.x + r.scrollX : 0,
64
+ y: n ? n.y + r.scrollY : 0,
65
+ width: n?.width ?? o,
66
+ height: n?.height ?? s,
67
+ windowWidth: o,
68
+ windowHeight: s,
74
69
  scrollX: 0,
75
70
  scrollY: 0
76
71
  })).toDataURL("image/png");
77
72
  })(), new Promise((e, t) => {
78
- p.current = setTimeout(() => t(/* @__PURE__ */ Error("Screenshot timed out")), h);
73
+ m.current = setTimeout(() => t(/* @__PURE__ */ Error("Screenshot timed out")), _);
79
74
  })]);
80
- r === d.current && i && n(i);
75
+ i === c.current && a && r(a);
81
76
  } catch (e) {
82
- if (r !== d.current) return;
83
- console.error("[CommentKit] Screenshot failed:", e), n(null), o("Could not capture the page. Try again, or cancel to return to the page.");
77
+ if (i !== c.current) return;
78
+ console.error("[CommentKit] Screenshot failed:", e), r(null), s("Could not capture the page. Try again, or cancel to return to the page.");
84
79
  } finally {
85
- r === d.current && (clearTimeout(p.current), p.current = void 0, f.current = !1, i(!1));
80
+ i === c.current && (clearTimeout(m.current), m.current = void 0, p.current = !1, a(!1));
86
81
  }
87
82
  }, [e]),
88
- reset: s(() => {
89
- d.current += 1, clearTimeout(p.current), p.current = void 0, f.current = !1, i(!1), n(null), o(null);
83
+ reset: l(() => {
84
+ c.current += 1, clearTimeout(m.current), m.current = void 0, p.current = !1, a(!1), r(null), s(null);
90
85
  }, [])
91
86
  };
92
87
  }
93
- var b = () => import("./comment-screenshot-annotator-DcaSSuWB.js");
94
- function x({ capturePage: s, availableUsers: c = [], onSave: l, onCancel: u }) {
95
- let { imageUrl: d, capturing: m, error: h, capture: g, reset: _ } = y(s), v = o.useRef(null), [x, S] = o.useState(null), [C, w] = o.useState(null), T = x !== null, E = o.useMemo(() => !x || !C ? null : {
96
- x: Math.min(x.x, C.x),
97
- y: Math.min(x.y, C.y),
98
- width: Math.abs(C.x - x.x),
99
- height: Math.abs(C.y - x.y)
100
- }, [C, x]), D = o.useCallback(() => {
101
- g();
102
- }, [g]), O = (e) => {
103
- if (!(e.button !== 0 || d || m) && v.current === null) {
104
- v.current = e.pointerId;
88
+ var x = () => import("./comment-screenshot-annotator-aDtgMbBF.js");
89
+ function S({ capturePage: t, availableUsers: l = [], onSave: u, onCancel: d }) {
90
+ 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
+ x: Math.min(S.x, w.x),
92
+ y: Math.min(S.y, w.y),
93
+ width: Math.abs(w.x - S.x),
94
+ height: Math.abs(w.y - S.y)
95
+ }, [w, S]), O = c.useCallback(() => {
96
+ _();
97
+ }, [_]), k = (e) => {
98
+ if (!(e.button !== 0 || f || p) && y.current === null) {
99
+ y.current = e.pointerId;
105
100
  try {
106
101
  e.currentTarget.setPointerCapture(e.pointerId);
107
102
  } catch {}
108
- S({
103
+ C({
109
104
  x: e.clientX,
110
105
  y: e.clientY
111
- }), w({
106
+ }), T({
112
107
  x: e.clientX,
113
108
  y: e.clientY
114
109
  });
115
110
  }
116
- }, k = (e) => {
117
- T && !d && v.current === e.pointerId && w({
111
+ }, A = (e) => {
112
+ E && !f && y.current === e.pointerId && T({
118
113
  x: e.clientX,
119
114
  y: e.clientY
120
115
  });
121
- }, A = (e) => {
122
- if (v.current !== e.pointerId) return;
123
- if (v.current = null, e.currentTarget.hasPointerCapture?.(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !T || !E || d) {
124
- S(null), w(null);
116
+ }, j = (e) => {
117
+ if (y.current !== e.pointerId) return;
118
+ if (y.current = null, e.currentTarget.hasPointerCapture?.(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !E || !D || f) {
119
+ C(null), T(null);
125
120
  return;
126
121
  }
127
- let t = E.width >= 20 && E.height >= 20 ? E : void 0;
128
- S(null), w(null), g(t);
129
- }, j = (e) => {
130
- d || m || e.target !== e.currentTarget || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), D());
131
- }, M = o.useCallback(() => {
132
- _(), u();
133
- }, [_, u]);
134
- return o.useEffect(() => {
135
- if (d) return;
136
- let e = (e) => {
137
- e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), M());
122
+ let t = D.width >= 20 && D.height >= 20 ? D : void 0;
123
+ C(null), T(null), _(t);
124
+ }, M = (e) => {
125
+ f || p || e.target !== e.currentTarget || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), O());
126
+ }, N = c.useCallback(() => {
127
+ v(), d();
128
+ }, [v, d]);
129
+ return c.useEffect(() => {
130
+ if (f) return;
131
+ let t = (t) => {
132
+ e() || t.key === "Escape" && !t.defaultPrevented && (t.preventDefault(), N());
138
133
  };
139
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
140
- }, [d, M]), d ? /* @__PURE__ */ f(n, {
141
- load: b,
134
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
135
+ }, [f, N]), f ? /* @__PURE__ */ m(i, {
136
+ load: x,
142
137
  label: "screenshot editor",
143
- onCancel: M,
144
- children: ({ CommentScreenshotAnnotator: e }) => /* @__PURE__ */ f(e, {
145
- imageUrl: d,
146
- availableUsers: c,
147
- onSave: l,
148
- onCancel: M
138
+ onCancel: N,
139
+ children: ({ CommentScreenshotAnnotator: e }) => /* @__PURE__ */ m(e, {
140
+ imageUrl: f,
141
+ availableUsers: l,
142
+ onSave: u,
143
+ onCancel: N
149
144
  })
150
- }) : /* @__PURE__ */ p("div", {
145
+ }) : /* @__PURE__ */ h("div", {
151
146
  role: "button",
152
147
  tabIndex: 0,
153
148
  "data-commentkit-ui": "",
154
149
  "data-slot": "comment-screenshot-overlay",
155
150
  className: "ck-screenshot-overlay",
156
151
  "aria-label": "Drag to select a region, or press Enter for the full page",
157
- onPointerDown: O,
158
- onPointerMove: k,
159
- onPointerUp: A,
152
+ onPointerDown: k,
153
+ onPointerMove: A,
154
+ onPointerUp: j,
160
155
  onPointerCancel: () => {
161
- v.current = null, S(null), w(null);
156
+ y.current = null, C(null), T(null);
162
157
  },
163
- onKeyDown: j,
158
+ onKeyDown: M,
164
159
  children: [
165
- E && E.width > 5 && E.height > 5 ? /* @__PURE__ */ f("div", {
160
+ D && D.width > 5 && D.height > 5 ? /* @__PURE__ */ m("div", {
166
161
  className: "ck-screenshot-selection",
167
162
  style: {
168
- "--ck-x": `${E.x}px`,
169
- "--ck-y": `${E.y}px`,
170
- "--ck-w": `${E.width}px`,
171
- "--ck-h": `${E.height}px`
163
+ "--ck-x": `${D.x}px`,
164
+ "--ck-y": `${D.y}px`,
165
+ "--ck-w": `${D.width}px`,
166
+ "--ck-h": `${D.height}px`
172
167
  }
173
168
  }) : null,
174
- /* @__PURE__ */ p("div", {
169
+ /* @__PURE__ */ h("div", {
175
170
  className: "ck-screenshot-overlay-bar",
176
171
  onPointerDown: (e) => e.stopPropagation(),
177
172
  children: [
178
- f(m ? r : a, {}),
179
- /* @__PURE__ */ f("span", { children: m ? "Capturing…" : "Drag to select region, or click for full page" }),
180
- /* @__PURE__ */ f(e, {
173
+ m(p ? a : s, {}),
174
+ /* @__PURE__ */ m("span", { children: p ? "Capturing…" : "Drag to select region, or click for full page" }),
175
+ /* @__PURE__ */ m(n, {
181
176
  type: "button",
182
177
  variant: "ghost",
183
178
  size: "icon-sm",
184
179
  "aria-label": "Cancel screenshot",
185
180
  onClick: (e) => {
186
- e.stopPropagation(), M();
181
+ e.stopPropagation(), N();
187
182
  },
188
- children: /* @__PURE__ */ f(i, {})
183
+ children: /* @__PURE__ */ m(o, {})
189
184
  })
190
185
  ]
191
186
  }),
192
- h ? /* @__PURE__ */ f("p", {
187
+ g ? /* @__PURE__ */ m("p", {
193
188
  role: "alert",
194
189
  className: "ck-screenshot-overlay-error",
195
- children: h
190
+ children: g
196
191
  }) : null,
197
- /* @__PURE__ */ f(t, { mode: "screenshot" })
192
+ /* @__PURE__ */ m(r, { mode: "screenshot" })
198
193
  ]
199
194
  });
200
195
  }
201
- function S(e) {
202
- return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("style", {
196
+ function C(e) {
197
+ return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("style", {
203
198
  "data-ck-tool-styles": "screenshot",
204
- children: m
205
- }), /* @__PURE__ */ f(x, { ...e })] });
199
+ children: g
200
+ }), /* @__PURE__ */ m(S, { ...e })] });
206
201
  }
207
- export { S as CommentScreenshotOverlay };
202
+ export { C as CommentScreenshotOverlay };
@@ -0,0 +1,153 @@
1
+ import * as e from "react";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ var i = [
4
+ {
5
+ title: "General",
6
+ shortcuts: [
7
+ {
8
+ keys: [
9
+ "⌘",
10
+ "⇧",
11
+ "K"
12
+ ],
13
+ description: "Toggle CommentKit"
14
+ },
15
+ {
16
+ keys: ["?"],
17
+ description: "Keyboard shortcuts"
18
+ },
19
+ {
20
+ keys: ["Esc"],
21
+ description: "Close or cancel"
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ title: "Tools",
27
+ shortcuts: [
28
+ {
29
+ keys: ["C"],
30
+ description: "Pin comment"
31
+ },
32
+ {
33
+ keys: ["E"],
34
+ description: "Select element"
35
+ },
36
+ {
37
+ keys: ["H"],
38
+ description: "Highlight"
39
+ },
40
+ {
41
+ keys: ["D"],
42
+ description: "Drawing"
43
+ },
44
+ {
45
+ keys: ["S"],
46
+ description: "Screenshot"
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ title: "Formatting",
52
+ shortcuts: [
53
+ {
54
+ keys: ["⌘", "B"],
55
+ description: "Bold"
56
+ },
57
+ {
58
+ keys: ["⌘", "I"],
59
+ description: "Italic"
60
+ },
61
+ {
62
+ keys: ["⌘", "E"],
63
+ description: "Code"
64
+ },
65
+ {
66
+ keys: [
67
+ "⌘",
68
+ "⇧",
69
+ "X"
70
+ ],
71
+ description: "Strikethrough"
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ title: "Composer",
77
+ shortcuts: [
78
+ {
79
+ keys: ["↵"],
80
+ description: "Submit reply"
81
+ },
82
+ {
83
+ keys: ["⌘", "↵"],
84
+ description: "Submit comment"
85
+ },
86
+ {
87
+ keys: ["⇧", "↵"],
88
+ description: "New line"
89
+ },
90
+ {
91
+ keys: ["@"],
92
+ description: "Mention a user"
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ title: "Drawing",
98
+ shortcuts: [
99
+ {
100
+ keys: ["⌘", "Z"],
101
+ description: "Undo stroke"
102
+ },
103
+ {
104
+ keys: [
105
+ "⌘",
106
+ "⇧",
107
+ "Z"
108
+ ],
109
+ description: "Redo stroke"
110
+ },
111
+ {
112
+ keys: ["Esc"],
113
+ description: "Cancel drawing"
114
+ }
115
+ ]
116
+ }
117
+ ];
118
+ function a({ Kbd: a, KbdGroup: o, ScrollArea: s, Separator: c }) {
119
+ return /* @__PURE__ */ r(t, { children: [
120
+ /* @__PURE__ */ n(s, {
121
+ className: "ck-shortcuts-scroll",
122
+ children: /* @__PURE__ */ n("div", {
123
+ className: "ck-shortcuts-groups",
124
+ children: i.map((t, i) => /* @__PURE__ */ r(e.Fragment, { children: [i > 0 ? /* @__PURE__ */ n(c, {}) : null, /* @__PURE__ */ r("div", {
125
+ className: "ck-shortcuts-group",
126
+ children: [/* @__PURE__ */ n("p", {
127
+ className: "ck-shortcuts-label",
128
+ children: t.title
129
+ }), /* @__PURE__ */ n("div", {
130
+ className: "ck-shortcuts-list",
131
+ children: t.shortcuts.map((e) => /* @__PURE__ */ r("div", {
132
+ className: "ck-shortcuts-row",
133
+ children: [/* @__PURE__ */ n("span", {
134
+ className: "ck-shortcuts-description",
135
+ children: e.description
136
+ }), /* @__PURE__ */ n(o, { children: e.keys.map((t) => /* @__PURE__ */ n(a, { children: t }, `${e.description}-${t}`)) })]
137
+ }, e.description))
138
+ })]
139
+ })] }, t.title))
140
+ })
141
+ }),
142
+ /* @__PURE__ */ n(c, {}),
143
+ /* @__PURE__ */ r("p", {
144
+ className: "ck-shortcuts-footer",
145
+ children: [
146
+ "Press ",
147
+ /* @__PURE__ */ n(a, { children: "?" }),
148
+ " anytime to toggle this overlay"
149
+ ]
150
+ })
151
+ ] });
152
+ }
153
+ export { a as ShortcutContent };
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./button-By0hGrJK.js";
2
- import { i as t, o as n, r, t as i } from "./separator-XDBsaWyw.js";
2
+ import { i as t, o as n, r, t as i } from "./separator-aphZiRoJ.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-0vd-DY4S.js";
4
+ import { C as o, H as s, U as c, W as l, u } from "./comment-kit-ui-qKjCHHOy.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", {
@@ -113,8 +113,7 @@ var y = 2500, b = ({ core: a, state: f }) => {
113
113
  try {
114
114
  await a.copyAgentContext({
115
115
  commentIds: Array.from(g),
116
- includeResolved: !1,
117
- includeHtml: !0
116
+ includeResolved: !1
118
117
  }), w(Date.now());
119
118
  } catch {
120
119
  E("Could not copy. Allow clipboard access and try again.");