pptxgenjs-plus 4.4.0 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptxgenjs-plus",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "author": {
5
5
  "name": "Brent Ely",
6
6
  "url": "https://github.com/gitbrent/"
@@ -60,8 +60,8 @@
60
60
  "lint": "bun run generate:version && eslint src test",
61
61
  "typecheck": "bun run generate:version && tsc --noEmit",
62
62
  "test:types": "tsc --noEmit -p test/types/nodenext/tsconfig.json && tsc --noEmit -p test/types/node16/tsconfig.json && tsc --noEmit -p test/types/bundler/tsconfig.json && tsc --noEmit -p test/types/legacy/tsconfig.json && tsc --noEmit -p test/types/umd/tsconfig.json",
63
- "test": "bun run generate:version && bun test test/gen-utils.test.ts test/issues.test.ts test/audit-fixes.test.ts test/pptxgen.e2e.test.ts test/contracts.test.ts test/coverage.test.ts test/coverage-objects.test.ts test/package-version-plugin.test.ts test/ms-pptx-profile.test.ts test/pptx-verify.test.ts test/backports-core.test.ts test/backports-charts.test.ts test/backports-slides.test.ts",
64
- "test:coverage": "bun run generate:version && bun test --coverage test/gen-utils.test.ts test/issues.test.ts test/audit-fixes.test.ts test/pptxgen.e2e.test.ts test/contracts.test.ts test/coverage.test.ts test/coverage-objects.test.ts test/package-version-plugin.test.ts test/ms-pptx-profile.test.ts test/pptx-verify.test.ts test/backports-core.test.ts test/backports-charts.test.ts test/backports-slides.test.ts",
63
+ "test": "bun run generate:version && bun test test/gen-utils.test.ts test/issues.test.ts test/audit-fixes.test.ts test/pptxgen.e2e.test.ts test/contracts.test.ts test/coverage.test.ts test/coverage-objects.test.ts test/package-version-plugin.test.ts test/ms-pptx-profile.test.ts test/pptx-verify.test.ts test/backports-core.test.ts test/backports-charts.test.ts test/backports-slides.test.ts test/impress-powerpoint-compat.test.ts",
64
+ "test:coverage": "bun run generate:version && bun test --coverage test/gen-utils.test.ts test/issues.test.ts test/audit-fixes.test.ts test/pptxgen.e2e.test.ts test/contracts.test.ts test/coverage.test.ts test/coverage-objects.test.ts test/package-version-plugin.test.ts test/ms-pptx-profile.test.ts test/pptx-verify.test.ts test/backports-core.test.ts test/backports-charts.test.ts test/backports-slides.test.ts test/impress-powerpoint-compat.test.ts",
65
65
  "test:office": "bun run generate:version && bun test test/office-open.test.ts",
66
66
  "test:powerpoint": "bun run generate:version && bun test --timeout 180000 --max-concurrency 1 test/powerpoint-open.test.ts && bun test --timeout 180000 --max-concurrency 1 test/powerpoint-repair-fixtures.test.ts",
67
67
  "powerpoint:verify": "bun test/powerpoint-verify.ts",
package/types/core.d.ts CHANGED
@@ -1621,6 +1621,18 @@ declare interface ImageProps extends PositionProps, DataOrPathProps, ObjectNameP
1621
1621
  */
1622
1622
  y?: Coord;
1623
1623
  };
1624
+ /**
1625
+ * Direct percentage crop insets (`<a:srcRect l="..." t="..." r="..." b="..."/>`, ECMA-376 §5.1.10.55).
1626
+ * Each side is a percentage (`0..100`) of the source image to crop away (1% = 1000 in DrawingML
1627
+ * `ST_Percentage` units, where `100000` = 100%). Preserves the exact image box `w`/`h` (`<a:ext>`).
1628
+ * @example { l: 21.88, r: 21.87 }
1629
+ */
1630
+ crop?: {
1631
+ l?: number;
1632
+ t?: number;
1633
+ r?: number;
1634
+ b?: number;
1635
+ };
1624
1636
  /**
1625
1637
  * Transparency (percent)
1626
1638
  * - MS-PPT > Format Picture > Picture > Picture Transparency > Transparency
@@ -1730,6 +1742,8 @@ declare interface ISlideObject {
1730
1742
  shape?: SHAPE_NAME;
1731
1743
  /** @internal group children (`p:grpSp`) */
1732
1744
  _objects?: ISlideObject[];
1745
+ /** @internal slide-level `<mc:Fallback><p:pic>…</p:pic></mc:Fallback>` image for text shapes with `options.fallbackImage` */
1746
+ _fallbackImage?: ISlideObject;
1733
1747
  /** zoom kind: slide | section | summary @internal */
1734
1748
  zoomKind?: 'slide' | 'section' | 'summary';
1735
1749
  /** 1-based target slide number (slide zoom) @internal */
@@ -5280,6 +5294,16 @@ declare interface TextPropsOptions extends PositionProps, DataOrPathProps, TextB
5280
5294
  fontScale?: number;
5281
5295
  lnSpcReduction?: number;
5282
5296
  };
5297
+ /**
5298
+ * Explicit font scaling percentage (`1..100`) emitted as `fontScale` on `<a:normAutofit>`
5299
+ * when `fit: 'shrink'` is set (ECMA-376 §5.1.5.1.3; `100` = `100000`).
5300
+ */
5301
+ fontScale?: number;
5302
+ /**
5303
+ * Explicit line spacing reduction percentage (`0..100`) emitted as `lnSpcReduction` on
5304
+ * `<a:normAutofit>` when `fit: 'shrink'` is set (ECMA-376 §5.1.5.1.3; `20` = `20000`).
5305
+ */
5306
+ lnSpcReduction?: number;
5283
5307
  /**
5284
5308
  * Shape fill
5285
5309
  * @example { color:'FF0000' } // hex color (red)
@@ -5444,15 +5468,33 @@ declare interface TextPropsOptions extends PositionProps, DataOrPathProps, TextB
5444
5468
  horzOverflow?: 'overflow' | 'clip';
5445
5469
  /**
5446
5470
  * Prebuilt Office Math (OMML) fragment for this text run.
5447
- * Emitted as PowerPoint math: `<a14:m><m:oMath>…</m:oMath></a14:m>` interleaved
5448
- * with surrounding `<a:r>` text runs. Bare `m:oMath` (without `a14:m`) is
5449
- * silently stripped by PowerPoint on open — the library wraps it for you.
5471
+ * Emitted as spec-valid MCE `<mc:AlternateContent><mc:Choice Requires="a14"><a14:m><m:oMathPara>…</m:oMathPara></a14:m></mc:Choice><mc:Fallback>…</mc:Fallback></mc:AlternateContent>`
5472
+ * interleaved with surrounding `<a:r>` text runs. Bare `m:oMath` (without `a14:m` + `m:oMathPara`) is
5473
+ * stripped or fails schema validation — the library normalizes and wraps it for you.
5450
5474
  * Callers convert LaTeX/MathML → OMML themselves (e.g. MathLive + mathml2omml).
5451
5475
  * Use `text: ''` for math-only runs; surrounding runs can still hold plain text.
5452
5476
  * @example { text: '', options: { omml: '<m:oMath xmlns:m="…">…</m:oMath>' } }
5453
5477
  * @since v4.1.0
5454
5478
  */
5455
5479
  omml?: string;
5480
+ /**
5481
+ * Optional fallback content emitted inside `<mc:Fallback>` for an inline `omml` run.
5482
+ * Consumers that do not advertise `a14` (such as LibreOffice Impress) render this fallback
5483
+ * inline in place of `<a14:m>`.
5484
+ * - Pass a `string` for a single styled `<a:r>` inheriting this run's styling.
5485
+ * - Pass `TextProps[]` for rich multi-run fallback (e.g. italics, bold, sub/superscripts, Cambria Math).
5486
+ * - When omitted, falls back to the run's `text` (if non-empty) or an empty `<a:r><a:rPr dirty="0"/><a:t/></a:r>`.
5487
+ */
5488
+ ommlFallback?: string | TextProps[];
5489
+ /**
5490
+ * Optional fallback picture (`<p:pic>`) wrapped alongside this text shape in a slide-level
5491
+ * `<mc:AlternateContent><mc:Choice Requires="a14"><p:sp>…</p:sp></mc:Choice><mc:Fallback><p:pic>…</p:pic></mc:Fallback></mc:AlternateContent>`.
5492
+ * Ideal for standalone display math: PowerPoint renders the native editable OMML `<p:sp>`,
5493
+ * while consumers that do not advertise `a14` (e.g. LibreOffice Impress) render the fallback picture
5494
+ * (including vector `<asvg:svgBlip>` when SVG `data`/`path` + `svgPngData` are supplied).
5495
+ * Omitted `x`/`y`/`w`/`h`/`rotate` inherit from the parent text shape.
5496
+ */
5497
+ fallbackImage?: ImageProps;
5456
5498
  /**
5457
5499
  * Whether "Fit to Shape?" is enabled
5458
5500
  * @deprecated v3.3.0 - use `fit`