@hirokisakabe/pom 9.1.0 → 9.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildContext.js +2 -4
- package/dist/buildContext.js.map +1 -1
- package/dist/buildPptx.d.ts.map +1 -1
- package/dist/buildPptx.js +2 -6
- package/dist/buildPptx.js.map +1 -1
- package/dist/extractSlideMastersAsPptx.js +1 -1
- package/dist/renderPptx/glimpseTextBoxes.js +646 -0
- package/dist/renderPptx/glimpseTextBoxes.js.map +1 -0
- package/dist/renderPptx/nodes/flow.js +95 -90
- package/dist/renderPptx/nodes/flow.js.map +1 -1
- package/dist/renderPptx/nodes/icon.js +33 -24
- package/dist/renderPptx/nodes/icon.js.map +1 -1
- package/dist/renderPptx/nodes/image.js +5 -22
- package/dist/renderPptx/nodes/image.js.map +1 -1
- package/dist/renderPptx/nodes/list.js +96 -111
- package/dist/renderPptx/nodes/list.js.map +1 -1
- package/dist/renderPptx/nodes/matrix.js +92 -70
- package/dist/renderPptx/nodes/matrix.js.map +1 -1
- package/dist/renderPptx/nodes/processArrow.js +68 -35
- package/dist/renderPptx/nodes/processArrow.js.map +1 -1
- package/dist/renderPptx/nodes/pyramid.js +34 -16
- package/dist/renderPptx/nodes/pyramid.js.map +1 -1
- package/dist/renderPptx/nodes/shape.js +63 -37
- package/dist/renderPptx/nodes/shape.js.map +1 -1
- package/dist/renderPptx/nodes/svg.js +2 -5
- package/dist/renderPptx/nodes/svg.js.map +1 -1
- package/dist/renderPptx/nodes/text.js +16 -45
- package/dist/renderPptx/nodes/text.js.map +1 -1
- package/dist/renderPptx/nodes/timeline.js +108 -74
- package/dist/renderPptx/nodes/timeline.js.map +1 -1
- package/dist/renderPptx/nodes/tree.js +78 -79
- package/dist/renderPptx/nodes/tree.js.map +1 -1
- package/dist/renderPptx/renderPptx.js +4 -5
- package/dist/renderPptx/renderPptx.js.map +1 -1
- package/dist/renderPptx/utils/backgroundBorder.js +85 -49
- package/dist/renderPptx/utils/backgroundBorder.js.map +1 -1
- package/dist/renderPptx/utils/glimpsePicture.js +130 -0
- package/dist/renderPptx/utils/glimpsePicture.js.map +1 -0
- package/dist/renderPptx/utils/glimpseShape.js +90 -0
- package/dist/renderPptx/utils/glimpseShape.js.map +1 -0
- package/dist/renderPptx/utils/glimpseTextBox.js +126 -0
- package/dist/renderPptx/utils/glimpseTextBox.js.map +1 -0
- package/dist/renderPptx/utils/straightLine.js +29 -14
- package/dist/renderPptx/utils/straightLine.js.map +1 -1
- package/dist/renderPptx/utils/visualStyle.js +1 -24
- package/dist/renderPptx/utils/visualStyle.js.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +4 -4
- package/dist/renderPptx/glowEffects.js +0 -152
- package/dist/renderPptx/glowEffects.js.map +0 -1
- package/dist/renderPptx/gradientFills.js +0 -167
- package/dist/renderPptx/gradientFills.js.map +0 -1
package/dist/buildContext.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlimpseTextBoxRegistry } from "./renderPptx/glimpseTextBoxes.js";
|
|
2
2
|
import { DiagnosticCollector } from "./diagnostics.js";
|
|
3
|
-
import { GlowEffectRegistry } from "./renderPptx/glowEffects.js";
|
|
4
3
|
//#region src/buildContext.ts
|
|
5
4
|
function createBuildContext(textMeasurementMode = "auto") {
|
|
6
5
|
return {
|
|
@@ -9,8 +8,7 @@ function createBuildContext(textMeasurementMode = "auto") {
|
|
|
9
8
|
imageDataCache: /* @__PURE__ */ new Map(),
|
|
10
9
|
iconRasterCache: /* @__PURE__ */ new Map(),
|
|
11
10
|
diagnostics: new DiagnosticCollector(),
|
|
12
|
-
|
|
13
|
-
glowEffects: new GlowEffectRegistry()
|
|
11
|
+
glimpseTextBoxes: new GlimpseTextBoxRegistry()
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
14
|
//#endregion
|
package/dist/buildContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildContext.js","names":[],"sources":["../src/buildContext.ts"],"sourcesContent":["import type { TextMeasurementMode } from \"./calcYogaLayout/measureText.ts\";\nimport { DiagnosticCollector } from \"./diagnostics.ts\";\nimport {
|
|
1
|
+
{"version":3,"file":"buildContext.js","names":[],"sources":["../src/buildContext.ts"],"sourcesContent":["import type { TextMeasurementMode } from \"./calcYogaLayout/measureText.ts\";\nimport { DiagnosticCollector } from \"./diagnostics.ts\";\nimport { GlimpseTextBoxRegistry } from \"./renderPptx/glimpseTextBoxes.ts\";\n\nexport interface BuildContext {\n textMeasurementMode: TextMeasurementMode;\n imageSizeCache: Map<string, { widthPx: number; heightPx: number }>;\n imageDataCache: Map<string, string>;\n iconRasterCache: Map<string, string>;\n diagnostics: DiagnosticCollector;\n glimpseTextBoxes: GlimpseTextBoxRegistry;\n}\n\nexport function createBuildContext(\n textMeasurementMode: TextMeasurementMode = \"auto\",\n): BuildContext {\n return {\n textMeasurementMode,\n imageSizeCache: new Map(),\n imageDataCache: new Map(),\n iconRasterCache: new Map(),\n diagnostics: new DiagnosticCollector(),\n glimpseTextBoxes: new GlimpseTextBoxRegistry(),\n };\n}\n"],"mappings":";;;AAaA,SAAgB,mBACd,sBAA2C,QAC7B;CACd,OAAO;EACL;EACA,gCAAgB,IAAI,IAAI;EACxB,gCAAgB,IAAI,IAAI;EACxB,iCAAiB,IAAI,IAAI;EACzB,aAAa,IAAI,oBAAoB;EACrC,kBAAkB,IAAI,uBAAuB;CAC/C;AACF"}
|
package/dist/buildPptx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPptx.d.ts","names":[],"sources":["../src/buildPptx.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"buildPptx.d.ts","names":[],"sources":["../src/buildPptx.ts"],"mappings":";;;;;UAmBiB,eAAA;EACf,IAAA,sBAA0B,OAAA;EAC1B,WAAA,EAAa,UAAU;AAAA;AAAA,iBAGH,SAAA,CACpB,GAAA,UACA,SAAA;EAAa,CAAA;EAAW,CAAA;AAAA,GACxB,OAAA;EACE,MAAA,GAAS,kBAAA;EACT,UAAA,GAAa,WAAA,GAAc,UAAA;EAC3B,eAAA,GAAkB,mBAAA;EAClB,OAAA;EACA,MAAA;AAAA,IAED,OAAA,CAAQ,eAAA"}
|
package/dist/buildPptx.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { freeYogaTree } from "./shared/freeYogaTree.js";
|
|
2
|
-
import {
|
|
2
|
+
import { patchPptxWriteForGlimpseTextBoxes } from "./renderPptx/glimpseTextBoxes.js";
|
|
3
3
|
import { calcYogaLayout } from "./calcYogaLayout/calcYogaLayout.js";
|
|
4
4
|
import { autoFitSlide } from "./autoFit/autoFit.js";
|
|
5
5
|
import { DiagnosticsError } from "./diagnostics.js";
|
|
6
|
-
import { patchPptxWriteForGlowEffects } from "./renderPptx/glowEffects.js";
|
|
7
6
|
import { createBuildContext } from "./buildContext.js";
|
|
8
7
|
import { extractLayoutResults } from "./calcYogaLayout/types.js";
|
|
9
8
|
import { parseMasterPptx } from "./parseMasterPptx.js";
|
|
@@ -14,8 +13,6 @@ import { validatePositioned } from "./validatePositioned/validatePositioned.js";
|
|
|
14
13
|
//#region src/buildPptx.ts
|
|
15
14
|
async function buildPptx(xml, slideSize, options) {
|
|
16
15
|
const ctx = createBuildContext(options?.textMeasurement ?? "auto");
|
|
17
|
-
ctx.gradientFills.reserveColors(xml);
|
|
18
|
-
if (options?.master) ctx.gradientFills.reserveColors(JSON.stringify(options.master));
|
|
19
16
|
const nodes = parseXml(xml);
|
|
20
17
|
const positionedPages = [];
|
|
21
18
|
for (const [slideIndex, node] of nodes.entries()) {
|
|
@@ -44,8 +41,7 @@ async function buildPptx(xml, slideSize, options) {
|
|
|
44
41
|
ctx.diagnostics.add("MASTER_PPTX_PARSE_FAILED", message);
|
|
45
42
|
}
|
|
46
43
|
const pptx = await renderPptx(positionedPages, slideSize, ctx, master);
|
|
47
|
-
|
|
48
|
-
patchPptxWriteForGlowEffects(pptx, ctx.glowEffects);
|
|
44
|
+
patchPptxWriteForGlimpseTextBoxes(pptx, ctx.glimpseTextBoxes);
|
|
49
45
|
const diagnostics = ctx.diagnostics.items;
|
|
50
46
|
if (options?.strict && diagnostics.length > 0) throw new DiagnosticsError(diagnostics);
|
|
51
47
|
return {
|
package/dist/buildPptx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPptx.js","names":[],"sources":["../src/buildPptx.ts"],"sourcesContent":["import { autoFitSlide } from \"./autoFit/autoFit.ts\";\nimport { createBuildContext } from \"./buildContext.ts\";\nimport { calcYogaLayout } from \"./calcYogaLayout/calcYogaLayout.ts\";\nimport type { TextMeasurementMode } from \"./calcYogaLayout/measureText.ts\";\nimport type { YogaNodeMap } from \"./calcYogaLayout/types.ts\";\nimport { extractLayoutResults } from \"./calcYogaLayout/types.ts\";\nimport type { Diagnostic } from \"./diagnostics.ts\";\nimport { DiagnosticsError } from \"./diagnostics.ts\";\nimport { parseMasterPptx } from \"./parseMasterPptx.ts\";\nimport { parseXml } from \"./parseXml/parseXml.ts\";\nimport {
|
|
1
|
+
{"version":3,"file":"buildPptx.js","names":[],"sources":["../src/buildPptx.ts"],"sourcesContent":["import { autoFitSlide } from \"./autoFit/autoFit.ts\";\nimport { createBuildContext } from \"./buildContext.ts\";\nimport { calcYogaLayout } from \"./calcYogaLayout/calcYogaLayout.ts\";\nimport type { TextMeasurementMode } from \"./calcYogaLayout/measureText.ts\";\nimport type { YogaNodeMap } from \"./calcYogaLayout/types.ts\";\nimport { extractLayoutResults } from \"./calcYogaLayout/types.ts\";\nimport type { Diagnostic } from \"./diagnostics.ts\";\nimport { DiagnosticsError } from \"./diagnostics.ts\";\nimport { parseMasterPptx } from \"./parseMasterPptx.ts\";\nimport { parseXml } from \"./parseXml/parseXml.ts\";\nimport { patchPptxWriteForGlimpseTextBoxes } from \"./renderPptx/glimpseTextBoxes.ts\";\nimport { renderPptx } from \"./renderPptx/renderPptx.ts\";\nimport { freeYogaTree } from \"./shared/freeYogaTree.ts\";\nimport { toPositioned } from \"./toPositioned/toPositioned.ts\";\nimport { PositionedNode, SlideMasterOptions } from \"./types.ts\";\nimport { validatePositioned } from \"./validatePositioned/validatePositioned.ts\";\n\nexport type { TextMeasurementMode };\n\nexport interface BuildPptxResult {\n pptx: import(\"pptxgenjs\").default;\n diagnostics: Diagnostic[];\n}\n\nexport async function buildPptx(\n xml: string,\n slideSize: { w: number; h: number },\n options?: {\n master?: SlideMasterOptions;\n masterPptx?: ArrayBuffer | Uint8Array;\n textMeasurement?: TextMeasurementMode;\n autoFit?: boolean;\n strict?: boolean;\n },\n): Promise<BuildPptxResult> {\n const ctx = createBuildContext(options?.textMeasurement ?? \"auto\");\n\n const nodes = parseXml(xml);\n const positionedPages: PositionedNode[] = [];\n\n for (const [slideIndex, node] of nodes.entries()) {\n let map: YogaNodeMap | undefined;\n try {\n if (options?.autoFit !== false) {\n map = await autoFitSlide(node, slideSize, ctx);\n } else {\n map = await calcYogaLayout(node, slideSize, ctx);\n }\n const layoutMap = extractLayoutResults(map);\n const positioned = await toPositioned(node, ctx, layoutMap);\n validatePositioned(positioned, slideSize, ctx, slideIndex);\n positionedPages.push(positioned);\n } finally {\n if (map) freeYogaTree(map);\n }\n }\n\n // masterPptx から背景を抽出し、master オプションにマージ\n let master = options?.master;\n if (options?.masterPptx) {\n try {\n const bg = await parseMasterPptx(options.masterPptx);\n if (bg) {\n if (master) {\n // 明示的に background が指定されていない場合のみ、masterPptx の背景を使用\n if (!master.background) {\n master = { ...master, background: bg };\n }\n } else {\n master = { background: bg };\n }\n }\n } catch (e) {\n const message =\n e instanceof Error ? e.message : \"Unknown error parsing masterPptx\";\n ctx.diagnostics.add(\"MASTER_PPTX_PARSE_FAILED\", message);\n }\n }\n\n const pptx = await renderPptx(positionedPages, slideSize, ctx, master);\n\n // glimpse writer で生成した Text / Shape / Picture XML で marker shape を置換する\n patchPptxWriteForGlimpseTextBoxes(pptx, ctx.glimpseTextBoxes);\n\n const diagnostics = ctx.diagnostics.items;\n\n if (options?.strict && diagnostics.length > 0) {\n throw new DiagnosticsError(diagnostics);\n }\n\n return { pptx, diagnostics };\n}\n"],"mappings":";;;;;;;;;;;;;AAwBA,eAAsB,UACpB,KACA,WACA,SAO0B;CAC1B,MAAM,MAAM,mBAAmB,SAAS,mBAAmB,MAAM;CAEjE,MAAM,QAAQ,SAAS,GAAG;CAC1B,MAAM,kBAAoC,CAAC;CAE3C,KAAK,MAAM,CAAC,YAAY,SAAS,MAAM,QAAQ,GAAG;EAChD,IAAI;EACJ,IAAI;GACF,IAAI,SAAS,YAAY,OACvB,MAAM,MAAM,aAAa,MAAM,WAAW,GAAG;QAE7C,MAAM,MAAM,eAAe,MAAM,WAAW,GAAG;GAGjD,MAAM,aAAa,MAAM,aAAa,MAAM,KAD1B,qBAAqB,GACkB,CAAC;GAC1D,mBAAmB,YAAY,WAAW,KAAK,UAAU;GACzD,gBAAgB,KAAK,UAAU;EACjC,UAAU;GACR,IAAI,KAAK,aAAa,GAAG;EAC3B;CACF;CAGA,IAAI,SAAS,SAAS;CACtB,IAAI,SAAS,YACX,IAAI;EACF,MAAM,KAAK,MAAM,gBAAgB,QAAQ,UAAU;EACnD,IAAI,IACF,IAAI;OAEE,CAAC,OAAO,YACV,SAAS;IAAE,GAAG;IAAQ,YAAY;GAAG;EAAA,OAGvC,SAAS,EAAE,YAAY,GAAG;CAGhC,SAAS,GAAG;EACV,MAAM,UACJ,aAAa,QAAQ,EAAE,UAAU;EACnC,IAAI,YAAY,IAAI,4BAA4B,OAAO;CACzD;CAGF,MAAM,OAAO,MAAM,WAAW,iBAAiB,WAAW,KAAK,MAAM;CAGrE,kCAAkC,MAAM,IAAI,gBAAgB;CAE5D,MAAM,cAAc,IAAI,YAAY;CAEpC,IAAI,SAAS,UAAU,YAAY,SAAS,GAC1C,MAAM,IAAI,iBAAiB,WAAW;CAGxC,OAAO;EAAE;EAAM;CAAY;AAC7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getMasterLayoutPartPaths, getPresentationMasterPartPaths, isVisibleLayout, toUint8Array } from "./pptxLayoutEnumeration.js";
|
|
2
|
-
import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
3
2
|
import { readPptx } from "@pptx-glimpse/document";
|
|
3
|
+
import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
4
4
|
//#region src/extractSlideMastersAsPptx.ts
|
|
5
5
|
const SLIDE_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
|
6
6
|
const SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|