@mce/bigesj 0.2.3 → 0.2.5

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.
@@ -0,0 +1 @@
1
+ export declare function convertImageElementToUrl(el: Record<string, any>): Promise<string>;
@@ -1,4 +1,7 @@
1
1
  export * from './animation';
2
2
  export * from './doc';
3
3
  export * from './element';
4
+ export * from './image';
4
5
  export * from './layout';
6
+ export * from './svg';
7
+ export * from './text';
@@ -0,0 +1 @@
1
+ export declare function convertSvgElementToUrl(el: Record<string, any>): Promise<string>;
@@ -1,7 +1,7 @@
1
1
  import type { NormalizedTextContent, StyleObject } from 'modern-idoc';
2
2
  type BigeElementText = Record<string, any>;
3
3
  export declare function convertTextStyle(el: BigeElementText, isByWord?: boolean): Promise<Partial<StyleObject>>;
4
- export declare function convertTextEffects(el: BigeElementText, ctx?: CanvasRenderingContext2D): Promise<Partial<StyleObject>[] | undefined>;
4
+ export declare function convertTextEffects(el: BigeElementText): Promise<Partial<StyleObject>[] | undefined>;
5
5
  export declare function getTextContents(el: BigeElementText): BigeElementText['contents'];
6
6
  export declare function convertTextContent(el: BigeElementText, isByWord?: boolean): Promise<NormalizedTextContent>;
7
7
  export {};
package/dist/index.js CHANGED
@@ -1,110 +1,110 @@
1
- import { useEditor as Y, definePlugin as k } from "mce";
2
- import { Element2D as O } from "modern-canvas";
3
- import { ref as I, effectScope as v, getCurrentScope as Q, onScopeDispose as X, onBeforeUnmount as G } from "vue";
4
- import { idGenerator as x, normalizeCRLF as W, isGradient as F } from "modern-idoc";
5
- import { gunzipSync as P } from "fflate";
6
- const p = I([]);
7
- function U(e, o) {
8
- const n = [];
9
- for (let t = 0; t <= o.length; t++)
10
- n[t] = [t];
1
+ import { useEditor as rt, definePlugin as ot } from "mce";
2
+ import { assets as B, Element2D as nt } from "modern-canvas";
3
+ import { ref as Z, effectScope as it, getCurrentScope as ft, onScopeDispose as ct, onBeforeUnmount as lt } from "vue";
4
+ import { idGenerator as U, normalizeCRLF as Mt, isGradient as dt } from "modern-idoc";
5
+ import { gunzipSync as Lt } from "fflate";
6
+ const X = Z([]);
7
+ function wt(e, r) {
8
+ const o = [];
9
+ for (let t = 0; t <= r.length; t++)
10
+ o[t] = [t];
11
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);
12
+ o[0][t] = t;
13
+ for (let t = 1; t <= r.length; t++)
14
+ for (let s = 1; s <= e.length; s++) {
15
+ const n = e[s - 1] === r[t - 1] ? 0 : 1;
16
+ o[t][s] = Math.min(o[t - 1][s] + 1, o[t][s - 1] + 1, o[t - 1][s - 1] + n);
17
17
  }
18
- return n[o.length][e.length];
18
+ return o[r.length][e.length];
19
19
  }
20
- function B() {
20
+ function mt() {
21
21
  const {
22
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;
23
+ } = rt(), r = Z(/* @__PURE__ */ new Map());
24
+ async function o(n) {
25
+ let i = X.value;
26
+ return i.length || (i = await fetch(n).then((f) => f.json()).then((f) => f.data.datalist), X.value = i), i;
27
27
  }
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
- let i;
33
- if (d.forEach((r) => {
34
- i ??= M.get(r), i ??= L.get(r);
35
- }), i === void 0) {
36
- let r;
37
- d.forEach((c) => {
38
- let l = c;
39
- l.endsWith(" R") ? l = `${l.substring(0, l.length - 2)}常规` : l.endsWith(" B") && (l = `${l.substring(0, l.length - 2)}粗体`);
40
- const w = l.length;
41
- L.forEach((m, u) => {
42
- const y = U(l, u);
43
- if (w <= y)
28
+ function t(n, i = X.value) {
29
+ const f = new Map(i.map((a, l) => [a.id, l])), M = new Map(
30
+ i.flatMap((a, l) => [...a.en_name.split(","), ...a.name.split(",")].map((L) => [L, l]))
31
+ ), d = n.replace(/"/g, "").split(",");
32
+ let c;
33
+ if (d.forEach((a) => {
34
+ c ??= f.get(a), c ??= M.get(a);
35
+ }), c === void 0) {
36
+ let a;
37
+ d.forEach((l) => {
38
+ let L = l;
39
+ L.endsWith(" R") ? L = `${L.substring(0, L.length - 2)}常规` : L.endsWith(" B") && (L = `${L.substring(0, L.length - 2)}粗体`);
40
+ const w = L.length;
41
+ M.forEach((y, m) => {
42
+ const C = wt(L, m);
43
+ if (w <= C)
44
44
  return;
45
- const g = -(y * 0.9 + (u.endsWith("常规") ? 0 : 1) * 0.1);
46
- (r === void 0 || g > r) && (r = g, i = m);
45
+ const j = -(C * 0.9 + (m.endsWith("常规") ? 0 : 1) * 0.1);
46
+ (a === void 0 || j > a) && (a = j, c = y);
47
47
  });
48
48
  });
49
49
  }
50
- return i !== void 0 ? f[i] : void 0;
50
+ return c !== void 0 ? i[c] : void 0;
51
51
  }
52
- async function a(s) {
53
- const f = typeof s == "string" ? [s] : s, M = [];
54
- for (const L of f) {
55
- let d = o.value.get(L);
52
+ async function s(n) {
53
+ const i = typeof n == "string" ? [n] : n, f = [];
54
+ for (const M of i) {
55
+ let d = r.value.get(M);
56
56
  if (!d) {
57
- const i = t(L);
58
- if (i && (d = o.value.get(i.en_name), !d)) {
59
- const r = Array.from(
57
+ const c = t(M);
58
+ if (c && (d = r.value.get(c.en_name), !d)) {
59
+ const a = Array.from(
60
60
  new Set(
61
- [L, i.en_name].filter(Boolean).map((c) => c.replace(/"/g, ""))
61
+ [M, c.en_name].filter(Boolean).map((l) => l.replace(/"/g, ""))
62
62
  )
63
63
  );
64
64
  d = e({
65
- family: r,
66
- src: i.fonturl
67
- }), r.forEach((c) => o.value.set(c, d)), o.value.set(String(L), d);
65
+ family: a,
66
+ src: c.fonturl
67
+ }), a.forEach((l) => r.value.set(l, d)), r.value.set(String(M), d);
68
68
  }
69
69
  }
70
- d && M.push(d);
70
+ d && f.push(d);
71
71
  }
72
- return await Promise.all(M);
72
+ return await Promise.all(f);
73
73
  }
74
74
  return {
75
- bigeFonts: p,
75
+ bigeFonts: X,
76
76
  searchBigeFont: t,
77
- loadBigeFonts: n,
78
- loadFont: a
77
+ loadBigeFonts: o,
78
+ loadFont: s
79
79
  };
80
80
  }
81
- function J(e, o) {
82
- return Q() ? (X(e, o), !0) : !1;
81
+ function ut(e, r) {
82
+ return ft() ? (ct(e, r), !0) : !1;
83
83
  }
84
- const R = typeof window < "u" && typeof document < "u";
84
+ const gt = typeof window < "u" && typeof document < "u";
85
85
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
86
86
  // @__NO_SIDE_EFFECTS__
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);
87
+ function yt(e) {
88
+ if (!gt) return e;
89
+ let r = 0, o, t;
90
+ const s = () => {
91
+ r -= 1, t && r <= 0 && (t.stop(), o = void 0, t = void 0);
92
92
  };
93
- return ((...s) => (o += 1, t || (t = v(!0), n = t.run(() => e(...s))), J(a), n));
93
+ return ((...n) => (r += 1, t || (t = it(!0), o = t.run(() => e(...n))), ut(s), o));
94
94
  }
95
- const S = /* @__PURE__ */ Z(() => {
95
+ const _ = /* @__PURE__ */ yt(() => {
96
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;
97
+ function r(t, s) {
98
+ let n = e.get(t);
99
+ return n || (n = fetch(t).then(s), e.set(t, n)), n;
100
100
  }
101
- async function n(t) {
102
- return o(t, (a) => a.text());
101
+ async function o(t) {
102
+ return r(t, (s) => s.text());
103
103
  }
104
104
  return {
105
- fetchToText: n
105
+ fetchToText: o
106
106
  };
107
- }), C = {
107
+ }), Y = {
108
108
  easing: {
109
109
  匀速: "linear",
110
110
  加速: "cubic-bezier(0.55, 0, 1, 0.45)",
@@ -437,242 +437,406 @@ const S = /* @__PURE__ */ Z(() => {
437
437
  ]
438
438
  }
439
439
  };
440
- function h(e, o, n) {
440
+ function G(e, r, o) {
441
441
  const {
442
442
  name: t,
443
- delay: a = 0,
444
- duration: s,
445
- iterations: f,
446
- mode: M,
447
- easing: L,
443
+ delay: s = 0,
444
+ duration: n,
445
+ iterations: i,
446
+ mode: f,
447
+ easing: M,
448
448
  path: d,
449
- offsetRotate: i,
450
- ...r
451
- } = o;
452
- let c;
449
+ offsetRotate: c,
450
+ ...a
451
+ } = r;
452
+ let l;
453
453
  if (t === "自定义路径" && d) {
454
- let l = `M ${e.style.width / 2} ${e.style.height / 2}`;
455
- d.forEach((m) => {
456
- const u = Object.keys(m);
457
- l += ` ${u[0]}${m[u[0]].join(" ")}`;
454
+ let L = `M ${e.style.width / 2} ${e.style.height / 2}`;
455
+ d.forEach((y) => {
456
+ const m = Object.keys(y);
457
+ L += ` ${m[0]}${y[m[0]].join(" ")}`;
458
458
  });
459
- const w = `path("${l}")`;
460
- switch (n) {
459
+ const w = `path("${L}")`;
460
+ switch (o) {
461
461
  case "in":
462
- c = [
463
- { opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: i },
464
- { offsetDistance: "0%", offsetPath: w, offsetRotate: i }
462
+ l = [
463
+ { opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: c },
464
+ { offsetDistance: "0%", offsetPath: w, offsetRotate: c }
465
465
  ];
466
466
  break;
467
467
  case "stay":
468
- c = [
469
- { offsetDistance: "0%", offsetPath: w, offsetRotate: i },
470
- { offsetDistance: "100%", offsetPath: w, offsetRotate: i }
468
+ l = [
469
+ { offsetDistance: "0%", offsetPath: w, offsetRotate: c },
470
+ { offsetDistance: "100%", offsetPath: w, offsetRotate: c }
471
471
  ];
472
472
  break;
473
473
  case "out":
474
- c = [
475
- { offsetDistance: "0%", offsetPath: w, offsetRotate: i },
476
- { opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: i }
474
+ l = [
475
+ { offsetDistance: "0%", offsetPath: w, offsetRotate: c },
476
+ { opacity: 0, offsetDistance: "100%", offsetPath: w, offsetRotate: c }
477
477
  ];
478
478
  break;
479
479
  }
480
480
  } else
481
- switch (n) {
481
+ switch (o) {
482
482
  case "in":
483
- c = C.textIn[t]?.[0] ?? C.in[t];
483
+ l = Y.textIn[t]?.[0] ?? Y.in[t];
484
484
  break;
485
485
  case "stay":
486
- c = C.stay[t];
486
+ l = Y.stay[t];
487
487
  break;
488
488
  case "out":
489
- c = C.out[t];
489
+ l = Y.out[t];
490
490
  break;
491
491
  }
492
492
  return {
493
- id: x(),
494
- name: o.name ?? o.title ?? o.id,
495
- delay: a,
496
- duration: t ? s * (f || 1) : 0,
497
- effectMode: M === "逐字" || M === "逐行" ? "sibling" : "parent",
498
- keyframes: c ?? [],
499
- easing: C.easing[L],
493
+ id: U(),
494
+ name: r.name ?? r.title ?? r.id,
495
+ delay: s,
496
+ duration: t ? n * (i || 1) : 0,
497
+ effectMode: f === "逐字" || f === "逐行" ? "sibling" : "parent",
498
+ keyframes: l ?? [],
499
+ easing: Y.easing[M],
500
500
  meta: {
501
- ...r,
501
+ ...a,
502
502
  inCanvasIs: "Animation",
503
503
  inPptIs: "Animation",
504
504
  inEditorIs: "Node"
505
505
  }
506
506
  };
507
507
  }
508
- function $(e) {
508
+ function jt(e) {
509
509
  if (!e.animations?.length)
510
510
  return {
511
511
  delay: 0,
512
512
  duration: 0,
513
513
  animations: []
514
514
  };
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,
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, n = t ? t.delay - s + t.duration : 0, i = [];
518
+ return r && i.push(
519
+ G(e, {
520
+ ...r,
521
521
  delay: 0
522
522
  }, "in")
523
- ), n && f.push(
524
- h(e, {
525
- ...n,
526
- delay: n.delay - a
523
+ ), o && i.push(
524
+ G(e, {
525
+ ...o,
526
+ delay: o.delay - s
527
527
  }, "stay")
528
- ), t && f.push(
529
- h(e, {
528
+ ), t && i.push(
529
+ G(e, {
530
530
  ...t,
531
- delay: t.delay - a
531
+ delay: t.delay - s
532
532
  }, "out")
533
533
  ), {
534
- delay: a,
535
- duration: s - a,
536
- animations: f.filter((M) => !!M?.keyframes)
534
+ delay: s,
535
+ duration: n - s,
536
+ animations: i.filter((f) => !!f?.keyframes)
537
537
  };
538
538
  }
539
- const H = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNzIgNzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDcyIDcyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTE5LjMsMzguMWMwLjIsMC41LDAuNCwwLjksMC43LDEuNGMwLjIsMC4zLDAuNCwwLjQsMC44LDAuNGMwLjMsMCwwLjUtMC4xLDAuNi0wLjRjMC4xLTAuMywwLjEtMC42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MSwwLjIsMC4zLDAuMiwwLjZ2My40QzU1LjYsMzcuMyw1NS40LDM3LjYsNTUsMzcuN3ogTTUzLjksMzYuMnYtMmgtNy4xdjJINTMuOXogTTQ5LjYsNDAuN2MwLDAuMy0wLjEsMC41LTAuMiwwLjYgICBjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMS0wLjItMC4yLTAuNC0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMiAgIHMwLjQsMC4xLDAuNiwwLjJjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTUyLjgsNDAuN2MwLDAuMi0wLjEsMC40LTAuMiwwLjZjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yICAgYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMi0wLjEtMC4yLTAuMy0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMmMwLjIsMCwwLjQsMC4xLDAuNiwwLjIgICBjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTU2LjYsNDAuM2MwLjIsMC40LDAuMSwwLjgtMC4zLDEuMWMtMC41LDAuMy0wLjgsMC4yLTEuMS0wLjNsLTEtMS43Yy0wLjItMC41LTAuMS0wLjgsMC4zLTEuMSAgIGMwLjUtMC4yLDAuOS0wLjEsMS4xLDAuM0w1Ni42LDQwLjN6Ii8+CjwvZz4KPC9zdmc+";
540
- async function _(e, o = !1) {
541
- const { fetchToText: n } = S(), t = {
539
+ async function V(e) {
540
+ const {
541
+ transform: r = {},
542
+ style: o = {},
543
+ maskUrl: t,
544
+ imageEffects: s = [],
545
+ imageEffectsRatio: n = 1
546
+ } = e, i = e.clipUrl || e.url, {
547
+ translateX: f = 0,
548
+ translateY: M = 0,
549
+ zoom: d = 1
550
+ } = r ?? {}, {
551
+ scaleX: c = 1,
552
+ scaleY: a = 1,
553
+ filter: l
554
+ } = o;
555
+ if (f === 0 && M === 0 && d === 1 && c === 1 && a === 1 && !t && !l && !s.length)
556
+ return i;
557
+ const L = await B.fetchImageBitmap(i), {
558
+ originWidth: w = L.width,
559
+ originHeight: y = L.height,
560
+ imageWidth: m = w,
561
+ imageHeight: C = y
562
+ } = r, {
563
+ width: j = w,
564
+ height: h = y
565
+ } = o, D = window.devicePixelRatio || 1, [g, u] = W(j, h, D);
566
+ if (l && (u.filter = l), u.scale(c, a), u.translate(c < 0 ? -j : 0, a < 0 ? -h : 0), t) {
567
+ const T = await B.fetchImageBitmap(t);
568
+ u.drawImage(T, 0, 0, T.width, T.height, 0, 0, j, h), T.close(), u.globalCompositeOperation = "source-in";
569
+ }
570
+ const A = m * d, k = C * d, tt = -(A / 2 - m / 2) + f, et = -(k / 2 - C / 2) + M;
571
+ if (u.drawImage(L, 0, 0, L.width, L.height, tt, et, A, k), L.close(), u.globalCompositeOperation = "source-over", s.length > 0) {
572
+ const S = {
573
+ x: (j - j * 0.9) / 2,
574
+ y: (h - h * 0.9) / 2
575
+ }, v = await createImageBitmap(g);
576
+ u.clearRect(0, 0, g.width, g.height), u.scale(0.9, 0.9);
577
+ for (let F = s.length - 1; F >= 0; F--) {
578
+ const { filling: E, offset: R, stroke: at } = s[F];
579
+ let z = v;
580
+ if (E) {
581
+ const [I, x] = W(j, h, D);
582
+ if (x.drawImage(z, 0, 0, j, h), x.globalCompositeOperation = "source-in", E.color) {
583
+ const [p, N] = W(j, h, D);
584
+ N.fillStyle = E.color, N.fillRect(0, 0, j, h), x.drawImage(p, 0, 0, j, h);
585
+ } else if (E.imageContent?.image) {
586
+ const p = await B.fetchImageBitmap(E.imageContent.image);
587
+ x.drawImage(p, 0, 0, j, h), p.close();
588
+ }
589
+ z = I;
590
+ }
591
+ if (at?.forEach(({ width: I, color: x }) => {
592
+ z = new ht().use((p, N, O) => {
593
+ const [, J] = W(N.width, N.height);
594
+ J.drawImage(N, 0, 0);
595
+ const st = Ct(J), $ = O.thickness, H = O.thickness;
596
+ p.strokeStyle = O.color, p.lineWidth = O.thickness * 2, p.lineJoin = "round", st.forEach((b) => {
597
+ p.beginPath(), p.moveTo($ + b[0].x, H + b[1].y);
598
+ for (let Q = 1; Q < b.length; Q++)
599
+ p.lineTo($ + b[Q].x, H + b[Q].y);
600
+ p.closePath();
601
+ }), p.stroke();
602
+ }).make(z, {
603
+ color: x,
604
+ thickness: I / 50 * n
605
+ });
606
+ }), R) {
607
+ let { x: I, y: x } = R;
608
+ I = I / 50 * n * 200, x = x / 50 * n * 200, u.drawImage(z, I + S.x, x + S.y, j, h);
609
+ } else
610
+ u.drawImage(z, S.x, S.y, j, h);
611
+ }
612
+ v.close();
613
+ }
614
+ return await new Promise((T) => {
615
+ g.toBlob((S) => {
616
+ try {
617
+ T(URL.createObjectURL(S));
618
+ } catch (v) {
619
+ console.error(`Failed to URL.createObjectURL, url: ${i}`, v), T(i);
620
+ }
621
+ });
622
+ });
623
+ }
624
+ function W(e, r, o = 1) {
625
+ const t = document.createElement("canvas");
626
+ t.width = e * o, t.height = r * o, t.style.width = `${e}px`, t.style.height = `${r}px`;
627
+ const s = t.getContext("2d");
628
+ return s.scale(o, o), [t, s];
629
+ }
630
+ class ht {
631
+ canvas = document.createElement("canvas");
632
+ method;
633
+ use(r) {
634
+ return this.method = r, this;
635
+ }
636
+ make(r, o) {
637
+ const { canvas: t } = this, s = this.canvas.getContext("2d"), n = o.thickness * 2, [i, f] = [r.width, r.height].map((M) => M + n);
638
+ return (i !== t.width || f !== t.height) && (t.width = i, 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
+ }
640
+ }
641
+ function Ct(e) {
642
+ const t = e.canvas.width, s = e.canvas.height, n = [];
643
+ let i = 3;
644
+ const f = 100;
645
+ return (() => {
646
+ const d = [], c = new Uint32Array(e.getImageData(0, 0, t, s).data.buffer);
647
+ let a, l, L, w, y = -1, m, C = 9;
648
+ const j = [9, 0, 3, 3, 2, 0, 9, 3, 1, 9, 1, 1, 2, 0, 2, 9];
649
+ function h(g, u) {
650
+ return g >= 0 && u >= 0 && g < t && u < s ? c[u * t + g] >>> 24 > f : !1;
651
+ }
652
+ function D(g, u) {
653
+ let A = 0;
654
+ return h(g - 1, u - 1) && (A += 1), h(g, u - 1) && (A += 2), h(g - 1, u) && (A += 4), h(g, u) && (A += 8), A === 6 ? C === 0 ? 2 : 3 : A === 9 ? C === 3 ? 0 : 1 : j[A];
655
+ }
656
+ for (let g = i; g < c.length; g++)
657
+ if (c[g] >>> 24 > f) {
658
+ y = i = g;
659
+ break;
660
+ }
661
+ if (y >= 0) {
662
+ a = L = y % t, l = w = Math.floor(y / t);
663
+ do
664
+ m = D(a, l), m === 0 ? l-- : m === 1 ? l++ : m === 2 ? a-- : m === 3 && a++, m !== C && (d.push({ x: a + 0, y: l + 0 }), C = m);
665
+ while (a !== L || l !== w);
666
+ }
667
+ return n.push(d), d;
668
+ })(), n;
669
+ }
670
+ async function pt(e) {
671
+ const {
672
+ id: r,
673
+ doc: o,
674
+ url: t,
675
+ style: s = {},
676
+ background: n = {}
677
+ } = e;
678
+ let i = o;
679
+ i || (i = await fetch(t).then((M) => M.text()));
680
+ const f = new DOMParser().parseFromString(
681
+ i.replace(new RegExp(`#el-${r} `, "gi"), "").replace(/data-colors\s/, " ").replace(/[a-z-]+="([^\s<]*<\S*)"/gi, ""),
682
+ "image/svg+xml"
683
+ ).documentElement;
684
+ if (!(f instanceof SVGElement))
685
+ throw new TypeError(`Failed to DOMParser, parse svg to DOM error: ${i}`);
686
+ if (n.src) {
687
+ const M = `#${r}-fill-blip`, d = f.querySelector(M), c = d?.querySelector("image");
688
+ if (d && c)
689
+ try {
690
+ const a = await B.fetchImageBitmap(n.src).then((l) => {
691
+ const L = document.createElement("canvas");
692
+ return L.width = l.width, L.height = l.height, L.getContext("2d")?.drawImage(l, 0, 0), l.close(), L.toDataURL("image/png");
693
+ });
694
+ c?.setAttribute("href", a), d?.setAttribute("fill", M);
695
+ } catch (a) {
696
+ console.error(a);
697
+ }
698
+ }
699
+ return s.width && f.setAttribute("width", String(s.width * 2)), s.height && f.setAttribute("height", String(s.height * 2)), await V({
700
+ ...e,
701
+ transform: {
702
+ ...e.transform,
703
+ originWidth: s.width,
704
+ originHeight: s.height
705
+ },
706
+ url: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(f.outerHTML)}`
707
+ });
708
+ }
709
+ const At = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNzIgNzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDcyIDcyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTE5LjMsMzguMWMwLjIsMC41LDAuNCwwLjksMC43LDEuNGMwLjIsMC4zLDAuNCwwLjQsMC44LDAuNGMwLjMsMCwwLjUtMC4xLDAuNi0wLjRjMC4xLTAuMywwLjEtMC42LDAuMi0wLjkgICBjMC0wLjIsMC4xLTAuNCwwLjMtMC41YzAuMi0wLjEsMC40LTAuMiwwLjYtMC4xYzAuMiwwLDAuNCwwLjEsMC41LDAuM2MwLjEsMC4yLDAuMiwwLjQsMC4xLDAuNmMtMC4xLDAuNi0wLjIsMS4yLTAuNCwxLjcgICBjLTAuMywwLjgtMC45LDEuMi0xLjcsMS4yYy0wLjksMC0xLjYtMC40LTIuMS0xLjJjLTAuMy0wLjQtMC41LTAuOC0wLjctMS4zYy0wLjQsMC4zLTEsMC42LTEuNywxYy0wLjUsMC4yLTAuOCwwLjEtMS4xLT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4xLDAuNiwwLjJjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTUyLjgsNDAuN2MwLDAuMi0wLjEsMC40LTAuMiwwLjZjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yICAgYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMi0wLjEtMC4yLTAuMy0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMmMwLjIsMCwwLjQsMC4xLDAuNiwwLjIgICBjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTU2LjYsNDAuM2MwLjIsMC40LDAuMSwwLjgtMC4zLDEuMWMtMC41LDAuMy0wLjgsMC4yLTEuMS0wLjNsLTEtMS43Yy0wLjItMC41LTAuMS0wLjgsMC4zLTEuMSAgIGMwLjUtMC4yLDAuOS0wLjEsMS4xLDAuM0w1Ni42LDQwLjN6Ii8+CjwvZz4KPC9zdmc+";
710
+ async function xt(e, r = !1) {
711
+ const { fetchToText: o } = _(), t = {
542
712
  ...e.style,
543
- highlightReferImage: H,
713
+ highlightReferImage: At,
544
714
  listStyleType: "none",
545
715
  listStyleImage: "none"
546
716
  };
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;
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;
548
718
  }
549
- async function V(e, o) {
550
- const n = e.textEffects ?? [];
551
- if (n.length)
719
+ async function Tt(e) {
720
+ const r = e.textEffects ?? [];
721
+ if (r.length)
552
722
  return await Promise.all(
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
- if (!r?.image)
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
- else {
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
- });
564
- a.color = o?.createPattern(y, w ? "repeat" : "no-repeat"), URL.revokeObjectURL(u);
565
- }
723
+ [...r].reverse().map(async (o) => {
724
+ const t = {}, { offset: s, skew: n, stroke: i, shadow: f, filling: M } = o;
725
+ if (s && (t.translateX = s.x, t.translateY = s.y), n && (t.skewX = n.x, t.skewY = n.y), i?.color && i.width && (t.textStrokeWidth = i.width, t.textStrokeColor = i.color), f && (t.shadowOffsetX = f.offsetX, t.shadowOffsetY = f.offsetY, t.shadowBlur = f.blur, t.shadowColor = f.color), M) {
726
+ const { color: d, imageContent: c, gradient: a } = M;
727
+ c?.image || (a ? t.color = `linear-gradient(${90 - a.angle}deg, ${a.stops.map((l) => `${l.color} ${l.offset * 100}%`).join(",")})` : d && (t.color = d));
566
728
  }
567
- return a;
729
+ return t;
568
730
  })
569
731
  );
570
732
  }
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, `
733
+ function Dt(e) {
734
+ return e.version ? e.contents : e.contents.map((r) => {
735
+ let o;
736
+ return r.map((t, s) => {
737
+ let n = t.content;
738
+ n = n.replace(/ |\r\n|\n\r|[\n\r\t\v]/g, " "), n = n.replace(/<br\/>/g, `
577
739
  `);
578
- let f = "";
579
- for (const M of Array.from(s))
580
- a === 0 && M === " " || n === " " && M === " " || (f += M), n = M;
740
+ let i = "", f = 0;
741
+ for (const M of Array.from(n))
742
+ s === 0 && f === 0 && M === " " || o === " " && M === " " || (i += M), o = M, f++;
581
743
  return {
582
744
  ...t,
583
- content: f
745
+ content: i
584
746
  };
585
747
  }).filter((t) => t.content);
586
748
  });
587
749
  }
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 = {
750
+ async function It(e, r = !1) {
751
+ const { fetchToText: o } = _(), t = Dt(e), s = [];
752
+ for (let n = 0, i = t.length; n < i; n++) {
753
+ const f = t[n], M = {
592
754
  fragments: []
593
755
  };
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);
756
+ s.push(M);
757
+ for (let d = 0, c = f.length; d < c; d++) {
758
+ const a = {}, l = f[d];
759
+ for (const w in l)
760
+ w !== "id" && l[w] !== "" && (a[w] = l[w]);
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 ? M.listStyleType = "disc" : a.listStyle && (M.listStyleImage = await o(a.listStyle.image), M.listStyleSize = `${a.listStyle.size * 100}%`));
762
+ const L = M.fragments[M.fragments.length - 1];
763
+ L && Object.keys(L).length === 1 && L.content && Object.keys(a).length === 1 && a.content ? L.content += a.content : M.fragments.push(a);
598
764
  }
599
765
  }
600
- return a;
766
+ return s;
601
767
  }
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
- id: x(),
768
+ const P = (e) => (Number.parseFloat(e) || 0) / 100;
769
+ async function q(e, r, o) {
770
+ const t = { ...e.style ?? e }, s = {
771
+ inPptIs: "Shape",
772
+ inEditorIs: "Element"
773
+ }, n = {
774
+ id: U(),
608
775
  name: e.name ?? e.title ?? e.id,
609
- style: {
610
- // TODO 过滤掉部分属性
611
- ...t,
612
- visibility: e.editable === !1 ? "hidden" : "visible"
613
- },
614
- meta: {
615
- inPptIs: "Shape",
616
- inEditorIs: "Element",
617
- lock: e.lock === !0
618
- },
776
+ style: t,
777
+ meta: s,
619
778
  children: []
620
779
  };
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
780
+ 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) {
781
+ const i = jt(e);
782
+ n.delay = i.delay, n.duration = i.duration, n.children.push(...i.animations), o && (i.animations.forEach((f) => {
783
+ o.endTime = Math.max(
784
+ o.endTime,
785
+ i.delay + f.delay + f.duration
627
786
  );
628
- }), n.endTime = Math.max(n.endTime, s.delay + s.duration));
787
+ }), o.endTime = Math.max(o.endTime, i.delay + i.duration));
629
788
  }
630
789
  switch (e.type) {
631
790
  case "image":
632
- if (a.meta.inPptIs = "Picture", a.foreground = {
633
- image: e.url,
791
+ if (s.inPptIs = "Picture", n.foreground = {
792
+ image: await V(e),
634
793
  fillWithShape: !0
635
- }, e.maskUrl, e.cropping) {
636
- const s = e.style.width, f = e.style.height, {
794
+ }, e.clipUrl && (s.rawForegroundImage = e.url), e.cropping) {
795
+ const i = e.style.width, f = e.style.height, {
637
796
  imageWidth: M,
638
- imageHeight: L,
639
- maskWidth: d = s,
640
- maskHeight: i = f,
641
- translateX: r,
642
- translateY: c,
643
- zoom: l = 1
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
- bottom: E / m
797
+ imageHeight: d,
798
+ maskWidth: c = i,
799
+ maskHeight: a = f,
800
+ translateX: l,
801
+ translateY: L,
802
+ zoom: w = 1
803
+ } = e.cropping, y = M * w, m = d * w, C = (y - c) / 2 - l, j = (m - a) / 2 - L, h = C + c / 2, D = j + a / 2, g = -(i / 2 - h), u = -(f / 2 - D), A = y - (g + i), k = m - (u + f);
804
+ n.foreground.cropRect = {
805
+ left: g / y,
806
+ top: u / m,
807
+ right: A / y,
808
+ bottom: k / m
650
809
  };
651
810
  }
652
811
  break;
653
812
  case "svg": {
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)}`,
813
+ s.inPptIs = "Picture", n.foreground = {
814
+ image: await pt(e),
658
815
  fillWithShape: !0
659
816
  };
660
817
  break;
661
818
  }
662
819
  case "text": {
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),
820
+ s.inPptIs = "Shape", t.writingMode === "horizontal-tb" ? t.width = Math.ceil(t.width + t.letterSpacing) : t.height = Math.ceil(t.height + t.letterSpacing), n.text = {
821
+ content: await It(e),
822
+ style: await xt(e),
823
+ effects: await Tt(e),
667
824
  // plugins: [deformation(el.deformation?.type?.endsWith("byWord") ? -1 : 999, () => el.deformation)],
668
825
  drawMode: "texture"
669
826
  };
670
827
  break;
671
828
  }
672
829
  case "com":
673
- a.meta.inPptIs = "GroupShape", a.children = await Promise.all(
674
- e.children.map((s) => z(s, e, n))
675
- );
830
+ s.inPptIs = "GroupShape", n.children = (await Promise.all(
831
+ e.children.map(async (i) => {
832
+ try {
833
+ return await q(i, e, o);
834
+ } catch (f) {
835
+ console.warn(f);
836
+ return;
837
+ }
838
+ })
839
+ )).filter(Boolean);
676
840
  break;
677
841
  case "pic":
678
842
  case "mosaic":
@@ -699,175 +863,187 @@ async function z(e, o, n) {
699
863
  console.warn(e);
700
864
  break;
701
865
  }
702
- return a;
866
+ return n;
703
867
  }
704
- async function tt(e, o = !0, n) {
705
- const t = x(), a = {
868
+ async function St(e, r = !0, o) {
869
+ const t = U(), s = {
706
870
  ...e.style ?? e
707
871
  };
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)), {
872
+ r && (s.overflow = "hidden");
873
+ let n;
874
+ 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)), {
711
875
  id: t,
712
- name: o ? `Frame ${t}` : e.name,
713
- style: a,
876
+ name: r ? `Frame ${t}` : e.name,
877
+ style: s,
714
878
  // TODO 过滤掉部分属性
715
- background: s,
716
- children: await Promise.all(
717
- e.elements.map((f) => z(f, void 0, n))
718
- ),
879
+ background: n,
880
+ children: (await Promise.all(
881
+ e.elements.map(async (i) => {
882
+ try {
883
+ return await q(i, void 0, o);
884
+ } catch (f) {
885
+ console.warn(f);
886
+ return;
887
+ }
888
+ })
889
+ )).filter(Boolean),
719
890
  meta: {
720
- inPptIs: o ? "Slide" : "GroupShape",
721
- inEditorIs: o ? "Frame" : "Element"
891
+ inPptIs: r ? "Slide" : "GroupShape",
892
+ inEditorIs: r ? "Frame" : "Element"
722
893
  }
723
894
  };
724
895
  }
725
- async function N(e, o = 48) {
896
+ async function K(e, r = 0) {
726
897
  const {
727
- layouts: n,
898
+ layouts: o,
728
899
  metas: t = {}
729
- } = e, a = {
900
+ } = e, s = {
730
901
  endTime: 0
731
902
  };
732
- let s = await Promise.all(
733
- n.map(async (L, d) => ({
903
+ let n = await Promise.all(
904
+ o.map(async (M, d) => ({
734
905
  index: d,
735
- element: await tt(L, !0, a)
906
+ element: await St(M, !0, s)
736
907
  }))
737
- ), f = 0;
738
- s = s.sort((L, d) => L.index - d.index).map((L, d) => {
739
- const i = L.element;
740
- return i.style && (i.style.top = f, f += Number(i.style.height) + o), i.name = `Frame ${d + 1}`, i;
908
+ ), i = 0;
909
+ n = n.sort((M, d) => M.index - d.index).map((M, d) => {
910
+ const c = M.element;
911
+ return c.style && (c.style.top = i, i += Number(c.style.height) + r), c.name = `Frame ${d + 1}`, c;
741
912
  });
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;
913
+ const f = n.reduce((M) => {
914
+ const d = M.style?.left ?? 0, c = M.style?.top ?? 0, a = M.style?.width ?? 0, l = M.style?.height ?? 0;
744
915
  return {
745
916
  minX: d,
746
- minY: i,
747
- maxX: d + r,
748
- maxY: i + c
917
+ minY: c,
918
+ maxX: d + a,
919
+ maxY: c + l
749
920
  };
750
921
  }, { minX: 0, minY: 0, maxX: 0, maxY: 0 });
751
922
  return {
752
923
  name: t.name || "doc",
753
924
  style: {
754
- width: t?.width ?? M.maxX - M.minX,
755
- height: t?.height ?? M.maxY - M.minY
925
+ width: t?.width ?? f.maxX - f.minX,
926
+ height: t?.height ?? f.maxY - f.minY
756
927
  },
757
- children: s,
928
+ children: n,
758
929
  meta: {
759
930
  ...t,
760
- endTime: a.endTime,
931
+ endTime: s.endTime,
761
932
  inEditorIs: "Doc"
762
933
  }
763
934
  };
764
935
  }
765
- function et(e, o) {
766
- const { config: n } = e;
936
+ function zt(e, r) {
937
+ const { config: o } = e;
767
938
  return {
768
939
  name: "bigesj:bidTid",
769
940
  test: (t) => typeof t == "object" && t && !!(t.bid || t.tid),
770
941
  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.data.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;
942
+ const s = t.bid ?? t.tid ?? "", n = async (c) => await fetch(
943
+ (t.bid ? r.bid : r.tid).replace("%d", c)
944
+ ).then((a) => a.json()).then((a) => JSON.parse(a.data.content));
945
+ let i = 0;
946
+ const f = await Promise.all(
947
+ s.split("|").map(async (c) => {
948
+ let [a, l] = c.split("[");
949
+ l && (l = l.substring(0, l.length - 1));
950
+ const L = l ? l.split(",").map((m) => Number(m)) : void 0, w = await n(a);
951
+ L !== void 0 && (w.layouts = w.layouts.filter((m, C) => L.includes(C)));
952
+ const y = await K(w);
953
+ return i = Math.max(i, y.meta?.maxTime ?? 0), y;
783
954
  })
784
- ), L = { ...M[0], id: a, children: [] };
785
- L.meta ??= {}, L.meta.maxTime = f, L.meta.inEditorIs = "Doc";
955
+ ), M = { ...f[0], id: s, children: [] };
956
+ M.meta ??= {}, M.meta.maxTime = i, M.meta.inEditorIs = "Doc";
786
957
  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;
958
+ return f.forEach((c) => {
959
+ let a = 0;
960
+ c.children?.forEach((l) => {
961
+ l.style && (l.style.left = d, a = Math.max(a, Number(l.style.width)), M.children.push(l));
962
+ }), d += a + o.value.frameGap;
963
+ }), M;
793
964
  }
794
965
  };
795
966
  }
796
- function at(e) {
797
- const { config: o } = e;
967
+ function Nt(e) {
968
+ const { config: r } = e;
798
969
  return {
799
970
  name: "bigesj:bige",
800
971
  accept: ".bige",
801
- test: (n) => n instanceof File && n.name.endsWith(".bige"),
802
- load: async (n) => await N(
972
+ test: (o) => o instanceof File && o.name.endsWith(".bige"),
973
+ load: async (o) => await K(
803
974
  JSON.parse(
804
975
  new TextDecoder().decode(
805
- P(new Uint8Array(await n.arrayBuffer()))
976
+ Lt(new Uint8Array(await o.arrayBuffer()))
806
977
  )
807
- ).content,
808
- o.value.frameGap
978
+ ).content
809
979
  )
810
980
  };
811
981
  }
812
- function Mt(e = {}) {
982
+ function Qt(e = {}) {
813
983
  const {
814
- font: o,
815
- api: n
984
+ font: r,
985
+ api: o
816
986
  } = e, t = {
817
987
  fonts: "/new/design/fonts",
818
988
  bid: "/new/udesign/info/%d",
819
989
  tid: "/new/design/info/%d",
820
- ...n
990
+ ...o
821
991
  };
822
- return k((a) => ({
992
+ return ot((s) => ({
823
993
  name: "bigesj",
824
994
  loaders: [
825
- at(a),
826
- et(a, t)
995
+ Nt(s),
996
+ zt(s, t)
827
997
  ],
828
998
  setup: async () => {
829
- o && await st(a, t);
999
+ r && await Et(s, t);
830
1000
  }
831
1001
  }));
832
1002
  }
833
- async function st(e, o) {
1003
+ async function Et(e, r) {
834
1004
  const {
835
- on: n,
1005
+ on: o,
836
1006
  off: t,
837
- root: a
1007
+ root: s
838
1008
  } = 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());
1009
+ loadBigeFonts: n,
1010
+ loadFont: i
1011
+ } = mt();
1012
+ function f(c) {
1013
+ c instanceof nt && (c.style.fontFamily && i(c.style.fontFamily).then(() => c.text.update()), c.text.content.forEach((a) => {
1014
+ a.fragments.forEach((l) => {
1015
+ l.fontFamily && i(l.fontFamily).then(() => c.text.update());
1016
+ }), a.fontFamily && i(a.fontFamily).then(() => c.text.update());
847
1017
  }));
848
1018
  }
849
- function L(i) {
850
- i.forEach((r) => {
851
- M(r), r.findOne((c) => (M(c), !1));
1019
+ function M(c) {
1020
+ c.forEach((a) => {
1021
+ f(a), a.findOne((l) => (f(l), !1));
852
1022
  });
853
1023
  }
854
1024
  async function d() {
855
- a.value && L([a.value]);
1025
+ s.value && M([s.value]);
856
1026
  }
857
- G(() => {
858
- t("setDoc", d), t("addElement", L);
859
- }), n("setDoc", d), n("addElement", L), await s(o.fonts);
1027
+ lt(() => {
1028
+ t("setDoc", d), t("addElement", M);
1029
+ }), o("setDoc", d), o("addElement", M), await n(r.fonts);
860
1030
  }
861
1031
  export {
862
- et as bidTidLoader,
863
- at as bigeLoader,
864
- h as convertAnimation,
865
- N as convertDoc,
866
- z as convertElement,
867
- tt as convertLayout,
868
- Mt as default,
869
- $ as parseAnimations,
870
- Mt as plugin,
871
- B as useFonts,
872
- S as useSharedTextAssets
1032
+ zt as bidTidLoader,
1033
+ Nt as bigeLoader,
1034
+ G as convertAnimation,
1035
+ K as convertDoc,
1036
+ q as convertElement,
1037
+ V as convertImageElementToUrl,
1038
+ St as convertLayout,
1039
+ pt as convertSvgElementToUrl,
1040
+ It as convertTextContent,
1041
+ Tt as convertTextEffects,
1042
+ xt as convertTextStyle,
1043
+ Qt as default,
1044
+ Dt as getTextContents,
1045
+ jt as parseAnimations,
1046
+ Qt as plugin,
1047
+ mt as useFonts,
1048
+ _ as useSharedTextAssets
873
1049
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mce/bigesj",
3
3
  "type": "module",
4
- "version": "0.2.3",
4
+ "version": "0.2.5",
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.17",
51
+ "modern-canvas": "^0.12.20",
52
52
  "modern-font": "^0.4.4",
53
53
  "modern-idoc": "^0.10.5",
54
54
  "vue": "^3.5.22",
55
- "mce": "0.2.3"
55
+ "mce": "0.2.5"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "mce": "^0"