@mce/bigesj 0.2.7 → 0.11.0
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/index.js +154 -154
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { useEditor as rt, definePlugin as
|
|
2
|
-
import { assets as B, Element2D as
|
|
1
|
+
import { useEditor as rt, definePlugin as nt } from "mce";
|
|
2
|
+
import { assets as B, Element2D as ot } from "modern-canvas";
|
|
3
3
|
import { ref as Z, effectScope as it, getCurrentScope as ft, onScopeDispose as ct, onBeforeUnmount as lt } from "vue";
|
|
4
4
|
import { idGenerator as F, normalizeCRLF as Mt, isGradient as dt } from "modern-idoc";
|
|
5
5
|
import { gunzipSync as Lt } from "fflate";
|
|
6
6
|
const X = Z([]);
|
|
7
7
|
function wt(e, r) {
|
|
8
|
-
const
|
|
8
|
+
const o = [];
|
|
9
9
|
for (let t = 0; t <= r.length; t++)
|
|
10
|
-
|
|
10
|
+
o[t] = [t];
|
|
11
11
|
for (let t = 0; t <= e.length; t++)
|
|
12
|
-
|
|
12
|
+
o[0][t] = t;
|
|
13
13
|
for (let t = 1; t <= r.length; t++)
|
|
14
14
|
for (let s = 1; s <= e.length; s++) {
|
|
15
15
|
const i = e[s - 1] === r[t - 1] ? 0 : 1;
|
|
16
|
-
|
|
16
|
+
o[t][s] = Math.min(o[t - 1][s] + 1, o[t][s - 1] + 1, o[t - 1][s - 1] + i);
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return o[r.length][e.length];
|
|
19
19
|
}
|
|
20
20
|
function mt() {
|
|
21
21
|
const {
|
|
22
22
|
loadFont: e
|
|
23
23
|
} = rt(), r = Z(/* @__PURE__ */ new Map());
|
|
24
|
-
async function
|
|
25
|
-
let
|
|
26
|
-
return
|
|
24
|
+
async function o(i) {
|
|
25
|
+
let n = X.value;
|
|
26
|
+
return n.length || (n = await fetch(i).then((f) => f.json()).then((f) => f.data.datalist), X.value = n), n;
|
|
27
27
|
}
|
|
28
|
-
function t(i,
|
|
29
|
-
const f = new Map(
|
|
30
|
-
|
|
28
|
+
function t(i, n = X.value) {
|
|
29
|
+
const f = new Map(n.map((a, M) => [a.id, M])), c = new Map(
|
|
30
|
+
n.flatMap((a, M) => [...a.en_name.split(","), ...a.name.split(",")].map((L) => [L, M]))
|
|
31
31
|
), d = i.replace(/"/g, "").split(",");
|
|
32
32
|
let l;
|
|
33
33
|
if (d.forEach((a) => {
|
|
@@ -38,20 +38,20 @@ function mt() {
|
|
|
38
38
|
let L = M;
|
|
39
39
|
L.endsWith(" R") ? L = `${L.substring(0, L.length - 2)}常规` : L.endsWith(" B") && (L = `${L.substring(0, L.length - 2)}粗体`);
|
|
40
40
|
const w = L.length;
|
|
41
|
-
c.forEach((
|
|
42
|
-
const C = wt(L,
|
|
41
|
+
c.forEach((h, u) => {
|
|
42
|
+
const C = wt(L, u);
|
|
43
43
|
if (w <= C)
|
|
44
44
|
return;
|
|
45
|
-
const
|
|
46
|
-
(a === void 0 ||
|
|
45
|
+
const m = -(C * 0.9 + (u.endsWith("常规") ? 0 : 1) * 0.1);
|
|
46
|
+
(a === void 0 || m > a) && (a = m, l = h);
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
return l !== void 0 ?
|
|
50
|
+
return l !== void 0 ? n[l] : void 0;
|
|
51
51
|
}
|
|
52
52
|
async function s(i) {
|
|
53
|
-
const
|
|
54
|
-
for (const c of
|
|
53
|
+
const n = typeof i == "string" ? [i] : i, f = [];
|
|
54
|
+
for (const c of n) {
|
|
55
55
|
let d = r.value.get(c);
|
|
56
56
|
if (!d) {
|
|
57
57
|
const l = t(c);
|
|
@@ -74,7 +74,7 @@ function mt() {
|
|
|
74
74
|
return {
|
|
75
75
|
bigeFonts: X,
|
|
76
76
|
searchBigeFont: t,
|
|
77
|
-
loadBigeFonts:
|
|
77
|
+
loadBigeFonts: o,
|
|
78
78
|
loadFont: s
|
|
79
79
|
};
|
|
80
80
|
}
|
|
@@ -86,11 +86,11 @@ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
|
86
86
|
// @__NO_SIDE_EFFECTS__
|
|
87
87
|
function yt(e) {
|
|
88
88
|
if (!gt) return e;
|
|
89
|
-
let r = 0,
|
|
89
|
+
let r = 0, o, t;
|
|
90
90
|
const s = () => {
|
|
91
|
-
r -= 1, t && r <= 0 && (t.stop(),
|
|
91
|
+
r -= 1, t && r <= 0 && (t.stop(), o = void 0, t = void 0);
|
|
92
92
|
};
|
|
93
|
-
return ((...i) => (r += 1, t || (t = it(!0),
|
|
93
|
+
return ((...i) => (r += 1, t || (t = it(!0), o = t.run(() => e(...i))), ut(s), o));
|
|
94
94
|
}
|
|
95
95
|
const _ = /* @__PURE__ */ yt(() => {
|
|
96
96
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -98,11 +98,11 @@ const _ = /* @__PURE__ */ yt(() => {
|
|
|
98
98
|
let i = e.get(t);
|
|
99
99
|
return i || (i = fetch(t).then(s), e.set(t, i)), i;
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function o(t) {
|
|
102
102
|
return r(t, (s) => s.text());
|
|
103
103
|
}
|
|
104
104
|
return {
|
|
105
|
-
fetchToText:
|
|
105
|
+
fetchToText: o
|
|
106
106
|
};
|
|
107
107
|
}), Y = {
|
|
108
108
|
easing: {
|
|
@@ -437,12 +437,12 @@ const _ = /* @__PURE__ */ yt(() => {
|
|
|
437
437
|
]
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
|
-
function U(e, r,
|
|
440
|
+
function U(e, r, o) {
|
|
441
441
|
const {
|
|
442
442
|
name: t,
|
|
443
443
|
delay: s = 0,
|
|
444
444
|
duration: i,
|
|
445
|
-
iterations:
|
|
445
|
+
iterations: n,
|
|
446
446
|
mode: f,
|
|
447
447
|
easing: c,
|
|
448
448
|
path: d,
|
|
@@ -452,12 +452,12 @@ function U(e, r, n) {
|
|
|
452
452
|
let M;
|
|
453
453
|
if (t === "自定义路径" && d) {
|
|
454
454
|
let L = `M ${e.style.width / 2} ${e.style.height / 2}`;
|
|
455
|
-
d.forEach((
|
|
456
|
-
const
|
|
457
|
-
L += ` ${
|
|
455
|
+
d.forEach((h) => {
|
|
456
|
+
const u = Object.keys(h);
|
|
457
|
+
L += ` ${u[0]}${h[u[0]].join(" ")}`;
|
|
458
458
|
});
|
|
459
459
|
const w = `path("${L}")`;
|
|
460
|
-
switch (
|
|
460
|
+
switch (o) {
|
|
461
461
|
case "in":
|
|
462
462
|
M = [
|
|
463
463
|
{ opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: l },
|
|
@@ -478,7 +478,7 @@ function U(e, r, n) {
|
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
} else
|
|
481
|
-
switch (
|
|
481
|
+
switch (o) {
|
|
482
482
|
case "in":
|
|
483
483
|
M = Y.textIn[t]?.[0] ?? Y.in[t];
|
|
484
484
|
break;
|
|
@@ -493,7 +493,7 @@ function U(e, r, n) {
|
|
|
493
493
|
id: F(),
|
|
494
494
|
name: r.name ?? r.title ?? r.id,
|
|
495
495
|
delay: s,
|
|
496
|
-
duration: t ? i * (
|
|
496
|
+
duration: t ? i * (n || 1) : 0,
|
|
497
497
|
effectMode: f === "逐字" || f === "逐行" ? "sibling" : "parent",
|
|
498
498
|
keyframes: M ?? [],
|
|
499
499
|
easing: Y.easing[c],
|
|
@@ -512,20 +512,20 @@ function jt(e) {
|
|
|
512
512
|
duration: 0,
|
|
513
513
|
animations: []
|
|
514
514
|
};
|
|
515
|
-
let r,
|
|
516
|
-
e.animations[0].in ? (r = e.animations[0].in,
|
|
517
|
-
const s = r?.delay ?? 0, i = t ? t.delay - s + t.duration : 0,
|
|
518
|
-
return r &&
|
|
515
|
+
let r, o, t;
|
|
516
|
+
e.animations[0].in ? (r = e.animations[0].in, o = e.animations[0].stay, t = e.animations[0].out) : (r = e.animations?.find((f) => f.category === "in"), o = e.animations?.find((f) => f.category === "stay"), t = e.animations?.find((f) => f.category === "out"));
|
|
517
|
+
const s = r?.delay ?? 0, i = t ? t.delay - s + t.duration : 0, n = [];
|
|
518
|
+
return r && n.push(
|
|
519
519
|
U(e, {
|
|
520
520
|
...r,
|
|
521
521
|
delay: 0
|
|
522
522
|
}, "in")
|
|
523
|
-
),
|
|
523
|
+
), o && n.push(
|
|
524
524
|
U(e, {
|
|
525
|
-
...
|
|
526
|
-
delay:
|
|
525
|
+
...o,
|
|
526
|
+
delay: o.delay - s
|
|
527
527
|
}, "stay")
|
|
528
|
-
), t &&
|
|
528
|
+
), t && n.push(
|
|
529
529
|
U(e, {
|
|
530
530
|
...t,
|
|
531
531
|
delay: t.delay - s
|
|
@@ -533,17 +533,17 @@ function jt(e) {
|
|
|
533
533
|
), {
|
|
534
534
|
delay: s,
|
|
535
535
|
duration: i - s,
|
|
536
|
-
animations:
|
|
536
|
+
animations: n.filter((f) => !!f?.keyframes)
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
539
|
async function V(e) {
|
|
540
540
|
const {
|
|
541
541
|
transform: r = {},
|
|
542
|
-
style:
|
|
542
|
+
style: o = {},
|
|
543
543
|
maskUrl: t,
|
|
544
544
|
imageEffects: s = [],
|
|
545
545
|
imageEffectsRatio: i = 1
|
|
546
|
-
} = e,
|
|
546
|
+
} = e, n = e.clipUrl || e.url, {
|
|
547
547
|
translateX: f = 0,
|
|
548
548
|
translateY: c = 0,
|
|
549
549
|
zoom: d = 1
|
|
@@ -551,40 +551,40 @@ async function V(e) {
|
|
|
551
551
|
scaleX: l = 1,
|
|
552
552
|
scaleY: a = 1,
|
|
553
553
|
filter: M
|
|
554
|
-
} =
|
|
554
|
+
} = o;
|
|
555
555
|
if (f === 0 && c === 0 && d === 1 && l === 1 && a === 1 && !t && !M && !s.length)
|
|
556
|
-
return
|
|
557
|
-
const L = await B.fetchImageBitmap(
|
|
556
|
+
return n;
|
|
557
|
+
const L = await B.fetchImageBitmap(n), {
|
|
558
558
|
originWidth: w = L.width,
|
|
559
|
-
originHeight:
|
|
560
|
-
imageWidth:
|
|
561
|
-
imageHeight: C =
|
|
559
|
+
originHeight: h = L.height,
|
|
560
|
+
imageWidth: u = w,
|
|
561
|
+
imageHeight: C = h
|
|
562
562
|
} = r, {
|
|
563
|
-
width:
|
|
564
|
-
height:
|
|
565
|
-
} =
|
|
566
|
-
if (M && (
|
|
567
|
-
const
|
|
568
|
-
|
|
563
|
+
width: m = w,
|
|
564
|
+
height: g = h
|
|
565
|
+
} = o, T = window.devicePixelRatio || 1, [j, y] = W(m, g, T);
|
|
566
|
+
if (M && (y.filter = M), y.scale(l, a), y.translate(l < 0 ? -m : 0, a < 0 ? -g : 0), t) {
|
|
567
|
+
const D = await B.fetchImageBitmap(t);
|
|
568
|
+
y.drawImage(D, 0, 0, D.width, D.height, 0, 0, m, g), D.close(), y.globalCompositeOperation = "source-in";
|
|
569
569
|
}
|
|
570
|
-
const A =
|
|
571
|
-
if (
|
|
570
|
+
const A = u * d, k = C * d, tt = -(A / 2 - u / 2) + f, et = -(k / 2 - C / 2) + c;
|
|
571
|
+
if (y.drawImage(L, 0, 0, L.width, L.height, tt, et, A, k), L.close(), y.globalCompositeOperation = "source-over", s.length > 0) {
|
|
572
572
|
const S = {
|
|
573
|
-
x: (
|
|
574
|
-
y: (
|
|
575
|
-
}, v = await createImageBitmap(
|
|
576
|
-
|
|
573
|
+
x: (m - m * 0.9) / 2,
|
|
574
|
+
y: (g - g * 0.9) / 2
|
|
575
|
+
}, v = await createImageBitmap(j);
|
|
576
|
+
y.clearRect(0, 0, j.width, j.height), y.scale(0.9, 0.9);
|
|
577
577
|
for (let G = s.length - 1; G >= 0; G--) {
|
|
578
578
|
const { filling: b, offset: R, stroke: at } = s[G];
|
|
579
579
|
let z = v;
|
|
580
580
|
if (b) {
|
|
581
|
-
const [I, x] = W(
|
|
582
|
-
if (x.drawImage(z, 0, 0,
|
|
583
|
-
const [p, N] = W(
|
|
584
|
-
N.fillStyle = b.color, N.fillRect(0, 0,
|
|
581
|
+
const [I, x] = W(m, g, T);
|
|
582
|
+
if (x.drawImage(z, 0, 0, m, g), x.globalCompositeOperation = "source-in", b.color) {
|
|
583
|
+
const [p, N] = W(m, g, T);
|
|
584
|
+
N.fillStyle = b.color, N.fillRect(0, 0, m, g), x.drawImage(p, 0, 0, m, g);
|
|
585
585
|
} else if (b.imageContent?.image) {
|
|
586
586
|
const p = await B.fetchImageBitmap(b.imageContent.image);
|
|
587
|
-
x.drawImage(p, 0, 0,
|
|
587
|
+
x.drawImage(p, 0, 0, m, g), p.close();
|
|
588
588
|
}
|
|
589
589
|
z = I;
|
|
590
590
|
}
|
|
@@ -605,27 +605,27 @@ async function V(e) {
|
|
|
605
605
|
});
|
|
606
606
|
}), R) {
|
|
607
607
|
let { x: I, y: x } = R;
|
|
608
|
-
I = I / 50 * i * 200, x = x / 50 * i * 200,
|
|
608
|
+
I = I / 50 * i * 200, x = x / 50 * i * 200, y.drawImage(z, I + S.x, x + S.y, m, g);
|
|
609
609
|
} else
|
|
610
|
-
|
|
610
|
+
y.drawImage(z, S.x, S.y, m, g);
|
|
611
611
|
}
|
|
612
612
|
v.close();
|
|
613
613
|
}
|
|
614
|
-
return await new Promise((
|
|
615
|
-
|
|
614
|
+
return await new Promise((D) => {
|
|
615
|
+
j.toBlob((S) => {
|
|
616
616
|
try {
|
|
617
|
-
|
|
617
|
+
D(URL.createObjectURL(S));
|
|
618
618
|
} catch (v) {
|
|
619
|
-
console.error(`Failed to URL.createObjectURL, url: ${
|
|
619
|
+
console.error(`Failed to URL.createObjectURL, url: ${n}`, v), D(n);
|
|
620
620
|
}
|
|
621
621
|
});
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
|
-
function W(e, r,
|
|
624
|
+
function W(e, r, o = 1) {
|
|
625
625
|
const t = document.createElement("canvas");
|
|
626
|
-
t.width = e *
|
|
626
|
+
t.width = e * o, t.height = r * o, t.style.width = `${e}px`, t.style.height = `${r}px`;
|
|
627
627
|
const s = t.getContext("2d");
|
|
628
|
-
return s.scale(
|
|
628
|
+
return s.scale(o, o), [t, s];
|
|
629
629
|
}
|
|
630
630
|
class ht {
|
|
631
631
|
canvas = document.createElement("canvas");
|
|
@@ -633,35 +633,35 @@ class ht {
|
|
|
633
633
|
use(r) {
|
|
634
634
|
return this.method = r, this;
|
|
635
635
|
}
|
|
636
|
-
make(r,
|
|
637
|
-
const { canvas: t } = this, s = this.canvas.getContext("2d"), i =
|
|
638
|
-
return (
|
|
636
|
+
make(r, o) {
|
|
637
|
+
const { canvas: t } = this, s = this.canvas.getContext("2d"), i = o.thickness * 2, [n, f] = [r.width, r.height].map((c) => c + i);
|
|
638
|
+
return (n !== t.width || f !== t.height) && (t.width = n, t.height = f), s.clearRect(0, 0, s.canvas.width, s.canvas.height), this.method(s, r, o), s.drawImage(r, o.thickness, o.thickness), t;
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
function Ct(e) {
|
|
642
642
|
const t = e.canvas.width, s = e.canvas.height, i = [];
|
|
643
|
-
let
|
|
643
|
+
let n = 3;
|
|
644
644
|
const f = 100;
|
|
645
645
|
return (() => {
|
|
646
646
|
const d = [], l = new Uint32Array(e.getImageData(0, 0, t, s).data.buffer);
|
|
647
|
-
let a, M, L, w,
|
|
648
|
-
const
|
|
649
|
-
function
|
|
650
|
-
return
|
|
647
|
+
let a, M, L, w, h = -1, u, C = 9;
|
|
648
|
+
const m = [9, 0, 3, 3, 2, 0, 9, 3, 1, 9, 1, 1, 2, 0, 2, 9];
|
|
649
|
+
function g(j, y) {
|
|
650
|
+
return j >= 0 && y >= 0 && j < t && y < s ? l[y * t + j] >>> 24 > f : !1;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function T(j, y) {
|
|
653
653
|
let A = 0;
|
|
654
|
-
return
|
|
654
|
+
return g(j - 1, y - 1) && (A += 1), g(j, y - 1) && (A += 2), g(j - 1, y) && (A += 4), g(j, y) && (A += 8), A === 6 ? C === 0 ? 2 : 3 : A === 9 ? C === 3 ? 0 : 1 : m[A];
|
|
655
655
|
}
|
|
656
|
-
for (let
|
|
657
|
-
if (l[
|
|
658
|
-
|
|
656
|
+
for (let j = n; j < l.length; j++)
|
|
657
|
+
if (l[j] >>> 24 > f) {
|
|
658
|
+
h = n = j;
|
|
659
659
|
break;
|
|
660
660
|
}
|
|
661
|
-
if (
|
|
662
|
-
a = L =
|
|
661
|
+
if (h >= 0) {
|
|
662
|
+
a = L = h % t, M = w = Math.floor(h / t);
|
|
663
663
|
do
|
|
664
|
-
|
|
664
|
+
u = T(a, M), u === 0 ? M-- : u === 1 ? M++ : u === 2 ? a-- : u === 3 && a++, u !== C && (d.push({ x: a + 0, y: M + 0 }), C = u);
|
|
665
665
|
while (a !== L || M !== w);
|
|
666
666
|
}
|
|
667
667
|
return i.push(d), d;
|
|
@@ -670,19 +670,19 @@ function Ct(e) {
|
|
|
670
670
|
async function pt(e) {
|
|
671
671
|
const {
|
|
672
672
|
id: r,
|
|
673
|
-
doc:
|
|
673
|
+
doc: o,
|
|
674
674
|
url: t,
|
|
675
675
|
style: s = {},
|
|
676
676
|
background: i = {}
|
|
677
677
|
} = e;
|
|
678
|
-
let
|
|
679
|
-
|
|
678
|
+
let n = o;
|
|
679
|
+
n || (n = await fetch(t).then((c) => c.text()));
|
|
680
680
|
const f = new DOMParser().parseFromString(
|
|
681
|
-
|
|
681
|
+
n.replace(new RegExp(`#el-${r} `, "gi"), "").replace(/data-colors\s/, " ").replace(/[a-z-]+="([^\s<]*<\S*)"/gi, ""),
|
|
682
682
|
"image/svg+xml"
|
|
683
683
|
).documentElement;
|
|
684
684
|
if (!(f instanceof SVGElement))
|
|
685
|
-
throw new TypeError(`Failed to DOMParser, parse svg to DOM error: ${
|
|
685
|
+
throw new TypeError(`Failed to DOMParser, parse svg to DOM error: ${n}`);
|
|
686
686
|
if (i.src) {
|
|
687
687
|
const c = `#${r}-fill-blip`, d = f.querySelector(c), l = d?.querySelector("image");
|
|
688
688
|
if (d && l)
|
|
@@ -708,21 +708,21 @@ async function pt(e) {
|
|
|
708
708
|
}
|
|
709
709
|
const At = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNzIgNzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDcyIDcyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTE5LjMsMzguMWMwLjIsMC41LDAuNCwwLjksMC43LDEuNGMwLjIsMC4zLDAuNCwwLjQsMC44LDAuNGMwLjMsMCwwLjUtMC4xLDAuNi0wLjRjMC4xLTAuMywwLjEtMC42LDAuMi0wLjkgICBjMC0wLjIsMC4xLTAuNCwwLjMtMC41YzAuMi0wLjEsMC40LTAuMiwwLjYtMC4xYzAuMiwwLDAuNCwwLjEsMC41LDAuM2MwLjEsMC4yLDAuMiwwLjQsMC4xLDAuNmMtMC4xLDAuNi0wLjIsMS4yLTAuNCwxLjcgICBjLTAuMywwLjgtMC45LDEuMi0xLjcsMS4yYy0wLjksMC0xLjYtMC40LTIuMS0xLjJjLTAuMy0wLjQtMC41LTAuOC0wLjctMS4zYy0wLjQsMC4zLTEsMC42LTEuNywxYy0wLjUsMC4yLTAuOCwwLjEtMS4xLTAuMyAgIGMtMC4yLTAuNS0wLjEtMC45LDAuMy0xLjFjMC43LTAuNCwxLjQtMC44LDEuOS0xLjFjLTAuMi0wLjktMC40LTIuMS0wLjUtMy43TDE1LjksMzRjLTAuMiwwLTAuNCwwLTAuNi0wLjEgICBjLTAuMi0wLjEtMC4zLTAuMy0wLjMtMC41YzAtMC4yLDAtMC40LDAuMi0wLjZzMC4zLTAuMywwLjUtMC4z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MC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMmMwLjIsMCwwLjQsMC4xLDAuNiwwLjIgICBjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTU2LjYsNDAuM2MwLjIsMC40LDAuMSwwLjgtMC4zLDEuMWMtMC41LDAuMy0wLjgsMC4yLTEuMS0wLjNsLTEtMS43Yy0wLjItMC41LTAuMS0wLjgsMC4zLTEuMSAgIGMwLjUtMC4yLDAuOS0wLjEsMS4xLDAuM0w1Ni42LDQwLjN6Ii8+CjwvZz4KPC9zdmc+";
|
|
710
710
|
async function xt(e, r = !1) {
|
|
711
|
-
const { fetchToText:
|
|
711
|
+
const { fetchToText: o } = _(), t = {
|
|
712
712
|
...e.style,
|
|
713
713
|
highlightReferImage: At,
|
|
714
714
|
listStyleType: "none",
|
|
715
715
|
listStyleImage: "none"
|
|
716
716
|
};
|
|
717
|
-
return e.style.fontSize && (t.fontSize = Math.floor(e.style.fontSize)), e.listStyle?.colormap && (t.listStyleColormap = e.listStyle?.colormap), r || (e.listMode ? t.listStyleType = "disc" : e.listStyle && (t.listStyleImage = await
|
|
717
|
+
return e.style.fontSize && (t.fontSize = Math.floor(e.style.fontSize)), e.listStyle?.colormap && (t.listStyleColormap = e.listStyle?.colormap), r || (e.listMode ? t.listStyleType = "disc" : e.listStyle && (t.listStyleImage = await o(e.listStyle.image), t.listStyleSize = `${e.listStyle.size * 100}%`)), e.background?.enabled ? (t.backgroundImage = e.background.image, t.backgroundSize = e.background.size, t.backgroundColormap = e.background.colormap, t.padding = e.background.padding) : t.padding = 0, t;
|
|
718
718
|
}
|
|
719
719
|
async function Tt(e) {
|
|
720
720
|
const r = e.textEffects ?? [];
|
|
721
721
|
if (r.length)
|
|
722
722
|
return await Promise.all(
|
|
723
|
-
[...r].reverse().map(async (
|
|
724
|
-
const t = {}, { offset: s, skew: i, stroke:
|
|
725
|
-
if (s && (t.translateX = s.x, t.translateY = s.y), i && (t.skewX = i.x, t.skewY = i.y),
|
|
723
|
+
[...r].reverse().map(async (o) => {
|
|
724
|
+
const t = {}, { offset: s, skew: i, stroke: n, shadow: f, filling: c } = o;
|
|
725
|
+
if (s && (t.translateX = s.x, t.translateY = s.y), i && (t.skewX = i.x, t.skewY = i.y), n?.color && n.width && (t.textStrokeWidth = n.width, t.textStrokeColor = n.color), f && (t.shadowOffsetX = f.offsetX, t.shadowOffsetY = f.offsetY, t.shadowBlur = f.blur, t.shadowColor = f.color), c) {
|
|
726
726
|
const { color: d, imageContent: l, gradient: a } = c;
|
|
727
727
|
l?.image || (a ? t.color = `linear-gradient(${90 - a.angle}deg, ${a.stops.map((M) => `${M.color} ${M.offset * 100}%`).join(",")})` : d && (t.color = d));
|
|
728
728
|
}
|
|
@@ -732,24 +732,24 @@ async function Tt(e) {
|
|
|
732
732
|
}
|
|
733
733
|
function Dt(e) {
|
|
734
734
|
return e.version ? e.contents : e.contents.map((r) => {
|
|
735
|
-
let
|
|
735
|
+
let o;
|
|
736
736
|
return r.map((t, s) => {
|
|
737
737
|
let i = t.content;
|
|
738
738
|
i = i.replace(/ |\r\n|\n\r|[\n\r\t\v]/g, " "), i = i.replace(/<br\/>/g, `
|
|
739
739
|
`);
|
|
740
|
-
let
|
|
740
|
+
let n = "", f = 0;
|
|
741
741
|
for (const c of Array.from(i))
|
|
742
|
-
s === 0 && f === 0 && c === " " ||
|
|
742
|
+
s === 0 && f === 0 && c === " " || o === " " && c === " " || (n += c), o = c, f++;
|
|
743
743
|
return {
|
|
744
744
|
...t,
|
|
745
|
-
content:
|
|
745
|
+
content: n
|
|
746
746
|
};
|
|
747
747
|
}).filter((t) => t.content);
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
async function It(e, r = !1) {
|
|
751
|
-
const { fetchToText:
|
|
752
|
-
for (let i = 0,
|
|
751
|
+
const { fetchToText: o } = _(), t = Dt(e), s = [];
|
|
752
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
753
753
|
const f = t[i], c = {
|
|
754
754
|
fragments: []
|
|
755
755
|
};
|
|
@@ -758,7 +758,7 @@ async function It(e, r = !1) {
|
|
|
758
758
|
const a = {}, M = f[d];
|
|
759
759
|
for (const w in M)
|
|
760
760
|
w !== "id" && M[w] !== "" && (a[w] = M[w]);
|
|
761
|
-
a.fontSize && (a.fontSize = Math.floor(a.fontSize)), a.content = Mt(a.content), a.highlight && (a.highlightImage = await
|
|
761
|
+
a.fontSize && (a.fontSize = Math.floor(a.fontSize)), a.content = Mt(a.content), a.highlight && (a.highlightImage = await o(a.highlight.image), r ? a.highlightSize = "cover" : a.highlight.size && (a.highlightSize = `${a.highlight.size}rem`), a.highlight.colormap && (a.highlightColormap = a.highlight.colormap), a.highlight.line && (a.highlightLine = a.highlight.line), a.highlight.thickness && (a.highlightThickness = `${a.highlight.thickness}%`), delete a.highlight), r || (a.listMode ? c.listStyleType = "disc" : a.listStyle && (c.listStyleImage = await o(a.listStyle.image), c.listStyleSize = `${a.listStyle.size * 100}%`));
|
|
762
762
|
const L = c.fragments[c.fragments.length - 1];
|
|
763
763
|
L && Object.keys(L).length === 1 && L.content && Object.keys(a).length === 1 && a.content ? L.content += a.content : c.fragments.push(a);
|
|
764
764
|
}
|
|
@@ -766,7 +766,7 @@ async function It(e, r = !1) {
|
|
|
766
766
|
return s;
|
|
767
767
|
}
|
|
768
768
|
const P = (e) => (Number.parseFloat(e) || 0) / 100;
|
|
769
|
-
async function q(e, r,
|
|
769
|
+
async function q(e, r, o) {
|
|
770
770
|
const t = { ...e.style ?? e };
|
|
771
771
|
delete t.bottom, delete t.right;
|
|
772
772
|
const s = {
|
|
@@ -782,13 +782,13 @@ async function q(e, r, n) {
|
|
|
782
782
|
children: []
|
|
783
783
|
};
|
|
784
784
|
if (t.borderRadius && (t.borderRadius = t.borderRadius * 0.01 * Math.max(t.height, t.width)), r && e.groupStyle && (t.width = r.style.width * P(e.groupStyle.width), t.height = r.style.height * P(e.groupStyle.height), t.left = r.style.width * P(e.groupStyle.left), t.top = r.style.height * P(e.groupStyle.top)), e.editable === !1 && (t.visibility = "hidden"), e.lock === !0 && (s.lock = !0), e.animations?.length) {
|
|
785
|
-
const
|
|
786
|
-
i.delay =
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
785
|
+
const n = jt(e);
|
|
786
|
+
i.delay = n.delay, i.duration = n.duration, i.children.push(...n.animations), o && (n.animations.forEach((f) => {
|
|
787
|
+
o.endTime = Math.max(
|
|
788
|
+
o.endTime,
|
|
789
|
+
n.delay + f.delay + f.duration
|
|
790
790
|
);
|
|
791
|
-
}),
|
|
791
|
+
}), o.endTime = Math.max(o.endTime, n.delay + n.duration));
|
|
792
792
|
}
|
|
793
793
|
switch (e.type) {
|
|
794
794
|
case "image":
|
|
@@ -796,20 +796,20 @@ async function q(e, r, n) {
|
|
|
796
796
|
image: await V(e),
|
|
797
797
|
fillWithShape: !0
|
|
798
798
|
}, e.clipUrl && (s.rawForegroundImage = e.url), e.cropping) {
|
|
799
|
-
const
|
|
799
|
+
const n = e.style.width, f = e.style.height, {
|
|
800
800
|
imageWidth: c,
|
|
801
801
|
imageHeight: d,
|
|
802
|
-
maskWidth: l =
|
|
802
|
+
maskWidth: l = n,
|
|
803
803
|
maskHeight: a = f,
|
|
804
804
|
translateX: M,
|
|
805
805
|
translateY: L,
|
|
806
806
|
zoom: w = 1
|
|
807
|
-
} = e.cropping,
|
|
807
|
+
} = e.cropping, h = c * w, u = d * w, C = (h - l) / 2 - M, m = (u - a) / 2 - L, g = C + l / 2, T = m + a / 2, j = -(n / 2 - g), y = -(f / 2 - T), A = h - (j + n), k = u - (y + f);
|
|
808
808
|
i.foreground.cropRect = {
|
|
809
|
-
left:
|
|
810
|
-
top:
|
|
811
|
-
right: A /
|
|
812
|
-
bottom: k /
|
|
809
|
+
left: j / h,
|
|
810
|
+
top: y / u,
|
|
811
|
+
right: A / h,
|
|
812
|
+
bottom: k / u
|
|
813
813
|
};
|
|
814
814
|
}
|
|
815
815
|
break;
|
|
@@ -831,9 +831,9 @@ async function q(e, r, n) {
|
|
|
831
831
|
}
|
|
832
832
|
case "com":
|
|
833
833
|
s.inPptIs = "GroupShape", i.children = (await Promise.all(
|
|
834
|
-
e.children.map(async (
|
|
834
|
+
e.children.map(async (n) => {
|
|
835
835
|
try {
|
|
836
|
-
return await q(
|
|
836
|
+
return await q(n, e, o);
|
|
837
837
|
} catch (f) {
|
|
838
838
|
console.warn(f);
|
|
839
839
|
return;
|
|
@@ -868,7 +868,7 @@ async function q(e, r, n) {
|
|
|
868
868
|
}
|
|
869
869
|
return i;
|
|
870
870
|
}
|
|
871
|
-
async function St(e, r = !0,
|
|
871
|
+
async function St(e, r = !0, o) {
|
|
872
872
|
const t = F(), s = {
|
|
873
873
|
...e.style ?? e
|
|
874
874
|
};
|
|
@@ -878,17 +878,17 @@ async function St(e, r = !0, n) {
|
|
|
878
878
|
inEditorIs: r ? "Frame" : "Element"
|
|
879
879
|
};
|
|
880
880
|
e.id && (i.rawId = e.id), e.name && (i.rawName = e.name);
|
|
881
|
-
let
|
|
882
|
-
return e.background && (e.background.color && (
|
|
881
|
+
let n;
|
|
882
|
+
return e.background && (e.background.color && (n ??= {}, dt(e.background.color ?? "") ? n.image = e.background.color : n.color = e.background.color), e.background.image && (n ??= {}, n.image = e.background.image)), {
|
|
883
883
|
id: t,
|
|
884
884
|
name: r ? `Frame ${t}` : e.name,
|
|
885
885
|
style: s,
|
|
886
886
|
// TODO 过滤掉部分属性
|
|
887
|
-
background:
|
|
887
|
+
background: n,
|
|
888
888
|
children: (await Promise.all(
|
|
889
889
|
e.elements.map(async (f) => {
|
|
890
890
|
try {
|
|
891
|
-
return await q(f, void 0,
|
|
891
|
+
return await q(f, void 0, o);
|
|
892
892
|
} catch (c) {
|
|
893
893
|
console.warn(c);
|
|
894
894
|
return;
|
|
@@ -900,20 +900,20 @@ async function St(e, r = !0, n) {
|
|
|
900
900
|
}
|
|
901
901
|
async function K(e, r = 0) {
|
|
902
902
|
const {
|
|
903
|
-
layouts:
|
|
903
|
+
layouts: o,
|
|
904
904
|
metas: t = {}
|
|
905
905
|
} = e, s = {
|
|
906
906
|
endTime: 0
|
|
907
907
|
};
|
|
908
908
|
let i = await Promise.all(
|
|
909
|
-
|
|
909
|
+
o.map(async (c, d) => ({
|
|
910
910
|
index: d,
|
|
911
911
|
element: await St(c, !0, s)
|
|
912
912
|
}))
|
|
913
|
-
),
|
|
913
|
+
), n = 0;
|
|
914
914
|
i = i.sort((c, d) => c.index - d.index).map((c, d) => {
|
|
915
915
|
const l = c.element;
|
|
916
|
-
return l.style && (l.style.top =
|
|
916
|
+
return l.style && (l.style.top = n, n += Number(l.style.height) + r), l.name = `Frame ${d + 1}`, l;
|
|
917
917
|
});
|
|
918
918
|
const f = i.reduce((c) => {
|
|
919
919
|
const d = c.style?.left ?? 0, l = c.style?.top ?? 0, a = c.style?.width ?? 0, M = c.style?.height ?? 0;
|
|
@@ -940,32 +940,32 @@ async function K(e, r = 0) {
|
|
|
940
940
|
};
|
|
941
941
|
}
|
|
942
942
|
function zt(e, r) {
|
|
943
|
-
const { config:
|
|
943
|
+
const { config: o } = e;
|
|
944
944
|
return {
|
|
945
945
|
name: "bigesj:bidTid",
|
|
946
946
|
test: (t) => typeof t == "object" && t && !!(t.bid || t.tid),
|
|
947
947
|
load: async (t) => {
|
|
948
948
|
const s = t.bid ?? t.tid ?? "", i = async (l) => await fetch(
|
|
949
949
|
(t.bid ? r.bid : r.tid).replace("%d", l)
|
|
950
|
-
).then((a) => a.json()).then((a) =>
|
|
951
|
-
let
|
|
950
|
+
).then((a) => a.json()).then((a) => a.data);
|
|
951
|
+
let n = 0;
|
|
952
952
|
const f = await Promise.all(
|
|
953
953
|
s.split("|").map(async (l) => {
|
|
954
954
|
let [a, M] = l.split("[");
|
|
955
955
|
M && (M = M.substring(0, M.length - 1));
|
|
956
|
-
const L = M ? M.split(",").map((
|
|
957
|
-
L !== void 0 && (
|
|
958
|
-
const
|
|
959
|
-
return
|
|
956
|
+
const L = M ? M.split(",").map((g) => Number(g)) : void 0, w = await i(a), { content: h, ...u } = w, C = JSON.parse(h);
|
|
957
|
+
L !== void 0 && (C.layouts = C.layouts.filter((g, T) => L.includes(T)));
|
|
958
|
+
const m = await K(C);
|
|
959
|
+
return m.meta.raw = u, n = Math.max(n, m.meta?.maxTime ?? 0), m;
|
|
960
960
|
})
|
|
961
961
|
), c = { ...f[0], id: s, children: [] };
|
|
962
|
-
c.meta ??= {}, c.meta.maxTime =
|
|
962
|
+
c.meta ??= {}, c.meta.maxTime = n, c.meta.inEditorIs = "Doc";
|
|
963
963
|
let d = 0;
|
|
964
964
|
return f.forEach((l) => {
|
|
965
965
|
let a = 0;
|
|
966
966
|
l.children?.forEach((M) => {
|
|
967
967
|
M.style && (M.style.left = d, a = Math.max(a, Number(M.style.width)), c.children.push(M));
|
|
968
|
-
}), d += a +
|
|
968
|
+
}), d += a + o.value.frameGap;
|
|
969
969
|
}), c;
|
|
970
970
|
}
|
|
971
971
|
};
|
|
@@ -980,7 +980,7 @@ function Nt() {
|
|
|
980
980
|
new TextDecoder().decode(
|
|
981
981
|
Lt(new Uint8Array(await e.arrayBuffer()))
|
|
982
982
|
)
|
|
983
|
-
), { content:
|
|
983
|
+
), { content: o, ...t } = r, s = await K(o);
|
|
984
984
|
return s.meta.raw = t, s;
|
|
985
985
|
}
|
|
986
986
|
};
|
|
@@ -988,14 +988,14 @@ function Nt() {
|
|
|
988
988
|
function Qt(e = {}) {
|
|
989
989
|
const {
|
|
990
990
|
font: r,
|
|
991
|
-
api:
|
|
991
|
+
api: o
|
|
992
992
|
} = e, t = {
|
|
993
993
|
fonts: "/new/design/fonts",
|
|
994
994
|
bid: "/new/udesign/info/%d",
|
|
995
995
|
tid: "/new/design/info/%d",
|
|
996
|
-
...
|
|
996
|
+
...o
|
|
997
997
|
};
|
|
998
|
-
return
|
|
998
|
+
return nt((s) => ({
|
|
999
999
|
name: "bigesj",
|
|
1000
1000
|
loaders: [
|
|
1001
1001
|
Nt(),
|
|
@@ -1008,18 +1008,18 @@ function Qt(e = {}) {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
async function bt(e, r) {
|
|
1010
1010
|
const {
|
|
1011
|
-
on:
|
|
1011
|
+
on: o,
|
|
1012
1012
|
off: t,
|
|
1013
1013
|
root: s
|
|
1014
1014
|
} = e, {
|
|
1015
1015
|
loadBigeFonts: i,
|
|
1016
|
-
loadFont:
|
|
1016
|
+
loadFont: n
|
|
1017
1017
|
} = mt();
|
|
1018
1018
|
function f(l) {
|
|
1019
|
-
l instanceof
|
|
1019
|
+
l instanceof ot && (l.style.fontFamily && n(l.style.fontFamily).then(() => l.text.update()), l.text.content.forEach((a) => {
|
|
1020
1020
|
a.fragments.forEach((M) => {
|
|
1021
|
-
M.fontFamily &&
|
|
1022
|
-
}), a.fontFamily &&
|
|
1021
|
+
M.fontFamily && n(M.fontFamily).then(() => l.text.update());
|
|
1022
|
+
}), a.fontFamily && n(a.fontFamily).then(() => l.text.update());
|
|
1023
1023
|
}));
|
|
1024
1024
|
}
|
|
1025
1025
|
function c(l) {
|
|
@@ -1032,7 +1032,7 @@ async function bt(e, r) {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
lt(() => {
|
|
1034
1034
|
t("setDoc", d), t("addElement", c);
|
|
1035
|
-
}),
|
|
1035
|
+
}), o("setDoc", d), o("addElement", c), await i(r.fonts);
|
|
1036
1036
|
}
|
|
1037
1037
|
export {
|
|
1038
1038
|
zt as bidTidLoader,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/bigesj",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0",
|
|
5
5
|
"description": "Plugin for mce",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"fflate": "^0.8.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"modern-canvas": "^0.12.
|
|
51
|
+
"modern-canvas": "^0.12.21",
|
|
52
52
|
"modern-font": "^0.4.4",
|
|
53
53
|
"modern-idoc": "^0.10.5",
|
|
54
54
|
"vue": "^3.5.22",
|
|
55
|
-
"mce": "0.
|
|
55
|
+
"mce": "0.11.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"mce": "^0"
|