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