canvas/dist/utils/index.mjs.map
2026-03-11 18:42:08 -07:00

1 line
No EOL
29 KiB
Text

{"version":3,"sources":["../../src/utils/debug.ts","../../src/utils/gesture-configs.ts","../../src/utils/mutation-queue.ts","../../src/utils/component-registry.tsx","../../src/utils/edge-path-calculators.ts","../../src/utils/layout.ts","../../src/utils/hit-test.ts","../../src/utils/edge-path-registry.ts"],"sourcesContent":["/**\n * Debug utility for @blinksgg/canvas\n *\n * Uses the `debug` package with `canvas:*` namespaces.\n * Enable in browser: `localStorage.debug = 'canvas:*'`\n * Enable in Node: `DEBUG=canvas:* node ...`\n *\n * Log levels:\n * debug('message') — verbose trace (blue)\n * debug.warn('message') — warnings (yellow, always stderr)\n * debug.error('message') — errors (red, always stderr)\n */\n\nimport debugFactory from 'debug';\nconst NAMESPACE = 'canvas';\n/**\n * Create a debug logger for a specific module.\n *\n * @example\n * ```ts\n * const debug = createDebug('graph');\n * debug('loaded %d nodes', count); // canvas:graph\n * debug.warn('node %s not found', id); // canvas:graph:warn\n * debug.error('sync failed: %O', err); // canvas:graph:error\n * ```\n */\nexport function createDebug(module) {\n const base = debugFactory(`${NAMESPACE}:${module}`);\n const warn = debugFactory(`${NAMESPACE}:${module}:warn`);\n const error = debugFactory(`${NAMESPACE}:${module}:error`);\n\n // Warnings and errors always log (even without DEBUG=canvas:*)\n warn.enabled = true;\n error.enabled = true;\n\n // Color hints: warn = yellow, error = red\n warn.log = console.warn.bind(console);\n error.log = console.error.bind(console);\n\n // Build the debugger with warn/error sub-loggers\n const debugFn = Object.assign(base, {\n warn,\n error\n });\n return debugFn;\n}\n\n// Pre-configured debug loggers\nexport const debug = {\n graph: {\n node: createDebug('graph:node'),\n edge: createDebug('graph:edge'),\n sync: createDebug('graph:sync')\n },\n ui: {\n selection: createDebug('ui:selection'),\n drag: createDebug('ui:drag'),\n resize: createDebug('ui:resize')\n },\n sync: {\n status: createDebug('sync:status'),\n mutations: createDebug('sync:mutations'),\n queue: createDebug('sync:queue')\n },\n viewport: createDebug('viewport')\n};","/**\n * Gesture configuration for @use-gesture/react\n *\n * Input-source-aware configurations.\n * Components should select the appropriate config based on `primaryInputSourceAtom`.\n */\n\n// =============================================================================\n// Source-Specific Configs\n// =============================================================================\n\n/** Gesture config for finger input (larger thresholds for imprecise touch) */\nconst fingerGestureConfig = {\n eventOptions: {\n passive: false,\n capture: false\n },\n drag: {\n pointer: {\n touch: true,\n keys: false,\n capture: false,\n buttons: -1\n },\n filterTaps: true,\n tapsThreshold: 10,\n // Was 3 — too strict for fingers\n threshold: 10 // Was 3 — needs larger dead zone\n }\n};\n\n/** Gesture config for pencil/stylus input (precise, tight thresholds) */\nconst pencilGestureConfig = {\n eventOptions: {\n passive: false,\n capture: false\n },\n drag: {\n pointer: {\n touch: true,\n keys: false,\n capture: false,\n buttons: -1\n },\n filterTaps: true,\n tapsThreshold: 3,\n threshold: 2 // Very precise — small dead zone\n }\n};\n\n/** Gesture config for mouse input */\nconst mouseGestureConfig = {\n eventOptions: {\n passive: false,\n capture: false\n },\n drag: {\n pointer: {\n touch: true,\n keys: false,\n capture: false,\n buttons: -1\n },\n filterTaps: true,\n tapsThreshold: 5,\n // Was 3\n threshold: 3\n }\n};\n\n// =============================================================================\n// Config Selectors\n// =============================================================================\n\n/**\n * Get the appropriate node gesture config for the given input source.\n */\nexport function getNodeGestureConfig(source) {\n switch (source) {\n case 'finger':\n return fingerGestureConfig;\n case 'pencil':\n return pencilGestureConfig;\n case 'mouse':\n return mouseGestureConfig;\n }\n}\n\n/**\n * Get the appropriate viewport gesture config for the given input source.\n */\nexport function getViewportGestureConfig(source) {\n const base = getNodeGestureConfig(source);\n return {\n ...base,\n eventOptions: {\n passive: false\n },\n pinch: {\n pointer: {\n touch: true\n }\n },\n wheel: {\n eventOptions: {\n passive: false\n }\n }\n };\n}","/**\n * Mutation queue for tracking pending node updates\n *\n * Prevents race conditions during rapid drag operations.\n */\n\n/**\n * Global map to track pending mutations per node\n */\nexport const pendingNodeMutations = new Map();\n\n/**\n * Get or create pending mutation state for a node\n */\nexport function getPendingState(nodeId) {\n let state = pendingNodeMutations.get(nodeId);\n if (!state) {\n state = {\n inFlight: false,\n queuedPosition: null,\n queuedUiProperties: null,\n graphId: null\n };\n pendingNodeMutations.set(nodeId, state);\n }\n return state;\n}\n\n/**\n * Clear pending state for a node\n */\nexport function clearPendingState(nodeId) {\n pendingNodeMutations.delete(nodeId);\n}\n\n/**\n * Clear all pending mutation state (used on graph switch)\n */\nexport function clearAllPendingMutations() {\n pendingNodeMutations.clear();\n}\n\n/**\n * Check if any node has pending mutations\n */\nexport function hasPendingMutations() {\n for (const state of pendingNodeMutations.values()) {\n if (state.inFlight || state.queuedPosition !== null || state.queuedUiProperties !== null) {\n return true;\n }\n }\n return false;\n}","import { c as _c } from \"react/compiler-runtime\";\n/**\n * Component Registry Utility\n *\n * Creates a memoized component registry for mapping node types to React components.\n * Handles lazy loading, memoization caching, and fallback rendering.\n */\n\nimport React from 'react';\n\n/**\n * A map of type strings to lazy-loaded React components\n */\n\n/**\n * Options for creating a component registry\n */\n\n/**\n * Result of createComponentRegistry\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Creates a component registry with automatic memoization and caching.\n *\n * @example\n * ```tsx\n * const { getComponent, Fallback } = createComponentRegistry({\n * registry: {\n * notes: React.lazy(() => import('./notes/mod')),\n * player: React.lazy(() => import('./player/mod')),\n * },\n * fallback: ({ nodeData }) => <div>Unknown: {nodeData.type}</div>,\n * });\n *\n * // Usage\n * const Component = getComponent(node.type) || Fallback;\n * return <Component nodeData={node} />;\n * ```\n */\nexport function createComponentRegistry({\n registry,\n fallback,\n getDisplayName = type => `Memoized${type}Component`\n}) {\n // Cache for memoized component wrappers - one per type\n const memoizedCache = new Map();\n const getComponent = type => {\n // Check cache first\n if (memoizedCache.has(type)) {\n return memoizedCache.get(type);\n }\n const LazyComponent = registry[type];\n if (!LazyComponent) {\n return fallback || null;\n }\n\n // Create a stable wrapper component for this type\n function RegistryComponent(props) {\n const $ = _c(2);\n let t0;\n if ($[0] !== props) {\n t0 = /*#__PURE__*/_jsx(LazyComponent, {\n ...props\n });\n $[0] = props;\n $[1] = t0;\n } else {\n t0 = $[1];\n }\n return t0;\n }\n RegistryComponent.displayName = getDisplayName(type);\n\n // Cache it for future calls\n memoizedCache.set(type, RegistryComponent);\n return RegistryComponent;\n };\n const getTypes = () => Object.keys(registry);\n const hasType = type => type in registry;\n return {\n getComponent,\n getTypes,\n hasType,\n Fallback: fallback || null\n };\n}\n\n/**\n * Creates a simple fallback component that displays the unknown type\n */\nexport function createFallbackComponent(getMessage) {\n return function FallbackComponent(props) {\n const message = getMessage ? getMessage(props) : `Unsupported type: \"${props.nodeData?.dbData?.node_type || 'Unknown'}\"`;\n return /*#__PURE__*/_jsx(\"div\", {\n style: {\n padding: '10px',\n color: 'orange'\n },\n children: /*#__PURE__*/_jsx(\"p\", {\n children: message\n })\n });\n };\n}","/**\n * Edge Path Calculators\n *\n * Configurable edge path calculation strategies.\n * Allows customization of how edges are drawn between nodes.\n */\n\n/**\n * Edge path calculator function type\n */\n\n/**\n * Horizontal Bezier curve (default)\n * Control points extend horizontally from source/target\n */\nexport const bezierHorizontal = ({\n x1,\n y1,\n x2,\n y2\n}) => {\n const dist = Math.abs(x2 - x1);\n const offset = Math.max(dist * 0.5, 50);\n const cp1x = x1 + offset;\n const cp1y = y1;\n const cp2x = x2 - offset;\n const cp2y = y2;\n const path = `M ${x1} ${y1} C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${x2} ${y2}`;\n\n // Midpoint along bezier curve (approximation)\n const labelX = (x1 + x2) / 2;\n const labelY = (y1 + y2) / 2;\n return {\n path,\n labelX,\n labelY\n };\n};\n\n/**\n * Vertical Bezier curve\n * Control points extend vertically from source/target\n */\nexport const bezierVertical = ({\n x1,\n y1,\n x2,\n y2\n}) => {\n const dist = Math.abs(y2 - y1);\n const offset = Math.max(dist * 0.5, 50);\n const cp1x = x1;\n const cp1y = y1 + offset;\n const cp2x = x2;\n const cp2y = y2 - offset;\n const path = `M ${x1} ${y1} C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${x2} ${y2}`;\n const labelX = (x1 + x2) / 2;\n const labelY = (y1 + y2) / 2;\n return {\n path,\n labelX,\n labelY\n };\n};\n\n/**\n * Smart Bezier curve\n * Chooses horizontal or vertical based on relative positions\n */\nexport const bezierSmart = input => {\n const {\n x1,\n y1,\n x2,\n y2\n } = input;\n const dx = Math.abs(x2 - x1);\n const dy = Math.abs(y2 - y1);\n\n // Use horizontal if nodes are more side-by-side, vertical if more stacked\n return dx > dy ? bezierHorizontal(input) : bezierVertical(input);\n};\n\n/**\n * Straight line edge\n */\nexport const straight = ({\n x1,\n y1,\n x2,\n y2\n}) => {\n const path = `M ${x1} ${y1} L ${x2} ${y2}`;\n const labelX = (x1 + x2) / 2;\n const labelY = (y1 + y2) / 2;\n return {\n path,\n labelX,\n labelY\n };\n};\n\n/**\n * Step edge (orthogonal) - horizontal first, then vertical\n */\nexport const stepHorizontal = ({\n x1,\n y1,\n x2,\n y2\n}) => {\n const midX = (x1 + x2) / 2;\n const path = `M ${x1} ${y1} L ${midX} ${y1} L ${midX} ${y2} L ${x2} ${y2}`;\n const labelX = midX;\n const labelY = (y1 + y2) / 2;\n return {\n path,\n labelX,\n labelY\n };\n};\n\n/**\n * Step edge (orthogonal) - vertical first, then horizontal\n */\nexport const stepVertical = ({\n x1,\n y1,\n x2,\n y2\n}) => {\n const midY = (y1 + y2) / 2;\n const path = `M ${x1} ${y1} L ${x1} ${midY} L ${x2} ${midY} L ${x2} ${y2}`;\n const labelX = (x1 + x2) / 2;\n const labelY = midY;\n return {\n path,\n labelX,\n labelY\n };\n};\n\n/**\n * Smart step edge\n * Chooses horizontal-first or vertical-first based on relative positions\n */\nexport const stepSmart = input => {\n const {\n x1,\n y1,\n x2,\n y2\n } = input;\n const dx = Math.abs(x2 - x1);\n const dy = Math.abs(y2 - y1);\n return dx > dy ? stepHorizontal(input) : stepVertical(input);\n};\n\n/**\n * Smooth step edge - orthogonal with rounded corners\n */\nexport const smoothStep = ({\n x1,\n y1,\n x2,\n y2\n}) => {\n const midX = (x1 + x2) / 2;\n const radius = Math.min(20, Math.abs(x2 - x1) / 4, Math.abs(y2 - y1) / 2);\n\n // Handle cases where radius would cause issues\n if (radius < 5 || Math.abs(y2 - y1) < radius * 2) {\n return stepHorizontal({\n x1,\n y1,\n x2,\n y2,\n sourceWidth: 0,\n sourceHeight: 0,\n targetWidth: 0,\n targetHeight: 0\n });\n }\n const yDir = y2 > y1 ? 1 : -1;\n const path = `\n M ${x1} ${y1}\n L ${midX - radius} ${y1}\n Q ${midX} ${y1}, ${midX} ${y1 + radius * yDir}\n L ${midX} ${y2 - radius * yDir}\n Q ${midX} ${y2}, ${midX + radius} ${y2}\n L ${x2} ${y2}\n `.replace(/\\s+/g, ' ').trim();\n const labelX = midX;\n const labelY = (y1 + y2) / 2;\n return {\n path,\n labelX,\n labelY\n };\n};\n\n/**\n * Available edge path types\n */\n\n/**\n * Get calculator by type name\n */\nexport function getEdgePathCalculator(type) {\n switch (type) {\n case 'bezier':\n return bezierHorizontal;\n case 'bezier-vertical':\n return bezierVertical;\n case 'bezier-smart':\n return bezierSmart;\n case 'straight':\n return straight;\n case 'step':\n return stepHorizontal;\n case 'step-vertical':\n return stepVertical;\n case 'step-smart':\n return stepSmart;\n case 'smooth-step':\n return smoothStep;\n default:\n return bezierHorizontal;\n }\n}\n\n/**\n * Default edge path calculator\n */\nexport const defaultEdgePathCalculator = bezierHorizontal;","/**\n * Layout utilities for canvas operations.\n *\n * Provides geometry calculations, bounds computation, and node overlap detection.\n */\n\n// ============================================================\n// Types\n// ============================================================\n\n/**\n * Rectangle with position and dimensions\n */\n\n/**\n * Node with position and dimensions (alias for geometry functions)\n */\n\n/**\n * Extended bounds with computed edges\n */\n\n/**\n * Mode for fitToBounds operation\n */\nexport let FitToBoundsMode = /*#__PURE__*/function (FitToBoundsMode) {\n /** Fit all nodes in the graph */\n FitToBoundsMode[\"Graph\"] = \"graph\";\n /** Fit only selected nodes */\n FitToBoundsMode[\"Selection\"] = \"selection\";\n return FitToBoundsMode;\n}({});\n\n// ============================================================\n// Bounds Calculation\n// ============================================================\n\n/**\n * Calculate the bounding rectangle that contains all nodes.\n *\n * @param nodes - Array of rectangles (nodes with x, y, width, height)\n * @returns Bounding rectangle containing all nodes\n *\n * @example\n * const bounds = calculateBounds([\n * { x: 0, y: 0, width: 100, height: 100 },\n * { x: 200, y: 150, width: 100, height: 100 },\n * ]);\n * // bounds = { x: 0, y: 0, width: 300, height: 250 }\n */\nexport const calculateBounds = nodes => {\n if (nodes.length === 0) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n const minX = Math.min(...nodes.map(node => node.x));\n const minY = Math.min(...nodes.map(node => node.y));\n const maxX = Math.max(...nodes.map(node => node.x + node.width));\n const maxY = Math.max(...nodes.map(node => node.y + node.height));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n};\n\n// ============================================================\n// Node Geometry\n// ============================================================\n\n/**\n * Get the center point of a node.\n */\nexport function getNodeCenter(node) {\n return {\n x: node.x + node.width / 2,\n y: node.y + node.height / 2\n };\n}\n\n/**\n * Set a node's position based on center coordinates.\n * Returns a new node object with updated position.\n */\nexport function setNodeCenter(node, centerX, centerY) {\n return {\n ...node,\n x: centerX - node.width / 2,\n y: centerY - node.height / 2\n };\n}\n\n/**\n * Check if two nodes overlap.\n */\nexport function checkNodesOverlap(node1, node2) {\n const center1 = getNodeCenter(node1);\n const center2 = getNodeCenter(node2);\n const dx = Math.abs(center1.x - center2.x);\n const dy = Math.abs(center1.y - center2.y);\n const minDistanceX = (node1.width + node2.width) / 2;\n const minDistanceY = (node1.height + node2.height) / 2;\n return dx < minDistanceX && dy < minDistanceY;\n}\n\n/**\n * Get the bounding box of a node.\n */\nexport function getNodeBounds(node) {\n return {\n x: node.x,\n y: node.y,\n width: node.width,\n height: node.height,\n left: node.x,\n right: node.x + node.width,\n top: node.y,\n bottom: node.y + node.height\n };\n}\n\n/**\n * Check if two nodes are within a certain distance of each other.\n */\nexport function areNodesClose(node1, node2, threshold = 200) {\n const center1 = getNodeCenter(node1);\n const center2 = getNodeCenter(node2);\n const distance = Math.sqrt(Math.pow(center1.x - center2.x, 2) + Math.pow(center1.y - center2.y, 2));\n return distance <= threshold;\n}","/**\n * Hit-testing utilities for canvas elements.\n *\n * Abstracts `document.elementFromPoint` / `document.elementsFromPoint`\n * behind testable functions. In tests or SSR, consumers can provide\n * a mock implementation via `setHitTestProvider`.\n */\n\n// --- Types ---\n\n// --- Default provider (real DOM) ---\n\nconst defaultProvider = {\n elementFromPoint: (x, y) => document.elementFromPoint(x, y),\n elementsFromPoint: (x, y) => document.elementsFromPoint(x, y)\n};\nlet _provider = defaultProvider;\n\n/**\n * Override the hit-test provider (for testing or SSR).\n * Pass `null` to restore the default DOM provider.\n */\nexport function setHitTestProvider(provider) {\n _provider = provider ?? defaultProvider;\n}\n\n// --- Hit-test functions ---\n\n/**\n * Find the canvas node at a screen position.\n * Looks for the nearest ancestor with `[data-node-id]`.\n */\nexport function hitTestNode(screenX, screenY) {\n const element = _provider.elementFromPoint(screenX, screenY);\n const nodeElement = element?.closest('[data-node-id]') ?? null;\n const nodeId = nodeElement?.getAttribute('data-node-id') ?? null;\n return {\n nodeId,\n element: nodeElement\n };\n}\n\n/**\n * Find a port at a screen position.\n * Scans through all elements at the position for `[data-drag-port-id]`.\n */\nexport function hitTestPort(screenX, screenY) {\n const elements = _provider.elementsFromPoint(screenX, screenY);\n for (const el of elements) {\n const portElement = el.closest('[data-drag-port-id]');\n if (portElement) {\n const portId = portElement.dataset.dragPortId;\n const portBar = portElement.closest('[data-port-bar]');\n const nodeId = portBar?.dataset.nodeId;\n if (portId && nodeId) {\n return {\n nodeId,\n portId\n };\n }\n }\n }\n return null;\n}","/**\n * Edge Path Registry\n *\n * Extensible registry for custom edge path calculators.\n * Built-in calculators are resolved first, then custom ones.\n * Used by the plugin system to allow plugins to add new edge path types.\n */\n\nimport { getEdgePathCalculator as getBuiltInCalculator } from './edge-path-calculators';\nconst customCalculators = new Map();\n\n/**\n * Register a custom edge path calculator.\n * Custom calculators take precedence over built-in ones with the same name.\n */\nexport function registerEdgePathCalculator(name, calculator) {\n customCalculators.set(name, calculator);\n}\n\n/**\n * Unregister a custom edge path calculator.\n */\nexport function unregisterEdgePathCalculator(name) {\n return customCalculators.delete(name);\n}\n\n/**\n * Get an edge path calculator by name.\n * Checks custom calculators first, then falls back to built-in ones.\n */\nexport function resolveEdgePathCalculator(name) {\n return customCalculators.get(name) ?? getBuiltInCalculator(name);\n}\n\n/**\n * Check if a custom calculator is registered.\n */\nexport function hasCustomEdgePathCalculator(name) {\n return customCalculators.has(name);\n}\n\n/**\n * Get all registered custom calculator names.\n */\nexport function getCustomEdgePathCalculatorNames() {\n return Array.from(customCalculators.keys());\n}\n\n/**\n * Clear all custom calculators. Mainly for testing.\n */\nexport function clearCustomEdgePathCalculators() {\n customCalculators.clear();\n}"],"mappings":";AAaA,OAAO,kBAAkB;AACzB,IAAM,YAAY;AAYX,SAAS,YAAY,QAAQ;AAClC,QAAM,OAAO,aAAa,GAAG,SAAS,IAAI,MAAM,EAAE;AAClD,QAAM,OAAO,aAAa,GAAG,SAAS,IAAI,MAAM,OAAO;AACvD,QAAM,QAAQ,aAAa,GAAG,SAAS,IAAI,MAAM,QAAQ;AAGzD,OAAK,UAAU;AACf,QAAM,UAAU;AAGhB,OAAK,MAAM,QAAQ,KAAK,KAAK,OAAO;AACpC,QAAM,MAAM,QAAQ,MAAM,KAAK,OAAO;AAGtC,QAAM,UAAU,OAAO,OAAO,MAAM;AAAA,IAClC;AAAA,IACA;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAGO,IAAM,QAAQ;AAAA,EACnB,OAAO;AAAA,IACL,MAAM,YAAY,YAAY;AAAA,IAC9B,MAAM,YAAY,YAAY;AAAA,IAC9B,MAAM,YAAY,YAAY;AAAA,EACh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