@procore/bim-webviewer-sdk 14.0.0 → 14.1.0-BIM-3945.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/Procore.Bim.Webviewer.d.ts +38 -5
  3. package/dist/Procore.Bim.Webviewer.js +1 -1
  4. package/dist/types/src/Webviewer.d.ts +18 -3
  5. package/dist/types/src/api/analytic_events/__tests__/payloadFactories.test.d.ts +1 -0
  6. package/dist/types/src/api/analytic_events/analyticKeys.d.ts +20 -8
  7. package/dist/types/src/api/analytic_events/payloadFactories.d.ts +16 -8
  8. package/dist/types/src/api/types/FileExtraction.d.ts +8 -0
  9. package/dist/types/src/api/types/Model.d.ts +3 -1
  10. package/dist/types/src/components/HomeViewpointManager/HomeViewpointManager.d.ts +7 -1
  11. package/dist/types/src/components/HomeViewpointManager/__tests__/fixtures.d.ts +8 -1
  12. package/dist/types/src/components/RootComponent.d.ts +2 -0
  13. package/dist/types/src/components/ShortestDistanceComponent.d.ts +27 -3
  14. package/dist/types/src/components/StatsJS.d.ts +12 -0
  15. package/dist/types/src/components/__tests__/ShortestDistanceComponent.test.d.ts +1 -0
  16. package/dist/types/src/controllers/Bootstrapper.d.ts +4 -4
  17. package/dist/types/src/controllers/{DomController.d.ts → DomController/DomController.d.ts} +4 -5
  18. package/dist/types/src/controllers/DomController/__tests__/DomController.test.d.ts +1 -0
  19. package/dist/types/src/controllers/DomController/__tests__/fitCanvasToSize.test.d.ts +1 -0
  20. package/dist/types/src/controllers/DomController/fitCanvasToSize.d.ts +4 -0
  21. package/dist/types/src/controllers/DomController/index.d.ts +1 -0
  22. package/dist/types/src/controllers/PubSubController.d.ts +1 -0
  23. package/dist/types/src/controllers/RenderController.d.ts +17 -12
  24. package/dist/types/src/controllers/RenderControllerProxy.d.ts +4 -11
  25. package/dist/types/src/controllers/RenderControllerWorker.d.ts +3 -0
  26. package/dist/types/src/procoregl/StreamedGeometryFactory.d.ts +0 -2
  27. package/dist/types/src/pwfreader/PWF.d.ts +3 -0
  28. package/dist/types/src/pwfreader/pwf/impl/bufferReader/PartitionProxyBufferReader.d.ts +1 -0
  29. package/dist/types/src/pwfreader/shared/MeshServices.d.ts +1 -0
  30. package/dist/types/src/pwfreader/shared/Meshnode.d.ts +17 -11
  31. package/dist/types/src/pwfreader/streaming/PartitionProxy.d.ts +6 -0
  32. package/dist/types/src/pwfreader/streaming/PartitionUrl.d.ts +1 -0
  33. package/dist/types/src/pwfreader/streaming/StreamedMeshServices.d.ts +1 -1
  34. package/dist/types/src/pwfreader/streaming/StreamedMeshnode.d.ts +2 -12
  35. package/dist/types/src/pwfreader/streaming/__tests__/PartitionUrl.test.d.ts +1 -0
  36. package/dist/types/src/utils/ApiMetaData/ApiMetaData.d.ts +2 -1
  37. package/dist/types/src/utils/ApiMetaData/__tests__/mocks.d.ts +9 -2
  38. package/dist/types/src/utils/LRUCache.d.ts +13 -0
  39. package/dist/types/src/utils/__tests__/LRUCache.test.d.ts +1 -0
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - `model.getSnapshot` and `model.getSnapshotDataUrl` now take an optional `size` parameter, e.g. `model.getSnapshot({ size: { width: 640, height: 480 } })`
13
+ - When no `size` parameter is present, it will return an image with the dimensions of the canvas
14
+ - When a `size` parameter is present, it will return an image with the maximum dimensions that fit in the current canvas that match the aspect ratio of the requested size. This may be smaller or larger than the requested size depending on the size of the canvas.
15
+
16
+ ### Changed
17
+
18
+ - [Breaking Change] `model.getSnapshot` now expects a params object instead of individual params. It only had one optional argument so there is just one change:
19
+ - `model.getSnapshot('#aabbcc')` must now be called as `model.getSnapshot({ color: '#aabbcc' })`
20
+
21
+ ## [14.1.0] - 2024-04-15
22
+
23
+ ### Fixed
24
+
25
+ - Fixes the loading of partitioned models when on `production`.
26
+ - Fixes the inconsistencies of the ShortestDistanceComponent when operating on partitioned models.
27
+
28
+ ### Added
29
+
30
+ - Add `model.getViewpoint` and `model.setViewpoint` methods.
31
+ - These methods interact with the viewpoints schema defined by the `bim_viewpoints` endpoint (https://developers.procore.com/reference/rest/v1/bim-viewpoints?version=1.0)
32
+ - Calls to `camera.get/setBcfCamera`, `model.getSections/setSectionsData`, `markup.setRedlines` (or its deprecated alias `camera.setMarkup`) for the purpose of constructing viewpoints can be replaced with calls to `model.get/setViewpoint`
33
+ - public events `initializationComplete` and `initializationComplete` have their payloads updated to include `step_failed`, and `error_descriptions` properties. Should an error occur during initialization, the `step_failed` property will be set to the step failed while bootstrapping the model and the `error_descriptions` will be set to the error message.
34
+
35
+ ### Changed
36
+
37
+ - Removed some development-only checks from renderer in the production build for a minor performance improvement.
38
+ - Minor reduction in build size
39
+
40
+ ### Removed
41
+
42
+ - "Could not find node with id" console warning that some models would generate a lot of. It's not really a problem and there's no need to clog the console with it.
43
+
8
44
  ## [14.0.0] - 2024-04-01
9
45
 
10
46
  ### Fixed
@@ -1,3 +1,11 @@
1
+ declare type Attachment = {
2
+ id: number;
3
+ content_type: string;
4
+ name: string;
5
+ size: number;
6
+ url: string;
7
+ };
8
+
1
9
  declare type AutodeskFormatClipBox = {
2
10
  Type: 'OrientedBox3D';
3
11
  Version: 1;
@@ -48,6 +56,7 @@ export declare namespace Benchmark {
48
56
  declare type BimFileUpload = {
49
57
  id: number;
50
58
  file_version: FileVersion;
59
+ attachment: Attachment;
51
60
  };
52
61
 
53
62
  declare type BoundingBox = {
@@ -113,6 +122,8 @@ declare type CommonOptions = {
113
122
  bimFileId?: number;
114
123
  };
115
124
 
125
+ declare type CssColor = RGB | RGBA | HEX | string;
126
+
116
127
  declare type FeatureFlags = Partial<{
117
128
  enableObjectTreeSearch: boolean;
118
129
  }>;
@@ -166,6 +177,8 @@ declare type GeometryFile = {
166
177
  url: string;
167
178
  };
168
179
 
180
+ declare type HEX = `#${string}`;
181
+
169
182
  declare type MetricId = string;
170
183
 
171
184
  declare type Model = {
@@ -175,7 +188,7 @@ declare type Model = {
175
188
  declare type ModelRevision = {
176
189
  id: number;
177
190
  revision: number;
178
- viewpoints: Viewpoint[];
191
+ viewpoints: ModelRevisionViewpoint[];
179
192
  };
180
193
 
181
194
  declare type ModelRevisionModePwfV1Options = CommonOptions & PwfV1Bundle & {
@@ -188,6 +201,10 @@ declare type ModelRevisionModePwfV2Options = CommonOptions & PwfV2Bundle & {
188
201
  modelRevisionId: ModelRevision['id'];
189
202
  };
190
203
 
204
+ declare type ModelRevisionViewpoint = Viewpoint & {
205
+ primary: boolean;
206
+ };
207
+
191
208
  declare const NAV_MODE: {
192
209
  readonly DEFAULT: 0;
193
210
  readonly FLY: 1;
@@ -266,6 +283,10 @@ declare type PwfV2Bundle = {
266
283
  manifestUrl: GeometryFile['url'];
267
284
  };
268
285
 
286
+ declare type RGB = `rgb(${number}, ${number}, ${number})`;
287
+
288
+ declare type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`;
289
+
269
290
  declare type SectionDataAutodeskFormat = {
270
291
  Type: 'ClipPlaneSet';
271
292
  Version: 1;
@@ -308,7 +329,6 @@ declare type Viewpoint = {
308
329
  camera_data: string;
309
330
  sections_data: string;
310
331
  redlines_data: string;
311
- primary: boolean;
312
332
  };
313
333
 
314
334
  declare type WebFormatExtractionItem = {
@@ -370,9 +390,19 @@ export declare class Webviewer {
370
390
  position: Vector3;
371
391
  direction: Vector3;
372
392
  }>;
373
- getSnapshot: (color: string) => Promise<void>;
374
- getSnapshotDataUrl: (params?: {
375
- color: unknown;
393
+ getSnapshot: (params: {
394
+ color?: CssColor;
395
+ aspectRatio?: {
396
+ width: number;
397
+ height: number;
398
+ };
399
+ }) => Promise<void>;
400
+ getSnapshotDataUrl: (params: {
401
+ color?: CssColor;
402
+ aspectRatio?: {
403
+ width: number;
404
+ height: number;
405
+ };
376
406
  }) => Promise<string>;
377
407
  setLookAt: (x: number, y: number, z: number) => Promise<{
378
408
  position: Vector3;
@@ -457,6 +487,7 @@ export declare class Webviewer {
457
487
  setOptions: (opts: {
458
488
  selection: string;
459
489
  }) => void;
490
+ setCanvasSelectionEnabled: (enabled: boolean) => void;
460
491
  MapToModelSpace: (point: Vector2, modelA: Vector2, modelB: Vector2, planA: Vector2, planB: Vector2, imgSize: Vector2, rect: Vector2, direction: Vector2, applyOffset: boolean) => Promise<{
461
492
  x?: number;
462
493
  y?: number;
@@ -501,6 +532,8 @@ export declare class Webviewer {
501
532
  clearAllObjectColor: () => Promise<void> | void;
502
533
  filterObjectTree: (objectIds: number[]) => Promise<void>;
503
534
  clearObjectTreeFilter: () => Promise<void>;
535
+ getViewpoint: () => Promise<Viewpoint>;
536
+ setViewpoint: (viewpoint: Viewpoint) => Promise<void>;
504
537
  };
505
538
  api: {
506
539
  getNamesForObjects: (ids: number[]) => Promise<any>;