@shapediver/viewer.shared.services 2.7.10 → 2.8.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/dist/converter/Converter.d.ts +8 -6
- package/dist/converter/Converter.d.ts.map +1 -1
- package/dist/converter/Converter.js +63 -61
- package/dist/converter/Converter.js.map +1 -1
- package/dist/dom-event-engine/DomEventEngine.d.ts.map +1 -1
- package/dist/dom-event-engine/DomEventEngine.js +1 -2
- package/dist/dom-event-engine/DomEventEngine.js.map +1 -1
- package/dist/event-engine/EventEngine.d.ts +6 -4
- package/dist/event-engine/EventEngine.d.ts.map +1 -1
- package/dist/event-engine/EventEngine.js +24 -32
- package/dist/event-engine/EventEngine.js.map +1 -1
- package/dist/http-client/HttpClient.d.ts +4 -3
- package/dist/http-client/HttpClient.d.ts.map +1 -1
- package/dist/http-client/HttpClient.js +28 -41
- package/dist/http-client/HttpClient.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/input-validator/InputValidator.d.ts +4 -3
- package/dist/input-validator/InputValidator.d.ts.map +1 -1
- package/dist/input-validator/InputValidator.js +20 -20
- package/dist/input-validator/InputValidator.js.map +1 -1
- package/dist/logger/Logger.d.ts +11 -37
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.js +79 -235
- package/dist/logger/Logger.js.map +1 -1
- package/dist/logger/ShapeDiverViewerErrors.d.ts +5 -0
- package/dist/logger/ShapeDiverViewerErrors.d.ts.map +1 -1
- package/dist/logger/ShapeDiverViewerErrors.js +9 -1
- package/dist/logger/ShapeDiverViewerErrors.js.map +1 -1
- package/dist/performance-evaluator/PerformanceEvaluator.d.ts +16 -14
- package/dist/performance-evaluator/PerformanceEvaluator.d.ts.map +1 -1
- package/dist/performance-evaluator/PerformanceEvaluator.js +37 -40
- package/dist/performance-evaluator/PerformanceEvaluator.js.map +1 -1
- package/dist/settings-engine/SettingsEngine.d.ts.map +1 -1
- package/dist/settings-engine/SettingsEngine.js +3 -5
- package/dist/settings-engine/SettingsEngine.js.map +1 -1
- package/dist/state-engine/StateEngine.d.ts +11 -11
- package/dist/state-engine/StateEngine.d.ts.map +1 -1
- package/dist/state-engine/StateEngine.js +15 -26
- package/dist/state-engine/StateEngine.js.map +1 -1
- package/dist/system-info/SystemInfo.d.ts +21 -19
- package/dist/system-info/SystemInfo.d.ts.map +1 -1
- package/dist/system-info/SystemInfo.js +45 -61
- package/dist/system-info/SystemInfo.js.map +1 -1
- package/dist/type-check/TypeChecker.d.ts +3 -1
- package/dist/type-check/TypeChecker.d.ts.map +1 -1
- package/dist/type-check/TypeChecker.js +11 -14
- package/dist/type-check/TypeChecker.js.map +1 -1
- package/dist/uuid-generator/UuidGenerator.d.ts +8 -6
- package/dist/uuid-generator/UuidGenerator.d.ts.map +1 -1
- package/dist/uuid-generator/UuidGenerator.js +17 -24
- package/dist/uuid-generator/UuidGenerator.js.map +1 -1
- package/package.json +5 -8
- package/src/converter/Converter.ts +67 -47
- package/src/dom-event-engine/DomEventEngine.ts +1 -2
- package/src/event-engine/EventEngine.ts +34 -22
- package/src/http-client/HttpClient.ts +35 -32
- package/src/index.ts +4 -3
- package/src/input-validator/InputValidator.ts +29 -11
- package/src/logger/Logger.ts +60 -183
- package/src/logger/ShapeDiverViewerErrors.ts +9 -0
- package/src/performance-evaluator/PerformanceEvaluator.ts +45 -31
- package/src/settings-engine/SettingsEngine.ts +4 -6
- package/src/state-engine/StateEngine.ts +32 -30
- package/src/system-info/SystemInfo.ts +66 -47
- package/src/type-check/TypeChecker.ts +19 -5
- package/src/uuid-generator/UuidGenerator.ts +30 -14
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { singleton } from 'tsyringe'
|
|
2
1
|
import UAParser from 'ua-parser-js';
|
|
3
2
|
|
|
4
|
-
@singleton()
|
|
5
3
|
export class SystemInfo {
|
|
4
|
+
// #region Properties (5)
|
|
6
5
|
|
|
7
6
|
private readonly _isBrowser: boolean;
|
|
8
7
|
private readonly _isIframe: boolean;
|
|
9
8
|
private readonly _origin: string;
|
|
10
9
|
private readonly _parser: UAParser;
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
private static _instance: SystemInfo;
|
|
12
|
+
|
|
13
|
+
// #endregion Properties (5)
|
|
14
|
+
|
|
15
|
+
// #region Constructors (1)
|
|
16
|
+
|
|
17
|
+
private constructor() {
|
|
13
18
|
this._parser = new UAParser();
|
|
14
19
|
const isInternetExplorer = typeof window !== 'undefined' && window.navigator && window.navigator.userAgent.indexOf('Trident') > -1;
|
|
15
20
|
this._isBrowser = isInternetExplorer ||
|
|
@@ -29,22 +34,17 @@ export class SystemInfo {
|
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
* Check if we are on a Mac OS device
|
|
34
|
-
*/
|
|
35
|
-
public get isMacOS(): boolean {
|
|
36
|
-
const osName = this._parser.getOS().name;
|
|
37
|
-
return osName === 'Mac OS';
|
|
38
|
-
};
|
|
37
|
+
// #endregion Constructors (1)
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
// #region Public Static Accessors (1)
|
|
40
|
+
|
|
41
|
+
public static get instance() {
|
|
42
|
+
return this._instance || (this._instance = new this());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// #endregion Public Static Accessors (1)
|
|
46
|
+
|
|
47
|
+
// #region Public Accessors (11)
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Check if we are on an Android device
|
|
@@ -52,23 +52,14 @@ export class SystemInfo {
|
|
|
52
52
|
public get isAndroid(): boolean {
|
|
53
53
|
const osName = this._parser.getOS().name;
|
|
54
54
|
return osName === 'Android';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Check if we are on a mobile device
|
|
59
|
-
*/
|
|
60
|
-
public get isMobile(): boolean {
|
|
61
|
-
const type = this._parser.getDevice().type;
|
|
62
|
-
return type === 'mobile' || type === 'tablet';
|
|
63
|
-
};
|
|
55
|
+
}
|
|
64
56
|
|
|
65
57
|
/**
|
|
66
|
-
* Check if we are running in
|
|
58
|
+
* Check if we are running in a browser
|
|
67
59
|
*/
|
|
68
|
-
public get
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
60
|
+
public get isBrowser(): boolean {
|
|
61
|
+
return this._isBrowser;
|
|
62
|
+
}
|
|
72
63
|
|
|
73
64
|
/**
|
|
74
65
|
* Check if we are running in Safari
|
|
@@ -76,42 +67,70 @@ export class SystemInfo {
|
|
|
76
67
|
public get isChrome(): boolean {
|
|
77
68
|
const browserName = this._parser.getBrowser().name;
|
|
78
69
|
return !!(browserName && browserName.includes('Chrome'));
|
|
79
|
-
}
|
|
70
|
+
}
|
|
80
71
|
|
|
81
72
|
/**
|
|
82
|
-
* Check if we are running in
|
|
73
|
+
* Check if we are running in Firefox
|
|
83
74
|
*/
|
|
84
|
-
public get
|
|
75
|
+
public get isFirefox(): boolean {
|
|
85
76
|
const browserName = this._parser.getBrowser().name;
|
|
86
|
-
return !!(browserName && browserName.includes('
|
|
87
|
-
}
|
|
77
|
+
return !!(browserName && browserName.includes('Firefox'));
|
|
78
|
+
}
|
|
88
79
|
|
|
89
80
|
/**
|
|
90
|
-
* Check if we are running in
|
|
81
|
+
* Check if we are running in internet explorer (arrrggghhhh!!!!)
|
|
91
82
|
*/
|
|
92
|
-
public get
|
|
83
|
+
public get isIE(): boolean {
|
|
93
84
|
const browserName = this._parser.getBrowser().name;
|
|
94
|
-
return !!(browserName && browserName.includes('
|
|
95
|
-
}
|
|
85
|
+
return !!(browserName && browserName.includes('IE'));
|
|
86
|
+
}
|
|
96
87
|
|
|
97
88
|
/**
|
|
98
|
-
* Check if we are
|
|
89
|
+
* Check if we are on an IOS device
|
|
99
90
|
*/
|
|
100
|
-
public get
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
public get isIOS(): boolean {
|
|
92
|
+
const osName = this._parser.getOS().name;
|
|
93
|
+
return osName === 'iOS' ||
|
|
94
|
+
(window.navigator && window.navigator.maxTouchPoints === 5 && window.navigator.platform === 'MacIntel');
|
|
95
|
+
}
|
|
103
96
|
|
|
104
97
|
/**
|
|
105
98
|
* Check if we are running in an iframe
|
|
106
99
|
*/
|
|
107
100
|
public get isIframe(): boolean {
|
|
108
101
|
return this._isIframe;
|
|
109
|
-
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check if we are on a Mac OS device
|
|
106
|
+
*/
|
|
107
|
+
public get isMacOS(): boolean {
|
|
108
|
+
const osName = this._parser.getOS().name;
|
|
109
|
+
return osName === 'Mac OS';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Check if we are on a mobile device
|
|
114
|
+
*/
|
|
115
|
+
public get isMobile(): boolean {
|
|
116
|
+
const type = this._parser.getDevice().type;
|
|
117
|
+
return type === 'mobile' || type === 'tablet';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Check if we are running in Safari
|
|
122
|
+
*/
|
|
123
|
+
public get isSafari(): boolean {
|
|
124
|
+
const browserName = this._parser.getBrowser().name;
|
|
125
|
+
return !!(browserName && browserName.includes('Safari'));
|
|
126
|
+
}
|
|
110
127
|
|
|
111
128
|
/**
|
|
112
129
|
* Get guessed origin of embedding website
|
|
113
130
|
*/
|
|
114
131
|
public get origin(): string {
|
|
115
132
|
return this._origin + '';
|
|
116
|
-
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// #endregion Public Accessors (11)
|
|
117
136
|
}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { singleton } from 'tsyringe'
|
|
2
|
-
|
|
3
|
-
@singleton()
|
|
4
1
|
export class TypeChecker {
|
|
2
|
+
// #region Properties (1)
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
private static _instance: TypeChecker;
|
|
5
|
+
|
|
6
|
+
// #endregion Properties (1)
|
|
7
|
+
|
|
8
|
+
// #region Public Static Accessors (1)
|
|
9
|
+
|
|
10
|
+
public static get instance() {
|
|
11
|
+
return this._instance || (this._instance = new this());
|
|
8
12
|
}
|
|
9
13
|
|
|
14
|
+
// #endregion Public Static Accessors (1)
|
|
15
|
+
|
|
16
|
+
// #region Public Methods (2)
|
|
17
|
+
|
|
10
18
|
public isHTMLCanvasElement(value: any): boolean {
|
|
11
19
|
return value instanceof HTMLCanvasElement;
|
|
12
20
|
}
|
|
21
|
+
|
|
22
|
+
public isTypeOf(value: any, type: string): boolean {
|
|
23
|
+
return typeof value === type;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// #endregion Public Methods (2)
|
|
13
27
|
}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import { singleton } from 'tsyringe'
|
|
2
1
|
import { parse as parseUUID, stringify as stringifyUUID, v4, validate as validateUUID } from 'uuid'
|
|
3
2
|
|
|
4
|
-
@singleton()
|
|
5
3
|
export class UuidGenerator {
|
|
4
|
+
// #region Properties (1)
|
|
5
|
+
|
|
6
|
+
private static _instance: UuidGenerator;
|
|
7
|
+
|
|
8
|
+
// #endregion Properties (1)
|
|
9
|
+
|
|
10
|
+
// #region Public Static Accessors (1)
|
|
11
|
+
|
|
12
|
+
public static get instance() {
|
|
13
|
+
return this._instance || (this._instance = new this());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// #endregion Public Static Accessors (1)
|
|
17
|
+
|
|
18
|
+
// #region Public Methods (4)
|
|
19
|
+
|
|
6
20
|
/**
|
|
7
21
|
* Creates a new uuid v4.
|
|
8
22
|
*/
|
|
9
23
|
public create(): string {
|
|
10
24
|
return v4();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Checks if the provided string is a valid uuid.
|
|
15
|
-
*
|
|
16
|
-
* @param uuid the uuid to check
|
|
17
|
-
*/
|
|
18
|
-
public validate(uuid: string): boolean {
|
|
19
|
-
return validateUUID(uuid);
|
|
20
|
-
};
|
|
25
|
+
}
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* Parse the uuid to array of bytes
|
|
@@ -27,7 +32,7 @@ export class UuidGenerator {
|
|
|
27
32
|
*/
|
|
28
33
|
public parse(uuid: string): ArrayLike<number> {
|
|
29
34
|
return parseUUID(uuid);
|
|
30
|
-
}
|
|
35
|
+
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
38
|
* Stringify an array of bytes to an uuid
|
|
@@ -37,5 +42,16 @@ export class UuidGenerator {
|
|
|
37
42
|
*/
|
|
38
43
|
public stringify(uuid: ArrayLike<number>): string {
|
|
39
44
|
return stringifyUUID(uuid);
|
|
40
|
-
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Checks if the provided string is a valid uuid.
|
|
49
|
+
*
|
|
50
|
+
* @param uuid the uuid to check
|
|
51
|
+
*/
|
|
52
|
+
public validate(uuid: string): boolean {
|
|
53
|
+
return validateUUID(uuid);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// #endregion Public Methods (4)
|
|
41
57
|
}
|