@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,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a pointer event's client coordinates into the canvas's
|
|
3
|
+
* internal pixel coordinates, accounting for current display scale.
|
|
4
|
+
*
|
|
5
|
+
* Handles both mouse and the first finger of a touch event.
|
|
6
|
+
*
|
|
7
|
+
* @param {MouseEvent|TouchEvent} e
|
|
8
|
+
* @param {HTMLCanvasElement} canvas
|
|
9
|
+
* @returns {{x: number, y: number}}
|
|
10
|
+
*/
|
|
11
|
+
export function canvasCoords(e, canvas) {
|
|
12
|
+
const rect = canvas.getBoundingClientRect();
|
|
13
|
+
const scaleX = canvas.width / rect.width;
|
|
14
|
+
const scaleY = canvas.height / rect.height;
|
|
15
|
+
const clientX = e.touches ? e.touches[0].clientX : e.clientX;
|
|
16
|
+
const clientY = e.touches ? e.touches[0].clientY : e.clientY;
|
|
17
|
+
return {
|
|
18
|
+
x: (clientX - rect.left) * scaleX,
|
|
19
|
+
y: (clientY - rect.top) * scaleY,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas event wiring — mouse, touch (including pinch-zoom on two
|
|
3
|
+
* fingers), and the canvas-area pan handler.
|
|
4
|
+
*
|
|
5
|
+
* Mouse:
|
|
6
|
+
* mousedown on canvas → beginDraw
|
|
7
|
+
* mousemove on window → continueDraw (window so a drag can
|
|
8
|
+
* continue past the canvas edge)
|
|
9
|
+
* mouseup on window → endDraw
|
|
10
|
+
* mouseenter/mouseleave → show/hide the brush-cursor overlay
|
|
11
|
+
* mousedown on canvas-area (NOT on the canvas itself, lasso only)
|
|
12
|
+
* → beginDraw (lasso starts outside canvas)
|
|
13
|
+
*
|
|
14
|
+
* Touch:
|
|
15
|
+
* touchstart 1 finger → beginDraw
|
|
16
|
+
* touchmove 1 finger → continueDraw
|
|
17
|
+
* touchend / touchcancel → endDraw
|
|
18
|
+
* touchstart 2 fingers → pinch-zoom + 2-finger pan
|
|
19
|
+
*
|
|
20
|
+
* Pan (any free space around the canvas):
|
|
21
|
+
* pointerdown / pointermove / pointerup on canvas-area, skipping
|
|
22
|
+
* the canvas + transform overlay + UI elements above them. Sets
|
|
23
|
+
* canvasArea.dataset.panX/Y + CSS transform on both canvases.
|
|
24
|
+
*
|
|
25
|
+
* Exposes `canvasArea._resetPan()` so the zoom/fit reset can clear
|
|
26
|
+
* the pan offset.
|
|
27
|
+
*
|
|
28
|
+
* @param {{
|
|
29
|
+
* canvasArea: HTMLDivElement,
|
|
30
|
+
* beginDraw: (e: Event) => void,
|
|
31
|
+
* continueDraw: (e: Event) => void,
|
|
32
|
+
* endDraw: (e?: Event) => void,
|
|
33
|
+
* updateBrushCursor: (e: Event) => void,
|
|
34
|
+
* syncZoomControls?: () => void,
|
|
35
|
+
* }} ctx
|
|
36
|
+
*/
|
|
37
|
+
import { state } from './state.js';
|
|
38
|
+
|
|
39
|
+
export function wireCanvasEvents({ canvasArea, beginDraw, continueDraw, endDraw, updateBrushCursor, syncZoomControls }) {
|
|
40
|
+
// Mouse — mousedown stays on the canvas; mousemove/up are bound to
|
|
41
|
+
// the WINDOW so a drag can continue (and end) past the canvas edge.
|
|
42
|
+
// Critical for the Resize tool where users overshoot.
|
|
43
|
+
state.mainCanvas.addEventListener('mousedown', beginDraw);
|
|
44
|
+
window.addEventListener('mousemove', continueDraw);
|
|
45
|
+
window.addEventListener('mouseup', endDraw);
|
|
46
|
+
// Lasso can start OUTSIDE the canvas — fallback mousedown on the
|
|
47
|
+
// surrounding canvas-area so the user can begin a lasso path in
|
|
48
|
+
// the empty space around the image. Other tools stay canvas-only.
|
|
49
|
+
canvasArea.addEventListener('mousedown', (e) => {
|
|
50
|
+
if (state.tool !== 'lasso') return;
|
|
51
|
+
if (e.target === state.mainCanvas) return; // already handled
|
|
52
|
+
beginDraw(e);
|
|
53
|
+
});
|
|
54
|
+
state.mainCanvas.addEventListener('mouseenter', (e) => {
|
|
55
|
+
if (['brush', 'eraser', 'inpaint', 'lasso', 'clone'].includes(state.tool)) updateBrushCursor(e);
|
|
56
|
+
});
|
|
57
|
+
state.mainCanvas.addEventListener('mouseleave', () => {
|
|
58
|
+
// Only hide the brush-cursor overlay on leave — DO NOT end the
|
|
59
|
+
// drag, so the user can drag a resize handle past the canvas edge.
|
|
60
|
+
if (state.cursorEl) state.cursorEl.style.display = 'none';
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Touch — single finger draws; two fingers pan + pinch-zoom.
|
|
64
|
+
let multiActive = false;
|
|
65
|
+
let multiStartDist = 0;
|
|
66
|
+
let multiStartZoom = 1;
|
|
67
|
+
let multiStartCenter = { x: 0, y: 0 };
|
|
68
|
+
let multiStartPan = { x: 0, y: 0 };
|
|
69
|
+
const touchInfo = (e) => {
|
|
70
|
+
const t1 = e.touches[0], t2 = e.touches[1];
|
|
71
|
+
const cx = (t1.clientX + t2.clientX) / 2;
|
|
72
|
+
const cy = (t1.clientY + t2.clientY) / 2;
|
|
73
|
+
const dx = t2.clientX - t1.clientX;
|
|
74
|
+
const dy = t2.clientY - t1.clientY;
|
|
75
|
+
return { cx, cy, dist: Math.hypot(dx, dy) };
|
|
76
|
+
};
|
|
77
|
+
const applyCanvasOffset = (x, y) => {
|
|
78
|
+
canvasArea.dataset.panX = String(x);
|
|
79
|
+
canvasArea.dataset.panY = String(y);
|
|
80
|
+
const t = `translate3d(${x}px, ${y}px, 0)`;
|
|
81
|
+
state.mainCanvas.style.transform = t;
|
|
82
|
+
if (state.transformOverlay) state.transformOverlay.style.transform = t;
|
|
83
|
+
};
|
|
84
|
+
state.mainCanvas.addEventListener('touchstart', (e) => {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
if (e.touches.length >= 2) {
|
|
87
|
+
// End any in-progress single-finger draw before switching modes.
|
|
88
|
+
if (!multiActive) endDraw();
|
|
89
|
+
multiActive = true;
|
|
90
|
+
const info = touchInfo(e);
|
|
91
|
+
multiStartDist = info.dist;
|
|
92
|
+
multiStartZoom = state.zoom;
|
|
93
|
+
multiStartCenter = { x: info.cx, y: info.cy };
|
|
94
|
+
multiStartPan = {
|
|
95
|
+
x: parseFloat(canvasArea.dataset.panX || '0') || 0,
|
|
96
|
+
y: parseFloat(canvasArea.dataset.panY || '0') || 0,
|
|
97
|
+
};
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (multiActive) return;
|
|
101
|
+
beginDraw(e);
|
|
102
|
+
}, { passive: false });
|
|
103
|
+
state.mainCanvas.addEventListener('touchmove', (e) => {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
if (multiActive && e.touches.length >= 2) {
|
|
106
|
+
const info = touchInfo(e);
|
|
107
|
+
const ratio = info.dist / Math.max(1, multiStartDist);
|
|
108
|
+
const newZoom = Math.max(0.1, Math.min(5, multiStartZoom * ratio));
|
|
109
|
+
if (Math.abs(newZoom - state.zoom) > 0.001) {
|
|
110
|
+
state.zoom = newZoom;
|
|
111
|
+
state.mainCanvas.style.width = (state.imgWidth * state.zoom) + 'px';
|
|
112
|
+
state.mainCanvas.style.height = (state.imgHeight * state.zoom) + 'px';
|
|
113
|
+
const label = state.container.querySelector('.ge-zoom-label');
|
|
114
|
+
if (label) label.textContent = Math.round(state.zoom * 100) + '%';
|
|
115
|
+
syncZoomControls?.();
|
|
116
|
+
}
|
|
117
|
+
const dx = info.cx - multiStartCenter.x;
|
|
118
|
+
const dy = info.cy - multiStartCenter.y;
|
|
119
|
+
applyCanvasOffset(multiStartPan.x + dx, multiStartPan.y + dy);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (multiActive) return;
|
|
123
|
+
continueDraw(e);
|
|
124
|
+
}, { passive: false });
|
|
125
|
+
state.mainCanvas.addEventListener('touchend', (e) => {
|
|
126
|
+
if (multiActive) {
|
|
127
|
+
if (e.touches.length < 2) multiActive = false;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
endDraw(e);
|
|
131
|
+
});
|
|
132
|
+
state.mainCanvas.addEventListener('touchcancel', () => {
|
|
133
|
+
multiActive = false;
|
|
134
|
+
endDraw();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Press-and-drag in the empty space AROUND the canvas pans the
|
|
138
|
+
// canvas + overlay via CSS transform. Works even when the image
|
|
139
|
+
// fits the viewport (no scroll needed). Skips presses on the canvas
|
|
140
|
+
// itself (the canvas owns its own drawing input) or on UI elements
|
|
141
|
+
// above it.
|
|
142
|
+
let panning = false;
|
|
143
|
+
let pid = null;
|
|
144
|
+
let startX = 0, startY = 0;
|
|
145
|
+
const getOffset = () => {
|
|
146
|
+
const v = canvasArea.dataset.panX || '0';
|
|
147
|
+
const u = canvasArea.dataset.panY || '0';
|
|
148
|
+
return { x: parseFloat(v) || 0, y: parseFloat(u) || 0 };
|
|
149
|
+
};
|
|
150
|
+
const applyOffset = (x, y) => {
|
|
151
|
+
canvasArea.dataset.panX = String(x);
|
|
152
|
+
canvasArea.dataset.panY = String(y);
|
|
153
|
+
const t = `translate3d(${x}px, ${y}px, 0)`;
|
|
154
|
+
state.mainCanvas.style.transform = t;
|
|
155
|
+
if (state.transformOverlay) state.transformOverlay.style.transform = t;
|
|
156
|
+
};
|
|
157
|
+
canvasArea.addEventListener('pointerdown', (e) => {
|
|
158
|
+
if (state.tool === 'lasso') return;
|
|
159
|
+
if (e.target === state.mainCanvas || e.target === state.transformOverlay) return;
|
|
160
|
+
if (e.target.closest('button, input, .ge-adj-popup, .ge-transform-popup, .ge-fx-popup, .ge-inpaint-popup, .ge-controls, .ge-right-panel, .ge-fx-menu')) return;
|
|
161
|
+
// During an active transform the corner/rotation handles render
|
|
162
|
+
// OUTSIDE the canvas (over the surrounding area), and the overlay is
|
|
163
|
+
// pointer-events:none — so a grab on an outside handle lands here.
|
|
164
|
+
// Route it to the transform tool (getHandleAt works in image space,
|
|
165
|
+
// even for points beyond the canvas) instead of panning the canvas.
|
|
166
|
+
if (state.transformActive) {
|
|
167
|
+
beginDraw(e);
|
|
168
|
+
// Only swallow the event (skip pan) if a handle was grabbed OR the
|
|
169
|
+
// layer-move fallback engaged; otherwise let the pan logic below
|
|
170
|
+
// run so empty space still pans while the transform tool is open.
|
|
171
|
+
if (state.transformHandle || state.moving) return;
|
|
172
|
+
}
|
|
173
|
+
const off = getOffset();
|
|
174
|
+
panning = true;
|
|
175
|
+
pid = e.pointerId;
|
|
176
|
+
startX = e.clientX - off.x;
|
|
177
|
+
startY = e.clientY - off.y;
|
|
178
|
+
try { canvasArea.setPointerCapture(pid); } catch {}
|
|
179
|
+
canvasArea.style.cursor = 'grabbing';
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
});
|
|
182
|
+
canvasArea.addEventListener('pointermove', (e) => {
|
|
183
|
+
if (!panning || e.pointerId !== pid) return;
|
|
184
|
+
applyOffset(e.clientX - startX, e.clientY - startY);
|
|
185
|
+
});
|
|
186
|
+
const endPan = () => {
|
|
187
|
+
if (!panning) return;
|
|
188
|
+
panning = false;
|
|
189
|
+
try { canvasArea.releasePointerCapture(pid); } catch {}
|
|
190
|
+
pid = null;
|
|
191
|
+
canvasArea.style.cursor = '';
|
|
192
|
+
};
|
|
193
|
+
canvasArea.addEventListener('pointerup', endPan);
|
|
194
|
+
canvasArea.addEventListener('pointercancel', endPan);
|
|
195
|
+
// Reset offset whenever zoom/fit changes the canvas size.
|
|
196
|
+
canvasArea._resetPan = () => applyOffset(0, 0);
|
|
197
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whole-document transforms: rotate by 90/180/270° or flip horizontal/
|
|
3
|
+
* vertical. These mutate every layer's canvas + the offset map + the
|
|
4
|
+
* document's overall width/height so the result feels like the whole
|
|
5
|
+
* image rotated as one piece.
|
|
6
|
+
*
|
|
7
|
+
* Pure-ish — reads/writes shared state directly; the factory takes a
|
|
8
|
+
* small dep bag for the orchestration plumbing (undo snapshot, canvas
|
|
9
|
+
* loading overlay, fit-zoom-to-viewport, composite redraw).
|
|
10
|
+
*
|
|
11
|
+
* @param {{
|
|
12
|
+
* saveState: (label?: string) => void,
|
|
13
|
+
* composite: () => void,
|
|
14
|
+
* fitZoom: () => void,
|
|
15
|
+
* showCanvasLoading: (label: string) => void,
|
|
16
|
+
* hideCanvasLoading: () => void,
|
|
17
|
+
* }} deps
|
|
18
|
+
*/
|
|
19
|
+
import { state } from './state.js';
|
|
20
|
+
|
|
21
|
+
export function createCanvasTransforms({ saveState, composite, fitZoom, showCanvasLoading, hideCanvasLoading }) {
|
|
22
|
+
return {
|
|
23
|
+
/**
|
|
24
|
+
* Rotate the entire document by `deg` (90 / 180 / 270). 90 and 270
|
|
25
|
+
* swap canvas dimensions. Each layer is rotated around its own
|
|
26
|
+
* centre, then its centre is rotated around the old image centre
|
|
27
|
+
* and translated into the new image's frame.
|
|
28
|
+
*
|
|
29
|
+
* Wrapped in requestAnimationFrame because the rotation pass can
|
|
30
|
+
* block the UI for 0.5–2 s on big images — the spinner overlay
|
|
31
|
+
* paints before we block.
|
|
32
|
+
*/
|
|
33
|
+
rotateAll(deg) {
|
|
34
|
+
if (!state.layers.length) return;
|
|
35
|
+
saveState(`Rotate ${deg}°`);
|
|
36
|
+
showCanvasLoading('Rotating…');
|
|
37
|
+
const oldW = state.imgWidth, oldH = state.imgHeight;
|
|
38
|
+
const swap = (deg === 90 || deg === 270);
|
|
39
|
+
const newW = swap ? oldH : oldW;
|
|
40
|
+
const newH = swap ? oldW : oldH;
|
|
41
|
+
const rad = (deg * Math.PI) / 180;
|
|
42
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
try {
|
|
45
|
+
for (const layer of state.layers) {
|
|
46
|
+
const lw = layer.canvas.width, lh = layer.canvas.height;
|
|
47
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
48
|
+
// Layer centre in old image coords.
|
|
49
|
+
const cx = off.x + lw / 2;
|
|
50
|
+
const cy = off.y + lh / 2;
|
|
51
|
+
// Rotate the centre around the old image centre and
|
|
52
|
+
// translate so the new image centre lands at (newW/2, newH/2).
|
|
53
|
+
const dx = cx - oldW / 2;
|
|
54
|
+
const dy = cy - oldH / 2;
|
|
55
|
+
const nx = dx * cos - dy * sin + newW / 2;
|
|
56
|
+
const ny = dx * sin + dy * cos + newH / 2;
|
|
57
|
+
// New per-layer dims: swap when 90/270.
|
|
58
|
+
const newLw = swap ? lh : lw;
|
|
59
|
+
const newLh = swap ? lw : lh;
|
|
60
|
+
const tmp = document.createElement('canvas');
|
|
61
|
+
tmp.width = newLw; tmp.height = newLh;
|
|
62
|
+
const tctx = tmp.getContext('2d');
|
|
63
|
+
tctx.translate(newLw / 2, newLh / 2);
|
|
64
|
+
tctx.rotate(rad);
|
|
65
|
+
tctx.drawImage(layer.canvas, -lw / 2, -lh / 2);
|
|
66
|
+
layer.canvas.width = newLw;
|
|
67
|
+
layer.canvas.height = newLh;
|
|
68
|
+
layer.ctx.drawImage(tmp, 0, 0);
|
|
69
|
+
// The adjustment-render caches are keyed only by the adjustment
|
|
70
|
+
// signature, which rotation doesn't change — so composite would draw
|
|
71
|
+
// the STALE pre-rotation cache (the "had to click twice" bug). Drop
|
|
72
|
+
// them so the next composite re-renders from the rotated canvas.
|
|
73
|
+
layer._adjCacheKey = null;
|
|
74
|
+
layer._adjFinalKey = null;
|
|
75
|
+
state.layerOffsets.set(layer.id, {
|
|
76
|
+
x: Math.round(nx - newLw / 2),
|
|
77
|
+
y: Math.round(ny - newLh / 2),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
state.imgWidth = newW;
|
|
81
|
+
state.imgHeight = newH;
|
|
82
|
+
state.mainCanvas.width = newW;
|
|
83
|
+
state.mainCanvas.height = newH;
|
|
84
|
+
if (state.maskCanvas) {
|
|
85
|
+
state.maskCanvas.width = newW;
|
|
86
|
+
state.maskCanvas.height = newH;
|
|
87
|
+
}
|
|
88
|
+
const sizeLabel = document.getElementById('ge-canvas-size');
|
|
89
|
+
if (sizeLabel) sizeLabel.textContent = `${newW}×${newH}`;
|
|
90
|
+
fitZoom();
|
|
91
|
+
composite();
|
|
92
|
+
} finally {
|
|
93
|
+
hideCanvasLoading();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Mirror every layer horizontally ('h') or vertically ('v').
|
|
100
|
+
* Canvas dimensions don't change. Each layer offset is reflected
|
|
101
|
+
* around the image centre.
|
|
102
|
+
*/
|
|
103
|
+
flipAll(axis) {
|
|
104
|
+
if (!state.layers.length) return;
|
|
105
|
+
saveState(axis === 'h' ? 'Flip horizontal' : 'Flip vertical');
|
|
106
|
+
for (const layer of state.layers) {
|
|
107
|
+
const lw = layer.canvas.width, lh = layer.canvas.height;
|
|
108
|
+
const tmp = document.createElement('canvas');
|
|
109
|
+
tmp.width = lw; tmp.height = lh;
|
|
110
|
+
const tctx = tmp.getContext('2d');
|
|
111
|
+
tctx.save();
|
|
112
|
+
if (axis === 'h') { tctx.translate(lw, 0); tctx.scale(-1, 1); }
|
|
113
|
+
else { tctx.translate(0, lh); tctx.scale(1, -1); }
|
|
114
|
+
tctx.drawImage(layer.canvas, 0, 0);
|
|
115
|
+
tctx.restore();
|
|
116
|
+
layer.ctx.clearRect(0, 0, lw, lh);
|
|
117
|
+
layer.ctx.drawImage(tmp, 0, 0);
|
|
118
|
+
// Invalidate the adjustment-render caches (keyed by adjustment sig only)
|
|
119
|
+
// so composite redraws from the flipped canvas, not a stale cache.
|
|
120
|
+
layer._adjCacheKey = null;
|
|
121
|
+
layer._adjFinalKey = null;
|
|
122
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
123
|
+
if (axis === 'h') {
|
|
124
|
+
state.layerOffsets.set(layer.id, { x: state.imgWidth - off.x - lw, y: off.y });
|
|
125
|
+
} else {
|
|
126
|
+
state.layerOffsets.set(layer.id, { x: off.x, y: state.imgHeight - off.y - lh });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
composite();
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paint a transparency-checkerboard pattern across the given canvas
|
|
3
|
+
* context. The editor uses this beneath every layer pass so empty
|
|
4
|
+
* (transparent) areas of the document are visible.
|
|
5
|
+
*
|
|
6
|
+
* Pure function — depends only on its arguments.
|
|
7
|
+
*
|
|
8
|
+
* @param {CanvasRenderingContext2D} ctx
|
|
9
|
+
* @param {number} w Width in canvas pixels.
|
|
10
|
+
* @param {number} h Height in canvas pixels.
|
|
11
|
+
*/
|
|
12
|
+
export function drawCheckerboard(ctx, w, h) {
|
|
13
|
+
const size = 10;
|
|
14
|
+
ctx.fillStyle = '#ccc';
|
|
15
|
+
ctx.fillRect(0, 0, w, h);
|
|
16
|
+
ctx.fillStyle = '#fff';
|
|
17
|
+
for (let y = 0; y < h; y += size) {
|
|
18
|
+
for (let x = 0; x < w; x += size) {
|
|
19
|
+
if ((Math.floor(x / size) + Math.floor(y / size)) % 2 === 0) {
|
|
20
|
+
ctx.fillRect(x, y, size, size);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paste + drag-and-drop import handlers. Both add an image to the
|
|
3
|
+
* editor as a new layer:
|
|
4
|
+
*
|
|
5
|
+
* - Paste (Ctrl+V): checks `state.internalClipboard` first (set by
|
|
6
|
+
* lasso copy/cut), then falls back to the system clipboard's
|
|
7
|
+
* `image/*` items. Layer is named "Pasted Selection" or "Pasted"
|
|
8
|
+
* and becomes active; the tool snaps to Move so the user can
|
|
9
|
+
* reposition it immediately.
|
|
10
|
+
* - Drop: any `image/*` file dragged from the OS / another tab.
|
|
11
|
+
* Shows a "Drop image to add as new layer" overlay mid-drag. Each
|
|
12
|
+
* dropped image is routed through `handleImportedImage` so canvas-
|
|
13
|
+
* resize prompts + undo history work the same as the toolbar
|
|
14
|
+
* Import button.
|
|
15
|
+
*
|
|
16
|
+
* Both gated by `state.editorOpen` so they're inert when the editor
|
|
17
|
+
* is closed (other listeners on the page get first dibs).
|
|
18
|
+
*
|
|
19
|
+
* @param {{
|
|
20
|
+
* container: HTMLElement,
|
|
21
|
+
* saveState: (label?: string) => void,
|
|
22
|
+
* createLayer: (name: string, w: number, h: number) => object,
|
|
23
|
+
* renderLayerPanel: () => void,
|
|
24
|
+
* composite: () => void,
|
|
25
|
+
* handleImportedImage: (img: HTMLImageElement) => void,
|
|
26
|
+
* uiModule: object,
|
|
27
|
+
* }} deps
|
|
28
|
+
*/
|
|
29
|
+
import { state } from './state.js';
|
|
30
|
+
|
|
31
|
+
export function wireClipboardAndDrop({
|
|
32
|
+
container, saveState, createLayer, renderLayerPanel, composite,
|
|
33
|
+
handleImportedImage, uiModule,
|
|
34
|
+
}) {
|
|
35
|
+
// ── Paste ──
|
|
36
|
+
window.addEventListener('paste', (e) => {
|
|
37
|
+
if (!state.editorOpen) return;
|
|
38
|
+
|
|
39
|
+
function pasteAsLayer(imgSource, label) {
|
|
40
|
+
if (!state.editorOpen) return; // user closed mid-paste
|
|
41
|
+
saveState();
|
|
42
|
+
const layer = createLayer(label || 'Pasted', imgSource.width, imgSource.height);
|
|
43
|
+
layer.ctx.drawImage(imgSource, 0, 0);
|
|
44
|
+
state.layers.push(layer);
|
|
45
|
+
state.activeLayerId = layer.id;
|
|
46
|
+
state.tool = 'move';
|
|
47
|
+
const tb = state.container?.querySelector('.ge-toolbar');
|
|
48
|
+
if (tb) tb.querySelectorAll('.ge-tool-btn').forEach(b => b.classList.toggle('active', b.dataset.tool === 'move'));
|
|
49
|
+
renderLayerPanel();
|
|
50
|
+
composite();
|
|
51
|
+
uiModule.showToast('Pasted as new layer');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check internal clipboard first (from Ctrl+C lasso/wand).
|
|
55
|
+
if (state.internalClipboard) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
e.stopImmediatePropagation();
|
|
58
|
+
pasteAsLayer(state.internalClipboard, 'Pasted Selection');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Fall back to system clipboard.
|
|
63
|
+
const items = e.clipboardData?.items;
|
|
64
|
+
if (!items) return;
|
|
65
|
+
for (const item of items) {
|
|
66
|
+
if (!item.type.startsWith('image/')) continue;
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
e.stopImmediatePropagation();
|
|
69
|
+
const blob = item.getAsFile();
|
|
70
|
+
const url = URL.createObjectURL(blob);
|
|
71
|
+
const img = new Image();
|
|
72
|
+
img.onload = () => { pasteAsLayer(img, 'Pasted'); URL.revokeObjectURL(url); };
|
|
73
|
+
img.src = url;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}, true); // capture phase so we beat chat input
|
|
77
|
+
|
|
78
|
+
// ── Drag-and-drop ──
|
|
79
|
+
// Visual drop-zone overlay appears mid-drag; routes via
|
|
80
|
+
// handleImportedImage so the import respects canvas resizing rules
|
|
81
|
+
// + saves history (same path as the toolbar Import button).
|
|
82
|
+
const dropZone = container;
|
|
83
|
+
if (!dropZone) return;
|
|
84
|
+
let dragDepth = 0;
|
|
85
|
+
const hasFileType = (dt) => dt && Array.from(dt.types || []).some(t => t === 'Files');
|
|
86
|
+
const showOverlay = () => {
|
|
87
|
+
if (!state.editorOpen) return;
|
|
88
|
+
let ov = dropZone.querySelector('.ge-drop-overlay');
|
|
89
|
+
if (!ov) {
|
|
90
|
+
ov = document.createElement('div');
|
|
91
|
+
ov.className = 'ge-drop-overlay';
|
|
92
|
+
ov.innerHTML = '<div class="ge-drop-overlay-msg">Drop image to add as new layer</div>';
|
|
93
|
+
dropZone.appendChild(ov);
|
|
94
|
+
}
|
|
95
|
+
ov.style.display = '';
|
|
96
|
+
};
|
|
97
|
+
const hideOverlay = () => {
|
|
98
|
+
const ov = dropZone.querySelector('.ge-drop-overlay');
|
|
99
|
+
if (ov) ov.style.display = 'none';
|
|
100
|
+
};
|
|
101
|
+
dropZone.addEventListener('dragenter', (e) => {
|
|
102
|
+
if (!state.editorOpen || !hasFileType(e.dataTransfer)) return;
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
dragDepth++;
|
|
105
|
+
showOverlay();
|
|
106
|
+
});
|
|
107
|
+
dropZone.addEventListener('dragover', (e) => {
|
|
108
|
+
if (!state.editorOpen || !hasFileType(e.dataTransfer)) return;
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
111
|
+
});
|
|
112
|
+
dropZone.addEventListener('dragleave', () => {
|
|
113
|
+
if (!state.editorOpen) return;
|
|
114
|
+
dragDepth = Math.max(0, dragDepth - 1);
|
|
115
|
+
if (dragDepth === 0) hideOverlay();
|
|
116
|
+
});
|
|
117
|
+
dropZone.addEventListener('drop', (e) => {
|
|
118
|
+
if (!state.editorOpen) return;
|
|
119
|
+
dragDepth = 0;
|
|
120
|
+
hideOverlay();
|
|
121
|
+
const files = Array.from(e.dataTransfer?.files || []).filter(f => f.type.startsWith('image/'));
|
|
122
|
+
if (!files.length) return;
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
for (const f of files) {
|
|
126
|
+
const url = URL.createObjectURL(f);
|
|
127
|
+
const img = new Image();
|
|
128
|
+
img.onload = () => { handleImportedImage(img); URL.revokeObjectURL(url); };
|
|
129
|
+
img.onerror = () => URL.revokeObjectURL(url);
|
|
130
|
+
img.src = url;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure composite helpers — flatten a layer list into a single canvas
|
|
3
|
+
* for thumbnails / merged-mask use.
|
|
4
|
+
*
|
|
5
|
+
* Both helpers are stateless: the caller passes everything they need
|
|
6
|
+
* (layer list, canvas dimensions, an offsets lookup). The legacy
|
|
7
|
+
* gallery editor's module-level functions wrap these with their own
|
|
8
|
+
* state.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Cheap downscaled preview composited from all visible layers.
|
|
13
|
+
* Returns a JPEG dataURL, or null when there's nothing to draw.
|
|
14
|
+
*
|
|
15
|
+
* @param {Array<{visible: boolean, opacity: number, id: string, canvas: HTMLCanvasElement}>} layers
|
|
16
|
+
* @param {number} imgW Document width in canvas pixels.
|
|
17
|
+
* @param {number} imgH Document height in canvas pixels.
|
|
18
|
+
* @param {Map<string,{x:number,y:number}>} offsets Layer offsets, keyed by id.
|
|
19
|
+
* @param {number} maxDim Longest-edge target in CSS pixels.
|
|
20
|
+
* @param {number} quality JPEG quality 0..1.
|
|
21
|
+
* @returns {string|null}
|
|
22
|
+
*/
|
|
23
|
+
export function buildThumbnail(layers, imgW, imgH, offsets, maxDim, quality = 0.6) {
|
|
24
|
+
if (!imgW || !imgH) return null;
|
|
25
|
+
try {
|
|
26
|
+
const scale = Math.min(1, maxDim / Math.max(imgW, imgH));
|
|
27
|
+
const tw = Math.max(1, Math.round(imgW * scale));
|
|
28
|
+
const th = Math.max(1, Math.round(imgH * scale));
|
|
29
|
+
const c = document.createElement('canvas');
|
|
30
|
+
c.width = tw; c.height = th;
|
|
31
|
+
const ctx = c.getContext('2d');
|
|
32
|
+
for (const layer of layers) {
|
|
33
|
+
if (!layer.visible) continue;
|
|
34
|
+
ctx.globalAlpha = layer.opacity;
|
|
35
|
+
const off = offsets.get(layer.id) || { x: 0, y: 0 };
|
|
36
|
+
ctx.drawImage(
|
|
37
|
+
layer.canvas,
|
|
38
|
+
off.x * scale, off.y * scale,
|
|
39
|
+
layer.canvas.width * scale, layer.canvas.height * scale,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
ctx.globalAlpha = 1;
|
|
43
|
+
return c.toDataURL('image/jpeg', quality);
|
|
44
|
+
} catch (_) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Union of every visible mask sub-layer across `layers`, rendered as a
|
|
52
|
+
* binary white canvas the size of the document.
|
|
53
|
+
*
|
|
54
|
+
* `lighter` composite = additive — overlapping pixels stay clamped at
|
|
55
|
+
* 255, so wherever any mask painted, the result is solid white.
|
|
56
|
+
* Returns null when no mask layer contributed any pixels (so the caller
|
|
57
|
+
* can early-out cleanly).
|
|
58
|
+
*
|
|
59
|
+
* @param {Array<{masks?: Array<{visible: boolean, canvas: HTMLCanvasElement}>}>} layers
|
|
60
|
+
* @param {number} imgW
|
|
61
|
+
* @param {number} imgH
|
|
62
|
+
* @returns {HTMLCanvasElement|null}
|
|
63
|
+
*/
|
|
64
|
+
export function buildMergedMaskCanvas(layers, imgW, imgH) {
|
|
65
|
+
if (!imgW || !imgH) return null;
|
|
66
|
+
const out = document.createElement('canvas');
|
|
67
|
+
out.width = imgW;
|
|
68
|
+
out.height = imgH;
|
|
69
|
+
const ctx = out.getContext('2d');
|
|
70
|
+
ctx.globalCompositeOperation = 'lighter';
|
|
71
|
+
let anyMask = false;
|
|
72
|
+
for (const ly of layers) {
|
|
73
|
+
if (!ly.masks || !ly.masks.length) continue;
|
|
74
|
+
for (const mk of ly.masks) {
|
|
75
|
+
if (!mk.visible) continue;
|
|
76
|
+
if (!mk.canvas || !mk.canvas.width || !mk.canvas.height) continue;
|
|
77
|
+
ctx.drawImage(mk.canvas, 0, 0);
|
|
78
|
+
anyMask = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
ctx.globalCompositeOperation = 'source-over';
|
|
82
|
+
return anyMask ? out : null;
|
|
83
|
+
}
|