@forevka/wordcanvas 0.7.1 → 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.
- package/dist-lib/assets/{worker-D8rUOKfg.js → worker-4HYrkNrG.js} +10873 -10730
- package/dist-lib/assets/worker-CJpwUzKh.js +2403 -0
- package/dist-lib/blockFactory-B_CLnkUh.js +106 -0
- package/dist-lib/browser-p_rkUcqE.js +1339 -0
- package/dist-lib/builder.js +14 -13
- package/dist-lib/editorApp-mTD0YNv-.js +9863 -0
- package/dist-lib/export.js +4507 -4456
- package/dist-lib/generate-toc.js +5 -5
- package/dist-lib/import.js +2 -2
- package/dist-lib/measure.js +2 -2
- package/dist-lib/{measureHost-CMiJKdlk.js → measureHost-B2aKX7lF.js} +1 -1
- package/dist-lib/metrics-BUMIC9Mv.js +164 -0
- package/dist-lib/pipeline-DD0nxAYM.js +1850 -0
- package/dist-lib/recalc-docx.js +2 -2
- package/dist-lib/recalcToc-CFCGCgij.js +3985 -0
- package/dist-lib/styleProps-DhqDEfvc.js +149 -0
- package/dist-lib/stylesheet-B6oczA-L.js +141 -0
- package/dist-lib/{toc-B6VpkJge.js → toc-Dj57zdz-.js} +5 -5
- package/dist-lib/{webmcp-6WxRNKCc.js → webmcp-CXghUon_.js} +2 -2
- package/dist-lib/{wordcanvas-CFqpDK0k.js → wordcanvas-D5DI9ZR1.js} +49 -23
- package/dist-lib/wordcanvas.js +1 -1
- package/dist-node/{chunk-22JHAERT.js → chunk-57L5XMCL.js} +235 -39
- package/dist-node/chunk-57L5XMCL.js.map +7 -0
- package/dist-node/{chunk-4PDVRJF6.js → chunk-EMY2P524.js} +32 -2
- package/dist-node/chunk-EMY2P524.js.map +7 -0
- package/dist-node/{chunk-6AJJMHKY.js → chunk-KJV7GJ3H.js} +1 -1
- package/dist-node/chunk-KJV7GJ3H.js.map +7 -0
- package/dist-node/{chunk-CDN6WU2P.js → chunk-PIMVQULL.js} +7 -1
- package/dist-node/chunk-PIMVQULL.js.map +7 -0
- package/dist-node/{chunk-BRAPV465.js → chunk-SA26UVIJ.js} +2 -2
- package/dist-node/{chunk-RNB336F3.js → chunk-T3253N22.js} +92 -14
- package/dist-node/{chunk-RNB336F3.js.map → chunk-T3253N22.js.map} +2 -2
- package/dist-node/{chunk-4ICCHZX4.js → chunk-U27EBKBG.js} +37 -1
- package/dist-node/chunk-U27EBKBG.js.map +7 -0
- package/dist-node/{engine-5FGDJD2H.js → engine-5F7DUU4W.js} +4 -4
- package/dist-node/export.js +89 -24
- package/dist-node/export.js.map +2 -2
- package/dist-node/generate-toc.js +6 -6
- package/dist-node/import.js +3 -3
- package/dist-node/measure.js +2 -2
- package/dist-node/recalc-docx.js +4 -4
- package/package.json +1 -1
- package/types/model.d.ts +46 -0
- package/types/wordcanvas.d.ts +212 -157
- package/dist-lib/assets/worker-wXuuyshQ.js +0 -2258
- package/dist-lib/blockFactory-CUI4Rqiq.js +0 -186
- package/dist-lib/browser-DkKxreJM.js +0 -1305
- package/dist-lib/editorApp-DLXMmtu5.js +0 -8023
- package/dist-lib/metrics-CkAo4zh8.js +0 -143
- package/dist-lib/pipeline-CbxmCE84.js +0 -1705
- package/dist-lib/recalcToc-g1hFKSNs.js +0 -3935
- package/dist-lib/styleProps-Db5pEkG8.js +0 -127
- package/dist-node/chunk-22JHAERT.js.map +0 -7
- package/dist-node/chunk-4ICCHZX4.js.map +0 -7
- package/dist-node/chunk-4PDVRJF6.js.map +0 -7
- package/dist-node/chunk-6AJJMHKY.js.map +0 -7
- package/dist-node/chunk-CDN6WU2P.js.map +0 -7
- /package/dist-node/{chunk-BRAPV465.js.map → chunk-SA26UVIJ.js.map} +0 -0
- /package/dist-node/{engine-5FGDJD2H.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
|
+
};
|