@bimdata/viewer 2.0.0-beta.99 → 2.0.0

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
@@ -63,7 +63,6 @@ declare namespace BDV {
63
63
  offline?: {
64
64
  enabled: boolean;
65
65
  dataFile: string;
66
- fallbackToNetwork?: boolean;
67
66
  };
68
67
 
69
68
  /** @deprecated use `modelIds` instead */
@@ -84,6 +83,7 @@ declare namespace BDV {
84
83
  };
85
84
  bcfManager?: boolean;
86
85
  buildingMaker?: boolean;
86
+ "drawing-tools"?: boolean;
87
87
  dwg?:
88
88
  | boolean
89
89
  | {
@@ -97,22 +97,21 @@ declare namespace BDV {
97
97
  help?: boolean;
98
98
  modelLoader?: "hidden" | "disabled";
99
99
  };
100
- equipment2d?: boolean;
101
100
  fullscreen?: boolean;
102
- gauge2d?: boolean;
103
101
  ged?: boolean;
104
102
  header?: boolean;
105
103
  measure2d?: boolean;
106
104
  measure3d?: boolean;
107
105
  navigationVersionsModel?: boolean;
108
106
  pdf?: boolean;
109
- pdfAnnotations?: boolean;
110
107
  pdfExport?: boolean;
111
108
  plan?:
112
109
  | boolean
113
110
  | {
114
111
  help?: boolean;
115
112
  modelLoader?: "hidden" | "disabled";
113
+ storeySelector?: boolean;
114
+ storeySelectorAutoOpen?: boolean;
116
115
  };
117
116
  pointCloud?:
118
117
  | boolean
@@ -137,17 +136,17 @@ declare namespace BDV {
137
136
  structure?:
138
137
  | boolean
139
138
  | {
140
- merge?: boolean;
141
139
  export?: boolean;
140
+ merge?: boolean;
142
141
  translateIfcEntities?: boolean;
143
142
  customTranslations?: Object;
144
143
  };
145
144
  "structure-properties"?:
146
145
  | boolean
147
146
  | {
148
- merge?: boolean;
149
- export?: boolean;
150
147
  editProperties?: boolean;
148
+ export?: boolean;
149
+ merge?: boolean;
151
150
  translateIfcEntities?: boolean;
152
151
  customTranslations?: Object;
153
152
  };
@@ -159,9 +158,10 @@ declare namespace BDV {
159
158
  compass?: boolean;
160
159
  help?: boolean;
161
160
  modelLoader?: "hidden" | "disabled";
161
+ storeySelector?: boolean;
162
+ storeySelectorAutoOpen?: boolean;
162
163
  };
163
164
  "viewer2d-background"?: boolean;
164
- "viewer2d-drawer"?: boolean;
165
165
  "viewer2d-parameters"?: boolean;
166
166
  "viewer2d-screenshot"?: boolean;
167
167
  viewer3d?:
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.99",
4
+ "version": "2.0.0",
5
5
  "description": "A customizable BIM viewer.",
6
6
  "keywords": [
7
7
  "bim",
@@ -23,7 +23,8 @@
23
23
  "main": "dist/bimdata-viewer.esm.min.js",
24
24
  "module": "dist/bimdata-viewer.esm.min.js",
25
25
  "scripts": {
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",
26
+ "build": "vite build && esbuild dist/bimdata-viewer.esm.min.js --minify --outfile=dist/bimdata-viewer.esm.min.js --allow-overwrite",
27
+ "build:split": "vite build -c vite.config.split.js && esbuild dist/bimdata-viewer-split.esm.min.js --minify --outfile=dist/bimdata-viewer-split.esm.min.js --allow-overwrite",
27
28
  "cy:run": "cypress run",
28
29
  "cy:open": "cypress open",
29
30
  "dev": "vite",
@@ -48,62 +49,62 @@
48
49
  "index.d.ts"
49
50
  ],
50
51
  "devDependencies": {
51
- "@babel/preset-env": "^7.22.20",
52
+ "@babel/preset-env": "^7.24.0",
52
53
  "@bimdata/2d-engine": "2.4.0",
53
- "@bimdata/areas-next": "0.1.13",
54
- "@bimdata/bcf-components": "6.2.0",
54
+ "@bimdata/areas-next": "0.1.15",
55
+ "@bimdata/bcf-components": "6.2.1",
55
56
  "@bimdata/building-maker": "3.0.3",
56
- "@bimdata/components": "1.3.1",
57
- "@bimdata/design-system": "2.1.0-rc.12",
58
- "@bimdata/typescript-fetch-api-client": "9.20.1",
59
- "@rollup/plugin-alias": "5.0.0",
60
- "@rollup/plugin-babel": "^6.0.3",
61
- "@rollup/plugin-commonjs": "^25.0.4",
62
- "@rollup/plugin-image": "^3.0.2",
63
- "@rollup/plugin-replace": "^5.0.2",
57
+ "@bimdata/components": "1.3.2",
58
+ "@bimdata/design-system": "2.1.0-rc.14",
59
+ "@bimdata/typescript-fetch-api-client": "10.0.0",
60
+ "@rollup/plugin-alias": "5.1.0",
61
+ "@rollup/plugin-babel": "^6.0.4",
62
+ "@rollup/plugin-commonjs": "^25.0.7",
63
+ "@rollup/plugin-image": "^3.0.3",
64
+ "@rollup/plugin-replace": "^5.0.5",
64
65
  "@semantic-release/changelog": "^6.0.3",
65
- "@semantic-release/commit-analyzer": "^11.0.0",
66
+ "@semantic-release/commit-analyzer": "^11.1.0",
66
67
  "@semantic-release/git": "^10.0.1",
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",
68
+ "@semantic-release/github": "^9.2.6",
69
+ "@semantic-release/npm": "^11.0.3",
70
+ "@semantic-release/release-notes-generator": "^12.1.0",
71
+ "@vitejs/plugin-vue": "4.6.2",
71
72
  "@vue/vue3-jest": "29.2.6",
72
73
  "@xeokit/xeokit-sdk": "git+https://git@github.com/Amoki/xeokit-sdk.git#369bb4876e529995cd4c192bc7fda5e957f9634f",
73
- "@zip.js/zip.js": "^2.7.32",
74
- "async": "^3.2.4",
75
- "autoprefixer": "^10.4.16",
74
+ "@zip.js/zip.js": "^2.7.37",
75
+ "async": "^3.2.5",
76
+ "autoprefixer": "^10.4.18",
76
77
  "babel-core": "^7.0.0-bridge.0",
77
78
  "babel-jest": "^29.7.0",
78
79
  "conventional-changelog-eslint": "^5.0.0",
79
- "cypress": "13.3.0",
80
- "eslint": "^8.50.0",
81
- "eslint-config-prettier": "^9.0.0",
80
+ "cypress": "13.6.6",
81
+ "esbuild": "^0.20.1",
82
+ "eslint": "^8.57.0",
83
+ "eslint-config-prettier": "^9.1.0",
82
84
  "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
+ "eslint-plugin-jest": "^27.9.0",
86
+ "eslint-plugin-prettier": "^5.1.3",
87
+ "eslint-plugin-vue": "^9.22.0",
86
88
  "form-data": "^4.0.0",
87
89
  "html2canvas": "1.4.1",
88
90
  "http-server": "^14.1.1",
89
91
  "jest": "^29.7.0",
90
92
  "jest-environment-jsdom": "^29.7.0",
91
- "jest-extended": "^4.0.1",
93
+ "jest-extended": "^4.0.2",
92
94
  "jspdf": "^2.5.1",
93
95
  "lodash": "^4.17.21",
94
96
  "node-fetch": "^3.3.2",
95
- "postcss": "^8.4.31",
96
- "prettier": "^3.0.3",
97
+ "postcss": "^8.4.35",
98
+ "prettier": "^3.2.5",
97
99
  "querystring": "^0.2.0",
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.3.4",
106
- "vue-eslint-parser": "^9.3.1",
107
- "vue-i18n": "^9.5.0"
100
+ "sass": "^1.71.1",
101
+ "semantic-release": "^22.0.12",
102
+ "sinon": "^16.1.3",
103
+ "start-server-and-test": "2.0.3",
104
+ "vite": "4.5.2",
105
+ "vite-plugin-css-injected-by-js": "3.4.0",
106
+ "vue": "3.4.21",
107
+ "vue-eslint-parser": "^9.4.2",
108
+ "vue-i18n": "^9.10.1"
108
109
  }
109
110
  }
package/types/api.d.ts CHANGED
@@ -94,6 +94,8 @@ declare namespace BDV {
94
94
  }
95
95
 
96
96
  interface Permissions {
97
+ hasReadPermission: boolean;
98
+ hasWritePermission: boolean;
97
99
  hasAdminPermission: boolean;
98
100
  hasBcfReadPermission: boolean;
99
101
  hasBcfWritePermission: boolean;
@@ -101,8 +103,16 @@ declare namespace BDV {
101
103
  hasDocWritePermission: boolean;
102
104
  hasModelReadPermission: boolean;
103
105
  hasModelWritePermission: boolean;
104
- hasReadPermission: boolean;
105
- hasWritePermission: boolean;
106
+ tokenScopes: {
107
+ bcf?: string[];
108
+ document?: string[];
109
+ model?: string[];
110
+ };
111
+ usableScopes: {
112
+ bcf?: string[];
113
+ document?: string[];
114
+ model?: string[];
115
+ };
106
116
  userRole?: string;
107
117
  user?: {
108
118
  id: number;
@@ -115,15 +125,5 @@ declare namespace BDV {
115
125
  sub: string;
116
126
  profile_picture: string;
117
127
  };
118
- tokenScopes: {
119
- bcf?: string[];
120
- model?: string[];
121
- document?: string[];
122
- };
123
- usableScopes: {
124
- bcf?: string[];
125
- model?: string[];
126
- document?: string[];
127
- };
128
128
  }
129
129
  }
package/types/state.d.ts CHANGED
@@ -244,25 +244,20 @@ declare namespace BDV {
244
244
  selected: boolean;
245
245
  }
246
246
 
247
- interface StatePlan extends ApiPlan {
248
- plan?: ApiPlan;
247
+ interface StatePlan extends StatePositionning {
249
248
  model: StateModel;
250
249
  storey: StateStorey;
251
- positioning: StatePositionning;
252
-
253
- key: string;
254
250
  index: number;
255
- loading: boolean;
256
- editing: boolean;
257
- selected: boolean;
251
+ key: string;
258
252
  }
259
253
 
260
254
  interface StatePositionning {
261
- x: number;
262
- y: number;
263
- angle: number;
255
+ translation_x: number;
256
+ translation_y: number;
257
+ rotate_z: number;
264
258
  scale: number;
265
259
  opacity: number;
260
+ plan?: ApiPlan;
266
261
  }
267
262
 
268
263
  interface StateAnnotation {
@@ -1,28 +0,0 @@
1
- declare namespace BDV {
2
- interface $Viewer {
3
- cfg: ViewerConfig;
4
- i18n: i18n;
5
- readonly api: Api;
6
- readonly state: State;
7
- readonly pluginsCfg: ViewerConfigPlugins;
8
- readonly registeredPlugins: string[];
9
- readonly registeredWindows: string[];
10
-
11
- readonly globalContext: GlobalContext;
12
- readonly localContext: LocalContext;
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;
27
- }
28
- }
package/types/events.d.ts DELETED
@@ -1,25 +0,0 @@
1
- type Events = {
2
- [eventName: string]: Object;
3
- };
4
-
5
- type SubscriptionId = number;
6
-
7
- interface EventOptions {
8
- getLastEvent?: boolean;
9
- }
10
-
11
- interface EventHandler<T extends Events> {
12
- on<N extends keyof T>(
13
- eventName: N,
14
- callback: (arg: T[N]) => void,
15
- options?: EventOptions
16
- ): SubscriptionId;
17
- once<N extends keyof T>(
18
- eventName: N,
19
- callback: (arg: T[N]) => void,
20
- options?: EventOptions
21
- ): SubscriptionId;
22
- off(subId: SubscriptionId): void;
23
- emit<N extends keyof T>(eventName: N, payload: T[N]): void;
24
- clear(): void;
25
- }
@@ -1,40 +0,0 @@
1
- declare namespace BDV {
2
- interface GlobalContext {
3
- hub: EventHandler<GlobalContextEvents & LocalContextEvents>;
4
- layout: any;
5
- readonly el: HTMLElement;
6
- readonly plugins: Map<string, PluginInstance[]>;
7
-
8
- activeLocalContext?: LocalContext;
9
- readonly localContexts: LocalContext[];
10
- getLocalContexts(window: string): LocalContext[];
11
- getViewers(): ModelViewerInstance[];
12
-
13
- // ---
14
-
15
- registerShortcut(shortcut: Shortcut, context: GlobalContext | LocalContext): boolean;
16
- unregisterShortcut(name: string, context: GlobalContext | LocalContext): boolean;
17
-
18
- readonly loading: boolean;
19
- loadingProcessStart(): void;
20
- loadingProcessEnd(): void;
21
- setSpinner(spinner: any): void;
22
-
23
- modals: {
24
- pushModal(component: any, props?: any, options?: any): void;
25
- clearModal(): void;
26
- };
27
-
28
- // ---
29
-
30
- bcfManagerDisplayed: boolean; // TODO: should be moved elsewhere
31
-
32
- /** @deprecated use `plugins` Map instead */
33
- getPlugins(name: string): PluginInstance[];
34
- }
35
-
36
- type GlobalContextEvents = {
37
- "window-open": Window;
38
- "window-close": Window;
39
- };
40
- }
@@ -1,162 +0,0 @@
1
- declare namespace BDV {
2
- interface LocalContext {
3
- hub: EventHandler<LocalContextEvents>;
4
-
5
- id: number;
6
- readonly el: Element;
7
- readonly x: number;
8
- readonly y: number;
9
- readonly width: number;
10
- readonly height: number;
11
- resolution: number;
12
-
13
- // Local state
14
- readonly multiModel: boolean;
15
- readonly modelTypes?: string[];
16
- readonly loadedModels: StateModel[];
17
- readonly loadedModelIds: number[];
18
- readonly loadingModelIds: number[];
19
- readonly currentStorey: StateStorey | null;
20
- loadModels(ids: number[]): Promise<boolean>;
21
- unloadModels(ids: number[]): boolean;
22
- toggleModel(id: number): Promise<boolean>;
23
- selectStorey(storey: StateStorey): void;
24
- showPlan(plan: StatePlan): void;
25
- hidePlan(plan: StatePlan): void;
26
- togglePlanVisibility(plan: StatePlan): void;
27
- togglePlanEdition(plan: StatePlan): void;
28
- createPlan(model: StateModel, storey: StateStorey, document: ApiDocument, positioning: StatePositionning): Promise<StatePlan>;
29
- updatePlan(plan: StatePlan, positioning: StatePositionning): Promise<StatePlan>;
30
- deletePlan(plan: StatePlan): Promise<void>;
31
-
32
- // Viewer
33
- readonly viewer: ModelViewerInstance | null;
34
- readonly annotationMode: boolean;
35
- getViewpoint: (options?: any) => any | Promise<any>;
36
- setViewpoint: (viewpoint: any, options?: any) => void | Promise<void>;
37
- startAnnotationMode: (callback: Function) => void;
38
- stopAnnotationMode: () => void;
39
- fitView: (options?: any) => void;
40
- showUI: (options?: any) => void;
41
- hideUI: (options?: { exceptions: string[] }) => Promise<void>;
42
-
43
- // Window
44
- readonly window: Window;
45
- loadWindow(windowName: string): void;
46
-
47
- // Plugins
48
- readonly plugins: Map<string, PluginInstance>;
49
- readonly _plugins: PluginInstance[];
50
- setPlugins(names: string[]): void;
51
-
52
- // Shortcuts
53
- registerShortcut(shortcut: Shortcut): boolean;
54
- unregisterShortcut(name: string): boolean;
55
-
56
- // Loading
57
- readonly loading: boolean;
58
- loadingProcessStart(): void;
59
- loadingProcessEnd(): void;
60
-
61
- // Modals
62
- readonly modals: {
63
- pushModal(component: Object, props?: Object, options?: Object): void;
64
- clearModal(): void;
65
- };
66
-
67
- // ---
68
-
69
- /** @deprecated use `plugins` Map instead */
70
- getPlugin(name: string): PluginInstance;
71
- /** @deprecated use `loadingProcessStart` instead */
72
- incrementSpinnerProcesses(): void;
73
- /** @deprecated use `loadingProcessEnd` instead */
74
- decrementSpinnerProcesses(): void;
75
- }
76
-
77
- type LocalContextEvents = {
78
- "alert": { type: string; message: string };
79
- "context-resize": { width: number; height: number };
80
- "plugin-created": { name: string; plugin: PluginInstance; };
81
- "plugin-destroyed": { name: string; plugin: PluginInstance; };
82
- "plugin-menu-open": { name: string; plugin: PluginInstance; };
83
- "plugin-menu-close": { name: string; plugin: PluginInstance; };
84
-
85
- "models-loaded": { models: StateModel[] };
86
- "models-unloaded": { models: StateModel[] };
87
- "models-loading": { ids: number[] };
88
- "storey-selected": { storey: StateStorey };
89
- "plan-shown": { plan: StatePlan };
90
- "plan-hidden": { plan: StatePlan };
91
- "plan-editing": { plan: StatePlan | null };
92
- "plan-created": { plan: StatePlan };
93
- "plan-updated": { plan: StatePlan };
94
- "plan-deleted": { plan: StatePlan };
95
-
96
- "3d-model-loaded": {
97
- model: StateModel;
98
- plugin: ViewerIfc3D.Instance;
99
- /** @deprecated use `model` instead */
100
- ifc: StateModel;
101
- };
102
- "3d-model-unloaded": {
103
- model: StateModel;
104
- plugin: ViewerIfc3D.Instance;
105
- /** @deprecated use `model` instead */
106
- ifc: StateModel;
107
- };
108
- "2d-model-loaded": {
109
- model: StateModel;
110
- plugin: ViewerIfc2D.Instance;
111
- /** @deprecated use `model` instead */
112
- ifc: StateModel;
113
- };
114
- "2d-model-unloaded": {
115
- model: StateModel;
116
- plugin: ViewerIfc2D.Instance;
117
- /** @deprecated use `model` instead */
118
- ifc: StateModel;
119
- };
120
- "dwg-model-loaded": {
121
- type: "svg" | "binary";
122
- dwg: Document | ArrayBuffer;
123
- model: StateModel;
124
- plugin: ViewerDwg.Instance;
125
- };
126
- "dwg-model-unloaded": {
127
- model: StateModel;
128
- plugin: ViewerDwg.Instance;
129
- };
130
- "dxf-model-loaded": {
131
- type: "svg" | "binary";
132
- dxf: Document | ArrayBuffer;
133
- model: StateModel;
134
- plugin: ViewerDwg.Instance;
135
- };
136
- "dxf-model-unloaded": {
137
- model: StateModel;
138
- plugin: ViewerDwg.Instance;
139
- };
140
- "plan-model-loaded": {
141
- model: StateModel;
142
- plugin: ViewerPlan.Instance;
143
- };
144
- "plan-model-unloaded": {
145
- model: StateModel;
146
- plugin: ViewerPlan.Instance;
147
- };
148
- "pointcloud-model-loaded": {
149
- model: StateModel;
150
- plugin: ViewerPointCloud.Instance;
151
- };
152
- "pointcloud-model-unloaded": {
153
- model: StateModel;
154
- plugin: ViewerPointCloud.Instance;
155
- };
156
-
157
- "pdf-page-changed": {
158
- model: StateModel;
159
- page: any;
160
- };
161
- };
162
- }
@@ -1,81 +0,0 @@
1
- declare namespace BDV {
2
- interface PluginDefinition {
3
- name: string;
4
- isViewer?: boolean;
5
- i18n?: Object;
6
- addToWindows?: string[];
7
- component?: any;
8
- window?: Window;
9
- button?: {
10
- position: string;
11
- stance?: number;
12
- tooltip: string;
13
- content: "free" | "simple" | "panel" | "none";
14
- keepOpen?: boolean;
15
- overlapWith?: string[];
16
- icon?: {
17
- imgUri?: string;
18
- component?: any;
19
- options?: { props: Object; };
20
- };
21
- };
22
- startupScript?: ($viewer: $Viewer) => void;
23
-
24
- // Appended properties
25
- id?: number;
26
- componentInstance?: PluginInstance;
27
- shown?: boolean;
28
- }
29
-
30
- interface PluginInstance {
31
- name: string;
32
- plugin: PluginDefinition;
33
- $cfg: any;
34
- $viewer: $Viewer;
35
- $show(): void;
36
- $hide(): void;
37
- $open?: () => void;
38
- onOpen?: () => void;
39
- $close?: () => void;
40
- onClose?: () => void;
41
- }
42
-
43
- interface ModelViewerConfig {
44
- modelLoader?: "hidden" | "disabled";
45
- }
46
-
47
- interface ModelViewerInstance extends PluginInstance {
48
- viewer?: any;
49
- modelTypes?: string[];
50
- annotationMode: boolean;
51
-
52
- getLoadedModels: () => StateModel[];
53
- loadModels: (models: StateModel[]) => Promise<void>;
54
- unloadModels: (models: StateModel[]) => Promise<void>;
55
- getViewpoint: (options?: any) => any | Promise<any>;
56
- setViewpoint: (viewpoint: any, options?: any) => void | Promise<void>;
57
- startAnnotationMode: (callback: AnnotationCallback) => void;
58
- stopAnnotationMode: () => void;
59
- fitView: (options?: any) => void;
60
- showUI: (options?: any) => void;
61
- hideUI: (options?: { exceptions: string[] }) => Promise<void>;
62
- }
63
-
64
- interface PluginManager {
65
- cfg: ViewerConfigPlugins;
66
- readonly registeredPlugins: Map<string, PluginDefinition>;
67
- readonly pluginsUnits: PluginsUnit[];
68
-
69
- getPluginCopy(name: string, silent?: boolean): PluginDefinition;
70
- registerPlugin(plugin: PluginDefinition): void;
71
- registerPluginsTranslations(i18nPlugin: any): void;
72
- runPluginsScripts($viewer: $Viewer): void;
73
- }
74
-
75
- interface PluginsUnit {
76
- localContext: LocalContext;
77
- }
78
-
79
- type AnnotationCallback = (params: AnnotationParams) => void;
80
- type AnnotationParams = { x: number, y: number, z: number, models: StateModel[], storey?: StateStorey, page?: number };
81
- }
@@ -1,17 +0,0 @@
1
- declare namespace BDV {
2
- interface Window {
3
- name: string;
4
- label: string;
5
- icon: { imgUri: string; };
6
- plugins?: string[];
7
- menu?: boolean;
8
- modelTypes?: string[];
9
- multiModel: boolean;
10
- }
11
-
12
- interface WindowManager {
13
- registeredWindows: Map<string, Window>;
14
- registerWindow(window: Window): Window;
15
- unregisterWindow(name: string): void;
16
- }
17
- }