@openpresentation/opf-pptx 0.26.9 → 0.27.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/index.js +11 -8
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -52,8 +52,8 @@ import { prepareSvg, svgDataUriBytes, svgRasterScale, svgBlipRelationship, attac
|
|
|
52
52
|
import { chartPaletteSchemes, applyChartSchemeColors } from './chart-scheme-colors.js';
|
|
53
53
|
import { rasterMetadata, pictureTransform, normalizeImageOrientation } from './image-geometry.js';
|
|
54
54
|
import {
|
|
55
|
-
catalogRecords, clrMapAttributes, normalizeColorVariant, chartPaletteForFill, chartSeriesPalette, chartTextSize as coreChartTextSize, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeSyntaxPaletteForRoles, readableSchemeColor, codeLineNumbers, codeLineRuns, codeSyntaxPaletteForScheme, composeSlide,
|
|
56
|
-
ENGINE_DEFAULT_FONT_SCHEME, defaultSlideBackground, fitImage, fitText, layoutTable, layoutWatermark, metricTrendMark, resolveCanvasDimensions, resolveColorRoles, resolveFontFamilies,
|
|
55
|
+
catalogRecords, clrMapAttributes, normalizeColorVariant, chartLeadFromScheme, chartPaletteForFill, chartSeriesPalette, chartTextSize as coreChartTextSize, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeSyntaxPaletteForRoles, readableSchemeColor, codeLineNumbers, codeLineRuns, codeSyntaxPaletteForScheme, composeSlide,
|
|
56
|
+
ENGINE_DEFAULT_FONT_SCHEME, defaultSlideBackground, fitImage, fitText, layoutTable, layoutWatermark, metricTrendMark, metricValueColor, resolveCanvasDimensions, resolveColorRoles, resolveFontFamilies,
|
|
57
57
|
resolveChartColors, resolveReference, resolveScriptFonts, resolveTextStyle, textColorForFill, textWidthMeasurer, timelineMarkerShapes, timelineTextColor, tokenizeCode
|
|
58
58
|
} from "@openpresentation/opf/composition";
|
|
59
59
|
import { colorContext, resolveColorRefValue, resolveExportColor, resolveVariableColors } from "./color-ref.js";
|
|
@@ -2928,7 +2928,8 @@ function addChartPayload(slide, chart, region, context, options = {}, path = "ch
|
|
|
2928
2928
|
// `chart.colors` scheme slot or role) is written as a schemeClr, so re-theming in PowerPoint recolours the series.
|
|
2929
2929
|
const colorContext = {roles: context.roles, variables: context.variables, accents: context.roles.map?.accents};
|
|
2930
2930
|
const preferredPalette = chartSeriesPalette(context.colorScheme, chart.colors, colorContext);
|
|
2931
|
-
|
|
2931
|
+
// WI-5 (P18, D3): series 1 from the scheme reaches 4.5:1 on a dark panel, as the preview draws it; a lifted colour is written as srgbClr.
|
|
2932
|
+
const adjustedPalette = chartPaletteForFill(panelFill, preferredPalette, {legibleLead: chartLeadFromScheme(chart.colors, context.colorScheme, colorContext)});
|
|
2932
2933
|
const palette = adjustedPalette.map(color=>normalizeHex(color));
|
|
2933
2934
|
const paletteSchemes = chartPaletteSchemes(chart.colors, preferredPalette, adjustedPalette, (reference, hex) => schemeColorValue(reference, `#${hex}`, context), context.roles.map?.accents);
|
|
2934
2935
|
Object.assign(context.chartHeadings.get(objectName), {palette, paletteSchemes, circular});
|
|
@@ -3131,7 +3132,7 @@ function addTablePayload(slide, authoredTable, region, context, options, path, p
|
|
|
3131
3132
|
recordPayloadData(context, objectName, 'table', presentation, path, layout);
|
|
3132
3133
|
// FA-27: the table's text alternative (the frame's descr; the empty string is PowerPoint's decorative marker).
|
|
3133
3134
|
if (typeof authoredTable?.alt === 'string') context.frameAlts.set(objectName, authoredTable.alt);
|
|
3134
|
-
if (layout.rows.some(row => row.cells.some(cell => Object.keys(cell.style ?? {}).length))) context.tableCells.set(objectName, {layout, scale, context, defaultBorder:{color:`#${context.colors.border}`,width:1/scale}});
|
|
3135
|
+
if (layout.rows.some(row => row.cells.some(cell => Object.keys(cell.style ?? {}).length))) context.tableCells.set(objectName, {layout, scale, context, defaultBorder:{color:`#${context.colors.border}`,width:1/scale}, hiddenBorder:{color:'#000000',width:0}});
|
|
3135
3136
|
slide.addTable(rows, {
|
|
3136
3137
|
objectName,
|
|
3137
3138
|
x: region.x,
|
|
@@ -3142,12 +3143,14 @@ function addTablePayload(slide, authoredTable, region, context, options, path, p
|
|
|
3142
3143
|
// frame height is the row total so the XML matches what both engines draw.
|
|
3143
3144
|
h: layout.height / 96,
|
|
3144
3145
|
rowH: layout.rows.map(row => row.box.height / 96),
|
|
3145
|
-
|
|
3146
|
+
// WI-5 (P20): the column widths core sized from content, the same ones the preview draws (logical column order, as a:tblGrid lists them).
|
|
3147
|
+
colW: layout.columnWidths.map(width => width / 96),
|
|
3146
3148
|
autoPage: false,
|
|
3147
3149
|
fontFace: context.fonts.body,
|
|
3148
3150
|
fontSize: 15 * scale * 0.75,
|
|
3149
3151
|
color: context.colors.text,
|
|
3150
|
-
|
|
3152
|
+
// WI-5 (P20): horizontal rules only (top and bottom of every cell), as the preview draws them; an explicit cell border is written over this.
|
|
3153
|
+
border: [{ type: "solid", color: context.colors.border, pt: 0.75 }, { type: "none" }, { type: "solid", color: context.colors.border, pt: 0.75 }, { type: "none" }],
|
|
3151
3154
|
margin: [6 * scale, 7.5 * scale, 3 * scale, 7.5 * scale],
|
|
3152
3155
|
valign: "top"
|
|
3153
3156
|
});
|
|
@@ -3439,7 +3442,7 @@ function addMetricPayload(slide,value,layout,context,path,options) {
|
|
|
3439
3442
|
const group=String(context.metricTags.size+1),manifest=metricManifest(value,layout,group);
|
|
3440
3443
|
// RR-07: a trend colours the trend and delta text and adds one native arrow shape, from core's accepted geometry.
|
|
3441
3444
|
const trendMark=metricTrendMark(layout,{background:`#${normalizeHex(context.colors.background)}`,...(context.roles.neutrals?.trendNeutral ? {neutral: context.roles.neutrals.trendNeutral.hex} : {})});
|
|
3442
|
-
const partColor=part=>trendMark&&(part.role==='trend'||part.role==='delta')?trendMark.color.slice(1):part.role==='value'?context.colors.accent:context.textColor;
|
|
3445
|
+
const partColor=part=>trendMark&&(part.role==='trend'||part.role==='delta')?trendMark.color.slice(1):part.role==='value'?metricValueColor(`#${normalizeHex(context.colors.accent)}`,`#${normalizeHex(context.colors.background)}`).slice(1).toUpperCase():context.textColor;
|
|
3443
3446
|
for (const [partIndex,part] of layout.parts.entries()) {
|
|
3444
3447
|
const invalid=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/u.exec(part.text);
|
|
3445
3448
|
if (invalid) throw new OPFPptxError('invalid-metric-text',`Metric text contains U+${invalid[0].codePointAt(0).toString(16).toUpperCase().padStart(4,'0')} at UTF-16 offset ${invalid.index}, which XML cannot represent; edit that character before exporting.`,{path:part.path});
|
|
@@ -4681,7 +4684,7 @@ function normalizePartBytes(path, bytes, context, renameMaps, entries, imageMeta
|
|
|
4681
4684
|
// Anchor-only styling truncates dashes and restores hidden segments.
|
|
4682
4685
|
const perimeter = {left:currentColumn === owner.column, right:currentColumn === owner.column + owner.colSpan - 1,
|
|
4683
4686
|
top:currentRow === owner.row, bottom:currentRow === owner.row + owner.rowSpan - 1};
|
|
4684
|
-
const style = cell ? {...cell.style} : {borders:Object.fromEntries(Object.keys(perimeter).map(edge => [edge,perimeter[edge] ? owner.style?.borders?.[edge] ?? table.defaultBorder : {color:'#000000',width:0}]))};
|
|
4687
|
+
const style = cell ? {...cell.style} : {borders:Object.fromEntries(Object.keys(perimeter).map(edge => [edge,perimeter[edge] ? owner.style?.borders?.[edge] ?? (edge === 'left' || edge === 'right' ? table.hiddenBorder : table.defaultBorder) : {color:'#000000',width:0}]))};
|
|
4685
4688
|
style.borders = {...style.borders};
|
|
4686
4689
|
// Native shared-edge precedence can let an implicit neighbor cover
|
|
4687
4690
|
// an explicit merge border. Give both physical sides that border.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpresentation/opf-pptx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Pure local OPF to PPTX export and PPTX to OPF import tooling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"fflate": "^0.8.3",
|
|
44
44
|
"pako": "3.0.2",
|
|
45
45
|
"sharp": "0.35.5",
|
|
46
|
-
"@openpresentation/gallery": "^0.
|
|
47
|
-
"@openpresentation/opf": "^0.
|
|
46
|
+
"@openpresentation/gallery": "^0.27.0",
|
|
47
|
+
"@openpresentation/opf": "^0.27.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@openpresentation/opf-render": "^0.
|
|
50
|
+
"@openpresentation/opf-render": "^0.27.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@openpresentation/opf-render": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@resvg/resvg-js": "2.6.2",
|
|
75
75
|
"esbuild": "0.28.2",
|
|
76
76
|
"playwright": "1.64.0",
|
|
77
|
-
"@openpresentation/opf-render": "0.
|
|
77
|
+
"@openpresentation/opf-render": "0.27.0"
|
|
78
78
|
},
|
|
79
79
|
"imports": {
|
|
80
80
|
"#image-fallback": {
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"test:native-text": "node test/native-text-whitespace.mjs",
|
|
110
110
|
"test:determinism": "node test/determinism.mjs"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "f90536d0e9a7a16b25aa718e03ced4e00a7316e1"
|
|
113
113
|
}
|