@mce/bigesj 0.1.4 → 0.2.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/dist/composables/useFonts.d.ts +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +311 -263
- package/dist/loaders/bidTid.d.ts +2 -0
- package/dist/loaders/bige.d.ts +2 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/plugin.d.ts +9 -1
- package/package.json +3 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { FontLoadedResult } from 'modern-font';
|
|
2
2
|
export type BigeFont = Record<string, any>;
|
|
3
|
-
export declare const bigeFonts: import("vue").Ref<BigeFont[], BigeFont[]>;
|
|
4
3
|
export declare function useFonts(): {
|
|
5
4
|
bigeFonts: import("vue").Ref<BigeFont[], BigeFont[]>;
|
|
6
5
|
searchBigeFont: (keyword: string, fonts?: BigeFont[]) => BigeFont | undefined;
|
|
7
|
-
loadBigeFonts: () => Promise<BigeFont[]>;
|
|
6
|
+
loadBigeFonts: (url: string) => Promise<BigeFont[]>;
|
|
8
7
|
loadFont: (name: string | string[]) => Promise<(FontLoadedResult | undefined)[]>;
|
|
9
8
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEditor as b, definePlugin as k } from "mce";
|
|
1
|
+
import { useEditor as Y, definePlugin as k } from "mce";
|
|
3
2
|
import { Element2D as O } from "modern-canvas";
|
|
4
|
-
import { ref as I, effectScope as
|
|
3
|
+
import { ref as I, effectScope as v, getCurrentScope as Q, onScopeDispose as X, onBeforeUnmount as G } from "vue";
|
|
5
4
|
import { idGenerator as x, normalizeCRLF as W, isGradient as F } from "modern-idoc";
|
|
5
|
+
import { gunzipSync as P } from "fflate";
|
|
6
6
|
const p = I([]);
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
for (let
|
|
10
|
-
|
|
11
|
-
for (let
|
|
12
|
-
|
|
13
|
-
for (let
|
|
14
|
-
for (let
|
|
15
|
-
const
|
|
16
|
-
|
|
7
|
+
function U(e, o) {
|
|
8
|
+
const n = [];
|
|
9
|
+
for (let t = 0; t <= o.length; t++)
|
|
10
|
+
n[t] = [t];
|
|
11
|
+
for (let t = 0; t <= e.length; t++)
|
|
12
|
+
n[0][t] = t;
|
|
13
|
+
for (let t = 1; t <= o.length; t++)
|
|
14
|
+
for (let a = 1; a <= e.length; a++) {
|
|
15
|
+
const s = e[a - 1] === o[t - 1] ? 0 : 1;
|
|
16
|
+
n[t][a] = Math.min(n[t - 1][a] + 1, n[t][a - 1] + 1, n[t - 1][a - 1] + s);
|
|
17
17
|
}
|
|
18
|
-
return o
|
|
18
|
+
return n[o.length][e.length];
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function B() {
|
|
21
21
|
const {
|
|
22
|
-
loadFont:
|
|
23
|
-
} =
|
|
24
|
-
async function
|
|
25
|
-
let
|
|
26
|
-
return
|
|
22
|
+
loadFont: e
|
|
23
|
+
} = Y(), o = I(/* @__PURE__ */ new Map());
|
|
24
|
+
async function n(s) {
|
|
25
|
+
let f = p.value;
|
|
26
|
+
return f.length || (f = await fetch(s).then((M) => M.json()).then((M) => M.data.datalist), p.value = f), f;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const M = new Map(f.map((r,
|
|
30
|
-
f.flatMap((r,
|
|
31
|
-
),
|
|
28
|
+
function t(s, f = p.value) {
|
|
29
|
+
const M = new Map(f.map((r, c) => [r.id, c])), L = new Map(
|
|
30
|
+
f.flatMap((r, c) => [...r.en_name.split(","), ...r.name.split(",")].map((l) => [l, c]))
|
|
31
|
+
), d = s.replace(/"/g, "").split(",");
|
|
32
32
|
let i;
|
|
33
|
-
if (
|
|
33
|
+
if (d.forEach((r) => {
|
|
34
34
|
i ??= M.get(r), i ??= L.get(r);
|
|
35
35
|
}), i === void 0) {
|
|
36
36
|
let r;
|
|
37
|
-
|
|
38
|
-
let l =
|
|
37
|
+
d.forEach((c) => {
|
|
38
|
+
let l = c;
|
|
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
41
|
L.forEach((m, u) => {
|
|
42
|
-
const
|
|
43
|
-
if (w <=
|
|
42
|
+
const y = U(l, u);
|
|
43
|
+
if (w <= y)
|
|
44
44
|
return;
|
|
45
|
-
const
|
|
46
|
-
(r === void 0 ||
|
|
45
|
+
const g = -(y * 0.9 + (u.endsWith("常规") ? 0 : 1) * 0.1);
|
|
46
|
+
(r === void 0 || g > r) && (r = g, i = m);
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return i !== void 0 ? f[i] : void 0;
|
|
51
51
|
}
|
|
52
|
-
async function s
|
|
53
|
-
const f = typeof
|
|
52
|
+
async function a(s) {
|
|
53
|
+
const f = typeof s == "string" ? [s] : s, M = [];
|
|
54
54
|
for (const L of f) {
|
|
55
|
-
let
|
|
56
|
-
if (!
|
|
57
|
-
const i =
|
|
58
|
-
if (i && (
|
|
55
|
+
let d = o.value.get(L);
|
|
56
|
+
if (!d) {
|
|
57
|
+
const i = t(L);
|
|
58
|
+
if (i && (d = o.value.get(i.en_name), !d)) {
|
|
59
59
|
const r = Array.from(
|
|
60
60
|
new Set(
|
|
61
|
-
[L, i.en_name].filter(Boolean).map((
|
|
61
|
+
[L, i.en_name].filter(Boolean).map((c) => c.replace(/"/g, ""))
|
|
62
62
|
)
|
|
63
63
|
);
|
|
64
|
-
|
|
64
|
+
d = e({
|
|
65
65
|
family: r,
|
|
66
66
|
src: i.fonturl
|
|
67
|
-
}), r.forEach((
|
|
67
|
+
}), r.forEach((c) => o.value.set(c, d)), o.value.set(String(L), d);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
d && M.push(d);
|
|
71
71
|
}
|
|
72
72
|
return await Promise.all(M);
|
|
73
73
|
}
|
|
74
74
|
return {
|
|
75
75
|
bigeFonts: p,
|
|
76
|
-
searchBigeFont:
|
|
77
|
-
loadBigeFonts:
|
|
78
|
-
loadFont:
|
|
76
|
+
searchBigeFont: t,
|
|
77
|
+
loadBigeFonts: n,
|
|
78
|
+
loadFont: a
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function J(e, o) {
|
|
82
|
+
return Q() ? (X(e, o), !0) : !1;
|
|
83
83
|
}
|
|
84
|
-
const
|
|
84
|
+
const R = typeof window < "u" && typeof document < "u";
|
|
85
85
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
86
86
|
// @__NO_SIDE_EFFECTS__
|
|
87
|
-
function
|
|
88
|
-
if (!
|
|
89
|
-
let
|
|
90
|
-
const
|
|
91
|
-
|
|
87
|
+
function Z(e) {
|
|
88
|
+
if (!R) return e;
|
|
89
|
+
let o = 0, n, t;
|
|
90
|
+
const a = () => {
|
|
91
|
+
o -= 1, t && o <= 0 && (t.stop(), n = void 0, t = void 0);
|
|
92
92
|
};
|
|
93
|
-
return ((...
|
|
93
|
+
return ((...s) => (o += 1, t || (t = v(!0), n = t.run(() => e(...s))), J(a), n));
|
|
94
94
|
}
|
|
95
|
-
const S = /* @__PURE__ */
|
|
96
|
-
const
|
|
97
|
-
function
|
|
98
|
-
let
|
|
99
|
-
return
|
|
95
|
+
const S = /* @__PURE__ */ Z(() => {
|
|
96
|
+
const e = /* @__PURE__ */ new Map();
|
|
97
|
+
function o(t, a) {
|
|
98
|
+
let s = e.get(t);
|
|
99
|
+
return s || (s = fetch(t).then(a), e.set(t, s)), s;
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
102
|
-
return
|
|
101
|
+
async function n(t) {
|
|
102
|
+
return o(t, (a) => a.text());
|
|
103
103
|
}
|
|
104
104
|
return {
|
|
105
|
-
fetchToText:
|
|
105
|
+
fetchToText: n
|
|
106
106
|
};
|
|
107
107
|
}), C = {
|
|
108
108
|
easing: {
|
|
@@ -437,65 +437,65 @@ const S = /* @__PURE__ */ R(() => {
|
|
|
437
437
|
]
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
|
-
function h(
|
|
440
|
+
function h(e, o, n) {
|
|
441
441
|
const {
|
|
442
|
-
name:
|
|
443
|
-
delay:
|
|
444
|
-
duration:
|
|
442
|
+
name: t,
|
|
443
|
+
delay: a = 0,
|
|
444
|
+
duration: s,
|
|
445
445
|
iterations: f,
|
|
446
446
|
mode: M,
|
|
447
447
|
easing: L,
|
|
448
|
-
path:
|
|
448
|
+
path: d,
|
|
449
449
|
offsetRotate: i,
|
|
450
450
|
...r
|
|
451
|
-
} =
|
|
452
|
-
let
|
|
453
|
-
if (
|
|
454
|
-
let l = `M ${
|
|
455
|
-
|
|
451
|
+
} = o;
|
|
452
|
+
let c;
|
|
453
|
+
if (t === "自定义路径" && d) {
|
|
454
|
+
let l = `M ${e.style.width / 2} ${e.style.height / 2}`;
|
|
455
|
+
d.forEach((m) => {
|
|
456
456
|
const u = Object.keys(m);
|
|
457
457
|
l += ` ${u[0]}${m[u[0]].join(" ")}`;
|
|
458
458
|
});
|
|
459
459
|
const w = `path("${l}")`;
|
|
460
|
-
switch (
|
|
460
|
+
switch (n) {
|
|
461
461
|
case "in":
|
|
462
|
-
|
|
462
|
+
c = [
|
|
463
463
|
{ opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: i },
|
|
464
464
|
{ offsetDistance: "0%", offsetPath: w, offsetRotate: i }
|
|
465
465
|
];
|
|
466
466
|
break;
|
|
467
467
|
case "stay":
|
|
468
|
-
|
|
468
|
+
c = [
|
|
469
469
|
{ offsetDistance: "0%", offsetPath: w, offsetRotate: i },
|
|
470
470
|
{ offsetDistance: "100%", offsetPath: w, offsetRotate: i }
|
|
471
471
|
];
|
|
472
472
|
break;
|
|
473
473
|
case "out":
|
|
474
|
-
|
|
474
|
+
c = [
|
|
475
475
|
{ offsetDistance: "0%", offsetPath: w, offsetRotate: i },
|
|
476
476
|
{ opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: i }
|
|
477
477
|
];
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
} else
|
|
481
|
-
switch (
|
|
481
|
+
switch (n) {
|
|
482
482
|
case "in":
|
|
483
|
-
|
|
483
|
+
c = C.textIn[t]?.[0] ?? C.in[t];
|
|
484
484
|
break;
|
|
485
485
|
case "stay":
|
|
486
|
-
|
|
486
|
+
c = C.stay[t];
|
|
487
487
|
break;
|
|
488
488
|
case "out":
|
|
489
|
-
|
|
489
|
+
c = C.out[t];
|
|
490
490
|
break;
|
|
491
491
|
}
|
|
492
492
|
return {
|
|
493
493
|
id: x(),
|
|
494
|
-
name:
|
|
495
|
-
delay:
|
|
496
|
-
duration:
|
|
494
|
+
name: o.name ?? o.title ?? o.id,
|
|
495
|
+
delay: a,
|
|
496
|
+
duration: t ? s * (f || 1) : 0,
|
|
497
497
|
effectMode: M === "逐字" || M === "逐行" ? "sibling" : "parent",
|
|
498
|
-
keyframes:
|
|
498
|
+
keyframes: c ?? [],
|
|
499
499
|
easing: C.easing[L],
|
|
500
500
|
meta: {
|
|
501
501
|
...r,
|
|
@@ -505,173 +505,173 @@ function h(t, n, o) {
|
|
|
505
505
|
}
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
if (!
|
|
508
|
+
function $(e) {
|
|
509
|
+
if (!e.animations?.length)
|
|
510
510
|
return {
|
|
511
511
|
delay: 0,
|
|
512
512
|
duration: 0,
|
|
513
513
|
animations: []
|
|
514
514
|
};
|
|
515
|
-
let
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
return
|
|
519
|
-
h(
|
|
520
|
-
...
|
|
515
|
+
let o, n, t;
|
|
516
|
+
e.animations[0].in ? (o = e.animations[0].in, n = e.animations[0].stay, t = e.animations[0].out) : (o = e.animations?.find((M) => M.category === "in"), n = e.animations?.find((M) => M.category === "stay"), t = e.animations?.find((M) => M.category === "out"));
|
|
517
|
+
const a = o?.delay ?? 0, s = t ? t.delay - a + t.duration : 0, f = [];
|
|
518
|
+
return o && f.push(
|
|
519
|
+
h(e, {
|
|
520
|
+
...o,
|
|
521
521
|
delay: 0
|
|
522
522
|
}, "in")
|
|
523
|
-
),
|
|
524
|
-
h(
|
|
525
|
-
...
|
|
526
|
-
delay:
|
|
523
|
+
), n && f.push(
|
|
524
|
+
h(e, {
|
|
525
|
+
...n,
|
|
526
|
+
delay: n.delay - a
|
|
527
527
|
}, "stay")
|
|
528
|
-
),
|
|
529
|
-
h(
|
|
530
|
-
...
|
|
531
|
-
delay:
|
|
528
|
+
), t && f.push(
|
|
529
|
+
h(e, {
|
|
530
|
+
...t,
|
|
531
|
+
delay: t.delay - a
|
|
532
532
|
}, "out")
|
|
533
533
|
), {
|
|
534
|
-
delay:
|
|
535
|
-
duration:
|
|
534
|
+
delay: a,
|
|
535
|
+
duration: s - a,
|
|
536
536
|
animations: f.filter((M) => !!M?.keyframes)
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
|
-
const
|
|
540
|
-
async function
|
|
541
|
-
const { fetchToText:
|
|
542
|
-
...
|
|
543
|
-
highlightReferImage:
|
|
539
|
+
const H = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNzIgNzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDcyIDcyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTE5LjMsMzguMWMwLjIsMC41LDAuNCwwLjksMC43LDEuNGMwLjIsMC4zLDAuNCwwLjQsMC44LDAuNGMwLjMs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GMwLjIsMCwwLjQsMC4xLDAuNiwwLjIgICBjMC4xLDAuMSwwLjIsMC4zLDAuMiwwLjZ2My40QzU1LjYsMzcuMyw1NS40LDM3LjYsNTUsMzcuN3ogTTUzLjksMzYuMnYtMmgtNy4xdjJINTMuOXogTTQ5LjYsNDAuN2MwLDAuMy0wLjEsMC41LTAuMiwwLjYgICBjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMS0wLjItMC4yLTAuNC0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMiAgIHMwLjQsMC4xLDAuNiwwLjJjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTUyLjgsNDAuN2MwLDAuMi0wLjEsMC40LTAuMiwwLjZjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yICAgYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMi0wLjEtMC4yLTAuMy0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMmMwLjIsMCwwLjQsMC4xLDAuNiwwLjIgICBjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTU2LjYsNDAuM2MwLjIsMC40LDAuMSwwLjgtMC4zLDEuMWMtMC41LDAuMy0wLjgsMC4yLTEuMS0wLjNsLTEtMS43Yy0wLjItMC41LTAuMS0wLjgsMC4zLTEuMSAgIGMwLjUtMC4yLDAuOS0wLjEsMS4xLDAuM0w1Ni42LDQwLjN6Ii8+CjwvZz4KPC9zdmc+";
|
|
540
|
+
async function _(e, o = !1) {
|
|
541
|
+
const { fetchToText: n } = S(), t = {
|
|
542
|
+
...e.style,
|
|
543
|
+
highlightReferImage: H,
|
|
544
544
|
listStyleType: "none",
|
|
545
545
|
listStyleImage: "none"
|
|
546
546
|
};
|
|
547
|
-
return
|
|
547
|
+
return e.style.fontSize && (t.fontSize = Math.floor(e.style.fontSize)), e.listStyle?.colormap && (t.listStyleColormap = e.listStyle?.colormap), o || (e.listMode ? t.listStyleType = "disc" : e.listStyle && (t.listStyleImage = await n(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;
|
|
548
548
|
}
|
|
549
|
-
async function
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
549
|
+
async function V(e, o) {
|
|
550
|
+
const n = e.textEffects ?? [];
|
|
551
|
+
if (n.length)
|
|
552
552
|
return await Promise.all(
|
|
553
|
-
[...
|
|
554
|
-
const
|
|
555
|
-
if (
|
|
556
|
-
const { color: i, imageContent: r, gradient:
|
|
553
|
+
[...n].reverse().map(async (t) => {
|
|
554
|
+
const a = {}, { offset: s, skew: f, stroke: M, shadow: L, filling: d } = t;
|
|
555
|
+
if (s && (a.translateX = s.x, a.translateY = s.y), f && (a.skewX = f.x, a.skewY = f.y), M?.color && M.width && (a.textStrokeWidth = M.width, a.textStrokeColor = M.color), L && (a.shadowOffsetX = L.offsetX, a.shadowOffsetY = L.offsetY, a.shadowBlur = L.blur, a.shadowColor = L.color), d) {
|
|
556
|
+
const { color: i, imageContent: r, gradient: c } = d;
|
|
557
557
|
if (!r?.image)
|
|
558
|
-
|
|
558
|
+
c ? a.color = `linear-gradient(${90 - c.angle}deg, ${c.stops.map((l) => `${l.color} ${l.offset * 100}%`).join(",")})` : i && (a.color = i);
|
|
559
559
|
else {
|
|
560
|
-
const { image: l, repeat: w } = r, m = await fetch(l).then((
|
|
561
|
-
const
|
|
562
|
-
|
|
560
|
+
const { image: l, repeat: w } = r, m = await fetch(l).then((g) => g.blob()), u = URL.createObjectURL(m), y = await new Promise((g) => {
|
|
561
|
+
const j = new Image();
|
|
562
|
+
j.crossOrigin = "anonymous", j.onload = () => g(j), j.src = u;
|
|
563
563
|
});
|
|
564
|
-
|
|
564
|
+
a.color = o?.createPattern(y, w ? "repeat" : "no-repeat"), URL.revokeObjectURL(u);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
return
|
|
567
|
+
return a;
|
|
568
568
|
})
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
|
-
function
|
|
572
|
-
return
|
|
573
|
-
let
|
|
574
|
-
return
|
|
575
|
-
let
|
|
576
|
-
|
|
571
|
+
function q(e) {
|
|
572
|
+
return e.version ? e.contents : e.contents.map((o) => {
|
|
573
|
+
let n;
|
|
574
|
+
return o.map((t, a) => {
|
|
575
|
+
let s = t.content;
|
|
576
|
+
s = s.replace(/ |\r\n|\n\r|[\n\r\t\v]/g, " "), s = s.replace(/<br\/>/g, `
|
|
577
577
|
`);
|
|
578
578
|
let f = "";
|
|
579
|
-
for (const M of Array.from(
|
|
580
|
-
|
|
579
|
+
for (const M of Array.from(s))
|
|
580
|
+
a === 0 && M === " " || n === " " && M === " " || (f += M), n = M;
|
|
581
581
|
return {
|
|
582
|
-
...
|
|
582
|
+
...t,
|
|
583
583
|
content: f
|
|
584
584
|
};
|
|
585
|
-
}).filter((
|
|
585
|
+
}).filter((t) => t.content);
|
|
586
586
|
});
|
|
587
587
|
}
|
|
588
|
-
async function
|
|
589
|
-
const { fetchToText:
|
|
590
|
-
for (let
|
|
591
|
-
const M =
|
|
588
|
+
async function K(e, o = !1) {
|
|
589
|
+
const { fetchToText: n } = S(), t = q(e), a = [];
|
|
590
|
+
for (let s = 0, f = t.length; s < f; s++) {
|
|
591
|
+
const M = t[s], L = {
|
|
592
592
|
fragments: []
|
|
593
593
|
};
|
|
594
|
-
|
|
595
|
-
for (let
|
|
596
|
-
const r = { ...M[
|
|
597
|
-
r.fontSize && (r.fontSize = Math.floor(r.fontSize)), r.content = W(r.content), r.highlight && (r.highlightImage = await
|
|
594
|
+
a.push(L);
|
|
595
|
+
for (let d = 0, i = M.length; d < i; d++) {
|
|
596
|
+
const r = { ...M[d] };
|
|
597
|
+
r.fontSize && (r.fontSize = Math.floor(r.fontSize)), r.content = W(r.content), r.highlight && (r.highlightImage = await n(r.highlight.image), o ? r.highlightSize = "cover" : r.highlight.size && (r.highlightSize = `${r.highlight.size}rem`), r.highlight.colormap && (r.highlightColormap = r.highlight.colormap), r.highlight.line && (r.highlightLine = r.highlight.line), r.highlight.thickness && (r.highlightThickness = `${r.highlight.thickness}%`), delete r.highlight), o || (r.listMode ? L.listStyleType = "disc" : r.listStyle && (L.listStyleImage = await n(r.listStyle.image), L.listStyleSize = `${r.listStyle.size * 100}%`)), L.fragments.push(r);
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
return
|
|
600
|
+
return a;
|
|
601
601
|
}
|
|
602
|
-
const A = (
|
|
603
|
-
async function z(
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
const
|
|
602
|
+
const A = (e) => (Number.parseFloat(e) || 0) / 100;
|
|
603
|
+
async function z(e, o, n) {
|
|
604
|
+
const t = e.style ?? e;
|
|
605
|
+
t.borderRadius && (t.borderRadius = t.borderRadius * 0.01 * Math.max(t.height, t.width)), o && e.groupStyle && (t.width = o.style.width * A(e.groupStyle.width), t.height = o.style.height * A(e.groupStyle.height), t.left = o.style.width * A(e.groupStyle.left), t.top = o.style.height * A(e.groupStyle.top));
|
|
606
|
+
const a = {
|
|
607
607
|
id: x(),
|
|
608
|
-
name:
|
|
608
|
+
name: e.name ?? e.title ?? e.id,
|
|
609
609
|
style: {
|
|
610
610
|
// TODO 过滤掉部分属性
|
|
611
|
-
...
|
|
612
|
-
visibility:
|
|
611
|
+
...t,
|
|
612
|
+
visibility: e.editable === !1 ? "hidden" : "visible"
|
|
613
613
|
},
|
|
614
614
|
meta: {
|
|
615
615
|
inPptIs: "Shape",
|
|
616
616
|
inEditorIs: "Element",
|
|
617
|
-
lock:
|
|
617
|
+
lock: e.lock === !0
|
|
618
618
|
},
|
|
619
619
|
children: []
|
|
620
620
|
};
|
|
621
|
-
if (
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
621
|
+
if (e.animations?.length) {
|
|
622
|
+
const s = $(e);
|
|
623
|
+
a.delay = s.delay, a.duration = s.duration, a.children.push(...s.animations), n && (s.animations.forEach((f) => {
|
|
624
|
+
n.endTime = Math.max(
|
|
625
|
+
n.endTime,
|
|
626
|
+
s.delay + f.delay + f.duration
|
|
627
627
|
);
|
|
628
|
-
}),
|
|
628
|
+
}), n.endTime = Math.max(n.endTime, s.delay + s.duration));
|
|
629
629
|
}
|
|
630
|
-
switch (
|
|
630
|
+
switch (e.type) {
|
|
631
631
|
case "image":
|
|
632
|
-
if (
|
|
633
|
-
image:
|
|
632
|
+
if (a.meta.inPptIs = "Picture", a.foreground = {
|
|
633
|
+
image: e.url,
|
|
634
634
|
fillWithShape: !0
|
|
635
|
-
},
|
|
636
|
-
const
|
|
635
|
+
}, e.maskUrl, e.cropping) {
|
|
636
|
+
const s = e.style.width, f = e.style.height, {
|
|
637
637
|
imageWidth: M,
|
|
638
638
|
imageHeight: L,
|
|
639
|
-
maskWidth:
|
|
639
|
+
maskWidth: d = s,
|
|
640
640
|
maskHeight: i = f,
|
|
641
641
|
translateX: r,
|
|
642
|
-
translateY:
|
|
642
|
+
translateY: c,
|
|
643
643
|
zoom: l = 1
|
|
644
|
-
} =
|
|
645
|
-
|
|
646
|
-
left:
|
|
647
|
-
top:
|
|
648
|
-
right:
|
|
644
|
+
} = e.cropping, w = M * l, m = L * l, u = (w - d) / 2 - r, y = (m - i) / 2 - c, g = u + d / 2, j = y + i / 2, T = -(s / 2 - g), D = -(f / 2 - j), b = w - (T + s), E = m - (D + f);
|
|
645
|
+
a.foreground.cropRect = {
|
|
646
|
+
left: T / w,
|
|
647
|
+
top: D / m,
|
|
648
|
+
right: b / w,
|
|
649
649
|
bottom: E / m
|
|
650
650
|
};
|
|
651
651
|
}
|
|
652
652
|
break;
|
|
653
653
|
case "svg": {
|
|
654
|
-
|
|
655
|
-
let
|
|
656
|
-
|
|
657
|
-
image: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
|
654
|
+
a.meta.inPptIs = "Picture";
|
|
655
|
+
let s = e.doc;
|
|
656
|
+
s || (s = await fetch(e.url).then((f) => f.text())), s = s.replace(new RegExp(`#el-${e.id} `, "gi"), ""), s = s.replace('width="100%"', `width="${t.width * 2}"`), s = s.replace('height="100%"', `height="${t.height * 2}"`), a.foreground = {
|
|
657
|
+
image: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`,
|
|
658
658
|
fillWithShape: !0
|
|
659
659
|
};
|
|
660
660
|
break;
|
|
661
661
|
}
|
|
662
662
|
case "text": {
|
|
663
|
-
|
|
664
|
-
content: await
|
|
665
|
-
style: await
|
|
666
|
-
effects: await
|
|
663
|
+
a.meta.inPptIs = "Shape", t.writingMode === "horizontal-tb" ? a.style.width = Math.ceil(t.width + t.letterSpacing) : a.style.height = Math.ceil(t.height + t.letterSpacing), a.text = {
|
|
664
|
+
content: await K(e),
|
|
665
|
+
style: await _(e),
|
|
666
|
+
effects: await V(e),
|
|
667
667
|
// plugins: [deformation(el.deformation?.type?.endsWith("byWord") ? -1 : 999, () => el.deformation)],
|
|
668
668
|
drawMode: "texture"
|
|
669
669
|
};
|
|
670
670
|
break;
|
|
671
671
|
}
|
|
672
672
|
case "com":
|
|
673
|
-
|
|
674
|
-
|
|
673
|
+
a.meta.inPptIs = "GroupShape", a.children = await Promise.all(
|
|
674
|
+
e.children.map((s) => z(s, e, n))
|
|
675
675
|
);
|
|
676
676
|
break;
|
|
677
677
|
case "pic":
|
|
@@ -696,130 +696,178 @@ async function z(t, n, o) {
|
|
|
696
696
|
case "collage":
|
|
697
697
|
case "imageWall":
|
|
698
698
|
default:
|
|
699
|
-
console.warn(
|
|
699
|
+
console.warn(e);
|
|
700
700
|
break;
|
|
701
701
|
}
|
|
702
|
-
return
|
|
702
|
+
return a;
|
|
703
703
|
}
|
|
704
|
-
async function
|
|
705
|
-
const
|
|
706
|
-
...
|
|
704
|
+
async function tt(e, o = !0, n) {
|
|
705
|
+
const t = x(), a = {
|
|
706
|
+
...e.style ?? e
|
|
707
707
|
};
|
|
708
|
-
|
|
709
|
-
let
|
|
710
|
-
return
|
|
711
|
-
id:
|
|
712
|
-
name:
|
|
713
|
-
style:
|
|
708
|
+
o && (a.overflow = "hidden");
|
|
709
|
+
let s;
|
|
710
|
+
return e.background && (e.background.color && (s ??= {}, F(e.background.color ?? "") ? s.image = e.background.color : s.color = e.background.color), e.background.image && (s ??= {}, s.image = e.background.image)), {
|
|
711
|
+
id: t,
|
|
712
|
+
name: o ? `Frame ${t}` : e.name,
|
|
713
|
+
style: a,
|
|
714
714
|
// TODO 过滤掉部分属性
|
|
715
|
-
background:
|
|
715
|
+
background: s,
|
|
716
716
|
children: await Promise.all(
|
|
717
|
-
|
|
717
|
+
e.elements.map((f) => z(f, void 0, n))
|
|
718
718
|
),
|
|
719
719
|
meta: {
|
|
720
|
-
inPptIs:
|
|
721
|
-
inEditorIs:
|
|
720
|
+
inPptIs: o ? "Slide" : "GroupShape",
|
|
721
|
+
inEditorIs: o ? "Frame" : "Element"
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
|
-
async function
|
|
725
|
+
async function N(e, o = 48) {
|
|
726
726
|
const {
|
|
727
|
-
layouts:
|
|
728
|
-
metas:
|
|
729
|
-
} =
|
|
727
|
+
layouts: n,
|
|
728
|
+
metas: t = {}
|
|
729
|
+
} = e, a = {
|
|
730
730
|
endTime: 0
|
|
731
731
|
};
|
|
732
|
-
let
|
|
733
|
-
|
|
734
|
-
index:
|
|
735
|
-
element: await
|
|
732
|
+
let s = await Promise.all(
|
|
733
|
+
n.map(async (L, d) => ({
|
|
734
|
+
index: d,
|
|
735
|
+
element: await tt(L, !0, a)
|
|
736
736
|
}))
|
|
737
737
|
), f = 0;
|
|
738
|
-
|
|
738
|
+
s = s.sort((L, d) => L.index - d.index).map((L, d) => {
|
|
739
739
|
const i = L.element;
|
|
740
|
-
return i.style && (i.style.top = f, f += Number(i.style.height) +
|
|
740
|
+
return i.style && (i.style.top = f, f += Number(i.style.height) + o), i.name = `Frame ${d + 1}`, i;
|
|
741
741
|
});
|
|
742
|
-
const M =
|
|
743
|
-
const
|
|
742
|
+
const M = s.reduce((L) => {
|
|
743
|
+
const d = L.style?.left ?? 0, i = L.style?.top ?? 0, r = L.style?.width ?? 0, c = L.style?.height ?? 0;
|
|
744
744
|
return {
|
|
745
|
-
minX:
|
|
745
|
+
minX: d,
|
|
746
746
|
minY: i,
|
|
747
|
-
maxX:
|
|
748
|
-
maxY: i +
|
|
747
|
+
maxX: d + r,
|
|
748
|
+
maxY: i + c
|
|
749
749
|
};
|
|
750
750
|
}, { minX: 0, minY: 0, maxX: 0, maxY: 0 });
|
|
751
751
|
return {
|
|
752
|
-
name:
|
|
752
|
+
name: t.name || "doc",
|
|
753
753
|
style: {
|
|
754
|
-
width:
|
|
755
|
-
height:
|
|
754
|
+
width: t?.width ?? M.maxX - M.minX,
|
|
755
|
+
height: t?.height ?? M.maxY - M.minY
|
|
756
756
|
},
|
|
757
|
-
children:
|
|
757
|
+
children: s,
|
|
758
758
|
meta: {
|
|
759
|
-
...
|
|
760
|
-
endTime:
|
|
759
|
+
...t,
|
|
760
|
+
endTime: a.endTime,
|
|
761
761
|
inEditorIs: "Doc"
|
|
762
762
|
}
|
|
763
763
|
};
|
|
764
764
|
}
|
|
765
|
-
|
|
766
|
-
const { config: n } =
|
|
765
|
+
function et(e, o) {
|
|
766
|
+
const { config: n } = e;
|
|
767
|
+
return {
|
|
768
|
+
name: "bigesj:bidTid",
|
|
769
|
+
test: (t) => typeof t == "object" && t && !!(t.bid || t.tid),
|
|
770
|
+
load: async (t) => {
|
|
771
|
+
const a = t.bid ?? t.tid ?? "", s = async (i) => await fetch(
|
|
772
|
+
(t.bid ? o.bid : o.tid).replace("%d", i)
|
|
773
|
+
).then((r) => r.json()).then((r) => JSON.parse(r.content));
|
|
774
|
+
let f = 0;
|
|
775
|
+
const M = await Promise.all(
|
|
776
|
+
a.split("|").map(async (i) => {
|
|
777
|
+
let [r, c] = i.split("[");
|
|
778
|
+
c && (c = c.substring(0, c.length - 1));
|
|
779
|
+
const l = c ? c.split(",").map((u) => Number(u)) : void 0, w = await s(r);
|
|
780
|
+
l !== void 0 && (w.layouts = w.layouts.filter((u, y) => l.includes(y)));
|
|
781
|
+
const m = await N(w, n.value.frameGap);
|
|
782
|
+
return f = Math.max(f, m.meta?.maxTime ?? 0), m;
|
|
783
|
+
})
|
|
784
|
+
), L = { ...M[0], id: a, children: [] };
|
|
785
|
+
L.meta ??= {}, L.meta.maxTime = f, L.meta.inEditorIs = "Doc";
|
|
786
|
+
let d = 0;
|
|
787
|
+
return M.forEach((i) => {
|
|
788
|
+
let r = 0;
|
|
789
|
+
i.children?.forEach((c) => {
|
|
790
|
+
c.style && (c.style.left = d, r = Math.max(r, Number(c.style.width)), L.children.push(c));
|
|
791
|
+
}), d += r + n.value.frameGap;
|
|
792
|
+
}), L;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
function at(e) {
|
|
797
|
+
const { config: o } = e;
|
|
767
798
|
return {
|
|
799
|
+
name: "bigesj:bige",
|
|
800
|
+
accept: ".bige",
|
|
801
|
+
test: (n) => n instanceof File && n.name.endsWith(".bige"),
|
|
802
|
+
load: async (n) => await N(
|
|
803
|
+
JSON.parse(
|
|
804
|
+
new TextDecoder().decode(
|
|
805
|
+
P(new Uint8Array(await n.arrayBuffer()))
|
|
806
|
+
)
|
|
807
|
+
).content,
|
|
808
|
+
o.value.frameGap
|
|
809
|
+
)
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
function Mt(e = {}) {
|
|
813
|
+
const {
|
|
814
|
+
font: o,
|
|
815
|
+
api: n
|
|
816
|
+
} = e, t = {
|
|
817
|
+
fonts: "/new/design/fonts",
|
|
818
|
+
bid: "/new/udesign/info/%d",
|
|
819
|
+
tid: "/new/design/info/%d",
|
|
820
|
+
...n
|
|
821
|
+
};
|
|
822
|
+
return k((a) => ({
|
|
768
823
|
name: "bigesj",
|
|
769
824
|
loaders: [
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
accept: ".bige",
|
|
773
|
-
test: (o) => o instanceof File && o.name.endsWith(".bige"),
|
|
774
|
-
load: async (o) => await tt(
|
|
775
|
-
JSON.parse(
|
|
776
|
-
new TextDecoder().decode(
|
|
777
|
-
Y(new Uint8Array(await o.arrayBuffer()))
|
|
778
|
-
)
|
|
779
|
-
).content,
|
|
780
|
-
n.value.frameGap
|
|
781
|
-
)
|
|
782
|
-
}
|
|
825
|
+
at(a),
|
|
826
|
+
et(a, t)
|
|
783
827
|
],
|
|
784
828
|
setup: async () => {
|
|
785
|
-
|
|
786
|
-
on: o,
|
|
787
|
-
off: e,
|
|
788
|
-
root: s
|
|
789
|
-
} = t, {
|
|
790
|
-
loadBigeFonts: a,
|
|
791
|
-
loadFont: f
|
|
792
|
-
} = U();
|
|
793
|
-
function M(i) {
|
|
794
|
-
i instanceof O && (i.style.fontFamily && f(i.style.fontFamily).then(() => i.text.update()), i.text.content.forEach((r) => {
|
|
795
|
-
r.fragments.forEach((d) => {
|
|
796
|
-
d.fontFamily && f(d.fontFamily).then(() => i.text.update());
|
|
797
|
-
}), r.fontFamily && f(r.fontFamily).then(() => i.text.update());
|
|
798
|
-
}));
|
|
799
|
-
}
|
|
800
|
-
function L(i) {
|
|
801
|
-
i.forEach((r) => {
|
|
802
|
-
M(r), r.findOne((d) => (M(d), !1));
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
async function c() {
|
|
806
|
-
s.value && L([s.value]);
|
|
807
|
-
}
|
|
808
|
-
G(() => {
|
|
809
|
-
e("setDoc", c), e("addElement", L);
|
|
810
|
-
}), o("setDoc", c), o("addElement", L), await a();
|
|
829
|
+
o && await st(a, t);
|
|
811
830
|
}
|
|
812
|
-
};
|
|
813
|
-
}
|
|
831
|
+
}));
|
|
832
|
+
}
|
|
833
|
+
async function st(e, o) {
|
|
834
|
+
const {
|
|
835
|
+
on: n,
|
|
836
|
+
off: t,
|
|
837
|
+
root: a
|
|
838
|
+
} = e, {
|
|
839
|
+
loadBigeFonts: s,
|
|
840
|
+
loadFont: f
|
|
841
|
+
} = B();
|
|
842
|
+
function M(i) {
|
|
843
|
+
i instanceof O && (i.style.fontFamily && f(i.style.fontFamily).then(() => i.text.update()), i.text.content.forEach((r) => {
|
|
844
|
+
r.fragments.forEach((c) => {
|
|
845
|
+
c.fontFamily && f(c.fontFamily).then(() => i.text.update());
|
|
846
|
+
}), r.fontFamily && f(r.fontFamily).then(() => i.text.update());
|
|
847
|
+
}));
|
|
848
|
+
}
|
|
849
|
+
function L(i) {
|
|
850
|
+
i.forEach((r) => {
|
|
851
|
+
M(r), r.findOne((c) => (M(c), !1));
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
async function d() {
|
|
855
|
+
a.value && L([a.value]);
|
|
856
|
+
}
|
|
857
|
+
G(() => {
|
|
858
|
+
t("setDoc", d), t("addElement", L);
|
|
859
|
+
}), n("setDoc", d), n("addElement", L), await s(o.fonts);
|
|
860
|
+
}
|
|
814
861
|
export {
|
|
815
|
-
|
|
862
|
+
et as bidTidLoader,
|
|
863
|
+
at as bigeLoader,
|
|
816
864
|
h as convertAnimation,
|
|
817
|
-
|
|
865
|
+
N as convertDoc,
|
|
818
866
|
z as convertElement,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
867
|
+
tt as convertLayout,
|
|
868
|
+
Mt as default,
|
|
869
|
+
$ as parseAnimations,
|
|
870
|
+
Mt as plugin,
|
|
871
|
+
B as useFonts,
|
|
824
872
|
S as useSharedTextAssets
|
|
825
873
|
};
|
package/dist/plugin.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/bigesj",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
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.16",
|
|
52
52
|
"modern-font": "^0.4.4",
|
|
53
53
|
"modern-idoc": "^0.10.4",
|
|
54
54
|
"vue": "^3.5.22",
|
|
55
|
-
"mce": "0.1
|
|
55
|
+
"mce": "0.2.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"mce": "^0"
|