@commentkit/comment-kit 0.7.0 → 0.7.2

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 (56) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +10 -6
  3. package/SECURITY.md +14 -6
  4. package/dist/angular.es.js +2 -2
  5. package/dist/comment-kit.es.js +5 -5
  6. package/dist/demo.es.js +36 -34
  7. package/dist/headless.es.js +3 -3
  8. package/dist/preact.es.js +2 -2
  9. package/dist/qwik.qwik.mjs +2 -2
  10. package/dist/react.es.js +2 -2
  11. package/dist/shared/{ShadowRootContext-Bv-4aElu.js → ShadowRootContext-CjciYxVN.js} +4 -4
  12. package/dist/shared/annotation-toolbar-CZI1KVdW.js +1094 -0
  13. package/dist/shared/attachment-refresh-mQw-L7hB.js +94 -0
  14. package/dist/shared/{button-group-Cl9CrvvU.js → button-group-C285iSkZ.js} +14 -16
  15. package/dist/shared/capture-colors-CxSLsU5-.js +74 -0
  16. package/dist/shared/capture-privacy-DUROnio5.js +77 -0
  17. package/dist/shared/{comment-drawing-canvas-Dzb5YoFw.js → comment-drawing-canvas-CYFFKgCm.js} +2 -2
  18. package/dist/shared/{comment-utils-BycYTSxA.js → comment-icon-4SQd3nlz.js} +30 -24
  19. package/dist/shared/comment-image-lightbox-DmTNxuqX.js +190 -0
  20. package/dist/shared/comment-images-content-BX4DQ9Ol.js +214 -0
  21. package/dist/shared/{comment-kit-core-BaSuMzp9.js → comment-kit-core-VuIidMeu.js} +1096 -793
  22. package/dist/shared/{comment-kit-ui-CzfdAZs2.js → comment-kit-ui-BjJ1ZLiv.js} +6091 -6486
  23. package/dist/shared/{comment-screenshot-annotator-C7X-_bm6.js → comment-screenshot-annotator-CMOG1md7.js} +5 -5
  24. package/dist/shared/{comment-screenshot-overlay-wIrZrcRy.js → comment-screenshot-overlay-iWW-V-Iw.js} +114 -118
  25. package/dist/shared/comment-shortcut-groups-CfEmkitU.js +153 -0
  26. package/dist/shared/{dev-export-panel-FwFVdady.js → dev-export-panel-CrRENbMn.js} +9 -10
  27. package/dist/shared/dev-grab-Ca4MlS2Y.js +196 -0
  28. package/dist/shared/{element-selector-BhJm-NSs.js → element-selector-g1bTvdEA.js} +450 -408
  29. package/dist/shared/{mount-ui--ijs8pWT.js → mount-ui-Dz5QLq4W.js} +121 -106
  30. package/dist/shared/{pusher-ipHMJnO_.js → pusher-ue0D83de.js} +1 -1
  31. package/dist/shared/realtime-CieWAnsW.js +321 -0
  32. package/dist/shared/realtime-recovery-BSVMwsXJ.js +135 -0
  33. package/dist/shared/request-activity-DQrAUwfA.js +11 -0
  34. package/dist/shared/{separator-XDBsaWyw.js → separator-aphZiRoJ.js} +1 -1
  35. package/dist/shared/{shadow-root-C5v-T8lQ.js → shadow-root-Cv1aLuFf.js} +31 -31
  36. package/dist/shared/{styles-D3yMtaec.js → styles-CnYsLS2f.js} +1 -1
  37. package/dist/shared/text-B4HHZNaa.js +23 -0
  38. package/dist/shared/token-session-CPQpt3-u.js +25 -0
  39. package/dist/shared/useRender-D1z_X_BY.js +5 -0
  40. package/dist/shared/{validation-C7QG8j7Z.js → validation-3wbbbuX0.js} +26 -1
  41. package/dist/shared/websocket-manager-BnK55c3U.js +381 -0
  42. package/dist/solid.es.js +2 -2
  43. package/dist/svelte.es.js +2 -2
  44. package/dist/types/core/api-client.d.ts +11 -2
  45. package/dist/types/core/comment-kit-core.d.ts +11 -5
  46. package/dist/types/core/types.d.ts +54 -2
  47. package/dist/types/core/websocket-manager.d.ts +13 -0
  48. package/dist/types/core/write-access.d.ts +9 -0
  49. package/dist/vue.es.js +2 -2
  50. package/docs/api-reference.md +25 -4
  51. package/package.json +3 -2
  52. package/dist/shared/annotation-toolbar-B9SxYqoF.js +0 -1093
  53. package/dist/shared/comment-image-lightbox-BPYJT1sB.js +0 -183
  54. package/dist/shared/dev-grab-DDqg0LQf.js +0 -203
  55. package/dist/shared/realtime-Dk41VwKg.js +0 -302
  56. package/dist/shared/websocket-manager-DhLWh3Jr.js +0 -302
@@ -0,0 +1,214 @@
1
+ import { d as e, s as t, t as n } from "./button-By0hGrJK.js";
2
+ import { t as r } from "./useRender-D1z_X_BY.js";
3
+ import { c as i, j as a, l as o, r as s } from "./comment-kit-ui-BjJ1ZLiv.js";
4
+ import { n as c, r as l, t as u } from "./attachment-refresh-mQw-L7hB.js";
5
+ import * as d from "react";
6
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ var h = d.forwardRef(function({ ratio: e, className: n, style: r, ...i }, a) {
8
+ return /* @__PURE__ */ p("div", {
9
+ ref: a,
10
+ "data-slot": "aspect-ratio",
11
+ className: t("ck-aspect-ratio", n),
12
+ style: {
13
+ "--ratio": e,
14
+ ...r
15
+ },
16
+ ...i
17
+ });
18
+ }), g = d.forwardRef(function({ className: e, state: n = "done", size: r = "default", orientation: i = "horizontal", ...a }, o) {
19
+ return /* @__PURE__ */ p("div", {
20
+ ref: o,
21
+ "data-slot": "attachment",
22
+ "data-state": n,
23
+ "data-size": r,
24
+ "data-orientation": i,
25
+ className: t("ck-attachment", e),
26
+ ...a
27
+ });
28
+ }), _ = d.forwardRef(function({ className: e, variant: n = "icon", ...r }, i) {
29
+ return /* @__PURE__ */ p("div", {
30
+ ref: i,
31
+ "data-slot": "attachment-media",
32
+ "data-variant": n,
33
+ className: t("ck-attachment-media", e),
34
+ ...r
35
+ });
36
+ });
37
+ d.forwardRef(function({ className: e, ...n }, r) {
38
+ return s("attachment"), /* @__PURE__ */ p("div", {
39
+ ref: r,
40
+ "data-slot": "attachment-group",
41
+ className: t("ck-attachment-group", e),
42
+ ...n
43
+ });
44
+ });
45
+ var v = d.forwardRef(function({ className: e, ...n }, r) {
46
+ return /* @__PURE__ */ p("div", {
47
+ ref: r,
48
+ "data-slot": "attachment-content",
49
+ className: t("ck-attachment-content", e),
50
+ ...n
51
+ });
52
+ }), y = d.forwardRef(function({ className: e, ...n }, r) {
53
+ return /* @__PURE__ */ p("span", {
54
+ ref: r,
55
+ "data-slot": "attachment-title",
56
+ className: t("ck-attachment-title", e),
57
+ ...n
58
+ });
59
+ }), b = d.forwardRef(function({ className: e, ...n }, r) {
60
+ return /* @__PURE__ */ p("span", {
61
+ ref: r,
62
+ "data-slot": "attachment-description",
63
+ className: t("ck-attachment-description", e),
64
+ ...n
65
+ });
66
+ });
67
+ d.forwardRef(function({ className: e, ...n }, r) {
68
+ return /* @__PURE__ */ p("div", {
69
+ ref: r,
70
+ "data-slot": "attachment-actions",
71
+ className: t("ck-attachment-actions", e),
72
+ ...n
73
+ });
74
+ }), d.forwardRef(function({ className: e, variant: t = "ghost", size: r = "icon-xs", ...i }, a) {
75
+ return /* @__PURE__ */ p(n, {
76
+ ref: a,
77
+ "data-slot": "attachment-action",
78
+ variant: t,
79
+ size: r,
80
+ className: e,
81
+ ...i
82
+ });
83
+ });
84
+ var x = d.forwardRef(function({ className: n, render: i, type: a, ...o }, s) {
85
+ return r({
86
+ defaultTagName: "button",
87
+ props: e({
88
+ ref: s,
89
+ type: i ? a : a ?? "button",
90
+ className: t("ck-attachment-trigger", n)
91
+ }, o),
92
+ render: i,
93
+ state: { slot: "attachment-trigger" }
94
+ });
95
+ }), S = () => import("./comment-image-lightbox-DmTNxuqX.js"), C = 3;
96
+ function w(e) {
97
+ return e.mimeType ? e.mimeType.startsWith("image/") : e.type === "screenshot" || e.type === "drawing" || e.thumbnail ? !0 : /^data:image\//i.test(e.url) || /\.(png|jpe?g|webp|gif|avif|svg)(?:[?#]|$)/i.test(e.filename ?? e.url);
98
+ }
99
+ function T(e) {
100
+ try {
101
+ let t = new URL(e, typeof window > "u" ? "https://commentkit.dev" : window.location.href);
102
+ return [
103
+ "http:",
104
+ "https:",
105
+ "blob:"
106
+ ].includes(t.protocol) ? t.href : void 0;
107
+ } catch {
108
+ return;
109
+ }
110
+ }
111
+ var E = d.memo(function({ images: e }) {
112
+ let [t, n] = d.useState(!1), [r, i] = d.useState(0), o = d.useRef(null), s = e.filter(w), c = e.filter((e) => !w(e)), l = s.length > C ? s.length - C : 0, u = s.slice(0, C), h = d.useCallback((e) => {
113
+ i(e), n(!0);
114
+ }, []);
115
+ return e.length === 0 ? null : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", {
116
+ className: "ck-comment-images",
117
+ onClick: (e) => {
118
+ e.stopPropagation();
119
+ },
120
+ children: [u.map((e, t) => /* @__PURE__ */ p(D, {
121
+ image: e,
122
+ index: t,
123
+ more: t === u.length - 1 ? l : 0,
124
+ onOpen: (e) => {
125
+ o.current = e, h(t);
126
+ }
127
+ }, e.id)), c.map((e) => /* @__PURE__ */ p(O, { file: e }, e.id))]
128
+ }), /* @__PURE__ */ p(a, {
129
+ load: S,
130
+ label: "image viewer",
131
+ needed: t,
132
+ onCancel: () => n(!1),
133
+ children: ({ CommentImageLightbox: e }) => /* @__PURE__ */ p(e, {
134
+ images: s,
135
+ initialIndex: r,
136
+ open: t,
137
+ returnFocusRef: o,
138
+ onClose: () => {
139
+ n(!1);
140
+ }
141
+ })
142
+ })] });
143
+ });
144
+ function D({ image: e, index: t, more: n, onOpen: r }) {
145
+ let a = l(e), s = e.filename ?? e.alt ?? `Image ${String(t + 1)}`;
146
+ return /* @__PURE__ */ m(g, {
147
+ orientation: "vertical",
148
+ children: [
149
+ /* @__PURE__ */ p(_, {
150
+ variant: "image",
151
+ children: /* @__PURE__ */ p(h, {
152
+ ratio: 1,
153
+ className: "ck-comment-image-ratio",
154
+ children: a.failed ? /* @__PURE__ */ p(u, {
155
+ link: a,
156
+ compact: !0
157
+ }) : /* @__PURE__ */ p("img", {
158
+ src: e.url,
159
+ alt: s,
160
+ className: "ck-comment-image",
161
+ onError: a.onError
162
+ }, `${e.url}:${a.attempt}`)
163
+ })
164
+ }),
165
+ n > 0 ? /* @__PURE__ */ m(o, {
166
+ variant: "secondary",
167
+ className: "ck-comment-image-more",
168
+ children: ["+", n]
169
+ }) : null,
170
+ /* @__PURE__ */ p(x, {
171
+ "aria-label": `Open ${s}`,
172
+ title: [
173
+ e.type,
174
+ e.filename,
175
+ i(e.size)
176
+ ].filter(Boolean).join(" • ") || void 0,
177
+ onClick: (e) => {
178
+ e.stopPropagation(), r(e.currentTarget);
179
+ }
180
+ })
181
+ ]
182
+ });
183
+ }
184
+ function O({ file: e }) {
185
+ let t = l(e), n = e.filename ?? e.alt ?? "Attachment", r = T(e.url);
186
+ return /* @__PURE__ */ m(g, {
187
+ className: "ck-comment-file",
188
+ children: [
189
+ /* @__PURE__ */ p(_, { children: /* @__PURE__ */ m("svg", {
190
+ viewBox: "0 0 24 24",
191
+ fill: "none",
192
+ stroke: "currentColor",
193
+ strokeWidth: "1.5",
194
+ "aria-hidden": "true",
195
+ children: [/* @__PURE__ */ p("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6Z" }), /* @__PURE__ */ p("path", { d: "M14 2v6h6M8 13h8M8 17h5" })]
196
+ }) }),
197
+ /* @__PURE__ */ m(v, { children: [/* @__PURE__ */ p(y, { children: n }), /* @__PURE__ */ p(b, { children: t.refreshFailed ? "Could not refresh. Try again." : t.loading ? "Refreshing link…" : i(e.size) ?? "File" })] }),
198
+ r ? /* @__PURE__ */ p(x, {
199
+ render: /* @__PURE__ */ p("a", {
200
+ href: r,
201
+ download: n,
202
+ target: "_blank",
203
+ rel: "noopener noreferrer"
204
+ }),
205
+ "aria-label": `Download ${n}`,
206
+ "aria-disabled": t.loading || void 0,
207
+ onClick: (r) => {
208
+ t.loading ? r.preventDefault() : c(e.url) && (r.preventDefault(), t.download(n));
209
+ }
210
+ }) : null
211
+ ]
212
+ });
213
+ }
214
+ export { E as CommentImagesContent };