vim-web 0.3.23 → 0.3.25

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 (192) hide show
  1. package/dist/types/react-viewer/bim/bimInfoBody.d.ts +9 -0
  2. package/dist/types/react-viewer/bim/bimInfoData.d.ts +77 -0
  3. package/dist/types/react-viewer/bim/bimInfoHeader.d.ts +6 -0
  4. package/dist/types/react-viewer/bim/bimInfoObject.d.ts +12 -0
  5. package/dist/types/react-viewer/bim/bimInfoPanel.d.ts +10 -0
  6. package/dist/types/react-viewer/bim/bimInfoVim.d.ts +5 -0
  7. package/dist/types/react-viewer/bim/bimPanel.d.ts +40 -0
  8. package/dist/types/react-viewer/bim/bimSearch.d.ts +17 -0
  9. package/dist/types/react-viewer/bim/bimTree.d.ts +31 -0
  10. package/dist/types/react-viewer/bim/bimTreeData.d.ts +43 -0
  11. package/dist/types/react-viewer/bim/bimUtils.d.ts +13 -0
  12. package/dist/types/react-viewer/bim/openState.d.ts +5 -0
  13. package/dist/types/react-viewer/container.d.ts +27 -0
  14. package/dist/types/react-viewer/controlbar/controlBar.d.ts +57 -0
  15. package/dist/types/react-viewer/controlbar/controlBarButton.d.ts +17 -0
  16. package/dist/types/react-viewer/controlbar/controlBarCommands.d.ts +4 -0
  17. package/dist/types/react-viewer/controlbar/controlBarSection.d.ts +10 -0
  18. package/dist/types/react-viewer/controlbar/fullScreenState.d.ts +4 -0
  19. package/dist/types/react-viewer/controlbar/measureState.d.ts +7 -0
  20. package/dist/types/react-viewer/controlbar/pointerState.d.ts +6 -0
  21. package/dist/types/react-viewer/controlbar/restOfScreen.d.ts +5 -0
  22. package/dist/types/react-viewer/controlbar/sectionBoxState.d.ts +15 -0
  23. package/dist/types/react-viewer/errors/errorStyle.d.ts +15 -0
  24. package/dist/types/react-viewer/errors/errorUtils.d.ts +2 -0
  25. package/dist/types/react-viewer/errors/errors.d.ts +5 -0
  26. package/dist/types/react-viewer/errors/fileDownloadingError.d.ts +2 -0
  27. package/dist/types/react-viewer/errors/fileLoadingError.d.ts +2 -0
  28. package/dist/types/react-viewer/errors/fileOpeningError.d.ts +2 -0
  29. package/dist/types/react-viewer/errors/serverCompatibilityError.d.ts +2 -0
  30. package/dist/types/react-viewer/errors/serverConnectionError.d.ts +2 -0
  31. package/dist/types/react-viewer/helpers/camera.d.ts +37 -0
  32. package/dist/types/react-viewer/helpers/cameraObserver.d.ts +8 -0
  33. package/dist/types/react-viewer/helpers/cursor.d.ts +35 -0
  34. package/dist/types/react-viewer/helpers/data.d.ts +27 -0
  35. package/dist/types/react-viewer/helpers/deferredPromise.d.ts +8 -0
  36. package/dist/types/react-viewer/helpers/element.d.ts +13 -0
  37. package/dist/types/react-viewer/helpers/fullScreenObserver.d.ts +9 -0
  38. package/dist/types/react-viewer/helpers/inputs.d.ts +23 -0
  39. package/dist/types/react-viewer/helpers/isolation.d.ts +87 -0
  40. package/dist/types/react-viewer/helpers/loadRequest.d.ts +29 -0
  41. package/dist/types/react-viewer/helpers/requestResult.d.ts +13 -0
  42. package/dist/types/react-viewer/helpers/utils.d.ts +7 -0
  43. package/dist/types/react-viewer/panels/axesPanel.d.ts +20 -0
  44. package/dist/types/react-viewer/panels/contextMenu.d.ts +75 -0
  45. package/dist/types/react-viewer/panels/help.d.ts +15 -0
  46. package/dist/types/react-viewer/panels/icons.d.ts +46 -0
  47. package/dist/types/react-viewer/panels/loadingBox.d.ts +26 -0
  48. package/dist/types/react-viewer/panels/logo.d.ts +5 -0
  49. package/dist/types/react-viewer/panels/messageBox.d.ts +14 -0
  50. package/dist/types/react-viewer/panels/modal.d.ts +18 -0
  51. package/dist/types/react-viewer/panels/overlay.d.ts +10 -0
  52. package/dist/types/react-viewer/panels/performance.d.ts +7 -0
  53. package/dist/types/react-viewer/panels/toast.d.ts +22 -0
  54. package/dist/types/react-viewer/reactViewerIndex.d.ts +8 -0
  55. package/dist/types/react-viewer/settings/menuSettings.d.ts +17 -0
  56. package/dist/types/react-viewer/settings/settings.d.ts +65 -0
  57. package/dist/types/react-viewer/settings/settingsState.d.ts +18 -0
  58. package/dist/types/react-viewer/settings/settingsStorage.d.ts +6 -0
  59. package/dist/types/react-viewer/sidePanel/sidePanel.d.ts +20 -0
  60. package/dist/types/react-viewer/sidePanel/sideState.d.ts +22 -0
  61. package/dist/types/react-viewer/ultra/ultraComponent.d.ts +30 -0
  62. package/dist/types/react-viewer/ultra/ultraErrors.d.ts +3 -0
  63. package/dist/types/react-viewer/urls.d.ts +2 -0
  64. package/dist/types/react-viewer/webgl/viewerState.d.ts +11 -0
  65. package/dist/types/react-viewer/webgl/webglComponent.d.ts +41 -0
  66. package/dist/types/react-viewer/webgl/webglComponentRef.d.ts +99 -0
  67. package/dist/types/react-viewer/webgl/webglLoading.d.ts +67 -0
  68. package/dist/types/ultra-viewer/ultraViewerIndex.d.ts +8 -0
  69. package/dist/types/ultra-viewer/utils/array.d.ts +18 -0
  70. package/dist/types/ultra-viewer/utils/debounce.d.ts +1 -0
  71. package/dist/types/ultra-viewer/utils/deferredPromise.d.ts +8 -0
  72. package/dist/types/ultra-viewer/utils/math3d.d.ts +106 -0
  73. package/dist/types/ultra-viewer/utils/promise.d.ts +21 -0
  74. package/dist/types/ultra-viewer/utils/result.d.ts +11 -0
  75. package/dist/types/ultra-viewer/utils/url.d.ts +8 -0
  76. package/dist/types/ultra-viewer/utils/validation.d.ts +28 -0
  77. package/dist/types/ultra-viewer/viewer/camera.d.ts +118 -0
  78. package/dist/types/ultra-viewer/viewer/color.d.ts +57 -0
  79. package/dist/types/ultra-viewer/viewer/colorManager.d.ts +73 -0
  80. package/dist/types/ultra-viewer/viewer/decoder.d.ts +116 -0
  81. package/dist/types/ultra-viewer/viewer/decoderWithWorker.d.ts +80 -0
  82. package/dist/types/ultra-viewer/viewer/inputs/InputTouch.d.ts +25 -0
  83. package/dist/types/ultra-viewer/viewer/inputs/inputHandler.d.ts +7 -0
  84. package/dist/types/ultra-viewer/viewer/inputs/inputKeyboard.d.ts +20 -0
  85. package/dist/types/ultra-viewer/viewer/inputs/inputMouse.d.ts +21 -0
  86. package/dist/types/ultra-viewer/viewer/inputs/inputs.d.ts +27 -0
  87. package/dist/types/ultra-viewer/viewer/loadRequest.d.ts +36 -0
  88. package/dist/types/ultra-viewer/viewer/logger.d.ts +9 -0
  89. package/dist/types/ultra-viewer/viewer/marshal.d.ts +72 -0
  90. package/dist/types/ultra-viewer/viewer/protocol.d.ts +13 -0
  91. package/dist/types/ultra-viewer/viewer/renderer.d.ts +142 -0
  92. package/dist/types/ultra-viewer/viewer/rpcClient.d.ts +72 -0
  93. package/dist/types/ultra-viewer/viewer/rpcSafeClient.d.ts +382 -0
  94. package/dist/types/ultra-viewer/viewer/selection.d.ts +94 -0
  95. package/dist/types/ultra-viewer/viewer/socketClient.d.ts +141 -0
  96. package/dist/types/ultra-viewer/viewer/streamLogger.d.ts +19 -0
  97. package/dist/types/ultra-viewer/viewer/streamRenderer.d.ts +7 -0
  98. package/dist/types/ultra-viewer/viewer/viewer.d.ts +123 -0
  99. package/dist/types/ultra-viewer/viewer/viewport.d.ts +39 -0
  100. package/dist/types/ultra-viewer/viewer/vim.d.ts +111 -0
  101. package/dist/types/ultra-viewer/viewer/vimCollection.d.ts +43 -0
  102. package/dist/types/vimWebIndex.d.ts +4 -0
  103. package/dist/types/webgl-viewer/images.d.ts +4 -0
  104. package/dist/types/webgl-viewer/index.d.ts +26 -0
  105. package/dist/types/webgl-viewer/utils/boxes.d.ts +5 -0
  106. package/dist/types/webgl-viewer/utils/deferredPromise.d.ts +8 -0
  107. package/dist/types/webgl-viewer/utils/requestResult.d.ts +13 -0
  108. package/dist/types/webgl-viewer/vim-loader/averageBoundingBox.d.ts +6 -0
  109. package/dist/types/webgl-viewer/vim-loader/colorAttributes.d.ts +34 -0
  110. package/dist/types/webgl-viewer/vim-loader/elementMapping.d.ts +113 -0
  111. package/dist/types/webgl-viewer/vim-loader/geometry.d.ts +105 -0
  112. package/dist/types/webgl-viewer/vim-loader/materials/isolationMaterial.d.ts +12 -0
  113. package/dist/types/webgl-viewer/vim-loader/materials/maskMaterial.d.ts +8 -0
  114. package/dist/types/webgl-viewer/vim-loader/materials/mergeMaterial.d.ts +18 -0
  115. package/dist/types/webgl-viewer/vim-loader/materials/outlineMaterial.d.ts +36 -0
  116. package/dist/types/webgl-viewer/vim-loader/materials/simpleMaterial.d.ts +12 -0
  117. package/dist/types/webgl-viewer/vim-loader/materials/skyboxMaterial.d.ts +16 -0
  118. package/dist/types/webgl-viewer/vim-loader/materials/standardMaterial.d.ts +57 -0
  119. package/dist/types/webgl-viewer/vim-loader/materials/transferMaterial.d.ts +8 -0
  120. package/dist/types/webgl-viewer/vim-loader/materials/viewerMaterials.d.ts +158 -0
  121. package/dist/types/webgl-viewer/vim-loader/mesh.d.ts +115 -0
  122. package/dist/types/webgl-viewer/vim-loader/object3D.d.ts +105 -0
  123. package/dist/types/webgl-viewer/vim-loader/objectAttributes.d.ts +19 -0
  124. package/dist/types/webgl-viewer/vim-loader/progressive/g3dOffsets.d.ts +53 -0
  125. package/dist/types/webgl-viewer/vim-loader/progressive/g3dSubset.d.ts +115 -0
  126. package/dist/types/webgl-viewer/vim-loader/progressive/insertableGeometry.d.ts +40 -0
  127. package/dist/types/webgl-viewer/vim-loader/progressive/insertableMesh.d.ts +59 -0
  128. package/dist/types/webgl-viewer/vim-loader/progressive/insertableSubmesh.d.ts +43 -0
  129. package/dist/types/webgl-viewer/vim-loader/progressive/instancedMesh.d.ts +32 -0
  130. package/dist/types/webgl-viewer/vim-loader/progressive/instancedMeshFactory.d.ts +20 -0
  131. package/dist/types/webgl-viewer/vim-loader/progressive/instancedSubmesh.d.ts +31 -0
  132. package/dist/types/webgl-viewer/vim-loader/progressive/legacyMeshFactory.d.ts +23 -0
  133. package/dist/types/webgl-viewer/vim-loader/progressive/loadingSynchronizer.d.ts +27 -0
  134. package/dist/types/webgl-viewer/vim-loader/progressive/open.d.ts +12 -0
  135. package/dist/types/webgl-viewer/vim-loader/progressive/subsetBuilder.d.ts +73 -0
  136. package/dist/types/webgl-viewer/vim-loader/progressive/subsetRequest.d.ts +37 -0
  137. package/dist/types/webgl-viewer/vim-loader/progressive/vimRequest.d.ts +44 -0
  138. package/dist/types/webgl-viewer/vim-loader/progressive/vimx.d.ts +17 -0
  139. package/dist/types/webgl-viewer/vim-loader/scene.d.ts +92 -0
  140. package/dist/types/webgl-viewer/vim-loader/vim.d.ts +157 -0
  141. package/dist/types/webgl-viewer/vim-loader/vimSettings.d.ts +62 -0
  142. package/dist/types/webgl-viewer/vim-webgl-viewer/camera/camera.d.ts +255 -0
  143. package/dist/types/webgl-viewer/vim-webgl-viewer/camera/cameraMovement.d.ts +77 -0
  144. package/dist/types/webgl-viewer/vim-webgl-viewer/camera/cameraMovementLerp.d.ts +28 -0
  145. package/dist/types/webgl-viewer/vim-webgl-viewer/camera/cameraMovementSnap.d.ts +24 -0
  146. package/dist/types/webgl-viewer/vim-webgl-viewer/camera/orthographic.d.ts +12 -0
  147. package/dist/types/webgl-viewer/vim-webgl-viewer/camera/perspective.d.ts +12 -0
  148. package/dist/types/webgl-viewer/vim-webgl-viewer/environment/cameraLight.d.ts +43 -0
  149. package/dist/types/webgl-viewer/vim-webgl-viewer/environment/environment.d.ts +44 -0
  150. package/dist/types/webgl-viewer/vim-webgl-viewer/environment/groundPlane.d.ts +25 -0
  151. package/dist/types/webgl-viewer/vim-webgl-viewer/environment/skybox.d.ts +39 -0
  152. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/axes/axes.d.ts +14 -0
  153. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/axes/axesSettings.d.ts +19 -0
  154. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/axes/gizmoAxes.d.ts +60 -0
  155. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmoLoading.d.ts +23 -0
  156. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmoOrbit.d.ts +71 -0
  157. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmoRectangle.d.ts +51 -0
  158. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmos.d.ts +50 -0
  159. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/markers/gizmoMarker.d.ts +64 -0
  160. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/markers/gizmoMarkers.d.ts +29 -0
  161. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measure.d.ts +103 -0
  162. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measureFlow.d.ts +36 -0
  163. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measureGizmo.d.ts +44 -0
  164. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measureHtml.d.ts +26 -0
  165. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/sectionBox/sectionBox.d.ts +70 -0
  166. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/sectionBox/sectionBoxGizmo.d.ts +47 -0
  167. package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +39 -0
  168. package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/input.d.ts +128 -0
  169. package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/inputHandler.d.ts +29 -0
  170. package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/keyboard.d.ts +113 -0
  171. package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/mouse.d.ts +66 -0
  172. package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/touch.d.ts +45 -0
  173. package/dist/types/webgl-viewer/vim-webgl-viewer/raycaster.d.ts +89 -0
  174. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/mergePass.d.ts +16 -0
  175. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/outlinePass.d.ts +19 -0
  176. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderScene.d.ts +49 -0
  177. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderer.d.ts +125 -0
  178. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderingComposer.d.ts +46 -0
  179. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderingSection.d.ts +36 -0
  180. package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/transferPass.d.ts +15 -0
  181. package/dist/types/webgl-viewer/vim-webgl-viewer/selection.d.ts +90 -0
  182. package/dist/types/webgl-viewer/vim-webgl-viewer/settings/defaultViewerSettings.d.ts +5 -0
  183. package/dist/types/webgl-viewer/vim-webgl-viewer/settings/viewerSettings.d.ts +342 -0
  184. package/dist/types/webgl-viewer/vim-webgl-viewer/settings/viewerSettingsParsing.d.ts +9 -0
  185. package/dist/types/webgl-viewer/vim-webgl-viewer/viewer.d.ts +100 -0
  186. package/dist/types/webgl-viewer/vim-webgl-viewer/viewport.d.ts +73 -0
  187. package/dist/vim-web.css +2029 -0
  188. package/dist/vim-web.iife.js +72763 -0
  189. package/dist/vim-web.iife.js.map +1 -0
  190. package/dist/vim-web.mjs +72746 -0
  191. package/dist/vim-web.mjs.map +1 -0
  192. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @module public-api
3
+ */
4
+ import '../style.css';
5
+ import '../../webgl-viewer/style.css';
6
+ import * as VIM from '../../webgl-viewer/index';
7
+ import { PartialComponentSettings } from '../settings/settings';
8
+ import { VimComponentContainer } from '../container';
9
+ import { VimComponentRef } from './webglComponentRef';
10
+ export * as VIM from '../../webgl-viewer/index';
11
+ export * as THREE from 'three';
12
+ export * as ContextMenu from '../panels/contextMenu';
13
+ export * as BimInfo from '../bim/bimInfoData';
14
+ export * as ControlBar from '../controlbar/controlBar';
15
+ export * as Icons from '../panels/icons';
16
+ export * from '../helpers/loadRequest';
17
+ export * from './webglComponentRef';
18
+ export { getLocalComponentSettings as getLocalSettings } from '../settings/settingsStorage';
19
+ export { type ComponentSettings as Settings, type PartialComponentSettings as PartialSettings, defaultSettings } from '../settings/settings';
20
+ export * from '../container';
21
+ /**
22
+ * Creates a UI container along with a VIM.Viewer and its associated React component.
23
+ * @param container An optional container object. If none is provided, a container will be created.
24
+ * @param componentSettings UI Component settings.
25
+ * @param viewerSettings Viewer settings.
26
+ * @returns An object containing the resulting container, reactRoot, and viewer.
27
+ */
28
+ export declare function createWebglComponent(container?: VimComponentContainer | HTMLElement, componentSettings?: PartialComponentSettings, viewerSettings?: VIM.PartialViewerSettings): Promise<VimComponentRef>;
29
+ /**
30
+ * Represents a React component providing UI for the Vim viewer.
31
+ * @param container The container object containing root, gfx, and UI elements for the Vim viewer.
32
+ * @param viewer The Vim viewer instance for which UI is provided.
33
+ * @param onMount A callback function triggered when the component is mounted. Receives a reference to the Vim component.
34
+ * @param settings Optional settings for configuring the Vim component's behavior.
35
+ */
36
+ export declare function VimComponent(props: {
37
+ container: VimComponentContainer;
38
+ viewer: VIM.Viewer;
39
+ onMount: (component: VimComponentRef) => void;
40
+ settings?: PartialComponentSettings;
41
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @module public-api
3
+ */
4
+ import * as VIM from '../../webgl-viewer/index';
5
+ import { ContextMenuCustomization } from '../panels/contextMenu';
6
+ import { ComponentSettings } from '../settings/settings';
7
+ import { Isolation } from '../helpers/isolation';
8
+ import { ComponentCamera } from '../helpers/camera';
9
+ import { VimComponentContainer } from '../container';
10
+ import { BimInfoPanelRef } from '../bim/bimInfoData';
11
+ import { ControlBarCustomization } from '../controlbar/controlBar';
12
+ import { ComponentLoader } from './webglLoading';
13
+ import { ModalRef } from '../panels/modal';
14
+ /**
15
+ * Settings API managing settings applied to the component.
16
+ */
17
+ export type SettingsRef = {
18
+ /**
19
+ * Allows updating settings by providing a callback function.
20
+ * @param updater A function that updates the current settings.
21
+ */
22
+ update: (updater: (settings: ComponentSettings) => void) => void;
23
+ /**
24
+ * Registers a callback function to be notified when settings are updated.
25
+ * @param callback A function to be called when settings are updated, receiving the updated settings.
26
+ */
27
+ register: (callback: (settings: ComponentSettings) => void) => void;
28
+ };
29
+ export type ContextMenuRef = {
30
+ /**
31
+ * Defines a callback function to dynamically customize the context menu.
32
+ * @param customization The configuration object specifying the customization options for the context menu.
33
+ */
34
+ customize: (customization: ContextMenuCustomization) => void;
35
+ };
36
+ export type ControlBarRef = {
37
+ /**
38
+ * Defines a callback function to dynamically customize the control bar.
39
+ * @param customization The configuration object specifying the customization options for the control bar.
40
+ */
41
+ customize: (customization: ControlBarCustomization) => void;
42
+ };
43
+ export type HelpRef = {
44
+ /**
45
+ * Displays the help message.
46
+ * @param value Boolean value to show or hide the help message.
47
+ */
48
+ show(value: boolean): any;
49
+ /**
50
+ * Returns the current state of the help message.
51
+ */
52
+ isShow(): any;
53
+ };
54
+ /**
55
+ * Root-level API of the Vim component.
56
+ */
57
+ export type VimComponentRef = {
58
+ /**
59
+ * HTML structure containing the component.
60
+ */
61
+ container: VimComponentContainer;
62
+ /**
63
+ * Vim WebGL viewer around which the WebGL component is built.
64
+ */
65
+ viewer: VIM.Viewer;
66
+ /**
67
+ * Vim WebGL loader to download VIMs.
68
+ */
69
+ loader: ComponentLoader;
70
+ /**
71
+ * Isolation API managing isolation state in the component.
72
+ */
73
+ isolation: Isolation;
74
+ /**
75
+ * Context menu API managing the content and behavior of the context menu.
76
+ */
77
+ contextMenu: ContextMenuRef;
78
+ /**
79
+ * Context menu API managing the content and behavior of the context menu.
80
+ */
81
+ controlBar: ControlBarRef;
82
+ /**
83
+ * Settings API managing settings applied to the component.
84
+ */
85
+ settings: SettingsRef;
86
+ /**
87
+ * Message API to interact with the loading box.
88
+ */
89
+ modal: ModalRef;
90
+ /**
91
+ * Camera API to interact with the viewer camera at a higher level.
92
+ */
93
+ camera: ComponentCamera;
94
+ /**
95
+ * API To interact with the BIM info panel.
96
+ */
97
+ bimInfo: BimInfoPanelRef;
98
+ dispose: () => void;
99
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @module viw-webgl-react
3
+ */
4
+ import * as VIM from '../../webgl-viewer/index';
5
+ import { LoadRequest } from '../helpers/loadRequest';
6
+ import { ModalRef } from '../panels/modal';
7
+ type AddSettings = {
8
+ /**
9
+ * Controls whether to frame the camera on a vim everytime it is updated.
10
+ * Default: true
11
+ */
12
+ autoFrame?: boolean;
13
+ /**
14
+ * Controls whether to initially load the vim content or not.
15
+ * Default: false
16
+ */
17
+ loadEmpty?: boolean;
18
+ };
19
+ export type OpenSettings = VIM.VimPartialSettings & AddSettings;
20
+ export type LoadingError = {
21
+ url: string;
22
+ error: string;
23
+ };
24
+ /**
25
+ * Provides functionality for asynchronously opening sources and tracking progress.
26
+ * Includes event emitters for progress updates and completion notifications.
27
+ */
28
+ export declare class ComponentLoader {
29
+ private _viewer;
30
+ private _modal;
31
+ constructor(viewer: VIM.Viewer, modal: ModalRef);
32
+ /**
33
+ * Event emitter for progress updates.
34
+ */
35
+ onProgress(p: VIM.IProgressLogs): void;
36
+ /**
37
+ * Event emitter for completion notifications.
38
+ */
39
+ onDone(): void;
40
+ /**
41
+ * Event emitter for error notifications.
42
+ */
43
+ onError(e: LoadingError): void;
44
+ /**
45
+ * Asynchronously opens a vim at source, applying the provided settings.
46
+ * @param source The source to open, either as a string or ArrayBuffer.
47
+ * @param settings Partial settings to apply to the opened source.
48
+ * @param onProgress Optional callback function to track progress during opening.
49
+ * Receives progress logs as input.
50
+ */
51
+ open(source: VIM.RequestSource, settings: OpenSettings, onProgress?: (p: VIM.IProgressLogs) => void): Promise<VIM.Vim>;
52
+ /**
53
+ * Creates a new load request for the provided source and settings.
54
+ * @param source The url to the vim file or a buffer of the file.
55
+ * @param settings Settings to apply to vim file.
56
+ * @returns A new load request instance to track progress and get result.
57
+ */
58
+ request(source: VIM.RequestSource, settings: VIM.VimPartialSettings): LoadRequest;
59
+ add(vim: VIM.Vim, settings?: AddSettings): void;
60
+ /**
61
+ * Removes the vim from the viewer and disposes it.
62
+ * @param vim Vim to remove from the viewer.
63
+ */
64
+ remove(vim: VIM.Vim): void;
65
+ private initVim;
66
+ }
67
+ export {};
@@ -0,0 +1,8 @@
1
+ export * from './viewer/viewer';
2
+ export * as utils from './utils/promise';
3
+ export * from './viewer/vim';
4
+ export * from './viewer/vim';
5
+ export * from './utils/math3d';
6
+ export * from './viewer/color';
7
+ export type { ILoadRequest, VimRequestErrorType } from './viewer/loadRequest';
8
+ export type { ClientState } from './viewer/socketClient';
@@ -0,0 +1,18 @@
1
+ export declare function invertMap<K, V>(inputMap: Map<K, V>): Map<V, K[]>;
2
+ /**
3
+ * Batches an array into smaller arrays of a specified size.
4
+ * @param array - The array to batch.
5
+ * @param batchSize - The size of each batch.
6
+ * @returns An array of arrays, each containing a batch of elements.
7
+ * @throws An error if the batch size is not a positive integer.
8
+ */
9
+ export declare function batchArray<T>(array: T[], batchSize: number): T[][];
10
+ /**
11
+ * Batches two arrays simultaneously, maintaining alignment between corresponding elements.
12
+ * @param array1 - The first array to batch.
13
+ * @param array2 - The second array to batch.
14
+ * @param batchSize - The size of each batch.
15
+ * @returns An array of objects, each containing a batch from each array.
16
+ * @throws An error if the input arrays are not of the same length.
17
+ */
18
+ export declare function batchArrays<T, U>(array1: T[], array2: U[], batchSize: number): [T[], U[]][];
@@ -0,0 +1 @@
1
+ export declare function debounce<T extends (...args: any[]) => void>(func: T, delay: number): [(...args: Parameters<T>) => void, () => void];
@@ -0,0 +1,8 @@
1
+ export declare class DeferredPromise<T> extends Promise<T> {
2
+ resolve: (value: T | PromiseLike<T>) => void;
3
+ reject: (reason: T | Error) => void;
4
+ initialCallStack: Error['stack'];
5
+ constructor(executor?: ConstructorParameters<typeof Promise<T>>[0]);
6
+ /** @throws error with amended call stack */
7
+ rejectWithError(error: Error): void;
8
+ }
@@ -0,0 +1,106 @@
1
+ export declare class Vector3 {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ constructor(x?: number, y?: number, z?: number);
6
+ set(x: number, y: number, z: number): this;
7
+ copy(v: Vector3): this;
8
+ add(v: Vector3): this;
9
+ sub(v: Vector3): this;
10
+ multiplyScalar(scalar: number): this;
11
+ min(v: Vector3): this;
12
+ max(v: Vector3): this;
13
+ isValid(): boolean;
14
+ equals(v: Vector3): boolean;
15
+ toArray(): number[];
16
+ }
17
+ export declare class Vector2 {
18
+ x: number;
19
+ y: number;
20
+ constructor(x?: number, y?: number);
21
+ set(x: number, y: number): this;
22
+ copy(v: Vector2): this;
23
+ add(v: Vector2): this;
24
+ sub(v: Vector2): this;
25
+ multiplyScalar(scalar: number): this;
26
+ min(v: Vector2): this;
27
+ max(v: Vector2): this;
28
+ equals(v: Vector2): boolean;
29
+ isValid(): boolean;
30
+ almostEquals(v: Vector2, tolerance?: number): boolean;
31
+ toArray(): number[];
32
+ distanceTo(v: Vector2): number;
33
+ clamp01(): this;
34
+ }
35
+ export declare class Segment {
36
+ origin: Vector3;
37
+ target: Vector3;
38
+ constructor(origin?: Vector3, target?: Vector3);
39
+ static fromArray(array: number[]): Segment;
40
+ toArray(): number[];
41
+ isValid(): boolean;
42
+ equals(segment: Segment): boolean;
43
+ }
44
+ export declare class Box3 {
45
+ min: Vector3;
46
+ max: Vector3;
47
+ constructor(min?: Vector3, max?: Vector3);
48
+ static fromArray(array: number[]): Box3;
49
+ isValid(): boolean;
50
+ set(min: Vector3, max: Vector3): this;
51
+ setFromPoints(points: Vector3[]): this;
52
+ getCenter(target?: Vector3): Vector3;
53
+ getSize(target?: Vector3): Vector3;
54
+ containsPoint(point: Vector3): boolean;
55
+ intersectsBox(box: Box3): boolean;
56
+ expandByPoint(point: Vector3): this;
57
+ union(box: Box3): this;
58
+ toArray(): number[];
59
+ }
60
+ export declare class RGBA {
61
+ r: number;
62
+ g: number;
63
+ b: number;
64
+ a: number;
65
+ constructor(r: number, g: number, b: number, a?: number);
66
+ isValid(): boolean;
67
+ equals(color: RGBA): boolean;
68
+ static fromString(str: string): RGBA;
69
+ }
70
+ export declare class RGB {
71
+ r: number;
72
+ g: number;
73
+ b: number;
74
+ constructor(r: number, g: number, b: number);
75
+ }
76
+ export declare class RGBA32 {
77
+ readonly hex: number;
78
+ constructor(hex: number);
79
+ static fromInts(r: number, g: number, b: number, a?: number): RGBA32;
80
+ static fromFloats(r: number, g: number, b: number, a?: number): RGBA32;
81
+ static fromString(str: string): RGBA32;
82
+ /**
83
+ * The red component of the color in the range [0-255].
84
+ */
85
+ get r(): number;
86
+ /**
87
+ * The green component of the color in the range [0-255].
88
+ */
89
+ get g(): number;
90
+ /**
91
+ * The blue component of the color in the range [0-255].
92
+ */
93
+ get b(): number;
94
+ /**
95
+ * The alpha component of the color in the range [0-255].
96
+ */
97
+ get a(): number;
98
+ }
99
+ /**
100
+ * Remaps the given value from the range [0-1] to [0-max].
101
+ */
102
+ export declare function remap(value: number, max: number): number;
103
+ /**
104
+ * Clamps the given value between the given min and max.
105
+ */
106
+ export declare function clamp(value: number, min: number, max: number): number;
@@ -0,0 +1,21 @@
1
+ export interface IPromise<T> {
2
+ promise: Promise<T>;
3
+ resolve(value: T): void;
4
+ reject(reason?: string): void;
5
+ }
6
+ export declare class ControllablePromise<T> implements IPromise<T> {
7
+ private _resolve;
8
+ private _reject;
9
+ private _promise;
10
+ constructor();
11
+ get promise(): Promise<T>;
12
+ resolve(value: T): void;
13
+ reject(reason?: string): void;
14
+ }
15
+ export declare class ResolvedPromise<T> implements IPromise<T> {
16
+ private _value;
17
+ constructor(value: T);
18
+ get promise(): Promise<Awaited<T>>;
19
+ resolve(_: T): void;
20
+ reject(_?: string): void;
21
+ }
@@ -0,0 +1,11 @@
1
+ export declare class Result<T, E> {
2
+ private readonly value;
3
+ private readonly error;
4
+ private constructor();
5
+ static ok<T, E>(value: T): Result<T, E>;
6
+ static error<T, E>(error: E): Result<T, E>;
7
+ isOk(): this is Result<T, undefined>;
8
+ isError(): this is Result<undefined, string>;
9
+ getValue(): T;
10
+ getError(): E;
11
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Checks if the given string is a valid URL.
3
+ * @param str - The string to check.
4
+ * @returns True if the string is a valid URL; otherwise, false.
5
+ */
6
+ export declare function isURL(str: string): boolean;
7
+ export declare function isFileURI(inputString: string | null | undefined): boolean;
8
+ export declare function isWebSocketUrl(input: string): boolean;
@@ -0,0 +1,28 @@
1
+ import { Box3, RGB, RGBA, Segment, Vector2, Vector3 } from './math3d';
2
+ export declare class Validation {
3
+ static isNumber(value: number): boolean;
4
+ static isPositiveNumber(value: number): boolean;
5
+ static isInteger(value: number): boolean;
6
+ static isPositiveInteger(value: number): boolean;
7
+ static isInRange01(value: number): boolean;
8
+ static areIntegers(values: number[]): boolean;
9
+ static isComponentHandle(handle: number): boolean;
10
+ static areComponentHandles(handles: number[]): boolean;
11
+ static isMaterialHandle(handle: number): boolean;
12
+ static isValidVector2(value: Vector2): boolean;
13
+ static isRelativeVector2(value: Vector2): boolean;
14
+ static isValidVector3(value: Vector3): boolean;
15
+ static isValidBox(box: Box3): boolean;
16
+ static isValidSegment(segment: Segment): boolean;
17
+ static isRelativeRGBA(color: RGBA): boolean;
18
+ static isRelativeRGB(color: RGB): boolean;
19
+ static isNonEmptyString(value: string): boolean;
20
+ static isURL(value: string): boolean;
21
+ static areSameLength<T1, T2>(array: T1[], array2: T2[]): boolean;
22
+ static isFullArray(array: any[]): boolean;
23
+ static clamp(min: number, max: number, value: number): number;
24
+ static clamp01(value: number): number;
25
+ static min0(value: number): number;
26
+ static clampRGBA01(value: RGBA): RGBA;
27
+ static clampRGB01(value: RGBA): RGBA;
28
+ }
@@ -0,0 +1,118 @@
1
+ import { Box3, Segment } from '../utils/math3d';
2
+ import { RpcSafeClient } from './rpcSafeClient';
3
+ import { Vim } from './vim';
4
+ /**
5
+ * Interface defining camera control operations in the 3D viewer
6
+ * @interface
7
+ */
8
+ export interface ICamera {
9
+ /**
10
+ * Frames all Vim models in the viewer to fit within the camera view
11
+ * @param {number} [blendTime=0.5] - Animation duration in seconds
12
+ * @returns {Promise<Segment | undefined>} Promise resolving to the final camera position segment
13
+ */
14
+ frameAll(blendTime?: number): Promise<Segment | undefined>;
15
+ /**
16
+ * Frames a specified bounding box in the viewer
17
+ * @param {Box3} box - The 3D bounding box to frame
18
+ * @param {number} [blendTime=0.5] - Animation duration in seconds
19
+ * @returns {Promise<Segment | undefined>} Promise resolving to the final camera position segment
20
+ */
21
+ frameBox(box: Box3, blendTime?: number): Promise<Segment | undefined>;
22
+ /**
23
+ * Frames specified nodes of a Vim model in the camera view
24
+ * @param {Vim} vim - The target Vim model
25
+ * @param {number[] | 'all'} nodes - Array of node indices or 'all' for entire model
26
+ * @param {number} [blendTime=0.5] - Animation duration in seconds
27
+ * @returns {Promise<Segment | undefined>} Promise resolving to the final camera position segment
28
+ */
29
+ frameVim(vim: Vim, nodes: number[] | 'all', blendTime?: number): Promise<Segment | undefined>;
30
+ /**
31
+ * Saves the current camera position for later restoration
32
+ * @param {Segment} [segment] - Optional specific camera position to save
33
+ */
34
+ save(segment?: Segment): void;
35
+ /**
36
+ * Controls the rendering state of the viewer
37
+ * @param {boolean} value - True to pause, false to resume rendering
38
+ */
39
+ pause(value: boolean): void;
40
+ /**
41
+ * Restores the camera to its previously saved position
42
+ * Initially that will be the first call to a Frame method
43
+ * @param {number} [blendTime=0.5] - Animation duration in seconds
44
+ */
45
+ restoreSavedPosition(blendTime?: number): void;
46
+ }
47
+ /**
48
+ * Implements camera control operations for the 3D viewer
49
+ * @class
50
+ */
51
+ export declare class Camera implements ICamera {
52
+ private _rpc;
53
+ private _lastPosition;
54
+ private _interval;
55
+ private _defaultBlendTime;
56
+ private _savedPosition;
57
+ /**
58
+ * Creates a new Camera instance
59
+ * @param rpc - RPC client for camera communication
60
+ */
61
+ constructor(rpc: RpcSafeClient);
62
+ /**
63
+ * Saves the current camera position for later restoration
64
+ * @param segment - Optional segment to save as the camera position
65
+ */
66
+ save(segment?: Segment): Promise<void>;
67
+ /**
68
+ * Resets the camera to the last saved position
69
+ */
70
+ restoreSavedPosition(blendTime?: number): void;
71
+ /**
72
+ * Restores the camera to its last tracked position
73
+ * @param blendTime - Duration of the camera animation in seconds
74
+ */
75
+ restoreLastPosition(blendTime?: number): void;
76
+ /**
77
+ * Handles camera initialization when connection is established
78
+ */
79
+ onConnect(): void;
80
+ /**
81
+ * Starts tracking camera position at regular intervals
82
+ */
83
+ startTracking(): void;
84
+ /**
85
+ * Stops tracking camera position
86
+ */
87
+ stopTracking(): void;
88
+ /**
89
+ * Updates the stored camera position
90
+ * @private
91
+ */
92
+ private update;
93
+ /**
94
+ * Pauses or resumes rendering
95
+ * @param value - True to pause rendering, false to resume
96
+ */
97
+ pause(value: boolean): void;
98
+ /**
99
+ * Frames all vims in the viewer to fit within the camera view
100
+ * @param blendTime - Duration of the camera animation in seconds (defaults to 0.5)
101
+ * @returns Promise that resolves when the framing animation is complete
102
+ */
103
+ frameAll(blendTime?: number): Promise<Segment | undefined>;
104
+ /**
105
+ * Frames a specific bounding box in the viewer
106
+ * @param box - The 3D bounding box to frame in the camera view
107
+ * @param blendTime - Duration of the camera animation in seconds (defaults to 0.5)
108
+ */
109
+ frameBox(box: Box3, blendTime?: number): Promise<Segment | undefined>;
110
+ /**
111
+ * Frames specific nodes of a Vim model in the camera view
112
+ * @param vim - The Vim model containing the nodes to frame
113
+ * @param nodes - Array of node indices to frame, or 'all' to frame the entire model
114
+ * @param blendTime - Duration of the camera animation in seconds (defaults to 0.5)
115
+ * @returns Promise that resolves when the framing animation is complete
116
+ */
117
+ frameVim(vim: Vim, nodes: number[] | 'all', blendTime?: number): Promise<Segment | undefined>;
118
+ }
@@ -0,0 +1,57 @@
1
+ import { RGBA32 } from "../utils/math3d";
2
+ import { ColorManager } from "./colorManager";
3
+ /**
4
+ * Represents a handle to a color in the color management system.
5
+ * This class provides access to color components and manages the lifecycle of color instances.
6
+ */
7
+ export declare class ColorHandle {
8
+ private _manager;
9
+ /** Unique identifier for the color instance */
10
+ readonly id: number;
11
+ /** The RGBA color value */
12
+ readonly color: RGBA32;
13
+ private _disposed;
14
+ /**
15
+ * Indicates whether the color handle has been disposed.
16
+ * @returns {boolean} True if the color handle has been disposed, false otherwise.
17
+ */
18
+ get disposed(): boolean;
19
+ /**
20
+ * Gets the hexadecimal representation of the color.
21
+ * @returns {number} The color value as a hexadecimal number.
22
+ */
23
+ get hex(): number;
24
+ /**
25
+ * Gets the red component of the color.
26
+ * @returns {number} The red component value in the range [0-255].
27
+ */
28
+ get r(): number;
29
+ /**
30
+ * Gets the green component of the color.
31
+ * @returns {number} The green component value in the range [0-255].
32
+ */
33
+ get g(): number;
34
+ /**
35
+ * Gets the blue component of the color.
36
+ * @returns {number} The blue component value in the range [0-255].
37
+ */
38
+ get b(): number;
39
+ /**
40
+ * Gets the alpha (opacity) component of the color.
41
+ * @returns {number} The alpha component value in the range [0-255].
42
+ */
43
+ get a(): number;
44
+ /**
45
+ * Creates a new ColorHandle instance.
46
+ * @param {RGBA32} color - The RGBA color value.
47
+ * @param {number} serverId - The unique identifier assigned by the server.
48
+ * @param {ColorManager} manager - The color manager instance that manages this color handle.
49
+ */
50
+ constructor(color: RGBA32, serverId: number, manager: ColorManager);
51
+ /**
52
+ * Disposes of the color handle and releases associated resources.
53
+ * Once disposed, the color handle cannot be used anymore.
54
+ * Multiple calls to dispose are safely ignored.
55
+ */
56
+ dispose(): void;
57
+ }
@@ -0,0 +1,73 @@
1
+ import { RpcSafeClient } from './rpcSafeClient';
2
+ import { ColorHandle } from './color';
3
+ import { RGBA32 } from '../utils/math3d';
4
+ /**
5
+ * Manages the creation, caching, and deletion of color instances.
6
+ * Handles batched deletion of colors to optimize RPC calls.
7
+ */
8
+ export declare class ColorManager {
9
+ private _rpc;
10
+ private _hexToColor;
11
+ private _idToColor;
12
+ private _toDelete;
13
+ private _deleteId;
14
+ /**
15
+ * Creates a new ColorManager instance.
16
+ * @param rpc - The RPC client used for communication with the rendering backend
17
+ */
18
+ constructor(rpc: RpcSafeClient);
19
+ /**
20
+ * Creates or retrieves a cached color instance for the given hex value.
21
+ * @param hex - The RGBA32 color value
22
+ * @returns Promise resolving to a ColorHandle, or undefined if creation fails
23
+ */
24
+ getColor(hex: RGBA32): Promise<ColorHandle | undefined>;
25
+ /**
26
+ * Creates or retrieves cached color instances for multiple hex values.
27
+ * @param c - Array of RGBA32 color values
28
+ * @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
29
+ * @remarks Duplicate hex values will be mapped to the same color instance for efficiency
30
+ */
31
+ getColors(c: RGBA32[]): Promise<ColorHandle[]>;
32
+ /**
33
+ * Retrieves a color instance by its unique identifier.
34
+ * @param id - The unique identifier of the color
35
+ * @returns The ColorHandle associated with the ID, or undefined if not found
36
+ */
37
+ getFromId(id: number): ColorHandle;
38
+ /**
39
+ * Destroys a color instance and removes it from the cache.
40
+ * @param color - The ColorHandle to destroy
41
+ */
42
+ destroy(color: ColorHandle): void;
43
+ /**
44
+ * Destroys all color instances and clears the cache.
45
+ */
46
+ clear(): void;
47
+ /**
48
+ * Creates multiple color instances via RPC.
49
+ * @param colors - Array of RGBA32 color values to create
50
+ * @returns Promise resolving to an array of ColorHandles, or undefined if creation fails
51
+ * @private
52
+ */
53
+ private _createColors;
54
+ /**
55
+ * Creates a single color instance and adds it to the cache.
56
+ * @param color - The RGBA32 color value
57
+ * @param id - The unique identifier for the color instance
58
+ * @returns The created ColorHandle
59
+ * @private
60
+ */
61
+ private _createColor;
62
+ /**
63
+ * Queues a color for deletion in the next batch.
64
+ * @param color - The ColorHandle to delete
65
+ * @private
66
+ */
67
+ private _deleteColor;
68
+ /**
69
+ * Immediately deletes all queued colors.
70
+ * @private
71
+ */
72
+ private _deleteBatch;
73
+ }