@hirokisakabe/pom 2.0.0 → 3.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 +158 -38
- package/dist/buildPptx.js +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.d.ts.map +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js +95 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{inputSchema.d.ts → parseXml/inputSchema.d.ts} +253 -24
- package/dist/parseXml/inputSchema.d.ts.map +1 -0
- package/dist/{inputSchema.js → parseXml/inputSchema.js} +36 -2
- package/dist/{parseXml.d.ts → parseXml/parseXml.d.ts} +1 -1
- package/dist/parseXml/parseXml.d.ts.map +1 -0
- package/dist/{parseXml.js → parseXml/parseXml.js} +30 -2
- package/dist/renderPptx/nodes/flow.d.ts.map +1 -1
- package/dist/renderPptx/nodes/flow.js +26 -16
- 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/list.d.ts +12 -0
- package/dist/renderPptx/nodes/list.d.ts.map +1 -0
- package/dist/renderPptx/nodes/list.js +145 -0
- package/dist/renderPptx/nodes/matrix.d.ts.map +1 -1
- package/dist/renderPptx/nodes/matrix.js +43 -31
- package/dist/renderPptx/nodes/processArrow.d.ts.map +1 -1
- package/dist/renderPptx/nodes/processArrow.js +14 -6
- package/dist/renderPptx/nodes/shape.js +2 -2
- package/dist/renderPptx/nodes/table.d.ts.map +1 -1
- package/dist/renderPptx/nodes/table.js +1 -1
- package/dist/renderPptx/nodes/timeline.d.ts.map +1 -1
- package/dist/renderPptx/nodes/timeline.js +58 -37
- package/dist/renderPptx/nodes/tree.d.ts.map +1 -1
- package/dist/renderPptx/nodes/tree.js +49 -40
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +8 -2
- package/dist/renderPptx/textOptions.d.ts +1 -28
- package/dist/renderPptx/textOptions.d.ts.map +1 -1
- package/dist/renderPptx/textOptions.js +1 -27
- package/dist/renderPptx/utils/backgroundBorder.js +1 -1
- package/dist/renderPptx/utils/scaleToFit.d.ts +8 -0
- package/dist/renderPptx/utils/scaleToFit.d.ts.map +1 -0
- package/dist/renderPptx/utils/scaleToFit.js +19 -0
- package/dist/shared/measureImage.d.ts.map +1 -0
- package/dist/{table/utils.d.ts → shared/tableUtils.d.ts} +1 -1
- package/dist/shared/tableUtils.d.ts.map +1 -0
- package/dist/toPositioned/toPositioned.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.js +4 -2
- package/dist/types.d.ts +277 -52
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +48 -8
- package/package.json +1 -1
- package/dist/calcYogaLayout/measureImage.d.ts.map +0 -1
- package/dist/inputSchema.d.ts.map +0 -1
- package/dist/parseXml.d.ts.map +0 -1
- package/dist/table/utils.d.ts.map +0 -1
- /package/dist/{calcYogaLayout → shared}/measureImage.d.ts +0 -0
- /package/dist/{calcYogaLayout → shared}/measureImage.js +0 -0
- /package/dist/{table/utils.js → shared/tableUtils.js} +0 -0
package/README.md
CHANGED
|
@@ -1,25 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">pom</h1>
|
|
2
|
+
<p align="center">
|
|
3
|
+
Declarative PowerPoint generation from XML — built for AI
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/@hirokisakabe/pom"><img src="https://img.shields.io/npm/v/@hirokisakabe/pom.svg" alt="npm version"></a>
|
|
8
|
+
<a href="https://github.com/hirokisakabe/pom/actions/workflows/ci.yml"><img src="https://github.com/hirokisakabe/pom/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
9
|
+
<a href="https://github.com/hirokisakabe/pom/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@hirokisakabe/pom.svg" alt="License"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<b>pom (PowerPoint Object Model)</b> is a TypeScript library that converts XML into PowerPoint files (.pptx).<br>
|
|
14
|
+
Flexbox-style layout powered by <a href="https://www.yogalayout.dev/">yoga-layout</a>, rendered with <a href="https://github.com/nicktomlin/pptxgenjs">pptxgenjs</a>.
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://pom-playground.vercel.app/"><b>Try it online — Playground</b></a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="https://pom-playground.vercel.app/">
|
|
23
|
+
<img src="./docs/images/playground.png" alt="Playground" width="800">
|
|
24
|
+
</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Table of Contents
|
|
30
|
+
|
|
31
|
+
- [Features](#features)
|
|
32
|
+
- [Quick Start](#quick-start)
|
|
33
|
+
- [Available Nodes](#available-nodes)
|
|
34
|
+
- [Node Examples](#node-examples)
|
|
35
|
+
- [Documentation](#documentation)
|
|
36
|
+
- [License](#license)
|
|
2
37
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
> **[Try it online](https://pom-playground.vercel.app/)** — XML Playground
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
38
|
+
## Features
|
|
8
39
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
40
|
+
- **AI Friendly** — Simple XML structure designed for LLM code generation. Pair with [LLM Integration guide](./docs/llm-integration.md) for prompt-ready references.
|
|
41
|
+
- **Declarative** — Describe slides as XML. No imperative API calls needed.
|
|
42
|
+
- **Flexible Layout** — Flexbox-style layout with VStack / HStack / Box, powered by yoga-layout.
|
|
43
|
+
- **Rich Nodes** — 15 built-in node types: charts, flowcharts, tables, timelines, org trees, and more.
|
|
44
|
+
- **Schema-validated** — XML input is validated with Zod schemas at runtime with clear error messages.
|
|
45
|
+
- **PowerPoint Native** — Full access to native PowerPoint shape features (roundRect, ellipse, arrows, etc.).
|
|
46
|
+
- **Pixel Units** — Intuitive pixel-based sizing (internally converted to inches at 96 DPI).
|
|
47
|
+
- **Master Slide** — Define headers, footers, and page numbers once — applied to all slides automatically.
|
|
48
|
+
- **Accurate Text Measurement** — Text width measured with opentype.js and bundled Noto Sans JP fonts for consistent layout.
|
|
11
49
|
|
|
12
|
-
|
|
13
|
-
> pom works in both Node.js and browser environments. Text measurement uses opentype.js with bundled Noto Sans JP fonts, ensuring consistent layout across all environments.
|
|
50
|
+
## Quick Start
|
|
14
51
|
|
|
15
|
-
|
|
52
|
+
> Requires Node.js 18+
|
|
16
53
|
|
|
17
54
|
```bash
|
|
18
55
|
npm install @hirokisakabe/pom
|
|
19
56
|
```
|
|
20
57
|
|
|
21
|
-
## Quick Start
|
|
22
|
-
|
|
23
58
|
```typescript
|
|
24
59
|
import { buildPptx } from "@hirokisakabe/pom";
|
|
25
60
|
|
|
@@ -34,36 +69,121 @@ const pptx = await buildPptx(xml, { w: 1280, h: 720 });
|
|
|
34
69
|
await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
35
70
|
```
|
|
36
71
|
|
|
37
|
-
## Features
|
|
38
|
-
|
|
39
|
-
- **Schema-validated**: XML input validated with Zod schemas at runtime
|
|
40
|
-
- **Declarative**: Describe slides with XML
|
|
41
|
-
- **PowerPoint First**: Native support for Shape features
|
|
42
|
-
- **Flexible Layout**: Automatic layout with VStack/HStack/Box
|
|
43
|
-
- **Pixel Units**: Intuitive pixel-based sizing (internally converted to inches)
|
|
44
|
-
- **Master Slide**: Automatically insert common headers, footers, and page numbers across all pages
|
|
45
|
-
- **AI Friendly**: Simple structure that makes it easy for LLMs to generate code
|
|
46
|
-
|
|
47
72
|
## Available Nodes
|
|
48
73
|
|
|
49
|
-
| Node | Description
|
|
50
|
-
| ------------ |
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
74
|
+
| Node | Description |
|
|
75
|
+
| ------------ | ---------------------------------------------- |
|
|
76
|
+
| Text | Text with font styling and decoration |
|
|
77
|
+
| Ul | Unordered (bullet) list with Li items |
|
|
78
|
+
| Ol | Ordered (numbered) list with Li items |
|
|
79
|
+
| Image | Images from file path, URL, or base64 |
|
|
80
|
+
| Table | Tables with customizable columns and rows |
|
|
81
|
+
| Shape | PowerPoint shapes (roundRect, ellipse, etc.) |
|
|
82
|
+
| Chart | Charts (bar, line, pie, area, doughnut, radar) |
|
|
83
|
+
| Timeline | Timeline / roadmap visualizations |
|
|
84
|
+
| Matrix | 2x2 positioning maps |
|
|
85
|
+
| Tree | Organization charts and decision trees |
|
|
86
|
+
| Flow | Flowcharts with nodes and edges |
|
|
87
|
+
| ProcessArrow | Chevron-style process diagrams |
|
|
88
|
+
| Line | Horizontal / vertical lines |
|
|
89
|
+
| Layer | Absolute-positioned overlay container |
|
|
90
|
+
| Box | Container for single child with padding |
|
|
91
|
+
| VStack | Vertical stack layout |
|
|
92
|
+
| HStack | Horizontal stack layout |
|
|
64
93
|
|
|
65
94
|
For detailed node documentation, see [Nodes Reference](./docs/nodes.md).
|
|
66
95
|
|
|
96
|
+
## Node Examples
|
|
97
|
+
|
|
98
|
+
### Chart
|
|
99
|
+
|
|
100
|
+
```xml
|
|
101
|
+
<Chart chartType="bar" w="350" h="250" showTitle="true" title="Bar Chart" showLegend="true">
|
|
102
|
+
<Series name="Q1">
|
|
103
|
+
<DataPoint label="Jan" value="30" />
|
|
104
|
+
<DataPoint label="Feb" value="45" />
|
|
105
|
+
</Series>
|
|
106
|
+
</Chart>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<img src="./docs/images/chart.png" alt="Chart example" width="600">
|
|
110
|
+
|
|
111
|
+
### Flow
|
|
112
|
+
|
|
113
|
+
```xml
|
|
114
|
+
<Flow direction="horizontal" w="100%" h="300">
|
|
115
|
+
<FlowNode id="start" shape="flowChartTerminator" text="Start" color="16A34A" />
|
|
116
|
+
<FlowNode id="process" shape="flowChartProcess" text="Process" color="1D4ED8" />
|
|
117
|
+
<FlowNode id="end" shape="flowChartTerminator" text="End" color="DC2626" />
|
|
118
|
+
<Connection from="start" to="process" />
|
|
119
|
+
<Connection from="process" to="end" />
|
|
120
|
+
</Flow>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
<img src="./docs/images/flow.png" alt="Flow example" width="600">
|
|
124
|
+
|
|
125
|
+
### Tree
|
|
126
|
+
|
|
127
|
+
```xml
|
|
128
|
+
<Tree layout="vertical" nodeShape="roundRect" w="100%" h="400">
|
|
129
|
+
<TreeItem label="CEO" color="0F172A">
|
|
130
|
+
<TreeItem label="CTO" color="1D4ED8">
|
|
131
|
+
<TreeItem label="Dev Team" color="0EA5E9" />
|
|
132
|
+
</TreeItem>
|
|
133
|
+
<TreeItem label="CFO" color="16A34A">
|
|
134
|
+
<TreeItem label="Finance" color="0EA5E9" />
|
|
135
|
+
</TreeItem>
|
|
136
|
+
</TreeItem>
|
|
137
|
+
</Tree>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
<img src="./docs/images/tree.png" alt="Tree example" width="600">
|
|
141
|
+
|
|
142
|
+
### Table
|
|
143
|
+
|
|
144
|
+
```xml
|
|
145
|
+
<Table defaultRowHeight="36">
|
|
146
|
+
<Column width="80" />
|
|
147
|
+
<Column width="200" />
|
|
148
|
+
<Row>
|
|
149
|
+
<Cell bold="true" backgroundColor="0F172A" color="FFFFFF">ID</Cell>
|
|
150
|
+
<Cell bold="true" backgroundColor="0F172A" color="FFFFFF">Name</Cell>
|
|
151
|
+
</Row>
|
|
152
|
+
<Row>
|
|
153
|
+
<Cell>001</Cell>
|
|
154
|
+
<Cell>Project Alpha</Cell>
|
|
155
|
+
</Row>
|
|
156
|
+
</Table>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
<img src="./docs/images/table.png" alt="Table example" width="600">
|
|
160
|
+
|
|
161
|
+
### Timeline
|
|
162
|
+
|
|
163
|
+
```xml
|
|
164
|
+
<Timeline direction="horizontal" w="100%" h="200">
|
|
165
|
+
<TimelineItem date="2024 Q1" title="Phase 1" description="Planning" color="1D4ED8" />
|
|
166
|
+
<TimelineItem date="2024 Q2" title="Phase 2" description="Development" color="16A34A" />
|
|
167
|
+
<TimelineItem date="2024 Q3" title="Phase 3" description="Testing" color="0EA5E9" />
|
|
168
|
+
</Timeline>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
<img src="./docs/images/timeline.png" alt="Timeline example" width="600">
|
|
172
|
+
|
|
173
|
+
### ProcessArrow
|
|
174
|
+
|
|
175
|
+
```xml
|
|
176
|
+
<ProcessArrow direction="horizontal" w="100%" h="100">
|
|
177
|
+
<Step label="Planning" color="4472C4" />
|
|
178
|
+
<Step label="Design" color="5B9BD5" />
|
|
179
|
+
<Step label="Development" color="70AD47" />
|
|
180
|
+
<Step label="Testing" color="FFC000" />
|
|
181
|
+
<Step label="Release" color="ED7D31" />
|
|
182
|
+
</ProcessArrow>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
<img src="./docs/images/processArrow.png" alt="ProcessArrow example" width="600">
|
|
186
|
+
|
|
67
187
|
## Documentation
|
|
68
188
|
|
|
69
189
|
| Document | Description |
|
package/dist/buildPptx.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { calcYogaLayout } from "./calcYogaLayout/calcYogaLayout.js";
|
|
2
2
|
import { setTextMeasurementMode, } from "./calcYogaLayout/measureText.js";
|
|
3
|
-
import { parseXml } from "./parseXml.js";
|
|
3
|
+
import { parseXml } from "./parseXml/parseXml.js";
|
|
4
4
|
import { renderPptx } from "./renderPptx/renderPptx.js";
|
|
5
5
|
import { toPositioned } from "./toPositioned/toPositioned.js";
|
|
6
6
|
export async function buildPptx(xml, slideSize, options) {
|
|
@@ -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;AA6BnE;;;;;;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,18 @@
|
|
|
1
1
|
import { loadYoga } from "yoga-layout/load";
|
|
2
2
|
import { measureText } from "./measureText.js";
|
|
3
|
-
import { measureImage, prefetchImageSize } from "
|
|
4
|
-
import { calcTableIntrinsicSize } from "../
|
|
3
|
+
import { measureImage, prefetchImageSize } from "../shared/measureImage.js";
|
|
4
|
+
import { calcTableIntrinsicSize } from "../shared/tableUtils.js";
|
|
5
5
|
import { measureProcessArrow, measureTimeline, measureMatrix, measureTree, measureFlow, } from "./measureCompositeNodes.js";
|
|
6
|
+
/**
|
|
7
|
+
* コンポジットノードの最小スケール閾値。
|
|
8
|
+
* renderPptx/utils/scaleToFit.ts の MIN_SCALE_THRESHOLD と同じ値を維持すること。
|
|
9
|
+
*/
|
|
10
|
+
const MIN_SCALE_THRESHOLD = 0.5;
|
|
11
|
+
/** 制約付きサイズを閾値でクランプする */
|
|
12
|
+
function constrainWithMinScale(intrinsicSize, availableSize) {
|
|
13
|
+
const minSize = intrinsicSize * MIN_SCALE_THRESHOLD;
|
|
14
|
+
return Math.max(minSize, Math.min(intrinsicSize, availableSize));
|
|
15
|
+
}
|
|
6
16
|
/**
|
|
7
17
|
* POMNode ツリーを Yoga でレイアウト計算する
|
|
8
18
|
* POMNode ツリーの各ノードに yogaNode プロパティがセットされる
|
|
@@ -232,6 +242,37 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
232
242
|
});
|
|
233
243
|
}
|
|
234
244
|
break;
|
|
245
|
+
case "ul":
|
|
246
|
+
case "ol":
|
|
247
|
+
{
|
|
248
|
+
const combinedText = node.items.map((item) => item.text).join("\n");
|
|
249
|
+
const fontSizePx = node.fontPx ?? 24;
|
|
250
|
+
const fontFamily = "Noto Sans JP";
|
|
251
|
+
const fontWeight = node.bold ? "bold" : "normal";
|
|
252
|
+
const lineHeight = node.lineSpacingMultiple ?? 1.3;
|
|
253
|
+
yn.setMeasureFunc((width, widthMode) => {
|
|
254
|
+
const maxWidthPx = (() => {
|
|
255
|
+
switch (widthMode) {
|
|
256
|
+
case yoga.MEASURE_MODE_UNDEFINED:
|
|
257
|
+
return Number.POSITIVE_INFINITY;
|
|
258
|
+
case yoga.MEASURE_MODE_EXACTLY:
|
|
259
|
+
case yoga.MEASURE_MODE_AT_MOST:
|
|
260
|
+
return width;
|
|
261
|
+
}
|
|
262
|
+
})();
|
|
263
|
+
const { widthPx, heightPx } = measureText(combinedText, maxWidthPx, {
|
|
264
|
+
fontFamily,
|
|
265
|
+
fontSizePx,
|
|
266
|
+
lineHeight,
|
|
267
|
+
fontWeight,
|
|
268
|
+
});
|
|
269
|
+
return {
|
|
270
|
+
width: widthPx,
|
|
271
|
+
height: heightPx,
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
235
276
|
case "image":
|
|
236
277
|
{
|
|
237
278
|
const src = node.src;
|
|
@@ -262,9 +303,9 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
262
303
|
// テキストがある場合、テキストサイズを測定
|
|
263
304
|
const text = node.text;
|
|
264
305
|
const fontSizePx = node.fontPx ?? 24;
|
|
265
|
-
const fontFamily = "Noto Sans JP";
|
|
306
|
+
const fontFamily = node.fontFamily ?? "Noto Sans JP";
|
|
266
307
|
const fontWeight = node.bold ? "bold" : "normal";
|
|
267
|
-
const lineHeight = 1.3;
|
|
308
|
+
const lineHeight = node.lineSpacingMultiple ?? 1.3;
|
|
268
309
|
yn.setMeasureFunc((width, widthMode) => {
|
|
269
310
|
const maxWidthPx = (() => {
|
|
270
311
|
switch (widthMode) {
|
|
@@ -292,41 +333,76 @@ async function applyStyleToYogaNode(node, yn) {
|
|
|
292
333
|
break;
|
|
293
334
|
case "processArrow":
|
|
294
335
|
{
|
|
295
|
-
yn.setMeasureFunc(() => {
|
|
296
|
-
const
|
|
297
|
-
return {
|
|
336
|
+
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
337
|
+
const intrinsic = measureProcessArrow(node);
|
|
338
|
+
return {
|
|
339
|
+
width: widthMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
340
|
+
? constrainWithMinScale(intrinsic.width, width)
|
|
341
|
+
: intrinsic.width,
|
|
342
|
+
height: heightMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
343
|
+
? constrainWithMinScale(intrinsic.height, height)
|
|
344
|
+
: intrinsic.height,
|
|
345
|
+
};
|
|
298
346
|
});
|
|
299
347
|
}
|
|
300
348
|
break;
|
|
301
349
|
case "timeline":
|
|
302
350
|
{
|
|
303
|
-
yn.setMeasureFunc(() => {
|
|
304
|
-
const
|
|
305
|
-
return {
|
|
351
|
+
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
352
|
+
const intrinsic = measureTimeline(node);
|
|
353
|
+
return {
|
|
354
|
+
width: widthMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
355
|
+
? constrainWithMinScale(intrinsic.width, width)
|
|
356
|
+
: intrinsic.width,
|
|
357
|
+
height: heightMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
358
|
+
? constrainWithMinScale(intrinsic.height, height)
|
|
359
|
+
: intrinsic.height,
|
|
360
|
+
};
|
|
306
361
|
});
|
|
307
362
|
}
|
|
308
363
|
break;
|
|
309
364
|
case "matrix":
|
|
310
365
|
{
|
|
311
|
-
yn.setMeasureFunc(() => {
|
|
312
|
-
const
|
|
313
|
-
return {
|
|
366
|
+
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
367
|
+
const intrinsic = measureMatrix(node);
|
|
368
|
+
return {
|
|
369
|
+
width: widthMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
370
|
+
? constrainWithMinScale(intrinsic.width, width)
|
|
371
|
+
: intrinsic.width,
|
|
372
|
+
height: heightMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
373
|
+
? constrainWithMinScale(intrinsic.height, height)
|
|
374
|
+
: intrinsic.height,
|
|
375
|
+
};
|
|
314
376
|
});
|
|
315
377
|
}
|
|
316
378
|
break;
|
|
317
379
|
case "tree":
|
|
318
380
|
{
|
|
319
|
-
yn.setMeasureFunc(() => {
|
|
320
|
-
const
|
|
321
|
-
return {
|
|
381
|
+
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
382
|
+
const intrinsic = measureTree(node);
|
|
383
|
+
return {
|
|
384
|
+
width: widthMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
385
|
+
? constrainWithMinScale(intrinsic.width, width)
|
|
386
|
+
: intrinsic.width,
|
|
387
|
+
height: heightMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
388
|
+
? constrainWithMinScale(intrinsic.height, height)
|
|
389
|
+
: intrinsic.height,
|
|
390
|
+
};
|
|
322
391
|
});
|
|
323
392
|
}
|
|
324
393
|
break;
|
|
325
394
|
case "flow":
|
|
326
395
|
{
|
|
327
|
-
yn.setMeasureFunc(() => {
|
|
328
|
-
const
|
|
329
|
-
return {
|
|
396
|
+
yn.setMeasureFunc((width, widthMode, height, heightMode) => {
|
|
397
|
+
const intrinsic = measureFlow(node);
|
|
398
|
+
return {
|
|
399
|
+
width: widthMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
400
|
+
? constrainWithMinScale(intrinsic.width, width)
|
|
401
|
+
: intrinsic.width,
|
|
402
|
+
height: heightMode !== yoga.MEASURE_MODE_UNDEFINED
|
|
403
|
+
? constrainWithMinScale(intrinsic.height, height)
|
|
404
|
+
: intrinsic.height,
|
|
405
|
+
};
|
|
330
406
|
});
|
|
331
407
|
}
|
|
332
408
|
break;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { buildPptx } from "./buildPptx.ts";
|
|
2
2
|
export type { TextMeasurementMode } from "./buildPptx.ts";
|
|
3
|
-
export { ParseXmlError } from "./parseXml.ts";
|
|
3
|
+
export { ParseXmlError } from "./parseXml/parseXml.ts";
|
|
4
4
|
export type { SlideMasterOptions, SlideMasterBackground, SlideMasterMargin, MasterObject, MasterTextObject, MasterImageObject, MasterRectObject, MasterLineObject, SlideNumberOptions, } from "./types.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,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { buildPptx } from "./buildPptx.js";
|
|
2
|
-
export { ParseXmlError } from "./parseXml.js";
|
|
2
|
+
export { ParseXmlError } from "./parseXml/parseXml.js";
|