@commentkit/comment-kit 1.0.1 → 1.5.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +126 -1
  2. package/README.md +12 -5
  3. package/SECURITY.md +3 -1
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +22 -23
  5. package/dist/npm/chunks/AgentSend-DyWxNQ0p.js +64 -0
  6. package/dist/npm/chunks/Checklist-VYkSl6Q9.js +259 -0
  7. package/dist/npm/chunks/Composer-CnsGQirF.js +679 -0
  8. package/dist/npm/chunks/Guest-DkIvY5zt.js +170 -0
  9. package/dist/npm/chunks/MarkupEditor-DxTI9nJH.js +334 -0
  10. package/dist/npm/chunks/Panel-riaMYxt-.js +863 -0
  11. package/dist/npm/chunks/Settings-CB4zxQAL.js +206 -0
  12. package/dist/npm/chunks/{Shortcuts-3AOERWBh.js → Shortcuts-D1cbajg_.js} +21 -17
  13. package/dist/npm/chunks/StyleEditor-BtTv3I8_.js +44 -0
  14. package/dist/npm/chunks/StylePanel-BI-n5Me1.js +199 -0
  15. package/dist/npm/chunks/TaskFields-HwrD0FrH.js +272 -0
  16. package/dist/npm/chunks/ThreadCard-CjaC8BTa.js +1026 -0
  17. package/dist/npm/chunks/Viewer-BnWshSXb.js +110 -0
  18. package/dist/npm/chunks/agent-Cr6NB6We.js +146 -0
  19. package/dist/npm/chunks/anchor-OCQnjp_6.js +294 -0
  20. package/dist/npm/chunks/{ar-BVQ4ToG2.js → ar-BQ9K9Oqf.js} +188 -7
  21. package/dist/npm/chunks/card-bits-CxteYiZ9.js +126 -0
  22. package/dist/npm/chunks/client-CJ1tpI62.js +754 -0
  23. package/dist/npm/chunks/colors-0Ied7PE2.js +101 -0
  24. package/dist/npm/chunks/confetti-DKeKR7-6.js +41 -0
  25. package/dist/npm/chunks/{de-CamSq76K.js → de-CcPi8xdC.js} +159 -7
  26. package/dist/npm/chunks/drafts-CpQdHhcK.js +51 -0
  27. package/dist/npm/chunks/{es-BBIlcnsU.js → es-DXgkjDCG.js} +159 -7
  28. package/dist/npm/chunks/extension-BIGfr4Gh.js +50 -0
  29. package/dist/npm/chunks/{extension-CLm_T7Vj.js → extension-DkDSW4qw.js} +2 -2
  30. package/dist/npm/chunks/{fr-BXsff0Zz.js → fr-IjJaUbWh.js} +159 -7
  31. package/dist/npm/chunks/{hi-y-APBuxh.js → hi-BhKQK2MU.js} +159 -7
  32. package/dist/npm/chunks/html2canvas-pro.esm-lgs6tb4C.js +8378 -0
  33. package/dist/npm/chunks/i18n-DAJGndZ2.js +904 -0
  34. package/dist/npm/chunks/{it-C5MH_Ktv.js → it-DKiSCkiD.js} +159 -7
  35. package/dist/npm/chunks/{ja-s1JJld2J.js → ja-BI1WagDg.js} +159 -7
  36. package/dist/npm/chunks/{live-CkVrNM1-.js → live-B-mo27Qq.js} +1 -1
  37. package/dist/npm/chunks/lock-C82sC17d.js +30 -0
  38. package/dist/npm/chunks/{nl-CFzRMEfl.js → nl-CJw3VUQ5.js} +159 -7
  39. package/dist/npm/chunks/pick-CYPkLLFJ.js +120 -0
  40. package/dist/npm/chunks/{pt-BR-DE_r-5UM.js → pt-BR-CjBolC5g.js} +159 -7
  41. package/dist/npm/chunks/{pusher-BSsQoE1K.js → realtime-D22tI_AS.js} +58 -4
  42. package/dist/npm/chunks/source-CTQmAh0Y.js +146 -0
  43. package/dist/npm/chunks/src-CgBEoWl0.js +150 -0
  44. package/dist/npm/chunks/start-DW9_DKmf.js +1783 -0
  45. package/dist/npm/chunks/upload-BmrpZE5G.js +42 -0
  46. package/dist/npm/chunks/uploads-CipONvCy.js +541 -0
  47. package/dist/npm/chunks/{zh-CN--gibO2l7.js → zh-CN-BrZGx2S0.js} +159 -7
  48. package/dist/npm/element.js +4 -5
  49. package/dist/npm/headless.js +3 -3
  50. package/dist/npm/index.js +2 -2
  51. package/dist/npm/react.js +1 -1
  52. package/dist/npm/svelte.js +1 -1
  53. package/dist/npm/types/adapters/vue.d.ts +14 -0
  54. package/dist/npm/types/anchor/index.d.ts +22 -1
  55. package/dist/npm/types/core/api.d.ts +3 -0
  56. package/dist/npm/types/core/auth.d.ts +11 -0
  57. package/dist/npm/types/core/client.d.ts +128 -6
  58. package/dist/npm/types/core/types.d.ts +78 -4
  59. package/dist/npm/types/headless.d.ts +1 -1
  60. package/dist/npm/types/index.d.ts +6 -1
  61. package/dist/npm/vue.js +5 -1
  62. package/package.json +6 -3
  63. package/dist/npm/chunks/Guest-CdfnuD8T.js +0 -157
  64. package/dist/npm/chunks/MarkupEditor-Clb17Tse.js +0 -199
  65. package/dist/npm/chunks/Panel-CgvEbZXr.js +0 -438
  66. package/dist/npm/chunks/ThreadCard-DuGKe-gE.js +0 -817
  67. package/dist/npm/chunks/anchor-DT-Ynhh1.js +0 -270
  68. package/dist/npm/chunks/art-Bn9_ANNS.js +0 -155
  69. package/dist/npm/chunks/client-CS5oL_LQ.js +0 -620
  70. package/dist/npm/chunks/colors-CX-IPjvb.js +0 -86
  71. package/dist/npm/chunks/extension-DWHHer7j.js +0 -26
  72. package/dist/npm/chunks/format-CP2xZaec.js +0 -524
  73. package/dist/npm/chunks/html2canvas-DfGb8yka.js +0 -4024
  74. package/dist/npm/chunks/mount-VmnAiANB.js +0 -1507
  75. package/dist/npm/chunks/privacy-DLhezjyi.js +0 -30
  76. package/dist/npm/chunks/realtime-CBRW9BB3.js +0 -34
  77. package/dist/npm/chunks/src-DG8ehgE9.js +0 -549
@@ -1,270 +0,0 @@
1
- function e(e) {
2
- return !!e?.closest("[data-commentkit-host],[data-commentkit-ui]");
3
- }
4
- function t(e) {
5
- let t = n(e.element), i = t.getBoundingClientRect(), s = Math.max(1, i.width), l = Math.max(1, i.height), u = (e) => Math.min(1, Math.max(0, e)), d = e.endX !== void 0 && e.endY !== void 0 && Math.abs(e.endX - e.clientX) > 8 && Math.abs(e.endY - e.clientY) > 8, f = e.quote?.trim() ? e.quote.trim().slice(0, 2e3) : null, p = Math.min(e.clientX, e.endX ?? e.clientX), m = Math.min(e.clientY, e.endY ?? e.clientY);
6
- return {
7
- type: f ? "text" : d ? "region" : "element",
8
- ck_id: t.closest("[data-ck-id]")?.getAttribute("data-ck-id") ?? null,
9
- source: t.closest("[data-ck-src]")?.getAttribute("data-ck-src") ?? null,
10
- selector: r(t),
11
- xpath: a(t),
12
- fingerprint: o(t),
13
- quote: f,
14
- offset: {
15
- x: c(u((e.clientX - i.left) / s)),
16
- y: c(u((e.clientY - i.top) / l))
17
- },
18
- rect: d ? {
19
- x: c(u((p - i.left) / s)),
20
- y: c(u((m - i.top) / l)),
21
- w: c(u(Math.abs((e.endX ?? 0) - e.clientX) / s)),
22
- h: c(u(Math.abs((e.endY ?? 0) - e.clientY) / l))
23
- } : null,
24
- page: {
25
- x: c((e.clientX + scrollX) / Math.max(1, document.documentElement.scrollWidth) * 100, 2),
26
- y: Math.round(e.clientY + scrollY)
27
- }
28
- };
29
- }
30
- function n(t) {
31
- let n = t.closest("a,button,[role=button],input,select,textarea,label,summary");
32
- return n && !e(n) ? n : t;
33
- }
34
- function r(e) {
35
- if (!e.isConnected) return null;
36
- let t = [], n = e;
37
- for (let e = 0; n && n !== document.documentElement && e < 8; e++) {
38
- let e = n.getAttribute("id");
39
- if (e && i(e)) {
40
- t.unshift(`#${CSS.escape(e)}`);
41
- break;
42
- }
43
- let r = [
44
- "data-ck-id",
45
- "data-testid",
46
- "data-test",
47
- "data-cy",
48
- "name"
49
- ].find((e) => n.getAttribute(e));
50
- if (r) {
51
- if (t.unshift(`${n.tagName.toLowerCase()}[${r}="${CSS.escape(n.getAttribute(r))}"]`), r !== "name") break;
52
- n = n.parentElement;
53
- continue;
54
- }
55
- let a = n.tagName.toLowerCase(), o = [...n.classList].filter(i).slice(0, 2);
56
- o.length && (a += o.map((e) => `.${CSS.escape(e)}`).join(""));
57
- let s = n.parentElement;
58
- if (s) {
59
- let e = [...s.children].filter((e) => e.tagName === n.tagName);
60
- e.length > 1 && (a += `:nth-of-type(${e.indexOf(n) + 1})`);
61
- }
62
- t.unshift(a), n = s;
63
- }
64
- return t.length ? t.join(" > ").slice(0, 1e3) : null;
65
- }
66
- function i(e) {
67
- return e.length > 40 || e.length < 2 || /^(css|sc|jsx|emotion|svelte|astro)-[a-z0-9]+$/i.test(e) || /[0-9a-f]{5,}/i.test(e) && /\d/.test(e) || /^[a-z]+_[a-z0-9]{5,}$/i.test(e) || /^(radix|headlessui|react-aria|mui)-/i.test(e) || /:r[0-9a-z]+:/i.test(e) ? !1 : /^[a-zA-Z_][\w-]*$/.test(e);
68
- }
69
- function a(e) {
70
- let t = [], n = e;
71
- for (; n && n.nodeType === 1 && t.length < 30;) {
72
- let e = 1;
73
- for (let t = n.previousElementSibling; t; t = t.previousElementSibling) t.tagName === n.tagName && e++;
74
- t.unshift(`${n.tagName.toLowerCase()}[${e}]`), n = n.parentElement;
75
- }
76
- return t.length ? `/${t.join("/")}`.slice(0, 2e3) : null;
77
- }
78
- function o(e) {
79
- let t = s(e.textContent ?? "").slice(0, 160), n = s(e.getAttribute("aria-label") ?? e.getAttribute("alt") ?? e.getAttribute("placeholder") ?? "") || t;
80
- return n ? `${e.tagName.toLowerCase()}|${n}`.slice(0, 500) : null;
81
- }
82
- function s(e) {
83
- return e.replace(/\s+/g, " ").trim().toLowerCase();
84
- }
85
- function c(e, t = 4) {
86
- let n = 10 ** t;
87
- return Math.round(e * n) / n;
88
- }
89
- function l(e, t = document) {
90
- let n = u(e, t);
91
- if (e.type === "text" && e.quote) {
92
- let t = v(e.quote, n?.element ?? document.body);
93
- if (t) {
94
- let e = t.getBoundingClientRect();
95
- return {
96
- state: n?.state ?? "moved",
97
- element: n?.element ?? t.startContainer.parentElement,
98
- point: {
99
- x: e.left + scrollX,
100
- y: e.top + scrollY
101
- },
102
- rect: {
103
- x: e.left + scrollX,
104
- y: e.top + scrollY,
105
- w: e.width,
106
- h: e.height
107
- }
108
- };
109
- }
110
- }
111
- if (n) {
112
- let t = n.element.getBoundingClientRect(), r = e.offset ?? {
113
- x: .5,
114
- y: .5
115
- }, i = e.rect ? {
116
- x: t.left + scrollX + e.rect.x * t.width,
117
- y: t.top + scrollY + e.rect.y * t.height,
118
- w: e.rect.w * t.width,
119
- h: e.rect.h * t.height
120
- } : null;
121
- return {
122
- state: n.state,
123
- element: n.element,
124
- point: i ? {
125
- x: i.x,
126
- y: i.y
127
- } : {
128
- x: t.left + scrollX + r.x * t.width,
129
- y: t.top + scrollY + r.y * t.height
130
- },
131
- rect: i
132
- };
133
- }
134
- return {
135
- state: "detached",
136
- element: null,
137
- point: {
138
- x: e.page.x / 100 * document.documentElement.scrollWidth,
139
- y: e.page.y
140
- },
141
- rect: null
142
- };
143
- }
144
- function u(t, n) {
145
- let r = (t) => !!t && t.isConnected && !e(t) && _(t);
146
- if (t.ck_id) {
147
- let e = n.querySelector(`[data-ck-id="${CSS.escape(t.ck_id)}"]`);
148
- if (r(e)) return {
149
- element: e,
150
- state: "anchored"
151
- };
152
- }
153
- if (t.source) {
154
- let e = [...n.querySelectorAll(`[data-ck-src="${CSS.escape(t.source)}"]`)].filter(r), i = m(e, t.fingerprint);
155
- if (i) return {
156
- element: i.el,
157
- state: e.length === 1 || i.score > .9 ? "anchored" : "moved"
158
- };
159
- }
160
- if (t.selector) {
161
- let e = [];
162
- try {
163
- e = [...n.querySelectorAll(t.selector)].filter(r);
164
- } catch {}
165
- let i = m(e, t.fingerprint);
166
- if (i && (i.score >= .6 || !t.fingerprint)) return {
167
- element: i.el,
168
- state: i.score >= .9 || !t.fingerprint ? "anchored" : "moved"
169
- };
170
- if (i && e.length === 1 && !t.selector.includes(" > ") && d.test(t.selector)) return {
171
- element: i.el,
172
- state: "moved"
173
- };
174
- }
175
- if (t.xpath) {
176
- let e = g(t.xpath);
177
- if (r(e) && (!t.fingerprint || h(o(e), t.fingerprint) >= .8)) return {
178
- element: e,
179
- state: "moved"
180
- };
181
- }
182
- if (t.fingerprint) {
183
- let [e, i] = p(t.fingerprint);
184
- if (e && /^[a-z0-9]+$/.test(e)) {
185
- let i = m([...n.querySelectorAll(e)].filter(r).slice(0, 2e3), t.fingerprint);
186
- if (i && i.score >= .85) return {
187
- element: i.el,
188
- state: "moved"
189
- };
190
- }
191
- if (i && i.length >= 12) {
192
- let e = [...n.querySelectorAll(f)].filter(r).slice(0, 2e3), t = null;
193
- for (let n of e) {
194
- let e = h(p(o(n) ?? "")[1], i);
195
- e >= .95 && (!t || e > t.score) && (t = {
196
- el: n,
197
- score: e
198
- });
199
- }
200
- if (t) return {
201
- element: t.el,
202
- state: "moved"
203
- };
204
- }
205
- }
206
- return null;
207
- }
208
- var d = /^(#|[a-z0-9]+\[data-(ck-id|testid|test|cy)=)/, f = "h1,h2,h3,h4,h5,h6,p,li,td,th,a,button,label,span,div,section,article,dt,dd,figcaption,blockquote";
209
- function p(e) {
210
- let t = e.indexOf("|");
211
- return t < 0 ? ["", e] : [e.slice(0, t), e.slice(t + 1)];
212
- }
213
- function m(e, t) {
214
- if (!e.length) return null;
215
- if (!t) return {
216
- el: e[0],
217
- score: 1
218
- };
219
- let n = null;
220
- for (let r of e) {
221
- let e = h(o(r), t);
222
- if ((!n || e > n.score) && (n = {
223
- el: r,
224
- score: e
225
- }), e === 1) break;
226
- }
227
- return n;
228
- }
229
- function h(e, t) {
230
- if (!e || !t) return 0;
231
- if (e === t) return 1;
232
- let n = (e) => {
233
- let t = /* @__PURE__ */ new Map();
234
- for (let n = 0; n < e.length - 1; n++) {
235
- let r = e.slice(n, n + 2);
236
- t.set(r, (t.get(r) ?? 0) + 1);
237
- }
238
- return t;
239
- }, r = n(e), i = n(t), a = 0;
240
- for (let [e, t] of r) a += Math.min(t, i.get(e) ?? 0);
241
- let o = Math.max(1, e.length - 1 + (t.length - 1));
242
- return 2 * a / o;
243
- }
244
- function g(e) {
245
- try {
246
- let t = document.evaluate(e, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
247
- return t.singleNodeValue instanceof Element ? t.singleNodeValue : null;
248
- } catch {
249
- return null;
250
- }
251
- }
252
- function _(e) {
253
- let t = e.getBoundingClientRect();
254
- return t.width > 0 || t.height > 0 || typeof navigator < "u" && navigator.userAgent.includes("jsdom");
255
- }
256
- function v(t, n) {
257
- let r = t.replace(/\s+/g, " ").trim();
258
- if (!r) return null;
259
- let i = document.createTreeWalker(n, NodeFilter.SHOW_TEXT, { acceptNode: (t) => e(t.parentElement) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT });
260
- for (let e = i.nextNode(); e; e = i.nextNode()) {
261
- let t = e.textContent ?? "", n = t.indexOf(r.slice(0, Math.min(r.length, 60)));
262
- if (n >= 0) {
263
- let i = document.createRange();
264
- return i.setStart(e, n), i.setEnd(e, Math.min(t.length, n + r.length)), i;
265
- }
266
- }
267
- return null;
268
- }
269
- //#endregion
270
- export { r as i, e as n, l as r, t };
@@ -1,155 +0,0 @@
1
- import { d as e, y as t } from "./format-CP2xZaec.js";
2
- //#region src/ui/art.tsx
3
- var n = "M31.5 4.8C17.3 4.4 7 15.2 7 29c0 13 8.5 21.2 20.9 23 1.6.2 2.1 1.2 2.1 2.5v6.9c0 1.7 1.2 2.1 2.5.9 5.7-4.9 16-13.6 21.1-22.1 3.5-5.8 4.7-11.8 3.2-18.1C54.3 11.5 44.7 4.6 31.5 4.8Z", r = (t, r, i, a) => /* @__PURE__ */ e("path", {
4
- class: a,
5
- d: n,
6
- transform: `translate(${t} ${r}) scale(${i})`
7
- }), i = {
8
- caughtUp: () => /* @__PURE__ */ e(t, { children: [
9
- /* @__PURE__ */ e("path", {
10
- class: "ck-art-w",
11
- d: "M28 50l8-20h48l8 20v18H28z"
12
- }),
13
- /* @__PURE__ */ e("path", {
14
- class: "ck-art-line",
15
- d: "M28 50h19l4 6h18l4-6h19"
16
- }),
17
- r(44, 4, .5, "ck-art-a"),
18
- /* @__PURE__ */ e("path", {
19
- class: "ck-art-tick",
20
- d: "M53 19l5 5 9-10"
21
- })
22
- ] }),
23
- noFeedback: () => /* @__PURE__ */ e(t, { children: [
24
- /* @__PURE__ */ e("rect", {
25
- class: "ck-art-w",
26
- x: "22",
27
- y: "18",
28
- width: "70",
29
- height: "52",
30
- rx: "7"
31
- }),
32
- /* @__PURE__ */ e("path", {
33
- class: "ck-art-line",
34
- d: "M22 29h70"
35
- }),
36
- /* @__PURE__ */ e("circle", {
37
- class: "ck-art-dot",
38
- cx: "29",
39
- cy: "23.5",
40
- r: "1.6"
41
- }),
42
- /* @__PURE__ */ e("circle", {
43
- class: "ck-art-dot",
44
- cx: "35",
45
- cy: "23.5",
46
- r: "1.6"
47
- }),
48
- /* @__PURE__ */ e("rect", {
49
- class: "ck-art-m",
50
- x: "30",
51
- y: "37",
52
- width: "34",
53
- height: "5",
54
- rx: "2.5"
55
- }),
56
- /* @__PURE__ */ e("rect", {
57
- class: "ck-art-m",
58
- x: "30",
59
- y: "47",
60
- width: "46",
61
- height: "5",
62
- rx: "2.5"
63
- }),
64
- /* @__PURE__ */ e("rect", {
65
- class: "ck-art-m",
66
- x: "30",
67
- y: "57",
68
- width: "26",
69
- height: "5",
70
- rx: "2.5"
71
- }),
72
- r(70, 6, .46, "ck-art-a"),
73
- /* @__PURE__ */ e("path", {
74
- class: "ck-art-tick",
75
- d: "M84.5 14v9M80 18.5h9"
76
- })
77
- ] }),
78
- noMatch: () => /* @__PURE__ */ e(t, { children: [
79
- /* @__PURE__ */ e("rect", {
80
- class: "ck-art-m",
81
- x: "22",
82
- y: "22",
83
- width: "52",
84
- height: "6",
85
- rx: "3"
86
- }),
87
- /* @__PURE__ */ e("rect", {
88
- class: "ck-art-m",
89
- x: "22",
90
- y: "36",
91
- width: "40",
92
- height: "6",
93
- rx: "3"
94
- }),
95
- /* @__PURE__ */ e("rect", {
96
- class: "ck-art-m",
97
- x: "22",
98
- y: "50",
99
- width: "46",
100
- height: "6",
101
- rx: "3"
102
- }),
103
- /* @__PURE__ */ e("circle", {
104
- class: "ck-art-w",
105
- cx: "76",
106
- cy: "42",
107
- r: "15"
108
- }),
109
- /* @__PURE__ */ e("path", {
110
- class: "ck-art-line ck-art-bold",
111
- d: "M87 53l11 11"
112
- }),
113
- /* @__PURE__ */ e("path", {
114
- class: "ck-art-line",
115
- d: "M70 42h12"
116
- })
117
- ] }),
118
- error: () => /* @__PURE__ */ e(t, { children: [
119
- r(36, 6, .75, "ck-art-m"),
120
- /* @__PURE__ */ e("path", {
121
- class: "ck-art-line ck-art-bold",
122
- d: "M60 18v14"
123
- }),
124
- /* @__PURE__ */ e("circle", {
125
- class: "ck-art-ink",
126
- cx: "60",
127
- cy: "40",
128
- r: "2.4"
129
- }),
130
- /* @__PURE__ */ e("path", {
131
- class: "ck-art-spark",
132
- d: "M24 22l6 4M22 36h7M96 22l-6 4M98 36h-7"
133
- })
134
- ] }),
135
- gone: () => /* @__PURE__ */ e(t, { children: r(36, 6, .75, "ck-art-ghost") })
136
- };
137
- function a({ name: t }) {
138
- return /* @__PURE__ */ e("svg", {
139
- class: "ck-art",
140
- viewBox: "0 0 120 80",
141
- width: "120",
142
- height: "80",
143
- "aria-hidden": "true",
144
- focusable: "false",
145
- children: [/* @__PURE__ */ e("ellipse", {
146
- class: "ck-art-shadow",
147
- cx: "60",
148
- cy: "74",
149
- rx: "34",
150
- ry: "3.5"
151
- }), i[t]()]
152
- });
153
- }
154
- //#endregion
155
- export { a as t };