@silurus/ooxml 0.77.0 → 0.77.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 +1 -1
- package/dist/{canvas-viewer-mechanics-DTkBvITv.js → canvas-viewer-mechanics-D5zXbOrS.js} +1 -1
- package/dist/{document-pull-client-iWr8-S7P.js → document-pull-client-CC8pPuzi.js} +1799 -1769
- package/dist/{docx-B1gYS6eU.js → docx-Dg9N9OX4.js} +14 -14
- package/dist/docx.mjs +3 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-C1r2zvji.js → line-distribute-BtfPlM2A.js} +133 -72
- package/dist/{line-metrics-BdCACYlq.js → line-metrics-B66x33iy.js} +1446 -1340
- package/dist/node.mjs +7 -7
- package/dist/{pptx-CQjtK_o7.js → pptx-BFP7Isgf.js} +38 -38
- package/dist/pptx.mjs +4 -4
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-Ca80nlG5.js → render-D-cOpMLV.js} +1 -1
- package/dist/render-worker-host-BzpMoFRr.js +27 -0
- package/dist/render-worker-host-CdZ5hW2X.js +27 -0
- package/dist/render-worker-host-quqYq02i.js +27 -0
- package/dist/{resource-measurement-E_S_iau4.js → resource-measurement-CVfVTQrt.js} +1 -1
- package/dist/{session-KvKxQAeL.js → session-DxAVpIP-.js} +2 -2
- package/dist/{slide-pull-client-BXb67StB.js → slide-pull-client-Lag44QA8.js} +1171 -878
- package/dist/types/docx.d.ts +46 -3
- package/dist/types/index.d.ts +104 -8
- package/dist/types/node.d.ts +99 -3
- package/dist/types/pptx.d.ts +32 -2
- package/dist/types/xlsx.d.ts +88 -3
- package/dist/{worksheet-pull-client-YzjJMOns.js → worksheet-pull-client-D74b_23i.js} +2 -2
- package/dist/{xlsx-RLCmd1Bm.js → xlsx-Bik59Raj.js} +1106 -1075
- package/dist/xlsx.mjs +4 -4
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/render-worker-host-BozYMmxO.js +0 -27
- package/dist/render-worker-host-C96AiK8e.js +0 -27
- package/dist/render-worker-host-EHG5j8FK.js +0 -27
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
-
import { B as t, Et as n, It as r, Lt as i, R as a, a as o,
|
|
3
|
-
import { C as h, E as g, S as _, T as v, _ as y, a as b, b as x, c as S, d as ee, f as te, g as ne, h as re, i as C, l as w, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as T, w as fe, x as pe, y as E } from "./canvas-viewer-mechanics-
|
|
2
|
+
import { B as t, Et as n, It as r, Lt as i, R as a, a as o, gn as s, hn as c, ht as l, it as u, kt as d, on as f, q as p, z as m } from "./line-metrics-B66x33iy.js";
|
|
3
|
+
import { C as h, E as g, S as _, T as v, _ as y, a as b, b as x, c as S, d as ee, f as te, g as ne, h as re, i as C, l as w, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as T, w as fe, x as pe, y as E } from "./canvas-viewer-mechanics-D5zXbOrS.js";
|
|
4
4
|
import { a as me, c as he, i as ge, o as _e, r as ve, s as ye, t as be } from "./bounded-raw-part-cache-C6ro6Ezf.js";
|
|
5
|
-
import { C as xe, S as Se, _ as D, a as Ce, b as we, c as Te, d as Ee, f as De, g as Oe, h as ke, l as Ae, m as je, n as O, o as Me, p as Ne, s as Pe, t as k, v as A, w as Fe, x as j, y as Ie } from "./document-pull-client-
|
|
5
|
+
import { C as xe, S as Se, _ as D, a as Ce, b as we, c as Te, d as Ee, f as De, g as Oe, h as ke, l as Ae, m as je, n as O, o as Me, p as Ne, s as Pe, t as k, v as A, w as Fe, x as j, y as Ie } from "./document-pull-client-CC8pPuzi.js";
|
|
6
6
|
import { n as Le, r as M, t as N } from "./highlight-rect-CAkCWJ37.js";
|
|
7
7
|
//#region packages/core/src/fonts/embedded.ts
|
|
8
8
|
function Re(e, t) {
|
|
@@ -341,7 +341,7 @@ var U = class e {
|
|
|
341
341
|
t = await e.arrayBuffer();
|
|
342
342
|
} else t = n;
|
|
343
343
|
t = g(await v(t, r.password)), c.setSourceBytes(t.byteLength), c.checkpoint("container ready");
|
|
344
|
-
let a = s === "worker" ? (await import("./render-worker-host-
|
|
344
|
+
let a = s === "worker" ? (await import("./render-worker-host-CdZ5hW2X.js")).createRenderWorker() : new Ue(), l;
|
|
345
345
|
try {
|
|
346
346
|
if (l = new e(a, s, o, r.wasmUrl), l._metrics = c, await l._parse(t, i.policy, s === "worker" ? !!r.useGoogleFonts : !1, r.workerTimeoutMs, (e) => c.observeUsage(e)), s === "worker" && l._mode === "main" && (c.setMode("main"), console.warn("[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.")), r.math && l._mode === "worker" && console.warn("[ooxml] the math engine is unavailable in mode: 'worker'; equations will be skipped. Use mode: 'main' for documents with equations."), l._mode === "main" && r.useGoogleFonts && l._document && (l._googleFontFaces = await ge(Ne(l._document), De)), l._mode === "main" && l._document?.embeddedFonts?.length) {
|
|
347
347
|
let e = l;
|
|
@@ -865,7 +865,7 @@ var Q = Symbol("DocxViewer.borrowedDocument"), ut = class e {
|
|
|
865
865
|
await this.goToPage(this._currentPage - 1);
|
|
866
866
|
}
|
|
867
867
|
_naturalWidthPx() {
|
|
868
|
-
return !this._doc || this._doc.pageCount === 0 ? 0 : this._doc.pageSize(this._currentPage).widthPt *
|
|
868
|
+
return !this._doc || this._doc.pageCount === 0 ? 0 : this._doc.pageSize(this._currentPage).widthPt * f;
|
|
869
869
|
}
|
|
870
870
|
_renderWidth() {
|
|
871
871
|
if (this._scale === null) return this._opts.width;
|
|
@@ -904,8 +904,8 @@ var Q = Symbol("DocxViewer.borrowedDocument"), ut = class e {
|
|
|
904
904
|
let t = this._doc.pageSize(this._currentPage), n = this._fitContainer();
|
|
905
905
|
if (!n) return;
|
|
906
906
|
let r = y({
|
|
907
|
-
contentWidth: t.widthPt *
|
|
908
|
-
contentHeight: t.heightPt *
|
|
907
|
+
contentWidth: t.widthPt * f,
|
|
908
|
+
contentHeight: t.heightPt * f,
|
|
909
909
|
containerWidth: n.clientWidth,
|
|
910
910
|
containerHeight: n.clientHeight
|
|
911
911
|
}, e);
|
|
@@ -1173,10 +1173,10 @@ var Q = Symbol("DocxViewer.borrowedDocument"), ut = class e {
|
|
|
1173
1173
|
return this._doc?.pageCount ?? 0;
|
|
1174
1174
|
}
|
|
1175
1175
|
_pageWidthPx(e) {
|
|
1176
|
-
return this._doc.pageSize(e).widthPt *
|
|
1176
|
+
return this._doc.pageSize(e).widthPt * f * this._scale;
|
|
1177
1177
|
}
|
|
1178
1178
|
_pageHeightPx(e) {
|
|
1179
|
-
return this._doc.pageSize(e).heightPt *
|
|
1179
|
+
return this._doc.pageSize(e).heightPt * f * this._scale;
|
|
1180
1180
|
}
|
|
1181
1181
|
_fitWidthPx() {
|
|
1182
1182
|
if (this._opts.width && this._opts.width > 0) return this._opts.width;
|
|
@@ -1190,7 +1190,7 @@ var Q = Symbol("DocxViewer.borrowedDocument"), ut = class e {
|
|
|
1190
1190
|
let e = this._fitWidthPx();
|
|
1191
1191
|
if (e <= 0) return 0;
|
|
1192
1192
|
let t = this._doc.pageSize(0).widthPt;
|
|
1193
|
-
return t <= 0 ? 0 : e / (t *
|
|
1193
|
+
return t <= 0 ? 0 : e / (t * f);
|
|
1194
1194
|
}
|
|
1195
1195
|
relayout() {
|
|
1196
1196
|
this._relayout();
|
|
@@ -1442,8 +1442,8 @@ var Q = Symbol("DocxViewer.borrowedDocument"), ut = class e {
|
|
|
1442
1442
|
_fit(e) {
|
|
1443
1443
|
if (!this._doc || this._doc.pageCount === 0) return;
|
|
1444
1444
|
let t = this._doc.pageSize(0), n = y({
|
|
1445
|
-
contentWidth: t.widthPt *
|
|
1446
|
-
contentHeight: t.heightPt *
|
|
1445
|
+
contentWidth: t.widthPt * f,
|
|
1446
|
+
contentHeight: t.heightPt * f,
|
|
1447
1447
|
containerWidth: this._fitWidthPx(),
|
|
1448
1448
|
containerHeight: this._scrollHost.clientHeight
|
|
1449
1449
|
}, e);
|
|
@@ -1708,8 +1708,8 @@ var ht = /* @__PURE__ */ e({
|
|
|
1708
1708
|
DocxScrollViewer: () => mt,
|
|
1709
1709
|
DocxViewer: () => ut,
|
|
1710
1710
|
OoxmlDecodedImageLimitError: () => r,
|
|
1711
|
-
OoxmlError: () =>
|
|
1712
|
-
OoxmlResourceLimitError: () =>
|
|
1711
|
+
OoxmlError: () => c,
|
|
1712
|
+
OoxmlResourceLimitError: () => s,
|
|
1713
1713
|
autoResize: () => fe,
|
|
1714
1714
|
buildDocxHighlightLayer: () => q,
|
|
1715
1715
|
buildDocxTextLayer: () => K,
|
package/dist/docx.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { It as e, Lt as t, a as n,
|
|
2
|
-
import { w as a } from "./canvas-viewer-mechanics-
|
|
3
|
-
import { a as o, c as s, i as c, n as l, o as u, r as d, s as f } from "./docx-
|
|
1
|
+
import { It as e, Lt as t, a as n, gn as r, hn as i } from "./line-metrics-B66x33iy.js";
|
|
2
|
+
import { w as a } from "./canvas-viewer-mechanics-D5zXbOrS.js";
|
|
3
|
+
import { a as o, c as s, i as c, n as l, o as u, r as d, s as f } from "./docx-Dg9N9OX4.js";
|
|
4
4
|
export { s as DocxDocument, d as DocxScrollViewer, c as DocxViewer, e as OoxmlDecodedImageLimitError, i as OoxmlError, r as OoxmlResourceLimitError, a as autoResize, u as buildDocxHighlightLayer, f as buildDocxTextLayer, t as isOoxmlDecodedImageLimitError, l as noteText, n as openExternalHyperlink, o as readDocxTextSelectionContext };
|
package/dist/docx_parser_bg.wasm
CHANGED
|
Binary file
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./docx-
|
|
2
|
-
import { t } from "./xlsx-
|
|
3
|
-
import { t as n } from "./pptx-
|
|
1
|
+
import { t as e } from "./docx-Dg9N9OX4.js";
|
|
2
|
+
import { t } from "./xlsx-Bik59Raj.js";
|
|
3
|
+
import { t as n } from "./pptx-BFP7Isgf.js";
|
|
4
4
|
export { e as docx, n as pptx, t as xlsx };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Yt as e, b as t, w as n, x as r, zt as i } from "./line-metrics-B66x33iy.js";
|
|
2
2
|
//#region packages/core/src/fonts/symbol-font.ts
|
|
3
3
|
var a = {
|
|
4
4
|
167: "♣",
|
|
@@ -83,7 +83,43 @@ function f(e, t) {
|
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region packages/core/src/shape/custGeom.ts
|
|
86
|
-
function p(e, t, n, r, i
|
|
86
|
+
function p(e, t, n, r, i) {
|
|
87
|
+
let a = Infinity, o = Infinity, s = -Infinity, c = -Infinity, l = (e, t) => {
|
|
88
|
+
!Number.isFinite(e) || !Number.isFinite(t) || (a = Math.min(a, e), o = Math.min(o, t), s = Math.max(s, e), c = Math.max(c, t));
|
|
89
|
+
};
|
|
90
|
+
for (let a of e) {
|
|
91
|
+
let e = 0, o = 0;
|
|
92
|
+
for (let s of a) switch (s.cmd) {
|
|
93
|
+
case "moveTo":
|
|
94
|
+
case "lineTo":
|
|
95
|
+
e = s.x, o = s.y, l(t + e * r, n + o * i);
|
|
96
|
+
break;
|
|
97
|
+
case "cubicBezTo":
|
|
98
|
+
l(t + s.x1 * r, n + s.y1 * i), l(t + s.x2 * r, n + s.y2 * i), e = s.x, o = s.y, l(t + e * r, n + o * i);
|
|
99
|
+
break;
|
|
100
|
+
case "quadBezTo":
|
|
101
|
+
l(t + s.x1 * r, n + s.y1 * i), e = s.x, o = s.y, l(t + e * r, n + o * i);
|
|
102
|
+
break;
|
|
103
|
+
case "arcTo": {
|
|
104
|
+
let a = Math.abs(s.wr * r), c = Math.abs(s.hr * i);
|
|
105
|
+
if (a <= 0 || c <= 0) break;
|
|
106
|
+
let u = s.stAng * Math.PI / 180, d = s.swAng * Math.PI / 180, f = t + e * r, p = n + o * i, m = f - a * Math.cos(u), h = p - c * Math.sin(u);
|
|
107
|
+
l(m - a, h - c), l(m + a, h + c);
|
|
108
|
+
let g = u + d;
|
|
109
|
+
e = (m + a * Math.cos(g) - t) / r, o = (h + c * Math.sin(g) - n) / i;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case "close": break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return Number.isFinite(a) ? {
|
|
116
|
+
x: a,
|
|
117
|
+
y: o,
|
|
118
|
+
w: s - a,
|
|
119
|
+
h: c - o
|
|
120
|
+
} : null;
|
|
121
|
+
}
|
|
122
|
+
function m(e, t, n, r, i, a) {
|
|
87
123
|
for (let o of t) {
|
|
88
124
|
let t = 0, s = 0;
|
|
89
125
|
for (let c of o) switch (c.cmd) {
|
|
@@ -96,6 +132,9 @@ function p(e, t, n, r, i, a) {
|
|
|
96
132
|
case "cubicBezTo":
|
|
97
133
|
e.bezierCurveTo(n + c.x1 * i, r + c.y1 * a, n + c.x2 * i, r + c.y2 * a, n + c.x * i, r + c.y * a), t = c.x, s = c.y;
|
|
98
134
|
break;
|
|
135
|
+
case "quadBezTo":
|
|
136
|
+
e.quadraticCurveTo(n + c.x1 * i, r + c.y1 * a, n + c.x * i, r + c.y * a), t = c.x, s = c.y;
|
|
137
|
+
break;
|
|
99
138
|
case "arcTo": {
|
|
100
139
|
let o = c.wr * i, l = c.hr * a;
|
|
101
140
|
if (o <= 0 || l <= 0) break;
|
|
@@ -111,11 +150,11 @@ function p(e, t, n, r, i, a) {
|
|
|
111
150
|
}
|
|
112
151
|
//#endregion
|
|
113
152
|
//#region packages/core/src/shape/custgeom-endpoints.ts
|
|
114
|
-
var
|
|
115
|
-
function
|
|
116
|
-
return e.cmd === "lineTo" || e.cmd === "cubicBezTo" || e.cmd === "arcTo";
|
|
153
|
+
var h = 1e-9;
|
|
154
|
+
function g(e) {
|
|
155
|
+
return e.cmd === "lineTo" || e.cmd === "cubicBezTo" || e.cmd === "quadBezTo" || e.cmd === "arcTo";
|
|
117
156
|
}
|
|
118
|
-
function
|
|
157
|
+
function _(e, t, n, r) {
|
|
119
158
|
let i = n === 0 ? 0 : n, a = r === 0 ? 0 : r;
|
|
120
159
|
return {
|
|
121
160
|
x: e,
|
|
@@ -125,7 +164,7 @@ function g(e, t, n, r) {
|
|
|
125
164
|
angle: Math.atan2(a, i)
|
|
126
165
|
};
|
|
127
166
|
}
|
|
128
|
-
function
|
|
167
|
+
function v(e, t, n) {
|
|
129
168
|
switch (n.cmd) {
|
|
130
169
|
case "lineTo": return {
|
|
131
170
|
dx: n.x - e,
|
|
@@ -133,7 +172,14 @@ function _(e, t, n) {
|
|
|
133
172
|
};
|
|
134
173
|
case "cubicBezTo": {
|
|
135
174
|
let r = n.x1 - e, i = n.y1 - t;
|
|
136
|
-
return Math.abs(r) <
|
|
175
|
+
return Math.abs(r) < h && Math.abs(i) < h && (r = n.x2 - e, i = n.y2 - t), Math.abs(r) < h && Math.abs(i) < h && (r = n.x - e, i = n.y - t), {
|
|
176
|
+
dx: r,
|
|
177
|
+
dy: i
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
case "quadBezTo": {
|
|
181
|
+
let r = n.x1 - e, i = n.y1 - t;
|
|
182
|
+
return Math.abs(r) < h && Math.abs(i) < h && (r = n.x - e, i = n.y - t), {
|
|
137
183
|
dx: r,
|
|
138
184
|
dy: i
|
|
139
185
|
};
|
|
@@ -151,11 +197,12 @@ function _(e, t, n) {
|
|
|
151
197
|
};
|
|
152
198
|
}
|
|
153
199
|
}
|
|
154
|
-
function
|
|
200
|
+
function y(e, t, n) {
|
|
155
201
|
switch (n.cmd) {
|
|
156
202
|
case "moveTo":
|
|
157
203
|
case "lineTo":
|
|
158
|
-
case "cubicBezTo":
|
|
204
|
+
case "cubicBezTo":
|
|
205
|
+
case "quadBezTo": return {
|
|
159
206
|
x: n.x,
|
|
160
207
|
y: n.y
|
|
161
208
|
};
|
|
@@ -176,8 +223,8 @@ function v(e, t, n) {
|
|
|
176
223
|
};
|
|
177
224
|
}
|
|
178
225
|
}
|
|
179
|
-
function
|
|
180
|
-
let { x: r, y: i } =
|
|
226
|
+
function b(e, t, n) {
|
|
227
|
+
let { x: r, y: i } = y(e, t, n);
|
|
181
228
|
switch (n.cmd) {
|
|
182
229
|
case "lineTo": return {
|
|
183
230
|
dx: n.x - e,
|
|
@@ -187,7 +234,16 @@ function y(e, t, n) {
|
|
|
187
234
|
};
|
|
188
235
|
case "cubicBezTo": {
|
|
189
236
|
let a = n.x - n.x2, o = n.y - n.y2;
|
|
190
|
-
return Math.abs(a) <
|
|
237
|
+
return Math.abs(a) < h && Math.abs(o) < h && (a = n.x - n.x1, o = n.y - n.y1), Math.abs(a) < h && Math.abs(o) < h && (a = n.x - e, o = n.y - t), {
|
|
238
|
+
dx: a,
|
|
239
|
+
dy: o,
|
|
240
|
+
x: r,
|
|
241
|
+
y: i
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
case "quadBezTo": {
|
|
245
|
+
let a = n.x - n.x1, o = n.y - n.y1;
|
|
246
|
+
return Math.abs(a) < h && Math.abs(o) < h && (a = n.x - e, o = n.y - t), {
|
|
191
247
|
dx: a,
|
|
192
248
|
dy: o,
|
|
193
249
|
x: r,
|
|
@@ -217,50 +273,50 @@ function y(e, t, n) {
|
|
|
217
273
|
};
|
|
218
274
|
}
|
|
219
275
|
}
|
|
220
|
-
function
|
|
276
|
+
function x(e) {
|
|
221
277
|
let t = 0, n = 0, r = !1;
|
|
222
|
-
for (let i of e) i.cmd === "moveTo" && (r = !0), {x: t, y: n} =
|
|
278
|
+
for (let i of e) i.cmd === "moveTo" && (r = !0), {x: t, y: n} = y(t, n, i);
|
|
223
279
|
return r ? {
|
|
224
280
|
x: t,
|
|
225
281
|
y: n
|
|
226
282
|
} : null;
|
|
227
283
|
}
|
|
228
|
-
function
|
|
284
|
+
function S(e) {
|
|
229
285
|
if (e.some((e) => e.cmd === "close")) return !0;
|
|
230
286
|
let t = e.find((e) => e.cmd === "moveTo");
|
|
231
287
|
if (!t) return !1;
|
|
232
|
-
let n =
|
|
233
|
-
return !n || !e.some(
|
|
288
|
+
let n = x(e);
|
|
289
|
+
return !n || !e.some(g) ? !1 : Math.abs(n.x - t.x) < h && Math.abs(n.y - t.y) < h;
|
|
234
290
|
}
|
|
235
|
-
function
|
|
291
|
+
function C(e) {
|
|
236
292
|
let t = {
|
|
237
293
|
start: null,
|
|
238
294
|
end: null
|
|
239
295
|
};
|
|
240
296
|
if (!e || e.length === 0) return t;
|
|
241
297
|
let n = e[0];
|
|
242
|
-
if (n && n.length > 0 && !
|
|
243
|
-
let e = n.find((e) => e.cmd === "moveTo"), r = n.find(
|
|
298
|
+
if (n && n.length > 0 && !S(n)) {
|
|
299
|
+
let e = n.find((e) => e.cmd === "moveTo"), r = n.find(g);
|
|
244
300
|
if (e && r) {
|
|
245
|
-
let n =
|
|
246
|
-
(Math.abs(n.dx) >
|
|
301
|
+
let n = v(e.x, e.y, r);
|
|
302
|
+
(Math.abs(n.dx) > h || Math.abs(n.dy) > h) && (t.start = _(e.x, e.y, -n.dx, -n.dy));
|
|
247
303
|
}
|
|
248
304
|
}
|
|
249
305
|
let r = e[e.length - 1];
|
|
250
|
-
if (r && r.length > 0 && !
|
|
306
|
+
if (r && r.length > 0 && !S(r)) {
|
|
251
307
|
let e = 0, n = 0, i = -1;
|
|
252
|
-
for (let e = 0; e < r.length; e++)
|
|
308
|
+
for (let e = 0; e < r.length; e++) g(r[e]) && (i = e);
|
|
253
309
|
if (i >= 0) {
|
|
254
|
-
for (let t = 0; t < i; t++) ({x: e, y: n} =
|
|
255
|
-
let a =
|
|
256
|
-
(Math.abs(a.dx) >
|
|
310
|
+
for (let t = 0; t < i; t++) ({x: e, y: n} = y(e, n, r[t]));
|
|
311
|
+
let a = b(e, n, r[i]);
|
|
312
|
+
(Math.abs(a.dx) > h || Math.abs(a.dy) > h) && (t.end = _(a.x, a.y, a.dx, a.dy));
|
|
257
313
|
}
|
|
258
314
|
}
|
|
259
315
|
return t;
|
|
260
316
|
}
|
|
261
317
|
//#endregion
|
|
262
318
|
//#region packages/core/src/shape/preset.ts
|
|
263
|
-
function
|
|
319
|
+
function w(e, t, n, r, i, a, o, s = -Math.PI / 2) {
|
|
264
320
|
let c = a * 2;
|
|
265
321
|
for (let l = 0; l < c; l++) {
|
|
266
322
|
let c = s + l * Math.PI / a, u = l % 2 == 0 ? 1 : o, d = t + r * u * Math.cos(c), f = n + i * u * Math.sin(c);
|
|
@@ -268,43 +324,43 @@ function C(e, t, n, r, i, a, o, s = -Math.PI / 2) {
|
|
|
268
324
|
}
|
|
269
325
|
e.closePath();
|
|
270
326
|
}
|
|
271
|
-
function
|
|
327
|
+
function T(e, t, n, r, i, a, o = -Math.PI / 2) {
|
|
272
328
|
for (let s = 0; s < a; s++) {
|
|
273
329
|
let c = o + s * 2 * Math.PI / a, l = t + r * Math.cos(c), u = n + i * Math.sin(c);
|
|
274
330
|
s === 0 ? e.moveTo(l, u) : e.lineTo(l, u);
|
|
275
331
|
}
|
|
276
332
|
e.closePath();
|
|
277
333
|
}
|
|
278
|
-
function
|
|
334
|
+
function E(e, t, n, r, i, a, o) {
|
|
279
335
|
let s = (e) => Math.atan2(r * Math.sin(e), i * Math.cos(e)), c = s(a), l = s(a + o), u = t - r * Math.cos(c), d = n - i * Math.sin(c);
|
|
280
336
|
return e.ellipse(u, d, Math.abs(r), Math.abs(i), 0, c, l, o < 0), {
|
|
281
337
|
x: u + r * Math.cos(l),
|
|
282
338
|
y: d + i * Math.sin(l)
|
|
283
339
|
};
|
|
284
340
|
}
|
|
285
|
-
var
|
|
341
|
+
var D = {
|
|
286
342
|
oval: "ellipse",
|
|
287
343
|
rtriangle: "rttriangle",
|
|
288
344
|
roundrectangle: "roundrect",
|
|
289
345
|
flowchartsumingjunction: "flowchartsummingjunction"
|
|
290
|
-
},
|
|
346
|
+
}, O = new Set(/* @__PURE__ */ "ellipse.rttriangle.triangle.diamond.trapezoid.roundrect.snip1rect.frame.irregularseal1.irregularseal2.star4.star8.star12.star16.star24.star32.line.straightconnector1.callout1.bordercallout1.leftuparrow.quadarrowcallout.mathequal.mathplus.mathminus.flowchartdecision.flowchartmanualinput.flowchartconnector.flowchartinputoutput.flowchartmerge.flowchartextract.flowchartpreparation.flowchartcollate".split(".")), k = new Set([
|
|
291
347
|
"accentcallout1",
|
|
292
348
|
"accentbordercallout1",
|
|
293
349
|
"flowchartpredefinedprocess",
|
|
294
350
|
"flowchartsort",
|
|
295
351
|
"flowchartinternalstorage",
|
|
296
352
|
"flowchartsummingjunction"
|
|
297
|
-
]),
|
|
353
|
+
]), A = new Set([
|
|
298
354
|
"round2samerect",
|
|
299
355
|
"round2diagrect",
|
|
300
356
|
"dodecagon",
|
|
301
357
|
"star10"
|
|
302
358
|
]);
|
|
303
|
-
function
|
|
359
|
+
function j(e, t, n, r, a, o, s = null, c = null, l = null, u = null) {
|
|
304
360
|
let d = n + a / 2, f = r + o / 2;
|
|
305
361
|
{
|
|
306
|
-
let d = t.toLowerCase(), f =
|
|
307
|
-
if ((
|
|
362
|
+
let d = t.toLowerCase(), f = D[d] ?? d;
|
|
363
|
+
if ((O.has(f) || k.has(f) || A.has(f)) && i(e, f, n, r, a, o, [
|
|
308
364
|
s,
|
|
309
365
|
c,
|
|
310
366
|
l,
|
|
@@ -318,29 +374,29 @@ function A(e, t, n, r, a, o, s = null, c = null, l = null, u = null) {
|
|
|
318
374
|
break;
|
|
319
375
|
}
|
|
320
376
|
case "pentagon":
|
|
321
|
-
|
|
377
|
+
T(e, d, f, a / 2, o / 2, 5);
|
|
322
378
|
break;
|
|
323
379
|
case "hexagon":
|
|
324
|
-
|
|
380
|
+
T(e, d, f, a / 2, o / 2, 6, 0);
|
|
325
381
|
break;
|
|
326
382
|
case "heptagon":
|
|
327
|
-
|
|
383
|
+
T(e, d, f, a / 2, o / 2, 7);
|
|
328
384
|
break;
|
|
329
385
|
case "octagon":
|
|
330
|
-
|
|
386
|
+
T(e, d, f, a / 2, o / 2, 8, -Math.PI / 8);
|
|
331
387
|
break;
|
|
332
388
|
case "decagon":
|
|
333
|
-
|
|
389
|
+
T(e, d, f, a / 2, o / 2, 10);
|
|
334
390
|
break;
|
|
335
391
|
case "star5":
|
|
336
392
|
case "star":
|
|
337
|
-
|
|
393
|
+
w(e, d, f, a / 2, o / 2, 5, (s ?? 19098) / 5e4);
|
|
338
394
|
break;
|
|
339
395
|
case "star6":
|
|
340
|
-
|
|
396
|
+
w(e, d, f, a / 2, o / 2, 6, (s ?? 28868) / 5e4, 0);
|
|
341
397
|
break;
|
|
342
398
|
case "star7":
|
|
343
|
-
|
|
399
|
+
w(e, d, f, a / 2, o / 2, 7, (s ?? 34142) / 5e4);
|
|
344
400
|
break;
|
|
345
401
|
case "rightarrow": {
|
|
346
402
|
let t = o * Math.min(1, (s ?? 5e4) / 1e5), i = a * Math.min(1, (c ?? 5e4) / 1e5), l = r + (o - t) / 2;
|
|
@@ -750,27 +806,27 @@ function A(e, t, n, r, a, o, s = null, c = null, l = null, u = null) {
|
|
|
750
806
|
break;
|
|
751
807
|
}
|
|
752
808
|
case "curvedrightarrow": {
|
|
753
|
-
let t = Math.min(a, o), i = o / 2, u = 5e4 * o / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(d, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = 1e5 * (Math.sqrt(Math.max(0, h)) * a / (2 * m)) / t, _ = t * Math.min(g, Math.max(0, l ?? 25e3)) / 1e5, v = Math.sqrt(Math.max(0, a * a - _ * _)) * m / a, y = m + f, b = m + v, x = y + v, S = (p - f) / 2, C = b - S, w = x + S,
|
|
754
|
-
e.moveTo(n, r + m),
|
|
809
|
+
let t = Math.min(a, o), i = o / 2, u = 5e4 * o / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(d, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = 1e5 * (Math.sqrt(Math.max(0, h)) * a / (2 * m)) / t, _ = t * Math.min(g, Math.max(0, l ?? 25e3)) / 1e5, v = Math.sqrt(Math.max(0, a * a - _ * _)) * m / a, y = m + f, b = m + v, x = y + v, S = (p - f) / 2, C = b - S, w = x + S, T = o - p / 2, D = a - _, O = Math.atan2(_, v), k = -O, A = Math.PI - O;
|
|
810
|
+
e.moveTo(n, r + m), E(e, n, r + m, a, m, Math.PI, k), e.lineTo(n + D, r + C), e.lineTo(n + a, r + T), e.lineTo(n + D, r + w), e.lineTo(n + D, r + x), E(e, n + D, r + x, a, m, A, O), e.closePath();
|
|
755
811
|
break;
|
|
756
812
|
}
|
|
757
813
|
case "curvedleftarrow": {
|
|
758
|
-
let t = Math.min(a, o), i = o / 2, u = 5e4 * o / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(d, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = Math.sqrt(Math.max(0, h)) * a / (2 * m), _ = 1e5 * g / t, v = t * Math.min(_, Math.max(0, l ?? 25e3)) / 1e5, y = Math.sqrt(Math.max(0, a * a - v * v)) * m / a, b = m + f, x = m + y, S = b + y, C = (p - f) / 2, w = x - C,
|
|
814
|
+
let t = Math.min(a, o), i = o / 2, u = 5e4 * o / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(d, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = Math.sqrt(Math.max(0, h)) * a / (2 * m), _ = 1e5 * g / t, v = t * Math.min(_, Math.max(0, l ?? 25e3)) / 1e5, y = Math.sqrt(Math.max(0, a * a - v * v)) * m / a, b = m + f, x = m + y, S = b + y, C = (p - f) / 2, w = x - C, T = S + C, D = o - p / 2, O = v, k = Math.atan2(v, y), A = f / 2, j = Math.atan2(A, g), M = j - k, N = k - j, P = -j;
|
|
759
815
|
e.moveTo(n, r + D), e.lineTo(n + O, r + w), e.lineTo(n + O, r + x);
|
|
760
|
-
let F =
|
|
761
|
-
|
|
816
|
+
let F = E(e, n + O, r + x, a, m, k, M);
|
|
817
|
+
E(e, F.x, F.y, a, m, P, N), e.lineTo(n + O, r + T), e.closePath();
|
|
762
818
|
break;
|
|
763
819
|
}
|
|
764
820
|
case "curveduparrow": {
|
|
765
|
-
let t = Math.min(a, o), i = a / 2, u = 5e4 * a / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(1e5, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = Math.sqrt(Math.max(0, h)) * o / (2 * m), _ = 1e5 * g / t, v = t * Math.min(_, Math.max(0, l ?? 25e3)) / 1e5, y = Math.sqrt(Math.max(0, o * o - v * v)) * m / o, b = m + f, x = m + y, S = b + y, C = (p - f) / 2, w = x - C,
|
|
766
|
-
e.moveTo(n + D, r), e.lineTo(n +
|
|
767
|
-
let I =
|
|
768
|
-
|
|
821
|
+
let t = Math.min(a, o), i = a / 2, u = 5e4 * a / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(1e5, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = Math.sqrt(Math.max(0, h)) * o / (2 * m), _ = 1e5 * g / t, v = t * Math.min(_, Math.max(0, l ?? 25e3)) / 1e5, y = Math.sqrt(Math.max(0, o * o - v * v)) * m / o, b = m + f, x = m + y, S = b + y, C = (p - f) / 2, w = x - C, T = S + C, D = a - p / 2, O = v, k = Math.atan2(v, y), A = f / 2, j = Math.atan2(A, g), M = j - k, N = k - j, P = Math.PI / 2 - k, F = Math.PI / 2 - j;
|
|
822
|
+
e.moveTo(n + D, r), e.lineTo(n + T, r + O), e.lineTo(n + S, r + O);
|
|
823
|
+
let I = E(e, n + S, r + O, m, o, P, N);
|
|
824
|
+
E(e, I.x, I.y, m, o, F, M), e.lineTo(n + w, r + O), e.closePath();
|
|
769
825
|
break;
|
|
770
826
|
}
|
|
771
827
|
case "curveddownarrow": {
|
|
772
|
-
let t = Math.min(a, o), i = a / 2, u = 5e4 * a / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(1e5, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = Math.sqrt(Math.max(0, h)) * o / (2 * m), _ = 1e5 * g / t, v = t * Math.min(_, Math.max(0, l ?? 25e3)) / 1e5, y = Math.sqrt(Math.max(0, o * o - v * v)) * m / o, b = m + f, x = m + y, S = b + y, C = (p - f) / 2, w = x - C,
|
|
773
|
-
3 * Math.PI / 2 - j, j - Math.PI / 2, Math.PI / 2 - j, e.moveTo(n + D, r + o), e.lineTo(n + w, r + O), e.lineTo(n + x, r + O),
|
|
828
|
+
let t = Math.min(a, o), i = a / 2, u = 5e4 * a / t, d = Math.min(u, Math.max(0, c ?? 5e4)), f = t * Math.min(1e5, Math.max(0, s ?? 25e3)) / 1e5, p = t * d / 1e5, m = i - (f + p) / 4, h = (2 * m) ** 2 - f ** 2, g = Math.sqrt(Math.max(0, h)) * o / (2 * m), _ = 1e5 * g / t, v = t * Math.min(_, Math.max(0, l ?? 25e3)) / 1e5, y = Math.sqrt(Math.max(0, o * o - v * v)) * m / o, b = m + f, x = m + y, S = b + y, C = (p - f) / 2, w = x - C, T = S + C, D = a - p / 2, O = o - v, k = Math.atan2(v, y), A = f / 2, j = Math.atan2(A, g), M = 3 * Math.PI / 2 + k;
|
|
829
|
+
3 * Math.PI / 2 - j, j - Math.PI / 2, Math.PI / 2 - j, e.moveTo(n + D, r + o), e.lineTo(n + w, r + O), e.lineTo(n + x, r + O), E(e, n + x, r + O, m, o, M, -k), e.lineTo(n + b, r), E(e, n + b, r, m, o, 3 * Math.PI / 2, k), e.lineTo(n + T, r + O), e.closePath();
|
|
774
830
|
break;
|
|
775
831
|
}
|
|
776
832
|
case "stripedrightarrow": {
|
|
@@ -818,7 +874,7 @@ function A(e, t, n, r, a, o, s = null, c = null, l = null, u = null) {
|
|
|
818
874
|
}
|
|
819
875
|
//#endregion
|
|
820
876
|
//#region packages/core/src/shape/arrow.ts
|
|
821
|
-
function
|
|
877
|
+
function M(e, t, n) {
|
|
822
878
|
let r = Math.max(.5, t.width * n), i = e.w === "sm" ? 4 : e.w === "lg" ? 8 : 6, a = e.len === "sm" ? 4 : e.len === "lg" ? 8 : 6;
|
|
823
879
|
return {
|
|
824
880
|
lw: r,
|
|
@@ -826,16 +882,21 @@ function j(e, t, n) {
|
|
|
826
882
|
len: r * a
|
|
827
883
|
};
|
|
828
884
|
}
|
|
829
|
-
var
|
|
885
|
+
var N = new Set([
|
|
830
886
|
"triangle",
|
|
831
887
|
"stealth",
|
|
832
888
|
"diamond",
|
|
833
889
|
"oval"
|
|
834
890
|
]);
|
|
835
|
-
function N(e, t, n) {
|
|
836
|
-
return M.has(e.type) ? j(e, t, n).len : 0;
|
|
837
|
-
}
|
|
838
891
|
function P(e, t, n) {
|
|
892
|
+
return N.has(e.type) ? M(e, t, n).len : 0;
|
|
893
|
+
}
|
|
894
|
+
function F(e, t, n) {
|
|
895
|
+
if (e.type === "none") return 0;
|
|
896
|
+
let { lw: r, halfW: i, len: a } = M(e, t, n);
|
|
897
|
+
return Math.max(a, i) + r / 2;
|
|
898
|
+
}
|
|
899
|
+
function I(e, t, n) {
|
|
839
900
|
if (n <= 0) return {
|
|
840
901
|
x: e.x,
|
|
841
902
|
y: e.y
|
|
@@ -851,32 +912,32 @@ function P(e, t, n) {
|
|
|
851
912
|
y: e.y + i * o
|
|
852
913
|
};
|
|
853
914
|
}
|
|
854
|
-
function
|
|
915
|
+
function L(t, n, r, i, a, o, s, c) {
|
|
855
916
|
if (a.type === "none") return;
|
|
856
|
-
let { lw:
|
|
857
|
-
switch (t.save(), t.translate(n, r), t.rotate(i), t.fillStyle =
|
|
917
|
+
let { lw: l, halfW: u, len: d } = M(a, o, s), f = c ?? e(o.color);
|
|
918
|
+
switch (t.save(), t.translate(n, r), t.rotate(i), t.fillStyle = f, t.strokeStyle = f, t.lineWidth = l, t.setLineDash([]), t.beginPath(), a.type) {
|
|
858
919
|
case "triangle":
|
|
859
920
|
case "stealth":
|
|
860
|
-
t.moveTo(0, 0), t.lineTo(-
|
|
921
|
+
t.moveTo(0, 0), t.lineTo(-d, -u), t.lineTo(-d, u), t.closePath(), t.fill();
|
|
861
922
|
break;
|
|
862
923
|
case "arrow":
|
|
863
|
-
t.
|
|
924
|
+
t.lineCap = "round", t.lineJoin = "round", t.moveTo(-d, -u), t.lineTo(0, 0), t.lineTo(-d, u), t.stroke();
|
|
864
925
|
break;
|
|
865
926
|
case "diamond":
|
|
866
|
-
t.moveTo(0, 0), t.lineTo(-
|
|
927
|
+
t.moveTo(0, 0), t.lineTo(-d / 2, -u), t.lineTo(-d, 0), t.lineTo(-d / 2, u), t.closePath(), t.fill();
|
|
867
928
|
break;
|
|
868
929
|
case "oval":
|
|
869
|
-
t.ellipse(-
|
|
930
|
+
t.ellipse(-d / 2, 0, d / 2, u, 0, 0, Math.PI * 2), t.fill();
|
|
870
931
|
break;
|
|
871
932
|
}
|
|
872
933
|
t.restore();
|
|
873
934
|
}
|
|
874
935
|
//#endregion
|
|
875
936
|
//#region packages/core/src/text/line-distribute.ts
|
|
876
|
-
var
|
|
877
|
-
function
|
|
937
|
+
var R = (e) => e === 32 || e === 12288;
|
|
938
|
+
function z(e, i, a = {}) {
|
|
878
939
|
if (Math.abs(i) <= .5) return null;
|
|
879
|
-
let o = a.firstContentSi ?? 0, s = a.lastDrawnSi ?? e.length - 1, c = a.minPerGap ?? -Infinity, l = a.isGapChar ?? n, u = a.isWhitespace ??
|
|
940
|
+
let o = a.firstContentSi ?? 0, s = a.lastDrawnSi ?? e.length - 1, c = a.minPerGap ?? -Infinity, l = a.isGapChar ?? n, u = a.isWhitespace ?? R, d = a.seaClusterGaps ?? !1, f = [];
|
|
880
941
|
for (let t = o; t < e.length; t++) {
|
|
881
942
|
let n = e[t];
|
|
882
943
|
if (n === void 0) continue;
|
|
@@ -938,4 +999,4 @@ function L(e, i, a = {}) {
|
|
|
938
999
|
};
|
|
939
1000
|
}
|
|
940
1001
|
//#endregion
|
|
941
|
-
export {
|
|
1002
|
+
export { I as a, m as c, u as d, f, P as i, p as l, L as n, j as o, F as r, C as s, z as t, d as u };
|