@llumi/design-system 2.1.1 → 2.1.3
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-INmlhDAE.js → adopt-global-styles-D6lWTS0e.js} +1 -1
- package/base.css +1 -1
- package/bpmn.mjs +7 -7
- package/copy-button.mjs +3 -3
- package/download-button.mjs +3 -3
- package/highlighter.mjs +3 -3
- package/{icon-button-DAkuwHJL.js → icon-button-96SPshca.js} +1 -1
- package/{icons-Cjb2xhwP.js → icons-1XY8iOrm.js} +1 -1
- package/{index-CAsEAVKB.js → index-NX_ixyBG.js} +1 -1
- package/{llumi-element-DREcOcPF.js → llumi-element-B5OMT-K9.js} +1 -1
- package/mermaid.mjs +14 -14
- package/package.json +1 -1
- package/review.mjs +601 -488
- package/{slot-text-D4E6m0AN.js → slot-text-BmOKO3bK.js} +1 -1
- package/theme.css +1 -1
package/review.mjs
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { fromCallback as
|
|
2
|
-
import { a as
|
|
3
|
-
import { tinykeys as
|
|
4
|
-
import { html as w, css as
|
|
5
|
-
import { property as
|
|
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-D6lWTS0e.js";
|
|
3
|
+
import { tinykeys as Nt } from "https://cdn.jsdelivr.net/npm/tinykeys@3.1.0/+esm";
|
|
4
|
+
import { html as w, css as W } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/+esm";
|
|
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
|
|
8
|
-
import { L as C } from "./llumi-element-
|
|
9
|
-
import { autoUpdate as
|
|
10
|
-
import { repeat as
|
|
11
|
-
import { styleMap as
|
|
12
|
-
/*! @llumi/design-system v2.1.
|
|
13
|
-
function
|
|
14
|
-
const t =
|
|
7
|
+
import { i as G } from "./icons-1XY8iOrm.js";
|
|
8
|
+
import { L as C } from "./llumi-element-B5OMT-K9.js";
|
|
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
|
+
import { repeat as _t } from "https://cdn.jsdelivr.net/npm/lit@3.3.3/directives/repeat.js/+esm";
|
|
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.3 | (c) 2026 pAIrprog SAS | license: https://cdn.jsdelivr.net/npm/@llumi/design-system@2.1.3/LICENSE | bundled third-party components under MIT, see NOTICE | @license */
|
|
13
|
+
function ut(i, e) {
|
|
14
|
+
const t = i.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 (i.matches(n.selector)) {
|
|
18
|
+
const o = n.toId(i);
|
|
19
|
+
if (o) return o;
|
|
20
20
|
}
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const t =
|
|
23
|
+
function H(i, e) {
|
|
24
|
+
const t = i.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 o = i.closest(n.selector);
|
|
31
|
+
if (o) {
|
|
32
|
+
const r = n.toId(o);
|
|
33
|
+
if (r) return { element: o, targetId: r };
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
function D(
|
|
38
|
+
function D(i, e) {
|
|
39
39
|
const t = /* @__PURE__ */ new Set(), n = [];
|
|
40
|
-
for (const
|
|
41
|
-
|
|
40
|
+
for (const o of Array.from(
|
|
41
|
+
i.querySelectorAll("[data-review-id]")
|
|
42
42
|
)) {
|
|
43
|
-
const r =
|
|
43
|
+
const r = o.getAttribute("data-review-id");
|
|
44
44
|
if (!r) continue;
|
|
45
|
-
const s =
|
|
45
|
+
const s = o.hasAttribute("data-review-selectable");
|
|
46
46
|
n.push({
|
|
47
|
-
element:
|
|
47
|
+
element: o,
|
|
48
48
|
targetId: r,
|
|
49
49
|
kind: s ? "both" : "element"
|
|
50
|
-
}), t.add(
|
|
50
|
+
}), t.add(o);
|
|
51
51
|
}
|
|
52
|
-
for (const
|
|
52
|
+
for (const o of e ?? [])
|
|
53
53
|
for (const r of Array.from(
|
|
54
|
-
|
|
54
|
+
i.querySelectorAll(o.selector)
|
|
55
55
|
)) {
|
|
56
56
|
if (t.has(r)) continue;
|
|
57
|
-
const s =
|
|
57
|
+
const s = o.toId(r);
|
|
58
58
|
if (!s) continue;
|
|
59
59
|
const a = r.hasAttribute("data-review-selectable");
|
|
60
60
|
n.push({
|
|
@@ -63,125 +63,125 @@ function D(o, e) {
|
|
|
63
63
|
kind: a ? "both" : "element"
|
|
64
64
|
}), t.add(r);
|
|
65
65
|
}
|
|
66
|
-
for (const
|
|
67
|
-
|
|
66
|
+
for (const o of Array.from(
|
|
67
|
+
i.querySelectorAll("[data-review-selectable]")
|
|
68
68
|
)) {
|
|
69
|
-
if (t.has(
|
|
70
|
-
const r =
|
|
71
|
-
r && (n.push({ element:
|
|
69
|
+
if (t.has(o)) continue;
|
|
70
|
+
const r = o.getAttribute("data-review-selectable");
|
|
71
|
+
r && (n.push({ element: o, targetId: r, kind: "selectable" }), t.add(o));
|
|
72
72
|
}
|
|
73
73
|
return n;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const tt = "review-highlight-hover", y = "review-highlight-commented", z = "review-highlight-editing", F = "review-highlight-uncommented", V = "review-target", gt = "review-active";
|
|
76
|
+
function Y(i) {
|
|
77
|
+
i.classList.remove(
|
|
78
|
+
tt,
|
|
79
79
|
y,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
z,
|
|
81
|
+
F
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
let t = null, n = null,
|
|
84
|
+
function $t(i, e) {
|
|
85
|
+
let t = null, n = null, o = null;
|
|
86
86
|
function r(c) {
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
for (const { element:
|
|
90
|
-
(
|
|
87
|
+
i.classList.add(gt);
|
|
88
|
+
const u = D(i, e);
|
|
89
|
+
for (const { element: p, targetId: d, kind: L } of u)
|
|
90
|
+
(L === "element" || L === "both") && (p.hasAttribute("data-review-id") || p.classList.add(V), c.has(d) && p.classList.add(y));
|
|
91
91
|
}
|
|
92
92
|
function s() {
|
|
93
|
-
|
|
94
|
-
const c = D(
|
|
95
|
-
for (const { element:
|
|
96
|
-
|
|
93
|
+
i.classList.remove(gt), t && (clearTimeout(t), t = null);
|
|
94
|
+
const c = D(i, e);
|
|
95
|
+
for (const { element: u } of c)
|
|
96
|
+
Y(u), u.classList.remove(V);
|
|
97
97
|
}
|
|
98
98
|
function a(c) {
|
|
99
|
-
const
|
|
100
|
-
for (const { element: d } of
|
|
101
|
-
!d.classList.contains(y) && !d.classList.contains(
|
|
99
|
+
const u = D(i, e), p = [];
|
|
100
|
+
for (const { element: d } of u)
|
|
101
|
+
!d.classList.contains(y) && !d.classList.contains(z) && (d.classList.add(F), p.push(d));
|
|
102
102
|
c && (t && clearTimeout(t), t = setTimeout(() => {
|
|
103
103
|
t = null;
|
|
104
|
-
for (const d of
|
|
105
|
-
d.classList.contains(
|
|
104
|
+
for (const d of p)
|
|
105
|
+
d.classList.contains(z) || d.classList.remove(F);
|
|
106
106
|
}, 500));
|
|
107
107
|
}
|
|
108
108
|
function l() {
|
|
109
109
|
t && (clearTimeout(t), t = null);
|
|
110
|
-
const c = D(
|
|
111
|
-
for (const { element:
|
|
112
|
-
|
|
110
|
+
const c = D(i, e);
|
|
111
|
+
for (const { element: u } of c)
|
|
112
|
+
u.classList.remove(F);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
114
|
+
function v(c, u) {
|
|
115
|
+
u || (Y(c), c.classList.add(z));
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
|
|
117
|
+
function h(c, u) {
|
|
118
|
+
Y(c), u && c.classList.add(y);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
(
|
|
120
|
+
function g(c, u) {
|
|
121
|
+
(ut(c, e) ?? c.getAttribute("data-review-selectable")) !== u && c.classList.add(tt);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
const d =
|
|
125
|
-
d !==
|
|
123
|
+
function m(c, u, p) {
|
|
124
|
+
const d = ut(c, e) ?? c.getAttribute("data-review-selectable");
|
|
125
|
+
d !== u && (c.classList.remove(tt), d && (p != null && p.has(d)) && c.classList.add(y));
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
for (const
|
|
130
|
-
for (const d of Array.from(
|
|
127
|
+
function M(c) {
|
|
128
|
+
X(), o = c.editingTarget ?? null, n = new MutationObserver((u) => {
|
|
129
|
+
for (const p of u) {
|
|
130
|
+
for (const d of Array.from(p.removedNodes)) {
|
|
131
131
|
if (!(d instanceof HTMLElement)) continue;
|
|
132
|
-
|
|
132
|
+
o && (d === o || d.contains(o)) && (o = null, c.onTargetDisconnected()), (d.hasAttribute("data-review-selectable") || d.querySelector("[data-review-selectable]") !== null) && c.onSelectableReconnected();
|
|
133
133
|
}
|
|
134
|
-
for (const d of Array.from(
|
|
134
|
+
for (const d of Array.from(p.addedNodes)) {
|
|
135
135
|
if (!(d instanceof HTMLElement)) continue;
|
|
136
|
-
const
|
|
136
|
+
const L = [
|
|
137
137
|
...d.matches("[data-review-id]") ? [d] : [],
|
|
138
138
|
...Array.from(
|
|
139
139
|
d.querySelectorAll("[data-review-id]")
|
|
140
140
|
)
|
|
141
141
|
];
|
|
142
|
-
for (const T of
|
|
143
|
-
const
|
|
144
|
-
|
|
142
|
+
for (const T of L) {
|
|
143
|
+
const $ = T.getAttribute("data-review-id");
|
|
144
|
+
$ && c.commentedIds.has($) && T.classList.add(y);
|
|
145
145
|
}
|
|
146
146
|
for (const T of e ?? []) {
|
|
147
|
-
const
|
|
147
|
+
const $ = [
|
|
148
148
|
...d.matches(T.selector) ? [d] : [],
|
|
149
149
|
...Array.from(d.querySelectorAll(T.selector))
|
|
150
150
|
];
|
|
151
|
-
for (const
|
|
152
|
-
const
|
|
153
|
-
|
|
151
|
+
for (const B of $) {
|
|
152
|
+
const dt = T.toId(B);
|
|
153
|
+
B.classList.add(V), dt && c.commentedIds.has(dt) && B.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(i, { childList: !0, subtree: !0 });
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
n && (n.disconnect(), n = null),
|
|
161
|
+
function X() {
|
|
162
|
+
n && (n.disconnect(), n = null), o = null;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
s(),
|
|
164
|
+
function Ot() {
|
|
165
|
+
s(), X();
|
|
166
166
|
}
|
|
167
167
|
return {
|
|
168
168
|
activate: r,
|
|
169
169
|
deactivate: s,
|
|
170
170
|
reveal: a,
|
|
171
171
|
unreveal: l,
|
|
172
|
-
setEditing:
|
|
173
|
-
clearEditing:
|
|
174
|
-
applyHover:
|
|
175
|
-
clearHover:
|
|
176
|
-
startObserving:
|
|
177
|
-
stopObserving:
|
|
178
|
-
destroy:
|
|
172
|
+
setEditing: v,
|
|
173
|
+
clearEditing: h,
|
|
174
|
+
applyHover: g,
|
|
175
|
+
clearHover: m,
|
|
176
|
+
startObserving: M,
|
|
177
|
+
stopObserving: X,
|
|
178
|
+
destroy: Ot
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
function
|
|
183
|
-
const t =
|
|
184
|
-
(
|
|
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(i, e) {
|
|
183
|
+
const t = i.find(
|
|
184
|
+
(o) => o.targetId === e && !o.selection
|
|
185
185
|
);
|
|
186
186
|
return t ? { comment: t, isNew: !1 } : { comment: {
|
|
187
187
|
commentId: crypto.randomUUID(),
|
|
@@ -190,14 +190,14 @@ function Pt(o, e) {
|
|
|
190
190
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
191
191
|
}, isNew: !0 };
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
let e =
|
|
195
|
-
if (
|
|
193
|
+
function zt(i) {
|
|
194
|
+
let e = i.comments;
|
|
195
|
+
if (i.editingCommentId !== null) {
|
|
196
196
|
const t = e.find(
|
|
197
|
-
(n) => n.commentId ===
|
|
197
|
+
(n) => n.commentId === i.editingCommentId
|
|
198
198
|
);
|
|
199
199
|
t && t.content === "" && (e = e.filter(
|
|
200
|
-
(n) => n.commentId !==
|
|
200
|
+
(n) => n.commentId !== i.editingCommentId
|
|
201
201
|
));
|
|
202
202
|
}
|
|
203
203
|
return {
|
|
@@ -207,28 +207,28 @@ function Rt(o) {
|
|
|
207
207
|
selectionRange: null
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
const e =
|
|
210
|
+
function J(i) {
|
|
211
|
+
const e = i.comments.filter((o) => o.content.trim()), t = e.length > 0, n = i.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 ? i.overallComment.trim() : void 0
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function Ft(i) {
|
|
219
219
|
const e = /* @__PURE__ */ new Set();
|
|
220
|
-
for (const t of
|
|
220
|
+
for (const t of i.comments)
|
|
221
221
|
!t.selection && t.content.trim() && e.add(t.targetId);
|
|
222
222
|
return e;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
const
|
|
224
|
+
function Ut() {
|
|
225
|
+
const i = ht(
|
|
226
226
|
({ sendBack: t, input: n }) => {
|
|
227
|
-
const
|
|
227
|
+
const o = () => 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" });
|
|
231
|
-
}, a =
|
|
231
|
+
}, a = Nt(window, {
|
|
232
232
|
[n.shortcut]: (l) => {
|
|
233
233
|
l.preventDefault(), t({ type: "TOGGLE" });
|
|
234
234
|
},
|
|
@@ -242,12 +242,12 @@ function Mt() {
|
|
|
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", o), () => {
|
|
246
|
+
a(), window.removeEventListener("keydown", r), window.removeEventListener("keyup", s), window.removeEventListener("blur", o);
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
), e =
|
|
250
|
-
const
|
|
249
|
+
), e = ht(({ sendBack: t, input: n }) => {
|
|
250
|
+
const o = 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,9 +255,9 @@ function Mt() {
|
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
return
|
|
258
|
+
return o.observe(n.wrapperElement, { childList: !0, subtree: !0 }), () => o.disconnect();
|
|
259
259
|
});
|
|
260
|
-
return
|
|
260
|
+
return Lt({
|
|
261
261
|
types: {
|
|
262
262
|
context: {},
|
|
263
263
|
events: {},
|
|
@@ -265,11 +265,11 @@ function Mt() {
|
|
|
265
265
|
emitted: {}
|
|
266
266
|
},
|
|
267
267
|
actors: {
|
|
268
|
-
keyboardActor:
|
|
268
|
+
keyboardActor: i,
|
|
269
269
|
mutationObserverActor: e
|
|
270
270
|
},
|
|
271
271
|
guards: {
|
|
272
|
-
isCommentingEditing:
|
|
272
|
+
isCommentingEditing: At({ commenting: "editing" }),
|
|
273
273
|
hasSelectionCommentId: ({ event: t }) => t.type !== "CLICK" ? !1 : !!t.selectionCommentId,
|
|
274
274
|
hasTargetId: ({ event: t }) => t.type !== "CLICK" ? !1 : !!t.targetId && !t.selectionCommentId,
|
|
275
275
|
hasNoTarget: ({ event: t }) => t.type !== "CLICK" ? !1 : !t.targetId && !t.selectionCommentId,
|
|
@@ -278,10 +278,10 @@ function Mt() {
|
|
|
278
278
|
if (n.selectionCommentId)
|
|
279
279
|
return t.editingCommentId === n.selectionCommentId;
|
|
280
280
|
if (n.targetId) {
|
|
281
|
-
const
|
|
281
|
+
const o = t.comments.find(
|
|
282
282
|
(r) => r.commentId === t.editingCommentId
|
|
283
283
|
);
|
|
284
|
-
return !!
|
|
284
|
+
return !!o && o.targetId === n.targetId && !o.selection;
|
|
285
285
|
}
|
|
286
286
|
return !1;
|
|
287
287
|
}
|
|
@@ -292,13 +292,13 @@ function Mt() {
|
|
|
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: o, 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, o] : t.comments,
|
|
301
|
+
editingCommentId: o.commentId,
|
|
302
302
|
targetElement: n.element ?? null,
|
|
303
303
|
selectionRange: null
|
|
304
304
|
};
|
|
@@ -310,7 +310,7 @@ function Mt() {
|
|
|
310
310
|
}),
|
|
311
311
|
createSelectionComment: E(({ context: t, event: n }) => {
|
|
312
312
|
if (n.type !== "SELECT_TEXT") return {};
|
|
313
|
-
const
|
|
313
|
+
const o = {
|
|
314
314
|
commentId: crypto.randomUUID(),
|
|
315
315
|
targetId: n.targetId,
|
|
316
316
|
content: "",
|
|
@@ -318,15 +318,15 @@ function Mt() {
|
|
|
318
318
|
selection: n.selectionRange
|
|
319
319
|
};
|
|
320
320
|
return {
|
|
321
|
-
comments: [...t.comments,
|
|
322
|
-
editingCommentId:
|
|
321
|
+
comments: [...t.comments, o],
|
|
322
|
+
editingCommentId: o.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
|
+
(o) => o.commentId === t.editingCommentId ? { ...o, content: n.content } : o
|
|
330
330
|
)
|
|
331
331
|
}),
|
|
332
332
|
deleteComment: E(({ context: t }) => ({
|
|
@@ -337,17 +337,17 @@ function Mt() {
|
|
|
337
337
|
targetElement: null,
|
|
338
338
|
selectionRange: null
|
|
339
339
|
})),
|
|
340
|
-
cleanup: E(({ context: t }) =>
|
|
341
|
-
emitChanged:
|
|
340
|
+
cleanup: E(({ context: t }) => zt(t)),
|
|
341
|
+
emitChanged: mt(({ context: t }) => ({
|
|
342
342
|
type: "REVIEW_CHANGED",
|
|
343
|
-
result:
|
|
343
|
+
result: J(t)
|
|
344
344
|
})),
|
|
345
345
|
persistSave: ({ context: t }) => {
|
|
346
|
-
t.persistence.save(
|
|
346
|
+
t.persistence.save(J(t));
|
|
347
347
|
},
|
|
348
|
-
emitSubmitted:
|
|
348
|
+
emitSubmitted: mt(({ context: t }) => ({
|
|
349
349
|
type: "REVIEW_SUBMITTED",
|
|
350
|
-
result:
|
|
350
|
+
result: J(t)
|
|
351
351
|
})),
|
|
352
352
|
// Highlight lifecycle actions — call manager methods directly via
|
|
353
353
|
// callbacks passed through input. The machine owns WHEN highlights
|
|
@@ -355,7 +355,7 @@ function Mt() {
|
|
|
355
355
|
// Actions run synchronously during transitions — no timing gap.
|
|
356
356
|
// Never add useEffects that react to derived machine state.
|
|
357
357
|
highlightsActivate: ({ context: t }) => {
|
|
358
|
-
t.highlights.activate(
|
|
358
|
+
t.highlights.activate(Ft(t));
|
|
359
359
|
},
|
|
360
360
|
highlightsDeactivate: ({ context: t }) => {
|
|
361
361
|
t.highlights.deactivate();
|
|
@@ -370,17 +370,17 @@ function Mt() {
|
|
|
370
370
|
t.highlights.unreveal();
|
|
371
371
|
},
|
|
372
372
|
editingTargetSet: ({ context: t }) => {
|
|
373
|
-
var
|
|
373
|
+
var o;
|
|
374
374
|
if (!t.targetElement) return;
|
|
375
|
-
const n = !!((
|
|
375
|
+
const n = !!((o = t.comments.find(
|
|
376
376
|
(r) => r.commentId === t.editingCommentId
|
|
377
|
-
)) != null &&
|
|
377
|
+
)) != null && o.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
|
+
(o) => o.commentId === t.editingCommentId
|
|
384
384
|
);
|
|
385
385
|
t.highlights.clearEditing(
|
|
386
386
|
t.targetElement,
|
|
@@ -392,9 +392,9 @@ function Mt() {
|
|
|
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, o = (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: o,
|
|
398
398
|
overallComment: r,
|
|
399
399
|
editingCommentId: null,
|
|
400
400
|
targetElement: null,
|
|
@@ -441,7 +441,7 @@ function Mt() {
|
|
|
441
441
|
on: {
|
|
442
442
|
TOGGLE: {
|
|
443
443
|
target: "inactive",
|
|
444
|
-
actions:
|
|
444
|
+
actions: Dt(({ enqueue: t, check: n }) => {
|
|
445
445
|
n("isCommentingEditing") && t.raise({ type: "CLOSE" });
|
|
446
446
|
})
|
|
447
447
|
}
|
|
@@ -636,7 +636,7 @@ function Mt() {
|
|
|
636
636
|
}
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
|
-
const
|
|
639
|
+
const pt = {
|
|
640
640
|
load: () => {
|
|
641
641
|
},
|
|
642
642
|
save: () => {
|
|
@@ -644,180 +644,243 @@ const ct = {
|
|
|
644
644
|
clear: () => {
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
|
-
function
|
|
647
|
+
function Q() {
|
|
648
648
|
try {
|
|
649
649
|
return typeof localStorage > "u" ? void 0 : localStorage;
|
|
650
650
|
} catch {
|
|
651
651
|
return;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
if (typeof
|
|
656
|
-
const e =
|
|
654
|
+
function Kt(i) {
|
|
655
|
+
if (typeof i != "object" || i === null) return !1;
|
|
656
|
+
const e = i.status;
|
|
657
657
|
return e === "approved" || e === "commented";
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function Wt(i) {
|
|
660
660
|
return {
|
|
661
661
|
load() {
|
|
662
|
-
const e =
|
|
662
|
+
const e = Q();
|
|
663
663
|
if (e)
|
|
664
664
|
try {
|
|
665
|
-
const t = e.getItem(
|
|
665
|
+
const t = e.getItem(i);
|
|
666
666
|
if (t === null) return;
|
|
667
667
|
const n = JSON.parse(t);
|
|
668
|
-
return
|
|
668
|
+
return Kt(n) ? n : void 0;
|
|
669
669
|
} catch {
|
|
670
670
|
return;
|
|
671
671
|
}
|
|
672
672
|
},
|
|
673
673
|
save(e) {
|
|
674
|
-
const t =
|
|
674
|
+
const t = Q();
|
|
675
675
|
if (t)
|
|
676
676
|
try {
|
|
677
677
|
if (e.status === "approved") {
|
|
678
|
-
t.removeItem(
|
|
678
|
+
t.removeItem(i);
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
681
|
-
t.setItem(
|
|
681
|
+
t.setItem(i, JSON.stringify(e));
|
|
682
682
|
} catch {
|
|
683
683
|
}
|
|
684
684
|
},
|
|
685
685
|
clear() {
|
|
686
|
-
const e =
|
|
686
|
+
const e = Q();
|
|
687
687
|
if (e)
|
|
688
688
|
try {
|
|
689
|
-
e.removeItem(
|
|
689
|
+
e.removeItem(i);
|
|
690
690
|
} catch {
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
|
-
const
|
|
696
|
-
function
|
|
695
|
+
const jt = 3;
|
|
696
|
+
function qt(i) {
|
|
697
|
+
const e = [], t = (n) => {
|
|
698
|
+
n instanceof Element && n.shadowRoot && (e.push(n.shadowRoot), n.shadowRoot.childNodes.forEach(t)), n.childNodes.forEach(t);
|
|
699
|
+
};
|
|
700
|
+
return t(i), e;
|
|
701
|
+
}
|
|
702
|
+
function It(i) {
|
|
703
|
+
const e = document.createRange();
|
|
704
|
+
return e.setStart(i.startContainer, i.startOffset), e.setEnd(i.endContainer, i.endOffset), e;
|
|
705
|
+
}
|
|
706
|
+
function lt(i, e) {
|
|
707
|
+
if (i.isCollapsed || i.rangeCount === 0) return null;
|
|
708
|
+
const t = qt(e), n = i.getComposedRanges;
|
|
709
|
+
if (n && t.length > 0) {
|
|
710
|
+
const r = n.call(i, { shadowRoots: t })[0];
|
|
711
|
+
if (r) return It(r);
|
|
712
|
+
}
|
|
713
|
+
return i.getRangeAt(0);
|
|
714
|
+
}
|
|
715
|
+
function Xt(i) {
|
|
697
716
|
const e = window.getSelection();
|
|
698
717
|
if (!e || e.isCollapsed || e.rangeCount === 0)
|
|
699
718
|
return null;
|
|
700
|
-
const t = e
|
|
701
|
-
if (
|
|
702
|
-
const
|
|
703
|
-
|
|
719
|
+
const t = lt(e, i);
|
|
720
|
+
if (!t) return null;
|
|
721
|
+
const n = t.toString();
|
|
722
|
+
if (n.length < jt) return null;
|
|
723
|
+
const o = Yt(
|
|
724
|
+
i,
|
|
704
725
|
t.startContainer,
|
|
705
726
|
t.startOffset
|
|
706
|
-
), r =
|
|
707
|
-
if (
|
|
708
|
-
const s =
|
|
709
|
-
|
|
727
|
+
), r = o + n.length;
|
|
728
|
+
if (o < 0) return null;
|
|
729
|
+
const s = Jt(
|
|
730
|
+
St(i),
|
|
710
731
|
n,
|
|
711
|
-
|
|
732
|
+
o
|
|
712
733
|
);
|
|
713
|
-
return { startOffset:
|
|
734
|
+
return { startOffset: o, endOffset: r, selectedText: n, matchIndex: s };
|
|
714
735
|
}
|
|
715
|
-
function
|
|
716
|
-
const t =
|
|
736
|
+
function et(i, e) {
|
|
737
|
+
const t = St(i);
|
|
717
738
|
if (t.slice(
|
|
718
739
|
e.startOffset,
|
|
719
740
|
e.endOffset
|
|
720
741
|
) === e.selectedText)
|
|
721
|
-
return
|
|
722
|
-
|
|
742
|
+
return ft(
|
|
743
|
+
i,
|
|
723
744
|
e.startOffset,
|
|
724
745
|
e.endOffset
|
|
725
746
|
);
|
|
726
|
-
const
|
|
747
|
+
const o = Qt(
|
|
727
748
|
t,
|
|
728
749
|
e.selectedText,
|
|
729
750
|
e.matchIndex
|
|
730
751
|
);
|
|
731
|
-
return
|
|
732
|
-
o,
|
|
752
|
+
return o < 0 ? null : ft(
|
|
733
753
|
i,
|
|
734
|
-
|
|
754
|
+
o,
|
|
755
|
+
o + e.selectedText.length
|
|
735
756
|
);
|
|
736
757
|
}
|
|
737
|
-
function
|
|
738
|
-
if (
|
|
739
|
-
const t =
|
|
740
|
-
return e
|
|
758
|
+
function Bt(i, e) {
|
|
759
|
+
if (i.isCollapsed || i.rangeCount === 0) return !1;
|
|
760
|
+
const t = lt(i, e);
|
|
761
|
+
return t ? U(e, t.startContainer) && U(e, t.endContainer) : !1;
|
|
741
762
|
}
|
|
742
|
-
function
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const a = jt(e);
|
|
753
|
-
return a && n.setEnd(a, ((s = a.textContent) == null ? void 0 : s.length) ?? 0), n;
|
|
763
|
+
function Z(i) {
|
|
764
|
+
let e = i;
|
|
765
|
+
for (; e; ) {
|
|
766
|
+
const t = e instanceof HTMLElement ? e : e.parentElement, n = t == null ? void 0 : t.closest("[data-review-selectable]");
|
|
767
|
+
if (n) return n;
|
|
768
|
+
const o = e.getRootNode();
|
|
769
|
+
if (o instanceof ShadowRoot)
|
|
770
|
+
e = o.host;
|
|
771
|
+
else
|
|
772
|
+
return null;
|
|
754
773
|
}
|
|
755
774
|
return null;
|
|
756
775
|
}
|
|
757
|
-
function
|
|
776
|
+
function Vt(i, e) {
|
|
758
777
|
var r;
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
778
|
+
if (i.isCollapsed || i.rangeCount === 0) return null;
|
|
779
|
+
const t = lt(i, e);
|
|
780
|
+
if (!t) return null;
|
|
781
|
+
const n = U(e, t.startContainer), o = U(e, t.endContainer);
|
|
782
|
+
if (n && o)
|
|
783
|
+
return It(t);
|
|
784
|
+
if (n && !o) {
|
|
785
|
+
const s = Zt(e);
|
|
786
|
+
if (s) {
|
|
787
|
+
const a = document.createRange();
|
|
788
|
+
return a.setStart(t.startContainer, t.startOffset), a.setEnd(s, ((r = s.textContent) == null ? void 0 : r.length) ?? 0), a;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
function U(i, e) {
|
|
794
|
+
if (!e) return !1;
|
|
795
|
+
if (i === e) return !0;
|
|
796
|
+
let t = e;
|
|
797
|
+
for (; t; ) {
|
|
798
|
+
if (i === t) return !0;
|
|
799
|
+
const n = t.getRootNode();
|
|
800
|
+
if (n instanceof ShadowRoot) {
|
|
801
|
+
if (i === n.host) return !0;
|
|
802
|
+
t = n.host;
|
|
803
|
+
} else
|
|
804
|
+
return !!i.contains(t);
|
|
805
|
+
}
|
|
806
|
+
return !1;
|
|
807
|
+
}
|
|
808
|
+
function St(i) {
|
|
809
|
+
let e = "";
|
|
810
|
+
const t = (n) => {
|
|
811
|
+
n instanceof Element && n.shadowRoot && n.shadowRoot.childNodes.forEach(t), n.childNodes.forEach((o) => {
|
|
812
|
+
o.nodeType === Node.TEXT_NODE ? e += o.textContent ?? "" : t(o);
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
return t(i), e;
|
|
816
|
+
}
|
|
817
|
+
function Yt(i, e, t) {
|
|
818
|
+
var o;
|
|
819
|
+
let n = 0;
|
|
820
|
+
for (const r of k(i)) {
|
|
821
|
+
if (r === e) return n + t;
|
|
822
|
+
n += ((o = r.textContent) == null ? void 0 : o.length) ?? 0;
|
|
764
823
|
}
|
|
765
824
|
return -1;
|
|
766
825
|
}
|
|
767
|
-
function
|
|
768
|
-
var
|
|
769
|
-
const n = document.
|
|
770
|
-
let
|
|
771
|
-
for (
|
|
772
|
-
const l = ((
|
|
773
|
-
if (!
|
|
774
|
-
return
|
|
775
|
-
|
|
826
|
+
function ft(i, e, t) {
|
|
827
|
+
var s;
|
|
828
|
+
const n = document.createRange();
|
|
829
|
+
let o = 0, r = !1;
|
|
830
|
+
for (const a of k(i)) {
|
|
831
|
+
const l = ((s = a.textContent) == null ? void 0 : s.length) ?? 0;
|
|
832
|
+
if (!r && o + l > e && (n.setStart(a, e - o), r = !0), r && o + l >= t)
|
|
833
|
+
return n.setEnd(a, t - o), n;
|
|
834
|
+
o += l;
|
|
776
835
|
}
|
|
777
836
|
return null;
|
|
778
837
|
}
|
|
779
|
-
function
|
|
780
|
-
|
|
838
|
+
function* k(i) {
|
|
839
|
+
i instanceof Element && i.shadowRoot && (yield* k(i.shadowRoot));
|
|
840
|
+
for (const e of Array.from(i.childNodes))
|
|
841
|
+
e.nodeType === Node.TEXT_NODE ? yield e : e instanceof Element && (yield* k(e));
|
|
842
|
+
}
|
|
843
|
+
function Jt(i, e, t) {
|
|
844
|
+
let n = 0, o = 0;
|
|
781
845
|
for (; ; ) {
|
|
782
|
-
const r =
|
|
846
|
+
const r = i.indexOf(e, o);
|
|
783
847
|
if (r < 0 || r === t) return n;
|
|
784
|
-
|
|
848
|
+
o = r + 1, n++;
|
|
785
849
|
}
|
|
786
850
|
}
|
|
787
|
-
function
|
|
788
|
-
let n = 0,
|
|
851
|
+
function Qt(i, e, t) {
|
|
852
|
+
let n = 0, o = 0;
|
|
789
853
|
for (; ; ) {
|
|
790
|
-
const r =
|
|
854
|
+
const r = i.indexOf(e, o);
|
|
791
855
|
if (r < 0) return -1;
|
|
792
856
|
if (n === t) return r;
|
|
793
|
-
|
|
857
|
+
o = r + 1, n++;
|
|
794
858
|
}
|
|
795
859
|
}
|
|
796
|
-
function
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
return t;
|
|
860
|
+
function Zt(i) {
|
|
861
|
+
let e = null;
|
|
862
|
+
for (const t of k(i))
|
|
863
|
+
e = t;
|
|
864
|
+
return e;
|
|
802
865
|
}
|
|
803
|
-
function
|
|
804
|
-
const n = /* @__PURE__ */ new Map(),
|
|
866
|
+
function te(i, e, t) {
|
|
867
|
+
const n = /* @__PURE__ */ new Map(), o = D(e, t).sort((r, s) => {
|
|
805
868
|
const a = r.element.compareDocumentPosition(s.element);
|
|
806
869
|
return a & Node.DOCUMENT_POSITION_PRECEDING ? 1 : a & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 0;
|
|
807
870
|
});
|
|
808
|
-
for (const [r, s] of
|
|
871
|
+
for (const [r, s] of o.entries())
|
|
809
872
|
n.set(s.targetId, r);
|
|
810
|
-
return [...
|
|
873
|
+
return [...i].sort((r, s) => {
|
|
811
874
|
const a = n.get(r.targetId) ?? Number.MAX_SAFE_INTEGER, l = n.get(s.targetId) ?? Number.MAX_SAFE_INTEGER;
|
|
812
875
|
return a - l;
|
|
813
876
|
});
|
|
814
877
|
}
|
|
815
|
-
var
|
|
816
|
-
for (var
|
|
817
|
-
(s =
|
|
818
|
-
return n &&
|
|
878
|
+
var ee = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, x = (i, e, t, n) => {
|
|
879
|
+
for (var o = n > 1 ? void 0 : n ? ne(e, t) : e, r = i.length - 1, s; r >= 0; r--)
|
|
880
|
+
(s = i[r]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
881
|
+
return n && o && ee(e, t, o), o;
|
|
819
882
|
};
|
|
820
|
-
const
|
|
883
|
+
const ie = {
|
|
821
884
|
"top-left": { top: "16px", left: "16px" },
|
|
822
885
|
"top-center": { top: "16px", left: "50%", translateX: "-50%" },
|
|
823
886
|
"top-right": { top: "16px", right: "16px" },
|
|
@@ -827,19 +890,19 @@ const Yt = {
|
|
|
827
890
|
};
|
|
828
891
|
let b = class extends C {
|
|
829
892
|
constructor() {
|
|
830
|
-
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 = (
|
|
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 = (i) => {
|
|
831
894
|
const e = this.bar.getBoundingClientRect();
|
|
832
895
|
this.dragStart = {
|
|
833
|
-
px:
|
|
834
|
-
py:
|
|
896
|
+
px: i.clientX,
|
|
897
|
+
py: i.clientY,
|
|
835
898
|
ox: e.left,
|
|
836
899
|
oy: e.top
|
|
837
900
|
}, window.addEventListener("pointermove", this.onDragMove), window.addEventListener("pointerup", this.onDragEnd);
|
|
838
|
-
}, this.onDragMove = (
|
|
901
|
+
}, this.onDragMove = (i) => {
|
|
839
902
|
if (!this.dragStart) return;
|
|
840
|
-
const e = this.dragStart.ox + (
|
|
903
|
+
const e = this.dragStart.ox + (i.clientX - this.dragStart.px), t = this.dragStart.oy + (i.clientY - this.dragStart.py), n = 16, o = window.innerWidth - this.bar.offsetWidth - n, r = window.innerHeight - this.bar.offsetHeight - n;
|
|
841
904
|
this.dragOffset = {
|
|
842
|
-
x: Math.max(n, Math.min(e,
|
|
905
|
+
x: Math.max(n, Math.min(e, o)),
|
|
843
906
|
y: Math.max(n, Math.min(t, r))
|
|
844
907
|
};
|
|
845
908
|
}, this.onDragEnd = () => {
|
|
@@ -850,41 +913,41 @@ let b = class extends C {
|
|
|
850
913
|
return this.bar ?? null;
|
|
851
914
|
}
|
|
852
915
|
render() {
|
|
853
|
-
const
|
|
916
|
+
const i = this.mode !== "idle", e = this.commentCount + (this.hasOverallComment ? 1 : 0), t = e > 0, n = ie[this.barPosition], o = 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);`;
|
|
854
917
|
return w`<div
|
|
855
918
|
data-bar
|
|
856
|
-
class=${A({ bar: !0, "bar--active":
|
|
857
|
-
style=${
|
|
919
|
+
class=${A({ bar: !0, "bar--active": i })}
|
|
920
|
+
style=${o}
|
|
858
921
|
>
|
|
859
922
|
<div
|
|
860
923
|
class="grip"
|
|
861
924
|
@pointerdown=${this.onDragStart}
|
|
862
925
|
>
|
|
863
|
-
<span class="icon icon-12">${
|
|
926
|
+
<span class="icon icon-12">${G.gripVertical}</span>
|
|
864
927
|
</div>
|
|
865
928
|
|
|
866
929
|
<label class="label">
|
|
867
930
|
<span class=${A({
|
|
868
931
|
"label-text": !0,
|
|
869
|
-
"label-text--active":
|
|
870
|
-
"label-text--idle": !
|
|
932
|
+
"label-text--active": i,
|
|
933
|
+
"label-text--idle": !i
|
|
871
934
|
})}>Annotate</span>
|
|
872
935
|
<button
|
|
873
936
|
type="button"
|
|
874
937
|
role="switch"
|
|
875
|
-
aria-checked=${
|
|
938
|
+
aria-checked=${i ? "true" : "false"}
|
|
876
939
|
data-toggle
|
|
877
940
|
@click=${this.onToggle}
|
|
878
941
|
class=${A({
|
|
879
942
|
toggle: !0,
|
|
880
|
-
"toggle--active":
|
|
881
|
-
"toggle--idle": !
|
|
943
|
+
"toggle--active": i,
|
|
944
|
+
"toggle--idle": !i
|
|
882
945
|
})}
|
|
883
946
|
>
|
|
884
947
|
<span class=${A({
|
|
885
948
|
knob: !0,
|
|
886
|
-
"knob--active":
|
|
887
|
-
"knob--idle": !
|
|
949
|
+
"knob--active": i,
|
|
950
|
+
"knob--idle": !i
|
|
888
951
|
})}></span>
|
|
889
952
|
</button>
|
|
890
953
|
</label>
|
|
@@ -903,7 +966,7 @@ let b = class extends C {
|
|
|
903
966
|
})}
|
|
904
967
|
>
|
|
905
968
|
Comment
|
|
906
|
-
<span class="icon icon-14">${
|
|
969
|
+
<span class="icon icon-14">${G.messageSquare}</span>
|
|
907
970
|
</button>
|
|
908
971
|
|
|
909
972
|
<div class="divider"></div>
|
|
@@ -916,7 +979,7 @@ let b = class extends C {
|
|
|
916
979
|
>
|
|
917
980
|
${t ? "Submit" : "Approve"}
|
|
918
981
|
<span class="badge">
|
|
919
|
-
${t ? e : w`<span class="icon icon-12">${
|
|
982
|
+
${t ? e : w`<span class="icon icon-12">${G.check}</span>`}
|
|
920
983
|
</span>
|
|
921
984
|
</button>
|
|
922
985
|
</div>`;
|
|
@@ -942,7 +1005,7 @@ let b = class extends C {
|
|
|
942
1005
|
};
|
|
943
1006
|
b.styles = [
|
|
944
1007
|
C.styles,
|
|
945
|
-
|
|
1008
|
+
W`
|
|
946
1009
|
:host {
|
|
947
1010
|
color-scheme: light;
|
|
948
1011
|
color: #18181b;
|
|
@@ -1132,33 +1195,33 @@ b.styles = [
|
|
|
1132
1195
|
`
|
|
1133
1196
|
];
|
|
1134
1197
|
x([
|
|
1135
|
-
|
|
1198
|
+
f()
|
|
1136
1199
|
], b.prototype, "mode", 2);
|
|
1137
1200
|
x([
|
|
1138
|
-
|
|
1201
|
+
f({ type: Number })
|
|
1139
1202
|
], b.prototype, "commentCount", 2);
|
|
1140
1203
|
x([
|
|
1141
|
-
|
|
1204
|
+
f({ type: Boolean })
|
|
1142
1205
|
], b.prototype, "hasOverallComment", 2);
|
|
1143
1206
|
x([
|
|
1144
|
-
|
|
1207
|
+
f({ type: Boolean })
|
|
1145
1208
|
], b.prototype, "overallCommentOpen", 2);
|
|
1146
1209
|
x([
|
|
1147
|
-
|
|
1210
|
+
f()
|
|
1148
1211
|
], b.prototype, "barPosition", 2);
|
|
1149
1212
|
x([
|
|
1150
|
-
|
|
1213
|
+
j("[data-bar]")
|
|
1151
1214
|
], b.prototype, "bar", 2);
|
|
1152
1215
|
x([
|
|
1153
|
-
|
|
1216
|
+
Pt()
|
|
1154
1217
|
], b.prototype, "dragOffset", 2);
|
|
1155
1218
|
b = x([
|
|
1156
|
-
|
|
1219
|
+
N("llumi-review-bar")
|
|
1157
1220
|
], b);
|
|
1158
|
-
var
|
|
1159
|
-
for (var
|
|
1160
|
-
(s =
|
|
1161
|
-
return n &&
|
|
1221
|
+
var oe = Object.defineProperty, re = Object.getOwnPropertyDescriptor, P = (i, e, t, n) => {
|
|
1222
|
+
for (var o = n > 1 ? void 0 : n ? re(e, t) : e, r = i.length - 1, s; r >= 0; r--)
|
|
1223
|
+
(s = i[r]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
1224
|
+
return n && o && oe(e, t, o), o;
|
|
1162
1225
|
};
|
|
1163
1226
|
let I = class extends C {
|
|
1164
1227
|
constructor() {
|
|
@@ -1166,8 +1229,8 @@ let I = class extends C {
|
|
|
1166
1229
|
}
|
|
1167
1230
|
/** Focus the inner textarea (the element itself isn't focusable). */
|
|
1168
1231
|
focus() {
|
|
1169
|
-
var
|
|
1170
|
-
(
|
|
1232
|
+
var i;
|
|
1233
|
+
(i = this.textarea) == null || i.focus();
|
|
1171
1234
|
}
|
|
1172
1235
|
render() {
|
|
1173
1236
|
return w`<textarea
|
|
@@ -1177,8 +1240,8 @@ let I = class extends C {
|
|
|
1177
1240
|
@input=${this.onInput}
|
|
1178
1241
|
></textarea>`;
|
|
1179
1242
|
}
|
|
1180
|
-
onInput(
|
|
1181
|
-
const e =
|
|
1243
|
+
onInput(i) {
|
|
1244
|
+
const e = i.target.value;
|
|
1182
1245
|
this.autoGrow(), this.dispatchEvent(
|
|
1183
1246
|
new CustomEvent("change", {
|
|
1184
1247
|
detail: e,
|
|
@@ -1188,8 +1251,8 @@ let I = class extends C {
|
|
|
1188
1251
|
);
|
|
1189
1252
|
}
|
|
1190
1253
|
autoGrow() {
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1254
|
+
const i = this.textarea;
|
|
1255
|
+
i && (i.style.height = "auto", i.style.height = `${i.scrollHeight}px`);
|
|
1193
1256
|
}
|
|
1194
1257
|
firstUpdated() {
|
|
1195
1258
|
this.autoFocus && this.textarea.focus(), this.autoGrow();
|
|
@@ -1200,7 +1263,7 @@ let I = class extends C {
|
|
|
1200
1263
|
};
|
|
1201
1264
|
I.styles = [
|
|
1202
1265
|
C.styles,
|
|
1203
|
-
|
|
1266
|
+
W`
|
|
1204
1267
|
textarea {
|
|
1205
1268
|
width: 100%;
|
|
1206
1269
|
resize: none;
|
|
@@ -1223,45 +1286,45 @@ I.styles = [
|
|
|
1223
1286
|
}
|
|
1224
1287
|
`
|
|
1225
1288
|
];
|
|
1226
|
-
|
|
1227
|
-
|
|
1289
|
+
P([
|
|
1290
|
+
f()
|
|
1228
1291
|
], I.prototype, "value", 2);
|
|
1229
|
-
|
|
1230
|
-
|
|
1292
|
+
P([
|
|
1293
|
+
f({ type: Boolean })
|
|
1231
1294
|
], I.prototype, "autoFocus", 2);
|
|
1232
|
-
|
|
1233
|
-
|
|
1295
|
+
P([
|
|
1296
|
+
f()
|
|
1234
1297
|
], I.prototype, "placeholder", 2);
|
|
1235
|
-
|
|
1236
|
-
|
|
1298
|
+
P([
|
|
1299
|
+
j("textarea")
|
|
1237
1300
|
], I.prototype, "textarea", 2);
|
|
1238
|
-
I =
|
|
1239
|
-
|
|
1301
|
+
I = P([
|
|
1302
|
+
N("llumi-default-editor")
|
|
1240
1303
|
], I);
|
|
1241
|
-
var
|
|
1242
|
-
for (var
|
|
1243
|
-
(s =
|
|
1244
|
-
return n &&
|
|
1304
|
+
var se = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, _ = (i, e, t, n) => {
|
|
1305
|
+
for (var o = n > 1 ? void 0 : n ? ae(e, t) : e, r = i.length - 1, s; r >= 0; r--)
|
|
1306
|
+
(s = i[r]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
1307
|
+
return n && o && se(e, t, o), o;
|
|
1245
1308
|
};
|
|
1246
1309
|
let S = class extends C {
|
|
1247
1310
|
constructor() {
|
|
1248
1311
|
super(...arguments), this.targetElement = null, this.anchor = null, this.value = "";
|
|
1249
1312
|
}
|
|
1250
1313
|
render() {
|
|
1251
|
-
const
|
|
1314
|
+
const i = this.value.trim().length > 0;
|
|
1252
1315
|
return w`<div
|
|
1253
1316
|
data-floating
|
|
1254
1317
|
class="floating"
|
|
1255
1318
|
style="position:absolute;top:0;left:0;"
|
|
1256
1319
|
>
|
|
1257
1320
|
<div class="panel">
|
|
1258
|
-
${
|
|
1321
|
+
${i ? w`<button
|
|
1259
1322
|
type="button"
|
|
1260
1323
|
data-delete
|
|
1261
1324
|
class="delete-btn"
|
|
1262
1325
|
@click=${this.onDelete}
|
|
1263
1326
|
>
|
|
1264
|
-
<span class="icon icon-14">${
|
|
1327
|
+
<span class="icon icon-14">${G.trash}</span>
|
|
1265
1328
|
<span class="delete-label">Delete</span>
|
|
1266
1329
|
</button>` : null}
|
|
1267
1330
|
<div class="editor-wrap" @change=${this.onEditorChange} @cancel=${this.onCancel} @delete=${this.onDelete}>
|
|
@@ -1272,64 +1335,64 @@ let S = class extends C {
|
|
|
1272
1335
|
</div>
|
|
1273
1336
|
</div>`;
|
|
1274
1337
|
}
|
|
1275
|
-
onEditorChange(
|
|
1276
|
-
if (typeof
|
|
1277
|
-
const e =
|
|
1278
|
-
|
|
1338
|
+
onEditorChange(i) {
|
|
1339
|
+
if (typeof i.detail != "string") return;
|
|
1340
|
+
const e = i.detail;
|
|
1341
|
+
i.stopPropagation(), this.dispatchEvent(
|
|
1279
1342
|
new CustomEvent("change", { detail: e, bubbles: !0, composed: !0 })
|
|
1280
1343
|
);
|
|
1281
1344
|
}
|
|
1282
|
-
onCancel(
|
|
1283
|
-
|
|
1345
|
+
onCancel(i) {
|
|
1346
|
+
i.stopPropagation(), this.dispatchEvent(
|
|
1284
1347
|
new CustomEvent("close", { bubbles: !0, composed: !0 })
|
|
1285
1348
|
);
|
|
1286
1349
|
}
|
|
1287
|
-
onDelete(
|
|
1288
|
-
|
|
1350
|
+
onDelete(i) {
|
|
1351
|
+
i.stopPropagation(), this.dispatchEvent(
|
|
1289
1352
|
new CustomEvent("delete", { bubbles: !0, composed: !0 })
|
|
1290
1353
|
);
|
|
1291
1354
|
}
|
|
1292
1355
|
startPositioning() {
|
|
1293
1356
|
var t;
|
|
1294
|
-
const
|
|
1295
|
-
!
|
|
1296
|
-
|
|
1357
|
+
const i = this.anchor ?? this.targetElement, e = this.floating;
|
|
1358
|
+
!i || !e || ((t = this.cleanup) == null || t.call(this), this.cleanup = bt(i, e, () => {
|
|
1359
|
+
Ct(i, e, {
|
|
1297
1360
|
placement: "right",
|
|
1298
1361
|
middleware: [
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1362
|
+
Et(12),
|
|
1363
|
+
wt({ padding: 16 }),
|
|
1364
|
+
xt({ padding: 16, crossAxis: !0 }),
|
|
1365
|
+
yt({
|
|
1303
1366
|
padding: 16,
|
|
1304
|
-
apply({ availableWidth: n, elements:
|
|
1305
|
-
Object.assign(
|
|
1367
|
+
apply({ availableWidth: n, elements: o }) {
|
|
1368
|
+
Object.assign(o.floating.style, {
|
|
1306
1369
|
maxWidth: `${Math.min(400, n)}px`
|
|
1307
1370
|
});
|
|
1308
1371
|
}
|
|
1309
1372
|
})
|
|
1310
1373
|
]
|
|
1311
|
-
}).then(({ x: n, y:
|
|
1312
|
-
Object.assign(e.style, { left: `${n}px`, top: `${
|
|
1374
|
+
}).then(({ x: n, y: o }) => {
|
|
1375
|
+
Object.assign(e.style, { left: `${n}px`, top: `${o}px` });
|
|
1313
1376
|
});
|
|
1314
1377
|
}));
|
|
1315
1378
|
}
|
|
1316
|
-
updated(
|
|
1317
|
-
(
|
|
1379
|
+
updated(i) {
|
|
1380
|
+
(i.has("targetElement") || i.has("anchor")) && (this.startPositioning(), this.focusEditor());
|
|
1318
1381
|
}
|
|
1319
1382
|
focusEditor() {
|
|
1320
|
-
const
|
|
1383
|
+
const i = this.renderRoot.querySelector(
|
|
1321
1384
|
'slot[name="editor"]'
|
|
1322
|
-
), t = ((
|
|
1385
|
+
), t = ((i == null ? void 0 : i.assignedElements()) ?? [])[0] ?? this.renderRoot.querySelector("llumi-default-editor");
|
|
1323
1386
|
t == null || t.focus();
|
|
1324
1387
|
}
|
|
1325
1388
|
disconnectedCallback() {
|
|
1326
|
-
var
|
|
1327
|
-
super.disconnectedCallback(), (
|
|
1389
|
+
var i;
|
|
1390
|
+
super.disconnectedCallback(), (i = this.cleanup) == null || i.call(this), this.cleanup = void 0;
|
|
1328
1391
|
}
|
|
1329
1392
|
};
|
|
1330
1393
|
S.styles = [
|
|
1331
1394
|
C.styles,
|
|
1332
|
-
|
|
1395
|
+
W`
|
|
1333
1396
|
.floating {
|
|
1334
1397
|
z-index: calc(var(--review-z-index, 9998) + 1);
|
|
1335
1398
|
}
|
|
@@ -1403,32 +1466,32 @@ S.styles = [
|
|
|
1403
1466
|
}
|
|
1404
1467
|
`
|
|
1405
1468
|
];
|
|
1406
|
-
|
|
1407
|
-
|
|
1469
|
+
_([
|
|
1470
|
+
f({ attribute: !1 })
|
|
1408
1471
|
], S.prototype, "targetElement", 2);
|
|
1409
|
-
|
|
1410
|
-
|
|
1472
|
+
_([
|
|
1473
|
+
f({ attribute: !1 })
|
|
1411
1474
|
], S.prototype, "anchor", 2);
|
|
1412
|
-
|
|
1413
|
-
|
|
1475
|
+
_([
|
|
1476
|
+
f()
|
|
1414
1477
|
], S.prototype, "value", 2);
|
|
1415
|
-
|
|
1416
|
-
|
|
1478
|
+
_([
|
|
1479
|
+
j("[data-floating]")
|
|
1417
1480
|
], S.prototype, "floating", 2);
|
|
1418
|
-
S =
|
|
1419
|
-
|
|
1481
|
+
S = _([
|
|
1482
|
+
N("llumi-comment-dialog")
|
|
1420
1483
|
], S);
|
|
1421
|
-
var
|
|
1422
|
-
for (var
|
|
1423
|
-
(s =
|
|
1424
|
-
return n &&
|
|
1484
|
+
var le = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, q = (i, e, t, n) => {
|
|
1485
|
+
for (var o = n > 1 ? void 0 : n ? ce(e, t) : e, r = i.length - 1, s; r >= 0; r--)
|
|
1486
|
+
(s = i[r]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
1487
|
+
return n && o && le(e, t, o), o;
|
|
1425
1488
|
};
|
|
1426
|
-
let
|
|
1489
|
+
let O = class extends C {
|
|
1427
1490
|
constructor() {
|
|
1428
|
-
super(...arguments), this.barElement = null, this.value = "", this.onDocKeydown = (
|
|
1429
|
-
|
|
1430
|
-
}, this.onDocPointerdown = (
|
|
1431
|
-
const e =
|
|
1491
|
+
super(...arguments), this.barElement = null, this.value = "", this.onDocKeydown = (i) => {
|
|
1492
|
+
i.key === "Escape" && (i.preventDefault(), this.emitClose());
|
|
1493
|
+
}, this.onDocPointerdown = (i) => {
|
|
1494
|
+
const e = i.composedPath();
|
|
1432
1495
|
this.floating && !e.includes(this.floating) && !e.includes(this) && this.emitClose();
|
|
1433
1496
|
};
|
|
1434
1497
|
}
|
|
@@ -1451,10 +1514,10 @@ let L = class extends C {
|
|
|
1451
1514
|
</div>
|
|
1452
1515
|
</div>`;
|
|
1453
1516
|
}
|
|
1454
|
-
onEditorChange(
|
|
1455
|
-
if (typeof
|
|
1456
|
-
const e =
|
|
1457
|
-
|
|
1517
|
+
onEditorChange(i) {
|
|
1518
|
+
if (typeof i.detail != "string") return;
|
|
1519
|
+
const e = i.detail;
|
|
1520
|
+
i.stopPropagation(), this.dispatchEvent(
|
|
1458
1521
|
new CustomEvent("change", { detail: e, bubbles: !0, composed: !0 })
|
|
1459
1522
|
);
|
|
1460
1523
|
}
|
|
@@ -1465,42 +1528,42 @@ let L = class extends C {
|
|
|
1465
1528
|
}
|
|
1466
1529
|
startPositioning() {
|
|
1467
1530
|
var t;
|
|
1468
|
-
const
|
|
1469
|
-
!
|
|
1470
|
-
|
|
1531
|
+
const i = this.barElement, e = this.floating;
|
|
1532
|
+
!i || !e || ((t = this.cleanup) == null || t.call(this), this.cleanup = bt(i, e, () => {
|
|
1533
|
+
Ct(i, e, {
|
|
1471
1534
|
placement: "top",
|
|
1472
1535
|
middleware: [
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1536
|
+
Et(12),
|
|
1537
|
+
wt({ padding: 16 }),
|
|
1538
|
+
xt({ padding: 16, crossAxis: !0 }),
|
|
1539
|
+
yt({
|
|
1477
1540
|
padding: 16,
|
|
1478
|
-
apply({ availableWidth: n, elements:
|
|
1479
|
-
Object.assign(
|
|
1541
|
+
apply({ availableWidth: n, elements: o }) {
|
|
1542
|
+
Object.assign(o.floating.style, {
|
|
1480
1543
|
maxWidth: `${Math.min(400, n)}px`
|
|
1481
1544
|
});
|
|
1482
1545
|
}
|
|
1483
1546
|
})
|
|
1484
1547
|
]
|
|
1485
|
-
}).then(({ x: n, y:
|
|
1486
|
-
Object.assign(e.style, { left: `${n}px`, top: `${
|
|
1548
|
+
}).then(({ x: n, y: o }) => {
|
|
1549
|
+
Object.assign(e.style, { left: `${n}px`, top: `${o}px` });
|
|
1487
1550
|
});
|
|
1488
1551
|
}));
|
|
1489
1552
|
}
|
|
1490
1553
|
connectedCallback() {
|
|
1491
1554
|
super.connectedCallback(), document.addEventListener("keydown", this.onDocKeydown), document.addEventListener("pointerdown", this.onDocPointerdown, !0);
|
|
1492
1555
|
}
|
|
1493
|
-
updated(
|
|
1494
|
-
|
|
1556
|
+
updated(i) {
|
|
1557
|
+
i.has("barElement") && this.startPositioning();
|
|
1495
1558
|
}
|
|
1496
1559
|
disconnectedCallback() {
|
|
1497
|
-
var
|
|
1498
|
-
super.disconnectedCallback(), (
|
|
1560
|
+
var i;
|
|
1561
|
+
super.disconnectedCallback(), (i = this.cleanup) == null || i.call(this), this.cleanup = void 0, document.removeEventListener("keydown", this.onDocKeydown), document.removeEventListener("pointerdown", this.onDocPointerdown, !0);
|
|
1499
1562
|
}
|
|
1500
1563
|
};
|
|
1501
|
-
|
|
1564
|
+
O.styles = [
|
|
1502
1565
|
C.styles,
|
|
1503
|
-
|
|
1566
|
+
W`
|
|
1504
1567
|
.floating {
|
|
1505
1568
|
z-index: calc(var(--review-z-index, 9998) + 1);
|
|
1506
1569
|
}
|
|
@@ -1529,44 +1592,44 @@ L.styles = [
|
|
|
1529
1592
|
}
|
|
1530
1593
|
`
|
|
1531
1594
|
];
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
],
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
],
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
],
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
],
|
|
1544
|
-
var
|
|
1545
|
-
for (var
|
|
1546
|
-
(s =
|
|
1547
|
-
return n &&
|
|
1595
|
+
q([
|
|
1596
|
+
f({ attribute: !1 })
|
|
1597
|
+
], O.prototype, "barElement", 2);
|
|
1598
|
+
q([
|
|
1599
|
+
f()
|
|
1600
|
+
], O.prototype, "value", 2);
|
|
1601
|
+
q([
|
|
1602
|
+
j("[data-floating]")
|
|
1603
|
+
], O.prototype, "floating", 2);
|
|
1604
|
+
O = q([
|
|
1605
|
+
N("llumi-overall-comment-dialog")
|
|
1606
|
+
], O);
|
|
1607
|
+
var de = Object.defineProperty, he = Object.getOwnPropertyDescriptor, Tt = (i, e, t, n) => {
|
|
1608
|
+
for (var o = n > 1 ? void 0 : n ? he(e, t) : e, r = i.length - 1, s; r >= 0; r--)
|
|
1609
|
+
(s = i[r]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
1610
|
+
return n && o && de(e, t, o), o;
|
|
1548
1611
|
};
|
|
1549
|
-
const
|
|
1550
|
-
let
|
|
1612
|
+
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 nt = class extends C {
|
|
1551
1614
|
constructor() {
|
|
1552
1615
|
super(...arguments), this.positions = [];
|
|
1553
1616
|
}
|
|
1554
1617
|
render() {
|
|
1555
|
-
return w`${
|
|
1618
|
+
return w`${_t(
|
|
1556
1619
|
this.positions,
|
|
1557
|
-
(
|
|
1558
|
-
(
|
|
1620
|
+
(i) => i.commentId,
|
|
1621
|
+
(i) => w`<button
|
|
1559
1622
|
type="button"
|
|
1560
|
-
@click=${(e) => this.onClick(e,
|
|
1561
|
-
style=${
|
|
1623
|
+
@click=${(e) => this.onClick(e, i.commentId)}
|
|
1624
|
+
style=${Mt({
|
|
1562
1625
|
position: "absolute",
|
|
1563
|
-
top: `${
|
|
1564
|
-
left: `${
|
|
1626
|
+
top: `${i.top - 10}px`,
|
|
1627
|
+
left: `${i.left + 2}px`,
|
|
1565
1628
|
width: "20px",
|
|
1566
1629
|
height: "20px",
|
|
1567
1630
|
borderRadius: "50%",
|
|
1568
1631
|
backgroundColor: "white",
|
|
1569
|
-
backgroundImage: `url("${
|
|
1632
|
+
backgroundImage: `url("${me}")`,
|
|
1570
1633
|
backgroundSize: "12px 12px",
|
|
1571
1634
|
backgroundRepeat: "no-repeat",
|
|
1572
1635
|
backgroundPosition: "center",
|
|
@@ -1579,8 +1642,8 @@ let Z = class extends C {
|
|
|
1579
1642
|
></button>`
|
|
1580
1643
|
)}`;
|
|
1581
1644
|
}
|
|
1582
|
-
onClick(
|
|
1583
|
-
|
|
1645
|
+
onClick(i, e) {
|
|
1646
|
+
i.stopPropagation(), this.dispatchEvent(
|
|
1584
1647
|
new CustomEvent("icon-click", {
|
|
1585
1648
|
detail: e,
|
|
1586
1649
|
bubbles: !0,
|
|
@@ -1589,30 +1652,40 @@ let Z = class extends C {
|
|
|
1589
1652
|
);
|
|
1590
1653
|
}
|
|
1591
1654
|
};
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
],
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
],
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1655
|
+
Tt([
|
|
1656
|
+
f({ attribute: !1 })
|
|
1657
|
+
], nt.prototype, "positions", 2);
|
|
1658
|
+
nt = Tt([
|
|
1659
|
+
N("llumi-selection-comment-icons")
|
|
1660
|
+
], nt);
|
|
1661
|
+
const K = "data-review-selectable", it = "review-selection-commented", ot = "review-selection-editing", R = "review-selection-hover", ue = `
|
|
1662
|
+
::highlight(${it}) {
|
|
1663
|
+
background-color: var(--review-selection-commented-color, oklch(0.85 0.08 250 / 0.4));
|
|
1664
|
+
}
|
|
1665
|
+
::highlight(${ot}) {
|
|
1666
|
+
background-color: var(--review-selection-editing-color, oklch(0.75 0.12 250 / 0.6));
|
|
1667
|
+
}
|
|
1668
|
+
::highlight(${R}) {
|
|
1669
|
+
background-color: var(--review-selection-hover-color, oklch(0.8 0.1 250 / 0.5));
|
|
1670
|
+
}
|
|
1671
|
+
`, vt = "data-llumi-review-highlight";
|
|
1672
|
+
function rt() {
|
|
1600
1673
|
if (!(typeof CSS > "u"))
|
|
1601
1674
|
return CSS.highlights;
|
|
1602
1675
|
}
|
|
1603
|
-
function
|
|
1676
|
+
function st(...i) {
|
|
1604
1677
|
return new Highlight(
|
|
1605
|
-
...
|
|
1678
|
+
...i
|
|
1606
1679
|
);
|
|
1607
1680
|
}
|
|
1608
|
-
class
|
|
1681
|
+
class ge {
|
|
1609
1682
|
constructor(e) {
|
|
1610
|
-
this.ranges = /* @__PURE__ */ new Map(), this.repositionRaf = 0, this.reposition = () => {
|
|
1683
|
+
this.ranges = /* @__PURE__ */ new Map(), this.repositionRaf = 0, this.retryRaf = 0, this.retryCount = 0, this.observedShadowRoots = /* @__PURE__ */ new WeakSet(), this.shadowObservers = [], this.reposition = () => {
|
|
1611
1684
|
this.repositionRaf || (this.repositionRaf = requestAnimationFrame(() => {
|
|
1612
1685
|
if (this.repositionRaf = 0, !this.ctx.isAnnotating() || this.ranges.size === 0) return;
|
|
1613
1686
|
const t = [];
|
|
1614
|
-
for (const [n,
|
|
1615
|
-
const r = this.iconPositionForRange(n,
|
|
1687
|
+
for (const [n, o] of this.ranges) {
|
|
1688
|
+
const r = this.iconPositionForRange(n, o);
|
|
1616
1689
|
r && t.push(r);
|
|
1617
1690
|
}
|
|
1618
1691
|
this.ctx.icons.positions = t;
|
|
@@ -1630,55 +1703,95 @@ class se {
|
|
|
1630
1703
|
* to a comment whose content is not yet committed, hence the fallback).
|
|
1631
1704
|
*/
|
|
1632
1705
|
update(e) {
|
|
1633
|
-
const t =
|
|
1706
|
+
const t = rt();
|
|
1634
1707
|
if (!t) return;
|
|
1635
|
-
const n =
|
|
1708
|
+
const n = st(), o = st(), r = /* @__PURE__ */ new Map(), s = [], a = this.ctx.getSnapshot();
|
|
1709
|
+
let l = !1;
|
|
1636
1710
|
for (const h of e) {
|
|
1637
1711
|
if (!h.selection) continue;
|
|
1638
|
-
const
|
|
1639
|
-
`[${
|
|
1712
|
+
const g = this.ctx.host.querySelector(
|
|
1713
|
+
`[${K}="${h.targetId}"]`
|
|
1640
1714
|
);
|
|
1641
|
-
if (!
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1715
|
+
if (!g) continue;
|
|
1716
|
+
this.ensureShadowRootWired(g);
|
|
1717
|
+
const m = et(g, h.selection);
|
|
1718
|
+
if (!m || m.toString() !== h.selection.selectedText) {
|
|
1719
|
+
l = !0;
|
|
1720
|
+
continue;
|
|
1721
|
+
}
|
|
1722
|
+
r.set(h.commentId, m), h.commentId === a.editingCommentId ? o.add(m) : n.add(m);
|
|
1723
|
+
const M = this.iconPositionForRange(h.commentId, m);
|
|
1724
|
+
M && s.push(M);
|
|
1647
1725
|
}
|
|
1648
|
-
const
|
|
1649
|
-
if (
|
|
1726
|
+
const v = a.editingCommentId;
|
|
1727
|
+
if (v && !r.has(v)) {
|
|
1650
1728
|
const h = a.comments.find(
|
|
1651
|
-
(
|
|
1729
|
+
(g) => g.commentId === v
|
|
1652
1730
|
);
|
|
1653
1731
|
if (h != null && h.selection) {
|
|
1654
|
-
const
|
|
1655
|
-
`[${
|
|
1732
|
+
const g = this.ctx.host.querySelector(
|
|
1733
|
+
`[${K}="${h.targetId}"]`
|
|
1656
1734
|
);
|
|
1657
|
-
if (
|
|
1658
|
-
|
|
1659
|
-
|
|
1735
|
+
if (g) {
|
|
1736
|
+
this.ensureShadowRootWired(g);
|
|
1737
|
+
const m = et(g, h.selection);
|
|
1738
|
+
m ? o.add(m) : l = !0;
|
|
1660
1739
|
}
|
|
1661
1740
|
}
|
|
1662
1741
|
}
|
|
1663
1742
|
this.ranges = r, t.set(
|
|
1664
|
-
|
|
1743
|
+
it,
|
|
1665
1744
|
n
|
|
1666
|
-
), t.set(
|
|
1745
|
+
), t.set(ot, o), this.ctx.icons.positions = s, l && this.retryCount < 10 && this.ctx.isAnnotating() ? (this.retryCount++, this.retryRaf = requestAnimationFrame(() => {
|
|
1746
|
+
this.retryRaf = 0, this.ctx.isAnnotating() && this.update(
|
|
1747
|
+
this.ctx.getSnapshot().comments.filter((h) => h.selection)
|
|
1748
|
+
);
|
|
1749
|
+
})) : l || (this.retryCount = 0);
|
|
1667
1750
|
}
|
|
1668
1751
|
// Page-coordinate position of a selection comment's icon, anchored to the
|
|
1669
1752
|
// end of its range (so it sits just past the selected text).
|
|
1670
1753
|
iconPositionForRange(e, t) {
|
|
1671
|
-
const n = t.getClientRects(),
|
|
1672
|
-
return
|
|
1754
|
+
const n = t.getClientRects(), o = n[n.length - 1];
|
|
1755
|
+
return o ? {
|
|
1673
1756
|
commentId: e,
|
|
1674
|
-
top:
|
|
1675
|
-
left:
|
|
1757
|
+
top: o.top + window.scrollY,
|
|
1758
|
+
left: o.right + window.scrollX
|
|
1676
1759
|
} : null;
|
|
1677
1760
|
}
|
|
1761
|
+
/**
|
|
1762
|
+
* For a selectable target that owns an open shadow root (e.g.
|
|
1763
|
+
* `<llumi-highlighter>`), inject the `::highlight()` CSS and attach a
|
|
1764
|
+
* MutationObserver — both idempotently, once per shadow root.
|
|
1765
|
+
*
|
|
1766
|
+
* Why: (1) document-level `::highlight()` rules don't cross the shadow
|
|
1767
|
+
* boundary, so the shadow tree needs its own copy to paint. (2) Lit
|
|
1768
|
+
* re-renders replace text nodes the range references; the observer triggers
|
|
1769
|
+
* a re-`update` so the range is rebuilt over the new nodes.
|
|
1770
|
+
*
|
|
1771
|
+
* This is called lazily from `update`, so it catches shadow roots that
|
|
1772
|
+
* appear after the review's `activate` (the host's `connectedCallback`
|
|
1773
|
+
* fires before its shadow-child's).
|
|
1774
|
+
*/
|
|
1775
|
+
ensureShadowRootWired(e) {
|
|
1776
|
+
const t = e.shadowRoot;
|
|
1777
|
+
if (!t || this.observedShadowRoots.has(t)) return;
|
|
1778
|
+
if (this.observedShadowRoots.add(t), !t.querySelector(`style[${vt}]`)) {
|
|
1779
|
+
const o = document.createElement("style");
|
|
1780
|
+
o.setAttribute(vt, ""), o.textContent = ue, t.prepend(o);
|
|
1781
|
+
}
|
|
1782
|
+
const n = new MutationObserver(() => {
|
|
1783
|
+
this.ctx.isAnnotating() && this.update(
|
|
1784
|
+
this.ctx.getSnapshot().comments.filter((o) => o.selection)
|
|
1785
|
+
);
|
|
1786
|
+
});
|
|
1787
|
+
n.observe(t, { childList: !0, subtree: !0, characterData: !0 }), this.shadowObservers.push(n);
|
|
1788
|
+
}
|
|
1678
1789
|
/** Clear all three highlight registries, the `rangeMap`, and icon positions. */
|
|
1679
1790
|
clear() {
|
|
1680
|
-
const e =
|
|
1681
|
-
e && (e.delete(
|
|
1791
|
+
const e = rt();
|
|
1792
|
+
e && (e.delete(it), e.delete(ot), e.delete(R)), this.retryRaf && (cancelAnimationFrame(this.retryRaf), this.retryRaf = 0), this.retryCount = 0;
|
|
1793
|
+
for (const t of this.shadowObservers) t.disconnect();
|
|
1794
|
+
this.shadowObservers = [], this.observedShadowRoots = /* @__PURE__ */ new WeakSet(), this.ranges.clear(), this.ctx.icons.positions = [];
|
|
1682
1795
|
}
|
|
1683
1796
|
/** Capture-phase scroll + resize listeners, so icons recompute on any scroll. */
|
|
1684
1797
|
attachListeners() {
|
|
@@ -1686,31 +1799,31 @@ class se {
|
|
|
1686
1799
|
}
|
|
1687
1800
|
/** Remove listeners and cancel any pending rAF. */
|
|
1688
1801
|
detachListeners() {
|
|
1689
|
-
window.removeEventListener("scroll", this.reposition, !0), window.removeEventListener("resize", this.reposition), this.repositionRaf && cancelAnimationFrame(this.repositionRaf);
|
|
1802
|
+
window.removeEventListener("scroll", this.reposition, !0), window.removeEventListener("resize", this.reposition), this.repositionRaf && cancelAnimationFrame(this.repositionRaf), this.retryRaf && cancelAnimationFrame(this.retryRaf);
|
|
1690
1803
|
}
|
|
1691
1804
|
}
|
|
1692
|
-
const
|
|
1805
|
+
const pe = "$mod+Shift+M", ct = class ct extends HTMLElement {
|
|
1693
1806
|
constructor() {
|
|
1694
|
-
super(...arguments), this.persistence =
|
|
1807
|
+
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 = () => {
|
|
1695
1808
|
if (!this.isAnnotating()) return;
|
|
1696
1809
|
const e = window.getSelection();
|
|
1697
1810
|
if (!e || e.isCollapsed || e.rangeCount === 0)
|
|
1698
1811
|
return;
|
|
1699
|
-
const t = e.getRangeAt(0), n =
|
|
1812
|
+
const t = e.getRangeAt(0), n = Z(t.startContainer);
|
|
1700
1813
|
if (!n) return;
|
|
1701
|
-
const
|
|
1702
|
-
if (
|
|
1814
|
+
const o = Z(t.endContainer);
|
|
1815
|
+
if (o && o !== n) {
|
|
1703
1816
|
e.removeAllRanges();
|
|
1704
1817
|
return;
|
|
1705
1818
|
}
|
|
1706
|
-
if (!
|
|
1707
|
-
const a =
|
|
1819
|
+
if (!o || !Bt(e, n)) {
|
|
1820
|
+
const a = Vt(e, n);
|
|
1708
1821
|
if (!a) return;
|
|
1709
1822
|
e.removeAllRanges(), e.addRange(a);
|
|
1710
1823
|
}
|
|
1711
|
-
const r = n.getAttribute(
|
|
1824
|
+
const r = n.getAttribute(K);
|
|
1712
1825
|
if (!r) return;
|
|
1713
|
-
const s =
|
|
1826
|
+
const s = Xt(n);
|
|
1714
1827
|
s && (e.removeAllRanges(), this.selectionJustHandled = !0, this.actor.send({
|
|
1715
1828
|
type: "SELECT_TEXT",
|
|
1716
1829
|
targetId: r,
|
|
@@ -1719,28 +1832,28 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1719
1832
|
}));
|
|
1720
1833
|
}, this.onPointerMove = (e) => {
|
|
1721
1834
|
if (!this.isAnnotating()) return;
|
|
1722
|
-
const t =
|
|
1835
|
+
const t = rt();
|
|
1723
1836
|
if (!t) return;
|
|
1724
1837
|
const n = this.caretPosition(e.clientX, e.clientY);
|
|
1725
1838
|
if (!n) {
|
|
1726
|
-
this.hoveredComment && (t.delete(
|
|
1839
|
+
this.hoveredComment && (t.delete(R), this.hoveredComment = null);
|
|
1727
1840
|
return;
|
|
1728
1841
|
}
|
|
1729
|
-
let
|
|
1842
|
+
let o = null;
|
|
1730
1843
|
for (const [r, s] of this.painter.rangeMap)
|
|
1731
1844
|
if (s.isPointInRange(n.offsetNode, n.offset)) {
|
|
1732
|
-
|
|
1845
|
+
o = r;
|
|
1733
1846
|
break;
|
|
1734
1847
|
}
|
|
1735
|
-
if (
|
|
1736
|
-
if (this.hoveredComment =
|
|
1737
|
-
const r = this.painter.rangeMap.get(
|
|
1848
|
+
if (o !== this.hoveredComment)
|
|
1849
|
+
if (this.hoveredComment = o, o) {
|
|
1850
|
+
const r = this.painter.rangeMap.get(o);
|
|
1738
1851
|
r && t.set(
|
|
1739
|
-
|
|
1740
|
-
|
|
1852
|
+
R,
|
|
1853
|
+
st(r)
|
|
1741
1854
|
);
|
|
1742
1855
|
} else
|
|
1743
|
-
t.delete(
|
|
1856
|
+
t.delete(R);
|
|
1744
1857
|
}, this.onClickCapture = (e) => {
|
|
1745
1858
|
if (!this.isAnnotating() || e.defaultPrevented) return;
|
|
1746
1859
|
if (this.selectionJustHandled) {
|
|
@@ -1753,27 +1866,27 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1753
1866
|
if (n) {
|
|
1754
1867
|
for (const [a, l] of this.painter.rangeMap)
|
|
1755
1868
|
if (l.isPointInRange(n.offsetNode, n.offset)) {
|
|
1756
|
-
const
|
|
1757
|
-
(
|
|
1869
|
+
const v = this.selectionComments.find(
|
|
1870
|
+
(g) => g.commentId === a
|
|
1758
1871
|
);
|
|
1872
|
+
if (!v) continue;
|
|
1873
|
+
const h = Z(n.offsetNode);
|
|
1759
1874
|
if (!h) continue;
|
|
1760
|
-
const u = Y(n.offsetNode);
|
|
1761
|
-
if (!u) continue;
|
|
1762
1875
|
e.stopPropagation(), e.preventDefault(), this.actor.send({
|
|
1763
1876
|
type: "CLICK",
|
|
1764
|
-
targetId:
|
|
1765
|
-
element:
|
|
1877
|
+
targetId: v.targetId,
|
|
1878
|
+
element: h,
|
|
1766
1879
|
selectionCommentId: a
|
|
1767
1880
|
});
|
|
1768
1881
|
return;
|
|
1769
1882
|
}
|
|
1770
1883
|
}
|
|
1771
|
-
const
|
|
1884
|
+
const o = e.target, s = o.closest(
|
|
1772
1885
|
".review-highlight-hover, .review-highlight-commented, .review-highlight-editing"
|
|
1773
1886
|
);
|
|
1774
1887
|
if (s && this.contains(s)) {
|
|
1775
1888
|
e.stopPropagation(), e.preventDefault();
|
|
1776
|
-
const a =
|
|
1889
|
+
const a = H(o, this.customTargets);
|
|
1777
1890
|
a ? this.actor.send({
|
|
1778
1891
|
type: "CLICK",
|
|
1779
1892
|
targetId: a.targetId,
|
|
@@ -1782,7 +1895,7 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1782
1895
|
}
|
|
1783
1896
|
}, this.onWrapperClick = (e) => {
|
|
1784
1897
|
if (!this.contains(e.target) || !this.isAnnotating()) return;
|
|
1785
|
-
const t =
|
|
1898
|
+
const t = H(e.target, this.customTargets);
|
|
1786
1899
|
t ? (e.stopPropagation(), e.preventDefault(), this.actor.send({
|
|
1787
1900
|
type: "CLICK",
|
|
1788
1901
|
targetId: t.targetId,
|
|
@@ -1791,12 +1904,12 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1791
1904
|
}, this.onMouseOver = (e) => {
|
|
1792
1905
|
const t = this.manager;
|
|
1793
1906
|
if (!t || !this.isAnnotating()) return;
|
|
1794
|
-
const n = this.currentEditingTargetId(),
|
|
1907
|
+
const n = this.currentEditingTargetId(), o = H(
|
|
1795
1908
|
e.target,
|
|
1796
1909
|
this.customTargets
|
|
1797
1910
|
);
|
|
1798
|
-
if (
|
|
1799
|
-
t.applyHover(
|
|
1911
|
+
if (o) {
|
|
1912
|
+
t.applyHover(o.element, n);
|
|
1800
1913
|
return;
|
|
1801
1914
|
}
|
|
1802
1915
|
const r = e.target.closest(
|
|
@@ -1806,25 +1919,25 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1806
1919
|
}, this.onMouseOut = (e) => {
|
|
1807
1920
|
const t = this.manager;
|
|
1808
1921
|
if (!t || !this.isAnnotating()) return;
|
|
1809
|
-
const n = this.currentEditingTargetId(),
|
|
1922
|
+
const n = this.currentEditingTargetId(), o = /* @__PURE__ */ new Set();
|
|
1810
1923
|
for (const a of this.actor.getSnapshot().context.comments)
|
|
1811
|
-
!a.selection && a.content.trim() &&
|
|
1812
|
-
const r =
|
|
1924
|
+
!a.selection && a.content.trim() && o.add(a.targetId);
|
|
1925
|
+
const r = H(
|
|
1813
1926
|
e.target,
|
|
1814
1927
|
this.customTargets
|
|
1815
1928
|
);
|
|
1816
1929
|
if (r) {
|
|
1817
|
-
t.clearHover(r.element, n,
|
|
1930
|
+
t.clearHover(r.element, n, o);
|
|
1818
1931
|
return;
|
|
1819
1932
|
}
|
|
1820
1933
|
const s = e.target.closest(
|
|
1821
1934
|
"[data-review-selectable]"
|
|
1822
1935
|
);
|
|
1823
|
-
s && t.clearHover(s, n,
|
|
1936
|
+
s && t.clearHover(s, n, o);
|
|
1824
1937
|
};
|
|
1825
1938
|
}
|
|
1826
1939
|
get shortcut() {
|
|
1827
|
-
return this.getAttribute("shortcut") ??
|
|
1940
|
+
return this.getAttribute("shortcut") ?? pe;
|
|
1828
1941
|
}
|
|
1829
1942
|
get barPosition() {
|
|
1830
1943
|
return this.getAttribute("bar-position") ?? "bottom-center";
|
|
@@ -1837,11 +1950,11 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1837
1950
|
return e != null && e.trim() ? e : null;
|
|
1838
1951
|
}
|
|
1839
1952
|
connectedCallback() {
|
|
1840
|
-
|
|
1953
|
+
kt("review", Ht), this.style.position === "" && (this.style.position = "relative"), this.style.display === "" && (this.style.display = "block");
|
|
1841
1954
|
const e = this.buildHighlightCallbacks();
|
|
1842
|
-
this.persistence = this.persistKey ?
|
|
1843
|
-
const t =
|
|
1844
|
-
this.actor =
|
|
1955
|
+
this.persistence = this.persistKey ? Wt(this.persistKey) : pt;
|
|
1956
|
+
const t = Ut();
|
|
1957
|
+
this.actor = Rt(t, {
|
|
1845
1958
|
input: {
|
|
1846
1959
|
shortcut: this.shortcut,
|
|
1847
1960
|
initialData: this.initialData,
|
|
@@ -1849,16 +1962,16 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1849
1962
|
highlights: e,
|
|
1850
1963
|
persistence: this.persistence
|
|
1851
1964
|
}
|
|
1852
|
-
}), this.actor.on("REVIEW_CHANGED", (n) => this.emitChange(n.result)), this.actor.on("REVIEW_SUBMITTED", (n) => this.emitSubmit(n.result)), this.mountChrome(), this.painter = new
|
|
1965
|
+
}), this.actor.on("REVIEW_CHANGED", (n) => this.emitChange(n.result)), this.actor.on("REVIEW_SUBMITTED", (n) => this.emitSubmit(n.result)), this.mountChrome(), this.painter = new ge({
|
|
1853
1966
|
host: this,
|
|
1854
1967
|
icons: this.icons,
|
|
1855
1968
|
getSnapshot: () => this.actor.getSnapshot().context,
|
|
1856
1969
|
isAnnotating: () => this.isAnnotating()
|
|
1857
|
-
}), this.actor.subscribe(() => this.syncFromSnapshot()), this.actor.start(), this.manager =
|
|
1970
|
+
}), 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();
|
|
1858
1971
|
}
|
|
1859
1972
|
disconnectedCallback() {
|
|
1860
|
-
var e, t, n,
|
|
1861
|
-
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, (
|
|
1973
|
+
var e, t, n, o, r, s, a, l;
|
|
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, (o = this.actor) == null || o.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();
|
|
1862
1975
|
}
|
|
1863
1976
|
attributeChangedCallback() {
|
|
1864
1977
|
this.bar && (this.bar.barPosition = this.barPosition);
|
|
@@ -1866,7 +1979,7 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1866
1979
|
buildDetailResult(e) {
|
|
1867
1980
|
return e.status === "commented" ? {
|
|
1868
1981
|
...e,
|
|
1869
|
-
comments:
|
|
1982
|
+
comments: te(
|
|
1870
1983
|
e.comments,
|
|
1871
1984
|
this,
|
|
1872
1985
|
this.customTargets
|
|
@@ -1903,7 +2016,7 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1903
2016
|
// null when the range can't be restored, so the dialog falls back to anchoring
|
|
1904
2017
|
// on the whole element.
|
|
1905
2018
|
selectionAnchor(e, t) {
|
|
1906
|
-
const n =
|
|
2019
|
+
const n = et(e, t);
|
|
1907
2020
|
return n ? {
|
|
1908
2021
|
getBoundingClientRect: () => n.getBoundingClientRect(),
|
|
1909
2022
|
getClientRects: () => n.getClientRects(),
|
|
@@ -1931,10 +2044,10 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1931
2044
|
), document.body.append(this.icons);
|
|
1932
2045
|
}
|
|
1933
2046
|
onIconClick(e) {
|
|
1934
|
-
const t = this.actor.getSnapshot().context.comments.find((
|
|
2047
|
+
const t = this.actor.getSnapshot().context.comments.find((o) => o.commentId === e);
|
|
1935
2048
|
if (!t) return;
|
|
1936
2049
|
const n = this.querySelector(
|
|
1937
|
-
`[${
|
|
2050
|
+
`[${K}="${t.targetId}"]`
|
|
1938
2051
|
);
|
|
1939
2052
|
n && this.actor.send({
|
|
1940
2053
|
type: "CLICK",
|
|
@@ -1945,18 +2058,18 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1945
2058
|
}
|
|
1946
2059
|
// --- snapshot → UI sync ---
|
|
1947
2060
|
syncFromSnapshot() {
|
|
1948
|
-
const e = this.actor.getSnapshot(), { comments: t, overallComment: n, editingCommentId:
|
|
2061
|
+
const e = this.actor.getSnapshot(), { comments: t, overallComment: n, editingCommentId: o, targetElement: r } = e.context;
|
|
1949
2062
|
this.selectionComments = t.filter(
|
|
1950
|
-
(
|
|
2063
|
+
(m) => m.selection && m.content.trim()
|
|
1951
2064
|
);
|
|
1952
|
-
const s = !e.matches({ annotating: "inactive" }), a = e.matches({ commenting: "editing" }), l =
|
|
1953
|
-
this.bar.mode = s ? l ? "editing" : "commenting" : "idle", this.bar.commentCount =
|
|
2065
|
+
const s = !e.matches({ annotating: "inactive" }), a = e.matches({ commenting: "editing" }), l = o ? t.find((m) => m.commentId === o) : null, v = a && o === null, h = t.filter((m) => m.content.trim()).length, g = n.trim().length > 0;
|
|
2066
|
+
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(
|
|
1954
2067
|
"llumi-comment-dialog"
|
|
1955
2068
|
), this.commentDialog.addEventListener(
|
|
1956
2069
|
"change",
|
|
1957
|
-
(
|
|
2070
|
+
(m) => this.actor.send({
|
|
1958
2071
|
type: "COMMENT_CHANGE",
|
|
1959
|
-
content:
|
|
2072
|
+
content: m.detail
|
|
1960
2073
|
})
|
|
1961
2074
|
), this.commentDialog.addEventListener(
|
|
1962
2075
|
"delete",
|
|
@@ -1964,13 +2077,13 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
1964
2077
|
), this.commentDialog.addEventListener(
|
|
1965
2078
|
"close",
|
|
1966
2079
|
() => this.actor.send({ type: "CLOSE" })
|
|
1967
|
-
), document.body.append(this.commentDialog)), l.commentId !== this.commentDialogAnchorId && (this.commentDialogAnchorId = l.commentId, this.commentDialog.anchor = l.selection ? this.selectionAnchor(r, l.selection) : null, this.commentDialog.targetElement = r), this.commentDialog.value = l.content) : this.commentDialog && (this.commentDialog.remove(), this.commentDialog = null, this.commentDialogAnchorId = null),
|
|
2080
|
+
), document.body.append(this.commentDialog)), l.commentId !== this.commentDialogAnchorId && (this.commentDialogAnchorId = l.commentId, this.commentDialog.anchor = l.selection ? this.selectionAnchor(r, l.selection) : null, this.commentDialog.targetElement = r), this.commentDialog.value = l.content) : this.commentDialog && (this.commentDialog.remove(), this.commentDialog = null, this.commentDialogAnchorId = null), v ? (this.overallDialog || (this.overallDialog = document.createElement(
|
|
1968
2081
|
"llumi-overall-comment-dialog"
|
|
1969
2082
|
), this.overallDialog.addEventListener(
|
|
1970
2083
|
"change",
|
|
1971
|
-
(
|
|
2084
|
+
(m) => this.actor.send({
|
|
1972
2085
|
type: "COMMENT_CHANGE",
|
|
1973
|
-
content:
|
|
2086
|
+
content: m.detail
|
|
1974
2087
|
})
|
|
1975
2088
|
), this.overallDialog.addEventListener(
|
|
1976
2089
|
"close",
|
|
@@ -2031,14 +2144,14 @@ const ae = "$mod+Shift+M", it = class it extends HTMLElement {
|
|
|
2031
2144
|
return ((t = e.comments.find((n) => n.commentId === e.editingCommentId)) == null ? void 0 : t.targetId) ?? void 0;
|
|
2032
2145
|
}
|
|
2033
2146
|
};
|
|
2034
|
-
|
|
2035
|
-
let
|
|
2036
|
-
customElements.get("llumi-review") || customElements.define("llumi-review",
|
|
2147
|
+
ct.observedAttributes = ["bar-position", "shortcut", "default-mode"];
|
|
2148
|
+
let at = ct;
|
|
2149
|
+
customElements.get("llumi-review") || customElements.define("llumi-review", at);
|
|
2037
2150
|
export {
|
|
2038
2151
|
S as LlumiCommentDialog,
|
|
2039
2152
|
I as LlumiDefaultEditor,
|
|
2040
|
-
|
|
2041
|
-
|
|
2153
|
+
O as LlumiOverallCommentDialog,
|
|
2154
|
+
at as LlumiReview,
|
|
2042
2155
|
b as LlumiReviewBar,
|
|
2043
|
-
|
|
2156
|
+
nt as LlumiSelectionCommentIcons
|
|
2044
2157
|
};
|