@plait/core 0.24.0-next.12 → 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 +3 -3
  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 +3 -3
  29. package/esm2022/utils/to-image.mjs +106 -34
  30. package/esm2022/utils/tree.mjs +2 -2
  31. package/fesm2022/plait-core.mjs +142 -78
  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 +1 -1
  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);
@@ -3227,7 +3299,7 @@ function withMoving(board) {
3227
3299
  const activeElementsRectangle = getRectangleByElements(board, activeElements, true);
3228
3300
  activeElementsRectangle.x += offsetX;
3229
3301
  activeElementsRectangle.y += offsetY;
3230
- const reactionManager = new ReactionManager(board, activeElements, activeElementsRectangle);
3302
+ const reactionManager = new AlignReaction(board, activeElements, activeElementsRectangle);
3231
3303
  const ref = reactionManager.handleAlign();
3232
3304
  offsetX -= ref.deltaX;
3233
3305
  offsetY -= ref.deltaY;
@@ -3392,7 +3464,9 @@ const withHotkey = (board) => {
3392
3464
  return;
3393
3465
  }
3394
3466
  const selectedElements = getSelectedElements(board);
3395
- 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))) {
3396
3470
  event.preventDefault();
3397
3471
  board.deleteFragment(null);
3398
3472
  }
@@ -3520,14 +3594,15 @@ class PlaitElementComponent {
3520
3594
  this.board.destroyElement(this.getContext());
3521
3595
  }
3522
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 }); }
3523
- 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 }); }
3524
3598
  }
3525
3599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitElementComponent, decorators: [{
3526
3600
  type: Component,
3527
3601
  args: [{
3528
3602
  selector: 'plait-element',
3529
3603
  template: '',
3530
- changeDetection: ChangeDetectionStrategy.OnPush
3604
+ changeDetection: ChangeDetectionStrategy.OnPush,
3605
+ standalone: true
3531
3606
  }]
3532
3607
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }]; }, propDecorators: { index: [{
3533
3608
  type: Input
@@ -3543,7 +3618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3543
3618
  type: Input
3544
3619
  }] } });
3545
3620
 
3546
- class PlaitChildrenElement {
3621
+ class PlaitChildrenElementComponent {
3547
3622
  constructor() {
3548
3623
  this.trackBy = (index, element) => {
3549
3624
  return element.id;
@@ -3557,8 +3632,8 @@ class PlaitChildrenElement {
3557
3632
  this.parentG = PlaitBoard.getElementHost(this.board);
3558
3633
  }
3559
3634
  }
3560
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitChildrenElement, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3561
- 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: `
3562
3637
  <plait-element
3563
3638
  *ngFor="let item of parent.children; let index = index; trackBy: trackBy"
3564
3639
  [index]="index"
@@ -3568,9 +3643,9 @@ class PlaitChildrenElement {
3568
3643
  [effect]="effect"
3569
3644
  [parentG]="parentG"
3570
3645
  ></plait-element>
3571
- `, 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"] }] }); }
3572
3647
  }
3573
- 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: [{
3574
3649
  type: Component,
3575
3650
  args: [{
3576
3651
  selector: 'plait-children',
@@ -3584,7 +3659,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3584
3659
  [effect]="effect"
3585
3660
  [parentG]="parentG"
3586
3661
  ></plait-element>
3587
- `
3662
+ `,
3663
+ standalone: true,
3664
+ imports: [NgFor, PlaitElementComponent]
3588
3665
  }]
3589
3666
  }], ctorParameters: function () { return []; }, propDecorators: { board: [{
3590
3667
  type: Input
@@ -3908,7 +3985,7 @@ class PlaitBoardComponent {
3908
3985
  });
3909
3986
  }
3910
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 }); }
3911
- 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: `
3912
3989
  <div class="viewport-container" #viewportContainer>
3913
3990
  <svg #svg width="100%" height="100%" style="position: relative;" class="board-host-svg">
3914
3991
  <g class="element-host"></g>
@@ -3918,7 +3995,7 @@ class PlaitBoardComponent {
3918
3995
  <plait-children [board]="board" [effect]="effect"></plait-children>
3919
3996
  </div>
3920
3997
  <ng-content></ng-content>
3921
- `, 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 }); }
3922
3999
  }
3923
4000
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitBoardComponent, decorators: [{
3924
4001
  type: Component,
@@ -3936,7 +4013,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3936
4013
  <ng-content></ng-content>
3937
4014
  `,
3938
4015
  changeDetection: ChangeDetectionStrategy.OnPush,
3939
- providers: [PlaitContextService]
4016
+ providers: [PlaitContextService],
4017
+ standalone: true,
4018
+ imports: [PlaitChildrenElementComponent]
3940
4019
  }]
3941
4020
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { plaitValue: [{
3942
4021
  type: Input
@@ -3975,21 +4054,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
3975
4054
  args: [PlaitIslandBaseComponent, { descendants: true }]
3976
4055
  }] } });
3977
4056
 
3978
- const COMPONENTS = [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent];
3979
- class PlaitModule {
3980
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3981
- 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] }); }
3982
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, imports: [CommonModule] }); }
3983
- }
3984
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: PlaitModule, decorators: [{
3985
- type: NgModule,
3986
- args: [{
3987
- declarations: [...COMPONENTS],
3988
- imports: [CommonModule],
3989
- exports: [...COMPONENTS]
3990
- }]
3991
- }] });
3992
-
3993
4057
  /**
3994
4058
  * 1.create board instance
3995
4059
  * 2.build fake node weak map
@@ -4158,5 +4222,5 @@ function createModModifierKeys() {
4158
4222
  * Generated bundle index. Do not edit.
4159
4223
  */
4160
4224
 
4161
- 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 };
4162
4226
  //# sourceMappingURL=plait-core.mjs.map