@moltenship/calendar-dnd 0.0.0-stage → 1.0.0-rc.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/LICENSE +21 -0
- package/README.md +33 -2
- package/dist/index.d.mts +296 -0
- package/dist/index.mjs +1427 -0
- package/package.json +50 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Timofey Maximov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
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. `useCalendarPointer`
|
|
5
|
+
does this in a view's Renderer, and `attachCalendarPointer` outside a React component.
|
|
6
|
+
|
|
7
|
+
It also takes drags across the calendar's edge: `startCalendarDrop` drops items dragged in from
|
|
8
|
+
the rest of the page, such as unscheduled tasks, into the view under them, and
|
|
9
|
+
`monitorCalendarDrags` lets drop zones outside the calendar take events dragged out of it, and
|
|
10
|
+
lets an animation follow each drag. A drag library's binding drives them.
|
|
11
|
+
|
|
12
|
+
It's a layer of `@moltenship/calendar`, which re-exports all of it. Most apps install
|
|
13
|
+
`@moltenship/calendar` only and import `useCalendarPointer` from there.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @moltenship/calendar-dnd react
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- React 19. React is a peer dependency.
|
|
22
|
+
- A runtime with `Temporal` (Node.js 26 and later include it), or a polyfill that defines
|
|
23
|
+
`globalThis.Temporal`, loaded first.
|
|
24
|
+
- TypeScript 6 or later with `"lib": ["DOM", "DOM.Iterable", "ESNext"]`. `ESNext` has the
|
|
25
|
+
`Temporal` types.
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
- [Interactions](https://time.molten.sh/docs/interactions)
|
|
30
|
+
- [Repository](https://github.com/Moltenship/time)
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { CalendarAnnouncer, CalendarDraft, CalendarEventPlacement, CalendarEventProposal, CalendarPolicyResult, CalendarProposalDetail, CalendarTransactionResult, EventId, EventSnapshot, NormalizedCalendarEvent, ResourceId, TimeGridColumn } from "@moltenship/calendar-core";
|
|
2
|
+
import { WallTimeSnapOptions } from "@moltenship/calendar-temporal";
|
|
3
|
+
import { RefCallback } from "react";
|
|
4
|
+
//#region src/attach-calendar-pointer.d.ts
|
|
5
|
+
interface CalendarPointerOptions<TEvent, TEventId extends EventId, TResourceId extends ResourceId> {
|
|
6
|
+
/** Events as rendered, pending changes included; resolves `data-event-id`. */
|
|
7
|
+
readonly events: EventSnapshot<TEvent, TEventId, TResourceId>;
|
|
8
|
+
/**
|
|
9
|
+
* Receives one proposal per completed drag, with `{ input: "pointer" }`. Clicks and cancelled
|
|
10
|
+
* drags propose nothing. An item dragged in from outside the calendar (`startCalendarDrop`)
|
|
11
|
+
* proposes here too, a create carrying its record as `event`, with the input that drove it.
|
|
12
|
+
* Return the transaction's result, as `proposeEventChange` does, to announce whether it was
|
|
13
|
+
* saved.
|
|
14
|
+
*/
|
|
15
|
+
readonly onPropose: (proposal: CalendarEventProposal<TEventId, TResourceId, TEvent>, detail: CalendarProposalDetail) => void | PromiseLike<CalendarTransactionResult<TEvent, TEventId, TResourceId>>;
|
|
16
|
+
/** The display time zone. */
|
|
17
|
+
readonly timeZone: string;
|
|
18
|
+
/**
|
|
19
|
+
* Speaks each drag's start, steps, and outcome, and labels the preview's time range; pass
|
|
20
|
+
* `useCalendarAnnouncer()`. Without one, ranges are formatted in the runtime's locale.
|
|
21
|
+
*/
|
|
22
|
+
readonly announcer?: CalendarAnnouncer;
|
|
23
|
+
/**
|
|
24
|
+
* 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`. Preview segments get `data-invalid` when
|
|
26
|
+
* a policy rejects it and `data-warning` when one flags it.
|
|
27
|
+
*/
|
|
28
|
+
readonly check?: (proposal: CalendarEventProposal<TEventId, TResourceId, TEvent>) => CalendarPolicyResult<TEvent, TEventId, TResourceId> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Day columns of the time axis, matched to `[data-date]` elements without `data-all-day`: a
|
|
31
|
+
* time grid's or a timeline's `columns`. A new array mid-gesture is picked up, as a view that
|
|
32
|
+
* renders more days while a drag scrolls it needs.
|
|
33
|
+
*/
|
|
34
|
+
readonly columns?: readonly TimeGridColumn[];
|
|
35
|
+
/**
|
|
36
|
+
* Turns gestures off. It's also read when the layer attaches: a region disabled then doesn't
|
|
37
|
+
* listen for touch moves, which a drag needs on iOS, so attach again when it changes, as
|
|
38
|
+
* `useCalendarPointer` does.
|
|
39
|
+
*/
|
|
40
|
+
readonly disabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Hears the draft as the preview moves: once per change of where a drop would land, and `null`
|
|
43
|
+
* when the gesture ends or leaves the view. Pass `useCalendarDraftReporter()` so the root's
|
|
44
|
+
* draft hooks, such as `useDraftBusy`, follow pointer drags too.
|
|
45
|
+
*/
|
|
46
|
+
readonly onPreview?: (draft: CalendarDraft<TEventId, TResourceId> | null) => void;
|
|
47
|
+
/** Extra classes for the preview segments. */
|
|
48
|
+
readonly ghostClassName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* A ref to the element scrolled while dragging near its edges. Defaults to the nearest scrollable
|
|
51
|
+
* ancestor of where the drag starts.
|
|
52
|
+
*/
|
|
53
|
+
readonly scrollContainer?: {
|
|
54
|
+
readonly current: Element | null;
|
|
55
|
+
};
|
|
56
|
+
/** Wall-clock grid for time columns. Defaults to 15 minutes. */
|
|
57
|
+
readonly snap?: WallTimeSnapOptions;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Adds pointer move, resize, and create to a rendered view through delegated listeners on one
|
|
61
|
+
* region. The view marks its parts with data attributes:
|
|
62
|
+
*
|
|
63
|
+
* - `data-event-id` on events (spread `eventIdAttributes(id)` to keep numeric IDs distinct), with
|
|
64
|
+
* `data-resize="start"` or `"end"` on resize handles;
|
|
65
|
+
* - `data-date` (an ISO date) on time-grid day columns and on day cells (month cells, or a time
|
|
66
|
+
* grid's all-day row, which also carries `data-all-day`); a time column with
|
|
67
|
+
* `data-axis="inline"`, such as a timeline's strip for one date, runs its day from the inline
|
|
68
|
+
* start, the right under `dir="rtl"`;
|
|
69
|
+
* - in a resource view, `data-resource-id` on each cell or an element around it (spread
|
|
70
|
+
* `resourceIdAttributes(id)`), so a drop in another resource swaps it in the event's
|
|
71
|
+
* `resourceIds` and a create starts in the resource it began in;
|
|
72
|
+
* - `data-event-time` on the element inside an event that shows its time range, which the
|
|
73
|
+
* preview relabels with the proposed range;
|
|
74
|
+
* - `data-occludes` on parts that sit over the cells, such as sticky headers: a gesture can't start
|
|
75
|
+
* or land on the cells scrolled beneath them;
|
|
76
|
+
* - `data-calendar-pointer="none"` on controls of their own inside the region, such as annotation
|
|
77
|
+
* marks, so pressing them never starts a drag.
|
|
78
|
+
*
|
|
79
|
+
* The preview moves without re-rendering. `onPropose` runs once per drop; a click (less than a few
|
|
80
|
+
* pixels of travel) is left alone, and Escape cancels. Touch drags start after a finger rests still
|
|
81
|
+
* for 450 ms, so a swipe scrolls; once one starts, the page holds still under it. Returns a function
|
|
82
|
+
* that detaches everything.
|
|
83
|
+
*/
|
|
84
|
+
export declare function attachCalendarPointer<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(region: HTMLElement, getOptions: () => CalendarPointerOptions<TEvent, TEventId, TResourceId>): () => void;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/drags.d.ts
|
|
87
|
+
/** A point in viewport (client) coordinates. */
|
|
88
|
+
interface CalendarPoint {
|
|
89
|
+
readonly x: number;
|
|
90
|
+
readonly y: number;
|
|
91
|
+
}
|
|
92
|
+
/** A rectangle in viewport (client) coordinates. */
|
|
93
|
+
interface CalendarRect {
|
|
94
|
+
readonly height: number;
|
|
95
|
+
readonly width: number;
|
|
96
|
+
readonly x: number;
|
|
97
|
+
readonly y: number;
|
|
98
|
+
}
|
|
99
|
+
/** Where a view's preview shows that a moved event would land. */
|
|
100
|
+
interface CalendarDragPreview {
|
|
101
|
+
/**
|
|
102
|
+
* The time range the preview's copy of the event shows, as the view's announcer formats it, or
|
|
103
|
+
* `null` where the preview is a plain box, as in a month.
|
|
104
|
+
*/
|
|
105
|
+
readonly label: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* The preview's boxes at least partly in view, in order, each at its full size even where a
|
|
108
|
+
* scroller clips it: a day, week row or resource the event would cover. Empty when none is.
|
|
109
|
+
*/
|
|
110
|
+
readonly rects: readonly CalendarRect[];
|
|
111
|
+
/** `invalid` when a policy would reject the drop, `warning` when one would flag it. */
|
|
112
|
+
readonly validity: "invalid" | "warning" | null;
|
|
113
|
+
}
|
|
114
|
+
/** An event the pointer layer is moving, offered to `monitorCalendarDrags`. */
|
|
115
|
+
interface CalendarEventDrag<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
116
|
+
/** The element pressed: the event's segment in the view. */
|
|
117
|
+
readonly element: HTMLElement;
|
|
118
|
+
/** The event, as the view rendered it; `event.event` is the application's record. */
|
|
119
|
+
readonly event: NormalizedCalendarEvent<TEvent, TEventId, TResourceId>;
|
|
120
|
+
/** Where the press was. */
|
|
121
|
+
readonly origin: CalendarPoint;
|
|
122
|
+
/**
|
|
123
|
+
* Asks `claims` again and redraws the preview, for a follower whose answer changed without the
|
|
124
|
+
* pointer moving, as when a library works out its drop target after a move.
|
|
125
|
+
*/
|
|
126
|
+
readonly refresh: () => void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Follows one drag that a monitor took on. A follower with `claims` stands for drop zones outside
|
|
130
|
+
* the calendar, which changes how the view treats the drag; one without only watches it, as an
|
|
131
|
+
* animation that decorates drags does, and the drag goes on as if no one followed.
|
|
132
|
+
*/
|
|
133
|
+
interface CalendarDragFollower {
|
|
134
|
+
/**
|
|
135
|
+
* Whether a drop zone of the follower's is under the pointer. While one is, the calendar shows
|
|
136
|
+
* no preview of its own, and a release there proposes nothing and announces nothing: the zone's
|
|
137
|
+
* owner handles the drop and speaks for it.
|
|
138
|
+
*/
|
|
139
|
+
readonly claims?: () => boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The drag ended. `dropped` is true when it was released while `claims` said so, false after a
|
|
142
|
+
* drop in the calendar, a release over nowhere, Escape, or a lost pointer. `landing` is the
|
|
143
|
+
* preview a release in the view proposed the move at, policies still to run; `null` when it
|
|
144
|
+
* proposed nothing: Escape, a lost pointer, or a release where the event already was, over
|
|
145
|
+
* nowhere or over a zone. No `preview(null)` comes before it.
|
|
146
|
+
*/
|
|
147
|
+
readonly end?: (dropped: boolean, landing: CalendarDragPreview | null) => void;
|
|
148
|
+
/** The pointer moved. */
|
|
149
|
+
readonly move?: (point: CalendarPoint) => void;
|
|
150
|
+
/**
|
|
151
|
+
* The view's preview changed, or moved as the view scrolled under it: where a drop would land
|
|
152
|
+
* now, or `null` when the view shows none, off it or under a claimed zone.
|
|
153
|
+
*/
|
|
154
|
+
readonly preview?: (preview: CalendarDragPreview | null) => void;
|
|
155
|
+
}
|
|
156
|
+
/** Hears a move as it starts; returns a follower to take it on, or nothing to leave it. */
|
|
157
|
+
type CalendarDragMonitor = (drag: CalendarEventDrag) => CalendarDragFollower | void;
|
|
158
|
+
/**
|
|
159
|
+
* Hears every event a calendar view starts to move by pointer, on the page, so a drop zone
|
|
160
|
+
* outside the calendar can take it, such as a list of unscheduled items or a bin, or an animation
|
|
161
|
+
* can follow it. Resizes and creates aren't offered. While a follower with `claims` is on a drag,
|
|
162
|
+
* the view counts only where it's the topmost thing under the pointer, so a sheet of zones over it
|
|
163
|
+
* hides it; off the view, covered or claimed, a copy of the event follows the pointer. The view
|
|
164
|
+
* scrolls only while the pointer is over it, and after the pointer has left, only once it has
|
|
165
|
+
* been clear of the edges again or rested at one. Followers without `claims` change none of that.
|
|
166
|
+
* Returns a function that stops listening.
|
|
167
|
+
*/
|
|
168
|
+
export declare function monitorCalendarDrags(monitor: CalendarDragMonitor): () => void;
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/drop.d.ts
|
|
171
|
+
/** What an item dragged in from outside the calendar becomes when it's dropped on a view. */
|
|
172
|
+
interface CalendarDropSource<TEvent = unknown, TEventId extends EventId = EventId> {
|
|
173
|
+
/**
|
|
174
|
+
* How many days it covers when dropped on day cells: a month cell, the all-day row. 1 by
|
|
175
|
+
* default.
|
|
176
|
+
*/
|
|
177
|
+
readonly days?: number;
|
|
178
|
+
/** How long it is when dropped on a time column. An hour by default. */
|
|
179
|
+
readonly duration?: Temporal.Duration | Temporal.DurationLike;
|
|
180
|
+
/**
|
|
181
|
+
* The application record the new event copies, such as a task mapped to your event type. The
|
|
182
|
+
* create change carries it as `change.event`, so `onEventChange` knows what was dropped.
|
|
183
|
+
*/
|
|
184
|
+
readonly event?: TEvent;
|
|
185
|
+
/**
|
|
186
|
+
* An event the calendar shows, to move instead of creating one: its start lands where it's
|
|
187
|
+
* dropped. A view without it takes no drop.
|
|
188
|
+
*/
|
|
189
|
+
readonly eventId?: TEventId;
|
|
190
|
+
/** What announcements call the item, such as a task's title. */
|
|
191
|
+
readonly title?: string;
|
|
192
|
+
}
|
|
193
|
+
/** How `startCalendarDrop` follows a drag. */
|
|
194
|
+
interface CalendarDropOptions {
|
|
195
|
+
/**
|
|
196
|
+
* The input driving the drag: `"keyboard"` for a drag library's keyboard sensor, `"pointer"`
|
|
197
|
+
* (the default) for a mouse, finger or pen. Proposals and announcements carry it.
|
|
198
|
+
*/
|
|
199
|
+
readonly input?: "keyboard" | "pointer";
|
|
200
|
+
}
|
|
201
|
+
/** A drag from outside the calendar, as `startCalendarDrop` follows it. */
|
|
202
|
+
interface CalendarDropSession<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
203
|
+
/** Ends it without proposing anything, and announces a cancel if a view heard it start. */
|
|
204
|
+
readonly cancel: () => void;
|
|
205
|
+
/**
|
|
206
|
+
* Proposes the placement under the last point, once, through the view's `onPropose`, and ends
|
|
207
|
+
* the drag. Resolves with the transaction's result; `null` when it proposed nothing, over no
|
|
208
|
+
* view or for a move that would change nothing, and when `onPropose` returns no result.
|
|
209
|
+
*/
|
|
210
|
+
readonly drop: () => Promise<CalendarTransactionResult<TEvent, TEventId, TResourceId> | null>;
|
|
211
|
+
/**
|
|
212
|
+
* Follows the drag to a viewport point: finds the view under it, previews the placement a drop
|
|
213
|
+
* there would make, checks it against the root's policies, announces it, and scrolls the view
|
|
214
|
+
* near its edges. `null` means the point is over no calendar, as when the library has found a
|
|
215
|
+
* drop zone of the app's there.
|
|
216
|
+
*/
|
|
217
|
+
readonly move: (point: CalendarPoint | null) => void;
|
|
218
|
+
/** Where a drop would land now; `null` over no view, and once the drag has ended. */
|
|
219
|
+
readonly placement: CalendarEventPlacement<TResourceId> | null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Follows a drag that started outside the calendar, such as a task dragged from a list, over the
|
|
223
|
+
* calendar views on the page, and drops it into one: the framework-agnostic half of external drag
|
|
224
|
+
* and drop, which a drag library's binding drives. Every view that uses `useCalendarPointer` takes
|
|
225
|
+
* part, through the options it passes: the preview shows range boxes in its slots, its `check`
|
|
226
|
+
* marks them `data-invalid` or `data-warning`, its announcer speaks each step with `outside` set,
|
|
227
|
+
* and its `onPropose` gets the drop. Read-only views take no part.
|
|
228
|
+
*
|
|
229
|
+
* Over a time column a drop creates a timed event starting at the slot under the point,
|
|
230
|
+
* `duration` long; over day cells, an all-day event of `days` days. In a resource view it books
|
|
231
|
+
* the resource it's dropped in. With `eventId`, it moves that event instead, unless it's
|
|
232
|
+
* read-only.
|
|
233
|
+
*
|
|
234
|
+
* The topmost element under the point decides: anything over a view, such as a sheet or a
|
|
235
|
+
* dialog, hides it. So the library's drag image must let the pointer through
|
|
236
|
+
* (`pointer-events: none`), as dnd-kit's does. From the first `move` until `drop` or `cancel`, a
|
|
237
|
+
* frame loop scrolls the view under the point near its edges, once the point has been clear of
|
|
238
|
+
* them or rested at one for a moment, so crossing an edge on the way in doesn't scroll it.
|
|
239
|
+
*/
|
|
240
|
+
export declare function startCalendarDrop<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId>(source: CalendarDropSource<TEvent, TEventId>, { input }?: CalendarDropOptions): CalendarDropSession<TEvent, TEventId, TResourceId>;
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/event-id.d.ts
|
|
243
|
+
/**
|
|
244
|
+
* Attributes that identify an event element, for spreading onto it. `data-event-id` holds the ID
|
|
245
|
+
* as text; numeric IDs add `data-event-id-type="number"`, so `1` and `"1"` stay distinct.
|
|
246
|
+
*/
|
|
247
|
+
export declare function eventIdAttributes(id: EventId): {
|
|
248
|
+
readonly "data-event-id": string;
|
|
249
|
+
readonly "data-event-id-type"?: "number";
|
|
250
|
+
};
|
|
251
|
+
/** The event ID an element carries through `eventIdAttributes`, or `null` without one. */
|
|
252
|
+
export declare function eventIdOf(element: Element): EventId | null;
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/regions.d.ts
|
|
255
|
+
/** A calendar view's region, as a binding to a drag-and-drop library sees it. */
|
|
256
|
+
interface CalendarRegion {
|
|
257
|
+
/** Whether its gestures are off, as on a read-only root: then it takes no drops either. */
|
|
258
|
+
readonly disabled: boolean;
|
|
259
|
+
/** The element the view passed to `useCalendarPointer` or `attachCalendarPointer`. */
|
|
260
|
+
readonly element: HTMLElement;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Hears the calendar views on the page: once now, and again whenever a view's region attaches or
|
|
264
|
+
* detaches. A region that turns read-only attaches again, so `disabled` follows it. Returns a
|
|
265
|
+
* function that stops listening.
|
|
266
|
+
*/
|
|
267
|
+
export declare function observeCalendarRegions(observer: (regions: readonly CalendarRegion[]) => void): () => void;
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/resource-id.d.ts
|
|
270
|
+
/**
|
|
271
|
+
* Attributes that place an element in a resource, for spreading onto a resource's column, row, or
|
|
272
|
+
* cells. `data-resource-id` holds the ID as text, empty for the unassigned bucket (`null`); numeric
|
|
273
|
+
* IDs add `data-resource-id-type="number"`, so `1` and `"1"` stay distinct.
|
|
274
|
+
*/
|
|
275
|
+
export declare function resourceIdAttributes(id: ResourceId | null): {
|
|
276
|
+
readonly "data-resource-id": string;
|
|
277
|
+
readonly "data-resource-id-type"?: "number";
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* The resource an element sits in, from the nearest `resourceIdAttributes`: `null` in the
|
|
281
|
+
* unassigned bucket, `undefined` outside any resource.
|
|
282
|
+
*/
|
|
283
|
+
export declare function resourceIdOf(element: Element): ResourceId | null | undefined;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/use-calendar-pointer.d.ts
|
|
286
|
+
/**
|
|
287
|
+
* Pointer move, resize, and create for a view region; see `attachCalendarPointer` for the data
|
|
288
|
+
* attributes the view renders. Returns a ref for the region element. Options are read when a
|
|
289
|
+
* gesture starts, and `columns` again as it moves, so changing them never re-attaches listeners,
|
|
290
|
+
* and dragging never re-renders. `disabled` is the exception: a disabled region doesn't listen for
|
|
291
|
+
* touch moves, so a read-only calendar's swipes never wait for its listener, and changing it
|
|
292
|
+
* attaches the listeners again.
|
|
293
|
+
*/
|
|
294
|
+
export declare function useCalendarPointer<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(options: CalendarPointerOptions<TEvent, TEventId, TResourceId>): RefCallback<HTMLElement>;
|
|
295
|
+
//#endregion
|
|
296
|
+
export type { CalendarDragFollower, CalendarDragMonitor, CalendarDragPreview, CalendarDropOptions, CalendarDropSession, CalendarDropSource, CalendarEventDrag, CalendarPoint, CalendarPointerOptions, CalendarRect, CalendarRegion };
|