hyperbook 0.93.0 → 0.93.1
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-pyide/client.js +32 -23
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -381,6 +381,22 @@ hyperbook.python = (function () {
|
|
|
381
381
|
const numeric = Number(value);
|
|
382
382
|
return Number.isFinite(numeric) ? numeric : fallback;
|
|
383
383
|
};
|
|
384
|
+
const toPlainBoolean = (value, fallback = false) => {
|
|
385
|
+
if (value === null || value === undefined) return fallback;
|
|
386
|
+
if (typeof value === "boolean") return value;
|
|
387
|
+
if (typeof value === "number") return value !== 0;
|
|
388
|
+
if (typeof value === "bigint") return value !== 0n;
|
|
389
|
+
if (typeof value === "string") {
|
|
390
|
+
const normalized = value.trim().toLowerCase();
|
|
391
|
+
if (!normalized) return fallback;
|
|
392
|
+
if (["false", "0", "no", "off"].includes(normalized)) return false;
|
|
393
|
+
if (["true", "1", "yes", "on"].includes(normalized)) return true;
|
|
394
|
+
}
|
|
395
|
+
if (typeof value.toJs === "function") {
|
|
396
|
+
return toPlainBoolean(value.toJs({ pyproxies: [] }), fallback);
|
|
397
|
+
}
|
|
398
|
+
return Boolean(value);
|
|
399
|
+
};
|
|
384
400
|
const fontSizeToCanvasUnits = (value) => {
|
|
385
401
|
const numeric = toPlainNumber(value, Number.NaN);
|
|
386
402
|
if (!Number.isFinite(numeric) || numeric === 0) {
|
|
@@ -1026,28 +1042,21 @@ hyperbook.python = (function () {
|
|
|
1026
1042
|
let writeMove = move;
|
|
1027
1043
|
let writeAlign = align;
|
|
1028
1044
|
let writeFont = font;
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
const kwargs = toPlainObject(
|
|
1032
|
-
if (kwargs)
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
else if (hasOwn(kwargs, "text")) writeText = kwargs.text;
|
|
1045
|
-
if (hasOwn(kwargs, "move")) writeMove = kwargs.move;
|
|
1046
|
-
if (hasOwn(kwargs, "align")) writeAlign = kwargs.align;
|
|
1047
|
-
if (hasOwn(kwargs, "font")) writeFont = kwargs.font;
|
|
1048
|
-
}
|
|
1049
|
-
writeFont = null;
|
|
1050
|
-
}
|
|
1045
|
+
const applyWriteKwargs = (candidate) => {
|
|
1046
|
+
if (!isWriteKwargsObject(candidate)) return;
|
|
1047
|
+
const kwargs = toPlainObject(candidate);
|
|
1048
|
+
if (!kwargs) return;
|
|
1049
|
+
if (hasOwn(kwargs, "arg")) writeText = kwargs.arg;
|
|
1050
|
+
else if (hasOwn(kwargs, "text")) writeText = kwargs.text;
|
|
1051
|
+
if (hasOwn(kwargs, "move")) writeMove = kwargs.move;
|
|
1052
|
+
if (hasOwn(kwargs, "align")) writeAlign = kwargs.align;
|
|
1053
|
+
if (hasOwn(kwargs, "font")) writeFont = kwargs.font;
|
|
1054
|
+
};
|
|
1055
|
+
applyWriteKwargs(writeText);
|
|
1056
|
+
applyWriteKwargs(writeMove);
|
|
1057
|
+
applyWriteKwargs(writeAlign);
|
|
1058
|
+
applyWriteKwargs(writeFont);
|
|
1059
|
+
if (isWriteKwargsObject(writeFont)) writeFont = null;
|
|
1051
1060
|
|
|
1052
1061
|
let family = currentFontFamily;
|
|
1053
1062
|
let size = fontSize;
|
|
@@ -1080,7 +1089,7 @@ hyperbook.python = (function () {
|
|
|
1080
1089
|
},
|
|
1081
1090
|
],
|
|
1082
1091
|
});
|
|
1083
|
-
if (
|
|
1092
|
+
if (toPlainBoolean(writeMove, false)) {
|
|
1084
1093
|
const metrics = measureTurtleText(String(writeText), family, size, style);
|
|
1085
1094
|
const left = metrics.left || 0;
|
|
1086
1095
|
const right = metrics.right || metrics.width || 0;
|
package/dist/index.js
CHANGED
|
@@ -202149,7 +202149,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
|
|
|
202149
202149
|
/***/ ((module) => {
|
|
202150
202150
|
|
|
202151
202151
|
"use strict";
|
|
202152
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.93.
|
|
202152
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.93.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"}}');
|
|
202153
202153
|
|
|
202154
202154
|
/***/ })
|
|
202155
202155
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperbook",
|
|
3
|
-
"version": "0.93.
|
|
3
|
+
"version": "0.93.1",
|
|
4
4
|
"author": "Mike Barkmin",
|
|
5
5
|
"homepage": "https://github.com/openpatch/hyperbook#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"ws": "^8.18.0",
|
|
59
59
|
"create-hyperbook": "0.3.6",
|
|
60
60
|
"@hyperbook/fs": "0.25.0",
|
|
61
|
-
"@hyperbook/
|
|
62
|
-
"@hyperbook/
|
|
61
|
+
"@hyperbook/types": "0.23.0",
|
|
62
|
+
"@hyperbook/markdown": "0.64.1"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"version": "pnpm build",
|