@commentkit/comment-kit 1.5.1 → 2.0.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 (141) hide show
  1. package/CHANGELOG.md +281 -582
  2. package/README.md +334 -154
  3. package/SECURITY.md +47 -46
  4. package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
  5. package/dist/node/browser.js +17 -0
  6. package/dist/node/cli/api.js +226 -0
  7. package/dist/node/cli/bin.js +18 -0
  8. package/dist/node/cli/credentials.js +268 -0
  9. package/dist/node/cli/doctor.js +725 -0
  10. package/dist/node/cli/format.js +54 -0
  11. package/dist/node/cli/init.js +372 -0
  12. package/dist/node/cli/main.js +519 -0
  13. package/dist/node/cli/mcp.js +114 -0
  14. package/dist/node/cli/open.js +20 -0
  15. package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
  16. package/dist/node/plugins/astro.js +26 -0
  17. package/dist/node/plugins/git-BIXLbL3f.js +92 -0
  18. package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
  19. package/dist/node/plugins/next.js +48 -0
  20. package/dist/node/plugins/options-THop1K92.js +71 -0
  21. package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
  22. package/dist/node/plugins/vite-BdAYUW10.js +74 -0
  23. package/dist/node/plugins/vite.js +1 -0
  24. package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
  25. package/dist/node/plugins/webpack-loader.cjs +21 -0
  26. package/dist/node/plugins/webpack-loader.js +18 -0
  27. package/dist/node/plugins/webpack.js +1 -0
  28. package/dist/node/shared/endpoint.js +26 -0
  29. package/dist/node/shared/format.js +63 -0
  30. package/dist/node/types/astro.d.ts +11 -0
  31. package/dist/node/types/next.d.ts +34 -0
  32. package/dist/node/types/options.d.ts +59 -0
  33. package/dist/node/types/vite.d.ts +11 -0
  34. package/dist/node/types/webpack-loader.d.ts +22 -0
  35. package/dist/node/types/webpack.d.ts +27 -0
  36. package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
  37. package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
  38. package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
  39. package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
  40. package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
  41. package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
  42. package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
  43. package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
  44. package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
  45. package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
  46. package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
  47. package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
  48. package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
  49. package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
  50. package/dist/npm/chunks/{agent-CqDO3JMA.js → agent-C1OQzBAm.js} +20 -21
  51. package/dist/npm/chunks/{anchor-OCQnjp_6.js → anchor-BsQNVkHj.js} +109 -87
  52. package/dist/npm/chunks/{ar-BQ9K9Oqf.js → ar-CAJ3XT8e.js} +73 -20
  53. package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
  54. package/dist/npm/chunks/{client-dZeNdizE.js → client-kNAo2TTG.js} +292 -285
  55. package/dist/npm/chunks/{colors-CAjY4jxf.js → colors-CWAn_swA.js} +1 -2
  56. package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
  57. package/dist/npm/chunks/context-B8UAzve0.js +20 -0
  58. package/dist/npm/chunks/context-BuMl7A07.js +48 -0
  59. package/dist/npm/chunks/{de-CcPi8xdC.js → de-Dl18G48t.js} +64 -19
  60. package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
  61. package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
  62. package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
  63. package/dist/npm/chunks/{es-DXgkjDCG.js → es-Dxk79lS9.js} +64 -19
  64. package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
  65. package/dist/npm/chunks/{extension-BFkXOmX5.js → extension-E81hWyiT.js} +21 -14
  66. package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
  67. package/dist/npm/chunks/{fr-IjJaUbWh.js → fr-8BebGKYD.js} +121 -76
  68. package/dist/npm/chunks/{hi-BhKQK2MU.js → hi-BIN6Yy_p.js} +65 -20
  69. package/dist/npm/chunks/{html2canvas-pro.esm-lgs6tb4C.js → html2canvas-pro.esm-B7b8p5Wr.js} +608 -528
  70. package/dist/npm/chunks/i18n-DOBt8e9U.js +936 -0
  71. package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
  72. package/dist/npm/chunks/{it-DKiSCkiD.js → it-Cr6EwpPQ.js} +83 -38
  73. package/dist/npm/chunks/{ja-BI1WagDg.js → ja-Iy3s5aur.js} +62 -17
  74. package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
  75. package/dist/npm/chunks/live-CelVeZfP.js +85 -0
  76. package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
  77. package/dist/npm/chunks/{lock-C82sC17d.js → lock-B1JLlOhz.js} +0 -1
  78. package/dist/npm/chunks/{nl-CJw3VUQ5.js → nl-B84WHqqe.js} +65 -20
  79. package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
  80. package/dist/npm/chunks/{pick-dDDLxCDI.js → pick-yTyqtxN0.js} +46 -46
  81. package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
  82. package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
  83. package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
  84. package/dist/npm/chunks/{pt-BR-CjBolC5g.js → pt-BR-DOkdlfoe.js} +64 -19
  85. package/dist/npm/chunks/{realtime-D22tI_AS.js → realtime-C79zF50C.js} +16 -15
  86. package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
  87. package/dist/npm/chunks/{rolldown-runtime-Y_bBpyJl.js → rolldown-runtime-QGRDbDUS.js} +1 -2
  88. package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
  89. package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
  90. package/dist/npm/chunks/{source-BQS2_xfB.js → source-pXVve2Cx.js} +2 -3
  91. package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
  92. package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
  93. package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
  94. package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
  95. package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
  96. package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
  97. package/dist/npm/chunks/{zh-CN-BrZGx2S0.js → zh-CN-Z5fQCb7G.js} +63 -18
  98. package/dist/npm/element.js +59 -23
  99. package/dist/npm/headless.js +7 -3
  100. package/dist/npm/index.js +3 -3
  101. package/dist/npm/react.js +19 -13
  102. package/dist/npm/svelte.js +29 -14
  103. package/dist/npm/types/adapters/react.d.ts +4 -1
  104. package/dist/npm/types/adapters/svelte.d.ts +4 -1
  105. package/dist/npm/types/adapters/vue.d.ts +35 -2
  106. package/dist/npm/types/anchor/index.d.ts +19 -0
  107. package/dist/npm/types/capture/privacy.d.ts +14 -0
  108. package/dist/npm/types/core/api.d.ts +20 -1
  109. package/dist/npm/types/core/auth.d.ts +47 -14
  110. package/dist/npm/types/core/client.d.ts +60 -4
  111. package/dist/npm/types/core/page-key.d.ts +42 -0
  112. package/dist/npm/types/core/types.d.ts +87 -4
  113. package/dist/npm/types/element.d.ts +17 -7
  114. package/dist/npm/types/headless.d.ts +2 -1
  115. package/dist/npm/types/index.d.ts +16 -6
  116. package/dist/npm/vue.js +45 -11
  117. package/package.json +95 -21
  118. package/dist/npm/chunks/AgentSend-DjFZSC0S.js +0 -64
  119. package/dist/npm/chunks/Checklist-BEz4IZdT.js +0 -259
  120. package/dist/npm/chunks/Composer-D1wbmdjF.js +0 -681
  121. package/dist/npm/chunks/Guest-CtyRy8Kz.js +0 -170
  122. package/dist/npm/chunks/MarkupEditor-CPH4yKx4.js +0 -334
  123. package/dist/npm/chunks/Panel-DSoUAlbQ.js +0 -863
  124. package/dist/npm/chunks/Settings-C_qV4n7J.js +0 -206
  125. package/dist/npm/chunks/Shortcuts-ChnaribX.js +0 -60
  126. package/dist/npm/chunks/StyleEditor-DqZd6C5o.js +0 -44
  127. package/dist/npm/chunks/StylePanel-DMC3riYK.js +0 -199
  128. package/dist/npm/chunks/TaskFields-BfjjllMx.js +0 -272
  129. package/dist/npm/chunks/ThreadCard-DmKAelSL.js +0 -1026
  130. package/dist/npm/chunks/Viewer-mw69qSI5.js +0 -110
  131. package/dist/npm/chunks/card-bits-C7bIk5KX.js +0 -126
  132. package/dist/npm/chunks/confetti-DKeKR7-6.js +0 -41
  133. package/dist/npm/chunks/drafts-CpQdHhcK.js +0 -51
  134. package/dist/npm/chunks/extension-Gvei3opb.js +0 -54
  135. package/dist/npm/chunks/i18n-DAJGndZ2.js +0 -904
  136. package/dist/npm/chunks/live-MvvBdoGd.js +0 -34
  137. package/dist/npm/chunks/report-DoDVi1qT.js +0 -28
  138. package/dist/npm/chunks/src-C_oUnL0i.js +0 -150
  139. package/dist/npm/chunks/start-C5-rebEU.js +0 -1783
  140. package/dist/npm/chunks/upload-CzPAjktW.js +0 -42
  141. package/dist/npm/chunks/uploads-tpLjiJdH.js +0 -541
@@ -0,0 +1,208 @@
1
+ import { a as e, d as t, i as n, p as r, s as i, t as a } from "./client-kNAo2TTG.js";
2
+ // src/activation.ts
3
+ var o = "commentkit:active", s = "data-commentkit-extension";
4
+ function c() {
5
+ return document.documentElement.hasAttribute(s);
6
+ }
7
+ function l() {
8
+ return /^(127\.0\.0\.1|\[::1\])$|(^|\.)localhost$|\.test$/.test(location.hostname);
9
+ }
10
+ function u(e, t = !0) {
11
+ if (!t || l() || c() || /[?&]ck(_thread|_code)?(=|&|$)/.test(location.href)) return !0;
12
+ try {
13
+ let t = `commentkit:v1:${e}`;
14
+ return !!localStorage.getItem(t) || !!sessionStorage.getItem(t) || localStorage.getItem(o) === "1";
15
+ } catch {
16
+ return !1;
17
+ }
18
+ }
19
+ function d(e) {
20
+ try {
21
+ e ? localStorage.setItem(o, "1") : localStorage.removeItem(o);
22
+ } catch {}
23
+ }
24
+ function f(e, t) {
25
+ let n;
26
+ try {
27
+ let r = t ? location.hash : location.href, i = r.replace(RegExp(`([?#&])ck_${e}=([^&#]*)(&?)`), (e, t, r, i) => (n = r, i && t));
28
+ i != r && history.replaceState(history.state, "", location.href.replace(r, () => i));
29
+ } catch {}
30
+ return n;
31
+ }
32
+ function p(e) {
33
+ let t = (t) => {
34
+ (t.metaKey || t.ctrlKey) && t.shiftKey && /^k$/i.test(t.key) && e() && (t.preventDefault(), t.stopImmediatePropagation());
35
+ };
36
+ return addEventListener("keydown", t, !0), () => removeEventListener("keydown", t, !0);
37
+ }
38
+ var m = "commentkit:crashes";
39
+ function h() {
40
+ try {
41
+ let [e, t] = JSON.parse(localStorage.getItem(m));
42
+ return Date.now() - t < 216e5 ? e : 0;
43
+ } catch {
44
+ return 0;
45
+ }
46
+ }
47
+ // src/index.ts
48
+ var g = null, _ = null, v = null, y = {}, b = Symbol.for("commentkit.instance");
49
+ function x(e, t, ...n) {
50
+ y[e] || (y[e] = 1, console.warn(`[CommentKit] ${t}`, ...n));
51
+ }
52
+ function S(e, ...t) {
53
+ y[e] || (y[e] = 1, import("./show-BgVC8gWY.js").then((n) => n.explain(e, ...t)).catch(T));
54
+ }
55
+ function C() {
56
+ let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
57
+ try {
58
+ let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
59
+ typeof t == "string" && (t = JSON.parse(t));
60
+ let n = t ?? {};
61
+ return {
62
+ branch: e(n.branch),
63
+ commit: e(n.commit)
64
+ };
65
+ } catch {
66
+ return {
67
+ branch: null,
68
+ commit: null
69
+ };
70
+ }
71
+ }
72
+ function w(e) {
73
+ let t = f("signin"), n = f("code", 1);
74
+ if (typeof window > "u") return j(e);
75
+ try {
76
+ let r = t ?? e?._signin;
77
+ if (r != null && (_ = r), v = n ?? e?._finish ?? v, g) return e?.project !== g.project && S("project", e?.project, g.project), g.client.auth.takeSignInLink(_), _ = null, O(g);
78
+ let i = k(e);
79
+ return typeof i == "string" ? j(e, i) : (g = i, O(i));
80
+ } catch (t) {
81
+ return console.warn("[CommentKit] The widget could not start because of an error inside CommentKit; your page is not affected. See https://commentkit.dev/docs/troubleshooting", t), import("./show-BgVC8gWY.js").then((n) => n.reportStart(e, t)).catch(T), j(e);
82
+ }
83
+ }
84
+ var T = () => void 0, E = (e) => (t) => x(e, `${e}() failed.`, t), D = (e, t) => (...n) => t(...n).then(T, E(e));
85
+ function O(e) {
86
+ e.refs++;
87
+ let t = !0, n = /* @__PURE__ */ new Set();
88
+ return {
89
+ ...e.api,
90
+ client: e.client,
91
+ on: ((r, i) => {
92
+ if (!t) return T;
93
+ let a = e.client.on(r, i);
94
+ return n.add(a), a;
95
+ }),
96
+ destroy() {
97
+ t && (t = !1, n.forEach((e) => e()), --e.refs < 1 && e.destroy());
98
+ },
99
+ _m: e.started
100
+ };
101
+ }
102
+ function k(e) {
103
+ if (!e?.project || !t.test(e.project)) return S("key", !!e?.project), "bad project key";
104
+ let o = document;
105
+ if (o[b]) return S("copy", o[b]), "second copy";
106
+ let s = C(), { _key: l, _signin: f, _finish: m, identity: y, ...x } = e, w = {
107
+ ...x,
108
+ ...r(e.branch || s.branch, e.commit || s.commit)
109
+ }, O = new a(w), k = null, A = null, j = !1, M = !1, N = !!l, P = O.auth.takeSignInLink(_) || !!(O.auth.finishLink = v);
110
+ _ = v = null;
111
+ let F = 0, I, L = (e) => (e === !0 && (M = !0), M && k?.attach?.(), j || k ? Promise.resolve() : (A ?? (A = (async (e) => {
112
+ let t = () => e !== F, n = import("./show-BgVC8gWY.js");
113
+ n.catch(T);
114
+ try {
115
+ let e = await O.loadConfig();
116
+ if (t()) return;
117
+ k = await (await n).mount(O, e, P, t, R, y, () => I = setTimeout(L, 6e4)), M && k?.attach?.(), k && N && d(!0);
118
+ } catch (e) {
119
+ await n.then((t) => t.failed(O, e), E("show"));
120
+ } finally {
121
+ t() || (A = null);
122
+ }
123
+ })(F)), A)), R = () => {
124
+ clearTimeout(I), F++, M = !1, A = null, k?.(), k = null;
125
+ }, z = w.toggleShortcut === !1 ? T : p(() => {
126
+ try {
127
+ if (k) return O.state.set({ request: {
128
+ kind: "inbox",
129
+ at: Date.now()
130
+ } }), !0;
131
+ N = !0, L(!0);
132
+ } catch (e) {
133
+ E("shortcut")(e);
134
+ }
135
+ });
136
+ c() && import("./extension-E81hWyiT.js").then((e) => e.extensionHello()).catch(() => void 0);
137
+ let B = P || N || u(w.project, w.hideOnProduction ?? !0) || !!y;
138
+ B && !P && !N && h() >= 3 && (B = !1, S("cooling")), B && !O.auth.hasSession() && O.prefetchSignIn();
139
+ let V = B ? L().then(() => !!k) : Promise.resolve(!1), H = {
140
+ show: () => L(!0),
141
+ hide: R,
142
+ open: D("open", async (e) => {
143
+ O.state.set({ opening: String(e).slice(0, 64) }), await L(!0);
144
+ }),
145
+ comment: D("comment", async (e = !0) => {
146
+ e && (N = !0), await L(e), e && k && d(!0), O.state.set({ request: {
147
+ kind: e ? "comment" : "stop",
148
+ at: Date.now()
149
+ } });
150
+ }),
151
+ signIn: async () => await O.signIn() === "signed_in",
152
+ identify: (e) => import("./identify-CN-3xzqL.js").then((t) => t.identify(O, e, L)).catch(() => !1),
153
+ signOut: D("signOut", () => O.signOut()),
154
+ session: () => i(O.state.get().session)
155
+ };
156
+ Object.defineProperty(o, b, {
157
+ value: n,
158
+ configurable: !0
159
+ });
160
+ let U = {
161
+ project: w.project,
162
+ client: O,
163
+ refs: 0,
164
+ started: V,
165
+ api: H,
166
+ destroy() {
167
+ j = !0, R(), z(), _ = O.auth.signInLink, v = O.auth.finishLink, delete o[b], g === U && (g = null);
168
+ try {
169
+ O.destroy();
170
+ } catch (e) {
171
+ E("destroy")(e);
172
+ }
173
+ }
174
+ };
175
+ return U;
176
+ }
177
+ var A = () => new Proxy(() => Promise.resolve(), { get: (e, t) => t === "then" ? void 0 : t === Symbol.toPrimitive ? () => "" : A() });
178
+ function j(t, n) {
179
+ let r = async () => void 0, i = async () => !1, a = () => T, o = e(), s = t ?? {}, c = {
180
+ options: s,
181
+ state: {
182
+ get: () => o,
183
+ subscribe: a,
184
+ set: T
185
+ },
186
+ on: a,
187
+ emit: T,
188
+ endpoint: String(s.endpoint ?? "https://commentkit.dev").replace(/\/+$/, "")
189
+ };
190
+ return {
191
+ client: new Proxy(c, { get: (e, t) => t in e ? e[t] : t === "then" ? void 0 : A() }),
192
+ show: r,
193
+ hide: T,
194
+ open: r,
195
+ comment: r,
196
+ signIn: i,
197
+ identify: i,
198
+ signOut: r,
199
+ session: () => null,
200
+ on: a,
201
+ destroy: T,
202
+ ...n ? { _r() {
203
+ let e = n && /* @__PURE__ */ Error(`init() stayed off: ${n}`);
204
+ n = void 0, e && import("./show-BgVC8gWY.js").then((n) => n.reportStart(t, e)).catch(T);
205
+ } } : {}
206
+ };
207
+ }
208
+ export { d as a, c as i, m as n, h as r, w as t };