move eventBus, appStorage, EditorStore to services directory

This commit is contained in:
Bowen Tan 2022-01-17 15:12:53 +08:00
parent 15bd209be8
commit 61665cdca0
6 changed files with 13 additions and 15 deletions

View File

@ -8,10 +8,10 @@ import {
withDefaultSize,
withDefaultVariant,
} from '@chakra-ui/react';
import { initEventBus } from './eventBus';
import { EditorStore } from './EditorStore';
import { initEventBus } from './services/eventBus';
import { EditorStore } from './services/EditorStore';
import { StorageHandler } from './types';
import { AppStorage } from './AppStorage';
import { AppStorage } from './services/AppStorage';
import { Application, Module } from '@sunmao-ui/core';
type SunmaoUIEditorProps = {
@ -80,7 +80,5 @@ export function initSunmaoUIEditor(props: SunmaoUIEditorProps = {}) {
return {
Editor,
registry,
onChange: () => null,
onSave: () => null,
};
}

View File

@ -1,5 +1,5 @@
import { ComponentSchema } from '@sunmao-ui/core';
import { EventBusType } from '../eventBus';
import { EventBusType } from '../services/eventBus';
import { IUndoRedoManager, IOperation, OperationList } from './type';
export class AppModelManager implements IUndoRedoManager {

View File

@ -1,10 +1,10 @@
import { observable, makeObservable, action, toJS } from 'mobx';
import { Application, ComponentSchema, Module } from '@sunmao-ui/core';
import { produce } from 'immer';
import { DefaultNewModule, EmptyAppSchema } from './constants';
import { addModuleId, removeModuleId } from './utils/addModuleId';
import { cloneDeep } from 'lodash-es';
import { StorageHandler } from './types';
import { produce } from 'immer';
import { DefaultNewModule, EmptyAppSchema } from '../constants';
import { addModuleId, removeModuleId } from '../utils/addModuleId';
import { StorageHandler } from '../types';
export class AppStorage {
app: Application;

View File

@ -5,8 +5,8 @@ import { Registry, StateManager } from '@sunmao-ui/runtime';
import { EventBusType } from './eventBus';
import { AppStorage } from './AppStorage';
import { SchemaValidator } from './validator';
import { addModuleId } from './utils/addModuleId';
import { SchemaValidator } from '../validator';
import { addModuleId } from '../utils/addModuleId';
type EditingTarget = {
kind: 'app' | 'module';

View File

@ -1,6 +1,6 @@
import mitt from 'mitt';
import { ComponentSchema } from '@sunmao-ui/core';
import { IOperation } from './operations/type';
import { IOperation } from '../operations/type';
export type EventNames = {
operation: IOperation;

View File

@ -1,7 +1,7 @@
import { Application, Module } from '@sunmao-ui/core';
import { initSunmaoUI, Registry, StateManager } from '@sunmao-ui/runtime';
import { EditorStore } from './EditorStore';
import { EventBusType } from './eventBus';
import { EditorStore } from './services/EditorStore';
import { EventBusType } from './services/eventBus';
import { AppModelManager } from './operations/AppModelManager';
type ReturnOfInit = ReturnType<typeof initSunmaoUI>;