@json-to-office/core-docx 0.38.0 → 1.0.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/highcharts.d.ts +16 -6
- package/dist/components/highcharts.d.ts.map +1 -1
- package/dist/components/index.d.ts +8 -14
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/visual.d.ts +60 -18
- package/dist/components/visual.d.ts.map +1 -1
- package/dist/core/collectTocHeadings.d.ts +15 -1
- package/dist/core/collectTocHeadings.d.ts.map +1 -1
- package/dist/core/componentTransform.d.ts +30 -0
- package/dist/core/componentTransform.d.ts.map +1 -0
- package/dist/core/desugarExternals.d.ts +35 -0
- package/dist/core/desugarExternals.d.ts.map +1 -0
- package/dist/core/flattenVisuals.d.ts.map +1 -1
- package/dist/core/generateFromIr.d.ts +78 -0
- package/dist/core/generateFromIr.d.ts.map +1 -0
- package/dist/core/generationContext.d.ts +2 -2
- package/dist/core/generationContext.d.ts.map +1 -1
- package/dist/core/generator.d.ts +48 -39
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/imageResources.d.ts +35 -0
- package/dist/core/imageResources.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/layout.d.ts +15 -3
- package/dist/core/layout.d.ts.map +1 -1
- package/dist/core/markdownList.d.ts +21 -0
- package/dist/core/markdownList.d.ts.map +1 -0
- package/dist/core/prerasterizeVisuals.d.ts +2 -3
- package/dist/core/prerasterizeVisuals.d.ts.map +1 -1
- package/dist/core/sectionBookmarks.d.ts +15 -40
- package/dist/core/sectionBookmarks.d.ts.map +1 -1
- package/dist/core/tableModel.d.ts +188 -0
- package/dist/core/tableModel.d.ts.map +1 -0
- package/dist/core/tocField.d.ts +70 -0
- package/dist/core/tocField.d.ts.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8060 -7269
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts +49 -0
- package/dist/ir/compiler.d.ts.map +1 -0
- package/dist/ir/debug.d.ts +15 -0
- package/dist/ir/debug.d.ts.map +1 -0
- package/dist/ir/features.d.ts +19 -0
- package/dist/ir/features.d.ts.map +1 -0
- package/dist/ir/index.d.ts +16 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/inline.d.ts +126 -0
- package/dist/ir/inline.d.ts.map +1 -0
- package/dist/ir/types.d.ts +774 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/units.d.ts +57 -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/createDocumentGenerator.d.ts +10 -3
- package/dist/plugin/createDocumentGenerator.d.ts.map +1 -1
- package/dist/plugin/example/index.d.ts.map +1 -1
- package/dist/plugin/example/index.js +8083 -7149
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/schema.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +13 -26
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/renderers/docxjs/emit.d.ts +41 -0
- package/dist/renderers/docxjs/emit.d.ts.map +1 -0
- package/dist/renderers/docxjs/index.d.ts +22 -0
- package/dist/renderers/docxjs/index.d.ts.map +1 -0
- package/dist/renderers/docxjs/styles.d.ts +12 -0
- package/dist/renderers/docxjs/styles.d.ts.map +1 -0
- package/dist/renderers/office-open/emit.d.ts +63 -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/office-open/styles.d.ts +13 -0
- package/dist/renderers/office-open/styles.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 +35 -0
- package/dist/renderers/types.d.ts.map +1 -0
- package/dist/styles/themeToStyles.d.ts +12 -0
- package/dist/styles/themeToStyles.d.ts.map +1 -0
- package/dist/styles/utils/borderUtils.d.ts +13 -6
- package/dist/styles/utils/borderUtils.d.ts.map +1 -1
- package/dist/styles/utils/layoutUtils.d.ts +10 -14
- package/dist/styles/utils/layoutUtils.d.ts.map +1 -1
- package/dist/styles/utils/styleHelpers.d.ts +6 -2
- package/dist/styles/utils/styleHelpers.d.ts.map +1 -1
- package/dist/themes/overrides.d.ts +0 -2
- package/dist/themes/overrides.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +18 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/bookmarkRegistry.d.ts +13 -77
- package/dist/utils/bookmarkRegistry.d.ts.map +1 -1
- package/dist/utils/commentRegistry.d.ts +5 -43
- package/dist/utils/commentRegistry.d.ts.map +1 -1
- package/dist/utils/exampleRunner.d.ts.map +1 -1
- package/dist/utils/imageUtils.d.ts +23 -19
- package/dist/utils/imageUtils.d.ts.map +1 -1
- package/dist/utils/numberingConfig.d.ts +7 -87
- package/dist/utils/numberingConfig.d.ts.map +1 -1
- package/dist/utils/packageDocument.d.ts +0 -3
- package/dist/utils/packageDocument.d.ts.map +1 -1
- package/dist/utils/revisionUtils.d.ts +6 -67
- package/dist/utils/revisionUtils.d.ts.map +1 -1
- package/dist/utils/warningsDocument.d.ts.map +1 -1
- package/package.json +12 -4
- package/dist/cache/index.d.ts +0 -7
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/key-generator.d.ts +0 -34
- package/dist/cache/key-generator.d.ts.map +0 -1
- package/dist/components/columns.d.ts +0 -12
- package/dist/components/columns.d.ts.map +0 -1
- package/dist/components/heading.d.ts +0 -12
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/image.d.ts +0 -12
- package/dist/components/image.d.ts.map +0 -1
- package/dist/components/list.d.ts +0 -12
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/paragraph.d.ts +0 -12
- package/dist/components/paragraph.d.ts.map +0 -1
- package/dist/components/section.d.ts +0 -12
- package/dist/components/section.d.ts.map +0 -1
- package/dist/components/statistic.d.ts +0 -12
- package/dist/components/statistic.d.ts.map +0 -1
- package/dist/components/table.d.ts +0 -13
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/text-box.d.ts +0 -9
- package/dist/components/text-box.d.ts.map +0 -1
- package/dist/components/toc/index.d.ts +0 -30
- package/dist/components/toc/index.d.ts.map +0 -1
- package/dist/core/cached-render.d.ts +0 -92
- package/dist/core/cached-render.d.ts.map +0 -1
- package/dist/core/content.d.ts +0 -319
- package/dist/core/content.d.ts.map +0 -1
- package/dist/core/render.d.ts +0 -48
- package/dist/core/render.d.ts.map +0 -1
- package/dist/styles/themeToDocxAdapter.d.ts +0 -22
- package/dist/styles/themeToDocxAdapter.d.ts.map +0 -1
- package/dist/styles/utils/cellUtils.d.ts +0 -55
- package/dist/styles/utils/cellUtils.d.ts.map +0 -1
- package/dist/utils/alignmentUtils.d.ts +0 -10
- package/dist/utils/alignmentUtils.d.ts.map +0 -1
- package/dist/utils/commentAnchors.d.ts +0 -39
- package/dist/utils/commentAnchors.d.ts.map +0 -1
- package/dist/utils/componentAnnotations.d.ts +0 -23
- package/dist/utils/componentAnnotations.d.ts.map +0 -1
- package/dist/utils/docxImagePositioning.d.ts +0 -19
- package/dist/utils/docxImagePositioning.d.ts.map +0 -1
- package/dist/utils/noteRegistry.d.ts +0 -43
- package/dist/utils/noteRegistry.d.ts.map +0 -1
- package/dist/utils/noteResolver.d.ts +0 -31
- package/dist/utils/noteResolver.d.ts.map +0 -1
- package/dist/utils/numberedItemsRegistry.d.ts +0 -38
- package/dist/utils/numberedItemsRegistry.d.ts.map +0 -1
- package/dist/utils/placeholderImage.d.ts +0 -31
- package/dist/utils/placeholderImage.d.ts.map +0 -1
- package/dist/utils/placeholderProcessor.d.ts +0 -58
- package/dist/utils/placeholderProcessor.d.ts.map +0 -1
- package/dist/utils/textParser.d.ts +0 -117
- package/dist/utils/textParser.d.ts.map +0 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* Core module exports
|
|
3
3
|
* Functional document generation API
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
5
|
+
export { generateBufferFromJson, generateBufferWithWarnings, generateBufferFromConfig, generateBufferFromFile, generateAndSaveFromJson, generateAndSaveFromFile, DocumentGenerator, } from './generator';
|
|
6
6
|
export { processDocument, createDocumentMetadata, extractSections, flattenComponents, createRenderContext, } from './structure';
|
|
7
7
|
export { applyLayout, analyzeLayoutGroups, determineComponentLayout, processLayoutComponents, getColumnSettings, createSectionProperties, calculateColumnDistribution, } from './layout';
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export { renderComponentWithCache, initializeComponentCache, getComponentCache, clearComponentCache, getComponentCacheStats, warmComponentCache, } from './cached-render';
|
|
8
|
+
export { compileDocumentToIr, generateBufferViaIr } from './generateFromIr';
|
|
9
|
+
export { desugarExternals } from './desugarExternals';
|
|
11
10
|
export type { ProcessedDocument, DocumentMetadata, ProcessedSection, } from './structure';
|
|
12
11
|
export type { LayoutPlan, SectionLayout, LayoutGroup } from './layout';
|
|
13
|
-
export type {
|
|
12
|
+
export type { ImageOptions } from '../components/visual';
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/core/layout.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Layout Functions
|
|
3
3
|
* Handle all layout concerns including columns, breaks, and section properties
|
|
4
4
|
*/
|
|
5
|
-
import { SectionType, Column as DocxColumn } from 'docx';
|
|
6
5
|
import { ComponentDefinition, ColumnSettings } from '../types';
|
|
7
6
|
import { ThemeConfig } from '../styles';
|
|
8
7
|
import { ProcessedSection } from './structure';
|
|
@@ -25,12 +24,25 @@ export interface WordSectionProperties {
|
|
|
25
24
|
right: number;
|
|
26
25
|
bottom: number;
|
|
27
26
|
left: number;
|
|
27
|
+
header?: number;
|
|
28
|
+
footer?: number;
|
|
29
|
+
gutter?: number;
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
column: ColumnSettings & {
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The same explicit columns as `children`, in twips.
|
|
35
|
+
*
|
|
36
|
+
* `children` holds docx `Column` instances, which keep their width and
|
|
37
|
+
* space private, so anything downstream of a renderer boundary cannot read
|
|
38
|
+
* them back. This is the plain-numbers copy the DocxIR compiler reads.
|
|
39
|
+
*/
|
|
40
|
+
widths?: Array<{
|
|
41
|
+
width: number;
|
|
42
|
+
space?: number;
|
|
43
|
+
}>;
|
|
32
44
|
};
|
|
33
|
-
type?:
|
|
45
|
+
type?: 'continuous' | 'nextColumn' | 'nextPage' | 'evenPage' | 'oddPage';
|
|
34
46
|
}
|
|
35
47
|
export interface SectionLayout {
|
|
36
48
|
properties: WordSectionProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/core/layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/core/layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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;YACf;;;eAGG;YACH,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;QACF,MAAM,EAAE;YACN,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,IAAI,EAAE,MAAM,CAAC;YAGb,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;IACF,MAAM,EAAE,cAAc,GAAG;QACvB;;;;;;W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,GAClB,mBAAmB,EAAE,EAAE,CAiBzB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown list syntax inside a paragraph's text.
|
|
3
|
+
*
|
|
4
|
+
* A paragraph whose whole text is `- one\n- two` is a list, not prose, and has
|
|
5
|
+
* always rendered as one. Detecting that is a pure reading of the text with no
|
|
6
|
+
* renderer in it, so both the pre-IR writer and the DocxIR compiler read it
|
|
7
|
+
* here rather than each deciding for itself what counts as a list.
|
|
8
|
+
*/
|
|
9
|
+
export interface MarkdownList {
|
|
10
|
+
type: 'unordered' | 'ordered';
|
|
11
|
+
items: {
|
|
12
|
+
text: string;
|
|
13
|
+
level: number;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse markdown list syntax from paragraph text
|
|
18
|
+
* Returns null if no list detected, or { type, items } if list found
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseMarkdownList(text: string): MarkdownList | null;
|
|
21
|
+
//# sourceMappingURL=markdownList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownList.d.ts","sourceRoot":"","sources":["../../src/core/markdownList.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CA2CnE"}
|
|
@@ -30,7 +30,7 @@ export interface PrerasterizeOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
fonts?: readonly RasterizeFontFace[];
|
|
32
32
|
}
|
|
33
|
-
/** Cumulative pre-pass counters for
|
|
33
|
+
/** Cumulative pre-pass counters for visual-work observability (#156). */
|
|
34
34
|
export interface VisualPrepassStats {
|
|
35
35
|
/** Documents that entered the pre-pass with at least one visual. */
|
|
36
36
|
documents: number;
|
|
@@ -41,8 +41,7 @@ export interface VisualPrepassStats {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Get cumulative per-document pre-pass counters. `collected - unique` is the
|
|
44
|
-
* work
|
|
45
|
-
* stats can never show, since `visual` bypasses that cache by design.
|
|
44
|
+
* work saved by batch-internal deduplication.
|
|
46
45
|
*/
|
|
47
46
|
export declare function getVisualPrepassStats(): VisualPrepassStats;
|
|
48
47
|
export declare function resetVisualPrepassStats(): void;
|
|
@@ -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,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;IACrB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACtC;AAED,
|
|
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,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;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;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,EAAE,CA4B/D;AA6ED;;;;;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,CAiOrD"}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The bookmark a section is addressable by.
|
|
3
3
|
*
|
|
4
|
-
* `
|
|
5
|
-
* `\b` switch against
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `context.custom.sectionBookmarks` in `components/section.ts`, whose value
|
|
9
|
-
* shadowed the first for everything below a nested section. Consumers read
|
|
10
|
-
* whichever won.
|
|
4
|
+
* `w:bookmarkStart/@w:name` is what a section-scoped table of contents resolves
|
|
5
|
+
* its `\b` switch against, so the name has to be derivable identically by
|
|
6
|
+
* whoever writes the bookmark and whoever points at it. It is derived from the
|
|
7
|
+
* section's ordinal, and both sides call this.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* place that decides both, and one map that remembers what a given section
|
|
16
|
-
* resolved to.
|
|
9
|
+
* This used to be a registry with per-render state, because the pre-IR writer
|
|
10
|
+
* had two producers allocating from two different traversal orders. The
|
|
11
|
+
* compiler has one, so a pure function is enough.
|
|
17
12
|
*/
|
|
18
|
-
/** A resolved OOXML bookmark: its name plus the numeric id
|
|
13
|
+
/** A resolved OOXML bookmark: its name plus the numeric id its ends share. */
|
|
19
14
|
export interface SectionBookmark {
|
|
20
15
|
/** `w:bookmarkStart/@w:name`, and the TOC `\b` switch argument. */
|
|
21
16
|
id: string;
|
|
@@ -23,31 +18,11 @@ export interface SectionBookmark {
|
|
|
23
18
|
linkId: number;
|
|
24
19
|
}
|
|
25
20
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
21
|
+
* The bookmark for a layout section, derived from its ordinal.
|
|
22
|
+
*
|
|
23
|
+
* Every layout chunk of one user-defined section shares an ordinal (see
|
|
24
|
+
* `computeSectionOrdinals`), so they all resolve to the same bookmark — which
|
|
25
|
+
* is the point: the start lands in the first chunk and the end in the last.
|
|
28
26
|
*/
|
|
29
|
-
declare
|
|
30
|
-
private fallback;
|
|
31
|
-
private readonly scopes;
|
|
32
|
-
private get state();
|
|
33
|
-
/** Run work with an isolated registry that follows its async call chain. */
|
|
34
|
-
runScoped<T>(callback: () => T): T;
|
|
35
|
-
/**
|
|
36
|
-
* The bookmark for a layout section, derived from its ordinal.
|
|
37
|
-
*
|
|
38
|
-
* Every layout chunk of one user-defined section shares an ordinal (see
|
|
39
|
-
* `computeSectionOrdinals`), so they all resolve to the same bookmark — which
|
|
40
|
-
* is the point: the start lands in the first chunk and the end in the last.
|
|
41
|
-
*/
|
|
42
|
-
forLayoutSection(ordinal: number): SectionBookmark;
|
|
43
|
-
/**
|
|
44
|
-
* The bookmark for a `section` component, allocated on first sight and
|
|
45
|
-
* remembered so re-resolving the same component never allocates twice.
|
|
46
|
-
*/
|
|
47
|
-
forSectionComponent(component: object): SectionBookmark;
|
|
48
|
-
/** Test-only: reset the unscoped fallback counters. */
|
|
49
|
-
clear(): void;
|
|
50
|
-
}
|
|
51
|
-
export declare const globalSectionBookmarkRegistry: SectionBookmarkRegistry;
|
|
52
|
-
export {};
|
|
27
|
+
export declare function sectionBookmark(ordinal: number): SectionBookmark;
|
|
53
28
|
//# sourceMappingURL=sectionBookmarks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sectionBookmarks.d.ts","sourceRoot":"","sources":["../../src/core/sectionBookmarks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sectionBookmarks.d.ts","sourceRoot":"","sources":["../../src/core/sectionBookmarks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEhE"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `table` component, resolved down to plain numbers and colours.
|
|
3
|
+
*
|
|
4
|
+
* A table's authoring surface is layered: a value may come from the cell, the
|
|
5
|
+
* column, the table's header defaults, the table's cell defaults, the table's
|
|
6
|
+
* own border settings, or the built-in defaults — and borders, sizes and
|
|
7
|
+
* padding each cascade *per side*, so a cell can take its left border from one
|
|
8
|
+
* layer and its top from another. Getting that cascade right is the whole job,
|
|
9
|
+
* and it has nothing to do with any renderer.
|
|
10
|
+
*
|
|
11
|
+
* So it lives here, once. Both the pre-IR writer (`createTable`) and the DocxIR
|
|
12
|
+
* compiler resolve a table through this module and then only translate the
|
|
13
|
+
* result into their own vocabulary. Two copies of these rules would drift, and
|
|
14
|
+
* the drift would be invisible until a border quietly changed colour.
|
|
15
|
+
*
|
|
16
|
+
* Everything returned is resolved: colours are 6-digit hex without `#`, border
|
|
17
|
+
* sizes are points, padding and heights are points. Nothing here loads content
|
|
18
|
+
* or touches the filesystem.
|
|
19
|
+
*/
|
|
20
|
+
import type { ComponentDefinition } from '../types';
|
|
21
|
+
import type { ThemeConfig } from '../styles';
|
|
22
|
+
export type TableCellContent = string | ComponentDefinition;
|
|
23
|
+
export type TableFontConfig = {
|
|
24
|
+
family?: string;
|
|
25
|
+
size?: number;
|
|
26
|
+
bold?: boolean;
|
|
27
|
+
fontWeight?: number;
|
|
28
|
+
italic?: boolean;
|
|
29
|
+
underline?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type BorderColor = string | {
|
|
32
|
+
bottom?: string;
|
|
33
|
+
top?: string;
|
|
34
|
+
right?: string;
|
|
35
|
+
left?: string;
|
|
36
|
+
};
|
|
37
|
+
export type BorderSize = number | {
|
|
38
|
+
bottom?: number;
|
|
39
|
+
top?: number;
|
|
40
|
+
right?: number;
|
|
41
|
+
left?: number;
|
|
42
|
+
};
|
|
43
|
+
export type Padding = number | {
|
|
44
|
+
bottom?: number;
|
|
45
|
+
top?: number;
|
|
46
|
+
right?: number;
|
|
47
|
+
left?: number;
|
|
48
|
+
};
|
|
49
|
+
export type CellDefaults = {
|
|
50
|
+
color?: string;
|
|
51
|
+
backgroundColor?: string;
|
|
52
|
+
horizontalAlignment?: 'left' | 'center' | 'right' | 'justify';
|
|
53
|
+
verticalAlignment?: 'top' | 'middle' | 'bottom';
|
|
54
|
+
font?: TableFontConfig;
|
|
55
|
+
borderColor?: BorderColor;
|
|
56
|
+
borderSize?: BorderSize;
|
|
57
|
+
padding?: Padding;
|
|
58
|
+
height?: number;
|
|
59
|
+
};
|
|
60
|
+
export type HideBorders = boolean | {
|
|
61
|
+
top?: boolean;
|
|
62
|
+
right?: boolean;
|
|
63
|
+
bottom?: boolean;
|
|
64
|
+
left?: boolean;
|
|
65
|
+
insideHorizontal?: boolean;
|
|
66
|
+
insideVertical?: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** A cell as written, plus the annotations that ride along with it. */
|
|
69
|
+
export type TableCellSource<TComment, TRevision> = CellDefaults & {
|
|
70
|
+
comment?: TComment;
|
|
71
|
+
revision?: TRevision;
|
|
72
|
+
content?: TableCellContent;
|
|
73
|
+
};
|
|
74
|
+
export type TableColumnSource<TComment, TRevision> = {
|
|
75
|
+
/** Width in points (number) or as a percentage string, e.g. `"40%"`. */
|
|
76
|
+
width?: number | string;
|
|
77
|
+
cellDefaults?: CellDefaults;
|
|
78
|
+
header?: TableCellSource<TComment, TRevision>;
|
|
79
|
+
cells?: TableCellSource<TComment, TRevision>[];
|
|
80
|
+
};
|
|
81
|
+
export type TableSource<TComment, TRevision, TRowRevision> = {
|
|
82
|
+
borderColor?: BorderColor;
|
|
83
|
+
borderSize?: BorderSize;
|
|
84
|
+
hideBorders?: HideBorders;
|
|
85
|
+
cellDefaults?: CellDefaults;
|
|
86
|
+
headerCellDefaults?: CellDefaults;
|
|
87
|
+
width?: number;
|
|
88
|
+
columns: TableColumnSource<TComment, TRevision>[];
|
|
89
|
+
/** Row-parallel properties, indexed like `columns[].cells`. */
|
|
90
|
+
rows?: {
|
|
91
|
+
revision?: TRowRevision;
|
|
92
|
+
cantSplit?: boolean;
|
|
93
|
+
tableHeader?: boolean;
|
|
94
|
+
}[];
|
|
95
|
+
keepInOnePage?: boolean;
|
|
96
|
+
keepNext?: boolean;
|
|
97
|
+
repeatHeaderOnPageBreak?: boolean;
|
|
98
|
+
};
|
|
99
|
+
export interface ResolvedSides<T> {
|
|
100
|
+
top: T;
|
|
101
|
+
right: T;
|
|
102
|
+
bottom: T;
|
|
103
|
+
left: T;
|
|
104
|
+
}
|
|
105
|
+
/** One side of a cell's border, after the cascade and the hide rules. */
|
|
106
|
+
export interface ResolvedBorder {
|
|
107
|
+
/** Points. Zero means no border. */
|
|
108
|
+
size: number;
|
|
109
|
+
/** 6-digit hex, no `#`. */
|
|
110
|
+
color: string;
|
|
111
|
+
/** True when `hideBorders` suppressed this side for this cell. */
|
|
112
|
+
hidden: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface ResolvedCell<TComment, TRevision> {
|
|
115
|
+
content?: TableCellContent;
|
|
116
|
+
comment?: TComment;
|
|
117
|
+
revision?: TRevision;
|
|
118
|
+
/** Text colour: hex, `auto`, or undefined to inherit the table style. */
|
|
119
|
+
color?: string;
|
|
120
|
+
/** Fill: hex, `auto`, or the `transparent` sentinel meaning "no shading". */
|
|
121
|
+
backgroundColor?: string;
|
|
122
|
+
horizontalAlignment: 'left' | 'center' | 'right' | 'justify';
|
|
123
|
+
verticalAlignment: 'top' | 'middle' | 'bottom';
|
|
124
|
+
font: TableFontConfig;
|
|
125
|
+
borders: ResolvedSides<ResolvedBorder>;
|
|
126
|
+
/** Points, per side. Absent when no layer asked for padding. */
|
|
127
|
+
padding?: ResolvedSides<number>;
|
|
128
|
+
/**
|
|
129
|
+
* A cell the source never wrote, kept only so the grid stays rectangular.
|
|
130
|
+
*
|
|
131
|
+
* It draws its borders and nothing else — no fill, no padding, no content —
|
|
132
|
+
* which is what tells a renderer to leave it empty rather than style it.
|
|
133
|
+
*/
|
|
134
|
+
missing?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface ResolvedRow<TComment, TRevision, TRowRevision> {
|
|
137
|
+
cells: ResolvedCell<TComment, TRevision>[];
|
|
138
|
+
/** Points; the tallest height any cell in the row asked for. */
|
|
139
|
+
height?: number;
|
|
140
|
+
isHeader: boolean;
|
|
141
|
+
/** Set only when the source stated it. */
|
|
142
|
+
tableHeader?: boolean;
|
|
143
|
+
cantSplit?: boolean;
|
|
144
|
+
revision?: TRowRevision;
|
|
145
|
+
/** Every cell paragraph in the row keeps with the next one. */
|
|
146
|
+
keepNext: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The table's column grid.
|
|
150
|
+
*
|
|
151
|
+
* `twips` is the real OOXML unit. `percent` is what the pipeline has always
|
|
152
|
+
* written when no column states a width — the grid then carries a percentage
|
|
153
|
+
* per column rather than a width, which Word tolerates because the table
|
|
154
|
+
* itself is sized in percent.
|
|
155
|
+
*/
|
|
156
|
+
export interface ResolvedColumnGrid {
|
|
157
|
+
unit: 'twips' | 'percent';
|
|
158
|
+
values: number[];
|
|
159
|
+
}
|
|
160
|
+
export interface ResolvedTable<TComment, TRevision, TRowRevision> {
|
|
161
|
+
columnGrid: ResolvedColumnGrid;
|
|
162
|
+
width: {
|
|
163
|
+
size: number;
|
|
164
|
+
unit: 'twips' | 'percent';
|
|
165
|
+
};
|
|
166
|
+
header: ResolvedRow<TComment, TRevision, TRowRevision>;
|
|
167
|
+
rows: ResolvedRow<TComment, TRevision, TRowRevision>[];
|
|
168
|
+
/** Headers repeat across page breaks unless the source disabled it. */
|
|
169
|
+
repeatHeader: boolean;
|
|
170
|
+
/** Emitted when the column widths cannot fit the page. */
|
|
171
|
+
overflow?: {
|
|
172
|
+
totalTwips: number;
|
|
173
|
+
availableTwips: number;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export interface TableModelOptions {
|
|
177
|
+
/** Reports a value that could not be used. Deduplicated by the caller. */
|
|
178
|
+
onWarning?: (code: string, message: string) => void;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Resolve a whole table.
|
|
182
|
+
*
|
|
183
|
+
* The generic parameters keep the annotation types (`comment`, `revision`) out
|
|
184
|
+
* of this module: it carries them through untouched, so neither the pre-IR
|
|
185
|
+
* writer's docx-shaped types nor the IR's own have to be known here.
|
|
186
|
+
*/
|
|
187
|
+
export declare function resolveTableModel<TComment, TRevision, TRowRevision>(source: TableSource<TComment, TRevision, TRowRevision>, theme: ThemeConfig, themeName: string, options?: TableModelOptions): ResolvedTable<TComment, TRevision, TRowRevision>;
|
|
188
|
+
//# sourceMappingURL=tableModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableModel.d.ts","sourceRoot":"","sources":["../../src/core/tableModel.ts"],"names":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,iBAAiB;IAChC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD;AA4OD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EACjE,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EACtD,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,iBAAsB,GAC9B,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,CAiNlD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `toc` component, resolved into the switches a Word field needs.
|
|
3
|
+
*
|
|
4
|
+
* A table of contents is a field: Word repopulates it on open from the outline
|
|
5
|
+
* and the switches the field carries. Deciding what those switches say — which
|
|
6
|
+
* outline levels, which extra styles, which region, which levels keep their
|
|
7
|
+
* page numbers — is a reading of the authoring props with no renderer in it.
|
|
8
|
+
*
|
|
9
|
+
* The cached entries are the other half. Word refreshes the field, but headless
|
|
10
|
+
* LibreOffice does not, so without them a PDF export shows only the title. What
|
|
11
|
+
* is cached must be exactly what Word would collect, or a reader pressing F9
|
|
12
|
+
* sees the table change under them — the disagreement caching exists to avoid.
|
|
13
|
+
*/
|
|
14
|
+
import type { ThemeConfig } from '../styles';
|
|
15
|
+
import type { TocHeadingEntry } from './collectTocHeadings';
|
|
16
|
+
export interface TocFieldEntry {
|
|
17
|
+
text: string;
|
|
18
|
+
level: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedTocField {
|
|
21
|
+
/** `\o` — heading outline levels to include, inclusive. */
|
|
22
|
+
headingRange: {
|
|
23
|
+
from: number;
|
|
24
|
+
to: number;
|
|
25
|
+
};
|
|
26
|
+
/** `\t` — extra paragraph styles, by Word display name, with their level. */
|
|
27
|
+
styleLevels: Array<{
|
|
28
|
+
styleName: string;
|
|
29
|
+
level: number;
|
|
30
|
+
}>;
|
|
31
|
+
/** `\b` — restrict to a bookmarked region. */
|
|
32
|
+
bookmarkScope?: string;
|
|
33
|
+
/** `\n` — level ranges whose entries omit a page number. */
|
|
34
|
+
omitPageNumbersForLevels: Array<{
|
|
35
|
+
from: number;
|
|
36
|
+
to: number;
|
|
37
|
+
}>;
|
|
38
|
+
/** What separates an entry's text from its page number. */
|
|
39
|
+
entrySeparator: string;
|
|
40
|
+
entries: TocFieldEntry[];
|
|
41
|
+
/** Things the field cannot express, to be reported by the caller. */
|
|
42
|
+
warnings: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The Word display name a theme style key registers under: camelCase and
|
|
46
|
+
* kebab/snake separators become spaces (`calloutTitle` → `callout Title`).
|
|
47
|
+
* Mirrors the naming in `themeToDocxAdapter`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function toStyleDisplayName(styleId: string): string;
|
|
50
|
+
export interface TocFieldSource {
|
|
51
|
+
depth?: unknown;
|
|
52
|
+
pageNumbersDepth?: unknown;
|
|
53
|
+
includePageNumbers?: boolean;
|
|
54
|
+
numberingStyle?: string;
|
|
55
|
+
numberSeparator?: boolean;
|
|
56
|
+
scope?: 'auto' | 'document' | 'section';
|
|
57
|
+
styles?: Array<{
|
|
58
|
+
styleId: string;
|
|
59
|
+
level: number;
|
|
60
|
+
}>;
|
|
61
|
+
title?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Resolve a `toc` component's props into field switches and cached entries. */
|
|
64
|
+
export declare function resolveTocField(props: TocFieldSource, theme: ThemeConfig, context: {
|
|
65
|
+
/** The bookmark of the section this TOC sits in, if any. */
|
|
66
|
+
sectionBookmarkId?: string;
|
|
67
|
+
/** Every heading and mapped-style paragraph in the document, in order. */
|
|
68
|
+
collected?: readonly TocHeadingEntry[];
|
|
69
|
+
}): ResolvedTocField;
|
|
70
|
+
//# sourceMappingURL=tocField.d.ts.map
|
|
@@ -0,0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GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE;IACP,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CACxC,GACA,gBAAgB,CAgFlB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export declare function getCoreVersion(): string;
|
|
2
|
-
export {
|
|
2
|
+
export { generateBufferFromJson, generateBufferWithWarnings, generateBufferFromConfig, generateBufferFromFile, generateAndSaveFromJson, generateAndSaveFromFile, validateJsonSchema, isReportComponentDefinition, DocumentGenerator as CoreDocumentGenerator, type DocxGenerationResult, } from './core/generator';
|
|
3
|
+
export type { DocxRendererId } from './renderers/types';
|
|
4
|
+
export { DEFAULT_DOCX_RENDERER_ID } from './renderers/types';
|
|
5
|
+
export { docxRendererIds, isDocxRendererId } from './renderers/registry';
|
|
6
|
+
export { UncompiledComponentError } from './core/generateFromIr';
|
|
3
7
|
export { flattenVisuals, type FlattenVisualsOptions, } from './core/flattenVisuals';
|
|
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, getComponentBypassStats, warmComponentCache, componentBypassReason, type ComponentBypassReason, type ComponentBypassStats, } from './core/cached-render';
|
|
6
8
|
export { getVisualPrepassStats, resetVisualPrepassStats, type VisualPrepassStats, } from './core/prerasterizeVisuals';
|
|
7
9
|
export { isReportComponent, isSectionComponent, isHeadingComponent, isParagraphComponent, isColumnsComponent, isImageComponent, isStatisticComponent, isTableComponent, isListComponent, isHighchartsComponent, isVisualComponent, } from './types/index';
|
|
8
|
-
export type { ImageContent, StatisticContent, TableData, SectionProperties, ColumnSettings, PageSizeOptions, PageMarginOptions, PageNumberOptions, PageBorderOptions, RenderContext, } from './types/index';
|
|
10
|
+
export type { ReportComponentDefinition, ReportComponentDefinitionFor, ImageContent, StatisticContent, TableData, SectionProperties, ColumnSettings, PageSizeOptions, PageMarginOptions, PageNumberOptions, PageBorderOptions, RenderContext, } from './types/index';
|
|
9
11
|
export * from './utils/formatters';
|
|
10
|
-
export { parseTextWithDecorators } from './utils/textParser';
|
|
11
12
|
export { isNodeEnvironment, hasNodeBuiltins } from './utils/environment';
|
|
12
13
|
export { generateWarningsDocument, formatWarningsText, } from './utils/warningsDocument';
|
|
13
14
|
export { themes, minimalTheme, corporateTheme, modernTheme, } from './styles/index';
|
|
@@ -17,6 +18,6 @@ export { examples, getExample, getExampleNames, loadJsonExample, } from './templ
|
|
|
17
18
|
export { runExample } from './utils/exampleRunner';
|
|
18
19
|
import './components/index';
|
|
19
20
|
export type { ChartGenerationResult, } from './components/highcharts';
|
|
20
|
-
export { createComponent, createVersion, createDocumentGenerator, validateComponentProps, validateDocument, cleanComponentProps, ComponentValidationError, UnknownPreservedComponentError, generatePluginDocumentSchema, exportPluginSchema, generateComponentSchemas, mergeSchemas, type CustomComponent, type ComponentVersion, type ComponentVersionMap, type RenderFunction, type RenderContext as ComponentRenderContext, type DocumentGenerator, type DocumentGeneratorOptions, type GenerateOptions, type GenerateFileOptions, type
|
|
21
|
+
export { createComponent, createVersion, createDocumentGenerator, validateComponentProps, validateDocument, cleanComponentProps, ComponentValidationError, UnknownPreservedComponentError, generatePluginDocumentSchema, exportPluginSchema, generateComponentSchemas, mergeSchemas, type CustomComponent, type ComponentVersion, type ComponentVersionMap, type RenderFunction, type RenderContext as ComponentRenderContext, type DocumentGenerator, type DocumentGeneratorOptions, type GenerateOptions, type GenerateFileOptions, type BufferGenerationResult, type FileGenerationResult, type StandardDefinitionResult, type ValidationResult, type ValidationError, type ExtractCustomComponentType, type CustomComponentUnion, type ExtendedComponentDefinition, type ExtendedReportComponent, type InferCustomComponents, } from './plugin/index';
|
|
21
22
|
export type { PluginComponent, PluginRenderFunction, PluginValidationError, PluginValidationResult, } from './types/plugin';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAID,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,IAAI,qBAAqB,EAC1C,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,qBAAqB,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