Restructure ORA editor into modular blueprints with browse dialog

- Split app.py into route blueprints (files, layers, images, polygon, mask, krita)
- Create services layer (polygon_storage, comfyui, file_browser)
- Extract config constants to config.py
- Split templates into Jinja partials (base, components, modals)
- Add browse dialog for visual file navigation
- Add /api/browse endpoint for directory listing
This commit is contained in:
2026-03-27 21:29:27 -07:00
parent 17da8c475e
commit fb812e57bc
21 changed files with 2269 additions and 1794 deletions

View File

@@ -0,0 +1,49 @@
<!-- Mask preview modal for ORA Editor -->
<div x-show="showMaskModal" @keydown.escape.window="closeMaskModal()"
class="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-75">
<div class="bg-gray-800 rounded-lg p-6 max-w-2xl w-full mx-4 border border-gray-600" style="max-height: 90vh; display: flex; flex-direction: column;">
<div class="flex items-center justify-between mb-4">
<h2 class="text-xl font-bold">Extracted Mask</h2>
<!-- View mode toggle -->
<div class="flex gap-2">
<button
@click="maskViewMode = 'with-bg'"
:class="maskViewMode === 'with-bg' ? 'bg-blue-600' : 'bg-gray-600'"
class="px-3 py-1 rounded text-sm font-medium"
>With Background</button>
<button
@click="maskViewMode = 'masked-only'"
:class="maskViewMode === 'masked-only' ? 'bg-green-600' : 'bg-gray-600'"
class="px-3 py-1 rounded text-sm font-medium"
>Masked Only</button>
</div>
</div>
<div class="flex-1 overflow-auto bg-gray-700 rounded mb-4 flex items-center justify-center p-4" style="min-height: 300px; max-height: 50vh;">
<div class="relative" style="max-width: 100%; max-height: calc(50vh - 2rem);">
<!-- Base image (shown in "with-bg" mode) -->
<img
x-show="maskViewMode === 'with-bg'"
:src="'/api/image/base?ora_path=' + encodeURIComponent(oraPath)"
class="border border-gray-600"
style="max-width: 100%; max-height: calc(50vh - 2rem);"
>
<!-- Masked image (transparent where mask is black) -->
<img
x-show="tempMaskPath"
:src="'/api/image/masked?ora_path=' + encodeURIComponent(oraPath) + '&mask_path=' + encodeURIComponent(tempMaskPath)"
class="border border-gray-600"
:class="maskViewMode === 'with-bg' ? 'absolute inset-0' : ''"
style="max-width: 100%; max-height: calc(50vh - 2rem);"
>
</div>
</div>
<div class="flex gap-4 justify-end">
<button @click="rerollMask()" :disabled="isExtracting" class="bg-gray-600 hover:bg-gray-500 disabled:bg-gray-700 px-4 py-2 rounded transition">Re-roll</button>
<button @click="useMask()" :disabled="isExtracting || !tempMaskPath" class="bg-green-600 hover:bg-green-700 disabled:bg-gray-600 px-4 py-2 rounded transition">Use This Mask</button>
<button @click="closeMaskModal()" :disabled="isExtracting" class="bg-red-600 hover:bg-red-700 disabled:bg-gray-600 px-4 py-2 rounded transition">Cancel</button>
</div>
</div>
</div>