@json-to-office/core-docx 1.0.0 → 1.3.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/components/visual.d.ts +6 -6
- package/dist/components/visual.d.ts.map +1 -1
- package/dist/core/desugarExternals.d.ts.map +1 -1
- package/dist/core/flattenVisuals.d.ts.map +1 -1
- package/dist/core/imageResources.d.ts.map +1 -1
- package/dist/core/prerasterizeVisuals.d.ts +10 -4
- package/dist/core/prerasterizeVisuals.d.ts.map +1 -1
- package/dist/index.js +1222 -98
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts.map +1 -1
- package/dist/ir/features.d.ts +1 -1
- package/dist/ir/features.d.ts.map +1 -1
- package/dist/ir/nativeVisual.d.ts +79 -0
- package/dist/ir/nativeVisual.d.ts.map +1 -0
- package/dist/ir/types.d.ts +155 -1
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/units.d.ts +12 -0
- package/dist/ir/units.d.ts.map +1 -1
- package/dist/ir/validation.d.ts.map +1 -1
- package/dist/plugin/example/index.js +1215 -96
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/renderers/docxjs/emit.d.ts.map +1 -1
- package/dist/renderers/docxjs/index.d.ts.map +1 -1
- package/dist/renderers/office-open/chartParts.d.ts +28 -0
- package/dist/renderers/office-open/chartParts.d.ts.map +1 -0
- package/dist/renderers/office-open/emit.d.ts +47 -6
- package/dist/renderers/office-open/emit.d.ts.map +1 -1
- package/dist/renderers/office-open/index.d.ts +2 -2
- package/dist/renderers/office-open/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/chartWorkbook.d.ts +19 -0
- package/dist/utils/chartWorkbook.d.ts.map +1 -0
- package/dist/utils/packageDocument.d.ts +2 -0
- package/dist/utils/packageDocument.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* lives here is the presentation that gets sent, the identity that keys the
|
|
9
9
|
* batch, and the image props the result desugars to.
|
|
10
10
|
*/
|
|
11
|
-
import type {
|
|
11
|
+
import type { VisualRasterProps } from '@json-to-office/shared-docx';
|
|
12
12
|
import type { PptxServiceConfig, PptxRasterizeResult, RasterizeFontFace } from '@json-to-office/shared';
|
|
13
13
|
export declare const DEFAULT_RASTERIZE_SERVER_URL = "http://localhost:7802";
|
|
14
14
|
/**
|
|
@@ -16,7 +16,7 @@ export declare const DEFAULT_RASTERIZE_SERVER_URL = "http://localhost:7802";
|
|
|
16
16
|
* The shape mirrors a normal `.pptx.json` document so the pptx engine renders
|
|
17
17
|
* it unchanged. Exported for reuse by the `flattenVisuals` transform.
|
|
18
18
|
*/
|
|
19
|
-
export declare function buildVisualPresentation(props:
|
|
19
|
+
export declare function buildVisualPresentation(props: VisualRasterProps): Record<string, unknown>;
|
|
20
20
|
/**
|
|
21
21
|
* Where an image sits on the page, and how big it is.
|
|
22
22
|
*
|
|
@@ -70,19 +70,19 @@ export interface ImageOptions {
|
|
|
70
70
|
* Default rendered width (px) for a visual: its physical canvas inches, so a
|
|
71
71
|
* 6×4 canvas prints 6×4 unless `width` overrides.
|
|
72
72
|
*/
|
|
73
|
-
export declare function defaultVisualWidthPx(props:
|
|
73
|
+
export declare function defaultVisualWidthPx(props: VisualRasterProps): number;
|
|
74
74
|
/**
|
|
75
75
|
* Shared image-placement options derived from a visual's props. Used by BOTH
|
|
76
76
|
* desugaring paths — the generation pre-pass and the offline flatten transform
|
|
77
77
|
* — so the two cannot drift: width default, alignment default, caption,
|
|
78
78
|
* spacing, floating and the keep flags all live here once.
|
|
79
79
|
*/
|
|
80
|
-
export declare function visualToImageOptions(props:
|
|
80
|
+
export declare function visualToImageOptions(props: VisualRasterProps): ImageOptions;
|
|
81
81
|
/**
|
|
82
82
|
* Map visual props to the `image` props they desugar to (used by the
|
|
83
83
|
* `flattenVisuals` transform to produce a portable, service-free document).
|
|
84
84
|
*/
|
|
85
|
-
export declare function visualToImageProps(props:
|
|
85
|
+
export declare function visualToImageProps(props: VisualRasterProps, base64DataUri: string): Record<string, unknown>;
|
|
86
86
|
/**
|
|
87
87
|
* Identity of one visual rasterization: content + resolution + (for HTTP
|
|
88
88
|
* services) the target server. Keys the per-document pre-rasterization map
|
|
@@ -107,7 +107,7 @@ export declare function visualRasterKey(presentation: unknown, dpi: number, serv
|
|
|
107
107
|
* actually do or the same visual could rasterize against two different
|
|
108
108
|
* services depending on cache luck.
|
|
109
109
|
*/
|
|
110
|
-
export declare function effectiveVisualServerUrl(props:
|
|
110
|
+
export declare function effectiveVisualServerUrl(props: VisualRasterProps, serviceConfig: PptxServiceConfig | undefined): string | undefined;
|
|
111
111
|
/**
|
|
112
112
|
* Rasterize a single-slide presentation to a PNG via the configured service.
|
|
113
113
|
* An in-process `render` callback takes precedence over an HTTP `serverUrl`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../src/components/visual.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../src/components/visual.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAIpE;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;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EAAE,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAuD9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desugarExternals.d.ts","sourceRoot":"","sources":["../../src/core/desugarExternals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"desugarExternals.d.ts","sourceRoot":"","sources":["../../src/core/desugarExternals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAY7C,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,CAAC,CAAC,CA4CZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flattenVisuals.d.ts","sourceRoot":"","sources":["../../src/core/flattenVisuals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"flattenVisuals.d.ts","sourceRoot":"","sources":["../../src/core/flattenVisuals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAiBhC,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,SAAS,EAAE,cAAc,CAAC;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACtC;AAUD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,OAAO,EAC9C,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,CAAC,CAAC,CAyDZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageResources.d.ts","sourceRoot":"","sources":["../../src/core/imageResources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;
|
|
1
|
+
{"version":3,"file":"imageResources.d.ts","sourceRoot":"","sources":["../../src/core/imageResources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAOpD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE9D,yEAAyE;AACzE,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,QAAQ,CAAC,mBAAmB,GAAG,SAAS,CAAC,GACpD,OAAO,CAAC,cAAc,CAAC,CAyBzB"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* the sequential status quo, never to a broken render.
|
|
17
17
|
*/
|
|
18
18
|
import { type PptxServiceConfig, type PptxRasterizeBatchSlideResult, type RasterizeFontFace } from '@json-to-office/shared';
|
|
19
|
-
import type
|
|
19
|
+
import { type VisualRasterProps } from '@json-to-office/shared-docx';
|
|
20
20
|
export interface PrerasterizeOptions {
|
|
21
21
|
/** Directory relative asset paths resolve against (#142). */
|
|
22
22
|
baseDir?: string;
|
|
@@ -46,16 +46,22 @@ export interface VisualPrepassStats {
|
|
|
46
46
|
export declare function getVisualPrepassStats(): VisualPrepassStats;
|
|
47
47
|
export declare function resetVisualPrepassStats(): void;
|
|
48
48
|
/**
|
|
49
|
-
* Collect the props of every enabled `visual` component reachable
|
|
50
|
-
* `root`. The walk is generic — every array element and object value is
|
|
49
|
+
* Collect the props of every enabled *raster* `visual` component reachable
|
|
50
|
+
* from `root`. The walk is generic — every array element and object value is
|
|
51
51
|
* visited — so visuals nested anywhere (columns, table cells, section
|
|
52
52
|
* headers/footers, plugin containers) are found without enumerating
|
|
53
53
|
* container shapes. Disabled component subtrees are pruned: they never
|
|
54
54
|
* render, so rasterizing them is wasted work. Over-collection is harmless
|
|
55
55
|
* (an unused map entry); under-collection is harmless (render-time
|
|
56
56
|
* fallback) — which is what makes the generic walk safe.
|
|
57
|
+
*
|
|
58
|
+
* `renderMode: "native"` visuals are excluded, not merely skipped later: they
|
|
59
|
+
* are drawn as a Word drawing group by the backend, so a native-only document
|
|
60
|
+
* must reach no rasterizer, stage no fonts and move no pre-pass counter. This
|
|
61
|
+
* function is also the `hasVisual` predicate the font stager consults, which
|
|
62
|
+
* is why the exclusion belongs here rather than at each call site.
|
|
57
63
|
*/
|
|
58
|
-
export declare function collectVisualProps(root: unknown):
|
|
64
|
+
export declare function collectVisualProps(root: unknown): VisualRasterProps[];
|
|
59
65
|
/**
|
|
60
66
|
* Batch-rasterize a document's visuals ahead of rendering. Returns a map of
|
|
61
67
|
* `visualRasterKey` → per-visual result (pixels or a recorded error). Never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerasterizeVisuals.d.ts","sourceRoot":"","sources":["../../src/core/prerasterizeVisuals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"prerasterizeVisuals.d.ts","sourceRoot":"","sources":["../../src/core/prerasterizeVisuals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAkBrC,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACtC;AAED,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CAChB;AAQD;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAI9C;AAkBD;;;;;;;;;;;;;;;GAeG;AACH,w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