@hirokisakabe/pom 3.0.0 → 4.0.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/README.md +34 -21
- package/dist/calcYogaLayout/calcYogaLayout.d.ts.map +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js +29 -4
- package/dist/calcYogaLayout/fontLoader.d.ts +16 -0
- package/dist/calcYogaLayout/fontLoader.d.ts.map +1 -1
- package/dist/calcYogaLayout/fontLoader.js +28 -0
- package/dist/calcYogaLayout/measureCompositeNodes.d.ts +13 -1
- package/dist/calcYogaLayout/measureCompositeNodes.d.ts.map +1 -1
- package/dist/calcYogaLayout/measureCompositeNodes.js +21 -0
- package/dist/parseXml/inputSchema.d.ts +52 -0
- package/dist/parseXml/inputSchema.d.ts.map +1 -1
- package/dist/parseXml/inputSchema.js +9 -1
- package/dist/parseXml/parseXml.d.ts.map +1 -1
- package/dist/parseXml/parseXml.js +48 -30
- package/dist/renderPptx/nodes/index.d.ts +1 -0
- package/dist/renderPptx/nodes/index.d.ts.map +1 -1
- package/dist/renderPptx/nodes/index.js +1 -0
- package/dist/renderPptx/nodes/pyramid.d.ts +8 -0
- package/dist/renderPptx/nodes/pyramid.d.ts.map +1 -0
- package/dist/renderPptx/nodes/pyramid.js +81 -0
- package/dist/renderPptx/nodes/table.d.ts.map +1 -1
- package/dist/renderPptx/nodes/table.js +2 -0
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +4 -1
- package/dist/toPositioned/toPositioned.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.js +9 -0
- package/dist/types.d.ts +69 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
85
85
|
| Tree | Organization charts and decision trees |
|
|
86
86
|
| Flow | Flowcharts with nodes and edges |
|
|
87
87
|
| ProcessArrow | Chevron-style process diagrams |
|
|
88
|
+
| Pyramid | Pyramid diagrams for hierarchies |
|
|
88
89
|
| Line | Horizontal / vertical lines |
|
|
89
90
|
| Layer | Absolute-positioned overlay container |
|
|
90
91
|
| Box | Container for single child with padding |
|
|
@@ -99,10 +100,10 @@ For detailed node documentation, see [Nodes Reference](./docs/nodes.md).
|
|
|
99
100
|
|
|
100
101
|
```xml
|
|
101
102
|
<Chart chartType="bar" w="350" h="250" showTitle="true" title="Bar Chart" showLegend="true">
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
</
|
|
103
|
+
<ChartSeries name="Q1">
|
|
104
|
+
<ChartDataPoint label="Jan" value="30" />
|
|
105
|
+
<ChartDataPoint label="Feb" value="45" />
|
|
106
|
+
</ChartSeries>
|
|
106
107
|
</Chart>
|
|
107
108
|
```
|
|
108
109
|
|
|
@@ -115,8 +116,8 @@ For detailed node documentation, see [Nodes Reference](./docs/nodes.md).
|
|
|
115
116
|
<FlowNode id="start" shape="flowChartTerminator" text="Start" color="16A34A" />
|
|
116
117
|
<FlowNode id="process" shape="flowChartProcess" text="Process" color="1D4ED8" />
|
|
117
118
|
<FlowNode id="end" shape="flowChartTerminator" text="End" color="DC2626" />
|
|
118
|
-
<
|
|
119
|
-
<
|
|
119
|
+
<FlowConnection from="start" to="process" />
|
|
120
|
+
<FlowConnection from="process" to="end" />
|
|
120
121
|
</Flow>
|
|
121
122
|
```
|
|
122
123
|
|
|
@@ -143,16 +144,16 @@ For detailed node documentation, see [Nodes Reference](./docs/nodes.md).
|
|
|
143
144
|
|
|
144
145
|
```xml
|
|
145
146
|
<Table defaultRowHeight="36">
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
<
|
|
151
|
-
</
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
</
|
|
147
|
+
<TableColumn width="80" />
|
|
148
|
+
<TableColumn width="200" />
|
|
149
|
+
<TableRow>
|
|
150
|
+
<TableCell bold="true" backgroundColor="0F172A" color="FFFFFF">ID</TableCell>
|
|
151
|
+
<TableCell bold="true" backgroundColor="0F172A" color="FFFFFF">Name</TableCell>
|
|
152
|
+
</TableRow>
|
|
153
|
+
<TableRow>
|
|
154
|
+
<TableCell>001</TableCell>
|
|
155
|
+
<TableCell>Project Alpha</TableCell>
|
|
156
|
+
</TableRow>
|
|
156
157
|
</Table>
|
|
157
158
|
```
|
|
158
159
|
|
|
@@ -174,16 +175,28 @@ For detailed node documentation, see [Nodes Reference](./docs/nodes.md).
|
|
|
174
175
|
|
|
175
176
|
```xml
|
|
176
177
|
<ProcessArrow direction="horizontal" w="100%" h="100">
|
|
177
|
-
<
|
|
178
|
-
<
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
<
|
|
178
|
+
<ProcessArrowStep label="Planning" color="4472C4" />
|
|
179
|
+
<ProcessArrowStep label="Design" color="5B9BD5" />
|
|
180
|
+
<ProcessArrowStep label="Development" color="70AD47" />
|
|
181
|
+
<ProcessArrowStep label="Testing" color="FFC000" />
|
|
182
|
+
<ProcessArrowStep label="Release" color="ED7D31" />
|
|
182
183
|
</ProcessArrow>
|
|
183
184
|
```
|
|
184
185
|
|
|
185
186
|
<img src="./docs/images/processArrow.png" alt="ProcessArrow example" width="600">
|
|
186
187
|
|
|
188
|
+
### Pyramid
|
|
189
|
+
|
|
190
|
+
```xml
|
|
191
|
+
<Pyramid direction="up" w="600" h="300">
|
|
192
|
+
<PyramidLevel label="Strategy" color="E91E63" />
|
|
193
|
+
<PyramidLevel label="Tactics" color="9C27B0" />
|
|
194
|
+
<PyramidLevel label="Execution" color="673AB7" />
|
|
195
|
+
</Pyramid>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
<img src="./docs/images/pyramid.png" alt="Pyramid example" width="600">
|
|
199
|
+
|
|
187
200
|
## Documentation
|
|
188
201
|
|
|
189
202
|
| Document | Description |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calcYogaLayout.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/calcYogaLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"calcYogaLayout.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/calcYogaLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,aAAa,CAAC;AA+BnE;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,OAAO,EACb,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,iBAiBpC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { loadYoga } from "yoga-layout/load";
|
|
2
2
|
import { measureText } from "./measureText.js";
|
|
3
|
+
import { measureFontLineHeightRatio } from "./fontLoader.js";
|
|
3
4
|
import { measureImage, prefetchImageSize } from "../shared/measureImage.js";
|
|
4
5
|
import { calcTableIntrinsicSize } from "../shared/tableUtils.js";
|
|
5
|
-
import { measureProcessArrow, measureTimeline, measureMatrix, measureTree, measureFlow, } from "./measureCompositeNodes.js";
|
|
6
|
+
import { measureProcessArrow, measureTimeline, measureMatrix, measureTree, measureFlow, measurePyramid, } from "./measureCompositeNodes.js";
|
|
6
7
|
/**
|
|
7
8
|
* コンポジットノードの最小スケール閾値。
|
|
8
9
|
* renderPptx/utils/scaleToFit.ts の MIN_SCALE_THRESHOLD と同じ値を維持すること。
|
|
@@ -124,6 +125,7 @@ async function buildPomWithYogaTree(node, parentYoga, parentNode) {
|
|
|
124
125
|
case "tree":
|
|
125
126
|
case "flow":
|
|
126
127
|
case "processArrow":
|
|
128
|
+
case "pyramid":
|
|
127
129
|
case "line":
|
|
128
130
|
// 子要素なし
|
|
129
131
|
break;
|
|
@@ -249,7 +251,13 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
249
251
|
const fontSizePx = node.fontPx ?? 24;
|
|
250
252
|
const fontFamily = "Noto Sans JP";
|
|
251
253
|
const fontWeight = node.bold ? "bold" : "normal";
|
|
252
|
-
const
|
|
254
|
+
const lineSpacingMultiple = node.lineSpacingMultiple ?? 1.3;
|
|
255
|
+
// PowerPoint の lineSpacingMultiple はフォントメトリクス(ascent + descent)に
|
|
256
|
+
// 対する倍率。fontSizePx × fontMetricsRatio × lineSpacingMultiple で計算する。
|
|
257
|
+
const fontMetricsRatio = measureFontLineHeightRatio(fontWeight);
|
|
258
|
+
const lineHeight = fontMetricsRatio * lineSpacingMultiple;
|
|
259
|
+
// バレット/番号のインデント幅(pptxgenjs DEF_BULLET_MARGIN = 27pt = 36px @96dpi)
|
|
260
|
+
const bulletIndentPx = 36;
|
|
253
261
|
yn.setMeasureFunc((width, widthMode) => {
|
|
254
262
|
const maxWidthPx = (() => {
|
|
255
263
|
switch (widthMode) {
|
|
@@ -260,14 +268,16 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
260
268
|
return width;
|
|
261
269
|
}
|
|
262
270
|
})();
|
|
263
|
-
|
|
271
|
+
// バレットインデント分を除いたテキスト利用可能幅で計測
|
|
272
|
+
const textMaxWidthPx = Math.max(0, maxWidthPx - bulletIndentPx);
|
|
273
|
+
const { widthPx, heightPx } = measureText(combinedText, textMaxWidthPx, {
|
|
264
274
|
fontFamily,
|
|
265
275
|
fontSizePx,
|
|
266
276
|
lineHeight,
|
|
267
277
|
fontWeight,
|
|
268
278
|
});
|
|
269
279
|
return {
|
|
270
|
-
width: widthPx,
|
|
280
|
+
width: widthPx + bulletIndentPx,
|
|
271
281
|
height: heightPx,
|
|
272
282
|
};
|
|
273
283
|
});
|
|
@@ -346,6 +356,21 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
346
356
|
});
|
|
347
357
|
}
|
|
348
358
|
break;
|
|
359
|
+
case "pyramid":
|
|
360
|
+
{
|
|
361
|
+
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
362
|
+
const intrinsic = measurePyramid(node);
|
|
363
|
+
return {
|
|
364
|
+
width: widthMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
365
|
+
? constrainWithMinScale(intrinsic.width, width)
|
|
366
|
+
: intrinsic.width,
|
|
367
|
+
height: heightMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
368
|
+
? constrainWithMinScale(intrinsic.height, height)
|
|
369
|
+
: intrinsic.height,
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
break;
|
|
349
374
|
case "timeline":
|
|
350
375
|
{
|
|
351
376
|
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
@@ -10,4 +10,20 @@
|
|
|
10
10
|
* @returns テキスト幅(ピクセル)
|
|
11
11
|
*/
|
|
12
12
|
export declare function measureTextWidth(text: string, fontSizePx: number, weight: "normal" | "bold"): number;
|
|
13
|
+
/**
|
|
14
|
+
* フォントの自然な行高さ比率を取得する
|
|
15
|
+
*
|
|
16
|
+
* PowerPoint の lineSpacingMultiple はフォントサイズではなく、
|
|
17
|
+
* フォントメトリクス(ascent + descent)に対する倍率として適用される。
|
|
18
|
+
* この関数は fontSizePx に対する自然な行高さの比率を返す。
|
|
19
|
+
*
|
|
20
|
+
* - USE_TYPO_METRICS (fsSelection bit 7) が設定されている場合:
|
|
21
|
+
* sTypoAscender, sTypoDescender, sTypoLineGap を使用
|
|
22
|
+
* - 設定されていない場合:
|
|
23
|
+
* usWinAscent, usWinDescent を使用
|
|
24
|
+
*
|
|
25
|
+
* @param weight フォントウェイト
|
|
26
|
+
* @returns fontSizePx に対する行高さの比率(例: 1.448)
|
|
27
|
+
*/
|
|
28
|
+
export declare function measureFontLineHeightRatio(weight: "normal" | "bold"): number;
|
|
13
29
|
//# sourceMappingURL=fontLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fontLoader.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/fontLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,QAAQ,GAAG,MAAM,GACxB,MAAM,CAGR"}
|
|
1
|
+
{"version":3,"file":"fontLoader.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/fontLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,QAAQ,GAAG,MAAM,GACxB,MAAM,CAGR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAgB5E"}
|
|
@@ -57,3 +57,31 @@ export function measureTextWidth(text, fontSizePx, weight) {
|
|
|
57
57
|
const font = getFont(weight);
|
|
58
58
|
return font.getAdvanceWidth(text, fontSizePx, { kerning: true });
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* フォントの自然な行高さ比率を取得する
|
|
62
|
+
*
|
|
63
|
+
* PowerPoint の lineSpacingMultiple はフォントサイズではなく、
|
|
64
|
+
* フォントメトリクス(ascent + descent)に対する倍率として適用される。
|
|
65
|
+
* この関数は fontSizePx に対する自然な行高さの比率を返す。
|
|
66
|
+
*
|
|
67
|
+
* - USE_TYPO_METRICS (fsSelection bit 7) が設定されている場合:
|
|
68
|
+
* sTypoAscender, sTypoDescender, sTypoLineGap を使用
|
|
69
|
+
* - 設定されていない場合:
|
|
70
|
+
* usWinAscent, usWinDescent を使用
|
|
71
|
+
*
|
|
72
|
+
* @param weight フォントウェイト
|
|
73
|
+
* @returns fontSizePx に対する行高さの比率(例: 1.448)
|
|
74
|
+
*/
|
|
75
|
+
export function measureFontLineHeightRatio(weight) {
|
|
76
|
+
const font = getFont(weight);
|
|
77
|
+
const upm = font.unitsPerEm;
|
|
78
|
+
const os2 = font.tables?.os2;
|
|
79
|
+
if (!os2) {
|
|
80
|
+
return 1.0;
|
|
81
|
+
}
|
|
82
|
+
const useTypoMetrics = Boolean(os2.fsSelection & (1 << 7));
|
|
83
|
+
if (useTypoMetrics) {
|
|
84
|
+
return (os2.sTypoAscender - os2.sTypoDescender + os2.sTypoLineGap) / upm;
|
|
85
|
+
}
|
|
86
|
+
return (os2.usWinAscent + os2.usWinDescent) / upm;
|
|
87
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProcessArrowNode, TimelineNode, MatrixNode, TreeNode, FlowNode } from "../types.ts";
|
|
1
|
+
import type { ProcessArrowNode, TimelineNode, MatrixNode, TreeNode, FlowNode, PyramidNode } from "../types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* ProcessArrow ノードの intrinsic size を計算する
|
|
4
4
|
*/
|
|
@@ -46,4 +46,16 @@ export declare function measureFlow(node: FlowNode): {
|
|
|
46
46
|
width: number;
|
|
47
47
|
height: number;
|
|
48
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Pyramid ノードの intrinsic size を計算する
|
|
51
|
+
*
|
|
52
|
+
* ピラミッドの描画には以下のデフォルト値が使用される:
|
|
53
|
+
* - baseWidth: 400px (最も広い層の幅)
|
|
54
|
+
* - layerHeight: 50px (各層の高さ)
|
|
55
|
+
* - gap: 2px (層間の隙間)
|
|
56
|
+
*/
|
|
57
|
+
export declare function measurePyramid(node: PyramidNode): {
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
};
|
|
49
61
|
//# sourceMappingURL=measureCompositeNodes.d.ts.map
|
|
@@ -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,
|
|
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;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;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAcA"}
|
|
@@ -141,3 +141,24 @@ export function measureFlow(node) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Pyramid ノードの intrinsic size を計算する
|
|
146
|
+
*
|
|
147
|
+
* ピラミッドの描画には以下のデフォルト値が使用される:
|
|
148
|
+
* - baseWidth: 400px (最も広い層の幅)
|
|
149
|
+
* - layerHeight: 50px (各層の高さ)
|
|
150
|
+
* - gap: 2px (層間の隙間)
|
|
151
|
+
*/
|
|
152
|
+
export function measurePyramid(node) {
|
|
153
|
+
const levelCount = node.levels.length;
|
|
154
|
+
if (levelCount === 0) {
|
|
155
|
+
return { width: 0, height: 0 };
|
|
156
|
+
}
|
|
157
|
+
const baseWidth = 400;
|
|
158
|
+
const layerHeight = 50;
|
|
159
|
+
const gap = 2;
|
|
160
|
+
return {
|
|
161
|
+
width: baseWidth,
|
|
162
|
+
height: levelCount * layerHeight + (levelCount - 1) * gap,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
@@ -508,6 +508,8 @@ export declare const inputTableNodeSchema: z.ZodObject<{
|
|
|
508
508
|
center: "center";
|
|
509
509
|
}>>;
|
|
510
510
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
511
|
+
colspan: z.ZodOptional<z.ZodNumber>;
|
|
512
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
511
513
|
}, z.core.$strip>>;
|
|
512
514
|
height: z.ZodOptional<z.ZodNumber>;
|
|
513
515
|
}, z.core.$strip>>;
|
|
@@ -1179,6 +1181,56 @@ export declare const inputProcessArrowNodeSchema: z.ZodObject<{
|
|
|
1179
1181
|
strike: z.ZodOptional<z.ZodBoolean>;
|
|
1180
1182
|
highlight: z.ZodOptional<z.ZodString>;
|
|
1181
1183
|
}, z.core.$strip>;
|
|
1184
|
+
export declare const inputPyramidNodeSchema: z.ZodObject<{
|
|
1185
|
+
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1186
|
+
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1187
|
+
minW: z.ZodOptional<z.ZodNumber>;
|
|
1188
|
+
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1189
|
+
minH: z.ZodOptional<z.ZodNumber>;
|
|
1190
|
+
maxH: z.ZodOptional<z.ZodNumber>;
|
|
1191
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1192
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
1193
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
1194
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
1195
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
1196
|
+
}, z.core.$strip>]>>;
|
|
1197
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1198
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1199
|
+
src: z.ZodString;
|
|
1200
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
1201
|
+
cover: "cover";
|
|
1202
|
+
contain: "contain";
|
|
1203
|
+
}>>;
|
|
1204
|
+
}, z.core.$strip>>;
|
|
1205
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
1206
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1207
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1208
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1209
|
+
solid: "solid";
|
|
1210
|
+
dash: "dash";
|
|
1211
|
+
dashDot: "dashDot";
|
|
1212
|
+
lgDash: "lgDash";
|
|
1213
|
+
lgDashDot: "lgDashDot";
|
|
1214
|
+
lgDashDotDot: "lgDashDotDot";
|
|
1215
|
+
sysDash: "sysDash";
|
|
1216
|
+
sysDot: "sysDot";
|
|
1217
|
+
}>>;
|
|
1218
|
+
}, z.core.$strip>>;
|
|
1219
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
1220
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
1221
|
+
type: z.ZodLiteral<"pyramid">;
|
|
1222
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
1223
|
+
up: "up";
|
|
1224
|
+
down: "down";
|
|
1225
|
+
}>>;
|
|
1226
|
+
levels: z.ZodArray<z.ZodObject<{
|
|
1227
|
+
label: z.ZodString;
|
|
1228
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1229
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
1230
|
+
}, z.core.$strip>>;
|
|
1231
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1232
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
1233
|
+
}, z.core.$strip>;
|
|
1182
1234
|
export declare const inputLineNodeSchema: z.ZodObject<{
|
|
1183
1235
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1184
1236
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../../src/parseXml/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../../src/parseXml/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAsCL,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa9B,CAAC;AAKH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAe,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKhC,CAAC;AAUH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS9B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAatC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW9B,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Used by `parseXml` to validate parsed XML input.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, liNodeSchema, radarStyleSchema, bulletNumberTypeSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, lineArrowSchema, underlineSchema, backgroundImageSchema, } from "../types.js";
|
|
8
|
+
import { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, liNodeSchema, radarStyleSchema, bulletNumberTypeSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, pyramidDirectionSchema, pyramidLevelSchema, lineArrowSchema, underlineSchema, backgroundImageSchema, } from "../types.js";
|
|
9
9
|
// ===== Base Node Schema =====
|
|
10
10
|
export const inputBaseNodeSchema = z.object({
|
|
11
11
|
w: lengthSchema.optional(),
|
|
@@ -166,6 +166,13 @@ export const inputProcessArrowNodeSchema = inputBaseNodeSchema.extend({
|
|
|
166
166
|
strike: z.boolean().optional(),
|
|
167
167
|
highlight: z.string().optional(),
|
|
168
168
|
});
|
|
169
|
+
export const inputPyramidNodeSchema = inputBaseNodeSchema.extend({
|
|
170
|
+
type: z.literal("pyramid"),
|
|
171
|
+
direction: pyramidDirectionSchema.optional(),
|
|
172
|
+
levels: z.array(pyramidLevelSchema).min(1),
|
|
173
|
+
fontPx: z.number().optional(),
|
|
174
|
+
bold: z.boolean().optional(),
|
|
175
|
+
});
|
|
169
176
|
export const inputLineNodeSchema = inputBaseNodeSchema.extend({
|
|
170
177
|
type: z.literal("line"),
|
|
171
178
|
x1: z.number(),
|
|
@@ -223,6 +230,7 @@ const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
223
230
|
inputTreeNodeSchema,
|
|
224
231
|
inputFlowNodeSchema,
|
|
225
232
|
inputProcessArrowNodeSchema,
|
|
233
|
+
inputPyramidNodeSchema,
|
|
226
234
|
inputLineNodeSchema,
|
|
227
235
|
inputLayerNodeSchemaBase,
|
|
228
236
|
]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../../src/parseXml/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../../src/parseXml/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAqC3C,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBACrB,MAAM,EAAE,MAAM,EAAE;CAM7B;AA2+BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAiCrD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { XMLParser } from "fast-xml-parser";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { inputTextNodeSchema, inputUlNodeSchema, inputOlNodeSchema, inputLiNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputLineNodeSchema, inputBaseNodeSchema, } from "./inputSchema.js";
|
|
4
|
-
import { alignItemsSchema, justifyContentSchema, shadowStyleSchema, processArrowStepSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, flowNodeItemSchema, flowConnectionSchema, chartDataSchema, tableColumnSchema, tableCellSchema, } from "../types.js";
|
|
3
|
+
import { inputTextNodeSchema, inputUlNodeSchema, inputOlNodeSchema, inputLiNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputPyramidNodeSchema, inputLineNodeSchema, inputBaseNodeSchema, } from "./inputSchema.js";
|
|
4
|
+
import { alignItemsSchema, justifyContentSchema, shadowStyleSchema, processArrowStepSchema, pyramidLevelSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, flowNodeItemSchema, flowConnectionSchema, chartDataSchema, tableColumnSchema, tableCellSchema, } from "../types.js";
|
|
5
5
|
// ===== ParseXmlError =====
|
|
6
6
|
export class ParseXmlError extends Error {
|
|
7
7
|
errors;
|
|
@@ -24,6 +24,7 @@ const TAG_TO_TYPE = {
|
|
|
24
24
|
Tree: "tree",
|
|
25
25
|
Flow: "flow",
|
|
26
26
|
ProcessArrow: "processArrow",
|
|
27
|
+
Pyramid: "pyramid",
|
|
27
28
|
Ul: "ul",
|
|
28
29
|
Ol: "ol",
|
|
29
30
|
Line: "line",
|
|
@@ -48,6 +49,7 @@ const leafNodeShapes = {
|
|
|
48
49
|
tree: extractShape(inputTreeNodeSchema),
|
|
49
50
|
flow: extractShape(inputFlowNodeSchema),
|
|
50
51
|
processArrow: extractShape(inputProcessArrowNodeSchema),
|
|
52
|
+
pyramid: extractShape(inputPyramidNodeSchema),
|
|
51
53
|
line: extractShape(inputLineNodeSchema),
|
|
52
54
|
ul: extractShape(inputUlNodeSchema),
|
|
53
55
|
ol: extractShape(inputOlNodeSchema),
|
|
@@ -126,6 +128,7 @@ const leafNodeValidationSchemas = {
|
|
|
126
128
|
tree: inputTreeNodeSchema,
|
|
127
129
|
flow: inputFlowNodeSchema,
|
|
128
130
|
processArrow: inputProcessArrowNodeSchema,
|
|
131
|
+
pyramid: inputPyramidNodeSchema,
|
|
129
132
|
line: inputLineNodeSchema,
|
|
130
133
|
ul: inputUlNodeSchema,
|
|
131
134
|
ol: inputOlNodeSchema,
|
|
@@ -185,6 +188,7 @@ const CHILD_ELEMENT_PROPS = {
|
|
|
185
188
|
timeline: new Set(["items"]),
|
|
186
189
|
matrix: new Set(["axes", "items", "quadrants"]),
|
|
187
190
|
processArrow: new Set(["steps"]),
|
|
191
|
+
pyramid: new Set(["levels"]),
|
|
188
192
|
tree: new Set(["data"]),
|
|
189
193
|
ul: new Set(["items"]),
|
|
190
194
|
ol: new Set(["items"]),
|
|
@@ -408,15 +412,16 @@ function getTextContent(node) {
|
|
|
408
412
|
}
|
|
409
413
|
// ===== Child element schemas for type coercion =====
|
|
410
414
|
const childElementShapes = {
|
|
411
|
-
|
|
415
|
+
ProcessArrowStep: extractShape(processArrowStepSchema),
|
|
416
|
+
PyramidLevel: extractShape(pyramidLevelSchema),
|
|
412
417
|
TimelineItem: extractShape(timelineItemSchema),
|
|
413
|
-
|
|
414
|
-
|
|
418
|
+
MatrixAxes: extractShape(matrixAxisSchema),
|
|
419
|
+
MatrixQuadrants: extractShape(matrixQuadrantsSchema),
|
|
415
420
|
MatrixItem: extractShape(matrixItemSchema),
|
|
416
421
|
FlowNode: extractShape(flowNodeItemSchema),
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
422
|
+
FlowConnection: extractShape(flowConnectionSchema),
|
|
423
|
+
TableColumn: extractShape(tableColumnSchema),
|
|
424
|
+
TableCell: extractShape(tableCellSchema),
|
|
420
425
|
Li: extractShape(inputLiNodeSchema),
|
|
421
426
|
};
|
|
422
427
|
function coerceChildAttrs(parentTagName, tagName, attrs, errors) {
|
|
@@ -448,14 +453,26 @@ function convertProcessArrowChildren(childElements, result, errors) {
|
|
|
448
453
|
const steps = [];
|
|
449
454
|
for (const child of childElements) {
|
|
450
455
|
const tag = getTagName(child);
|
|
451
|
-
if (tag !== "
|
|
452
|
-
errors.push(`Unknown child element <${tag}> inside <ProcessArrow>. Expected: <
|
|
456
|
+
if (tag !== "ProcessArrowStep") {
|
|
457
|
+
errors.push(`Unknown child element <${tag}> inside <ProcessArrow>. Expected: <ProcessArrowStep>`);
|
|
453
458
|
continue;
|
|
454
459
|
}
|
|
455
460
|
steps.push(coerceChildAttrs("ProcessArrow", tag, getAttributes(child), errors));
|
|
456
461
|
}
|
|
457
462
|
result.steps = steps;
|
|
458
463
|
}
|
|
464
|
+
function convertPyramidChildren(childElements, result, errors) {
|
|
465
|
+
const levels = [];
|
|
466
|
+
for (const child of childElements) {
|
|
467
|
+
const tag = getTagName(child);
|
|
468
|
+
if (tag !== "PyramidLevel") {
|
|
469
|
+
errors.push(`Unknown child element <${tag}> inside <Pyramid>. Expected: <PyramidLevel>`);
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
levels.push(coerceChildAttrs("Pyramid", tag, getAttributes(child), errors));
|
|
473
|
+
}
|
|
474
|
+
result.levels = levels;
|
|
475
|
+
}
|
|
459
476
|
function convertTimelineChildren(childElements, result, errors) {
|
|
460
477
|
const items = [];
|
|
461
478
|
for (const child of childElements) {
|
|
@@ -473,17 +490,17 @@ function convertMatrixChildren(childElements, result, errors) {
|
|
|
473
490
|
for (const child of childElements) {
|
|
474
491
|
const tag = getTagName(child);
|
|
475
492
|
switch (tag) {
|
|
476
|
-
case "
|
|
493
|
+
case "MatrixAxes":
|
|
477
494
|
result.axes = coerceChildAttrs("Matrix", tag, getAttributes(child), errors);
|
|
478
495
|
break;
|
|
479
|
-
case "
|
|
496
|
+
case "MatrixQuadrants":
|
|
480
497
|
result.quadrants = coerceChildAttrs("Matrix", tag, getAttributes(child), errors);
|
|
481
498
|
break;
|
|
482
499
|
case "MatrixItem":
|
|
483
500
|
items.push(coerceChildAttrs("Matrix", tag, getAttributes(child), errors));
|
|
484
501
|
break;
|
|
485
502
|
default:
|
|
486
|
-
errors.push(`Unknown child element <${tag}> inside <Matrix>. Expected: <
|
|
503
|
+
errors.push(`Unknown child element <${tag}> inside <Matrix>. Expected: <MatrixAxes>, <MatrixQuadrants>, or <MatrixItem>`);
|
|
487
504
|
}
|
|
488
505
|
}
|
|
489
506
|
if (items.length > 0) {
|
|
@@ -499,11 +516,11 @@ function convertFlowChildren(childElements, result, errors) {
|
|
|
499
516
|
case "FlowNode":
|
|
500
517
|
nodes.push(coerceChildAttrs("Flow", tag, getAttributes(child), errors));
|
|
501
518
|
break;
|
|
502
|
-
case "
|
|
519
|
+
case "FlowConnection":
|
|
503
520
|
connections.push(coerceChildAttrs("Flow", tag, getAttributes(child), errors));
|
|
504
521
|
break;
|
|
505
522
|
default:
|
|
506
|
-
errors.push(`Unknown child element <${tag}> inside <Flow>. Expected: <FlowNode> or <
|
|
523
|
+
errors.push(`Unknown child element <${tag}> inside <Flow>. Expected: <FlowNode> or <FlowConnection>`);
|
|
507
524
|
}
|
|
508
525
|
}
|
|
509
526
|
if (nodes.length > 0) {
|
|
@@ -518,8 +535,8 @@ function convertChartChildren(childElements, result, errors) {
|
|
|
518
535
|
const data = [];
|
|
519
536
|
for (const child of childElements) {
|
|
520
537
|
const tag = getTagName(child);
|
|
521
|
-
if (tag !== "
|
|
522
|
-
errors.push(`Unknown child element <${tag}> inside <Chart>. Expected: <
|
|
538
|
+
if (tag !== "ChartSeries") {
|
|
539
|
+
errors.push(`Unknown child element <${tag}> inside <Chart>. Expected: <ChartSeries>`);
|
|
523
540
|
continue;
|
|
524
541
|
}
|
|
525
542
|
const attrs = getAttributes(child);
|
|
@@ -532,7 +549,7 @@ function convertChartChildren(childElements, result, errors) {
|
|
|
532
549
|
if (nameSchema) {
|
|
533
550
|
const coerced = coerceValue(attrs.name, nameSchema);
|
|
534
551
|
if (coerced.error !== null) {
|
|
535
|
-
errors.push(`<Chart>.<
|
|
552
|
+
errors.push(`<Chart>.<ChartSeries>: ${coerced.error}`);
|
|
536
553
|
}
|
|
537
554
|
else {
|
|
538
555
|
series.name = coerced.value;
|
|
@@ -544,23 +561,23 @@ function convertChartChildren(childElements, result, errors) {
|
|
|
544
561
|
}
|
|
545
562
|
for (const dp of getChildElements(child)) {
|
|
546
563
|
const dpTag = getTagName(dp);
|
|
547
|
-
if (dpTag !== "
|
|
548
|
-
errors.push(`Unknown child element <${dpTag}> inside <
|
|
564
|
+
if (dpTag !== "ChartDataPoint") {
|
|
565
|
+
errors.push(`Unknown child element <${dpTag}> inside <ChartSeries>. Expected: <ChartDataPoint>`);
|
|
549
566
|
continue;
|
|
550
567
|
}
|
|
551
568
|
const dpAttrs = getAttributes(dp);
|
|
552
569
|
if (dpAttrs.label === undefined) {
|
|
553
|
-
errors.push('<
|
|
570
|
+
errors.push('<ChartDataPoint> requires a "label" attribute');
|
|
554
571
|
}
|
|
555
572
|
if (dpAttrs.value === undefined) {
|
|
556
|
-
errors.push('<
|
|
573
|
+
errors.push('<ChartDataPoint> requires a "value" attribute');
|
|
557
574
|
}
|
|
558
575
|
if (dpAttrs.label === undefined || dpAttrs.value === undefined) {
|
|
559
576
|
continue;
|
|
560
577
|
}
|
|
561
578
|
const numValue = Number(dpAttrs.value);
|
|
562
579
|
if (isNaN(numValue)) {
|
|
563
|
-
errors.push(`Cannot convert "${dpAttrs.value}" to number in <
|
|
580
|
+
errors.push(`Cannot convert "${dpAttrs.value}" to number in <ChartDataPoint> "value" attribute`);
|
|
564
581
|
continue;
|
|
565
582
|
}
|
|
566
583
|
series.labels.push(dpAttrs.label);
|
|
@@ -576,19 +593,19 @@ function convertTableChildren(childElements, result, errors) {
|
|
|
576
593
|
for (const child of childElements) {
|
|
577
594
|
const tag = getTagName(child);
|
|
578
595
|
switch (tag) {
|
|
579
|
-
case "
|
|
596
|
+
case "TableColumn":
|
|
580
597
|
columns.push(coerceChildAttrs("Table", tag, getAttributes(child), errors));
|
|
581
598
|
break;
|
|
582
|
-
case "
|
|
599
|
+
case "TableRow": {
|
|
583
600
|
const rowAttrs = getAttributes(child);
|
|
584
601
|
const cells = [];
|
|
585
602
|
for (const cellEl of getChildElements(child)) {
|
|
586
603
|
const cellTag = getTagName(cellEl);
|
|
587
|
-
if (cellTag !== "
|
|
588
|
-
errors.push(`Unknown child element <${cellTag}> inside <
|
|
604
|
+
if (cellTag !== "TableCell") {
|
|
605
|
+
errors.push(`Unknown child element <${cellTag}> inside <TableRow>. Expected: <TableCell>`);
|
|
589
606
|
continue;
|
|
590
607
|
}
|
|
591
|
-
const cellAttrs = coerceChildAttrs("
|
|
608
|
+
const cellAttrs = coerceChildAttrs("TableRow", cellTag, getAttributes(cellEl), errors);
|
|
592
609
|
const cellText = getTextContent(cellEl);
|
|
593
610
|
if (cellText !== undefined && !("text" in cellAttrs)) {
|
|
594
611
|
cellAttrs.text = cellText;
|
|
@@ -599,7 +616,7 @@ function convertTableChildren(childElements, result, errors) {
|
|
|
599
616
|
if (rowAttrs.height !== undefined) {
|
|
600
617
|
const h = Number(rowAttrs.height);
|
|
601
618
|
if (isNaN(h)) {
|
|
602
|
-
errors.push(`Cannot convert "${rowAttrs.height}" to number in <
|
|
619
|
+
errors.push(`Cannot convert "${rowAttrs.height}" to number in <TableRow> "height" attribute`);
|
|
603
620
|
}
|
|
604
621
|
else {
|
|
605
622
|
row.height = h;
|
|
@@ -609,7 +626,7 @@ function convertTableChildren(childElements, result, errors) {
|
|
|
609
626
|
break;
|
|
610
627
|
}
|
|
611
628
|
default:
|
|
612
|
-
errors.push(`Unknown child element <${tag}> inside <Table>. Expected: <
|
|
629
|
+
errors.push(`Unknown child element <${tag}> inside <Table>. Expected: <TableColumn> or <TableRow>`);
|
|
613
630
|
}
|
|
614
631
|
}
|
|
615
632
|
if (columns.length > 0) {
|
|
@@ -680,6 +697,7 @@ const CHILD_ELEMENT_CONVERTERS = {
|
|
|
680
697
|
ul: (childElements, result, errors) => convertListChildren("Ul", childElements, result, errors),
|
|
681
698
|
ol: (childElements, result, errors) => convertListChildren("Ol", childElements, result, errors),
|
|
682
699
|
processArrow: convertProcessArrowChildren,
|
|
700
|
+
pyramid: convertPyramidChildren,
|
|
683
701
|
timeline: convertTimelineChildren,
|
|
684
702
|
matrix: convertMatrixChildren,
|
|
685
703
|
flow: convertFlowChildren,
|
|
@@ -8,6 +8,7 @@ export { renderMatrixNode } from "./matrix.ts";
|
|
|
8
8
|
export { renderTreeNode } from "./tree.ts";
|
|
9
9
|
export { renderFlowNode } from "./flow.ts";
|
|
10
10
|
export { renderProcessArrowNode } from "./processArrow.ts";
|
|
11
|
+
export { renderPyramidNode } from "./pyramid.ts";
|
|
11
12
|
export { renderLineNode } from "./line.ts";
|
|
12
13
|
export { renderUlNode, renderOlNode } from "./list.ts";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -8,5 +8,6 @@ export { renderMatrixNode } from "./matrix.js";
|
|
|
8
8
|
export { renderTreeNode } from "./tree.js";
|
|
9
9
|
export { renderFlowNode } from "./flow.js";
|
|
10
10
|
export { renderProcessArrowNode } from "./processArrow.js";
|
|
11
|
+
export { renderPyramidNode } from "./pyramid.js";
|
|
11
12
|
export { renderLineNode } from "./line.js";
|
|
12
13
|
export { renderUlNode, renderOlNode } from "./list.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PositionedNode } from "../../types.ts";
|
|
2
|
+
import type { RenderContext } from "../types.ts";
|
|
3
|
+
type PyramidPositionedNode = Extract<PositionedNode, {
|
|
4
|
+
type: "pyramid";
|
|
5
|
+
}>;
|
|
6
|
+
export declare function renderPyramidNode(node: PyramidPositionedNode, ctx: RenderContext): void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=pyramid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pyramid.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/pyramid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,qBAAqB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAE1E,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,qBAAqB,EAC3B,GAAG,EAAE,aAAa,GACjB,IAAI,CAgGN"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { pxToIn, pxToPt } from "../units.js";
|
|
2
|
+
import { measurePyramid } from "../../calcYogaLayout/measureCompositeNodes.js";
|
|
3
|
+
import { calcScaleFactor } from "../utils/scaleToFit.js";
|
|
4
|
+
export function renderPyramidNode(node, ctx) {
|
|
5
|
+
const direction = node.direction ?? "up";
|
|
6
|
+
const levels = node.levels;
|
|
7
|
+
const levelCount = levels.length;
|
|
8
|
+
if (levelCount === 0)
|
|
9
|
+
return;
|
|
10
|
+
const defaultColor = "4472C4";
|
|
11
|
+
const defaultTextColor = "FFFFFF";
|
|
12
|
+
// スケール係数を計算
|
|
13
|
+
const intrinsic = measurePyramid(node);
|
|
14
|
+
const scaleFactor = calcScaleFactor(node.w, node.h, intrinsic.width, intrinsic.height, "pyramid");
|
|
15
|
+
const baseWidth = 400 * scaleFactor;
|
|
16
|
+
const layerHeight = 50 * scaleFactor;
|
|
17
|
+
const gap = 2 * scaleFactor;
|
|
18
|
+
const totalHeight = levelCount * layerHeight + (levelCount - 1) * gap;
|
|
19
|
+
const startX = node.x + (node.w - baseWidth) / 2;
|
|
20
|
+
const startY = node.y + (node.h - totalHeight) / 2;
|
|
21
|
+
for (let i = 0; i < levelCount; i++) {
|
|
22
|
+
const level = levels[i];
|
|
23
|
+
const fillColor = level.color?.replace("#", "") ?? defaultColor;
|
|
24
|
+
const textColor = level.textColor?.replace("#", "") ?? defaultTextColor;
|
|
25
|
+
const layerY = startY + i * (layerHeight + gap);
|
|
26
|
+
// direction="up": i=0 が最上段(最も狭い=三角形)、i=levelCount-1 が最下段(最も広い)
|
|
27
|
+
// direction="down": i=0 が最上段(最も広い)、i=levelCount-1 が最下段(最も狭い=三角形)
|
|
28
|
+
// 頂点層の上辺は幅0(三角形)、それ以外は台形
|
|
29
|
+
let topWidthRatio;
|
|
30
|
+
let bottomWidthRatio;
|
|
31
|
+
if (direction === "up") {
|
|
32
|
+
topWidthRatio = i / levelCount;
|
|
33
|
+
bottomWidthRatio = (i + 1) / levelCount;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
topWidthRatio = (levelCount - i) / levelCount;
|
|
37
|
+
bottomWidthRatio = (levelCount - i - 1) / levelCount;
|
|
38
|
+
}
|
|
39
|
+
const topWidth = baseWidth * topWidthRatio;
|
|
40
|
+
const bottomWidth = baseWidth * bottomWidthRatio;
|
|
41
|
+
const topLeftX = startX + (baseWidth - topWidth) / 2;
|
|
42
|
+
const topRightX = topLeftX + topWidth;
|
|
43
|
+
const bottomLeftX = startX + (baseWidth - bottomWidth) / 2;
|
|
44
|
+
const bottomRightX = bottomLeftX + bottomWidth;
|
|
45
|
+
// custGeom のバウンディングボックス
|
|
46
|
+
const bboxX = Math.min(topLeftX, bottomLeftX);
|
|
47
|
+
const bboxW = Math.max(topRightX, bottomRightX) - bboxX;
|
|
48
|
+
// points はバウンディングボックス内の相対インチ座標
|
|
49
|
+
const points = [
|
|
50
|
+
{ x: pxToIn(topLeftX - bboxX), y: 0 },
|
|
51
|
+
{ x: pxToIn(topRightX - bboxX), y: 0 },
|
|
52
|
+
{ x: pxToIn(bottomRightX - bboxX), y: pxToIn(layerHeight) },
|
|
53
|
+
{ x: pxToIn(bottomLeftX - bboxX), y: pxToIn(layerHeight) },
|
|
54
|
+
{ close: true },
|
|
55
|
+
];
|
|
56
|
+
// 図形を描画(頂点層は三角形、それ以外は台形)
|
|
57
|
+
ctx.slide.addShape("custGeom", {
|
|
58
|
+
x: pxToIn(bboxX),
|
|
59
|
+
y: pxToIn(layerY),
|
|
60
|
+
w: pxToIn(bboxW),
|
|
61
|
+
h: pxToIn(layerHeight),
|
|
62
|
+
points,
|
|
63
|
+
fill: { color: fillColor },
|
|
64
|
+
line: { type: "none" },
|
|
65
|
+
});
|
|
66
|
+
// テキストを図形の中央に重ねて描画
|
|
67
|
+
ctx.slide.addText(level.label, {
|
|
68
|
+
x: pxToIn(bboxX),
|
|
69
|
+
y: pxToIn(layerY),
|
|
70
|
+
w: pxToIn(bboxW),
|
|
71
|
+
h: pxToIn(layerHeight),
|
|
72
|
+
fontSize: pxToPt((node.fontPx ?? 14) * scaleFactor),
|
|
73
|
+
fontFace: "Noto Sans JP",
|
|
74
|
+
color: textColor,
|
|
75
|
+
bold: node.bold ?? false,
|
|
76
|
+
align: "center",
|
|
77
|
+
valign: "middle",
|
|
78
|
+
autoFit: true,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,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,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,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,CAqCN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAEnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AAuBrB,KAAK,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAqJxC;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,kBAAkB,+BAiL5B"}
|
|
@@ -9,7 +9,7 @@ import { pxToIn, pxToPt } from "./units.js";
|
|
|
9
9
|
import { convertUnderline, convertStrike } from "./textOptions.js";
|
|
10
10
|
import { getImageData } from "../shared/measureImage.js";
|
|
11
11
|
import { renderBackgroundAndBorder } from "./utils/backgroundBorder.js";
|
|
12
|
-
import { renderTextNode, renderImageNode, renderTableNode, renderShapeNode, renderChartNode, renderTimelineNode, renderMatrixNode, renderTreeNode, renderFlowNode, renderProcessArrowNode, renderLineNode, renderUlNode, renderOlNode, } from "./nodes/index.js";
|
|
12
|
+
import { renderTextNode, renderImageNode, renderTableNode, renderShapeNode, renderChartNode, renderTimelineNode, renderMatrixNode, renderTreeNode, renderFlowNode, renderProcessArrowNode, renderPyramidNode, renderLineNode, renderUlNode, renderOlNode, } from "./nodes/index.js";
|
|
13
13
|
const DEFAULT_MASTER_NAME = "POM_MASTER";
|
|
14
14
|
/**
|
|
15
15
|
* MasterObject を pptxgenjs の objects 形式に変換する
|
|
@@ -282,6 +282,9 @@ export function renderPptx(pages, slidePx, master) {
|
|
|
282
282
|
case "processArrow":
|
|
283
283
|
renderProcessArrowNode(node, ctx);
|
|
284
284
|
break;
|
|
285
|
+
case "pyramid":
|
|
286
|
+
renderPyramidNode(node, ctx);
|
|
287
|
+
break;
|
|
285
288
|
case "line":
|
|
286
289
|
renderLineNode(node, ctx);
|
|
287
290
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPositioned.d.ts","sourceRoot":"","sources":["../../src/toPositioned/toPositioned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG3D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,OAAO,SAAI,EACX,OAAO,SAAI,GACV,cAAc,
|
|
1
|
+
{"version":3,"file":"toPositioned.d.ts","sourceRoot":"","sources":["../../src/toPositioned/toPositioned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG3D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,OAAO,SAAI,EACX,OAAO,SAAI,GACV,cAAc,CAoNhB"}
|
|
@@ -108,6 +108,15 @@ export function toPositioned(pom, parentX = 0, parentY = 0) {
|
|
|
108
108
|
h: layout.height,
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
+
case "pyramid": {
|
|
112
|
+
return {
|
|
113
|
+
...pom,
|
|
114
|
+
x: absoluteX,
|
|
115
|
+
y: absoluteY,
|
|
116
|
+
w: layout.width,
|
|
117
|
+
h: layout.height,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
111
120
|
case "box": {
|
|
112
121
|
return {
|
|
113
122
|
...pom,
|
package/dist/types.d.ts
CHANGED
|
@@ -773,6 +773,8 @@ export declare const tableCellSchema: z.ZodObject<{
|
|
|
773
773
|
center: "center";
|
|
774
774
|
}>>;
|
|
775
775
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
776
|
+
colspan: z.ZodOptional<z.ZodNumber>;
|
|
777
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
776
778
|
}, z.core.$strip>;
|
|
777
779
|
export declare const tableRowSchema: z.ZodObject<{
|
|
778
780
|
cells: z.ZodArray<z.ZodObject<{
|
|
@@ -809,6 +811,8 @@ export declare const tableRowSchema: z.ZodObject<{
|
|
|
809
811
|
center: "center";
|
|
810
812
|
}>>;
|
|
811
813
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
814
|
+
colspan: z.ZodOptional<z.ZodNumber>;
|
|
815
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
812
816
|
}, z.core.$strip>>;
|
|
813
817
|
height: z.ZodOptional<z.ZodNumber>;
|
|
814
818
|
}, z.core.$strip>;
|
|
@@ -892,6 +896,8 @@ export declare const tableNodeSchema: z.ZodObject<{
|
|
|
892
896
|
center: "center";
|
|
893
897
|
}>>;
|
|
894
898
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
899
|
+
colspan: z.ZodOptional<z.ZodNumber>;
|
|
900
|
+
rowspan: z.ZodOptional<z.ZodNumber>;
|
|
895
901
|
}, z.core.$strip>>;
|
|
896
902
|
height: z.ZodOptional<z.ZodNumber>;
|
|
897
903
|
}, z.core.$strip>>;
|
|
@@ -1568,6 +1574,67 @@ export declare const processArrowNodeSchema: z.ZodObject<{
|
|
|
1568
1574
|
highlight: z.ZodOptional<z.ZodString>;
|
|
1569
1575
|
}, z.core.$strip>;
|
|
1570
1576
|
export type ProcessArrowNode = z.infer<typeof processArrowNodeSchema>;
|
|
1577
|
+
export declare const pyramidDirectionSchema: z.ZodEnum<{
|
|
1578
|
+
up: "up";
|
|
1579
|
+
down: "down";
|
|
1580
|
+
}>;
|
|
1581
|
+
export declare const pyramidLevelSchema: z.ZodObject<{
|
|
1582
|
+
label: z.ZodString;
|
|
1583
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1584
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
1585
|
+
}, z.core.$strip>;
|
|
1586
|
+
export declare const pyramidNodeSchema: z.ZodObject<{
|
|
1587
|
+
yogaNode: z.ZodOptional<z.ZodCustom<YogaNode, YogaNode>>;
|
|
1588
|
+
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1589
|
+
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1590
|
+
minW: z.ZodOptional<z.ZodNumber>;
|
|
1591
|
+
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1592
|
+
minH: z.ZodOptional<z.ZodNumber>;
|
|
1593
|
+
maxH: z.ZodOptional<z.ZodNumber>;
|
|
1594
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1595
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
1596
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
1597
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
1598
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
1599
|
+
}, z.core.$strip>]>>;
|
|
1600
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1601
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1602
|
+
src: z.ZodString;
|
|
1603
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
1604
|
+
cover: "cover";
|
|
1605
|
+
contain: "contain";
|
|
1606
|
+
}>>;
|
|
1607
|
+
}, z.core.$strip>>;
|
|
1608
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
1609
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1610
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1611
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1612
|
+
solid: "solid";
|
|
1613
|
+
dash: "dash";
|
|
1614
|
+
dashDot: "dashDot";
|
|
1615
|
+
lgDash: "lgDash";
|
|
1616
|
+
lgDashDot: "lgDashDot";
|
|
1617
|
+
lgDashDotDot: "lgDashDotDot";
|
|
1618
|
+
sysDash: "sysDash";
|
|
1619
|
+
sysDot: "sysDot";
|
|
1620
|
+
}>>;
|
|
1621
|
+
}, z.core.$strip>>;
|
|
1622
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
1623
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
1624
|
+
type: z.ZodLiteral<"pyramid">;
|
|
1625
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
1626
|
+
up: "up";
|
|
1627
|
+
down: "down";
|
|
1628
|
+
}>>;
|
|
1629
|
+
levels: z.ZodArray<z.ZodObject<{
|
|
1630
|
+
label: z.ZodString;
|
|
1631
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1632
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
1633
|
+
}, z.core.$strip>>;
|
|
1634
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1635
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
1636
|
+
}, z.core.$strip>;
|
|
1637
|
+
export type PyramidNode = z.infer<typeof pyramidNodeSchema>;
|
|
1571
1638
|
export declare const flowDirectionSchema: z.ZodEnum<{
|
|
1572
1639
|
horizontal: "horizontal";
|
|
1573
1640
|
vertical: "vertical";
|
|
@@ -1815,7 +1882,7 @@ export type LayerNode = BasePOMNode & {
|
|
|
1815
1882
|
type: "layer";
|
|
1816
1883
|
children: LayerChild[];
|
|
1817
1884
|
};
|
|
1818
|
-
export type POMNode = TextNode | UlNode | OlNode | ImageNode | TableNode | BoxNode | VStackNode | HStackNode | ShapeNode | ChartNode | TimelineNode | MatrixNode | TreeNode | FlowNode | ProcessArrowNode | LineNode | LayerNode;
|
|
1885
|
+
export type POMNode = TextNode | UlNode | OlNode | ImageNode | TableNode | BoxNode | VStackNode | HStackNode | ShapeNode | ChartNode | TimelineNode | MatrixNode | TreeNode | FlowNode | ProcessArrowNode | PyramidNode | LineNode | LayerNode;
|
|
1819
1886
|
declare const positionedBaseSchema: z.ZodObject<{
|
|
1820
1887
|
x: z.ZodNumber;
|
|
1821
1888
|
y: z.ZodNumber;
|
|
@@ -1835,7 +1902,7 @@ export type PositionedNode = (TextNode & PositionedBase) | (UlNode & PositionedB
|
|
|
1835
1902
|
children: PositionedNode[];
|
|
1836
1903
|
}) | (HStackNode & PositionedBase & {
|
|
1837
1904
|
children: PositionedNode[];
|
|
1838
|
-
}) | (ShapeNode & PositionedBase) | (ChartNode & PositionedBase) | (TimelineNode & PositionedBase) | (MatrixNode & PositionedBase) | (TreeNode & PositionedBase) | (FlowNode & PositionedBase) | (ProcessArrowNode & PositionedBase) | (LineNode & PositionedBase) | (LayerNode & PositionedBase & {
|
|
1905
|
+
}) | (ShapeNode & PositionedBase) | (ChartNode & PositionedBase) | (TimelineNode & PositionedBase) | (MatrixNode & PositionedBase) | (TreeNode & PositionedBase) | (FlowNode & PositionedBase) | (ProcessArrowNode & PositionedBase) | (PyramidNode & PositionedBase) | (LineNode & PositionedBase) | (LayerNode & PositionedBase & {
|
|
1839
1906
|
children: PositionedLayerChild[];
|
|
1840
1907
|
});
|
|
1841
1908
|
declare const masterTextObjectSchema: z.ZodObject<{
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,YAAY,sEAIvB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;mBAQxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;EAS3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAI5B,CAAC;AAEH,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MAAM,uBAAuB;;;;;mBAQ3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMnC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -374,6 +374,8 @@ export const tableCellSchema = z.object({
|
|
|
374
374
|
highlight: z.string().optional(),
|
|
375
375
|
alignText: z.enum(["left", "center", "right"]).optional(),
|
|
376
376
|
backgroundColor: z.string().optional(),
|
|
377
|
+
colspan: z.number().int().min(1).optional(),
|
|
378
|
+
rowspan: z.number().int().min(1).optional(),
|
|
377
379
|
});
|
|
378
380
|
export const tableRowSchema = z.object({
|
|
379
381
|
cells: z.array(tableCellSchema),
|
|
@@ -511,6 +513,20 @@ export const processArrowNodeSchema = basePOMNodeSchema.extend({
|
|
|
511
513
|
strike: z.boolean().optional(),
|
|
512
514
|
highlight: z.string().optional(),
|
|
513
515
|
});
|
|
516
|
+
// ===== Pyramid Node =====
|
|
517
|
+
export const pyramidDirectionSchema = z.enum(["up", "down"]);
|
|
518
|
+
export const pyramidLevelSchema = z.object({
|
|
519
|
+
label: z.string(),
|
|
520
|
+
color: z.string().optional(),
|
|
521
|
+
textColor: z.string().optional(),
|
|
522
|
+
});
|
|
523
|
+
export const pyramidNodeSchema = basePOMNodeSchema.extend({
|
|
524
|
+
type: z.literal("pyramid"),
|
|
525
|
+
direction: pyramidDirectionSchema.optional(),
|
|
526
|
+
levels: z.array(pyramidLevelSchema).min(1),
|
|
527
|
+
fontPx: z.number().optional(),
|
|
528
|
+
bold: z.boolean().optional(),
|
|
529
|
+
});
|
|
514
530
|
// ===== Flow Node =====
|
|
515
531
|
export const flowDirectionSchema = z.enum(["horizontal", "vertical"]);
|
|
516
532
|
const flowNodeShapeSchema = z.enum([
|
|
@@ -628,6 +644,7 @@ const pomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
628
644
|
treeNodeSchema,
|
|
629
645
|
flowNodeSchema,
|
|
630
646
|
processArrowNodeSchema,
|
|
647
|
+
pyramidNodeSchema,
|
|
631
648
|
lineNodeSchema,
|
|
632
649
|
layerNodeSchemaBase,
|
|
633
650
|
]));
|
|
@@ -666,6 +683,7 @@ const positionedNodeSchema = z.lazy(() => z.union([
|
|
|
666
683
|
treeNodeSchema.merge(positionedBaseSchema),
|
|
667
684
|
flowNodeSchema.merge(positionedBaseSchema),
|
|
668
685
|
processArrowNodeSchema.merge(positionedBaseSchema),
|
|
686
|
+
pyramidNodeSchema.merge(positionedBaseSchema),
|
|
669
687
|
lineNodeSchema.merge(positionedBaseSchema),
|
|
670
688
|
layerNodeSchemaBase.merge(positionedBaseSchema).extend({
|
|
671
689
|
children: z.array(positionedLayerChildSchema),
|
package/package.json
CHANGED