@hirokisakabe/pom 7.3.0 → 7.3.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measureCompositeNodes.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/measureCompositeNodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,WAAW,EAEZ,MAAM,aAAa,CAAC;AAOrB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAuBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,
|
|
1
|
+
{"version":3,"file":"measureCompositeNodes.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/measureCompositeNodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,WAAW,EAEZ,MAAM,aAAa,CAAC;AAOrB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAuBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAsCA;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAQA;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAuCA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAsBA;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAcA"}
|
|
@@ -43,9 +43,11 @@ export function measureTimeline(node) {
|
|
|
43
43
|
const direction = node.direction ?? "horizontal";
|
|
44
44
|
if (direction === "horizontal") {
|
|
45
45
|
// 各アイテムの幅: 120px (ラベル幅)
|
|
46
|
-
//
|
|
46
|
+
// 両端アイテムのラベルがコンテナに収まるよう labelW 込みで計算する
|
|
47
|
+
// (描画側 renderHorizontalTimeline は線端点を labelW/2 でインセットする)
|
|
48
|
+
const labelW = 120;
|
|
47
49
|
const minItemSpacing = 120; // 各アイテムの最小間隔
|
|
48
|
-
const minWidth =
|
|
50
|
+
const minWidth = labelW + (itemCount - 1) * minItemSpacing;
|
|
49
51
|
// 高さ: 上部ラベル(40) + nodeRadius*2 + 下部ラベル(24+32) + マージン
|
|
50
52
|
const height = 40 + nodeRadius * 2 + 8 + 24 + 32;
|
|
51
53
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/icons/renderIcon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/icons/renderIcon.ts"],"names":[],"mappings":"AA6EA,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CA0CjB"}
|
package/dist/icons/renderIcon.js
CHANGED
|
@@ -7,6 +7,13 @@ import { ICON_DATA } from "./iconData.js";
|
|
|
7
7
|
const RESVG_PKG = ["@resvg", "resvg-wasm"].join("/");
|
|
8
8
|
let resvgModule;
|
|
9
9
|
let wasmInitPromise;
|
|
10
|
+
// Function コンストラクタを使って require を取得することでバンドラの静的解析から
|
|
11
|
+
// 完全に隠蔽する。実行時は createRequire で生成した require が利用される。
|
|
12
|
+
function getNodeRequire() {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
14
|
+
const factory = new Function("url", "createRequire", "return createRequire(url)");
|
|
15
|
+
return factory(import.meta.url, createRequire);
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* WASM バイナリのパスを解決する。
|
|
12
19
|
* バンドル環境(esbuild)では同ディレクトリの index_bg.wasm を参照し、
|
|
@@ -17,8 +24,7 @@ function resolveWasmPath() {
|
|
|
17
24
|
const localPath = join(dir, "index_bg.wasm");
|
|
18
25
|
if (existsSync(localPath))
|
|
19
26
|
return localPath;
|
|
20
|
-
|
|
21
|
-
return require.resolve(`${RESVG_PKG}/index_bg.wasm`);
|
|
27
|
+
return getNodeRequire().resolve(`${RESVG_PKG}/index_bg.wasm`);
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* WASM モジュールを初期化し、Resvg クラスを返す。
|
|
@@ -27,8 +33,7 @@ function resolveWasmPath() {
|
|
|
27
33
|
function ensureWasmInitialized() {
|
|
28
34
|
if (!wasmInitPromise) {
|
|
29
35
|
wasmInitPromise = (async () => {
|
|
30
|
-
const
|
|
31
|
-
const mod = req(RESVG_PKG);
|
|
36
|
+
const mod = getNodeRequire()(RESVG_PKG);
|
|
32
37
|
const wasmPath = resolveWasmPath();
|
|
33
38
|
const wasmBuffer = await readFile(wasmPath);
|
|
34
39
|
await mod.initWasm(wasmBuffer);
|
|
@@ -35,8 +35,11 @@ export function renderTimelineNode(node, ctx) {
|
|
|
35
35
|
function renderHorizontalTimeline(node, ctx, items, defaultColor, nodeRadius, lineWidth, scaleFactor) {
|
|
36
36
|
const itemCount = items.length;
|
|
37
37
|
const lineY = node.y + node.h / 2;
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const labelW = 120 * scaleFactor;
|
|
39
|
+
// 極端に狭い node.w でも startX <= endX を保つため、インセットを node.w/2 で頭打ちする
|
|
40
|
+
const inset = Math.min(labelW / 2, node.w / 2);
|
|
41
|
+
const startX = node.x + inset;
|
|
42
|
+
const endX = node.x + node.w - inset;
|
|
40
43
|
const lineLength = endX - startX;
|
|
41
44
|
// メインの線を描画
|
|
42
45
|
ctx.slide.addShape(ctx.pptx.ShapeType.line, {
|
|
@@ -46,7 +49,6 @@ function renderHorizontalTimeline(node, ctx, items, defaultColor, nodeRadius, li
|
|
|
46
49
|
h: 0,
|
|
47
50
|
line: { color: "E2E8F0", width: pxToPt(lineWidth) },
|
|
48
51
|
});
|
|
49
|
-
const labelW = 120 * scaleFactor;
|
|
50
52
|
const dateLabelH = 24 * scaleFactor;
|
|
51
53
|
const titleLabelH = 24 * scaleFactor;
|
|
52
54
|
const descLabelH = 32 * scaleFactor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "AI-friendly PowerPoint generation with a Flexbox layout engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
63
|
-
"fast-xml-parser": "^5.
|
|
63
|
+
"fast-xml-parser": "^5.7.1",
|
|
64
64
|
"image-size": "2.0.2",
|
|
65
65
|
"jszip": "^3.10.1",
|
|
66
66
|
"opentype.js": "^1.3.4",
|