@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
@@ -0,0 +1,146 @@
1
+ import { s as e } from "./client-CJ1tpI62.js";
2
+ //#region src/anchor/source.ts
3
+ var t = /^[A-Za-z_$][\w$.-]*$/, n = /* @__PURE__ */ new Set([
4
+ "src",
5
+ "app",
6
+ "apps",
7
+ "pages",
8
+ "components",
9
+ "lib",
10
+ "packages",
11
+ "resources",
12
+ "routes"
13
+ ]), r = /node_modules|\/\.vite\/|\/_next\/static\/|react-dom|jsx-dev-runtime|jsx-runtime|\/chunk-/, i = 30;
14
+ function a(t) {
15
+ let n = o(t);
16
+ if (!n) return null;
17
+ let r = {}, i = `${n.file}${n.line ? `:${n.line}${n.column ? `:${n.column}` : ""}` : ""}`;
18
+ return n.file && i.length <= 500 && e.test(i) && !t.closest("[data-ck-src]") && (r.source = i), n.component && (r.component = n.component), r.source || r.component ? r : null;
19
+ }
20
+ function o(e) {
21
+ try {
22
+ return d(e) ?? p(e) ?? m(e) ?? h(e);
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+ function s(e) {
28
+ if (typeof e != "string" || !e) return null;
29
+ let t = e.split(/[?#]/)[0];
30
+ try {
31
+ t = decodeURI(t);
32
+ } catch {}
33
+ let r = /^file:/i.test(t);
34
+ t = t.replace(/\\/g, "/").replace(/^[a-z][\w+.-]*:\/\/[^/]*/i, "");
35
+ let i = t.split("/").filter((e) => e && e !== "." && e !== "@fs" && !/^\(.*\)$/.test(e));
36
+ if (!i.length || i.includes("node_modules") || i.includes("..")) return null;
37
+ let a = i.findIndex((e) => n.has(e)), o = r || /^([A-Za-z]:|Users|home|private|var|opt|tmp|mnt|srv|workspace|root)$/.test(i[0]);
38
+ return (a >= 0 ? i.slice(a) : o ? i.slice(-3) : i).join("/").slice(0, 400) || null;
39
+ }
40
+ function c(e, t, n, r) {
41
+ let i = s(e);
42
+ if (!i) return null;
43
+ let a = { file: i }, o = (e) => typeof e == "number" ? e : typeof e == "string" ? Number(e) : NaN, c = o(t), l = o(n);
44
+ return Number.isInteger(c) && c > 0 && (a.line = c, Number.isInteger(l) && l > 0 && (a.column = l)), r && (a.component = r), a;
45
+ }
46
+ function l(e) {
47
+ if (!e || typeof e == "string") return null;
48
+ let n = e, r = [
49
+ n.displayName,
50
+ n.name,
51
+ n.__name,
52
+ n.render?.displayName,
53
+ n.render?.name,
54
+ n.type?.displayName,
55
+ n.type?.name
56
+ ].find((e) => typeof e == "string" && t.test(e));
57
+ return r ? r.slice(0, 120) : null;
58
+ }
59
+ function u(e, t) {
60
+ let n = e;
61
+ for (let e = 0; n && e < i; e++, n = n.parentElement) {
62
+ let e = t(n);
63
+ if (e) return e;
64
+ }
65
+ return null;
66
+ }
67
+ function d(e) {
68
+ let n = u(e, (e) => {
69
+ let t = Object.keys(e).find((e) => e.startsWith("__reactFiber$") || e.startsWith("__reactInternalInstance$"));
70
+ return t ? e[t] : null;
71
+ });
72
+ if (!n || !("_debugOwner" in n) && !n._debugSource && !n._debugStack) return null;
73
+ let r = null, a = n;
74
+ for (let e = 0; a && e < i; e++) {
75
+ let e = a._debugOwner, n = l(e?.type) ?? (typeof e?.name == "string" && t.test(e.name) ? e.name.slice(0, 120) : null) ?? (typeof a.type == "function" ? l(a.type) : null);
76
+ r ?? (r = n);
77
+ let i = a._debugSource, o = i ? c(i.fileName, i.lineNumber, i.columnNumber, n) : f(a._debugStack, n);
78
+ if (o) return o;
79
+ a = e && typeof e == "object" && "tag" in e ? e : a.return;
80
+ }
81
+ return r ? {
82
+ file: "",
83
+ component: r
84
+ } : null;
85
+ }
86
+ function f(e, t) {
87
+ let n = e && typeof e == "object" ? e.stack : e;
88
+ if (typeof n != "string") return null;
89
+ for (let e of n.split("\n").slice(1, 12)) {
90
+ let n = /((?:[a-z][\w+.-]*:\/\/|\/)[^\s()]*?):(\d+):(\d+)\)?\s*$/i.exec(e);
91
+ if (!n || r.test(n[1])) continue;
92
+ let i = c(n[1], n[2], void 0, t);
93
+ if (i) return i;
94
+ }
95
+ return null;
96
+ }
97
+ function p(e) {
98
+ let t = u(e, (e) => e.__vueParentComponent), n = e.closest("[data-v-inspector]")?.getAttribute("data-v-inspector");
99
+ if (!t && !n) return null;
100
+ let r = null;
101
+ for (let e = t, n = 0; e && !r && n < i; n++, e = e.parent) r = l(e.type) ?? g(e.type?.__file);
102
+ let a = n ? /^(.+?)(?::(\d+))?(?::(\d+))?$/.exec(n) : null;
103
+ return (a ? c(a[1], a[2], a[3], r) : null) ?? c(t?.type?.__file, void 0, void 0, r) ?? (r ? {
104
+ file: "",
105
+ component: r
106
+ } : null);
107
+ }
108
+ function m(e) {
109
+ let t = u(e, (e) => e.__svelte_meta)?.loc;
110
+ if (!t) return null;
111
+ let n = typeof t.line == "number" ? t.line + +("char" in t) : void 0, r = typeof t.column == "number" ? t.column + 1 : void 0;
112
+ return c(t.file, n, r, g(t.file));
113
+ }
114
+ function h(e) {
115
+ let t = u(e, (e) => {
116
+ let t = e.__k;
117
+ return t && typeof t == "object" && ("__e" in t || "__k" in t) ? t : null;
118
+ });
119
+ if (!t) return null;
120
+ let n = null, r = [t];
121
+ for (let t = 0; r.length && t < 5e3; t++) {
122
+ let t = r.pop();
123
+ if (t.__e === e && typeof t.type == "string") {
124
+ n = t;
125
+ break;
126
+ }
127
+ if (Array.isArray(t.__k)) for (let e of t.__k) e && typeof e == "object" && r.push(e);
128
+ }
129
+ let a = null, o = null;
130
+ for (let e = n, t = 0; e && t < i; t++, e = e.__) {
131
+ typeof e.type == "function" && (a ?? (a = l(e.type)));
132
+ let t = e.__source;
133
+ if (!o && t && (o = c(t.fileName, t.lineNumber, t.columnNumber)), o && a) break;
134
+ }
135
+ return o && a && (o.component = a), o ?? (a ? {
136
+ file: "",
137
+ component: a
138
+ } : null);
139
+ }
140
+ function g(e) {
141
+ if (typeof e != "string") return null;
142
+ let n = e.split(/[?#]/)[0].split(/[\\/]/).pop()?.replace(/\.[^.]+$/, "") ?? "";
143
+ return t.test(n) ? n.slice(0, 120) : null;
144
+ }
145
+ //#endregion
146
+ export { a as readSource };
@@ -0,0 +1,150 @@
1
+ import { c as e, o as t, p as n, t as r } from "./client-CJ1tpI62.js";
2
+ //#region src/activation.ts
3
+ var i = "commentkit:active", a = "data-commentkit-extension";
4
+ function o() {
5
+ return document.documentElement.hasAttribute(a);
6
+ }
7
+ function s(e = location.origin) {
8
+ let t = new URL(e).hostname;
9
+ return t === "localhost" || t === "127.0.0.1" || t === "[::1]" || t.endsWith(".localhost") || t.endsWith(".test");
10
+ }
11
+ function c(e, t = !0) {
12
+ if (!t || s() || o()) return !0;
13
+ let n = new URLSearchParams(location.search);
14
+ if (n.has("ck") || n.has("ck_thread") || n.has("ck_code")) return !0;
15
+ try {
16
+ let t = `commentkit:v1:${e}`;
17
+ return !!localStorage.getItem(t) || !!sessionStorage.getItem(t) || localStorage.getItem(i) === "1";
18
+ } catch {
19
+ return !1;
20
+ }
21
+ }
22
+ function l(e) {
23
+ try {
24
+ e ? localStorage.setItem(i, "1") : localStorage.removeItem(i);
25
+ } catch {}
26
+ }
27
+ function u(e) {
28
+ let t = (t) => {
29
+ (t.metaKey || t.ctrlKey) && t.shiftKey && t.key.toLowerCase() === "k" && (t.preventDefault(), t.stopImmediatePropagation(), e());
30
+ };
31
+ return addEventListener("keydown", t, !0), () => removeEventListener("keydown", t, !0);
32
+ }
33
+ //#endregion
34
+ //#region src/index.ts
35
+ var d = null;
36
+ function f() {
37
+ let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
38
+ try {
39
+ let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
40
+ if (typeof t == "string" && (t = JSON.parse(t)), !t || typeof t != "object") return {
41
+ branch: null,
42
+ commit: null
43
+ };
44
+ let n = t;
45
+ return {
46
+ branch: e(n.branch),
47
+ commit: e(n.commit)
48
+ };
49
+ } catch {
50
+ return {
51
+ branch: null,
52
+ commit: null
53
+ };
54
+ }
55
+ }
56
+ function p(e) {
57
+ if (d) return d;
58
+ if (typeof window > "u") return g();
59
+ try {
60
+ return m(e);
61
+ } catch (e) {
62
+ return console.warn("[CommentKit] The widget could not start.", e), g();
63
+ }
64
+ }
65
+ function m(i) {
66
+ if (!i?.project || !t.test(i.project)) return console.warn("[CommentKit] init() needs your publishable project key (pk_live_… or pk_test_…). Find it in your CommentKit project under Setup."), g();
67
+ let a = f(), s = {
68
+ ...i,
69
+ ...e(i.branch || a.branch, i.commit || a.commit)
70
+ }, p = new r(s), m = null, _ = null, v = null, y = null, b = h(), x = () => {
71
+ let e = Date.now(), t = () => {
72
+ document.visibilityState === "hidden" || Date.now() - e < 15e3 || (e = Date.now(), p.loadConfig().then((e) => !e.enabled && !b && C(), () => void 0));
73
+ }, n = setInterval(t, 6e4);
74
+ return document.addEventListener("visibilitychange", t), () => {
75
+ clearInterval(n), document.removeEventListener("visibilitychange", t);
76
+ };
77
+ }, S = () => m ? Promise.resolve() : (v ?? (v = (async () => {
78
+ try {
79
+ let e = await p.loadConfig();
80
+ if (!e.enabled && !b) return;
81
+ let t = import("./start-DW9_DKmf.js").then((e) => e.t), n = t.then((e) => e.setLocale(s.locale));
82
+ t.catch(() => void 0), n.catch(() => void 0), await p.auth.completeRedirect().catch(() => !1), o() && await import("./extension-BIGfr4Gh.js").then((e) => e.extensionHandoff(p.auth)).catch(() => !1), await p.loadSession().catch(() => null);
83
+ let { installDiagnostics: r, mountWidget: i } = await t;
84
+ _ = r({
85
+ console: e.features.console_capture,
86
+ network: e.features.network_capture,
87
+ endpoint: p.endpoint
88
+ }), await n, m = i(p, C, () => {
89
+ C(), l(!1);
90
+ }), y = x(), p.emit("ready", { session: p.state.get().session });
91
+ } catch (e) {
92
+ let t = e instanceof n;
93
+ console.warn(t ? `[CommentKit] The widget could not start: ${e.message} (${e.code}). See https://commentkit.dev/docs/errors#${e.code}` : "[CommentKit] The widget could not start.", e), t && p.emit("error", { error: e }), (!t || e.status >= 500) && p.reportCrash(e, "start");
94
+ } finally {
95
+ v = null;
96
+ }
97
+ })()), v), C = () => {
98
+ y?.(), y = null, m?.(), m = null, _?.(), _ = null;
99
+ }, w = u(() => {
100
+ m ? p.state.set({ request: {
101
+ kind: "inbox",
102
+ at: Date.now()
103
+ } }) : (l(!0), S());
104
+ });
105
+ return o() && import("./extension-BIGfr4Gh.js").then((e) => e.extensionHello()).catch(() => void 0), c(s.project, s.hideOnProduction ?? !0) && S(), d = {
106
+ client: p,
107
+ show: S,
108
+ hide: C,
109
+ open: (e) => (p.state.set({ opening: String(e).slice(0, 64) }), S()),
110
+ comment: async (e = !0) => {
111
+ e && l(!0), await S(), p.state.set({ request: {
112
+ kind: e ? "comment" : "stop",
113
+ at: Date.now()
114
+ } });
115
+ },
116
+ signIn: async () => await p.signIn() === "signed_in",
117
+ signOut: () => p.signOut(),
118
+ session: () => p.state.get().session,
119
+ on: (e, t) => p.on(e, t),
120
+ destroy() {
121
+ C(), w(), p.destroy(), d = null;
122
+ }
123
+ }, d;
124
+ }
125
+ function h() {
126
+ let e = new URLSearchParams(location.search);
127
+ if (e.has("ck") || e.has("ck_thread")) return !0;
128
+ try {
129
+ return !!sessionStorage.getItem("commentkit:share");
130
+ } catch {
131
+ return !1;
132
+ }
133
+ }
134
+ function g() {
135
+ let e = async () => void 0;
136
+ return {
137
+ client: void 0,
138
+ show: e,
139
+ hide: () => void 0,
140
+ open: e,
141
+ comment: e,
142
+ signIn: async () => !1,
143
+ signOut: e,
144
+ session: () => null,
145
+ on: () => () => void 0,
146
+ destroy: () => void 0
147
+ };
148
+ }
149
+ //#endregion
150
+ export { o as n, p as t };