@llumi/design-system 2.1.4 → 2.1.5
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/{adopt-global-styles-C0chASBU.js → adopt-global-styles-Bo2exag9.js} +1 -1
- package/base.css +1 -1
- package/bpmn.mjs +7 -7
- package/copy-button.mjs +3 -3
- package/custom-elements.json +246 -246
- package/download-button.mjs +3 -3
- package/highlighter.mjs +3 -3
- package/{icon-button-BK4v3Qya.js → icon-button-DmgiqZbF.js} +1 -1
- package/{icons-_LsftaTj.js → icons-D0InUNTF.js} +1 -1
- package/{index-BMouT9YM.js → index-DB0dYOCa.js} +1 -1
- package/{llumi-element-PGzWxI8r.js → llumi-element-CLEVA6m6.js} +1 -1
- package/mermaid.mjs +42 -42
- package/package.json +1 -1
- package/review.mjs +351 -347
- package/{slot-text-CIfdXSIp.js → slot-text-Dd3_erPv.js} +1 -1
- package/theme.css +1 -1
package/review.mjs
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { fromCallback as ht, setup as Lt, emit as mt, assign as E, stateIn as At, enqueueActions as Dt, createActor as Rt } from "https://cdn.jsdelivr.net/npm/xstate@5.32.2/+esm";
|
|
2
|
-
import { a as kt } from "./adopt-global-styles-
|
|
2
|
+
import { a as kt } from "./adopt-global-styles-Bo2exag9.js";
|
|
3
3
|
import { tinykeys as Nt } from "https://cdn.jsdelivr.net/npm/tinykeys@3.1.0/+esm";
|
|
4
4
|
import { html as w, css as W } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/+esm";
|
|
5
5
|
import { property as f, query as j, state as Pt, customElement as N } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/decorators.js/+esm";
|
|
6
6
|
import { classMap as A } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/directives/class-map.js/+esm";
|
|
7
|
-
import { i as G } from "./icons-
|
|
8
|
-
import { L as C } from "./llumi-element-
|
|
7
|
+
import { i as G } from "./icons-D0InUNTF.js";
|
|
8
|
+
import { L as C } from "./llumi-element-CLEVA6m6.js";
|
|
9
9
|
import { autoUpdate as bt, computePosition as Ct, offset as Et, flip as wt, shift as xt, size as yt } from "https://cdn.jsdelivr.net/npm/@floating-ui/dom@1.7.6/+esm";
|
|
10
10
|
import { repeat as _t } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/directives/repeat.js/+esm";
|
|
11
11
|
import { styleMap as Mt } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/directives/style-map.js/+esm";
|
|
12
|
-
/*! @llumi/design-system v2.1.
|
|
13
|
-
function ut(
|
|
14
|
-
const t =
|
|
12
|
+
/*! @llumi/design-system v2.1.5 | (c) 2026 pAIrprog SAS | license: https://cdn.jsdelivr.net/npm/@llumi/design-system@2.1.5/LICENSE | bundled third-party components under MIT, see NOTICE | @license */
|
|
13
|
+
function ut(o, e) {
|
|
14
|
+
const t = o.getAttribute("data-review-id");
|
|
15
15
|
if (t) return t;
|
|
16
16
|
for (const n of e ?? [])
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
17
|
+
if (o.matches(n.selector)) {
|
|
18
|
+
const i = n.toId(o);
|
|
19
|
+
if (i) return i;
|
|
20
20
|
}
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
function H(
|
|
24
|
-
const t =
|
|
23
|
+
function H(o, e) {
|
|
24
|
+
const t = o.closest("[data-review-id]");
|
|
25
25
|
if (t) {
|
|
26
26
|
const n = t.getAttribute("data-review-id");
|
|
27
27
|
if (n) return { element: t, targetId: n };
|
|
28
28
|
}
|
|
29
29
|
for (const n of e ?? []) {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const r = n.toId(
|
|
33
|
-
if (r) return { element:
|
|
30
|
+
const i = o.closest(n.selector);
|
|
31
|
+
if (i) {
|
|
32
|
+
const r = n.toId(i);
|
|
33
|
+
if (r) return { element: i, targetId: r };
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
function D(
|
|
38
|
+
function D(o, e) {
|
|
39
39
|
const t = /* @__PURE__ */ new Set(), n = [];
|
|
40
|
-
for (const
|
|
41
|
-
|
|
40
|
+
for (const i of Array.from(
|
|
41
|
+
o.querySelectorAll("[data-review-id]")
|
|
42
42
|
)) {
|
|
43
|
-
const r =
|
|
43
|
+
const r = i.getAttribute("data-review-id");
|
|
44
44
|
if (!r) continue;
|
|
45
|
-
const s =
|
|
45
|
+
const s = i.hasAttribute("data-review-selectable");
|
|
46
46
|
n.push({
|
|
47
|
-
element:
|
|
47
|
+
element: i,
|
|
48
48
|
targetId: r,
|
|
49
49
|
kind: s ? "both" : "element"
|
|
50
|
-
}), t.add(
|
|
50
|
+
}), t.add(i);
|
|
51
51
|
}
|
|
52
|
-
for (const
|
|
52
|
+
for (const i of e ?? [])
|
|
53
53
|
for (const r of Array.from(
|
|
54
|
-
|
|
54
|
+
o.querySelectorAll(i.selector)
|
|
55
55
|
)) {
|
|
56
56
|
if (t.has(r)) continue;
|
|
57
|
-
const s =
|
|
57
|
+
const s = i.toId(r);
|
|
58
58
|
if (!s) continue;
|
|
59
59
|
const a = r.hasAttribute("data-review-selectable");
|
|
60
60
|
n.push({
|
|
@@ -63,40 +63,40 @@ function D(i, e) {
|
|
|
63
63
|
kind: a ? "both" : "element"
|
|
64
64
|
}), t.add(r);
|
|
65
65
|
}
|
|
66
|
-
for (const
|
|
67
|
-
|
|
66
|
+
for (const i of Array.from(
|
|
67
|
+
o.querySelectorAll("[data-review-selectable]")
|
|
68
68
|
)) {
|
|
69
|
-
if (t.has(
|
|
70
|
-
const r =
|
|
71
|
-
r && (n.push({ element:
|
|
69
|
+
if (t.has(i)) continue;
|
|
70
|
+
const r = i.getAttribute("data-review-selectable");
|
|
71
|
+
r && (n.push({ element: i, targetId: r, kind: "selectable" }), t.add(i));
|
|
72
72
|
}
|
|
73
73
|
return n;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const et = "review-highlight-hover", y = "review-highlight-commented", z = "review-highlight-editing", F = "review-highlight-uncommented", Y = "review-target", gt = "review-active";
|
|
76
|
+
function J(o) {
|
|
77
|
+
o.classList.remove(
|
|
78
|
+
et,
|
|
79
79
|
y,
|
|
80
80
|
z,
|
|
81
81
|
F
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
function $t(
|
|
85
|
-
let t = null, n = null,
|
|
84
|
+
function $t(o, e) {
|
|
85
|
+
let t = null, n = null, i = null;
|
|
86
86
|
function r(c) {
|
|
87
|
-
|
|
88
|
-
const u = D(
|
|
87
|
+
o.classList.add(gt);
|
|
88
|
+
const u = D(o, e);
|
|
89
89
|
for (const { element: p, targetId: d, kind: L } of u)
|
|
90
|
-
(L === "element" || L === "both") && (p.hasAttribute("data-review-id") || p.classList.add(
|
|
90
|
+
(L === "element" || L === "both") && (p.hasAttribute("data-review-id") || p.classList.add(Y), c.has(d) && p.classList.add(y));
|
|
91
91
|
}
|
|
92
92
|
function s() {
|
|
93
|
-
|
|
94
|
-
const c = D(
|
|
93
|
+
o.classList.remove(gt), t && (clearTimeout(t), t = null);
|
|
94
|
+
const c = D(o, e);
|
|
95
95
|
for (const { element: u } of c)
|
|
96
|
-
|
|
96
|
+
J(u), u.classList.remove(Y);
|
|
97
97
|
}
|
|
98
98
|
function a(c) {
|
|
99
|
-
const u = D(
|
|
99
|
+
const u = D(o, e), p = [];
|
|
100
100
|
for (const { element: d } of u)
|
|
101
101
|
!d.classList.contains(y) && !d.classList.contains(z) && (d.classList.add(F), p.push(d));
|
|
102
102
|
c && (t && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -107,29 +107,29 @@ function $t(i, e) {
|
|
|
107
107
|
}
|
|
108
108
|
function l() {
|
|
109
109
|
t && (clearTimeout(t), t = null);
|
|
110
|
-
const c = D(
|
|
110
|
+
const c = D(o, e);
|
|
111
111
|
for (const { element: u } of c)
|
|
112
112
|
u.classList.remove(F);
|
|
113
113
|
}
|
|
114
114
|
function v(c, u) {
|
|
115
|
-
u || (
|
|
115
|
+
u || (J(c), c.classList.add(z));
|
|
116
116
|
}
|
|
117
117
|
function h(c, u) {
|
|
118
|
-
|
|
118
|
+
J(c), u && c.classList.add(y);
|
|
119
119
|
}
|
|
120
120
|
function g(c, u) {
|
|
121
|
-
(ut(c, e) ?? c.getAttribute("data-review-selectable")) !== u && c.classList.add(
|
|
121
|
+
(ut(c, e) ?? c.getAttribute("data-review-selectable")) !== u && c.classList.add(et);
|
|
122
122
|
}
|
|
123
123
|
function m(c, u, p) {
|
|
124
124
|
const d = ut(c, e) ?? c.getAttribute("data-review-selectable");
|
|
125
|
-
d !== u && (c.classList.remove(
|
|
125
|
+
d !== u && (c.classList.remove(et), d && (p != null && p.has(d)) && c.classList.add(y));
|
|
126
126
|
}
|
|
127
127
|
function M(c) {
|
|
128
|
-
|
|
128
|
+
B(), i = c.editingTarget ?? null, n = new MutationObserver((u) => {
|
|
129
129
|
for (const p of u) {
|
|
130
130
|
for (const d of Array.from(p.removedNodes)) {
|
|
131
131
|
if (!(d instanceof HTMLElement)) continue;
|
|
132
|
-
|
|
132
|
+
i && (d === i || d.contains(i)) && (i = null, c.onTargetDisconnected()), (d.hasAttribute("data-review-selectable") || d.querySelector("[data-review-selectable]") !== null) && c.onSelectableReconnected();
|
|
133
133
|
}
|
|
134
134
|
for (const d of Array.from(p.addedNodes)) {
|
|
135
135
|
if (!(d instanceof HTMLElement)) continue;
|
|
@@ -148,21 +148,21 @@ function $t(i, e) {
|
|
|
148
148
|
...d.matches(T.selector) ? [d] : [],
|
|
149
149
|
...Array.from(d.querySelectorAll(T.selector))
|
|
150
150
|
];
|
|
151
|
-
for (const
|
|
152
|
-
const dt = T.toId(
|
|
153
|
-
|
|
151
|
+
for (const V of $) {
|
|
152
|
+
const dt = T.toId(V);
|
|
153
|
+
V.classList.add(Y), dt && c.commentedIds.has(dt) && V.classList.add(y);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
(d.hasAttribute("data-review-selectable") || d.querySelector("[data-review-selectable]") !== null) && c.onSelectableReconnected();
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
}), n.observe(
|
|
159
|
+
}), n.observe(o, { childList: !0, subtree: !0 });
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
n && (n.disconnect(), n = null),
|
|
161
|
+
function B() {
|
|
162
|
+
n && (n.disconnect(), n = null), i = null;
|
|
163
163
|
}
|
|
164
164
|
function Ot() {
|
|
165
|
-
s(),
|
|
165
|
+
s(), B();
|
|
166
166
|
}
|
|
167
167
|
return {
|
|
168
168
|
activate: r,
|
|
@@ -174,14 +174,14 @@ function $t(i, e) {
|
|
|
174
174
|
applyHover: g,
|
|
175
175
|
clearHover: m,
|
|
176
176
|
startObserving: M,
|
|
177
|
-
stopObserving:
|
|
177
|
+
stopObserving: B,
|
|
178
178
|
destroy: Ot
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
const Ht = `:root{--review-highlight-uncommented-color: oklch(.7 0 0 / .15);--review-highlight-commented-color: oklch(.7 0 0 / .3);--review-highlight-color: oklch(.7 0 0 / .5);--review-highlight-editing-color: oklch(.6 0 0 / .7);--review-badge-icon-color: oklch(.35 0 0);--review-z-index: 9998;--review-selection-commented-color: oklch(.85 .08 250 / .4);--review-selection-editing-color: oklch(.75 .12 250 / .6);--review-selection-hover-color: oklch(.8 .1 250 / .5)}[data-review-id],[data-review-selectable],.review-target{outline:2px solid transparent;outline-offset:2px;transition:outline-color .15s ease}.review-highlight-uncommented{outline-color:var(--review-highlight-uncommented-color)}.review-highlight-commented{outline-color:var(--review-highlight-commented-color);position:relative}.review-highlight-hover{outline-color:var(--review-highlight-color)}.review-highlight-commented:after{content:"";position:absolute;top:-12px;right:-14px;width:20px;height:20px;border-radius:50%;background-color:#fff;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23404040' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");background-size:12px 12px;background-repeat:no-repeat;background-position:center;box-shadow:0 1px 3px #0000001a;pointer-events:none}.review-highlight-editing:after{display:none}[data-review-selectable]:not([data-review-id]).review-highlight-commented:after{display:none}.review-highlight-editing{outline-color:var(--review-highlight-editing-color)}::highlight(review-selection-commented){background-color:var(--review-selection-commented-color)}::highlight(review-selection-editing){background-color:var(--review-selection-editing-color)}::highlight(review-selection-hover){background-color:var(--review-selection-hover-color)}.review-active [data-review-id],.review-active .review-target{cursor:pointer}.review-active [data-review-selectable]{cursor:text}`;
|
|
182
|
-
function Gt(
|
|
183
|
-
const t =
|
|
184
|
-
(
|
|
182
|
+
function Gt(o, e) {
|
|
183
|
+
const t = o.find(
|
|
184
|
+
(i) => i.targetId === e && !i.selection
|
|
185
185
|
);
|
|
186
186
|
return t ? { comment: t, isNew: !1 } : { comment: {
|
|
187
187
|
commentId: crypto.randomUUID(),
|
|
@@ -190,14 +190,14 @@ function Gt(i, e) {
|
|
|
190
190
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
191
191
|
}, isNew: !0 };
|
|
192
192
|
}
|
|
193
|
-
function zt(
|
|
194
|
-
let e =
|
|
195
|
-
if (
|
|
193
|
+
function zt(o) {
|
|
194
|
+
let e = o.comments;
|
|
195
|
+
if (o.editingCommentId !== null) {
|
|
196
196
|
const t = e.find(
|
|
197
|
-
(n) => n.commentId ===
|
|
197
|
+
(n) => n.commentId === o.editingCommentId
|
|
198
198
|
);
|
|
199
199
|
t && t.content === "" && (e = e.filter(
|
|
200
|
-
(n) => n.commentId !==
|
|
200
|
+
(n) => n.commentId !== o.editingCommentId
|
|
201
201
|
));
|
|
202
202
|
}
|
|
203
203
|
return {
|
|
@@ -207,24 +207,24 @@ function zt(i) {
|
|
|
207
207
|
selectionRange: null
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
const e =
|
|
210
|
+
function Q(o) {
|
|
211
|
+
const e = o.comments.filter((i) => i.content.trim()), t = e.length > 0, n = o.overallComment.trim().length > 0;
|
|
212
212
|
return !t && !n ? { status: "approved" } : {
|
|
213
213
|
status: "commented",
|
|
214
214
|
comments: e,
|
|
215
|
-
overallComment: n ?
|
|
215
|
+
overallComment: n ? o.overallComment.trim() : void 0
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
function Ft(
|
|
218
|
+
function Ft(o) {
|
|
219
219
|
const e = /* @__PURE__ */ new Set();
|
|
220
|
-
for (const t of
|
|
220
|
+
for (const t of o.comments)
|
|
221
221
|
!t.selection && t.content.trim() && e.add(t.targetId);
|
|
222
222
|
return e;
|
|
223
223
|
}
|
|
224
224
|
function Ut() {
|
|
225
|
-
const
|
|
225
|
+
const o = ht(
|
|
226
226
|
({ sendBack: t, input: n }) => {
|
|
227
|
-
const
|
|
227
|
+
const i = () => t({ type: "RELEASE_ANNOTATE" }), r = (l) => {
|
|
228
228
|
l.key === "Alt" && (l.preventDefault(), t({ type: "HOLD_ANNOTATE" }));
|
|
229
229
|
}, s = (l) => {
|
|
230
230
|
l.key === "Alt" && t({ type: "RELEASE_ANNOTATE" });
|
|
@@ -242,12 +242,12 @@ function Ut() {
|
|
|
242
242
|
l.preventDefault(), t({ type: "CLOSE" });
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
|
-
return window.addEventListener("keydown", r), window.addEventListener("keyup", s), window.addEventListener("blur",
|
|
246
|
-
a(), window.removeEventListener("keydown", r), window.removeEventListener("keyup", s), window.removeEventListener("blur",
|
|
245
|
+
return window.addEventListener("keydown", r), window.addEventListener("keyup", s), window.addEventListener("blur", i), () => {
|
|
246
|
+
a(), window.removeEventListener("keydown", r), window.removeEventListener("keyup", s), window.removeEventListener("blur", i);
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
), e = ht(({ sendBack: t, input: n }) => {
|
|
250
|
-
const
|
|
250
|
+
const i = new MutationObserver((r) => {
|
|
251
251
|
for (const s of r)
|
|
252
252
|
for (const a of Array.from(s.removedNodes))
|
|
253
253
|
if (a instanceof HTMLElement && (a === n.targetElement || a.contains(n.targetElement))) {
|
|
@@ -255,7 +255,7 @@ function Ut() {
|
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
return
|
|
258
|
+
return i.observe(n.wrapperElement, { childList: !0, subtree: !0 }), () => i.disconnect();
|
|
259
259
|
});
|
|
260
260
|
return Lt({
|
|
261
261
|
types: {
|
|
@@ -265,7 +265,7 @@ function Ut() {
|
|
|
265
265
|
emitted: {}
|
|
266
266
|
},
|
|
267
267
|
actors: {
|
|
268
|
-
keyboardActor:
|
|
268
|
+
keyboardActor: o,
|
|
269
269
|
mutationObserverActor: e
|
|
270
270
|
},
|
|
271
271
|
guards: {
|
|
@@ -278,10 +278,10 @@ function Ut() {
|
|
|
278
278
|
if (n.selectionCommentId)
|
|
279
279
|
return t.editingCommentId === n.selectionCommentId;
|
|
280
280
|
if (n.targetId) {
|
|
281
|
-
const
|
|
281
|
+
const i = t.comments.find(
|
|
282
282
|
(r) => r.commentId === t.editingCommentId
|
|
283
283
|
);
|
|
284
|
-
return !!
|
|
284
|
+
return !!i && i.targetId === n.targetId && !i.selection;
|
|
285
285
|
}
|
|
286
286
|
return !1;
|
|
287
287
|
}
|
|
@@ -292,13 +292,13 @@ function Ut() {
|
|
|
292
292
|
actions: {
|
|
293
293
|
openElementComment: E(({ context: t, event: n }) => {
|
|
294
294
|
if (n.type !== "CLICK" || !n.targetId) return {};
|
|
295
|
-
const { comment:
|
|
295
|
+
const { comment: i, isNew: r } = Gt(
|
|
296
296
|
t.comments,
|
|
297
297
|
n.targetId
|
|
298
298
|
);
|
|
299
299
|
return {
|
|
300
|
-
comments: r ? [...t.comments,
|
|
301
|
-
editingCommentId:
|
|
300
|
+
comments: r ? [...t.comments, i] : t.comments,
|
|
301
|
+
editingCommentId: i.commentId,
|
|
302
302
|
targetElement: n.element ?? null,
|
|
303
303
|
selectionRange: null
|
|
304
304
|
};
|
|
@@ -310,7 +310,7 @@ function Ut() {
|
|
|
310
310
|
}),
|
|
311
311
|
createSelectionComment: E(({ context: t, event: n }) => {
|
|
312
312
|
if (n.type !== "SELECT_TEXT") return {};
|
|
313
|
-
const
|
|
313
|
+
const i = {
|
|
314
314
|
commentId: crypto.randomUUID(),
|
|
315
315
|
targetId: n.targetId,
|
|
316
316
|
content: "",
|
|
@@ -318,15 +318,15 @@ function Ut() {
|
|
|
318
318
|
selection: n.selectionRange
|
|
319
319
|
};
|
|
320
320
|
return {
|
|
321
|
-
comments: [...t.comments,
|
|
322
|
-
editingCommentId:
|
|
321
|
+
comments: [...t.comments, i],
|
|
322
|
+
editingCommentId: i.commentId,
|
|
323
323
|
targetElement: n.targetElement,
|
|
324
324
|
selectionRange: n.selectionRange
|
|
325
325
|
};
|
|
326
326
|
}),
|
|
327
327
|
updateContent: E(({ context: t, event: n }) => n.type !== "COMMENT_CHANGE" ? {} : t.editingCommentId === null ? { overallComment: n.content } : {
|
|
328
328
|
comments: t.comments.map(
|
|
329
|
-
(
|
|
329
|
+
(i) => i.commentId === t.editingCommentId ? { ...i, content: n.content } : i
|
|
330
330
|
)
|
|
331
331
|
}),
|
|
332
332
|
deleteComment: E(({ context: t }) => ({
|
|
@@ -340,14 +340,14 @@ function Ut() {
|
|
|
340
340
|
cleanup: E(({ context: t }) => zt(t)),
|
|
341
341
|
emitChanged: mt(({ context: t }) => ({
|
|
342
342
|
type: "REVIEW_CHANGED",
|
|
343
|
-
result:
|
|
343
|
+
result: Q(t)
|
|
344
344
|
})),
|
|
345
345
|
persistSave: ({ context: t }) => {
|
|
346
|
-
t.persistence.save(
|
|
346
|
+
t.persistence.save(Q(t));
|
|
347
347
|
},
|
|
348
348
|
emitSubmitted: mt(({ context: t }) => ({
|
|
349
349
|
type: "REVIEW_SUBMITTED",
|
|
350
|
-
result:
|
|
350
|
+
result: Q(t)
|
|
351
351
|
})),
|
|
352
352
|
// Highlight lifecycle actions — call manager methods directly via
|
|
353
353
|
// callbacks passed through input. The machine owns WHEN highlights
|
|
@@ -370,17 +370,17 @@ function Ut() {
|
|
|
370
370
|
t.highlights.unreveal();
|
|
371
371
|
},
|
|
372
372
|
editingTargetSet: ({ context: t }) => {
|
|
373
|
-
var
|
|
373
|
+
var i;
|
|
374
374
|
if (!t.targetElement) return;
|
|
375
|
-
const n = !!((
|
|
375
|
+
const n = !!((i = t.comments.find(
|
|
376
376
|
(r) => r.commentId === t.editingCommentId
|
|
377
|
-
)) != null &&
|
|
377
|
+
)) != null && i.selection);
|
|
378
378
|
t.highlights.setEditing(t.targetElement, n);
|
|
379
379
|
},
|
|
380
380
|
editingTargetCleared: ({ context: t }) => {
|
|
381
381
|
if (!t.targetElement) return;
|
|
382
382
|
const n = t.comments.find(
|
|
383
|
-
(
|
|
383
|
+
(i) => i.commentId === t.editingCommentId
|
|
384
384
|
);
|
|
385
385
|
t.highlights.clearEditing(
|
|
386
386
|
t.targetElement,
|
|
@@ -392,9 +392,9 @@ function Ut() {
|
|
|
392
392
|
id: "review",
|
|
393
393
|
type: "parallel",
|
|
394
394
|
context: ({ input: t }) => {
|
|
395
|
-
const n = t.persistence.load() ?? t.initialData,
|
|
395
|
+
const n = t.persistence.load() ?? t.initialData, i = (n == null ? void 0 : n.status) === "commented" ? n.comments ?? [] : [], r = (n == null ? void 0 : n.status) === "commented" ? n.overallComment ?? "" : "";
|
|
396
396
|
return {
|
|
397
|
-
comments:
|
|
397
|
+
comments: i,
|
|
398
398
|
overallComment: r,
|
|
399
399
|
editingCommentId: null,
|
|
400
400
|
targetElement: null,
|
|
@@ -644,25 +644,25 @@ const pt = {
|
|
|
644
644
|
clear: () => {
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
|
-
function
|
|
647
|
+
function Z() {
|
|
648
648
|
try {
|
|
649
649
|
return typeof localStorage > "u" ? void 0 : localStorage;
|
|
650
650
|
} catch {
|
|
651
651
|
return;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
function Kt(
|
|
655
|
-
if (typeof
|
|
656
|
-
const e =
|
|
654
|
+
function Kt(o) {
|
|
655
|
+
if (typeof o != "object" || o === null) return !1;
|
|
656
|
+
const e = o.status;
|
|
657
657
|
return e === "approved" || e === "commented";
|
|
658
658
|
}
|
|
659
|
-
function Wt(
|
|
659
|
+
function Wt(o) {
|
|
660
660
|
return {
|
|
661
661
|
load() {
|
|
662
|
-
const e =
|
|
662
|
+
const e = Z();
|
|
663
663
|
if (e)
|
|
664
664
|
try {
|
|
665
|
-
const t = e.getItem(
|
|
665
|
+
const t = e.getItem(o);
|
|
666
666
|
if (t === null) return;
|
|
667
667
|
const n = JSON.parse(t);
|
|
668
668
|
return Kt(n) ? n : void 0;
|
|
@@ -671,117 +671,120 @@ function Wt(i) {
|
|
|
671
671
|
}
|
|
672
672
|
},
|
|
673
673
|
save(e) {
|
|
674
|
-
const t =
|
|
674
|
+
const t = Z();
|
|
675
675
|
if (t)
|
|
676
676
|
try {
|
|
677
677
|
if (e.status === "approved") {
|
|
678
|
-
t.removeItem(
|
|
678
|
+
t.removeItem(o);
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
681
|
-
t.setItem(
|
|
681
|
+
t.setItem(o, JSON.stringify(e));
|
|
682
682
|
} catch {
|
|
683
683
|
}
|
|
684
684
|
},
|
|
685
685
|
clear() {
|
|
686
|
-
const e =
|
|
686
|
+
const e = Z();
|
|
687
687
|
if (e)
|
|
688
688
|
try {
|
|
689
|
-
e.removeItem(
|
|
689
|
+
e.removeItem(o);
|
|
690
690
|
} catch {
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
695
|
const jt = 3;
|
|
696
|
-
function qt(
|
|
696
|
+
function qt(o) {
|
|
697
697
|
const e = [], t = (n) => {
|
|
698
698
|
n instanceof Element && n.shadowRoot && (e.push(n.shadowRoot), n.shadowRoot.childNodes.forEach(t)), n.childNodes.forEach(t);
|
|
699
699
|
};
|
|
700
|
-
return t(
|
|
700
|
+
return t(o), e;
|
|
701
701
|
}
|
|
702
|
-
function It(
|
|
702
|
+
function It(o) {
|
|
703
703
|
const e = document.createRange();
|
|
704
|
-
return e.setStart(
|
|
704
|
+
return e.setStart(o.startContainer, o.startOffset), e.setEnd(o.endContainer, o.endOffset), e;
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
706
|
+
function q(o, e) {
|
|
707
|
+
const t = qt(e), n = o.getComposedRanges;
|
|
708
|
+
if (n && t.length > 0)
|
|
709
|
+
try {
|
|
710
|
+
const r = n.call(o, ...t)[0];
|
|
711
|
+
if (r) return It(r);
|
|
712
|
+
} catch {
|
|
713
|
+
}
|
|
714
|
+
if (o.rangeCount === 0) return null;
|
|
715
|
+
try {
|
|
716
|
+
return o.getRangeAt(0);
|
|
717
|
+
} catch {
|
|
718
|
+
return null;
|
|
719
|
+
}
|
|
714
720
|
}
|
|
715
|
-
function Xt(
|
|
721
|
+
function Xt(o) {
|
|
716
722
|
const e = window.getSelection();
|
|
717
|
-
if (!e
|
|
718
|
-
|
|
719
|
-
const t = lt(e, i);
|
|
723
|
+
if (!e) return null;
|
|
724
|
+
const t = q(e, o);
|
|
720
725
|
if (!t) return null;
|
|
721
726
|
const n = t.toString();
|
|
722
727
|
if (n.length < jt) return null;
|
|
723
|
-
const
|
|
724
|
-
|
|
728
|
+
const i = Yt(
|
|
729
|
+
o,
|
|
725
730
|
t.startContainer,
|
|
726
731
|
t.startOffset
|
|
727
|
-
), r =
|
|
728
|
-
if (
|
|
732
|
+
), r = i + n.length;
|
|
733
|
+
if (i < 0) return null;
|
|
729
734
|
const s = Jt(
|
|
730
|
-
St(
|
|
735
|
+
St(o),
|
|
731
736
|
n,
|
|
732
|
-
|
|
737
|
+
i
|
|
733
738
|
);
|
|
734
|
-
return { startOffset:
|
|
739
|
+
return { startOffset: i, endOffset: r, selectedText: n, matchIndex: s };
|
|
735
740
|
}
|
|
736
|
-
function
|
|
737
|
-
const t = St(
|
|
741
|
+
function nt(o, e) {
|
|
742
|
+
const t = St(o);
|
|
738
743
|
if (t.slice(
|
|
739
744
|
e.startOffset,
|
|
740
745
|
e.endOffset
|
|
741
746
|
) === e.selectedText)
|
|
742
747
|
return ft(
|
|
743
|
-
|
|
748
|
+
o,
|
|
744
749
|
e.startOffset,
|
|
745
750
|
e.endOffset
|
|
746
751
|
);
|
|
747
|
-
const
|
|
752
|
+
const i = Qt(
|
|
748
753
|
t,
|
|
749
754
|
e.selectedText,
|
|
750
755
|
e.matchIndex
|
|
751
756
|
);
|
|
752
|
-
return
|
|
753
|
-
i,
|
|
757
|
+
return i < 0 ? null : ft(
|
|
754
758
|
o,
|
|
755
|
-
|
|
759
|
+
i,
|
|
760
|
+
i + e.selectedText.length
|
|
756
761
|
);
|
|
757
762
|
}
|
|
758
|
-
function Bt(
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return t ? U(e, t.startContainer) && U(e, t.endContainer) : !1;
|
|
763
|
+
function Bt(o, e) {
|
|
764
|
+
const t = q(o, e);
|
|
765
|
+
return !t || t.collapsed ? !1 : U(e, t.startContainer) && U(e, t.endContainer);
|
|
762
766
|
}
|
|
763
|
-
function
|
|
764
|
-
let e =
|
|
767
|
+
function tt(o) {
|
|
768
|
+
let e = o;
|
|
765
769
|
for (; e; ) {
|
|
766
770
|
const t = e instanceof HTMLElement ? e : e.parentElement, n = t == null ? void 0 : t.closest("[data-review-selectable]");
|
|
767
771
|
if (n) return n;
|
|
768
|
-
const
|
|
769
|
-
if (
|
|
770
|
-
e =
|
|
772
|
+
const i = e.getRootNode();
|
|
773
|
+
if (i instanceof ShadowRoot)
|
|
774
|
+
e = i.host;
|
|
771
775
|
else
|
|
772
776
|
return null;
|
|
773
777
|
}
|
|
774
778
|
return null;
|
|
775
779
|
}
|
|
776
|
-
function Vt(
|
|
780
|
+
function Vt(o, e) {
|
|
777
781
|
var r;
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
if (n && o)
|
|
782
|
+
const t = q(o, e);
|
|
783
|
+
if (!t || t.collapsed) return null;
|
|
784
|
+
const n = U(e, t.startContainer), i = U(e, t.endContainer);
|
|
785
|
+
if (n && i)
|
|
783
786
|
return It(t);
|
|
784
|
-
if (n && !
|
|
787
|
+
if (n && !i) {
|
|
785
788
|
const s = Zt(e);
|
|
786
789
|
if (s) {
|
|
787
790
|
const a = document.createRange();
|
|
@@ -790,95 +793,95 @@ function Vt(i, e) {
|
|
|
790
793
|
}
|
|
791
794
|
return null;
|
|
792
795
|
}
|
|
793
|
-
function U(
|
|
796
|
+
function U(o, e) {
|
|
794
797
|
if (!e) return !1;
|
|
795
|
-
if (
|
|
798
|
+
if (o === e) return !0;
|
|
796
799
|
let t = e;
|
|
797
800
|
for (; t; ) {
|
|
798
|
-
if (
|
|
801
|
+
if (o === t) return !0;
|
|
799
802
|
const n = t.getRootNode();
|
|
800
803
|
if (n instanceof ShadowRoot) {
|
|
801
|
-
if (
|
|
804
|
+
if (o === n.host) return !0;
|
|
802
805
|
t = n.host;
|
|
803
806
|
} else
|
|
804
|
-
return !!
|
|
807
|
+
return !!o.contains(t);
|
|
805
808
|
}
|
|
806
809
|
return !1;
|
|
807
810
|
}
|
|
808
|
-
function St(
|
|
811
|
+
function St(o) {
|
|
809
812
|
let e = "";
|
|
810
813
|
const t = (n) => {
|
|
811
|
-
n instanceof Element && n.shadowRoot && n.shadowRoot.childNodes.forEach(t), n.childNodes.forEach((
|
|
812
|
-
|
|
814
|
+
n instanceof Element && n.shadowRoot && n.shadowRoot.childNodes.forEach(t), n.childNodes.forEach((i) => {
|
|
815
|
+
i.nodeType === Node.TEXT_NODE ? e += i.textContent ?? "" : t(i);
|
|
813
816
|
});
|
|
814
817
|
};
|
|
815
|
-
return t(
|
|
818
|
+
return t(o), e;
|
|
816
819
|
}
|
|
817
|
-
function Yt(
|
|
818
|
-
var
|
|
820
|
+
function Yt(o, e, t) {
|
|
821
|
+
var i;
|
|
819
822
|
let n = 0;
|
|
820
|
-
for (const r of k(
|
|
823
|
+
for (const r of k(o)) {
|
|
821
824
|
if (r === e) return n + t;
|
|
822
|
-
n += ((
|
|
825
|
+
n += ((i = r.textContent) == null ? void 0 : i.length) ?? 0;
|
|
823
826
|
}
|
|
824
827
|
return -1;
|
|
825
828
|
}
|
|
826
|
-
function ft(
|
|
829
|
+
function ft(o, e, t) {
|
|
827
830
|
var s;
|
|
828
831
|
const n = document.createRange();
|
|
829
|
-
let
|
|
830
|
-
for (const a of k(
|
|
832
|
+
let i = 0, r = !1;
|
|
833
|
+
for (const a of k(o)) {
|
|
831
834
|
const l = ((s = a.textContent) == null ? void 0 : s.length) ?? 0;
|
|
832
|
-
if (!r &&
|
|
833
|
-
return n.setEnd(a, t -
|
|
834
|
-
|
|
835
|
+
if (!r && i + l > e && (n.setStart(a, e - i), r = !0), r && i + l >= t)
|
|
836
|
+
return n.setEnd(a, t - i), n;
|
|
837
|
+
i += l;
|
|
835
838
|
}
|
|
836
839
|
return null;
|
|
837
840
|
}
|
|
838
|
-
function* k(
|
|
839
|
-
|
|
840
|
-
for (const e of Array.from(
|
|
841
|
+
function* k(o) {
|
|
842
|
+
o instanceof Element && o.shadowRoot && (yield* k(o.shadowRoot));
|
|
843
|
+
for (const e of Array.from(o.childNodes))
|
|
841
844
|
e.nodeType === Node.TEXT_NODE ? yield e : e instanceof Element && (yield* k(e));
|
|
842
845
|
}
|
|
843
|
-
function Jt(
|
|
844
|
-
let n = 0,
|
|
846
|
+
function Jt(o, e, t) {
|
|
847
|
+
let n = 0, i = 0;
|
|
845
848
|
for (; ; ) {
|
|
846
|
-
const r =
|
|
849
|
+
const r = o.indexOf(e, i);
|
|
847
850
|
if (r < 0 || r === t) return n;
|
|
848
|
-
|
|
851
|
+
i = r + 1, n++;
|
|
849
852
|
}
|
|
850
853
|
}
|
|
851
|
-
function Qt(
|
|
852
|
-
let n = 0,
|
|
854
|
+
function Qt(o, e, t) {
|
|
855
|
+
let n = 0, i = 0;
|
|
853
856
|
for (; ; ) {
|
|
854
|
-
const r =
|
|
857
|
+
const r = o.indexOf(e, i);
|
|
855
858
|
if (r < 0) return -1;
|
|
856
859
|
if (n === t) return r;
|
|
857
|
-
|
|
860
|
+
i = r + 1, n++;
|
|
858
861
|
}
|
|
859
862
|
}
|
|
860
|
-
function Zt(
|
|
863
|
+
function Zt(o) {
|
|
861
864
|
let e = null;
|
|
862
|
-
for (const t of k(
|
|
865
|
+
for (const t of k(o))
|
|
863
866
|
e = t;
|
|
864
867
|
return e;
|
|
865
868
|
}
|
|
866
|
-
function te(
|
|
867
|
-
const n = /* @__PURE__ */ new Map(),
|
|
869
|
+
function te(o, e, t) {
|
|
870
|
+
const n = /* @__PURE__ */ new Map(), i = D(e, t).sort((r, s) => {
|
|
868
871
|
const a = r.element.compareDocumentPosition(s.element);
|
|
869
872
|
return a & Node.DOCUMENT_POSITION_PRECEDING ? 1 : a & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 0;
|
|
870
873
|
});
|
|
871
|
-
for (const [r, s] of
|
|
874
|
+
for (const [r, s] of i.entries())
|
|
872
875
|
n.set(s.targetId, r);
|
|
873
|
-
return [...
|
|
876
|
+
return [...o].sort((r, s) => {
|
|
874
877
|
const a = n.get(r.targetId) ?? Number.MAX_SAFE_INTEGER, l = n.get(s.targetId) ?? Number.MAX_SAFE_INTEGER;
|
|
875
878
|
return a - l;
|
|
876
879
|
});
|
|
877
880
|
}
|
|
878
|
-
var ee = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, x = (
|
|
879
|
-
for (var
|
|
880
|
-
(s =
|
|
881
|
-
return n &&
|
|
881
|
+
var ee = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, x = (o, e, t, n) => {
|
|
882
|
+
for (var i = n > 1 ? void 0 : n ? ne(e, t) : e, r = o.length - 1, s; r >= 0; r--)
|
|
883
|
+
(s = o[r]) && (i = (n ? s(e, t, i) : s(i)) || i);
|
|
884
|
+
return n && i && ee(e, t, i), i;
|
|
882
885
|
};
|
|
883
886
|
const ie = {
|
|
884
887
|
"top-left": { top: "16px", left: "16px" },
|
|
@@ -890,19 +893,19 @@ const ie = {
|
|
|
890
893
|
};
|
|
891
894
|
let b = class extends C {
|
|
892
895
|
constructor() {
|
|
893
|
-
super(...arguments), this.mode = "idle", this.commentCount = 0, this.hasOverallComment = !1, this.overallCommentOpen = !1, this.barPosition = "bottom-center", this.dragOffset = null, this.dragStart = null, this.onDragStart = (
|
|
896
|
+
super(...arguments), this.mode = "idle", this.commentCount = 0, this.hasOverallComment = !1, this.overallCommentOpen = !1, this.barPosition = "bottom-center", this.dragOffset = null, this.dragStart = null, this.onDragStart = (o) => {
|
|
894
897
|
const e = this.bar.getBoundingClientRect();
|
|
895
898
|
this.dragStart = {
|
|
896
|
-
px:
|
|
897
|
-
py:
|
|
899
|
+
px: o.clientX,
|
|
900
|
+
py: o.clientY,
|
|
898
901
|
ox: e.left,
|
|
899
902
|
oy: e.top
|
|
900
903
|
}, window.addEventListener("pointermove", this.onDragMove), window.addEventListener("pointerup", this.onDragEnd);
|
|
901
|
-
}, this.onDragMove = (
|
|
904
|
+
}, this.onDragMove = (o) => {
|
|
902
905
|
if (!this.dragStart) return;
|
|
903
|
-
const e = this.dragStart.ox + (
|
|
906
|
+
const e = this.dragStart.ox + (o.clientX - this.dragStart.px), t = this.dragStart.oy + (o.clientY - this.dragStart.py), n = 16, i = window.innerWidth - this.bar.offsetWidth - n, r = window.innerHeight - this.bar.offsetHeight - n;
|
|
904
907
|
this.dragOffset = {
|
|
905
|
-
x: Math.max(n, Math.min(e,
|
|
908
|
+
x: Math.max(n, Math.min(e, i)),
|
|
906
909
|
y: Math.max(n, Math.min(t, r))
|
|
907
910
|
};
|
|
908
911
|
}, this.onDragEnd = () => {
|
|
@@ -913,11 +916,11 @@ let b = class extends C {
|
|
|
913
916
|
return this.bar ?? null;
|
|
914
917
|
}
|
|
915
918
|
render() {
|
|
916
|
-
const
|
|
919
|
+
const o = this.mode !== "idle", e = this.commentCount + (this.hasOverallComment ? 1 : 0), t = e > 0, n = ie[this.barPosition], i = this.dragOffset ? `position:fixed;left:${this.dragOffset.x}px;top:${this.dragOffset.y}px;z-index:var(--review-z-index,9998);` : `position:fixed;${n.top ? `top:${n.top};` : ""}${n.bottom ? `bottom:${n.bottom};` : ""}${n.left ? `left:${n.left};` : ""}${n.right ? `right:${n.right};` : ""}${n.translateX ? `transform:translateX(${n.translateX});` : ""}z-index:var(--review-z-index,9998);`;
|
|
917
920
|
return w`<div
|
|
918
921
|
data-bar
|
|
919
|
-
class=${A({ bar: !0, "bar--active":
|
|
920
|
-
style=${
|
|
922
|
+
class=${A({ bar: !0, "bar--active": o })}
|
|
923
|
+
style=${i}
|
|
921
924
|
>
|
|
922
925
|
<div
|
|
923
926
|
class="grip"
|
|
@@ -929,25 +932,25 @@ let b = class extends C {
|
|
|
929
932
|
<label class="label">
|
|
930
933
|
<span class=${A({
|
|
931
934
|
"label-text": !0,
|
|
932
|
-
"label-text--active":
|
|
933
|
-
"label-text--idle": !
|
|
935
|
+
"label-text--active": o,
|
|
936
|
+
"label-text--idle": !o
|
|
934
937
|
})}>Annotate</span>
|
|
935
938
|
<button
|
|
936
939
|
type="button"
|
|
937
940
|
role="switch"
|
|
938
|
-
aria-checked=${
|
|
941
|
+
aria-checked=${o ? "true" : "false"}
|
|
939
942
|
data-toggle
|
|
940
943
|
@click=${this.onToggle}
|
|
941
944
|
class=${A({
|
|
942
945
|
toggle: !0,
|
|
943
|
-
"toggle--active":
|
|
944
|
-
"toggle--idle": !
|
|
946
|
+
"toggle--active": o,
|
|
947
|
+
"toggle--idle": !o
|
|
945
948
|
})}
|
|
946
949
|
>
|
|
947
950
|
<span class=${A({
|
|
948
951
|
knob: !0,
|
|
949
|
-
"knob--active":
|
|
950
|
-
"knob--idle": !
|
|
952
|
+
"knob--active": o,
|
|
953
|
+
"knob--idle": !o
|
|
951
954
|
})}></span>
|
|
952
955
|
</button>
|
|
953
956
|
</label>
|
|
@@ -1218,10 +1221,10 @@ x([
|
|
|
1218
1221
|
b = x([
|
|
1219
1222
|
N("llumi-review-bar")
|
|
1220
1223
|
], b);
|
|
1221
|
-
var oe = Object.defineProperty, re = Object.getOwnPropertyDescriptor, P = (
|
|
1222
|
-
for (var
|
|
1223
|
-
(s =
|
|
1224
|
-
return n &&
|
|
1224
|
+
var oe = Object.defineProperty, re = Object.getOwnPropertyDescriptor, P = (o, e, t, n) => {
|
|
1225
|
+
for (var i = n > 1 ? void 0 : n ? re(e, t) : e, r = o.length - 1, s; r >= 0; r--)
|
|
1226
|
+
(s = o[r]) && (i = (n ? s(e, t, i) : s(i)) || i);
|
|
1227
|
+
return n && i && oe(e, t, i), i;
|
|
1225
1228
|
};
|
|
1226
1229
|
let I = class extends C {
|
|
1227
1230
|
constructor() {
|
|
@@ -1229,8 +1232,8 @@ let I = class extends C {
|
|
|
1229
1232
|
}
|
|
1230
1233
|
/** Focus the inner textarea (the element itself isn't focusable). */
|
|
1231
1234
|
focus() {
|
|
1232
|
-
var
|
|
1233
|
-
(
|
|
1235
|
+
var o;
|
|
1236
|
+
(o = this.textarea) == null || o.focus();
|
|
1234
1237
|
}
|
|
1235
1238
|
render() {
|
|
1236
1239
|
return w`<textarea
|
|
@@ -1240,8 +1243,8 @@ let I = class extends C {
|
|
|
1240
1243
|
@input=${this.onInput}
|
|
1241
1244
|
></textarea>`;
|
|
1242
1245
|
}
|
|
1243
|
-
onInput(
|
|
1244
|
-
const e =
|
|
1246
|
+
onInput(o) {
|
|
1247
|
+
const e = o.target.value;
|
|
1245
1248
|
this.autoGrow(), this.dispatchEvent(
|
|
1246
1249
|
new CustomEvent("change", {
|
|
1247
1250
|
detail: e,
|
|
@@ -1251,8 +1254,8 @@ let I = class extends C {
|
|
|
1251
1254
|
);
|
|
1252
1255
|
}
|
|
1253
1256
|
autoGrow() {
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1257
|
+
const o = this.textarea;
|
|
1258
|
+
o && (o.style.height = "auto", o.style.height = `${o.scrollHeight}px`);
|
|
1256
1259
|
}
|
|
1257
1260
|
firstUpdated() {
|
|
1258
1261
|
this.autoFocus && this.textarea.focus(), this.autoGrow();
|
|
@@ -1301,24 +1304,24 @@ P([
|
|
|
1301
1304
|
I = P([
|
|
1302
1305
|
N("llumi-default-editor")
|
|
1303
1306
|
], I);
|
|
1304
|
-
var se = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, _ = (
|
|
1305
|
-
for (var
|
|
1306
|
-
(s =
|
|
1307
|
-
return n &&
|
|
1307
|
+
var se = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, _ = (o, e, t, n) => {
|
|
1308
|
+
for (var i = n > 1 ? void 0 : n ? ae(e, t) : e, r = o.length - 1, s; r >= 0; r--)
|
|
1309
|
+
(s = o[r]) && (i = (n ? s(e, t, i) : s(i)) || i);
|
|
1310
|
+
return n && i && se(e, t, i), i;
|
|
1308
1311
|
};
|
|
1309
1312
|
let S = class extends C {
|
|
1310
1313
|
constructor() {
|
|
1311
1314
|
super(...arguments), this.targetElement = null, this.anchor = null, this.value = "";
|
|
1312
1315
|
}
|
|
1313
1316
|
render() {
|
|
1314
|
-
const
|
|
1317
|
+
const o = this.value.trim().length > 0;
|
|
1315
1318
|
return w`<div
|
|
1316
1319
|
data-floating
|
|
1317
1320
|
class="floating"
|
|
1318
1321
|
style="position:absolute;top:0;left:0;"
|
|
1319
1322
|
>
|
|
1320
1323
|
<div class="panel">
|
|
1321
|
-
${
|
|
1324
|
+
${o ? w`<button
|
|
1322
1325
|
type="button"
|
|
1323
1326
|
data-delete
|
|
1324
1327
|
class="delete-btn"
|
|
@@ -1335,28 +1338,28 @@ let S = class extends C {
|
|
|
1335
1338
|
</div>
|
|
1336
1339
|
</div>`;
|
|
1337
1340
|
}
|
|
1338
|
-
onEditorChange(
|
|
1339
|
-
if (typeof
|
|
1340
|
-
const e =
|
|
1341
|
-
|
|
1341
|
+
onEditorChange(o) {
|
|
1342
|
+
if (typeof o.detail != "string") return;
|
|
1343
|
+
const e = o.detail;
|
|
1344
|
+
o.stopPropagation(), this.dispatchEvent(
|
|
1342
1345
|
new CustomEvent("change", { detail: e, bubbles: !0, composed: !0 })
|
|
1343
1346
|
);
|
|
1344
1347
|
}
|
|
1345
|
-
onCancel(
|
|
1346
|
-
|
|
1348
|
+
onCancel(o) {
|
|
1349
|
+
o.stopPropagation(), this.dispatchEvent(
|
|
1347
1350
|
new CustomEvent("close", { bubbles: !0, composed: !0 })
|
|
1348
1351
|
);
|
|
1349
1352
|
}
|
|
1350
|
-
onDelete(
|
|
1351
|
-
|
|
1353
|
+
onDelete(o) {
|
|
1354
|
+
o.stopPropagation(), this.dispatchEvent(
|
|
1352
1355
|
new CustomEvent("delete", { bubbles: !0, composed: !0 })
|
|
1353
1356
|
);
|
|
1354
1357
|
}
|
|
1355
1358
|
startPositioning() {
|
|
1356
1359
|
var t;
|
|
1357
|
-
const
|
|
1358
|
-
!
|
|
1359
|
-
Ct(
|
|
1360
|
+
const o = this.anchor ?? this.targetElement, e = this.floating;
|
|
1361
|
+
!o || !e || ((t = this.cleanup) == null || t.call(this), this.cleanup = bt(o, e, () => {
|
|
1362
|
+
Ct(o, e, {
|
|
1360
1363
|
placement: "right",
|
|
1361
1364
|
middleware: [
|
|
1362
1365
|
Et(12),
|
|
@@ -1364,30 +1367,30 @@ let S = class extends C {
|
|
|
1364
1367
|
xt({ padding: 16, crossAxis: !0 }),
|
|
1365
1368
|
yt({
|
|
1366
1369
|
padding: 16,
|
|
1367
|
-
apply({ availableWidth: n, elements:
|
|
1368
|
-
Object.assign(
|
|
1370
|
+
apply({ availableWidth: n, elements: i }) {
|
|
1371
|
+
Object.assign(i.floating.style, {
|
|
1369
1372
|
maxWidth: `${Math.min(400, n)}px`
|
|
1370
1373
|
});
|
|
1371
1374
|
}
|
|
1372
1375
|
})
|
|
1373
1376
|
]
|
|
1374
|
-
}).then(({ x: n, y:
|
|
1375
|
-
Object.assign(e.style, { left: `${n}px`, top: `${
|
|
1377
|
+
}).then(({ x: n, y: i }) => {
|
|
1378
|
+
Object.assign(e.style, { left: `${n}px`, top: `${i}px` });
|
|
1376
1379
|
});
|
|
1377
1380
|
}));
|
|
1378
1381
|
}
|
|
1379
|
-
updated(
|
|
1380
|
-
(
|
|
1382
|
+
updated(o) {
|
|
1383
|
+
(o.has("targetElement") || o.has("anchor")) && (this.startPositioning(), this.focusEditor());
|
|
1381
1384
|
}
|
|
1382
1385
|
focusEditor() {
|
|
1383
|
-
const
|
|
1386
|
+
const o = this.renderRoot.querySelector(
|
|
1384
1387
|
'slot[name="editor"]'
|
|
1385
|
-
), t = ((
|
|
1388
|
+
), t = ((o == null ? void 0 : o.assignedElements()) ?? [])[0] ?? this.renderRoot.querySelector("llumi-default-editor");
|
|
1386
1389
|
t == null || t.focus();
|
|
1387
1390
|
}
|
|
1388
1391
|
disconnectedCallback() {
|
|
1389
|
-
var
|
|
1390
|
-
super.disconnectedCallback(), (
|
|
1392
|
+
var o;
|
|
1393
|
+
super.disconnectedCallback(), (o = this.cleanup) == null || o.call(this), this.cleanup = void 0;
|
|
1391
1394
|
}
|
|
1392
1395
|
};
|
|
1393
1396
|
S.styles = [
|
|
@@ -1481,17 +1484,17 @@ _([
|
|
|
1481
1484
|
S = _([
|
|
1482
1485
|
N("llumi-comment-dialog")
|
|
1483
1486
|
], S);
|
|
1484
|
-
var le = Object.defineProperty, ce = Object.getOwnPropertyDescriptor,
|
|
1485
|
-
for (var
|
|
1486
|
-
(s =
|
|
1487
|
-
return n &&
|
|
1487
|
+
var le = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, X = (o, e, t, n) => {
|
|
1488
|
+
for (var i = n > 1 ? void 0 : n ? ce(e, t) : e, r = o.length - 1, s; r >= 0; r--)
|
|
1489
|
+
(s = o[r]) && (i = (n ? s(e, t, i) : s(i)) || i);
|
|
1490
|
+
return n && i && le(e, t, i), i;
|
|
1488
1491
|
};
|
|
1489
1492
|
let O = class extends C {
|
|
1490
1493
|
constructor() {
|
|
1491
|
-
super(...arguments), this.barElement = null, this.value = "", this.onDocKeydown = (
|
|
1492
|
-
|
|
1493
|
-
}, this.onDocPointerdown = (
|
|
1494
|
-
const e =
|
|
1494
|
+
super(...arguments), this.barElement = null, this.value = "", this.onDocKeydown = (o) => {
|
|
1495
|
+
o.key === "Escape" && (o.preventDefault(), this.emitClose());
|
|
1496
|
+
}, this.onDocPointerdown = (o) => {
|
|
1497
|
+
const e = o.composedPath();
|
|
1495
1498
|
this.floating && !e.includes(this.floating) && !e.includes(this) && this.emitClose();
|
|
1496
1499
|
};
|
|
1497
1500
|
}
|
|
@@ -1514,10 +1517,10 @@ let O = class extends C {
|
|
|
1514
1517
|
</div>
|
|
1515
1518
|
</div>`;
|
|
1516
1519
|
}
|
|
1517
|
-
onEditorChange(
|
|
1518
|
-
if (typeof
|
|
1519
|
-
const e =
|
|
1520
|
-
|
|
1520
|
+
onEditorChange(o) {
|
|
1521
|
+
if (typeof o.detail != "string") return;
|
|
1522
|
+
const e = o.detail;
|
|
1523
|
+
o.stopPropagation(), this.dispatchEvent(
|
|
1521
1524
|
new CustomEvent("change", { detail: e, bubbles: !0, composed: !0 })
|
|
1522
1525
|
);
|
|
1523
1526
|
}
|
|
@@ -1528,9 +1531,9 @@ let O = class extends C {
|
|
|
1528
1531
|
}
|
|
1529
1532
|
startPositioning() {
|
|
1530
1533
|
var t;
|
|
1531
|
-
const
|
|
1532
|
-
!
|
|
1533
|
-
Ct(
|
|
1534
|
+
const o = this.barElement, e = this.floating;
|
|
1535
|
+
!o || !e || ((t = this.cleanup) == null || t.call(this), this.cleanup = bt(o, e, () => {
|
|
1536
|
+
Ct(o, e, {
|
|
1534
1537
|
placement: "top",
|
|
1535
1538
|
middleware: [
|
|
1536
1539
|
Et(12),
|
|
@@ -1538,27 +1541,27 @@ let O = class extends C {
|
|
|
1538
1541
|
xt({ padding: 16, crossAxis: !0 }),
|
|
1539
1542
|
yt({
|
|
1540
1543
|
padding: 16,
|
|
1541
|
-
apply({ availableWidth: n, elements:
|
|
1542
|
-
Object.assign(
|
|
1544
|
+
apply({ availableWidth: n, elements: i }) {
|
|
1545
|
+
Object.assign(i.floating.style, {
|
|
1543
1546
|
maxWidth: `${Math.min(400, n)}px`
|
|
1544
1547
|
});
|
|
1545
1548
|
}
|
|
1546
1549
|
})
|
|
1547
1550
|
]
|
|
1548
|
-
}).then(({ x: n, y:
|
|
1549
|
-
Object.assign(e.style, { left: `${n}px`, top: `${
|
|
1551
|
+
}).then(({ x: n, y: i }) => {
|
|
1552
|
+
Object.assign(e.style, { left: `${n}px`, top: `${i}px` });
|
|
1550
1553
|
});
|
|
1551
1554
|
}));
|
|
1552
1555
|
}
|
|
1553
1556
|
connectedCallback() {
|
|
1554
1557
|
super.connectedCallback(), document.addEventListener("keydown", this.onDocKeydown), document.addEventListener("pointerdown", this.onDocPointerdown, !0);
|
|
1555
1558
|
}
|
|
1556
|
-
updated(
|
|
1557
|
-
|
|
1559
|
+
updated(o) {
|
|
1560
|
+
o.has("barElement") && this.startPositioning();
|
|
1558
1561
|
}
|
|
1559
1562
|
disconnectedCallback() {
|
|
1560
|
-
var
|
|
1561
|
-
super.disconnectedCallback(), (
|
|
1563
|
+
var o;
|
|
1564
|
+
super.disconnectedCallback(), (o = this.cleanup) == null || o.call(this), this.cleanup = void 0, document.removeEventListener("keydown", this.onDocKeydown), document.removeEventListener("pointerdown", this.onDocPointerdown, !0);
|
|
1562
1565
|
}
|
|
1563
1566
|
};
|
|
1564
1567
|
O.styles = [
|
|
@@ -1592,39 +1595,39 @@ O.styles = [
|
|
|
1592
1595
|
}
|
|
1593
1596
|
`
|
|
1594
1597
|
];
|
|
1595
|
-
|
|
1598
|
+
X([
|
|
1596
1599
|
f({ attribute: !1 })
|
|
1597
1600
|
], O.prototype, "barElement", 2);
|
|
1598
|
-
|
|
1601
|
+
X([
|
|
1599
1602
|
f()
|
|
1600
1603
|
], O.prototype, "value", 2);
|
|
1601
|
-
|
|
1604
|
+
X([
|
|
1602
1605
|
j("[data-floating]")
|
|
1603
1606
|
], O.prototype, "floating", 2);
|
|
1604
|
-
O =
|
|
1607
|
+
O = X([
|
|
1605
1608
|
N("llumi-overall-comment-dialog")
|
|
1606
1609
|
], O);
|
|
1607
|
-
var de = Object.defineProperty, he = Object.getOwnPropertyDescriptor, Tt = (
|
|
1608
|
-
for (var
|
|
1609
|
-
(s =
|
|
1610
|
-
return n &&
|
|
1610
|
+
var de = Object.defineProperty, he = Object.getOwnPropertyDescriptor, Tt = (o, e, t, n) => {
|
|
1611
|
+
for (var i = n > 1 ? void 0 : n ? he(e, t) : e, r = o.length - 1, s; r >= 0; r--)
|
|
1612
|
+
(s = o[r]) && (i = (n ? s(e, t, i) : s(i)) || i);
|
|
1613
|
+
return n && i && de(e, t, i), i;
|
|
1611
1614
|
};
|
|
1612
1615
|
const me = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23404040' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z'/%3E%3C/svg%3E";
|
|
1613
|
-
let
|
|
1616
|
+
let it = class extends C {
|
|
1614
1617
|
constructor() {
|
|
1615
1618
|
super(...arguments), this.positions = [];
|
|
1616
1619
|
}
|
|
1617
1620
|
render() {
|
|
1618
1621
|
return w`${_t(
|
|
1619
1622
|
this.positions,
|
|
1620
|
-
(
|
|
1621
|
-
(
|
|
1623
|
+
(o) => o.commentId,
|
|
1624
|
+
(o) => w`<button
|
|
1622
1625
|
type="button"
|
|
1623
|
-
@click=${(e) => this.onClick(e,
|
|
1626
|
+
@click=${(e) => this.onClick(e, o.commentId)}
|
|
1624
1627
|
style=${Mt({
|
|
1625
1628
|
position: "absolute",
|
|
1626
|
-
top: `${
|
|
1627
|
-
left: `${
|
|
1629
|
+
top: `${o.top - 10}px`,
|
|
1630
|
+
left: `${o.left + 2}px`,
|
|
1628
1631
|
width: "20px",
|
|
1629
1632
|
height: "20px",
|
|
1630
1633
|
borderRadius: "50%",
|
|
@@ -1642,8 +1645,8 @@ let nt = class extends C {
|
|
|
1642
1645
|
></button>`
|
|
1643
1646
|
)}`;
|
|
1644
1647
|
}
|
|
1645
|
-
onClick(
|
|
1646
|
-
|
|
1648
|
+
onClick(o, e) {
|
|
1649
|
+
o.stopPropagation(), this.dispatchEvent(
|
|
1647
1650
|
new CustomEvent("icon-click", {
|
|
1648
1651
|
detail: e,
|
|
1649
1652
|
bubbles: !0,
|
|
@@ -1654,28 +1657,28 @@ let nt = class extends C {
|
|
|
1654
1657
|
};
|
|
1655
1658
|
Tt([
|
|
1656
1659
|
f({ attribute: !1 })
|
|
1657
|
-
],
|
|
1658
|
-
|
|
1660
|
+
], it.prototype, "positions", 2);
|
|
1661
|
+
it = Tt([
|
|
1659
1662
|
N("llumi-selection-comment-icons")
|
|
1660
|
-
],
|
|
1661
|
-
const K = "data-review-selectable",
|
|
1662
|
-
::highlight(${
|
|
1663
|
+
], it);
|
|
1664
|
+
const K = "data-review-selectable", ot = "review-selection-commented", rt = "review-selection-editing", R = "review-selection-hover", ue = `
|
|
1665
|
+
::highlight(${ot}) {
|
|
1663
1666
|
background-color: var(--review-selection-commented-color, oklch(0.85 0.08 250 / 0.4));
|
|
1664
1667
|
}
|
|
1665
|
-
::highlight(${
|
|
1668
|
+
::highlight(${rt}) {
|
|
1666
1669
|
background-color: var(--review-selection-editing-color, oklch(0.75 0.12 250 / 0.6));
|
|
1667
1670
|
}
|
|
1668
1671
|
::highlight(${R}) {
|
|
1669
1672
|
background-color: var(--review-selection-hover-color, oklch(0.8 0.1 250 / 0.5));
|
|
1670
1673
|
}
|
|
1671
1674
|
`, vt = "data-llumi-review-highlight";
|
|
1672
|
-
function
|
|
1675
|
+
function st() {
|
|
1673
1676
|
if (!(typeof CSS > "u"))
|
|
1674
1677
|
return CSS.highlights;
|
|
1675
1678
|
}
|
|
1676
|
-
function
|
|
1679
|
+
function at(...o) {
|
|
1677
1680
|
return new Highlight(
|
|
1678
|
-
...
|
|
1681
|
+
...o
|
|
1679
1682
|
);
|
|
1680
1683
|
}
|
|
1681
1684
|
class ge {
|
|
@@ -1684,8 +1687,8 @@ class ge {
|
|
|
1684
1687
|
this.repositionRaf || (this.repositionRaf = requestAnimationFrame(() => {
|
|
1685
1688
|
if (this.repositionRaf = 0, !this.ctx.isAnnotating() || this.ranges.size === 0) return;
|
|
1686
1689
|
const t = [];
|
|
1687
|
-
for (const [n,
|
|
1688
|
-
const r = this.iconPositionForRange(n,
|
|
1690
|
+
for (const [n, i] of this.ranges) {
|
|
1691
|
+
const r = this.iconPositionForRange(n, i);
|
|
1689
1692
|
r && t.push(r);
|
|
1690
1693
|
}
|
|
1691
1694
|
this.ctx.icons.positions = t;
|
|
@@ -1703,9 +1706,9 @@ class ge {
|
|
|
1703
1706
|
* to a comment whose content is not yet committed, hence the fallback).
|
|
1704
1707
|
*/
|
|
1705
1708
|
update(e) {
|
|
1706
|
-
const t =
|
|
1709
|
+
const t = st();
|
|
1707
1710
|
if (!t) return;
|
|
1708
|
-
const n =
|
|
1711
|
+
const n = at(), i = at(), r = /* @__PURE__ */ new Map(), s = [], a = this.ctx.getSnapshot();
|
|
1709
1712
|
let l = !1;
|
|
1710
1713
|
for (const h of e) {
|
|
1711
1714
|
if (!h.selection) continue;
|
|
@@ -1714,12 +1717,12 @@ class ge {
|
|
|
1714
1717
|
);
|
|
1715
1718
|
if (!g) continue;
|
|
1716
1719
|
this.ensureShadowRootWired(g);
|
|
1717
|
-
const m =
|
|
1720
|
+
const m = nt(g, h.selection);
|
|
1718
1721
|
if (!m || m.toString() !== h.selection.selectedText) {
|
|
1719
1722
|
l = !0;
|
|
1720
1723
|
continue;
|
|
1721
1724
|
}
|
|
1722
|
-
r.set(h.commentId, m), h.commentId === a.editingCommentId ?
|
|
1725
|
+
r.set(h.commentId, m), h.commentId === a.editingCommentId ? i.add(m) : n.add(m);
|
|
1723
1726
|
const M = this.iconPositionForRange(h.commentId, m);
|
|
1724
1727
|
M && s.push(M);
|
|
1725
1728
|
}
|
|
@@ -1734,15 +1737,15 @@ class ge {
|
|
|
1734
1737
|
);
|
|
1735
1738
|
if (g) {
|
|
1736
1739
|
this.ensureShadowRootWired(g);
|
|
1737
|
-
const m =
|
|
1738
|
-
m ?
|
|
1740
|
+
const m = nt(g, h.selection);
|
|
1741
|
+
m ? i.add(m) : l = !0;
|
|
1739
1742
|
}
|
|
1740
1743
|
}
|
|
1741
1744
|
}
|
|
1742
1745
|
this.ranges = r, t.set(
|
|
1743
|
-
|
|
1746
|
+
ot,
|
|
1744
1747
|
n
|
|
1745
|
-
), t.set(
|
|
1748
|
+
), t.set(rt, i), this.ctx.icons.positions = s, l && this.retryCount < 10 && this.ctx.isAnnotating() ? (this.retryCount++, this.retryRaf = requestAnimationFrame(() => {
|
|
1746
1749
|
this.retryRaf = 0, this.ctx.isAnnotating() && this.update(
|
|
1747
1750
|
this.ctx.getSnapshot().comments.filter((h) => h.selection)
|
|
1748
1751
|
);
|
|
@@ -1751,11 +1754,11 @@ class ge {
|
|
|
1751
1754
|
// Page-coordinate position of a selection comment's icon, anchored to the
|
|
1752
1755
|
// end of its range (so it sits just past the selected text).
|
|
1753
1756
|
iconPositionForRange(e, t) {
|
|
1754
|
-
const n = t.getClientRects(),
|
|
1755
|
-
return
|
|
1757
|
+
const n = t.getClientRects(), i = n[n.length - 1];
|
|
1758
|
+
return i ? {
|
|
1756
1759
|
commentId: e,
|
|
1757
|
-
top:
|
|
1758
|
-
left:
|
|
1760
|
+
top: i.top + window.scrollY,
|
|
1761
|
+
left: i.right + window.scrollX
|
|
1759
1762
|
} : null;
|
|
1760
1763
|
}
|
|
1761
1764
|
/**
|
|
@@ -1776,20 +1779,20 @@ class ge {
|
|
|
1776
1779
|
const t = e.shadowRoot;
|
|
1777
1780
|
if (!t || this.observedShadowRoots.has(t)) return;
|
|
1778
1781
|
if (this.observedShadowRoots.add(t), !t.querySelector(`style[${vt}]`)) {
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1782
|
+
const i = document.createElement("style");
|
|
1783
|
+
i.setAttribute(vt, ""), i.textContent = ue, t.prepend(i);
|
|
1781
1784
|
}
|
|
1782
1785
|
const n = new MutationObserver(() => {
|
|
1783
1786
|
this.ctx.isAnnotating() && this.update(
|
|
1784
|
-
this.ctx.getSnapshot().comments.filter((
|
|
1787
|
+
this.ctx.getSnapshot().comments.filter((i) => i.selection)
|
|
1785
1788
|
);
|
|
1786
1789
|
});
|
|
1787
1790
|
n.observe(t, { childList: !0, subtree: !0, characterData: !0 }), this.shadowObservers.push(n);
|
|
1788
1791
|
}
|
|
1789
1792
|
/** Clear all three highlight registries, the `rangeMap`, and icon positions. */
|
|
1790
1793
|
clear() {
|
|
1791
|
-
const e =
|
|
1792
|
-
e && (e.delete(
|
|
1794
|
+
const e = st();
|
|
1795
|
+
e && (e.delete(ot), e.delete(rt), e.delete(R)), this.retryRaf && (cancelAnimationFrame(this.retryRaf), this.retryRaf = 0), this.retryCount = 0;
|
|
1793
1796
|
for (const t of this.shadowObservers) t.disconnect();
|
|
1794
1797
|
this.shadowObservers = [], this.observedShadowRoots = /* @__PURE__ */ new WeakSet(), this.ranges.clear(), this.ctx.icons.positions = [];
|
|
1795
1798
|
}
|
|
@@ -1807,16 +1810,17 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1807
1810
|
super(...arguments), this.persistence = pt, this.manager = null, this.hoveredComment = null, this.selectionJustHandled = !1, this.selectionComments = [], this.commentDialog = null, this.commentDialogAnchorId = null, this.overallDialog = null, this.onPointerUp = () => {
|
|
1808
1811
|
if (!this.isAnnotating()) return;
|
|
1809
1812
|
const e = window.getSelection();
|
|
1810
|
-
if (!e
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
+
if (!e) return;
|
|
1814
|
+
const t = q(e, this);
|
|
1815
|
+
if (!t || t.collapsed) return;
|
|
1816
|
+
const n = tt(t.startContainer);
|
|
1813
1817
|
if (!n) return;
|
|
1814
|
-
const
|
|
1815
|
-
if (
|
|
1818
|
+
const i = tt(t.endContainer);
|
|
1819
|
+
if (i && i !== n) {
|
|
1816
1820
|
e.removeAllRanges();
|
|
1817
1821
|
return;
|
|
1818
1822
|
}
|
|
1819
|
-
if (!
|
|
1823
|
+
if (!i || !Bt(e, n)) {
|
|
1820
1824
|
const a = Vt(e, n);
|
|
1821
1825
|
if (!a) return;
|
|
1822
1826
|
e.removeAllRanges(), e.addRange(a);
|
|
@@ -1832,25 +1836,25 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1832
1836
|
}));
|
|
1833
1837
|
}, this.onPointerMove = (e) => {
|
|
1834
1838
|
if (!this.isAnnotating()) return;
|
|
1835
|
-
const t =
|
|
1839
|
+
const t = st();
|
|
1836
1840
|
if (!t) return;
|
|
1837
1841
|
const n = this.caretPosition(e.clientX, e.clientY);
|
|
1838
1842
|
if (!n) {
|
|
1839
1843
|
this.hoveredComment && (t.delete(R), this.hoveredComment = null);
|
|
1840
1844
|
return;
|
|
1841
1845
|
}
|
|
1842
|
-
let
|
|
1846
|
+
let i = null;
|
|
1843
1847
|
for (const [r, s] of this.painter.rangeMap)
|
|
1844
1848
|
if (s.isPointInRange(n.offsetNode, n.offset)) {
|
|
1845
|
-
|
|
1849
|
+
i = r;
|
|
1846
1850
|
break;
|
|
1847
1851
|
}
|
|
1848
|
-
if (
|
|
1849
|
-
if (this.hoveredComment =
|
|
1850
|
-
const r = this.painter.rangeMap.get(
|
|
1852
|
+
if (i !== this.hoveredComment)
|
|
1853
|
+
if (this.hoveredComment = i, i) {
|
|
1854
|
+
const r = this.painter.rangeMap.get(i);
|
|
1851
1855
|
r && t.set(
|
|
1852
1856
|
R,
|
|
1853
|
-
|
|
1857
|
+
at(r)
|
|
1854
1858
|
);
|
|
1855
1859
|
} else
|
|
1856
1860
|
t.delete(R);
|
|
@@ -1870,7 +1874,7 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1870
1874
|
(g) => g.commentId === a
|
|
1871
1875
|
);
|
|
1872
1876
|
if (!v) continue;
|
|
1873
|
-
const h =
|
|
1877
|
+
const h = tt(n.offsetNode);
|
|
1874
1878
|
if (!h) continue;
|
|
1875
1879
|
e.stopPropagation(), e.preventDefault(), this.actor.send({
|
|
1876
1880
|
type: "CLICK",
|
|
@@ -1881,12 +1885,12 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1881
1885
|
return;
|
|
1882
1886
|
}
|
|
1883
1887
|
}
|
|
1884
|
-
const
|
|
1888
|
+
const i = e.target, s = i.closest(
|
|
1885
1889
|
".review-highlight-hover, .review-highlight-commented, .review-highlight-editing"
|
|
1886
1890
|
);
|
|
1887
1891
|
if (s && this.contains(s)) {
|
|
1888
1892
|
e.stopPropagation(), e.preventDefault();
|
|
1889
|
-
const a = H(
|
|
1893
|
+
const a = H(i, this.customTargets);
|
|
1890
1894
|
a ? this.actor.send({
|
|
1891
1895
|
type: "CLICK",
|
|
1892
1896
|
targetId: a.targetId,
|
|
@@ -1904,12 +1908,12 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1904
1908
|
}, this.onMouseOver = (e) => {
|
|
1905
1909
|
const t = this.manager;
|
|
1906
1910
|
if (!t || !this.isAnnotating()) return;
|
|
1907
|
-
const n = this.currentEditingTargetId(),
|
|
1911
|
+
const n = this.currentEditingTargetId(), i = H(
|
|
1908
1912
|
e.target,
|
|
1909
1913
|
this.customTargets
|
|
1910
1914
|
);
|
|
1911
|
-
if (
|
|
1912
|
-
t.applyHover(
|
|
1915
|
+
if (i) {
|
|
1916
|
+
t.applyHover(i.element, n);
|
|
1913
1917
|
return;
|
|
1914
1918
|
}
|
|
1915
1919
|
const r = e.target.closest(
|
|
@@ -1919,21 +1923,21 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1919
1923
|
}, this.onMouseOut = (e) => {
|
|
1920
1924
|
const t = this.manager;
|
|
1921
1925
|
if (!t || !this.isAnnotating()) return;
|
|
1922
|
-
const n = this.currentEditingTargetId(),
|
|
1926
|
+
const n = this.currentEditingTargetId(), i = /* @__PURE__ */ new Set();
|
|
1923
1927
|
for (const a of this.actor.getSnapshot().context.comments)
|
|
1924
|
-
!a.selection && a.content.trim() &&
|
|
1928
|
+
!a.selection && a.content.trim() && i.add(a.targetId);
|
|
1925
1929
|
const r = H(
|
|
1926
1930
|
e.target,
|
|
1927
1931
|
this.customTargets
|
|
1928
1932
|
);
|
|
1929
1933
|
if (r) {
|
|
1930
|
-
t.clearHover(r.element, n,
|
|
1934
|
+
t.clearHover(r.element, n, i);
|
|
1931
1935
|
return;
|
|
1932
1936
|
}
|
|
1933
1937
|
const s = e.target.closest(
|
|
1934
1938
|
"[data-review-selectable]"
|
|
1935
1939
|
);
|
|
1936
|
-
s && t.clearHover(s, n,
|
|
1940
|
+
s && t.clearHover(s, n, i);
|
|
1937
1941
|
};
|
|
1938
1942
|
}
|
|
1939
1943
|
get shortcut() {
|
|
@@ -1970,8 +1974,8 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
1970
1974
|
}), this.actor.subscribe(() => this.syncFromSnapshot()), this.actor.start(), this.manager = $t(this, this.customTargets), this.actor.send({ type: "MOUNTED" }), this.addEventListener("pointerup", this.onPointerUp), this.addEventListener("pointermove", this.onPointerMove), this.addEventListener("click", this.onClickCapture, !0), this.addEventListener("click", this.onWrapperClick), this.addEventListener("mouseover", this.onMouseOver), this.addEventListener("mouseout", this.onMouseOut), this.painter.attachListeners(), this.syncFromSnapshot();
|
|
1971
1975
|
}
|
|
1972
1976
|
disconnectedCallback() {
|
|
1973
|
-
var e, t, n,
|
|
1974
|
-
this.removeEventListener("pointerup", this.onPointerUp), this.removeEventListener("pointermove", this.onPointerMove), this.removeEventListener("click", this.onClickCapture, !0), this.removeEventListener("click", this.onWrapperClick), this.removeEventListener("mouseover", this.onMouseOver), this.removeEventListener("mouseout", this.onMouseOut), (e = this.painter) == null || e.detachListeners(), (t = this.painter) == null || t.clear(), (n = this.manager) == null || n.destroy(), this.manager = null, (
|
|
1977
|
+
var e, t, n, i, r, s, a, l;
|
|
1978
|
+
this.removeEventListener("pointerup", this.onPointerUp), this.removeEventListener("pointermove", this.onPointerMove), this.removeEventListener("click", this.onClickCapture, !0), this.removeEventListener("click", this.onWrapperClick), this.removeEventListener("mouseover", this.onMouseOver), this.removeEventListener("mouseout", this.onMouseOut), (e = this.painter) == null || e.detachListeners(), (t = this.painter) == null || t.clear(), (n = this.manager) == null || n.destroy(), this.manager = null, (i = this.actor) == null || i.stop(), (r = this.bar) == null || r.remove(), (s = this.commentDialog) == null || s.remove(), (a = this.overallDialog) == null || a.remove(), (l = this.icons) == null || l.remove();
|
|
1975
1979
|
}
|
|
1976
1980
|
attributeChangedCallback() {
|
|
1977
1981
|
this.bar && (this.bar.barPosition = this.barPosition);
|
|
@@ -2016,7 +2020,7 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
2016
2020
|
// null when the range can't be restored, so the dialog falls back to anchoring
|
|
2017
2021
|
// on the whole element.
|
|
2018
2022
|
selectionAnchor(e, t) {
|
|
2019
|
-
const n =
|
|
2023
|
+
const n = nt(e, t);
|
|
2020
2024
|
return n ? {
|
|
2021
2025
|
getBoundingClientRect: () => n.getBoundingClientRect(),
|
|
2022
2026
|
getClientRects: () => n.getClientRects(),
|
|
@@ -2044,7 +2048,7 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
2044
2048
|
), document.body.append(this.icons);
|
|
2045
2049
|
}
|
|
2046
2050
|
onIconClick(e) {
|
|
2047
|
-
const t = this.actor.getSnapshot().context.comments.find((
|
|
2051
|
+
const t = this.actor.getSnapshot().context.comments.find((i) => i.commentId === e);
|
|
2048
2052
|
if (!t) return;
|
|
2049
2053
|
const n = this.querySelector(
|
|
2050
2054
|
`[${K}="${t.targetId}"]`
|
|
@@ -2058,11 +2062,11 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
2058
2062
|
}
|
|
2059
2063
|
// --- snapshot → UI sync ---
|
|
2060
2064
|
syncFromSnapshot() {
|
|
2061
|
-
const e = this.actor.getSnapshot(), { comments: t, overallComment: n, editingCommentId:
|
|
2065
|
+
const e = this.actor.getSnapshot(), { comments: t, overallComment: n, editingCommentId: i, targetElement: r } = e.context;
|
|
2062
2066
|
this.selectionComments = t.filter(
|
|
2063
2067
|
(m) => m.selection && m.content.trim()
|
|
2064
2068
|
);
|
|
2065
|
-
const s = !e.matches({ annotating: "inactive" }), a = e.matches({ commenting: "editing" }), l =
|
|
2069
|
+
const s = !e.matches({ annotating: "inactive" }), a = e.matches({ commenting: "editing" }), l = i ? t.find((m) => m.commentId === i) : null, v = a && i === null, h = t.filter((m) => m.content.trim()).length, g = n.trim().length > 0;
|
|
2066
2070
|
this.bar.mode = s ? l ? "editing" : "commenting" : "idle", this.bar.commentCount = h, this.bar.hasOverallComment = g, this.bar.overallCommentOpen = v, this.icons.style.display = s ? "" : "none", a && l && r ? (this.commentDialog || (this.commentDialog = document.createElement(
|
|
2067
2071
|
"llumi-comment-dialog"
|
|
2068
2072
|
), this.commentDialog.addEventListener(
|
|
@@ -2145,13 +2149,13 @@ const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
|
2145
2149
|
}
|
|
2146
2150
|
};
|
|
2147
2151
|
ct.observedAttributes = ["bar-position", "shortcut", "default-mode"];
|
|
2148
|
-
let
|
|
2149
|
-
customElements.get("llumi-review") || customElements.define("llumi-review",
|
|
2152
|
+
let lt = ct;
|
|
2153
|
+
customElements.get("llumi-review") || customElements.define("llumi-review", lt);
|
|
2150
2154
|
export {
|
|
2151
2155
|
S as LlumiCommentDialog,
|
|
2152
2156
|
I as LlumiDefaultEditor,
|
|
2153
2157
|
O as LlumiOverallCommentDialog,
|
|
2154
|
-
|
|
2158
|
+
lt as LlumiReview,
|
|
2155
2159
|
b as LlumiReviewBar,
|
|
2156
|
-
|
|
2160
|
+
it as LlumiSelectionCommentIcons
|
|
2157
2161
|
};
|