Skip to content

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

style: format imports

Danila Poyarkovddb1db8175bf
diff --git a/packages/core/src/clipboard.ts b/packages/core/src/clipboard.ts
index ff723fb66..c4a5158c3 100644
--- a/packages/core/src/clipboard.ts
+++ b/packages/core/src/clipboard.ts
@@ -274,12 +274,7 @@ export function importClipboardNodes(
remapComponentIds(created, graph)
- populateAndApplyOverrides(
- graph,
- guidMap as Map<string, InstanceNodeChange>,
- created,
- blobs
- )
+ populateAndApplyOverrides(graph, guidMap as Map<string, InstanceNodeChange>, created, blobs)
for (const figmaId of internalTopLevel) {
const ourId = created.get(figmaId)
diff --git a/packages/core/src/text/fonts.ts b/packages/core/src/text/fonts.ts
index 97faf01cc..fe1433cfb 100644
--- a/packages/core/src/text/fonts.ts
+++ b/packages/core/src/text/fonts.ts
@@ -1,8 +1,4 @@
-import {
- DEFAULT_FONT_FAMILY,
- IS_BROWSER,
- GOOGLE_FONTS_API_KEY
-} from '#core/constants'
+import { DEFAULT_FONT_FAMILY, IS_BROWSER, GOOGLE_FONTS_API_KEY } from '#core/constants'
import { fontFallbackEntry } from '#core/text/fallbacks'
import type { SceneGraph } from '#core/scene-graph'
@@ -300,7 +296,8 @@ export class FontManager {
const result: Record<FontFallbackScript, string[]> = { cjk: [], arabic: [] }
await Promise.all(
scripts.map(async (script) => {
- result[script] = script === 'cjk' ? await this.ensureCJKFallback() : await this.ensureArabicFallback()
+ result[script] =
+ script === 'cjk' ? await this.ensureCJKFallback() : await this.ensureArabicFallback()
})
)
return result
@@ -357,7 +354,11 @@ export class FontManager {
}
}
- private async writeDownloadedFont(family: string, style: string, data: ArrayBuffer): Promise<void> {
+ private async writeDownloadedFont(
+ family: string,
+ style: string,
+ data: ArrayBuffer
+ ): Promise<void> {
if (!this.downloadedFontCache) return
try {
await this.downloadedFontCache.write(family, style, data)
@@ -446,11 +447,7 @@ export class FontManager {
}
}
- private registerAndCache(
- family: string,
- style: string,
- buffer: ArrayBuffer
- ): ArrayBuffer | null {
+ private registerAndCache(family: string, style: string, buffer: ArrayBuffer): ArrayBuffer | null {
this.loadedFamilies.set(`${family}|${style}`, buffer)
this.registerFontInCanvasKit(family, buffer)
this.registerFontInBrowser(family, style, buffer)
diff --git a/packages/vue/src/primitives/ColorPicker/ColorInputRoot.vue b/packages/vue/src/primitives/ColorPicker/ColorInputRoot.vue
index 8c6e7e84d..341fe68e4 100644
--- a/packages/vue/src/primitives/ColorPicker/ColorInputRoot.vue
+++ b/packages/vue/src/primitives/ColorPicker/ColorInputRoot.vue
@@ -31,11 +31,5 @@ const actions = {
</script>
<template>
- <slot
- :color="color"
- :editable="editable"
- :hex="hex"
- :actions="actions"
- :okhcl="okhcl"
- />
+ <slot :color="color" :editable="editable" :hex="hex" :actions="actions" :okhcl="okhcl" />
</template>
diff --git a/src/app/automation/bridge/file-handlers.ts b/src/app/automation/bridge/file-handlers.ts
index 0bf5a5a79..aa1aa4514 100644
--- a/src/app/automation/bridge/file-handlers.ts
+++ b/src/app/automation/bridge/file-handlers.ts
@@ -1,6 +1,6 @@
import { openFileFromPath } from '@/app/shell/menu/use'
-import { isTauri } from '@/app/tauri/env'
import { createTab, openFileInNewTab } from '@/app/tabs'
+import { isTauri } from '@/app/tauri/env'
import type { EditorStore } from '@/app/editor/active-store'
diff --git a/src/app/document/io/reload-source.ts b/src/app/document/io/reload-source.ts
index 0191d0438..5e0881717 100644
--- a/src/app/document/io/reload-source.ts
+++ b/src/app/document/io/reload-source.ts
@@ -1,6 +1,5 @@
-import { readFigFile } from '@open-pencil/core/io/formats/fig'
-
import { isTauri } from '@/app/tauri/env'
+import { readFigFile } from '@open-pencil/core/io/formats/fig'
export type ReloadSourceOptions = {
documentName: string
diff --git a/src/app/document/io/write.ts b/src/app/document/io/write.ts
index 776623084..5bed09c61 100644
--- a/src/app/document/io/write.ts
+++ b/src/app/document/io/write.ts
@@ -1,7 +1,7 @@
-import type { EditorState } from '@open-pencil/core/editor'
-
import { isTauri } from '@/app/tauri/env'
+import type { EditorState } from '@open-pencil/core/editor'
+
type WriteDocumentState = EditorState
type DocumentWriterOptions = {
diff --git a/src/app/editor/fonts/cache.ts b/src/app/editor/fonts/cache.ts
index d8740113c..8cf5b1168 100644
--- a/src/app/editor/fonts/cache.ts
+++ b/src/app/editor/fonts/cache.ts
@@ -67,7 +67,9 @@ async function writeManifest(manifest: FontCacheManifest) {
export async function downloadedFontCacheSummary(): Promise<DownloadedFontCacheSummary> {
const manifest = await readManifest()
- const entries = Object.values(manifest.entries).filter((entry): entry is FontCacheEntry => !!entry)
+ const entries = Object.values(manifest.entries).filter(
+ (entry): entry is FontCacheEntry => !!entry
+ )
return {
count: entries.length,
byteLength: entries.reduce((sum, entry) => sum + entry.byteLength, 0),
@@ -92,7 +94,9 @@ export function createTauriDownloadedFontCache(): DownloadedFontCache {
const entry = manifest.entries[await cacheKey(family, style)]
if (!entry) return null
- const data = await readFile(`${CACHE_DIR}/${entry.file}`, { baseDir: BaseDirectory.AppLocalData })
+ const data = await readFile(`${CACHE_DIR}/${entry.file}`, {
+ baseDir: BaseDirectory.AppLocalData
+ })
const buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)
if (buffer.byteLength !== entry.byteLength) return null
if ((await hashBytes(buffer)) !== entry.sha256) return null
diff --git a/src/app/editor/fonts/index.ts b/src/app/editor/fonts/index.ts
index 1d59945c3..8771dfeb5 100644
--- a/src/app/editor/fonts/index.ts
+++ b/src/app/editor/fonts/index.ts
@@ -1,11 +1,10 @@
-import { fontManager, styleToWeight, type LocalFontAccessState } from '@open-pencil/core/text'
-
import {
clearDownloadedFontCache as clearTauriDownloadedFontCache,
createTauriDownloadedFontCache,
downloadedFontCacheSummary as tauriDownloadedFontCacheSummary
} from '@/app/editor/fonts/cache'
import { isTauri } from '@/app/tauri/env'
+import { fontManager, styleToWeight, type LocalFontAccessState } from '@open-pencil/core/text'
if (typeof navigator !== 'undefined') {
fontManager.setFallbackUserAgent(navigator.userAgent)
diff --git a/src/app/shell/menu/use.ts b/src/app/shell/menu/use.ts
index d851ce5e7..3123e7f20 100644
--- a/src/app/shell/menu/use.ts
+++ b/src/app/shell/menu/use.ts
@@ -4,8 +4,8 @@ import { useEditorStore } from '@/app/editor/active-store'
import { importFileDialog, openFileDialog } from '@/app/shell/menu/files'
import { useAppTheme } from '@/app/shell/theme'
import { checkForAppUpdate } from '@/app/shell/updater'
-import { isTauri } from '@/app/tauri/env'
import { createTab, closeTab, activeTab } from '@/app/tabs'
+import { isTauri } from '@/app/tauri/env'
import { useEditorCommands, useI18n } from '@open-pencil/vue'
import type { EditorCommandId } from '@open-pencil/vue'
diff --git a/src/components/FillPicker.vue b/src/components/FillPicker.vue
index f7583b65c..7286c1210 100644
--- a/src/components/FillPicker.vue
+++ b/src/components/FillPicker.vue
@@ -90,9 +90,17 @@ const { panels } = useI18n()
@update="emit('update', applySolidFillColor(currentFill, $event))"
/>
- <GradientEditor v-if="category === 'GRADIENT'" :fill="currentFill" @update="emit('update', $event)" />
+ <GradientEditor
+ v-if="category === 'GRADIENT'"
+ :fill="currentFill"
+ @update="emit('update', $event)"
+ />
- <ImageFillPicker v-if="category === 'IMAGE'" :fill="currentFill" @update="emit('update', $event)" />
+ <ImageFillPicker
+ v-if="category === 'IMAGE'"
+ :fill="currentFill"
+ @update="emit('update', $event)"
+ />
</template>
</FillPickerRoot>
</template>
diff --git a/src/components/FontPicker.vue b/src/components/FontPicker.vue
index 0105bae96..156fe594f 100644
--- a/src/components/FontPicker.vue
+++ b/src/components/FontPicker.vue
@@ -23,7 +23,8 @@ const ui = computed<FontPickerUi>(() => ({
trigger: selectCls.trigger,
content: cls.content,
item: selectCls.item,
- search: 'w-full border-b border-border bg-transparent px-2 py-1 text-xs text-surface outline-none placeholder:text-muted',
+ search:
+ 'w-full border-b border-border bg-transparent px-2 py-1 text-xs text-surface outline-none placeholder:text-muted',
empty: 'px-2 py-3 text-center text-xs text-muted',
emptyAction: 'mt-2 rounded bg-accent px-2 py-1 text-xs font-medium text-white disabled:opacity-50'
}))
@@ -51,8 +52,6 @@ const localFontAccess = {
</button>
</template>
-
-
<template #item="{ family, selected }">
<div
data-test-id="font-picker-item"
diff --git a/src/components/FontSettings/FontSettingsPopover.vue b/src/components/FontSettings/FontSettingsPopover.vue
index 5f81640e6..23020f169 100644
--- a/src/components/FontSettings/FontSettingsPopover.vue
+++ b/src/components/FontSettings/FontSettingsPopover.vue
@@ -7,11 +7,17 @@ import { useButtonUI } from '@/components/ui/button'
import { usePopoverUI } from '@/components/ui/popover'
const cls = usePopoverUI({ content: 'isolate z-[51] w-80 p-3' })
-const trigger = useButtonUI({ tone: 'ghost', size: 'iconSm', ui: { base: 'shrink-0 border border-border bg-input' } })
+const trigger = useButtonUI({
+ tone: 'ghost',
+ size: 'iconSm',
+ ui: { base: 'shrink-0 border border-border bg-input' }
+})
const secondaryButton = useButtonUI({
tone: 'ghost',
size: 'sm',
- ui: { base: 'w-full bg-input px-2 py-1.5 text-[10px] font-medium text-surface hover:bg-hover disabled:opacity-50' }
+ ui: {
+ base: 'w-full bg-input px-2 py-1.5 text-[10px] font-medium text-surface hover:bg-hover disabled:opacity-50'
+ }
})
const primaryButton = useButtonUI({
tone: 'accent',
@@ -40,7 +46,11 @@ onMounted(() => {
<template>
<PopoverRoot @update:open="$event && refreshSummary()">
- <PopoverTrigger data-test-id="font-settings-trigger" :class="trigger.base" title="Font settings">
+ <PopoverTrigger
+ data-test-id="font-settings-trigger"
+ :class="trigger.base"
+ title="Font settings"
+ >
<icon-lucide-settings class="size-3.5" />
</PopoverTrigger>
@@ -55,7 +65,9 @@ onMounted(() => {
>
<div class="flex flex-col gap-3">
<div class="flex items-start gap-2">
- <div class="flex size-8 shrink-0 items-center justify-center rounded bg-input text-muted">
+ <div
+ class="flex size-8 shrink-0 items-center justify-center rounded bg-input text-muted"
+ >
<icon-lucide-type class="size-4" />
</div>
<div>
@@ -144,7 +156,10 @@ onMounted(() => {
</button>
</div>
- <p v-if="status" class="rounded bg-input px-2 py-1.5 text-[10px] leading-relaxed text-muted">
+ <p
+ v-if="status"
+ class="rounded bg-input px-2 py-1.5 text-[10px] leading-relaxed text-muted"
+ >
{{ status }}
</p>
</div>
diff --git a/src/components/FontSettings/use.ts b/src/components/FontSettings/use.ts
index 207c503eb..d5fcf1659 100644
--- a/src/components/FontSettings/use.ts
+++ b/src/components/FontSettings/use.ts
@@ -59,8 +59,8 @@ export function useFontSettings(actions: FontSettingsActions = defaultActions) {
return new Date(cacheUpdatedAt.value).toLocaleDateString()
})
- const canRequestLocalFonts = computed(() =>
- accessState.value === 'prompt' || accessState.value === 'denied'
+ const canRequestLocalFonts = computed(
+ () => accessState.value === 'prompt' || accessState.value === 'denied'
)
async function refreshSummary() {
diff --git a/src/components/LayerTree.vue b/src/components/LayerTree.vue
index faa250972..4778eba6a 100644
--- a/src/components/LayerTree.vue
+++ b/src/components/LayerTree.vue
@@ -65,12 +65,7 @@ function onTreeSelect(e: CustomEvent, select: (additive: boolean) => void) {
<LayerTreeItem
v-for="item in flattenItems"
:key="item._id"
- v-slot="{
- node,
- isSelected,
- padLeft,
- actions
- }"
+ v-slot="{ node, isSelected, padLeft, actions }"
:node="item.value"
:level="item.level"
:has-children="item.hasChildren"
diff --git a/src/components/ScrubInput.vue b/src/components/ScrubInput.vue
index a8d2d4051..e87c00add 100644
--- a/src/components/ScrubInput.vue
+++ b/src/components/ScrubInput.vue
@@ -50,7 +50,9 @@ defineOptions({ inheritAttrs: false })
]"
:style="{ cursor: editing ? 'auto' : 'ew-resize' }"
@pointerdown="
- !editing && !($event.target as HTMLElement)?.closest?.('button') && actions.startScrub($event)
+ !editing &&
+ !($event.target as HTMLElement)?.closest?.('button') &&
+ actions.startScrub($event)
"
@focus="!editing && actions.startEdit()"
>
diff --git a/src/components/Toolbar/DesktopToolbar.vue b/src/components/Toolbar/DesktopToolbar.vue
index 3e941d5aa..03dda3374 100644
--- a/src/components/Toolbar/DesktopToolbar.vue
+++ b/src/components/Toolbar/DesktopToolbar.vue
@@ -9,9 +9,9 @@ import type { EditorToolDef } from '@open-pencil/core/editor'
import type { ToolbarUi, ToolIconMap, ToolLabels } from '@/components/Toolbar/types'
const { tools, activeTool, toolIcons, toolLabels, toolShortcuts, ui } = defineProps<{
- tools: EditorToolDef[]
- activeTool: Tool
- toolIcons: ToolIconMap
+ tools: EditorToolDef[]
+ activeTool: Tool
+ toolIcons: ToolIconMap
toolLabels: ToolLabels
toolShortcuts: Record<Tool, string>
ui?: ToolbarUi
diff --git a/src/components/Toolbar/MobileToolbar.vue b/src/components/Toolbar/MobileToolbar.vue
index 812da8bb5..4b72a193b 100644
--- a/src/components/Toolbar/MobileToolbar.vue
+++ b/src/components/Toolbar/MobileToolbar.vue
@@ -11,7 +11,12 @@ import { ToolbarItem } from '@open-pencil/vue'
import type { Tool } from '@open-pencil/vue'
import type { EditorToolDef } from '@open-pencil/core/editor'
-import type { ToolbarActionItem, ToolbarUi, ToolIconMap, ToolLabels } from '@/components/Toolbar/types'
+import type {
+ ToolbarActionItem,
+ ToolbarUi,
+ ToolIconMap,
+ ToolLabels
+} from '@/components/Toolbar/types'
const {
tools,
diff --git a/src/components/VariablesDialog.vue b/src/components/VariablesDialog.vue
index 90118e5d1..634f586a5 100644
--- a/src/components/VariablesDialog.vue
+++ b/src/components/VariablesDialog.vue
@@ -239,7 +239,9 @@ watch(collectionInput, (input) => {
</table>
</div>
- <div class="flex w-full shrink-0 items-center justify-between gap-2 border-t border-border px-4 py-2">
+ <div
+ class="flex w-full shrink-0 items-center justify-between gap-2 border-t border-border px-4 py-2"
+ >
<span class="text-xs text-muted">{{ panels.createVariable }}</span>
<DropdownMenuRoot>
<DropdownMenuTrigger as-child>
@@ -253,7 +255,12 @@ watch(collectionInput, (input) => {
</button>
</DropdownMenuTrigger>
<DropdownMenuPortal>
- <DropdownMenuContent side="top" :side-offset="8" align="end" :class="menuCls.content">
+ <DropdownMenuContent
+ side="top"
+ :side-offset="8"
+ align="end"
+ :class="menuCls.content"
+ >
<DropdownMenuItem
v-for="item in variableTypes"
:key="item.type"
@@ -264,7 +271,9 @@ watch(collectionInput, (input) => {
<component :is="variableTypeIcons[item.type]" :class="menuCls.icon" />
<span class="flex min-w-0 flex-1 flex-col">
<span>{{ item.label() }}</span>
- <span class="truncate text-[10px] text-muted">{{ item.description() }}</span>
+ <span class="truncate text-[10px] text-muted">{{
+ item.description()
+ }}</span>
</span>
</DropdownMenuItem>
</DropdownMenuContent>
diff --git a/src/components/properties/EffectsSection.vue b/src/components/properties/EffectsSection.vue
index d361e6560..6a591be7f 100644
--- a/src/components/properties/EffectsSection.vue
+++ b/src/components/properties/EffectsSection.vue
@@ -77,7 +77,10 @@ const sectionCls = useSectionUI()
/>
<icon-lucide-eye-off v-else data-test-id="visibility-icon-off" class="size-3.5" />
</button>
- <button :class="useIconButtonUI().base" @click="effectsCtx.handleRemove(actions.remove, i)">
+ <button
+ :class="useIconButtonUI().base"
+ @click="effectsCtx.handleRemove(actions.remove, i)"
+ >
−
</button>
</div>
diff --git a/src/components/properties/PositionSection.vue b/src/components/properties/PositionSection.vue
index d86261cbc..8f74b81dc 100644
--- a/src/components/properties/PositionSection.vue
+++ b/src/components/properties/PositionSection.vue
@@ -26,16 +26,7 @@ function handleAlign(
<template>
<PositionControlsRoot
- v-slot="{
- active,
- isMulti,
- xValue,
- yValue,
- wValue,
- hValue,
- rotationValue,
- actions
- }"
+ v-slot="{ active, isMulti, xValue, yValue, wValue, hValue, rotationValue, actions }"
>
<div v-if="active" data-test-id="position-section" :class="sectionCls.wrapper">
<label class="mb-1.5 block text-[11px] text-muted">{{ panels.position }}</label>