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,98 @@
1
+ import { IResettableActions, ResetAction } from '../../../core';
2
+ import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
3
+ import { PluginBase } from '../../PluginBase';
4
+ import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
5
+ type GridDirection = 'xy' | 'yz' | 'xz';
6
+ interface ModelBounds {
7
+ x: {
8
+ min: number;
9
+ max: number;
10
+ };
11
+ y: {
12
+ min: number;
13
+ max: number;
14
+ };
15
+ z: {
16
+ min: number;
17
+ max: number;
18
+ };
19
+ }
20
+ type StepCalculator = (bounds: ModelBounds, dir: GridDirection) => number;
21
+ interface GridDirCfg {
22
+ visible: boolean;
23
+ color: [number, number, number];
24
+ step: number;
25
+ opacity: number;
26
+ /** 是否扩展到空间(从平面网格扩展为3D空间网格) */
27
+ expandToSpace: boolean;
28
+ }
29
+ interface AutoAdaptConfig {
30
+ enabled: boolean;
31
+ xyCalculator?: StepCalculator;
32
+ yzCalculator?: StepCalculator;
33
+ xzCalculator?: StepCalculator;
34
+ }
35
+ export interface RenderGridPluginConfig extends ToolbarPluginConfig {
36
+ defaultStep?: number;
37
+ autoAdapt?: AutoAdaptConfig;
38
+ xy?: Partial<GridDirCfg>;
39
+ yz?: Partial<GridDirCfg>;
40
+ xz?: Partial<GridDirCfg>;
41
+ }
42
+ export declare class RenderGridPlugin extends PluginBase<RenderGridPluginConfig> implements IToolbarPlugin, IResettableActions {
43
+ readonly metadata: {
44
+ id: string;
45
+ name: string;
46
+ type: "toolbar";
47
+ description: string;
48
+ };
49
+ readonly order = 4;
50
+ readonly defaultConfig: RenderGridPluginConfig;
51
+ private autoAdapt;
52
+ private panelOpen;
53
+ private expanded;
54
+ /** 当前模型边界,用于计算网格范围和间距滑块最大值 */
55
+ private currentModelBounds;
56
+ private dCfg;
57
+ private vis;
58
+ private clr;
59
+ private stp;
60
+ private opa;
61
+ private expand;
62
+ private autoStp;
63
+ private actors;
64
+ private mappers;
65
+ protected onInit(): void;
66
+ /** 更新缓存的模型边界 */
67
+ private syncBoundsAndRebuild;
68
+ private createActors;
69
+ /** 从模型 Actor 获取边界(排除网格 Actor 自身) */
70
+ private getModelBounds;
71
+ /** 备用方案:从 renderer 获取边界(排除网格 Actor) */
72
+ private getBoundsFromRenderer;
73
+ private recalcAuto;
74
+ private getStep;
75
+ private rebuildGrid;
76
+ private rebuildAll;
77
+ private clearAll;
78
+ private toggleDir;
79
+ private setColor;
80
+ private setStep;
81
+ private setOpa;
82
+ private toggleExpand;
83
+ private toggleAuto;
84
+ private resetToDefaults;
85
+ private getActiveState;
86
+ private get hasVisiblePlane();
87
+ private getIconCfg;
88
+ protected onDispose(): void;
89
+ registerResetActions(): ResetAction[];
90
+ private getStepMax;
91
+ render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
92
+ [key: string]: any;
93
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
94
+ isVisible(): boolean;
95
+ getShortcutConfig(): KeyboardShortcutConfigItem[];
96
+ getKeyboardShortcutActions(): KeyboardShortcutAction[];
97
+ }
98
+ export {};
@@ -0,0 +1,49 @@
1
+ import { ToolbarPluginConfig, IToolbarPlugin } from '../../types';
2
+ import { PluginBase } from '../../PluginBase';
3
+ import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
4
+ /** 主题切换插件配置 */
5
+ export interface ThemeSwitchPluginConfig extends ToolbarPluginConfig {
6
+ /** 可用主题列表(主题ID数组),默认显示所有内置主题 */
7
+ availableThemes?: string[];
8
+ /** 默认主题ID */
9
+ defaultTheme?: string;
10
+ }
11
+ /**
12
+ * 主题切换插件
13
+ * 在工具栏中提供主题切换下拉菜单
14
+ * 从 ctx.theme 读取和修改主题状态(单一数据源)
15
+ */
16
+ export declare class ThemeSwitchPlugin extends PluginBase<ThemeSwitchPluginConfig> implements IToolbarPlugin {
17
+ readonly metadata: {
18
+ id: string;
19
+ name: string;
20
+ type: "toolbar";
21
+ description: string;
22
+ };
23
+ readonly order = 10;
24
+ readonly defaultConfig: ThemeSwitchPluginConfig;
25
+ /** 下拉菜单是否展开 */
26
+ private isDropdownOpen;
27
+ /** 下拉弹窗对齐管理器(运行时自动根据按钮位置判断向左/向右展开) */
28
+ private dropdownAlignment;
29
+ protected onInit(): void;
30
+ protected onDispose(): void;
31
+ /** 处理点击外部关闭下拉菜单 */
32
+ private handleOutsideClick;
33
+ /** 切换主题(调用 ctx.theme.setTheme) */
34
+ switchTheme(themeId: string): void;
35
+ /** 获取当前主题ID(从 ctx.theme 读取) */
36
+ getCurrentThemeId(): string;
37
+ /** 获取VTK容器元素 */
38
+ private getContainer;
39
+ /** 切换下拉菜单 */
40
+ private toggleDropdown;
41
+ /** 可用主题列表(从 ctx.theme 获取) */
42
+ private get availableThemes();
43
+ /** 当前主题配置(从 ctx.theme 获取) */
44
+ private get currentTheme();
45
+ render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
46
+ [key: string]: any;
47
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
48
+ isVisible(): boolean;
49
+ }
@@ -0,0 +1,6 @@
1
+ export * from './AxesPlugin';
2
+ export * from './BackgroundColorPlugin';
3
+ export * from './LanguageSwitchPlugin';
4
+ export * from './LightIntensityPlugin';
5
+ export * from './RenderGridPlugin';
6
+ export * from './ThemeSwitchPlugin';
@@ -0,0 +1,70 @@
1
+ import { Component } from 'vue';
2
+ import { IResettableActions, ResetAction } from '../../../core';
3
+ import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin, PluginIcon } from '../../types';
4
+ import { PluginBase } from '../../PluginBase';
5
+ /** 书签插件配置 */
6
+ export interface BookmarkPluginConfig extends ToolbarPluginConfig {
7
+ /** 最大书签数量,默认 20 */
8
+ maxBookmarks?: number;
9
+ /** 场景清空时是否自动清除书签,默认 true */
10
+ clearOnSceneClear?: boolean;
11
+ /** 添加书签图标 */
12
+ addIcon?: PluginIcon;
13
+ }
14
+ export declare class BookmarkPlugin extends PluginBase<BookmarkPluginConfig> implements IToolbarPlugin, IResettableActions {
15
+ readonly metadata: {
16
+ id: string;
17
+ name: string;
18
+ type: "toolbar";
19
+ description: string;
20
+ };
21
+ readonly order = 7;
22
+ readonly defaultConfig: BookmarkPluginConfig;
23
+ /** 书签列表 */
24
+ private bookmarks;
25
+ /** 是否显示下拉弹窗 */
26
+ private isDropdownOpen;
27
+ /** 下拉弹窗对齐管理器(运行时自动根据按钮位置判断向左/向右展开) */
28
+ private dropdownAlignment;
29
+ /** 新增书签名称输入 */
30
+ private editingName;
31
+ /** 提示信息 */
32
+ private feedbackText;
33
+ private feedbackType;
34
+ /** 计数器,用于自动生成书签名称 */
35
+ private autoNameCounter;
36
+ /** 最大书签数量(快捷访问) */
37
+ private get maxBookmarks();
38
+ protected onInit(): void;
39
+ protected onDispose(): void;
40
+ /** 处理点击外部关闭弹窗 */
41
+ private handleOutsideClick;
42
+ /**
43
+ * 添加书签
44
+ * 支持输入/不输入名称,不输入时自动生成 autoName + N
45
+ */
46
+ private addBookmark;
47
+ /**
48
+ * 恢复书签视角
49
+ */
50
+ private restoreBookmark;
51
+ /**
52
+ * 删除书签
53
+ */
54
+ private deleteBookmark;
55
+ /**
56
+ * 清除全部书签,重置自动命名计数器
57
+ */
58
+ private clearAllBookmarks;
59
+ /**
60
+ * 显示反馈提示
61
+ */
62
+ private showFeedback;
63
+ /** 切换下拉弹窗 */
64
+ private toggleDropdown;
65
+ registerResetActions(): ResetAction[];
66
+ render(): Component;
67
+ isVisible(): boolean;
68
+ getShortcutConfig(): KeyboardShortcutConfigItem[];
69
+ getKeyboardShortcutActions(): KeyboardShortcutAction[];
70
+ }
@@ -0,0 +1,112 @@
1
+ import { Component, DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ import { IResettableActions, ResetAction } from '../../../core';
3
+ import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
4
+ import { PluginBase } from '../../PluginBase';
5
+ /** 测量类型 */
6
+ export type MeasurementType = 'point' | 'distance' | 'angle';
7
+ /** 测量模式配置 */
8
+ interface MeasurementModeConfig {
9
+ /** 每组需要的点数 */
10
+ pointsPerGroup: number;
11
+ /** 最大组数 */
12
+ maxGroups: number;
13
+ /** 模式图标 */
14
+ icon: any;
15
+ /** 模式名称 */
16
+ label: string;
17
+ }
18
+ /** 测量插件配置 */
19
+ export interface MeasurementPluginConfig extends ToolbarPluginConfig {
20
+ /** 默认测量类型 */
21
+ defaultType?: MeasurementType;
22
+ /** 测量模式配置 */
23
+ modeConfig?: Record<MeasurementType, MeasurementModeConfig>;
24
+ /** 颜色方案,依次为第1组、第2组、第3组、第4组... */
25
+ colors?: [number, number, number][];
26
+ /** 标记半径比例,默认0.003*/
27
+ markerRadiusRatio?: number;
28
+ /** 管线半径比例,默认0.0015*/
29
+ tubeRadiusRatio?: number;
30
+ }
31
+ export declare class MeasurementPlugin extends PluginBase<MeasurementPluginConfig> implements IToolbarPlugin, IResettableActions {
32
+ readonly metadata: {
33
+ id: string;
34
+ name: string;
35
+ type: "toolbar";
36
+ description: string;
37
+ };
38
+ readonly order = 0;
39
+ readonly defaultConfig: MeasurementPluginConfig;
40
+ /** 测量是否启用(响应式) */
41
+ private enabled;
42
+ /** 当前测量模式(响应式) */
43
+ private activeType;
44
+ /** 测量结果列表(响应式) */
45
+ private measurements;
46
+ /** 拾取器 */
47
+ private cellPicker;
48
+ /** 左键点击事件订阅句柄 */
49
+ private clickSubscription;
50
+ /** 鼠标移动事件订阅句柄 */
51
+ private mouseMoveSubscription;
52
+ /** 测量 ID 计数器 */
53
+ private measurementIdCounter;
54
+ /** 测量组数据 */
55
+ private groups;
56
+ /** extension watcher 停止函数(locale 变更时先停止旧 watcher 再重新注册) */
57
+ private extensionWatcher;
58
+ protected onInit(): void;
59
+ protected onDispose(): void;
60
+ registerResetActions(): ResetAction[];
61
+ /** 初始化测量工具(渲染管线就绪后调用) */
62
+ private initMeasurement;
63
+ /** 切换测量启用状态 */
64
+ private toggleMeasurement;
65
+ /** 启用测量模式 */
66
+ private enableMeasurement;
67
+ /** 禁用测量模式 */
68
+ private disableMeasurement;
69
+ /** 设置测量类型 */
70
+ private setMeasurementType;
71
+ /** 清除所有测量结果 */
72
+ private clearMeasurements;
73
+ /** 获取当前模式配置 */
74
+ private getModeConfig;
75
+ /** 获取当前组 */
76
+ private getCurrentGroup;
77
+ /** 递归释放 Actor 及其内部 VTK 对象(mapper/inputData/property/source/filter) */
78
+ private deepDeleteActor;
79
+ /** 清理所有组的临时标记 */
80
+ private clearAllGroups;
81
+ /** 完成一个组的测量 */
82
+ private completeGroup;
83
+ /** 注册测量结果到信息面板 */
84
+ private registerInfoPanel;
85
+ /** 注销信息面板 */
86
+ /** 注册测量模式选择扩展区 */
87
+ private registerExtension;
88
+ /** 注销测量模式选择扩展区 */
89
+ /** 渲染扩展区内容(测量模式选择下拉菜单) */
90
+ renderExtension(): Component;
91
+ /** 处理鼠标左键点击(拾取测量点) */
92
+ private handleClickPick;
93
+ /** 计算场景对角线长度(用于自适应标记/连线大小) */
94
+ private getSceneDiagonal;
95
+ /**
96
+ * 创建测量点标记(小球)
97
+ * 半径根据场景尺寸自适应:sceneSize * 0.005
98
+ */
99
+ private createMarker;
100
+ /**
101
+ * 创建测量连线(管状线)
102
+ * 使用 vtkLineSource + vtkTubeFilter 渲染为 3D 管道
103
+ */
104
+ private createLine;
105
+ render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
106
+ [key: string]: any;
107
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
108
+ isVisible(): boolean;
109
+ getShortcutConfig(): KeyboardShortcutConfigItem[];
110
+ getKeyboardShortcutActions(): KeyboardShortcutAction[];
111
+ }
112
+ export {};
@@ -0,0 +1,55 @@
1
+ import { ToolbarPluginConfig, IToolbarPlugin } from '../../types';
2
+ import { PluginBase } from '../../PluginBase';
3
+ import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
4
+ /** 性能监控插件配置 */
5
+ export interface PerformancePluginConfig extends ToolbarPluginConfig {
6
+ /** 是否显示FPS */
7
+ showFPS?: boolean;
8
+ /** 是否显示内存使用量 */
9
+ showMemory?: boolean;
10
+ /** 是否显示渲染时间 */
11
+ showRenderTime?: boolean;
12
+ /** 是否显示三角形数 */
13
+ showTriangleCount?: boolean;
14
+ /** 内存刷新间隔(ms) */
15
+ memoryRefreshInterval?: number;
16
+ }
17
+ export declare class PerformancePlugin extends PluginBase<PerformancePluginConfig> implements IToolbarPlugin {
18
+ readonly metadata: {
19
+ id: string;
20
+ name: string;
21
+ type: "toolbar";
22
+ description: string;
23
+ };
24
+ readonly order = 0;
25
+ readonly defaultConfig: PerformancePluginConfig;
26
+ /** 是否启用监控(响应式) */
27
+ private monitoring;
28
+ /** 性能数据 */
29
+ private fps;
30
+ private renderTime;
31
+ private triangleCount;
32
+ private memoryUsed;
33
+ private memoryTotal;
34
+ private memoryLimit;
35
+ private memoryPercent;
36
+ private memoryTimer;
37
+ protected onInit(): void;
38
+ protected onDispose(): void;
39
+ private enableMonitoring;
40
+ /** 禁用监控 */
41
+ private disableMonitoring;
42
+ /** 切换监控状态 */
43
+ private toggleMonitoring;
44
+ private onPerformanceUpdate;
45
+ /** 更新内存信息 */
46
+ private updateMemoryInfo;
47
+ /** 格式化内存大小 */
48
+ private formatMemory;
49
+ /** 注册信息面板 */
50
+ private registerInfoPanel;
51
+ render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
52
+ [key: string]: any;
53
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
54
+ isVisible(): boolean;
55
+ }
@@ -0,0 +1,58 @@
1
+ import { Component } from 'vue';
2
+ import { IResettableActions, ResetAction } from '../../../core';
3
+ import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
4
+ import { PluginBase } from '../../PluginBase';
5
+ /** 截图倍率 */
6
+ export type ScreenshotMultiplier = 1 | 2 | 4;
7
+ /** 截图格式 */
8
+ export type ScreenshotFormat = 'png' | 'jpeg' | 'webp';
9
+ /** 截图插件配置 */
10
+ export interface ScreenshotPluginConfig extends ToolbarPluginConfig {
11
+ /** 默认截图格式,默认 'png' */
12
+ defaultFormat?: ScreenshotFormat;
13
+ /** 默认图片质量 (0-1),默认 1.0 */
14
+ defaultQuality?: number;
15
+ /** 默认倍率,默认 1 */
16
+ defaultMultiplier?: ScreenshotMultiplier;
17
+ /** 默认透明背景,默认 false */
18
+ defaultTransparentBg?: boolean;
19
+ }
20
+ export declare class ScreenshotPlugin extends PluginBase<ScreenshotPluginConfig> implements IToolbarPlugin, IResettableActions {
21
+ readonly metadata: {
22
+ id: string;
23
+ name: string;
24
+ type: "toolbar";
25
+ description: string;
26
+ };
27
+ readonly order = 0;
28
+ readonly defaultConfig: ScreenshotPluginConfig;
29
+ /** 是否显示下拉弹窗 */
30
+ private isDropdownOpen;
31
+ /** 下拉弹窗对齐管理器(运行时自动根据按钮位置判断向左/向右展开) */
32
+ private dropdownAlignment;
33
+ /** 截图倍率 */
34
+ private multiplier;
35
+ /** 截图格式 */
36
+ private format;
37
+ /** 图片质量 (0-1) */
38
+ private quality;
39
+ /** 是否透明背景 */
40
+ private transparentBg;
41
+ /** 导出状态:'idle' | 'exporting' | 'done' | 'error' */
42
+ private exportStatus;
43
+ /** 状态提示信息 */
44
+ private statusText;
45
+ protected onInit(): void;
46
+ protected onDispose(): void;
47
+ /** 处理点击外部关闭弹窗 */
48
+ private handleOutsideClick;
49
+ /**
50
+ * 执行截图并下载
51
+ */
52
+ private captureAndDownload;
53
+ registerResetActions(): ResetAction[];
54
+ render(): Component;
55
+ isVisible(): boolean;
56
+ getShortcutConfig(): KeyboardShortcutConfigItem[];
57
+ getKeyboardShortcutActions(): KeyboardShortcutAction[];
58
+ }
@@ -0,0 +1,4 @@
1
+ export * from './BookmarkPlugin';
2
+ export * from './MeasurementPlugin';
3
+ export * from './PerformancePlugin';
4
+ export * from './ScreenshotPlugin';
@@ -0,0 +1,67 @@
1
+ import { Component, VNode, Ref } from 'vue';
2
+ import { PluginIcon, ToolbarIconConfig, KeyboardShortcutConfigItem, ShortcutConfig } from '../types';
3
+ /**
4
+ * 渲染工具栏图标
5
+ * 支持字符串(emoji)、Vue组件、ToolbarIconConfig
6
+ *
7
+ * @param icon 图标配置
8
+ * @param state 当前状态(用于多状态图标)
9
+ * @param active 是否激活状态(用于双状态图标)
10
+ * @returns VNode | string
11
+ */
12
+ export declare function renderToolbarIcon(icon: PluginIcon | undefined | null, state?: string, active?: boolean): VNode | string;
13
+ /**
14
+ * 创建图标配置
15
+ * 用于简化插件中图标配置的创建
16
+ *
17
+ * @param defaultIcon 默认图标
18
+ * @param activeIcon 激活状态图标
19
+ * @param inactiveIcon 非激活状态图标
20
+ * @param states 多状态图标
21
+ * @returns ToolbarIconConfig
22
+ */
23
+ export declare function createIconConfig(defaultIcon: Component, activeIcon?: Component, inactiveIcon?: Component, states?: Record<string, Component>): ToolbarIconConfig;
24
+ /**
25
+ * 标准化快捷键配置
26
+ * 将各种简写形式统一解析为 KeyboardShortcutConfigItem[]
27
+ *
28
+ * @param config 快捷键配置(支持多种简写形式)
29
+ * @param defaultAction 默认动作标识(当使用 string/string[] 简写时需要)
30
+ * @param defaultDescription 默认描述(可选)
31
+ * @returns 标准化的 KeyboardShortcutConfigItem[]
32
+ */
33
+ export declare function normalizeShortcutConfig(config: ShortcutConfig | undefined, defaultAction?: string, defaultDescription?: string): KeyboardShortcutConfigItem[];
34
+ /**
35
+ * 下拉弹窗对齐管理对象
36
+ * 通过 ref 跟踪当前对齐方向,并提供 update() 方法在弹窗打开时重新计算
37
+ */
38
+ export interface DropdownAlignment {
39
+ /** 当前对齐方向:'left'(弹窗向右展开)或 'right'(弹窗向左展开) */
40
+ align: Ref<'left' | 'right'>;
41
+ /** 重新计算对齐方向(应在弹窗打开后、DOM 渲染后调用) */
42
+ update: () => Promise<void>;
43
+ }
44
+ /**
45
+ * 创建下拉弹窗对齐管理器
46
+ * 根据按钮在视口中的位置自动判断弹窗应向左还是向右展开,
47
+ * 确保弹窗始终在可视范围内 —— 无论按钮在工具栏的什么位置。
48
+ *
49
+ * 使用示例:
50
+ * ```ts
51
+ * private dropdownAlignment = createDropdownAlignment('iimm-vtk-screenshot')
52
+ * // 在按钮点击时:
53
+ * if (this.isDropdownOpen.value) this.dropdownAlignment.update()
54
+ * // 在弹窗 div 上:
55
+ * style: getDropdownAlignStyle(this.dropdownAlignment.align.value)
56
+ * ```
57
+ *
58
+ * @param containerClass 插件容器元素的 CSS 类名(不含前导点)
59
+ * @param dropdownMinWidth 弹窗的最小宽度(含边距),默认 280px
60
+ */
61
+ export declare function createDropdownAlignment(containerClass: string, dropdownMinWidth?: number): DropdownAlignment;
62
+ /**
63
+ * 根据对齐方向返回对应的内联样式对象
64
+ * @param align 对齐方向('left' 或 'right')
65
+ * @returns Vue style 绑定对象
66
+ */
67
+ export declare function getDropdownAlignStyle(align: 'left' | 'right' | undefined): Record<string, string>;