@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,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crop tool — drag-rect selection that lets the user cut down the
|
|
3
|
+
* canvas to a smaller region. Supports Shift-lock aspect ratio and
|
|
4
|
+
* click-inside-rect to reposition an existing crop without redrawing.
|
|
5
|
+
*
|
|
6
|
+
* Owns its own begin/drag/end handlers and reads/writes shared state.
|
|
7
|
+
* The factory takes a small dependency bag for things still living in
|
|
8
|
+
* galleryEditor.js — `composite` redraws the canvas, `showCropApply`
|
|
9
|
+
* mounts the floating W×H + Apply panel after the user finishes
|
|
10
|
+
* dragging.
|
|
11
|
+
*
|
|
12
|
+
* @param {{
|
|
13
|
+
* composite: () => void,
|
|
14
|
+
* showCropApply: () => void,
|
|
15
|
+
* }} deps
|
|
16
|
+
*/
|
|
17
|
+
import { state } from '../state.js';
|
|
18
|
+
import { canvasCoords } from '../canvas-coords.js';
|
|
19
|
+
import { drawCheckerboard } from '../checkerboard.js';
|
|
20
|
+
|
|
21
|
+
export function createCropTool({ composite, showCropApply }) {
|
|
22
|
+
return {
|
|
23
|
+
begin(e) {
|
|
24
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
25
|
+
// Click inside an existing crop rect → switch to move-mode so
|
|
26
|
+
// the user can reposition without redrawing.
|
|
27
|
+
if (state.cropRect &&
|
|
28
|
+
coords.x >= state.cropRect.x && coords.x <= state.cropRect.x + state.cropRect.w &&
|
|
29
|
+
coords.y >= state.cropRect.y && coords.y <= state.cropRect.y + state.cropRect.h) {
|
|
30
|
+
state.cropMoving = true;
|
|
31
|
+
state.cropMoveStart = { x: coords.x, y: coords.y, rx: state.cropRect.x, ry: state.cropRect.y };
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
state.cropping = true;
|
|
35
|
+
state.cropStart = coords;
|
|
36
|
+
state.cropEnd = { ...state.cropStart };
|
|
37
|
+
state.cropRect = null;
|
|
38
|
+
state.cropAspectLock = null;
|
|
39
|
+
// Tear down the size panel while the user is drawing a new rect.
|
|
40
|
+
const old = state.container?.querySelector('.ge-crop-apply');
|
|
41
|
+
if (old) old.remove();
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
drag(e) {
|
|
45
|
+
// Move-mode: drag the existing rect around the canvas.
|
|
46
|
+
if (state.cropMoving && state.cropRect && state.cropMoveStart) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
const c = canvasCoords(e, state.mainCanvas);
|
|
49
|
+
const dx = c.x - state.cropMoveStart.x;
|
|
50
|
+
const dy = c.y - state.cropMoveStart.y;
|
|
51
|
+
let nx = state.cropMoveStart.rx + dx;
|
|
52
|
+
let ny = state.cropMoveStart.ry + dy;
|
|
53
|
+
// Clamp to canvas bounds so the rect stays fully visible.
|
|
54
|
+
nx = Math.max(0, Math.min(nx, state.mainCanvas.width - state.cropRect.w));
|
|
55
|
+
ny = Math.max(0, Math.min(ny, state.mainCanvas.height - state.cropRect.h));
|
|
56
|
+
state.cropRect = { ...state.cropRect, x: nx, y: ny };
|
|
57
|
+
composite();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!state.cropping) return;
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
state.cropEnd = canvasCoords(e, state.mainCanvas);
|
|
63
|
+
// Shift-held = lock aspect ratio. First Shift press during the
|
|
64
|
+
// drag snapshots the current aspect; subsequent moves stay locked.
|
|
65
|
+
// Releasing Shift resets so the user can re-lock at a new ratio.
|
|
66
|
+
if (e.shiftKey) {
|
|
67
|
+
const rawDx = state.cropEnd.x - state.cropStart.x;
|
|
68
|
+
const rawDy = state.cropEnd.y - state.cropStart.y;
|
|
69
|
+
if (state.cropAspectLock == null) {
|
|
70
|
+
const rawW = Math.abs(rawDx) || 1;
|
|
71
|
+
const rawH = Math.abs(rawDy) || 1;
|
|
72
|
+
state.cropAspectLock = rawW / rawH;
|
|
73
|
+
}
|
|
74
|
+
const absDx = Math.abs(rawDx);
|
|
75
|
+
const absDy = Math.abs(rawDy);
|
|
76
|
+
// Whichever axis the user moved more (relative to the lock) is
|
|
77
|
+
// the driver; scale the other to preserve aspect.
|
|
78
|
+
let dx, dy;
|
|
79
|
+
if (absDx >= absDy * state.cropAspectLock) {
|
|
80
|
+
dx = rawDx;
|
|
81
|
+
dy = Math.sign(rawDy || 1) * (absDx / state.cropAspectLock);
|
|
82
|
+
} else {
|
|
83
|
+
dy = rawDy;
|
|
84
|
+
dx = Math.sign(rawDx || 1) * (absDy * state.cropAspectLock);
|
|
85
|
+
}
|
|
86
|
+
state.cropEnd = { x: state.cropStart.x + dx, y: state.cropStart.y + dy };
|
|
87
|
+
} else {
|
|
88
|
+
state.cropAspectLock = null;
|
|
89
|
+
}
|
|
90
|
+
composite();
|
|
91
|
+
// Draw crop overlay.
|
|
92
|
+
const x = Math.min(state.cropStart.x, state.cropEnd.x);
|
|
93
|
+
const y = Math.min(state.cropStart.y, state.cropEnd.y);
|
|
94
|
+
const w = Math.abs(state.cropEnd.x - state.cropStart.x);
|
|
95
|
+
const h = Math.abs(state.cropEnd.y - state.cropStart.y);
|
|
96
|
+
state.mainCtx.fillStyle = 'rgba(0,0,0,0.4)';
|
|
97
|
+
state.mainCtx.fillRect(0, 0, state.mainCanvas.width, state.mainCanvas.height);
|
|
98
|
+
state.mainCtx.clearRect(x, y, w, h);
|
|
99
|
+
// Redraw layers inside the crop rect (dim everything outside).
|
|
100
|
+
state.mainCtx.save();
|
|
101
|
+
state.mainCtx.beginPath();
|
|
102
|
+
state.mainCtx.rect(x, y, w, h);
|
|
103
|
+
state.mainCtx.clip();
|
|
104
|
+
drawCheckerboard(state.mainCtx, state.mainCanvas.width, state.mainCanvas.height);
|
|
105
|
+
for (const layer of state.layers) {
|
|
106
|
+
if (!layer.visible) continue;
|
|
107
|
+
state.mainCtx.globalAlpha = layer.opacity;
|
|
108
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
109
|
+
state.mainCtx.drawImage(layer.canvas, off.x, off.y);
|
|
110
|
+
}
|
|
111
|
+
state.mainCtx.globalAlpha = 1;
|
|
112
|
+
state.mainCtx.restore();
|
|
113
|
+
// Dashed border around the kept region.
|
|
114
|
+
state.mainCtx.strokeStyle = '#fff';
|
|
115
|
+
state.mainCtx.lineWidth = 1;
|
|
116
|
+
state.mainCtx.setLineDash([4, 4]);
|
|
117
|
+
state.mainCtx.strokeRect(x, y, w, h);
|
|
118
|
+
state.mainCtx.setLineDash([]);
|
|
119
|
+
state.cropRect = { x, y, w, h };
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
end() {
|
|
123
|
+
// Move-mode wrap-up: refresh the floating panel so Apply follows
|
|
124
|
+
// the rect to its new spot.
|
|
125
|
+
if (state.cropMoving) {
|
|
126
|
+
state.cropMoving = false;
|
|
127
|
+
state.cropMoveStart = null;
|
|
128
|
+
if (state.cropRect) showCropApply();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
state.cropping = false;
|
|
132
|
+
if (state.cropRect && state.cropRect.w > 5 && state.cropRect.h > 5) {
|
|
133
|
+
showCropApply();
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterative 4-connected flood fill on RGBA pixel data.
|
|
3
|
+
*
|
|
4
|
+
* Pure function — takes the source pixel array + seed + tolerance and
|
|
5
|
+
* returns a mask canvas with white where the fill landed. The legacy
|
|
6
|
+
* gallery editor's magic-wand tool delegates to this.
|
|
7
|
+
*
|
|
8
|
+
* @param {Uint8ClampedArray|Uint8Array} src RGBA bytes (length = w*h*4).
|
|
9
|
+
* @param {number} w Pixel width.
|
|
10
|
+
* @param {number} h Pixel height.
|
|
11
|
+
* @param {number} seedX Floored seed X.
|
|
12
|
+
* @param {number} seedY Floored seed Y.
|
|
13
|
+
* @param {number} tolerance Tolerance 0..100. Internally
|
|
14
|
+
* squared and scaled to RGB+A
|
|
15
|
+
* space (max ≈ 195k at 100).
|
|
16
|
+
* @returns {HTMLCanvasElement|null} A `w × h` mask canvas with
|
|
17
|
+
* white-opaque pixels for
|
|
18
|
+
* visited cells, or null if
|
|
19
|
+
* the seed is out of bounds.
|
|
20
|
+
*/
|
|
21
|
+
export function floodFillMask(src, w, h, seedX, seedY, tolerance) {
|
|
22
|
+
if (seedX < 0 || seedY < 0 || seedX >= w || seedY >= h) return null;
|
|
23
|
+
|
|
24
|
+
const seedIdx = (seedY * w + seedX) * 4;
|
|
25
|
+
const sr = src[seedIdx], sg = src[seedIdx + 1];
|
|
26
|
+
const sb = src[seedIdx + 2], sa = src[seedIdx + 3];
|
|
27
|
+
|
|
28
|
+
// 0..100 → squared RGB+A distance threshold. Max single-channel diff
|
|
29
|
+
// is 255, so sqrt(4 * 255²) ≈ 510; squared cap ≈ 195k at tol = 100.
|
|
30
|
+
const tol = Math.pow(tolerance * 4.42, 2);
|
|
31
|
+
|
|
32
|
+
const visited = new Uint8Array(w * h);
|
|
33
|
+
const stack = [seedX, seedY];
|
|
34
|
+
visited[seedY * w + seedX] = 1;
|
|
35
|
+
while (stack.length) {
|
|
36
|
+
const y = stack.pop();
|
|
37
|
+
const x = stack.pop();
|
|
38
|
+
const nbrs = [
|
|
39
|
+
[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1],
|
|
40
|
+
];
|
|
41
|
+
for (const [nx, ny] of nbrs) {
|
|
42
|
+
if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
|
|
43
|
+
const idx = ny * w + nx;
|
|
44
|
+
if (visited[idx]) continue;
|
|
45
|
+
const o = idx * 4;
|
|
46
|
+
const dr = src[o] - sr, dg = src[o + 1] - sg;
|
|
47
|
+
const db = src[o + 2] - sb, da = src[o + 3] - sa;
|
|
48
|
+
// RGB + alpha-aware so a click on a transparent pixel selects
|
|
49
|
+
// the transparent region cleanly.
|
|
50
|
+
if (dr * dr + dg * dg + db * db + da * da <= tol) {
|
|
51
|
+
visited[idx] = 1;
|
|
52
|
+
stack.push(nx, ny);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const mask = document.createElement('canvas');
|
|
58
|
+
mask.width = w;
|
|
59
|
+
mask.height = h;
|
|
60
|
+
const mCtx = mask.getContext('2d');
|
|
61
|
+
const mData = mCtx.createImageData(w, h);
|
|
62
|
+
for (let i = 0; i < w * h; i++) {
|
|
63
|
+
if (visited[i]) {
|
|
64
|
+
mData.data[i * 4] = 255;
|
|
65
|
+
mData.data[i * 4 + 1] = 255;
|
|
66
|
+
mData.data[i * 4 + 2] = 255;
|
|
67
|
+
mData.data[i * 4 + 3] = 255;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
mCtx.putImageData(mData, 0, 0);
|
|
71
|
+
return mask;
|
|
72
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lasso-tool pixel & path helpers.
|
|
3
|
+
*
|
|
4
|
+
* All functions take the lasso polygon `points` as an explicit
|
|
5
|
+
* argument so they can be tested in isolation. The legacy gallery
|
|
6
|
+
* editor calls them with its module-level `_lassoPoints` array.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Shift each polygon vertex along the outward normal by `grow` pixels.
|
|
11
|
+
* Used by the lasso overlay (to draw the "feather" halo) and by
|
|
12
|
+
* `buildLassoMask` (to bake the grown polygon into the mask).
|
|
13
|
+
*
|
|
14
|
+
* @param {{x: number, y: number}[]} points Polygon vertices in draw order.
|
|
15
|
+
* @param {number} grow Positive = expand outward, negative = contract.
|
|
16
|
+
* @returns {{x: number, y: number}[]} New array (same length, original is not mutated).
|
|
17
|
+
*/
|
|
18
|
+
export function lassoOffsetPoints(points, grow) {
|
|
19
|
+
const n = points.length;
|
|
20
|
+
if (n < 3 || !grow) return points;
|
|
21
|
+
// Polygon winding (positive = CCW) — flip the normal so it points
|
|
22
|
+
// away from the interior regardless of draw direction.
|
|
23
|
+
let area = 0;
|
|
24
|
+
for (let i = 0; i < n; i++) {
|
|
25
|
+
const p = points[i], q = points[(i + 1) % n];
|
|
26
|
+
area += (q.x - p.x) * (q.y + p.y);
|
|
27
|
+
}
|
|
28
|
+
const sign = area > 0 ? 1 : -1;
|
|
29
|
+
const out = new Array(n);
|
|
30
|
+
for (let i = 0; i < n; i++) {
|
|
31
|
+
const a = points[(i - 1 + n) % n], b = points[i], c = points[(i + 1) % n];
|
|
32
|
+
const e1x = b.x - a.x, e1y = b.y - a.y;
|
|
33
|
+
const e2x = c.x - b.x, e2y = c.y - b.y;
|
|
34
|
+
const l1 = Math.hypot(e1x, e1y) || 1;
|
|
35
|
+
const l2 = Math.hypot(e2x, e2y) || 1;
|
|
36
|
+
// Perpendicular (dy, -dx); flip via `sign` for outward direction.
|
|
37
|
+
const n1x = (e1y / l1) * sign, n1y = (-e1x / l1) * sign;
|
|
38
|
+
const n2x = (e2y / l2) * sign, n2y = (-e2x / l2) * sign;
|
|
39
|
+
const nx = (n1x + n2x) / 2;
|
|
40
|
+
const ny = (n1y + n2y) / 2;
|
|
41
|
+
const nl = Math.hypot(nx, ny) || 1;
|
|
42
|
+
out[i] = { x: b.x + (nx / nl) * grow, y: b.y + (ny / nl) * grow };
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Trace the lasso polygon on the given context (move-to + line-to,
|
|
50
|
+
* closed). Caller is responsible for `stroke()` / `fill()` choice.
|
|
51
|
+
*/
|
|
52
|
+
export function getLassoPath(ctx, points) {
|
|
53
|
+
if (!points || points.length < 1) return;
|
|
54
|
+
ctx.beginPath();
|
|
55
|
+
ctx.moveTo(points[0].x, points[0].y);
|
|
56
|
+
for (let i = 1; i < points.length; i++) {
|
|
57
|
+
ctx.lineTo(points[i].x, points[i].y);
|
|
58
|
+
}
|
|
59
|
+
ctx.closePath();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Build a (optionally feathered, optionally grown) selection mask
|
|
65
|
+
* from a lasso polygon.
|
|
66
|
+
*
|
|
67
|
+
* @param {{x: number, y: number}[]} points Polygon vertices.
|
|
68
|
+
* @param {number} w / h Output canvas dimensions.
|
|
69
|
+
* @param {number} offX / offY Translate the polygon by (offX, offY) before rasterising.
|
|
70
|
+
* @param {number} feather Feather width in pixels. 0 = hard edge.
|
|
71
|
+
* @param {number} grow Positive = dilate the polygon, negative = erode.
|
|
72
|
+
* @returns {HTMLCanvasElement} A `w × h` canvas with alpha = selection strength.
|
|
73
|
+
*/
|
|
74
|
+
export function buildLassoMask(points, w, h, offX, offY, feather, grow) {
|
|
75
|
+
// Step 1: draw hard mask
|
|
76
|
+
const hard = document.createElement('canvas');
|
|
77
|
+
hard.width = w; hard.height = h;
|
|
78
|
+
const hCtx = hard.getContext('2d');
|
|
79
|
+
hCtx.beginPath();
|
|
80
|
+
hCtx.moveTo(points[0].x - offX, points[0].y - offY);
|
|
81
|
+
for (let i = 1; i < points.length; i++) {
|
|
82
|
+
hCtx.lineTo(points[i].x - offX, points[i].y - offY);
|
|
83
|
+
}
|
|
84
|
+
hCtx.closePath();
|
|
85
|
+
hCtx.fillStyle = '#fff';
|
|
86
|
+
hCtx.fill();
|
|
87
|
+
|
|
88
|
+
// Step 1b: grow / shrink — blur the hard mask, threshold low for
|
|
89
|
+
// grow and high for shrink. Same technique as the bg-remove edge
|
|
90
|
+
// tuner. RGB is left alone, alpha is replaced.
|
|
91
|
+
if (grow && grow !== 0) {
|
|
92
|
+
const blurC = document.createElement('canvas');
|
|
93
|
+
blurC.width = w; blurC.height = h;
|
|
94
|
+
const bctx = blurC.getContext('2d');
|
|
95
|
+
bctx.filter = `blur(${Math.abs(grow)}px)`;
|
|
96
|
+
bctx.drawImage(hard, 0, 0);
|
|
97
|
+
bctx.filter = 'none';
|
|
98
|
+
const blurred = bctx.getImageData(0, 0, w, h).data;
|
|
99
|
+
const hd = hCtx.getImageData(0, 0, w, h);
|
|
100
|
+
const out = hd.data;
|
|
101
|
+
const thr = grow > 0 ? 32 : 200;
|
|
102
|
+
for (let i = 0; i < out.length; i += 4) {
|
|
103
|
+
const a = blurred[i + 3] >= thr ? 255 : 0;
|
|
104
|
+
out[i] = a; out[i + 1] = a; out[i + 2] = a; out[i + 3] = a;
|
|
105
|
+
}
|
|
106
|
+
hCtx.putImageData(hd, 0, 0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (feather <= 0) return hard;
|
|
110
|
+
|
|
111
|
+
// Step 2: pixel data and distance-based feather.
|
|
112
|
+
const hardData = hCtx.getImageData(0, 0, w, h);
|
|
113
|
+
const d = hardData.data;
|
|
114
|
+
|
|
115
|
+
// Build inside/outside map.
|
|
116
|
+
const inside = new Uint8Array(w * h);
|
|
117
|
+
for (let i = 0; i < w * h; i++) {
|
|
118
|
+
inside[i] = d[i * 4] > 128 ? 1 : 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Distance from edge (for pixels inside the selection, distance to nearest outside pixel).
|
|
122
|
+
const dist = new Float32Array(w * h);
|
|
123
|
+
dist.fill(feather + 1);
|
|
124
|
+
|
|
125
|
+
// Seed: edge pixels (inside pixels adjacent to outside pixels).
|
|
126
|
+
for (let y = 0; y < h; y++) {
|
|
127
|
+
for (let x = 0; x < w; x++) {
|
|
128
|
+
const i = y * w + x;
|
|
129
|
+
if (!inside[i]) { dist[i] = 0; continue; }
|
|
130
|
+
const hasOutside = (x > 0 && !inside[i-1]) || (x < w-1 && !inside[i+1]) ||
|
|
131
|
+
(y > 0 && !inside[(y-1)*w+x]) || (y < h-1 && !inside[(y+1)*w+x]);
|
|
132
|
+
if (hasOutside) dist[i] = 1;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Two-pass chamfer distance transform.
|
|
137
|
+
for (let y = 0; y < h; y++) {
|
|
138
|
+
for (let x = 0; x < w; x++) {
|
|
139
|
+
const i = y * w + x;
|
|
140
|
+
if (dist[i] === 0) continue;
|
|
141
|
+
if (x > 0) dist[i] = Math.min(dist[i], dist[i-1] + 1);
|
|
142
|
+
if (y > 0) dist[i] = Math.min(dist[i], dist[(y-1)*w+x] + 1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (let y = h-1; y >= 0; y--) {
|
|
146
|
+
for (let x = w-1; x >= 0; x--) {
|
|
147
|
+
const i = y * w + x;
|
|
148
|
+
if (dist[i] === 0) continue;
|
|
149
|
+
if (x < w-1) dist[i] = Math.min(dist[i], dist[i+1] + 1);
|
|
150
|
+
if (y < h-1) dist[i] = Math.min(dist[i], dist[(y+1)*w+x] + 1);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Pixels near the edge get reduced alpha.
|
|
155
|
+
const result = document.createElement('canvas');
|
|
156
|
+
result.width = w; result.height = h;
|
|
157
|
+
const rCtx = result.getContext('2d');
|
|
158
|
+
const rData = rCtx.createImageData(w, h);
|
|
159
|
+
|
|
160
|
+
for (let i = 0; i < w * h; i++) {
|
|
161
|
+
if (!inside[i]) continue;
|
|
162
|
+
const edgeDist = dist[i];
|
|
163
|
+
const alpha = edgeDist >= feather ? 255 : Math.round((edgeDist / feather) * 255);
|
|
164
|
+
rData.data[i*4] = alpha;
|
|
165
|
+
rData.data[i*4+1] = alpha;
|
|
166
|
+
rData.data[i*4+2] = alpha;
|
|
167
|
+
rData.data[i*4+3] = 255;
|
|
168
|
+
}
|
|
169
|
+
rCtx.putImageData(rData, 0, 0);
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lasso tool — freehand polygon selection. Mouse-down starts a fresh
|
|
3
|
+
* polygon; every move appends a point and redraws the dashed outline;
|
|
4
|
+
* mouse-up keeps the selection visible (the panel's action buttons
|
|
5
|
+
* read `state.lassoPoints` to act on it).
|
|
6
|
+
*
|
|
7
|
+
* Owns its own begin/drag/end handlers and reads/writes shared state.
|
|
8
|
+
*
|
|
9
|
+
* @param {{
|
|
10
|
+
* composite: () => void,
|
|
11
|
+
* drawLassoOverlay: () => void,
|
|
12
|
+
* syncToolClearIndicators: () => void,
|
|
13
|
+
* }} deps
|
|
14
|
+
*/
|
|
15
|
+
import { state } from '../state.js';
|
|
16
|
+
import { canvasCoords } from '../canvas-coords.js';
|
|
17
|
+
|
|
18
|
+
export function createLassoTool({ composite, drawLassoOverlay, syncToolClearIndicators }) {
|
|
19
|
+
return {
|
|
20
|
+
begin(e) {
|
|
21
|
+
state.lassoPoints = [];
|
|
22
|
+
state.lassoActive = true;
|
|
23
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
24
|
+
state.lassoPoints.push(coords);
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
drag(e) {
|
|
28
|
+
if (!state.lassoActive) return;
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
31
|
+
state.lassoPoints.push(coords);
|
|
32
|
+
// Live overlay: dashed white outline + translucent red fill.
|
|
33
|
+
composite();
|
|
34
|
+
if (state.lassoPoints.length > 1) {
|
|
35
|
+
state.mainCtx.beginPath();
|
|
36
|
+
state.mainCtx.moveTo(state.lassoPoints[0].x, state.lassoPoints[0].y);
|
|
37
|
+
for (let i = 1; i < state.lassoPoints.length; i++) {
|
|
38
|
+
state.mainCtx.lineTo(state.lassoPoints[i].x, state.lassoPoints[i].y);
|
|
39
|
+
}
|
|
40
|
+
state.mainCtx.closePath();
|
|
41
|
+
state.mainCtx.strokeStyle = '#fff';
|
|
42
|
+
state.mainCtx.lineWidth = 1 / state.zoom;
|
|
43
|
+
state.mainCtx.setLineDash([4 / state.zoom, 4 / state.zoom]);
|
|
44
|
+
state.mainCtx.stroke();
|
|
45
|
+
state.mainCtx.setLineDash([]);
|
|
46
|
+
state.mainCtx.fillStyle = 'rgba(255, 80, 80, 0.15)';
|
|
47
|
+
state.mainCtx.fill();
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
end() {
|
|
52
|
+
state.lassoActive = false;
|
|
53
|
+
if (state.lassoPoints.length < 3) {
|
|
54
|
+
state.lassoPoints = [];
|
|
55
|
+
composite();
|
|
56
|
+
syncToolClearIndicators();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Keep the selection drawn — the panel's action buttons use it.
|
|
60
|
+
composite();
|
|
61
|
+
drawLassoOverlay();
|
|
62
|
+
syncToolClearIndicators();
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Move tool — drag a layer around the canvas, with optional snap-on-Ctrl
|
|
3
|
+
* to other layers' edges/centers and to canvas edges/center.
|
|
4
|
+
*
|
|
5
|
+
* Owns its own input handlers (begin/drag/end) and reads/writes the
|
|
6
|
+
* shared `state` store directly. The factory takes a small dependency
|
|
7
|
+
* bag for things that still live in galleryEditor.js — `activeLayer`,
|
|
8
|
+
* `saveState`, `composite` — so this module doesn't have to know about
|
|
9
|
+
* the orchestrator.
|
|
10
|
+
*
|
|
11
|
+
* @param {{
|
|
12
|
+
* activeLayer: () => {id: string, canvas: HTMLCanvasElement, locked?: boolean} | null,
|
|
13
|
+
* saveState: (label?: string) => void,
|
|
14
|
+
* composite: () => void,
|
|
15
|
+
* }} deps
|
|
16
|
+
* @returns {{ begin: (e: Event) => void, drag: (e: Event) => void, end: () => void }}
|
|
17
|
+
*/
|
|
18
|
+
import { state } from '../state.js';
|
|
19
|
+
import { canvasCoords } from '../canvas-coords.js';
|
|
20
|
+
import { computeSnap as computeSnapImpl } from '../snap.js';
|
|
21
|
+
|
|
22
|
+
export function createMoveTool({ activeLayer, saveState, composite }) {
|
|
23
|
+
function computeSnap(layer, nx, ny) {
|
|
24
|
+
return computeSnapImpl(layer, nx, ny, {
|
|
25
|
+
zoom: state.zoom,
|
|
26
|
+
canvasW: state.imgWidth,
|
|
27
|
+
canvasH: state.imgHeight,
|
|
28
|
+
otherLayers: state.layers.map(l => ({
|
|
29
|
+
visible: l.visible,
|
|
30
|
+
id: l.id,
|
|
31
|
+
canvas: l.canvas,
|
|
32
|
+
offset: state.layerOffsets.get(l.id) || { x: 0, y: 0 },
|
|
33
|
+
})),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
begin(e) {
|
|
39
|
+
const layer = activeLayer();
|
|
40
|
+
if (!layer || layer.locked) return;
|
|
41
|
+
saveState();
|
|
42
|
+
state.moving = true;
|
|
43
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
44
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
45
|
+
state.moveStartX = coords.x;
|
|
46
|
+
state.moveStartY = coords.y;
|
|
47
|
+
state.moveLayerOffsetX = off.x;
|
|
48
|
+
state.moveLayerOffsetY = off.y;
|
|
49
|
+
},
|
|
50
|
+
drag(e) {
|
|
51
|
+
if (!state.moving) return;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
const layer = activeLayer();
|
|
54
|
+
if (!layer) return;
|
|
55
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
56
|
+
const dx = coords.x - state.moveStartX;
|
|
57
|
+
const dy = coords.y - state.moveStartY;
|
|
58
|
+
let nx = state.moveLayerOffsetX + dx;
|
|
59
|
+
let ny = state.moveLayerOffsetY + dy;
|
|
60
|
+
// Ctrl held = snap to canvas edges/center and to every other
|
|
61
|
+
// visible layer's edges/center. Opt-in to avoid a "sticky" feel
|
|
62
|
+
// during normal drags.
|
|
63
|
+
if (e.ctrlKey || e.metaKey) {
|
|
64
|
+
const snapped = computeSnap(layer, nx, ny);
|
|
65
|
+
nx = snapped.x;
|
|
66
|
+
ny = snapped.y;
|
|
67
|
+
state.activeSnapGuides = snapped.guides;
|
|
68
|
+
} else {
|
|
69
|
+
state.activeSnapGuides = null;
|
|
70
|
+
}
|
|
71
|
+
state.layerOffsets.set(layer.id, { x: nx, y: ny });
|
|
72
|
+
composite();
|
|
73
|
+
},
|
|
74
|
+
end() {
|
|
75
|
+
state.moving = false;
|
|
76
|
+
state.activeSnapGuides = null;
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared stroke pipeline for brush / eraser / inpaint.
|
|
3
|
+
*
|
|
4
|
+
* Per-sample stamping happens in `_strokeTo` (still in galleryEditor.js
|
|
5
|
+
* because it touches a lot of pixel-pass internals). This module owns
|
|
6
|
+
* the begin / continue / end orchestration around it:
|
|
7
|
+
*
|
|
8
|
+
* - begin: capture the inpaint-erase flag for the stroke, ensure a
|
|
9
|
+
* mask sub-layer exists when inpaint runs against an empty
|
|
10
|
+
* layer, push an undo entry with a tool-specific label, then
|
|
11
|
+
* kick off the first stamp.
|
|
12
|
+
* - continue: forward the new cursor position to `_strokeTo`.
|
|
13
|
+
* - end: clear the drawing flag, composite, sync any tool indicators
|
|
14
|
+
* that reflect mask state.
|
|
15
|
+
*
|
|
16
|
+
* Clone has its own begin (see tools/clone.js) but reuses `continue`
|
|
17
|
+
* and `end` because once a clone stroke is in progress, the pipeline
|
|
18
|
+
* is identical.
|
|
19
|
+
*
|
|
20
|
+
* @param {{
|
|
21
|
+
* saveState: (label: string) => void,
|
|
22
|
+
* strokeTo: (x: number, y: number) => void,
|
|
23
|
+
* composite: () => void,
|
|
24
|
+
* getActiveMaskLayer: () => object | null,
|
|
25
|
+
* activeParentLayer: () => object | null,
|
|
26
|
+
* ensureActiveMaskLayer: () => object | null,
|
|
27
|
+
* createLayer: (name: string, w: number, h: number) => object,
|
|
28
|
+
* renderLayerPanel: () => void,
|
|
29
|
+
* syncToolClearIndicators: () => void,
|
|
30
|
+
* }} deps
|
|
31
|
+
*/
|
|
32
|
+
import { state } from '../state.js';
|
|
33
|
+
import { canvasCoords } from '../canvas-coords.js';
|
|
34
|
+
|
|
35
|
+
const STROKE_TOOLS = new Set(['brush', 'eraser', 'inpaint']);
|
|
36
|
+
|
|
37
|
+
function strokeLabel(tool) {
|
|
38
|
+
if (tool === 'brush') return 'Brush stroke';
|
|
39
|
+
if (tool === 'eraser') return 'Eraser stroke';
|
|
40
|
+
if (tool === 'inpaint') return state.inpaintEraseStroke ? 'Erase mask' : 'Paint mask';
|
|
41
|
+
return 'Stroke';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createStrokeTool({
|
|
45
|
+
saveState, strokeTo, composite,
|
|
46
|
+
getActiveMaskLayer, activeParentLayer, ensureActiveMaskLayer, createLayer,
|
|
47
|
+
renderLayerPanel, syncToolClearIndicators,
|
|
48
|
+
}) {
|
|
49
|
+
return {
|
|
50
|
+
/**
|
|
51
|
+
* Begin a stroke. Returns true if the dispatcher should consider
|
|
52
|
+
* the event handled (i.e. tool is one of brush/eraser/inpaint).
|
|
53
|
+
*/
|
|
54
|
+
tryBegin(e) {
|
|
55
|
+
if (!STROKE_TOOLS.has(state.tool)) return false;
|
|
56
|
+
// Capture the inpaint-erase flag for this stroke. Ctrl+Alt
|
|
57
|
+
// pressed at pointerdown flips the persistent toggle for one
|
|
58
|
+
// stroke only.
|
|
59
|
+
if (state.tool === 'inpaint') {
|
|
60
|
+
const flip = e && e.ctrlKey && e.altKey;
|
|
61
|
+
state.inpaintEraseStroke = flip ? !state.inpaintEraseMode : state.inpaintEraseMode;
|
|
62
|
+
// Make sure we're painting onto an existing mask sub-layer. If
|
|
63
|
+
// there's no parent layer at all, create one first so a totally
|
|
64
|
+
// empty canvas can accept an inpaint stroke.
|
|
65
|
+
if (!getActiveMaskLayer()) {
|
|
66
|
+
let parent = activeParentLayer();
|
|
67
|
+
if (!parent) {
|
|
68
|
+
parent = createLayer('Layer 1', state.imgWidth, state.imgHeight);
|
|
69
|
+
state.layers.push(parent);
|
|
70
|
+
state.activeLayerId = parent.id;
|
|
71
|
+
}
|
|
72
|
+
if (parent.masks && parent.masks.length) {
|
|
73
|
+
parent.activeMaskId = parent.masks[parent.masks.length - 1].id;
|
|
74
|
+
const m = getActiveMaskLayer();
|
|
75
|
+
if (m) {
|
|
76
|
+
state.maskCanvas = m.canvas;
|
|
77
|
+
state.maskCtx = m.ctx;
|
|
78
|
+
renderLayerPanel();
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
const mk = ensureActiveMaskLayer();
|
|
82
|
+
if (mk) {
|
|
83
|
+
state.maskCanvas = mk.canvas;
|
|
84
|
+
state.maskCtx = mk.ctx;
|
|
85
|
+
renderLayerPanel();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
saveState(strokeLabel(state.tool));
|
|
91
|
+
state.drawing = true;
|
|
92
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
93
|
+
state.lastX = coords.x;
|
|
94
|
+
state.lastY = coords.y;
|
|
95
|
+
strokeTo(coords.x, coords.y);
|
|
96
|
+
return true;
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Forward an in-progress stroke. Returns true if a stroke is
|
|
101
|
+
* actually in progress (dispatcher should short-circuit).
|
|
102
|
+
*/
|
|
103
|
+
tryContinue(e) {
|
|
104
|
+
if (!state.drawing) return false;
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
107
|
+
strokeTo(coords.x, coords.y);
|
|
108
|
+
return true;
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Wrap up an in-progress stroke. Returns true if there was one.
|
|
113
|
+
*/
|
|
114
|
+
tryEnd() {
|
|
115
|
+
if (!state.drawing) return false;
|
|
116
|
+
const wasDrawingInpaint = state.tool === 'inpaint';
|
|
117
|
+
state.drawing = false;
|
|
118
|
+
composite();
|
|
119
|
+
if (wasDrawingInpaint) syncToolClearIndicators();
|
|
120
|
+
return true;
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|