@zcomponent/core 2.0.0-alpha.3 → 2.0.0-alpha.4
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/behavior.d.ts +7 -1
- package/lib/behavior.js +6 -1
- package/lib/behaviors/ConsoleLog.d.ts +2 -0
- package/lib/behaviors/ConsoleLog.js +2 -0
- package/lib/behaviors/LaunchURL.d.ts +2 -0
- package/lib/behaviors/LaunchURL.js +2 -0
- package/lib/behaviors/LogAnalyticsEvent.d.ts +2 -0
- package/lib/behaviors/LogAnalyticsEvent.js +2 -0
- package/lib/behaviors/PlaySound.d.ts +3 -0
- package/lib/behaviors/PlaySound.js +7 -1
- package/lib/behaviors/ShowTextAlert.d.ts +1 -0
- package/lib/behaviors/ShowTextAlert.js +1 -0
- package/lib/behaviors/ToggleLayerClips.d.ts +1 -0
- package/lib/behaviors/ToggleLayerClips.js +9 -3
- package/lib/component.d.ts +7 -0
- package/lib/component.js +6 -0
- package/lib/components/AnimatedLoader.d.ts +6 -0
- package/lib/components/AnimatedLoader.js +6 -0
- package/lib/components/Audio.d.ts +28 -2
- package/lib/components/Audio.js +55 -8
- package/lib/components/DefaultCookieConsent.d.ts +11 -0
- package/lib/components/DefaultCookieConsent.js +33 -9
- package/lib/components/DefaultLoader.d.ts +3 -0
- package/lib/components/DefaultLoader.js +15 -8
- package/lib/components/Gamepad.d.ts +61 -0
- package/lib/components/Gamepad.js +61 -0
- package/lib/components/LongLoad.d.ts +3 -0
- package/lib/components/LongLoad.js +3 -0
- package/lib/components/SnapshotUI.d.ts +14 -0
- package/lib/components/SnapshotUI.js +27 -9
- package/lib/context.d.ts +11 -1
- package/lib/context.js +9 -1
- package/lib/contexts/analyticscontext.d.ts +3 -0
- package/lib/contexts/analyticscontext.js +14 -2
- package/lib/contexts/audiocontextcontext.d.ts +12 -0
- package/lib/contexts/audiocontextcontext.js +131 -56
- package/lib/contexts/canvascontext.d.ts +25 -0
- package/lib/contexts/canvascontext.js +75 -15
- package/lib/contexts/cookieconsentcontext.d.ts +19 -0
- package/lib/contexts/cookieconsentcontext.js +135 -27
- package/lib/contexts/environmentcontext.d.ts +13 -5
- package/lib/contexts/environmentcontext.js +26 -14
- package/lib/contexts/gamepadcontext.d.ts +17 -0
- package/lib/contexts/gamepadcontext.js +160 -74
- package/lib/contexts/gesturecontext.d.ts +11 -0
- package/lib/contexts/gesturecontext.js +266 -169
- package/lib/contexts/globaltagcontext.d.ts +2 -0
- package/lib/contexts/globaltagcontext.js +69 -10
- package/lib/contexts/loadcontext.d.ts +19 -0
- package/lib/contexts/loadcontext.js +68 -18
- package/lib/contexts/orientationcontext.d.ts +13 -0
- package/lib/contexts/orientationcontext.js +60 -11
- package/lib/contexts/snapshotContext.d.ts +10 -0
- package/lib/contexts/snapshotContext.js +55 -9
- package/lib/contexts/tagcontext.d.ts +14 -0
- package/lib/contexts/tagcontext.js +186 -98
- package/lib/entity.d.ts +5 -1
- package/lib/entity.js +4 -1
- package/lib/zcomponent.d.ts +20 -0
- package/lib/zcomponent.js +81 -12
- package/package.json +1 -1
|
@@ -1,4 +1,39 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
1
35
|
import { Context } from '../context';
|
|
36
|
+
import { zIgnore } from '../decorators';
|
|
2
37
|
import { Observable } from '../observable';
|
|
3
38
|
/**
|
|
4
39
|
* Representing the overall status of the cookie consent process: 'unknown', 'initializing', 'initialized'.
|
|
@@ -39,33 +74,106 @@ Object.freeze(CookieType);
|
|
|
39
74
|
* - `marketingVendors`: Array of registered marketing vendors.
|
|
40
75
|
* @zcontext
|
|
41
76
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
let CookieConsentContext = (() => {
|
|
78
|
+
let _classSuper = Context;
|
|
79
|
+
let _instanceExtraInitializers = [];
|
|
80
|
+
let _status_decorators;
|
|
81
|
+
let _status_initializers = [];
|
|
82
|
+
let _status_extraInitializers = [];
|
|
83
|
+
let _functionalCookies_decorators;
|
|
84
|
+
let _functionalCookies_initializers = [];
|
|
85
|
+
let _functionalCookies_extraInitializers = [];
|
|
86
|
+
let _performanceCookies_decorators;
|
|
87
|
+
let _performanceCookies_initializers = [];
|
|
88
|
+
let _performanceCookies_extraInitializers = [];
|
|
89
|
+
let _marketingCookies_decorators;
|
|
90
|
+
let _marketingCookies_initializers = [];
|
|
91
|
+
let _marketingCookies_extraInitializers = [];
|
|
92
|
+
let _showSettings_decorators;
|
|
93
|
+
let _showSettings_initializers = [];
|
|
94
|
+
let _showSettings_extraInitializers = [];
|
|
95
|
+
let _performanceVendors_decorators;
|
|
96
|
+
let _performanceVendors_initializers = [];
|
|
97
|
+
let _performanceVendors_extraInitializers = [];
|
|
98
|
+
let _marketingVendors_decorators;
|
|
99
|
+
let _marketingVendors_initializers = [];
|
|
100
|
+
let _marketingVendors_extraInitializers = [];
|
|
101
|
+
let _registerPerformanceVendor_decorators;
|
|
102
|
+
let _registerMarketingVendor_decorators;
|
|
103
|
+
return class CookieConsentContext extends _classSuper {
|
|
104
|
+
static {
|
|
105
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
106
|
+
_status_decorators = [zIgnore()];
|
|
107
|
+
_functionalCookies_decorators = [zIgnore()];
|
|
108
|
+
_performanceCookies_decorators = [zIgnore()];
|
|
109
|
+
_marketingCookies_decorators = [zIgnore()];
|
|
110
|
+
_showSettings_decorators = [zIgnore()];
|
|
111
|
+
_performanceVendors_decorators = [zIgnore()];
|
|
112
|
+
_marketingVendors_decorators = [zIgnore()];
|
|
113
|
+
_registerPerformanceVendor_decorators = [zIgnore()];
|
|
114
|
+
_registerMarketingVendor_decorators = [zIgnore()];
|
|
115
|
+
__esDecorate(this, null, _registerPerformanceVendor_decorators, { kind: "method", name: "registerPerformanceVendor", static: false, private: false, access: { has: obj => "registerPerformanceVendor" in obj, get: obj => obj.registerPerformanceVendor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
116
|
+
__esDecorate(this, null, _registerMarketingVendor_decorators, { kind: "method", name: "registerMarketingVendor", static: false, private: false, access: { has: obj => "registerMarketingVendor" in obj, get: obj => obj.registerMarketingVendor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
117
|
+
__esDecorate(null, null, _status_decorators, { kind: "field", name: "status", static: false, private: false, access: { has: obj => "status" in obj, get: obj => obj.status, set: (obj, value) => { obj.status = value; } }, metadata: _metadata }, _status_initializers, _status_extraInitializers);
|
|
118
|
+
__esDecorate(null, null, _functionalCookies_decorators, { kind: "field", name: "functionalCookies", static: false, private: false, access: { has: obj => "functionalCookies" in obj, get: obj => obj.functionalCookies, set: (obj, value) => { obj.functionalCookies = value; } }, metadata: _metadata }, _functionalCookies_initializers, _functionalCookies_extraInitializers);
|
|
119
|
+
__esDecorate(null, null, _performanceCookies_decorators, { kind: "field", name: "performanceCookies", static: false, private: false, access: { has: obj => "performanceCookies" in obj, get: obj => obj.performanceCookies, set: (obj, value) => { obj.performanceCookies = value; } }, metadata: _metadata }, _performanceCookies_initializers, _performanceCookies_extraInitializers);
|
|
120
|
+
__esDecorate(null, null, _marketingCookies_decorators, { kind: "field", name: "marketingCookies", static: false, private: false, access: { has: obj => "marketingCookies" in obj, get: obj => obj.marketingCookies, set: (obj, value) => { obj.marketingCookies = value; } }, metadata: _metadata }, _marketingCookies_initializers, _marketingCookies_extraInitializers);
|
|
121
|
+
__esDecorate(null, null, _showSettings_decorators, { kind: "field", name: "showSettings", static: false, private: false, access: { has: obj => "showSettings" in obj, get: obj => obj.showSettings, set: (obj, value) => { obj.showSettings = value; } }, metadata: _metadata }, _showSettings_initializers, _showSettings_extraInitializers);
|
|
122
|
+
__esDecorate(null, null, _performanceVendors_decorators, { kind: "field", name: "performanceVendors", static: false, private: false, access: { has: obj => "performanceVendors" in obj, get: obj => obj.performanceVendors, set: (obj, value) => { obj.performanceVendors = value; } }, metadata: _metadata }, _performanceVendors_initializers, _performanceVendors_extraInitializers);
|
|
123
|
+
__esDecorate(null, null, _marketingVendors_decorators, { kind: "field", name: "marketingVendors", static: false, private: false, access: { has: obj => "marketingVendors" in obj, get: obj => obj.marketingVendors, set: (obj, value) => { obj.marketingVendors = value; } }, metadata: _metadata }, _marketingVendors_initializers, _marketingVendors_extraInitializers);
|
|
124
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @zignore
|
|
128
|
+
*/
|
|
129
|
+
status = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _status_initializers, new Observable(Status.unknown)));
|
|
130
|
+
/**
|
|
131
|
+
* @zignore
|
|
132
|
+
*/
|
|
133
|
+
functionalCookies = (__runInitializers(this, _status_extraInitializers), __runInitializers(this, _functionalCookies_initializers, new Observable(ConsentStatus.unknown)));
|
|
134
|
+
/**
|
|
135
|
+
* @zignore
|
|
136
|
+
*/
|
|
137
|
+
performanceCookies = (__runInitializers(this, _functionalCookies_extraInitializers), __runInitializers(this, _performanceCookies_initializers, new Observable(ConsentStatus.unknown)));
|
|
138
|
+
/**
|
|
139
|
+
* @zignore
|
|
140
|
+
*/
|
|
141
|
+
marketingCookies = (__runInitializers(this, _performanceCookies_extraInitializers), __runInitializers(this, _marketingCookies_initializers, new Observable(ConsentStatus.unknown)));
|
|
142
|
+
/**
|
|
143
|
+
* @zignore
|
|
144
|
+
*/
|
|
145
|
+
showSettings = (__runInitializers(this, _marketingCookies_extraInitializers), __runInitializers(this, _showSettings_initializers, new Observable(undefined)));
|
|
146
|
+
/**
|
|
147
|
+
* @default []
|
|
148
|
+
* @zignore
|
|
149
|
+
*/
|
|
150
|
+
performanceVendors = (__runInitializers(this, _showSettings_extraInitializers), __runInitializers(this, _performanceVendors_initializers, []));
|
|
151
|
+
/**
|
|
152
|
+
* @default []
|
|
153
|
+
* @zignore
|
|
154
|
+
*/
|
|
155
|
+
marketingVendors = (__runInitializers(this, _performanceVendors_extraInitializers), __runInitializers(this, _marketingVendors_initializers, []));
|
|
156
|
+
/**
|
|
157
|
+
* Registers a performance vendor.
|
|
158
|
+
* @zignore
|
|
159
|
+
*/
|
|
160
|
+
registerPerformanceVendor(v) {
|
|
161
|
+
this.performanceVendors.push(v);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Registers a marketing vendor.
|
|
165
|
+
* @zignore
|
|
166
|
+
*/
|
|
167
|
+
registerMarketingVendor(v) {
|
|
168
|
+
this.marketingVendors.push(v);
|
|
169
|
+
}
|
|
170
|
+
constructor() {
|
|
171
|
+
super(...arguments);
|
|
172
|
+
__runInitializers(this, _marketingVendors_extraInitializers);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
})();
|
|
176
|
+
export { CookieConsentContext };
|
|
69
177
|
/**
|
|
70
178
|
* Retrieves the consent status for functional cookies.
|
|
71
179
|
* @param {ContextManager} mgr The context manager instance.
|
|
@@ -5,26 +5,34 @@ import { Observable } from '../observable';
|
|
|
5
5
|
export declare class EnvironmentContext extends Context {
|
|
6
6
|
/**
|
|
7
7
|
* Observable indicating if the application is in design time.
|
|
8
|
-
|
|
8
|
+
* @zui
|
|
9
|
+
*/
|
|
9
10
|
readonly designTime: Observable<boolean, never>;
|
|
10
11
|
/**
|
|
11
12
|
* Observable indicating if the application is in edit time.
|
|
12
|
-
*
|
|
13
|
+
* @zui
|
|
14
|
+
*/
|
|
13
15
|
readonly editTime: Observable<boolean, never>;
|
|
14
16
|
/**
|
|
15
17
|
* Observable indicating if the application is in run time.
|
|
16
|
-
|
|
18
|
+
* @zui
|
|
19
|
+
*/
|
|
17
20
|
readonly runTime: Observable<boolean, never>;
|
|
18
21
|
/**
|
|
19
22
|
* Observable indicating if the application is a development build.
|
|
20
|
-
|
|
23
|
+
* @zui
|
|
24
|
+
*/
|
|
21
25
|
readonly developmentBuild: Observable<boolean, never>;
|
|
22
26
|
/**
|
|
23
27
|
* Observable indicating if the application is a production build.
|
|
24
|
-
*
|
|
28
|
+
* @zui
|
|
29
|
+
*/
|
|
25
30
|
readonly productionBuild: Observable<boolean, never>;
|
|
26
31
|
private readonly _documentFlagManager;
|
|
27
32
|
constructor(contextManager: ContextManager, props: {});
|
|
33
|
+
/**
|
|
34
|
+
* @zignore
|
|
35
|
+
*/
|
|
28
36
|
dispose(): never;
|
|
29
37
|
}
|
|
30
38
|
/**
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
1
8
|
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
9
|
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
10
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
@@ -25,21 +32,15 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
25
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
33
|
done = true;
|
|
27
34
|
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
35
|
import { Context } from '../context';
|
|
36
|
-
import { zUI } from '../decorators';
|
|
36
|
+
import { zIgnore, zUI } from '../decorators';
|
|
37
37
|
import { Observable } from '../observable';
|
|
38
38
|
import { DocumentFlagManager } from './documentflagmanager';
|
|
39
39
|
import { LoadContext } from './loadcontext';
|
|
40
40
|
/** @zcontext */
|
|
41
41
|
let EnvironmentContext = (() => {
|
|
42
42
|
let _classSuper = Context;
|
|
43
|
+
let _instanceExtraInitializers = [];
|
|
43
44
|
let _designTime_decorators;
|
|
44
45
|
let _designTime_initializers = [];
|
|
45
46
|
let _designTime_extraInitializers = [];
|
|
@@ -55,6 +56,7 @@ let EnvironmentContext = (() => {
|
|
|
55
56
|
let _productionBuild_decorators;
|
|
56
57
|
let _productionBuild_initializers = [];
|
|
57
58
|
let _productionBuild_extraInitializers = [];
|
|
59
|
+
let _dispose_decorators;
|
|
58
60
|
return class EnvironmentContext extends _classSuper {
|
|
59
61
|
static {
|
|
60
62
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -63,6 +65,8 @@ let EnvironmentContext = (() => {
|
|
|
63
65
|
_runTime_decorators = [zUI()];
|
|
64
66
|
_developmentBuild_decorators = [zUI()];
|
|
65
67
|
_productionBuild_decorators = [zUI()];
|
|
68
|
+
_dispose_decorators = [zIgnore()];
|
|
69
|
+
__esDecorate(this, null, _dispose_decorators, { kind: "method", name: "dispose", static: false, private: false, access: { has: obj => "dispose" in obj, get: obj => obj.dispose }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
66
70
|
__esDecorate(null, null, _designTime_decorators, { kind: "field", name: "designTime", static: false, private: false, access: { has: obj => "designTime" in obj, get: obj => obj.designTime, set: (obj, value) => { obj.designTime = value; } }, metadata: _metadata }, _designTime_initializers, _designTime_extraInitializers);
|
|
67
71
|
__esDecorate(null, null, _editTime_decorators, { kind: "field", name: "editTime", static: false, private: false, access: { has: obj => "editTime" in obj, get: obj => obj.editTime, set: (obj, value) => { obj.editTime = value; } }, metadata: _metadata }, _editTime_initializers, _editTime_extraInitializers);
|
|
68
72
|
__esDecorate(null, null, _runTime_decorators, { kind: "field", name: "runTime", static: false, private: false, access: { has: obj => "runTime" in obj, get: obj => obj.runTime, set: (obj, value) => { obj.runTime = value; } }, metadata: _metadata }, _runTime_initializers, _runTime_extraInitializers);
|
|
@@ -72,23 +76,28 @@ let EnvironmentContext = (() => {
|
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
74
78
|
* Observable indicating if the application is in design time.
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
* @zui
|
|
80
|
+
*/
|
|
81
|
+
designTime = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _designTime_initializers, new Observable(false)));
|
|
77
82
|
/**
|
|
78
83
|
* Observable indicating if the application is in edit time.
|
|
79
|
-
*
|
|
84
|
+
* @zui
|
|
85
|
+
*/
|
|
80
86
|
editTime = (__runInitializers(this, _designTime_extraInitializers), __runInitializers(this, _editTime_initializers, new Observable(false)));
|
|
81
87
|
/**
|
|
82
88
|
* Observable indicating if the application is in run time.
|
|
83
|
-
|
|
89
|
+
* @zui
|
|
90
|
+
*/
|
|
84
91
|
runTime = (__runInitializers(this, _editTime_extraInitializers), __runInitializers(this, _runTime_initializers, new Observable(true)));
|
|
85
92
|
/**
|
|
86
93
|
* Observable indicating if the application is a development build.
|
|
87
|
-
|
|
94
|
+
* @zui
|
|
95
|
+
*/
|
|
88
96
|
developmentBuild = (__runInitializers(this, _runTime_extraInitializers), __runInitializers(this, _developmentBuild_initializers, new Observable(typeof process !== 'undefined' && process?.env?.NODE_ENV === 'development')));
|
|
89
97
|
/**
|
|
90
98
|
* Observable indicating if the application is a production build.
|
|
91
|
-
*
|
|
99
|
+
* @zui
|
|
100
|
+
*/
|
|
92
101
|
productionBuild = (__runInitializers(this, _developmentBuild_extraInitializers), __runInitializers(this, _productionBuild_initializers, new Observable(!this.developmentBuild.value)));
|
|
93
102
|
_documentFlagManager = __runInitializers(this, _productionBuild_extraInitializers);
|
|
94
103
|
constructor(contextManager, props) {
|
|
@@ -96,6 +105,9 @@ let EnvironmentContext = (() => {
|
|
|
96
105
|
const loadContext = this.contextManager.get(LoadContext);
|
|
97
106
|
this._documentFlagManager = new DocumentFlagManager(this, loadContext);
|
|
98
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* @zignore
|
|
110
|
+
*/
|
|
99
111
|
dispose() {
|
|
100
112
|
this._documentFlagManager.dispose();
|
|
101
113
|
return super.dispose();
|
|
@@ -39,7 +39,13 @@ export type GamepadButtonValue = ValueOf<typeof GamepadButton>;
|
|
|
39
39
|
* @zcontext
|
|
40
40
|
*/
|
|
41
41
|
export declare class GamepadContext extends Context {
|
|
42
|
+
/**
|
|
43
|
+
* @zignore
|
|
44
|
+
*/
|
|
42
45
|
readonly onGamepadsChange: Event<[]>;
|
|
46
|
+
/**
|
|
47
|
+
* @zignore
|
|
48
|
+
*/
|
|
43
49
|
readonly activeGamepads: Set<number>;
|
|
44
50
|
private _registeredGamepads;
|
|
45
51
|
/**
|
|
@@ -50,27 +56,38 @@ export declare class GamepadContext extends Context {
|
|
|
50
56
|
private _update;
|
|
51
57
|
/**
|
|
52
58
|
* Retrieves a gamepad instance by its index.
|
|
59
|
+
*
|
|
53
60
|
* @param indx The index of the gamepad.
|
|
54
61
|
* @returns The gamepad instance or null if not found.
|
|
62
|
+
* @zignore
|
|
55
63
|
*/
|
|
56
64
|
getGamepad(indx: number): Gamepad | null;
|
|
57
65
|
/**
|
|
58
66
|
* Executes a function on each active gamepad, optionally filtered by index.
|
|
67
|
+
*
|
|
59
68
|
* @param requestedIndex The index to filter gamepads by, if specified.
|
|
60
69
|
* @param fn The function to execute on each matching gamepad.
|
|
70
|
+
* @zignore
|
|
61
71
|
*/
|
|
62
72
|
forGamepadsMatchingIndex(requestedIndex: number | undefined, fn: (gamepad: Gamepad) => void): void;
|
|
63
73
|
/**
|
|
64
74
|
* Registers a gamepad with a specific index.
|
|
75
|
+
*
|
|
65
76
|
* @param indx The index of the gamepad.
|
|
66
77
|
* @param gamepad The gamepad to register.
|
|
78
|
+
* @zignore
|
|
67
79
|
*/
|
|
68
80
|
registerGamepad(indx: number, gamepad: Gamepad): void;
|
|
69
81
|
/**
|
|
70
82
|
* Unregisters a gamepad by its index.
|
|
83
|
+
*
|
|
71
84
|
* @param indx The index of the gamepad to unregister.
|
|
85
|
+
* @zignore
|
|
72
86
|
*/
|
|
73
87
|
unregsiterGamepad(indx: number): void;
|
|
88
|
+
/**
|
|
89
|
+
* @zignore
|
|
90
|
+
*/
|
|
74
91
|
dispose(): never;
|
|
75
92
|
}
|
|
76
93
|
/**
|
|
@@ -1,4 +1,39 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
1
35
|
import { Context } from '../context';
|
|
36
|
+
import { zIgnore } from '../decorators';
|
|
2
37
|
import { Event } from '../event';
|
|
3
38
|
import { isDesignTime } from './environmentcontext';
|
|
4
39
|
/**
|
|
@@ -38,86 +73,137 @@ Object.freeze(GamepadButton);
|
|
|
38
73
|
* Manages and tracks gamepad connections and states.
|
|
39
74
|
* @zcontext
|
|
40
75
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
let GamepadContext = (() => {
|
|
77
|
+
let _classSuper = Context;
|
|
78
|
+
let _instanceExtraInitializers = [];
|
|
79
|
+
let _onGamepadsChange_decorators;
|
|
80
|
+
let _onGamepadsChange_initializers = [];
|
|
81
|
+
let _onGamepadsChange_extraInitializers = [];
|
|
82
|
+
let _activeGamepads_decorators;
|
|
83
|
+
let _activeGamepads_initializers = [];
|
|
84
|
+
let _activeGamepads_extraInitializers = [];
|
|
85
|
+
let _getGamepad_decorators;
|
|
86
|
+
let _forGamepadsMatchingIndex_decorators;
|
|
87
|
+
let _registerGamepad_decorators;
|
|
88
|
+
let _unregsiterGamepad_decorators;
|
|
89
|
+
let _dispose_decorators;
|
|
90
|
+
return class GamepadContext extends _classSuper {
|
|
91
|
+
static {
|
|
92
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
93
|
+
_onGamepadsChange_decorators = [zIgnore()];
|
|
94
|
+
_activeGamepads_decorators = [zIgnore()];
|
|
95
|
+
_getGamepad_decorators = [zIgnore()];
|
|
96
|
+
_forGamepadsMatchingIndex_decorators = [zIgnore()];
|
|
97
|
+
_registerGamepad_decorators = [zIgnore()];
|
|
98
|
+
_unregsiterGamepad_decorators = [zIgnore()];
|
|
99
|
+
_dispose_decorators = [zIgnore()];
|
|
100
|
+
__esDecorate(this, null, _getGamepad_decorators, { kind: "method", name: "getGamepad", static: false, private: false, access: { has: obj => "getGamepad" in obj, get: obj => obj.getGamepad }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
101
|
+
__esDecorate(this, null, _forGamepadsMatchingIndex_decorators, { kind: "method", name: "forGamepadsMatchingIndex", static: false, private: false, access: { has: obj => "forGamepadsMatchingIndex" in obj, get: obj => obj.forGamepadsMatchingIndex }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
102
|
+
__esDecorate(this, null, _registerGamepad_decorators, { kind: "method", name: "registerGamepad", static: false, private: false, access: { has: obj => "registerGamepad" in obj, get: obj => obj.registerGamepad }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
103
|
+
__esDecorate(this, null, _unregsiterGamepad_decorators, { kind: "method", name: "unregsiterGamepad", static: false, private: false, access: { has: obj => "unregsiterGamepad" in obj, get: obj => obj.unregsiterGamepad }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
104
|
+
__esDecorate(this, null, _dispose_decorators, { kind: "method", name: "dispose", static: false, private: false, access: { has: obj => "dispose" in obj, get: obj => obj.dispose }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
105
|
+
__esDecorate(null, null, _onGamepadsChange_decorators, { kind: "field", name: "onGamepadsChange", static: false, private: false, access: { has: obj => "onGamepadsChange" in obj, get: obj => obj.onGamepadsChange, set: (obj, value) => { obj.onGamepadsChange = value; } }, metadata: _metadata }, _onGamepadsChange_initializers, _onGamepadsChange_extraInitializers);
|
|
106
|
+
__esDecorate(null, null, _activeGamepads_decorators, { kind: "field", name: "activeGamepads", static: false, private: false, access: { has: obj => "activeGamepads" in obj, get: obj => obj.activeGamepads, set: (obj, value) => { obj.activeGamepads = value; } }, metadata: _metadata }, _activeGamepads_initializers, _activeGamepads_extraInitializers);
|
|
107
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
54
108
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
109
|
+
/**
|
|
110
|
+
* @zignore
|
|
111
|
+
*/
|
|
112
|
+
onGamepadsChange = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _onGamepadsChange_initializers, new Event()));
|
|
113
|
+
/**
|
|
114
|
+
* @zignore
|
|
115
|
+
*/
|
|
116
|
+
activeGamepads = (__runInitializers(this, _onGamepadsChange_extraInitializers), __runInitializers(this, _activeGamepads_initializers, new Set()));
|
|
117
|
+
_registeredGamepads = (__runInitializers(this, _activeGamepads_extraInitializers), new Map());
|
|
118
|
+
/**
|
|
119
|
+
* Creates an instance of GamepadContext.
|
|
120
|
+
* @param contextManager - The current ContextManager
|
|
121
|
+
*/
|
|
122
|
+
constructor(contextManager) {
|
|
123
|
+
super(contextManager, {});
|
|
124
|
+
if (!isDesignTime(contextManager) && typeof navigator.getGamepads === 'function') {
|
|
125
|
+
window.addEventListener('gamepadconnected', this._update);
|
|
126
|
+
window.addEventListener('gamepaddisconnected', this._update);
|
|
64
127
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
128
|
+
this._update();
|
|
129
|
+
}
|
|
130
|
+
_update = () => {
|
|
131
|
+
const gamepads = navigator.getGamepads();
|
|
132
|
+
let changes = false;
|
|
133
|
+
for (let i = 0; i < gamepads.length; i++) {
|
|
134
|
+
if (gamepads[i] === null && this.activeGamepads.has(i)) {
|
|
135
|
+
this.activeGamepads.delete(i);
|
|
136
|
+
changes = true;
|
|
137
|
+
}
|
|
138
|
+
else if (gamepads[i] !== null && !this.activeGamepads.has(i)) {
|
|
139
|
+
this.activeGamepads.add(i);
|
|
140
|
+
changes = true;
|
|
141
|
+
}
|
|
68
142
|
}
|
|
143
|
+
if (changes)
|
|
144
|
+
this.onGamepadsChange.emit();
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Retrieves a gamepad instance by its index.
|
|
148
|
+
*
|
|
149
|
+
* @param indx The index of the gamepad.
|
|
150
|
+
* @returns The gamepad instance or null if not found.
|
|
151
|
+
* @zignore
|
|
152
|
+
*/
|
|
153
|
+
getGamepad(indx) {
|
|
154
|
+
return this._registeredGamepads.get(indx) ?? (navigator.getGamepads?.()?.[indx] || null);
|
|
69
155
|
}
|
|
70
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Executes a function on each active gamepad, optionally filtered by index.
|
|
158
|
+
*
|
|
159
|
+
* @param requestedIndex The index to filter gamepads by, if specified.
|
|
160
|
+
* @param fn The function to execute on each matching gamepad.
|
|
161
|
+
* @zignore
|
|
162
|
+
*/
|
|
163
|
+
forGamepadsMatchingIndex(requestedIndex, fn) {
|
|
164
|
+
for (const indx of this.activeGamepads) {
|
|
165
|
+
if (requestedIndex !== undefined && indx !== requestedIndex)
|
|
166
|
+
continue;
|
|
167
|
+
const gamepad = this.getGamepad(indx);
|
|
168
|
+
if (gamepad)
|
|
169
|
+
fn(gamepad);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Registers a gamepad with a specific index.
|
|
174
|
+
*
|
|
175
|
+
* @param indx The index of the gamepad.
|
|
176
|
+
* @param gamepad The gamepad to register.
|
|
177
|
+
* @zignore
|
|
178
|
+
*/
|
|
179
|
+
registerGamepad(indx, gamepad) {
|
|
180
|
+
this._registeredGamepads.set(indx, gamepad);
|
|
181
|
+
if (gamepad !== null)
|
|
182
|
+
this.activeGamepads.add(indx);
|
|
71
183
|
this.onGamepadsChange.emit();
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Retrieves a gamepad instance by its index.
|
|
75
|
-
* @param indx The index of the gamepad.
|
|
76
|
-
* @returns The gamepad instance or null if not found.
|
|
77
|
-
*/
|
|
78
|
-
getGamepad(indx) {
|
|
79
|
-
return this._registeredGamepads.get(indx) ?? (navigator.getGamepads?.()?.[indx] || null);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Executes a function on each active gamepad, optionally filtered by index.
|
|
83
|
-
* @param requestedIndex The index to filter gamepads by, if specified.
|
|
84
|
-
* @param fn The function to execute on each matching gamepad.
|
|
85
|
-
*/
|
|
86
|
-
forGamepadsMatchingIndex(requestedIndex, fn) {
|
|
87
|
-
for (const indx of this.activeGamepads) {
|
|
88
|
-
if (requestedIndex !== undefined && indx !== requestedIndex)
|
|
89
|
-
continue;
|
|
90
|
-
const gamepad = this.getGamepad(indx);
|
|
91
|
-
if (gamepad)
|
|
92
|
-
fn(gamepad);
|
|
93
184
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
window.removeEventListener('gamepadconnected', this._update);
|
|
117
|
-
window.removeEventListener('gamepaddisconnected', this._update);
|
|
118
|
-
return super.dispose();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
185
|
+
/**
|
|
186
|
+
* Unregisters a gamepad by its index.
|
|
187
|
+
*
|
|
188
|
+
* @param indx The index of the gamepad to unregister.
|
|
189
|
+
* @zignore
|
|
190
|
+
*/
|
|
191
|
+
unregsiterGamepad(indx) {
|
|
192
|
+
this._registeredGamepads.delete(indx);
|
|
193
|
+
this.activeGamepads.delete(indx);
|
|
194
|
+
this.onGamepadsChange.emit();
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @zignore
|
|
198
|
+
*/
|
|
199
|
+
dispose() {
|
|
200
|
+
window.removeEventListener('gamepadconnected', this._update);
|
|
201
|
+
window.removeEventListener('gamepaddisconnected', this._update);
|
|
202
|
+
return super.dispose();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
})();
|
|
206
|
+
export { GamepadContext };
|
|
121
207
|
/**
|
|
122
208
|
* Converts a gamepad axis enum value to its corresponding numeric representation.
|
|
123
209
|
* @param axis The gamepad axis to translate.
|