@json-to-office/core-pptx 0.36.0 → 1.2.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/core/expandHighcharts.d.ts +35 -0
- package/dist/core/expandHighcharts.d.ts.map +1 -0
- package/dist/core/finalizePackage.d.ts +39 -0
- package/dist/core/finalizePackage.d.ts.map +1 -0
- package/dist/core/generateFromIr.d.ts +71 -0
- package/dist/core/generateFromIr.d.ts.map +1 -0
- package/dist/core/generationContext.d.ts +2 -10
- package/dist/core/generationContext.d.ts.map +1 -1
- package/dist/core/generationOptions.d.ts +73 -0
- package/dist/core/generationOptions.d.ts.map +1 -0
- package/dist/core/generator.d.ts +18 -78
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/resolveImageLayout.d.ts +23 -0
- package/dist/core/resolveImageLayout.d.ts.map +1 -0
- package/dist/core/structure.d.ts.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4299 -2208
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts +41 -0
- package/dist/ir/compiler.d.ts.map +1 -0
- package/dist/ir/debug.d.ts +18 -0
- package/dist/ir/debug.d.ts.map +1 -0
- package/dist/ir/features.d.ts +18 -0
- package/dist/ir/features.d.ts.map +1 -0
- package/dist/ir/index.d.ts +19 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/resources.d.ts +55 -0
- package/dist/ir/resources.d.ts.map +1 -0
- package/dist/ir/types.d.ts +623 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/units.d.ts +66 -0
- package/dist/ir/units.d.ts.map +1 -0
- package/dist/ir/validation.d.ts +19 -0
- package/dist/ir/validation.d.ts.map +1 -0
- package/dist/plugin/createPresentationGenerator.d.ts +7 -1
- package/dist/plugin/createPresentationGenerator.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +7 -1
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/renderers/office-open/emit.d.ts +42 -0
- package/dist/renderers/office-open/emit.d.ts.map +1 -0
- package/dist/renderers/office-open/index.d.ts +25 -0
- package/dist/renderers/office-open/index.d.ts.map +1 -0
- package/dist/renderers/pptxgenjs/chart.d.ts +11 -0
- package/dist/renderers/pptxgenjs/chart.d.ts.map +1 -0
- package/dist/renderers/pptxgenjs/emit.d.ts +60 -0
- package/dist/renderers/pptxgenjs/emit.d.ts.map +1 -0
- package/dist/renderers/pptxgenjs/fills.d.ts +38 -0
- package/dist/renderers/pptxgenjs/fills.d.ts.map +1 -0
- package/dist/renderers/pptxgenjs/index.d.ts +22 -0
- package/dist/renderers/pptxgenjs/index.d.ts.map +1 -0
- package/dist/renderers/pptxgenjs/packaging.d.ts +51 -0
- package/dist/renderers/pptxgenjs/packaging.d.ts.map +1 -0
- package/dist/{core → renderers/pptxgenjs}/svgRasterFallback.d.ts +1 -1
- package/dist/renderers/pptxgenjs/svgRasterFallback.d.ts.map +1 -0
- package/dist/renderers/pptxgenjs/table.d.ts +19 -0
- package/dist/renderers/pptxgenjs/table.d.ts.map +1 -0
- package/dist/renderers/registry.d.ts +15 -0
- package/dist/renderers/registry.d.ts.map +1 -0
- package/dist/renderers/types.d.ts +36 -0
- package/dist/renderers/types.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +23 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -3
- package/dist/components/chart.d.ts +0 -89
- package/dist/components/chart.d.ts.map +0 -1
- package/dist/components/highcharts.d.ts +0 -9
- package/dist/components/highcharts.d.ts.map +0 -1
- package/dist/components/image.d.ts +0 -35
- package/dist/components/image.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -13
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/shape.d.ts +0 -61
- package/dist/components/shape.d.ts.map +0 -1
- package/dist/components/table.d.ts +0 -48
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/text.d.ts +0 -76
- package/dist/components/text.d.ts.map +0 -1
- package/dist/core/packagePresentation.d.ts +0 -29
- package/dist/core/packagePresentation.d.ts.map +0 -1
- package/dist/core/render.d.ts +0 -8
- package/dist/core/render.d.ts.map +0 -1
- package/dist/core/svgRasterFallback.d.ts.map +0 -1
- package/dist/core/template.d.ts +0 -10
- package/dist/core/template.d.ts.map +0 -1
- package/dist/utils/fillXml.d.ts +0 -19
- package/dist/utils/fillXml.d.ts.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit and identity helpers for PptxIR construction.
|
|
3
|
+
*
|
|
4
|
+
* Authoring expresses geometry in inches (or percent strings); the IR expresses
|
|
5
|
+
* it in EMU. The conversion is a single rounding step, done here so every
|
|
6
|
+
* compile site agrees on it — and so the PptxGenJS adapter can invert it
|
|
7
|
+
* exactly by dividing, since PptxGenJS applies the same `Math.round(in * EMU)`
|
|
8
|
+
* on the way in.
|
|
9
|
+
*/
|
|
10
|
+
import type { PptxIrColor } from './types';
|
|
11
|
+
/** Inches → EMU. */
|
|
12
|
+
export declare function inchesToEmu(inches: number): number;
|
|
13
|
+
/** EMU → inches. Lossless against `inchesToEmu` for realistic magnitudes. */
|
|
14
|
+
export declare function emuToInches(emu: number): number;
|
|
15
|
+
/** Slide size in EMU, the frame percentages resolve against. */
|
|
16
|
+
export interface SlideExtentEmu {
|
|
17
|
+
widthEmu: number;
|
|
18
|
+
heightEmu: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve an authored dimension to EMU.
|
|
22
|
+
*
|
|
23
|
+
* This reproduces the authoring contract the pipeline has always had, quirks
|
|
24
|
+
* included, because the numbers it produces are the numbers that end up in the
|
|
25
|
+
* package:
|
|
26
|
+
*
|
|
27
|
+
* - a number below 100 is inches
|
|
28
|
+
* - a number of 100 or more is already EMU (nobody authors a 100-inch slide,
|
|
29
|
+
* and callers do pass EMU through)
|
|
30
|
+
* - a percent string resolves against the slide extent *in EMU*, so the single
|
|
31
|
+
* rounding step happens at the end
|
|
32
|
+
* - a bare numeric string is treated as a number
|
|
33
|
+
* - anything else is 0 rather than an error
|
|
34
|
+
*
|
|
35
|
+
* The rules are stated here once so no compile site has to re-derive them.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveDimensionEmu(value: number | string, axis: 'X' | 'Y', extent: SlideExtentEmu): number;
|
|
38
|
+
/**
|
|
39
|
+
* Width used when an element does not state one.
|
|
40
|
+
*
|
|
41
|
+
* 75% of the slide width — the width the pipeline has always produced for an
|
|
42
|
+
* element with no `w`. Materialising it here is what lets the IR promise an
|
|
43
|
+
* explicit transform without changing any output.
|
|
44
|
+
*/
|
|
45
|
+
export declare function defaultWidthEmu(extent: SlideExtentEmu): number;
|
|
46
|
+
/**
|
|
47
|
+
* Build an IR colour from an already-resolved bare hex string.
|
|
48
|
+
*
|
|
49
|
+
* `resolveColor` (utils/color.ts) is what turns theme tokens into hex; this
|
|
50
|
+
* only normalises casing and attaches transparency, so an unresolved token can
|
|
51
|
+
* never reach the IR by accident.
|
|
52
|
+
*/
|
|
53
|
+
export declare function irColor(bareHex: string, transparency?: number): PptxIrColor;
|
|
54
|
+
/** Normalise degrees into [0, 360). */
|
|
55
|
+
export declare function normalizeDegrees(degrees: number): number;
|
|
56
|
+
/** Lowercase hex SHA-256, the identity used for inline resources. */
|
|
57
|
+
export declare function sha256Hex(bytes: Uint8Array): string;
|
|
58
|
+
/**
|
|
59
|
+
* Deterministic element id from its position in the tree.
|
|
60
|
+
*
|
|
61
|
+
* Ids are derived, never allocated from a counter, so two concurrent
|
|
62
|
+
* generations of the same document produce the same ids and a single
|
|
63
|
+
* generation's ids do not depend on evaluation order.
|
|
64
|
+
*/
|
|
65
|
+
export declare function elementId(slideIndex: number, indexPath: readonly number[]): string;
|
|
66
|
+
//# sourceMappingURL=units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/ir/units.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,oBAAoB;AACpB,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,IAAI,EAAE,GAAG,GAAG,GAAG,EACf,MAAM,EAAE,cAAc,GACrB,MAAM,CAmBR;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,CAK3E;AAED,uCAAuC;AACvC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,MAAM,CAER"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PptxIR invariants.
|
|
3
|
+
*
|
|
4
|
+
* These are not authoring checks — the schema validators already ran. They
|
|
5
|
+
* guard the *contract* the IR promises adapters: resolved colours, finite EMU
|
|
6
|
+
* geometry, resolved resource references, in-range slide links, no functions or
|
|
7
|
+
* renderer objects hiding in the tree.
|
|
8
|
+
*
|
|
9
|
+
* A violation is a compiler bug, so it is reported as an error, not a warning.
|
|
10
|
+
*/
|
|
11
|
+
import { type PptxIR } from './types';
|
|
12
|
+
export interface IrViolation {
|
|
13
|
+
path: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function validatePptxIr(ir: PptxIR): IrViolation[];
|
|
17
|
+
/** Throw on the first invariant violation. Used by tests and debug builds. */
|
|
18
|
+
export declare function assertValidPptxIr(ir: PptxIR): void;
|
|
19
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/ir/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAEL,KAAK,MAAM,EAOZ,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CA4FxD;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CASlD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { PptxThemeConfig } from '../types';
|
|
2
2
|
import type { PresentationGeneratorBuilder, GenerationValidationOptions } from './types';
|
|
3
|
+
import type { PresentationPackagingOptions } from '../core/finalizePackage';
|
|
4
|
+
import type { PptxRendererId } from '../renderers/types';
|
|
3
5
|
import type { ServicesConfig, FontRuntimeOpts } from '@json-to-office/shared';
|
|
4
|
-
import { type PresentationPackagingOptions } from '../core/packagePresentation';
|
|
5
6
|
/**
|
|
6
7
|
* Options for creating a presentation generator
|
|
7
8
|
*/
|
|
@@ -24,6 +25,11 @@ export interface PresentationGeneratorOptions extends PresentationPackagingOptio
|
|
|
24
25
|
* overrides it; defaults to `process.cwd()` when neither is set (#142).
|
|
25
26
|
*/
|
|
26
27
|
baseDir?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Backend that turns the compiled presentation into bytes. Per-call
|
|
30
|
+
* `options.renderer` overrides it; defaults to `pptxgenjs`.
|
|
31
|
+
*/
|
|
32
|
+
renderer?: PptxRendererId;
|
|
27
33
|
}
|
|
28
34
|
/**
|
|
29
35
|
* Create a presentation generator with chainable component registration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPresentationGenerator.d.ts","sourceRoot":"","sources":["../../src/plugin/createPresentationGenerator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAIV,eAAe,
|
|
1
|
+
{"version":3,"file":"createPresentationGenerator.d.ts","sourceRoot":"","sources":["../../src/plugin/createPresentationGenerator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAIV,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAEV,4BAA4B,EAK5B,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AAIjB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9E;;GAEG;AACH,MAAM,WAAW,4BACf,SAAQ,4BAA4B;IACpC,wCAAwC;IACxC,KAAK,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC/C,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,oFAAoF;IACpF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,qEAAqE;IACrE,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAmjBD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,4BAAiC,GACzC,4BAA4B,CAAC,SAAS,EAAE,CAAC,CAmB3C"}
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import type { Static, TSchema } from '@sinclair/typebox';
|
|
6
6
|
import type { CustomComponent } from '@json-to-office/shared/plugin';
|
|
7
7
|
import type { PptxComponentInput, PresentationComponentDefinition, SlideComponentDefinition, PipelineWarning } from '../types';
|
|
8
|
-
import type {
|
|
8
|
+
import type { PptxRendererId } from '../renderers/types';
|
|
9
|
+
import type { PresentationPackagingOptions } from '../core/finalizePackage';
|
|
9
10
|
type InferVersionMap<T> = T extends CustomComponent<any, infer V, any> ? V : never;
|
|
10
11
|
type InferName<T> = T extends CustomComponent<any, any, infer N> ? N : never;
|
|
11
12
|
/**
|
|
@@ -96,6 +97,11 @@ export interface GenerateOptions extends PresentationPackagingOptions {
|
|
|
96
97
|
* set (#142).
|
|
97
98
|
*/
|
|
98
99
|
baseDir?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Backend that turns the compiled presentation into bytes. Overrides the
|
|
102
|
+
* constructor `renderer`; defaults to `pptxgenjs`.
|
|
103
|
+
*/
|
|
104
|
+
renderer?: PptxRendererId;
|
|
99
105
|
}
|
|
100
106
|
export type GenerateFileOptions = GenerateOptions;
|
|
101
107
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EACV,kBAAkB,EAClB,+BAA+B,EAC/B,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AAG,CAAC,EAAE,GAAG,SAAS,EAAE,CAC3E,SAAQ,qBAAqB,CAAC,WAAW,CAAC;IAC1C,YAAY,CAAC,aAAa,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC/D,SAAS,EAAE,aAAa,GACvB,4BAA4B,CAAC,SAAS,CAAC,GAAG,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;CAC3E;AAID,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAClC,CAAC,SAAS,4BAA4B,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE9D,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAC7B,CAAC,SAAS,4BAA4B,CAAC,MAAM,CAAC,CAAC,GAC3C,6BAA6B,CAAC,CAAC,CAAC,GAChC,KAAK,CAAC;AAEZ,MAAM,MAAM,wBAAwB,CAAC,CAAC,IACpC,CAAC,SAAS,4BAA4B,CAAC,MAAM,CAAC,CAAC,GAC3C,0BAA0B,CAAC,CAAC,CAAC,GAC7B,CAAC,SAAS,qBAAqB,CAAC,MAAM,CAAC,CAAC,GACtC,0BAA0B,CAAC,CAAC,CAAC,GAC7B,KAAK,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PptxIR → `@office-open/pptx` options.
|
|
3
|
+
*
|
|
4
|
+
* The mapping is unusually direct because the two models agree on units: EMU
|
|
5
|
+
* for geometry, points for font sizes, degrees for angles, percent for gradient
|
|
6
|
+
* stops. Bare numbers reach the backend in exactly those units — the
|
|
7
|
+
* `UniversalMeasure` string form is never used here, because a value that has
|
|
8
|
+
* already been resolved has no business being re-parsed.
|
|
9
|
+
*
|
|
10
|
+
* Backend gaps are handled by *not declaring the capability* in `index.ts`, so
|
|
11
|
+
* anything this module cannot express has already been rejected before it is
|
|
12
|
+
* called. Reaching a `throw` here is a bug, not a user error.
|
|
13
|
+
*/
|
|
14
|
+
import type { PptxIrBackground, PptxIrElement, PptxIrFill, PptxIrResource, PptxIrTextBodyStyle, PptxIrTextRun } from '../../ir/types';
|
|
15
|
+
type Opts = Record<string, unknown>;
|
|
16
|
+
export type ResourceLookup = ReadonlyMap<string, PptxIrResource>;
|
|
17
|
+
export interface OfficeOpenEmitContext {
|
|
18
|
+
resources: ResourceLookup;
|
|
19
|
+
/** Bytes for file and remote resources, fetched before rendering. */
|
|
20
|
+
resourceBytes: ReadonlyMap<string, Uint8Array>;
|
|
21
|
+
/**
|
|
22
|
+
* Allocates the drawing id for the next element on the current slide.
|
|
23
|
+
*
|
|
24
|
+
* The backend numbers elements from a counter that lives for the life of the
|
|
25
|
+
* process, so a second render of the same deck produces different ids and
|
|
26
|
+
* different bytes. Numbering them here, per slide, makes a render depend only
|
|
27
|
+
* on its input.
|
|
28
|
+
*/
|
|
29
|
+
nextId: () => number;
|
|
30
|
+
}
|
|
31
|
+
export declare function fill(value: PptxIrFill, ctx: OfficeOpenEmitContext): unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Build a text body.
|
|
34
|
+
*
|
|
35
|
+
* `breakAfter` on a run starts a new paragraph, which is how the IR expresses a
|
|
36
|
+
* hard break inside a body.
|
|
37
|
+
*/
|
|
38
|
+
export declare function textBody(runs: readonly PptxIrTextRun[], style: PptxIrTextBodyStyle | undefined): Opts;
|
|
39
|
+
export declare function slideChild(element: PptxIrElement, ctx: OfficeOpenEmitContext): Opts;
|
|
40
|
+
export declare function background(value: PptxIrBackground, ctx: OfficeOpenEmitContext): Opts;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAEhB,aAAa,EACb,UAAU,EAMV,cAAc,EAKd,mBAAmB,EAEnB,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAExB,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,cAAc,CAAC;IAC1B,qEAAqE;IACrE,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC/C;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,MAAM,CAAC;CACtB;AAuFD,wBAAgB,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAmC3E;AAwED;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,KAAK,EAAE,mBAAmB,GAAG,SAAS,GACrC,IAAI,CA2BN;AAiVD,wBAAgB,UAAU,CACxB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,qBAAqB,GACzB,IAAI,CAoBN;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,qBAAqB,GACzB,IAAI,CAKN"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The experimental `@office-open/pptx` renderer.
|
|
3
|
+
*
|
|
4
|
+
* Selecting it is explicit and opt-in; `pptxgenjs` stays the default. The
|
|
5
|
+
* backend is an optional peer dependency, resolved at call time so a missing
|
|
6
|
+
* package surfaces as an install hint rather than a module-resolution failure.
|
|
7
|
+
*
|
|
8
|
+
* The capability set below is deliberately narrow. A feature is listed only
|
|
9
|
+
* when it has been proven against the real package, never from its README, and
|
|
10
|
+
* a gap in the backend is expressed by *omitting* the capability — which makes
|
|
11
|
+
* the compiler reject the document before any bytes exist, instead of shipping
|
|
12
|
+
* a deck with content quietly missing.
|
|
13
|
+
*/
|
|
14
|
+
import type { PptxIR } from '../../ir/types';
|
|
15
|
+
import type { PptxRenderer, PptxRendererId } from '../types';
|
|
16
|
+
export declare const OFFICE_OPEN_PPTX_RENDERER_ID: PptxRendererId;
|
|
17
|
+
export declare function createOfficeOpenPptxRenderer(): Promise<PptxRenderer>;
|
|
18
|
+
/**
|
|
19
|
+
* Build the backend's document object for an IR presentation.
|
|
20
|
+
*
|
|
21
|
+
* Exported for tests: asserting on this object is far cheaper, and far more
|
|
22
|
+
* legible, than unzipping a package.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildPresentationOptions(ir: PptxIR): Promise<Record<string, unknown>>;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGhF,eAAO,MAAM,4BAA4B,EAAE,cAA8B,CAAC;AA6E1E,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,YAAY,CAAC,CAqC1E;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAoDlC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PptxIR charts → PptxGenJS.
|
|
3
|
+
*
|
|
4
|
+
* Pure vocabulary translation. Every colour, font family, bold toggle and
|
|
5
|
+
* palette entry was resolved by the compiler, so nothing here consults a theme
|
|
6
|
+
* or decides a default.
|
|
7
|
+
*/
|
|
8
|
+
import type PptxGenJS from 'pptxgenjs';
|
|
9
|
+
import type { PptxIrChartElement } from '../../ir/types';
|
|
10
|
+
export declare function emitChart(slide: PptxGenJS.Slide, element: PptxIrChartElement): void;
|
|
11
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/chart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAEV,kBAAkB,EAInB,MAAM,gBAAgB,CAAC;AAKxB,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,kBAAkB,GAC1B,IAAI,CAeN"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PptxIR → PptxGenJS calls.
|
|
3
|
+
*
|
|
4
|
+
* Each function here maps one IR node onto the option bag PptxGenJS expects.
|
|
5
|
+
* They are deliberately small and free of policy: every cascade, default and
|
|
6
|
+
* unit conversion already happened in the compiler, so this layer only
|
|
7
|
+
* translates vocabulary.
|
|
8
|
+
*
|
|
9
|
+
* Unit note: the IR is in EMU, PptxGenJS takes inches. Dividing is exact
|
|
10
|
+
* against the compiler's `Math.round(inches * 914400)` because PptxGenJS
|
|
11
|
+
* applies the same rounding on the way in.
|
|
12
|
+
*/
|
|
13
|
+
import type PptxGenJS from 'pptxgenjs';
|
|
14
|
+
import type { PptxIrColor, PptxIrElement, PptxIrFill, PptxIrGeometry, PptxIrHyperlink, PptxIrImageElement, PptxIrLine, PptxIrResource, PptxIrShadow, PptxIrShapeElement, PptxIrTextBodyStyle, PptxIrTextBoxElement, PptxIrTextRun, PptxIrTransform } from '../../ir/types';
|
|
15
|
+
import type { PipelineWarning } from '../../types';
|
|
16
|
+
import type { PendingFillSink } from './fills';
|
|
17
|
+
type Opts = Record<string, unknown>;
|
|
18
|
+
/** Resources by id, so an element's `resourceId` can be turned into a source. */
|
|
19
|
+
export type ResourceLookup = ReadonlyMap<string, PptxIrResource>;
|
|
20
|
+
export interface EmitContext {
|
|
21
|
+
pptx: PptxGenJS;
|
|
22
|
+
resources: ResourceLookup;
|
|
23
|
+
/** Registry for fills PptxGenJS cannot express. Absent disables the splice. */
|
|
24
|
+
pendingFills?: PendingFillSink;
|
|
25
|
+
/** Sink for a shape this backend has no preset for. */
|
|
26
|
+
warnings?: PipelineWarning[];
|
|
27
|
+
}
|
|
28
|
+
export declare function transformOpts(transform: PptxIrTransform): Opts;
|
|
29
|
+
/** PptxGenJS wants bare hex; the IR already stores it that way. */
|
|
30
|
+
export declare function colorValue(color: PptxIrColor): string;
|
|
31
|
+
export declare function lineOpts(line: PptxIrLine): Opts;
|
|
32
|
+
export declare function shadowOpts(shadow: PptxIrShadow): Opts;
|
|
33
|
+
export declare function hyperlinkOpts(link: PptxIrHyperlink): Opts;
|
|
34
|
+
/**
|
|
35
|
+
* Apply a fill.
|
|
36
|
+
*
|
|
37
|
+
* Solid fills map directly. Gradients and patterns do not exist in the
|
|
38
|
+
* PptxGenJS API, so they are registered for the post-generation splice and a
|
|
39
|
+
* sentinel solid fill is written in their place — the workaround lives here,
|
|
40
|
+
* never in the IR.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyFill(opts: Opts, fill: PptxIrFill, elementPath: string, ctx: EmitContext): void;
|
|
43
|
+
export declare function textBodyOpts(style: PptxIrTextBodyStyle): Opts;
|
|
44
|
+
/** Run-level options. Every value is already resolved; nothing cascades here. */
|
|
45
|
+
export declare function runOpts(run: PptxIrTextRun): Opts;
|
|
46
|
+
export declare function emitTextBox(slide: PptxGenJS.Slide, element: PptxIrTextBoxElement, ctx: EmitContext): void;
|
|
47
|
+
/** Map an IR geometry name to a PptxGenJS `ShapeType` member. */
|
|
48
|
+
export declare function shapeType(geometry: PptxIrGeometry, pptx: PptxGenJS): unknown | undefined;
|
|
49
|
+
export declare function emitShape(slide: PptxGenJS.Slide, element: PptxIrShapeElement, ctx: EmitContext): void;
|
|
50
|
+
/**
|
|
51
|
+
* Turn a resource into the `path`/`data` pair PptxGenJS expects.
|
|
52
|
+
*
|
|
53
|
+
* Inline bytes become a data URI; file and remote origins keep their location
|
|
54
|
+
* so PptxGenJS streams them exactly as it did before the IR existed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function imageSourceOpts(resource: PptxIrResource): Opts;
|
|
57
|
+
export declare function emitImage(slide: PptxGenJS.Slide, element: PptxIrImageElement, ctx: EmitContext): void;
|
|
58
|
+
export declare function emitElement(slide: PptxGenJS.Slide, element: PptxIrElement, ctx: EmitContext): void;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,cAAc,CAAC;IAC1B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC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,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,WAAW,GACf,IAAI,CA0BN"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient and pattern fills for the PptxGenJS backend.
|
|
3
|
+
*
|
|
4
|
+
* PptxGenJS has no API for either. The workaround — render a sentinel
|
|
5
|
+
* `<a:solidFill>` on a uniquely-named shape, then splice the real fill element
|
|
6
|
+
* in while packaging — is a property of *this backend*, so it lives here and
|
|
7
|
+
* never in PptxIR or in generic PPTX types. PptxIR describes the gradient
|
|
8
|
+
* semantically; another adapter is free to emit it directly.
|
|
9
|
+
*
|
|
10
|
+
* Colours arriving here are already resolved to hex by the compiler, so
|
|
11
|
+
* building the XML is a pure string operation.
|
|
12
|
+
*/
|
|
13
|
+
import type { PptxIrColor, PptxIrFill, PptxIrGradient } from '../../ir/types';
|
|
14
|
+
/**
|
|
15
|
+
* A fill to splice into slide XML during packaging.
|
|
16
|
+
*
|
|
17
|
+
* The shape that registered it carries `cNvPr name="{objectName}"`.
|
|
18
|
+
*/
|
|
19
|
+
export interface PendingXmlFill {
|
|
20
|
+
objectName: string;
|
|
21
|
+
/** Complete replacement element, e.g. `<a:gradFill>…</a:gradFill>`. */
|
|
22
|
+
xml: string;
|
|
23
|
+
}
|
|
24
|
+
/** Collects pending fills for one render. Never module-global. */
|
|
25
|
+
export type PendingFillSink = PendingXmlFill[];
|
|
26
|
+
export declare function buildGradientFillXml(gradient: PptxIrGradient): string;
|
|
27
|
+
export declare function buildPatternFillXml(preset: string, foreground: PptxIrColor, background: PptxIrColor): string;
|
|
28
|
+
/**
|
|
29
|
+
* Write a sentinel solid fill and register the real fill for splicing.
|
|
30
|
+
*
|
|
31
|
+
* Without a sink — a caller rendering outside the buffer pipeline — the shape
|
|
32
|
+
* keeps the sentinel colour, so the deck still reads as authored instead of
|
|
33
|
+
* falling back to a PptxGenJS default.
|
|
34
|
+
*/
|
|
35
|
+
export declare function registerAdvancedFill(opts: Record<string, unknown>, fill: Extract<PptxIrFill, {
|
|
36
|
+
kind: 'gradient' | 'pattern';
|
|
37
|
+
}>, elementPath: string, sink: PendingFillSink | undefined): void;
|
|
38
|
+
//# sourceMappingURL=fills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fills.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/fills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAmBxB;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,kEAAkE;AAClE,MAAM,MAAM,eAAe,GAAG,cAAc,EAAE,CAAC;AA0B/C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAcrE;AAOD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,WAAW,GACtB,MAAM,CAOR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,GAAG,SAAS,CAAA;CAAE,CAAC,EAC3D,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,eAAe,GAAG,SAAS,GAChC,IAAI,CAgBN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PptxGenJS renderer.
|
|
3
|
+
*
|
|
4
|
+
* This is the only place in `core-pptx` production code allowed to import
|
|
5
|
+
* `pptxgenjs`. It consumes PptxIR and nothing else — no author JSON, no
|
|
6
|
+
* `ProcessedPresentation`, no theme lookups.
|
|
7
|
+
*/
|
|
8
|
+
import PptxGenJS from 'pptxgenjs';
|
|
9
|
+
import type { PptxIR } from '../../ir/types';
|
|
10
|
+
import type { PipelineWarning } from '../../types';
|
|
11
|
+
import type { PptxRenderer, PptxRendererId } from '../types';
|
|
12
|
+
import type { PendingFillSink } from './fills';
|
|
13
|
+
export declare const PPTXGENJS_RENDERER_ID: PptxRendererId;
|
|
14
|
+
export declare function createPptxGenJsRenderer(): PptxRenderer;
|
|
15
|
+
/**
|
|
16
|
+
* Build the PptxGenJS object graph for an IR document.
|
|
17
|
+
*
|
|
18
|
+
* Exported for tests: it is the interesting half of the adapter, and asserting
|
|
19
|
+
* on the object graph is far cheaper than unzipping a package.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildPresentation(ir: PptxIR, pendingFills?: PendingFillSink, warnings?: PipelineWarning[]): PptxGenJS;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,EACV,MAAM,EAKP,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,eAAO,MAAM,qBAAqB,EAAE,cAA4B,CAAC;AAqBjE,wBAAgB,uBAAuB,IAAI,YAAY,CAoBtD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,YAAY,CAAC,EAAE,eAAe,EAC9B,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,SAAS,CAoCX"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packaging for PptxGenJS output.
|
|
3
|
+
*
|
|
4
|
+
* Everything here exists because of what PptxGenJS emits, and would be wrong
|
|
5
|
+
* to apply to another backend's bytes:
|
|
6
|
+
*
|
|
7
|
+
* - **Gradient and pattern fills.** The library has no API for either, so the
|
|
8
|
+
* emitter registers the fill XML against a sentinel shape name and this pass
|
|
9
|
+
* splices it in, restoring a normal name on the way out.
|
|
10
|
+
* - **The table style GUID.** PptxGenJS hard-codes Medium Style 2 Accent 1 on
|
|
11
|
+
* every table, which paints banding and accent borders the author never
|
|
12
|
+
* asked for. Swapping it for No Style No Grid leaves the explicit borders
|
|
13
|
+
* the emitter already wrote.
|
|
14
|
+
* - **SVG previews.** The library builds them with a browser canvas, so under
|
|
15
|
+
* Node it writes a broken-image placeholder — see `svgRasterFallback.ts`.
|
|
16
|
+
*
|
|
17
|
+
* Deterministic timestamps, canonical chart ids and the zip encoding are not
|
|
18
|
+
* repairs; they are properties of an OOXML package. Those live in
|
|
19
|
+
* `core/finalizePackage.ts` and run on the same open zip, so the package is
|
|
20
|
+
* still read once and written once — which is what the byte-stable corpus was
|
|
21
|
+
* recorded against.
|
|
22
|
+
*/
|
|
23
|
+
/// <reference types="node" />
|
|
24
|
+
import type { PendingXmlFill, PipelineWarning } from '../../types';
|
|
25
|
+
export interface PptxGenJsPackagingOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Gradient/pattern fills registered during rendering. Each entry names a
|
|
28
|
+
* shape (via its sentinel `cNvPr name`) whose `<a:solidFill>` is swapped for
|
|
29
|
+
* the registered fill XML.
|
|
30
|
+
*/
|
|
31
|
+
pendingFills?: readonly PendingXmlFill[];
|
|
32
|
+
/** Normalize metadata and ZIP timestamps. Defaults to true. */
|
|
33
|
+
deterministic?: boolean;
|
|
34
|
+
/** Clock used when deterministic packaging is enabled. */
|
|
35
|
+
generatedAt?: Date | string;
|
|
36
|
+
/**
|
|
37
|
+
* Sink for repairs that need to report, e.g. an SVG that cannot rasterize.
|
|
38
|
+
* When omitted their failures go to `console.warn`.
|
|
39
|
+
*/
|
|
40
|
+
warnings?: PipelineWarning[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Apply the backend repairs, then hand the same zip to generic finalization.
|
|
44
|
+
*
|
|
45
|
+
* Returns the input buffer untouched when nothing needed doing, which only
|
|
46
|
+
* happens with `deterministic: false` — PptxGenJS stamps both `core.xml` and
|
|
47
|
+
* its ZIP entries with the wall clock, so a deterministic build always
|
|
48
|
+
* rewrites something.
|
|
49
|
+
*/
|
|
50
|
+
export declare function packagePptxGenJsBuffer(buffer: Buffer, options?: PptxGenJsPackagingOptions): Promise<Buffer>;
|
|
51
|
+
//# sourceMappingURL=packaging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packaging.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/packaging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AASH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQnE,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACzC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AA4CD;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,MAAM,CAAC,CAmCjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type JSZip from 'jszip';
|
|
2
|
-
import type { PipelineWarning } from '
|
|
2
|
+
import type { PipelineWarning } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Replace the broken-image placeholders PptxGenJS writes for inline SVG
|
|
5
5
|
* pictures with real rasterizations of those SVGs. Never throws: a missing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgRasterFallback.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/svgRasterFallback.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAyInD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,KAAK,EACV,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,OAAO,CAAC,OAAO,CAAC,CAkElB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PptxIR tables → PptxGenJS.
|
|
3
|
+
*
|
|
4
|
+
* Two things live here that are properties of *this backend* rather than of a
|
|
5
|
+
* table:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Units.** PptxGenJS's table path uses a different inch/EMU threshold from
|
|
8
|
+
* the rest of its API (20 instead of 100) and does not run x/y/h through its
|
|
9
|
+
* normal parser. Passing EMU directly sidesteps both: any real value is
|
|
10
|
+
* above the threshold, so PptxGenJS uses it verbatim.
|
|
11
|
+
* 2. **Rounded corners.** OOXML tables have no corner radius, and PptxGenJS
|
|
12
|
+
* exposes none. The IR asks for one semantically; this module realises it by
|
|
13
|
+
* drawing rounded rectangles behind the table and making the corner cells
|
|
14
|
+
* transparent so they show through. That technique is not in the IR.
|
|
15
|
+
*/
|
|
16
|
+
import type PptxGenJS from 'pptxgenjs';
|
|
17
|
+
import type { PptxIrTableElement } from '../../ir/types';
|
|
18
|
+
export declare function emitTable(slide: PptxGenJS.Slide, element: PptxIrTableElement, pptx: PptxGenJS): void;
|
|
19
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/renderers/pptxgenjs/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAGV,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AAQxB,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,SAAS,GACd,IAAI,CAqBN"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PPTX renderer registry.
|
|
3
|
+
*
|
|
4
|
+
* Adapters are registered as async factories so an optional backend is only
|
|
5
|
+
* imported when it is actually selected — choosing `pptxgenjs` never loads
|
|
6
|
+
* `@office-open/pptx`, and a missing optional dependency surfaces as an
|
|
7
|
+
* actionable install hint rather than a bare module-resolution failure.
|
|
8
|
+
*/
|
|
9
|
+
import { type PptxRenderer, type PptxRendererId } from './types';
|
|
10
|
+
/** Resolve a renderer by id, defaulting to `pptxgenjs`. */
|
|
11
|
+
export declare function resolvePptxRenderer(id?: PptxRendererId): Promise<PptxRenderer>;
|
|
12
|
+
/** Renderer ids registered for PPTX. */
|
|
13
|
+
export declare function pptxRendererIds(): readonly PptxRendererId[];
|
|
14
|
+
export declare function isPptxRendererId(value: string): value is PptxRendererId;
|
|
15
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/renderers/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAiBjB,2DAA2D;AAC3D,wBAAgB,mBAAmB,CACjC,EAAE,CAAC,EAAE,cAAc,GAClB,OAAO,CAAC,YAAY,CAAC,CAEvB;AAED,wCAAwC;AACxC,wBAAgB,eAAe,IAAI,SAAS,cAAc,EAAE,CAE3D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PPTX renderer contracts.
|
|
3
|
+
*
|
|
4
|
+
* Format-specific bindings of the shared `OfficeRenderer` contract. Nothing in
|
|
5
|
+
* this file imports a backend; the adapters under `pptxgenjs/` and
|
|
6
|
+
* `office-open/` do, and they are the only places allowed to.
|
|
7
|
+
*/
|
|
8
|
+
import type { OfficeRenderer, RenderOptions } from '@json-to-office/shared/rendering';
|
|
9
|
+
import type { PptxFeature } from '../ir/features';
|
|
10
|
+
import type { PptxIR } from '../ir/types';
|
|
11
|
+
import type { PipelineWarning } from '../types';
|
|
12
|
+
import { DEFAULT_PPTX_RENDERER_ID, type PptxRendererId } from '@json-to-office/shared-pptx';
|
|
13
|
+
/**
|
|
14
|
+
* Renderer ids available for PPTX.
|
|
15
|
+
*
|
|
16
|
+
* `pptxgenjs` is the default and must keep producing today's output.
|
|
17
|
+
* `office-open` is experimental and opt-in.
|
|
18
|
+
*/
|
|
19
|
+
export { DEFAULT_PPTX_RENDERER_ID };
|
|
20
|
+
export type { PptxRendererId };
|
|
21
|
+
/**
|
|
22
|
+
* Render options for PPTX.
|
|
23
|
+
*
|
|
24
|
+
* Adds a warning sink to the shared contract. Post-render repairs — the SVG
|
|
25
|
+
* preview fix, for one — can find problems that the author should hear about,
|
|
26
|
+
* and those have to reach the same structured warning list the rest of the
|
|
27
|
+
* pipeline uses rather than `console.warn`.
|
|
28
|
+
*/
|
|
29
|
+
export interface PptxRenderOptions extends RenderOptions {
|
|
30
|
+
warnings?: PipelineWarning[];
|
|
31
|
+
}
|
|
32
|
+
export interface PptxRenderer extends OfficeRenderer<PptxIR, PptxFeature, PptxRendererId> {
|
|
33
|
+
render(document: PptxIR, options?: PptxRenderOptions): Promise<Uint8Array>;
|
|
34
|
+
}
|
|
35
|
+
export type { RenderOptions };
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/renderers/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAErC;;;;;GAKG;AACH,OAAO,EAAE,wBAAwB,EAAE,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,YACf,SAAQ,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC5E;AAED,YAAY,EAAE,aAAa,EAAE,CAAC"}
|