From a7e5d44d9c86bbdbcf932e62df53a24ab1cb95d9 Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Tue, 3 Nov 2026 15:45:58 -0500 Subject: [PATCH] Refine desktop workspace and inspector --- app/assets/css/app.css | 16 +- app/assets/css/interface.css | 426 ++++++++++++++++ app/assets/loading.html | 24 +- app/components/ButtonBackground.vue | 2 +- app/components/ButtonColorPicker.vue | 18 +- app/components/ButtonCopyImage.vue | 4 +- app/components/CanvasControlSurface.vue | 5 +- app/components/ColorPicker.vue | 34 +- app/components/ControlAspectRatios.vue | 90 ++-- app/components/ControlDimensions.vue | 77 +-- app/components/ControlFitToWindow.vue | 77 +-- app/components/ControlTab.vue | 6 +- app/components/ControlTabs.vue | 145 ++++-- app/components/ControlWindowPosition.vue | 81 +++ app/components/ControlWorkspaceLayout.vue | 90 ++++ app/components/ControlZoom.vue | 110 ++++ app/components/DesktopTitlebar.vue | 2 +- app/components/Dropdown.vue | 4 +- app/components/Editor.vue | 275 +++++----- app/components/FileDropdown.vue | 4 +- app/components/InputCornerRadius.vue | 67 +++ app/components/InputMargin.vue | 97 ++-- app/components/Modal.vue | 2 +- app/components/ModalChangelog.vue | 10 +- app/components/ModalCustomBackground.vue | 30 +- app/components/ModalHelp.vue | 22 +- app/components/ModalPreferences.vue | 50 +- app/components/ModalSavedProjectCard.vue | 11 +- app/components/ModalSavedProjects.vue | 16 +- app/components/ModalTemplates.vue | 20 +- app/components/NewTab.vue | 29 +- app/components/Page.vue | 100 ++-- app/components/PopoverPanel.vue | 17 +- app/components/Preview.vue | 473 ++++++++++-------- app/components/PropertyField.vue | 16 + app/components/SearchableSelect.vue | 29 +- app/components/SettingsRow.vue | 6 +- app/components/SettingsSection.vue | 6 +- app/components/Tab.vue | 16 +- app/components/TabBackgrounds.vue | 10 +- app/components/TabPreview.vue | 375 ++++++++------ app/components/TabScenes.vue | 8 +- app/components/TabThemes.vue | 91 +--- app/components/Toggle.vue | 8 +- app/components/ToggleBackgroundBlur.vue | 24 +- app/components/ToggleBorder.vue | 18 +- app/components/ToggleHeader.vue | 123 ++--- app/components/ToggleShadow.vue | 75 +-- app/components/ToggleShine.vue | 117 +++-- app/components/ToggleSocialBadge.vue | 133 ++--- app/components/ToolbarButton.vue | 8 +- app/components/ui/button/index.js | 10 +- .../ui/context-menu/ContextMenuContent.vue | 7 +- .../ui/context-menu/ContextMenuItem.vue | 2 +- .../ui/context-menu/ContextMenuSeparator.vue | 2 +- app/components/ui/dialog/DialogContent.vue | 10 +- app/components/ui/dialog/DialogHeader.vue | 2 +- .../ui/dialog/DialogScrollContent.vue | 11 +- app/components/ui/dialog/DialogTitle.vue | 2 +- .../DropdownMenuCheckboxItem.vue | 2 +- .../ui/dropdown-menu/DropdownMenuContent.vue | 7 +- .../ui/dropdown-menu/DropdownMenuItem.vue | 2 +- .../dropdown-menu/DropdownMenuRadioItem.vue | 2 +- .../dropdown-menu/DropdownMenuSeparator.vue | 2 +- .../dropdown-menu/DropdownMenuSubContent.vue | 7 +- .../dropdown-menu/DropdownMenuSubTrigger.vue | 2 +- app/components/ui/input/Input.vue | 2 +- app/components/ui/popover/PopoverContent.vue | 7 +- app/components/ui/select/SelectContent.vue | 10 +- app/components/ui/select/SelectItem.vue | 2 +- app/components/ui/select/SelectLabel.vue | 2 +- app/components/ui/select/SelectSeparator.vue | 2 +- app/components/ui/select/SelectTrigger.vue | 2 +- app/components/ui/switch/Switch.vue | 4 +- app/components/ui/tabs/TabsContent.vue | 2 +- app/components/ui/tabs/TabsTrigger.vue | 2 +- app/composables/usePanZoom.js | 10 +- app/composables/useProjectStoreFactory.js | 2 +- app/lib/utils.ts | 4 +- app/pages/index.vue | 72 +-- tests/components/ButtonColorPicker.test.js | 28 ++ tests/components/ControlAspectRatios.test.js | 19 +- tests/components/ControlZoom.test.js | 86 ++++ tests/components/Editor.test.js | 152 ++++++ tests/components/NewTab.test.js | 2 +- tests/components/Page.test.js | 105 +++- tests/components/Preview.test.js | 51 ++ tests/components/Tab.test.js | 7 + tests/components/TabPreview.test.js | 111 ++++ tests/components/TabThemes.test.js | 4 +- tests/composables/usePanZoom.test.js | 36 ++ tests/composables/usePanZoomGestures.test.js | 63 ++- 92 files changed, 2973 insertions(+), 1381 deletions(-) create mode 100644 app/assets/css/interface.css create mode 100644 app/components/ControlWindowPosition.vue create mode 100644 app/components/ControlWorkspaceLayout.vue create mode 100644 app/components/ControlZoom.vue create mode 100644 app/components/InputCornerRadius.vue create mode 100644 app/components/PropertyField.vue create mode 100644 tests/components/ButtonColorPicker.test.js create mode 100644 tests/components/ControlZoom.test.js create mode 100644 tests/components/Editor.test.js diff --git a/app/assets/css/app.css b/app/assets/css/app.css index 45bbc9d8..ba86926a 100644 --- a/app/assets/css/app.css +++ b/app/assets/css/app.css @@ -12,9 +12,22 @@ --font-mono-jetbrains: JetbrainsMono; --radius-control: 0.375rem; - --radius-surface: 0.5rem; + --radius-surface: 0.625rem; + --radius-dialog: 0.875rem; --radius-emphasis: 0.75rem; + --color-ui-canvas: var(--ui-canvas); + --color-ui-chrome: var(--ui-chrome); + --color-ui-panel: var(--ui-panel); + --color-ui-popup: var(--ui-popup); + --color-ui-field: var(--ui-field); + --color-ui-hover: var(--ui-hover); + --color-ui-selected: var(--ui-selected); + --color-ui-line: var(--ui-line); + --color-ui-text: var(--ui-text); + --color-ui-muted: var(--ui-muted); + --color-ui-focus: var(--ui-focus); + --color-blue-gray-50: var(--color-slate-50); --color-blue-gray-100: var(--color-slate-100); --color-blue-gray-200: var(--color-slate-200); @@ -154,6 +167,7 @@ @import 'tailwind-scrollbar-hide/v4'; +@import './interface.css'; @import './content.css'; @import './prism.css'; @import './prism-dark.css'; diff --git a/app/assets/css/interface.css b/app/assets/css/interface.css new file mode 100644 index 00000000..e4c978de --- /dev/null +++ b/app/assets/css/interface.css @@ -0,0 +1,426 @@ +:root { + --ui-canvas: #ededee; + --ui-chrome: #f5f5f6; + --ui-panel: #fafafa; + --ui-popup: #fff; + --ui-field: #fff; + --ui-hover: #e8e8eb; + --ui-selected: #dedee3; + --ui-line: rgb(0 0 0 / 10%); + --ui-text: #252528; + --ui-muted: #707076; + --ui-focus: #6e83b7; + --ui-switch-off: #d6d6da; + --ui-switch-thumb: #fff; + --ui-shadow: 0 8px 28px rgb(0 0 0 / 14%), 0 1px 4px rgb(0 0 0 / 8%); +} + +@layer utilities { + .floating-toolbar :where(button, input[aria-label='Canvas zoom']) { + border: 1px solid transparent; + border-radius: 9999px; + background: transparent; + color: var(--ui-muted); + transition: + background-color 120ms ease, + border-color 120ms ease, + color 120ms ease; + } + + .floating-toolbar + :is(button, input[aria-label='Canvas zoom']):not(:disabled):is( + :hover, + [data-state='open'] + ) { + border-color: var(--ui-line); + background: var(--ui-hover); + color: var(--ui-text); + } + + .floating-toolbar :is([aria-selected='true'], [aria-pressed='true']) { + border-color: var(--ui-line); + background: var(--ui-selected); + color: var(--ui-text); + } + + .floating-toolbar :is(button, input[aria-label='Canvas zoom']):focus-visible { + outline: 2px solid var(--ui-focus); + outline-offset: 1px; + box-shadow: none; + } +} + +.dark { + --ui-canvas: #191919; + --ui-chrome: #202020; + --ui-panel: #242424; + --ui-popup: #2b2b2b; + --ui-field: #303030; + --ui-hover: #383838; + --ui-selected: #424242; + --ui-line: rgb(255 255 255 / 9%); + --ui-text: #ededed; + --ui-muted: #a0a0a0; + --ui-focus: #92a6d3; + --ui-switch-off: #454545; + --ui-switch-thumb: #bcbcbc; + --ui-shadow: 0 12px 36px rgb(0 0 0 / 30%), 0 2px 6px rgb(0 0 0 / 20%); +} + +@layer components { + .ui-navbar-button { + display: flex; + width: 32px; + height: 32px; + flex: none; + align-items: center; + justify-content: center; + border: 1px solid transparent; + border-radius: 10px; + background: transparent; + color: var(--ui-muted); + user-select: none; + transition: + background-color 120ms ease, + border-color 120ms ease, + color 120ms ease; + } + + .ui-navbar-button:is(:hover, [data-state='open']) { + border-color: var(--ui-line); + background: var(--ui-hover); + color: var(--ui-text); + } + + .ui-navbar-button:focus-visible { + outline: 2px solid var(--ui-focus); + outline-offset: 1px; + } + + .workspace-statusbar { + height: 40px; + flex: none; + overflow-x: auto; + overflow-y: hidden; + border-top: 1px solid var(--ui-line); + background: var(--ui-chrome); + scrollbar-width: thin; + } + + .workspace-statusbar-content { + display: flex; + height: 100%; + min-width: max-content; + align-items: center; + gap: 8px; + padding: 0 8px; + } + + .ui-switch { + width: 32px; + height: 18px; + background: var(--ui-switch-off); + transition: background-color 120ms ease; + } + + .ui-switch-thumb { + width: 14px; + height: 14px; + background: var(--ui-switch-thumb); + box-shadow: 0 1px 2px rgb(0 0 0 / 15%); + transition: + transform 120ms ease, + background-color 120ms ease; + } + + .ui-switch[data-state='checked'] { + background: var(--ui-text); + } + + .ui-switch-thumb[data-state='checked'] { + transform: translateX(14px); + background: var(--ui-canvas); + } + + .ui-popup, + .ui-dialog { + border: 1px solid var(--ui-line); + background: var(--ui-popup); + color: var(--ui-text); + box-shadow: var(--ui-shadow); + outline: none; + } + + .ui-popup { + border-radius: var(--radius-surface); + transform-origin: var(--reka-popper-transform-origin, center); + } + + .ui-popup[data-state='open'] { + animation: popup-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1); + } + + .ui-popup[data-state='closed'] { + animation: popup-out 90ms ease-in; + } + + .ui-dialog { + border-radius: var(--radius-dialog); + background: var(--ui-panel); + } + + .ui-dialog[data-state='open'] { + animation: dialog-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1); + } + + .ui-dialog[data-state='closed'] { + animation: popup-out 100ms ease-in; + } + + .ui-overlay { + background: rgb(0 0 0 / 30%); + } + + .dark .ui-overlay { + background: rgb(0 0 0 / 45%); + } + + .ui-overlay[data-state='open'], + .ui-tab-content { + animation: fade-in 140ms ease-out; + } + + .ui-overlay[data-state='closed'] { + animation: fade-in 100ms ease-in reverse; + } + + .ui-field { + border-color: var(--ui-line); + background: var(--ui-field); + color: var(--ui-text); + box-shadow: 0 1px 1px rgb(0 0 0 / 3%); + transition: + background-color 120ms ease, + border-color 120ms ease, + box-shadow 120ms ease; + } + + .ui-field:hover:not(:disabled) { + background: var(--ui-hover); + } + + .ui-field:focus-visible { + outline: 2px solid var(--ui-focus); + outline-offset: 1px; + } + + .ui-menu-item { + min-height: 28px; + border-radius: var(--radius-control); + color: var(--ui-text); + outline: none; + } + + .ui-menu-item:is( + :focus, + :hover, + [data-highlighted], + [data-state='open'], + [data-active-searchable-select-option='true'] + ) { + background: var(--ui-selected); + color: var(--ui-text); + } + + .ui-menu-item[data-disabled] { + pointer-events: none; + opacity: 0.4; + } + + .ui-close { + display: inline-flex; + width: 28px; + height: 28px; + align-items: center; + justify-content: center; + border-radius: var(--radius-control); + color: var(--ui-muted); + transition: + background-color 120ms ease, + color 120ms ease; + } + + .ui-close:hover { + background: var(--ui-hover); + color: var(--ui-text); + } + + .ui-close:focus-visible { + outline: 2px solid var(--ui-focus); + outline-offset: 1px; + } + + .inspector-enter-active, + .inspector-leave-active { + transition: width 180ms cubic-bezier(0.2, 0.8, 0.2, 1); + } + + .inspector-enter-active > .inspector-panel, + .inspector-leave-active > .inspector-panel { + transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1); + } + + .inspector-enter-from > .inspector-panel, + .inspector-leave-to > .inspector-panel { + transform: translateX(100%); + } + + @keyframes popup-in { + from { + opacity: 0; + scale: 0.98; + } + to { + opacity: 1; + scale: 1; + } + } + + @keyframes popup-out { + from { + opacity: 1; + scale: 1; + } + to { + opacity: 0; + scale: 0.98; + } + } + + @keyframes dialog-in { + from { + opacity: 0; + scale: 0.98; + transform: translateY(6px); + } + to { + opacity: 1; + scale: 1; + transform: translateY(0); + } + } + + @keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + + .property-fields { + display: grid; + gap: 8px; + padding: 12px; + } + + .property-field { + display: grid; + grid-template-columns: 84px minmax(0, 1fr); + align-items: center; + gap: 12px; + min-height: 28px; + } + + .property-choice { + display: flex; + min-width: 0; + flex-direction: column; + align-items: center; + gap: 6px; + padding: 8px; + border: 1px solid var(--ui-line); + border-radius: var(--radius-control); + color: var(--ui-muted); + font-size: 11px; + transition: background-color 120ms ease; + } + + .property-choice:hover { + background: var(--ui-hover); + color: var(--ui-text); + } + + .property-choice[aria-pressed='true'] { + border-color: var(--ui-focus); + background: var(--ui-hover); + color: var(--ui-text); + } + + .property-choice:focus-visible { + outline: 2px solid var(--ui-focus); + outline-offset: 2px; + } + + .property-diagram-field { + display: flex; + min-width: 0; + flex-direction: column; + gap: 4px; + color: var(--ui-muted); + font-size: 11px; + text-align: center; + } + + .property-diagram-field input { + text-align: center; + font-variant-numeric: tabular-nums; + } + + .property-preview { + overflow: hidden; + border: 1px solid var(--ui-line); + border-radius: var(--radius-control); + background: var(--ui-canvas); + } + + .property-field > label { + color: var(--ui-muted); + font-size: 12px; + font-weight: 400; + } + + .property-field-control { + display: flex; + min-width: 0; + align-items: center; + justify-content: flex-end; + gap: 6px; + } + + .property-field-control > :not(.ui-toggle) { + min-width: 0; + } + + .property-field-control > button, + .property-field-control > .color-picker-trigger { + width: 100%; + } + + @media (prefers-reduced-motion: reduce) { + .ui-switch, + .ui-switch-thumb, + .ui-popup, + .ui-dialog, + .ui-overlay, + .ui-tab-content, + .inspector-enter-active, + .inspector-leave-active, + .inspector-enter-active > .inspector-panel, + .inspector-leave-active > .inspector-panel { + animation: none !important; + transition: none !important; + } + } +} diff --git a/app/assets/loading.html b/app/assets/loading.html index 803ecc95..15db6172 100644 --- a/app/assets/loading.html +++ b/app/assets/loading.html @@ -8,18 +8,12 @@ html { --showcode-loader-bg: #09090b; - --showcode-loader-surface: rgba(24, 24, 27, 0.68); - --showcode-loader-border: rgba(255, 255, 255, 0.08); --showcode-loader-track: rgba(255, 255, 255, 0.12); - --showcode-loader-shadow: rgba(0, 0, 0, 0.42); } html[data-showcode-loader-theme="light"] { --showcode-loader-bg: #fafafa; - --showcode-loader-surface: rgba(255, 255, 255, 0.82); - --showcode-loader-border: rgba(24, 24, 27, 0.08); --showcode-loader-track: rgba(24, 24, 27, 0.12); - --showcode-loader-shadow: rgba(24, 24, 27, 0.12); } .showcode-loader { @@ -32,15 +26,7 @@ justify-content: center; gap: 1.35rem; overflow: hidden; - background: - radial-gradient(ellipse at center, rgba(99, 102, 241, 0.18), transparent 38%), - var(--showcode-loader-bg); -} - -html[data-showcode-loader-theme="light"] .showcode-loader { - background: - radial-gradient(ellipse at center, rgba(129, 140, 248, 0.22), transparent 42%), - var(--showcode-loader-bg); + background: var(--showcode-loader-bg); } .showcode-loader__mark { @@ -48,19 +34,11 @@ width: 5rem; height: 5rem; place-items: center; - border: 1px solid var(--showcode-loader-border); - border-radius: 1.35rem; - background: var(--showcode-loader-surface); - box-shadow: - 0 1.5rem 4rem var(--showcode-loader-shadow), - inset 0 1px 0 rgba(255, 255, 255, 0.08); - backdrop-filter: blur(24px); } .showcode-loader__logo { width: 3.15rem; height: auto; - filter: drop-shadow(0 0.85rem 1.5rem rgba(99, 102, 241, 0.38)); } .showcode-loader__indicator { diff --git a/app/components/ButtonBackground.vue b/app/components/ButtonBackground.vue index e45a53d5..d5c8d4bf 100644 --- a/app/components/ButtonBackground.vue +++ b/app/components/ButtonBackground.vue @@ -1,5 +1,5 @@ diff --git a/app/components/ButtonCopyImage.vue b/app/components/ButtonCopyImage.vue index 0be92dea..1af62db0 100644 --- a/app/components/ButtonCopyImage.vue +++ b/app/components/ButtonCopyImage.vue @@ -16,7 +16,7 @@ -