evomeme 0.1.9 → 0.1.10
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/dist/canvas-public/app.js +509 -5999
- package/dist/canvas-public/assets/presets/catalog.json +47 -0
- package/dist/canvas-public/assets/presets/tiles/A_01_CaoDi.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_02_ShaMo.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_03_TianKong.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_04_ShuiBo.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_05_HaiMian.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_06_MuDiBan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_07_ShiZhuan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_08_AnRongYan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_09_QingTaiShi.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_10_ShenHai.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_11_HuiYanShi.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_12_HongTu.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_13_GengDi.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_14_HuoShanYan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_15_NiTu.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_16_HuangSha.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_17_CongLin.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_18_ZiYanShi.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_19_MoGuTu.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_20_HuaDian.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_21_HaiLang.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_22_GanTu.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_23_QingTaiShiBan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_24_XingKong.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_25_MoFaFuWen.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_26_ShiTuYeDi.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_27_LanZhuan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_28_HongZhuan.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_29_YueQiu.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_30_JinShuGe.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_31_JinShuJingGai.png +0 -0
- package/dist/canvas-public/assets/presets/tiles/A_32_ShuZiChuang.png +0 -0
- package/dist/canvas-public/canvas/actions.js +143 -0
- package/dist/canvas-public/canvas/camera.js +28 -0
- package/dist/canvas-public/canvas/chrome.js +13 -0
- package/dist/canvas-public/canvas/data.js +123 -0
- package/dist/canvas-public/canvas/dependencies.js +19 -0
- package/dist/canvas-public/canvas/interactions.js +544 -0
- package/dist/canvas-public/canvas/panel-resize.js +5 -0
- package/dist/canvas-public/canvas/renderer.js +297 -0
- package/dist/canvas-public/canvas/selection.js +62 -0
- package/dist/canvas-public/canvas/serialization.js +118 -0
- package/dist/canvas-public/canvas/sync.js +202 -0
- package/dist/canvas-public/core/api.js +27 -0
- package/dist/canvas-public/core/feature-registry.js +29 -0
- package/dist/canvas-public/core/feature-state.js +228 -0
- package/dist/canvas-public/core/layout.js +133 -0
- package/dist/canvas-public/core/operations.js +38 -0
- package/dist/canvas-public/core/project.js +203 -0
- package/dist/canvas-public/core/state.js +27 -0
- package/dist/canvas-public/dialogs/context-menu.js +118 -0
- package/dist/canvas-public/elements/base.js +100 -0
- package/dist/canvas-public/elements/connections.js +105 -0
- package/dist/canvas-public/elements/drag.js +53 -0
- package/dist/canvas-public/elements/image.js +259 -0
- package/dist/canvas-public/elements/loading-recovery.js +5 -0
- package/dist/canvas-public/elements/loading.js +21 -0
- package/dist/canvas-public/elements/map.js +64 -0
- package/dist/canvas-public/elements/registry.js +58 -0
- package/dist/canvas-public/elements/replacement.js +78 -0
- package/dist/canvas-public/elements/resize.js +210 -0
- package/dist/canvas-public/elements/task-pipeline.js +234 -0
- package/dist/canvas-public/elements/types.js +21 -0
- package/dist/canvas-public/elements/ui.js +14 -0
- package/dist/canvas-public/elements/video.js +64 -0
- package/dist/canvas-public/features/assets/local-assets.js +72 -0
- package/dist/canvas-public/features/assets/official-assets.js +538 -0
- package/dist/canvas-public/features/editing/canvas-size.js +532 -0
- package/dist/canvas-public/features/editing/color-key.js +469 -0
- package/dist/canvas-public/features/editing/cutout.js +20 -0
- package/dist/canvas-public/features/editing/interactive-image-editing.js +981 -0
- package/dist/canvas-public/features/editing/layer-decomposition.js +44 -0
- package/dist/canvas-public/features/editing/manual-split.js +114 -0
- package/dist/canvas-public/features/editing/perfect-pixel.js +336 -0
- package/dist/canvas-public/features/editing/scroll-preview.js +129 -0
- package/dist/canvas-public/features/editing/scroll-seam-elimination.js +71 -0
- package/dist/canvas-public/features/editing/seam-elimination.js +46 -0
- package/dist/canvas-public/features/editing/smart-split.js +48 -0
- package/dist/canvas-public/features/editing/source-preview.js +43 -0
- package/dist/canvas-public/features/editing/video-cycle.js +49 -0
- package/dist/canvas-public/features/editing/video-frames.js +35 -0
- package/dist/canvas-public/features/frame-editor/frame-editing.js +755 -0
- package/dist/canvas-public/features/frame-editor/frame-model.js +63 -0
- package/dist/canvas-public/features/frame-editor/playback.js +83 -0
- package/dist/canvas-public/features/frame-editor/preview.js +149 -0
- package/dist/canvas-public/features/generation/animation.js +272 -0
- package/dist/canvas-public/features/generation/asset-batch.js +102 -0
- package/dist/canvas-public/features/generation/direction.js +163 -0
- package/dist/canvas-public/features/generation/fields.js +73 -0
- package/dist/canvas-public/features/generation/game-ui.js +64 -0
- package/dist/canvas-public/features/generation/image.js +83 -0
- package/dist/canvas-public/features/generation/scroll-image.js +157 -0
- package/dist/canvas-public/features/generation/seamless-tile.js +52 -0
- package/dist/canvas-public/features/generation/tile-transition-atlas.js +79 -0
- package/dist/canvas-public/features/generation/video.js +105 -0
- package/dist/canvas-public/features/map/creation.js +73 -0
- package/dist/canvas-public/features/map/tile-map-editor.js +2518 -0
- package/dist/canvas-public/features/registry.js +59 -0
- package/dist/canvas-public/index.html +84 -259
- package/dist/canvas-public/inspector/controls.js +49 -0
- package/dist/canvas-public/inspector/frame-preview.js +11 -0
- package/dist/canvas-public/inspector/inspector.js +190 -0
- package/dist/canvas-public/inspector/media-inspector.js +517 -0
- package/dist/canvas-public/inspector/media-preview.js +56 -0
- package/dist/canvas-public/inspector/number-stepper.js +96 -0
- package/dist/canvas-public/inspector/resize.js +88 -0
- package/dist/canvas-public/inspector/scroll-preview.js +11 -0
- package/dist/canvas-public/inspector/ui-inspector.js +14 -0
- package/dist/canvas-public/language/en-US.js +1059 -0
- package/dist/canvas-public/language/index.js +79 -0
- package/dist/canvas-public/language/zh-CN.js +1059 -0
- package/dist/canvas-public/map/export.js +9 -0
- package/dist/canvas-public/map/inspector.js +8 -0
- package/dist/canvas-public/map/model.js +409 -0
- package/dist/canvas-public/map/tile-map-editor.js +2 -0
- package/dist/canvas-public/media/metadata.js +183 -0
- package/dist/canvas-public/media/support.js +183 -0
- package/dist/canvas-public/styles/base.css +49 -0
- package/dist/canvas-public/styles/canvas.css +127 -0
- package/dist/canvas-public/styles/controls.css +203 -0
- package/dist/canvas-public/styles/dialogs.css +521 -0
- package/dist/canvas-public/styles/feature-form.css +409 -0
- package/dist/canvas-public/styles/inspector.css +441 -0
- package/dist/canvas-public/styles/layout.css +344 -0
- package/dist/canvas-public/styles/map.css +11 -0
- package/dist/canvas-public/styles/nodes.css +636 -0
- package/dist/canvas-public/styles.css +9 -2247
- package/dist/canvas-public/ui/controls.js +222 -0
- package/dist/canvas-public/ui/elements.js +9 -0
- package/dist/canvas-public/ui/feature-controller.js +296 -0
- package/dist/canvas-public/ui/feature-form.js +401 -0
- package/dist/canvas-public/ui/settings.js +83 -0
- package/dist/canvas-public/ui/toolbar.js +55 -0
- package/dist/canvas-public/vendor/pixi-tilemap.js +126 -0
- package/dist/canvas-public/vendor/pixi.min.js +2340 -0
- package/dist/canvas-public/workers/color-key-worker.js +289 -0
- package/dist/canvas-public/workers/perfect-pixel-worker.js +510 -0
- package/dist/index.js +42236 -13382
- package/dist/skills/en-US/evomeme-canvas/SKILL.md +52 -0
- package/dist/skills/en-US/evomeme-canvas/agents/openai.yaml +7 -0
- package/dist/skills/en-US/evomeme-cloud-fs/SKILL.md +176 -0
- package/dist/skills/en-US/evomeme-cloud-fs/agents/openai.yaml +7 -0
- package/dist/skills/en-US/evomeme-cover/SKILL.md +132 -0
- package/dist/skills/en-US/evomeme-cover/agents/openai.yaml +7 -0
- package/dist/skills/en-US/evomeme-game-maker/SKILL.md +288 -0
- package/dist/skills/en-US/evomeme-game-maker/agents/openai.yaml +4 -0
- package/dist/skills/en-US/evomeme-login/SKILL.md +92 -0
- package/dist/skills/en-US/evomeme-login/agents/openai.yaml +7 -0
- package/dist/skills/en-US/evomeme-native-bridge-sdk/SKILL.md +286 -0
- package/dist/skills/en-US/evomeme-native-bridge-sdk/agents/openai.yaml +8 -0
- package/dist/skills/en-US/evomeme-tos-upload/SKILL.md +47 -0
- package/dist/skills/en-US/evomeme-tos-upload/agents/openai.yaml +5 -0
- package/dist/skills/en-US/evomeme-ui/SKILL.md +123 -0
- package/dist/skills/en-US/evomeme-ui/agents/openai.yaml +4 -0
- package/dist/skills/en-US/evomeme-ui/references/host-layout.md +69 -0
- package/dist/skills/en-US/game-art/SKILL.md +121 -0
- package/dist/skills/en-US/game-art/agents/openai.yaml +8 -0
- package/dist/skills/en-US/game-asset-align/SKILL.md +45 -0
- package/dist/skills/en-US/game-asset-align/agents/openai.yaml +8 -0
- package/dist/skills/en-US/game-asset-align/references/alignment-contract.md +61 -0
- package/dist/skills/en-US/game-asset-align/references/blender-scene-pipeline.md +45 -0
- package/dist/skills/en-US/game-asset-align/references/canonical-package.md +26 -0
- package/dist/skills/en-US/game-asset-align/references/engine-capabilities.md +14 -0
- package/dist/skills/en-US/game-asset-align/references/lightweight-review.md +32 -0
- package/dist/skills/en-US/game-asset-align/references/repair-policy.md +30 -0
- package/dist/skills/en-US/game-asset-align/references/tool-contract.md +39 -0
- package/dist/skills/en-US/game-asset-align/references/visual-review.md +26 -0
- package/dist/skills/en-US/game-asset-image-generator/SKILL.md +104 -0
- package/dist/skills/en-US/game-asset-image-generator/agents/openai.yaml +7 -0
- package/dist/skills/en-US/game-asset-image-generator/references/background.md +32 -0
- package/dist/skills/en-US/game-asset-image-generator/references/static-game-assets.md +38 -0
- package/dist/skills/en-US/game-audio/SKILL.md +82 -0
- package/dist/skills/en-US/game-audio/agents/openai.yaml +4 -0
- package/dist/skills/en-US/game-demo/SKILL.md +103 -0
- package/dist/skills/en-US/game-demo/agents/openai.yaml +7 -0
- package/dist/skills/en-US/game-maker/SKILL.md +111 -0
- package/dist/skills/en-US/game-maker/agents/openai.yaml +4 -0
- package/dist/skills/en-US/game-test/SKILL.md +58 -0
- package/dist/skills/en-US/game-test/agents/openai.yaml +7 -0
- package/dist/skills/en-US/game-ui/SKILL.md +177 -0
- package/dist/skills/en-US/game-ui/agents/openai.yaml +4 -0
- package/dist/skills/en-US/godot-3d-game/SKILL.md +39 -0
- package/dist/skills/en-US/godot-3d-game/agents/openai.yaml +8 -0
- package/dist/skills/en-US/godot-3d-game/references/alignment-gates.md +26 -0
- package/dist/skills/en-US/godot-3d-game/references/appearance-alignment.md +52 -0
- package/dist/skills/en-US/godot-3d-game/references/build-and-qa.md +22 -0
- package/dist/skills/en-US/godot-3d-game/references/canonical-asset-runtime.md +27 -0
- package/dist/skills/en-US/godot-3d-game/references/import-and-wrapper-scenes.md +20 -0
- package/dist/skills/en-US/godot-3d-game/references/physics-colliders.md +13 -0
- package/dist/skills/en-US/godot-3d-game/references/project-structure.md +22 -0
- package/dist/skills/en-US/godot-3d-game/references/skeleton-animation.md +16 -0
- package/dist/skills/en-US/phaser-2d-game/SKILL.md +127 -0
- package/dist/skills/en-US/phaser-2d-game/agents/openai.yaml +8 -0
- package/dist/skills/en-US/phaser-2d-game/references/engine-performance.md +64 -0
- package/dist/skills/en-US/phaser-2d-game/references/engine-physics.md +139 -0
- package/dist/skills/en-US/phaser-2d-game/references/engine-runtime.md +129 -0
- package/dist/skills/en-US/phaser-2d-game/references/engine-spritesheets.md +99 -0
- package/dist/skills/en-US/phaser-2d-game/references/engine-tilemaps.md +80 -0
- package/dist/skills/en-US/phaser-2d-game/references/file-structure.md +94 -0
- package/dist/skills/en-US/phaser-2d-graphics-builder/SKILL.md +68 -0
- package/dist/skills/en-US/phaser-2d-graphics-builder/agents/openai.yaml +7 -0
- package/dist/skills/en-US/threejs-3d-game/SKILL.md +117 -0
- package/dist/skills/en-US/threejs-3d-game/agents/openai.yaml +7 -0
- package/dist/skills/en-US/threejs-3d-game/references/engine-asset-pipeline.md +153 -0
- package/dist/skills/en-US/threejs-3d-game/references/engine-audio.md +70 -0
- package/dist/skills/en-US/threejs-3d-game/references/engine-input-camera.md +84 -0
- package/dist/skills/en-US/threejs-3d-game/references/engine-performance.md +96 -0
- package/dist/skills/en-US/threejs-3d-game/references/engine-physics.md +142 -0
- package/dist/skills/en-US/threejs-3d-game/references/engine-runtime.md +199 -0
- package/dist/skills/en-US/threejs-3d-game/references/file-structure.md +353 -0
- package/dist/skills/en-US/threejs-aaa-graphics-builder/SKILL.md +62 -0
- package/dist/skills/en-US/threejs-aaa-graphics-builder/agents/openai.yaml +7 -0
- package/{skills → dist/skills/zh-CN}/evomeme-cloud-fs/SKILL.md +4 -4
- package/{skills → dist/skills/zh-CN}/evomeme-cover/SKILL.md +1 -1
- package/{skills → dist/skills/zh-CN}/evomeme-game-maker/SKILL.md +91 -88
- package/{skills → dist/skills/zh-CN}/evomeme-tos-upload/SKILL.md +6 -5
- package/dist/skills/zh-CN/evomeme-ui/SKILL.md +123 -0
- package/dist/skills/zh-CN/evomeme-ui/agents/openai.yaml +4 -0
- package/dist/skills/zh-CN/evomeme-ui/references/host-layout.md +69 -0
- package/dist/skills/zh-CN/game-asset-align/SKILL.md +45 -0
- package/dist/skills/zh-CN/game-asset-align/agents/openai.yaml +8 -0
- package/dist/skills/zh-CN/game-asset-align/references/alignment-contract.md +61 -0
- package/dist/skills/zh-CN/game-asset-align/references/blender-scene-pipeline.md +45 -0
- package/dist/skills/zh-CN/game-asset-align/references/canonical-package.md +26 -0
- package/dist/skills/zh-CN/game-asset-align/references/engine-capabilities.md +14 -0
- package/dist/skills/zh-CN/game-asset-align/references/lightweight-review.md +32 -0
- package/dist/skills/zh-CN/game-asset-align/references/repair-policy.md +30 -0
- package/dist/skills/zh-CN/game-asset-align/references/tool-contract.md +39 -0
- package/dist/skills/zh-CN/game-asset-align/references/visual-review.md +26 -0
- package/{skills → dist/skills/zh-CN}/game-asset-image-generator/SKILL.md +1 -1
- package/dist/skills/zh-CN/game-audio/references/bgm-cdn.md +127 -0
- package/dist/skills/zh-CN/game-audio/references/sfx-cdn.md +77 -0
- package/dist/skills/zh-CN/game-test/references/checklists/playtest-qa.md +12 -0
- package/{skills → dist/skills/zh-CN}/game-ui/SKILL.md +9 -1
- package/dist/skills/zh-CN/game-ui/references/checklists/game-ui-quality.md +14 -0
- package/dist/skills/zh-CN/game-ui/references/checklists/hud-readability.md +12 -0
- package/dist/skills/zh-CN/game-ui/references/checklists/mobile-input.md +12 -0
- package/dist/skills/zh-CN/game-ui/references/checklists/responsive-ui-fit.md +12 -0
- package/dist/skills/zh-CN/game-ui/references/ui-patterns.md +140 -0
- package/dist/skills/zh-CN/game-ui/references/ui-prompt-templates.md +63 -0
- package/dist/skills/zh-CN/godot-3d-game/SKILL.md +39 -0
- package/dist/skills/zh-CN/godot-3d-game/agents/openai.yaml +8 -0
- package/dist/skills/zh-CN/godot-3d-game/references/alignment-gates.md +26 -0
- package/dist/skills/zh-CN/godot-3d-game/references/appearance-alignment.md +52 -0
- package/dist/skills/zh-CN/godot-3d-game/references/build-and-qa.md +22 -0
- package/dist/skills/zh-CN/godot-3d-game/references/canonical-asset-runtime.md +27 -0
- package/dist/skills/zh-CN/godot-3d-game/references/import-and-wrapper-scenes.md +20 -0
- package/dist/skills/zh-CN/godot-3d-game/references/physics-colliders.md +13 -0
- package/dist/skills/zh-CN/godot-3d-game/references/project-structure.md +22 -0
- package/dist/skills/zh-CN/godot-3d-game/references/skeleton-animation.md +16 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-1.jpeg +0 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-2.jpeg +0 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-3.jpg +0 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/checklists/compose-quality.md +10 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/checklists/performance-safe-visual-detail.md +9 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/checklists/premium-game-quality-gate.md +15 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/checklists/sprite-quality.md +10 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/checklists/technical-art-quality.md +9 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/checklists/visual-scorecard.md +9 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/compose-recipes.md +71 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/graphics-prompt-templates.md +33 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/implementation-blueprint.md +82 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/sprite-recipes.md +90 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/technical-art.md +67 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/vfx-recipes.md +67 -0
- package/dist/skills/zh-CN/phaser-2d-graphics-builder/references/visual-scorecard.md +129 -0
- package/{skills → dist/skills/zh-CN}/threejs-3d-game/SKILL.md +6 -2
- package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/engine-asset-pipeline.md +52 -15
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-1.jpg +0 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-2.jpg +0 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-3.jpg +0 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/checklists/aaa-game-quality-gate.md +23 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/checklists/aaa-visual-scorecard.md +19 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/checklists/material-lighting-quality.md +14 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/checklists/performance-safe-visual-detail.md +14 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/checklists/procedural-model-quality.md +15 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/checklists/technical-art-quality.md +17 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/graphics-prompt-templates.md +236 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/implementation-blueprint.md +161 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/model-recipes.md +146 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/render-recipes.md +90 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/shader-cookbook.md +292 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/technical-art.md +167 -0
- package/dist/skills/zh-CN/threejs-aaa-graphics-builder/references/visual-scorecard.md +147 -0
- package/dist/stage-blender/bake_materials.py +102 -0
- package/dist/stage-blender/export_scene.py +275 -0
- package/dist/stage-blender/preview_camera.py +90 -0
- package/dist/stage-blender/repair_mesh.py +112 -0
- package/dist/stage-public/app.js +759 -0
- package/dist/stage-public/baked/bakePilot.js +44 -0
- package/dist/stage-public/baked/bakedScene.js +129 -0
- package/dist/stage-public/baked/sceneAppearance.js +225 -0
- package/dist/stage-public/baked/sceneCamera.js +45 -0
- package/dist/stage-public/comparison-contract.js +28 -0
- package/dist/stage-public/delivery.html +4 -0
- package/dist/stage-public/delivery.js +17 -0
- package/dist/stage-public/godot/appearance.gd +170 -0
- package/dist/stage-public/godot/preview.gd +79 -0
- package/dist/stage-public/index.html +141 -0
- package/dist/stage-public/review-app.js +289 -0
- package/dist/stage-public/review-runtime.js +63 -0
- package/dist/stage-public/review.css +24 -0
- package/dist/stage-public/review.html +47 -0
- package/dist/stage-public/scene-runtime.js +212 -0
- package/dist/stage-public/sceneContractRuntime.js +235 -0
- package/dist/stage-public/styles.css +328 -0
- package/dist/stage-public/three-appearance.js +104 -0
- package/dist/stage-public/vendor/three170/LICENSE +21 -0
- package/dist/stage-public/vendor/three170/build/three.module.js +54571 -0
- package/dist/stage-public/vendor/three170/examples/jsm/controls/OrbitControls.js +1523 -0
- package/dist/stage-public/vendor/three170/examples/jsm/environments/RoomEnvironment.js +144 -0
- package/dist/stage-public/vendor/three170/examples/jsm/libs/fflate.module.js +2672 -0
- package/dist/stage-public/vendor/three170/examples/jsm/loaders/EXRLoader.js +2563 -0
- package/dist/stage-public/vendor/three170/examples/jsm/loaders/GLTFLoader.js +4727 -0
- package/dist/stage-public/vendor/three170/examples/jsm/utils/BufferGeometryUtils.js +1373 -0
- package/dist/tile-transition-mask.svg +40 -0
- package/package.json +21 -7
- package/dist/canvas-public/cycle-detect.js +0 -166
- package/dist/canvas-public/smart-split.js +0 -185
- /package/{skills → dist/skills/en-US}/game-audio/references/bgm-cdn.md +0 -0
- /package/{skills → dist/skills/en-US}/game-audio/references/sfx-cdn.md +0 -0
- /package/{skills → dist/skills/en-US}/game-test/references/checklists/playtest-qa.md +0 -0
- /package/{skills → dist/skills/en-US}/game-ui/references/checklists/game-ui-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/game-ui/references/checklists/hud-readability.md +0 -0
- /package/{skills → dist/skills/en-US}/game-ui/references/checklists/mobile-input.md +0 -0
- /package/{skills → dist/skills/en-US}/game-ui/references/checklists/responsive-ui-fit.md +0 -0
- /package/{skills → dist/skills/en-US}/game-ui/references/ui-patterns.md +0 -0
- /package/{skills → dist/skills/en-US}/game-ui/references/ui-prompt-templates.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-1.jpeg +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-2.jpeg +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-3.jpg +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/checklists/compose-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/checklists/performance-safe-visual-detail.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/checklists/premium-game-quality-gate.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/checklists/sprite-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/checklists/technical-art-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/checklists/visual-scorecard.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/compose-recipes.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/graphics-prompt-templates.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/implementation-blueprint.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/sprite-recipes.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/technical-art.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/vfx-recipes.md +0 -0
- /package/{skills → dist/skills/en-US}/phaser-2d-graphics-builder/references/visual-scorecard.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-1.jpg +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-2.jpg +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-3.jpg +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/checklists/aaa-game-quality-gate.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/checklists/aaa-visual-scorecard.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/checklists/material-lighting-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/checklists/performance-safe-visual-detail.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/checklists/procedural-model-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/checklists/technical-art-quality.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/graphics-prompt-templates.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/implementation-blueprint.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/model-recipes.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/render-recipes.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/shader-cookbook.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/technical-art.md +0 -0
- /package/{skills → dist/skills/en-US}/threejs-aaa-graphics-builder/references/visual-scorecard.md +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-canvas/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-canvas/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-cloud-fs/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-cover/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-game-maker/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-login/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-login/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-native-bridge-sdk/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-native-bridge-sdk/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/evomeme-tos-upload/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-art/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-art/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-asset-image-generator/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-asset-image-generator/references/background.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-asset-image-generator/references/static-game-assets.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-audio/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-audio/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-demo/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-demo/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-maker/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-maker/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-test/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/game-test/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/game-ui/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/references/engine-performance.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/references/engine-physics.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/references/engine-runtime.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/references/engine-spritesheets.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/references/engine-tilemaps.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-game/references/file-structure.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-graphics-builder/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/phaser-2d-graphics-builder/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/agents/openai.yaml +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/engine-audio.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/engine-input-camera.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/engine-performance.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/engine-physics.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/engine-runtime.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-3d-game/references/file-structure.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-aaa-graphics-builder/SKILL.md +0 -0
- /package/{skills → dist/skills/zh-CN}/threejs-aaa-graphics-builder/agents/openai.yaml +0 -0
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
import { t } from '../../language/index.js'
|
|
2
|
+
import { api } from '../../core/api.js'
|
|
3
|
+
import { state } from '../../core/state.js'
|
|
4
|
+
import {
|
|
5
|
+
ensureFeatureState,
|
|
6
|
+
notifyFeatureState,
|
|
7
|
+
subscribeFeatureState,
|
|
8
|
+
} from '../../core/feature-state.js'
|
|
9
|
+
import { el } from '../../ui/controls.js'
|
|
10
|
+
|
|
11
|
+
// Painterro owns only drawing interactions. Parameters and remote submission use the feature controller.
|
|
12
|
+
export default {
|
|
13
|
+
styles: `
|
|
14
|
+
.interactive-editor-stage {
|
|
15
|
+
position: relative;
|
|
16
|
+
flex: 1 1 auto;
|
|
17
|
+
min-height: 440px;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.interactive-editor-host {
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
border: 1px solid var(--line);
|
|
26
|
+
border-radius: 14px;
|
|
27
|
+
background:
|
|
28
|
+
radial-gradient(circle at 50% 15%, rgba(61, 214, 198, 0.06), transparent 38%),
|
|
29
|
+
var(--bg-0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.interactive-editor-host .ptro-wrapper {
|
|
33
|
+
bottom: 0 !important;
|
|
34
|
+
color: var(--text);
|
|
35
|
+
background:
|
|
36
|
+
radial-gradient(circle at 50% 12%, rgba(61, 214, 198, 0.06), transparent 40%),
|
|
37
|
+
var(--bg-0) !important;
|
|
38
|
+
font-family: 'DM Sans', sans-serif !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.interactive-editor-host .ptro-wrapper .ptro-substrate {
|
|
42
|
+
opacity: 1 !important;
|
|
43
|
+
background: var(--bg-1) !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.interactive-editor-host .ptro-scroller {
|
|
47
|
+
padding: 20px 20px 20px 72px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.interactive-editor-host.is-panning .ptro-scroller,
|
|
51
|
+
.interactive-editor-host.is-panning .ptro-crp-el {
|
|
52
|
+
cursor: grabbing !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.interactive-editor-host .ptro-bar {
|
|
56
|
+
top: 50% !important;
|
|
57
|
+
right: auto !important;
|
|
58
|
+
bottom: auto !important;
|
|
59
|
+
left: 14px !important;
|
|
60
|
+
width: auto !important;
|
|
61
|
+
height: auto !important;
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: flex-start;
|
|
64
|
+
transform: translateY(-50%);
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
background: transparent !important;
|
|
67
|
+
color: var(--text) !important;
|
|
68
|
+
font-family: 'DM Sans', sans-serif !important;
|
|
69
|
+
z-index: 30;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.interactive-editor-host .ptro-bar > div {
|
|
73
|
+
position: relative;
|
|
74
|
+
width: max-content;
|
|
75
|
+
max-width: none;
|
|
76
|
+
height: auto !important;
|
|
77
|
+
min-width: 46px;
|
|
78
|
+
min-height: 0;
|
|
79
|
+
margin: 0 auto;
|
|
80
|
+
padding: 6px;
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
gap: 4px;
|
|
86
|
+
overflow: visible !important;
|
|
87
|
+
pointer-events: auto;
|
|
88
|
+
border: 1px solid var(--line);
|
|
89
|
+
border-radius: 15px;
|
|
90
|
+
background: rgba(26, 31, 39, 0.92);
|
|
91
|
+
box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
|
|
92
|
+
backdrop-filter: blur(18px);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.interactive-editor-host .ptro-bar .ptro-icon-btn {
|
|
96
|
+
width: 34px !important;
|
|
97
|
+
height: 34px !important;
|
|
98
|
+
margin: 0 !important;
|
|
99
|
+
padding: 0;
|
|
100
|
+
flex: 0 0 34px;
|
|
101
|
+
border: 1px solid transparent !important;
|
|
102
|
+
border-radius: 50%;
|
|
103
|
+
color: var(--muted) !important;
|
|
104
|
+
background: transparent !important;
|
|
105
|
+
box-shadow: none !important;
|
|
106
|
+
transition:
|
|
107
|
+
color 120ms ease,
|
|
108
|
+
border-color 120ms ease,
|
|
109
|
+
background 120ms ease,
|
|
110
|
+
transform 120ms ease;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.interactive-editor-host .ptro-bar .ptro-icon-btn:hover:not(:disabled) {
|
|
114
|
+
color: var(--text) !important;
|
|
115
|
+
border-color: var(--line) !important;
|
|
116
|
+
background: var(--bg-2) !important;
|
|
117
|
+
transform: translateY(-1px);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.interactive-editor-host .ptro-bar .ptro-icon-btn.ptro-color-active-control {
|
|
121
|
+
color: #071311 !important;
|
|
122
|
+
border-color: rgba(61, 214, 198, 0.72) !important;
|
|
123
|
+
background: var(--accent) !important;
|
|
124
|
+
box-shadow: 0 6px 18px rgba(61, 214, 198, 0.2) !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.interactive-editor-host .ptro-bar .ptro-icon-btn:disabled {
|
|
128
|
+
opacity: 0.3;
|
|
129
|
+
cursor: not-allowed;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.interactive-editor-host .ptro-bar .ptro-icon-btn svg {
|
|
133
|
+
width: 18px;
|
|
134
|
+
height: 18px;
|
|
135
|
+
fill: none;
|
|
136
|
+
stroke: currentColor;
|
|
137
|
+
stroke-width: 1.8;
|
|
138
|
+
stroke-linecap: round;
|
|
139
|
+
stroke-linejoin: round;
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.interactive-editor-host .ptro-tool-controls {
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: 0;
|
|
146
|
+
bottom: auto;
|
|
147
|
+
left: calc(100% + 10px);
|
|
148
|
+
width: max-content;
|
|
149
|
+
min-height: 42px;
|
|
150
|
+
max-width: none;
|
|
151
|
+
padding: 5px 8px;
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
gap: 7px;
|
|
156
|
+
flex-wrap: nowrap;
|
|
157
|
+
overflow: visible;
|
|
158
|
+
transform: translateY(-50%);
|
|
159
|
+
border: 1px solid var(--line);
|
|
160
|
+
border-radius: 12px;
|
|
161
|
+
background: rgba(26, 31, 39, 0.94);
|
|
162
|
+
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
|
|
163
|
+
backdrop-filter: blur(16px);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.interactive-editor-host .ptro-bar:not(.has-tool-options) .ptro-tool-controls,
|
|
167
|
+
.interactive-editor-host .ptro-tool-controls:empty {
|
|
168
|
+
display: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.interactive-editor-host .ptro-tool-controls .ptro-tool-ctl-name {
|
|
172
|
+
margin: 0 0 0 4px !important;
|
|
173
|
+
padding: 0 !important;
|
|
174
|
+
flex: 0 0 auto;
|
|
175
|
+
border-radius: 0 !important;
|
|
176
|
+
color: var(--muted);
|
|
177
|
+
background: transparent !important;
|
|
178
|
+
font-family: 'DM Sans', sans-serif !important;
|
|
179
|
+
font-size: 12px;
|
|
180
|
+
line-height: 32px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.interactive-editor-host .ptro-tool-controls .ptro-input,
|
|
184
|
+
.interactive-editor-host .ptro-tool-controls select.ptro-input {
|
|
185
|
+
width: 64px !important;
|
|
186
|
+
height: 32px !important;
|
|
187
|
+
padding: 0 8px !important;
|
|
188
|
+
border: 1px solid var(--line) !important;
|
|
189
|
+
border-radius: 9px;
|
|
190
|
+
color: var(--text) !important;
|
|
191
|
+
background: var(--bg-0) !important;
|
|
192
|
+
box-shadow: none !important;
|
|
193
|
+
font-family: 'DM Sans', sans-serif !important;
|
|
194
|
+
font-size: 13px !important;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.interactive-editor-host .ptro-tool-controls .ptro-color-btn {
|
|
198
|
+
position: relative;
|
|
199
|
+
z-index: 2;
|
|
200
|
+
width: 28px !important;
|
|
201
|
+
height: 28px !important;
|
|
202
|
+
flex: 0 0 28px;
|
|
203
|
+
border: 2px solid rgba(255, 255, 255, 0.82) !important;
|
|
204
|
+
border-radius: 50%;
|
|
205
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45) !important;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.interactive-editor-host .ptro-tool-controls .ptro-btn-color-checkers-bar {
|
|
209
|
+
display: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.interactive-editor-host .interactive-crop-hint {
|
|
213
|
+
color: var(--muted);
|
|
214
|
+
font-size: 12px;
|
|
215
|
+
white-space: nowrap;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.interactive-editor-host .interactive-crop-apply {
|
|
219
|
+
height: 30px;
|
|
220
|
+
padding: 0 11px;
|
|
221
|
+
border: 1px solid rgba(61, 214, 198, 0.42);
|
|
222
|
+
border-radius: 8px;
|
|
223
|
+
color: #071311;
|
|
224
|
+
background: var(--accent);
|
|
225
|
+
font-size: 12px;
|
|
226
|
+
font-weight: 700;
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.interactive-editor-host .interactive-crop-apply:hover {
|
|
231
|
+
filter: brightness(1.06);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.interactive-editor-host .ptro-tool-controls [data-id='shadowOn'],
|
|
235
|
+
.interactive-editor-host .ptro-tool-controls [data-id='fontName'],
|
|
236
|
+
.interactive-editor-host .ptro-tool-controls [data-id='fontIsBold'],
|
|
237
|
+
.interactive-editor-host .ptro-tool-controls [data-id='fontIsItalic'],
|
|
238
|
+
.interactive-editor-host .ptro-tool-controls [data-id='fontStrokeAndShadow'],
|
|
239
|
+
.interactive-editor-host .ptro-tool-controls .ptro-tool-ctl-name:has(+ [data-id='shadowOn']),
|
|
240
|
+
.interactive-editor-host .ptro-tool-controls .ptro-tool-ctl-name:has(+ [data-id='fontName']),
|
|
241
|
+
.interactive-editor-host .ptro-tool-controls .ptro-tool-ctl-name:has(+ [data-id='fontIsBold']),
|
|
242
|
+
.interactive-editor-host .ptro-tool-controls .ptro-tool-ctl-name:has(+ [data-id='fontIsItalic']),
|
|
243
|
+
.interactive-editor-host .ptro-tool-controls .ptro-tool-ctl-name:has(+ [data-id='fontStrokeAndShadow']) {
|
|
244
|
+
display: none !important;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.interactive-editor-host .ptro-info,
|
|
248
|
+
.interactive-editor-host .ptro-bar-right {
|
|
249
|
+
display: none !important;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.interactive-editor-host .ptro-common-widget-wrapper {
|
|
253
|
+
color: var(--text);
|
|
254
|
+
background: rgba(7, 10, 14, 0.62) !important;
|
|
255
|
+
backdrop-filter: blur(4px);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.interactive-editor-host .ptro-pallet,
|
|
259
|
+
.interactive-editor-host .ptro-color-widget-wrapper .ptro-v-middle-in {
|
|
260
|
+
border: 1px solid var(--line);
|
|
261
|
+
border-radius: 14px;
|
|
262
|
+
background: var(--bg-1);
|
|
263
|
+
box-shadow: var(--shadow);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.interactive-edit-compose {
|
|
267
|
+
flex: 0 0 auto;
|
|
268
|
+
display: flex;
|
|
269
|
+
flex-direction: column;
|
|
270
|
+
gap: 8px;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.interactive-edit-compose .layer-decomposition-prompt {
|
|
274
|
+
width: 100%;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.interactive-edit-model {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
gap: 8px;
|
|
281
|
+
color: var(--muted);
|
|
282
|
+
font-size: 12px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.interactive-edit-model select {
|
|
286
|
+
min-width: 112px;
|
|
287
|
+
border: 1px solid var(--line);
|
|
288
|
+
border-radius: 8px;
|
|
289
|
+
padding: 6px 9px;
|
|
290
|
+
background: var(--bg-1);
|
|
291
|
+
color: var(--text);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.interactive-edit-zoom {
|
|
295
|
+
position: absolute;
|
|
296
|
+
top: 12px;
|
|
297
|
+
right: 12px;
|
|
298
|
+
z-index: 35;
|
|
299
|
+
display: grid;
|
|
300
|
+
grid-template-columns: auto 96px 36px;
|
|
301
|
+
align-items: center;
|
|
302
|
+
gap: 7px;
|
|
303
|
+
min-height: 32px;
|
|
304
|
+
padding: 5px 8px;
|
|
305
|
+
border: 1px solid var(--line);
|
|
306
|
+
border-radius: 10px;
|
|
307
|
+
color: var(--muted);
|
|
308
|
+
background: rgba(26, 31, 39, 0.86);
|
|
309
|
+
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
|
|
310
|
+
backdrop-filter: blur(16px);
|
|
311
|
+
font-size: 11px;
|
|
312
|
+
line-height: 1;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.interactive-edit-zoom input {
|
|
316
|
+
width: 96px;
|
|
317
|
+
height: 16px;
|
|
318
|
+
margin: 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.interactive-edit-zoom output {
|
|
322
|
+
color: var(--text);
|
|
323
|
+
font-family: 'JetBrains Mono', monospace;
|
|
324
|
+
font-size: 10px;
|
|
325
|
+
text-align: right;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.interactive-edit-compose > .modal-actions {
|
|
329
|
+
padding-top: 0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@media (max-width: 760px) {
|
|
333
|
+
.modal-dialog-interactive-edit {
|
|
334
|
+
width: calc(100vw - 16px);
|
|
335
|
+
height: calc(100vh - 16px);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.interactive-editor-stage {
|
|
339
|
+
min-height: 360px;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
`,
|
|
344
|
+
render(ui) {
|
|
345
|
+
const view = ui.view()
|
|
346
|
+
if (view) view.classList.add('interactive-edit-view')
|
|
347
|
+
return ui.stack(view, ui.prompt('prompt'), ui.field('model'), ui.field('html.text075'))
|
|
348
|
+
},
|
|
349
|
+
id: 'interactive-edit',
|
|
350
|
+
title: 'html.text049',
|
|
351
|
+
storage: 'parameters',
|
|
352
|
+
menu: [{ accepts: ['image'] }],
|
|
353
|
+
node: {
|
|
354
|
+
type: 'feature_dialog',
|
|
355
|
+
width: 900,
|
|
356
|
+
minWidth: 520,
|
|
357
|
+
minHeight: 520,
|
|
358
|
+
generationInput: true,
|
|
359
|
+
classNames: ['is-interactive-ui', 'is-interactive-edit'],
|
|
360
|
+
},
|
|
361
|
+
fields: [
|
|
362
|
+
{
|
|
363
|
+
path: 'prompt',
|
|
364
|
+
type: 'textarea',
|
|
365
|
+
default: '',
|
|
366
|
+
required: true,
|
|
367
|
+
label: 'html.text105',
|
|
368
|
+
placeholder: 'html.text019',
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
path: 'model',
|
|
372
|
+
type: 'enum',
|
|
373
|
+
default: 'asset-pro',
|
|
374
|
+
label: 'html.text074',
|
|
375
|
+
options: [
|
|
376
|
+
{ value: 'asset-pro', labelKey: 'models.assetPro' },
|
|
377
|
+
{ value: 'asset-max', labelKey: 'models.assetMax' },
|
|
378
|
+
],
|
|
379
|
+
},
|
|
380
|
+
{ path: 'referenceImageData', type: 'hidden', default: '' },
|
|
381
|
+
{ type: 'note', label: 'html.text075' },
|
|
382
|
+
],
|
|
383
|
+
runtimeDefaults: () => ({ ready: false }),
|
|
384
|
+
ready: (p) => p.ready,
|
|
385
|
+
submitLabel: 'html.text077',
|
|
386
|
+
setup: createInteractiveImageEditing,
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function createInteractiveImageEditing(services) {
|
|
390
|
+
const views = new Map()
|
|
391
|
+
return {
|
|
392
|
+
mountView(host, item) {
|
|
393
|
+
const view = mountDrawingView(host, item, services)
|
|
394
|
+
views.set(item.id, view)
|
|
395
|
+
return () => {
|
|
396
|
+
view.dispose()
|
|
397
|
+
if (views.get(item.id) === view) views.delete(item.id)
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
async task(item, params) {
|
|
401
|
+
const referenceImageData = await views.get(item.id)?.exportImage()
|
|
402
|
+
if (!referenceImageData?.startsWith('data:image/'))
|
|
403
|
+
throw new Error(t('features.editing.interactiveImageEditing.text036'))
|
|
404
|
+
params.referenceImageData = referenceImageData
|
|
405
|
+
return {
|
|
406
|
+
endpoint: '/api/generate',
|
|
407
|
+
body: {
|
|
408
|
+
prompt: params.prompt.trim(),
|
|
409
|
+
model: params.model,
|
|
410
|
+
reference_ids: [item.sourceId],
|
|
411
|
+
reference_image_data: referenceImageData,
|
|
412
|
+
},
|
|
413
|
+
wait: {
|
|
414
|
+
name: t('features.editing.interactiveImageEditing.text041'),
|
|
415
|
+
references: [item.sourceId],
|
|
416
|
+
},
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
dispose(id) {
|
|
420
|
+
views.get(id)?.dispose()
|
|
421
|
+
views.delete(id)
|
|
422
|
+
},
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function mountDrawingView(host, item, services) {
|
|
427
|
+
const params = ensureFeatureState(item)
|
|
428
|
+
const { imageUrl } = services
|
|
429
|
+
let interactiveEditor = null,
|
|
430
|
+
interactiveEditorExportRequest = null,
|
|
431
|
+
interactiveEditorInteractionCleanup = null,
|
|
432
|
+
disposed = false
|
|
433
|
+
const stage = el('div', 'interactive-editor-stage')
|
|
434
|
+
stage.style.height = '500px'
|
|
435
|
+
stage.style.flexShrink = '0'
|
|
436
|
+
const drawingHost = el('div', 'interactive-editor-host')
|
|
437
|
+
drawingHost.id = 'drawing-' + item.id
|
|
438
|
+
const zoomLabel = el('label', 'interactive-edit-zoom', t('html.text073'))
|
|
439
|
+
const zoom = el('input'),
|
|
440
|
+
output = el('output')
|
|
441
|
+
zoom.type = 'range'
|
|
442
|
+
zoom.min = '1'
|
|
443
|
+
zoom.max = '400'
|
|
444
|
+
zoom.value = '100'
|
|
445
|
+
zoom.step = '1'
|
|
446
|
+
zoomLabel.append(zoom, output)
|
|
447
|
+
stage.append(drawingHost, zoomLabel)
|
|
448
|
+
const status = el('p', 'modal-hint', t('features.editing.interactiveImageEditing.text026'))
|
|
449
|
+
const save = el('button', 'ghost-btn', t('html.text076'))
|
|
450
|
+
save.type = 'button'
|
|
451
|
+
host.append(stage, status, save)
|
|
452
|
+
const elements = {
|
|
453
|
+
world: host.closest('.canvas-world') || document.getElementById('world'),
|
|
454
|
+
interactiveEditorHost: drawingHost,
|
|
455
|
+
interactiveEditZoom: zoom,
|
|
456
|
+
interactiveEditZoomValue: output,
|
|
457
|
+
interactiveEditStatus: status,
|
|
458
|
+
}
|
|
459
|
+
const reportError = (error) => {
|
|
460
|
+
if (!disposed) {
|
|
461
|
+
params.messages.push({ error: String(error?.message || error) })
|
|
462
|
+
notifyFeatureState(item.id)
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const INTERACTIVE_EDITOR_TRANSLATION = {
|
|
466
|
+
name: 'zh-CN-canvas',
|
|
467
|
+
strings: {
|
|
468
|
+
lineColor: t('features.editing.interactiveImageEditing.text001'),
|
|
469
|
+
lineColorFull: t('features.editing.interactiveImageEditing.text002'),
|
|
470
|
+
fillColor: t('features.editing.interactiveImageEditing.text003'),
|
|
471
|
+
fillColorFull: t('features.editing.interactiveImageEditing.text004'),
|
|
472
|
+
alpha: t('features.editing.interactiveImageEditing.text005'),
|
|
473
|
+
alphaFull: t('features.editing.interactiveImageEditing.text005'),
|
|
474
|
+
lineWidth: t('features.editing.interactiveImageEditing.text006'),
|
|
475
|
+
lineWidthFull: t('features.editing.interactiveImageEditing.text007'),
|
|
476
|
+
arrowLength: t('features.editing.interactiveImageEditing.text008'),
|
|
477
|
+
arrowLengthFull: t('features.editing.interactiveImageEditing.text009'),
|
|
478
|
+
textColor: t('features.editing.interactiveImageEditing.text001'),
|
|
479
|
+
textColorFull: t('features.editing.interactiveImageEditing.text010'),
|
|
480
|
+
fontSize: t('features.editing.interactiveImageEditing.text011'),
|
|
481
|
+
fontSizeFull: t('features.editing.interactiveImageEditing.text012'),
|
|
482
|
+
apply: t('features.editing.interactiveImageEditing.text013'),
|
|
483
|
+
cancel: t('features.editing.interactiveImageEditing.text014'),
|
|
484
|
+
tools: {
|
|
485
|
+
select: t('features.editing.interactiveImageEditing.text015'),
|
|
486
|
+
rect: t('features.editing.interactiveImageEditing.text016'),
|
|
487
|
+
ellipse: t('features.editing.interactiveImageEditing.text017'),
|
|
488
|
+
arrow: t('features.editing.interactiveImageEditing.text018'),
|
|
489
|
+
brush: t('features.editing.interactiveImageEditing.text019'),
|
|
490
|
+
text: t('features.editing.interactiveImageEditing.text020'),
|
|
491
|
+
rotate: t('features.editing.interactiveImageEditing.text021'),
|
|
492
|
+
undo: t('features.editing.interactiveImageEditing.text022'),
|
|
493
|
+
redo: t('features.editing.interactiveImageEditing.text023'),
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const INTERACTIVE_EDITOR_HIDDEN_TOOLS = [
|
|
499
|
+
'crop',
|
|
500
|
+
'pixelize',
|
|
501
|
+
'line',
|
|
502
|
+
'filters',
|
|
503
|
+
'eraser',
|
|
504
|
+
'resize',
|
|
505
|
+
'settings',
|
|
506
|
+
'zoomout',
|
|
507
|
+
'zoomin',
|
|
508
|
+
'bucket',
|
|
509
|
+
'clear',
|
|
510
|
+
'save',
|
|
511
|
+
'open',
|
|
512
|
+
'close',
|
|
513
|
+
]
|
|
514
|
+
|
|
515
|
+
const INTERACTIVE_EDITOR_TOOL_ORDER = [
|
|
516
|
+
'arrow',
|
|
517
|
+
'brush',
|
|
518
|
+
'rect',
|
|
519
|
+
'ellipse',
|
|
520
|
+
'text',
|
|
521
|
+
'select',
|
|
522
|
+
'rotate',
|
|
523
|
+
'undo',
|
|
524
|
+
'redo',
|
|
525
|
+
]
|
|
526
|
+
|
|
527
|
+
const INTERACTIVE_EDITOR_TOOL_ICONS = {
|
|
528
|
+
arrow: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 19 19 5M10 5h9v9"/></svg>',
|
|
529
|
+
brush:
|
|
530
|
+
'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.5 16.5c3-9 6.4 8.2 9.4-.5 2.2-6.4 4.8-5.7 7.6-2.2"/></svg>',
|
|
531
|
+
rect: '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="4.5" y="5.5" width="15" height="13" rx="1.5"/></svg>',
|
|
532
|
+
ellipse:
|
|
533
|
+
'<svg viewBox="0 0 24 24" aria-hidden="true"><ellipse cx="12" cy="12" rx="8" ry="6.5"/></svg>',
|
|
534
|
+
text: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 6h14M12 6v13M8.5 19h7"/></svg>',
|
|
535
|
+
select:
|
|
536
|
+
'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 4H4v4M16 4h4v4M20 16v4h-4M8 20H4v-4"/></svg>',
|
|
537
|
+
rotate:
|
|
538
|
+
'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 7v5h-5M19 12a7 7 0 1 1-2-5"/></svg>',
|
|
539
|
+
undo: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9 7-4 4 4 4M5 11h8a6 6 0 0 1 6 6"/></svg>',
|
|
540
|
+
redo: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15 7 4 4-4 4M19 11h-8a6 6 0 0 0-6 6"/></svg>',
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function syncInteractiveEditZoomControl(editor) {
|
|
544
|
+
const percentage = Math.max(1, Math.min(400, Math.round((editor?.zoomFactor || 1) * 100)))
|
|
545
|
+
elements.interactiveEditZoom.value = String(percentage)
|
|
546
|
+
elements.interactiveEditZoomValue.value = `${percentage}%`
|
|
547
|
+
elements.interactiveEditZoomValue.textContent = `${percentage}%`
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function destroyInteractiveEditor() {
|
|
551
|
+
const editor = interactiveEditor
|
|
552
|
+
interactiveEditor = null
|
|
553
|
+
interactiveEditorInteractionCleanup?.()
|
|
554
|
+
interactiveEditorInteractionCleanup = null
|
|
555
|
+
const exportRequest = interactiveEditorExportRequest
|
|
556
|
+
interactiveEditorExportRequest = null
|
|
557
|
+
if (exportRequest) {
|
|
558
|
+
clearTimeout(exportRequest.timeout)
|
|
559
|
+
exportRequest.reject(new Error(t('features.editing.interactiveImageEditing.text024')))
|
|
560
|
+
}
|
|
561
|
+
if (editor) {
|
|
562
|
+
try {
|
|
563
|
+
editor.hide()
|
|
564
|
+
} catch {
|
|
565
|
+
/* editor may still be initializing */
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
elements.interactiveEditorHost.innerHTML = ''
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
async function initializeInteractiveEditor(imageId) {
|
|
572
|
+
try {
|
|
573
|
+
const PainterroEditor = window.Painterro
|
|
574
|
+
if (typeof PainterroEditor !== 'function')
|
|
575
|
+
throw new Error(t('features.editing.interactiveImageEditing.text027'))
|
|
576
|
+
if (disposed) return
|
|
577
|
+
let editor = null
|
|
578
|
+
let loadTimeout = null
|
|
579
|
+
await new Promise((resolve, reject) => {
|
|
580
|
+
const finish = (callback, value) => {
|
|
581
|
+
if (loadTimeout) clearTimeout(loadTimeout)
|
|
582
|
+
callback(value)
|
|
583
|
+
}
|
|
584
|
+
editor = PainterroEditor({
|
|
585
|
+
id: elements.interactiveEditorHost.id,
|
|
586
|
+
defaultTool: 'brush',
|
|
587
|
+
hiddenTools: INTERACTIVE_EDITOR_HIDDEN_TOOLS,
|
|
588
|
+
backgroundFillColorAlpha: 0,
|
|
589
|
+
defaultPrimitiveShadowOn: false,
|
|
590
|
+
defaultTextStrokeAndShadow: false,
|
|
591
|
+
disableWheelZoom: true,
|
|
592
|
+
fixMobilePageReloader: false,
|
|
593
|
+
toolbarHeightPx: 64,
|
|
594
|
+
buttonSizePx: 44,
|
|
595
|
+
colorScheme: {
|
|
596
|
+
main: '#1a1f27',
|
|
597
|
+
control: '#232a34',
|
|
598
|
+
controlShadow: '0 0 0 1px rgba(255,255,255,0.08)',
|
|
599
|
+
controlContent: '#e8edf4',
|
|
600
|
+
hoverControl: '#2d3744',
|
|
601
|
+
hoverControlContent: '#ffffff',
|
|
602
|
+
activeControl: '#3dd6c6',
|
|
603
|
+
activeControlContent: '#0b1214',
|
|
604
|
+
inputBorderColor: 'rgba(255,255,255,0.1)',
|
|
605
|
+
inputBackground: '#12151a',
|
|
606
|
+
inputText: '#e8edf4',
|
|
607
|
+
backgroundColor: '#12151a',
|
|
608
|
+
toolControlNameColor: 'transparent',
|
|
609
|
+
dragOverBarColor: 'rgba(61,214,198,0.18)',
|
|
610
|
+
},
|
|
611
|
+
translation: INTERACTIVE_EDITOR_TRANSLATION,
|
|
612
|
+
onChange: ({ image, operationsDone }) => {
|
|
613
|
+
if (disposed || !params.ready || !operationsDone) return
|
|
614
|
+
params.referenceImageData = image.asDataURL('image/png')
|
|
615
|
+
services.saveLayout().catch(reportError)
|
|
616
|
+
},
|
|
617
|
+
onImageLoaded: () => finish(resolve),
|
|
618
|
+
onImageFailedOpen: () =>
|
|
619
|
+
finish(reject, new Error(t('features.editing.interactiveImageEditing.text028'))),
|
|
620
|
+
saveHandler: (image, done) => {
|
|
621
|
+
const request = interactiveEditorExportRequest
|
|
622
|
+
if (!request || request.editor !== editor) {
|
|
623
|
+
done(false)
|
|
624
|
+
return
|
|
625
|
+
}
|
|
626
|
+
interactiveEditorExportRequest = null
|
|
627
|
+
clearTimeout(request.timeout)
|
|
628
|
+
try {
|
|
629
|
+
request.resolve(image.asDataURL('image/png'))
|
|
630
|
+
} catch (error) {
|
|
631
|
+
request.reject(error)
|
|
632
|
+
} finally {
|
|
633
|
+
done(false)
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
})
|
|
637
|
+
interactiveEditor = editor
|
|
638
|
+
interactiveEditorInteractionCleanup = installInteractiveEditorInteractions(editor)
|
|
639
|
+
editor.show(params.referenceImageData || imageUrl(imageId))
|
|
640
|
+
loadTimeout = setTimeout(
|
|
641
|
+
() => reject(new Error(t('features.editing.interactiveImageEditing.text029'))),
|
|
642
|
+
10_000,
|
|
643
|
+
)
|
|
644
|
+
})
|
|
645
|
+
if (disposed || interactiveEditor !== editor) return
|
|
646
|
+
decorateInteractiveEditorToolbar(editor)
|
|
647
|
+
syncInteractiveEditZoomControl(editor)
|
|
648
|
+
params.ready = true
|
|
649
|
+
notifyFeatureState(item.id)
|
|
650
|
+
elements.interactiveEditStatus.hidden = true
|
|
651
|
+
} catch (error) {
|
|
652
|
+
if (disposed) return
|
|
653
|
+
destroyInteractiveEditor()
|
|
654
|
+
params.ready = false
|
|
655
|
+
notifyFeatureState(item.id)
|
|
656
|
+
elements.interactiveEditStatus.hidden = false
|
|
657
|
+
elements.interactiveEditStatus.textContent = String(error.message || error)
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
function decorateInteractiveEditorToolbar(editor) {
|
|
662
|
+
const bar = elements.interactiveEditorHost.querySelector('.ptro-bar > div')
|
|
663
|
+
const controls = bar?.querySelector('.ptro-tool-controls')
|
|
664
|
+
if (!bar || !controls) return
|
|
665
|
+
for (const tool of INTERACTIVE_EDITOR_TOOL_ORDER) {
|
|
666
|
+
const button = bar.querySelector(`button[aria-label="${tool}"]`)
|
|
667
|
+
if (!button) continue
|
|
668
|
+
button.dataset.tool = tool === 'select' ? 'crop' : tool
|
|
669
|
+
button.innerHTML = INTERACTIVE_EDITOR_TOOL_ICONS[tool]
|
|
670
|
+
button.addEventListener('click', () => {
|
|
671
|
+
const toolbar = button.closest('.ptro-bar')
|
|
672
|
+
const isSelectedTool = editor.activeTool?.name === tool
|
|
673
|
+
if (tool === 'select' && isSelectedTool) {
|
|
674
|
+
mountInteractiveCropControls(editor, controls, toolbar)
|
|
675
|
+
}
|
|
676
|
+
const hasOptions = isSelectedTool && !['undo', 'redo', 'rotate'].includes(tool)
|
|
677
|
+
if (hasOptions) {
|
|
678
|
+
controls.style.top = `${button.offsetTop + button.offsetHeight / 2}px`
|
|
679
|
+
}
|
|
680
|
+
toolbar?.classList.toggle('has-tool-options', hasOptions)
|
|
681
|
+
})
|
|
682
|
+
bar.insertBefore(button, controls)
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function mountInteractiveCropControls(editor, controls, toolbar) {
|
|
687
|
+
controls.innerHTML = ''
|
|
688
|
+
const hint = document.createElement('span')
|
|
689
|
+
hint.className = 'interactive-crop-hint'
|
|
690
|
+
hint.textContent = t('features.editing.interactiveImageEditing.text030')
|
|
691
|
+
const apply = document.createElement('button')
|
|
692
|
+
apply.type = 'button'
|
|
693
|
+
apply.className = 'interactive-crop-apply'
|
|
694
|
+
apply.textContent = t('features.editing.interactiveImageEditing.text031')
|
|
695
|
+
apply.addEventListener('click', (event) => {
|
|
696
|
+
event.preventDefault()
|
|
697
|
+
event.stopPropagation()
|
|
698
|
+
const area = editor.select?.area
|
|
699
|
+
const width = area?.bottoml?.[0] - area?.topl?.[0]
|
|
700
|
+
const height = area?.bottoml?.[1] - area?.topl?.[1]
|
|
701
|
+
if (!editor.select?.shown || !(width > 0 && height > 0)) {
|
|
702
|
+
hint.textContent = t('features.editing.interactiveImageEditing.text032')
|
|
703
|
+
return
|
|
704
|
+
}
|
|
705
|
+
editor.select.doCrop()
|
|
706
|
+
editor.closeActiveTool(true)
|
|
707
|
+
editor.setActiveTool(editor.defaultTool)
|
|
708
|
+
toolbar?.classList.remove('has-tool-options')
|
|
709
|
+
})
|
|
710
|
+
controls.append(hint, apply)
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function installInteractiveEditorCoordinateFix(host) {
|
|
714
|
+
const nativeGetBoundingClientRect = Element.prototype.getBoundingClientRect
|
|
715
|
+
const patchedElements = new Map()
|
|
716
|
+
let mouseGestureActive = false
|
|
717
|
+
|
|
718
|
+
const coordinateSpace = () => {
|
|
719
|
+
const worldRect = nativeGetBoundingClientRect.call(elements.world)
|
|
720
|
+
return {
|
|
721
|
+
scale: Math.max(0.01, Number(state.camera.scale) || 1),
|
|
722
|
+
originX: worldRect.left,
|
|
723
|
+
originY: worldRect.top,
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const normalizeX = (value, space) =>
|
|
728
|
+
space.originX + (Number(value) - space.originX) / space.scale
|
|
729
|
+
const normalizeY = (value, space) =>
|
|
730
|
+
space.originY + (Number(value) - space.originY) / space.scale
|
|
731
|
+
|
|
732
|
+
const normalizeRect = (rect) => {
|
|
733
|
+
const space = coordinateSpace()
|
|
734
|
+
const left = normalizeX(rect.left, space)
|
|
735
|
+
const top = normalizeY(rect.top, space)
|
|
736
|
+
const width = rect.width / space.scale
|
|
737
|
+
const height = rect.height / space.scale
|
|
738
|
+
return {
|
|
739
|
+
x: left,
|
|
740
|
+
y: top,
|
|
741
|
+
left,
|
|
742
|
+
top,
|
|
743
|
+
right: left + width,
|
|
744
|
+
bottom: top + height,
|
|
745
|
+
width,
|
|
746
|
+
height,
|
|
747
|
+
toJSON() {
|
|
748
|
+
return {
|
|
749
|
+
x: left,
|
|
750
|
+
y: top,
|
|
751
|
+
left,
|
|
752
|
+
top,
|
|
753
|
+
right: left + width,
|
|
754
|
+
bottom: top + height,
|
|
755
|
+
width,
|
|
756
|
+
height,
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
const patchElement = (element) => {
|
|
763
|
+
if (!(element instanceof Element) || patchedElements.has(element)) return
|
|
764
|
+
const ownDescriptor = Object.getOwnPropertyDescriptor(element, 'getBoundingClientRect')
|
|
765
|
+
const readNativeRect = element.getBoundingClientRect.bind(element)
|
|
766
|
+
try {
|
|
767
|
+
Object.defineProperty(element, 'getBoundingClientRect', {
|
|
768
|
+
configurable: true,
|
|
769
|
+
value: () => normalizeRect(readNativeRect()),
|
|
770
|
+
})
|
|
771
|
+
patchedElements.set(element, ownDescriptor || null)
|
|
772
|
+
} catch {
|
|
773
|
+
/* keep native geometry when a browser does not allow an instance override */
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
patchElement(host)
|
|
778
|
+
for (const element of host.querySelectorAll('*')) patchElement(element)
|
|
779
|
+
const observer = new MutationObserver((records) => {
|
|
780
|
+
for (const record of records) {
|
|
781
|
+
for (const node of record.addedNodes) {
|
|
782
|
+
if (!(node instanceof Element)) continue
|
|
783
|
+
patchElement(node)
|
|
784
|
+
for (const element of node.querySelectorAll('*')) patchElement(element)
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
})
|
|
788
|
+
observer.observe(host, { childList: true, subtree: true })
|
|
789
|
+
|
|
790
|
+
const eventBelongsToEditor = (event) =>
|
|
791
|
+
event.target instanceof Node && host.contains(event.target)
|
|
792
|
+
const normalizeMouseEvent = (event) => {
|
|
793
|
+
const space = coordinateSpace()
|
|
794
|
+
try {
|
|
795
|
+
Object.defineProperties(event, {
|
|
796
|
+
clientX: { configurable: true, value: normalizeX(event.clientX, space) },
|
|
797
|
+
clientY: { configurable: true, value: normalizeY(event.clientY, space) },
|
|
798
|
+
})
|
|
799
|
+
} catch {
|
|
800
|
+
/* Chromium permits shadowing these accessors; leave the event intact elsewhere */
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
const onMouseDown = (event) => {
|
|
804
|
+
if (!eventBelongsToEditor(event)) return
|
|
805
|
+
mouseGestureActive = true
|
|
806
|
+
normalizeMouseEvent(event)
|
|
807
|
+
}
|
|
808
|
+
const onMouseMove = (event) => {
|
|
809
|
+
if (!mouseGestureActive && !eventBelongsToEditor(event)) return
|
|
810
|
+
normalizeMouseEvent(event)
|
|
811
|
+
}
|
|
812
|
+
const onMouseUp = (event) => {
|
|
813
|
+
if (!mouseGestureActive) return
|
|
814
|
+
normalizeMouseEvent(event)
|
|
815
|
+
mouseGestureActive = false
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
document.addEventListener('mousedown', onMouseDown, true)
|
|
819
|
+
document.addEventListener('mousemove', onMouseMove, true)
|
|
820
|
+
document.addEventListener('mouseup', onMouseUp, true)
|
|
821
|
+
|
|
822
|
+
return () => {
|
|
823
|
+
document.removeEventListener('mousedown', onMouseDown, true)
|
|
824
|
+
document.removeEventListener('mousemove', onMouseMove, true)
|
|
825
|
+
document.removeEventListener('mouseup', onMouseUp, true)
|
|
826
|
+
observer.disconnect()
|
|
827
|
+
for (const [element, descriptor] of patchedElements) {
|
|
828
|
+
if (descriptor) Object.defineProperty(element, 'getBoundingClientRect', descriptor)
|
|
829
|
+
else delete element.getBoundingClientRect
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
function installInteractiveEditorInteractions(editor) {
|
|
835
|
+
const scroller = editor?.scroller
|
|
836
|
+
if (!scroller) return () => undefined
|
|
837
|
+
const removeCoordinateFix = installInteractiveEditorCoordinateFix(
|
|
838
|
+
elements.interactiveEditorHost,
|
|
839
|
+
)
|
|
840
|
+
let pan = null
|
|
841
|
+
|
|
842
|
+
const onMouseDown = (event) => {
|
|
843
|
+
if (event.button !== 1) return
|
|
844
|
+
event.preventDefault()
|
|
845
|
+
event.stopPropagation()
|
|
846
|
+
pan = {
|
|
847
|
+
x: event.clientX,
|
|
848
|
+
y: event.clientY,
|
|
849
|
+
left: scroller.scrollLeft,
|
|
850
|
+
top: scroller.scrollTop,
|
|
851
|
+
}
|
|
852
|
+
elements.interactiveEditorHost.classList.add('is-panning')
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
const onMouseMove = (event) => {
|
|
856
|
+
if (!pan) return
|
|
857
|
+
event.preventDefault()
|
|
858
|
+
event.stopPropagation()
|
|
859
|
+
scroller.scrollLeft = pan.left - (event.clientX - pan.x)
|
|
860
|
+
scroller.scrollTop = pan.top - (event.clientY - pan.y)
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
const stopPanning = (event) => {
|
|
864
|
+
if (!pan) return
|
|
865
|
+
if (event) {
|
|
866
|
+
event.preventDefault()
|
|
867
|
+
event.stopPropagation()
|
|
868
|
+
}
|
|
869
|
+
pan = null
|
|
870
|
+
elements.interactiveEditorHost.classList.remove('is-panning')
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const onAuxClick = (event) => {
|
|
874
|
+
if (event.button === 1) event.preventDefault()
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
scroller.addEventListener('mousedown', onMouseDown, true)
|
|
878
|
+
scroller.addEventListener('auxclick', onAuxClick)
|
|
879
|
+
window.addEventListener('mousemove', onMouseMove, true)
|
|
880
|
+
window.addEventListener('mouseup', stopPanning, true)
|
|
881
|
+
window.addEventListener('blur', stopPanning)
|
|
882
|
+
|
|
883
|
+
return () => {
|
|
884
|
+
removeCoordinateFix()
|
|
885
|
+
scroller.removeEventListener('mousedown', onMouseDown, true)
|
|
886
|
+
scroller.removeEventListener('auxclick', onAuxClick)
|
|
887
|
+
window.removeEventListener('mousemove', onMouseMove, true)
|
|
888
|
+
window.removeEventListener('mouseup', stopPanning, true)
|
|
889
|
+
window.removeEventListener('blur', stopPanning)
|
|
890
|
+
elements.interactiveEditorHost.classList.remove('is-panning')
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function exportInteractiveEditor(editor) {
|
|
895
|
+
if (interactiveEditorExportRequest) {
|
|
896
|
+
return Promise.reject(new Error(t('features.editing.interactiveImageEditing.text033')))
|
|
897
|
+
}
|
|
898
|
+
return new Promise((resolve, reject) => {
|
|
899
|
+
const timeout = setTimeout(() => {
|
|
900
|
+
if (interactiveEditorExportRequest?.editor !== editor) return
|
|
901
|
+
interactiveEditorExportRequest = null
|
|
902
|
+
reject(new Error(t('features.editing.interactiveImageEditing.text034')))
|
|
903
|
+
}, 10_000)
|
|
904
|
+
interactiveEditorExportRequest = { editor, resolve, reject, timeout }
|
|
905
|
+
try {
|
|
906
|
+
editor.save()
|
|
907
|
+
} catch (error) {
|
|
908
|
+
interactiveEditorExportRequest = null
|
|
909
|
+
clearTimeout(timeout)
|
|
910
|
+
reject(error)
|
|
911
|
+
}
|
|
912
|
+
})
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
zoom.addEventListener('input', () => {
|
|
916
|
+
interactiveEditor?.setZoom(Number(zoom.value))
|
|
917
|
+
syncInteractiveEditZoomControl(interactiveEditor)
|
|
918
|
+
})
|
|
919
|
+
const unsubscribe = subscribeFeatureState(item.id, () => {
|
|
920
|
+
save.disabled = params.busy || !params.ready
|
|
921
|
+
zoom.disabled = params.busy || !params.ready
|
|
922
|
+
drawingHost.style.pointerEvents = params.busy ? 'none' : ''
|
|
923
|
+
})
|
|
924
|
+
save.addEventListener('click', async () => {
|
|
925
|
+
if (params.busy || !params.ready) return
|
|
926
|
+
params.busy = true
|
|
927
|
+
notifyFeatureState(item.id)
|
|
928
|
+
const operation = services.beginActiveOperation('interactive-edit-save')
|
|
929
|
+
try {
|
|
930
|
+
const data = await exportInteractiveEditor(interactiveEditor)
|
|
931
|
+
const sourceName = String(services.imageName(item.sourceId) || 'image').replace(
|
|
932
|
+
/\.[^.]+$/,
|
|
933
|
+
'',
|
|
934
|
+
)
|
|
935
|
+
const saved = await api('/api/upload', {
|
|
936
|
+
method: 'POST',
|
|
937
|
+
headers: { 'Content-Type': 'application/json' },
|
|
938
|
+
body: JSON.stringify({
|
|
939
|
+
name: sourceName + '_edited.png',
|
|
940
|
+
data,
|
|
941
|
+
place: false,
|
|
942
|
+
operation: 'interactive_edit',
|
|
943
|
+
source_id: item.sourceId,
|
|
944
|
+
}),
|
|
945
|
+
})
|
|
946
|
+
await services.replaceLocal(item, [
|
|
947
|
+
{
|
|
948
|
+
id: saved.id,
|
|
949
|
+
name: saved.name,
|
|
950
|
+
x: item.x,
|
|
951
|
+
y: item.y,
|
|
952
|
+
width: 220,
|
|
953
|
+
height: null,
|
|
954
|
+
references: [{ id: item.sourceId, role: 'source' }],
|
|
955
|
+
},
|
|
956
|
+
])
|
|
957
|
+
await services.reload()
|
|
958
|
+
services.setSelection([saved.id])
|
|
959
|
+
services.renderChrome()
|
|
960
|
+
} catch (error) {
|
|
961
|
+
reportError(error)
|
|
962
|
+
} finally {
|
|
963
|
+
params.busy = false
|
|
964
|
+
services.endActiveOperation(operation)
|
|
965
|
+
notifyFeatureState(item.id)
|
|
966
|
+
}
|
|
967
|
+
})
|
|
968
|
+
requestAnimationFrame(() => {
|
|
969
|
+
if (!disposed) initializeInteractiveEditor(item.sourceId)
|
|
970
|
+
})
|
|
971
|
+
return {
|
|
972
|
+
exportImage: () => exportInteractiveEditor(interactiveEditor),
|
|
973
|
+
dispose() {
|
|
974
|
+
if (disposed) return
|
|
975
|
+
disposed = true
|
|
976
|
+
params.ready = false
|
|
977
|
+
unsubscribe()
|
|
978
|
+
destroyInteractiveEditor()
|
|
979
|
+
},
|
|
980
|
+
}
|
|
981
|
+
}
|