@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,250 @@
1
+ import { inject, type ComputedRef, type InjectionKey, type Ref } from 'vue'
2
+ import type { FlowEdgePath, FlowPosition } from './flowPaths'
3
+ import type { FlowLayout, FlowLayoutOptions } from './flowLayout'
4
+
5
+ export type { FlowPosition }
6
+
7
+ /** A point in flow coordinates */
8
+ export interface FlowXY { x: number; 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
+
46
+ /** What a `circle` node shows */
47
+ export interface FlowCircleData {
48
+ label?: string
49
+ /** Its fill: a container role (default a neutral surface) */
50
+ color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'neutral' | 'inverse'
51
+ /** A small count or tag on its top right (a level, an excess) */
52
+ badge?: string | number
53
+ /** A soft halo around it, in a role's color */
54
+ ring?: 'primary' | 'secondary' | 'tertiary' | 'error'
55
+ /** Diameter in px (default 56) */
56
+ size?: number
57
+ }
58
+
59
+ export type FlowMarker = 'arrow' | 'arrow-closed' | 'none'
60
+
61
+ export interface FlowEdge<D = any> {
62
+ id: string
63
+ source: string
64
+ target: string
65
+ /** The handle's `id` when its node has several */
66
+ sourceHandle?: string | null
67
+ targetHandle?: string | null
68
+ /** `bezier` (default), `smoothstep`, `step`, `straight`, or a `#edge-<type>` slot */
69
+ type?: string
70
+ /**
71
+ * For a `#edge-<type>` slot: how it's routed, which is the `path` the slot gets and where the edge is hit
72
+ * (default `bezier`)
73
+ */
74
+ pathType?: 'bezier' | 'smoothstep' | 'step' | 'straight'
75
+ label?: string
76
+ /** The label chip's color (default a neutral chip) */
77
+ labelTone?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'neutral'
78
+ /** Dashes that flow from source to target (`'reverse'`: from target to source) */
79
+ animated?: boolean | 'reverse'
80
+ /** The line's (and arrowhead's) color: an M3 role (`primary`, `tertiary`, `error`, `outline`…) or any CSS color. Changes animate */
81
+ color?: string
82
+ /** The line's width in px (default 2). Changes animate */
83
+ width?: number
84
+ /** A dashed line, standing still */
85
+ dashed?: boolean
86
+ /** Default `arrow-closed` */
87
+ markerEnd?: FlowMarker
88
+ markerStart?: FlowMarker
89
+ data?: D
90
+ hidden?: boolean
91
+ selectable?: boolean
92
+ deletable?: boolean
93
+ /** Its ends can be dragged to other handles once selected; default MFlow's `edgesReconnectable` */
94
+ reconnectable?: boolean
95
+ class?: string
96
+ }
97
+
98
+ /** The view: `x`/`y` in px, where the flow's origin is on the canvas, and the zoom */
99
+ export interface FlowViewport { x: number; y: number; zoom: number }
100
+
101
+ /** A connection being made or checked */
102
+ export interface FlowConnection {
103
+ source: string
104
+ sourceHandle: string | null
105
+ target: string
106
+ targetHandle: string | null
107
+ }
108
+
109
+ export interface FlowSelection { nodes: string[]; 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
+
121
+ export interface FlowFitOptions {
122
+ /** Room around the nodes, a fraction of the view (default 0.1) */
123
+ padding?: number
124
+ /** Only these nodes */
125
+ nodes?: string[]
126
+ maxZoom?: number
127
+ minZoom?: number
128
+ /** Default true */
129
+ animate?: boolean
130
+ }
131
+
132
+ /** What MFlow provides to everything inside it, and `useFlow()` returns */
133
+ export interface FlowContext {
134
+ nodes: ComputedRef<FlowNode[]>
135
+ edges: ComputedRef<FlowEdge[]>
136
+ viewport: Readonly<Ref<FlowViewport>>
137
+ selection: ComputedRef<FlowSelection>
138
+ minZoom: ComputedRef<number>
139
+ maxZoom: ComputedRef<number>
140
+ /** Canvas size in px */
141
+ size: Readonly<Ref<{ width: number; height: number }>>
142
+ /** Interaction switched off by the lock button (or MFlow's `locked`) */
143
+ locked: Ref<boolean>
144
+ getNode(id: string): FlowNode | undefined
145
+ /** A node's top left corner in flow coordinates, its parents added, where it's drawn right now */
146
+ getAbsolutePosition(id: string): FlowXY
147
+ /** A node's measured (or set) size */
148
+ getSize(id: string): { width: number; height: number }
149
+ /** Nodes overlapping this one (or a rectangle in flow coordinates), groups and its own family left out */
150
+ getIntersectingNodes(node: string | { x: number; y: number; width: number; height: number }): FlowNode[]
151
+ /** Page (client) coordinates → flow coordinates */
152
+ screenToFlow(p: { x: number; y: number }): FlowXY
153
+ flowToScreen(p: FlowXY): { x: number; y: number }
154
+ setViewport(v: Partial<FlowViewport>, opts?: { animate?: boolean }): void
155
+ fitView(opts?: FlowFitOptions): void
156
+ /** Centers the view on a flow point, at `zoom` or the current zoom */
157
+ setCenter(x: number, y: number, opts?: { zoom?: number; animate?: boolean }): void
158
+ zoomIn(): void
159
+ zoomOut(): void
160
+ zoomTo(zoom: number, opts?: { animate?: boolean }): void
161
+ addNodes(nodes: FlowNode | FlowNode[]): void
162
+ addEdges(edges: FlowEdge | FlowEdge[]): void
163
+ updateNode(id: string, patch: Partial<FlowNode> | ((n: FlowNode) => FlowNode)): void
164
+ updateEdge(id: string, patch: Partial<FlowEdge> | ((e: FlowEdge) => FlowEdge)): void
165
+ /** Deletes nodes (with their edges and children) and edges by id */
166
+ remove(ids: { nodes?: string[]; edges?: string[] }): void
167
+ setSelection(sel: Partial<FlowSelection>): void
168
+ /** Runs a layout over the nodes' measured sizes; default MFlow's `layout` (or the tree layout). Animated and undoable */
169
+ layout(fn?: 'tree' | 'layered' | FlowLayout, options?: FlowLayoutOptions): Promise<void>
170
+ undo(): void
171
+ redo(): void
172
+ canUndo: ComputedRef<boolean>
173
+ canRedo: ComputedRef<boolean>
174
+ copy(): void
175
+ cut(): void
176
+ /** Pastes what was copied, at a flow point (default a step from the originals) */
177
+ paste(at?: FlowXY): void
178
+ /**
179
+ * Drags a node with a pointer that's already down, e.g. one just added from a palette outside the canvas: it
180
+ * follows the pointer from there (guides, splicing into an edge) until it's let go. With a finger, the page
181
+ * doesn't scroll under it meanwhile (start the drag from a long press, so a swipe still scrolls your palette)
182
+ */
183
+ startDrag(id: string, e: PointerEvent): void
184
+ }
185
+
186
+ // Internal: what nodes and handles inside MFlow reach
187
+ export interface FlowInternals extends FlowContext {
188
+ registerHandle(nodeId: string, el: HTMLElement, info: () => Omit<FlowHandleBounds, 'x' | 'y'>): () => void
189
+ measureNode(nodeId: string): void
190
+ startConnection(e: PointerEvent, nodeId: string, handleId: string | null, type: 'source' | 'target'): void
191
+ /** The handle a connection being dragged would snap to (`nodeId:handleId:type`), and whether it's valid */
192
+ connectionTarget: Readonly<Ref<{ key: string; valid: boolean } | null>>
193
+ connecting: Readonly<Ref<boolean>>
194
+ /** The edge a dragged node would splice into if dropped now */
195
+ insertEdge: Readonly<Ref<string | null>>
196
+ /** Dragging an edge draws a branch from its source (edgeBranching) */
197
+ branching: ComputedRef<boolean>
198
+ nodesConnectable: ComputedRef<boolean>
199
+ direction: ComputedRef<'horizontal' | 'vertical'>
200
+ registerNodeEl(id: string, el: HTMLElement | null): void
201
+ selectedNodes: ComputedRef<Set<string>>
202
+ selectedEdges: ComputedRef<Set<string>>
203
+ dragging: Readonly<Ref<Set<string>>>
204
+ isLifted(id: string): boolean
205
+ zIndexOf(id: string): number
206
+ edgeGeometry(e: FlowEdge): FlowEdgeGeometry | null
207
+ isReconnectable(e: FlowEdge): boolean
208
+ sidePositions(n: FlowNode): { source: FlowPosition; target: FlowPosition }
209
+ onNodeKey(e: KeyboardEvent, id: string): void
210
+ onEdgeKey(e: KeyboardEvent, id: string): void
211
+ }
212
+
213
+ // Internal: an edge's ends and path
214
+ export interface FlowEdgeGeometry extends FlowEdgePath {
215
+ sourceX: number
216
+ sourceY: number
217
+ targetX: number
218
+ targetY: number
219
+ sourcePosition: FlowPosition
220
+ targetPosition: FlowPosition
221
+ /** How far the end sits inside a handle (0 at a node's side) */
222
+ sourceInset: number
223
+ targetInset: number
224
+ }
225
+
226
+ export const FLOW_KEY: InjectionKey<FlowInternals> = Symbol('m3-flow')
227
+
228
+ // Internal: provided by each node's shell to the node (and its handles) inside
229
+ export interface FlowNodeState {
230
+ id: string
231
+ node: ComputedRef<FlowNode>
232
+ selected: ComputedRef<boolean>
233
+ dragging: ComputedRef<boolean>
234
+ }
235
+ export const FLOW_NODE_KEY: InjectionKey<FlowNodeState> = Symbol('m3-flow-node')
236
+
237
+ /**
238
+ * The enclosing `<MFlow>`'s state and controls, from any component rendered inside it (a `#node-<type>` slot, a
239
+ * panel of your own). Outside one, use MFlow's template ref, which exposes the same.
240
+ */
241
+ export function useFlow(): FlowContext {
242
+ const ctx = inject(FLOW_KEY, null)
243
+ if (!ctx) throw new Error('useFlow() must be called inside <MFlow>')
244
+ return ctx
245
+ }
246
+
247
+ /** The node a component is rendered in (inside a `#node-<type>` slot), or null */
248
+ export function useFlowNode() {
249
+ return inject(FLOW_NODE_KEY, null)
250
+ }
@@ -0,0 +1,92 @@
1
+ import { inject, type ComputedRef, type InjectionKey, type Ref } from 'vue'
2
+ import type { GanttCriticalPath, GanttDependency, GanttScheduleOptions, GanttTask } from './ganttSchedule'
3
+ import type { TimeUnit } from './_ganttTime'
4
+
5
+ /** MGantt's named zoom levels */
6
+ export type GanttScale = TimeUnit
7
+
8
+ /** A column of MGantt's task list */
9
+ export interface GanttColumn {
10
+ /** `name`, `start`, `end`, `duration` and `progress` are built in; anything else reads `task.data[key]` (or the slot `#cell-<key>`) */
11
+ key: string
12
+ label?: string
13
+ /** px; the `name` column takes what's left when it has none */
14
+ width?: number
15
+ align?: 'start' | 'center' | 'end'
16
+ /** Text for a cell */
17
+ format?: (task: GanttTask) => string
18
+ }
19
+
20
+ /** What MGantt provides to everything inside it (MGanttControls, panels of yours), and its template ref exposes */
21
+ export interface GanttContext {
22
+ /** The tasks as drawn: summaries rolled up from their children */
23
+ tasks: ComputedRef<GanttTask[]>
24
+ selection: ComputedRef<string[]>
25
+ /** The closest named scale to the zoom */
26
+ scale: ComputedRef<GanttScale>
27
+ /** The zoom, in px per day */
28
+ pxPerDay: Readonly<Ref<number>>
29
+ readonly: ComputedRef<boolean>
30
+ canUndo: ComputedRef<boolean>
31
+ canRedo: ComputedRef<boolean>
32
+ /** Every task id whose children are hidden */
33
+ collapsed: ComputedRef<string[]>
34
+ undo(): void
35
+ redo(): void
36
+ zoomIn(): void
37
+ zoomOut(): void
38
+ setScale(scale: GanttScale): void
39
+ /** Scrolls so a date (default now) sits at the view's `align` (default center) */
40
+ scrollToDate(date?: string, opts?: { align?: 'start' | 'center'; animate?: boolean }): 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?: { after?: string }): void
49
+ updateTask(id: string, patch: Partial<GanttTask> | ((t: GanttTask) => GanttTask)): void
50
+ /** Deletes tasks with their children and the dependencies on them */
51
+ removeTasks(ids: string[]): void
52
+ /** Makes `to` depend on `from` */
53
+ link(from: string, to: string, type?: GanttDependency['type'], lag?: number): void
54
+ unlink(from: string, to: string): void
55
+ /** Runs `scheduleTasks` over the tasks with MGantt's calendar; undoable */
56
+ schedule(options?: GanttScheduleOptions): void
57
+ criticalPath: ComputedRef<GanttCriticalPath>
58
+ /** The date (snapped) under a page x */
59
+ dateAt(clientX: number): string
60
+ }
61
+
62
+ export const GANTT_KEY: InjectionKey<GanttContext> = Symbol('m3-gantt')
63
+
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 const TIMELINE_CONTROLS_KEY: InjectionKey<TimelineControls> = Symbol('m3-timeline-controls')
83
+
84
+ /**
85
+ * The enclosing `<MGantt>`'s state and controls, from a component rendered in its default slot. Outside one, use
86
+ * MGantt's template ref, which exposes the same.
87
+ */
88
+ export function useGantt(): GanttContext {
89
+ const ctx = inject(GANTT_KEY, null)
90
+ if (!ctx) throw new Error('useGantt() must be called inside <MGantt>')
91
+ return ctx
92
+ }
@@ -238,6 +238,171 @@ export interface M3Locale {
238
238
  /** MTimeline's button past `limit`; `{count}` is how many entries are hidden */
239
239
  timelineShowMore: string
240
240
  timelineShowLess: string
241
+ // Media players (MVideoPlayer, MAudioPlayer); `{seconds}` is the skip length
242
+ mediaPlayer: string
243
+ mediaPlay: string
244
+ mediaPause: string
245
+ mediaReplay: string
246
+ mediaSeekBack: string
247
+ mediaSeekForward: string
248
+ mediaSeconds: string
249
+ mediaMute: string
250
+ mediaUnmute: string
251
+ mediaVolume: string
252
+ mediaFullscreen: string
253
+ mediaExitFullscreen: string
254
+ mediaPictureInPicture: string
255
+ mediaSettings: string
256
+ mediaSpeed: string
257
+ mediaSpeedNormal: string
258
+ mediaSubtitles: string
259
+ mediaSubtitlesOff: string
260
+ mediaQuality: string
261
+ mediaQualityAuto: string
262
+ mediaLive: string
263
+ mediaError: string
264
+ mediaRepeat: string
265
+ mediaRepeatOne: string
266
+ mediaShuffle: string
267
+ // MPdfViewer; `{current}`/`{total}` count search matches
268
+ pdfViewer: string
269
+ pdfThumbnails: string
270
+ pdfOutline: string
271
+ pdfPage: string
272
+ pdfZoom: string
273
+ pdfZoomIn: string
274
+ pdfZoomOut: string
275
+ pdfFitWidth: string
276
+ pdfFitPage: string
277
+ pdfSearch: string
278
+ pdfSearchPrevious: string
279
+ pdfSearchNext: string
280
+ pdfMatchCount: string
281
+ pdfNoMatches: string
282
+ pdfMore: string
283
+ pdfRotate: string
284
+ pdfDownload: string
285
+ pdfPrint: string
286
+ pdfFullscreen: string
287
+ pdfExitFullscreen: string
288
+ pdfPassword: string
289
+ pdfPasswordLabel: string
290
+ pdfWrongPassword: string
291
+ pdfOpen: string
292
+ pdfError: string
293
+ pdfLoading: string
294
+ pdfAnnotate: string
295
+ pdfSelect: string
296
+ pdfHighlight: string
297
+ pdfNote: string
298
+ pdfDraw: string
299
+ pdfEraser: string
300
+ pdfInkWidth: string
301
+ pdfColor: string
302
+ pdfUndo: string
303
+ pdfCopy: string
304
+ pdfDelete: string
305
+ pdfNotePlaceholder: string
306
+ pdfAddComment: string
307
+ flowCanvas: string
308
+ flowNode: string
309
+ flowEdge: string
310
+ flowZoomIn: string
311
+ flowZoomOut: string
312
+ flowFitView: string
313
+ flowLock: string
314
+ flowUnlock: string
315
+ flowUndo: string
316
+ flowRedo: string
317
+ flowMinimap: string
318
+ flowMoved: string
319
+ flowConnected: string
320
+ flowDeleted: string
321
+ flowDeleteEdge: string
322
+ flowDelete: string
323
+ ganttChart: string
324
+ ganttTask: string
325
+ ganttStart: string
326
+ ganttEnd: string
327
+ ganttDuration: string
328
+ ganttProgress: string
329
+ ganttDays: string
330
+ ganttHours: string
331
+ ganttMilestone: string
332
+ ganttQuarter: string
333
+ ganttToday: string
334
+ ganttZoomIn: string
335
+ ganttZoomOut: string
336
+ ganttExpandAll: string
337
+ ganttCollapseAll: string
338
+ ganttExpand: string
339
+ ganttCollapse: string
340
+ ganttUndo: string
341
+ ganttRedo: string
342
+ ganttScaleHour: string
343
+ ganttScaleDay: string
344
+ ganttScaleWeek: string
345
+ ganttScaleMonth: string
346
+ ganttScaleQuarter: string
347
+ ganttScaleYear: string
348
+ ganttMoved: string
349
+ ganttProgressSet: string
350
+ ganttLinked: string
351
+ ganttUnlink: string
352
+ ganttDeleted: string
353
+ ganttDelete: string
354
+ ganttReordered: string
355
+ ganttSlack: string
356
+ ganttCritical: string
357
+ ganttBaseline: string
358
+ ganttEmpty: string
359
+ ganttResize: string
360
+ timelineResource: string
361
+ timelineConflict: string
362
+ timelineMoved: string
363
+ timelineEmpty: string
364
+ cropArea: string
365
+ cropRotateLeft: string
366
+ cropRotateRight: string
367
+ cropFlip: string
368
+ cropReset: string
369
+ cropFree: string
370
+ drawCanvas: string
371
+ drawTools: string
372
+ drawMore: string
373
+ drawSelect: string
374
+ drawPan: string
375
+ drawPen: string
376
+ drawBrush: string
377
+ drawMarker: string
378
+ drawHighlighter: string
379
+ drawEraser: string
380
+ drawStrokeEraser: string
381
+ drawLine: string
382
+ drawArrow: string
383
+ drawRect: string
384
+ drawEllipse: string
385
+ drawText: string
386
+ drawFill: string
387
+ drawColor: string
388
+ floorPlan: string
389
+ floorSeats: string
390
+ drawCustomColor: string
391
+ drawSize: string
392
+ drawUndo: string
393
+ drawRedo: string
394
+ drawDelete: string
395
+ drawLayers: string
396
+ drawLayer: string
397
+ drawLayerName: string
398
+ drawAddLayer: string
399
+ drawDeleteLayer: string
400
+ drawShowLayer: string
401
+ drawHideLayer: string
402
+ drawLockLayer: string
403
+ drawUnlockLayer: string
404
+ drawLayerUp: string
405
+ drawLayerDown: string
241
406
  }
242
407
 
243
408
  export const defaultLocale: M3Locale = {
@@ -456,6 +621,169 @@ export const defaultLocale: M3Locale = {
456
621
  mapSearchPlaces: 'Search places',
457
622
  timelineShowMore: 'Show {count} more',
458
623
  timelineShowLess: 'Show less',
624
+ mediaPlayer: 'Media player',
625
+ mediaPlay: 'Play',
626
+ mediaPause: 'Pause',
627
+ mediaReplay: 'Replay',
628
+ mediaSeekBack: 'Back {seconds} seconds',
629
+ mediaSeekForward: 'Forward {seconds} seconds',
630
+ mediaSeconds: '{seconds} seconds',
631
+ mediaMute: 'Mute',
632
+ mediaUnmute: 'Unmute',
633
+ mediaVolume: 'Volume',
634
+ mediaFullscreen: 'Full screen',
635
+ mediaExitFullscreen: 'Exit full screen',
636
+ mediaPictureInPicture: 'Picture-in-picture',
637
+ mediaSettings: 'Settings',
638
+ mediaSpeed: 'Playback speed',
639
+ mediaSpeedNormal: 'Normal',
640
+ mediaSubtitles: 'Subtitles',
641
+ mediaSubtitlesOff: 'Off',
642
+ mediaQuality: 'Quality',
643
+ mediaQualityAuto: 'Auto',
644
+ mediaLive: 'Live',
645
+ mediaError: 'This media can\'t be played',
646
+ mediaRepeat: 'Repeat',
647
+ mediaRepeatOne: 'Repeat one',
648
+ mediaShuffle: 'Shuffle',
649
+ pdfViewer: 'PDF viewer',
650
+ pdfThumbnails: 'Pages',
651
+ pdfOutline: 'Contents',
652
+ pdfPage: 'Page',
653
+ pdfZoom: 'Zoom',
654
+ pdfZoomIn: 'Zoom in',
655
+ pdfZoomOut: 'Zoom out',
656
+ pdfFitWidth: 'Fit to width',
657
+ pdfFitPage: 'Fit page',
658
+ pdfSearch: 'Find in document',
659
+ pdfSearchPrevious: 'Previous match',
660
+ pdfSearchNext: 'Next match',
661
+ pdfMatchCount: '{current} of {total}',
662
+ pdfNoMatches: 'No matches',
663
+ pdfMore: 'More options',
664
+ pdfRotate: 'Rotate',
665
+ pdfDownload: 'Download',
666
+ pdfPrint: 'Print',
667
+ pdfFullscreen: 'Full screen',
668
+ pdfExitFullscreen: 'Exit full screen',
669
+ pdfPassword: 'This document is password protected',
670
+ pdfPasswordLabel: 'Password',
671
+ pdfWrongPassword: 'Wrong password',
672
+ pdfOpen: 'Open',
673
+ pdfError: 'This PDF can\'t be opened',
674
+ pdfLoading: 'Loading document',
675
+ pdfAnnotate: 'Annotate',
676
+ pdfSelect: 'Select',
677
+ pdfHighlight: 'Highlight',
678
+ pdfNote: 'Note',
679
+ pdfDraw: 'Draw',
680
+ pdfEraser: 'Eraser',
681
+ pdfInkWidth: 'Line width {n} pt',
682
+ pdfColor: 'Color',
683
+ pdfUndo: 'Undo',
684
+ pdfCopy: 'Copy',
685
+ pdfDelete: 'Delete',
686
+ pdfNotePlaceholder: 'Write a note',
687
+ pdfAddComment: 'Add a comment',
688
+ flowCanvas: 'Diagram',
689
+ flowNode: 'node',
690
+ flowEdge: 'Connection from {source} to {target}',
691
+ flowZoomIn: 'Zoom in',
692
+ flowZoomOut: 'Zoom out',
693
+ flowFitView: 'Fit view',
694
+ flowLock: 'Lock',
695
+ flowUnlock: 'Unlock',
696
+ flowUndo: 'Undo',
697
+ flowRedo: 'Redo',
698
+ flowMinimap: 'Mini map',
699
+ flowMoved: '{label} moved',
700
+ flowConnected: 'Connected {source} to {target}',
701
+ flowDeleted: '{count} deleted',
702
+ flowDeleteEdge: 'Delete connection',
703
+ flowDelete: 'Delete',
704
+ ganttChart: 'Gantt chart',
705
+ ganttTask: 'Task',
706
+ ganttStart: 'Start',
707
+ ganttEnd: 'End',
708
+ ganttDuration: 'Duration',
709
+ ganttProgress: 'Progress',
710
+ ganttDays: '{n} d',
711
+ ganttHours: '{n} h',
712
+ ganttMilestone: 'Milestone',
713
+ ganttQuarter: 'Q{n}',
714
+ ganttToday: 'Today',
715
+ ganttZoomIn: 'Zoom in',
716
+ ganttZoomOut: 'Zoom out',
717
+ ganttExpandAll: 'Expand all',
718
+ ganttCollapseAll: 'Collapse all',
719
+ ganttExpand: 'Expand',
720
+ ganttCollapse: 'Collapse',
721
+ ganttUndo: 'Undo',
722
+ ganttRedo: 'Redo',
723
+ ganttScaleHour: 'Hours',
724
+ ganttScaleDay: 'Days',
725
+ ganttScaleWeek: 'Weeks',
726
+ ganttScaleMonth: 'Months',
727
+ ganttScaleQuarter: 'Quarters',
728
+ ganttScaleYear: 'Years',
729
+ ganttMoved: '{name}: {start} to {end}',
730
+ ganttProgressSet: '{name}: {progress}% done',
731
+ ganttLinked: '{from} linked to {to}',
732
+ ganttUnlink: 'Remove dependency',
733
+ ganttDeleted: '{count} deleted',
734
+ ganttDelete: 'Delete',
735
+ ganttReordered: '{name} moved to row {pos}',
736
+ ganttSlack: 'Slack: {n} d',
737
+ ganttCritical: 'Critical',
738
+ ganttBaseline: 'Baseline',
739
+ ganttEmpty: 'No tasks yet',
740
+ ganttResize: 'Resize the task list',
741
+ timelineResource: 'Resource',
742
+ timelineConflict: 'Overlaps another booking',
743
+ timelineMoved: '{title}: {resource}, {start} to {end}',
744
+ timelineEmpty: 'No resources',
745
+ cropArea: 'Crop area',
746
+ cropRotateLeft: 'Rotate left',
747
+ cropRotateRight: 'Rotate right',
748
+ cropFlip: 'Flip horizontally',
749
+ cropReset: 'Reset',
750
+ cropFree: 'Free',
751
+ drawCanvas: 'Drawing canvas',
752
+ drawTools: 'Drawing tools',
753
+ drawMore: 'More tools',
754
+ drawSelect: 'Select',
755
+ drawPan: 'Pan',
756
+ drawPen: 'Pen',
757
+ drawBrush: 'Brush',
758
+ drawMarker: 'Marker',
759
+ drawHighlighter: 'Highlighter',
760
+ drawEraser: 'Eraser',
761
+ drawStrokeEraser: 'Stroke eraser',
762
+ drawLine: 'Line',
763
+ drawArrow: 'Arrow',
764
+ drawRect: 'Rectangle',
765
+ drawEllipse: 'Ellipse',
766
+ drawText: 'Text',
767
+ drawFill: 'Fill',
768
+ drawColor: 'Color',
769
+ floorPlan: 'Floor plan',
770
+ floorSeats: '{n} seats',
771
+ drawCustomColor: 'Custom color',
772
+ drawSize: 'Size',
773
+ drawUndo: 'Undo',
774
+ drawRedo: 'Redo',
775
+ drawDelete: 'Delete selection',
776
+ drawLayers: 'Layers',
777
+ drawLayer: 'Layer {n}',
778
+ drawLayerName: 'Layer name',
779
+ drawAddLayer: 'Add layer',
780
+ drawDeleteLayer: 'Delete layer',
781
+ drawShowLayer: 'Show layer',
782
+ drawHideLayer: 'Hide layer',
783
+ drawLockLayer: 'Lock layer',
784
+ drawUnlockLayer: 'Unlock layer',
785
+ drawLayerUp: 'Move layer up',
786
+ drawLayerDown: 'Move layer down',
459
787
  }
460
788
 
461
789
  export const M3_LOCALE_KEY: InjectionKey<MaybeRef<Partial<M3Locale>>> = Symbol('m3-locale')