@moltenship/calendar-dnd-kit 1.0.0-rc.1 → 2.0.0-beta.1

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/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { DragDropManager } from "@dnd-kit/dom";
2
2
  import { CalendarEventPlacement, EventId, ResourceId } from "@moltenship/calendar-core";
3
3
  import { CalendarDropSource } from "@moltenship/calendar-dnd";
4
- //#region src/calendar-dnd-kit.d.ts
5
4
  /**
6
5
  * Connects the calendar views on the page to the dnd-kit `DragDropProvider` it's rendered in, so
7
6
  * draggables carrying `calendarDropData` drop into them and calendar events drag out to your
@@ -10,8 +9,6 @@ import { CalendarDropSource } from "@moltenship/calendar-dnd";
10
9
  * droppable of yours is on. See `connectCalendarDragDrop`.
11
10
  */
12
11
  export declare function CalendarDndKit(): null;
13
- //#endregion
14
- //#region src/connect.d.ts
15
12
  /**
16
13
  * Connects the calendar views on the page to a dnd-kit manager, and returns a function that
17
14
  * disconnects them. `CalendarDndKit` does this for the `DragDropProvider` it's in; call it
@@ -33,8 +30,6 @@ export declare function CalendarDndKit(): null;
33
30
  * - dnd-kit's `AutoScroller` is off while a drag is over a view, which scrolls itself.
34
31
  */
35
32
  export declare function connectCalendarDragDrop(manager: DragDropManager): () => void;
36
- //#endregion
37
- //#region src/data.d.ts
38
33
  declare const dropKey = "@moltenship/calendar-drop";
39
34
  /**
40
35
  * The `type` of the draggable a calendar event becomes while it's dragged out of a view; list it
@@ -73,5 +68,4 @@ export declare function calendarEventOf<TEvent = unknown, TEventId extends Event
73
68
  * `onDragEnd` of yours can leave `operation.target` alone when this says so.
74
69
  */
75
70
  export declare function isCalendarTarget(target: WithData): boolean;
76
- //#endregion
77
71
  export type { CalendarEventDragData };
package/dist/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { useDragDropManager } from "@dnd-kit/react";
3
3
  import { useEffect } from "react";
4
+ import { CollisionPriority, CollisionType } from "@dnd-kit/abstract";
4
5
  import { AutoScroller, Draggable, Droppable, Feedback } from "@dnd-kit/dom";
5
6
  import { eventPlacement } from "@moltenship/calendar-core";
6
7
  import { monitorCalendarDrags, observeCalendarRegions, startCalendarDrop } from "@moltenship/calendar-dnd";
7
- //#region src/data.ts
8
+ // src/data.ts
8
9
  const dropKey = "@moltenship/calendar-drop";
9
10
  const eventKey = "@moltenship/calendar-event";
10
11
  const regionKey = "@moltenship/calendar-view";
@@ -51,8 +52,7 @@ const calendarViewData = Object.freeze({ [regionKey]: true });
51
52
  function isCalendarTarget(target) {
52
53
  return field(target, regionKey) === true;
53
54
  }
54
- //#endregion
55
- //#region src/connect.ts
55
+ // src/connect.ts
56
56
  /** The most of a long or wide event the drag's stand-in covers, as the calendar's copy does. */
57
57
  const PROXY_MAXIMUM = {
58
58
  height: 120,
@@ -63,14 +63,6 @@ const proxyFeedback = [Feedback.configure({
63
63
  dropAnimation: null,
64
64
  feedback: "move"
65
65
  })];
66
- /**
67
- * dnd-kit's `CollisionPriority.Highest`, which a view claims only where it's the topmost thing
68
- * under the pointer: there it wins over a droppable of the app's around or under it, and a
69
- * droppable of the app's over it wins, since the view isn't topmost there.
70
- */
71
- const VIEW_PRIORITY = 4;
72
- /** dnd-kit's `CollisionType.PointerIntersection`. */
73
- const POINTER_INTERSECTION = 2;
74
66
  /** Opaque IDs for the entities the adapter registers, unique on the page. */
75
67
  let entities = 0;
76
68
  const nextId = (kind) => `@moltenship/calendar-${kind}:${entities += 1}`;
@@ -222,8 +214,8 @@ function connect(manager) {
222
214
  accept: takesDrop,
223
215
  collisionDetector: ({ dragOperation }) => topmostIn(element, dragOperation.position.current) ? {
224
216
  id,
225
- priority: VIEW_PRIORITY,
226
- type: POINTER_INTERSECTION,
217
+ priority: CollisionPriority.Highest,
218
+ type: CollisionType.PointerIntersection,
227
219
  value: 1
228
220
  } : null,
229
221
  data: calendarViewData,
@@ -381,8 +373,7 @@ function connect(manager) {
381
373
  for (const cleanup of cleanups.splice(0).reverse()) cleanup();
382
374
  };
383
375
  }
384
- //#endregion
385
- //#region src/calendar-dnd-kit.ts
376
+ // src/calendar-dnd-kit.ts
386
377
  /**
387
378
  * Connects the calendar views on the page to the dnd-kit `DragDropProvider` it's rendered in, so
388
379
  * draggables carrying `calendarDropData` drop into them and calendar events drag out to your
@@ -395,5 +386,4 @@ function CalendarDndKit() {
395
386
  useEffect(() => manager === null ? void 0 : connectCalendarDragDrop(manager), [manager]);
396
387
  return null;
397
388
  }
398
- //#endregion
399
389
  export { CalendarDndKit, calendarDropData, calendarDropOf, calendarEventOf, calendarEventType, connectCalendarDragDrop, isCalendarTarget };
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "@moltenship/calendar-dnd-kit",
3
- "version": "1.0.0-rc.1",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Optional dnd-kit adapter for Moltenship Time: drag your items into the calendar and events out.",
5
+ "keywords": [
6
+ "calendar",
7
+ "dnd-kit",
8
+ "drag-and-drop",
9
+ "event-calendar",
10
+ "react",
11
+ "scheduler",
12
+ "temporal",
13
+ "typescript"
14
+ ],
5
15
  "homepage": "https://time.molten.sh/docs/api/dnd-kit",
6
16
  "bugs": {
7
17
  "url": "https://github.com/Moltenship/time/issues"
@@ -28,20 +38,21 @@
28
38
  "access": "public"
29
39
  },
30
40
  "dependencies": {
31
- "@moltenship/calendar-core": "1.0.0-rc.1",
32
- "@moltenship/calendar-dnd": "1.0.0-rc.1"
41
+ "@dnd-kit/abstract": "^0.5.0",
42
+ "@moltenship/calendar-core": "2.0.0-beta.1",
43
+ "@moltenship/calendar-dnd": "2.0.0-beta.1"
33
44
  },
34
45
  "devDependencies": {
35
- "@dnd-kit/dom": "0.5.0",
36
- "@dnd-kit/react": "0.5.0",
46
+ "@dnd-kit/dom": "0.5.1",
47
+ "@dnd-kit/react": "0.5.1",
37
48
  "@types/react": "19.3.0",
38
49
  "@types/react-dom": "19.3.0",
39
- "jsdom": "30.1.2",
40
- "react": "19.3.0",
41
- "react-dom": "19.3.0",
50
+ "jsdom": "30.1.3",
51
+ "react": "19.3.1",
52
+ "react-dom": "19.3.1",
42
53
  "typescript": "^7.0.2",
43
- "vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
44
- "vite-plus": "1.1.0"
54
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
55
+ "vite-plus": "1.4.0"
45
56
  },
46
57
  "peerDependencies": {
47
58
  "@dnd-kit/dom": "^0.5.0",
@@ -50,7 +61,6 @@
50
61
  },
51
62
  "scripts": {
52
63
  "build": "vp pack",
53
- "check": "vp check",
54
64
  "dev": "vp pack --watch",
55
65
  "test": "vp test --passWithNoTests"
56
66
  }