@openpresentation/opf-pptx 0.17.0 → 0.18.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/README.md +9 -7
- package/dist/document-provenance.js +7 -5
- package/dist/furniture-provenance.js +179 -69
- package/dist/image-fallback-node.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +78 -27
- package/dist/logo-provenance.js +8 -8
- package/dist/master-furniture.js +326 -0
- package/dist/media-dedupe.js +2 -0
- package/dist/native-furniture.js +6 -2
- package/package.json +4 -4
package/dist/native-furniture.js
CHANGED
|
@@ -78,9 +78,10 @@ const guid = (kind, n) => `{0F0F2701-${kind}-4000-8000-${n.toString(16).toUpperC
|
|
|
78
78
|
* maps a generated object name to its placeholder type. Runs after the tags are
|
|
79
79
|
* attached: the shape keeps its name, geometry, runs, fields and tags, and gains
|
|
80
80
|
* `p:ph` (a placeholder is a text shape the layout can supply defaults for).
|
|
81
|
+
* `bands` maps a generated object name to its zone's band (`{x, width}` in pixels) for a part narrower than its zone.
|
|
81
82
|
* Returns the placeholders in use and the first geometry/alignment seen per type.
|
|
82
83
|
*/
|
|
83
|
-
export function attachNativePlaceholders(entries, records) {
|
|
84
|
+
export function attachNativePlaceholders(entries, records, bands = new Map()) {
|
|
84
85
|
const used = new Set(), first = new Map(), seen = new Set();
|
|
85
86
|
if (!records.size) return {used, first};
|
|
86
87
|
const slides = Object.keys(entries).filter(path => /^ppt\/slides\/slide\d+\.xml$/.test(path)).sort((a, b) => Number(a.match(/\d+/)[0]) - Number(b.match(/\d+/)[0]));
|
|
@@ -101,7 +102,10 @@ export function attachNativePlaceholders(entries, records) {
|
|
|
101
102
|
if (!first.has(ph)) {
|
|
102
103
|
const geometry = shape.match(/<a:off x="(-?\d+)" y="(-?\d+)"\/><a:ext cx="(\d+)" cy="(\d+)"\/>/);
|
|
103
104
|
const algn = shape.match(/<a:pPr\b[^>]*\balgn="(\w+)"/)?.[1] ?? 'l';
|
|
104
|
-
|
|
105
|
+
// A part in a zone with other parts (a logo beside the footer text) is only as wide as its text (RR-71); the master and
|
|
106
|
+
// layout placeholders a footer added natively lands in use the zone's whole band at the same edge.
|
|
107
|
+
const band = bands.get(name);
|
|
108
|
+
if (geometry) first.set(ph, {x: band ? Math.round(band.x * EMU) : Number(geometry[1]), y: Number(geometry[2]), cx: band ? Math.round(band.width * EMU) : Number(geometry[3]), cy: Number(geometry[4]), algn});
|
|
105
109
|
}
|
|
106
110
|
changed = true;
|
|
107
111
|
return shape;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpresentation/opf-pptx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Pure local OPF to PPTX export and PPTX to OPF import tooling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@node-projects/jszip": "4.3.0",
|
|
68
|
-
"@openpresentation/opf": "^0.
|
|
68
|
+
"@openpresentation/opf": "^0.18.1",
|
|
69
69
|
"@rgrove/parse-xml": "4.2.3",
|
|
70
70
|
"fast-xml-parser": "^5.8.0",
|
|
71
71
|
"fflate": "^0.8.3",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"sharp": "0.35.5"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@openpresentation/opf-render": "^0.
|
|
76
|
+
"@openpresentation/opf-render": "^0.18.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"@openpresentation/opf-render": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@expo-google-fonts/roboto": "0.4.3",
|
|
93
93
|
"@expo-google-fonts/roboto-mono": "0.4.2",
|
|
94
94
|
"@expo-google-fonts/tinos": "0.4.2",
|
|
95
|
-
"@openpresentation/opf-render": "0.
|
|
95
|
+
"@openpresentation/opf-render": "0.18.0",
|
|
96
96
|
"@resvg/resvg-js": "2.6.2",
|
|
97
97
|
"esbuild": "0.28.2",
|
|
98
98
|
"playwright": "1.63.0"
|