@mintplayer/web-components 1.0.0 → 1.2.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 (237) hide show
  1. package/a11y/index.mjs +2 -56
  2. package/calendar/index.mjs +2 -363
  3. package/checkbox/index.mjs +4 -0
  4. package/checkbox/src/components/index.d.ts +2 -0
  5. package/checkbox/src/components/mp-checkbox.d.ts +69 -0
  6. package/checkbox/src/index.d.ts +2 -0
  7. package/chunks/color-C4VT0EL7.mjs +847 -0
  8. package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
  9. package/chunks/live-announcer-CZDTKulf.mjs +58 -0
  10. package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
  11. package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
  12. package/chunks/mp-datatable-Con0yQue.mjs +1125 -0
  13. package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
  14. package/chunks/mp-select-BDS1-YGn.mjs +254 -0
  15. package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
  16. package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
  17. package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
  18. package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
  19. package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
  20. package/code-snippet/index.mjs +16 -13
  21. package/datatable/index.mjs +7 -0
  22. package/datatable/src/components/index.d.ts +2 -0
  23. package/datatable/src/components/mp-datatable.d.ts +260 -0
  24. package/datatable/src/index.d.ts +6 -0
  25. package/datatable/src/sort/compute-next-sort.d.ts +18 -0
  26. package/datatable/src/sort/index.d.ts +3 -0
  27. package/datatable/src/sort/sort-rows.d.ts +6 -0
  28. package/datatable/src/styles/datatable.styles.d.ts +2 -0
  29. package/datatable/src/styles/index.d.ts +1 -0
  30. package/datatable/src/types/column-def.d.ts +41 -0
  31. package/datatable/src/types/index.d.ts +2 -0
  32. package/datatable/src/types/tree.d.ts +42 -0
  33. package/datepicker/index.mjs +240 -0
  34. package/datepicker/src/index.d.ts +1 -0
  35. package/datepicker/src/mp-datepicker.element.d.ts +94 -0
  36. package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
  37. package/datetime-picker/index.mjs +427 -0
  38. package/datetime-picker/src/index.d.ts +1 -0
  39. package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
  40. package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
  41. package/dock/index.mjs +2402 -0
  42. package/dock/src/components/index.d.ts +1 -0
  43. package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
  44. package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
  45. package/dock/src/index.d.ts +2 -0
  46. package/dock/src/types/dock-layout.d.ts +65 -0
  47. package/dock/src/types/index.d.ts +1 -0
  48. package/file-manager/index.mjs +1263 -0
  49. package/file-manager/src/components/index.d.ts +2 -0
  50. package/file-manager/src/components/mp-file-manager.d.ts +320 -0
  51. package/file-manager/src/index.d.ts +5 -0
  52. package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
  53. package/file-manager/src/styles/index.d.ts +1 -0
  54. package/file-manager/src/types/file-system-node.d.ts +24 -0
  55. package/file-manager/src/types/index.d.ts +3 -0
  56. package/file-manager/src/types/messages.d.ts +43 -0
  57. package/multi-range/index.mjs +407 -0
  58. package/multi-range/src/index.d.ts +2 -0
  59. package/multi-range/src/mint-multi-range.element.d.ts +124 -0
  60. package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
  61. package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
  62. package/otp-input/index.mjs +362 -0
  63. package/otp-input/src/index.d.ts +4 -0
  64. package/otp-input/src/mint-otp-input.element.d.ts +134 -0
  65. package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
  66. package/otp-input/src/types/otp-input-case.d.ts +1 -0
  67. package/otp-input/src/types/otp-input-size.d.ts +1 -0
  68. package/otp-input/src/types/otp-input-type.d.ts +1 -0
  69. package/overlay/index.mjs +260 -0
  70. package/overlay/src/index.d.ts +2 -0
  71. package/overlay/src/overlay-controller.d.ts +205 -0
  72. package/package.json +1 -1
  73. package/pagination/index.mjs +5 -0
  74. package/pagination/src/components/index.d.ts +2 -0
  75. package/pagination/src/components/mp-pagination.d.ts +95 -0
  76. package/pagination/src/index.d.ts +2 -0
  77. package/pagination/src/styles/index.d.ts +1 -0
  78. package/pagination/src/styles/pagination.styles.d.ts +2 -0
  79. package/query-builder/index.mjs +3720 -0
  80. package/query-builder/src/context.d.ts +14 -0
  81. package/query-builder/src/dnd/drag-controller.d.ts +69 -0
  82. package/query-builder/src/index.d.ts +23 -0
  83. package/query-builder/src/model/default-tree.d.ts +7 -0
  84. package/query-builder/src/model/editor.d.ts +15 -0
  85. package/query-builder/src/model/errors.d.ts +6 -0
  86. package/query-builder/src/model/expression.d.ts +22 -0
  87. package/query-builder/src/model/field-def.d.ts +17 -0
  88. package/query-builder/src/model/messages.d.ts +17 -0
  89. package/query-builder/src/model/operator-overrides.d.ts +21 -0
  90. package/query-builder/src/model/operators.d.ts +8 -0
  91. package/query-builder/src/model/saved-query.d.ts +6 -0
  92. package/query-builder/src/model/sort.d.ts +9 -0
  93. package/query-builder/src/model/tree-ops.d.ts +56 -0
  94. package/query-builder/src/mp-query-builder.element.d.ts +158 -0
  95. package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
  96. package/query-builder/src/mp-query-condition.element.d.ts +44 -0
  97. package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
  98. package/query-builder/src/mp-query-group.element.d.ts +52 -0
  99. package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
  100. package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
  101. package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
  102. package/query-builder/src/preview/render-expression.d.ts +23 -0
  103. package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
  104. package/query-builder/src/visitor/visit-tree.d.ts +29 -0
  105. package/query-builder/src/visitor/visitor-types.d.ts +15 -0
  106. package/radio/index.mjs +162 -0
  107. package/radio/src/components/index.d.ts +2 -0
  108. package/radio/src/components/mp-radio.d.ts +63 -0
  109. package/radio/src/index.d.ts +2 -0
  110. package/ribbon/index.mjs +3151 -0
  111. package/ribbon/src/index.d.ts +10 -0
  112. package/ribbon/src/items/index.d.ts +15 -0
  113. package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
  114. package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
  115. package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
  116. package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
  117. package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
  118. package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
  119. package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
  120. package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
  121. package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
  122. package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
  123. package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
  124. package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
  125. package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
  126. package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
  127. package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
  128. package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
  129. package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
  130. package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
  131. package/ribbon/src/mp-ribbon.element.d.ts +211 -0
  132. package/ribbon/src/types/ribbon.types.d.ts +4 -0
  133. package/scheduler/index.mjs +3567 -0
  134. package/scheduler/src/components/mp-scheduler.d.ts +238 -0
  135. package/scheduler/src/drag/drag-manager.d.ts +90 -0
  136. package/scheduler/src/drag/drag-preview.d.ts +42 -0
  137. package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
  138. package/scheduler/src/drag/drag-types.d.ts +104 -0
  139. package/scheduler/src/drag/index.d.ts +4 -0
  140. package/scheduler/src/events/event-types.d.ts +58 -0
  141. package/scheduler/src/events/index.d.ts +2 -0
  142. package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
  143. package/scheduler/src/index.d.ts +6 -0
  144. package/scheduler/src/input/index.d.ts +2 -0
  145. package/scheduler/src/input/input-handler.d.ts +105 -0
  146. package/scheduler/src/input/pointer-event.d.ts +39 -0
  147. package/scheduler/src/state/scheduler-state.d.ts +189 -0
  148. package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
  149. package/scheduler/src/views/base-view.d.ts +87 -0
  150. package/scheduler/src/views/day-view.d.ts +25 -0
  151. package/scheduler/src/views/index.d.ts +6 -0
  152. package/scheduler/src/views/month-view.d.ts +27 -0
  153. package/scheduler/src/views/timeline-view.d.ts +23 -0
  154. package/scheduler/src/views/week-view.d.ts +28 -0
  155. package/scheduler/src/views/year-view.d.ts +25 -0
  156. package/scheduler-core/index.mjs +174 -0
  157. package/scheduler-core/src/index.d.ts +3 -0
  158. package/scheduler-core/src/models/drag-state.d.ts +43 -0
  159. package/scheduler-core/src/models/event.d.ts +111 -0
  160. package/scheduler-core/src/models/events.d.ts +108 -0
  161. package/scheduler-core/src/models/index.d.ts +7 -0
  162. package/scheduler-core/src/models/options.d.ts +88 -0
  163. package/scheduler-core/src/models/resource.d.ts +58 -0
  164. package/scheduler-core/src/models/time-slot.d.ts +31 -0
  165. package/scheduler-core/src/models/types.d.ts +20 -0
  166. package/scheduler-core/src/services/date.service.d.ts +140 -0
  167. package/scheduler-core/src/services/index.d.ts +4 -0
  168. package/scheduler-core/src/services/position.service.d.ts +35 -0
  169. package/scheduler-core/src/services/resource.service.d.ts +83 -0
  170. package/scheduler-core/src/services/timeline.service.d.ts +103 -0
  171. package/scheduler-core/src/utils/color.d.ts +24 -0
  172. package/scheduler-core/src/utils/dom.d.ts +54 -0
  173. package/scheduler-core/src/utils/id.d.ts +16 -0
  174. package/scheduler-core/src/utils/index.d.ts +3 -0
  175. package/select/index.mjs +4 -0
  176. package/select/src/components/index.d.ts +2 -0
  177. package/select/src/components/mp-select.d.ts +82 -0
  178. package/select/src/index.d.ts +2 -0
  179. package/splitter/index.mjs +10 -0
  180. package/splitter/src/components/index.d.ts +2 -0
  181. package/splitter/src/components/mp-splitter.d.ts +109 -0
  182. package/splitter/src/index.d.ts +11 -0
  183. package/splitter/src/input/index.d.ts +4 -0
  184. package/splitter/src/input/input-handler.d.ts +36 -0
  185. package/splitter/src/input/pointer-event.d.ts +9 -0
  186. package/splitter/src/managers/index.d.ts +2 -0
  187. package/splitter/src/managers/resize-manager.d.ts +13 -0
  188. package/splitter/src/state/index.d.ts +2 -0
  189. package/splitter/src/state/splitter-state.d.ts +24 -0
  190. package/splitter/src/styles/index.d.ts +1 -0
  191. package/splitter/src/styles/splitter.styles.d.ts +2 -0
  192. package/splitter/src/types/direction.d.ts +1 -0
  193. package/splitter/src/types/index.d.ts +5 -0
  194. package/splitter/src/types/panel-info.d.ts +6 -0
  195. package/splitter/src/types/point.d.ts +4 -0
  196. package/splitter/src/types/resize-operation.d.ts +13 -0
  197. package/tab-control/index.mjs +6 -0
  198. package/tab-control/src/components/index.d.ts +3 -0
  199. package/tab-control/src/components/mp-tab-control.d.ts +50 -0
  200. package/tab-control/src/components/mp-tab-page.d.ts +35 -0
  201. package/tab-control/src/index.d.ts +4 -0
  202. package/tab-control/src/styles/index.d.ts +1 -0
  203. package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
  204. package/tab-control/src/types/index.d.ts +1 -0
  205. package/tab-control/src/types/tabs-position.d.ts +1 -0
  206. package/tile-manager/index.mjs +867 -0
  207. package/tile-manager/src/components/index.d.ts +2 -0
  208. package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
  209. package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
  210. package/tile-manager/src/index.d.ts +4 -0
  211. package/tile-manager/src/types/grid-rect.d.ts +12 -0
  212. package/tile-manager/src/types/index.d.ts +3 -0
  213. package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
  214. package/tile-manager/src/types/tile-position.d.ts +10 -0
  215. package/tile-manager/src/utils/index.d.ts +1 -0
  216. package/tile-manager/src/utils/pack.d.ts +24 -0
  217. package/timepicker/index.mjs +5 -0
  218. package/timepicker/src/index.d.ts +2 -0
  219. package/timepicker/src/mp-time-list.element.d.ts +76 -0
  220. package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
  221. package/timepicker/src/mp-timepicker.element.d.ts +87 -0
  222. package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
  223. package/toggle-button/index.mjs +5 -0
  224. package/toggle-button/src/components/index.d.ts +2 -0
  225. package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
  226. package/toggle-button/src/index.d.ts +3 -0
  227. package/toggle-button/src/styles/index.d.ts +1 -0
  228. package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
  229. package/treeview/index.mjs +5 -0
  230. package/treeview/src/components/index.d.ts +2 -0
  231. package/treeview/src/components/mp-treeview.d.ts +113 -0
  232. package/treeview/src/index.d.ts +4 -0
  233. package/treeview/src/styles/index.d.ts +1 -0
  234. package/treeview/src/styles/treeview.styles.d.ts +2 -0
  235. package/treeview/src/types/index.d.ts +1 -0
  236. package/treeview/src/types/tree-node.d.ts +14 -0
  237. package/custom-elements.json +0 -1774
@@ -0,0 +1,238 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import { ViewType, SchedulerEvent, Resource, ResourceGroup, SchedulerOptions } from '@mintplayer/web-components/scheduler-core';
3
+ /**
4
+ * MpScheduler Web Component
5
+ *
6
+ * A fully-featured scheduler/calendar component.
7
+ * Refactored for clarity with separated concerns:
8
+ * - DragManager: Handles all drag operations
9
+ * - InputHandler: Normalizes mouse/touch input
10
+ * - SchedulerEventEmitter: Dispatches custom events
11
+ */
12
+ export declare class MpScheduler extends LitElement {
13
+ static styles: import('lit').CSSResult[];
14
+ static get observedAttributes(): string[];
15
+ private stateManager;
16
+ private currentView;
17
+ private currentViewType;
18
+ private contentContainer;
19
+ private dragManager;
20
+ private inputHandler;
21
+ private eventEmitter;
22
+ private previousView;
23
+ private previousDate;
24
+ private previousSelectedEventId;
25
+ private previousRangeKey;
26
+ private pendingDragUpdate;
27
+ private latestDragState;
28
+ private boundHandleKeyDown;
29
+ private boundHandleFocusIn;
30
+ private nowIndicatorTimer;
31
+ private readonly liveAnnouncer;
32
+ constructor();
33
+ connectedCallback(): void;
34
+ disconnectedCallback(): void;
35
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
36
+ get view(): ViewType;
37
+ set view(value: ViewType);
38
+ get date(): Date;
39
+ set date(value: Date);
40
+ get events(): SchedulerEvent[];
41
+ set events(value: SchedulerEvent[]);
42
+ get resources(): (Resource | ResourceGroup)[];
43
+ set resources(value: (Resource | ResourceGroup)[]);
44
+ get options(): SchedulerOptions;
45
+ set options(value: Partial<SchedulerOptions>);
46
+ get selectedEvent(): SchedulerEvent | null;
47
+ set selectedEvent(value: SchedulerEvent | null);
48
+ get selectedRange(): {
49
+ start: Date;
50
+ end: Date;
51
+ } | null;
52
+ next(): void;
53
+ prev(): void;
54
+ today(): void;
55
+ gotoDate(date: Date): void;
56
+ changeView(view: ViewType): void;
57
+ /**
58
+ * Clear the time-range selection and the focused-cell selection. Public
59
+ * because — per PRD scheduler-controlled-selection — the WC no longer
60
+ * auto-clears on commit; consumers call this from their `event-create`
61
+ * handler if they want the post-create selection cleared.
62
+ */
63
+ clearSelection(): void;
64
+ addEvent(event: SchedulerEvent): void;
65
+ updateEvent(event: SchedulerEvent): void;
66
+ removeEvent(eventId: string): void;
67
+ getEventById(eventId: string): SchedulerEvent | null;
68
+ refetchEvents(): void;
69
+ render(): TemplateResult;
70
+ protected firstUpdated(): void;
71
+ private populateHeader;
72
+ private updateTitle;
73
+ private renderView;
74
+ private onStateChange;
75
+ private detectAndEmitChanges;
76
+ private updateUI;
77
+ private scheduleDragUpdate;
78
+ private handlePointerDown;
79
+ private handlePointerMove;
80
+ private handlePointerUp;
81
+ private handleDragComplete;
82
+ private handleClick;
83
+ private handleDoubleClick;
84
+ /**
85
+ * When focus lands on an event block (Tab, programmatic, or click), select
86
+ * the event and emit `event-selected` for mouse-parity (PRD §6.5 D3). The
87
+ * subsequent setSelectedEvent call routes through detectAndEmitChanges
88
+ * which fires `selection-change`.
89
+ *
90
+ * `focusin` bubbles across shadow boundaries but `e.target` is retargeted
91
+ * to the host. Use composedPath()[0] for the actual focused element.
92
+ */
93
+ private handleFocusIn;
94
+ private handleKeyDown;
95
+ private getFocusedKind;
96
+ private handleAltShortcut;
97
+ private handleEventKeyDown;
98
+ /**
99
+ * Inter-event arrow nav (PRD scheduler-controlled-selection §5.3): walk
100
+ * the events in document order (start time, with id as tiebreaker) by ±1.
101
+ * No wrap at the ends — matches the APG list/feed pattern.
102
+ */
103
+ private focusAdjacentEvent;
104
+ private handleCellKeyDown;
105
+ /**
106
+ * If a cell is the active element but state.focusedCell is empty (e.g.
107
+ * Tab landed on the fallback first cell), seed the state from the
108
+ * active element's data attributes.
109
+ */
110
+ private initFocusedCellFromActive;
111
+ /**
112
+ * Month-view keyboard handler (PRD scheduler-controlled-selection §5.1).
113
+ * Arrows walk days; ArrowUp/Down ± one week; cross-month moves auto-
114
+ * advance the displayed date so the new month renders. Enter emits
115
+ * `event-create` for the focused day's full range.
116
+ */
117
+ private handleMonthCellKeyDown;
118
+ /**
119
+ * Year-view keyboard handler (PRD scheduler-controlled-selection §5.2).
120
+ * The focus unit is a month — ArrowLeft/Right ± 1, ArrowUp/Down ± 3 to
121
+ * mirror the visual 4×3 layout. Cross-year auto-advances. Enter emits
122
+ * `event-create` for the focused month's full range.
123
+ */
124
+ private handleYearCellKeyDown;
125
+ /**
126
+ * Sync `focusedDate` from the currently-active month/year cell. Runs at
127
+ * the top of every Phase B keydown so click-driven and Tab-driven focus
128
+ * moves are reflected in state before arrow keys read it.
129
+ */
130
+ private syncFocusedDateFromActive;
131
+ private moveFocusedDateByDays;
132
+ private moveFocusedDateByMonths;
133
+ /**
134
+ * Apply a focused-date update. If the new date crosses the displayed
135
+ * period (different month on month view; different year on year view),
136
+ * also bump `state.date` so the view re-renders to the new period —
137
+ * APG date-picker auto-advance behaviour. Then schedule a focus
138
+ * restoration on the matching cell after the next render.
139
+ */
140
+ private commitFocusedDate;
141
+ /**
142
+ * Find the month/year date-cell DOM element by id and focus it. Keys are
143
+ * built from *local* date components to match `MonthView.dayKey()` /
144
+ * `YearView.monthKey()` — see those helpers for why ISO is unsafe across
145
+ * non-UTC timezones.
146
+ */
147
+ private scrollAndFocusDateCell;
148
+ /**
149
+ * Emit `event-create` covering the focused day (month view) or focused
150
+ * month (year view). No internal mutation per PRD
151
+ * scheduler-controlled-selection — consumer constructs the actual event.
152
+ */
153
+ private commitFocusedDateAsCreate;
154
+ private moveCellByTime;
155
+ /** Week view ArrowLeft/Right: ±1 day, same time-of-day. No-op on day view. */
156
+ private moveCellByDay;
157
+ /** Timeline ArrowUp/Down: ±1 resource, same time-of-day. PRD D1: cross-resource
158
+ * Shift+Arrow is intentionally ignored (resource is categorical). */
159
+ private moveCellByResource;
160
+ private moveCellToColumnExtreme;
161
+ private moveCellToViewExtreme;
162
+ /**
163
+ * PageUp/PageDown — advance one period (week or day) and re-focus the same
164
+ * day-of-week + time-of-day in the new period. Selection is cleared since
165
+ * crossing a period boundary breaks the linear-range invariant.
166
+ */
167
+ private moveCellByPeriod;
168
+ /**
169
+ * Apply the focus move to state and DOM. `extend` grows the selection
170
+ * range; otherwise selection is cleared. Live-region announces the new
171
+ * focused cell or selection range.
172
+ */
173
+ private commitFocusMove;
174
+ private cellIsWithinView;
175
+ private parseTimeOnDay;
176
+ private adjacentResource;
177
+ private getResourceTitle;
178
+ /**
179
+ * Find the cell DOM element for a (slot, resource) pair and call .focus()
180
+ * on it. scrollIntoView with block:nearest provides parity with mouse
181
+ * drag-near-edge auto-pan (PRD D6).
182
+ */
183
+ private scrollAndFocusCell;
184
+ /** Re-focus whatever cell the keyboard model currently considers focused. */
185
+ private focusFocusedCell;
186
+ private cssEscape;
187
+ /**
188
+ * Emit `event-create` covering the active selection range, or a single
189
+ * cell when no selection is active. Per PRD scheduler-controlled-selection,
190
+ * this is a *request* — no internal state mutation, no auto-clear, no
191
+ * auto-focus. The consumer constructs the SchedulerEvent and decides
192
+ * whether/when to clear the selection.
193
+ */
194
+ private createEventFromCellOrSelection;
195
+ /**
196
+ * Active keyboard-driven event move. Captures the original time range and
197
+ * (timeline) resource so Escape can revert; the working copy is mutated in
198
+ * place by arrow keys and committed or rolled back on Enter / Escape.
199
+ */
200
+ private keyboardMove;
201
+ /**
202
+ * Enter keyboard event-move mode. Captures the working copy and a snapshot
203
+ * of the resource (timeline). Visual feedback is provided by routing the
204
+ * working start/end through the existing previewEvent state — the same
205
+ * channel used for mouse drag — so the event renders at the projected
206
+ * destination as the user nudges.
207
+ */
208
+ private enterEventMoveMode;
209
+ /**
210
+ * Move-mode keymap. Layered on the existing M-mode foundation:
211
+ * - bare Arrow keys nudge the event
212
+ * - Shift+Arrow resizes the end edge
213
+ * - Alt+Shift+Arrow resizes the start edge
214
+ * - on week view, Shift+ArrowLeft/Right pushes the end edge across the
215
+ * day boundary (PRD D5) — symmetric with Shift+ArrowDown for time.
216
+ * - Enter commits, Escape reverts.
217
+ */
218
+ private handleKeyboardMove;
219
+ private minutesPerSlot;
220
+ /** Shift the working event by `deltaMs` along the time axis (preserves duration). */
221
+ private nudgeKeyboardMove;
222
+ /** Walk to the next/previous resource (timeline only). Updates the preview's resourceId. */
223
+ private nudgeKeyboardMoveResource;
224
+ /**
225
+ * Resize one edge of the working event. Clamps to a minimum duration of
226
+ * one slot to keep the event valid, and refuses to invert (start ≤ end).
227
+ */
228
+ private resizeKeyboardMoveEdge;
229
+ /** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
230
+ * then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
231
+ private applyKeyboardMovePreview;
232
+ private commitEventMoveMode;
233
+ private cancelEventMoveMode;
234
+ private startNowIndicatorTimer;
235
+ private stopNowIndicatorTimer;
236
+ private getSlotAtPosition;
237
+ private getSlotFromElement;
238
+ }
@@ -0,0 +1,90 @@
1
+ import { SchedulerEvent, TimeSlot } from '@mintplayer/web-components/scheduler-core';
2
+ import { SchedulerStateManager } from '../state/scheduler-state';
3
+ import { DragConfig, DragCompletionResult, PointerTarget } from './drag-types';
4
+ import { NormalizedPointerEvent } from '../input/pointer-event';
5
+ /**
6
+ * Callback for when a drag operation completes.
7
+ */
8
+ export interface DragCompleteCallback {
9
+ (result: DragCompletionResult, originalEvent: Event): void;
10
+ }
11
+ /**
12
+ * Coordinates drag operations between the state machine and scheduler state.
13
+ * Handles RAF scheduling for smooth drag updates.
14
+ */
15
+ export declare class DragManager {
16
+ private readonly stateMachine;
17
+ private readonly stateManager;
18
+ private readonly config;
19
+ private pendingUpdate;
20
+ private latestPointer;
21
+ private getSlotAtPosition;
22
+ constructor(stateManager: SchedulerStateManager, config?: Partial<DragConfig>);
23
+ /**
24
+ * Set the function used to get a slot at a position.
25
+ * This must be set before handling pointer events.
26
+ */
27
+ setSlotResolver(resolver: (x: number, y: number) => TimeSlot | null): void;
28
+ /**
29
+ * Handle pointer down - may start pending drag.
30
+ * @param immediate If true, skip pending state (for touch-initiated drags)
31
+ */
32
+ handlePointerDown(pointer: NormalizedPointerEvent, target: PointerTarget, immediate?: boolean): void;
33
+ /**
34
+ * Handle pointer move - may activate drag or update preview.
35
+ */
36
+ handlePointerMove(pointer: NormalizedPointerEvent): void;
37
+ /**
38
+ * Handle pointer up - finalize or cancel drag.
39
+ * Returns the completion result if a drag was completed.
40
+ */
41
+ handlePointerUp(pointer: NormalizedPointerEvent): DragCompletionResult | null;
42
+ /**
43
+ * Cancel any in-progress drag operation.
44
+ */
45
+ cancel(): void;
46
+ /**
47
+ * Check if a drag operation is in progress.
48
+ */
49
+ isActive(): boolean;
50
+ /**
51
+ * Check if waiting for drag threshold.
52
+ */
53
+ isPending(): boolean;
54
+ /**
55
+ * Check if in any drag-related state.
56
+ */
57
+ isDragging(): boolean;
58
+ /**
59
+ * Get the current drag phase.
60
+ */
61
+ getPhase(): string;
62
+ /**
63
+ * Reset the drag manager state.
64
+ */
65
+ reset(): void;
66
+ /**
67
+ * Clean up resources.
68
+ */
69
+ destroy(): void;
70
+ /**
71
+ * Create a new event from a completed create drag.
72
+ */
73
+ createEventFromResult(result: DragCompletionResult): SchedulerEvent;
74
+ /**
75
+ * Update an event from a completed move/resize drag.
76
+ */
77
+ updateEventFromResult(result: DragCompletionResult, event: SchedulerEvent): SchedulerEvent;
78
+ /**
79
+ * Process pending pointer move using RAF.
80
+ */
81
+ private processPendingMove;
82
+ /**
83
+ * Sync state machine state to scheduler state manager.
84
+ */
85
+ private syncToStateManager;
86
+ /**
87
+ * Cancel any pending RAF update.
88
+ */
89
+ private cancelPendingUpdate;
90
+ }
@@ -0,0 +1,42 @@
1
+ import { DragOperationType, PreviewEvent, SchedulerEvent, TimeSlot } from '@mintplayer/web-components/scheduler-core';
2
+ import { DragConfig } from './drag-types';
3
+ /**
4
+ * Calculates preview positions for drag operations.
5
+ * Handles create, move, and resize operations.
6
+ */
7
+ export declare class DragPreviewCalculator {
8
+ private readonly config;
9
+ constructor(config?: Partial<DragConfig>);
10
+ /**
11
+ * Calculate the preview event position based on drag state.
12
+ *
13
+ * @param type - The type of drag operation
14
+ * @param startSlot - The slot where the drag started
15
+ * @param currentSlot - The current slot under the pointer
16
+ * @param originalEvent - The original event being moved/resized (null for create)
17
+ * @returns The preview event with new start/end, or null if invalid
18
+ */
19
+ calculatePreview(type: DragOperationType, startSlot: TimeSlot, currentSlot: TimeSlot, originalEvent: SchedulerEvent | null): PreviewEvent | null;
20
+ /**
21
+ * Calculate preview for creating a new event.
22
+ * Extends selection from start slot to current slot.
23
+ */
24
+ private calculateCreatePreview;
25
+ /**
26
+ * Calculate preview for moving an existing event.
27
+ * Preserves event duration, applies offset from drag start.
28
+ */
29
+ private calculateMovePreview;
30
+ /**
31
+ * Calculate preview for resizing event start.
32
+ * Moves start time while keeping end fixed.
33
+ * Enforces minimum duration.
34
+ */
35
+ private calculateResizeStartPreview;
36
+ /**
37
+ * Calculate preview for resizing event end.
38
+ * Moves end time while keeping start fixed.
39
+ * Enforces minimum duration.
40
+ */
41
+ private calculateResizeEndPreview;
42
+ }
@@ -0,0 +1,102 @@
1
+ import { PreviewEvent } from '@mintplayer/web-components/scheduler-core';
2
+ import { DragMachineState, DragMachineEvent, DragConfig, DragCompletionResult } from './drag-types';
3
+ /**
4
+ * Explicit state machine for drag operations.
5
+ *
6
+ * States:
7
+ * - idle: No drag operation in progress
8
+ * - pending: Pointer is down, waiting for movement to exceed threshold
9
+ * - active: Drag is in progress, preview is being updated
10
+ * - completing: Drag just finished, result is available
11
+ *
12
+ * Transitions:
13
+ * - idle + POINTER_DOWN (on valid target) → pending
14
+ * - pending + POINTER_MOVE (threshold exceeded) → active
15
+ * - pending + POINTER_UP → idle (treated as click)
16
+ * - pending + CANCEL → idle
17
+ * - active + POINTER_MOVE → active (update preview)
18
+ * - active + POINTER_UP → completing
19
+ * - active + CANCEL → idle
20
+ * - completing → idle (after result is consumed)
21
+ */
22
+ export declare class DragStateMachine {
23
+ private state;
24
+ private readonly config;
25
+ private readonly previewCalculator;
26
+ constructor(config?: Partial<DragConfig>);
27
+ /**
28
+ * Get current state (read-only).
29
+ */
30
+ getState(): Readonly<DragMachineState>;
31
+ /**
32
+ * Get the current phase.
33
+ */
34
+ getPhase(): DragMachineState['phase'];
35
+ /**
36
+ * Check if drag is currently active.
37
+ */
38
+ isActive(): boolean;
39
+ /**
40
+ * Check if drag is pending (waiting for threshold).
41
+ */
42
+ isPending(): boolean;
43
+ /**
44
+ * Check if in any drag-related state (pending or active).
45
+ */
46
+ isDragging(): boolean;
47
+ /**
48
+ * Get the preview event if in active state.
49
+ */
50
+ getPreview(): PreviewEvent | null;
51
+ /**
52
+ * Get the completion result if in completing state.
53
+ */
54
+ getCompletionResult(): DragCompletionResult | null;
55
+ /**
56
+ * Process an event and transition to new state.
57
+ * Returns true if state changed.
58
+ */
59
+ send(event: DragMachineEvent): boolean;
60
+ /**
61
+ * Reset to idle state.
62
+ */
63
+ reset(): void;
64
+ /**
65
+ * Consume the completion result and return to idle.
66
+ * Call this after handling a completed drag.
67
+ */
68
+ consumeResult(): DragCompletionResult | null;
69
+ /**
70
+ * Pure transition function.
71
+ * Given current state and event, returns new state.
72
+ */
73
+ private transition;
74
+ /**
75
+ * Transitions from idle state.
76
+ */
77
+ private transitionFromIdle;
78
+ /**
79
+ * Transitions from pending state.
80
+ */
81
+ private transitionFromPending;
82
+ /**
83
+ * Transitions from active state.
84
+ */
85
+ private transitionFromActive;
86
+ /**
87
+ * Transitions from completing state.
88
+ */
89
+ private transitionFromCompleting;
90
+ /**
91
+ * Activate drag from pending state.
92
+ */
93
+ private activateDrag;
94
+ /**
95
+ * Get operation type from pointer target.
96
+ */
97
+ private getOperationType;
98
+ /**
99
+ * Get initial preview for a pending drag (used for click detection).
100
+ */
101
+ private getInitialPreview;
102
+ }
@@ -0,0 +1,104 @@
1
+ import { DragOperationType, PreviewEvent, SchedulerEvent, TimeSlot } from '@mintplayer/web-components/scheduler-core';
2
+ /**
3
+ * Simple position with x/y coordinates.
4
+ */
5
+ export interface Position {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ /**
10
+ * Result of analyzing what element the pointer is over.
11
+ */
12
+ export interface PointerTarget {
13
+ /** Type of target element */
14
+ type: 'event' | 'resize-handle' | 'slot' | 'none';
15
+ /** The scheduler event if pointer is over an event */
16
+ event?: SchedulerEvent;
17
+ /** The slot element if pointer is over a slot */
18
+ slotElement?: HTMLElement;
19
+ /** The resize handle type if pointer is over a resize handle */
20
+ resizeHandle?: 'start' | 'end';
21
+ }
22
+ /**
23
+ * Drag operation phases - explicit state machine states.
24
+ *
25
+ * - idle: No drag operation in progress
26
+ * - pending: Pointer down, waiting for movement to exceed threshold
27
+ * - active: Drag in progress, preview is being updated
28
+ * - completing: Pointer up, finalizing the operation
29
+ */
30
+ export type DragPhase = 'idle' | 'pending' | 'active' | 'completing';
31
+ /**
32
+ * State machine state with discriminated union.
33
+ * The `phase` field determines which other fields are valid.
34
+ */
35
+ export type DragMachineState = {
36
+ phase: 'idle';
37
+ } | {
38
+ phase: 'pending';
39
+ operationType: DragOperationType;
40
+ event: SchedulerEvent | null;
41
+ startPosition: Position;
42
+ startSlot: TimeSlot | null;
43
+ slotElement?: HTMLElement;
44
+ } | {
45
+ phase: 'active';
46
+ operationType: DragOperationType;
47
+ event: SchedulerEvent | null;
48
+ startSlot: TimeSlot;
49
+ currentSlot: TimeSlot;
50
+ preview: PreviewEvent;
51
+ originalEvent?: SchedulerEvent;
52
+ } | {
53
+ phase: 'completing';
54
+ result: DragCompletionResult;
55
+ };
56
+ /**
57
+ * Result of a completed drag operation.
58
+ */
59
+ export interface DragCompletionResult {
60
+ /** Type of operation that was completed */
61
+ type: DragOperationType;
62
+ /** The final preview (new event position) */
63
+ preview: PreviewEvent;
64
+ /** The event that was moved/resized (null for create) */
65
+ event: SchedulerEvent | null;
66
+ /** Original event before modification */
67
+ originalEvent?: SchedulerEvent;
68
+ /** Whether this was a click (no actual drag occurred) */
69
+ wasClick: boolean;
70
+ }
71
+ /**
72
+ * Events that can trigger state transitions in the drag state machine.
73
+ */
74
+ export type DragMachineEvent = {
75
+ type: 'POINTER_DOWN';
76
+ target: PointerTarget;
77
+ position: Position;
78
+ slot: TimeSlot | null;
79
+ slotElement?: HTMLElement;
80
+ /** If true, skip pending state and go directly to active (for touch drags) */
81
+ immediate?: boolean;
82
+ } | {
83
+ type: 'POINTER_MOVE';
84
+ position: Position;
85
+ slot: TimeSlot | null;
86
+ } | {
87
+ type: 'POINTER_UP';
88
+ position: Position;
89
+ } | {
90
+ type: 'CANCEL';
91
+ };
92
+ /**
93
+ * Configuration for the drag state machine.
94
+ */
95
+ export interface DragConfig {
96
+ /** Pixels of movement before drag activates (default: 5) */
97
+ dragThreshold: number;
98
+ /** Minimum event duration in milliseconds (default: 30 minutes) */
99
+ minDurationMs: number;
100
+ }
101
+ /**
102
+ * Default drag configuration.
103
+ */
104
+ export declare const DEFAULT_DRAG_CONFIG: DragConfig;
@@ -0,0 +1,4 @@
1
+ export * from './drag-types';
2
+ export * from './drag-preview';
3
+ export * from './drag-state-machine';
4
+ export * from './drag-manager';
@@ -0,0 +1,58 @@
1
+ import { SchedulerEvent, ViewType } from '@mintplayer/web-components/scheduler-core';
2
+ /**
3
+ * Time range carried by selection-change and event-create. `start` is the
4
+ * inclusive lower edge, `end` is the exclusive upper edge of the last
5
+ * selected slot — matching the natural slot-pair shape produced by
6
+ * `selectionRange()` in `views/base-view.ts`.
7
+ */
8
+ export interface TimeRange {
9
+ start: Date;
10
+ end: Date;
11
+ }
12
+ /**
13
+ * All custom events the scheduler can emit.
14
+ * Using a discriminated union for type safety.
15
+ */
16
+ export type SchedulerCustomEvent = {
17
+ type: 'event-selected';
18
+ event: SchedulerEvent;
19
+ originalEvent: Event;
20
+ } | {
21
+ type: 'event-dblclick';
22
+ event: SchedulerEvent;
23
+ originalEvent: Event;
24
+ } | {
25
+ type: 'event-create';
26
+ range: TimeRange;
27
+ view: ViewType;
28
+ resourceId?: string;
29
+ originalEvent: Event;
30
+ } | {
31
+ type: 'event-update';
32
+ event: SchedulerEvent;
33
+ oldEvent: SchedulerEvent;
34
+ originalEvent: Event;
35
+ } | {
36
+ type: 'event-delete';
37
+ event: SchedulerEvent;
38
+ } | {
39
+ type: 'date-click';
40
+ date: Date;
41
+ originalEvent: Event;
42
+ } | {
43
+ type: 'view-change';
44
+ view: ViewType;
45
+ date: Date;
46
+ } | {
47
+ type: 'selection-change';
48
+ selectedEvent: SchedulerEvent | null;
49
+ range: TimeRange | null;
50
+ view: ViewType;
51
+ resourceId?: string;
52
+ };
53
+ /**
54
+ * Type helper to extract the detail type for a specific event.
55
+ */
56
+ export type EventDetail<T extends SchedulerCustomEvent['type']> = Omit<Extract<SchedulerCustomEvent, {
57
+ type: T;
58
+ }>, 'type'>;
@@ -0,0 +1,2 @@
1
+ export * from './event-types';
2
+ export * from './scheduler-event-emitter';