@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,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor state store — a single mutable object that the gallery editor
|
|
3
|
+
* and its tool modules read and write directly.
|
|
4
|
+
*
|
|
5
|
+
* Migration: galleryEditor.js used to own ~110 module-scope `let`
|
|
6
|
+
* declarations and capture them via closure. Tool modules can't import
|
|
7
|
+
* a `let` binding's mutations across module boundaries, so we move the
|
|
8
|
+
* state into a single exported OBJECT whose properties are freely
|
|
9
|
+
* mutated by anyone holding a reference. Read/write `state.transformW`
|
|
10
|
+
* exactly the way the old code wrote `_transformW`.
|
|
11
|
+
*
|
|
12
|
+
* Slices land here one tool at a time; this file grows as more state
|
|
13
|
+
* migrates out of galleryEditor.js. Defaults match the legacy
|
|
14
|
+
* module-scope initializers verbatim — every `state.foo = …` reset
|
|
15
|
+
* site in galleryEditor.js still works unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export const state = {
|
|
18
|
+
// ── Transform tool ──
|
|
19
|
+
// Drag-resize / rotate session state. While `transformActive` is
|
|
20
|
+
// false every field below should be considered stale.
|
|
21
|
+
transformActive: false,
|
|
22
|
+
transformLayer: null,
|
|
23
|
+
transformOrigW: 0,
|
|
24
|
+
transformOrigH: 0,
|
|
25
|
+
// Which corner/edge handle the user is currently dragging. One of
|
|
26
|
+
// 'tl' | 'tr' | 'bl' | 'br' | 'rot' | null.
|
|
27
|
+
transformHandle: null,
|
|
28
|
+
// Which handle is currently under the cursor (no drag). Drives the
|
|
29
|
+
// hover cursor lookup; lives next to `transformHandle` because both
|
|
30
|
+
// come from `_getTransformHandle`.
|
|
31
|
+
hoveredHandle: null,
|
|
32
|
+
// Snapshot of the layer canvas + offset at transform start so Cancel
|
|
33
|
+
// can restore exactly without re-fetching from the layer.
|
|
34
|
+
transformOrigCanvas: null,
|
|
35
|
+
transformOrigOffset: null,
|
|
36
|
+
// In-progress dimensions / rotation / flips committed on Apply.
|
|
37
|
+
transformPendingW: 0,
|
|
38
|
+
transformPendingH: 0,
|
|
39
|
+
transformPendingRot: 0,
|
|
40
|
+
transformPendingFlipH: false,
|
|
41
|
+
transformPendingFlipV: false,
|
|
42
|
+
transformAspectLock: true,
|
|
43
|
+
// Floating Transform popup element + drag-start offsets.
|
|
44
|
+
transformPopup: null,
|
|
45
|
+
transformStartX: 0,
|
|
46
|
+
transformStartY: 0,
|
|
47
|
+
transformStartOffX: 0,
|
|
48
|
+
transformStartOffY: 0,
|
|
49
|
+
// Transform overlay canvas — separate canvas positioned over the
|
|
50
|
+
// main canvas with extra slack for handle rendering. Created by
|
|
51
|
+
// _buildEditor; the move/transform tools draw their handle layer
|
|
52
|
+
// onto its 2D context.
|
|
53
|
+
transformOverlay: null,
|
|
54
|
+
transformOverlayCtx: null,
|
|
55
|
+
|
|
56
|
+
// ── Magic Wand tool ──
|
|
57
|
+
// Binary selection mask + the layer it was sampled from. `wandMask`
|
|
58
|
+
// is a canvas the size of `wandLayer`'s pixels, white where selected,
|
|
59
|
+
// transparent elsewhere. `wandLastSeed` remembers the last click so
|
|
60
|
+
// tolerance retunes can re-run the flood-fill without re-prompting.
|
|
61
|
+
wandMask: null,
|
|
62
|
+
wandLayerId: null,
|
|
63
|
+
wandTolerance: 24,
|
|
64
|
+
wandMaskVisible: true,
|
|
65
|
+
wandMode: 'replace',
|
|
66
|
+
wandLiveRetune: false,
|
|
67
|
+
wandLastSeed: null,
|
|
68
|
+
// Cached layer pixel data (getImageData is O(pixels) — expensive for
|
|
69
|
+
// 4K layers; invalidated when the active layer changes).
|
|
70
|
+
wandSrcCache: null,
|
|
71
|
+
|
|
72
|
+
// ── Brush / Eraser / Clone tools ──
|
|
73
|
+
// Shared paint color (brush picks up the swatch; eraser and clone
|
|
74
|
+
// ignore color but reuse the same picker control).
|
|
75
|
+
color: '#e06c75',
|
|
76
|
+
// Brush diameter in canvas pixels. Persisted across tool switches;
|
|
77
|
+
// bumped to a mask-friendly default on first inpaint entry.
|
|
78
|
+
brushSize: 8,
|
|
79
|
+
// Per-tool stroke modifiers — opacity + flow + softness. Each tool
|
|
80
|
+
// owns its own row so users can dial them in independently.
|
|
81
|
+
brushOpacity: 100,
|
|
82
|
+
brushFlow: 100,
|
|
83
|
+
brushSoftness: 100,
|
|
84
|
+
eraserOpacity: 100,
|
|
85
|
+
eraserFlow: 100,
|
|
86
|
+
eraserSoftness: 100,
|
|
87
|
+
cloneOpacity: 100,
|
|
88
|
+
cloneFlow: 100,
|
|
89
|
+
cloneSoftness: 100,
|
|
90
|
+
// Clone-stamp source point (set via Alt-click or double-tap). Null
|
|
91
|
+
// means no source picked yet — clicking with the clone tool no-ops
|
|
92
|
+
// until a source is set.
|
|
93
|
+
cloneSourceX: null,
|
|
94
|
+
cloneSourceY: null,
|
|
95
|
+
// Stroke-start offsets so the source moves WITH the brush, keeping
|
|
96
|
+
// the source→destination offset constant across the stroke.
|
|
97
|
+
cloneStrokeStartX: null,
|
|
98
|
+
cloneStrokeStartY: null,
|
|
99
|
+
// Frozen snapshot of the source layer's pixels at stroke start so
|
|
100
|
+
// moving the source over previously-painted pixels samples the
|
|
101
|
+
// original, not the in-progress stamp ring.
|
|
102
|
+
cloneSourceSnapshot: null,
|
|
103
|
+
cloneSourceLayerId: null,
|
|
104
|
+
// Mobile: double-tap detection for "set source" since Alt-click
|
|
105
|
+
// isn't an option without a keyboard.
|
|
106
|
+
cloneLastTapTime: 0,
|
|
107
|
+
cloneLastTapX: 0,
|
|
108
|
+
cloneLastTapY: 0,
|
|
109
|
+
|
|
110
|
+
// ── Inpaint + mask ──
|
|
111
|
+
// Active mask canvas + its 2D context. Re-pointed to the active
|
|
112
|
+
// mask sub-layer whenever the user picks a different mask in the
|
|
113
|
+
// layer panel.
|
|
114
|
+
maskCanvas: null,
|
|
115
|
+
maskCtx: null,
|
|
116
|
+
maskVisible: true,
|
|
117
|
+
// Reused canvas for the union-of-masks tint pass (saves repeated
|
|
118
|
+
// allocation on every composite).
|
|
119
|
+
compositeMaskUnion: null,
|
|
120
|
+
// Visual tint applied to mask pixels in the composite — purely
|
|
121
|
+
// cosmetic; the AI model still sees a hard binary mask.
|
|
122
|
+
maskTintColor: 'rgba(255, 110, 110, 1)',
|
|
123
|
+
maskTintOpacity: 0.28,
|
|
124
|
+
// Inpaint-tool paint vs erase modes (Ctrl+Alt flips for a single
|
|
125
|
+
// stroke; UI buttons toggle the persistent setting).
|
|
126
|
+
inpaintEraseMode: false,
|
|
127
|
+
inpaintEraseStroke: false,
|
|
128
|
+
// First-entry guard: bump brush size to the mask-friendly default
|
|
129
|
+
// the first time the user opens inpaint per session.
|
|
130
|
+
inpaintBrushInitialised: false,
|
|
131
|
+
// Last successful inpaint result layer — drives the live edge
|
|
132
|
+
// feather / stroke sliders (those only apply to the most recent
|
|
133
|
+
// result).
|
|
134
|
+
lastInpaintLayerId: null,
|
|
135
|
+
// Captured handlers so we can detach them on close without leaking.
|
|
136
|
+
inpaintDismissHandlers: null,
|
|
137
|
+
// Background-remove tool state — pristine snapshot so the edge
|
|
138
|
+
// cleanup sliders can live-rebuild alpha without re-running rembg.
|
|
139
|
+
rembgLiveLayer: null,
|
|
140
|
+
rembgLiveSnap: null,
|
|
141
|
+
// Memoised "is rembg installed on the server?" probe.
|
|
142
|
+
rembgInstalledCache: null,
|
|
143
|
+
|
|
144
|
+
// ── Stroke drag state ──
|
|
145
|
+
// Generic in-progress-stroke flags shared by brush/eraser/clone/
|
|
146
|
+
// inpaint. `lastX/Y` are the last mouse position used to interpolate
|
|
147
|
+
// a continuous line through fast-moving cursor samples.
|
|
148
|
+
drawing: false,
|
|
149
|
+
lastX: 0,
|
|
150
|
+
lastY: 0,
|
|
151
|
+
|
|
152
|
+
// ── Move tool ──
|
|
153
|
+
moving: false,
|
|
154
|
+
moveStartX: 0,
|
|
155
|
+
moveStartY: 0,
|
|
156
|
+
// Layer offset at drag start so we can compute the new offset by
|
|
157
|
+
// (mouse - startMouse) + startOffset rather than accumulating delta.
|
|
158
|
+
moveLayerOffsetX: 0,
|
|
159
|
+
moveLayerOffsetY: 0,
|
|
160
|
+
// Snap guides drawn during a move-tool drag (Ctrl held). Each entry
|
|
161
|
+
// is a vertical / horizontal line in canvas space.
|
|
162
|
+
activeSnapGuides: null,
|
|
163
|
+
|
|
164
|
+
// ── Crop tool ──
|
|
165
|
+
cropping: false,
|
|
166
|
+
cropStart: null,
|
|
167
|
+
cropEnd: null,
|
|
168
|
+
cropRect: null,
|
|
169
|
+
cropAspectLock: null,
|
|
170
|
+
// True while the user drags the inside of an already-finished crop
|
|
171
|
+
// rect to reposition it.
|
|
172
|
+
cropMoving: false,
|
|
173
|
+
cropMoveStart: null,
|
|
174
|
+
|
|
175
|
+
// ── Lasso tool ──
|
|
176
|
+
// Freehand selection polygon in canvas pixels. Empty when no lasso
|
|
177
|
+
// is in progress or staged.
|
|
178
|
+
lassoPoints: [],
|
|
179
|
+
lassoActive: false,
|
|
180
|
+
|
|
181
|
+
// In-editor copy/paste — separate from the OS clipboard so we can
|
|
182
|
+
// round-trip layer alpha and metadata losslessly.
|
|
183
|
+
internalClipboard: null,
|
|
184
|
+
|
|
185
|
+
// ── Editor DOM refs ──
|
|
186
|
+
// Root container that openEditor mounts into.
|
|
187
|
+
container: null,
|
|
188
|
+
// Main image canvas + its 2D context. Re-created on every openEditor
|
|
189
|
+
// so the editor can reopen with fresh dimensions.
|
|
190
|
+
mainCanvas: null,
|
|
191
|
+
mainCtx: null,
|
|
192
|
+
|
|
193
|
+
// ── Document + layers ──
|
|
194
|
+
layers: [],
|
|
195
|
+
activeLayerId: null,
|
|
196
|
+
// Active tool ID — one of move/crop/transform/brush/eraser/clone/
|
|
197
|
+
// lasso/wand/inpaint/rembg/harmonize/sharpen/upscale/style.
|
|
198
|
+
tool: 'move',
|
|
199
|
+
// Display zoom (1 = 100%). pan{X,Y} translate the canvas inside the
|
|
200
|
+
// viewport.
|
|
201
|
+
zoom: 1,
|
|
202
|
+
panX: 0,
|
|
203
|
+
panY: 0,
|
|
204
|
+
// Document dimensions in canvas pixels.
|
|
205
|
+
imgWidth: 0,
|
|
206
|
+
imgHeight: 0,
|
|
207
|
+
// Gallery image id this editor session is editing, or null for
|
|
208
|
+
// blank-canvas drafts.
|
|
209
|
+
imageId: null,
|
|
210
|
+
// Original file extension so save-over-original re-encodes in the
|
|
211
|
+
// same format (JPEG vs PNG matters: JPEG cuts upload size 5-10× for
|
|
212
|
+
// camera photos over remote tunnels).
|
|
213
|
+
originalExt: 'png',
|
|
214
|
+
// True between openEditor / closeEditor — guards async callbacks
|
|
215
|
+
// that fire after the user closes the editor (don't draw onto a
|
|
216
|
+
// dead canvas, don't re-mount the spinner).
|
|
217
|
+
editorOpen: false,
|
|
218
|
+
// Document-level click-away handlers registered for the current
|
|
219
|
+
// session. Tracked so closeEditor can detach them all cleanly.
|
|
220
|
+
// Mutated in place (push / length = 0); the reference never changes.
|
|
221
|
+
editorDocClickHandlers: [],
|
|
222
|
+
|
|
223
|
+
// ── Undo / redo ──
|
|
224
|
+
undoStack: [],
|
|
225
|
+
redoStack: [],
|
|
226
|
+
|
|
227
|
+
// ── Layer offsets + id allocation ──
|
|
228
|
+
// Map<layerId, {x, y}> — kept in a Map so we can serialise it
|
|
229
|
+
// separately from the layer's own canvas. Mutated in place.
|
|
230
|
+
layerOffsets: new Map(),
|
|
231
|
+
nextLayerId: 1,
|
|
232
|
+
|
|
233
|
+
// ── Popup / panel handles ──
|
|
234
|
+
fxPopupEl: null,
|
|
235
|
+
fxPopupLayerId: null,
|
|
236
|
+
fxMenuEl: null,
|
|
237
|
+
adjPopupEl: null,
|
|
238
|
+
// rAF-throttled live preview while sliders are dragged in adj popups.
|
|
239
|
+
adjRafPending: false,
|
|
240
|
+
historyPanelEl: null,
|
|
241
|
+
// Custom brush-cursor overlay element (circle following the mouse).
|
|
242
|
+
cursorEl: null,
|
|
243
|
+
// Hover-preview thumbnail floating element (singleton, repositioned).
|
|
244
|
+
layerThumbEl: null,
|
|
245
|
+
// Loading-overlay element (whirlpool + label).
|
|
246
|
+
editorLoadingEl: null,
|
|
247
|
+
|
|
248
|
+
// ── Draft persistence ──
|
|
249
|
+
draftId: null,
|
|
250
|
+
draftName: '',
|
|
251
|
+
persistTimer: null,
|
|
252
|
+
// Current PUT/POST promise so concurrent saves can chain.
|
|
253
|
+
persistInFlight: null,
|
|
254
|
+
// True when an edit happened during an in-flight save — triggers a
|
|
255
|
+
// follow-up persist after the current one finishes.
|
|
256
|
+
persistDirty: false,
|
|
257
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stroke pipeline — paints one segment (last-position → current
|
|
3
|
+
* position) onto the active layer (or its active mask sub-layer).
|
|
4
|
+
*
|
|
5
|
+
* `strokeTo` dispatches by tool:
|
|
6
|
+
* - clone → cloneStrokeTo (custom stamp-based paint loop)
|
|
7
|
+
* - brush → source-over with opacity × flow + softness blur
|
|
8
|
+
* - eraser → destination-out with opacity × flow + softness blur
|
|
9
|
+
* - inpaint → source-over (paint) or destination-out (erase) with
|
|
10
|
+
* full alpha on the mask canvas
|
|
11
|
+
*
|
|
12
|
+
* If the active parent has an active mask sub-layer, brush / eraser /
|
|
13
|
+
* inpaint target the mask canvas instead of the layer's pixel canvas.
|
|
14
|
+
*
|
|
15
|
+
* @param {{
|
|
16
|
+
* activeLayer: () => object | null,
|
|
17
|
+
* getActiveMaskLayer: () => object | null,
|
|
18
|
+
* composite: () => void,
|
|
19
|
+
* }} deps
|
|
20
|
+
*/
|
|
21
|
+
import { state } from './state.js';
|
|
22
|
+
|
|
23
|
+
export function createStrokePipeline({ activeLayer, getActiveMaskLayer, composite }) {
|
|
24
|
+
function cloneStrokeTo(x, y, layer) {
|
|
25
|
+
if (!state.cloneSourceSnapshot) return;
|
|
26
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
27
|
+
const dx = x - state.cloneStrokeStartX;
|
|
28
|
+
const dy = y - state.cloneStrokeStartY;
|
|
29
|
+
const srcX = state.cloneSourceX + dx;
|
|
30
|
+
const srcY = state.cloneSourceY + dy;
|
|
31
|
+
const ctx = layer.ctx;
|
|
32
|
+
const radius = Math.max(1, state.brushSize / 2);
|
|
33
|
+
// Walk last → current in roughly half-brush steps so stamps
|
|
34
|
+
// overlap into a continuous brush trail.
|
|
35
|
+
const lastSrcX = state.cloneSourceX + (state.lastX - state.cloneStrokeStartX);
|
|
36
|
+
const lastSrcY = state.cloneSourceY + (state.lastY - state.cloneStrokeStartY);
|
|
37
|
+
const dist = Math.hypot(x - state.lastX, y - state.lastY);
|
|
38
|
+
const step = Math.max(1, radius * 0.5);
|
|
39
|
+
const steps = Math.max(1, Math.ceil(dist / step));
|
|
40
|
+
const stampSize = Math.max(2, Math.ceil(radius * 2));
|
|
41
|
+
const stampRadius = stampSize / 2;
|
|
42
|
+
const stamp = document.createElement('canvas');
|
|
43
|
+
stamp.width = stampSize;
|
|
44
|
+
stamp.height = stampSize;
|
|
45
|
+
const stampCtx = stamp.getContext('2d');
|
|
46
|
+
const softness = Math.max(0, Math.min(1, state.cloneSoftness / 300));
|
|
47
|
+
const hardStop = stampRadius * (1 - softness);
|
|
48
|
+
ctx.save();
|
|
49
|
+
ctx.globalAlpha = (state.cloneOpacity / 100) * (state.cloneFlow / 100);
|
|
50
|
+
for (let i = 1; i <= steps; i++) {
|
|
51
|
+
const t = i / steps;
|
|
52
|
+
const px = state.lastX + (x - state.lastX) * t - off.x;
|
|
53
|
+
const py = state.lastY + (y - state.lastY) * t - off.y;
|
|
54
|
+
const sx = lastSrcX + (srcX - lastSrcX) * t;
|
|
55
|
+
const sy = lastSrcY + (srcY - lastSrcY) * t;
|
|
56
|
+
stampCtx.clearRect(0, 0, stampSize, stampSize);
|
|
57
|
+
stampCtx.globalCompositeOperation = 'source-over';
|
|
58
|
+
stampCtx.drawImage(
|
|
59
|
+
state.cloneSourceSnapshot,
|
|
60
|
+
sx - stampRadius, sy - stampRadius, stampSize, stampSize,
|
|
61
|
+
0, 0, stampSize, stampSize,
|
|
62
|
+
);
|
|
63
|
+
stampCtx.globalCompositeOperation = 'destination-in';
|
|
64
|
+
const mask = stampCtx.createRadialGradient(stampRadius, stampRadius, hardStop, stampRadius, stampRadius, stampRadius);
|
|
65
|
+
mask.addColorStop(0, 'rgba(0,0,0,1)');
|
|
66
|
+
mask.addColorStop(1, 'rgba(0,0,0,0)');
|
|
67
|
+
stampCtx.fillStyle = mask;
|
|
68
|
+
stampCtx.fillRect(0, 0, stampSize, stampSize);
|
|
69
|
+
ctx.drawImage(stamp, px - stampRadius, py - stampRadius);
|
|
70
|
+
}
|
|
71
|
+
ctx.restore();
|
|
72
|
+
state.lastX = x;
|
|
73
|
+
state.lastY = y;
|
|
74
|
+
composite();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function strokeTo(x, y) {
|
|
78
|
+
const layer = activeLayer();
|
|
79
|
+
if (!layer) return;
|
|
80
|
+
// Clone uses a stamp-based paint loop, not the line-stroke
|
|
81
|
+
// pipeline below.
|
|
82
|
+
if (state.tool === 'clone') return cloneStrokeTo(x, y, layer);
|
|
83
|
+
|
|
84
|
+
// If the active parent has an active mask sub-layer, brush /
|
|
85
|
+
// eraser / inpaint paint the mask canvas instead of the layer's
|
|
86
|
+
// pixel canvas. Brush adds to the mask, Eraser carves it away,
|
|
87
|
+
// Inpaint still works (its mask plumbing was already pointed at
|
|
88
|
+
// the same canvas).
|
|
89
|
+
const activeMask = getActiveMaskLayer();
|
|
90
|
+
const paintingMask = !!activeMask &&
|
|
91
|
+
(state.tool === 'brush' || state.tool === 'eraser' || state.tool === 'inpaint');
|
|
92
|
+
const ctx = paintingMask
|
|
93
|
+
? activeMask.ctx
|
|
94
|
+
: (state.tool === 'inpaint' ? state.maskCtx : layer.ctx);
|
|
95
|
+
const off = state.layerOffsets.get(layer.id) || { x: 0, y: 0 };
|
|
96
|
+
|
|
97
|
+
ctx.save();
|
|
98
|
+
ctx.lineWidth = state.brushSize;
|
|
99
|
+
ctx.lineCap = 'round';
|
|
100
|
+
ctx.lineJoin = 'round';
|
|
101
|
+
|
|
102
|
+
if (state.tool === 'eraser') {
|
|
103
|
+
ctx.globalCompositeOperation = 'destination-out';
|
|
104
|
+
// Effective alpha = opacity × flow. Opacity = max strength a
|
|
105
|
+
// stroke can reach; flow = how much erases per pass.
|
|
106
|
+
ctx.globalAlpha = (state.eraserOpacity / 100) * (state.eraserFlow / 100);
|
|
107
|
+
ctx.strokeStyle = 'rgba(0,0,0,1)';
|
|
108
|
+
if (state.eraserSoftness > 0) {
|
|
109
|
+
const blurPx = (state.eraserSoftness / 100) * (state.brushSize / 2);
|
|
110
|
+
ctx.filter = `blur(${blurPx.toFixed(2)}px)`;
|
|
111
|
+
}
|
|
112
|
+
} else if (state.tool === 'brush') {
|
|
113
|
+
// Brush — state.color onto the layer (or white onto an active
|
|
114
|
+
// mask sub-layer). Mask painting forces full alpha so masks
|
|
115
|
+
// stay a clean binary by default (a sub-100% brush would
|
|
116
|
+
// silently paint partial-strength mask pixels).
|
|
117
|
+
ctx.globalCompositeOperation = 'source-over';
|
|
118
|
+
ctx.strokeStyle = paintingMask ? 'rgba(255,255,255,1)' : state.color;
|
|
119
|
+
if (paintingMask) {
|
|
120
|
+
ctx.globalAlpha = 1;
|
|
121
|
+
} else {
|
|
122
|
+
ctx.globalAlpha = (state.brushOpacity / 100) * (state.brushFlow / 100);
|
|
123
|
+
if (state.brushSoftness > 0) {
|
|
124
|
+
const blurPx = (state.brushSoftness / 100) * (state.brushSize / 2);
|
|
125
|
+
ctx.filter = `blur(${blurPx.toFixed(2)}px)`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else if (state.tool === 'inpaint') {
|
|
129
|
+
if (state.inpaintEraseStroke) {
|
|
130
|
+
ctx.globalCompositeOperation = 'destination-out';
|
|
131
|
+
ctx.strokeStyle = 'rgba(0,0,0,1)';
|
|
132
|
+
} else {
|
|
133
|
+
ctx.globalCompositeOperation = 'source-over';
|
|
134
|
+
// Diffusion server expects white = inpaint area. The red
|
|
135
|
+
// overlay is rendered separately in composite() for the user.
|
|
136
|
+
ctx.strokeStyle = 'rgba(255,255,255,1)';
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
ctx.globalCompositeOperation = 'source-over';
|
|
140
|
+
ctx.strokeStyle = state.color;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Mask canvases are always full-image (no per-layer offset), so
|
|
144
|
+
// painting onto a mask uses canvas-coord origin too — same as
|
|
145
|
+
// inpaint.
|
|
146
|
+
const onMaskOrInpaint = paintingMask || state.tool === 'inpaint';
|
|
147
|
+
const drawX = onMaskOrInpaint ? 0 : off.x;
|
|
148
|
+
const drawY = onMaskOrInpaint ? 0 : off.y;
|
|
149
|
+
|
|
150
|
+
ctx.beginPath();
|
|
151
|
+
ctx.moveTo(state.lastX - drawX, state.lastY - drawY);
|
|
152
|
+
ctx.lineTo(x - drawX, y - drawY);
|
|
153
|
+
ctx.stroke();
|
|
154
|
+
ctx.restore();
|
|
155
|
+
|
|
156
|
+
state.lastX = x;
|
|
157
|
+
state.lastY = y;
|
|
158
|
+
composite();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return { strokeTo, cloneStrokeTo };
|
|
162
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tool stroke-modifier sliders (Opacity / Flow / Softness) for
|
|
3
|
+
* Eraser, Brush, and Clone. The three sections share identical UX:
|
|
4
|
+
*
|
|
5
|
+
* - Opacity slider: writes to state, updates label, fades the
|
|
6
|
+
* preview swatch opacity.
|
|
7
|
+
* - Flow slider: writes to state, updates label, fades the swatch
|
|
8
|
+
* opacity AND swaps its border style (dashed at low flow → dotted
|
|
9
|
+
* at high flow) so the user sees the "denseness" change.
|
|
10
|
+
* - Softness slider: writes to state, updates label, tweens the
|
|
11
|
+
* radial-gradient inner stop on the swatch so it visually fades
|
|
12
|
+
* from hard disk to soft falloff.
|
|
13
|
+
*
|
|
14
|
+
* The whole block was three near-identical 30-LOC copies before; now
|
|
15
|
+
* it's one helper that takes the tool's prefix + a state-field bag.
|
|
16
|
+
*
|
|
17
|
+
* Usage: just call wireStrokeToolSliders() — the DOM IDs are wired
|
|
18
|
+
* statically from #ge-{eraser,brush,clone}-{opacity,flow,softness}
|
|
19
|
+
* + their labels + preview swatches.
|
|
20
|
+
*/
|
|
21
|
+
import { state } from './state.js';
|
|
22
|
+
|
|
23
|
+
/** Wire the three sliders for one stroke tool. */
|
|
24
|
+
function wireToolSliders(prefix, fields) {
|
|
25
|
+
const opPrev = document.getElementById(`ge-${prefix}-preview-opacity`);
|
|
26
|
+
const flPrev = document.getElementById(`ge-${prefix}-preview-flow`);
|
|
27
|
+
const softPrev = document.getElementById(`ge-${prefix}-preview-softness`);
|
|
28
|
+
|
|
29
|
+
document.getElementById(`ge-${prefix}-opacity`)?.addEventListener('input', (e) => {
|
|
30
|
+
state[fields.opacity] = parseInt(e.target.value);
|
|
31
|
+
document.getElementById(`ge-${prefix}-opacity-label`).textContent = state[fields.opacity] + '%';
|
|
32
|
+
if (opPrev) opPrev.style.opacity = (state[fields.opacity] / 100).toFixed(2);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
document.getElementById(`ge-${prefix}-flow`)?.addEventListener('input', (e) => {
|
|
36
|
+
state[fields.flow] = parseInt(e.target.value);
|
|
37
|
+
document.getElementById(`ge-${prefix}-flow-label`).textContent = state[fields.flow] + '%';
|
|
38
|
+
// Lower flow → fewer / sparser dots. Cycle dot densities by
|
|
39
|
+
// swapping the dashed/dotted border style and fading opacity.
|
|
40
|
+
if (flPrev) {
|
|
41
|
+
const denseness = Math.max(1, Math.round(state[fields.flow] / 20));
|
|
42
|
+
flPrev.style.borderStyle = denseness <= 2 ? 'dashed' : 'dotted';
|
|
43
|
+
flPrev.style.opacity = (0.3 + (state[fields.flow] / 100) * 0.6).toFixed(2);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
document.getElementById(`ge-${prefix}-softness`)?.addEventListener('input', (e) => {
|
|
48
|
+
state[fields.softness] = parseInt(e.target.value);
|
|
49
|
+
document.getElementById(`ge-${prefix}-softness-label`).textContent = state[fields.softness] + '%';
|
|
50
|
+
// Preview tweens from a hard disk into a soft radial gradient as
|
|
51
|
+
// softness rises (the CSS already sets the radial gradient — we
|
|
52
|
+
// just tween the inner solid radius to communicate the falloff).
|
|
53
|
+
if (softPrev) {
|
|
54
|
+
const innerStop = Math.max(0, 60 - state[fields.softness] * 0.55);
|
|
55
|
+
softPrev.style.background = `radial-gradient(circle, var(--fg) 0%, var(--fg) ${innerStop}%, transparent 90%)`;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function wireStrokeToolSliders() {
|
|
61
|
+
wireToolSliders('eraser', { opacity: 'eraserOpacity', flow: 'eraserFlow', softness: 'eraserSoftness' });
|
|
62
|
+
wireToolSliders('brush', { opacity: 'brushOpacity', flow: 'brushFlow', softness: 'brushSoftness' });
|
|
63
|
+
wireToolSliders('clone', { opacity: 'cloneOpacity', flow: 'cloneFlow', softness: 'cloneSoftness' });
|
|
64
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clone tool — Alt-click (desktop) or double-tap (mobile) sets the
|
|
3
|
+
* sample source; a regular click+drag stamps from that source onto the
|
|
4
|
+
* active layer. The source point moves WITH the brush so the offset
|
|
5
|
+
* stays constant across the stroke.
|
|
6
|
+
*
|
|
7
|
+
* begin() handles the source-pick and stroke-start branches; the
|
|
8
|
+
* actual per-sample stamping continues through the shared stroke
|
|
9
|
+
* pipeline (`_strokeTo`) which knows about clone-mode internally.
|
|
10
|
+
*
|
|
11
|
+
* @param {{
|
|
12
|
+
* activeLayer: () => object | null,
|
|
13
|
+
* saveState: (label?: string) => void,
|
|
14
|
+
* strokeTo: (x: number, y: number) => void,
|
|
15
|
+
* showToast: (msg: string) => void,
|
|
16
|
+
* }} deps
|
|
17
|
+
*/
|
|
18
|
+
import { state } from '../state.js';
|
|
19
|
+
import { canvasCoords } from '../canvas-coords.js';
|
|
20
|
+
|
|
21
|
+
export function createCloneTool({ activeLayer, saveState, strokeTo, showToast }) {
|
|
22
|
+
return {
|
|
23
|
+
begin(e) {
|
|
24
|
+
const layer = activeLayer();
|
|
25
|
+
const coords = canvasCoords(e, state.mainCanvas);
|
|
26
|
+
// Mobile equivalent of Alt-click: double-tap in screen pixels.
|
|
27
|
+
// Wider tolerances (500 ms, 40 px) than desktop because finger
|
|
28
|
+
// taps drift more than mouse clicks.
|
|
29
|
+
const isTouchEvt = e.type && e.type.startsWith('touch');
|
|
30
|
+
let isDoubleTap = false;
|
|
31
|
+
if (isTouchEvt) {
|
|
32
|
+
const t = e.touches ? e.touches[0] : null;
|
|
33
|
+
const cx = t ? t.clientX : 0;
|
|
34
|
+
const cy = t ? t.clientY : 0;
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
const dt = now - state.cloneLastTapTime;
|
|
37
|
+
const dx = cx - state.cloneLastTapX;
|
|
38
|
+
const dy = cy - state.cloneLastTapY;
|
|
39
|
+
if (dt < 500 && Math.hypot(dx, dy) < 40) {
|
|
40
|
+
isDoubleTap = true;
|
|
41
|
+
state.cloneLastTapTime = 0; // consume the pair
|
|
42
|
+
} else {
|
|
43
|
+
state.cloneLastTapTime = now;
|
|
44
|
+
state.cloneLastTapX = cx;
|
|
45
|
+
state.cloneLastTapY = cy;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (e.altKey || isDoubleTap) {
|
|
49
|
+
state.cloneSourceX = coords.x;
|
|
50
|
+
state.cloneSourceY = coords.y;
|
|
51
|
+
state.cloneSourceLayerId = (layer && layer.id) || state.activeLayerId;
|
|
52
|
+
state.cloneSourceSnapshot = null; // captured at first stroke
|
|
53
|
+
showToast('Clone source set');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (state.cloneSourceX === null || state.cloneSourceY === null) {
|
|
57
|
+
showToast(isTouchEvt
|
|
58
|
+
? 'Double-tap first to set a clone source'
|
|
59
|
+
: 'Alt-click first to set a clone source');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!layer || layer.locked) return;
|
|
63
|
+
saveState('Clone stroke');
|
|
64
|
+
// Snapshot the source layer's pixels at stroke-start so the
|
|
65
|
+
// brush samples clean source pixels even after it has painted
|
|
66
|
+
// over them. Otherwise we'd cascade-clone the same ring.
|
|
67
|
+
const srcLayer = state.layers.find(l => l.id === state.cloneSourceLayerId) || layer;
|
|
68
|
+
const snap = document.createElement('canvas');
|
|
69
|
+
snap.width = srcLayer.canvas.width;
|
|
70
|
+
snap.height = srcLayer.canvas.height;
|
|
71
|
+
snap.getContext('2d').drawImage(srcLayer.canvas, 0, 0);
|
|
72
|
+
state.cloneSourceSnapshot = snap;
|
|
73
|
+
state.cloneStrokeStartX = coords.x;
|
|
74
|
+
state.cloneStrokeStartY = coords.y;
|
|
75
|
+
state.drawing = true;
|
|
76
|
+
state.lastX = coords.x;
|
|
77
|
+
state.lastY = coords.y;
|
|
78
|
+
strokeTo(coords.x, coords.y);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|