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