From 009a6d0754b5c40cd68d7f51cec368e6493c291f Mon Sep 17 00:00:00 2001 From: yaoyun8 <142570291+yaoyun8@users.noreply.github.com> Date: Thu, 7 Dec 2023 20:36:26 +0800 Subject: [PATCH 01/11] fix: code check (#117) --- mockServer/assets/js/1005web-components.es.js | 4 +- .../assets/js/1005web-components.umd.js | 40 +++++++------- mockServer/assets/js/1505web-components.es.js | 4 +- .../assets/js/1505web-components.umd.js | 40 +++++++------- mockServer/assets/js/998web-components.es.js | 8 +-- mockServer/assets/js/998web-components.umd.js | 53 ++++++++++--------- mockServer/src/services/app.js | 4 +- mockServer/src/services/blockCategory.js | 2 +- .../canvas/src/components/render/render.js | 15 ++++-- packages/common/vite.config.js | 2 +- .../plugins/block/src/js/blockSetting.jsx | 2 +- packages/plugins/page/src/PageTree.vue | 24 ++++----- packages/toolbars/save/src/js/index.js | 2 +- packages/vue-generator/src/generator/page.js | 5 +- packages/vue-generator/src/utils/index.js | 27 +++++----- .../src/utils/vue-sfc-validator.js | 22 ++++---- 16 files changed, 135 insertions(+), 119 deletions(-) diff --git a/mockServer/assets/js/1005web-components.es.js b/mockServer/assets/js/1005web-components.es.js index 0043c1ad7..689d20a98 100644 --- a/mockServer/assets/js/1005web-components.es.js +++ b/mockServer/assets/js/1005web-components.es.js @@ -26,7 +26,7 @@ const cacheStringFunction = (fn) => { } const hyphenateRE = /\B([A-Z])/g const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase()) -var _export_sfc = (sfc, props) => { +const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc for (const [key, val] of props) { target[key] = val @@ -73,7 +73,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { ]) ) } -var block = /* @__PURE__ */ _export_sfc(_sfc_main, [ +const block = /* @__PURE__ */ _export_sfc(_sfc_main, [ ['render', _sfc_render], ['__file', 'D:/tmp/buildground/buildground_1673597935715/src/block/generated/components/PortalBlock.vue'] ]) diff --git a/mockServer/assets/js/1005web-components.umd.js b/mockServer/assets/js/1005web-components.umd.js index 09985233a..049e2961b 100644 --- a/mockServer/assets/js/1005web-components.umd.js +++ b/mockServer/assets/js/1005web-components.umd.js @@ -11,25 +11,27 @@ */ ;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory( - require('@opentiny/tiny-engine-webcomponent-core'), - require('vue'), - require('vue-i18n'), - require('@opentiny/vue-icon') - )) - : typeof define === 'function' && define.amd - ? define(['@opentiny/tiny-engine-webcomponent-core', 'vue', 'vue-i18n', '@opentiny/vue-icon'], factory) - : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), - (global.TinyVueBlock = factory(global.TinyWebcomponentCore, global.Vue, global.VueI18n, global.TinyVueIcon))) -})(this, function (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon) { + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = factory( + require('@opentiny/tiny-engine-webcomponent-core'), + require('vue'), + require('vue-i18n'), + require('@opentiny/vue-icon') + ) + } else if (typeof define === 'function' && define.amd) { + define(['@opentiny/tiny-engine-webcomponent-core', 'vue', 'vue-i18n', '@opentiny/vue-icon'], factory) + } else { + ;(global = typeof globalThis !== 'undefined' ? globalThis : global || self), + (global.TinyVueBlock = factory(global.TinyWebcomponentCore, global.Vue, global.VueI18n, global.TinyVueIcon)) + } +})(this, (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon) => { function _interopNamespace(e) { if (e && e.__esModule) return e - var n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } }) + const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } }) if (e) { - Object.keys(e).forEach(function (k) { + Object.keys(e).forEach((k) => { if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k) + const d = Object.getOwnPropertyDescriptor(e, k) Object.defineProperty( n, k, @@ -45,10 +47,10 @@ } }) } - n['default'] = e + n.default = e return Object.freeze(n) } - var vue__namespace = /* @__PURE__ */ _interopNamespace(vue) + const vue__namespace = /* @__PURE__ */ _interopNamespace(vue) Object.freeze({}) Object.freeze([]) const cacheStringFunction = (fn) => { @@ -60,7 +62,7 @@ } const hyphenateRE = /\B([A-Z])/g const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase()) - var _export_sfc = (sfc, props) => { + const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc for (const [key, val] of props) { target[key] = val @@ -112,7 +114,7 @@ ]) ) } - var block = /* @__PURE__ */ _export_sfc(_sfc_main, [ + const block = /* @__PURE__ */ _export_sfc(_sfc_main, [ ['render', _sfc_render], ['__file', 'D:/tmp/buildground/buildground_1673597935715/src/block/generated/components/PortalBlock.vue'] ]) diff --git a/mockServer/assets/js/1505web-components.es.js b/mockServer/assets/js/1505web-components.es.js index 6fa9696be..1d33e4e1c 100644 --- a/mockServer/assets/js/1505web-components.es.js +++ b/mockServer/assets/js/1505web-components.es.js @@ -76,6 +76,6 @@ const Mapper = { TinyDropdown: Dropdown, TinyChartHistogram: ChartHistogram } -Mapper['TinyTabs'].isGroup = true -Mapper['TinyGrid'].isGroup = true +Mapper.TinyTabs.isGroup = true +Mapper.TinyGrid.isGroup = true export { Mapper as default } diff --git a/mockServer/assets/js/1505web-components.umd.js b/mockServer/assets/js/1505web-components.umd.js index 3fefed87d..baf686393 100644 --- a/mockServer/assets/js/1505web-components.umd.js +++ b/mockServer/assets/js/1505web-components.umd.js @@ -1,23 +1,25 @@ /** -* Copyright (c) 2023 - present TinyEngine Authors. -* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. -* -* Use of this source code is governed by an MIT-style license. -* -* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, -* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR -* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. -* -*/ + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ ;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('@opentiny/vue'))) - : typeof define === 'function' && define.amd - ? define(['@opentiny/vue'], factory) - : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), - (global.TinyLowcodeComponent = factory(global.TinyVue))) -})(this, function (tinyVue3) { + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = factory(require('@opentiny/vue')) + } else if (typeof define === 'function' && define.amd) { + define(['@opentiny/vue'], factory) + } else { + ;(global = typeof globalThis !== 'undefined' ? globalThis : global || self), + (global.TinyLowcodeComponent = factory(global.TinyVue)) + } +})(this, (tinyVue3) => { 'use strict' const Mapper = { TinyCarouselItem: tinyVue3.CarouselItem, @@ -52,7 +54,7 @@ TinyDropdown: tinyVue3.Dropdown, TinyChartHistogram: tinyVue3.ChartHistogram } - Mapper['TinyTabs'].isGroup = true - Mapper['TinyGrid'].isGroup = true + Mapper.TinyTabs.isGroup = true + Mapper.TinyGrid.isGroup = true return Mapper }) diff --git a/mockServer/assets/js/998web-components.es.js b/mockServer/assets/js/998web-components.es.js index 4dae48ff3..173aa1786 100644 --- a/mockServer/assets/js/998web-components.es.js +++ b/mockServer/assets/js/998web-components.es.js @@ -42,9 +42,9 @@ const cacheStringFunction = (fn) => { } const hyphenateRE = /\B([A-Z])/g const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase()) -var _style_0 = +const _style_0 = '\n.team-list-item.active[data-v-b66e3972] {\r\n border: 1px solid #38acff;\n}\n.toolbars-item[data-v-b66e3972]:hover {\r\n cursor: pointer;\r\n background-color: #f1f2f3;\n}\n.toolbars-item.active[data-v-b66e3972] {\r\n background-color: #e5e6e8;\n}\n' -var _export_sfc = (sfc, props) => { +const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc for (const [key, val] of props) { target[key] = val @@ -406,7 +406,7 @@ const _hoisted_22 = /* @__PURE__ */ _withScopeId(() => ) ) function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { - var _a + let _a const _component_tiny_icon_setting = resolveComponent('tiny-icon-setting') const _component_tiny_tooltip = resolveComponent('tiny-tooltip') const _component_tiny_icon_check_out = resolveComponent('tiny-icon-check-out') @@ -640,7 +640,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { ]) ) } -var block = /* @__PURE__ */ _export_sfc(_sfc_main, [ +const block = /* @__PURE__ */ _export_sfc(_sfc_main, [ ['render', _sfc_render], ['styles', [_style_0]], ['__scopeId', 'data-v-b66e3972'], diff --git a/mockServer/assets/js/998web-components.umd.js b/mockServer/assets/js/998web-components.umd.js index 13b18553a..312b59eba 100644 --- a/mockServer/assets/js/998web-components.umd.js +++ b/mockServer/assets/js/998web-components.umd.js @@ -11,36 +11,41 @@ */ ;(function (global, factory) { - typeof exports === 'object ' && typeof module !== 'undefined ' - ? (module.exports = factory( - require('@opentiny/tiny-engine-webcomponent-core '), - require('vue '), - require('vue-i18n '), - require('@opentiny/vue-icon '), - require('@opentiny/vue ') - )) - : typeof define === 'function ' && define.amd - ? define( - ['@opentiny/tiny-engine-webcomponent-core ', 'vue ', 'vue-i18n ', '@opentiny/vue-icon ', '@opentiny/vue '], - factory - ) - : ((global = typeof globalThis !== 'undefined ' ? globalThis : global || self), + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = factory( + require('@opentiny/tiny-engine-webcomponent-core'), + require('vue'), + require('vue-i18n'), + require('@opentiny/vue-icon'), + require('@opentiny/vue') + ) + } else if (typeof define === 'function ' && define.amd) { + define([ + '@opentiny/tiny-engine-webcomponent-core', + 'vue', + 'vue-i18n', + '@opentiny/vue-icon', + '@opentiny/vue' + ], factory) + } else { + ;(global = typeof globalThis !== 'undefined' ? globalThis : global || self), (global.TinyVueBlock = factory( global.TinyWebcomponentCore, global.Vue, global.VueI18n, global.TinyVueIcon, global.TinyVue - ))) -})(this, function (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon, tinyVue3) { + )) + } +})(this, (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon, tinyVue3) => { 'use strict ' function _interopNamespace(e) { if (e && e.__esModule) return e - var n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module ' } }) + const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module ' } }) if (e) { - Object.keys(e).forEach(function (k) { + Object.keys(e).forEach((k) => { if (k !== 'default ') { - var d = Object.getOwnPropertyDescriptor(e, k) + const d = Object.getOwnPropertyDescriptor(e, k) Object.defineProperty( n, k, @@ -59,7 +64,7 @@ n['default '] = e return Object.freeze(n) } - var vue__namespace = /* @__PURE__ */ _interopNamespace(vue) + const vue__namespace = /* @__PURE__ */ _interopNamespace(vue) Object.freeze({}) Object.freeze([]) const cacheStringFunction = (fn) => { @@ -71,9 +76,9 @@ } const hyphenateRE = /\B([A-Z])/g const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1 ').toLowerCase()) - var _style_0 = + const _style_0 = '\n.team-list-item.active[data-v-b66e3972] {\r\n border: 1px solid #38acff;\n}\n.toolbars-item[data-v-b66e3972]:hover {\r\n cursor: pointer;\r\n background-color: #f1f2f3;\n}\n.toolbars-item.active[data-v-b66e3972] {\r\n background-color: #e5e6e8;\n}\n ' - var _export_sfc = (sfc, props) => { + const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc for (const [key, val] of props) { target[key] = val @@ -446,7 +451,7 @@ ) ) function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { - var _a + let _a const _component_tiny_icon_setting = vue.resolveComponent('tiny-icon-setting ') const _component_tiny_tooltip = vue.resolveComponent('tiny-tooltip ') const _component_tiny_icon_check_out = vue.resolveComponent('tiny-icon-check-out ') @@ -688,7 +693,7 @@ ]) ) } - var block = /* @__PURE__ */ _export_sfc(_sfc_main, [ + const block = /* @__PURE__ */ _export_sfc(_sfc_main, [ ['render ', _sfc_render], ['styles ', [_style_0]], ['__scopeId ', 'data-v-b66e3972 '], diff --git a/mockServer/src/services/app.js b/mockServer/src/services/app.js index 3bfd17159..60821e43d 100644 --- a/mockServer/src/services/app.js +++ b/mockServer/src/services/app.js @@ -31,7 +31,7 @@ export default class AppService { // 拼装数据源 const dataSource = { list: source, - dataHandler: app['data_handler'] + dataHandler: app.data_handler } // 拼装工具类 const utils = [] @@ -47,7 +47,7 @@ export default class AppService { const i18n = this.formatI18nEntrites(entriesData) return getResponseData({ dataSource, - globalState: app['global_state'], + globalState: app.global_state, utils, i18n }) diff --git a/mockServer/src/services/blockCategory.js b/mockServer/src/services/blockCategory.js index fcf5240f6..401b963dd 100644 --- a/mockServer/src/services/blockCategory.js +++ b/mockServer/src/services/blockCategory.js @@ -49,7 +49,7 @@ export default class BlockCategoryService { const categories = await this.db.findOneAsync({ _id: id }) categories.blocks.push(params._id) await this.db.updateAsync({ _id: id }, { $set: categories }) - return + return getResponseData(categories) } params.app = appinfo.app await this.db.updateAsync({ _id: id }, { $set: params }) diff --git a/packages/canvas/src/components/render/render.js b/packages/canvas/src/components/render/render.js index f6d36f9ba..08b412a6c 100644 --- a/packages/canvas/src/components/render/render.js +++ b/packages/canvas/src/components/render/render.js @@ -169,6 +169,7 @@ const parseI18n = (i18n, scope, ctx) => { const renderDefault = (children, scope, parent) => children.map?.((child) => + // eslint-disable-next-line no-use-before-define h(renderer, { schema: child, scope, @@ -495,20 +496,22 @@ const stopEvent = (event) => { return false } -const generateSlotGroup = (children, isCustomElm) => { +const generateSlotGroup = (children, isCustomElm, schema) => { const slotGroup = {} children.forEach((child) => { const { componentName, children, params = [], props } = child const slot = child.slot || props?.slot?.name || props?.slot || 'default' + const isNotEmptyTemplate = componentName === 'Template' && children.length isCustomElm && (child.props.slot = 'slot') // CE下需要给子节点加上slot标识 slotGroup[slot] = slotGroup[slot] || { value: [], - params + params, + parent: isNotEmptyTemplate ? child : schema } - slotGroup[slot].value.push(...(componentName === 'Template' && children.length ? children : [child])) // template 标签直接过滤掉 + slotGroup[slot].value.push(...(isNotEmptyTemplate ? children : [child])) // template 标签直接过滤掉 }) return slotGroup @@ -516,11 +519,13 @@ const generateSlotGroup = (children, isCustomElm) => { const renderSlot = (children, scope, schema, isCustomElm) => { if (children.some((a) => a.componentName === 'Template')) { - const slotGroup = generateSlotGroup(children, isCustomElm) + const slotGroup = generateSlotGroup(children, isCustomElm, schema) const slots = {} Object.keys(slotGroup).forEach((slotName) => { - slots[slotName] = ($scope) => renderDefault(slotGroup[slotName].value, { ...scope, ...$scope }, schema) + const currentSlot = slotGroup[slotName] + + slots[slotName] = ($scope) => renderDefault(currentSlot.value, { ...scope, ...$scope }, currentSlot.parent) }) return slots diff --git a/packages/common/vite.config.js b/packages/common/vite.config.js index 147e729c2..fbd436ce0 100644 --- a/packages/common/vite.config.js +++ b/packages/common/vite.config.js @@ -40,7 +40,7 @@ export default defineConfig({ return 'import "./style.css"' } - return + return '' } }, external: ['vue', 'monaco-editor', /@opentiny\/tiny-engine.*/, /@opentiny\/vue.*/, /^prettier.*/] diff --git a/packages/plugins/block/src/js/blockSetting.jsx b/packages/plugins/block/src/js/blockSetting.jsx index 19e8410d7..9fc945011 100644 --- a/packages/plugins/block/src/js/blockSetting.jsx +++ b/packages/plugins/block/src/js/blockSetting.jsx @@ -522,7 +522,7 @@ const configureSlots = (blockSchema = {}) => { export const getDeployProgress = (taskId, block) => { fetchDeployProgress(taskId).then((data) => { block.deployStatus = data.taskStatus - block.publishProgress = data['progress_percent'] + block.publishProgress = data.progress_percent block.taskResult = data.taskResult if (block.publishProgress === PROGRESS.End) { diff --git a/packages/plugins/page/src/PageTree.vue b/packages/plugins/page/src/PageTree.vue index 38933a34f..af41500b9 100644 --- a/packages/plugins/page/src/PageTree.vue +++ b/packages/plugins/page/src/PageTree.vue @@ -113,6 +113,7 @@ export default { const secondGroupData = { groupName: '公共页面', groupId: COMMON_PAGE_GROUP_ID, data: [] } pagesData.forEach((item) => { + const namedNode = item.name ? item : { ...item, name: item.folderName, group: 'staticPages' } const node = item.meta ? { ...item, @@ -121,9 +122,7 @@ export default { isPage: true, isBody: item.meta.rootElement === ELEMENT_TAG.Body } - : item.name - ? item - : { ...item, name: item.folderName, group: 'staticPages' } + : namedNode const { children, ...other } = node @@ -258,7 +257,16 @@ export default { } else { data.trueFolder = false } + const isPageLocked = getCanvasStatus(data.occupier).state === PAGE_STATUS.Lock + const pageEditIcon = isPageLocked ? ( + openSettingPanel(e, node, isPageLocked)} + > + ) : null + return ( nodeClick(e, node)}> @@ -267,15 +275,7 @@ export default { {node.label} - {data.isPage ? ( - isPageLocked ? ( - openSettingPanel(e, node, isPageLocked)} - > - ) : null - ) : null} + {data.isPage ? pageEditIcon : null} {data.isHome ? ( diff --git a/packages/toolbars/save/src/js/index.js b/packages/toolbars/save/src/js/index.js index 33e1532dd..bdef0baf9 100644 --- a/packages/toolbars/save/src/js/index.js +++ b/packages/toolbars/save/src/js/index.js @@ -74,7 +74,7 @@ export const saveCommon = (value) => { pageSettingState.currentPageData[pageContent] = pageSchema - return + return Promise.resolve() } return isBlock() ? saveBlock(pageSchema) : savePage(pageSchema) diff --git a/packages/vue-generator/src/generator/page.js b/packages/vue-generator/src/generator/page.js index bdd0bb122..e63e826eb 100644 --- a/packages/vue-generator/src/generator/page.js +++ b/packages/vue-generator/src/generator/page.js @@ -54,8 +54,6 @@ function recurseChildren(children, state, description, result) { return result } -// const isEmptyRoot = (isRootNode, props) => isRootNode && Object.keys(props).length === 0 - const isEmptySlot = (componentName, children) => componentName === BUILTIN_COMPONENT_NAME.TEMPLATE && !(children?.length || children?.type) @@ -168,6 +166,8 @@ function handleBinding(props, attrsArr, description, state) { if (propType === 'i18n') { return attrsArr.push(`:${key}="t('${item.key}')"`) } + + return attrsArr }) } @@ -361,7 +361,6 @@ const generateVueCode = ({ schema, name, type, componentsMap }) => { // 转换 state 中的特殊类型 traverseState(state, description) - // const { utils, bridge } = wrap(function() { return this })() const usedResource = Object.keys(description.jsResource).filter((key) => description.jsResource[key]) const resourceStatement = usedResource.length ? `const { ${usedResource.join(',')} } = wrap(function() { return this })()` diff --git a/packages/vue-generator/src/utils/index.js b/packages/vue-generator/src/utils/index.js index 415778b05..9229f17d8 100644 --- a/packages/vue-generator/src/utils/index.js +++ b/packages/vue-generator/src/utils/index.js @@ -1,14 +1,14 @@ /** -* Copyright (c) 2023 - present TinyEngine Authors. -* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. -* -* Use of this source code is governed by an MIT-style license. -* -* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, -* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR -* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. -* -*/ + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ import { capitalize, hyphenate } from '@vue/shared' import { tinyIcon as unifyIconName } from '../pre-processor' @@ -26,17 +26,19 @@ const getFunctionInfo = (fnStr) => { params: result[3] .split(',') .map((item) => item.trim()) - .filter((item) => !!item), + .filter((item) => Boolean(item)), body: result[4] } } return null } +const safeRandom = () => crypto.getRandomValues(new Uint32Array(1))[0] / (Math.pow(2, 32) - 1) + const randomString = (length = 4, chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') => { let result = '' for (let i = length; i > 0; --i) { - result += chars[Math.floor(Math.random() * chars.length)] + result += chars[Math.floor(safeRandom() * chars.length)] } return result } @@ -142,6 +144,7 @@ const handleIconInProps = (description, iconProp) => { export { getTypeOfSchema, getFunctionInfo, + safeRandom, randomString, avoidDuplicateString, lowerFirst, diff --git a/packages/vue-generator/src/utils/vue-sfc-validator.js b/packages/vue-generator/src/utils/vue-sfc-validator.js index 7206662d4..0b7bbe301 100644 --- a/packages/vue-generator/src/utils/vue-sfc-validator.js +++ b/packages/vue-generator/src/utils/vue-sfc-validator.js @@ -1,14 +1,14 @@ /** -* Copyright (c) 2023 - present TinyEngine Authors. -* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. -* -* Use of this source code is governed by an MIT-style license. -* -* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, -* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR -* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. -* -*/ + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ import { parse as parseSFC, compileScript, compileStyle, compileTemplate } from '@vue/compiler-sfc' import { generateCodeFrame } from '@vue/shared' @@ -107,7 +107,7 @@ export function validateByCompile(filename, code) { // validate via compile style // 目前暂时没有预处理器,如:less const stylesResult = styles.map(({ content, module }) => - compileStyle({ source: content, filename, id, scoped, modules: !!module }) + compileStyle({ source: content, filename, id, scoped, modules: Boolean(module) }) ) const errorsInStyles = stylesResult .filter(({ errors }) => errors.length) From 0cc2993eb2678c29d6ce3ed908ed33ff96303d9e Mon Sep 17 00:00:00 2001 From: yaoyun8 <142570291+yaoyun8@users.noreply.github.com> Date: Thu, 7 Dec 2023 20:36:53 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20=E5=8F=98=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=8E=E4=BF=9D=E5=AD=98=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=94=B9=E5=8F=98=E9=87=8F=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=20(#110)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/toolbars/save/src/js/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/toolbars/save/src/js/index.js b/packages/toolbars/save/src/js/index.js index bdef0baf9..0094b9dbd 100644 --- a/packages/toolbars/save/src/js/index.js +++ b/packages/toolbars/save/src/js/index.js @@ -12,7 +12,7 @@ import { reactive, ref } from 'vue' import { useBlock, useCanvas, useLayout, useNotify, usePage } from '@opentiny/tiny-engine-controller' -import { getSchema, setSchema } from '@opentiny/tiny-engine-canvas' +import { getSchema, setSchema, selectNode } from '@opentiny/tiny-engine-canvas' import { constants } from '@opentiny/tiny-engine-utils' import { handlePageUpdate } from '@opentiny/tiny-engine-common/js/http' @@ -77,6 +77,9 @@ export const saveCommon = (value) => { return Promise.resolve() } + // 选中画布中的页面,关闭插件、属性配置 + selectNode(null) + return isBlock() ? saveBlock(pageSchema) : savePage(pageSchema) } export const openCommon = async () => { From 0478258c87c632c720d59c6ac7de23d6b7e5dcae Mon Sep 17 00:00:00 2001 From: yaoyun8 <142570291+yaoyun8@users.noreply.github.com> Date: Thu, 7 Dec 2023 20:37:19 +0800 Subject: [PATCH 03/11] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE=20(#106)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/canvas/src/components/render/render.js | 2 +- packages/common/component/BindI18n.vue | 2 +- packages/vue-generator/src/generator/page.js | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/canvas/src/components/render/render.js b/packages/canvas/src/components/render/render.js index 08b412a6c..6465e1b50 100644 --- a/packages/canvas/src/components/render/render.js +++ b/packages/canvas/src/components/render/render.js @@ -160,7 +160,7 @@ const parseI18n = (i18n, scope, ctx) => { return parseExpression( { type: 'JSExpression', - value: `this.i18n('${i18n.key}')` + value: `this.i18n('${i18n.key}', ${JSON.stringify(i18n.params)})` }, scope, { i18n: i18nHost.global.t, ...ctx } diff --git a/packages/common/component/BindI18n.vue b/packages/common/component/BindI18n.vue index b2d04a58f..9a93a2494 100644 --- a/packages/common/component/BindI18n.vue +++ b/packages/common/component/BindI18n.vue @@ -96,7 +96,7 @@ export default { const params = [] const data = props?.data?.params || {} - curValue.replace(/\$\{(.+?)\}/g, (substr, key) => { + curValue.replace(/\{(.+?)\}/g, (substr, key) => { key && params.push({ name: key, value: data[key] || '' }) }) paramsForm.value = params diff --git a/packages/vue-generator/src/generator/page.js b/packages/vue-generator/src/generator/page.js index e63e826eb..e30fb68ce 100644 --- a/packages/vue-generator/src/generator/page.js +++ b/packages/vue-generator/src/generator/page.js @@ -164,7 +164,12 @@ function handleBinding(props, attrsArr, description, state) { } if (propType === 'i18n') { - return attrsArr.push(`:${key}="t('${item.key}')"`) + const tArguments = [`'${item.key}'`] + const i18nParams = JSON.stringify(item.params)?.replace(/"/g, "'") + + i18nParams && tArguments.push(i18nParams) + + return attrsArr.push(`:${key}="t(${tArguments.join(',')})"`) } return attrsArr From fd5baf1660ff551760a0718a34b07b770e87311e Mon Sep 17 00:00:00 2001 From: chilingling <26962197+chilingling@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:34:43 -0800 Subject: [PATCH 04/11] feat(style): stylePanel add style selector, write css to global styles (#41) * feat(style): stylePanel add style selector, write css to global styles * feat(style): classNameSelector support edit and delete * fix(build): fix setting-style plugin build error * fix(chore): fix review comment --- .../src/components/container/container.js | 2 + packages/controller/src/useProperties.js | 15 +- packages/settings/styles/package.json | 3 + packages/settings/styles/src/Main.vue | 41 +- .../components/background/BackgroundGroup.vue | 1 - .../src/components/border/BorderGroup.vue | 2 - .../components/classNamesContainer/index.vue | 636 ++++++++++++++++++ .../src/components/effects/EffectGroup.vue | 1 - .../settings/styles/src/components/index.js | 65 +- .../styles/src/components/layout/FlexBox.vue | 1 - .../styles/src/components/layout/GridBox.vue | 1 - .../src/components/position/PositionGroup.vue | 3 - .../styles/src/components/size/SizeGroup.vue | 1 - .../src/components/spacing/SpacingGroup.vue | 36 +- .../components/typography/TypographyGroup.vue | 1 - packages/settings/styles/src/js/parser.js | 274 ++++++++ packages/settings/styles/src/js/useStyle.js | 402 ++++++++--- packages/theme/dark/settings.less | 21 + packages/theme/light/settings.less | 21 + 19 files changed, 1355 insertions(+), 172 deletions(-) create mode 100644 packages/settings/styles/src/components/classNamesContainer/index.vue create mode 100644 packages/settings/styles/src/js/parser.js diff --git a/packages/canvas/src/components/container/container.js b/packages/canvas/src/components/container/container.js index 10fd4d341..b62eff2d9 100644 --- a/packages/canvas/src/components/container/container.js +++ b/packages/canvas/src/components/container/container.js @@ -410,6 +410,8 @@ export const clearSelect = () => { canvasState.current = null canvasState.parent = null Object.assign(selectState, initialRectState) + // 临时借用 remote 事件出发 currentSchema 更新 + canvasState?.emit?.('remove') } export const querySelectById = (id, type = '') => { diff --git a/packages/controller/src/useProperties.js b/packages/controller/src/useProperties.js index dad95daf3..81e132aed 100644 --- a/packages/controller/src/useProperties.js +++ b/packages/controller/src/useProperties.js @@ -10,11 +10,13 @@ * */ -import { toRaw, nextTick, shallowReactive } from 'vue' +import { toRaw, nextTick, shallowReactive, ref } from 'vue' +import { getNode, setState, updateRect } from '@opentiny/tiny-engine-canvas' import useCanvas from './useCanvas' import useResource from './useResource' import useTranslate from './useTranslate' -import { getNode, setState, updateRect } from '@opentiny/tiny-engine-canvas' + +const propsUpdateKey = ref(0) const otherBaseKey = { className: { @@ -168,6 +170,10 @@ const getProps = (schema, parent) => { } const setProp = (name, value) => { + if (!properties.schema) { + return + } + properties.schema.props = properties.schema.props || {} if (value === '' || value === undefined || value === null) { @@ -178,6 +184,7 @@ const setProp = (name, value) => { // 没有父级,或者不在节点上面,要更新内容。就用setState getNode(properties.schema.id, true).parent || setState(useCanvas().getPageSchema().state) + propsUpdateKey.value++ nextTick(updateRect) } @@ -188,6 +195,7 @@ const getProp = (key) => { const delProp = (name) => { const props = properties.schema.props || {} delete props[name] + propsUpdateKey.value++ } const setProps = (schema) => { @@ -205,6 +213,7 @@ export default function () { translateProp, getSchema(parent) { return parent ? properties : properties.schema - } + }, + propsUpdateKey } } diff --git a/packages/settings/styles/package.json b/packages/settings/styles/package.json index 39d0f5843..4432befe2 100644 --- a/packages/settings/styles/package.json +++ b/packages/settings/styles/package.json @@ -28,8 +28,11 @@ "@opentiny/tiny-engine-common": "workspace:^1.0.0", "@opentiny/tiny-engine-controller": "workspace:^1.0.0", "@opentiny/tiny-engine-http": "workspace:^1.0.0", + "@opentiny/tiny-engine-utils": "workspace:^1.0.0", "@opentiny/vue": "~3.10.0", "@opentiny/vue-renderless": "~3.10.0", + "@vueuse/core": "^9.6.0", + "postcss": "^8.4.31", "vue": "3.2.45" }, "devDependencies": { diff --git a/packages/settings/styles/src/Main.vue b/packages/settings/styles/src/Main.vue index e0b7a7b64..4d0e4db65 100644 --- a/packages/settings/styles/src/Main.vue +++ b/packages/settings/styles/src/Main.vue @@ -17,7 +17,7 @@ @save="save(CSS_TYPE.Style, $event)" /> - + @@ -58,23 +58,26 @@ + + + diff --git a/packages/settings/styles/src/components/effects/EffectGroup.vue b/packages/settings/styles/src/components/effects/EffectGroup.vue index 7d46ea1b5..95c66a02a 100644 --- a/packages/settings/styles/src/components/effects/EffectGroup.vue +++ b/packages/settings/styles/src/components/effects/EffectGroup.vue @@ -388,7 +388,6 @@ export default { const { setPosition } = useModal() const { getSettingFlag, getProperty } = useProperties({ - props, names: Object.values(EFFECTS_PROPERTY), parseNumber: true }) diff --git a/packages/settings/styles/src/components/index.js b/packages/settings/styles/src/components/index.js index 31d6d66b6..ec2f4c1c7 100644 --- a/packages/settings/styles/src/components/index.js +++ b/packages/settings/styles/src/components/index.js @@ -1,41 +1,28 @@ /** -* Copyright (c) 2023 - present TinyEngine Authors. -* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. -* -* Use of this source code is governed by an MIT-style license. -* -* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, -* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR -* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. -* -*/ + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ -import BackgroundGroup from './background/BackgroundGroup.vue' -import BorderGroup from './border/BorderGroup.vue' -import EffectGroup from './effects/EffectGroup.vue' -import ImageSelect from './inputs/ImageSelect.vue' -import ResetButton from './inputs/ResetButton.vue' -import LayoutGroup from './layout/LayoutGroup.vue' -import PositionGroup from './position/PositionGroup.vue' -import BoxShadowGroup from './shadow/BoxShadowGroup.vue' -import SizeGroup from './size/SizeGroup.vue' -import SpacingGroup from './spacing/SpacingGroup.vue' -import SpacingSetting from './spacing/SpacingSetting.vue' -import TypographyGroup from './typography/TypographyGroup.vue' -import TypographyMore from './typography/TypographyMore.vue' - -export default { - BackgroundGroup, - BorderGroup, - EffectGroup, - ImageSelect, - ResetButton, - LayoutGroup, - PositionGroup, - BoxShadowGroup, - SizeGroup, - SpacingGroup, - SpacingSetting, - TypographyGroup, - TypographyMore -} +export { default as BackgroundGroup } from './background/BackgroundGroup.vue' +export { default as BorderGroup } from './border/BorderGroup.vue' +export { default as EffectGroup } from './effects/EffectGroup.vue' +export { default as ImageSelect } from './inputs/ImageSelect.vue' +export { default as ResetButton } from './inputs/ResetButton.vue' +export { default as LayoutGroup } from './layout/LayoutGroup.vue' +export { default as PositionGroup } from './position/PositionGroup.vue' +export { default as BoxShadowGroup } from './shadow/BoxShadowGroup.vue' +export { default as SizeGroup } from './size/SizeGroup.vue' +export { default as SpacingGroup } from './spacing/SpacingGroup.vue' +export { default as SpacingSetting } from './spacing/SpacingSetting.vue' +export { default as TypographyGroup } from './typography/TypographyGroup.vue' +export { default as TypographyMore } from './typography/TypographyMore.vue' +export { default as FlexBox } from './layout/FlexBox.vue' +export { default as GridBox } from './layout/GridBox.vue' +export { default as ClassNamesContainer } from './classNamesContainer/index.vue' diff --git a/packages/settings/styles/src/components/layout/FlexBox.vue b/packages/settings/styles/src/components/layout/FlexBox.vue index a92beacec..7aa410a20 100644 --- a/packages/settings/styles/src/components/layout/FlexBox.vue +++ b/packages/settings/styles/src/components/layout/FlexBox.vue @@ -176,7 +176,6 @@ export default { const showModal = ref(false) const { getSettingFlag } = useProperties({ - props, names: Object.values(FLEX_PROPERTY), parseNumber: true }) diff --git a/packages/settings/styles/src/components/layout/GridBox.vue b/packages/settings/styles/src/components/layout/GridBox.vue index ae377015b..5f07cefcf 100644 --- a/packages/settings/styles/src/components/layout/GridBox.vue +++ b/packages/settings/styles/src/components/layout/GridBox.vue @@ -361,7 +361,6 @@ export default { }) const { getProperty, getSettingFlag } = useProperties({ - props, names: Object.values(GRID_PROPERTY), parseNumber: true }) diff --git a/packages/settings/styles/src/components/position/PositionGroup.vue b/packages/settings/styles/src/components/position/PositionGroup.vue index a8e166420..f103ff021 100644 --- a/packages/settings/styles/src/components/position/PositionGroup.vue +++ b/packages/settings/styles/src/components/position/PositionGroup.vue @@ -221,7 +221,6 @@ import { reactive, watchEffect } from 'vue' import { Tooltip } from '@opentiny/vue' import { MetaSelect } from '@opentiny/tiny-engine-common' -import { camelize } from '@opentiny/tiny-engine-controller/utils' import { push } from '@opentiny/vue-renderless/common/array' import ModalMask, { useModal } from '../inputs/ModalMask.vue' import SpacingSetting from '../spacing/SpacingSetting.vue' @@ -368,7 +367,6 @@ export default { } const { getProperty, getSettingFlag, getPropertyValue, getPropertyText } = useProperties({ - props, names: Object.values(POSITION_PROPERTY), parseNumber: true }) @@ -413,7 +411,6 @@ export default { } const openDirectionSetting = (type, styleName) => { - styleName = camelize(styleName) state.property = { type, diff --git a/packages/settings/styles/src/components/size/SizeGroup.vue b/packages/settings/styles/src/components/size/SizeGroup.vue index b440f0765..84165a5b1 100644 --- a/packages/settings/styles/src/components/size/SizeGroup.vue +++ b/packages/settings/styles/src/components/size/SizeGroup.vue @@ -339,7 +339,6 @@ export default { }) const { getProperty, getSettingFlag, getPropertyValue } = useProperties({ - props, names: Object.values(SIZE_PROPERTY), parseNumber: true }) diff --git a/packages/settings/styles/src/components/spacing/SpacingGroup.vue b/packages/settings/styles/src/components/spacing/SpacingGroup.vue index bb45f860b..57dc55861 100644 --- a/packages/settings/styles/src/components/spacing/SpacingGroup.vue +++ b/packages/settings/styles/src/components/spacing/SpacingGroup.vue @@ -397,7 +397,6 @@ + + diff --git a/packages/blockToWebComponentTemplate/src/lib.js b/packages/blockToWebComponentTemplate/src/lib.js new file mode 100644 index 000000000..61a538b09 --- /dev/null +++ b/packages/blockToWebComponentTemplate/src/lib.js @@ -0,0 +1,20 @@ +import { hyphenate } from '@vue/shared' +import { defineCustomElement } from '@opentiny/tiny-engine-webcomponent-core' +import block from './BlockFileName.vue' + +window.TinyLowcodeResource = window.TinyLowcodeResource || {} + +const blockName = hyphenate('BlockFileName') + +if (customElements.get(blockName)) { + if (window.TinyLowcodeResource[blockName]) { + Object.assign(window.TinyLowcodeResource[blockName], block) + } +} else { + block.links = process.env.VUE_APP_UI_LIB_FULL_STYLE_FILE_URL + block.styles = ['svg { width: 10px; height: 10px;}', ...(block.styles || [])] + window.TinyLowcodeResource[blockName] = block + customElements.define(blockName, defineCustomElement(block)) +} + +export default block diff --git a/packages/blockToWebComponentTemplate/vite.config.js b/packages/blockToWebComponentTemplate/vite.config.js new file mode 100644 index 000000000..db65f1cc6 --- /dev/null +++ b/packages/blockToWebComponentTemplate/vite.config.js @@ -0,0 +1,66 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' +import path from 'path' + +const config = { + define: {}, + resolve: { + alias: {} + }, + build: { + cssCodeSplit: false, + minify: false, + commonjsOptions: { + transformMixedEsModules: true + }, + rollupOptions: { + external: [ + 'vue', + 'vue-i18n', + '@opentiny/tiny-engine-i18n-host', + '@opentiny/tiny-engine-webcomponent-core', + '@opentiny/vue', + '@opentiny/vue-icon' + ], + output: { + globals: { + vue: 'Vue', + 'vue-i18n': 'VueI18n', + '@opentiny/tiny-engine-i18n-host': 'TinyI18nHost', + '@opentiny/tiny-engine-webcomponent-core': 'TinyWebcomponentCore', + '@opentiny/vue': 'TinyVue', + '@opentiny/vue-icon': 'TinyVueIcon' + } + } + } + } +} + +export default defineConfig(({ command, mode }) => { + if (command !== 'build' || mode !== 'block') { + return + } + + const vuePluginConfig = {} + const styleLinks = ['https://registry.npmmirror.com/@opentiny/vue-theme/3.11/files/index.css'] + + config.publicDir = false + + config.build.lib = { + entry: path.resolve(__dirname, './src/lib.js'), + name: 'TinyVueBlock', + formats: ['umd', 'es'], + fileName: (format) => `js/web-component.${format}.js` + } + + vuePluginConfig.customElement = true + + config.plugins = [vue(vuePluginConfig), vueJsx()] + + config.define['process.env'] = { + VUE_APP_UI_LIB_FULL_STYLE_FILE_URL: styleLinks + } + + return config +}) From 1d4c32e279c1aac1f5116acc9290ea044f536bc3 Mon Sep 17 00:00:00 2001 From: yaoyun8 <142570291+yaoyun8@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:41:15 +0800 Subject: [PATCH 10/11] =?UTF-8?q?fix=EF=BC=9A=E5=88=A0=E9=99=A4lowcodeWrap?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E5=8F=82=E6=95=B0=20(#119)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vue-generator/src/generator/page.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-generator/src/generator/page.js b/packages/vue-generator/src/generator/page.js index e30fb68ce..fad6884fd 100644 --- a/packages/vue-generator/src/generator/page.js +++ b/packages/vue-generator/src/generator/page.js @@ -407,7 +407,7 @@ const props = defineProps({${propsArr.join(',\n')}}) const emit = defineEmits(${JSON.stringify(emitsArr)}) const { t, lowcodeWrap, stores } = vue.inject(I18nInjectionKey).lowcode() -const wrap = lowcodeWrap(props, { emit }, t) +const wrap = lowcodeWrap(props, { emit }) ${iconStatement} From 11e302f1f9e75f8c76bfb59e44e2da1053b62d01 Mon Sep 17 00:00:00 2001 From: chilingling <26962197+chilingling@users.noreply.github.com> Date: Fri, 15 Dec 2023 00:08:26 -0800 Subject: [PATCH 11/11] fix(chore): replace unpkg with npmmirror (#149) * fix(chore): replace unpkg with npmmirror * fix(dev): dev environment use node_moduels * fix(chore): sync version * fix(preview): use npmmirror link * fix(preview): devtoolapi use unpkg link * fix(preview): import map add esm cdn * fix(version): fix tiny-vue version * fix(version): fix tiny-vue version * fix(version): fix tiny-vue version --- packages/design-core/canvas.html | 2 +- packages/design-core/package.json | 2 + .../src/preview/src/preview/importMap.js | 37 ++++++++++--------- .../src/preview/src/preview/srcFiles/app.js | 24 ++++++------ packages/design-core/vite.config.js | 10 +++-- 5 files changed, 41 insertions(+), 34 deletions(-) diff --git a/packages/design-core/canvas.html b/packages/design-core/canvas.html index 17a98930f..c07062ef3 100644 --- a/packages/design-core/canvas.html +++ b/packages/design-core/canvas.html @@ -4,7 +4,7 @@ - +