@json-to-office/core-docx 0.30.0 → 0.32.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/toc/index.d.ts.map +1 -1
- package/dist/core/cached-render.d.ts +40 -2
- package/dist/core/cached-render.d.ts.map +1 -1
- package/dist/core/layout.d.ts +0 -2
- package/dist/core/layout.d.ts.map +1 -1
- package/dist/core/prerasterizeVisuals.d.ts +16 -0
- package/dist/core/prerasterizeVisuals.d.ts.map +1 -1
- package/dist/core/render.d.ts.map +1 -1
- package/dist/core/structure.d.ts +0 -2
- package/dist/core/structure.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -68
- package/dist/index.js.map +1 -1
- package/dist/plugin/example/index.js +115 -74
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/example/nested-section.component.d.ts.map +1 -1
- package/dist/plugin/example/plugin-demo.json +56 -4
- package/dist/templates/documents/proposal.docx.json +829 -246
- package/dist/templates/documents/technical-guide.docx.json +23 -8
- package/dist/templates/themes/index.d.ts +12 -8
- package/dist/templates/themes/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,eAAe,EAIhB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC;CACjB;AAyCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,sBAAsB,EACjC,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,CAAC,SAAS,GAAG,eAAe,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,eAAe,EAIhB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC;CACjB;AAyCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,sBAAsB,EACjC,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,CAAC,SAAS,GAAG,eAAe,CAAC,EAAE,CAgNjC"}
|
|
@@ -6,6 +6,28 @@ import { Paragraph, Table, TableOfContents, Textbox } from 'docx';
|
|
|
6
6
|
import { ComponentDefinition, RenderContext } from '../types';
|
|
7
7
|
import { ThemeConfig } from '../styles';
|
|
8
8
|
import { MemoryCache } from '../cache';
|
|
9
|
+
/** Why a component type is never cached (see renderComponentWithCache). */
|
|
10
|
+
export type ComponentBypassReason = 'dynamic-context' | 'bookmark-id' | 'revision-ids';
|
|
11
|
+
export interface ComponentBypassStats {
|
|
12
|
+
/** Component type name. */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Renders that skipped the cache by design. */
|
|
15
|
+
renders: number;
|
|
16
|
+
/** The (first observed) reason this type bypasses the cache. */
|
|
17
|
+
reason: ComponentBypassReason;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get per-type "uncached by design" render counters.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getComponentBypassStats(): ComponentBypassStats[];
|
|
23
|
+
/**
|
|
24
|
+
* True when the serialized props/children reference a registered placeholder
|
|
25
|
+
* whose output can vary with the generation date. Components without one
|
|
26
|
+
* render identically across dates, so their cache keys must not embed the
|
|
27
|
+
* per-render timestamp — that's what made cross-render hits impossible for
|
|
28
|
+
* date-less documents (#156).
|
|
29
|
+
*/
|
|
30
|
+
export declare function usesDateSensitivePlaceholder(serialized: string): boolean;
|
|
9
31
|
/**
|
|
10
32
|
* Initialize the component cache
|
|
11
33
|
*/
|
|
@@ -32,9 +54,25 @@ export declare function warmComponentCache(components: Array<{
|
|
|
32
54
|
context: RenderContext;
|
|
33
55
|
}>): Promise<void>;
|
|
34
56
|
/**
|
|
35
|
-
* Get component cache statistics
|
|
57
|
+
* Get component cache statistics, extended with per-type "uncached by
|
|
58
|
+
* design" render counters (#156). The bypass counters exist even before the
|
|
59
|
+
* cache is initialized — a document full of bypassed types never triggers
|
|
60
|
+
* initialization, yet its renders are exactly what needs surfacing.
|
|
36
61
|
*/
|
|
37
|
-
export declare function getComponentCacheStats():
|
|
62
|
+
export declare function getComponentCacheStats(): {
|
|
63
|
+
bypassedComponents: ComponentBypassStats[];
|
|
64
|
+
} | {
|
|
65
|
+
bypassedComponents: ComponentBypassStats[];
|
|
66
|
+
entries: number;
|
|
67
|
+
totalSize: number;
|
|
68
|
+
hitRate: number;
|
|
69
|
+
missRate: number;
|
|
70
|
+
totalHits: number;
|
|
71
|
+
totalMisses: number;
|
|
72
|
+
avgResponseTime: number;
|
|
73
|
+
evictions: number;
|
|
74
|
+
componentStats: Map<string, import("@json-to-office/shared/cache").ComponentStatistics>;
|
|
75
|
+
} | null;
|
|
38
76
|
/**
|
|
39
77
|
* Export component cache for persistence
|
|
40
78
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cached-render.d.ts","sourceRoot":"","sources":["../../src/core/cached-render.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,WAAW,EAIZ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"cached-render.d.ts","sourceRoot":"","sources":["../../src/core/cached-render.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,WAAW,EAIZ,MAAM,UAAU,CAAC;AAWlB,2EAA2E;AAC3E,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,aAAa,GACb,cAAc,CAAC;AAEnB,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAwBD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,oBAAoB,EAAE,CAMhE;AAUD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CASxE;AAYD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CA4BlE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,GAAG,IAAI,CAEtD;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKzD;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,EACtB,WAAW,UAAQ,GAClB,OAAO,CAAC,CAAC,SAAS,GAAG,KAAK,GAAG,eAAe,GAAG,OAAO,CAAC,EAAE,CAAC,CAuH5D;AAKD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,KAAK,CAAC;IAChB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC,GACD,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB;;;;;;;;;;;;;SAOrC;AAED;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,GAAG,CACvD,MAAM,EACN,OAAO,CACR,GAAG,IAAI,CAAC,CAgBR;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GACzB,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
package/dist/core/layout.d.ts
CHANGED
|
@@ -38,8 +38,6 @@ export interface SectionLayout {
|
|
|
38
38
|
isUserSection: boolean;
|
|
39
39
|
/** True if this layout chunk belongs to a user-defined Section (all chunks of that section) */
|
|
40
40
|
belongsToUserSection: boolean;
|
|
41
|
-
/** The heading level of the section title (e.g., 1 for Heading1) - used by TOCs to exclude section title from section-scoped TOCs */
|
|
42
|
-
sectionTitleLevel?: number;
|
|
43
41
|
/** Page configuration override for this section */
|
|
44
42
|
pageOverride?: {
|
|
45
43
|
size?: 'A4' | 'A3' | 'LETTER' | 'LEGAL' | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/core/layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,cAAc,EAMf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,MAAM,EAAE;YACN,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,MAAM,EAAE,cAAc,GAAG;QAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IACrD,IAAI,CAAC,EAAE,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,qBAAqB,CAAC;IAClC,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,UAAU,EAAE,QAAQ,GAAG,cAAc,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,mBAAmB,EAAE,GAAG,gBAAgB,CAAC;IAClD,MAAM,CAAC,EAAE,mBAAmB,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E,QAAQ,GAAG,cAAc,GAChC,cAAc,CAchB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,EACvC,YAAY,CAAC,EAAE;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,GACA,qBAAqB,CAwEvB;AA0GD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,mBAAmB,EAAE,EACjC,WAAW,EAAE,MAAM,GAClB,mBAAmB,EAAE,EAAE,CAiBzB"}
|
|
@@ -23,6 +23,22 @@ export interface PrerasterizeOptions {
|
|
|
23
23
|
/** Max concurrent per-visual fallback rasterizations (default 4). */
|
|
24
24
|
concurrency?: number;
|
|
25
25
|
}
|
|
26
|
+
/** Cumulative pre-pass counters for cache observability (#156). */
|
|
27
|
+
export interface VisualPrepassStats {
|
|
28
|
+
/** Documents that entered the pre-pass with at least one visual. */
|
|
29
|
+
documents: number;
|
|
30
|
+
/** Enabled visuals collected across those documents. */
|
|
31
|
+
collected: number;
|
|
32
|
+
/** Unique rasterization units after dedupe (identical content+dpi). */
|
|
33
|
+
unique: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get cumulative per-document pre-pass counters. `collected - unique` is the
|
|
37
|
+
* work the dedupe saved — the `visual` cache benefit the component cache
|
|
38
|
+
* stats can never show, since `visual` bypasses that cache by design.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getVisualPrepassStats(): VisualPrepassStats;
|
|
41
|
+
export declare function resetVisualPrepassStats(): void;
|
|
26
42
|
/**
|
|
27
43
|
* Collect the props of every enabled `visual` component reachable from
|
|
28
44
|
* `root`. The walk is generic — every array element and object value is
|
|
@@ -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,EACnC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAkB/D,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AASD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,EAAE,CA4B/D;AAsDD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,iBAAiB,GAAG,SAAS,EAC5C,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,
|
|
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,EACnC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EA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AE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA8DD;;GAEG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,QAAQ,CAAC,CAYnB;AAkZD;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,EACtB,cAAc,CAAC,EAAE,MAAM,EACvB,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,UAAQ,GAClB,OAAO,CAAC,eAAe,CAAC,CA+G1B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,CAAC,SAAS,GAAG,KAAK,GAAG,eAAe,GAAG,OAAO,CAAC,EAAE,CAAC,CAmC5D"}
|
package/dist/core/structure.d.ts
CHANGED
|
@@ -25,8 +25,6 @@ export interface DocumentMetadata {
|
|
|
25
25
|
date: Date;
|
|
26
26
|
}
|
|
27
27
|
export interface ProcessedSection {
|
|
28
|
-
title?: string;
|
|
29
|
-
level?: number;
|
|
30
28
|
components: ComponentDefinition[];
|
|
31
29
|
header?: ComponentDefinition[] | 'linkToPrevious';
|
|
32
30
|
footer?: ComponentDefinition[] | 'linkToPrevious';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/core/structure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EACzB,aAAa,EAGd,MAAM,UAAU,CAAC;AAClB,OAAO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QAAQ,GAAG,OAAO,GAAG;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5E,OAAO,CAAC,EAAE;YACR,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,yBAAyB,EACnC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,IAAI,GACpB,OAAO,CAAC,iBAAiB,CAAC,CAgE5B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,cAAc,OAAa,GAC1B,gBAAgB,CAWlB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAwC7B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,mBAAmB,EAAE,EACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAyBhC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,GAChB,aAAa,CA0Bf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ export declare function getCoreVersion(): string;
|
|
|
2
2
|
export { generateDocument, generateFromConfig, generateDocumentFromJson, generateDocumentFromFile, generateBufferFromJson, generateBufferFromFile, generateAndSaveFromJson, generateAndSaveFromFile, validateJsonSchema, isReportComponentDefinition, saveDocument, generateAndSave, DocumentGenerator as CoreDocumentGenerator, } from './core/generator';
|
|
3
3
|
export { flattenVisuals, type FlattenVisualsOptions, } from './core/flattenVisuals';
|
|
4
4
|
export { MemoryCache, CacheKeyGenerator, DEFAULT_CACHE_CONFIG, getCacheConfigFromEnv, mergeConfigs, ComponentCacheAnalytics, type CacheConfiguration, type CachedComponent, type CacheStatistics, type CacheKeyOptions, type CacheEvents, type CacheAnalyticsReport, type ComponentPerformanceMetrics, type ComponentCacheTrends, type CacheOptimizationRecommendation, type TimeSeriesPoint, } from './cache/index';
|
|
5
|
-
export { initializeComponentCache, getComponentCache, clearComponentCache, getComponentCacheStats, warmComponentCache, } from './core/cached-render';
|
|
5
|
+
export { initializeComponentCache, getComponentCache, clearComponentCache, getComponentCacheStats, getComponentBypassStats, warmComponentCache, type ComponentBypassReason, type ComponentBypassStats, } from './core/cached-render';
|
|
6
|
+
export { getVisualPrepassStats, resetVisualPrepassStats, type VisualPrepassStats, } from './core/prerasterizeVisuals';
|
|
6
7
|
export { isReportComponent, isSectionComponent, isHeadingComponent, isParagraphComponent, isColumnsComponent, isImageComponent, isStatisticComponent, isTableComponent, isListComponent, isHighchartsComponent, isVisualComponent, } from './types/index';
|
|
7
8
|
export type { ImageContent, StatisticContent, TableData, SectionProperties, ColumnSettings, PageSizeOptions, PageMarginOptions, PageNumberOptions, PageBorderOptions, RenderContext, } from './types/index';
|
|
8
9
|
export * from './utils/formatters';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAGD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EAC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Ae,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,oBAAoB,CAAC;AAG5B,YAAY,EAEV,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAEL,eAAe,EACf,aAAa,EACb,uBAAuB,EAGvB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,8BAA8B,EAG9B,4BAA4B,EAC5B,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EAGZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,aAAa,IAAI,sBAAsB,EAC5C,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGpB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2257,39 +2257,15 @@ async function extractSections(components, context) {
|
|
|
2257
2257
|
context
|
|
2258
2258
|
);
|
|
2259
2259
|
const shouldPageBreak = component.props?.pageBreak !== false;
|
|
2260
|
-
if (component.props?.title) {
|
|
2261
|
-
const headingLevel = Math.min(
|
|
2262
|
-
Math.max(component.props.level || 1, 1),
|
|
2263
|
-
6
|
|
2264
|
-
);
|
|
2265
|
-
sectionComponents.unshift(
|
|
2266
|
-
resolveComponentDefaults(
|
|
2267
|
-
{
|
|
2268
|
-
name: "heading",
|
|
2269
|
-
props: {
|
|
2270
|
-
text: component.props.title,
|
|
2271
|
-
level: headingLevel,
|
|
2272
|
-
pageBreak: shouldPageBreak,
|
|
2273
|
-
// Apply zero-spacing to prevent unwanted initial line
|
|
2274
|
-
spacing: {
|
|
2275
|
-
before: 0,
|
|
2276
|
-
after: 0
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
},
|
|
2280
|
-
context.fullTheme
|
|
2281
|
-
)
|
|
2282
|
-
);
|
|
2283
|
-
}
|
|
2284
2260
|
sections.push({
|
|
2285
|
-
title: component.props?.title,
|
|
2286
|
-
level: component.props?.level,
|
|
2287
2261
|
components: sectionComponents,
|
|
2288
2262
|
header: component.props?.header,
|
|
2289
2263
|
footer: component.props?.footer,
|
|
2290
2264
|
isExplicitSection: true,
|
|
2291
|
-
//
|
|
2292
|
-
|
|
2265
|
+
// Page break is handled at layout level (sections render no title of
|
|
2266
|
+
// their own — a visible title is an explicit heading child; the
|
|
2267
|
+
// authoring label lives in props.meta.title and is never rendered)
|
|
2268
|
+
pageBreak: shouldPageBreak,
|
|
2293
2269
|
// Preserve page configuration override if present
|
|
2294
2270
|
page: component.props?.page
|
|
2295
2271
|
});
|
|
@@ -2314,29 +2290,6 @@ async function flattenComponents(components, context) {
|
|
|
2314
2290
|
children: await flattenComponents(component.children, context)
|
|
2315
2291
|
});
|
|
2316
2292
|
} else if (isSectionComponent(component) && component.children) {
|
|
2317
|
-
if (component.props?.title) {
|
|
2318
|
-
const headingLevel = Math.min(
|
|
2319
|
-
Math.max(component.props.level || 1, 1),
|
|
2320
|
-
6
|
|
2321
|
-
);
|
|
2322
|
-
flattened.push(
|
|
2323
|
-
resolveComponentDefaults(
|
|
2324
|
-
{
|
|
2325
|
-
name: "heading",
|
|
2326
|
-
props: {
|
|
2327
|
-
text: component.props.title,
|
|
2328
|
-
level: headingLevel,
|
|
2329
|
-
// Apply zero-spacing to prevent unwanted initial line
|
|
2330
|
-
spacing: {
|
|
2331
|
-
before: 0,
|
|
2332
|
-
after: 0
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
},
|
|
2336
|
-
context.fullTheme
|
|
2337
|
-
)
|
|
2338
|
-
);
|
|
2339
|
-
}
|
|
2340
2293
|
flattened.push(...await flattenComponents(component.children, context));
|
|
2341
2294
|
} else {
|
|
2342
2295
|
flattened.push(component);
|
|
@@ -2399,7 +2352,6 @@ function applyLayout(sections, theme, themeName) {
|
|
|
2399
2352
|
footer: section.footer,
|
|
2400
2353
|
isUserSection: isSourceUserSection,
|
|
2401
2354
|
belongsToUserSection: isSourceUserSection,
|
|
2402
|
-
sectionTitleLevel: section.level,
|
|
2403
2355
|
pageOverride: section.page
|
|
2404
2356
|
});
|
|
2405
2357
|
continue;
|
|
@@ -2434,8 +2386,6 @@ function applyLayout(sections, theme, themeName) {
|
|
|
2434
2386
|
// at the start of column content.
|
|
2435
2387
|
isUserSection: isSourceUserSection && j === 0,
|
|
2436
2388
|
belongsToUserSection: isSourceUserSection,
|
|
2437
|
-
// Pass section title level for TOC scoping
|
|
2438
|
-
sectionTitleLevel: section.level,
|
|
2439
2389
|
// Pass page override for this section
|
|
2440
2390
|
pageOverride: section.page
|
|
2441
2391
|
});
|
|
@@ -4271,6 +4221,33 @@ function componentHasRevision(component) {
|
|
|
4271
4221
|
import { createHash as createHash3 } from "crypto";
|
|
4272
4222
|
var componentCache = null;
|
|
4273
4223
|
var cacheKeyGen = null;
|
|
4224
|
+
var bypassStats = /* @__PURE__ */ new Map();
|
|
4225
|
+
function recordBypass(type, reason) {
|
|
4226
|
+
const entry = bypassStats.get(type);
|
|
4227
|
+
if (entry) {
|
|
4228
|
+
entry.renders++;
|
|
4229
|
+
} else {
|
|
4230
|
+
bypassStats.set(type, { renders: 1, reason });
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
function getComponentBypassStats() {
|
|
4234
|
+
return Array.from(bypassStats.entries()).map(([type, s]) => ({
|
|
4235
|
+
type,
|
|
4236
|
+
renders: s.renders,
|
|
4237
|
+
reason: s.reason
|
|
4238
|
+
}));
|
|
4239
|
+
}
|
|
4240
|
+
var DATE_INDEPENDENT_PLACEHOLDERS = /* @__PURE__ */ new Set(["PAGE", "TOTAL_PAGES"]);
|
|
4241
|
+
function usesDateSensitivePlaceholder(serialized) {
|
|
4242
|
+
const placeholderRegex = /\{([^}{]+)\}/g;
|
|
4243
|
+
let match;
|
|
4244
|
+
while ((match = placeholderRegex.exec(serialized)) !== null) {
|
|
4245
|
+
const name = match[1].toUpperCase();
|
|
4246
|
+
if (DATE_INDEPENDENT_PLACEHOLDERS.has(name)) continue;
|
|
4247
|
+
if (PlaceholderRegistry.has(name)) return true;
|
|
4248
|
+
}
|
|
4249
|
+
return false;
|
|
4250
|
+
}
|
|
4274
4251
|
function createThemeHash(theme) {
|
|
4275
4252
|
const themeString = JSON.stringify(theme);
|
|
4276
4253
|
return createHash3("sha256").update(themeString).digest("hex").substring(0, 8);
|
|
@@ -4312,24 +4289,34 @@ async function clearComponentCache() {
|
|
|
4312
4289
|
if (componentCache) {
|
|
4313
4290
|
await componentCache.clear();
|
|
4314
4291
|
}
|
|
4292
|
+
bypassStats.clear();
|
|
4315
4293
|
}
|
|
4316
4294
|
async function renderComponentWithCache(component, theme, themeName, context, bypassCache = false) {
|
|
4317
|
-
const
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4295
|
+
const bypassReason = componentHasRevision(
|
|
4296
|
+
component
|
|
4297
|
+
) ? "revision-ids" : "id" in component ? "bookmark-id" : component.name === "toc" || component.name === "section" || component.name === "visual" || component.name === "heading" || // Both explicit lists and markdown-list paragraphs register
|
|
4298
|
+
// numbering in the current document scope. Cached paragraphs can
|
|
4299
|
+
// otherwise reference definitions that only existed in a previous
|
|
4300
|
+
// render.
|
|
4301
|
+
component.name === "list" || component.name === "paragraph" ? "dynamic-context" : null;
|
|
4321
4302
|
if (!componentCache) {
|
|
4322
4303
|
initializeComponentCache();
|
|
4323
4304
|
}
|
|
4324
|
-
if (
|
|
4305
|
+
if (bypassReason !== null) {
|
|
4306
|
+
recordBypass(component.name, bypassReason);
|
|
4307
|
+
return renderComponent(component, theme, themeName, context);
|
|
4308
|
+
}
|
|
4309
|
+
if (!componentCache || bypassCache || !componentCache.getConfig().enabled) {
|
|
4325
4310
|
return renderComponent(component, theme, themeName, context);
|
|
4326
4311
|
}
|
|
4327
4312
|
const componentProps = JSON.stringify(component.props || {});
|
|
4328
4313
|
const themeHash = createThemeHash(theme);
|
|
4329
4314
|
const contextKey = context?.section ? `${context.section.currentLayout}:${context.section.columnCount}` : "no-section";
|
|
4330
|
-
const generationDateKey = getGenerationDate().toISOString();
|
|
4331
4315
|
const baseDirKey = getBaseDir() ?? "";
|
|
4332
4316
|
const childrenKey = "children" in component && component.children ? `:children:${JSON.stringify(component.children)}` : "";
|
|
4317
|
+
const generationDateKey = usesDateSensitivePlaceholder(
|
|
4318
|
+
componentProps + childrenKey
|
|
4319
|
+
) ? getGenerationDate().toISOString() : "no-date";
|
|
4333
4320
|
const cacheKey = `component:${component.name}:${themeHash}:${contextKey}:${generationDateKey}:${baseDirKey}:${componentProps}${childrenKey}`;
|
|
4334
4321
|
const cached = await componentCache.get(cacheKey);
|
|
4335
4322
|
if (cached) {
|
|
@@ -4372,10 +4359,11 @@ async function warmComponentCache(components) {
|
|
|
4372
4359
|
await Promise.all(warmingPromises);
|
|
4373
4360
|
}
|
|
4374
4361
|
function getComponentCacheStats() {
|
|
4362
|
+
const bypassedComponents = getComponentBypassStats();
|
|
4375
4363
|
if (!componentCache) {
|
|
4376
|
-
return null;
|
|
4364
|
+
return bypassedComponents.length > 0 ? { bypassedComponents } : null;
|
|
4377
4365
|
}
|
|
4378
|
-
return componentCache.getStats();
|
|
4366
|
+
return { ...componentCache.getStats(), bypassedComponents };
|
|
4379
4367
|
}
|
|
4380
4368
|
|
|
4381
4369
|
// src/core/content.ts
|
|
@@ -6808,8 +6796,6 @@ function renderTocComponent(component, theme, context) {
|
|
|
6808
6796
|
);
|
|
6809
6797
|
}
|
|
6810
6798
|
const stylesWithLevels = [];
|
|
6811
|
-
const sectionTitleLevel = context?.section?.sectionTitleLevel;
|
|
6812
|
-
const startLevel = effectiveScope === "section" && sectionTitleLevel ? sectionTitleLevel : 0;
|
|
6813
6799
|
if (componentProps.styles && componentProps.styles.length > 0) {
|
|
6814
6800
|
for (const styleMapping of componentProps.styles) {
|
|
6815
6801
|
const styleId = styleMapping.styleId;
|
|
@@ -6820,7 +6806,7 @@ function renderTocComponent(component, theme, context) {
|
|
|
6820
6806
|
);
|
|
6821
6807
|
}
|
|
6822
6808
|
}
|
|
6823
|
-
const effectiveDepthStart =
|
|
6809
|
+
const effectiveDepthStart = depthStart;
|
|
6824
6810
|
const effectiveDepthEnd = depthEnd;
|
|
6825
6811
|
const tocOptions = {
|
|
6826
6812
|
hyperlink: true,
|
|
@@ -7229,6 +7215,19 @@ function createLimiter(max) {
|
|
|
7229
7215
|
var DEFAULT_FALLBACK_CONCURRENCY = 4;
|
|
7230
7216
|
var BATCH_TIMEOUT_BASE_MS = 3e4;
|
|
7231
7217
|
var BATCH_TIMEOUT_PER_SLIDE_MS = 1e4;
|
|
7218
|
+
var prepassStats = {
|
|
7219
|
+
documents: 0,
|
|
7220
|
+
collected: 0,
|
|
7221
|
+
unique: 0
|
|
7222
|
+
};
|
|
7223
|
+
function getVisualPrepassStats() {
|
|
7224
|
+
return { ...prepassStats };
|
|
7225
|
+
}
|
|
7226
|
+
function resetVisualPrepassStats() {
|
|
7227
|
+
prepassStats.documents = 0;
|
|
7228
|
+
prepassStats.collected = 0;
|
|
7229
|
+
prepassStats.unique = 0;
|
|
7230
|
+
}
|
|
7232
7231
|
function collectVisualProps(root) {
|
|
7233
7232
|
const found = [];
|
|
7234
7233
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
@@ -7305,6 +7304,9 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
|
|
|
7305
7304
|
}
|
|
7306
7305
|
}
|
|
7307
7306
|
if (targets.size === 0) return map;
|
|
7307
|
+
prepassStats.documents++;
|
|
7308
|
+
prepassStats.collected += visuals.length;
|
|
7309
|
+
prepassStats.unique += targets.size;
|
|
7308
7310
|
const unique = [...targets.values()];
|
|
7309
7311
|
const limit = createLimiter(
|
|
7310
7312
|
Math.max(1, options.concurrency ?? DEFAULT_FALLBACK_CONCURRENCY)
|
|
@@ -7705,9 +7707,7 @@ async function renderSection(section, theme, themeName, context, sectionOrdinal,
|
|
|
7705
7707
|
currentLayout: section.layoutType,
|
|
7706
7708
|
columnCount: section.properties.column?.count || 1,
|
|
7707
7709
|
// Always pass the same bookmark ID for all layout chunks of the same section
|
|
7708
|
-
sectionBookmarkId
|
|
7709
|
-
// Pass section title level for TOC scoping (excludes section title from its own TOC)
|
|
7710
|
-
sectionTitleLevel: section.sectionTitleLevel
|
|
7710
|
+
sectionBookmarkId
|
|
7711
7711
|
}
|
|
7712
7712
|
};
|
|
7713
7713
|
if (sectionBookmarkId && isFirstLayoutOfUserSection && sharedLinkId !== void 0) {
|
|
@@ -9297,11 +9297,13 @@ export {
|
|
|
9297
9297
|
generatePluginDocumentSchema,
|
|
9298
9298
|
generateWarningsDocument,
|
|
9299
9299
|
export_getCacheConfigFromEnv as getCacheConfigFromEnv,
|
|
9300
|
+
getComponentBypassStats,
|
|
9300
9301
|
getComponentCache,
|
|
9301
9302
|
getComponentCacheStats,
|
|
9302
9303
|
getCoreVersion,
|
|
9303
9304
|
getExample,
|
|
9304
9305
|
getExampleNames,
|
|
9306
|
+
getVisualPrepassStats,
|
|
9305
9307
|
hasNodeBuiltins,
|
|
9306
9308
|
initializeComponentCache,
|
|
9307
9309
|
isColumnsComponent,
|
|
@@ -9325,6 +9327,7 @@ export {
|
|
|
9325
9327
|
minimalTheme,
|
|
9326
9328
|
modernTheme,
|
|
9327
9329
|
parseTextWithDecorators,
|
|
9330
|
+
resetVisualPrepassStats,
|
|
9328
9331
|
runExample,
|
|
9329
9332
|
saveDocument,
|
|
9330
9333
|
themes,
|