@bimdata/viewer 2.0.0-beta.9 → 2.0.0-beta.91

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,30 +58,84 @@ declare namespace BDV {
50
58
  accessToken: string;
51
59
  cloudId: number;
52
60
  projectId: number;
53
- modelIds: number[];
61
+ modelIds?: number[];
54
62
 
55
63
  /** @deprecated use `modelIds` instead */
56
64
  ifcIds?: number[];
57
65
  }
58
66
 
59
67
  interface ViewerConfigPlugins {
60
- // Conf
61
- addPlugins?: boolean;
62
- windowSelector?: boolean;
68
+ // --- General config ---
69
+ windowSelector?: boolean; // Enable/Disable window selector
63
70
 
64
- // IFC 3D Viewer
65
- viewer3d?:
71
+ // --- Native plugins config ---
72
+
73
+ alerts?: boolean;
74
+ bcf?:
66
75
  | boolean
67
76
  | {
68
- edges?: boolean;
69
- enableOffsets: boolean;
77
+ topicGuid?: string;
78
+ };
79
+ bcfManager?: boolean;
80
+ buildingMaker?: boolean;
81
+ dwg?:
82
+ | boolean
83
+ | {
84
+ help?: boolean;
85
+ modelLoader?: "hidden" | "disabled";
86
+ };
87
+ "dwg-layer"?: boolean;
88
+ dxf?:
89
+ | boolean
90
+ | {
91
+ help?: boolean;
92
+ modelLoader?: "hidden" | "disabled";
93
+ };
94
+ equipment2d?: boolean;
95
+ fullscreen?: boolean;
96
+ gauge2d?: boolean;
97
+ ged?: boolean;
98
+ header?: boolean;
99
+ measure2d?: boolean;
100
+ measure3d?: boolean;
101
+ navigationVersionsModel?: boolean;
102
+ pdf?: boolean;
103
+ pdfAnnotations?: boolean;
104
+ pdfExport?: boolean;
105
+ plan?:
106
+ | boolean
107
+ | {
108
+ help?: boolean;
109
+ modelLoader?: "hidden" | "disabled";
110
+ };
111
+ pointCloud?:
112
+ | boolean
113
+ | {
114
+ help?: boolean;
115
+ modelLoader?: "hidden" | "disabled";
70
116
  navCube?: boolean;
71
117
  pivotMarker?: boolean;
72
118
  };
119
+ pointCloudParameters?: boolean;
73
120
  projection?: boolean;
121
+ properties?:
122
+ | boolean
123
+ | {
124
+ editProperties?: boolean;
125
+ };
126
+ "right-angled"?: boolean;
74
127
  search?: boolean;
75
128
  section?: boolean;
129
+ smartview?: boolean;
76
130
  split?: boolean;
131
+ structure?:
132
+ | boolean
133
+ | {
134
+ merge?: boolean;
135
+ export?: boolean;
136
+ translateIfcEntities?: boolean;
137
+ customTranslations?: Object;
138
+ };
77
139
  "structure-properties"?:
78
140
  | boolean
79
141
  | {
@@ -83,63 +145,32 @@ declare namespace BDV {
83
145
  translateIfcEntities?: boolean;
84
146
  customTranslations?: Object;
85
147
  };
86
- "viewer3d-parameters"?: boolean;
87
-
88
- // IFC 2D Viewer
89
- viewer2d?: boolean;
90
- equipment2d?: boolean;
91
- gauge2d?: boolean;
92
148
  switch?: boolean;
149
+ synchronization?: boolean;
150
+ viewer2d?:
151
+ | boolean
152
+ | {
153
+ help?: boolean;
154
+ modelLoader?: "hidden" | "disabled";
155
+ };
93
156
  "viewer2d-background"?: boolean;
94
157
  "viewer2d-drawer"?: boolean;
95
158
  "viewer2d-parameters"?: boolean;
96
159
  "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?:
160
+ viewer3d?:
109
161
  | boolean
110
162
  | {
163
+ edges?: boolean;
164
+ enableDynamicLOD?: boolean;
165
+ enableOffsets: boolean;
166
+ home?: boolean;
167
+ help?: boolean;
168
+ modelLoader?: "hidden" | "disabled";
111
169
  navCube?: boolean;
170
+ navigationVersionsModel?: boolean;
171
+ pivotMarker?: boolean;
112
172
  };
113
-
114
- // BCF
115
- bcf?:
116
- | boolean
117
- | {
118
- topicGuid?: string;
119
- };
120
- bcfManager?: boolean;
121
-
122
- // Misc
123
- alerts?: boolean;
124
- buildingMaker?: boolean;
125
- fullscreen?: boolean;
126
- ged?: boolean;
127
- header?: boolean;
128
- pdf?: boolean;
129
- properties?:
130
- | boolean
131
- | {
132
- editProperties?: boolean;
133
- };
134
- "storey-selector"?: boolean;
135
- structure?:
136
- | boolean
137
- | {
138
- merge?: boolean;
139
- export?: boolean;
140
- translateIfcEntities?: boolean;
141
- customTranslations?: Object;
142
- };
173
+ "viewer3d-parameters"?: boolean;
143
174
  "window-split"?: boolean;
144
175
  }
145
176
  }
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.9",
4
+ "version": "2.0.0-beta.91",
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,61 @@
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
53
  "@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",
54
+ "@bimdata/bcf-components": "6.2.0",
55
+ "@bimdata/building-maker": "3.0.3",
56
+ "@bimdata/components": "1.3.1",
57
+ "@bimdata/design-system": "2.1.0-rc.11",
58
+ "@bimdata/typescript-fetch-api-client": "9.18.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#529c091812085560f45509c8a7e4043556b72b91",
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
73
  "async": "^3.2.4",
74
- "autoprefixer": "^10.4.14",
74
+ "autoprefixer": "^10.4.16",
75
75
  "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",
76
+ "babel-jest": "^29.7.0",
77
+ "conventional-changelog-eslint": "^5.0.0",
78
+ "cypress": "13.3.0",
79
+ "eslint": "^8.50.0",
80
+ "eslint-config-prettier": "^9.0.0",
81
+ "eslint-plugin-cypress": "^2.15.1",
82
+ "eslint-plugin-jest": "^27.4.2",
83
+ "eslint-plugin-prettier": "^5.0.0",
84
+ "eslint-plugin-vue": "^9.17.0",
85
85
  "form-data": "^4.0.0",
86
86
  "html2canvas": "1.4.1",
87
87
  "http-server": "^14.1.1",
88
- "jest": "^29.5.0",
89
- "jest-environment-jsdom": "^29.5.0",
90
- "jest-extended": "^3.2.4",
88
+ "jest": "^29.7.0",
89
+ "jest-environment-jsdom": "^29.7.0",
90
+ "jest-extended": "^4.0.1",
91
91
  "jspdf": "^2.5.1",
92
92
  "lodash": "^4.17.21",
93
- "node-fetch": "^3.3.1",
94
- "postcss": "^8.4.23",
95
- "prettier": "^2.8.8",
93
+ "node-fetch": "^3.3.2",
94
+ "postcss": "^8.4.31",
95
+ "prettier": "^3.0.3",
96
96
  "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",
97
+ "sass": "^1.68.0",
98
+ "semantic-release": "^22.0.5",
99
+ "sinon": "^16.0.0",
100
+ "start-server-and-test": "2.0.1",
101
+ "terser": "^5.20.0",
102
+ "vite": "4.4.9",
103
+ "vite-plugin-css-injected-by-js": "3.3.0",
105
104
  "vue": "3.3.4",
106
- "vue-eslint-parser": "^9.3.0",
107
- "vue-i18n": "^9.2.2"
105
+ "vue-eslint-parser": "^9.3.1",
106
+ "vue-i18n": "^9.5.0"
108
107
  }
109
108
  }
@@ -1,17 +1,28 @@
1
1
  declare namespace BDV {
2
2
  interface $Viewer {
3
3
  cfg: ViewerConfig;
4
- i18n: any;
4
+ i18n: i18n;
5
5
  readonly api: Api;
6
6
  readonly state: State;
7
+ readonly pluginsCfg: ViewerConfigPlugins;
8
+ readonly registeredPlugins: string[];
9
+ readonly registeredWindows: string[];
7
10
 
8
- readonly pluginManager: PluginManager;
9
- readonly shortcutManager: ShortcutManager;
10
11
  readonly globalContext: GlobalContext;
11
12
  readonly localContext: LocalContext;
12
- getLocalContexts(window: string): LocalContext[];
13
-
14
- currentContext: any;
15
13
  contextMenu: ContextMenu;
14
+
15
+ readonly shortcutManager: ShortcutManager;
16
+
17
+ // ---
18
+
19
+ readonly _pluginManager: PluginManager;
20
+ readonly _windowManager: WindowManager;
21
+ }
22
+
23
+ interface i18n {
24
+ i18nVuePlugin: any;
25
+ registerTranslations(messages: Object): void;
26
+ changeLocale(locale: ViewerLocale): void;
16
27
  }
17
28
  }
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,17 @@ declare namespace BDV {
38
43
  source: ModelSource;
39
44
  status: ModelStatus;
40
45
  archived: boolean;
41
- document: ApiDocument;
46
+ document?: ApiDocument;
42
47
  project_id: number;
43
48
  structure_file?: string;
44
49
  xkt_file?: string;
45
50
  gltf_file?: string;
46
51
  map_file?: string;
52
+
53
+ // Multi-page PDF
54
+ page_number?: number;
55
+ parent_id?: number;
56
+ children?: ApiModel[];
47
57
  }
48
58
 
49
59
  type ApiPlan = ApiModel;
@@ -54,12 +64,7 @@ declare namespace BDV {
54
64
  longname: string;
55
65
  type: string;
56
66
  object_type: string;
57
- model: StateModel;
58
- parent: StateObject;
59
67
  children: ApiObject[];
60
-
61
- /** @deprecated use `model` instead */
62
- ifc: StateModel;
63
68
  }
64
69
 
65
70
  interface ApiStorey {
@@ -77,25 +82,36 @@ declare namespace BDV {
77
82
  }
78
83
 
79
84
  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,
85
+ hasAdminPermission: boolean;
86
+ hasBcfReadPermission: boolean;
87
+ hasBcfWritePermission: boolean;
88
+ hasDocReadPermission: boolean;
89
+ hasDocWritePermission: boolean;
90
+ hasModelReadPermission: boolean;
91
+ hasModelWritePermission: boolean;
92
+ hasReadPermission: boolean;
93
+ hasWritePermission: boolean;
94
+ userRole?: string;
95
+ user?: {
96
+ id: number;
97
+ email: string;
98
+ firstName: string;
99
+ lastName: string;
100
+ created_at: string;
101
+ updated_at: string;
102
+ provider: string;
103
+ sub: string;
104
+ profile_picture: string;
105
+ };
90
106
  tokenScopes: {
91
- bcf?: string[],
92
- model?: string[],
93
- document?: string[],
94
- }
107
+ bcf?: string[];
108
+ model?: string[];
109
+ document?: string[];
110
+ };
95
111
  usableScopes: {
96
- bcf?: string[],
97
- model?: string[],
98
- document?: string[],
99
- }
112
+ bcf?: string[];
113
+ model?: string[];
114
+ document?: string[];
115
+ };
100
116
  }
101
117
  }
package/types/events.d.ts CHANGED
@@ -2,6 +2,8 @@ type Events = {
2
2
  [eventName: string]: Object;
3
3
  };
4
4
 
5
+ type SubscriptionId = number;
6
+
5
7
  interface EventOptions {
6
8
  getLastEvent?: boolean;
7
9
  }
@@ -11,13 +13,13 @@ interface EventHandler<T extends Events> {
11
13
  eventName: N,
12
14
  callback: (arg: T[N]) => void,
13
15
  options?: EventOptions
14
- ): number;
16
+ ): SubscriptionId;
15
17
  once<N extends keyof T>(
16
18
  eventName: N,
17
19
  callback: (arg: T[N]) => void,
18
20
  options?: EventOptions
19
- ): number;
20
- off(subscriptionId: number): void;
21
+ ): SubscriptionId;
22
+ off(subId: SubscriptionId): void;
21
23
  emit<N extends keyof T>(eventName: N, payload: T[N]): void;
22
24
  clear(): void;
23
25
  }
@@ -1,42 +1,39 @@
1
1
  declare namespace BDV {
2
2
  interface GlobalContext {
3
- hub: EventHandler<LocalContextEvents & GlobalContextEvents>;
3
+ hub: EventHandler<GlobalContextEvents & LocalContextEvents>;
4
+ layout: any;
5
+ readonly el: HTMLElement;
6
+ readonly plugins: Map<string, PluginInstance[]>;
4
7
 
5
- areas: any;
6
- areasSettingsDisplayed: boolean;
7
- areasSwapEnabled: boolean;
8
- areasSettingsFullOption: boolean;
9
- bcfManagerDisplayed: boolean;
10
- mouseover: boolean;
11
-
12
- /** @deprecated */
13
- getPlugins(name: string): Plugin[];
14
- plugins: Map<string, Plugin>;
8
+ activeLocalContext?: LocalContext;
9
+ readonly localContexts: LocalContext[];
10
+ getLocalContexts(window: string): LocalContext[];
11
+ getViewers(): ModelViewerInstance[];
15
12
 
16
13
  // ---
17
14
 
18
- loading: boolean;
15
+ registerShortcut(shortcut: Shortcut, context: GlobalContext | LocalContext): boolean;
16
+ unregisterShortcut(name: string, context: GlobalContext | LocalContext): boolean;
17
+
18
+ readonly loading: boolean;
19
19
  loadingProcessStart(): void;
20
20
  loadingProcessEnd(): void;
21
-
22
- registerShortcut(shortcut: Shortcut, context: GlobalContext): boolean;
23
- unregisterShortcut(name: string, context: GlobalContext): boolean;
21
+ setSpinner(spinner: any): void;
24
22
 
25
23
  modals: {
26
- pushModal(component: Object, options?: { args: Object }): void;
24
+ pushModal(component: any, props?: any, options?: any): void;
27
25
  clearModal(): void;
28
26
  };
27
+
28
+ // ---
29
+
30
+ bcfManagerDisplayed: boolean; // TODO: should be moved elsewhere
31
+
32
+ /** @deprecated use `plugins` Map instead */
33
+ getPlugins(name: string): PluginInstance[];
29
34
  }
30
35
 
31
36
  type GlobalContextEvents = {
32
- "plan-model-loaded": {
33
- model: ApiModel;
34
- plugin: ViewerDwg.Plugin;
35
- };
36
- "plan-model-unloaded": {
37
- model: ApiModel;
38
- plugin: ViewerDwg.Plugin;
39
- };
40
37
  "window-open": Window;
41
38
  "window-close": Window;
42
39
  };