@forevka/wordcanvas 0.7.2 → 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.
- package/dist-lib/assets/{worker-4HYrkNrG.js → worker-CqU4Popa.js} +399 -375
- package/dist-lib/assets/{worker-CJpwUzKh.js → worker-Cw5cYW5z.js} +359 -344
- package/dist-lib/{blockFactory-B_CLnkUh.js → blockFactory-DDCRWDnA.js} +16 -31
- package/dist-lib/browser-BUrsjziD.js +612 -0
- package/dist-lib/builder.js +16 -17
- package/dist-lib/editorApp-CB_ZArIF.js +9566 -0
- package/dist-lib/export.js +28 -28
- package/dist-lib/generate-toc.js +6 -6
- package/dist-lib/import.js +2 -2
- package/dist-lib/lists-DpmgbDyt.js +110 -0
- package/dist-lib/measure.js +2 -2
- package/dist-lib/{measureHost-B2aKX7lF.js → measureHost-BlukHGwx.js} +1 -1
- package/dist-lib/metrics-bvGO8KDK.js +96 -0
- package/dist-lib/paintStyle-vT6jtWbH.js +74 -0
- package/dist-lib/{pipeline-DD0nxAYM.js → pipeline-UryP-u7Z.js} +80 -80
- package/dist-lib/recalc-docx.js +2 -2
- package/dist-lib/{recalcToc-CFCGCgij.js → recalcToc-BfXlXZik.js} +3 -3
- package/dist-lib/{stylesheet-B6oczA-L.js → stylesheet-LTBEGkvG.js} +32 -27
- package/dist-lib/toc-D09f4PrI.js +939 -0
- package/dist-lib/{webmcp-CXghUon_.js → webmcp-K6UZgQJ0.js} +60 -68
- package/dist-lib/wordcanvas-DBx2ana_.js +734 -0
- package/dist-lib/wordcanvas.js +4 -2
- package/dist-node/{chunk-PIMVQULL.js → chunk-373K2XRY.js} +34 -22
- package/dist-node/chunk-373K2XRY.js.map +7 -0
- package/dist-node/{chunk-57L5XMCL.js → chunk-3PUV3BG6.js} +2 -2
- package/dist-node/{chunk-U27EBKBG.js → chunk-5RX3IHWE.js} +3 -3
- package/dist-node/chunk-5RX3IHWE.js.map +7 -0
- package/dist-node/{chunk-SA26UVIJ.js → chunk-HWQKGDS2.js} +2 -2
- package/dist-node/{chunk-T3253N22.js → chunk-ZLLSXOO2.js} +3 -3
- package/dist-node/{engine-5F7DUU4W.js → engine-LLA6PCS5.js} +4 -4
- package/dist-node/export.js +5 -5
- package/dist-node/generate-toc.js +4 -4
- package/dist-node/import.js +2 -2
- package/dist-node/measure.js +2 -2
- package/dist-node/recalc-docx.js +3 -3
- package/package.json +1 -1
- package/types/wordcanvas.d.ts +649 -212
- package/dist-lib/browser-p_rkUcqE.js +0 -1339
- package/dist-lib/editorApp-mTD0YNv-.js +0 -9863
- package/dist-lib/lists-Sc5I40JO.js +0 -110
- package/dist-lib/metrics-BUMIC9Mv.js +0 -164
- package/dist-lib/toc-Dj57zdz-.js +0 -213
- package/dist-lib/wordcanvas-D5DI9ZR1.js +0 -151
- package/dist-node/chunk-PIMVQULL.js.map +0 -7
- package/dist-node/chunk-U27EBKBG.js.map +0 -7
- /package/dist-node/{chunk-57L5XMCL.js.map → chunk-3PUV3BG6.js.map} +0 -0
- /package/dist-node/{chunk-SA26UVIJ.js.map → chunk-HWQKGDS2.js.map} +0 -0
- /package/dist-node/{chunk-T3253N22.js.map → chunk-ZLLSXOO2.js.map} +0 -0
- /package/dist-node/{engine-5F7DUU4W.js.map → engine-LLA6PCS5.js.map} +0 -0
package/dist-lib/builder.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as
|
|
3
|
-
import { b as L,
|
|
4
|
-
import { B as y } from "./blockFactory-
|
|
5
|
-
import {
|
|
6
|
-
import { b as E, e as T, r as H } from "./pipeline-DD0nxAYM.js";
|
|
1
|
+
import { t as x, B as w, b as v, g as B } from "./toc-D09f4PrI.js";
|
|
2
|
+
import { d as C, s as R } from "./stylesheet-LTBEGkvG.js";
|
|
3
|
+
import { d as k, D as I, a as F, b as A, n as L, m as D } from "./lists-DpmgbDyt.js";
|
|
4
|
+
import { B as y } from "./blockFactory-DDCRWDnA.js";
|
|
5
|
+
import { b as E, e as T, r as H } from "./pipeline-UryP-u7Z.js";
|
|
7
6
|
function N(a) {
|
|
8
7
|
let t = "";
|
|
9
8
|
for (let i = 0; i < a.length; i += 32768)
|
|
@@ -383,7 +382,7 @@ class f {
|
|
|
383
382
|
r !== void 0 ? s[r] || (this.ctx.warn(
|
|
384
383
|
`list-missing:${r}`,
|
|
385
384
|
`List definition "${r}" is not in the document — a default ${i} definition was registered under that id.`
|
|
386
|
-
), s[r] = { ...k(i === "number" ? "decimal" : "bullet"), id: r }) : (r = i === "number" ?
|
|
385
|
+
), s[r] = { ...k(i === "number" ? "decimal" : "bullet"), id: r }) : (r = i === "number" ? I : F, s[r] || (s[r] = k(i === "number" ? "decimal" : "bullet")));
|
|
387
386
|
for (const n of t) {
|
|
388
387
|
const o = typeof n == "string" ? { text: n } : n, h = Math.max(0, Math.min(8, o.level ?? e.level ?? 0));
|
|
389
388
|
this.push(this.ctx.paragraph([this.ctx.run(o.text, o.style ?? {})], { list: { listId: r, level: h } }));
|
|
@@ -463,7 +462,7 @@ function $(a) {
|
|
|
463
462
|
Object.keys(a.sdts).length === 0 && delete a.sdts;
|
|
464
463
|
}
|
|
465
464
|
}
|
|
466
|
-
const
|
|
465
|
+
const Z = (a) => a * 96, J = (a) => a * 96 / 2.54, Q = (a) => a * 96 / 72, V = (a) => a / 15, z = {
|
|
467
466
|
Letter: { pageWidthPx: 816, pageHeightPx: 1056 },
|
|
468
467
|
Legal: { pageWidthPx: 816, pageHeightPx: 1344 },
|
|
469
468
|
A4: { pageWidthPx: 794, pageHeightPx: 1123 },
|
|
@@ -483,7 +482,7 @@ class b extends f {
|
|
|
483
482
|
marginPx: { top: p, right: p, bottom: p, left: p, ...t.margins }
|
|
484
483
|
},
|
|
485
484
|
blocks: [],
|
|
486
|
-
stylesheet: t.stylesheet ??
|
|
485
|
+
stylesheet: t.stylesheet ?? C()
|
|
487
486
|
};
|
|
488
487
|
return new b(new y(i, t.idSeed));
|
|
489
488
|
}
|
|
@@ -542,12 +541,12 @@ class b extends f {
|
|
|
542
541
|
* defaults from it. Call EARLY — only content added afterwards inherits it. */
|
|
543
542
|
defaultStyle(t) {
|
|
544
543
|
const e = this.ctx.stylesheet();
|
|
545
|
-
return
|
|
544
|
+
return R(e, t) ? (e.defaultStyleId = t, this.ctx.refreshDefaults(), this) : (this.ctx.warn(`style-missing:${t}`, `.defaultStyle("${t}") — no such style in the stylesheet; default unchanged.`), this);
|
|
546
545
|
}
|
|
547
546
|
/** Register a custom list definition; reference it via .list(items,{listId:id}). */
|
|
548
547
|
listDefinition(t, e) {
|
|
549
548
|
const i = this.ctx.doc.lists ??= {};
|
|
550
|
-
return "levels" in e ? i[t] = { id: t, levels: e.levels } : e.kind === "bullet" ? i[t] =
|
|
549
|
+
return "levels" in e ? i[t] = { id: t, levels: e.levels } : e.kind === "bullet" ? i[t] = A(t, e.char) : e.kind === "number" ? i[t] = L(t, e.format, e.suffix ?? ".") : i[t] = { ...D(), id: t }, this;
|
|
551
550
|
}
|
|
552
551
|
/** Register (or override) a builder-only table-style preset — reusable cell
|
|
553
552
|
* formatting applied via .table(rows, { style: name }). Resolved to concrete
|
|
@@ -566,7 +565,7 @@ class b extends f {
|
|
|
566
565
|
hideInWeb: !0,
|
|
567
566
|
outlineRange: { from: 1, to: t.maxLevel ?? 3 }
|
|
568
567
|
};
|
|
569
|
-
this.ctx.doc.tocInstruction =
|
|
568
|
+
this.ctx.doc.tocInstruction = v(e);
|
|
570
569
|
const i = this.ctx.paragraph([]);
|
|
571
570
|
return this.push(i), this.ctx.doc.tocAnchorBlockId = i.id, this;
|
|
572
571
|
}
|
|
@@ -610,7 +609,7 @@ class b extends f {
|
|
|
610
609
|
build() {
|
|
611
610
|
this.flushPendingPageBreak();
|
|
612
611
|
let t = structuredClone(this.ctx.doc);
|
|
613
|
-
return this.tocRequested && t.tocAnchorBlockId !== void 0 && (t =
|
|
612
|
+
return this.tocRequested && t.tocAnchorBlockId !== void 0 && (t = B(t, this.tocOpts).doc), t.blocks.length === 0 && t.blocks.push(this.ctx.paragraph([])), t;
|
|
614
613
|
}
|
|
615
614
|
}
|
|
616
615
|
export {
|
|
@@ -621,8 +620,8 @@ export {
|
|
|
621
620
|
f as StoryBuilder,
|
|
622
621
|
W as TableBuilder,
|
|
623
622
|
S as bytesToDataUrl,
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
623
|
+
J as cm,
|
|
624
|
+
Z as inches,
|
|
625
|
+
Q as pt,
|
|
626
|
+
V as twips
|
|
628
627
|
};
|