# Process Builder Technical Appendix This document provides technical implementation details for developers working with the Process Builder system. > For user documentation and usage guidelines, please refer to [Process Builder Documentation](USER_GUIDE.md) ## Architecture Overview ### Technology Stack - **Frontend Framework**: Nuxt 3 / Vue 3 - **State Management**: Pinia - **Flow Visualization**: Vue Flow - **UI Framework**: Tailwind CSS - **Icons**: Material Design Icons - **Validation**: Zod - **Form Components**: FormKit ### Key Dependencies ```json { "@vue-flow/core": "^1.42.5", "@vue-flow/background": "^1.3.2", "@vue-flow/controls": "^1.1.2", "@vue-flow/minimap": "^1.5.3", "@pinia/nuxt": "^0.4.11", "@formkit/nuxt": "^1.5.5", "uuid": "^10.0.0", "zod": "^3.22.2" } ``` ## Project Structure ``` pages/ ├── process-builder/ │ ├── index.vue # Main builder interface │ └── manage.vue # Process management components/ ├── process-flow/ │ ├── ProcessFlowCanvas.vue # Flow canvas │ ├── ProcessFlowNodes.js # Custom node types │ ├── FormSelector.vue # Form selection component │ ├── GatewayConditionManager.vue # Gateway conditions UI │ ├── ApiNodeConfiguration.vue # API node configuration │ ├── FormNodeConfiguration.vue # Form node configuration │ ├── BusinessRuleConfiguration.vue # Business rule configuration │ └── VariableManager.vue # Process variables manager stores/ ├── processBuilder.js # State management └── variableStore.js # Variable state management composables/ └── useProcessValidation.js # Process validation types/ └── process-builder.d.ts # TypeScript definitions ``` ## Component Architecture ### Core Components 1. **ProcessFlowCanvas.vue** ```vue ``` 2. **ProcessFlowNodes.js** ```javascript import { h, markRaw } from 'vue'; import { Handle, Position } from '@vue-flow/core'; // Custom node renderer with handles const CustomNode = markRaw({ template: `
{{ label }}
`, props: ['id', 'type', 'label', 'data'], components: { Handle } }); // Node type definitions export const nodeTypes = markRaw({ task: TaskNode, start: StartNode, end: EndNode, gateway: GatewayNode, form: FormNode, script: ScriptNode }); ``` ## Enhanced Node Configuration Components The following components implement the improved UI/UX for node configuration: ### 1. VariableManager.vue The Variable Manager allows users to create, edit, and manage global process variables. ```vue ``` ### 2. BusinessRuleConfiguration.vue The Business Rule Configuration component provides a stepped workflow for configuring rule nodes. ```vue ### 3. GatewayConditionManager.vue The Gateway Condition Manager provides an enhanced UI for decision point configuration. ```vue ``` ### 4. ApiNodeConfiguration.vue The API Node Configuration component provides a stepped interface for configuring API calls. ```vue ``` ### 5. FormNodeConfiguration.vue The Form Node Configuration component provides a stepped interface for configuring form interactions. ```vue ``` ## State Management The project uses Pinia for state management. Key stores include: ### variableStore.js ```javascript import { defineStore } from 'pinia'; export const useVariableStore = defineStore('variables', { state: () => ({ variables: { global: [], local: {} } }), getters: { getAllVariables: (state) => state.variables, getVariableByName: (state) => (name, scope = 'global') => { if (scope === 'global') { return state.variables.global.find(v => v.name === name); } else { return state.variables.local[scope]?.find(v => v.name === name); } } }, actions: { addVariable(variable) { const { scope = 'global' } = variable; if (scope === 'global') { this.variables.global.push(variable); } else { if (!this.variables.local[scope]) { this.variables.local[scope] = []; } this.variables.local[scope].push(variable); } }, updateVariable(name, updatedVariable, scope = 'global') { if (scope === 'global') { const index = this.variables.global.findIndex(v => v.name === name); if (index !== -1) { this.variables.global[index] = { ...updatedVariable }; } } else { if (this.variables.local[scope]) { const index = this.variables.local[scope].findIndex(v => v.name === name); if (index !== -1) { this.variables.local[scope][index] = { ...updatedVariable }; } } } }, deleteVariable(name, scope = 'global') { if (scope === 'global') { this.variables.global = this.variables.global.filter(v => v.name !== name); } else if (this.variables.local[scope]) { this.variables.local[scope] = this.variables.local[scope].filter(v => v.name !== name); } } } }); ``` ## UI Component Styling The project uses Tailwind CSS for styling with consistent patterns: ### Color Theming by Component Type Each node type has a consistent color theme: - **Business Rules**: Purple - **API Tasks**: Indigo - **Form Tasks**: Emerald - **Decision Points**: Orange - **Variables**: Blue ### Common Visual Elements 1. **Modal Headers**: ```html

{Title}

{Description}

``` 2. **Step Indicators**: ```html
``` 3. **Empty States**: ```html

{Empty State Title}

{Empty State Description}

{Action Text}
``` ## Best Practices for Development When developing new components or enhancing existing ones: 1. **Consistent Design Pattern**: - Follow the established design patterns for node configurations - Use the same structure for headers, step indicators, and action buttons - Maintain the color coding system for different node types 2. **Responsive Components**: - Ensure all components work on various screen sizes - Use responsive utilities from Tailwind - Test on mobile and desktop views 3. **State Management**: - Store node configuration in the appropriate Pinia store - Use reactive Vue 3 patterns with `ref`, `computed`, etc. - Implement proper validation before saving 4. **Accessibility**: - Ensure all UI elements are keyboard accessible - Use semantic HTML elements - Maintain proper focus management in modals 5. **Data Flow Visualization**: - Use visual indicators to show data flow direction - Provide clear feedback on how variables are used - Highlight connections between nodes --- For user documentation and usage guidelines, please refer to [Process Builder Documentation](USER_GUIDE.md). Last updated: July 10, 2024