@instructure/platform-notebook 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ContentWithNoteWrapper.d.ts.map +1 -1
- package/dist/NoteCard.d.ts.map +1 -1
- package/dist/NoteReactionMenu.d.ts.map +1 -1
- package/dist/NotebookProvider.d.ts +2 -1
- package/dist/NotebookProvider.d.ts.map +1 -1
- package/dist/NotesListView.d.ts.map +1 -1
- package/dist/index.js +399 -370
- 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 Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as
|
|
1
|
+
import { jsx as s, jsxs as T, Fragment as Ye } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as V, useEffect as ee, 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 {
|
|
16
|
-
import { CloseButton as it, Button as $, IconButton as V } from "@instructure/ui-buttons";
|
|
16
|
+
import { CloseButton as it, Button as $, IconButton as Q } 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) => {
|
|
@@ -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 Y(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 && Y.fromRange(n, a);
|
|
388
388
|
o.push({
|
|
389
389
|
id: i.id,
|
|
390
390
|
reaction: i.reaction,
|
|
@@ -415,22 +415,22 @@ const ze = (n) => {
|
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: t, id: o } = n, { range: r } = t ?? {};
|
|
417
417
|
r && ((l = Y.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Rt({ id: o });
|
|
418
|
-
},
|
|
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
|
|
513
|
-
|
|
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 M = wt(E).filter((N) => N.textContent && N.textContent.length > 0);
|
|
513
|
+
M.forEach((N, I) => {
|
|
514
514
|
var Z;
|
|
515
515
|
const k = N.parentElement;
|
|
516
516
|
if ((k == null ? void 0 : k.dataset.highlightId) === o) return;
|
|
517
|
-
const x =
|
|
518
|
-
let
|
|
519
|
-
_ ?
|
|
517
|
+
const x = I === 0, O = I === M.length - 1, _ = M.length === 1;
|
|
518
|
+
let F;
|
|
519
|
+
_ ? F = "single" : x ? F = "first" : O ? F = "last" : F = "middle";
|
|
520
520
|
const D = document.createElement("span");
|
|
521
|
-
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position =
|
|
521
|
+
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = F, 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
|
}), (Z = N.parentNode) == null || Z.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 = V(!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 =
|
|
769
|
-
return
|
|
774
|
+
const { translations: t } = G(), o = V(null), r = V(null);
|
|
775
|
+
return ee(() => {
|
|
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__ */ T(te, { children: [
|
|
787
|
+
/* @__PURE__ */ T(
|
|
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__ */ T(
|
|
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,115 +831,114 @@ function Vn({
|
|
|
800
831
|
},
|
|
801
832
|
courseId: l,
|
|
802
833
|
pageSize: 100
|
|
803
|
-
}), { mutate: u } = Dt(o), { mutate:
|
|
804
|
-
|
|
834
|
+
}), { mutate: u } = Dt(o), { mutate: S } = At(o), { mutate: f } = Lt(o), y = V([]), [E, H] = W([]), [M, N] = W(null), [I, k] = W(""), [x, O] = W(null), [_, F] = W(!1);
|
|
835
|
+
ee(() => {
|
|
805
836
|
const R = n.current;
|
|
806
837
|
if (!R) return;
|
|
807
838
|
const b = R.closest(".user_content") ?? R;
|
|
808
839
|
if (b.classList.contains("enhanced")) {
|
|
809
|
-
|
|
840
|
+
F(!0);
|
|
810
841
|
return;
|
|
811
842
|
}
|
|
812
843
|
const P = new MutationObserver((L) => {
|
|
813
844
|
for (const p of L)
|
|
814
845
|
if (p.type === "attributes" && p.attributeName === "class" && p.target.classList.contains("enhanced")) {
|
|
815
|
-
|
|
846
|
+
F(!0), P.disconnect();
|
|
816
847
|
return;
|
|
817
848
|
}
|
|
818
849
|
});
|
|
819
850
|
return P.observe(b, { attributes: !0, attributeFilter: ["class"] }), () => P.disconnect();
|
|
820
|
-
}, [n]),
|
|
851
|
+
}, [n]), ee(() => {
|
|
821
852
|
if (!_ || !n.current) return;
|
|
822
853
|
let b = null;
|
|
823
854
|
const P = () => {
|
|
824
855
|
b && clearTimeout(b), b = setTimeout(() => {
|
|
825
856
|
var xe;
|
|
826
|
-
const
|
|
827
|
-
if (!(
|
|
828
|
-
const j =
|
|
857
|
+
const v = window.getSelection(), A = n.current;
|
|
858
|
+
if (!(v != null && v.rangeCount) || !A) return;
|
|
859
|
+
const j = v.toString().trim();
|
|
829
860
|
if (j === "") return;
|
|
830
|
-
const J =
|
|
861
|
+
const J = v.getRangeAt(0);
|
|
831
862
|
if (!A.contains(J.commonAncestorContainer)) return;
|
|
832
|
-
const
|
|
833
|
-
|
|
863
|
+
const Ie = (xe = X.fromRange(A, J)) == null ? void 0 : xe.toSelector();
|
|
864
|
+
Ie && !It(Ie, E) && (N(J.cloneRange()), k(j), O(Ct(J)));
|
|
834
865
|
}, t);
|
|
835
|
-
}, L = (
|
|
836
|
-
if (!(
|
|
866
|
+
}, L = (v) => {
|
|
867
|
+
if (!(v.target instanceof Node)) return;
|
|
837
868
|
const A = document.getElementById(de);
|
|
838
|
-
A != null && A.contains(
|
|
869
|
+
A != null && A.contains(v.target) ? (v.preventDefault(), v.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 && It(m);
|
|
847
|
-
}, [m]);
|
|
876
|
+
}, [_, E, t, n]);
|
|
848
877
|
const D = K(
|
|
849
878
|
(R) => {
|
|
850
879
|
var j;
|
|
851
880
|
const b = n.current;
|
|
852
881
|
if (!b || !R.highlightData) return null;
|
|
853
|
-
const { highlightData: P, reaction: L, id: p } = R, { range:
|
|
882
|
+
const { highlightData: P, reaction: L, id: p } = R, { range: v } = P, A = v && ((j = Y.fromSelector(b, v)) == null ? void 0 : j.toRange());
|
|
854
883
|
if (A) {
|
|
855
884
|
const J = {
|
|
856
885
|
id: p,
|
|
857
886
|
selectedNoteId: m,
|
|
858
887
|
type: L[0],
|
|
859
888
|
onClick: () => {
|
|
860
|
-
|
|
889
|
+
d(p), g();
|
|
861
890
|
}
|
|
862
891
|
};
|
|
863
892
|
return kt(A, J, e), P.textPosition;
|
|
864
893
|
}
|
|
865
894
|
return null;
|
|
866
895
|
},
|
|
867
|
-
[n, m, e,
|
|
896
|
+
[n, m, e, d, g]
|
|
868
897
|
);
|
|
869
|
-
|
|
898
|
+
ee(() => {
|
|
870
899
|
if (!_ || !h || !n.current) return;
|
|
871
900
|
const R = n.current, b = h.notes, P = /* @__PURE__ */ new Set(), L = [], p = [];
|
|
872
901
|
if (b.length === 0) {
|
|
873
|
-
if (
|
|
874
|
-
for (const
|
|
875
|
-
Le(
|
|
876
|
-
|
|
902
|
+
if (y.current.length > 0) {
|
|
903
|
+
for (const v of y.current)
|
|
904
|
+
Le(v, R);
|
|
905
|
+
y.current = [], H([]);
|
|
877
906
|
}
|
|
878
907
|
return;
|
|
879
908
|
}
|
|
880
|
-
if (
|
|
881
|
-
const { notesForUpdate:
|
|
909
|
+
if (a && b[0].highlightData.pageLastModifiedAt !== a) {
|
|
910
|
+
const { notesForUpdate: v, noteIdsForDelete: A } = vt(
|
|
882
911
|
R,
|
|
883
912
|
b,
|
|
884
|
-
|
|
913
|
+
a
|
|
885
914
|
);
|
|
886
|
-
for (const j of
|
|
887
|
-
|
|
915
|
+
for (const j of v)
|
|
916
|
+
S({ id: j.id, input: j });
|
|
888
917
|
for (const j of A)
|
|
889
918
|
f(j);
|
|
890
919
|
} else {
|
|
891
|
-
for (const
|
|
892
|
-
const A = D(
|
|
893
|
-
P.add(
|
|
920
|
+
for (const v of b) {
|
|
921
|
+
const A = D(v);
|
|
922
|
+
P.add(v.id), A && (L.push(v), p.push(A));
|
|
894
923
|
}
|
|
895
|
-
for (const
|
|
896
|
-
P.has(
|
|
897
|
-
H(p),
|
|
924
|
+
for (const v of y.current)
|
|
925
|
+
P.has(v.id) || Le(v, R);
|
|
926
|
+
H(p), y.current = L, m && Tt(m);
|
|
898
927
|
}
|
|
899
928
|
}, [
|
|
900
929
|
_,
|
|
901
930
|
h,
|
|
902
931
|
D,
|
|
903
|
-
|
|
932
|
+
a,
|
|
904
933
|
n,
|
|
905
|
-
|
|
906
|
-
f
|
|
934
|
+
S,
|
|
935
|
+
f,
|
|
936
|
+
m
|
|
907
937
|
]);
|
|
908
938
|
const Z = (R) => {
|
|
909
939
|
const b = n.current;
|
|
910
|
-
if (!
|
|
911
|
-
const P = Y.fromRange(b,
|
|
940
|
+
if (!M || !b) return;
|
|
941
|
+
const P = Y.fromRange(b, M), L = X.fromRange(b, M);
|
|
912
942
|
u(
|
|
913
943
|
{
|
|
914
944
|
courseId: l,
|
|
@@ -917,22 +947,22 @@ function Vn({
|
|
|
917
947
|
userText: "",
|
|
918
948
|
reaction: [R],
|
|
919
949
|
highlightData: {
|
|
920
|
-
selectedText:
|
|
950
|
+
selectedText: I,
|
|
921
951
|
textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
|
|
922
952
|
range: P.toSelector(),
|
|
923
|
-
pageLastModifiedAt:
|
|
953
|
+
pageLastModifiedAt: a ?? ""
|
|
924
954
|
}
|
|
925
955
|
},
|
|
926
956
|
{
|
|
927
957
|
onSuccess: (p) => {
|
|
928
958
|
var A;
|
|
929
|
-
const
|
|
930
|
-
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(),
|
|
959
|
+
const v = p.id;
|
|
960
|
+
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(), d(v), g();
|
|
931
961
|
}
|
|
932
962
|
}
|
|
933
963
|
);
|
|
934
964
|
};
|
|
935
|
-
return !
|
|
965
|
+
return !M || !x ? null : Ze(
|
|
936
966
|
/* @__PURE__ */ s(
|
|
937
967
|
"div",
|
|
938
968
|
{
|
|
@@ -967,7 +997,7 @@ const En = (n, e) => ({
|
|
|
967
997
|
}) => {
|
|
968
998
|
const r = En(e, o), l = {
|
|
969
999
|
position: "relative",
|
|
970
|
-
backgroundColor: t ? r.backgroundColor :
|
|
1000
|
+
backgroundColor: t ? r.backgroundColor : Te(r.backgroundColor, 0.5),
|
|
971
1001
|
textDecorationLine: "underline",
|
|
972
1002
|
textDecorationStyle: r.underlineStyle,
|
|
973
1003
|
textDecorationColor: r.underlineColor,
|
|
@@ -978,9 +1008,9 @@ const En = (n, e) => ({
|
|
|
978
1008
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: n });
|
|
979
1009
|
}, Qe = () => {
|
|
980
1010
|
const { translations: n } = G();
|
|
981
|
-
return /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */ s(
|
|
983
|
-
/* @__PURE__ */ s(
|
|
1011
|
+
return /* @__PURE__ */ T(C, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1012
|
+
/* @__PURE__ */ s(C.Item, { as: "div", children: /* @__PURE__ */ s(tt, { color: "error" }) }),
|
|
1013
|
+
/* @__PURE__ */ s(C.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(me, { maxLines: 3, children: n.highlightUnavailable }) })
|
|
984
1014
|
] });
|
|
985
1015
|
}, Sn = {
|
|
986
1016
|
filter: null,
|
|
@@ -1006,26 +1036,26 @@ function Yn({
|
|
|
1006
1036
|
learningObject: o,
|
|
1007
1037
|
pageSize: r = 16
|
|
1008
1038
|
}) {
|
|
1009
|
-
const [i, l] = Fe(vn, Sn), { filter:
|
|
1010
|
-
|
|
1011
|
-
Object.keys(
|
|
1039
|
+
const [i, l] = Fe(vn, Sn), { filter: a, courseFilter: m, pageParamsWithDirection: d } = i;
|
|
1040
|
+
ee(() => {
|
|
1041
|
+
Object.keys(d).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
|
|
1012
1042
|
}, [r]);
|
|
1013
|
-
const g = t ? m : e, { direction: h, pageParams: u } =
|
|
1043
|
+
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
1044
|
api: n,
|
|
1015
1045
|
filter: {
|
|
1016
1046
|
...g ? { courseId: g } : {},
|
|
1017
|
-
...
|
|
1047
|
+
...a ? { reactions: [a] } : {},
|
|
1018
1048
|
...o ? { learningObject: o } : {}
|
|
1019
1049
|
},
|
|
1020
|
-
cursor:
|
|
1050
|
+
cursor: S,
|
|
1021
1051
|
direction: h,
|
|
1022
1052
|
pageSize: r
|
|
1023
|
-
}), H = (f == null ? void 0 : f.notes) ?? [],
|
|
1053
|
+
}), H = (f == null ? void 0 : f.notes) ?? [], M = f == null ? void 0 : f.pageInfo, N = K(() => {
|
|
1024
1054
|
l({
|
|
1025
1055
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1026
1056
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "next" }
|
|
1027
1057
|
});
|
|
1028
|
-
}, [f == null ? void 0 : f.pageInfo]),
|
|
1058
|
+
}, [f == null ? void 0 : f.pageInfo]), I = K(() => {
|
|
1029
1059
|
l({
|
|
1030
1060
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1031
1061
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "prev" }
|
|
@@ -1037,15 +1067,15 @@ function Yn({
|
|
|
1037
1067
|
}, []);
|
|
1038
1068
|
return {
|
|
1039
1069
|
notes: H,
|
|
1040
|
-
pageInfo:
|
|
1041
|
-
isLoading:
|
|
1042
|
-
isError:
|
|
1043
|
-
filter:
|
|
1070
|
+
pageInfo: M,
|
|
1071
|
+
isLoading: y,
|
|
1072
|
+
isError: E,
|
|
1073
|
+
filter: a,
|
|
1044
1074
|
courseFilter: m,
|
|
1045
1075
|
setFilter: k,
|
|
1046
1076
|
setCourseFilter: x,
|
|
1047
1077
|
fetchNextPage: N,
|
|
1048
|
-
fetchPreviousPage:
|
|
1078
|
+
fetchPreviousPage: I
|
|
1049
1079
|
};
|
|
1050
1080
|
}
|
|
1051
1081
|
const ue = "all";
|
|
@@ -1058,8 +1088,8 @@ function Zn({ filter: n, setFilter: e }) {
|
|
|
1058
1088
|
],
|
|
1059
1089
|
[t]
|
|
1060
1090
|
), r = K(
|
|
1061
|
-
(l, { value:
|
|
1062
|
-
e(!
|
|
1091
|
+
(l, { value: a }) => {
|
|
1092
|
+
e(!a || a === ue ? null : a);
|
|
1063
1093
|
},
|
|
1064
1094
|
[e]
|
|
1065
1095
|
);
|
|
@@ -1080,9 +1110,9 @@ function Zn({ filter: n, setFilter: e }) {
|
|
|
1080
1110
|
handleReactionFilterChange: r
|
|
1081
1111
|
};
|
|
1082
1112
|
}
|
|
1083
|
-
const
|
|
1113
|
+
const Tn = ({ hasActiveFilter: n = !1 }) => {
|
|
1084
1114
|
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__ */
|
|
1115
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ T(C, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1086
1116
|
!n && /* @__PURE__ */ s(nt, { size: "medium" }),
|
|
1087
1117
|
/* @__PURE__ */ s(ae, { level: "h3", children: t }),
|
|
1088
1118
|
/* @__PURE__ */ s(U, { color: "secondary", children: o })
|
|
@@ -1097,8 +1127,8 @@ const In = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1097
1127
|
onDismiss: t,
|
|
1098
1128
|
placement: "end",
|
|
1099
1129
|
size: "regular",
|
|
1100
|
-
children: /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */ s(
|
|
1130
|
+
children: /* @__PURE__ */ T(C, { direction: "column", height: "100vh", children: [
|
|
1131
|
+
/* @__PURE__ */ s(C.Item, { children: /* @__PURE__ */ s(z, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ T(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1102
1132
|
/* @__PURE__ */ s(ae, { level: "h3", children: o.notebook }),
|
|
1103
1133
|
/* @__PURE__ */ s(
|
|
1104
1134
|
it,
|
|
@@ -1110,11 +1140,11 @@ const In = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1110
1140
|
}
|
|
1111
1141
|
)
|
|
1112
1142
|
] }) }) }),
|
|
1113
|
-
/* @__PURE__ */ s(
|
|
1143
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
|
|
1114
1144
|
] })
|
|
1115
1145
|
}
|
|
1116
1146
|
);
|
|
1117
|
-
},
|
|
1147
|
+
}, Cn = {
|
|
1118
1148
|
[w.IMPORTANT]: {
|
|
1119
1149
|
color: "success",
|
|
1120
1150
|
translationKey: "important",
|
|
@@ -1126,27 +1156,27 @@ const In = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1126
1156
|
icon: /* @__PURE__ */ s(Ne, { size: "x-small" })
|
|
1127
1157
|
}
|
|
1128
1158
|
}, Ve = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
|
|
1129
|
-
const { translations: o } = G(), r =
|
|
1159
|
+
const { translations: o } = G(), r = Cn[n], i = o[r.translationKey], [l, a] = W(!1), m = V(null), d = V(null), g = K(
|
|
1130
1160
|
(h) => {
|
|
1131
|
-
e == null || e(h),
|
|
1161
|
+
e == null || e(h), a(!1);
|
|
1132
1162
|
},
|
|
1133
1163
|
[e]
|
|
1134
1164
|
);
|
|
1135
|
-
return t && e ? /* @__PURE__ */
|
|
1136
|
-
|
|
1165
|
+
return t && e ? /* @__PURE__ */ T(
|
|
1166
|
+
te,
|
|
1137
1167
|
{
|
|
1138
1168
|
placement: "bottom start",
|
|
1139
1169
|
show: l,
|
|
1140
|
-
onToggle: (h) =>
|
|
1170
|
+
onToggle: (h) => a(h),
|
|
1141
1171
|
shouldHideOnSelect: !0,
|
|
1142
1172
|
shouldFocusTriggerOnClose: !0,
|
|
1143
1173
|
trigger: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }),
|
|
1144
1174
|
children: [
|
|
1145
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ T(te.Item, { ref: m, onClick: () => g(w.CONFUSING), children: [
|
|
1146
1176
|
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
1147
1177
|
` ${o.markUnclear}`
|
|
1148
1178
|
] }),
|
|
1149
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ T(te.Item, { ref: d, onClick: () => g(w.IMPORTANT), children: [
|
|
1150
1180
|
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
1151
1181
|
` ${o.markImportant}`
|
|
1152
1182
|
] })
|
|
@@ -1161,7 +1191,7 @@ function Ae(n, e) {
|
|
|
1161
1191
|
day: "numeric"
|
|
1162
1192
|
});
|
|
1163
1193
|
}
|
|
1164
|
-
const
|
|
1194
|
+
const In = ({
|
|
1165
1195
|
noteId: n,
|
|
1166
1196
|
date: e,
|
|
1167
1197
|
highlight: t,
|
|
@@ -1169,28 +1199,28 @@ const Cn = ({
|
|
|
1169
1199
|
type: r,
|
|
1170
1200
|
onClick: i,
|
|
1171
1201
|
onDelete: l,
|
|
1172
|
-
onSaveNote:
|
|
1202
|
+
onSaveNote: a,
|
|
1173
1203
|
onTypeChange: m,
|
|
1174
|
-
isActive:
|
|
1204
|
+
isActive: d,
|
|
1175
1205
|
isPanelView: g = !1,
|
|
1176
1206
|
courseName: h,
|
|
1177
1207
|
locale: u,
|
|
1178
|
-
highlightTheme:
|
|
1208
|
+
highlightTheme: S,
|
|
1179
1209
|
renderLink: f,
|
|
1180
|
-
href:
|
|
1210
|
+
href: y
|
|
1181
1211
|
}) => {
|
|
1182
|
-
const { translations:
|
|
1183
|
-
|
|
1212
|
+
const { translations: E } = G(), [H, M] = W(!1), [N, I] = W(!1), [k, x] = W(o || ""), [O, _] = W(!1), F = V(null), D = K((p) => {
|
|
1213
|
+
F.current = p;
|
|
1184
1214
|
}, []);
|
|
1185
|
-
|
|
1186
|
-
var p;
|
|
1187
|
-
|
|
1188
|
-
}, [
|
|
1189
|
-
const Z = r === w.IMPORTANT ?
|
|
1215
|
+
ee(() => {
|
|
1216
|
+
var p, v;
|
|
1217
|
+
d && ((p = F.current) == null || p.scrollIntoView({ behavior: "smooth", block: "nearest" }), (v = F.current) == null || v.focus());
|
|
1218
|
+
}, [d]);
|
|
1219
|
+
const Z = r === w.IMPORTANT ? E.important : E.unclear, R = (p) => {
|
|
1190
1220
|
p.key === "Enter" && (p.preventDefault(), i == null || i());
|
|
1191
|
-
}, b = [Z,
|
|
1221
|
+
}, b = [Z, E.note];
|
|
1192
1222
|
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__ */
|
|
1223
|
+
const P = b.join(", "), L = /* @__PURE__ */ T(
|
|
1194
1224
|
z,
|
|
1195
1225
|
{
|
|
1196
1226
|
as: "div",
|
|
@@ -1198,69 +1228,69 @@ const Cn = ({
|
|
|
1198
1228
|
borderRadius: "medium",
|
|
1199
1229
|
padding: "small",
|
|
1200
1230
|
position: "relative",
|
|
1201
|
-
role:
|
|
1202
|
-
"aria-label":
|
|
1203
|
-
"aria-pressed":
|
|
1204
|
-
tabIndex:
|
|
1231
|
+
role: y || N ? void 0 : "button",
|
|
1232
|
+
"aria-label": y ? void 0 : P,
|
|
1233
|
+
"aria-pressed": y || N ? void 0 : d,
|
|
1234
|
+
tabIndex: y || d ? -1 : 0,
|
|
1205
1235
|
"data-testid": "note-card",
|
|
1206
1236
|
elementRef: D,
|
|
1207
|
-
onClick:
|
|
1208
|
-
onMouseEnter: () =>
|
|
1209
|
-
onMouseLeave: () =>
|
|
1210
|
-
onKeyDown:
|
|
1237
|
+
onClick: d ? void 0 : i,
|
|
1238
|
+
onMouseEnter: () => M(!0),
|
|
1239
|
+
onMouseLeave: () => M(!1),
|
|
1240
|
+
onKeyDown: d ? void 0 : R,
|
|
1211
1241
|
cursor: N ? "default" : "pointer",
|
|
1212
1242
|
children: [
|
|
1213
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ T(C, { direction: "column", gap: "small", children: [
|
|
1214
1244
|
/* @__PURE__ */ s(
|
|
1215
1245
|
Ve,
|
|
1216
1246
|
{
|
|
1217
1247
|
type: r,
|
|
1218
1248
|
onTypeChange: g && m ? (p) => m(n, p) : void 0,
|
|
1219
|
-
renderAsMenuTrigger: g && !!m && !!
|
|
1249
|
+
renderAsMenuTrigger: g && !!m && !!d
|
|
1220
1250
|
}
|
|
1221
1251
|
),
|
|
1222
|
-
t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children:
|
|
1252
|
+
t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children: d && g ? /* @__PURE__ */ s(
|
|
1223
1253
|
he,
|
|
1224
1254
|
{
|
|
1225
1255
|
type: r,
|
|
1226
|
-
isCardActive: !!
|
|
1227
|
-
theme:
|
|
1256
|
+
isCardActive: !!d || H,
|
|
1257
|
+
theme: S,
|
|
1228
1258
|
children: t
|
|
1229
1259
|
}
|
|
1230
1260
|
) : /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
|
|
1231
1261
|
he,
|
|
1232
1262
|
{
|
|
1233
1263
|
type: r,
|
|
1234
|
-
isCardActive: !!
|
|
1235
|
-
theme:
|
|
1264
|
+
isCardActive: !!d || H,
|
|
1265
|
+
theme: S,
|
|
1236
1266
|
children: t
|
|
1237
1267
|
}
|
|
1238
1268
|
) }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
N && g ? /* @__PURE__ */
|
|
1269
|
+
/* @__PURE__ */ T(C, { direction: "column", gap: "small", children: [
|
|
1270
|
+
N && g ? /* @__PURE__ */ T(C, { direction: "column", gap: "x-small", children: [
|
|
1241
1271
|
/* @__PURE__ */ s(
|
|
1242
1272
|
He,
|
|
1243
1273
|
{
|
|
1244
|
-
label: /* @__PURE__ */ s(Me, { children:
|
|
1274
|
+
label: /* @__PURE__ */ s(Me, { children: E.editNote }),
|
|
1245
1275
|
value: k,
|
|
1246
1276
|
onChange: (p) => x(p.target.value),
|
|
1247
|
-
placeholder:
|
|
1277
|
+
placeholder: E.addNoteOptional
|
|
1248
1278
|
}
|
|
1249
1279
|
),
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */ s(
|
|
1280
|
+
/* @__PURE__ */ T(C, { gap: "xx-small", children: [
|
|
1281
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1252
1282
|
$,
|
|
1253
1283
|
{
|
|
1254
1284
|
display: "block",
|
|
1255
1285
|
size: "small",
|
|
1256
1286
|
"data-testid": "note-card-cancel",
|
|
1257
1287
|
onClick: () => {
|
|
1258
|
-
x(o || ""),
|
|
1288
|
+
x(o || ""), I(!1);
|
|
1259
1289
|
},
|
|
1260
|
-
children:
|
|
1290
|
+
children: E.cancel
|
|
1261
1291
|
}
|
|
1262
1292
|
) }),
|
|
1263
|
-
/* @__PURE__ */ s(
|
|
1293
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1264
1294
|
$,
|
|
1265
1295
|
{
|
|
1266
1296
|
display: "block",
|
|
@@ -1268,58 +1298,58 @@ const Cn = ({
|
|
|
1268
1298
|
size: "small",
|
|
1269
1299
|
"data-testid": "note-card-save",
|
|
1270
1300
|
onClick: () => {
|
|
1271
|
-
|
|
1301
|
+
a == null || a(n, k), I(!1);
|
|
1272
1302
|
},
|
|
1273
1303
|
interaction: k.trim() ? "enabled" : "disabled",
|
|
1274
|
-
children:
|
|
1304
|
+
children: E.save
|
|
1275
1305
|
}
|
|
1276
1306
|
) })
|
|
1277
1307
|
] })
|
|
1278
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children:
|
|
1308
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: d && g ? /* @__PURE__ */ T(U, { children: [
|
|
1279
1309
|
o,
|
|
1280
1310
|
" ",
|
|
1281
1311
|
/* @__PURE__ */ s(
|
|
1282
|
-
|
|
1312
|
+
Q,
|
|
1283
1313
|
{
|
|
1284
1314
|
size: "small",
|
|
1285
1315
|
withBackground: !1,
|
|
1286
1316
|
withBorder: !1,
|
|
1287
|
-
screenReaderLabel:
|
|
1317
|
+
screenReaderLabel: E.editNote,
|
|
1288
1318
|
"data-testid": "note-card-edit",
|
|
1289
1319
|
onClick: (p) => {
|
|
1290
|
-
p.stopPropagation(),
|
|
1320
|
+
p.stopPropagation(), I(!0);
|
|
1291
1321
|
},
|
|
1292
1322
|
children: /* @__PURE__ */ s(fe, {})
|
|
1293
1323
|
}
|
|
1294
1324
|
)
|
|
1295
|
-
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g &&
|
|
1296
|
-
|
|
1325
|
+
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && d ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ T(U, { color: "secondary", children: [
|
|
1326
|
+
E.addNotePrompt,
|
|
1297
1327
|
" ",
|
|
1298
1328
|
/* @__PURE__ */ s(
|
|
1299
|
-
|
|
1329
|
+
Q,
|
|
1300
1330
|
{
|
|
1301
1331
|
size: "small",
|
|
1302
1332
|
withBackground: !1,
|
|
1303
1333
|
withBorder: !1,
|
|
1304
|
-
screenReaderLabel:
|
|
1334
|
+
screenReaderLabel: E.editNote,
|
|
1305
1335
|
"data-testid": "note-card-edit",
|
|
1306
1336
|
onClick: (p) => {
|
|
1307
|
-
p.stopPropagation(),
|
|
1337
|
+
p.stopPropagation(), I(!0);
|
|
1308
1338
|
},
|
|
1309
1339
|
children: /* @__PURE__ */ s(fe, {})
|
|
1310
1340
|
}
|
|
1311
1341
|
)
|
|
1312
1342
|
] }) }) : null,
|
|
1313
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ T(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1314
1344
|
/* @__PURE__ */ s(U, { size: "small", color: "secondary", children: Ae(e, u) }),
|
|
1315
|
-
|
|
1316
|
-
|
|
1345
|
+
d && l && /* @__PURE__ */ s(
|
|
1346
|
+
Q,
|
|
1317
1347
|
{
|
|
1318
1348
|
size: "small",
|
|
1319
1349
|
withBackground: !1,
|
|
1320
1350
|
withBorder: !1,
|
|
1321
1351
|
color: "danger",
|
|
1322
|
-
screenReaderLabel:
|
|
1352
|
+
screenReaderLabel: E.deleteNote,
|
|
1323
1353
|
"data-testid": "note-card-delete",
|
|
1324
1354
|
onClick: (p) => {
|
|
1325
1355
|
p.stopPropagation(), _(!0);
|
|
@@ -1344,8 +1374,8 @@ const Cn = ({
|
|
|
1344
1374
|
insetInlineStart: "0",
|
|
1345
1375
|
insetInlineEnd: "0",
|
|
1346
1376
|
stacking: "above",
|
|
1347
|
-
children: /* @__PURE__ */
|
|
1348
|
-
|
|
1377
|
+
children: /* @__PURE__ */ T(
|
|
1378
|
+
C,
|
|
1349
1379
|
{
|
|
1350
1380
|
direction: "column",
|
|
1351
1381
|
justifyItems: "center",
|
|
@@ -1364,7 +1394,7 @@ const Cn = ({
|
|
|
1364
1394
|
onClick: (p) => {
|
|
1365
1395
|
p.stopPropagation(), l(n), _(!1);
|
|
1366
1396
|
},
|
|
1367
|
-
children:
|
|
1397
|
+
children: E.deleteNote
|
|
1368
1398
|
}
|
|
1369
1399
|
),
|
|
1370
1400
|
/* @__PURE__ */ s(
|
|
@@ -1376,7 +1406,7 @@ const Cn = ({
|
|
|
1376
1406
|
onClick: (p) => {
|
|
1377
1407
|
p.stopPropagation(), _(!1);
|
|
1378
1408
|
},
|
|
1379
|
-
children:
|
|
1409
|
+
children: E.cancel
|
|
1380
1410
|
}
|
|
1381
1411
|
)
|
|
1382
1412
|
]
|
|
@@ -1387,7 +1417,7 @@ const Cn = ({
|
|
|
1387
1417
|
]
|
|
1388
1418
|
}
|
|
1389
1419
|
);
|
|
1390
|
-
return
|
|
1420
|
+
return y && f ? f({ href: y, children: L, ariaLabel: P }) : L;
|
|
1391
1421
|
};
|
|
1392
1422
|
function xn(n, e) {
|
|
1393
1423
|
const t = Array.from({ length: e }, () => []);
|
|
@@ -1398,7 +1428,6 @@ function xn(n, e) {
|
|
|
1398
1428
|
const wn = {
|
|
1399
1429
|
display: "flex",
|
|
1400
1430
|
gap: "1rem",
|
|
1401
|
-
padding: "1rem",
|
|
1402
1431
|
boxSizing: "border-box",
|
|
1403
1432
|
width: "100%",
|
|
1404
1433
|
alignItems: "flex-start"
|
|
@@ -1416,28 +1445,28 @@ const wn = {
|
|
|
1416
1445
|
onPreviousPage: r,
|
|
1417
1446
|
onNextPage: i,
|
|
1418
1447
|
onNoteSelect: l,
|
|
1419
|
-
onNoteDelete:
|
|
1448
|
+
onNoteDelete: a,
|
|
1420
1449
|
onNoteSave: m,
|
|
1421
|
-
onNoteTypeChange:
|
|
1450
|
+
onNoteTypeChange: d,
|
|
1422
1451
|
selectedNoteId: g,
|
|
1423
1452
|
hasActiveFilter: h = !1,
|
|
1424
1453
|
columnCount: u = 1,
|
|
1425
|
-
highlightTheme:
|
|
1454
|
+
highlightTheme: S,
|
|
1426
1455
|
locale: f,
|
|
1427
|
-
renderNoteLink:
|
|
1428
|
-
noteHref:
|
|
1456
|
+
renderNoteLink: y,
|
|
1457
|
+
noteHref: E
|
|
1429
1458
|
}) => {
|
|
1430
|
-
const { translations: H } = G(),
|
|
1459
|
+
const { translations: H } = G(), M = re(
|
|
1431
1460
|
() => xn(n, u),
|
|
1432
1461
|
[n, u]
|
|
1433
1462
|
), 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:
|
|
1463
|
+
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__ */ T(Ye, { children: [
|
|
1464
|
+
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children: M.map((I, k) => (
|
|
1436
1465
|
// oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
|
|
1437
|
-
/* @__PURE__ */ s("div", { style: kn, children:
|
|
1466
|
+
/* @__PURE__ */ s("div", { style: kn, children: I.map((x) => {
|
|
1438
1467
|
var O;
|
|
1439
1468
|
return /* @__PURE__ */ s(
|
|
1440
|
-
|
|
1469
|
+
In,
|
|
1441
1470
|
{
|
|
1442
1471
|
noteId: x.id,
|
|
1443
1472
|
date: x.createdAt,
|
|
@@ -1447,21 +1476,21 @@ const wn = {
|
|
|
1447
1476
|
isActive: g === x.id,
|
|
1448
1477
|
isPanelView: !!g,
|
|
1449
1478
|
onClick: l ? () => l(x.id) : void 0,
|
|
1450
|
-
onDelete:
|
|
1451
|
-
onSaveNote: m ? (_,
|
|
1452
|
-
onTypeChange:
|
|
1453
|
-
highlightTheme:
|
|
1479
|
+
onDelete: a ? (_) => a(_) : void 0,
|
|
1480
|
+
onSaveNote: m ? (_, F) => m(_, F) : void 0,
|
|
1481
|
+
onTypeChange: d ? (_, F) => d(_, F) : void 0,
|
|
1482
|
+
highlightTheme: S,
|
|
1454
1483
|
locale: f,
|
|
1455
|
-
renderLink:
|
|
1456
|
-
href:
|
|
1484
|
+
renderLink: y,
|
|
1485
|
+
href: E ? E(x.id, x) : void 0
|
|
1457
1486
|
},
|
|
1458
1487
|
x.id
|
|
1459
1488
|
);
|
|
1460
1489
|
}) }, k)
|
|
1461
1490
|
)) }),
|
|
1462
|
-
N && /* @__PURE__ */
|
|
1491
|
+
N && /* @__PURE__ */ T(C, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
|
|
1463
1492
|
/* @__PURE__ */ s(
|
|
1464
|
-
|
|
1493
|
+
Q,
|
|
1465
1494
|
{
|
|
1466
1495
|
size: "small",
|
|
1467
1496
|
screenReaderLabel: H.previousPage,
|
|
@@ -1472,7 +1501,7 @@ const wn = {
|
|
|
1472
1501
|
}
|
|
1473
1502
|
),
|
|
1474
1503
|
/* @__PURE__ */ s(
|
|
1475
|
-
|
|
1504
|
+
Q,
|
|
1476
1505
|
{
|
|
1477
1506
|
size: "small",
|
|
1478
1507
|
screenReaderLabel: H.nextPage,
|
|
@@ -1492,37 +1521,37 @@ const wn = {
|
|
|
1492
1521
|
onSave: r,
|
|
1493
1522
|
onDelete: i,
|
|
1494
1523
|
onTypeChange: l,
|
|
1495
|
-
onBack:
|
|
1524
|
+
onBack: a,
|
|
1496
1525
|
editing: m = !1
|
|
1497
1526
|
}) => {
|
|
1498
|
-
const { translations:
|
|
1499
|
-
return /* @__PURE__ */
|
|
1527
|
+
const { translations: d } = G(), [g, h] = W(m), [u, S] = W(n || ""), [f, y] = W(!1);
|
|
1528
|
+
return /* @__PURE__ */ T(C, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1500
1529
|
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
1530
|
/* @__PURE__ */ s(Ve, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1502
|
-
g ? /* @__PURE__ */
|
|
1531
|
+
g ? /* @__PURE__ */ T(C, { direction: "column", gap: "x-small", children: [
|
|
1503
1532
|
/* @__PURE__ */ s(
|
|
1504
1533
|
He,
|
|
1505
1534
|
{
|
|
1506
|
-
label:
|
|
1535
|
+
label: d.addNoteOptional,
|
|
1507
1536
|
value: u,
|
|
1508
|
-
onChange: (
|
|
1537
|
+
onChange: (E) => S(E.target.value),
|
|
1509
1538
|
resize: "vertical"
|
|
1510
1539
|
}
|
|
1511
1540
|
),
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */ s(
|
|
1541
|
+
/* @__PURE__ */ T(C, { gap: "xx-small", children: [
|
|
1542
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1514
1543
|
$,
|
|
1515
1544
|
{
|
|
1516
1545
|
display: "block",
|
|
1517
1546
|
size: "small",
|
|
1518
1547
|
"data-testid": "single-note-cancel",
|
|
1519
1548
|
onClick: () => {
|
|
1520
|
-
|
|
1549
|
+
S(n || ""), h(!1);
|
|
1521
1550
|
},
|
|
1522
|
-
children:
|
|
1551
|
+
children: d.cancel
|
|
1523
1552
|
}
|
|
1524
1553
|
) }),
|
|
1525
|
-
/* @__PURE__ */ s(
|
|
1554
|
+
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1526
1555
|
$,
|
|
1527
1556
|
{
|
|
1528
1557
|
display: "block",
|
|
@@ -1532,47 +1561,47 @@ const wn = {
|
|
|
1532
1561
|
onClick: () => {
|
|
1533
1562
|
r(u), h(!1);
|
|
1534
1563
|
},
|
|
1535
|
-
children:
|
|
1564
|
+
children: d.save
|
|
1536
1565
|
}
|
|
1537
1566
|
) })
|
|
1538
1567
|
] })
|
|
1539
|
-
] }) : /* @__PURE__ */
|
|
1540
|
-
n && /* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children:
|
|
1568
|
+
] }) : /* @__PURE__ */ T(C, { direction: "column", gap: "small", children: [
|
|
1569
|
+
n && /* @__PURE__ */ T(z, { as: "div", children: [
|
|
1570
|
+
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children: d.note }),
|
|
1542
1571
|
/* @__PURE__ */ s(U, { children: n })
|
|
1543
1572
|
] }),
|
|
1544
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ T(C, { justifyItems: "space-between", children: [
|
|
1545
1574
|
/* @__PURE__ */ s(
|
|
1546
1575
|
$,
|
|
1547
1576
|
{
|
|
1548
1577
|
size: "small",
|
|
1549
1578
|
renderIcon: /* @__PURE__ */ s(st, {}),
|
|
1550
1579
|
"data-testid": "single-note-back",
|
|
1551
|
-
onClick: () =>
|
|
1552
|
-
children:
|
|
1580
|
+
onClick: () => a == null ? void 0 : a(),
|
|
1581
|
+
children: d.back
|
|
1553
1582
|
}
|
|
1554
1583
|
),
|
|
1555
|
-
/* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ T(C, { gap: "xx-small", children: [
|
|
1556
1585
|
i && /* @__PURE__ */ s(
|
|
1557
|
-
|
|
1586
|
+
Q,
|
|
1558
1587
|
{
|
|
1559
1588
|
size: "small",
|
|
1560
1589
|
withBackground: !1,
|
|
1561
1590
|
withBorder: !1,
|
|
1562
1591
|
color: "danger",
|
|
1563
|
-
screenReaderLabel:
|
|
1592
|
+
screenReaderLabel: d.deleteNote,
|
|
1564
1593
|
"data-testid": "single-note-delete",
|
|
1565
|
-
onClick: () =>
|
|
1594
|
+
onClick: () => y(!0),
|
|
1566
1595
|
children: /* @__PURE__ */ s(le, {})
|
|
1567
1596
|
}
|
|
1568
1597
|
),
|
|
1569
1598
|
/* @__PURE__ */ s(
|
|
1570
|
-
|
|
1599
|
+
Q,
|
|
1571
1600
|
{
|
|
1572
1601
|
size: "small",
|
|
1573
1602
|
withBackground: !1,
|
|
1574
1603
|
withBorder: !1,
|
|
1575
|
-
screenReaderLabel:
|
|
1604
|
+
screenReaderLabel: d.editNote,
|
|
1576
1605
|
"data-testid": "single-note-edit",
|
|
1577
1606
|
onClick: () => h(!0),
|
|
1578
1607
|
children: /* @__PURE__ */ s(fe, {})
|
|
@@ -1580,7 +1609,7 @@ const wn = {
|
|
|
1580
1609
|
)
|
|
1581
1610
|
] })
|
|
1582
1611
|
] }),
|
|
1583
|
-
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */
|
|
1612
|
+
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ T(C, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1584
1613
|
/* @__PURE__ */ s(
|
|
1585
1614
|
$,
|
|
1586
1615
|
{
|
|
@@ -1590,9 +1619,9 @@ const wn = {
|
|
|
1590
1619
|
renderIcon: /* @__PURE__ */ s(le, {}),
|
|
1591
1620
|
"data-testid": "single-note-confirm-delete",
|
|
1592
1621
|
onClick: () => {
|
|
1593
|
-
i(),
|
|
1622
|
+
i(), y(!1);
|
|
1594
1623
|
},
|
|
1595
|
-
children:
|
|
1624
|
+
children: d.deleteNote
|
|
1596
1625
|
}
|
|
1597
1626
|
),
|
|
1598
1627
|
/* @__PURE__ */ s(
|
|
@@ -1601,8 +1630,8 @@ const wn = {
|
|
|
1601
1630
|
display: "block",
|
|
1602
1631
|
size: "small",
|
|
1603
1632
|
"data-testid": "single-note-cancel-delete",
|
|
1604
|
-
onClick: () =>
|
|
1605
|
-
children:
|
|
1633
|
+
onClick: () => y(!1),
|
|
1634
|
+
children: d.cancel
|
|
1606
1635
|
}
|
|
1607
1636
|
)
|
|
1608
1637
|
] }) })
|
|
@@ -1613,17 +1642,17 @@ export {
|
|
|
1613
1642
|
Vn as ContentWithNoteWrapper,
|
|
1614
1643
|
he as Highlight,
|
|
1615
1644
|
Qe as HighlightError,
|
|
1616
|
-
|
|
1645
|
+
In as NoteCard,
|
|
1617
1646
|
Ve as NoteChip,
|
|
1618
1647
|
yn as NoteReactionMenu,
|
|
1619
|
-
|
|
1648
|
+
Tn as NotebookEmptyState,
|
|
1620
1649
|
Qn as NotebookProvider,
|
|
1621
1650
|
pn as NotebookTranslationsProvider,
|
|
1622
1651
|
Jn as NotebookTray,
|
|
1623
1652
|
eo as NotesListView,
|
|
1624
1653
|
w as REACTION_TYPE,
|
|
1625
1654
|
to as SingleNote,
|
|
1626
|
-
|
|
1655
|
+
Te as createTransparentColor,
|
|
1627
1656
|
Dt as useCreateNote,
|
|
1628
1657
|
Lt as useDeleteNote,
|
|
1629
1658
|
$e as useGetNotes,
|