From 267f251f8a5f0ed47e20595231eb8f3a8b021b54 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Tue, 17 Mar 2026 10:38:40 +0300 Subject: [PATCH] Phase 7: Migrate 10 components from useEditorStore to useEditor Components now using useEditor() from SDK instead of app's useEditorStore(): - CodePanel, DesignPanel, ImageFillPicker, LayerTree, PagesPanel, PropertiesPanel, VariablesDialog, FillSection, PageSection, VariablesSection 7 components remain on useEditorStore for app-specific methods: - AppMenu, Toolbar, MobileHud (saveFigFile, exportSelection, mobile*) - CanvasMenu (renderExportImage) - EditorCanvas (cursorCanvasX/Y app state) - MobileDrawer (mobileDrawerSnap app state) - ExportSection (exportSelection, renderExportImage) --- src/components/CodePanel.vue | 4 ++-- src/components/DesignPanel.vue | 8 ++++---- src/components/ImageFillPicker.vue | 4 ++-- src/components/LayerTree.vue | 12 ++++++++---- src/components/PagesPanel.vue | 5 ++--- src/components/PropertiesPanel.vue | 4 ++-- src/components/VariablesDialog.vue | 4 ++-- src/components/properties/FillSection.vue | 5 ++--- src/components/properties/PageSection.vue | 4 ++-- src/components/properties/VariablesSection.vue | 4 ++-- 10 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/components/CodePanel.vue b/src/components/CodePanel.vue index 48f91dcd6..6476a2f59 100644 --- a/src/components/CodePanel.vue +++ b/src/components/CodePanel.vue @@ -5,11 +5,11 @@ import { ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewpor import { computed, ref, watch } from 'vue' import { selectionToJSX } from '@open-pencil/core' -import { useEditorStore } from '@/stores/editor' +import { useEditor } from '@open-pencil/vue' import type { JSXFormat } from '@open-pencil/core' -const store = useEditorStore() +const store = useEditor() const copied = ref(false) const jsxFormat = ref('openpencil') diff --git a/src/components/DesignPanel.vue b/src/components/DesignPanel.vue index 62f02836c..a174ca227 100644 --- a/src/components/DesignPanel.vue +++ b/src/components/DesignPanel.vue @@ -1,7 +1,7 @@ diff --git a/src/components/VariablesDialog.vue b/src/components/VariablesDialog.vue index c5ae5cfad..d8baf6da3 100644 --- a/src/components/VariablesDialog.vue +++ b/src/components/VariablesDialog.vue @@ -25,11 +25,11 @@ import IconToggleLeft from '~icons/lucide/toggle-left' import IconX from '~icons/lucide/x' import ColorInput from './ColorInput.vue' import { colorToHexRaw, parseColor, randomHex } from '@open-pencil/core' -import { useEditorStore } from '@/stores/editor' +import { useEditor } from '@open-pencil/vue' import type { Variable, VariableCollection, VariableValue, Color } from '@open-pencil/core' const open = defineModel('open', { default: false }) -const store = useEditorStore() +const store = useEditor() const searchTerm = ref('') const collections = computed(() => { diff --git a/src/components/properties/FillSection.vue b/src/components/properties/FillSection.vue index 85bc1a69c..08631b8e5 100644 --- a/src/components/properties/FillSection.vue +++ b/src/components/properties/FillSection.vue @@ -15,14 +15,13 @@ import { import FillPicker from '@/components/FillPicker.vue' import ScrubInput from '@/components/ScrubInput.vue' -import { PropertyListRoot } from '@open-pencil/vue' -import { useEditorStore } from '@/stores/editor' +import { PropertyListRoot, useEditor } from '@open-pencil/vue' import { DEFAULT_SHAPE_FILL } from '@/constants' import { colorToCSS, colorToHexRaw } from '@open-pencil/core' import type { Fill, Variable } from '@open-pencil/core' -const store = useEditorStore() +const store = useEditor() const colorVariables = computed(() => store.graph.getVariablesByType('COLOR')) diff --git a/src/components/properties/PageSection.vue b/src/components/properties/PageSection.vue index a496b1802..ca7ef34ef 100644 --- a/src/components/properties/PageSection.vue +++ b/src/components/properties/PageSection.vue @@ -1,10 +1,10 @@