From 37ebe14e362b5945ec52a38914949f30976d6d08 Mon Sep 17 00:00:00 2001 From: chilingling Date: Thu, 6 Jun 2024 05:29:44 -0700 Subject: [PATCH 1/3] feat: merge lowcodeconfig with registry, migrate alias config to demo --- designer-demo/registry.js | 5 ++ designer-demo/vite.config.js | 59 ++++++++++++++ .../canvas/src/components/render/runner.js | 4 +- packages/common/component/LifeCycles.vue | 7 +- packages/controller/adapter.js | 4 +- packages/controller/src/hooks/useBlock.js | 6 +- packages/controller/src/hooks/useResource.js | 5 +- packages/controller/src/hooks/useSaveLocal.js | 7 +- packages/controller/src/index.js | 3 +- packages/design-core/config/lowcode.config.js | 2 +- packages/design-core/registry.js | 58 +++++++++++++- packages/design-core/src/App.vue | 6 ++ packages/design-core/src/init.js | 6 +- packages/design-core/src/preview/src/App.vue | 6 +- packages/design-core/src/theme/dark.js | 1 + packages/design-core/src/theme/light.js | 1 + packages/design-core/vite.config.js | 76 +------------------ packages/plugins/block/src/BlockSetting.vue | 9 ++- packages/plugins/bridge/src/BridgeSetting.vue | 5 +- .../datasource/src/DataSourceTemplate.vue | 4 +- packages/plugins/i18n/src/Main.vue | 5 +- packages/plugins/materials/src/block/http.js | 11 ++- packages/plugins/page/src/PageHistory.vue | 7 +- .../props/src/components/groups/LifeCycle.vue | 7 +- packages/toolbars/generate-vue/src/Main.vue | 14 +--- packages/toolbars/logo/src/Main.vue | 5 +- packages/toolbars/preview/src/Main.vue | 7 +- 27 files changed, 193 insertions(+), 137 deletions(-) create mode 100644 packages/design-core/src/theme/dark.js create mode 100644 packages/design-core/src/theme/light.js diff --git a/designer-demo/registry.js b/designer-demo/registry.js index e31418546..bdba8cab5 100644 --- a/designer-demo/registry.js +++ b/designer-demo/registry.js @@ -11,6 +11,11 @@ */ export default { + config: { + id: 'engine.config', + theme: 'dark', + material: [], + }, layout: { id: 'engine.layout' }, toolbars: [ { diff --git a/designer-demo/vite.config.js b/designer-demo/vite.config.js index 1a424c307..becb8ba82 100644 --- a/designer-demo/vite.config.js +++ b/designer-demo/vite.config.js @@ -1,11 +1,70 @@ +import path from 'node:path' import { defineConfig, mergeConfig } from 'vite' import getDefaultConfig from '@opentiny/tiny-engine/vite.config.js' export default defineConfig((options) => { const defaultConfig = getDefaultConfig(options) + + const devAlias = { + '@opentiny/tiny-engine-controller/js': path.resolve(__dirname, '../packages/controller/js'), + '@opentiny/tiny-engine-common/component': path.resolve(__dirname, '../packages/common/component'), + '@opentiny/tiny-engine-common': path.resolve(__dirname, '../packages/common/index.js'), + '@opentiny/tiny-engine-controller/utils': path.resolve(__dirname, '../packages/controller/utils.js'), + '@opentiny/tiny-engine-controller/adapter': path.resolve(__dirname, '../packages/controller/adapter.js'), + '@opentiny/tiny-engine-controller': path.resolve(__dirname, '../packages/controller/src/index.js'), + '@opentiny/tiny-engine-plugin-materials': path.resolve(__dirname, '../packages/plugins/materials/index.js'), + '@opentiny/tiny-engine-plugin-block': path.resolve(__dirname, '../packages/plugins/block/index.js'), + '@opentiny/tiny-engine-plugin-data': path.resolve(__dirname, '../packages/plugins/data/index.js'), + '@opentiny/tiny-engine-plugin-datasource': path.resolve(__dirname, '../packages/plugins/datasource/index.js'), + '@opentiny/tiny-engine-plugin-script': path.resolve(__dirname, '../packages/plugins/script/index.js'), + '@opentiny/tiny-engine-plugin-tree': path.resolve(__dirname, '../packages/plugins/tree/index.js'), + '@opentiny/tiny-engine-plugin-help': path.resolve(__dirname, '../packages/plugins/help/index.js'), + '@opentiny/tiny-engine-plugin-schema': path.resolve(__dirname, '../packages/plugins/schema/index.js'), + '@opentiny/tiny-engine-plugin-page': path.resolve(__dirname, '../packages/plugins/page/index.js'), + '@opentiny/tiny-engine-plugin-i18n': path.resolve(__dirname, '../packages/plugins/i18n/index.js'), + '@opentiny/tiny-engine-plugin-bridge': path.resolve(__dirname, '../packages/plugins/bridge/index.js'), + '@opentiny/tiny-engine-plugin-tutorial': path.resolve(__dirname, '../packages/plugins/tutorial/index.js'), + '@opentiny/tiny-engine-plugin-robot': path.resolve(__dirname, '../packages/plugins/robot/index.js'), + '@opentiny/tiny-engine-settings-panel': path.resolve(__dirname, '../packages/settings/panel/index.js'), + '@opentiny/tiny-engine-setting-events': path.resolve(__dirname, '../packages/settings/events/index.js'), + '@opentiny/tiny-engine-setting-props': path.resolve(__dirname, '../packages/settings/props/index.js'), + '@opentiny/tiny-engine-setting-styles': path.resolve(__dirname, '../packages/settings/styles/index.js'), + '@opentiny/tiny-engine-toolbar-breadcrumb': path.resolve(__dirname, '../packages/toolbars/breadcrumb/index.js'), + '@opentiny/tiny-engine-toolbar-fullscreen': path.resolve(__dirname, '../packages/toolbars/fullscreen/index.js'), + '@opentiny/tiny-engine-toolbar-lang': path.resolve(__dirname, '../packages/toolbars/lang/index.js'), + '@opentiny/tiny-engine-toolbar-layout': path.resolve(__dirname, '../packages/toolbars/layout/index.js'), + '@opentiny/tiny-engine-toolbar-checkinout': path.resolve(__dirname, '../packages/toolbars/lock/index.js'), + '@opentiny/tiny-engine-toolbar-logo': path.resolve(__dirname, '../packages/toolbars/logo/index.js'), + '@opentiny/tiny-engine-toolbar-logout': path.resolve(__dirname, '../packages/toolbars/logout/index.js'), + '@opentiny/tiny-engine-toolbar-media': path.resolve(__dirname, '../packages/toolbars/media/index.js'), + '@opentiny/tiny-engine-toolbar-preview': path.resolve(__dirname, '../packages/toolbars/preview/index.js'), + '@opentiny/tiny-engine-toolbar-generate-vue': path.resolve(__dirname, '../packages/toolbars/generate-vue/index.js'), + '@opentiny/tiny-engine-toolbar-refresh': path.resolve(__dirname, '../packages/toolbars/refresh/index.js'), + '@opentiny/tiny-engine-toolbar-redoundo': path.resolve(__dirname, '../packages/toolbars/redoundo/index.js'), + '@opentiny/tiny-engine-toolbar-clean': path.resolve(__dirname, '../packages/toolbars/clean/index.js'), + '@opentiny/tiny-engine-toolbar-save': path.resolve(__dirname, '../packages/toolbars/save/index.js'), + '@opentiny/tiny-engine-toolbar-setting': path.resolve(__dirname, '../packages/toolbars/setting/index.js'), + '@opentiny/tiny-engine-toolbar-collaboration': path.resolve(__dirname, '../packages/toolbars/collaboration/index.js'), + '@opentiny/tiny-engine-theme-dark': path.resolve(__dirname, '../packages/theme/dark/index.less'), + '@opentiny/tiny-engine-theme-light': path.resolve(__dirname, '../packages/theme/light/index.less'), + '@opentiny/tiny-engine-svgs': path.resolve(__dirname, '../packages/svgs/index.js'), + '@opentiny/tiny-engine-http': path.resolve(__dirname, '../packages/http/src/index.js'), + '@opentiny/tiny-engine-canvas': path.resolve(__dirname, '../packages/canvas/src/index.js'), + '@opentiny/tiny-engine-utils': path.resolve(__dirname, '../packages/utils/src/index.js'), + '@opentiny/tiny-engine-webcomponent-core': path.resolve(__dirname, '../packages/webcomponent/src/lib.js'), + '@opentiny/tiny-engine-i18n-host': path.resolve(__dirname, '../packages/i18n/src/lib.js'), + '@opentiny/tiny-engine-builtin-component': path.resolve(__dirname, '../packages/builtinComponent/index.js'), + '@opentiny/tiny-engine-entry': path.resolve(__dirname, '../packages/entry/src/index.js'), + '@opentiny/tiny-engine-layout': path.resolve(__dirname, '../packages/layout/index.js'), + '@opentiny/tiny-engine-configurator': path.resolve(__dirname, '../packages/configurator/src/index.js') + } + const config = { server: { port: 8090 + }, + resolve: { + alias: devAlias } } diff --git a/packages/canvas/src/components/render/runner.js b/packages/canvas/src/components/render/runner.js index 93d9902db..aa0210f87 100644 --- a/packages/canvas/src/components/render/runner.js +++ b/packages/canvas/src/components/render/runner.js @@ -134,8 +134,8 @@ const create = () => { export const createRender = (config) => { initRenderContext() - const { dslMode, canvasOptions } = config - const { styles = [], scripts = [] } = canvasOptions[dslMode] + + const { styles = [], scripts = [] } = config.canvasDependencies const { styles: thirdStyles = [], scripts: thirdScripts = [] } = window.thirdPartyDeps || {} Promise.all([ diff --git a/packages/common/component/LifeCycles.vue b/packages/common/component/LifeCycles.vue index c7abdcd28..cff2d6a37 100644 --- a/packages/common/component/LifeCycles.vue +++ b/packages/common/component/LifeCycles.vue @@ -78,7 +78,8 @@