@plait/core 0.62.0-next.1 → 0.62.0-next.10

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.
@@ -49,6 +49,7 @@ export interface PlaitBoard {
49
49
  isRectangleHit: (element: PlaitElement, range: Selection) => boolean;
50
50
  isHit: (element: PlaitElement, point: Point) => boolean;
51
51
  isInsidePoint: (element: PlaitElement, point: Point) => boolean;
52
+ getHitElement: (hitElements: PlaitElement[]) => PlaitElement;
52
53
  isRecursion: (element: PlaitElement) => boolean;
53
54
  isMovable: (element: PlaitElement) => boolean;
54
55
  getRectangle: (element: PlaitElement) => RectangleClient | null;
@@ -12,7 +12,6 @@ export * from './point';
12
12
  export * from './selection';
13
13
  export * from './viewport';
14
14
  export * from './history';
15
- export * from './plugin-key';
16
15
  export * from './theme';
17
16
  export * from './direction';
18
17
  export * from './group';
@@ -42,8 +42,12 @@ export type SetNodeOperation = {
42
42
  export type PlaitOperation = InsertNodeOperation | SetViewportOperation | SetSelectionOperation | SetNodeOperation | RemoveNodeOperation | MoveNodeOperation | SetThemeOperation;
43
43
  export interface PlaitOperationInterface {
44
44
  inverse: (op: PlaitOperation) => PlaitOperation;
45
- isSetViewportOperation: (value: any) => boolean;
45
+ isSetViewportOperation: (value: PlaitOperation) => boolean;
46
+ isSetSelectionOperation: (value: PlaitOperation) => boolean;
47
+ isSetThemeOperation: (value: PlaitOperation) => boolean;
46
48
  }
47
49
  export declare const isSetViewportOperation: (value: any) => value is SetViewportOperation;
50
+ export declare const isSetSelectionOperation: (value: any) => value is SetSelectionOperation;
51
+ export declare const isSetThemeOperation: (value: any) => value is SetThemeOperation;
48
52
  export declare const inverse: (op: PlaitOperation) => PlaitOperation;
49
53
  export declare const PlaitOperation: PlaitOperationInterface;
@@ -1,2 +1,13 @@
1
1
  import { PlaitBoard } from './board';
2
2
  export type PlaitPlugin = (board: PlaitBoard) => PlaitBoard;
3
+ export interface WithPluginOptions {
4
+ disabled?: boolean;
5
+ }
6
+ export interface WithSelectionPluginOptions extends WithPluginOptions {
7
+ isMultipleSelection: boolean;
8
+ isDisabledSelection: boolean;
9
+ isPreventClearSelection: boolean;
10
+ }
11
+ export declare enum PlaitPluginKey {
12
+ 'withSelection' = "withSelection"
13
+ }
package/package.json CHANGED
@@ -1,16 +1,29 @@
1
1
  {
2
2
  "name": "@plait/core",
3
- "version": "0.62.0-next.1",
3
+ "version": "0.62.0-next.10",
4
4
  "peerDependencies": {
5
5
  "immer": "^10.0.3",
6
6
  "is-hotkey": "^0.2.0",
7
- "rxjs": "~7.8.0",
7
+ "rxjs": "^7.8.0",
8
8
  "roughjs": "^4.5.2",
9
- "slate": "^0.101.5"
9
+ "points-on-curve": "^1.0.0"
10
10
  },
11
11
  "dependencies": {
12
12
  "tslib": "^2.3.0"
13
13
  },
14
+ "license": "MIT",
15
+ "repository": "https://github.com/worktile/plait",
16
+ "keywords": [
17
+ "drawing",
18
+ "whiteboard",
19
+ "framework",
20
+ "mind map",
21
+ "flow chart",
22
+ "free hand",
23
+ "open-source"
24
+ ],
25
+ "module": "fesm2022/plait-core.mjs",
26
+ "typings": "index.d.ts",
14
27
  "exports": {
15
28
  "./package.json": {
16
29
  "default": "./package.json"
@@ -22,7 +35,5 @@
22
35
  "default": "./fesm2022/plait-core.mjs"
23
36
  }
24
37
  },
25
- "module": "fesm2022/plait-core.mjs",
26
- "typings": "index.d.ts",
27
38
  "sideEffects": false
28
39
  }
@@ -1,9 +1,7 @@
1
1
  import { PlaitBoard } from '../interfaces/board';
2
- export interface PlaitPluginOptions {
3
- disabled?: boolean;
4
- }
2
+ import { WithPluginOptions } from '../interfaces/plugin';
5
3
  export interface PlaitOptionsBoard extends PlaitBoard {
6
- getPluginOptions: <K = PlaitPluginOptions>(key: string) => K;
7
- setPluginOptions: <K = PlaitPluginOptions>(key: string, value: Partial<K>) => void;
4
+ getPluginOptions: <K = WithPluginOptions>(key: string) => K;
5
+ setPluginOptions: <K = WithPluginOptions>(key: string, value: Partial<K>) => void;
8
6
  }
9
7
  export declare const withOptions: (board: PlaitBoard) => PlaitOptionsBoard;
@@ -1,7 +1,2 @@
1
1
  import { PlaitBoard } from '../interfaces/board';
2
- import { PlaitPluginOptions } from './with-options';
3
- export interface WithPluginOptions extends PlaitPluginOptions {
4
- isMultiple: boolean;
5
- isDisabledSelect: boolean;
6
- }
7
2
  export declare function withSelection(board: PlaitBoard): PlaitBoard;
@@ -7,3 +7,5 @@ export declare const getProbablySupportsClipboardWriteText: () => boolean;
7
7
  export declare const getProbablySupportsClipboardRead: () => boolean;
8
8
  export declare const createClipboardContext: (type: WritableClipboardType, elements: WritableClipboardData, text: string) => WritableClipboardContext;
9
9
  export declare const addClipboardContext: (clipboardContext: WritableClipboardContext, addition: WritableClipboardContext) => WritableClipboardContext;
10
+ export declare const replaceAngleBrackets: (str: string) => string;
11
+ export declare const reverseReplaceAngleBrackets: (str: string) => string;
package/utils/common.d.ts CHANGED
@@ -5,9 +5,9 @@ export interface MoveNodeOption {
5
5
  newPath: Path;
6
6
  }
7
7
  export declare const throttleRAF: (board: PlaitBoard, key: string, fn: () => void) => void;
8
- export declare const debounce: (func: () => void, wait: number, options?: {
8
+ export declare const debounce: <T>(func: (args?: T | undefined) => void, wait: number, options?: {
9
9
  leading: boolean;
10
- }) => () => void;
10
+ }) => (args?: T | undefined) => void;
11
11
  export declare const getElementsIndices: (board: PlaitBoard, elements: PlaitElement[]) => number[];
12
12
  export declare const getHighestIndexOfElement: (board: PlaitBoard, elements: PlaitElement[]) => number;
13
13
  export declare const moveElementsToNewPath: (board: PlaitBoard, moveOptions: MoveNodeOption[]) => void;
@@ -4,6 +4,7 @@ import { PlaitElement } from '../interfaces/element';
4
4
  import { Point } from '../interfaces/point';
5
5
  import { PlaitOptionsBoard } from '../plugins/with-options';
6
6
  export declare const getHitElementsBySelection: (board: PlaitBoard, selection?: Selection, match?: (element: PlaitElement) => boolean) => PlaitElement[];
7
+ export declare const getHitElementsByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean) => PlaitElement[];
7
8
  export declare const getHitElementByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean) => undefined | PlaitElement;
8
9
  export declare const getHitSelectedElements: (board: PlaitBoard, point: Point) => PlaitElement[];
9
10
  export declare const cacheSelectedElements: (board: PlaitBoard, selectedElements: PlaitElement[]) => void;
@@ -1,9 +1,9 @@
1
- import { PlaitBoard, PlaitElement, PlaitGroup } from '../interfaces';
1
+ import { PlaitBoard, PlaitElement, PlaitGroup, WithSelectionPluginOptions } from '../interfaces';
2
2
  export declare function isSelectionMoving(board: PlaitBoard): boolean;
3
3
  export declare function setSelectionMoving(board: PlaitBoard): void;
4
4
  export declare function clearSelectionMoving(board: PlaitBoard): void;
5
5
  export declare function isHandleSelection(board: PlaitBoard): boolean;
6
- export declare function isSetSelectionOperation(board: PlaitBoard): boolean;
6
+ export declare function hasSetSelectionOperation(board: PlaitBoard): boolean;
7
7
  export declare function getTemporaryElements(board: PlaitBoard): PlaitElement[] | undefined;
8
8
  export declare function getTemporaryRef(board: PlaitBoard): {
9
9
  elements: PlaitElement[];
@@ -14,3 +14,5 @@ export declare function drawEntireActiveRectangleG(board: PlaitBoard): SVGGEleme
14
14
  export declare function setSelectedElementsWithGroup(board: PlaitBoard, elements: PlaitElement[], isShift: boolean): void;
15
15
  export declare function cacheSelectedElementsWithGroupOnShift(board: PlaitBoard, elements: PlaitElement[], isSelectGroupElement: boolean, elementsInHighestGroup: PlaitElement[]): void;
16
16
  export declare function cacheSelectedElementsWithGroup(board: PlaitBoard, elements: PlaitElement[], isSelectGroupElement: boolean, hitElementGroups: PlaitGroup[]): void;
17
+ export declare const getSelectionOptions: (board: PlaitBoard) => WithSelectionPluginOptions;
18
+ export declare const setSelectionOptions: (board: PlaitBoard, options: Partial<WithSelectionPluginOptions>) => void;
@@ -1,5 +0,0 @@
1
- export var PlaitPluginKey;
2
- (function (PlaitPluginKey) {
3
- PlaitPluginKey["withSelection"] = "withSelection";
4
- })(PlaitPluginKey || (PlaitPluginKey = {}));
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLWtleS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvc3JjL2ludGVyZmFjZXMvcGx1Z2luLWtleS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSxjQUVYO0FBRkQsV0FBWSxjQUFjO0lBQ3RCLGlEQUFpQyxDQUFBO0FBQ3JDLENBQUMsRUFGVyxjQUFjLEtBQWQsY0FBYyxRQUV6QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIFBsYWl0UGx1Z2luS2V5IHtcbiAgICAnd2l0aFNlbGVjdGlvbicgPSAnd2l0aFNlbGVjdGlvbidcbn1cbiJdfQ==
@@ -1,3 +0,0 @@
1
- export declare enum PlaitPluginKey {
2
- 'withSelection' = "withSelection"
3
- }