@hyperbook/markdown 0.24.5 → 0.24.7
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/directive-p5/client.js +12 -2
- package/dist/index.js +8 -4
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
|
@@ -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/index.js
CHANGED
|
@@ -65415,7 +65415,7 @@ var makeNavigationSectionElement = (ctx, section) => {
|
|
|
65415
65415
|
type: "element",
|
|
65416
65416
|
tagName: "a",
|
|
65417
65417
|
properties: {
|
|
65418
|
-
href,
|
|
65418
|
+
href: ctx.makeUrl(href || "", "book"),
|
|
65419
65419
|
class: "label"
|
|
65420
65420
|
},
|
|
65421
65421
|
children: [
|
|
@@ -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, " ");
|