@forevka/wordcanvas 0.7.0 → 0.7.2

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 (66) hide show
  1. package/README.md +48 -1
  2. package/dist-lib/assets/{worker-BsOsK39A.js → worker-4HYrkNrG.js} +12276 -11981
  3. package/dist-lib/assets/worker-CJpwUzKh.js +2403 -0
  4. package/dist-lib/blockFactory-B_CLnkUh.js +106 -0
  5. package/dist-lib/browser-p_rkUcqE.js +1339 -0
  6. package/dist-lib/builder.js +365 -109
  7. package/dist-lib/editorApp-mTD0YNv-.js +9863 -0
  8. package/dist-lib/export.js +4670 -4567
  9. package/dist-lib/generate-toc.js +5 -5
  10. package/dist-lib/import.js +4 -1538
  11. package/dist-lib/{lists-BegzmTmD.js → lists-Sc5I40JO.js} +2 -2
  12. package/dist-lib/measure.js +2 -2
  13. package/dist-lib/{measureHost-CMiJKdlk.js → measureHost-B2aKX7lF.js} +1 -1
  14. package/dist-lib/metrics-BUMIC9Mv.js +164 -0
  15. package/dist-lib/pipeline-DD0nxAYM.js +1850 -0
  16. package/dist-lib/recalc-docx.js +2 -2
  17. package/dist-lib/recalcToc-CFCGCgij.js +3985 -0
  18. package/dist-lib/styleProps-DhqDEfvc.js +149 -0
  19. package/dist-lib/stylesheet-B6oczA-L.js +141 -0
  20. package/dist-lib/toc-Dj57zdz-.js +213 -0
  21. package/dist-lib/{webmcp-B7Gvd58E.js → webmcp-CXghUon_.js} +2 -2
  22. package/dist-lib/{wordcanvas-BAxBeErX.js → wordcanvas-D5DI9ZR1.js} +49 -23
  23. package/dist-lib/wordcanvas.js +1 -1
  24. package/dist-node/{chunk-GXFDF7UY.js → chunk-57L5XMCL.js} +327 -59
  25. package/dist-node/chunk-57L5XMCL.js.map +7 -0
  26. package/dist-node/{chunk-TBSXA2I4.js → chunk-EGSAVPCC.js} +1 -1
  27. package/dist-node/chunk-EGSAVPCC.js.map +7 -0
  28. package/dist-node/{chunk-4PDVRJF6.js → chunk-EMY2P524.js} +32 -2
  29. package/dist-node/chunk-EMY2P524.js.map +7 -0
  30. package/dist-node/{chunk-2RCPB7UZ.js → chunk-KJV7GJ3H.js} +1 -1
  31. package/dist-node/chunk-KJV7GJ3H.js.map +7 -0
  32. package/dist-node/{chunk-XDUDPPJW.js → chunk-PIMVQULL.js} +93 -24
  33. package/dist-node/chunk-PIMVQULL.js.map +7 -0
  34. package/dist-node/{chunk-BRAPV465.js → chunk-SA26UVIJ.js} +2 -2
  35. package/dist-node/{chunk-IJLL6IFJ.js → chunk-T3253N22.js} +202 -13
  36. package/dist-node/{chunk-IJLL6IFJ.js.map → chunk-T3253N22.js.map} +2 -2
  37. package/dist-node/{chunk-4ICCHZX4.js → chunk-U27EBKBG.js} +37 -1
  38. package/dist-node/chunk-U27EBKBG.js.map +7 -0
  39. package/dist-node/{engine-FRCX7PXF.js → engine-5F7DUU4W.js} +4 -4
  40. package/dist-node/export.js +178 -52
  41. package/dist-node/export.js.map +2 -2
  42. package/dist-node/generate-toc.js +7 -7
  43. package/dist-node/import.js +3 -3
  44. package/dist-node/measure.js +2 -2
  45. package/dist-node/recalc-docx.js +5 -5
  46. package/dist-node/recalc-docx.js.map +1 -1
  47. package/package.json +1 -1
  48. package/types/model.d.ts +277 -225
  49. package/types/recalc-docx.d.ts +27 -27
  50. package/types/wordcanvas.d.ts +212 -157
  51. package/dist-lib/assets/worker-BbFAIxdy.js +0 -2163
  52. package/dist-lib/blockFactory-Bcy0U40y.js +0 -178
  53. package/dist-lib/browser-5Sv4CuNy.js +0 -1284
  54. package/dist-lib/editorApp-DvjFPHiy.js +0 -7582
  55. package/dist-lib/metrics-CkAo4zh8.js +0 -143
  56. package/dist-lib/recalcToc-uaLWt59L.js +0 -3835
  57. package/dist-lib/styleProps-Db5pEkG8.js +0 -127
  58. package/dist-lib/toc-CZel_Kk3.js +0 -127
  59. package/dist-node/chunk-2RCPB7UZ.js.map +0 -7
  60. package/dist-node/chunk-4ICCHZX4.js.map +0 -7
  61. package/dist-node/chunk-4PDVRJF6.js.map +0 -7
  62. package/dist-node/chunk-GXFDF7UY.js.map +0 -7
  63. package/dist-node/chunk-TBSXA2I4.js.map +0 -7
  64. package/dist-node/chunk-XDUDPPJW.js.map +0 -7
  65. /package/dist-node/{chunk-BRAPV465.js.map → chunk-SA26UVIJ.js.map} +0 -0
  66. /package/dist-node/{engine-FRCX7PXF.js.map → engine-5F7DUU4W.js.map} +0 -0
@@ -0,0 +1,106 @@
1
+ import { b as i, s as u } from "./stylesheet-B6oczA-L.js";
2
+ import { h as y } from "./toc-Dj57zdz-.js";
3
+ const a = { color: "#d0d4d9", widthPx: 1 }, d = { top: a, right: a, bottom: a, left: a };
4
+ function c() {
5
+ return /* @__PURE__ */ new Map([
6
+ ["plain", {}],
7
+ ["grid", { borders: d }],
8
+ ["headerBand", { headerRow: !0, headerShading: "#1a73e8", headerChar: { color: "#ffffff", bold: !0 }, borders: d }],
9
+ ["striped", { headerRow: !0, headerShading: "#e8f0fe", headerChar: { bold: !0 }, stripeShading: "#f6f9fe" }]
10
+ ]);
11
+ }
12
+ const l = {
13
+ fontFamily: "Georgia, serif",
14
+ fontSizePx: 16,
15
+ bold: !1,
16
+ italic: !1,
17
+ underline: !1,
18
+ strikethrough: !1,
19
+ color: "#202124"
20
+ }, n = {
21
+ align: "left",
22
+ lineHeight: 1.5,
23
+ spaceBeforePx: 0,
24
+ spaceAfterPx: 12,
25
+ indentFirstLinePx: 0,
26
+ indentLeftPx: 0
27
+ };
28
+ function S(s, e) {
29
+ const t = s.stylesheet ? i(s.stylesheet, s.stylesheet.defaultStyleId) : { char: {}, para: {} };
30
+ return {
31
+ kind: "paragraph",
32
+ id: e,
33
+ revision: 0,
34
+ runs: [{ text: "", style: { ...l, ...t.char } }],
35
+ style: { ...n, ...t.para }
36
+ };
37
+ }
38
+ class b {
39
+ ids;
40
+ doc;
41
+ warnings = [];
42
+ seenWarnings = /* @__PURE__ */ new Set();
43
+ /** Concrete defaults for new runs/paragraphs (default style resolved). */
44
+ charDefault;
45
+ paraDefault;
46
+ /** Footnote marker counter — monotonic in insertion order (.footnote()). */
47
+ footnoteCounter = 0;
48
+ /** Builder-only table-style presets (seeded with built-ins; .tableStylePreset adds). */
49
+ tableStyles = c();
50
+ constructor(e, t) {
51
+ this.doc = e, this.ids = y(t ?? `bld${Math.random().toString(36).slice(2, 6)}`);
52
+ const r = e.stylesheet ? i(e.stylesheet, e.stylesheet.defaultStyleId) : { char: {}, para: {} };
53
+ this.charDefault = { ...l, ...r.char }, this.paraDefault = { ...n, ...r.para };
54
+ }
55
+ /** Next footnote marker number (1-based, insertion order). */
56
+ nextFootnoteNumber() {
57
+ return ++this.footnoteCounter;
58
+ }
59
+ /** Recompute the run/paragraph defaults from the current stylesheet's default
60
+ * style — called when .defaultStyle() changes which style is the baseline. */
61
+ refreshDefaults() {
62
+ const e = this.doc.stylesheet ? i(this.doc.stylesheet, this.doc.stylesheet.defaultStyleId) : { char: {}, para: {} };
63
+ this.charDefault = { ...l, ...e.char }, this.paraDefault = { ...n, ...e.para };
64
+ }
65
+ /** A registered table-style preset by name, or undefined (+ warning). */
66
+ tableStyle(e) {
67
+ const t = this.tableStyles.get(e);
68
+ return t || this.warn(`table-style-missing:${e}`, `Table style "${e}" is not registered — .table({ style: "${e}" }) used no preset.`), t;
69
+ }
70
+ warn(e, t) {
71
+ this.seenWarnings.has(e) || (this.seenWarnings.add(e), this.warnings.push({ code: e, message: t }));
72
+ }
73
+ run(e, t = {}) {
74
+ return { text: e, style: { ...this.charDefault, ...t } };
75
+ }
76
+ paragraph(e, t = {}) {
77
+ return {
78
+ kind: "paragraph",
79
+ id: this.ids.next(),
80
+ revision: 0,
81
+ runs: e.length > 0 ? e : [this.run("")],
82
+ style: { ...this.paraDefault, ...t }
83
+ };
84
+ }
85
+ image(e, t, r, f, h) {
86
+ const o = { kind: "image", id: this.ids.next(), revision: 0, src: e, widthPx: t, heightPx: r, align: f };
87
+ return h && (o.wrap = h), o;
88
+ }
89
+ /** The stylesheet, creating an empty one on demand for style registration. */
90
+ stylesheet() {
91
+ return this.doc.stylesheet || (this.doc.stylesheet = { styles: [], defaultStyleId: "Normal" }), this.doc.stylesheet;
92
+ }
93
+ /** Resolved char+para templates for a named style, or undefined (+ warning). */
94
+ lookupStyle(e) {
95
+ const t = this.doc.stylesheet;
96
+ if (!t || !u(t, e)) {
97
+ this.warn(`style-missing:${e}`, `Named style "${e}" is not in the stylesheet — .withStyle("${e}") was ignored.`);
98
+ return;
99
+ }
100
+ return i(t, e);
101
+ }
102
+ }
103
+ export {
104
+ b as B,
105
+ S as e
106
+ };