Files
metabuilder/redux/hooks
johndoe6345789 ab8694c81d chore(deps): systematically update library versions across all packages
- Update React from 18.2.0 to 19.2.3 in workflowui
- Update Next.js to latest stable (15.1.3, 16.1.2)
- Update @reduxjs/toolkit to 1.9.7 and 2.5.2 across packages
- Update React-Redux to 9.2.0 for better React 19 compatibility
- Update TypeScript to 5.9.3 for latest language features
- Update testing libraries: Jest, Vitest, Playwright to latest
- Update build tools: Vite, ESLint to current versions
- Update @tanstack/react-query to 5.91.2
- Update Framer Motion to 13.0.3
- Update Three.js to 0.177.0
- Update Tailwind CSS to 4.1.18 (consistent across packages)
- Update Monaco Editor to 4.7.0
- Update React Router to 7.17.2
- Update date-fns to 3.6.0
- Update Dexie to 4.0.8
- Update Sass to 1.83.5
- Update type definitions (@types/node, @types/react, etc.)
- Update AWS SDK for S3 integration
- Add multi-version peer dependency support for gradual upgrades
- Ensure compatibility across monorepo workspaces

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 16:55:46 +00:00
..

@metabuilder/hooks-core

Core React hooks for workflow UI applications built with Redux.

Key Feature: Service-independent hooks - use these with any Redux-compatible workflow implementation.

What's Included

Canvas Hooks

  • useCanvasZoom - Manage canvas zoom level
  • useCanvasPan - Manage canvas pan/translation
  • useCanvasSelection - Manage selected items on canvas
  • useCanvasSettings - Manage grid, snap, and other canvas settings
  • useCanvasGridUtils - Grid calculations and utilities

Editor Hooks

  • useEditor - Aggregated editor state
  • useEditorZoom - Node editor zoom control
  • useEditorPan - Node editor pan control
  • useEditorNodes - Node selection and manipulation
  • useEditorEdges - Edge/connection selection
  • useEditorSelection - General selection state
  • useEditorClipboard - Copy/paste operations
  • useEditorHistory - Undo/redo history

UI Hooks

  • useUI - Aggregated UI state
  • useUIModals - Modal dialog state
  • useUINotifications - Toast/notification management
  • useUILoading - Global loading state
  • useUITheme - Theme (light/dark) management
  • useUISidebar - Sidebar visibility state

Utility Hooks

  • useCanvasVirtualization - Virtual scrolling for large canvas
  • useResponsiveSidebar - Responsive sidebar behavior
  • usePasswordValidation - Password strength validation

Installation

npm install @metabuilder/hooks-core react react-redux @metabuilder/redux-slices

Usage

import { useCanvasZoom, useEditorSelection, useUIModals } from '@metabuilder/hooks-core'
import { Provider } from 'react-redux'
import { store } from '@metabuilder/redux-slices' // Or your own store

function WorkflowEditor() {
  const { zoom, zoomIn, zoomOut } = useCanvasZoom()
  const { selectedNodeIds, selectNode } = useEditorSelection()
  const { openModal } = useUIModals()

  return (
    <div>
      <button onClick={zoomIn}>Zoom In ({zoom.toFixed(0)}%)</button>
      <button onClick={zoomOut}>Zoom Out</button>
      {/* Your editor UI */}
    </div>
  )
}

export default function App() {
  return (
    <Provider store={store}>
      <WorkflowEditor />
    </Provider>
  )
}

Requirements

  • React 18.0+
  • Redux with workflow slices
  • react-redux

Architecture

All hooks in this package:

  • Are service-independent - no API calls, no database access
  • Use Redux as source of truth - dispatch actions, select state
  • Are framework-agnostic - work with any Redux setup
  • Are type-safe - full TypeScript support
  • Are composable - hooks are small and combine well

Future

These hooks will be extended with:

  • Canvas operations (creation, deletion, layout)
  • Workflow execution hooks
  • Collaboration hooks (cursors, presence)
  • Real-time sync hooks

Contributing

See main metabuilder repository for contribution guidelines.

License

MIT