@zcomponent/core 1.29.0 → 2.0.0-alpha.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/README.md +1 -0
- package/css/zcomponent.css +121 -122
- package/index.js +0 -3
- package/lib/actionbehavior.d.ts +3 -3
- package/lib/actionbehavior.js +20 -19
- package/lib/animation/animation.d.ts +13 -6
- package/lib/animation/animation.js +56 -43
- package/lib/animation/bezier.d.ts +6 -0
- package/lib/animation/bezier.js +8 -2
- package/lib/animation/clips/clip.d.ts +13 -1
- package/lib/animation/clips/clip.js +34 -14
- package/lib/animation/index.d.ts +4 -4
- package/lib/animation/index.js +4 -4
- package/lib/animation/layer.d.ts +9 -0
- package/lib/animation/layer.js +28 -12
- package/lib/animation/layerclip.d.ts +21 -0
- package/lib/animation/layerclip.js +82 -45
- package/lib/animation/tracks/cliptrack.d.ts +18 -0
- package/lib/animation/tracks/cliptrack.js +27 -6
- package/lib/animation/tracks/functiontrack.d.ts +9 -0
- package/lib/animation/tracks/functiontrack.js +16 -3
- package/lib/animation/tracks/propertytrack.d.ts +20 -1
- package/lib/animation/tracks/propertytrack.js +48 -11
- package/lib/animation/tracks/streamtrack.d.ts +18 -0
- package/lib/animation/tracks/streamtrack.js +32 -6
- package/lib/animation/tracks/track.d.ts +8 -2
- package/lib/animation/tracks/track.js +3 -2
- package/lib/behavior.js +13 -10
- package/lib/behaviors/ActivateState.d.ts +22 -24
- package/lib/behaviors/ActivateState.js +145 -35
- package/lib/behaviors/CallFunction.d.ts +2 -4
- package/lib/behaviors/CallFunction.js +69 -11
- package/lib/behaviors/ChangeRootScene.d.ts +35 -0
- package/lib/behaviors/ChangeRootScene.js +123 -0
- package/lib/behaviors/ConsoleLog.d.ts +6 -5
- package/lib/behaviors/ConsoleLog.js +95 -12
- package/lib/behaviors/DownloadSnapshot.d.ts +7 -12
- package/lib/behaviors/DownloadSnapshot.js +70 -19
- package/lib/behaviors/EmitComponentPropEvent.d.ts +1 -3
- package/lib/behaviors/EmitComponentPropEvent.js +80 -12
- package/lib/behaviors/LaunchURL.d.ts +5 -5
- package/lib/behaviors/LaunchURL.js +92 -10
- package/lib/behaviors/LogAnalyticsEvent.d.ts +10 -4
- package/lib/behaviors/LogAnalyticsEvent.js +88 -7
- package/lib/behaviors/PauseLayerClip.d.ts +7 -9
- package/lib/behaviors/PauseLayerClip.js +89 -21
- package/lib/behaviors/PlayLayerClip.d.ts +35 -32
- package/lib/behaviors/PlayLayerClip.js +202 -48
- package/lib/behaviors/PlaySound.d.ts +19 -25
- package/lib/behaviors/PlaySound.js +122 -28
- package/lib/behaviors/SetLayerOff.d.ts +7 -9
- package/lib/behaviors/SetLayerOff.js +88 -21
- package/lib/behaviors/ShareSnapshot.d.ts +5 -9
- package/lib/behaviors/ShareSnapshot.js +70 -17
- package/lib/behaviors/ShowTextAlert.d.ts +16 -29
- package/lib/behaviors/ShowTextAlert.js +116 -48
- package/lib/behaviors/TakeSnapshot.d.ts +22 -26
- package/lib/behaviors/TakeSnapshot.js +131 -56
- package/lib/behaviors/ToggleLayerClips.d.ts +45 -62
- package/lib/behaviors/ToggleLayerClips.js +233 -64
- package/lib/behaviors/stream/PauseStream.d.ts +5 -16
- package/lib/behaviors/stream/PauseStream.js +94 -34
- package/lib/behaviors/stream/PlayStream.d.ts +14 -27
- package/lib/behaviors/stream/PlayStream.js +123 -34
- package/lib/behaviors/stream/SeekStream.d.ts +8 -18
- package/lib/behaviors/stream/SeekStream.js +97 -31
- package/lib/behaviors/stream/StopStream.d.ts +6 -15
- package/lib/behaviors/stream/StopStream.js +89 -27
- package/lib/component.d.ts +36 -13
- package/lib/component.js +237 -151
- package/lib/components/AnimatedLoader.d.ts +51 -0
- package/lib/components/AnimatedLoader.js +159 -0
- package/lib/components/Audio.d.ts +35 -37
- package/lib/components/Audio.js +264 -151
- package/lib/components/AudioLayerSettings.d.ts +13 -11
- package/lib/components/AudioLayerSettings.js +76 -18
- package/lib/components/Children.d.ts +2 -1
- package/lib/components/Children.js +66 -13
- package/lib/components/ConditionalConstruct.d.ts +44 -0
- package/lib/components/ConditionalConstruct.js +142 -0
- package/lib/components/DefaultCookieConsent.d.ts +53 -73
- package/lib/components/DefaultCookieConsent.js +382 -264
- package/lib/components/DefaultLoader.d.ts +40 -28
- package/lib/components/DefaultLoader.js +198 -46
- package/lib/components/Gamepad.d.ts +5 -26
- package/lib/components/Gamepad.js +201 -65
- package/lib/components/LoaderScope.d.ts +15 -0
- package/lib/components/LoaderScope.js +71 -0
- package/lib/components/LongLoad.d.ts +11 -15
- package/lib/components/LongLoad.js +89 -34
- package/lib/components/SnapshotUI.d.ts +19 -24
- package/lib/components/SnapshotUI.js +202 -105
- package/lib/context.d.ts +23 -5
- package/lib/context.js +12 -6
- package/lib/contexts/analyticscontext.d.ts +12 -2
- package/lib/contexts/analyticscontext.js +68 -10
- package/lib/contexts/audiocontextcontext.d.ts +1 -1
- package/lib/contexts/audiocontextcontext.js +9 -8
- package/lib/contexts/canvascontext.d.ts +32 -18
- package/lib/contexts/canvascontext.js +195 -120
- package/lib/contexts/cookieconsentcontext.d.ts +38 -28
- package/lib/contexts/cookieconsentcontext.js +35 -32
- package/lib/contexts/documentflagmanager.js +15 -11
- package/lib/contexts/environmentcontext.d.ts +22 -6
- package/lib/contexts/environmentcontext.js +135 -21
- package/lib/contexts/gamepadcontext.d.ts +29 -26
- package/lib/contexts/gamepadcontext.js +46 -46
- package/lib/contexts/gesturecontext.d.ts +31 -6
- package/lib/contexts/gesturecontext.js +110 -85
- package/lib/contexts/globaltagcontext.d.ts +1 -1
- package/lib/contexts/globaltagcontext.js +8 -11
- package/lib/contexts/loadcontext.d.ts +45 -8
- package/lib/contexts/loadcontext.js +232 -82
- package/lib/contexts/orientationcontext.d.ts +13 -15
- package/lib/contexts/orientationcontext.js +150 -67
- package/lib/contexts/rootcomponentscontext.d.ts +16 -0
- package/lib/contexts/rootcomponentscontext.js +65 -0
- package/lib/contexts/snapshotContext.d.ts +0 -3
- package/lib/contexts/snapshotContext.js +78 -23
- package/lib/contexts/tagcontext.d.ts +5 -5
- package/lib/contexts/tagcontext.js +16 -16
- package/lib/contexts/textalertcontext.d.ts +1 -5
- package/lib/contexts/textalertcontext.js +1 -5
- package/lib/contexts/usereventcontext.d.ts +1 -1
- package/lib/contexts/usereventcontext.js +12 -12
- package/lib/data/animation.d.ts +10 -2
- package/lib/data/change.d.ts +1 -1
- package/lib/data/change.js +7 -0
- package/lib/data/core.d.ts +9 -1
- package/lib/data/index.d.ts +1 -1
- package/lib/data/index.js +1 -1
- package/lib/decorators.d.ts +348 -0
- package/lib/decorators.js +239 -0
- package/lib/decoratorutils.d.ts +3 -0
- package/lib/decoratorutils.js +8 -0
- package/lib/emitter.d.ts +15 -2
- package/lib/emitter.js +15 -6
- package/lib/entity.d.ts +43 -25
- package/lib/entity.js +104 -71
- package/lib/event.d.ts +2 -1
- package/lib/event.js +1 -4
- package/lib/groups.d.ts +18 -0
- package/lib/groups.js +19 -0
- package/lib/icons.d.ts +3372 -0
- package/lib/icons.js +1 -0
- package/lib/index.d.ts +18 -13
- package/lib/index.js +17 -13
- package/lib/inflate.d.ts +7 -7
- package/lib/inflate.js +5 -5
- package/lib/observable.d.ts +9 -2
- package/lib/observable.js +5 -4
- package/lib/observe.d.ts +18 -0
- package/lib/observe.js +177 -0
- package/lib/profile.d.ts +9 -5
- package/lib/profile.js +27 -17
- package/lib/selectors.d.ts +1 -1
- package/lib/selectors.js +5 -4
- package/lib/types.d.ts +161 -19
- package/lib/types.js +22 -1
- package/lib/values/values.d.ts +7 -8
- package/lib/values/values.js +1 -2
- package/lib/values/valuesmutator.d.ts +4 -1
- package/lib/values/valuesmutator.js +10 -8
- package/lib/zcomponent.d.ts +21 -10
- package/lib/zcomponent.js +717 -540
- package/package.json +22 -5
- package/lib/behaviors/ChangeCursor.d.ts +0 -39
- package/lib/behaviors/ChangeCursor.js +0 -44
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
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
|
+
};
|
|
1
35
|
import { Component } from '../component';
|
|
2
36
|
import { useOnBeforeRender } from '../contexts/canvascontext';
|
|
3
|
-
import {
|
|
37
|
+
import { EnvironmentContext, isEditTime } from '../contexts/environmentcontext';
|
|
4
38
|
import { GamepadContext } from '../contexts/gamepadcontext';
|
|
39
|
+
import { zComponent, zUI } from '../decorators';
|
|
5
40
|
import { Event } from '../event';
|
|
6
|
-
import { Observable } from '../observable';
|
|
7
41
|
/**
|
|
8
42
|
* Manages gamepad interactions, facilitating the tracking and handling of button press events for a specific controller.
|
|
9
43
|
*
|
|
@@ -11,53 +45,149 @@ import { Observable } from '../observable';
|
|
|
11
45
|
* @zcomponent
|
|
12
46
|
* @zicon sports_esports
|
|
13
47
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
let Gamepad = (() => {
|
|
49
|
+
let _classDecorators = [zComponent({ icon: 'sports_esports' })];
|
|
50
|
+
let _classDescriptor;
|
|
51
|
+
let _classExtraInitializers = [];
|
|
52
|
+
let _classThis;
|
|
53
|
+
let _classSuper = Component;
|
|
54
|
+
let _onButtonDown_decorators;
|
|
55
|
+
let _onButtonDown_initializers = [];
|
|
56
|
+
let _onButtonDown_extraInitializers = [];
|
|
57
|
+
let _onButtonUp_decorators;
|
|
58
|
+
let _onButtonUp_initializers = [];
|
|
59
|
+
let _onButtonUp_extraInitializers = [];
|
|
60
|
+
let _onButtonSouth_decorators;
|
|
61
|
+
let _onButtonSouth_initializers = [];
|
|
62
|
+
let _onButtonSouth_extraInitializers = [];
|
|
63
|
+
let _onButtonWest_decorators;
|
|
64
|
+
let _onButtonWest_initializers = [];
|
|
65
|
+
let _onButtonWest_extraInitializers = [];
|
|
66
|
+
let _onButtonNorth_decorators;
|
|
67
|
+
let _onButtonNorth_initializers = [];
|
|
68
|
+
let _onButtonNorth_extraInitializers = [];
|
|
69
|
+
let _onButtonEast_decorators;
|
|
70
|
+
let _onButtonEast_initializers = [];
|
|
71
|
+
let _onButtonEast_extraInitializers = [];
|
|
72
|
+
let _onButtonShoulderLeft_decorators;
|
|
73
|
+
let _onButtonShoulderLeft_initializers = [];
|
|
74
|
+
let _onButtonShoulderLeft_extraInitializers = [];
|
|
75
|
+
let _onButtonShoulderRight_decorators;
|
|
76
|
+
let _onButtonShoulderRight_initializers = [];
|
|
77
|
+
let _onButtonShoulderRight_extraInitializers = [];
|
|
78
|
+
let _onButtonTriggerLeft_decorators;
|
|
79
|
+
let _onButtonTriggerLeft_initializers = [];
|
|
80
|
+
let _onButtonTriggerLeft_extraInitializers = [];
|
|
81
|
+
let _onButtonTriggerRight_decorators;
|
|
82
|
+
let _onButtonTriggerRight_initializers = [];
|
|
83
|
+
let _onButtonTriggerRight_extraInitializers = [];
|
|
84
|
+
let _onButtonDLeft_decorators;
|
|
85
|
+
let _onButtonDLeft_initializers = [];
|
|
86
|
+
let _onButtonDLeft_extraInitializers = [];
|
|
87
|
+
let _onButtonDRight_decorators;
|
|
88
|
+
let _onButtonDRight_initializers = [];
|
|
89
|
+
let _onButtonDRight_extraInitializers = [];
|
|
90
|
+
let _onButtonDUp_decorators;
|
|
91
|
+
let _onButtonDUp_initializers = [];
|
|
92
|
+
let _onButtonDUp_extraInitializers = [];
|
|
93
|
+
let _onButtonDDown_decorators;
|
|
94
|
+
let _onButtonDDown_initializers = [];
|
|
95
|
+
let _onButtonDDown_extraInitializers = [];
|
|
96
|
+
let _onButtonSelect_decorators;
|
|
97
|
+
let _onButtonSelect_initializers = [];
|
|
98
|
+
let _onButtonSelect_extraInitializers = [];
|
|
99
|
+
let _onButtonStart_decorators;
|
|
100
|
+
let _onButtonStart_initializers = [];
|
|
101
|
+
let _onButtonStart_extraInitializers = [];
|
|
102
|
+
let _onButtonCenter_decorators;
|
|
103
|
+
let _onButtonCenter_initializers = [];
|
|
104
|
+
let _onButtonCenter_extraInitializers = [];
|
|
105
|
+
let _onButtonStickLeft_decorators;
|
|
106
|
+
let _onButtonStickLeft_initializers = [];
|
|
107
|
+
let _onButtonStickLeft_extraInitializers = [];
|
|
108
|
+
let _onButtonStickRight_decorators;
|
|
109
|
+
let _onButtonStickRight_initializers = [];
|
|
110
|
+
let _onButtonStickRight_extraInitializers = [];
|
|
111
|
+
let _controllerIndex_decorators;
|
|
112
|
+
let _controllerIndex_initializers = [];
|
|
113
|
+
let _controllerIndex_extraInitializers = [];
|
|
114
|
+
let _analogPressedThreshold_decorators;
|
|
115
|
+
let _analogPressedThreshold_initializers = [];
|
|
116
|
+
let _analogPressedThreshold_extraInitializers = [];
|
|
117
|
+
var Gamepad = class extends _classSuper {
|
|
118
|
+
static { _classThis = this; }
|
|
119
|
+
static {
|
|
120
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
121
|
+
_onButtonDown_decorators = [zUI()];
|
|
122
|
+
_onButtonUp_decorators = [zUI()];
|
|
123
|
+
_onButtonSouth_decorators = [zUI()];
|
|
124
|
+
_onButtonWest_decorators = [zUI()];
|
|
125
|
+
_onButtonNorth_decorators = [zUI()];
|
|
126
|
+
_onButtonEast_decorators = [zUI()];
|
|
127
|
+
_onButtonShoulderLeft_decorators = [zUI()];
|
|
128
|
+
_onButtonShoulderRight_decorators = [zUI()];
|
|
129
|
+
_onButtonTriggerLeft_decorators = [zUI()];
|
|
130
|
+
_onButtonTriggerRight_decorators = [zUI()];
|
|
131
|
+
_onButtonDLeft_decorators = [zUI()];
|
|
132
|
+
_onButtonDRight_decorators = [zUI()];
|
|
133
|
+
_onButtonDUp_decorators = [zUI()];
|
|
134
|
+
_onButtonDDown_decorators = [zUI()];
|
|
135
|
+
_onButtonSelect_decorators = [zUI()];
|
|
136
|
+
_onButtonStart_decorators = [zUI()];
|
|
137
|
+
_onButtonCenter_decorators = [zUI()];
|
|
138
|
+
_onButtonStickLeft_decorators = [zUI()];
|
|
139
|
+
_onButtonStickRight_decorators = [zUI()];
|
|
140
|
+
_controllerIndex_decorators = [zUI()];
|
|
141
|
+
_analogPressedThreshold_decorators = [zUI()];
|
|
142
|
+
__esDecorate(null, null, _onButtonDown_decorators, { kind: "field", name: "onButtonDown", static: false, private: false, access: { has: obj => "onButtonDown" in obj, get: obj => obj.onButtonDown, set: (obj, value) => { obj.onButtonDown = value; } }, metadata: _metadata }, _onButtonDown_initializers, _onButtonDown_extraInitializers);
|
|
143
|
+
__esDecorate(null, null, _onButtonUp_decorators, { kind: "field", name: "onButtonUp", static: false, private: false, access: { has: obj => "onButtonUp" in obj, get: obj => obj.onButtonUp, set: (obj, value) => { obj.onButtonUp = value; } }, metadata: _metadata }, _onButtonUp_initializers, _onButtonUp_extraInitializers);
|
|
144
|
+
__esDecorate(null, null, _onButtonSouth_decorators, { kind: "field", name: "onButtonSouth", static: false, private: false, access: { has: obj => "onButtonSouth" in obj, get: obj => obj.onButtonSouth, set: (obj, value) => { obj.onButtonSouth = value; } }, metadata: _metadata }, _onButtonSouth_initializers, _onButtonSouth_extraInitializers);
|
|
145
|
+
__esDecorate(null, null, _onButtonWest_decorators, { kind: "field", name: "onButtonWest", static: false, private: false, access: { has: obj => "onButtonWest" in obj, get: obj => obj.onButtonWest, set: (obj, value) => { obj.onButtonWest = value; } }, metadata: _metadata }, _onButtonWest_initializers, _onButtonWest_extraInitializers);
|
|
146
|
+
__esDecorate(null, null, _onButtonNorth_decorators, { kind: "field", name: "onButtonNorth", static: false, private: false, access: { has: obj => "onButtonNorth" in obj, get: obj => obj.onButtonNorth, set: (obj, value) => { obj.onButtonNorth = value; } }, metadata: _metadata }, _onButtonNorth_initializers, _onButtonNorth_extraInitializers);
|
|
147
|
+
__esDecorate(null, null, _onButtonEast_decorators, { kind: "field", name: "onButtonEast", static: false, private: false, access: { has: obj => "onButtonEast" in obj, get: obj => obj.onButtonEast, set: (obj, value) => { obj.onButtonEast = value; } }, metadata: _metadata }, _onButtonEast_initializers, _onButtonEast_extraInitializers);
|
|
148
|
+
__esDecorate(null, null, _onButtonShoulderLeft_decorators, { kind: "field", name: "onButtonShoulderLeft", static: false, private: false, access: { has: obj => "onButtonShoulderLeft" in obj, get: obj => obj.onButtonShoulderLeft, set: (obj, value) => { obj.onButtonShoulderLeft = value; } }, metadata: _metadata }, _onButtonShoulderLeft_initializers, _onButtonShoulderLeft_extraInitializers);
|
|
149
|
+
__esDecorate(null, null, _onButtonShoulderRight_decorators, { kind: "field", name: "onButtonShoulderRight", static: false, private: false, access: { has: obj => "onButtonShoulderRight" in obj, get: obj => obj.onButtonShoulderRight, set: (obj, value) => { obj.onButtonShoulderRight = value; } }, metadata: _metadata }, _onButtonShoulderRight_initializers, _onButtonShoulderRight_extraInitializers);
|
|
150
|
+
__esDecorate(null, null, _onButtonTriggerLeft_decorators, { kind: "field", name: "onButtonTriggerLeft", static: false, private: false, access: { has: obj => "onButtonTriggerLeft" in obj, get: obj => obj.onButtonTriggerLeft, set: (obj, value) => { obj.onButtonTriggerLeft = value; } }, metadata: _metadata }, _onButtonTriggerLeft_initializers, _onButtonTriggerLeft_extraInitializers);
|
|
151
|
+
__esDecorate(null, null, _onButtonTriggerRight_decorators, { kind: "field", name: "onButtonTriggerRight", static: false, private: false, access: { has: obj => "onButtonTriggerRight" in obj, get: obj => obj.onButtonTriggerRight, set: (obj, value) => { obj.onButtonTriggerRight = value; } }, metadata: _metadata }, _onButtonTriggerRight_initializers, _onButtonTriggerRight_extraInitializers);
|
|
152
|
+
__esDecorate(null, null, _onButtonDLeft_decorators, { kind: "field", name: "onButtonDLeft", static: false, private: false, access: { has: obj => "onButtonDLeft" in obj, get: obj => obj.onButtonDLeft, set: (obj, value) => { obj.onButtonDLeft = value; } }, metadata: _metadata }, _onButtonDLeft_initializers, _onButtonDLeft_extraInitializers);
|
|
153
|
+
__esDecorate(null, null, _onButtonDRight_decorators, { kind: "field", name: "onButtonDRight", static: false, private: false, access: { has: obj => "onButtonDRight" in obj, get: obj => obj.onButtonDRight, set: (obj, value) => { obj.onButtonDRight = value; } }, metadata: _metadata }, _onButtonDRight_initializers, _onButtonDRight_extraInitializers);
|
|
154
|
+
__esDecorate(null, null, _onButtonDUp_decorators, { kind: "field", name: "onButtonDUp", static: false, private: false, access: { has: obj => "onButtonDUp" in obj, get: obj => obj.onButtonDUp, set: (obj, value) => { obj.onButtonDUp = value; } }, metadata: _metadata }, _onButtonDUp_initializers, _onButtonDUp_extraInitializers);
|
|
155
|
+
__esDecorate(null, null, _onButtonDDown_decorators, { kind: "field", name: "onButtonDDown", static: false, private: false, access: { has: obj => "onButtonDDown" in obj, get: obj => obj.onButtonDDown, set: (obj, value) => { obj.onButtonDDown = value; } }, metadata: _metadata }, _onButtonDDown_initializers, _onButtonDDown_extraInitializers);
|
|
156
|
+
__esDecorate(null, null, _onButtonSelect_decorators, { kind: "field", name: "onButtonSelect", static: false, private: false, access: { has: obj => "onButtonSelect" in obj, get: obj => obj.onButtonSelect, set: (obj, value) => { obj.onButtonSelect = value; } }, metadata: _metadata }, _onButtonSelect_initializers, _onButtonSelect_extraInitializers);
|
|
157
|
+
__esDecorate(null, null, _onButtonStart_decorators, { kind: "field", name: "onButtonStart", static: false, private: false, access: { has: obj => "onButtonStart" in obj, get: obj => obj.onButtonStart, set: (obj, value) => { obj.onButtonStart = value; } }, metadata: _metadata }, _onButtonStart_initializers, _onButtonStart_extraInitializers);
|
|
158
|
+
__esDecorate(null, null, _onButtonCenter_decorators, { kind: "field", name: "onButtonCenter", static: false, private: false, access: { has: obj => "onButtonCenter" in obj, get: obj => obj.onButtonCenter, set: (obj, value) => { obj.onButtonCenter = value; } }, metadata: _metadata }, _onButtonCenter_initializers, _onButtonCenter_extraInitializers);
|
|
159
|
+
__esDecorate(null, null, _onButtonStickLeft_decorators, { kind: "field", name: "onButtonStickLeft", static: false, private: false, access: { has: obj => "onButtonStickLeft" in obj, get: obj => obj.onButtonStickLeft, set: (obj, value) => { obj.onButtonStickLeft = value; } }, metadata: _metadata }, _onButtonStickLeft_initializers, _onButtonStickLeft_extraInitializers);
|
|
160
|
+
__esDecorate(null, null, _onButtonStickRight_decorators, { kind: "field", name: "onButtonStickRight", static: false, private: false, access: { has: obj => "onButtonStickRight" in obj, get: obj => obj.onButtonStickRight, set: (obj, value) => { obj.onButtonStickRight = value; } }, metadata: _metadata }, _onButtonStickRight_initializers, _onButtonStickRight_extraInitializers);
|
|
161
|
+
__esDecorate(null, null, _controllerIndex_decorators, { kind: "field", name: "controllerIndex", static: false, private: false, access: { has: obj => "controllerIndex" in obj, get: obj => obj.controllerIndex, set: (obj, value) => { obj.controllerIndex = value; } }, metadata: _metadata }, _controllerIndex_initializers, _controllerIndex_extraInitializers);
|
|
162
|
+
__esDecorate(null, null, _analogPressedThreshold_decorators, { kind: "field", name: "analogPressedThreshold", static: false, private: false, access: { has: obj => "analogPressedThreshold" in obj, get: obj => obj.analogPressedThreshold, set: (obj, value) => { obj.analogPressedThreshold = value; } }, metadata: _metadata }, _analogPressedThreshold_initializers, _analogPressedThreshold_extraInitializers);
|
|
163
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
164
|
+
Gamepad = _classThis = _classDescriptor.value;
|
|
165
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
166
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
167
|
+
}
|
|
168
|
+
onButtonDown = __runInitializers(this, _onButtonDown_initializers, new Event());
|
|
169
|
+
onButtonUp = (__runInitializers(this, _onButtonDown_extraInitializers), __runInitializers(this, _onButtonUp_initializers, new Event()));
|
|
170
|
+
onButtonSouth = (__runInitializers(this, _onButtonUp_extraInitializers), __runInitializers(this, _onButtonSouth_initializers, new Event()));
|
|
171
|
+
onButtonWest = (__runInitializers(this, _onButtonSouth_extraInitializers), __runInitializers(this, _onButtonWest_initializers, new Event()));
|
|
172
|
+
onButtonNorth = (__runInitializers(this, _onButtonWest_extraInitializers), __runInitializers(this, _onButtonNorth_initializers, new Event()));
|
|
173
|
+
onButtonEast = (__runInitializers(this, _onButtonNorth_extraInitializers), __runInitializers(this, _onButtonEast_initializers, new Event()));
|
|
174
|
+
onButtonShoulderLeft = (__runInitializers(this, _onButtonEast_extraInitializers), __runInitializers(this, _onButtonShoulderLeft_initializers, new Event()));
|
|
175
|
+
onButtonShoulderRight = (__runInitializers(this, _onButtonShoulderLeft_extraInitializers), __runInitializers(this, _onButtonShoulderRight_initializers, new Event()));
|
|
176
|
+
onButtonTriggerLeft = (__runInitializers(this, _onButtonShoulderRight_extraInitializers), __runInitializers(this, _onButtonTriggerLeft_initializers, new Event()));
|
|
177
|
+
onButtonTriggerRight = (__runInitializers(this, _onButtonTriggerLeft_extraInitializers), __runInitializers(this, _onButtonTriggerRight_initializers, new Event()));
|
|
178
|
+
onButtonDLeft = (__runInitializers(this, _onButtonTriggerRight_extraInitializers), __runInitializers(this, _onButtonDLeft_initializers, new Event()));
|
|
179
|
+
onButtonDRight = (__runInitializers(this, _onButtonDLeft_extraInitializers), __runInitializers(this, _onButtonDRight_initializers, new Event()));
|
|
180
|
+
onButtonDUp = (__runInitializers(this, _onButtonDRight_extraInitializers), __runInitializers(this, _onButtonDUp_initializers, new Event()));
|
|
181
|
+
onButtonDDown = (__runInitializers(this, _onButtonDUp_extraInitializers), __runInitializers(this, _onButtonDDown_initializers, new Event()));
|
|
182
|
+
onButtonSelect = (__runInitializers(this, _onButtonDDown_extraInitializers), __runInitializers(this, _onButtonSelect_initializers, new Event()));
|
|
183
|
+
onButtonStart = (__runInitializers(this, _onButtonSelect_extraInitializers), __runInitializers(this, _onButtonStart_initializers, new Event()));
|
|
184
|
+
onButtonCenter = (__runInitializers(this, _onButtonStart_extraInitializers), __runInitializers(this, _onButtonCenter_initializers, new Event()));
|
|
185
|
+
onButtonStickLeft = (__runInitializers(this, _onButtonCenter_extraInitializers), __runInitializers(this, _onButtonStickLeft_initializers, new Event()));
|
|
186
|
+
onButtonStickRight = (__runInitializers(this, _onButtonStickLeft_extraInitializers), __runInitializers(this, _onButtonStickRight_initializers, new Event()));
|
|
187
|
+
/**
|
|
188
|
+
* @default []
|
|
189
|
+
*/
|
|
190
|
+
_indexMapping = (__runInitializers(this, _onButtonStickRight_extraInitializers), [
|
|
61
191
|
this.onButtonSouth,
|
|
62
192
|
this.onButtonEast,
|
|
63
193
|
this.onButtonWest,
|
|
@@ -75,35 +205,41 @@ export class Gamepad extends Component {
|
|
|
75
205
|
this.onButtonDLeft,
|
|
76
206
|
this.onButtonDRight,
|
|
77
207
|
this.onButtonCenter,
|
|
78
|
-
];
|
|
208
|
+
]);
|
|
209
|
+
controllerIndex = __runInitializers(this, _controllerIndex_initializers, undefined);
|
|
79
210
|
/**
|
|
80
|
-
* @
|
|
211
|
+
* @default 0.1
|
|
81
212
|
*/
|
|
82
|
-
|
|
213
|
+
analogPressedThreshold = (__runInitializers(this, _controllerIndex_extraInitializers), __runInitializers(this, _analogPressedThreshold_initializers, 0.1));
|
|
214
|
+
_downLastFrame = (__runInitializers(this, _analogPressedThreshold_extraInitializers), new Map());
|
|
83
215
|
/**
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
216
|
+
* Creates a new Gamepad component.
|
|
217
|
+
* @param contextManager - The current ContextManager
|
|
218
|
+
* @param props - The constructor properties.
|
|
86
219
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
220
|
+
constructor(contextManager, props) {
|
|
221
|
+
super(contextManager, props);
|
|
222
|
+
const environment = this.contextManager.get(EnvironmentContext);
|
|
223
|
+
this.register(environment.editTime, this._updateRegistration);
|
|
224
|
+
}
|
|
225
|
+
_updateRegistration = () => {
|
|
90
226
|
if (isEditTime(this.contextManager))
|
|
91
227
|
this.unregister(useOnBeforeRender(this.contextManager), this._update);
|
|
92
228
|
else
|
|
93
229
|
this.register(useOnBeforeRender(this.contextManager), this._update);
|
|
94
230
|
};
|
|
95
|
-
|
|
96
|
-
if (!this.enabledResolved
|
|
231
|
+
_update = () => {
|
|
232
|
+
if (!this.enabledResolved)
|
|
97
233
|
return;
|
|
98
234
|
const downEvents = [];
|
|
99
235
|
const upEvents = [];
|
|
100
236
|
const context = this.contextManager.get(GamepadContext);
|
|
101
|
-
context.forGamepadsMatchingIndex(this.controllerIndex
|
|
237
|
+
context.forGamepadsMatchingIndex(this.controllerIndex, gamepad => {
|
|
102
238
|
const downLastFrame = this._downLastFrame.get(gamepad.index) ?? new Set();
|
|
103
239
|
this._downLastFrame.set(gamepad.index, downLastFrame);
|
|
104
240
|
for (let i = 0; i < gamepad.buttons.length; i++) {
|
|
105
241
|
const button = gamepad.buttons[i];
|
|
106
|
-
const downThisFrame = button.pressed || button.value > this.analogPressedThreshold
|
|
242
|
+
const downThisFrame = button.pressed || button.value > this.analogPressedThreshold;
|
|
107
243
|
if (downThisFrame && !downLastFrame.has(i))
|
|
108
244
|
downEvents.push({
|
|
109
245
|
button: i,
|
|
@@ -134,7 +270,7 @@ export class Gamepad extends Component {
|
|
|
134
270
|
this.onButtonUp.emit(evt);
|
|
135
271
|
}
|
|
136
272
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
273
|
+
};
|
|
274
|
+
return Gamepad = _classThis;
|
|
275
|
+
})();
|
|
276
|
+
export { Gamepad };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, ConstructorProps } from '../component';
|
|
2
|
+
import { ContextManager } from '../context';
|
|
3
|
+
/**
|
|
4
|
+
* Forks the LoadContext so that children components can have their own loading scope. Use this to create custom loading views for specific parts of your experience by adding loadable components within this scope along with an AnimatedLoader or DefaultLoader.
|
|
5
|
+
* @zcomponent
|
|
6
|
+
* @zicon hourglass_bottom
|
|
7
|
+
* @zgroup Advanced
|
|
8
|
+
*/
|
|
9
|
+
export declare class LoaderScope extends Component {
|
|
10
|
+
/**
|
|
11
|
+
* @param contextManager - The current ContextManager
|
|
12
|
+
* @param props - The constructor properties.
|
|
13
|
+
*/
|
|
14
|
+
constructor(contextManager: ContextManager, props: ConstructorProps);
|
|
15
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
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
|
+
import { Component } from '../component';
|
|
36
|
+
import { LoadContext } from '../contexts/loadcontext';
|
|
37
|
+
import { zComponent } from '../decorators';
|
|
38
|
+
/**
|
|
39
|
+
* Forks the LoadContext so that children components can have their own loading scope. Use this to create custom loading views for specific parts of your experience by adding loadable components within this scope along with an AnimatedLoader or DefaultLoader.
|
|
40
|
+
* @zcomponent
|
|
41
|
+
* @zicon hourglass_bottom
|
|
42
|
+
* @zgroup Advanced
|
|
43
|
+
*/
|
|
44
|
+
let LoaderScope = (() => {
|
|
45
|
+
let _classDecorators = [zComponent({ icon: 'hourglass_bottom', group: 'Advanced' })];
|
|
46
|
+
let _classDescriptor;
|
|
47
|
+
let _classExtraInitializers = [];
|
|
48
|
+
let _classThis;
|
|
49
|
+
let _classSuper = Component;
|
|
50
|
+
var LoaderScope = class extends _classSuper {
|
|
51
|
+
static { _classThis = this; }
|
|
52
|
+
static {
|
|
53
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
54
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
55
|
+
LoaderScope = _classThis = _classDescriptor.value;
|
|
56
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
57
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param contextManager - The current ContextManager
|
|
61
|
+
* @param props - The constructor properties.
|
|
62
|
+
*/
|
|
63
|
+
constructor(contextManager, props) {
|
|
64
|
+
const [childContextManager, loadContext] = contextManager.fork(LoadContext);
|
|
65
|
+
loadContext.isLoaded.value = true;
|
|
66
|
+
super(childContextManager, props);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return LoaderScope = _classThis;
|
|
70
|
+
})();
|
|
71
|
+
export { LoaderScope };
|
|
@@ -1,49 +1,45 @@
|
|
|
1
|
-
import { Component, ContextManager, Event } from '..';
|
|
1
|
+
import { Component, ContextManager, Event, Time } from '..';
|
|
2
2
|
export interface LongLoadConstructorProps {
|
|
3
3
|
/**
|
|
4
4
|
* The number of loading processes to simulate
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @zgroup LongLoad
|
|
7
7
|
* @zgrouppriority 10
|
|
8
|
-
* @
|
|
8
|
+
* @default 10
|
|
9
9
|
*/
|
|
10
10
|
numberOfLoads?: number;
|
|
11
11
|
/**
|
|
12
12
|
* The shortest time (in milliseconds) that a given load should take
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* @zgroup LongLoad
|
|
15
15
|
* @zgrouppriority 10
|
|
16
|
-
* @
|
|
17
|
-
* @zdefault 500
|
|
16
|
+
* @default 500
|
|
18
17
|
*/
|
|
19
|
-
minimumLoadTime:
|
|
18
|
+
minimumLoadTime: Time<'milliseconds'>;
|
|
20
19
|
/**
|
|
21
20
|
* The shortest time (in milliseconds) that a given load should take
|
|
22
|
-
*
|
|
21
|
+
*
|
|
23
22
|
* @zgroup LongLoad
|
|
24
23
|
* @zgrouppriority 10
|
|
25
|
-
* @
|
|
26
|
-
* @zdefault 5000
|
|
24
|
+
* @default 5000
|
|
27
25
|
*/
|
|
28
|
-
maximumLoadTime:
|
|
26
|
+
maximumLoadTime: Time<'milliseconds'>;
|
|
29
27
|
/**
|
|
30
28
|
* If the long loading process should occur in production builds (in addition to development builds)
|
|
31
|
-
*
|
|
29
|
+
*
|
|
32
30
|
* @zgroup LongLoad
|
|
33
31
|
* @zgrouppriority 10
|
|
34
|
-
* @
|
|
32
|
+
* @default false
|
|
35
33
|
*/
|
|
36
34
|
runInProduction: boolean;
|
|
37
35
|
}
|
|
38
36
|
/**
|
|
39
37
|
* Simulates long random loading times to facilitate development and debugging of loading processes.
|
|
40
|
-
*
|
|
41
38
|
* @zcomponent
|
|
42
39
|
* @zicon settings
|
|
43
40
|
* @zgroup Advanced
|
|
44
41
|
*/
|
|
45
42
|
export declare class LongLoad extends Component<any, LongLoadConstructorProps> {
|
|
46
|
-
/** @zui */
|
|
47
43
|
readonly onLoad: Event<[]>;
|
|
48
44
|
/**
|
|
49
45
|
* Creates an instance of LongLoad.
|
|
@@ -1,44 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
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
|
+
import { Component, Event, isDevelopmentBuild, registerLoadable, zComponent, zUI } from '..';
|
|
2
36
|
/**
|
|
3
37
|
* Simulates long random loading times to facilitate development and debugging of loading processes.
|
|
4
|
-
*
|
|
5
38
|
* @zcomponent
|
|
6
39
|
* @zicon settings
|
|
7
40
|
* @zgroup Advanced
|
|
8
41
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
let LongLoad = (() => {
|
|
43
|
+
let _classDecorators = [zComponent({ icon: 'settings', group: 'Advanced' })];
|
|
44
|
+
let _classDescriptor;
|
|
45
|
+
let _classExtraInitializers = [];
|
|
46
|
+
let _classThis;
|
|
47
|
+
let _classSuper = Component;
|
|
48
|
+
let _onLoad_decorators;
|
|
49
|
+
let _onLoad_initializers = [];
|
|
50
|
+
let _onLoad_extraInitializers = [];
|
|
51
|
+
var LongLoad = class extends _classSuper {
|
|
52
|
+
static { _classThis = this; }
|
|
53
|
+
static {
|
|
54
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
55
|
+
_onLoad_decorators = [zUI()];
|
|
56
|
+
__esDecorate(null, null, _onLoad_decorators, { kind: "field", name: "onLoad", static: false, private: false, access: { has: obj => "onLoad" in obj, get: obj => obj.onLoad, set: (obj, value) => { obj.onLoad = value; } }, metadata: _metadata }, _onLoad_initializers, _onLoad_extraInitializers);
|
|
57
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
58
|
+
LongLoad = _classThis = _classDescriptor.value;
|
|
59
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
60
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
61
|
+
}
|
|
62
|
+
onLoad = __runInitializers(this, _onLoad_initializers, new Event());
|
|
63
|
+
/**
|
|
64
|
+
* Creates an instance of LongLoad.
|
|
65
|
+
* @param contextManager - The current ContextManager
|
|
66
|
+
* @param props - The constructor properties.
|
|
67
|
+
* @returns - A new LongLoad instance.
|
|
68
|
+
*/
|
|
69
|
+
constructor(contextManager, props) {
|
|
70
|
+
super(contextManager, props);
|
|
71
|
+
__runInitializers(this, _onLoad_extraInitializers);
|
|
72
|
+
if (!props.runInProduction && !isDevelopmentBuild(contextManager))
|
|
73
|
+
return;
|
|
74
|
+
const minimumLoadTime = props.minimumLoadTime ?? 500;
|
|
75
|
+
const maximumLoadTime = props.maximumLoadTime ?? 5000;
|
|
76
|
+
const all = [];
|
|
77
|
+
for (let i = 0; i < (props.numberOfLoads ?? 10); i++) {
|
|
78
|
+
const promise = new Promise(resolve => {
|
|
30
79
|
if (this.disposed)
|
|
31
80
|
return;
|
|
32
|
-
|
|
33
|
-
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
if (this.disposed)
|
|
83
|
+
return;
|
|
84
|
+
resolve();
|
|
85
|
+
}, minimumLoadTime + Math.random() * (maximumLoadTime - minimumLoadTime));
|
|
86
|
+
});
|
|
87
|
+
registerLoadable(this, promise);
|
|
88
|
+
all.push(promise);
|
|
89
|
+
}
|
|
90
|
+
Promise.all(all).then(() => {
|
|
91
|
+
if (this.disposed)
|
|
92
|
+
return;
|
|
93
|
+
this.onLoad.emit();
|
|
34
94
|
});
|
|
35
|
-
registerLoadable(contextManager, promise);
|
|
36
|
-
all.push(promise);
|
|
37
95
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
96
|
+
};
|
|
97
|
+
return LongLoad = _classThis;
|
|
98
|
+
})();
|
|
99
|
+
export { LongLoad };
|