@m3ui-vue/m3ui-vue 1.3.3 → 1.3.5
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.
- package/dist/API.md +79 -6
- package/dist/api.json +1 -1
- package/dist/components/MFloorPlan.vue.d.ts +21 -2
- package/dist/components/MFlow.vue.d.ts +45 -6
- package/dist/components/MFlowHandle.vue.d.ts +3 -2
- package/dist/composables/flowPaths.d.ts +20 -1
- package/dist/composables/useFlow.d.ts +47 -1
- package/dist/flow.d.ts +2 -2
- package/dist/flow.js +1358 -1060
- package/dist/flow.js.map +1 -1
- package/dist/flowPaths-DzW-aiET.js +204 -0
- package/dist/flowPaths-DzW-aiET.js.map +1 -0
- package/dist/gantt.js +1 -1
- package/dist/m3ui.js +185 -180
- package/dist/m3ui.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/MFloorPlan.test.ts +38 -0
- package/src/__tests__/MFlow.test.ts +139 -2
- package/src/components/MFloorPlan.vue +29 -8
- package/src/components/MFlow.vue +268 -33
- package/src/components/MFlowHandle.vue +5 -3
- package/src/components/_MFlowEdge.vue +73 -1
- package/src/composables/flowPaths.ts +77 -7
- package/src/composables/useFlow.ts +39 -1
- package/src/flow.ts +2 -1
- package/dist/flowPaths-CUc6X373.js +0 -161
- package/dist/flowPaths-CUc6X373.js.map +0 -1
package/dist/API.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @m3ui-vue/m3ui-vue 1.3.
|
|
1
|
+
# @m3ui-vue/m3ui-vue 1.3.5 — API reference
|
|
2
2
|
|
|
3
3
|
Material Design 3 components for Vue 3 + Tailwind CSS v4. Generated from the source by
|
|
4
4
|
`scripts/generate-api.mjs`; full docs with live demos at https://m3ui.dev.
|
|
@@ -1400,11 +1400,12 @@ Props:
|
|
|
1400
1400
|
- `editable?: boolean = false` — Drag tables around; otherwise a click opens one
|
|
1401
1401
|
- `grid?: number = 10` — Grid step in plan units (0: no snapping)
|
|
1402
1402
|
- `showGrid?: boolean = true` — Draw the grid while editing
|
|
1403
|
+
- `tableSnap?: "point" | "cell" = "point"` — Where a table's middle snaps: `point` a grid point (default), `cell` the middle of a grid square, so tables sit in the squares between the points while walls, zones and decor snap to the points (a plan of cells)
|
|
1403
1404
|
- `chairs?: boolean = true` — Draw chairs from `seats`
|
|
1404
1405
|
- `decorKinds?: Record<string, FloorDecorKind>` — Decor kinds of yours, or the built-in ones restyled (merged over them by name)
|
|
1405
1406
|
- `rotatable?: boolean = true` — The handle that turns the picked table or decor (off when your app doesn't keep angles)
|
|
1406
1407
|
- `dragMerged?: boolean = false` — Dragging (or nudging) a merged table moves its whole merge with it
|
|
1407
|
-
- `selectable?: "none" | "multiple" | "single" = "none"` —
|
|
1408
|
+
- `selectable?: "none" | "multiple" | "single" = "none"` — What a click on a table selects outside editing: nothing, one, or several (toggling; to merge them). While editing, `multiple` keeps clicks toggling tables in and out of the selection, and a drag moves the table pressed on its own (to bring the ones being merged together)
|
|
1408
1409
|
- `canMerge?: ((ids: (string | number)[]) => string | boolean)` — Whether these tables may be merged: `true`, or `false` / a reason to refuse (shown by `merge-refused`)
|
|
1409
1410
|
- `label?: string` — Accessible name
|
|
1410
1411
|
- `tables?: FloorTable[] = []` (v-model:tables)
|
|
@@ -1625,6 +1626,7 @@ Props:
|
|
|
1625
1626
|
- `nodesConnectable?: boolean = true`
|
|
1626
1627
|
- `elementsSelectable?: boolean = true`
|
|
1627
1628
|
- `edgesReconnectable?: boolean = true`
|
|
1629
|
+
- `edgesReroutable?: boolean = false` — The segments of a selected `smoothstep`/`step` edge get grips: drag one sideways to reroute the edge (it keeps the route in `edge.route`), or drag a leg at either end to add a jog. Default off
|
|
1628
1630
|
- `defaultEdgeOptions?: Partial<FlowEdge<any>>` — Merged into edges made by connecting (`type`, `animated`, `markerEnd`…)
|
|
1629
1631
|
- `autoConnect?: boolean = true` — Adds an edge to `edges` when a connection is made; off, only `connect` fires
|
|
1630
1632
|
- `isValidConnection?: ((c: FlowConnection) => boolean)` — Whether a connection may be made (no duplicates or same-node loops are offered either way)
|
|
@@ -1640,7 +1642,7 @@ Props:
|
|
|
1640
1642
|
- `dropIntoGroups?: boolean = false` — Nodes dropped onto a `group` join it (and leave it when dropped outside)
|
|
1641
1643
|
- `animate?: boolean = true` — Positions spring to their new place when they change from outside
|
|
1642
1644
|
- `getId?: ((kind: "edge" | "node") => string)` — Makes ids for pasted nodes and new edges
|
|
1643
|
-
- `edgeBranching?: boolean = false` — A drag that starts on an edge draws a new edge from the same source, a branch, as in a circuit editor (the preview leaves from where you grabbed it). A click still selects the edge; with a finger, only a selected edge branches, so a swipe across one still pans
|
|
1645
|
+
- `edgeBranching?: boolean | "junction" = false` — A drag that starts on an edge draws a new edge from the same source, a branch, as in a circuit editor (the preview leaves from where you grabbed it). A click still selects the edge; with a finger, only a selected edge branches, so a swipe across one still pans. `'junction'`: the branch leaves from the very point you grabbed, as in Logisim: nothing is added, `branch` fires with that point on the edge, and you split the edge there with a junction node of your own (or leave a loose end where it was dropped on nothing)
|
|
1644
1646
|
- `nativeContextMenu?: boolean = false` — Let the browser's own context menu open on the canvas (right click, or a long press on a phone). Off by default: the `*-contextmenu` events still fire, for a menu of your own (MContextMenu's `showAt`). Text fields inside nodes always keep it, for copy and paste
|
|
1645
1647
|
- `label?: string` — The canvas's accessible name
|
|
1646
1648
|
|
|
@@ -1653,8 +1655,10 @@ Events:
|
|
|
1653
1655
|
- `update:locked(boolean)`
|
|
1654
1656
|
- `connect(FlowConnection)` — A connection was made (it's also added to `edges` with `autoConnect`)
|
|
1655
1657
|
- `connect-start({ nodeId: string; handleId: string | null; type: "source" | "target"; })` — A connection drag started from a handle
|
|
1658
|
+
- `branch({ edge: FlowEdge<any>; connection: FlowConnection | null; position: FlowXY; direction: FlowPosition; end: FlowXY; routes?: { before: number[]; after: number[]; } | undefined; })` — A branch was dragged off an edge (edgeBranching) and dropped: `{ edge, connection, position, direction, end }`, the connection null when it was dropped on nothing, `position` the point on the edge where it was grabbed (on the grid along the edge with snapToGrid), `direction` the way the edge runs there toward its target, `end` where it was dropped, and for an edge with its own `route`, `routes` that keep each half's shape. With `'junction'` this is all that happens: split the edge with a node there whose handles are at `position="auto"`, the first half arriving with `targetPosition` opposite to `direction` and the second leaving with `sourcePosition: direction`, so it runs on straight through
|
|
1656
1659
|
- `connect-end({ connection: FlowConnection | null; position: FlowXY; from: { nodeId: string; handleId: string | null; type: "source" | "target"; }; })` — A connection drag ended: `{ connection }` when it connected, else the flow `position` it was dropped at and where it came from
|
|
1657
1660
|
- `reconnect({ edge: FlowEdge<any>; connection: FlowConnection; })` — An edge's end was moved to another handle: `{ edge, connection }`
|
|
1661
|
+
- `reroute(edge: FlowEdge<any>)` — A segment of an edge was dragged (`edgesReroutable`): the edge with its new `route`
|
|
1658
1662
|
- `insert({ node: FlowNode<any>; edge: FlowEdge<any>; connections: [FlowConnection, FlowConnection]; })` — A lone node was dropped onto an edge and spliced in: `{ node, edge, connections }` (with `autoConnect` the edge is replaced by the two connections, keeping its type and look)
|
|
1659
1663
|
- `node-click(FlowNode<any>, MouseEvent)` — / node-dblclick / node-contextmenu `(node, event)`
|
|
1660
1664
|
- `node-dblclick(FlowNode<any>, MouseEvent)`
|
|
@@ -1680,6 +1684,7 @@ Exposed (template ref):
|
|
|
1680
1684
|
- `getAbsolutePosition: (id: string) => FlowXY` — A node's top left corner in flow coordinates, its parents added, where it's drawn right now
|
|
1681
1685
|
- `getSize: (id: string) => { width: number; height: number; }` — A node's measured (or set) size
|
|
1682
1686
|
- `getIntersectingNodes: (node: string | { x: number; y: number; width: number; height: number; }) => FlowNode<any>[]` — Nodes overlapping this one (or a rectangle in flow coordinates), groups and its own family left out
|
|
1687
|
+
- `getEdgeAt: (p: FlowXY, opts?: { radius?: number | undefined; ignore?: ((e: FlowEdge<any>) => boolean) | undefined; } | undefined) => FlowEdgeHit | null` — The edge passing within `radius` (flow units, default 8) of a flow point, nearest first, skipping the ones `ignore` returns true for: where on it the point falls (on the grid along it with snapToGrid), the way it runs there toward its target, and for an edge with its own route, the routes that keep each half's shape if it's split there (as the `branch` event gives). For dropping something onto an edge, e.g. a junction
|
|
1683
1688
|
- `screenToFlow: (p: { x: number; y: number; }) => FlowXY` — Page (client) coordinates → flow coordinates
|
|
1684
1689
|
- `flowToScreen: (p: FlowXY) => { x: number; y: number; }`
|
|
1685
1690
|
- `setViewport: (v: Partial<FlowViewport>, opts?: { animate?: boolean | undefined; } | undefined) => void`
|
|
@@ -1689,6 +1694,7 @@ Exposed (template ref):
|
|
|
1689
1694
|
- `zoomTo: (zoom: number, opts?: { animate?: boolean | undefined; } | undefined) => void`
|
|
1690
1695
|
- `addNodes: (nodes: FlowNode<any> | FlowNode<any>[]) => void`
|
|
1691
1696
|
- `addEdges: (edges: FlowEdge<any> | FlowEdge<any>[]) => void`
|
|
1697
|
+
- `change: (next: { nodes?: FlowNode<any>[] | undefined; edges?: FlowEdge<any>[] | undefined; }) => void` — Several changes as one undoable step (nodes and edges added, changed or removed together): each list given replaces the current one
|
|
1692
1698
|
- `updateNode: (id: string, patch: Partial<FlowNode<any>> | ((n: FlowNode<any>) => FlowNode<any>)) => void`
|
|
1693
1699
|
- `updateEdge: (id: string, patch: Partial<FlowEdge<any>> | ((e: FlowEdge<any>) => FlowEdge<any>)) => void`
|
|
1694
1700
|
- `remove: (ids: { nodes?: string[] | undefined; edges?: string[] | undefined; }) => void` — Deletes nodes (with their edges and children) and edges by id
|
|
@@ -1728,7 +1734,7 @@ A connection point on a node in MFlow: drag from it to another node's handle to
|
|
|
1728
1734
|
|
|
1729
1735
|
Props:
|
|
1730
1736
|
- `type?: "source" | "target" = "source"` — `source`: edges leave from it; `target`: they arrive
|
|
1731
|
-
- `position?: FlowPosition`
|
|
1737
|
+
- `position?: "auto" | FlowPosition` — Its side; `'auto'` sits in the node's middle (or where you put it) and each edge leaves or arrives on the side facing its other end
|
|
1732
1738
|
- `id?: string`
|
|
1733
1739
|
- `connectable?: boolean = true`
|
|
1734
1740
|
|
|
@@ -4935,7 +4941,7 @@ Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
|
4935
4941
|
`getSmoothStepPath` with sharp corners
|
|
4936
4942
|
|
|
4937
4943
|
```ts
|
|
4938
|
-
getStepPath(p: FlowEdgePathParams & { offset?: number }): FlowEdgePath
|
|
4944
|
+
getStepPath(p: FlowEdgePathParams & { offset?: number; route?: number[] }): FlowEdgePath
|
|
4939
4945
|
```
|
|
4940
4946
|
|
|
4941
4947
|
### getStraightPath
|
|
@@ -4958,6 +4964,36 @@ The corners of an orthogonal route between the ends, leaving and arriving square
|
|
|
4958
4964
|
smoothStepPoints(p: FlowEdgePathParams & { offset?: number }): Pt[]
|
|
4959
4965
|
```
|
|
4960
4966
|
|
|
4967
|
+
### routePoints
|
|
4968
|
+
|
|
4969
|
+
Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
4970
|
+
|
|
4971
|
+
The corners of an orthogonal edge routed through `route`: the positions of its segments after the first, alternately x and y, starting with where the leg leaving the source ends (an x when the source's side is left or right). The legs at the ends stretch to wherever the nodes are, and a corner is added before the target when it's needed to arrive square to its side, so the route stays orthogonal as the nodes move.
|
|
4972
|
+
|
|
4973
|
+
```ts
|
|
4974
|
+
routePoints(p: FlowEdgePathParams & { route: number[] }): Pt[]
|
|
4975
|
+
```
|
|
4976
|
+
|
|
4977
|
+
### pointsToRoute
|
|
4978
|
+
|
|
4979
|
+
Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
4980
|
+
|
|
4981
|
+
The other way round: the `route` that runs an orthogonal edge through these corners (its ends first and last)
|
|
4982
|
+
|
|
4983
|
+
```ts
|
|
4984
|
+
pointsToRoute(points: Pt[], sourcePosition: FlowPosition = 'bottom', targetPosition?: FlowPosition): number[]
|
|
4985
|
+
```
|
|
4986
|
+
|
|
4987
|
+
### getRoutedPath
|
|
4988
|
+
|
|
4989
|
+
Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
4990
|
+
|
|
4991
|
+
Right-angled steps through `route` (see `routePoints`), rounded like `getSmoothStepPath`
|
|
4992
|
+
|
|
4993
|
+
```ts
|
|
4994
|
+
getRoutedPath(p: FlowEdgePathParams & { route: number[]; borderRadius?: number }): FlowEdgePath
|
|
4995
|
+
```
|
|
4996
|
+
|
|
4961
4997
|
### arrowPath
|
|
4962
4998
|
|
|
4963
4999
|
Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
@@ -6270,6 +6306,13 @@ export interface FlowContext {
|
|
|
6270
6306
|
getSize(id: string): { width: number; height: number }
|
|
6271
6307
|
/** Nodes overlapping this one (or a rectangle in flow coordinates), groups and its own family left out */
|
|
6272
6308
|
getIntersectingNodes(node: string | { x: number; y: number; width: number; height: number }): FlowNode[]
|
|
6309
|
+
/**
|
|
6310
|
+
* The edge passing within `radius` (flow units, default 8) of a flow point, nearest first, skipping the ones
|
|
6311
|
+
* `ignore` returns true for: where on it the point falls (on the grid along it with snapToGrid), the way it runs
|
|
6312
|
+
* there toward its target, and for an edge with its own route, the routes that keep each half's shape if it's split
|
|
6313
|
+
* there (as the `branch` event gives). For dropping something onto an edge, e.g. a junction
|
|
6314
|
+
*/
|
|
6315
|
+
getEdgeAt(p: FlowXY, opts?: { radius?: number; ignore?: (e: FlowEdge) => boolean }): FlowEdgeHit | null
|
|
6273
6316
|
/** Page (client) coordinates → flow coordinates */
|
|
6274
6317
|
screenToFlow(p: { x: number; y: number }): FlowXY
|
|
6275
6318
|
flowToScreen(p: FlowXY): { x: number; y: number }
|
|
@@ -6282,6 +6325,8 @@ export interface FlowContext {
|
|
|
6282
6325
|
zoomTo(zoom: number, opts?: { animate?: boolean }): void
|
|
6283
6326
|
addNodes(nodes: FlowNode | FlowNode[]): void
|
|
6284
6327
|
addEdges(edges: FlowEdge | FlowEdge[]): void
|
|
6328
|
+
/** Several changes as one undoable step (nodes and edges added, changed or removed together): each list given replaces the current one */
|
|
6329
|
+
change(next: { nodes?: FlowNode[]; edges?: FlowEdge[] }): void
|
|
6285
6330
|
updateNode(id: string, patch: Partial<FlowNode> | ((n: FlowNode) => FlowNode)): void
|
|
6286
6331
|
updateEdge(id: string, patch: Partial<FlowEdge> | ((e: FlowEdge) => FlowEdge)): void
|
|
6287
6332
|
/** Deletes nodes (with their edges and children) and edges by id */
|
|
@@ -6341,10 +6386,32 @@ export interface FlowEdge<D = any> {
|
|
|
6341
6386
|
deletable?: boolean
|
|
6342
6387
|
/** Its ends can be dragged to other handles once selected; default MFlow's `edgesReconnectable` */
|
|
6343
6388
|
reconnectable?: boolean
|
|
6389
|
+
/**
|
|
6390
|
+
* A `smoothstep`/`step` edge's own route: where its segments after the first run, alternately x and y (see
|
|
6391
|
+
* `routePoints`). Dragging a selected edge's segments writes it (MFlow's `edgesReroutable`); without one it's
|
|
6392
|
+
* routed automatically
|
|
6393
|
+
*/
|
|
6394
|
+
route?: number[]
|
|
6395
|
+
/** Its segments can be dragged once selected; default MFlow's `edgesReroutable` */
|
|
6396
|
+
reroutable?: boolean
|
|
6397
|
+
/** The side it leaves an `'auto'` handle by (default the side facing its other end) */
|
|
6398
|
+
sourcePosition?: FlowPosition
|
|
6399
|
+
/** The side it arrives at an `'auto'` handle by (default the side facing its other end) */
|
|
6400
|
+
targetPosition?: FlowPosition
|
|
6344
6401
|
class?: string
|
|
6345
6402
|
}
|
|
6346
6403
|
```
|
|
6347
6404
|
|
|
6405
|
+
```ts
|
|
6406
|
+
/** An edge found under a point (`getEdgeAt`) */
|
|
6407
|
+
export interface FlowEdgeHit {
|
|
6408
|
+
edge: FlowEdge
|
|
6409
|
+
position: FlowXY
|
|
6410
|
+
direction: FlowPosition
|
|
6411
|
+
routes?: { before: number[]; after: number[] }
|
|
6412
|
+
}
|
|
6413
|
+
```
|
|
6414
|
+
|
|
6348
6415
|
```ts
|
|
6349
6416
|
export interface FlowFitOptions {
|
|
6350
6417
|
/** Room around the nodes, a fraction of the view (default 0.1) */
|
|
@@ -6363,7 +6430,8 @@ export interface FlowFitOptions {
|
|
|
6363
6430
|
export interface FlowHandleBounds {
|
|
6364
6431
|
id: string | null
|
|
6365
6432
|
type: 'source' | 'target'
|
|
6366
|
-
|
|
6433
|
+
/** 'auto': each edge leaves or arrives on the side that faces its other end */
|
|
6434
|
+
position: FlowPosition | 'auto'
|
|
6367
6435
|
x: number
|
|
6368
6436
|
y: number
|
|
6369
6437
|
connectable: boolean
|
|
@@ -6408,6 +6476,11 @@ export interface FlowNode<D = any> {
|
|
|
6408
6476
|
deletable?: boolean
|
|
6409
6477
|
/** `false` keeps it from splicing into an edge when dropped onto one */
|
|
6410
6478
|
insertable?: boolean
|
|
6479
|
+
/**
|
|
6480
|
+
* With snapToGrid, what lands on the grid is its position plus this (default its corner): `{ x: w / 2, y: h / 2 }`
|
|
6481
|
+
* puts its middle on the grid, e.g. a junction dot whose wires run along the grid lines
|
|
6482
|
+
*/
|
|
6483
|
+
gridOffset?: FlowXY
|
|
6411
6484
|
class?: string
|
|
6412
6485
|
}
|
|
6413
6486
|
```
|