@commentkit/comment-kit 1.0.0-beta.2 → 1.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +2 -4
  3. package/dist/npm/chunks/{Guest-CKoV6pEK.js → Guest-CdfnuD8T.js} +46 -46
  4. package/dist/npm/chunks/{MarkupEditor-DAo4qppg.js → MarkupEditor-Clb17Tse.js} +2 -2
  5. package/dist/npm/chunks/Panel-CgvEbZXr.js +438 -0
  6. package/dist/npm/chunks/{Shortcuts-CHMcrjAM.js → Shortcuts-3AOERWBh.js} +2 -2
  7. package/dist/npm/chunks/ThreadCard-DuGKe-gE.js +817 -0
  8. package/dist/npm/chunks/{ar-D3SPpN1T.js → ar-BVQ4ToG2.js} +66 -39
  9. package/dist/npm/chunks/art-Bn9_ANNS.js +155 -0
  10. package/dist/npm/chunks/{client-D1NizpDK.js → client-CS5oL_LQ.js} +14 -21
  11. package/dist/npm/chunks/{de-C8eC6c6f.js → de-CamSq76K.js} +53 -29
  12. package/dist/npm/chunks/{es-Bczf42tm.js → es-BBIlcnsU.js} +52 -28
  13. package/dist/npm/chunks/{extension--it1LAj-.js → extension-CLm_T7Vj.js} +1 -1
  14. package/dist/npm/chunks/{extension-XfuRGu2o.js → extension-DWHHer7j.js} +1 -1
  15. package/dist/npm/chunks/{format-Bw_tNOh9.js → format-CP2xZaec.js} +2 -2
  16. package/dist/npm/chunks/{fr-BaQw-v2e.js → fr-BXsff0Zz.js} +64 -40
  17. package/dist/npm/chunks/{hi-BamV-yXv.js → hi-y-APBuxh.js} +60 -36
  18. package/dist/npm/chunks/{it-DC14_EjN.js → it-C5MH_Ktv.js} +53 -29
  19. package/dist/npm/chunks/{ja-B1mmTN7Y.js → ja-s1JJld2J.js} +57 -33
  20. package/dist/npm/chunks/live-CkVrNM1-.js +34 -0
  21. package/dist/npm/chunks/mount-VmnAiANB.js +1507 -0
  22. package/dist/npm/chunks/{nl-BfhqUsmX.js → nl-CFzRMEfl.js} +62 -38
  23. package/dist/npm/chunks/{pt-BR-CEPu4W5U.js → pt-BR-DE_r-5UM.js} +53 -29
  24. package/dist/npm/chunks/{report-Dh4fxd4J.js → report-DoDVi1qT.js} +5 -4
  25. package/dist/npm/chunks/{src-DujplxfI.js → src-DG8ehgE9.js} +96 -64
  26. package/dist/npm/chunks/{zh-CN-kgqjYwHQ.js → zh-CN--gibO2l7.js} +53 -29
  27. package/dist/npm/element.js +2 -2
  28. package/dist/npm/headless.js +1 -1
  29. package/dist/npm/index.js +2 -2
  30. package/dist/npm/react.js +1 -1
  31. package/dist/npm/svelte.js +1 -1
  32. package/dist/npm/types/anchor/index.d.ts +0 -1
  33. package/dist/npm/types/core/auth.d.ts +0 -2
  34. package/dist/npm/types/core/client.d.ts +7 -6
  35. package/dist/npm/types/core/types.d.ts +19 -0
  36. package/dist/npm/vue.js +1 -1
  37. package/package.json +2 -3
  38. package/dist/npm/chunks/Panel-BRBDHlGg.js +0 -399
  39. package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +0 -570
  40. package/dist/npm/chunks/mount-5fFig0k6.js +0 -1447
@@ -0,0 +1,438 @@
1
+ import { a as e, i as t, n, o as r } from "./src-DG8ehgE9.js";
2
+ import { r as i } from "./client-CS5oL_LQ.js";
3
+ import { r as a } from "./anchor-DT-Ynhh1.js";
4
+ import { d as o, f as s, h as c, i as ee, l as te, n as ne, p as l, s as re, u, y as d } from "./format-CP2xZaec.js";
5
+ import { t as f } from "./art-Bn9_ANNS.js";
6
+ import { c as p, l as m, n as h, u as g } from "./mount-VmnAiANB.js";
7
+ //#region src/ui/Panel.tsx
8
+ function _({ client: n, side: f, dock: _ = "bottom", onClose: y, onOpen: ae }) {
9
+ let S = g(n.state, (e) => e.threads), C = g(n.state, (e) => e.unread), w = g(n.state, (e) => e.allBranches), T = g(n.state, (e) => e.here), E = g(n.state, (e) => e.session), oe = g(n.state, (e) => e.config?.read_only ?? !1), D = n.options.branch, se = m(), [O, k] = c(C > 0 ? "inbox" : "page"), [ce, A] = c({ state: "loading" }), [j, M] = c({ state: "loading" }), [N, P] = c(""), [F, I] = c("active"), [L, le] = c(0), [R, z] = c(""), [B, V] = c(null), [H, U] = c(!1), [W, ue] = c({
10
+ people: [],
11
+ labels: []
12
+ }), G = l(null), K = l(null);
13
+ s(() => K.current?.querySelector("[aria-selected=true]")?.focus({ preventScroll: !0 }), []);
14
+ let q = !!(N || R || B), J = q || F !== "active", de = () => {
15
+ P(""), I("active"), z(""), V(null);
16
+ }, Y = !!E && E.role !== "guest";
17
+ s(() => {
18
+ if (O === "inbox" || O === "page" && !q) return;
19
+ A({ state: "loading" });
20
+ let e = setTimeout(() => {
21
+ n.listThreads({
22
+ q: N || void 0,
23
+ status: O === "page" ? "active" : F,
24
+ branch: n.branchFilter(),
25
+ page_url: O === "page" ? i() : void 0,
26
+ assignee: R || void 0,
27
+ label: B ?? void 0
28
+ }).then((e) => A({
29
+ state: "ready",
30
+ data: e.data.filter((e) => x(e, R, B, E))
31
+ }), () => A({ state: "error" }));
32
+ }, N ? 250 : 0);
33
+ return () => clearTimeout(e);
34
+ }, [
35
+ O,
36
+ N,
37
+ F,
38
+ L,
39
+ w,
40
+ R,
41
+ B,
42
+ q
43
+ ]), s(() => {
44
+ !H || W.people.length || W.labels.length || Promise.all([n.people().catch(() => []), n.labels().catch(() => [])]).then(([e, t]) => ue({
45
+ people: e.filter((e) => e.assignable && e.id !== null),
46
+ labels: t
47
+ }));
48
+ }, [H]), s(() => {
49
+ O === "inbox" && n.inbox().then((e) => M({
50
+ state: "ready",
51
+ data: e
52
+ }), () => M({ state: "error" }));
53
+ }, [
54
+ O,
55
+ C,
56
+ L
57
+ ]);
58
+ let X = (e) => h("page" in e ? e.page.url : e.page_url, "page" in e ? e.id : e.thread_id, ae), Z = (e) => p(e, ".ck-item", !0), Q = () => le((e) => e + 1), $ = O === "page" && !q ? {
59
+ state: "ready",
60
+ data: S
61
+ } : ce, fe = [
62
+ [
63
+ "page",
64
+ "thisPage",
65
+ S.length
66
+ ],
67
+ [
68
+ "all",
69
+ "allPages",
70
+ null
71
+ ],
72
+ [
73
+ "inbox",
74
+ "notifications",
75
+ C || null
76
+ ]
77
+ ];
78
+ return /* @__PURE__ */ o("aside", {
79
+ class: "ck-panel",
80
+ "data-side": f,
81
+ "data-dock": _,
82
+ "aria-label": r("inbox"),
83
+ "data-commentkit-ui": !0,
84
+ onKeyDown: (e) => e.key === "Escape" && y(),
85
+ children: [
86
+ /* @__PURE__ */ o("div", {
87
+ class: "ck-card-head",
88
+ children: [
89
+ /* @__PURE__ */ o("span", {
90
+ class: "ck-card-title",
91
+ children: r("inbox")
92
+ }),
93
+ T > 1 ? /* @__PURE__ */ o("span", {
94
+ class: "ck-here",
95
+ role: "status",
96
+ children: [/* @__PURE__ */ o("span", {
97
+ "aria-hidden": "true",
98
+ class: "ck-dot"
99
+ }), t("peopleHere", T)]
100
+ }) : null,
101
+ /* @__PURE__ */ o("button", {
102
+ class: "ck-ghost",
103
+ onClick: y,
104
+ "aria-label": r("close"),
105
+ children: /* @__PURE__ */ o(ne, { name: "close" })
106
+ })
107
+ ]
108
+ }),
109
+ /* @__PURE__ */ o("div", {
110
+ class: "ck-tabs",
111
+ role: "tablist",
112
+ ref: K,
113
+ onKeyDown: (e) => p(e, "[role=tab]"),
114
+ children: fe.map(([e, t, n]) => /* @__PURE__ */ o("button", {
115
+ role: "tab",
116
+ id: `ck-tab-${e}`,
117
+ "aria-controls": "ck-tabpanel",
118
+ class: "ck-tab",
119
+ "aria-selected": O === e,
120
+ tabIndex: O === e ? 0 : -1,
121
+ onClick: () => k(e),
122
+ onFocus: () => k(e),
123
+ children: [
124
+ r(t),
125
+ " ",
126
+ n ? /* @__PURE__ */ o("span", {
127
+ class: "ck-count",
128
+ children: n
129
+ }) : null
130
+ ]
131
+ }))
132
+ }),
133
+ se ? null : /* @__PURE__ */ o("div", {
134
+ class: "ck-note",
135
+ "data-tone": "warning",
136
+ role: "status",
137
+ children: r("offline")
138
+ }),
139
+ oe ? /* @__PURE__ */ o("div", {
140
+ class: "ck-note ck-pad-x",
141
+ role: "status",
142
+ children: r("readOnlyShort")
143
+ }) : null,
144
+ D && O !== "inbox" ? /* @__PURE__ */ o("div", {
145
+ class: "ck-branchbar",
146
+ role: "group",
147
+ "aria-label": r("branchFilter"),
148
+ children: [/* @__PURE__ */ o("button", {
149
+ class: "ck-chip",
150
+ "aria-pressed": !w,
151
+ onClick: () => void n.setAllBranches(!1).catch(() => void 0),
152
+ title: D,
153
+ children: r("thisBranch", { branch: b(D) })
154
+ }), /* @__PURE__ */ o("button", {
155
+ class: "ck-chip",
156
+ "aria-pressed": w,
157
+ onClick: () => void n.setAllBranches(!0).catch(() => void 0),
158
+ children: r("allBranches")
159
+ })]
160
+ }) : null,
161
+ O === "inbox" ? null : /* @__PURE__ */ o(d, { children: [
162
+ /* @__PURE__ */ o("div", {
163
+ class: "ck-filters",
164
+ children: [/* @__PURE__ */ o("input", {
165
+ class: "ck-input",
166
+ type: "search",
167
+ "aria-label": r("search"),
168
+ placeholder: r("search"),
169
+ value: N,
170
+ onInput: (e) => P(e.target.value),
171
+ onKeyDown: (e) => e.stopPropagation()
172
+ }), O === "all" ? /* @__PURE__ */ o("select", {
173
+ class: "ck-input",
174
+ "aria-label": r("statusFilter"),
175
+ value: F,
176
+ onChange: (e) => I(e.target.value),
177
+ children: [
178
+ /* @__PURE__ */ o("option", {
179
+ value: "active",
180
+ children: r("status_open")
181
+ }),
182
+ /* @__PURE__ */ o("option", {
183
+ value: "in_review",
184
+ children: r("status_in_review")
185
+ }),
186
+ /* @__PURE__ */ o("option", {
187
+ value: "resolved,closed",
188
+ children: r("status_resolved")
189
+ }),
190
+ /* @__PURE__ */ o("option", {
191
+ value: "all",
192
+ children: r("allStatuses")
193
+ })
194
+ ]
195
+ }) : null]
196
+ }),
197
+ /* @__PURE__ */ o("div", {
198
+ class: "ck-branchbar",
199
+ children: [Y ? /* @__PURE__ */ o("button", {
200
+ class: "ck-chip",
201
+ "aria-pressed": R === "me",
202
+ onClick: () => z(R === "me" ? "" : "me"),
203
+ children: r("assignedToMe")
204
+ }) : null, /* @__PURE__ */ o("button", {
205
+ class: "ck-chip",
206
+ "aria-expanded": H,
207
+ "aria-controls": "ck-more-filters",
208
+ onClick: () => U(!H),
209
+ children: [r("filters"), R || B ? " •" : ""]
210
+ })]
211
+ }),
212
+ H ? /* @__PURE__ */ o("div", {
213
+ class: "ck-filters",
214
+ id: "ck-more-filters",
215
+ children: [Y ? /* @__PURE__ */ o("select", {
216
+ class: "ck-input",
217
+ "aria-label": r("assigneeFilter"),
218
+ value: R,
219
+ onChange: (e) => z(e.target.value),
220
+ children: [
221
+ /* @__PURE__ */ o("option", {
222
+ value: "",
223
+ children: r("anyone")
224
+ }),
225
+ /* @__PURE__ */ o("option", {
226
+ value: "me",
227
+ children: r("assignedToMe")
228
+ }),
229
+ /* @__PURE__ */ o("option", {
230
+ value: "none",
231
+ children: r("unassigned")
232
+ }),
233
+ W.people.map((e) => /* @__PURE__ */ o("option", {
234
+ value: String(e.id),
235
+ children: e.name
236
+ }))
237
+ ]
238
+ }) : null, /* @__PURE__ */ o("select", {
239
+ class: "ck-input",
240
+ "aria-label": r("labelFilter"),
241
+ value: B === null ? "" : String(B),
242
+ onChange: (e) => {
243
+ let t = e.target.value;
244
+ V(t ? Number(t) : null);
245
+ },
246
+ children: [/* @__PURE__ */ o("option", {
247
+ value: "",
248
+ children: r("anyLabel")
249
+ }), W.labels.map((e) => /* @__PURE__ */ o("option", {
250
+ value: String(e.id),
251
+ children: e.name
252
+ }))]
253
+ })]
254
+ }) : null
255
+ ] }),
256
+ /* @__PURE__ */ o("div", {
257
+ class: "ck-card-body",
258
+ id: "ck-tabpanel",
259
+ role: "tabpanel",
260
+ "aria-labelledby": `ck-tab-${O}`,
261
+ style: { padding: 0 },
262
+ "aria-busy": (O === "inbox" ? j : $).state === "loading",
263
+ children: O === "inbox" ? /* @__PURE__ */ o(v, {
264
+ load: j,
265
+ onRetry: Q,
266
+ art: "caughtUp",
267
+ empty: /* @__PURE__ */ o("strong", { children: r("allCaughtUp") }),
268
+ children: (t) => /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ o("ul", {
269
+ class: "ck-list",
270
+ ref: G,
271
+ onKeyDown: Z,
272
+ children: t.map((t) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
273
+ class: "ck-item",
274
+ "data-unread": !t.read,
275
+ onClick: () => X(t),
276
+ children: [/* @__PURE__ */ o("div", {
277
+ class: "ck-item-top",
278
+ children: [/* @__PURE__ */ o("span", {
279
+ class: "ck-item-tags",
280
+ children: [/* @__PURE__ */ o(ie, { item: t }), t.reference ? ` · ${t.reference}` : ""]
281
+ }), /* @__PURE__ */ o("span", {
282
+ class: "ck-time",
283
+ children: e(t.created_at)
284
+ })]
285
+ }), t.excerpt ? /* @__PURE__ */ o("div", {
286
+ class: "ck-item-text",
287
+ children: t.excerpt
288
+ }) : null]
289
+ }) }))
290
+ }), C ? /* @__PURE__ */ o("div", {
291
+ class: "ck-pad",
292
+ children: /* @__PURE__ */ o("button", {
293
+ class: "ck-btn",
294
+ onClick: () => void n.markRead({ all: !0 }).then(Q),
295
+ children: r("markAllRead")
296
+ })
297
+ }) : null] })
298
+ }) : /* @__PURE__ */ o(v, {
299
+ load: $,
300
+ onRetry: Q,
301
+ art: J ? "noMatch" : "noFeedback",
302
+ empty: J ? /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ o("strong", { children: r("noMatch") }), /* @__PURE__ */ o("button", {
303
+ class: "ck-btn",
304
+ onClick: de,
305
+ children: r("clearFilters")
306
+ })] }) : /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ o("strong", { children: r(O === "all" ? "nothingAnywhere" : "nothingHere") }), /* @__PURE__ */ o("span", {
307
+ class: "ck-hint",
308
+ children: r("nothingHereHint")
309
+ })] }),
310
+ children: (n) => /* @__PURE__ */ o("ul", {
311
+ class: "ck-list",
312
+ ref: G,
313
+ onKeyDown: Z,
314
+ children: n.map((n) => {
315
+ let i = O === "page" && a(n.anchor).state === "detached", s = i ? te(n.capture?.screenshot?.thumbnail_url, "image") : null;
316
+ return /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("button", {
317
+ class: "ck-item",
318
+ "data-shot": s ? "true" : void 0,
319
+ onClick: () => X(n),
320
+ children: [/* @__PURE__ */ o("div", {
321
+ class: "ck-item-main",
322
+ children: [
323
+ /* @__PURE__ */ o("div", {
324
+ class: "ck-item-top",
325
+ children: [/* @__PURE__ */ o("span", {
326
+ class: "ck-item-tags",
327
+ children: [
328
+ /* @__PURE__ */ o("strong", { children: Y ? n.reference : r("feedbackRef", { ref: n.reference }) }),
329
+ /* @__PURE__ */ o(ee, { status: n.status }),
330
+ re(n) ? /* @__PURE__ */ o("span", {
331
+ class: "ck-tag",
332
+ title: `${r(`screen_${u(n.breakpoint)}`)} (${n.breakpoint}px)`,
333
+ children: r(`size_${u(n.breakpoint)}`)
334
+ }) : null,
335
+ i ? /* @__PURE__ */ o("span", {
336
+ class: "ck-badge-soft",
337
+ title: r("detached"),
338
+ children: r("notOnPage")
339
+ }) : null
340
+ ]
341
+ }), /* @__PURE__ */ o("span", {
342
+ class: "ck-time",
343
+ children: e(n.last_activity_at)
344
+ })]
345
+ }),
346
+ /* @__PURE__ */ o("div", {
347
+ class: "ck-item-text",
348
+ children: n.first_message?.body
349
+ }),
350
+ /* @__PURE__ */ o("div", {
351
+ class: "ck-muted ck-item-meta",
352
+ children: [
353
+ /* @__PURE__ */ o("bdi", { children: n.author.name }),
354
+ O === "all" ? /* @__PURE__ */ o(d, { children: [" · ", /* @__PURE__ */ o("bdi", { children: n.page.title || n.page.path })] }) : "",
355
+ " · ",
356
+ t("messageCount", n.message_count),
357
+ w && n.page.branch && n.page.branch !== D ? ` · ${r("onBranch", { branch: b(n.page.branch) })}` : ""
358
+ ]
359
+ })
360
+ ]
361
+ }), s ? /* @__PURE__ */ o("img", {
362
+ class: "ck-item-thumb",
363
+ src: s,
364
+ alt: r("screenshot"),
365
+ loading: "lazy"
366
+ }) : null]
367
+ }) });
368
+ })
369
+ })
370
+ })
371
+ })
372
+ ]
373
+ });
374
+ }
375
+ function v({ load: e, onRetry: t, art: n, empty: i, children: a }) {
376
+ return e.state === "loading" ? /* @__PURE__ */ o("div", {
377
+ class: "ck-loading",
378
+ role: "status",
379
+ "aria-label": r("loadingEarlier"),
380
+ children: [
381
+ 0,
382
+ 1,
383
+ 2
384
+ ].map(() => /* @__PURE__ */ o("div", {
385
+ class: "ck-loading-row",
386
+ children: [
387
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" }),
388
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" }),
389
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" })
390
+ ]
391
+ }))
392
+ }) : e.state === "error" ? /* @__PURE__ */ o("div", {
393
+ class: "ck-empty",
394
+ role: "alert",
395
+ children: [
396
+ /* @__PURE__ */ o(f, { name: "error" }),
397
+ r("loadFailed"),
398
+ /* @__PURE__ */ o("button", {
399
+ class: "ck-btn",
400
+ onClick: t,
401
+ children: r("retry")
402
+ })
403
+ ]
404
+ }) : e.data.length ? /* @__PURE__ */ o(d, { children: a(e.data) }) : /* @__PURE__ */ o("div", {
405
+ class: "ck-empty",
406
+ children: [/* @__PURE__ */ o(f, { name: n }), i]
407
+ });
408
+ }
409
+ function ie({ item: e }) {
410
+ let t = `kind_${e.kind}`, [i, a] = /^kind_[a-z_]+$/.test(t) && t in y ? n(t, "actor") : ["", ` ${e.kind.replace(/_/g, " ")}`], { type: s, name: c } = e.actor;
411
+ return /* @__PURE__ */ o(d, { children: [
412
+ i,
413
+ /* @__PURE__ */ o("strong", { children: /* @__PURE__ */ o("bdi", { children: s === "agent" || s === "integration" || s === "system" ? c : r("personName", { name: c }) }) }),
414
+ a
415
+ ] });
416
+ }
417
+ var y = {
418
+ kind_mention: !0,
419
+ kind_reply: !0,
420
+ kind_assigned: !0,
421
+ kind_ready_for_review: !0,
422
+ kind_reopened: !0,
423
+ kind_resolved: !0,
424
+ kind_closed: !0,
425
+ kind_new_feedback: !0,
426
+ kind_due_soon: !0,
427
+ kind_overdue: !0,
428
+ kind_agent_request: !0
429
+ };
430
+ function b(e) {
431
+ return e.length > 28 ? `${e.slice(0, 27)}…` : e;
432
+ }
433
+ function x(e, t, n, r) {
434
+ let i = e.assignee;
435
+ return n !== null && e.labels && !e.labels.some((e) => e.id === n) ? !1 : t === "none" ? !i : t === "me" ? !!i && !!r && i.id === r.person.id && i.type === r.person.type : !t || i?.id === t;
436
+ }
437
+ //#endregion
438
+ export { _ as Panel };
@@ -1,5 +1,5 @@
1
- import { a as e } from "./src-DujplxfI.js";
2
- import { d as t, f as n, n as r, p as i } from "./format-Bw_tNOh9.js";
1
+ import { o as e } from "./src-DG8ehgE9.js";
2
+ import { d as t, f as n, n as r, p as i } from "./format-CP2xZaec.js";
3
3
  //#region src/ui/Shortcuts.tsx
4
4
  var a = [
5
5
  ["C", "shortcutComment"],