@mintplayer/web-components 2.7.0 → 2.8.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/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +19 -1
- package/chunks/{id-BstjfRrz.mjs → id-DNZVAnGC.mjs} +267 -162
- package/chunks/{mp-calendar.element-u6uS31_j.mjs → mp-calendar.element-CJ8-t-Zn.mjs} +71 -39
- package/chunks/{mp-datetime-picker.element-MPTRHwyc.mjs → mp-datetime-picker.element-D1CiLbHm.mjs} +1 -1
- package/datepicker/index.mjs +1 -1
- package/datetime-picker/index.mjs +1 -1
- package/package.json +1 -1
- package/scheduler/index.mjs +1332 -765
- package/scheduler/src/components/mp-scheduler.d.ts +186 -1
- package/scheduler/src/input/input-handler.d.ts +22 -0
- package/scheduler/src/views/base-view.d.ts +30 -1
- package/scheduler/src/views/index.d.ts +1 -1
- package/scheduler/src/views/timeline-view.d.ts +39 -15
- package/scheduler/src/views/year-view.d.ts +7 -0
- package/scheduler-core/index.mjs +42 -40
- package/scheduler-core/src/models/messages.d.ts +29 -0
- package/scheduler-core/src/models/options.d.ts +24 -7
- package/scheduler-core/src/services/date.service.d.ts +64 -10
- package/scheduler-core/src/utils/color.d.ts +19 -0
|
@@ -163,24 +163,24 @@ class y extends p {
|
|
|
163
163
|
}
|
|
164
164
|
/** Compute the weeks rendered for the current month, honoring firstDayOfWeek. */
|
|
165
165
|
getWeeks(e) {
|
|
166
|
-
const t = new Date(e.getFullYear(), e.getMonth(), 1), n = new Date(e.getFullYear(), e.getMonth() + 1, 0), r = this.startOfWeek(t),
|
|
167
|
-
for (let
|
|
168
|
-
const h = new Date(r.getFullYear(), r.getMonth(), r.getDate() +
|
|
166
|
+
const t = new Date(e.getFullYear(), e.getMonth(), 1), n = new Date(e.getFullYear(), e.getMonth() + 1, 0), r = this.startOfWeek(t), o = this.endOfWeek(n), s = this.daysBetween(r, o) + 1, l = [];
|
|
167
|
+
for (let i = 0; i < s; i++) {
|
|
168
|
+
const h = new Date(r.getFullYear(), r.getMonth(), r.getDate() + i);
|
|
169
169
|
l.push({
|
|
170
170
|
date: h,
|
|
171
171
|
dayOfMonth: h.getDate(),
|
|
172
172
|
isInMonth: h.getFullYear() === e.getFullYear() && h.getMonth() === e.getMonth()
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
const
|
|
176
|
-
for (let
|
|
177
|
-
const h = l.slice(
|
|
178
|
-
|
|
179
|
-
number: this.weekOfYear(
|
|
175
|
+
const a = [];
|
|
176
|
+
for (let i = 0; i < l.length; i += 7) {
|
|
177
|
+
const h = l.slice(i, i + 7), d = h.find((g) => g.isInMonth), f = d ? d.date : h[0].date;
|
|
178
|
+
a.push({
|
|
179
|
+
number: this.weekOfYear(f),
|
|
180
180
|
days: h
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
return
|
|
183
|
+
return a;
|
|
184
184
|
}
|
|
185
185
|
/** First day of the visible grid — Monday-on-top by default. */
|
|
186
186
|
startOfWeek(e) {
|
|
@@ -194,12 +194,44 @@ class y extends p {
|
|
|
194
194
|
daysBetween(e, t) {
|
|
195
195
|
return Math.floor((this.dateOnly(t) - this.dateOnly(e)) / 864e5);
|
|
196
196
|
}
|
|
197
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* How many days of a year a week must contain to count as that year's week 1.
|
|
199
|
+
* ISO says 4 (the Thursday rule); the US convention says 1 (week 1 is simply
|
|
200
|
+
* the week containing Jan 1). `Intl` reports it per locale, and it is the ONLY
|
|
201
|
+
* thing that distinguishes the two systems once the week start is known.
|
|
202
|
+
*/
|
|
203
|
+
minimalDaysInFirstWeek() {
|
|
204
|
+
try {
|
|
205
|
+
const e = new Intl.Locale(this.locale ?? navigator.language), t = typeof e.getWeekInfo == "function" ? e.getWeekInfo()?.minimalDays : e.weekInfo?.minimalDays;
|
|
206
|
+
if (typeof t == "number") return t;
|
|
207
|
+
} catch {
|
|
208
|
+
}
|
|
209
|
+
return this.firstDayOfWeek === 1 ? 4 : 1;
|
|
210
|
+
}
|
|
211
|
+
/** The start of the week that owns week 1 of `year`. */
|
|
212
|
+
firstWeekStart(e) {
|
|
213
|
+
return this.startOfWeek(new Date(e, 0, this.minimalDaysInFirstWeek()));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Week-of-year honouring BOTH the week start and the locale's minimal-days
|
|
217
|
+
* rule.
|
|
218
|
+
*
|
|
219
|
+
* Was hardcoded ISO-8601, which is only correct for a Monday-start week. Under
|
|
220
|
+
* a Sunday start — what en-US and ja-JP resolve to — it labelled two
|
|
221
|
+
* consecutive rows of January 2026 "week 1" and ran one short from then on.
|
|
222
|
+
* That column is a real `<th scope="row">`, so a screen reader read the wrong
|
|
223
|
+
* number, and the scheduler's own editor renders this calendar.
|
|
224
|
+
*/
|
|
198
225
|
weekOfYear(e) {
|
|
199
|
-
const t =
|
|
200
|
-
t.
|
|
201
|
-
|
|
202
|
-
|
|
226
|
+
const t = this.startOfWeek(e);
|
|
227
|
+
let n = t.getFullYear(), r = this.firstWeekStart(n);
|
|
228
|
+
if (t.getTime() < r.getTime())
|
|
229
|
+
r = this.firstWeekStart(--n);
|
|
230
|
+
else {
|
|
231
|
+
const o = this.firstWeekStart(n + 1);
|
|
232
|
+
t.getTime() >= o.getTime() && (r = o);
|
|
233
|
+
}
|
|
234
|
+
return Math.round(this.daysBetween(r, t) / 7) + 1;
|
|
203
235
|
}
|
|
204
236
|
/** Localized weekday short + long names, in the order driven by firstDayOfWeek. */
|
|
205
237
|
weekdayNames() {
|
|
@@ -229,15 +261,15 @@ class y extends p {
|
|
|
229
261
|
focusableDate() {
|
|
230
262
|
const e = this.currentMonth;
|
|
231
263
|
if (!e) return null;
|
|
232
|
-
const t = (
|
|
264
|
+
const t = (a) => a.getFullYear() === e.getFullYear() && a.getMonth() === e.getMonth(), n = (a) => a && t(a) ? a : null, r = n(this._focusedDate);
|
|
233
265
|
if (r) return r;
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
266
|
+
const o = n(this.selectedDate);
|
|
267
|
+
if (o) return o;
|
|
236
268
|
const l = n(/* @__PURE__ */ new Date());
|
|
237
269
|
if (l) return l;
|
|
238
|
-
for (const
|
|
239
|
-
for (const
|
|
240
|
-
if (
|
|
270
|
+
for (const a of this.getWeeks(e))
|
|
271
|
+
for (const i of a.days)
|
|
272
|
+
if (i && i.isInMonth && !this.isDisabled(i.date)) return i.date;
|
|
241
273
|
return null;
|
|
242
274
|
}
|
|
243
275
|
/* ---- Public API ---- */
|
|
@@ -280,21 +312,21 @@ class y extends p {
|
|
|
280
312
|
/* ---- Keyboard ---- */
|
|
281
313
|
onCellKeyDown(e, t) {
|
|
282
314
|
if (!t || !t.isInMonth) return;
|
|
283
|
-
const n = e.key, r = n === "ArrowLeft" || n === "ArrowRight" || n === "ArrowUp" || n === "ArrowDown" || n === "Home" || n === "End" || n === "PageUp" || n === "PageDown",
|
|
284
|
-
if (!r && !
|
|
285
|
-
if (e.preventDefault(),
|
|
315
|
+
const n = e.key, r = n === "ArrowLeft" || n === "ArrowRight" || n === "ArrowUp" || n === "ArrowDown" || n === "Home" || n === "End" || n === "PageUp" || n === "PageDown", o = n === "Enter" || n === " ";
|
|
316
|
+
if (!r && !o) return;
|
|
317
|
+
if (e.preventDefault(), o) {
|
|
286
318
|
this.goto(t);
|
|
287
319
|
return;
|
|
288
320
|
}
|
|
289
321
|
const s = t.date;
|
|
290
322
|
let l = new Date(s);
|
|
291
|
-
const
|
|
323
|
+
const a = getComputedStyle(this).direction === "rtl";
|
|
292
324
|
switch (n) {
|
|
293
325
|
case "ArrowLeft":
|
|
294
|
-
l.setDate(s.getDate() + (
|
|
326
|
+
l.setDate(s.getDate() + (a ? 1 : -1));
|
|
295
327
|
break;
|
|
296
328
|
case "ArrowRight":
|
|
297
|
-
l.setDate(s.getDate() + (
|
|
329
|
+
l.setDate(s.getDate() + (a ? -1 : 1));
|
|
298
330
|
break;
|
|
299
331
|
case "ArrowUp":
|
|
300
332
|
l.setDate(s.getDate() - 7);
|
|
@@ -303,13 +335,13 @@ class y extends p {
|
|
|
303
335
|
l.setDate(s.getDate() + 7);
|
|
304
336
|
break;
|
|
305
337
|
case "Home": {
|
|
306
|
-
const
|
|
307
|
-
l.setDate(s.getDate() -
|
|
338
|
+
const i = (s.getDay() - this.firstDayOfWeek + 7) % 7;
|
|
339
|
+
l.setDate(s.getDate() - i);
|
|
308
340
|
break;
|
|
309
341
|
}
|
|
310
342
|
case "End": {
|
|
311
|
-
const
|
|
312
|
-
l.setDate(s.getDate() +
|
|
343
|
+
const i = (this.firstDayOfWeek + 6 - s.getDay() + 7) % 7;
|
|
344
|
+
l.setDate(s.getDate() + i);
|
|
313
345
|
break;
|
|
314
346
|
}
|
|
315
347
|
case "PageUp":
|
|
@@ -357,14 +389,14 @@ class y extends p {
|
|
|
357
389
|
rowheader in an unlabelled column. Visually empty, spoken. -->
|
|
358
390
|
<th scope="col" role="columnheader"><span class="visually-hidden">Week</span></th>
|
|
359
391
|
${n.map(
|
|
360
|
-
(
|
|
392
|
+
(o) => u`<th scope="col" role="columnheader" title="${o.long}">${o.short}</th>`
|
|
361
393
|
)}
|
|
362
394
|
</tr>
|
|
363
395
|
${t.map(
|
|
364
|
-
(
|
|
396
|
+
(o) => u`
|
|
365
397
|
<tr role="row">
|
|
366
|
-
<th scope="row" role="rowheader">${
|
|
367
|
-
${
|
|
398
|
+
<th scope="row" role="rowheader">${o.number}</th>
|
|
399
|
+
${o.days.map((s) => this.renderCell(s, r))}
|
|
368
400
|
</tr>
|
|
369
401
|
`
|
|
370
402
|
)}
|
|
@@ -372,15 +404,15 @@ class y extends p {
|
|
|
372
404
|
`;
|
|
373
405
|
}
|
|
374
406
|
renderCell(e, t) {
|
|
375
|
-
const n = !!e && e.isInMonth, r = !!e && this.isDisabled(e.date),
|
|
376
|
-
|
|
377
|
-
const
|
|
407
|
+
const n = !!e && e.isInMonth, r = !!e && this.isDisabled(e.date), o = !!e && e.isInMonth && this.isSameDate(this.selectedDate, e.date), s = !!e && e.isInMonth && this.isToday(e.date), l = !!e && e.isInMonth && this.isSameDate(t, e.date), a = [];
|
|
408
|
+
o && a.push("selected"), n && !r && a.push("cursor-pointer");
|
|
409
|
+
const i = a.length ? a.join(" ") : void 0, h = e && e.isInMonth ? this.cellId(e.date) : void 0;
|
|
378
410
|
return u`<td
|
|
379
411
|
role="gridcell"
|
|
380
412
|
id="${h ?? c}"
|
|
381
|
-
class="${
|
|
413
|
+
class="${i ?? c}"
|
|
382
414
|
tabindex="${n ? l ? 0 : -1 : c}"
|
|
383
|
-
aria-selected="${n ?
|
|
415
|
+
aria-selected="${n ? o ? "true" : "false" : c}"
|
|
384
416
|
aria-current="${s ? "date" : c}"
|
|
385
417
|
aria-disabled="${r ? "true" : c}"
|
|
386
418
|
@click="${() => this.goto(e)}"
|
package/chunks/{mp-datetime-picker.element-MPTRHwyc.mjs → mp-datetime-picker.element-D1CiLbHm.mjs}
RENAMED
|
@@ -3,7 +3,7 @@ import { query as n } from "lit/decorators.js";
|
|
|
3
3
|
import { L as w } from "./live-announcer-Bi0orG4n.mjs";
|
|
4
4
|
import { e as D } from "./error-text-B45eDAt1.mjs";
|
|
5
5
|
import { O as g } from "./overlay-controller-D6agzzOI.mjs";
|
|
6
|
-
import "./mp-calendar.element-
|
|
6
|
+
import "./mp-calendar.element-CJ8-t-Zn.mjs";
|
|
7
7
|
import { m as p } from "./mp-timepicker.element-COZEUIoE.mjs";
|
|
8
8
|
import { i as $ } from "./invalid-feedback.styles-he0JYrJm.mjs";
|
|
9
9
|
c`<!-- Rendered dynamically by render(). Codegen-wc emits styles from the
|
package/datepicker/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { query as a } from "lit/decorators.js";
|
|
|
3
3
|
import { O as h } from "../chunks/overlay-controller-D6agzzOI.mjs";
|
|
4
4
|
import "lit/directives/ref.js";
|
|
5
5
|
import { H as b } from "../chunks/host-aria-WSGs7SPQ.mjs";
|
|
6
|
-
import "../chunks/mp-calendar.element-
|
|
6
|
+
import "../chunks/mp-calendar.element-CJ8-t-Zn.mjs";
|
|
7
7
|
d`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
|
|
8
8
|
target emits a \`styles\` export from the sibling .scss. -->`;
|
|
9
9
|
const g = u(`:host {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|