mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 02:28:04 +08:00 
			
		
		
		
	build: 统一构建
This commit is contained in:
		
							parent
							
								
									51ca1e60af
								
							
						
					
					
						commit
						5c0cfe44dd
					
				@ -17,7 +17,7 @@
 | 
				
			|||||||
    "pg:vue2": "pnpm playground:vue2",
 | 
					    "pg:vue2": "pnpm playground:vue2",
 | 
				
			||||||
    "playground:react": "pnpm --filter \"runtime-react\" build:libs && pnpm --filter \"runtime-react\" --filter \"tmagic-playground\" dev:react",
 | 
					    "playground:react": "pnpm --filter \"runtime-react\" build:libs && pnpm --filter \"runtime-react\" --filter \"tmagic-playground\" dev:react",
 | 
				
			||||||
    "pg:react": "pnpm playground:react",
 | 
					    "pg:react": "pnpm playground:react",
 | 
				
			||||||
    "build": "pnpm build:dts && pnpm --filter \"@tmagic/*\" build",
 | 
					    "build": "pnpm build:dts && pnpm --filter \"@tmagic/cli\" build && node scripts/build.mjs",
 | 
				
			||||||
    "build:dts": "pnpm --filter \"@tmagic/cli\" build && tsc -p tsconfig.build-browser.json && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build-vue.json && rollup -c rollup.dts.config.js && rimraf temp",
 | 
					    "build:dts": "pnpm --filter \"@tmagic/cli\" build && tsc -p tsconfig.build-browser.json && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build-vue.json && rollup -c rollup.dts.config.js && rimraf temp",
 | 
				
			||||||
    "check:type": "tsc --incremental --noEmit -p tsconfig.check.json && vue-tsc --noEmit -p tsconfig.check-vue.json",
 | 
					    "check:type": "tsc --incremental --noEmit -p tsconfig.check.json && vue-tsc --noEmit -p tsconfig.check-vue.json",
 | 
				
			||||||
    "build:playground": "pnpm --filter \"runtime-vue3\" build && pnpm --filter \"tmagic-playground\" build",
 | 
					    "build:playground": "pnpm --filter \"runtime-vue3\" build && pnpm --filter \"tmagic-playground\" build",
 | 
				
			||||||
@ -51,6 +51,7 @@
 | 
				
			|||||||
    "@typescript-eslint/parser": "^5.62.0",
 | 
					    "@typescript-eslint/parser": "^5.62.0",
 | 
				
			||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					    "@vitejs/plugin-vue": "^5.2.1",
 | 
				
			||||||
    "@vitest/coverage-v8": "^2.1.8",
 | 
					    "@vitest/coverage-v8": "^2.1.8",
 | 
				
			||||||
 | 
					    "@vue/compiler-sfc": "^3.5.13",
 | 
				
			||||||
    "c8": "^7.14.0",
 | 
					    "c8": "^7.14.0",
 | 
				
			||||||
    "commitizen": "^4.3.1",
 | 
					    "commitizen": "^4.3.1",
 | 
				
			||||||
    "conventional-changelog-cli": "^4.1.0",
 | 
					    "conventional-changelog-cli": "^4.1.0",
 | 
				
			||||||
@ -80,8 +81,8 @@
 | 
				
			|||||||
    "serialize-javascript": "^6.0.2",
 | 
					    "serialize-javascript": "^6.0.2",
 | 
				
			||||||
    "shx": "^0.3.4",
 | 
					    "shx": "^0.3.4",
 | 
				
			||||||
    "typescript": "^5.7.3",
 | 
					    "typescript": "^5.7.3",
 | 
				
			||||||
    "vite": "^6.0.9",
 | 
					    "vite": "^6.0.10",
 | 
				
			||||||
    "vitepress": "^1.5.0",
 | 
					    "vitepress": "^1.6.1",
 | 
				
			||||||
    "vitest": "^3.0.2",
 | 
					    "vitest": "^3.0.2",
 | 
				
			||||||
    "vue": "^3.5.13",
 | 
					    "vue": "^3.5.13",
 | 
				
			||||||
    "vue-tsc": "^2.2.0"
 | 
					    "vue-tsc": "^2.2.0"
 | 
				
			||||||
 | 
				
			|||||||
@ -24,9 +24,6 @@
 | 
				
			|||||||
    "resetcss.css"
 | 
					    "resetcss.css"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -35,9 +32,6 @@
 | 
				
			|||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
					    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "keywords": [
 | 
					 | 
				
			||||||
    "vue"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@tmagic/data-source": "workspace:*",
 | 
					    "@tmagic/data-source": "workspace:*",
 | 
				
			||||||
    "@tmagic/dep": "workspace:*",
 | 
					    "@tmagic/dep": "workspace:*",
 | 
				
			||||||
@ -48,10 +42,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/events": "^3.0.0",
 | 
					    "@types/events": "^3.0.0",
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4"
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "typescript": "*"
 | 
					    "typescript": "*"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,46 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicCore',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-core',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -19,9 +19,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build --mode=es && vite build --mode=umd"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -49,9 +46,6 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/events": "^3.0.0",
 | 
					    "@types/events": "^3.0.0",
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4"
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "tsc-alias": "^1.8.5",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,55 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig(({ mode }) => ({
 | 
					 | 
				
			||||||
  resolve: {
 | 
					 | 
				
			||||||
    alias: [{ find: /^@data-source/, replacement: path.join(__dirname, './src') }],
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicDataSource',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-data-source',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        if (mode === 'umd' && id === 'lodash-es') {
 | 
					 | 
				
			||||||
          return false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
}));
 | 
					 | 
				
			||||||
@ -19,9 +19,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -30,11 +27,6 @@
 | 
				
			|||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
					    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/schema": "workspace:*",
 | 
					    "@tmagic/schema": "workspace:*",
 | 
				
			||||||
    "@tmagic/utils": "workspace:*",
 | 
					    "@tmagic/utils": "workspace:*",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,41 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicDep',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-dep',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -23,9 +23,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -44,13 +41,6 @@
 | 
				
			|||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@popperjs/core": "^2.11.8"
 | 
					    "@popperjs/core": "^2.11.8"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					 | 
				
			||||||
    "@vue/compiler-sfc": "^3.5.13",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "vue": ">=3.5.0",
 | 
					    "vue": ">=3.5.0",
 | 
				
			||||||
    "typescript": "*"
 | 
					    "typescript": "*"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,54 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
import vue from '@vitejs/plugin-vue';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  plugins: [vue()],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicDesign',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-design',
 | 
					 | 
				
			||||||
      cssFileName: 'style',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      output: {
 | 
					 | 
				
			||||||
        // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
 | 
					 | 
				
			||||||
        globals: {
 | 
					 | 
				
			||||||
          vue: 'Vue',
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -28,9 +28,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -70,17 +67,10 @@
 | 
				
			|||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/events": "^3.0.0",
 | 
					    "@types/events": "^3.0.0",
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4",
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "@types/serialize-javascript": "^5.0.1",
 | 
					    "@types/serialize-javascript": "^5.0.1",
 | 
				
			||||||
    "@types/sortablejs": "^1.15.8",
 | 
					    "@types/sortablejs": "^1.15.8",
 | 
				
			||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					 | 
				
			||||||
    "@vue/compiler-sfc": "^3.5.13",
 | 
					 | 
				
			||||||
    "@vue/test-utils": "^2.4.6",
 | 
					    "@vue/test-utils": "^2.4.6",
 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					    "type-fest": "^4.10.3"
 | 
				
			||||||
    "sass": "^1.83.0",
 | 
					 | 
				
			||||||
    "tsc-alias": "^1.8.5",
 | 
					 | 
				
			||||||
    "type-fest": "^4.10.3",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/core": "workspace:*",
 | 
					    "@tmagic/core": "workspace:*",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,64 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 vue from '@vitejs/plugin-vue';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  plugins: [vue()],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  resolve: {
 | 
					 | 
				
			||||||
    alias: [{ find: /^@editor/, replacement: path.join(__dirname, './src') }],
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicEditor',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-editor',
 | 
					 | 
				
			||||||
      cssFileName: 'style',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      output: {
 | 
					 | 
				
			||||||
        // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
 | 
					 | 
				
			||||||
        globals: {
 | 
					 | 
				
			||||||
          vue: 'Vue',
 | 
					 | 
				
			||||||
          'element-plus': 'ElementPlus',
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -19,9 +19,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -37,11 +34,6 @@
 | 
				
			|||||||
    "vue3",
 | 
					    "vue3",
 | 
				
			||||||
    "typescript"
 | 
					    "typescript"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/design": "workspace:*",
 | 
					    "@tmagic/design": "workspace:*",
 | 
				
			||||||
    "element-plus": ">=2.8.0",
 | 
					    "element-plus": ">=2.8.0",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,42 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicElementPlusAdapter',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-element-plus-adapter',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -28,9 +28,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -48,14 +45,8 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4",
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "@types/sortablejs": "^1.15.8",
 | 
					    "@types/sortablejs": "^1.15.8",
 | 
				
			||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					    "@vue/test-utils": "^2.4.6"
 | 
				
			||||||
    "@vue/compiler-sfc": "^3.5.13",
 | 
					 | 
				
			||||||
    "@vue/test-utils": "^2.4.6",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "sass": "^1.83.0",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/design": "workspace:*",
 | 
					    "@tmagic/design": "workspace:*",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,58 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
import vue from '@vitejs/plugin-vue';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  plugins: [vue()],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicForm',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-form',
 | 
					 | 
				
			||||||
      cssFileName: 'style',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      output: {
 | 
					 | 
				
			||||||
        // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
 | 
					 | 
				
			||||||
        globals: {
 | 
					 | 
				
			||||||
          vue: 'Vue',
 | 
					 | 
				
			||||||
          'element-plus': 'ElementPlus',
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -30,11 +30,6 @@
 | 
				
			|||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
					    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "typescript": "*"
 | 
					    "typescript": "*"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +0,0 @@
 | 
				
			|||||||
import { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicSchema',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-schema',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -19,9 +19,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -41,16 +38,10 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/events": "^3.0.0",
 | 
					    "@types/events": "^3.0.0",
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4"
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "sass": "^1.83.0",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/core": "workspace:*",
 | 
					    "@tmagic/core": "workspace:*",
 | 
				
			||||||
    "@tmagic/schema": "workspace:*",
 | 
					 | 
				
			||||||
    "@tmagic/utils": "workspace:*",
 | 
					 | 
				
			||||||
    "typescript": "*"
 | 
					    "typescript": "*"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependenciesMeta": {
 | 
					  "peerDependenciesMeta": {
 | 
				
			||||||
 | 
				
			|||||||
@ -21,9 +21,8 @@ import KeyController from 'keycon';
 | 
				
			|||||||
import { throttle } from 'lodash-es';
 | 
					import { throttle } from 'lodash-es';
 | 
				
			||||||
import type { MoveableOptions, OnDragStart } from 'moveable';
 | 
					import type { MoveableOptions, OnDragStart } from 'moveable';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Env } from '@tmagic/core';
 | 
					import type { Id } from '@tmagic/core';
 | 
				
			||||||
import type { Id } from '@tmagic/schema';
 | 
					import { addClassName, Env, getDocument, getIdFromEl, removeClassNameByClassName } from '@tmagic/core';
 | 
				
			||||||
import { addClassName, getDocument, getIdFromEl, removeClassNameByClassName } from '@tmagic/utils';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  AbleActionEventType,
 | 
					  AbleActionEventType,
 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,7 @@ import type {
 | 
				
			|||||||
} from 'moveable';
 | 
					} from 'moveable';
 | 
				
			||||||
import MoveableHelper from 'moveable-helper';
 | 
					import MoveableHelper from 'moveable-helper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { calcValueByFontsize, getIdFromEl, setIdToEl } from '@tmagic/utils';
 | 
					import { calcValueByFontsize, getIdFromEl, setIdToEl } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { DRAG_EL_ID_PREFIX, GHOST_EL_ID_PREFIX, Mode, ZIndex } from './const';
 | 
					import { DRAG_EL_ID_PREFIX, GHOST_EL_ID_PREFIX, Mode, ZIndex } from './const';
 | 
				
			||||||
import TargetShadow from './TargetShadow';
 | 
					import TargetShadow from './TargetShadow';
 | 
				
			||||||
 | 
				
			|||||||
@ -20,8 +20,8 @@ import { EventEmitter } from 'events';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import type { MoveableOptions, OnDragStart } from 'moveable';
 | 
					import type { MoveableOptions, OnDragStart } from 'moveable';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import type { Id } from '@tmagic/schema';
 | 
					import type { Id } from '@tmagic/core';
 | 
				
			||||||
import { getIdFromEl } from '@tmagic/utils';
 | 
					import { getIdFromEl } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ActionManager from './ActionManager';
 | 
					import ActionManager from './ActionManager';
 | 
				
			||||||
import { DEFAULT_ZOOM } from './const';
 | 
					import { DEFAULT_ZOOM } from './const';
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@
 | 
				
			|||||||
/* eslint-disable no-param-reassign */
 | 
					/* eslint-disable no-param-reassign */
 | 
				
			||||||
import Moveable, { MoveableOptions } from 'moveable';
 | 
					import Moveable, { MoveableOptions } from 'moveable';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { getIdFromEl } from '@tmagic/utils';
 | 
					import { getIdFromEl } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Mode, StageDragStatus } from './const';
 | 
					import { Mode, StageDragStatus } from './const';
 | 
				
			||||||
import type DragResizeHelper from './DragResizeHelper';
 | 
					import type DragResizeHelper from './DragResizeHelper';
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@
 | 
				
			|||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { createDiv, getDocument, injectStyle } from '@tmagic/utils';
 | 
					import { createDiv, getDocument, injectStyle } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Mode, ZIndex } from './const';
 | 
					import { Mode, ZIndex } from './const';
 | 
				
			||||||
import Rule from './Rule';
 | 
					import Rule from './Rule';
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import Moveable from 'moveable';
 | 
					import Moveable from 'moveable';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { getIdFromEl } from '@tmagic/utils';
 | 
					import { getIdFromEl } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { DRAG_EL_ID_PREFIX, Mode, StageDragStatus } from './const';
 | 
					import { DRAG_EL_ID_PREFIX, Mode, StageDragStatus } from './const';
 | 
				
			||||||
import DragResizeHelper from './DragResizeHelper';
 | 
					import DragResizeHelper from './DragResizeHelper';
 | 
				
			||||||
 | 
				
			|||||||
@ -18,8 +18,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { EventEmitter } from 'events';
 | 
					import { EventEmitter } from 'events';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Id } from '@tmagic/schema';
 | 
					import type { Id } from '@tmagic/core';
 | 
				
			||||||
import { getElById, getHost, injectStyle, isSameDomain } from '@tmagic/utils';
 | 
					import { getElById, getHost, injectStyle, isSameDomain } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { DEFAULT_ZOOM, RenderType } from './const';
 | 
					import { DEFAULT_ZOOM, RenderType } from './const';
 | 
				
			||||||
import style from './style.css?raw';
 | 
					import style from './style.css?raw';
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@
 | 
				
			|||||||
 * See the License for the specific language governing permissions and
 | 
					 * See the License for the specific language governing permissions and
 | 
				
			||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
import { getElById, getIdFromEl, guid, setIdToEl } from '@tmagic/utils';
 | 
					import { getElById, getIdFromEl, guid, setIdToEl } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Mode, ZIndex } from './const';
 | 
					import { Mode, ZIndex } from './const';
 | 
				
			||||||
import type { TargetElement as ShadowElement, TargetShadowConfig, UpdateDragEl } from './types';
 | 
					import type { TargetElement as ShadowElement, TargetShadowConfig, UpdateDragEl } from './types';
 | 
				
			||||||
 | 
				
			|||||||
@ -19,8 +19,8 @@
 | 
				
			|||||||
import type { GuidesOptions } from '@scena/guides';
 | 
					import type { GuidesOptions } from '@scena/guides';
 | 
				
			||||||
import type { MoveableOptions, OnDragStart } from 'moveable';
 | 
					import type { MoveableOptions, OnDragStart } from 'moveable';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import type { Id, MApp, MContainer, MNode } from '@tmagic/core';
 | 
				
			||||||
import Core from '@tmagic/core';
 | 
					import Core from '@tmagic/core';
 | 
				
			||||||
import type { Id, MApp, MContainer, MNode } from '@tmagic/schema';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { AbleActionEventType, ContainerHighlightType, GuidesType, RenderType, ZIndex } from './const';
 | 
					import { AbleActionEventType, ContainerHighlightType, GuidesType, RenderType, ZIndex } from './const';
 | 
				
			||||||
import DragResizeHelper from './DragResizeHelper';
 | 
					import DragResizeHelper from './DragResizeHelper';
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@
 | 
				
			|||||||
 * See the License for the specific language governing permissions and
 | 
					 * See the License for the specific language governing permissions and
 | 
				
			||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
import { getIdFromEl, removeClassName } from '@tmagic/utils';
 | 
					import { getIdFromEl, removeClassName } from '@tmagic/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { GHOST_EL_ID_PREFIX, Mode, SELECTED_CLASS, ZIndex } from './const';
 | 
					import { GHOST_EL_ID_PREFIX, Mode, SELECTED_CLASS, ZIndex } from './const';
 | 
				
			||||||
import type { Offset, SortEventData, TargetElement } from './types';
 | 
					import type { Offset, SortEventData, TargetElement } from './types';
 | 
				
			||||||
 | 
				
			|||||||
@ -1,45 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicStage',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-stage',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -27,9 +27,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -42,13 +39,7 @@
 | 
				
			|||||||
    "lodash-es": "^4.17.21"
 | 
					    "lodash-es": "^4.17.21"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4"
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					 | 
				
			||||||
    "@vue/compiler-sfc": "^3.5.13",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "sass": "^1.83.0",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/design": "workspace:*",
 | 
					    "@tmagic/design": "workspace:*",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,58 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
import vue from '@vitejs/plugin-vue';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  plugins: [vue()],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicTable',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-table',
 | 
					 | 
				
			||||||
      cssFileName: 'style',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      output: {
 | 
					 | 
				
			||||||
        // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
 | 
					 | 
				
			||||||
        globals: {
 | 
					 | 
				
			||||||
          vue: 'Vue',
 | 
					 | 
				
			||||||
          'element-plus': 'ElementPlus',
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -37,13 +37,6 @@
 | 
				
			|||||||
    "vue3",
 | 
					    "vue3",
 | 
				
			||||||
    "typescript"
 | 
					    "typescript"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					 | 
				
			||||||
    "@vue/compiler-sfc": "^3.5.13",
 | 
					 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/design": "workspace:*",
 | 
					    "@tmagic/design": "workspace:*",
 | 
				
			||||||
    "tdesign-vue-next": "^1.9.8",
 | 
					    "tdesign-vue-next": "^1.9.8",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,45 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
import vue from '@vitejs/plugin-vue';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  plugins: [vue()],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicTdesignVueNextAdapter',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-tdesign-vue-next-adapter',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -15,9 +15,6 @@
 | 
				
			|||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
					    "url": "https://github.com/Tencent/tmagic-editor.git"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@tmagic/react-button": "workspace:*",
 | 
					    "@tmagic/react-button": "workspace:*",
 | 
				
			||||||
    "@tmagic/react-container": "workspace:*",
 | 
					    "@tmagic/react-container": "workspace:*",
 | 
				
			||||||
@ -37,9 +34,5 @@
 | 
				
			|||||||
    "typescript": {
 | 
					    "typescript": {
 | 
				
			||||||
      "optional": true
 | 
					      "optional": true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,46 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicUiReact',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-ui-react',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -12,9 +12,6 @@
 | 
				
			|||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
    "directory": "packages/ui",
 | 
					    "directory": "packages/ui",
 | 
				
			||||||
@ -40,9 +37,5 @@
 | 
				
			|||||||
    "typescript": {
 | 
					    "typescript": {
 | 
				
			||||||
      "optional": true
 | 
					      "optional": true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "devDependencies": {
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,46 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicUi',
 | 
					 | 
				
			||||||
      fileName: 'tmagic-ui',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
@ -18,9 +18,6 @@
 | 
				
			|||||||
    "src"
 | 
					    "src"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "scripts": {
 | 
					 | 
				
			||||||
    "build": "vite build --mode=es && vite build --mode=umd"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
    "node": ">=18"
 | 
					    "node": ">=18"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -33,10 +30,7 @@
 | 
				
			|||||||
    "lodash-es": "^4.17.21"
 | 
					    "lodash-es": "^4.17.21"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/lodash-es": "^4.17.4",
 | 
					    "@types/lodash-es": "^4.17.4"
 | 
				
			||||||
    "@types/node": "^18.19.0",
 | 
					 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@tmagic/schema": "workspace:*",
 | 
					    "@tmagic/schema": "workspace:*",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,51 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * Tencent is pleased to support the open source community by making TMagicEditor available.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Copyright (C) 2023 THL A29 Limited, a Tencent company.  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 { defineConfig, type LibraryFormats } from 'vite';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import pkg from './package.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default defineConfig(({ mode }) => ({
 | 
					 | 
				
			||||||
  build: {
 | 
					 | 
				
			||||||
    cssCodeSplit: false,
 | 
					 | 
				
			||||||
    sourcemap: false,
 | 
					 | 
				
			||||||
    minify: false,
 | 
					 | 
				
			||||||
    target: 'esnext',
 | 
					 | 
				
			||||||
    emptyOutDir: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'src/index.ts',
 | 
					 | 
				
			||||||
      name: 'TMagicUtils',
 | 
					 | 
				
			||||||
      formats: ['es', 'umd', 'cjs'].includes(mode) ? [mode as LibraryFormats] : ['es', 'umd'],
 | 
					 | 
				
			||||||
      fileName: 'tmagic-utils',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rollupOptions: {
 | 
					 | 
				
			||||||
      // 确保外部化处理那些你不想打包进库的依赖
 | 
					 | 
				
			||||||
      external(id: string) {
 | 
					 | 
				
			||||||
        if (mode === 'umd' && id === 'lodash-es') {
 | 
					 | 
				
			||||||
          return false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return Object.keys({
 | 
					 | 
				
			||||||
          ...pkg.dependencies,
 | 
					 | 
				
			||||||
          ...pkg.peerDependencies,
 | 
					 | 
				
			||||||
        }).some((k) => new RegExp(`^${k}`).test(id));
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
}));
 | 
					 | 
				
			||||||
@ -37,6 +37,6 @@
 | 
				
			|||||||
    "typescript": "^5.7.3",
 | 
					    "typescript": "^5.7.3",
 | 
				
			||||||
    "unplugin-auto-import": "^0.12.0",
 | 
					    "unplugin-auto-import": "^0.12.0",
 | 
				
			||||||
    "unplugin-vue-components": "^0.22.11",
 | 
					    "unplugin-vue-components": "^0.22.11",
 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					    "vite": "^6.0.10"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										506
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										506
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -37,6 +37,6 @@
 | 
				
			|||||||
    "@vitejs/plugin-legacy": "^6.0.0",
 | 
					    "@vitejs/plugin-legacy": "^6.0.0",
 | 
				
			||||||
    "@vitejs/plugin-react-refresh": "^1.3.1",
 | 
					    "@vitejs/plugin-react-refresh": "^1.3.1",
 | 
				
			||||||
    "typescript": "^5.7.3",
 | 
					    "typescript": "^5.7.3",
 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					    "vite": "^6.0.10"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -51,7 +51,7 @@
 | 
				
			|||||||
    "@vitejs/plugin-vue": "^5.2.1",
 | 
					    "@vitejs/plugin-vue": "^5.2.1",
 | 
				
			||||||
    "@vue/compiler-sfc": "^3.5.13",
 | 
					    "@vue/compiler-sfc": "^3.5.13",
 | 
				
			||||||
    "rimraf": "^3.0.2",
 | 
					    "rimraf": "^3.0.2",
 | 
				
			||||||
    "vite": "^6.0.9",
 | 
					    "vite": "^6.0.10",
 | 
				
			||||||
    "vue-tsc": "^2.2.0"
 | 
					    "vue-tsc": "^2.2.0"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,7 @@
 | 
				
			|||||||
    "rollup": "^4.31.0",
 | 
					    "rollup": "^4.31.0",
 | 
				
			||||||
    "rollup-plugin-external-globals": "^0.10.0",
 | 
					    "rollup-plugin-external-globals": "^0.10.0",
 | 
				
			||||||
    "sass": "^1.83.0",
 | 
					    "sass": "^1.83.0",
 | 
				
			||||||
    "vite": "^6.0.9",
 | 
					    "vite": "^6.0.10",
 | 
				
			||||||
    "@vitejs/plugin-legacy": "^6.0.0",
 | 
					    "@vitejs/plugin-legacy": "^6.0.0",
 | 
				
			||||||
    "@vitejs/plugin-vue2": "^2.3.1",
 | 
					    "@vitejs/plugin-vue2": "^2.3.1",
 | 
				
			||||||
    "vue-template-compiler": "^2.7.4"
 | 
					    "vue-template-compiler": "^2.7.4"
 | 
				
			||||||
 | 
				
			|||||||
@ -37,6 +37,6 @@
 | 
				
			|||||||
    "sass": "^1.83.0",
 | 
					    "sass": "^1.83.0",
 | 
				
			||||||
    "terser": "^5.31.6",
 | 
					    "terser": "^5.31.6",
 | 
				
			||||||
    "typescript": "^5.7.3",
 | 
					    "typescript": "^5.7.3",
 | 
				
			||||||
    "vite": "^6.0.9"
 | 
					    "vite": "^6.0.10"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										96
									
								
								scripts/build.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								scripts/build.mjs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,96 @@
 | 
				
			|||||||
 | 
					import fs from 'node:fs';
 | 
				
			||||||
 | 
					import { createRequire } from 'node:module';
 | 
				
			||||||
 | 
					import path from 'node:path';
 | 
				
			||||||
 | 
					import { fileURLToPath } from 'node:url';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { build as buildVite } from 'vite';
 | 
				
			||||||
 | 
					import vue from '@vitejs/plugin-vue';
 | 
				
			||||||
 | 
					import minimist from 'minimist';
 | 
				
			||||||
 | 
					import rimraf from 'rimraf';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const args = minimist(process.argv.slice(2));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const toPascalCase = (str) => str.replace(/(^\w|-\w)/g, (text) => text.replace(/-/, '').toUpperCase());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const __dirname = path.dirname(fileURLToPath(import.meta.url));
 | 
				
			||||||
 | 
					const packagesDir = path.resolve(__dirname, '../packages');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (args.package) {
 | 
				
			||||||
 | 
					  const pkgRoot = path.resolve(packagesDir, args.package);
 | 
				
			||||||
 | 
					  if (fs.statSync(pkgRoot).isDirectory()) {
 | 
				
			||||||
 | 
					    rimraf.sync(path.resolve(packagesDir, `./${args.package}/dist`));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    build({ packageName: args.package, format: 'es' });
 | 
				
			||||||
 | 
					    build({ packageName: args.package, format: 'umd' });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					} else {
 | 
				
			||||||
 | 
					  const packages = fs.readdirSync(packagesDir).filter((p) => {
 | 
				
			||||||
 | 
					    const pkgRoot = path.resolve(packagesDir, p);
 | 
				
			||||||
 | 
					    if (fs.statSync(pkgRoot).isDirectory()) {
 | 
				
			||||||
 | 
					      const pkg = JSON.parse(fs.readFileSync(path.resolve(pkgRoot, 'package.json'), 'utf-8'));
 | 
				
			||||||
 | 
					      return !pkg.private && !pkg.bin;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (const packageName of packages) {
 | 
				
			||||||
 | 
					    rimraf.sync(path.resolve(packagesDir, `./${packageName}/dist`));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    build({ packageName, format: 'es' });
 | 
				
			||||||
 | 
					    build({ packageName, format: 'umd' });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function build({ packageName, format }) {
 | 
				
			||||||
 | 
					  const pkg = createRequire(import.meta.url)(`../packages/${packageName}/package.json`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  await buildVite({
 | 
				
			||||||
 | 
					    root: path.resolve(packagesDir, `./${packageName}`),
 | 
				
			||||||
 | 
					    clearScreen: false,
 | 
				
			||||||
 | 
					    configFile: false,
 | 
				
			||||||
 | 
					    plugins: [vue()],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    build: {
 | 
				
			||||||
 | 
					      emptyOutDir: false,
 | 
				
			||||||
 | 
					      cssCodeSplit: false,
 | 
				
			||||||
 | 
					      sourcemap: false,
 | 
				
			||||||
 | 
					      minify: false,
 | 
				
			||||||
 | 
					      target: 'esnext',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      lib: {
 | 
				
			||||||
 | 
					        entry: 'src/index.ts',
 | 
				
			||||||
 | 
					        name: `TMagic${toPascalCase(packageName)}`,
 | 
				
			||||||
 | 
					        fileName: `tmagic-${packageName}`,
 | 
				
			||||||
 | 
					        formats: [format],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      rollupOptions: {
 | 
				
			||||||
 | 
					        // 确保外部化处理那些你不想打包进库的依赖
 | 
				
			||||||
 | 
					        external(id) {
 | 
				
			||||||
 | 
					          if (format === 'umd' && id === 'lodash-es') {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          return Object.keys({
 | 
				
			||||||
 | 
					            ...pkg.dependencies,
 | 
				
			||||||
 | 
					            ...pkg.peerDependencies,
 | 
				
			||||||
 | 
					          }).some((k) => new RegExp(`^${k}`).test(id));
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        output: {
 | 
				
			||||||
 | 
					          // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
 | 
				
			||||||
 | 
					          globals: {
 | 
				
			||||||
 | 
					            vue: 'Vue',
 | 
				
			||||||
 | 
					            'element-plus': 'ElementPlus',
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    resolve: {
 | 
				
			||||||
 | 
					      alias: [
 | 
				
			||||||
 | 
					        { find: /^@data-source/, replacement: path.join(packagesDir, '/data-source/src') },
 | 
				
			||||||
 | 
					        { find: /^@editor/, replacement: path.join(packagesDir, './editor/src') },
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,11 +1,12 @@
 | 
				
			|||||||
// @ts-check
 | 
					// @ts-check
 | 
				
			||||||
import enquirer from 'enquirer';
 | 
					 | 
				
			||||||
import execa from 'execa';
 | 
					 | 
				
			||||||
import minimist from 'minimist';
 | 
					 | 
				
			||||||
import fs from 'node:fs';
 | 
					import fs from 'node:fs';
 | 
				
			||||||
import { createRequire } from 'node:module';
 | 
					import { createRequire } from 'node:module';
 | 
				
			||||||
import path from 'node:path';
 | 
					import path from 'node:path';
 | 
				
			||||||
import { fileURLToPath } from 'node:url';
 | 
					import { fileURLToPath } from 'node:url';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import enquirer from 'enquirer';
 | 
				
			||||||
 | 
					import execa from 'execa';
 | 
				
			||||||
 | 
					import minimist from 'minimist';
 | 
				
			||||||
import pico from 'picocolors';
 | 
					import pico from 'picocolors';
 | 
				
			||||||
import semver from 'semver';
 | 
					import semver from 'semver';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,7 +36,8 @@ const args = minimist(process.argv.slice(2), {
 | 
				
			|||||||
const preId = args.preid || semver.prerelease(currentVersion)?.[0];
 | 
					const preId = args.preid || semver.prerelease(currentVersion)?.[0];
 | 
				
			||||||
const isDryRun = args.dry;
 | 
					const isDryRun = args.dry;
 | 
				
			||||||
/** @type {boolean | undefined} */
 | 
					/** @type {boolean | undefined} */
 | 
				
			||||||
let { skipTests } = args;
 | 
					// eslint-disable-next-line prefer-destructuring
 | 
				
			||||||
 | 
					let skipTests = args.skipTests;
 | 
				
			||||||
const { skipBuild } = args;
 | 
					const { skipBuild } = args;
 | 
				
			||||||
const skipPrompts = args.skipPrompts || args.canary;
 | 
					const skipPrompts = args.skipPrompts || args.canary;
 | 
				
			||||||
const skipGit = args.skipGit || args.canary;
 | 
					const skipGit = args.skipGit || args.canary;
 | 
				
			||||||
@ -335,7 +337,7 @@ function updatePackage(pkgRoot, version, getNewPackageName, updateDep = false) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @param {Package} pkg
 | 
					 * @param {Package} pkg
 | 
				
			||||||
 * @param {'dependencies' | 'peerDependencies'} depType
 | 
					 * @param {'dependencies' | 'peerDependencies' | 'devDependencies'} depType
 | 
				
			||||||
 * @param {string} version
 | 
					 * @param {string} version
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function updateDeps(pkg, depType, version) {
 | 
					function updateDeps(pkg, depType, version) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user