@zeewain/3d-avatar-sdk 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +6 -5
  2. package/dist/assets/Build/webgl.data.unityweb +0 -0
  3. package/dist/assets/Build/webgl.framework.js.unityweb +0 -0
  4. package/dist/assets/Build/webgl.wasm.unityweb +0 -0
  5. package/dist/examples/test-umd/index.html +762 -0
  6. package/dist/examples/test-vue2/.eslintignore +45 -0
  7. package/dist/examples/test-vue2/.eslintrc.js +174 -0
  8. package/dist/examples/test-vue2/.stylelintignore +50 -0
  9. package/dist/examples/test-vue2/.stylelintrc.js +79 -0
  10. package/dist/examples/test-vue2/README.md +139 -0
  11. package/dist/examples/test-vue2/babel.config.js +14 -0
  12. package/dist/examples/test-vue2/package.json +53 -0
  13. package/dist/examples/test-vue2/pnpm-lock.yaml +8776 -0
  14. package/dist/examples/test-vue2/public/index.html +19 -0
  15. package/dist/examples/test-vue2/setup.js +170 -0
  16. package/dist/examples/test-vue2/src/App.vue +943 -0
  17. package/dist/examples/test-vue2/src/components/BroadcastAPI.vue +666 -0
  18. package/dist/examples/test-vue2/src/components/CameraAPI.vue +414 -0
  19. package/dist/examples/test-vue2/src/components/GlobalConfig.vue +200 -0
  20. package/dist/examples/test-vue2/src/components/InfoCards.vue +294 -0
  21. package/dist/examples/test-vue2/src/components/InitAPI.vue +334 -0
  22. package/dist/examples/test-vue2/src/components/LogPanel.vue +249 -0
  23. package/dist/examples/test-vue2/src/components/MotionControlAPI.vue +400 -0
  24. package/dist/examples/test-vue2/src/components/UnityPreview.vue +201 -0
  25. package/dist/examples/test-vue2/src/main.js +16 -0
  26. package/dist/examples/test-vue2/vue.config.js +41 -0
  27. package/dist/examples/test-vue3/.eslintrc +3 -0
  28. package/dist/examples/test-vue3/.stylelintignore +3 -0
  29. package/dist/examples/test-vue3/.stylelintrc +48 -0
  30. package/dist/examples/test-vue3/README.md +236 -0
  31. package/dist/examples/test-vue3/env.d.ts +8 -0
  32. package/dist/examples/test-vue3/index.html +95 -0
  33. package/dist/examples/test-vue3/package.json +55 -0
  34. package/dist/examples/test-vue3/pnpm-lock.yaml +4636 -0
  35. package/dist/examples/test-vue3/setup.js +167 -0
  36. package/dist/examples/test-vue3/src/App.vue +962 -0
  37. package/dist/examples/test-vue3/src/components/BroadcastAPI.vue +636 -0
  38. package/dist/examples/test-vue3/src/components/CameraAPI.vue +376 -0
  39. package/dist/examples/test-vue3/src/components/GlobalConfig.vue +213 -0
  40. package/dist/examples/test-vue3/src/components/InfoCards.vue +288 -0
  41. package/dist/examples/test-vue3/src/components/InitAPI.vue +339 -0
  42. package/dist/examples/test-vue3/src/components/LogPanel.vue +236 -0
  43. package/dist/examples/test-vue3/src/components/MotionControlAPI.vue +373 -0
  44. package/dist/examples/test-vue3/src/components/UnityPreview.vue +189 -0
  45. package/dist/examples/test-vue3/src/main.ts +12 -0
  46. package/dist/examples/test-vue3/src/types.ts +9 -0
  47. package/dist/examples/test-vue3/tsconfig.json +44 -0
  48. package/dist/examples/test-vue3/tsconfig.node.json +14 -0
  49. package/dist/examples/test-vue3/vite.config.ts +75 -0
  50. package/dist/index.d.ts +142 -132
  51. package/dist/index.es5.js +93 -41
  52. package/dist/index.es5.umd.js +93 -41
  53. package/dist/index.esm.js +101 -42
  54. package/dist/index.umd.cjs +101 -42
  55. package/package.json +4 -3
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
+ <title>ZEEAvatarSDK Vue2 测试控制台</title>
9
+ <!-- 引入Font Awesome图标 -->
10
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
11
+ </head>
12
+ <body>
13
+ <noscript>
14
+ <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
15
+ </noscript>
16
+ <div id="app"></div>
17
+ <!-- built files will be auto injected -->
18
+ </body>
19
+ </html>
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * @fileoverview 统一的项目设置脚本
5
+ * @description 根据运行环境自动设置项目,支持本地开发和npm包两种模式
6
+ */
7
+
8
+ const fs = require('fs-extra')
9
+ const path = require('path')
10
+ const { execSync } = require('child_process')
11
+
12
+ // 路径配置
13
+ const PROJECT_ROOT = process.cwd()
14
+ const SDK_ROOT = path.resolve(PROJECT_ROOT, '../../')
15
+ const SDK_DIST = path.resolve(SDK_ROOT, 'dist')
16
+ const NPM_SDK_ASSETS = path.resolve(PROJECT_ROOT, 'node_modules/@zeewain/3d-avatar-sdk/dist/assets')
17
+ const LOCAL_ASSETS_TARGET = path.resolve(PROJECT_ROOT, 'public/assets')
18
+ const ENV_FILE = path.resolve(PROJECT_ROOT, '.env.local')
19
+
20
+ // 解析命令行参数
21
+ const args = process.argv.slice(2)
22
+ const isDev = args.includes('--dev') || args.includes('-d')
23
+ const isProduction = args.includes('--prod') || args.includes('-p')
24
+ const mode = isDev ? 'dev' : (isProduction ? 'prod' : 'auto')
25
+
26
+ console.log('🚀 设置 3D数字人SDK Vue2 测试项目...')
27
+ console.log(`📁 项目目录: ${PROJECT_ROOT}`)
28
+ console.log(`🔧 运行模式: ${mode}`)
29
+ console.log('')
30
+
31
+ /**
32
+ * 检测应该使用的模式
33
+ * @returns {'dev'|'npm'} 返回检测到的模式
34
+ */
35
+ function detectMode () {
36
+ // 如果明确指定了模式,使用指定的模式
37
+ if (isDev) return 'dev'
38
+ if (isProduction) return 'npm'
39
+
40
+ // 自动检测:如果父目录存在SDK源码,优先使用开发模式
41
+ const sdkSourceExists = fs.existsSync(path.resolve(SDK_ROOT, 'src'))
42
+
43
+ if (sdkSourceExists) {
44
+ console.log('✅ 检测到本地SDK源码,将使用开发模式')
45
+ return 'dev'
46
+ } else {
47
+ console.log('📦 未检测到本地SDK源码,将使用npm包模式')
48
+ return 'npm'
49
+ }
50
+ }
51
+
52
+ /**
53
+ * 设置开发环境
54
+ */
55
+ async function setupDevEnvironment () {
56
+ console.log('🔧 设置本地开发环境...')
57
+
58
+ try {
59
+ // 1. 检查并构建SDK
60
+ if (!fs.existsSync(SDK_DIST)) {
61
+ console.log('⚠️ SDK构建目录不存在,正在构建...')
62
+ execSync('npm run build', { cwd: SDK_ROOT, stdio: 'inherit' })
63
+ } else {
64
+ console.log('✅ SDK构建目录已存在')
65
+ }
66
+
67
+ // 2. 复制本地SDK的assets文件
68
+ const localSdkAssetsPath = path.resolve(SDK_DIST, 'assets')
69
+ if (fs.existsSync(localSdkAssetsPath)) {
70
+ console.log('📋 复制本地SDK构建文件...')
71
+ await fs.copy(localSdkAssetsPath, LOCAL_ASSETS_TARGET)
72
+ console.log('✅ 本地SDK构建文件复制完成')
73
+ }
74
+
75
+ // 3. 创建开发环境配置
76
+ console.log('📝 设置开发环境变量...')
77
+ const envContent = `# 本地开发环境配置
78
+ # 使用本地SDK版本而不是npm版本
79
+ VUE_APP_USE_LOCAL_SDK=true
80
+
81
+ # 本地SDK路径信息(仅供参考)
82
+ VUE_APP_LOCAL_SDK_PATH=${SDK_DIST}
83
+
84
+ # 开发模式标识
85
+ NODE_ENV=development
86
+ VUE_APP_ENV=development
87
+ `
88
+
89
+ fs.writeFileSync(ENV_FILE, envContent)
90
+ console.log(`✅ 已创建开发环境配置: ${ENV_FILE}`)
91
+ } catch (error) {
92
+ console.error('❌ 开发环境设置失败:', error.message)
93
+ throw error
94
+ }
95
+ }
96
+
97
+ /**
98
+ * 设置生产环境(使用npm包)
99
+ */
100
+ async function setupProductionEnvironment () {
101
+ console.log('📦 设置npm包环境...')
102
+
103
+ try {
104
+ // 1. 复制npm包中的assets文件
105
+ if (fs.existsSync(NPM_SDK_ASSETS)) {
106
+ console.log('📋 复制npm包构建文件...')
107
+ await fs.copy(NPM_SDK_ASSETS, LOCAL_ASSETS_TARGET)
108
+ console.log('✅ npm包构建文件复制完成')
109
+ } else {
110
+ console.log('⚠️ 警告: 未找到npm包中的Unity构建文件')
111
+ console.log(' 请确保已安装 @zeewain/3d-avatar-sdk 包')
112
+ }
113
+
114
+ // 2. 创建生产环境配置
115
+ console.log('📝 设置生产环境变量...')
116
+ const envContent = `# 生产环境配置
117
+ # 使用npm包版本
118
+ VUE_APP_USE_LOCAL_SDK=false
119
+
120
+ # 生产模式标识
121
+ NODE_ENV=production
122
+ VUE_APP_ENV=production
123
+ `
124
+
125
+ fs.writeFileSync(ENV_FILE, envContent)
126
+ console.log(`✅ 已创建生产环境配置: ${ENV_FILE}`)
127
+ } catch (error) {
128
+ console.error('❌ 生产环境设置失败:', error.message)
129
+ throw error
130
+ }
131
+ }
132
+
133
+ /**
134
+ * 主设置函数
135
+ */
136
+ async function setup () {
137
+ try {
138
+ const selectedMode = detectMode()
139
+
140
+ // 确保目标目录存在
141
+ await fs.ensureDir(LOCAL_ASSETS_TARGET)
142
+
143
+ if (selectedMode === 'dev') {
144
+ await setupDevEnvironment()
145
+ } else {
146
+ await setupProductionEnvironment()
147
+ }
148
+
149
+ console.log('')
150
+ console.log('🎉 设置完成!')
151
+ console.log('')
152
+
153
+ if (selectedMode === 'dev') {
154
+ console.log('🔧 开发模式说明:')
155
+ console.log(' - 使用本地SDK源码,修改后重新构建即可生效')
156
+ console.log(' - 运行 `npm run setup --prod` 可切换到npm包模式')
157
+ console.log(' - SDK源码路径:', SDK_ROOT)
158
+ } else {
159
+ console.log('📦 npm包模式说明:')
160
+ console.log(' - 使用已发布的npm包版本')
161
+ console.log(' - 运行 `npm run setup --dev` 可切换到开发模式')
162
+ }
163
+ } catch (error) {
164
+ console.error('❌ 设置过程中出现错误:', error.message)
165
+ process.exit(1)
166
+ }
167
+ }
168
+
169
+ // 运行设置
170
+ setup()