@mce/bigesj 0.16.6 → 0.17.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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { plugin } from './plugin';
2
2
  export * from './composables';
3
3
  export * from './convert';
4
- export * from './editorOptions';
5
4
  export * from './loaders';
5
+ export * from './options';
6
6
  export * from './plugin';
7
7
  export default plugin;
package/dist/index.js CHANGED
@@ -1093,8 +1093,8 @@ function signedArea(data, start, end, dim) {
1093
1093
  }
1094
1094
  return sum;
1095
1095
  }
1096
- function drawPoint(ctx, x, y, options = {}) {
1097
- const { radius = 1 } = options;
1096
+ function drawPoint(ctx, x, y, options2 = {}) {
1097
+ const { radius = 1 } = options2;
1098
1098
  ctx.moveTo(x, y);
1099
1099
  ctx.arc(x, y, radius, 0, Math.PI * 2);
1100
1100
  }
@@ -2624,7 +2624,7 @@ function cubicBezierP3(t, p) {
2624
2624
  function cubicBezier(t, p0, p1, p2, p3) {
2625
2625
  return cubicBezierP0(t, p0) + cubicBezierP1(t, p1) + cubicBezierP2(t, p2) + cubicBezierP3(t, p3);
2626
2626
  }
2627
- function fillTriangulate(pointArray, options = {}) {
2627
+ function fillTriangulate(pointArray, options2 = {}) {
2628
2628
  let {
2629
2629
  vertices = [],
2630
2630
  indices = [],
@@ -2632,7 +2632,7 @@ function fillTriangulate(pointArray, options = {}) {
2632
2632
  verticesStride = 2,
2633
2633
  verticesOffset = vertices.length / verticesStride,
2634
2634
  indicesOffset = indices.length
2635
- } = options;
2635
+ } = options2;
2636
2636
  const triangles = earcut(pointArray, holes, 2);
2637
2637
  if (triangles.length) {
2638
2638
  for (let i = 0; i < triangles.length; i += 3) {
@@ -2938,7 +2938,7 @@ function quadraticBezier(t, p0, p1, p2) {
2938
2938
  }
2939
2939
  const closePointEps = 1e-4;
2940
2940
  const curveEps = 1e-4;
2941
- function strokeTriangulate(points, options = {}) {
2941
+ function strokeTriangulate(points, options2 = {}) {
2942
2942
  const {
2943
2943
  vertices = [],
2944
2944
  indices = [],
@@ -2951,7 +2951,7 @@ function strokeTriangulate(points, options = {}) {
2951
2951
  },
2952
2952
  flipAlignment = false,
2953
2953
  closed = true
2954
- } = options;
2954
+ } = options2;
2955
2955
  const eps = closePointEps;
2956
2956
  if (points.length === 0) {
2957
2957
  return { vertices, indices };
@@ -3503,16 +3503,16 @@ class Curve {
3503
3503
  getFillVertices(_options) {
3504
3504
  return this.getAdaptiveVertices();
3505
3505
  }
3506
- fillTriangulate(options) {
3506
+ fillTriangulate(options2) {
3507
3507
  return fillTriangulate(
3508
- this.getFillVertices(options),
3509
- options
3508
+ this.getFillVertices(options2),
3509
+ options2
3510
3510
  );
3511
3511
  }
3512
- strokeTriangulate(options) {
3512
+ strokeTriangulate(options2) {
3513
3513
  return strokeTriangulate(
3514
3514
  this.getAdaptiveVertices(),
3515
- options
3515
+ options2
3516
3516
  );
3517
3517
  }
3518
3518
  toCommands() {
@@ -4043,15 +4043,15 @@ class LineCurve extends Curve {
4043
4043
  { type: "L", x: p2.x, y: p2.y }
4044
4044
  ];
4045
4045
  }
4046
- getFillVertices(options = {}) {
4046
+ getFillVertices(options2 = {}) {
4047
4047
  const minX = Math.min(this.p1.x, this.p2.x);
4048
4048
  const maxX = Math.max(this.p1.x, this.p2.x);
4049
4049
  const minY = Math.min(this.p1.y, this.p2.y);
4050
4050
  const maxY = Math.max(this.p1.y, this.p2.y);
4051
4051
  const x = minX;
4052
4052
  const y = minY;
4053
- const width = maxX - minX || options.style?.strokeWidth || 0;
4054
- const height = maxY - minY || options.style?.strokeWidth || 0;
4053
+ const width = maxX - minX || options2.style?.strokeWidth || 0;
4054
+ const height = maxY - minY || options2.style?.strokeWidth || 0;
4055
4055
  return [
4056
4056
  x,
4057
4057
  y,
@@ -4158,16 +4158,16 @@ class CompositeCurve extends Curve {
4158
4158
  });
4159
4159
  return output;
4160
4160
  }
4161
- strokeTriangulate(options) {
4161
+ strokeTriangulate(options2) {
4162
4162
  if (this.curves.length === 1) {
4163
- return this.curves[0].strokeTriangulate(options);
4163
+ return this.curves[0].strokeTriangulate(options2);
4164
4164
  } else {
4165
- return super.strokeTriangulate(options);
4165
+ return super.strokeTriangulate(options2);
4166
4166
  }
4167
4167
  }
4168
- getFillVertices(options) {
4168
+ getFillVertices(options2) {
4169
4169
  if (this.curves.length === 1) {
4170
- return this.curves[0].getFillVertices(options);
4170
+ return this.curves[0].getFillVertices(options2);
4171
4171
  } else {
4172
4172
  const output = [];
4173
4173
  let offset;
@@ -4176,7 +4176,7 @@ class CompositeCurve extends Curve {
4176
4176
  if (curve instanceof LineCurve) {
4177
4177
  arr = curve.getAdaptiveVertices();
4178
4178
  } else {
4179
- arr = curve.getFillVertices(options);
4179
+ arr = curve.getFillVertices(options2);
4180
4180
  }
4181
4181
  output.push(...arr);
4182
4182
  if (offset) {
@@ -4585,9 +4585,9 @@ class CurvePath extends CompositeCurve {
4585
4585
  super.getAdaptiveVertices(output)
4586
4586
  );
4587
4587
  }
4588
- getFillVertices(options) {
4588
+ getFillVertices(options2) {
4589
4589
  return this._closeVertices(
4590
- super.getFillVertices(options)
4590
+ super.getFillVertices(options2)
4591
4591
  );
4592
4592
  }
4593
4593
  _setCurrentPoint(point) {
@@ -4986,12 +4986,12 @@ class Path2D extends CompositeCurve {
4986
4986
  });
4987
4987
  return { min: min.finite(), max: max.finite() };
4988
4988
  }
4989
- strokeTriangulate(options) {
4990
- const indices = options?.indices ?? [];
4991
- const vertices = options?.vertices ?? [];
4989
+ strokeTriangulate(options2) {
4990
+ const indices = options2?.indices ?? [];
4991
+ const vertices = options2?.vertices ?? [];
4992
4992
  this.curves.forEach((curve) => {
4993
4993
  curve.strokeTriangulate({
4994
- ...options,
4994
+ ...options2,
4995
4995
  indices,
4996
4996
  vertices,
4997
4997
  style: { ...this.style }
@@ -4999,12 +4999,12 @@ class Path2D extends CompositeCurve {
4999
4999
  });
5000
5000
  return { indices, vertices };
5001
5001
  }
5002
- fillTriangulate(options) {
5002
+ fillTriangulate(options2) {
5003
5003
  const _options = {
5004
- ...options,
5004
+ ...options2,
5005
5005
  style: {
5006
5006
  ...this.style,
5007
- ...options?.style
5007
+ ...options2?.style
5008
5008
  }
5009
5009
  };
5010
5010
  const indices = _options.indices ?? [];
@@ -5030,7 +5030,7 @@ class Path2D extends CompositeCurve {
5030
5030
  }
5031
5031
  }
5032
5032
  fillTriangulate(_pointArray, {
5033
- ...options,
5033
+ ...options2,
5034
5034
  indices,
5035
5035
  vertices,
5036
5036
  holes,
@@ -5040,7 +5040,7 @@ class Path2D extends CompositeCurve {
5040
5040
  } else {
5041
5041
  this.curves.forEach((curve) => {
5042
5042
  curve.fillTriangulate({
5043
- ...options,
5043
+ ...options2,
5044
5044
  indices,
5045
5045
  vertices,
5046
5046
  style: { ...this.style }
@@ -5210,8 +5210,8 @@ ${content}
5210
5210
  toSvg() {
5211
5211
  return new DOMParser().parseFromString(this.toSvgString(), "image/svg+xml").documentElement;
5212
5212
  }
5213
- toCanvas(options = {}) {
5214
- const { pixelRatio = 2, ...style } = options;
5213
+ toCanvas(options2 = {}) {
5214
+ const { pixelRatio = 2, ...style } = options2;
5215
5215
  const { left, top, width, height } = this.getBoundingBox();
5216
5216
  const canvas = document.createElement("canvas");
5217
5217
  canvas.width = width * pixelRatio;
@@ -5466,22 +5466,22 @@ async function convertShapeElementToSvg(el) {
5466
5466
  </svg>`;
5467
5467
  return doc;
5468
5468
  }
5469
- function resolveOptions(options) {
5469
+ function resolveOptions(options2) {
5470
5470
  return {
5471
5471
  width: 0,
5472
5472
  height: 0,
5473
5473
  strokeWidth: 0,
5474
- ...options,
5475
- variables: { ...options.variables }
5474
+ ...options2,
5475
+ variables: { ...options2.variables }
5476
5476
  };
5477
5477
  }
5478
- function _createPresetShape(node, options) {
5478
+ function _createPresetShape(node, options2) {
5479
5479
  const shape = parsePresetShapeDefinition(node);
5480
5480
  return {
5481
5481
  ...shape,
5482
5482
  cate: Number(node.attr("@cate") ?? 0),
5483
5483
  title: node.attr("@title") ?? node.name,
5484
- svg: shape.generateSvgString(resolveOptions(options))
5484
+ svg: shape.generateSvgString(resolveOptions(options2))
5485
5485
  };
5486
5486
  }
5487
5487
  let root;
@@ -5492,13 +5492,13 @@ async function getRoot() {
5492
5492
  }
5493
5493
  return root;
5494
5494
  }
5495
- async function createPresetShape(name, options = {}) {
5495
+ async function createPresetShape(name, options2 = {}) {
5496
5496
  const node = (await getRoot()).find(name);
5497
5497
  return _createPresetShape(node, {
5498
5498
  width: 18,
5499
5499
  height: 18,
5500
5500
  strokeWidth: 1,
5501
- ...options
5501
+ ...options2
5502
5502
  });
5503
5503
  }
5504
5504
  function parseCssStyleLinearGradient(linearGradient) {
@@ -5554,238 +5554,6 @@ function convertSvgLinearGradient(value) {
5554
5554
  return `linear-gradient(${args.join(", ")})`;
5555
5555
  }
5556
5556
  }
5557
- async function convertImageElementToUrl(el) {
5558
- const {
5559
- transform = {},
5560
- style = {},
5561
- maskUrl,
5562
- imageEffects = [],
5563
- imageEffectsRatio = 1
5564
- } = el;
5565
- const url = el.clipUrl || el.url;
5566
- const {
5567
- translateX = 0,
5568
- translateY = 0,
5569
- zoom = 1
5570
- } = transform ?? {};
5571
- const {
5572
- scaleX = 1,
5573
- scaleY = 1,
5574
- filter
5575
- } = style;
5576
- if (translateX === 0 && translateY === 0 && zoom === 1 && scaleX === 1 && scaleY === 1 && !maskUrl && !filter && !imageEffects.length) {
5577
- return url;
5578
- }
5579
- const img = await assets.fetchImageBitmap(url);
5580
- const {
5581
- originWidth = img.width,
5582
- originHeight = img.height,
5583
- imageWidth = originWidth,
5584
- imageHeight = originHeight
5585
- } = transform;
5586
- const {
5587
- width = originWidth,
5588
- height = originHeight
5589
- } = style;
5590
- const dpr = window.devicePixelRatio || 1;
5591
- const [canvas, ctx] = createCanvas(width, height, dpr);
5592
- if (filter)
5593
- ctx.filter = filter;
5594
- ctx.scale(scaleX, scaleY);
5595
- ctx.translate(scaleX < 0 ? -width : 0, scaleY < 0 ? -height : 0);
5596
- if (maskUrl) {
5597
- const mask = await assets.fetchImageBitmap(maskUrl);
5598
- ctx.drawImage(mask, 0, 0, mask.width, mask.height, 0, 0, width, height);
5599
- mask.close();
5600
- ctx.globalCompositeOperation = "source-in";
5601
- }
5602
- const dw = imageWidth * zoom;
5603
- const dh = imageHeight * zoom;
5604
- const dx = -(dw / 2 - imageWidth / 2) + translateX;
5605
- const dy = -(dh / 2 - imageHeight / 2) + translateY;
5606
- ctx.drawImage(img, 0, 0, img.width, img.height, dx, dy, dw, dh);
5607
- img.close();
5608
- ctx.globalCompositeOperation = "source-over";
5609
- if (imageEffects.length > 0) {
5610
- const scale = 0.9;
5611
- const center = {
5612
- x: (width - width * scale) / 2,
5613
- y: (height - height * scale) / 2
5614
- };
5615
- const canvasBitmap = await createImageBitmap(canvas);
5616
- ctx.clearRect(0, 0, canvas.width, canvas.height);
5617
- ctx.scale(scale, scale);
5618
- for (let i = imageEffects.length - 1; i >= 0; i--) {
5619
- const { filling, offset, stroke } = imageEffects[i];
5620
- let effectCanvas = canvasBitmap;
5621
- if (filling) {
5622
- const [canvas1, ctx1] = createCanvas(width, height, dpr);
5623
- ctx1.drawImage(effectCanvas, 0, 0, width, height);
5624
- ctx1.globalCompositeOperation = "source-in";
5625
- if (filling.color) {
5626
- const [canvas2, ctx2] = createCanvas(width, height, dpr);
5627
- ctx2.fillStyle = filling.color;
5628
- ctx2.fillRect(0, 0, width, height);
5629
- ctx1.drawImage(canvas2, 0, 0, width, height);
5630
- } else if (filling.imageContent?.image) {
5631
- const img2 = await assets.fetchImageBitmap(filling.imageContent.image);
5632
- ctx1.drawImage(img2, 0, 0, width, height);
5633
- img2.close();
5634
- }
5635
- effectCanvas = canvas1;
5636
- }
5637
- stroke?.forEach(({ width: width2, color }) => {
5638
- effectCanvas = new ImageStroke().use((ctx2, image, options) => {
5639
- const [, ctx1] = createCanvas(image.width, image.height);
5640
- ctx1.drawImage(image, 0, 0);
5641
- const paths = getContours(ctx1);
5642
- const x = options.thickness;
5643
- const y = options.thickness;
5644
- ctx2.strokeStyle = options.color;
5645
- ctx2.lineWidth = options.thickness * 2;
5646
- ctx2.lineJoin = "round";
5647
- paths.forEach((path) => {
5648
- ctx2.beginPath();
5649
- ctx2.moveTo(x + path[0].x, y + path[1].y);
5650
- for (let i2 = 1; i2 < path.length; i2++) {
5651
- ctx2.lineTo(x + path[i2].x, y + path[i2].y);
5652
- }
5653
- ctx2.closePath();
5654
- });
5655
- ctx2.stroke();
5656
- }).make(effectCanvas, {
5657
- color,
5658
- thickness: width2 / 50 * imageEffectsRatio
5659
- });
5660
- });
5661
- if (offset) {
5662
- let { x, y } = offset;
5663
- x = x / 50 * imageEffectsRatio * 200;
5664
- y = y / 50 * imageEffectsRatio * 200;
5665
- ctx.drawImage(effectCanvas, x + center.x, y + center.y, width, height);
5666
- } else {
5667
- ctx.drawImage(effectCanvas, center.x, center.y, width, height);
5668
- }
5669
- }
5670
- canvasBitmap.close();
5671
- }
5672
- return await new Promise((resolve) => {
5673
- canvas.toBlob((blob) => {
5674
- try {
5675
- resolve(URL.createObjectURL(blob));
5676
- } catch (e) {
5677
- console.error(`Failed to URL.createObjectURL, url: ${url}`, e);
5678
- resolve(url);
5679
- }
5680
- });
5681
- });
5682
- }
5683
- function createCanvas(width, height, ratio = 1) {
5684
- const canvas = document.createElement("canvas");
5685
- canvas.width = width * ratio;
5686
- canvas.height = height * ratio;
5687
- canvas.style.width = `${width}px`;
5688
- canvas.style.height = `${height}px`;
5689
- const ctx = canvas.getContext("2d");
5690
- ctx.scale(ratio, ratio);
5691
- return [canvas, ctx];
5692
- }
5693
- class ImageStroke {
5694
- canvas = document.createElement("canvas");
5695
- method;
5696
- use(method) {
5697
- this.method = method;
5698
- return this;
5699
- }
5700
- make(image, options) {
5701
- const { canvas } = this;
5702
- const ctx = this.canvas.getContext("2d");
5703
- const strokeSize = options.thickness * 2;
5704
- const [resultWidth, resultHeight] = [image.width, image.height].map((val) => val + strokeSize);
5705
- if (resultWidth !== canvas.width || resultHeight !== canvas.height) {
5706
- canvas.width = resultWidth;
5707
- canvas.height = resultHeight;
5708
- }
5709
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
5710
- this.method(ctx, image, options);
5711
- ctx.drawImage(image, options.thickness, options.thickness);
5712
- return canvas;
5713
- }
5714
- }
5715
- function getContours(ctx) {
5716
- const cx = 0;
5717
- const cy = 0;
5718
- const canvasWidth = ctx.canvas.width;
5719
- const canvasHeight = ctx.canvas.height;
5720
- const paths = [];
5721
- let lastPos = 3;
5722
- const alpha = 100;
5723
- const trace = () => {
5724
- const path = [];
5725
- const data = new Uint32Array(ctx.getImageData(cx, cy, canvasWidth, canvasHeight).data.buffer);
5726
- let x;
5727
- let y;
5728
- let startX;
5729
- let startY;
5730
- let startPos = -1;
5731
- let step;
5732
- let prevStep = 9;
5733
- const steps = [9, 0, 3, 3, 2, 0, 9, 3, 1, 9, 1, 1, 2, 0, 2, 9];
5734
- function getState(x2, y2) {
5735
- return x2 >= 0 && y2 >= 0 && x2 < canvasWidth && y2 < canvasHeight ? data[y2 * canvasWidth + x2] >>> 24 > alpha : false;
5736
- }
5737
- function getNextStep(x2, y2) {
5738
- let v = 0;
5739
- if (getState(x2 - 1, y2 - 1)) {
5740
- v += 1;
5741
- }
5742
- if (getState(x2, y2 - 1)) {
5743
- v += 2;
5744
- }
5745
- if (getState(x2 - 1, y2)) {
5746
- v += 4;
5747
- }
5748
- if (getState(x2, y2)) {
5749
- v += 8;
5750
- }
5751
- if (v === 6)
5752
- return prevStep === 0 ? 2 : 3;
5753
- else if (v === 9)
5754
- return prevStep === 3 ? 0 : 1;
5755
- else
5756
- return steps[v];
5757
- }
5758
- for (let i = lastPos; i < data.length; i++) {
5759
- if (data[i] >>> 24 > alpha) {
5760
- startPos = lastPos = i;
5761
- break;
5762
- }
5763
- }
5764
- if (startPos >= 0) {
5765
- x = startX = startPos % canvasWidth;
5766
- y = startY = Math.floor(startPos / canvasWidth);
5767
- do {
5768
- step = getNextStep(x, y);
5769
- if (step === 0)
5770
- y--;
5771
- else if (step === 1)
5772
- y++;
5773
- else if (step === 2)
5774
- x--;
5775
- else if (step === 3)
5776
- x++;
5777
- if (step !== prevStep) {
5778
- path.push({ x: x + cx, y: y + cy });
5779
- prevStep = step;
5780
- }
5781
- } while (x !== startX || y !== startY);
5782
- }
5783
- paths.push(path);
5784
- return path;
5785
- };
5786
- trace();
5787
- return paths;
5788
- }
5789
5557
  async function convertSvgElementToUrl(el) {
5790
5558
  const {
5791
5559
  id,
@@ -5849,15 +5617,7 @@ async function convertSvgElementToUrl(el) {
5849
5617
  svg.setAttribute("width", String(style.width * 2));
5850
5618
  if (style.height)
5851
5619
  svg.setAttribute("height", String(style.height * 2));
5852
- return await convertImageElementToUrl({
5853
- ...el,
5854
- transform: {
5855
- ...el.transform,
5856
- originWidth: style.width,
5857
- originHeight: style.height
5858
- },
5859
- url: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg.outerHTML)}`
5860
- });
5620
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg.outerHTML)}`;
5861
5621
  }
5862
5622
  const highlightReferImage = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNzIgNzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDcyIDcyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTE5LjMsMzguMWMwLjIsMC41LDAuNCwwLjksMC43LDEuNGMwLjIsMC4zLDAuNCwwLjQsMC44LDAuNGMwLjMsMCwwLjUtMC4xLDAuNi0wLjRjMC4xLTAuMywwLjEtMC42LDAuMi0wLjkg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LDAuMiwwLjZ2My40QzU1LjYsMzcuMyw1NS40LDM3LjYsNTUsMzcuN3ogTTUzLjksMzYuMnYtMmgtNy4xdjJINTMuOXogTTQ5LjYsNDAuN2MwLDAuMy0wLjEsMC41LTAuMiwwLjYgICBjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMS0wLjItMC4yLTAuNC0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMiAgIHMwLjQsMC4xLDAuNiwwLjJjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTUyLjgsNDAuN2MwLDAuMi0wLjEsMC40LTAuMiwwLjZjLTAuMiwwLjEtMC40LDAuMi0wLjYsMC4yICAgYy0wLjIsMC0wLjQtMC4xLTAuNi0wLjJjLTAuMi0wLjEtMC4yLTAuMy0wLjItMC42bDAtMS42YzAtMC4yLDAuMS0wLjQsMC4yLTAuNmMwLjItMC4yLDAuMy0wLjIsMC42LTAuMmMwLjIsMCwwLjQsMC4xLDAuNiwwLjIgICBjMC4yLDAuMiwwLjIsMC40LDAuMiwwLjZWNDAuN3ogTTU2LjYsNDAuM2MwLjIsMC40LDAuMSwwLjgtMC4zLDEuMWMtMC41LDAuMy0wLjgsMC4yLTEuMS0wLjNsLTEtMS43Yy0wLjItMC41LTAuMS0wLjgsMC4zLTEuMSAgIGMwLjUtMC4yLDAuOS0wLjEsMS4xLDAuM0w1Ni42LDQwLjN6Ii8+CjwvZz4KPC9zdmc+";
5863
5623
  function convertTextStyle(el, isByWord = false) {
@@ -6077,7 +5837,6 @@ async function convertElement(el, parent, context) {
6077
5837
  }
6078
5838
  switch (el.type) {
6079
5839
  case "image":
6080
- element.name = element.name ?? "图片";
6081
5840
  meta.inCanvasIs = "Element2D";
6082
5841
  meta.inPptIs = "Picture";
6083
5842
  meta.lockAspectRatio = true;
@@ -6088,7 +5847,7 @@ async function convertElement(el, parent, context) {
6088
5847
  if (el.clipUrl) {
6089
5848
  meta.rawForegroundImage = el.url;
6090
5849
  }
6091
- if (el.maskUrl) {
5850
+ if (el.maskUrl && el.maskUrl !== el.url) {
6092
5851
  style.maskImage = el.maskUrl;
6093
5852
  }
6094
5853
  if (el.cropping) {
@@ -6106,7 +5865,6 @@ async function convertElement(el, parent, context) {
6106
5865
  }
6107
5866
  break;
6108
5867
  case "svg": {
6109
- element.name = element.name ?? "SVG";
6110
5868
  meta.inCanvasIs = "Element2D";
6111
5869
  meta.inPptIs = "Picture";
6112
5870
  meta.lockAspectRatio = true;
@@ -6117,7 +5875,6 @@ async function convertElement(el, parent, context) {
6117
5875
  break;
6118
5876
  }
6119
5877
  case "text": {
6120
- element.name = element.name ?? "文字";
6121
5878
  meta.inCanvasIs = "Element2D";
6122
5879
  meta.inPptIs = "Shape";
6123
5880
  if (style.writingMode === "horizontal-tb") {
@@ -6142,7 +5899,6 @@ async function convertElement(el, parent, context) {
6142
5899
  break;
6143
5900
  }
6144
5901
  case "com":
6145
- element.name = element.name ?? "组合";
6146
5902
  meta.inCanvasIs = "Element2D";
6147
5903
  meta.inPptIs = "GroupShape";
6148
5904
  element.children.push(
@@ -6159,7 +5915,6 @@ async function convertElement(el, parent, context) {
6159
5915
  );
6160
5916
  break;
6161
5917
  case "shape": {
6162
- element.name = element.name ?? "形状";
6163
5918
  meta.inCanvasIs = "Element2D";
6164
5919
  meta.inPptIs = "Shape";
6165
5920
  const svg = await convertShapeElementToSvg(el);
@@ -6192,12 +5947,10 @@ async function convertElement(el, parent, context) {
6192
5947
  break;
6193
5948
  }
6194
5949
  case "anim":
6195
- element.name = element.name ?? "Lottie";
6196
5950
  meta.inCanvasIs = "Lottie2D";
6197
5951
  element.src = el.url;
6198
5952
  break;
6199
5953
  case "video":
6200
- element.name = element.name ?? "视频";
6201
5954
  meta.inCanvasIs = "Video2D";
6202
5955
  element.src = el.src;
6203
5956
  break;
@@ -6257,11 +6010,11 @@ async function convertLayout(layout, isFrame = true, context) {
6257
6010
  meta
6258
6011
  };
6259
6012
  }
6260
- async function convertDoc(doc, options = {}) {
6013
+ async function convertDoc(doc, options2 = {}) {
6261
6014
  const {
6262
6015
  gap = 0,
6263
6016
  included
6264
- } = options;
6017
+ } = options2;
6265
6018
  let data;
6266
6019
  let raw = {};
6267
6020
  if (doc.content) {
@@ -6336,6 +6089,238 @@ async function convertDoc(doc, options = {}) {
6336
6089
  }
6337
6090
  };
6338
6091
  }
6092
+ async function convertImageElementToUrl(el) {
6093
+ const {
6094
+ transform = {},
6095
+ style = {},
6096
+ maskUrl,
6097
+ imageEffects = [],
6098
+ imageEffectsRatio = 1
6099
+ } = el;
6100
+ const url = el.clipUrl || el.url;
6101
+ const {
6102
+ translateX = 0,
6103
+ translateY = 0,
6104
+ zoom = 1
6105
+ } = transform ?? {};
6106
+ const {
6107
+ scaleX = 1,
6108
+ scaleY = 1,
6109
+ filter
6110
+ } = style;
6111
+ if (translateX === 0 && translateY === 0 && zoom === 1 && scaleX === 1 && scaleY === 1 && !maskUrl && !filter && !imageEffects.length) {
6112
+ return url;
6113
+ }
6114
+ const img = await assets.fetchImageBitmap(url);
6115
+ const {
6116
+ originWidth = img.width,
6117
+ originHeight = img.height,
6118
+ imageWidth = originWidth,
6119
+ imageHeight = originHeight
6120
+ } = transform;
6121
+ const {
6122
+ width = originWidth,
6123
+ height = originHeight
6124
+ } = style;
6125
+ const dpr = window.devicePixelRatio || 1;
6126
+ const [canvas, ctx] = createCanvas(width, height, dpr);
6127
+ if (filter)
6128
+ ctx.filter = filter;
6129
+ ctx.scale(scaleX, scaleY);
6130
+ ctx.translate(scaleX < 0 ? -width : 0, scaleY < 0 ? -height : 0);
6131
+ if (maskUrl) {
6132
+ const mask = await assets.fetchImageBitmap(maskUrl);
6133
+ ctx.drawImage(mask, 0, 0, mask.width, mask.height, 0, 0, width, height);
6134
+ mask.close();
6135
+ ctx.globalCompositeOperation = "source-in";
6136
+ }
6137
+ const dw = imageWidth * zoom;
6138
+ const dh = imageHeight * zoom;
6139
+ const dx = -(dw / 2 - imageWidth / 2) + translateX;
6140
+ const dy = -(dh / 2 - imageHeight / 2) + translateY;
6141
+ ctx.drawImage(img, 0, 0, img.width, img.height, dx, dy, dw, dh);
6142
+ img.close();
6143
+ ctx.globalCompositeOperation = "source-over";
6144
+ if (imageEffects.length > 0) {
6145
+ const scale = 0.9;
6146
+ const center = {
6147
+ x: (width - width * scale) / 2,
6148
+ y: (height - height * scale) / 2
6149
+ };
6150
+ const canvasBitmap = await createImageBitmap(canvas);
6151
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
6152
+ ctx.scale(scale, scale);
6153
+ for (let i = imageEffects.length - 1; i >= 0; i--) {
6154
+ const { filling, offset, stroke } = imageEffects[i];
6155
+ let effectCanvas = canvasBitmap;
6156
+ if (filling) {
6157
+ const [canvas1, ctx1] = createCanvas(width, height, dpr);
6158
+ ctx1.drawImage(effectCanvas, 0, 0, width, height);
6159
+ ctx1.globalCompositeOperation = "source-in";
6160
+ if (filling.color) {
6161
+ const [canvas2, ctx2] = createCanvas(width, height, dpr);
6162
+ ctx2.fillStyle = filling.color;
6163
+ ctx2.fillRect(0, 0, width, height);
6164
+ ctx1.drawImage(canvas2, 0, 0, width, height);
6165
+ } else if (filling.imageContent?.image) {
6166
+ const img2 = await assets.fetchImageBitmap(filling.imageContent.image);
6167
+ ctx1.drawImage(img2, 0, 0, width, height);
6168
+ img2.close();
6169
+ }
6170
+ effectCanvas = canvas1;
6171
+ }
6172
+ stroke?.forEach(({ width: width2, color }) => {
6173
+ effectCanvas = new ImageStroke().use((ctx2, image, options2) => {
6174
+ const [, ctx1] = createCanvas(image.width, image.height);
6175
+ ctx1.drawImage(image, 0, 0);
6176
+ const paths = getContours(ctx1);
6177
+ const x = options2.thickness;
6178
+ const y = options2.thickness;
6179
+ ctx2.strokeStyle = options2.color;
6180
+ ctx2.lineWidth = options2.thickness * 2;
6181
+ ctx2.lineJoin = "round";
6182
+ paths.forEach((path) => {
6183
+ ctx2.beginPath();
6184
+ ctx2.moveTo(x + path[0].x, y + path[1].y);
6185
+ for (let i2 = 1; i2 < path.length; i2++) {
6186
+ ctx2.lineTo(x + path[i2].x, y + path[i2].y);
6187
+ }
6188
+ ctx2.closePath();
6189
+ });
6190
+ ctx2.stroke();
6191
+ }).make(effectCanvas, {
6192
+ color,
6193
+ thickness: width2 / 50 * imageEffectsRatio
6194
+ });
6195
+ });
6196
+ if (offset) {
6197
+ let { x, y } = offset;
6198
+ x = x / 50 * imageEffectsRatio * 200;
6199
+ y = y / 50 * imageEffectsRatio * 200;
6200
+ ctx.drawImage(effectCanvas, x + center.x, y + center.y, width, height);
6201
+ } else {
6202
+ ctx.drawImage(effectCanvas, center.x, center.y, width, height);
6203
+ }
6204
+ }
6205
+ canvasBitmap.close();
6206
+ }
6207
+ return await new Promise((resolve) => {
6208
+ canvas.toBlob((blob) => {
6209
+ try {
6210
+ resolve(URL.createObjectURL(blob));
6211
+ } catch (e) {
6212
+ console.error(`Failed to URL.createObjectURL, url: ${url}`, e);
6213
+ resolve(url);
6214
+ }
6215
+ });
6216
+ });
6217
+ }
6218
+ function createCanvas(width, height, ratio = 1) {
6219
+ const canvas = document.createElement("canvas");
6220
+ canvas.width = width * ratio;
6221
+ canvas.height = height * ratio;
6222
+ canvas.style.width = `${width}px`;
6223
+ canvas.style.height = `${height}px`;
6224
+ const ctx = canvas.getContext("2d");
6225
+ ctx.scale(ratio, ratio);
6226
+ return [canvas, ctx];
6227
+ }
6228
+ class ImageStroke {
6229
+ canvas = document.createElement("canvas");
6230
+ method;
6231
+ use(method) {
6232
+ this.method = method;
6233
+ return this;
6234
+ }
6235
+ make(image, options2) {
6236
+ const { canvas } = this;
6237
+ const ctx = this.canvas.getContext("2d");
6238
+ const strokeSize = options2.thickness * 2;
6239
+ const [resultWidth, resultHeight] = [image.width, image.height].map((val) => val + strokeSize);
6240
+ if (resultWidth !== canvas.width || resultHeight !== canvas.height) {
6241
+ canvas.width = resultWidth;
6242
+ canvas.height = resultHeight;
6243
+ }
6244
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
6245
+ this.method(ctx, image, options2);
6246
+ ctx.drawImage(image, options2.thickness, options2.thickness);
6247
+ return canvas;
6248
+ }
6249
+ }
6250
+ function getContours(ctx) {
6251
+ const cx = 0;
6252
+ const cy = 0;
6253
+ const canvasWidth = ctx.canvas.width;
6254
+ const canvasHeight = ctx.canvas.height;
6255
+ const paths = [];
6256
+ let lastPos = 3;
6257
+ const alpha = 100;
6258
+ const trace = () => {
6259
+ const path = [];
6260
+ const data = new Uint32Array(ctx.getImageData(cx, cy, canvasWidth, canvasHeight).data.buffer);
6261
+ let x;
6262
+ let y;
6263
+ let startX;
6264
+ let startY;
6265
+ let startPos = -1;
6266
+ let step;
6267
+ let prevStep = 9;
6268
+ const steps = [9, 0, 3, 3, 2, 0, 9, 3, 1, 9, 1, 1, 2, 0, 2, 9];
6269
+ function getState(x2, y2) {
6270
+ return x2 >= 0 && y2 >= 0 && x2 < canvasWidth && y2 < canvasHeight ? data[y2 * canvasWidth + x2] >>> 24 > alpha : false;
6271
+ }
6272
+ function getNextStep(x2, y2) {
6273
+ let v = 0;
6274
+ if (getState(x2 - 1, y2 - 1)) {
6275
+ v += 1;
6276
+ }
6277
+ if (getState(x2, y2 - 1)) {
6278
+ v += 2;
6279
+ }
6280
+ if (getState(x2 - 1, y2)) {
6281
+ v += 4;
6282
+ }
6283
+ if (getState(x2, y2)) {
6284
+ v += 8;
6285
+ }
6286
+ if (v === 6)
6287
+ return prevStep === 0 ? 2 : 3;
6288
+ else if (v === 9)
6289
+ return prevStep === 3 ? 0 : 1;
6290
+ else
6291
+ return steps[v];
6292
+ }
6293
+ for (let i = lastPos; i < data.length; i++) {
6294
+ if (data[i] >>> 24 > alpha) {
6295
+ startPos = lastPos = i;
6296
+ break;
6297
+ }
6298
+ }
6299
+ if (startPos >= 0) {
6300
+ x = startX = startPos % canvasWidth;
6301
+ y = startY = Math.floor(startPos / canvasWidth);
6302
+ do {
6303
+ step = getNextStep(x, y);
6304
+ if (step === 0)
6305
+ y--;
6306
+ else if (step === 1)
6307
+ y++;
6308
+ else if (step === 2)
6309
+ x--;
6310
+ else if (step === 3)
6311
+ x++;
6312
+ if (step !== prevStep) {
6313
+ path.push({ x: x + cx, y: y + cy });
6314
+ prevStep = step;
6315
+ }
6316
+ } while (x !== startX || y !== startY);
6317
+ }
6318
+ paths.push(path);
6319
+ return path;
6320
+ };
6321
+ trace();
6322
+ return paths;
6323
+ }
6339
6324
  function bidTidLoader(editor, api) {
6340
6325
  const {
6341
6326
  config,
@@ -6386,7 +6371,7 @@ function bidTidLoader(editor, api) {
6386
6371
  doc.children.push(element);
6387
6372
  }
6388
6373
  });
6389
- left += width + config.value.frameGap;
6374
+ left += width + config.value.canvas.frame.gap;
6390
6375
  });
6391
6376
  return doc;
6392
6377
  }
@@ -6410,11 +6395,11 @@ function bigeLoader() {
6410
6395
  }
6411
6396
  };
6412
6397
  }
6413
- function plugin(options = {}) {
6398
+ function plugin(options2 = {}) {
6414
6399
  const {
6415
6400
  font,
6416
6401
  api
6417
- } = options;
6402
+ } = options2;
6418
6403
  const _api = {
6419
6404
  fonts: "/new/design/fonts",
6420
6405
  bid: "/new/udesign/info/%d",
@@ -6485,23 +6470,37 @@ async function setupFonts(editor, api) {
6485
6470
  await loadBigeFonts(api.fonts, true);
6486
6471
  });
6487
6472
  }
6488
- const editorOptions = {
6489
- checkerboard: true,
6490
- checkerboardStyle: "grid",
6491
- pixelGrid: true,
6492
- camera: true,
6493
- ruler: true,
6494
- scrollbar: true,
6495
- statusbar: true,
6496
- frameGap: 48,
6497
- zoomToFit: "width",
6498
- typographyStrategy: "autoHeight",
6473
+ const options = {
6499
6474
  locale: { locale: "zhHans" },
6500
- defaultFont: { family: "SourceHanSansCN-Normal", src: "https://bige.cdn.bcebos.com/files/202006/cBNrzOsE_rAQB.woff" },
6501
- transformControls: {
6502
- handleShape: "circle",
6503
- handleStrategy: "point",
6504
- rotator: true
6475
+ viewport: {
6476
+ camera: { enabled: true },
6477
+ zoom: { strategy: "containWidth" },
6478
+ screenPadding: { left: 110, top: 60, right: 110, bottom: 60 }
6479
+ },
6480
+ canvas: {
6481
+ checkerboard: { enabled: true, style: "grid" },
6482
+ pixelGrid: { enabled: true },
6483
+ frame: { outline: false }
6484
+ },
6485
+ ui: {
6486
+ ruler: { visible: true },
6487
+ scrollbar: { visible: true },
6488
+ statusbar: { visible: true }
6489
+ },
6490
+ interaction: {
6491
+ transform: {
6492
+ handleShape: "circle",
6493
+ handleStyle: "8-points",
6494
+ lockAspectRatioStrategy: "diagonal",
6495
+ rotator: true
6496
+ }
6497
+ },
6498
+ typography: {
6499
+ strategy: "autoHeight",
6500
+ defaultFont: {
6501
+ family: "SourceHanSansCN-Normal",
6502
+ src: "https://bige.cdn.bcebos.com/files/202006/cBNrzOsE_rAQB.woff"
6503
+ }
6505
6504
  }
6506
6505
  };
6507
6506
  export {
@@ -6519,9 +6518,9 @@ export {
6519
6518
  convertTextStyle,
6520
6519
  croppingToCropRect,
6521
6520
  plugin as default,
6522
- editorOptions,
6523
6521
  getStyle,
6524
6522
  getTextContents,
6523
+ options,
6525
6524
  parseAnimations,
6526
6525
  plugin,
6527
6526
  transformToCropRect,
@@ -0,0 +1,2 @@
1
+ import type { Options } from 'mce';
2
+ export declare const options: Options;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mce/bigesj",
3
3
  "type": "module",
4
- "version": "0.16.6",
4
+ "version": "0.17.0",
5
5
  "description": "Plugin for mce",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "modern-openxml": "^1.10.1"
50
50
  },
51
51
  "devDependencies": {
52
- "mce": "0.16.6"
52
+ "mce": "0.17.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "mce": "^0"
@@ -1 +0,0 @@
1
- export declare const editorOptions: Partial<Mce.Options>;