@openpresentation/opf-render 0.5.0 → 0.5.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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # OPF Render
2
2
 
3
+ Version 0.5.1 reserves quote attribution/source space before fitting long text. See [quote layout and real-browser evidence](docs/quote-footer-0.5.1.md) for regression coverage and overflow behavior.
4
+
3
5
  Deterministic local renderer for Open Presentation Format documents. The shared SVG core implements validation, catalog resolution, placeholder binding and text layout. Node APIs additionally convert SVG to PNG and raster-backed PDF.
4
6
 
5
7
  ## Scope
package/dist/svg.js CHANGED
@@ -833,8 +833,12 @@ function renderMetric(item, box, bound, options) {
833
833
 
834
834
  function renderQuote(item, box, bound, options) {
835
835
  const quote = isPlainObject(item.value) ? item.value : { text: item.value };
836
+ const attribution = [quote.attribution, quote.source].filter(Boolean).join(" - ");
837
+ const body = inset(box, 18);
838
+ // Reserve the attribution footer before fitting the quote; it is not an overlay.
839
+ if (attribution) body.height = Math.max(1, box.height - 94);
836
840
  const children = [
837
- renderTextBox(`"${quote.text ?? ""}"`, inset(box, 18), bound, {
841
+ renderTextBox(`"${quote.text ?? ""}"`, body, bound, {
838
842
  path: `${item.path}.text`,
839
843
  fontSize: 28,
840
844
  fontFamily: bound.design.fonts.heading,
@@ -842,7 +846,7 @@ function renderQuote(item, box, bound, options) {
842
846
  fill: bound.design.colors.text,
843
847
  options
844
848
  }),
845
- renderTextBox([quote.attribution, quote.source].filter(Boolean).join(" - "), {
849
+ renderTextBox(attribution, {
846
850
  x: box.x + 18,
847
851
  y: box.y + box.height - 58,
848
852
  width: box.width - 36,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpresentation/opf-render",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Deterministic local OPF renderer for SVG, PNG, and PDF output.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,8 +57,9 @@
57
57
  "build": "node scripts/build.mjs",
58
58
  "typecheck": "node --check src/index.js && node --check scripts/build.mjs && node --check scripts/validate-package.mjs && node --check test/smoke.mjs && node --check test/golden.mjs && node --check src/fonts.js && node --check src/fonts-node.js && node --check src/font-compatibility.js && node --check test/office-fonts.mjs && node --check src/fonts-browser.js && node --check test/fonts-browser.mjs && node --check src/svg.js && node --check src/raster.js && node --check src/raster-images.js && node --check test/webp.mjs && node --check test/jpeg-orientation.mjs && node --check scripts/build-browser-check.mjs && node --check test/jpeg-browser.js && node --check test/rich-table.mjs && node --check test/styled-table.mjs",
59
59
  "validate": "node scripts/validate-package.mjs",
60
- "test": "npm run build && node test/smoke.mjs && node test/webp.mjs && node test/jpeg-orientation.mjs && node test/fonts.mjs && node test/office-fonts.mjs && node test/timeline.mjs && node test/rich-trace.mjs && node test/rich-table.mjs && node test/golden-gate.mjs && node test/golden.mjs && node test/fonts-browser.mjs && node test/design-preview.mjs && npm run build:browser-check && npm run test:styled-table",
60
+ "test": "npm run build && node test/smoke.mjs && node test/webp.mjs && node test/jpeg-orientation.mjs && node test/fonts.mjs && node test/office-fonts.mjs && node test/timeline.mjs && node test/quote-footer.mjs && node test/rich-trace.mjs && node test/rich-table.mjs && node test/golden-gate.mjs && node test/golden.mjs && node test/fonts-browser.mjs && node test/design-preview.mjs && npm run build:browser-check && npm run test:styled-table",
61
61
  "test:golden": "npm run build && node test/golden.mjs",
62
+ "test:browser": "npm run build:browser-check && node test/browser-check.mjs",
62
63
  "golden:update": "npm run build && node test/golden.mjs --update",
63
64
  "prepack": "npm run build",
64
65
  "build:browser-check": "node scripts/build-browser-check.mjs",
@@ -80,6 +81,7 @@
80
81
  "sharp": "0.35.4"
81
82
  },
82
83
  "devDependencies": {
83
- "esbuild": "0.28.2"
84
+ "esbuild": "0.28.2",
85
+ "playwright": "1.63.0"
84
86
  }
85
87
  }