Skip to content

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

fix(app): fix variable picker click and layout spacing

Danila Poyarkov7252b450cfff
diff --git a/src/components/ScrubInput.vue b/src/components/ScrubInput.vue
index e0d623414..75859d24b 100644
--- a/src/components/ScrubInput.vue
+++ b/src/components/ScrubInput.vue
@@ -49,7 +49,9 @@ defineOptions({ inheritAttrs: false })
'group flex h-[26px] min-w-0 flex-1 items-center rounded border border-border bg-input focus-within:border-accent focus:border-accent'
]"
:style="{ cursor: editing ? 'auto' : 'ew-resize' }"
- @pointerdown="!editing && !($event.target as HTMLElement)?.closest?.('button') && startScrub($event)"
+ @pointerdown="
+ !editing && !($event.target as HTMLElement)?.closest?.('button') && startScrub($event)
+ "
@focus="!editing && startEdit()"
>
<span v-if="attrs['data-test-id']" data-test-id="scrub-input" class="hidden" />
diff --git a/src/components/properties/LayoutSection/SizeControls.vue b/src/components/properties/LayoutSection/SizeControls.vue
index 479364e78..060d7afe7 100644
--- a/src/components/properties/LayoutSection/SizeControls.vue
+++ b/src/components/properties/LayoutSection/SizeControls.vue
@@ -107,12 +107,6 @@ const heightLimitItems = [
}
]
-function sizingShortLabel(sizing: LayoutSizing): string | null {
- if (sizing === 'HUG') return panels.value.sizingHugShort
- if (sizing === 'FILL') return panels.value.sizingFillShort
- return null
-}
-
function anchorRef(element: HTMLElement | null): HTMLElement | undefined {
return element ?? undefined
}
@@ -204,11 +198,10 @@ function handleSizeSelect(axis: 'width' | 'height', value: SizeSelectValue) {
<SelectTrigger
data-test-id="layout-width-sizing-menu"
:reference="anchorRef(widthFieldRef)"
- class="flex shrink-0 cursor-pointer items-center self-stretch border-none bg-transparent px-1 text-[11px] text-muted outline-none"
+ class="flex shrink-0 cursor-pointer items-center justify-center self-stretch border-none bg-transparent px-1.5 text-[11px] text-muted outline-none"
@pointerdown.stop
>
- <span class="group-hover:hidden">{{ sizingShortLabel(ctx.widthSizing) }}</span>
- <icon-lucide-chevron-down class="hidden size-3 group-hover:block" />
+ <icon-lucide-chevron-down class="size-3" />
</SelectTrigger>
<SelectPortal>
<SelectContent
@@ -287,11 +280,10 @@ function handleSizeSelect(axis: 'width' | 'height', value: SizeSelectValue) {
<SelectTrigger
data-test-id="layout-height-sizing-menu"
:reference="anchorRef(heightFieldRef)"
- class="flex shrink-0 cursor-pointer items-center self-stretch border-none bg-transparent px-1 text-[11px] text-muted outline-none"
+ class="flex shrink-0 cursor-pointer items-center justify-center self-stretch border-none bg-transparent px-1.5 text-[11px] text-muted outline-none"
@pointerdown.stop
>
- <span class="group-hover:hidden">{{ sizingShortLabel(ctx.heightSizing) }}</span>
- <icon-lucide-chevron-down class="hidden size-3 group-hover:block" />
+ <icon-lucide-chevron-down class="size-3" />
</SelectTrigger>
<SelectPortal>
<SelectContent
diff --git a/src/components/properties/VariableScrubInput.vue b/src/components/properties/VariableScrubInput.vue
index 022fb9799..fe2b0f8de 100644
--- a/src/components/properties/VariableScrubInput.vue
+++ b/src/components/properties/VariableScrubInput.vue
@@ -85,28 +85,30 @@ defineOptions({ inheritAttrs: true })
<slot name="icon" />
</template>
<template #suffix>
- <BoundVariableButton
- v-if="binding.getBoundVariable(nodeId)"
- :label="panels.detachVariable"
- @detach="binding.unbindVariable(nodeId)"
- />
- <VariablePickerPopover
- v-else
- v-model:search-term="binding.searchTerm.value"
- :variables="binding.filteredVariables.value"
- :trigger-label="panels.applyVariable"
- :search-placeholder="dialogs.search"
- :empty-label="panels.noVariablesFound"
- :create-label="
- panels.createNumberVariable({
- value: typeof modelValue === 'number' ? Math.round(modelValue) : 0
- })
- "
- :create-name-placeholder="panels.variableName"
- :create-submit-label="panels.create"
- @select="onBind($event.id)"
- @create="onCreate"
- />
+ <span :class="$slots['after-variable'] ? '' : 'pr-1'" class="flex items-center">
+ <BoundVariableButton
+ v-if="binding.getBoundVariable(nodeId)"
+ :label="panels.detachVariable"
+ @detach="binding.unbindVariable(nodeId)"
+ />
+ <VariablePickerPopover
+ v-else
+ v-model:search-term="binding.searchTerm.value"
+ :variables="binding.filteredVariables.value"
+ :trigger-label="panels.applyVariable"
+ :search-placeholder="dialogs.search"
+ :empty-label="panels.noVariablesFound"
+ :create-label="
+ panels.createNumberVariable({
+ value: typeof modelValue === 'number' ? Math.round(modelValue) : 0
+ })
+ "
+ :create-name-placeholder="panels.variableName"
+ :create-submit-label="panels.create"
+ @select="onBind($event.id)"
+ @create="onCreate"
+ />
+ </span>
<slot name="after-variable" />
</template>
</ScrubInput>