@plait/core 0.15.0 → 0.16.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.
@@ -4,7 +4,7 @@ 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 produce, { createDraft, finishDraft, isDraft } from 'immer';
7
- import isHotkey$1, { isKeyHotkey, isHotkey } from 'is-hotkey';
7
+ import { isKeyHotkey, isHotkey } from 'is-hotkey';
8
8
  import * as i1 from '@angular/common';
9
9
  import { CommonModule } from '@angular/common';
10
10
 
@@ -344,6 +344,9 @@ const Path = {
344
344
  const last = path[path.length - 1];
345
345
  return path.slice(0, -1).concat(last + 1);
346
346
  },
347
+ hasPrevious(path) {
348
+ return path[path.length - 1] > 0;
349
+ },
347
350
  previous(path) {
348
351
  if (path.length === 0) {
349
352
  throw new Error(`Cannot get the next path of a root path [${path}], because it has no previous index.`);
@@ -2633,7 +2636,7 @@ const withHotkey = (board) => {
2633
2636
  const { keydown, globalKeydown } = board;
2634
2637
  board.keydown = (event) => {
2635
2638
  const options = board.getPluginOptions(PlaitPluginKey.withSelection);
2636
- if (!PlaitBoard.isReadonly(board) && options.isMultiple && isHotkey$1('mod+a', event)) {
2639
+ if (!PlaitBoard.isReadonly(board) && options.isMultiple && isHotkey('mod+a', event)) {
2637
2640
  event.preventDefault();
2638
2641
  let elements = [];
2639
2642
  depthFirstRecursion(board, node => {
@@ -2653,22 +2656,22 @@ const withHotkey = (board) => {
2653
2656
  };
2654
2657
  board.globalKeydown = (event) => {
2655
2658
  if (PlaitBoard.getMovingPointInBoard(board) || PlaitBoard.isMovingPointInBoard(board)) {
2656
- if (isHotkey$1(['mod+=', 'mod++'], { byKey: true })(event)) {
2659
+ if (isHotkey(['mod+=', 'mod++'], { byKey: true })(event)) {
2657
2660
  event.preventDefault();
2658
2661
  BoardTransforms.updateZoom(board, board.viewport.zoom + 0.1, false);
2659
2662
  return;
2660
2663
  }
2661
- if (isHotkey$1(['mod+shift+=', 'mod+shift++'], { byKey: true })(event)) {
2664
+ if (isHotkey(['mod+shift+=', 'mod+shift++'], { byKey: true })(event)) {
2662
2665
  event.preventDefault();
2663
2666
  BoardTransforms.fitViewport(board);
2664
2667
  return;
2665
2668
  }
2666
- if (isHotkey$1(['mod+-', 'mod+shift+-'])(event)) {
2669
+ if (isHotkey(['mod+-', 'mod+shift+-'])(event)) {
2667
2670
  event.preventDefault();
2668
2671
  BoardTransforms.updateZoom(board, board.viewport.zoom - 0.1);
2669
2672
  return;
2670
2673
  }
2671
- if (isHotkey$1(['mod+0', 'mod+shift+0'], { byKey: true })(event)) {
2674
+ if (isHotkey(['mod+0', 'mod+shift+0'], { byKey: true })(event)) {
2672
2675
  event.preventDefault();
2673
2676
  BoardTransforms.updateZoom(board, 1);
2674
2677
  return;