@mk-drag-and-drop/dom 0.1.0 → 0.2.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.
- package/README.md +56 -32
- package/dist/controller/controller-internals.d.ts +4 -4
- package/dist/controller/create-drag-controller.d.ts +8 -8
- package/dist/controller/create-drag-controller.js +23 -53
- package/dist/draggable/create-draggable-binding.js +3 -3
- package/dist/droppable/create-drop-container-binding.js +4 -4
- package/dist/droppable/create-drop-container.d.ts +1 -1
- package/dist/droppable/create-drop-container.js +3 -3
- package/dist/droppable/create-droppable-binding.js +4 -4
- package/dist/droppable/create-droppable.d.ts +1 -1
- package/dist/droppable/create-droppable.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/input/pointer-activation.d.ts +4 -2
- package/dist/input/pointer-activation.js +28 -16
- package/dist/integration/index.d.ts +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/runtime/drag-runtime-scope.d.ts +21 -0
- package/dist/runtime/{drag-runtime-handle.js → drag-runtime-scope.js} +8 -9
- package/dist/runtime/drag-runtime.d.ts +21 -17
- package/dist/runtime/drag-runtime.js +274 -155
- package/dist/runtime/lifecycle.d.ts +5 -0
- package/dist/runtime/types.d.ts +3 -2
- package/dist/sortable/create-sortable-binding.js +4 -4
- package/dist/sortable/create-sortable.d.ts +1 -1
- package/dist/sortable/create-sortable.js +3 -3
- package/dist/sortable/sortable-preview.js +20 -17
- package/dist/sortable/sortable-registry.d.ts +15 -6
- package/dist/sortable/sortable-registry.js +65 -47
- package/package.json +1 -1
- package/dist/runtime/drag-runtime-handle.d.ts +0 -22
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DragRuntime } from "./drag-runtime.js";
|
|
2
|
-
export function
|
|
2
|
+
export function createDragRuntimeScope(options) {
|
|
3
3
|
const runtime = new DragRuntime(options);
|
|
4
|
-
const
|
|
4
|
+
const scope = {
|
|
5
5
|
configure: (input) => runtime.configure(input),
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
cancelDrag: () => runtime.cancelDrag(),
|
|
7
|
+
releaseActiveDragResources: () => runtime.releaseActiveDragResources(),
|
|
8
8
|
setOverlayRect: (overlayRect) => runtime.setOverlayRect(overlayRect),
|
|
9
9
|
requestDragStart: (input) => runtime.requestDragStart(input),
|
|
10
10
|
isKeyboardDragEnabled: () => runtime.isKeyboardDragEnabled(),
|
|
@@ -23,11 +23,10 @@ export function createDragRuntimeHandle(options) {
|
|
|
23
23
|
},
|
|
24
24
|
getDropTargetRegistration: (dropTargetId, group) => runtime.getDropTargetRegistration(dropTargetId, group),
|
|
25
25
|
subscribe: (subscription) => runtime.subscribe(subscription),
|
|
26
|
-
onDispose: (callback) => runtime.onDispose(callback),
|
|
27
26
|
remeasureDropTargets: (input) => runtime.remeasureDropTargets(input),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
registerStaleDomBinding: (record) => runtime.registerStaleDomBinding(record),
|
|
28
|
+
pruneDisconnectedDomBindings: () => runtime.pruneDisconnectedDomBindings(),
|
|
29
|
+
getStaleDomBindingRecordCount: () => runtime.getStaleDomBindingRecordCount(),
|
|
31
30
|
};
|
|
32
|
-
return
|
|
31
|
+
return scope;
|
|
33
32
|
}
|
|
@@ -3,8 +3,8 @@ import { type KeyboardMoveDirection, type SourceKeyboardDragKeyDownInput as Keyb
|
|
|
3
3
|
import { type DragGroup, type RegisterDropTargetOptions, type RemeasureDropTargetsInput } from "./drop-target-registry.js";
|
|
4
4
|
import type { DragRuntimeSubscription } from "./lifecycle.js";
|
|
5
5
|
import type { DragRuntimeConfigureInput, DragRuntimeOptions, Point, RequestDragStartInput, RequestKeyboardDragStartInput } from "./types.js";
|
|
6
|
-
export type
|
|
7
|
-
|
|
6
|
+
export type StaleDomBindingRecord = {
|
|
7
|
+
release: () => void;
|
|
8
8
|
isConnected: () => boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class DragRuntime {
|
|
@@ -16,13 +16,12 @@ export declare class DragRuntime {
|
|
|
16
16
|
private session;
|
|
17
17
|
private modifiers;
|
|
18
18
|
private activeDragModifiers;
|
|
19
|
-
private
|
|
20
|
-
private
|
|
19
|
+
private releaseActiveInputListeners;
|
|
20
|
+
private restoreTextSelectionSuppression;
|
|
21
21
|
private queuedPointerPosition;
|
|
22
22
|
private pointerFrameId;
|
|
23
23
|
private subscriptions;
|
|
24
|
-
private
|
|
25
|
-
private bindingCleanupRecords;
|
|
24
|
+
private staleDomBindingRecords;
|
|
26
25
|
private lifecycleCallbacks;
|
|
27
26
|
private lifecycleHelpers;
|
|
28
27
|
private lifecycleDropTargetRectSnapshot;
|
|
@@ -32,7 +31,7 @@ export declare class DragRuntime {
|
|
|
32
31
|
private updateOverlayHost;
|
|
33
32
|
private targetingAlgorithm;
|
|
34
33
|
private hasDragOverlay;
|
|
35
|
-
private
|
|
34
|
+
private overlayRelease;
|
|
36
35
|
private targetingConstraint;
|
|
37
36
|
private pointerActivation;
|
|
38
37
|
private keyboardDrag;
|
|
@@ -45,31 +44,35 @@ export declare class DragRuntime {
|
|
|
45
44
|
moveKeyboardDrag(direction: KeyboardMoveDirection): void;
|
|
46
45
|
updatePointer(rawPointerPosition: Point): void;
|
|
47
46
|
private updatePointerNow;
|
|
47
|
+
private updatePointerNowOrRelease;
|
|
48
|
+
private finishDragAfterQueuedPointerUpdate;
|
|
48
49
|
endDrag(): void;
|
|
49
50
|
cancelDrag(): void;
|
|
51
|
+
cancelPendingActivation(): void;
|
|
50
52
|
registerDropTarget(dropTargetId: string, element: HTMLElement, group: DragGroup, options?: RegisterDropTargetOptions): void;
|
|
51
53
|
unregisterDropTarget(dropTargetId: string, element?: HTMLElement): void;
|
|
52
54
|
registerDropContainer(containerId: string, element: HTMLElement, group: DragGroup): void;
|
|
53
55
|
unregisterDropContainer(containerId: string, element?: HTMLElement): void;
|
|
54
|
-
|
|
56
|
+
releaseActiveDragResources(): void;
|
|
57
|
+
private releaseActiveDragResourcesAndRethrow;
|
|
55
58
|
getDropTargetRect(dropTargetId: string): DragRect | null;
|
|
56
59
|
getDropTargetRegistration(dropTargetId: string, group?: DragGroup): import("./drop-target-registry.js").DropTargetRegistration | null;
|
|
57
60
|
getCurrentDragRect(): DragRect | null;
|
|
58
61
|
setOverlayRect(overlayRect: DragRect | null): void;
|
|
59
62
|
remeasureDropTargets(input?: RemeasureDropTargetsInput): void;
|
|
60
63
|
subscribe(subscription: DragRuntimeSubscription): () => void;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
getBindingCleanupRecordCount(): number;
|
|
65
|
-
dispose(): void;
|
|
64
|
+
registerStaleDomBinding(record: StaleDomBindingRecord): () => void;
|
|
65
|
+
pruneDisconnectedDomBindings(): void;
|
|
66
|
+
getStaleDomBindingRecordCount(): number;
|
|
66
67
|
private startDragNow;
|
|
67
68
|
private finishDrag;
|
|
69
|
+
private releaseOverlayAfterDrag;
|
|
68
70
|
private bindPointerWindowListeners;
|
|
69
71
|
private bindKeyboardWindowListeners;
|
|
70
72
|
private suppressTextSelection;
|
|
71
73
|
private resetActiveDragState;
|
|
72
|
-
private
|
|
74
|
+
private releaseActiveInputResources;
|
|
75
|
+
private clearOverlayHost;
|
|
73
76
|
private flushQueuedPointerUpdate;
|
|
74
77
|
private cancelQueuedPointerUpdate;
|
|
75
78
|
private setSession;
|
|
@@ -85,12 +88,13 @@ export declare class DragRuntime {
|
|
|
85
88
|
private getAvailableDropTargets;
|
|
86
89
|
private getCurrentDragRectAt;
|
|
87
90
|
private removeDisconnectedDropTargets;
|
|
88
|
-
private
|
|
89
|
-
private disposeBindingCleanupRecords;
|
|
91
|
+
private pruneDisconnectedDomBindingRecords;
|
|
90
92
|
private clearActiveDropTargetIdIfRemoved;
|
|
91
|
-
private
|
|
93
|
+
private notifyDragStartSubscriptions;
|
|
94
|
+
private notifyDragStartLifecycle;
|
|
92
95
|
private notifyDragUpdate;
|
|
93
96
|
private notifyDragEnd;
|
|
94
97
|
private notifyDrop;
|
|
98
|
+
private notifyActiveDragReset;
|
|
95
99
|
}
|
|
96
100
|
export declare function createDragRuntime(options?: DragRuntimeOptions): DragRuntime;
|