@fraziym/axoniz 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/agents/definition.d.ts +15 -0
- package/dist/agents/definition.d.ts.map +1 -0
- package/dist/agents/definition.js +41 -0
- package/dist/agents/definition.js.map +1 -0
- package/dist/agents/index.d.ts +12 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +11 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.d.ts +17 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +23 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/specialized.d.ts +31 -0
- package/dist/agents/specialized.d.ts.map +1 -0
- package/dist/agents/specialized.js +75 -0
- package/dist/agents/specialized.js.map +1 -0
- package/dist/awareness/index.d.ts +14 -0
- package/dist/awareness/index.d.ts.map +1 -0
- package/dist/awareness/index.js +22 -0
- package/dist/awareness/index.js.map +1 -0
- package/dist/awareness/service.d.ts +180 -0
- package/dist/awareness/service.d.ts.map +1 -0
- package/dist/awareness/service.js +789 -0
- package/dist/awareness/service.js.map +1 -0
- package/dist/cli/entry.d.ts +13 -0
- package/dist/cli/entry.d.ts.map +1 -0
- package/dist/cli/entry.js +35 -0
- package/dist/cli/entry.js.map +1 -0
- package/dist/comms/telegram.d.ts +41 -0
- package/dist/comms/telegram.d.ts.map +1 -0
- package/dist/comms/telegram.js +332 -0
- package/dist/comms/telegram.js.map +1 -0
- package/dist/core/agent.d.ts +252 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +1399 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/auth.d.ts +23 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +113 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/authority.d.ts +118 -0
- package/dist/core/authority.d.ts.map +1 -0
- package/dist/core/authority.js +402 -0
- package/dist/core/authority.js.map +1 -0
- package/dist/core/backend/async_queue.d.ts +17 -0
- package/dist/core/backend/async_queue.d.ts.map +1 -0
- package/dist/core/backend/async_queue.js +66 -0
- package/dist/core/backend/async_queue.js.map +1 -0
- package/dist/core/backend/index.d.ts +24 -0
- package/dist/core/backend/index.d.ts.map +1 -0
- package/dist/core/backend/index.js +128 -0
- package/dist/core/backend/index.js.map +1 -0
- package/dist/core/backend/llama_server.d.ts +39 -0
- package/dist/core/backend/llama_server.d.ts.map +1 -0
- package/dist/core/backend/llama_server.js +182 -0
- package/dist/core/backend/llama_server.js.map +1 -0
- package/dist/core/backend/llamacpp.d.ts +40 -0
- package/dist/core/backend/llamacpp.d.ts.map +1 -0
- package/dist/core/backend/llamacpp.js +200 -0
- package/dist/core/backend/llamacpp.js.map +1 -0
- package/dist/core/backend/lmstudio.d.ts +53 -0
- package/dist/core/backend/lmstudio.d.ts.map +1 -0
- package/dist/core/backend/lmstudio.js +274 -0
- package/dist/core/backend/lmstudio.js.map +1 -0
- package/dist/core/backend/ollama.d.ts +25 -0
- package/dist/core/backend/ollama.d.ts.map +1 -0
- package/dist/core/backend/ollama.js +86 -0
- package/dist/core/backend/ollama.js.map +1 -0
- package/dist/core/backend/openai.d.ts +27 -0
- package/dist/core/backend/openai.d.ts.map +1 -0
- package/dist/core/backend/openai.js +84 -0
- package/dist/core/backend/openai.js.map +1 -0
- package/dist/core/backend/types.d.ts +73 -0
- package/dist/core/backend/types.d.ts.map +1 -0
- package/dist/core/backend/types.js +137 -0
- package/dist/core/backend/types.js.map +1 -0
- package/dist/core/chat_store.d.ts +77 -0
- package/dist/core/chat_store.d.ts.map +1 -0
- package/dist/core/chat_store.js +332 -0
- package/dist/core/chat_store.js.map +1 -0
- package/dist/core/cli.d.ts +82 -0
- package/dist/core/cli.d.ts.map +1 -0
- package/dist/core/cli.js +602 -0
- package/dist/core/cli.js.map +1 -0
- package/dist/core/config.d.ts +127 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +295 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/debug.d.ts +8 -0
- package/dist/core/debug.d.ts.map +1 -0
- package/dist/core/debug.js +8 -0
- package/dist/core/debug.js.map +1 -0
- package/dist/core/downloader.d.ts +31 -0
- package/dist/core/downloader.d.ts.map +1 -0
- package/dist/core/downloader.js +180 -0
- package/dist/core/downloader.js.map +1 -0
- package/dist/core/errors.d.ts +80 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +134 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/extras.d.ts +160 -0
- package/dist/core/extras.d.ts.map +1 -0
- package/dist/core/extras.js +553 -0
- package/dist/core/extras.js.map +1 -0
- package/dist/core/health.d.ts +27 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +96 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/history.d.ts +50 -0
- package/dist/core/history.d.ts.map +1 -0
- package/dist/core/history.js +276 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/intelligence/ast_index.d.ts +255 -0
- package/dist/core/intelligence/ast_index.d.ts.map +1 -0
- package/dist/core/intelligence/ast_index.js +1369 -0
- package/dist/core/intelligence/ast_index.js.map +1 -0
- package/dist/core/intelligence/confidence.d.ts +113 -0
- package/dist/core/intelligence/confidence.d.ts.map +1 -0
- package/dist/core/intelligence/confidence.js +298 -0
- package/dist/core/intelligence/confidence.js.map +1 -0
- package/dist/core/intelligence/context_compressor.d.ts +80 -0
- package/dist/core/intelligence/context_compressor.d.ts.map +1 -0
- package/dist/core/intelligence/context_compressor.js +245 -0
- package/dist/core/intelligence/context_compressor.js.map +1 -0
- package/dist/core/intelligence/daemon.d.ts +247 -0
- package/dist/core/intelligence/daemon.d.ts.map +1 -0
- package/dist/core/intelligence/daemon.js +842 -0
- package/dist/core/intelligence/daemon.js.map +1 -0
- package/dist/core/intelligence/index.d.ts +60 -0
- package/dist/core/intelligence/index.d.ts.map +1 -0
- package/dist/core/intelligence/index.js +101 -0
- package/dist/core/intelligence/index.js.map +1 -0
- package/dist/core/intelligence/predictor.d.ts +246 -0
- package/dist/core/intelligence/predictor.d.ts.map +1 -0
- package/dist/core/intelligence/predictor.js +590 -0
- package/dist/core/intelligence/predictor.js.map +1 -0
- package/dist/core/intelligence/reflex.d.ts +84 -0
- package/dist/core/intelligence/reflex.d.ts.map +1 -0
- package/dist/core/intelligence/reflex.js +344 -0
- package/dist/core/intelligence/reflex.js.map +1 -0
- package/dist/core/intelligence/self_correction.d.ts +121 -0
- package/dist/core/intelligence/self_correction.d.ts.map +1 -0
- package/dist/core/intelligence/self_correction.js +327 -0
- package/dist/core/intelligence/self_correction.js.map +1 -0
- package/dist/core/intelligence/skill_distiller.d.ts +100 -0
- package/dist/core/intelligence/skill_distiller.d.ts.map +1 -0
- package/dist/core/intelligence/skill_distiller.js +246 -0
- package/dist/core/intelligence/skill_distiller.js.map +1 -0
- package/dist/core/intelligence/swarm.d.ts +330 -0
- package/dist/core/intelligence/swarm.d.ts.map +1 -0
- package/dist/core/intelligence/swarm.js +1064 -0
- package/dist/core/intelligence/swarm.js.map +1 -0
- package/dist/core/intelligence/trajectory.d.ts +107 -0
- package/dist/core/intelligence/trajectory.d.ts.map +1 -0
- package/dist/core/intelligence/trajectory.js +330 -0
- package/dist/core/intelligence/trajectory.js.map +1 -0
- package/dist/core/logger.d.ts +111 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +640 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/loop.d.ts +123 -0
- package/dist/core/loop.d.ts.map +1 -0
- package/dist/core/loop.js +423 -0
- package/dist/core/loop.js.map +1 -0
- package/dist/core/memory.d.ts +81 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +328 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/metrics.d.ts +29 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/metrics.js +109 -0
- package/dist/core/metrics.js.map +1 -0
- package/dist/core/models.d.ts +51 -0
- package/dist/core/models.d.ts.map +1 -0
- package/dist/core/models.js +146 -0
- package/dist/core/models.js.map +1 -0
- package/dist/core/optimizer.d.ts +34 -0
- package/dist/core/optimizer.d.ts.map +1 -0
- package/dist/core/optimizer.js +131 -0
- package/dist/core/optimizer.js.map +1 -0
- package/dist/core/persona.d.ts +35 -0
- package/dist/core/persona.d.ts.map +1 -0
- package/dist/core/persona.js +126 -0
- package/dist/core/persona.js.map +1 -0
- package/dist/core/rate_limit.d.ts +23 -0
- package/dist/core/rate_limit.d.ts.map +1 -0
- package/dist/core/rate_limit.js +62 -0
- package/dist/core/rate_limit.js.map +1 -0
- package/dist/core/runner.d.ts +63 -0
- package/dist/core/runner.d.ts.map +1 -0
- package/dist/core/runner.js +671 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/core/stream_parser.d.ts +43 -0
- package/dist/core/stream_parser.d.ts.map +1 -0
- package/dist/core/stream_parser.js +140 -0
- package/dist/core/stream_parser.js.map +1 -0
- package/dist/core/tool_schemas.d.ts +26 -0
- package/dist/core/tool_schemas.d.ts.map +1 -0
- package/dist/core/tool_schemas.js +124 -0
- package/dist/core/tool_schemas.js.map +1 -0
- package/dist/core/which.d.ts +2 -0
- package/dist/core/which.d.ts.map +1 -0
- package/dist/core/which.js +35 -0
- package/dist/core/which.js.map +1 -0
- package/dist/goals/index.d.ts +9 -0
- package/dist/goals/index.d.ts.map +1 -0
- package/dist/goals/index.js +17 -0
- package/dist/goals/index.js.map +1 -0
- package/dist/goals/service.d.ts +115 -0
- package/dist/goals/service.d.ts.map +1 -0
- package/dist/goals/service.js +415 -0
- package/dist/goals/service.js.map +1 -0
- package/dist/goals/types.d.ts +47 -0
- package/dist/goals/types.d.ts.map +1 -0
- package/dist/goals/types.js +66 -0
- package/dist/goals/types.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/autonomous_startup.d.ts +51 -0
- package/dist/integrations/autonomous_startup.d.ts.map +1 -0
- package/dist/integrations/autonomous_startup.js +419 -0
- package/dist/integrations/autonomous_startup.js.map +1 -0
- package/dist/integrations/goose.d.ts +105 -0
- package/dist/integrations/goose.d.ts.map +1 -0
- package/dist/integrations/goose.js +408 -0
- package/dist/integrations/goose.js.map +1 -0
- package/dist/integrations/index.d.ts +21 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +17 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/mcp.d.ts +73 -0
- package/dist/integrations/mcp.d.ts.map +1 -0
- package/dist/integrations/mcp.js +307 -0
- package/dist/integrations/mcp.js.map +1 -0
- package/dist/integrations/mempalace.d.ts +18 -0
- package/dist/integrations/mempalace.d.ts.map +1 -0
- package/dist/integrations/mempalace.js +25 -0
- package/dist/integrations/mempalace.js.map +1 -0
- package/dist/integrations/multi_agent.d.ts +82 -0
- package/dist/integrations/multi_agent.d.ts.map +1 -0
- package/dist/integrations/multi_agent.js +280 -0
- package/dist/integrations/multi_agent.js.map +1 -0
- package/dist/integrations/unified_memory.d.ts +415 -0
- package/dist/integrations/unified_memory.d.ts.map +1 -0
- package/dist/integrations/unified_memory.js +1489 -0
- package/dist/integrations/unified_memory.js.map +1 -0
- package/dist/roles/beru.yaml +48 -0
- package/dist/sidecar/client.d.ts +63 -0
- package/dist/sidecar/client.d.ts.map +1 -0
- package/dist/sidecar/client.js +222 -0
- package/dist/sidecar/client.js.map +1 -0
- package/dist/sidecar/index.d.ts +7 -0
- package/dist/sidecar/index.d.ts.map +1 -0
- package/dist/sidecar/index.js +6 -0
- package/dist/sidecar/index.js.map +1 -0
- package/dist/startup.d.ts +22 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +194 -0
- package/dist/startup.js.map +1 -0
- package/dist/tools/_internal.d.ts +90 -0
- package/dist/tools/_internal.d.ts.map +1 -0
- package/dist/tools/_internal.js +375 -0
- package/dist/tools/_internal.js.map +1 -0
- package/dist/tools/_smoke.d.ts +2 -0
- package/dist/tools/_smoke.d.ts.map +1 -0
- package/dist/tools/_smoke.js +203 -0
- package/dist/tools/_smoke.js.map +1 -0
- package/dist/tools/axodex_tools.d.ts +51 -0
- package/dist/tools/axodex_tools.d.ts.map +1 -0
- package/dist/tools/axodex_tools.js +181 -0
- package/dist/tools/axodex_tools.js.map +1 -0
- package/dist/tools/code_tools.d.ts +33 -0
- package/dist/tools/code_tools.d.ts.map +1 -0
- package/dist/tools/code_tools.js +191 -0
- package/dist/tools/code_tools.js.map +1 -0
- package/dist/tools/computer_tools.d.ts +59 -0
- package/dist/tools/computer_tools.d.ts.map +1 -0
- package/dist/tools/computer_tools.js +348 -0
- package/dist/tools/computer_tools.js.map +1 -0
- package/dist/tools/file_tools.d.ts +51 -0
- package/dist/tools/file_tools.d.ts.map +1 -0
- package/dist/tools/file_tools.js +424 -0
- package/dist/tools/file_tools.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/shell_tools.d.ts +39 -0
- package/dist/tools/shell_tools.d.ts.map +1 -0
- package/dist/tools/shell_tools.js +163 -0
- package/dist/tools/shell_tools.js.map +1 -0
- package/dist/tools/web_tools.d.ts +31 -0
- package/dist/tools/web_tools.d.ts.map +1 -0
- package/dist/tools/web_tools.js +117 -0
- package/dist/tools/web_tools.js.map +1 -0
- package/dist/voice/index.d.ts +41 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +58 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/light_daemon.d.ts +197 -0
- package/dist/voice/light_daemon.d.ts.map +1 -0
- package/dist/voice/light_daemon.js +746 -0
- package/dist/voice/light_daemon.js.map +1 -0
- package/dist/voice/setup.d.ts +63 -0
- package/dist/voice/setup.d.ts.map +1 -0
- package/dist/voice/setup.js +443 -0
- package/dist/voice/setup.js.map +1 -0
- package/dist/voice/stt.d.ts +148 -0
- package/dist/voice/stt.d.ts.map +1 -0
- package/dist/voice/stt.js +361 -0
- package/dist/voice/stt.js.map +1 -0
- package/dist/voice/tts.d.ts +168 -0
- package/dist/voice/tts.d.ts.map +1 -0
- package/dist/voice/tts.js +698 -0
- package/dist/voice/tts.js.map +1 -0
- package/dist/voice/voice_loop.d.ts +101 -0
- package/dist/voice/voice_loop.d.ts.map +1 -0
- package/dist/voice/voice_loop.js +463 -0
- package/dist/voice/voice_loop.js.map +1 -0
- package/dist/voice/wake_word.d.ts +153 -0
- package/dist/voice/wake_word.d.ts.map +1 -0
- package/dist/voice/wake_word.js +458 -0
- package/dist/voice/wake_word.js.map +1 -0
- package/dist/voice/wav.d.ts +99 -0
- package/dist/voice/wav.d.ts.map +1 -0
- package/dist/voice/wav.js +306 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/web/broker.d.ts +33 -0
- package/dist/web/broker.d.ts.map +1 -0
- package/dist/web/broker.js +58 -0
- package/dist/web/broker.js.map +1 -0
- package/dist/web/open_browser.d.ts +2 -0
- package/dist/web/open_browser.d.ts.map +1 -0
- package/dist/web/open_browser.js +42 -0
- package/dist/web/open_browser.js.map +1 -0
- package/dist/web/server.d.ts +54 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +831 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/static/app.js +4121 -0
- package/dist/web/static/index.html +2281 -0
- package/dist/web/static/js/MODULE_SUMMARY.md +124 -0
- package/dist/web/static/js/a11y.js +165 -0
- package/dist/web/static/js/admin.js +2145 -0
- package/dist/web/static/js/assistant.js +475 -0
- package/dist/web/static/js/calendar/reminders.js +114 -0
- package/dist/web/static/js/calendar/utils.js +166 -0
- package/dist/web/static/js/calendar.js +3348 -0
- package/dist/web/static/js/censor.js +356 -0
- package/dist/web/static/js/chat.js +4546 -0
- package/dist/web/static/js/chatRenderer.js +2294 -0
- package/dist/web/static/js/chatStream.js +276 -0
- package/dist/web/static/js/codeRunner.js +398 -0
- package/dist/web/static/js/color/hex.js +14 -0
- package/dist/web/static/js/colorPicker.js +453 -0
- package/dist/web/static/js/compare/icons.js +77 -0
- package/dist/web/static/js/compare/index.js +1482 -0
- package/dist/web/static/js/compare/models.js +104 -0
- package/dist/web/static/js/compare/panes.js +817 -0
- package/dist/web/static/js/compare/probe.js +78 -0
- package/dist/web/static/js/compare/scoreboard.js +223 -0
- package/dist/web/static/js/compare/selector.js +1335 -0
- package/dist/web/static/js/compare/state.js +58 -0
- package/dist/web/static/js/compare/stream.js +695 -0
- package/dist/web/static/js/compare/vote.js +254 -0
- package/dist/web/static/js/cookbook-diagnosis.js +694 -0
- package/dist/web/static/js/cookbook-hwfit.js +1888 -0
- package/dist/web/static/js/cookbook.js +2093 -0
- package/dist/web/static/js/cookbookDownload.js +633 -0
- package/dist/web/static/js/cookbookProgressSignal.js +29 -0
- package/dist/web/static/js/cookbookRunning.js +3506 -0
- package/dist/web/static/js/cookbookServe.js +2128 -0
- package/dist/web/static/js/document.js +9731 -0
- package/dist/web/static/js/documentLibrary.js +3376 -0
- package/dist/web/static/js/dragSort.js +265 -0
- package/dist/web/static/js/editor/ai-inpaint.js +374 -0
- package/dist/web/static/js/editor/ai-models.js +273 -0
- package/dist/web/static/js/editor/ai-rembg.js +230 -0
- package/dist/web/static/js/editor/ai-tool-runner.js +147 -0
- package/dist/web/static/js/editor/ai-tools-misc.js +216 -0
- package/dist/web/static/js/editor/build/controls.js +366 -0
- package/dist/web/static/js/editor/build/popups.js +112 -0
- package/dist/web/static/js/editor/build/right-panel.js +200 -0
- package/dist/web/static/js/editor/build/toolbar.js +73 -0
- package/dist/web/static/js/editor/build/topbar.js +131 -0
- package/dist/web/static/js/editor/build/transform-popup.js +109 -0
- package/dist/web/static/js/editor/canvas-coords.js +21 -0
- package/dist/web/static/js/editor/canvas-events.js +197 -0
- package/dist/web/static/js/editor/canvas-transforms.js +132 -0
- package/dist/web/static/js/editor/checkerboard.js +24 -0
- package/dist/web/static/js/editor/clipboard-and-drop.js +133 -0
- package/dist/web/static/js/editor/composite-helpers.js +83 -0
- package/dist/web/static/js/editor/filters/blur.js +118 -0
- package/dist/web/static/js/editor/filters/edge-feather.js +70 -0
- package/dist/web/static/js/editor/fx/adj-popup.js +677 -0
- package/dist/web/static/js/editor/fx/filter-string.js +38 -0
- package/dist/web/static/js/editor/fx/histogram.js +67 -0
- package/dist/web/static/js/editor/fx/pixel-pass.js +249 -0
- package/dist/web/static/js/editor/harmonize-masks.js +116 -0
- package/dist/web/static/js/editor/history-panel.js +176 -0
- package/dist/web/static/js/editor/keyboard-shortcuts.js +271 -0
- package/dist/web/static/js/editor/layer-helpers.js +131 -0
- package/dist/web/static/js/editor/layer-panel.js +600 -0
- package/dist/web/static/js/editor/mask-utils.js +91 -0
- package/dist/web/static/js/editor/shortcuts-popover.js +149 -0
- package/dist/web/static/js/editor/slider-ux.js +191 -0
- package/dist/web/static/js/editor/snap.js +107 -0
- package/dist/web/static/js/editor/state.js +257 -0
- package/dist/web/static/js/editor/stroke-pipeline.js +162 -0
- package/dist/web/static/js/editor/stroke-tool-sliders.js +64 -0
- package/dist/web/static/js/editor/tools/clone.js +81 -0
- package/dist/web/static/js/editor/tools/crop.js +137 -0
- package/dist/web/static/js/editor/tools/flood-fill.js +72 -0
- package/dist/web/static/js/editor/tools/lasso-mask.js +171 -0
- package/dist/web/static/js/editor/tools/lasso.js +65 -0
- package/dist/web/static/js/editor/tools/move.js +79 -0
- package/dist/web/static/js/editor/tools/stroke.js +123 -0
- package/dist/web/static/js/editor/tools/transform-drag.js +174 -0
- package/dist/web/static/js/editor/tools/transform-handles.js +271 -0
- package/dist/web/static/js/editor/tools/transform-session.js +381 -0
- package/dist/web/static/js/editor/tools/wand.js +46 -0
- package/dist/web/static/js/editor/wire-import.js +148 -0
- package/dist/web/static/js/editor/wire-inpaint-controls.js +164 -0
- package/dist/web/static/js/editor/wire-merge-buttons.js +103 -0
- package/dist/web/static/js/editor/wire-selection-controls.js +170 -0
- package/dist/web/static/js/editor/wire-topbar-menus.js +174 -0
- package/dist/web/static/js/editor/wire-topbar-overflow.js +49 -0
- package/dist/web/static/js/editor/wire-topbar.js +188 -0
- package/dist/web/static/js/emailInbox.js +1245 -0
- package/dist/web/static/js/emailLibrary/replyRecipients.js +27 -0
- package/dist/web/static/js/emailLibrary/signatureFold.js +339 -0
- package/dist/web/static/js/emailLibrary/state.js +34 -0
- package/dist/web/static/js/emailLibrary/utils.js +202 -0
- package/dist/web/static/js/emailLibrary.js +5217 -0
- package/dist/web/static/js/emojiPicker.js +311 -0
- package/dist/web/static/js/escMenuStack.js +102 -0
- package/dist/web/static/js/fileHandler.js +295 -0
- package/dist/web/static/js/gallery.js +2835 -0
- package/dist/web/static/js/galleryEditor.js +3798 -0
- package/dist/web/static/js/group.js +955 -0
- package/dist/web/static/js/init.js +405 -0
- package/dist/web/static/js/keyboard-shortcuts.js +292 -0
- package/dist/web/static/js/langIcons.js +187 -0
- package/dist/web/static/js/markdown/tableRow.js +19 -0
- package/dist/web/static/js/markdown.js +806 -0
- package/dist/web/static/js/memory.js +1418 -0
- package/dist/web/static/js/modalManager.js +1552 -0
- package/dist/web/static/js/modalSnap.js +782 -0
- package/dist/web/static/js/model/matchKey.js +19 -0
- package/dist/web/static/js/modelPicker.js +695 -0
- package/dist/web/static/js/modelSort.js +33 -0
- package/dist/web/static/js/models.js +642 -0
- package/dist/web/static/js/notes.js +5054 -0
- package/dist/web/static/js/package.json +1 -0
- package/dist/web/static/js/platform.js +47 -0
- package/dist/web/static/js/presets.js +1110 -0
- package/dist/web/static/js/providers.js +93 -0
- package/dist/web/static/js/rag.js +177 -0
- package/dist/web/static/js/research/jobs.js +335 -0
- package/dist/web/static/js/research/panel.js +1233 -0
- package/dist/web/static/js/researchSynapse.js +225 -0
- package/dist/web/static/js/search-chat.js +201 -0
- package/dist/web/static/js/search.js +52 -0
- package/dist/web/static/js/section-management.js +260 -0
- package/dist/web/static/js/sessions.js +3108 -0
- package/dist/web/static/js/settings.js +4991 -0
- package/dist/web/static/js/sidebar-layout.js +573 -0
- package/dist/web/static/js/signature.js +504 -0
- package/dist/web/static/js/skills.js +1908 -0
- package/dist/web/static/js/slashAutocomplete.js +267 -0
- package/dist/web/static/js/slashCommands.js +6099 -0
- package/dist/web/static/js/spinner.js +406 -0
- package/dist/web/static/js/storage.js +123 -0
- package/dist/web/static/js/tasks.js +2699 -0
- package/dist/web/static/js/theme.js +2086 -0
- package/dist/web/static/js/tileManager.js +386 -0
- package/dist/web/static/js/tourAutoplay.js +133 -0
- package/dist/web/static/js/tourHints.js +179 -0
- package/dist/web/static/js/tts-ai.js +521 -0
- package/dist/web/static/js/ui.js +1288 -0
- package/dist/web/static/js/util/ordinal.js +13 -0
- package/dist/web/static/js/voiceRecorder.js +283 -0
- package/dist/web/static/js/windowDrag.js +326 -0
- package/dist/web/static/js/windowResize.js +233 -0
- package/dist/web/static/landing.html +824 -0
- package/dist/web/static/lib/docx.umd.min.js +20116 -0
- package/dist/web/static/lib/highlight.min.js +1213 -0
- package/dist/web/static/lib/html2pdf.bundle.min.js +3 -0
- package/dist/web/static/lib/mammoth.browser.min.js +21 -0
- package/dist/web/static/lib/qrcode.min.js +8 -0
- package/dist/web/static/lib/xlsx.full.min.js +24 -0
- package/dist/web/static/login.html +582 -0
- package/dist/web/static/manifest.json +15 -0
- package/dist/web/static/style.css +35733 -0
- package/dist/web/static/sw.js +144 -0
- package/dist/workflows/engine.d.ts +162 -0
- package/dist/workflows/engine.d.ts.map +1 -0
- package/dist/workflows/engine.js +625 -0
- package/dist/workflows/engine.js.map +1 -0
- package/dist/workflows/index.d.ts +8 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +14 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform-drag tool — handle drag interactions for the Transform
|
|
3
|
+
* tool (resize via corner/edge handles, rotation via the rot grip).
|
|
4
|
+
*
|
|
5
|
+
* The transform UI runs in TWO modes: the floating popup (W/H/rot
|
|
6
|
+
* numeric inputs, lives elsewhere) AND direct drag on the canvas
|
|
7
|
+
* handles. Both ultimately mutate `state.transformPendingW/H/Rot` and
|
|
8
|
+
* call `reapplyTransform()` to redraw. This module owns the drag
|
|
9
|
+
* branch.
|
|
10
|
+
*
|
|
11
|
+
* The dispatcher in galleryEditor.js calls `tryBegin/tryContinue/
|
|
12
|
+
* tryEnd` which return `true` when the event was for the transform
|
|
13
|
+
* tool and was handled (so the dispatcher can short-circuit).
|
|
14
|
+
*
|
|
15
|
+
* @param {{
|
|
16
|
+
* beginMove: (e: Event) => void,
|
|
17
|
+
* composite: () => void,
|
|
18
|
+
* drawTransformHandles: () => void,
|
|
19
|
+
* reapplyTransform: () => void,
|
|
20
|
+
* getTransformHandle: (x: number, y: number) => string | null,
|
|
21
|
+
* cursorForHandle: (id: string | null) => string,
|
|
22
|
+
* }} deps
|
|
23
|
+
*/
|
|
24
|
+
import { state } from '../state.js';
|
|
25
|
+
import { canvasCoords } from '../canvas-coords.js';
|
|
26
|
+
|
|
27
|
+
export function createTransformDragTool({
|
|
28
|
+
beginMove, composite, drawTransformHandles, reapplyTransform,
|
|
29
|
+
getTransformHandle, cursorForHandle,
|
|
30
|
+
}) {
|
|
31
|
+
return {
|
|
32
|
+
/**
|
|
33
|
+
* Called on pointerdown. Returns true if the transform tool handled
|
|
34
|
+
* the event (the dispatcher should NOT fall through to other tools).
|
|
35
|
+
*/
|
|
36
|
+
tryBegin(e) {
|
|
37
|
+
if (!state.transformActive) return false;
|
|
38
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
39
|
+
state.transformHandle = getTransformHandle(coords.x, coords.y);
|
|
40
|
+
if (state.transformHandle) {
|
|
41
|
+
state.transformStartX = coords.x;
|
|
42
|
+
state.transformStartY = coords.y;
|
|
43
|
+
// Snapshot offset + size at drag-start so each frame computes
|
|
44
|
+
// "start + dx" (correct delta) rather than accumulating off the
|
|
45
|
+
// running offset, which was making top/left grabs drift.
|
|
46
|
+
const layer = state.transformLayer;
|
|
47
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
48
|
+
state.transformStartOffX = off.x;
|
|
49
|
+
state.transformStartOffY = off.y;
|
|
50
|
+
state.transformOrigW = layer.canvas.width;
|
|
51
|
+
state.transformOrigH = layer.canvas.height;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
// No corner hit — if click inside the layer's bounding box, act
|
|
55
|
+
// like Move so the user can drag the layer around without
|
|
56
|
+
// switching tools.
|
|
57
|
+
if (state.transformLayer) {
|
|
58
|
+
const off = state.layerOffsets.get(state.transformLayer.id) || { x: 0, y: 0 };
|
|
59
|
+
const w = state.transformLayer.canvas.width;
|
|
60
|
+
const h = state.transformLayer.canvas.height;
|
|
61
|
+
if (coords.x >= off.x && coords.x <= off.x + w &&
|
|
62
|
+
coords.y >= off.y && coords.y <= off.y + h) {
|
|
63
|
+
beginMove(e);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Called on pointermove. Returns true if handled.
|
|
72
|
+
*
|
|
73
|
+
* When transformActive but no handle is grabbed, updates the
|
|
74
|
+
* hover cursor + pulse. When a handle is grabbed, drives the
|
|
75
|
+
* resize / rotation pipeline.
|
|
76
|
+
*/
|
|
77
|
+
tryContinue(e) {
|
|
78
|
+
if (!state.transformActive) return false;
|
|
79
|
+
// No drag in progress — just hover-cursor + pulse.
|
|
80
|
+
if (!state.transformHandle && state.mainCanvas) {
|
|
81
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
82
|
+
const hovered = getTransformHandle(coords.x, coords.y);
|
|
83
|
+
state.mainCanvas.style.cursor = hovered ? cursorForHandle(hovered) : 'default';
|
|
84
|
+
if (hovered !== state.hoveredHandle) {
|
|
85
|
+
state.hoveredHandle = hovered;
|
|
86
|
+
composite();
|
|
87
|
+
}
|
|
88
|
+
return false; // didn't fully consume the event
|
|
89
|
+
}
|
|
90
|
+
if (!state.transformHandle) return false;
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
93
|
+
// Rotation grip — angle measured from the layer's geometric
|
|
94
|
+
// centre to the cursor. Mirror into the popup if it's open.
|
|
95
|
+
if (state.transformHandle === 'rot') {
|
|
96
|
+
const layer = state.transformLayer;
|
|
97
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
98
|
+
const cx = off.x + layer.canvas.width / 2;
|
|
99
|
+
const cy = off.y + layer.canvas.height / 2;
|
|
100
|
+
const rad = Math.atan2(coords.y - cy, coords.x - cx) + Math.PI / 2;
|
|
101
|
+
let deg = Math.round((rad * 180) / Math.PI);
|
|
102
|
+
if (e.shiftKey) deg = Math.round(deg / 15) * 15; // 15° snap
|
|
103
|
+
while (deg > 180) deg -= 360;
|
|
104
|
+
while (deg <= -180) deg += 360;
|
|
105
|
+
state.transformPendingRot = deg;
|
|
106
|
+
reapplyTransform();
|
|
107
|
+
if (state.transformPopup) {
|
|
108
|
+
const rotIn = state.transformPopup.querySelector('#ge-transform-rot');
|
|
109
|
+
if (rotIn) rotIn.value = String(deg);
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
// Resize via corner / edge handle.
|
|
114
|
+
const dx = coords.x - state.transformStartX;
|
|
115
|
+
const dy = coords.y - state.transformStartY;
|
|
116
|
+
const layer = state.transformLayer;
|
|
117
|
+
let newW = layer.canvas.width;
|
|
118
|
+
let newH = layer.canvas.height;
|
|
119
|
+
if (state.transformHandle.includes('r')) newW = state.transformOrigW + dx;
|
|
120
|
+
if (state.transformHandle.includes('l')) newW = state.transformOrigW - dx;
|
|
121
|
+
if (state.transformHandle.includes('b')) newH = state.transformOrigH + dy;
|
|
122
|
+
if (state.transformHandle.includes('t')) newH = state.transformOrigH - dy;
|
|
123
|
+
// Shift = lock aspect ratio. Use whichever axis moved more
|
|
124
|
+
// (relative to the original) as the driver.
|
|
125
|
+
if (e.shiftKey && state.transformOrigW > 0 && state.transformOrigH > 0) {
|
|
126
|
+
const aspect = state.transformOrigW / state.transformOrigH;
|
|
127
|
+
const wDelta = Math.abs(newW - state.transformOrigW);
|
|
128
|
+
const hDelta = Math.abs(newH - state.transformOrigH);
|
|
129
|
+
if (wDelta >= hDelta) {
|
|
130
|
+
newH = Math.max(1, Math.round(newW / aspect));
|
|
131
|
+
} else {
|
|
132
|
+
newW = Math.max(1, Math.round(newH * aspect));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
newW = Math.max(1, Math.round(newW));
|
|
136
|
+
newH = Math.max(1, Math.round(newH));
|
|
137
|
+
// Route through the popup-driven pipeline so popup + drag stay
|
|
138
|
+
// in sync. Anchor the opposite corner via transformOrigOffset so
|
|
139
|
+
// handles don't slide while the user drags.
|
|
140
|
+
state.transformPendingW = newW;
|
|
141
|
+
state.transformPendingH = newH;
|
|
142
|
+
const anchorOffX = state.transformStartOffX +
|
|
143
|
+
(state.transformHandle.includes('l') ? (state.transformOrigW - newW) : 0);
|
|
144
|
+
const anchorOffY = state.transformStartOffY +
|
|
145
|
+
(state.transformHandle.includes('t') ? (state.transformOrigH - newH) : 0);
|
|
146
|
+
state.transformOrigOffset = {
|
|
147
|
+
x: anchorOffX + newW / 2 - state.transformOrigW / 2,
|
|
148
|
+
y: anchorOffY + newH / 2 - state.transformOrigH / 2,
|
|
149
|
+
};
|
|
150
|
+
reapplyTransform();
|
|
151
|
+
// Mirror the new W/H into the popup if it's open.
|
|
152
|
+
if (state.transformPopup) {
|
|
153
|
+
const wIn = state.transformPopup.querySelector('#ge-transform-w');
|
|
154
|
+
const hIn = state.transformPopup.querySelector('#ge-transform-h');
|
|
155
|
+
if (wIn) wIn.value = String(state.transformPendingFlipH ? -newW : newW);
|
|
156
|
+
if (hIn) hIn.value = String(state.transformPendingFlipV ? -newH : newH);
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Called on pointerup. Returns true if handled.
|
|
163
|
+
*/
|
|
164
|
+
tryEnd() {
|
|
165
|
+
if (!(state.transformActive && state.transformHandle)) return false;
|
|
166
|
+
state.transformHandle = null;
|
|
167
|
+
state.transformOrigW = state.transformLayer?.canvas.width || 0;
|
|
168
|
+
state.transformOrigH = state.transformLayer?.canvas.height || 0;
|
|
169
|
+
composite();
|
|
170
|
+
drawTransformHandles();
|
|
171
|
+
return true;
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform-tool handle rendering + hit-testing + overlay sync.
|
|
3
|
+
*
|
|
4
|
+
* Lives separately from `transform-drag.js` (which owns the drag
|
|
5
|
+
* STATE MACHINE) because these three helpers are pure geometry that
|
|
6
|
+
* happens to read shared state — they don't track in-progress drags,
|
|
7
|
+
* they just paint and hit-test.
|
|
8
|
+
*
|
|
9
|
+
* - `syncOverlay(margin)` positions the overlay canvas + sizes its
|
|
10
|
+
* bitmap based on the main canvas + zoom.
|
|
11
|
+
* - `drawHandles(margin)` draws the rotated bounding outline + 4
|
|
12
|
+
* corner handles + the rotation knob (with
|
|
13
|
+
* hover / active visual states).
|
|
14
|
+
* - `getHandleAt(x, y)` returns the handle id under (x, y), or
|
|
15
|
+
* null. Geometry MUST mirror `drawHandles`
|
|
16
|
+
* exactly or the user grabs phantom points.
|
|
17
|
+
*
|
|
18
|
+
* No event listeners attached here — the dispatcher in
|
|
19
|
+
* editor/tools/transform-drag.js calls `getHandleAt` and routes
|
|
20
|
+
* pointer events.
|
|
21
|
+
*/
|
|
22
|
+
import { state } from '../state.js';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Position the transform overlay canvas + size its backing bitmap.
|
|
26
|
+
* Margin is the image-space slack each side so handles can render
|
|
27
|
+
* outside the main canvas (matches _TRANSFORM_OVERLAY_MARGIN in
|
|
28
|
+
* galleryEditor.js — kept as a parameter so this module has no
|
|
29
|
+
* dependency on a magic number defined elsewhere).
|
|
30
|
+
*/
|
|
31
|
+
export function syncOverlay(margin) {
|
|
32
|
+
if (!state.transformOverlay || !state.mainCanvas) return;
|
|
33
|
+
if (!state.transformActive) {
|
|
34
|
+
state.transformOverlay.style.display = 'none';
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const W = state.mainCanvas.width + 2 * margin;
|
|
38
|
+
const H = state.mainCanvas.height + 2 * margin;
|
|
39
|
+
if (state.transformOverlay.width !== W) state.transformOverlay.width = W;
|
|
40
|
+
if (state.transformOverlay.height !== H) state.transformOverlay.height = H;
|
|
41
|
+
// Overlay must scale with state.zoom so its handles render at the
|
|
42
|
+
// SAME on-screen size as the main canvas content. Without this, the
|
|
43
|
+
// overlay renders at full bitmap size while main canvas shrinks
|
|
44
|
+
// (zoomed-out), making handles look massive.
|
|
45
|
+
state.transformOverlay.style.display = '';
|
|
46
|
+
state.transformOverlay.style.position = 'absolute';
|
|
47
|
+
state.transformOverlay.style.width = (W * state.zoom) + 'px';
|
|
48
|
+
state.transformOverlay.style.height = (H * state.zoom) + 'px';
|
|
49
|
+
state.transformOverlay.style.pointerEvents = 'none';
|
|
50
|
+
state.transformOverlay.style.zIndex = '5';
|
|
51
|
+
// Position the overlay at the main canvas's LAYOUT position
|
|
52
|
+
// (offsetLeft/Top — unaffected by CSS transforms), shifted up-left by
|
|
53
|
+
// the overlay's `margin` image-px of handle slack. Then SHARE the
|
|
54
|
+
// canvas's transform (the pan handler writes the same translate3d to
|
|
55
|
+
// both canvas + overlay), so pan moves them together. Reading the
|
|
56
|
+
// layout offset (not getBoundingClientRect, which includes the pan
|
|
57
|
+
// transform) is what avoids the double-pan "bounce".
|
|
58
|
+
state.transformOverlay.style.left = Math.round(state.mainCanvas.offsetLeft - margin * state.zoom) + 'px';
|
|
59
|
+
state.transformOverlay.style.top = Math.round(state.mainCanvas.offsetTop - margin * state.zoom) + 'px';
|
|
60
|
+
state.transformOverlay.style.transform = state.mainCanvas.style.transform || 'none';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Compute the on-screen position of the rotation knob given the
|
|
66
|
+
* layer's bbox center + rotation. The knob normally sits OUTSIDE the
|
|
67
|
+
* top edge of the rotated layer; if that would land beyond the canvas
|
|
68
|
+
* viewport, flip it INSIDE.
|
|
69
|
+
*
|
|
70
|
+
* Returned by `_knobPosition` and shared by drawHandles + getHandleAt
|
|
71
|
+
* so both compute the same point.
|
|
72
|
+
*/
|
|
73
|
+
function knobPosition(cxh, cyh, rotRad, baseInnerR, rotOffset) {
|
|
74
|
+
let rotInside = false;
|
|
75
|
+
const outsideR = baseInnerR + rotOffset;
|
|
76
|
+
const knobLocalX = cxh + Math.sin(rotRad) * outsideR;
|
|
77
|
+
const knobLocalY = cyh - Math.cos(rotRad) * outsideR;
|
|
78
|
+
// Primary check: anything drawn outside the main canvas's pixel
|
|
79
|
+
// buffer is invisible (canvas operations clip silently).
|
|
80
|
+
if (
|
|
81
|
+
knobLocalX < 0 || knobLocalY < 0 ||
|
|
82
|
+
knobLocalX > state.mainCanvas.width || knobLocalY > state.mainCanvas.height
|
|
83
|
+
) {
|
|
84
|
+
rotInside = true;
|
|
85
|
+
}
|
|
86
|
+
// Secondary check: even if the knob is inside the canvas bitmap, the
|
|
87
|
+
// viewport may have scrolled the canvas such that the knob falls
|
|
88
|
+
// outside the visible canvas-area window.
|
|
89
|
+
try {
|
|
90
|
+
const area = state.container && state.container.querySelector('.ge-canvas-area');
|
|
91
|
+
if (area && !rotInside) {
|
|
92
|
+
const aRect = area.getBoundingClientRect();
|
|
93
|
+
const mRect = state.mainCanvas.getBoundingClientRect();
|
|
94
|
+
const scaleX = mRect.width / state.mainCanvas.width;
|
|
95
|
+
const scaleY = mRect.height / state.mainCanvas.height;
|
|
96
|
+
const knobClientX = mRect.left + knobLocalX * scaleX;
|
|
97
|
+
const knobClientY = mRect.top + knobLocalY * scaleY;
|
|
98
|
+
if (knobClientY < aRect.top + 6) rotInside = true;
|
|
99
|
+
if (knobClientX < aRect.left + 6 || knobClientX > aRect.right - 6) rotInside = true;
|
|
100
|
+
}
|
|
101
|
+
} catch {}
|
|
102
|
+
const innerR = rotInside ? Math.max(4, baseInnerR - rotOffset) : baseInnerR;
|
|
103
|
+
const rotR = rotInside ? innerR : baseInnerR + rotOffset;
|
|
104
|
+
return {
|
|
105
|
+
rotInside,
|
|
106
|
+
innerR,
|
|
107
|
+
rotX: cxh + Math.sin(rotRad) * rotR,
|
|
108
|
+
rotY: cyh - Math.cos(rotRad) * rotR,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Draw the rotated bounding outline + 4 corner handles + the rotation
|
|
115
|
+
* knob into the overlay canvas. The overlay is translated by `margin`
|
|
116
|
+
* so image (0,0) maps to overlay (margin, margin).
|
|
117
|
+
*/
|
|
118
|
+
export function drawHandles(margin) {
|
|
119
|
+
if (!state.transformActive || !state.transformLayer) return;
|
|
120
|
+
syncOverlay(margin);
|
|
121
|
+
if (!state.transformOverlayCtx) return;
|
|
122
|
+
const layer = state.transformLayer;
|
|
123
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
124
|
+
const w = layer.canvas.width;
|
|
125
|
+
const h = layer.canvas.height;
|
|
126
|
+
const ctx = state.transformOverlayCtx;
|
|
127
|
+
// Clear + shift drawing by margin so image (0,0) maps to overlay (M,M).
|
|
128
|
+
ctx.clearRect(0, 0, state.transformOverlay.width, state.transformOverlay.height);
|
|
129
|
+
ctx.save();
|
|
130
|
+
ctx.translate(margin, margin);
|
|
131
|
+
// Zoom-corrected handle size + stroke so they stay readable at any zoom.
|
|
132
|
+
const sz = 10 / state.zoom;
|
|
133
|
+
const stroke = 1.5 / state.zoom;
|
|
134
|
+
|
|
135
|
+
// Pre-rotation rectangle dims (what the user sees the layer as).
|
|
136
|
+
// Falls back to layer bbox before any popup values exist.
|
|
137
|
+
const preW = state.transformPendingW || w;
|
|
138
|
+
const preH = state.transformPendingH || h;
|
|
139
|
+
const cxBox = off.x + w / 2;
|
|
140
|
+
const cyBox = off.y + h / 2;
|
|
141
|
+
const rotRadBox = ((state.transformPendingRot || 0) * Math.PI) / 180;
|
|
142
|
+
const cosBox = Math.cos(rotRadBox);
|
|
143
|
+
const sinBox = Math.sin(rotRadBox);
|
|
144
|
+
const rotPt = (dx, dy) => ({
|
|
145
|
+
x: cxBox + dx * cosBox - dy * sinBox,
|
|
146
|
+
y: cyBox + dx * sinBox + dy * cosBox,
|
|
147
|
+
});
|
|
148
|
+
const tl = rotPt(-preW / 2, -preH / 2);
|
|
149
|
+
const tr = rotPt( preW / 2, -preH / 2);
|
|
150
|
+
const br = rotPt( preW / 2, preH / 2);
|
|
151
|
+
const bl = rotPt(-preW / 2, preH / 2);
|
|
152
|
+
|
|
153
|
+
// Outline of the rotated rectangle — solid white inner line with a
|
|
154
|
+
// thin black halo for contrast on light AND dark backgrounds.
|
|
155
|
+
const drawRectOutline = () => {
|
|
156
|
+
ctx.beginPath();
|
|
157
|
+
ctx.moveTo(tl.x, tl.y);
|
|
158
|
+
ctx.lineTo(tr.x, tr.y);
|
|
159
|
+
ctx.lineTo(br.x, br.y);
|
|
160
|
+
ctx.lineTo(bl.x, bl.y);
|
|
161
|
+
ctx.closePath();
|
|
162
|
+
ctx.stroke();
|
|
163
|
+
};
|
|
164
|
+
ctx.lineWidth = 1 / state.zoom;
|
|
165
|
+
ctx.strokeStyle = 'rgba(0, 0, 0, 0.45)';
|
|
166
|
+
ctx.setLineDash([6 / state.zoom, 4 / state.zoom]);
|
|
167
|
+
ctx.lineDashOffset = 1 / state.zoom;
|
|
168
|
+
drawRectOutline();
|
|
169
|
+
ctx.strokeStyle = '#fff';
|
|
170
|
+
ctx.lineDashOffset = 0;
|
|
171
|
+
drawRectOutline();
|
|
172
|
+
ctx.setLineDash([]);
|
|
173
|
+
|
|
174
|
+
// Corner handles + rotation knob anchored to the rotated layer's
|
|
175
|
+
// top-center (not bbox top), so the knob stays attached to the
|
|
176
|
+
// visible content as it spins.
|
|
177
|
+
const rotOffset = 24 / state.zoom;
|
|
178
|
+
const cxh = off.x + w / 2;
|
|
179
|
+
const cyh = off.y + h / 2;
|
|
180
|
+
const rotRad = ((state.transformPendingRot || 0) * Math.PI) / 180;
|
|
181
|
+
const baseInnerR = (state.transformPendingH || h) / 2;
|
|
182
|
+
const knob = knobPosition(cxh, cyh, rotRad, baseInnerR, rotOffset);
|
|
183
|
+
// Tether line collapses to a point when knob is inside the layer.
|
|
184
|
+
const drawTether = !knob.rotInside;
|
|
185
|
+
const innerX = cxh + Math.sin(rotRad) * baseInnerR;
|
|
186
|
+
const innerY = cyh - Math.cos(rotRad) * baseInnerR;
|
|
187
|
+
const corners = [
|
|
188
|
+
{ x: tl.x, y: tl.y, id: 'tl' },
|
|
189
|
+
{ x: tr.x, y: tr.y, id: 'tr' },
|
|
190
|
+
{ x: br.x, y: br.y, id: 'br' },
|
|
191
|
+
{ x: bl.x, y: bl.y, id: 'bl' },
|
|
192
|
+
{ x: knob.rotX, y: knob.rotY, id: 'rot' },
|
|
193
|
+
];
|
|
194
|
+
if (drawTether) {
|
|
195
|
+
ctx.beginPath();
|
|
196
|
+
ctx.moveTo(innerX, innerY);
|
|
197
|
+
ctx.lineTo(knob.rotX, knob.rotY);
|
|
198
|
+
ctx.strokeStyle = 'rgba(255, 255, 255, 0.7)';
|
|
199
|
+
ctx.lineWidth = 1 / state.zoom;
|
|
200
|
+
ctx.stroke();
|
|
201
|
+
}
|
|
202
|
+
for (const c of corners) {
|
|
203
|
+
const active = c.id === state.transformHandle;
|
|
204
|
+
const hovered = !active && c.id === state.hoveredHandle;
|
|
205
|
+
const radius = (active ? sz * 0.75 : hovered ? sz * 0.6 : sz / 2);
|
|
206
|
+
ctx.beginPath();
|
|
207
|
+
ctx.arc(c.x, c.y, radius, 0, Math.PI * 2);
|
|
208
|
+
ctx.fillStyle = active ? '#e06c75' : hovered ? '#ffd' : '#fff';
|
|
209
|
+
ctx.fill();
|
|
210
|
+
ctx.lineWidth = stroke;
|
|
211
|
+
ctx.strokeStyle = active ? '#fff' : 'rgba(0, 0, 0, 0.5)';
|
|
212
|
+
ctx.stroke();
|
|
213
|
+
if (hovered) {
|
|
214
|
+
// Subtle red ring around the hovered handle for visual feedback.
|
|
215
|
+
ctx.beginPath();
|
|
216
|
+
ctx.arc(c.x, c.y, radius + 2 / state.zoom, 0, Math.PI * 2);
|
|
217
|
+
ctx.strokeStyle = 'rgba(224, 108, 117, 0.7)';
|
|
218
|
+
ctx.lineWidth = stroke;
|
|
219
|
+
ctx.stroke();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
ctx.restore();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Hit-test (x, y) against the transform handles. Returns the handle
|
|
228
|
+
* id ('tl' | 'tr' | 'br' | 'bl' | 'rot') or null.
|
|
229
|
+
*
|
|
230
|
+
* Geometry MUST mirror `drawHandles` exactly, otherwise the user
|
|
231
|
+
* grabs phantom points.
|
|
232
|
+
*/
|
|
233
|
+
export function getHandleAt(x, y) {
|
|
234
|
+
if (!state.transformLayer) return null;
|
|
235
|
+
const layer = state.transformLayer;
|
|
236
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
237
|
+
const w = layer.canvas.width;
|
|
238
|
+
const h = layer.canvas.height;
|
|
239
|
+
const threshold = 8 / state.zoom;
|
|
240
|
+
const rotOffset = 24 / state.zoom;
|
|
241
|
+
const cxh = off.x + w / 2;
|
|
242
|
+
const cyh = off.y + h / 2;
|
|
243
|
+
const rotRad = ((state.transformPendingRot || 0) * Math.PI) / 180;
|
|
244
|
+
const baseInnerR = (state.transformPendingH || h) / 2;
|
|
245
|
+
const knob = knobPosition(cxh, cyh, rotRad, baseInnerR, rotOffset);
|
|
246
|
+
|
|
247
|
+
// Rotate corners around centre — must match drawHandles.
|
|
248
|
+
const preW = state.transformPendingW || w;
|
|
249
|
+
const preH = state.transformPendingH || h;
|
|
250
|
+
const cosA = Math.cos(rotRad);
|
|
251
|
+
const sinA = Math.sin(rotRad);
|
|
252
|
+
const rotCorner = (dx, dy) => ({
|
|
253
|
+
x: cxh + dx * cosA - dy * sinA,
|
|
254
|
+
y: cyh + dx * sinA + dy * cosA,
|
|
255
|
+
});
|
|
256
|
+
const tlH = rotCorner(-preW / 2, -preH / 2);
|
|
257
|
+
const trH = rotCorner( preW / 2, -preH / 2);
|
|
258
|
+
const brH = rotCorner( preW / 2, preH / 2);
|
|
259
|
+
const blH = rotCorner(-preW / 2, preH / 2);
|
|
260
|
+
const handles = [
|
|
261
|
+
{ x: tlH.x, y: tlH.y, id: 'tl' },
|
|
262
|
+
{ x: trH.x, y: trH.y, id: 'tr' },
|
|
263
|
+
{ x: brH.x, y: brH.y, id: 'br' },
|
|
264
|
+
{ x: blH.x, y: blH.y, id: 'bl' },
|
|
265
|
+
{ x: knob.rotX, y: knob.rotY, id: 'rot' },
|
|
266
|
+
];
|
|
267
|
+
for (const c of handles) {
|
|
268
|
+
if (Math.abs(x - c.x) < threshold && Math.abs(y - c.y) < threshold) return c.id;
|
|
269
|
+
}
|
|
270
|
+
return null;
|
|
271
|
+
}
|