hyperbook 0.84.4 → 0.85.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/assets/bootstrap.js +248 -0
- package/dist/assets/cloud.js +28 -17
- package/dist/assets/directive-abc-music/client.js +11 -3
- package/dist/assets/directive-archive/client.js +17 -4
- package/dist/assets/directive-audio/client.js +67 -28
- package/dist/assets/directive-bookmarks/client.js +9 -1
- package/dist/assets/directive-download/client.js +10 -2
- package/dist/assets/directive-embed/client.js +112 -0
- package/dist/assets/directive-embed/style.css +70 -1
- package/dist/assets/directive-excalidraw/client.js +9 -0
- package/dist/assets/directive-excalidraw/hyperbook-excalidraw.umd.js +1 -1
- package/dist/assets/directive-geogebra/client.js +16 -3
- package/dist/assets/directive-h5p/client.js +32 -3
- package/dist/assets/directive-learningmap/client.js +11 -3
- package/dist/assets/directive-mermaid/client.js +11 -1
- package/dist/assets/directive-multievent/multievent.js +2 -2
- package/dist/assets/directive-onlineide/client.js +7 -0
- package/dist/assets/directive-onlineide/include/online-ide-embedded.js +43 -43
- package/dist/assets/directive-p5/client.js +39 -7
- package/dist/assets/directive-protect/client.js +11 -3
- package/dist/assets/directive-pyide/client.js +20 -9
- package/dist/assets/directive-scratchblock/client.js +9 -0
- package/dist/assets/directive-slideshow/client.js +12 -4
- package/dist/assets/directive-sqlide/client.js +7 -0
- package/dist/assets/directive-sqlide/include/sql-ide-embedded.js +3 -3
- package/dist/assets/directive-tabs/client.js +14 -3
- package/dist/assets/directive-textinput/client.js +14 -3
- package/dist/assets/directive-webide/client.js +45 -10
- package/dist/assets/directive-youtube/client.js +99 -0
- package/dist/assets/directive-youtube/style.css +63 -0
- package/dist/assets/hyperbook.types.js +209 -0
- package/dist/assets/i18n.js +15 -1
- package/dist/assets/store.js +174 -139
- package/dist/assets/ui.js +279 -0
- package/dist/index.js +632 -413
- package/dist/locales/de.json +9 -1
- package/dist/locales/en.json +9 -1
- package/package.json +4 -4
- package/dist/assets/client.js +0 -506
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
/// <reference path="../hyperbook.types.js" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GeoGebra math applet integration.
|
|
5
|
+
* @type {HyperbookGeogebra}
|
|
6
|
+
* @memberof hyperbook
|
|
7
|
+
* @see hyperbook.store
|
|
8
|
+
*/
|
|
1
9
|
hyperbook.geogebra = (function () {
|
|
2
10
|
async function init(root) {
|
|
3
11
|
const els = root.getElementsByTagName("hyperbook-geogebra");
|
|
4
12
|
for (const el of els) {
|
|
5
13
|
const id = el.getAttribute("data-id");
|
|
6
14
|
|
|
7
|
-
const result = await store.geogebra.get(id);
|
|
15
|
+
const result = await hyperbook.store.geogebra.get(id);
|
|
8
16
|
if (result && result.state) {
|
|
9
17
|
el.setBase64(result.state);
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
el.registerUpdateListener(() => {
|
|
13
21
|
el.getBase64((b) => {
|
|
14
|
-
store.geogebra.put({ id, state: b });
|
|
22
|
+
hyperbook.store.geogebra.put({ id, state: b });
|
|
15
23
|
});
|
|
16
24
|
});
|
|
17
25
|
}
|
|
@@ -33,5 +41,10 @@ hyperbook.geogebra = (function () {
|
|
|
33
41
|
|
|
34
42
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
// Initialize existing elements on document load
|
|
45
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
46
|
+
init(document);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return { init };
|
|
37
50
|
})();
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/// <reference path="../hyperbook.types.js" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* H5P interactive content integration.
|
|
5
|
+
* @type {HyperbookH5p}
|
|
6
|
+
* @memberof hyperbook
|
|
7
|
+
* @see hyperbook.store
|
|
8
|
+
*/
|
|
1
9
|
hyperbook.h5p = (function () {
|
|
2
10
|
/**
|
|
3
11
|
* Initialize H5P elements within the given root element.
|
|
@@ -7,7 +15,7 @@ hyperbook.h5p = (function () {
|
|
|
7
15
|
const save = (id) =>
|
|
8
16
|
H5P.getUserData(id, "state", (error, userData) => {
|
|
9
17
|
if (!error) {
|
|
10
|
-
store.h5p.put({ id, userData });
|
|
18
|
+
hyperbook.store.h5p.put({ id, userData });
|
|
11
19
|
}
|
|
12
20
|
});
|
|
13
21
|
|
|
@@ -33,7 +41,7 @@ hyperbook.h5p = (function () {
|
|
|
33
41
|
const src = el.getAttribute("data-src");
|
|
34
42
|
const id = el.getAttribute("data-id");
|
|
35
43
|
if (h5pFrame && src) {
|
|
36
|
-
const result = await store.h5p.get(id);
|
|
44
|
+
const result = await hyperbook.store.h5p.get(id);
|
|
37
45
|
const h5pOptions = {
|
|
38
46
|
...h5pBaseOptions,
|
|
39
47
|
id,
|
|
@@ -51,5 +59,26 @@ hyperbook.h5p = (function () {
|
|
|
51
59
|
}
|
|
52
60
|
};
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
// Initialize existing elements on document load
|
|
63
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
64
|
+
init(document);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Observe for new elements added to the DOM
|
|
68
|
+
const observer = new MutationObserver((mutations) => {
|
|
69
|
+
mutations.forEach((mutation) => {
|
|
70
|
+
mutation.addedNodes.forEach((node) => {
|
|
71
|
+
if (
|
|
72
|
+
node.nodeType === 1 &&
|
|
73
|
+
node.classList.contains("directive-h5p")
|
|
74
|
+
) {
|
|
75
|
+
init(node);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
82
|
+
|
|
83
|
+
return { init, save };
|
|
55
84
|
})();
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/// <reference path="../hyperbook.types.js" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Learning map visualization and progress tracking.
|
|
5
|
+
* @type {HyperbookLearningmap}
|
|
6
|
+
* @memberof hyperbook
|
|
7
|
+
* @see hyperbook.store
|
|
8
|
+
*/
|
|
1
9
|
hyperbook.learningmap = (function () {
|
|
2
10
|
async function init(root) {
|
|
3
11
|
const elems = root.getElementsByClassName("directive-learningmap");
|
|
@@ -5,12 +13,12 @@ hyperbook.learningmap = (function () {
|
|
|
5
13
|
for (let elem of elems) {
|
|
6
14
|
const map = elem.getElementsByTagName("hyperbook-learningmap")[0];
|
|
7
15
|
if (map) {
|
|
8
|
-
const result = await store.learningmap.get(elem.id);
|
|
16
|
+
const result = await hyperbook.store.learningmap.get(elem.id);
|
|
9
17
|
if (result) {
|
|
10
18
|
map.initialState = result;
|
|
11
19
|
}
|
|
12
20
|
map.addEventListener("change", function (event) {
|
|
13
|
-
store.learningmap
|
|
21
|
+
hyperbook.store.learningmap
|
|
14
22
|
.update(elem.id, {
|
|
15
23
|
id: elem.id,
|
|
16
24
|
nodes: event.detail.nodes,
|
|
@@ -20,7 +28,7 @@ hyperbook.learningmap = (function () {
|
|
|
20
28
|
})
|
|
21
29
|
.then((updated) => {
|
|
22
30
|
if (updated == 0) {
|
|
23
|
-
store.learningmap.put({
|
|
31
|
+
hyperbook.store.learningmap.put({
|
|
24
32
|
id: elem.id,
|
|
25
33
|
nodes: event.detail.nodes,
|
|
26
34
|
x: event.detail.x,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/// <reference path="../hyperbook.types.js" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mermaid diagram rendering.
|
|
5
|
+
* @type {HyperbookMermaid}
|
|
6
|
+
* @memberof hyperbook
|
|
7
|
+
*/
|
|
1
8
|
hyperbook.mermaid = (function () {
|
|
2
9
|
const elementCode = ".directive-mermaid";
|
|
3
10
|
|
|
@@ -69,7 +76,10 @@ hyperbook.mermaid = (function () {
|
|
|
69
76
|
});
|
|
70
77
|
};
|
|
71
78
|
|
|
72
|
-
|
|
79
|
+
// Initialize existing elements on document load
|
|
80
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
81
|
+
init();
|
|
82
|
+
});
|
|
73
83
|
|
|
74
84
|
// Observe for new elements added to the DOM
|
|
75
85
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -204,14 +204,14 @@ var multievent = {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
await store.multievent.put({
|
|
207
|
+
await hyperbook.store.multievent.put({
|
|
208
208
|
id: "multievent_" + clNr + "_" + window.location.pathname,
|
|
209
209
|
state: JSON.stringify(state)
|
|
210
210
|
});
|
|
211
211
|
},
|
|
212
212
|
loadState: async function (clNr) {
|
|
213
213
|
try {
|
|
214
|
-
var record = await store.multievent.get("multievent_" + clNr + "_" + window.location.pathname);
|
|
214
|
+
var record = await hyperbook.store.multievent.get("multievent_" + clNr + "_" + window.location.pathname);
|
|
215
215
|
if (!record) return false;
|
|
216
216
|
|
|
217
217
|
var state = JSON.parse(record.state);
|