@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.
Files changed (88) hide show
  1. package/dist/core/expandHighcharts.d.ts +35 -0
  2. package/dist/core/expandHighcharts.d.ts.map +1 -0
  3. package/dist/core/finalizePackage.d.ts +39 -0
  4. package/dist/core/finalizePackage.d.ts.map +1 -0
  5. package/dist/core/generateFromIr.d.ts +71 -0
  6. package/dist/core/generateFromIr.d.ts.map +1 -0
  7. package/dist/core/generationContext.d.ts +2 -10
  8. package/dist/core/generationContext.d.ts.map +1 -1
  9. package/dist/core/generationOptions.d.ts +73 -0
  10. package/dist/core/generationOptions.d.ts.map +1 -0
  11. package/dist/core/generator.d.ts +18 -78
  12. package/dist/core/generator.d.ts.map +1 -1
  13. package/dist/core/resolveImageLayout.d.ts +23 -0
  14. package/dist/core/resolveImageLayout.d.ts.map +1 -0
  15. package/dist/core/structure.d.ts.map +1 -1
  16. package/dist/index.d.ts +8 -5
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4299 -2208
  19. package/dist/index.js.map +1 -1
  20. package/dist/ir/compiler.d.ts +41 -0
  21. package/dist/ir/compiler.d.ts.map +1 -0
  22. package/dist/ir/debug.d.ts +18 -0
  23. package/dist/ir/debug.d.ts.map +1 -0
  24. package/dist/ir/features.d.ts +18 -0
  25. package/dist/ir/features.d.ts.map +1 -0
  26. package/dist/ir/index.d.ts +19 -0
  27. package/dist/ir/index.d.ts.map +1 -0
  28. package/dist/ir/resources.d.ts +55 -0
  29. package/dist/ir/resources.d.ts.map +1 -0
  30. package/dist/ir/types.d.ts +623 -0
  31. package/dist/ir/types.d.ts.map +1 -0
  32. package/dist/ir/units.d.ts +66 -0
  33. package/dist/ir/units.d.ts.map +1 -0
  34. package/dist/ir/validation.d.ts +19 -0
  35. package/dist/ir/validation.d.ts.map +1 -0
  36. package/dist/plugin/createPresentationGenerator.d.ts +7 -1
  37. package/dist/plugin/createPresentationGenerator.d.ts.map +1 -1
  38. package/dist/plugin/types.d.ts +7 -1
  39. package/dist/plugin/types.d.ts.map +1 -1
  40. package/dist/renderers/office-open/emit.d.ts +42 -0
  41. package/dist/renderers/office-open/emit.d.ts.map +1 -0
  42. package/dist/renderers/office-open/index.d.ts +25 -0
  43. package/dist/renderers/office-open/index.d.ts.map +1 -0
  44. package/dist/renderers/pptxgenjs/chart.d.ts +11 -0
  45. package/dist/renderers/pptxgenjs/chart.d.ts.map +1 -0
  46. package/dist/renderers/pptxgenjs/emit.d.ts +60 -0
  47. package/dist/renderers/pptxgenjs/emit.d.ts.map +1 -0
  48. package/dist/renderers/pptxgenjs/fills.d.ts +38 -0
  49. package/dist/renderers/pptxgenjs/fills.d.ts.map +1 -0
  50. package/dist/renderers/pptxgenjs/index.d.ts +22 -0
  51. package/dist/renderers/pptxgenjs/index.d.ts.map +1 -0
  52. package/dist/renderers/pptxgenjs/packaging.d.ts +51 -0
  53. package/dist/renderers/pptxgenjs/packaging.d.ts.map +1 -0
  54. package/dist/{core → renderers/pptxgenjs}/svgRasterFallback.d.ts +1 -1
  55. package/dist/renderers/pptxgenjs/svgRasterFallback.d.ts.map +1 -0
  56. package/dist/renderers/pptxgenjs/table.d.ts +19 -0
  57. package/dist/renderers/pptxgenjs/table.d.ts.map +1 -0
  58. package/dist/renderers/registry.d.ts +15 -0
  59. package/dist/renderers/registry.d.ts.map +1 -0
  60. package/dist/renderers/types.d.ts +36 -0
  61. package/dist/renderers/types.d.ts.map +1 -0
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/dist/types.d.ts +23 -3
  64. package/dist/types.d.ts.map +1 -1
  65. package/package.json +13 -3
  66. package/dist/components/chart.d.ts +0 -89
  67. package/dist/components/chart.d.ts.map +0 -1
  68. package/dist/components/highcharts.d.ts +0 -9
  69. package/dist/components/highcharts.d.ts.map +0 -1
  70. package/dist/components/image.d.ts +0 -35
  71. package/dist/components/image.d.ts.map +0 -1
  72. package/dist/components/index.d.ts +0 -13
  73. package/dist/components/index.d.ts.map +0 -1
  74. package/dist/components/shape.d.ts +0 -61
  75. package/dist/components/shape.d.ts.map +0 -1
  76. package/dist/components/table.d.ts +0 -48
  77. package/dist/components/table.d.ts.map +0 -1
  78. package/dist/components/text.d.ts +0 -76
  79. package/dist/components/text.d.ts.map +0 -1
  80. package/dist/core/packagePresentation.d.ts +0 -29
  81. package/dist/core/packagePresentation.d.ts.map +0 -1
  82. package/dist/core/render.d.ts +0 -8
  83. package/dist/core/render.d.ts.map +0 -1
  84. package/dist/core/svgRasterFallback.d.ts.map +0 -1
  85. package/dist/core/template.d.ts +0 -10
  86. package/dist/core/template.d.ts.map +0 -1
  87. package/dist/utils/fillXml.d.ts +0 -19
  88. package/dist/utils/fillXml.d.ts.map +0 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Compile a processed presentation into PptxIR.
3
+ *
4
+ * The input is `ProcessedPresentation` — the authoring tree after schema
5
+ * validation, custom-component expansion, theme resolution and component
6
+ * defaults. What remains, and what this module does, is the last mile of
7
+ * resolution: grid cells become EMU transforms, placeholder content is merged
8
+ * with its declaration, theme colour tokens become hex, the font cascade is
9
+ * flattened onto every run, and page-number placeholders are substituted.
10
+ *
11
+ * No renderer is imported here, and none may be. The output is plain data.
12
+ *
13
+ * Scope: this is the Phase 2 vertical slice — metadata, slide size, slides,
14
+ * solid backgrounds, text bodies (single and rich-run), images and preset
15
+ * shapes. Component kinds outside that slice are reported through
16
+ * `unsupported`, so a caller can tell "not yet compiled" from "compiled to
17
+ * nothing".
18
+ */
19
+ import { type FeatureRequirement } from '@json-to-office/shared/rendering';
20
+ import type { PipelineWarning, ProcessedPresentation } from '../types';
21
+ import type { PptxFeature } from './features';
22
+ import { type PptxIR } from './types';
23
+ /** A component kind the compiler does not yet lower into IR. */
24
+ export interface UnsupportedComponent {
25
+ name: string;
26
+ path: string;
27
+ }
28
+ export interface PptxCompileResult {
29
+ ir: PptxIR;
30
+ /** Backend capabilities the IR needs, with the IR path that needs them. */
31
+ required: readonly FeatureRequirement<PptxFeature>[];
32
+ warnings: PipelineWarning[];
33
+ /**
34
+ * Components the compiler could not lower. Empty once the migration is
35
+ * complete; until then this is what keeps the legacy path authoritative
36
+ * instead of silently dropping content.
37
+ */
38
+ unsupported: UnsupportedComponent[];
39
+ }
40
+ export declare function compilePresentation(processed: ProcessedPresentation, warnings?: PipelineWarning[]): PptxCompileResult;
41
+ //# sourceMappingURL=compiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/ir/compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAEV,eAAe,EAGf,qBAAqB,EAKtB,MAAM,UAAU,CAAC;AAalB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM9C,OAAO,EAGL,KAAK,MAAM,EA+BZ,MAAM,SAAS,CAAC;AAWjB,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,QAAQ,EAAE,SAAS,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;IACrD,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAeD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,qBAAqB,EAChC,QAAQ,GAAE,eAAe,EAAO,GAC/B,iBAAiB,CAmDnB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Stable debug snapshots of PptxIR.
3
+ *
4
+ * A snapshot is the IR with every binary resource replaced by its content hash
5
+ * and byte length, and object keys emitted in a fixed order. That makes it
6
+ * diffable in a test and readable in a bug report, without base64-inflating
7
+ * megabytes of image data into the snapshot file.
8
+ *
9
+ * The transform is lossless for everything a reviewer cares about and lossy
10
+ * only for bytes, which are identified by hash instead.
11
+ */
12
+ import type { PptxIR } from './types';
13
+ /** A JSON-safe view of the IR, suitable for `toMatchSnapshot`. */
14
+ export type PptxIrSnapshot = Record<string, unknown>;
15
+ export declare function snapshotPptxIr(ir: PptxIR): PptxIrSnapshot;
16
+ /** Render a snapshot as stable, pretty-printed JSON. */
17
+ export declare function formatPptxIr(ir: PptxIR): string;
18
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/ir/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,SAAS,CAAC;AAEtD,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAKzD;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * PPTX renderer features.
3
+ *
4
+ * A feature is a capability a *backend* must have, not an authoring concept.
5
+ * The compiler records one requirement per IR node that needs one; a renderer
6
+ * declares the set it can satisfy. Anything required but not declared fails
7
+ * before rendering, with the IR path attached.
8
+ *
9
+ * Names are chosen so the boundary is real: `gradient-fills` is separate from
10
+ * `pattern-fills` because a backend can plausibly have one and not the other,
11
+ * while `rich-text` covers multi-run bodies as a single indivisible ability.
12
+ */
13
+ export declare const PPTX_FEATURES: readonly ["masters", "placeholders", "rich-text", "complex-bullet-glyphs", "text", "shapes", "images", "svg", "image-crop", "image-rounding", "tables", "table-merged-cells", "table-insets", "table-rounded-corners", "table-auto-page", "charts", "solid-fills", "gradient-fills", "pattern-fills", "image-fills", "lines", "shadows", "backgrounds", "speaker-notes", "hidden-slides", "transitions", "external-links", "internal-links", "text-hyperlinks", "element-hyperlinks", "rotation", "image-transform", "flip-horizontal", "flip-vertical", "groups", "proofing-language", "rtl"];
14
+ export type PptxFeature = (typeof PPTX_FEATURES)[number];
15
+ /** Every feature, for an adapter that claims the full surface. */
16
+ export declare const ALL_PPTX_FEATURES: ReadonlySet<PptxFeature>;
17
+ export declare function isPptxFeature(value: string): value is PptxFeature;
18
+ //# sourceMappingURL=features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/ir/features.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,aAAa,gkBAgGhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,WAAW,CAEtD,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAEjE"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * PptxIR — internal to `@json-to-office/core-pptx` for this release.
3
+ *
4
+ * Deliberately not re-exported from `packages/core-pptx/src/index.ts`: the IR
5
+ * shape is expected to move while the DOCX side of the migration lands, and
6
+ * publishing it now would freeze it. See
7
+ * `docs/architecture/office-renderer-ir.md`.
8
+ */
9
+ export * from './types';
10
+ export * from './features';
11
+ export * from './units';
12
+ export * from './resources';
13
+ export { compilePresentation } from './compiler';
14
+ export type { PptxCompileResult, UnsupportedComponent } from './compiler';
15
+ export { assertValidPptxIr, validatePptxIr } from './validation';
16
+ export type { IrViolation } from './validation';
17
+ export { formatPptxIr, snapshotPptxIr } from './debug';
18
+ export type { PptxIrSnapshot } from './debug';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ir/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Resource table used while compiling a presentation to PptxIR.
3
+ *
4
+ * One table per compilation — never module-global — so concurrent generations
5
+ * cannot share ids or entries.
6
+ *
7
+ * Identity depends on where the bytes come from. Inline sources (authored
8
+ * base64, raw SVG) are decoded once and keyed by content hash, so the same
9
+ * image authored twice becomes one resource. File and remote sources keep
10
+ * their location and are keyed by it, because reading every file at compile
11
+ * time would change when I/O happens and how much of a large deck is resident
12
+ * in memory.
13
+ */
14
+ import type { PptxIrPixelSize, PptxIrResource } from './types';
15
+ export interface InlineResourceInput {
16
+ kind: 'inline';
17
+ bytes: Uint8Array;
18
+ mediaType?: string;
19
+ }
20
+ export interface FileResourceInput {
21
+ kind: 'file';
22
+ path: string;
23
+ mediaType?: string;
24
+ }
25
+ export interface RemoteResourceInput {
26
+ kind: 'remote';
27
+ url: string;
28
+ mediaType?: string;
29
+ }
30
+ export type ResourceInput = InlineResourceInput | FileResourceInput | RemoteResourceInput;
31
+ export declare class ResourceTable {
32
+ private readonly byKey;
33
+ private readonly order;
34
+ /**
35
+ * Add a resource (or return the existing one with matching identity) and
36
+ * return its id.
37
+ */
38
+ intern(input: ResourceInput, intrinsic?: PptxIrPixelSize): string;
39
+ /** Every resource, in first-use order. */
40
+ list(): PptxIrResource[];
41
+ get(id: string): PptxIrResource | undefined;
42
+ }
43
+ /**
44
+ * Split a `data:` URI into its media type and decoded bytes.
45
+ *
46
+ * Returns `undefined` for anything that is not a base64 data URI, so callers
47
+ * can fall back to treating the string as a location.
48
+ */
49
+ export declare function parseDataUri(source: string): {
50
+ mediaType: string;
51
+ bytes: Uint8Array;
52
+ } | undefined;
53
+ /** Guess a media type from a file extension or URL path. */
54
+ export declare function mediaTypeFromLocation(location: string): string | undefined;
55
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/ir/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEf,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GACrB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,CAAC;AAExB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAE9C;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,MAAM;IAsBjE,0CAA0C;IAC1C,IAAI,IAAI,cAAc,EAAE;IAIxB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;CAG5C;AA6BD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,GACb;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG,SAAS,CAStD;AAED,4DAA4D;AAC5D,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAyB1E"}