mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 03:01:16 +00:00
refactor: mv shell/workspace to engine
This commit is contained in:
parent
1874a4b3e1
commit
01985a0f56
@ -17,6 +17,7 @@ export {
|
|||||||
action,
|
action,
|
||||||
runInAction,
|
runInAction,
|
||||||
untracked,
|
untracked,
|
||||||
|
flow
|
||||||
} from 'mobx';
|
} from 'mobx';
|
||||||
export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
|
export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import { createIcon } from '@alilc/lowcode-utils';
|
|||||||
|
|
||||||
interface ISettingsPrimaryPaneProps {
|
interface ISettingsPrimaryPaneProps {
|
||||||
engineEditor: Editor;
|
engineEditor: Editor;
|
||||||
config: any;
|
config?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
@ -2,15 +2,25 @@
|
|||||||
"name": "@alilc/lowcode-engine",
|
"name": "@alilc/lowcode-engine",
|
||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
||||||
"main": "dist/engine-core.js",
|
"type": "module",
|
||||||
"module": "dist/engine-core.js",
|
"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": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"es",
|
"src",
|
||||||
"lib"
|
"package.json"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"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"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -23,9 +33,9 @@
|
|||||||
"@alilc/lowcode-plugin-command": "workspace:*",
|
"@alilc/lowcode-plugin-command": "workspace:*",
|
||||||
"@alilc/lowcode-plugin-designer": "workspace:*",
|
"@alilc/lowcode-plugin-designer": "workspace:*",
|
||||||
"@alilc/lowcode-plugin-outline-pane": "workspace:*",
|
"@alilc/lowcode-plugin-outline-pane": "workspace:*",
|
||||||
"@alilc/lowcode-shell": "workspace:*",
|
|
||||||
"@alilc/lowcode-utils": "workspace:*",
|
"@alilc/lowcode-utils": "workspace:*",
|
||||||
"@alilc/lowcode-workspace": "workspace:*",
|
"@alilc/lowcode-types": "workspace:*",
|
||||||
|
"classnames": "^2.5.1",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
|
|||||||
@ -38,7 +38,7 @@ import {
|
|||||||
Workspace as InnerWorkspace,
|
Workspace as InnerWorkspace,
|
||||||
Workbench as WorkSpaceWorkbench,
|
Workbench as WorkSpaceWorkbench,
|
||||||
IWorkspace,
|
IWorkspace,
|
||||||
} from '@alilc/lowcode-workspace';
|
} from './workspace';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Hotkey,
|
Hotkey,
|
||||||
@ -55,7 +55,7 @@ import {
|
|||||||
Config,
|
Config,
|
||||||
CommonUI,
|
CommonUI,
|
||||||
Command,
|
Command,
|
||||||
} from '@alilc/lowcode-shell';
|
} from './shell';
|
||||||
import { isPlainObject } from '@alilc/lowcode-utils';
|
import { isPlainObject } from '@alilc/lowcode-utils';
|
||||||
import './modules/live-editing';
|
import './modules/live-editing';
|
||||||
import * as classes from './modules/classes';
|
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 { defaultContextMenu } from './inner-plugins/default-context-menu';
|
||||||
import { CommandPlugin } from '@alilc/lowcode-plugin-command';
|
import { CommandPlugin } from '@alilc/lowcode-plugin-command';
|
||||||
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
|
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
|
||||||
|
import { version } from '../package.json'
|
||||||
|
|
||||||
export * from './modules/skeleton-types';
|
export * from './modules/skeleton-types';
|
||||||
export * from './modules/designer-types';
|
export * from './modules/designer-types';
|
||||||
@ -210,7 +211,8 @@ engineConfig.set('isOpenSource', isOpenSource);
|
|||||||
// container which will host LowCodeEngine DOM
|
// container which will host LowCodeEngine DOM
|
||||||
let engineContainer: HTMLElement;
|
let engineContainer: HTMLElement;
|
||||||
// @ts-ignore webpack Define variable
|
// @ts-ignore webpack Define variable
|
||||||
export const version = VERSION_PLACEHOLDER;
|
|
||||||
|
export { version }
|
||||||
engineConfig.set('ENGINE_VERSION', version);
|
engineConfig.set('ENGINE_VERSION', version);
|
||||||
|
|
||||||
const pluginPromise = registryInnerPlugin(designer, editor, plugins);
|
const pluginPromise = registryInnerPlugin(designer, editor, plugins);
|
||||||
|
|||||||
@ -88,7 +88,7 @@ function getSuitableInsertion(
|
|||||||
} else {
|
} else {
|
||||||
// FIXME!!, parent maybe null
|
// FIXME!!, parent maybe null
|
||||||
target = refNode.parent!;
|
target = refNode.parent!;
|
||||||
index = refNode.index + 1;
|
index = refNode.index! + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target && insertNode && !target.componentMeta?.checkNestingDown(target, insertNode)) {
|
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) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
return getNextForSelect(parent.nextSibling, false, parent?.parent);
|
return getNextForSelect(parent.nextSibling!, false, parent?.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -147,7 +147,7 @@ function getPrevForSelect(prev: IPublicModelNode | null, head?: any, parent?: IP
|
|||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = getPrevForSelect(prev.prevSibling);
|
ret = getPrevForSelect(prev.prevSibling!);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,7 @@ export const componentMetaParser = (designer: any) => {
|
|||||||
const { material } = ctx;
|
const { material } = ctx;
|
||||||
material.onChangeAssets(() => {
|
material.onChangeAssets(() => {
|
||||||
const assets = material.getAssets();
|
const assets = material.getAssets();
|
||||||
const { components = [] } = assets;
|
designer.buildComponentMetasMap(assets?.components ?? []);
|
||||||
designer.buildComponentMetasMap(components);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7,6 +7,7 @@ const { intl, getLocale } = createIntl?.({
|
|||||||
'zh-CN': zhCN,
|
'zh-CN': zhCN,
|
||||||
}) || {
|
}) || {
|
||||||
intl: (id) => {
|
intl: (id) => {
|
||||||
|
// @ts-ignore
|
||||||
return zhCN[id];
|
return zhCN[id];
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
1
packages/engine/src/module.d.ts
vendored
Normal file
1
packages/engine/src/module.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
declare module 'ric-shim';
|
||||||
@ -11,6 +11,6 @@ export {
|
|||||||
Prop,
|
Prop,
|
||||||
SimulatorHost,
|
SimulatorHost,
|
||||||
SkeletonItem,
|
SkeletonItem,
|
||||||
} from '@alilc/lowcode-shell';
|
} from '../shell';
|
||||||
export { Node as InnerNode } from '@alilc/lowcode-designer';
|
export { Node as InnerNode } from '@alilc/lowcode-designer';
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import * as designerCabin from '@alilc/lowcode-designer';
|
|||||||
// 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性
|
// 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性
|
||||||
export type Node = designerCabin.Node;
|
export type Node = designerCabin.Node;
|
||||||
export type DocumentModel = designerCabin.DocumentModel;
|
export type DocumentModel = designerCabin.DocumentModel;
|
||||||
export type RootNode = designerCabin.RootNode;
|
|
||||||
export type EditingTarget = designerCabin.EditingTarget;
|
export type EditingTarget = designerCabin.EditingTarget;
|
||||||
export type SaveHandler = designerCabin.SaveHandler;
|
export type SaveHandler = designerCabin.SaveHandler;
|
||||||
export type ComponentMeta = designerCabin.ComponentMeta;
|
export type ComponentMeta = designerCabin.ComponentMeta;
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import { IPublicModelSettingField } from '../../../types/src/shell/model/setting
|
|||||||
import {
|
import {
|
||||||
Node,
|
Node,
|
||||||
SettingField,
|
SettingField,
|
||||||
} from '@alilc/lowcode-shell';
|
} from '../shell';
|
||||||
|
|
||||||
class ShellModelFactory implements IShellModelFactory {
|
class ShellModelFactory implements IShellModelFactory {
|
||||||
createNode(node: INode | null | undefined): IPublicModelNode | null {
|
createNode(node: INode | null | undefined): IPublicModelNode | null {
|
||||||
return Node.create(node);
|
return Node.create(node);
|
||||||
@ -16,4 +17,5 @@ class ShellModelFactory implements IShellModelFactory {
|
|||||||
return SettingField.create(prop);
|
return SettingField.create(prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shellModelFactory = new ShellModelFactory();
|
export const shellModelFactory = new ShellModelFactory();
|
||||||
@ -15,7 +15,7 @@ import {
|
|||||||
editorCabinSymbol,
|
editorCabinSymbol,
|
||||||
skeletonCabinSymbol,
|
skeletonCabinSymbol,
|
||||||
simulatorRenderSymbol,
|
simulatorRenderSymbol,
|
||||||
} from '@alilc/lowcode-shell';
|
} from '../shell';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
projectSymbol,
|
projectSymbol,
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export class Canvas implements IPublicApiCanvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get activeTracker(): IPublicModelActiveTracker | null {
|
get activeTracker(): IPublicModelActiveTracker | null {
|
||||||
const activeTracker = new ShellActiveTracker(this[designerSymbol].activeTracker);
|
const activeTracker = new ShellActiveTracker(this[designerSymbol].activeTracker as any);
|
||||||
return activeTracker;
|
return activeTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ export class Command implements IPublicApiCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
batchExecuteCommand(commands: { name: string; args: IPublicTypeCommandHandlerArgs }[]): void {
|
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 {
|
executeCommand(name: string, args: IPublicTypeCommandHandlerArgs): void {
|
||||||
@ -59,7 +59,7 @@ export class CommonUI implements IPublicApiCommonUI {
|
|||||||
Search = Search;
|
Search = Search;
|
||||||
Select = Select;
|
Select = Select;
|
||||||
SplitButton = SplitButton;
|
SplitButton = SplitButton;
|
||||||
Step = Step;
|
Step = Step as any;
|
||||||
Switch = Switch;
|
Switch = Switch;
|
||||||
Tab = Tab;
|
Tab = Tab;
|
||||||
Table = Table;
|
Table = Table;
|
||||||
@ -13,7 +13,7 @@ import {
|
|||||||
IPublicTypeContextMenuAction,
|
IPublicTypeContextMenuAction,
|
||||||
IPublicTypeContextMenuItem,
|
IPublicTypeContextMenuItem,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace';
|
import { Workspace as InnerWorkspace } from '../../workspace';
|
||||||
import { editorSymbol, designerSymbol } from '../symbols';
|
import { editorSymbol, designerSymbol } from '../symbols';
|
||||||
import { ComponentMeta as ShellComponentMeta } from '../model';
|
import { ComponentMeta as ShellComponentMeta } from '../model';
|
||||||
import { ComponentType } from 'react';
|
import { ComponentType } from 'react';
|
||||||
@ -199,6 +199,7 @@ export class Project implements IPublicApiProject {
|
|||||||
* 当前 project 的模拟器 ready 事件
|
* 当前 project 的模拟器 ready 事件
|
||||||
*/
|
*/
|
||||||
onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable {
|
onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable {
|
||||||
|
// @ts-ignore
|
||||||
const offFn = this[projectSymbol].onSimulatorReady((simulator: BuiltinSimulatorHost) => {
|
const offFn = this[projectSymbol].onSimulatorReady((simulator: BuiltinSimulatorHost) => {
|
||||||
fn(SimulatorHost.create(simulator)!);
|
fn(SimulatorHost.create(simulator)!);
|
||||||
});
|
});
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { IPublicApiWorkspace, IPublicModelResource, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
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 { resourceSymbol, workspaceSymbol } from '../symbols';
|
||||||
import { Resource as ShellResource, Window as ShellWindow } from '../model';
|
import { Resource as ShellResource, Window as ShellWindow } from '../model';
|
||||||
import { Plugins } from './plugins';
|
import { Plugins } from './plugins';
|
||||||
@ -29,7 +29,7 @@ import {
|
|||||||
CommonUI,
|
CommonUI,
|
||||||
Command,
|
Command,
|
||||||
} from './api';
|
} from './api';
|
||||||
import { getEvent, type Event } from '@alilc/lowcode-editor-skeleton';
|
import { getEvent, Event } from '@alilc/lowcode-editor-skeleton';
|
||||||
|
|
||||||
export * from './symbols';
|
export * from './symbols';
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export class ActiveTracker implements IPublicModelActiveTracker {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { node: innerNode, detail, instance } = _target;
|
const { node: innerNode, detail, instance } = _target as any;
|
||||||
const publicNode = ShellNode.create(innerNode);
|
const publicNode = ShellNode.create(innerNode);
|
||||||
return {
|
return {
|
||||||
node: publicNode!,
|
node: publicNode!,
|
||||||
@ -71,6 +71,7 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
const shellDoc = new DocumentModel(document);
|
const shellDoc = new DocumentModel(document);
|
||||||
// @ts-ignore 直接返回已挂载的 shell doc 实例
|
// @ts-ignore 直接返回已挂载的 shell doc 实例
|
||||||
document[shellDocSymbol] = shellDoc;
|
document[shellDocSymbol] = shellDoc;
|
||||||
|
// @ts-ignore
|
||||||
return shellDoc;
|
return shellDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set dropLocation(loc: IPublicModelDropLocation | null) {
|
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
|
* @param data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
|
// @ts-ignore
|
||||||
createNode<IPublicModelNode>(data: IPublicTypeNodeSchema): IPublicModelNode | null {
|
createNode<IPublicModelNode>(data: IPublicTypeNodeSchema): IPublicModelNode | null {
|
||||||
|
// @ts-ignore
|
||||||
return ShellNode.create(this[documentSymbol].createNode(data));
|
return ShellNode.create(this[documentSymbol].createNode(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export class Dragon implements IPublicModelDragon {
|
|||||||
* @param boost 拖拽转换函数
|
* @param boost 拖拽转换函数
|
||||||
*/
|
*/
|
||||||
from(shell: Element, boost: (e: MouseEvent) => IPublicTypeDragNodeDataObject | null): any {
|
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({
|
return this[dragonSymbol].boost({
|
||||||
...dragObject,
|
...dragObject,
|
||||||
nodes: dragObject.nodes.map((node: any) => node[nodeSymbol]),
|
nodes: dragObject.nodes.map((node: any) => node[nodeSymbol]),
|
||||||
}, boostEvent, fromRglNode?.[nodeSymbol]);
|
} as any, boostEvent, fromRglNode?.[nodeSymbol]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { editorViewSymbol, pluginContextSymbol } from '../symbols';
|
import { editorViewSymbol, pluginContextSymbol } from '../symbols';
|
||||||
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
|
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
|
||||||
import { IViewContext } from '@alilc/lowcode-workspace';
|
import { IViewContext } from '../../workspace';
|
||||||
|
|
||||||
export class EditorView {
|
export class EditorView {
|
||||||
[editorViewSymbol]: IViewContext;
|
[editorViewSymbol]: IViewContext;
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { IPublicModelResource } from '@alilc/lowcode-types';
|
import { IPublicModelResource } from '@alilc/lowcode-types';
|
||||||
import { IResource } from '@alilc/lowcode-workspace';
|
import { IResource } from '../../workspace';
|
||||||
import { resourceSymbol } from '../symbols';
|
import { resourceSymbol } from '../symbols';
|
||||||
|
|
||||||
export class Resource implements IPublicModelResource {
|
export class Resource implements IPublicModelResource {
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { windowSymbol } from '../symbols';
|
import { windowSymbol } from '../symbols';
|
||||||
import { IPublicModelResource, IPublicModelWindow, IPublicTypeDisposable } from '@alilc/lowcode-types';
|
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 { Resource as ShellResource } from './resource';
|
||||||
import { EditorView } from './editor-view';
|
import { EditorView } from './editor-view';
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ import {
|
|||||||
Canvas,
|
Canvas,
|
||||||
CommonUI,
|
CommonUI,
|
||||||
Command,
|
Command,
|
||||||
} from '@alilc/lowcode-shell';
|
} from '../../shell';
|
||||||
import {
|
import {
|
||||||
IPluginPreferenceMananger,
|
IPluginPreferenceMananger,
|
||||||
IPublicApiCanvas,
|
IPublicApiCanvas,
|
||||||
@ -1,10 +1,9 @@
|
|||||||
import { computed, makeObservable, obx } from '@alilc/lowcode-editor-core';
|
import { computed, makeObservable, obx, flow } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
IPublicEditorViewConfig,
|
IPublicEditorViewConfig,
|
||||||
IPublicEnumPluginRegisterLevel,
|
IPublicEnumPluginRegisterLevel,
|
||||||
IPublicTypeEditorView,
|
IPublicTypeEditorView,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { flow } from 'mobx';
|
|
||||||
import { IWorkspace } from '../workspace';
|
import { IWorkspace } from '../workspace';
|
||||||
import { BasicContext, IBasicContext } from './base-context';
|
import { BasicContext, IBasicContext } from './base-context';
|
||||||
import { IEditorWindow } from '../window';
|
import { IEditorWindow } from '../window';
|
||||||
@ -29,7 +28,7 @@ export class Context extends BasicContext implements IViewContext {
|
|||||||
|
|
||||||
@obx isInit: boolean = false;
|
@obx isInit: boolean = false;
|
||||||
|
|
||||||
init = flow(function* (this: Context) {
|
init: any = flow(function* (this: Context) {
|
||||||
if (this.viewType === 'webview') {
|
if (this.viewType === 'webview') {
|
||||||
const url = yield this.instance?.url?.();
|
const url = yield this.instance?.url?.();
|
||||||
yield this.plugins.register(getWebviewPlugin(url, this.viewName));
|
yield this.plugins.register(getWebviewPlugin(url, this.viewName));
|
||||||
@ -56,7 +56,7 @@ export class EditorWindow implements Omit<IPublicModelWindow<IResource>, 'change
|
|||||||
constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) {
|
constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
this.title = config.title;
|
this.title = config.title;
|
||||||
this.icon = resource.icon;
|
this.icon = resource.icon as any;
|
||||||
this.sleep = config.sleep;
|
this.sleep = config.sleep;
|
||||||
if (config.sleep) {
|
if (config.sleep) {
|
||||||
this.updateState(WINDOW_STATE.sleep);
|
this.updateState(WINDOW_STATE.sleep);
|
||||||
@ -4,7 +4,6 @@
|
|||||||
"emitDeclarationOnly": true,
|
"emitDeclarationOnly": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"outDir": "temp",
|
"outDir": "temp",
|
||||||
"stripInternal": true,
|
"stripInternal": true
|
||||||
"paths": {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,13 +10,20 @@ export default defineConfig({
|
|||||||
lib: {
|
lib: {
|
||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeDesigner',
|
name: 'AliLowCodeEngine',
|
||||||
formats: ['es', 'cjs'],
|
formats: ['es', 'cjs', 'iife'],
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'designer',
|
fileName: 'engine',
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: externals,
|
external: externals,
|
||||||
|
output: {
|
||||||
|
// for UMD
|
||||||
|
globals: {
|
||||||
|
react: 'React',
|
||||||
|
'react-dom': 'ReactDOM',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
8
packages/engine/vitest.config.ts
Normal file
8
packages/engine/vitest.config.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
include: ['tests/*.spec.ts'],
|
||||||
|
environment: 'jsdom'
|
||||||
|
}
|
||||||
|
})
|
||||||
@ -8,6 +8,8 @@ const logger = getLogger({ level: 'warn', bizName: 'plugin:plugin-designer' });
|
|||||||
|
|
||||||
export interface PluginProps {
|
export interface PluginProps {
|
||||||
engineEditor: Editor;
|
engineEditor: Editor;
|
||||||
|
// ??
|
||||||
|
engineConfig?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DesignerPluginState {
|
interface DesignerPluginState {
|
||||||
|
|||||||
@ -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"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"emitDeclarationOnly": true,
|
|
||||||
"declaration": true,
|
|
||||||
"outDir": "temp",
|
|
||||||
"stripInternal": true,
|
|
||||||
"paths": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "dist"
|
|
||||||
},
|
|
||||||
"include": ["src"]
|
|
||||||
}
|
|
||||||
@ -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()],
|
|
||||||
});
|
|
||||||
@ -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"
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "dist"
|
|
||||||
},
|
|
||||||
"include": ["src"]
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user