@hirokisakabe/pom 0.1.1 → 0.1.3
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
CHANGED
package/dist/buildPptx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPptx.d.ts","sourceRoot":"","sources":["../src/buildPptx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAElD,wBAAsB,SAAS,CAC7B,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"buildPptx.d.ts","sourceRoot":"","sources":["../src/buildPptx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAElD,wBAAsB,SAAS,CAC7B,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,wCAapC"}
|
package/dist/buildPptx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calcYogaLayout } from "./calcYogaLayout/calcYogaLayout";
|
|
2
2
|
import { renderPptx } from "./renderPptx/renderPptx";
|
|
3
3
|
import { toPositioned } from "./toPositioned/toPositioned";
|
|
4
|
-
export async function buildPptx(nodes, slideSize
|
|
4
|
+
export async function buildPptx(nodes, slideSize) {
|
|
5
5
|
const positionedPages = [];
|
|
6
6
|
for (const node of nodes) {
|
|
7
7
|
await calcYogaLayout(node, slideSize);
|
|
@@ -9,5 +9,5 @@ export async function buildPptx(nodes, slideSize, fileName) {
|
|
|
9
9
|
positionedPages.push(positioned);
|
|
10
10
|
}
|
|
11
11
|
const pptx = renderPptx(positionedPages, slideSize);
|
|
12
|
-
|
|
12
|
+
return pptx;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type PptxGenJSType from "pptxgenjs";
|
|
2
2
|
import type { PositionedNode } from "../types";
|
|
3
3
|
export declare const PX_PER_IN = 96;
|
|
4
4
|
export declare const pxToIn: (px: number) => number;
|
|
@@ -13,6 +13,6 @@ type SlidePx = {
|
|
|
13
13
|
* @param slidePx スライド全体のサイズ(px)
|
|
14
14
|
* @returns PptxGenJS インスタンス
|
|
15
15
|
*/
|
|
16
|
-
export declare function renderPptx(pages: PositionedNode[], slidePx: SlidePx):
|
|
16
|
+
export declare function renderPptx(pages: PositionedNode[], slidePx: SlidePx): PptxGenJSType;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=renderPptx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,MAAM,GAAI,IAAI,MAAM,WAAmB,CAAC;AACrD,eAAO,MAAM,MAAM,GAAI,IAAI,MAAM,WAA0B,CAAC;AAE5D,KAAK,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,OAAO,iBAqMnE"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const PptxGenJS = require("pptxgenjs");
|
|
2
4
|
import { resolveRowHeights } from "../table/utils";
|
|
3
5
|
export const PX_PER_IN = 96;
|
|
4
6
|
export const pxToIn = (px) => px / PX_PER_IN;
|
|
@@ -11,9 +13,7 @@ export const pxToPt = (px) => (px * 72) / PX_PER_IN;
|
|
|
11
13
|
*/
|
|
12
14
|
export function renderPptx(pages, slidePx) {
|
|
13
15
|
const slideIn = { w: pxToIn(slidePx.w), h: pxToIn(slidePx.h) }; // layout(=px) → PptxGenJS(=inch) への最終変換
|
|
14
|
-
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
16
|
-
const pptx = new PptxGenJS.default();
|
|
16
|
+
const pptx = new PptxGenJS();
|
|
17
17
|
pptx.defineLayout({ name: "custom", width: slideIn.w, height: slideIn.h });
|
|
18
18
|
pptx.layout = "custom";
|
|
19
19
|
for (const data of pages) {
|
|
@@ -67,6 +67,7 @@ export function renderPptx(pages, slidePx) {
|
|
|
67
67
|
align: "left",
|
|
68
68
|
valign: "top",
|
|
69
69
|
margin: 0,
|
|
70
|
+
lineSpacingMultiple: 1.3,
|
|
70
71
|
};
|
|
71
72
|
slide.addText(node.text ?? "", opts);
|
|
72
73
|
break;
|
|
@@ -164,6 +165,7 @@ export function renderPptx(pages, slidePx) {
|
|
|
164
165
|
color: node.fontColor,
|
|
165
166
|
align: node.alignText ?? "center",
|
|
166
167
|
valign: "middle",
|
|
168
|
+
lineSpacingMultiple: 1.3,
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
171
|
else {
|
package/package.json
CHANGED