@witchcraft/layout 0.4.4 → 0.5.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 (99) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/FrameDragHandle.vue +3 -3
  3. package/dist/runtime/components/LayoutDragEdgeGrabbed.vue +3 -3
  4. package/dist/runtime/components/LayoutDragEdgeHandle.d.vue.ts +2 -2
  5. package/dist/runtime/components/LayoutDragEdgeHandle.vue +2 -2
  6. package/dist/runtime/components/LayoutDragEdgeHandle.vue.d.ts +2 -2
  7. package/dist/runtime/components/LayoutDragEdges.vue +5 -5
  8. package/dist/runtime/components/LayoutEdgesActiveFrame.vue +2 -2
  9. package/dist/runtime/components/LayoutFrame.vue +2 -2
  10. package/dist/runtime/components/LayoutIntersectionHandle.d.vue.ts +2 -2
  11. package/dist/runtime/components/LayoutIntersectionHandle.vue +2 -2
  12. package/dist/runtime/components/LayoutIntersectionHandle.vue.d.ts +2 -2
  13. package/dist/runtime/components/LayoutIntersections.vue +4 -4
  14. package/dist/runtime/components/LayoutWindow.d.vue.ts +44 -44
  15. package/dist/runtime/components/LayoutWindow.vue +27 -27
  16. package/dist/runtime/components/LayoutWindow.vue.d.ts +44 -44
  17. package/dist/runtime/composables/useFrames.d.ts +107 -109
  18. package/dist/runtime/composables/useFrames.js +103 -99
  19. package/dist/runtime/demo/App.vue +16 -16
  20. package/dist/runtime/demo/DemoControls.d.vue.ts +2 -2
  21. package/dist/runtime/demo/DemoControls.vue +4 -4
  22. package/dist/runtime/demo/DemoControls.vue.d.ts +2 -2
  23. package/dist/runtime/helpers/createZoneSideClipPath.d.ts +2 -2
  24. package/dist/runtime/helpers/{findFrameDraggableEdges.d.ts → findFrameMoveableEdges.d.ts} +2 -2
  25. package/dist/runtime/helpers/{findFrameDraggableEdges.js → findFrameMoveableEdges.js} +3 -3
  26. package/dist/runtime/helpers/{findDraggableEdge.d.ts → findMoveableEdge.d.ts} +1 -1
  27. package/dist/runtime/helpers/{findDraggableEdge.js → findMoveableEdge.js} +1 -1
  28. package/dist/runtime/helpers/index.d.ts +2 -2
  29. package/dist/runtime/helpers/index.js +2 -2
  30. package/dist/runtime/layout/createSplitDecoFromDrag.d.ts +1 -1
  31. package/dist/runtime/layout/createSplitDecoFromDrag.js +2 -2
  32. package/dist/runtime/layout/findSafeSplitEdge.d.ts +1 -1
  33. package/dist/runtime/layout/findSafeSplitEdge.js +2 -2
  34. package/dist/runtime/layout/getCloseFrameInfo.js +4 -4
  35. package/dist/runtime/layout/getFrameRearrangeInfo.d.ts +2 -2
  36. package/dist/runtime/layout/getFrameRearrangeInfo.js +8 -8
  37. package/dist/runtime/layout/getFrameSplitInfo.d.ts +1 -1
  38. package/dist/runtime/layout/getFrameSplitInfo.js +2 -2
  39. package/dist/runtime/layout/{getFrameDragZones.d.ts → getFrameZones.d.ts} +3 -3
  40. package/dist/runtime/layout/{getFrameDragZones.js → getFrameZones.js} +1 -1
  41. package/dist/runtime/layout/{getWindowDragZones.d.ts → getWindowZones.d.ts} +1 -1
  42. package/dist/runtime/layout/{getWindowDragZones.js → getWindowZones.js} +1 -1
  43. package/dist/runtime/layout/getZones.d.ts +8 -0
  44. package/dist/runtime/layout/getZones.js +32 -0
  45. package/dist/runtime/layout/index.d.ts +3 -3
  46. package/dist/runtime/layout/index.js +3 -3
  47. package/dist/runtime/{drag/DragActionHandler.d.ts → move/ActionHandler.d.ts} +18 -21
  48. package/dist/runtime/{drag/DragActionHandler.js → move/ActionHandler.js} +17 -17
  49. package/dist/runtime/{drag → move}/CloseAction.d.ts +8 -8
  50. package/dist/runtime/{drag → move}/CloseAction.js +29 -26
  51. package/dist/runtime/{drag → move}/FrameDragAction.d.ts +8 -8
  52. package/dist/runtime/{drag → move}/FrameDragAction.js +23 -21
  53. package/dist/runtime/{drag/DragDirectionStore.d.ts → move/MoveDirectionStore.d.ts} +4 -4
  54. package/dist/runtime/{drag/DragDirectionStore.js → move/MoveDirectionStore.js} +9 -9
  55. package/dist/runtime/{drag → move}/SplitAction.d.ts +9 -9
  56. package/dist/runtime/{drag → move}/SplitAction.js +46 -43
  57. package/dist/runtime/{drag → move}/createDefaultHandlers.d.ts +2 -2
  58. package/dist/runtime/types/index.d.ts +185 -171
  59. package/dist/runtime/types/index.js +2 -2
  60. package/dist/runtime/types/vue.d.ts +14 -16
  61. package/dist/runtime/types/vue.js +1 -1
  62. package/package.json +1 -1
  63. package/src/runtime/components/FrameDragHandle.vue +3 -3
  64. package/src/runtime/components/LayoutDragEdgeGrabbed.vue +3 -3
  65. package/src/runtime/components/LayoutDragEdgeHandle.vue +4 -4
  66. package/src/runtime/components/LayoutDragEdges.vue +5 -5
  67. package/src/runtime/components/LayoutEdgesActiveFrame.vue +2 -2
  68. package/src/runtime/components/LayoutFrame.vue +2 -2
  69. package/src/runtime/components/LayoutIntersectionHandle.vue +4 -4
  70. package/src/runtime/components/LayoutIntersections.vue +4 -4
  71. package/src/runtime/components/LayoutWindow.vue +32 -32
  72. package/src/runtime/composables/useFrames.ts +108 -102
  73. package/src/runtime/demo/App.vue +18 -18
  74. package/src/runtime/demo/DemoControls.vue +5 -5
  75. package/src/runtime/helpers/createZoneSideClipPath.ts +2 -2
  76. package/src/runtime/helpers/{findFrameDraggableEdges.ts → findFrameMoveableEdges.ts} +4 -4
  77. package/src/runtime/helpers/{findDraggableEdge.ts → findMoveableEdge.ts} +1 -1
  78. package/src/runtime/helpers/index.ts +2 -2
  79. package/src/runtime/layout/createSplitDecoFromDrag.ts +2 -2
  80. package/src/runtime/layout/findSafeSplitEdge.ts +4 -4
  81. package/src/runtime/layout/getCloseFrameInfo.ts +4 -4
  82. package/src/runtime/layout/getFrameRearrangeInfo.ts +10 -10
  83. package/src/runtime/layout/getFrameSplitInfo.ts +5 -5
  84. package/src/runtime/layout/{getFrameDragZones.ts → getFrameZones.ts} +4 -4
  85. package/src/runtime/layout/{getWindowDragZones.ts → getWindowZones.ts} +1 -1
  86. package/src/runtime/layout/getZones.ts +48 -0
  87. package/src/runtime/layout/index.ts +3 -3
  88. package/src/runtime/{drag/DragActionHandler.ts → move/ActionHandler.ts} +42 -40
  89. package/src/runtime/{drag → move}/CloseAction.ts +39 -36
  90. package/src/runtime/{drag → move}/FrameDragAction.ts +36 -35
  91. package/src/runtime/{drag/DragDirectionStore.ts → move/MoveDirectionStore.ts} +10 -10
  92. package/src/runtime/{drag → move}/SplitAction.ts +56 -53
  93. package/src/runtime/{drag → move}/createDefaultHandlers.ts +2 -2
  94. package/src/runtime/types/index.ts +80 -69
  95. package/src/runtime/types/vue.ts +14 -14
  96. package/dist/runtime/layout/getDragZones.d.ts +0 -8
  97. package/dist/runtime/layout/getDragZones.js +0 -32
  98. package/src/runtime/layout/getDragZones.ts +0 -48
  99. /package/dist/runtime/{drag → move}/createDefaultHandlers.js +0 -0
@@ -1,10 +1,10 @@
1
- import { DragActionHandler } from "./DragActionHandler.js";
1
+ import { ActionHandler } from "./ActionHandler.js";
2
2
  import { createZoneSideClipPath } from "../helpers/createZoneSideClipPath.js";
3
3
  import { applyFrameChanges } from "../layout/applyFrameChanges.js";
4
- import { getDragZones } from "../layout/getDragZones.js";
5
4
  import { getFrameDockInfo } from "../layout/getFrameDockInfo.js";
6
5
  import { getFrameRearrangeInfo } from "../layout/getFrameRearrangeInfo.js";
7
6
  import { getFrameSwapInfo } from "../layout/getFrameSwapInfo.js";
7
+ import { getZones } from "../layout/getZones.js";
8
8
  import { settings } from "../settings.js";
9
9
  export class FrameDragAction {
10
10
  name = "frameDrag";
@@ -14,7 +14,7 @@ export class FrameDragAction {
14
14
  };
15
15
  debug = false;
16
16
  textHints = { actions: [], errors: [] };
17
- handleEvent = (_e, state) => state.isDragging === "frame";
17
+ handleEvent = (_e, state) => state.isMoving === "frame";
18
18
  dragHints = {
19
19
  actions: {
20
20
  split: "Drop to Split the current frame.",
@@ -60,7 +60,7 @@ export class FrameDragAction {
60
60
  }
61
61
  getDecos(matchedZone, state, result) {
62
62
  const isError = result instanceof Error;
63
- const frame = state.dragHoveredFrame;
63
+ const frame = state.moveHoveredFrame;
64
64
  if (!matchedZone || !frame) {
65
65
  const decos2 = [];
66
66
  this.modifyDecos(decos2);
@@ -93,23 +93,27 @@ export class FrameDragAction {
93
93
  this.reset();
94
94
  return false;
95
95
  }
96
- onDragChange(_type, _e, state) {
97
- if (state.dragDistance <= this.minDragDistance) {
98
- return { updateEdges: false, shapes: [], showDragging: false };
96
+ onMoveChange(type, _e, state) {
97
+ if (type === "end") {
98
+ this.reset();
99
+ return { shapes: [] };
100
+ }
101
+ if (state.moveDistance <= this.minDragDistance) {
102
+ return { updateEdges: false, shapes: [], showMoving: false };
99
103
  }
100
- const { win, draggingFrameId, dragHoveredFrame } = state;
101
- const matchedZone = getDragZones(state, settings.zoneSizes);
104
+ const { win, movingFrameId, moveHoveredFrame } = state;
105
+ const matchedZone = getZones(state, settings.zoneSizes);
102
106
  if (!matchedZone) {
103
107
  this.state.lastReturn = void 0;
104
- } else if (dragHoveredFrame && matchedZone.type === "frame" && matchedZone.side) {
108
+ } else if (moveHoveredFrame && matchedZone.type === "frame" && matchedZone.side) {
105
109
  if (matchedZone.side !== "center") {
106
- this.state.lastReturn = getFrameRearrangeInfo(win, draggingFrameId, dragHoveredFrame.id, matchedZone.side);
110
+ this.state.lastReturn = getFrameRearrangeInfo(win, movingFrameId, moveHoveredFrame.id, matchedZone.side);
107
111
  } else {
108
- this.state.lastReturn = getFrameSwapInfo(win, draggingFrameId, dragHoveredFrame.id);
112
+ this.state.lastReturn = getFrameSwapInfo(win, movingFrameId, moveHoveredFrame.id);
109
113
  if (!(this.state.lastReturn instanceof Error)) this.state.lastReturn.info = "swap";
110
114
  }
111
- } else if (matchedZone.type === "window" && dragHoveredFrame && !dragHoveredFrame.docked) {
112
- this.state.lastReturn = getFrameDockInfo(win, draggingFrameId, matchedZone.side);
115
+ } else if (matchedZone.type === "window" && moveHoveredFrame && !moveHoveredFrame.docked) {
116
+ this.state.lastReturn = getFrameDockInfo(win, movingFrameId, matchedZone.side);
113
117
  if (!(this.state.lastReturn instanceof Error)) this.state.lastReturn.info = "dock";
114
118
  }
115
119
  this.setTextHints(this.state.lastReturn);
@@ -117,27 +121,25 @@ export class FrameDragAction {
117
121
  return {
118
122
  shapes: decos.flatMap((_) => _.shapes),
119
123
  updateEdges: false,
120
- showDragging: false
124
+ showMoving: false
121
125
  };
122
126
  }
123
- onDragApply(state) {
127
+ onMoveApply(state) {
124
128
  const result = this.state.lastReturn;
125
- if (!result || !state.dragHoveredFrame || !state.draggingFrameId) {
126
- this.reset();
129
+ if (!result || !state.moveHoveredFrame || !state.movingFrameId) {
127
130
  return true;
128
131
  }
129
132
  if (result instanceof Error) {
130
133
  this.hooks.onError?.(result);
131
134
  } else {
132
135
  if (this.debug) {
133
- DragActionHandler.debugState(this.name, "before", state, this.state, this.debug);
136
+ ActionHandler.debugState(this.name, "before", state, this.state, this.debug);
134
137
  }
135
138
  applyFrameChanges(state.win, result);
136
139
  if (this.debug) {
137
- DragActionHandler.debugState(this.name, "after", state, this.state, this.debug);
140
+ ActionHandler.debugState(this.name, "after", state, this.state, this.debug);
138
141
  }
139
142
  }
140
- this.reset();
141
143
  return true;
142
144
  }
143
145
  cancel() {
@@ -1,11 +1,11 @@
1
1
  import type { Direction, Orientation, Point } from "../types/index.js";
2
- export declare class DragDirectionStore {
2
+ export declare class MoveDirectionStore {
3
3
  hooks: {
4
4
  onUpdate: (directions: Record<Orientation, Direction | undefined>) => void;
5
5
  };
6
- constructor(hooks: DragDirectionStore["hooks"]);
6
+ constructor(hooks: MoveDirectionStore["hooks"]);
7
7
  lastPoint: Point | undefined;
8
- dragDirection: Record<Orientation, Direction | undefined>;
8
+ moveDirection: Record<Orientation, Direction | undefined>;
9
9
  lesser: {
10
10
  x: Direction;
11
11
  y: Direction;
@@ -16,5 +16,5 @@ export declare class DragDirectionStore {
16
16
  };
17
17
  reset(): void;
18
18
  update(point: Point): boolean;
19
- getDragDirection(coord: "x" | "y", point: Point): Direction | false;
19
+ getMoveDirection(coord: "x" | "y", point: Point): Direction | false;
20
20
  }
@@ -1,10 +1,10 @@
1
- export class DragDirectionStore {
1
+ export class MoveDirectionStore {
2
2
  hooks;
3
3
  constructor(hooks) {
4
4
  this.hooks = hooks;
5
5
  }
6
6
  lastPoint;
7
- dragDirection = {};
7
+ moveDirection = {};
8
8
  lesser = {
9
9
  x: "left",
10
10
  y: "up"
@@ -15,27 +15,27 @@ export class DragDirectionStore {
15
15
  };
16
16
  reset() {
17
17
  this.lastPoint = void 0;
18
- this.dragDirection = {};
18
+ this.moveDirection = {};
19
19
  }
20
20
  update(point) {
21
- const newXDirection = this.getDragDirection("x", point);
22
- const newYDirection = this.getDragDirection("y", point);
21
+ const newXDirection = this.getMoveDirection("x", point);
22
+ const newYDirection = this.getMoveDirection("y", point);
23
23
  let changed = false;
24
24
  if (newXDirection) {
25
- this.dragDirection.horizontal = newXDirection;
25
+ this.moveDirection.horizontal = newXDirection;
26
26
  }
27
27
  if (newYDirection) {
28
- this.dragDirection.vertical = newYDirection;
28
+ this.moveDirection.vertical = newYDirection;
29
29
  }
30
30
  if (this.lastPoint?.x !== point.x || this.lastPoint?.y !== point.y) {
31
31
  this.lastPoint = point;
32
32
  changed = true;
33
33
  }
34
34
  if (!changed) return false;
35
- this.hooks.onUpdate(this.dragDirection);
35
+ this.hooks.onUpdate(this.moveDirection);
36
36
  return true;
37
37
  }
38
- getDragDirection(coord, point) {
38
+ getMoveDirection(coord, point) {
39
39
  if (!this.lastPoint) return false;
40
40
  const diff = point[coord] - this.lastPoint[coord];
41
41
  if (diff > 0) return this.greater[coord];
@@ -1,9 +1,9 @@
1
1
  import { getFrameSplitInfo } from "../layout/getFrameSplitInfo.js";
2
- import type { ActionDragChangeResult, DragState, IDragAction, Point, SplitDeco } from "../types/index.js";
2
+ import type { ActionChangeResult, IAction, MoveState, Point, SplitDeco } from "../types/index.js";
3
3
  import type { KnownError } from "../utils/KnownError.js";
4
4
  export type SplitInfo = Exclude<ReturnType<typeof getFrameSplitInfo>, KnownError>;
5
5
  export type DragChangeType = "start" | "move" | "end";
6
- export declare class SplitAction implements IDragAction {
6
+ export declare class SplitAction implements IAction {
7
7
  name: "split";
8
8
  minDragDistance: number;
9
9
  state: {
@@ -15,7 +15,7 @@ export declare class SplitAction implements IDragAction {
15
15
  allowed: false;
16
16
  res: SplitInfo | undefined;
17
17
  lastPoint: Point | undefined;
18
- lastReturn: ActionDragChangeResult | undefined;
18
+ lastReturn: ActionChangeResult | undefined;
19
19
  };
20
20
  debug: boolean | string;
21
21
  textHints: {
@@ -26,7 +26,7 @@ export declare class SplitAction implements IDragAction {
26
26
  actions: string[] | ((type: DragChangeType) => string[]);
27
27
  transformError: (e: KnownError) => string;
28
28
  };
29
- handleEvent: (e: PointerEvent | KeyboardEvent, state: DragState) => boolean;
29
+ handleEvent: (e: PointerEvent | KeyboardEvent, state: MoveState) => boolean;
30
30
  modifyDecos: (shapes: SplitDeco[]) => void;
31
31
  hooks: {
32
32
  onStart?: () => void;
@@ -42,15 +42,15 @@ export declare class SplitAction implements IDragAction {
42
42
  minDragDistance?: number;
43
43
  });
44
44
  reset(): void;
45
- getDecos(state: DragState): SplitDeco[];
46
- canHandleRequest(e: PointerEvent | KeyboardEvent, state: DragState): boolean;
45
+ getDecos(state: MoveState): SplitDeco[];
46
+ canHandleRequest(e: PointerEvent | KeyboardEvent, state: MoveState): boolean;
47
47
  setTextHints(result: true | SplitInfo | KnownError | undefined): void;
48
48
  getTextHints(type: "start" | "move" | "end"): {
49
49
  actions: string[];
50
50
  errors: string[];
51
51
  };
52
- calculateSplitRequest(state: DragState): boolean;
53
- onDragChange(_type: "start" | "end" | "move", _e: PointerEvent | undefined, state: DragState): ActionDragChangeResult;
54
- onDragApply(state: DragState): boolean;
52
+ calculateSplitRequest(state: MoveState): boolean;
53
+ onMoveChange(type: "start" | "end" | "move", _e: PointerEvent | undefined, state: MoveState): ActionChangeResult;
54
+ onMoveApply(state: MoveState): boolean;
55
55
  cancel(): void;
56
56
  }
@@ -1,4 +1,4 @@
1
- import { DragActionHandler } from "./DragActionHandler.js";
1
+ import { ActionHandler } from "./ActionHandler.js";
2
2
  import { getEdgeOrientation } from "../helpers/getEdgeOrientation.js";
3
3
  import { oppositeSide } from "../helpers/oppositeSide.js";
4
4
  import { applyFrameChanges } from "../layout/applyFrameChanges.js";
@@ -15,7 +15,7 @@ export class SplitAction {
15
15
  actions: ["Hold Alt to Split"],
16
16
  transformError: (e) => e.message
17
17
  };
18
- handleEvent = (e, state) => e.altKey || state.isDraggingFromWindowEdge;
18
+ handleEvent = (e, state) => e.altKey || state.isMovingFromWindowEdge;
19
19
  modifyDecos = () => {
20
20
  };
21
21
  hooks;
@@ -42,19 +42,19 @@ export class SplitAction {
42
42
  let decos = [];
43
43
  const {
44
44
  win,
45
- isDragging,
46
- dragHoveredFrame,
47
- dragDirections,
48
- draggingEdges,
49
- dragPoint
45
+ isMoving,
46
+ moveHoveredFrame,
47
+ moveDirections,
48
+ movingEdges,
49
+ movePoint
50
50
  } = state;
51
- if (isDragging && this.state.allowed && dragHoveredFrame && draggingEdges.length === 1) {
52
- const oppositeOrientation = oppositeSide(getEdgeOrientation(draggingEdges[0]));
51
+ if (isMoving && this.state.allowed && moveHoveredFrame && movingEdges.length === 1) {
52
+ const oppositeOrientation = oppositeSide(getEdgeOrientation(movingEdges[0]));
53
53
  const deco = createSplitDecoFromDrag(
54
54
  win.frames,
55
- dragHoveredFrame,
56
- dragDirections[oppositeOrientation],
57
- dragPoint
55
+ moveHoveredFrame,
56
+ moveDirections[oppositeOrientation],
57
+ movePoint
58
58
  );
59
59
  decos = [deco];
60
60
  }
@@ -62,9 +62,9 @@ export class SplitAction {
62
62
  return decos;
63
63
  }
64
64
  canHandleRequest(e, state) {
65
- const { draggingEdges } = state;
66
- if (draggingEdges.length !== 1) return false;
67
- this.setTextHints(state.isDragging === "edge" && !state.isDraggingFromWindowEdge ? true : void 0);
65
+ const { movingEdges } = state;
66
+ if (movingEdges.length !== 1) return false;
67
+ this.setTextHints(state.isMoving === "edge" && !state.isMovingFromWindowEdge ? true : void 0);
68
68
  if (this.handleEvent(e, state)) {
69
69
  this.hooks.onStart?.();
70
70
  return true;
@@ -92,24 +92,24 @@ export class SplitAction {
92
92
  }
93
93
  calculateSplitRequest(state) {
94
94
  const {
95
- dragHoveredFrame,
96
- dragDirections,
97
- draggingEdges,
98
- dragPoint,
95
+ moveHoveredFrame,
96
+ moveDirections,
97
+ movingEdges,
98
+ movePoint,
99
99
  win
100
100
  } = state;
101
- const oppositeOrientation = oppositeSide(getEdgeOrientation(draggingEdges[0]));
102
- const originalDragHoveredFrame = win.frames[dragHoveredFrame.id];
101
+ const oppositeOrientation = oppositeSide(getEdgeOrientation(movingEdges[0]));
102
+ const originalDragHoveredFrame = win.frames[moveHoveredFrame.id];
103
103
  const canSplit = getFrameSplitInfo(
104
104
  originalDragHoveredFrame,
105
- dragDirections[oppositeOrientation],
106
- dragPoint
105
+ moveDirections[oppositeOrientation],
106
+ movePoint
107
107
  );
108
- this.setTextHints(state.isDragging === "edge" && !state.isDraggingFromWindowEdge ? canSplit : void 0);
108
+ this.setTextHints(state.isMoving === "edge" && !state.isMovingFromWindowEdge ? canSplit : void 0);
109
109
  if (!(canSplit instanceof Error)) {
110
110
  this.state.allowed = true;
111
111
  this.state.res = canSplit;
112
- this.state.lastPoint = dragPoint ? { ...dragPoint } : void 0;
112
+ this.state.lastPoint = movePoint ? { ...movePoint } : void 0;
113
113
  return true;
114
114
  } else {
115
115
  this.hooks.onError?.(canSplit);
@@ -118,52 +118,55 @@ export class SplitAction {
118
118
  return false;
119
119
  }
120
120
  }
121
- onDragChange(_type, _e, state) {
122
- const { dragHoveredFrame, dragDistance } = state;
123
- if (dragDistance <= this.minDragDistance) {
124
- return { updateEdges: false, shapes: [], showDragging: false };
121
+ onMoveChange(type, _e, state) {
122
+ if (type === "end") {
123
+ this.reset();
124
+ return { shapes: [] };
125
+ }
126
+ const { moveHoveredFrame, moveDistance } = state;
127
+ if (moveDistance <= this.minDragDistance) {
128
+ return { updateEdges: false, shapes: [], showMoving: false };
125
129
  }
126
130
  let ok = false;
127
- if (dragHoveredFrame) {
128
- if (this.state.lastPoint?.x === state.dragPoint?.x && this.state.lastPoint?.y === state.dragPoint?.y && this.state.lastReturn) {
131
+ if (moveHoveredFrame) {
132
+ if (this.state.lastPoint?.x === state.movePoint?.x && this.state.lastPoint?.y === state.movePoint?.y && this.state.lastReturn) {
129
133
  return this.state.lastReturn;
130
134
  }
131
135
  ok = this.calculateSplitRequest(state);
132
136
  }
133
137
  const decos = this.getDecos(state);
134
138
  if (!ok) {
135
- if (dragHoveredFrame && dragHoveredFrame.docked) {
139
+ if (moveHoveredFrame && moveHoveredFrame.docked) {
136
140
  const errorDeco = {
137
141
  type: "rect",
138
142
  data: {
139
- x: dragHoveredFrame.x,
140
- y: dragHoveredFrame.y,
141
- width: dragHoveredFrame.width,
142
- height: dragHoveredFrame.height
143
+ x: moveHoveredFrame.x,
144
+ y: moveHoveredFrame.y,
145
+ width: moveHoveredFrame.width,
146
+ height: moveHoveredFrame.height
143
147
  },
144
148
  attrs: { class: "deco-split-error bg-red-500/50" }
145
149
  };
146
- this.state.lastReturn = { updateEdges: true, shapes: [errorDeco], showDragging: false };
150
+ this.state.lastReturn = { updateEdges: true, shapes: [errorDeco], showMoving: false };
147
151
  return this.state.lastReturn;
148
152
  }
149
153
  }
150
- this.state.lastReturn = { updateEdges: false, shapes: decos.flatMap((_) => _.shapes), showDragging: false };
154
+ this.state.lastReturn = { updateEdges: false, shapes: decos.flatMap((_) => _.shapes), showMoving: false };
151
155
  return this.state.lastReturn;
152
156
  }
153
- onDragApply(state) {
154
- if (this.state.res && state.dragHoveredFrame) {
157
+ onMoveApply(state) {
158
+ if (this.state.res && state.moveHoveredFrame) {
155
159
  const ok = this.calculateSplitRequest(state);
156
160
  if (ok) {
157
161
  if (this.debug) {
158
- DragActionHandler.debugState(this.name, "before", state, this.state, this.debug);
162
+ ActionHandler.debugState(this.name, "before", state, this.state, this.debug);
159
163
  }
160
164
  applyFrameChanges(state.win, this.state.res);
161
165
  if (this.debug) {
162
- DragActionHandler.debugState(this.name, "after", state, this.state, this.debug);
166
+ ActionHandler.debugState(this.name, "after", state, this.state, this.debug);
163
167
  }
164
168
  }
165
169
  }
166
- this.reset();
167
170
  return true;
168
171
  }
169
172
  cancel() {
@@ -1,4 +1,4 @@
1
- import type { IDragAction } from "../types/index.js";
1
+ import type { IAction } from "../types/index.js";
2
2
  /**
3
3
  * Creates the default drag actions (Split, Close, FrameDrag).
4
4
  */
@@ -6,4 +6,4 @@ export declare function createDefaultHandlers(config?: {
6
6
  debugSplit?: boolean;
7
7
  debugClose?: boolean;
8
8
  debugFrameDrag?: boolean;
9
- }): IDragAction[];
9
+ }): IAction[];