@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
@@ -1,186 +0,0 @@
1
- import { p } from "./browser-DkKxreJM.js";
2
- import { h as y } from "./toc-B6VpkJge.js";
3
- function d(a, e) {
4
- return a.styles.find((t) => t.id === e);
5
- }
6
- function l(a, e) {
7
- const t = [], s = /* @__PURE__ */ new Set();
8
- for (let r = d(a, e); r && !s.has(r.id); r = r.basedOn ? d(a, r.basedOn) : void 0)
9
- s.add(r.id), t.unshift(r);
10
- const i = {}, n = {};
11
- for (const r of t)
12
- Object.assign(i, c(r.char)), Object.assign(n, c(r.para));
13
- return { char: i, para: n };
14
- }
15
- function c(a) {
16
- const e = {};
17
- for (const [t, s] of Object.entries(a))
18
- s !== void 0 && (e[t] = s);
19
- return e;
20
- }
21
- function S(a, e) {
22
- return p(a).filter((t) => t.style.namedStyle === e);
23
- }
24
- function x() {
25
- return {
26
- defaultStyleId: "Normal",
27
- styles: [
28
- {
29
- id: "Normal",
30
- name: "Normal",
31
- char: { fontFamily: "Georgia, serif", fontSizePx: 16, bold: !1, italic: !1, color: "#202124" },
32
- para: { ...{ lineHeight: 1.5, spaceBeforePx: 0, spaceAfterPx: 12 }, align: "left", indentFirstLinePx: 0 }
33
- },
34
- {
35
- id: "Title",
36
- name: "Title",
37
- basedOn: "Normal",
38
- char: { fontFamily: "Arial, sans-serif", fontSizePx: 32, bold: !0, color: "#1a1a2e" },
39
- para: { align: "center", spaceAfterPx: 4 }
40
- },
41
- {
42
- id: "Subtitle",
43
- name: "Subtitle",
44
- basedOn: "Normal",
45
- char: { italic: !0, color: "#5f6368" },
46
- para: { align: "center", spaceAfterPx: 28 }
47
- },
48
- {
49
- id: "Heading1",
50
- name: "Heading 1",
51
- basedOn: "Normal",
52
- char: { fontFamily: "Arial, sans-serif", fontSizePx: 24, bold: !0, color: "#1a1a2e" },
53
- para: { spaceBeforePx: 18, spaceAfterPx: 8, keepWithNext: !0 }
54
- },
55
- {
56
- id: "Heading2",
57
- name: "Heading 2",
58
- basedOn: "Heading1",
59
- char: { fontSizePx: 19 },
60
- para: { spaceBeforePx: 14, spaceAfterPx: 6 }
61
- },
62
- {
63
- id: "Quote",
64
- name: "Quote",
65
- basedOn: "Normal",
66
- char: { italic: !0, color: "#5f6368" },
67
- para: { indentLeftPx: 36, spaceBeforePx: 8, spaceAfterPx: 8 }
68
- },
69
- {
70
- id: "Code",
71
- name: "Code",
72
- basedOn: "Normal",
73
- char: { fontFamily: "Consolas, monospace", fontSizePx: 14, color: "#0b57d0" },
74
- para: { lineHeight: 1.35 }
75
- }
76
- ]
77
- };
78
- }
79
- const o = { color: "#d0d4d9", widthPx: 1 }, u = { top: o, right: o, bottom: o, left: o };
80
- function g() {
81
- return /* @__PURE__ */ new Map([
82
- ["plain", {}],
83
- ["grid", { borders: u }],
84
- ["headerBand", { headerRow: !0, headerShading: "#1a73e8", headerChar: { color: "#ffffff", bold: !0 }, borders: u }],
85
- ["striped", { headerRow: !0, headerShading: "#e8f0fe", headerChar: { bold: !0 }, stripeShading: "#f6f9fe" }]
86
- ]);
87
- }
88
- const h = {
89
- fontFamily: "Georgia, serif",
90
- fontSizePx: 16,
91
- bold: !1,
92
- italic: !1,
93
- underline: !1,
94
- strikethrough: !1,
95
- color: "#202124"
96
- }, f = {
97
- align: "left",
98
- lineHeight: 1.5,
99
- spaceBeforePx: 0,
100
- spaceAfterPx: 12,
101
- indentFirstLinePx: 0,
102
- indentLeftPx: 0
103
- };
104
- function P(a, e) {
105
- const t = a.stylesheet ? l(a.stylesheet, a.stylesheet.defaultStyleId) : { char: {}, para: {} };
106
- return {
107
- kind: "paragraph",
108
- id: e,
109
- revision: 0,
110
- runs: [{ text: "", style: { ...h, ...t.char } }],
111
- style: { ...f, ...t.para }
112
- };
113
- }
114
- class A {
115
- ids;
116
- doc;
117
- warnings = [];
118
- seenWarnings = /* @__PURE__ */ new Set();
119
- /** Concrete defaults for new runs/paragraphs (default style resolved). */
120
- charDefault;
121
- paraDefault;
122
- /** Footnote marker counter — monotonic in insertion order (.footnote()). */
123
- footnoteCounter = 0;
124
- /** Builder-only table-style presets (seeded with built-ins; .tableStylePreset adds). */
125
- tableStyles = g();
126
- constructor(e, t) {
127
- this.doc = e, this.ids = y(t ?? `bld${Math.random().toString(36).slice(2, 6)}`);
128
- const s = e.stylesheet ? l(e.stylesheet, e.stylesheet.defaultStyleId) : { char: {}, para: {} };
129
- this.charDefault = { ...h, ...s.char }, this.paraDefault = { ...f, ...s.para };
130
- }
131
- /** Next footnote marker number (1-based, insertion order). */
132
- nextFootnoteNumber() {
133
- return ++this.footnoteCounter;
134
- }
135
- /** Recompute the run/paragraph defaults from the current stylesheet's default
136
- * style — called when .defaultStyle() changes which style is the baseline. */
137
- refreshDefaults() {
138
- const e = this.doc.stylesheet ? l(this.doc.stylesheet, this.doc.stylesheet.defaultStyleId) : { char: {}, para: {} };
139
- this.charDefault = { ...h, ...e.char }, this.paraDefault = { ...f, ...e.para };
140
- }
141
- /** A registered table-style preset by name, or undefined (+ warning). */
142
- tableStyle(e) {
143
- const t = this.tableStyles.get(e);
144
- return t || this.warn(`table-style-missing:${e}`, `Table style "${e}" is not registered — .table({ style: "${e}" }) used no preset.`), t;
145
- }
146
- warn(e, t) {
147
- this.seenWarnings.has(e) || (this.seenWarnings.add(e), this.warnings.push({ code: e, message: t }));
148
- }
149
- run(e, t = {}) {
150
- return { text: e, style: { ...this.charDefault, ...t } };
151
- }
152
- paragraph(e, t = {}) {
153
- return {
154
- kind: "paragraph",
155
- id: this.ids.next(),
156
- revision: 0,
157
- runs: e.length > 0 ? e : [this.run("")],
158
- style: { ...this.paraDefault, ...t }
159
- };
160
- }
161
- image(e, t, s, i, n) {
162
- const r = { kind: "image", id: this.ids.next(), revision: 0, src: e, widthPx: t, heightPx: s, align: i };
163
- return n && (r.wrap = n), r;
164
- }
165
- /** The stylesheet, creating an empty one on demand for style registration. */
166
- stylesheet() {
167
- return this.doc.stylesheet || (this.doc.stylesheet = { styles: [], defaultStyleId: "Normal" }), this.doc.stylesheet;
168
- }
169
- /** Resolved char+para templates for a named style, or undefined (+ warning). */
170
- lookupStyle(e) {
171
- const t = this.doc.stylesheet;
172
- if (!t || !d(t, e)) {
173
- this.warn(`style-missing:${e}`, `Named style "${e}" is not in the stylesheet — .withStyle("${e}") was ignored.`);
174
- return;
175
- }
176
- return l(t, e);
177
- }
178
- }
179
- export {
180
- A as B,
181
- x as d,
182
- P as e,
183
- S as p,
184
- l as r,
185
- d as s
186
- };