@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.
- package/CHANGELOG.md +281 -582
- package/README.md +334 -154
- package/SECURITY.md +47 -46
- package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
- package/dist/node/browser.js +17 -0
- package/dist/node/cli/api.js +226 -0
- package/dist/node/cli/bin.js +18 -0
- package/dist/node/cli/credentials.js +268 -0
- package/dist/node/cli/doctor.js +725 -0
- package/dist/node/cli/format.js +54 -0
- package/dist/node/cli/init.js +372 -0
- package/dist/node/cli/main.js +519 -0
- package/dist/node/cli/mcp.js +114 -0
- package/dist/node/cli/open.js +20 -0
- package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
- package/dist/node/plugins/astro.js +26 -0
- package/dist/node/plugins/git-BIXLbL3f.js +92 -0
- package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
- package/dist/node/plugins/next.js +48 -0
- package/dist/node/plugins/options-THop1K92.js +71 -0
- package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
- package/dist/node/plugins/vite-BdAYUW10.js +74 -0
- package/dist/node/plugins/vite.js +1 -0
- package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
- package/dist/node/plugins/webpack-loader.cjs +21 -0
- package/dist/node/plugins/webpack-loader.js +18 -0
- package/dist/node/plugins/webpack.js +1 -0
- package/dist/node/shared/endpoint.js +26 -0
- package/dist/node/shared/format.js +63 -0
- package/dist/node/types/astro.d.ts +11 -0
- package/dist/node/types/next.d.ts +34 -0
- package/dist/node/types/options.d.ts +59 -0
- package/dist/node/types/vite.d.ts +11 -0
- package/dist/node/types/webpack-loader.d.ts +22 -0
- package/dist/node/types/webpack.d.ts +27 -0
- package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
- package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
- package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
- package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
- package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
- package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
- package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
- package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
- package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
- package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
- package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
- package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
- package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
- package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
- package/dist/npm/chunks/{agent-CqDO3JMA.js → agent-C1OQzBAm.js} +20 -21
- package/dist/npm/chunks/{anchor-OCQnjp_6.js → anchor-BsQNVkHj.js} +109 -87
- package/dist/npm/chunks/{ar-BQ9K9Oqf.js → ar-CAJ3XT8e.js} +73 -20
- package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
- package/dist/npm/chunks/{client-dZeNdizE.js → client-kNAo2TTG.js} +292 -285
- package/dist/npm/chunks/{colors-CAjY4jxf.js → colors-CWAn_swA.js} +1 -2
- package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
- package/dist/npm/chunks/context-B8UAzve0.js +20 -0
- package/dist/npm/chunks/context-BuMl7A07.js +48 -0
- package/dist/npm/chunks/{de-CcPi8xdC.js → de-Dl18G48t.js} +64 -19
- package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
- package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
- package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
- package/dist/npm/chunks/{es-DXgkjDCG.js → es-Dxk79lS9.js} +64 -19
- package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
- package/dist/npm/chunks/{extension-BFkXOmX5.js → extension-E81hWyiT.js} +21 -14
- package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
- package/dist/npm/chunks/{fr-IjJaUbWh.js → fr-8BebGKYD.js} +121 -76
- package/dist/npm/chunks/{hi-BhKQK2MU.js → hi-BIN6Yy_p.js} +65 -20
- package/dist/npm/chunks/{html2canvas-pro.esm-lgs6tb4C.js → html2canvas-pro.esm-B7b8p5Wr.js} +608 -528
- package/dist/npm/chunks/i18n-DOBt8e9U.js +936 -0
- package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
- package/dist/npm/chunks/{it-DKiSCkiD.js → it-Cr6EwpPQ.js} +83 -38
- package/dist/npm/chunks/{ja-BI1WagDg.js → ja-Iy3s5aur.js} +62 -17
- package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
- package/dist/npm/chunks/live-CelVeZfP.js +85 -0
- package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
- package/dist/npm/chunks/{lock-C82sC17d.js → lock-B1JLlOhz.js} +0 -1
- package/dist/npm/chunks/{nl-CJw3VUQ5.js → nl-B84WHqqe.js} +65 -20
- package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
- package/dist/npm/chunks/{pick-dDDLxCDI.js → pick-yTyqtxN0.js} +46 -46
- package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
- package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
- package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
- package/dist/npm/chunks/{pt-BR-CjBolC5g.js → pt-BR-DOkdlfoe.js} +64 -19
- package/dist/npm/chunks/{realtime-D22tI_AS.js → realtime-C79zF50C.js} +16 -15
- package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
- package/dist/npm/chunks/{rolldown-runtime-Y_bBpyJl.js → rolldown-runtime-QGRDbDUS.js} +1 -2
- package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
- package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
- package/dist/npm/chunks/{source-BQS2_xfB.js → source-pXVve2Cx.js} +2 -3
- package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
- package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
- package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
- package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
- package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
- package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
- package/dist/npm/chunks/{zh-CN-BrZGx2S0.js → zh-CN-Z5fQCb7G.js} +63 -18
- package/dist/npm/element.js +59 -23
- package/dist/npm/headless.js +7 -3
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +19 -13
- package/dist/npm/svelte.js +29 -14
- package/dist/npm/types/adapters/react.d.ts +4 -1
- package/dist/npm/types/adapters/svelte.d.ts +4 -1
- package/dist/npm/types/adapters/vue.d.ts +35 -2
- package/dist/npm/types/anchor/index.d.ts +19 -0
- package/dist/npm/types/capture/privacy.d.ts +14 -0
- package/dist/npm/types/core/api.d.ts +20 -1
- package/dist/npm/types/core/auth.d.ts +47 -14
- package/dist/npm/types/core/client.d.ts +60 -4
- package/dist/npm/types/core/page-key.d.ts +42 -0
- package/dist/npm/types/core/types.d.ts +87 -4
- package/dist/npm/types/element.d.ts +17 -7
- package/dist/npm/types/headless.d.ts +2 -1
- package/dist/npm/types/index.d.ts +16 -6
- package/dist/npm/vue.js +45 -11
- package/package.json +95 -21
- package/dist/npm/chunks/AgentSend-DjFZSC0S.js +0 -64
- package/dist/npm/chunks/Checklist-BEz4IZdT.js +0 -259
- package/dist/npm/chunks/Composer-D1wbmdjF.js +0 -681
- package/dist/npm/chunks/Guest-CtyRy8Kz.js +0 -170
- package/dist/npm/chunks/MarkupEditor-CPH4yKx4.js +0 -334
- package/dist/npm/chunks/Panel-DSoUAlbQ.js +0 -863
- package/dist/npm/chunks/Settings-C_qV4n7J.js +0 -206
- package/dist/npm/chunks/Shortcuts-ChnaribX.js +0 -60
- package/dist/npm/chunks/StyleEditor-DqZd6C5o.js +0 -44
- package/dist/npm/chunks/StylePanel-DMC3riYK.js +0 -199
- package/dist/npm/chunks/TaskFields-BfjjllMx.js +0 -272
- package/dist/npm/chunks/ThreadCard-DmKAelSL.js +0 -1026
- package/dist/npm/chunks/Viewer-mw69qSI5.js +0 -110
- package/dist/npm/chunks/card-bits-C7bIk5KX.js +0 -126
- package/dist/npm/chunks/confetti-DKeKR7-6.js +0 -41
- package/dist/npm/chunks/drafts-CpQdHhcK.js +0 -51
- package/dist/npm/chunks/extension-Gvei3opb.js +0 -54
- package/dist/npm/chunks/i18n-DAJGndZ2.js +0 -904
- package/dist/npm/chunks/live-MvvBdoGd.js +0 -34
- package/dist/npm/chunks/report-DoDVi1qT.js +0 -28
- package/dist/npm/chunks/src-C_oUnL0i.js +0 -150
- package/dist/npm/chunks/start-C5-rebEU.js +0 -1783
- package/dist/npm/chunks/upload-CzPAjktW.js +0 -42
- 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 };
|