diff --git a/packages/editor-core/src/utils/obx.ts b/packages/editor-core/src/utils/obx.ts index 64da4a21b..82bbe1833 100644 --- a/packages/editor-core/src/utils/obx.ts +++ b/packages/editor-core/src/utils/obx.ts @@ -17,6 +17,7 @@ export { action, runInAction, untracked, + flow } from 'mobx'; export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx'; diff --git a/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx b/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx index 42c97bd7a..093198eb6 100644 --- a/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx +++ b/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx @@ -20,7 +20,7 @@ import { createIcon } from '@alilc/lowcode-utils'; interface ISettingsPrimaryPaneProps { engineEditor: Editor; - config: any; + config?: any; } @observer diff --git a/packages/engine/package.json b/packages/engine/package.json index 4562e36c9..16650d9b8 100644 --- a/packages/engine/package.json +++ b/packages/engine/package.json @@ -2,15 +2,25 @@ "name": "@alilc/lowcode-engine", "version": "2.0.0-beta.0", "description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系", - "main": "dist/engine-core.js", - "module": "dist/engine-core.js", + "type": "module", + "main": "dist/engine.js", + "module": "dist/engine.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/engine.js", + "require": "./dist/engine.cjs", + "types": "./dist/index.d.ts" + } + }, "files": [ "dist", - "es", - "lib" + "src", + "package.json" ], "scripts": { - "version:update": "node ./scripts/version.js", + "build:target": "vite build", + "build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs", "test": "vitest" }, "license": "MIT", @@ -23,9 +33,9 @@ "@alilc/lowcode-plugin-command": "workspace:*", "@alilc/lowcode-plugin-designer": "workspace:*", "@alilc/lowcode-plugin-outline-pane": "workspace:*", - "@alilc/lowcode-shell": "workspace:*", "@alilc/lowcode-utils": "workspace:*", - "@alilc/lowcode-workspace": "workspace:*", + "@alilc/lowcode-types": "workspace:*", + "classnames": "^2.5.1", "prop-types": "^15.7.2", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/engine/src/engine-core.ts b/packages/engine/src/engine-core.ts index 7590b23f4..f80d5ed18 100644 --- a/packages/engine/src/engine-core.ts +++ b/packages/engine/src/engine-core.ts @@ -38,7 +38,7 @@ import { Workspace as InnerWorkspace, Workbench as WorkSpaceWorkbench, IWorkspace, -} from '@alilc/lowcode-workspace'; +} from './workspace'; import { Hotkey, @@ -55,7 +55,7 @@ import { Config, CommonUI, Command, -} from '@alilc/lowcode-shell'; +} from './shell'; import { isPlainObject } from '@alilc/lowcode-utils'; import './modules/live-editing'; import * as classes from './modules/classes'; @@ -68,6 +68,7 @@ import { builtinHotkey } from './inner-plugins/builtin-hotkey'; import { defaultContextMenu } from './inner-plugins/default-context-menu'; import { CommandPlugin } from '@alilc/lowcode-plugin-command'; import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane'; +import { version } from '../package.json' export * from './modules/skeleton-types'; export * from './modules/designer-types'; @@ -210,7 +211,8 @@ engineConfig.set('isOpenSource', isOpenSource); // container which will host LowCodeEngine DOM let engineContainer: HTMLElement; // @ts-ignore webpack Define variable -export const version = VERSION_PLACEHOLDER; + +export { version } engineConfig.set('ENGINE_VERSION', version); const pluginPromise = registryInnerPlugin(designer, editor, plugins); diff --git a/packages/engine/src/inner-plugins/builtin-hotkey.ts b/packages/engine/src/inner-plugins/builtin-hotkey.ts index 1a1f3a9c4..8d15df74f 100644 --- a/packages/engine/src/inner-plugins/builtin-hotkey.ts +++ b/packages/engine/src/inner-plugins/builtin-hotkey.ts @@ -88,7 +88,7 @@ function getSuitableInsertion( } else { // FIXME!!, parent maybe null target = refNode.parent!; - index = refNode.index + 1; + index = refNode.index! + 1; } if (target && insertNode && !target.componentMeta?.checkNestingDown(target, insertNode)) { @@ -116,14 +116,14 @@ function getNextForSelect(next: IPublicModelNode | null, head?: any, parent?: IP } } - ret = getNextForSelect(next.nextSibling); + ret = getNextForSelect(next.nextSibling!); if (ret) { return ret; } } if (parent) { - return getNextForSelect(parent.nextSibling, false, parent?.parent); + return getNextForSelect(parent.nextSibling!, false, parent?.parent); } return null; @@ -147,7 +147,7 @@ function getPrevForSelect(prev: IPublicModelNode | null, head?: any, parent?: IP return prev; } - ret = getPrevForSelect(prev.prevSibling); + ret = getPrevForSelect(prev.prevSibling!); if (ret) { return ret; } diff --git a/packages/engine/src/inner-plugins/component-meta-parser.ts b/packages/engine/src/inner-plugins/component-meta-parser.ts index d0fbb4300..921503da4 100644 --- a/packages/engine/src/inner-plugins/component-meta-parser.ts +++ b/packages/engine/src/inner-plugins/component-meta-parser.ts @@ -7,8 +7,7 @@ export const componentMetaParser = (designer: any) => { const { material } = ctx; material.onChangeAssets(() => { const assets = material.getAssets(); - const { components = [] } = assets; - designer.buildComponentMetasMap(components); + designer.buildComponentMetasMap(assets?.components ?? []); }); }, }; diff --git a/packages/engine/src/locale/index.ts b/packages/engine/src/locale/index.ts index ca89840b0..5ff70ad8f 100644 --- a/packages/engine/src/locale/index.ts +++ b/packages/engine/src/locale/index.ts @@ -7,6 +7,7 @@ const { intl, getLocale } = createIntl?.({ 'zh-CN': zhCN, }) || { intl: (id) => { + // @ts-ignore return zhCN[id]; }, }; diff --git a/packages/engine/src/module.d.ts b/packages/engine/src/module.d.ts new file mode 100644 index 000000000..74f3fbd94 --- /dev/null +++ b/packages/engine/src/module.d.ts @@ -0,0 +1 @@ +declare module 'ric-shim'; \ No newline at end of file diff --git a/packages/engine/src/modules/classes.ts b/packages/engine/src/modules/classes.ts index 3b7627deb..66586febd 100644 --- a/packages/engine/src/modules/classes.ts +++ b/packages/engine/src/modules/classes.ts @@ -11,6 +11,6 @@ export { Prop, SimulatorHost, SkeletonItem, -} from '@alilc/lowcode-shell'; +} from '../shell'; export { Node as InnerNode } from '@alilc/lowcode-designer'; diff --git a/packages/engine/src/modules/designer-types.ts b/packages/engine/src/modules/designer-types.ts index a0ee79952..e410d1b97 100644 --- a/packages/engine/src/modules/designer-types.ts +++ b/packages/engine/src/modules/designer-types.ts @@ -3,7 +3,6 @@ import * as designerCabin from '@alilc/lowcode-designer'; // 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性 export type Node = designerCabin.Node; export type DocumentModel = designerCabin.DocumentModel; -export type RootNode = designerCabin.RootNode; export type EditingTarget = designerCabin.EditingTarget; export type SaveHandler = designerCabin.SaveHandler; export type ComponentMeta = designerCabin.ComponentMeta; diff --git a/packages/engine/src/modules/shell-model-factory.ts b/packages/engine/src/modules/shell-model-factory.ts index 4271d126a..4af8cd42e 100644 --- a/packages/engine/src/modules/shell-model-factory.ts +++ b/packages/engine/src/modules/shell-model-factory.ts @@ -7,7 +7,8 @@ import { IPublicModelSettingField } from '../../../types/src/shell/model/setting import { Node, SettingField, -} from '@alilc/lowcode-shell'; +} from '../shell'; + class ShellModelFactory implements IShellModelFactory { createNode(node: INode | null | undefined): IPublicModelNode | null { return Node.create(node); @@ -16,4 +17,5 @@ class ShellModelFactory implements IShellModelFactory { return SettingField.create(prop); } } + export const shellModelFactory = new ShellModelFactory(); \ No newline at end of file diff --git a/packages/engine/src/modules/symbols.ts b/packages/engine/src/modules/symbols.ts index 55c70e5dc..a066231f3 100644 --- a/packages/engine/src/modules/symbols.ts +++ b/packages/engine/src/modules/symbols.ts @@ -15,7 +15,7 @@ import { editorCabinSymbol, skeletonCabinSymbol, simulatorRenderSymbol, -} from '@alilc/lowcode-shell'; +} from '../shell'; export default { projectSymbol, diff --git a/packages/shell/src/api/canvas.ts b/packages/engine/src/shell/api/canvas.ts similarity index 98% rename from packages/shell/src/api/canvas.ts rename to packages/engine/src/shell/api/canvas.ts index 48acbc487..c4743d2d9 100644 --- a/packages/shell/src/api/canvas.ts +++ b/packages/engine/src/shell/api/canvas.ts @@ -38,7 +38,7 @@ export class Canvas implements IPublicApiCanvas { } get activeTracker(): IPublicModelActiveTracker | null { - const activeTracker = new ShellActiveTracker(this[designerSymbol].activeTracker); + const activeTracker = new ShellActiveTracker(this[designerSymbol].activeTracker as any); return activeTracker; } diff --git a/packages/shell/src/api/command.ts b/packages/engine/src/shell/api/command.ts similarity index 98% rename from packages/shell/src/api/command.ts rename to packages/engine/src/shell/api/command.ts index ebab4a9ff..58bbbc045 100644 --- a/packages/shell/src/api/command.ts +++ b/packages/engine/src/shell/api/command.ts @@ -25,7 +25,7 @@ export class Command implements IPublicApiCommand { } batchExecuteCommand(commands: { name: string; args: IPublicTypeCommandHandlerArgs }[]): void { - this[commandSymbol].batchExecuteCommand(commands, this[pluginContextSymbol]); + this[commandSymbol].batchExecuteCommand(commands, this[pluginContextSymbol]!); } executeCommand(name: string, args: IPublicTypeCommandHandlerArgs): void { diff --git a/packages/shell/src/api/common.tsx b/packages/engine/src/shell/api/common.tsx similarity index 100% rename from packages/shell/src/api/common.tsx rename to packages/engine/src/shell/api/common.tsx diff --git a/packages/shell/src/api/commonUI.tsx b/packages/engine/src/shell/api/commonUI.tsx similarity index 99% rename from packages/shell/src/api/commonUI.tsx rename to packages/engine/src/shell/api/commonUI.tsx index 85dafdf0b..d922330c1 100644 --- a/packages/shell/src/api/commonUI.tsx +++ b/packages/engine/src/shell/api/commonUI.tsx @@ -59,7 +59,7 @@ export class CommonUI implements IPublicApiCommonUI { Search = Search; Select = Select; SplitButton = SplitButton; - Step = Step; + Step = Step as any; Switch = Switch; Tab = Tab; Table = Table; diff --git a/packages/shell/src/api/config.ts b/packages/engine/src/shell/api/config.ts similarity index 100% rename from packages/shell/src/api/config.ts rename to packages/engine/src/shell/api/config.ts diff --git a/packages/shell/src/api/hotkey.ts b/packages/engine/src/shell/api/hotkey.ts similarity index 100% rename from packages/shell/src/api/hotkey.ts rename to packages/engine/src/shell/api/hotkey.ts diff --git a/packages/shell/src/api/index.ts b/packages/engine/src/shell/api/index.ts similarity index 100% rename from packages/shell/src/api/index.ts rename to packages/engine/src/shell/api/index.ts diff --git a/packages/shell/src/api/logger.ts b/packages/engine/src/shell/api/logger.ts similarity index 100% rename from packages/shell/src/api/logger.ts rename to packages/engine/src/shell/api/logger.ts diff --git a/packages/shell/src/api/material.ts b/packages/engine/src/shell/api/material.ts similarity index 98% rename from packages/shell/src/api/material.ts rename to packages/engine/src/shell/api/material.ts index 9c0ae73ab..cfb71f262 100644 --- a/packages/shell/src/api/material.ts +++ b/packages/engine/src/shell/api/material.ts @@ -13,7 +13,7 @@ import { IPublicTypeContextMenuAction, IPublicTypeContextMenuItem, } from '@alilc/lowcode-types'; -import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace'; +import { Workspace as InnerWorkspace } from '../../workspace'; import { editorSymbol, designerSymbol } from '../symbols'; import { ComponentMeta as ShellComponentMeta } from '../model'; import { ComponentType } from 'react'; diff --git a/packages/shell/src/api/plugins.ts b/packages/engine/src/shell/api/plugins.ts similarity index 100% rename from packages/shell/src/api/plugins.ts rename to packages/engine/src/shell/api/plugins.ts diff --git a/packages/shell/src/api/project.ts b/packages/engine/src/shell/api/project.ts similarity index 99% rename from packages/shell/src/api/project.ts rename to packages/engine/src/shell/api/project.ts index f005d0af0..bd9f4a1a1 100644 --- a/packages/shell/src/api/project.ts +++ b/packages/engine/src/shell/api/project.ts @@ -199,6 +199,7 @@ export class Project implements IPublicApiProject { * 当前 project 的模拟器 ready 事件 */ onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable { + // @ts-ignore const offFn = this[projectSymbol].onSimulatorReady((simulator: BuiltinSimulatorHost) => { fn(SimulatorHost.create(simulator)!); }); diff --git a/packages/shell/src/api/setters.ts b/packages/engine/src/shell/api/setters.ts similarity index 100% rename from packages/shell/src/api/setters.ts rename to packages/engine/src/shell/api/setters.ts diff --git a/packages/shell/src/api/simulator-host.ts b/packages/engine/src/shell/api/simulator-host.ts similarity index 100% rename from packages/shell/src/api/simulator-host.ts rename to packages/engine/src/shell/api/simulator-host.ts diff --git a/packages/shell/src/api/skeleton.ts b/packages/engine/src/shell/api/skeleton.ts similarity index 100% rename from packages/shell/src/api/skeleton.ts rename to packages/engine/src/shell/api/skeleton.ts diff --git a/packages/shell/src/api/workspace.ts b/packages/engine/src/shell/api/workspace.ts similarity index 98% rename from packages/shell/src/api/workspace.ts rename to packages/engine/src/shell/api/workspace.ts index c793a6753..2629d0c22 100644 --- a/packages/shell/src/api/workspace.ts +++ b/packages/engine/src/shell/api/workspace.ts @@ -1,5 +1,5 @@ import { IPublicApiWorkspace, IPublicModelResource, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types'; -import { IWorkspace } from '@alilc/lowcode-workspace'; +import { IWorkspace } from '../../workspace'; import { resourceSymbol, workspaceSymbol } from '../symbols'; import { Resource as ShellResource, Window as ShellWindow } from '../model'; import { Plugins } from './plugins'; diff --git a/packages/shell/src/components/context-menu.tsx b/packages/engine/src/shell/components/context-menu.tsx similarity index 100% rename from packages/shell/src/components/context-menu.tsx rename to packages/engine/src/shell/components/context-menu.tsx diff --git a/packages/shell/src/index.ts b/packages/engine/src/shell/index.ts similarity index 94% rename from packages/shell/src/index.ts rename to packages/engine/src/shell/index.ts index 2d56476be..87e0c5a99 100644 --- a/packages/shell/src/index.ts +++ b/packages/engine/src/shell/index.ts @@ -29,7 +29,7 @@ import { CommonUI, Command, } from './api'; -import { getEvent, type Event } from '@alilc/lowcode-editor-skeleton'; +import { getEvent, Event } from '@alilc/lowcode-editor-skeleton'; export * from './symbols'; diff --git a/packages/shell/src/model/active-tracker.ts b/packages/engine/src/shell/model/active-tracker.ts similarity index 95% rename from packages/shell/src/model/active-tracker.ts rename to packages/engine/src/shell/model/active-tracker.ts index 32d4c04eb..bd7453bd8 100644 --- a/packages/shell/src/model/active-tracker.ts +++ b/packages/engine/src/shell/model/active-tracker.ts @@ -19,7 +19,7 @@ export class ActiveTracker implements IPublicModelActiveTracker { return null; } - const { node: innerNode, detail, instance } = _target; + const { node: innerNode, detail, instance } = _target as any; const publicNode = ShellNode.create(innerNode); return { node: publicNode!, diff --git a/packages/shell/src/model/clipboard.ts b/packages/engine/src/shell/model/clipboard.ts similarity index 100% rename from packages/shell/src/model/clipboard.ts rename to packages/engine/src/shell/model/clipboard.ts diff --git a/packages/shell/src/model/component-meta.ts b/packages/engine/src/shell/model/component-meta.ts similarity index 100% rename from packages/shell/src/model/component-meta.ts rename to packages/engine/src/shell/model/component-meta.ts diff --git a/packages/shell/src/model/condition-group.ts b/packages/engine/src/shell/model/condition-group.ts similarity index 100% rename from packages/shell/src/model/condition-group.ts rename to packages/engine/src/shell/model/condition-group.ts diff --git a/packages/shell/src/model/detecting.ts b/packages/engine/src/shell/model/detecting.ts similarity index 100% rename from packages/shell/src/model/detecting.ts rename to packages/engine/src/shell/model/detecting.ts diff --git a/packages/shell/src/model/document-model.ts b/packages/engine/src/shell/model/document-model.ts similarity index 99% rename from packages/shell/src/model/document-model.ts rename to packages/engine/src/shell/model/document-model.ts index bd0ccaf75..20795aea8 100644 --- a/packages/shell/src/model/document-model.ts +++ b/packages/engine/src/shell/model/document-model.ts @@ -71,6 +71,7 @@ export class DocumentModel implements IPublicModelDocumentModel { const shellDoc = new DocumentModel(document); // @ts-ignore 直接返回已挂载的 shell doc 实例 document[shellDocSymbol] = shellDoc; + // @ts-ignore return shellDoc; } @@ -138,7 +139,7 @@ export class DocumentModel implements IPublicModelDocumentModel { } set dropLocation(loc: IPublicModelDropLocation | null) { - this[documentSymbol].dropLocation = loc; + this[documentSymbol].dropLocation = loc as any; } /** @@ -196,7 +197,9 @@ export class DocumentModel implements IPublicModelDocumentModel { * @param data * @returns */ + // @ts-ignore createNode(data: IPublicTypeNodeSchema): IPublicModelNode | null { + // @ts-ignore return ShellNode.create(this[documentSymbol].createNode(data)); } diff --git a/packages/shell/src/model/drag-object.ts b/packages/engine/src/shell/model/drag-object.ts similarity index 100% rename from packages/shell/src/model/drag-object.ts rename to packages/engine/src/shell/model/drag-object.ts diff --git a/packages/shell/src/model/dragon.ts b/packages/engine/src/shell/model/dragon.ts similarity index 96% rename from packages/shell/src/model/dragon.ts rename to packages/engine/src/shell/model/dragon.ts index 7f2492e7e..ca6d8267f 100644 --- a/packages/shell/src/model/dragon.ts +++ b/packages/engine/src/shell/model/dragon.ts @@ -96,7 +96,7 @@ export class Dragon implements IPublicModelDragon { * @param boost 拖拽转换函数 */ from(shell: Element, boost: (e: MouseEvent) => IPublicTypeDragNodeDataObject | null): any { - return this[dragonSymbol].from(shell, boost); + return this[dragonSymbol].from(shell, boost as any); } /** @@ -111,7 +111,7 @@ export class Dragon implements IPublicModelDragon { return this[dragonSymbol].boost({ ...dragObject, nodes: dragObject.nodes.map((node: any) => node[nodeSymbol]), - }, boostEvent, fromRglNode?.[nodeSymbol]); + } as any, boostEvent, fromRglNode?.[nodeSymbol]); } /** diff --git a/packages/shell/src/model/drop-location.ts b/packages/engine/src/shell/model/drop-location.ts similarity index 100% rename from packages/shell/src/model/drop-location.ts rename to packages/engine/src/shell/model/drop-location.ts diff --git a/packages/shell/src/model/editor-view.ts b/packages/engine/src/shell/model/editor-view.ts similarity index 94% rename from packages/shell/src/model/editor-view.ts rename to packages/engine/src/shell/model/editor-view.ts index 92d1a5772..4b2435414 100644 --- a/packages/shell/src/model/editor-view.ts +++ b/packages/engine/src/shell/model/editor-view.ts @@ -1,6 +1,6 @@ import { editorViewSymbol, pluginContextSymbol } from '../symbols'; import { IPublicModelPluginContext } from '@alilc/lowcode-types'; -import { IViewContext } from '@alilc/lowcode-workspace'; +import { IViewContext } from '../../workspace'; export class EditorView { [editorViewSymbol]: IViewContext; diff --git a/packages/shell/src/model/history.ts b/packages/engine/src/shell/model/history.ts similarity index 100% rename from packages/shell/src/model/history.ts rename to packages/engine/src/shell/model/history.ts diff --git a/packages/shell/src/model/index.ts b/packages/engine/src/shell/model/index.ts similarity index 100% rename from packages/shell/src/model/index.ts rename to packages/engine/src/shell/model/index.ts diff --git a/packages/shell/src/model/locate-event.ts b/packages/engine/src/shell/model/locate-event.ts similarity index 100% rename from packages/shell/src/model/locate-event.ts rename to packages/engine/src/shell/model/locate-event.ts diff --git a/packages/shell/src/model/modal-nodes-manager.ts b/packages/engine/src/shell/model/modal-nodes-manager.ts similarity index 100% rename from packages/shell/src/model/modal-nodes-manager.ts rename to packages/engine/src/shell/model/modal-nodes-manager.ts diff --git a/packages/shell/src/model/node-children.ts b/packages/engine/src/shell/model/node-children.ts similarity index 100% rename from packages/shell/src/model/node-children.ts rename to packages/engine/src/shell/model/node-children.ts diff --git a/packages/shell/src/model/node.ts b/packages/engine/src/shell/model/node.ts similarity index 100% rename from packages/shell/src/model/node.ts rename to packages/engine/src/shell/model/node.ts diff --git a/packages/shell/src/model/plugin-instance.ts b/packages/engine/src/shell/model/plugin-instance.ts similarity index 100% rename from packages/shell/src/model/plugin-instance.ts rename to packages/engine/src/shell/model/plugin-instance.ts diff --git a/packages/shell/src/model/prop.ts b/packages/engine/src/shell/model/prop.ts similarity index 100% rename from packages/shell/src/model/prop.ts rename to packages/engine/src/shell/model/prop.ts diff --git a/packages/shell/src/model/props.ts b/packages/engine/src/shell/model/props.ts similarity index 100% rename from packages/shell/src/model/props.ts rename to packages/engine/src/shell/model/props.ts diff --git a/packages/shell/src/model/resource.ts b/packages/engine/src/shell/model/resource.ts similarity index 95% rename from packages/shell/src/model/resource.ts rename to packages/engine/src/shell/model/resource.ts index da344742d..9b5491ac6 100644 --- a/packages/shell/src/model/resource.ts +++ b/packages/engine/src/shell/model/resource.ts @@ -1,5 +1,5 @@ import { IPublicModelResource } from '@alilc/lowcode-types'; -import { IResource } from '@alilc/lowcode-workspace'; +import { IResource } from '../../workspace'; import { resourceSymbol } from '../symbols'; export class Resource implements IPublicModelResource { diff --git a/packages/shell/src/model/selection.ts b/packages/engine/src/shell/model/selection.ts similarity index 100% rename from packages/shell/src/model/selection.ts rename to packages/engine/src/shell/model/selection.ts diff --git a/packages/shell/src/model/setting-field.ts b/packages/engine/src/shell/model/setting-field.ts similarity index 100% rename from packages/shell/src/model/setting-field.ts rename to packages/engine/src/shell/model/setting-field.ts diff --git a/packages/shell/src/model/setting-top-entry.ts b/packages/engine/src/shell/model/setting-top-entry.ts similarity index 100% rename from packages/shell/src/model/setting-top-entry.ts rename to packages/engine/src/shell/model/setting-top-entry.ts diff --git a/packages/shell/src/model/simulator-render.ts b/packages/engine/src/shell/model/simulator-render.ts similarity index 100% rename from packages/shell/src/model/simulator-render.ts rename to packages/engine/src/shell/model/simulator-render.ts diff --git a/packages/shell/src/model/skeleton-item.ts b/packages/engine/src/shell/model/skeleton-item.ts similarity index 100% rename from packages/shell/src/model/skeleton-item.ts rename to packages/engine/src/shell/model/skeleton-item.ts diff --git a/packages/shell/src/model/window.ts b/packages/engine/src/shell/model/window.ts similarity index 96% rename from packages/shell/src/model/window.ts rename to packages/engine/src/shell/model/window.ts index 1bc84e661..d75dbd6cc 100644 --- a/packages/shell/src/model/window.ts +++ b/packages/engine/src/shell/model/window.ts @@ -1,6 +1,6 @@ import { windowSymbol } from '../symbols'; import { IPublicModelResource, IPublicModelWindow, IPublicTypeDisposable } from '@alilc/lowcode-types'; -import { IEditorWindow } from '@alilc/lowcode-workspace'; +import { IEditorWindow } from '../../workspace'; import { Resource as ShellResource } from './resource'; import { EditorView } from './editor-view'; diff --git a/packages/shell/src/symbols.ts b/packages/engine/src/shell/symbols.ts similarity index 100% rename from packages/shell/src/symbols.ts rename to packages/engine/src/shell/symbols.ts diff --git a/packages/workspace/src/context/base-context.ts b/packages/engine/src/workspace/context/base-context.ts similarity index 99% rename from packages/workspace/src/context/base-context.ts rename to packages/engine/src/workspace/context/base-context.ts index 7a84619c8..78d47c88b 100644 --- a/packages/workspace/src/context/base-context.ts +++ b/packages/engine/src/workspace/context/base-context.ts @@ -33,7 +33,7 @@ import { Canvas, CommonUI, Command, -} from '@alilc/lowcode-shell'; +} from '../../shell'; import { IPluginPreferenceMananger, IPublicApiCanvas, diff --git a/packages/workspace/src/context/view-context.ts b/packages/engine/src/workspace/context/view-context.ts similarity index 93% rename from packages/workspace/src/context/view-context.ts rename to packages/engine/src/workspace/context/view-context.ts index 230227cf1..8dd26d170 100644 --- a/packages/workspace/src/context/view-context.ts +++ b/packages/engine/src/workspace/context/view-context.ts @@ -1,10 +1,9 @@ -import { computed, makeObservable, obx } from '@alilc/lowcode-editor-core'; +import { computed, makeObservable, obx, flow } from '@alilc/lowcode-editor-core'; import { IPublicEditorViewConfig, IPublicEnumPluginRegisterLevel, IPublicTypeEditorView, } from '@alilc/lowcode-types'; -import { flow } from 'mobx'; import { IWorkspace } from '../workspace'; import { BasicContext, IBasicContext } from './base-context'; import { IEditorWindow } from '../window'; @@ -29,7 +28,7 @@ export class Context extends BasicContext implements IViewContext { @obx isInit: boolean = false; - init = flow(function* (this: Context) { + init: any = flow(function* (this: Context) { if (this.viewType === 'webview') { const url = yield this.instance?.url?.(); yield this.plugins.register(getWebviewPlugin(url, this.viewName)); diff --git a/packages/workspace/src/index.ts b/packages/engine/src/workspace/index.ts similarity index 100% rename from packages/workspace/src/index.ts rename to packages/engine/src/workspace/index.ts diff --git a/packages/workspace/src/inner-plugins/webview.tsx b/packages/engine/src/workspace/inner-plugins/webview.tsx similarity index 100% rename from packages/workspace/src/inner-plugins/webview.tsx rename to packages/engine/src/workspace/inner-plugins/webview.tsx diff --git a/packages/workspace/src/layouts/workbench.tsx b/packages/engine/src/workspace/layouts/workbench.tsx similarity index 100% rename from packages/workspace/src/layouts/workbench.tsx rename to packages/engine/src/workspace/layouts/workbench.tsx diff --git a/packages/workspace/src/less-variables.less b/packages/engine/src/workspace/less-variables.less similarity index 100% rename from packages/workspace/src/less-variables.less rename to packages/engine/src/workspace/less-variables.less diff --git a/packages/workspace/src/resource-type.ts b/packages/engine/src/workspace/resource-type.ts similarity index 100% rename from packages/workspace/src/resource-type.ts rename to packages/engine/src/workspace/resource-type.ts diff --git a/packages/workspace/src/resource.ts b/packages/engine/src/workspace/resource.ts similarity index 100% rename from packages/workspace/src/resource.ts rename to packages/engine/src/workspace/resource.ts diff --git a/packages/workspace/src/skeleton-context.ts b/packages/engine/src/workspace/skeleton-context.ts similarity index 100% rename from packages/workspace/src/skeleton-context.ts rename to packages/engine/src/workspace/skeleton-context.ts diff --git a/packages/workspace/src/view/editor-view.tsx b/packages/engine/src/workspace/view/editor-view.tsx similarity index 100% rename from packages/workspace/src/view/editor-view.tsx rename to packages/engine/src/workspace/view/editor-view.tsx diff --git a/packages/workspace/src/view/resource-view.less b/packages/engine/src/workspace/view/resource-view.less similarity index 100% rename from packages/workspace/src/view/resource-view.less rename to packages/engine/src/workspace/view/resource-view.less diff --git a/packages/workspace/src/view/resource-view.tsx b/packages/engine/src/workspace/view/resource-view.tsx similarity index 100% rename from packages/workspace/src/view/resource-view.tsx rename to packages/engine/src/workspace/view/resource-view.tsx diff --git a/packages/workspace/src/view/window-view.tsx b/packages/engine/src/workspace/view/window-view.tsx similarity index 100% rename from packages/workspace/src/view/window-view.tsx rename to packages/engine/src/workspace/view/window-view.tsx diff --git a/packages/workspace/src/window.ts b/packages/engine/src/workspace/window.ts similarity index 99% rename from packages/workspace/src/window.ts rename to packages/engine/src/workspace/window.ts index 565575b71..340c902f4 100644 --- a/packages/workspace/src/window.ts +++ b/packages/engine/src/workspace/window.ts @@ -56,7 +56,7 @@ export class EditorWindow implements Omit, 'change constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) { makeObservable(this); this.title = config.title; - this.icon = resource.icon; + this.icon = resource.icon as any; this.sleep = config.sleep; if (config.sleep) { this.updateState(WINDOW_STATE.sleep); diff --git a/packages/workspace/src/workspace.ts b/packages/engine/src/workspace/workspace.ts similarity index 100% rename from packages/workspace/src/workspace.ts rename to packages/engine/src/workspace/workspace.ts diff --git a/packages/workspace/tsconfig.declaration.json b/packages/engine/tsconfig.declaration.json similarity index 76% rename from packages/workspace/tsconfig.declaration.json rename to packages/engine/tsconfig.declaration.json index 54e57efbd..bccb9a3e5 100644 --- a/packages/workspace/tsconfig.declaration.json +++ b/packages/engine/tsconfig.declaration.json @@ -4,7 +4,6 @@ "emitDeclarationOnly": true, "declaration": true, "outDir": "temp", - "stripInternal": true, - "paths": {} + "stripInternal": true } } diff --git a/packages/workspace/vite.config.ts b/packages/engine/vite.config.ts similarity index 71% rename from packages/workspace/vite.config.ts rename to packages/engine/vite.config.ts index 546af4fc2..928dbe8e1 100644 --- a/packages/workspace/vite.config.ts +++ b/packages/engine/vite.config.ts @@ -10,13 +10,20 @@ export default defineConfig({ lib: { // Could also be a dictionary or array of multiple entry points entry: resolve(import.meta.dirname, 'src/index.ts'), - name: 'LowCodeDesigner', - formats: ['es', 'cjs'], + name: 'AliLowCodeEngine', + formats: ['es', 'cjs', 'iife'], // the proper extensions will be added - fileName: 'designer', + fileName: 'engine', }, rollupOptions: { external: externals, + output: { + // for UMD + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + }, + }, }, }, plugins: [react()], diff --git a/packages/engine/vitest.config.ts b/packages/engine/vitest.config.ts new file mode 100644 index 000000000..73d181d02 --- /dev/null +++ b/packages/engine/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + include: ['tests/*.spec.ts'], + environment: 'jsdom' + } +}) diff --git a/packages/plugin-designer/src/index.tsx b/packages/plugin-designer/src/index.tsx index 11221826d..4c769be58 100644 --- a/packages/plugin-designer/src/index.tsx +++ b/packages/plugin-designer/src/index.tsx @@ -8,6 +8,8 @@ const logger = getLogger({ level: 'warn', bizName: 'plugin:plugin-designer' }); export interface PluginProps { engineEditor: Editor; + // ?? + engineConfig?: any; } interface DesignerPluginState { diff --git a/packages/shell/package.json b/packages/shell/package.json deleted file mode 100644 index c87b74ce8..000000000 --- a/packages/shell/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@alilc/lowcode-shell", - "version": "2.0.0-beta.0", - "description": "Shell Layer for AliLowCodeEngine", - "type": "module", - "main": "lib/index.js", - "module": "es/index.js", - "files": [ - "lib", - "es" - ], - "scripts": { - "build:target": "vite build", - "build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs", - "test": "vitest" - }, - "license": "MIT", - "dependencies": { - "@alifd/next": "^1.27.8", - "@alilc/lowcode-designer": "workspace:*", - "@alilc/lowcode-editor-core": "workspace:*", - "@alilc/lowcode-editor-skeleton": "workspace:*", - "@alilc/lowcode-types": "workspace:*", - "@alilc/lowcode-utils": "workspace:*", - "@alilc/lowcode-workspace": "workspace:*", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@testing-library/react": "^14.2.2", - "@types/react": "^18.2.0", - "@types/react-dom": "^18.2.0" - }, - "peerDependencies": { - "@alifd/next": "^1.27.8", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - }, - "repository": { - "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell" - }, - "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" -} diff --git a/packages/shell/tsconfig.declaration.json b/packages/shell/tsconfig.declaration.json deleted file mode 100644 index 54e57efbd..000000000 --- a/packages/shell/tsconfig.declaration.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "emitDeclarationOnly": true, - "declaration": true, - "outDir": "temp", - "stripInternal": true, - "paths": {} - } -} diff --git a/packages/shell/tsconfig.json b/packages/shell/tsconfig.json deleted file mode 100644 index 039e0b4d1..000000000 --- a/packages/shell/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] -} diff --git a/packages/shell/vite.config.ts b/packages/shell/vite.config.ts deleted file mode 100644 index 546af4fc2..000000000 --- a/packages/shell/vite.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { defineConfig } from 'vite'; -import { resolve } from 'node:path'; -import react from '@vitejs/plugin-react'; -import { devDependencies, peerDependencies } from './package.json'; - -const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)]; - -export default defineConfig({ - build: { - lib: { - // Could also be a dictionary or array of multiple entry points - entry: resolve(import.meta.dirname, 'src/index.ts'), - name: 'LowCodeDesigner', - formats: ['es', 'cjs'], - // the proper extensions will be added - fileName: 'designer', - }, - rollupOptions: { - external: externals, - }, - }, - plugins: [react()], -}); diff --git a/packages/shell/vitest.config.ts b/packages/shell/vitest.config.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/workspace/package.json b/packages/workspace/package.json deleted file mode 100644 index 56b9cdb6b..000000000 --- a/packages/workspace/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@alilc/lowcode-workspace", - "version": "2.0.0-beta.0", - "description": "Shell Layer for AliLowCodeEngine", - "license": "MIT", - "type": "module", - "main": "lib/index.js", - "module": "es/index.js", - "exports": { - ".": {} - }, - "files": [ - "dist", - "src", - "package.json" - ], - "scripts": { - "build": "pnpm run \"/^build:.*/\"", - "build:target": "vite build", - "build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs", - "test": "vitest", - "test:cov": "" - }, - "dependencies": { - "@alilc/lowcode-designer": "workspace:*", - "@alilc/lowcode-editor-core": "workspace:*", - "@alilc/lowcode-editor-skeleton": "workspace:*", - "@alilc/lowcode-types": "workspace:*", - "@alilc/lowcode-utils": "workspace:*", - "classnames": "^2.5.1", - "mobx": "^6.12.1", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@alib/build-scripts": "^0.1.29", - "@testing-library/react": "^11.2.2", - "@types/react": "^18.2.0", - "@types/react-dom": "^18.2.0" - }, - "peerDependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - }, - "repository": { - "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/workspace" - }, - "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" -} diff --git a/packages/workspace/tsconfig.json b/packages/workspace/tsconfig.json deleted file mode 100644 index 039e0b4d1..000000000 --- a/packages/workspace/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] -} diff --git a/packages/workspace/vitest.config.ts b/packages/workspace/vitest.config.ts deleted file mode 100644 index e69de29bb..000000000