@instructure/platform-notebook 0.9.1 → 0.10.0
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/index.js
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as
|
|
1
|
+
import { jsx as s, jsxs as v, Fragment as Ye } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as Y, useEffect as Q, useState as W, useCallback as K } from "react";
|
|
3
3
|
import { createPortal as Ze } from "react-dom";
|
|
4
|
-
import { z as
|
|
4
|
+
import { z as c } from "zod";
|
|
5
5
|
import Je from "diff-match-patch";
|
|
6
6
|
import { useQueryClient as ge, useMutation as pe, useQuery as et } from "@tanstack/react-query";
|
|
7
7
|
import { IconQuestionLine as Ne, IconPinLine as be, IconWarningLine as tt, IconNoteLine as nt, IconEditLine as fe, IconTrashLine as le, IconArrowOpenStartLine as ot, IconArrowOpenEndLine as rt, IconArrowStartLine as st } from "@instructure/ui-icons";
|
|
8
|
-
import { Menu as
|
|
9
|
-
import {
|
|
8
|
+
import { Menu as te } from "@instructure/ui-menu";
|
|
9
|
+
import { View as z } from "@instructure/ui-view";
|
|
10
|
+
import { Flex as C } from "@instructure/ui-flex";
|
|
10
11
|
import { TruncateText as me } from "@instructure/ui-truncate-text";
|
|
11
12
|
import { ScreenReaderContent as Me } from "@instructure/ui-a11y-content";
|
|
12
13
|
import { SimpleSelect as we } from "@instructure/ui-simple-select";
|
|
13
14
|
import { Heading as ae } from "@instructure/ui-heading";
|
|
14
15
|
import { Text as U } from "@instructure/ui-text";
|
|
15
|
-
import { View as z } from "@instructure/ui-view";
|
|
16
16
|
import { CloseButton as it, Button as $, IconButton as V } from "@instructure/ui-buttons";
|
|
17
17
|
import { Tray as lt } from "@instructure/ui-tray";
|
|
18
18
|
import { TextArea as He } from "@instructure/ui-text-area";
|
|
19
19
|
import { Pill as ke } from "@instructure/ui-pill";
|
|
20
20
|
import { Spinner as at } from "@instructure/ui-spinner";
|
|
21
|
-
const ct =
|
|
22
|
-
startContainer:
|
|
23
|
-
endContainer:
|
|
24
|
-
startOffset:
|
|
25
|
-
endOffset:
|
|
26
|
-
}), dt =
|
|
27
|
-
start:
|
|
28
|
-
end:
|
|
29
|
-
}), ye =
|
|
30
|
-
selectedText:
|
|
31
|
-
hasNoHighlightAnymore:
|
|
21
|
+
const ct = c.object({
|
|
22
|
+
startContainer: c.string(),
|
|
23
|
+
endContainer: c.string(),
|
|
24
|
+
startOffset: c.number(),
|
|
25
|
+
endOffset: c.number()
|
|
26
|
+
}), dt = c.object({
|
|
27
|
+
start: c.number(),
|
|
28
|
+
end: c.number()
|
|
29
|
+
}), ye = c.object({
|
|
30
|
+
selectedText: c.string(),
|
|
31
|
+
hasNoHighlightAnymore: c.boolean().optional(),
|
|
32
32
|
textPosition: dt.nullable(),
|
|
33
33
|
range: ct.nullable(),
|
|
34
|
-
pageLastModifiedAt:
|
|
34
|
+
pageLastModifiedAt: c.string()
|
|
35
35
|
});
|
|
36
36
|
var w = /* @__PURE__ */ ((n) => (n.IMPORTANT = "Important", n.CONFUSING = "Confusing", n))(w || {});
|
|
37
|
-
const Ee =
|
|
37
|
+
const Ee = c.enum([
|
|
38
38
|
"Important",
|
|
39
39
|
"Confusing"
|
|
40
40
|
/* CONFUSING */
|
|
41
|
-
]),
|
|
42
|
-
startCursor:
|
|
43
|
-
endCursor:
|
|
44
|
-
hasNextPage:
|
|
45
|
-
hasPreviousPage:
|
|
46
|
-
}), ce =
|
|
47
|
-
id:
|
|
48
|
-
rootAccountUuid:
|
|
49
|
-
userId:
|
|
50
|
-
courseId:
|
|
51
|
-
objectId:
|
|
52
|
-
objectType:
|
|
53
|
-
userText:
|
|
54
|
-
reaction:
|
|
41
|
+
]), We = c.object({
|
|
42
|
+
startCursor: c.string().nullish(),
|
|
43
|
+
endCursor: c.string().nullish(),
|
|
44
|
+
hasNextPage: c.boolean().nullish(),
|
|
45
|
+
hasPreviousPage: c.boolean().nullish()
|
|
46
|
+
}), ce = c.object({
|
|
47
|
+
id: c.string(),
|
|
48
|
+
rootAccountUuid: c.string(),
|
|
49
|
+
userId: c.string(),
|
|
50
|
+
courseId: c.string(),
|
|
51
|
+
objectId: c.string(),
|
|
52
|
+
objectType: c.string(),
|
|
53
|
+
userText: c.string().optional(),
|
|
54
|
+
reaction: c.array(Ee),
|
|
55
55
|
highlightData: ye,
|
|
56
|
-
createdAt:
|
|
57
|
-
updatedAt:
|
|
58
|
-
}), ut =
|
|
59
|
-
cursor:
|
|
56
|
+
createdAt: c.string(),
|
|
57
|
+
updatedAt: c.string()
|
|
58
|
+
}), ut = c.object({
|
|
59
|
+
cursor: c.string(),
|
|
60
60
|
node: ce
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
notes:
|
|
64
|
-
edges:
|
|
65
|
-
nodes:
|
|
66
|
-
pageInfo:
|
|
62
|
+
c.object({
|
|
63
|
+
notes: c.object({
|
|
64
|
+
edges: c.array(ut),
|
|
65
|
+
nodes: c.array(ce),
|
|
66
|
+
pageInfo: We
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
|
-
const ft =
|
|
70
|
-
type:
|
|
71
|
-
id:
|
|
72
|
-
}), mt =
|
|
73
|
-
courseId:
|
|
69
|
+
const ft = c.object({
|
|
70
|
+
type: c.string(),
|
|
71
|
+
id: c.string()
|
|
72
|
+
}), mt = c.object({
|
|
73
|
+
courseId: c.string().optional(),
|
|
74
74
|
learningObject: ft.optional(),
|
|
75
|
-
reactions:
|
|
75
|
+
reactions: c.array(c.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
|
-
|
|
78
|
-
courseId:
|
|
77
|
+
c.object({
|
|
78
|
+
courseId: c.string().optional(),
|
|
79
79
|
filter: mt,
|
|
80
|
-
pageParams:
|
|
81
|
-
direction:
|
|
82
|
-
pageSize:
|
|
80
|
+
pageParams: We.optional(),
|
|
81
|
+
direction: c.enum(["next", "prev"]).optional(),
|
|
82
|
+
pageSize: c.number().optional()
|
|
83
83
|
});
|
|
84
|
-
|
|
85
|
-
courseId:
|
|
86
|
-
objectId:
|
|
87
|
-
objectType:
|
|
88
|
-
userText:
|
|
89
|
-
reaction:
|
|
84
|
+
c.object({
|
|
85
|
+
courseId: c.string(),
|
|
86
|
+
objectId: c.string(),
|
|
87
|
+
objectType: c.string(),
|
|
88
|
+
userText: c.string().optional(),
|
|
89
|
+
reaction: c.array(Ee),
|
|
90
90
|
highlightData: ye
|
|
91
91
|
});
|
|
92
|
-
|
|
92
|
+
c.object({
|
|
93
93
|
createNote: ce
|
|
94
94
|
});
|
|
95
|
-
|
|
96
|
-
id:
|
|
97
|
-
userText:
|
|
98
|
-
reaction:
|
|
95
|
+
c.object({
|
|
96
|
+
id: c.string(),
|
|
97
|
+
userText: c.string().optional(),
|
|
98
|
+
reaction: c.array(Ee),
|
|
99
99
|
highlightData: ye
|
|
100
100
|
});
|
|
101
|
-
|
|
101
|
+
c.object({
|
|
102
102
|
updateNote: ce
|
|
103
103
|
});
|
|
104
|
-
|
|
105
|
-
deleteNote:
|
|
104
|
+
c.object({
|
|
105
|
+
deleteNote: c.string()
|
|
106
106
|
});
|
|
107
|
-
var
|
|
107
|
+
var Be = /* @__PURE__ */ ((n) => (n[n.FORWARDS = 1] = "FORWARDS", n[n.BACKWARDS = 2] = "BACKWARDS", n))(Be || {});
|
|
108
108
|
class q {
|
|
109
109
|
constructor(e, t) {
|
|
110
110
|
this.start = e, this.end = t;
|
|
@@ -123,17 +123,17 @@ class q {
|
|
|
123
123
|
return o.setStart(e.node, e.offset), o.setEnd(t.node, t.offset), o;
|
|
124
124
|
}
|
|
125
125
|
static fromRange(e) {
|
|
126
|
-
const t =
|
|
126
|
+
const t = B.fromPoint(e.startContainer, e.startOffset), o = B.fromPoint(e.endContainer, e.endOffset);
|
|
127
127
|
return !t || !o ? null : new q(t, o);
|
|
128
128
|
}
|
|
129
129
|
static fromOffsets(e, t, o) {
|
|
130
|
-
return new q(new
|
|
130
|
+
return new q(new B(e, t), new B(e, o));
|
|
131
131
|
}
|
|
132
132
|
relativeTo(e) {
|
|
133
133
|
return new q(this.start.relativeTo(e), this.end.relativeTo(e));
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
class
|
|
136
|
+
class B {
|
|
137
137
|
constructor(e, t) {
|
|
138
138
|
t < 0 && console.error("Offset is invalid"), this.element = e, this.offset = t;
|
|
139
139
|
}
|
|
@@ -144,7 +144,7 @@ class W {
|
|
|
144
144
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
145
145
|
const o = document.createTreeWalker(this.element.getRootNode(), NodeFilter.SHOW_TEXT);
|
|
146
146
|
o.currentNode = this.element;
|
|
147
|
-
const r = e.direction ===
|
|
147
|
+
const r = e.direction === Be.FORWARDS, i = r ? o.nextNode() : o.previousNode();
|
|
148
148
|
if (!i)
|
|
149
149
|
throw t;
|
|
150
150
|
return { node: i, offset: r ? 0 : i.data.length };
|
|
@@ -155,9 +155,9 @@ class W {
|
|
|
155
155
|
static fromCharOffset(e, t) {
|
|
156
156
|
switch (e.nodeType) {
|
|
157
157
|
case Node.TEXT_NODE:
|
|
158
|
-
return
|
|
158
|
+
return B.fromPoint(e, t);
|
|
159
159
|
case Node.ELEMENT_NODE:
|
|
160
|
-
return new
|
|
160
|
+
return new B(e, t);
|
|
161
161
|
default:
|
|
162
162
|
return console.error("Node is not an element or text node"), null;
|
|
163
163
|
}
|
|
@@ -170,7 +170,7 @@ class W {
|
|
|
170
170
|
if (!e.parentElement)
|
|
171
171
|
return console.error("Text node has no parent"), null;
|
|
172
172
|
const o = De(e) + t;
|
|
173
|
-
return new
|
|
173
|
+
return new B(e.parentElement, o);
|
|
174
174
|
}
|
|
175
175
|
case Node.ELEMENT_NODE: {
|
|
176
176
|
if (t < 0 || t > e.childNodes.length)
|
|
@@ -178,7 +178,7 @@ class W {
|
|
|
178
178
|
let o = 0;
|
|
179
179
|
for (let r = 0; r < t; r++)
|
|
180
180
|
o += ze(e.childNodes[r]);
|
|
181
|
-
return new
|
|
181
|
+
return new B(e, o);
|
|
182
182
|
}
|
|
183
183
|
default:
|
|
184
184
|
return console.error("Point is not in an element or text node"), null;
|
|
@@ -190,7 +190,7 @@ class W {
|
|
|
190
190
|
let t = this.element, o = this.offset;
|
|
191
191
|
for (; t !== e; )
|
|
192
192
|
o += De(t), t.parentElement && (t = t.parentElement);
|
|
193
|
-
return new
|
|
193
|
+
return new B(t, o);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
const ht = (n) => {
|
|
@@ -232,19 +232,19 @@ const pt = (n) => {
|
|
|
232
232
|
let r = e;
|
|
233
233
|
o.shift();
|
|
234
234
|
for (const i of o) {
|
|
235
|
-
let l,
|
|
235
|
+
let l, a;
|
|
236
236
|
const m = i.indexOf("[");
|
|
237
237
|
if (m !== -1) {
|
|
238
238
|
l = i.slice(0, m);
|
|
239
239
|
const g = i.slice(m + 1, i.indexOf("]"));
|
|
240
|
-
if (
|
|
240
|
+
if (a = Number.parseInt(g, 10) - 1, a < 0)
|
|
241
241
|
return null;
|
|
242
242
|
} else
|
|
243
|
-
l = i,
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
243
|
+
l = i, a = 0;
|
|
244
|
+
const d = Nt(r, l, a);
|
|
245
|
+
if (!d)
|
|
246
246
|
return null;
|
|
247
|
-
r =
|
|
247
|
+
r = d;
|
|
248
248
|
}
|
|
249
249
|
return r;
|
|
250
250
|
}, Re = (n, e = document.body) => {
|
|
@@ -254,12 +254,12 @@ const pt = (n) => {
|
|
|
254
254
|
return document.evaluate(`.${n}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
class
|
|
257
|
+
class Z {
|
|
258
258
|
constructor(e, t) {
|
|
259
259
|
this.root = e, this.range = t;
|
|
260
260
|
}
|
|
261
261
|
static fromRange(e, t) {
|
|
262
|
-
return new
|
|
262
|
+
return new Z(e, t);
|
|
263
263
|
}
|
|
264
264
|
static fromSelector(e, t) {
|
|
265
265
|
if (!(t != null && t.startContainer) || !(t != null && t.endContainer))
|
|
@@ -270,11 +270,11 @@ class Y {
|
|
|
270
270
|
const r = Re(t.endContainer, e);
|
|
271
271
|
if (!r)
|
|
272
272
|
return console.error("Failed to resolve endContainer XPath"), null;
|
|
273
|
-
const i =
|
|
273
|
+
const i = B.fromCharOffset(o, t.startOffset), l = B.fromCharOffset(r, t.endOffset);
|
|
274
274
|
if (!i || !l)
|
|
275
275
|
return null;
|
|
276
|
-
const
|
|
277
|
-
return
|
|
276
|
+
const a = new q(i, l).toRange();
|
|
277
|
+
return a ? new Z(e, a) : null;
|
|
278
278
|
}
|
|
279
279
|
toRange() {
|
|
280
280
|
return this.range;
|
|
@@ -329,10 +329,10 @@ const ze = (n) => {
|
|
|
329
329
|
}, je = (n, ...e) => {
|
|
330
330
|
let t = e.shift();
|
|
331
331
|
const o = n.ownerDocument.createNodeIterator(n, NodeFilter.SHOW_TEXT), r = [];
|
|
332
|
-
let i = o.nextNode(), l = null,
|
|
332
|
+
let i = o.nextNode(), l = null, a = 0;
|
|
333
333
|
for (; t !== void 0 && i; )
|
|
334
|
-
l = i,
|
|
335
|
-
for (; t !== void 0 && l &&
|
|
334
|
+
l = i, a + l.data.length > t ? (r.push({ node: l, offset: t - a }), t = e.shift()) : (i = o.nextNode(), a += l.data.length);
|
|
335
|
+
for (; t !== void 0 && l && a === t; )
|
|
336
336
|
r.push({ node: l, offset: l.data.length }), t = e.shift();
|
|
337
337
|
return t !== void 0 && console.error("Offset exceeds text length"), r;
|
|
338
338
|
}, yt = (n, e, t, o) => {
|
|
@@ -348,17 +348,17 @@ const ze = (n) => {
|
|
|
348
348
|
if (!i)
|
|
349
349
|
return null;
|
|
350
350
|
if (e.length > 32) {
|
|
351
|
-
const l = e.slice(0, 32),
|
|
352
|
-
let
|
|
353
|
-
const g = r.match_main(i,
|
|
354
|
-
if (
|
|
351
|
+
const l = e.slice(0, 32), a = e.slice(-32), m = o - t;
|
|
352
|
+
let d = r.match_main(i, l, t);
|
|
353
|
+
const g = r.match_main(i, a, o), h = g + a.length;
|
|
354
|
+
if (d === -1 || g === -1)
|
|
355
355
|
return null;
|
|
356
|
-
const u = h -
|
|
357
|
-
if ((
|
|
358
|
-
return yt(n,
|
|
359
|
-
if (
|
|
356
|
+
const u = h - d, S = Math.abs(u - m);
|
|
357
|
+
if ((d > h || S > 5) && (r.Match_Distance = e.length + 100, d = r.match_main(i, l, h), d !== -1 && d < h))
|
|
358
|
+
return yt(n, d, h, m);
|
|
359
|
+
if (d < h && S <= 5)
|
|
360
360
|
return X.fromSelector(n, {
|
|
361
|
-
start:
|
|
361
|
+
start: d,
|
|
362
362
|
end: h
|
|
363
363
|
});
|
|
364
364
|
} else {
|
|
@@ -384,7 +384,7 @@ const ze = (n) => {
|
|
|
384
384
|
for (const i of e) {
|
|
385
385
|
const l = St(i, n);
|
|
386
386
|
if (l) {
|
|
387
|
-
const
|
|
387
|
+
const a = l.toRange(), m = a && Z.fromRange(n, a);
|
|
388
388
|
o.push({
|
|
389
389
|
id: i.id,
|
|
390
390
|
reaction: i.reaction,
|
|
@@ -414,23 +414,23 @@ const ze = (n) => {
|
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: t, id: o } = n, { range: r } = t ?? {};
|
|
417
|
-
r && ((l =
|
|
418
|
-
},
|
|
417
|
+
r && ((l = Z.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Rt({ id: o });
|
|
418
|
+
}, Tt = (n) => {
|
|
419
419
|
const e = document.getElementById(ve(n));
|
|
420
420
|
if (e) {
|
|
421
421
|
const t = e.getBoundingClientRect();
|
|
422
422
|
t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth) || e.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
423
423
|
}
|
|
424
|
-
}, se = 90, ie = 172,
|
|
424
|
+
}, se = 90, ie = 172, Ct = (n) => {
|
|
425
425
|
const e = n.getClientRects();
|
|
426
426
|
if (!e.length)
|
|
427
427
|
return null;
|
|
428
|
-
const t = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth,
|
|
429
|
-
const
|
|
430
|
-
return f >= i &&
|
|
431
|
-
},
|
|
432
|
-
const
|
|
433
|
-
return f >= i &&
|
|
428
|
+
const t = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (f) => {
|
|
429
|
+
const y = f + ie;
|
|
430
|
+
return f >= i && y <= l - i;
|
|
431
|
+
}, d = (f) => {
|
|
432
|
+
const y = f + se;
|
|
433
|
+
return f >= i && y <= a - i;
|
|
434
434
|
};
|
|
435
435
|
let g;
|
|
436
436
|
const h = t.right - ie;
|
|
@@ -441,25 +441,25 @@ const ze = (n) => {
|
|
|
441
441
|
if (m(f))
|
|
442
442
|
g = f;
|
|
443
443
|
else {
|
|
444
|
-
const
|
|
445
|
-
m(
|
|
444
|
+
const E = (t.left + t.right) / 2 - ie / 2;
|
|
445
|
+
m(E) ? g = E : h < i ? g = i : g = l - ie - i;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
let u;
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
451
|
-
u =
|
|
449
|
+
const S = o.bottom + r;
|
|
450
|
+
if (d(S))
|
|
451
|
+
u = S;
|
|
452
452
|
else {
|
|
453
453
|
const f = t.top - se - r;
|
|
454
|
-
|
|
454
|
+
d(f) ? u = f : S + se > a - i ? u = a - se - i : u = i;
|
|
455
455
|
}
|
|
456
456
|
return { top: u, left: g };
|
|
457
|
-
},
|
|
457
|
+
}, It = (n, e) => {
|
|
458
458
|
for (const t of e)
|
|
459
459
|
if (n.start < t.end && n.end > t.start)
|
|
460
460
|
return !0;
|
|
461
461
|
return !1;
|
|
462
|
-
}, Se = (n) => `highlight-wrapper-${n}`, ve = (n) => `${Se(n)}-start`, Ue = (n) => `${Se(n)}-end`, oe = (n) => `[data-highlight-id="${CSS.escape(n)}"]`,
|
|
462
|
+
}, Se = (n) => `highlight-wrapper-${n}`, ve = (n) => `${Se(n)}-start`, Ue = (n) => `${Se(n)}-end`, oe = (n) => `[data-highlight-id="${CSS.escape(n)}"]`, Te = (n, e) => {
|
|
463
463
|
const t = Number.parseInt(n.slice(1, 3), 16), o = Number.parseInt(n.slice(3, 5), 16), r = Number.parseInt(n.slice(5, 7), 16);
|
|
464
464
|
return `rgba(${t}, ${o}, ${r}, ${e})`;
|
|
465
465
|
}, xt = (n, e) => {
|
|
@@ -499,36 +499,36 @@ const ze = (n) => {
|
|
|
499
499
|
Ot(e, t);
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
|
-
const l = e.type === w.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l :
|
|
502
|
+
const l = e.type === w.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l : Te(l, 0.5), d = e.type === w.IMPORTANT ? t.colors.importantUnderline : t.colors.confusingUnderline, g = e.type === w.IMPORTANT ? "solid" : "dashed", h = n.toString(), u = document.createElement("span");
|
|
503
503
|
u.id = `${r}-start`, u.className = "highlight-marker-start", u.dataset.highlightId = o || "", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", h), u.style.position = "relative", u.style.fontSize = "0", u.style.lineHeight = "0", u.style.width = "0", u.style.height = "0", u.style.margin = "0", u.style.padding = "0", u.style.border = "0";
|
|
504
|
-
const
|
|
505
|
-
|
|
504
|
+
const S = document.createElement("span");
|
|
505
|
+
S.id = Ue(o), S.className = "highlight-marker-end", S.dataset.highlightId = o || "";
|
|
506
506
|
const f = n.cloneRange();
|
|
507
|
-
f.collapse(!1), f.insertNode(
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const F = wt(
|
|
513
|
-
F.forEach((N,
|
|
514
|
-
var
|
|
507
|
+
f.collapse(!1), f.insertNode(S);
|
|
508
|
+
const y = n.cloneRange();
|
|
509
|
+
y.collapse(!0), y.insertNode(u);
|
|
510
|
+
const E = document.createRange();
|
|
511
|
+
E.setStartAfter(u), E.setEndBefore(S);
|
|
512
|
+
const F = wt(E).filter((N) => N.textContent && N.textContent.length > 0);
|
|
513
|
+
F.forEach((N, I) => {
|
|
514
|
+
var J;
|
|
515
515
|
const k = N.parentElement;
|
|
516
516
|
if ((k == null ? void 0 : k.dataset.highlightId) === o) return;
|
|
517
|
-
const x =
|
|
517
|
+
const x = I === 0, O = I === F.length - 1, _ = F.length === 1;
|
|
518
518
|
let M;
|
|
519
519
|
_ ? M = "single" : x ? M = "first" : O ? M = "last" : M = "middle";
|
|
520
520
|
const D = document.createElement("span");
|
|
521
|
-
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = M, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor =
|
|
521
|
+
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = M, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = d, D.style.textDecorationStyle = g, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (R) => {
|
|
522
522
|
var b;
|
|
523
523
|
R.target.tagName !== "A" && ((b = e.onClick) == null || b.call(e));
|
|
524
|
-
}), (
|
|
524
|
+
}), (J = N.parentNode) == null || J.insertBefore(D, N), D.appendChild(N);
|
|
525
525
|
}), u.addEventListener("click", (N) => {
|
|
526
|
-
var
|
|
527
|
-
N.target.tagName !== "A" && ((
|
|
526
|
+
var I;
|
|
527
|
+
N.target.tagName !== "A" && ((I = e.onClick) == null || I.call(e));
|
|
528
528
|
}), u.addEventListener("keydown", (N) => {
|
|
529
|
-
var
|
|
529
|
+
var I;
|
|
530
530
|
if (N.key === "Enter" || N.key === " ")
|
|
531
|
-
N.preventDefault(), (
|
|
531
|
+
N.preventDefault(), (I = e.onClick) == null || I.call(e);
|
|
532
532
|
else if (N.key === "Tab" && !N.shiftKey) {
|
|
533
533
|
const k = document.querySelectorAll(oe(o));
|
|
534
534
|
for (const x of k) {
|
|
@@ -542,19 +542,19 @@ const ze = (n) => {
|
|
|
542
542
|
}), u.addEventListener("focus", () => {
|
|
543
543
|
document.querySelectorAll(
|
|
544
544
|
oe(o)
|
|
545
|
-
).forEach((
|
|
546
|
-
|
|
545
|
+
).forEach((I) => {
|
|
546
|
+
I.classList.add("highlight-focused");
|
|
547
547
|
});
|
|
548
548
|
}), u.addEventListener("blur", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
550
|
oe(o)
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
551
|
+
).forEach((I) => {
|
|
552
|
+
I.classList.remove("highlight-focused");
|
|
553
553
|
});
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
556
|
function Ot(n, e) {
|
|
557
|
-
const t = n.type === w.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t :
|
|
557
|
+
const t = n.type === w.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t : Te(t, 0.5);
|
|
558
558
|
document.querySelectorAll(
|
|
559
559
|
oe(n.id ?? "")
|
|
560
560
|
).forEach((l) => {
|
|
@@ -571,7 +571,7 @@ const Rt = (n) => {
|
|
|
571
571
|
(l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
|
|
572
572
|
i.remove();
|
|
573
573
|
}), t == null || t.remove(), o == null || o.remove();
|
|
574
|
-
},
|
|
574
|
+
}, ne = {
|
|
575
575
|
all: ["notebook"],
|
|
576
576
|
notes: (n) => ["notebook", "notes", n]
|
|
577
577
|
};
|
|
@@ -580,7 +580,7 @@ function Dt(n) {
|
|
|
580
580
|
return pe({
|
|
581
581
|
mutationFn: (t) => n.createNote(t),
|
|
582
582
|
onSuccess: () => {
|
|
583
|
-
e.invalidateQueries({ queryKey:
|
|
583
|
+
e.invalidateQueries({ queryKey: ne.all });
|
|
584
584
|
}
|
|
585
585
|
});
|
|
586
586
|
}
|
|
@@ -589,7 +589,7 @@ function Lt(n) {
|
|
|
589
589
|
return pe({
|
|
590
590
|
mutationFn: (t) => n.deleteNote(t),
|
|
591
591
|
onSuccess: () => {
|
|
592
|
-
e.invalidateQueries({ queryKey:
|
|
592
|
+
e.invalidateQueries({ queryKey: ne.all });
|
|
593
593
|
}
|
|
594
594
|
});
|
|
595
595
|
}
|
|
@@ -599,7 +599,7 @@ function $e({
|
|
|
599
599
|
...t
|
|
600
600
|
}) {
|
|
601
601
|
return et({
|
|
602
|
-
queryKey:
|
|
602
|
+
queryKey: ne.notes(t),
|
|
603
603
|
queryFn: () => n.getNotes(t),
|
|
604
604
|
enabled: e
|
|
605
605
|
});
|
|
@@ -609,14 +609,14 @@ function At(n) {
|
|
|
609
609
|
return pe({
|
|
610
610
|
mutationFn: ({ id: t, input: o }) => n.updateNote(t, o),
|
|
611
611
|
onMutate: async ({ id: t, input: o }) => {
|
|
612
|
-
await e.cancelQueries({ queryKey:
|
|
613
|
-
const i = e.getQueryCache().findAll({ queryKey:
|
|
614
|
-
for (const
|
|
615
|
-
const m =
|
|
616
|
-
m && (l.set(
|
|
612
|
+
await e.cancelQueries({ queryKey: ne.all });
|
|
613
|
+
const i = e.getQueryCache().findAll({ queryKey: ne.all }), l = /* @__PURE__ */ new Map();
|
|
614
|
+
for (const a of i) {
|
|
615
|
+
const m = a.state.data;
|
|
616
|
+
m && (l.set(a.queryKey, m), e.setQueryData(a.queryKey, {
|
|
617
617
|
...m,
|
|
618
618
|
notes: m.notes.map(
|
|
619
|
-
(
|
|
619
|
+
(d) => d.id === t ? { ...d, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : d
|
|
620
620
|
)
|
|
621
621
|
}));
|
|
622
622
|
}
|
|
@@ -628,18 +628,18 @@ function At(n) {
|
|
|
628
628
|
e.setQueryData(i, l);
|
|
629
629
|
},
|
|
630
630
|
onSettled: () => {
|
|
631
|
-
e.invalidateQueries({ queryKey:
|
|
631
|
+
e.invalidateQueries({ queryKey: ne.all });
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Back",
|
|
635
|
+
const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Back", Wt = "Edit note", Bt = "Save", zt = "Cancel", jt = "Delete note", Ut = "note", $t = "Add note (optional)", qt = "Remove from Notebook", Gt = "Add a note (optional)", Kt = "Mark important", Xt = "Mark unclear", Qt = "Saved to Notebook.", Vt = "Note updated", Yt = "Note deleted", Zt = "Error saving to Notebook.", Jt = "Error updating note", en = "Note deletion failed", tn = "Loading notes", nn = "Failed to load notes", on = "Start capturing your notes", rn = "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.", sn = "Nothing here yet", ln = "Adjust your filters or create a new note to get started.", an = "You have no notes for the selected filter", cn = "Previous page", dn = "Next page", un = "All courses", fn = "All notes", mn = "Close Notebook panel", hn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", gn = "The content you highlighted is no longer available.", Ce = {
|
|
636
636
|
notebook: Pt,
|
|
637
637
|
notes: _t,
|
|
638
638
|
important: Ft,
|
|
639
639
|
unclear: Mt,
|
|
640
640
|
back: Ht,
|
|
641
|
-
editNote:
|
|
642
|
-
save:
|
|
641
|
+
editNote: Wt,
|
|
642
|
+
save: Bt,
|
|
643
643
|
cancel: zt,
|
|
644
644
|
deleteNote: jt,
|
|
645
645
|
note: Ut,
|
|
@@ -670,7 +670,7 @@ const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Bac
|
|
|
670
670
|
highlightUnavailable: gn
|
|
671
671
|
}, qe = Pe(null);
|
|
672
672
|
function Ge(n, e) {
|
|
673
|
-
const t =
|
|
673
|
+
const t = Ce[n] ?? n;
|
|
674
674
|
return e ? t.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : t;
|
|
675
675
|
}
|
|
676
676
|
function pn({
|
|
@@ -680,7 +680,7 @@ function pn({
|
|
|
680
680
|
}) {
|
|
681
681
|
const o = re(
|
|
682
682
|
() => ({
|
|
683
|
-
translations: { ...
|
|
683
|
+
translations: { ...Ce, ...n },
|
|
684
684
|
translate: e ?? Ge
|
|
685
685
|
}),
|
|
686
686
|
[n, e]
|
|
@@ -689,7 +689,7 @@ function pn({
|
|
|
689
689
|
}
|
|
690
690
|
function G() {
|
|
691
691
|
const n = _e(qe);
|
|
692
|
-
return n || { translations:
|
|
692
|
+
return n || { translations: Ce, translate: Ge };
|
|
693
693
|
}
|
|
694
694
|
const Nn = {
|
|
695
695
|
selectedNoteId: null,
|
|
@@ -725,11 +725,12 @@ function Qn({
|
|
|
725
725
|
courseId: r,
|
|
726
726
|
pageLastModifiedAt: i,
|
|
727
727
|
onAnalyticsEvent: l,
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
728
|
+
onOpen: a,
|
|
729
|
+
translations: m,
|
|
730
|
+
translate: d,
|
|
731
|
+
children: g
|
|
731
732
|
}) {
|
|
732
|
-
const [
|
|
733
|
+
const [h, u] = Fe(bn, Nn), S = Y(!1), f = re(
|
|
733
734
|
() => ({
|
|
734
735
|
api: n,
|
|
735
736
|
currentUserId: e,
|
|
@@ -738,12 +739,16 @@ function Qn({
|
|
|
738
739
|
courseId: r,
|
|
739
740
|
pageLastModifiedAt: i,
|
|
740
741
|
onAnalyticsEvent: l,
|
|
741
|
-
...
|
|
742
|
-
selectNote: (
|
|
743
|
-
clearSelectedNote: () =>
|
|
744
|
-
setEditing: (
|
|
745
|
-
openTray: () =>
|
|
746
|
-
|
|
742
|
+
...h,
|
|
743
|
+
selectNote: (y, E = !1) => u({ type: "SELECT_NOTE", payload: { id: y, isEditing: E } }),
|
|
744
|
+
clearSelectedNote: () => u({ type: "CLEAR_SELECTED_NOTE" }),
|
|
745
|
+
setEditing: (y) => u({ type: "SET_EDITING", payload: y }),
|
|
746
|
+
openTray: () => {
|
|
747
|
+
S.current || (S.current = !0, a == null || a()), u({ type: "OPEN_TRAY" });
|
|
748
|
+
},
|
|
749
|
+
closeTray: () => {
|
|
750
|
+
S.current = !1, u({ type: "CLOSE_TRAY" });
|
|
751
|
+
}
|
|
747
752
|
}),
|
|
748
753
|
[
|
|
749
754
|
n,
|
|
@@ -753,10 +758,11 @@ function Qn({
|
|
|
753
758
|
r,
|
|
754
759
|
i,
|
|
755
760
|
l,
|
|
756
|
-
|
|
761
|
+
a,
|
|
762
|
+
h
|
|
757
763
|
]
|
|
758
764
|
);
|
|
759
|
-
return /* @__PURE__ */ s(Ke.Provider, { value:
|
|
765
|
+
return /* @__PURE__ */ s(Ke.Provider, { value: f, children: /* @__PURE__ */ s(pn, { translations: m, translate: d, children: g }) });
|
|
760
766
|
}
|
|
761
767
|
function Xe() {
|
|
762
768
|
const n = _e(Ke);
|
|
@@ -765,19 +771,44 @@ function Xe() {
|
|
|
765
771
|
return n;
|
|
766
772
|
}
|
|
767
773
|
const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
768
|
-
const { translations: t } = G(), o =
|
|
774
|
+
const { translations: t } = G(), o = Y(null), r = Y(null);
|
|
769
775
|
return Q(() => {
|
|
770
776
|
n === w.CONFUSING && o.current ? o.current.focus() : n === w.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
771
|
-
}, [n]), /* @__PURE__ */
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
777
|
+
}, [n]), /* @__PURE__ */ s(
|
|
778
|
+
z,
|
|
779
|
+
{
|
|
780
|
+
as: "div",
|
|
781
|
+
background: "primary",
|
|
782
|
+
borderWidth: "small",
|
|
783
|
+
borderColor: "secondary",
|
|
784
|
+
borderRadius: "medium",
|
|
785
|
+
shadow: "resting",
|
|
786
|
+
children: /* @__PURE__ */ v(te, { children: [
|
|
787
|
+
/* @__PURE__ */ v(
|
|
788
|
+
te.Item,
|
|
789
|
+
{
|
|
790
|
+
ref: o,
|
|
791
|
+
onClick: () => e(w.CONFUSING),
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
794
|
+
` ${t.markUnclear}`
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
/* @__PURE__ */ v(
|
|
799
|
+
te.Item,
|
|
800
|
+
{
|
|
801
|
+
ref: r,
|
|
802
|
+
onClick: () => e(w.IMPORTANT),
|
|
803
|
+
children: [
|
|
804
|
+
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
805
|
+
` ${t.markImportant}`
|
|
806
|
+
]
|
|
807
|
+
}
|
|
808
|
+
)
|
|
809
|
+
] })
|
|
810
|
+
}
|
|
811
|
+
);
|
|
781
812
|
}, de = "notebook-inline-reaction-menu";
|
|
782
813
|
function Vn({
|
|
783
814
|
containerRef: n,
|
|
@@ -789,9 +820,9 @@ function Vn({
|
|
|
789
820
|
objectId: r,
|
|
790
821
|
objectType: i,
|
|
791
822
|
courseId: l,
|
|
792
|
-
pageLastModifiedAt:
|
|
823
|
+
pageLastModifiedAt: a,
|
|
793
824
|
selectedNoteId: m,
|
|
794
|
-
selectNote:
|
|
825
|
+
selectNote: d,
|
|
795
826
|
openTray: g
|
|
796
827
|
} = Xe(), { data: h } = $e({
|
|
797
828
|
api: o,
|
|
@@ -800,7 +831,7 @@ function Vn({
|
|
|
800
831
|
},
|
|
801
832
|
courseId: l,
|
|
802
833
|
pageSize: 100
|
|
803
|
-
}), { mutate: u } = Dt(o), { mutate:
|
|
834
|
+
}), { mutate: u } = Dt(o), { mutate: S } = At(o), { mutate: f } = Lt(o), y = Y([]), [E, H] = W([]), [F, N] = W(null), [I, k] = W(""), [x, O] = W(null), [_, M] = W(!1);
|
|
804
835
|
Q(() => {
|
|
805
836
|
const R = n.current;
|
|
806
837
|
if (!R) return;
|
|
@@ -823,92 +854,92 @@ function Vn({
|
|
|
823
854
|
const P = () => {
|
|
824
855
|
b && clearTimeout(b), b = setTimeout(() => {
|
|
825
856
|
var xe;
|
|
826
|
-
const
|
|
827
|
-
if (!(
|
|
828
|
-
const j =
|
|
857
|
+
const T = window.getSelection(), A = n.current;
|
|
858
|
+
if (!(T != null && T.rangeCount) || !A) return;
|
|
859
|
+
const j = T.toString().trim();
|
|
829
860
|
if (j === "") return;
|
|
830
|
-
const
|
|
831
|
-
if (!A.contains(
|
|
832
|
-
const
|
|
833
|
-
|
|
861
|
+
const ee = T.getRangeAt(0);
|
|
862
|
+
if (!A.contains(ee.commonAncestorContainer)) return;
|
|
863
|
+
const Ie = (xe = X.fromRange(A, ee)) == null ? void 0 : xe.toSelector();
|
|
864
|
+
Ie && !It(Ie, E) && (N(ee.cloneRange()), k(j), O(Ct(ee)));
|
|
834
865
|
}, t);
|
|
835
|
-
}, L = (
|
|
836
|
-
if (!(
|
|
866
|
+
}, L = (T) => {
|
|
867
|
+
if (!(T.target instanceof Node)) return;
|
|
837
868
|
const A = document.getElementById(de);
|
|
838
|
-
A != null && A.contains(
|
|
869
|
+
A != null && A.contains(T.target) ? (T.preventDefault(), T.stopImmediatePropagation()) : (O(null), N(null), k(""));
|
|
839
870
|
}, p = () => {
|
|
840
871
|
O(null), N(null), k("");
|
|
841
872
|
};
|
|
842
873
|
return document.addEventListener("selectionchange", P), document.addEventListener("mousedown", L), document.addEventListener("touchstart", L), window.addEventListener("scroll", p, !0), () => {
|
|
843
874
|
b && clearTimeout(b), document.removeEventListener("selectionchange", P), document.removeEventListener("mousedown", L), document.removeEventListener("touchstart", L), window.removeEventListener("scroll", p, !0);
|
|
844
875
|
};
|
|
845
|
-
}, [_,
|
|
846
|
-
m &&
|
|
876
|
+
}, [_, E, t, n]), Q(() => {
|
|
877
|
+
m && Tt(m);
|
|
847
878
|
}, [m]);
|
|
848
879
|
const D = K(
|
|
849
880
|
(R) => {
|
|
850
881
|
var j;
|
|
851
882
|
const b = n.current;
|
|
852
883
|
if (!b || !R.highlightData) return null;
|
|
853
|
-
const { highlightData: P, reaction: L, id: p } = R, { range:
|
|
884
|
+
const { highlightData: P, reaction: L, id: p } = R, { range: T } = P, A = T && ((j = Z.fromSelector(b, T)) == null ? void 0 : j.toRange());
|
|
854
885
|
if (A) {
|
|
855
|
-
const
|
|
886
|
+
const ee = {
|
|
856
887
|
id: p,
|
|
857
888
|
selectedNoteId: m,
|
|
858
889
|
type: L[0],
|
|
859
890
|
onClick: () => {
|
|
860
|
-
|
|
891
|
+
d(p), g();
|
|
861
892
|
}
|
|
862
893
|
};
|
|
863
|
-
return kt(A,
|
|
894
|
+
return kt(A, ee, e), P.textPosition;
|
|
864
895
|
}
|
|
865
896
|
return null;
|
|
866
897
|
},
|
|
867
|
-
[n, m, e,
|
|
898
|
+
[n, m, e, d, g]
|
|
868
899
|
);
|
|
869
900
|
Q(() => {
|
|
870
901
|
if (!_ || !h || !n.current) return;
|
|
871
902
|
const R = n.current, b = h.notes, P = /* @__PURE__ */ new Set(), L = [], p = [];
|
|
872
903
|
if (b.length === 0) {
|
|
873
|
-
if (
|
|
874
|
-
for (const
|
|
875
|
-
Le(
|
|
876
|
-
|
|
904
|
+
if (y.current.length > 0) {
|
|
905
|
+
for (const T of y.current)
|
|
906
|
+
Le(T, R);
|
|
907
|
+
y.current = [], H([]);
|
|
877
908
|
}
|
|
878
909
|
return;
|
|
879
910
|
}
|
|
880
|
-
if (
|
|
881
|
-
const { notesForUpdate:
|
|
911
|
+
if (a && b[0].highlightData.pageLastModifiedAt !== a) {
|
|
912
|
+
const { notesForUpdate: T, noteIdsForDelete: A } = vt(
|
|
882
913
|
R,
|
|
883
914
|
b,
|
|
884
|
-
|
|
915
|
+
a
|
|
885
916
|
);
|
|
886
|
-
for (const j of
|
|
887
|
-
|
|
917
|
+
for (const j of T)
|
|
918
|
+
S({ id: j.id, input: j });
|
|
888
919
|
for (const j of A)
|
|
889
920
|
f(j);
|
|
890
921
|
} else {
|
|
891
|
-
for (const
|
|
892
|
-
const A = D(
|
|
893
|
-
P.add(
|
|
922
|
+
for (const T of b) {
|
|
923
|
+
const A = D(T);
|
|
924
|
+
P.add(T.id), A && (L.push(T), p.push(A));
|
|
894
925
|
}
|
|
895
|
-
for (const
|
|
896
|
-
P.has(
|
|
897
|
-
H(p),
|
|
926
|
+
for (const T of y.current)
|
|
927
|
+
P.has(T.id) || Le(T, R);
|
|
928
|
+
H(p), y.current = L;
|
|
898
929
|
}
|
|
899
930
|
}, [
|
|
900
931
|
_,
|
|
901
932
|
h,
|
|
902
933
|
D,
|
|
903
|
-
|
|
934
|
+
a,
|
|
904
935
|
n,
|
|
905
|
-
|
|
936
|
+
S,
|
|
906
937
|
f
|
|
907
938
|
]);
|
|
908
|
-
const
|
|
939
|
+
const J = (R) => {
|
|
909
940
|
const b = n.current;
|
|
910
941
|
if (!F || !b) return;
|
|
911
|
-
const P =
|
|
942
|
+
const P = Z.fromRange(b, F), L = X.fromRange(b, F);
|
|
912
943
|
u(
|
|
913
944
|
{
|
|
914
945
|
courseId: l,
|
|
@@ -917,17 +948,17 @@ function Vn({
|
|
|
917
948
|
userText: "",
|
|
918
949
|
reaction: [R],
|
|
919
950
|
highlightData: {
|
|
920
|
-
selectedText:
|
|
951
|
+
selectedText: I,
|
|
921
952
|
textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
|
|
922
953
|
range: P.toSelector(),
|
|
923
|
-
pageLastModifiedAt:
|
|
954
|
+
pageLastModifiedAt: a ?? ""
|
|
924
955
|
}
|
|
925
956
|
},
|
|
926
957
|
{
|
|
927
958
|
onSuccess: (p) => {
|
|
928
959
|
var A;
|
|
929
|
-
const
|
|
930
|
-
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(),
|
|
960
|
+
const T = p.id;
|
|
961
|
+
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(), d(T), g();
|
|
931
962
|
}
|
|
932
963
|
}
|
|
933
964
|
);
|
|
@@ -949,7 +980,7 @@ function Vn({
|
|
|
949
980
|
const b = document.getElementById(de);
|
|
950
981
|
b != null && b.contains(R.relatedTarget) || (O(null), N(null), k(""));
|
|
951
982
|
},
|
|
952
|
-
children: /* @__PURE__ */ s(yn, { onSelectReaction:
|
|
983
|
+
children: /* @__PURE__ */ s(yn, { onSelectReaction: J })
|
|
953
984
|
}
|
|
954
985
|
),
|
|
955
986
|
document.body
|
|
@@ -967,7 +998,7 @@ const En = (n, e) => ({
|
|
|
967
998
|
}) => {
|
|
968
999
|
const r = En(e, o), l = {
|
|
969
1000
|
position: "relative",
|
|
970
|
-
backgroundColor: t ? r.backgroundColor :
|
|
1001
|
+
backgroundColor: t ? r.backgroundColor : Te(r.backgroundColor, 0.5),
|
|
971
1002
|
textDecorationLine: "underline",
|
|
972
1003
|
textDecorationStyle: r.underlineStyle,
|
|
973
1004
|
textDecorationColor: r.underlineColor,
|
|
@@ -978,9 +1009,9 @@ const En = (n, e) => ({
|
|
|
978
1009
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: n });
|
|
979
1010
|
}, Qe = () => {
|
|
980
1011
|
const { translations: n } = G();
|
|
981
|
-
return /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */ s(
|
|
983
|
-
/* @__PURE__ */ s(
|
|
1012
|
+
return /* @__PURE__ */ v(C, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1013
|
+
/* @__PURE__ */ s(C.Item, { as: "div", children: /* @__PURE__ */ s(tt, { color: "error" }) }),
|
|
1014
|
+
/* @__PURE__ */ s(C.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(me, { maxLines: 3, children: n.highlightUnavailable }) })
|
|
984
1015
|
] });
|
|
985
1016
|
}, Sn = {
|
|
986
1017
|
filter: null,
|
|
@@ -1006,18 +1037,18 @@ function Yn({
|
|
|
1006
1037
|
learningObject: o,
|
|
1007
1038
|
pageSize: r = 16
|
|
1008
1039
|
}) {
|
|
1009
|
-
const [i, l] = Fe(vn, Sn), { filter:
|
|
1040
|
+
const [i, l] = Fe(vn, Sn), { filter: a, courseFilter: m, pageParamsWithDirection: d } = i;
|
|
1010
1041
|
Q(() => {
|
|
1011
|
-
Object.keys(
|
|
1042
|
+
Object.keys(d).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
|
|
1012
1043
|
}, [r]);
|
|
1013
|
-
const g = t ? m : e, { direction: h, pageParams: u } =
|
|
1044
|
+
const g = t ? m : e, { direction: h, pageParams: u } = d, S = h === "next" ? (u == null ? void 0 : u.endCursor) ?? void 0 : h === "prev" ? (u == null ? void 0 : u.startCursor) ?? void 0 : void 0, { data: f, isLoading: y, isError: E } = $e({
|
|
1014
1045
|
api: n,
|
|
1015
1046
|
filter: {
|
|
1016
1047
|
...g ? { courseId: g } : {},
|
|
1017
|
-
...
|
|
1048
|
+
...a ? { reactions: [a] } : {},
|
|
1018
1049
|
...o ? { learningObject: o } : {}
|
|
1019
1050
|
},
|
|
1020
|
-
cursor:
|
|
1051
|
+
cursor: S,
|
|
1021
1052
|
direction: h,
|
|
1022
1053
|
pageSize: r
|
|
1023
1054
|
}), H = (f == null ? void 0 : f.notes) ?? [], F = f == null ? void 0 : f.pageInfo, N = K(() => {
|
|
@@ -1025,7 +1056,7 @@ function Yn({
|
|
|
1025
1056
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1026
1057
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "next" }
|
|
1027
1058
|
});
|
|
1028
|
-
}, [f == null ? void 0 : f.pageInfo]),
|
|
1059
|
+
}, [f == null ? void 0 : f.pageInfo]), I = K(() => {
|
|
1029
1060
|
l({
|
|
1030
1061
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1031
1062
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "prev" }
|
|
@@ -1038,14 +1069,14 @@ function Yn({
|
|
|
1038
1069
|
return {
|
|
1039
1070
|
notes: H,
|
|
1040
1071
|
pageInfo: F,
|
|
1041
|
-
isLoading:
|
|
1042
|
-
isError:
|
|
1043
|
-
filter:
|
|
1072
|
+
isLoading: y,
|
|
1073
|
+
isError: E,
|
|
1074
|
+
filter: a,
|
|
1044
1075
|
courseFilter: m,
|
|
1045
1076
|
setFilter: k,
|
|
1046
1077
|
setCourseFilter: x,
|
|
1047
1078
|
fetchNextPage: N,
|
|
1048
|
-
fetchPreviousPage:
|
|
1079
|
+
fetchPreviousPage: I
|
|
1049
1080
|
};
|
|
1050
1081
|
}
|
|
1051
1082
|
const ue = "all";
|
|
@@ -1058,8 +1089,8 @@ function Zn({ filter: n, setFilter: e }) {
|
|
|
1058
1089
|
],
|
|
1059
1090
|
[t]
|
|
1060
1091
|
), r = K(
|
|
1061
|
-
(l, { value:
|
|
1062
|
-
e(!
|
|
1092
|
+
(l, { value: a }) => {
|
|
1093
|
+
e(!a || a === ue ? null : a);
|
|
1063
1094
|
},
|
|
1064
1095
|
[e]
|
|
1065
1096
|
);
|
|
@@ -1080,9 +1111,9 @@ function Zn({ filter: n, setFilter: e }) {
|
|
|
1080
1111
|
handleReactionFilterChange: r
|
|
1081
1112
|
};
|
|
1082
1113
|
}
|
|
1083
|
-
const
|
|
1114
|
+
const Tn = ({ hasActiveFilter: n = !1 }) => {
|
|
1084
1115
|
const { translations: e } = G(), t = n ? e.nothingHereYet : e.emptyStateHeading, o = n ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1085
|
-
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ v(C, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1086
1117
|
!n && /* @__PURE__ */ s(nt, { size: "medium" }),
|
|
1087
1118
|
/* @__PURE__ */ s(ae, { level: "h3", children: t }),
|
|
1088
1119
|
/* @__PURE__ */ s(U, { color: "secondary", children: o })
|
|
@@ -1097,8 +1128,8 @@ const In = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1097
1128
|
onDismiss: t,
|
|
1098
1129
|
placement: "end",
|
|
1099
1130
|
size: "regular",
|
|
1100
|
-
children: /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */ s(
|
|
1131
|
+
children: /* @__PURE__ */ v(C, { direction: "column", height: "100vh", children: [
|
|
1132
|
+
/* @__PURE__ */ s(C.Item, { children: /* @__PURE__ */ s(z, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ v(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1102
1133
|
/* @__PURE__ */ s(ae, { level: "h3", children: o.notebook }),
|
|
1103
1134
|
/* @__PURE__ */ s(
|
|
1104
1135
|
it,
|
|
@@ -1110,11 +1141,11 @@ const In = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1110
1141
|
}
|
|
1111
1142
|
)
|
|
1112
1143
|
] }) }) }),
|
|
1113
|
-
/* @__PURE__ */ s(
|
|
1144
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
|
|
1114
1145
|
] })
|
|
1115
1146
|
}
|
|
1116
1147
|
);
|
|
1117
|
-
},
|
|
1148
|
+
}, Cn = {
|
|
1118
1149
|
[w.IMPORTANT]: {
|
|
1119
1150
|
color: "success",
|
|
1120
1151
|
translationKey: "important",
|
|
@@ -1126,27 +1157,27 @@ const In = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1126
1157
|
icon: /* @__PURE__ */ s(Ne, { size: "x-small" })
|
|
1127
1158
|
}
|
|
1128
1159
|
}, Ve = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
|
|
1129
|
-
const { translations: o } = G(), r =
|
|
1160
|
+
const { translations: o } = G(), r = Cn[n], i = o[r.translationKey], [l, a] = W(!1), m = Y(null), d = Y(null), g = K(
|
|
1130
1161
|
(h) => {
|
|
1131
|
-
e == null || e(h),
|
|
1162
|
+
e == null || e(h), a(!1);
|
|
1132
1163
|
},
|
|
1133
1164
|
[e]
|
|
1134
1165
|
);
|
|
1135
|
-
return t && e ? /* @__PURE__ */
|
|
1136
|
-
|
|
1166
|
+
return t && e ? /* @__PURE__ */ v(
|
|
1167
|
+
te,
|
|
1137
1168
|
{
|
|
1138
1169
|
placement: "bottom start",
|
|
1139
1170
|
show: l,
|
|
1140
|
-
onToggle: (h) =>
|
|
1171
|
+
onToggle: (h) => a(h),
|
|
1141
1172
|
shouldHideOnSelect: !0,
|
|
1142
1173
|
shouldFocusTriggerOnClose: !0,
|
|
1143
1174
|
trigger: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }),
|
|
1144
1175
|
children: [
|
|
1145
|
-
/* @__PURE__ */
|
|
1176
|
+
/* @__PURE__ */ v(te.Item, { ref: m, onClick: () => g(w.CONFUSING), children: [
|
|
1146
1177
|
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
1147
1178
|
` ${o.markUnclear}`
|
|
1148
1179
|
] }),
|
|
1149
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ v(te.Item, { ref: d, onClick: () => g(w.IMPORTANT), children: [
|
|
1150
1181
|
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
1151
1182
|
` ${o.markImportant}`
|
|
1152
1183
|
] })
|
|
@@ -1161,7 +1192,7 @@ function Ae(n, e) {
|
|
|
1161
1192
|
day: "numeric"
|
|
1162
1193
|
});
|
|
1163
1194
|
}
|
|
1164
|
-
const
|
|
1195
|
+
const In = ({
|
|
1165
1196
|
noteId: n,
|
|
1166
1197
|
date: e,
|
|
1167
1198
|
highlight: t,
|
|
@@ -1169,28 +1200,28 @@ const Cn = ({
|
|
|
1169
1200
|
type: r,
|
|
1170
1201
|
onClick: i,
|
|
1171
1202
|
onDelete: l,
|
|
1172
|
-
onSaveNote:
|
|
1203
|
+
onSaveNote: a,
|
|
1173
1204
|
onTypeChange: m,
|
|
1174
|
-
isActive:
|
|
1205
|
+
isActive: d,
|
|
1175
1206
|
isPanelView: g = !1,
|
|
1176
1207
|
courseName: h,
|
|
1177
1208
|
locale: u,
|
|
1178
|
-
highlightTheme:
|
|
1209
|
+
highlightTheme: S,
|
|
1179
1210
|
renderLink: f,
|
|
1180
|
-
href:
|
|
1211
|
+
href: y
|
|
1181
1212
|
}) => {
|
|
1182
|
-
const { translations:
|
|
1213
|
+
const { translations: E } = G(), [H, F] = W(!1), [N, I] = W(!1), [k, x] = W(o || ""), [O, _] = W(!1), M = Y(null), D = K((p) => {
|
|
1183
1214
|
M.current = p;
|
|
1184
1215
|
}, []);
|
|
1185
1216
|
Q(() => {
|
|
1186
1217
|
var p;
|
|
1187
|
-
|
|
1188
|
-
}, [
|
|
1189
|
-
const
|
|
1218
|
+
d && ((p = M.current) == null || p.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
1219
|
+
}, [d]);
|
|
1220
|
+
const J = r === w.IMPORTANT ? E.important : E.unclear, R = (p) => {
|
|
1190
1221
|
p.key === "Enter" && (p.preventDefault(), i == null || i());
|
|
1191
|
-
}, b = [
|
|
1222
|
+
}, b = [J, E.note];
|
|
1192
1223
|
t && b.push(t), o && b.push(o), e && b.push(Ae(e, u)), h && b.push(h);
|
|
1193
|
-
const P = b.join(", "), L = /* @__PURE__ */
|
|
1224
|
+
const P = b.join(", "), L = /* @__PURE__ */ v(
|
|
1194
1225
|
z,
|
|
1195
1226
|
{
|
|
1196
1227
|
as: "div",
|
|
@@ -1198,69 +1229,69 @@ const Cn = ({
|
|
|
1198
1229
|
borderRadius: "medium",
|
|
1199
1230
|
padding: "small",
|
|
1200
1231
|
position: "relative",
|
|
1201
|
-
role:
|
|
1202
|
-
"aria-label":
|
|
1203
|
-
"aria-pressed":
|
|
1204
|
-
tabIndex:
|
|
1232
|
+
role: y || N ? void 0 : "button",
|
|
1233
|
+
"aria-label": y ? void 0 : P,
|
|
1234
|
+
"aria-pressed": y || N ? void 0 : d,
|
|
1235
|
+
tabIndex: y || d ? -1 : 0,
|
|
1205
1236
|
"data-testid": "note-card",
|
|
1206
1237
|
elementRef: D,
|
|
1207
|
-
onClick:
|
|
1238
|
+
onClick: d ? void 0 : i,
|
|
1208
1239
|
onMouseEnter: () => F(!0),
|
|
1209
1240
|
onMouseLeave: () => F(!1),
|
|
1210
|
-
onKeyDown:
|
|
1241
|
+
onKeyDown: d ? void 0 : R,
|
|
1211
1242
|
cursor: N ? "default" : "pointer",
|
|
1212
1243
|
children: [
|
|
1213
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ v(C, { direction: "column", gap: "small", children: [
|
|
1214
1245
|
/* @__PURE__ */ s(
|
|
1215
1246
|
Ve,
|
|
1216
1247
|
{
|
|
1217
1248
|
type: r,
|
|
1218
1249
|
onTypeChange: g && m ? (p) => m(n, p) : void 0,
|
|
1219
|
-
renderAsMenuTrigger: g && !!m && !!
|
|
1250
|
+
renderAsMenuTrigger: g && !!m && !!d
|
|
1220
1251
|
}
|
|
1221
1252
|
),
|
|
1222
|
-
t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children:
|
|
1253
|
+
t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children: d && g ? /* @__PURE__ */ s(
|
|
1223
1254
|
he,
|
|
1224
1255
|
{
|
|
1225
1256
|
type: r,
|
|
1226
|
-
isCardActive: !!
|
|
1227
|
-
theme:
|
|
1257
|
+
isCardActive: !!d || H,
|
|
1258
|
+
theme: S,
|
|
1228
1259
|
children: t
|
|
1229
1260
|
}
|
|
1230
1261
|
) : /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
|
|
1231
1262
|
he,
|
|
1232
1263
|
{
|
|
1233
1264
|
type: r,
|
|
1234
|
-
isCardActive: !!
|
|
1235
|
-
theme:
|
|
1265
|
+
isCardActive: !!d || H,
|
|
1266
|
+
theme: S,
|
|
1236
1267
|
children: t
|
|
1237
1268
|
}
|
|
1238
1269
|
) }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
N && g ? /* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ v(C, { direction: "column", gap: "small", children: [
|
|
1271
|
+
N && g ? /* @__PURE__ */ v(C, { direction: "column", gap: "x-small", children: [
|
|
1241
1272
|
/* @__PURE__ */ s(
|
|
1242
1273
|
He,
|
|
1243
1274
|
{
|
|
1244
|
-
label: /* @__PURE__ */ s(Me, { children:
|
|
1275
|
+
label: /* @__PURE__ */ s(Me, { children: E.editNote }),
|
|
1245
1276
|
value: k,
|
|
1246
1277
|
onChange: (p) => x(p.target.value),
|
|
1247
|
-
placeholder:
|
|
1278
|
+
placeholder: E.addNoteOptional
|
|
1248
1279
|
}
|
|
1249
1280
|
),
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */ s(
|
|
1281
|
+
/* @__PURE__ */ v(C, { gap: "xx-small", children: [
|
|
1282
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1252
1283
|
$,
|
|
1253
1284
|
{
|
|
1254
1285
|
display: "block",
|
|
1255
1286
|
size: "small",
|
|
1256
1287
|
"data-testid": "note-card-cancel",
|
|
1257
1288
|
onClick: () => {
|
|
1258
|
-
x(o || ""),
|
|
1289
|
+
x(o || ""), I(!1);
|
|
1259
1290
|
},
|
|
1260
|
-
children:
|
|
1291
|
+
children: E.cancel
|
|
1261
1292
|
}
|
|
1262
1293
|
) }),
|
|
1263
|
-
/* @__PURE__ */ s(
|
|
1294
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1264
1295
|
$,
|
|
1265
1296
|
{
|
|
1266
1297
|
display: "block",
|
|
@@ -1268,14 +1299,14 @@ const Cn = ({
|
|
|
1268
1299
|
size: "small",
|
|
1269
1300
|
"data-testid": "note-card-save",
|
|
1270
1301
|
onClick: () => {
|
|
1271
|
-
|
|
1302
|
+
a == null || a(n, k), I(!1);
|
|
1272
1303
|
},
|
|
1273
1304
|
interaction: k.trim() ? "enabled" : "disabled",
|
|
1274
|
-
children:
|
|
1305
|
+
children: E.save
|
|
1275
1306
|
}
|
|
1276
1307
|
) })
|
|
1277
1308
|
] })
|
|
1278
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children:
|
|
1309
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: d && g ? /* @__PURE__ */ v(U, { children: [
|
|
1279
1310
|
o,
|
|
1280
1311
|
" ",
|
|
1281
1312
|
/* @__PURE__ */ s(
|
|
@@ -1284,16 +1315,16 @@ const Cn = ({
|
|
|
1284
1315
|
size: "small",
|
|
1285
1316
|
withBackground: !1,
|
|
1286
1317
|
withBorder: !1,
|
|
1287
|
-
screenReaderLabel:
|
|
1318
|
+
screenReaderLabel: E.editNote,
|
|
1288
1319
|
"data-testid": "note-card-edit",
|
|
1289
1320
|
onClick: (p) => {
|
|
1290
|
-
p.stopPropagation(),
|
|
1321
|
+
p.stopPropagation(), I(!0);
|
|
1291
1322
|
},
|
|
1292
1323
|
children: /* @__PURE__ */ s(fe, {})
|
|
1293
1324
|
}
|
|
1294
1325
|
)
|
|
1295
|
-
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g &&
|
|
1296
|
-
|
|
1326
|
+
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && d ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ v(U, { color: "secondary", children: [
|
|
1327
|
+
E.addNotePrompt,
|
|
1297
1328
|
" ",
|
|
1298
1329
|
/* @__PURE__ */ s(
|
|
1299
1330
|
V,
|
|
@@ -1301,25 +1332,25 @@ const Cn = ({
|
|
|
1301
1332
|
size: "small",
|
|
1302
1333
|
withBackground: !1,
|
|
1303
1334
|
withBorder: !1,
|
|
1304
|
-
screenReaderLabel:
|
|
1335
|
+
screenReaderLabel: E.editNote,
|
|
1305
1336
|
"data-testid": "note-card-edit",
|
|
1306
1337
|
onClick: (p) => {
|
|
1307
|
-
p.stopPropagation(),
|
|
1338
|
+
p.stopPropagation(), I(!0);
|
|
1308
1339
|
},
|
|
1309
1340
|
children: /* @__PURE__ */ s(fe, {})
|
|
1310
1341
|
}
|
|
1311
1342
|
)
|
|
1312
1343
|
] }) }) : null,
|
|
1313
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ v(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1314
1345
|
/* @__PURE__ */ s(U, { size: "small", color: "secondary", children: Ae(e, u) }),
|
|
1315
|
-
|
|
1346
|
+
d && l && /* @__PURE__ */ s(
|
|
1316
1347
|
V,
|
|
1317
1348
|
{
|
|
1318
1349
|
size: "small",
|
|
1319
1350
|
withBackground: !1,
|
|
1320
1351
|
withBorder: !1,
|
|
1321
1352
|
color: "danger",
|
|
1322
|
-
screenReaderLabel:
|
|
1353
|
+
screenReaderLabel: E.deleteNote,
|
|
1323
1354
|
"data-testid": "note-card-delete",
|
|
1324
1355
|
onClick: (p) => {
|
|
1325
1356
|
p.stopPropagation(), _(!0);
|
|
@@ -1344,8 +1375,8 @@ const Cn = ({
|
|
|
1344
1375
|
insetInlineStart: "0",
|
|
1345
1376
|
insetInlineEnd: "0",
|
|
1346
1377
|
stacking: "above",
|
|
1347
|
-
children: /* @__PURE__ */
|
|
1348
|
-
|
|
1378
|
+
children: /* @__PURE__ */ v(
|
|
1379
|
+
C,
|
|
1349
1380
|
{
|
|
1350
1381
|
direction: "column",
|
|
1351
1382
|
justifyItems: "center",
|
|
@@ -1364,7 +1395,7 @@ const Cn = ({
|
|
|
1364
1395
|
onClick: (p) => {
|
|
1365
1396
|
p.stopPropagation(), l(n), _(!1);
|
|
1366
1397
|
},
|
|
1367
|
-
children:
|
|
1398
|
+
children: E.deleteNote
|
|
1368
1399
|
}
|
|
1369
1400
|
),
|
|
1370
1401
|
/* @__PURE__ */ s(
|
|
@@ -1376,7 +1407,7 @@ const Cn = ({
|
|
|
1376
1407
|
onClick: (p) => {
|
|
1377
1408
|
p.stopPropagation(), _(!1);
|
|
1378
1409
|
},
|
|
1379
|
-
children:
|
|
1410
|
+
children: E.cancel
|
|
1380
1411
|
}
|
|
1381
1412
|
)
|
|
1382
1413
|
]
|
|
@@ -1387,7 +1418,7 @@ const Cn = ({
|
|
|
1387
1418
|
]
|
|
1388
1419
|
}
|
|
1389
1420
|
);
|
|
1390
|
-
return
|
|
1421
|
+
return y && f ? f({ href: y, children: L, ariaLabel: P }) : L;
|
|
1391
1422
|
};
|
|
1392
1423
|
function xn(n, e) {
|
|
1393
1424
|
const t = Array.from({ length: e }, () => []);
|
|
@@ -1398,7 +1429,6 @@ function xn(n, e) {
|
|
|
1398
1429
|
const wn = {
|
|
1399
1430
|
display: "flex",
|
|
1400
1431
|
gap: "1rem",
|
|
1401
|
-
padding: "1rem",
|
|
1402
1432
|
boxSizing: "border-box",
|
|
1403
1433
|
width: "100%",
|
|
1404
1434
|
alignItems: "flex-start"
|
|
@@ -1416,28 +1446,28 @@ const wn = {
|
|
|
1416
1446
|
onPreviousPage: r,
|
|
1417
1447
|
onNextPage: i,
|
|
1418
1448
|
onNoteSelect: l,
|
|
1419
|
-
onNoteDelete:
|
|
1449
|
+
onNoteDelete: a,
|
|
1420
1450
|
onNoteSave: m,
|
|
1421
|
-
onNoteTypeChange:
|
|
1451
|
+
onNoteTypeChange: d,
|
|
1422
1452
|
selectedNoteId: g,
|
|
1423
1453
|
hasActiveFilter: h = !1,
|
|
1424
1454
|
columnCount: u = 1,
|
|
1425
|
-
highlightTheme:
|
|
1455
|
+
highlightTheme: S,
|
|
1426
1456
|
locale: f,
|
|
1427
|
-
renderNoteLink:
|
|
1428
|
-
noteHref:
|
|
1457
|
+
renderNoteLink: y,
|
|
1458
|
+
noteHref: E
|
|
1429
1459
|
}) => {
|
|
1430
1460
|
const { translations: H } = G(), F = re(
|
|
1431
1461
|
() => xn(n, u),
|
|
1432
1462
|
[n, u]
|
|
1433
1463
|
), N = (o == null ? void 0 : o.hasNextPage) || (o == null ? void 0 : o.hasPreviousPage);
|
|
1434
|
-
return e ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(at, { renderTitle: H.loadingNotes }) }) : t ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(ae, { level: "h4", children: H.failedToLoadNotes }) }) : n.length === 0 ? /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(
|
|
1435
|
-
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children: F.map((
|
|
1464
|
+
return e ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(at, { renderTitle: H.loadingNotes }) }) : t ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(ae, { level: "h4", children: H.failedToLoadNotes }) }) : n.length === 0 ? /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(Tn, { hasActiveFilter: h }) }) : /* @__PURE__ */ v(Ye, { children: [
|
|
1465
|
+
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children: F.map((I, k) => (
|
|
1436
1466
|
// oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
|
|
1437
|
-
/* @__PURE__ */ s("div", { style: kn, children:
|
|
1467
|
+
/* @__PURE__ */ s("div", { style: kn, children: I.map((x) => {
|
|
1438
1468
|
var O;
|
|
1439
1469
|
return /* @__PURE__ */ s(
|
|
1440
|
-
|
|
1470
|
+
In,
|
|
1441
1471
|
{
|
|
1442
1472
|
noteId: x.id,
|
|
1443
1473
|
date: x.createdAt,
|
|
@@ -1447,19 +1477,19 @@ const wn = {
|
|
|
1447
1477
|
isActive: g === x.id,
|
|
1448
1478
|
isPanelView: !!g,
|
|
1449
1479
|
onClick: l ? () => l(x.id) : void 0,
|
|
1450
|
-
onDelete:
|
|
1480
|
+
onDelete: a ? (_) => a(_) : void 0,
|
|
1451
1481
|
onSaveNote: m ? (_, M) => m(_, M) : void 0,
|
|
1452
|
-
onTypeChange:
|
|
1453
|
-
highlightTheme:
|
|
1482
|
+
onTypeChange: d ? (_, M) => d(_, M) : void 0,
|
|
1483
|
+
highlightTheme: S,
|
|
1454
1484
|
locale: f,
|
|
1455
|
-
renderLink:
|
|
1456
|
-
href:
|
|
1485
|
+
renderLink: y,
|
|
1486
|
+
href: E ? E(x.id, x) : void 0
|
|
1457
1487
|
},
|
|
1458
1488
|
x.id
|
|
1459
1489
|
);
|
|
1460
1490
|
}) }, k)
|
|
1461
1491
|
)) }),
|
|
1462
|
-
N && /* @__PURE__ */
|
|
1492
|
+
N && /* @__PURE__ */ v(C, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
|
|
1463
1493
|
/* @__PURE__ */ s(
|
|
1464
1494
|
V,
|
|
1465
1495
|
{
|
|
@@ -1492,37 +1522,37 @@ const wn = {
|
|
|
1492
1522
|
onSave: r,
|
|
1493
1523
|
onDelete: i,
|
|
1494
1524
|
onTypeChange: l,
|
|
1495
|
-
onBack:
|
|
1525
|
+
onBack: a,
|
|
1496
1526
|
editing: m = !1
|
|
1497
1527
|
}) => {
|
|
1498
|
-
const { translations:
|
|
1499
|
-
return /* @__PURE__ */
|
|
1528
|
+
const { translations: d } = G(), [g, h] = W(m), [u, S] = W(n || ""), [f, y] = W(!1);
|
|
1529
|
+
return /* @__PURE__ */ v(C, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1500
1530
|
t != null ? /* @__PURE__ */ s(z, { as: "div", children: /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(he, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1501
1531
|
/* @__PURE__ */ s(Ve, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1502
|
-
g ? /* @__PURE__ */
|
|
1532
|
+
g ? /* @__PURE__ */ v(C, { direction: "column", gap: "x-small", children: [
|
|
1503
1533
|
/* @__PURE__ */ s(
|
|
1504
1534
|
He,
|
|
1505
1535
|
{
|
|
1506
|
-
label:
|
|
1536
|
+
label: d.addNoteOptional,
|
|
1507
1537
|
value: u,
|
|
1508
|
-
onChange: (
|
|
1538
|
+
onChange: (E) => S(E.target.value),
|
|
1509
1539
|
resize: "vertical"
|
|
1510
1540
|
}
|
|
1511
1541
|
),
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */ s(
|
|
1542
|
+
/* @__PURE__ */ v(C, { gap: "xx-small", children: [
|
|
1543
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1514
1544
|
$,
|
|
1515
1545
|
{
|
|
1516
1546
|
display: "block",
|
|
1517
1547
|
size: "small",
|
|
1518
1548
|
"data-testid": "single-note-cancel",
|
|
1519
1549
|
onClick: () => {
|
|
1520
|
-
|
|
1550
|
+
S(n || ""), h(!1);
|
|
1521
1551
|
},
|
|
1522
|
-
children:
|
|
1552
|
+
children: d.cancel
|
|
1523
1553
|
}
|
|
1524
1554
|
) }),
|
|
1525
|
-
/* @__PURE__ */ s(
|
|
1555
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1526
1556
|
$,
|
|
1527
1557
|
{
|
|
1528
1558
|
display: "block",
|
|
@@ -1532,27 +1562,27 @@ const wn = {
|
|
|
1532
1562
|
onClick: () => {
|
|
1533
1563
|
r(u), h(!1);
|
|
1534
1564
|
},
|
|
1535
|
-
children:
|
|
1565
|
+
children: d.save
|
|
1536
1566
|
}
|
|
1537
1567
|
) })
|
|
1538
1568
|
] })
|
|
1539
|
-
] }) : /* @__PURE__ */
|
|
1540
|
-
n && /* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children:
|
|
1569
|
+
] }) : /* @__PURE__ */ v(C, { direction: "column", gap: "small", children: [
|
|
1570
|
+
n && /* @__PURE__ */ v(z, { as: "div", children: [
|
|
1571
|
+
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children: d.note }),
|
|
1542
1572
|
/* @__PURE__ */ s(U, { children: n })
|
|
1543
1573
|
] }),
|
|
1544
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ v(C, { justifyItems: "space-between", children: [
|
|
1545
1575
|
/* @__PURE__ */ s(
|
|
1546
1576
|
$,
|
|
1547
1577
|
{
|
|
1548
1578
|
size: "small",
|
|
1549
1579
|
renderIcon: /* @__PURE__ */ s(st, {}),
|
|
1550
1580
|
"data-testid": "single-note-back",
|
|
1551
|
-
onClick: () =>
|
|
1552
|
-
children:
|
|
1581
|
+
onClick: () => a == null ? void 0 : a(),
|
|
1582
|
+
children: d.back
|
|
1553
1583
|
}
|
|
1554
1584
|
),
|
|
1555
|
-
/* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ v(C, { gap: "xx-small", children: [
|
|
1556
1586
|
i && /* @__PURE__ */ s(
|
|
1557
1587
|
V,
|
|
1558
1588
|
{
|
|
@@ -1560,9 +1590,9 @@ const wn = {
|
|
|
1560
1590
|
withBackground: !1,
|
|
1561
1591
|
withBorder: !1,
|
|
1562
1592
|
color: "danger",
|
|
1563
|
-
screenReaderLabel:
|
|
1593
|
+
screenReaderLabel: d.deleteNote,
|
|
1564
1594
|
"data-testid": "single-note-delete",
|
|
1565
|
-
onClick: () =>
|
|
1595
|
+
onClick: () => y(!0),
|
|
1566
1596
|
children: /* @__PURE__ */ s(le, {})
|
|
1567
1597
|
}
|
|
1568
1598
|
),
|
|
@@ -1572,7 +1602,7 @@ const wn = {
|
|
|
1572
1602
|
size: "small",
|
|
1573
1603
|
withBackground: !1,
|
|
1574
1604
|
withBorder: !1,
|
|
1575
|
-
screenReaderLabel:
|
|
1605
|
+
screenReaderLabel: d.editNote,
|
|
1576
1606
|
"data-testid": "single-note-edit",
|
|
1577
1607
|
onClick: () => h(!0),
|
|
1578
1608
|
children: /* @__PURE__ */ s(fe, {})
|
|
@@ -1580,7 +1610,7 @@ const wn = {
|
|
|
1580
1610
|
)
|
|
1581
1611
|
] })
|
|
1582
1612
|
] }),
|
|
1583
|
-
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */
|
|
1613
|
+
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ v(C, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1584
1614
|
/* @__PURE__ */ s(
|
|
1585
1615
|
$,
|
|
1586
1616
|
{
|
|
@@ -1590,9 +1620,9 @@ const wn = {
|
|
|
1590
1620
|
renderIcon: /* @__PURE__ */ s(le, {}),
|
|
1591
1621
|
"data-testid": "single-note-confirm-delete",
|
|
1592
1622
|
onClick: () => {
|
|
1593
|
-
i(),
|
|
1623
|
+
i(), y(!1);
|
|
1594
1624
|
},
|
|
1595
|
-
children:
|
|
1625
|
+
children: d.deleteNote
|
|
1596
1626
|
}
|
|
1597
1627
|
),
|
|
1598
1628
|
/* @__PURE__ */ s(
|
|
@@ -1601,8 +1631,8 @@ const wn = {
|
|
|
1601
1631
|
display: "block",
|
|
1602
1632
|
size: "small",
|
|
1603
1633
|
"data-testid": "single-note-cancel-delete",
|
|
1604
|
-
onClick: () =>
|
|
1605
|
-
children:
|
|
1634
|
+
onClick: () => y(!1),
|
|
1635
|
+
children: d.cancel
|
|
1606
1636
|
}
|
|
1607
1637
|
)
|
|
1608
1638
|
] }) })
|
|
@@ -1613,17 +1643,17 @@ export {
|
|
|
1613
1643
|
Vn as ContentWithNoteWrapper,
|
|
1614
1644
|
he as Highlight,
|
|
1615
1645
|
Qe as HighlightError,
|
|
1616
|
-
|
|
1646
|
+
In as NoteCard,
|
|
1617
1647
|
Ve as NoteChip,
|
|
1618
1648
|
yn as NoteReactionMenu,
|
|
1619
|
-
|
|
1649
|
+
Tn as NotebookEmptyState,
|
|
1620
1650
|
Qn as NotebookProvider,
|
|
1621
1651
|
pn as NotebookTranslationsProvider,
|
|
1622
1652
|
Jn as NotebookTray,
|
|
1623
1653
|
eo as NotesListView,
|
|
1624
1654
|
w as REACTION_TYPE,
|
|
1625
1655
|
to as SingleNote,
|
|
1626
|
-
|
|
1656
|
+
Te as createTransparentColor,
|
|
1627
1657
|
Dt as useCreateNote,
|
|
1628
1658
|
Lt as useDeleteNote,
|
|
1629
1659
|
$e as useGetNotes,
|