@json-to-office/core-docx 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/generateFromIr.d.ts +5 -1
- package/dist/core/generateFromIr.d.ts.map +1 -1
- package/dist/core/generator.d.ts +4 -0
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/structure.d.ts +13 -0
- package/dist/core/structure.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1084 -348
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts.map +1 -1
- package/dist/plugin/example/index.js +572 -251
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/quality/facts.d.ts +82 -0
- package/dist/quality/facts.d.ts.map +1 -0
- package/dist/quality/preflight.d.ts +15 -0
- package/dist/quality/preflight.d.ts.map +1 -0
- package/dist/quality/rules.d.ts +38 -0
- package/dist/quality/rules.d.ts.map +1 -0
- package/dist/quality/text-metrics.d.ts +34 -0
- package/dist/quality/text-metrics.d.ts.map +1 -0
- package/dist/renderers/docxjs/index.d.ts.map +1 -1
- package/dist/renderers/office-open/index.d.ts.map +1 -1
- package/dist/renderers/registry.d.ts +18 -4
- package/dist/renderers/registry.d.ts.map +1 -1
- package/dist/styles/themeToStyles.d.ts +35 -1
- package/dist/styles/themeToStyles.d.ts.map +1 -1
- package/dist/templates/themes/apex.docx.theme.json +1 -2
- package/dist/templates/themes/corporate.docx.theme.json +1 -2
- package/dist/templates/themes/devportal.docx.theme.json +1 -2
- package/dist/templates/themes/minimal.docx.theme.json +1 -2
- package/dist/templates/themes/modern.docx.theme.json +1 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -14
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { PreparedDocument, QualityFact } from '@json-to-office/quality';
|
|
2
|
+
import type { FontRuntimeOpts, GenerationWarning } from '@json-to-office/shared';
|
|
3
|
+
import type { ReportComponentDefinition } from '../types';
|
|
4
|
+
import type { ThemeConfig } from '../styles';
|
|
5
|
+
import { type GenerationThemeContext } from '../core/generationContext';
|
|
6
|
+
import { type ResolvedDocumentTree } from '../core/structure';
|
|
7
|
+
export interface DocxTableWidthFact extends QualityFact {
|
|
8
|
+
kind: 'docx/table-width';
|
|
9
|
+
totalWidthTwips: number;
|
|
10
|
+
availableWidthTwips: number;
|
|
11
|
+
hasExplicitWidth: boolean;
|
|
12
|
+
allColumnsExplicit: boolean;
|
|
13
|
+
pointSum: number;
|
|
14
|
+
percentSum: number;
|
|
15
|
+
/**
|
|
16
|
+
* Authored explicit widths by column index (points as numbers, `"NN%"`
|
|
17
|
+
* strings kept verbatim) — what a fix has to rescale. Columns without an
|
|
18
|
+
* explicit width are absent.
|
|
19
|
+
*/
|
|
20
|
+
explicitWidths: ReadonlyArray<{
|
|
21
|
+
index: number;
|
|
22
|
+
width: number | string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export interface DocxHeadingFact extends QualityFact {
|
|
26
|
+
kind: 'docx/heading';
|
|
27
|
+
level: number;
|
|
28
|
+
previousLevel?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A paragraph pinned into a floating frame — the one place in DOCX where the
|
|
32
|
+
* author, not the layout engine, decides how much room the text gets. Flowed
|
|
33
|
+
* body copy repaginates; a frame keeps its declared box and lets the text spill
|
|
34
|
+
* or break inside it.
|
|
35
|
+
*/
|
|
36
|
+
export interface DocxFrameTextFact extends QualityFact {
|
|
37
|
+
kind: 'docx/frame-text';
|
|
38
|
+
text: string;
|
|
39
|
+
fontSizePt: number;
|
|
40
|
+
/** Height of one line, including the resolved line-spacing rule. */
|
|
41
|
+
lineHeightPt: number;
|
|
42
|
+
/** Signed tracking in points: negative when the run is condensed. */
|
|
43
|
+
characterSpacingPt: number;
|
|
44
|
+
frameWidthTwips: number;
|
|
45
|
+
frameHeightTwips?: number;
|
|
46
|
+
/** Frame top, when pinned with an absolute vertical offset. */
|
|
47
|
+
offsetYTwips?: number;
|
|
48
|
+
/** The paper edge — the last twip anything can render on. */
|
|
49
|
+
pageBottomTwips: number;
|
|
50
|
+
/** The longest whitespace-delimited token — the one with nowhere to wrap. */
|
|
51
|
+
longestWord: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A `<text>` element inside an inline SVG, with the canvas it has to sit in.
|
|
55
|
+
* SVG has no overflow rule to fall back on: a baseline past the viewBox is
|
|
56
|
+
* simply not painted, and the words leave the document's text layer with it.
|
|
57
|
+
*/
|
|
58
|
+
export interface DocxSvgTextFact extends QualityFact {
|
|
59
|
+
kind: 'docx/svg-text';
|
|
60
|
+
content: string;
|
|
61
|
+
/** Baseline position and nominal size, in viewBox units. */
|
|
62
|
+
baselineY: number;
|
|
63
|
+
fontSizeUnits: number;
|
|
64
|
+
viewBoxMinY: number;
|
|
65
|
+
viewBoxHeight: number;
|
|
66
|
+
}
|
|
67
|
+
export type DocxQualityFact = DocxTableWidthFact | DocxHeadingFact | DocxFrameTextFact | DocxSvgTextFact;
|
|
68
|
+
export interface DocxQualityModel {
|
|
69
|
+
authored: ReportComponentDefinition;
|
|
70
|
+
context: GenerationThemeContext;
|
|
71
|
+
document: ResolvedDocumentTree;
|
|
72
|
+
themeName: string;
|
|
73
|
+
}
|
|
74
|
+
export interface PrepareDocxQualityOptions {
|
|
75
|
+
customThemes?: Record<string, ThemeConfig>;
|
|
76
|
+
fonts?: FontRuntimeOpts;
|
|
77
|
+
warnings?: GenerationWarning[];
|
|
78
|
+
context?: GenerationThemeContext;
|
|
79
|
+
renderer?: string;
|
|
80
|
+
}
|
|
81
|
+
export declare function prepareDocxQualityDocument(document: ReportComponentDefinition, options?: PrepareDocxQualityOptions): PreparedDocument<DocxQualityModel, DocxQualityFact>;
|
|
82
|
+
//# sourceMappingURL=facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facts.d.ts","sourceRoot":"","sources":["../../src/quality/facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAuB,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,IAAI,EAAE,kBAAkB,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,cAAc,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,eAAe,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,yBAAyB,CAAC;IACpC,OAAO,EAAE,sBAAsB,CAAC;IAChC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAkPD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,yBAAyB,EACnC,OAAO,GAAE,yBAA8B,GACtC,gBAAgB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CA+ErD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** DOCX quality analysis over renderer-aligned prepared facts. */
|
|
2
|
+
import { type PreparedDocument, type QualityAnalysis, type QualityPolicy, type QualityProfile } from '@json-to-office/quality';
|
|
3
|
+
import type { ThemeConfig } from '../styles';
|
|
4
|
+
import type { DocxQualityFact, DocxQualityModel } from './facts';
|
|
5
|
+
export interface DocxQualityOptions {
|
|
6
|
+
customThemes?: Record<string, ThemeConfig>;
|
|
7
|
+
}
|
|
8
|
+
export interface DocxQualityAnalysisOptions extends DocxQualityOptions {
|
|
9
|
+
renderer?: string;
|
|
10
|
+
profile?: QualityProfile;
|
|
11
|
+
policy?: QualityPolicy;
|
|
12
|
+
prepared?: PreparedDocument<DocxQualityModel, DocxQualityFact>;
|
|
13
|
+
}
|
|
14
|
+
export declare function analyzeDocxQuality(doc: unknown, options?: DocxQualityAnalysisOptions): QualityAnalysis;
|
|
15
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/quality/preflight.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAUjE,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;CAChE;AAiBD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE,0BAA+B,GACvC,eAAe,CA2CjB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { QualityEngine, type QualityProfile, type QualityRule, type QualityRulePack } from '@json-to-office/quality';
|
|
2
|
+
import type { DocxQualityFact, DocxQualityModel } from './facts';
|
|
3
|
+
export declare const docxTableWidthRule: QualityRule<DocxQualityModel, DocxQualityFact>;
|
|
4
|
+
export declare const docxHeadingHierarchyRule: QualityRule<DocxQualityModel, DocxQualityFact>;
|
|
5
|
+
export declare const docxTextFitRule: QualityRule<DocxQualityModel, DocxQualityFact>;
|
|
6
|
+
export declare const docxSvgTextBoundsRule: QualityRule<DocxQualityModel, DocxQualityFact>;
|
|
7
|
+
export declare const DOCX_QUALITY_RULES: QualityRulePack<DocxQualityModel, DocxQualityFact>;
|
|
8
|
+
export declare const DOCX_QUALITY_PROFILES: {
|
|
9
|
+
readonly 'executive-report': {
|
|
10
|
+
readonly id: "executive-report";
|
|
11
|
+
readonly formats: readonly ["docx"];
|
|
12
|
+
readonly description: "Short decision document with strict outline continuity.";
|
|
13
|
+
readonly rules: {
|
|
14
|
+
readonly 'docx/heading-hierarchy': {
|
|
15
|
+
readonly severity: "warning";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly 'technical-report': {
|
|
20
|
+
readonly id: "technical-report";
|
|
21
|
+
readonly formats: readonly ["docx"];
|
|
22
|
+
readonly description: "Portable professional report defaults.";
|
|
23
|
+
};
|
|
24
|
+
readonly 'legal-appendix': {
|
|
25
|
+
readonly id: "legal-appendix";
|
|
26
|
+
readonly formats: readonly ["docx"];
|
|
27
|
+
readonly description: "Dense appendix: preserve integrity without editorial taste.";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare const DOCX_DEFAULT_QUALITY_PROFILE: QualityProfile;
|
|
31
|
+
/**
|
|
32
|
+
* Callers name a shipped profile by id — `{ id: 'executive-report', formats: ['docx'] }`.
|
|
33
|
+
* Without this lookup that request reaches the engine carrying nothing but its id,
|
|
34
|
+
* so the analysis runs on defaults while stamping the requested profileId.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveDocxQualityProfile(requested: QualityProfile | undefined): QualityProfile | undefined;
|
|
37
|
+
export declare const docxQualityEngine: QualityEngine<DocxQualityModel, DocxQualityFact>;
|
|
38
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/quality/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAGV,eAAe,EACf,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAejB,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAC1C,gBAAgB,EAChB,eAAe,CA6DhB,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAChD,gBAAgB,EAChB,eAAe,CAuChB,CAAC;AAsBF,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,gBAAgB,EAAE,eAAe,CAwF1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAC7C,gBAAgB,EAChB,eAAe,CAqChB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,gBAAgB,EAChB,eAAe,CAShB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;CAmBiB,CAAC;AAEpD,eAAO,MAAM,4BAA4B,EAAE,cACA,CAAC;AAK5C;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,cAAc,GAAG,SAAS,GACpC,cAAc,GAAG,SAAS,CAK5B;AAED,eAAO,MAAM,iBAAiB,kDAA8C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A width model for authored runs, used only to answer "does this text fit".
|
|
3
|
+
*
|
|
4
|
+
* A single characters-per-point factor cannot do this job. Measured against the
|
|
5
|
+
* shipped display headings (`pdftotext -bbox`), the implied factor ran 0.435
|
|
6
|
+
* for mixed-case words and 0.694 for all-caps — a 39% spread that no single
|
|
7
|
+
* constant survives, because caps and lowercase are simply different widths.
|
|
8
|
+
*
|
|
9
|
+
* These are the standard Helvetica advance widths in 1/1000 em. The grotesque
|
|
10
|
+
* sans faces the stock templates use (DM Sans, Inter, Geist, Archivo) track
|
|
11
|
+
* them closely enough that summing real characters lands within about 8% of the
|
|
12
|
+
* rendered width, and it under-estimates more often than it over-estimates —
|
|
13
|
+
* the safe direction for a rule that only speaks up on overflow.
|
|
14
|
+
*
|
|
15
|
+
* Validated against rendered geometry at authoring time:
|
|
16
|
+
*
|
|
17
|
+
* "Vision," 80pt model 179.2pt actual 182.7pt −1.9%
|
|
18
|
+
* "Financial" 80pt model 241.8pt actual 246.8pt −2.0%
|
|
19
|
+
* "Global" 107pt model 251.6pt actual 264.4pt −4.8%
|
|
20
|
+
* "Performance" 80pt model 362.2pt actual 383.0pt −5.4%
|
|
21
|
+
* "OUR" 76pt model 168.9pt actual 158.2pt +6.8%
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Width of `text` in points at `fontSizePt`, with `trackingPt` of signed
|
|
25
|
+
* letter-spacing applied per character (negative when the run is condensed).
|
|
26
|
+
*/
|
|
27
|
+
export declare function estimateTextWidthPt(text: string, fontSizePt: number, trackingPt?: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Lines `text` needs when wrapped at `widthPt`, breaking on spaces. A word
|
|
30
|
+
* wider than the line gets its own line here; the renderer would break it
|
|
31
|
+
* mid-word, which `docx/text-fit` reports separately.
|
|
32
|
+
*/
|
|
33
|
+
export declare function estimateWrappedLines(text: string, widthPt: number, fontSizePt: number, trackingPt?: number): number;
|
|
34
|
+
//# sourceMappingURL=text-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-metrics.d.ts","sourceRoot":"","sources":["../../src/quality/text-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAgFH;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,UAAU,SAAI,GACb,MAAM,CAOR;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,SAAI,GACb,MAAM,CAuBR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/docxjs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,QAAQ,EAUT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAKL,KAAK,aAAa,EAEnB,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,kBAAkB,EAAE,cAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/docxjs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,QAAQ,EAUT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAKL,KAAK,aAAa,EAEnB,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,kBAAkB,EAAE,cAAyB,CAAC;AAwC3D,wBAAgB,oBAAoB,IAAI,YAAY,CA0BnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,SAAS,GAAE,aAAyB,GACnC,QAAQ,CA2CV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EACV,MAAM,EAEN,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAWhF,eAAO,MAAM,4BAA4B,EAAE,cAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EACV,MAAM,EAEN,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAWhF,eAAO,MAAM,4BAA4B,EAAE,cAA8B,CAAC;AA8D1E,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,YAAY,CAAC,CAqD1E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,cAAc,EAAO,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA4ClC"}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DOCX renderer registry.
|
|
3
3
|
*
|
|
4
|
-
* Adapters are registered as async factories so
|
|
5
|
-
*
|
|
6
|
-
* `@office-open/docx`, and a
|
|
7
|
-
*
|
|
4
|
+
* Adapters are registered as async factories so a backend is only imported
|
|
5
|
+
* when it is actually selected — choosing `docxjs` never loads
|
|
6
|
+
* `@office-open/docx`, and a backend that cannot be loaded at all (an
|
|
7
|
+
* `--omit=optional` install, a broken tree) surfaces as an actionable install
|
|
8
|
+
* hint rather than a bare module-resolution failure. `statuses()` asks the
|
|
9
|
+
* same question up front, so a discovery surface never advertises a renderer
|
|
10
|
+
* that would fail on the first render.
|
|
8
11
|
*/
|
|
12
|
+
import { type RendererStatus } from '@json-to-office/shared/rendering';
|
|
9
13
|
import { type DocxRenderer, type DocxRendererId } from './types';
|
|
10
14
|
/** Resolve a renderer by id, defaulting to `docxjs`. */
|
|
11
15
|
export declare function resolveDocxRenderer(id?: DocxRendererId): Promise<DocxRenderer>;
|
|
12
16
|
/** Renderer ids registered for DOCX. */
|
|
13
17
|
export declare function docxRendererIds(): readonly DocxRendererId[];
|
|
18
|
+
/**
|
|
19
|
+
* Every registered renderer with whether its backend can be loaded here.
|
|
20
|
+
*
|
|
21
|
+
* Registration is not availability: the factory only runs on selection, so an
|
|
22
|
+
* id alone says nothing about whether the render behind it will work. Callers
|
|
23
|
+
* that advertise renderers — `jto_info`, `jto_discover` — report this instead
|
|
24
|
+
* of docxRendererIds() so a renderer that cannot run is never offered as one
|
|
25
|
+
* that can.
|
|
26
|
+
*/
|
|
27
|
+
export declare function docxRendererStatuses(): Promise<RendererStatus<DocxRendererId>[]>;
|
|
14
28
|
export declare function isDocxRendererId(value: string): value is DocxRendererId;
|
|
15
29
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/renderers/registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/renderers/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAiBjB,wDAAwD;AACxD,wBAAgB,mBAAmB,CACjC,EAAE,CAAC,EAAE,cAAc,GAClB,OAAO,CAAC,YAAY,CAAC,CAEvB;AAED,wCAAwC;AACxC,wBAAgB,eAAe,IAAI,SAAS,cAAc,EAAE,CAE3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAC7C,cAAc,CAAC,cAAc,CAAC,EAAE,CACjC,CAEA;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE"}
|
|
@@ -6,7 +6,41 @@
|
|
|
6
6
|
* shape, so which styles a document defines — and what each one says — is
|
|
7
7
|
* decided once, here, rather than once per renderer.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Style ids a `statistic` lowers to.
|
|
11
|
+
*
|
|
12
|
+
* Exported because the compiler names them on every statistic paragraph it
|
|
13
|
+
* emits and the two must not drift: a `w:pStyle` pointing at a style the
|
|
14
|
+
* document does not define is not an error anywhere in OOXML, it just resolves
|
|
15
|
+
* to Normal — which is how the component came to render as two ordinary body
|
|
16
|
+
* paragraphs with nothing to tell the number from its caption.
|
|
17
|
+
*/
|
|
18
|
+
export declare const STATISTIC_NUMBER_STYLE_ID = "StatisticNumber";
|
|
19
|
+
export declare const STATISTIC_DESCRIPTION_STYLE_ID = "StatisticDescription";
|
|
20
|
+
/**
|
|
21
|
+
* The number's size, in points, per the component's `size` prop.
|
|
22
|
+
*
|
|
23
|
+
* `medium` is what the style itself carries; the compiler overrides the run
|
|
24
|
+
* for the other two, so a document that never states `size` needs no run
|
|
25
|
+
* properties at all and restyling every statistic stays a one-style edit.
|
|
26
|
+
*/
|
|
27
|
+
export declare const STATISTIC_SIZE_POINTS: Readonly<Record<string, number>>;
|
|
28
|
+
import type { DocxIrParagraphStyle, DocxIrStyles } from '../ir/types';
|
|
10
29
|
import type { ThemeConfig } from './index';
|
|
11
30
|
export declare function createDocumentStyles(themeNameOrObject?: string | ThemeConfig, language?: string): DocxIrStyles;
|
|
31
|
+
/**
|
|
32
|
+
* The two paragraph styles a `statistic` lowers to.
|
|
33
|
+
*
|
|
34
|
+
* Separate from `createDocumentStyles`, and appended by the compiler only when
|
|
35
|
+
* the document actually contains a statistic. Defining them unconditionally
|
|
36
|
+
* would rewrite `word/styles.xml` in every document ever produced — including
|
|
37
|
+
* the ones with no statistic in them — to fix a component most documents never
|
|
38
|
+
* use, and every recorded golden with it.
|
|
39
|
+
*
|
|
40
|
+
* A theme that names either id under `styles` has already had it emitted as a
|
|
41
|
+
* custom style, so that one is skipped rather than defined twice: two entries
|
|
42
|
+
* with the same id leave the later one winning, and the later one here is the
|
|
43
|
+
* default, not the theme's.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createStatisticStyles(theme: ThemeConfig): DocxIrParagraphStyle[];
|
|
12
46
|
//# sourceMappingURL=themeToStyles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeToStyles.d.ts","sourceRoot":"","sources":["../../src/styles/themeToStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"themeToStyles.d.ts","sourceRoot":"","sources":["../../src/styles/themeToStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAC3D,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIlE,CAAC;AAEF,OAAO,KAAK,EAMV,oBAAoB,EAEpB,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoX3C,wBAAgB,oBAAoB,CAClC,iBAAiB,GAAE,MAAM,GAAG,WAAuB,EACnD,QAAQ,CAAC,EAAE,MAAM,GAChB,YAAY,CAgjBd;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,GACjB,oBAAoB,EAAE,CAmExB"}
|