@hirokisakabe/pom 1.0.0 → 1.1.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/buildPptx.d.ts +2 -2
- package/dist/buildPptx.d.ts.map +1 -1
- package/dist/buildPptx.js +4 -4
- package/dist/calcYogaLayout/calcYogaLayout.d.ts +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.d.ts.map +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js +62 -5
- package/dist/calcYogaLayout/measureCompositeNodes.d.ts +49 -0
- package/dist/calcYogaLayout/measureCompositeNodes.d.ts.map +1 -0
- package/dist/calcYogaLayout/measureCompositeNodes.js +143 -0
- package/dist/calcYogaLayout/measureImage.d.ts.map +1 -1
- package/dist/calcYogaLayout/measureImage.js +8 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/inputSchema.d.ts +79 -2
- package/dist/inputSchema.d.ts.map +1 -1
- package/dist/inputSchema.js +24 -1
- package/dist/renderPptx/nodes/box.d.ts +1 -0
- package/dist/renderPptx/nodes/box.js +1 -0
- package/dist/renderPptx/nodes/chart.d.ts +2 -2
- package/dist/renderPptx/nodes/chart.d.ts.map +1 -1
- package/dist/renderPptx/nodes/chart.js +1 -1
- package/dist/renderPptx/nodes/flow.d.ts +2 -2
- package/dist/renderPptx/nodes/flow.d.ts.map +1 -1
- package/dist/renderPptx/nodes/flow.js +1 -1
- package/dist/renderPptx/nodes/image.d.ts +2 -2
- package/dist/renderPptx/nodes/image.d.ts.map +1 -1
- package/dist/renderPptx/nodes/image.js +1 -1
- package/dist/renderPptx/nodes/index.d.ts +11 -10
- package/dist/renderPptx/nodes/index.d.ts.map +1 -1
- package/dist/renderPptx/nodes/index.js +11 -10
- package/dist/renderPptx/nodes/line.d.ts +8 -0
- package/dist/renderPptx/nodes/line.d.ts.map +1 -0
- package/dist/renderPptx/nodes/line.js +45 -0
- package/dist/renderPptx/nodes/matrix.d.ts +2 -2
- package/dist/renderPptx/nodes/matrix.d.ts.map +1 -1
- package/dist/renderPptx/nodes/matrix.js +1 -1
- package/dist/renderPptx/nodes/processArrow.d.ts +2 -2
- package/dist/renderPptx/nodes/processArrow.d.ts.map +1 -1
- package/dist/renderPptx/nodes/processArrow.js +1 -1
- package/dist/renderPptx/nodes/shape.d.ts +2 -2
- package/dist/renderPptx/nodes/shape.d.ts.map +1 -1
- package/dist/renderPptx/nodes/shape.js +1 -1
- package/dist/renderPptx/nodes/table.d.ts +2 -2
- package/dist/renderPptx/nodes/table.d.ts.map +1 -1
- package/dist/renderPptx/nodes/table.js +2 -2
- package/dist/renderPptx/nodes/text.d.ts +2 -2
- package/dist/renderPptx/nodes/text.d.ts.map +1 -1
- package/dist/renderPptx/nodes/text.js +1 -1
- package/dist/renderPptx/nodes/timeline.d.ts +2 -2
- package/dist/renderPptx/nodes/timeline.d.ts.map +1 -1
- package/dist/renderPptx/nodes/timeline.js +1 -1
- package/dist/renderPptx/nodes/tree.d.ts +2 -2
- package/dist/renderPptx/nodes/tree.d.ts.map +1 -1
- package/dist/renderPptx/nodes/tree.js +1 -1
- package/dist/renderPptx/renderPptx.d.ts +4 -5
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +56 -39
- package/dist/renderPptx/textOptions.d.ts +1 -1
- package/dist/renderPptx/textOptions.d.ts.map +1 -1
- package/dist/renderPptx/textOptions.js +1 -1
- package/dist/renderPptx/types.d.ts +5 -4
- package/dist/renderPptx/types.d.ts.map +1 -1
- package/dist/renderPptx/utils/backgroundBorder.d.ts +2 -2
- package/dist/renderPptx/utils/backgroundBorder.d.ts.map +1 -1
- package/dist/renderPptx/utils/backgroundBorder.js +1 -1
- package/dist/renderPptx/utils/index.d.ts +5 -5
- package/dist/renderPptx/utils/index.d.ts.map +1 -1
- package/dist/renderPptx/utils/index.js +3 -3
- package/dist/renderPptx/utils/shapeDrawing.d.ts +1 -1
- package/dist/renderPptx/utils/shapeDrawing.d.ts.map +1 -1
- package/dist/renderPptx/utils/shapeDrawing.js +1 -1
- package/dist/renderPptx/utils/textDrawing.d.ts +1 -1
- package/dist/renderPptx/utils/textDrawing.d.ts.map +1 -1
- package/dist/renderPptx/utils/textDrawing.js +1 -1
- package/dist/schema.d.ts +2 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/table/utils.d.ts +1 -1
- package/dist/table/utils.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.d.ts +1 -1
- package/dist/toPositioned/toPositioned.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.js +61 -1
- package/dist/types.d.ts +117 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +44 -0
- package/package.json +1 -1
package/dist/buildPptx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextMeasurementMode } from "./calcYogaLayout/measureText";
|
|
2
|
-
import { POMNode, SlideMasterOptions } from "./types";
|
|
1
|
+
import { TextMeasurementMode } from "./calcYogaLayout/measureText.ts";
|
|
2
|
+
import { POMNode, SlideMasterOptions } from "./types.ts";
|
|
3
3
|
export type { TextMeasurementMode };
|
|
4
4
|
export declare function buildPptx(nodes: POMNode[], slideSize: {
|
|
5
5
|
w: number;
|
package/dist/buildPptx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPptx.d.ts","sourceRoot":"","sources":["../src/buildPptx.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"buildPptx.d.ts","sourceRoot":"","sources":["../src/buildPptx.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEzE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,wBAAsB,SAAS,CAC7B,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnC,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC,wCAoBF"}
|
package/dist/buildPptx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { calcYogaLayout } from "./calcYogaLayout/calcYogaLayout";
|
|
2
|
-
import { setTextMeasurementMode, } from "./calcYogaLayout/measureText";
|
|
3
|
-
import { renderPptx } from "./renderPptx/renderPptx";
|
|
4
|
-
import { toPositioned } from "./toPositioned/toPositioned";
|
|
1
|
+
import { calcYogaLayout } from "./calcYogaLayout/calcYogaLayout.js";
|
|
2
|
+
import { setTextMeasurementMode, } from "./calcYogaLayout/measureText.js";
|
|
3
|
+
import { renderPptx } from "./renderPptx/renderPptx.js";
|
|
4
|
+
import { toPositioned } from "./toPositioned/toPositioned.js";
|
|
5
5
|
export async function buildPptx(nodes, slideSize, options) {
|
|
6
6
|
// テキスト計測モードを設定(デフォルトは auto)
|
|
7
7
|
if (options?.textMeasurement) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calcYogaLayout.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/calcYogaLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,
|
|
1
|
+
{"version":3,"file":"calcYogaLayout.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/calcYogaLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,aAAa,CAAC;AAcnE;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,OAAO,EACb,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,iBAiBpC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { loadYoga } from "yoga-layout/load";
|
|
2
|
-
import { measureText } from "./measureText";
|
|
3
|
-
import { measureImage, prefetchImageSize } from "./measureImage";
|
|
4
|
-
import { calcTableIntrinsicSize } from "../table/utils";
|
|
2
|
+
import { measureText } from "./measureText.js";
|
|
3
|
+
import { measureImage, prefetchImageSize } from "./measureImage.js";
|
|
4
|
+
import { calcTableIntrinsicSize } from "../table/utils.js";
|
|
5
|
+
import { measureProcessArrow, measureTimeline, measureMatrix, measureTree, measureFlow, } from "./measureCompositeNodes.js";
|
|
5
6
|
/**
|
|
6
7
|
* POMNode ツリーを Yoga でレイアウト計算する
|
|
7
8
|
* POMNode ツリーの各ノードに yogaNode プロパティがセットされる
|
|
@@ -45,6 +46,11 @@ function collectImageSources(node) {
|
|
|
45
46
|
traverse(child);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
49
|
+
else if (n.type === "layer") {
|
|
50
|
+
for (const child of n.children) {
|
|
51
|
+
traverse(child);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
traverse(node);
|
|
50
56
|
return sources;
|
|
@@ -84,6 +90,14 @@ async function buildPomWithYogaTree(node, parentYoga, parentNode) {
|
|
|
84
90
|
}
|
|
85
91
|
break;
|
|
86
92
|
}
|
|
93
|
+
case "layer": {
|
|
94
|
+
// layer の子要素は絶対配置なので、各子要素のサイズ計算のみ行う
|
|
95
|
+
// x, y は toPositioned で適用される
|
|
96
|
+
for (const child of node.children) {
|
|
97
|
+
await buildPomWithYogaTree(child, yn, node);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
87
101
|
case "text":
|
|
88
102
|
case "image":
|
|
89
103
|
case "table":
|
|
@@ -93,6 +107,7 @@ async function buildPomWithYogaTree(node, parentYoga, parentNode) {
|
|
|
93
107
|
case "tree":
|
|
94
108
|
case "flow":
|
|
95
109
|
case "processArrow":
|
|
110
|
+
case "line":
|
|
96
111
|
// 子要素なし
|
|
97
112
|
break;
|
|
98
113
|
}
|
|
@@ -268,12 +283,54 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
268
283
|
// テキストがない場合は、明示的にサイズが指定されていることを期待
|
|
269
284
|
}
|
|
270
285
|
break;
|
|
286
|
+
case "processArrow":
|
|
287
|
+
{
|
|
288
|
+
yn.setMeasureFunc(() => {
|
|
289
|
+
const { width, height } = measureProcessArrow(node);
|
|
290
|
+
return { width, height };
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
271
294
|
case "timeline":
|
|
295
|
+
{
|
|
296
|
+
yn.setMeasureFunc(() => {
|
|
297
|
+
const { width, height } = measureTimeline(node);
|
|
298
|
+
return { width, height };
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
272
302
|
case "matrix":
|
|
303
|
+
{
|
|
304
|
+
yn.setMeasureFunc(() => {
|
|
305
|
+
const { width, height } = measureMatrix(node);
|
|
306
|
+
return { width, height };
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
273
310
|
case "tree":
|
|
311
|
+
{
|
|
312
|
+
yn.setMeasureFunc(() => {
|
|
313
|
+
const { width, height } = measureTree(node);
|
|
314
|
+
return { width, height };
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
break;
|
|
274
318
|
case "flow":
|
|
275
|
-
|
|
276
|
-
|
|
319
|
+
{
|
|
320
|
+
yn.setMeasureFunc(() => {
|
|
321
|
+
const { width, height } = measureFlow(node);
|
|
322
|
+
return { width, height };
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case "line":
|
|
327
|
+
// line ノードは絶対座標を使用するため、Yoga レイアウトではサイズ 0 として扱う
|
|
328
|
+
yn.setWidth(0);
|
|
329
|
+
yn.setHeight(0);
|
|
330
|
+
break;
|
|
331
|
+
case "layer":
|
|
332
|
+
// layer は子を絶対配置するコンテナ
|
|
333
|
+
// サイズは明示的に指定されることを期待
|
|
277
334
|
break;
|
|
278
335
|
}
|
|
279
336
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ProcessArrowNode, TimelineNode, MatrixNode, TreeNode, FlowNode } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* ProcessArrow ノードの intrinsic size を計算する
|
|
4
|
+
*/
|
|
5
|
+
export declare function measureProcessArrow(node: ProcessArrowNode): {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Timeline ノードの intrinsic size を計算する
|
|
11
|
+
*
|
|
12
|
+
* Timeline の描画には以下の固定値が使用される:
|
|
13
|
+
* - nodeRadius: 12px (円のサイズ)
|
|
14
|
+
* - 日付ラベル領域: 上部 40px
|
|
15
|
+
* - タイトルラベル領域: 下部 24px
|
|
16
|
+
* - 説明ラベル領域: 下部 32px
|
|
17
|
+
*/
|
|
18
|
+
export declare function measureTimeline(node: TimelineNode): {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Matrix ノードの intrinsic size を計算する
|
|
24
|
+
*
|
|
25
|
+
* Matrix の描画には以下の固定値が使用される:
|
|
26
|
+
* - padding: 60px (軸ラベル用の余白)
|
|
27
|
+
* - itemSize: 24px (アイテムの円のサイズ)
|
|
28
|
+
*/
|
|
29
|
+
export declare function measureMatrix(_: MatrixNode): {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Tree ノードの intrinsic size を計算する
|
|
35
|
+
*
|
|
36
|
+
* ツリー構造を再帰的に走査し、必要なサイズを計算する
|
|
37
|
+
*/
|
|
38
|
+
export declare function measureTree(node: TreeNode): {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Flow ノードの intrinsic size を計算する
|
|
44
|
+
*/
|
|
45
|
+
export declare function measureFlow(node: FlowNode): {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=measureCompositeNodes.d.ts.map
|
|
@@ -0,0 +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,EAET,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAsBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAoCA;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"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProcessArrow ノードの intrinsic size を計算する
|
|
3
|
+
*/
|
|
4
|
+
export function measureProcessArrow(node) {
|
|
5
|
+
const stepCount = node.steps.length;
|
|
6
|
+
if (stepCount === 0) {
|
|
7
|
+
return { width: 0, height: 0 };
|
|
8
|
+
}
|
|
9
|
+
const itemWidth = node.itemWidth ?? 150;
|
|
10
|
+
const itemHeight = node.itemHeight ?? 60;
|
|
11
|
+
const gap = node.gap ?? -15;
|
|
12
|
+
const direction = node.direction ?? "horizontal";
|
|
13
|
+
if (direction === "horizontal") {
|
|
14
|
+
return {
|
|
15
|
+
width: stepCount * itemWidth + (stepCount - 1) * gap,
|
|
16
|
+
height: itemHeight,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return {
|
|
21
|
+
width: itemWidth,
|
|
22
|
+
height: stepCount * itemHeight + (stepCount - 1) * gap,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Timeline ノードの intrinsic size を計算する
|
|
28
|
+
*
|
|
29
|
+
* Timeline の描画には以下の固定値が使用される:
|
|
30
|
+
* - nodeRadius: 12px (円のサイズ)
|
|
31
|
+
* - 日付ラベル領域: 上部 40px
|
|
32
|
+
* - タイトルラベル領域: 下部 24px
|
|
33
|
+
* - 説明ラベル領域: 下部 32px
|
|
34
|
+
*/
|
|
35
|
+
export function measureTimeline(node) {
|
|
36
|
+
const itemCount = node.items.length;
|
|
37
|
+
if (itemCount === 0) {
|
|
38
|
+
return { width: 0, height: 0 };
|
|
39
|
+
}
|
|
40
|
+
const nodeRadius = 12;
|
|
41
|
+
const direction = node.direction ?? "horizontal";
|
|
42
|
+
if (direction === "horizontal") {
|
|
43
|
+
// 各アイテムの幅: 120px (ラベル幅)
|
|
44
|
+
// 最小幅: nodeRadius * 2 + (itemCount - 1) * 間隔
|
|
45
|
+
const minItemSpacing = 120; // 各アイテムの最小間隔
|
|
46
|
+
const minWidth = nodeRadius * 2 + (itemCount - 1) * minItemSpacing;
|
|
47
|
+
// 高さ: 上部ラベル(40) + nodeRadius*2 + 下部ラベル(24+32) + マージン
|
|
48
|
+
const height = 40 + nodeRadius * 2 + 8 + 24 + 32;
|
|
49
|
+
return {
|
|
50
|
+
width: minWidth,
|
|
51
|
+
height: height,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// 垂直方向
|
|
56
|
+
// 各アイテムの高さ: 約 60px
|
|
57
|
+
const minItemSpacing = 60;
|
|
58
|
+
const minHeight = nodeRadius * 2 + (itemCount - 1) * minItemSpacing;
|
|
59
|
+
// 幅: lineX(40) + nodeRadius + ラベル幅
|
|
60
|
+
const width = 40 + nodeRadius * 2 + 16 + 100;
|
|
61
|
+
return {
|
|
62
|
+
width: width,
|
|
63
|
+
height: minHeight,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Matrix ノードの intrinsic size を計算する
|
|
69
|
+
*
|
|
70
|
+
* Matrix の描画には以下の固定値が使用される:
|
|
71
|
+
* - padding: 60px (軸ラベル用の余白)
|
|
72
|
+
* - itemSize: 24px (アイテムの円のサイズ)
|
|
73
|
+
*/
|
|
74
|
+
export function measureMatrix(_) {
|
|
75
|
+
const padding = 60;
|
|
76
|
+
const minAreaSize = 100; // 最小の内部描画領域サイズ
|
|
77
|
+
return {
|
|
78
|
+
width: padding * 2 + minAreaSize,
|
|
79
|
+
height: padding * 2 + minAreaSize,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Tree ノードの intrinsic size を計算する
|
|
84
|
+
*
|
|
85
|
+
* ツリー構造を再帰的に走査し、必要なサイズを計算する
|
|
86
|
+
*/
|
|
87
|
+
export function measureTree(node) {
|
|
88
|
+
const layout = node.layout ?? "vertical";
|
|
89
|
+
const nodeWidth = node.nodeWidth ?? 120;
|
|
90
|
+
const nodeHeight = node.nodeHeight ?? 40;
|
|
91
|
+
const levelGap = node.levelGap ?? 60;
|
|
92
|
+
const siblingGap = node.siblingGap ?? 20;
|
|
93
|
+
function calculateSubtreeSize(item) {
|
|
94
|
+
if (!item.children || item.children.length === 0) {
|
|
95
|
+
return { width: nodeWidth, height: nodeHeight };
|
|
96
|
+
}
|
|
97
|
+
const childSizes = item.children.map(calculateSubtreeSize);
|
|
98
|
+
if (layout === "vertical") {
|
|
99
|
+
const childrenWidth = childSizes.reduce((sum, s) => sum + s.width, 0) +
|
|
100
|
+
siblingGap * (childSizes.length - 1);
|
|
101
|
+
const childrenHeight = Math.max(...childSizes.map((s) => s.height));
|
|
102
|
+
return {
|
|
103
|
+
width: Math.max(nodeWidth, childrenWidth),
|
|
104
|
+
height: nodeHeight + levelGap + childrenHeight,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const childrenHeight = childSizes.reduce((sum, s) => sum + s.height, 0) +
|
|
109
|
+
siblingGap * (childSizes.length - 1);
|
|
110
|
+
const childrenWidth = Math.max(...childSizes.map((s) => s.width));
|
|
111
|
+
return {
|
|
112
|
+
width: nodeWidth + levelGap + childrenWidth,
|
|
113
|
+
height: Math.max(nodeHeight, childrenHeight),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return calculateSubtreeSize(node.data);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Flow ノードの intrinsic size を計算する
|
|
121
|
+
*/
|
|
122
|
+
export function measureFlow(node) {
|
|
123
|
+
const nodeCount = node.nodes.length;
|
|
124
|
+
if (nodeCount === 0) {
|
|
125
|
+
return { width: 0, height: 0 };
|
|
126
|
+
}
|
|
127
|
+
const nodeWidth = node.nodeWidth ?? 120;
|
|
128
|
+
const nodeHeight = node.nodeHeight ?? 60;
|
|
129
|
+
const nodeGap = node.nodeGap ?? 80;
|
|
130
|
+
const direction = node.direction ?? "horizontal";
|
|
131
|
+
if (direction === "horizontal") {
|
|
132
|
+
return {
|
|
133
|
+
width: nodeCount * nodeWidth + (nodeCount - 1) * nodeGap,
|
|
134
|
+
height: nodeHeight,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return {
|
|
139
|
+
width: nodeWidth,
|
|
140
|
+
height: nodeCount * nodeHeight + (nodeCount - 1) * nodeGap,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measureImage.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/measureImage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"measureImage.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/measureImage.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CA0DD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAqDA"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createRequire } from "module";
|
|
2
2
|
import * as fs from "fs";
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
5
|
+
const imageSizeModule = require("image-size");
|
|
6
|
+
// CommonJS モジュールは .default または直接エクスポートされる場合がある
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
|
|
8
|
+
const imageSize = imageSizeModule.default ?? imageSizeModule;
|
|
9
|
+
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
|
|
3
10
|
/**
|
|
4
11
|
* 画像サイズのキャッシュ(事前取得した画像サイズを保持)
|
|
5
12
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./inputSchema";
|
|
3
|
-
export { buildPptx } from "./buildPptx";
|
|
4
|
-
export type { TextMeasurementMode } from "./buildPptx";
|
|
1
|
+
export * from "./types.ts";
|
|
2
|
+
export * from "./inputSchema.ts";
|
|
3
|
+
export { buildPptx } from "./buildPptx.ts";
|
|
4
|
+
export type { TextMeasurementMode } from "./buildPptx.ts";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./inputSchema";
|
|
3
|
-
export { buildPptx } from "./buildPptx";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./inputSchema.js";
|
|
3
|
+
export { buildPptx } from "./buildPptx.js";
|
package/dist/inputSchema.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
import { z } from "zod";
|
|
20
|
-
import { type AlignItems, type JustifyContent, type TreeDataItem } from "./types";
|
|
20
|
+
import { type AlignItems, type JustifyContent, type TreeDataItem } from "./types.ts";
|
|
21
21
|
export declare const inputBaseNodeSchema: z.ZodObject<{
|
|
22
22
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
23
23
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -761,6 +761,73 @@ export declare const inputProcessArrowNodeSchema: z.ZodObject<{
|
|
|
761
761
|
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
762
762
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
763
763
|
}, z.core.$strip>;
|
|
764
|
+
export declare const inputLineNodeSchema: z.ZodObject<{
|
|
765
|
+
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
766
|
+
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
767
|
+
minW: z.ZodOptional<z.ZodNumber>;
|
|
768
|
+
maxW: z.ZodOptional<z.ZodNumber>;
|
|
769
|
+
minH: z.ZodOptional<z.ZodNumber>;
|
|
770
|
+
maxH: z.ZodOptional<z.ZodNumber>;
|
|
771
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
772
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
773
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
774
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
775
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
776
|
+
}, z.core.$strip>]>>;
|
|
777
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
778
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
779
|
+
color: z.ZodOptional<z.ZodString>;
|
|
780
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
781
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
782
|
+
solid: "solid";
|
|
783
|
+
dash: "dash";
|
|
784
|
+
dashDot: "dashDot";
|
|
785
|
+
lgDash: "lgDash";
|
|
786
|
+
lgDashDot: "lgDashDot";
|
|
787
|
+
lgDashDotDot: "lgDashDotDot";
|
|
788
|
+
sysDash: "sysDash";
|
|
789
|
+
sysDot: "sysDot";
|
|
790
|
+
}>>;
|
|
791
|
+
}, z.core.$strip>>;
|
|
792
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
793
|
+
type: z.ZodLiteral<"line">;
|
|
794
|
+
x1: z.ZodNumber;
|
|
795
|
+
y1: z.ZodNumber;
|
|
796
|
+
x2: z.ZodNumber;
|
|
797
|
+
y2: z.ZodNumber;
|
|
798
|
+
color: z.ZodOptional<z.ZodString>;
|
|
799
|
+
lineWidth: z.ZodOptional<z.ZodNumber>;
|
|
800
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
801
|
+
solid: "solid";
|
|
802
|
+
dash: "dash";
|
|
803
|
+
dashDot: "dashDot";
|
|
804
|
+
lgDash: "lgDash";
|
|
805
|
+
lgDashDot: "lgDashDot";
|
|
806
|
+
lgDashDotDot: "lgDashDotDot";
|
|
807
|
+
sysDash: "sysDash";
|
|
808
|
+
sysDot: "sysDot";
|
|
809
|
+
}>>;
|
|
810
|
+
beginArrow: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
811
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
812
|
+
diamond: "diamond";
|
|
813
|
+
triangle: "triangle";
|
|
814
|
+
none: "none";
|
|
815
|
+
arrow: "arrow";
|
|
816
|
+
oval: "oval";
|
|
817
|
+
stealth: "stealth";
|
|
818
|
+
}>>;
|
|
819
|
+
}, z.core.$strip>]>>;
|
|
820
|
+
endArrow: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
821
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
822
|
+
diamond: "diamond";
|
|
823
|
+
triangle: "triangle";
|
|
824
|
+
none: "none";
|
|
825
|
+
arrow: "arrow";
|
|
826
|
+
oval: "oval";
|
|
827
|
+
stealth: "stealth";
|
|
828
|
+
}>>;
|
|
829
|
+
}, z.core.$strip>]>>;
|
|
830
|
+
}, z.core.$strip>;
|
|
764
831
|
export type InputTextNode = z.infer<typeof inputTextNodeSchema>;
|
|
765
832
|
export type InputImageNode = z.infer<typeof inputImageNodeSchema>;
|
|
766
833
|
export type InputTableNode = z.infer<typeof inputTableNodeSchema>;
|
|
@@ -771,6 +838,7 @@ export type InputMatrixNode = z.infer<typeof inputMatrixNodeSchema>;
|
|
|
771
838
|
export type InputTreeNode = z.infer<typeof inputTreeNodeSchema>;
|
|
772
839
|
export type InputFlowNode = z.infer<typeof inputFlowNodeSchema>;
|
|
773
840
|
export type InputProcessArrowNode = z.infer<typeof inputProcessArrowNodeSchema>;
|
|
841
|
+
export type InputLineNode = z.infer<typeof inputLineNodeSchema>;
|
|
774
842
|
export type InputBoxNode = InputBaseNode & {
|
|
775
843
|
type: "box";
|
|
776
844
|
children: InputPOMNode;
|
|
@@ -789,10 +857,19 @@ export type InputHStackNode = InputBaseNode & {
|
|
|
789
857
|
alignItems?: AlignItems;
|
|
790
858
|
justifyContent?: JustifyContent;
|
|
791
859
|
};
|
|
792
|
-
export type
|
|
860
|
+
export type InputLayerChild = InputPOMNode & {
|
|
861
|
+
x: number;
|
|
862
|
+
y: number;
|
|
863
|
+
};
|
|
864
|
+
export type InputLayerNode = InputBaseNode & {
|
|
865
|
+
type: "layer";
|
|
866
|
+
children: InputLayerChild[];
|
|
867
|
+
};
|
|
868
|
+
export type InputPOMNode = InputTextNode | InputImageNode | InputTableNode | InputBoxNode | InputVStackNode | InputHStackNode | InputShapeNode | InputChartNode | InputTimelineNode | InputMatrixNode | InputTreeNode | InputFlowNode | InputProcessArrowNode | InputLineNode | InputLayerNode;
|
|
793
869
|
export declare const inputBoxNodeSchema: z.ZodType<InputBoxNode>;
|
|
794
870
|
export declare const inputVStackNodeSchema: z.ZodType<InputVStackNode>;
|
|
795
871
|
export declare const inputHStackNodeSchema: z.ZodType<InputHStackNode>;
|
|
872
|
+
export declare const inputLayerNodeSchema: z.ZodType<InputLayerNode>;
|
|
796
873
|
/**
|
|
797
874
|
* Input schema for POM nodes (for LLM/external input validation)
|
|
798
875
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EA+BL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW9B,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGzD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAEH,eAAO,MAAM,4BAA4B;;;;;mBAQvC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC"}
|
package/dist/inputSchema.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
import { z } from "zod";
|
|
20
|
-
import { lengthSchema, paddingSchema, borderStyleSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, radarStyleSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, } from "./types";
|
|
20
|
+
import { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, radarStyleSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, lineArrowSchema, } from "./types.js";
|
|
21
21
|
// ===== Base Node Schema =====
|
|
22
22
|
export const inputBaseNodeSchema = z.object({
|
|
23
23
|
w: lengthSchema.optional(),
|
|
@@ -122,6 +122,18 @@ export const inputProcessArrowNodeSchema = inputBaseNodeSchema.extend({
|
|
|
122
122
|
fontPx: z.number().optional(),
|
|
123
123
|
bold: z.boolean().optional(),
|
|
124
124
|
});
|
|
125
|
+
export const inputLineNodeSchema = inputBaseNodeSchema.extend({
|
|
126
|
+
type: z.literal("line"),
|
|
127
|
+
x1: z.number(),
|
|
128
|
+
y1: z.number(),
|
|
129
|
+
x2: z.number(),
|
|
130
|
+
y2: z.number(),
|
|
131
|
+
color: z.string().optional(),
|
|
132
|
+
lineWidth: z.number().optional(),
|
|
133
|
+
dashType: borderDashSchema.optional(),
|
|
134
|
+
beginArrow: lineArrowSchema.optional(),
|
|
135
|
+
endArrow: lineArrowSchema.optional(),
|
|
136
|
+
});
|
|
125
137
|
// ===== Recursive Node Schemas =====
|
|
126
138
|
const inputBoxNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
127
139
|
type: z.literal("box"),
|
|
@@ -141,9 +153,18 @@ const inputHStackNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
|
141
153
|
alignItems: alignItemsSchema.optional(),
|
|
142
154
|
justifyContent: justifyContentSchema.optional(),
|
|
143
155
|
});
|
|
156
|
+
const inputLayerChildSchemaBase = z.lazy(() => inputPomNodeSchema.and(z.object({
|
|
157
|
+
x: z.number(),
|
|
158
|
+
y: z.number(),
|
|
159
|
+
})));
|
|
160
|
+
const inputLayerNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
161
|
+
type: z.literal("layer"),
|
|
162
|
+
children: z.array(inputLayerChildSchemaBase),
|
|
163
|
+
});
|
|
144
164
|
export const inputBoxNodeSchema = inputBoxNodeSchemaBase;
|
|
145
165
|
export const inputVStackNodeSchema = inputVStackNodeSchemaBase;
|
|
146
166
|
export const inputHStackNodeSchema = inputHStackNodeSchemaBase;
|
|
167
|
+
export const inputLayerNodeSchema = inputLayerNodeSchemaBase;
|
|
147
168
|
/**
|
|
148
169
|
* Input schema for POM nodes (for LLM/external input validation)
|
|
149
170
|
*
|
|
@@ -176,6 +197,8 @@ export const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
176
197
|
inputTreeNodeSchema,
|
|
177
198
|
inputFlowNodeSchema,
|
|
178
199
|
inputProcessArrowNodeSchema,
|
|
200
|
+
inputLineNodeSchema,
|
|
201
|
+
inputLayerNodeSchemaBase,
|
|
179
202
|
]));
|
|
180
203
|
// ===== Slide Master Options Schema =====
|
|
181
204
|
export const inputMasterTextObjectSchema = z.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PositionedNode } from "../../types";
|
|
2
|
-
import type { RenderContext } from "../types";
|
|
1
|
+
import type { PositionedNode } from "../../types.ts";
|
|
2
|
+
import type { RenderContext } from "../types.ts";
|
|
3
3
|
type ChartPositionedNode = Extract<PositionedNode, {
|
|
4
4
|
type: "chart";
|
|
5
5
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAwBN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PositionedNode } from "../../types";
|
|
2
|
-
import type { RenderContext } from "../types";
|
|
1
|
+
import type { PositionedNode } from "../../types.ts";
|
|
2
|
+
import type { RenderContext } from "../types.ts";
|
|
3
3
|
type FlowPositionedNode = Extract<PositionedNode, {
|
|
4
4
|
type: "flow";
|
|
5
5
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAWpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,aAAa,GACjB,IAAI,CA0GN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PositionedNode } from "../../types";
|
|
2
|
-
import type { RenderContext } from "../types";
|
|
1
|
+
import type { PositionedNode } from "../../types.ts";
|
|
2
|
+
import type { RenderContext } from "../types.ts";
|
|
3
3
|
type ImagePositionedNode = Extract<PositionedNode, {
|
|
4
4
|
type: "image";
|
|
5
5
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAeN"}
|