@bimdata/viewer 2.0.0-beta.8 → 2.0.0-beta.80

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
@@ -5,18 +5,19 @@ declare module "@bimdata/viewer" {
5
5
  declare namespace BDV {
6
6
  interface Viewer {
7
7
  mount(container: HTMLElement | string, layout?: any): any;
8
+ destroy(): void;
8
9
  setAccessToken(token: string): void;
9
- setLocale(lang: ViewerLocales): void;
10
- registerPlugin(plugin: PluginConfig, cfg?: Object): void;
10
+ setLocale(lang: ViewerLocale): void;
11
+ registerPlugin(plugin: PluginDefinition, cfg?: Object): void;
11
12
  registerWindow(window: Object): void;
12
13
  unregisterWindow(name: string): void;
13
- loadModels(modelIds: number[]): StateModel[];
14
+ loadModels(modelIds: number[]): Promise<StateModel[]>;
14
15
 
15
16
  /** @deprecated use `loadModels` instead */
16
- loadIfcs(ifcIds: number[]): StateModel[];
17
+ loadIfcs(ifcIds: number[]): Promise<StateModel[]>;
17
18
  }
18
19
 
19
- enum ViewerLocales {
20
+ enum ViewerLocale {
20
21
  "de",
21
22
  "en",
22
23
  "es",
@@ -28,7 +29,7 @@ declare namespace BDV {
28
29
  ui?: ViewerConfigUI;
29
30
  api: ViewerConfigApi;
30
31
  plugins?: ViewerConfigPlugins;
31
- locale?: ViewerLocales;
32
+ locale?: ViewerLocale;
32
33
  }
33
34
 
34
35
  interface ViewerConfigUI {
@@ -57,23 +58,77 @@ declare namespace BDV {
57
58
  }
58
59
 
59
60
  interface ViewerConfigPlugins {
60
- // Conf
61
- addPlugins?: boolean;
62
- windowSelector?: boolean;
61
+ // --- General config ---
62
+ windowSelector?: boolean; // Enable/Disable window selector
63
63
 
64
- // IFC 3D Viewer
65
- viewer3d?:
64
+ // --- Native plugins config ---
65
+
66
+ alerts?: boolean;
67
+ bcf?:
66
68
  | boolean
67
69
  | {
68
- edges?: boolean;
69
- enableOffsets: boolean;
70
+ topicGuid?: string;
71
+ };
72
+ bcfManager?: boolean;
73
+ buildingMaker?: boolean;
74
+ dwg?:
75
+ | boolean
76
+ | {
77
+ help?: boolean;
78
+ modelLoader?: "hidden" | "disabled";
79
+ };
80
+ "dwg-layer"?: boolean;
81
+ dxf?:
82
+ | boolean
83
+ | {
84
+ help?: boolean;
85
+ modelLoader?: "hidden" | "disabled";
86
+ };
87
+ equipment2d?: boolean;
88
+ fullscreen?: boolean;
89
+ gauge2d?: boolean;
90
+ ged?: boolean;
91
+ header?: boolean;
92
+ measure2d?: boolean;
93
+ measure3d?: boolean;
94
+ navigationVersionsModel?: boolean;
95
+ pdf?: boolean;
96
+ pdfAnnotations?: boolean;
97
+ pdfExport?: boolean;
98
+ plan?:
99
+ | boolean
100
+ | {
101
+ help?: boolean;
102
+ modelLoader?: "hidden" | "disabled";
103
+ };
104
+ pointCloud?:
105
+ | boolean
106
+ | {
107
+ help?: boolean;
108
+ modelLoader?: "hidden" | "disabled";
70
109
  navCube?: boolean;
71
110
  pivotMarker?: boolean;
72
111
  };
112
+ pointCloudParameters?: boolean;
73
113
  projection?: boolean;
114
+ properties?:
115
+ | boolean
116
+ | {
117
+ editProperties?: boolean;
118
+ };
119
+ "right-angled"?: boolean;
74
120
  search?: boolean;
75
121
  section?: boolean;
122
+ smartview?: boolean;
76
123
  split?: boolean;
124
+ structure?:
125
+ | boolean
126
+ | {
127
+ merge?: boolean;
128
+ export?: boolean;
129
+ translateIfcEntities?: boolean;
130
+ customTranslations?: Object;
131
+ };
77
132
  "structure-properties"?:
78
133
  | boolean
79
134
  | {
@@ -83,63 +138,32 @@ declare namespace BDV {
83
138
  translateIfcEntities?: boolean;
84
139
  customTranslations?: Object;
85
140
  };
86
- "viewer3d-parameters"?: boolean;
87
-
88
- // IFC 2D Viewer
89
- viewer2d?: boolean;
90
- equipment2d?: boolean;
91
- gauge2d?: boolean;
92
141
  switch?: boolean;
142
+ synchronization?: boolean;
143
+ viewer2d?:
144
+ | boolean
145
+ | {
146
+ help?: boolean;
147
+ modelLoader?: "hidden" | "disabled";
148
+ };
93
149
  "viewer2d-background"?: boolean;
94
150
  "viewer2d-drawer"?: boolean;
95
151
  "viewer2d-parameters"?: boolean;
96
152
  "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?:
153
+ viewer3d?:
109
154
  | boolean
110
155
  | {
156
+ edges?: boolean;
157
+ enableDynamicLOD?: boolean;
158
+ enableOffsets: boolean;
159
+ home?: boolean;
160
+ help?: boolean;
161
+ modelLoader?: "hidden" | "disabled";
111
162
  navCube?: boolean;
163
+ navigationVersionsModel?: boolean;
164
+ pivotMarker?: boolean;
112
165
  };
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
- };
166
+ "viewer3d-parameters"?: boolean;
143
167
  "window-split"?: boolean;
144
168
  }
145
169
  }
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.8",
4
+ "version": "2.0.0-beta.80",
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.1.0",
55
+ "@bimdata/building-maker": "3.0.3",
56
+ "@bimdata/components": "1.3.1",
57
+ "@bimdata/design-system": "2.1.0-rc.9",
58
+ "@bimdata/typescript-fetch-api-client": "9.16.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
4
  readonly apiUrl: string;
6
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,25 @@ 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;
90
95
  tokenScopes: {
91
- bcf?: string[],
92
- model?: string[],
93
- document?: string[],
94
- }
96
+ bcf?: string[];
97
+ model?: string[];
98
+ document?: string[];
99
+ };
95
100
  usableScopes: {
96
- bcf?: string[],
97
- model?: string[],
98
- document?: string[],
99
- }
101
+ bcf?: string[];
102
+ model?: string[];
103
+ document?: string[];
104
+ };
100
105
  }
101
106
  }
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
  };