@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.
- package/README.md +48 -1
- package/dist-lib/assets/{worker-BsOsK39A.js → worker-D8rUOKfg.js} +9603 -9451
- package/dist-lib/assets/worker-wXuuyshQ.js +2258 -0
- package/dist-lib/{blockFactory-Bcy0U40y.js → blockFactory-CUI4Rqiq.js} +50 -42
- package/dist-lib/{browser-5Sv4CuNy.js → browser-DkKxreJM.js} +404 -383
- package/dist-lib/builder.js +364 -109
- package/dist-lib/editorApp-DLXMmtu5.js +8023 -0
- package/dist-lib/export.js +3820 -3768
- package/dist-lib/generate-toc.js +4 -4
- package/dist-lib/import.js +4 -1538
- package/dist-lib/{lists-BegzmTmD.js → lists-Sc5I40JO.js} +2 -2
- package/dist-lib/pipeline-CbxmCE84.js +1705 -0
- package/dist-lib/recalc-docx.js +2 -2
- package/dist-lib/recalcToc-g1hFKSNs.js +3935 -0
- package/dist-lib/toc-B6VpkJge.js +213 -0
- package/dist-lib/{webmcp-B7Gvd58E.js → webmcp-6WxRNKCc.js} +2 -2
- package/dist-lib/{wordcanvas-BAxBeErX.js → wordcanvas-CFqpDK0k.js} +1 -1
- package/dist-lib/wordcanvas.js +1 -1
- package/dist-node/{chunk-GXFDF7UY.js → chunk-22JHAERT.js} +95 -23
- package/dist-node/chunk-22JHAERT.js.map +7 -0
- package/dist-node/{chunk-2RCPB7UZ.js → chunk-6AJJMHKY.js} +1 -1
- package/dist-node/chunk-6AJJMHKY.js.map +7 -0
- package/dist-node/{chunk-XDUDPPJW.js → chunk-CDN6WU2P.js} +89 -26
- package/dist-node/chunk-CDN6WU2P.js.map +7 -0
- package/dist-node/{chunk-TBSXA2I4.js → chunk-EGSAVPCC.js} +1 -1
- package/dist-node/chunk-EGSAVPCC.js.map +7 -0
- package/dist-node/{chunk-IJLL6IFJ.js → chunk-RNB336F3.js} +116 -5
- package/dist-node/{chunk-IJLL6IFJ.js.map → chunk-RNB336F3.js.map} +2 -2
- package/dist-node/{engine-FRCX7PXF.js → engine-5FGDJD2H.js} +3 -3
- package/dist-node/export.js +92 -31
- package/dist-node/export.js.map +2 -2
- package/dist-node/generate-toc.js +5 -5
- package/dist-node/import.js +3 -3
- package/dist-node/recalc-docx.js +4 -4
- package/dist-node/recalc-docx.js.map +1 -1
- package/package.json +1 -1
- package/types/model.d.ts +231 -225
- package/types/recalc-docx.d.ts +27 -27
- package/dist-lib/assets/worker-BbFAIxdy.js +0 -2163
- package/dist-lib/editorApp-DvjFPHiy.js +0 -7582
- package/dist-lib/recalcToc-uaLWt59L.js +0 -3835
- package/dist-lib/toc-CZel_Kk3.js +0 -127
- package/dist-node/chunk-2RCPB7UZ.js.map +0 -7
- package/dist-node/chunk-GXFDF7UY.js.map +0 -7
- package/dist-node/chunk-TBSXA2I4.js.map +0 -7
- package/dist-node/chunk-XDUDPPJW.js.map +0 -7
- /package/dist-node/{engine-FRCX7PXF.js.map → engine-5FGDJD2H.js.map} +0 -0
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { p } from "./browser-
|
|
2
|
-
|
|
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
|
|
6
|
+
function l(a, e) {
|
|
6
7
|
const t = [], s = /* @__PURE__ */ new Set();
|
|
7
|
-
for (let r =
|
|
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,
|
|
12
|
+
Object.assign(i, c(r.char)), Object.assign(n, c(r.para));
|
|
12
13
|
return { char: i, para: n };
|
|
13
14
|
}
|
|
14
|
-
function
|
|
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
|
|
21
|
+
function S(a, e) {
|
|
21
22
|
return p(a).filter((t) => t.style.namedStyle === e);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
},
|
|
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
|
|
113
|
-
const t = a.stylesheet ?
|
|
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: { ...
|
|
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 =
|
|
132
|
-
const s = e.stylesheet ?
|
|
133
|
-
this.charDefault = { ...h, ...s.char }, this.paraDefault = { ...
|
|
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 || !
|
|
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
|
|
176
|
+
return l(t, e);
|
|
166
177
|
}
|
|
167
178
|
}
|
|
168
179
|
export {
|
|
169
180
|
A as B,
|
|
170
|
-
x as
|
|
171
|
-
P as
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
};
|