@plait/core 0.24.0-next.11 → 0.24.0-next.13

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.
Files changed (42) hide show
  1. package/board/board.component.d.ts +1 -1
  2. package/core/children/children.component.d.ts +3 -3
  3. package/core/element/element.component.d.ts +1 -1
  4. package/esm2022/board/board.component.mjs +7 -5
  5. package/esm2022/constants/resize.mjs +1 -1
  6. package/esm2022/core/children/children.component.mjs +11 -9
  7. package/esm2022/core/element/context.mjs +1 -1
  8. package/esm2022/core/element/element.component.mjs +4 -3
  9. package/esm2022/interfaces/board.mjs +1 -1
  10. package/esm2022/interfaces/plugin-key.mjs +1 -1
  11. package/esm2022/interfaces/point.mjs +1 -1
  12. package/esm2022/interfaces/viewport.mjs +2 -2
  13. package/esm2022/plugins/create-board.mjs +10 -9
  14. package/esm2022/plugins/with-hotkey.mjs +4 -2
  15. package/esm2022/plugins/with-moving.mjs +5 -5
  16. package/esm2022/plugins/with-options.mjs +1 -1
  17. package/esm2022/public-api.mjs +1 -2
  18. package/esm2022/testing/core/fake-weak-map.mjs +2 -2
  19. package/esm2022/testing/core/index.mjs +1 -1
  20. package/esm2022/testing/fake-events/event-objects.mjs +1 -1
  21. package/esm2022/testing/fake-events/index.mjs +1 -1
  22. package/esm2022/testing/index.mjs +1 -1
  23. package/esm2022/testing/test-element.mjs +1 -1
  24. package/esm2022/transforms/element.mjs +4 -4
  25. package/esm2022/utils/board.mjs +1 -1
  26. package/esm2022/utils/draw/rectangle.mjs +1 -1
  27. package/esm2022/utils/element.mjs +3 -3
  28. package/esm2022/utils/reaction-manager.mjs +115 -85
  29. package/esm2022/utils/to-image.mjs +106 -34
  30. package/esm2022/utils/tree.mjs +2 -2
  31. package/fesm2022/plait-core.mjs +258 -163
  32. package/fesm2022/plait-core.mjs.map +1 -1
  33. package/interfaces/board.d.ts +1 -0
  34. package/package.json +1 -1
  35. package/public-api.d.ts +0 -1
  36. package/testing/core/fake-weak-map.d.ts +2 -2
  37. package/transforms/element.d.ts +2 -2
  38. package/utils/reaction-manager.d.ts +5 -5
  39. package/utils/to-image.d.ts +11 -0
  40. package/utils/tree.d.ts +2 -2
  41. package/esm2022/plait.module.mjs +0 -21
  42. package/plait.module.d.ts +0 -10
@@ -1,12 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Input, Injectable, Component, ChangeDetectionStrategy, EventEmitter, ElementRef, Output, HostBinding, ViewChild, ContentChildren, NgModule } from '@angular/core';
2
+ import { Directive, Input, Injectable, Component, ChangeDetectionStrategy, EventEmitter, ElementRef, Output, HostBinding, ViewChild, ContentChildren } from '@angular/core';
3
3
  import rough from 'roughjs/bin/rough';
4
4
  import { timer, Subject, fromEvent } from 'rxjs';
5
5
  import { takeUntil, filter, tap } from 'rxjs/operators';
6
6
  import { isKeyHotkey, isHotkey } from 'is-hotkey';
7
7
  import produce, { createDraft, finishDraft, isDraft } from 'immer';
8
- import * as i1 from '@angular/common';
9
- import { CommonModule } from '@angular/common';
8
+ import { NgFor } from '@angular/common';
10
9
 
11
10
  // record richtext type status
12
11
  const IS_BOARD_CACHE = new WeakMap();
@@ -1245,6 +1244,68 @@ const cacheMovingElements = (board, elements) => {
1245
1244
  BOARD_TO_MOVING_ELEMENT.set(board, elements);
1246
1245
  };
1247
1246
 
1247
+ const IMAGE_CONTAINER = 'plait-image-container';
1248
+ /**
1249
+ * Is element node
1250
+ * @param node
1251
+ * @returns
1252
+ */
1253
+ function isElementNode(node) {
1254
+ return node.nodeType === Node.ELEMENT_NODE;
1255
+ }
1256
+ /**
1257
+ * load image resources
1258
+ * @param url image url
1259
+ * @returns image element
1260
+ */
1261
+ function loadImage(src) {
1262
+ return new Promise((resolve, reject) => {
1263
+ const img = new Image();
1264
+ img.crossOrigin = 'anonymous';
1265
+ img.onload = () => resolve(img);
1266
+ img.onerror = () => reject(new Error('Failed to load image'));
1267
+ img.src = src;
1268
+ });
1269
+ }
1270
+ /**
1271
+ * create and return canvas and context
1272
+ * @param width canvas width
1273
+ * @param height canvas height
1274
+ * @param fillStyle fill style
1275
+ * @returns canvas and context
1276
+ */
1277
+ function createCanvas(width, height, fillStyle = 'transparent') {
1278
+ const canvas = document.createElement('canvas');
1279
+ const ctx = canvas.getContext('2d');
1280
+ canvas.width = width;
1281
+ canvas.height = height;
1282
+ canvas.style.width = `${width}px`;
1283
+ canvas.style.height = `${height}px`;
1284
+ ctx.strokeStyle = '#ffffff';
1285
+ ctx.fillStyle = fillStyle;
1286
+ ctx.fillRect(0, 0, width, height);
1287
+ return {
1288
+ canvas,
1289
+ ctx
1290
+ };
1291
+ }
1292
+ /**
1293
+ * convert image to base64
1294
+ * @param url image url
1295
+ * @returns image base64
1296
+ */
1297
+ function convertImageToBase64(url) {
1298
+ return loadImage(url).then(img => {
1299
+ const { canvas, ctx } = createCanvas(img.width, img.height);
1300
+ ctx?.drawImage(img, 0, 0);
1301
+ return canvas.toDataURL('image/png');
1302
+ });
1303
+ }
1304
+ /**
1305
+ * clone node style
1306
+ * @param nativeNode source node
1307
+ * @param clonedNode clone node
1308
+ */
1248
1309
  function cloneCSSStyle(nativeNode, clonedNode) {
1249
1310
  const targetStyle = clonedNode.style;
1250
1311
  if (!targetStyle) {
@@ -1262,25 +1323,13 @@ function cloneCSSStyle(nativeNode, clonedNode) {
1262
1323
  });
1263
1324
  }
1264
1325
  }
1265
- function createCanvas(width, height, fillStyle) {
1266
- const canvas = document.createElement('canvas');
1267
- const ctx = canvas.getContext('2d');
1268
- canvas.width = width;
1269
- canvas.height = height;
1270
- canvas.style.width = `${width}px`;
1271
- canvas.style.height = `${height}px`;
1272
- ctx.strokeStyle = '#ffffff';
1273
- ctx.fillStyle = fillStyle;
1274
- ctx.fillRect(0, 0, width, height);
1275
- return {
1276
- canvas,
1277
- ctx
1278
- };
1279
- }
1280
- function isElementNode(node) {
1281
- return node.nodeType === Node.ELEMENT_NODE;
1282
- }
1283
- function cloneSvg(board, options) {
1326
+ /**
1327
+ * clone svg element
1328
+ * @param board board
1329
+ * @param options parameter configuration
1330
+ * @returns clone svg element
1331
+ */
1332
+ async function cloneSvg(board, options) {
1284
1333
  const elementHostBox = getRectangleByElements(board, board.children, true);
1285
1334
  const { width, height, x, y } = elementHostBox;
1286
1335
  const { padding = 4, inlineStyleClassNames } = options;
@@ -1293,8 +1342,9 @@ function cloneSvg(board, options) {
1293
1342
  cloneSvgElement.setAttribute('height', `${height}`);
1294
1343
  cloneSvgElement.setAttribute('viewBox', [x - padding, y - padding, width + 2 * padding, height + 2 * padding].join(','));
1295
1344
  if (inlineStyleClassNames) {
1296
- const sourceNodes = Array.from(sourceSvg.querySelectorAll(inlineStyleClassNames));
1297
- const cloneNodes = Array.from(cloneSvgElement.querySelectorAll(inlineStyleClassNames));
1345
+ const classNames = inlineStyleClassNames + `,.${IMAGE_CONTAINER}`;
1346
+ const sourceNodes = Array.from(sourceSvg.querySelectorAll(classNames));
1347
+ const cloneNodes = Array.from(cloneSvgElement.querySelectorAll(classNames));
1298
1348
  sourceNodes.forEach((node, index) => {
1299
1349
  const cloneNode = cloneNodes[index];
1300
1350
  const childElements = Array.from(node.querySelectorAll('*')).filter(isElementNode);
@@ -1302,21 +1352,38 @@ function cloneSvg(board, options) {
1302
1352
  sourceNodes.push(...childElements);
1303
1353
  cloneNodes.push(...cloneChildElements);
1304
1354
  });
1305
- sourceNodes.forEach((node, index) => {
1355
+ // processing styles
1356
+ sourceNodes.map((node, index) => {
1306
1357
  const cloneNode = cloneNodes[index];
1307
1358
  cloneCSSStyle(node, cloneNode);
1308
1359
  });
1309
1360
  }
1361
+ // 使用 Promise.all 等待所有异步操作完成
1362
+ const sourceImageNodes = Array.from(sourceSvg.querySelectorAll(`.${IMAGE_CONTAINER}`));
1363
+ const cloneImageNodes = Array.from(cloneSvgElement.querySelectorAll(`.${IMAGE_CONTAINER}`));
1364
+ await Promise.all(sourceImageNodes.map((_, index) => {
1365
+ return new Promise(resolve => {
1366
+ const cloneNode = cloneImageNodes[index];
1367
+ // processing image
1368
+ const image = cloneNode.querySelector('img');
1369
+ const url = image?.getAttribute('src');
1370
+ if (!url) {
1371
+ return resolve(true);
1372
+ }
1373
+ convertImageToBase64(url).then(base64Image => {
1374
+ image?.setAttribute('src', base64Image);
1375
+ resolve(true);
1376
+ });
1377
+ });
1378
+ }));
1310
1379
  return cloneSvgElement;
1311
1380
  }
1312
- function loadImage(src) {
1313
- return new Promise((resolve, reject) => {
1314
- const img = new Image();
1315
- img.onload = () => resolve(img);
1316
- img.onerror = () => reject(new Error('Failed to load image'));
1317
- img.src = src;
1318
- });
1319
- }
1381
+ /**
1382
+ * current board transfer pictures
1383
+ * @param board board
1384
+ * @param options parameter configuration
1385
+ * @returns images in the specified format base64
1386
+ */
1320
1387
  async function toImage(board, options) {
1321
1388
  if (!board) {
1322
1389
  return undefined;
@@ -1326,21 +1393,25 @@ async function toImage(board, options) {
1326
1393
  const { width, height } = elementHostBox;
1327
1394
  const ratioWidth = width * ratio;
1328
1395
  const ratioHeight = height * ratio;
1329
- const cloneSvgElement = cloneSvg(board, options);
1396
+ const cloneSvgElement = await cloneSvg(board, options);
1330
1397
  const { canvas, ctx } = createCanvas(ratioWidth, ratioHeight, fillStyle);
1331
1398
  const svgStr = new XMLSerializer().serializeToString(cloneSvgElement);
1332
1399
  const imgSrc = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgStr)}`;
1333
1400
  try {
1334
1401
  const img = await loadImage(imgSrc);
1335
1402
  ctx.drawImage(img, 0, 0, ratioWidth, ratioHeight);
1336
- const url = canvas.toDataURL('image/png');
1337
- return url;
1403
+ return canvas.toDataURL('image/png');
1338
1404
  }
1339
1405
  catch (error) {
1340
1406
  console.error('Error converting SVG to image:', error);
1341
1407
  return undefined;
1342
1408
  }
1343
1409
  }
1410
+ /**
1411
+ * download the file with the specified name
1412
+ * @param url download url
1413
+ * @param name file name
1414
+ */
1344
1415
  function downloadImage(url, name) {
1345
1416
  const a = document.createElement('a');
1346
1417
  a.href = url;
@@ -1759,7 +1830,7 @@ const Point = {
1759
1830
  const Viewport = {
1760
1831
  isViewport: (value) => {
1761
1832
  return !isNullOrUndefined(value.zoom) && !isNullOrUndefined(value.viewBackgroundColor);
1762
- },
1833
+ }
1763
1834
  };
1764
1835
 
1765
1836
  const SAVING = new WeakMap();
@@ -1873,9 +1944,9 @@ function getBoardRectangle(board) {
1873
1944
  }
1874
1945
  function getElementById(board, id, dataSource) {
1875
1946
  if (!dataSource) {
1876
- dataSource = findElements(board, { match: (element) => true, recursion: (element) => true });
1947
+ dataSource = findElements(board, { match: element => true, recursion: element => true });
1877
1948
  }
1878
- let element = dataSource.find((element) => element.id === id);
1949
+ let element = dataSource.find(element => element.id === id);
1879
1950
  return element;
1880
1951
  }
1881
1952
  function findElements(board, options) {
@@ -2626,14 +2697,15 @@ function createBoard(children, options) {
2626
2697
  isMovable: element => false,
2627
2698
  getRectangle: element => null,
2628
2699
  applyTheme: (element) => { },
2629
- pointerDown: (pointer) => { },
2630
- pointerMove: (pointer) => { },
2631
- pointerUp: (pointer) => { },
2632
- pointerCancel: (pointer) => { },
2633
- pointerOut: (pointer) => { },
2634
- pointerLeave: (pointer) => { },
2635
- globalPointerMove: (pointer) => { },
2636
- globalPointerUp: (pointer) => { },
2700
+ isAlign: element => false,
2701
+ pointerDown: pointer => { },
2702
+ pointerMove: pointer => { },
2703
+ pointerUp: pointer => { },
2704
+ pointerCancel: pointer => { },
2705
+ pointerOut: pointer => { },
2706
+ pointerLeave: pointer => { },
2707
+ globalPointerMove: pointer => { },
2708
+ globalPointerUp: pointer => { }
2637
2709
  };
2638
2710
  return board;
2639
2711
  }
@@ -2817,7 +2889,7 @@ function withViewport(board) {
2817
2889
  }
2818
2890
 
2819
2891
  const ALIGN_TOLERANCE = 2;
2820
- class ReactionManager {
2892
+ class AlignReaction {
2821
2893
  constructor(board, activeElements, activeRectangle) {
2822
2894
  this.board = board;
2823
2895
  this.activeElements = activeElements;
@@ -2827,7 +2899,7 @@ class ReactionManager {
2827
2899
  getAlignRectangle() {
2828
2900
  const result = [];
2829
2901
  depthFirstRecursion(this.board, node => {
2830
- if (PlaitBoard.isBoard(node) || this.activeElements.some(element => node.id === element.id) || node.type !== 'geometry') {
2902
+ if (PlaitBoard.isBoard(node) || this.activeElements.some(element => node.id === element.id) || !this.board.isAlign(node)) {
2831
2903
  return;
2832
2904
  }
2833
2905
  const rectangle = this.board.getRectangle(node);
@@ -2954,17 +3026,27 @@ class ReactionManager {
2954
3026
  }
2955
3027
  }
2956
3028
  const alignDeltaX = deltaX;
3029
+ const alignDeltaY = deltaY;
2957
3030
  this.activeRectangle.x += deltaX;
2958
- const distributeHorizontalResult = this.alignDistributeHorizontal(alignRectangles);
2959
- const distributeLines = distributeHorizontalResult.distributeLines;
2960
- if (distributeHorizontalResult.deltaX) {
2961
- deltaX = distributeHorizontalResult.deltaX;
3031
+ const distributeHorizontalResult = this.alignDistribute(alignRectangles, true);
3032
+ const distributeVerticalResult = this.alignDistribute(alignRectangles, false);
3033
+ const distributeLines = [...distributeHorizontalResult.distributeLines, ...distributeVerticalResult.distributeLines];
3034
+ if (distributeHorizontalResult.delta) {
3035
+ deltaX = distributeHorizontalResult.delta;
2962
3036
  if (alignDeltaX !== deltaX) {
2963
3037
  alignLines[0] = [];
2964
3038
  alignLines[1] = [];
2965
3039
  alignLines[2] = [];
2966
3040
  }
2967
3041
  }
3042
+ if (distributeVerticalResult.delta) {
3043
+ deltaY = distributeVerticalResult.delta;
3044
+ if (alignDeltaY !== deltaY) {
3045
+ alignLines[3] = [];
3046
+ alignLines[4] = [];
3047
+ alignLines[5] = [];
3048
+ }
3049
+ }
2968
3050
  if (alignLines.length) {
2969
3051
  this.drawAlignLines(alignLines, g);
2970
3052
  }
@@ -3001,82 +3083,85 @@ class ReactionManager {
3001
3083
  indexY
3002
3084
  };
3003
3085
  }
3004
- alignDistributeHorizontal(alignRectangles) {
3086
+ alignDistribute(alignRectangles, isHorizontal) {
3005
3087
  let distributeLines = [];
3006
- let deltaX = 0;
3007
- const activeRectangleCenterX = this.activeRectangle.x + this.activeRectangle.width / 2;
3088
+ let delta = 0;
3008
3089
  let rectangles = [];
3090
+ const axis = isHorizontal ? 'x' : 'y';
3091
+ const side = isHorizontal ? 'width' : 'height';
3092
+ const activeRectangleCenter = this.activeRectangle[axis] + this.activeRectangle[side] / 2;
3009
3093
  alignRectangles.forEach(rec => {
3010
- if (isHorizontalCross(rec, this.activeRectangle) && !RectangleClient.isHit(rec, this.activeRectangle)) {
3094
+ const isCross = isHorizontal ? isHorizontalCross(rec, this.activeRectangle) : isVerticalCross(rec, this.activeRectangle);
3095
+ if (isCross && !RectangleClient.isHit(rec, this.activeRectangle)) {
3011
3096
  rectangles.push(rec);
3012
3097
  }
3013
3098
  });
3014
- rectangles = [...rectangles, this.activeRectangle].sort((a, b) => a.x - b.x);
3099
+ rectangles = [...rectangles, this.activeRectangle].sort((a, b) => a[axis] - b[axis]);
3015
3100
  const refArray = [];
3016
3101
  let distributeDistance = 0;
3017
- let leftIndex = undefined;
3018
- let rightIndex = undefined;
3102
+ let beforeIndex = undefined;
3103
+ let afterIndex = undefined;
3019
3104
  for (let i = 0; i < rectangles.length; i++) {
3020
3105
  for (let j = i + 1; j < rectangles.length; j++) {
3021
- const left = rectangles[i];
3022
- const right = rectangles[j];
3023
- const distance = right.x - (left.x + left.width);
3106
+ const before = rectangles[i];
3107
+ const after = rectangles[j];
3108
+ const distance = after[axis] - (before[axis] + before[side]);
3024
3109
  let dif = Infinity;
3025
- if (refArray[i]?.right) {
3026
- refArray[i].right.push({ distance, index: j });
3110
+ if (refArray[i]?.after) {
3111
+ refArray[i].after.push({ distance, index: j });
3027
3112
  }
3028
3113
  else {
3029
- refArray[i] = { ...refArray[i], right: [{ distance, index: j }] };
3114
+ refArray[i] = { ...refArray[i], after: [{ distance, index: j }] };
3030
3115
  }
3031
- if (refArray[j]?.left) {
3032
- refArray[j].left.push({ distance, index: i });
3116
+ if (refArray[j]?.before) {
3117
+ refArray[j].before.push({ distance, index: i });
3033
3118
  }
3034
3119
  else {
3035
- refArray[j] = { ...refArray[j], left: [{ distance, index: i }] };
3120
+ refArray[j] = { ...refArray[j], before: [{ distance, index: i }] };
3036
3121
  }
3037
3122
  //middle
3038
- let _centerX = (left.x + left.width + right.x) / 2;
3039
- dif = Math.abs(activeRectangleCenterX - _centerX);
3123
+ let _center = (before[axis] + before[side] + after[axis]) / 2;
3124
+ dif = Math.abs(activeRectangleCenter - _center);
3040
3125
  if (dif < ALIGN_TOLERANCE) {
3041
- distributeDistance = (right.x - (left.x + left.width) - this.activeRectangle.width) / 2;
3042
- deltaX = activeRectangleCenterX - _centerX;
3043
- leftIndex = i;
3044
- rightIndex = j;
3126
+ distributeDistance = (after[axis] - (before[axis] + before[side]) - this.activeRectangle[side]) / 2;
3127
+ delta = activeRectangleCenter - _center;
3128
+ beforeIndex = i;
3129
+ afterIndex = j;
3045
3130
  }
3046
- //right
3047
- const distanceRight = right.x - (left.x + left.width);
3048
- _centerX = right.x + right.width + distanceRight + this.activeRectangle.width / 2;
3049
- dif = Math.abs(activeRectangleCenterX - _centerX);
3131
+ //after
3132
+ const distanceRight = after[axis] - (before[axis] + before[side]);
3133
+ _center = after[axis] + after[side] + distanceRight + this.activeRectangle[side] / 2;
3134
+ dif = Math.abs(activeRectangleCenter - _center);
3050
3135
  if (!distributeDistance && dif < ALIGN_TOLERANCE) {
3051
3136
  distributeDistance = distanceRight;
3052
- leftIndex = j;
3053
- deltaX = activeRectangleCenterX - _centerX;
3137
+ beforeIndex = j;
3138
+ delta = activeRectangleCenter - _center;
3054
3139
  }
3055
- //left
3056
- const distanceLeft = right.x - (left.x + left.width);
3057
- _centerX = left.x - distanceLeft - this.activeRectangle.width / 2;
3058
- dif = Math.abs(activeRectangleCenterX - _centerX);
3140
+ //before
3141
+ const distanceBefore = after[axis] - (before[axis] + before[side]);
3142
+ _center = before[axis] - distanceBefore - this.activeRectangle[side] / 2;
3143
+ dif = Math.abs(activeRectangleCenter - _center);
3059
3144
  if (!distributeDistance && dif < ALIGN_TOLERANCE) {
3060
- distributeDistance = distanceLeft;
3061
- rightIndex = i;
3062
- deltaX = activeRectangleCenterX - _centerX;
3145
+ distributeDistance = distanceBefore;
3146
+ afterIndex = i;
3147
+ delta = activeRectangleCenter - _center;
3063
3148
  }
3064
3149
  }
3065
3150
  }
3066
3151
  const activeIndex = rectangles.indexOf(this.activeRectangle);
3067
- let leftIndexes = [];
3068
- let rightIndexes = [];
3069
- if (leftIndex !== undefined) {
3070
- leftIndexes.push(leftIndex);
3071
- findRectangle(distributeDistance, refArray[leftIndex], Direction.left, leftIndexes);
3072
- }
3073
- if (rightIndex !== undefined) {
3074
- rightIndexes.push(rightIndex);
3075
- findRectangle(distributeDistance, refArray[rightIndex], Direction.right, rightIndexes);
3076
- }
3077
- if (leftIndexes.length || rightIndexes.length) {
3078
- const indexArr = [...leftIndexes.reverse(), activeIndex, ...rightIndexes];
3079
- this.activeRectangle.x -= deltaX;
3152
+ let beforeIndexes = [];
3153
+ let afterIndexes = [];
3154
+ if (beforeIndex !== undefined) {
3155
+ beforeIndexes.push(beforeIndex);
3156
+ findRectangle(distributeDistance, refArray[beforeIndex], 'before', beforeIndexes);
3157
+ }
3158
+ if (afterIndex !== undefined) {
3159
+ afterIndexes.push(afterIndex);
3160
+ findRectangle(distributeDistance, refArray[afterIndex], 'after', afterIndexes);
3161
+ }
3162
+ if (beforeIndexes.length || afterIndexes.length) {
3163
+ const indexArr = [...beforeIndexes.reverse(), activeIndex, ...afterIndexes];
3164
+ this.activeRectangle[axis] -= delta;
3080
3165
  for (let i = 1; i < indexArr.length; i++) {
3081
3166
  distributeLines.push(getLinePoints(rectangles[indexArr[i - 1]], rectangles[indexArr[i]]));
3082
3167
  }
@@ -3084,7 +3169,7 @@ class ReactionManager {
3084
3169
  function findRectangle(distance, ref, direction, rectangleIndexes) {
3085
3170
  const arr = ref[direction];
3086
3171
  const index = refArray.indexOf(ref);
3087
- if ((index === 0 && direction === Direction.left) || (index === refArray.length - 1 && direction === Direction.right))
3172
+ if ((index === 0 && direction === 'before') || (index === refArray.length - 1 && direction === 'after'))
3088
3173
  return;
3089
3174
  for (let i = 0; i < arr.length; i++) {
3090
3175
  if (Math.abs(arr[i].distance - distance) < 0.1) {
@@ -3094,22 +3179,29 @@ class ReactionManager {
3094
3179
  }
3095
3180
  }
3096
3181
  }
3097
- function getLinePoints(leftRectangle, rightRectangle) {
3098
- const verticalY = [
3099
- leftRectangle.y,
3100
- leftRectangle.y + leftRectangle.height,
3101
- rightRectangle.y,
3102
- rightRectangle.y + rightRectangle.height
3103
- ];
3104
- const sortArr = verticalY.sort((a, b) => a - b);
3105
- const y = (sortArr[1] + sortArr[2]) / 2;
3106
- const line = [
3107
- [leftRectangle.x + leftRectangle.width + 2, y],
3108
- [rightRectangle.x - 2, y]
3182
+ function getLinePoints(beforeRectangle, afterRectangle) {
3183
+ const oppositeAxis = axis === 'x' ? 'y' : 'x';
3184
+ const oppositeSide = side === 'width' ? 'height' : 'width';
3185
+ const align = [
3186
+ beforeRectangle[oppositeAxis],
3187
+ beforeRectangle[oppositeAxis] + beforeRectangle[oppositeSide],
3188
+ afterRectangle[oppositeAxis],
3189
+ afterRectangle[oppositeAxis] + afterRectangle[oppositeSide]
3109
3190
  ];
3110
- return line;
3191
+ const sortArr = align.sort((a, b) => a - b);
3192
+ const average = (sortArr[1] + sortArr[2]) / 2;
3193
+ const offset = 3;
3194
+ return isHorizontal
3195
+ ? [
3196
+ [beforeRectangle.x + beforeRectangle.width + offset, average],
3197
+ [afterRectangle.x - offset, average]
3198
+ ]
3199
+ : [
3200
+ [average, beforeRectangle.y + beforeRectangle.height + offset],
3201
+ [average, afterRectangle.y - offset]
3202
+ ];
3111
3203
  }
3112
- return { deltaX, distributeLines };
3204
+ return { delta, distributeLines };
3113
3205
  }
3114
3206
  drawAlignLines(lines, g) {
3115
3207
  lines.forEach(points => {
@@ -3124,32 +3216,43 @@ class ReactionManager {
3124
3216
  });
3125
3217
  }
3126
3218
  drawDistributeLines(lines, g) {
3127
- lines.forEach(points => {
3128
- if (!points.length)
3219
+ lines.forEach(line => {
3220
+ if (!line.length)
3129
3221
  return;
3130
- if (points[0][1] === points[1][1]) {
3131
- const yAlign = PlaitBoard.getRoughSVG(this.board).line(points[0][0], points[0][1], points[1][0], points[1][1], {
3132
- stroke: SELECTION_BORDER_COLOR,
3133
- strokeWidth: 1
3134
- });
3135
- const bar1 = PlaitBoard.getRoughSVG(this.board).line(points[0][0], points[0][1] - 4, points[0][0], points[1][1] + 4, {
3136
- stroke: SELECTION_BORDER_COLOR,
3137
- strokeWidth: 1
3138
- });
3139
- const bar2 = PlaitBoard.getRoughSVG(this.board).line(points[1][0], points[0][1] - 4, points[1][0], points[1][1] + 4, {
3222
+ let isHorizontal = line[0][1] === line[1][1];
3223
+ const yAlign = PlaitBoard.getRoughSVG(this.board).line(line[0][0], line[0][1], line[1][0], line[1][1], {
3224
+ stroke: SELECTION_BORDER_COLOR,
3225
+ strokeWidth: 1
3226
+ });
3227
+ g.appendChild(yAlign);
3228
+ line.forEach(point => {
3229
+ const barPoint = getBarPoint(point, isHorizontal);
3230
+ const bar = PlaitBoard.getRoughSVG(this.board).line(barPoint[0][0], barPoint[0][1], barPoint[1][0], barPoint[1][1], {
3140
3231
  stroke: SELECTION_BORDER_COLOR,
3141
3232
  strokeWidth: 1
3142
3233
  });
3143
- g.appendChild(yAlign);
3144
- g.appendChild(bar1);
3145
- g.appendChild(bar2);
3146
- }
3234
+ g.appendChild(bar);
3235
+ });
3147
3236
  });
3148
3237
  }
3149
3238
  }
3150
3239
  function isHorizontalCross(rectangle, other) {
3151
3240
  return !(rectangle.y + rectangle.height < other.y || rectangle.y > other.y + other.height);
3152
3241
  }
3242
+ function isVerticalCross(rectangle, other) {
3243
+ return !(rectangle.x + rectangle.width < other.x || rectangle.x > other.x + other.width);
3244
+ }
3245
+ function getBarPoint(point, isHorizontal) {
3246
+ return isHorizontal
3247
+ ? [
3248
+ [point[0], point[1] - 4],
3249
+ [point[0], point[1] + 4]
3250
+ ]
3251
+ : [
3252
+ [point[0] - 4, point[1]],
3253
+ [point[0] + 4, point[1]]
3254
+ ];
3255
+ }
3153
3256
 
3154
3257
  function withMoving(board) {
3155
3258
  const { pointerDown, pointerMove, globalPointerUp, globalPointerMove } = board;
@@ -3190,13 +3293,13 @@ function withMoving(board) {
3190
3293
  const endPoint = transformPoint(board, toPoint(event.x, event.y, host));
3191
3294
  offsetX = endPoint[0] - startPoint[0];
3192
3295
  offsetY = endPoint[1] - startPoint[1];
3193
- const offsetBuffer = 5;
3194
- if (Math.abs(offsetX) > offsetBuffer || Math.abs(offsetY) > offsetBuffer || getMovingElements(board).length > 0) {
3296
+ const tolerance = 5;
3297
+ if (Math.abs(offsetX) > tolerance || Math.abs(offsetY) > tolerance || getMovingElements(board).length > 0) {
3195
3298
  throttleRAF(() => {
3196
3299
  const activeElementsRectangle = getRectangleByElements(board, activeElements, true);
3197
3300
  activeElementsRectangle.x += offsetX;
3198
3301
  activeElementsRectangle.y += offsetY;
3199
- const reactionManager = new ReactionManager(board, activeElements, activeElementsRectangle);
3302
+ const reactionManager = new AlignReaction(board, activeElements, activeElementsRectangle);
3200
3303
  const ref = reactionManager.handleAlign();
3201
3304
  offsetX -= ref.deltaX;
3202
3305
  offsetY -= ref.deltaY;
@@ -3361,7 +3464,9 @@ const withHotkey = (board) => {
3361
3464
  return;
3362
3465
  }
3363
3466
  const selectedElements = getSelectedElements(board);
3364
- if (!PlaitBoard.isReadonly(board) && selectedElements.length > 0 && (hotkeys.isDeleteBackward(event) || hotkeys.isDeleteForward(event))) {
3467
+ if (!PlaitBoard.isReadonly(board) &&
3468
+ selectedElements.length > 0 &&
3469
+ (hotkeys.isDeleteBackward(event) || hotkeys.isDeleteForward(event))) {
3365
3470
  event.preventDefault();
3366
3471
  board.deleteFragment(null);
3367
3472
  }
@@ -3489,14 +3594,15 @@ class PlaitElementComponent {
3489
3594
  this.board.destroyElement(this.getContext());
3490
3595
  }
3491
3596
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitElementComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
3492
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: PlaitElementComponent, selector: "plait-element", inputs: { index: "index", element: "element", parent: "parent", board: "board", effect: "effect", parentG: "parentG" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3597
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: PlaitElementComponent, isStandalone: true, selector: "plait-element", inputs: { index: "index", element: "element", parent: "parent", board: "board", effect: "effect", parentG: "parentG" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3493
3598
  }
3494
3599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitElementComponent, decorators: [{
3495
3600
  type: Component,
3496
3601
  args: [{
3497
3602
  selector: 'plait-element',
3498
3603
  template: '',
3499
- changeDetection: ChangeDetectionStrategy.OnPush
3604
+ changeDetection: ChangeDetectionStrategy.OnPush,
3605
+ standalone: true
3500
3606
  }]
3501
3607
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }]; }, propDecorators: { index: [{
3502
3608
  type: Input
@@ -3512,7 +3618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3512
3618
  type: Input
3513
3619
  }] } });
3514
3620
 
3515
- class PlaitChildrenElement {
3621
+ class PlaitChildrenElementComponent {
3516
3622
  constructor() {
3517
3623
  this.trackBy = (index, element) => {
3518
3624
  return element.id;
@@ -3526,8 +3632,8 @@ class PlaitChildrenElement {
3526
3632
  this.parentG = PlaitBoard.getElementHost(this.board);
3527
3633
  }
3528
3634
  }
3529
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitChildrenElement, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3530
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: PlaitChildrenElement, selector: "plait-children", inputs: { board: "board", parent: "parent", effect: "effect", parentG: "parentG" }, ngImport: i0, template: `
3635
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitChildrenElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3636
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: PlaitChildrenElementComponent, isStandalone: true, selector: "plait-children", inputs: { board: "board", parent: "parent", effect: "effect", parentG: "parentG" }, ngImport: i0, template: `
3531
3637
  <plait-element
3532
3638
  *ngFor="let item of parent.children; let index = index; trackBy: trackBy"
3533
3639
  [index]="index"
@@ -3537,9 +3643,9 @@ class PlaitChildrenElement {
3537
3643
  [effect]="effect"
3538
3644
  [parentG]="parentG"
3539
3645
  ></plait-element>
3540
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PlaitElementComponent, selector: "plait-element", inputs: ["index", "element", "parent", "board", "effect", "parentG"] }] }); }
3646
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PlaitElementComponent, selector: "plait-element", inputs: ["index", "element", "parent", "board", "effect", "parentG"] }] }); }
3541
3647
  }
3542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitChildrenElement, decorators: [{
3648
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitChildrenElementComponent, decorators: [{
3543
3649
  type: Component,
3544
3650
  args: [{
3545
3651
  selector: 'plait-children',
@@ -3553,7 +3659,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3553
3659
  [effect]="effect"
3554
3660
  [parentG]="parentG"
3555
3661
  ></plait-element>
3556
- `
3662
+ `,
3663
+ standalone: true,
3664
+ imports: [NgFor, PlaitElementComponent]
3557
3665
  }]
3558
3666
  }], ctorParameters: function () { return []; }, propDecorators: { board: [{
3559
3667
  type: Input
@@ -3877,7 +3985,7 @@ class PlaitBoardComponent {
3877
3985
  });
3878
3986
  }
3879
3987
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitBoardComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
3880
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: PlaitBoardComponent, selector: "plait-board", inputs: { plaitValue: "plaitValue", plaitViewport: "plaitViewport", plaitPlugins: "plaitPlugins", plaitOptions: "plaitOptions", plaitTheme: "plaitTheme" }, outputs: { plaitChange: "plaitChange", plaitBoardInitialized: "plaitBoardInitialized" }, host: { properties: { "class": "this.hostClass", "class.readonly": "this.readonly", "class.focused": "this.isFocused", "class.disabled-scroll": "this.disabledScrollOnNonFocus" } }, providers: [PlaitContextService], queries: [{ propertyName: "islands", predicate: PlaitIslandBaseComponent, descendants: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, static: true }, { propertyName: "viewportContainer", first: true, predicate: ["viewportContainer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
3988
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: PlaitBoardComponent, isStandalone: true, selector: "plait-board", inputs: { plaitValue: "plaitValue", plaitViewport: "plaitViewport", plaitPlugins: "plaitPlugins", plaitOptions: "plaitOptions", plaitTheme: "plaitTheme" }, outputs: { plaitChange: "plaitChange", plaitBoardInitialized: "plaitBoardInitialized" }, host: { properties: { "class": "this.hostClass", "class.readonly": "this.readonly", "class.focused": "this.isFocused", "class.disabled-scroll": "this.disabledScrollOnNonFocus" } }, providers: [PlaitContextService], queries: [{ propertyName: "islands", predicate: PlaitIslandBaseComponent, descendants: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, static: true }, { propertyName: "viewportContainer", first: true, predicate: ["viewportContainer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
3881
3989
  <div class="viewport-container" #viewportContainer>
3882
3990
  <svg #svg width="100%" height="100%" style="position: relative;" class="board-host-svg">
3883
3991
  <g class="element-host"></g>
@@ -3887,7 +3995,7 @@ class PlaitBoardComponent {
3887
3995
  <plait-children [board]="board" [effect]="effect"></plait-children>
3888
3996
  </div>
3889
3997
  <ng-content></ng-content>
3890
- `, isInline: true, dependencies: [{ kind: "component", type: PlaitChildrenElement, selector: "plait-children", inputs: ["board", "parent", "effect", "parentG"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3998
+ `, isInline: true, dependencies: [{ kind: "component", type: PlaitChildrenElementComponent, selector: "plait-children", inputs: ["board", "parent", "effect", "parentG"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3891
3999
  }
3892
4000
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitBoardComponent, decorators: [{
3893
4001
  type: Component,
@@ -3905,7 +4013,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3905
4013
  <ng-content></ng-content>
3906
4014
  `,
3907
4015
  changeDetection: ChangeDetectionStrategy.OnPush,
3908
- providers: [PlaitContextService]
4016
+ providers: [PlaitContextService],
4017
+ standalone: true,
4018
+ imports: [PlaitChildrenElementComponent]
3909
4019
  }]
3910
4020
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { plaitValue: [{
3911
4021
  type: Input
@@ -3944,21 +4054,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3944
4054
  args: [PlaitIslandBaseComponent, { descendants: true }]
3945
4055
  }] } });
3946
4056
 
3947
- const COMPONENTS = [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent];
3948
- class PlaitModule {
3949
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3950
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, declarations: [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent], imports: [CommonModule], exports: [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent] }); }
3951
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, imports: [CommonModule] }); }
3952
- }
3953
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, decorators: [{
3954
- type: NgModule,
3955
- args: [{
3956
- declarations: [...COMPONENTS],
3957
- imports: [CommonModule],
3958
- exports: [...COMPONENTS]
3959
- }]
3960
- }] });
3961
-
3962
4057
  /**
3963
4058
  * 1.create board instance
3964
4059
  * 2.build fake node weak map
@@ -4127,5 +4222,5 @@ function createModModifierKeys() {
4127
4222
  * Generated bundle index. Do not edit.
4128
4223
  */
4129
4224
 
4130
- export { A, ACTIVE_STROKE_WIDTH, ALT, APOSTROPHE, ATTACHED_ELEMENT_CLASS_NAME, AT_SIGN, B, BACKSLASH, BACKSPACE, BOARD_TO_COMPONENT, BOARD_TO_ELEMENT_HOST, BOARD_TO_HOST, BOARD_TO_IS_SELECTION_MOVING, BOARD_TO_MOVING_ELEMENT, BOARD_TO_MOVING_POINT, BOARD_TO_MOVING_POINT_IN_BOARD, BOARD_TO_ON_CHANGE, BOARD_TO_ROUGH_SVG, BOARD_TO_SELECTED_ELEMENT, BOARD_TO_TEMPORARY_ELEMENTS, BOARD_TO_TOUCH_REF, BOARD_TO_VIEWPORT_ORIGINATION, BoardTransforms, C, CAPS_LOCK, CLIP_BOARD_FORMAT_KEY, CLOSE_SQUARE_BRACKET, COMMA, CONTEXT_MENU, CONTROL, ColorfulThemeColor, CoreTransforms, D, DASH, DELETE, DOWN_ARROW, DarkThemeColor, DefaultThemeColor, Direction, E, EIGHT, ELEMENT_TO_COMPONENT, END, ENTER, EQUALS, ESCAPE, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FF_EQUALS, FF_MINUS, FF_MUTE, FF_SEMICOLON, FF_VOLUME_DOWN, FF_VOLUME_UP, FIRST_MEDIA, FIVE, FLUSHING, FOUR, G, H, HOME, HOST_CLASS_NAME, I, INSERT, IS_APPLE, IS_BOARD_CACHE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_MAC, IS_SAFARI, IS_TEXT_EDITABLE, J, K, L, LAST_MEDIA, LEFT_ARROW, M, MAC_ENTER, MAC_META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, MAX_RADIUS, MERGING, META, MUTE, N, NINE, NODE_TO_INDEX, NODE_TO_PARENT, NS, NUMPAD_DIVIDE, NUMPAD_EIGHT, NUMPAD_FIVE, NUMPAD_FOUR, NUMPAD_MINUS, NUMPAD_MULTIPLY, NUMPAD_NINE, NUMPAD_ONE, NUMPAD_PERIOD, NUMPAD_PLUS, NUMPAD_SEVEN, NUMPAD_SIX, NUMPAD_THREE, NUMPAD_TWO, NUMPAD_ZERO, NUM_CENTER, NUM_LOCK, O, ONE, OPEN_SQUARE_BRACKET, P, PAGE_DOWN, PAGE_UP, PATH_REFS, PAUSE, PERIOD, PLUS_SIGN, POINTER_BUTTON, PRESS_AND_MOVE_BUFFER, PRINT_SCREEN, Path, PlaitBoard, PlaitBoardComponent, PlaitChildrenElement, PlaitContextService, PlaitElement, PlaitElementComponent, PlaitHistoryBoard, PlaitIslandBaseComponent, PlaitIslandPopoverBaseComponent, PlaitModule, PlaitNode, PlaitOperation, PlaitPluginElementComponent, PlaitPluginKey, PlaitPointerType, Point, Q, QUESTION_MARK, R, RIGHT_ARROW, RectangleClient, ResizeCursorClass, RetroThemeColor, S, SAVING, SCROLL_BAR_WIDTH, SCROLL_LOCK, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, SELECTION_RECTANGLE_CLASS_NAME, SEMICOLON, SEVEN, SHIFT, SINGLE_QUOTE, SIX, SLASH, SPACE, Selection, SoftThemeColor, StarryThemeColor, T, TAB, THREE, TILDE, TWO, ThemeColorMode, ThemeColors, Transforms, U, UP_ARROW, V, VOLUME_DOWN, VOLUME_UP, Viewport, W, X, Y, Z, ZERO, addMovingElements, addSelectedElement, arrowPoints, cacheMovingElements, cacheSelectedElements, clampZoomLevel, clearNodeWeakMap, clearSelectedElement, clearSelectionMoving, clearViewportOrigination, createFakeEvent, createForeignObject, createG, createKeyboardEvent, createMask, createModModifierKeys, createMouseEvent, createPath, createPointerEvent, createRect, createSVG, createSelectionRectangleG, createTestingBoard, createText, createTouchEvent, debounce, deleteTemporaryElements, depthFirstRecursion, distanceBetweenPointAndPoint, distanceBetweenPointAndRectangle, distanceBetweenPointAndSegment, distanceBetweenPointAndSegments, downloadImage, drawArrow, drawBezierPath, drawCircle, drawLine, drawLinearPath, drawRectangle, drawRoundRectangle, fakeNodeWeakMap, findElements, getBoardRectangle, getClipboardByKey, getClipboardDataByMedia, getDataFromClipboard, getElementById, getElementHostBBox, getHitElementOfRoot, getHitElements, getIsRecursionFunc, getMovingElements, getNearestPointBetweenPointAndSegment, getNearestPointBetweenPointAndSegments, getRealScrollBarWidth, getRectangleByElements, getSelectedElements, getTemporaryElements, getTemporaryRef, getTextFromClipboard, getViewBox, getViewBoxCenterPoint, getViewportContainerRect, getViewportOrigination, handleTouchTarget, hasBeforeContextChange, hasInputOrTextareaTarget, hasOnBoardChange, hasOnContextChanged, hotkeys, idCreator, initializeViewBox, initializeViewportContainer, initializeViewportOffset, inverse, isDOMElement, isDOMNode, isFromScrolling, isFromViewportChange, isHitElements, isInPlaitBoard, isLineHitLine, isMainPointer, isNullOrUndefined, isPointInEllipse, isPointInPolygon, isPointInRoundRectangle, isPolylineHitRectangle, isPreventTouchMove, isSecondaryPointer, isSelectedElement, isSelectionMoving, isSetViewportOperation, normalizePoint, preventTouchMove, removeMovingElements, removeSelectedElement, rotate, scrollToRectangle, setClipboardData, setClipboardDataByMedia, setClipboardDataByText, setIsFromScrolling, setIsFromViewportChange, setPathStrokeLinecap, setSVGViewBox, setSelectionMoving, setStrokeLinecap, shouldClear, shouldMerge, shouldSave, throttleRAF, toImage, toPoint, transformPoint, transformPoints, updateForeignObject, updateForeignObjectWidth, updateViewportContainerScroll, updateViewportOffset, updateViewportOrigination, withMoving, withOptions, withSelection };
4225
+ export { A, ACTIVE_STROKE_WIDTH, ALT, APOSTROPHE, ATTACHED_ELEMENT_CLASS_NAME, AT_SIGN, B, BACKSLASH, BACKSPACE, BOARD_TO_COMPONENT, BOARD_TO_ELEMENT_HOST, BOARD_TO_HOST, BOARD_TO_IS_SELECTION_MOVING, BOARD_TO_MOVING_ELEMENT, BOARD_TO_MOVING_POINT, BOARD_TO_MOVING_POINT_IN_BOARD, BOARD_TO_ON_CHANGE, BOARD_TO_ROUGH_SVG, BOARD_TO_SELECTED_ELEMENT, BOARD_TO_TEMPORARY_ELEMENTS, BOARD_TO_TOUCH_REF, BOARD_TO_VIEWPORT_ORIGINATION, BoardTransforms, C, CAPS_LOCK, CLIP_BOARD_FORMAT_KEY, CLOSE_SQUARE_BRACKET, COMMA, CONTEXT_MENU, CONTROL, ColorfulThemeColor, CoreTransforms, D, DASH, DELETE, DOWN_ARROW, DarkThemeColor, DefaultThemeColor, Direction, E, EIGHT, ELEMENT_TO_COMPONENT, END, ENTER, EQUALS, ESCAPE, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FF_EQUALS, FF_MINUS, FF_MUTE, FF_SEMICOLON, FF_VOLUME_DOWN, FF_VOLUME_UP, FIRST_MEDIA, FIVE, FLUSHING, FOUR, G, H, HOME, HOST_CLASS_NAME, I, INSERT, IS_APPLE, IS_BOARD_CACHE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_MAC, IS_SAFARI, IS_TEXT_EDITABLE, J, K, L, LAST_MEDIA, LEFT_ARROW, M, MAC_ENTER, MAC_META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, MAX_RADIUS, MERGING, META, MUTE, N, NINE, NODE_TO_INDEX, NODE_TO_PARENT, NS, NUMPAD_DIVIDE, NUMPAD_EIGHT, NUMPAD_FIVE, NUMPAD_FOUR, NUMPAD_MINUS, NUMPAD_MULTIPLY, NUMPAD_NINE, NUMPAD_ONE, NUMPAD_PERIOD, NUMPAD_PLUS, NUMPAD_SEVEN, NUMPAD_SIX, NUMPAD_THREE, NUMPAD_TWO, NUMPAD_ZERO, NUM_CENTER, NUM_LOCK, O, ONE, OPEN_SQUARE_BRACKET, P, PAGE_DOWN, PAGE_UP, PATH_REFS, PAUSE, PERIOD, PLUS_SIGN, POINTER_BUTTON, PRESS_AND_MOVE_BUFFER, PRINT_SCREEN, Path, PlaitBoard, PlaitBoardComponent, PlaitChildrenElementComponent, PlaitContextService, PlaitElement, PlaitElementComponent, PlaitHistoryBoard, PlaitIslandBaseComponent, PlaitIslandPopoverBaseComponent, PlaitNode, PlaitOperation, PlaitPluginElementComponent, PlaitPluginKey, PlaitPointerType, Point, Q, QUESTION_MARK, R, RIGHT_ARROW, RectangleClient, ResizeCursorClass, RetroThemeColor, S, SAVING, SCROLL_BAR_WIDTH, SCROLL_LOCK, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, SELECTION_RECTANGLE_CLASS_NAME, SEMICOLON, SEVEN, SHIFT, SINGLE_QUOTE, SIX, SLASH, SPACE, Selection, SoftThemeColor, StarryThemeColor, T, TAB, THREE, TILDE, TWO, ThemeColorMode, ThemeColors, Transforms, U, UP_ARROW, V, VOLUME_DOWN, VOLUME_UP, Viewport, W, X, Y, Z, ZERO, addMovingElements, addSelectedElement, arrowPoints, cacheMovingElements, cacheSelectedElements, clampZoomLevel, clearNodeWeakMap, clearSelectedElement, clearSelectionMoving, clearViewportOrigination, createFakeEvent, createForeignObject, createG, createKeyboardEvent, createMask, createModModifierKeys, createMouseEvent, createPath, createPointerEvent, createRect, createSVG, createSelectionRectangleG, createTestingBoard, createText, createTouchEvent, debounce, deleteTemporaryElements, depthFirstRecursion, distanceBetweenPointAndPoint, distanceBetweenPointAndRectangle, distanceBetweenPointAndSegment, distanceBetweenPointAndSegments, downloadImage, drawArrow, drawBezierPath, drawCircle, drawLine, drawLinearPath, drawRectangle, drawRoundRectangle, fakeNodeWeakMap, findElements, getBoardRectangle, getClipboardByKey, getClipboardDataByMedia, getDataFromClipboard, getElementById, getElementHostBBox, getHitElementOfRoot, getHitElements, getIsRecursionFunc, getMovingElements, getNearestPointBetweenPointAndSegment, getNearestPointBetweenPointAndSegments, getRealScrollBarWidth, getRectangleByElements, getSelectedElements, getTemporaryElements, getTemporaryRef, getTextFromClipboard, getViewBox, getViewBoxCenterPoint, getViewportContainerRect, getViewportOrigination, handleTouchTarget, hasBeforeContextChange, hasInputOrTextareaTarget, hasOnBoardChange, hasOnContextChanged, hotkeys, idCreator, initializeViewBox, initializeViewportContainer, initializeViewportOffset, inverse, isDOMElement, isDOMNode, isFromScrolling, isFromViewportChange, isHitElements, isInPlaitBoard, isLineHitLine, isMainPointer, isNullOrUndefined, isPointInEllipse, isPointInPolygon, isPointInRoundRectangle, isPolylineHitRectangle, isPreventTouchMove, isSecondaryPointer, isSelectedElement, isSelectionMoving, isSetViewportOperation, normalizePoint, preventTouchMove, removeMovingElements, removeSelectedElement, rotate, scrollToRectangle, setClipboardData, setClipboardDataByMedia, setClipboardDataByText, setIsFromScrolling, setIsFromViewportChange, setPathStrokeLinecap, setSVGViewBox, setSelectionMoving, setStrokeLinecap, shouldClear, shouldMerge, shouldSave, throttleRAF, toImage, toPoint, transformPoint, transformPoints, updateForeignObject, updateForeignObjectWidth, updateViewportContainerScroll, updateViewportOffset, updateViewportOrigination, withMoving, withOptions, withSelection };
4131
4226
  //# sourceMappingURL=plait-core.mjs.map