hyperbook 0.96.1 → 0.97.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/directive-openscad/client.js +203 -2
- package/dist/assets/directive-openscad/openscad.js +5 -7
- package/dist/assets/directive-openscad/openscad.wasm +0 -0
- package/dist/assets/directive-openscad/style.css +120 -0
- package/dist/assets/directive-openscad/worker.js +49 -0
- package/dist/assets/directive-pyide/client.js +45 -54
- package/dist/index.js +118 -1
- package/dist/locales/de.json +5 -0
- package/dist/locales/en.json +5 -0
- package/package.json +4 -4
|
@@ -272,6 +272,126 @@
|
|
|
272
272
|
border-right: none;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
.directive-openscad .binary-files-section {
|
|
276
|
+
border: 1px solid var(--color-spacer);
|
|
277
|
+
border-top: none;
|
|
278
|
+
border-bottom: none;
|
|
279
|
+
background-color: var(--color-background, var(--color--background, #fff));
|
|
280
|
+
margin-bottom: 0;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.directive-openscad .binary-files-section summary {
|
|
284
|
+
padding: 8px 12px;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
font-weight: 500;
|
|
287
|
+
display: flex;
|
|
288
|
+
align-items: center;
|
|
289
|
+
user-select: none;
|
|
290
|
+
background-color: var(--color-background, var(--color--background, #fff));
|
|
291
|
+
list-style: none;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.directive-openscad .binary-files-section summary::-webkit-details-marker {
|
|
295
|
+
display: none;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.directive-openscad .binary-files-section summary .summary-text {
|
|
299
|
+
display: flex;
|
|
300
|
+
align-items: center;
|
|
301
|
+
gap: 8px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.directive-openscad .binary-files-section summary .summary-indicator {
|
|
305
|
+
transition: transform 0.2s;
|
|
306
|
+
display: inline-block;
|
|
307
|
+
font-size: 0.75rem;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.directive-openscad .binary-files-section[open] summary .summary-indicator {
|
|
311
|
+
transform: rotate(90deg);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.directive-openscad .binary-files-section summary:hover {
|
|
315
|
+
background-color: var(--color-spacer);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.directive-openscad .binary-files-actions {
|
|
319
|
+
padding: 8px;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.directive-openscad .add-binary-file {
|
|
323
|
+
width: 100%;
|
|
324
|
+
flex: none;
|
|
325
|
+
padding: 6px 12px;
|
|
326
|
+
font-size: 0.875rem;
|
|
327
|
+
border: 1px solid var(--color-spacer);
|
|
328
|
+
border-radius: 4px;
|
|
329
|
+
background-color: var(--color-background, var(--color--background, #fff));
|
|
330
|
+
color: var(--color-text);
|
|
331
|
+
cursor: pointer;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.directive-openscad .add-binary-file:hover {
|
|
335
|
+
background-color: var(--color-spacer);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.directive-openscad .binary-files-list {
|
|
339
|
+
padding: 8px;
|
|
340
|
+
display: flex;
|
|
341
|
+
flex-direction: column;
|
|
342
|
+
gap: 4px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.directive-openscad .binary-files-empty {
|
|
346
|
+
padding: 12px;
|
|
347
|
+
text-align: center;
|
|
348
|
+
color: var(--color-text);
|
|
349
|
+
opacity: 0.6;
|
|
350
|
+
font-style: italic;
|
|
351
|
+
font-size: 0.875rem;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.directive-openscad .binary-file-item {
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
gap: 8px;
|
|
358
|
+
padding: 8px 12px;
|
|
359
|
+
font-size: 0.875rem;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.directive-openscad .binary-file-icon {
|
|
363
|
+
font-size: 1rem;
|
|
364
|
+
flex-shrink: 0;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.directive-openscad .binary-file-name {
|
|
368
|
+
flex: 1;
|
|
369
|
+
word-break: break-all;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.directive-openscad .binary-file-delete {
|
|
373
|
+
background: none;
|
|
374
|
+
border: none;
|
|
375
|
+
color: var(--color-text);
|
|
376
|
+
cursor: pointer;
|
|
377
|
+
font-size: 1.125rem;
|
|
378
|
+
line-height: 1;
|
|
379
|
+
padding: 0;
|
|
380
|
+
margin: 0;
|
|
381
|
+
width: 20px;
|
|
382
|
+
height: 20px;
|
|
383
|
+
display: flex;
|
|
384
|
+
align-items: center;
|
|
385
|
+
justify-content: center;
|
|
386
|
+
border-radius: 2px;
|
|
387
|
+
flex: none;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.directive-openscad .binary-file-delete:hover {
|
|
391
|
+
background-color: rgba(220, 38, 38, 0.1);
|
|
392
|
+
color: #dc2626;
|
|
393
|
+
}
|
|
394
|
+
|
|
275
395
|
.directive-openscad button.fullscreen {
|
|
276
396
|
flex: 0 0 auto;
|
|
277
397
|
min-width: 42px;
|
|
@@ -183,6 +183,48 @@ const loadFonts = async () => {
|
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
+
const normalizeFsPath = (rawPath) => {
|
|
187
|
+
if (typeof rawPath !== "string") return null;
|
|
188
|
+
const trimmed = rawPath.trim();
|
|
189
|
+
if (!trimmed) return null;
|
|
190
|
+
return (trimmed.startsWith("/") ? trimmed : `/${trimmed}`).replace(/\/+/g, "/");
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const ensureParentDirectories = (instance, filePath) => {
|
|
194
|
+
const parts = filePath.split("/").filter(Boolean);
|
|
195
|
+
let current = "";
|
|
196
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
197
|
+
current += `/${parts[i]}`;
|
|
198
|
+
try {
|
|
199
|
+
instance.FS.mkdir(current);
|
|
200
|
+
} catch (_) {}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const mountBinaryFiles = async (instance, binaryFiles = []) => {
|
|
205
|
+
for (const file of binaryFiles) {
|
|
206
|
+
const fsPath = normalizeFsPath(file?.dest);
|
|
207
|
+
if (!fsPath) continue;
|
|
208
|
+
|
|
209
|
+
const url = file?.url;
|
|
210
|
+
if (typeof url !== "string" || !url) {
|
|
211
|
+
throw new Error(`Invalid OpenSCAD binary file URL for ${fsPath}`);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const resp = await fetch(url);
|
|
215
|
+
if (!resp.ok) {
|
|
216
|
+
throw new Error(`Failed to fetch binary file ${url}: ${resp.status}`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const data = new Uint8Array(await resp.arrayBuffer());
|
|
220
|
+
ensureParentDirectories(instance, fsPath);
|
|
221
|
+
try {
|
|
222
|
+
instance.FS.unlink(fsPath);
|
|
223
|
+
} catch (_) {}
|
|
224
|
+
instance.FS.writeFile(fsPath, data);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
186
228
|
const toArrayBuffer = (content) => {
|
|
187
229
|
const typed = content instanceof Uint8Array ? content : new Uint8Array(content || []);
|
|
188
230
|
return typed.buffer.slice(typed.byteOffset, typed.byteOffset + typed.byteLength);
|
|
@@ -465,6 +507,7 @@ const runOpenScadInvocation = async ({
|
|
|
465
507
|
outputPaths = [],
|
|
466
508
|
args = [],
|
|
467
509
|
libraryNames = [],
|
|
510
|
+
binaryFiles = [],
|
|
468
511
|
}) => {
|
|
469
512
|
const mergedOutputs = [];
|
|
470
513
|
const start = performance.now();
|
|
@@ -476,6 +519,9 @@ const runOpenScadInvocation = async ({
|
|
|
476
519
|
if (libraryNames.length > 0) {
|
|
477
520
|
await mountLibraries(instance, libraryNames);
|
|
478
521
|
}
|
|
522
|
+
if (binaryFiles.length > 0) {
|
|
523
|
+
await mountBinaryFiles(instance, binaryFiles);
|
|
524
|
+
}
|
|
479
525
|
|
|
480
526
|
try {
|
|
481
527
|
instance.FS.unlink(sourcePath);
|
|
@@ -528,6 +574,7 @@ self.addEventListener("message", async (event) => {
|
|
|
528
574
|
sourcePath,
|
|
529
575
|
outputPaths: [outPath],
|
|
530
576
|
libraryNames: payload?.libraryNames || [],
|
|
577
|
+
binaryFiles: payload?.binaryFiles || [],
|
|
531
578
|
args: [
|
|
532
579
|
sourcePath,
|
|
533
580
|
"-o",
|
|
@@ -547,6 +594,7 @@ self.addEventListener("message", async (event) => {
|
|
|
547
594
|
sourcePath,
|
|
548
595
|
outputPaths: [outPath],
|
|
549
596
|
libraryNames: payload?.libraryNames || [],
|
|
597
|
+
binaryFiles: payload?.binaryFiles || [],
|
|
550
598
|
args: [
|
|
551
599
|
sourcePath,
|
|
552
600
|
"-o",
|
|
@@ -583,6 +631,7 @@ self.addEventListener("message", async (event) => {
|
|
|
583
631
|
sourcePath,
|
|
584
632
|
outputPaths: [outPath],
|
|
585
633
|
libraryNames: payload?.libraryNames || [],
|
|
634
|
+
binaryFiles: payload?.binaryFiles || [],
|
|
586
635
|
args: [
|
|
587
636
|
sourcePath,
|
|
588
637
|
"-o",
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
var executionStates = /* @__PURE__ */ new Map();
|
|
8
8
|
var interruptBuffers = /* @__PURE__ */ new Map();
|
|
9
9
|
var pytamaroStdoutCarry = /* @__PURE__ */ new Map();
|
|
10
|
-
var pytamaroCanvasTargets = /* @__PURE__ */ new Set();
|
|
11
10
|
var getExecutionState = (id) => {
|
|
12
11
|
if (!executionStates.has(id)) {
|
|
13
12
|
executionStates.set(id, {
|
|
@@ -29,37 +28,7 @@
|
|
|
29
28
|
var getOutput = (id) => {
|
|
30
29
|
return document.getElementById(id)?.getElementsByClassName("output")[0];
|
|
31
30
|
};
|
|
32
|
-
var getCanvas2 = (id) => {
|
|
33
|
-
return document.getElementById(id)?.getElementsByClassName("canvas")[0];
|
|
34
|
-
};
|
|
35
|
-
var setPytamaroCanvasTarget = (id, enabled) => {
|
|
36
|
-
if (enabled) {
|
|
37
|
-
pytamaroCanvasTargets.add(id);
|
|
38
|
-
} else {
|
|
39
|
-
pytamaroCanvasTargets.delete(id);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
31
|
var renderPytamaroDataUri = (id, container, dataUri) => {
|
|
43
|
-
if (id && pytamaroCanvasTargets.has(id)) {
|
|
44
|
-
const canvas = getCanvas2(id);
|
|
45
|
-
const context = canvas?.getContext?.("2d");
|
|
46
|
-
if (canvas && context) {
|
|
47
|
-
const img2 = new Image();
|
|
48
|
-
img2.onload = () => {
|
|
49
|
-
const width = Math.max(1, img2.naturalWidth || img2.width);
|
|
50
|
-
const height = Math.max(1, img2.naturalHeight || img2.height);
|
|
51
|
-
canvas.width = width;
|
|
52
|
-
canvas.height = height;
|
|
53
|
-
context.clearRect(0, 0, width, height);
|
|
54
|
-
context.drawImage(img2, 0, 0, width, height);
|
|
55
|
-
};
|
|
56
|
-
img2.onerror = () => {
|
|
57
|
-
appendOutputErrorLine(id, "Failed to render pytamaro graphic.");
|
|
58
|
-
};
|
|
59
|
-
img2.src = dataUri;
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
32
|
const img = document.createElement("img");
|
|
64
33
|
img.src = dataUri;
|
|
65
34
|
img.style.maxWidth = "100%";
|
|
@@ -213,7 +182,6 @@
|
|
|
213
182
|
};
|
|
214
183
|
var clearPytamaroStdoutCarry = (id) => {
|
|
215
184
|
pytamaroStdoutCarry.delete(id);
|
|
216
|
-
pytamaroCanvasTargets.delete(id);
|
|
217
185
|
};
|
|
218
186
|
|
|
219
187
|
// assets/directive-pyide/src/turtle-ffi.js
|
|
@@ -1308,16 +1276,34 @@
|
|
|
1308
1276
|
} else if (type === "CircularSector") {
|
|
1309
1277
|
const radius = Math.max(0, Number(spec.radius) || 0);
|
|
1310
1278
|
const angle = Number(spec.angle) || 0;
|
|
1311
|
-
width = radius * 2;
|
|
1312
|
-
height = radius * 2;
|
|
1313
1279
|
const fill = colorToCss(spec.color);
|
|
1280
|
+
const \u03B8 = angle * Math.PI / 180;
|
|
1281
|
+
const endX = radius * Math.cos(-\u03B8);
|
|
1282
|
+
const endY = radius * Math.sin(-\u03B8);
|
|
1283
|
+
const bxs = [0, radius, endX];
|
|
1284
|
+
const bys = [0, 0, endY];
|
|
1285
|
+
if (angle >= 90) bys.push(-radius);
|
|
1286
|
+
if (angle >= 180) bxs.push(-radius);
|
|
1287
|
+
if (angle >= 270) bys.push(radius);
|
|
1288
|
+
const minX = Math.min(...bxs);
|
|
1289
|
+
const maxX = Math.max(...bxs);
|
|
1290
|
+
const minY = Math.min(...bys);
|
|
1291
|
+
const maxY = Math.max(...bys);
|
|
1292
|
+
width = Math.max(0, maxX - minX);
|
|
1293
|
+
height = Math.max(0, maxY - minY);
|
|
1294
|
+
const bboxCX = (minX + maxX) / 2;
|
|
1295
|
+
const bboxCY = (minY + maxY) / 2;
|
|
1296
|
+
pin = { x: -bboxCX, y: -bboxCY };
|
|
1314
1297
|
draw = (ctx) => {
|
|
1298
|
+
ctx.save();
|
|
1299
|
+
ctx.translate(-bboxCX, -bboxCY);
|
|
1315
1300
|
ctx.beginPath();
|
|
1316
1301
|
ctx.moveTo(0, 0);
|
|
1317
1302
|
ctx.arc(0, 0, radius, 0, -angle * Math.PI / 180, true);
|
|
1318
1303
|
ctx.closePath();
|
|
1319
1304
|
ctx.fillStyle = fill;
|
|
1320
1305
|
ctx.fill();
|
|
1306
|
+
ctx.restore();
|
|
1321
1307
|
};
|
|
1322
1308
|
} else if (type === "Triangle") {
|
|
1323
1309
|
const side1 = Math.max(0, Number(spec.side1) || 0);
|
|
@@ -1417,8 +1403,8 @@
|
|
|
1417
1403
|
continue;
|
|
1418
1404
|
}
|
|
1419
1405
|
if (type === "Compose") {
|
|
1420
|
-
const bg = stack.pop();
|
|
1421
1406
|
const fg = stack.pop();
|
|
1407
|
+
const bg = stack.pop();
|
|
1422
1408
|
if (!fg || !bg) continue;
|
|
1423
1409
|
const fgPin = spec.fg_pin ? decodePoint(spec.fg_pin, fg.width, fg.height) : fg.pin;
|
|
1424
1410
|
const bgPin = spec.bg_pin ? decodePoint(spec.bg_pin, bg.width, bg.height) : bg.pin;
|
|
@@ -1498,14 +1484,30 @@
|
|
|
1498
1484
|
} else if (type === "CircularSector") {
|
|
1499
1485
|
const radius = Math.max(0, Number(spec.radius) || 0);
|
|
1500
1486
|
const angle = Number(spec.angle) || 0;
|
|
1501
|
-
width = radius * 2;
|
|
1502
|
-
height = radius * 2;
|
|
1503
1487
|
const fill = colorToCss(spec.color);
|
|
1504
|
-
const
|
|
1505
|
-
const endX = radius * Math.cos(
|
|
1506
|
-
const endY = radius * Math.sin(
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1488
|
+
const \u03B8 = angle * Math.PI / 180;
|
|
1489
|
+
const endX = radius * Math.cos(-\u03B8);
|
|
1490
|
+
const endY = radius * Math.sin(-\u03B8);
|
|
1491
|
+
const bxs = [0, radius, endX];
|
|
1492
|
+
const bys = [0, 0, endY];
|
|
1493
|
+
if (angle >= 90) bys.push(-radius);
|
|
1494
|
+
if (angle >= 180) bxs.push(-radius);
|
|
1495
|
+
if (angle >= 270) bys.push(radius);
|
|
1496
|
+
const minX = Math.min(...bxs);
|
|
1497
|
+
const maxX = Math.max(...bxs);
|
|
1498
|
+
const minY = Math.min(...bys);
|
|
1499
|
+
const maxY = Math.max(...bys);
|
|
1500
|
+
width = Math.max(0, maxX - minX);
|
|
1501
|
+
height = Math.max(0, maxY - minY);
|
|
1502
|
+
const bboxCX = (minX + maxX) / 2;
|
|
1503
|
+
const bboxCY = (minY + maxY) / 2;
|
|
1504
|
+
pin = { x: -bboxCX, y: -bboxCY };
|
|
1505
|
+
if (angle >= 360) {
|
|
1506
|
+
svg = `<g transform="translate(${-bboxCX},${-bboxCY})"><circle cx="0" cy="0" r="${radius}" fill="${fill}"/></g>`;
|
|
1507
|
+
} else {
|
|
1508
|
+
const largeArcFlag = angle > 180 ? 1 : 0;
|
|
1509
|
+
svg = `<g transform="translate(${-bboxCX},${-bboxCY})"><path d="M 0 0 L ${radius} 0 A ${radius} ${radius} 0 ${largeArcFlag} 0 ${endX} ${endY} Z" fill="${fill}"/></g>`;
|
|
1510
|
+
}
|
|
1509
1511
|
} else if (type === "Triangle") {
|
|
1510
1512
|
const side1 = Math.max(0, Number(spec.side1) || 0);
|
|
1511
1513
|
const side2 = Math.max(0, Number(spec.side2) || 0);
|
|
@@ -1582,8 +1584,8 @@
|
|
|
1582
1584
|
continue;
|
|
1583
1585
|
}
|
|
1584
1586
|
if (type === "Compose") {
|
|
1585
|
-
const bg = stack.pop();
|
|
1586
1587
|
const fg = stack.pop();
|
|
1588
|
+
const bg = stack.pop();
|
|
1587
1589
|
if (!fg || !bg) continue;
|
|
1588
1590
|
const fgPin = spec.fg_pin ? decodePoint(spec.fg_pin, fg.width, fg.height) : fg.pin;
|
|
1589
1591
|
const bgPin = spec.bg_pin ? decodePoint(spec.bg_pin, bg.width, bg.height) : bg.pin;
|
|
@@ -2288,14 +2290,6 @@ if _pg:
|
|
|
2288
2290
|
(elem.getAttribute("data-packages") || "").split(",").map((pkg) => pkg.trim()).filter((pkg) => pkg.length > 0)
|
|
2289
2291
|
)
|
|
2290
2292
|
);
|
|
2291
|
-
const hasPytamaroPackage = additionalPackages.some(
|
|
2292
|
-
(pkg) => pkg.toLowerCase() === "pytamaro"
|
|
2293
|
-
);
|
|
2294
|
-
const scriptLooksLikePytamaro = (script) => {
|
|
2295
|
-
return /\bfrom\s+pytamaro\s+import\b|\bimport\s+pytamaro\b/.test(
|
|
2296
|
-
script
|
|
2297
|
-
);
|
|
2298
|
-
};
|
|
2299
2293
|
let pyideState = { id };
|
|
2300
2294
|
const initialSource = editorDiv ? editorDiv.textContent : "";
|
|
2301
2295
|
if (editorDiv) editorDiv.textContent = "";
|
|
@@ -2509,8 +2503,6 @@ if _pg:
|
|
|
2509
2503
|
});
|
|
2510
2504
|
run?.addEventListener("click", async () => {
|
|
2511
2505
|
const script = getEditorValue();
|
|
2512
|
-
const usesPytamaro = hasPytamaroPackage || scriptLooksLikePytamaro(script);
|
|
2513
|
-
const renderPytamaroToCanvas = hasCanvas && canvas && usesPytamaro;
|
|
2514
2506
|
if (hasCanvas) {
|
|
2515
2507
|
showCanvas2();
|
|
2516
2508
|
} else {
|
|
@@ -2528,7 +2520,6 @@ if _pg:
|
|
|
2528
2520
|
output.innerHTML = "";
|
|
2529
2521
|
clearPytamaroStdoutCarry(id);
|
|
2530
2522
|
try {
|
|
2531
|
-
setPytamaroCanvasTarget(id, renderPytamaroToCanvas);
|
|
2532
2523
|
const { results, error } = await executeScript(
|
|
2533
2524
|
id,
|
|
2534
2525
|
script,
|
package/dist/index.js
CHANGED
|
@@ -174988,6 +174988,11 @@ var en_default = {
|
|
|
174988
174988
|
"openscad-params-loading": "Loading parameters...",
|
|
174989
174989
|
"openscad-params-none": "No parameters",
|
|
174990
174990
|
"openscad-parameters": "Parameters",
|
|
174991
|
+
"openscad-binary-files": "Binary Files",
|
|
174992
|
+
"openscad-no-binary-files": "No binary files",
|
|
174993
|
+
"openscad-add-binary-file": "Add binary file",
|
|
174994
|
+
"openscad-add": "Add",
|
|
174995
|
+
"openscad-file-replace": "Replace existing file?",
|
|
174991
174996
|
"user-login-title": "Login",
|
|
174992
174997
|
"user-username": "Username",
|
|
174993
174998
|
"user-password": "Password",
|
|
@@ -175126,6 +175131,11 @@ var de_default = {
|
|
|
175126
175131
|
"openscad-params-loading": "Parameter werden geladen...",
|
|
175127
175132
|
"openscad-params-none": "Keine Parameter",
|
|
175128
175133
|
"openscad-parameters": "Parameter",
|
|
175134
|
+
"openscad-binary-files": "Bin\xE4rdateien",
|
|
175135
|
+
"openscad-no-binary-files": "Keine Bin\xE4rdateien",
|
|
175136
|
+
"openscad-add-binary-file": "Bin\xE4rdatei hinzuf\xFCgen",
|
|
175137
|
+
"openscad-add": "Hinzuf\xFCgen",
|
|
175138
|
+
"openscad-file-replace": "Existierende Datei ersetzen?",
|
|
175129
175139
|
"user-login-title": "Anmelden",
|
|
175130
175140
|
"user-username": "Benutzername",
|
|
175131
175141
|
"user-password": "Passwort",
|
|
@@ -201560,6 +201570,35 @@ var remarkDirectiveOpenscad_default = (ctx) => () => {
|
|
|
201560
201570
|
if (isDirective(node3) && node3.name === name) {
|
|
201561
201571
|
const { src = "", id = hash(node3), height, library } = node3.attributes || {};
|
|
201562
201572
|
const data = node3.data || (node3.data = {});
|
|
201573
|
+
const binaryFiles = [];
|
|
201574
|
+
for (const child of node3.children) {
|
|
201575
|
+
let text9 = "";
|
|
201576
|
+
if (child.type === "text") {
|
|
201577
|
+
text9 = child.value;
|
|
201578
|
+
} else if (child.type === "paragraph") {
|
|
201579
|
+
const reconstructText = (paragraphNode) => {
|
|
201580
|
+
if (paragraphNode.type === "text") return paragraphNode.value;
|
|
201581
|
+
if (paragraphNode.type === "link") return paragraphNode.url;
|
|
201582
|
+
if (paragraphNode.children) {
|
|
201583
|
+
return paragraphNode.children.map(reconstructText).join("");
|
|
201584
|
+
}
|
|
201585
|
+
return "";
|
|
201586
|
+
};
|
|
201587
|
+
text9 = child.children.map(reconstructText).join("");
|
|
201588
|
+
}
|
|
201589
|
+
if (!text9) continue;
|
|
201590
|
+
const fileMatches = text9.matchAll(/@file\s+dest="([^"]+)"\s+src="([^"]+)"/g);
|
|
201591
|
+
for (const match of fileMatches) {
|
|
201592
|
+
const dest = match[1];
|
|
201593
|
+
const src2 = match[2];
|
|
201594
|
+
const url = ctx.makeUrl(
|
|
201595
|
+
src2,
|
|
201596
|
+
"public",
|
|
201597
|
+
ctx.navigation.current || void 0
|
|
201598
|
+
);
|
|
201599
|
+
binaryFiles.push({ dest, url });
|
|
201600
|
+
}
|
|
201601
|
+
}
|
|
201563
201602
|
expectContainerDirective(node3, file, name);
|
|
201564
201603
|
registerDirective(file, name, ["client.js"], ["style.css"], []);
|
|
201565
201604
|
requestJS(file, ["codemirror", "codemirror.bundle.js"]);
|
|
@@ -201575,6 +201614,11 @@ var remarkDirectiveOpenscad_default = (ctx) => () => {
|
|
|
201575
201614
|
data.hProperties = {
|
|
201576
201615
|
class: "directive-openscad",
|
|
201577
201616
|
"data-id": id,
|
|
201617
|
+
"data-binary-files": Buffer.from(
|
|
201618
|
+
JSON.stringify(binaryFiles)
|
|
201619
|
+
).toString("base64"),
|
|
201620
|
+
"data-base-path": ctx.config.basePath || "/",
|
|
201621
|
+
"data-page-path": ctx.navigation.current?.path?.directory || "",
|
|
201578
201622
|
...height ? { style: `--openscad-height: ${height}` } : {},
|
|
201579
201623
|
...library ? { "data-library": library } : {}
|
|
201580
201624
|
};
|
|
@@ -201675,6 +201719,79 @@ var remarkDirectiveOpenscad_default = (ctx) => () => {
|
|
|
201675
201719
|
}
|
|
201676
201720
|
]
|
|
201677
201721
|
},
|
|
201722
|
+
{
|
|
201723
|
+
type: "element",
|
|
201724
|
+
tagName: "details",
|
|
201725
|
+
properties: {
|
|
201726
|
+
class: "binary-files-section"
|
|
201727
|
+
},
|
|
201728
|
+
children: [
|
|
201729
|
+
{
|
|
201730
|
+
type: "element",
|
|
201731
|
+
tagName: "summary",
|
|
201732
|
+
properties: {},
|
|
201733
|
+
children: [
|
|
201734
|
+
{
|
|
201735
|
+
type: "element",
|
|
201736
|
+
tagName: "span",
|
|
201737
|
+
properties: {
|
|
201738
|
+
class: "summary-text"
|
|
201739
|
+
},
|
|
201740
|
+
children: [
|
|
201741
|
+
{
|
|
201742
|
+
type: "element",
|
|
201743
|
+
tagName: "span",
|
|
201744
|
+
properties: {
|
|
201745
|
+
class: "summary-indicator"
|
|
201746
|
+
},
|
|
201747
|
+
children: [
|
|
201748
|
+
{
|
|
201749
|
+
type: "text",
|
|
201750
|
+
value: "\u25B6"
|
|
201751
|
+
}
|
|
201752
|
+
]
|
|
201753
|
+
},
|
|
201754
|
+
{
|
|
201755
|
+
type: "text",
|
|
201756
|
+
value: i18n.get("openscad-binary-files")
|
|
201757
|
+
}
|
|
201758
|
+
]
|
|
201759
|
+
}
|
|
201760
|
+
]
|
|
201761
|
+
},
|
|
201762
|
+
{
|
|
201763
|
+
type: "element",
|
|
201764
|
+
tagName: "div",
|
|
201765
|
+
properties: {
|
|
201766
|
+
class: "binary-files-list"
|
|
201767
|
+
},
|
|
201768
|
+
children: []
|
|
201769
|
+
},
|
|
201770
|
+
{
|
|
201771
|
+
type: "element",
|
|
201772
|
+
tagName: "div",
|
|
201773
|
+
properties: {
|
|
201774
|
+
class: "binary-files-actions"
|
|
201775
|
+
},
|
|
201776
|
+
children: [
|
|
201777
|
+
{
|
|
201778
|
+
type: "element",
|
|
201779
|
+
tagName: "button",
|
|
201780
|
+
properties: {
|
|
201781
|
+
class: "add-binary-file",
|
|
201782
|
+
title: i18n.get("openscad-add-binary-file")
|
|
201783
|
+
},
|
|
201784
|
+
children: [
|
|
201785
|
+
{
|
|
201786
|
+
type: "text",
|
|
201787
|
+
value: "+ " + i18n.get("openscad-add")
|
|
201788
|
+
}
|
|
201789
|
+
]
|
|
201790
|
+
}
|
|
201791
|
+
]
|
|
201792
|
+
}
|
|
201793
|
+
]
|
|
201794
|
+
},
|
|
201678
201795
|
{
|
|
201679
201796
|
type: "element",
|
|
201680
201797
|
tagName: "div",
|
|
@@ -202118,7 +202235,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
|
|
|
202118
202235
|
/***/ ((module) => {
|
|
202119
202236
|
|
|
202120
202237
|
"use strict";
|
|
202121
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.
|
|
202238
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.97.0","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=18"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"create-hyperbook":"workspace:*","@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
|
|
202122
202239
|
|
|
202123
202240
|
/***/ })
|
|
202124
202241
|
|
package/dist/locales/de.json
CHANGED
|
@@ -105,6 +105,11 @@
|
|
|
105
105
|
"openscad-params-loading": "Parameter werden geladen...",
|
|
106
106
|
"openscad-params-none": "Keine Parameter",
|
|
107
107
|
"openscad-parameters": "Parameter",
|
|
108
|
+
"openscad-binary-files": "Binärdateien",
|
|
109
|
+
"openscad-no-binary-files": "Keine Binärdateien",
|
|
110
|
+
"openscad-add-binary-file": "Binärdatei hinzufügen",
|
|
111
|
+
"openscad-add": "Hinzufügen",
|
|
112
|
+
"openscad-file-replace": "Existierende Datei ersetzen?",
|
|
108
113
|
"user-login-title": "Anmelden",
|
|
109
114
|
"user-username": "Benutzername",
|
|
110
115
|
"user-password": "Passwort",
|
package/dist/locales/en.json
CHANGED
|
@@ -105,6 +105,11 @@
|
|
|
105
105
|
"openscad-params-loading": "Loading parameters...",
|
|
106
106
|
"openscad-params-none": "No parameters",
|
|
107
107
|
"openscad-parameters": "Parameters",
|
|
108
|
+
"openscad-binary-files": "Binary Files",
|
|
109
|
+
"openscad-no-binary-files": "No binary files",
|
|
110
|
+
"openscad-add-binary-file": "Add binary file",
|
|
111
|
+
"openscad-add": "Add",
|
|
112
|
+
"openscad-file-replace": "Replace existing file?",
|
|
108
113
|
"user-login-title": "Login",
|
|
109
114
|
"user-username": "Username",
|
|
110
115
|
"user-password": "Password",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperbook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"author": "Mike Barkmin",
|
|
5
5
|
"homepage": "https://github.com/openpatch/hyperbook#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"update-check": "1.5.4",
|
|
58
58
|
"ws": "^8.18.0",
|
|
59
59
|
"create-hyperbook": "0.3.6",
|
|
60
|
-
"@hyperbook/markdown": "0.
|
|
61
|
-
"@hyperbook/
|
|
62
|
-
"@hyperbook/
|
|
60
|
+
"@hyperbook/markdown": "0.68.0",
|
|
61
|
+
"@hyperbook/types": "0.23.0",
|
|
62
|
+
"@hyperbook/fs": "0.25.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"version": "pnpm build",
|