### Guide Path CSS Styling Source: https://github.com/getartisanflow/wireflow/blob/main/docs/animation/paths.md Provides CSS rules for styling the guide path overlay. This example sets the stroke color, width, dash array, and opacity for the guide path. ```css .flow-guide-path { stroke: var(--flow-accent); stroke-width: 1; stroke-dasharray: 4 4; fill: none; opacity: 0.4; } ``` -------------------------------- ### Install WireFlow Source: https://github.com/getartisanflow/wireflow/blob/main/README.md Install the WireFlow package and run the necessary artisan command to set up the components. ```bash composer require getartisanflow/wireflow php artisan wireflow:install ``` -------------------------------- ### Build assets after installation Source: https://github.com/getartisanflow/wireflow/blob/main/docs/commands.md After running the installation command, build your project's assets to reflect the changes. ```bash npm run build ``` -------------------------------- ### Install Dependencies and Build Source: https://github.com/getartisanflow/wireflow/blob/main/docs/addons/collab.md Install the necessary peer dependencies and the AlpineFlow npm package, then rebuild the project. ```bash npm install @getartisanflow/alpineflow yjs y-websocket y-protocols npm run build ``` -------------------------------- ### Full Example with Nodes and Edges Source: https://github.com/getartisanflow/wireflow/blob/main/docs/edges/styling.md Defines nodes and edges with various status classes and marker ends, then renders them using a Blade component. This demonstrates a complete setup for a flow diagram. ```php public array $nodes = [ ['id' => 'a', 'position' => ['x' => 0, 'y' => 0], 'data' => ['label' => 'Success']], ['id' => 'b', 'position' => ['x' => 250, 'y' => 0], 'data' => ['label' => 'Warning']], ['id' => 'c', 'position' => ['x' => 500, 'y' => 0], 'data' => ['label' => 'Danger']], ['id' => 'd', 'position' => ['x' => 125, 'y' => 150], 'data' => ['label' => 'Info']], ['id' => 'e', 'position' => ['x' => 375, 'y' => 150], 'data' => ['label' => 'Primary']], ]; public array $edges = [ ['id' => 'e1', 'source' => 'a', 'target' => 'd', 'class' => 'flow-edge-success', 'markerEnd' => 'arrowclosed'], ['id' => 'e2', 'source' => 'b', 'target' => 'd', 'class' => 'flow-edge-warning', 'markerEnd' => 'arrowclosed'], ['id' => 'e3', 'source' => 'b', 'target' => 'e', 'class' => 'flow-edge-danger', 'markerEnd' => 'arrowclosed'], ['id' => 'e4', 'source' => 'c', 'target' => 'e', 'class' => 'flow-edge-info', 'markerEnd' => 'arrowclosed'], ]; ``` ```blade ``` -------------------------------- ### Quick Setup with Artisan Command Source: https://github.com/getartisanflow/wireflow/blob/main/docs/getting-started/installation.md Run the Artisan command to automatically publish configuration, assets, and include necessary JS/CSS imports. This is the recommended setup method. ```bash php artisan wireflow:install npm run build ``` -------------------------------- ### Interactive Demo Setup Source: https://github.com/getartisanflow/wireflow/blob/main/docs/server/patterns.md This HTML and JavaScript setup demonstrates a simplified workflow canvas. It initializes nodes and edges, and includes basic controls for interacting with the workflow, such as an 'Approve Step' button. ```toolbar Status: pending ``` ```html
``` -------------------------------- ### Install AlpineFlow and Layout Addons Source: https://github.com/getartisanflow/wireflow/blob/main/docs/addons/layouts.md Install the core AlpineFlow package and any desired layout engine peer dependencies using npm. ```bash npm install @getartisanflow/alpineflow npm install @dagrejs/dagre # for dagre layout npm install d3-force # for force-directed layout npm install d3-hierarchy # for tree/cluster layout npm install elkjs # for ELK layout engine ``` -------------------------------- ### Install Whiteboard Addon Source: https://github.com/getartisanflow/wireflow/blob/main/docs/addons/whiteboard.md Install the AlpineFlow npm package and register the whiteboard plugin. Rebuild your project after adding the import. ```bash npm install @getartisanflow/alpineflow ``` ```bash npm run build ``` -------------------------------- ### Install WireFlow with a Specific Theme Source: https://github.com/getartisanflow/wireflow/blob/main/docs/theming/themes.md When installing WireFlow, you can specify a theme to be used. Remember to rebuild assets afterward. ```bash php artisan wireflow:install --theme=flux npm run build ``` -------------------------------- ### Persistent Flow Component Example Source: https://github.com/getartisanflow/wireflow/blob/main/docs/server/events.md A complete Livewire component example demonstrating how to persist node positions and handle connections, integrating with database models. ```php nodes = FlowNode::all()->map(fn ($n) => [ 'id' => (string) $n->id, 'position' => ['x' => $n->x, 'y' => $n->y], 'data' => ['label' => $n->label], ])->toArray(); $this->edges = FlowEdge::all()->map(fn ($e) => [ 'id' => (string) $e->id, 'source' => (string) $e->source_id, 'target' => (string) $e->target_id, ])->toArray(); } public function onNodeDragEnd(string $nodeId, array $position): void { FlowNode::where('id', $nodeId)->update([ 'x' => $position['x'], 'y' => $position['y'], ]); } public function onConnect(string $source, string $target, ?string $sourceHandle, ?string $targetHandle): void { $edge = FlowEdge::create([ 'source_id' => $source, 'target_id' => $target, ]); $this->edges[] = [ 'id' => (string) $edge->id, 'source' => $source, 'target' => $target, ]; } public function onPaneClick(array $position): void { $this->flowDeselectAll(); } public function render() { return view('livewire.persistent-flow'); } } ``` ```blade {{-- resources/views/livewire/persistent-flow.blade.php --}}
``` -------------------------------- ### Interactive Flow Canvas Demo Source: https://github.com/getartisanflow/wireflow/blob/main/docs/server/patterns.md This example demonstrates sending particles along edges in a flow canvas upon a button click. It includes custom toolbar elements for interaction and a simplified flow setup. ```html