@forevka/wordcanvas 0.7.1 → 0.7.3

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.
Files changed (64) hide show
  1. package/dist-lib/assets/{worker-D8rUOKfg.js → worker-CqU4Popa.js} +10903 -10736
  2. package/dist-lib/assets/worker-Cw5cYW5z.js +2418 -0
  3. package/dist-lib/blockFactory-DDCRWDnA.js +91 -0
  4. package/dist-lib/browser-BUrsjziD.js +612 -0
  5. package/dist-lib/builder.js +13 -13
  6. package/dist-lib/editorApp-CB_ZArIF.js +9566 -0
  7. package/dist-lib/export.js +4507 -4456
  8. package/dist-lib/generate-toc.js +7 -7
  9. package/dist-lib/import.js +2 -2
  10. package/dist-lib/lists-DpmgbDyt.js +110 -0
  11. package/dist-lib/measure.js +2 -2
  12. package/dist-lib/{measureHost-CMiJKdlk.js → measureHost-BlukHGwx.js} +1 -1
  13. package/dist-lib/metrics-bvGO8KDK.js +96 -0
  14. package/dist-lib/paintStyle-vT6jtWbH.js +74 -0
  15. package/dist-lib/pipeline-UryP-u7Z.js +1850 -0
  16. package/dist-lib/recalc-docx.js +2 -2
  17. package/dist-lib/recalcToc-BfXlXZik.js +3985 -0
  18. package/dist-lib/styleProps-DhqDEfvc.js +149 -0
  19. package/dist-lib/stylesheet-LTBEGkvG.js +146 -0
  20. package/dist-lib/toc-D09f4PrI.js +939 -0
  21. package/dist-lib/{webmcp-6WxRNKCc.js → webmcp-K6UZgQJ0.js} +60 -68
  22. package/dist-lib/wordcanvas-DBx2ana_.js +734 -0
  23. package/dist-lib/wordcanvas.js +4 -2
  24. package/dist-node/{chunk-CDN6WU2P.js → chunk-373K2XRY.js} +40 -22
  25. package/dist-node/chunk-373K2XRY.js.map +7 -0
  26. package/dist-node/{chunk-22JHAERT.js → chunk-3PUV3BG6.js} +235 -39
  27. package/dist-node/chunk-3PUV3BG6.js.map +7 -0
  28. package/dist-node/{chunk-4ICCHZX4.js → chunk-5RX3IHWE.js} +39 -3
  29. package/dist-node/chunk-5RX3IHWE.js.map +7 -0
  30. package/dist-node/{chunk-4PDVRJF6.js → chunk-EMY2P524.js} +32 -2
  31. package/dist-node/chunk-EMY2P524.js.map +7 -0
  32. package/dist-node/{chunk-BRAPV465.js → chunk-HWQKGDS2.js} +2 -2
  33. package/dist-node/{chunk-6AJJMHKY.js → chunk-KJV7GJ3H.js} +1 -1
  34. package/dist-node/chunk-KJV7GJ3H.js.map +7 -0
  35. package/dist-node/{chunk-RNB336F3.js → chunk-ZLLSXOO2.js} +92 -14
  36. package/dist-node/{chunk-RNB336F3.js.map → chunk-ZLLSXOO2.js.map} +2 -2
  37. package/dist-node/{engine-5FGDJD2H.js → engine-LLA6PCS5.js} +4 -4
  38. package/dist-node/export.js +89 -24
  39. package/dist-node/export.js.map +2 -2
  40. package/dist-node/generate-toc.js +6 -6
  41. package/dist-node/import.js +3 -3
  42. package/dist-node/measure.js +2 -2
  43. package/dist-node/recalc-docx.js +4 -4
  44. package/package.json +1 -1
  45. package/types/model.d.ts +46 -0
  46. package/types/wordcanvas.d.ts +493 -1
  47. package/dist-lib/assets/worker-wXuuyshQ.js +0 -2258
  48. package/dist-lib/blockFactory-CUI4Rqiq.js +0 -186
  49. package/dist-lib/browser-DkKxreJM.js +0 -1305
  50. package/dist-lib/editorApp-DLXMmtu5.js +0 -8023
  51. package/dist-lib/lists-Sc5I40JO.js +0 -110
  52. package/dist-lib/metrics-CkAo4zh8.js +0 -143
  53. package/dist-lib/pipeline-CbxmCE84.js +0 -1705
  54. package/dist-lib/recalcToc-g1hFKSNs.js +0 -3935
  55. package/dist-lib/styleProps-Db5pEkG8.js +0 -127
  56. package/dist-lib/toc-B6VpkJge.js +0 -213
  57. package/dist-lib/wordcanvas-CFqpDK0k.js +0 -125
  58. package/dist-node/chunk-22JHAERT.js.map +0 -7
  59. package/dist-node/chunk-4ICCHZX4.js.map +0 -7
  60. package/dist-node/chunk-4PDVRJF6.js.map +0 -7
  61. package/dist-node/chunk-6AJJMHKY.js.map +0 -7
  62. package/dist-node/chunk-CDN6WU2P.js.map +0 -7
  63. /package/dist-node/{chunk-BRAPV465.js.map → chunk-HWQKGDS2.js.map} +0 -0
  64. /package/dist-node/{engine-5FGDJD2H.js.map → engine-LLA6PCS5.js.map} +0 -0
@@ -6,17 +6,17 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  runImport
9
- } from "./chunk-22JHAERT.js";
9
+ } from "./chunk-3PUV3BG6.js";
10
10
  import {
11
11
  el,
12
12
  escapeText,
13
13
  paraCoreXml,
14
14
  runPropsXml,
15
15
  textEl
16
- } from "./chunk-4PDVRJF6.js";
16
+ } from "./chunk-EMY2P524.js";
17
17
  import {
18
18
  findMainDocumentPart
19
- } from "./chunk-6AJJMHKY.js";
19
+ } from "./chunk-KJV7GJ3H.js";
20
20
  import {
21
21
  pageOfBlockMap
22
22
  } from "./chunk-EGSAVPCC.js";
@@ -28,15 +28,15 @@ import {
28
28
  } from "./chunk-5PUCGN47.js";
29
29
  import {
30
30
  createLayoutEngine
31
- } from "./chunk-RNB336F3.js";
31
+ } from "./chunk-ZLLSXOO2.js";
32
32
  import {
33
33
  detectTocHeadings,
34
34
  inRange,
35
35
  parseTocInstruction,
36
36
  textOfRuns,
37
37
  tocEntryStyle
38
- } from "./chunk-CDN6WU2P.js";
39
- import "./chunk-4ICCHZX4.js";
38
+ } from "./chunk-373K2XRY.js";
39
+ import "./chunk-5RX3IHWE.js";
40
40
  import "./chunk-XSRSBST2.js";
41
41
 
42
42
  // src/recalc/generateTocDocx.ts
@@ -6,10 +6,10 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  runImport
9
- } from "./chunk-22JHAERT.js";
10
- import "./chunk-6AJJMHKY.js";
9
+ } from "./chunk-3PUV3BG6.js";
10
+ import "./chunk-KJV7GJ3H.js";
11
11
  import "./chunk-5PUCGN47.js";
12
- import "./chunk-CDN6WU2P.js";
12
+ import "./chunk-373K2XRY.js";
13
13
  import "./chunk-XSRSBST2.js";
14
14
  export {
15
15
  runImport
@@ -6,8 +6,8 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  installMeasureHost
9
- } from "./chunk-BRAPV465.js";
10
- import "./chunk-4ICCHZX4.js";
9
+ } from "./chunk-HWQKGDS2.js";
10
+ import "./chunk-5RX3IHWE.js";
11
11
  import "./chunk-XSRSBST2.js";
12
12
  export {
13
13
  installMeasureHost
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  findMainDocumentPart
9
- } from "./chunk-6AJJMHKY.js";
9
+ } from "./chunk-KJV7GJ3H.js";
10
10
  import {
11
11
  pageOfBlockMap
12
12
  } from "./chunk-EGSAVPCC.js";
@@ -18,9 +18,9 @@ import {
18
18
  } from "./chunk-5PUCGN47.js";
19
19
  import {
20
20
  createLayoutEngine
21
- } from "./chunk-RNB336F3.js";
22
- import "./chunk-CDN6WU2P.js";
23
- import "./chunk-4ICCHZX4.js";
21
+ } from "./chunk-ZLLSXOO2.js";
22
+ import "./chunk-373K2XRY.js";
23
+ import "./chunk-5RX3IHWE.js";
24
24
  import "./chunk-XSRSBST2.js";
25
25
 
26
26
  // src/recalc/patchTocDocx.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forevka/wordcanvas",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "description": "Open-source embeddable Word-style document editor: canvas-rendered, with live collaboration, track changes & comments, and DOCX/PDF import & export. A lightweight alternative to Syncfusion, OnlyOffice, and DevExpress document editors. Self-contained, zero runtime dependencies.",
6
6
  "license": "MIT",
package/types/model.d.ts CHANGED
@@ -25,6 +25,9 @@ export interface CharStyle {
25
25
  footnoteRef?: string | undefined;
26
26
  /** Content-control membership (properties live in Document.sdts). */
27
27
  sdtId?: string | undefined;
28
+ /** Character-style reference (w:rStyle → a type==="character" NamedStyle).
29
+ * Reference only — concrete formatting stays baked on the run. */
30
+ charStyleId?: string | undefined;
28
31
  }
29
32
 
30
33
  export interface TabStop {
@@ -120,6 +123,15 @@ export interface TableRow {
120
123
  cells: TableCell[];
121
124
  }
122
125
 
126
+ export interface TableCondOverrides {
127
+ firstRow?: boolean;
128
+ lastRow?: boolean;
129
+ firstCol?: boolean;
130
+ lastCol?: boolean;
131
+ bandRows?: boolean;
132
+ bandCols?: boolean;
133
+ }
134
+
123
135
  export interface TableBlock {
124
136
  kind: "table";
125
137
  id: string;
@@ -127,10 +139,38 @@ export interface TableBlock {
127
139
  rows: TableRow[];
128
140
  /** Column widths as fractions of content width (sum = 1). Absent = equal. */
129
141
  colFractions?: number[];
142
+ /** Table-style reference (→ Document.tableStyles); effective cell formatting is baked. */
143
+ styleId?: string | undefined;
144
+ /** Which conditional bands of the referenced style are active (w:tblLook). */
145
+ condOverrides?: TableCondOverrides;
130
146
  }
131
147
 
132
148
  export type Block = Paragraph | ImageBlock | TableBlock;
133
149
 
150
+ /** Conditional-format slots of a table style (OOXML w:tblStylePr types). */
151
+ export type TableCond =
152
+ | "wholeTable"
153
+ | "firstRow" | "lastRow" | "firstCol" | "lastCol"
154
+ | "band1Horz" | "band2Horz" | "band1Vert" | "band2Vert"
155
+ | "nwCell" | "neCell" | "swCell" | "seCell";
156
+
157
+ export interface TableCondProps {
158
+ char?: Partial<CharStyle>;
159
+ para?: Partial<ParaStyle>;
160
+ shading?: string;
161
+ borders?: CellBorders;
162
+ margin?: CellMargin;
163
+ }
164
+
165
+ export interface TableStyle {
166
+ id: string;
167
+ name: string;
168
+ basedOn?: string;
169
+ conds: Partial<Record<TableCond, TableCondProps>>;
170
+ rowBandSize?: number;
171
+ colBandSize?: number;
172
+ }
173
+
134
174
  export type BandContainer = "header" | "footer" | "headerFirst" | "headerEven" | "footerFirst" | "footerEven";
135
175
 
136
176
  export interface SectionProps {
@@ -152,11 +192,15 @@ export interface SectionProps {
152
192
  footerEven?: Block[];
153
193
  }
154
194
 
195
+ export type NamedStyleType = "paragraph" | "character";
196
+
155
197
  export interface NamedStyle {
156
198
  /** Shares the docx styleId space ("Normal", "Heading1", …). */
157
199
  id: string;
158
200
  /** Display name. */
159
201
  name: string;
202
+ /** Paragraph vs character style. Optional; untyped styles read as "paragraph". */
203
+ type?: NamedStyleType;
160
204
  basedOn?: string;
161
205
  char: Partial<CharStyle>;
162
206
  para: Partial<ParaStyle>;
@@ -216,6 +260,8 @@ export interface Document {
216
260
  stylesheet?: Stylesheet;
217
261
  /** List definitions keyed by id. */
218
262
  lists?: Record<string, ListDefinition>;
263
+ /** Table styles keyed by id (docx styleId space). */
264
+ tableStyles?: Record<string, TableStyle>;
219
265
  /** Footnote bodies keyed by ref id. */
220
266
  footnotes?: Record<string, Paragraph[]>;
221
267
  /** Content-control properties keyed by sdtId. */