@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,94 @@
|
|
|
1
|
+
import { s as e } from "./validation-D-8u4M7I.js";
|
|
2
|
+
import { n as t } from "./dist-De294MVF.js";
|
|
3
|
+
import { t as n } from "./button-By0hGrJK.js";
|
|
4
|
+
import { q as r } from "./comment-kit-ui-0vd-DY4S.js";
|
|
5
|
+
import * as i from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
function s(e) {
|
|
8
|
+
try {
|
|
9
|
+
let t = new URL(e, "https://commentkit.dev"), n = t.searchParams.get("expires");
|
|
10
|
+
return t.searchParams.has("signature") && /^\d{1,12}$/.test(n ?? "") && Number(n) * 1e3 <= Date.now() + 3e4;
|
|
11
|
+
} catch {
|
|
12
|
+
return !1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function c(t) {
|
|
16
|
+
return e(t, !0) ? new URL(t, window.location.href).href : null;
|
|
17
|
+
}
|
|
18
|
+
function l(e) {
|
|
19
|
+
let n = i.useContext(r), a = i.useRef(e);
|
|
20
|
+
a.current = e;
|
|
21
|
+
let o = i.useRef(!0), l = i.useRef(null), u = i.useRef(null), d = i.useRef(null), [f, p] = i.useState(null), [m, h] = i.useState(!1), [g, _] = i.useState(!1), [v, y] = i.useState(0);
|
|
22
|
+
i.useEffect(() => (o.current = !0, () => {
|
|
23
|
+
o.current = !1;
|
|
24
|
+
}), []);
|
|
25
|
+
let b = !!(e && f === e.url), x = async () => {
|
|
26
|
+
if (!e || !n) return null;
|
|
27
|
+
if (l.current && u.current === e.id) return l.current;
|
|
28
|
+
let t = e.id, r = {};
|
|
29
|
+
d.current = r, u.current = t, _(!0), h(!1);
|
|
30
|
+
let i = (async () => {
|
|
31
|
+
try {
|
|
32
|
+
let e = await Promise.resolve().then(() => n(t)), r = e ? c(e) : null;
|
|
33
|
+
return !o.current || a.current?.id !== t ? null : r ? (p(null), y((e) => e + 1), r) : (p(a.current.url), h(!0), null);
|
|
34
|
+
} catch {
|
|
35
|
+
return o.current && a.current?.id === t && (p(a.current.url), h(!0)), null;
|
|
36
|
+
} finally {
|
|
37
|
+
d.current === r && (l.current = null, o.current && _(!1));
|
|
38
|
+
}
|
|
39
|
+
})();
|
|
40
|
+
return l.current = i, i;
|
|
41
|
+
}, S = async () => e ? b || s(e.url) ? x() : c(e.url) : null;
|
|
42
|
+
return {
|
|
43
|
+
failed: b,
|
|
44
|
+
refreshFailed: m,
|
|
45
|
+
loading: g,
|
|
46
|
+
attempt: v,
|
|
47
|
+
refresh: x,
|
|
48
|
+
resolve: S,
|
|
49
|
+
download: async (n) => {
|
|
50
|
+
if (!e) return;
|
|
51
|
+
let r = b || s(e.url), i = r ? window.open("about:blank", "_blank") : null;
|
|
52
|
+
i && (i.opener = null);
|
|
53
|
+
let a = await S();
|
|
54
|
+
if (!a) {
|
|
55
|
+
i?.close(), t.error("Could not refresh the attachment. Try again.");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (i) {
|
|
59
|
+
try {
|
|
60
|
+
!i.closed && i.location.href === "about:blank" && i.location.replace(a);
|
|
61
|
+
} catch {}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (r) {
|
|
65
|
+
t.info("Link refreshed. Select Download again to open it.");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let o = document.createElement("a");
|
|
69
|
+
o.href = a, o.download = n, o.target = "_blank", o.rel = "noopener noreferrer", o.click();
|
|
70
|
+
},
|
|
71
|
+
canRefresh: !!n,
|
|
72
|
+
onError: () => {
|
|
73
|
+
e && p(e.url);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function u({ link: e, compact: t = !1 }) {
|
|
78
|
+
return /* @__PURE__ */ o("div", {
|
|
79
|
+
className: `ck-attachment-error${t ? " ck-attachment-error-compact" : ""}`,
|
|
80
|
+
role: "status",
|
|
81
|
+
onClick: (e) => e.stopPropagation(),
|
|
82
|
+
children: [/* @__PURE__ */ a("p", { children: e.refreshFailed ? t ? "Could not refresh." : "Could not refresh this preview. Try again." : t ? "Preview unavailable." : "Preview unavailable. The link may have expired." }), e.canRefresh ? /* @__PURE__ */ a(n, {
|
|
83
|
+
variant: "outline",
|
|
84
|
+
size: "sm",
|
|
85
|
+
disabled: e.loading,
|
|
86
|
+
"aria-label": "Refresh preview",
|
|
87
|
+
onClick: () => {
|
|
88
|
+
e.refresh();
|
|
89
|
+
},
|
|
90
|
+
children: e.loading ? t ? "…" : "Refreshing…" : t ? "Refresh" : "Refresh preview"
|
|
91
|
+
}) : null]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export { s as n, l as r, u as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { O as e, c as t, d as n, s as r
|
|
2
|
-
import { t as
|
|
1
|
+
import { O as e, c as t, d as n, s as r } from "./button-By0hGrJK.js";
|
|
2
|
+
import { t as i } from "./separator-XDBsaWyw.js";
|
|
3
|
+
import { t as a } from "./useRender-D1z_X_BY.js";
|
|
3
4
|
import * as o from "react";
|
|
4
5
|
import { jsx as s } from "react/jsx-runtime";
|
|
5
6
|
var c = "ArrowUp", l = "ArrowDown", u = "ArrowLeft", d = "ArrowRight", f = "Home", p = "PageUp", m = "PageDown", h = /* @__PURE__ */ new Set([
|
|
@@ -56,10 +57,7 @@ function x(e) {
|
|
|
56
57
|
scrollPaddingLeft: parseFloat(t.scrollPaddingLeft) || 0
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
return i(e.defaultTagName ?? "div", e, e);
|
|
61
|
-
}
|
|
62
|
-
var C = o.forwardRef(function({ className: e, orientation: t = "horizontal", ...n }, i) {
|
|
60
|
+
var S = o.forwardRef(function({ className: e, orientation: t = "horizontal", ...n }, i) {
|
|
63
61
|
return /* @__PURE__ */ s("div", {
|
|
64
62
|
ref: i,
|
|
65
63
|
role: "group",
|
|
@@ -69,25 +67,25 @@ var C = o.forwardRef(function({ className: e, orientation: t = "horizontal", ...
|
|
|
69
67
|
...n
|
|
70
68
|
});
|
|
71
69
|
});
|
|
72
|
-
|
|
73
|
-
var
|
|
74
|
-
return
|
|
70
|
+
S.displayName = "ButtonGroup";
|
|
71
|
+
var C = o.forwardRef(function({ className: e, render: t, ...i }, o) {
|
|
72
|
+
return a({
|
|
75
73
|
defaultTagName: "div",
|
|
76
|
-
ref:
|
|
74
|
+
ref: o,
|
|
77
75
|
props: n({ className: r("ck-button-group-text", e) }, i),
|
|
78
76
|
render: t,
|
|
79
77
|
state: { slot: "button-group-text" }
|
|
80
78
|
});
|
|
81
79
|
});
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
return /* @__PURE__ */ s(
|
|
85
|
-
ref:
|
|
80
|
+
C.displayName = "ButtonGroupText";
|
|
81
|
+
var w = o.forwardRef(function({ className: e, orientation: n = "vertical", ...r }, a) {
|
|
82
|
+
return /* @__PURE__ */ s(i, {
|
|
83
|
+
ref: a,
|
|
86
84
|
"data-slot": "button-group-separator",
|
|
87
85
|
orientation: n,
|
|
88
86
|
className: t("ck-button-group-separator", e),
|
|
89
87
|
...r
|
|
90
88
|
});
|
|
91
89
|
});
|
|
92
|
-
|
|
93
|
-
export {
|
|
90
|
+
w.displayName = "ButtonGroupSeparator";
|
|
91
|
+
export { c as a, g as c, v as d, y as f, d as i, m as l, l as n, h as o, u as r, f as s, S as t, p as u };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var e = [
|
|
2
|
+
"background-color",
|
|
3
|
+
"background-image",
|
|
4
|
+
"color",
|
|
5
|
+
"border-top-color",
|
|
6
|
+
"border-right-color",
|
|
7
|
+
"border-bottom-color",
|
|
8
|
+
"border-left-color",
|
|
9
|
+
"box-shadow",
|
|
10
|
+
"text-shadow",
|
|
11
|
+
"text-decoration-color",
|
|
12
|
+
"-webkit-text-stroke-color",
|
|
13
|
+
"list-style-image",
|
|
14
|
+
"fill",
|
|
15
|
+
"stroke"
|
|
16
|
+
];
|
|
17
|
+
function t(e, t) {
|
|
18
|
+
let n = 1, r = "";
|
|
19
|
+
for (let i = t; i < e.length; i++) {
|
|
20
|
+
let t = e[i];
|
|
21
|
+
if (t === "\\") i++;
|
|
22
|
+
else if (r) t === r && (r = "");
|
|
23
|
+
else if (t === "\"" || t === "'") r = t;
|
|
24
|
+
else if (t === "(") n++;
|
|
25
|
+
else if (t === ")" && --n === 0) return i;
|
|
26
|
+
}
|
|
27
|
+
return -1;
|
|
28
|
+
}
|
|
29
|
+
function n(n) {
|
|
30
|
+
let r = n.defaultView;
|
|
31
|
+
if (!r) return;
|
|
32
|
+
let i = null, a = /* @__PURE__ */ new Map(), o = (e) => {
|
|
33
|
+
let t = a.get(e);
|
|
34
|
+
if (t) return t;
|
|
35
|
+
if (!i) {
|
|
36
|
+
let e = n.createElement("canvas");
|
|
37
|
+
if (e.width = e.height = 1, i = e.getContext("2d", {
|
|
38
|
+
colorSpace: "srgb",
|
|
39
|
+
willReadFrequently: !0
|
|
40
|
+
}), !i) throw Error("Screenshot color conversion is unavailable");
|
|
41
|
+
}
|
|
42
|
+
if (i.fillStyle = "#010203", i.fillStyle = e, i.fillStyle === "#010203" && (i.fillStyle = "#040506", i.fillStyle = e, i.fillStyle === "#040506")) throw Error("Unsupported screenshot color");
|
|
43
|
+
i.clearRect(0, 0, 1, 1), i.fillRect(0, 0, 1, 1);
|
|
44
|
+
let [r, o, s, c] = i.getImageData(0, 0, 1, 1).data, l = `rgba(${r}, ${o}, ${s}, ${c / 255})`;
|
|
45
|
+
return a.set(e, l), l;
|
|
46
|
+
}, s = (e) => {
|
|
47
|
+
let n = /\b(url|oklch|oklab|lch|lab|hwb|color|color-mix|light-dark|(?:repeating-)?(?:linear|radial)-gradient)\(/gi, r = "", i = 0;
|
|
48
|
+
for (let a = n.exec(e); a; a = n.exec(e)) {
|
|
49
|
+
let c = t(e, n.lastIndex);
|
|
50
|
+
if (c < 0) return e;
|
|
51
|
+
let l = e.slice(a.index, c + 1), u = a[1].toLowerCase(), d = l;
|
|
52
|
+
if (u.endsWith("gradient")) {
|
|
53
|
+
let t = s(e.slice(n.lastIndex, c)), r = t.indexOf(","), i = t.slice(0, r), a = i.replace(/\s*\bin\s+[\w-]+(?:\s+(?:shorter|longer|increasing|decreasing)\s+hue)?\s*/i, "").trim();
|
|
54
|
+
a !== i.trim() && (t = (a ? a + "," : "") + t.slice(r + 1)), d = `${u}(${t})`;
|
|
55
|
+
} else u !== "url" && (d = o(l));
|
|
56
|
+
r += e.slice(i, a.index) + d, i = n.lastIndex = c + 1;
|
|
57
|
+
}
|
|
58
|
+
return r + e.slice(i);
|
|
59
|
+
}, c = [];
|
|
60
|
+
for (let t of n.querySelectorAll("*")) {
|
|
61
|
+
if (!t.style) continue;
|
|
62
|
+
let n = r.getComputedStyle(t);
|
|
63
|
+
for (let r of e) {
|
|
64
|
+
let e = n.getPropertyValue(r), i = s(e);
|
|
65
|
+
i !== e && c.push([
|
|
66
|
+
t.style,
|
|
67
|
+
r,
|
|
68
|
+
i
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (let [e, t, n] of c) e.setProperty(t, n, "important");
|
|
73
|
+
}
|
|
74
|
+
export { n as normalizeCaptureColors };
|
package/dist/shared/{comment-drawing-canvas-Dzb5YoFw.js → comment-drawing-canvas-DdXlMgbF.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./annotation-toolbar-
|
|
2
|
-
import {
|
|
1
|
+
import { n as e, r as t, t as n } from "./annotation-toolbar-cGC1p-SP.js";
|
|
2
|
+
import { N as r, a as i, g as a, i as o } from "./comment-kit-ui-0vd-DY4S.js";
|
|
3
3
|
import * as s from "react";
|
|
4
4
|
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
5
|
var d = ".ck-annotation-toolbar{background-color:var(--background);width:100%;max-width:100%;box-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a, 0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);border-radius:2rem;flex-wrap:wrap;justify-content:center;align-items:center;gap:.375rem .5rem;margin-inline:auto;padding:.375rem;display:flex}@media (width>=1024px){.ck-annotation-toolbar{width:fit-content}}.ck-annotation-separator.ck-separator[data-orientation=vertical]{height:1rem;display:none}@media (width>=1024px){.ck-annotation-separator.ck-separator[data-orientation=vertical]{display:block}}.ck-annotation-stroke{align-items:center;gap:.5rem;width:7rem;padding-inline:.25rem;display:flex}@media (width>=1024px){.ck-annotation-stroke{width:12rem}}.ck-annotation-slider{flex:auto;min-width:0}.ck-annotation-stroke-label{color:var(--muted-foreground);font-variant-numeric:tabular-nums;flex-shrink:0;font-size:.75rem;line-height:1rem}.ck-annotation-swatch{background-color:var(--ck-bg);width:.875rem;height:.875rem;box-shadow:0 0 0 1px color-mix(in oklch, var(--foreground) 5%, transparent);border-radius:999px}.ck-annotation-tooltip{align-items:center;gap:.375rem;display:inline-flex}.ck-annotation-save--disabled{opacity:.5}.ck-drawing-canvas{z-index:var(--z-ck-marker-layer);cursor:none;pointer-events:auto;flex-direction:column;padding-top:1rem;display:flex;position:fixed;inset:0}.ck-drawing-canvas-scrim{pointer-events:none;background-color:#0000004d;position:absolute;inset:0}@supports ((-webkit-backdrop-filter:blur(4px)) or (backdrop-filter:blur(4px))){.ck-drawing-canvas-scrim{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}}.ck-drawing-canvas-toolbar{z-index:1;cursor:auto;width:100%;min-width:0;margin-inline:auto;padding-inline:.75rem;position:relative}.ck-drawing-canvas-surface{z-index:0;touch-action:none;flex:auto;min-height:0;position:relative}.ck-drawing-canvas-error{border-radius:var(--radius-md);background:var(--background);width:max-content;max-width:calc(100vw - 1.5rem);color:var(--destructive);margin:.75rem auto;padding:.75rem;font-size:.875rem}";
|
|
@@ -90,7 +90,7 @@ function Fe(e) {
|
|
|
90
90
|
t.length === 0 ? n !== "0" && (e.setAttribute("tabindex", "0"), e.setAttribute("data-tabindex", "0")) : (n !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
|
|
91
91
|
}
|
|
92
92
|
function Ie(e) {
|
|
93
|
-
let { context: n, children: i, disabled: o = !1, initialFocus: c = !0, returnFocus: u = !0, explicitReturnFocus: ue, restoreFocus: b = !1, modal: x = !0, closeOnFocusOut: S = !0, openInteractionType: xe = "", nextFocusableElement: C, previousFocusableElement: w, beforeContentFocusGuardRef: D, externalTree: Ee, getInsideElements: k } = e, A = n.useState("open"), j = n.useState("domReferenceElement"), M = n.useState("floatingElement"), { events: N, dataRef: P } = n.context, F = s(() => P.current.floatingContext?.nodeId), De = c === !1, I = de(j) && De, Ae = m(c), L = m(u), Ie = m(ue), R = m(xe), Le = m(A), z = ee(Ee), B = re(), V = T.useRef(!1), H = T.useRef(!1), U = T.useRef(!1), Re = T.useRef(null), W = T.useRef(""), G = T.useRef(""), K = T.useRef(null), q = T.useRef(null), ze = a(K, D, B?.beforeInsideRef), Be = a(q, B?.afterInsideRef), Ve = Se(), J = Se(),
|
|
93
|
+
let { context: n, children: i, disabled: o = !1, initialFocus: c = !0, returnFocus: u = !0, explicitReturnFocus: ue, restoreFocus: b = !1, modal: x = !0, closeOnFocusOut: S = !0, openInteractionType: xe = "", nextFocusableElement: C, previousFocusableElement: w, beforeContentFocusGuardRef: D, externalTree: Ee, getInsideElements: k } = e, A = n.useState("open"), j = n.useState("domReferenceElement"), M = n.useState("floatingElement"), { events: N, dataRef: P } = n.context, F = s(() => P.current.floatingContext?.nodeId), De = c === !1, I = de(j) && De, Ae = m(c), L = m(u), Ie = m(ue), R = m(xe), Le = m(A), z = ee(Ee), B = re(), V = T.useRef(!1), H = T.useRef(!1), U = T.useRef(!1), Re = T.useRef(null), W = T.useRef(""), G = T.useRef(""), K = T.useRef(null), q = T.useRef(null), ze = a(K, D, B?.beforeInsideRef), Be = a(q, B?.afterInsideRef), Ve = Se(), J = Se(), He = ne(), Y = B != null, X = fe(M), Z = s((e = X) => e ? be(e) : []), Q = s(() => k?.().filter((e) => e != null) ?? []);
|
|
94
94
|
T.useEffect(() => {
|
|
95
95
|
if (o || !x) return;
|
|
96
96
|
function e(e) {
|
|
@@ -156,7 +156,7 @@ function Ie(e) {
|
|
|
156
156
|
].includes(i), f = !(d(j, i) || d(M, i) || d(i, M) || d(B?.portalNode, i) || l.some((e) => e === i || d(e, i)) || c.hasMatchingElement((e) => d(e, i)) || u || z && (ve(z.nodesRef.current, s).find((e) => d(e.context?.elements.floating, i) || d(e.context?.elements.domReference, i)) || he(z.nodesRef.current, s).find((e) => [e.context?.elements.floating, fe(e.context?.elements.floating)].includes(i) || e.context?.elements.domReference === i)));
|
|
157
157
|
if (a === j && X && Fe(X), b && a !== j && !ce(o) && v(e) === e.body) {
|
|
158
158
|
if (r(X) && (X.focus(), b === "popup")) {
|
|
159
|
-
|
|
159
|
+
He.request(() => {
|
|
160
160
|
X.focus();
|
|
161
161
|
});
|
|
162
162
|
return;
|
|
@@ -191,7 +191,7 @@ function Ie(e) {
|
|
|
191
191
|
P,
|
|
192
192
|
Ve,
|
|
193
193
|
J,
|
|
194
|
-
|
|
194
|
+
He,
|
|
195
195
|
C,
|
|
196
196
|
w,
|
|
197
197
|
Q
|
|
@@ -341,7 +341,7 @@ function Ie(e) {
|
|
|
341
341
|
queueMicrotask(je);
|
|
342
342
|
};
|
|
343
343
|
}, [o, X]);
|
|
344
|
-
let Ue = !o && (!x || !I) && (
|
|
344
|
+
let Ue = !o && (!x || !I) && (Y || x);
|
|
345
345
|
return /*#__PURE__*/ Te(T.Fragment, { children: [
|
|
346
346
|
Ue && /*#__PURE__*/ E(ae, {
|
|
347
347
|
"data-type": "inside",
|
|
@@ -570,7 +570,7 @@ function J(e, t) {
|
|
|
570
570
|
onPointerDown: r
|
|
571
571
|
}), [n, r]);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function He(e) {
|
|
574
574
|
let [t, n] = T.useState(null), r = J(e, n);
|
|
575
575
|
return w(e, (t) => {
|
|
576
576
|
t && !e && n(null);
|
|
@@ -579,24 +579,30 @@ function Y(e) {
|
|
|
579
579
|
triggerProps: r
|
|
580
580
|
}), [t, r]);
|
|
581
581
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
582
|
+
function Y({ className: e, children: t, strokeWidth: n = 2, ...r }) {
|
|
583
|
+
return /* @__PURE__ */ E("svg", {
|
|
584
|
+
viewBox: "0 0 24 24",
|
|
585
|
+
fill: "none",
|
|
586
|
+
stroke: "currentColor",
|
|
587
|
+
strokeWidth: n,
|
|
588
|
+
strokeLinecap: "round",
|
|
589
|
+
strokeLinejoin: "round",
|
|
590
|
+
"aria-hidden": "true",
|
|
591
|
+
...r,
|
|
592
|
+
className: e,
|
|
593
|
+
children: t
|
|
594
|
+
});
|
|
590
595
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
};
|
|
596
|
-
function Q(e) {
|
|
597
|
-
return e.status === "resolved" || e.status === "complete" || e.isResolved === !0;
|
|
596
|
+
function X(e) {
|
|
597
|
+
return /* @__PURE__ */ Te(Y, {
|
|
598
|
+
...e,
|
|
599
|
+
children: [/* @__PURE__ */ E("path", { d: "M9.14339 10.691L9.35031 10.4841C11.329 8.50532 14.5372 8.50532 16.5159 10.4841C18.4947 12.4628 18.4947 15.671 16.5159 17.6497L13.6497 20.5159C11.671 22.4947 8.46279 22.4947 6.48405 20.5159C4.50532 18.5372 4.50532 15.329 6.48405 13.3503L6.9484 12.886" }), /* @__PURE__ */ E("path", { d: "M17.0516 11.114L17.5159 10.6497C19.4947 8.67095 19.4947 5.46279 17.5159 3.48405C15.5372 1.50532 12.329 1.50532 10.3503 3.48405L7.48405 6.35031C5.50532 8.32904 5.50532 11.5372 7.48405 13.5159C9.46279 15.4947 12.671 15.4947 14.6497 13.5159L14.8566 13.309" })]
|
|
600
|
+
});
|
|
598
601
|
}
|
|
599
|
-
function
|
|
600
|
-
return
|
|
602
|
+
function Z(e) {
|
|
603
|
+
return /* @__PURE__ */ E(Y, {
|
|
604
|
+
...e,
|
|
605
|
+
children: /* @__PURE__ */ E("path", { d: "M5 14.5C5 14.5 6.5 14.5 8.5 18C8.5 18 14.0588 8.83333 19 7" })
|
|
606
|
+
});
|
|
601
607
|
}
|
|
602
|
-
export {
|
|
608
|
+
export { J as a, Le as c, O as d, He as i, R as l, X as n, Be as o, Z as r, ze as s, Y as t, Ie as u };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { n as e } from "./dist-De294MVF.js";
|
|
2
|
+
import { s as t, t as n } from "./button-By0hGrJK.js";
|
|
3
|
+
import { i as r, o as i, r as a } from "./separator-XDBsaWyw.js";
|
|
4
|
+
import { t as o } from "./comment-icon-Dg9ZWpz-.js";
|
|
5
|
+
import { t as s } from "./button-group-CWdKaOlC.js";
|
|
6
|
+
import { c, h as l, m as u, p as d } from "./comment-kit-ui-0vd-DY4S.js";
|
|
7
|
+
import { r as f, t as p } from "./attachment-refresh-CzQFXHkL.js";
|
|
8
|
+
import * as m from "react";
|
|
9
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
|
+
var v = ".ck-dialog-content.ck-image-lightbox{width:100vw;max-width:none;height:100dvh;max-height:none;box-shadow:none;background-color:#0000;border:0;border-radius:0;justify-content:center;align-items:center;gap:0;padding:0;display:flex;inset:0;translate:none}@media (width>=640px){.ck-dialog-content.ck-image-lightbox{max-width:none}}.ck-root[data-theme=dark] .ck-dialog-content.ck-image-lightbox{box-shadow:none}.ck-image-lightbox-prev,.ck-image-lightbox-next{position:absolute}.ck-image-lightbox-prev{inset-inline-start:1rem}.ck-image-lightbox-next{inset-inline-end:1rem}.ck-image-lightbox-photo{object-fit:contain;width:auto;max-width:90vw;height:auto;max-height:90vh}.ck-image-lightbox-meta{border-radius:var(--radius-xl);background-color:var(--muted);text-align:center;max-width:90vw;color:var(--muted-foreground);padding:.25rem .625rem;font-size:.75rem;line-height:1rem;position:absolute;bottom:3.5rem;left:50%;transform:translate(-50%)}.ck-image-lightbox-actions{top:1rem;position:absolute;inset-inline-end:1rem}.ck-image-lightbox-dots{gap:.5rem;display:flex;position:absolute;bottom:1.5rem}.ck-image-lightbox-dot{cursor:pointer;background-color:color-mix(in oklch, var(--foreground) 40%, transparent);border:0;border-radius:999px;width:.625rem;height:.625rem;padding:0;transition:background-color .15s cubic-bezier(.4,0,.2,1)}.ck-image-lightbox-dot:hover{background-color:color-mix(in oklch, var(--foreground) 60%, transparent)}.ck-image-lightbox-dot--active,.ck-image-lightbox-dot--active:hover{background-color:var(--foreground)}";
|
|
11
|
+
function y() {
|
|
12
|
+
return /* @__PURE__ */ g(o, {
|
|
13
|
+
strokeWidth: 1.5,
|
|
14
|
+
children: /* @__PURE__ */ g("path", { d: "M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18" })
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function b() {
|
|
18
|
+
return /* @__PURE__ */ g(o, {
|
|
19
|
+
strokeWidth: 1.5,
|
|
20
|
+
children: /* @__PURE__ */ g("path", { d: "M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18" })
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function x() {
|
|
24
|
+
return /* @__PURE__ */ _(o, {
|
|
25
|
+
strokeWidth: 1.5,
|
|
26
|
+
children: [/* @__PURE__ */ g("path", { d: "M7.5 14.5C7.5 11.2002 7.5 9.55025 8.52513 8.52513C9.55025 7.5 11.2002 7.5 14.5 7.5C17.7998 7.5 19.4497 7.5 20.4749 8.52513C21.5 9.55025 21.5 11.2002 21.5 14.5C21.5 17.7998 21.5 19.4497 20.4749 20.4749C19.4497 21.5 17.7998 21.5 14.5 21.5C11.2002 21.5 9.55025 21.5 8.52513 20.4749C7.5 19.4497 7.5 17.7998 7.5 14.5Z" }), /* @__PURE__ */ g("path", { d: "M7.5 16.5C6.10355 16.5 5.40533 16.5 4.84402 16.3036C3.83866 15.9518 3.0482 15.1613 2.69641 14.156C2.5 13.5947 2.5 12.8964 2.5 11.5V9.5C2.5 6.20017 2.5 4.55025 3.52513 3.52513C4.55025 2.5 6.20017 2.5 9.5 2.5H11.5C12.8964 2.5 13.5947 2.5 14.156 2.69641C15.1613 3.0482 15.9518 3.83866 16.3036 4.84402C16.5 5.40533 16.5 6.10355 16.5 7.5" })]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function S() {
|
|
30
|
+
return /* @__PURE__ */ _(o, {
|
|
31
|
+
strokeWidth: 1.5,
|
|
32
|
+
children: [/* @__PURE__ */ g("path", { d: "M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" }), /* @__PURE__ */ g("path", { d: "M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" })]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function C() {
|
|
36
|
+
return /* @__PURE__ */ g(o, {
|
|
37
|
+
strokeWidth: 1.5,
|
|
38
|
+
children: /* @__PURE__ */ g("path", { d: "M18 6L6.00081 17.9992M17.9992 18L6 6.00085" })
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
var w = m.memo(function({ images: o, initialIndex: v, open: w, onClose: T, returnFocusRef: E }) {
|
|
42
|
+
let [D, O] = m.useState(v);
|
|
43
|
+
m.useEffect(() => {
|
|
44
|
+
w && O(Math.max(0, Math.min(v, o.length - 1)));
|
|
45
|
+
}, [
|
|
46
|
+
v,
|
|
47
|
+
w,
|
|
48
|
+
o.length
|
|
49
|
+
]);
|
|
50
|
+
let k = o[D], A = f(k), j = !!(k && (k.type ?? k.filename ?? k.size != null)), M = async (t) => {
|
|
51
|
+
if (t.stopPropagation(), k) try {
|
|
52
|
+
let t = await A.resolve();
|
|
53
|
+
if (!t) throw Error("Attachment unavailable");
|
|
54
|
+
let n = new URL(t, window.location.href);
|
|
55
|
+
if (n.protocol !== "http:" && n.protocol !== "https:" && n.protocol !== "data:" && n.protocol !== "blob:") throw Error("Invalid image URL protocol");
|
|
56
|
+
let r = await fetch(n.href).catch((e) => {
|
|
57
|
+
throw A.onError(), e;
|
|
58
|
+
});
|
|
59
|
+
if (!r.ok) throw A.onError(), Error(`Failed to fetch image (${String(r.status)})`);
|
|
60
|
+
let i = await r.blob();
|
|
61
|
+
await navigator.clipboard.write([new ClipboardItem({ [i.type]: i })]), e.success("Image copied");
|
|
62
|
+
} catch {
|
|
63
|
+
e.error("Failed to copy image");
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ g(d, {
|
|
67
|
+
open: w && o.length > 0,
|
|
68
|
+
onOpenChange: (e) => {
|
|
69
|
+
e || T();
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ _(u, {
|
|
72
|
+
showCloseButton: !1,
|
|
73
|
+
finalFocus: E,
|
|
74
|
+
"aria-describedby": void 0,
|
|
75
|
+
className: "ck-image-lightbox",
|
|
76
|
+
onClick: T,
|
|
77
|
+
onKeyDownCapture: (e) => {
|
|
78
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
79
|
+
e.preventDefault(), e.stopPropagation();
|
|
80
|
+
let t = e.key === "ArrowLeft" ? -1 : 1;
|
|
81
|
+
O((e) => Math.max(0, Math.min(o.length - 1, e + t)));
|
|
82
|
+
},
|
|
83
|
+
children: [/* @__PURE__ */ g(l, {
|
|
84
|
+
className: "ck-sr-only",
|
|
85
|
+
children: "Image lightbox"
|
|
86
|
+
}), k ? /* @__PURE__ */ _(h, { children: [
|
|
87
|
+
o.length > 1 && D > 0 ? /* @__PURE__ */ g(n, {
|
|
88
|
+
variant: "outline",
|
|
89
|
+
size: "icon",
|
|
90
|
+
"aria-label": "Previous image",
|
|
91
|
+
className: "ck-image-lightbox-prev",
|
|
92
|
+
onClick: (e) => {
|
|
93
|
+
e.stopPropagation(), O((e) => e - 1);
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ g(y, {})
|
|
96
|
+
}) : null,
|
|
97
|
+
o.length > 1 && D < o.length - 1 ? /* @__PURE__ */ g(n, {
|
|
98
|
+
variant: "outline",
|
|
99
|
+
size: "icon",
|
|
100
|
+
"aria-label": "Next image",
|
|
101
|
+
className: "ck-image-lightbox-next",
|
|
102
|
+
onClick: (e) => {
|
|
103
|
+
e.stopPropagation(), O((e) => e + 1);
|
|
104
|
+
},
|
|
105
|
+
children: /* @__PURE__ */ g(b, {})
|
|
106
|
+
}) : null,
|
|
107
|
+
A.failed ? /* @__PURE__ */ g(p, { link: A }) : /* @__PURE__ */ g("img", {
|
|
108
|
+
src: k.url,
|
|
109
|
+
onError: A.onError,
|
|
110
|
+
alt: k.alt ?? k.filename ?? `Image ${String(D + 1)}`,
|
|
111
|
+
className: "ck-image-lightbox-photo",
|
|
112
|
+
onClick: (e) => {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
}
|
|
115
|
+
}, `${k.url}:${A.attempt}`),
|
|
116
|
+
j ? /* @__PURE__ */ g("div", {
|
|
117
|
+
className: "ck-image-lightbox-meta",
|
|
118
|
+
onClick: (e) => {
|
|
119
|
+
e.stopPropagation();
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
k.type,
|
|
123
|
+
k.filename,
|
|
124
|
+
c(k.size)
|
|
125
|
+
].filter(Boolean).join(" • ")
|
|
126
|
+
}) : null,
|
|
127
|
+
/* @__PURE__ */ _(s, {
|
|
128
|
+
className: "ck-image-lightbox-actions",
|
|
129
|
+
onClick: (e) => {
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
},
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(i, {
|
|
134
|
+
render: /* @__PURE__ */ g(n, {
|
|
135
|
+
variant: "outline",
|
|
136
|
+
size: "icon",
|
|
137
|
+
"aria-label": "Copy image",
|
|
138
|
+
disabled: A.loading,
|
|
139
|
+
onClick: (e) => {
|
|
140
|
+
M(e);
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
children: /* @__PURE__ */ g(x, {})
|
|
144
|
+
}), /* @__PURE__ */ g(r, { children: "Copy image" })] }),
|
|
145
|
+
/* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(i, {
|
|
146
|
+
render: /* @__PURE__ */ g(n, {
|
|
147
|
+
variant: "outline",
|
|
148
|
+
size: "icon",
|
|
149
|
+
"aria-label": "Download",
|
|
150
|
+
disabled: A.loading,
|
|
151
|
+
onClick: (e) => {
|
|
152
|
+
e.stopPropagation(), k && A.download(k.filename ?? k.alt ?? `image-${String(D + 1)}`);
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
children: /* @__PURE__ */ g(S, {})
|
|
156
|
+
}), /* @__PURE__ */ g(r, { children: "Download" })] }),
|
|
157
|
+
/* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(i, {
|
|
158
|
+
render: /* @__PURE__ */ g(n, {
|
|
159
|
+
variant: "outline",
|
|
160
|
+
size: "icon",
|
|
161
|
+
"aria-label": "Close",
|
|
162
|
+
onClick: T
|
|
163
|
+
}),
|
|
164
|
+
children: /* @__PURE__ */ g(C, {})
|
|
165
|
+
}), /* @__PURE__ */ g(r, { children: "Close" })] })
|
|
166
|
+
]
|
|
167
|
+
}),
|
|
168
|
+
o.length > 1 ? /* @__PURE__ */ g("div", {
|
|
169
|
+
className: "ck-image-lightbox-dots",
|
|
170
|
+
children: o.map((e, n) => /* @__PURE__ */ g("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
"aria-label": `Go to image ${String(n + 1)}`,
|
|
173
|
+
"aria-current": n === D ? "true" : void 0,
|
|
174
|
+
className: t("ck-image-lightbox-dot", n === D && "ck-image-lightbox-dot--active"),
|
|
175
|
+
onClick: (e) => {
|
|
176
|
+
e.stopPropagation(), O(n);
|
|
177
|
+
}
|
|
178
|
+
}, e.id))
|
|
179
|
+
}) : null
|
|
180
|
+
] }) : null]
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
function T(e) {
|
|
185
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", {
|
|
186
|
+
"data-ck-tool-styles": "lightbox",
|
|
187
|
+
children: v
|
|
188
|
+
}), /* @__PURE__ */ g(w, { ...e })] });
|
|
189
|
+
}
|
|
190
|
+
export { T as CommentImageLightbox };
|