@commentkit/comment-kit 0.7.0 → 0.7.1
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 +27 -0
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +5 -5
- package/dist/demo.es.js +4 -3
- 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/{annotation-toolbar-B9SxYqoF.js → annotation-toolbar-cGC1p-SP.js} +379 -379
- package/dist/shared/attachment-refresh-CzQFXHkL.js +94 -0
- package/dist/shared/{button-group-Cl9CrvvU.js → button-group-CWdKaOlC.js} +14 -16
- package/dist/shared/capture-colors-CxSLsU5-.js +74 -0
- package/dist/shared/{comment-drawing-canvas-Dzb5YoFw.js → comment-drawing-canvas-DdXlMgbF.js} +2 -2
- package/dist/shared/{comment-utils-BycYTSxA.js → comment-icon-Dg9ZWpz-.js} +29 -23
- package/dist/shared/comment-image-lightbox-B7iHjnAz.js +190 -0
- package/dist/shared/comment-images-content-D7YNUgo5.js +214 -0
- package/dist/shared/{comment-kit-core-BaSuMzp9.js → comment-kit-core-C862uNAm.js} +998 -778
- package/dist/shared/{comment-kit-ui-CzfdAZs2.js → comment-kit-ui-0vd-DY4S.js} +5206 -5410
- package/dist/shared/{comment-screenshot-annotator-C7X-_bm6.js → comment-screenshot-annotator-DcaSSuWB.js} +5 -5
- package/dist/shared/{comment-screenshot-overlay-wIrZrcRy.js → comment-screenshot-overlay-D_nFoJmM.js} +6 -5
- package/dist/shared/{dev-export-panel-FwFVdady.js → dev-export-panel-pWBlhlse.js} +7 -7
- package/dist/shared/dev-grab-eQ9EgEGY.js +210 -0
- package/dist/shared/{element-selector-BhJm-NSs.js → element-selector-DC-_XJ0k.js} +311 -272
- package/dist/shared/{mount-ui--ijs8pWT.js → mount-ui-B68j8r6I.js} +4 -4
- package/dist/shared/{pusher-ipHMJnO_.js → pusher-C1FHQGXV.js} +1 -1
- package/dist/shared/realtime-Diqz7G_y.js +317 -0
- package/dist/shared/realtime-recovery-DJ_adc-H.js +135 -0
- package/dist/shared/{shadow-root-C5v-T8lQ.js → shadow-root-CrO75sED.js} +1 -1
- package/dist/shared/{styles-D3yMtaec.js → styles-C9Jwvm0Q.js} +1 -1
- package/dist/shared/useRender-D1z_X_BY.js +5 -0
- package/dist/shared/{validation-C7QG8j7Z.js → validation-D-8u4M7I.js} +14 -1
- package/dist/shared/{websocket-manager-DhLWh3Jr.js → websocket-manager-CFak_YHy.js} +148 -89
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +8 -1
- package/dist/types/core/comment-kit-core.d.ts +9 -0
- package/dist/types/core/types.d.ts +35 -0
- package/dist/types/core/websocket-manager.d.ts +12 -0
- package/dist/types/core/write-access.d.ts +9 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +6 -0
- package/package.json +3 -2
- package/dist/shared/comment-image-lightbox-BPYJT1sB.js +0 -183
- package/dist/shared/dev-grab-DDqg0LQf.js +0 -203
- package/dist/shared/realtime-Dk41VwKg.js +0 -302
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./annotation-toolbar-
|
|
2
|
-
import {
|
|
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";
|
|
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) {
|
|
@@ -35,9 +35,9 @@ function f({ imageUrl: f, availableUsers: p = [], onSave: m, onCancel: h }) {
|
|
|
35
35
|
O *= e, k *= e;
|
|
36
36
|
}
|
|
37
37
|
let A = b?.w ?? O, j = b?.h ?? k, M = g.paths.flatMap((e) => {
|
|
38
|
-
let t =
|
|
38
|
+
let t = a(e);
|
|
39
39
|
return t ? [t] : [];
|
|
40
|
-
}), N = g.activePath ?
|
|
40
|
+
}), N = g.activePath ? a(g.activePath) : null, P = (e) => {
|
|
41
41
|
let t = e.currentTarget.getBoundingClientRect();
|
|
42
42
|
return !t.width || !t.height ? null : {
|
|
43
43
|
x: (e.clientX - t.left) * A / t.width,
|
|
@@ -115,7 +115,7 @@ function f({ imageUrl: f, availableUsers: p = [], onSave: m, onCancel: h }) {
|
|
|
115
115
|
})]
|
|
116
116
|
}), /* @__PURE__ */ l("div", {
|
|
117
117
|
className: "ck-screenshot-annotator-composer",
|
|
118
|
-
children: /* @__PURE__ */ l(
|
|
118
|
+
children: /* @__PURE__ */ l(i, {
|
|
119
119
|
mode: "new-thread",
|
|
120
120
|
placeholder: "Describe what you see...",
|
|
121
121
|
availableUsers: p,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./button-By0hGrJK.js";
|
|
2
|
-
import {
|
|
2
|
+
import { g as t, j as n, v as r } from "./comment-kit-ui-0vd-DY4S.js";
|
|
3
3
|
import { d as i, i as a } from "./annotation-icons-Dh-bmNYK.js";
|
|
4
4
|
import * as o from "react";
|
|
5
5
|
import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
@@ -64,6 +64,7 @@ function y(e) {
|
|
|
64
64
|
scale: 1,
|
|
65
65
|
logging: !1,
|
|
66
66
|
ignoreElements: v,
|
|
67
|
+
onclone: (e) => import("./capture-colors-CxSLsU5-.js").then(({ normalizeCaptureColors: t }) => t(e)),
|
|
67
68
|
x: t ? t.x + n.scrollX : 0,
|
|
68
69
|
y: t ? t.y + n.scrollY : 0,
|
|
69
70
|
width: t?.width ?? a,
|
|
@@ -89,7 +90,7 @@ function y(e) {
|
|
|
89
90
|
}, [])
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
var b = () => import("./comment-screenshot-annotator-
|
|
93
|
+
var b = () => import("./comment-screenshot-annotator-DcaSSuWB.js");
|
|
93
94
|
function x({ capturePage: s, availableUsers: c = [], onSave: l, onCancel: u }) {
|
|
94
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 : {
|
|
95
96
|
x: Math.min(x.x, C.x),
|
|
@@ -136,7 +137,7 @@ function x({ capturePage: s, availableUsers: c = [], onSave: l, onCancel: u }) {
|
|
|
136
137
|
e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), M());
|
|
137
138
|
};
|
|
138
139
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
139
|
-
}, [d, M]), d ? /* @__PURE__ */ f(
|
|
140
|
+
}, [d, M]), d ? /* @__PURE__ */ f(n, {
|
|
140
141
|
load: b,
|
|
141
142
|
label: "screenshot editor",
|
|
142
143
|
onCancel: M,
|
|
@@ -174,7 +175,7 @@ function x({ capturePage: s, availableUsers: c = [], onSave: l, onCancel: u }) {
|
|
|
174
175
|
className: "ck-screenshot-overlay-bar",
|
|
175
176
|
onPointerDown: (e) => e.stopPropagation(),
|
|
176
177
|
children: [
|
|
177
|
-
f(m ?
|
|
178
|
+
f(m ? r : a, {}),
|
|
178
179
|
/* @__PURE__ */ f("span", { children: m ? "Capturing…" : "Drag to select region, or click for full page" }),
|
|
179
180
|
/* @__PURE__ */ f(e, {
|
|
180
181
|
type: "button",
|
|
@@ -193,7 +194,7 @@ function x({ capturePage: s, availableUsers: c = [], onSave: l, onCancel: u }) {
|
|
|
193
194
|
className: "ck-screenshot-overlay-error",
|
|
194
195
|
children: h
|
|
195
196
|
}) : null,
|
|
196
|
-
/* @__PURE__ */ f(
|
|
197
|
+
/* @__PURE__ */ f(t, { mode: "screenshot" })
|
|
197
198
|
]
|
|
198
199
|
});
|
|
199
200
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./button-By0hGrJK.js";
|
|
2
2
|
import { i as t, o as n, r, t as i } from "./separator-XDBsaWyw.js";
|
|
3
3
|
import { t as a } from "./createReactComponent-BZHeRbD0.js";
|
|
4
|
-
import {
|
|
4
|
+
import { C as o, H as s, U as c, W as l, u } from "./comment-kit-ui-0vd-DY4S.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", {
|
|
@@ -48,7 +48,7 @@ var y = 2500, b = ({ core: a, state: f }) => {
|
|
|
48
48
|
className: "ck-dev-export-header",
|
|
49
49
|
children: [/* @__PURE__ */ m("div", {
|
|
50
50
|
className: "ck-dev-export-title",
|
|
51
|
-
children: [/* @__PURE__ */ p(
|
|
51
|
+
children: [/* @__PURE__ */ p(s, {
|
|
52
52
|
size: 16,
|
|
53
53
|
"aria-hidden": !0
|
|
54
54
|
}), /* @__PURE__ */ p("strong", { children: "Dev export" })]
|
|
@@ -61,7 +61,7 @@ var y = 2500, b = ({ core: a, state: f }) => {
|
|
|
61
61
|
/* @__PURE__ */ m("div", {
|
|
62
62
|
className: "ck-dev-export-toolbar",
|
|
63
63
|
children: [
|
|
64
|
-
/* @__PURE__ */ p(
|
|
64
|
+
/* @__PURE__ */ p(o, {
|
|
65
65
|
checked: A,
|
|
66
66
|
indeterminate: j,
|
|
67
67
|
onCheckedChange: () => {
|
|
@@ -124,7 +124,7 @@ var y = 2500, b = ({ core: a, state: f }) => {
|
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
disabled: M || x,
|
|
127
|
-
children: [/* @__PURE__ */ p(
|
|
127
|
+
children: [/* @__PURE__ */ p(c, {
|
|
128
128
|
size: 14,
|
|
129
129
|
"aria-hidden": !0
|
|
130
130
|
}), x ? "Copying…" : `Copy ${g.size || ""} for agent`.trim()]
|
|
@@ -143,9 +143,9 @@ var y = 2500, b = ({ core: a, state: f }) => {
|
|
|
143
143
|
" open comments."
|
|
144
144
|
]
|
|
145
145
|
}),
|
|
146
|
-
/* @__PURE__ */ p(
|
|
146
|
+
/* @__PURE__ */ p(u, {
|
|
147
147
|
className: "ck-dev-export-scroll",
|
|
148
|
-
children: O.length === 0 ? /* @__PURE__ */ p(
|
|
148
|
+
children: O.length === 0 ? /* @__PURE__ */ p(l, {
|
|
149
149
|
className: "ck-dev-export-empty",
|
|
150
150
|
children: "No open stakeholder comments on this project. Comments left in production or staging will show up here for bulk export."
|
|
151
151
|
}) : /* @__PURE__ */ p("ul", {
|
|
@@ -155,7 +155,7 @@ var y = 2500, b = ({ core: a, state: f }) => {
|
|
|
155
155
|
return /* @__PURE__ */ m("li", {
|
|
156
156
|
className: "ck-dev-export-row",
|
|
157
157
|
"data-checked": t,
|
|
158
|
-
children: [/* @__PURE__ */ p(
|
|
158
|
+
children: [/* @__PURE__ */ p(o, {
|
|
159
159
|
checked: t,
|
|
160
160
|
onCheckedChange: () => N(e.id),
|
|
161
161
|
"aria-label": `Select ${e.title}`
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { c as e, f as t, l as n, m as r, p as i, r as a } from "./comment-kit-core-C862uNAm.js";
|
|
2
|
+
import { a as o, i as s, o as c } from "./dom-Bhf4WFtY.js";
|
|
3
|
+
var l = 4e3, u = 500, d = 2e3, f = 1e3, p = 5, m = 25, h = 3145728;
|
|
4
|
+
function g(e) {
|
|
5
|
+
let t = r(e?.comment, d);
|
|
6
|
+
return t.length > 0 ? t : null;
|
|
7
|
+
}
|
|
8
|
+
function _(e) {
|
|
9
|
+
return (e?.attachments ?? []).slice(0, p).flatMap((e) => {
|
|
10
|
+
let t = r(e.name, f), n = r(e.path, f);
|
|
11
|
+
return !t || !n ? [] : [{
|
|
12
|
+
name: t,
|
|
13
|
+
path: n,
|
|
14
|
+
...e.pathSource ? { pathSource: e.pathSource } : {},
|
|
15
|
+
...e.type ? { type: r(e.type, f) } : {},
|
|
16
|
+
...typeof e.size == "number" ? { size: e.size } : {},
|
|
17
|
+
...typeof e.lastModified == "number" ? { lastModified: e.lastModified } : {}
|
|
18
|
+
}];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function v(e) {
|
|
22
|
+
return typeof HTMLElement < "u" && e instanceof HTMLElement;
|
|
23
|
+
}
|
|
24
|
+
function y(e, t, n, i) {
|
|
25
|
+
let a = e.getBoundingClientRect(), c = s(e), d = o(e), f = e.getAttribute("class"), p = e.getAttribute("role"), m = e.getAttribute("aria-label"), h = r(e.textContent, u), g = r(e.outerHTML, l);
|
|
26
|
+
return {
|
|
27
|
+
found: !0,
|
|
28
|
+
tagName: e.tagName.toLowerCase(),
|
|
29
|
+
...e.id ? { id: e.id } : {},
|
|
30
|
+
...f ? { className: f } : {},
|
|
31
|
+
...p ? { role: p } : {},
|
|
32
|
+
...m ? { ariaLabel: m } : {},
|
|
33
|
+
...h ? { text: h } : {},
|
|
34
|
+
rect: {
|
|
35
|
+
top: a.top,
|
|
36
|
+
left: a.left,
|
|
37
|
+
width: a.width,
|
|
38
|
+
height: a.height
|
|
39
|
+
},
|
|
40
|
+
...g ? { htmlPreview: g } : {},
|
|
41
|
+
...c ? { selector: c } : {},
|
|
42
|
+
...d ? { xpath: d } : {},
|
|
43
|
+
...t ? {
|
|
44
|
+
source: b(t),
|
|
45
|
+
stack: n.map(b)
|
|
46
|
+
} : {},
|
|
47
|
+
...i ? { componentName: i } : {}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function b(e) {
|
|
51
|
+
return {
|
|
52
|
+
filePath: e.filePath,
|
|
53
|
+
lineNumber: e.lineNumber,
|
|
54
|
+
columnNumber: e.columnNumber,
|
|
55
|
+
componentName: e.componentName
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function x(e) {
|
|
59
|
+
let t = `${r(e.filePath, 2e3)}${e.lineNumber === null ? "" : `:${e.lineNumber}`}${e.columnNumber === null ? "" : `:${e.columnNumber}`}`;
|
|
60
|
+
return e.componentName ? `${r(e.componentName, 300)} (${t})` : t;
|
|
61
|
+
}
|
|
62
|
+
function S(e, t, n, a, o, s) {
|
|
63
|
+
let c = [
|
|
64
|
+
"# CommentKit Element Grab",
|
|
65
|
+
"",
|
|
66
|
+
i,
|
|
67
|
+
""
|
|
68
|
+
], l = r(t.tagName ?? "element", 100), u = t.id ? `#${r(t.id, 300)}` : "";
|
|
69
|
+
if (c.push(`**Tag:** \`${l}${u}\``), o && c.push(`**Comment:** ${o}`), s.length > 0) {
|
|
70
|
+
c.push("", "**Attachments:**");
|
|
71
|
+
for (let e of s) {
|
|
72
|
+
let t = [
|
|
73
|
+
e.type ? `type: \`${e.type}\`` : null,
|
|
74
|
+
typeof e.size == "number" ? `size: ${e.size} bytes` : null,
|
|
75
|
+
e.pathSource ? `path source: ${e.pathSource}` : null
|
|
76
|
+
].filter(Boolean).join(", ");
|
|
77
|
+
c.push(`- \`${e.name}\` - path: \`${e.path}\`${t ? ` (${t})` : ""}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (t.componentName && c.push(`**Component:** \`${r(t.componentName, 300)}\``), t.source && c.push(`**Source:** ${x(t.source)}`), t.stack && t.stack.length > 1) {
|
|
81
|
+
c.push("", "**Stack:**");
|
|
82
|
+
for (let e of t.stack) c.push(`- ${x(e)}`);
|
|
83
|
+
}
|
|
84
|
+
return t.source || (t.selector && c.push(`**Selector:** \`${r(t.selector, 2e3)}\``), t.xpath && c.push(`**XPath:** \`${r(t.xpath, 2e3)}\``)), c.push(`**Page:** ${r(e.title || "Untitled", 300)} — ${r(e.url || e.path, 4e3)}`), c.push(""), c.push("**HTML:**", "```html", n, "```", ""), a && c.push("**Screenshot:** captured. If no image accompanies this paste, attach it from the export preview.", ""), c.join("\n");
|
|
85
|
+
}
|
|
86
|
+
function C(e) {
|
|
87
|
+
let t = e.element;
|
|
88
|
+
return {
|
|
89
|
+
tagName: t.tagName,
|
|
90
|
+
id: t.id,
|
|
91
|
+
className: t.className,
|
|
92
|
+
textContent: t.text,
|
|
93
|
+
componentName: t.componentName,
|
|
94
|
+
filePath: t.source?.filePath,
|
|
95
|
+
lineNumber: t.source?.lineNumber ?? void 0,
|
|
96
|
+
columnNumber: t.source?.columnNumber ?? void 0,
|
|
97
|
+
comment: e.comment ?? void 0,
|
|
98
|
+
attachments: e.attachments,
|
|
99
|
+
selector: t.selector,
|
|
100
|
+
xpath: t.xpath
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function w(e) {
|
|
104
|
+
if (typeof window > "u" || typeof window.dispatchEvent != "function") return;
|
|
105
|
+
let t = e[0];
|
|
106
|
+
t && window.dispatchEvent(new CustomEvent("commentkit:element-selected", { detail: {
|
|
107
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
108
|
+
page: t.page,
|
|
109
|
+
elements: e.map(C)
|
|
110
|
+
} }));
|
|
111
|
+
}
|
|
112
|
+
async function T(i, o, s, u) {
|
|
113
|
+
if (!i || typeof Element > "u" || !(i instanceof Element) || typeof i.getBoundingClientRect != "function") return null;
|
|
114
|
+
let d = (v(i), i), f = await t(i), p = f?.source ?? null, m = f?.stack ?? [], h = f?.componentName ?? null, b = await a(o, s, d, { reportErrors: !1 }), x = b?.dataUrl ?? null, C = b?.blob ?? null, T = y(i, p, m, h), E = T.htmlPreview ?? r(i.outerHTML, l), D = c(), O = g(u), k = _(u), A = S({
|
|
115
|
+
url: D.url,
|
|
116
|
+
path: D.path,
|
|
117
|
+
title: D.title
|
|
118
|
+
}, T, E, x, O, k);
|
|
119
|
+
try {
|
|
120
|
+
C ? await e(A, C) : await n(A);
|
|
121
|
+
} catch {}
|
|
122
|
+
let j = {
|
|
123
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
124
|
+
page: {
|
|
125
|
+
url: D.url,
|
|
126
|
+
path: D.path,
|
|
127
|
+
title: D.title
|
|
128
|
+
},
|
|
129
|
+
element: T,
|
|
130
|
+
comment: O,
|
|
131
|
+
attachments: k,
|
|
132
|
+
html: E,
|
|
133
|
+
screenshotDataUrl: x,
|
|
134
|
+
markdown: A
|
|
135
|
+
};
|
|
136
|
+
return w([j]), j;
|
|
137
|
+
}
|
|
138
|
+
function E(e, t, n, a) {
|
|
139
|
+
let o = [
|
|
140
|
+
"# CommentKit Element Grab",
|
|
141
|
+
"",
|
|
142
|
+
i,
|
|
143
|
+
"",
|
|
144
|
+
`**Elements:** ${t.length}`,
|
|
145
|
+
`**Page:** ${r(e.title || "Untitled", 300)} — ${r(e.url || e.path, 4e3)}`
|
|
146
|
+
];
|
|
147
|
+
if (n && o.push(`**Comment:** ${n}`), a.length > 0) {
|
|
148
|
+
o.push("", "**Attachments:**");
|
|
149
|
+
for (let e of a) o.push(`- \`${e.name}\` - path: \`${e.path}\`${e.pathSource ? ` (path source: ${e.pathSource})` : ""}`);
|
|
150
|
+
}
|
|
151
|
+
return o.push(""), t.forEach((e, t) => {
|
|
152
|
+
let { element: n } = e, i = r(n.tagName ?? "element", 100), a = n.id ? `#${r(n.id, 300)}` : "";
|
|
153
|
+
o.push(`## [${t + 1}] \`${i}${a}\``), n.componentName && o.push(`- Component: \`${r(n.componentName, 300)}\``), n.source && o.push(`- Source: ${x(n.source)}`), n.stack && n.stack.length > 1 && o.push(`- Stack: ${n.stack.map((e) => r(e.componentName ?? e.filePath, 2e3)).join(" → ")}`), n.source || (n.selector && o.push(`- Selector: \`${r(n.selector, 2e3)}\``), n.xpath && o.push(`- XPath: \`${r(n.xpath, 2e3)}\``)), o.push("", "```html", e.html, "```", ""), e.screenshotDataUrl && o.push(``, "");
|
|
154
|
+
}), o.join("\n");
|
|
155
|
+
}
|
|
156
|
+
async function D(e, i, o, s) {
|
|
157
|
+
let u = e.filter((e) => !!e && typeof Element < "u" && e instanceof Element && typeof e.getBoundingClientRect == "function");
|
|
158
|
+
if (u.length === 0) return null;
|
|
159
|
+
let d = u.slice(0, m);
|
|
160
|
+
u.length > m && typeof console < "u" && console.warn(`[CommentKit] grabElements was called with ${u.length} elements — capped to ${m} for clipboard size. Pass fewer elements to avoid truncation.`);
|
|
161
|
+
let f = [], p = 0, b = 0, x = g(s), C = _(s);
|
|
162
|
+
for (let e of d) {
|
|
163
|
+
let n = (v(e), e), s = await t(e), u = s?.source ?? null, d = s?.stack ?? [], m = s?.componentName ?? null, g = null;
|
|
164
|
+
if (p < h) {
|
|
165
|
+
let e = (await a(i, o, n, { reportErrors: !1 }))?.dataUrl ?? null;
|
|
166
|
+
e && p + e.length <= h ? (g = e, p += e.length) : e && b++;
|
|
167
|
+
} else b++;
|
|
168
|
+
let _ = y(e, u, d, m), w = _.htmlPreview ?? r(e.outerHTML, l), T = c(), E = S({
|
|
169
|
+
url: T.url,
|
|
170
|
+
path: T.path,
|
|
171
|
+
title: T.title
|
|
172
|
+
}, _, w, g, x, C);
|
|
173
|
+
f.push({
|
|
174
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
175
|
+
page: {
|
|
176
|
+
url: T.url,
|
|
177
|
+
path: T.path,
|
|
178
|
+
title: T.title
|
|
179
|
+
},
|
|
180
|
+
element: _,
|
|
181
|
+
comment: x,
|
|
182
|
+
attachments: C,
|
|
183
|
+
html: w,
|
|
184
|
+
screenshotDataUrl: g,
|
|
185
|
+
markdown: E
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
b > 0 && typeof console < "u" && console.warn(`[CommentKit] grabElements dropped ${b} screenshot${b === 1 ? "" : "s"} to stay under the ${Math.round(h / 1024 / 1024)}MB clipboard budget.`);
|
|
189
|
+
let T = c(), D = E({
|
|
190
|
+
url: T.url,
|
|
191
|
+
path: T.path,
|
|
192
|
+
title: T.title
|
|
193
|
+
}, f, x, C);
|
|
194
|
+
try {
|
|
195
|
+
await n(D);
|
|
196
|
+
} catch {}
|
|
197
|
+
let O = {
|
|
198
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
199
|
+
page: {
|
|
200
|
+
url: T.url,
|
|
201
|
+
path: T.path,
|
|
202
|
+
title: T.title
|
|
203
|
+
},
|
|
204
|
+
results: f,
|
|
205
|
+
attachments: C,
|
|
206
|
+
markdown: D
|
|
207
|
+
};
|
|
208
|
+
return w(f), O;
|
|
209
|
+
}
|
|
210
|
+
export { T as grabElement, D as grabElements };
|