@plait/draw 0.70.0 → 0.72.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.
Files changed (83) hide show
  1. package/arrow-line.component.d.ts +1 -1
  2. package/constants/default.d.ts +1 -0
  3. package/constants/geometry.d.ts +5 -5
  4. package/constants/index.d.ts +1 -0
  5. package/constants/pointer.d.ts +3 -3
  6. package/engines/table/table.d.ts +2 -2
  7. package/engines/uml/combined-fragment.d.ts +2 -2
  8. package/engines/uml/package.d.ts +2 -2
  9. package/esm2022/arrow-line.component.mjs +13 -13
  10. package/esm2022/constants/default.mjs +2 -0
  11. package/esm2022/constants/geometry.mjs +8 -8
  12. package/esm2022/constants/index.mjs +2 -1
  13. package/esm2022/constants/pointer.mjs +4 -4
  14. package/esm2022/engines/table/table.mjs +3 -3
  15. package/esm2022/engines/uml/combined-fragment.mjs +5 -5
  16. package/esm2022/engines/uml/package.mjs +5 -5
  17. package/esm2022/generators/geometry-shape.generator.mjs +6 -5
  18. package/esm2022/generators/single-text.generator.mjs +3 -3
  19. package/esm2022/generators/table.generator.mjs +6 -5
  20. package/esm2022/generators/text.generator.mjs +25 -21
  21. package/esm2022/geometry.component.mjs +4 -5
  22. package/esm2022/interfaces/arrow-line.mjs +1 -1
  23. package/esm2022/interfaces/element.mjs +1 -7
  24. package/esm2022/interfaces/geometry.mjs +6 -6
  25. package/esm2022/interfaces/index.mjs +13 -1
  26. package/esm2022/interfaces/options.mjs +2 -0
  27. package/esm2022/interfaces/vector-line.mjs +5 -5
  28. package/esm2022/plugins/with-arrow-line-text.mjs +2 -2
  29. package/esm2022/plugins/with-draw-fragment.mjs +8 -12
  30. package/esm2022/plugins/with-draw-hotkey.mjs +3 -3
  31. package/esm2022/plugins/with-draw-resize.mjs +11 -6
  32. package/esm2022/plugins/with-draw-rotate.mjs +3 -2
  33. package/esm2022/plugins/with-draw.mjs +10 -11
  34. package/esm2022/plugins/with-vector-line-create.mjs +123 -0
  35. package/esm2022/plugins/with-vector-line-resize.mjs +3 -3
  36. package/esm2022/table.component.mjs +8 -9
  37. package/esm2022/transforms/index.mjs +3 -3
  38. package/esm2022/transforms/multi-text-geometry-text.mjs +3 -3
  39. package/esm2022/utils/arrow-line/arrow-line-basic.mjs +6 -5
  40. package/esm2022/utils/clipboard.mjs +6 -17
  41. package/esm2022/utils/common.mjs +15 -8
  42. package/esm2022/utils/geometry.mjs +3 -3
  43. package/esm2022/utils/hit.mjs +21 -19
  44. package/esm2022/utils/index.mjs +2 -1
  45. package/esm2022/utils/multi-text-geometry.mjs +3 -3
  46. package/esm2022/utils/selected.mjs +9 -1
  47. package/esm2022/utils/snap-resizing.mjs +1 -1
  48. package/esm2022/utils/style/stroke.mjs +7 -17
  49. package/esm2022/utils/table.mjs +2 -2
  50. package/esm2022/utils/vector-line.mjs +6 -10
  51. package/esm2022/vector-line.component.mjs +2 -4
  52. package/fesm2022/plait-draw.mjs +259 -318
  53. package/fesm2022/plait-draw.mjs.map +1 -1
  54. package/generators/single-text.generator.d.ts +2 -2
  55. package/generators/text.generator.d.ts +11 -11
  56. package/interfaces/arrow-line.d.ts +1 -1
  57. package/interfaces/element.d.ts +0 -5
  58. package/interfaces/geometry.d.ts +11 -10
  59. package/interfaces/index.d.ts +4 -1
  60. package/interfaces/options.d.ts +4 -0
  61. package/interfaces/vector-line.d.ts +4 -4
  62. package/package.json +1 -1
  63. package/plugins/with-vector-line-create.d.ts +2 -0
  64. package/styles/styles.scss +1 -1
  65. package/table.component.d.ts +2 -2
  66. package/transforms/common.d.ts +1 -1
  67. package/transforms/geometry.d.ts +1 -1
  68. package/transforms/index.d.ts +3 -3
  69. package/transforms/multi-text-geometry-text.d.ts +2 -2
  70. package/utils/clipboard.d.ts +10 -3
  71. package/utils/common.d.ts +5 -3
  72. package/utils/geometry.d.ts +6 -6
  73. package/utils/hit.d.ts +8 -4
  74. package/utils/index.d.ts +1 -0
  75. package/utils/multi-text-geometry.d.ts +6 -10
  76. package/utils/selected.d.ts +3 -1
  77. package/utils/snap-resizing.d.ts +2 -2
  78. package/utils/style/stroke.d.ts +1 -2
  79. package/utils/vector-line.d.ts +0 -1
  80. package/esm2022/plugins/with-geometry-resize.mjs +0 -70
  81. package/esm2022/plugins/with-vector-pen-create.mjs +0 -123
  82. package/plugins/with-geometry-resize.d.ts +0 -2
  83. package/plugins/with-vector-pen-create.d.ts +0 -2
@@ -1,10 +1,10 @@
1
1
  import { PlaitBoard, PlaitElement } from '@plait/core';
2
2
  import { PlaitGeometry } from '../interfaces';
3
- import { PlaitDrawShapeText, TextGenerator, TextGeneratorOptions } from './text.generator';
3
+ import { DrawTextInfo, TextGenerator, TextGeneratorOptions } from './text.generator';
4
4
  import { ParagraphElement } from '@plait/common';
5
5
  export declare class SingleTextGenerator<T extends PlaitElement = PlaitGeometry> extends TextGenerator<T> {
6
6
  get textManage(): import("@plait/common").TextManage;
7
7
  constructor(board: PlaitBoard, element: T, text: ParagraphElement, options: TextGeneratorOptions<T>);
8
- update(element: T, previousDrawShapeTexts: PlaitDrawShapeText[], currentDrawShapeTexts: PlaitDrawShapeText[], elementG: SVGElement): void;
8
+ update(element: T, previousDrawShapeTexts: DrawTextInfo[], currentDrawShapeTexts: DrawTextInfo[], elementG: SVGElement): void;
9
9
  update(element: T, previousText: ParagraphElement, currentText: ParagraphElement, elementG: SVGElement): void;
10
10
  }
@@ -1,43 +1,43 @@
1
1
  import { ParagraphElement, TextManage, TextManageChangeData } from '@plait/common';
2
2
  import { PlaitBoard, PlaitElement, RectangleClient } from '@plait/core';
3
3
  import { DrawShapes, EngineExtraData, PlaitGeometry } from '../interfaces';
4
- export interface PlaitDrawShapeText extends EngineExtraData {
5
- key: string;
4
+ export interface DrawTextInfo extends EngineExtraData {
5
+ id: string;
6
6
  text: ParagraphElement;
7
7
  textHeight: number;
8
8
  board?: PlaitBoard;
9
9
  }
10
10
  export interface TextGeneratorOptions<T> {
11
- onChange: (element: T, textChangeRef: TextManageChangeData, text: PlaitDrawShapeText) => void;
12
- getRenderRectangle?: (element: T, text: PlaitDrawShapeText) => RectangleClient;
11
+ onChange: (element: T, textChangeRef: TextManageChangeData, text: DrawTextInfo) => void;
12
+ getRenderRectangle?: (element: T, text: DrawTextInfo) => RectangleClient;
13
13
  getMaxWidth?: () => number;
14
14
  }
15
15
  export declare const KEY_TO_TEXT_MANAGE: WeakMap<PlaitBoard, {
16
16
  [key: string]: TextManage;
17
17
  }>;
18
- export declare const setTextManage: (board: PlaitBoard, key: string, textManage: TextManage) => WeakMap<PlaitBoard, {
18
+ export declare const setTextManage: (board: PlaitBoard, element: PlaitElement, text: DrawTextInfo, textManage: TextManage) => WeakMap<PlaitBoard, {
19
19
  [key: string]: TextManage;
20
20
  }>;
21
- export declare const getTextManage: (board: PlaitBoard, key: string) => TextManage;
21
+ export declare const getTextManage: (board: PlaitBoard, element: PlaitElement | undefined, text: Pick<DrawTextInfo, "id">) => TextManage;
22
22
  export declare const deleteTextManage: (board: PlaitBoard, key: string) => void;
23
23
  export declare class TextGenerator<T extends PlaitElement = PlaitGeometry> {
24
24
  protected board: PlaitBoard;
25
25
  protected element: T;
26
- protected texts: PlaitDrawShapeText[];
26
+ protected texts: DrawTextInfo[];
27
27
  protected options: TextGeneratorOptions<T>;
28
28
  textManages: TextManage[];
29
29
  get shape(): DrawShapes;
30
- constructor(board: PlaitBoard, element: T, texts: PlaitDrawShapeText[], options: TextGeneratorOptions<T>);
30
+ constructor(board: PlaitBoard, element: T, texts: DrawTextInfo[], options: TextGeneratorOptions<T>);
31
31
  initialize(): void;
32
32
  draw(elementG: SVGElement): void;
33
- update(element: T, previousDrawShapeTexts: PlaitDrawShapeText[], currentDrawShapeTexts: PlaitDrawShapeText[], elementG: SVGElement): void;
33
+ update(element: T, previousDrawShapeTexts: DrawTextInfo[], currentDrawShapeTexts: DrawTextInfo[], elementG: SVGElement): void;
34
34
  private createTextManage;
35
- getRectangle(text: PlaitDrawShapeText): {
35
+ getRectangle(text: DrawTextInfo): {
36
36
  height: any;
37
37
  width: number;
38
38
  x: any;
39
39
  y: number;
40
40
  };
41
- getMaxWidth(text: PlaitDrawShapeText): number;
41
+ getMaxWidth(text: DrawTextInfo): number;
42
42
  destroy(): void;
43
43
  }
@@ -1,7 +1,7 @@
1
1
  import { Direction, PlaitBoard, PlaitElement, Point, PointOfRectangle, Vector } from '@plait/core';
2
2
  import { Element } from 'slate';
3
- import { StrokeStyle } from './element';
4
3
  import { PlaitShapeElement } from '.';
4
+ import { StrokeStyle } from '@plait/common';
5
5
  export declare enum ArrowLineMarkerType {
6
6
  arrow = "arrow",
7
7
  none = "none",
@@ -1,8 +1,3 @@
1
- export declare enum StrokeStyle {
2
- solid = "solid",
3
- dashed = "dashed",
4
- dotted = "dotted"
5
- }
6
1
  export declare enum MemorizeKey {
7
2
  basicShape = "basicShape",
8
3
  flowchart = "flowchart",
@@ -1,7 +1,6 @@
1
1
  import { PlaitElement, Point } from '@plait/core';
2
- import { StrokeStyle } from './element';
3
- import { PlaitDrawShapeText } from '../generators/text.generator';
4
- import { ParagraphElement } from '@plait/common';
2
+ import { DrawTextInfo } from '../generators/text.generator';
3
+ import { ParagraphElement, StrokeStyle } from '@plait/common';
5
4
  export declare enum BasicShapes {
6
5
  rectangle = "rectangle",
7
6
  ellipse = "ellipse",
@@ -74,18 +73,18 @@ export declare enum UMLSymbols {
74
73
  providedInterface = "providedInterface",
75
74
  requiredInterface = "requiredInterface"
76
75
  }
77
- export declare enum MultipleTextGeometryCommonTextKeys {
76
+ export declare enum GeometryCommonTextKeys {
78
77
  name = "name",
79
78
  content = "content"
80
79
  }
81
80
  export type GeometryShapes = BasicShapes | FlowchartSymbols | UMLSymbols;
82
81
  export type SwimlaneDirection = 'horizontal' | 'vertical';
83
- export interface PlaitBaseGeometry extends PlaitElement {
84
- type: 'geometry';
85
- points: [Point, Point];
86
- shape: GeometryShapes;
82
+ export interface PlaitBaseGeometry<T extends string = 'geometry', P extends Point[] = [Point, Point], S extends string = GeometryShapes> extends PlaitElement {
83
+ type: T;
84
+ points: P;
85
+ shape: S;
87
86
  }
88
- export interface PlaitCommonGeometry extends PlaitBaseGeometry {
87
+ export interface PlaitCommonGeometry<T extends string = 'geometry', P extends Point[] = [Point, Point], S extends string = GeometryShapes> extends PlaitBaseGeometry<T, P, S> {
89
88
  fill?: string;
90
89
  strokeColor?: string;
91
90
  strokeWidth?: number;
@@ -93,8 +92,10 @@ export interface PlaitCommonGeometry extends PlaitBaseGeometry {
93
92
  angle?: number;
94
93
  opacity?: number;
95
94
  }
95
+ export interface PlaitCustomGeometry<T extends string = string, P extends Point[] = Point[], S extends string = string> extends PlaitBaseGeometry<T, P, S> {
96
+ }
96
97
  export interface PlaitMultipleTextGeometry extends PlaitCommonGeometry {
97
- texts: PlaitDrawShapeText[];
98
+ texts: DrawTextInfo[];
98
99
  }
99
100
  export interface PlaitGeometry extends PlaitCommonGeometry {
100
101
  text?: ParagraphElement;
@@ -1,4 +1,4 @@
1
- import { GeometryShapes, PlaitGeometry } from './geometry';
1
+ import { GeometryShapes, PlaitCustomGeometry, PlaitGeometry } from './geometry';
2
2
  import { PlaitImage } from './image';
3
3
  import { PlaitArrowLine } from './arrow-line';
4
4
  import { PlaitSwimlane, SwimlaneSymbols } from './swimlane';
@@ -6,6 +6,7 @@ import { PlaitBaseTable, PlaitTable, TableSymbols } from './table';
6
6
  import { PlaitText } from './text';
7
7
  import { PlaitVectorLine } from './vector-line';
8
8
  import { PlaitLine } from './line';
9
+ import { PlaitBoard } from '@plait/core';
9
10
  export * from './arrow-line';
10
11
  export * from './geometry';
11
12
  export * from './text';
@@ -14,6 +15,7 @@ export * from './engine';
14
15
  export * from './swimlane';
15
16
  export * from './table';
16
17
  export * from './vector-line';
18
+ export * from './options';
17
19
  export type PlaitDrawElement = PlaitGeometry | PlaitArrowLine | PlaitVectorLine | PlaitImage | PlaitBaseTable | PlaitSwimlane;
18
20
  export type PlaitShapeElement = PlaitGeometry | PlaitImage | PlaitTable | PlaitSwimlane;
19
21
  export type DrawShapes = GeometryShapes | TableSymbols | SwimlaneSymbols;
@@ -26,6 +28,7 @@ export declare const PlaitDrawElement: {
26
28
  isImage: (value: any) => value is PlaitImage;
27
29
  isTable: (value: any) => value is PlaitTable;
28
30
  isDrawElement: (value: any) => value is PlaitDrawElement;
31
+ isCustomGeometryElement: (board: PlaitBoard, value: any) => value is PlaitCustomGeometry;
29
32
  isShapeElement: (value: any) => value is PlaitShapeElement;
30
33
  isBasicShape: (value: any) => boolean;
31
34
  isFlowchart: (value: any) => boolean;
@@ -0,0 +1,4 @@
1
+ import { WithPluginOptions } from "@plait/core";
2
+ export interface WithDrawOptions extends WithPluginOptions {
3
+ customGeometryTypes: string[];
4
+ }
@@ -1,13 +1,13 @@
1
1
  import { Path, PlaitElement, Point } from '@plait/core';
2
- import { StrokeStyle } from './element';
3
- export declare enum VectorPenPointerType {
4
- vectorPen = "vectorPen"
2
+ import { StrokeStyle } from '@plait/common';
3
+ export declare enum VectorLinePointerType {
4
+ vectorLine = "vectorLine"
5
5
  }
6
6
  export declare enum VectorLineShape {
7
7
  straight = "straight",
8
8
  curve = "curve"
9
9
  }
10
- export interface VectorPenRef {
10
+ export interface VectorLineRef {
11
11
  start?: Point;
12
12
  element?: PlaitVectorLine;
13
13
  path?: Path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/draw",
3
- "version": "0.70.0",
3
+ "version": "0.72.0",
4
4
  "peerDependencies": {},
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0"
@@ -0,0 +1,2 @@
1
+ import { PlaitBoard } from '@plait/core';
2
+ export declare const withVectorLineCreateByDraw: (board: PlaitBoard) => PlaitBoard;
@@ -4,7 +4,7 @@
4
4
  cursor: default;
5
5
  }
6
6
  }
7
- &:not(.pointer-text):not(.pointer-selection):not(.pointer-hand):not(.pointer-vectorPen) {
7
+ &:not(.pointer-text):not(.pointer-selection):not(.pointer-hand):not(.pointer-vectorLine) {
8
8
  .board-host-svg {
9
9
  cursor: crosshair;
10
10
  }
@@ -1,7 +1,7 @@
1
1
  import { PlaitBoard, PlaitPluginElementContext, OnContextChanged } from '@plait/core';
2
2
  import { ActiveGenerator, CommonElementFlavour } from '@plait/common';
3
3
  import { PlaitTable, PlaitTableCell } from './interfaces/table';
4
- import { PlaitDrawShapeText, TextGenerator } from './generators/text.generator';
4
+ import { DrawTextInfo, TextGenerator } from './generators/text.generator';
5
5
  import { TableGenerator } from './generators/table.generator';
6
6
  import { ArrowLineAutoCompleteGenerator } from './generators/arrow-line-auto-complete.generator';
7
7
  export declare class TableComponent<T extends PlaitTable> extends CommonElementFlavour<T, PlaitBoard> implements OnContextChanged<T, PlaitBoard> {
@@ -14,7 +14,7 @@ export declare class TableComponent<T extends PlaitTable> extends CommonElementF
14
14
  initialize(): void;
15
15
  draw(): void;
16
16
  rotateVerticalText(): void;
17
- getDrawShapeTexts(cells: PlaitTableCell[]): PlaitDrawShapeText[];
17
+ getDrawShapeTexts(cells: PlaitTableCell[]): DrawTextInfo[];
18
18
  initializeTextManage(): void;
19
19
  onContextChanged(value: PlaitPluginElementContext<T, PlaitBoard>, previous: PlaitPluginElementContext<T, PlaitBoard>): void;
20
20
  destroy(): void;
@@ -1,3 +1,3 @@
1
1
  import { PlaitBoard, Vector, Point } from '@plait/core';
2
2
  import { GeometryShapes, SwimlaneDrawSymbols } from '../interfaces';
3
- export declare const insertDrawByVector: (board: PlaitBoard, point: Point, shape: GeometryShapes | SwimlaneDrawSymbols, vector: Vector) => import("../interfaces").PlaitCommonGeometry | import("../interfaces").PlaitSwimlane | null;
3
+ export declare const insertDrawByVector: (board: PlaitBoard, point: Point, shape: GeometryShapes | SwimlaneDrawSymbols, vector: Vector) => import("../interfaces").PlaitCommonGeometry<"geometry", [Point, Point], GeometryShapes> | import("../interfaces").PlaitSwimlane | null;
@@ -1,7 +1,7 @@
1
1
  import { PlaitBoard, Point, Path } from '@plait/core';
2
2
  import { GeometryShapes } from '../interfaces';
3
3
  import { Element } from 'slate';
4
- export declare const insertGeometry: (board: PlaitBoard, points: [Point, Point], shape: GeometryShapes) => import("../interfaces").PlaitCommonGeometry;
4
+ export declare const insertGeometry: (board: PlaitBoard, points: [Point, Point], shape: GeometryShapes) => import("../interfaces").PlaitCommonGeometry<"geometry", [Point, Point], GeometryShapes>;
5
5
  export declare const insertText: (board: PlaitBoard, point: Point, text: string | Element) => void;
6
6
  export declare const resizeGeometry: (board: PlaitBoard, points: [Point, Point], textHeight: number, path: Path) => void;
7
7
  export declare const switchGeometryShape: (board: PlaitBoard, shape: GeometryShapes) => void;
@@ -1,7 +1,7 @@
1
1
  export declare const DrawTransforms: {
2
2
  setText: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitGeometry, text: import("slate").Element, width: number, textHeight: number) => void;
3
- setDrawShapeText: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitMultipleTextGeometry, text: import("@plait/draw").PlaitDrawShapeText) => void;
4
- insertGeometry: (board: import("@plait/core").PlaitBoard, points: [import("@plait/core").Point, import("@plait/core").Point], shape: import("@plait/draw").GeometryShapes) => import("@plait/draw").PlaitCommonGeometry;
3
+ setDrawTexts: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitMultipleTextGeometry, text: import("@plait/draw").DrawTextInfo) => void;
4
+ insertGeometry: (board: import("@plait/core").PlaitBoard, points: [import("@plait/core").Point, import("@plait/core").Point], shape: import("@plait/draw").GeometryShapes) => import("@plait/draw").PlaitCommonGeometry<"geometry", [import("@plait/core").Point, import("@plait/core").Point], import("@plait/draw").GeometryShapes>;
5
5
  resizeGeometry: (board: import("@plait/core").PlaitBoard, points: [import("@plait/core").Point, import("@plait/core").Point], textHeight: number, path: import("@plait/core").Path) => void;
6
6
  insertText: (board: import("@plait/core").PlaitBoard, point: import("@plait/core").Point, text: string | import("slate").Element) => void;
7
7
  setTextSize: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitGeometry, textWidth: number, textHeight: number) => void;
@@ -21,5 +21,5 @@ export declare const DrawTransforms: {
21
21
  removeSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
22
22
  updateSwimlaneCount: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, count: number) => void;
23
23
  setTableFill: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitBaseTable, fill: string | null, path: import("@plait/core").Path) => void;
24
- insertDrawByVector: (board: import("@plait/core").PlaitBoard, point: import("@plait/core").Point, shape: import("@plait/draw").GeometryShapes | import("@plait/draw").SwimlaneDrawSymbols, vector: import("@plait/core").Vector) => import("@plait/draw").PlaitCommonGeometry | import("@plait/draw").PlaitSwimlane | null;
24
+ insertDrawByVector: (board: import("@plait/core").PlaitBoard, point: import("@plait/core").Point, shape: import("@plait/draw").GeometryShapes | import("@plait/draw").SwimlaneDrawSymbols, vector: import("@plait/core").Vector) => import("@plait/draw").PlaitCommonGeometry<"geometry", [import("@plait/core").Point, import("@plait/core").Point], import("@plait/draw").GeometryShapes> | import("@plait/draw").PlaitSwimlane | null;
25
25
  };
@@ -1,4 +1,4 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
2
  import { PlaitMultipleTextGeometry } from '../interfaces';
3
- import { PlaitDrawShapeText } from '../generators/text.generator';
4
- export declare const setDrawShapeText: (board: PlaitBoard, element: PlaitMultipleTextGeometry, text: PlaitDrawShapeText) => void;
3
+ import { DrawTextInfo } from '../generators/text.generator';
4
+ export declare const setDrawTexts: (board: PlaitBoard, element: PlaitMultipleTextGeometry, text: DrawTextInfo) => void;
@@ -1,4 +1,11 @@
1
- import { PlaitBoard, Point } from '@plait/core';
2
- import { PlaitArrowLine, PlaitDrawElement, PlaitGeometry } from '../interfaces';
3
- export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => (PlaitGeometry | import("../interfaces").PlaitBaseTable | PlaitArrowLine | import("../interfaces").PlaitVectorLine)[];
1
+ import { PlaitBoard, PlaitElement, Point } from '@plait/core';
2
+ import { PlaitDrawElement } from '../interfaces';
3
+ export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => (PlaitElement | {
4
+ points: number[][];
5
+ id: string;
6
+ children?: PlaitElement[];
7
+ type?: string;
8
+ groupId?: string;
9
+ angle?: number;
10
+ })[];
4
11
  export declare const insertClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => void;
package/utils/common.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { PlaitBoard, PlaitElement, Point, RectangleClient } from '@plait/core';
2
- import { DrawShapes, EngineExtraData, PlaitBaseGeometry, PlaitCommonGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
2
+ import { DrawShapes, EngineExtraData, PlaitBaseGeometry, PlaitCommonGeometry, PlaitCustomGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
3
3
  import { Alignment } from '@plait/common';
4
4
  import { Options } from 'roughjs/bin/core';
5
5
  import { PlaitBaseTable } from '../interfaces/table';
6
- import { PlaitDrawShapeText } from '../generators/text.generator';
6
+ import { DrawTextInfo } from '../generators/text.generator';
7
7
  export declare const getTextRectangle: <T extends PlaitElement = PlaitGeometry>(element: T) => {
8
8
  height: any;
9
9
  width: number;
@@ -15,6 +15,7 @@ export declare const insertElement: (board: PlaitBoard, element: PlaitBaseGeomet
15
15
  export declare const isDrawElementIncludeText: (element: PlaitDrawElement) => boolean;
16
16
  export declare const isDrawElementsIncludeText: (elements: PlaitDrawElement[]) => boolean;
17
17
  export declare const isDrawElementClosed: (element: PlaitDrawElement) => boolean;
18
+ export declare const isCustomGeometryClosed: (board: PlaitBoard, value: PlaitElement) => value is PlaitCustomGeometry;
18
19
  export declare const getSnappingShape: (board: PlaitBoard, point: Point) => PlaitShapeElement | null;
19
20
  export declare const getSnappingRef: (board: PlaitBoard, hitElement: PlaitShapeElement, point: Point) => {
20
21
  isHitEdge: boolean;
@@ -29,5 +30,6 @@ export declare const drawBoundReaction: (board: PlaitBoard, element: PlaitShapeE
29
30
  hasMask: boolean;
30
31
  hasConnector: boolean;
31
32
  }) => SVGGElement;
32
- export declare const getTextKey: <T extends PlaitElement = PlaitGeometry>(element: T, text: PlaitDrawShapeText) => string;
33
+ export declare const getTextKey: (element: PlaitElement | undefined, text: Pick<DrawTextInfo, "id">) => string;
33
34
  export declare const getGeometryAlign: (board: PlaitBoard, element: PlaitCommonGeometry | PlaitBaseTable) => Alignment;
35
+ export declare const isClosedPoints: (points: Point[]) => boolean;
@@ -5,7 +5,7 @@ import { DrawPointerType } from '../constants';
5
5
  import { Alignment, CustomText } from '@plait/common';
6
6
  import { Options } from 'roughjs/bin/core';
7
7
  import { PlaitShapeElement } from '../interfaces';
8
- import { PlaitDrawShapeText } from '../generators/text.generator';
8
+ import { DrawTextInfo } from '../generators/text.generator';
9
9
  export type GeometryStyleOptions = Pick<PlaitGeometry, 'fill' | 'strokeColor' | 'strokeWidth'>;
10
10
  export type TextProperties = Partial<CustomText> & {
11
11
  align?: Alignment;
@@ -71,7 +71,7 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
71
71
  width: number;
72
72
  height: number;
73
73
  texts: {
74
- key: import("../interfaces").MultipleTextGeometryCommonTextKeys;
74
+ id: import("../interfaces").GeometryCommonTextKeys;
75
75
  text: string;
76
76
  align: Alignment;
77
77
  }[];
@@ -103,7 +103,7 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
103
103
  width: number;
104
104
  height: number;
105
105
  texts: {
106
- key: import("../interfaces").MultipleTextGeometryCommonTextKeys;
106
+ id: import("../interfaces").GeometryCommonTextKeys;
107
107
  text: string;
108
108
  align: Alignment;
109
109
  }[];
@@ -126,7 +126,7 @@ export declare const createDefaultFlowchart: (point: Point) => (PlaitGeometry |
126
126
  export declare const getAutoCompletePoints: (element: PlaitShapeElement) => [Point, Point, Point, Point];
127
127
  export declare const getHitIndexOfAutoCompletePoint: (movingPoint: Point, points: Point[]) => number;
128
128
  export declare const getDrawDefaultStrokeColor: (theme: ThemeColorMode) => string;
129
- export declare const getFlowchartDefaultFill: (theme: ThemeColorMode) => string;
129
+ export declare const getDefaultFill: (theme: ThemeColorMode) => string;
130
130
  export declare const getTextShapeProperty: (board: PlaitBoard, text?: string | Element, fontSize?: number | string) => {
131
131
  width: number;
132
132
  height: number;
@@ -138,8 +138,8 @@ export declare const getDefaultGeometryProperty: (pointer: DrawPointerType) => {
138
138
  };
139
139
  export declare const getDefaultTextPoints: (board: PlaitBoard, centerPoint: Point, fontSize?: number | string) => [Point, Point];
140
140
  export declare const createTextElement: (board: PlaitBoard, points: [Point, Point], text?: string | Element, textHeight?: number) => PlaitGeometry;
141
- export declare const createDefaultGeometry: (board: PlaitBoard, points: [Point, Point], shape: GeometryShapes) => import("../interfaces").PlaitCommonGeometry;
142
- export declare const editText: (board: PlaitBoard, element: PlaitGeometry, text?: PlaitDrawShapeText) => void;
141
+ export declare const createDefaultGeometry: (board: PlaitBoard, points: [Point, Point], shape: GeometryShapes) => import("../interfaces").PlaitCommonGeometry<"geometry", [Point, Point], GeometryShapes>;
142
+ export declare const editText: (board: PlaitBoard, element: PlaitGeometry, text?: DrawTextInfo) => void;
143
143
  export declare const rerenderGeometryActive: (board: PlaitBoard, element: PlaitGeometry) => void;
144
144
  export declare const isGeometryIncludeText: (element: PlaitGeometry) => boolean;
145
145
  export declare const isSingleTextShape: (shape: GeometryShapes) => boolean;
package/utils/hit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PlaitElement, RectangleClient, Selection, PlaitBoard, Point } from '@plait/core';
2
- import { PlaitArrowLine, PlaitCommonGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement, PlaitVectorLine } from '../interfaces';
2
+ import { PlaitArrowLine, PlaitCommonGeometry, PlaitCustomGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement, PlaitVectorLine } from '../interfaces';
3
3
  export declare const isTextExceedingBounds: (geometry: PlaitGeometry) => boolean;
4
4
  export declare const isHitArrowLineText: (board: PlaitBoard, element: PlaitArrowLine, point: Point) => boolean;
5
5
  export declare const isHitPolyLine: (pathPoints: Point[], point: Point) => boolean;
@@ -8,9 +8,13 @@ export declare const isHitVectorLine: (board: PlaitBoard, element: PlaitVectorLi
8
8
  export declare const isRectangleHitElementText: (element: PlaitCommonGeometry, rectangle: RectangleClient) => boolean;
9
9
  export declare const isHitElementText: (element: PlaitCommonGeometry, point: Point) => boolean;
10
10
  export declare const isRectangleHitDrawElement: (board: PlaitBoard, element: PlaitElement, selection: Selection) => boolean | null;
11
- export declare const getDrawHitElement: (board: PlaitBoard, elements: PlaitDrawElement[]) => PlaitElement;
12
- export declare const getFirstFilledDrawElement: (board: PlaitBoard, elements: PlaitDrawElement[]) => PlaitGeometry | null;
13
- export declare const getFirstTextOrLineElement: (elements: PlaitDrawElement[]) => PlaitArrowLine | import("../interfaces").PlaitText | null;
11
+ export declare const isRectangleHitRotatedElement: (board: PlaitBoard, rectangle: RectangleClient, element: PlaitElement & {
12
+ points: Point[];
13
+ }) => boolean;
14
+ export declare const isRectangleHitRotatedPoints: (rectangle: RectangleClient, points: Point[], angle: number | undefined) => boolean;
15
+ export declare const getHitDrawElement: (board: PlaitBoard, elements: (PlaitDrawElement | PlaitCustomGeometry)[]) => PlaitElement;
16
+ export declare const getFirstFilledDrawElement: (board: PlaitBoard, elements: (PlaitDrawElement | PlaitCustomGeometry)[]) => PlaitGeometry | PlaitCustomGeometry<string, Point[], string> | null;
17
+ export declare const getFirstTextOrLineElement: (elements: PlaitElement[]) => PlaitArrowLine | import("../interfaces").PlaitText | null;
14
18
  export declare const isHitDrawElement: (board: PlaitBoard, element: PlaitElement, point: Point) => boolean | null;
15
19
  export declare const isHitEdgeOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
16
20
  export declare const isInsideOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
package/utils/index.d.ts CHANGED
@@ -13,3 +13,4 @@ export * from './table-selected';
13
13
  export * from './swimlane';
14
14
  export * from './line';
15
15
  export * from './vector-line';
16
+ export * from './clipboard';
@@ -1,14 +1,10 @@
1
- import { Point } from '@plait/core';
2
- import { GeometryShapes, PlaitMultipleTextGeometry, PlaitCommonGeometry } from '../interfaces/geometry';
3
- import { PlaitDrawShapeText } from '../generators/text.generator';
1
+ import { PlaitElement, Point } from '@plait/core';
2
+ import { GeometryShapes, PlaitMultipleTextGeometry } from '../interfaces/geometry';
3
+ import { DrawTextInfo } from '../generators/text.generator';
4
4
  import { GeometryStyleOptions } from './geometry';
5
5
  export declare const isMultipleTextShape: (shape: GeometryShapes) => boolean;
6
- export declare const isMultipleTextGeometry: (geometry: PlaitCommonGeometry) => geometry is PlaitMultipleTextGeometry;
6
+ export declare const isMultipleTextGeometry: (geometry: PlaitElement) => geometry is PlaitMultipleTextGeometry;
7
7
  export declare const getMultipleTextGeometryTextKeys: (shape: GeometryShapes) => string[] | undefined;
8
8
  export declare const createMultipleTextGeometryElement: (shape: GeometryShapes, points: [Point, Point], options?: GeometryStyleOptions) => PlaitMultipleTextGeometry;
9
- export declare const buildDefaultTextsByShape: (shape: GeometryShapes) => {
10
- key: string;
11
- text: import("slate").BaseElement;
12
- textHeight: any;
13
- }[];
14
- export declare const getHitMultipleGeometryText: (element: PlaitMultipleTextGeometry, point: Point) => PlaitDrawShapeText | undefined;
9
+ export declare const buildDefaultTextsByShape: (shape: GeometryShapes) => DrawTextInfo[];
10
+ export declare const getHitMultipleGeometryText: (element: PlaitMultipleTextGeometry, point: Point) => DrawTextInfo | undefined;
@@ -1,10 +1,12 @@
1
1
  import { PlaitBoard, PlaitElement } from '@plait/core';
2
- import { PlaitArrowLine, PlaitDrawElement, PlaitGeometry, PlaitSwimlane, PlaitVectorLine } from '../interfaces';
2
+ import { PlaitArrowLine, PlaitCustomGeometry, PlaitDrawElement, PlaitGeometry, PlaitSwimlane, PlaitVectorLine } from '../interfaces';
3
3
  import { PlaitImage } from '../interfaces/image';
4
4
  export declare const getSelectedDrawElements: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitDrawElement[];
5
5
  export declare const getSelectedGeometryElements: (board: PlaitBoard) => PlaitGeometry[];
6
+ export declare const getSelectedCustomGeometryElements: (board: PlaitBoard) => PlaitCustomGeometry<string, import("@plait/core").Point[], string>[];
6
7
  export declare const getSelectedArrowLineElements: (board: PlaitBoard) => PlaitArrowLine[];
7
8
  export declare const getSelectedVectorLineElements: (board: PlaitBoard) => PlaitVectorLine[];
8
9
  export declare const getSelectedImageElements: (board: PlaitBoard) => PlaitImage[];
9
10
  export declare const isSingleSelectSwimlane: (board: PlaitBoard) => boolean;
11
+ export declare const isSingleSelectArrowLine: (board: PlaitBoard) => boolean;
10
12
  export declare const getSelectedSwimlane: (board: PlaitBoard) => PlaitSwimlane;
@@ -1,6 +1,6 @@
1
1
  import { ResizeRef, ResizeState } from '@plait/common';
2
2
  import { DirectionFactors, PlaitBoard, PlaitElement, Point, RectangleClient, SnapRef } from '@plait/core';
3
- import { PlaitDrawElement } from '../interfaces';
3
+ import { PlaitCustomGeometry, PlaitDrawElement } from '../interfaces';
4
4
  export declare const debugGenerator: import("@plait/core").DebugGenerator;
5
5
  export interface ResizeSnapRef extends SnapRef {
6
6
  xZoom: number;
@@ -18,7 +18,7 @@ export interface ResizeSnapOptions {
18
18
  handlePoint?: Point;
19
19
  isCreate?: boolean;
20
20
  }
21
- export declare function getSnapResizingRefOptions(board: PlaitBoard, resizeRef: ResizeRef<PlaitDrawElement | PlaitDrawElement[]>, resizeState: ResizeState, resizeOriginPointAndHandlePoint: {
21
+ export declare function getSnapResizingRefOptions(board: PlaitBoard, resizeRef: ResizeRef<PlaitDrawElement | PlaitCustomGeometry | (PlaitDrawElement | PlaitCustomGeometry)[]>, resizeState: ResizeState, resizeOriginPointAndHandlePoint: {
22
22
  originPoint: Point;
23
23
  handlePoint: Point;
24
24
  }, isAspectRatio: boolean, isFromCorner: boolean): ResizeSnapOptions;
@@ -1,5 +1,4 @@
1
1
  import { PlaitBoard, PlaitElement } from '@plait/core';
2
2
  export declare const getStrokeColorByElement: (board: PlaitBoard, element: PlaitElement) => any;
3
3
  export declare const getFillByElement: (board: PlaitBoard, element: PlaitElement) => any;
4
- export declare const getLineDashByElement: (element: PlaitElement) => any[] | undefined;
5
- export declare const getStrokeStyleByElement: (element: PlaitElement) => any;
4
+ export declare const getStrokeStyleByElement: (board: PlaitBoard, element: PlaitElement) => any;
@@ -1,6 +1,5 @@
1
1
  import { PlaitBoard, Point } from '@plait/core';
2
2
  import { PlaitVectorLine, VectorLineShape } from '../interfaces';
3
- export declare const isClosedVectorLine: (vectorLine: PlaitVectorLine) => boolean;
4
3
  export declare const getVectorLinePoints: (board: PlaitBoard, element: PlaitVectorLine) => Point[] | null;
5
4
  export declare const createVectorLineElement: (shape: VectorLineShape, points: Point[], options?: Pick<PlaitVectorLine, "strokeColor" | "strokeWidth" | "fill">) => PlaitVectorLine;
6
5
  export declare const vectorLineCreating: (board: PlaitBoard, lineShape: VectorLineShape, points: Point[], movingPoint: Point, lineShapeG: SVGGElement) => PlaitVectorLine;
@@ -1,70 +0,0 @@
1
- import { PlaitBoard, Transforms, getSelectedElements, rotateAntiPointsByElement } from '@plait/core';
2
- import { canResize, getFirstTextManage, getIndexByResizeHandle, isCornerHandle, normalizeShapePoints, withResize } from '@plait/common';
3
- import { getSelectedGeometryElements, getSelectedImageElements } from '../utils/selected';
4
- import { DrawTransforms } from '../transforms';
5
- import { PlaitDrawElement } from '../interfaces';
6
- import { getHitRectangleResizeHandleRef } from '../utils/position/geometry';
7
- import { getResizeOriginPointAndHandlePoint } from './with-draw-resize';
8
- import { getSnapResizingRefOptions, getSnapResizingRef } from '../utils/snap-resizing';
9
- import { isGeometryIncludeText } from '../utils';
10
- export const withGeometryResize = (board) => {
11
- let snapG;
12
- const options = {
13
- key: 'draw-geometry',
14
- canResize: () => {
15
- return true;
16
- },
17
- hitTest: (point) => {
18
- const selectedElements = [...getSelectedGeometryElements(board), ...getSelectedImageElements(board)];
19
- if (selectedElements.length !== 1 || getSelectedElements(board).length !== 1) {
20
- return null;
21
- }
22
- const target = selectedElements[0];
23
- if (canResize(board, target)) {
24
- const rectangle = board.getRectangle(target);
25
- const handleRef = getHitRectangleResizeHandleRef(board, rectangle, point, target.angle);
26
- if (handleRef) {
27
- return {
28
- element: target,
29
- handle: handleRef.handle,
30
- cursorClass: handleRef.cursorClass,
31
- rectangle
32
- };
33
- }
34
- }
35
- return null;
36
- },
37
- onResize: (resizeRef, resizeState) => {
38
- resizeState.startPoint = rotateAntiPointsByElement(resizeState.startPoint, resizeRef.element) || resizeState.startPoint;
39
- resizeState.endPoint = rotateAntiPointsByElement(resizeState.endPoint, resizeRef.element) || resizeState.endPoint;
40
- snapG?.remove();
41
- const isFromCorner = isCornerHandle(board, resizeRef.handle);
42
- const isAspectRatio = resizeState.isShift || PlaitDrawElement.isImage(resizeRef.element);
43
- const handleIndex = getIndexByResizeHandle(resizeRef.handle);
44
- const { originPoint, handlePoint } = getResizeOriginPointAndHandlePoint(board, handleIndex, resizeRef.rectangle);
45
- const resizeSnapRefOptions = getSnapResizingRefOptions(board, resizeRef, resizeState, {
46
- originPoint,
47
- handlePoint
48
- }, isAspectRatio, isFromCorner);
49
- const resizeSnapRef = getSnapResizingRef(board, [resizeRef.element], resizeSnapRefOptions);
50
- snapG = resizeSnapRef.snapG;
51
- PlaitBoard.getElementActiveHost(board).append(snapG);
52
- let points = resizeSnapRef.activePoints;
53
- if (PlaitDrawElement.isGeometry(resizeRef.element) && isGeometryIncludeText(resizeRef.element)) {
54
- const { height: textHeight } = getFirstTextManage(resizeRef.element).getSize();
55
- DrawTransforms.resizeGeometry(board, points, textHeight, resizeRef.path);
56
- }
57
- else {
58
- points = normalizeShapePoints(points);
59
- Transforms.setNode(board, { points }, resizeRef.path);
60
- }
61
- },
62
- afterResize: (resizeRef) => {
63
- snapG?.remove();
64
- snapG = null;
65
- }
66
- };
67
- withResize(board, options);
68
- return board;
69
- };
70
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l0aC1nZW9tZXRyeS1yZXNpemUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy9kcmF3L3NyYy9wbHVnaW5zL3dpdGgtZ2VvbWV0cnktcmVzaXplLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBUSxVQUFVLEVBQTBCLFVBQVUsRUFBRSxtQkFBbUIsRUFBRSx5QkFBeUIsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVuSSxPQUFPLEVBSUgsU0FBUyxFQUNULGtCQUFrQixFQUNsQixzQkFBc0IsRUFDdEIsY0FBYyxFQUNkLG9CQUFvQixFQUNwQixVQUFVLEVBQ2IsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLDJCQUEyQixFQUFFLHdCQUF3QixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDMUYsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUcvQyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDakQsT0FBTyxFQUFFLDhCQUE4QixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFDNUUsT0FBTyxFQUFFLGtDQUFrQyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDeEUsT0FBTyxFQUFFLHlCQUF5QixFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDdkYsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sVUFBVSxDQUFDO0FBRWpELE1BQU0sQ0FBQyxNQUFNLGtCQUFrQixHQUFHLENBQUMsS0FBaUIsRUFBRSxFQUFFO0lBQ3BELElBQUksS0FBeUI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AgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCB0YXJnZXQgPSBzZWxlY3RlZEVsZW1lbnRzWzBdO1xuICAgICAgICAgICAgaWYgKGNhblJlc2l6ZShib2FyZCwgdGFyZ2V0KSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlY3RhbmdsZSA9IGJvYXJkLmdldFJlY3RhbmdsZSh0YXJnZXQpIGFzIFJlY3RhbmdsZUNsaWVudDtcbiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVSZWYgPSBnZXRIaXRSZWN0YW5nbGVSZXNpemVIYW5kbGVSZWYoYm9hcmQsIHJlY3RhbmdsZSwgcG9pbnQsIHRhcmdldC5hbmdsZSk7XG4gICAgICAgICAgICAgICAgaWYgKGhhbmRsZVJlZikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudDogdGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlOiBoYW5kbGVSZWYuaGFuZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgY3Vyc29yQ2xhc3M6IGhhbmRsZVJlZi5jdXJzb3JDbGFzcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlY3RhbmdsZVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9LFxuICAgICAgICBvblJlc2l6ZTogKHJlc2l6ZVJlZjogUmVzaXplUmVmPFBsYWl0R2VvbWV0cnkgfCBQbGFpdEltYWdlPiwgcmVzaXplU3RhdGU6IFJlc2l6ZVN0YXRlKSA9PiB7XG4gICAgICAgICAgICByZXNpemVTdGF0ZS5zdGFydFBvaW50ID0gcm90YXRlQW50aVBvaW50c0J5RWxlbWVudChyZXNpemVTdGF0ZS5zdGFydFBvaW50LCByZXNpemV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