@openpresentation/opf-pptx 0.20.0 → 0.20.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/README.md +4 -2
- package/dist/index.js +8 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# OPF PPTX
|
|
2
2
|
|
|
3
|
-
Catalogs (OPF 0.
|
|
3
|
+
Catalogs (OPF 0.20): export resolves the document's embedded records and host-registered catalogs (`Catalog[]`, never fetched). Register Gallery 3 explicitly for export: `import { gallery } from "@openpresentation/gallery"; toPptx(deck, { catalogs: [gallery] })`. Bare ids resolve in the document's custom/default records, then the registered default catalog; `catalogs.default:false` closes that fallback. When import `catalogs` is omitted, foreign PowerPoint layout type/name mapping uses the default catalog from installed `@openpresentation/gallery`; theme and colour-scheme recovery still requires explicitly registered catalogs; `fromPptx(bytes, { catalogs: [] })` explicitly opts out. An unresolved reference emits core's `unresolved-reference` diagnostic and uses engine defaults; `strictReferences:true` refuses the export with `OPFPptxError`. Native layout tags preserve valid catalog sources and opt-outs, and damaged identity/source metadata emits diagnostics instead of creating invalid catalog groups.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Generated slide masters carry the display name `pptx.gallery`, including masters copied for per-slide script fonts. Individual slide layouts keep their Gallery or authored custom names. The master label is separate from the theme name: authored theme identities stay exact so import can recover them. Archive tests verify the emitted names; PowerPoint menu display is a separate native observation.
|
|
6
|
+
|
|
7
|
+
Current API (PPTX 0.20.0; core `^0.20.1` and optional renderer peer `^0.20.0`): `toPptx(presentation, { fonts })` takes the fonts handle returned by `@openpresentation/opf-render/fonts-node`'s `loadFonts()` (core's `Fonts`, with at least `textMeasurement`). `fromPptx(bytes, { signals: true })` returns `{ presentation, signals }`. `OPFPptxError` carries `findings` (core format or variable errors) and `diagnostics` (layout-overflow diagnostics). Typeface helpers are `inventoryTypefaces` and `checkTypefaces`; the latter takes `{ families }`. These API names replaced the earlier top-level `textMeasurement`, `{ document, signals }`, `issues`, `inventoryPptxTypefaces`, `checkPptxTypefaces` and `{ fonts }` check options in the historical RR-55 migration. Each slide is composed with core's `resolveSlideContext` options and its resolved design fonts. Unresolved references report `unresolved-reference` and use engine defaults unless `strictReferences: true` refuses the export. A slide without a layout, or with `layout: "auto"`, composes automatically.
|
|
6
8
|
|
|
7
9
|
Version 0.12.0 requires `@openpresentation/opf` ^0.12.0 (composed font sizes on PowerPoint's 0.01 pt grid, hanging wrap whitespace, promoted regions in reading order, right-to-left decks composed mirrored) and exports what that core composes, plus the export and import changes listed in the changelog; use it with opf-render 0.12.0 (optional peer ^0.12.0) and opf-editor 0.11.0 so preview and export resolve one core. Version 0.11.9 exports an SVG image as a native SVG picture over a PNG fallback (rasterized in Node by the optional `@openpresentation/opf-render` peer or `options.svgRasterizer`; without one it stays the placeholder), writes a deck footer's first text, date and slide number as native PowerPoint Header & Footer placeholders (output change for decks with a footer; every export now carries the footer placeholders on its master, layout and notes master; see [native header and footer](docs/native-header-footer.md)) and adds the opt-in `fromPptx(bytes, {signals: true})`, which also returns the raw per-shape signals of every slide (see Import signals; the option leaves the default import unchanged; core floor `^0.11.4` unchanged, no API removed). Version 0.11.8 re-imports rich text that wraps over several native lines as the one authored payload instead of reporting `content-structure-changed` (the export records the line count; decks exported by earlier versions import as before; core floor `^0.11.4` unchanged, no API change). Version 0.11.7 requires `@openpresentation/opf` ^0.11.4 and exports the design fields natively (cover and section logos, header and footer logos, picture bullets, the accent font), writes every chart's text at the size the preview draws, round-trips the slide content structure, sections, extensions, assets and brand images through PPTX provenance (a fresh export of a plain deck re-imports in its authored form, so read a root payload field before `blocks[0]`), writes slide sections as PowerPoint's section list, and degrades an SVG image to the preview's placeholder instead of aborting; install it with renderer 0.11.9 and editor 0.10.6 so export and preview resolve the same core (no API removed). Version 0.11.6 exports the treemap, histogram, pareto, box-and-whisker, waterfall and funnel charts as native chartex parts by default (`toPptx({chartex: 'auto'})`; `world` stays a clustered column with `chart-data-adapted`; pass `chartex: 'fallback'` for the previous output) and gives chartex text the deck's label colour and font (no API removed). Version 0.11.5 writes the slide tag run as a theme color reference (`a:schemeClr accent1`) where the deck theme holds the primary there (no API change; the color is unchanged). Version 0.11.4 re-imports quote payloads (each native quote line carries an `OPF_QUOTE_V1` tag) and slide-level image payloads from an unchanged export, writes the theme's `a:ea` and `a:cs` only for slots a script font is selected for, and requires core `^0.11.3` (the 70 legacy gallery layout ids and their geometry; install it with renderer 0.11.6 and editor 0.10.4 so export and preview resolve the same core; no API removed). Version 0.11.3 adds the opt-in `toPptx({ chartex: 'native' })` export of the seven chartex chart types and always imports chartex charts (no API removed; the default output is unchanged). Version 0.11.2 exports the classic chart types as native chart constructs and writes named and default table colours, text pairs and hyperlink colours as theme references (no API or dependency change; resolved colours are unchanged). Version 0.11.1 exports `design.watermark` as a native picture (it re-imports) and embeds byte-identical media parts once, with no API or dependency change. Version 0.11.0 requires core `^0.11.2` (cover slides are centered between header and footer furniture) and the optional `@openpresentation/opf-render` peer `^0.11.0`; install them together so export and preview resolve the same core. Version 0.10.0 required core `^0.11.1` and the peer `^0.10.0`. It adds native slide-number and date fields, socials, slide-level image treatments, theme color schemes, script-slot fonts and RTL, re-import of design and metadata references, native underline and current-body formatting on import, and UTC-canonical `zipDate` (see the changelog for the intentional contract changes).
|
|
8
10
|
|
package/dist/index.js
CHANGED
|
@@ -2036,7 +2036,8 @@ function masterBackground(context) {
|
|
|
2036
2036
|
|
|
2037
2037
|
// The theme part carries the deck-level scheme (slide overrides stay literal)
|
|
2038
2038
|
// and, for a theme reference that resolves (embedded or in a registered catalog), that theme's name, which import
|
|
2039
|
-
// recovery matches against the registered catalogs (FF-24).
|
|
2039
|
+
// recovery matches against the registered catalogs (FF-24). Without an authored theme,
|
|
2040
|
+
// brand the generated theme: PowerPoint uses it for the Home > Layout category.
|
|
2040
2041
|
function exportTheme(presentation, context, options) {
|
|
2041
2042
|
const reference = presentation.design?.theme;
|
|
2042
2043
|
const theme = typeof reference === "string" ? resolveReference(presentation, "themes", reference, {catalogs: options.catalogs}) : undefined;
|
|
@@ -2044,7 +2045,7 @@ function exportTheme(presentation, context, options) {
|
|
|
2044
2045
|
return {
|
|
2045
2046
|
themeColors: themeSlotColors(scheme),
|
|
2046
2047
|
schemeName: scheme.name ?? scheme.id ?? "OpenPresentation",
|
|
2047
|
-
themeName: theme ? theme.record.name ?? theme.id :
|
|
2048
|
+
themeName: theme ? theme.record.name ?? theme.id : "pptx.gallery"
|
|
2048
2049
|
};
|
|
2049
2050
|
}
|
|
2050
2051
|
|
|
@@ -4330,7 +4331,11 @@ function normalizePartBytes(path, bytes, context, renameMaps, entries, imageMeta
|
|
|
4330
4331
|
`<Override PartName="/${part}" ContentType="${metadata.mediaType}"/>`).join('');
|
|
4331
4332
|
xml = xml.replace('</Types>', `${overrides}</Types>`);
|
|
4332
4333
|
}
|
|
4333
|
-
if (/^ppt\/slideMasters\/slideMaster\d+\.xml$/.test(path))
|
|
4334
|
+
if (/^ppt\/slideMasters\/slideMaster\d+\.xml$/.test(path)) {
|
|
4335
|
+
// Name the generated master; PowerPoint's layout category also needs the default theme name. Script masters copy this label.
|
|
4336
|
+
xml = themeMasterBulletFonts(xml).replace(/<p:cSld\b([^>]*)>/, (_, attributes) =>
|
|
4337
|
+
`<p:cSld${attributes.replace(/\s+name="[^"]*"/, '')} name="pptx.gallery">`);
|
|
4338
|
+
}
|
|
4334
4339
|
if (context.masterBackground && path === 'ppt/slideMasters/slideMaster1.xml') xml = writeMasterBackground(xml, context.masterBackground);
|
|
4335
4340
|
if (context.masterBackground && /^ppt\/slideLayouts\/slideLayout\d+\.xml$/.test(path)) xml = inheritLayoutBackground(xml);
|
|
4336
4341
|
if (path === 'ppt/presentation.xml') xml = presentationInSchemaOrder(xml);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpresentation/opf-pptx",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"description": "Pure local OPF to PPTX export and PPTX to OPF import tooling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"test:determinism": "node test/determinism.mjs"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@openpresentation/gallery": "^3.0.0",
|
|
68
67
|
"@node-projects/jszip": "4.3.0",
|
|
68
|
+
"@openpresentation/gallery": "^3.0.0",
|
|
69
69
|
"@openpresentation/opf": "^0.20.1",
|
|
70
70
|
"@rgrove/parse-xml": "4.2.3",
|
|
71
71
|
"fast-xml-parser": "^5.8.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@openpresentation/opf-render": "0.20.0",
|
|
102
102
|
"@resvg/resvg-js": "2.6.2",
|
|
103
103
|
"esbuild": "0.28.2",
|
|
104
|
-
"playwright": "1.
|
|
104
|
+
"playwright": "1.64.0"
|
|
105
105
|
},
|
|
106
106
|
"imports": {
|
|
107
107
|
"#image-fallback": {
|