@mintplayer/web-components 2.5.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.
Files changed (52) hide show
  1. package/a11y/index.mjs +9 -8
  2. package/calendar/index.mjs +1 -1
  3. package/calendar/src/mp-calendar.element.d.ts +19 -1
  4. package/checkbox/index.mjs +1 -1
  5. package/chunks/error-text-B45eDAt1.mjs +17 -0
  6. package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
  7. package/chunks/{id-D5QCG603.mjs → id-DNZVAnGC.mjs} +290 -160
  8. package/chunks/{mp-calendar.element-u6uS31_j.mjs → mp-calendar.element-CJ8-t-Zn.mjs} +71 -39
  9. package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
  10. package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
  11. package/chunks/mp-datetime-picker.element-D1CiLbHm.mjs +530 -0
  12. package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
  13. package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
  14. package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
  15. package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
  16. package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
  17. package/datatable/index.mjs +1 -1
  18. package/datepicker/index.mjs +2 -2
  19. package/datetime-picker/index.mjs +2 -431
  20. package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
  21. package/file-manager/index.mjs +1 -1
  22. package/navbar/index.mjs +1 -1
  23. package/otp-input/index.mjs +4 -3
  24. package/overlay/index.mjs +1 -1
  25. package/overlay/src/overlay-controller.d.ts +13 -0
  26. package/package.json +1 -1
  27. package/query-builder/index.mjs +2 -2
  28. package/radio/index.mjs +1 -1
  29. package/radio-group/index.mjs +2 -2
  30. package/ribbon/index.mjs +1 -1
  31. package/scheduler/index.mjs +2775 -1025
  32. package/scheduler/src/components/mp-scheduler.d.ts +454 -11
  33. package/scheduler/src/input/input-handler.d.ts +22 -0
  34. package/scheduler/src/state/scheduler-state.d.ts +10 -0
  35. package/scheduler/src/views/base-view.d.ts +30 -1
  36. package/scheduler/src/views/index.d.ts +1 -1
  37. package/scheduler/src/views/timeline-view.d.ts +87 -15
  38. package/scheduler/src/views/year-view.d.ts +11 -2
  39. package/scheduler-core/index.mjs +44 -41
  40. package/scheduler-core/src/models/event.d.ts +6 -2
  41. package/scheduler-core/src/models/messages.d.ts +89 -0
  42. package/scheduler-core/src/models/options.d.ts +46 -13
  43. package/scheduler-core/src/models/permissions.d.ts +35 -4
  44. package/scheduler-core/src/models/time-slot.d.ts +11 -6
  45. package/scheduler-core/src/services/date.service.d.ts +64 -10
  46. package/scheduler-core/src/utils/color.d.ts +19 -0
  47. package/select/index.mjs +1 -1
  48. package/timepicker/index.mjs +4 -3
  49. package/timepicker/src/mp-time-list.element.d.ts +44 -7
  50. package/timepicker/src/mp-timepicker.element.d.ts +5 -0
  51. package/toggle-button/index.mjs +1 -1
  52. package/tree-select/index.mjs +1 -1
@@ -19,12 +19,30 @@ export interface SchedulerPermissions {
19
19
  createEvent: boolean;
20
20
  /** Move an existing event in time (or across resources on the timeline). */
21
21
  moveEvent: boolean;
22
- /** Drag/keyboard the START edge. Supersedes the never-implemented `eventStartEditable`. */
23
- resizeEventStart: boolean;
24
- /** Drag/keyboard the END edge. Supersedes the never-implemented `eventDurationEditable`. */
25
- resizeEventEnd: boolean;
22
+ /**
23
+ * Drag/keyboard either edge — one flag, not two.
24
+ *
25
+ * Supersedes `resizeEventStart` / `resizeEventEnd`, which were a misreading
26
+ * of FullCalendar: its `eventStartEditable` means "start editable **through
27
+ * dragging**" (our `moveEvent`), and `eventDurationEditable` covers resize
28
+ * as ONE flag for both edges. Splitting it globally answered a question
29
+ * nobody asks — "no user may ever resize any start edge" — while making an
30
+ * asymmetric commit constructible (B35).
31
+ *
32
+ * Per-edge locking still exists where it belongs: on the ITEM, as
33
+ * `SchedulerEvent.resizable`'s `{ start, end }` form. That is data-dependent
34
+ * ("this shift already clocked in; its start is pinned, you may still extend
35
+ * it"), which is exactly what a per-item flag is for. See `resolveResizeEdge`.
36
+ */
37
+ resizeEvent: boolean;
26
38
  /** Delete/Backspace on a focused event. */
27
39
  deleteEvent: boolean;
40
+ /**
41
+ * Edit an event's non-geometric fields (title, colour) through the built-in
42
+ * event editor. The editor's start/end fields follow `moveEvent` and the
43
+ * resize capabilities instead — time is time, whichever surface changes it.
44
+ */
45
+ editEvent: boolean;
28
46
  /** Extend a multi-cell time range with Shift+Arrow or a slot drag. */
29
47
  selectRange: boolean;
30
48
  /** Add a resource row (timeline). Off by default — see the PRD. */
@@ -81,3 +99,16 @@ export declare function resolveCapability(capability: SchedulerCapability, opts:
81
99
  permissions?: boolean | Partial<SchedulerPermissions>;
82
100
  event?: SchedulerEvent | null;
83
101
  }): boolean;
102
+ /**
103
+ * May this event be resized *from this edge*?
104
+ *
105
+ * Only the three direct-manipulation surfaces ask — the resize handles, the
106
+ * pointer gesture, and Shift+Arrow vs Alt+Shift+Arrow — because there the edge
107
+ * is a property of the **gesture**, not of the permission. Everything else
108
+ * asks `resolveCapability('resizeEvent', …)`.
109
+ */
110
+ export declare function resolveResizeEdge(edge: 'start' | 'end', opts: {
111
+ readonly?: boolean;
112
+ permissions?: boolean | Partial<SchedulerPermissions>;
113
+ event?: SchedulerEvent | null;
114
+ }): boolean;
@@ -9,13 +9,18 @@ export interface TimeSlot {
9
9
  /**
10
10
  * Resource the slot belongs to, for views with a resource axis (timeline).
11
11
  *
12
- * Carried so a pointer create-drag can report WHICH row it happened in:
13
- * without it `event-create` always emitted `resourceId: undefined`, and the
14
- * created event landed nowhere the user was pointing. `undefined` on
15
- * week/day/month/year, which have no resource axis, and on the timeline's
16
- * unassigned bucket row.
12
+ * Carried so a pointer drag can report WHICH row it is happening in:
13
+ * without it `event-create` always emitted `resourceId: undefined`, and a
14
+ * move-drag could not change rows at all.
15
+ *
16
+ * TRI-STATE, deliberately: `undefined` means "this view has no resource
17
+ * axis" (week/day/month/year), `null` means "the timeline's unassigned
18
+ * bucket row". The two must stay distinguishable — collapsing them is what
19
+ * made a drop onto the bucket indistinguishable from a week-view drag, so
20
+ * an event could never be UN-assigned by pointer. Matches the idiom of
21
+ * `eventsByResource: Map<string | null, …>`.
17
22
  */
18
- resourceId?: string;
23
+ resourceId?: string | null;
19
24
  }
20
25
  /**
21
26
  * A row of time slots with associated metadata
@@ -61,18 +61,76 @@ export declare class DateService {
61
61
  * Uses the Intl API to determine if the locale uses 12-hour or 24-hour time
62
62
  */
63
63
  detectTimeFormat(locale?: string): TimeFormat;
64
+ /** Memoized `getWeekInfo().firstDay` per locale — see resolveFirstDayOfWeek. */
65
+ private readonly weekStarts;
66
+ /**
67
+ * Which day the week starts on: the caller's explicit choice, else the
68
+ * locale's own convention, else Monday.
69
+ *
70
+ * Two numbering systems meet here and they disagree about Sunday.
71
+ * `Date.prototype.getDay()` — which every calculation in this file speaks — is
72
+ * 0-6 with **Sunday = 0**. `Intl.Locale…getWeekInfo().firstDay` is 1-7 with
73
+ * **Sunday = 7**. The `% 7` is that conversion, and it is the only place the
74
+ * 1-7 domain is allowed to exist: `DayOfWeek` stays 0-6 because it is also the
75
+ * type of `BusinessHours.daysOfWeek`, which is `getDay()`-based and would
76
+ * silently accept a meaningless 7 if the type were widened.
77
+ *
78
+ * Resolved from the locale the CALLER passes, never from a stored default. A
79
+ * derivation reading `DEFAULT_OPTIONS.locale` would have read the old 'en-US'
80
+ * literal and handed every user on earth a Sunday start, Europe included.
81
+ *
82
+ * `getWeekInfo` is absent in Firefox, and is a getter on some engines and a
83
+ * method on others; both shapes and neither are handled.
84
+ */
85
+ resolveFirstDayOfWeek(explicit?: DayOfWeek, locale?: string): DayOfWeek;
86
+ /**
87
+ * Format a time of day.
88
+ *
89
+ * Was hand-rolled — `${hours}:${minutes}` with hardcoded 'AM'/'PM' literals —
90
+ * which no locale could reach: nl wants "a.m.", ja "午前", and several locales
91
+ * separate with something other than a colon.
92
+ *
93
+ * `format` is an explicit override. Leave it undefined and `hour12` is not
94
+ * passed at all, so `Intl` applies whatever the locale itself does — which is
95
+ * the behaviour the scheduler wants by default and the reason
96
+ * `detectTimeFormat` is not needed on this path.
97
+ */
98
+ formatTime(date: Date, format?: TimeFormat, locale?: string): string;
99
+ /**
100
+ * `Intl.DateTimeFormat` instances are expensive to construct and this runs once
101
+ * per slot per day — hundreds of times per render. Memoized on the only two
102
+ * inputs that vary.
103
+ */
104
+ private readonly timeFormatters;
105
+ private timeFormatter;
106
+ /**
107
+ * Format date for display.
108
+ *
109
+ * `locale` is optional and stays optional all the way down: `undefined` tells
110
+ * `Intl` to use the runtime's own locale. It used to default to `'en-US'`,
111
+ * which is not a neutral fallback but an instruction to render US English.
112
+ */
113
+ formatDate(date: Date, locale?: string, options?: Intl.DateTimeFormatOptions): string;
64
114
  /**
65
- * Format time according to format preference
115
+ * Format date with weekday — "Mon, Jul 27" in en-US, "ma 27 jul" in nl-BE,
116
+ * "7月27日(月)" in ja-JP. The field order is the locale's business, not ours.
66
117
  */
67
- formatTime(date: Date, format?: TimeFormat): string;
118
+ formatDateWithWeekday(date: Date, locale?: string): string;
68
119
  /**
69
- * Format date for display
120
+ * Format a date RANGE, letting the locale place the separator and elide the
121
+ * shared parts ("Jul 27 – Aug 2, 2026"). Falls back to a plain join where
122
+ * `formatRange` is unavailable.
70
123
  */
71
- formatDate(date: Date, locale?: string, options?: Intl.DateTimeFormatOptions): string;
124
+ formatDateRange(start: Date, end: Date, locale?: string, options?: Intl.DateTimeFormatOptions): string;
72
125
  /**
73
- * Format date with weekday
126
+ * Format a start–end time pair as one range.
127
+ *
128
+ * Beats joining two `formatTime` results with a literal separator: the locale
129
+ * chooses the dash AND elides what the ends share, so en-US reads
130
+ * "9:00 – 10:00 AM" rather than "9:00 AM - 10:00 AM". The event chips used a
131
+ * hyphen while the announcements used an en-dash; now neither hardcodes one.
74
132
  */
75
- formatDateWithWeekday(date: Date, locale?: string): string;
133
+ formatTimeRange(start: Date, end: Date, format?: TimeFormat, locale?: string): string;
76
134
  /**
77
135
  * Get month name
78
136
  */
@@ -121,10 +179,6 @@ export declare class DateService {
121
179
  * Add years to a date
122
180
  */
123
181
  addYears(date: Date, years: number): Date;
124
- /**
125
- * Get week number of the year
126
- */
127
- getWeekNumber(date: Date): number;
128
182
  /**
129
183
  * Get seconds from midnight for a date
130
184
  */
@@ -10,6 +10,25 @@ export declare function getColorByIndex(index: number): string;
10
10
  * Calculate contrasting text color (black or white) for a background
11
11
  */
12
12
  export declare function getContrastColor(backgroundColor: string): string;
13
+ /**
14
+ * Black or white — whichever actually scores the higher WCAG contrast ratio
15
+ * against `background`. `null` when the colour cannot be parsed.
16
+ *
17
+ * Distinct from {@link getContrastColor}, which computes YIQ *perceived
18
+ * brightness* against a 0.5 threshold. YIQ is a reasonable approximation for
19
+ * decorative text and is what every event label in the scheduler already uses,
20
+ * but it is not the WCAG formula and can pick the losing foreground on mid-tone
21
+ * backgrounds. Use this one wherever the result carries meaning a user must be
22
+ * able to read — an interactive control's glyph, say — and leave the existing
23
+ * callers alone: switching them would recolour every event label in all five
24
+ * views, which deserves its own visual review rather than a drive-by.
25
+ */
26
+ export declare function getReadableTextColor(background: string): string | null;
27
+ /**
28
+ * The WCAG contrast ratio between a hex colour and black or white, so callers
29
+ * (and tests) can assert a threshold rather than trust a branch.
30
+ */
31
+ export declare function contrastRatioWith(background: string, foreground: string): number | null;
13
32
  /**
14
33
  * Lighten a color by a percentage
15
34
  */
package/select/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { M as p } from "../chunks/mp-select-Ctu-v1-p.mjs";
1
+ import { M as p } from "../chunks/mp-select-CKX0eM5C.mjs";
2
2
  export {
3
3
  p as MpSelect
4
4
  };
@@ -1,5 +1,6 @@
1
- import { M as i, a as p } from "../chunks/mp-timepicker.element-Bz393NDQ.mjs";
1
+ import { M as a, a as i, m as s } from "../chunks/mp-timepicker.element-COZEUIoE.mjs";
2
2
  export {
3
- i as MpTimeListElement,
4
- p as MpTimepickerElement
3
+ a as MpTimeListElement,
4
+ i as MpTimepickerElement,
5
+ s as minutesOfDay
5
6
  };
@@ -1,6 +1,17 @@
1
1
  import { LitElement, TemplateResult } from 'lit';
2
2
  export type TimeStep = 1 | 5 | 10 | 15 | 30 | 60;
3
3
  export type Hour12Mode = boolean | 'auto';
4
+ /**
5
+ * A `Date`'s time-of-day as minutes from midnight, for feeding
6
+ * `mp-time-list`'s `minMinutes` / `maxMinutes`.
7
+ *
8
+ * Exported because every composite that owns a time list has to make this
9
+ * conversion, and each one has to decide FIRST whether its bound is a
10
+ * time-of-day (`mp-timepicker`: convert unconditionally) or a datetime
11
+ * (`mp-datetime-picker`: convert only on the bound's own day, `null`
12
+ * otherwise). Naming the step makes that decision visible at the call site.
13
+ */
14
+ export declare function minutesOfDay(d: Date | null | undefined): number | null;
4
15
  /**
5
16
  * mp-time-list — Bootstrap-styled time-slot listbox primitive.
6
17
  *
@@ -33,11 +44,13 @@ export declare class MpTimeListElement extends LitElement {
33
44
  type: NumberConstructor;
34
45
  reflect: boolean;
35
46
  };
36
- min: {
37
- attribute: boolean;
47
+ minMinutes: {
48
+ attribute: string;
49
+ type: NumberConstructor;
38
50
  };
39
- max: {
40
- attribute: boolean;
51
+ maxMinutes: {
52
+ attribute: string;
53
+ type: NumberConstructor;
41
54
  };
42
55
  hour12: {
43
56
  attribute: string;
@@ -53,13 +66,37 @@ export declare class MpTimeListElement extends LitElement {
53
66
  };
54
67
  selectedTime: Date | null;
55
68
  step: TimeStep;
56
- min: Date | null;
57
- max: Date | null;
69
+ /**
70
+ * Earliest / latest selectable slot, as **minutes from midnight** — this
71
+ * element is a pure time-of-day primitive and now says so in its types.
72
+ *
73
+ * They were `min`/`max: Date`, which read like datetime bounds but were
74
+ * compared time-of-day only. That ambiguity is not theoretical: a composite
75
+ * editing a range across two days would grey out the same clock range on
76
+ * *every* day, and `mp-timepicker`'s consumers legitimately pass
77
+ * `new Date(2020, 0, 1, 18, 0)` meaning simply "18:00", which any date-aware
78
+ * reading would disable outright. A `Date` can be mistaken for a datetime
79
+ * bound; `minMinutes: 480` cannot. Deriving the per-day value is the
80
+ * COMPOSITE's job — see `mp-datetime-picker`.
81
+ */
82
+ minMinutes: number | null;
83
+ maxMinutes: number | null;
58
84
  hour12: Hour12Mode;
59
85
  locale: string | undefined;
60
86
  private _focusedMinutes;
61
87
  private readonly instanceId;
62
- /** One tab stop for the whole list; arrows move focus AND the tab stop. */
88
+ /**
89
+ * One tab stop for the whole list; arrows move focus AND the tab stop.
90
+ *
91
+ * `isDisabled: () => false` keeps out-of-range slots IN the traversal —
92
+ * APG-correct (a disabled option should be discoverable, so the user learns
93
+ * the bound exists rather than watching keys do nothing) and consistent with
94
+ * `mp-calendar`, which one popup away was already doing it this way. It is
95
+ * also load-bearing: `moveTo` refuses a disabled target, so with the default
96
+ * predicate PageUp/PageDown became a swallowed keypress the moment bounds
97
+ * were passed — it `preventDefault()`s, then bails. Selection is still
98
+ * refused, in `selectMinutes`, which is where the rule belongs.
99
+ */
63
100
  private readonly roving;
64
101
  connectedCallback(): void;
65
102
  disconnectedCallback(): void;
@@ -78,6 +78,11 @@ export declare class MpTimepickerElement extends LitElement {
78
78
  };
79
79
  selectedTime: Date | null;
80
80
  step: TimeStep;
81
+ /**
82
+ * Earliest / latest selectable time. **Time-of-day only** — the date half is
83
+ * ignored, so `new Date(2020, 0, 1, 18, 0)` simply means "18:00", which is
84
+ * how this component's consumers have always used it.
85
+ */
81
86
  min: Date | null;
82
87
  max: Date | null;
83
88
  hour12: Hour12Mode;
@@ -1,4 +1,4 @@
1
- import { M as e, t as g } from "../chunks/mp-toggle-button-Kz6sIgBJ.mjs";
1
+ import { M as e, t as g } from "../chunks/mp-toggle-button-C4Loq_p4.mjs";
2
2
  export {
3
3
  e as MpToggleButton,
4
4
  g as toggleButtonStyles
@@ -1,6 +1,6 @@
1
1
  import { unsafeCSS as c, LitElement as u, html as a, nothing as o } from "lit";
2
2
  import { repeat as p } from "lit/directives/repeat.js";
3
- import { O as b } from "../chunks/overlay-controller-DPt13i8p.mjs";
3
+ import { O as b } from "../chunks/overlay-controller-D6agzzOI.mjs";
4
4
  import { L as m } from "../chunks/live-announcer-Bi0orG4n.mjs";
5
5
  import { d as _ } from "../chunks/focus-restore-DxuP1Oe2.mjs";
6
6
  import { H as f } from "../chunks/host-aria-WSGs7SPQ.mjs";