@moltenship/calendar-dnd 1.0.0-rc.2 → 2.0.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 +5 -5
- package/dist/index.d.mts +17 -30
- package/dist/index.mjs +608 -130
- package/package.json +17 -15
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @moltenship/calendar-dnd
|
|
2
2
|
|
|
3
3
|
The pointer layer of Moltenship Time: drag to move, resize and create events inside a view, on
|
|
4
|
-
native Pointer Events. Drags become change proposals for your app to save. `
|
|
5
|
-
does this
|
|
4
|
+
native Pointer Events. Drags become change proposals for your app to save. `attachCalendarPointer`
|
|
5
|
+
does this for a view's element. It's plain DOM, with no framework: `useCalendarPointer`, the React
|
|
6
|
+
binding, is in `@moltenship/calendar-react`.
|
|
6
7
|
|
|
7
8
|
It also takes drags across the calendar's edge: `startCalendarDrop` drops items dragged in from
|
|
8
9
|
the rest of the page, such as unscheduled tasks, into the view under them, and
|
|
@@ -15,10 +16,9 @@ It's a layer of `@moltenship/calendar`, which re-exports all of it. Most apps in
|
|
|
15
16
|
## Install
|
|
16
17
|
|
|
17
18
|
```bash
|
|
18
|
-
pnpm add @moltenship/calendar-dnd
|
|
19
|
+
pnpm add @moltenship/calendar-dnd
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
- React 19. React is a peer dependency.
|
|
22
22
|
- A runtime with `Temporal` (Node.js 26 and later include it), or a polyfill that defines
|
|
23
23
|
`globalThis.Temporal`, loaded first.
|
|
24
24
|
- TypeScript 6 or later with `"lib": ["DOM", "DOM.Iterable", "ESNext"]`. `ESNext` has the
|
|
@@ -26,7 +26,7 @@ pnpm add @moltenship/calendar-dnd react
|
|
|
26
26
|
|
|
27
27
|
## Documentation
|
|
28
28
|
|
|
29
|
-
- [Interactions](https://time.molten.sh/docs/interactions)
|
|
29
|
+
- [Interactions](https://time.molten.sh/docs/react/interactions)
|
|
30
30
|
- [Repository](https://github.com/Moltenship/time)
|
|
31
31
|
|
|
32
32
|
## License
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { CalendarAnnouncer, CalendarDraft, CalendarEventPlacement, CalendarEventProposal, CalendarPolicyResult, CalendarProposalDetail, CalendarTransactionResult, EventId, EventSnapshot, NormalizedCalendarEvent, ResourceId, TimeGridColumn } from "@moltenship/calendar-core";
|
|
2
2
|
import { WallTimeSnapOptions } from "@moltenship/calendar-temporal";
|
|
3
|
-
import { RefCallback } from "react";
|
|
4
|
-
//#region src/attach-calendar-pointer.d.ts
|
|
5
3
|
interface CalendarPointerOptions<TEvent, TEventId extends EventId, TResourceId extends ResourceId> {
|
|
6
4
|
/** Events as rendered, pending changes included; resolves `data-event-id`. */
|
|
7
5
|
readonly events: EventSnapshot<TEvent, TEventId, TResourceId>;
|
|
@@ -22,10 +20,12 @@ interface CalendarPointerOptions<TEvent, TEventId extends EventId, TResourceId e
|
|
|
22
20
|
readonly announcer?: CalendarAnnouncer;
|
|
23
21
|
/**
|
|
24
22
|
* Asks the root's policies about the proposal a drop would make, so the preview shows whether
|
|
25
|
-
* it would be saved: pass `actions.checkEventChange`.
|
|
26
|
-
*
|
|
23
|
+
* it would be saved: pass `actions.checkEventChange`. It gets the detail the drop will propose
|
|
24
|
+
* with, `{ input: "pointer" }` or a dragged-in item's input, so a policy that answers by input
|
|
25
|
+
* answers the preview as it will the drop. Preview segments get `data-invalid` when a policy
|
|
26
|
+
* rejects it and `data-warning` when one flags it.
|
|
27
27
|
*/
|
|
28
|
-
readonly check?: (proposal: CalendarEventProposal<TEventId, TResourceId, TEvent
|
|
28
|
+
readonly check?: (proposal: CalendarEventProposal<TEventId, TResourceId, TEvent>, detail: CalendarProposalDetail) => CalendarPolicyResult<TEvent, TEventId, TResourceId> | null;
|
|
29
29
|
/**
|
|
30
30
|
* Day columns of the time axis, matched to `[data-date]` elements without `data-all-day`: a
|
|
31
31
|
* time grid's or a timeline's `columns`. A new array mid-gesture is picked up, as a view that
|
|
@@ -35,7 +35,7 @@ interface CalendarPointerOptions<TEvent, TEventId extends EventId, TResourceId e
|
|
|
35
35
|
/**
|
|
36
36
|
* Turns gestures off. It's also read when the layer attaches: a region disabled then doesn't
|
|
37
37
|
* listen for touch moves, which a drag needs on iOS, so attach again when it changes, as
|
|
38
|
-
* `useCalendarPointer` does.
|
|
38
|
+
* the React integration's `useCalendarPointer` does.
|
|
39
39
|
*/
|
|
40
40
|
readonly disabled?: boolean;
|
|
41
41
|
/**
|
|
@@ -46,6 +46,15 @@ interface CalendarPointerOptions<TEvent, TEventId extends EventId, TResourceId e
|
|
|
46
46
|
readonly onPreview?: (draft: CalendarDraft<TEventId, TResourceId> | null) => void;
|
|
47
47
|
/** Extra classes for the preview segments. */
|
|
48
48
|
readonly ghostClassName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* How the preview follows the pointer. `"snapped"`, the default, draws the event where a drop
|
|
51
|
+
* would land, so it steps from slot to slot. `"free"` moves a copy of a moved event with the
|
|
52
|
+
* pointer, pixel for pixel, over boxes where a drop would land
|
|
53
|
+
* (`[data-calendar-ghost="landing"]`), and slides it there on release; a resize or create on a
|
|
54
|
+
* time axis draws its edge under the pointer. Both propose, check, and announce the same snapped
|
|
55
|
+
* placement.
|
|
56
|
+
*/
|
|
57
|
+
readonly preview?: "free" | "snapped";
|
|
49
58
|
/**
|
|
50
59
|
* A ref to the element scrolled while dragging near its edges. Defaults to the nearest scrollable
|
|
51
60
|
* ancestor of where the drag starts.
|
|
@@ -90,8 +99,6 @@ interface CalendarPointerOptions<TEvent, TEventId extends EventId, TResourceId e
|
|
|
90
99
|
* that detaches everything.
|
|
91
100
|
*/
|
|
92
101
|
export declare function attachCalendarPointer<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(region: HTMLElement, getOptions: () => CalendarPointerOptions<TEvent, TEventId, TResourceId>): () => void;
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/drags.d.ts
|
|
95
102
|
/** A point in viewport (client) coordinates. */
|
|
96
103
|
interface CalendarPoint {
|
|
97
104
|
readonly x: number;
|
|
@@ -174,8 +181,6 @@ type CalendarDragMonitor = (drag: CalendarEventDrag) => CalendarDragFollower | v
|
|
|
174
181
|
* Returns a function that stops listening.
|
|
175
182
|
*/
|
|
176
183
|
export declare function monitorCalendarDrags(monitor: CalendarDragMonitor): () => void;
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/drop.d.ts
|
|
179
184
|
/** What an item dragged in from outside the calendar becomes when it's dropped on a view. */
|
|
180
185
|
interface CalendarDropSource<TEvent = unknown, TEventId extends EventId = EventId> {
|
|
181
186
|
/**
|
|
@@ -229,7 +234,7 @@ interface CalendarDropSession<TEvent = unknown, TEventId extends EventId = Event
|
|
|
229
234
|
/**
|
|
230
235
|
* Follows a drag that started outside the calendar, such as a task dragged from a list, over the
|
|
231
236
|
* calendar views on the page, and drops it into one: the framework-agnostic half of external drag
|
|
232
|
-
* and drop, which a drag library's binding drives. Every view that uses `
|
|
237
|
+
* and drop, which a drag library's binding drives. Every view that uses `attachCalendarPointer` takes
|
|
233
238
|
* part, through the options it passes: the preview shows range boxes in its slots, its `check`
|
|
234
239
|
* marks them `data-invalid` or `data-warning`, its announcer speaks each step with `outside` set,
|
|
235
240
|
* and its `onPropose` gets the drop. Read-only views take no part.
|
|
@@ -246,8 +251,6 @@ interface CalendarDropSession<TEvent = unknown, TEventId extends EventId = Event
|
|
|
246
251
|
* them or rested at one for a moment, so crossing an edge on the way in doesn't scroll it.
|
|
247
252
|
*/
|
|
248
253
|
export declare function startCalendarDrop<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId>(source: CalendarDropSource<TEvent, TEventId>, { input }?: CalendarDropOptions): CalendarDropSession<TEvent, TEventId, TResourceId>;
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/event-id.d.ts
|
|
251
254
|
/**
|
|
252
255
|
* Attributes that identify an event element, for spreading onto it. `data-event-id` holds the ID
|
|
253
256
|
* as text; numeric IDs add `data-event-id-type="number"`, so `1` and `"1"` stay distinct.
|
|
@@ -258,13 +261,11 @@ export declare function eventIdAttributes(id: EventId): {
|
|
|
258
261
|
};
|
|
259
262
|
/** The event ID an element carries through `eventIdAttributes`, or `null` without one. */
|
|
260
263
|
export declare function eventIdOf(element: Element): EventId | null;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/regions.d.ts
|
|
263
264
|
/** A calendar view's region, as a binding to a drag-and-drop library sees it. */
|
|
264
265
|
interface CalendarRegion {
|
|
265
266
|
/** Whether its gestures are off, as on a read-only root: then it takes no drops either. */
|
|
266
267
|
readonly disabled: boolean;
|
|
267
|
-
/** The element the view
|
|
268
|
+
/** The element the view attached with `attachCalendarPointer`, or a binding of it. */
|
|
268
269
|
readonly element: HTMLElement;
|
|
269
270
|
}
|
|
270
271
|
/**
|
|
@@ -273,8 +274,6 @@ interface CalendarRegion {
|
|
|
273
274
|
* function that stops listening.
|
|
274
275
|
*/
|
|
275
276
|
export declare function observeCalendarRegions(observer: (regions: readonly CalendarRegion[]) => void): () => void;
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/resource-id.d.ts
|
|
278
277
|
/**
|
|
279
278
|
* Attributes that place an element in a resource, for spreading onto a resource's column, row, or
|
|
280
279
|
* cells. `data-resource-id` holds the ID as text, empty for the unassigned bucket (`null`); numeric
|
|
@@ -289,16 +288,4 @@ export declare function resourceIdAttributes(id: ResourceId | null): {
|
|
|
289
288
|
* unassigned bucket, `undefined` outside any resource.
|
|
290
289
|
*/
|
|
291
290
|
export declare function resourceIdOf(element: Element): ResourceId | null | undefined;
|
|
292
|
-
//#endregion
|
|
293
|
-
//#region src/use-calendar-pointer.d.ts
|
|
294
|
-
/**
|
|
295
|
-
* Pointer move, resize, and create for a view region; see `attachCalendarPointer` for the data
|
|
296
|
-
* attributes the view renders. Returns a ref for the region element. Options are read when a
|
|
297
|
-
* gesture starts, and `columns` again as it moves, so changing them never re-attaches listeners,
|
|
298
|
-
* and dragging never re-renders. `disabled` is the exception: a disabled region doesn't listen for
|
|
299
|
-
* touch moves, so a read-only calendar's swipes never wait for its listener, and changing it
|
|
300
|
-
* attaches the listeners again.
|
|
301
|
-
*/
|
|
302
|
-
export declare function useCalendarPointer<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(options: CalendarPointerOptions<TEvent, TEventId, TResourceId>): RefCallback<HTMLElement>;
|
|
303
|
-
//#endregion
|
|
304
291
|
export type { CalendarDragFollower, CalendarDragMonitor, CalendarDragPreview, CalendarDropOptions, CalendarDropSession, CalendarDropSource, CalendarEventDrag, CalendarPoint, CalendarPointerOptions, CalendarRect, CalendarRegion };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { belongsInTimeGridAllDayRow, createPlacementBetween, eventPlacement, formatPlacementRange, movePlacementToTarget, resizePlacementToTarget, showsInResource, splitEventsByDay, timeGridDateTimeAt, timedFragmentBox, timelineExtent } from "@moltenship/calendar-core";
|
|
1
|
+
import { belongsInTimeGridAllDayRow, createPlacementBetween, eventPlacement, formatPlacementRange, movePlacementToTarget, resizePlacementToTarget, showsInResource, slotDuration, splitEventsByDay, timeGridDateTimeAt, timedFragmentBox, timelineExtent } from "@moltenship/calendar-core";
|
|
3
2
|
import { comparePlainDates, instantInterval, plainDateInterval } from "@moltenship/calendar-temporal";
|
|
4
|
-
|
|
5
|
-
//#region src/auto-scroll.ts
|
|
3
|
+
// src/auto-scroll.ts
|
|
6
4
|
const EDGE = 48;
|
|
7
5
|
const MAXIMUM_STEP = 18;
|
|
8
6
|
/** Pixels to scroll this frame along one axis: faster the deeper the pointer is in an edge band. */
|
|
@@ -84,8 +82,7 @@ function autoScroll(container, x, y, sideways = container) {
|
|
|
84
82
|
sideways.scrollLeft += step(x, rect.left, rect.right);
|
|
85
83
|
return container.scrollTop !== scrollTop || sideways.scrollLeft !== scrollLeft;
|
|
86
84
|
}
|
|
87
|
-
|
|
88
|
-
//#region src/drags.ts
|
|
85
|
+
// src/drags.ts
|
|
89
86
|
const monitors = /* @__PURE__ */ new Set();
|
|
90
87
|
/** Reports an application callback's error without breaking the gesture it heard about. */
|
|
91
88
|
function reportCallbackError(error) {
|
|
@@ -138,8 +135,7 @@ function claimed(followers) {
|
|
|
138
135
|
}
|
|
139
136
|
});
|
|
140
137
|
}
|
|
141
|
-
|
|
142
|
-
//#region src/event-id.ts
|
|
138
|
+
// src/event-id.ts
|
|
143
139
|
/**
|
|
144
140
|
* Attributes that identify an event element, for spreading onto it. `data-event-id` holds the ID
|
|
145
141
|
* as text; numeric IDs add `data-event-id-type="number"`, so `1` and `"1"` stay distinct.
|
|
@@ -156,8 +152,7 @@ function eventIdOf(element) {
|
|
|
156
152
|
if (id === null) return null;
|
|
157
153
|
return element.getAttribute("data-event-id-type") === "number" ? Number(id) : id;
|
|
158
154
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/gestures.ts
|
|
155
|
+
// src/gestures.ts
|
|
161
156
|
/** The snapped time under the pointer. The keyboard reaches the same targets through slots. */
|
|
162
157
|
function interactionTarget(target, snap) {
|
|
163
158
|
return target.kind === "day" ? target : {
|
|
@@ -193,6 +188,42 @@ function createdPlacement(anchor, current, { snap }) {
|
|
|
193
188
|
};
|
|
194
189
|
return createPlacementBetween(interactionTarget(anchor, floor), interactionTarget(current, floor), { snap });
|
|
195
190
|
}
|
|
191
|
+
/** A free drag's drawn edge follows the pointer to the second; drops still land on slots. */
|
|
192
|
+
const FOLLOWING = {
|
|
193
|
+
increment: 1,
|
|
194
|
+
smallestUnit: "second"
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Where a free resize (`preview: "free"`) draws the event: its dragged edge under the pointer
|
|
198
|
+
* rather than on a slot, never shorter than one. For drawing only; `null` across axes or
|
|
199
|
+
* resources, as `resizedPlacement` is.
|
|
200
|
+
*/
|
|
201
|
+
function followedResize(original, edge, grab, current, options) {
|
|
202
|
+
if (grab.kind !== "time" || current.kind !== "time") return null;
|
|
203
|
+
return resizePlacementToTarget(original, edge, interactionTarget(grab, FOLLOWING), interactionTarget(current, FOLLOWING), options);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Where a free create draws its range: from the slot it started in to the pointer, at least that
|
|
207
|
+
* slot. For drawing only; `null` across axes or resources, as `createdPlacement` is.
|
|
208
|
+
*/
|
|
209
|
+
function followedCreate(anchor, current, { snap }) {
|
|
210
|
+
if (anchor.kind !== "time" || current.kind !== "time") return null;
|
|
211
|
+
if (anchor.resourceId !== current.resourceId) return null;
|
|
212
|
+
const start = timeGridDateTimeAt(anchor.column, anchor.y, { snap: {
|
|
213
|
+
...snap,
|
|
214
|
+
mode: "floor"
|
|
215
|
+
} });
|
|
216
|
+
const end = start.add(slotDuration(snap));
|
|
217
|
+
const at = timeGridDateTimeAt(current.column, current.y, { snap: FOLLOWING });
|
|
218
|
+
const resourceIds = anchor.resourceId == null ? [] : [anchor.resourceId];
|
|
219
|
+
const before = Temporal.ZonedDateTime.compare(at, start) < 0;
|
|
220
|
+
return {
|
|
221
|
+
end: (before || Temporal.ZonedDateTime.compare(at, end) < 0 ? end : at).toInstant(),
|
|
222
|
+
kind: "timed",
|
|
223
|
+
resourceIds,
|
|
224
|
+
start: (before ? at : start).toInstant()
|
|
225
|
+
};
|
|
226
|
+
}
|
|
196
227
|
/**
|
|
197
228
|
* Where an item dragged in from outside lands, starting at the slot or day under the pointer. A
|
|
198
229
|
* new event is `duration` long over a time column and `days` long over day cells, in the resource
|
|
@@ -231,8 +262,7 @@ function droppedPlacement(item, target, { snap, timeZone }) {
|
|
|
231
262
|
start: at.at.toInstant()
|
|
232
263
|
};
|
|
233
264
|
}
|
|
234
|
-
|
|
235
|
-
//#region src/resource-id.ts
|
|
265
|
+
// src/resource-id.ts
|
|
236
266
|
/**
|
|
237
267
|
* Attributes that place an element in a resource, for spreading onto a resource's column, row, or
|
|
238
268
|
* cells. `data-resource-id` holds the ID as text, empty for the unassigned bucket (`null`); numeric
|
|
@@ -256,8 +286,7 @@ function resourceIdOf(element) {
|
|
|
256
286
|
if (id === "") return null;
|
|
257
287
|
return holder.getAttribute("data-resource-id-type") === "number" ? Number(id) : id;
|
|
258
288
|
}
|
|
259
|
-
|
|
260
|
-
//#region src/targets.ts
|
|
289
|
+
// src/targets.ts
|
|
261
290
|
/** A view's time columns by ISO date, for matching `[data-date]` elements to them. */
|
|
262
291
|
function columnsByDate(columns) {
|
|
263
292
|
return new Map((columns ?? []).map((column) => [column.date.toString(), column]));
|
|
@@ -325,8 +354,7 @@ function targetAt(surface, x, y) {
|
|
|
325
354
|
}
|
|
326
355
|
return null;
|
|
327
356
|
}
|
|
328
|
-
|
|
329
|
-
//#region src/ghost.ts
|
|
357
|
+
// src/ghost.ts
|
|
330
358
|
function clips(overflow) {
|
|
331
359
|
return overflow !== "" && overflow !== "visible";
|
|
332
360
|
}
|
|
@@ -362,6 +390,10 @@ function visibleBounds(surface, cell, rectOf) {
|
|
|
362
390
|
}
|
|
363
391
|
return bounds;
|
|
364
392
|
}
|
|
393
|
+
/** Where an element's content can paint, read now: for one box, outside any layout pass. */
|
|
394
|
+
function visibleOf(surface, element) {
|
|
395
|
+
return visibleBounds(surface, element, (ancestor) => ancestor.getBoundingClientRect());
|
|
396
|
+
}
|
|
365
397
|
function isVisible({ height, left, top, visible, width }) {
|
|
366
398
|
return left < visible.right && left + width > visible.left && top < visible.bottom && top + height > visible.top;
|
|
367
399
|
}
|
|
@@ -509,22 +541,106 @@ function ghostValidity(check) {
|
|
|
509
541
|
return check.change.warnings !== void 0 && check.change.warnings.length > 0 ? "warning" : null;
|
|
510
542
|
}
|
|
511
543
|
/**
|
|
544
|
+
* How long a free preview takes to settle where it lands, unless the computed
|
|
545
|
+
* `transition-duration` says otherwise; see `--calendar-ghost-settle-duration`.
|
|
546
|
+
*/
|
|
547
|
+
const SETTLE_MS = 150;
|
|
548
|
+
const SETTLE_TRANSITION = [
|
|
549
|
+
"transform",
|
|
550
|
+
"width",
|
|
551
|
+
"height",
|
|
552
|
+
"clip-path"
|
|
553
|
+
].map((property) => `${property} var(--calendar-ghost-settle-duration, ${SETTLE_MS}ms) var(--calendar-ghost-settle-easing, ease-out)`).join(", ");
|
|
554
|
+
function prefersReducedMotion() {
|
|
555
|
+
return typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
556
|
+
}
|
|
557
|
+
/** The longest of an element's computed transition durations, in milliseconds. */
|
|
558
|
+
function transitionMs(element) {
|
|
559
|
+
const durations = getComputedStyle(element).transitionDuration.split(",").map((duration) => {
|
|
560
|
+
const value = Number.parseFloat(duration);
|
|
561
|
+
return duration.trim().endsWith("ms") ? value : value * 1e3;
|
|
562
|
+
}).filter(Number.isFinite);
|
|
563
|
+
return durations.length === 0 ? SETTLE_MS : Math.max(...durations);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Starts `segments` sliding to where `place` puts them, then removes them and `cleanup`'s parts.
|
|
567
|
+
* The current position is read first, so the change transitions from it.
|
|
568
|
+
*/
|
|
569
|
+
function settle(segments, place, cleanup) {
|
|
570
|
+
const remove = () => {
|
|
571
|
+
for (const segment of segments) segment.remove();
|
|
572
|
+
cleanup();
|
|
573
|
+
};
|
|
574
|
+
const [first] = segments;
|
|
575
|
+
if (first === void 0 || prefersReducedMotion()) {
|
|
576
|
+
remove();
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
for (const segment of segments) {
|
|
580
|
+
getComputedStyle(segment).transform;
|
|
581
|
+
segment.style.transition = SETTLE_TRANSITION;
|
|
582
|
+
segment.setAttribute("data-settling", "");
|
|
583
|
+
}
|
|
584
|
+
segments.forEach(place);
|
|
585
|
+
setTimeout(remove, transitionMs(first) + 20);
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Finds where a fixed `left: 0; top: 0` box actually sits. It is the viewport origin unless an
|
|
589
|
+
* ancestor is transformed, which makes that ancestor the containing block of fixed elements.
|
|
590
|
+
*/
|
|
591
|
+
var OriginProbe = class {
|
|
592
|
+
#element = null;
|
|
593
|
+
#region;
|
|
594
|
+
constructor(region) {
|
|
595
|
+
this.#region = region;
|
|
596
|
+
}
|
|
597
|
+
measure() {
|
|
598
|
+
if (this.#element === null) {
|
|
599
|
+
this.#element = document.createElement("div");
|
|
600
|
+
this.#element.setAttribute("aria-hidden", "true");
|
|
601
|
+
this.#element.setAttribute("data-calendar-ghost-origin", "");
|
|
602
|
+
Object.assign(this.#element.style, {
|
|
603
|
+
height: "0",
|
|
604
|
+
left: "0",
|
|
605
|
+
pointerEvents: "none",
|
|
606
|
+
position: "fixed",
|
|
607
|
+
top: "0",
|
|
608
|
+
visibility: "hidden",
|
|
609
|
+
width: "0"
|
|
610
|
+
});
|
|
611
|
+
this.#region.append(this.#element);
|
|
612
|
+
}
|
|
613
|
+
return this.#element.getBoundingClientRect();
|
|
614
|
+
}
|
|
615
|
+
remove() {
|
|
616
|
+
this.#element?.remove();
|
|
617
|
+
this.#element = null;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
/**
|
|
512
621
|
* Fixed-position preview segments, moved with transforms so a drag never re-renders the view, and
|
|
513
622
|
* clipped to their cells' scroll viewports. Segments are translucent clones of the dragged event,
|
|
514
623
|
* or range boxes for creates and day cells; style them through `[data-calendar-ghost]` or the
|
|
515
624
|
* `--calendar-ghost-*` custom properties. A clone's `[data-event-time]` shows `label`, and
|
|
516
625
|
* `data-invalid` or `data-warning` marks a drop the policies would reject or flag. A clone that
|
|
517
626
|
* follows the pointer outside the view, toward a drop zone of the app's, has `data-outside`.
|
|
627
|
+
*
|
|
628
|
+
* A `"landing"` layer draws the boxes where a free drag (`preview: "free"`) would land, as
|
|
629
|
+
* `[data-calendar-ghost="landing"]`, styled through `--calendar-ghost-landing-background` and
|
|
630
|
+
* `--calendar-ghost-landing-shadow`.
|
|
518
631
|
*/
|
|
519
632
|
var GhostLayer = class {
|
|
520
633
|
#className;
|
|
521
|
-
#
|
|
634
|
+
#kind;
|
|
522
635
|
#outside = false;
|
|
636
|
+
#origin;
|
|
523
637
|
#region;
|
|
524
638
|
#segments = [];
|
|
525
639
|
#template = null;
|
|
526
|
-
constructor(region, className) {
|
|
640
|
+
constructor(region, className, kind = "preview") {
|
|
527
641
|
this.#className = className;
|
|
642
|
+
this.#kind = kind;
|
|
643
|
+
this.#origin = new OriginProbe(region);
|
|
528
644
|
this.#region = region;
|
|
529
645
|
}
|
|
530
646
|
/**
|
|
@@ -540,21 +656,10 @@ var GhostLayer = class {
|
|
|
540
656
|
while (this.#segments.length < rects.length) this.#segments.push(this.#createSegment());
|
|
541
657
|
while (this.#segments.length > rects.length) this.#segments.pop().remove();
|
|
542
658
|
if (rects.length === 0) return;
|
|
543
|
-
const origin = this.#
|
|
659
|
+
const origin = this.#origin.measure();
|
|
544
660
|
rects.forEach((rect, index) => {
|
|
545
661
|
const segment = this.#segments[index];
|
|
546
|
-
|
|
547
|
-
const { height, left, top, visible, width } = rect;
|
|
548
|
-
const insets = [
|
|
549
|
-
visible.top - top,
|
|
550
|
-
left + width - visible.right,
|
|
551
|
-
top + height - visible.bottom,
|
|
552
|
-
visible.left - left
|
|
553
|
-
].map((inset) => Math.max(0, inset));
|
|
554
|
-
style.width = `${width}px`;
|
|
555
|
-
style.height = `${height}px`;
|
|
556
|
-
style.transform = `translate3d(${left - origin.left}px, ${top - origin.top}px, 0)`;
|
|
557
|
-
style.clipPath = insets.some((inset) => inset > 0) ? `inset(${insets.map((inset) => `${inset}px`).join(" ")})` : "";
|
|
662
|
+
this.#place(segment, rect, origin);
|
|
558
663
|
segment.toggleAttribute("data-invalid", validity === "invalid");
|
|
559
664
|
segment.toggleAttribute("data-warning", validity === "warning");
|
|
560
665
|
segment.toggleAttribute("data-outside", outside);
|
|
@@ -565,67 +670,258 @@ var GhostLayer = class {
|
|
|
565
670
|
clear() {
|
|
566
671
|
for (const segment of this.#segments) segment.remove();
|
|
567
672
|
this.#segments.length = 0;
|
|
568
|
-
this.#origin
|
|
569
|
-
this.#origin = null;
|
|
673
|
+
this.#origin.remove();
|
|
570
674
|
}
|
|
571
675
|
/**
|
|
572
|
-
*
|
|
573
|
-
*
|
|
676
|
+
* Slides the segments onto `rects`, one for one, and removes them once there; without as many
|
|
677
|
+
* rects, or under reduced motion, removes them at once. The layer is left empty for reuse.
|
|
574
678
|
*/
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
pointerEvents: "none",
|
|
584
|
-
position: "fixed",
|
|
585
|
-
top: "0",
|
|
586
|
-
visibility: "hidden",
|
|
587
|
-
width: "0"
|
|
588
|
-
});
|
|
589
|
-
this.#region.append(this.#origin);
|
|
679
|
+
settle(rects) {
|
|
680
|
+
const segments = this.#segments.splice(0);
|
|
681
|
+
const origin = this.#origin;
|
|
682
|
+
this.#origin = new OriginProbe(this.#region);
|
|
683
|
+
if (rects.length !== segments.length) {
|
|
684
|
+
for (const segment of segments) segment.remove();
|
|
685
|
+
origin.remove();
|
|
686
|
+
return;
|
|
590
687
|
}
|
|
591
|
-
|
|
688
|
+
const at = origin.measure();
|
|
689
|
+
settle(segments, (segment, index) => this.#place(segment, rects[index], at), () => origin.remove());
|
|
690
|
+
}
|
|
691
|
+
#place(segment, rect, origin) {
|
|
692
|
+
const { style } = segment;
|
|
693
|
+
const { height, left, top, visible, width } = rect;
|
|
694
|
+
const insets = [
|
|
695
|
+
visible.top - top,
|
|
696
|
+
left + width - visible.right,
|
|
697
|
+
top + height - visible.bottom,
|
|
698
|
+
visible.left - left
|
|
699
|
+
].map((inset) => Math.max(0, inset));
|
|
700
|
+
style.width = `${width}px`;
|
|
701
|
+
style.height = `${height}px`;
|
|
702
|
+
style.transform = `translate3d(${left - origin.left}px, ${top - origin.top}px, 0)`;
|
|
703
|
+
style.clipPath = insets.some((inset) => inset > 0) ? `inset(${insets.map((inset) => `${inset}px`).join(" ")})` : "";
|
|
592
704
|
}
|
|
593
705
|
#createSegment() {
|
|
594
706
|
const template = this.#template;
|
|
595
|
-
|
|
596
|
-
for (const attribute of [
|
|
597
|
-
"data-dragging",
|
|
598
|
-
"data-event-id",
|
|
599
|
-
"data-event-id-type",
|
|
600
|
-
"id"
|
|
601
|
-
]) segment.removeAttribute(attribute);
|
|
602
|
-
segment.setAttribute("aria-hidden", "true");
|
|
603
|
-
segment.setAttribute("data-calendar-ghost", template === null ? "range" : "event");
|
|
604
|
-
if (this.#className !== void 0) segment.classList.add(...this.#className.split(/\s+/).filter(Boolean));
|
|
605
|
-
Object.assign(segment.style, {
|
|
606
|
-
bottom: "auto",
|
|
607
|
-
boxSizing: "border-box",
|
|
608
|
-
left: "0",
|
|
609
|
-
margin: "0",
|
|
610
|
-
pointerEvents: "none",
|
|
611
|
-
position: "fixed",
|
|
612
|
-
right: "auto",
|
|
613
|
-
top: "0",
|
|
614
|
-
zIndex: "var(--calendar-ghost-z-index, 50)"
|
|
615
|
-
});
|
|
616
|
-
Object.assign(segment.style, template === null ? {
|
|
617
|
-
background: "var(--calendar-ghost-background, rgb(37 99 235 / 0.18))",
|
|
618
|
-
borderRadius: "var(--calendar-ghost-radius, 6px)"
|
|
619
|
-
} : {
|
|
620
|
-
boxShadow: "var(--calendar-ghost-shadow, 0 6px 16px rgb(0 0 0 / 0.18))",
|
|
621
|
-
opacity: "var(--calendar-ghost-opacity, 0.75)"
|
|
622
|
-
});
|
|
623
|
-
this.#region.append(segment);
|
|
624
|
-
return segment;
|
|
707
|
+
return ghostSegment(this.#region, template, this.#className, this.#kind === "landing" ? "landing" : template === null ? "range" : "event");
|
|
625
708
|
}
|
|
626
709
|
};
|
|
627
|
-
|
|
628
|
-
|
|
710
|
+
/**
|
|
711
|
+
* A see-through copy of `template`, or a range box without one, fixed over the view: the parts of
|
|
712
|
+
* every preview.
|
|
713
|
+
*/
|
|
714
|
+
function ghostSegment(region, template, className, kind) {
|
|
715
|
+
const segment = template === null ? document.createElement("div") : template.cloneNode(true);
|
|
716
|
+
for (const attribute of [
|
|
717
|
+
"data-dragging",
|
|
718
|
+
"data-event-id",
|
|
719
|
+
"data-event-id-type",
|
|
720
|
+
"id"
|
|
721
|
+
]) segment.removeAttribute(attribute);
|
|
722
|
+
segment.setAttribute("aria-hidden", "true");
|
|
723
|
+
segment.setAttribute("data-calendar-ghost", kind);
|
|
724
|
+
if (className !== void 0) segment.classList.add(...className.split(/\s+/).filter(Boolean));
|
|
725
|
+
Object.assign(segment.style, {
|
|
726
|
+
bottom: "auto",
|
|
727
|
+
boxSizing: "border-box",
|
|
728
|
+
left: "0",
|
|
729
|
+
margin: "0",
|
|
730
|
+
pointerEvents: "none",
|
|
731
|
+
position: "fixed",
|
|
732
|
+
right: "auto",
|
|
733
|
+
top: "0",
|
|
734
|
+
zIndex: kind === "landing" ? "calc(var(--calendar-ghost-z-index, 50) - 1)" : "var(--calendar-ghost-z-index, 50)"
|
|
735
|
+
});
|
|
736
|
+
Object.assign(segment.style, kind === "landing" ? {
|
|
737
|
+
background: "var(--calendar-ghost-landing-background, rgb(37 99 235 / 0.1))",
|
|
738
|
+
borderRadius: "var(--calendar-ghost-radius, 6px)",
|
|
739
|
+
boxShadow: "var(--calendar-ghost-landing-shadow, inset 0 0 0 1.5px rgb(37 99 235 / 0.45))"
|
|
740
|
+
} : template === null ? {
|
|
741
|
+
background: "var(--calendar-ghost-background, rgb(37 99 235 / 0.18))",
|
|
742
|
+
borderRadius: "var(--calendar-ghost-radius, 6px)"
|
|
743
|
+
} : {
|
|
744
|
+
boxShadow: "var(--calendar-ghost-shadow, 0 6px 16px rgb(0 0 0 / 0.18))",
|
|
745
|
+
opacity: "var(--calendar-ghost-opacity, 0.75)"
|
|
746
|
+
});
|
|
747
|
+
region.append(segment);
|
|
748
|
+
return segment;
|
|
749
|
+
}
|
|
750
|
+
/** The most of a long or wide event a copy that follows the pointer outside the view shows. */
|
|
751
|
+
const FLOATING_MAXIMUM = {
|
|
752
|
+
height: 120,
|
|
753
|
+
width: 320
|
|
754
|
+
};
|
|
755
|
+
function viewportBounds() {
|
|
756
|
+
return {
|
|
757
|
+
bottom: innerHeight,
|
|
758
|
+
left: 0,
|
|
759
|
+
right: innerWidth,
|
|
760
|
+
top: 0
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* A `clip-path` that hides what of `box` falls outside `bounds`. Insets are always given, and
|
|
765
|
+
* negative where nothing clips, so the clip transitions with the box and keeps the shadow.
|
|
766
|
+
*/
|
|
767
|
+
function clipTo({ height, left, top, width }, bounds) {
|
|
768
|
+
return `inset(${[
|
|
769
|
+
bounds.top - top,
|
|
770
|
+
left + width - bounds.right,
|
|
771
|
+
top + height - bounds.bottom,
|
|
772
|
+
bounds.left - left
|
|
773
|
+
].map((inset) => `${Math.max(-32, inset)}px`).join(" ")})`;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* The copy of a moved event that a free drag (`preview: "free"`) moves with the pointer, pixel for
|
|
777
|
+
* pixel: the event's box at the press, carried by how far the pointer has gone since. Over the view
|
|
778
|
+
* it keeps the event's size and is clipped where the cell it would land in may paint, as scrolled
|
|
779
|
+
* content is; off the view it shrinks to at most `FLOATING_MAXIMUM` around the press, as the copy
|
|
780
|
+
* of a snapped drag does there. Its `[data-event-time]` shows the range a drop would propose;
|
|
781
|
+
* `data-outside` marks it where there's nothing to drop on.
|
|
782
|
+
*/
|
|
783
|
+
var GhostClone = class {
|
|
784
|
+
#bounds;
|
|
785
|
+
#box;
|
|
786
|
+
#element;
|
|
787
|
+
#floating;
|
|
788
|
+
#floats = false;
|
|
789
|
+
#home;
|
|
790
|
+
#label = null;
|
|
791
|
+
#origin;
|
|
792
|
+
#probe;
|
|
793
|
+
#press;
|
|
794
|
+
#point;
|
|
795
|
+
/** The time labels and what they said, restored where there's nothing to drop on. */
|
|
796
|
+
#times;
|
|
797
|
+
#validity = null;
|
|
798
|
+
#outside = false;
|
|
799
|
+
/** `visible` is where the event may paint at the press. */
|
|
800
|
+
constructor(region, template, className, press, visible) {
|
|
801
|
+
const rect = template.getBoundingClientRect();
|
|
802
|
+
this.#box = {
|
|
803
|
+
height: rect.height,
|
|
804
|
+
left: rect.left,
|
|
805
|
+
top: rect.top,
|
|
806
|
+
width: rect.width
|
|
807
|
+
};
|
|
808
|
+
const width = Math.min(rect.width, FLOATING_MAXIMUM.width);
|
|
809
|
+
const height = Math.min(rect.height, FLOATING_MAXIMUM.height);
|
|
810
|
+
this.#floating = {
|
|
811
|
+
height,
|
|
812
|
+
offset: {
|
|
813
|
+
x: Math.min(Math.max(press.x - rect.left, 0), width),
|
|
814
|
+
y: Math.min(Math.max(press.y - rect.top, 0), height)
|
|
815
|
+
},
|
|
816
|
+
width
|
|
817
|
+
};
|
|
818
|
+
this.#bounds = visible;
|
|
819
|
+
this.#home = visible;
|
|
820
|
+
this.#press = press;
|
|
821
|
+
this.#point = press;
|
|
822
|
+
this.#probe = new OriginProbe(region);
|
|
823
|
+
this.#origin = this.#probe.measure();
|
|
824
|
+
this.#element = ghostSegment(region, template, className, "event");
|
|
825
|
+
this.#resize(this.#box);
|
|
826
|
+
this.#element.style.clipPath = clipTo(this.#box, visible);
|
|
827
|
+
this.#times = [...this.#element.querySelectorAll("[data-event-time]")].map((time) => [time, time.textContent]);
|
|
828
|
+
}
|
|
829
|
+
/** The event's box at the press, and where it could paint then. */
|
|
830
|
+
get home() {
|
|
831
|
+
return {
|
|
832
|
+
...this.#box,
|
|
833
|
+
visible: this.#home
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
/** The copy's box now, in viewport coordinates. */
|
|
837
|
+
get rect() {
|
|
838
|
+
if (this.#floats) {
|
|
839
|
+
const { height, offset, width } = this.#floating;
|
|
840
|
+
return {
|
|
841
|
+
height,
|
|
842
|
+
left: this.#point.x - offset.x,
|
|
843
|
+
top: this.#point.y - offset.y,
|
|
844
|
+
width
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
return {
|
|
848
|
+
...this.#box,
|
|
849
|
+
left: this.#box.left + this.#point.x - this.#press.x,
|
|
850
|
+
top: this.#box.top + this.#point.y - this.#press.y
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
/** Clips the copy, from its next move, to where a cell's content may paint. */
|
|
854
|
+
clip(bounds) {
|
|
855
|
+
this.#bounds = bounds;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Shrinks the copy, from its next move, to at most `FLOATING_MAXIMUM` around the press, off the
|
|
859
|
+
* view or over a drop zone of the app's; `false` gives it the event's size again.
|
|
860
|
+
*/
|
|
861
|
+
float(floats) {
|
|
862
|
+
if (floats === this.#floats) return;
|
|
863
|
+
this.#floats = floats;
|
|
864
|
+
this.#resize(this.rect);
|
|
865
|
+
}
|
|
866
|
+
/** Puts the copy under the pointer: a transform and a clip. */
|
|
867
|
+
follow(point) {
|
|
868
|
+
this.#point = point;
|
|
869
|
+
const box = this.rect;
|
|
870
|
+
this.#element.style.transform = this.#translate(box);
|
|
871
|
+
this.#element.style.clipPath = clipTo(box, this.#floats ? viewportBounds() : this.#bounds);
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Shows the range a drop would propose, or the event's own with `null`, and what the policies
|
|
875
|
+
* say; `outside` marks the copy where there's nothing to drop on.
|
|
876
|
+
*/
|
|
877
|
+
mark(label, validity, outside) {
|
|
878
|
+
if (label !== this.#label) {
|
|
879
|
+
this.#label = label;
|
|
880
|
+
for (const [time, text] of this.#times) time.textContent = label ?? text;
|
|
881
|
+
}
|
|
882
|
+
if (validity !== this.#validity) {
|
|
883
|
+
this.#validity = validity;
|
|
884
|
+
this.#element.toggleAttribute("data-invalid", validity === "invalid");
|
|
885
|
+
this.#element.toggleAttribute("data-warning", validity === "warning");
|
|
886
|
+
}
|
|
887
|
+
if (outside !== this.#outside) {
|
|
888
|
+
this.#outside = outside;
|
|
889
|
+
this.#element.toggleAttribute("data-outside", outside);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
/** Finds the fixed-position origin again, after a scroll that may have carried it. */
|
|
893
|
+
measure() {
|
|
894
|
+
this.#origin = this.#probe.measure();
|
|
895
|
+
this.follow(this.#point);
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Slides the copy onto `target`, its clip onto `target.visible`, and removes it there; at once
|
|
899
|
+
* without a target.
|
|
900
|
+
*/
|
|
901
|
+
settle(target) {
|
|
902
|
+
if (target === null) {
|
|
903
|
+
this.remove();
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
settle([this.#element], ({ style }) => {
|
|
907
|
+
this.#resize(target);
|
|
908
|
+
style.transform = this.#translate(target);
|
|
909
|
+
style.clipPath = clipTo(target, target.visible);
|
|
910
|
+
}, () => this.#probe.remove());
|
|
911
|
+
}
|
|
912
|
+
remove() {
|
|
913
|
+
this.#element.remove();
|
|
914
|
+
this.#probe.remove();
|
|
915
|
+
}
|
|
916
|
+
#resize({ height, width }) {
|
|
917
|
+
this.#element.style.width = `${width}px`;
|
|
918
|
+
this.#element.style.height = `${height}px`;
|
|
919
|
+
}
|
|
920
|
+
#translate({ left, top }) {
|
|
921
|
+
return `translate3d(${left - this.#origin.left}px, ${top - this.#origin.top}px, 0)`;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
// src/outcome.ts
|
|
629
925
|
/**
|
|
630
926
|
* Announces what became of a proposal from what `onPropose` returned: the transaction's result, or
|
|
631
927
|
* from a handler that returns none, a commit of what was proposed. Resolves with the result, or
|
|
@@ -652,8 +948,7 @@ function settleProposal(returned, proposed, announce) {
|
|
|
652
948
|
return result;
|
|
653
949
|
});
|
|
654
950
|
}
|
|
655
|
-
|
|
656
|
-
//#region src/regions.ts
|
|
951
|
+
// src/regions.ts
|
|
657
952
|
const regions = /* @__PURE__ */ new Set();
|
|
658
953
|
const observers = /* @__PURE__ */ new Set();
|
|
659
954
|
function isEnabled(region) {
|
|
@@ -717,8 +1012,7 @@ function regionAt(x, y) {
|
|
|
717
1012
|
} : null;
|
|
718
1013
|
return null;
|
|
719
1014
|
}
|
|
720
|
-
|
|
721
|
-
//#region src/attach-calendar-pointer.ts
|
|
1015
|
+
// src/attach-calendar-pointer.ts
|
|
722
1016
|
const DEFAULT_SNAP$1 = {
|
|
723
1017
|
increment: 15,
|
|
724
1018
|
smallestUnit: "minute"
|
|
@@ -731,11 +1025,6 @@ const DRAG_DISTANCE = 4;
|
|
|
731
1025
|
*/
|
|
732
1026
|
const LONG_PRESS_MS = 450;
|
|
733
1027
|
const TOUCH_TOLERANCE = 8;
|
|
734
|
-
/** The most of a long or wide event the copy that follows the pointer outside the view shows. */
|
|
735
|
-
const FLOATING_MAXIMUM = {
|
|
736
|
-
height: 120,
|
|
737
|
-
width: 320
|
|
738
|
-
};
|
|
739
1028
|
const noFollowers = Object.freeze([]);
|
|
740
1029
|
const pointerInput = Object.freeze({ input: "pointer" });
|
|
741
1030
|
function preventDefault(event) {
|
|
@@ -796,6 +1085,41 @@ function floatingRect({ height, offset, width }, point) {
|
|
|
796
1085
|
width
|
|
797
1086
|
};
|
|
798
1087
|
}
|
|
1088
|
+
function renderedBox(element) {
|
|
1089
|
+
const { height, left, top, width } = element.getBoundingClientRect();
|
|
1090
|
+
return {
|
|
1091
|
+
element,
|
|
1092
|
+
height,
|
|
1093
|
+
left,
|
|
1094
|
+
top,
|
|
1095
|
+
width
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
/** Whether two boxes are the same to within half a pixel. */
|
|
1099
|
+
function sameBox(left, right) {
|
|
1100
|
+
return Math.abs(left.left - right.left) < .5 && Math.abs(left.top - right.top) < .5 && Math.abs(left.width - right.width) < .5 && Math.abs(left.height - right.height) < .5;
|
|
1101
|
+
}
|
|
1102
|
+
function center({ height, left, top, width }) {
|
|
1103
|
+
return {
|
|
1104
|
+
x: left + width / 2,
|
|
1105
|
+
y: top + height / 2
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
/** The box nearest `near`, by their centres. */
|
|
1109
|
+
function nearest(boxes, near) {
|
|
1110
|
+
const { x, y } = center(near);
|
|
1111
|
+
let best = null;
|
|
1112
|
+
let distance = Infinity;
|
|
1113
|
+
for (const box of boxes) {
|
|
1114
|
+
const point = center(box);
|
|
1115
|
+
const next = Math.hypot(point.x - x, point.y - y);
|
|
1116
|
+
if (next < distance) {
|
|
1117
|
+
best = box;
|
|
1118
|
+
distance = next;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return best;
|
|
1122
|
+
}
|
|
799
1123
|
/**
|
|
800
1124
|
* The event an element renders. Without `data-event-id-type`, an ID that only exists as a number
|
|
801
1125
|
* still resolves, which keeps all-numeric calendars working with plain `data-event-id`.
|
|
@@ -832,6 +1156,20 @@ function resolveEvent(events, element) {
|
|
|
832
1156
|
*/
|
|
833
1157
|
function attachCalendarPointer(region, getOptions) {
|
|
834
1158
|
let session = null;
|
|
1159
|
+
/**
|
|
1160
|
+
* The last touch's pressed element, which keeps its `touchmove` listener until the finger
|
|
1161
|
+
* lifts. The gesture ends as the page starts scrolling under the finger, and in Chromium's touch
|
|
1162
|
+
* emulation, a change to the page's touch listeners then could stop that scroll after its first
|
|
1163
|
+
* step. So the region hears the lift through listeners it has from the start.
|
|
1164
|
+
*/
|
|
1165
|
+
let lastTouch = null;
|
|
1166
|
+
function releaseLastTouch() {
|
|
1167
|
+
lastTouch?.removeEventListener("touchmove", onTouchMove);
|
|
1168
|
+
lastTouch = null;
|
|
1169
|
+
}
|
|
1170
|
+
function onTouchLift(event) {
|
|
1171
|
+
if ((event.touches?.length ?? 0) === 0) releaseLastTouch();
|
|
1172
|
+
}
|
|
835
1173
|
function placementAt(current, target) {
|
|
836
1174
|
const { gesture, options } = current;
|
|
837
1175
|
if (gesture.kind === "create") return createdPlacement(gesture.anchor, target, options);
|
|
@@ -892,7 +1230,8 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
892
1230
|
const changed = current.placement !== null;
|
|
893
1231
|
current.placement = null;
|
|
894
1232
|
current.check = null;
|
|
895
|
-
showOutside(current);
|
|
1233
|
+
if (current.free === void 0) showOutside(current);
|
|
1234
|
+
else followOutside(current, current.free);
|
|
896
1235
|
if (changed) {
|
|
897
1236
|
getOptions().onPreview?.(null);
|
|
898
1237
|
show(current, () => null);
|
|
@@ -900,11 +1239,14 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
900
1239
|
return changed;
|
|
901
1240
|
}
|
|
902
1241
|
const changed = current.placement === null || !samePlacement(current.placement, placement);
|
|
903
|
-
if (!scrolled && !changed)
|
|
1242
|
+
if (!scrolled && !changed) {
|
|
1243
|
+
if (current.free !== void 0) drawFree(current, current.free, target, false);
|
|
1244
|
+
return false;
|
|
1245
|
+
}
|
|
904
1246
|
current.placement = placement;
|
|
905
1247
|
if (changed) {
|
|
906
1248
|
const proposed = proposal(current);
|
|
907
|
-
current.check = proposed === null ? null : getOptions().check?.(proposed) ?? null;
|
|
1249
|
+
current.check = proposed === null ? null : getOptions().check?.(proposed, pointerInput) ?? null;
|
|
908
1250
|
getOptions().onPreview?.({
|
|
909
1251
|
eventId: current.gesture.kind === "create" ? null : current.gesture.event.id,
|
|
910
1252
|
proposed: placement
|
|
@@ -915,7 +1257,16 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
915
1257
|
const template = layout.axis === "time" && gesture.kind !== "create" ? gesture.element : null;
|
|
916
1258
|
const label = template === null ? null : current.announcer?.formatRange(placement) ?? formatPlacementRange(placement, { timeZone: current.options.timeZone });
|
|
917
1259
|
const validity = ghostValidity(current.check);
|
|
918
|
-
current.ghost.render(layout.rects, template, label, validity);
|
|
1260
|
+
if (current.free === void 0) current.ghost.render(layout.rects, template, label, validity);
|
|
1261
|
+
else {
|
|
1262
|
+
Object.assign(current.free, {
|
|
1263
|
+
label,
|
|
1264
|
+
layout,
|
|
1265
|
+
validity
|
|
1266
|
+
});
|
|
1267
|
+
if (scrolled) current.free.clone?.measure();
|
|
1268
|
+
drawFree(current, current.free, target, true);
|
|
1269
|
+
}
|
|
919
1270
|
show(current, () => ({
|
|
920
1271
|
label,
|
|
921
1272
|
rects: layout.rects.map(viewportRect),
|
|
@@ -923,6 +1274,126 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
923
1274
|
}));
|
|
924
1275
|
return changed;
|
|
925
1276
|
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Draws a free drag (`preview: "free"`) over `target`: a moved event's copy under the pointer
|
|
1279
|
+
* over the landing boxes, or a resize's or create's edge under the pointer on a time axis.
|
|
1280
|
+
* `laidOut` says the snapped preview was laid out again; when it wasn't, a move only moves its
|
|
1281
|
+
* copy.
|
|
1282
|
+
*/
|
|
1283
|
+
function drawFree(current, free, target, laidOut) {
|
|
1284
|
+
const { gesture } = current;
|
|
1285
|
+
const { label, layout, validity } = free;
|
|
1286
|
+
if (layout === null) return;
|
|
1287
|
+
if (gesture.kind === "move") {
|
|
1288
|
+
const { clone } = free;
|
|
1289
|
+
if (clone === void 0) return;
|
|
1290
|
+
clone.float(false);
|
|
1291
|
+
if (laidOut) {
|
|
1292
|
+
free.marker.render(layout.rects, null, null, validity);
|
|
1293
|
+
clone.mark(label, validity, false);
|
|
1294
|
+
const landing = nearest(layout.rects, clone.rect);
|
|
1295
|
+
if (landing !== null) clone.clip(landing.visible);
|
|
1296
|
+
}
|
|
1297
|
+
clone.follow(current.point);
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
const template = layout.axis === "time" && gesture.kind === "resize" ? gesture.element : null;
|
|
1301
|
+
const followed = layout.axis !== "time" ? null : gesture.kind === "create" ? followedCreate(gesture.anchor, target, current.options) : followedResize(gesture.original, gesture.edge, gesture.grab, target, current.options);
|
|
1302
|
+
if (followed === null) {
|
|
1303
|
+
free.marker.clear();
|
|
1304
|
+
if (laidOut) current.ghost.render(layout.rects, template, label, validity);
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
if (laidOut) free.marker.render(layout.rects, null, null, validity);
|
|
1308
|
+
const drawn = ghostLayout(current.surface, followed, current.options.timeZone);
|
|
1309
|
+
current.ghost.render(drawn.rects, template, label, validity);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Where a free drag has nothing to drop on: no landing, and a moved event's copy marked so. Off
|
|
1313
|
+
* the view, or over a drop zone of the app's, the copy shrinks as a snapped drag's does; over a
|
|
1314
|
+
* header of the view it keeps its size and its last cell's clip.
|
|
1315
|
+
*/
|
|
1316
|
+
function followOutside(current, free) {
|
|
1317
|
+
free.marker.clear();
|
|
1318
|
+
current.ghost.clear();
|
|
1319
|
+
const { clone } = free;
|
|
1320
|
+
if (clone === void 0) return;
|
|
1321
|
+
clone.mark(null, null, true);
|
|
1322
|
+
clone.float(current.claimed || !overView(current.point));
|
|
1323
|
+
clone.follow(current.point);
|
|
1324
|
+
}
|
|
1325
|
+
/** Where the view renders the event now: a box per segment it shows. */
|
|
1326
|
+
function renderedBoxes(id) {
|
|
1327
|
+
const boxes = [];
|
|
1328
|
+
for (const element of region.querySelectorAll("[data-event-id]")) {
|
|
1329
|
+
if (String(eventIdOf(element)) !== String(id)) continue;
|
|
1330
|
+
const box = renderedBox(element);
|
|
1331
|
+
if (box.width > 0 || box.height > 0) boxes.push(box);
|
|
1332
|
+
}
|
|
1333
|
+
return boxes;
|
|
1334
|
+
}
|
|
1335
|
+
/** A rendered box as a target to settle on, clipped where its element may paint. */
|
|
1336
|
+
function settleTarget(current, box) {
|
|
1337
|
+
if (box === null) return null;
|
|
1338
|
+
const { element, ...rest } = box;
|
|
1339
|
+
return {
|
|
1340
|
+
...rest,
|
|
1341
|
+
visible: visibleOf(current.surface, element)
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Ends a free drag's preview: `"drop"` slides it to where the drop lands, `"home"` back to the
|
|
1346
|
+
* event, and `null` removes it, as for a drop zone of the app's. A drop waits a frame, for a
|
|
1347
|
+
* refusal the policies or the app give at once and for the view to render the change.
|
|
1348
|
+
*/
|
|
1349
|
+
function settleFree(current, free, to) {
|
|
1350
|
+
free.marker.clear();
|
|
1351
|
+
const { gesture } = current;
|
|
1352
|
+
const refused = () => free.refused || free.validity === "invalid";
|
|
1353
|
+
if (gesture.kind !== "move") {
|
|
1354
|
+
const { layout } = free;
|
|
1355
|
+
if (to !== "drop" || layout === null || refused()) {
|
|
1356
|
+
current.ghost.clear();
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
requestAnimationFrame(() => {
|
|
1360
|
+
if (refused()) current.ghost.clear();
|
|
1361
|
+
else current.ghost.settle(layout.rects);
|
|
1362
|
+
});
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
const { clone } = free;
|
|
1366
|
+
if (clone === void 0) return;
|
|
1367
|
+
if (to === null || prefersReducedMotion()) {
|
|
1368
|
+
clone.remove();
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
const from = clone.rect;
|
|
1372
|
+
const { id } = gesture.event;
|
|
1373
|
+
if (to === "home") {
|
|
1374
|
+
clone.settle(gesture.element.isConnected ? settleTarget(current, renderedBox(gesture.element)) : settleTarget(current, nearest(renderedBoxes(id), from)));
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const { layout } = free;
|
|
1378
|
+
const landing = layout === null ? null : nearest(layout.rects, from);
|
|
1379
|
+
const fallback = landing === null ? null : {
|
|
1380
|
+
height: layout.axis === "time" ? landing.height : Math.min(from.height, landing.height),
|
|
1381
|
+
left: landing.left,
|
|
1382
|
+
top: landing.top,
|
|
1383
|
+
visible: landing.visible,
|
|
1384
|
+
width: Math.min(from.width, landing.width)
|
|
1385
|
+
};
|
|
1386
|
+
const before = renderedBoxes(id);
|
|
1387
|
+
requestAnimationFrame(() => {
|
|
1388
|
+
const after = renderedBoxes(id);
|
|
1389
|
+
if (refused()) {
|
|
1390
|
+
clone.settle(settleTarget(current, nearest(after, from)) ?? clone.home);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
const moved = after.filter((box) => !before.some((old) => sameBox(old, box)));
|
|
1394
|
+
clone.settle(settleTarget(current, nearest(moved, from)) ?? fallback);
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
926
1397
|
/** Tells the followers what the preview shows now. */
|
|
927
1398
|
function show(current, shown) {
|
|
928
1399
|
if (current.followers.length === 0) return;
|
|
@@ -955,7 +1426,10 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
955
1426
|
region.setAttribute("data-interaction", current.gesture.kind);
|
|
956
1427
|
if (current.gesture.kind !== "create") current.gesture.element.setAttribute("data-dragging", "");
|
|
957
1428
|
getSelection()?.removeAllRanges();
|
|
958
|
-
if (current.gesture.kind === "move")
|
|
1429
|
+
if (current.gesture.kind === "move") {
|
|
1430
|
+
follow(current, current.gesture);
|
|
1431
|
+
if (current.free !== void 0) current.free.clone = new GhostClone(region, current.gesture.element, current.free.className, current.origin, visibleOf(current.surface, current.gesture.element));
|
|
1432
|
+
}
|
|
959
1433
|
trackEdges(current);
|
|
960
1434
|
current.frame = requestAnimationFrame(scrollFrame);
|
|
961
1435
|
preview(current);
|
|
@@ -972,34 +1446,39 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
972
1446
|
}
|
|
973
1447
|
});
|
|
974
1448
|
current.zones = current.followers.some((follower) => follower.claims !== void 0);
|
|
975
|
-
if (current.zones) current.floating = floatingOf(element, current.origin);
|
|
1449
|
+
if (current.zones && current.free === void 0) current.floating = floatingOf(element, current.origin);
|
|
976
1450
|
tellFollowers(current.followers, (follower) => follower.move?.(current.point));
|
|
977
1451
|
}
|
|
978
1452
|
/**
|
|
979
1453
|
* Ends the gesture; `dropped` tells its followers a drop zone of theirs took it, and `landing`
|
|
980
|
-
* what the preview showed where a release in the view proposed the move.
|
|
1454
|
+
* what the preview showed where a release in the view proposed the move. `settle` says where a
|
|
1455
|
+
* free drag's preview goes: to the drop it proposed, or back to the event.
|
|
981
1456
|
*/
|
|
982
|
-
function end(dropped = false, landing = null) {
|
|
1457
|
+
function end(dropped = false, landing = null, settle = "home") {
|
|
983
1458
|
const current = session;
|
|
984
1459
|
if (current === null) return;
|
|
985
1460
|
session = null;
|
|
986
1461
|
if (current.placement !== null) getOptions().onPreview?.(null);
|
|
987
1462
|
clearTimeout(current.longPress);
|
|
988
1463
|
if (current.frame !== void 0) cancelAnimationFrame(current.frame);
|
|
989
|
-
current.ghost.clear();
|
|
990
1464
|
region.removeAttribute("data-interaction");
|
|
991
1465
|
if (current.gesture.kind !== "create") current.gesture.element.removeAttribute("data-dragging");
|
|
992
1466
|
window.removeEventListener("pointermove", onPointerMove);
|
|
993
1467
|
window.removeEventListener("pointerup", onPointerUp);
|
|
994
1468
|
window.removeEventListener("pointercancel", onPointerCancel);
|
|
995
1469
|
window.removeEventListener("keydown", onKeyDown, true);
|
|
996
|
-
current.touchTarget
|
|
1470
|
+
lastTouch = current.touchTarget;
|
|
997
1471
|
for (const type of [
|
|
998
1472
|
"contextmenu",
|
|
999
1473
|
"dragstart",
|
|
1000
1474
|
"selectstart"
|
|
1001
1475
|
]) window.removeEventListener(type, preventDefault);
|
|
1002
|
-
|
|
1476
|
+
try {
|
|
1477
|
+
if (current.free === void 0) current.ghost.clear();
|
|
1478
|
+
else settleFree(current, current.free, dropped ? null : settle);
|
|
1479
|
+
} finally {
|
|
1480
|
+
tellFollowers(current.followers, (follower) => follower.end?.(dropped, landing));
|
|
1481
|
+
}
|
|
1003
1482
|
}
|
|
1004
1483
|
/** Ends the gesture without proposing anything. */
|
|
1005
1484
|
function cancel() {
|
|
@@ -1061,13 +1540,16 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
1061
1540
|
return;
|
|
1062
1541
|
}
|
|
1063
1542
|
const proposed = proposal(current);
|
|
1064
|
-
end(false, proposed === null ? null : current.shown);
|
|
1543
|
+
end(false, proposed === null ? null : current.shown, proposed === null ? "home" : "drop");
|
|
1065
1544
|
suppressNextClick();
|
|
1066
1545
|
if (proposed === null) {
|
|
1067
1546
|
announce(current, { phase: "cancel" });
|
|
1068
1547
|
return;
|
|
1069
1548
|
}
|
|
1070
|
-
settleProposal(getOptions().onPropose(proposed, pointerInput), current.placement, (outcome) =>
|
|
1549
|
+
settleProposal(getOptions().onPropose(proposed, pointerInput), current.placement, (outcome) => {
|
|
1550
|
+
if (outcome.phase === "reject" && current.free !== void 0) current.free.refused = true;
|
|
1551
|
+
announce(current, outcome);
|
|
1552
|
+
});
|
|
1071
1553
|
}
|
|
1072
1554
|
function onKeyDown(event) {
|
|
1073
1555
|
if (event.key !== "Escape" || session === null) return;
|
|
@@ -1105,6 +1587,7 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
1105
1587
|
}
|
|
1106
1588
|
function onPointerDown(event) {
|
|
1107
1589
|
if (session !== null || event.button !== 0 || !event.isPrimary) return;
|
|
1590
|
+
if (lastTouch instanceof Node && !region.contains(lastTouch)) releaseLastTouch();
|
|
1108
1591
|
const options = getOptions();
|
|
1109
1592
|
if (options.disabled === true || !(event.target instanceof Element)) return;
|
|
1110
1593
|
const surface = {
|
|
@@ -1123,6 +1606,14 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
1123
1606
|
claimed: false,
|
|
1124
1607
|
edges: new EdgeArming(true),
|
|
1125
1608
|
followers: noFollowers,
|
|
1609
|
+
free: options.preview === "free" ? {
|
|
1610
|
+
className: options.ghostClassName,
|
|
1611
|
+
label: null,
|
|
1612
|
+
layout: null,
|
|
1613
|
+
marker: new GhostLayer(region, options.ghostClassName, "landing"),
|
|
1614
|
+
refused: false,
|
|
1615
|
+
validity: null
|
|
1616
|
+
} : void 0,
|
|
1126
1617
|
gesture,
|
|
1127
1618
|
ghost: new GhostLayer(region, options.ghostClassName),
|
|
1128
1619
|
options: {
|
|
@@ -1173,7 +1664,11 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
1173
1664
|
if (session?.active === true) event.preventDefault();
|
|
1174
1665
|
}
|
|
1175
1666
|
region.addEventListener("pointerdown", onPointerDown);
|
|
1176
|
-
if (getOptions().disabled !== true)
|
|
1667
|
+
if (getOptions().disabled !== true) {
|
|
1668
|
+
region.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
1669
|
+
region.addEventListener("touchend", onTouchLift, { passive: true });
|
|
1670
|
+
region.addEventListener("touchcancel", onTouchLift, { passive: true });
|
|
1671
|
+
}
|
|
1177
1672
|
const unregister = registerRegion({
|
|
1178
1673
|
element: region,
|
|
1179
1674
|
getOptions
|
|
@@ -1182,11 +1677,13 @@ function attachCalendarPointer(region, getOptions) {
|
|
|
1182
1677
|
cancel();
|
|
1183
1678
|
region.removeEventListener("pointerdown", onPointerDown);
|
|
1184
1679
|
region.removeEventListener("touchmove", onTouchMove);
|
|
1680
|
+
region.removeEventListener("touchend", onTouchLift);
|
|
1681
|
+
region.removeEventListener("touchcancel", onTouchLift);
|
|
1682
|
+
releaseLastTouch();
|
|
1185
1683
|
unregister();
|
|
1186
1684
|
};
|
|
1187
1685
|
}
|
|
1188
|
-
|
|
1189
|
-
//#region src/drop.ts
|
|
1686
|
+
// src/drop.ts
|
|
1190
1687
|
const DEFAULT_DURATION = { hours: 1 };
|
|
1191
1688
|
const DEFAULT_SNAP = {
|
|
1192
1689
|
increment: 15,
|
|
@@ -1221,7 +1718,7 @@ function regionOver(region, hit, eventId) {
|
|
|
1221
1718
|
/**
|
|
1222
1719
|
* Follows a drag that started outside the calendar, such as a task dragged from a list, over the
|
|
1223
1720
|
* calendar views on the page, and drops it into one: the framework-agnostic half of external drag
|
|
1224
|
-
* and drop, which a drag library's binding drives. Every view that uses `
|
|
1721
|
+
* and drop, which a drag library's binding drives. Every view that uses `attachCalendarPointer` takes
|
|
1225
1722
|
* part, through the options it passes: the preview shows range boxes in its slots, its `check`
|
|
1226
1723
|
* marks them `data-invalid` or `data-warning`, its announcer speaks each step with `outside` set,
|
|
1227
1724
|
* and its `onPropose` gets the drop. Read-only views take no part.
|
|
@@ -1334,7 +1831,7 @@ function startCalendarDrop(source, { input = "pointer" } = {}) {
|
|
|
1334
1831
|
} else {
|
|
1335
1832
|
if (changed) {
|
|
1336
1833
|
const proposed = proposal(current);
|
|
1337
|
-
check = proposed === null ? null : options.check?.(proposed) ?? null;
|
|
1834
|
+
check = proposed === null ? null : options.check?.(proposed, detail) ?? null;
|
|
1338
1835
|
options.onPreview?.({
|
|
1339
1836
|
eventId: source.eventId ?? null,
|
|
1340
1837
|
proposed: next
|
|
@@ -1411,23 +1908,4 @@ function startCalendarDrop(source, { input = "pointer" } = {}) {
|
|
|
1411
1908
|
}
|
|
1412
1909
|
};
|
|
1413
1910
|
}
|
|
1414
|
-
|
|
1415
|
-
//#region src/use-calendar-pointer.ts
|
|
1416
|
-
/**
|
|
1417
|
-
* Pointer move, resize, and create for a view region; see `attachCalendarPointer` for the data
|
|
1418
|
-
* attributes the view renders. Returns a ref for the region element. Options are read when a
|
|
1419
|
-
* gesture starts, and `columns` again as it moves, so changing them never re-attaches listeners,
|
|
1420
|
-
* and dragging never re-renders. `disabled` is the exception: a disabled region doesn't listen for
|
|
1421
|
-
* touch moves, so a read-only calendar's swipes never wait for its listener, and changing it
|
|
1422
|
-
* attaches the listeners again.
|
|
1423
|
-
*/
|
|
1424
|
-
function useCalendarPointer(options) {
|
|
1425
|
-
const latest = useRef(options);
|
|
1426
|
-
useInsertionEffect(() => {
|
|
1427
|
-
latest.current = options;
|
|
1428
|
-
});
|
|
1429
|
-
const disabled = options.disabled === true;
|
|
1430
|
-
return useCallback((element) => element === null ? void 0 : attachCalendarPointer(element, () => latest.current), [disabled]);
|
|
1431
|
-
}
|
|
1432
|
-
//#endregion
|
|
1433
|
-
export { attachCalendarPointer, eventIdAttributes, eventIdOf, monitorCalendarDrags, observeCalendarRegions, resourceIdAttributes, resourceIdOf, startCalendarDrop, useCalendarPointer };
|
|
1911
|
+
export { attachCalendarPointer, eventIdAttributes, eventIdOf, monitorCalendarDrags, observeCalendarRegions, resourceIdAttributes, resourceIdOf, startCalendarDrop };
|
package/package.json
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltenship/calendar-dnd",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Pointer drag, resize, and create interactions for Moltenship Time views.",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"calendar",
|
|
7
|
+
"drag-and-drop",
|
|
8
|
+
"event-calendar",
|
|
9
|
+
"pointer-events",
|
|
10
|
+
"resize",
|
|
11
|
+
"scheduler",
|
|
12
|
+
"temporal",
|
|
13
|
+
"typescript"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://time.molten.sh/docs/react/interactions",
|
|
6
16
|
"bugs": {
|
|
7
17
|
"url": "https://github.com/Moltenship/time/issues"
|
|
8
18
|
},
|
|
@@ -28,25 +38,17 @@
|
|
|
28
38
|
"access": "public"
|
|
29
39
|
},
|
|
30
40
|
"dependencies": {
|
|
31
|
-
"@moltenship/calendar-core": "
|
|
32
|
-
"@moltenship/calendar-temporal": "
|
|
41
|
+
"@moltenship/calendar-core": "2.0.0",
|
|
42
|
+
"@moltenship/calendar-temporal": "2.0.0"
|
|
33
43
|
},
|
|
34
44
|
"devDependencies": {
|
|
35
|
-
"
|
|
36
|
-
"@types/react-dom": "19.3.0",
|
|
37
|
-
"jsdom": "30.1.2",
|
|
38
|
-
"react": "19.3.0",
|
|
39
|
-
"react-dom": "19.3.0",
|
|
45
|
+
"jsdom": "30.1.3",
|
|
40
46
|
"typescript": "^7.0.2",
|
|
41
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
42
|
-
"vite-plus": "1.
|
|
43
|
-
},
|
|
44
|
-
"peerDependencies": {
|
|
45
|
-
"react": "^19.0.0"
|
|
47
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
48
|
+
"vite-plus": "1.4.0"
|
|
46
49
|
},
|
|
47
50
|
"scripts": {
|
|
48
51
|
"build": "vp pack",
|
|
49
|
-
"check": "vp check",
|
|
50
52
|
"dev": "vp pack --watch",
|
|
51
53
|
"test": "vp test --passWithNoTests"
|
|
52
54
|
}
|