@forevka/wordcanvas 0.7.0 → 0.7.1

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 (47) hide show
  1. package/README.md +48 -1
  2. package/dist-lib/assets/{worker-BsOsK39A.js → worker-D8rUOKfg.js} +9603 -9451
  3. package/dist-lib/assets/worker-wXuuyshQ.js +2258 -0
  4. package/dist-lib/{blockFactory-Bcy0U40y.js → blockFactory-CUI4Rqiq.js} +50 -42
  5. package/dist-lib/{browser-5Sv4CuNy.js → browser-DkKxreJM.js} +404 -383
  6. package/dist-lib/builder.js +364 -109
  7. package/dist-lib/editorApp-DLXMmtu5.js +8023 -0
  8. package/dist-lib/export.js +3820 -3768
  9. package/dist-lib/generate-toc.js +4 -4
  10. package/dist-lib/import.js +4 -1538
  11. package/dist-lib/{lists-BegzmTmD.js → lists-Sc5I40JO.js} +2 -2
  12. package/dist-lib/pipeline-CbxmCE84.js +1705 -0
  13. package/dist-lib/recalc-docx.js +2 -2
  14. package/dist-lib/recalcToc-g1hFKSNs.js +3935 -0
  15. package/dist-lib/toc-B6VpkJge.js +213 -0
  16. package/dist-lib/{webmcp-B7Gvd58E.js → webmcp-6WxRNKCc.js} +2 -2
  17. package/dist-lib/{wordcanvas-BAxBeErX.js → wordcanvas-CFqpDK0k.js} +1 -1
  18. package/dist-lib/wordcanvas.js +1 -1
  19. package/dist-node/{chunk-GXFDF7UY.js → chunk-22JHAERT.js} +95 -23
  20. package/dist-node/chunk-22JHAERT.js.map +7 -0
  21. package/dist-node/{chunk-2RCPB7UZ.js → chunk-6AJJMHKY.js} +1 -1
  22. package/dist-node/chunk-6AJJMHKY.js.map +7 -0
  23. package/dist-node/{chunk-XDUDPPJW.js → chunk-CDN6WU2P.js} +89 -26
  24. package/dist-node/chunk-CDN6WU2P.js.map +7 -0
  25. package/dist-node/{chunk-TBSXA2I4.js → chunk-EGSAVPCC.js} +1 -1
  26. package/dist-node/chunk-EGSAVPCC.js.map +7 -0
  27. package/dist-node/{chunk-IJLL6IFJ.js → chunk-RNB336F3.js} +116 -5
  28. package/dist-node/{chunk-IJLL6IFJ.js.map → chunk-RNB336F3.js.map} +2 -2
  29. package/dist-node/{engine-FRCX7PXF.js → engine-5FGDJD2H.js} +3 -3
  30. package/dist-node/export.js +92 -31
  31. package/dist-node/export.js.map +2 -2
  32. package/dist-node/generate-toc.js +5 -5
  33. package/dist-node/import.js +3 -3
  34. package/dist-node/recalc-docx.js +4 -4
  35. package/dist-node/recalc-docx.js.map +1 -1
  36. package/package.json +1 -1
  37. package/types/model.d.ts +231 -225
  38. package/types/recalc-docx.d.ts +27 -27
  39. package/dist-lib/assets/worker-BbFAIxdy.js +0 -2163
  40. package/dist-lib/editorApp-DvjFPHiy.js +0 -7582
  41. package/dist-lib/recalcToc-uaLWt59L.js +0 -3835
  42. package/dist-lib/toc-CZel_Kk3.js +0 -127
  43. package/dist-node/chunk-2RCPB7UZ.js.map +0 -7
  44. package/dist-node/chunk-GXFDF7UY.js.map +0 -7
  45. package/dist-node/chunk-TBSXA2I4.js.map +0 -7
  46. package/dist-node/chunk-XDUDPPJW.js.map +0 -7
  47. /package/dist-node/{engine-FRCX7PXF.js.map → engine-5FGDJD2H.js.map} +0 -0
@@ -1,26 +1,27 @@
1
- import { p } from "./browser-5Sv4CuNy.js";
2
- function l(a, e) {
1
+ import { p } from "./browser-DkKxreJM.js";
2
+ import { h as y } from "./toc-B6VpkJge.js";
3
+ function d(a, e) {
3
4
  return a.styles.find((t) => t.id === e);
4
5
  }
5
- function o(a, e) {
6
+ function l(a, e) {
6
7
  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
+ for (let r = d(a, e); r && !s.has(r.id); r = r.basedOn ? d(a, r.basedOn) : void 0)
8
9
  s.add(r.id), t.unshift(r);
9
10
  const i = {}, n = {};
10
11
  for (const r of t)
11
- Object.assign(i, d(r.char)), Object.assign(n, d(r.para));
12
+ Object.assign(i, c(r.char)), Object.assign(n, c(r.para));
12
13
  return { char: i, para: n };
13
14
  }
14
- function d(a) {
15
+ function c(a) {
15
16
  const e = {};
16
17
  for (const [t, s] of Object.entries(a))
17
18
  s !== void 0 && (e[t] = s);
18
19
  return e;
19
20
  }
20
- function g(a, e) {
21
+ function S(a, e) {
21
22
  return p(a).filter((t) => t.style.namedStyle === e);
22
23
  }
23
- function m() {
24
+ function x() {
24
25
  return {
25
26
  defaultStyleId: "Normal",
26
27
  styles: [
@@ -75,23 +76,14 @@ function m() {
75
76
  ]
76
77
  };
77
78
  }
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;
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
+ ]);
95
87
  }
96
88
  const h = {
97
89
  fontFamily: "Georgia, serif",
@@ -101,7 +93,7 @@ const h = {
101
93
  underline: !1,
102
94
  strikethrough: !1,
103
95
  color: "#202124"
104
- }, u = {
96
+ }, f = {
105
97
  align: "left",
106
98
  lineHeight: 1.5,
107
99
  spaceBeforePx: 0,
@@ -109,14 +101,14 @@ const h = {
109
101
  indentFirstLinePx: 0,
110
102
  indentLeftPx: 0
111
103
  };
112
- function b(a, e) {
113
- const t = a.stylesheet ? o(a.stylesheet, a.stylesheet.defaultStyleId) : { char: {}, para: {} };
104
+ function P(a, e) {
105
+ const t = a.stylesheet ? l(a.stylesheet, a.stylesheet.defaultStyleId) : { char: {}, para: {} };
114
106
  return {
115
107
  kind: "paragraph",
116
108
  id: e,
117
109
  revision: 0,
118
110
  runs: [{ text: "", style: { ...h, ...t.char } }],
119
- style: { ...u, ...t.para }
111
+ style: { ...f, ...t.para }
120
112
  };
121
113
  }
122
114
  class A {
@@ -127,10 +119,29 @@ class A {
127
119
  /** Concrete defaults for new runs/paragraphs (default style resolved). */
128
120
  charDefault;
129
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();
130
126
  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 };
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;
134
145
  }
135
146
  warn(e, t) {
136
147
  this.seenWarnings.has(e) || (this.seenWarnings.add(e), this.warnings.push({ code: e, message: t }));
@@ -158,21 +169,18 @@ class A {
158
169
  /** Resolved char+para templates for a named style, or undefined (+ warning). */
159
170
  lookupStyle(e) {
160
171
  const t = this.doc.stylesheet;
161
- if (!t || !l(t, e)) {
172
+ if (!t || !d(t, e)) {
162
173
  this.warn(`style-missing:${e}`, `Named style "${e}" is not in the stylesheet — .withStyle("${e}") was ignored.`);
163
174
  return;
164
175
  }
165
- return o(t, e);
176
+ return l(t, e);
166
177
  }
167
178
  }
168
179
  export {
169
180
  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
181
+ x as d,
182
+ P as e,
183
+ S as p,
184
+ l as r,
185
+ d as s
178
186
  };