hyperbook 0.96.1 → 0.96.2

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.
@@ -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
@@ -2288,14 +2256,6 @@ if _pg:
2288
2256
  (elem.getAttribute("data-packages") || "").split(",").map((pkg) => pkg.trim()).filter((pkg) => pkg.length > 0)
2289
2257
  )
2290
2258
  );
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
2259
  let pyideState = { id };
2300
2260
  const initialSource = editorDiv ? editorDiv.textContent : "";
2301
2261
  if (editorDiv) editorDiv.textContent = "";
@@ -2509,8 +2469,6 @@ if _pg:
2509
2469
  });
2510
2470
  run?.addEventListener("click", async () => {
2511
2471
  const script = getEditorValue();
2512
- const usesPytamaro = hasPytamaroPackage || scriptLooksLikePytamaro(script);
2513
- const renderPytamaroToCanvas = hasCanvas && canvas && usesPytamaro;
2514
2472
  if (hasCanvas) {
2515
2473
  showCanvas2();
2516
2474
  } else {
@@ -2528,7 +2486,6 @@ if _pg:
2528
2486
  output.innerHTML = "";
2529
2487
  clearPytamaroStdoutCarry(id);
2530
2488
  try {
2531
- setPytamaroCanvasTarget(id, renderPytamaroToCanvas);
2532
2489
  const { results, error } = await executeScript(
2533
2490
  id,
2534
2491
  script,
package/dist/index.js CHANGED
@@ -202118,7 +202118,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
202118
202118
  /***/ ((module) => {
202119
202119
 
202120
202120
  "use strict";
202121
- module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.96.1","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"}}');
202121
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.96.2","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
202122
 
202123
202123
  /***/ })
202124
202124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.96.1",
3
+ "version": "0.96.2",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -57,8 +57,8 @@
57
57
  "update-check": "1.5.4",
58
58
  "ws": "^8.18.0",
59
59
  "create-hyperbook": "0.3.6",
60
- "@hyperbook/markdown": "0.67.1",
61
60
  "@hyperbook/fs": "0.25.0",
61
+ "@hyperbook/markdown": "0.67.2",
62
62
  "@hyperbook/types": "0.23.0"
63
63
  },
64
64
  "scripts": {