@m3ui-vue/m3ui-vue 1.3.6 → 1.3.8

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 CHANGED
@@ -1,4 +1,4 @@
1
- # @m3ui-vue/m3ui-vue 1.3.6 — API reference
1
+ # @m3ui-vue/m3ui-vue 1.3.8 — 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.
@@ -1650,7 +1650,7 @@ export type FloorTablePreset = Partial<FloorTable> & { name?: string }
1650
1650
 
1651
1651
  Import from `@m3ui-vue/m3ui-vue/flow`.
1652
1652
 
1653
- A node editor (not an M3 spec component): nodes you drag around on a canvas that pans and zooms, joined by edges drawn from handle to handle. Built from M3 pieces (nodes are cards, the controls a floating toolbar) with the API shape of Vue Flow / React Flow. Nodes and edges are `v-model`s of plain objects; the view, the selection and the lock are too. Pan by dragging the background (or the wheel, or two fingers), zoom with Ctrl + wheel, a trackpad or touch pinch, or a double click. Shift + drag (or `selectionOnDrag`; on touch, a long press on the background) draws a selection box; Delete removes what's selected, Ctrl+Z/Ctrl+Shift+Z undo and redo, Ctrl+C/X/V/A copy, cut, paste and select all, and the arrows move the selected nodes. A drag from a handle to another connects them; dropped on nothing it fires `connect-end` with the spot, to offer a new node there. To disconnect: the × on a selected edge, Delete, dragging an edge's end (or a connected input) away and dropping it on nothing. Alignment guides show while dragging one node. Nodes are drawn by type: `default`/`input`/`output` (an MFlowNode), `circle` (a vertex: `data.label`, `color`, `badge`, `ring`, `size`; its edges run center to center in any direction), `group` (a box its children move with), or a `#node-<type>` slot of your own with MFlowHandles in it; edges are `bezier`, `smoothstep`, `step`, `straight` or a `#edge-<type>` slot (with `getBezierPath` and friends); `color`, `width`, `dashed`, `animated` and `labelTone` restyle one without a slot, with a transition. `layout` lays them out (`'tree'`, `'layered'` or a function, e.g. one calling dagre) whenever the graph's shape changes. Put `MFlowControls`, `MFlowMinimap` or anything of yours in the default slot: it's drawn over the canvas, the canvas's gestures and wheel leave it alone, and `useFlow()` works inside it. Inside a node, controls (buttons, inputs, links) never start a drag; mark anything else that shouldn't with `data-flow-nodrag`, and an area that scrolls on its own with `data-flow-nowheel`. `startDrag(id, event)` hands a pointer that's already down to a node, to drag something in from outside (a palette). Positions spring to their new place when they change from outside (a layout, an undo); the view springs on `fitView()`/zoom buttons. Nodes are rendered by small components of their own so moving one only redraws it and its edges.
1653
+ A node editor (not an M3 spec component): nodes you drag around on a canvas that pans and zooms, joined by edges drawn from handle to handle. Built from M3 pieces (nodes are cards, the controls a floating toolbar) with the API shape of Vue Flow / React Flow. Nodes and edges are `v-model`s of plain objects; the view, the selection and the lock are too. Pan by dragging the background (or the wheel, or two fingers), zoom with Ctrl + wheel, a trackpad or touch pinch, or a double click. Shift + drag (or `selectionOnDrag`; on touch, a long press on the background) draws a selection box; Delete removes what's selected, Ctrl+Z/Ctrl+Shift+Z undo and redo, Ctrl+C/X/V/D/A copy, cut, paste, duplicate and select all, and the arrows move the selected nodes. A drag from a handle to another connects them; dropped on nothing it fires `connect-end` with the spot, to offer a new node there. To disconnect: the × on a selected edge, Delete, dragging an edge's end (or a connected input) away and dropping it on nothing. Alignment guides show while dragging one node. Nodes are drawn by type: `default`/`input`/`output` (an MFlowNode), `circle` (a vertex: `data.label`, `color`, `badge`, `ring`, `size`; its edges run center to center in any direction), `group` (a box its children move with), or a `#node-<type>` slot of your own with MFlowHandles in it; edges are `bezier`, `smoothstep`, `step`, `straight` or a `#edge-<type>` slot (with `getBezierPath` and friends); `color`, `width`, `dashed`, `animated` and `labelTone` restyle one without a slot, with a transition. `layout` lays them out (`'tree'`, `'layered'` or a function, e.g. one calling dagre) whenever the graph's shape changes. Put `MFlowControls`, `MFlowMinimap` or anything of yours in the default slot: it's drawn over the canvas, the canvas's gestures and wheel leave it alone, and `useFlow()` works inside it. Inside a node, controls (buttons, inputs, links) never start a drag; mark anything else that shouldn't with `data-flow-nodrag`, and an area that scrolls on its own with `data-flow-nowheel`. `startDrag(id, event)` hands a pointer that's already down to a node, to drag something in from outside (a palette). Positions spring to their new place when they change from outside (a layout, an undo); the view springs on `fitView()`/zoom buttons. Nodes are rendered by small components of their own so moving one only redraws it and its edges.
1654
1654
 
1655
1655
  Props:
1656
1656
  - `nodes?: FlowNode<any>[] = []` (v-model:nodes)
@@ -1674,6 +1674,7 @@ Props:
1674
1674
  - `elementsSelectable?: boolean = true`
1675
1675
  - `edgesReconnectable?: boolean = true`
1676
1676
  - `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
1677
+ - `edgeSpacing?: number = 0` — `smoothstep`/`step` edges from different sources whose middle runs would lie on top of each other, running the same way, are moved apart by this many px, so two wires never read as one (edges from the same output may share a run). Edges with their own `route` stay put and the others keep off them. Default 0: off
1677
1678
  - `defaultEdgeOptions?: Partial<FlowEdge<any>>` — Merged into edges made by connecting (`type`, `animated`, `markerEnd`…)
1678
1679
  - `autoConnect?: boolean = true` — Adds an edge to `edges` when a connection is made; off, only `connect` fires
1679
1680
  - `isValidConnection?: ((c: FlowConnection) => boolean)` — Whether a connection may be made (no duplicates or same-node loops are offered either way)
@@ -1732,6 +1733,7 @@ Exposed (template ref):
1732
1733
  - `getSize: (id: string) => { width: number; height: number; }` — A node's measured (or set) size
1733
1734
  - `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
1734
1735
  - `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
1736
+ - `getEdgePath: (id: string) => string | null` — The SVG path (`d`, flow coordinates) an edge is drawn along right now, its own route and edgeSpacing included: to draw it elsewhere, e.g. an exported image
1735
1737
  - `screenToFlow: (p: { x: number; y: number; }) => FlowXY` — Page (client) coordinates → flow coordinates
1736
1738
  - `flowToScreen: (p: FlowXY) => { x: number; y: number; }`
1737
1739
  - `setViewport: (v: Partial<FlowViewport>, opts?: { animate?: boolean | undefined; } | undefined) => void`
@@ -1753,6 +1755,7 @@ Exposed (template ref):
1753
1755
  - `copy: () => void`
1754
1756
  - `cut: () => void`
1755
1757
  - `paste: (at?: FlowXY | undefined) => void` — Pastes what was copied, at a flow point (default a step from the originals)
1758
+ - `duplicate: () => void` — Copies of the selection (with the edges between them) a step away, selected; the clipboard stays as it was
1756
1759
  - `startDrag: (id: string, e: PointerEvent) => void` — Drags a node with a pointer that's already down, e.g. one just added from a palette outside the canvas: it follows the pointer from there (guides, splicing into an edge) until it's let go. With a finger, the page doesn't scroll under it meanwhile (start the drag from a long press, so a swipe still scrolls your palette)
1757
1760
 
1758
1761
  ### MFlowControls
@@ -4475,7 +4478,7 @@ Slots:
4475
4478
 
4476
4479
  ### MTour
4477
4480
 
4478
- A guided, step-by-step walkthrough that highlights a page element per step with an auto-positioned tooltip and a dimming scrim.
4481
+ A guided, step-by-step walkthrough that highlights a page element per step with an auto-positioned tooltip and a dimming scrim. With `interactive` the page stays usable: no scrim, the target gets a ring drawn over it (the element itself is left alone) and the ring and the tooltip follow it every frame, for targets that move (a canvas being panned, a panel opening). With `v-model:step` the page drives the steps itself (a tutorial that moves on when the user has done what a step asks, or skips the ones already done), and the `content`/`actions` slots replace the text and the buttons.
4479
4482
 
4480
4483
  Props:
4481
4484
  - `modelValue: boolean` (v-model) — Show/hide the tour (v-model)
@@ -4483,14 +4486,28 @@ Props:
4483
4486
  - `prevLabel?: string` — Label for the Previous button (defaults to the locale string, 'Previous')
4484
4487
  - `nextLabel?: string` — Label for the Next button (defaults to the locale string, 'Next')
4485
4488
  - `finishLabel?: string` — Label for the final step's button (defaults to the locale string, 'Finish')
4489
+ - `step?: number` (v-model:step) — The current step's index (v-model:step); without it the tour keeps its own
4490
+ - `interactive?: boolean` — Leaves the page usable while the tour is open: no scrim, a ring drawn over the target instead of lifting the target itself, tooltip and ring following the target as it moves, no scrolling to it
4486
4491
 
4487
4492
  Events:
4488
4493
  - `update:modelValue(boolean)` — Emitted when the tour opens or closes (Escape-less — closed via the X button, clicking the scrim, or finishing) — powers v-model
4489
4494
  - `finish()` — Emitted when the user completes the last step (clicks the finish button)
4495
+ - `update:step(number)` — Emitted when the current step changes (v-model:step)
4496
+
4497
+ Slots:
4498
+ - `#indicator { index: number; count: number; }` — Replaces the "2 / 5" over the step. Scope: `{ index, count }`
4499
+ - `#content { step: TourStep; index: number; }` — Replaces a step's title and text. Scope: `{ step, index }`
4500
+ - `#progress { index: number; count: number; }` — Replaces the progress dots. Scope: `{ index, count }`
4501
+ - `#actions { step: TourStep; index: number; isFirst: boolean; isLast: boolean; next: () => void; prev: () => void; close: () => void; }` — Replaces the Previous/Next buttons. Scope: `{ step, index, isFirst, isLast, next, prev, close }`
4490
4502
 
4491
4503
  ```ts
4492
4504
  export interface TourStep {
4493
- target: string
4505
+ /**
4506
+ * The element to highlight and point at: a CSS selector, or a function returning the element (looked up again
4507
+ * on every frame in `interactive` mode, so it can change). None, or none found: the tooltip sits in the viewport,
4508
+ * on its `placement` side (centered without one)
4509
+ */
4510
+ target?: string | (() => Element | null | undefined)
4494
4511
  title: string
4495
4512
  content: string
4496
4513
  placement?: 'top' | 'bottom' | 'left' | 'right'
@@ -4978,7 +4995,7 @@ Import from `@m3ui-vue/m3ui-vue/flow`.
4978
4995
  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
4979
4996
 
4980
4997
  ```ts
4981
- getSmoothStepPath(p: FlowEdgePathParams & { borderRadius?: number; offset?: number }): FlowEdgePath
4998
+ getSmoothStepPath(p: FlowEdgePathParams & FlowStepCenter & { borderRadius?: number; offset?: number }): FlowEdgePath
4982
4999
  ```
4983
5000
 
4984
5001
  ### getStepPath
@@ -4988,7 +5005,7 @@ Import from `@m3ui-vue/m3ui-vue/flow`.
4988
5005
  `getSmoothStepPath` with sharp corners
4989
5006
 
4990
5007
  ```ts
4991
- getStepPath(p: FlowEdgePathParams & { offset?: number; route?: number[] }): FlowEdgePath
5008
+ getStepPath(p: FlowEdgePathParams & FlowStepCenter & { offset?: number; route?: number[] }): FlowEdgePath
4992
5009
  ```
4993
5010
 
4994
5011
  ### getStraightPath
@@ -5005,10 +5022,8 @@ getStraightPath(p: FlowEdgePathParams): FlowEdgePath
5005
5022
 
5006
5023
  Import from `@m3ui-vue/m3ui-vue/flow`.
5007
5024
 
5008
- The corners of an orthogonal route between the ends, leaving and arriving square to the sides
5009
-
5010
5025
  ```ts
5011
- smoothStepPoints(p: FlowEdgePathParams & { offset?: number }): Pt[]
5026
+ smoothStepPoints(p: FlowEdgePathParams & FlowStepCenter & { offset?: number }): Pt[]
5012
5027
  ```
5013
5028
 
5014
5029
  ### routePoints
@@ -6360,6 +6375,8 @@ export interface FlowContext {
6360
6375
  * there (as the `branch` event gives). For dropping something onto an edge, e.g. a junction
6361
6376
  */
6362
6377
  getEdgeAt(p: FlowXY, opts?: { radius?: number; ignore?: (e: FlowEdge) => boolean }): FlowEdgeHit | null
6378
+ /** The SVG path (`d`, flow coordinates) an edge is drawn along right now, its own route and edgeSpacing included: to draw it elsewhere, e.g. an exported image */
6379
+ getEdgePath(id: string): string | null
6363
6380
  /** Page (client) coordinates → flow coordinates */
6364
6381
  screenToFlow(p: { x: number; y: number }): FlowXY
6365
6382
  flowToScreen(p: FlowXY): { x: number; y: number }
@@ -6389,6 +6406,8 @@ export interface FlowContext {
6389
6406
  cut(): void
6390
6407
  /** Pastes what was copied, at a flow point (default a step from the originals) */
6391
6408
  paste(at?: FlowXY): void
6409
+ /** Copies of the selection (with the edges between them) a step away, selected; the clipboard stays as it was */
6410
+ duplicate(): void
6392
6411
  /**
6393
6412
  * Drags a node with a pointer that's already down, e.g. one just added from a palette outside the canvas: it
6394
6413
  * follows the pointer from there (guides, splicing into an edge) until it's let go. With a finger, the page
@@ -6582,6 +6601,18 @@ export interface FlowEdgePathParams {
6582
6601
  export type FlowPosition = 'top' | 'right' | 'bottom' | 'left'
6583
6602
  ```
6584
6603
 
6604
+ ```ts
6605
+ /** The corners of an orthogonal route between the ends, leaving and arriving square to the sides */
6606
+ /**
6607
+ * Where a step edge from `sourcePosition` to `targetPosition` turns. `centerX` / `centerY` move its middle run (the
6608
+ * one halfway between the ends) off the halfway point, e.g. to keep it off another edge's
6609
+ */
6610
+ export interface FlowStepCenter {
6611
+ centerX?: number
6612
+ centerY?: number
6613
+ }
6614
+ ```
6615
+
6585
6616
  ```ts
6586
6617
  /** A layout: MFlow's `layout` prop and `layout()` take one */
6587
6618
  export type FlowLayout = (