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