@hyperbook/markdown 0.24.6 → 0.24.8
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/client.js +9 -2
- package/dist/assets/directive-p5/client.js +12 -2
- package/dist/assets/shell.css +42 -40
- package/dist/index.js +7 -3
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/assets/client.js
CHANGED
|
@@ -6,9 +6,16 @@ var hyperbook = (function () {
|
|
|
6
6
|
const initCollapsibles = (root) => {
|
|
7
7
|
const collapsibleEls = root.getElementsByClassName("collapsible");
|
|
8
8
|
for (let collapsible of collapsibleEls) {
|
|
9
|
+
const id = collapsible.parentElement.getAttribute("data-id");
|
|
10
|
+
|
|
11
|
+
if (id.startsWith("_nav:") && !collapsible.classList.contains("empty")) {
|
|
12
|
+
const link = collapsible.querySelector("a");
|
|
13
|
+
link?.addEventListener("click", (event) => {
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
9
17
|
collapsible.addEventListener("click", () => {
|
|
10
18
|
collapsible.classList.toggle("expanded");
|
|
11
|
-
const id = collapsible.parentElement.getAttribute("data-id");
|
|
12
19
|
if (id) {
|
|
13
20
|
store.collapsibles.get(id).then((result) => {
|
|
14
21
|
if (!result) {
|
|
@@ -28,7 +35,7 @@ var hyperbook = (function () {
|
|
|
28
35
|
};
|
|
29
36
|
|
|
30
37
|
/**
|
|
31
|
-
* @param {HTMLElement} root
|
|
38
|
+
* @param {HTMLElement} root
|
|
32
39
|
*/
|
|
33
40
|
const updateCollapsibles = (root) => {
|
|
34
41
|
store.collapsibles.toArray().then((collapsibles) => {
|
|
@@ -4,7 +4,7 @@ hyperbook.p5 = (function () {
|
|
|
4
4
|
codeInput.templates.prism(window.Prism, [
|
|
5
5
|
new codeInput.plugins.AutoCloseBrackets(),
|
|
6
6
|
new codeInput.plugins.Indent(true, 2),
|
|
7
|
-
])
|
|
7
|
+
]),
|
|
8
8
|
);
|
|
9
9
|
|
|
10
10
|
const elems = document.getElementsByClassName("directive-p5");
|
|
@@ -32,6 +32,13 @@ hyperbook.p5 = (function () {
|
|
|
32
32
|
const resetEl = elem.getElementsByClassName("reset")[0];
|
|
33
33
|
const downloadEl = elem.getElementsByClassName("download")[0];
|
|
34
34
|
|
|
35
|
+
if (frame) {
|
|
36
|
+
frame.srcdoc = frame.srcdoc.replaceAll(
|
|
37
|
+
"###ORIGIN###",
|
|
38
|
+
window.location.origin,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
copyEl?.addEventListener("click", async () => {
|
|
36
43
|
try {
|
|
37
44
|
await navigator.clipboard.writeText(editor.value);
|
|
@@ -61,6 +68,7 @@ hyperbook.p5 = (function () {
|
|
|
61
68
|
const code = result.sketch;
|
|
62
69
|
frame.srcdoc = template
|
|
63
70
|
.replace("###SLOT###", wrapSketch(code))
|
|
71
|
+
.replaceAll("###ORIGIN###", window.location.origin)
|
|
64
72
|
.replace(/\u00A0/g, " ");
|
|
65
73
|
}
|
|
66
74
|
|
|
@@ -71,7 +79,9 @@ hyperbook.p5 = (function () {
|
|
|
71
79
|
|
|
72
80
|
update?.addEventListener("click", () => {
|
|
73
81
|
const code = editor.value;
|
|
74
|
-
frame.srcdoc = template
|
|
82
|
+
frame.srcdoc = template
|
|
83
|
+
.replace("###SLOT###", wrapSketch(code))
|
|
84
|
+
.replaceAll("###ORIGIN###", window.location.origin);
|
|
75
85
|
});
|
|
76
86
|
});
|
|
77
87
|
}
|
package/dist/assets/shell.css
CHANGED
|
@@ -37,27 +37,27 @@ side-drawer {
|
|
|
37
37
|
border-right-color: var(--color-nav-border);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.sidebar
|
|
41
|
-
.nav-drawer-content
|
|
40
|
+
.sidebar>.author,
|
|
41
|
+
.nav-drawer-content>.author {
|
|
42
42
|
color: var(--color-author-color);
|
|
43
43
|
background: var(--color-author-background);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.sidebar
|
|
47
|
-
.nav-drawer-content
|
|
46
|
+
.sidebar>.author:hover,
|
|
47
|
+
.nav-drawer-content>.author:hover {
|
|
48
48
|
color: var(--color-brand);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/* Three bars for burger menu */
|
|
52
|
-
.toggle
|
|
53
|
-
.toggle
|
|
54
|
-
.toggle
|
|
52
|
+
.toggle>.bar1,
|
|
53
|
+
.toggle>.bar2,
|
|
54
|
+
.toggle>.bar3 {
|
|
55
55
|
background-color: var(--color-brand-text);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.inverted .toggle
|
|
59
|
-
.inverted .toggle
|
|
60
|
-
.inverted .toggle
|
|
58
|
+
.inverted .toggle>.bar1,
|
|
59
|
+
.inverted .toggle>.bar2,
|
|
60
|
+
.inverted .toggle>.bar3 {
|
|
61
61
|
background-color: var(--color-brand);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -78,11 +78,11 @@ header.inverted {
|
|
|
78
78
|
color: var(--color-brand-text);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
header.inverted
|
|
81
|
+
header.inverted>.branding {
|
|
82
82
|
color: var(--color-brand);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
header.inverted
|
|
85
|
+
header.inverted>.branding:hover {
|
|
86
86
|
color: var(--color-brand);
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -90,17 +90,17 @@ header.inverted > .branding:hover {
|
|
|
90
90
|
border-top-color: var(--color-spacer);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
.section
|
|
93
|
+
.section>.name {
|
|
94
94
|
color: var(--color-text);
|
|
95
95
|
border-color: var(--color-spacer);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.section
|
|
98
|
+
.section>.name>.label {
|
|
99
99
|
color: var(--color-text);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.section
|
|
103
|
-
color: var(--color-
|
|
102
|
+
.section>.name.active>.label {
|
|
103
|
+
color: var(--color-brand);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
.section .name.empty {
|
|
@@ -109,15 +109,15 @@ header.inverted > .branding:hover {
|
|
|
109
109
|
font-style: italic;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
.section
|
|
112
|
+
.section>.name:hover {
|
|
113
113
|
background: var(--color-spacer);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.section
|
|
116
|
+
.section>.name.empty:hover {
|
|
117
117
|
background: none;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.section
|
|
120
|
+
.section>.name.active {
|
|
121
121
|
background: var(--color-background);
|
|
122
122
|
color: var(--color-brand);
|
|
123
123
|
}
|
|
@@ -136,7 +136,7 @@ header.inverted > .branding:hover {
|
|
|
136
136
|
color: var(--color-brand);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.section
|
|
139
|
+
.section>.links {
|
|
140
140
|
border-left-color: var(--color-spacer);
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -234,21 +234,21 @@ a.jump.previous::before {
|
|
|
234
234
|
border-right-color: var(--color-nav-border);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.sidebar
|
|
238
|
-
.nav-drawer-content
|
|
237
|
+
.sidebar>nav,
|
|
238
|
+
.nav-drawer-content>nav {
|
|
239
239
|
padding: 20px;
|
|
240
240
|
flex: 1;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
.sidebar
|
|
244
|
-
.nav-drawer-content
|
|
243
|
+
.sidebar>.author,
|
|
244
|
+
.nav-drawer-content>.author {
|
|
245
245
|
text-align: center;
|
|
246
246
|
text-decoration: none;
|
|
247
247
|
padding: 20px;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.sidebar
|
|
251
|
-
.nav-drawer-content
|
|
250
|
+
.sidebar>.author,
|
|
251
|
+
.nav-drawer-content>.author>b {
|
|
252
252
|
font-weight: bold;
|
|
253
253
|
}
|
|
254
254
|
|
|
@@ -268,9 +268,9 @@ a.jump.previous::before {
|
|
|
268
268
|
cursor: pointer;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
.toggle
|
|
272
|
-
.toggle
|
|
273
|
-
.toggle
|
|
271
|
+
.toggle>.bar1,
|
|
272
|
+
.toggle>.bar2,
|
|
273
|
+
.toggle>.bar3 {
|
|
274
274
|
width: 35px;
|
|
275
275
|
height: 5px;
|
|
276
276
|
margin: 6px 0;
|
|
@@ -386,7 +386,7 @@ header {
|
|
|
386
386
|
margin-right: 8px;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
#custom-links-footer
|
|
389
|
+
#custom-links-footer>.links-item {
|
|
390
390
|
border-radius: 8px;
|
|
391
391
|
padding: 8px;
|
|
392
392
|
border: 1px solid var(--color-nav-border);
|
|
@@ -565,13 +565,13 @@ header {
|
|
|
565
565
|
|
|
566
566
|
.section ul,
|
|
567
567
|
.virtual-section ul,
|
|
568
|
-
nav
|
|
568
|
+
nav>ul {
|
|
569
569
|
list-style-type: none;
|
|
570
570
|
margin: 0;
|
|
571
571
|
padding: 0;
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
nav li
|
|
574
|
+
nav li+li {
|
|
575
575
|
margin-top: 0px;
|
|
576
576
|
}
|
|
577
577
|
|
|
@@ -585,7 +585,7 @@ nav li + li {
|
|
|
585
585
|
margin-top: 8px;
|
|
586
586
|
}
|
|
587
587
|
|
|
588
|
-
.section
|
|
588
|
+
.section>.name {
|
|
589
589
|
display: flex;
|
|
590
590
|
text-decoration: none;
|
|
591
591
|
padding: 10px;
|
|
@@ -595,12 +595,12 @@ nav li + li {
|
|
|
595
595
|
user-select: none;
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
-
.section
|
|
598
|
+
.section>.name>.label {
|
|
599
599
|
flex: 1;
|
|
600
600
|
text-decoration: none;
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
-
.section
|
|
603
|
+
.section>.name>.toggle {
|
|
604
604
|
text-align: right;
|
|
605
605
|
background: none;
|
|
606
606
|
border: none;
|
|
@@ -613,8 +613,10 @@ nav li + li {
|
|
|
613
613
|
|
|
614
614
|
.collapsible:after {
|
|
615
615
|
content: "\002B";
|
|
616
|
+
width: 1.2rem;
|
|
616
617
|
color: var(--color-text);
|
|
617
618
|
font-weight: bold;
|
|
619
|
+
text-align: right;
|
|
618
620
|
float: right;
|
|
619
621
|
margin-left: 5px;
|
|
620
622
|
}
|
|
@@ -628,7 +630,7 @@ nav li + li {
|
|
|
628
630
|
opacity: 0;
|
|
629
631
|
}
|
|
630
632
|
|
|
631
|
-
.collapsible.expanded
|
|
633
|
+
.collapsible.expanded+.collapsible-content {
|
|
632
634
|
display: block;
|
|
633
635
|
opacity: 1;
|
|
634
636
|
}
|
|
@@ -644,7 +646,7 @@ nav li + li {
|
|
|
644
646
|
text-decoration: none;
|
|
645
647
|
}
|
|
646
648
|
|
|
647
|
-
.section
|
|
649
|
+
.section>.links {
|
|
648
650
|
border-left-width: 1px;
|
|
649
651
|
border-left-style: solid;
|
|
650
652
|
}
|
|
@@ -676,12 +678,12 @@ nav.toc li {
|
|
|
676
678
|
margin-bottom: 8px;
|
|
677
679
|
}
|
|
678
680
|
|
|
679
|
-
nav.toc li
|
|
681
|
+
nav.toc li>a {
|
|
680
682
|
color: var(--color-text);
|
|
681
683
|
text-decoration: none;
|
|
682
684
|
}
|
|
683
685
|
|
|
684
|
-
nav.toc li
|
|
686
|
+
nav.toc li>a:hover {
|
|
685
687
|
color: var(--color-brand);
|
|
686
688
|
}
|
|
687
689
|
|
|
@@ -735,4 +737,4 @@ nav.toc li.level-3 {
|
|
|
735
737
|
mask-repeat: no-repeat;
|
|
736
738
|
cursor: pointer;
|
|
737
739
|
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXVwbG9hZCI+PHBhdGggZD0iTTIxIDE1djRhMiAyIDAgMCAxLTIgMkg1YTIgMiAwIDAgMS0yLTJ2LTQiLz48cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ii8+PGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiLz48L3N2Zz4=");
|
|
738
|
-
}
|
|
740
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -73286,6 +73286,7 @@ var rehypeDirectiveP5_default = (ctx) => () => {
|
|
|
73286
73286
|
return sketchCode;
|
|
73287
73287
|
};
|
|
73288
73288
|
const makeWrapInMarkupTemplate = (code4) => `<!DOCTYPE html>
|
|
73289
|
+
<head>
|
|
73289
73290
|
<meta charset="utf8" />
|
|
73290
73291
|
<base href="${ctx.makeUrl("", "public")}" />
|
|
73291
73292
|
<style type='text/css'>
|
|
@@ -73300,6 +73301,7 @@ canvas {
|
|
|
73300
73301
|
}
|
|
73301
73302
|
</style>
|
|
73302
73303
|
${(code4.scripts ? [cdnLibraryUrl, ...code4.scripts] : []).map((src) => `<script type="text/javascript" src="${src}"></script>`).join("\n")}
|
|
73304
|
+
</head>
|
|
73303
73305
|
<body></body>
|
|
73304
73306
|
<script id="code" type="text/javascript">###SLOT###</script>
|
|
73305
73307
|
`;
|
|
@@ -73329,10 +73331,12 @@ ${(code4.scripts ? [cdnLibraryUrl, ...code4.scripts] : []).map((src) => `<script
|
|
|
73329
73331
|
}
|
|
73330
73332
|
const template = makeWrapInMarkupTemplate({
|
|
73331
73333
|
scripts: [
|
|
73334
|
+
/**
|
|
73332
73335
|
ctx.makeUrl(
|
|
73333
|
-
|
|
73334
|
-
"assets"
|
|
73335
|
-
)
|
|
73336
|
+
path.posix.join("directive-p5", "p5.sound.min.js"),
|
|
73337
|
+
"assets",
|
|
73338
|
+
),
|
|
73339
|
+
*/
|
|
73336
73340
|
]
|
|
73337
73341
|
});
|
|
73338
73342
|
const srcdoc = template.replace("###SLOT###", wrapSketch(srcFile)).replace(/\u00A0/g, " ");
|