@json-to-office/core-docx 2.7.0 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-to-office/core-docx",
3
- "version": "2.7.0",
3
+ "version": "3.1.0",
4
4
  "description": "Core DOCX document generation engine",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,9 +24,9 @@
24
24
  "adm-zip": "0.5.16",
25
25
  "date-fns": "3.6.0",
26
26
  "probe-image-size": "7.2.3",
27
- "@json-to-office/quality": "^2.6.0",
28
- "@json-to-office/shared": "^2.6.0",
29
- "@json-to-office/shared-docx": "^2.7.0"
27
+ "@json-to-office/quality": "^3.0.0",
28
+ "@json-to-office/shared": "^3.1.0",
29
+ "@json-to-office/shared-docx": "^3.0.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "docx": "9.7.1"
@@ -1,22 +0,0 @@
1
- /**
2
- * The `cover` block, lowered to primitives.
3
- *
4
- * A logo where the theme's `logoSlot` puts it, the cover rule from the
5
- * `chrome.cover` recipe a third of the way down the page, the client as an
6
- * eyebrow, the title in the recipe's type role, the subtitle in the theme's
7
- * subtitle style, and a meta line — date and confidentiality — under it. The
8
- * drop to the title is the block's own share of the body height the theme's
9
- * page leaves — a proportion resolved against the theme, never a coordinate,
10
- * and not a recipe key. Every colour, weight and role is the recipe's, with
11
- * fallbacks that hold on a theme that declares no recipe at all.
12
- *
13
- * The block does not break the page after itself: a paragraph can only break
14
- * before, and a break before the first paragraph of a new section is a blank
15
- * page. Put the cover in a section of its own and the report proper starts
16
- * on a fresh page with its own running head.
17
- */
18
- import type { CoverProps } from '@json-to-office/shared-docx';
19
- import type { ThemeConfig } from '../styles';
20
- import type { BlockCompilation } from './types';
21
- export declare function compileCover(props: CoverProps, theme: ThemeConfig): BlockCompilation;
22
- //# sourceMappingURL=cover.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../src/blocks/cover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgBhD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,WAAW,GACjB,gBAAgB,CA4HlB"}
@@ -1,20 +0,0 @@
1
- /**
2
- * The `key-takeaways` block, lowered to primitives.
3
- *
4
- * A rule in the theme's accent, a label in the theme's label role, the
5
- * takeaways as a list the theme's list defaults already style, and a hairline
6
- * to close the box. Nothing here is a coordinate or a colour of its own:
7
- * every value is read from the resolved theme's `chrome.keyTakeaways` recipe,
8
- * with defaults that hold on a theme that declares none, so the same block
9
- * looks like the house on `consulting` and like itself on any other theme.
10
- *
11
- * The compiled children carry a source map back to the slots — the label to
12
- * `/props/label`, the list items to `/props/items` — so a finding on a
13
- * compiled paragraph is reported at the takeaway the author can patch.
14
- */
15
- import type { KeyTakeawaysProps } from '@json-to-office/shared-docx';
16
- import type { ThemeConfig } from '../styles';
17
- import type { BlockCompilation } from './types';
18
- export declare const KEY_TAKEAWAYS_DEFAULT_LABEL = "Key takeaways";
19
- export declare function compileKeyTakeaways(props: KeyTakeawaysProps, theme: ThemeConfig): BlockCompilation;
20
- //# sourceMappingURL=keyTakeaways.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyTakeaways.d.ts","sourceRoot":"","sources":["../../src/blocks/keyTakeaways.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAU3D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,WAAW,GACjB,gBAAgB,CA+DlB"}
@@ -1,31 +0,0 @@
1
- /**
2
- * What every block reads from the theme, and how it falls back.
3
- *
4
- * A block never states a size, a colour or a coordinate of its own: it names a
5
- * type role and a chrome recipe, and the resolved theme supplies the values.
6
- * On a theme that declares neither, the block still has to draw — so each
7
- * helper here carries the plain fallback that holds anywhere: a named style
8
- * when the theme resolved one, explicit run formatting when it did not.
9
- */
10
- import type { ThemeConfig } from '../styles';
11
- /** What a block's rule may weigh: the `divider` component's whole range. */
12
- export declare const MIN_RULE_PT = 0.25;
13
- export declare const MAX_RULE_PT = 12;
14
- export declare function clampRule(weightPt: number): number;
15
- /** The eyebrow a theme without the role gets: small, bold, accent, caps. */
16
- export declare const FALLBACK_EYEBROW_FONT: {
17
- readonly size: 9;
18
- readonly bold: true;
19
- readonly color: "accent";
20
- readonly case: "upper";
21
- };
22
- /** Whether the resolved theme carries a named style for `role`. */
23
- export declare function hasStyle(theme: ThemeConfig, role: string): boolean;
24
- /**
25
- * The paragraph props that set text in `role`: `themeStyle` when the theme
26
- * resolved that role, else the explicit `font` the caller falls back to. A
27
- * recipe colour, when given, is stated either way — it is the theme's own
28
- * word on the matter.
29
- */
30
- export declare function roleProps(theme: ThemeConfig, role: string, fallbackFont: Record<string, unknown>, color?: string): Record<string, unknown>;
31
- //# sourceMappingURL=recipe.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../../src/blocks/recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,4EAA4E;AAC5E,eAAO,MAAM,WAAW,OAAO,CAAC;AAChC,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB"}
@@ -1,69 +0,0 @@
1
- /**
2
- * The `running-head` block, lowered to page chrome.
3
- *
4
- * Unlike the flow blocks, this one lowers to nothing where it stands: its
5
- * output is a header and a footer for the section it sits in and every later
6
- * section that authors no chrome of its own. The header is the document
7
- * title on the left and the section tracker on the right, set in the
8
- * `chrome.runningHead` recipe's role with a rule beneath; the footer is a
9
- * rule, then the confidentiality line, the page as `n / N` and the date, set
10
- * in the `chrome.confidentialFooter` recipe's role. Two or three parts sit
11
- * on tab stops at the section's measure, so the tracker is flush with the
12
- * right margin and the page number centred whatever the text around it. A
13
- * lone page number stays centred; a lone text part takes the recipe's
14
- * `alignment`.
15
- *
16
- * `{PAGE}` and `{TOTAL_PAGES}` are the pipeline's own placeholders: they
17
- * lower to Word fields, which is the only way a page can know its number.
18
- * Word counts from the first page of the document, cover included.
19
- */
20
- import type { RunningHeadProps } from '@json-to-office/shared-docx';
21
- import type { ThemeConfig } from '../styles';
22
- import type { BlockCompilation } from './types';
23
- /** What one section tells the running head about itself. */
24
- export interface RunningHeadScope {
25
- /** Authored pointer of the block, where chrome findings land by default. */
26
- block: string;
27
- /** The document's `metadata.title`, the header's left text by default. */
28
- documentTitle?: string;
29
- /**
30
- * The section's own tracker, from its `section-opener`, with the absolute
31
- * authored pointer of the slot it came from.
32
- */
33
- opener?: {
34
- text: string;
35
- slot: string;
36
- };
37
- /** The section's `props.page` override, if it has one. */
38
- page?: SectionPage;
39
- }
40
- /** The part of a section's `props.page` the measure depends on. */
41
- export interface SectionPage {
42
- size?: 'A4' | 'A3' | 'LETTER' | 'LEGAL' | {
43
- width: number;
44
- height: number;
45
- };
46
- margins?: {
47
- left?: number;
48
- right?: number;
49
- };
50
- }
51
- /** Header and footer, each as a compilation relative to its own array. */
52
- export interface RunningHeadCompilation {
53
- header: BlockCompilation;
54
- footer: BlockCompilation;
55
- }
56
- export declare const PAGE_OF_TOTAL = "{PAGE} / {TOTAL_PAGES}";
57
- /**
58
- * The text measure a section's chrome is laid out on: the theme's page,
59
- * unless the section overrides its size or side margins.
60
- */
61
- export declare function sectionMeasureTwips(theme: ThemeConfig, page?: SectionPage): number;
62
- /**
63
- * Lower a running head for one section. Every emitted pointer maps to the
64
- * slot whose text it carries — the opener's tracker when one set it, else
65
- * this block's own slot — so a finding on the compiled chrome lands where the
66
- * author can patch it.
67
- */
68
- export declare function compileRunningHead(props: RunningHeadProps, theme: ThemeConfig, scope: RunningHeadScope): RunningHeadCompilation;
69
- //# sourceMappingURL=runningHead.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runningHead.d.ts","sourceRoot":"","sources":["../../src/blocks/runningHead.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAK7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,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;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AASD,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,IAAI,CAAC,EAAE,WAAW,GACjB,MAAM,CAWR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,gBAAgB,GACtB,sBAAsB,CA2GxB"}
@@ -1,26 +0,0 @@
1
- /**
2
- * The `section-opener` block, lowered to primitives.
3
- *
4
- * The number as an eyebrow in the theme's `eyebrow` role, then the title as
5
- * a level-1 heading — a real heading, so the table of contents, heading
6
- * numbering and cross-references all see the section the way Word does. The
7
- * tracker is not drawn in the flow at all: it is what the running head in
8
- * force reads for the enclosing section, resolved by {@link sectionTracker}.
9
- */
10
- import type { SectionOpenerProps } from '@json-to-office/shared-docx';
11
- import type { ThemeConfig } from '../styles';
12
- import type { BlockCompilation } from './types';
13
- export declare function compileSectionOpener(props: SectionOpenerProps, theme: ThemeConfig): BlockCompilation;
14
- /**
15
- * The tracker a section shows in its running head: the first enabled
16
- * `section-opener` among its direct children, its `tracker` or, failing that,
17
- * its `title`. Returns the authored pointer of the slot the text came from,
18
- * relative to the section, so chrome findings can point at it.
19
- */
20
- export declare function sectionTracker(section: {
21
- children?: unknown;
22
- }): {
23
- text: string;
24
- slot: string;
25
- } | undefined;
26
- //# sourceMappingURL=sectionOpener.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sectionOpener.d.ts","sourceRoot":"","sources":["../../src/blocks/sectionOpener.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,WAAW,GACjB,gBAAgB,CAiClB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAqB7C"}
@@ -1,15 +0,0 @@
1
- import type { ComponentDefinition } from '../types';
2
- /**
3
- * What lowering one block produces: the primitives, in flow order, and a
4
- * source map from each emitted pointer to the authored one it came from.
5
- *
6
- * Pointers are relative to the block node. A value of `''` maps an emitted
7
- * node to the block itself; a slot pointer such as `/props/items` maps an
8
- * emitted region onto the authored slot, and anything beneath it (`/props/
9
- * items/2`) carries the remainder across unchanged.
10
- */
11
- export interface BlockCompilation {
12
- children: ComponentDefinition[];
13
- sourceMap: Readonly<Record<string, string>>;
14
- }
15
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/blocks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC7C"}