Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions app/components/ControlDimensions.vue
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
<template>
<div class="grid grid-cols-2 gap-2">
<div class="relative min-w-0">
<Label
:for="`${id}-width`"
class="text-ui-muted absolute inset-y-0 left-2 z-10 flex items-center text-[11px]"
>
W
</Label>
<InputAddon :icon="MoveHorizontalIcon">
<Input
:id="`${id}-width`"
aria-label="Canvas width"
title="Canvas width"
type="number"
min="1"
max="5000"
class="h-8 pl-7 tabular-nums"
class="h-8 tabular-nums"
:model-value="width"
:disabled="lockWindowSize"
@update:model-value="$emit('update:width', $event)"
/>
</div>
<div class="relative min-w-0">
<Label
:for="`${id}-height`"
class="text-ui-muted absolute inset-y-0 left-2 z-10 flex items-center text-[11px]"
>
H
</Label>
</InputAddon>
<InputAddon :icon="MoveVerticalIcon">
<Input
:id="`${id}-height`"
aria-label="Canvas height"
title="Canvas height"
type="number"
min="1"
max="5000"
class="h-8 pl-7 tabular-nums"
class="h-8 tabular-nums"
:model-value="height"
:disabled="lockWindowSize"
@update:model-value="$emit('update:height', $event)"
/>
</div>
</InputAddon>
</div>
</template>

<script setup>
import { MoveHorizontalIcon, MoveVerticalIcon } from 'lucide-vue-next';
import { useId } from 'vue';

defineProps({
Expand Down
32 changes: 20 additions & 12 deletions app/components/ControlFitToWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,28 @@
</div>
<div class="property-fields">
<PropertyField label="Horizontal" v-slot="{ id }">
<Input
:id="id"
type="number"
:model-value="lockWindowPaddingX"
@update:model-value="$emit('update:lock-window-padding-x', Number($event))"
/>
<InputAddon :icon="MoveHorizontalIcon">
<Input
:id="id"
type="number"
:model-value="lockWindowPaddingX"
@update:model-value="
$emit('update:lock-window-padding-x', Number($event))
"
/>
</InputAddon>
</PropertyField>
<PropertyField label="Vertical" v-slot="{ id }">
<Input
:id="id"
type="number"
:model-value="lockWindowPaddingY"
@update:model-value="$emit('update:lock-window-padding-y', Number($event))"
/>
<InputAddon :icon="MoveVerticalIcon">
<Input
:id="id"
type="number"
:model-value="lockWindowPaddingY"
@update:model-value="
$emit('update:lock-window-padding-y', Number($event))
"
/>
</InputAddon>
</PropertyField>
</div>
</PopoverPanel>
Expand Down
19 changes: 19 additions & 0 deletions app/components/InputAddon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<span :class="cn('relative block w-full min-w-0 [&_input]:pl-7', props.class)">
<slot />
<component
:is="icon"
aria-hidden="true"
class="text-ui-muted pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 [input:disabled+&]:opacity-50"
/>
</span>
</template>

<script setup>
import { cn } from '@/lib/utils';

const props = defineProps({
icon: { type: [Object, Function], required: true },
class: { type: null, required: false },
});
</script>
146 changes: 91 additions & 55 deletions app/components/ModalPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,29 @@
</SettingsRow>

<SettingsRow label="Size">
<Input
min="1"
type="number"
v-model="preferences.editorFontSize"
class="w-20"
/>
<InputAddon :icon="TypeIcon" class="w-20">
<Input
aria-label="Editor font size"
min="1"
type="number"
v-model="preferences.editorFontSize"
/>
</InputAddon>
</SettingsRow>

<SettingsRow label="Line Height">
<Input
min="1"
step="0.1"
type="number"
v-model="preferences.editorLineHeight"
<InputAddon
:icon="AlignVerticalSpaceBetweenIcon"
class="w-20"
/>
>
<Input
aria-label="Editor line height"
min="1"
step="0.1"
type="number"
v-model="preferences.editorLineHeight"
/>
</InputAddon>
</SettingsRow>

<SettingsRow label="Ligatures">
Expand Down Expand Up @@ -239,31 +246,40 @@
</SettingsRow>

<SettingsRow label="Size">
<Input
min="1"
type="number"
v-model="preferences.previewFontSize"
class="w-20"
/>
<InputAddon :icon="TypeIcon" class="w-20">
<Input
aria-label="Preview font size"
min="1"
type="number"
v-model="preferences.previewFontSize"
/>
</InputAddon>
</SettingsRow>

<SettingsRow label="Line Height">
<Input
min="0"
type="number"
v-model="preferences.previewLineHeight"
<InputAddon
:icon="AlignVerticalSpaceBetweenIcon"
class="w-20"
/>
>
<Input
aria-label="Preview line height"
min="0"
type="number"
v-model="preferences.previewLineHeight"
/>
</InputAddon>
</SettingsRow>
</SettingsSection>

<SettingsSection title="Focus">
<SettingsRow label="Blur Strength">
<Input
type="number"
v-model="preferences.previewCodeBlurStrength"
class="w-20"
/>
<InputAddon :icon="BlendIcon" class="w-20">
<Input
aria-label="Blur strength"
type="number"
v-model="preferences.previewCodeBlurStrength"
/>
</InputAddon>
</SettingsRow>
</SettingsSection>

Expand All @@ -274,17 +290,25 @@

<template v-if="preferences.previewLockToWindow">
<SettingsRow label="Padding X">
<Input
v-model="preferences.previewLockToWindowPaddingX"
class="w-20"
/>
<InputAddon :icon="MoveHorizontalIcon" class="w-20">
<Input
aria-label="Horizontal fit padding"
v-model="
preferences.previewLockToWindowPaddingX
"
/>
</InputAddon>
</SettingsRow>

<SettingsRow label="Padding Y">
<Input
v-model="preferences.previewLockToWindowPaddingY"
class="w-20"
/>
<InputAddon :icon="MoveVerticalIcon" class="w-20">
<Input
aria-label="Vertical fit padding"
v-model="
preferences.previewLockToWindowPaddingY
"
/>
</InputAddon>
</SettingsRow>
</template>
</SettingsSection>
Expand All @@ -295,19 +319,23 @@
description="Add a width and height pair"
>
<div class="flex items-center gap-2">
<Input
min="1"
type="number"
v-model="customAspectRatioWidth"
class="w-16"
/>
<InputAddon :icon="MoveHorizontalIcon" class="w-20">
<Input
aria-label="Aspect ratio width"
min="1"
type="number"
v-model="customAspectRatioWidth"
/>
</InputAddon>
<span class="text-xs text-zinc-400">:</span>
<Input
min="1"
type="number"
v-model="customAspectRatioHeight"
class="w-16"
/>
<InputAddon :icon="MoveVerticalIcon" class="w-20">
<Input
aria-label="Aspect ratio height"
min="1"
type="number"
v-model="customAspectRatioHeight"
/>
</InputAddon>
<Button
size="icon-sm"
:disabled="!canAddCustomAspectRatio"
Expand Down Expand Up @@ -406,10 +434,12 @@
</SettingsRow>

<SettingsRow label="Username">
<Input
v-model="preferences.socialUsername"
class="w-28 sm:w-40"
/>
<InputAddon :icon="AtSignIcon" class="w-28 sm:w-40">
<Input
aria-label="Username"
v-model="preferences.socialUsername"
/>
</InputAddon>
</SettingsRow>

<SettingsRow label="Display Name">
Expand Down Expand Up @@ -509,15 +539,21 @@ import { orderBy } from 'lodash';
import { storeToRefs } from 'pinia';
import Draggable from 'vuedraggable';
import {
AlignVerticalSpaceBetweenIcon,
AtSignIcon,
BlendIcon,
CodeIcon,
EyeIcon,
ShareIcon,
DownloadIcon,
EyeIcon,
MoonIcon,
MoveHorizontalIcon,
MoveVerticalIcon,
PaletteIcon,
PlusIcon,
ShareIcon,
SunIcon,
MoonIcon,
SunriseIcon,
TypeIcon,
XIcon,
} from 'lucide-vue-next';
import useFonts from '@/composables/useFonts';
Expand Down
18 changes: 10 additions & 8 deletions app/components/SearchableSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
>
<div class="flex min-h-0 flex-col overflow-hidden">
<div class="shrink-0 p-1">
<Input
ref="searchInput"
v-model="search"
:placeholder="placeholder"
class="border-0"
@keydown="handleSearchKeydown"
/>
<InputAddon :icon="SearchIcon">
<Input
ref="searchInput"
v-model="search"
:placeholder="placeholder"
class="border-0"
@keydown="handleSearchKeydown"
/>
</InputAddon>
</div>

<div class="ui-menu-separator" role="separator" />
Expand Down Expand Up @@ -77,7 +79,7 @@
</template>

<script setup>
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-vue-next';
import { CheckIcon, ChevronsUpDownIcon, SearchIcon } from 'lucide-vue-next';
import { computed, nextTick, ref, watch } from 'vue';
import { Popover as UiPopover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn, formControlFocusClasses } from '@/lib/utils';
Expand Down
Loading
Loading