@cocoar/vue-calendar 1.16.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 +257 -0
- package/dist/__test-utils__/event-fixtures.d.ts +4 -0
- package/dist/__test-utils__/event-fixtures.d.ts.map +1 -0
- package/dist/builders/calendar-builder-internals.d.ts +14 -0
- package/dist/builders/calendar-builder-internals.d.ts.map +1 -0
- package/dist/builders/calendar-builder.d.ts +296 -0
- package/dist/builders/calendar-builder.d.ts.map +1 -0
- package/dist/builders/event-zone-hints.d.ts +20 -0
- package/dist/builders/event-zone-hints.d.ts.map +1 -0
- package/dist/builders/render-helpers.d.ts +19 -0
- package/dist/builders/render-helpers.d.ts.map +1 -0
- package/dist/builders/types.d.ts +175 -0
- package/dist/builders/types.d.ts.map +1 -0
- package/dist/components/CoarCalendar.vue.d.ts +150 -0
- package/dist/components/CoarCalendar.vue.d.ts.map +1 -0
- package/dist/components/CoarDisplayZoneSwitcher.vue.d.ts +28 -0
- package/dist/components/CoarDisplayZoneSwitcher.vue.d.ts.map +1 -0
- package/dist/components/VirtualizedSurface1DY.vue.d.ts +90 -0
- package/dist/components/VirtualizedSurface1DY.vue.d.ts.map +1 -0
- package/dist/components/VirtualizedSurface2D.vue.d.ts +71 -0
- package/dist/components/VirtualizedSurface2D.vue.d.ts.map +1 -0
- package/dist/components/internal/CoarEventDecorations.vue.d.ts +13 -0
- package/dist/components/internal/CoarEventDecorations.vue.d.ts.map +1 -0
- package/dist/components/internal/RenderEventFallback.d.ts +17 -0
- package/dist/components/internal/RenderEventFallback.d.ts.map +1 -0
- package/dist/components/internal/agenda/CoarAgendaDayHeader.vue.d.ts +54 -0
- package/dist/components/internal/agenda/CoarAgendaDayHeader.vue.d.ts.map +1 -0
- package/dist/components/internal/month/CoarMonthBar.vue.d.ts +80 -0
- package/dist/components/internal/month/CoarMonthBar.vue.d.ts.map +1 -0
- package/dist/components/internal/month/CoarMonthCell.vue.d.ts +74 -0
- package/dist/components/internal/month/CoarMonthCell.vue.d.ts.map +1 -0
- package/dist/components/internal/month/CoarMonthGrid.vue.d.ts +50 -0
- package/dist/components/internal/month/CoarMonthGrid.vue.d.ts.map +1 -0
- package/dist/components/internal/month/CoarMonthPill.vue.d.ts +83 -0
- package/dist/components/internal/month/CoarMonthPill.vue.d.ts.map +1 -0
- package/dist/components/internal/month/CoarMonthRow.vue.d.ts +44 -0
- package/dist/components/internal/month/CoarMonthRow.vue.d.ts.map +1 -0
- package/dist/components/internal/time-grid/CoarTimeGridAllDayBand.vue.d.ts +39 -0
- package/dist/components/internal/time-grid/CoarTimeGridAllDayBand.vue.d.ts.map +1 -0
- package/dist/components/internal/time-grid/CoarTimeGridColumn.vue.d.ts +44 -0
- package/dist/components/internal/time-grid/CoarTimeGridColumn.vue.d.ts.map +1 -0
- package/dist/components/internal/time-grid/CoarTimeGridHeader.vue.d.ts +44 -0
- package/dist/components/internal/time-grid/CoarTimeGridHeader.vue.d.ts.map +1 -0
- package/dist/components/internal/time-grid/CoarTimeGridNowMarker.vue.d.ts +18 -0
- package/dist/components/internal/time-grid/CoarTimeGridNowMarker.vue.d.ts.map +1 -0
- package/dist/composables/useA11yAnnouncer.d.ts +9 -0
- package/dist/composables/useA11yAnnouncer.d.ts.map +1 -0
- package/dist/composables/useCalendarDnd.d.ts +212 -0
- package/dist/composables/useCalendarDnd.d.ts.map +1 -0
- package/dist/composables/useCoarDrag.d.ts +97 -0
- package/dist/composables/useCoarDrag.d.ts.map +1 -0
- package/dist/composables/useMonthDnd.d.ts +89 -0
- package/dist/composables/useMonthDnd.d.ts.map +1 -0
- package/dist/composables/useMonthExpansion.d.ts +35 -0
- package/dist/composables/useMonthExpansion.d.ts.map +1 -0
- package/dist/composables/useTimeGridDnd.d.ts +104 -0
- package/dist/composables/useTimeGridDnd.d.ts.map +1 -0
- package/dist/composables/useViewWindow.d.ts +14 -0
- package/dist/composables/useViewWindow.d.ts.map +1 -0
- package/dist/core/agendaLayout.d.ts +47 -0
- package/dist/core/agendaLayout.d.ts.map +1 -0
- package/dist/core/dnd/move-math.d.ts +136 -0
- package/dist/core/dnd/move-math.d.ts.map +1 -0
- package/dist/core/dragHitTest.d.ts +74 -0
- package/dist/core/dragHitTest.d.ts.map +1 -0
- package/dist/core/eventIndex.d.ts +106 -0
- package/dist/core/eventIndex.d.ts.map +1 -0
- package/dist/core/index.d.ts +32 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/measurementCache.d.ts +87 -0
- package/dist/core/measurementCache.d.ts.map +1 -0
- package/dist/core/monthGridLayout.d.ts +68 -0
- package/dist/core/monthGridLayout.d.ts.map +1 -0
- package/dist/core/overlapLayout.d.ts +88 -0
- package/dist/core/overlapLayout.d.ts.map +1 -0
- package/dist/core/recurrence-public.d.ts +59 -0
- package/dist/core/recurrence-public.d.ts.map +1 -0
- package/dist/core/recurrence.d.ts +112 -0
- package/dist/core/recurrence.d.ts.map +1 -0
- package/dist/core/recurrenceWorker.d.ts +62 -0
- package/dist/core/recurrenceWorker.d.ts.map +1 -0
- package/dist/core/temporal.d.ts +214 -0
- package/dist/core/temporal.d.ts.map +1 -0
- package/dist/core/timeGridLayout.d.ts +109 -0
- package/dist/core/timeGridLayout.d.ts.map +1 -0
- package/dist/core/types.d.ts +211 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/viewWindow.d.ts +53 -0
- package/dist/core/viewWindow.d.ts.map +1 -0
- package/dist/core/virtualScroll.d.ts +91 -0
- package/dist/core/virtualScroll.d.ts.map +1 -0
- package/dist/core-DK63eHat.js +959 -0
- package/dist/core.js +2 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4221 -0
- package/dist/useAgendaView.d.ts +6 -0
- package/dist/useAgendaView.d.ts.map +1 -0
- package/dist/useCalendar.d.ts +6 -0
- package/dist/useCalendar.d.ts.map +1 -0
- package/dist/useDayView.d.ts +6 -0
- package/dist/useDayView.d.ts.map +1 -0
- package/dist/useMonthView.d.ts +6 -0
- package/dist/useMonthView.d.ts.map +1 -0
- package/dist/useWeekView.d.ts +6 -0
- package/dist/useWeekView.d.ts.map +1 -0
- package/dist/vue-calendar.css +2 -0
- package/package.json +68 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { Temporal, CalendarEvent } from '../core';
|
|
3
|
+
import { CalendarDragMode, CalendarDropTarget, DstPolicy, MoveResult } from '../core/dnd/move-math';
|
|
4
|
+
export type { DstPolicy } from '../core/dnd/move-math';
|
|
5
|
+
export { buildDropPayload } from '../core/dnd/move-math';
|
|
6
|
+
/**
|
|
7
|
+
* Re-export of the canonical `CalendarDropTarget` from
|
|
8
|
+
* `core/dnd/move-math`. Comment kept here for the existing
|
|
9
|
+
* import path.
|
|
10
|
+
*
|
|
11
|
+
* `date`: ISO date string (`YYYY-MM-DD`) of the day-column.
|
|
12
|
+
*
|
|
13
|
+
* `minutes`: minutes from local midnight, snapped to `slotDuration`.
|
|
14
|
+
* `null` for all-day drops — no time component, the drop is "place
|
|
15
|
+
* this event on this date" regardless of where vertically the
|
|
16
|
+
* pointer is.
|
|
17
|
+
*/
|
|
18
|
+
export type { CalendarDropTarget };
|
|
19
|
+
export interface UseCalendarDndOptions {
|
|
20
|
+
/** Scrollable surface element (for auto-scroll). */
|
|
21
|
+
surfaceRef: Ref<HTMLElement | null>;
|
|
22
|
+
/**
|
|
23
|
+
* The columns container (`.coar-time-grid__columns`). Used as the
|
|
24
|
+
* hit-test reference frame for timed-event drags. Optional —
|
|
25
|
+
* month-view consumers don't have a time-grid.
|
|
26
|
+
*/
|
|
27
|
+
columnsRef?: Ref<HTMLElement | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Optional separate hit-test container for the all-day band
|
|
30
|
+
* (`.coar-time-grid__all-day-columns`). When set, drags initiated
|
|
31
|
+
* with `mode: 'allDay'` snap to date-only targets relative to this
|
|
32
|
+
* container, so the user can move all-day bars horizontally
|
|
33
|
+
* across days without touching the time-grid math.
|
|
34
|
+
*/
|
|
35
|
+
allDayColumnsRef?: Ref<HTMLElement | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Optional 6×7 month-grid container. When set, `startMonthDrag`
|
|
38
|
+
* snaps to date-only targets via a 2D cell hit-test against this
|
|
39
|
+
* container. Pair with `monthGridDates` (42 dates).
|
|
40
|
+
*/
|
|
41
|
+
monthGridRef?: Ref<HTMLElement | null>;
|
|
42
|
+
/** Visible days for the time-grid (left-to-right). Required when columnsRef is set. */
|
|
43
|
+
days?: ComputedRef<ReadonlyArray<Temporal.PlainDate>> | Ref<ReadonlyArray<Temporal.PlainDate>>;
|
|
44
|
+
/**
|
|
45
|
+
* 42 dates for the month grid (6 rows × 7 cols, top-left first).
|
|
46
|
+
* Required when `monthGridRef` is set.
|
|
47
|
+
*/
|
|
48
|
+
monthGridDates?: ComputedRef<ReadonlyArray<Temporal.PlainDate>> | Ref<ReadonlyArray<Temporal.PlainDate>>;
|
|
49
|
+
/** `[startHour, endHour]`. Required when columnsRef is set. */
|
|
50
|
+
timeRange?: ComputedRef<readonly [number, number]> | Ref<readonly [number, number]>;
|
|
51
|
+
/** Pixels per hour (for translating Y → minutes). Required when columnsRef is set. */
|
|
52
|
+
pixelsPerHour?: ComputedRef<number> | Ref<number>;
|
|
53
|
+
/** Slot subdivision in minutes (e.g. 30). Required when columnsRef is set. */
|
|
54
|
+
slotDuration?: ComputedRef<number> | Ref<number>;
|
|
55
|
+
/**
|
|
56
|
+
* IANA display timezone — the zone the calendar is currently
|
|
57
|
+
* rendering in. Required for timed targets so move-math can resolve
|
|
58
|
+
* the slot in the same zone the user's eyes saw it. Default `'UTC'`.
|
|
59
|
+
* Real consumers pass `builder.timezone()` (the same value the
|
|
60
|
+
* layouts use).
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* IANA display timezone — the zone the calendar is currently
|
|
64
|
+
* rendering in. **Required** since Phase 8.11-AC. Required for
|
|
65
|
+
* timed targets so move-math can resolve the slot in the same
|
|
66
|
+
* zone the user's eyes saw it (Article 4 + Article 9 — defaults
|
|
67
|
+
* are not decisions, the silent-UTC fallback used to be a real
|
|
68
|
+
* foot-gun for direct callers).
|
|
69
|
+
*/
|
|
70
|
+
timezone: ComputedRef<string> | Ref<string>;
|
|
71
|
+
/**
|
|
72
|
+
* DST disambiguation policy. Forwarded into `applyMoveToEvent`. See
|
|
73
|
+
* `DstPolicy` in `core/dnd/move-math` for semantics. Default
|
|
74
|
+
* `'compatible'` matches the polyfill default.
|
|
75
|
+
*/
|
|
76
|
+
dstPolicy?: ComputedRef<DstPolicy> | Ref<DstPolicy>;
|
|
77
|
+
/**
|
|
78
|
+
* Render-buffer offset (in minutes) the time-grid applies above the
|
|
79
|
+
* first hour. CoarTimeGrid leaves some visual padding above
|
|
80
|
+
* `timeRange[0]` so events at the boundary have room for their
|
|
81
|
+
* focus halo / resize handle. The hit-test must subtract that
|
|
82
|
+
* offset so a click in the buffer zone doesn't map to a negative
|
|
83
|
+
* time. Default 0 (no buffer). Set this to whatever
|
|
84
|
+
* `RENDER_BUFFER_MINUTES` the time-grid uses.
|
|
85
|
+
*/
|
|
86
|
+
timeGridTopBufferMinutes?: ComputedRef<number> | Ref<number>;
|
|
87
|
+
/**
|
|
88
|
+
* Pointer-distance threshold (px) below which a pointerup is
|
|
89
|
+
* treated as a click instead of a drop. Default 5. Forwarded to
|
|
90
|
+
* `useCoarDrag.dragThreshold`.
|
|
91
|
+
*/
|
|
92
|
+
dragThreshold?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Optional drop validator. Called per pointer-move once a target
|
|
95
|
+
* slot has been hit-tested. Return `false` to mark the slot as
|
|
96
|
+
* invalid — the ghost still renders (so the user sees their
|
|
97
|
+
* pointer position) but with an invalid style, and `onEventDrop`
|
|
98
|
+
* won't fire on release. Returning `true` (or omitting the
|
|
99
|
+
* predicate) keeps the slot valid.
|
|
100
|
+
*
|
|
101
|
+
* Use this for business rules like "daily standups can't move to
|
|
102
|
+
* a weekend" or "blocked hours can't accept events".
|
|
103
|
+
*/
|
|
104
|
+
canDrop?: (event: CalendarEvent, target: CalendarDropTarget) => boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Called once the pointer crossed the drag threshold AND the user
|
|
107
|
+
* released over a valid slot. Consumer applies `next` to its data.
|
|
108
|
+
*/
|
|
109
|
+
onEventDrop?: (payload: {
|
|
110
|
+
event: CalendarEvent;
|
|
111
|
+
original: {
|
|
112
|
+
start: Temporal.ZonedDateTime | Temporal.PlainDate;
|
|
113
|
+
end?: Temporal.ZonedDateTime | Temporal.PlainDate;
|
|
114
|
+
displayZone: string;
|
|
115
|
+
};
|
|
116
|
+
next: MoveResult;
|
|
117
|
+
target: CalendarDropTarget & {
|
|
118
|
+
disambiguation: null | 'gap' | 'overlap';
|
|
119
|
+
};
|
|
120
|
+
native: PointerEvent | null;
|
|
121
|
+
}) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Called when pointer-down → up happened without crossing the
|
|
124
|
+
* drag threshold. Lets the consumer keep its `event-click` UX.
|
|
125
|
+
*/
|
|
126
|
+
onEventClick?: (event: CalendarEvent, native: PointerEvent | null) => void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Drag mode of the in-flight drag.
|
|
130
|
+
*
|
|
131
|
+
* - `'timed'` — move a timed event in the time-grid
|
|
132
|
+
* - `'timed-resize-start'` — drag the top edge of a timed event
|
|
133
|
+
* - `'timed-resize-end'` — drag the bottom edge of a timed event
|
|
134
|
+
* - `'allDay'` — move an all-day bar across days
|
|
135
|
+
* - `'allDay-resize-start'` — drag the left edge of an all-day bar
|
|
136
|
+
* - `'allDay-resize-end'` — drag the right edge of an all-day bar
|
|
137
|
+
* - `'month'` — move a pill / multi-day bar across cells
|
|
138
|
+
*
|
|
139
|
+
* Resize modes only ever update one side of the event (start XOR
|
|
140
|
+
* end). Move modes preserve the duration / span. The composable
|
|
141
|
+
* picks the right `applyMoveToEvent` branch based on the mode set
|
|
142
|
+
* by the matching `start*Drag` closure.
|
|
143
|
+
*/
|
|
144
|
+
export type { CalendarDragMode };
|
|
145
|
+
export interface UseCalendarDndReturn {
|
|
146
|
+
/** True only once the pointer has crossed the drag threshold. */
|
|
147
|
+
isDragging: ComputedRef<boolean>;
|
|
148
|
+
/** The event currently being dragged (or null when idle). */
|
|
149
|
+
draggedEvent: ComputedRef<CalendarEvent | null>;
|
|
150
|
+
/** Drag mode of the in-flight drag, or `null` when idle. */
|
|
151
|
+
dragMode: ComputedRef<CalendarDragMode | null>;
|
|
152
|
+
/** Current drop slot (or null when off-grid / idle). */
|
|
153
|
+
dropTarget: Ref<CalendarDropTarget | null>;
|
|
154
|
+
/**
|
|
155
|
+
* True for a brief window after the user released on an invalid
|
|
156
|
+
* drop target. Lets the consumer keep the "invalid" ghost
|
|
157
|
+
* rendered just long enough to play a fade-out animation, so the
|
|
158
|
+
* rejection reads as a soft snap-back rather than an instant
|
|
159
|
+
* disappear. Always `false` while the user is still dragging —
|
|
160
|
+
* use `isDragging.value || snappingBack.value` in templates.
|
|
161
|
+
*/
|
|
162
|
+
snappingBack: ComputedRef<boolean>;
|
|
163
|
+
/**
|
|
164
|
+
* Pointerdown handler for a TIMED event card. Resolves to a
|
|
165
|
+
* `{ date, minutes }` slot via the time-grid hit-test.
|
|
166
|
+
*/
|
|
167
|
+
startDrag: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
168
|
+
/** Top-edge handle: only the start moves, end stays anchored. */
|
|
169
|
+
startTimedResizeStart: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
170
|
+
/** Bottom-edge handle: only the end moves, start stays anchored. */
|
|
171
|
+
startTimedResizeEnd: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
172
|
+
/**
|
|
173
|
+
* Pointerdown handler for an ALL-DAY bar. Resolves to a
|
|
174
|
+
* `{ date, minutes: null }` slot via the all-day-band hit-test
|
|
175
|
+
* (X-only — the vertical position inside the band doesn't carry
|
|
176
|
+
* any meaning for an all-day event).
|
|
177
|
+
*/
|
|
178
|
+
startAllDayDrag: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
179
|
+
/** Left-edge handle on a multi-day all-day bar: start moves only. */
|
|
180
|
+
startAllDayResizeStart: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
181
|
+
/** Right-edge handle on a multi-day all-day bar: end moves only. */
|
|
182
|
+
startAllDayResizeEnd: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Pointerdown handler for a MONTH-view event (pill or multi-day
|
|
185
|
+
* bar). Resolves to a `{ date, minutes: null }` slot via the
|
|
186
|
+
* 6×7 month-grid hit-test. Drop preserves the event's wall-time
|
|
187
|
+
* (timed events) or shifts the all-day span (date-only events)
|
|
188
|
+
* by the original-vs-target date delta.
|
|
189
|
+
*/
|
|
190
|
+
startMonthDrag: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
191
|
+
/** Left-edge handle on a multi-day month bar: start moves only. */
|
|
192
|
+
startMonthResizeStart: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
193
|
+
/** Right-edge handle on a multi-day month bar: end moves only. */
|
|
194
|
+
startMonthResizeEnd: (event: CalendarEvent) => (e: PointerEvent) => void;
|
|
195
|
+
}
|
|
196
|
+
export declare function useCalendarDnd(opts: UseCalendarDndOptions): UseCalendarDndReturn;
|
|
197
|
+
/**
|
|
198
|
+
* Re-export of the pure-function move/resize math. Lives in
|
|
199
|
+
* `core/dnd/move-math.ts` since Phase 7.7 — kept here for the
|
|
200
|
+
* existing import path (`from '../composables/useCalendarDnd'`).
|
|
201
|
+
*
|
|
202
|
+
* - Move modes preserve duration / span and shift the whole
|
|
203
|
+
* event to the target slot.
|
|
204
|
+
* - Resize modes only update one side (start XOR end). The other
|
|
205
|
+
* side is preserved from the original event, with a small
|
|
206
|
+
* minimum-duration clamp so the user can't flip the event
|
|
207
|
+
* past zero.
|
|
208
|
+
*
|
|
209
|
+
* Pure-function on inputs — no side effects.
|
|
210
|
+
*/
|
|
211
|
+
export { applyMoveToEvent } from '../core/dnd/move-math';
|
|
212
|
+
//# sourceMappingURL=useCalendarDnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalendarDnd.d.ts","sourceRoot":"","sources":["../../src/composables/useCalendarDnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAqDzD;;;;;;;;;;;GAWG;AACH,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,UAAU,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACrC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3C;;;;OAIG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACvC,uFAAuF;IACvF,IAAI,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CA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AC,EAAE,YAAY,KAAK,IAAI,CAAC;IACrE,qEAAqE;IACrE,sBAAsB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5E,oEAAoE;IACpE,oBAAoB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1E;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,mEAAmE;IACnE,qBAAqB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3E,kEAAkE;IAClE,mBAAmB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CAC1E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,CAggBhF;AAED;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ComputedRef, Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { AutoScrollOptions } from '../core/dragHitTest';
|
|
3
|
+
export interface DragContext<T> {
|
|
4
|
+
/** The data the consumer attached to the dragged item. */
|
|
5
|
+
data: T;
|
|
6
|
+
/** Pointer's current screen-x / screen-y. */
|
|
7
|
+
pointer: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
/** Pointer's offset from drag-start. */
|
|
12
|
+
delta: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
/** Surface's scrollLeft / scrollTop at drag-start. */
|
|
17
|
+
startScroll: {
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
};
|
|
21
|
+
/** Surface's scrollLeft / scrollTop at the moment of this callback. */
|
|
22
|
+
scroll: {
|
|
23
|
+
left: number;
|
|
24
|
+
top: number;
|
|
25
|
+
};
|
|
26
|
+
/** Pointer's offset from drag-start INCLUDING auto-scroll motion. */
|
|
27
|
+
totalDelta: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* `true` once the pointer has moved past `dragThreshold`. With the
|
|
33
|
+
* default `dragThreshold: 0`, this is `true` from the very first
|
|
34
|
+
* move. Read it in `onDragEnd` to disambiguate "drop" from "click"
|
|
35
|
+
* — when it stays `false`, the user just pressed-and-released
|
|
36
|
+
* without any meaningful movement.
|
|
37
|
+
*/
|
|
38
|
+
crossedThreshold: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface UseCoarDragOptions<T> {
|
|
41
|
+
/**
|
|
42
|
+
* Element that scrolls during the drag (typically the
|
|
43
|
+
* `<VirtualizedSurface*>` root). Used both to clamp auto-scroll
|
|
44
|
+
* bounds and to write `scrollTop` / `scrollLeft` for auto-scroll.
|
|
45
|
+
* Pass `null` to disable auto-scroll entirely.
|
|
46
|
+
*/
|
|
47
|
+
surfaceRef: Ref<HTMLElement | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Auto-scroll behaviour. Pass `null` to disable auto-scroll while
|
|
50
|
+
* keeping drag tracking otherwise. Default: enabled with
|
|
51
|
+
* 30 px hot zone, 24 px/frame max velocity, linear curve.
|
|
52
|
+
*/
|
|
53
|
+
autoScroll?: AutoScrollOptions | null;
|
|
54
|
+
/**
|
|
55
|
+
* Distance in pixels (Manhattan-style: max of |dx|, |dy|) the
|
|
56
|
+
* pointer must travel before the drag is considered "active".
|
|
57
|
+
* Below this, `onDragMove` is suppressed and `isDragging` stays
|
|
58
|
+
* `false`. On `onDragEnd`, `ctx.crossedThreshold` tells the
|
|
59
|
+
* consumer whether a real drop happened or it was just a click.
|
|
60
|
+
*
|
|
61
|
+
* Default `0` keeps the legacy behaviour: every drag is active
|
|
62
|
+
* from pointerdown. Set to e.g. `5` to get standard click-vs-drag
|
|
63
|
+
* disambiguation (typical for direct-manipulation UIs like a
|
|
64
|
+
* calendar event card you can both click AND drag).
|
|
65
|
+
*/
|
|
66
|
+
dragThreshold?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Called once on pointerdown that becomes a drag. Return `false`
|
|
69
|
+
* to cancel the drag (no callbacks fire afterwards).
|
|
70
|
+
*/
|
|
71
|
+
onDragStart?: (ctx: {
|
|
72
|
+
event: PointerEvent;
|
|
73
|
+
data: T;
|
|
74
|
+
}) => boolean | void;
|
|
75
|
+
/**
|
|
76
|
+
* Called on each rAF tick while dragging. Coalesces multiple
|
|
77
|
+
* pointermove events between frames.
|
|
78
|
+
*/
|
|
79
|
+
onDragMove?: (ctx: DragContext<T>) => void;
|
|
80
|
+
/** Called on pointerup. */
|
|
81
|
+
onDragEnd?: (ctx: DragContext<T>) => void;
|
|
82
|
+
/** Called on pointercancel or Escape key. */
|
|
83
|
+
onDragCancel?: (ctx: DragContext<T>) => void;
|
|
84
|
+
}
|
|
85
|
+
export interface UseCoarDragReturn<T> {
|
|
86
|
+
/** True while a drag is in progress. */
|
|
87
|
+
isDragging: ComputedRef<boolean>;
|
|
88
|
+
/** The data of the currently-dragged item (or null when idle). */
|
|
89
|
+
draggedData: ShallowRef<T | null>;
|
|
90
|
+
/**
|
|
91
|
+
* Returns a `pointerdown` handler bound to the supplied data. Use
|
|
92
|
+
* via `@pointerdown="startDrag(item)"`.
|
|
93
|
+
*/
|
|
94
|
+
startDrag: (data: T) => (event: PointerEvent) => void;
|
|
95
|
+
}
|
|
96
|
+
export declare function useCoarDrag<T>(opts: UseCoarDragOptions<T>): UseCoarDragReturn<T>;
|
|
97
|
+
//# sourceMappingURL=useCoarDrag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCoarDrag.d.ts","sourceRoot":"","sources":["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EAAE,CAAC,CAAA;KAAE,KAAK,OAAO,GAAG,IAAI,CAAC;IACxE;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3C,2BAA2B;IAC3B,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC1C,6CAA6C;IAC7C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,wCAAwC;IACxC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,kEAAkE;IAClE,WAAW,EAAE,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAkOhF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { CalendarDragMode, UseCalendarDndReturn } from './useCalendarDnd';
|
|
3
|
+
import { DstPolicy, EventDropPayload, MoveResult } from '../core/dnd/move-math';
|
|
4
|
+
import { Temporal, CalendarEvent } from '../core';
|
|
5
|
+
/**
|
|
6
|
+
* Month drop payload — alias for the canonical `EventDropPayload`
|
|
7
|
+
* shape from core/dnd/move-math. Kept for backward-compatible import
|
|
8
|
+
* paths; new code should use `EventDropPayload` directly.
|
|
9
|
+
*/
|
|
10
|
+
export type MonthEventDropPayload = EventDropPayload;
|
|
11
|
+
export interface MonthDragSourceSnapshot {
|
|
12
|
+
/** Pill ranges per cell-day-key the dragged event occupied. */
|
|
13
|
+
pillCells: ReadonlyArray<string>;
|
|
14
|
+
/** Multi-day bar ranges per row, if applicable. */
|
|
15
|
+
bars: ReadonlyArray<{
|
|
16
|
+
rowIndex: number;
|
|
17
|
+
startCol: number;
|
|
18
|
+
endCol: number;
|
|
19
|
+
lane: number;
|
|
20
|
+
clippedStart: boolean;
|
|
21
|
+
clippedEnd: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
event: CalendarEvent;
|
|
24
|
+
}
|
|
25
|
+
export interface InvalidMonthGhost {
|
|
26
|
+
rowIndex: number;
|
|
27
|
+
startCol: number;
|
|
28
|
+
endCol: number;
|
|
29
|
+
isBar: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface UseMonthDndOptions {
|
|
32
|
+
/** Source events. */
|
|
33
|
+
events: MaybeRefOrGetter<ReadonlyArray<CalendarEvent>>;
|
|
34
|
+
/** 42 dates for the visible month grid (6×7, top-left first). */
|
|
35
|
+
gridDates: ComputedRef<ReadonlyArray<Temporal.PlainDate>> | Ref<ReadonlyArray<Temporal.PlainDate>>;
|
|
36
|
+
/** Element used as the month-grid hit-test reference. */
|
|
37
|
+
gridRef: Ref<HTMLElement | null>;
|
|
38
|
+
/** Effective IANA timezone for instant ↔ date math. */
|
|
39
|
+
timezone: MaybeRefOrGetter<string>;
|
|
40
|
+
/** DST disambiguation policy (Article 5). Default `'compatible'`. */
|
|
41
|
+
dstPolicy?: MaybeRefOrGetter<DstPolicy>;
|
|
42
|
+
/** Drop validator. Returning false marks the target invalid. */
|
|
43
|
+
canDrop?: (event: CalendarEvent, target: {
|
|
44
|
+
date: string;
|
|
45
|
+
minutes: number | null;
|
|
46
|
+
}) => boolean;
|
|
47
|
+
/** User clicked an event without crossing the drag threshold. */
|
|
48
|
+
onEventClick?: (event: CalendarEvent, native: PointerEvent | null) => void;
|
|
49
|
+
/** A drag completed (or a keyboard move fired). */
|
|
50
|
+
onEventDrop?: (payload: MonthEventDropPayload) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Optional screen-reader announcer hook. Called after every
|
|
53
|
+
* commit (mouse drop OR keyboard Enter) and after every cancel
|
|
54
|
+
* (keyboard Escape).
|
|
55
|
+
*/
|
|
56
|
+
onAnnounce?: (kind: 'committed' | 'cancelled', payload?: MonthEventDropPayload) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Snapshot of the in-flight keyboard-drag state. Drives the same
|
|
60
|
+
* preview-ghost / source-phantom rendering pipeline as a pointer
|
|
61
|
+
* drag — the visuals don't care which input modality started
|
|
62
|
+
* the drag.
|
|
63
|
+
*/
|
|
64
|
+
export interface KeyboardDragState {
|
|
65
|
+
event: CalendarEvent;
|
|
66
|
+
/** Working start/end after applying the arrow-key moves so far. */
|
|
67
|
+
next: MoveResult;
|
|
68
|
+
mode: CalendarDragMode;
|
|
69
|
+
/** Display zone snapshotted on first arrow keystroke. */
|
|
70
|
+
startDisplayZone: string;
|
|
71
|
+
/** Event start at first arrow keystroke (in case consumer
|
|
72
|
+
* mutates event mid-drag). */
|
|
73
|
+
originalStart: Temporal.ZonedDateTime | Temporal.PlainDate;
|
|
74
|
+
originalEnd?: Temporal.ZonedDateTime | Temporal.PlainDate;
|
|
75
|
+
}
|
|
76
|
+
export interface UseMonthDndReturn {
|
|
77
|
+
dnd: UseCalendarDndReturn;
|
|
78
|
+
workingEvents: ComputedRef<ReadonlyArray<CalendarEvent>>;
|
|
79
|
+
dragSourceSnapshot: Ref<MonthDragSourceSnapshot | null>;
|
|
80
|
+
invalidMonthGhost: ComputedRef<InvalidMonthGhost | null>;
|
|
81
|
+
isPreviewId: (id: string) => boolean;
|
|
82
|
+
isInvalidPillTarget: (day: Temporal.PlainDate) => boolean;
|
|
83
|
+
onMonthEventPointerdown: (e: PointerEvent, event: CalendarEvent) => void;
|
|
84
|
+
onMonthEventKeydown: (e: KeyboardEvent, event: CalendarEvent) => void;
|
|
85
|
+
/** Active keyboard-drag state, or `null` when no kbd-drag is in flight. */
|
|
86
|
+
keyboardDrag: Ref<KeyboardDragState | null>;
|
|
87
|
+
}
|
|
88
|
+
export declare function useMonthDnd(opts: UseMonthDndOptions): UseMonthDndReturn;
|
|
89
|
+
//# sourceMappingURL=useMonthDnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMonthDnd.d.ts","sourceRoot":"","sources":["../../src/composables/useMonthDnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC9D,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,QAAQ,EAIR,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,mDAAmD;IACnD,IAAI,EAAE,aAAa,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,OAAO,CAAC;QACtB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC,CAAC;IACH,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,C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AAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;IAC3D,WAAW,CAAC,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;CAC3D;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,oBAAoB,CAAC;IAC1B,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;IACzD,kBAAkB,EAAE,GAAG,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;IACxD,iBAAiB,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACzD,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,mBAAmB,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;IAC1D,uBAAuB,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzE,mBAAmB,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACtE,2EAA2E;IAC3E,YAAY,EAAE,GAAG,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CAkfvE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { MonthLayout } from '../core';
|
|
3
|
+
export interface UseMonthExpansionOptions {
|
|
4
|
+
/** Pixel-perfect month layout from `layoutMonthGrid`. */
|
|
5
|
+
layout: ComputedRef<MonthLayout> | Ref<MonthLayout>;
|
|
6
|
+
/** Rows-container element used to query cell overflow. */
|
|
7
|
+
gridRef: Ref<HTMLElement | null>;
|
|
8
|
+
/** Reactive token that resets expansion when the visible
|
|
9
|
+
* month changes (typically a `Temporal.PlainYearMonth`). */
|
|
10
|
+
resetToken: ComputedRef<unknown> | Ref<unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface UseMonthExpansionReturn {
|
|
13
|
+
/** Constants exposed for the parent's bar geometry math. */
|
|
14
|
+
readonly BAR_HEIGHT: number;
|
|
15
|
+
readonly BAR_GAP: number;
|
|
16
|
+
readonly DAY_NUMBER_HEIGHT: number;
|
|
17
|
+
/** Top-of-bar offset within a row for a given lane. */
|
|
18
|
+
barTopPx(lane: number): number;
|
|
19
|
+
/** Per-row total bar-area pixel height (used by the pills
|
|
20
|
+
* container's `margin-top`). */
|
|
21
|
+
rowBarHeightsPx: ComputedRef<number[]>;
|
|
22
|
+
/** Per-row total height (collapsed vs expanded). */
|
|
23
|
+
rowHeightPx: ComputedRef<number[]>;
|
|
24
|
+
/** Set of currently expanded row indices. Single-row mode —
|
|
25
|
+
* opening one collapses any other. */
|
|
26
|
+
expandedRows: Ref<Set<number>>;
|
|
27
|
+
/** Imperative expand / collapse helpers. */
|
|
28
|
+
expandRow(rowIdx: number): void;
|
|
29
|
+
collapseRow(rowIdx: number): void;
|
|
30
|
+
/** dateKey-keyed set of cells whose pill list outgrows their
|
|
31
|
+
* slot (pills container scrolls). */
|
|
32
|
+
overflowingCells: Ref<Set<string>>;
|
|
33
|
+
}
|
|
34
|
+
export declare function useMonthExpansion(opts: UseMonthExpansionOptions): UseMonthExpansionReturn;
|
|
35
|
+
//# sourceMappingURL=useMonthExpansion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMonthExpansion.d.ts","sourceRoot":"","sources":["../../src/composables/useMonthExpansion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,GAAG,EAOT,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAa3C,MAAM,WAAW,wBAAwB;IACvC,yDAAyD;IACzD,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;IACpD,0DAA0D;IAC1D,OAAO,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACjC;iEAC6D;IAC7D,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,uBAAuB;IACtC,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEnC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;qCACiC;IACjC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IAEvC,oDAAoD;IACpD,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IAEnC;2CACuC;IACvC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/B,4CAA4C;IAC5C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;0CACsC;IACtC,gBAAgB,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CACpC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,wBAAwB,GAC7B,uBAAuB,CA6GzB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { CalendarDragMode, UseCalendarDndReturn } from './useCalendarDnd';
|
|
3
|
+
import { DstPolicy, EventDropPayload, MoveResult } from '../core/dnd/move-math';
|
|
4
|
+
import { Temporal, CalendarEvent } from '../core';
|
|
5
|
+
/**
|
|
6
|
+
* Time-grid drop payload — structurally identical to the canonical
|
|
7
|
+
* `EventDropPayload` from `core/dnd/move-math`. Re-exported under this
|
|
8
|
+
* name as a convenience for time-grid-specific call sites.
|
|
9
|
+
*/
|
|
10
|
+
export type TimeGridEventDropPayload = EventDropPayload;
|
|
11
|
+
export interface TimedDragSourceSnapshot {
|
|
12
|
+
dayKey: string;
|
|
13
|
+
lane: number;
|
|
14
|
+
laneCount: number;
|
|
15
|
+
startMinutes: number;
|
|
16
|
+
endMinutes: number;
|
|
17
|
+
event: CalendarEvent;
|
|
18
|
+
}
|
|
19
|
+
export interface AllDayDragSourceSnapshot {
|
|
20
|
+
startCol: number;
|
|
21
|
+
endCol: number;
|
|
22
|
+
lane: number;
|
|
23
|
+
laneCount: number;
|
|
24
|
+
clippedStart: boolean;
|
|
25
|
+
clippedEnd: boolean;
|
|
26
|
+
event: CalendarEvent;
|
|
27
|
+
}
|
|
28
|
+
export interface InvalidTimedGhost {
|
|
29
|
+
dayKey: string;
|
|
30
|
+
startMinutes: number;
|
|
31
|
+
durationMinutes: number;
|
|
32
|
+
}
|
|
33
|
+
export interface InvalidAllDayGhost {
|
|
34
|
+
startCol: number;
|
|
35
|
+
endCol: number;
|
|
36
|
+
}
|
|
37
|
+
export interface UseTimeGridDndOptions {
|
|
38
|
+
events: MaybeRefOrGetter<ReadonlyArray<CalendarEvent>>;
|
|
39
|
+
days: ComputedRef<ReadonlyArray<Temporal.PlainDate>> | Ref<ReadonlyArray<Temporal.PlainDate>>;
|
|
40
|
+
timeRange: ComputedRef<readonly [number, number]> | Ref<readonly [number, number]>;
|
|
41
|
+
pixelsPerHour: ComputedRef<number> | Ref<number>;
|
|
42
|
+
slotDuration: ComputedRef<5 | 10 | 15 | 30 | 60> | Ref<5 | 10 | 15 | 30 | 60>;
|
|
43
|
+
timezone: MaybeRefOrGetter<string>;
|
|
44
|
+
/** DST disambiguation policy (Article 5). Default `'compatible'`. */
|
|
45
|
+
dstPolicy?: MaybeRefOrGetter<DstPolicy>;
|
|
46
|
+
surfaceRef: Ref<HTMLElement | null>;
|
|
47
|
+
columnsRef: Ref<HTMLElement | null>;
|
|
48
|
+
allDayColumnsRef: Ref<HTMLElement | null>;
|
|
49
|
+
/** Pixels of leading render buffer in the time-grid body. */
|
|
50
|
+
topBufferMinutes: ComputedRef<number> | Ref<number>;
|
|
51
|
+
canDrop?: (event: CalendarEvent, target: {
|
|
52
|
+
date: string;
|
|
53
|
+
minutes: number | null;
|
|
54
|
+
}) => boolean;
|
|
55
|
+
onEventClick?: (event: CalendarEvent, native: PointerEvent | null) => void;
|
|
56
|
+
onEventDrop?: (payload: TimeGridEventDropPayload) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Optional screen-reader announcer hook. Called after every
|
|
59
|
+
* commit (mouse drop OR keyboard Enter) and after every cancel
|
|
60
|
+
* (keyboard Escape). The view typically wires this to
|
|
61
|
+
* `useA11yAnnouncer().announce` so a `role="status"` element
|
|
62
|
+
* relays the change to assistive tech.
|
|
63
|
+
*/
|
|
64
|
+
onAnnounce?: (kind: 'committed' | 'cancelled', payload?: TimeGridEventDropPayload) => void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Snapshot of the in-flight keyboard-drag state. Drives the same
|
|
68
|
+
* preview-ghost / source-phantom rendering pipeline as a pointer
|
|
69
|
+
* drag (the visuals don't care which input modality started the
|
|
70
|
+
* drag).
|
|
71
|
+
*/
|
|
72
|
+
export interface KeyboardDragState {
|
|
73
|
+
event: CalendarEvent;
|
|
74
|
+
/** Working start/end after applying the arrow-key moves so far. */
|
|
75
|
+
next: MoveResult;
|
|
76
|
+
mode: CalendarDragMode;
|
|
77
|
+
/** Display zone snapshotted on the FIRST arrow keystroke. The
|
|
78
|
+
* user could toggle `.timezone()` mid-drag — we anchor to the
|
|
79
|
+
* zone the drag began in (mirroring mouse `dragStartDisplayZone`). */
|
|
80
|
+
startDisplayZone: string;
|
|
81
|
+
/** Event start snapshotted on the FIRST arrow keystroke. If the
|
|
82
|
+
* consumer mutates the underlying event between arrows (over-eager
|
|
83
|
+
* listener applies a preview), `original` on commit must still
|
|
84
|
+
* reflect the pre-drag value, not the mutated one. */
|
|
85
|
+
originalStart: Temporal.ZonedDateTime | Temporal.PlainDate;
|
|
86
|
+
/** Event end snapshotted on the FIRST arrow keystroke (if any). */
|
|
87
|
+
originalEnd?: Temporal.ZonedDateTime | Temporal.PlainDate;
|
|
88
|
+
}
|
|
89
|
+
export interface UseTimeGridDndReturn {
|
|
90
|
+
dnd: UseCalendarDndReturn;
|
|
91
|
+
workingEvents: ComputedRef<ReadonlyArray<CalendarEvent>>;
|
|
92
|
+
dragSourceSnapshot: Ref<TimedDragSourceSnapshot | null>;
|
|
93
|
+
dragAllDaySourceSnapshot: Ref<AllDayDragSourceSnapshot | null>;
|
|
94
|
+
invalidTimedGhost: ComputedRef<InvalidTimedGhost | null>;
|
|
95
|
+
invalidAllDayGhost: ComputedRef<InvalidAllDayGhost | null>;
|
|
96
|
+
isPreviewEvent: (id: string) => boolean;
|
|
97
|
+
onEventPointerdown: (e: PointerEvent, event: CalendarEvent, start: (data: CalendarEvent) => (e: PointerEvent) => void) => void;
|
|
98
|
+
onEventKeydown: (e: KeyboardEvent, event: CalendarEvent) => void;
|
|
99
|
+
draggedDurationMinutes: ComputedRef<number | null>;
|
|
100
|
+
/** Active keyboard-drag state, or `null` when no kbd-drag is in flight. */
|
|
101
|
+
keyboardDrag: Ref<KeyboardDragState | null>;
|
|
102
|
+
}
|
|
103
|
+
export declare function useTimeGridDnd(opts: UseTimeGridDndOptions): UseTimeGridDndReturn;
|
|
104
|
+
//# sourceMappingURL=useTimeGridDnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimeGridDnd.d.ts","sourceRoot":"","sources":["../../src/composables/useTimeGridDnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EAAE,WAA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,GAAG,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,qBAAqB,GAC1B,oBAAoB,CA2lBtB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ViewWindow } from '../core';
|
|
3
|
+
import { CalendarBuilder } from '../builders/calendar-builder';
|
|
4
|
+
interface UseViewWindowReturn {
|
|
5
|
+
/**
|
|
6
|
+
* Computed reflection of the current window. Same value the
|
|
7
|
+
* builder's `api.visibleRange` exposes; provided here so the
|
|
8
|
+
* caller doesn't have to wire two refs.
|
|
9
|
+
*/
|
|
10
|
+
readonly visibleRange: Readonly<Ref<ViewWindow | null>>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useViewWindow<TMeta extends Record<string, unknown> = Record<string, unknown>>(builder: CalendarBuilder<TMeta>): UseViewWindowReturn;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useViewWindow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useViewWindow.d.ts","sourceRoot":"","sources":["../../src/composables/useViewWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACL,KAAK,GAAG,EAKT,MAAM,KAAK,CAAC;AACb,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAU/D,UAAU,mBAAmB;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;CACzD;AAED,wBAAgB,aAAa,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3F,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,GAC9B,mBAAmB,CAoDrB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CalendarEvent } from './types';
|
|
2
|
+
/** A row in the agenda's flat list. */
|
|
3
|
+
export type AgendaItem<TMeta extends Record<string, unknown> = Record<string, unknown>> = AgendaHeaderItem | AgendaEventItem<TMeta>;
|
|
4
|
+
export interface AgendaHeaderItem {
|
|
5
|
+
kind: 'header';
|
|
6
|
+
/** The day this header introduces. ISO date string. */
|
|
7
|
+
date: string;
|
|
8
|
+
/** True if there are no events on this day (`showEmptyDays` mode). */
|
|
9
|
+
isEmpty: boolean;
|
|
10
|
+
/** Stable key for v-for. */
|
|
11
|
+
key: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AgendaEventItem<TMeta extends Record<string, unknown> = Record<string, unknown>> {
|
|
14
|
+
kind: 'event';
|
|
15
|
+
/** The day this row belongs to. ISO date string. */
|
|
16
|
+
date: string;
|
|
17
|
+
event: CalendarEvent<TMeta>;
|
|
18
|
+
/**
|
|
19
|
+
* True when this row is a multi-day event's continuation (i.e. the
|
|
20
|
+
* event's first day was earlier in the range). Consumers that want
|
|
21
|
+
* to elide continuations can filter on this.
|
|
22
|
+
*/
|
|
23
|
+
isContinuation: boolean;
|
|
24
|
+
/** Stable key for v-for, unique within the rendered range. */
|
|
25
|
+
key: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AgendaLayoutOptions {
|
|
28
|
+
/** Range start, inclusive. ISO date string `'YYYY-MM-DD'`. */
|
|
29
|
+
rangeStart: string;
|
|
30
|
+
/** Range end, exclusive. ISO date string. */
|
|
31
|
+
rangeEnd: string;
|
|
32
|
+
/** IANA timezone for resolving timed events. */
|
|
33
|
+
timezone: string;
|
|
34
|
+
/**
|
|
35
|
+
* Render a header even on days without any events. Default false —
|
|
36
|
+
* empty days are omitted from the agenda.
|
|
37
|
+
*/
|
|
38
|
+
showEmptyDays?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Flatten a list of events into an `AgendaItem[]` for rendering.
|
|
42
|
+
*
|
|
43
|
+
* Pure: same input → same output, byte-for-byte. Independent of
|
|
44
|
+
* input order (events are deterministically sorted internally).
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildAgendaItems<TMeta extends Record<string, unknown> = Record<string, unknown>>(events: ReadonlyArray<CalendarEvent<TMeta>>, opts: AgendaLayoutOptions): AgendaItem<TMeta>[];
|
|
47
|
+
//# sourceMappingURL=agendaLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agendaLayout.d.ts","sourceRoot":"","sources":["../../src/core/agendaLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,uCAAuC;AACvC,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClF,gBAAgB,GAChB,eAAe,CAAC,KAAK,CAAC,CAAC;AAE3B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC9F,IAAI,EAAE,OAAO,CAAC;IACd,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,8DAA8D;IAC9D,GAAG,EAAE,MAAM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