@instructure/platform-notebook 1.9.2 → 1.9.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/dist/NoteCard.d.ts.map +1 -1
- package/dist/index.js +549 -546
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { createContext as Ke, useMemo as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as qe } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Ke, useMemo as he, useContext as Xe, useReducer as Qe, useRef as $, useEffect as z, useState as j, useCallback as q } from "react";
|
|
3
3
|
import { createPortal as mt } from "react-dom";
|
|
4
|
-
import { z as
|
|
4
|
+
import { z as u } from "zod";
|
|
5
5
|
import gt from "diff-match-patch";
|
|
6
|
-
import { useQueryClient as
|
|
7
|
-
import { CloseButton as pt, Button as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { Heading as
|
|
6
|
+
import { useQueryClient as we, useMutation as Oe, useQuery as ht } from "@tanstack/react-query";
|
|
7
|
+
import { CloseButton as pt, Button as re, IconButton as me } from "@instructure/ui-buttons";
|
|
8
|
+
import { Flex as k } from "@instructure/ui-flex";
|
|
9
|
+
import { Heading as Se } from "@instructure/ui-heading";
|
|
10
10
|
import { Tray as yt } from "@instructure/ui-tray";
|
|
11
|
-
import { View as
|
|
12
|
-
import { IconQuestionLine as
|
|
13
|
-
import { Menu as
|
|
14
|
-
import { TruncateText as
|
|
11
|
+
import { View as X } from "@instructure/ui-view";
|
|
12
|
+
import { IconQuestionLine as Le, IconPinLine as Ae, IconWarningLine as Nt, IconNoteLine as bt, IconEditLine as ke, IconTrashLine as Te, IconArrowStartLine as Et } from "@instructure/ui-icons";
|
|
13
|
+
import { Menu as ue } from "@instructure/ui-menu";
|
|
14
|
+
import { TruncateText as Ee } from "@instructure/ui-truncate-text";
|
|
15
15
|
import { SimpleSelect as Be } from "@instructure/ui-simple-select";
|
|
16
|
-
import { Text as
|
|
17
|
-
import { ScreenReaderContent as
|
|
16
|
+
import { Text as oe } from "@instructure/ui-text";
|
|
17
|
+
import { ScreenReaderContent as pe } from "@instructure/ui-a11y-content";
|
|
18
18
|
import { Dialog as Tt } from "@instructure/ui-dialog";
|
|
19
19
|
import { TextArea as Ye } from "@instructure/ui-text-area";
|
|
20
20
|
import { Pill as $e } from "@instructure/ui-pill";
|
|
21
21
|
import { Pagination as St } from "@instructure/ui-pagination";
|
|
22
22
|
import { Spinner as vt } from "@instructure/ui-spinner";
|
|
23
|
-
const It =
|
|
24
|
-
startContainer:
|
|
25
|
-
endContainer:
|
|
26
|
-
startOffset:
|
|
27
|
-
endOffset:
|
|
28
|
-
}), Ct =
|
|
29
|
-
start:
|
|
30
|
-
end:
|
|
31
|
-
}),
|
|
32
|
-
selectedText:
|
|
33
|
-
hasNoHighlightAnymore:
|
|
23
|
+
const It = u.object({
|
|
24
|
+
startContainer: u.string(),
|
|
25
|
+
endContainer: u.string(),
|
|
26
|
+
startOffset: u.number(),
|
|
27
|
+
endOffset: u.number()
|
|
28
|
+
}), Ct = u.object({
|
|
29
|
+
start: u.number(),
|
|
30
|
+
end: u.number()
|
|
31
|
+
}), De = u.object({
|
|
32
|
+
selectedText: u.string(),
|
|
33
|
+
hasNoHighlightAnymore: u.boolean().optional(),
|
|
34
34
|
textPosition: Ct.nullable(),
|
|
35
35
|
range: It.nullable(),
|
|
36
|
-
pageLastModifiedAt:
|
|
36
|
+
pageLastModifiedAt: u.string()
|
|
37
37
|
});
|
|
38
|
-
var
|
|
39
|
-
const
|
|
38
|
+
var R = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(R || {});
|
|
39
|
+
const Pe = u.enum([
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]), xt =
|
|
44
|
-
totalCount:
|
|
45
|
-
totalNrOfPages:
|
|
46
|
-
}),
|
|
47
|
-
id:
|
|
48
|
-
rootAccountUuid:
|
|
49
|
-
userId:
|
|
50
|
-
courseId:
|
|
51
|
-
objectId:
|
|
52
|
-
objectType:
|
|
53
|
-
userText:
|
|
54
|
-
reaction:
|
|
55
|
-
highlightData:
|
|
56
|
-
createdAt:
|
|
57
|
-
updatedAt:
|
|
58
|
-
}),
|
|
59
|
-
cursor:
|
|
60
|
-
node:
|
|
43
|
+
]), xt = u.object({
|
|
44
|
+
totalCount: u.number().nullish(),
|
|
45
|
+
totalNrOfPages: u.number().nullish()
|
|
46
|
+
}), ve = u.object({
|
|
47
|
+
id: u.string(),
|
|
48
|
+
rootAccountUuid: u.string(),
|
|
49
|
+
userId: u.string(),
|
|
50
|
+
courseId: u.string(),
|
|
51
|
+
objectId: u.string(),
|
|
52
|
+
objectType: u.string(),
|
|
53
|
+
userText: u.string().optional(),
|
|
54
|
+
reaction: u.array(Pe),
|
|
55
|
+
highlightData: De,
|
|
56
|
+
createdAt: u.string(),
|
|
57
|
+
updatedAt: u.string()
|
|
58
|
+
}), kt = u.object({
|
|
59
|
+
cursor: u.string(),
|
|
60
|
+
node: ve
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
notes:
|
|
64
|
-
edges:
|
|
65
|
-
nodes:
|
|
62
|
+
u.object({
|
|
63
|
+
notes: u.object({
|
|
64
|
+
edges: u.array(kt),
|
|
65
|
+
nodes: u.array(ve),
|
|
66
66
|
pageInfo: xt
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
|
-
const
|
|
70
|
-
type:
|
|
71
|
-
id:
|
|
72
|
-
}), wt =
|
|
73
|
-
courseId:
|
|
74
|
-
learningObject:
|
|
75
|
-
reactions:
|
|
69
|
+
const Rt = u.object({
|
|
70
|
+
type: u.string(),
|
|
71
|
+
id: u.string()
|
|
72
|
+
}), wt = u.object({
|
|
73
|
+
courseId: u.string().optional(),
|
|
74
|
+
learningObject: Rt.optional(),
|
|
75
|
+
reactions: u.array(u.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
|
-
|
|
78
|
-
courseId:
|
|
77
|
+
u.object({
|
|
78
|
+
courseId: u.string().optional(),
|
|
79
79
|
filter: wt,
|
|
80
|
-
offset:
|
|
81
|
-
pageSize:
|
|
80
|
+
offset: u.number().optional(),
|
|
81
|
+
pageSize: u.number().optional()
|
|
82
82
|
});
|
|
83
|
-
|
|
84
|
-
courseId:
|
|
85
|
-
objectId:
|
|
86
|
-
objectType:
|
|
87
|
-
userText:
|
|
88
|
-
reaction:
|
|
89
|
-
highlightData:
|
|
83
|
+
u.object({
|
|
84
|
+
courseId: u.string(),
|
|
85
|
+
objectId: u.string(),
|
|
86
|
+
objectType: u.string(),
|
|
87
|
+
userText: u.string().optional(),
|
|
88
|
+
reaction: u.array(Pe),
|
|
89
|
+
highlightData: De
|
|
90
90
|
});
|
|
91
|
-
|
|
92
|
-
createNote:
|
|
91
|
+
u.object({
|
|
92
|
+
createNote: ve
|
|
93
93
|
});
|
|
94
|
-
|
|
95
|
-
id:
|
|
96
|
-
userText:
|
|
97
|
-
reaction:
|
|
98
|
-
highlightData:
|
|
94
|
+
u.object({
|
|
95
|
+
id: u.string(),
|
|
96
|
+
userText: u.string().optional(),
|
|
97
|
+
reaction: u.array(Pe),
|
|
98
|
+
highlightData: De
|
|
99
99
|
});
|
|
100
|
-
|
|
101
|
-
updateNote:
|
|
100
|
+
u.object({
|
|
101
|
+
updateNote: ve
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
deleteNote:
|
|
103
|
+
u.object({
|
|
104
|
+
deleteNote: u.string()
|
|
105
105
|
});
|
|
106
106
|
var Ve = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(Ve || {});
|
|
107
|
-
class
|
|
107
|
+
class se {
|
|
108
108
|
constructor(e, n) {
|
|
109
109
|
this.start = e, this.end = n;
|
|
110
110
|
}
|
|
@@ -122,17 +122,17 @@ class oe {
|
|
|
122
122
|
return o.setStart(e.node, e.offset), o.setEnd(n.node, n.offset), o;
|
|
123
123
|
}
|
|
124
124
|
static fromRange(e) {
|
|
125
|
-
const n =
|
|
126
|
-
return !n || !o ? null : new
|
|
125
|
+
const n = K.fromPoint(e.startContainer, e.startOffset), o = K.fromPoint(e.endContainer, e.endOffset);
|
|
126
|
+
return !n || !o ? null : new se(n, o);
|
|
127
127
|
}
|
|
128
128
|
static fromOffsets(e, n, o) {
|
|
129
|
-
return new
|
|
129
|
+
return new se(new K(e, n), new K(e, o));
|
|
130
130
|
}
|
|
131
131
|
relativeTo(e) {
|
|
132
|
-
return new
|
|
132
|
+
return new se(this.start.relativeTo(e), this.end.relativeTo(e));
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
class
|
|
135
|
+
class K {
|
|
136
136
|
constructor(e, n) {
|
|
137
137
|
n < 0 && console.error("Offset is invalid"), this.element = e, this.offset = n;
|
|
138
138
|
}
|
|
@@ -154,9 +154,9 @@ class X {
|
|
|
154
154
|
static fromCharOffset(e, n) {
|
|
155
155
|
switch (e.nodeType) {
|
|
156
156
|
case Node.TEXT_NODE:
|
|
157
|
-
return
|
|
157
|
+
return K.fromPoint(e, n);
|
|
158
158
|
case Node.ELEMENT_NODE:
|
|
159
|
-
return new
|
|
159
|
+
return new K(e, n);
|
|
160
160
|
default:
|
|
161
161
|
return console.error("Node is not an element or text node"), null;
|
|
162
162
|
}
|
|
@@ -168,8 +168,8 @@ class X {
|
|
|
168
168
|
return console.error("Text node offset is out of range"), null;
|
|
169
169
|
if (!e.parentElement)
|
|
170
170
|
return console.error("Text node has no parent"), null;
|
|
171
|
-
const o =
|
|
172
|
-
return new
|
|
171
|
+
const o = Ge(e) + n;
|
|
172
|
+
return new K(e.parentElement, o);
|
|
173
173
|
}
|
|
174
174
|
case Node.ELEMENT_NODE: {
|
|
175
175
|
if (n < 0 || n > e.childNodes.length)
|
|
@@ -177,7 +177,7 @@ class X {
|
|
|
177
177
|
let o = 0;
|
|
178
178
|
for (let r = 0; r < n; r++)
|
|
179
179
|
o += Ze(e.childNodes[r]);
|
|
180
|
-
return new
|
|
180
|
+
return new K(e, o);
|
|
181
181
|
}
|
|
182
182
|
default:
|
|
183
183
|
return console.error("Point is not in an element or text node"), null;
|
|
@@ -188,8 +188,8 @@ class X {
|
|
|
188
188
|
throw new Error("Parent is not an ancestor of current element");
|
|
189
189
|
let n = this.element, o = this.offset;
|
|
190
190
|
for (; n !== e; )
|
|
191
|
-
o +=
|
|
192
|
-
return new
|
|
191
|
+
o += Ge(n), n.parentElement && (n = n.parentElement);
|
|
192
|
+
return new K(n, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
const Ot = (t) => {
|
|
@@ -246,41 +246,41 @@ const At = (t) => {
|
|
|
246
246
|
r = c;
|
|
247
247
|
}
|
|
248
248
|
return r;
|
|
249
|
-
},
|
|
249
|
+
}, Ue = (t, e = document.body) => {
|
|
250
250
|
try {
|
|
251
251
|
return Pt(t, e);
|
|
252
252
|
} catch {
|
|
253
253
|
return document.evaluate(`.${t}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
|
-
class
|
|
256
|
+
class ae {
|
|
257
257
|
constructor(e, n) {
|
|
258
258
|
this.root = e, this.range = n;
|
|
259
259
|
}
|
|
260
260
|
static fromRange(e, n) {
|
|
261
|
-
return new
|
|
261
|
+
return new ae(e, n);
|
|
262
262
|
}
|
|
263
263
|
static fromSelector(e, n) {
|
|
264
264
|
if (!(n != null && n.startContainer) || !(n != null && n.endContainer))
|
|
265
265
|
return console.error("No start or end container in selector"), null;
|
|
266
|
-
const o =
|
|
266
|
+
const o = Ue(n.startContainer, e);
|
|
267
267
|
if (!o)
|
|
268
268
|
return console.error("Failed to resolve startContainer XPath"), null;
|
|
269
|
-
const r =
|
|
269
|
+
const r = Ue(n.endContainer, e);
|
|
270
270
|
if (!r)
|
|
271
271
|
return console.error("Failed to resolve endContainer XPath"), null;
|
|
272
|
-
const i =
|
|
272
|
+
const i = K.fromCharOffset(o, n.startOffset), l = K.fromCharOffset(r, n.endOffset);
|
|
273
273
|
if (!i || !l)
|
|
274
274
|
return null;
|
|
275
|
-
const a = new
|
|
276
|
-
return a ? new
|
|
275
|
+
const a = new se(i, l).toRange();
|
|
276
|
+
return a ? new ae(e, a) : null;
|
|
277
277
|
}
|
|
278
278
|
toRange() {
|
|
279
279
|
return this.range;
|
|
280
280
|
}
|
|
281
281
|
toSelector() {
|
|
282
282
|
var i;
|
|
283
|
-
const e = (i =
|
|
283
|
+
const e = (i = se.fromRange(this.range)) == null ? void 0 : i.toRange(), n = e && se.fromRange(e), o = n && He(n.start.element, this.root), r = n && He(n.end.element, this.root);
|
|
284
284
|
return !o || !r ? null : {
|
|
285
285
|
startContainer: o,
|
|
286
286
|
startOffset: n.start.offset,
|
|
@@ -289,17 +289,17 @@ class le {
|
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
class
|
|
292
|
+
class le {
|
|
293
293
|
constructor(e, n, o) {
|
|
294
294
|
this.root = e, this.start = n, this.end = o;
|
|
295
295
|
}
|
|
296
296
|
static fromRange(e, n) {
|
|
297
297
|
var r;
|
|
298
|
-
const o = (r =
|
|
299
|
-
return o ? new
|
|
298
|
+
const o = (r = se.fromRange(n)) == null ? void 0 : r.relativeTo(e);
|
|
299
|
+
return o ? new le(e, o.start.offset, o.end.offset) : null;
|
|
300
300
|
}
|
|
301
301
|
static fromSelector(e, n) {
|
|
302
|
-
return new
|
|
302
|
+
return new le(e, n.start, n.end);
|
|
303
303
|
}
|
|
304
304
|
toSelector() {
|
|
305
305
|
return {
|
|
@@ -308,7 +308,7 @@ class ie {
|
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
310
|
toRange() {
|
|
311
|
-
return
|
|
311
|
+
return se.fromOffsets(this.root, this.start, this.end).toRange();
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
const Ze = (t) => {
|
|
@@ -320,7 +320,7 @@ const Ze = (t) => {
|
|
|
320
320
|
default:
|
|
321
321
|
return 0;
|
|
322
322
|
}
|
|
323
|
-
},
|
|
323
|
+
}, Ge = (t) => {
|
|
324
324
|
let e = t.previousSibling, n = 0;
|
|
325
325
|
for (; e; )
|
|
326
326
|
n += Ze(e), e = e.previousSibling;
|
|
@@ -336,7 +336,7 @@ const Ze = (t) => {
|
|
|
336
336
|
return n !== void 0 && console.error("Offset exceeds text length"), r;
|
|
337
337
|
}, _t = (t, e, n, o) => {
|
|
338
338
|
const r = n - e;
|
|
339
|
-
return Math.abs(r - o) <= 5 ?
|
|
339
|
+
return Math.abs(r - o) <= 5 ? le.fromSelector(t, {
|
|
340
340
|
start: e,
|
|
341
341
|
end: n
|
|
342
342
|
}) : null;
|
|
@@ -356,14 +356,14 @@ const Ze = (t) => {
|
|
|
356
356
|
if ((c > d || b > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, d), c !== -1 && c < d))
|
|
357
357
|
return _t(t, c, d, m);
|
|
358
358
|
if (c < d && b <= 5)
|
|
359
|
-
return
|
|
359
|
+
return le.fromSelector(t, {
|
|
360
360
|
start: c,
|
|
361
361
|
end: d
|
|
362
362
|
});
|
|
363
363
|
} else {
|
|
364
364
|
const l = r.match_main(i, e, n);
|
|
365
365
|
if (l !== -1)
|
|
366
|
-
return
|
|
366
|
+
return le.fromSelector(t, {
|
|
367
367
|
start: l,
|
|
368
368
|
end: l + e.length
|
|
369
369
|
});
|
|
@@ -383,7 +383,7 @@ const Ze = (t) => {
|
|
|
383
383
|
for (const i of e) {
|
|
384
384
|
const l = Mt(i, t);
|
|
385
385
|
if (l) {
|
|
386
|
-
const a = l.toRange(), m = a &&
|
|
386
|
+
const a = l.toRange(), m = a && ae.fromRange(t, a), c = (a == null ? void 0 : a.toString().trim()) || i.highlightData.selectedText;
|
|
387
387
|
o.push({
|
|
388
388
|
id: i.id,
|
|
389
389
|
reaction: i.reaction,
|
|
@@ -414,28 +414,28 @@ const Ze = (t) => {
|
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: n, id: o } = t, { range: r } = n ?? {};
|
|
417
|
-
r && ((l =
|
|
417
|
+
r && ((l = ae.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Yt({ id: o });
|
|
418
418
|
}, $t = (t) => {
|
|
419
419
|
const n = document.querySelector(
|
|
420
420
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
421
|
-
) ?? document.getElementById(
|
|
421
|
+
) ?? document.getElementById(Ie(t));
|
|
422
422
|
if (n) {
|
|
423
423
|
const o = n.getBoundingClientRect();
|
|
424
424
|
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
425
425
|
}
|
|
426
|
-
},
|
|
426
|
+
}, ye = 90, Ne = 172, Ht = (t) => {
|
|
427
427
|
const e = t.getClientRects();
|
|
428
428
|
if (!e.length)
|
|
429
429
|
return null;
|
|
430
430
|
const n = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (p) => {
|
|
431
|
-
const E = p +
|
|
431
|
+
const E = p + Ne;
|
|
432
432
|
return p >= i && E <= l - i;
|
|
433
433
|
}, c = (p) => {
|
|
434
|
-
const E = p +
|
|
434
|
+
const E = p + ye;
|
|
435
435
|
return p >= i && E <= a - i;
|
|
436
436
|
};
|
|
437
437
|
let y;
|
|
438
|
-
const d = n.right -
|
|
438
|
+
const d = n.right - Ne;
|
|
439
439
|
if (m(d))
|
|
440
440
|
y = d;
|
|
441
441
|
else {
|
|
@@ -443,8 +443,8 @@ const Ze = (t) => {
|
|
|
443
443
|
if (m(p))
|
|
444
444
|
y = p;
|
|
445
445
|
else {
|
|
446
|
-
const g = (n.left + n.right) / 2 -
|
|
447
|
-
m(g) ? y = g : d < i ? y = i : y = l -
|
|
446
|
+
const g = (n.left + n.right) / 2 - Ne / 2;
|
|
447
|
+
m(g) ? y = g : d < i ? y = i : y = l - Ne - i;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
let h;
|
|
@@ -452,16 +452,16 @@ const Ze = (t) => {
|
|
|
452
452
|
if (c(b))
|
|
453
453
|
h = b;
|
|
454
454
|
else {
|
|
455
|
-
const p = n.top -
|
|
456
|
-
c(p) ? h = p : b +
|
|
455
|
+
const p = n.top - ye - r;
|
|
456
|
+
c(p) ? h = p : b + ye > a - i ? h = a - ye - i : h = i;
|
|
457
457
|
}
|
|
458
458
|
return { top: h, left: y };
|
|
459
|
-
},
|
|
459
|
+
}, Ut = (t, e) => {
|
|
460
460
|
for (const n of e)
|
|
461
461
|
if (t.start < n.end && t.end > n.start)
|
|
462
462
|
return !0;
|
|
463
463
|
return !1;
|
|
464
|
-
},
|
|
464
|
+
}, _e = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${_e(t)}-start`, et = (t) => `${_e(t)}-end`, ge = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, Gt = "2px", jt = "3px", Wt = "1px", tt = "3px", zt = "1px", nt = "Notebook note", Fe = (t, e) => {
|
|
465
465
|
const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
|
|
466
466
|
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
467
467
|
}, ot = (t, e, n, o, r) => {
|
|
@@ -498,12 +498,12 @@ const Ze = (t) => {
|
|
|
498
498
|
return n;
|
|
499
499
|
}, Xt = (t, e, n) => {
|
|
500
500
|
if (t.collapsed) return;
|
|
501
|
-
const o = e.id ?? "", r =
|
|
502
|
-
if (document.getElementById(
|
|
501
|
+
const o = e.id ?? "", r = _e(o);
|
|
502
|
+
if (document.getElementById(Ie(o))) {
|
|
503
503
|
Qt(e, n);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const l = e.type ===
|
|
506
|
+
const l = e.type === R.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : Fe(l, 0.5), c = e.type === R.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, y = e.type === R.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
|
|
507
507
|
d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
|
|
508
508
|
const h = e.labelPrefix ?? nt;
|
|
509
509
|
d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", h), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
|
|
@@ -515,91 +515,91 @@ const Ze = (t) => {
|
|
|
515
515
|
E.collapse(!0), E.insertNode(d);
|
|
516
516
|
const g = document.createRange();
|
|
517
517
|
g.setStartAfter(d), g.setEndBefore(b);
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
const
|
|
522
|
-
if ((
|
|
523
|
-
const
|
|
524
|
-
let
|
|
525
|
-
T ?
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
}), (
|
|
518
|
+
const W = Kt(g).filter((N) => N.textContent && N.textContent.length > 0);
|
|
519
|
+
W.forEach((N, C) => {
|
|
520
|
+
var M;
|
|
521
|
+
const D = N.parentElement;
|
|
522
|
+
if ((D == null ? void 0 : D.dataset.highlightId) === o) return;
|
|
523
|
+
const H = C === 0, P = C === W.length - 1, T = W.length === 1;
|
|
524
|
+
let O;
|
|
525
|
+
T ? O = "single" : H ? O = "first" : P ? O = "last" : O = "middle";
|
|
526
|
+
const x = document.createElement("span");
|
|
527
|
+
x.className = "highlight-content", x.dataset.highlightId = o || "", x.dataset.position = O, x.style.textDecorationLine = "underline", x.style.textDecorationThickness = n.borderWidthSmall, x.style.textUnderlineOffset = n.underlineOffset, x.style.cursor = "pointer", ot(x, a, m, c, y), x.addEventListener("click", (V) => {
|
|
528
|
+
var Z;
|
|
529
|
+
V.target.tagName !== "A" && ((Z = e.onClick) == null || Z.call(e));
|
|
530
|
+
}), (M = N.parentNode) == null || M.insertBefore(x, N), x.appendChild(N);
|
|
531
531
|
}), d.addEventListener("click", (N) => {
|
|
532
|
-
var
|
|
533
|
-
N.target.tagName !== "A" && ((
|
|
532
|
+
var C;
|
|
533
|
+
N.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
534
534
|
}), d.addEventListener("keydown", (N) => {
|
|
535
|
-
var
|
|
535
|
+
var C;
|
|
536
536
|
if (N.key === "Enter" || N.key === " ")
|
|
537
|
-
N.preventDefault(), (
|
|
537
|
+
N.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
538
538
|
else if (N.key === "Tab" && !N.shiftKey) {
|
|
539
|
-
const
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
N.preventDefault(),
|
|
539
|
+
const D = document.querySelectorAll(ge(o));
|
|
540
|
+
for (const H of D) {
|
|
541
|
+
const P = H.querySelector("a");
|
|
542
|
+
if (P) {
|
|
543
|
+
N.preventDefault(), P.focus();
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
}), d.addEventListener("focus", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
|
-
`.highlight-content${
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
550
|
+
`.highlight-content${ge(o)}`
|
|
551
|
+
).forEach((C) => {
|
|
552
|
+
C.style.boxShadow = `0 0 0 ${Gt} ${n.colors.focusOutline}`, C.style.borderRadius = jt;
|
|
553
553
|
});
|
|
554
554
|
}), d.addEventListener("blur", () => {
|
|
555
555
|
document.querySelectorAll(
|
|
556
|
-
`.highlight-content${
|
|
557
|
-
).forEach((
|
|
558
|
-
|
|
556
|
+
`.highlight-content${ge(o)}`
|
|
557
|
+
).forEach((C) => {
|
|
558
|
+
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? tt : "";
|
|
559
559
|
});
|
|
560
560
|
});
|
|
561
561
|
};
|
|
562
562
|
function Qt(t, e) {
|
|
563
|
-
const n = t.type ===
|
|
563
|
+
const n = t.type === R.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : Fe(n, 0.5), i = t.type === R.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === R.IMPORTANT ? "solid" : "dashed";
|
|
564
564
|
document.querySelectorAll(
|
|
565
|
-
`.highlight-content${
|
|
565
|
+
`.highlight-content${ge(t.id ?? "")}`
|
|
566
566
|
).forEach((c) => {
|
|
567
567
|
ot(c, o, r, i, l);
|
|
568
568
|
});
|
|
569
569
|
const m = document.getElementById(
|
|
570
|
-
|
|
570
|
+
Ie(t.id ?? "")
|
|
571
571
|
);
|
|
572
572
|
m && (m.setAttribute("aria-label", t.labelPrefix ?? nt), m.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? m.setAttribute("aria-current", "true") : m.removeAttribute("aria-current"));
|
|
573
573
|
}
|
|
574
574
|
const Yt = (t) => {
|
|
575
|
-
const e = t.id ?? "", n = document.getElementById(
|
|
575
|
+
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(et(e));
|
|
576
576
|
document.querySelectorAll(
|
|
577
|
-
|
|
577
|
+
ge(e)
|
|
578
578
|
).forEach((i) => {
|
|
579
579
|
var l;
|
|
580
580
|
for (; i.firstChild; )
|
|
581
581
|
(l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
|
|
582
582
|
i.remove();
|
|
583
583
|
}), n == null || n.remove(), o == null || o.remove();
|
|
584
|
-
},
|
|
584
|
+
}, fe = {
|
|
585
585
|
all: ["notebook"],
|
|
586
586
|
notes: (t) => ["notebook", "notes", t]
|
|
587
587
|
};
|
|
588
588
|
function Vt(t) {
|
|
589
|
-
const e =
|
|
590
|
-
return
|
|
589
|
+
const e = we();
|
|
590
|
+
return Oe({
|
|
591
591
|
mutationFn: (n) => t.createNote(n),
|
|
592
592
|
onSuccess: () => {
|
|
593
|
-
e.invalidateQueries({ queryKey:
|
|
593
|
+
e.invalidateQueries({ queryKey: fe.all });
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
function Zt(t) {
|
|
598
|
-
const e =
|
|
599
|
-
return
|
|
598
|
+
const e = we();
|
|
599
|
+
return Oe({
|
|
600
600
|
mutationFn: (n) => t.deleteNote(n),
|
|
601
601
|
onSuccess: () => {
|
|
602
|
-
e.invalidateQueries({ queryKey:
|
|
602
|
+
e.invalidateQueries({ queryKey: fe.all });
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
605
|
}
|
|
@@ -609,7 +609,7 @@ function rt({
|
|
|
609
609
|
...n
|
|
610
610
|
}) {
|
|
611
611
|
return ht({
|
|
612
|
-
queryKey:
|
|
612
|
+
queryKey: fe.notes(n),
|
|
613
613
|
queryFn: () => t.getNotes(n),
|
|
614
614
|
enabled: e
|
|
615
615
|
});
|
|
@@ -635,12 +635,12 @@ function st({
|
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
function en(t) {
|
|
638
|
-
const e =
|
|
639
|
-
return
|
|
638
|
+
const e = we();
|
|
639
|
+
return Oe({
|
|
640
640
|
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
641
641
|
onMutate: async ({ id: n, input: o }) => {
|
|
642
|
-
await e.cancelQueries({ queryKey:
|
|
643
|
-
const i = e.getQueryCache().findAll({ queryKey:
|
|
642
|
+
await e.cancelQueries({ queryKey: fe.all });
|
|
643
|
+
const i = e.getQueryCache().findAll({ queryKey: fe.all }), l = /* @__PURE__ */ new Map();
|
|
644
644
|
for (const a of i) {
|
|
645
645
|
const m = a.state.data;
|
|
646
646
|
m && (l.set(a.queryKey, m), e.setQueryData(a.queryKey, {
|
|
@@ -658,11 +658,11 @@ function en(t) {
|
|
|
658
658
|
e.setQueryData(i, l);
|
|
659
659
|
},
|
|
660
660
|
onSettled: () => {
|
|
661
|
-
e.invalidateQueries({ queryKey:
|
|
661
|
+
e.invalidateQueries({ queryKey: fe.all });
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Back", ln = "Edit note", an = "Save", cn = "Cancel", dn = "Delete note", un = "Delete note confirmation", fn = "note", mn = "Add note (optional)", gn = "Remove from Notebook", hn = "Add a note (optional)", pn = "Mark important", yn = "Mark unclear", Nn = "Saved to Notebook.", bn = "Note updated", En = "Note deleted", Tn = "Error saving to Notebook.", Sn = "Error updating note", vn = "Note deletion failed", In = "Loading notes", Cn = "Failed to load notes", xn = "Start capturing your notes",
|
|
665
|
+
const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Back", ln = "Edit note", an = "Save", cn = "Cancel", dn = "Delete note", un = "Delete note confirmation", fn = "note", mn = "Add note (optional)", gn = "Remove from Notebook", hn = "Add a note (optional)", pn = "Mark important", yn = "Mark unclear", Nn = "Saved to Notebook.", bn = "Note updated", En = "Note deleted", Tn = "Error saving to Notebook.", Sn = "Error updating note", vn = "Note deletion failed", In = "Loading notes", Cn = "Failed to load notes", xn = "Start capturing your notes", kn = "Your notes from learning materials will appear here. Highlight key ideas, reflections, or questions as you learn—they'll all be saved in your Notebook for easy review later.", Rn = "Nothing here yet", wn = "Adjust your filters or create a new note to get started.", On = "You have no notes for the selected filter", Ln = "Filter", An = "Previous page", Dn = "Next page", Pn = "All courses", _n = "All notes", Fn = "Close Notebook panel", Mn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", Bn = "The content you highlighted is no longer available.", $n = "Notebook note", Me = {
|
|
666
666
|
notebook: tn,
|
|
667
667
|
notes: nn,
|
|
668
668
|
important: on,
|
|
@@ -688,8 +688,8 @@ const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Bac
|
|
|
688
688
|
loadingNotes: In,
|
|
689
689
|
failedToLoadNotes: Cn,
|
|
690
690
|
emptyStateHeading: xn,
|
|
691
|
-
emptyStateDescription:
|
|
692
|
-
nothingHereYet:
|
|
691
|
+
emptyStateDescription: kn,
|
|
692
|
+
nothingHereYet: Rn,
|
|
693
693
|
adjustFiltersOrCreate: wn,
|
|
694
694
|
noNotesForFilter: On,
|
|
695
695
|
filter: Ln,
|
|
@@ -703,7 +703,7 @@ const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Bac
|
|
|
703
703
|
notebookNote: $n
|
|
704
704
|
}, it = Ke(null);
|
|
705
705
|
function lt(t, e) {
|
|
706
|
-
const n =
|
|
706
|
+
const n = Me[t] ?? t;
|
|
707
707
|
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
708
708
|
}
|
|
709
709
|
function Hn({
|
|
@@ -711,25 +711,25 @@ function Hn({
|
|
|
711
711
|
translate: e,
|
|
712
712
|
children: n
|
|
713
713
|
}) {
|
|
714
|
-
const o =
|
|
714
|
+
const o = he(
|
|
715
715
|
() => ({
|
|
716
|
-
translations: { ...
|
|
716
|
+
translations: { ...Me, ...t },
|
|
717
717
|
translate: e ?? lt
|
|
718
718
|
}),
|
|
719
719
|
[t, e]
|
|
720
720
|
);
|
|
721
721
|
return /* @__PURE__ */ s(it.Provider, { value: o, children: n });
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function ee() {
|
|
724
724
|
const t = Xe(it);
|
|
725
|
-
return t || { translations:
|
|
725
|
+
return t || { translations: Me, translate: lt };
|
|
726
726
|
}
|
|
727
|
-
const
|
|
727
|
+
const Un = (t) => ({
|
|
728
728
|
selectedNoteId: t ?? null,
|
|
729
729
|
isNoteEditing: !1,
|
|
730
730
|
isTrayOpen: t != null
|
|
731
731
|
});
|
|
732
|
-
function
|
|
732
|
+
function Gn(t, e) {
|
|
733
733
|
switch (e.type) {
|
|
734
734
|
case "SELECT_NOTE":
|
|
735
735
|
return {
|
|
@@ -763,7 +763,7 @@ function Eo({
|
|
|
763
763
|
translate: c,
|
|
764
764
|
children: y
|
|
765
765
|
}) {
|
|
766
|
-
const [d, h] = Qe(
|
|
766
|
+
const [d, h] = Qe(Gn, Un(a)), b = $(a != null), p = he(
|
|
767
767
|
() => ({
|
|
768
768
|
api: t,
|
|
769
769
|
currentUserId: e,
|
|
@@ -793,7 +793,7 @@ function ct() {
|
|
|
793
793
|
return t;
|
|
794
794
|
}
|
|
795
795
|
const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
796
|
-
const { isTrayOpen: e, closeTray: n } = ct(), { translations: o } =
|
|
796
|
+
const { isTrayOpen: e, closeTray: n } = ct(), { translations: o } = ee();
|
|
797
797
|
return /* @__PURE__ */ s(
|
|
798
798
|
yt,
|
|
799
799
|
{
|
|
@@ -802,9 +802,9 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
802
802
|
onDismiss: n,
|
|
803
803
|
placement: "end",
|
|
804
804
|
size: "regular",
|
|
805
|
-
children: /* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */ s(
|
|
807
|
-
/* @__PURE__ */ s(
|
|
805
|
+
children: /* @__PURE__ */ S(k, { direction: "column", height: "100vh", id: dt, children: [
|
|
806
|
+
/* @__PURE__ */ s(k.Item, { children: /* @__PURE__ */ s(X, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(k, { justifyItems: "space-between", alignItems: "center", children: [
|
|
807
|
+
/* @__PURE__ */ s(Se, { level: "h3", children: o.notebook }),
|
|
808
808
|
/* @__PURE__ */ s(
|
|
809
809
|
pt,
|
|
810
810
|
{
|
|
@@ -815,16 +815,16 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
815
815
|
}
|
|
816
816
|
)
|
|
817
817
|
] }) }) }),
|
|
818
|
-
/* @__PURE__ */ s(
|
|
818
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
819
819
|
] })
|
|
820
820
|
}
|
|
821
821
|
);
|
|
822
822
|
}, jn = ({ currentType: t, onSelectReaction: e }) => {
|
|
823
|
-
const { translations: n } =
|
|
824
|
-
return
|
|
825
|
-
t ===
|
|
823
|
+
const { translations: n } = ee(), o = $(null), r = $(null);
|
|
824
|
+
return z(() => {
|
|
825
|
+
t === R.CONFUSING && o.current ? o.current.focus() : t === R.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
826
826
|
}, [t]), /* @__PURE__ */ s(
|
|
827
|
-
|
|
827
|
+
X,
|
|
828
828
|
{
|
|
829
829
|
as: "div",
|
|
830
830
|
background: "primary",
|
|
@@ -832,25 +832,25 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
832
832
|
borderColor: "secondary",
|
|
833
833
|
borderRadius: "medium",
|
|
834
834
|
shadow: "resting",
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
|
|
835
|
+
children: /* @__PURE__ */ S(ue, { children: [
|
|
836
|
+
/* @__PURE__ */ S(
|
|
837
|
+
ue.Item,
|
|
838
838
|
{
|
|
839
839
|
ref: o,
|
|
840
|
-
onClick: () => e(
|
|
840
|
+
onClick: () => e(R.CONFUSING),
|
|
841
841
|
children: [
|
|
842
|
-
/* @__PURE__ */ s(
|
|
842
|
+
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
843
843
|
` ${n.markUnclear}`
|
|
844
844
|
]
|
|
845
845
|
}
|
|
846
846
|
),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
|
|
847
|
+
/* @__PURE__ */ S(
|
|
848
|
+
ue.Item,
|
|
849
849
|
{
|
|
850
850
|
ref: r,
|
|
851
|
-
onClick: () => e(
|
|
851
|
+
onClick: () => e(R.IMPORTANT),
|
|
852
852
|
children: [
|
|
853
|
-
/* @__PURE__ */ s(
|
|
853
|
+
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
854
854
|
` ${n.markImportant}`
|
|
855
855
|
]
|
|
856
856
|
}
|
|
@@ -858,7 +858,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
858
858
|
] })
|
|
859
859
|
}
|
|
860
860
|
);
|
|
861
|
-
},
|
|
861
|
+
}, Ce = "notebook-inline-reaction-menu";
|
|
862
862
|
function So({
|
|
863
863
|
containerRef: t,
|
|
864
864
|
highlightTheme: e,
|
|
@@ -878,130 +878,130 @@ function So({
|
|
|
878
878
|
isTrayOpen: b,
|
|
879
879
|
selectNote: p,
|
|
880
880
|
openTray: E
|
|
881
|
-
} = ct(), { translations: g } =
|
|
881
|
+
} = ct(), { translations: g } = ee(), { data: Q } = st({
|
|
882
882
|
api: a,
|
|
883
883
|
courseId: y,
|
|
884
884
|
learningObject: { type: c, id: m }
|
|
885
|
-
}), { mutate:
|
|
886
|
-
|
|
887
|
-
const [
|
|
888
|
-
|
|
885
|
+
}), { mutate: W } = Vt(a), { mutateAsync: N } = en(a), { mutate: C } = Zt(a), D = $([]), [H, P] = j([]), [T, O] = j(null), [x, M] = j(""), [V, Z] = j(null), ce = $(null);
|
|
886
|
+
ce.current = V;
|
|
887
|
+
const [J, de] = j(!1);
|
|
888
|
+
z(() => {
|
|
889
889
|
const w = t.current;
|
|
890
890
|
if (!w) return;
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
|
|
891
|
+
const I = w.closest(".user_content") ?? w;
|
|
892
|
+
if (I.classList.contains("enhanced")) {
|
|
893
|
+
de(!0);
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
|
-
const
|
|
897
|
-
for (const
|
|
898
|
-
if (
|
|
899
|
-
|
|
896
|
+
const F = new MutationObserver((A) => {
|
|
897
|
+
for (const G of A)
|
|
898
|
+
if (G.type === "attributes" && G.attributeName === "class" && G.target.classList.contains("enhanced")) {
|
|
899
|
+
de(!0), F.disconnect();
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
902
|
});
|
|
903
|
-
return
|
|
903
|
+
return F.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => F.disconnect();
|
|
904
904
|
}, [t]);
|
|
905
|
-
const
|
|
906
|
-
|
|
905
|
+
const Y = q(() => {
|
|
906
|
+
Z(null), O(null), M("");
|
|
907
907
|
}, []);
|
|
908
|
-
|
|
909
|
-
if (!
|
|
910
|
-
let
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
var
|
|
914
|
-
const
|
|
915
|
-
if (!(
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
if (!
|
|
920
|
-
const
|
|
921
|
-
|
|
908
|
+
z(() => {
|
|
909
|
+
if (!J || !t.current) return;
|
|
910
|
+
let I = null;
|
|
911
|
+
const F = () => {
|
|
912
|
+
I && clearTimeout(I), I = setTimeout(() => {
|
|
913
|
+
var ie;
|
|
914
|
+
const v = window.getSelection(), B = t.current;
|
|
915
|
+
if (!(v != null && v.rangeCount) || !B) return;
|
|
916
|
+
const ne = v.toString().trim();
|
|
917
|
+
if (ne === "") return;
|
|
918
|
+
const f = v.getRangeAt(0);
|
|
919
|
+
if (!B.contains(f.commonAncestorContainer)) return;
|
|
920
|
+
const L = (ie = le.fromRange(B, f)) == null ? void 0 : ie.toSelector();
|
|
921
|
+
L && !Ut(L, H) && (O(f.cloneRange()), M(ne), Z(Ht(f)));
|
|
922
922
|
}, n);
|
|
923
|
-
},
|
|
924
|
-
if (!(
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
},
|
|
928
|
-
|
|
929
|
-
},
|
|
930
|
-
|
|
923
|
+
}, A = (v) => {
|
|
924
|
+
if (!(v.target instanceof Node)) return;
|
|
925
|
+
const B = document.getElementById(Ce);
|
|
926
|
+
B != null && B.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : Y();
|
|
927
|
+
}, G = () => {
|
|
928
|
+
Y();
|
|
929
|
+
}, _ = (v) => {
|
|
930
|
+
v.key === "Escape" && ce.current !== null && (Y(), v.stopImmediatePropagation());
|
|
931
931
|
};
|
|
932
|
-
return document.addEventListener("selectionchange",
|
|
933
|
-
|
|
932
|
+
return document.addEventListener("selectionchange", F), document.addEventListener("mousedown", A), document.addEventListener("touchstart", A), document.addEventListener("keydown", _), window.addEventListener("scroll", G, !0), () => {
|
|
933
|
+
I && clearTimeout(I), document.removeEventListener("selectionchange", F), document.removeEventListener("mousedown", A), document.removeEventListener("touchstart", A), document.removeEventListener("keydown", _), window.removeEventListener("scroll", G, !0);
|
|
934
934
|
};
|
|
935
|
-
}, [
|
|
936
|
-
const
|
|
935
|
+
}, [J, H, n, t, Y]);
|
|
936
|
+
const te = q(
|
|
937
937
|
(w) => {
|
|
938
|
-
var
|
|
939
|
-
const
|
|
940
|
-
if (!
|
|
941
|
-
const { highlightData:
|
|
942
|
-
if (
|
|
943
|
-
const
|
|
944
|
-
id:
|
|
938
|
+
var B;
|
|
939
|
+
const I = t.current;
|
|
940
|
+
if (!I || !w.highlightData) return null;
|
|
941
|
+
const { highlightData: F, reaction: A, id: G } = w, { range: _ } = F, v = _ && ((B = ae.fromSelector(I, _)) == null ? void 0 : B.toRange());
|
|
942
|
+
if (v) {
|
|
943
|
+
const ne = A[0] === R.IMPORTANT ? g.important : g.unclear, f = {
|
|
944
|
+
id: G,
|
|
945
945
|
selectedNoteId: h,
|
|
946
|
-
type:
|
|
946
|
+
type: A[0],
|
|
947
947
|
isTrayOpen: b,
|
|
948
|
-
labelPrefix: `${g.notebookNote} (${
|
|
948
|
+
labelPrefix: `${g.notebookNote} (${ne})`,
|
|
949
949
|
popupId: dt,
|
|
950
950
|
onClick: () => {
|
|
951
|
-
p(
|
|
951
|
+
p(G), E();
|
|
952
952
|
}
|
|
953
953
|
};
|
|
954
|
-
return Xt(
|
|
954
|
+
return Xt(v, f, e), F.textPosition;
|
|
955
955
|
}
|
|
956
956
|
return null;
|
|
957
957
|
},
|
|
958
958
|
[t, h, b, e, g, p, E]
|
|
959
959
|
);
|
|
960
|
-
|
|
961
|
-
if (!
|
|
962
|
-
const w = t.current,
|
|
963
|
-
if (
|
|
964
|
-
if (
|
|
965
|
-
for (const
|
|
966
|
-
je(
|
|
967
|
-
|
|
960
|
+
z(() => {
|
|
961
|
+
if (!J || !Q || !t.current) return;
|
|
962
|
+
const w = t.current, I = Q.notes, F = /* @__PURE__ */ new Set(), A = [], G = [];
|
|
963
|
+
if (I.length === 0) {
|
|
964
|
+
if (D.current.length > 0) {
|
|
965
|
+
for (const _ of D.current)
|
|
966
|
+
je(_, w);
|
|
967
|
+
D.current = [], P([]);
|
|
968
968
|
}
|
|
969
969
|
return;
|
|
970
970
|
}
|
|
971
|
-
if (d &&
|
|
972
|
-
const { notesForUpdate:
|
|
971
|
+
if (d && I[0].highlightData.pageLastModifiedAt !== d) {
|
|
972
|
+
const { notesForUpdate: _, noteIdsForDelete: v } = Bt(
|
|
973
973
|
w,
|
|
974
|
-
|
|
974
|
+
I,
|
|
975
975
|
d
|
|
976
976
|
);
|
|
977
|
-
for (const
|
|
978
|
-
N({ id:
|
|
979
|
-
for (const
|
|
980
|
-
|
|
977
|
+
for (const B of _)
|
|
978
|
+
N({ id: B.id, input: B }).catch((ne) => r == null ? void 0 : r(ne));
|
|
979
|
+
for (const B of v)
|
|
980
|
+
C(B, { onError: i });
|
|
981
981
|
} else {
|
|
982
|
-
for (const
|
|
983
|
-
const
|
|
984
|
-
|
|
982
|
+
for (const _ of I) {
|
|
983
|
+
const v = te(_);
|
|
984
|
+
F.add(_.id), v && (A.push(_), G.push(v));
|
|
985
985
|
}
|
|
986
|
-
for (const
|
|
987
|
-
|
|
988
|
-
|
|
986
|
+
for (const _ of D.current)
|
|
987
|
+
F.has(_.id) || je(_, w);
|
|
988
|
+
P(G), D.current = A, h && $t(h);
|
|
989
989
|
}
|
|
990
990
|
}, [
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
991
|
+
J,
|
|
992
|
+
Q,
|
|
993
|
+
te,
|
|
994
994
|
d,
|
|
995
995
|
t,
|
|
996
996
|
N,
|
|
997
|
-
|
|
997
|
+
C,
|
|
998
998
|
h
|
|
999
999
|
]);
|
|
1000
|
-
const
|
|
1001
|
-
const
|
|
1002
|
-
if (!T || !
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1000
|
+
const U = (w) => {
|
|
1001
|
+
const I = t.current;
|
|
1002
|
+
if (!T || !I) return;
|
|
1003
|
+
const F = ae.fromRange(I, T), A = le.fromRange(I, T);
|
|
1004
|
+
W(
|
|
1005
1005
|
{
|
|
1006
1006
|
courseId: y,
|
|
1007
1007
|
objectId: m,
|
|
@@ -1009,58 +1009,58 @@ function So({
|
|
|
1009
1009
|
userText: "",
|
|
1010
1010
|
reaction: [w],
|
|
1011
1011
|
highlightData: {
|
|
1012
|
-
selectedText:
|
|
1013
|
-
textPosition: (
|
|
1014
|
-
range:
|
|
1012
|
+
selectedText: x,
|
|
1013
|
+
textPosition: (A == null ? void 0 : A.toSelector()) ?? null,
|
|
1014
|
+
range: F.toSelector(),
|
|
1015
1015
|
pageLastModifiedAt: d ?? ""
|
|
1016
1016
|
}
|
|
1017
1017
|
},
|
|
1018
1018
|
{
|
|
1019
|
-
onSuccess: (
|
|
1020
|
-
var
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1019
|
+
onSuccess: (G) => {
|
|
1020
|
+
var v;
|
|
1021
|
+
const _ = G.id;
|
|
1022
|
+
Y(), (v = window.getSelection()) == null || v.removeAllRanges(), p(_), E(), l == null || l(G);
|
|
1023
1023
|
},
|
|
1024
1024
|
onError: o
|
|
1025
1025
|
}
|
|
1026
1026
|
);
|
|
1027
1027
|
};
|
|
1028
|
-
return !T || !
|
|
1028
|
+
return !T || !V ? null : mt(
|
|
1029
1029
|
/* @__PURE__ */ s(
|
|
1030
1030
|
"div",
|
|
1031
1031
|
{
|
|
1032
|
-
id:
|
|
1032
|
+
id: Ce,
|
|
1033
1033
|
role: "toolbar",
|
|
1034
1034
|
style: {
|
|
1035
1035
|
position: "fixed",
|
|
1036
1036
|
zIndex: 100,
|
|
1037
|
-
top:
|
|
1038
|
-
left:
|
|
1037
|
+
top: V.top,
|
|
1038
|
+
left: V.left,
|
|
1039
1039
|
whiteSpace: "nowrap"
|
|
1040
1040
|
},
|
|
1041
1041
|
onBlur: (w) => {
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1042
|
+
const I = document.getElementById(Ce);
|
|
1043
|
+
I != null && I.contains(w.relatedTarget) || Y();
|
|
1044
1044
|
},
|
|
1045
|
-
children: /* @__PURE__ */ s(jn, { onSelectReaction:
|
|
1045
|
+
children: /* @__PURE__ */ s(jn, { onSelectReaction: U })
|
|
1046
1046
|
}
|
|
1047
1047
|
),
|
|
1048
1048
|
document.body
|
|
1049
1049
|
);
|
|
1050
1050
|
}
|
|
1051
1051
|
const Wn = (t, e) => ({
|
|
1052
|
-
backgroundColor: t ===
|
|
1053
|
-
underlineColor: t ===
|
|
1054
|
-
underlineStyle: t ===
|
|
1055
|
-
}),
|
|
1052
|
+
backgroundColor: t === R.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1053
|
+
underlineColor: t === R.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1054
|
+
underlineStyle: t === R.IMPORTANT ? "solid" : "dashed"
|
|
1055
|
+
}), Re = ({
|
|
1056
1056
|
children: t,
|
|
1057
|
-
type: e =
|
|
1057
|
+
type: e = R.IMPORTANT,
|
|
1058
1058
|
isCardActive: n = !0,
|
|
1059
1059
|
theme: o
|
|
1060
1060
|
}) => {
|
|
1061
1061
|
const r = Wn(e, o), l = {
|
|
1062
1062
|
position: "relative",
|
|
1063
|
-
backgroundColor: n ? r.backgroundColor :
|
|
1063
|
+
backgroundColor: n ? r.backgroundColor : Fe(r.backgroundColor, 0.5),
|
|
1064
1064
|
textDecorationLine: "underline",
|
|
1065
1065
|
textDecorationStyle: r.underlineStyle,
|
|
1066
1066
|
textDecorationColor: r.underlineColor,
|
|
@@ -1070,10 +1070,10 @@ const Wn = (t, e) => ({
|
|
|
1070
1070
|
};
|
|
1071
1071
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1072
1072
|
}, ut = () => {
|
|
1073
|
-
const { translations: t } =
|
|
1074
|
-
return /* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */ s(
|
|
1076
|
-
/* @__PURE__ */ s(
|
|
1073
|
+
const { translations: t } = ee();
|
|
1074
|
+
return /* @__PURE__ */ S(k, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1075
|
+
/* @__PURE__ */ s(k.Item, { as: "div", children: /* @__PURE__ */ s(Nt, { color: "error" }) }),
|
|
1076
|
+
/* @__PURE__ */ s(k.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ee, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1077
1077
|
] });
|
|
1078
1078
|
}, zn = {
|
|
1079
1079
|
filter: null,
|
|
@@ -1081,7 +1081,7 @@ const Wn = (t, e) => ({
|
|
|
1081
1081
|
currentPage: 1,
|
|
1082
1082
|
totalPages: void 0
|
|
1083
1083
|
};
|
|
1084
|
-
function
|
|
1084
|
+
function be(t, e) {
|
|
1085
1085
|
const n = typeof e == "number" ? Math.min(e, t) : t;
|
|
1086
1086
|
return Math.max(1, n);
|
|
1087
1087
|
}
|
|
@@ -1092,18 +1092,18 @@ function qn(t, e) {
|
|
|
1092
1092
|
case "SET_COURSE_FILTER":
|
|
1093
1093
|
return { ...t, courseFilter: e.payload, currentPage: 1 };
|
|
1094
1094
|
case "SET_PAGE":
|
|
1095
|
-
return { ...t, currentPage:
|
|
1095
|
+
return { ...t, currentPage: be(e.payload, t.totalPages) };
|
|
1096
1096
|
case "FOCUS_PAGE":
|
|
1097
1097
|
return { ...t, currentPage: Math.max(1, e.payload) };
|
|
1098
1098
|
case "INCREMENT_PAGE":
|
|
1099
|
-
return { ...t, currentPage:
|
|
1099
|
+
return { ...t, currentPage: be(t.currentPage + 1, t.totalPages) };
|
|
1100
1100
|
case "DECREMENT_PAGE":
|
|
1101
|
-
return { ...t, currentPage:
|
|
1101
|
+
return { ...t, currentPage: be(t.currentPage - 1, t.totalPages) };
|
|
1102
1102
|
case "SET_TOTAL_PAGES":
|
|
1103
1103
|
return t.totalPages === e.payload ? t : {
|
|
1104
1104
|
...t,
|
|
1105
1105
|
totalPages: e.payload,
|
|
1106
|
-
currentPage:
|
|
1106
|
+
currentPage: be(t.currentPage, e.payload)
|
|
1107
1107
|
};
|
|
1108
1108
|
default:
|
|
1109
1109
|
return t;
|
|
@@ -1117,9 +1117,9 @@ function vo({
|
|
|
1117
1117
|
pageSize: r = 16,
|
|
1118
1118
|
focusNoteId: i
|
|
1119
1119
|
}) {
|
|
1120
|
-
var
|
|
1120
|
+
var te;
|
|
1121
1121
|
const [l, a] = Qe(qn, zn), { filter: m, courseFilter: c, currentPage: y, totalPages: d } = l;
|
|
1122
|
-
|
|
1122
|
+
z(() => {
|
|
1123
1123
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1124
1124
|
}, [r]);
|
|
1125
1125
|
const h = n ? c : e, b = (y - 1) * r, p = !!o, E = {
|
|
@@ -1128,8 +1128,8 @@ function vo({
|
|
|
1128
1128
|
...o ? { learningObject: o } : {}
|
|
1129
1129
|
}, {
|
|
1130
1130
|
data: g,
|
|
1131
|
-
isLoading:
|
|
1132
|
-
isError:
|
|
1131
|
+
isLoading: Q,
|
|
1132
|
+
isError: W
|
|
1133
1133
|
} = rt({
|
|
1134
1134
|
api: t,
|
|
1135
1135
|
filter: E,
|
|
@@ -1138,88 +1138,88 @@ function vo({
|
|
|
1138
1138
|
enabled: !p
|
|
1139
1139
|
}), {
|
|
1140
1140
|
data: N,
|
|
1141
|
-
isLoading:
|
|
1142
|
-
isError:
|
|
1141
|
+
isLoading: C,
|
|
1142
|
+
isError: D
|
|
1143
1143
|
} = st({
|
|
1144
1144
|
api: t,
|
|
1145
1145
|
courseId: h ?? void 0,
|
|
1146
1146
|
learningObject: o,
|
|
1147
1147
|
enabled: p
|
|
1148
|
-
}),
|
|
1149
|
-
const
|
|
1150
|
-
return m ?
|
|
1151
|
-
}, [N, m]),
|
|
1152
|
-
|
|
1148
|
+
}), H = he(() => {
|
|
1149
|
+
const U = (N == null ? void 0 : N.notes) ?? [];
|
|
1150
|
+
return m ? U.filter((w) => w.reaction.includes(m)) : U;
|
|
1151
|
+
}, [N, m]), P = $(null);
|
|
1152
|
+
z(() => {
|
|
1153
1153
|
if (!i) {
|
|
1154
|
-
|
|
1154
|
+
P.current = null;
|
|
1155
1155
|
return;
|
|
1156
1156
|
}
|
|
1157
|
-
if (
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
const w = Math.floor(
|
|
1157
|
+
if (P.current === i) return;
|
|
1158
|
+
const U = H.findIndex((I) => I.id === i);
|
|
1159
|
+
if (U === -1) return;
|
|
1160
|
+
P.current = i;
|
|
1161
|
+
const w = Math.floor(U / r) + 1;
|
|
1162
1162
|
w !== y && a({ type: "FOCUS_PAGE", payload: w });
|
|
1163
|
-
}, [i,
|
|
1164
|
-
const T = p ?
|
|
1165
|
-
|
|
1166
|
-
a({ type: "SET_TOTAL_PAGES", payload:
|
|
1167
|
-
}, [
|
|
1168
|
-
const
|
|
1169
|
-
a({ type: "SET_PAGE", payload:
|
|
1170
|
-
}, []),
|
|
1163
|
+
}, [i, H, r, y]);
|
|
1164
|
+
const T = p ? H.slice(b, b + r) : (g == null ? void 0 : g.notes) ?? [], O = p ? C : Q, x = p ? D : W, M = p ? Math.max(1, Math.ceil(H.length / r)) : ((te = g == null ? void 0 : g.pageInfo) == null ? void 0 : te.totalNrOfPages) ?? void 0, V = p ? { totalCount: H.length, totalNrOfPages: M } : g == null ? void 0 : g.pageInfo;
|
|
1165
|
+
z(() => {
|
|
1166
|
+
a({ type: "SET_TOTAL_PAGES", payload: M });
|
|
1167
|
+
}, [M]);
|
|
1168
|
+
const Z = q((U) => {
|
|
1169
|
+
a({ type: "SET_PAGE", payload: U });
|
|
1170
|
+
}, []), ce = q(() => {
|
|
1171
1171
|
a({
|
|
1172
1172
|
type: "INCREMENT_PAGE"
|
|
1173
1173
|
/* IncrementPage */
|
|
1174
1174
|
});
|
|
1175
|
-
}, []),
|
|
1175
|
+
}, []), J = q(() => {
|
|
1176
1176
|
a({
|
|
1177
1177
|
type: "DECREMENT_PAGE"
|
|
1178
1178
|
/* DecrementPage */
|
|
1179
1179
|
});
|
|
1180
|
-
}, []),
|
|
1181
|
-
a({ type: "SET_FILTER", payload:
|
|
1182
|
-
}, []),
|
|
1183
|
-
a({ type: "SET_COURSE_FILTER", payload:
|
|
1180
|
+
}, []), de = q((U) => {
|
|
1181
|
+
a({ type: "SET_FILTER", payload: U });
|
|
1182
|
+
}, []), Y = q((U) => {
|
|
1183
|
+
a({ type: "SET_COURSE_FILTER", payload: U });
|
|
1184
1184
|
}, []);
|
|
1185
1185
|
return {
|
|
1186
1186
|
notes: T,
|
|
1187
|
-
pageInfo:
|
|
1188
|
-
isLoading:
|
|
1189
|
-
isError:
|
|
1187
|
+
pageInfo: V,
|
|
1188
|
+
isLoading: O,
|
|
1189
|
+
isError: x,
|
|
1190
1190
|
filter: m,
|
|
1191
1191
|
courseFilter: c,
|
|
1192
1192
|
currentPage: y,
|
|
1193
1193
|
totalPages: d,
|
|
1194
|
-
setFilter:
|
|
1195
|
-
setCourseFilter:
|
|
1196
|
-
setPage:
|
|
1197
|
-
fetchNextPage:
|
|
1198
|
-
fetchPreviousPage:
|
|
1194
|
+
setFilter: de,
|
|
1195
|
+
setCourseFilter: Y,
|
|
1196
|
+
setPage: Z,
|
|
1197
|
+
fetchNextPage: ce,
|
|
1198
|
+
fetchPreviousPage: J
|
|
1199
1199
|
};
|
|
1200
1200
|
}
|
|
1201
|
-
const
|
|
1201
|
+
const xe = "all";
|
|
1202
1202
|
function Io({ filter: t, setFilter: e }) {
|
|
1203
|
-
const { translations: n } =
|
|
1203
|
+
const { translations: n } = ee(), o = he(
|
|
1204
1204
|
() => [
|
|
1205
|
-
{ label: n.allNotes, value:
|
|
1206
|
-
{ label: n.important, value:
|
|
1207
|
-
{ label: n.unclear, value:
|
|
1205
|
+
{ label: n.allNotes, value: xe },
|
|
1206
|
+
{ label: n.important, value: R.IMPORTANT },
|
|
1207
|
+
{ label: n.unclear, value: R.CONFUSING }
|
|
1208
1208
|
],
|
|
1209
1209
|
[n]
|
|
1210
|
-
), r =
|
|
1210
|
+
), r = q(
|
|
1211
1211
|
(l, { value: a }) => {
|
|
1212
|
-
e(!a || a ===
|
|
1212
|
+
e(!a || a === xe ? null : a);
|
|
1213
1213
|
},
|
|
1214
1214
|
[e]
|
|
1215
1215
|
);
|
|
1216
1216
|
return {
|
|
1217
|
-
filterElement:
|
|
1217
|
+
filterElement: he(
|
|
1218
1218
|
() => /* @__PURE__ */ s(
|
|
1219
1219
|
Be,
|
|
1220
1220
|
{
|
|
1221
1221
|
renderLabel: n.filter,
|
|
1222
|
-
value: t ??
|
|
1222
|
+
value: t ?? xe,
|
|
1223
1223
|
onChange: r,
|
|
1224
1224
|
children: o.map((l) => /* @__PURE__ */ s(Be.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1225
1225
|
}
|
|
@@ -1231,31 +1231,31 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1231
1231
|
};
|
|
1232
1232
|
}
|
|
1233
1233
|
const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
1234
|
-
const { translations: e } =
|
|
1235
|
-
return /* @__PURE__ */ s(
|
|
1234
|
+
const { translations: e } = ee(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1235
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(k, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1236
1236
|
!t && /* @__PURE__ */ s(bt, { size: "medium" }),
|
|
1237
|
-
/* @__PURE__ */ s(
|
|
1238
|
-
/* @__PURE__ */ s(
|
|
1237
|
+
/* @__PURE__ */ s(Se, { level: "h3", children: n }),
|
|
1238
|
+
/* @__PURE__ */ s(oe, { color: "secondary", children: o })
|
|
1239
1239
|
] }) });
|
|
1240
1240
|
}, Xn = {
|
|
1241
|
-
[
|
|
1241
|
+
[R.IMPORTANT]: {
|
|
1242
1242
|
color: "success",
|
|
1243
1243
|
translationKey: "important",
|
|
1244
|
-
icon: /* @__PURE__ */ s(
|
|
1244
|
+
icon: /* @__PURE__ */ s(Ae, { size: "x-small" })
|
|
1245
1245
|
},
|
|
1246
|
-
[
|
|
1246
|
+
[R.CONFUSING]: {
|
|
1247
1247
|
color: "danger",
|
|
1248
1248
|
translationKey: "unclear",
|
|
1249
|
-
icon: /* @__PURE__ */ s(
|
|
1249
|
+
icon: /* @__PURE__ */ s(Le, { size: "x-small" })
|
|
1250
1250
|
}
|
|
1251
1251
|
}, ft = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1252
|
-
const { translations: o } =
|
|
1252
|
+
const { translations: o } = ee(), r = Xn[t], i = o[r.translationKey], [l, a] = j(!1), m = $(null), c = $(null), y = $(null), d = q(
|
|
1253
1253
|
(h) => {
|
|
1254
1254
|
e == null || e(h), a(!1);
|
|
1255
1255
|
},
|
|
1256
1256
|
[e]
|
|
1257
1257
|
);
|
|
1258
|
-
return
|
|
1258
|
+
return z(() => {
|
|
1259
1259
|
if (!l) return;
|
|
1260
1260
|
const h = (p) => {
|
|
1261
1261
|
p.key === "Escape" && p.stopPropagation();
|
|
@@ -1266,8 +1266,8 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1266
1266
|
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", b, !0), () => {
|
|
1267
1267
|
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", b, !0);
|
|
1268
1268
|
};
|
|
1269
|
-
}, [l]), n && e ? /* @__PURE__ */
|
|
1270
|
-
|
|
1269
|
+
}, [l]), n && e ? /* @__PURE__ */ S(
|
|
1270
|
+
ue,
|
|
1271
1271
|
{
|
|
1272
1272
|
placement: "bottom start",
|
|
1273
1273
|
show: l,
|
|
@@ -1286,17 +1286,17 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1286
1286
|
}
|
|
1287
1287
|
),
|
|
1288
1288
|
children: [
|
|
1289
|
-
/* @__PURE__ */
|
|
1290
|
-
/* @__PURE__ */ s(
|
|
1289
|
+
/* @__PURE__ */ S(ue.Item, { ref: m, onClick: () => d(R.CONFUSING), children: [
|
|
1290
|
+
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
1291
1291
|
` ${o.markUnclear}`
|
|
1292
1292
|
] }),
|
|
1293
|
-
/* @__PURE__ */
|
|
1294
|
-
/* @__PURE__ */ s(
|
|
1293
|
+
/* @__PURE__ */ S(ue.Item, { ref: c, onClick: () => d(R.IMPORTANT), children: [
|
|
1294
|
+
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
1295
1295
|
` ${o.markImportant}`
|
|
1296
1296
|
] })
|
|
1297
1297
|
]
|
|
1298
1298
|
}
|
|
1299
|
-
) : /* @__PURE__ */ s(
|
|
1299
|
+
) : /* @__PURE__ */ s(X, { display: "inline-flex", children: /* @__PURE__ */ s($e, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1300
1300
|
}, We = "0.75rem";
|
|
1301
1301
|
function ze(t, e) {
|
|
1302
1302
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
@@ -1323,42 +1323,42 @@ const Qn = ({
|
|
|
1323
1323
|
renderLink: p,
|
|
1324
1324
|
href: E
|
|
1325
1325
|
}) => {
|
|
1326
|
-
const { translations: g } =
|
|
1327
|
-
|
|
1328
|
-
}, []),
|
|
1329
|
-
|
|
1330
|
-
var
|
|
1331
|
-
c ? ((
|
|
1332
|
-
}, [c]),
|
|
1333
|
-
var
|
|
1334
|
-
N ? (
|
|
1335
|
-
}, [N]),
|
|
1336
|
-
if (!
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1326
|
+
const { translations: g } = ee(), [Q, W] = j(!1), [N, C] = j(!1), [D, H] = j(o || ""), [P, T] = j(!1), [O, x] = j(!1), [M, V] = j(!1), [Z, ce] = j(!1), J = $(null), de = q((f) => {
|
|
1327
|
+
J.current = f;
|
|
1328
|
+
}, []), Y = $(null), te = $(null), U = $(!1), w = $(null), I = $(null), F = $(!1);
|
|
1329
|
+
z(() => {
|
|
1330
|
+
var f, L;
|
|
1331
|
+
c ? ((f = J.current) == null || f.scrollIntoView({ behavior: "smooth", block: "nearest" }), (L = J.current) == null || L.focus()) : T(!1);
|
|
1332
|
+
}, [c]), z(() => {
|
|
1333
|
+
var f, L;
|
|
1334
|
+
N ? (U.current = !0, (f = Y.current) == null || f.focus()) : U.current && (U.current = !1, (L = te.current) == null || L.focus());
|
|
1335
|
+
}, [N]), z(() => {
|
|
1336
|
+
if (!P && F.current) {
|
|
1337
|
+
F.current = !1;
|
|
1338
|
+
const f = w.current;
|
|
1339
|
+
f != null && f.isConnected && f.focus();
|
|
1340
1340
|
}
|
|
1341
|
-
}, [
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1341
|
+
}, [P]);
|
|
1342
|
+
const A = q((f, L) => {
|
|
1343
|
+
F.current = !L, T(!1);
|
|
1344
1344
|
}, []);
|
|
1345
|
-
|
|
1346
|
-
if (!
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
-
},
|
|
1350
|
-
|
|
1345
|
+
z(() => {
|
|
1346
|
+
if (!P) return;
|
|
1347
|
+
const f = (ie) => {
|
|
1348
|
+
ie.key === "Escape" && ie.stopPropagation();
|
|
1349
|
+
}, L = (ie) => {
|
|
1350
|
+
ie.key === "Escape" && (ie.stopPropagation(), A());
|
|
1351
1351
|
};
|
|
1352
|
-
return window.addEventListener("keydown",
|
|
1353
|
-
window.removeEventListener("keydown",
|
|
1352
|
+
return window.addEventListener("keydown", f, !0), window.addEventListener("keyup", L, !0), () => {
|
|
1353
|
+
window.removeEventListener("keydown", f, !0), window.removeEventListener("keyup", L, !0);
|
|
1354
1354
|
};
|
|
1355
|
-
}, [
|
|
1356
|
-
const G = r ===
|
|
1357
|
-
|
|
1358
|
-
},
|
|
1359
|
-
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1355
|
+
}, [P, A]);
|
|
1356
|
+
const G = r === R.IMPORTANT ? g.important : g.unclear, _ = (f) => {
|
|
1357
|
+
f.key === "Enter" && (f.preventDefault(), i == null || i());
|
|
1358
|
+
}, v = [g.note, G];
|
|
1359
|
+
v.push(n || g.highlightUnavailable), o && v.push(o), e && v.push(ze(e, h)), d && v.push(d);
|
|
1360
|
+
const B = v.join(", "), ne = /* @__PURE__ */ S(
|
|
1361
|
+
X,
|
|
1362
1362
|
{
|
|
1363
1363
|
as: "div",
|
|
1364
1364
|
height: "100%",
|
|
@@ -1367,15 +1367,15 @@ const Qn = ({
|
|
|
1367
1367
|
padding: "small",
|
|
1368
1368
|
position: "relative",
|
|
1369
1369
|
role: E ? void 0 : c || N ? "group" : "button",
|
|
1370
|
-
"aria-label": E ? void 0 :
|
|
1370
|
+
"aria-label": E ? void 0 : B,
|
|
1371
1371
|
"aria-pressed": E || c || N ? void 0 : c,
|
|
1372
1372
|
tabIndex: E || c ? -1 : 0,
|
|
1373
1373
|
"data-testid": `note-card-${t}`,
|
|
1374
|
-
elementRef:
|
|
1374
|
+
elementRef: de,
|
|
1375
1375
|
onClick: c ? void 0 : i,
|
|
1376
|
-
onMouseEnter: () =>
|
|
1377
|
-
onMouseLeave: () =>
|
|
1378
|
-
onKeyDown: c ? void 0 :
|
|
1376
|
+
onMouseEnter: () => W(!0),
|
|
1377
|
+
onMouseLeave: () => W(!1),
|
|
1378
|
+
onKeyDown: c ? void 0 : _,
|
|
1379
1379
|
cursor: N ? "default" : "pointer",
|
|
1380
1380
|
children: [
|
|
1381
1381
|
/* @__PURE__ */ s(
|
|
@@ -1384,83 +1384,83 @@ const Qn = ({
|
|
|
1384
1384
|
"data-testid": `note-card-${t}-content`,
|
|
1385
1385
|
style: {
|
|
1386
1386
|
height: "100%",
|
|
1387
|
-
opacity: c &&
|
|
1387
|
+
opacity: c && P && l ? 0.25 : void 0
|
|
1388
1388
|
},
|
|
1389
|
-
children: /* @__PURE__ */
|
|
1389
|
+
children: /* @__PURE__ */ S(k, { direction: "column", gap: "small", height: "100%", children: [
|
|
1390
1390
|
/* @__PURE__ */ s(
|
|
1391
1391
|
ft,
|
|
1392
1392
|
{
|
|
1393
1393
|
type: r,
|
|
1394
|
-
onTypeChange: y && m ? (
|
|
1394
|
+
onTypeChange: y && m ? (f) => m(t, f) : void 0,
|
|
1395
1395
|
renderAsMenuTrigger: y && !!m && !!c
|
|
1396
1396
|
}
|
|
1397
1397
|
),
|
|
1398
|
-
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(
|
|
1399
|
-
|
|
1398
|
+
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(oe, { children: c && y ? /* @__PURE__ */ s(
|
|
1399
|
+
Re,
|
|
1400
1400
|
{
|
|
1401
1401
|
type: r,
|
|
1402
|
-
isCardActive: !!c ||
|
|
1402
|
+
isCardActive: !!c || Q,
|
|
1403
1403
|
theme: b,
|
|
1404
1404
|
children: n
|
|
1405
1405
|
}
|
|
1406
|
-
) : /* @__PURE__ */
|
|
1407
|
-
|
|
1408
|
-
/* @__PURE__ */ s("span", { "aria-hidden":
|
|
1409
|
-
|
|
1406
|
+
) : /* @__PURE__ */ S(qe, { children: [
|
|
1407
|
+
O && /* @__PURE__ */ s(pe, { children: n }),
|
|
1408
|
+
/* @__PURE__ */ s("span", { "aria-hidden": O, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: x, children: /* @__PURE__ */ s(
|
|
1409
|
+
Re,
|
|
1410
1410
|
{
|
|
1411
1411
|
type: r,
|
|
1412
|
-
isCardActive: !!c ||
|
|
1412
|
+
isCardActive: !!c || Q,
|
|
1413
1413
|
theme: b,
|
|
1414
1414
|
children: n
|
|
1415
1415
|
}
|
|
1416
1416
|
) }) })
|
|
1417
1417
|
] }) }) }) : /* @__PURE__ */ s(ut, {}),
|
|
1418
|
-
/* @__PURE__ */ s(
|
|
1419
|
-
N && y ? /* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ S(k, { direction: "column", gap: "small", height: "100%", children: [
|
|
1419
|
+
N && y ? /* @__PURE__ */ S(k, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1420
1420
|
/* @__PURE__ */ s(
|
|
1421
1421
|
Ye,
|
|
1422
1422
|
{
|
|
1423
|
-
label: /* @__PURE__ */ s(
|
|
1424
|
-
value:
|
|
1425
|
-
onChange: (
|
|
1423
|
+
label: /* @__PURE__ */ s(pe, { children: g.editNote }),
|
|
1424
|
+
value: D,
|
|
1425
|
+
onChange: (f) => H(f.target.value),
|
|
1426
1426
|
placeholder: g.addNoteOptional,
|
|
1427
|
-
textareaRef: (
|
|
1428
|
-
|
|
1427
|
+
textareaRef: (f) => {
|
|
1428
|
+
Y.current = f;
|
|
1429
1429
|
}
|
|
1430
1430
|
}
|
|
1431
1431
|
),
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */ s(
|
|
1434
|
-
|
|
1432
|
+
/* @__PURE__ */ S(k, { gap: "xx-small", children: [
|
|
1433
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1434
|
+
re,
|
|
1435
1435
|
{
|
|
1436
1436
|
display: "block",
|
|
1437
1437
|
size: "small",
|
|
1438
1438
|
"data-testid": `note-card-${t}-cancel`,
|
|
1439
1439
|
onClick: () => {
|
|
1440
|
-
|
|
1440
|
+
H(o || ""), C(!1);
|
|
1441
1441
|
},
|
|
1442
1442
|
children: g.cancel
|
|
1443
1443
|
}
|
|
1444
1444
|
) }),
|
|
1445
|
-
/* @__PURE__ */ s(
|
|
1446
|
-
|
|
1445
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1446
|
+
re,
|
|
1447
1447
|
{
|
|
1448
1448
|
display: "block",
|
|
1449
1449
|
color: "primary",
|
|
1450
1450
|
size: "small",
|
|
1451
1451
|
"data-testid": `note-card-${t}-save`,
|
|
1452
1452
|
onClick: () => {
|
|
1453
|
-
a == null || a(t,
|
|
1453
|
+
a == null || a(t, D.trim()), C(!1);
|
|
1454
1454
|
},
|
|
1455
1455
|
children: g.save
|
|
1456
1456
|
}
|
|
1457
1457
|
) })
|
|
1458
1458
|
] })
|
|
1459
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && y ? /* @__PURE__ */
|
|
1459
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && y ? /* @__PURE__ */ S(oe, { children: [
|
|
1460
1460
|
o,
|
|
1461
1461
|
" ",
|
|
1462
1462
|
/* @__PURE__ */ s(
|
|
1463
|
-
|
|
1463
|
+
me,
|
|
1464
1464
|
{
|
|
1465
1465
|
size: "small",
|
|
1466
1466
|
withBackground: !1,
|
|
@@ -1468,23 +1468,23 @@ const Qn = ({
|
|
|
1468
1468
|
margin: "xx-small 0 0 xxx-small",
|
|
1469
1469
|
screenReaderLabel: g.editNote,
|
|
1470
1470
|
"data-testid": `note-card-${t}-edit`,
|
|
1471
|
-
elementRef: (
|
|
1472
|
-
|
|
1471
|
+
elementRef: (f) => {
|
|
1472
|
+
te.current = f;
|
|
1473
1473
|
},
|
|
1474
|
-
onClick: (
|
|
1475
|
-
|
|
1474
|
+
onClick: (f) => {
|
|
1475
|
+
f.stopPropagation(), C(!0);
|
|
1476
1476
|
},
|
|
1477
|
-
children: /* @__PURE__ */ s(
|
|
1477
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
1478
1478
|
}
|
|
1479
1479
|
)
|
|
1480
|
-
] }) : /* @__PURE__ */
|
|
1481
|
-
|
|
1482
|
-
/* @__PURE__ */ s("span", { "aria-hidden":
|
|
1483
|
-
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */
|
|
1480
|
+
] }) : /* @__PURE__ */ S(oe, { children: [
|
|
1481
|
+
M && /* @__PURE__ */ s(pe, { children: o }),
|
|
1482
|
+
/* @__PURE__ */ s("span", { "aria-hidden": M, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: V, children: o }) })
|
|
1483
|
+
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ S(oe, { color: "secondary", children: [
|
|
1484
1484
|
g.addNotePrompt,
|
|
1485
1485
|
" ",
|
|
1486
1486
|
/* @__PURE__ */ s(
|
|
1487
|
-
|
|
1487
|
+
me,
|
|
1488
1488
|
{
|
|
1489
1489
|
size: "small",
|
|
1490
1490
|
withBackground: !1,
|
|
@@ -1492,20 +1492,20 @@ const Qn = ({
|
|
|
1492
1492
|
margin: "xx-small 0 0 xxx-small",
|
|
1493
1493
|
screenReaderLabel: g.editNote,
|
|
1494
1494
|
"data-testid": `note-card-${t}-edit`,
|
|
1495
|
-
elementRef: (
|
|
1496
|
-
|
|
1495
|
+
elementRef: (f) => {
|
|
1496
|
+
te.current = f;
|
|
1497
1497
|
},
|
|
1498
|
-
onClick: (
|
|
1499
|
-
|
|
1498
|
+
onClick: (f) => {
|
|
1499
|
+
f.stopPropagation(), C(!0);
|
|
1500
1500
|
},
|
|
1501
|
-
children: /* @__PURE__ */ s(
|
|
1501
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
1502
1502
|
}
|
|
1503
1503
|
)
|
|
1504
1504
|
] }) }) : null,
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */ s(
|
|
1505
|
+
/* @__PURE__ */ S(k, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1506
|
+
/* @__PURE__ */ s(oe, { as: "div", size: "small", color: "secondary", children: ze(e, h) }),
|
|
1507
1507
|
c && l && /* @__PURE__ */ s(
|
|
1508
|
-
|
|
1508
|
+
me,
|
|
1509
1509
|
{
|
|
1510
1510
|
size: "small",
|
|
1511
1511
|
withBackground: !1,
|
|
@@ -1514,31 +1514,34 @@ const Qn = ({
|
|
|
1514
1514
|
margin: "xx-small",
|
|
1515
1515
|
screenReaderLabel: g.deleteNote,
|
|
1516
1516
|
"data-testid": `note-card-${t}-delete`,
|
|
1517
|
-
elementRef: (
|
|
1518
|
-
|
|
1517
|
+
elementRef: (f) => {
|
|
1518
|
+
w.current = f;
|
|
1519
1519
|
},
|
|
1520
|
-
onClick: (
|
|
1521
|
-
|
|
1520
|
+
onClick: (f) => {
|
|
1521
|
+
f.stopPropagation(), F.current = !1, T(!0);
|
|
1522
1522
|
},
|
|
1523
|
-
children: /* @__PURE__ */ s(
|
|
1523
|
+
children: /* @__PURE__ */ s(Te, {})
|
|
1524
1524
|
}
|
|
1525
1525
|
)
|
|
1526
1526
|
] }),
|
|
1527
|
-
d && /* @__PURE__ */
|
|
1528
|
-
|
|
1527
|
+
d && /* @__PURE__ */ S(
|
|
1528
|
+
oe,
|
|
1529
1529
|
{
|
|
1530
1530
|
as: "div",
|
|
1531
1531
|
size: "small",
|
|
1532
1532
|
color: "secondary",
|
|
1533
1533
|
"data-testid": `note-card-${t}-course`,
|
|
1534
|
-
children:
|
|
1534
|
+
children: [
|
|
1535
|
+
Z && /* @__PURE__ */ s(pe, { children: d }),
|
|
1536
|
+
/* @__PURE__ */ s("span", { "aria-hidden": Z, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 1, onUpdate: ce, children: d }) })
|
|
1537
|
+
]
|
|
1535
1538
|
}
|
|
1536
1539
|
)
|
|
1537
1540
|
] }) })
|
|
1538
1541
|
] })
|
|
1539
1542
|
}
|
|
1540
1543
|
),
|
|
1541
|
-
c &&
|
|
1544
|
+
c && P && l && /* @__PURE__ */ s(
|
|
1542
1545
|
Tt,
|
|
1543
1546
|
{
|
|
1544
1547
|
open: !0,
|
|
@@ -1546,13 +1549,13 @@ const Qn = ({
|
|
|
1546
1549
|
label: g.deleteNoteConfirmation,
|
|
1547
1550
|
shouldContainFocus: !0,
|
|
1548
1551
|
shouldFocusOnOpen: !0,
|
|
1549
|
-
defaultFocusElement: () =>
|
|
1552
|
+
defaultFocusElement: () => I.current,
|
|
1550
1553
|
shouldCloseOnDocumentClick: !0,
|
|
1551
1554
|
shouldCloseOnEscape: !1,
|
|
1552
1555
|
shouldReturnFocus: !1,
|
|
1553
|
-
onDismiss:
|
|
1556
|
+
onDismiss: A,
|
|
1554
1557
|
children: /* @__PURE__ */ s(
|
|
1555
|
-
|
|
1558
|
+
X,
|
|
1556
1559
|
{
|
|
1557
1560
|
as: "div",
|
|
1558
1561
|
padding: "medium",
|
|
@@ -1562,8 +1565,8 @@ const Qn = ({
|
|
|
1562
1565
|
insetInlineStart: "0",
|
|
1563
1566
|
insetInlineEnd: "0",
|
|
1564
1567
|
stacking: "above",
|
|
1565
|
-
children: /* @__PURE__ */
|
|
1566
|
-
|
|
1568
|
+
children: /* @__PURE__ */ S(
|
|
1569
|
+
k,
|
|
1567
1570
|
{
|
|
1568
1571
|
direction: "column",
|
|
1569
1572
|
justifyItems: "center",
|
|
@@ -1572,45 +1575,45 @@ const Qn = ({
|
|
|
1572
1575
|
height: "100%",
|
|
1573
1576
|
children: [
|
|
1574
1577
|
/* @__PURE__ */ s(
|
|
1575
|
-
|
|
1578
|
+
re,
|
|
1576
1579
|
{
|
|
1577
1580
|
display: "block",
|
|
1578
1581
|
color: "danger",
|
|
1579
1582
|
withBackground: !1,
|
|
1580
|
-
themeOverride: (
|
|
1583
|
+
themeOverride: (f, L) => ({
|
|
1581
1584
|
borderRadius: We,
|
|
1582
1585
|
// Ghost states default to translucent fills; the faded card would show through.
|
|
1583
|
-
dangerGhostBackground:
|
|
1584
|
-
dangerGhostHoverBackground:
|
|
1585
|
-
dangerGhostActiveBackground:
|
|
1586
|
+
dangerGhostBackground: L.colors.contrasts.white1010,
|
|
1587
|
+
dangerGhostHoverBackground: L.colors.contrasts.red1212,
|
|
1588
|
+
dangerGhostActiveBackground: L.colors.contrasts.red1212,
|
|
1586
1589
|
// red45 on the hover tint is 3.74:1; red57 clears AA in every state.
|
|
1587
|
-
dangerGhostColor:
|
|
1588
|
-
dangerGhostBorderColor:
|
|
1590
|
+
dangerGhostColor: L.colors.contrasts.red5782,
|
|
1591
|
+
dangerGhostBorderColor: L.colors.contrasts.red5782
|
|
1589
1592
|
}),
|
|
1590
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1593
|
+
renderIcon: /* @__PURE__ */ s(Te, {}),
|
|
1591
1594
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1592
|
-
onClick: (
|
|
1593
|
-
|
|
1595
|
+
onClick: (f) => {
|
|
1596
|
+
f.stopPropagation(), l(t), T(!1);
|
|
1594
1597
|
},
|
|
1595
1598
|
children: g.deleteNote
|
|
1596
1599
|
}
|
|
1597
1600
|
),
|
|
1598
1601
|
/* @__PURE__ */ s(
|
|
1599
|
-
|
|
1602
|
+
re,
|
|
1600
1603
|
{
|
|
1601
1604
|
display: "block",
|
|
1602
1605
|
withBackground: !1,
|
|
1603
|
-
themeOverride: (
|
|
1606
|
+
themeOverride: (f, L) => ({
|
|
1604
1607
|
borderRadius: We,
|
|
1605
|
-
secondaryGhostBackground:
|
|
1606
|
-
secondaryGhostActiveBackground:
|
|
1608
|
+
secondaryGhostBackground: L.colors.contrasts.white1010,
|
|
1609
|
+
secondaryGhostActiveBackground: L.colors.contrasts.grey1111
|
|
1607
1610
|
}),
|
|
1608
1611
|
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1609
|
-
elementRef: (
|
|
1610
|
-
|
|
1612
|
+
elementRef: (f) => {
|
|
1613
|
+
I.current = f;
|
|
1611
1614
|
},
|
|
1612
|
-
onClick: (
|
|
1613
|
-
|
|
1615
|
+
onClick: (f) => {
|
|
1616
|
+
f.stopPropagation(), A();
|
|
1614
1617
|
},
|
|
1615
1618
|
children: g.cancel
|
|
1616
1619
|
}
|
|
@@ -1625,7 +1628,7 @@ const Qn = ({
|
|
|
1625
1628
|
]
|
|
1626
1629
|
}
|
|
1627
1630
|
);
|
|
1628
|
-
return E && p ? p({ href: E, children:
|
|
1631
|
+
return E && p ? p({ href: E, children: ne, ariaLabel: B }) : ne;
|
|
1629
1632
|
}, Yn = {
|
|
1630
1633
|
display: "grid",
|
|
1631
1634
|
gap: "1rem",
|
|
@@ -1652,71 +1655,71 @@ const Qn = ({
|
|
|
1652
1655
|
highlightTheme: p,
|
|
1653
1656
|
locale: E,
|
|
1654
1657
|
courseNames: g,
|
|
1655
|
-
renderNoteLink:
|
|
1656
|
-
noteHref:
|
|
1658
|
+
renderNoteLink: Q,
|
|
1659
|
+
noteHref: W
|
|
1657
1660
|
}) => {
|
|
1658
|
-
const { translations: N } =
|
|
1661
|
+
const { translations: N } = ee(), C = $(null), D = $(null), H = q(
|
|
1659
1662
|
(T) => {
|
|
1660
|
-
const
|
|
1661
|
-
let
|
|
1662
|
-
t.length > 1 && (
|
|
1663
|
+
const O = t.findIndex((M) => M.id === T);
|
|
1664
|
+
let x = null;
|
|
1665
|
+
t.length > 1 && (x = O > 0 ? t[O - 1].id : t[1].id), D.current = { targetId: x }, a == null || a(T);
|
|
1663
1666
|
},
|
|
1664
1667
|
[t, a]
|
|
1665
1668
|
);
|
|
1666
|
-
if (
|
|
1667
|
-
var
|
|
1668
|
-
const T =
|
|
1669
|
+
if (z(() => {
|
|
1670
|
+
var O;
|
|
1671
|
+
const T = D.current;
|
|
1669
1672
|
if (T)
|
|
1670
|
-
if (
|
|
1673
|
+
if (D.current = null, T.targetId === null)
|
|
1671
1674
|
y == null || y();
|
|
1672
1675
|
else {
|
|
1673
|
-
const
|
|
1676
|
+
const x = (O = C.current) == null ? void 0 : O.querySelector(
|
|
1674
1677
|
`[data-testid="note-card-${T.targetId}"]`
|
|
1675
1678
|
);
|
|
1676
|
-
|
|
1679
|
+
x == null || x.focus();
|
|
1677
1680
|
}
|
|
1678
1681
|
}, [t, y]), e)
|
|
1679
|
-
return /* @__PURE__ */ s(
|
|
1682
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(vt, { renderTitle: N.loadingNotes }) });
|
|
1680
1683
|
if (n)
|
|
1681
|
-
return /* @__PURE__ */ s(
|
|
1684
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Se, { level: "h4", children: N.failedToLoadNotes }) });
|
|
1682
1685
|
if (t.length === 0)
|
|
1683
|
-
return /* @__PURE__ */ s(
|
|
1684
|
-
const
|
|
1685
|
-
return /* @__PURE__ */
|
|
1686
|
+
return /* @__PURE__ */ s(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(Kn, { hasActiveFilter: h }) });
|
|
1687
|
+
const P = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
|
|
1688
|
+
return /* @__PURE__ */ S(qe, { children: [
|
|
1686
1689
|
/* @__PURE__ */ s(
|
|
1687
1690
|
"ul",
|
|
1688
1691
|
{
|
|
1689
|
-
ref:
|
|
1692
|
+
ref: C,
|
|
1690
1693
|
style: { ...Yn, gridTemplateColumns: `repeat(${b}, minmax(0, 1fr))` },
|
|
1691
1694
|
role: "list",
|
|
1692
1695
|
"data-testid": "notes-grid",
|
|
1693
1696
|
children: t.map((T) => {
|
|
1694
|
-
var
|
|
1697
|
+
var O;
|
|
1695
1698
|
return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
|
|
1696
1699
|
Qn,
|
|
1697
1700
|
{
|
|
1698
1701
|
noteId: T.id,
|
|
1699
1702
|
date: T.createdAt,
|
|
1700
|
-
type: T.reaction[0] ??
|
|
1701
|
-
highlight: (
|
|
1703
|
+
type: T.reaction[0] ?? R.IMPORTANT,
|
|
1704
|
+
highlight: (O = T.highlightData) == null ? void 0 : O.selectedText,
|
|
1702
1705
|
note: T.userText,
|
|
1703
1706
|
isActive: d === T.id,
|
|
1704
1707
|
isPanelView: !!d,
|
|
1705
1708
|
onClick: l ? () => l(T.id) : void 0,
|
|
1706
|
-
onDelete: a ?
|
|
1707
|
-
onSaveNote: m ? (
|
|
1708
|
-
onTypeChange: c ? (
|
|
1709
|
+
onDelete: a ? H : void 0,
|
|
1710
|
+
onSaveNote: m ? (x, M) => m(x, M) : void 0,
|
|
1711
|
+
onTypeChange: c ? (x, M) => c(x, M) : void 0,
|
|
1709
1712
|
highlightTheme: p,
|
|
1710
1713
|
locale: E,
|
|
1711
1714
|
courseName: g == null ? void 0 : g.get(T.courseId),
|
|
1712
|
-
renderLink:
|
|
1713
|
-
href:
|
|
1715
|
+
renderLink: Q,
|
|
1716
|
+
href: W ? W(T.id, T) : void 0
|
|
1714
1717
|
}
|
|
1715
1718
|
) }, T.id);
|
|
1716
1719
|
})
|
|
1717
1720
|
}
|
|
1718
1721
|
),
|
|
1719
|
-
|
|
1722
|
+
P && /* @__PURE__ */ s(k, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(k.Item, { children: /* @__PURE__ */ s(
|
|
1720
1723
|
St,
|
|
1721
1724
|
{
|
|
1722
1725
|
as: "nav",
|
|
@@ -1740,11 +1743,11 @@ const Qn = ({
|
|
|
1740
1743
|
onBack: a,
|
|
1741
1744
|
editing: m = !1
|
|
1742
1745
|
}) => {
|
|
1743
|
-
const { translations: c } =
|
|
1744
|
-
return /* @__PURE__ */
|
|
1745
|
-
n != null ? /* @__PURE__ */ s(
|
|
1746
|
+
const { translations: c } = ee(), [y, d] = j(m), [h, b] = j(t || ""), [p, E] = j(!1);
|
|
1747
|
+
return /* @__PURE__ */ S(k, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1748
|
+
n != null ? /* @__PURE__ */ s(X, { as: "div", children: /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(Re, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(ut, {}),
|
|
1746
1749
|
/* @__PURE__ */ s(ft, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1747
|
-
y ? /* @__PURE__ */
|
|
1750
|
+
y ? /* @__PURE__ */ S(k, { direction: "column", gap: "x-small", children: [
|
|
1748
1751
|
/* @__PURE__ */ s(
|
|
1749
1752
|
Ye,
|
|
1750
1753
|
{
|
|
@@ -1754,9 +1757,9 @@ const Qn = ({
|
|
|
1754
1757
|
resize: "vertical"
|
|
1755
1758
|
}
|
|
1756
1759
|
),
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */ s(
|
|
1759
|
-
|
|
1760
|
+
/* @__PURE__ */ S(k, { gap: "xx-small", children: [
|
|
1761
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1762
|
+
re,
|
|
1760
1763
|
{
|
|
1761
1764
|
display: "block",
|
|
1762
1765
|
size: "small",
|
|
@@ -1767,8 +1770,8 @@ const Qn = ({
|
|
|
1767
1770
|
children: c.cancel
|
|
1768
1771
|
}
|
|
1769
1772
|
) }),
|
|
1770
|
-
/* @__PURE__ */ s(
|
|
1771
|
-
|
|
1773
|
+
/* @__PURE__ */ s(k.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1774
|
+
re,
|
|
1772
1775
|
{
|
|
1773
1776
|
display: "block",
|
|
1774
1777
|
color: "primary",
|
|
@@ -1781,14 +1784,14 @@ const Qn = ({
|
|
|
1781
1784
|
}
|
|
1782
1785
|
) })
|
|
1783
1786
|
] })
|
|
1784
|
-
] }) : /* @__PURE__ */
|
|
1785
|
-
t && /* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */ s(
|
|
1787
|
-
/* @__PURE__ */ s(
|
|
1787
|
+
] }) : /* @__PURE__ */ S(k, { direction: "column", gap: "small", children: [
|
|
1788
|
+
t && /* @__PURE__ */ S(X, { as: "div", children: [
|
|
1789
|
+
/* @__PURE__ */ s(Se, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1790
|
+
/* @__PURE__ */ s(oe, { children: t })
|
|
1788
1791
|
] }),
|
|
1789
|
-
/* @__PURE__ */
|
|
1792
|
+
/* @__PURE__ */ S(k, { justifyItems: "space-between", children: [
|
|
1790
1793
|
/* @__PURE__ */ s(
|
|
1791
|
-
|
|
1794
|
+
re,
|
|
1792
1795
|
{
|
|
1793
1796
|
size: "small",
|
|
1794
1797
|
renderIcon: /* @__PURE__ */ s(Et, {}),
|
|
@@ -1797,9 +1800,9 @@ const Qn = ({
|
|
|
1797
1800
|
children: c.back
|
|
1798
1801
|
}
|
|
1799
1802
|
),
|
|
1800
|
-
/* @__PURE__ */
|
|
1803
|
+
/* @__PURE__ */ S(k, { gap: "xx-small", children: [
|
|
1801
1804
|
i && /* @__PURE__ */ s(
|
|
1802
|
-
|
|
1805
|
+
me,
|
|
1803
1806
|
{
|
|
1804
1807
|
size: "small",
|
|
1805
1808
|
withBackground: !1,
|
|
@@ -1808,11 +1811,11 @@ const Qn = ({
|
|
|
1808
1811
|
screenReaderLabel: c.deleteNote,
|
|
1809
1812
|
"data-testid": "single-note-delete",
|
|
1810
1813
|
onClick: () => E(!0),
|
|
1811
|
-
children: /* @__PURE__ */ s(
|
|
1814
|
+
children: /* @__PURE__ */ s(Te, {})
|
|
1812
1815
|
}
|
|
1813
1816
|
),
|
|
1814
1817
|
/* @__PURE__ */ s(
|
|
1815
|
-
|
|
1818
|
+
me,
|
|
1816
1819
|
{
|
|
1817
1820
|
size: "small",
|
|
1818
1821
|
withBackground: !1,
|
|
@@ -1820,19 +1823,19 @@ const Qn = ({
|
|
|
1820
1823
|
screenReaderLabel: c.editNote,
|
|
1821
1824
|
"data-testid": "single-note-edit",
|
|
1822
1825
|
onClick: () => d(!0),
|
|
1823
|
-
children: /* @__PURE__ */ s(
|
|
1826
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
1824
1827
|
}
|
|
1825
1828
|
)
|
|
1826
1829
|
] })
|
|
1827
1830
|
] }),
|
|
1828
|
-
p && i && /* @__PURE__ */ s(
|
|
1831
|
+
p && i && /* @__PURE__ */ s(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(k, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1829
1832
|
/* @__PURE__ */ s(
|
|
1830
|
-
|
|
1833
|
+
re,
|
|
1831
1834
|
{
|
|
1832
1835
|
display: "block",
|
|
1833
1836
|
color: "danger",
|
|
1834
1837
|
size: "small",
|
|
1835
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1838
|
+
renderIcon: /* @__PURE__ */ s(Te, {}),
|
|
1836
1839
|
"data-testid": "single-note-confirm-delete",
|
|
1837
1840
|
onClick: () => {
|
|
1838
1841
|
i(), E(!1);
|
|
@@ -1841,7 +1844,7 @@ const Qn = ({
|
|
|
1841
1844
|
}
|
|
1842
1845
|
),
|
|
1843
1846
|
/* @__PURE__ */ s(
|
|
1844
|
-
|
|
1847
|
+
re,
|
|
1845
1848
|
{
|
|
1846
1849
|
display: "block",
|
|
1847
1850
|
size: "small",
|
|
@@ -1856,7 +1859,7 @@ const Qn = ({
|
|
|
1856
1859
|
};
|
|
1857
1860
|
export {
|
|
1858
1861
|
So as ContentWithNoteWrapper,
|
|
1859
|
-
|
|
1862
|
+
Re as Highlight,
|
|
1860
1863
|
ut as HighlightError,
|
|
1861
1864
|
Qn as NoteCard,
|
|
1862
1865
|
ft as NoteChip,
|
|
@@ -1866,14 +1869,14 @@ export {
|
|
|
1866
1869
|
Hn as NotebookTranslationsProvider,
|
|
1867
1870
|
To as NotebookTray,
|
|
1868
1871
|
Co as NotesListView,
|
|
1869
|
-
|
|
1872
|
+
R as REACTION_TYPE,
|
|
1870
1873
|
xo as SingleNote,
|
|
1871
|
-
|
|
1874
|
+
Fe as createTransparentColor,
|
|
1872
1875
|
Vt as useCreateNote,
|
|
1873
1876
|
Zt as useDeleteNote,
|
|
1874
1877
|
rt as useGetNotes,
|
|
1875
1878
|
ct as useNotebook,
|
|
1876
|
-
|
|
1879
|
+
ee as useNotebookTranslations,
|
|
1877
1880
|
vo as useNotesData,
|
|
1878
1881
|
Io as useReactionFilter,
|
|
1879
1882
|
en as useUpdateNote
|