@m3ui-vue/m3ui-vue 1.2.2 → 1.3.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 (235) hide show
  1. package/dist/API.md +2776 -351
  2. package/dist/MButton-CuNzpoxm.js +172 -0
  3. package/dist/MButton-CuNzpoxm.js.map +1 -0
  4. package/dist/MDialog-HxEL-m58.js +173 -0
  5. package/dist/MDialog-HxEL-m58.js.map +1 -0
  6. package/dist/MIconButton-DoNotQ9v.js +282 -0
  7. package/dist/MIconButton-DoNotQ9v.js.map +1 -0
  8. package/dist/MListItem-DnPtv-hY.js +824 -0
  9. package/dist/MListItem-DnPtv-hY.js.map +1 -0
  10. package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
  11. package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
  12. package/dist/MMenuItem-Bih0h4-n.js +604 -0
  13. package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
  14. package/dist/MProgressBar-BCoruxA-.js +184 -0
  15. package/dist/MProgressBar-BCoruxA-.js.map +1 -0
  16. package/dist/MSeekBar-LURE1Ah7.js +435 -0
  17. package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
  18. package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
  19. package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
  20. package/dist/MSlider-_J4IS2_z.js +691 -0
  21. package/dist/MSlider-_J4IS2_z.js.map +1 -0
  22. package/dist/MSpinner-BhkMYKOM.js +65 -0
  23. package/dist/MSpinner-BhkMYKOM.js.map +1 -0
  24. package/dist/MTextField-CkzwNBWS.js +296 -0
  25. package/dist/MTextField-CkzwNBWS.js.map +1 -0
  26. package/dist/MTooltip-B67ZDSGp.js +756 -0
  27. package/dist/MTooltip-B67ZDSGp.js.map +1 -0
  28. package/dist/_storageKeys-CYXsUBwK.js +18 -0
  29. package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
  30. package/dist/_useEscapeStack-CjndQhqg.js +19 -0
  31. package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
  32. package/dist/api.json +1 -1
  33. package/dist/chart.js +1 -1
  34. package/dist/code-editor.js +1 -1
  35. package/dist/components/MAudioPlayer.vue.d.ts +115 -0
  36. package/dist/components/MBadge.vue.d.ts +1 -1
  37. package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
  38. package/dist/components/MBox.vue.d.ts +1 -1
  39. package/dist/components/MButton.vue.d.ts +1 -1
  40. package/dist/components/MConfirmDialog.vue.d.ts +1 -1
  41. package/dist/components/MCopyButton.vue.d.ts +2 -2
  42. package/dist/components/MDataTable.vue.d.ts +2 -2
  43. package/dist/components/MDialog.vue.d.ts +2 -2
  44. package/dist/components/MDivider.vue.d.ts +1 -1
  45. package/dist/components/MDragHandle.vue.d.ts +1 -1
  46. package/dist/components/MDrawCanvas.vue.d.ts +148 -0
  47. package/dist/components/MDrawLayers.vue.d.ts +3 -0
  48. package/dist/components/MDrawToolbar.vue.d.ts +34 -0
  49. package/dist/components/MExportButton.vue.d.ts +1 -1
  50. package/dist/components/MFab.vue.d.ts +2 -2
  51. package/dist/components/MFabMenu.vue.d.ts +2 -2
  52. package/dist/components/MFixed.vue.d.ts +1 -1
  53. package/dist/components/MFlex.vue.d.ts +2 -2
  54. package/dist/components/MFloorPlan.vue.d.ts +160 -0
  55. package/dist/components/MFlow.vue.d.ts +305 -0
  56. package/dist/components/MFlowControls.vue.d.ts +33 -0
  57. package/dist/components/MFlowHandle.vue.d.ts +16 -0
  58. package/dist/components/MFlowMinimap.vue.d.ts +22 -0
  59. package/dist/components/MFlowNode.vue.d.ts +35 -0
  60. package/dist/components/MGantt.vue.d.ts +141 -0
  61. package/dist/components/MGanttControls.vue.d.ts +32 -0
  62. package/dist/components/MIconButton.vue.d.ts +3 -1
  63. package/dist/components/MImageCropper.vue.d.ts +110 -0
  64. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  65. package/dist/components/MLightbox.vue.d.ts +2 -2
  66. package/dist/components/MList.vue.d.ts +1 -1
  67. package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
  68. package/dist/components/MMapControl.vue.d.ts +1 -1
  69. package/dist/components/MMapSearch.vue.d.ts +1 -1
  70. package/dist/components/MMaskField.vue.d.ts +12 -1
  71. package/dist/components/MMenu.vue.d.ts +1 -1
  72. package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
  73. package/dist/components/MNumberField.vue.d.ts +11 -2
  74. package/dist/components/MPdfViewer.vue.d.ts +174 -0
  75. package/dist/components/MPullToRefresh.vue.d.ts +1 -1
  76. package/dist/components/MResourceTimeline.vue.d.ts +149 -0
  77. package/dist/components/MScheduler.vue.d.ts +3 -3
  78. package/dist/components/MScheme.vue.d.ts +1 -1
  79. package/dist/components/MSearchField.vue.d.ts +1 -1
  80. package/dist/components/MSeekBar.vue.d.ts +1 -1
  81. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  82. package/dist/components/MSkeleton.vue.d.ts +1 -1
  83. package/dist/components/MSlider.vue.d.ts +2 -2
  84. package/dist/components/MSparkline.vue.d.ts +1 -1
  85. package/dist/components/MSplitter.vue.d.ts +1 -1
  86. package/dist/components/MStack.vue.d.ts +2 -2
  87. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  88. package/dist/components/MSwitch.vue.d.ts +1 -1
  89. package/dist/components/MTable.vue.d.ts +1 -1
  90. package/dist/components/MTagInput.vue.d.ts +12 -1
  91. package/dist/components/MTextField.vue.d.ts +13 -2
  92. package/dist/components/MToolbar.vue.d.ts +1 -1
  93. package/dist/components/MTree.vue.d.ts +2 -2
  94. package/dist/components/MVideoPlayer.vue.d.ts +253 -0
  95. package/dist/components/MVirtualTable.vue.d.ts +1 -1
  96. package/dist/components/MWindow.vue.d.ts +3 -3
  97. package/dist/components/_MFlowEdge.vue.d.ts +9 -0
  98. package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
  99. package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
  100. package/dist/components/_MPdfPage.vue.d.ts +76 -0
  101. package/dist/components/_MTimeBackground.vue.d.ts +14 -0
  102. package/dist/components/_MTimeHeader.vue.d.ts +20 -0
  103. package/dist/composables/_flowPanel.d.ts +2 -0
  104. package/dist/composables/_flowSlot.d.ts +5 -0
  105. package/dist/composables/_ganttTime.d.ts +41 -0
  106. package/dist/composables/_useTimeAxis.d.ts +90 -0
  107. package/dist/composables/drawGeometry.d.ts +119 -0
  108. package/dist/composables/flowFormats.d.ts +79 -0
  109. package/dist/composables/flowLayout.d.ts +45 -0
  110. package/dist/composables/flowPaths.d.ts +53 -0
  111. package/dist/composables/ganttFormats.d.ts +52 -0
  112. package/dist/composables/ganttSchedule.d.ts +99 -0
  113. package/dist/composables/useDrawing.d.ts +44 -0
  114. package/dist/composables/useFlow.d.ts +266 -0
  115. package/dist/composables/useGantt.d.ts +87 -0
  116. package/dist/composables/useLocale.d.ts +163 -0
  117. package/dist/composables/useMediaPlayer.d.ts +101 -0
  118. package/dist/composables/usePdf.d.ts +119 -0
  119. package/dist/composables/useResourceTimeline.d.ts +70 -0
  120. package/dist/draw.d.ts +7 -0
  121. package/dist/draw.js +1700 -0
  122. package/dist/draw.js.map +1 -0
  123. package/dist/flow.d.ts +14 -0
  124. package/dist/flow.js +3542 -0
  125. package/dist/flow.js.map +1 -0
  126. package/dist/flowPaths-CUc6X373.js +161 -0
  127. package/dist/flowPaths-CUc6X373.js.map +1 -0
  128. package/dist/gantt.d.ts +12 -0
  129. package/dist/gantt.js +3575 -0
  130. package/dist/gantt.js.map +1 -0
  131. package/dist/index.d.ts +4 -0
  132. package/dist/locales/index.js +1148 -7
  133. package/dist/locales/index.js.map +1 -1
  134. package/dist/m3ui-vue.css +1 -1
  135. package/dist/m3ui.js +7286 -7654
  136. package/dist/m3ui.js.map +1 -1
  137. package/dist/map.js +113 -108
  138. package/dist/map.js.map +1 -1
  139. package/dist/media.d.ts +5 -0
  140. package/dist/media.js +1311 -0
  141. package/dist/media.js.map +1 -0
  142. package/dist/pdf.d.ts +4 -0
  143. package/dist/pdf.js +1871 -0
  144. package/dist/pdf.js.map +1 -0
  145. package/dist/rich-text-editor.js +28 -26
  146. package/dist/rich-text-editor.js.map +1 -1
  147. package/dist/styles.css +1 -1
  148. package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
  149. package/dist/useLocale-BpGxplLV.js.map +1 -0
  150. package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
  151. package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
  152. package/package.json +29 -5
  153. package/src/__tests__/MAudioPlayer.test.ts +75 -0
  154. package/src/__tests__/MDrawCanvas.test.ts +110 -0
  155. package/src/__tests__/MFloorPlan.test.ts +97 -0
  156. package/src/__tests__/MFlow.test.ts +575 -0
  157. package/src/__tests__/MGantt.test.ts +130 -0
  158. package/src/__tests__/MImageCropper.test.ts +89 -0
  159. package/src/__tests__/MPdfViewer.test.ts +235 -0
  160. package/src/__tests__/MResourceTimeline.test.ts +102 -0
  161. package/src/__tests__/MVideoPlayer.test.ts +201 -0
  162. package/src/__tests__/drawGeometry.test.ts +58 -0
  163. package/src/__tests__/fieldExpose.test.ts +30 -0
  164. package/src/__tests__/flowFormats.test.ts +185 -0
  165. package/src/__tests__/flowLayout.test.ts +113 -0
  166. package/src/__tests__/ganttFormats.test.ts +76 -0
  167. package/src/__tests__/ganttSchedule.test.ts +136 -0
  168. package/src/__tests__/pdfMock.ts +83 -0
  169. package/src/__tests__/useMediaPlayer.test.ts +182 -0
  170. package/src/__tests__/usePdf.test.ts +102 -0
  171. package/src/components/MAudioPlayer.vue +319 -0
  172. package/src/components/MDrawCanvas.vue +813 -0
  173. package/src/components/MDrawLayers.vue +114 -0
  174. package/src/components/MDrawToolbar.vue +171 -0
  175. package/src/components/MFloorPlan.vue +581 -0
  176. package/src/components/MFlow.vue +2049 -0
  177. package/src/components/MFlowControls.vue +110 -0
  178. package/src/components/MFlowHandle.vue +60 -0
  179. package/src/components/MFlowMinimap.vue +134 -0
  180. package/src/components/MFlowNode.vue +98 -0
  181. package/src/components/MGantt.vue +1609 -0
  182. package/src/components/MGanttControls.vue +77 -0
  183. package/src/components/MIconButton.vue +3 -1
  184. package/src/components/MImageCropper.vue +507 -0
  185. package/src/components/MMaskField.vue +13 -0
  186. package/src/components/MNumberField.vue +13 -0
  187. package/src/components/MPdfViewer.vue +1269 -0
  188. package/src/components/MResourceTimeline.vue +1020 -0
  189. package/src/components/MTagInput.vue +13 -0
  190. package/src/components/MTextField.vue +16 -0
  191. package/src/components/MVideoPlayer.vue +839 -0
  192. package/src/components/_MFlowEdge.vue +100 -0
  193. package/src/components/_MFlowEdgeLabel.vue +56 -0
  194. package/src/components/_MFlowNodeShell.vue +111 -0
  195. package/src/components/_MPdfPage.vue +456 -0
  196. package/src/components/_MTimeBackground.vue +16 -0
  197. package/src/components/_MTimeHeader.vue +31 -0
  198. package/src/composables/_flowPanel.ts +13 -0
  199. package/src/composables/_flowSlot.ts +6 -0
  200. package/src/composables/_ganttTime.ts +200 -0
  201. package/src/composables/_useTimeAxis.ts +224 -0
  202. package/src/composables/drawGeometry.ts +405 -0
  203. package/src/composables/flowFormats.ts +916 -0
  204. package/src/composables/flowLayout.ts +297 -0
  205. package/src/composables/flowPaths.ts +239 -0
  206. package/src/composables/ganttFormats.ts +366 -0
  207. package/src/composables/ganttSchedule.ts +403 -0
  208. package/src/composables/useDrawing.ts +53 -0
  209. package/src/composables/useFlow.ts +250 -0
  210. package/src/composables/useGantt.ts +92 -0
  211. package/src/composables/useLocale.ts +328 -0
  212. package/src/composables/useMediaPlayer.ts +406 -0
  213. package/src/composables/usePdf.ts +456 -0
  214. package/src/composables/useResourceTimeline.ts +76 -0
  215. package/src/draw.ts +25 -0
  216. package/src/flow.ts +26 -0
  217. package/src/gantt.ts +12 -0
  218. package/src/index.ts +4 -0
  219. package/src/locales/de.ts +163 -0
  220. package/src/locales/es.ts +163 -0
  221. package/src/locales/fr.ts +163 -0
  222. package/src/locales/ja.ts +163 -0
  223. package/src/locales/ko.ts +163 -0
  224. package/src/locales/pt.ts +163 -0
  225. package/src/locales/zh.ts +163 -0
  226. package/src/media.ts +5 -0
  227. package/src/pdf.ts +15 -0
  228. package/dist/MMenuItem-D4Gx_l3F.js +0 -929
  229. package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
  230. package/dist/MSlider-Dx_S3vJ9.js +0 -1506
  231. package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
  232. package/dist/MTextField-Bz8JIsnl.js +0 -633
  233. package/dist/MTextField-Bz8JIsnl.js.map +0 -1
  234. package/dist/useLocale-JYxDDeXC.js.map +0 -1
  235. package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
@@ -0,0 +1,266 @@
1
+ import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
2
+ import type { FlowEdgePath, FlowPosition } from './flowPaths';
3
+ import type { FlowLayout, FlowLayoutOptions } from './flowLayout';
4
+ export type { FlowPosition };
5
+ /** A point in flow coordinates */
6
+ export interface FlowXY {
7
+ x: number;
8
+ y: number;
9
+ }
10
+ /**
11
+ * A node. Treat nodes as immutable: MFlow emits new arrays with new objects for whatever changed (`v-model:nodes`),
12
+ * and the history (undo) keeps the old ones.
13
+ */
14
+ export interface FlowNode<D = any> {
15
+ id: string;
16
+ /**
17
+ * How it's drawn: `default` (an MFlowNode with a handle each side), `input` (only a source), `output` (only a
18
+ * target), `circle` (a round vertex, see `FlowCircleData`), `group` (a container for nodes whose `parentId` is this
19
+ * one), or any name you give a `#node-<type>` slot
20
+ */
21
+ type?: string;
22
+ /** Its top left corner, in flow coordinates (relative to the parent's corner when it has a `parentId`) */
23
+ position: FlowXY;
24
+ /** Anything; the default node shows `label`, `subtitle` and `icon` */
25
+ data?: D;
26
+ /** A fixed size; otherwise it's measured. A `group` without one wraps its children */
27
+ width?: number;
28
+ height?: number;
29
+ /** The group this node sits in: it moves with it */
30
+ parentId?: string;
31
+ /** `'parent'` keeps it inside its group */
32
+ extent?: 'parent';
33
+ /** Where the default node's handles go; default from MFlow's `direction` */
34
+ sourcePosition?: FlowPosition;
35
+ targetPosition?: FlowPosition;
36
+ hidden?: boolean;
37
+ draggable?: boolean;
38
+ selectable?: boolean;
39
+ connectable?: boolean;
40
+ deletable?: boolean;
41
+ /** `false` keeps it from splicing into an edge when dropped onto one */
42
+ insertable?: boolean;
43
+ class?: string;
44
+ }
45
+ /** What a `circle` node shows */
46
+ export interface FlowCircleData {
47
+ label?: string;
48
+ /** Its fill: a container role (default a neutral surface) */
49
+ color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'neutral' | 'inverse';
50
+ /** A small count or tag on its top right (a level, an excess) */
51
+ badge?: string | number;
52
+ /** A soft halo around it, in a role's color */
53
+ ring?: 'primary' | 'secondary' | 'tertiary' | 'error';
54
+ /** Diameter in px (default 56) */
55
+ size?: number;
56
+ }
57
+ export type FlowMarker = 'arrow' | 'arrow-closed' | 'none';
58
+ export interface FlowEdge<D = any> {
59
+ id: string;
60
+ source: string;
61
+ target: string;
62
+ /** The handle's `id` when its node has several */
63
+ sourceHandle?: string | null;
64
+ targetHandle?: string | null;
65
+ /** `bezier` (default), `smoothstep`, `step`, `straight`, or a `#edge-<type>` slot */
66
+ type?: string;
67
+ /**
68
+ * For a `#edge-<type>` slot: how it's routed, which is the `path` the slot gets and where the edge is hit
69
+ * (default `bezier`)
70
+ */
71
+ pathType?: 'bezier' | 'smoothstep' | 'step' | 'straight';
72
+ label?: string;
73
+ /** The label chip's color (default a neutral chip) */
74
+ labelTone?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'neutral';
75
+ /** Dashes that flow from source to target (`'reverse'`: from target to source) */
76
+ animated?: boolean | 'reverse';
77
+ /** The line's (and arrowhead's) color: an M3 role (`primary`, `tertiary`, `error`, `outline`…) or any CSS color. Changes animate */
78
+ color?: string;
79
+ /** The line's width in px (default 2). Changes animate */
80
+ width?: number;
81
+ /** A dashed line, standing still */
82
+ dashed?: boolean;
83
+ /** Default `arrow-closed` */
84
+ markerEnd?: FlowMarker;
85
+ markerStart?: FlowMarker;
86
+ data?: D;
87
+ hidden?: boolean;
88
+ selectable?: boolean;
89
+ deletable?: boolean;
90
+ /** Its ends can be dragged to other handles once selected; default MFlow's `edgesReconnectable` */
91
+ reconnectable?: boolean;
92
+ class?: string;
93
+ }
94
+ /** The view: `x`/`y` in px, where the flow's origin is on the canvas, and the zoom */
95
+ export interface FlowViewport {
96
+ x: number;
97
+ y: number;
98
+ zoom: number;
99
+ }
100
+ /** A connection being made or checked */
101
+ export interface FlowConnection {
102
+ source: string;
103
+ sourceHandle: string | null;
104
+ target: string;
105
+ targetHandle: string | null;
106
+ }
107
+ export interface FlowSelection {
108
+ nodes: string[];
109
+ edges: string[];
110
+ }
111
+ /** A handle as measured: its center relative to its node's corner, in flow units */
112
+ export interface FlowHandleBounds {
113
+ id: string | null;
114
+ type: 'source' | 'target';
115
+ position: FlowPosition;
116
+ x: number;
117
+ y: number;
118
+ connectable: boolean;
119
+ }
120
+ export interface FlowFitOptions {
121
+ /** Room around the nodes, a fraction of the view (default 0.1) */
122
+ padding?: number;
123
+ /** Only these nodes */
124
+ nodes?: string[];
125
+ maxZoom?: number;
126
+ minZoom?: number;
127
+ /** Default true */
128
+ animate?: boolean;
129
+ }
130
+ /** What MFlow provides to everything inside it, and `useFlow()` returns */
131
+ export interface FlowContext {
132
+ nodes: ComputedRef<FlowNode[]>;
133
+ edges: ComputedRef<FlowEdge[]>;
134
+ viewport: Readonly<Ref<FlowViewport>>;
135
+ selection: ComputedRef<FlowSelection>;
136
+ minZoom: ComputedRef<number>;
137
+ maxZoom: ComputedRef<number>;
138
+ /** Canvas size in px */
139
+ size: Readonly<Ref<{
140
+ width: number;
141
+ height: number;
142
+ }>>;
143
+ /** Interaction switched off by the lock button (or MFlow's `locked`) */
144
+ locked: Ref<boolean>;
145
+ getNode(id: string): FlowNode | undefined;
146
+ /** A node's top left corner in flow coordinates, its parents added, where it's drawn right now */
147
+ getAbsolutePosition(id: string): FlowXY;
148
+ /** A node's measured (or set) size */
149
+ getSize(id: string): {
150
+ width: number;
151
+ height: number;
152
+ };
153
+ /** Nodes overlapping this one (or a rectangle in flow coordinates), groups and its own family left out */
154
+ getIntersectingNodes(node: string | {
155
+ x: number;
156
+ y: number;
157
+ width: number;
158
+ height: number;
159
+ }): FlowNode[];
160
+ /** Page (client) coordinates → flow coordinates */
161
+ screenToFlow(p: {
162
+ x: number;
163
+ y: number;
164
+ }): FlowXY;
165
+ flowToScreen(p: FlowXY): {
166
+ x: number;
167
+ y: number;
168
+ };
169
+ setViewport(v: Partial<FlowViewport>, opts?: {
170
+ animate?: boolean;
171
+ }): void;
172
+ fitView(opts?: FlowFitOptions): void;
173
+ /** Centers the view on a flow point, at `zoom` or the current zoom */
174
+ setCenter(x: number, y: number, opts?: {
175
+ zoom?: number;
176
+ animate?: boolean;
177
+ }): void;
178
+ zoomIn(): void;
179
+ zoomOut(): void;
180
+ zoomTo(zoom: number, opts?: {
181
+ animate?: boolean;
182
+ }): void;
183
+ addNodes(nodes: FlowNode | FlowNode[]): void;
184
+ addEdges(edges: FlowEdge | FlowEdge[]): void;
185
+ updateNode(id: string, patch: Partial<FlowNode> | ((n: FlowNode) => FlowNode)): void;
186
+ updateEdge(id: string, patch: Partial<FlowEdge> | ((e: FlowEdge) => FlowEdge)): void;
187
+ /** Deletes nodes (with their edges and children) and edges by id */
188
+ remove(ids: {
189
+ nodes?: string[];
190
+ edges?: string[];
191
+ }): void;
192
+ setSelection(sel: Partial<FlowSelection>): void;
193
+ /** Runs a layout over the nodes' measured sizes; default MFlow's `layout` (or the tree layout). Animated and undoable */
194
+ layout(fn?: 'tree' | 'layered' | FlowLayout, options?: FlowLayoutOptions): Promise<void>;
195
+ undo(): void;
196
+ redo(): void;
197
+ canUndo: ComputedRef<boolean>;
198
+ canRedo: ComputedRef<boolean>;
199
+ copy(): void;
200
+ cut(): void;
201
+ /** Pastes what was copied, at a flow point (default a step from the originals) */
202
+ paste(at?: FlowXY): void;
203
+ /**
204
+ * Drags a node with a pointer that's already down, e.g. one just added from a palette outside the canvas: it
205
+ * follows the pointer from there (guides, splicing into an edge) until it's let go. With a finger, the page
206
+ * doesn't scroll under it meanwhile (start the drag from a long press, so a swipe still scrolls your palette)
207
+ */
208
+ startDrag(id: string, e: PointerEvent): void;
209
+ }
210
+ export interface FlowInternals extends FlowContext {
211
+ registerHandle(nodeId: string, el: HTMLElement, info: () => Omit<FlowHandleBounds, 'x' | 'y'>): () => void;
212
+ measureNode(nodeId: string): void;
213
+ startConnection(e: PointerEvent, nodeId: string, handleId: string | null, type: 'source' | 'target'): void;
214
+ /** The handle a connection being dragged would snap to (`nodeId:handleId:type`), and whether it's valid */
215
+ connectionTarget: Readonly<Ref<{
216
+ key: string;
217
+ valid: boolean;
218
+ } | null>>;
219
+ connecting: Readonly<Ref<boolean>>;
220
+ /** The edge a dragged node would splice into if dropped now */
221
+ insertEdge: Readonly<Ref<string | null>>;
222
+ /** Dragging an edge draws a branch from its source (edgeBranching) */
223
+ branching: ComputedRef<boolean>;
224
+ nodesConnectable: ComputedRef<boolean>;
225
+ direction: ComputedRef<'horizontal' | 'vertical'>;
226
+ registerNodeEl(id: string, el: HTMLElement | null): void;
227
+ selectedNodes: ComputedRef<Set<string>>;
228
+ selectedEdges: ComputedRef<Set<string>>;
229
+ dragging: Readonly<Ref<Set<string>>>;
230
+ isLifted(id: string): boolean;
231
+ zIndexOf(id: string): number;
232
+ edgeGeometry(e: FlowEdge): FlowEdgeGeometry | null;
233
+ isReconnectable(e: FlowEdge): boolean;
234
+ sidePositions(n: FlowNode): {
235
+ source: FlowPosition;
236
+ target: FlowPosition;
237
+ };
238
+ onNodeKey(e: KeyboardEvent, id: string): void;
239
+ onEdgeKey(e: KeyboardEvent, id: string): void;
240
+ }
241
+ export interface FlowEdgeGeometry extends FlowEdgePath {
242
+ sourceX: number;
243
+ sourceY: number;
244
+ targetX: number;
245
+ targetY: number;
246
+ sourcePosition: FlowPosition;
247
+ targetPosition: FlowPosition;
248
+ /** How far the end sits inside a handle (0 at a node's side) */
249
+ sourceInset: number;
250
+ targetInset: number;
251
+ }
252
+ export declare const FLOW_KEY: InjectionKey<FlowInternals>;
253
+ export interface FlowNodeState {
254
+ id: string;
255
+ node: ComputedRef<FlowNode>;
256
+ selected: ComputedRef<boolean>;
257
+ dragging: ComputedRef<boolean>;
258
+ }
259
+ export declare const FLOW_NODE_KEY: InjectionKey<FlowNodeState>;
260
+ /**
261
+ * The enclosing `<MFlow>`'s state and controls, from any component rendered inside it (a `#node-<type>` slot, a
262
+ * panel of your own). Outside one, use MFlow's template ref, which exposes the same.
263
+ */
264
+ export declare function useFlow(): FlowContext;
265
+ /** The node a component is rendered in (inside a `#node-<type>` slot), or null */
266
+ export declare function useFlowNode(): FlowNodeState | null;
@@ -0,0 +1,87 @@
1
+ import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
2
+ import type { GanttCriticalPath, GanttDependency, GanttScheduleOptions, GanttTask } from './ganttSchedule';
3
+ import type { TimeUnit } from './_ganttTime';
4
+ /** MGantt's named zoom levels */
5
+ export type GanttScale = TimeUnit;
6
+ /** A column of MGantt's task list */
7
+ export interface GanttColumn {
8
+ /** `name`, `start`, `end`, `duration` and `progress` are built in; anything else reads `task.data[key]` (or the slot `#cell-<key>`) */
9
+ key: string;
10
+ label?: string;
11
+ /** px; the `name` column takes what's left when it has none */
12
+ width?: number;
13
+ align?: 'start' | 'center' | 'end';
14
+ /** Text for a cell */
15
+ format?: (task: GanttTask) => string;
16
+ }
17
+ /** What MGantt provides to everything inside it (MGanttControls, panels of yours), and its template ref exposes */
18
+ export interface GanttContext {
19
+ /** The tasks as drawn: summaries rolled up from their children */
20
+ tasks: ComputedRef<GanttTask[]>;
21
+ selection: ComputedRef<string[]>;
22
+ /** The closest named scale to the zoom */
23
+ scale: ComputedRef<GanttScale>;
24
+ /** The zoom, in px per day */
25
+ pxPerDay: Readonly<Ref<number>>;
26
+ readonly: ComputedRef<boolean>;
27
+ canUndo: ComputedRef<boolean>;
28
+ canRedo: ComputedRef<boolean>;
29
+ /** Every task id whose children are hidden */
30
+ collapsed: ComputedRef<string[]>;
31
+ undo(): void;
32
+ redo(): void;
33
+ zoomIn(): void;
34
+ zoomOut(): void;
35
+ setScale(scale: GanttScale): void;
36
+ /** Scrolls so a date (default now) sits at the view's `align` (default center) */
37
+ scrollToDate(date?: string, opts?: {
38
+ align?: 'start' | 'center';
39
+ animate?: boolean;
40
+ }): void;
41
+ /** Scrolls a task into view, its row and its bar */
42
+ scrollToTask(id: string): void;
43
+ toggle(id: string, expanded?: boolean): void;
44
+ expandAll(): void;
45
+ collapseAll(): void;
46
+ setSelection(ids: string[]): void;
47
+ /** Adds tasks (after `after`, or at the end); undoable */
48
+ addTasks(tasks: GanttTask | GanttTask[], opts?: {
49
+ after?: string;
50
+ }): void;
51
+ updateTask(id: string, patch: Partial<GanttTask> | ((t: GanttTask) => GanttTask)): void;
52
+ /** Deletes tasks with their children and the dependencies on them */
53
+ removeTasks(ids: string[]): void;
54
+ /** Makes `to` depend on `from` */
55
+ link(from: string, to: string, type?: GanttDependency['type'], lag?: number): void;
56
+ unlink(from: string, to: string): void;
57
+ /** Runs `scheduleTasks` over the tasks with MGantt's calendar; undoable */
58
+ schedule(options?: GanttScheduleOptions): void;
59
+ criticalPath: ComputedRef<GanttCriticalPath>;
60
+ /** The date (snapped) under a page x */
61
+ dateAt(clientX: number): string;
62
+ }
63
+ export declare const GANTT_KEY: InjectionKey<GanttContext>;
64
+ /** What MGanttControls drives, in an MGantt or an MResourceTimeline */
65
+ export interface TimelineControls {
66
+ scale: ComputedRef<GanttScale>;
67
+ readonly: ComputedRef<boolean>;
68
+ canUndo: ComputedRef<boolean>;
69
+ canRedo: ComputedRef<boolean>;
70
+ /** Whether anything can fold (summaries, resource groups) and whether something is folded */
71
+ foldable: ComputedRef<boolean>;
72
+ folded: ComputedRef<boolean>;
73
+ undo(): void;
74
+ redo(): void;
75
+ zoomIn(): void;
76
+ zoomOut(): void;
77
+ setScale(scale: GanttScale): void;
78
+ scrollToDate(date?: string): void;
79
+ expandAll(): void;
80
+ collapseAll(): void;
81
+ }
82
+ export declare const TIMELINE_CONTROLS_KEY: InjectionKey<TimelineControls>;
83
+ /**
84
+ * The enclosing `<MGantt>`'s state and controls, from a component rendered in its default slot. Outside one, use
85
+ * MGantt's template ref, which exposes the same.
86
+ */
87
+ export declare function useGantt(): GanttContext;
@@ -196,6 +196,169 @@ export interface M3Locale {
196
196
  /** MTimeline's button past `limit`; `{count}` is how many entries are hidden */
197
197
  timelineShowMore: string;
198
198
  timelineShowLess: string;
199
+ mediaPlayer: string;
200
+ mediaPlay: string;
201
+ mediaPause: string;
202
+ mediaReplay: string;
203
+ mediaSeekBack: string;
204
+ mediaSeekForward: string;
205
+ mediaSeconds: string;
206
+ mediaMute: string;
207
+ mediaUnmute: string;
208
+ mediaVolume: string;
209
+ mediaFullscreen: string;
210
+ mediaExitFullscreen: string;
211
+ mediaPictureInPicture: string;
212
+ mediaSettings: string;
213
+ mediaSpeed: string;
214
+ mediaSpeedNormal: string;
215
+ mediaSubtitles: string;
216
+ mediaSubtitlesOff: string;
217
+ mediaQuality: string;
218
+ mediaQualityAuto: string;
219
+ mediaLive: string;
220
+ mediaError: string;
221
+ mediaRepeat: string;
222
+ mediaRepeatOne: string;
223
+ mediaShuffle: string;
224
+ pdfViewer: string;
225
+ pdfThumbnails: string;
226
+ pdfOutline: string;
227
+ pdfPage: string;
228
+ pdfZoom: string;
229
+ pdfZoomIn: string;
230
+ pdfZoomOut: string;
231
+ pdfFitWidth: string;
232
+ pdfFitPage: string;
233
+ pdfSearch: string;
234
+ pdfSearchPrevious: string;
235
+ pdfSearchNext: string;
236
+ pdfMatchCount: string;
237
+ pdfNoMatches: string;
238
+ pdfMore: string;
239
+ pdfRotate: string;
240
+ pdfDownload: string;
241
+ pdfPrint: string;
242
+ pdfFullscreen: string;
243
+ pdfExitFullscreen: string;
244
+ pdfPassword: string;
245
+ pdfPasswordLabel: string;
246
+ pdfWrongPassword: string;
247
+ pdfOpen: string;
248
+ pdfError: string;
249
+ pdfLoading: string;
250
+ pdfAnnotate: string;
251
+ pdfSelect: string;
252
+ pdfHighlight: string;
253
+ pdfNote: string;
254
+ pdfDraw: string;
255
+ pdfEraser: string;
256
+ pdfInkWidth: string;
257
+ pdfColor: string;
258
+ pdfUndo: string;
259
+ pdfCopy: string;
260
+ pdfDelete: string;
261
+ pdfNotePlaceholder: string;
262
+ pdfAddComment: string;
263
+ flowCanvas: string;
264
+ flowNode: string;
265
+ flowEdge: string;
266
+ flowZoomIn: string;
267
+ flowZoomOut: string;
268
+ flowFitView: string;
269
+ flowLock: string;
270
+ flowUnlock: string;
271
+ flowUndo: string;
272
+ flowRedo: string;
273
+ flowMinimap: string;
274
+ flowMoved: string;
275
+ flowConnected: string;
276
+ flowDeleted: string;
277
+ flowDeleteEdge: string;
278
+ flowDelete: string;
279
+ ganttChart: string;
280
+ ganttTask: string;
281
+ ganttStart: string;
282
+ ganttEnd: string;
283
+ ganttDuration: string;
284
+ ganttProgress: string;
285
+ ganttDays: string;
286
+ ganttHours: string;
287
+ ganttMilestone: string;
288
+ ganttQuarter: string;
289
+ ganttToday: string;
290
+ ganttZoomIn: string;
291
+ ganttZoomOut: string;
292
+ ganttExpandAll: string;
293
+ ganttCollapseAll: string;
294
+ ganttExpand: string;
295
+ ganttCollapse: string;
296
+ ganttUndo: string;
297
+ ganttRedo: string;
298
+ ganttScaleHour: string;
299
+ ganttScaleDay: string;
300
+ ganttScaleWeek: string;
301
+ ganttScaleMonth: string;
302
+ ganttScaleQuarter: string;
303
+ ganttScaleYear: string;
304
+ ganttMoved: string;
305
+ ganttProgressSet: string;
306
+ ganttLinked: string;
307
+ ganttUnlink: string;
308
+ ganttDeleted: string;
309
+ ganttDelete: string;
310
+ ganttReordered: string;
311
+ ganttSlack: string;
312
+ ganttCritical: string;
313
+ ganttBaseline: string;
314
+ ganttEmpty: string;
315
+ ganttResize: string;
316
+ timelineResource: string;
317
+ timelineConflict: string;
318
+ timelineMoved: string;
319
+ timelineEmpty: string;
320
+ cropArea: string;
321
+ cropRotateLeft: string;
322
+ cropRotateRight: string;
323
+ cropFlip: string;
324
+ cropReset: string;
325
+ cropFree: string;
326
+ drawCanvas: string;
327
+ drawTools: string;
328
+ drawMore: string;
329
+ drawSelect: string;
330
+ drawPan: string;
331
+ drawPen: string;
332
+ drawBrush: string;
333
+ drawMarker: string;
334
+ drawHighlighter: string;
335
+ drawEraser: string;
336
+ drawStrokeEraser: string;
337
+ drawLine: string;
338
+ drawArrow: string;
339
+ drawRect: string;
340
+ drawEllipse: string;
341
+ drawText: string;
342
+ drawFill: string;
343
+ drawColor: string;
344
+ floorPlan: string;
345
+ floorSeats: string;
346
+ drawCustomColor: string;
347
+ drawSize: string;
348
+ drawUndo: string;
349
+ drawRedo: string;
350
+ drawDelete: string;
351
+ drawLayers: string;
352
+ drawLayer: string;
353
+ drawLayerName: string;
354
+ drawAddLayer: string;
355
+ drawDeleteLayer: string;
356
+ drawShowLayer: string;
357
+ drawHideLayer: string;
358
+ drawLockLayer: string;
359
+ drawUnlockLayer: string;
360
+ drawLayerUp: string;
361
+ drawLayerDown: string;
199
362
  }
200
363
  export declare const defaultLocale: M3Locale;
201
364
  export declare const M3_LOCALE_KEY: InjectionKey<MaybeRef<Partial<M3Locale>>>;
@@ -0,0 +1,101 @@
1
+ import { type MaybeRefOrGetter, type Ref, type WritableComputedRef } from 'vue';
2
+ /** What the lock screen and the system's media notification show (the Media Session API's metadata) */
3
+ export interface MediaPlayerMetadata {
4
+ title?: string;
5
+ artist?: string;
6
+ album?: string;
7
+ /** Cover images, largest last is fine: `[{ src, sizes: '512x512', type: 'image/png' }]` or plain URLs */
8
+ artwork?: (string | {
9
+ src: string;
10
+ sizes?: string;
11
+ type?: string;
12
+ })[];
13
+ }
14
+ export interface MediaPlayerOptions {
15
+ /**
16
+ * The `<audio>` or `<video>` element to drive (a ref or a getter; it may come and go). Without one the player
17
+ * runs its own clock over `duration`: for anything that isn't a media file (a canvas, a shader, generated audio)
18
+ * that should still play, pause, seek and change speed like one.
19
+ */
20
+ media?: MaybeRefOrGetter<HTMLMediaElement | null | undefined>;
21
+ /** The length in seconds, for the clock (without `media`) */
22
+ duration?: MaybeRefOrGetter<number | undefined>;
23
+ /** Shown on the lock screen and the system's media notification while this player plays (Media Session API) */
24
+ metadata?: MaybeRefOrGetter<MediaPlayerMetadata | null | undefined>;
25
+ /** The previous button (and the lock screen's); without it there is none */
26
+ onPrevious?: () => void;
27
+ /** The next button (and the lock screen's); without it there is none */
28
+ onNext?: () => void;
29
+ /** Whether there is a previous item right now (the first of a playlist has none). Default: `onPrevious` was given */
30
+ hasPrevious?: MaybeRefOrGetter<boolean>;
31
+ /** Whether there is a next item right now. Default: `onNext` was given */
32
+ hasNext?: MaybeRefOrGetter<boolean>;
33
+ /** Seconds `skip()` and the lock screen's seek buttons move by default. Default 10 */
34
+ seekStep?: number;
35
+ /** The clock starts over at the end instead of stopping (with `media`, set the element's `loop`) */
36
+ loop?: MaybeRefOrGetter<boolean | undefined>;
37
+ }
38
+ export interface MediaPlayer {
39
+ /** The media element being driven, or null (clock, or not mounted yet) */
40
+ media: Readonly<Ref<HTMLMediaElement | null>>;
41
+ /** Playing or paused; writing it plays or pauses */
42
+ playing: WritableComputedRef<boolean>;
43
+ /** Position in seconds; writing it seeks */
44
+ currentTime: WritableComputedRef<number>;
45
+ /** Length in seconds: 0 until known, Infinity for a live stream */
46
+ duration: Readonly<Ref<number>>;
47
+ /** Loaded time ranges, `[[start, end], …]` (the clock reports all of it) */
48
+ buffered: Readonly<Ref<[number, number][]>>;
49
+ /** Playback speed; writing it changes it */
50
+ rate: WritableComputedRef<number>;
51
+ /** Volume, 0 to 1; writing it changes it */
52
+ volume: WritableComputedRef<number>;
53
+ /** Muted; writing it mutes or unmutes */
54
+ muted: WritableComputedRef<boolean>;
55
+ /** Stalled for data (a spinner's moment). Writable for the clock, to simulate buffering: it stops advancing meanwhile */
56
+ waiting: Ref<boolean>;
57
+ /** Reached the end; `play()` or `toggle()` start over */
58
+ ended: Readonly<Ref<boolean>>;
59
+ /** A live stream (infinite duration): no seeking */
60
+ live: Readonly<Ref<boolean>>;
61
+ /** The media element's error, if loading or decoding failed */
62
+ error: Readonly<Ref<MediaError | null>>;
63
+ /** The browser refused to start playing (autoplay with sound before any user gesture) */
64
+ blocked: Readonly<Ref<boolean>>;
65
+ /** Whether there is a previous / next item (see the options of the same names) */
66
+ hasPrevious: Readonly<Ref<boolean>>;
67
+ hasNext: Readonly<Ref<boolean>>;
68
+ play: () => Promise<void>;
69
+ pause: () => void;
70
+ toggle: () => Promise<void>;
71
+ /** Seeks to a time in seconds (clamped to the media) */
72
+ seek: (time: number) => void;
73
+ /** Seeks by an offset in seconds, `seekStep` by default (negative goes back) */
74
+ skip: (seconds?: number) => void;
75
+ /** Pauses and goes back to the start */
76
+ stop: () => void;
77
+ previous: () => void;
78
+ next: () => void;
79
+ /**
80
+ * Drives this element instead of the `media` option (null: the clock; undefined: back to `media`). What
81
+ * `MVideoPlayer`/`MAudioPlayer` call with their own element when given a `player`: rate, volume and mute carry over
82
+ */
83
+ attach: (el: HTMLMediaElement | null | undefined) => void;
84
+ }
85
+ /**
86
+ * The state and controls of something that plays: an `<audio>`/`<video>` element, or a clock of its own for
87
+ * anything else. Everything is reactive, the writable parts (`playing`, `currentTime`, `rate`, `volume`, `muted`)
88
+ * act on the media when written, and the player takes the Media Session while it plays (lock screen and
89
+ * notification controls, with `metadata`). `MVideoPlayer` and `MAudioPlayer` are built on it; pass one to their
90
+ * `player` prop to keep playing across pages, or build a player UI of your own on it.
91
+ *
92
+ * ```ts
93
+ * const audio = ref<HTMLAudioElement>()
94
+ * const player = useMediaPlayer({ media: audio, metadata: () => ({ title: track.value.title }) })
95
+ * // <audio ref="audio" :src="track.src" /> … <button @click="player.toggle()">
96
+ *
97
+ * // A shader "video" 90 seconds long: its time is player.currentTime
98
+ * const clock = useMediaPlayer({ duration: 90 })
99
+ * ```
100
+ */
101
+ export declare function useMediaPlayer(options?: MediaPlayerOptions): MediaPlayer;