vtkviewer-vue 0.1.0

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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +753 -0
  3. package/README.md +1760 -0
  4. package/lib/types/components/PluginToolbar.vue.d.ts +7 -0
  5. package/lib/types/components/ToolbarExtension.vue.d.ts +9 -0
  6. package/lib/types/components/ToolbarInfoPanel.vue.d.ts +10 -0
  7. package/lib/types/components/VtkViewer.vue.d.ts +32 -0
  8. package/lib/types/components/index.d.ts +4 -0
  9. package/lib/types/composables/index.d.ts +7 -0
  10. package/lib/types/composables/useFormatLoader.d.ts +33 -0
  11. package/lib/types/composables/useResponsiveLayout.d.ts +46 -0
  12. package/lib/types/composables/useUIPlugins.d.ts +57 -0
  13. package/lib/types/composables/useViewer.d.ts +47 -0
  14. package/lib/types/configs/index.d.ts +76 -0
  15. package/lib/types/core/CommandRegistrar.d.ts +12 -0
  16. package/lib/types/core/CommandRegistry.d.ts +34 -0
  17. package/lib/types/core/ConfigAccessor.d.ts +33 -0
  18. package/lib/types/core/DisposalRegistry.d.ts +32 -0
  19. package/lib/types/core/EventBus.d.ts +79 -0
  20. package/lib/types/core/FormatDetector.d.ts +59 -0
  21. package/lib/types/core/I18nManager.d.ts +135 -0
  22. package/lib/types/core/InteractionSubContext.d.ts +73 -0
  23. package/lib/types/core/RenderSubContext.d.ts +74 -0
  24. package/lib/types/core/ResetManager.d.ts +122 -0
  25. package/lib/types/core/ResetRegistry.d.ts +170 -0
  26. package/lib/types/core/SceneSubContext.d.ts +25 -0
  27. package/lib/types/core/StateManager.d.ts +104 -0
  28. package/lib/types/core/ThemeContext.d.ts +37 -0
  29. package/lib/types/core/ToolbarExtensionRegistry.d.ts +105 -0
  30. package/lib/types/core/ToolbarInfoRegistry.d.ts +77 -0
  31. package/lib/types/core/UISubContext.d.ts +32 -0
  32. package/lib/types/core/ViewerContext.d.ts +101 -0
  33. package/lib/types/core/ViewerContextBuilder.d.ts +57 -0
  34. package/lib/types/core/createViewerContext.d.ts +26 -0
  35. package/lib/types/core/index.d.ts +23 -0
  36. package/lib/types/icons/index.d.ts +47 -0
  37. package/lib/types/index.d.ts +7 -0
  38. package/lib/types/plugins/PluginBase.d.ts +131 -0
  39. package/lib/types/plugins/PluginRegistry.d.ts +67 -0
  40. package/lib/types/plugins/defaults.d.ts +3 -0
  41. package/lib/types/plugins/format/DrcPlugin.d.ts +30 -0
  42. package/lib/types/plugins/format/GlbPlugin.d.ts +23 -0
  43. package/lib/types/plugins/format/ObjPlugin.d.ts +23 -0
  44. package/lib/types/plugins/format/PdbPlugin.d.ts +33 -0
  45. package/lib/types/plugins/format/PlyPlugin.d.ts +24 -0
  46. package/lib/types/plugins/format/StlPlugin.d.ts +25 -0
  47. package/lib/types/plugins/format/VtiPlugin.d.ts +60 -0
  48. package/lib/types/plugins/format/VtpPlugin.d.ts +24 -0
  49. package/lib/types/plugins/format/VtuPlugin.d.ts +25 -0
  50. package/lib/types/plugins/format/ZipPlugin.d.ts +38 -0
  51. package/lib/types/plugins/format/index.d.ts +13 -0
  52. package/lib/types/plugins/index.d.ts +13 -0
  53. package/lib/types/plugins/injectionKeys.d.ts +22 -0
  54. package/lib/types/plugins/pluginUtils.d.ts +61 -0
  55. package/lib/types/plugins/service/DragDropPlugin.d.ts +94 -0
  56. package/lib/types/plugins/service/KeyBindingPlugin.d.ts +83 -0
  57. package/lib/types/plugins/service/MemoryPressurePlugin.d.ts +68 -0
  58. package/lib/types/plugins/service/index.d.ts +6 -0
  59. package/lib/types/plugins/toolbar/animation/AnimationPlugin.d.ts +34 -0
  60. package/lib/types/plugins/toolbar/animation/index.d.ts +1 -0
  61. package/lib/types/plugins/toolbar/index.d.ts +9 -0
  62. package/lib/types/plugins/toolbar/interaction/CenterModelPlugin.d.ts +21 -0
  63. package/lib/types/plugins/toolbar/interaction/FullscreenPlugin.d.ts +27 -0
  64. package/lib/types/plugins/toolbar/interaction/PanPlugin.d.ts +24 -0
  65. package/lib/types/plugins/toolbar/interaction/ResetAllPlugin.d.ts +25 -0
  66. package/lib/types/plugins/toolbar/interaction/RotatePlugin.d.ts +24 -0
  67. package/lib/types/plugins/toolbar/interaction/ViewSelectPlugin.d.ts +26 -0
  68. package/lib/types/plugins/toolbar/interaction/ZoomPlugin.d.ts +24 -0
  69. package/lib/types/plugins/toolbar/interaction/index.d.ts +7 -0
  70. package/lib/types/plugins/toolbar/model/ClippingPlugin.d.ts +87 -0
  71. package/lib/types/plugins/toolbar/model/ColorByPlugin.d.ts +113 -0
  72. package/lib/types/plugins/toolbar/model/LoadModelPlugin.d.ts +93 -0
  73. package/lib/types/plugins/toolbar/model/RenderPrecisionPlugin.d.ts +68 -0
  74. package/lib/types/plugins/toolbar/model/RenderStylePlugin.d.ts +88 -0
  75. package/lib/types/plugins/toolbar/model/UnloadModelPlugin.d.ts +25 -0
  76. package/lib/types/plugins/toolbar/model/index.d.ts +6 -0
  77. package/lib/types/plugins/toolbar/scene/AxesPlugin.d.ts +96 -0
  78. package/lib/types/plugins/toolbar/scene/BackgroundColorPlugin.d.ts +25 -0
  79. package/lib/types/plugins/toolbar/scene/LanguageSwitchPlugin.d.ts +45 -0
  80. package/lib/types/plugins/toolbar/scene/LightIntensityPlugin.d.ts +42 -0
  81. package/lib/types/plugins/toolbar/scene/RenderGridPlugin.d.ts +98 -0
  82. package/lib/types/plugins/toolbar/scene/ThemeSwitchPlugin.d.ts +49 -0
  83. package/lib/types/plugins/toolbar/scene/index.d.ts +6 -0
  84. package/lib/types/plugins/toolbar/tools/BookmarkPlugin.d.ts +70 -0
  85. package/lib/types/plugins/toolbar/tools/MeasurementPlugin.d.ts +112 -0
  86. package/lib/types/plugins/toolbar/tools/PerformancePlugin.d.ts +55 -0
  87. package/lib/types/plugins/toolbar/tools/ScreenshotPlugin.d.ts +58 -0
  88. package/lib/types/plugins/toolbar/tools/index.d.ts +4 -0
  89. package/lib/types/plugins/toolbar/utils.d.ts +67 -0
  90. package/lib/types/plugins/types/index.d.ts +250 -0
  91. package/lib/types/plugins/ui/ErrorPlugin.d.ts +30 -0
  92. package/lib/types/plugins/ui/FilenameInfoPlugin.d.ts +40 -0
  93. package/lib/types/plugins/ui/LoadingPlugin.d.ts +28 -0
  94. package/lib/types/plugins/ui/SceneTreePlugin.d.ts +60 -0
  95. package/lib/types/plugins/ui/WebGLContextLostPlugin.d.ts +33 -0
  96. package/lib/types/plugins/ui/index.d.ts +8 -0
  97. package/lib/types/polyfills.d.ts +1 -0
  98. package/lib/types/types/index.d.ts +187 -0
  99. package/lib/types/types/vtk-modules.d.ts +80 -0
  100. package/lib/types/utils/asyncUtils.d.ts +8 -0
  101. package/lib/types/utils/colorByUtils.d.ts +55 -0
  102. package/lib/types/utils/debugLog.d.ts +13 -0
  103. package/lib/types/utils/errorHandler.d.ts +28 -0
  104. package/lib/types/utils/index.d.ts +10 -0
  105. package/lib/types/utils/sceneUtils.d.ts +11 -0
  106. package/lib/types/utils/themeManager.d.ts +78 -0
  107. package/lib/types/utils/volumeUtils.d.ts +14 -0
  108. package/lib/types/utils/vtkHelpers.d.ts +46 -0
  109. package/lib/types/utils/vtuLoader.d.ts +26 -0
  110. package/lib/types/utils/zipReader.d.ts +71 -0
  111. package/lib/vtkviewer.css +2 -0
  112. package/lib/vtkviewer.js +54714 -0
  113. package/lib/vtkviewer.umd.cjs +4560 -0
  114. package/package.json +89 -0
@@ -0,0 +1,104 @@
1
+ import { DeepReadonly } from 'vue';
2
+ /** 加载状态 */
3
+ export interface LoadingState {
4
+ isLoading: boolean;
5
+ progress: number;
6
+ stage: string;
7
+ /** 正在解析的文件大小(字节),0 表示未知 */
8
+ fileSize?: number;
9
+ }
10
+ /** 错误状态 */
11
+ export interface ErrorState {
12
+ hasError: boolean;
13
+ message: string;
14
+ severity: 'warning' | 'error' | 'fatal';
15
+ recoverable: boolean;
16
+ }
17
+ /** 查看器状态 */
18
+ export interface ViewerState {
19
+ isReady: boolean;
20
+ isRendering: boolean;
21
+ isContextLost: boolean;
22
+ }
23
+ /** 状态注册描述符 */
24
+ export interface StateDescriptor<T = any> {
25
+ key: string;
26
+ initialValue: T;
27
+ validator?: (value: T) => boolean;
28
+ }
29
+ /** 插件状态注册表 */
30
+ export interface PluginStateRegistry {
31
+ /** 注册插件状态 */
32
+ register<T>(pluginId: string, descriptor: StateDescriptor<T>): void;
33
+ /** 获取插件状态 */
34
+ get<T>(pluginId: string, key: string): T | undefined;
35
+ /** 设置插件状态 */
36
+ set<T>(pluginId: string, key: string, value: T): void;
37
+ /** 注销插件的所有状态 */
38
+ unregister(pluginId: string): void;
39
+ }
40
+ /**
41
+ * 状态管理器接口
42
+ */
43
+ export interface IStateManager {
44
+ /** 核心状态(只读) */
45
+ readonly core: {
46
+ readonly loading: DeepReadonly<LoadingState>;
47
+ readonly error: DeepReadonly<ErrorState>;
48
+ readonly viewer: DeepReadonly<ViewerState>;
49
+ };
50
+ /** 插件状态注册表 */
51
+ readonly pluginStates: PluginStateRegistry;
52
+ /** 更新加载状态 */
53
+ setLoading(state: Partial<LoadingState>): void;
54
+ /** 更新错误状态 */
55
+ setError(state: Partial<ErrorState>): void;
56
+ /** 清除错误 */
57
+ clearError(): void;
58
+ /** 更新查看器状态 */
59
+ setViewerState(state: Partial<ViewerState>): void;
60
+ }
61
+ /**
62
+ * 插件状态注册表实现
63
+ */
64
+ declare class PluginStateRegistryImpl implements PluginStateRegistry {
65
+ private states;
66
+ register<T>(pluginId: string, descriptor: StateDescriptor<T>): void;
67
+ get<T>(pluginId: string, key: string): T | undefined;
68
+ set<T>(pluginId: string, key: string, value: T): void;
69
+ unregister(pluginId: string): void;
70
+ }
71
+ /**
72
+ * 状态管理器实现
73
+ */
74
+ export declare class StateManagerImpl implements IStateManager {
75
+ private loadingState;
76
+ private errorState;
77
+ private viewerState;
78
+ private pluginStateRegistry;
79
+ readonly core: {
80
+ loading: {
81
+ readonly isLoading: boolean;
82
+ readonly progress: number;
83
+ readonly stage: string;
84
+ readonly fileSize?: number | undefined;
85
+ };
86
+ error: {
87
+ readonly hasError: boolean;
88
+ readonly message: string;
89
+ readonly severity: "warning" | "error" | "fatal";
90
+ readonly recoverable: boolean;
91
+ };
92
+ viewer: {
93
+ readonly isReady: boolean;
94
+ readonly isRendering: boolean;
95
+ readonly isContextLost: boolean;
96
+ };
97
+ };
98
+ readonly pluginStates: PluginStateRegistryImpl;
99
+ setLoading(state: Partial<LoadingState>): void;
100
+ setError(state: Partial<ErrorState>): void;
101
+ clearError(): void;
102
+ setViewerState(state: Partial<ViewerState>): void;
103
+ }
104
+ export {};
@@ -0,0 +1,37 @@
1
+ import { Ref } from 'vue';
2
+ import { ThemeConfig } from './ViewerContext';
3
+ /**
4
+ * 主题上下文接口
5
+ * 所有插件通过此接口访问和修改主题状态
6
+ */
7
+ export interface ThemeContext {
8
+ /** 当前主题 ID(响应式) */
9
+ readonly currentThemeId: Ref<string>;
10
+ /** 切换主题(只更新状态,DOM 操作由 VtkViewer 监听后执行) */
11
+ setTheme(themeId: string): void;
12
+ /** 获取主题配置 */
13
+ getTheme(themeId: string): ThemeConfig | undefined;
14
+ /** 获取所有已注册的主题 */
15
+ getAllThemes(): Record<string, ThemeConfig>;
16
+ }
17
+ /**
18
+ * ThemeContext 实现类
19
+ * 注意:
20
+ * 1. currentThemeId ref 由外部(VtkViewer)创建并传入
21
+ * 2. 此类不负责 DOM 操作,DOM 操作由 VtkViewer 监听状态变化后执行
22
+ */
23
+ export declare class ThemeContextImpl implements ThemeContext {
24
+ private themeManager;
25
+ /** 当前主题 ID(响应式,由外部传入) */
26
+ readonly currentThemeId: Ref<string>;
27
+ constructor(currentThemeId: Ref<string>);
28
+ /**
29
+ * 切换主题(只更新状态,不操作 DOM)
30
+ * DOM 操作由 VtkViewer 监听 currentThemeId 变化后执行
31
+ */
32
+ setTheme(themeId: string): void;
33
+ /** 获取主题配置 */
34
+ getTheme(themeId: string): ThemeConfig | undefined;
35
+ /** 获取所有已注册的主题 */
36
+ getAllThemes(): Record<string, ThemeConfig>;
37
+ }
@@ -0,0 +1,105 @@
1
+ import { Ref, Component } from 'vue';
2
+ /**
3
+ * 工具栏扩展区项
4
+ */
5
+ export interface ToolbarExtensionItem {
6
+ /** 唯一标识(通常使用插件 ID) */
7
+ id: string;
8
+ /** 要渲染的 Vue 组件 */
9
+ component: Component;
10
+ /** 是否激活 */
11
+ active: boolean;
12
+ /** 显示优先级(数值越小越靠前),默认 0 */
13
+ priority?: number;
14
+ }
15
+ /**
16
+ * 工具栏扩展区注册表接口
17
+ */
18
+ export interface IToolbarExtensionRegistry {
19
+ /**
20
+ * 注册扩展区
21
+ * @param item 扩展区配置
22
+ */
23
+ register(item: ToolbarExtensionItem): void;
24
+ /**
25
+ * 更新扩展区状态
26
+ * @param id 扩展区 ID
27
+ * @param updates 要更新的属性
28
+ */
29
+ update(id: string, updates: Partial<Omit<ToolbarExtensionItem, 'id'>>): void;
30
+ /**
31
+ * 注销扩展区
32
+ * @param id 扩展区 ID
33
+ */
34
+ unregister(id: string): void;
35
+ /**
36
+ * 激活指定扩展区(支持多个同时活跃)
37
+ * @param id 扩展区 ID
38
+ */
39
+ activate(id: string): void;
40
+ /**
41
+ * 停用指定扩展区
42
+ * @param id 扩展区 ID
43
+ */
44
+ deactivate(id: string): void;
45
+ /**
46
+ * 切换扩展区激活状态
47
+ * @param id 扩展区 ID
48
+ */
49
+ toggle(id: string): void;
50
+ /**
51
+ * 停用所有扩展区
52
+ */
53
+ deactivateAll(): void;
54
+ /**
55
+ * 检查是否存在指定 ID 的扩展区
56
+ * @param id 扩展区 ID
57
+ */
58
+ has(id: string): boolean;
59
+ /**
60
+ * 获取当前活跃的扩展区(响应式,单个 - 向后兼容)
61
+ */
62
+ readonly activeExtension: Ref<ToolbarExtensionItem | null>;
63
+ /**
64
+ * 获取所有活跃的扩展区(响应式,多个)
65
+ */
66
+ readonly activeExtensions: Ref<ToolbarExtensionItem[]>;
67
+ /**
68
+ * 响应式扩展区列表
69
+ */
70
+ readonly extensions: Ref<ToolbarExtensionItem[]>;
71
+ /**
72
+ * 清除所有扩展区
73
+ */
74
+ clear(): void;
75
+ }
76
+ /**
77
+ * 工具栏扩展区注册表实现
78
+ */
79
+ export declare class ToolbarExtensionRegistryImpl implements IToolbarExtensionRegistry {
80
+ /** 内部存储 */
81
+ private extensionMap;
82
+ /** 当前活跃的扩展区(单个,向后兼容) */
83
+ readonly activeExtension: Ref<ToolbarExtensionItem | null>;
84
+ /** 所有活跃的扩展区 */
85
+ readonly activeExtensions: Ref<ToolbarExtensionItem[]>;
86
+ /** 响应式扩展区列表 */
87
+ readonly extensions: Ref<ToolbarExtensionItem[]>;
88
+ register(item: ToolbarExtensionItem): void;
89
+ update(id: string, updates: Partial<Omit<ToolbarExtensionItem, 'id'>>): void;
90
+ unregister(id: string): void;
91
+ activate(id: string): void;
92
+ deactivate(id: string): void;
93
+ toggle(id: string): void;
94
+ deactivateAll(): void;
95
+ has(id: string): boolean;
96
+ clear(): void;
97
+ /**
98
+ * 刷新响应式列表
99
+ */
100
+ private refreshExtensions;
101
+ /**
102
+ * 刷新活跃扩展区列表
103
+ */
104
+ private refreshActiveExtensions;
105
+ }
@@ -0,0 +1,77 @@
1
+ import { Ref, Component } from 'vue';
2
+ /**
3
+ * 工具栏信息项
4
+ * 插件推送到信息面板的单个显示单元
5
+ */
6
+ export interface ToolbarInfoItem {
7
+ /** 唯一标识(通常使用插件 ID) */
8
+ id: string;
9
+ /** 要渲染的 Vue 组件 */
10
+ component: Component;
11
+ /** 显示优先级(数值越小越靠前),默认 0 */
12
+ priority?: number;
13
+ /** 响应式可见性检查回调(可选),返回 true 表示可见,默认可见 */
14
+ visibleCheck?: () => boolean;
15
+ }
16
+ /**
17
+ * 工具栏信息注册表接口
18
+ * 提供信息项的注册、更新、注销能力
19
+ */
20
+ export interface IToolbarInfoRegistry {
21
+ /**
22
+ * 注册信息项
23
+ * 如果已存在同 ID 项,则替换
24
+ * @param item 信息项
25
+ */
26
+ register(item: ToolbarInfoItem): void;
27
+ /**
28
+ * 更新信息项的部分属性
29
+ * @param id 信息项 ID
30
+ * @param updates 要更新的属性(component/priority/visible)
31
+ */
32
+ update(id: string, updates: Partial<Omit<ToolbarInfoItem, 'id'>>): void;
33
+ /**
34
+ * 注销信息项
35
+ * @param id 信息项 ID
36
+ */
37
+ unregister(id: string): void;
38
+ /**
39
+ * 检查是否存在指定 ID 的信息项
40
+ * @param id 信息项 ID
41
+ */
42
+ has(id: string): boolean;
43
+ /**
44
+ * 获取所有信息项(按优先级排序)
45
+ * 返回排序后的副本
46
+ */
47
+ getItems(): ToolbarInfoItem[];
48
+ /**
49
+ * 响应式信息项列表(按优先级排序)
50
+ * Vue 组件应使用此属性进行渲染
51
+ */
52
+ readonly items: Ref<ToolbarInfoItem[]>;
53
+ /**
54
+ * 清除所有信息项
55
+ */
56
+ clear(): void;
57
+ }
58
+ /**
59
+ * 工具栏信息注册表实现
60
+ */
61
+ export declare class ToolbarInfoRegistryImpl implements IToolbarInfoRegistry {
62
+ /** 内部存储(保持插入顺序) */
63
+ private itemMap;
64
+ /** 响应式列表(按优先级排序) */
65
+ readonly items: Ref<ToolbarInfoItem[]>;
66
+ register(item: ToolbarInfoItem): void;
67
+ update(id: string, updates: Partial<Omit<ToolbarInfoItem, 'id'>>): void;
68
+ unregister(id: string): void;
69
+ has(id: string): boolean;
70
+ getItems(): ToolbarInfoItem[];
71
+ clear(): void;
72
+ /**
73
+ * 刷新响应式列表
74
+ * 按优先级排序后更新 items ref
75
+ */
76
+ private refreshItems;
77
+ }
@@ -0,0 +1,32 @@
1
+ import { Ref } from 'vue';
2
+ import { ScreenshotOptions } from './RenderSubContext';
3
+ /**
4
+ * UI子上下文接口
5
+ * 提供UI状态查询和控制能力
6
+ */
7
+ export interface UISubContext {
8
+ /** 是否全屏 */
9
+ isFullscreen(): boolean;
10
+ /** 是否显示坐标轴 */
11
+ showAxes(): boolean;
12
+ /** 获取当前背景色 */
13
+ getBackgroundColor(): string;
14
+ /** 响应式默认背景色(由 VtkViewer props.background 驱动) */
15
+ readonly defaultBackground: Ref<string>;
16
+ /** 设置默认背景色(响应式更新) */
17
+ setDefaultBackground(color: string): void;
18
+ /** 截图 */
19
+ captureScreenshot(options?: ScreenshotOptions): Promise<Blob>;
20
+ /** 切换全屏 */
21
+ toggleFullscreen(): void;
22
+ /** 切换坐标轴显示 */
23
+ toggleAxes(): void;
24
+ /** 设置当前背景色 */
25
+ setBackgroundColor(color: string): void;
26
+ /** 应用视图预设 */
27
+ applyViewPreset(preset: string): void;
28
+ /** 是否紧凑模式 */
29
+ isCompactMode(): boolean;
30
+ /** 切换紧凑模式 */
31
+ toggleCompactMode(): void;
32
+ }
@@ -0,0 +1,101 @@
1
+ import { Ref } from 'vue';
2
+ import { PluginRegistry } from '../plugins';
3
+ import { RenderSubContext } from './RenderSubContext';
4
+ import { SceneSubContext } from './SceneSubContext';
5
+ import { InteractionSubContext } from './InteractionSubContext';
6
+ import { UISubContext } from './UISubContext';
7
+ import { IStateManager } from './StateManager';
8
+ import { CommandRegistry } from './CommandRegistry';
9
+ import { EventBus } from './EventBus';
10
+ import { ConfigAccessor } from './ConfigAccessor';
11
+ import { DisposalRegistry } from './DisposalRegistry';
12
+ import { ResetManager } from './ResetManager';
13
+ import { IToolbarInfoRegistry } from './ToolbarInfoRegistry';
14
+ import { IToolbarExtensionRegistry } from './ToolbarExtensionRegistry';
15
+ import { ThemeContext } from './ThemeContext';
16
+ /**
17
+ * 主题配置
18
+ */
19
+ export interface ThemeConfig {
20
+ /** 主题唯一标识 */
21
+ id: string;
22
+ /** 主题显示名称 */
23
+ name: string;
24
+ /** 是否为暗色主题 */
25
+ isDark: boolean;
26
+ /** 主题颜色配置 */
27
+ colors: {
28
+ toolbarBg: string;
29
+ toolbarBorder: string;
30
+ btnBg: string;
31
+ btnBgHover: string;
32
+ btnBgActive: string;
33
+ btnColor: string;
34
+ btnColorHover: string;
35
+ btnColorActive: string;
36
+ separatorColor: string;
37
+ popupBg: string;
38
+ popupBorder: string;
39
+ popupColor: string;
40
+ popupLabelColor: string;
41
+ inputBg: string;
42
+ inputBorder: string;
43
+ inputColor: string;
44
+ loadingBg: string;
45
+ loadingCardBg: string;
46
+ loadingText: string;
47
+ loadingTextSecondary: string;
48
+ infoPanelBg: string;
49
+ infoPanelLabel: string;
50
+ infoPanelValue: string;
51
+ errorBg: string;
52
+ errorBorder: string;
53
+ errorColor: string;
54
+ /** 扩展区背景色 */
55
+ extensionBg: string;
56
+ /** 扩展区分隔线颜色 */
57
+ extensionSeparatorColor: string;
58
+ };
59
+ }
60
+ /**
61
+ * 查看器上下文接口
62
+ * 插件通过 init(ctx) 方法接收此上下文
63
+ */
64
+ export interface ViewerContext {
65
+ /** 查看器是否已就绪(完成初始化) */
66
+ readonly isReady: Ref<boolean>;
67
+ /** VTK.js 渲染能力 */
68
+ readonly render: RenderSubContext;
69
+ /** 场景对象管理 */
70
+ readonly scene: SceneSubContext;
71
+ /** 用户交互控制 */
72
+ readonly interaction: InteractionSubContext;
73
+ /** UI状态和控制 */
74
+ readonly ui: UISubContext;
75
+ /** 统一状态管理 */
76
+ readonly stateManager: IStateManager;
77
+ /** 命令注册/执行 */
78
+ readonly commands: CommandRegistry;
79
+ /** 事件总线 */
80
+ readonly events: EventBus;
81
+ /** 配置访问 */
82
+ readonly config: ConfigAccessor;
83
+ /** 资源管理 */
84
+ readonly disposal: DisposalRegistry;
85
+ /** 插件注册表(用于插件间访问) */
86
+ readonly plugins: PluginRegistry;
87
+ /** 插件状态重置管理器 */
88
+ readonly resetManager: ResetManager;
89
+ /** 工具栏信息面板注册表 */
90
+ readonly infoPanel: IToolbarInfoRegistry;
91
+ /** 工具栏扩展区注册表 */
92
+ readonly toolbarExtension: IToolbarExtensionRegistry;
93
+ /** 主题状态管理(单一数据源) */
94
+ readonly theme: ThemeContext;
95
+ /** 外部解码器路径配置,供格式插件获取解码器入口(可响应式更新) */
96
+ readonly decoders: Record<string, string>;
97
+ /** 是否启用手势控制(触屏交互总开关) */
98
+ readonly enableGesture: Ref<boolean>;
99
+ /** 是否启用键盘控制(快捷键总开关) */
100
+ readonly enableKeyboard: Ref<boolean>;
101
+ }
@@ -0,0 +1,57 @@
1
+ import { Ref } from 'vue';
2
+ import { PluginRegistry } from '../plugins';
3
+ import { ViewerContext } from './ViewerContext';
4
+ import { RenderSubContext } from './RenderSubContext';
5
+ import { SceneSubContext } from './SceneSubContext';
6
+ import { InteractionSubContext } from './InteractionSubContext';
7
+ import { UISubContext } from './UISubContext';
8
+ import { IStateManager } from './StateManager';
9
+ import { CommandRegistry } from './CommandRegistry';
10
+ import { EventBus } from './EventBus';
11
+ import { ConfigAccessor } from './ConfigAccessor';
12
+ import { DisposalRegistry } from './DisposalRegistry';
13
+ import { ResetManager } from './ResetManager';
14
+ import { IToolbarInfoRegistry } from './ToolbarInfoRegistry';
15
+ import { IToolbarExtensionRegistry } from './ToolbarExtensionRegistry';
16
+ import { ThemeContext } from './ThemeContext';
17
+ export declare class ViewerContextBuilder {
18
+ private _render;
19
+ private _scene;
20
+ private _interaction;
21
+ private _ui;
22
+ private _stateManager;
23
+ private _commands;
24
+ private _events;
25
+ private _config;
26
+ private _disposal;
27
+ private _plugins;
28
+ private _resetManager;
29
+ private _infoPanel;
30
+ private _toolbarExtension;
31
+ private _theme;
32
+ private _decoders;
33
+ private _isReady;
34
+ private _enableGesture;
35
+ private _enableKeyboard;
36
+ /** 分步注入各子上下文 */
37
+ withRender(ctx: RenderSubContext): this;
38
+ withScene(ctx: SceneSubContext): this;
39
+ withInteraction(ctx: InteractionSubContext): this;
40
+ withUI(ctx: UISubContext): this;
41
+ withStateManager(sm: IStateManager): this;
42
+ withCommands(cr: CommandRegistry): this;
43
+ withEvents(eb: EventBus): this;
44
+ withConfig(ca: ConfigAccessor): this;
45
+ withDisposal(dr: DisposalRegistry): this;
46
+ withPlugins(pr: PluginRegistry): this;
47
+ withResetManager(rm: ResetManager): this;
48
+ withInfoPanel(ip: IToolbarInfoRegistry): this;
49
+ withToolbarExtension(te: IToolbarExtensionRegistry): this;
50
+ withTheme(theme: ThemeContext): this;
51
+ withDecoders(decoders: Record<string, string>): this;
52
+ withIsReady(isReady: Ref<boolean>): this;
53
+ withEnableGesture(enableGesture: Ref<boolean>): this;
54
+ withEnableKeyboard(enableKeyboard: Ref<boolean>): this;
55
+ /** 构建最终的 ViewerContext(校验所有字段已注入) */
56
+ build(): ViewerContext;
57
+ }
@@ -0,0 +1,26 @@
1
+ import { Ref } from 'vue';
2
+ import { vtkRenderWindow } from '@kitware/vtk.js/Rendering/Core/RenderWindow';
3
+ import { vtkRenderer } from '@kitware/vtk.js/Rendering/Core/Renderer';
4
+ import { RenderSubContext, InteractionSubContext, SceneSubContext, UISubContext, ConfigAccessor, EventBus } from '.';
5
+ /**
6
+ * 创建渲染子上下文(真实 VTK.js 渲染管线)
7
+ */
8
+ export declare function createRenderSubContext(): RenderSubContext;
9
+ /**
10
+ * 创建场景子上下文(真实 Actor/Volume 管理)
11
+ * @param getRenderer 动态获取渲染器的函数(延迟绑定,因为渲染器在 attachToContainer 后才可用)
12
+ */
13
+ export declare function createSceneSubContext(getRenderer: () => vtkRenderer | null): SceneSubContext;
14
+ /**
15
+ * 创建交互子上下文(真实 VTK.js 交互管线)
16
+ * @param getRenderWindow 动态获取渲染窗口的函数(延迟绑定)
17
+ * @param getRenderer 动态获取渲染器的函数(延迟绑定)
18
+ */
19
+ export declare function createInteractionSubContext(getRenderWindow: () => vtkRenderWindow | null, getRenderer: () => vtkRenderer | null, configAccessor?: ConfigAccessor, events?: EventBus, enableGesture?: Ref<boolean>, enableKeyboard?: Ref<boolean>): InteractionSubContext;
20
+ /**
21
+ * 创建UI子上下文
22
+ * @param getRenderWindow 延迟获取渲染窗口的函数
23
+ * @param getContainer 延迟获取内容区域容器的函数
24
+ * @param getFullscreenContainer 延迟获取全屏容器的函数(默认使用内容区域)
25
+ */
26
+ export declare function createUISubContext(getRenderWindow: () => vtkRenderWindow | null, getContainer: () => HTMLElement | null, getFullscreenContainer?: () => HTMLElement | null): UISubContext;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 核心模块导出
3
+ */
4
+ export * from './ViewerContext';
5
+ export * from './ViewerContextBuilder';
6
+ export * from './RenderSubContext';
7
+ export * from './SceneSubContext';
8
+ export * from './InteractionSubContext';
9
+ export * from './UISubContext';
10
+ export * from './StateManager';
11
+ export * from './CommandRegistry';
12
+ export * from './EventBus';
13
+ export * from './ConfigAccessor';
14
+ export * from './DisposalRegistry';
15
+ export * from './FormatDetector';
16
+ export * from './ResetManager';
17
+ export * from './ResetRegistry';
18
+ export * from './I18nManager';
19
+ export * from './ToolbarExtensionRegistry';
20
+ export * from './ToolbarInfoRegistry';
21
+ export * from './createViewerContext';
22
+ export * from './ThemeContext';
23
+ export * from './CommandRegistrar';
@@ -0,0 +1,47 @@
1
+ import { Component } from 'vue';
2
+ export declare const RotateIcon: Component;
3
+ export declare const ZoomIcon: Component;
4
+ export declare const PanIcon: Component;
5
+ export declare const CenterModelIcon: Component;
6
+ export declare const ResetIcon: Component;
7
+ export declare const UnloadIcon: Component;
8
+ export declare const ScreenshotIcon: Component;
9
+ export declare const FullscreenIcon: Component;
10
+ export declare const FullscreenExitIcon: Component;
11
+ export declare const AxesIcon: Component;
12
+ export declare const AxesDisplayIcon: Component;
13
+ export declare const AxesBothIcon: Component;
14
+ export declare const BackgroundColorIcon: Component;
15
+ export declare const ViewSelectIcon: Component;
16
+ export declare const RenderStyleIcon: Component;
17
+ export declare const RenderGridIcon: Component;
18
+ export declare const ClippingIcon: Component;
19
+ export declare const SaveCameraIcon: Component;
20
+ export declare const RestoreCameraIcon: Component;
21
+ export declare const LightIntensityIcon: Component;
22
+ export declare const SurfaceIcon: Component;
23
+ export declare const WireframeIcon: Component;
24
+ export declare const PointIcon: Component;
25
+ export declare const MeasurementDistanceIcon: Component;
26
+ export declare const MeasurementAngleIcon: Component;
27
+ export declare const MeasurementPointIcon: Component;
28
+ export declare const PlayIcon: Component;
29
+ export declare const PauseIcon: Component;
30
+ export declare const PerformanceIcon: Component;
31
+ export declare const VolumeIcon: Component;
32
+ export declare const ColorByIcon: Component;
33
+ export declare const RenderPrecisionIcon: Component;
34
+ export declare const ThemeSwitchIcon: Component;
35
+ export declare const CheckIcon: Component;
36
+ export declare const ErrorIcon: Component;
37
+ export declare const WarningIcon: Component;
38
+ export declare const InfoIcon: Component;
39
+ export declare const DeleteIcon: Component;
40
+ export declare const BookmarkIcon: Component;
41
+ export declare const BookmarkFilledIcon: Component;
42
+ export declare const BookmarkAddIcon: Component;
43
+ export declare const BookmarkListIcon: Component;
44
+ export declare const ScreenshotHiResIcon: Component;
45
+ export declare const ScreenshotWebpIcon: Component;
46
+ export declare const LoadModelIcon: Component;
47
+ export declare const SceneTreeIcon: Component;
@@ -0,0 +1,7 @@
1
+ export * from './core';
2
+ export * from './plugins';
3
+ export * from './components';
4
+ export * from './utils';
5
+ export * from './configs';
6
+ export * from './icons';
7
+ export * from './types';