@bimdata/viewer 2.0.0-beta.13 → 2.0.0-beta.131

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/index.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ /// <reference types="./types/api"/>
2
+ /// <reference types="./types/context-menu"/>
3
+ /// <reference types="./types/events"/>
4
+ /// <reference types="./types/global-context"/>
5
+ /// <reference types="./types/local-context"/>
6
+ /// <reference types="./types/models"/>
7
+ /// <reference types="./types/plugins"/>
8
+ /// <reference types="./types/shortcuts"/>
9
+ /// <reference types="./types/state"/>
10
+ /// <reference types="./types/windows"/>
11
+ /// <reference types="./types/xeokit"/>
12
+ /// <reference types="./types/$viewer"/>
13
+
1
14
  declare module "@bimdata/viewer" {
2
15
  export default function makeBIMDataViewer(cfg: BDV.ViewerConfig): BDV.Viewer;
3
16
  }
@@ -5,42 +18,37 @@ declare module "@bimdata/viewer" {
5
18
  declare namespace BDV {
6
19
  interface Viewer {
7
20
  mount(container: HTMLElement | string, layout?: any): any;
21
+ destroy(): void;
8
22
  setAccessToken(token: string): void;
9
- setLocale(lang: ViewerLocales): void;
10
- registerPlugin(plugin: PluginConfig, cfg?: Object): void;
23
+ setLocale(lang: ViewerLocale): void;
24
+ registerPlugin(plugin: PluginDefinition, cfg?: Object): void;
11
25
  registerWindow(window: Object): void;
12
26
  unregisterWindow(name: string): void;
13
- loadModels(modelIds: number[]): StateModel[];
27
+ loadModels(modelIds: number[]): Promise<StateModel[]>;
14
28
 
15
29
  /** @deprecated use `loadModels` instead */
16
- loadIfcs(ifcIds: number[]): StateModel[];
30
+ loadIfcs(ifcIds: number[]): Promise<StateModel[]>;
17
31
  }
18
32
 
19
- enum ViewerLocales {
20
- "de",
21
- "en",
22
- "es",
23
- "fr",
24
- "it",
25
- }
33
+ type ViewerLocale = "de" | "en" | "es" | "fr" | "it";
26
34
 
27
35
  interface ViewerConfig {
28
36
  ui?: ViewerConfigUI;
29
37
  api: ViewerConfigApi;
30
38
  plugins?: ViewerConfigPlugins;
31
- locale?: ViewerLocales;
39
+ locale?: ViewerLocale;
32
40
  }
33
41
 
34
42
  interface ViewerConfigUI {
35
- headerVisible: boolean;
36
- windowManager: boolean;
37
- version: boolean;
38
- bimdataLogo: boolean;
39
- contextMenu: {
40
- defaultCommands: boolean;
43
+ headerVisible?: boolean;
44
+ windowManager?: boolean;
45
+ version?: boolean;
46
+ bimdataLogo?: boolean;
47
+ contextMenu?: {
48
+ defaultCommands?: boolean;
41
49
  };
42
- style: {
43
- backgroundColor: string;
50
+ style?: {
51
+ backgroundColor?: string;
44
52
  };
45
53
  }
46
54
 
@@ -50,96 +58,126 @@ declare namespace BDV {
50
58
  accessToken: string;
51
59
  cloudId: number;
52
60
  projectId: number;
53
- modelIds: number[];
61
+ modelIds?: number[];
62
+
63
+ offline?: {
64
+ enabled: boolean;
65
+ dataFile: string;
66
+ };
54
67
 
55
68
  /** @deprecated use `modelIds` instead */
56
69
  ifcIds?: number[];
57
70
  }
58
71
 
59
72
  interface ViewerConfigPlugins {
60
- // Conf
61
- addPlugins?: boolean;
62
- windowSelector?: boolean;
73
+ // --- General config ---
74
+ windowSelector?: boolean; // Enable/Disable window selector
63
75
 
64
- // IFC 3D Viewer
65
- viewer3d?:
76
+ // --- Native plugins config ---
77
+
78
+ alerts?: boolean;
79
+ bcf?:
66
80
  | boolean
67
81
  | {
68
- edges?: boolean;
69
- enableOffsets: boolean;
70
- navCube?: boolean;
71
- pivotMarker?: boolean;
82
+ topicGuid?: string;
72
83
  };
73
- projection?: boolean;
74
- search?: boolean;
75
- section?: boolean;
76
- split?: boolean;
77
- "structure-properties"?:
78
- | boolean
79
- | {
80
- merge?: boolean;
81
- export?: boolean;
82
- editProperties?: boolean;
83
- translateIfcEntities?: boolean;
84
- customTranslations?: Object;
85
- };
86
- "viewer3d-parameters"?: boolean;
87
-
88
- // IFC 2D Viewer
89
- viewer2d?: boolean;
90
- equipment2d?: boolean;
91
- gauge2d?: boolean;
92
- switch?: boolean;
93
- "viewer2d-background"?: boolean;
94
- "viewer2d-drawer"?: boolean;
95
- "viewer2d-parameters"?: boolean;
96
- "viewer2d-screenshot"?: boolean;
97
-
98
- // DWG / DXF Viewers
99
- dwg?: boolean;
100
- dxf?: boolean;
101
- "dwg-layer"?: boolean;
102
-
103
- // Plan / Meta-Building Viewer
104
- plan?: boolean;
105
- synchronization?: boolean;
106
-
107
- // Point Cloud Viewer
108
- pointCloud?:
84
+ bcfManager?: boolean;
85
+ buildingMaker?: boolean;
86
+ "drawing-tools"?: boolean;
87
+ dwg?:
109
88
  | boolean
110
89
  | {
111
- navCube?: boolean;
90
+ help?: boolean;
91
+ modelLoader?: "hidden" | "disabled";
112
92
  };
113
-
114
- // BCF
115
- bcf?:
93
+ "dwg-layer"?: boolean;
94
+ dxf?:
116
95
  | boolean
117
96
  | {
118
- topicGuid?: string;
97
+ help?: boolean;
98
+ modelLoader?: "hidden" | "disabled";
119
99
  };
120
- bcfManager?: boolean;
121
-
122
- // Misc
123
- alerts?: boolean;
124
- buildingMaker?: boolean;
125
100
  fullscreen?: boolean;
126
101
  ged?: boolean;
127
102
  header?: boolean;
103
+ measure2d?: boolean;
104
+ measure3d?: boolean;
105
+ navigationVersionsModel?: boolean;
128
106
  pdf?: boolean;
107
+ pdfExport?: boolean;
108
+ plan?:
109
+ | boolean
110
+ | {
111
+ help?: boolean;
112
+ modelLoader?: "hidden" | "disabled";
113
+ storeySelector?: boolean;
114
+ storeySelectorAutoOpen?: boolean;
115
+ };
116
+ pointCloud?:
117
+ | boolean
118
+ | {
119
+ help?: boolean;
120
+ modelLoader?: "hidden" | "disabled";
121
+ navCube?: boolean;
122
+ pivotMarker?: boolean;
123
+ };
124
+ pointCloudParameters?: boolean;
125
+ projection?: boolean;
129
126
  properties?:
130
127
  | boolean
131
128
  | {
132
129
  editProperties?: boolean;
133
130
  };
134
- "storey-selector"?: boolean;
131
+ "right-angled"?: boolean;
132
+ search?: boolean;
133
+ section?: boolean;
134
+ smartview?: boolean;
135
+ split?: boolean;
135
136
  structure?:
136
137
  | boolean
137
138
  | {
139
+ export?: boolean;
138
140
  merge?: boolean;
141
+ translateIfcEntities?: boolean;
142
+ customTranslations?: Object;
143
+ };
144
+ "structure-properties"?:
145
+ | boolean
146
+ | {
147
+ editProperties?: boolean;
139
148
  export?: boolean;
149
+ merge?: boolean;
140
150
  translateIfcEntities?: boolean;
141
151
  customTranslations?: Object;
142
152
  };
153
+ switch?: boolean;
154
+ synchronization?: boolean;
155
+ viewer2d?:
156
+ | boolean
157
+ | {
158
+ compass?: boolean;
159
+ help?: boolean;
160
+ modelLoader?: "hidden" | "disabled";
161
+ storeySelector?: boolean;
162
+ storeySelectorAutoOpen?: boolean;
163
+ };
164
+ "viewer2d-background"?: boolean;
165
+ "viewer2d-parameters"?: boolean;
166
+ "viewer2d-screenshot"?: boolean;
167
+ viewer3d?:
168
+ | boolean
169
+ | {
170
+ edges?: boolean;
171
+ enableDynamicLOD?: boolean;
172
+ enableOffsets?: boolean;
173
+ home?: boolean;
174
+ help?: boolean;
175
+ modelLoader?: "hidden" | "disabled";
176
+ navCube?: boolean;
177
+ navigationVersionsModel?: boolean;
178
+ pivotMarker?: boolean;
179
+ };
180
+ "viewer3d-parameters"?: boolean;
143
181
  "window-split"?: boolean;
144
182
  }
145
183
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bimdata/viewer",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.13",
4
+ "version": "2.0.0-beta.131",
5
5
  "description": "A customizable BIM viewer.",
6
6
  "keywords": [
7
7
  "bim",
@@ -20,9 +20,8 @@
20
20
  "last 2 chrome version",
21
21
  "last 2 firefox version"
22
22
  ],
23
- "main": "dist/bimdata-viewer.min.js",
23
+ "main": "dist/bimdata-viewer.esm.min.js",
24
24
  "module": "dist/bimdata-viewer.esm.min.js",
25
- "unpkg": "dist/bimdata-viewer.min.js",
26
25
  "scripts": {
27
26
  "build": "vite build && npm exec terser -- -c -m --module dist/bimdata-viewer.js > dist/bimdata-viewer.esm.min.js && rm dist/bimdata-viewer.js",
28
27
  "cy:run": "cypress run",
@@ -49,61 +48,62 @@
49
48
  "index.d.ts"
50
49
  ],
51
50
  "devDependencies": {
52
- "@babel/preset-env": "^7.21.5",
51
+ "@babel/preset-env": "^7.22.20",
53
52
  "@bimdata/2d-engine": "2.4.0",
54
- "@bimdata/areas-next": "0.1.13",
55
- "@bimdata/bcf-components": "4.1.1",
56
- "@bimdata/building-maker": "1.6.1",
57
- "@bimdata/color-picker": "0.0.3",
58
- "@bimdata/design-system": "2.0.0-rc.16",
59
- "@bimdata/typescript-fetch-api-client": "9.8.0",
53
+ "@bimdata/areas-next": "0.1.15",
54
+ "@bimdata/bcf-components": "6.2.1",
55
+ "@bimdata/building-maker": "3.0.3",
56
+ "@bimdata/components": "1.3.2",
57
+ "@bimdata/design-system": "2.1.0-rc.14",
58
+ "@bimdata/typescript-fetch-api-client": "9.22.0",
60
59
  "@rollup/plugin-alias": "5.0.0",
61
60
  "@rollup/plugin-babel": "^6.0.3",
62
- "@rollup/plugin-commonjs": "^25.0.0",
61
+ "@rollup/plugin-commonjs": "^25.0.4",
63
62
  "@rollup/plugin-image": "^3.0.2",
63
+ "@rollup/plugin-replace": "^5.0.2",
64
64
  "@semantic-release/changelog": "^6.0.3",
65
- "@semantic-release/commit-analyzer": "^9.0.2",
65
+ "@semantic-release/commit-analyzer": "^11.0.0",
66
66
  "@semantic-release/git": "^10.0.1",
67
- "@semantic-release/github": "^8.0.7",
68
- "@semantic-release/npm": "^10.0.3",
69
- "@semantic-release/release-notes-generator": "^11.0.1",
70
- "@vitejs/plugin-vue": "4.2.3",
71
- "@vue/vue3-jest": "29.2.4",
72
- "@xeokit/xeokit-sdk": "git+https://git@github.com/Amoki/xeokit-sdk.git#7d1a4afb04b1394f33573ac16f719bc3d8d5acb4",
67
+ "@semantic-release/github": "^9.2.1",
68
+ "@semantic-release/npm": "^11.0.0",
69
+ "@semantic-release/release-notes-generator": "^12.0.0",
70
+ "@vitejs/plugin-vue": "4.3.4",
71
+ "@vue/vue3-jest": "29.2.6",
72
+ "@xeokit/xeokit-sdk": "git+https://git@github.com/Amoki/xeokit-sdk.git#369bb4876e529995cd4c192bc7fda5e957f9634f",
73
+ "@zip.js/zip.js": "^2.7.32",
73
74
  "async": "^3.2.4",
74
- "autoprefixer": "^10.4.14",
75
+ "autoprefixer": "^10.4.16",
75
76
  "babel-core": "^7.0.0-bridge.0",
76
- "babel-jest": "^29.5.0",
77
- "conventional-changelog-eslint": "^3.0.9",
78
- "cypress": "12.12.0",
79
- "eslint": "^8.41.0",
80
- "eslint-config-prettier": "^8.8.0",
81
- "eslint-plugin-cypress": "^2.13.3",
82
- "eslint-plugin-jest": "^27.2.1",
83
- "eslint-plugin-prettier": "^4.2.1",
84
- "eslint-plugin-vue": "^9.14.0",
77
+ "babel-jest": "^29.7.0",
78
+ "conventional-changelog-eslint": "^5.0.0",
79
+ "cypress": "13.3.0",
80
+ "eslint": "^8.50.0",
81
+ "eslint-config-prettier": "^9.0.0",
82
+ "eslint-plugin-cypress": "^2.15.1",
83
+ "eslint-plugin-jest": "^27.4.2",
84
+ "eslint-plugin-prettier": "^5.0.0",
85
+ "eslint-plugin-vue": "^9.17.0",
85
86
  "form-data": "^4.0.0",
86
87
  "html2canvas": "1.4.1",
87
88
  "http-server": "^14.1.1",
88
- "jest": "^29.5.0",
89
- "jest-environment-jsdom": "^29.5.0",
90
- "jest-extended": "^3.2.4",
89
+ "jest": "^29.7.0",
90
+ "jest-environment-jsdom": "^29.7.0",
91
+ "jest-extended": "^4.0.1",
91
92
  "jspdf": "^2.5.1",
92
93
  "lodash": "^4.17.21",
93
- "node-fetch": "^3.3.1",
94
- "postcss": "^8.4.23",
95
- "prettier": "^2.8.8",
94
+ "node-fetch": "^3.3.2",
95
+ "postcss": "^8.4.31",
96
+ "prettier": "^3.0.3",
96
97
  "querystring": "^0.2.0",
97
- "rollup-plugin-replace": "^2.2.0",
98
- "sass": "^1.62.1",
99
- "semantic-release": "^21.0.2",
100
- "sinon": "^15.1.0",
101
- "start-server-and-test": "2.0.0",
102
- "terser": "^5.17.5",
103
- "vite": "4.3.8",
104
- "vite-plugin-css-injected-by-js": "3.1.1",
105
- "vue": "3.3.4",
106
- "vue-eslint-parser": "^9.3.0",
107
- "vue-i18n": "^9.2.2"
98
+ "sass": "^1.68.0",
99
+ "semantic-release": "^22.0.5",
100
+ "sinon": "^16.0.0",
101
+ "start-server-and-test": "2.0.1",
102
+ "terser": "5.20.0",
103
+ "vite": "4.4.9",
104
+ "vite-plugin-css-injected-by-js": "3.3.0",
105
+ "vue": "3.4.19",
106
+ "vue-eslint-parser": "^9.3.1",
107
+ "vue-i18n": "^9.5.0"
108
108
  }
109
109
  }
package/types/api.d.ts CHANGED
@@ -1,17 +1,22 @@
1
1
  declare namespace BDV {
2
2
  interface Api {
3
- readonly permissions: Permissions;
4
3
  readonly apiClient: any;
5
- readonly apiUrl: string;
6
- readonly archiveUrl: string;
4
+ readonly apiUrl?: string;
5
+ readonly archiveUrl?: string;
7
6
  readonly cloudId: number;
8
7
  readonly projectId: number;
8
+ readonly permissions: Permissions;
9
9
  accessToken: string;
10
10
 
11
11
  getModel(modelId: number): Promise<ApiModel>;
12
12
  getModelStructure(model: ApiModel): Promise<any>;
13
13
  getRawElements(modelId: number): Promise<any>;
14
14
  getStoreys(modelId: number): Promise<ApiStorey[]>;
15
+ createModel(docId: number): Promise<ApiModel>;
16
+ waitForModelProcess(model: ApiModel): Promise<ApiModel>;
17
+ createStoreyPlan(modelId: number, storeyUuid: string, docId: number): Promise<ApiPlan>;
18
+ deleteStoreyPlan(modelId: number, storeyUuid: string, planId: number): Promise<void>;
19
+ updatePlanPositioning(modelId: number, storeyUuid: string, planId: number, positioning: ApiPositionning): Promise<ApiPositionning>;
15
20
 
16
21
  // ---
17
22
 
@@ -38,12 +43,29 @@ declare namespace BDV {
38
43
  source: ModelSource;
39
44
  status: ModelStatus;
40
45
  archived: boolean;
41
- document: ApiDocument;
42
46
  project_id: number;
47
+ document_id: number;
48
+ document?: ApiDocument;
49
+
50
+ // Model files
51
+ preview_file?: string;
43
52
  structure_file?: string;
44
- xkt_file?: string;
53
+ xkt_file?: string; // Deprecated: use `xkt_files` instead
54
+ xkt_files?: { version: number; file: string }[];
45
55
  gltf_file?: string;
46
56
  map_file?: string;
57
+ binary_2d_file?: string;
58
+
59
+ // Misc
60
+ world_position?: number[];
61
+ north_vector?: number[][];
62
+ recommanded_2d_angle?: number;
63
+ size_ratio?: number;
64
+
65
+ // Multi-page PDF
66
+ page_number?: number;
67
+ parent_id?: number;
68
+ children?: ApiModel[];
47
69
  }
48
70
 
49
71
  type ApiPlan = ApiModel;
@@ -54,12 +76,7 @@ declare namespace BDV {
54
76
  longname: string;
55
77
  type: string;
56
78
  object_type: string;
57
- model: StateModel;
58
- parent: StateObject;
59
79
  children: ApiObject[];
60
-
61
- /** @deprecated use `model` instead */
62
- ifc: StateModel;
63
80
  }
64
81
 
65
82
  interface ApiStorey {
@@ -77,25 +94,36 @@ declare namespace BDV {
77
94
  }
78
95
 
79
96
  interface Permissions {
80
- hasAdminPermission: boolean,
81
- hasBcfReadPermission: boolean,
82
- hasBcfWritePermission: boolean,
83
- hasDocReadPermission: boolean,
84
- hasDocWritePermission: boolean,
85
- hasModelReadPermission: boolean,
86
- hasModelWritePermission: boolean,
87
- hasReadPermission: boolean,
88
- hasWritePermission: boolean,
89
- userRole: string,
97
+ hasReadPermission: boolean;
98
+ hasWritePermission: boolean;
99
+ hasAdminPermission: boolean;
100
+ hasBcfReadPermission: boolean;
101
+ hasBcfWritePermission: boolean;
102
+ hasDocReadPermission: boolean;
103
+ hasDocWritePermission: boolean;
104
+ hasModelReadPermission: boolean;
105
+ hasModelWritePermission: boolean;
90
106
  tokenScopes: {
91
- bcf?: string[],
92
- model?: string[],
93
- document?: string[],
94
- }
107
+ bcf?: string[];
108
+ document?: string[];
109
+ model?: string[];
110
+ };
95
111
  usableScopes: {
96
- bcf?: string[],
97
- model?: string[],
98
- document?: string[],
99
- }
112
+ bcf?: string[];
113
+ document?: string[];
114
+ model?: string[];
115
+ };
116
+ userRole?: string;
117
+ user?: {
118
+ id: number;
119
+ email: string;
120
+ firstName: string;
121
+ lastName: string;
122
+ created_at: string;
123
+ updated_at: string;
124
+ provider: string;
125
+ sub: string;
126
+ profile_picture: string;
127
+ };
100
128
  }
101
129
  }
@@ -1,7 +1,7 @@
1
1
  declare namespace BDV {
2
2
  interface Shortcut {
3
3
  name: string;
4
- context: Object;
4
+ context: GlobalContext | LocalContext;
5
5
  key: string;
6
6
  ctrlKey: boolean;
7
7
  shiftKey: boolean;
@@ -11,12 +11,13 @@ declare namespace BDV {
11
11
 
12
12
  interface ShortcutManager {
13
13
  active: boolean;
14
+ activeLocalContext?: LocalContext;
14
15
  shortcuts: Shortcut[];
15
- currentContext: any;
16
16
 
17
17
  getShortcuts(context: GlobalContext | LocalContext): Shortcut[];
18
18
  getShortcut(name: string, context: GlobalContext | LocalContext): Shortcut;
19
19
  registerShortcut(shortcut: Shortcut, context: GlobalContext | LocalContext): boolean;
20
20
  unregisterShortcut(name: string, context: GlobalContext | LocalContext): boolean;
21
+ destroy(): void;
21
22
  }
22
23
  }