@linxai/3d-web 0.1.0 → 0.1.1

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.
@@ -1,89 +0,0 @@
1
- import { useState, useEffect } from 'react'
2
-
3
- export interface SubtitleProps {
4
- /** 字幕文本 */
5
- text?: string
6
- /** 是否可见 */
7
- visible?: boolean
8
- /** 容器样式 */
9
- style?: React.CSSProperties
10
- /** 字幕框样式 */
11
- boxStyle?: React.CSSProperties
12
- /** 文本样式 */
13
- textStyle?: React.CSSProperties
14
- /** 底部偏移(默认 80px) */
15
- bottomOffset?: number
16
- }
17
-
18
- /**
19
- * 字幕组件
20
- * 带淡入淡出动画的字幕显示
21
- */
22
- export function Subtitle({
23
- text = '',
24
- visible = true,
25
- style,
26
- boxStyle,
27
- textStyle,
28
- bottomOffset = 80,
29
- }: SubtitleProps) {
30
- const [fadeIn, setFadeIn] = useState(false)
31
-
32
- useEffect(() => {
33
- if (text) {
34
- setFadeIn(true)
35
- } else {
36
- setFadeIn(false)
37
- }
38
- }, [text])
39
-
40
- if (!visible || !text) return null
41
-
42
- return (
43
- <div
44
- style={{
45
- position: 'absolute',
46
- left: 0,
47
- right: 0,
48
- bottom: `${bottomOffset}px`,
49
- display: 'flex',
50
- justifyContent: 'center',
51
- padding: '0 20px',
52
- pointerEvents: 'none',
53
- zIndex: 100,
54
- opacity: fadeIn ? 1 : 0,
55
- transform: fadeIn ? 'translateY(0)' : 'translateY(10px)',
56
- transition: 'all 0.3s ease-out',
57
- ...style,
58
- }}
59
- >
60
- <div
61
- style={{
62
- background: 'rgba(0, 0, 0, 0.85)',
63
- backdropFilter: 'blur(10px)',
64
- padding: '16px 24px',
65
- borderRadius: '12px',
66
- maxWidth: '80%',
67
- boxShadow: '0 4px 20px rgba(0, 0, 0, 0.3)',
68
- border: '1px solid rgba(255, 255, 255, 0.1)',
69
- ...boxStyle,
70
- }}
71
- >
72
- <p
73
- style={{
74
- margin: 0,
75
- color: '#fff',
76
- fontSize: '16px',
77
- lineHeight: '1.6',
78
- textAlign: 'center',
79
- fontWeight: '500',
80
- ...textStyle,
81
- }}
82
- >
83
- {text}
84
- </p>
85
- </div>
86
- </div>
87
- )
88
- }
89
-
@@ -1,12 +0,0 @@
1
- /**
2
- * Web 端模型加载 Hook
3
- * 直接 re-export @react-three/drei 的 useGLTF
4
- *
5
- * @example
6
- * ```tsx
7
- * const gltf = useModelLoader('/model.glb')
8
- * return <primitive object={gltf.scene} />
9
- * ```
10
- */
11
- export { useGLTF as useModelLoader } from '@react-three/drei'
12
-
package/src/index.tsx DELETED
@@ -1,44 +0,0 @@
1
- /**
2
- * @linxai/3d-web
3
- * 3D 角色可视化 - Web 平台
4
- */
5
-
6
- // ============================================================
7
- // 核心组件(用户使用)
8
- // ============================================================
9
- export { CharacterView } from './components/CharacterView'
10
- export { Scene3D } from './components/Scene3D'
11
-
12
- // ============================================================
13
- // 类型定义(从 shared 导出)
14
- // ============================================================
15
- export type {
16
- // Character 相关
17
- Character,
18
- CharacterViewProps,
19
- OverlayConfig,
20
-
21
- // 配置类型
22
- ModelLoadConfig,
23
- AnimationConfig,
24
- AnimationStatesConfig,
25
- AnimationStateConfig,
26
- SceneConfig,
27
- OrbitControlsConfig,
28
- LightConfig,
29
- GridHelperConfig,
30
- } from '@linxai/3d-shared'
31
-
32
- // ============================================================
33
- // UI 组件(可选使用)
34
- // ============================================================
35
- export { CharacterOverlay } from './components/CharacterOverlay'
36
- export type { CharacterOverlayProps } from './components/CharacterOverlay'
37
- export { Subtitle } from './components/Subtitle'
38
- export type { SubtitleProps } from './components/Subtitle'
39
-
40
- // ============================================================
41
- // 高级 API(可选使用)
42
- // ============================================================
43
- export { WebSceneBuilder } from './builders/SceneBuilder'
44
- export { useModelLoader } from './hooks/useModelLoader'
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ESNext",
5
- "lib": ["ES2020", "DOM"],
6
- "jsx": "react-jsx",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "sourceMap": true,
10
- "outDir": "./dist",
11
- "rootDir": "./src",
12
- "strict": true,
13
- "esModuleInterop": true,
14
- "skipLibCheck": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "moduleResolution": "bundler",
17
- "resolveJsonModule": true,
18
- "allowSyntheticDefaultImports": true
19
- },
20
- "include": ["src/**/*"],
21
- "exclude": ["node_modules", "dist"]
22
- }
23
-
package/tsup.config.ts DELETED
@@ -1,19 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig({
4
- entry: ['src/index.tsx'],
5
- format: ['cjs', 'esm'],
6
- dts: true,
7
- external: [
8
- 'react',
9
- 'react-native',
10
- 'three',
11
- '@react-three/fiber',
12
- '@linxai/3d-shared',
13
- ],
14
- // 使用 React 17+ 的新 JSX runtime
15
- esbuildOptions(options) {
16
- options.jsx = 'automatic'
17
- },
18
- })
19
-