From 7f4ad228387f267bd550f0bf9d063e833bafdf19 Mon Sep 17 00:00:00 2001 From: nighca Date: Tue, 10 Feb 2026 15:00:47 +0800 Subject: [PATCH 1/3] Project interface extraction --- spx-gui/src/apis/aigc.ts | 3 +- .../agent-copilot/CopilotProvider.vue | 7 +- .../asset/animation/GroupCostumesModal.vue | 6 +- .../asset/gen/animation/AnimationGenItem.vue | 2 +- .../gen/animation/AnimationGenPreview.vue | 2 +- .../gen/animation/AnimationSettingsInput.vue | 2 +- .../gen/animation/AnimationVideoPreview.vue | 2 +- .../asset/gen/backdrop/BackdropGen.vue | 4 +- .../asset/gen/backdrop/BackdropGenItem.vue | 2 +- .../gen/backdrop/BackdropSettingsInput.vue | 2 +- .../asset/gen/common/GenStateFailed.vue | 2 +- .../asset/gen/common/ImageSelector.vue | 2 +- .../gen/common/ReferenceCostumeInput.vue | 2 +- .../asset/gen/costume/CostumeGenItem.vue | 2 +- .../asset/gen/costume/CostumeGenPreview.vue | 2 +- .../gen/costume/CostumeSettingsInput.vue | 2 +- .../components/asset/gen/sprite/SpriteGen.vue | 4 +- .../asset/gen/sprite/SpriteGenItem.vue | 2 +- .../asset/gen/sprite/SpriteGenModal.vue | 4 +- .../gen/sprite/SpriteGenPhaseContent.vue | 8 +- .../gen/sprite/SpriteGenPhaseSettings.vue | 2 +- .../asset/gen/sprite/SpriteSettingsInput.vue | 2 +- spx-gui/src/components/asset/index.ts | 76 ++++---- .../asset/library/AssetLibraryModal.vue | 25 ++- .../asset/library/AssetSaveModal.vue | 12 +- .../components/asset/library/BackdropItem.vue | 2 +- .../asset/library/BackdropPreview.vue | 4 +- .../components/asset/library/SoundItem.vue | 2 +- .../components/asset/library/SoundPreview.vue | 4 +- .../components/asset/library/SpriteItem.vue | 2 +- .../asset/library/SpritePreview.vue | 4 +- .../library/management/AssetEditModal.vue | 2 +- .../asset/library/management/BackdropItem.vue | 2 +- .../asset/library/management/SoundItem.vue | 2 +- .../asset/library/management/SpriteItem.vue | 2 +- .../asset/preprocessing/PreprocessModal.vue | 2 +- .../remove-background/RemoveBackground.vue | 2 +- .../asset/scratch/LoadFromScratch.vue | 20 +- .../asset/scratch/LoadFromScratchModal.vue | 6 +- .../components/asset/scratch/SpriteItem.vue | 4 +- .../components/common/CostumesAutoPlayer.vue | 2 +- .../src/components/common/CostumesPlayer.vue | 2 +- .../src/components/copilot/CopilotRoot.vue | 13 +- .../copilot/custom-elements/CodeBlock.vue | 2 +- .../copilot/custom-elements/CodeChange.vue | 2 +- .../editor/EditorContextProvider.vue | 6 +- .../src/components/editor/ProjectEditor.vue | 9 +- .../editor/code-editor/FormatButton.vue | 2 +- .../editor/code-editor/code-editor.ts | 14 +- .../components/editor/code-editor/common.ts | 22 +-- .../components/editor/code-editor/context.ts | 6 +- .../editor/code-editor/lsp/index.ts | 6 +- .../editor/code-editor/text-document.ts | 28 +-- .../editor/code-editor/ui/CodeEditorUI.vue | 14 +- .../editor/code-editor/ui/code-editor-ui.ts | 4 +- .../code-editor/ui/diagnostics/index.ts | 2 +- .../ui/document-tab/DocumentTab.vue | 4 +- .../editor/code-editor/ui/inlay-hint/index.ts | 2 +- .../ui/input-helper/InputHelper.vue | 2 +- .../code-editor/ui/input-helper/index.ts | 2 +- .../ui/resource-reference/index.ts | 2 +- .../code-editor/ui/resource/ResourceItem.vue | 14 +- .../ui/resource/resource-selector.ts | 34 ++-- .../editor/code-editor/ui/snippet.ts | 8 +- .../components/editor/common/EditorList.vue | 2 +- .../common/config/sprite/SpriteDirection.vue | 11 +- .../common/config/sprite/SpritePhysics.vue | 11 +- .../config/sprite/SpritePositionSize.vue | 11 +- .../common/config/sprite/SpriteVisible.vue | 11 +- .../components/editor/common/config/utils.ts | 10 +- .../SaveAssetToLibraryMenuItem.vue | 8 +- .../editor/common/viewer/DecoratorNode.vue | 2 +- .../editor/common/viewer/NodeTransformer.vue | 4 +- .../editor/common/viewer/SpriteNode.vue | 6 +- .../components/editor/common/viewer/common.ts | 4 +- .../viewer/quick-config/SpriteQuickConfig.vue | 6 +- .../viewer/quick-config/WidgetQuickConfig.vue | 4 +- .../sprite/DefaultConfigPanel.vue | 11 +- .../sprite/HeadingConfigPanel.vue | 2 +- .../common/viewer/quick-config/utils.ts | 18 +- .../widget/DefaultConfigPanel.vue | 9 +- spx-gui/src/components/editor/editing.test.ts | 173 +++++++++--------- spx-gui/src/components/editor/editing.ts | 83 +++++---- .../components/editor/editor-state.test.ts | 51 +++--- spx-gui/src/components/editor/editor-state.ts | 79 ++++++-- .../editor}/history.test.ts | 10 +- .../project => components/editor}/history.ts | 16 +- .../editor/map-editor/MapBasicConfig.vue | 4 +- .../editor/map-editor/MapEditor.vue | 6 +- .../editor/map-editor/MapLayerSortInput.vue | 11 +- .../editor/map-editor/MapPhysicsInput.vue | 11 +- .../editor/map-editor/MapSizeInput.vue | 15 +- .../editor/map-editor/SpriteBasicConfig.vue | 6 +- .../editor/map-editor/SpritesPanel.vue | 6 +- .../map-editor/map-viewer/MapViewer.vue | 13 +- .../components/editor/navbar/EditorNavbar.vue | 28 +-- .../editor/panels/sound/SoundSummaryItem.vue | 2 +- .../editor/panels/sound/SoundsPanel.vue | 4 +- .../panels/sprite/SpriteSummaryItem.vue | 2 +- .../preview/stage-viewer/StageViewer.vue | 8 +- spx-gui/src/components/editor/runtime.ts | 6 +- .../components/editor/sound/SoundEditor.vue | 4 +- .../src/components/editor/sound/SoundItem.vue | 6 +- .../components/editor/sound/SoundRecorder.vue | 11 +- .../editor/sound/SoundRecorderModal.vue | 6 +- .../editor/sprite/AnimationDetail.vue | 2 +- .../editor/sprite/AnimationEditor.vue | 4 +- .../editor/sprite/AnimationItem.vue | 4 +- .../editor/sprite/AnimationRemoveModal.vue | 11 +- .../editor/sprite/CheckableCostumeItem.vue | 2 +- .../editor/sprite/CostumeDetail.vue | 2 +- .../components/editor/sprite/CostumeItem.vue | 8 +- .../editor/sprite/CostumesEditor.vue | 10 +- .../editor/sprite/SpriteCollisionEditor.vue | 13 +- .../sprite/SpriteCollisionEditorModal.vue | 6 +- .../components/editor/sprite/SpriteEditor.vue | 6 +- .../components/editor/sprite/SpriteItem.vue | 16 +- .../components/editor/sprite/SpriteList.vue | 8 +- .../sprite/animation/AnimationPlayer.vue | 4 +- .../sprite/animation/AnimationSettings.vue | 2 +- .../sprite/animation/DurationEditor.vue | 4 +- .../editor/sprite/animation/SoundEditor.vue | 4 +- .../animation/state/BoundStateEditor.vue | 6 +- .../components/editor/stage/StageEditor.vue | 6 +- .../editor/stage/backdrop/BackdropDetail.vue | 2 +- .../editor/stage/backdrop/BackdropItem.vue | 6 +- .../stage/backdrop/BackdropModeSelector.vue | 4 +- .../editor/stage/backdrop/BackdropsEditor.vue | 8 +- .../editor/stage/widget/WidgetItem.vue | 8 +- .../editor/stage/widget/WidgetsEditor.vue | 4 +- .../stage/widget/detail/MonitorDetail.vue | 4 +- .../stage/widget/detail/WidgetDetail.vue | 4 +- .../components/editor/stage/widget/icon.ts | 4 +- .../components/project/ProjectCreateModal.vue | 10 +- .../project/ProjectPublishModal.vue | 8 +- .../project/ProjectPublishedModal.vue | 4 +- spx-gui/src/components/project/index.ts | 11 +- .../project/runner/ProjectRunner.vue | 8 +- .../project/runner/ProjectRunnerSurface.vue | 4 +- spx-gui/src/models/common/cloud.ts | 37 +++- spx-gui/src/models/common/local.ts | 22 ++- spx-gui/src/models/common/test.ts | 74 ++++---- spx-gui/src/models/common/xbp.test.ts | 18 +- spx-gui/src/models/common/xbp.ts | 16 +- spx-gui/src/models/project.ts | 49 +++++ .../src/models/{ => spx}/animation.test.ts | 10 +- spx-gui/src/models/{ => spx}/animation.ts | 2 +- spx-gui/src/models/{ => spx}/backdrop.test.ts | 2 +- spx-gui/src/models/{ => spx}/backdrop.ts | 2 +- .../{ => spx}/common/asset-name.test.ts | 12 +- .../src/models/{ => spx}/common/asset-name.ts | 0 spx-gui/src/models/{ => spx}/common/asset.ts | 4 +- .../models/{ => spx}/common/resource-model.ts | 0 spx-gui/src/models/spx/common/test.ts | 34 ++++ spx-gui/src/models/{ => spx}/costume.test.ts | 2 +- spx-gui/src/models/{ => spx}/costume.ts | 2 +- spx-gui/src/models/{ => spx}/gen/aigc-mock.ts | 2 +- .../{ => spx}/gen/animation-gen.test.ts | 25 +-- .../src/models/{ => spx}/gen/animation-gen.ts | 10 +- .../models/{ => spx}/gen/backdrop-gen.test.ts | 20 +- .../src/models/{ => spx}/gen/backdrop-gen.ts | 10 +- .../src/models/{ => spx}/gen/common.test.ts | 0 spx-gui/src/models/{ => spx}/gen/common.ts | 8 +- .../models/{ => spx}/gen/costume-gen.test.ts | 18 +- .../src/models/{ => spx}/gen/costume-gen.ts | 10 +- .../models/{ => spx}/gen/sprite-gen.test.ts | 22 +-- .../src/models/{ => spx}/gen/sprite-gen.ts | 14 +- .../index.test.ts => spx/project.test.ts} | 56 +++--- .../{project/index.ts => spx/project.ts} | 132 +++---------- spx-gui/src/models/{ => spx}/sound.test.ts | 6 +- spx-gui/src/models/{ => spx}/sound.ts | 8 +- spx-gui/src/models/{ => spx}/sprite.test.ts | 2 +- spx-gui/src/models/{ => spx}/sprite.ts | 8 +- spx-gui/src/models/{ => spx}/stage.test.ts | 2 +- spx-gui/src/models/{ => spx}/stage.ts | 4 +- spx-gui/src/models/{ => spx}/tilemap.test.ts | 2 +- spx-gui/src/models/{ => spx}/tilemap.ts | 4 +- spx-gui/src/models/{ => spx}/widget/index.ts | 0 .../src/models/{ => spx}/widget/monitor.ts | 0 .../models/{ => spx}/widget/widget.test.ts | 2 +- spx-gui/src/models/{ => spx}/widget/widget.ts | 0 spx-gui/src/pages/community/project.vue | 19 +- spx-gui/src/pages/editor/index.vue | 22 ++- spx-gui/src/utils/project.ts | 6 +- .../src/widgets/spx-runner/SpxRunner.ce.vue | 9 +- 185 files changed, 1138 insertions(+), 908 deletions(-) rename spx-gui/src/{models/project => components/editor}/history.test.ts (96%) rename spx-gui/src/{models/project => components/editor}/history.ts (84%) create mode 100644 spx-gui/src/models/project.ts rename spx-gui/src/models/{ => spx}/animation.test.ts (96%) rename spx-gui/src/models/{ => spx}/animation.ts (99%) rename spx-gui/src/models/{ => spx}/backdrop.test.ts (97%) rename spx-gui/src/models/{ => spx}/backdrop.ts (98%) rename spx-gui/src/models/{ => spx}/common/asset-name.test.ts (91%) rename spx-gui/src/models/{ => spx}/common/asset-name.ts (100%) rename spx-gui/src/models/{ => spx}/common/asset.ts (97%) rename spx-gui/src/models/{ => spx}/common/resource-model.ts (100%) create mode 100644 spx-gui/src/models/spx/common/test.ts rename spx-gui/src/models/{ => spx}/costume.test.ts (97%) rename spx-gui/src/models/{ => spx}/costume.ts (98%) rename spx-gui/src/models/{ => spx}/gen/aigc-mock.ts (99%) rename spx-gui/src/models/{ => spx}/gen/animation-gen.test.ts (95%) rename spx-gui/src/models/{ => spx}/gen/animation-gen.ts (96%) rename spx-gui/src/models/{ => spx}/gen/backdrop-gen.test.ts (94%) rename spx-gui/src/models/{ => spx}/gen/backdrop-gen.ts (93%) rename spx-gui/src/models/{ => spx}/gen/common.test.ts (100%) rename spx-gui/src/models/{ => spx}/gen/common.ts (97%) rename spx-gui/src/models/{ => spx}/gen/costume-gen.test.ts (94%) rename spx-gui/src/models/{ => spx}/gen/costume-gen.ts (95%) rename spx-gui/src/models/{ => spx}/gen/sprite-gen.test.ts (96%) rename spx-gui/src/models/{ => spx}/gen/sprite-gen.ts (97%) rename spx-gui/src/models/{project/index.test.ts => spx/project.test.ts} (83%) rename spx-gui/src/models/{project/index.ts => spx/project.ts} (85%) rename spx-gui/src/models/{ => spx}/sound.test.ts (92%) rename spx-gui/src/models/{ => spx}/sound.ts (97%) rename spx-gui/src/models/{ => spx}/sprite.test.ts (99%) rename spx-gui/src/models/{ => spx}/sprite.ts (99%) rename spx-gui/src/models/{ => spx}/stage.test.ts (99%) rename spx-gui/src/models/{ => spx}/stage.ts (99%) rename spx-gui/src/models/{ => spx}/tilemap.test.ts (98%) rename spx-gui/src/models/{ => spx}/tilemap.ts (99%) rename spx-gui/src/models/{ => spx}/widget/index.ts (100%) rename spx-gui/src/models/{ => spx}/widget/monitor.ts (100%) rename spx-gui/src/models/{ => spx}/widget/widget.test.ts (96%) rename spx-gui/src/models/{ => spx}/widget/widget.ts (100%) diff --git a/spx-gui/src/apis/aigc.ts b/spx-gui/src/apis/aigc.ts index c2e6f84b7..24b53cb8c 100644 --- a/spx-gui/src/apis/aigc.ts +++ b/spx-gui/src/apis/aigc.ts @@ -13,7 +13,8 @@ import { type UniversalUrl } from './common' import type { AssetExtraSettings, AssetType } from './asset' -import type { State } from '@/models/sprite.ts' +// TODO: avoid dep from apis to models +import type { State } from '@/models/spx/sprite' export type ProjectSettings = { name: string diff --git a/spx-gui/src/components/agent-copilot/CopilotProvider.vue b/spx-gui/src/components/agent-copilot/CopilotProvider.vue index 6c3fa49d8..fb26109e6 100644 --- a/spx-gui/src/components/agent-copilot/CopilotProvider.vue +++ b/spx-gui/src/components/agent-copilot/CopilotProvider.vue @@ -1,6 +1,7 @@ diff --git a/spx-gui/src/components/editor/map-editor/MapEditor.vue b/spx-gui/src/components/editor/map-editor/MapEditor.vue index 91ce9fb94..b346330d4 100644 --- a/spx-gui/src/components/editor/map-editor/MapEditor.vue +++ b/spx-gui/src/components/editor/map-editor/MapEditor.vue @@ -1,14 +1,14 @@ diff --git a/spx-gui/src/components/editor/map-editor/SpriteBasicConfig.vue b/spx-gui/src/components/editor/map-editor/SpriteBasicConfig.vue index 04488b030..56762a704 100644 --- a/spx-gui/src/components/editor/map-editor/SpriteBasicConfig.vue +++ b/spx-gui/src/components/editor/map-editor/SpriteBasicConfig.vue @@ -1,8 +1,8 @@ diff --git a/spx-gui/src/components/editor/sprite/animation/state/BoundStateEditor.vue b/spx-gui/src/components/editor/sprite/animation/state/BoundStateEditor.vue index 3a513213d..3b4ef8d0c 100644 --- a/spx-gui/src/components/editor/sprite/animation/state/BoundStateEditor.vue +++ b/spx-gui/src/components/editor/sprite/animation/state/BoundStateEditor.vue @@ -45,8 +45,8 @@ diff --git a/spx-gui/src/components/editor/stage/widget/detail/WidgetDetail.vue b/spx-gui/src/components/editor/stage/widget/detail/WidgetDetail.vue index 73ae3d2d8..2a8465ba9 100644 --- a/spx-gui/src/components/editor/stage/widget/detail/WidgetDetail.vue +++ b/spx-gui/src/components/editor/stage/widget/detail/WidgetDetail.vue @@ -3,8 +3,8 @@ + + +