@commentkit/comment-kit 1.6.0 → 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 (136) hide show
  1. package/CHANGELOG.md +281 -597
  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-BDMQtOzH.js → agent-C1OQzBAm.js} +9 -9
  51. package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
  52. package/dist/npm/chunks/{ar-8tPch6W4.js → ar-CAJ3XT8e.js} +69 -19
  53. package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
  54. package/dist/npm/chunks/{client-EFTWxHbJ.js → client-kNAo2TTG.js} +282 -290
  55. package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
  56. package/dist/npm/chunks/context-B8UAzve0.js +20 -0
  57. package/dist/npm/chunks/context-BuMl7A07.js +48 -0
  58. package/dist/npm/chunks/{de-C63897uD.js → de-Dl18G48t.js} +60 -18
  59. package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
  60. package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
  61. package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
  62. package/dist/npm/chunks/{es-CI2bSpvB.js → es-Dxk79lS9.js} +60 -18
  63. package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
  64. package/dist/npm/chunks/{extension-BST6LH1q.js → extension-E81hWyiT.js} +20 -12
  65. package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
  66. package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-8BebGKYD.js} +118 -76
  67. package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-BIN6Yy_p.js} +61 -19
  68. package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-DOBt8e9U.js} +91 -56
  69. package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
  70. package/dist/npm/chunks/{it-C8tnV0BF.js → it-Cr6EwpPQ.js} +79 -37
  71. package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-Iy3s5aur.js} +58 -16
  72. package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
  73. package/dist/npm/chunks/live-CelVeZfP.js +85 -0
  74. package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
  75. package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-B84WHqqe.js} +61 -19
  76. package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
  77. package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-yTyqtxN0.js} +45 -44
  78. package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
  79. package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
  80. package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
  81. package/dist/npm/chunks/{pt-BR-CkG7vpU2.js → pt-BR-DOkdlfoe.js} +60 -18
  82. package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
  83. package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
  84. package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
  85. package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
  86. package/dist/npm/chunks/{source-CS7C6wJA.js → source-pXVve2Cx.js} +1 -1
  87. package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
  88. package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
  89. package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
  90. package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
  91. package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
  92. package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
  93. package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-Z5fQCb7G.js} +59 -17
  94. package/dist/npm/element.js +58 -21
  95. package/dist/npm/headless.js +7 -3
  96. package/dist/npm/index.js +3 -3
  97. package/dist/npm/react.js +18 -11
  98. package/dist/npm/svelte.js +28 -12
  99. package/dist/npm/types/adapters/react.d.ts +4 -1
  100. package/dist/npm/types/adapters/svelte.d.ts +4 -1
  101. package/dist/npm/types/adapters/vue.d.ts +35 -2
  102. package/dist/npm/types/anchor/index.d.ts +19 -0
  103. package/dist/npm/types/capture/privacy.d.ts +14 -0
  104. package/dist/npm/types/core/api.d.ts +20 -1
  105. package/dist/npm/types/core/auth.d.ts +40 -21
  106. package/dist/npm/types/core/client.d.ts +60 -4
  107. package/dist/npm/types/core/page-key.d.ts +42 -0
  108. package/dist/npm/types/core/types.d.ts +87 -4
  109. package/dist/npm/types/element.d.ts +17 -7
  110. package/dist/npm/types/headless.d.ts +2 -1
  111. package/dist/npm/types/index.d.ts +16 -6
  112. package/dist/npm/vue.js +44 -9
  113. package/package.json +88 -14
  114. package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
  115. package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
  116. package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
  117. package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
  118. package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
  119. package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
  120. package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
  121. package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
  122. package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
  123. package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
  124. package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
  125. package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
  126. package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
  127. package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
  128. package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
  129. package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
  130. package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
  131. package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
  132. package/dist/npm/chunks/report-BBrT3r89.js +0 -27
  133. package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
  134. package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
  135. package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
  136. package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
@@ -0,0 +1,69 @@
1
+ import { I as e, L as t, P as n, z as r } from "./start-DtVlpt7p.js";
2
+ // src/capture/wrap.ts
3
+ var i = 20, a = 200;
4
+ function o(e) {
5
+ try {
6
+ if (e instanceof Error) return `${e.name}: ${e.message}`.slice(0, 1e3);
7
+ if (typeof e == "string") return e.slice(0, 1e3);
8
+ if (!e || typeof e != "object") return String(e);
9
+ let t = Array.isArray(e), n = t ? Array.from({ length: Math.min(e.length, i) }, (e, t) => t) : Object.keys(e).slice(0, i), r = t ? [] : {};
10
+ for (let t of n) {
11
+ let n = e[t];
12
+ r[t] = typeof n == "string" ? n.slice(0, a) : typeof n == "bigint" ? String(n) : n && typeof n == "object" ? Array.isArray(n) ? "[Array]" : "[Object]" : n;
13
+ }
14
+ return JSON.stringify(r).slice(0, 500);
15
+ } catch {
16
+ return "[unreadable]";
17
+ }
18
+ }
19
+ function s(t, i) {
20
+ try {
21
+ e(n, {
22
+ level: t,
23
+ message: r(i()),
24
+ at: (/* @__PURE__ */ new Date()).toISOString()
25
+ });
26
+ } catch {}
27
+ }
28
+ function c(e) {
29
+ let n = [], r = !0, a = (e, t, r) => {
30
+ let i = e[t], a = r(i);
31
+ e[t] = a, n.push(() => {
32
+ e[t] === a && (e[t] = i);
33
+ });
34
+ };
35
+ if (e.console) {
36
+ for (let e of ["error", "warn"]) a(console, e, (t) => (...n) => {
37
+ r && s(e, () => n.slice(0, i).map(o).join(" ")), t.apply(console, n);
38
+ });
39
+ let e = (e) => s("error", () => e.message || o(e.error)), t = (e) => s("error", () => `Unhandled promise rejection: ${o(e.reason)}`);
40
+ addEventListener("error", e), addEventListener("unhandledrejection", t), n.push(() => removeEventListener("error", e), () => removeEventListener("unhandledrejection", t));
41
+ }
42
+ if (e.network && typeof fetch == "function" && a(window, "fetch", (e) => async (...n) => {
43
+ if (!r) return e(...n);
44
+ let i = performance.now(), a = (n[1]?.method ?? (n[0] instanceof Request ? n[0].method : "GET")).toUpperCase(), o = n[0] instanceof Request ? n[0].url : String(n[0]);
45
+ try {
46
+ let r = await e(...n);
47
+ return r.status >= 400 && t(a, o, r.status, i), r;
48
+ } catch (e) {
49
+ throw t(a, o, 0, i), e;
50
+ }
51
+ }), e.network && typeof XMLHttpRequest == "function") {
52
+ let e = /* @__PURE__ */ new WeakMap();
53
+ a(XMLHttpRequest.prototype, "open", (t) => function(n, i, ...a) {
54
+ return r && e.set(this, {
55
+ method: String(n).toUpperCase(),
56
+ url: String(i)
57
+ }), t.call(this, n, i, ...a);
58
+ }), a(XMLHttpRequest.prototype, "send", (n) => function(i) {
59
+ let a = e.get(this), o = performance.now();
60
+ return a && this.addEventListener("loadend", () => {
61
+ r && (this.status >= 400 || this.status === 0) && t(a.method, a.url, this.status, o);
62
+ }, { once: !0 }), n.call(this, i);
63
+ });
64
+ }
65
+ return () => {
66
+ r = !1, n.forEach((e) => e());
67
+ };
68
+ }
69
+ export { c as wrap };
@@ -17,7 +17,7 @@ var e = {
17
17
  attach: "附加文件",
18
18
  screenshot: "截图",
19
19
  screenshotIncluded: "会自动附上你当前看到的画面截图。",
20
- screenshotRemove: "不附截图",
20
+ screenshotRemove: "移除截图",
21
21
  screenshotAdd: "附上截图",
22
22
  markup: "在截图上标注",
23
23
  markupDone: "标注完成",
@@ -25,7 +25,7 @@ var e = {
25
25
  tool_arrow: "箭头",
26
26
  tool_rect: "方框",
27
27
  tool_pen: "画笔",
28
- tool_blur: "模糊",
28
+ tool_blur: "马赛克",
29
29
  tool_text: "文字",
30
30
  markupTextPrompt: "备注写什么?",
31
31
  undo: "撤销",
@@ -41,8 +41,9 @@ var e = {
41
41
  signIn: "继续",
42
42
  signInMember: "登录",
43
43
  signOut: "退出登录",
44
- popupBlocked: "浏览器拦截了登录窗口。请再点一次按钮,或允许本网站弹出窗口。",
44
+ popupBlocked: "浏览器拦截了登录窗口。请重试,或允许本网站弹出窗口。",
45
45
  signInCancelled: "登录窗口在完成前被关闭了。你的评论还在。",
46
+ insecureContext: "只有在安全地址(https)上才能登录。请向网站团队索取此页面的 https 链接。",
46
47
  sent: "已发送!团队已收到通知。",
47
48
  sentGuest: "已发送!有人回复时我们会发邮件告诉你。",
48
49
  thisPage: "当前页面",
@@ -50,6 +51,7 @@ var e = {
50
51
  notifications: "通知",
51
52
  nothingHere: "这个页面还没有反馈。",
52
53
  nothingHereHint: "点击“评论”,然后点击页面上的任意位置。",
54
+ nothingHereHintTouch: "轻点“评论”,然后轻点页面上的任意位置。",
53
55
  nothingAnywhere: "这个网站还没有反馈。",
54
56
  noMatch: "没有符合搜索或筛选条件的反馈。",
55
57
  clearFilters: "清除筛选",
@@ -67,7 +69,7 @@ var e = {
67
69
  reopen: "重新打开",
68
70
  markInProgress: "开始处理",
69
71
  markInReview: "请求确认",
70
- closeThread: "不做修改直接关闭",
72
+ closeThread: "不修复,直接关闭",
71
73
  reviewAsk: "团队认为已经修好了。你看可以吗?",
72
74
  looksGood: "可以了 — 解决",
73
75
  notYet: "还不行 — 回复",
@@ -92,6 +94,7 @@ var e = {
92
94
  delete: "删除",
93
95
  edit: "编辑",
94
96
  edited: "已编辑",
97
+ teamOnly: "仅团队可见",
95
98
  save: "保存",
96
99
  mute: "关闭通知",
97
100
  unmute: "开启通知",
@@ -105,7 +108,7 @@ var e = {
105
108
  retry: "重试",
106
109
  loadingThread: "正在加载对话…",
107
110
  readOnlyReply: "你可以查看这段对话,但目前无法回复。",
108
- noReplyAccess: "你可以查看这条反馈,但没有回复权限。",
111
+ noReplyAccess: "你可以查看这段对话,但没有回复权限。",
109
112
  notOnPage: "当前页面上找不到",
110
113
  more: "更多",
111
114
  allStatuses: "全部",
@@ -148,6 +151,8 @@ var e = {
148
151
  peopleHere_one: "{n} 人正在查看",
149
152
  markupTextAdd: "添加备注",
150
153
  includeDiagnostics: "附上技术细节,帮助开发者排查",
154
+ diagnosticsSee: "查看包含的内容",
155
+ diagnosticsEmpty: "此页面还没有记录任何内容。",
151
156
  filters: "筛选",
152
157
  assignedToMe: "指派给我",
153
158
  assigneeFilter: "指派给",
@@ -164,10 +169,10 @@ var e = {
164
169
  guestExplain: "我们会通过邮件发送一个 6 位验证码。输入验证码后,你的评论会立即发布。",
165
170
  guestName: "你的姓名",
166
171
  guestEmail: "你的邮箱",
167
- shareExpired: "此客户链接已过期。请向团队索取新链接。",
172
+ shareExpired: "此审阅链接已过期。请向团队索取新链接。",
168
173
  verifyTitle: "请查看邮箱",
169
174
  verifyBody: "输入 6 位验证码即可发布你的评论。验证码已发送至 {email}。",
170
- verifyLookFor: "请查找来自 CommentKit 的邮件:“Your code for {website}”。如果没有收到,请检查垃圾邮件。",
175
+ verifyLookFor: "请查找来自 CommentKit 的邮件:“你在 {website} 的验证码”。如果没有收到,请检查垃圾邮件。",
171
176
  signInLinkTitle: "欢迎回到 {project}",
172
177
  signInLinkBody: "继续即可查看反馈并回复。我们会通过邮件发送一个 6 位验证码,确认是你本人。",
173
178
  notNow: "以后再说",
@@ -176,6 +181,14 @@ var e = {
176
181
  verifyResend: "重新发送验证码",
177
182
  verifyResent: "新的验证码已发送,可能需要一分钟才能收到。",
178
183
  verifyWait: "请等待一分钟后再索取新的验证码。",
184
+ guestCodesPaused: "该网站今天发送的验证码过多。请明天再试,或向团队寻求帮助。",
185
+ notLive: "请选择套餐,才能在正式上线的网站上使用评论。",
186
+ fileImagesOnly: "此网站只接受图片。",
187
+ tooBig: "内容太大,无法发送。请缩短评论,或换一个更小的文件。",
188
+ finishTitle: "发送你的评论?",
189
+ finishBody: "你打开了验证码邮件中的链接。点击按钮,即可发布你在这个网站上写的评论。",
190
+ finishSend: "发送我的评论",
191
+ finishExpired: "这个链接已失效。验证码邮件中的链接只能使用一次,有效期 10 分钟。如果你的评论仍在等待,请在你写评论的页面输入验证码。",
179
192
  verifyWrong: "验证码不正确。请检查邮件,或重新发送验证码。",
180
193
  verifyDifferent: "使用其他邮箱",
181
194
  verifyExpired: "此验证码已无法使用。你的评论仍保存在这台设备上。",
@@ -197,11 +210,12 @@ var e = {
197
210
  resolvedToast: "{ref} 已解决。",
198
211
  undoTooLate: "已无法撤销。如仍需处理,请重新打开 {ref}。",
199
212
  guestIntro: "留下你的姓名和邮箱,方便团队回复你。无需注册账号。",
200
- guestPrivacy: "你的姓名、邮箱和评论会发送给运营本网站的团队,以及为该团队提供此评论工具的 CommentKit。",
213
+ guestPrivacy: "你的姓名、邮箱、评论、截图和基本的浏览器信息会发送给运营本网站的团队,以及为该团队提供此评论工具的 CommentKit。",
201
214
  guestPrivacyLink: "隐私声明",
215
+ guestPrivacySite: "{website} 的隐私声明",
202
216
  guestNameMissing: "请填写姓名,让团队知道是谁写的。",
203
217
  guestEmailInvalid: "请检查邮箱地址,例如 name@company.com。",
204
- verifyLinkExpired: "此客户链接已过期。请向发送链接的人索取新链接。你的评论已保存在这台设备上。",
218
+ verifyLinkExpired: "此审阅链接已过期。请向发送链接的人索取新链接。你的评论已保存在这台设备上。",
205
219
  verifyRemoved: "团队已移除你对此网站的访问权限。请让他们重新添加你。",
206
220
  writeAgain: "重新填写",
207
221
  pendingNote: "你的评论正在等待我们发送到 {email} 的验证码。",
@@ -211,12 +225,13 @@ var e = {
211
225
  serverError: "CommentKit 出了点问题。请稍后重试。",
212
226
  noAccess: "你无权查看此网站上的反馈。请让团队重新邀请你。",
213
227
  originNotAllowed: "暂时无法从这个网址发送反馈。请让团队把它添加到项目中。",
214
- forbidden: "你没有权限执行此操作。",
228
+ forbidden: "你没有权限执行此操作。如有需要,请联系团队。",
215
229
  tooFast: "操作太频繁了。请稍等片刻再试。",
216
230
  sentWithoutScreenshot: "已发送,但没有附上截图:截图未能上传。",
217
231
  sentWithoutFiles: "已发送,但有些文件没能附加。你可以在回复中再附加。",
218
232
  replyFailed: "你的回复还没有发送。内容仍在这里,可以再试一次。",
219
233
  taskDetails: "任务详情",
234
+ taskDetailsSet: "已添加任务详情",
220
235
  priority: "优先级",
221
236
  priority_none: "无优先级",
222
237
  priority_low: "低",
@@ -235,9 +250,9 @@ var e = {
235
250
  formatCode: "代码",
236
251
  reopenedToast: "{ref} 已重新打开。",
237
252
  editedToast: "评论已更新。",
238
- editConflict: "刚刚有人修改了此内容,已刷新。",
253
+ editConflict: "刚刚有人编辑了此内容。现在显示的是对方的版本,请重新修改。",
239
254
  threadDeleted: "{ref} 已删除。",
240
- detailCreated: "留下时间",
255
+ detailCreated: "发布时间",
241
256
  detailResolved: "解决时间",
242
257
  detailPage: "页面",
243
258
  detailBrowser: "浏览器",
@@ -263,8 +278,9 @@ var e = {
263
278
  results_one: "{n} 个结果",
264
279
  results: "{n} 个结果",
265
280
  resultsMore: "{n}+ 个结果",
281
+ firstPageThreads: "显示此页面上的前 {n} 条评论",
266
282
  showMore: "显示更多",
267
- livePaused: "实时更新已暂停。重新连接或刷新页面后会显示新的反馈。",
283
+ livePaused: "连接已断开。重新连接后会显示新的反馈。",
268
284
  clearSearch: "清除搜索",
269
285
  filtersOn_one: "已启用 {n} 个筛选条件",
270
286
  filtersOn: "已启用 {n} 个筛选条件",
@@ -297,6 +313,7 @@ var e = {
297
313
  nextImage: "下一张图片",
298
314
  attachments: "附件",
299
315
  openImage: "打开 {name}",
316
+ openImageMore: "打开 {name} 及另外 {n} 张",
300
317
  uploading: "正在上传 {name}",
301
318
  retryUpload: "重新上传 {name}",
302
319
  uploadFailedShort: "这个文件没有上传成功。",
@@ -316,7 +333,7 @@ var e = {
316
333
  checklist: "清单",
317
334
  description: "描述",
318
335
  checklistProgress: "已完成 {n}/{total}",
319
- checklistAdd: "添加一项,然后按 Enter",
336
+ checklistAdd: "添加一项",
320
337
  removeItem: "移除 {item}",
321
338
  addChecklist: "添加清单",
322
339
  checklistShort_one: "已完成 {done}/{n}",
@@ -337,8 +354,8 @@ var e = {
337
354
  previousThread: "上一条",
338
355
  nextThread: "下一条",
339
356
  showOnPage: "在页面上显示",
340
- doubleClickHint: "在收件箱外双击即可关闭,或按 Esc。",
341
- spot_element: "在某个元素上",
357
+ doubleClickHint: "按 Esc 或双击页面即可关闭收件箱。",
358
+ spot_element: "在页面某处",
342
359
  spot_region: "在某个区域上",
343
360
  spot_text: "在选中的文字上",
344
361
  spot_page: "在整个页面上",
@@ -361,6 +378,31 @@ var e = {
361
378
  styleDone: "完成",
362
379
  stylePrevious: "{property} 的上一个值",
363
380
  styleNext: "{property} 的下一个值",
364
- styleEdit: "编辑建议的样式更改"
381
+ styleEdit: "编辑建议的样式更改",
382
+ shortcutsSetting: "单键快捷键",
383
+ shortcutsSettingHint: "使用 C、J、K、E 和 ? 键可评论、在评论之间切换并解决评论。如果它们干扰屏幕阅读器或其他工具,请关闭此项。",
384
+ movePin: "移动标记",
385
+ movePinHint: "点击此评论的新位置,或按 Tab 移到该处后按 Enter · 按 Esc 取消",
386
+ movePinHintTouch: "轻点此评论的新位置",
387
+ unread: "未读",
388
+ otherKind: "{actor} 更新了此内容",
389
+ unitKB: "{n} KB",
390
+ unitMB: "{n} MB",
391
+ unitGB: "{n} GB",
392
+ signOff: "页面审批",
393
+ signOffAsk: "对这个页面满意吗?",
394
+ signOffApprove: "批准此页面",
395
+ signOffAgain: "再次批准",
396
+ signOffNote: "添加备注(可选)",
397
+ signOffDone: "已批准。团队已收到通知。",
398
+ signOffMine: "你已于 {date} 批准此页面。",
399
+ signOffBy: "{name} 已批准",
400
+ signOffByMore: "{name} 和另外 {n} 人已批准",
401
+ signOffByMore_one: "{name} 和另外 {n} 人已批准",
402
+ signOffNewFeedback: "批准之后又收到了新的反馈。",
403
+ signOffNewCommit: "批准之后此页面已有改动。",
404
+ signOffOpen: "此页面还有 {n} 条评论未解决。你仍然可以批准。",
405
+ signOffOpen_one: "此页面还有 {n} 条评论未解决。你仍然可以批准。",
406
+ signOffWithdraw: "撤回批准"
365
407
  };
366
408
  export { e as default };
@@ -1,33 +1,70 @@
1
- import { t as e } from "./chunks/src-C4FsVoUp.js";
1
+ import { t as e } from "./chunks/src-BTMy4Gyc.js";
2
2
  // src/element.ts
3
- var t, n = class extends HTMLElement {
3
+ var t, n = [
4
+ "screenshots",
5
+ "markup",
6
+ "text",
7
+ "attachments",
8
+ "style",
9
+ "checklist"
10
+ ], r = [
11
+ "project",
12
+ "branch",
13
+ "commit",
14
+ "endpoint",
15
+ "locale",
16
+ "theme",
17
+ "position",
18
+ "auth",
19
+ "deployment-url",
20
+ "hide-on-production",
21
+ "shortcuts",
22
+ "toggle-shortcut",
23
+ "privacy",
24
+ "redact",
25
+ "tools-off"
26
+ ], i = typeof HTMLElement > "u" ? class {} : HTMLElement, a = class extends i {
4
27
  constructor(...e) {
5
- super(...e), this.kit = null;
28
+ super(...e), this.kit = null, this.started = "";
6
29
  }
7
30
  attributeChangedCallback(e, t, n) {
8
- t !== n && this.isConnected && (this.disconnectedCallback(), this.connectedCallback());
31
+ t !== n && this.isConnected && this.connectedCallback();
9
32
  }
10
33
  connectedCallback() {
11
34
  try {
12
- let t = this.getAttribute("project");
13
- if (!t) return;
14
- this.kit = e({
15
- project: t,
16
- branch: this.getAttribute("branch"),
17
- commit: this.getAttribute("commit"),
18
- endpoint: this.getAttribute("endpoint") ?? void 0,
19
- locale: this.getAttribute("locale") ?? void 0,
20
- theme: this.getAttribute("theme") ?? void 0,
21
- position: this.getAttribute("position") ?? void 0,
22
- auth: this.getAttribute("auth") ?? void 0,
23
- deploymentUrl: this.getAttribute("deployment-url"),
24
- hideOnProduction: this.getAttribute("hide-on-production") !== "false",
25
- shortcuts: this.getAttribute("shortcuts") !== "false"
26
- });
35
+ let t = this.getAttribute("project"), n = t ? this.options(t) : null, r = JSON.stringify(n);
36
+ if (this.kit && r === this.started || (this.disconnectedCallback(), !n)) return;
37
+ this.started = r, this.kit = e(n);
27
38
  } catch (e) {
28
39
  console.warn("[CommentKit] The widget could not start.", e);
29
40
  }
30
41
  }
42
+ options(e) {
43
+ let t = this.getAttribute("redact")?.trim(), r = (this.getAttribute("tools-off") ?? "").split(/\s+/).filter((e) => n.includes(e));
44
+ return {
45
+ project: e,
46
+ branch: this.getAttribute("branch"),
47
+ commit: this.getAttribute("commit"),
48
+ endpoint: this.getAttribute("endpoint") ?? void 0,
49
+ locale: this.getAttribute("locale") ?? void 0,
50
+ theme: this.getAttribute("theme") ?? void 0,
51
+ position: this.getAttribute("position") ?? void 0,
52
+ auth: this.getAttribute("auth") ?? void 0,
53
+ deploymentUrl: this.getAttribute("deployment-url"),
54
+ hideOnProduction: this.getAttribute("hide-on-production") !== "false",
55
+ shortcuts: this.getAttribute("shortcuts") !== "false",
56
+ toggleShortcut: this.getAttribute("toggle-shortcut") !== "false",
57
+ privacy: this.getAttribute("privacy") === "strict" ? "strict" : void 0,
58
+ redact: t ? [t] : void 0,
59
+ tools: r.length ? Object.fromEntries(r.map((e) => [e, !1])) : void 0
60
+ };
61
+ }
62
+ identify(e) {
63
+ return this.kit?.identify(e) ?? Promise.resolve(!1);
64
+ }
65
+ signOut() {
66
+ return this.kit?.signOut() ?? Promise.resolve();
67
+ }
31
68
  disconnectedCallback() {
32
69
  try {
33
70
  this.kit?.destroy();
@@ -35,5 +72,5 @@ var t, n = class extends HTMLElement {
35
72
  this.kit = null;
36
73
  }
37
74
  };
38
- t = n, t.observedAttributes = ["project"], typeof customElements < "u" && !customElements.get("comment-kit") && customElements.define("comment-kit", n);
39
- export { n as CommentKitElement };
75
+ t = a, t.observedAttributes = r, typeof customElements < "u" && !customElements.get("comment-kit") && customElements.define("comment-kit", a);
76
+ export { a as CommentKitElement };
@@ -1,3 +1,7 @@
1
- import { f as e, i as t, l as n, n as r, p as i, r as a, t as o } from "./chunks/client-EFTWxHbJ.js";
2
- import { a as s, o as c, t as l } from "./chunks/anchor-BsradQhn.js";
3
- export { e as ApiClient, n as AuthManager, o as CommentKitClient, i as CommentKitError, r as EDIT_CONFLICT, a as SDK_VERSION, l as createAnchor, t as currentPageUrl, s as resolveAnchor, c as stableSelector };
1
+ import { h as e, i as t, l as n, m as r, o as i, r as a, t as o, v as s } from "./chunks/client-kNAo2TTG.js";
2
+ import { i as c } from "./chunks/privacy-BWUGlHw5.js";
3
+ import { c as l, s as u, t as d } from "./chunks/anchor-BsQNVkHj.js";
4
+ import { n as f } from "./chunks/context-BuMl7A07.js";
5
+ import { n as p, t as m } from "./chunks/page-key-DepmJzC1.js";
6
+ f(), n(p);
7
+ export { e as ApiClient, r as AuthManager, o as CommentKitClient, s as CommentKitError, a as EDIT_CONFLICT, t as SDK_VERSION, c as configurePrivacy, d as createAnchor, i as currentPageUrl, m as pageKey, u as resolveAnchor, l as stableSelector };
package/dist/npm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./chunks/src-C4FsVoUp.js";
2
- import { p as t, r as n } from "./chunks/client-EFTWxHbJ.js";
3
- export { t as CommentKitError, n as SDK_VERSION, e as init };
1
+ import { t as e } from "./chunks/src-BTMy4Gyc.js";
2
+ import { i as t, v as n } from "./chunks/client-kNAo2TTG.js";
3
+ export { n as CommentKitError, t as SDK_VERSION, e as init };
package/dist/npm/react.js CHANGED
@@ -1,14 +1,16 @@
1
1
  "use client";
2
- import { t as e } from "./chunks/src-C4FsVoUp.js";
3
- import { useEffect as t } from "react";
2
+ import { t as e } from "./chunks/src-BTMy4Gyc.js";
3
+ import { useEffect as t, useRef as n } from "react";
4
4
  // src/adapters/react.tsx
5
- function n(n) {
5
+ function r(r) {
6
+ let i = n(null), a = n(r.identity);
6
7
  return t(() => {
7
8
  try {
8
- let t = e(n);
9
+ a.current = r.identity;
10
+ let t = i.current = e(r);
9
11
  return () => {
10
12
  try {
11
- t.destroy();
13
+ i.current === t && (i.current = null), t.destroy();
12
14
  } catch {}
13
15
  };
14
16
  } catch (e) {
@@ -16,10 +18,15 @@ function n(n) {
16
18
  return;
17
19
  }
18
20
  }, [
19
- n.project,
20
- n.branch,
21
- n.commit,
22
- n.endpoint
23
- ]), null;
21
+ r.project,
22
+ r.branch,
23
+ r.commit,
24
+ r.endpoint,
25
+ r.privacy,
26
+ r.toggleShortcut
27
+ ]), t(() => {
28
+ let e = r.identity;
29
+ e !== a.current && (a.current = e, typeof e == "string" && e && i.current?.identify(e));
30
+ }, [r.identity]), null;
24
31
  }
25
- export { n as CommentKit, n as default, e as init };
32
+ export { r as CommentKit, r as default, e as init };
@@ -1,16 +1,32 @@
1
- import { t as e } from "./chunks/src-C4FsVoUp.js";
1
+ import { t as e } from "./chunks/src-BTMy4Gyc.js";
2
2
  // src/adapters/svelte.ts
3
- function t(t, n) {
4
- let r = null;
5
- try {
6
- r = e(n);
7
- } catch (e) {
8
- console.warn("[CommentKit] The widget could not start.", e);
9
- }
10
- return { destroy: () => {
3
+ var t = (e) => JSON.stringify([
4
+ e?.project,
5
+ e?.branch,
6
+ e?.commit,
7
+ e?.endpoint,
8
+ e?.privacy,
9
+ e?.toggleShortcut
10
+ ]);
11
+ function n(n, r) {
12
+ let i = null, a = t(r), o = r?.identity, s = (t) => {
11
13
  try {
12
- r?.destroy();
14
+ i = e(t);
15
+ } catch (e) {
16
+ console.warn("[CommentKit] The widget could not start.", e);
17
+ }
18
+ }, c = () => {
19
+ try {
20
+ i?.destroy();
13
21
  } catch {}
14
- } };
22
+ i = null;
23
+ };
24
+ return s(r), {
25
+ update: (e) => {
26
+ let n = t(e), r = e?.identity, l = r !== o;
27
+ o = r, n === a ? l && typeof r == "string" && r && i?.identify(r) : (a = n, c(), s(e));
28
+ },
29
+ destroy: c
30
+ };
15
31
  }
16
- export { t as commentkit, e as init };
32
+ export { n as commentkit, e as init };
@@ -4,7 +4,10 @@ import { init, type CommentKitOptions } from "../index.js";
4
4
  * <CommentKit project="pk_live_…" branch={process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF} />
5
5
  * Renders nothing itself; the widget lives in its own Shadow DOM.
6
6
  * Never throws into your app: a failure is one console warning.
7
- * Options are read when it mounts; changing project, branch, commit or endpoint restarts it.
7
+ * Every init() option is a prop (privacy="strict", toggleShortcut={false}, redact, tools…), read when it
8
+ * mounts; changing project, branch, commit, endpoint, privacy or toggleShortcut restarts it.
9
+ * `identity` signs your site's user in (a token from your server, or a function fetching one); a new token
10
+ * string later (another user logged in) signs that user in without a restart.
8
11
  */
9
12
  export declare function CommentKit(props: CommentKitOptions): null;
10
13
  export default CommentKit;
@@ -1,9 +1,12 @@
1
1
  import { init, type CommentKitOptions } from "../index.js";
2
2
  /**
3
3
  * Svelte / SvelteKit: <svelte:body use:commentkit={{ project: "pk_live_…" }} />
4
- * or call init() inside onMount. Never throws into your app.
4
+ * or call init() inside onMount; every init() option works (privacy, toggleShortcut, redact, identity…). Never
5
+ * throws into your app. Changing project, branch, commit, endpoint, privacy or toggleShortcut restarts it; a new
6
+ * `identity` token string signs that user in without a restart.
5
7
  */
6
8
  export declare function commentkit(_node: HTMLElement, options: CommentKitOptions): {
9
+ update: (next: CommentKitOptions) => void;
7
10
  destroy: () => void;
8
11
  };
9
12
  export { init };
@@ -1,6 +1,10 @@
1
1
  import { type App, type PropType } from "vue";
2
2
  import { init, type CommentKitOptions } from "../index.js";
3
- /** <CommentKit project="pk_live_…" /> — or app.use(CommentKitPlugin, { project }) */
3
+ /**
4
+ * <CommentKit project="pk_live_…" /> — or app.use(CommentKitPlugin, { project }).
5
+ * `:identity` signs your site's user in (a token from your server, or a function fetching one); a new
6
+ * token string later signs that user in without a restart.
7
+ */
4
8
  export declare const CommentKit: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
9
  project: {
6
10
  type: StringConstructor;
@@ -38,6 +42,10 @@ export declare const CommentKit: import("vue").DefineComponent<import("vue").Ext
38
42
  type: PropType<string[]>;
39
43
  default: undefined;
40
44
  };
45
+ privacy: {
46
+ type: PropType<CommentKitOptions["privacy"]>;
47
+ default: undefined;
48
+ };
41
49
  locale: {
42
50
  type: StringConstructor;
43
51
  default: undefined;
@@ -50,10 +58,18 @@ export declare const CommentKit: import("vue").DefineComponent<import("vue").Ext
50
58
  type: BooleanConstructor;
51
59
  default: undefined;
52
60
  };
61
+ toggleShortcut: {
62
+ type: BooleanConstructor;
63
+ default: undefined;
64
+ };
53
65
  tools: {
54
66
  type: PropType<CommentKitOptions["tools"]>;
55
67
  default: undefined;
56
68
  };
69
+ identity: {
70
+ type: PropType<CommentKitOptions["identity"]>;
71
+ default: undefined;
72
+ };
57
73
  }>, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
58
74
  project: {
59
75
  type: StringConstructor;
@@ -91,6 +107,10 @@ export declare const CommentKit: import("vue").DefineComponent<import("vue").Ext
91
107
  type: PropType<string[]>;
92
108
  default: undefined;
93
109
  };
110
+ privacy: {
111
+ type: PropType<CommentKitOptions["privacy"]>;
112
+ default: undefined;
113
+ };
94
114
  locale: {
95
115
  type: StringConstructor;
96
116
  default: undefined;
@@ -103,10 +123,18 @@ export declare const CommentKit: import("vue").DefineComponent<import("vue").Ext
103
123
  type: BooleanConstructor;
104
124
  default: undefined;
105
125
  };
126
+ toggleShortcut: {
127
+ type: BooleanConstructor;
128
+ default: undefined;
129
+ };
106
130
  tools: {
107
131
  type: PropType<CommentKitOptions["tools"]>;
108
132
  default: undefined;
109
133
  };
134
+ identity: {
135
+ type: PropType<CommentKitOptions["identity"]>;
136
+ default: undefined;
137
+ };
110
138
  }>> & Readonly<{}>, {
111
139
  branch: string | null;
112
140
  commit: string | null;
@@ -116,17 +144,22 @@ export declare const CommentKit: import("vue").DefineComponent<import("vue").Ext
116
144
  theme: "auto" | "dark" | "light" | undefined;
117
145
  position: import("../index.js").Position | undefined;
118
146
  redact: string[];
147
+ privacy: "standard" | "strict" | undefined;
119
148
  locale: string;
120
149
  auth: "auto" | "popup" | "redirect" | undefined;
121
150
  shortcuts: boolean;
151
+ toggleShortcut: boolean;
122
152
  tools: {
123
153
  screenshots?: boolean;
124
154
  markup?: boolean;
125
155
  text?: boolean;
126
156
  attachments?: boolean;
157
+ style?: boolean;
158
+ checklist?: boolean;
127
159
  } | undefined;
160
+ identity: import("../index.js").IdentitySource | undefined;
128
161
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
129
162
  export declare const CommentKitPlugin: {
130
- install(_app: App, options: CommentKitOptions): void;
163
+ install(app: App, options: CommentKitOptions): void;
131
164
  };
132
165
  export { init };
@@ -52,7 +52,26 @@ export interface AnchorInput {
52
52
  export declare function rectOf(node: Node, r?: DOMRect): DOMRect;
53
53
  export declare function createAnchor(input: AnchorInput): Anchor;
54
54
  export declare function stableSelector(el: Element): string | null;
55
+ /**
56
+ * Set by ./context (a lazy chunk that comes with comment mode and pins): fingerprints that leave out redacted
57
+ * text and form values and add the neighbours' context after SEP. Until it arrives, the plain fingerprint.
58
+ */
59
+ export declare const ext: {
60
+ fp?: (el: Element) => string | null;
61
+ quote?: (el: Element, quote: string | null) => string | null;
62
+ /** A search starts (true) or ends: what is redacted on the page can be worked out once for it. */
63
+ pass?: (on: boolean) => void;
64
+ };
65
+ /** Between a fingerprint and its (optional, newer) neighbour context. Older fingerprints have none. */
66
+ export declare const SEP = "\u241E";
55
67
  export declare function fingerprint(el: Element): string | null;
68
+ /**
69
+ * The element's first MAX_TEXT characters of text, normalized: what its textContent gives, but read only
70
+ * that far (a page wrapper's textContent is the whole page, and resolving compares thousands of elements).
71
+ * Elements `skip` says yes to are left out, with everything in them.
72
+ */
73
+ export declare function textOf(el: Element, skip?: (el: Element) => boolean): string;
74
+ export declare function normalize(text: string): string;
56
75
  export interface Found {
57
76
  element: Element;
58
77
  state: AnchorState;
@@ -0,0 +1,14 @@
1
+ export declare const PRIVATE_CAPTURE_SELECTOR: string;
2
+ /** Form controls: what someone typed or chose. Never in anchors; in strict mode never in screenshots either. */
3
+ export declare const FORM_CONTROLS = "input,textarea,select";
4
+ /** Strict mode: every form control and every editable region. */
5
+ export declare const STRICT = "input,textarea,select,[contenteditable]:not([contenteditable=\"false\" i])";
6
+ /** Called with `[...config.privacy.redact_selectors, ...options.redact]` and the stricter of `config.privacy.mode` and `options.privacy` (ui/privacy.ts). Invalid selectors are left out. */
7
+ export declare function configurePrivacy(redact?: string[], privacy?: "standard" | "strict"): void;
8
+ /** Strict mode: set by the dashboard or init({ privacy: "strict" }) (via configurePrivacy), or passed for one capture. */
9
+ export declare const isStrict: (privacy?: "standard" | "strict") => boolean;
10
+ /** Everything private: the built-in policy, strict mode's form controls and editable regions, and `extra` selectors. */
11
+ export declare function privateSelector(extra?: string[], strict?: boolean): string;
12
+ /** Is the element (or anything around it, out through shadow roots) private? Fails closed. */
13
+ export declare function isCaptureRedacted(element: Element, selector?: string): boolean;
14
+ export declare function isValidSelector(selector: string): boolean;