feat: pattern editor

This commit is contained in:
2025-10-12 12:28:33 +02:00
parent 9a75b23169
commit cb172595b3
16 changed files with 4816 additions and 3 deletions

View File

@@ -685,7 +685,7 @@ body {
/* Preset controls */
.preset-select {
width: 100%;
background: var(--bg-tertiary);
background: var(--bg-secondary);
border: 1px solid var(--border-secondary);
border-radius: 6px;
padding: 0.5rem;
@@ -698,7 +698,7 @@ body {
}
.preset-select option {
background: var(--bg-secondary);
background: #1a252f;
color: var(--text-primary);
padding: 0.5rem;
}
@@ -754,6 +754,19 @@ body {
font-weight: 600;
}
.preset-label:has(input[type="checkbox"]) {
text-transform: none;
font-size: 0.8rem;
display: flex;
align-items: center;
cursor: pointer;
}
.preset-label input[type="checkbox"] {
cursor: pointer;
accent-color: var(--accent-primary);
}
.preset-input {
width: 100%;
background: var(--bg-tertiary);
@@ -1264,3 +1277,900 @@ body {
.animate-fade-in {
animation: fadeIn 0.3s ease-out;
}
/* ============================================
PRESET EDITOR STYLES
============================================ */
.editor-container {
padding: 2rem;
max-width: 100%;
margin: 0 auto;
}
/* Modern Editor Container - Full Screen */
.editor-container-modern {
padding: 0;
margin: 0;
height: calc(100vh - 70px);
width: 100vw;
max-width: 100vw;
overflow: hidden;
}
.editor-header {
margin-bottom: 2rem;
text-align: center;
}
.editor-header h2 {
font-size: 2rem;
margin-bottom: 0.5rem;
color: var(--text-primary);
}
.editor-subtitle {
color: var(--text-secondary);
font-size: 0.95rem;
margin-bottom: 1.5rem;
}
.editor-preview-controls {
display: flex;
justify-content: center;
align-items: center;
gap: 2rem;
padding: 1rem;
background: var(--bg-secondary);
border-radius: 12px;
border: 1px solid var(--border-primary);
margin-top: 1rem;
}
.preview-control-group {
display: flex;
align-items: center;
gap: 0.75rem;
}
.preview-control-group label {
color: var(--text-secondary);
font-size: 0.9rem;
font-weight: 500;
}
.node-select {
padding: 0.6rem 1rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 6px;
color: var(--text-primary);
font-size: 0.9rem;
min-width: 200px;
cursor: pointer;
transition: all 0.2s ease;
}
.node-select option {
background: #1a252f;
color: var(--text-primary);
padding: 0.5rem;
}
.node-select:focus {
outline: none;
border-color: var(--accent-primary);
}
.preview-status {
padding: 0.4rem 0.8rem;
background: var(--bg-tertiary);
border-radius: 6px;
font-size: 0.85rem;
color: var(--text-secondary);
border: 1px solid var(--border-primary);
}
.preview-status.active {
background: rgba(74, 222, 128, 0.1);
border-color: var(--accent-primary);
color: var(--accent-primary);
}
.preview-status.streaming {
background: rgba(96, 165, 250, 0.1);
border-color: var(--accent-secondary);
color: var(--accent-secondary);
}
.editor-layout {
display: grid;
grid-template-columns: 300px 1fr 350px;
gap: 1.5rem;
min-height: calc(100vh - 300px);
}
/* Modern Layout - Full Screen (50/50 Split) */
.editor-layout-modern {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0;
height: 100%;
width: 100%;
background: var(--bg-primary);
}
/* Live Preview Canvas */
.editor-preview-container {
position: relative;
background: var(--bg-tertiary);
border-radius: 8px;
padding: 1rem;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
}
.editor-canvas {
border: 2px solid var(--border-primary);
border-radius: 4px;
background: #000000;
image-rendering: pixelated;
image-rendering: crisp-edges;
width: 100%;
max-width: 400px;
height: auto;
aspect-ratio: 1;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.editor-canvas-info {
display: flex;
justify-content: space-between;
width: 100%;
max-width: 400px;
padding: 0.5rem 0.75rem;
background: var(--bg-secondary);
border-radius: 6px;
font-size: 0.85rem;
color: var(--text-secondary);
}
.editor-canvas-info span {
font-family: 'Monaco', 'Courier New', monospace;
}
/* Modern Preview Bar */
.editor-preview-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border-primary);
gap: 1rem;
flex-shrink: 0;
}
.preview-bar-controls {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
}
.preview-bar-info {
display: flex;
align-items: center;
gap: 0.5rem;
}
.node-select-compact {
padding: 0.5rem 0.75rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 6px;
color: var(--text-primary);
font-size: 0.85rem;
min-width: 150px;
cursor: pointer;
transition: all 0.2s ease;
}
.node-select-compact option {
background: #1a252f;
color: var(--text-primary);
padding: 0.5rem;
}
.node-select-compact:focus {
outline: none;
border-color: var(--accent-primary);
}
.btn-preview {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: linear-gradient(135deg, var(--accent-primary) 0%, #22c55e 100%);
border: none;
border-radius: 6px;
color: white;
font-size: 0.85rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-preview:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}
.btn-preview.active {
background: linear-gradient(135deg, var(--accent-error) 0%, #dc2626 100%);
}
.btn-preview.active:hover {
box-shadow: 0 4px 12px rgba(248, 113, 113, 0.3);
}
.preview-icon {
font-size: 1rem;
}
.preview-text {
font-weight: 600;
}
.preview-status-compact {
padding: 0.35rem 0.75rem;
background: var(--bg-tertiary);
border-radius: 6px;
font-size: 0.8rem;
color: var(--text-secondary);
border: 1px solid var(--border-primary);
font-weight: 500;
}
.preview-status-compact.active {
background: rgba(74, 222, 128, 0.1);
border-color: var(--accent-primary);
color: var(--accent-primary);
}
.preview-status-compact.streaming {
background: rgba(96, 165, 250, 0.1);
border-color: var(--accent-secondary);
color: var(--accent-secondary);
}
.info-badge {
padding: 0.35rem 0.75rem;
background: var(--bg-tertiary);
border-radius: 6px;
font-size: 0.8rem;
color: var(--text-secondary);
font-family: 'Monaco', 'Courier New', monospace;
font-weight: 500;
}
/* Preview Container with Layers */
.editor-preview-container-modern {
flex: 1;
display: flex;
gap: 0;
overflow: hidden;
min-height: 0;
}
/* Layers Sidebar (Left of Preview) */
.editor-layers-sidebar {
width: 240px;
background: var(--bg-secondary);
border-right: 1px solid var(--border-primary);
padding: 1rem;
overflow-y: auto;
overflow-x: hidden;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
/* Modern Canvas Preview - Full Right Panel */
.editor-preview-main {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-primary);
padding: 2rem;
overflow: hidden;
min-height: 0;
min-width: 0;
}
/* Full width button utility */
.btn-full-width {
width: 100%;
}
.editor-canvas-modern {
background: #000000;
image-rendering: pixelated;
image-rendering: crisp-edges;
border: 2px solid var(--border-primary);
border-radius: 8px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
width: min(95%, 90vh);
height: min(95%, 90vh);
aspect-ratio: 1;
max-width: 1000px;
max-height: 1000px;
}
/* Layers Section (deprecated - keeping for backward compatibility) */
.layers-section {
border-top: 1px solid var(--border-primary);
padding: 1rem;
max-height: 250px;
min-height: 150px;
overflow-y: auto;
overflow-x: hidden;
flex-shrink: 0;
}
.layer-details-content {
padding: 0;
}
/* Ensure scrolling works */
.editor-left-panel::-webkit-scrollbar,
.editor-layer-list-expandable::-webkit-scrollbar,
.layers-section::-webkit-scrollbar {
width: 6px;
}
.editor-left-panel::-webkit-scrollbar-track,
.editor-layer-list-expandable::-webkit-scrollbar-track,
.layers-section::-webkit-scrollbar-track {
background: transparent;
}
.editor-left-panel::-webkit-scrollbar-thumb,
.editor-layer-list-expandable::-webkit-scrollbar-thumb,
.layers-section::-webkit-scrollbar-thumb {
background: var(--border-primary);
border-radius: 3px;
}
.editor-left-panel::-webkit-scrollbar-thumb:hover,
.editor-layer-list-expandable::-webkit-scrollbar-thumb:hover,
.layers-section::-webkit-scrollbar-thumb:hover {
background: var(--border-hover);
}
.editor-sidebar,
.editor-main,
.editor-details {
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 12px;
padding: 1.5rem;
backdrop-filter: var(--backdrop-blur);
box-shadow: var(--shadow-secondary);
overflow-y: auto;
max-height: calc(100vh - 200px);
}
/* Modern Panels - Two Panel Layout */
.editor-left-panel {
background: var(--bg-secondary);
border-right: 1px solid var(--border-primary);
padding: 1rem;
overflow-y: auto;
overflow-x: hidden;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
gap: 1rem;
}
.editor-right-panel {
background: var(--bg-primary);
display: flex;
flex-direction: column;
overflow: hidden;
min-height: 0;
min-width: 0;
}
/* Compact Sections */
.editor-section-compact {
margin-bottom: 0;
}
.editor-layers-section {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
.editor-layers-section .section-title-compact {
flex-shrink: 0;
}
.section-title-compact {
font-size: 0.85rem;
font-weight: 600;
margin-bottom: 0.65rem;
color: var(--text-primary);
text-transform: uppercase;
letter-spacing: 0.5px;
opacity: 0.85;
}
.editor-section {
margin-bottom: 1.5rem;
}
.editor-section:last-child {
margin-bottom: 0;
}
.editor-section h3 {
font-size: 1.1rem;
margin-bottom: 1rem;
color: var(--text-primary);
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border-primary);
}
.editor-input-wrapper {
margin-bottom: 0.75rem;
}
.editor-input-wrapper label {
display: block;
margin-bottom: 0.35rem;
color: var(--text-secondary);
font-size: 0.8rem;
font-weight: 500;
}
.editor-input-wrapper input[type="text"],
.editor-input-wrapper input[type="number"],
.editor-input-wrapper textarea,
.editor-input-wrapper select {
width: 100%;
padding: 0.5rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 6px;
color: var(--text-primary);
font-size: 0.85rem;
transition: all 0.2s ease;
}
.editor-input-wrapper input[type="text"]:focus,
.editor-input-wrapper input[type="number"]:focus,
.editor-input-wrapper textarea:focus,
.editor-input-wrapper select:focus {
outline: none;
border-color: var(--accent-primary);
background: var(--bg-hover);
}
.editor-input-wrapper select option {
background: #1a252f;
color: var(--text-primary);
padding: 0.5rem;
}
.editor-input-wrapper input[type="color"] {
width: 100%;
height: 40px;
padding: 0.2rem;
background: var(--bg-tertiary);
border: 1px solid var(--border-primary);
border-radius: 6px;
cursor: pointer;
}
.editor-input-wrapper textarea {
resize: vertical;
min-height: 60px;
}
.editor-type-options {
margin-top: 0.75rem;
padding: 0.75rem;
background: var(--bg-tertiary);
border-radius: 6px;
border: 1px solid var(--border-primary);
}
.editor-type-options.hidden {
display: none;
}
.editor-actions {
display: flex;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.editor-actions button,
.editor-actions label {
flex: 1;
}
.editor-actions select {
width: 100%;
padding: 0.6rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 6px;
color: var(--text-primary);
font-size: 0.9rem;
cursor: pointer;
transition: all 0.2s ease;
}
.editor-actions select option {
background: #1a252f;
color: var(--text-primary);
padding: 0.5rem;
}
.editor-actions select:focus {
outline: none;
border-color: var(--accent-primary);
}
/* Layer List - Expandable Style */
.editor-layer-list-expandable {
display: flex;
flex-direction: column;
gap: 0.5rem;
flex: 1;
overflow-y: auto;
overflow-x: hidden;
min-height: 0;
padding-right: 0.25rem;
}
/* Old Layer List (deprecated) */
.editor-layer-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
flex: 1;
overflow-y: auto;
}
/* Expandable Layer Item */
.editor-layer-item {
background: var(--bg-tertiary);
border: 2px solid var(--border-primary);
border-radius: 8px;
overflow: visible;
transition: all 0.2s ease;
flex-shrink: 0;
}
.editor-layer-item:hover {
border-color: var(--border-hover);
}
.editor-layer-item.expanded {
border-color: var(--accent-primary);
background: rgba(74, 222, 128, 0.05);
}
/* Layer Header (Always Visible) */
.editor-layer-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem;
cursor: pointer;
user-select: none;
transition: background 0.2s ease;
}
.editor-layer-header:hover {
background: var(--bg-hover);
}
.editor-layer-header-left {
display: flex;
align-items: center;
gap: 0.5rem;
flex: 1;
}
.editor-layer-expand-icon {
font-size: 0.7rem;
color: var(--text-secondary);
transition: transform 0.2s ease;
}
.editor-layer-item.expanded .editor-layer-expand-icon {
transform: rotate(90deg);
}
.editor-layer-info {
flex: 1;
}
.editor-layer-title {
font-weight: 500;
color: var(--text-primary);
font-size: 0.9rem;
}
.editor-layer-subtitle {
font-size: 0.75rem;
color: var(--text-secondary);
margin-top: 0.15rem;
}
.editor-layer-buttons {
display: flex;
gap: 0.3rem;
}
/* Layer Content (Expandable) */
.editor-layer-content {
display: none;
padding: 0.75rem;
padding-top: 0.5rem;
border-top: 1px solid var(--border-primary);
background: var(--bg-secondary);
max-height: none;
overflow: visible;
}
.editor-layer-item.expanded .editor-layer-content {
display: block;
}
.btn-small {
padding: 0.4rem 0.6rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 4px;
color: var(--text-secondary);
cursor: pointer;
font-size: 0.85rem;
transition: all 0.2s ease;
}
.btn-small:hover:not(:disabled) {
background: var(--bg-hover);
border-color: var(--accent-primary);
color: var(--text-primary);
}
.btn-small:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.btn-small.btn-danger:hover:not(:disabled) {
border-color: var(--accent-error);
color: var(--accent-error);
}
/* Layer Details Panel */
.editor-group {
margin-bottom: 1rem;
padding: 0.75rem;
background: var(--bg-tertiary);
border-radius: 6px;
border: 1px solid var(--border-primary);
}
.editor-group h4 {
font-size: 0.85rem;
margin-bottom: 0.65rem;
color: var(--accent-primary);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.3px;
}
.animation-params {
margin-top: 0.5rem;
}
.color-stops-container {
display: flex;
flex-direction: column;
gap: 0.8rem;
}
.color-stop {
padding: 0.8rem;
background: var(--bg-secondary);
border-radius: 4px;
border: 1px solid var(--border-primary);
}
.editor-empty-state {
text-align: center;
color: var(--text-muted);
padding: 2rem;
font-size: 0.95rem;
}
/* Button Variants */
.btn-success {
background: linear-gradient(135deg, var(--accent-success) 0%, #45a049 100%);
color: white;
}
.btn-success:hover {
background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
}
.btn-danger {
background: linear-gradient(135deg, var(--accent-error) 0%, #dc2626 100%);
color: white;
}
.btn-danger:hover {
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}
/* Notifications */
.notification {
position: fixed;
top: 100px;
right: 20px;
padding: 1rem 1.5rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 8px;
box-shadow: var(--shadow-primary);
backdrop-filter: var(--backdrop-blur);
color: var(--text-primary);
font-size: 0.95rem;
z-index: 10000;
opacity: 0;
transform: translateX(400px);
transition: all 0.3s ease;
}
.notification.show {
opacity: 1;
transform: translateX(0);
}
.notification-success {
border-left: 4px solid var(--accent-success);
}
.notification-error {
border-left: 4px solid var(--accent-error);
}
.notification-info {
border-left: 4px solid var(--accent-secondary);
}
/* Responsive Design */
@media (max-width: 1800px) {
.editor-layout {
grid-template-columns: 280px 1fr 320px;
}
}
@media (max-width: 1400px) {
.editor-canvas-modern {
width: min(85%, 85vh);
height: min(85%, 85vh);
}
}
@media (max-width: 1200px) {
.editor-layout {
grid-template-columns: 1fr;
grid-template-rows: auto auto auto;
}
/* Stack vertically on mobile */
.editor-layout-modern {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
}
.editor-sidebar,
.editor-main,
.editor-details {
max-height: none;
}
.editor-left-panel {
border: none;
border-bottom: 1px solid var(--border-primary);
max-height: 50vh;
}
.editor-right-panel {
min-height: 50vh;
}
.editor-preview-controls {
flex-direction: column;
gap: 1rem;
}
.preview-control-group {
width: 100%;
justify-content: center;
}
.node-select {
min-width: 250px;
}
.preview-bar-controls {
flex-wrap: wrap;
}
}
@media (max-width: 768px) {
.editor-container {
padding: 1rem;
}
.editor-header h2 {
font-size: 1.5rem;
}
.editor-subtitle {
font-size: 0.85rem;
}
.editor-canvas {
max-width: 100%;
}
.editor-container-modern {
height: calc(100vh - 60px);
}
.editor-preview-bar {
flex-direction: column;
align-items: stretch;
}
.preview-bar-controls {
justify-content: stretch;
}
.node-select-compact {
flex: 1;
min-width: 0;
}
.btn-preview {
flex: 1;
}
.preview-bar-info {
justify-content: center;
}
}
/* Hidden utility */
.hidden {
display: none !important;
}