@commentkit/comment-kit 0.7.7 → 1.0.0-beta.0
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 +24 -0
- package/README.md +108 -762
- package/SECURITY.md +19 -14
- package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
- package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
- package/dist/npm/chunks/client-D1vrh_5G.js +590 -0
- package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
- package/dist/npm/chunks/html2canvas-_mjSRP3G.js +4011 -0
- package/dist/npm/chunks/mount-Ce1MZrcm.js +2485 -0
- package/dist/{shared/pusher-CnhQgAvF.js → npm/chunks/pusher-DRKlokR8.js} +224 -222
- package/dist/npm/chunks/realtime-5SvAvTUU.js +23 -0
- package/dist/npm/chunks/rolldown-runtime-VHNaYcLd.js +13 -0
- package/dist/npm/chunks/src-DJjfvVsa.js +330 -0
- package/dist/npm/element.js +24 -0
- package/dist/npm/headless.js +3 -0
- package/dist/npm/index.js +3 -0
- package/dist/npm/react.js +17 -0
- package/dist/npm/svelte.js +8 -0
- package/dist/npm/types/adapters/react.d.ts +9 -0
- package/dist/npm/types/adapters/svelte.d.ts +9 -0
- package/dist/npm/types/adapters/vue.d.ts +46 -0
- package/dist/npm/types/anchor/index.d.ts +49 -0
- package/dist/npm/types/core/api.d.ts +29 -0
- package/dist/npm/types/core/auth.d.ts +48 -0
- package/dist/npm/types/core/client.d.ts +100 -0
- package/dist/npm/types/core/store.d.ts +7 -0
- package/dist/npm/types/core/types.d.ts +278 -0
- package/dist/npm/types/element.d.ts +10 -0
- package/dist/npm/types/headless.d.ts +7 -0
- package/dist/npm/types/index.d.ts +30 -0
- package/dist/npm/vue.js +32 -0
- package/package.json +65 -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,151 +0,0 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./annotation-toolbar-zeiCmKIr.js";
|
|
2
|
-
import { T as r, _ as i, a, g as o, i as s } from "./comment-kit-ui-BHwYuSIi.js";
|
|
3
|
-
import * as c from "react";
|
|
4
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
-
function d(e) {
|
|
6
|
-
return new Promise((t, n) => {
|
|
7
|
-
let r = new Image(), i = setTimeout(() => n(/* @__PURE__ */ Error("Screenshot loading timed out. Try capturing it again.")), 15e3);
|
|
8
|
-
r.onload = () => {
|
|
9
|
-
clearTimeout(i), t(r);
|
|
10
|
-
}, r.onerror = () => {
|
|
11
|
-
clearTimeout(i), n(/* @__PURE__ */ Error("Could not load screenshot. Try capturing it again."));
|
|
12
|
-
}, r.src = e;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function f({ imageUrl: f, availableUsers: p = [], onSave: m, onCancel: h }) {
|
|
16
|
-
let g = t(), _ = c.useRef(null), v = c.useRef(null), y = c.useRef(0), [b, x] = c.useState(null), [S, C] = c.useState(() => ({
|
|
17
|
-
w: window.innerWidth,
|
|
18
|
-
h: window.innerHeight
|
|
19
|
-
}));
|
|
20
|
-
c.useEffect(() => {
|
|
21
|
-
let e = () => C({
|
|
22
|
-
w: window.innerWidth,
|
|
23
|
-
h: window.innerHeight
|
|
24
|
-
});
|
|
25
|
-
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
26
|
-
}, []), c.useEffect(() => () => {
|
|
27
|
-
y.current += 1;
|
|
28
|
-
}, []);
|
|
29
|
-
let w = c.useCallback(() => {
|
|
30
|
-
y.current += 1, h();
|
|
31
|
-
}, [h]), T = S.w < 1024, E = Math.max(160, Math.min(S.w - (T ? 32 : 428), 800)), D = Math.max(160, T ? Math.min(S.h * .42, 520) : S.h - 160), O = b?.w ?? E, k = b?.h ?? D;
|
|
32
|
-
if (T) O = E, b && b.w > 0 && (k = E * b.h / b.w);
|
|
33
|
-
else {
|
|
34
|
-
let e = Math.min(E / O, D / k, 1);
|
|
35
|
-
O *= e, k *= e;
|
|
36
|
-
}
|
|
37
|
-
let A = b?.w ?? O, j = b?.h ?? k, M = g.paths.flatMap((e) => {
|
|
38
|
-
let t = a(e);
|
|
39
|
-
return t ? [t] : [];
|
|
40
|
-
}), N = g.activePath ? a(g.activePath) : null, P = (e) => {
|
|
41
|
-
let t = e.currentTarget.getBoundingClientRect();
|
|
42
|
-
return !t.width || !t.height ? null : {
|
|
43
|
-
x: (e.clientX - t.left) * A / t.width,
|
|
44
|
-
y: (e.clientY - t.top) * j / t.height
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
return e(g.undo, g.redo, w), /* @__PURE__ */ u("div", {
|
|
48
|
-
"data-commentkit-ui": "",
|
|
49
|
-
"data-slot": "comment-screenshot-annotator",
|
|
50
|
-
className: "ck-screenshot-annotator",
|
|
51
|
-
children: [/* @__PURE__ */ l("div", {
|
|
52
|
-
className: "ck-screenshot-annotator-layout",
|
|
53
|
-
children: /* @__PURE__ */ u("div", {
|
|
54
|
-
className: "ck-screenshot-annotator-stage",
|
|
55
|
-
children: [/* @__PURE__ */ u("div", {
|
|
56
|
-
className: "ck-screenshot-annotator-media",
|
|
57
|
-
children: [/* @__PURE__ */ l("div", {
|
|
58
|
-
className: "ck-screenshot-annotator-toolbar",
|
|
59
|
-
children: /* @__PURE__ */ l(n, {
|
|
60
|
-
colors: r,
|
|
61
|
-
drawing: g,
|
|
62
|
-
onCancel: w
|
|
63
|
-
})
|
|
64
|
-
}), /* @__PURE__ */ u("div", {
|
|
65
|
-
className: "ck-screenshot-annotator-canvas",
|
|
66
|
-
style: {
|
|
67
|
-
"--ck-w": `${O}px`,
|
|
68
|
-
"--ck-h": `${k}px`,
|
|
69
|
-
"--ck-frame": `${D}px`
|
|
70
|
-
},
|
|
71
|
-
children: [/* @__PURE__ */ l("img", {
|
|
72
|
-
src: f,
|
|
73
|
-
alt: "Screenshot",
|
|
74
|
-
className: "ck-screenshot-annotator-image",
|
|
75
|
-
draggable: !1,
|
|
76
|
-
onLoad: (e) => {
|
|
77
|
-
let t = e.currentTarget;
|
|
78
|
-
t.naturalWidth && t.naturalHeight && x({
|
|
79
|
-
w: t.naturalWidth,
|
|
80
|
-
h: t.naturalHeight
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}), /* @__PURE__ */ u("svg", {
|
|
84
|
-
ref: _,
|
|
85
|
-
role: "application",
|
|
86
|
-
"aria-label": "Annotation canvas",
|
|
87
|
-
className: "ck-screenshot-annotator-strokes",
|
|
88
|
-
width: O,
|
|
89
|
-
height: k,
|
|
90
|
-
viewBox: `0 0 ${A} ${j}`,
|
|
91
|
-
onPointerDown: (e) => {
|
|
92
|
-
if (e.button !== 0 || v.current !== null) return;
|
|
93
|
-
let t = P(e);
|
|
94
|
-
if (t) {
|
|
95
|
-
v.current = e.pointerId;
|
|
96
|
-
try {
|
|
97
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
98
|
-
} catch {}
|
|
99
|
-
g.startPath(t.x, t.y, A / O);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
onPointerMove: (e) => {
|
|
103
|
-
if (v.current !== e.pointerId) return;
|
|
104
|
-
let t = P(e);
|
|
105
|
-
t && g.addPoint(t.x, t.y);
|
|
106
|
-
},
|
|
107
|
-
onPointerUp: (e) => {
|
|
108
|
-
v.current === e.pointerId && (v.current = null, e.currentTarget.hasPointerCapture?.(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), g.endPath());
|
|
109
|
-
},
|
|
110
|
-
onPointerCancel: (e) => {
|
|
111
|
-
v.current === e.pointerId && (v.current = null, g.cancelPath());
|
|
112
|
-
},
|
|
113
|
-
children: [M.map((e, t) => /* @__PURE__ */ l(s, { path: e }, `${e.type}-${t}`)), N ? /* @__PURE__ */ l(s, { path: N }) : null]
|
|
114
|
-
})]
|
|
115
|
-
})]
|
|
116
|
-
}), /* @__PURE__ */ l("div", {
|
|
117
|
-
className: "ck-screenshot-annotator-composer",
|
|
118
|
-
children: /* @__PURE__ */ l(i, {
|
|
119
|
-
mode: "new-thread",
|
|
120
|
-
placeholder: "Describe what you see...",
|
|
121
|
-
availableUsers: p,
|
|
122
|
-
onSubmit: async (e, t) => {
|
|
123
|
-
let n = y.current, r = _.current;
|
|
124
|
-
if (!r || g.paths.length === 0) {
|
|
125
|
-
await m(f, e, t);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
let i = await d(f), a = document.createElement("canvas");
|
|
129
|
-
a.width = i.naturalWidth, a.height = i.naturalHeight;
|
|
130
|
-
let o = a.getContext("2d");
|
|
131
|
-
if (!o) throw Error("Screenshot annotation is unavailable in this browser.");
|
|
132
|
-
o.drawImage(i, 0, 0);
|
|
133
|
-
let s = r.cloneNode(!0);
|
|
134
|
-
s.setAttribute("xmlns", "http://www.w3.org/2000/svg"), s.setAttribute("width", String(a.width)), s.setAttribute("height", String(a.height));
|
|
135
|
-
let c = new XMLSerializer().serializeToString(s), l = URL.createObjectURL(new Blob([c], { type: "image/svg+xml;charset=utf-8" }));
|
|
136
|
-
try {
|
|
137
|
-
let r = await d(l);
|
|
138
|
-
if (n !== y.current) return;
|
|
139
|
-
o.drawImage(r, 0, 0, a.width, a.height), await m(a.toDataURL("image/png"), e, t);
|
|
140
|
-
} finally {
|
|
141
|
-
URL.revokeObjectURL(l);
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
onCancel: w
|
|
145
|
-
})
|
|
146
|
-
})]
|
|
147
|
-
})
|
|
148
|
-
}), /* @__PURE__ */ l(o, { mode: "draw" })]
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
export { f as CommentScreenshotAnnotator };
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { u as e } from "./comment-kit-core-CmLUFujd.js";
|
|
2
|
-
import { t } from "./capture-privacy-CiOrcAlt.js";
|
|
3
|
-
import { t as n } from "./button-D4GHW6oZ.js";
|
|
4
|
-
import { C as r, g as i, v as a } from "./comment-kit-ui-BHwYuSIi.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) {
|
|
11
|
-
let r = e.dimensions.width / n.width, i = e.dimensions.height / n.height, a = new Image(), o = new Promise((e, t) => {
|
|
12
|
-
a.onload = () => e(), a.onerror = () => t(/* @__PURE__ */ Error("Could not load captured screenshot"));
|
|
13
|
-
});
|
|
14
|
-
a.src = e.dataUrl, await o;
|
|
15
|
-
let s = document.createElement("canvas");
|
|
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");
|
|
17
|
-
let c = s.getContext("2d");
|
|
18
|
-
if (!c) throw Error("Screenshot cropping is unavailable in this browser");
|
|
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");
|
|
20
|
-
}
|
|
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);
|
|
25
|
-
}, []), {
|
|
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);
|
|
34
|
-
try {
|
|
35
|
-
let a = await Promise.race([(async () => {
|
|
36
|
-
if (t(document.body)) throw Error("Page capture is disabled");
|
|
37
|
-
let r = {
|
|
38
|
-
width: Math.max(document.documentElement.scrollWidth, document.body?.scrollWidth ?? 0, window.innerWidth),
|
|
39
|
-
height: Math.max(document.documentElement.scrollHeight, document.body?.scrollHeight ?? 0, window.innerHeight),
|
|
40
|
-
scrollX: window.scrollX,
|
|
41
|
-
scrollY: window.scrollY,
|
|
42
|
-
windowWidth: window.innerWidth,
|
|
43
|
-
windowHeight: window.innerHeight
|
|
44
|
-
};
|
|
45
|
-
if (e) {
|
|
46
|
-
let t = await e();
|
|
47
|
-
if (!t) throw Error("Screenshot provider could not capture this page");
|
|
48
|
-
return n ? y(t, n, r) : t.dataUrl;
|
|
49
|
-
}
|
|
50
|
-
let a;
|
|
51
|
-
try {
|
|
52
|
-
a = (await import("html2canvas")).default;
|
|
53
|
-
} catch {
|
|
54
|
-
throw Error("Screenshot requires either a custom screenshotProvider in config or html2canvas installed. Install html2canvas: npm install html2canvas — or provide config.screenshotProvider.");
|
|
55
|
-
}
|
|
56
|
-
if (i !== c.current) return null;
|
|
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");
|
|
59
|
-
return (await a(document.body, {
|
|
60
|
-
useCORS: !0,
|
|
61
|
-
allowTaint: !1,
|
|
62
|
-
scale: 1,
|
|
63
|
-
logging: !1,
|
|
64
|
-
ignoreElements: t,
|
|
65
|
-
onclone: (e) => import("./capture-colors-D0uLr-vZ.js").then(({ normalizeCaptureColors: t }) => t(e)),
|
|
66
|
-
x: n ? n.x + r.scrollX : 0,
|
|
67
|
-
y: n ? n.y + r.scrollY : 0,
|
|
68
|
-
width: o,
|
|
69
|
-
height: s,
|
|
70
|
-
windowWidth: r.windowWidth,
|
|
71
|
-
windowHeight: r.windowHeight,
|
|
72
|
-
scrollX: r.scrollX,
|
|
73
|
-
scrollY: r.scrollY
|
|
74
|
-
})).toDataURL("image/png");
|
|
75
|
-
})(), new Promise((e, t) => {
|
|
76
|
-
m.current = setTimeout(() => t(/* @__PURE__ */ Error("Screenshot timed out")), _);
|
|
77
|
-
})]);
|
|
78
|
-
i === c.current && a && r(a);
|
|
79
|
-
} catch (e) {
|
|
80
|
-
if (i !== c.current) return;
|
|
81
|
-
console.error("[CommentKit] Screenshot failed:", e), r(null), s("Could not capture the page. Try again, or cancel to return to the page.");
|
|
82
|
-
} finally {
|
|
83
|
-
i === c.current && (clearTimeout(m.current), m.current = void 0, p.current = !1, a(!1));
|
|
84
|
-
}
|
|
85
|
-
}, [e]),
|
|
86
|
-
reset: l(() => {
|
|
87
|
-
c.current += 1, clearTimeout(m.current), m.current = void 0, p.current = !1, a(!1), r(null), s(null);
|
|
88
|
-
}, [])
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
var x = () => import("./comment-screenshot-annotator-zJZyO-XM.js");
|
|
92
|
-
function S({ capturePage: t, availableUsers: l = [], onSave: u, onCancel: d }) {
|
|
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
|
-
x: Math.min(S.x, w.x),
|
|
95
|
-
y: Math.min(S.y, w.y),
|
|
96
|
-
width: Math.abs(w.x - S.x),
|
|
97
|
-
height: Math.abs(w.y - S.y)
|
|
98
|
-
}, [w, S]), O = c.useCallback(() => {
|
|
99
|
-
_();
|
|
100
|
-
}, [_]), k = (e) => {
|
|
101
|
-
if (!(e.button !== 0 || f || p) && y.current === null) {
|
|
102
|
-
y.current = e.pointerId;
|
|
103
|
-
try {
|
|
104
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
105
|
-
} catch {}
|
|
106
|
-
C({
|
|
107
|
-
x: e.clientX,
|
|
108
|
-
y: e.clientY
|
|
109
|
-
}), T({
|
|
110
|
-
x: e.clientX,
|
|
111
|
-
y: e.clientY
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}, A = (e) => {
|
|
115
|
-
E && !f && y.current === e.pointerId && T({
|
|
116
|
-
x: e.clientX,
|
|
117
|
-
y: e.clientY
|
|
118
|
-
});
|
|
119
|
-
}, j = (e) => {
|
|
120
|
-
if (y.current !== e.pointerId) return;
|
|
121
|
-
if (y.current = null, e.currentTarget.hasPointerCapture?.(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !E || !D || f) {
|
|
122
|
-
C(null), T(null);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
let t = D.width >= 20 && D.height >= 20 ? D : void 0;
|
|
126
|
-
C(null), T(null), _(t);
|
|
127
|
-
}, M = (e) => {
|
|
128
|
-
f || p || e.target !== e.currentTarget || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), O());
|
|
129
|
-
}, N = c.useCallback(() => {
|
|
130
|
-
v(), d();
|
|
131
|
-
}, [v, d]);
|
|
132
|
-
return c.useEffect(() => {
|
|
133
|
-
if (f) return;
|
|
134
|
-
let t = (t) => {
|
|
135
|
-
e() || t.key === "Escape" && !t.defaultPrevented && (t.preventDefault(), N());
|
|
136
|
-
};
|
|
137
|
-
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
138
|
-
}, [f, N]), f ? /* @__PURE__ */ m(r, {
|
|
139
|
-
load: x,
|
|
140
|
-
label: "screenshot editor",
|
|
141
|
-
onCancel: N,
|
|
142
|
-
children: ({ CommentScreenshotAnnotator: e }) => /* @__PURE__ */ m(e, {
|
|
143
|
-
imageUrl: f,
|
|
144
|
-
availableUsers: l,
|
|
145
|
-
onSave: u,
|
|
146
|
-
onCancel: N
|
|
147
|
-
})
|
|
148
|
-
}) : /* @__PURE__ */ h("div", {
|
|
149
|
-
role: "button",
|
|
150
|
-
tabIndex: 0,
|
|
151
|
-
"data-commentkit-ui": "",
|
|
152
|
-
"data-slot": "comment-screenshot-overlay",
|
|
153
|
-
className: "ck-screenshot-overlay",
|
|
154
|
-
"aria-label": "Drag to select a region, or press Enter for the full page",
|
|
155
|
-
onPointerDown: k,
|
|
156
|
-
onPointerMove: A,
|
|
157
|
-
onPointerUp: j,
|
|
158
|
-
onPointerCancel: () => {
|
|
159
|
-
y.current = null, C(null), T(null);
|
|
160
|
-
},
|
|
161
|
-
onKeyDown: M,
|
|
162
|
-
children: [
|
|
163
|
-
D && D.width > 5 && D.height > 5 ? /* @__PURE__ */ m("div", {
|
|
164
|
-
className: "ck-screenshot-selection",
|
|
165
|
-
style: {
|
|
166
|
-
"--ck-x": `${D.x}px`,
|
|
167
|
-
"--ck-y": `${D.y}px`,
|
|
168
|
-
"--ck-w": `${D.width}px`,
|
|
169
|
-
"--ck-h": `${D.height}px`
|
|
170
|
-
}
|
|
171
|
-
}) : null,
|
|
172
|
-
/* @__PURE__ */ h("div", {
|
|
173
|
-
className: "ck-screenshot-overlay-bar",
|
|
174
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
175
|
-
children: [
|
|
176
|
-
m(p ? a : s, {}),
|
|
177
|
-
/* @__PURE__ */ m("span", { children: p ? "Capturing…" : "Drag to select region, or click for full page" }),
|
|
178
|
-
/* @__PURE__ */ m(n, {
|
|
179
|
-
type: "button",
|
|
180
|
-
variant: "ghost",
|
|
181
|
-
size: "icon-sm",
|
|
182
|
-
"aria-label": "Cancel screenshot",
|
|
183
|
-
onClick: (e) => {
|
|
184
|
-
e.stopPropagation(), N();
|
|
185
|
-
},
|
|
186
|
-
children: /* @__PURE__ */ m(o, {})
|
|
187
|
-
})
|
|
188
|
-
]
|
|
189
|
-
}),
|
|
190
|
-
g ? /* @__PURE__ */ m("p", {
|
|
191
|
-
role: "alert",
|
|
192
|
-
className: "ck-screenshot-overlay-error",
|
|
193
|
-
children: g
|
|
194
|
-
}) : null,
|
|
195
|
-
/* @__PURE__ */ m(i, { mode: "screenshot" })
|
|
196
|
-
]
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function C(e) {
|
|
200
|
-
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("style", {
|
|
201
|
-
"data-ck-tool-styles": "screenshot",
|
|
202
|
-
children: g
|
|
203
|
-
}), /* @__PURE__ */ m(S, { ...e })] });
|
|
204
|
-
}
|
|
205
|
-
export { C as CommentScreenshotOverlay };
|
|
@@ -1,153 +0,0 @@
|
|
|
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,45 +0,0 @@
|
|
|
1
|
-
import { createElement as e, forwardRef as t } from "react";
|
|
2
|
-
var n = {
|
|
3
|
-
outline: {
|
|
4
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
-
width: 24,
|
|
6
|
-
height: 24,
|
|
7
|
-
viewBox: "0 0 24 24",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: 2,
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round"
|
|
13
|
-
},
|
|
14
|
-
filled: {
|
|
15
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
-
width: 24,
|
|
17
|
-
height: 24,
|
|
18
|
-
viewBox: "0 0 24 24",
|
|
19
|
-
fill: "currentColor",
|
|
20
|
-
stroke: "none"
|
|
21
|
-
}
|
|
22
|
-
}, r = (r, i, a, o) => {
|
|
23
|
-
let s = t(({ color: t = "currentColor", size: a = 24, stroke: s = 2, title: c, className: l, children: u, ...d }, f) => e("svg", {
|
|
24
|
-
ref: f,
|
|
25
|
-
...n[r],
|
|
26
|
-
width: a,
|
|
27
|
-
height: a,
|
|
28
|
-
className: [
|
|
29
|
-
"tabler-icon",
|
|
30
|
-
`tabler-icon-${i}`,
|
|
31
|
-
l
|
|
32
|
-
].filter(Boolean).join(" "),
|
|
33
|
-
...r === "filled" ? { fill: t } : {
|
|
34
|
-
strokeWidth: s,
|
|
35
|
-
stroke: t
|
|
36
|
-
},
|
|
37
|
-
...d
|
|
38
|
-
}, [
|
|
39
|
-
c && e("title", { key: "svg-title" }, c),
|
|
40
|
-
...o.map(([t, n]) => e(t, n)),
|
|
41
|
-
...Array.isArray(u) ? u : [u]
|
|
42
|
-
]));
|
|
43
|
-
return s.displayName = `${a}`, s;
|
|
44
|
-
};
|
|
45
|
-
export { r as t };
|