@commentkit/comment-kit 1.0.0 → 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 +133 -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-BSOKdMHt.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-O7EPv0mI.js → ar-BQ9K9Oqf.js} +189 -8
  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-PGyZVNHX.js → de-CcPi8xdC.js} +160 -8
  26. package/dist/npm/chunks/drafts-CpQdHhcK.js +51 -0
  27. package/dist/npm/chunks/{es-Bq1idl8M.js → es-DXgkjDCG.js} +160 -8
  28. package/dist/npm/chunks/extension-BIGfr4Gh.js +50 -0
  29. package/dist/npm/chunks/{extension-B7SelsS0.js → extension-DkDSW4qw.js} +2 -2
  30. package/dist/npm/chunks/{fr-BVB9GGco.js → fr-IjJaUbWh.js} +160 -8
  31. package/dist/npm/chunks/{hi-DyBvrjzQ.js → hi-BhKQK2MU.js} +160 -8
  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-BlMMMwZh.js → it-DKiSCkiD.js} +160 -8
  35. package/dist/npm/chunks/{ja-lAioBCJv.js → ja-BI1WagDg.js} +160 -8
  36. package/dist/npm/chunks/{live-YFyP1GnP.js → live-B-mo27Qq.js} +1 -1
  37. package/dist/npm/chunks/lock-C82sC17d.js +30 -0
  38. package/dist/npm/chunks/{nl-DR8mLHnn.js → nl-CJw3VUQ5.js} +160 -8
  39. package/dist/npm/chunks/pick-CYPkLLFJ.js +120 -0
  40. package/dist/npm/chunks/{pt-BR-D7j6aDPx.js → pt-BR-CjBolC5g.js} +160 -8
  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-tzYg9NPH.js → zh-CN-BrZGx2S0.js} +160 -8
  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 +7 -5
  63. package/dist/npm/chunks/Guest-VNoofLxw.js +0 -157
  64. package/dist/npm/chunks/MarkupEditor-DTXrS3DD.js +0 -199
  65. package/dist/npm/chunks/Panel-B88JYH52.js +0 -438
  66. package/dist/npm/chunks/ThreadCard-izybwXIC.js +0 -817
  67. package/dist/npm/chunks/anchor-DT-Ynhh1.js +0 -270
  68. package/dist/npm/chunks/art-DK1JwPIo.js +0 -155
  69. package/dist/npm/chunks/client-Iegfv6ZC.js +0 -620
  70. package/dist/npm/chunks/colors-CX-IPjvb.js +0 -86
  71. package/dist/npm/chunks/extension-DSA8S8Qz.js +0 -26
  72. package/dist/npm/chunks/format-B5tJGtPC.js +0 -524
  73. package/dist/npm/chunks/html2canvas-DfGb8yka.js +0 -4024
  74. package/dist/npm/chunks/mount-Dx_8NhX3.js +0 -1484
  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-C1Qp94nr.js +0 -549
@@ -0,0 +1,272 @@
1
+ import { f as e, l as t, m as n, n as r, s as i, u as a } from "./i18n-DAJGndZ2.js";
2
+ import { n as o } from "./start-DW9_DKmf.js";
3
+ //#endregion
4
+ //#region src/ui/TaskFields.tsx
5
+ o(".ck-task{flex-wrap:wrap;gap:6px;padding:8px 14px 0;display:flex}.ck-date{position:relative}.ck-date[data-set]{color:var(--ck-text)}.ck-date-input{opacity:0;cursor:pointer;border:0;width:100%;height:100%;margin:0;padding:0;position:absolute;top:0;bottom:0;left:0;right:0}.ck-date:focus-within{outline:2px solid var(--ck-accent);outline-offset:1px}.ck-task-pick{position:relative}.ck-task-menu{z-index:2;top:calc(100% + 4px);border:1px solid var(--ck-border);border-radius:var(--ck-radius-md);background:var(--ck-bg);min-width:180px;max-height:220px;box-shadow:var(--ck-shadow);padding:4px 10px 10px;position:absolute;overflow:auto}.ck-task-menu:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){left:0}.ck-task-menu:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){left:0}.ck-task-menu:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){right:0}.ck-task-menu:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){right:0}.ck-swatch{border-radius:50%;flex:none;width:8px;height:8px}.ck-task-menu{overscroll-behavior:contain}.ck-task-draft{border:0;margin-top:8px;padding:0}");
6
+ var s = [
7
+ "none",
8
+ "low",
9
+ "medium",
10
+ "high",
11
+ "urgent"
12
+ ], c = /* @__PURE__ */ new WeakMap();
13
+ function l(e) {
14
+ let t = c.get(e);
15
+ return t || (t = Promise.all([e.people().catch(() => []), e.labels().catch(() => [])]).then(([e, t]) => ({
16
+ people: e.filter((e) => e.assignable && e.type === "user" && /^\d+$/.test(e.id ?? "")),
17
+ labels: t
18
+ })), c.set(e, t)), t;
19
+ }
20
+ function u(e) {
21
+ return /^\d{4}-\d{2}-\d{2}/.exec(e ?? "")?.[0] ?? "";
22
+ }
23
+ function d(e) {
24
+ let [t, n, i] = e.split("-").map(Number);
25
+ try {
26
+ return new Date(t, n - 1, i).toLocaleDateString(r(), {
27
+ day: "numeric",
28
+ month: "short",
29
+ year: "numeric"
30
+ });
31
+ } catch {
32
+ return e;
33
+ }
34
+ }
35
+ var f = (e) => /^#[0-9a-f]{6}$/i.test(e) ? e : "transparent";
36
+ function p({ client: e, thread: r, editable: o, onChange: c, onError: p }) {
37
+ let [h, v] = n(null), [y, b] = n(!1);
38
+ a(() => {
39
+ o && l(e).then(v);
40
+ }, [o]);
41
+ let x = r.labels ?? [], S = u(r.due_at), C = r.assignees ?? (r.assignee ? [r.assignee] : []);
42
+ if (!o) {
43
+ let e = [
44
+ r.priority === "none" ? null : /* @__PURE__ */ t("span", {
45
+ class: "ck-chip",
46
+ children: [
47
+ i("priority"),
48
+ ": ",
49
+ i(`priority_${r.priority}`)
50
+ ]
51
+ }),
52
+ C.length ? /* @__PURE__ */ t("span", {
53
+ class: "ck-chip",
54
+ children: [
55
+ i("assigneeFilter"),
56
+ ": ",
57
+ /* @__PURE__ */ t("bdi", { children: C.map((e) => e.name).join(", ") })
58
+ ]
59
+ }) : null,
60
+ S ? /* @__PURE__ */ t("span", {
61
+ class: "ck-chip",
62
+ children: i("dueOn", { date: d(S) })
63
+ }) : null,
64
+ ...x.map((e) => /* @__PURE__ */ t("span", {
65
+ class: "ck-chip",
66
+ children: [/* @__PURE__ */ t("span", {
67
+ class: "ck-swatch",
68
+ style: { background: f(e.color) }
69
+ }), /* @__PURE__ */ t("bdi", { children: e.name })]
70
+ }))
71
+ ].filter(Boolean);
72
+ return e.length ? /* @__PURE__ */ t("div", {
73
+ class: "ck-task",
74
+ role: "group",
75
+ "aria-label": i("taskDetails"),
76
+ children: e
77
+ }) : null;
78
+ }
79
+ let w = (t, n = {}) => {
80
+ let i = r;
81
+ b(!0), c({
82
+ ...r,
83
+ ...n
84
+ }), e.updateThread(r.id, t).then(c, (e) => {
85
+ c(i), p(e);
86
+ }).finally(() => b(!1));
87
+ }, T = h?.people ?? [], E = [...C.filter((e) => !T.some((t) => t.id === e.id)), ...T], D = C.map((e) => Number(e.id)), O = (e, t) => {
88
+ let n = t ? [...D.filter((t) => t !== Number(e.id)), Number(e.id)] : D.filter((t) => t !== Number(e.id)), r = n.map((e) => E.find((t) => Number(t.id) === e)).filter(Boolean);
89
+ w({ assignee_ids: n }, {
90
+ assignee: r[0] ?? null,
91
+ assignees: r
92
+ });
93
+ }, k = new Set(x.map((e) => e.id)), A = (e, t) => {
94
+ let n = [...k].filter((t) => t !== e).concat(t ? [e] : []), r = [...x, ...h?.labels ?? []];
95
+ w({ label_ids: n }, { labels: n.map((e) => r.find((t) => t.id === e)).filter(Boolean) });
96
+ }, j = i(`priority_${r.priority}`);
97
+ return /* @__PURE__ */ t("div", {
98
+ class: "ck-task",
99
+ role: "group",
100
+ "aria-label": i("taskDetails"),
101
+ children: [
102
+ /* @__PURE__ */ t(g, {
103
+ label: i("priority"),
104
+ summary: j,
105
+ children: s.map((e) => /* @__PURE__ */ t(_, {
106
+ type: "radio",
107
+ name: `ck-priority-${r.id}`,
108
+ checked: r.priority === e,
109
+ disabled: y,
110
+ onPick: () => w({ priority: e }, { priority: e }),
111
+ children: i(`priority_${e}`)
112
+ }))
113
+ }),
114
+ /* @__PURE__ */ t(g, {
115
+ label: i("assigneeFilter"),
116
+ summary: m(C),
117
+ keepOpen: !0,
118
+ children: E.map((e) => /* @__PURE__ */ t(_, {
119
+ type: "checkbox",
120
+ checked: D.includes(Number(e.id)),
121
+ disabled: y,
122
+ onPick: (t) => O(e, t),
123
+ children: /* @__PURE__ */ t("bdi", { children: e.name })
124
+ }))
125
+ }),
126
+ /* @__PURE__ */ t("label", {
127
+ class: "ck-chip ck-date",
128
+ "data-set": S ? "true" : void 0,
129
+ children: [/* @__PURE__ */ t("bdi", { children: S ? i("dueOn", { date: d(S) }) : i("dueDate") }), /* @__PURE__ */ t("input", {
130
+ class: "ck-date-input",
131
+ type: "date",
132
+ "aria-label": i("dueDate"),
133
+ disabled: y,
134
+ value: S,
135
+ onClick: (e) => {
136
+ try {
137
+ e.currentTarget.showPicker?.();
138
+ } catch {}
139
+ },
140
+ onChange: (e) => {
141
+ let t = e.target.value, n = t || null;
142
+ t !== S && w({ due_at: n }, { due_at: n });
143
+ }
144
+ })]
145
+ }),
146
+ h?.labels.length || x.length ? /* @__PURE__ */ t(g, {
147
+ label: i("labels"),
148
+ summary: x.length ? x.map((e) => e.name).join(", ") : i("noLabels"),
149
+ keepOpen: !0,
150
+ children: (h?.labels.length ? h.labels : x).map((e) => /* @__PURE__ */ t(_, {
151
+ type: "checkbox",
152
+ checked: k.has(e.id),
153
+ disabled: y,
154
+ onPick: (t) => A(e.id, t),
155
+ children: [/* @__PURE__ */ t("span", {
156
+ class: "ck-swatch",
157
+ style: { background: f(e.color) }
158
+ }), /* @__PURE__ */ t("bdi", { children: e.name })]
159
+ }))
160
+ }) : null
161
+ ]
162
+ });
163
+ }
164
+ function m(e) {
165
+ return e.length ? e.length === 1 ? e[0].name : `${e[0].name} +${e.length - 1}` : i("unassigned");
166
+ }
167
+ function h(e) {
168
+ e?.scrollIntoView({ block: "nearest" });
169
+ }
170
+ function g({ label: r, summary: i, spoken: o = i, keepOpen: s = !1, children: c }) {
171
+ let [l, u] = n(!1), d = e(null);
172
+ return a(() => {
173
+ if (!l) return;
174
+ let e = (e) => !e.composedPath().includes(d.current) && u(!1);
175
+ return addEventListener("pointerdown", e, !0), () => removeEventListener("pointerdown", e, !0);
176
+ }, [l]), /* @__PURE__ */ t("div", {
177
+ class: "ck-task-pick",
178
+ ref: d,
179
+ onChange: () => !s && u(!1),
180
+ children: [/* @__PURE__ */ t("button", {
181
+ class: "ck-chip",
182
+ "aria-expanded": l,
183
+ "aria-label": `${r}: ${o}`,
184
+ onClick: () => u(!l),
185
+ children: /* @__PURE__ */ t("bdi", { children: i })
186
+ }), l ? /* @__PURE__ */ t("div", {
187
+ class: "ck-task-menu",
188
+ role: "group",
189
+ "aria-label": r,
190
+ ref: h,
191
+ onKeyDown: (e) => e.key === "Escape" && (e.stopPropagation(), u(!1)),
192
+ children: c
193
+ }) : null]
194
+ });
195
+ }
196
+ function _({ type: e, name: n, checked: r, disabled: i, onPick: a, children: o }) {
197
+ return /* @__PURE__ */ t("label", {
198
+ class: "ck-check",
199
+ children: [/* @__PURE__ */ t("input", {
200
+ type: e,
201
+ name: n,
202
+ checked: r,
203
+ disabled: i,
204
+ onChange: (e) => a(e.target.checked)
205
+ }), o]
206
+ });
207
+ }
208
+ function v({ client: e, value: r, onChange: o }) {
209
+ let [c, u] = n(null);
210
+ a(() => void l(e).then(u), []);
211
+ let d = r.priority ?? "none", p = r.assignee_ids ?? [], h = p.map((e) => c?.people.find((t) => Number(t.id) === e)).filter((e) => !!e), v = new Set(r.label_ids ?? []), y = (c?.labels ?? []).filter((e) => v.has(e.id));
212
+ return /* @__PURE__ */ t("div", {
213
+ class: "ck-task ck-task-draft",
214
+ role: "group",
215
+ "aria-label": i("taskDetails"),
216
+ children: [
217
+ /* @__PURE__ */ t(g, {
218
+ label: i("priority"),
219
+ summary: i(d === "none" ? "priority" : `priority_${d}`),
220
+ spoken: i(`priority_${d}`),
221
+ children: s.map((e) => /* @__PURE__ */ t(_, {
222
+ type: "radio",
223
+ name: "ck-draft-priority",
224
+ checked: d === e,
225
+ disabled: !1,
226
+ onPick: () => o({
227
+ ...r,
228
+ priority: e
229
+ }),
230
+ children: i(`priority_${e}`)
231
+ }))
232
+ }),
233
+ /* @__PURE__ */ t(g, {
234
+ label: i("assigneeFilter"),
235
+ summary: h.length ? m(h) : i("assign"),
236
+ spoken: h.length ? m(h) : i("unassigned"),
237
+ keepOpen: !0,
238
+ children: (c?.people ?? []).map((e) => /* @__PURE__ */ t(_, {
239
+ type: "checkbox",
240
+ checked: p.includes(Number(e.id)),
241
+ disabled: !1,
242
+ onPick: (t) => o({
243
+ ...r,
244
+ assignee_ids: t ? [...p, Number(e.id)] : p.filter((t) => t !== Number(e.id))
245
+ }),
246
+ children: /* @__PURE__ */ t("bdi", { children: e.name })
247
+ }))
248
+ }),
249
+ c?.labels.length ? /* @__PURE__ */ t(g, {
250
+ label: i("labels"),
251
+ summary: y.length ? y.map((e) => e.name).join(", ") : i("labels"),
252
+ spoken: y.length ? y.map((e) => e.name).join(", ") : i("noLabels"),
253
+ keepOpen: !0,
254
+ children: c.labels.map((e) => /* @__PURE__ */ t(_, {
255
+ type: "checkbox",
256
+ checked: v.has(e.id),
257
+ disabled: !1,
258
+ onPick: (t) => o({
259
+ ...r,
260
+ label_ids: [...v].filter((t) => t !== e.id).concat(t ? [e.id] : [])
261
+ }),
262
+ children: [/* @__PURE__ */ t("span", {
263
+ class: "ck-swatch",
264
+ style: { background: f(e.color) }
265
+ }), /* @__PURE__ */ t("bdi", { children: e.name })]
266
+ }))
267
+ }) : null
268
+ ]
269
+ });
270
+ }
271
+ //#endregion
272
+ export { v as TaskDraft, p as TaskFields };