Skip to content

AI-native design editor. Open-source Figma alternative.

Adopt Reka UI Tooltip/ToggleGroup, VueUse useClipboard

Danila Poyarkov0fbaf1c24e18
diff --git a/src/components/CanvasMenu.vue b/src/components/CanvasMenu.vue
index fa4b89ff8..75692a13d 100644
--- a/src/components/CanvasMenu.vue
+++ b/src/components/CanvasMenu.vue
@@ -8,12 +8,14 @@ import {
ContextMenuSubContent,
ContextMenuPortal
} from 'reka-ui'
+import { useClipboard } from '@vueuse/core'
import { EditorMenuRoot, toast } from '@open-pencil/vue'
import { useEditorStore } from '@/stores/editor'
import { menuContent, menuItem, menuSeparator } from '@/components/ui/menu'
const store = useEditorStore()
+const { copy } = useClipboard()
function execCommand(cmd: string) {
window.document.execCommand(cmd)
@@ -21,7 +23,7 @@ function execCommand(cmd: string) {
async function clipboardWrite(text: string | null, label: string) {
if (!text) return
- await navigator.clipboard.writeText(text)
+ copy(text)
toast.show(`Copied as ${label}`)
}
diff --git a/src/components/CodePanel.vue b/src/components/CodePanel.vue
index 6476a2f59..c28fd3696 100644
--- a/src/components/CodePanel.vue
+++ b/src/components/CodePanel.vue
@@ -2,6 +2,7 @@
import Prism from 'prismjs'
import 'prismjs/components/prism-jsx'
import { ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport } from 'reka-ui'
+import { useClipboard } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
import { selectionToJSX } from '@open-pencil/core'
@@ -10,6 +11,7 @@ import { useEditor } from '@open-pencil/vue'
import type { JSXFormat } from '@open-pencil/core'
const store = useEditor()
+const { copy } = useClipboard()
const copied = ref(false)
const jsxFormat = ref<JSXFormat>('openpencil')
@@ -33,7 +35,7 @@ const highlightedLines = computed(() => {
let copyTimeout: ReturnType<typeof setTimeout> | undefined
function copyCode() {
- navigator.clipboard.writeText(jsxCode.value)
+ copy(jsxCode.value)
copied.value = true
clearTimeout(copyTimeout)
copyTimeout = setTimeout(() => (copied.value = false), 2000)
diff --git a/src/components/CollabPanel.vue b/src/components/CollabPanel.vue
index e2d9200f8..fd098ee76 100644
--- a/src/components/CollabPanel.vue
+++ b/src/components/CollabPanel.vue
@@ -1,4 +1,5 @@
<script setup lang="ts">
+import { useClipboard } from '@vueuse/core'
import { ref, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
@@ -21,6 +22,7 @@ import { initials } from '@/utils/text'
const route = useRoute()
const router = useRouter()
const collab = useCollabInjected()
+const { copy } = useClipboard()
const joinInput = ref('')
const nameDraft = ref(collab?.state.value.localName ?? '')
@@ -41,7 +43,7 @@ const isJoining = computed(() => !!pendingRoomId && !state.value.connected)
function copyLink() {
if (!shareUrl.value) return
- navigator.clipboard.writeText(shareUrl.value)
+ copy(shareUrl.value)
toast.show('Link copied to clipboard')
copied.value = true
setTimeout(() => {
@@ -54,7 +56,7 @@ function onShare() {
collab.setLocalName(nameDraft.value.trim())
const roomId = collab.shareCurrentDoc()
router.push(`/share/${roomId}`)
- navigator.clipboard.writeText(`${window.location.origin}/share/${roomId}`)
+ copy(`${window.location.origin}/share/${roomId}`)
toast.show('Link copied to clipboard')
popoverOpen.value = false
}
diff --git a/src/components/MobileHud.vue b/src/components/MobileHud.vue
index aa83911d6..fb8d17f63 100644
--- a/src/components/MobileHud.vue
+++ b/src/components/MobileHud.vue
@@ -1,4 +1,5 @@
<script setup lang="ts">
+import { useClipboard } from '@vueuse/core'
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import {
@@ -33,6 +34,7 @@ import type { Component } from 'vue'
const router = useRouter()
const collab = useCollabInjected()
const store = useEditorStore()
+const { copy } = useClipboard()
const collabState = computed(() => collab?.state.value ?? DEFAULT_COLLAB_STATE)
const collabPeers = computed(() => collab?.remotePeers.value ?? [])
@@ -42,7 +44,7 @@ function onShare() {
if (!collab) return
const roomId = collab.shareCurrentDoc()
router.push(`/share/${roomId}`)
- navigator.clipboard.writeText(`${window.location.origin}/share/${roomId}`)
+ copy(`${window.location.origin}/share/${roomId}`)
toast.show('Link copied to clipboard')
}
diff --git a/src/components/Tip.vue b/src/components/Tip.vue
new file mode 100644
index 000000000..e5ea11029
--- /dev/null
+++ b/src/components/Tip.vue
@@ -0,0 +1,25 @@
+<script setup lang="ts">
+import { TooltipContent, TooltipPortal, TooltipRoot, TooltipTrigger } from 'reka-ui'
+
+const { side = 'top' } = defineProps<{
+ label: string
+ side?: 'top' | 'bottom' | 'left' | 'right'
+}>()
+</script>
+
+<template>
+ <TooltipRoot>
+ <TooltipTrigger as-child>
+ <slot />
+ </TooltipTrigger>
+ <TooltipPortal>
+ <TooltipContent
+ :side="side"
+ :side-offset="4"
+ class="z-50 animate-in rounded bg-neutral-800 px-2 py-1 text-xs text-white shadow-lg zoom-in-95 fade-in"
+ >
+ {{ label }}
+ </TooltipContent>
+ </TooltipPortal>
+ </TooltipRoot>
+</template>
diff --git a/src/components/properties/PositionSection.vue b/src/components/properties/PositionSection.vue
index 9a042a4c2..676da30c6 100644
--- a/src/components/properties/PositionSection.vue
+++ b/src/components/properties/PositionSection.vue
@@ -2,6 +2,7 @@
import { computed } from 'vue'
import ScrubInput from '@/components/ScrubInput.vue'
+import Tip from '@/components/Tip.vue'
import { useNodeProps } from '@open-pencil/vue'
const {
@@ -36,56 +37,62 @@ const ids = computed(() => nodes.value.map((n) => n.id))
<!-- Alignment buttons -->
<div class="mb-1.5 flex gap-2">
<div class="flex gap-0.5">
- <button
- class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-align-left"
- title="Align left"
- @click="store.alignNodes(ids, 'horizontal', 'min')"
- >
- <icon-lucide-align-horizontal-justify-start class="size-3.5" />
- </button>
- <button
- class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-align-center-h"
- title="Align center horizontally"
- @click="store.alignNodes(ids, 'horizontal', 'center')"
- >
- <icon-lucide-align-horizontal-justify-center class="size-3.5" />
- </button>
- <button
- class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-align-right"
- title="Align right"
- @click="store.alignNodes(ids, 'horizontal', 'max')"
- >
- <icon-lucide-align-horizontal-justify-end class="size-3.5" />
- </button>
+ <Tip label="Align left">
+ <button
+ class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-align-left"
+ @click="store.alignNodes(ids, 'horizontal', 'min')"
+ >
+ <icon-lucide-align-horizontal-justify-start class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip label="Align center horizontally">
+ <button
+ class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-align-center-h"
+ @click="store.alignNodes(ids, 'horizontal', 'center')"
+ >
+ <icon-lucide-align-horizontal-justify-center class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip label="Align right">
+ <button
+ class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-align-right"
+ @click="store.alignNodes(ids, 'horizontal', 'max')"
+ >
+ <icon-lucide-align-horizontal-justify-end class="size-3.5" />
+ </button>
+ </Tip>
</div>
<div class="flex gap-0.5">
- <button
- class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-align-top"
- title="Align top"
- @click="store.alignNodes(ids, 'vertical', 'min')"
- >
- <icon-lucide-align-vertical-justify-start class="size-3.5" />
- </button>
- <button
- class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-align-center-v"
- title="Align center vertically"
- @click="store.alignNodes(ids, 'vertical', 'center')"
- >
- <icon-lucide-align-vertical-justify-center class="size-3.5" />
- </button>
- <button
- class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-align-bottom"
- title="Align bottom"
- @click="store.alignNodes(ids, 'vertical', 'max')"
- >
- <icon-lucide-align-vertical-justify-end class="size-3.5" />
- </button>
+ <Tip label="Align top">
+ <button
+ class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-align-top"
+ @click="store.alignNodes(ids, 'vertical', 'min')"
+ >
+ <icon-lucide-align-vertical-justify-start class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip label="Align center vertically">
+ <button
+ class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-align-center-v"
+ @click="store.alignNodes(ids, 'vertical', 'center')"
+ >
+ <icon-lucide-align-vertical-justify-center class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip label="Align bottom">
+ <button
+ class="flex size-7 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-align-bottom"
+ @click="store.alignNodes(ids, 'vertical', 'max')"
+ >
+ <icon-lucide-align-vertical-justify-end class="size-3.5" />
+ </button>
+ </Tip>
</div>
</div>
@@ -138,30 +145,33 @@ const ids = computed(() => nodes.value.map((n) => n.id))
<icon-lucide-rotate-ccw class="size-3" />
</template>
</ScrubInput>
- <button
- class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-flip-horizontal"
- title="Flip horizontal"
- @click="store.flipNodes(ids, 'horizontal')"
- >
- <icon-lucide-flip-horizontal class="size-3.5" />
- </button>
- <button
- class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-flip-vertical"
- title="Flip vertical"
- @click="store.flipNodes(ids, 'vertical')"
- >
- <icon-lucide-flip-vertical class="size-3.5" />
- </button>
- <button
- class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
- data-test-id="position-rotate-90"
- title="Rotate 90°"
- @click="store.rotateNodes(ids, 90)"
- >
- <icon-lucide-rotate-cw class="size-3.5" />
- </button>
+ <Tip label="Flip horizontal">
+ <button
+ class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-flip-horizontal"
+ @click="store.flipNodes(ids, 'horizontal')"
+ >
+ <icon-lucide-flip-horizontal class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip label="Flip vertical">
+ <button
+ class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-flip-vertical"
+ @click="store.flipNodes(ids, 'vertical')"
+ >
+ <icon-lucide-flip-vertical class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip label="Rotate 90°">
+ <button
+ class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"
+ data-test-id="position-rotate-90"
+ @click="store.rotateNodes(ids, 90)"
+ >
+ <icon-lucide-rotate-cw class="size-3.5" />
+ </button>
+ </Tip>
</div>
</div>
</template>
diff --git a/src/components/properties/TypographySection.vue b/src/components/properties/TypographySection.vue
index c900d8f38..1efcd9758 100644
--- a/src/components/properties/TypographySection.vue
+++ b/src/components/properties/TypographySection.vue
@@ -6,6 +6,7 @@ import FontPicker from '@/components/FontPicker.vue'
import ScrubInput from '@/components/ScrubInput.vue'
import { useNodeFontStatus, useNodeProps } from '@open-pencil/vue'
import { loadFont } from '@/engine/fonts'
+import { ToggleGroupItem, ToggleGroupRoot, type AcceptableValue } from 'reka-ui'
const { store, node, updateProp, commitProp } = useNodeProps()
const { missingFonts, hasMissingFonts } = useNodeFontStatus(() => node.value)
@@ -70,6 +71,36 @@ function toggleDecoration(deco: 'UNDERLINE' | 'STRIKETHROUGH') {
store.requestRender()
}
+const activeFormatting = computed(() => {
+ if (!node.value) return []
+ const result: string[] = []
+ if (node.value.fontWeight >= 700) result.push('bold')
+ if (node.value.italic) result.push('italic')
+ if (node.value.textDecoration === 'UNDERLINE') result.push('underline')
+ if (node.value.textDecoration === 'STRIKETHROUGH') result.push('strikethrough')
+ return result
+})
+
+function onFormattingChange(next: AcceptableValue | AcceptableValue[]) {
+ if (!node.value || !Array.isArray(next)) return
+ const prev = activeFormatting.value
+ const values = next as string[]
+ const added = values.filter((v) => !prev.includes(v))
+ const removed = prev.filter((v) => !values.includes(v))
+ for (const item of added) {
+ if (item === 'bold') toggleBold()
+ else if (item === 'italic') toggleItalic()
+ else if (item === 'underline') toggleDecoration('UNDERLINE')
+ else if (item === 'strikethrough') toggleDecoration('STRIKETHROUGH')
+ }
+ for (const item of removed) {
+ if (item === 'bold') toggleBold()
+ else if (item === 'italic') toggleItalic()
+ else if (item === 'underline') toggleDecoration('UNDERLINE')
+ else if (item === 'strikethrough') toggleDecoration('STRIKETHROUGH')
+ }
+}
+
onMounted(async () => {
if (!node.value) return
await loadFont(node.value.fontFamily, currentWeightLabel.value)
@@ -137,74 +168,63 @@ onMounted(async () => {
<!-- Text alignment + formatting -->
<div class="flex items-center gap-3">
- <div class="flex gap-0.5">
- <button
+ <ToggleGroupRoot
+ type="single"
+ class="flex gap-0.5"
+ :model-value="node.textAlignHorizontal"
+ @update:model-value="
+ (val: AcceptableValue) => {
+ if (val) setAlign(val as TextAlign)
+ }
+ "
+ >
+ <ToggleGroupItem
v-for="align in ['LEFT', 'CENTER', 'RIGHT'] as TextAlign[]"
:key="align"
- class="flex cursor-pointer items-center justify-center rounded border px-2 py-1"
- :class="
- node.textAlignHorizontal === align
- ? 'border-accent bg-accent text-white'
- : 'border-border bg-input text-muted hover:bg-hover hover:text-surface'
- "
- @click="setAlign(align)"
+ :value="align"
+ class="flex cursor-pointer items-center justify-center rounded border border-border bg-input px-2 py-1 text-muted hover:bg-hover hover:text-surface data-[state=on]:border-accent data-[state=on]:bg-accent data-[state=on]:text-white"
>
<icon-lucide-align-left v-if="align === 'LEFT'" class="size-3.5" />
<icon-lucide-align-center v-else-if="align === 'CENTER'" class="size-3.5" />
<icon-lucide-align-right v-else class="size-3.5" />
- </button>
- </div>
- <div class="flex gap-0.5">
- <button
+ </ToggleGroupItem>
+ </ToggleGroupRoot>
+ <ToggleGroupRoot
+ type="multiple"
+ class="flex gap-0.5"
+ :model-value="activeFormatting"
+ @update:model-value="onFormattingChange"
+ >
+ <ToggleGroupItem
+ value="bold"
data-test-id="typography-bold-button"
- class="flex cursor-pointer items-center justify-center rounded border px-2 py-1 font-bold"
- :class="
- node.fontWeight >= 700
- ? 'border-accent bg-accent text-white'
- : 'border-border bg-input text-muted hover:bg-hover hover:text-surface'
- "
+ class="flex cursor-pointer items-center justify-center rounded border border-border bg-input px-2 py-1 font-bold text-muted hover:bg-hover hover:text-surface data-[state=on]:border-accent data-[state=on]:bg-accent data-[state=on]:text-white"
title="Bold (⌘B)"
- @click="toggleBold"
>
<icon-lucide-bold class="size-3.5" />
- </button>
- <button
- class="flex cursor-pointer items-center justify-center rounded border px-2 py-1"
- :class="
- node.italic
- ? 'border-accent bg-accent text-white'
- : 'border-border bg-input text-muted hover:bg-hover hover:text-surface'
- "
+ </ToggleGroupItem>
+ <ToggleGroupItem
+ value="italic"
+ class="flex cursor-pointer items-center justify-center rounded border border-border bg-input px-2 py-1 text-muted hover:bg-hover hover:text-surface data-[state=on]:border-accent data-[state=on]:bg-accent data-[state=on]:text-white"
title="Italic (⌘I)"
- @click="toggleItalic"
>
<icon-lucide-italic class="size-3.5" />
- </button>
- <button
- class="flex cursor-pointer items-center justify-center rounded border px-2 py-1"
- :class="
- node.textDecoration === 'UNDERLINE'
- ? 'border-accent bg-accent text-white'
- : 'border-border bg-input text-muted hover:bg-hover hover:text-surface'
- "
+ </ToggleGroupItem>
+ <ToggleGroupItem
+ value="underline"
+ class="flex cursor-pointer items-center justify-center rounded border border-border bg-input px-2 py-1 text-muted hover:bg-hover hover:text-surface data-[state=on]:border-accent data-[state=on]:bg-accent data-[state=on]:text-white"
title="Underline (⌘U)"
- @click="toggleDecoration('UNDERLINE')"
>
<icon-lucide-underline class="size-3.5" />
- </button>
- <button
- class="flex cursor-pointer items-center justify-center rounded border px-2 py-1"
- :class="
- node.textDecoration === 'STRIKETHROUGH'
- ? 'border-accent bg-accent text-white'
- : 'border-border bg-input text-muted hover:bg-hover hover:text-surface'
- "
+ </ToggleGroupItem>
+ <ToggleGroupItem
+ value="strikethrough"
+ class="flex cursor-pointer items-center justify-center rounded border border-border bg-input px-2 py-1 text-muted hover:bg-hover hover:text-surface data-[state=on]:border-accent data-[state=on]:bg-accent data-[state=on]:text-white"
title="Strikethrough"
- @click="toggleDecoration('STRIKETHROUGH')"
>
<icon-lucide-strikethrough class="size-3.5" />
- </button>
- </div>
+ </ToggleGroupItem>
+ </ToggleGroupRoot>
</div>
</div>
</template>
diff --git a/src/views/EditorView.vue b/src/views/EditorView.vue
index 6bd2e3441..729474f0b 100644
--- a/src/views/EditorView.vue
+++ b/src/views/EditorView.vue
@@ -3,7 +3,7 @@ import { onMounted, onUnmounted, provide, ref } from 'vue'
import { useBreakpoints, useEventListener, useUrlSearchParams } from '@vueuse/core'
import { useRoute } from 'vue-router'
import { useHead } from '@unhead/vue'
-import { SplitterGroup, SplitterPanel, SplitterResizeHandle } from 'reka-ui'
+import { SplitterGroup, SplitterPanel, SplitterResizeHandle, TooltipProvider } from 'reka-ui'
import { useKeyboard } from '@/composables/use-keyboard'
import { useMenu } from '@/composables/use-menu'
@@ -75,93 +75,95 @@ onUnmounted(() => {
</script>
<template>
- <div data-test-id="editor-root" class="flex h-screen w-screen flex-col">
- <SafariBanner />
- <TabBar />
-
- <!-- Desktop layout -->
- <SplitterGroup
- v-if="!isMobile && showChrome && store.state.showUI"
- :key="activeTab?.id"
- direction="horizontal"
- class="flex-1 overflow-hidden"
- auto-save-id="editor-layout"
- >
- <SplitterPanel :default-size="18" :min-size="10" :max-size="30" class="flex">
- <LayersPanel />
- </SplitterPanel>
- <SplitterResizeHandle
- data-test-id="left-splitter-handle"
- class="group relative z-10 -mx-1 w-2 cursor-col-resize"
+ <TooltipProvider :delay-duration="400">
+ <div data-test-id="editor-root" class="flex h-screen w-screen flex-col">
+ <SafariBanner />
+ <TabBar />
+
+ <!-- Desktop layout -->
+ <SplitterGroup
+ v-if="!isMobile && showChrome && store.state.showUI"
+ :key="activeTab?.id"
+ direction="horizontal"
+ class="flex-1 overflow-hidden"
+ auto-save-id="editor-layout"
+ >
+ <SplitterPanel :default-size="18" :min-size="10" :max-size="30" class="flex">
+ <LayersPanel />
+ </SplitterPanel>
+ <SplitterResizeHandle
+ data-test-id="left-splitter-handle"
+ class="group relative z-10 -mx-1 w-2 cursor-col-resize"
+ >
+ <div class="pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2" />
+ </SplitterResizeHandle>
+ <SplitterPanel :default-size="64" :min-size="30" class="flex">
+ <div class="relative flex min-w-0 flex-1">
+ <EditorCanvas />
+ <Toolbar />
+ </div>
+ </SplitterPanel>
+ <SplitterResizeHandle class="group relative z-10 -mx-1 w-2 cursor-col-resize">
+ <div class="pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2" />
+ </SplitterResizeHandle>
+ <SplitterPanel :default-size="18" :min-size="10" :max-size="30" class="flex flex-col">
+ <div
+ class="flex shrink-0 items-center justify-between border-b border-border px-1.5 py-1.5"
+ >
+ <CollabPanel />
+ </div>
+ <PropertiesPanel />
+ </SplitterPanel>
+ </SplitterGroup>
+
+ <!-- Mobile layout -->
+ <div
+ v-else-if="isMobile && showChrome && store.state.showUI"
+ :key="'mobile-' + activeTab?.id"
+ class="flex flex-1 overflow-hidden"
>
- <div class="pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2" />
- </SplitterResizeHandle>
- <SplitterPanel :default-size="64" :min-size="30" class="flex">
<div class="relative flex min-w-0 flex-1">
<EditorCanvas />
+ <MobileHud />
<Toolbar />
</div>
- </SplitterPanel>
- <SplitterResizeHandle class="group relative z-10 -mx-1 w-2 cursor-col-resize">
- <div class="pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2" />
- </SplitterResizeHandle>
- <SplitterPanel :default-size="18" :min-size="10" :max-size="30" class="flex flex-col">
- <div
- class="flex shrink-0 items-center justify-between border-b border-border px-1.5 py-1.5"
- >
- <CollabPanel />
- </div>
- <PropertiesPanel />
- </SplitterPanel>
- </SplitterGroup>
-
- <!-- Mobile layout -->
- <div
- v-else-if="isMobile && showChrome && store.state.showUI"
- :key="'mobile-' + activeTab?.id"
- class="flex flex-1 overflow-hidden"
- >
- <div class="relative flex min-w-0 flex-1">
- <EditorCanvas />
- <MobileHud />
- <Toolbar />
+ <MobileDrawer />
</div>
- <MobileDrawer />
- </div>
- <!-- Collapsed UI (showUI=false) -->
- <div
- v-else-if="showChrome"
- :key="'collapsed-' + activeTab?.id"
- class="flex flex-1 overflow-hidden"
- >
- <div class="relative flex min-w-0 flex-1">
- <EditorCanvas />
- <div
- v-if="!isMobile"
- class="absolute top-7 left-7 z-10 flex items-center gap-2 rounded-lg border border-border bg-panel px-2 py-1 shadow-sm"
- >
- <img src="/favicon-32.png" class="size-4" alt="OpenPencil" />
- <span data-test-id="editor-document-name" class="text-xs text-surface">{{
- store.state.documentName
- }}</span>
- <button
- data-test-id="editor-show-ui"
- class="ml-1 flex size-6 cursor-pointer items-center justify-center rounded text-muted transition-colors hover:bg-hover hover:text-surface"
- title="Show UI (⌘\)"
- @click="store.state.showUI = true"
+ <!-- Collapsed UI (showUI=false) -->
+ <div
+ v-else-if="showChrome"
+ :key="'collapsed-' + activeTab?.id"
+ class="flex flex-1 overflow-hidden"
+ >
+ <div class="relative flex min-w-0 flex-1">
+ <EditorCanvas />
+ <div
+ v-if="!isMobile"
+ class="absolute top-7 left-7 z-10 flex items-center gap-2 rounded-lg border border-border bg-panel px-2 py-1 shadow-sm"
>
- <icon-lucide-sidebar class="size-3.5" />
- </button>
+ <img src="/favicon-32.png" class="size-4" alt="OpenPencil" />
+ <span data-test-id="editor-document-name" class="text-xs text-surface">{{
+ store.state.documentName
+ }}</span>
+ <button
+ data-test-id="editor-show-ui"
+ class="ml-1 flex size-6 cursor-pointer items-center justify-center rounded text-muted transition-colors hover:bg-hover hover:text-surface"
+ title="Show UI (⌘\)"
+ @click="store.state.showUI = true"
+ >
+ <icon-lucide-sidebar class="size-3.5" />
+ </button>
+ </div>
</div>
</div>
- </div>
- <!-- Bare canvas (no chrome, e.g. ?no-chrome) -->
- <div v-else :key="'bare-' + activeTab?.id" class="flex flex-1 overflow-hidden">
- <div class="relative flex min-w-0 flex-1">
- <EditorCanvas />
+ <!-- Bare canvas (no chrome, e.g. ?no-chrome) -->
+ <div v-else :key="'bare-' + activeTab?.id" class="flex flex-1 overflow-hidden">
+ <div class="relative flex min-w-0 flex-1">
+ <EditorCanvas />
+ </div>
</div>
</div>
- </div>
+ </TooltipProvider>
</template>