3dviewer-sdk 1.0.11 → 1.0.13

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.
package/dist/index.d.mts CHANGED
@@ -20,13 +20,19 @@ declare enum ViewerMessageType {
20
20
  ZOOM_WINDOW = "viewer-zoom-window",
21
21
  ZOOM_FIT = "viewer-zoom-fit",
22
22
  TOOLBAR_CONFIG = "viewer-toolbar-config",
23
- TOOLBAR_VISIBILITY = "viewer-toolbar-visibility",
23
+ TOOLBAR_USE = "viewer-toolbar-use",
24
24
  PANEL_OPEN = "viewer-panel-open",
25
25
  PANEL_CLOSE = "viewer-panel-close",
26
26
  CUTTING_PLANE_ACTION = "viewer-cutting-plane-action",
27
27
  SHEETS_GET_LIST = "viewer-sheets-get-list",
28
28
  SHEETS_LIST = "viewer-sheets-list",
29
29
  SHEETS_APPLY = "viewer-sheets-apply",
30
+ OBJECT_PROPERTIES_GET_LIST = "viewer-object-properties-get-list",
31
+ OBJECT_PROPERTIES_LIST = "viewer-object-properties-list",
32
+ LINKED_OBJECTS_GET_LIST = "viewer-linked-objects-get-list",
33
+ LINKED_OBJECTS_LIST = "viewer-linked-objects-list",
34
+ STATES_OBJECTS_GET_LIST = "viewer-states-objects-get-list",
35
+ STATES_OBJECTS_LIST = "viewer-states-objects-list",
30
36
  TREE_SELECT_NODE = "viewer-tree-select-node",
31
37
  TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
32
38
  TREE_NODE_IDS = "viewer-tree-node-ids",
@@ -42,7 +48,7 @@ declare enum ViewerMessageType {
42
48
  PAN_CHANGE = "viewer-pan-change"
43
49
  }
44
50
  type LanguageCode = "en" | "vn";
45
- type ToolbarVisibilityTarget = "all" | "left" | "center" | "right";
51
+ type ToolbarUseTarget = "all" | "left" | "center" | "right";
46
52
  type MarkupAction = "line" | "arrow" | "circle" | "ellipse" | "rectangle" | "polygon" | "polyline" | "textbox" | "note" | "callout" | "cloud" | "freehand";
47
53
  type MarkupOperationResultPayload = {
48
54
  requestId: string;
@@ -62,12 +68,29 @@ type MarkupListItem = {
62
68
  createdBy?: string;
63
69
  lastModifiedBy?: string;
64
70
  };
71
+ type PanelTarget = "clipping-commands" | "setting" | "statesObjects" | "linkedObjects" | "model-tree" | "sheets" | "object-properties";
65
72
  type SheetListItem = {
66
73
  id: string | number;
67
74
  name: string;
68
75
  is3D?: boolean;
69
76
  viewId?: string;
70
77
  };
78
+ type ObjectPropertyItem = Record<string, unknown>;
79
+ type LinkedObjectItem = Record<string, unknown>;
80
+ type StateObjectRefItem = {
81
+ name: string;
82
+ id: number;
83
+ };
84
+ type StateObjectItem = {
85
+ id: string;
86
+ name: string;
87
+ char: string;
88
+ object: StateObjectRefItem[];
89
+ states: {
90
+ color: string;
91
+ type: string;
92
+ };
93
+ };
71
94
  type PdfModeEventPayload = {
72
95
  mode: "plan" | "document";
73
96
  timestamp: number;
@@ -115,6 +138,21 @@ type ViewerEventMap = {
115
138
  activeSheetId?: string | number | null;
116
139
  timestamp: number;
117
140
  };
141
+ "object-properties:list": {
142
+ requestId: string;
143
+ properties: ObjectPropertyItem[];
144
+ timestamp: number;
145
+ };
146
+ "linked-objects:list": {
147
+ requestId: string;
148
+ linkedObjects: LinkedObjectItem[];
149
+ timestamp: number;
150
+ };
151
+ "states-objects:list": {
152
+ requestId: string;
153
+ statesObjects: StateObjectItem[];
154
+ timestamp: number;
155
+ };
118
156
  "markup:list": {
119
157
  requestId: string;
120
158
  markups: MarkupListItem[];
@@ -320,6 +358,7 @@ declare class FilesModule {
320
358
  private normalizeBaseUrl;
321
359
  private resolveBaseUrl;
322
360
  private resolveViewerPath;
361
+ private normalizeSdkViewerPath;
323
362
  private resolveViewerOrigin;
324
363
  private resolveHostConversion;
325
364
  private getUploadPath;
@@ -340,6 +379,7 @@ declare class FilesModule {
340
379
  private toErrorMessage;
341
380
  }
342
381
 
382
+ type ToolbarFormat = "3d" | "pdf";
343
383
  type GetSheetsOptions = {
344
384
  timeoutMs?: number;
345
385
  };
@@ -381,15 +421,11 @@ declare class ToolbarModule {
381
421
  disableAllPdf(): void;
382
422
  enableAll3D(): void;
383
423
  enableAllPdf(): void;
384
- hideToolbar(): void;
385
- showToolbar(): void;
386
- setToolbarVisible(visible: boolean, target?: ToolbarVisibilityTarget): void;
387
- hideLeftToolbar(): void;
388
- showLeftToolbar(): void;
389
- hideCenterToolbar(): void;
390
- showCenterToolbar(): void;
391
- hideRightToolbar(): void;
392
- showRightToolbar(): void;
424
+ useToolbar(target?: ToolbarUseTarget): void;
425
+ useLeftToolbar(): void;
426
+ useCenterToolbar(): void;
427
+ useRightToolbar(): void;
428
+ usePanel(panel: PanelTarget, format?: ToolbarFormat): void;
393
429
  openClippingPlanes(): void;
394
430
  closeClippingPlanes(): void;
395
431
  openSetting(): void;
@@ -409,6 +445,9 @@ declare class ToolbarModule {
409
445
  openSheets(): void;
410
446
  closeSheets(): void;
411
447
  getSheets(options?: GetSheetsOptions): Promise<SheetListItem[]>;
448
+ getObjectProperties(options?: GetSheetsOptions): Promise<ObjectPropertyItem[]>;
449
+ getLinkedObjects(options?: GetSheetsOptions): Promise<LinkedObjectItem[]>;
450
+ getStatesObjects(options?: GetSheetsOptions): Promise<StateObjectItem[]>;
412
451
  applySheet(sheetId: string | number): void;
413
452
  cuttingCloseSections(): void;
414
453
  cuttingMultipleSides(): void;
@@ -423,12 +462,15 @@ declare class ToolbarModule {
423
462
  cuttingReversePlaneY(): void;
424
463
  cuttingReversePlaneZ(): void;
425
464
  private postConfig;
426
- private postToolbarVisibility;
465
+ private postToolbarUse;
427
466
  private postPanelOpen;
428
467
  private postPanelClose;
429
468
  private postCuttingAction;
430
469
  private postSheetsGetList;
431
470
  private postSheetsApply;
471
+ private postObjectPropertiesGetList;
472
+ private postLinkedObjectsGetList;
473
+ private postStatesObjectsGetList;
432
474
  }
433
475
 
434
476
  type GetNodeIdsOptions = {
@@ -475,7 +517,7 @@ declare class LanguageModule {
475
517
  set(language: LanguageCode): void;
476
518
  }
477
519
 
478
- type InitialToolbarVisibility = Partial<Record<ToolbarVisibilityTarget, boolean>>;
520
+ type InitialToolbarUse = ToolbarUseTarget | ToolbarUseTarget[] | Partial<Record<ToolbarUseTarget, boolean>>;
479
521
  type Viewer3DOptions = {
480
522
  container: HTMLElement | string;
481
523
  url?: string;
@@ -483,7 +525,7 @@ type Viewer3DOptions = {
483
525
  viewerPath?: string;
484
526
  uploadPath?: string;
485
527
  file?: File;
486
- initialToolbarVisibility?: InitialToolbarVisibility;
528
+ initialToolbar?: InitialToolbarUse;
487
529
  width?: string;
488
530
  height?: string;
489
531
  sandbox?: string;
@@ -513,6 +555,7 @@ declare class Viewer3D {
513
555
  destroy(): void;
514
556
  private ensureInit;
515
557
  private withInitialOptions;
558
+ private normalizeInitialToolbar;
516
559
  _on<K extends SdkEventKey>(event: K, cb: (payload: SdkEventPayload<K>) => void): () => void;
517
560
  _off<K extends SdkEventKey>(event: K, cb: (payload: SdkEventPayload<K>) => void): void;
518
561
  _emit<K extends SdkEventKey>(event: K, payload: SdkEventPayload<K>): void;
@@ -520,4 +563,4 @@ declare class Viewer3D {
520
563
  private handleMessage;
521
564
  }
522
565
 
523
- export { type ConvertOptions, type ConvertV2Options, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type InitialToolbarVisibility, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };
566
+ export { type ConvertOptions, type ConvertV2Options, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type InitialToolbarUse, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };
package/dist/index.d.ts CHANGED
@@ -20,13 +20,19 @@ declare enum ViewerMessageType {
20
20
  ZOOM_WINDOW = "viewer-zoom-window",
21
21
  ZOOM_FIT = "viewer-zoom-fit",
22
22
  TOOLBAR_CONFIG = "viewer-toolbar-config",
23
- TOOLBAR_VISIBILITY = "viewer-toolbar-visibility",
23
+ TOOLBAR_USE = "viewer-toolbar-use",
24
24
  PANEL_OPEN = "viewer-panel-open",
25
25
  PANEL_CLOSE = "viewer-panel-close",
26
26
  CUTTING_PLANE_ACTION = "viewer-cutting-plane-action",
27
27
  SHEETS_GET_LIST = "viewer-sheets-get-list",
28
28
  SHEETS_LIST = "viewer-sheets-list",
29
29
  SHEETS_APPLY = "viewer-sheets-apply",
30
+ OBJECT_PROPERTIES_GET_LIST = "viewer-object-properties-get-list",
31
+ OBJECT_PROPERTIES_LIST = "viewer-object-properties-list",
32
+ LINKED_OBJECTS_GET_LIST = "viewer-linked-objects-get-list",
33
+ LINKED_OBJECTS_LIST = "viewer-linked-objects-list",
34
+ STATES_OBJECTS_GET_LIST = "viewer-states-objects-get-list",
35
+ STATES_OBJECTS_LIST = "viewer-states-objects-list",
30
36
  TREE_SELECT_NODE = "viewer-tree-select-node",
31
37
  TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
32
38
  TREE_NODE_IDS = "viewer-tree-node-ids",
@@ -42,7 +48,7 @@ declare enum ViewerMessageType {
42
48
  PAN_CHANGE = "viewer-pan-change"
43
49
  }
44
50
  type LanguageCode = "en" | "vn";
45
- type ToolbarVisibilityTarget = "all" | "left" | "center" | "right";
51
+ type ToolbarUseTarget = "all" | "left" | "center" | "right";
46
52
  type MarkupAction = "line" | "arrow" | "circle" | "ellipse" | "rectangle" | "polygon" | "polyline" | "textbox" | "note" | "callout" | "cloud" | "freehand";
47
53
  type MarkupOperationResultPayload = {
48
54
  requestId: string;
@@ -62,12 +68,29 @@ type MarkupListItem = {
62
68
  createdBy?: string;
63
69
  lastModifiedBy?: string;
64
70
  };
71
+ type PanelTarget = "clipping-commands" | "setting" | "statesObjects" | "linkedObjects" | "model-tree" | "sheets" | "object-properties";
65
72
  type SheetListItem = {
66
73
  id: string | number;
67
74
  name: string;
68
75
  is3D?: boolean;
69
76
  viewId?: string;
70
77
  };
78
+ type ObjectPropertyItem = Record<string, unknown>;
79
+ type LinkedObjectItem = Record<string, unknown>;
80
+ type StateObjectRefItem = {
81
+ name: string;
82
+ id: number;
83
+ };
84
+ type StateObjectItem = {
85
+ id: string;
86
+ name: string;
87
+ char: string;
88
+ object: StateObjectRefItem[];
89
+ states: {
90
+ color: string;
91
+ type: string;
92
+ };
93
+ };
71
94
  type PdfModeEventPayload = {
72
95
  mode: "plan" | "document";
73
96
  timestamp: number;
@@ -115,6 +138,21 @@ type ViewerEventMap = {
115
138
  activeSheetId?: string | number | null;
116
139
  timestamp: number;
117
140
  };
141
+ "object-properties:list": {
142
+ requestId: string;
143
+ properties: ObjectPropertyItem[];
144
+ timestamp: number;
145
+ };
146
+ "linked-objects:list": {
147
+ requestId: string;
148
+ linkedObjects: LinkedObjectItem[];
149
+ timestamp: number;
150
+ };
151
+ "states-objects:list": {
152
+ requestId: string;
153
+ statesObjects: StateObjectItem[];
154
+ timestamp: number;
155
+ };
118
156
  "markup:list": {
119
157
  requestId: string;
120
158
  markups: MarkupListItem[];
@@ -320,6 +358,7 @@ declare class FilesModule {
320
358
  private normalizeBaseUrl;
321
359
  private resolveBaseUrl;
322
360
  private resolveViewerPath;
361
+ private normalizeSdkViewerPath;
323
362
  private resolveViewerOrigin;
324
363
  private resolveHostConversion;
325
364
  private getUploadPath;
@@ -340,6 +379,7 @@ declare class FilesModule {
340
379
  private toErrorMessage;
341
380
  }
342
381
 
382
+ type ToolbarFormat = "3d" | "pdf";
343
383
  type GetSheetsOptions = {
344
384
  timeoutMs?: number;
345
385
  };
@@ -381,15 +421,11 @@ declare class ToolbarModule {
381
421
  disableAllPdf(): void;
382
422
  enableAll3D(): void;
383
423
  enableAllPdf(): void;
384
- hideToolbar(): void;
385
- showToolbar(): void;
386
- setToolbarVisible(visible: boolean, target?: ToolbarVisibilityTarget): void;
387
- hideLeftToolbar(): void;
388
- showLeftToolbar(): void;
389
- hideCenterToolbar(): void;
390
- showCenterToolbar(): void;
391
- hideRightToolbar(): void;
392
- showRightToolbar(): void;
424
+ useToolbar(target?: ToolbarUseTarget): void;
425
+ useLeftToolbar(): void;
426
+ useCenterToolbar(): void;
427
+ useRightToolbar(): void;
428
+ usePanel(panel: PanelTarget, format?: ToolbarFormat): void;
393
429
  openClippingPlanes(): void;
394
430
  closeClippingPlanes(): void;
395
431
  openSetting(): void;
@@ -409,6 +445,9 @@ declare class ToolbarModule {
409
445
  openSheets(): void;
410
446
  closeSheets(): void;
411
447
  getSheets(options?: GetSheetsOptions): Promise<SheetListItem[]>;
448
+ getObjectProperties(options?: GetSheetsOptions): Promise<ObjectPropertyItem[]>;
449
+ getLinkedObjects(options?: GetSheetsOptions): Promise<LinkedObjectItem[]>;
450
+ getStatesObjects(options?: GetSheetsOptions): Promise<StateObjectItem[]>;
412
451
  applySheet(sheetId: string | number): void;
413
452
  cuttingCloseSections(): void;
414
453
  cuttingMultipleSides(): void;
@@ -423,12 +462,15 @@ declare class ToolbarModule {
423
462
  cuttingReversePlaneY(): void;
424
463
  cuttingReversePlaneZ(): void;
425
464
  private postConfig;
426
- private postToolbarVisibility;
465
+ private postToolbarUse;
427
466
  private postPanelOpen;
428
467
  private postPanelClose;
429
468
  private postCuttingAction;
430
469
  private postSheetsGetList;
431
470
  private postSheetsApply;
471
+ private postObjectPropertiesGetList;
472
+ private postLinkedObjectsGetList;
473
+ private postStatesObjectsGetList;
432
474
  }
433
475
 
434
476
  type GetNodeIdsOptions = {
@@ -475,7 +517,7 @@ declare class LanguageModule {
475
517
  set(language: LanguageCode): void;
476
518
  }
477
519
 
478
- type InitialToolbarVisibility = Partial<Record<ToolbarVisibilityTarget, boolean>>;
520
+ type InitialToolbarUse = ToolbarUseTarget | ToolbarUseTarget[] | Partial<Record<ToolbarUseTarget, boolean>>;
479
521
  type Viewer3DOptions = {
480
522
  container: HTMLElement | string;
481
523
  url?: string;
@@ -483,7 +525,7 @@ type Viewer3DOptions = {
483
525
  viewerPath?: string;
484
526
  uploadPath?: string;
485
527
  file?: File;
486
- initialToolbarVisibility?: InitialToolbarVisibility;
528
+ initialToolbar?: InitialToolbarUse;
487
529
  width?: string;
488
530
  height?: string;
489
531
  sandbox?: string;
@@ -513,6 +555,7 @@ declare class Viewer3D {
513
555
  destroy(): void;
514
556
  private ensureInit;
515
557
  private withInitialOptions;
558
+ private normalizeInitialToolbar;
516
559
  _on<K extends SdkEventKey>(event: K, cb: (payload: SdkEventPayload<K>) => void): () => void;
517
560
  _off<K extends SdkEventKey>(event: K, cb: (payload: SdkEventPayload<K>) => void): void;
518
561
  _emit<K extends SdkEventKey>(event: K, payload: SdkEventPayload<K>): void;
@@ -520,4 +563,4 @@ declare class Viewer3D {
520
563
  private handleMessage;
521
564
  }
522
565
 
523
- export { type ConvertOptions, type ConvertV2Options, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type InitialToolbarVisibility, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };
566
+ export { type ConvertOptions, type ConvertV2Options, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type InitialToolbarUse, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };