pptx-glimpse 3.0.0 → 3.1.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/dist/browser.cjs +3058 -737
- package/dist/browser.d.cts +77 -8
- package/dist/browser.d.ts +77 -8
- package/dist/browser.js +486 -23
- package/dist/{chunk-KMSN55AE.js → chunk-NMAO44T7.js} +2242 -522
- package/dist/{chunk-2AYNMYMC.js → chunk-PGCREQQU.js} +134 -113
- package/dist/{chunk-MWMHSSAD.js → chunk-WAMKNW47.js} +4 -3
- package/dist/chunk-XGCLQP2P.js +83 -0
- package/dist/chunk-ZZKN4U5J.js +141 -0
- package/dist/cli.cjs +11214 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +195 -0
- package/dist/font-collector-BYuaCG-o.d.cts +547 -0
- package/dist/font-collector-BYuaCG-o.d.ts +547 -0
- package/dist/index.cjs +752 -562
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -76
- package/dist/{node-6KTAWUIB.js → node-E6UXPQSQ.js} +2 -2
- package/dist/{node-font-loader-274G445U.js → node-font-loader-OE3OLNDI.js} +2 -2
- package/package.json +9 -6
- package/dist/font-collector-DYooJP6L.d.cts +0 -1345
- package/dist/font-collector-DYooJP6L.d.ts +0 -1345
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { C as ConversionDiagnostic, a as ConvertOptions, D as DEFAULT_FONT_MAPPING, F as FontBuffer, b as FontMapping, L as LogLevel, O as OpentypeSetup, P as PngConversionReport, S as SlideImage,
|
|
1
|
+
export { C as ConversionDiagnostic, a as ConvertOptions, D as DEFAULT_FONT_MAPPING, F as FontBuffer, b as FontMapping, L as LogLevel, O as OpentypeSetup, P as PngConversionReport, S as SlideImage, c as SlideSupportCoverage, d as SlideSvg, e as SupportCoverage, f as SupportCoverageCounts, g as SvgConversionReport, U as UsedFonts, W as WarningEntry, h as WarningSummary, i as clearFontCache, j as collectUsedFonts, k as convertPptxToPng, l as convertPptxToSvg, n as createFontMapping, o as createOpentypeSetupFromBuffers, p as createOpentypeTextMeasurerFromBuffers, q as getMappedFont, r as getWarningEntries, s as getWarningSummary, t as renderPptxSourceModelToSvg } from './font-collector-BYuaCG-o.cjs';
|
|
2
|
+
export { PptxSourceModel } from '@pptx-glimpse/document';
|
|
2
3
|
|
|
3
4
|
type ResvgWasmInput = ArrayBuffer | Uint8Array | Response;
|
|
4
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { C as ConversionDiagnostic, a as ConvertOptions, D as DEFAULT_FONT_MAPPING, F as FontBuffer, b as FontMapping, L as LogLevel, O as OpentypeSetup, P as PngConversionReport, S as SlideImage,
|
|
1
|
+
export { C as ConversionDiagnostic, a as ConvertOptions, D as DEFAULT_FONT_MAPPING, F as FontBuffer, b as FontMapping, L as LogLevel, O as OpentypeSetup, P as PngConversionReport, S as SlideImage, c as SlideSupportCoverage, d as SlideSvg, e as SupportCoverage, f as SupportCoverageCounts, g as SvgConversionReport, U as UsedFonts, W as WarningEntry, h as WarningSummary, i as clearFontCache, j as collectUsedFonts, k as convertPptxToPng, l as convertPptxToSvg, n as createFontMapping, o as createOpentypeSetupFromBuffers, p as createOpentypeTextMeasurerFromBuffers, q as getMappedFont, r as getWarningEntries, s as getWarningSummary, t as renderPptxSourceModelToSvg } from './font-collector-BYuaCG-o.js';
|
|
2
|
+
export { PptxSourceModel } from '@pptx-glimpse/document';
|
|
2
3
|
|
|
3
4
|
type ResvgWasmInput = ArrayBuffer | Uint8Array | Response;
|
|
4
5
|
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
collectUsedFonts
|
|
3
|
+
} from "./chunk-ZZKN4U5J.js";
|
|
4
|
+
import {
|
|
5
|
+
convertPptxToPng,
|
|
6
|
+
convertPptxToSvg,
|
|
7
|
+
renderPptxSourceModelToSvg
|
|
8
|
+
} from "./chunk-XGCLQP2P.js";
|
|
9
|
+
import "./chunk-NMAO44T7.js";
|
|
6
10
|
import {
|
|
7
11
|
DEFAULT_FONT_MAPPING,
|
|
8
12
|
clearFontCache,
|
|
@@ -12,76 +16,7 @@ import {
|
|
|
12
16
|
getMappedFont,
|
|
13
17
|
getWarningEntries,
|
|
14
18
|
getWarningSummary
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
|
|
17
|
-
// src/converter.ts
|
|
18
|
-
async function convertPptxToSvg2(input, options) {
|
|
19
|
-
return convertPptxToSvg(input, options, loadSystemFontSetup);
|
|
20
|
-
}
|
|
21
|
-
async function convertPptxToPng(input, options) {
|
|
22
|
-
const svgResult = await convertPptxToSvg2(input, {
|
|
23
|
-
...options,
|
|
24
|
-
textOutput: "path"
|
|
25
|
-
});
|
|
26
|
-
const width = options?.width ?? DEFAULT_OUTPUT_WIDTH;
|
|
27
|
-
const height = options?.height;
|
|
28
|
-
const fontBuffers = await loadPngFontBuffers(options);
|
|
29
|
-
const slides = [];
|
|
30
|
-
for (const { slideNumber, svg } of svgResult.slides) {
|
|
31
|
-
const pngResult = await convertSvgToPng(svg, { width, height, fontBuffers });
|
|
32
|
-
slides.push({
|
|
33
|
-
slideNumber,
|
|
34
|
-
png: toPlainUint8Array(pngResult.png),
|
|
35
|
-
width: pngResult.width,
|
|
36
|
-
height: pngResult.height
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
slides,
|
|
41
|
-
diagnostics: svgResult.diagnostics,
|
|
42
|
-
supportCoverage: svgResult.supportCoverage
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
var loadSystemFontSetup = async (options) => {
|
|
46
|
-
if (!shouldLoadSystemFonts(options)) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
const { createOpentypeSetupFromSystem } = await import(
|
|
50
|
-
/* @vite-ignore */
|
|
51
|
-
"./node-6KTAWUIB.js"
|
|
52
|
-
);
|
|
53
|
-
return createOpentypeSetupFromSystem(
|
|
54
|
-
options?.fontDirs,
|
|
55
|
-
options?.fontMapping,
|
|
56
|
-
options?.skipSystemFonts
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
async function loadPngFontBuffers(options) {
|
|
60
|
-
if (options?.fonts !== void 0) {
|
|
61
|
-
return options.fonts.map((font) => toUint8Array(font.data));
|
|
62
|
-
}
|
|
63
|
-
if (!shouldLoadSystemFonts(options)) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
const { loadFontBuffersFromSystem } = await import(
|
|
67
|
-
/* @vite-ignore */
|
|
68
|
-
"./node-font-loader-274G445U.js"
|
|
69
|
-
);
|
|
70
|
-
return loadFontBuffersFromSystem(options?.fontDirs, options?.skipSystemFonts);
|
|
71
|
-
}
|
|
72
|
-
async function convertSvgToPng(svg, options) {
|
|
73
|
-
const { svgToPng } = await import("./png-IONMVVDQ.js");
|
|
74
|
-
return svgToPng(svg, options);
|
|
75
|
-
}
|
|
76
|
-
function shouldLoadSystemFonts(options) {
|
|
77
|
-
return options?.skipSystemFonts !== true || (options?.fontDirs?.length ?? 0) > 0;
|
|
78
|
-
}
|
|
79
|
-
function toUint8Array(data) {
|
|
80
|
-
return data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
81
|
-
}
|
|
82
|
-
function toPlainUint8Array(data) {
|
|
83
|
-
return new Uint8Array(data);
|
|
84
|
-
}
|
|
19
|
+
} from "./chunk-PGCREQQU.js";
|
|
85
20
|
|
|
86
21
|
// src/index.ts
|
|
87
22
|
async function initResvgWasm(wasm) {
|
|
@@ -93,12 +28,13 @@ export {
|
|
|
93
28
|
clearFontCache,
|
|
94
29
|
collectUsedFonts,
|
|
95
30
|
convertPptxToPng,
|
|
96
|
-
|
|
31
|
+
convertPptxToSvg,
|
|
97
32
|
createFontMapping,
|
|
98
33
|
createOpentypeSetupFromBuffers,
|
|
99
34
|
createOpentypeTextMeasurerFromBuffers,
|
|
100
35
|
getMappedFont,
|
|
101
36
|
getWarningEntries,
|
|
102
37
|
getWarningSummary,
|
|
103
|
-
initResvgWasm
|
|
38
|
+
initResvgWasm,
|
|
39
|
+
renderPptxSourceModelToSvg
|
|
104
40
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-glimpse",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "A lightweight JavaScript library for rendering PowerPoint (.pptx) files as SVG or PNG in Node.js. No LibreOffice required.",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "A lightweight JavaScript library for rendering PowerPoint (.pptx) files as SVG or PNG in Node.js and the browser. No LibreOffice required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"browser": "./dist/browser.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"pptx-glimpse": "./dist/cli.js"
|
|
12
|
+
},
|
|
10
13
|
"exports": {
|
|
11
14
|
".": {
|
|
12
15
|
"browser": {
|
|
@@ -46,12 +49,12 @@
|
|
|
46
49
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
47
50
|
"fast-xml-parser": "^5.7.3",
|
|
48
51
|
"fflate": "^0.8.2",
|
|
49
|
-
"opentype.js": "1.3.4"
|
|
52
|
+
"opentype.js": "1.3.4",
|
|
53
|
+
"@pptx-glimpse/document": "^0.2.0"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
52
|
-
"@pptx-glimpse/
|
|
53
|
-
"@pptx-glimpse/editor-core": "0.0.
|
|
54
|
-
"@pptx-glimpse/renderer": "0.0.0"
|
|
56
|
+
"@pptx-glimpse/renderer": "0.0.0",
|
|
57
|
+
"@pptx-glimpse/editor-core": "0.0.2"
|
|
55
58
|
},
|
|
56
59
|
"scripts": {
|
|
57
60
|
"build": "tsup"
|