@json-to-office/core-docx 1.3.0 → 1.4.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.
@@ -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;AA6B3D,wBAAgB,oBAAoB,IAAI,YAAY,CA0BnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,SAAS,GAAE,aAAyB,GACnC,QAAQ,CA2CV"}
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;AAwC1E,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
+ {"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 an optional backend is only
5
- * imported when it is actually selected — choosing `docxjs` never loads
6
- * `@office-open/docx`, and a missing optional dependency surfaces as an
7
- * actionable install hint rather than a bare module-resolution failure.
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;;;;;;;GAOG;AAKH,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,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE"}
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
- import type { DocxIrStyles } from '../ir/types';
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;AAWH,OAAO,KAAK,EAQV,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"}
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"}
@@ -102,8 +102,7 @@
102
102
  },
103
103
  "list": {
104
104
  "format": "bullet",
105
- "bullet": "\u2022",
106
- "indent": 3
105
+ "bullet": "\u2022"
107
106
  },
108
107
  "image": {
109
108
  "alignment": "center"
@@ -102,8 +102,7 @@
102
102
  },
103
103
  "list": {
104
104
  "format": "bullet",
105
- "bullet": "\u2022",
106
- "indent": 3
105
+ "bullet": "\u2022"
107
106
  },
108
107
  "statistic": {
109
108
  "alignment": "center"
@@ -110,8 +110,7 @@
110
110
  },
111
111
  "list": {
112
112
  "format": "bullet",
113
- "bullet": "\u2013",
114
- "indent": 3
113
+ "bullet": "\u2013"
115
114
  },
116
115
  "image": {
117
116
  "alignment": "center"
@@ -170,8 +170,7 @@
170
170
  },
171
171
  "list": {
172
172
  "format": "bullet",
173
- "bullet": "•",
174
- "indent": 3
173
+ "bullet": "•"
175
174
  },
176
175
  "image": {
177
176
  "alignment": "left"
@@ -94,8 +94,7 @@
94
94
  },
95
95
  "list": {
96
96
  "format": "bullet",
97
- "bullet": "\u2013",
98
- "indent": 3
97
+ "bullet": "\u2013"
99
98
  },
100
99
  "image": {
101
100
  "alignment": "center"