ooxml-core 1.24.0 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{PptxHandler-FSKKPZZC.mjs → PptxHandler-5TWAQWPK.mjs} +2 -2
- package/dist/{PptxHandler-H7MEWJJJ.mjs → PptxHandler-KBJ4TN3T.mjs} +1 -1
- package/dist/{PptxHandler-DNSXWTQV.cjs → PptxHandler-KFEE7O7W.cjs} +2 -2
- package/dist/{PresentationBuilder-7TSENZTX.mjs → PresentationBuilder-SCT5AQBP.mjs} +1 -1
- package/dist/{PresentationBuilder-RIJWQSEU.mjs → PresentationBuilder-SVHIKT4C.mjs} +2 -2
- package/dist/{PresentationBuilder-A5NI35VN.cjs → PresentationBuilder-SXLRXYDI.cjs} +4 -4
- package/dist/{chunk-4QPOJCJG.mjs → chunk-7N7C5BNM.mjs} +1 -1
- package/dist/{chunk-DLFMCZZT.mjs → chunk-CWCDFPKN.mjs} +1 -1
- package/dist/{chunk-LF5E5ZOH.mjs → chunk-GVP262WE.mjs} +25 -62
- package/dist/{chunk-VQF6HQEE.mjs → chunk-KVKTHGIY.mjs} +1 -1
- package/dist/{chunk-BA7Z6ATM.mjs → chunk-NE7626A4.mjs} +4 -4
- package/dist/{chunk-Q5PKBQXH.mjs → chunk-ON7XVRHQ.mjs} +26 -63
- package/dist/{chunk-HL3FBJ6X.cjs → chunk-XK55DEUD.cjs} +25 -62
- package/dist/pptx/automation/index.cjs +25 -67
- package/dist/pptx/automation/index.d.ts +3 -2
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Q5mM8kIR.d.ts → index-4FmgJajb.d.ts} +3 -2
- package/dist/pptx/chunks/index-4FmgJajb.d.ts.map +1 -0
- package/dist/pptx/chunks/index-C3xhAMSa.d.ts +837 -0
- package/dist/pptx/chunks/index-C3xhAMSa.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CPhsd7Df.d.ts → index-nKQ4s7FA.d.ts} +24 -834
- package/dist/pptx/chunks/index-nKQ4s7FA.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +25 -67
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +25 -67
- package/dist/pptx/index.d.ts +4 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.cjs +40 -0
- package/dist/pptx/node/index.d.ts +13 -0
- package/dist/pptx/node/index.d.ts.map +1 -0
- package/dist/pptx/node/index.mjs +40 -0
- package/package.json +6 -1
- package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +0 -1
- package/dist/pptx/chunks/index-Q5mM8kIR.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ import { xml, opc } from 'ooxml-core'; // or by namespace (shared building block
|
|
|
56
56
|
| `crypto` | ECMA-376 package encryption ([MS-OFFCRYPTO]) for every format: `decryptOoxmlPackage`, `encryptOoxmlPackage` (agile AES-256/SHA-512 by default, or Standard), `isEncryptedOoxmlPackage`, and typed errors with a `code` (`password-required`, `incorrect-password`, `data-integrity`). The compound-file container comes from ole2 (inlined); not in the root entry. |
|
|
57
57
|
| `collab` | Format-neutral real-time collaboration on Yjs: session and provider lifecycle, awareness/presence, transport-neutral sync (WebSocket, in-memory, any byte channel), update codecs, ordering helpers, asset sync and the product adapter seam. See `docs/collab-area.md`. |
|
|
58
58
|
| `docx` | WordprocessingML: model, parser, preserving serializer, editing, validation. Also `/docx/embedded`. `/docx/layout` is the DOM-free pagination engine (an approximation of Word, not parity) and `/docx/load` detects and loads DOCX (also password-protected, `{ password }`) and legacy .doc (ole2 inlined). |
|
|
59
|
-
| `pptx` | PresentationML: model, parser, serializer, editing, charts, SmartArt, converters, CLI, signatures. Subpaths `/pptx/converter`, `/pptx/cli`, `/pptx/signature-node`.
|
|
59
|
+
| `pptx` | PresentationML: model, parser, serializer, editing, charts, SmartArt, converters, CLI, signatures. Subpaths `/pptx/converter`, `/pptx/cli`, `/pptx/signature-node`, `/pptx/node`. |
|
|
60
60
|
| `xlsx` | SpreadsheetML: workbook model, `.xlsx`/`.xlsm` reader and preserving writer, formula engine (dependency graph, dynamic arrays, 490+ functions), Excel number formats, editing commands with undo, and the DOM-free grid layout (sizes, colours, conditional formats, charts as SVG, drawing anchors). SmartArt is shown from the cached drawing (not re-laid out) and kept verbatim on save. `/xlsx/load` detects and loads `.xlsx`, `.xlsm` (also password-protected: `loadWorkbook(bytes, { password })`, `saveWorkbook(workbook, 'xlsx', { password })`), legacy `.xls` (ole2 inlined) and CSV, and refuses `.xlsb` with a typed error. `/xlsx/collab` shares a workbook over Yjs (cells, formats, rows, columns, merges, sheets and defined names; see `docs/collab-area.md`). Digital signatures are detected and reported, never kept on save. An approximation of Excel, not parity. |
|
|
61
61
|
| `visio` | Visio: `.vsdx` parsing, loading and bounded editing, page layers and visibility, and a conservative preview of legacy `.vsd` (through ole2). See `docs/visio-legacy-vsd.md`. |
|
|
62
62
|
| `math` | Office Math: OMML to and from LaTeX and MathML, with colour and size helpers. |
|
|
@@ -93,7 +93,7 @@ count and the first cell.
|
|
|
93
93
|
npm install ooxml-core
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
Optional peer dependencies enable specific features: `node-forge` and `xml-crypto` for digital signatures (`/pptx/signature-node`), and `@napi-rs/canvas` for server-side rasterisation.
|
|
96
|
+
Optional peer dependencies enable specific features: `node-forge` and `xml-crypto` for digital signatures (`/pptx/signature-node`), and `@napi-rs/canvas` for server-side rasterisation. The `.ppt` writer's Node rasteriser for SVG pictures lives in the Node-only `/pptx/node` entry, so `ooxml-core/pptx` never references `@napi-rs/canvas` and browser builds of it never see that package. A `.ppt` save rasterises an SVG picture that has no raster fallback with the DOM. In Node.js, where there is no DOM, pass a rasteriser (`save(slides, { outputFormat: 'ppt', rasterizeSvg: rasterizeSvgInNode })`, with `rasterizeSvgInNode` from `ooxml-core/pptx/node`); without one the picture is written as a placeholder with a `ppt-image-format-unsupported` warning. Earlier releases loaded `@napi-rs/canvas` from `ooxml-core/pptx` itself for this.
|
|
97
97
|
|
|
98
98
|
## Quick start
|
|
99
99
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { PptxHandler } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { PptxHandler } from './chunk-ON7XVRHQ.mjs';
|
|
2
|
+
import './chunk-7N7C5BNM.mjs';
|
|
3
3
|
import './chunk-GBKBR4CX.mjs';
|
|
4
4
|
import './chunk-3GXV5MPC.mjs';
|
|
5
5
|
import './chunk-54S5A5PZ.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXK55DEUD_cjs = require('./chunk-XK55DEUD.cjs');
|
|
4
4
|
require('./chunk-4LZIUJI3.cjs');
|
|
5
5
|
require('./chunk-XZPZHXV4.cjs');
|
|
6
6
|
require('./chunk-5W2QL4SB.cjs');
|
|
@@ -9,5 +9,5 @@ require('./chunk-5W2QL4SB.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "PptxHandler", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkXK55DEUD_cjs.PptxHandler; }
|
|
13
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-
|
|
1
|
+
export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-GVP262WE.mjs';
|
|
2
2
|
import './chunk-6IIMI5RS.mjs';
|
|
3
3
|
import './chunk-GXHKNSZX.mjs';
|
|
4
4
|
import './chunk-CA7KCNL3.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-ON7XVRHQ.mjs';
|
|
2
|
+
import './chunk-7N7C5BNM.mjs';
|
|
3
3
|
import './chunk-GBKBR4CX.mjs';
|
|
4
4
|
import './chunk-3GXV5MPC.mjs';
|
|
5
5
|
import './chunk-54S5A5PZ.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXK55DEUD_cjs = require('./chunk-XK55DEUD.cjs');
|
|
4
4
|
require('./chunk-4LZIUJI3.cjs');
|
|
5
5
|
require('./chunk-XZPZHXV4.cjs');
|
|
6
6
|
require('./chunk-5W2QL4SB.cjs');
|
|
@@ -9,13 +9,13 @@ require('./chunk-5W2QL4SB.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "PresentationBuilder", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkXK55DEUD_cjs.PresentationBuilder; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "STANDARD_LAYOUTS", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkXK55DEUD_cjs.STANDARD_LAYOUTS; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "buildBlankPresentationArchive", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkXK55DEUD_cjs.buildBlankPresentationArchive; }
|
|
21
21
|
});
|
|
@@ -21818,7 +21818,7 @@ function findTextBearingElementById(elements3, elementId) {
|
|
|
21818
21818
|
}
|
|
21819
21819
|
async function loadNestedDeck(pptxBytes) {
|
|
21820
21820
|
try {
|
|
21821
|
-
const { PptxHandler } = await import('./PptxHandler-
|
|
21821
|
+
const { PptxHandler } = await import('./PptxHandler-5TWAQWPK.mjs');
|
|
21822
21822
|
const handler = new PptxHandler();
|
|
21823
21823
|
const data = await handler.load(pptxBytes.buffer.slice(0));
|
|
21824
21824
|
return { handler, slides: data.slides };
|
|
@@ -48142,52 +48142,6 @@ async function buildDeckMasterRoundTripsFromPptx(pptxBytes) {
|
|
|
48142
48142
|
};
|
|
48143
48143
|
}
|
|
48144
48144
|
|
|
48145
|
-
// pptx/core/ppt/writer/svg-rasterize-node.ts
|
|
48146
|
-
var NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
|
|
48147
|
-
var nodeCanvas;
|
|
48148
|
-
function isNodeCanvasModule(value) {
|
|
48149
|
-
const candidate = value;
|
|
48150
|
-
return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
|
|
48151
|
-
}
|
|
48152
|
-
function loadNodeCanvas() {
|
|
48153
|
-
nodeCanvas ??= (async () => {
|
|
48154
|
-
const runtime = globalThis.process;
|
|
48155
|
-
if (!runtime?.versions?.node) {
|
|
48156
|
-
return void 0;
|
|
48157
|
-
}
|
|
48158
|
-
try {
|
|
48159
|
-
const imported = await import(
|
|
48160
|
-
/* webpackIgnore: true */
|
|
48161
|
-
/* @vite-ignore */
|
|
48162
|
-
NODE_CANVAS_SPECIFIER
|
|
48163
|
-
);
|
|
48164
|
-
const withDefault = imported;
|
|
48165
|
-
if (isNodeCanvasModule(imported)) {
|
|
48166
|
-
return imported;
|
|
48167
|
-
}
|
|
48168
|
-
return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
|
|
48169
|
-
} catch {
|
|
48170
|
-
return void 0;
|
|
48171
|
-
}
|
|
48172
|
-
})();
|
|
48173
|
-
return nodeCanvas;
|
|
48174
|
-
}
|
|
48175
|
-
async function rasterizeSvgInNode(svg, sizeFor) {
|
|
48176
|
-
const canvasModule = await loadNodeCanvas();
|
|
48177
|
-
if (!canvasModule) {
|
|
48178
|
-
return void 0;
|
|
48179
|
-
}
|
|
48180
|
-
try {
|
|
48181
|
-
const image = await canvasModule.loadImage(svg);
|
|
48182
|
-
const { width, height } = sizeFor(image.width, image.height);
|
|
48183
|
-
const canvas = canvasModule.createCanvas(width, height);
|
|
48184
|
-
canvas.getContext("2d").drawImage(image, 0, 0, width, height);
|
|
48185
|
-
return new Uint8Array(canvas.toBuffer("image/png"));
|
|
48186
|
-
} catch {
|
|
48187
|
-
return void 0;
|
|
48188
|
-
}
|
|
48189
|
-
}
|
|
48190
|
-
|
|
48191
48145
|
// pptx/core/ppt/writer/svg-rasterize.ts
|
|
48192
48146
|
var MAX_EDGE_PX = 2048;
|
|
48193
48147
|
function hasDomRasteriser() {
|
|
@@ -48236,11 +48190,18 @@ async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
|
|
|
48236
48190
|
URL.revokeObjectURL(url);
|
|
48237
48191
|
}
|
|
48238
48192
|
}
|
|
48239
|
-
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
|
|
48240
|
-
|
|
48241
|
-
|
|
48242
|
-
(w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx)
|
|
48243
|
-
|
|
48193
|
+
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx, rasterize) {
|
|
48194
|
+
let png;
|
|
48195
|
+
if (rasterize) {
|
|
48196
|
+
const sizeFor = (w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx);
|
|
48197
|
+
try {
|
|
48198
|
+
png = await rasterize(svg, sizeFor);
|
|
48199
|
+
} catch {
|
|
48200
|
+
png = void 0;
|
|
48201
|
+
}
|
|
48202
|
+
} else if (hasDomRasteriser()) {
|
|
48203
|
+
png = await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx);
|
|
48204
|
+
}
|
|
48244
48205
|
return png ? { extension: "png", bytes: png } : void 0;
|
|
48245
48206
|
}
|
|
48246
48207
|
|
|
@@ -48282,25 +48243,25 @@ function pathFormat(path2) {
|
|
|
48282
48243
|
const ext = /\.([^./\\]+)$/u.exec(path2)?.[1]?.toLowerCase();
|
|
48283
48244
|
return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
|
|
48284
48245
|
}
|
|
48285
|
-
async function toPicture(bytes, el) {
|
|
48246
|
+
async function toPicture(bytes, el, options) {
|
|
48286
48247
|
const format = sniffImageFormat(bytes);
|
|
48287
48248
|
if (format === "tiff") {
|
|
48288
48249
|
return tiffToPicture(bytes);
|
|
48289
48250
|
}
|
|
48290
48251
|
if (format === "svg") {
|
|
48291
|
-
return rasterizeSvg(bytes, el.width || 1, el.height || 1);
|
|
48252
|
+
return rasterizeSvg(bytes, el.width || 1, el.height || 1, options.rasterizeSvg);
|
|
48292
48253
|
}
|
|
48293
48254
|
return bytesToPicture(bytes);
|
|
48294
48255
|
}
|
|
48295
|
-
async function resolveOne(el, source, readPart) {
|
|
48256
|
+
async function resolveOne(el, source, readPart, options) {
|
|
48296
48257
|
const inline = decodeBase64DataUrl(source.inline);
|
|
48297
48258
|
const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
|
|
48298
48259
|
const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
|
|
48299
48260
|
if (inline && (!partFormat || partFormat === inlineFormat)) {
|
|
48300
|
-
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
|
|
48261
|
+
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el, options) : void 0;
|
|
48301
48262
|
}
|
|
48302
48263
|
const part = source.partPath ? await readPart(source.partPath) : void 0;
|
|
48303
|
-
const fromPart = part ? await toPicture(part, el) : void 0;
|
|
48264
|
+
const fromPart = part ? await toPicture(part, el, options) : void 0;
|
|
48304
48265
|
if (fromPart) {
|
|
48305
48266
|
return fromPart;
|
|
48306
48267
|
}
|
|
@@ -48308,14 +48269,14 @@ async function resolveOne(el, source, readPart) {
|
|
|
48308
48269
|
return void 0;
|
|
48309
48270
|
}
|
|
48310
48271
|
const fetched = await fetchBlobUrl(source.inline);
|
|
48311
|
-
const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
|
|
48272
|
+
const fromFetch = fetched ? await toPicture(fetched, el, options) : void 0;
|
|
48312
48273
|
if (fromFetch || !source.svgPath) {
|
|
48313
48274
|
return fromFetch;
|
|
48314
48275
|
}
|
|
48315
48276
|
const svg = await readPart(source.svgPath);
|
|
48316
|
-
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
|
|
48277
|
+
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1, options.rasterizeSvg) : void 0;
|
|
48317
48278
|
}
|
|
48318
|
-
async function resolvePictureSources(slides, readPart) {
|
|
48279
|
+
async function resolvePictureSources(slides, readPart, options = {}) {
|
|
48319
48280
|
const pending = [];
|
|
48320
48281
|
const walk = (elements2) => {
|
|
48321
48282
|
for (const el of elements2) {
|
|
@@ -48333,7 +48294,7 @@ async function resolvePictureSources(slides, readPart) {
|
|
|
48333
48294
|
const resolved = /* @__PURE__ */ new Map();
|
|
48334
48295
|
await Promise.all(
|
|
48335
48296
|
pending.map(async ([el, source]) => {
|
|
48336
|
-
const picture = await resolveOne(el, source, readPart);
|
|
48297
|
+
const picture = await resolveOne(el, source, readPart, options);
|
|
48337
48298
|
if (picture) {
|
|
48338
48299
|
resolved.set(el, picture);
|
|
48339
48300
|
}
|
|
@@ -72927,7 +72888,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
72927
72888
|
* Serialise `slides` to a legacy binary PowerPoint 97-2003 (`.ppt`) file.
|
|
72928
72889
|
*
|
|
72929
72890
|
* @param slides - The (possibly mutated) live slide array.
|
|
72930
|
-
* @param options -
|
|
72891
|
+
* @param options - `pptPassword` and `rasterizeSvg` (the `.ppt`-only
|
|
72892
|
+
* options), `customShows` and `slideMasters`; every OOXML-specific
|
|
72931
72893
|
* option (conformance, embedded fonts, table styles, ...) has no binary
|
|
72932
72894
|
* `.ppt` counterpart and is ignored.
|
|
72933
72895
|
* @param saveAsPptx - Serialises the same slides as a Transitional `.pptx`
|
|
@@ -72943,7 +72905,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
72943
72905
|
const resolvedMedia = await this.resolveAudioMediaBytes(slides);
|
|
72944
72906
|
const resolvedPictures = await resolvePictureSources(
|
|
72945
72907
|
slides,
|
|
72946
|
-
async (path2) => this.zip.file(path2)?.async("uint8array")
|
|
72908
|
+
async (path2) => this.zip.file(path2)?.async("uint8array"),
|
|
72909
|
+
{ rasterizeSvg: options?.rasterizeSvg }
|
|
72947
72910
|
);
|
|
72948
72911
|
const deck = convertDeckToWriteModel(
|
|
72949
72912
|
slides,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasTextProperties, isImageLikeElement, blobUrlToDataUrl, getSubstituteFontFamily, stripXmlOrderSuffix } from './chunk-
|
|
1
|
+
import { hasTextProperties, isImageLikeElement, blobUrlToDataUrl, getSubstituteFontFamily, stripXmlOrderSuffix } from './chunk-7N7C5BNM.mjs';
|
|
2
2
|
|
|
3
3
|
// pptx/converter/media-context.ts
|
|
4
4
|
var MIME_TO_EXT = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-
|
|
2
|
-
import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-
|
|
3
|
-
import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-
|
|
1
|
+
import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-CWCDFPKN.mjs';
|
|
2
|
+
import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-ON7XVRHQ.mjs';
|
|
3
|
+
import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-7N7C5BNM.mjs';
|
|
4
4
|
import { openPptxZip } from './chunk-GBKBR4CX.mjs';
|
|
5
5
|
import { cloneSlide, cloneElement } from './chunk-54S5A5PZ.mjs';
|
|
6
6
|
|
|
@@ -14771,7 +14771,7 @@ async function setPresentationRunText(bytes, slideIndex, elementId, runIndex, te
|
|
|
14771
14771
|
async function createPresentationFromOutline(slides, options = {}) {
|
|
14772
14772
|
if (!(slides instanceof Array) || !slides.length || slides.length > 200)
|
|
14773
14773
|
throw new Error("A presentation outline has 1 to 200 slides");
|
|
14774
|
-
const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-
|
|
14774
|
+
const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-SVHIKT4C.mjs');
|
|
14775
14775
|
const { handler, data, createSlide } = await PresentationBuilder2.create({
|
|
14776
14776
|
...options.title ? { title: options.title } : {}
|
|
14777
14777
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, formatAutoNumberMarker, parseParagraphSpacingPx, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseStructuredCustomGeometry, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, evaluateGeometryPaths, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, EMU_PER_PX, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, hasShapeProperties, ensureXmlChild, hasTextProperties, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, buildSaveTimeCustomGeometryXml, applyCustomGeometryGuideOverrides, avLstForPreset, filterValidShapeAdjustmentEntries, applyDrawingMediaReference, XML_PROLOG, DGM_XMLNS, xmlEscape, writeBodyPrBooleanAttrs, applyTextBodySp3d, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, EMU_PER_PIXEL, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, mergeSmartArtPointXml, mergeSmartArtConnectionXml, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, ensureXmlChildren, TC_PR_BORDERS_ORDER, writeChartColorChoice, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, preservesSpreadsheetXmlWhitespace, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, first, children, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, SvgExporter, detectStrictConformance, normalizeStrictXml, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, deriveSlideTitles, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, encodeXmlAttributeValue, encodeXmlTextValue, stripXmlOrderMarkers, MIN_ELEMENT_SIZE, createDrawingObjectId, DEFAULT_TEXT_FONT_SIZE, EncryptedFileError, decodePptxJsonText, deserializePptxFromJson, applyImportedPptxData, DEFAULT_CHART_GRADIENT_ANGLE, supportsChartGradientFill, svgToCustomGeometryPaths, escAttr, MIN_TABLE_DIMENSION, MAX_TABLE_DIMENSION, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, effectChild, mergeEffectNode, mergeAttributeEffectNode, estimateMediaDurationMs, parseVmlElements, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, IncorrectPasswordError, applyThemeToData, detectFileFormat, parseOle2, decryptPptx, encryptPptx, escText, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, PML_XMLNS, solidFill, esc, OOXML_PERCENT_UNITS, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, emu, gradFill, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, extractGuidFromPartName, deobfuscateFont, detectFontFormat, parseKinsoku, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, relAttr, buildXml, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtPresLayoutVars, readChartManualLayoutValues, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS } from './chunk-
|
|
1
|
+
import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, formatAutoNumberMarker, parseParagraphSpacingPx, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseStructuredCustomGeometry, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, evaluateGeometryPaths, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, EMU_PER_PX, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, hasShapeProperties, ensureXmlChild, hasTextProperties, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, buildSaveTimeCustomGeometryXml, applyCustomGeometryGuideOverrides, avLstForPreset, filterValidShapeAdjustmentEntries, applyDrawingMediaReference, XML_PROLOG, DGM_XMLNS, xmlEscape, writeBodyPrBooleanAttrs, applyTextBodySp3d, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, EMU_PER_PIXEL, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, mergeSmartArtPointXml, mergeSmartArtConnectionXml, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, ensureXmlChildren, TC_PR_BORDERS_ORDER, writeChartColorChoice, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, preservesSpreadsheetXmlWhitespace, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, first, children, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, SvgExporter, detectStrictConformance, normalizeStrictXml, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, deriveSlideTitles, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, encodeXmlAttributeValue, encodeXmlTextValue, stripXmlOrderMarkers, MIN_ELEMENT_SIZE, createDrawingObjectId, DEFAULT_TEXT_FONT_SIZE, EncryptedFileError, decodePptxJsonText, deserializePptxFromJson, applyImportedPptxData, DEFAULT_CHART_GRADIENT_ANGLE, supportsChartGradientFill, svgToCustomGeometryPaths, escAttr, MIN_TABLE_DIMENSION, MAX_TABLE_DIMENSION, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, effectChild, mergeEffectNode, mergeAttributeEffectNode, estimateMediaDurationMs, parseVmlElements, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, IncorrectPasswordError, applyThemeToData, detectFileFormat, parseOle2, decryptPptx, encryptPptx, escText, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, PML_XMLNS, solidFill, esc, OOXML_PERCENT_UNITS, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, emu, gradFill, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, extractGuidFromPartName, deobfuscateFont, detectFontFormat, parseKinsoku, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, relAttr, buildXml, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtPresLayoutVars, readChartManualLayoutValues, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS } from './chunk-7N7C5BNM.mjs';
|
|
2
2
|
import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openNestedZip, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError, MAX_ZIP_ENTRY_COUNT } from './chunk-GBKBR4CX.mjs';
|
|
3
3
|
import { resolveSmartArtLayoutCategory } from './chunk-3GXV5MPC.mjs';
|
|
4
4
|
import { cloneXmlObject, applySmartArtLayoutDefinition, cloneSlide, parseSmartArtLayoutDefinition } from './chunk-54S5A5PZ.mjs';
|
|
@@ -47472,52 +47472,6 @@ async function buildDeckMasterRoundTripsFromPptx(pptxBytes) {
|
|
|
47472
47472
|
};
|
|
47473
47473
|
}
|
|
47474
47474
|
|
|
47475
|
-
// pptx/core/ppt/writer/svg-rasterize-node.ts
|
|
47476
|
-
var NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
|
|
47477
|
-
var nodeCanvas;
|
|
47478
|
-
function isNodeCanvasModule(value) {
|
|
47479
|
-
const candidate = value;
|
|
47480
|
-
return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
|
|
47481
|
-
}
|
|
47482
|
-
function loadNodeCanvas() {
|
|
47483
|
-
nodeCanvas ??= (async () => {
|
|
47484
|
-
const runtime = globalThis.process;
|
|
47485
|
-
if (!runtime?.versions?.node) {
|
|
47486
|
-
return void 0;
|
|
47487
|
-
}
|
|
47488
|
-
try {
|
|
47489
|
-
const imported = await import(
|
|
47490
|
-
/* webpackIgnore: true */
|
|
47491
|
-
/* @vite-ignore */
|
|
47492
|
-
NODE_CANVAS_SPECIFIER
|
|
47493
|
-
);
|
|
47494
|
-
const withDefault = imported;
|
|
47495
|
-
if (isNodeCanvasModule(imported)) {
|
|
47496
|
-
return imported;
|
|
47497
|
-
}
|
|
47498
|
-
return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
|
|
47499
|
-
} catch {
|
|
47500
|
-
return void 0;
|
|
47501
|
-
}
|
|
47502
|
-
})();
|
|
47503
|
-
return nodeCanvas;
|
|
47504
|
-
}
|
|
47505
|
-
async function rasterizeSvgInNode(svg, sizeFor) {
|
|
47506
|
-
const canvasModule = await loadNodeCanvas();
|
|
47507
|
-
if (!canvasModule) {
|
|
47508
|
-
return void 0;
|
|
47509
|
-
}
|
|
47510
|
-
try {
|
|
47511
|
-
const image = await canvasModule.loadImage(svg);
|
|
47512
|
-
const { width, height } = sizeFor(image.width, image.height);
|
|
47513
|
-
const canvas = canvasModule.createCanvas(width, height);
|
|
47514
|
-
canvas.getContext("2d").drawImage(image, 0, 0, width, height);
|
|
47515
|
-
return new Uint8Array(canvas.toBuffer("image/png"));
|
|
47516
|
-
} catch {
|
|
47517
|
-
return void 0;
|
|
47518
|
-
}
|
|
47519
|
-
}
|
|
47520
|
-
|
|
47521
47475
|
// pptx/core/ppt/writer/svg-rasterize.ts
|
|
47522
47476
|
var MAX_EDGE_PX = 2048;
|
|
47523
47477
|
function hasDomRasteriser() {
|
|
@@ -47566,11 +47520,18 @@ async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
|
|
|
47566
47520
|
URL.revokeObjectURL(url);
|
|
47567
47521
|
}
|
|
47568
47522
|
}
|
|
47569
|
-
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
|
|
47570
|
-
|
|
47571
|
-
|
|
47572
|
-
(w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx)
|
|
47573
|
-
|
|
47523
|
+
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx, rasterize) {
|
|
47524
|
+
let png;
|
|
47525
|
+
if (rasterize) {
|
|
47526
|
+
const sizeFor = (w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx);
|
|
47527
|
+
try {
|
|
47528
|
+
png = await rasterize(svg, sizeFor);
|
|
47529
|
+
} catch {
|
|
47530
|
+
png = void 0;
|
|
47531
|
+
}
|
|
47532
|
+
} else if (hasDomRasteriser()) {
|
|
47533
|
+
png = await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx);
|
|
47534
|
+
}
|
|
47574
47535
|
return png ? { extension: "png", bytes: png } : void 0;
|
|
47575
47536
|
}
|
|
47576
47537
|
|
|
@@ -47612,25 +47573,25 @@ function pathFormat(path2) {
|
|
|
47612
47573
|
const ext = /\.([^./\\]+)$/u.exec(path2)?.[1]?.toLowerCase();
|
|
47613
47574
|
return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
|
|
47614
47575
|
}
|
|
47615
|
-
async function toPicture(bytes, el) {
|
|
47576
|
+
async function toPicture(bytes, el, options) {
|
|
47616
47577
|
const format = sniffImageFormat(bytes);
|
|
47617
47578
|
if (format === "tiff") {
|
|
47618
47579
|
return tiffToPicture(bytes);
|
|
47619
47580
|
}
|
|
47620
47581
|
if (format === "svg") {
|
|
47621
|
-
return rasterizeSvg(bytes, el.width || 1, el.height || 1);
|
|
47582
|
+
return rasterizeSvg(bytes, el.width || 1, el.height || 1, options.rasterizeSvg);
|
|
47622
47583
|
}
|
|
47623
47584
|
return bytesToPicture(bytes);
|
|
47624
47585
|
}
|
|
47625
|
-
async function resolveOne(el, source, readPart) {
|
|
47586
|
+
async function resolveOne(el, source, readPart, options) {
|
|
47626
47587
|
const inline = decodeBase64DataUrl(source.inline);
|
|
47627
47588
|
const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
|
|
47628
47589
|
const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
|
|
47629
47590
|
if (inline && (!partFormat || partFormat === inlineFormat)) {
|
|
47630
|
-
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
|
|
47591
|
+
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el, options) : void 0;
|
|
47631
47592
|
}
|
|
47632
47593
|
const part = source.partPath ? await readPart(source.partPath) : void 0;
|
|
47633
|
-
const fromPart = part ? await toPicture(part, el) : void 0;
|
|
47594
|
+
const fromPart = part ? await toPicture(part, el, options) : void 0;
|
|
47634
47595
|
if (fromPart) {
|
|
47635
47596
|
return fromPart;
|
|
47636
47597
|
}
|
|
@@ -47638,14 +47599,14 @@ async function resolveOne(el, source, readPart) {
|
|
|
47638
47599
|
return void 0;
|
|
47639
47600
|
}
|
|
47640
47601
|
const fetched = await fetchBlobUrl(source.inline);
|
|
47641
|
-
const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
|
|
47602
|
+
const fromFetch = fetched ? await toPicture(fetched, el, options) : void 0;
|
|
47642
47603
|
if (fromFetch || !source.svgPath) {
|
|
47643
47604
|
return fromFetch;
|
|
47644
47605
|
}
|
|
47645
47606
|
const svg = await readPart(source.svgPath);
|
|
47646
|
-
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
|
|
47607
|
+
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1, options.rasterizeSvg) : void 0;
|
|
47647
47608
|
}
|
|
47648
|
-
async function resolvePictureSources(slides, readPart) {
|
|
47609
|
+
async function resolvePictureSources(slides, readPart, options = {}) {
|
|
47649
47610
|
const pending = [];
|
|
47650
47611
|
const walk = (elements2) => {
|
|
47651
47612
|
for (const el of elements2) {
|
|
@@ -47663,7 +47624,7 @@ async function resolvePictureSources(slides, readPart) {
|
|
|
47663
47624
|
const resolved = /* @__PURE__ */ new Map();
|
|
47664
47625
|
await Promise.all(
|
|
47665
47626
|
pending.map(async ([el, source]) => {
|
|
47666
|
-
const picture = await resolveOne(el, source, readPart);
|
|
47627
|
+
const picture = await resolveOne(el, source, readPart, options);
|
|
47667
47628
|
if (picture) {
|
|
47668
47629
|
resolved.set(el, picture);
|
|
47669
47630
|
}
|
|
@@ -71869,7 +71830,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
71869
71830
|
* Serialise `slides` to a legacy binary PowerPoint 97-2003 (`.ppt`) file.
|
|
71870
71831
|
*
|
|
71871
71832
|
* @param slides - The (possibly mutated) live slide array.
|
|
71872
|
-
* @param options -
|
|
71833
|
+
* @param options - `pptPassword` and `rasterizeSvg` (the `.ppt`-only
|
|
71834
|
+
* options), `customShows` and `slideMasters`; every OOXML-specific
|
|
71873
71835
|
* option (conformance, embedded fonts, table styles, ...) has no binary
|
|
71874
71836
|
* `.ppt` counterpart and is ignored.
|
|
71875
71837
|
* @param saveAsPptx - Serialises the same slides as a Transitional `.pptx`
|
|
@@ -71885,7 +71847,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
71885
71847
|
const resolvedMedia = await this.resolveAudioMediaBytes(slides);
|
|
71886
71848
|
const resolvedPictures = await resolvePictureSources(
|
|
71887
71849
|
slides,
|
|
71888
|
-
async (path2) => this.zip.file(path2)?.async("uint8array")
|
|
71850
|
+
async (path2) => this.zip.file(path2)?.async("uint8array"),
|
|
71851
|
+
{ rasterizeSvg: options?.rasterizeSvg }
|
|
71889
71852
|
);
|
|
71890
71853
|
const deck = convertDeckToWriteModel(
|
|
71891
71854
|
slides,
|
|
@@ -48148,52 +48148,6 @@ async function buildDeckMasterRoundTripsFromPptx(pptxBytes) {
|
|
|
48148
48148
|
};
|
|
48149
48149
|
}
|
|
48150
48150
|
|
|
48151
|
-
// pptx/core/ppt/writer/svg-rasterize-node.ts
|
|
48152
|
-
var NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
|
|
48153
|
-
var nodeCanvas;
|
|
48154
|
-
function isNodeCanvasModule(value) {
|
|
48155
|
-
const candidate = value;
|
|
48156
|
-
return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
|
|
48157
|
-
}
|
|
48158
|
-
function loadNodeCanvas() {
|
|
48159
|
-
nodeCanvas ??= (async () => {
|
|
48160
|
-
const runtime = globalThis.process;
|
|
48161
|
-
if (!runtime?.versions?.node) {
|
|
48162
|
-
return void 0;
|
|
48163
|
-
}
|
|
48164
|
-
try {
|
|
48165
|
-
const imported = await import(
|
|
48166
|
-
/* webpackIgnore: true */
|
|
48167
|
-
/* @vite-ignore */
|
|
48168
|
-
NODE_CANVAS_SPECIFIER
|
|
48169
|
-
);
|
|
48170
|
-
const withDefault = imported;
|
|
48171
|
-
if (isNodeCanvasModule(imported)) {
|
|
48172
|
-
return imported;
|
|
48173
|
-
}
|
|
48174
|
-
return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
|
|
48175
|
-
} catch {
|
|
48176
|
-
return void 0;
|
|
48177
|
-
}
|
|
48178
|
-
})();
|
|
48179
|
-
return nodeCanvas;
|
|
48180
|
-
}
|
|
48181
|
-
async function rasterizeSvgInNode(svg, sizeFor) {
|
|
48182
|
-
const canvasModule = await loadNodeCanvas();
|
|
48183
|
-
if (!canvasModule) {
|
|
48184
|
-
return void 0;
|
|
48185
|
-
}
|
|
48186
|
-
try {
|
|
48187
|
-
const image = await canvasModule.loadImage(svg);
|
|
48188
|
-
const { width, height } = sizeFor(image.width, image.height);
|
|
48189
|
-
const canvas = canvasModule.createCanvas(width, height);
|
|
48190
|
-
canvas.getContext("2d").drawImage(image, 0, 0, width, height);
|
|
48191
|
-
return new Uint8Array(canvas.toBuffer("image/png"));
|
|
48192
|
-
} catch {
|
|
48193
|
-
return void 0;
|
|
48194
|
-
}
|
|
48195
|
-
}
|
|
48196
|
-
|
|
48197
48151
|
// pptx/core/ppt/writer/svg-rasterize.ts
|
|
48198
48152
|
var MAX_EDGE_PX = 2048;
|
|
48199
48153
|
function hasDomRasteriser() {
|
|
@@ -48242,11 +48196,18 @@ async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
|
|
|
48242
48196
|
URL.revokeObjectURL(url);
|
|
48243
48197
|
}
|
|
48244
48198
|
}
|
|
48245
|
-
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
|
|
48246
|
-
|
|
48247
|
-
|
|
48248
|
-
(w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx)
|
|
48249
|
-
|
|
48199
|
+
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx, rasterize) {
|
|
48200
|
+
let png;
|
|
48201
|
+
if (rasterize) {
|
|
48202
|
+
const sizeFor = (w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx);
|
|
48203
|
+
try {
|
|
48204
|
+
png = await rasterize(svg, sizeFor);
|
|
48205
|
+
} catch {
|
|
48206
|
+
png = void 0;
|
|
48207
|
+
}
|
|
48208
|
+
} else if (hasDomRasteriser()) {
|
|
48209
|
+
png = await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx);
|
|
48210
|
+
}
|
|
48250
48211
|
return png ? { extension: "png", bytes: png } : void 0;
|
|
48251
48212
|
}
|
|
48252
48213
|
|
|
@@ -48288,25 +48249,25 @@ function pathFormat(path2) {
|
|
|
48288
48249
|
const ext = /\.([^./\\]+)$/u.exec(path2)?.[1]?.toLowerCase();
|
|
48289
48250
|
return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
|
|
48290
48251
|
}
|
|
48291
|
-
async function toPicture(bytes, el) {
|
|
48252
|
+
async function toPicture(bytes, el, options) {
|
|
48292
48253
|
const format = sniffImageFormat(bytes);
|
|
48293
48254
|
if (format === "tiff") {
|
|
48294
48255
|
return tiffToPicture(bytes);
|
|
48295
48256
|
}
|
|
48296
48257
|
if (format === "svg") {
|
|
48297
|
-
return rasterizeSvg(bytes, el.width || 1, el.height || 1);
|
|
48258
|
+
return rasterizeSvg(bytes, el.width || 1, el.height || 1, options.rasterizeSvg);
|
|
48298
48259
|
}
|
|
48299
48260
|
return bytesToPicture(bytes);
|
|
48300
48261
|
}
|
|
48301
|
-
async function resolveOne(el, source, readPart) {
|
|
48262
|
+
async function resolveOne(el, source, readPart, options) {
|
|
48302
48263
|
const inline = decodeBase64DataUrl(source.inline);
|
|
48303
48264
|
const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
|
|
48304
48265
|
const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
|
|
48305
48266
|
if (inline && (!partFormat || partFormat === inlineFormat)) {
|
|
48306
|
-
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
|
|
48267
|
+
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el, options) : void 0;
|
|
48307
48268
|
}
|
|
48308
48269
|
const part = source.partPath ? await readPart(source.partPath) : void 0;
|
|
48309
|
-
const fromPart = part ? await toPicture(part, el) : void 0;
|
|
48270
|
+
const fromPart = part ? await toPicture(part, el, options) : void 0;
|
|
48310
48271
|
if (fromPart) {
|
|
48311
48272
|
return fromPart;
|
|
48312
48273
|
}
|
|
@@ -48314,14 +48275,14 @@ async function resolveOne(el, source, readPart) {
|
|
|
48314
48275
|
return void 0;
|
|
48315
48276
|
}
|
|
48316
48277
|
const fetched = await fetchBlobUrl(source.inline);
|
|
48317
|
-
const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
|
|
48278
|
+
const fromFetch = fetched ? await toPicture(fetched, el, options) : void 0;
|
|
48318
48279
|
if (fromFetch || !source.svgPath) {
|
|
48319
48280
|
return fromFetch;
|
|
48320
48281
|
}
|
|
48321
48282
|
const svg = await readPart(source.svgPath);
|
|
48322
|
-
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
|
|
48283
|
+
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1, options.rasterizeSvg) : void 0;
|
|
48323
48284
|
}
|
|
48324
|
-
async function resolvePictureSources(slides, readPart) {
|
|
48285
|
+
async function resolvePictureSources(slides, readPart, options = {}) {
|
|
48325
48286
|
const pending = [];
|
|
48326
48287
|
const walk = (elements2) => {
|
|
48327
48288
|
for (const el of elements2) {
|
|
@@ -48339,7 +48300,7 @@ async function resolvePictureSources(slides, readPart) {
|
|
|
48339
48300
|
const resolved = /* @__PURE__ */ new Map();
|
|
48340
48301
|
await Promise.all(
|
|
48341
48302
|
pending.map(async ([el, source]) => {
|
|
48342
|
-
const picture = await resolveOne(el, source, readPart);
|
|
48303
|
+
const picture = await resolveOne(el, source, readPart, options);
|
|
48343
48304
|
if (picture) {
|
|
48344
48305
|
resolved.set(el, picture);
|
|
48345
48306
|
}
|
|
@@ -72933,7 +72894,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
72933
72894
|
* Serialise `slides` to a legacy binary PowerPoint 97-2003 (`.ppt`) file.
|
|
72934
72895
|
*
|
|
72935
72896
|
* @param slides - The (possibly mutated) live slide array.
|
|
72936
|
-
* @param options -
|
|
72897
|
+
* @param options - `pptPassword` and `rasterizeSvg` (the `.ppt`-only
|
|
72898
|
+
* options), `customShows` and `slideMasters`; every OOXML-specific
|
|
72937
72899
|
* option (conformance, embedded fonts, table styles, ...) has no binary
|
|
72938
72900
|
* `.ppt` counterpart and is ignored.
|
|
72939
72901
|
* @param saveAsPptx - Serialises the same slides as a Transitional `.pptx`
|
|
@@ -72949,7 +72911,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
72949
72911
|
const resolvedMedia = await this.resolveAudioMediaBytes(slides);
|
|
72950
72912
|
const resolvedPictures = await resolvePictureSources(
|
|
72951
72913
|
slides,
|
|
72952
|
-
async (path2) => this.zip.file(path2)?.async("uint8array")
|
|
72914
|
+
async (path2) => this.zip.file(path2)?.async("uint8array"),
|
|
72915
|
+
{ rasterizeSvg: options?.rasterizeSvg }
|
|
72953
72916
|
);
|
|
72954
72917
|
const deck = convertDeckToWriteModel(
|
|
72955
72918
|
slides,
|