@commentkit/comment-kit 1.6.0 → 2.0.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 +298 -590
- package/README.md +421 -145
- 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 +789 -0
- package/dist/node/cli/format.js +54 -0
- package/dist/node/cli/init.js +686 -0
- package/dist/node/cli/main.js +537 -0
- package/dist/node/cli/mcp.js +295 -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/dashboard-places.js +33 -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-DOy3jhyF.js +68 -0
- package/dist/npm/chunks/Checklist-CW_SwMpS.js +282 -0
- package/dist/npm/chunks/Composer-Bveq5QrK.js +727 -0
- package/dist/npm/chunks/Guest-7hcN765o.js +270 -0
- package/dist/npm/chunks/MarkupEditor-6bJGpWGO.js +345 -0
- package/dist/npm/chunks/Panel-ChPUB68C.js +1211 -0
- package/dist/npm/chunks/Settings-CB5eEKnf.js +231 -0
- package/dist/npm/chunks/Shortcuts-eAyjJ89P.js +62 -0
- package/dist/npm/chunks/StyleEditor-CZTdAA5c.js +46 -0
- package/dist/npm/chunks/StylePanel-B4pHQUL9.js +199 -0
- package/dist/npm/chunks/TaskFields-C8BX0Sgg.js +289 -0
- package/dist/npm/chunks/ThreadCard-B1EsX3PR.js +1160 -0
- package/dist/npm/chunks/Viewer-DY6zb90M.js +114 -0
- package/dist/npm/chunks/{agent-BDMQtOzH.js → agent-MTQHr9ei.js} +9 -9
- package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
- package/dist/npm/chunks/{ar-8tPch6W4.js → ar-L5cQ-NPe.js} +71 -19
- package/dist/npm/chunks/card-bits-CTdrkYn8.js +53 -0
- package/dist/npm/chunks/{client-EFTWxHbJ.js → client-7eVxvg5j.js} +282 -290
- package/dist/npm/chunks/confetti-BIs5s14P.js +49 -0
- package/dist/npm/chunks/context-BuMl7A07.js +48 -0
- package/dist/npm/chunks/context-Cf6khm7A.js +20 -0
- package/dist/npm/chunks/{de-C63897uD.js → de-D0C-v6tP.js} +62 -18
- package/dist/npm/chunks/dialog-DvdIkCW0.js +3 -0
- package/dist/npm/chunks/dpop-0A76OPa9.js +96 -0
- package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
- package/dist/npm/chunks/{es-CI2bSpvB.js → es-Bw4Dj9tN.js} +62 -18
- package/dist/npm/chunks/extension-DFVOvciD.js +62 -0
- package/dist/npm/chunks/{extension-BST6LH1q.js → extension-SmoH5AA4.js} +20 -12
- package/dist/npm/chunks/files-4lV9YQIX.js +114 -0
- package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-TkuQaIAa.js} +120 -76
- package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-DXSH2U8d.js} +63 -19
- package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-aVSu9TcJ.js} +136 -92
- package/dist/npm/chunks/identify-BGYh2dVo.js +106 -0
- package/dist/npm/chunks/{it-C8tnV0BF.js → it-CiWA_bch.js} +81 -37
- package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-C-QmR3yz.js} +60 -16
- package/dist/npm/chunks/late-words-80_VWt8S.js +14 -0
- package/dist/npm/chunks/live-BExWHzQ7.js +85 -0
- package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
- package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-CEmZRqjX.js} +63 -19
- package/dist/npm/chunks/page-key-HSY3Lze5.js +62 -0
- package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-B3sR7jtS.js} +45 -44
- package/dist/npm/chunks/pkce-CfZhiNBi.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-CkG7vpU2.js → pt-BR-b-a8sxO8.js} +62 -18
- package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
- package/dist/npm/chunks/report-DaVuoRYS.js +44 -0
- package/dist/npm/chunks/show-BoN8AC-F.js +97 -0
- package/dist/npm/chunks/signin-BOWr_WCo.js +75 -0
- package/dist/npm/chunks/{source-CS7C6wJA.js → source-mk3rGBBQ.js} +1 -1
- package/dist/npm/chunks/src-C8rZFyL_.js +215 -0
- package/dist/npm/chunks/start-CV4j78_q.js +1894 -0
- package/dist/npm/chunks/states-b9Bv3Ci7.js +3 -0
- package/dist/npm/chunks/upload-B2mkgMeJ.js +42 -0
- package/dist/npm/chunks/uploads-8AxyRq7g.js +1147 -0
- package/dist/npm/chunks/wrap-DW6EFbVQ.js +69 -0
- package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-JTscW8u8.js} +61 -17
- package/dist/npm/element.js +58 -21
- package/dist/npm/headless.js +7 -3
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +18 -11
- package/dist/npm/svelte.js +28 -12
- 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 +40 -21
- 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 +44 -9
- package/package.json +90 -14
- package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
- package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
- package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
- package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
- package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
- package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
- package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
- package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
- package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
- package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
- package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
- package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
- package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
- package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
- package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
- package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
- package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
- package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
- package/dist/npm/chunks/report-BBrT3r89.js +0 -27
- package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
- package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
- package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
- package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { a as e, d as t, i as n, p as r, s as i, t as a } from "./client-7eVxvg5j.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/core/retry-import.ts
|
|
48
|
+
function g(e, t = 2) {
|
|
49
|
+
return e().catch((n) => {
|
|
50
|
+
if (!t) throw n;
|
|
51
|
+
return new Promise((e) => setTimeout(e, 1500 / t)).then(() => g(e, t - 1));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// src/index.ts
|
|
55
|
+
var _ = null, v = null, y = null, b = {}, x = Symbol.for("commentkit.instance");
|
|
56
|
+
function S(e, t, ...n) {
|
|
57
|
+
b[e] || (b[e] = 1, console.warn(`[CommentKit] ${t}`, ...n));
|
|
58
|
+
}
|
|
59
|
+
function C(e, ...t) {
|
|
60
|
+
b[e] || (b[e] = 1, import("./show-BoN8AC-F.js").then((n) => n.explain(e, ...t)).catch(E));
|
|
61
|
+
}
|
|
62
|
+
function w() {
|
|
63
|
+
let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
|
|
64
|
+
try {
|
|
65
|
+
let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
|
|
66
|
+
typeof t == "string" && (t = JSON.parse(t));
|
|
67
|
+
let n = t ?? {};
|
|
68
|
+
return {
|
|
69
|
+
branch: e(n.branch),
|
|
70
|
+
commit: e(n.commit)
|
|
71
|
+
};
|
|
72
|
+
} catch {
|
|
73
|
+
return {
|
|
74
|
+
branch: null,
|
|
75
|
+
commit: null
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function T(e) {
|
|
80
|
+
let t = f("signin"), n = f("code", 1);
|
|
81
|
+
if (typeof window > "u") return M(e);
|
|
82
|
+
try {
|
|
83
|
+
let r = t ?? e?._signin;
|
|
84
|
+
if (r != null && (v = r), y = n ?? e?._finish ?? y, _) return e?.project !== _.project && C("project", e?.project, _.project), _.client.auth.takeSignInLink(v), v = null, k(_);
|
|
85
|
+
let i = A(e);
|
|
86
|
+
return typeof i == "string" ? M(e, i) : (_ = i, k(i));
|
|
87
|
+
} catch (t) {
|
|
88
|
+
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-BoN8AC-F.js").then((n) => n.reportStart(e, t)).catch(E), M(e);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
var E = () => void 0, D = (e) => (t) => S(e, `${e}() failed.`, t), O = (e, t) => (...n) => t(...n).then(E, D(e));
|
|
92
|
+
function k(e) {
|
|
93
|
+
e.refs++;
|
|
94
|
+
let t = !0, n = /* @__PURE__ */ new Set();
|
|
95
|
+
return {
|
|
96
|
+
...e.api,
|
|
97
|
+
client: e.client,
|
|
98
|
+
on: ((r, i) => {
|
|
99
|
+
if (!t) return E;
|
|
100
|
+
let a = e.client.on(r, i);
|
|
101
|
+
return n.add(a), a;
|
|
102
|
+
}),
|
|
103
|
+
destroy() {
|
|
104
|
+
t && (t = !1, n.forEach((e) => e()), --e.refs < 1 && e.destroy());
|
|
105
|
+
},
|
|
106
|
+
_m: e.started
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function A(e) {
|
|
110
|
+
if (!e?.project || !t.test(e.project)) return C("key", !!e?.project), "bad project key";
|
|
111
|
+
let o = document;
|
|
112
|
+
if (o[x]) return C("copy", o[x]), "second copy";
|
|
113
|
+
let s = w(), { _key: l, _signin: f, _finish: m, identity: b, ...S } = e, T = {
|
|
114
|
+
...S,
|
|
115
|
+
...r(e.branch || s.branch, e.commit || s.commit)
|
|
116
|
+
}, k = new a(T), A = null, j = null, M = !1, N = !1, P = !!l, F = k.auth.takeSignInLink(v) || !!(k.auth.finishLink = y);
|
|
117
|
+
v = y = null;
|
|
118
|
+
let I = 0, L, R = (e) => (e === !0 && (N = !0), N && A?.attach?.(), M || A ? Promise.resolve() : (j ?? (j = (async (e) => {
|
|
119
|
+
let t = () => e !== I, n = g(() => import("./show-BoN8AC-F.js"));
|
|
120
|
+
n.catch(E);
|
|
121
|
+
try {
|
|
122
|
+
let e = await k.loadConfig();
|
|
123
|
+
if (t()) return;
|
|
124
|
+
A = await (await n).mount(k, e, F, t, z, b, () => L = setTimeout(R, 6e4)), N && A?.attach?.(), A && P && d(!0);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
await n.then((t) => t.failed(k, e), D("show"));
|
|
127
|
+
} finally {
|
|
128
|
+
t() || (j = null);
|
|
129
|
+
}
|
|
130
|
+
})(I)), j)), z = () => {
|
|
131
|
+
clearTimeout(L), I++, N = !1, j = null, A?.(), A = null;
|
|
132
|
+
}, B = T.toggleShortcut === !1 ? E : p(() => {
|
|
133
|
+
try {
|
|
134
|
+
if (A) return k.state.set({ request: {
|
|
135
|
+
kind: "inbox",
|
|
136
|
+
at: Date.now()
|
|
137
|
+
} }), !0;
|
|
138
|
+
P = !0, R(!0);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
D("shortcut")(e);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
c() && import("./extension-SmoH5AA4.js").then((e) => e.extensionHello()).catch(() => void 0);
|
|
144
|
+
let V = F || P || u(T.project, T.hideOnProduction ?? !0) || !!b;
|
|
145
|
+
V && !F && !P && h() >= 3 && (V = !1, C("cooling")), V && !k.auth.hasSession() && k.prefetchSignIn();
|
|
146
|
+
let H = V ? R().then(() => !!A) : Promise.resolve(!1), U = {
|
|
147
|
+
show: () => R(!0),
|
|
148
|
+
hide: z,
|
|
149
|
+
open: O("open", async (e) => {
|
|
150
|
+
k.state.set({ opening: String(e).slice(0, 64) }), await R(!0);
|
|
151
|
+
}),
|
|
152
|
+
comment: O("comment", async (e = !0) => {
|
|
153
|
+
e && (P = !0), await R(e), e && A && d(!0), k.state.set({ request: {
|
|
154
|
+
kind: e ? "comment" : "stop",
|
|
155
|
+
at: Date.now()
|
|
156
|
+
} });
|
|
157
|
+
}),
|
|
158
|
+
signIn: async () => await k.signIn() === "signed_in",
|
|
159
|
+
identify: (e) => import("./identify-BGYh2dVo.js").then((t) => t.identify(k, e, R)).catch(() => !1),
|
|
160
|
+
signOut: O("signOut", () => k.signOut()),
|
|
161
|
+
session: () => i(k.state.get().session)
|
|
162
|
+
};
|
|
163
|
+
Object.defineProperty(o, x, {
|
|
164
|
+
value: n,
|
|
165
|
+
configurable: !0
|
|
166
|
+
});
|
|
167
|
+
let W = {
|
|
168
|
+
project: T.project,
|
|
169
|
+
client: k,
|
|
170
|
+
refs: 0,
|
|
171
|
+
started: H,
|
|
172
|
+
api: U,
|
|
173
|
+
destroy() {
|
|
174
|
+
M = !0, z(), B(), v = k.auth.signInLink, y = k.auth.finishLink, delete o[x], _ === W && (_ = null);
|
|
175
|
+
try {
|
|
176
|
+
k.destroy();
|
|
177
|
+
} catch (e) {
|
|
178
|
+
D("destroy")(e);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return W;
|
|
183
|
+
}
|
|
184
|
+
var j = () => new Proxy(() => Promise.resolve(), { get: (e, t) => t === "then" ? void 0 : t === Symbol.toPrimitive ? () => "" : j() });
|
|
185
|
+
function M(t, n) {
|
|
186
|
+
let r = async () => void 0, i = async () => !1, a = () => E, o = e(), s = t ?? {}, c = {
|
|
187
|
+
options: s,
|
|
188
|
+
state: {
|
|
189
|
+
get: () => o,
|
|
190
|
+
subscribe: a,
|
|
191
|
+
set: E
|
|
192
|
+
},
|
|
193
|
+
on: a,
|
|
194
|
+
emit: E,
|
|
195
|
+
endpoint: String(s.endpoint ?? "https://commentkit.dev").replace(/\/+$/, "")
|
|
196
|
+
};
|
|
197
|
+
return {
|
|
198
|
+
client: new Proxy(c, { get: (e, t) => t in e ? e[t] : t === "then" ? void 0 : j() }),
|
|
199
|
+
show: r,
|
|
200
|
+
hide: E,
|
|
201
|
+
open: r,
|
|
202
|
+
comment: r,
|
|
203
|
+
signIn: i,
|
|
204
|
+
identify: i,
|
|
205
|
+
signOut: r,
|
|
206
|
+
session: () => null,
|
|
207
|
+
on: a,
|
|
208
|
+
destroy: E,
|
|
209
|
+
...n ? { _r() {
|
|
210
|
+
let e = n && /* @__PURE__ */ Error(`init() stayed off: ${n}`);
|
|
211
|
+
n = void 0, e && import("./show-BoN8AC-F.js").then((n) => n.reportStart(t, e)).catch(E);
|
|
212
|
+
} } : {}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
export { c as a, h as i, g as n, d as o, m as r, T as t };
|