1 line
29 KiB
Text
1 line
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
|