From 0643699fac04389ac78fbc50cad24f6e7d3d5f1a Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 27 Aug 2025 15:43:28 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4ui/ui-react?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/.env.vue | 1 - playground/.env.vue3 | 2 + playground/package.json | 4 +- pnpm-lock.yaml | 118 +++++------------- react-components/qrcode/package.json | 2 +- runtime/react/build.vite.config.ts | 77 ------------ runtime/react/package.json | 27 ++-- runtime/react/page/vite.config.ts | 36 ++++++ runtime/react/playground/vite.config.ts | 35 ++++++ runtime/react/scripts/build.mjs | 30 +++++ runtime/react/scripts/vite.res.config.mjs | 47 +++++++ runtime/react/tmagic.config.ts | 21 +++- .../{dev.vite.config.ts => vite.config.ts} | 39 +++--- runtime/ui-react/README.md | 1 - runtime/ui-react/package.json | 38 ------ runtime/ui-react/src/index.ts | 54 -------- runtime/ui/README.md | 1 - runtime/ui/package.json | 41 ------ runtime/ui/src/index.ts | 54 -------- runtime/vue/page/vite.config.ts | 2 +- runtime/vue/tmagic.config.ts | 21 +++- 21 files changed, 259 insertions(+), 392 deletions(-) delete mode 100644 playground/.env.vue create mode 100644 playground/.env.vue3 delete mode 100644 runtime/react/build.vite.config.ts create mode 100644 runtime/react/page/vite.config.ts create mode 100644 runtime/react/playground/vite.config.ts create mode 100644 runtime/react/scripts/build.mjs create mode 100644 runtime/react/scripts/vite.res.config.mjs rename runtime/react/{dev.vite.config.ts => vite.config.ts} (73%) delete mode 100644 runtime/ui-react/README.md delete mode 100644 runtime/ui-react/package.json delete mode 100644 runtime/ui-react/src/index.ts delete mode 100644 runtime/ui/README.md delete mode 100644 runtime/ui/package.json delete mode 100644 runtime/ui/src/index.ts diff --git a/playground/.env.vue b/playground/.env.vue deleted file mode 100644 index fa601543..00000000 --- a/playground/.env.vue +++ /dev/null @@ -1 +0,0 @@ -VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue VITE_ENTRY_PATH=./entry/vue diff --git a/playground/.env.vue3 b/playground/.env.vue3 new file mode 100644 index 00000000..abe6b6f9 --- /dev/null +++ b/playground/.env.vue3 @@ -0,0 +1,2 @@ +VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue +VITE_ENTRY_PATH=./entry/vue diff --git a/playground/package.json b/playground/package.json index 65b08984..e6761f56 100644 --- a/playground/package.json +++ b/playground/package.json @@ -5,9 +5,9 @@ "private": true, "scripts": { "clean:top": "rimraf dist", - "dev": "vite --mode vue", + "dev": "vite --mode vue3", "dev:react": "vite --mode react", - "build": "npm run clean:top && node --max_old_space_size=8192 node_modules/vite/bin/vite.js build --mode vue", + "build": "npm run clean:top && node --max_old_space_size=8192 node_modules/vite/bin/vite.js build --mode vue3", "serve": "vite preview" }, "dependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index deafff96..fddb5b11 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -910,8 +910,11 @@ importers: specifier: 1.6.0-beta.6 version: 1.6.0-beta.6(@tmagic/core@1.6.0-beta.6(typescript@5.9.2))(typescript@5.9.2) axios: - specifier: ^1.10.0 - version: 1.10.0 + specifier: ^1.11.0 + version: 1.11.0 + qrcode: + specifier: ^1.5.0 + version: 1.5.4 react: specifier: ^18.3.1 version: 18.3.1 @@ -922,6 +925,9 @@ importers: '@tmagic/cli': specifier: 1.6.0-beta.6 version: 1.6.0-beta.6(typescript@5.9.2) + '@types/fs-extra': + specifier: ^11.0.4 + version: 11.0.4 '@types/react': specifier: ^18.3.3 version: 18.3.18 @@ -934,6 +940,9 @@ importers: '@vitejs/plugin-react-refresh': specifier: ^1.3.6 version: 1.3.6 + fs-extra: + specifier: ^11.3.1 + version: 11.3.1 terser: specifier: ^5.43.1 version: 5.43.1 @@ -943,6 +952,9 @@ importers: vite: specifier: 'catalog:' version: 7.1.3(@types/node@24.0.10)(jiti@2.4.2)(sass@1.91.0)(terser@5.43.1)(yaml@2.8.0) + vite-plugin-commonjs: + specifier: ^0.10.4 + version: 0.10.4 runtime/react-runtime-help: dependencies: @@ -987,78 +999,6 @@ importers: specifier: 'catalog:' version: 3.5.20(typescript@5.9.2) - runtime/ui: - dependencies: - '@tmagic/vue-button': - specifier: workspace:* - version: link:../../vue-components/button - '@tmagic/vue-container': - specifier: workspace:* - version: link:../../vue-components/container - '@tmagic/vue-img': - specifier: workspace:* - version: link:../../vue-components/img - '@tmagic/vue-iterator-container': - specifier: workspace:* - version: link:../../vue-components/iterator-container - '@tmagic/vue-overlay': - specifier: workspace:* - version: link:../../vue-components/overlay - '@tmagic/vue-page': - specifier: workspace:* - version: link:../../vue-components/page - '@tmagic/vue-page-fragment': - specifier: workspace:* - version: link:../../vue-components/page-fragment - '@tmagic/vue-page-fragment-container': - specifier: workspace:* - version: link:../../vue-components/page-fragment-container - '@tmagic/vue-qrcode': - specifier: workspace:* - version: link:../../vue-components/qrcode - '@tmagic/vue-text': - specifier: workspace:* - version: link:../../vue-components/text - typescript: - specifier: 'catalog:' - version: 5.9.2 - - runtime/ui-react: - dependencies: - '@tmagic/react-button': - specifier: workspace:* - version: link:../../react-components/button - '@tmagic/react-container': - specifier: workspace:* - version: link:../../react-components/container - '@tmagic/react-img': - specifier: workspace:* - version: link:../../react-components/img - '@tmagic/react-iterator-container': - specifier: workspace:* - version: link:../../react-components/iterator-container - '@tmagic/react-overlay': - specifier: workspace:* - version: link:../../react-components/overlay - '@tmagic/react-page': - specifier: workspace:* - version: link:../../react-components/page - '@tmagic/react-page-fragment': - specifier: workspace:* - version: link:../../react-components/page-fragment - '@tmagic/react-page-fragment-container': - specifier: workspace:* - version: link:../../react-components/page-fragment-container - '@tmagic/react-qrcode': - specifier: workspace:* - version: link:../../react-components/qrcode - '@tmagic/react-text': - specifier: workspace:* - version: link:../../react-components/text - typescript: - specifier: 'catalog:' - version: 5.9.2 - runtime/vue: dependencies: '@tmagic/core': @@ -3890,9 +3830,6 @@ packages: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} - axios@1.10.0: - resolution: {integrity: sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==} - axios@1.11.0: resolution: {integrity: sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==} @@ -6703,6 +6640,12 @@ packages: engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true + vite-plugin-commonjs@0.10.4: + resolution: {integrity: sha512-eWQuvQKCcx0QYB5e5xfxBNjQKyrjEWZIR9UOkOV6JAgxVhtbZvCOF+FNC2ZijBJ3U3Px04ZMMyyMyFBVWIJ5+g==} + + vite-plugin-dynamic-import@1.6.0: + resolution: {integrity: sha512-TM0sz70wfzTIo9YCxVFwS8OA9lNREsh+0vMHGSkWDTZ7bgd1Yjs5RV8EgB634l/91IsXJReg0xtmuQqP0mf+rg==} + vite@5.4.16: resolution: {integrity: sha512-Y5gnfp4NemVfgOTDQAunSD4346fal44L9mszGGY/e+qxsRT5y1sMlS/8tiQ8AFAp+MFgYNSINdfEchJiPm41vQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -9845,14 +9788,6 @@ snapshots: dependencies: possible-typed-array-names: 1.1.0 - axios@1.10.0: - dependencies: - follow-redirects: 1.15.9 - form-data: 4.0.2 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - axios@1.11.0: dependencies: follow-redirects: 1.15.9 @@ -13160,6 +13095,19 @@ snapshots: - tsx - yaml + vite-plugin-commonjs@0.10.4: + dependencies: + acorn: 8.15.0 + magic-string: 0.30.17 + vite-plugin-dynamic-import: 1.6.0 + + vite-plugin-dynamic-import@1.6.0: + dependencies: + acorn: 8.15.0 + es-module-lexer: 1.7.0 + fast-glob: 3.3.3 + magic-string: 0.30.17 + vite@5.4.16(@types/node@24.0.10)(sass@1.91.0)(terser@5.43.1): dependencies: esbuild: 0.21.5 diff --git a/react-components/qrcode/package.json b/react-components/qrcode/package.json index 00214823..9ac302fe 100644 --- a/react-components/qrcode/package.json +++ b/react-components/qrcode/package.json @@ -30,7 +30,7 @@ } }, "devDependencies": { - "@types/qrcode": "^1.4.2", + "@types/qrcode": "^1.4.2", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0" } diff --git a/runtime/react/build.vite.config.ts b/runtime/react/build.vite.config.ts deleted file mode 100644 index b095905c..00000000 --- a/runtime/react/build.vite.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making TMagicEditor available. - * - * Copyright (C) 2025 Tencent. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import path from 'path'; - -import { defineConfig } from 'vite'; -import legacy from '@vitejs/plugin-legacy'; -import reactRefresh from '@vitejs/plugin-react-refresh'; - -export default defineConfig(({ mode }) => { - if (['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event'].includes(mode)) { - const capitalToken = mode - .split(':') - .map((word) => word[0].toUpperCase() + word.slice(1)) - .join(''); - - const fileName = mode.replace(':', '-'); - - return { - publicDir: './.tmagic/public', - build: { - cssCodeSplit: false, - sourcemap: true, - minify: false, - target: 'esnext', - outDir: `../../playground/public/entry/react/${fileName}`, - - lib: { - entry: `.tmagic/${fileName}-entry.ts`, - name: `magicPreset${capitalToken}s`, - fileName: 'index', - formats: ['umd'], - }, - }, - }; - } - - if (['page', 'playground'].includes(mode)) { - return { - plugins: [ - reactRefresh(), - legacy({ - targets: ['defaults', 'not IE 11'], - }), - ], - - root: `./${mode}/`, - - publicDir: '../public', - - base: `/tmagic-editor/playground/runtime/react/${mode}`, - - build: { - emptyOutDir: true, - sourcemap: true, - outDir: path.resolve(process.cwd(), `../../playground/public/runtime/react/${mode}`), - }, - }; - } - - return {}; -}); diff --git a/runtime/react/package.json b/runtime/react/package.json index 3e9f88b5..03c90aac 100644 --- a/runtime/react/package.json +++ b/runtime/react/package.json @@ -7,36 +7,33 @@ "node": "^20.19.0 || >=22.12.0" }, "scripts": { - "dev:react": "vite --config dev.vite.config.ts", - "dev:playground": "vite --config dev.vite.config.ts", - "build": "npm run build:libs && npm run build:page && npm run build:playground", - "build:page": "vite build --config build.vite.config.ts --mode page", - "build:playground": "vite build --config build.vite.config.ts --mode playground", - "build:libs": "tmagic entry && npm run build:config && npm run build:value && npm run build:event && npm run build:ds:libs", - "build:ds:libs": "npm run build:ds:config && npm run build:ds:value && npm run build:ds:event", - "build:config": "vite build --config build.vite.config.ts --mode config", - "build:value": "vite build --config build.vite.config.ts --mode value", - "build:event": "vite build --config build.vite.config.ts --mode event", - "build:ds:config": "vite build --config build.vite.config.ts --mode ds:config", - "build:ds:value": "vite build --config build.vite.config.ts --mode ds:value", - "build:ds:event": "vite build --config build.vite.config.ts --mode ds:event" + "tmagic": "tmagic entry", + "dev:react": "vite --force", + "serve": "vite preview", + "build": "rimraf ./dist && node scripts/build.mjs --type=all && npm run build:client", + "build:libs": "tmagic entry && node scripts/build.mjs --type=res", + "build:client": "vite build --config ./page/vite.config.ts && vite build --config ./playground/vite.config.ts" }, "dependencies": { "@tmagic/core": "1.6.0-beta.6", "@tmagic/react-runtime-help": "0.2.0", "@tmagic/stage": "1.6.0-beta.6", - "axios": "^1.10.0", + "axios": "^1.11.0", + "qrcode": "^1.5.0", "react": "^18.3.1", "react-dom": "^18.3.1" }, "devDependencies": { "@tmagic/cli": "1.6.0-beta.6", + "@types/fs-extra": "^11.0.4", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@vitejs/plugin-legacy": "^7.2.1", "@vitejs/plugin-react-refresh": "^1.3.6", + "fs-extra": "^11.3.1", "typescript": "catalog:", "terser": "^5.43.1", - "vite": "catalog:" + "vite": "catalog:", + "vite-plugin-commonjs": "^0.10.4" } } diff --git a/runtime/react/page/vite.config.ts b/runtime/react/page/vite.config.ts new file mode 100644 index 00000000..2f46be6b --- /dev/null +++ b/runtime/react/page/vite.config.ts @@ -0,0 +1,36 @@ +import path from 'node:path'; + +import { defineConfig } from 'vite'; + +import fse from 'fs-extra'; + +import baseConfig from '../vite.config'; + +export default defineConfig({ + ...baseConfig, + + plugins: [ + ...(baseConfig.plugins || []), + { + name: 'vite-plugin-copy-runtime', + apply: 'build', + enforce: 'post', + closeBundle() { + const clientFile = path.resolve(__dirname, '../dist/page') + fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/react/page')) + }, + } + ], + + root: './page', + + publicDir: '../public', + + base: `${baseConfig.base}/page`, + + build: { + emptyOutDir: false, + sourcemap: true, + outDir: '../dist/page', + }, +}); diff --git a/runtime/react/playground/vite.config.ts b/runtime/react/playground/vite.config.ts new file mode 100644 index 00000000..0a855a13 --- /dev/null +++ b/runtime/react/playground/vite.config.ts @@ -0,0 +1,35 @@ +import path from 'node:path'; + +import { defineConfig } from 'vite'; +import fse from 'fs-extra'; + +import baseConfig from '../vite.config'; + +export default defineConfig({ + ...baseConfig, + + plugins: [ + ...(baseConfig.plugins || []), + { + name: 'vite-plugin-copy-runtime', + apply: 'build', + enforce: 'post', + closeBundle() { + const clientFile = path.resolve(__dirname, '../dist/playground') + fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/react/playground')) + }, + } + ], + + root: './playground', + + publicDir: '../public', + + base: `${baseConfig.base}/playground`, + + build: { + emptyOutDir: false, + sourcemap: true, + outDir: '../dist/playground', + }, +}); diff --git a/runtime/react/scripts/build.mjs b/runtime/react/scripts/build.mjs new file mode 100644 index 00000000..7853c7cb --- /dev/null +++ b/runtime/react/scripts/build.mjs @@ -0,0 +1,30 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { build as buildVite } from 'vite'; +import minimist from 'minimist'; + +import resViteConfig from './vite.res.config.mjs'; + +const args = minimist(process.argv.slice(2)); + +const dirname = path.dirname(fileURLToPath(import.meta.url)); + +const buildList = []; + +const buildRes = args.type === 'res' || args.type === 'all'; + +if (buildRes) { + for (const mode of ['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event']) { + buildList.push( + buildVite({ + root: path.resolve(dirname, '../'), + clearScreen: false, + configFile: false, + ...resViteConfig(mode), + }), + ); + } +} + +Promise.all(buildList); diff --git a/runtime/react/scripts/vite.res.config.mjs b/runtime/react/scripts/vite.res.config.mjs new file mode 100644 index 00000000..843a830e --- /dev/null +++ b/runtime/react/scripts/vite.res.config.mjs @@ -0,0 +1,47 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { defineConfig } from 'vite'; +import fse from 'fs-extra'; + +const dirname = path.dirname(fileURLToPath(import.meta.url)); + +export default defineConfig((mode) => { + const capitalToken = mode + .split(':') + .map((word) => word[0].toUpperCase() + word.slice(1)) + .join(''); + + const fileName = mode.replace(':', '-'); + + const publicPath = path.resolve(dirname, '../dist/entry', fileName); + fse.removeSync(publicPath); + + return { + plugins: [ + { + name: 'vite-plugin-copy-runtime', + apply: 'build', + enforce: 'post', + closeBundle() { + fse.copySync(publicPath, path.resolve(dirname, `../../../playground/public/entry/react/${fileName}`)); + }, + }, + ], + publicDir: './.tmagic/public', + build: { + cssCodeSplit: false, + sourcemap: true, + minify: false, + target: 'esnext', + outDir: `./dist/entry/${fileName}`, + + lib: { + entry: `.tmagic/${fileName}-entry.ts`, + name: `magicPreset${capitalToken}s`, + fileName: 'index', + formats: ['umd'], + }, + }, + }; +}); diff --git a/runtime/react/tmagic.config.ts b/runtime/react/tmagic.config.ts index cd8898c9..cf070b21 100644 --- a/runtime/react/tmagic.config.ts +++ b/runtime/react/tmagic.config.ts @@ -1,8 +1,23 @@ -import path from 'path'; - import { defineConfig } from '@tmagic/cli'; export default defineConfig({ - packages: [path.join(__dirname, '../ui-react')], componentFileAffix: '.tsx', + npmConfig: { + client: 'pnpm', + keepPackageJsonClean: true, + }, + packages: [ + { + button: '@tmagic/react-button' , + container: '@tmagic/react-container' , + img: '@tmagic/react-img' , + 'iterator-container': '@tmagic/react-iterator-container' , + overlay: '@tmagic/react-overlay' , + page: '@tmagic/react-page' , + 'page-fragment': '@tmagic/react-page-fragment' , + 'page-fragment-container': '@tmagic/react-page-fragment-container' , + 'qrcode': '@tmagic/react-qrcode' , + 'text': '@tmagic/react-text' , + } + ], }); diff --git a/runtime/react/dev.vite.config.ts b/runtime/react/vite.config.ts similarity index 73% rename from runtime/react/dev.vite.config.ts rename to runtime/react/vite.config.ts index 21e39c95..31c3c3f9 100644 --- a/runtime/react/dev.vite.config.ts +++ b/runtime/react/vite.config.ts @@ -16,13 +16,28 @@ * limitations under the License. */ -import path from 'path'; +import path from 'node:path'; import { defineConfig } from 'vite'; +import legacy from '@vitejs/plugin-legacy'; import reactRefresh from '@vitejs/plugin-react-refresh'; +import commonjs from 'vite-plugin-commonjs'; export default defineConfig({ - plugins: [reactRefresh()], + plugins: [ + commonjs({ + filter: (id) => { + if (id.includes('qrcode')) { + return true; + } + return false; + }, + }), + reactRefresh(), + legacy({ + targets: ['defaults', 'not IE 11'], + }) + ], resolve: { alias: [ @@ -34,17 +49,18 @@ export default defineConfig({ }, { find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') }, { find: /^@tmagic\/core/, replacement: path.join(__dirname, '../../packages/core/src/index.ts') }, - { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, - { find: /^@data-source/, replacement: path.join(__dirname, '../../packages/data-source/src') }, { find: /^@tmagic\/data-source/, replacement: path.join(__dirname, '../../packages/data-source/src/index.ts') }, { find: /^@tmagic\/dep/, replacement: path.join(__dirname, '../../packages/dep/src/index.ts') }, - { find: /^@tmagic\/react-runtime-help/, replacement: path.join(__dirname, '../react-runtime-help/src/index.ts') }, + { find: /^@data-source/, replacement: path.join(__dirname, '../../packages/data-source/src') }, + { find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') }, + { find: /^@tmagic\/vue-runtime-help/, replacement: path.join(__dirname, '../vue-runtime-help/src/index.ts') }, + { find: /^qrcode/, replacement: path.join(__dirname, './node_modules/qrcode') }, ], }, root: './', - base: '/tmagic-editor/playground/runtime/react/', + base: '/tmagic-editor/playground/runtime/react', publicDir: 'public', @@ -55,17 +71,10 @@ export default defineConfig({ }, build: { - sourcemap: true, - - cssCodeSplit: false, - rollupOptions: { input: { - page: './page/index.html', - playground: './playground/index.html', - }, - output: { - entryFileNames: 'assets/[name].js', + page: path.resolve(__dirname, './page/index.html'), + playground: path.resolve(__dirname, './playground/index.html'), }, }, }, diff --git a/runtime/ui-react/README.md b/runtime/ui-react/README.md deleted file mode 100644 index 0c425cb8..00000000 --- a/runtime/ui-react/README.md +++ /dev/null @@ -1 +0,0 @@ -# [文档](https://tencent.github.io/tmagic-editor/docs/) \ No newline at end of file diff --git a/runtime/ui-react/package.json b/runtime/ui-react/package.json deleted file mode 100644 index 8b19aa0b..00000000 --- a/runtime/ui-react/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@tmagic/ui-react", - "version": "1.5.18", - "type": "module", - "main": "dist/tmagic-ui-react.js", - "types": "types/index.d.ts", - "files": [ - "src" - ], - "engines": { - "node": ">=18" - }, - "repository": { - "directory": "runtime/ui-react", - "type": "git", - "url": "https://github.com/Tencent/tmagic-editor.git" - }, - "dependencies": { - "@tmagic/react-button": "workspace:*", - "@tmagic/react-container": "workspace:*", - "@tmagic/react-img": "workspace:*", - "@tmagic/react-iterator-container": "workspace:*", - "@tmagic/react-overlay": "workspace:*", - "@tmagic/react-page": "workspace:*", - "@tmagic/react-page-fragment": "workspace:*", - "@tmagic/react-page-fragment-container": "workspace:*", - "@tmagic/react-qrcode": "workspace:*", - "@tmagic/react-text": "workspace:*" - }, - "peerDependencies": { - "typescript": "catalog:" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } -} diff --git a/runtime/ui-react/src/index.ts b/runtime/ui-react/src/index.ts deleted file mode 100644 index a345efa9..00000000 --- a/runtime/ui-react/src/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making TMagicEditor available. - * - * Copyright (C) 2025 Tencent. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Button from '@tmagic/react-button'; -import Container from '@tmagic/react-container'; -import Img from '@tmagic/react-img'; -import IteratorContainer from '@tmagic/react-iterator-container'; -import Overlay from '@tmagic/react-overlay'; -import Page from '@tmagic/react-page'; -import PageFragment from '@tmagic/react-page-fragment'; -import PageFragmentContainer from '@tmagic/react-page-fragment-container'; -import QRcode from '@tmagic/react-qrcode'; -import Text from '@tmagic/react-text'; - -export { default as TMagicUiButton } from '@tmagic/react-button'; -export { default as TMagicUiContainer } from '@tmagic/react-container'; -export { default as TMagicUiImg } from '@tmagic/react-img'; -export { default as TMagicUiIteratorContainer } from '@tmagic/react-iterator-container'; -export { default as TMagicUiOverlay } from '@tmagic/react-overlay'; -export { default as TMagicUiPage } from '@tmagic/react-page'; -export { default as TMagicUiPageFragment } from '@tmagic/react-page-fragment'; -export { default as TMagicUiPageFragmentContainer } from '@tmagic/react-page-fragment-container'; -export { default as TMagicUiQRcode } from '@tmagic/react-qrcode'; -export { default as TMagicUiText } from '@tmagic/react-text'; - -const ui: Record = { - page: Page, - container: Container, - button: Button, - text: Text, - img: Img, - qrcode: QRcode, - overlay: Overlay, - 'page-fragment-container': PageFragmentContainer, - 'page-fragment': PageFragment, - 'iterator-container': IteratorContainer, -}; - -export default ui; diff --git a/runtime/ui/README.md b/runtime/ui/README.md deleted file mode 100644 index 0c425cb8..00000000 --- a/runtime/ui/README.md +++ /dev/null @@ -1 +0,0 @@ -# [文档](https://tencent.github.io/tmagic-editor/docs/) \ No newline at end of file diff --git a/runtime/ui/package.json b/runtime/ui/package.json deleted file mode 100644 index a3aa6222..00000000 --- a/runtime/ui/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "version": "1.6.0-beta.0", - "name": "@tmagic/ui", - "type": "module", - "main": "dist/tmagic-ui.js", - "types": "types/index.d.ts", - "files": [ - "src", - "dist", - "types" - ], - "engines": { - "node": ">=18" - }, - "license": "Apache-2.0", - "repository": { - "directory": "runtime/ui", - "type": "git", - "url": "https://github.com/Tencent/tmagic-editor.git" - }, - "dependencies": { - "@tmagic/vue-button": "workspace:*", - "@tmagic/vue-container": "workspace:*", - "@tmagic/vue-img": "workspace:*", - "@tmagic/vue-iterator-container": "workspace:*", - "@tmagic/vue-overlay": "workspace:*", - "@tmagic/vue-page": "workspace:*", - "@tmagic/vue-page-fragment": "workspace:*", - "@tmagic/vue-page-fragment-container": "workspace:*", - "@tmagic/vue-qrcode": "workspace:*", - "@tmagic/vue-text": "workspace:*" - }, - "peerDependencies": { - "typescript": "catalog:" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } -} diff --git a/runtime/ui/src/index.ts b/runtime/ui/src/index.ts deleted file mode 100644 index 17981221..00000000 --- a/runtime/ui/src/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making TMagicEditor available. - * - * Copyright (C) 2025 Tencent. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Button from '@tmagic/vue-button'; -import Container from '@tmagic/vue-container'; -import Img from '@tmagic/vue-img'; -import IteratorContainer from '@tmagic/vue-iterator-container'; -import Overlay from '@tmagic/vue-overlay'; -import Page from '@tmagic/vue-page'; -import PageFragment from '@tmagic/vue-page-fragment'; -import PageFragmentContainer from '@tmagic/vue-page-fragment-container'; -import QRcode from '@tmagic/vue-qrcode'; -import Text from '@tmagic/vue-text'; - -export { default as TMagicUiButton } from '@tmagic/vue-button'; -export { default as TMagicUiContainer } from '@tmagic/vue-container'; -export { default as TMagicUiImg } from '@tmagic/vue-img'; -export { default as TMagicUiIteratorContainer } from '@tmagic/vue-iterator-container'; -export { default as TMagicUiOverlay } from '@tmagic/vue-overlay'; -export { default as TMagicUiPage } from '@tmagic/vue-page'; -export { default as TMagicUiPageFragment } from '@tmagic/vue-page-fragment'; -export { default as TMagicUiPageFragmentContainer } from '@tmagic/vue-page-fragment-container'; -export { default as TMagicUiQRcode } from '@tmagic/vue-qrcode'; -export { default as TMagicUiText } from '@tmagic/vue-text'; - -const ui: Record = { - page: Page, - container: Container, - button: Button, - text: Text, - img: Img, - qrcode: QRcode, - overlay: Overlay, - 'page-fragment-container': PageFragmentContainer, - 'page-fragment': PageFragment, - 'iterator-container': IteratorContainer, -}; - -export default ui; diff --git a/runtime/vue/page/vite.config.ts b/runtime/vue/page/vite.config.ts index cb533f48..7ffa0ff0 100644 --- a/runtime/vue/page/vite.config.ts +++ b/runtime/vue/page/vite.config.ts @@ -17,7 +17,7 @@ export default defineConfig({ enforce: 'post', closeBundle() { const clientFile = path.resolve(__dirname, '../dist/page') - fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/vue/runtime/page')) + fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/vue/page')) }, } ], diff --git a/runtime/vue/tmagic.config.ts b/runtime/vue/tmagic.config.ts index a5eadd7b..511404b6 100644 --- a/runtime/vue/tmagic.config.ts +++ b/runtime/vue/tmagic.config.ts @@ -1,9 +1,24 @@ -import path from 'path'; - import { defineConfig } from '@tmagic/cli'; export default defineConfig({ - packages: [path.join(__dirname, '../ui')], componentFileAffix: '.vue', dynamicImport: true, + npmConfig: { + client: 'pnpm', + keepPackageJsonClean: true, + }, + packages: [ + { + button: '@tmagic/vue-button' , + container: '@tmagic/vue-container' , + img: '@tmagic/vue-img' , + 'iterator-container': '@tmagic/vue-iterator-container' , + overlay: '@tmagic/vue-overlay' , + page: '@tmagic/vue-page' , + 'page-fragment': '@tmagic/vue-page-fragment' , + 'page-fragment-container': '@tmagic/vue-page-fragment-container' , + 'qrcode': '@tmagic/vue-qrcode' , + 'text': '@tmagic/vue-text' , + } + ], });