@commentkit/comment-kit 0.7.0 → 0.7.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.
- package/CHANGELOG.md +27 -0
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +5 -5
- package/dist/demo.es.js +4 -3
- package/dist/headless.es.js +3 -3
- package/dist/preact.es.js +2 -2
- package/dist/qwik.qwik.mjs +2 -2
- package/dist/react.es.js +2 -2
- package/dist/shared/{annotation-toolbar-B9SxYqoF.js → annotation-toolbar-cGC1p-SP.js} +379 -379
- package/dist/shared/attachment-refresh-CzQFXHkL.js +94 -0
- package/dist/shared/{button-group-Cl9CrvvU.js → button-group-CWdKaOlC.js} +14 -16
- package/dist/shared/capture-colors-CxSLsU5-.js +74 -0
- package/dist/shared/{comment-drawing-canvas-Dzb5YoFw.js → comment-drawing-canvas-DdXlMgbF.js} +2 -2
- package/dist/shared/{comment-utils-BycYTSxA.js → comment-icon-Dg9ZWpz-.js} +29 -23
- package/dist/shared/comment-image-lightbox-B7iHjnAz.js +190 -0
- package/dist/shared/comment-images-content-D7YNUgo5.js +214 -0
- package/dist/shared/{comment-kit-core-BaSuMzp9.js → comment-kit-core-C862uNAm.js} +998 -778
- package/dist/shared/{comment-kit-ui-CzfdAZs2.js → comment-kit-ui-0vd-DY4S.js} +5206 -5410
- package/dist/shared/{comment-screenshot-annotator-C7X-_bm6.js → comment-screenshot-annotator-DcaSSuWB.js} +5 -5
- package/dist/shared/{comment-screenshot-overlay-wIrZrcRy.js → comment-screenshot-overlay-D_nFoJmM.js} +6 -5
- package/dist/shared/{dev-export-panel-FwFVdady.js → dev-export-panel-pWBlhlse.js} +7 -7
- package/dist/shared/dev-grab-eQ9EgEGY.js +210 -0
- package/dist/shared/{element-selector-BhJm-NSs.js → element-selector-DC-_XJ0k.js} +311 -272
- package/dist/shared/{mount-ui--ijs8pWT.js → mount-ui-B68j8r6I.js} +4 -4
- package/dist/shared/{pusher-ipHMJnO_.js → pusher-C1FHQGXV.js} +1 -1
- package/dist/shared/realtime-Diqz7G_y.js +317 -0
- package/dist/shared/realtime-recovery-DJ_adc-H.js +135 -0
- package/dist/shared/{shadow-root-C5v-T8lQ.js → shadow-root-CrO75sED.js} +1 -1
- package/dist/shared/{styles-D3yMtaec.js → styles-C9Jwvm0Q.js} +1 -1
- package/dist/shared/useRender-D1z_X_BY.js +5 -0
- package/dist/shared/{validation-C7QG8j7Z.js → validation-D-8u4M7I.js} +14 -1
- package/dist/shared/{websocket-manager-DhLWh3Jr.js → websocket-manager-CFak_YHy.js} +148 -89
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +8 -1
- package/dist/types/core/comment-kit-core.d.ts +9 -0
- package/dist/types/core/types.d.ts +35 -0
- package/dist/types/core/websocket-manager.d.ts +12 -0
- package/dist/types/core/write-access.d.ts +9 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +6 -0
- package/package.json +3 -2
- package/dist/shared/comment-image-lightbox-BPYJT1sB.js +0 -183
- package/dist/shared/dev-grab-DDqg0LQf.js +0 -203
- package/dist/shared/realtime-Dk41VwKg.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-0vd-DY4S.js";
|
|
4
|
+
import { n as c, r as l, t as u } from "./attachment-refresh-CzQFXHkL.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-B7iHjnAz.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 };
|