@cocoar/vue-calendar 3.2.0 → 3.3.0-beta.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocoar/vue-calendar",
3
- "version": "3.2.0",
3
+ "version": "3.3.0-beta.8",
4
4
  "description": "Vue 3 calendar component — Temporal-only public surface, single drop pipeline, per-endpoint source-zone preservation, explicit DST policy. Built on the principles laid out in the Time in Software, Done Right article series.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -62,8 +62,8 @@
62
62
  "rrule-temporal": "~1.5.3"
63
63
  },
64
64
  "peerDependencies": {
65
- "@cocoar/vue-localization": "3.2.0",
66
- "@cocoar/vue-ui": "3.2.0",
65
+ "@cocoar/vue-localization": "3.3.0-beta.8",
66
+ "@cocoar/vue-ui": "3.3.0-beta.8",
67
67
  "vue": "^3.5.0"
68
68
  },
69
69
  "devDependencies": {
@@ -1,223 +0,0 @@
1
- import { Temporal as e } from "@js-temporal/polyfill";
2
- //#region src/core/types.ts
3
- function t(e) {
4
- return "timeZoneId" in e.start;
5
- }
6
- function n(e) {
7
- return !("timeZoneId" in e.start);
8
- }
9
- function r(t) {
10
- let { id: n, start: r, end: a } = 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 (a !== void 0) {
19
- let t = a instanceof e.ZonedDateTime, i = a instanceof e.PlainDate;
20
- if (!t && !i) throw TypeError(`[CalendarEvent ${n}] end must be Temporal.ZonedDateTime or Temporal.PlainDate. Got ${a?.constructor?.name ?? typeof a}.`);
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(), a.toInstant()) >= 0) throw RangeError(`[CalendarEvent ${n}] end must be strictly after start.`);
24
- } else if (e.PlainDate.compare(r, a) >= 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) && !i.has(n)) {
28
- i.add(n);
29
- let e = `[@cocoar/vue-calendar] [CalendarEvent ${n}] meta.rrule / .rdate / .exdate / .recurrenceId is set, but recurrence is a separate series pipeline. This event renders only at \`start\`. Construct a \`RecurringSeries\` and bind it through \`CalendarBuilder.series(...)\` instead of putting rules into event metadata.`;
30
- typeof console < "u" && console.warn(e);
31
- }
32
- }
33
- var i = /* @__PURE__ */ new Set(), a = 15, o = class extends Error {
34
- disambiguation;
35
- constructor(e, t) {
36
- super(t), this.name = "DstResolutionError", this.disambiguation = e;
37
- }
38
- };
39
- function s(t, n) {
40
- let r;
41
- try {
42
- r = e.PlainDateTime.from({
43
- year: n.year,
44
- month: n.month,
45
- day: n.day,
46
- hour: n.hour,
47
- minute: n.minute,
48
- second: n.second ?? 0
49
- });
50
- } catch {
51
- return null;
52
- }
53
- try {
54
- return r.toZonedDateTime(t, { disambiguation: "reject" }), null;
55
- } catch {}
56
- let i;
57
- try {
58
- i = r.toZonedDateTime(t, { disambiguation: "earlier" });
59
- } catch {
60
- return null;
61
- }
62
- let a = i.toPlainDateTime();
63
- return e.PlainDateTime.compare(a, r) === 0 ? "overlap" : "gap";
64
- }
65
- function c(e, t, n, r, i, a) {
66
- let o = l(t, r, i, e);
67
- return {
68
- event: t,
69
- original: {
70
- start: n.start,
71
- ...n.end === void 0 ? {} : { end: n.end },
72
- displayZone: n.displayZone
73
- },
74
- next: o,
75
- target: {
76
- ...r,
77
- date: r.date,
78
- minutes: r.minutes,
79
- displayZone: r.displayZone,
80
- disambiguation: o.disambiguation ?? null
81
- },
82
- native: a
83
- };
84
- }
85
- function l(r, i, a, c = "compatible") {
86
- if (n(r)) {
87
- let t = r.start, n = r.end ?? t.add({ days: 1 }), o = e.PlainDate.from(i.date);
88
- if (a === "allDay-resize-start" || a === "month-resize-start") {
89
- let t = n.subtract({ days: 1 });
90
- return {
91
- start: e.PlainDate.compare(o, t) > 0 ? t : o,
92
- end: n
93
- };
94
- }
95
- if (a === "allDay-resize-end" || a === "month-resize-end") {
96
- let n = t.add({ days: 1 }), r = o.add({ days: 1 });
97
- return {
98
- start: t,
99
- end: e.PlainDate.compare(r, n) < 0 ? n : r
100
- };
101
- }
102
- let s = t.until(n).total({ unit: "days" }), c = o, l = c.add({ days: s });
103
- return r.end ? {
104
- start: c,
105
- end: l
106
- } : { start: c };
107
- }
108
- if (!t(r)) throw TypeError(`[applyMoveToEvent] event ${r.id} has unrecognised start shape`);
109
- let l = r.start.timeZoneId, u = r.end?.timeZoneId ?? l, d = r.start, f = r.end ?? null, p = e.PlainDate.from(i.date);
110
- if (i.minutes === null && a === "month") {
111
- let e = d.withTimeZone(i.displayZone).toPlainDate().until(p, { largestUnit: "days" }).days;
112
- return {
113
- start: d.add({ days: e }),
114
- ...f ? { end: f.add({ days: e }) } : {},
115
- disambiguation: null
116
- };
117
- }
118
- if (i.minutes === null && (a === "timed" || a === "timed-resize-start" || a === "timed-resize-end")) throw TypeError(`[applyMoveToEvent] timed event ${r.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.`);
119
- let m = e.PlainTime.from({
120
- hour: Math.floor(i.minutes / 60),
121
- minute: i.minutes % 60
122
- }), h = s(i.displayZone, {
123
- year: p.year,
124
- month: p.month,
125
- day: p.day,
126
- hour: m.hour,
127
- minute: m.minute
128
- });
129
- if (h && c === "reject") throw new o(h, `[applyMoveToEvent] target ${i.date}T${String(m.hour).padStart(2, "0")}:${String(m.minute).padStart(2, "0")} is a DST ${h} in ${i.displayZone}; policy='reject'.`);
130
- let g = c === "reject" ? "compatible" : c, _ = e.PlainDateTime.from({
131
- year: p.year,
132
- month: p.month,
133
- day: p.day,
134
- hour: m.hour,
135
- minute: m.minute
136
- }).toZonedDateTime(i.displayZone, { disambiguation: g }), v = _.withTimeZone(l), y = _.withTimeZone(u), b = h;
137
- if (a === "timed-resize-start") {
138
- let t = v;
139
- if (f) {
140
- let n = f.subtract({ minutes: 15 }).withTimeZone(l);
141
- e.Instant.compare(t.toInstant(), n.toInstant()) > 0 && (t = n);
142
- }
143
- return {
144
- start: t,
145
- ...f ? { end: f } : {},
146
- disambiguation: b
147
- };
148
- }
149
- if (a === "timed-resize-end") {
150
- let t = d.add({ minutes: 15 }).withTimeZone(u), n = y;
151
- return e.Instant.compare(n.toInstant(), t.toInstant()) < 0 && (n = t), {
152
- start: d,
153
- end: n,
154
- disambiguation: b
155
- };
156
- }
157
- if (a === "month-resize-start") {
158
- let t = d.withTimeZone(i.displayZone), n = s(i.displayZone, {
159
- year: p.year,
160
- month: p.month,
161
- day: p.day,
162
- hour: t.hour,
163
- minute: t.minute,
164
- second: t.second
165
- });
166
- if (n && c === "reject") throw new o(n, `[applyMoveToEvent] month-resize-start lands in a DST ${n} in ${i.displayZone}; policy='reject'.`);
167
- let r = c === "reject" ? "compatible" : c, a = e.PlainDateTime.from({
168
- year: p.year,
169
- month: p.month,
170
- day: p.day,
171
- hour: t.hour,
172
- minute: t.minute,
173
- second: t.second
174
- }).toZonedDateTime(i.displayZone, { disambiguation: r }).withTimeZone(l);
175
- if (f) {
176
- let t = f.subtract({ minutes: 15 }).withTimeZone(l);
177
- e.Instant.compare(a.toInstant(), t.toInstant()) > 0 && (a = t);
178
- }
179
- return {
180
- start: a,
181
- ...f ? { end: f } : {},
182
- disambiguation: n
183
- };
184
- }
185
- if (a === "month-resize-end") {
186
- let t = f ?? d, n = f ? u : l, r = t.withTimeZone(i.displayZone), a = s(i.displayZone, {
187
- year: p.year,
188
- month: p.month,
189
- day: p.day,
190
- hour: r.hour,
191
- minute: r.minute,
192
- second: r.second
193
- });
194
- if (a && c === "reject") throw new o(a, `[applyMoveToEvent] month-resize-end lands in a DST ${a} in ${i.displayZone}; policy='reject'.`);
195
- let m = c === "reject" ? "compatible" : c, h = e.PlainDateTime.from({
196
- year: p.year,
197
- month: p.month,
198
- day: p.day,
199
- hour: r.hour,
200
- minute: r.minute,
201
- second: r.second
202
- }).toZonedDateTime(i.displayZone, { disambiguation: m }).withTimeZone(n), g = d.add({ minutes: 15 }).withTimeZone(n);
203
- return e.Instant.compare(h.toInstant(), g.toInstant()) < 0 && (h = g), {
204
- start: d,
205
- end: h,
206
- disambiguation: a
207
- };
208
- }
209
- if (f) {
210
- let e = f.epochMilliseconds - d.epochMilliseconds;
211
- return {
212
- start: v,
213
- end: v.add({ milliseconds: e }).withTimeZone(u),
214
- disambiguation: b
215
- };
216
- }
217
- return {
218
- start: v,
219
- disambiguation: b
220
- };
221
- }
222
- //#endregion
223
- export { s as a, r as c, c as i, a as n, n as o, l as r, t as s, o as t };