@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,90 @@
1
+ import { type ComputedRef, type Ref } from 'vue';
2
+ import { type TimeUnit } from './_ganttTime';
3
+ export interface TimeAxisOptions {
4
+ scroller: Ref<HTMLElement | undefined>;
5
+ listWidth: ComputedRef<number>;
6
+ headerHeight: number;
7
+ /** Earliest and latest ms the content spans */
8
+ extent: ComputedRef<{
9
+ min: number;
10
+ max: number;
11
+ }>;
12
+ scale: () => TimeUnit;
13
+ pxPerDay: () => number | undefined;
14
+ minPxPerDay: () => number;
15
+ maxPxPerDay: () => number;
16
+ weekStartsOn: () => 0 | 1;
17
+ lang: ComputedRef<string | undefined>;
18
+ quarterLabel: () => string;
19
+ today: () => string | null | undefined;
20
+ calendar: () => {
21
+ workingDays?: number[];
22
+ holidays?: string[];
23
+ } | undefined;
24
+ /** Working hours shaded as such on hour scales, e.g. [9, 18] */
25
+ workHours?: () => [number, number] | undefined;
26
+ onScale: (s: TimeUnit) => void;
27
+ /** A pinch began: drop whatever drag was going on */
28
+ onPinch?: () => void;
29
+ }
30
+ export declare function useTimeAxis(o: TimeAxisOptions): {
31
+ ppd: Ref<number, number>;
32
+ scaleNow: ComputedRef<TimeUnit>;
33
+ view: Ref<{
34
+ left: number;
35
+ top: number;
36
+ width: number;
37
+ height: number;
38
+ }, {
39
+ left: number;
40
+ top: number;
41
+ width: number;
42
+ height: number;
43
+ } | {
44
+ left: number;
45
+ top: number;
46
+ width: number;
47
+ height: number;
48
+ }>;
49
+ timelineView: ComputedRef<number>;
50
+ origin: Ref<number, number>;
51
+ timelineWidth: ComputedRef<number>;
52
+ todayMs: ComputedRef<number | null>;
53
+ xOf: (ms: number) => number;
54
+ timeAt: (x: number) => number;
55
+ zoomTo: (target: number, anchor?: number, animate?: boolean) => void;
56
+ zoomIn: () => void;
57
+ zoomOut: () => void;
58
+ setScale: (s: TimeUnit) => void;
59
+ scrollToDate: (date?: string, opts?: {
60
+ align?: "start" | "center";
61
+ animate?: boolean;
62
+ }) => void;
63
+ units: ComputedRef<{
64
+ bottom: TimeUnit;
65
+ top: TimeUnit | null;
66
+ step: number;
67
+ }>;
68
+ topCells: ComputedRef<{
69
+ labelX: number;
70
+ key: number;
71
+ x: number;
72
+ w: number;
73
+ label: string;
74
+ }[]>;
75
+ bottomCells: ComputedRef<{
76
+ key: number;
77
+ x: number;
78
+ w: number;
79
+ label: string;
80
+ }[]>;
81
+ offTimes: ComputedRef<{
82
+ x: number;
83
+ w: number;
84
+ }[]>;
85
+ onTouchStart: (e: TouchEvent) => void;
86
+ pinchMove: (e: TouchEvent) => boolean;
87
+ onTouchEnd: (e: TouchEvent) => void;
88
+ pinching: () => boolean;
89
+ readView: () => void;
90
+ };
@@ -0,0 +1,119 @@
1
+ /** A point of a stroke: x, y, and the pressure (0–1) */
2
+ export type DrawPoint = [x: number, y: number, pressure: number];
3
+ export type DrawPen = 'pen' | 'brush' | 'marker' | 'highlighter';
4
+ export type DrawShapeKind = 'line' | 'arrow' | 'rect' | 'ellipse';
5
+ interface DrawItemBase {
6
+ id: string;
7
+ /** The layer it's on (`undefined`: the first one) */
8
+ layer?: string;
9
+ /** The page it's on, in `mode="pages"` (its coordinates are then relative to that page) */
10
+ page?: number;
11
+ color: string;
12
+ }
13
+ export interface DrawStroke extends DrawItemBase {
14
+ type: 'stroke';
15
+ pen: DrawPen;
16
+ /** Width at full pressure, in drawing units */
17
+ size: number;
18
+ points: DrawPoint[];
19
+ }
20
+ export interface DrawShape extends DrawItemBase {
21
+ type: 'shape';
22
+ shape: DrawShapeKind;
23
+ from: [number, number];
24
+ to: [number, number];
25
+ size: number;
26
+ /** Fill of a rect or an ellipse (`null`/absent: none) */
27
+ fill?: string | null;
28
+ }
29
+ export interface DrawText extends DrawItemBase {
30
+ type: 'text';
31
+ /** Top-left corner */
32
+ at: [number, number];
33
+ text: string;
34
+ /** Font size */
35
+ size: number;
36
+ }
37
+ export type DrawItem = DrawStroke | DrawShape | DrawText;
38
+ export interface DrawLayer {
39
+ id: string;
40
+ name: string;
41
+ visible?: boolean;
42
+ locked?: boolean;
43
+ }
44
+ export interface DrawBox {
45
+ x: number;
46
+ y: number;
47
+ width: number;
48
+ height: number;
49
+ }
50
+ export declare const drawId: () => string;
51
+ /** How each pen behaves: how much pressure thins it, how much its ends taper, how opaque it is */
52
+ export declare const PENS: Record<DrawPen, {
53
+ thinning: number;
54
+ taper: number;
55
+ opacity: number;
56
+ }>;
57
+ /**
58
+ * Smooths raw input points: each one moves part of the way toward the next sample (`smoothing` 0 keeps them as they
59
+ * are, 1 follows lazily), and points closer than a fraction of the size are merged. Pressure is kept.
60
+ */
61
+ export declare function smoothPoints(points: DrawPoint[], smoothing?: number, size?: number): DrawPoint[];
62
+ /** Pressure made up from speed, for a mouse or a finger: slow is heavy, fast is light */
63
+ export declare function simulatePressure(points: DrawPoint[], size: number): DrawPoint[];
64
+ /** A stroke as the SVG path of its filled outline (round caps, its width following pressure) */
65
+ export declare function strokePath(s: Pick<DrawStroke, 'points' | 'size' | 'pen'>): string;
66
+ /** A shape's outline as an SVG path (stroked), plus an arrow's head (filled) */
67
+ export declare function shapePath(s: Pick<DrawShape, 'shape' | 'from' | 'to' | 'size'>): {
68
+ d: string;
69
+ head?: string;
70
+ };
71
+ /** Holding Shift: lines snap to 45°, rects and ellipses become squares and circles */
72
+ export declare function constrain(kind: DrawShapeKind, from: [number, number], to: [number, number]): [number, number];
73
+ export declare const LINE_HEIGHT = 1.25;
74
+ /** A text's box, estimated from its characters (good enough to hit and select it) */
75
+ export declare function textBox(t: Pick<DrawText, 'at' | 'text' | 'size'>): DrawBox;
76
+ /** An item's bounds */
77
+ export declare function itemBox(item: DrawItem): DrawBox;
78
+ export declare function unionBox(boxes: DrawBox[]): DrawBox | null;
79
+ /** Whether a point (with a tolerance) touches an item */
80
+ export declare function hitItem(item: DrawItem, x: number, y: number, tolerance?: number): boolean;
81
+ /**
82
+ * The stroke-cutting eraser: the parts of a stroke within `r` of (x, y) go, what's left splits into separate
83
+ * strokes. Returns the item unchanged when it isn't touched, `[]` when it's all gone. Shapes and text go whole.
84
+ */
85
+ export declare function eraseAt(item: DrawItem, x: number, y: number, r: number): DrawItem[];
86
+ /** Whether a lasso (a closed polygon) takes an item: most of its points inside */
87
+ export declare function inLasso(item: DrawItem, poly: [number, number][]): boolean;
88
+ /** An item moved by (dx, dy) and scaled by (sx, sy) around (ox, oy) */
89
+ export declare function transformItem(item: DrawItem, t: {
90
+ dx?: number;
91
+ dy?: number;
92
+ sx?: number;
93
+ sy?: number;
94
+ ox?: number;
95
+ oy?: number;
96
+ }): DrawItem;
97
+ /** One item as SVG markup */
98
+ export declare function itemSvg(item: DrawItem, fontFamily?: string): string;
99
+ export interface DrawSvgOptions {
100
+ /** The area to export (default: the items' bounds plus `padding`) */
101
+ box?: DrawBox;
102
+ padding?: number;
103
+ /** A background fill (default: none, transparent) */
104
+ background?: string;
105
+ /** Only the items of this page */
106
+ page?: number;
107
+ /** Leave out these layers (hidden ones, say) */
108
+ hiddenLayers?: string[];
109
+ /** The layers' order, bottom first (items of other layers go first) */
110
+ layers?: string[];
111
+ fontFamily?: string;
112
+ }
113
+ /** Items in drawing order: by layer, then as they come */
114
+ export declare function sortByLayer(items: DrawItem[], layers?: string[]): DrawItem[];
115
+ /** A drawing (or one page of it) as a standalone SVG document */
116
+ export declare function toDrawSvg(items: DrawItem[], opts?: DrawSvgOptions): string;
117
+ /** An SVG document rendered to a PNG blob (in a browser), `scale` times its size */
118
+ export declare function svgToPng(svg: string, scale?: number): Promise<Blob>;
119
+ export {};
@@ -0,0 +1,79 @@
1
+ import type { FlowEdge, FlowNode } from './useFlow';
2
+ import { type FlowLayoutDirection, type FlowLayoutOptions } from './flowLayout';
3
+ /** A graph read from text */
4
+ export interface FlowGraph {
5
+ nodes: FlowNode[];
6
+ edges: FlowEdge[];
7
+ /** The graph's own direction (DOT `rankdir`, Mermaid `flowchart LR`) */
8
+ rankdir: FlowLayoutDirection;
9
+ /** The same, as MFlow's `direction` prop */
10
+ direction: 'horizontal' | 'vertical';
11
+ /** False for a DOT `graph` (edges without arrows) */
12
+ directed: boolean;
13
+ /** The DOT graph's name */
14
+ name?: string;
15
+ /** The DOT graph's `label` */
16
+ label?: string;
17
+ /** Every graph-level DOT attribute, as written */
18
+ attrs: Record<string, string>;
19
+ }
20
+ export interface FlowImportOptions {
21
+ /** How to place the nodes: `'layered'` (default), `'tree'`, or `false` to leave them at 0,0 (for MFlow's `layout` prop, which measures them first) */
22
+ layout?: 'layered' | 'tree' | false;
23
+ /** Gaps, sizes and direction for the layout (the direction defaults to the graph's own) */
24
+ layoutOptions?: FlowLayoutOptions;
25
+ /** The type given to plain nodes (default none: MFlow's default node) */
26
+ nodeType?: string;
27
+ /** The type given to every edge (e.g. `'smoothstep'`; default none: a bezier) */
28
+ edgeType?: string;
29
+ }
30
+ export interface FlowExportOptions {
31
+ /** The direction written (`rankdir` / `flowchart XX`): a layout direction or MFlow's `direction` (default TB) */
32
+ direction?: FlowLayoutDirection | 'horizontal' | 'vertical';
33
+ /** Node sizes, for `positions` (default each node's `width`/`height`, else 180 × 60) */
34
+ sizes?: Map<string, {
35
+ width: number;
36
+ height: number;
37
+ }> | Record<string, {
38
+ width: number;
39
+ height: number;
40
+ }>;
41
+ }
42
+ export interface FlowDotExportOptions extends FlowExportOptions {
43
+ /** The graph's name */
44
+ name?: string;
45
+ /** `digraph` (default) or `graph`, whose edges have no direction */
46
+ directed?: boolean;
47
+ /** Writes each node's place as `pos` (in points, y up), for `neato -n` */
48
+ positions?: boolean;
49
+ }
50
+ /**
51
+ * Reads a Graphviz DOT graph (`digraph`/`graph`, `strict`, subgraphs, defaults, ports, HTML labels): nodes take
52
+ * their `label` (default the id), `shape=circle`/`doublecircle`/`point` makes a `circle` node, `style=invis` hides;
53
+ * edges take `label`, `color`, `penwidth`, `style=dashed`/`dotted`/`bold`/`invis` and `dir`/`arrowhead`/`arrowtail`;
54
+ * `cluster` subgraphs become groups. Every attribute as written is kept in each node's and edge's `data.attrs`
55
+ * (ports as `tailport`/`headport`), to map the rest yourself. Laid out in layers along `rankdir`, unless every node
56
+ * has a `pos`. Throws a SyntaxError (with line and column) on what isn't DOT.
57
+ */
58
+ export declare function parseDot(source: string, options?: FlowImportOptions): FlowGraph;
59
+ /**
60
+ * Writes nodes and edges as a Graphviz DOT graph: labels, `circle` nodes as `shape=circle` (`doublecircle` with a
61
+ * ring), groups as `cluster` subgraphs, edge labels, colors (CSS ones; M3 roles are left out), widths, dashes,
62
+ * arrows and hidden ones. Attributes kept in `data.attrs` (as `parseDot` leaves them) are written back too.
63
+ */
64
+ export declare function toDot(nodes: FlowNode[], edges: FlowEdge[], options?: FlowDotExportOptions): string;
65
+ /**
66
+ * Reads a Mermaid flowchart (`flowchart`/`graph` with TB/TD/BT/LR/RL): node shapes (`(( ))` makes a `circle` node,
67
+ * `((( )))` one with a ring; every other shape is kept as `data.shape`), the `@{ shape, label }` syntax, chains and
68
+ * `&`, links `-->` `---` `-.->` `==>` `~~~` `<-->` `--o` `--x` with `|labels|` or `-- labels -->`, and subgraphs as
69
+ * groups. `classDef`, `style`, `click` and the like are skipped. Laid out in layers along its direction. Throws a
70
+ * SyntaxError (with line and column) on what it can't read.
71
+ */
72
+ export declare function parseMermaid(source: string, options?: FlowImportOptions): FlowGraph;
73
+ /**
74
+ * Writes nodes and edges as a Mermaid flowchart: labels, `circle` nodes as `(( ))` (`((( )))` with a ring), the
75
+ * shape kept in `data.shape` (as `parseMermaid` leaves it), groups as subgraphs, and edges as `-->`, `---` (no
76
+ * arrow), `-.->` (dashed), `==>` (3px or wider), `~~~` (hidden) or `<-->`, with their labels. Ids Mermaid can't take
77
+ * are renamed (`n1`, `n2`…).
78
+ */
79
+ export declare function toMermaid(nodes: FlowNode[], edges: FlowEdge[], options?: FlowExportOptions): string;
@@ -0,0 +1,45 @@
1
+ import type { FlowEdge, FlowNode, FlowXY } from './useFlow';
2
+ export type FlowLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
3
+ export interface FlowLayoutOptions {
4
+ /** TB (top to bottom, the default for a vertical MFlow), BT, LR (default for a horizontal one) or RL */
5
+ direction?: FlowLayoutDirection;
6
+ /** Space between neighbors in a level, px (default 40) */
7
+ gap?: number;
8
+ /** Space between levels, px (default 80) */
9
+ levelGap?: number;
10
+ /** Node sizes; MFlow passes the measured ones */
11
+ sizes?: Map<string, {
12
+ width: number;
13
+ height: number;
14
+ }> | Record<string, {
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ /** Size of a node missing from `sizes` (default 180 × 60) */
19
+ defaultSize?: {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ }
24
+ /** Top left corners by node id */
25
+ export type FlowLayoutResult = Record<string, FlowXY>;
26
+ /** A layout: MFlow's `layout` prop and `layout()` take one */
27
+ export type FlowLayout = (nodes: FlowNode[], edges: FlowEdge[], options: FlowLayoutOptions & {
28
+ sizes: Map<string, {
29
+ width: number;
30
+ height: number;
31
+ }>;
32
+ direction: FlowLayoutDirection;
33
+ }) => FlowLayoutResult | Promise<FlowLayoutResult>;
34
+ /**
35
+ * A tidy tree: each parent centered over its children, every subtree side by side without overlapping, levels
36
+ * aligned. Roots are the nodes nothing points to (in the nodes' order); a child's place among its siblings
37
+ * follows the edges' order. Extra parents and cycles are ignored (a node goes under the first parent reached).
38
+ */
39
+ export declare function layoutTree(nodes: FlowNode[], edges: FlowEdge[], options?: FlowLayoutOptions): FlowLayoutResult;
40
+ /**
41
+ * A layered layout for directed graphs: every edge points one level onwards where it can (longest path from the
42
+ * sources), the order within a level reduces crossings (barycenter sweeps), and nodes line up with what they're
43
+ * connected to without overlapping. Edges that close a cycle are laid out as if reversed.
44
+ */
45
+ export declare function layoutLayered(nodes: FlowNode[], edges: FlowEdge[], options?: FlowLayoutOptions): FlowLayoutResult;
@@ -0,0 +1,53 @@
1
+ /** A side of a node: where a handle sits and the direction an edge leaves it in */
2
+ export type FlowPosition = 'top' | 'right' | 'bottom' | 'left';
3
+ export interface FlowEdgePathParams {
4
+ sourceX: number;
5
+ sourceY: number;
6
+ /** Default 'bottom' */
7
+ sourcePosition?: FlowPosition;
8
+ targetX: number;
9
+ targetY: number;
10
+ /** Default 'top' */
11
+ targetPosition?: FlowPosition;
12
+ }
13
+ export interface FlowEdgePath {
14
+ /** The SVG path (`d`) */
15
+ path: string;
16
+ /** Where the label goes: the path's middle */
17
+ labelX: number;
18
+ labelY: number;
19
+ /** The direction the path leaves the source in, in radians (0 = right, π/2 = down) */
20
+ sourceAngle: number;
21
+ /** The direction the path arrives at the target in, in radians: the way an arrowhead points */
22
+ targetAngle: number;
23
+ }
24
+ /** A straight line between the ends */
25
+ export declare function getStraightPath(p: FlowEdgePathParams): FlowEdgePath;
26
+ /** A cubic curve that leaves and arrives square to the nodes' sides. `curvature` (default 0.25) bends it more when the target is behind the source */
27
+ export declare function getBezierPath(p: FlowEdgePathParams & {
28
+ curvature?: number;
29
+ }): FlowEdgePath;
30
+ type Pt = [number, number];
31
+ /** The corners of an orthogonal route between the ends, leaving and arriving square to the sides */
32
+ export declare function smoothStepPoints(p: FlowEdgePathParams & {
33
+ offset?: number;
34
+ }): Pt[];
35
+ /** Right-angled steps with rounded corners (`borderRadius`, default 8; 0 gives sharp steps). `offset` (default 20) is how far it leaves a node before turning */
36
+ export declare function getSmoothStepPath(p: FlowEdgePathParams & {
37
+ borderRadius?: number;
38
+ offset?: number;
39
+ }): FlowEdgePath;
40
+ /**
41
+ * Points along an edge's path, close enough together to measure how far something is from it (bezier curves are
42
+ * sampled; step paths are their corners)
43
+ */
44
+ export declare function edgePathPoints(type: string | undefined, p: FlowEdgePathParams): [number, number][];
45
+ /** The distance from a point to a polyline */
46
+ export declare function distanceToPoints(x: number, y: number, pts: [number, number][]): number;
47
+ /** `getSmoothStepPath` with sharp corners */
48
+ export declare function getStepPath(p: FlowEdgePathParams & {
49
+ offset?: number;
50
+ }): FlowEdgePath;
51
+ /** An arrowhead's path at (x, y) pointing along `angle`: open (two strokes) or closed (a filled triangle's outline) */
52
+ export declare function arrowPath(x: number, y: number, angle: number, size?: number, closed?: boolean): string;
53
+ export {};
@@ -0,0 +1,52 @@
1
+ import { type GanttTask } from './ganttSchedule';
2
+ export interface GanttCsvOptions {
3
+ /** Field separator (default `,`; reading, `;` and tabs are detected) */
4
+ separator?: string;
5
+ }
6
+ /**
7
+ * Tasks as CSV, one row each: id, name, start, end, progress, type, parent, dependencies (`a; b SS+2`), color and the
8
+ * baseline. `data` isn't written (keep it in JSON).
9
+ */
10
+ export declare function toGanttCsv(tasks: readonly GanttTask[], options?: GanttCsvOptions): string;
11
+ /**
12
+ * Reads tasks from CSV with a header row: the columns `toGanttCsv` writes, or what other tools call them (Task Name,
13
+ * Start Date, Finish, % Complete, Predecessors…; case and spaces don't matter). Rows without an id get one; without
14
+ * an end, a milestone. `dayFirst` reads `03/04/2026` as the 3rd of April (default true).
15
+ */
16
+ export declare function parseGanttCsv(text: string, options?: GanttCsvOptions & {
17
+ dayFirst?: boolean;
18
+ }): GanttTask[];
19
+ /** Tasks as JSON, `{ format: 'm3ui-gantt', version: 1, tasks }`, everything included (`data` too) */
20
+ export declare function toGanttJson(tasks: readonly GanttTask[], options?: {
21
+ space?: number;
22
+ }): string;
23
+ /**
24
+ * Reads tasks from JSON: what `toGanttJson` writes, a bare array of tasks, or `{ tasks: [...] }`. Each needs a name
25
+ * and a start; ids are filled in when missing. Throws a SyntaxError on anything else.
26
+ */
27
+ export declare function parseGanttJson(text: string): GanttTask[];
28
+ export interface GanttXmlOptions {
29
+ /** The project's name */
30
+ name?: string;
31
+ /** Working hours a date-only task's days run, for Project's datetimes (default 8 to 17) */
32
+ dayStart?: number;
33
+ dayEnd?: number;
34
+ }
35
+ /**
36
+ * Tasks as a Microsoft Project XML file (MSPDI): outline levels for summaries, start and finish (a date-only
37
+ * task's days from `dayStart` to `dayEnd`), duration, percent complete, milestones, predecessors with their type
38
+ * and lag (in days), and the baseline. Project, ProjectLibre and GanttProject open it.
39
+ */
40
+ export declare function toMsProjectXml(tasks: readonly GanttTask[], options?: GanttXmlOptions): string;
41
+ /**
42
+ * Reads a Microsoft Project XML file (MSPDI, as Project, ProjectLibre or GanttProject save it): the outline
43
+ * (summaries from outline levels), names, start and finish, percent complete, milestones, predecessors (type and lag
44
+ * in days) and the first baseline. With `dates: 'auto'` (default) a project whose tasks all start and finish at the
45
+ * day's working hours comes in as whole days; `'datetime'` keeps the times. The project's name comes back too.
46
+ */
47
+ export declare function parseMsProjectXml(text: string, options?: {
48
+ dates?: 'auto' | 'date' | 'datetime';
49
+ }): {
50
+ name?: string;
51
+ tasks: GanttTask[];
52
+ };
@@ -0,0 +1,99 @@
1
+ /** A predecessor of a task: finish-to-start (default), start-to-start, finish-to-finish or start-to-finish */
2
+ export interface GanttDependency {
3
+ /** The predecessor's id */
4
+ id: string;
5
+ type?: 'FS' | 'SS' | 'FF' | 'SF';
6
+ /** Days between them (negative overlaps them); working days with a calendar */
7
+ lag?: number;
8
+ }
9
+ /** A task. MGantt emits new arrays with new objects for whatever changed (`v-model:tasks`) */
10
+ export interface GanttTask<D = any> {
11
+ id: string;
12
+ name: string;
13
+ /** `YYYY-MM-DD` (whole days) or a datetime (`YYYY-MM-DDTHH:mm`, local, or ISO with a zone) */
14
+ start: string;
15
+ /** A date is the last day (inclusive); a datetime is when it ends. A milestone needs none */
16
+ end?: string;
17
+ /** 0 to 100 */
18
+ progress?: number;
19
+ /** `summary` is implied for a task with children (its dates and progress roll up from them) */
20
+ type?: 'task' | 'milestone' | 'summary';
21
+ /** The summary task it belongs to */
22
+ parentId?: string;
23
+ /** Its predecessors: ids (finish-to-start) or `GanttDependency` */
24
+ dependencies?: (string | GanttDependency)[];
25
+ /** An M3 role (default `primary`; `summary` defaults to `neutral`) */
26
+ color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'neutral';
27
+ /** The plan it's compared with (MGantt's `baselines`) */
28
+ baselineStart?: string;
29
+ baselineEnd?: string;
30
+ /** `false` keeps it from being moved, resized, linked, deleted or selected */
31
+ draggable?: boolean;
32
+ resizable?: boolean;
33
+ linkable?: boolean;
34
+ deletable?: boolean;
35
+ selectable?: boolean;
36
+ class?: string;
37
+ data?: D;
38
+ }
39
+ /** Which days are worked: weekdays (0 Sunday … 6 Saturday, default Monday to Friday) and holidays (`YYYY-MM-DD`) */
40
+ export interface GanttCalendar {
41
+ workingDays?: number[];
42
+ holidays?: string[];
43
+ }
44
+ export interface GanttScheduleOptions {
45
+ /** `'push'` (default) moves tasks only as late as their dependencies need; `'asap'` also pulls them back to the earliest they can start */
46
+ mode?: 'push' | 'asap';
47
+ /** Count durations and lags in working days (date-only tasks), starting on working days */
48
+ calendar?: GanttCalendar;
49
+ }
50
+ export interface GanttCriticalPath {
51
+ /** Tasks with no slack (and summaries holding one) */
52
+ tasks: string[];
53
+ /** Dependencies on the path, as `'<predecessor>><successor>'` */
54
+ dependencies: string[];
55
+ /** Each task's total slack in days: how late it can finish without delaying the end */
56
+ slack: Record<string, number>;
57
+ /** When the last task ends */
58
+ finish: string;
59
+ }
60
+ export declare function normalizeDependency(d: string | GanttDependency): Required<GanttDependency>;
61
+ /** Ids of tasks that have children */
62
+ export declare function summaryIds(tasks: readonly GanttTask[]): Set<string>;
63
+ export declare function isMilestone(t: GanttTask): boolean;
64
+ /** A task's span in ms, end exclusive: a date-only end runs to the next midnight; a milestone has none */
65
+ export declare function taskSpan(t: Pick<GanttTask, 'start' | 'end' | 'type'>): {
66
+ start: number;
67
+ end: number;
68
+ dateOnly: boolean;
69
+ };
70
+ /** The task's `start`/`end` strings for a span (end exclusive), in the format it came in */
71
+ export declare function spanDates(t: Pick<GanttTask, 'start' | 'end' | 'type'>, start: number, end: number): {
72
+ start: string;
73
+ end?: string;
74
+ };
75
+ /** Duration in whole days (date-only tasks) or fractions of a day */
76
+ export declare function taskDays(t: GanttTask): number;
77
+ /**
78
+ * Summaries take the span of their children (deepest first) and their progress, weighted by duration. Returns the
79
+ * same array when nothing changes.
80
+ */
81
+ export declare function rollupSummaries<T extends GanttTask>(tasks: readonly T[]): T[];
82
+ /** Working days from `start` to `end`, both included (`YYYY-MM-DD`) */
83
+ export declare function workingDays(start: string, end: string, calendar?: GanttCalendar): number;
84
+ /** The date `n` working days after `date` (before it when negative); 0 moves a day off to the next working day */
85
+ export declare function addWorkingDays(date: string, n: number, calendar?: GanttCalendar): string;
86
+ /**
87
+ * Moves tasks so every dependency holds: by default only later (`'push'`, what dragging a predecessor does), or as
88
+ * soon as possible (`'asap'`), keeping each task's duration. Summaries follow their tasks. Returns the same array
89
+ * when nothing moves.
90
+ */
91
+ export declare function scheduleTasks<T extends GanttTask>(tasks: readonly T[], options?: GanttScheduleOptions): T[];
92
+ /**
93
+ * The critical path over the tasks' current dates: tasks whose delay would delay the last one's end (no slack),
94
+ * through their dependencies. Slack is in calendar days, or working days with a calendar (so a weekend between
95
+ * two tasks isn't slack).
96
+ */
97
+ export declare function criticalPath(tasks: readonly GanttTask[], options?: {
98
+ calendar?: GanttCalendar;
99
+ }): GanttCriticalPath;
@@ -0,0 +1,44 @@
1
+ import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
2
+ import type { DrawItem, DrawLayer, DrawPen, DrawShapeKind } from './drawGeometry';
3
+ /** What a pointer does on an MDrawCanvas */
4
+ export type DrawTool = DrawPen | 'eraser' | 'stroke-eraser' | DrawShapeKind | 'text' | 'select' | 'pan';
5
+ export interface DrawExportOptions {
6
+ /** In `mode="pages"`: the page to export (default 0) */
7
+ page?: number;
8
+ /** PNG: pixels per drawing unit (default 2) */
9
+ scale?: number;
10
+ /** Paint the paper color behind the drawing (default true) */
11
+ background?: boolean;
12
+ }
13
+ /** What an MDrawCanvas shares with MDrawToolbar, MDrawLayers and anything built with useDrawing() inside it */
14
+ export interface DrawContext {
15
+ tool: Ref<DrawTool>;
16
+ color: Ref<string>;
17
+ size: Ref<number>;
18
+ /** New rects and ellipses are filled with the color */
19
+ fill: Ref<boolean>;
20
+ items: ComputedRef<DrawItem[]>;
21
+ selection: Ref<string[]>;
22
+ layers: ComputedRef<DrawLayer[]>;
23
+ setLayers(layers: DrawLayer[]): void;
24
+ /** The layer new items go on */
25
+ layer: Ref<string | undefined>;
26
+ mode: ComputedRef<'infinite' | 'pages'>;
27
+ pages: Ref<number>;
28
+ addPage(): void;
29
+ zoom: ComputedRef<number>;
30
+ zoomIn(): void;
31
+ zoomOut(): void;
32
+ fitView(): void;
33
+ canUndo: ComputedRef<boolean>;
34
+ canRedo: ComputedRef<boolean>;
35
+ undo(): void;
36
+ redo(): void;
37
+ clear(): void;
38
+ deleteSelection(): void;
39
+ exportSvg(opts?: DrawExportOptions): string;
40
+ exportPng(opts?: DrawExportOptions): Promise<Blob>;
41
+ }
42
+ export declare const DRAW_KEY: InjectionKey<DrawContext>;
43
+ /** The surrounding MDrawCanvas' state and actions, for a toolbar or panel of your own inside it */
44
+ export declare function useDrawing(): DrawContext;