@inweb/viewer-core 26.7.0 → 26.7.2
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/lib/loaders/ILoader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Assembly, File, Model } from "@inweb/client";
|
|
2
2
|
import type { IViewer } from "../viewer/IViewer";
|
|
3
3
|
/**
|
|
4
|
-
* Defines the file source to load:
|
|
4
|
+
* Defines the file source to load into the viewer:
|
|
5
5
|
*
|
|
6
6
|
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
7
7
|
* - File `URL` string
|
|
@@ -9,9 +9,8 @@ import type { IViewer } from "../viewer/IViewer";
|
|
|
9
9
|
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
|
|
10
10
|
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
11
11
|
* object
|
|
12
|
-
* - {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} instance
|
|
13
12
|
*/
|
|
14
|
-
export type FileSource = File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
13
|
+
export type FileSource = File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
15
14
|
/**
|
|
16
15
|
* Defines the file loading parameters (loader depended).
|
|
17
16
|
*/
|
package/lib/viewer/IViewer.d.ts
CHANGED
|
@@ -121,22 +121,13 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
121
121
|
* first availiable model will be loaded. If no models are found in the file, an exception will be
|
|
122
122
|
* thrown.
|
|
123
123
|
*
|
|
124
|
-
*
|
|
125
|
-
* a file format must be specified using `params.format` parameter (see below). If no appropriate
|
|
124
|
+
* For URLs, the file extension is used to determine the file format. For a `ArrayBuffer` and `Data
|
|
125
|
+
* URL`, a file format must be specified using `params.format` parameter (see below). If no appropriate
|
|
126
126
|
* loader is found for the specified format, an exception will be thrown.
|
|
127
127
|
*
|
|
128
128
|
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
129
129
|
* file, you must manually activate the required dragger.
|
|
130
130
|
*
|
|
131
|
-
* To open a large files, enable {@link IOptions.enablePartialMode | partial streaming} mode before
|
|
132
|
-
* opening. For example:
|
|
133
|
-
*
|
|
134
|
-
* ```javascript
|
|
135
|
-
* viewer.options.enableStreamingMode = true;
|
|
136
|
-
* viewer.options.enablePartialMode = true;
|
|
137
|
-
* await viewer.open(file);
|
|
138
|
-
* ```
|
|
139
|
-
*
|
|
140
131
|
* Fires:
|
|
141
132
|
*
|
|
142
133
|
* - {@link OpenEvent | open}
|
|
@@ -147,18 +138,36 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
147
138
|
* - {@link GeometryEndEvent | geometryend}
|
|
148
139
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
149
140
|
*
|
|
150
|
-
* @param file - File to load.
|
|
141
|
+
* @param file - File to load. Can be one of:
|
|
142
|
+
*
|
|
143
|
+
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
144
|
+
* - File `URL` string
|
|
145
|
+
* - {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string
|
|
146
|
+
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
|
|
147
|
+
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
148
|
+
* object
|
|
149
|
+
*
|
|
151
150
|
* @param params - Loading parameters.
|
|
152
|
-
* @param params.format - File format string. Required when loading a file as `ArrayBuffer
|
|
153
|
-
*
|
|
154
|
-
* @param params.mode - File opening mode. Can be one of:
|
|
151
|
+
* @param params.format - File format string. Required when loading a file as `ArrayBuffer` or `Data *
|
|
152
|
+
* URL`.
|
|
153
|
+
* @param params.mode - File opening mode. Viewer specific. Can be one of:
|
|
155
154
|
*
|
|
156
155
|
* - `open` - Unloads an open file and opens a new one. This is default mode.
|
|
157
156
|
* - `append` - Appends a file to an already open file. This mode is not supported for all formats.
|
|
157
|
+
*
|
|
158
|
+
* @param params.requestHeader - The
|
|
159
|
+
* {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP
|
|
160
|
+
* request.
|
|
161
|
+
* @param params.withCredentials - Whether the HTTP request uses credentials such as cookies,
|
|
162
|
+
* authorization headers or TLS client certificates. See
|
|
163
|
+
* {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}
|
|
164
|
+
* for mode details.
|
|
158
165
|
*/
|
|
159
166
|
open(file: FileSource, params: {
|
|
160
167
|
format?: string;
|
|
161
168
|
mode?: string;
|
|
169
|
+
requestHeader?: HeadersInit;
|
|
170
|
+
withCredentials?: boolean;
|
|
162
171
|
}): Promise<this>;
|
|
163
172
|
/**
|
|
164
173
|
* Cancels asynchronous file loading started with {@link open | open()}.
|
|
@@ -110,7 +110,7 @@ export interface DatabaseChunkEvent {
|
|
|
110
110
|
/**
|
|
111
111
|
* File to load.
|
|
112
112
|
*/
|
|
113
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
113
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
114
114
|
/**
|
|
115
115
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
116
116
|
*/
|
|
@@ -170,7 +170,7 @@ export interface GeometryChunkEvent {
|
|
|
170
170
|
/**
|
|
171
171
|
* File to load.
|
|
172
172
|
*/
|
|
173
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
173
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
174
174
|
/**
|
|
175
175
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
176
176
|
*/
|
|
@@ -195,7 +195,7 @@ export interface GeometryEndEvent {
|
|
|
195
195
|
/**
|
|
196
196
|
* File to load.
|
|
197
197
|
*/
|
|
198
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
198
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
199
199
|
/**
|
|
200
200
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
201
201
|
*/
|
|
@@ -224,7 +224,7 @@ export interface GeometryErrorEvent {
|
|
|
224
224
|
/**
|
|
225
225
|
* File to load.
|
|
226
226
|
*/
|
|
227
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
227
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
228
228
|
/**
|
|
229
229
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
230
230
|
*/
|
|
@@ -253,7 +253,7 @@ export interface GeometryProgressEvent {
|
|
|
253
253
|
/**
|
|
254
254
|
* File to load.
|
|
255
255
|
*/
|
|
256
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
256
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
257
257
|
/**
|
|
258
258
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
259
259
|
*/
|
|
@@ -278,7 +278,7 @@ export interface GeometryStartEvent {
|
|
|
278
278
|
/**
|
|
279
279
|
* File to load.
|
|
280
280
|
*/
|
|
281
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
281
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
282
282
|
/**
|
|
283
283
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
284
284
|
*/
|
|
@@ -361,7 +361,7 @@ export interface OpenEvent {
|
|
|
361
361
|
/**
|
|
362
362
|
* File to load.
|
|
363
363
|
*/
|
|
364
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
364
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
365
365
|
/**
|
|
366
366
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
367
367
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-core",
|
|
3
|
-
"version": "26.7.
|
|
3
|
+
"version": "26.7.2",
|
|
4
4
|
"description": "3D CAD and BIM data Viewer core",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "karma start karma.conf.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inweb/client": "~26.7.
|
|
30
|
-
"@inweb/eventemitter2": "~26.7.
|
|
29
|
+
"@inweb/client": "~26.7.2",
|
|
30
|
+
"@inweb/eventemitter2": "~26.7.2"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/loaders/ILoader.ts
CHANGED
|
@@ -25,7 +25,7 @@ import type { Assembly, File, Model } from "@inweb/client";
|
|
|
25
25
|
import type { IViewer } from "../viewer/IViewer";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Defines the file source to load:
|
|
28
|
+
* Defines the file source to load into the viewer:
|
|
29
29
|
*
|
|
30
30
|
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
31
31
|
* - File `URL` string
|
|
@@ -33,9 +33,8 @@ import type { IViewer } from "../viewer/IViewer";
|
|
|
33
33
|
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
|
|
34
34
|
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
35
35
|
* object
|
|
36
|
-
* - {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} instance
|
|
37
36
|
*/
|
|
38
|
-
export type FileSource = File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
37
|
+
export type FileSource = File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* Defines the file loading parameters (loader depended).
|
package/src/viewer/IViewer.ts
CHANGED
|
@@ -155,22 +155,13 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
155
155
|
* first availiable model will be loaded. If no models are found in the file, an exception will be
|
|
156
156
|
* thrown.
|
|
157
157
|
*
|
|
158
|
-
*
|
|
159
|
-
* a file format must be specified using `params.format` parameter (see below). If no appropriate
|
|
158
|
+
* For URLs, the file extension is used to determine the file format. For a `ArrayBuffer` and `Data
|
|
159
|
+
* URL`, a file format must be specified using `params.format` parameter (see below). If no appropriate
|
|
160
160
|
* loader is found for the specified format, an exception will be thrown.
|
|
161
161
|
*
|
|
162
162
|
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
163
163
|
* file, you must manually activate the required dragger.
|
|
164
164
|
*
|
|
165
|
-
* To open a large files, enable {@link IOptions.enablePartialMode | partial streaming} mode before
|
|
166
|
-
* opening. For example:
|
|
167
|
-
*
|
|
168
|
-
* ```javascript
|
|
169
|
-
* viewer.options.enableStreamingMode = true;
|
|
170
|
-
* viewer.options.enablePartialMode = true;
|
|
171
|
-
* await viewer.open(file);
|
|
172
|
-
* ```
|
|
173
|
-
*
|
|
174
165
|
* Fires:
|
|
175
166
|
*
|
|
176
167
|
* - {@link OpenEvent | open}
|
|
@@ -181,16 +172,40 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
181
172
|
* - {@link GeometryEndEvent | geometryend}
|
|
182
173
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
183
174
|
*
|
|
184
|
-
* @param file - File to load.
|
|
175
|
+
* @param file - File to load. Can be one of:
|
|
176
|
+
*
|
|
177
|
+
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
178
|
+
* - File `URL` string
|
|
179
|
+
* - {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string
|
|
180
|
+
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
|
|
181
|
+
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
182
|
+
* object
|
|
183
|
+
*
|
|
185
184
|
* @param params - Loading parameters.
|
|
186
|
-
* @param params.format - File format string. Required when loading a file as `ArrayBuffer
|
|
187
|
-
*
|
|
188
|
-
* @param params.mode - File opening mode. Can be one of:
|
|
185
|
+
* @param params.format - File format string. Required when loading a file as `ArrayBuffer` or `Data *
|
|
186
|
+
* URL`.
|
|
187
|
+
* @param params.mode - File opening mode. Viewer specific. Can be one of:
|
|
189
188
|
*
|
|
190
189
|
* - `open` - Unloads an open file and opens a new one. This is default mode.
|
|
191
190
|
* - `append` - Appends a file to an already open file. This mode is not supported for all formats.
|
|
191
|
+
*
|
|
192
|
+
* @param params.requestHeader - The
|
|
193
|
+
* {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP
|
|
194
|
+
* request.
|
|
195
|
+
* @param params.withCredentials - Whether the HTTP request uses credentials such as cookies,
|
|
196
|
+
* authorization headers or TLS client certificates. See
|
|
197
|
+
* {@link https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/withCredentials | XMLHttpRequest.withCredentials}
|
|
198
|
+
* for mode details.
|
|
192
199
|
*/
|
|
193
|
-
open(
|
|
200
|
+
open(
|
|
201
|
+
file: FileSource,
|
|
202
|
+
params: {
|
|
203
|
+
format?: string;
|
|
204
|
+
mode?: string;
|
|
205
|
+
requestHeader?: HeadersInit;
|
|
206
|
+
withCredentials?: boolean;
|
|
207
|
+
}
|
|
208
|
+
): Promise<this>;
|
|
194
209
|
|
|
195
210
|
/**
|
|
196
211
|
* Cancels asynchronous file loading started with {@link open | open()}.
|
|
@@ -120,7 +120,7 @@ export interface DatabaseChunkEvent {
|
|
|
120
120
|
/**
|
|
121
121
|
* File to load.
|
|
122
122
|
*/
|
|
123
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
123
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
@@ -188,7 +188,7 @@ export interface GeometryChunkEvent {
|
|
|
188
188
|
/**
|
|
189
189
|
* File to load.
|
|
190
190
|
*/
|
|
191
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
191
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
@@ -217,7 +217,7 @@ export interface GeometryEndEvent {
|
|
|
217
217
|
/**
|
|
218
218
|
* File to load.
|
|
219
219
|
*/
|
|
220
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
220
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
@@ -251,7 +251,7 @@ export interface GeometryErrorEvent {
|
|
|
251
251
|
/**
|
|
252
252
|
* File to load.
|
|
253
253
|
*/
|
|
254
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
254
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
257
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
@@ -285,7 +285,7 @@ export interface GeometryProgressEvent {
|
|
|
285
285
|
/**
|
|
286
286
|
* File to load.
|
|
287
287
|
*/
|
|
288
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
288
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
@@ -314,7 +314,7 @@ export interface GeometryStartEvent {
|
|
|
314
314
|
/**
|
|
315
315
|
* File to load.
|
|
316
316
|
*/
|
|
317
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
317
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
318
318
|
|
|
319
319
|
/**
|
|
320
320
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|
|
@@ -408,7 +408,7 @@ export interface OpenEvent {
|
|
|
408
408
|
/**
|
|
409
409
|
* File to load.
|
|
410
410
|
*/
|
|
411
|
-
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer
|
|
411
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
412
412
|
|
|
413
413
|
/**
|
|
414
414
|
* Model from file to load. Only defined when loading a file from the Open Cloud Server.
|