@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,959 @@
|
|
|
1
|
+
import { Temporal as e, Temporal as t } from "@js-temporal/polyfill";
|
|
2
|
+
//#region src/core/types.ts
|
|
3
|
+
function n(e) {
|
|
4
|
+
return "timeZoneId" in e.start;
|
|
5
|
+
}
|
|
6
|
+
function r(e) {
|
|
7
|
+
return !("timeZoneId" in e.start);
|
|
8
|
+
}
|
|
9
|
+
function i(t) {
|
|
10
|
+
let { id: n, start: r, end: i } = t, o = r instanceof e.ZonedDateTime, s = r instanceof e.PlainDate;
|
|
11
|
+
if (!o && !s) throw TypeError(`[CalendarEvent ${n}] start must be Temporal.ZonedDateTime or Temporal.PlainDate. Got ${r?.constructor?.name ?? typeof r}.`);
|
|
12
|
+
if (o) try {
|
|
13
|
+
r.toInstant();
|
|
14
|
+
} catch (e) {
|
|
15
|
+
let t = r.timeZoneId;
|
|
16
|
+
throw TypeError(`[CalendarEvent ${n}] start.timeZoneId='${t}' is not a recognised IANA zone (Temporal threw '${e.message}'). Use a real IANA name like 'Europe/Vienna' / 'America/Los_Angeles'.`, { cause: e });
|
|
17
|
+
}
|
|
18
|
+
if (i !== void 0) {
|
|
19
|
+
let t = i instanceof e.ZonedDateTime, a = i instanceof e.PlainDate;
|
|
20
|
+
if (!t && !a) throw TypeError(`[CalendarEvent ${n}] end must be Temporal.ZonedDateTime or Temporal.PlainDate. Got ${i?.constructor?.name ?? typeof i}.`);
|
|
21
|
+
if (o !== t) throw TypeError(`[CalendarEvent ${n}] start and end must be the same shape. Got start=${o ? "ZonedDateTime" : "PlainDate"}, end=${t ? "ZonedDateTime" : "PlainDate"}.`);
|
|
22
|
+
if (o) {
|
|
23
|
+
if (e.Instant.compare(r.toInstant(), i.toInstant()) >= 0) throw RangeError(`[CalendarEvent ${n}] end must be strictly after start.`);
|
|
24
|
+
} else if (e.PlainDate.compare(r, i) >= 0) throw RangeError(`[CalendarEvent ${n}] end must be strictly after start.`);
|
|
25
|
+
}
|
|
26
|
+
let c = t.meta;
|
|
27
|
+
if ((c?.rrule !== void 0 || c?.rdate !== void 0 || c?.exdate !== void 0 || c?.recurrenceId !== void 0) && !a.has(n)) {
|
|
28
|
+
a.add(n);
|
|
29
|
+
let e = `[@cocoar/vue-calendar] [CalendarEvent ${n}] meta.rrule / .rdate / .exdate / .recurrenceId is set, but recurrence is not yet wired (Phase 4). The event will render only as a single occurrence at \`start\`. Construct a \`RecurringSeries\` and use \`expandSeries()\` (when available) instead of stuffing rrule into meta.`;
|
|
30
|
+
typeof console < "u" && console.warn(e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
var a = /* @__PURE__ */ new Set();
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/core/temporal.ts
|
|
36
|
+
function o(e) {
|
|
37
|
+
return e % 7;
|
|
38
|
+
}
|
|
39
|
+
var s = !1;
|
|
40
|
+
function c(e) {
|
|
41
|
+
try {
|
|
42
|
+
let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
|
|
43
|
+
if (n && typeof n.firstDay == "number") return o(n.firstDay);
|
|
44
|
+
} catch {}
|
|
45
|
+
return !s && typeof console < "u" && (s = !0, console.warn(`[@cocoar/vue-calendar] Intl.Locale.weekInfo is not available on this runtime — falling back to Monday for locale '${e}'. Article 9: defaults are not decisions. Pass \`.firstDayOfWeek(0)\` (Sunday) / \`.firstDayOfWeek(6)\` (Saturday) etc. explicitly so the week-start is deterministic across browsers.`)), 1;
|
|
46
|
+
}
|
|
47
|
+
function l(e) {
|
|
48
|
+
try {
|
|
49
|
+
return new Intl.DateTimeFormat(e, { hour: "numeric" }).resolvedOptions().hour12 ?? !1;
|
|
50
|
+
} catch {
|
|
51
|
+
return !1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var u = !1;
|
|
55
|
+
function d() {
|
|
56
|
+
try {
|
|
57
|
+
let e = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
58
|
+
if (e) return e;
|
|
59
|
+
} catch {}
|
|
60
|
+
return !u && typeof console < "u" && (u = !0, console.warn("[@cocoar/vue-calendar] detectBrowserTimezone() couldn't read Intl.DateTimeFormat — falling back to 'UTC'. This is the Article-4 anti-pattern: human-meaningful times will render at the wrong wall-clock for users not in UTC. Pass an explicit IANA zone to `builder.timezone(...)` (e.g. 'Europe/Vienna'). If your app really does run in UTC, pass 'UTC' explicitly to silence this warning.")), "UTC";
|
|
61
|
+
}
|
|
62
|
+
function f(e, t) {
|
|
63
|
+
if (!t) return e;
|
|
64
|
+
let n = { ...e };
|
|
65
|
+
return t.hour12 !== void 0 && (n.hour12 = t.hour12), (t.dateStyle !== void 0 || t.timeStyle !== void 0) && (delete n.weekday, delete n.era, delete n.year, delete n.month, delete n.day, delete n.dayPeriod, delete n.hour, delete n.minute, delete n.second, delete n.fractionalSecondDigits, delete n.timeZoneName), t.dateStyle !== void 0 && (n.dateStyle = t.dateStyle), t.timeStyle !== void 0 && (n.timeStyle = t.timeStyle), n;
|
|
66
|
+
}
|
|
67
|
+
function p(e, t) {
|
|
68
|
+
let n = (o(e.dayOfWeek) - t + 7) % 7;
|
|
69
|
+
return n === 0 ? e : e.subtract({ days: n });
|
|
70
|
+
}
|
|
71
|
+
function m(e, t) {
|
|
72
|
+
return p(e, t).add({ days: 6 });
|
|
73
|
+
}
|
|
74
|
+
function h(e) {
|
|
75
|
+
return e.with({ day: 1 });
|
|
76
|
+
}
|
|
77
|
+
function g(e) {
|
|
78
|
+
return e.with({ day: e.daysInMonth });
|
|
79
|
+
}
|
|
80
|
+
function _(e) {
|
|
81
|
+
let t = e.dayOfWeek, n = e.add({ days: 4 - t }), r = n.with({
|
|
82
|
+
month: 1,
|
|
83
|
+
day: 1
|
|
84
|
+
}), i = (4 - r.dayOfWeek + 7) % 7, a = r.add({ days: i }), o = n.since(a, { largestUnit: "days" }).days;
|
|
85
|
+
return Math.floor(o / 7) + 1;
|
|
86
|
+
}
|
|
87
|
+
function v(e, t) {
|
|
88
|
+
let n = p(e, t), r = Array(7);
|
|
89
|
+
for (let e = 0; e < 7; e++) r[e] = n.add({ days: e });
|
|
90
|
+
return r;
|
|
91
|
+
}
|
|
92
|
+
function y(e, t) {
|
|
93
|
+
let n = p(e.toPlainDate({ day: 1 }), t), r = Array(42);
|
|
94
|
+
for (let e = 0; e < 42; e++) r[e] = n.add({ days: e });
|
|
95
|
+
return r;
|
|
96
|
+
}
|
|
97
|
+
function b(e, t, n = "short") {
|
|
98
|
+
let r = new Intl.DateTimeFormat(e, { weekday: n }), i = new Date(Date.UTC(2024, 0, 7)), a = Array(7);
|
|
99
|
+
for (let e = 0; e < 7; e++) {
|
|
100
|
+
let n = (t + e) % 7, o = new Date(i.getTime());
|
|
101
|
+
o.setUTCDate(o.getUTCDate() + n), a[e] = r.format(o);
|
|
102
|
+
}
|
|
103
|
+
return a;
|
|
104
|
+
}
|
|
105
|
+
function x(e) {
|
|
106
|
+
return e.toString();
|
|
107
|
+
}
|
|
108
|
+
function S(e, n) {
|
|
109
|
+
return e instanceof t.PlainDate ? e : e.withTimeZone(n).toPlainDate();
|
|
110
|
+
}
|
|
111
|
+
function C(e) {
|
|
112
|
+
return t.Now.plainDateISO(e);
|
|
113
|
+
}
|
|
114
|
+
function w(e) {
|
|
115
|
+
return t.Now.zonedDateTimeISO(e);
|
|
116
|
+
}
|
|
117
|
+
function ee(e) {
|
|
118
|
+
let { local: n, timeZoneId: r, dstPolicy: i = "compatible" } = e, a;
|
|
119
|
+
try {
|
|
120
|
+
a = t.PlainDateTime.from(n);
|
|
121
|
+
} catch (e) {
|
|
122
|
+
throw RangeError(`[parseScheduledTime] local='${n}' is not a parseable ISO-8601 datetime (${e.message}). Expected format: 'YYYY-MM-DDTHH:MM[:SS]'.`, { cause: e });
|
|
123
|
+
}
|
|
124
|
+
let o;
|
|
125
|
+
try {
|
|
126
|
+
o = a.toZonedDateTime(r, { disambiguation: i });
|
|
127
|
+
} catch (e) {
|
|
128
|
+
let t = e.message;
|
|
129
|
+
throw TypeError(i === "reject" ? `[parseScheduledTime] local='${n}' in '${r}' could not be resolved (${t}). Likely cause: dstPolicy='reject' on a DST gap (e.g. 02:30 on the spring-forward day). Use 'earlier' / 'later' / 'compatible' if you want the engine to resolve, or pick a different time.` : `[parseScheduledTime] timeZoneId='${r}' is not a recognised IANA zone (${t}). Use a real name like 'Europe/Vienna' / 'America/Los_Angeles' — abbreviations like 'CET' / 'EST' are ambiguous and intentionally rejected.`, { cause: e });
|
|
130
|
+
}
|
|
131
|
+
return o;
|
|
132
|
+
}
|
|
133
|
+
function te(e) {
|
|
134
|
+
try {
|
|
135
|
+
return t.PlainDate.from(e);
|
|
136
|
+
} catch (t) {
|
|
137
|
+
throw RangeError(`[parsePlainDate] iso='${e}' is not a parseable ISO-8601 date (${t.message}). Expected format: 'YYYY-MM-DD'.`, { cause: t });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function T(e) {
|
|
141
|
+
return {
|
|
142
|
+
local: e.toPlainDateTime().toString(),
|
|
143
|
+
timeZoneId: e.timeZoneId
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/core/recurrence-public.ts
|
|
148
|
+
var E = "[@cocoar/vue-calendar] expandSeries() is not implemented yet — the recurrence engine integration is Phase 4. The TYPE contract for RecurringSeries is enforced from Session 2 so your data layer can build against it now; expansion will become available without API changes.";
|
|
149
|
+
function D(e, t, n) {
|
|
150
|
+
throw TypeError(E);
|
|
151
|
+
}
|
|
152
|
+
var ne = E;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/core/viewWindow.ts
|
|
155
|
+
function O(t) {
|
|
156
|
+
let { view: n, cursor: r, firstDayOfWeek: i, timezone: a } = t;
|
|
157
|
+
switch (n) {
|
|
158
|
+
case "day": return {
|
|
159
|
+
view: n,
|
|
160
|
+
start: r.toString(),
|
|
161
|
+
end: r.add({ days: 1 }).toString(),
|
|
162
|
+
timezone: a
|
|
163
|
+
};
|
|
164
|
+
case "week": {
|
|
165
|
+
let e = p(r, i);
|
|
166
|
+
return {
|
|
167
|
+
view: n,
|
|
168
|
+
start: e.toString(),
|
|
169
|
+
end: e.add({ days: 7 }).toString(),
|
|
170
|
+
timezone: a
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
case "month": {
|
|
174
|
+
let t = y(e.PlainYearMonth.from({
|
|
175
|
+
year: r.year,
|
|
176
|
+
month: r.month
|
|
177
|
+
}), i);
|
|
178
|
+
return {
|
|
179
|
+
view: n,
|
|
180
|
+
start: t[0].toString(),
|
|
181
|
+
end: t[41].add({ days: 1 }).toString(),
|
|
182
|
+
timezone: a
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
case "agenda": {
|
|
186
|
+
let e = t.agendaLengthDays ?? 30;
|
|
187
|
+
return {
|
|
188
|
+
view: n,
|
|
189
|
+
start: r.toString(),
|
|
190
|
+
end: r.add({ days: e }).toString(),
|
|
191
|
+
timezone: a
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
case "timeline":
|
|
195
|
+
case "year": return {
|
|
196
|
+
view: n,
|
|
197
|
+
start: r.toString(),
|
|
198
|
+
end: r.add({ days: 1 }).toString(),
|
|
199
|
+
timezone: a
|
|
200
|
+
};
|
|
201
|
+
default: throw Error(`Unsupported view: ${String(n)}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function* k(t) {
|
|
205
|
+
let n = e.PlainDate.from(t.start), r = e.PlainDate.from(t.end);
|
|
206
|
+
for (; e.PlainDate.compare(n, r) < 0;) yield n, n = n.add({ days: 1 });
|
|
207
|
+
}
|
|
208
|
+
function A(t) {
|
|
209
|
+
let n = e.PlainDate.from(t.start);
|
|
210
|
+
return e.PlainDate.from(t.end).since(n, { largestUnit: "days" }).days;
|
|
211
|
+
}
|
|
212
|
+
function j(t, n) {
|
|
213
|
+
let r = e.PlainDate.from(t.start), i = e.PlainDate.from(t.end);
|
|
214
|
+
return e.PlainDate.compare(n, r) >= 0 && e.PlainDate.compare(n, i) < 0;
|
|
215
|
+
}
|
|
216
|
+
function M(e, t, n, r = 30) {
|
|
217
|
+
let i = n === "next" ? 1 : -1;
|
|
218
|
+
switch (e) {
|
|
219
|
+
case "day": return t.add({ days: 1 * i });
|
|
220
|
+
case "week": return t.add({ days: 7 * i });
|
|
221
|
+
case "month": return t.add({ months: 1 * i });
|
|
222
|
+
case "agenda": return t.add({ days: r * i });
|
|
223
|
+
case "timeline":
|
|
224
|
+
case "year": return e === "year" ? t.add({ months: 1 * i }) : t.add({ days: 1 * i });
|
|
225
|
+
default: throw Error(`Unsupported view: ${String(e)}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/core/overlapLayout.ts
|
|
230
|
+
function N(e, t) {
|
|
231
|
+
e.push(t);
|
|
232
|
+
let n = e.length - 1;
|
|
233
|
+
for (; n > 0;) {
|
|
234
|
+
let t = n - 1 >>> 1;
|
|
235
|
+
if (e[t] <= e[n]) break;
|
|
236
|
+
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function P(e) {
|
|
240
|
+
let t = e[0], n = e.pop();
|
|
241
|
+
if (e.length > 0) {
|
|
242
|
+
e[0] = n;
|
|
243
|
+
let t = 0, r = e.length;
|
|
244
|
+
for (;;) {
|
|
245
|
+
let n = t * 2 + 1, i = n + 1, a = t;
|
|
246
|
+
if (n < r && e[n] < e[a] && (a = n), i < r && e[i] < e[a] && (a = i), a === t) break;
|
|
247
|
+
[e[t], e[a]] = [e[a], e[t]], t = a;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return t;
|
|
251
|
+
}
|
|
252
|
+
function F(e, t, n, r) {
|
|
253
|
+
e.push(n), t.push(r);
|
|
254
|
+
let i = e.length - 1;
|
|
255
|
+
for (; i > 0;) {
|
|
256
|
+
let n = i - 1 >>> 1;
|
|
257
|
+
if (e[n] <= e[i]) break;
|
|
258
|
+
[e[n], e[i]] = [e[i], e[n]], [t[n], t[i]] = [t[i], t[n]], i = n;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function I(e) {
|
|
262
|
+
return e.length > 0 ? e[0] : Infinity;
|
|
263
|
+
}
|
|
264
|
+
function L(e, t) {
|
|
265
|
+
let n = {
|
|
266
|
+
end: e[0],
|
|
267
|
+
lane: t[0]
|
|
268
|
+
}, r = e.pop(), i = t.pop();
|
|
269
|
+
if (e.length > 0) {
|
|
270
|
+
e[0] = r, t[0] = i;
|
|
271
|
+
let n = 0, a = e.length;
|
|
272
|
+
for (;;) {
|
|
273
|
+
let r = n * 2 + 1, i = r + 1, o = n;
|
|
274
|
+
if (r < a && e[r] < e[o] && (o = r), i < a && e[i] < e[o] && (o = i), o === n) break;
|
|
275
|
+
[e[n], e[o]] = [e[o], e[n]], [t[n], t[o]] = [t[o], t[n]], n = o;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return n;
|
|
279
|
+
}
|
|
280
|
+
function R(e) {
|
|
281
|
+
let t = e.length;
|
|
282
|
+
if (t === 0) return {
|
|
283
|
+
bars: [],
|
|
284
|
+
laneCount: 0
|
|
285
|
+
};
|
|
286
|
+
let n = Array(t);
|
|
287
|
+
for (let r = 0; r < t; r++) {
|
|
288
|
+
let t = e[r];
|
|
289
|
+
if (t.end < t.start) throw RangeError(`Interval "${t.id}" has end (${t.end}) < start (${t.start})`);
|
|
290
|
+
n[r] = t;
|
|
291
|
+
}
|
|
292
|
+
n.sort((e, t) => e.start === t.start ? e.end === t.end ? e.id < t.id ? -1 : +(e.id > t.id) : t.end - e.end : e.start - t.start);
|
|
293
|
+
let r = [], i = [], a = [], o = 0, s = Array(t);
|
|
294
|
+
for (let e = 0; e < t; e++) {
|
|
295
|
+
let t = n[e];
|
|
296
|
+
for (; I(r) < t.start;) {
|
|
297
|
+
let { lane: e } = L(r, i);
|
|
298
|
+
N(a, e);
|
|
299
|
+
}
|
|
300
|
+
let c;
|
|
301
|
+
c = a.length > 0 ? P(a) : o++, F(r, i, t.end, c), s[e] = {
|
|
302
|
+
id: t.id,
|
|
303
|
+
lane: c,
|
|
304
|
+
start: t.start,
|
|
305
|
+
end: t.end
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
bars: s,
|
|
310
|
+
laneCount: o
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/core/timeGridLayout.ts
|
|
315
|
+
function z(e, t) {
|
|
316
|
+
let { day: r, timeRange: i, timezone: a } = t, [o, s] = i, c = o * 60, l = s * 60;
|
|
317
|
+
if (l - c <= 0) return [];
|
|
318
|
+
let u = [], d = /* @__PURE__ */ new Set();
|
|
319
|
+
for (let t of e) {
|
|
320
|
+
if (d.has(t.id) || (d.add(t.id), !n(t))) continue;
|
|
321
|
+
let e = V(t.start, r, a), i = t.end ? V(t.end, r, a) : e + 30, o = e, s = i, f = Math.max(o, c), p = Math.min(s, l);
|
|
322
|
+
p > 1440 && (p = Math.min(p, 1440)), f < 0 && (f = 0), !(p <= f) && (p <= c || f >= l || u.push({
|
|
323
|
+
event: t,
|
|
324
|
+
startMinutes: f - c,
|
|
325
|
+
endMinutes: p - c,
|
|
326
|
+
clippedTop: o < c,
|
|
327
|
+
clippedBottom: s > l
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
330
|
+
if (u.length === 0) return [];
|
|
331
|
+
let f = u.map((e, t) => ({
|
|
332
|
+
...e,
|
|
333
|
+
idx: t
|
|
334
|
+
})).sort((e, t) => e.startMinutes === t.startMinutes ? t.endMinutes - e.endMinutes : e.startMinutes - t.startMinutes), p = [], m = [], h = -Infinity;
|
|
335
|
+
for (let e of f) e.startMinutes >= h ? (m.length > 0 && p.push(m), m = [e], h = e.endMinutes) : (m.push(e), e.endMinutes > h && (h = e.endMinutes));
|
|
336
|
+
m.length > 0 && p.push(m);
|
|
337
|
+
let g = /* @__PURE__ */ new Map();
|
|
338
|
+
for (let e of p) {
|
|
339
|
+
let n = R(e.map((e) => ({
|
|
340
|
+
id: e.event.id,
|
|
341
|
+
start: e.startMinutes,
|
|
342
|
+
end: Math.max(e.startMinutes, e.endMinutes - 1)
|
|
343
|
+
}))), r = -1;
|
|
344
|
+
if (t.priorityId !== void 0) {
|
|
345
|
+
for (let e of n.bars) if (e.id === t.priorityId) {
|
|
346
|
+
r = e.lane;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
let i = n.laneCount - 1;
|
|
351
|
+
for (let e of n.bars) {
|
|
352
|
+
let t = e.lane;
|
|
353
|
+
r >= 0 && r < i && (t === r ? t = i : t > r && --t), g.set(e.id, {
|
|
354
|
+
lane: t,
|
|
355
|
+
laneCount: n.laneCount
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return u.map((e) => {
|
|
360
|
+
let t = g.get(e.event.id) ?? {
|
|
361
|
+
lane: 0,
|
|
362
|
+
laneCount: 1
|
|
363
|
+
};
|
|
364
|
+
return {
|
|
365
|
+
event: e.event,
|
|
366
|
+
lane: t.lane,
|
|
367
|
+
laneCount: t.laneCount,
|
|
368
|
+
startMinutes: e.startMinutes,
|
|
369
|
+
endMinutes: e.endMinutes,
|
|
370
|
+
clippedTop: e.clippedTop,
|
|
371
|
+
clippedBottom: e.clippedBottom
|
|
372
|
+
};
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function B(e, n) {
|
|
376
|
+
let { days: i } = n;
|
|
377
|
+
if (n.timezone, i.length === 0) return [];
|
|
378
|
+
let a = /* @__PURE__ */ new Map();
|
|
379
|
+
for (let e = 0; e < i.length; e++) a.set(x(i[e]), e);
|
|
380
|
+
x(i[i.length - 1]);
|
|
381
|
+
let o = [], s = /* @__PURE__ */ new Set();
|
|
382
|
+
for (let n of e) {
|
|
383
|
+
if (s.has(n.id) || (s.add(n.id), !r(n))) continue;
|
|
384
|
+
let e = n.start, c;
|
|
385
|
+
n.end ? (c = n.end.subtract({ days: 1 }), t.PlainDate.compare(c, e) < 0 && (c = e)) : c = e;
|
|
386
|
+
let l = i[0], u = i[i.length - 1];
|
|
387
|
+
if (t.PlainDate.compare(c, l) < 0 || t.PlainDate.compare(e, u) > 0) continue;
|
|
388
|
+
let d = t.PlainDate.compare(e, l) < 0 ? l : e, f = t.PlainDate.compare(c, u) > 0 ? u : c, p = a.get(x(d)), m = a.get(x(f));
|
|
389
|
+
p === void 0 || m === void 0 || o.push({
|
|
390
|
+
event: n,
|
|
391
|
+
startCol: p,
|
|
392
|
+
endCol: m,
|
|
393
|
+
clippedStart: t.PlainDate.compare(e, l) < 0,
|
|
394
|
+
clippedEnd: t.PlainDate.compare(c, u) > 0
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
if (o.length === 0) return [];
|
|
398
|
+
let c = R(o.map((e) => ({
|
|
399
|
+
id: e.event.id,
|
|
400
|
+
start: e.startCol,
|
|
401
|
+
end: e.endCol
|
|
402
|
+
}))), l = /* @__PURE__ */ new Map();
|
|
403
|
+
for (let e of c.bars) l.set(e.id, e.lane);
|
|
404
|
+
return o.map((e) => ({
|
|
405
|
+
event: e.event,
|
|
406
|
+
lane: l.get(e.event.id) ?? 0,
|
|
407
|
+
laneCount: c.laneCount,
|
|
408
|
+
startCol: e.startCol,
|
|
409
|
+
endCol: e.endCol,
|
|
410
|
+
clippedStart: e.clippedStart,
|
|
411
|
+
clippedEnd: e.clippedEnd
|
|
412
|
+
}));
|
|
413
|
+
}
|
|
414
|
+
function V(e, n, r) {
|
|
415
|
+
let i = e.withTimeZone(r), a = t.PlainDateTime.from({
|
|
416
|
+
year: n.year,
|
|
417
|
+
month: n.month,
|
|
418
|
+
day: n.day,
|
|
419
|
+
hour: 0,
|
|
420
|
+
minute: 0
|
|
421
|
+
}).toZonedDateTime(r, { disambiguation: "compatible" }), o = a.add({ days: 1 });
|
|
422
|
+
return t.ZonedDateTime.compare(i, a) < 0 ? -1 : t.ZonedDateTime.compare(i, o) >= 0 ? 1441 : i.hour * 60 + i.minute + i.second / 60;
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/core/monthGridLayout.ts
|
|
426
|
+
function H(e, n) {
|
|
427
|
+
let { gridDates: r, timezone: i } = n;
|
|
428
|
+
if (r.length !== 42) throw RangeError(`gridDates must have exactly 42 entries (got ${r.length})`);
|
|
429
|
+
let a = [];
|
|
430
|
+
for (let e = 0; e < 6; e++) {
|
|
431
|
+
let t = r.slice(e * 7, e * 7 + 7), n = /* @__PURE__ */ new Map();
|
|
432
|
+
for (let e = 0; e < 7; e++) n.set(x(t[e]), e);
|
|
433
|
+
a.push({
|
|
434
|
+
rowIndex: e,
|
|
435
|
+
days: t,
|
|
436
|
+
dayKeyToCol: n,
|
|
437
|
+
weekStart: t[0],
|
|
438
|
+
weekEnd: t[6]
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
let o = /* @__PURE__ */ new Set(), s = [], c = /* @__PURE__ */ new Map();
|
|
442
|
+
for (let t of e) {
|
|
443
|
+
if (o.has(t.id)) continue;
|
|
444
|
+
o.add(t.id);
|
|
445
|
+
let { firstDay: e, lastDayInclusive: n, isMultiDay: r } = U(t, i);
|
|
446
|
+
if (r) s.push({
|
|
447
|
+
event: t,
|
|
448
|
+
firstDay: e,
|
|
449
|
+
lastDayInclusive: n
|
|
450
|
+
});
|
|
451
|
+
else {
|
|
452
|
+
let n = x(e), r = c.get(n), i = {
|
|
453
|
+
event: t,
|
|
454
|
+
order: r ? r.length : 0
|
|
455
|
+
};
|
|
456
|
+
r ? r.push(i) : c.set(n, [i]);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return { weekRows: a.map((e) => {
|
|
460
|
+
let n = [];
|
|
461
|
+
for (let r of s) {
|
|
462
|
+
if (t.PlainDate.compare(r.lastDayInclusive, e.weekStart) < 0 || t.PlainDate.compare(r.firstDay, e.weekEnd) > 0) continue;
|
|
463
|
+
let i = t.PlainDate.compare(r.firstDay, e.weekStart) < 0 ? e.weekStart : r.firstDay, a = t.PlainDate.compare(r.lastDayInclusive, e.weekEnd) > 0 ? e.weekEnd : r.lastDayInclusive, o = e.dayKeyToCol.get(x(i)), s = e.dayKeyToCol.get(x(a));
|
|
464
|
+
o === void 0 || s === void 0 || n.push({
|
|
465
|
+
...r,
|
|
466
|
+
startCol: o,
|
|
467
|
+
endCol: s,
|
|
468
|
+
clippedStart: t.PlainDate.compare(r.firstDay, e.weekStart) < 0,
|
|
469
|
+
clippedEnd: t.PlainDate.compare(r.lastDayInclusive, e.weekEnd) > 0
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
let r = [];
|
|
473
|
+
if (n.length > 0) {
|
|
474
|
+
let e = R(n.map((e) => ({
|
|
475
|
+
id: e.event.id,
|
|
476
|
+
start: e.startCol,
|
|
477
|
+
end: e.endCol
|
|
478
|
+
}))), t = /* @__PURE__ */ new Map();
|
|
479
|
+
for (let n of e.bars) t.set(n.id, n.lane);
|
|
480
|
+
r = n.map((n) => ({
|
|
481
|
+
event: n.event,
|
|
482
|
+
lane: t.get(n.event.id) ?? 0,
|
|
483
|
+
laneCount: e.laneCount,
|
|
484
|
+
startCol: n.startCol,
|
|
485
|
+
endCol: n.endCol,
|
|
486
|
+
clippedStart: n.clippedStart,
|
|
487
|
+
clippedEnd: n.clippedEnd
|
|
488
|
+
}));
|
|
489
|
+
}
|
|
490
|
+
let i = /* @__PURE__ */ new Map();
|
|
491
|
+
for (let t of e.days) {
|
|
492
|
+
let e = x(t), n = c.get(e);
|
|
493
|
+
n && i.set(e, n);
|
|
494
|
+
}
|
|
495
|
+
return {
|
|
496
|
+
rowIndex: e.rowIndex,
|
|
497
|
+
weekStart: e.weekStart,
|
|
498
|
+
days: e.days,
|
|
499
|
+
multiDayBars: r,
|
|
500
|
+
cellPills: i
|
|
501
|
+
};
|
|
502
|
+
}) };
|
|
503
|
+
}
|
|
504
|
+
function U(e, n) {
|
|
505
|
+
if (r(e)) {
|
|
506
|
+
let n = e.start, r;
|
|
507
|
+
return e.end ? (r = e.end.subtract({ days: 1 }), t.PlainDate.compare(r, n) < 0 && (r = n)) : r = n, {
|
|
508
|
+
firstDay: n,
|
|
509
|
+
lastDayInclusive: r,
|
|
510
|
+
isMultiDay: t.PlainDate.compare(r, n) > 0
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
let i = S(e.start, n);
|
|
514
|
+
return {
|
|
515
|
+
firstDay: i,
|
|
516
|
+
lastDayInclusive: i,
|
|
517
|
+
isMultiDay: !1
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/core/agendaLayout.ts
|
|
522
|
+
function W(e, n) {
|
|
523
|
+
let { rangeStart: i, rangeEnd: a, timezone: o, showEmptyDays: s = !1 } = n, c = t.PlainDate.from(i), l = t.PlainDate.from(a);
|
|
524
|
+
if (t.PlainDate.compare(l, c) <= 0) return [];
|
|
525
|
+
let u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set();
|
|
526
|
+
function f(e) {
|
|
527
|
+
let t = u.get(e);
|
|
528
|
+
return t || (t = {
|
|
529
|
+
allDay: [],
|
|
530
|
+
timed: []
|
|
531
|
+
}, u.set(e, t)), t;
|
|
532
|
+
}
|
|
533
|
+
for (let n of e) {
|
|
534
|
+
if (d.has(n.id)) continue;
|
|
535
|
+
d.add(n.id);
|
|
536
|
+
let e = r(n), { firstDay: i, lastDayInclusive: a } = G(n, o), s = t.PlainDate.compare(i, c) < 0 ? c : i, u = l.subtract({ days: 1 }), p = t.PlainDate.compare(a, u) > 0 ? u : a;
|
|
537
|
+
if (t.PlainDate.compare(p, s) < 0) continue;
|
|
538
|
+
let m = s, h = !0;
|
|
539
|
+
for (; t.PlainDate.compare(m, p) <= 0;) {
|
|
540
|
+
let r = f(x(m)), a = t.PlainDate.compare(m, i) > 0 || !h;
|
|
541
|
+
if (e) r.allDay.push({
|
|
542
|
+
event: n,
|
|
543
|
+
isContinuation: a
|
|
544
|
+
});
|
|
545
|
+
else {
|
|
546
|
+
let e = a ? -Infinity : K(n, o);
|
|
547
|
+
r.timed.push({
|
|
548
|
+
event: n,
|
|
549
|
+
startMs: e,
|
|
550
|
+
isContinuation: a
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
h = !1, m = m.add({ days: 1 });
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
let p = [], m = c;
|
|
557
|
+
for (; t.PlainDate.compare(m, l) < 0;) {
|
|
558
|
+
let e = x(m), t = u.get(e), n = !!t && (t.allDay.length > 0 || t.timed.length > 0);
|
|
559
|
+
if ((n || s) && (p.push({
|
|
560
|
+
kind: "header",
|
|
561
|
+
date: e,
|
|
562
|
+
isEmpty: !n,
|
|
563
|
+
key: `h-${e}`
|
|
564
|
+
}), t)) {
|
|
565
|
+
t.allDay.sort((e, t) => e.event.id < t.event.id ? -1 : +(e.event.id > t.event.id));
|
|
566
|
+
for (let n of t.allDay) p.push({
|
|
567
|
+
kind: "event",
|
|
568
|
+
date: e,
|
|
569
|
+
event: n.event,
|
|
570
|
+
isContinuation: n.isContinuation,
|
|
571
|
+
key: `e-${e}-${n.event.id}`
|
|
572
|
+
});
|
|
573
|
+
t.timed.sort((e, t) => e.startMs === t.startMs ? e.event.id < t.event.id ? -1 : +(e.event.id > t.event.id) : e.startMs - t.startMs);
|
|
574
|
+
for (let n of t.timed) p.push({
|
|
575
|
+
kind: "event",
|
|
576
|
+
date: e,
|
|
577
|
+
event: n.event,
|
|
578
|
+
isContinuation: n.isContinuation,
|
|
579
|
+
key: `e-${e}-${n.event.id}`
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
m = m.add({ days: 1 });
|
|
583
|
+
}
|
|
584
|
+
return p;
|
|
585
|
+
}
|
|
586
|
+
function G(e, n) {
|
|
587
|
+
if (r(e)) {
|
|
588
|
+
let n = e.start, r;
|
|
589
|
+
return e.end ? (r = e.end.subtract({ days: 1 }), t.PlainDate.compare(r, n) < 0 && (r = n)) : r = n, {
|
|
590
|
+
firstDay: n,
|
|
591
|
+
lastDayInclusive: r
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
let i = S(e.start, n), a = i;
|
|
595
|
+
if (e.end) {
|
|
596
|
+
let r = e.end.withTimeZone(n), o = r.toPlainDate();
|
|
597
|
+
r.hour === 0 && r.minute === 0 && r.second === 0 && r.millisecond === 0 && r.microsecond === 0 && r.nanosecond === 0 ? (a = o.subtract({ days: 1 }), t.PlainDate.compare(a, i) < 0 && (a = i)) : a = o;
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
firstDay: i,
|
|
601
|
+
lastDayInclusive: a
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function K(e, t) {
|
|
605
|
+
return r(e) ? e.start.toZonedDateTime({ timeZone: t }).epochMilliseconds : e.start.epochMilliseconds;
|
|
606
|
+
}
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/core/measurementCache.ts
|
|
609
|
+
var q = class {
|
|
610
|
+
_itemCount;
|
|
611
|
+
_estimatedSize;
|
|
612
|
+
_measured;
|
|
613
|
+
_fenwick;
|
|
614
|
+
constructor(e, t) {
|
|
615
|
+
if (e < 0 || !Number.isFinite(e)) throw RangeError(`itemCount must be a non-negative finite number, got ${e}`);
|
|
616
|
+
if (t <= 0 || !Number.isFinite(t)) throw RangeError(`estimatedSize must be a positive finite number, got ${t}`);
|
|
617
|
+
this._itemCount = Math.floor(e), this._estimatedSize = t, this._measured = /* @__PURE__ */ new Map(), this._fenwick = new Float64Array(this._itemCount + 1);
|
|
618
|
+
}
|
|
619
|
+
get itemCount() {
|
|
620
|
+
return this._itemCount;
|
|
621
|
+
}
|
|
622
|
+
get estimatedSize() {
|
|
623
|
+
return this._estimatedSize;
|
|
624
|
+
}
|
|
625
|
+
get measuredCount() {
|
|
626
|
+
return this._measured.size;
|
|
627
|
+
}
|
|
628
|
+
has(e) {
|
|
629
|
+
return this._measured.has(e);
|
|
630
|
+
}
|
|
631
|
+
get(e) {
|
|
632
|
+
if (e < 0 || e >= this._itemCount) throw RangeError(`index ${e} out of range [0, ${this._itemCount})`);
|
|
633
|
+
return this._measured.get(e) ?? this._estimatedSize;
|
|
634
|
+
}
|
|
635
|
+
set(e, t) {
|
|
636
|
+
if (e < 0 || e >= this._itemCount) throw RangeError(`index ${e} out of range [0, ${this._itemCount})`);
|
|
637
|
+
if (t < 0 || !Number.isFinite(t)) throw RangeError(`size must be a non-negative finite number, got ${t}`);
|
|
638
|
+
let n = this._measured.has(e) ? this._measured.get(e) - this._estimatedSize : 0, r = t - this._estimatedSize - n;
|
|
639
|
+
if (this._measured.set(e, t), r !== 0) {
|
|
640
|
+
let t = e + 1;
|
|
641
|
+
for (; t <= this._itemCount;) this._fenwick[t] += r, t += t & -t;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
unset(e) {
|
|
645
|
+
if (e < 0 || e >= this._itemCount) throw RangeError(`index ${e} out of range [0, ${this._itemCount})`);
|
|
646
|
+
if (!this._measured.has(e)) return;
|
|
647
|
+
let t = this._measured.get(e) - this._estimatedSize;
|
|
648
|
+
if (this._measured.delete(e), t !== 0) {
|
|
649
|
+
let n = e + 1;
|
|
650
|
+
for (; n <= this._itemCount;) this._fenwick[n] -= t, n += n & -n;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
clear() {
|
|
654
|
+
this._measured.clear(), this._fenwick = new Float64Array(this._itemCount + 1);
|
|
655
|
+
}
|
|
656
|
+
resize(e) {
|
|
657
|
+
if (e < 0 || !Number.isFinite(e)) throw RangeError(`newCount must be a non-negative finite number, got ${e}`);
|
|
658
|
+
let t = Math.floor(e);
|
|
659
|
+
if (t === this._itemCount) return;
|
|
660
|
+
let n = /* @__PURE__ */ new Map();
|
|
661
|
+
for (let [e, r] of this._measured) e < t && n.set(e, r);
|
|
662
|
+
this._itemCount = t, this._measured = n, this._fenwick = new Float64Array(t + 1);
|
|
663
|
+
for (let [e, r] of n) {
|
|
664
|
+
let n = r - this._estimatedSize;
|
|
665
|
+
if (n === 0) continue;
|
|
666
|
+
let i = e + 1;
|
|
667
|
+
for (; i <= t;) this._fenwick[i] += n, i += i & -i;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
prefixSum(e) {
|
|
671
|
+
if (e <= 0) return 0;
|
|
672
|
+
let t = e >= this._itemCount ? this._itemCount : Math.floor(e), n = 0, r = t;
|
|
673
|
+
for (; r > 0;) n += this._fenwick[r], r -= r & -r;
|
|
674
|
+
return t * this._estimatedSize + n;
|
|
675
|
+
}
|
|
676
|
+
totalSize() {
|
|
677
|
+
return this.prefixSum(this._itemCount);
|
|
678
|
+
}
|
|
679
|
+
indexAtOffset(e) {
|
|
680
|
+
if (this._itemCount === 0 || e <= 0) return 0;
|
|
681
|
+
let t = 0, n = this._itemCount;
|
|
682
|
+
for (; t < n;) {
|
|
683
|
+
let r = t + n >>> 1;
|
|
684
|
+
this.prefixSum(r + 1) <= e ? t = r + 1 : n = r;
|
|
685
|
+
}
|
|
686
|
+
return t >= this._itemCount ? this._itemCount - 1 : t;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/core/virtualScroll.ts
|
|
691
|
+
function J(e, t, n, r = 3) {
|
|
692
|
+
if (e.itemCount === 0) return {
|
|
693
|
+
startIndex: 0,
|
|
694
|
+
endIndex: 0,
|
|
695
|
+
offset: 0,
|
|
696
|
+
totalSize: 0
|
|
697
|
+
};
|
|
698
|
+
if (r < 0 || !Number.isFinite(r)) throw RangeError(`overscan must be a non-negative finite number, got ${r}`);
|
|
699
|
+
if (n < 0 || !Number.isFinite(n)) throw RangeError(`viewportSize must be a non-negative finite number, got ${n}`);
|
|
700
|
+
let i = e.totalSize(), a = t < 0 ? 0 : t > i ? i : t, o = e.indexAtOffset(a), s = a + n, c = s >= i ? e.itemCount - 1 : e.indexAtOffset(s), l = Math.max(0, o - Math.floor(r));
|
|
701
|
+
return {
|
|
702
|
+
startIndex: l,
|
|
703
|
+
endIndex: Math.min(e.itemCount, c + 1 + Math.floor(r)),
|
|
704
|
+
offset: e.prefixSum(l),
|
|
705
|
+
totalSize: i
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
function Y(e, t, n, r, i, a, o = 3, s = 3) {
|
|
709
|
+
return {
|
|
710
|
+
x: J(e, n, i, o),
|
|
711
|
+
y: J(t, r, a, s)
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
function X(e, t, n) {
|
|
715
|
+
if (n < 0) throw RangeError(`anchorIndex must be non-negative, got ${n}`);
|
|
716
|
+
let r = e.prefixSum(n);
|
|
717
|
+
return t.prefixSum(n) - r;
|
|
718
|
+
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/core/dragHitTest.ts
|
|
721
|
+
function re(e, t, n, r, i) {
|
|
722
|
+
if (r.itemCount === 0) return {
|
|
723
|
+
itemIndex: -1,
|
|
724
|
+
ratio: NaN,
|
|
725
|
+
pixelInItem: 0
|
|
726
|
+
};
|
|
727
|
+
let a = e - t;
|
|
728
|
+
if (i !== void 0 && (a < 0 || a >= i)) return {
|
|
729
|
+
itemIndex: -1,
|
|
730
|
+
ratio: NaN,
|
|
731
|
+
pixelInItem: 0
|
|
732
|
+
};
|
|
733
|
+
let o = a + n;
|
|
734
|
+
if (o < 0) return {
|
|
735
|
+
itemIndex: -1,
|
|
736
|
+
ratio: NaN,
|
|
737
|
+
pixelInItem: 0
|
|
738
|
+
};
|
|
739
|
+
let s = r.indexAtOffset(o);
|
|
740
|
+
if (o >= r.totalSize()) return {
|
|
741
|
+
itemIndex: -1,
|
|
742
|
+
ratio: NaN,
|
|
743
|
+
pixelInItem: 0
|
|
744
|
+
};
|
|
745
|
+
let c = r.prefixSum(s), l = r.get(s), u = o - c;
|
|
746
|
+
return {
|
|
747
|
+
itemIndex: s,
|
|
748
|
+
ratio: l > 0 ? u / l : 0,
|
|
749
|
+
pixelInItem: u
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
function ie(e, t, n, r = {}) {
|
|
753
|
+
let i = r.hotZone ?? 30, a = r.maxVelocity ?? 24, o = r.curve ?? "linear";
|
|
754
|
+
if (i <= 0 || a <= 0) return {
|
|
755
|
+
velocityX: 0,
|
|
756
|
+
velocityY: 0
|
|
757
|
+
};
|
|
758
|
+
let { left: s, top: c, right: l, bottom: u } = n, d = t - c, f = u - t, p = e - s, m = l - e;
|
|
759
|
+
function h(e) {
|
|
760
|
+
if (e >= i) return 0;
|
|
761
|
+
if (e <= 0) return 1;
|
|
762
|
+
let t = 1 - e / i;
|
|
763
|
+
return o === "quadratic" ? t * t : t;
|
|
764
|
+
}
|
|
765
|
+
if (t < c || t > u || e < s || e > l) return {
|
|
766
|
+
velocityX: 0,
|
|
767
|
+
velocityY: 0
|
|
768
|
+
};
|
|
769
|
+
let g = h(d), _ = h(f), v = h(p), y = h(m), b = (_ - g) * a;
|
|
770
|
+
return {
|
|
771
|
+
velocityX: (y - v) * a,
|
|
772
|
+
velocityY: b
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region src/core/dnd/move-math.ts
|
|
777
|
+
var ae = 15, Z = class extends Error {
|
|
778
|
+
disambiguation;
|
|
779
|
+
constructor(e, t) {
|
|
780
|
+
super(t), this.name = "DstResolutionError", this.disambiguation = e;
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
function Q(t, n) {
|
|
784
|
+
let r;
|
|
785
|
+
try {
|
|
786
|
+
r = e.PlainDateTime.from({
|
|
787
|
+
year: n.year,
|
|
788
|
+
month: n.month,
|
|
789
|
+
day: n.day,
|
|
790
|
+
hour: n.hour,
|
|
791
|
+
minute: n.minute,
|
|
792
|
+
second: n.second ?? 0
|
|
793
|
+
});
|
|
794
|
+
} catch {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
try {
|
|
798
|
+
return r.toZonedDateTime(t, { disambiguation: "reject" }), null;
|
|
799
|
+
} catch {}
|
|
800
|
+
let i;
|
|
801
|
+
try {
|
|
802
|
+
i = r.toZonedDateTime(t, { disambiguation: "earlier" });
|
|
803
|
+
} catch {
|
|
804
|
+
return null;
|
|
805
|
+
}
|
|
806
|
+
let a = i.toPlainDateTime();
|
|
807
|
+
return e.PlainDateTime.compare(a, r) === 0 ? "overlap" : "gap";
|
|
808
|
+
}
|
|
809
|
+
function oe(e, t, n, r, i, a) {
|
|
810
|
+
let o = $(t, r, i, e);
|
|
811
|
+
return {
|
|
812
|
+
event: t,
|
|
813
|
+
original: {
|
|
814
|
+
start: n.start,
|
|
815
|
+
...n.end === void 0 ? {} : { end: n.end },
|
|
816
|
+
displayZone: n.displayZone
|
|
817
|
+
},
|
|
818
|
+
next: o,
|
|
819
|
+
target: {
|
|
820
|
+
...r,
|
|
821
|
+
date: r.date,
|
|
822
|
+
minutes: r.minutes,
|
|
823
|
+
displayZone: r.displayZone,
|
|
824
|
+
disambiguation: o.disambiguation ?? null
|
|
825
|
+
},
|
|
826
|
+
native: a
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
function $(t, i, a, o = "compatible") {
|
|
830
|
+
if (r(t)) {
|
|
831
|
+
let n = t.start, r = t.end ?? n.add({ days: 1 }), o = e.PlainDate.from(i.date);
|
|
832
|
+
if (a === "allDay-resize-start" || a === "month-resize-start") {
|
|
833
|
+
let t = r.subtract({ days: 1 });
|
|
834
|
+
return {
|
|
835
|
+
start: e.PlainDate.compare(o, t) > 0 ? t : o,
|
|
836
|
+
end: r
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
if (a === "allDay-resize-end" || a === "month-resize-end") {
|
|
840
|
+
let t = n.add({ days: 1 }), r = o.add({ days: 1 });
|
|
841
|
+
return {
|
|
842
|
+
start: n,
|
|
843
|
+
end: e.PlainDate.compare(r, t) < 0 ? t : r
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
let s = n.until(r).total({ unit: "days" }), c = o, l = c.add({ days: s });
|
|
847
|
+
return t.end ? {
|
|
848
|
+
start: c,
|
|
849
|
+
end: l
|
|
850
|
+
} : { start: c };
|
|
851
|
+
}
|
|
852
|
+
if (!n(t)) throw TypeError(`[applyMoveToEvent] event ${t.id} has unrecognised start shape`);
|
|
853
|
+
let s = t.start.timeZoneId, c = t.end?.timeZoneId ?? s, l = t.start, u = t.end ?? null, d = e.PlainDate.from(i.date);
|
|
854
|
+
if (i.minutes === null && (a === "timed" || a === "timed-resize-start" || a === "timed-resize-end")) throw TypeError(`[applyMoveToEvent] timed event ${t.id} cannot be dropped onto an all-day target (target.minutes === null). To convert a timed event to all-day, change the event's start to a Temporal.PlainDate explicitly in your event-source — the drop API does not auto-convert.`);
|
|
855
|
+
let f = e.PlainTime.from({
|
|
856
|
+
hour: Math.floor(i.minutes / 60),
|
|
857
|
+
minute: i.minutes % 60
|
|
858
|
+
}), p = Q(i.displayZone, {
|
|
859
|
+
year: d.year,
|
|
860
|
+
month: d.month,
|
|
861
|
+
day: d.day,
|
|
862
|
+
hour: f.hour,
|
|
863
|
+
minute: f.minute
|
|
864
|
+
});
|
|
865
|
+
if (p && o === "reject") throw new Z(p, `[applyMoveToEvent] target ${i.date}T${String(f.hour).padStart(2, "0")}:${String(f.minute).padStart(2, "0")} is a DST ${p} in ${i.displayZone}; policy='reject'.`);
|
|
866
|
+
let m = o === "reject" ? "compatible" : o, h = e.PlainDateTime.from({
|
|
867
|
+
year: d.year,
|
|
868
|
+
month: d.month,
|
|
869
|
+
day: d.day,
|
|
870
|
+
hour: f.hour,
|
|
871
|
+
minute: f.minute
|
|
872
|
+
}).toZonedDateTime(i.displayZone, { disambiguation: m }), g = h.withTimeZone(s), _ = h.withTimeZone(c), v = p;
|
|
873
|
+
if (a === "timed-resize-start") {
|
|
874
|
+
let t = g;
|
|
875
|
+
if (u) {
|
|
876
|
+
let n = u.subtract({ minutes: 15 }).withTimeZone(s);
|
|
877
|
+
e.Instant.compare(t.toInstant(), n.toInstant()) > 0 && (t = n);
|
|
878
|
+
}
|
|
879
|
+
return {
|
|
880
|
+
start: t,
|
|
881
|
+
...u ? { end: u } : {},
|
|
882
|
+
disambiguation: v
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
if (a === "timed-resize-end") {
|
|
886
|
+
let t = l.add({ minutes: 15 }).withTimeZone(c), n = _;
|
|
887
|
+
return e.Instant.compare(n.toInstant(), t.toInstant()) < 0 && (n = t), {
|
|
888
|
+
start: l,
|
|
889
|
+
end: n,
|
|
890
|
+
disambiguation: v
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
if (a === "month-resize-start") {
|
|
894
|
+
let t = l.withTimeZone(i.displayZone), n = Q(i.displayZone, {
|
|
895
|
+
year: d.year,
|
|
896
|
+
month: d.month,
|
|
897
|
+
day: d.day,
|
|
898
|
+
hour: t.hour,
|
|
899
|
+
minute: t.minute,
|
|
900
|
+
second: t.second
|
|
901
|
+
});
|
|
902
|
+
if (n && o === "reject") throw new Z(n, `[applyMoveToEvent] month-resize-start lands in a DST ${n} in ${i.displayZone}; policy='reject'.`);
|
|
903
|
+
let r = o === "reject" ? "compatible" : o, a = e.PlainDateTime.from({
|
|
904
|
+
year: d.year,
|
|
905
|
+
month: d.month,
|
|
906
|
+
day: d.day,
|
|
907
|
+
hour: t.hour,
|
|
908
|
+
minute: t.minute,
|
|
909
|
+
second: t.second
|
|
910
|
+
}).toZonedDateTime(i.displayZone, { disambiguation: r }).withTimeZone(s);
|
|
911
|
+
if (u) {
|
|
912
|
+
let t = u.subtract({ minutes: 15 }).withTimeZone(s);
|
|
913
|
+
e.Instant.compare(a.toInstant(), t.toInstant()) > 0 && (a = t);
|
|
914
|
+
}
|
|
915
|
+
return {
|
|
916
|
+
start: a,
|
|
917
|
+
...u ? { end: u } : {},
|
|
918
|
+
disambiguation: n
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
if (a === "month-resize-end") {
|
|
922
|
+
let t = u ?? l, n = u ? c : s, r = t.withTimeZone(i.displayZone), a = Q(i.displayZone, {
|
|
923
|
+
year: d.year,
|
|
924
|
+
month: d.month,
|
|
925
|
+
day: d.day,
|
|
926
|
+
hour: r.hour,
|
|
927
|
+
minute: r.minute,
|
|
928
|
+
second: r.second
|
|
929
|
+
});
|
|
930
|
+
if (a && o === "reject") throw new Z(a, `[applyMoveToEvent] month-resize-end lands in a DST ${a} in ${i.displayZone}; policy='reject'.`);
|
|
931
|
+
let f = o === "reject" ? "compatible" : o, p = e.PlainDateTime.from({
|
|
932
|
+
year: d.year,
|
|
933
|
+
month: d.month,
|
|
934
|
+
day: d.day,
|
|
935
|
+
hour: r.hour,
|
|
936
|
+
minute: r.minute,
|
|
937
|
+
second: r.second
|
|
938
|
+
}).toZonedDateTime(i.displayZone, { disambiguation: f }).withTimeZone(n), m = l.add({ minutes: 15 }).withTimeZone(n);
|
|
939
|
+
return e.Instant.compare(p.toInstant(), m.toInstant()) < 0 && (p = m), {
|
|
940
|
+
start: l,
|
|
941
|
+
end: p,
|
|
942
|
+
disambiguation: a
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
if (u) {
|
|
946
|
+
let e = u.epochMilliseconds - l.epochMilliseconds;
|
|
947
|
+
return {
|
|
948
|
+
start: g,
|
|
949
|
+
end: g.add({ milliseconds: e }).withTimeZone(c),
|
|
950
|
+
disambiguation: v
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
return {
|
|
954
|
+
start: g,
|
|
955
|
+
disambiguation: v
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
//#endregion
|
|
959
|
+
export { m as A, p as B, t as C, c as D, d as E, y as F, i as G, v as H, w as I, te as L, T as M, _ as N, l as O, b as P, ee as R, D as S, x as T, r as U, C as V, n as W, k as _, ie as a, A as b, J as c, W as d, H as f, O as g, R as h, oe as i, S as j, g as k, Y as l, z as m, ae as n, re as o, B as p, $ as r, X as s, Z as t, q as u, M as v, f as w, ne as x, j as y, h as z };
|