修复材质导出问题,添加库打包模式

This commit is contained in:
陈梓阳 2025-04-15 09:35:54 +08:00
parent 0929d5b80c
commit cfbfda520d
11 changed files with 26706 additions and 116 deletions

26520
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,31 @@
{ {
"name": "material-editor", "name": "material-editor",
"private": true, "private": true,
"version": "0.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vue-tsc -b && vite build", "build": "vue-tsc -b && vite build",
"preview": "vite preview" "preview": "vite preview"
}, },
"files": [
"dist",
"public",
"src",
"index.html",
"README.md"
],
"module": "./dist/material-editor.js",
"main": "./dist/material-editor.umd.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"dependencies": { "dependencies": {
"@jscad/modeling": "^2.11.0", "@jscad/modeling": "^2.11.0",
"csstype": "^3.1.3",
"fflate": "^0.8.2", "fflate": "^0.8.2",
"flatbush": "^3.3.0", "flatbush": "^3.3.0",
"js-angusj-clipper": "^1.2.1", "js-angusj-clipper": "^1.2.1",
@ -21,11 +37,11 @@
"xaop": "^2.0.0" "xaop": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^5.2.1", "@types/node": "^22.14.1",
"@vitejs/plugin-vue": "^5.2.3",
"@vue/tsconfig": "^0.7.0", "@vue/tsconfig": "^0.7.0",
"csstype": "^3.1.3",
"typescript": "~5.7.2", "typescript": "~5.7.2",
"vite": "^6.2.0", "vite": "^6.2.6",
"vue-tsc": "^2.2.4" "vue-tsc": "^2.2.4"
}, },
"packageManager": "pnpm@9.1.1+sha1.09ada6cd05003e0ced25fb716f9fda4063ec2e3b" "packageManager": "pnpm@9.1.1+sha1.09ada6cd05003e0ced25fb716f9fda4063ec2e3b"

View File

@ -11,6 +11,9 @@ importers:
'@jscad/modeling': '@jscad/modeling':
specifier: ^2.11.0 specifier: ^2.11.0
version: 2.12.5 version: 2.12.5
csstype:
specifier: ^3.1.3
version: 3.1.3
fflate: fflate:
specifier: ^0.8.2 specifier: ^0.8.2
version: 0.8.2 version: 0.8.2
@ -39,21 +42,21 @@ importers:
specifier: ^2.0.0 specifier: ^2.0.0
version: 2.1.0 version: 2.1.0
devDependencies: devDependencies:
'@types/node':
specifier: ^22.14.1
version: 22.14.1
'@vitejs/plugin-vue': '@vitejs/plugin-vue':
specifier: ^5.2.1 specifier: ^5.2.3
version: 5.2.3(vite@6.2.5)(vue@3.5.13(typescript@5.7.3)) version: 5.2.3(vite@6.2.6(@types/node@22.14.1))(vue@3.5.13(typescript@5.7.3))
'@vue/tsconfig': '@vue/tsconfig':
specifier: ^0.7.0 specifier: ^0.7.0
version: 0.7.0(typescript@5.7.3)(vue@3.5.13(typescript@5.7.3)) version: 0.7.0(typescript@5.7.3)(vue@3.5.13(typescript@5.7.3))
csstype:
specifier: ^3.1.3
version: 3.1.3
typescript: typescript:
specifier: ~5.7.2 specifier: ~5.7.2
version: 5.7.3 version: 5.7.3
vite: vite:
specifier: ^6.2.0 specifier: ^6.2.6
version: 6.2.5 version: 6.2.6(@types/node@22.14.1)
vue-tsc: vue-tsc:
specifier: ^2.2.4 specifier: ^2.2.4
version: 2.2.8(typescript@5.7.3) version: 2.2.8(typescript@5.7.3)
@ -233,120 +236,123 @@ packages:
'@jscad/modeling@2.12.5': '@jscad/modeling@2.12.5':
resolution: {integrity: sha512-7deHWmE+CKBx2RyxDxl9Pie0bDOHHtcsh4V0gKViu27abYXKGl8+myoddwIvxLczwnw31ZZXDdUdm0Ef51YwQg==} resolution: {integrity: sha512-7deHWmE+CKBx2RyxDxl9Pie0bDOHHtcsh4V0gKViu27abYXKGl8+myoddwIvxLczwnw31ZZXDdUdm0Ef51YwQg==}
'@rollup/rollup-android-arm-eabi@4.39.0': '@rollup/rollup-android-arm-eabi@4.40.0':
resolution: {integrity: sha512-lGVys55Qb00Wvh8DMAocp5kIcaNzEFTmGhfFd88LfaogYTRKrdxgtlO5H6S49v2Nd8R2C6wLOal0qv6/kCkOwA==} resolution: {integrity: sha512-+Fbls/diZ0RDerhE8kyC6hjADCXA1K4yVNlH0EYfd2XjyH0UGgzaQ8MlT0pCXAThfxv3QUAczHaL+qSv1E4/Cg==}
cpu: [arm] cpu: [arm]
os: [android] os: [android]
'@rollup/rollup-android-arm64@4.39.0': '@rollup/rollup-android-arm64@4.40.0':
resolution: {integrity: sha512-It9+M1zE31KWfqh/0cJLrrsCPiF72PoJjIChLX+rEcujVRCb4NLQ5QzFkzIZW8Kn8FTbvGQBY5TkKBau3S8cCQ==} resolution: {integrity: sha512-PPA6aEEsTPRz+/4xxAmaoWDqh67N7wFbgFUJGMnanCFs0TV99M0M8QhhaSCks+n6EbQoFvLQgYOGXxlMGQe/6w==}
cpu: [arm64] cpu: [arm64]
os: [android] os: [android]
'@rollup/rollup-darwin-arm64@4.39.0': '@rollup/rollup-darwin-arm64@4.40.0':
resolution: {integrity: sha512-lXQnhpFDOKDXiGxsU9/l8UEGGM65comrQuZ+lDcGUx+9YQ9dKpF3rSEGepyeR5AHZ0b5RgiligsBhWZfSSQh8Q==} resolution: {integrity: sha512-GwYOcOakYHdfnjjKwqpTGgn5a6cUX7+Ra2HeNj/GdXvO2VJOOXCiYYlRFU4CubFM67EhbmzLOmACKEfvp3J1kQ==}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
'@rollup/rollup-darwin-x64@4.39.0': '@rollup/rollup-darwin-x64@4.40.0':
resolution: {integrity: sha512-mKXpNZLvtEbgu6WCkNij7CGycdw9cJi2k9v0noMb++Vab12GZjFgUXD69ilAbBh034Zwn95c2PNSz9xM7KYEAQ==} resolution: {integrity: sha512-CoLEGJ+2eheqD9KBSxmma6ld01czS52Iw0e2qMZNpPDlf7Z9mj8xmMemxEucinev4LgHalDPczMyxzbq+Q+EtA==}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
'@rollup/rollup-freebsd-arm64@4.39.0': '@rollup/rollup-freebsd-arm64@4.40.0':
resolution: {integrity: sha512-jivRRlh2Lod/KvDZx2zUR+I4iBfHcu2V/BA2vasUtdtTN2Uk3jfcZczLa81ESHZHPHy4ih3T/W5rPFZ/hX7RtQ==} resolution: {integrity: sha512-r7yGiS4HN/kibvESzmrOB/PxKMhPTlz+FcGvoUIKYoTyGd5toHp48g1uZy1o1xQvybwwpqpe010JrcGG2s5nkg==}
cpu: [arm64] cpu: [arm64]
os: [freebsd] os: [freebsd]
'@rollup/rollup-freebsd-x64@4.39.0': '@rollup/rollup-freebsd-x64@4.40.0':
resolution: {integrity: sha512-8RXIWvYIRK9nO+bhVz8DwLBepcptw633gv/QT4015CpJ0Ht8punmoHU/DuEd3iw9Hr8UwUV+t+VNNuZIWYeY7Q==} resolution: {integrity: sha512-mVDxzlf0oLzV3oZOr0SMJ0lSDd3xC4CmnWJ8Val8isp9jRGl5Dq//LLDSPFrasS7pSm6m5xAcKaw3sHXhBjoRw==}
cpu: [x64] cpu: [x64]
os: [freebsd] os: [freebsd]
'@rollup/rollup-linux-arm-gnueabihf@4.39.0': '@rollup/rollup-linux-arm-gnueabihf@4.40.0':
resolution: {integrity: sha512-mz5POx5Zu58f2xAG5RaRRhp3IZDK7zXGk5sdEDj4o96HeaXhlUwmLFzNlc4hCQi5sGdR12VDgEUqVSHer0lI9g==} resolution: {integrity: sha512-y/qUMOpJxBMy8xCXD++jeu8t7kzjlOCkoxxajL58G62PJGBZVl/Gwpm7JK9+YvlB701rcQTzjUZ1JgUoPTnoQA==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.39.0': '@rollup/rollup-linux-arm-musleabihf@4.40.0':
resolution: {integrity: sha512-+YDwhM6gUAyakl0CD+bMFpdmwIoRDzZYaTWV3SDRBGkMU/VpIBYXXEvkEcTagw/7VVkL2vA29zU4UVy1mP0/Yw==} resolution: {integrity: sha512-GoCsPibtVdJFPv/BOIvBKO/XmwZLwaNWdyD8TKlXuqp0veo2sHE+A/vpMQ5iSArRUz/uaoj4h5S6Pn0+PdhRjg==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [musl] libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.39.0': '@rollup/rollup-linux-arm64-gnu@4.40.0':
resolution: {integrity: sha512-EKf7iF7aK36eEChvlgxGnk7pdJfzfQbNvGV/+l98iiMwU23MwvmV0Ty3pJ0p5WQfm3JRHOytSIqD9LB7Bq7xdQ==} resolution: {integrity: sha512-L5ZLphTjjAD9leJzSLI7rr8fNqJMlGDKlazW2tX4IUF9P7R5TMQPElpH82Q7eNIDQnQlAyiNVfRPfP2vM5Avvg==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.39.0': '@rollup/rollup-linux-arm64-musl@4.40.0':
resolution: {integrity: sha512-vYanR6MtqC7Z2SNr8gzVnzUul09Wi1kZqJaek3KcIlI/wq5Xtq4ZPIZ0Mr/st/sv/NnaPwy/D4yXg5x0B3aUUA==} resolution: {integrity: sha512-ATZvCRGCDtv1Y4gpDIXsS+wfFeFuLwVxyUBSLawjgXK2tRE6fnsQEkE4csQQYWlBlsFztRzCnBvWVfcae/1qxQ==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl] libc: [musl]
'@rollup/rollup-linux-loongarch64-gnu@4.39.0': '@rollup/rollup-linux-loongarch64-gnu@4.40.0':
resolution: {integrity: sha512-NMRUT40+h0FBa5fb+cpxtZoGAggRem16ocVKIv5gDB5uLDgBIwrIsXlGqYbLwW8YyO3WVTk1FkFDjMETYlDqiw==} resolution: {integrity: sha512-wG9e2XtIhd++QugU5MD9i7OnpaVb08ji3P1y/hNbxrQ3sYEelKJOq1UJ5dXczeo6Hj2rfDEL5GdtkMSVLa/AOg==}
cpu: [loong64] cpu: [loong64]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-powerpc64le-gnu@4.39.0': '@rollup/rollup-linux-powerpc64le-gnu@4.40.0':
resolution: {integrity: sha512-0pCNnmxgduJ3YRt+D+kJ6Ai/r+TaePu9ZLENl+ZDV/CdVczXl95CbIiwwswu4L+K7uOIGf6tMo2vm8uadRaICQ==} resolution: {integrity: sha512-vgXfWmj0f3jAUvC7TZSU/m/cOE558ILWDzS7jBhiCAFpY2WEBn5jqgbqvmzlMjtp8KlLcBlXVD2mkTSEQE6Ixw==}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.39.0': '@rollup/rollup-linux-riscv64-gnu@4.40.0':
resolution: {integrity: sha512-t7j5Zhr7S4bBtksT73bO6c3Qa2AV/HqiGlj9+KB3gNF5upcVkx+HLgxTm8DK4OkzsOYqbdqbLKwvGMhylJCPhQ==} resolution: {integrity: sha512-uJkYTugqtPZBS3Z136arevt/FsKTF/J9dEMTX/cwR7lsAW4bShzI2R0pJVw+hcBTWF4dxVckYh72Hk3/hWNKvA==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-riscv64-musl@4.39.0': '@rollup/rollup-linux-riscv64-musl@4.40.0':
resolution: {integrity: sha512-m6cwI86IvQ7M93MQ2RF5SP8tUjD39Y7rjb1qjHgYh28uAPVU8+k/xYWvxRO3/tBN2pZkSMa5RjnPuUIbrwVxeA==} resolution: {integrity: sha512-rKmSj6EXQRnhSkE22+WvrqOqRtk733x3p5sWpZilhmjnkHkpeCgWsFFo0dGnUGeA+OZjRl3+VYq+HyCOEuwcxQ==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [musl] libc: [musl]
'@rollup/rollup-linux-s390x-gnu@4.39.0': '@rollup/rollup-linux-s390x-gnu@4.40.0':
resolution: {integrity: sha512-iRDJd2ebMunnk2rsSBYlsptCyuINvxUfGwOUldjv5M4tpa93K8tFMeYGpNk2+Nxl+OBJnBzy2/JCscGeO507kA==} resolution: {integrity: sha512-SpnYlAfKPOoVsQqmTFJ0usx0z84bzGOS9anAC0AZ3rdSo3snecihbhFTlJZ8XMwzqAcodjFU4+/SM311dqE5Sw==}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.39.0': '@rollup/rollup-linux-x64-gnu@4.40.0':
resolution: {integrity: sha512-t9jqYw27R6Lx0XKfEFe5vUeEJ5pF3SGIM6gTfONSMb7DuG6z6wfj2yjcoZxHg129veTqU7+wOhY6GX8wmf90dA==} resolution: {integrity: sha512-RcDGMtqF9EFN8i2RYN2W+64CdHruJ5rPqrlYw+cgM3uOVPSsnAQps7cpjXe9be/yDp8UC7VLoCoKC8J3Kn2FkQ==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc] libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.39.0': '@rollup/rollup-linux-x64-musl@4.40.0':
resolution: {integrity: sha512-ThFdkrFDP55AIsIZDKSBWEt/JcWlCzydbZHinZ0F/r1h83qbGeenCt/G/wG2O0reuENDD2tawfAj2s8VK7Bugg==} resolution: {integrity: sha512-HZvjpiUmSNx5zFgwtQAV1GaGazT2RWvqeDi0hV+AtC8unqqDSsaFjPxfsO6qPtKRRg25SisACWnJ37Yio8ttaw==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl] libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.39.0': '@rollup/rollup-win32-arm64-msvc@4.40.0':
resolution: {integrity: sha512-jDrLm6yUtbOg2TYB3sBF3acUnAwsIksEYjLeHL+TJv9jg+TmTwdyjnDex27jqEMakNKf3RwwPahDIt7QXCSqRQ==} resolution: {integrity: sha512-UtZQQI5k/b8d7d3i9AZmA/t+Q4tk3hOC0tMOMSq2GlMYOfxbesxG4mJSeDp0EHs30N9bsfwUvs3zF4v/RzOeTQ==}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.39.0': '@rollup/rollup-win32-ia32-msvc@4.40.0':
resolution: {integrity: sha512-6w9uMuza+LbLCVoNKL5FSLE7yvYkq9laSd09bwS0tMjkwXrmib/4KmoJcrKhLWHvw19mwU+33ndC69T7weNNjQ==} resolution: {integrity: sha512-+m03kvI2f5syIqHXCZLPVYplP8pQch9JHyXKZ3AGMKlg8dCyr2PKHjwRLiW53LTrN/Nc3EqHOKxUxzoSPdKddA==}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
'@rollup/rollup-win32-x64-msvc@4.39.0': '@rollup/rollup-win32-x64-msvc@4.40.0':
resolution: {integrity: sha512-yAkUOkIKZlK5dl7u6dg897doBgLXmUHhIINM2c+sND3DZwnrdQkkSiDh7N75Ll4mM4dxSkYfXqU9fW3lLkMFug==} resolution: {integrity: sha512-lpPE1cLfP5oPzVjKMx10pgBmKELQnFJXHgvtHCtuJWOv8MxqdEIMNtgHgBFf7Ea2/7EuVwa9fodWUfXAlXZLZQ==}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@types/estree@1.0.7': '@types/estree@1.0.7':
resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==}
'@types/node@22.14.1':
resolution: {integrity: sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==}
'@vitejs/plugin-vue@5.2.3': '@vitejs/plugin-vue@5.2.3':
resolution: {integrity: sha512-IYSLEQj4LgZZuoVpdSUCw3dIynTWQgPlaRP6iAvMle4My0HdYwr5g5wQAfwOeHQBmYwEkqF70nRpSilr6PoUDg==} resolution: {integrity: sha512-IYSLEQj4LgZZuoVpdSUCw3dIynTWQgPlaRP6iAvMle4My0HdYwr5g5wQAfwOeHQBmYwEkqF70nRpSilr6PoUDg==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
@ -531,8 +537,8 @@ packages:
rfdc@1.4.1: rfdc@1.4.1:
resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}
rollup@4.39.0: rollup@4.40.0:
resolution: {integrity: sha512-thI8kNc02yNvnmJp8dr3fNWJ9tCONDhp6TV35X6HkKGGs9E6q7YWCHbe5vKiTa7TAiNcFEmXKj3X/pG2b3ci0g==} resolution: {integrity: sha512-Noe455xmA96nnqH5piFtLobsGbCij7Tu+tb3c1vYjNbTkfzGqXqQXG3wJaYXkRZuQ0vEYN4bhwg7QnIrqB5B+w==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'} engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true hasBin: true
@ -559,8 +565,11 @@ packages:
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
vite@6.2.5: undici-types@6.21.0:
resolution: {integrity: sha512-j023J/hCAa4pRIUH6J9HemwYfjB5llR2Ps0CWeikOtdR8+pAURAk0DoJC5/mm9kd+UgdnIy7d6HE4EAvlYhPhA==} resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
vite@6.2.6:
resolution: {integrity: sha512-9xpjNl3kR4rVDZgPNdTL0/c6ao4km69a/2ihNQbcANz8RuCOK3hQBmLSJf3bRKVQjVMda+YvizNE8AwvogcPbw==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@ -717,71 +726,75 @@ snapshots:
'@jscad/modeling@2.12.5': {} '@jscad/modeling@2.12.5': {}
'@rollup/rollup-android-arm-eabi@4.39.0': '@rollup/rollup-android-arm-eabi@4.40.0':
optional: true optional: true
'@rollup/rollup-android-arm64@4.39.0': '@rollup/rollup-android-arm64@4.40.0':
optional: true optional: true
'@rollup/rollup-darwin-arm64@4.39.0': '@rollup/rollup-darwin-arm64@4.40.0':
optional: true optional: true
'@rollup/rollup-darwin-x64@4.39.0': '@rollup/rollup-darwin-x64@4.40.0':
optional: true optional: true
'@rollup/rollup-freebsd-arm64@4.39.0': '@rollup/rollup-freebsd-arm64@4.40.0':
optional: true optional: true
'@rollup/rollup-freebsd-x64@4.39.0': '@rollup/rollup-freebsd-x64@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.39.0': '@rollup/rollup-linux-arm-gnueabihf@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-arm-musleabihf@4.39.0': '@rollup/rollup-linux-arm-musleabihf@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-arm64-gnu@4.39.0': '@rollup/rollup-linux-arm64-gnu@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-arm64-musl@4.39.0': '@rollup/rollup-linux-arm64-musl@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-loongarch64-gnu@4.39.0': '@rollup/rollup-linux-loongarch64-gnu@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-powerpc64le-gnu@4.39.0': '@rollup/rollup-linux-powerpc64le-gnu@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-riscv64-gnu@4.39.0': '@rollup/rollup-linux-riscv64-gnu@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-riscv64-musl@4.39.0': '@rollup/rollup-linux-riscv64-musl@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-s390x-gnu@4.39.0': '@rollup/rollup-linux-s390x-gnu@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-x64-gnu@4.39.0': '@rollup/rollup-linux-x64-gnu@4.40.0':
optional: true optional: true
'@rollup/rollup-linux-x64-musl@4.39.0': '@rollup/rollup-linux-x64-musl@4.40.0':
optional: true optional: true
'@rollup/rollup-win32-arm64-msvc@4.39.0': '@rollup/rollup-win32-arm64-msvc@4.40.0':
optional: true optional: true
'@rollup/rollup-win32-ia32-msvc@4.39.0': '@rollup/rollup-win32-ia32-msvc@4.40.0':
optional: true optional: true
'@rollup/rollup-win32-x64-msvc@4.39.0': '@rollup/rollup-win32-x64-msvc@4.40.0':
optional: true optional: true
'@types/estree@1.0.7': {} '@types/estree@1.0.7': {}
'@vitejs/plugin-vue@5.2.3(vite@6.2.5)(vue@3.5.13(typescript@5.7.3))': '@types/node@22.14.1':
dependencies: dependencies:
vite: 6.2.5 undici-types: 6.21.0
'@vitejs/plugin-vue@5.2.3(vite@6.2.6(@types/node@22.14.1))(vue@3.5.13(typescript@5.7.3))':
dependencies:
vite: 6.2.6(@types/node@22.14.1)
vue: 3.5.13(typescript@5.7.3) vue: 3.5.13(typescript@5.7.3)
'@volar/language-core@2.4.12': '@volar/language-core@2.4.12':
@ -999,30 +1012,30 @@ snapshots:
rfdc@1.4.1: {} rfdc@1.4.1: {}
rollup@4.39.0: rollup@4.40.0:
dependencies: dependencies:
'@types/estree': 1.0.7 '@types/estree': 1.0.7
optionalDependencies: optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.39.0 '@rollup/rollup-android-arm-eabi': 4.40.0
'@rollup/rollup-android-arm64': 4.39.0 '@rollup/rollup-android-arm64': 4.40.0
'@rollup/rollup-darwin-arm64': 4.39.0 '@rollup/rollup-darwin-arm64': 4.40.0
'@rollup/rollup-darwin-x64': 4.39.0 '@rollup/rollup-darwin-x64': 4.40.0
'@rollup/rollup-freebsd-arm64': 4.39.0 '@rollup/rollup-freebsd-arm64': 4.40.0
'@rollup/rollup-freebsd-x64': 4.39.0 '@rollup/rollup-freebsd-x64': 4.40.0
'@rollup/rollup-linux-arm-gnueabihf': 4.39.0 '@rollup/rollup-linux-arm-gnueabihf': 4.40.0
'@rollup/rollup-linux-arm-musleabihf': 4.39.0 '@rollup/rollup-linux-arm-musleabihf': 4.40.0
'@rollup/rollup-linux-arm64-gnu': 4.39.0 '@rollup/rollup-linux-arm64-gnu': 4.40.0
'@rollup/rollup-linux-arm64-musl': 4.39.0 '@rollup/rollup-linux-arm64-musl': 4.40.0
'@rollup/rollup-linux-loongarch64-gnu': 4.39.0 '@rollup/rollup-linux-loongarch64-gnu': 4.40.0
'@rollup/rollup-linux-powerpc64le-gnu': 4.39.0 '@rollup/rollup-linux-powerpc64le-gnu': 4.40.0
'@rollup/rollup-linux-riscv64-gnu': 4.39.0 '@rollup/rollup-linux-riscv64-gnu': 4.40.0
'@rollup/rollup-linux-riscv64-musl': 4.39.0 '@rollup/rollup-linux-riscv64-musl': 4.40.0
'@rollup/rollup-linux-s390x-gnu': 4.39.0 '@rollup/rollup-linux-s390x-gnu': 4.40.0
'@rollup/rollup-linux-x64-gnu': 4.39.0 '@rollup/rollup-linux-x64-gnu': 4.40.0
'@rollup/rollup-linux-x64-musl': 4.39.0 '@rollup/rollup-linux-x64-musl': 4.40.0
'@rollup/rollup-win32-arm64-msvc': 4.39.0 '@rollup/rollup-win32-arm64-msvc': 4.40.0
'@rollup/rollup-win32-ia32-msvc': 4.39.0 '@rollup/rollup-win32-ia32-msvc': 4.40.0
'@rollup/rollup-win32-x64-msvc': 4.39.0 '@rollup/rollup-win32-x64-msvc': 4.40.0
fsevents: 2.3.3 fsevents: 2.3.3
source-map-js@1.2.1: {} source-map-js@1.2.1: {}
@ -1039,12 +1052,15 @@ snapshots:
typescript@5.7.3: {} typescript@5.7.3: {}
vite@6.2.5: undici-types@6.21.0: {}
vite@6.2.6(@types/node@22.14.1):
dependencies: dependencies:
esbuild: 0.25.2 esbuild: 0.25.2
postcss: 8.5.3 postcss: 8.5.3
rollup: 4.39.0 rollup: 4.40.0
optionalDependencies: optionalDependencies:
'@types/node': 22.14.1
fsevents: 2.3.3 fsevents: 2.3.3
vscode-uri@3.1.0: {} vscode-uri@3.1.0: {}

View File

@ -2,7 +2,7 @@
import MaterialView from './components/MaterialView.vue'; import MaterialView from './components/MaterialView.vue';
// //
document.addEventListener('contextmenu', (e) => e.preventDefault()); // document.addEventListener('contextmenu', (e) => e.preventDefault());
</script> </script>

View File

@ -1,9 +1,22 @@
import { CADFiler, Database, DuplicateRecordCloning, PhysicalMaterialRecord } from "webcad_ue4_api"; import { CADFactory, CADFiler, CADObject, Database, DuplicateRecordCloning, ObjectId, PhysicalMaterialRecord } from "webcad_ue4_api";
// TODO: Danger: 注意入侵性代码
// 疑似是WebCAD中的漏洞当传入new Database()时,
// Database中的filer.ReadObject方法并不会为CadObject.objectId赋值
// 导致后续的CadObject.Id.Index发生空指针异常
// 因此需要修改CAD中的Database.AllocationObjectId尝试手动赋值
// @ts-ignore
Database.prototype.AllocationObjectId = function (this: Database, object: CADObject) {
if (object.Id === undefined) object.objectId = new ObjectId(undefined, undefined);
// @ts-ignore
object.Id.Index = this.idIndex++;
// @ts-ignore
this.idMap.set(object.Id.Index, object.Id);
}
export function MaterialOut(material: PhysicalMaterialRecord): string export function MaterialOut(material: PhysicalMaterialRecord): string
{ {
let db = new Database(); let db = new Database();
debugger;
db.WblockCloneObejcts( db.WblockCloneObejcts(
[material], [material],
db.MaterialTable, db.MaterialTable,

View File

@ -11,7 +11,7 @@
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { type Property } from 'csstype'; import type { Property } from 'csstype';
import { computed } from 'vue'; import { computed } from 'vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{

View File

@ -13,6 +13,9 @@ import CfFlex from './CfFlex.vue';
const scene = useScene(); const scene = useScene();
const container = useTemplateRef<HTMLElement>('container'); const container = useTemplateRef<HTMLElement>('container');
//
document.addEventListener('contextmenu', (e) => e.preventDefault());
onMounted(() => { onMounted(() => {
scene.Initial(container.value); scene.Initial(container.value);
}); });

View File

@ -0,0 +1,7 @@
export function DownloadFile(fileName: string, blob: Blob) {
const tempLink = document.createElement('a');
tempLink.href = URL.createObjectURL(blob as Blob);
tempLink.download = fileName;
tempLink.click();
URL.revokeObjectURL(tempLink.href);
}

5
src/lib/index.ts Normal file
View File

@ -0,0 +1,5 @@
import MaterialView from "../components/MaterialView.vue";
export {
MaterialView
}

View File

@ -95,19 +95,10 @@ export const useScene = defineStore('scene', () => {
materialName: string; materialName: string;
} }
async function UploadMaterialAsync(request: UploadMaterialRequest) { async function UploadMaterialAsync(request: UploadMaterialRequest) {
const logoPath = await HandleUpdateLogo(); // TODO: Warn: 是否要生成logo路径
// const logoPath = await HandleUpdateLogo();
const matJson = MaterialOut(Material.value as PhysicalMaterialRecord); const matJson = MaterialOut(Material.value as PhysicalMaterialRecord);
const data = await PostJson(MaterialUrls.create, { console.log(matJson);
dir_id: request,
name: request.materialName,
logo: logoPath,
// jsonString -> Deflate -> BinaryString -> Base64
file: btoa(String.fromCharCode(...await DeflateAsync(matJson))),
zip_type: 'gzip',
});
if (data.err_code !== RequestStatus.Ok) {
throw new Error(data.err_msg);
}
} }
async function HandleUpdateLogo() { async function HandleUpdateLogo() {

View File

@ -1,7 +1,26 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
build: {
lib: {
entry: resolve(__dirname, 'src/lib/index.ts'),
name: 'MaterialEditor',
fileName: (format) => `material-editor.${format}.js`
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}
}
}) })