@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,58 +1,70 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, ContextManager, ProjectFile } from '..';
|
|
2
2
|
export interface DefaultLoaderConstructorProps {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
4
|
* @zgroup Appearance
|
|
5
5
|
* @zgrouppriority 10
|
|
6
|
-
* @zvalues files *.+(jpg|jpeg|png|webp)
|
|
7
6
|
*/
|
|
8
|
-
backgroundImage:
|
|
7
|
+
backgroundImage: ProjectFile<'*.+(jpg|jpeg|png|webp)'>;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* The DefaultLoader shows a customizable loading bar while the assets of your experience are being downloaded and parsed by the browser.
|
|
12
|
-
*
|
|
13
11
|
* @zcomponent
|
|
14
|
-
* @zicon
|
|
12
|
+
* @zicon hourglass_bottom
|
|
15
13
|
* @zgroup Advanced
|
|
16
14
|
*/
|
|
17
15
|
export declare class DefaultLoader extends Component {
|
|
16
|
+
/**
|
|
17
|
+
* @zignore
|
|
18
|
+
*/
|
|
18
19
|
element: HTMLDivElement;
|
|
19
|
-
/**
|
|
20
|
-
* @
|
|
20
|
+
/**
|
|
21
|
+
* @default false
|
|
22
|
+
* @zui
|
|
21
23
|
* @zgroup Design Time
|
|
22
|
-
* @zgrouppriority 30
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
25
|
+
preview: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @default ""
|
|
28
|
+
* @zui
|
|
26
29
|
* @zgroup Text
|
|
27
|
-
* @zgrouppriority 20
|
|
28
30
|
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
+
title: string;
|
|
32
|
+
/**
|
|
33
|
+
* @default ""
|
|
34
|
+
* @zui
|
|
31
35
|
* @zgroup Text
|
|
32
|
-
* @zgrouppriority 20
|
|
33
36
|
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @
|
|
37
|
+
subtitle: string;
|
|
38
|
+
/**
|
|
39
|
+
* @default "#000000"
|
|
40
|
+
* @zui
|
|
37
41
|
* @zgroup Appearance
|
|
38
|
-
* @zgrouppriority 10
|
|
39
42
|
* @ztype color-hex
|
|
40
43
|
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @
|
|
44
|
+
backgroundColor: string;
|
|
45
|
+
/**
|
|
46
|
+
* @default "#ffffff"
|
|
47
|
+
* @zui
|
|
44
48
|
* @zgroup Appearance
|
|
45
|
-
* @zgrouppriority 10
|
|
46
49
|
* @ztype color-hex
|
|
47
50
|
*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @
|
|
51
|
+
textColor: string;
|
|
52
|
+
/**
|
|
53
|
+
* @default 1000
|
|
54
|
+
* @zui
|
|
55
|
+
* @zgroup Appearance
|
|
56
|
+
*/
|
|
57
|
+
zIndex: number;
|
|
58
|
+
/**
|
|
59
|
+
* @default false
|
|
60
|
+
* @zui
|
|
51
61
|
* @zgroup Appearance
|
|
52
|
-
* @zgrouppriority 10
|
|
53
62
|
*/
|
|
54
|
-
|
|
63
|
+
showIfLoadingAfterStart: boolean;
|
|
55
64
|
private _percentageElement;
|
|
65
|
+
/**
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
56
68
|
private _attached;
|
|
57
69
|
/**
|
|
58
70
|
* Creates a new DefaultLoader component.
|
|
@@ -1,36 +1,204 @@
|
|
|
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, isDesignTime, isStarted, useCanvas, useIsLoaded, useLoadPercent, zComponent, zIgnore, zObserve, zUI } from '..';
|
|
2
36
|
/**
|
|
3
37
|
* The DefaultLoader shows a customizable loading bar while the assets of your experience are being downloaded and parsed by the browser.
|
|
4
|
-
*
|
|
5
38
|
* @zcomponent
|
|
6
|
-
* @zicon
|
|
39
|
+
* @zicon hourglass_bottom
|
|
7
40
|
* @zgroup Advanced
|
|
8
41
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
let DefaultLoader = (() => {
|
|
43
|
+
let _classDecorators = [zComponent({ icon: 'hourglass_bottom', group: 'Advanced' })];
|
|
44
|
+
let _classDescriptor;
|
|
45
|
+
let _classExtraInitializers = [];
|
|
46
|
+
let _classThis;
|
|
47
|
+
let _classSuper = Component;
|
|
48
|
+
let _element_decorators;
|
|
49
|
+
let _element_initializers = [];
|
|
50
|
+
let _element_extraInitializers = [];
|
|
51
|
+
let _preview_decorators;
|
|
52
|
+
let _preview_initializers = [];
|
|
53
|
+
let _preview_extraInitializers = [];
|
|
54
|
+
let _title_decorators;
|
|
55
|
+
let _title_initializers = [];
|
|
56
|
+
let _title_extraInitializers = [];
|
|
57
|
+
let _subtitle_decorators;
|
|
58
|
+
let _subtitle_initializers = [];
|
|
59
|
+
let _subtitle_extraInitializers = [];
|
|
60
|
+
let _backgroundColor_decorators;
|
|
61
|
+
let _backgroundColor_initializers = [];
|
|
62
|
+
let _backgroundColor_extraInitializers = [];
|
|
63
|
+
let _textColor_decorators;
|
|
64
|
+
let _textColor_initializers = [];
|
|
65
|
+
let _textColor_extraInitializers = [];
|
|
66
|
+
let _zIndex_decorators;
|
|
67
|
+
let _zIndex_initializers = [];
|
|
68
|
+
let _zIndex_extraInitializers = [];
|
|
69
|
+
let _showIfLoadingAfterStart_decorators;
|
|
70
|
+
let _showIfLoadingAfterStart_initializers = [];
|
|
71
|
+
let _showIfLoadingAfterStart_extraInitializers = [];
|
|
72
|
+
var DefaultLoader = class extends _classSuper {
|
|
73
|
+
static { _classThis = this; }
|
|
74
|
+
static {
|
|
75
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
76
|
+
_element_decorators = [zIgnore()];
|
|
77
|
+
_preview_decorators = [zUI({ group: 'Design Time', priority: 30 }), zObserve(function () {
|
|
78
|
+
this._updateVisibility();
|
|
79
|
+
})];
|
|
80
|
+
_title_decorators = [zUI({ group: 'Text', priority: 20 }), zObserve(function (value) {
|
|
81
|
+
const titleElement = this.element.querySelector('#zcomponent-defaultloader-title');
|
|
82
|
+
if (titleElement)
|
|
83
|
+
titleElement.innerText = value;
|
|
84
|
+
})];
|
|
85
|
+
_subtitle_decorators = [zUI({ group: 'Text', priority: 20 }), zObserve(function (value) {
|
|
86
|
+
const subtitleElement = this.element.querySelector('#zcomponent-defaultloader-subtitle');
|
|
87
|
+
if (subtitleElement)
|
|
88
|
+
subtitleElement.innerText = value;
|
|
89
|
+
})];
|
|
90
|
+
_backgroundColor_decorators = [zUI({ group: 'Appearance', priority: 10, type: 'color-hex' }), zObserve(function (value) {
|
|
91
|
+
this.element.style.backgroundColor = value;
|
|
92
|
+
})];
|
|
93
|
+
_textColor_decorators = [zUI({ group: 'Appearance', priority: 10, type: 'color-hex' }), zObserve(function (value) {
|
|
94
|
+
this.element.style.color = value;
|
|
95
|
+
})];
|
|
96
|
+
_zIndex_decorators = [zUI({ group: 'Appearance', priority: 10 }), zObserve(function (value) {
|
|
97
|
+
this.element.style.zIndex = value.toString();
|
|
98
|
+
})];
|
|
99
|
+
_showIfLoadingAfterStart_decorators = [zUI({ group: 'Appearance', priority: 10 }), zObserve((v, instance) => () => instance._updateVisibility())];
|
|
100
|
+
__esDecorate(null, null, _element_decorators, { kind: "field", name: "element", static: false, private: false, access: { has: obj => "element" in obj, get: obj => obj.element, set: (obj, value) => { obj.element = value; } }, metadata: _metadata }, _element_initializers, _element_extraInitializers);
|
|
101
|
+
__esDecorate(null, null, _preview_decorators, { kind: "field", name: "preview", static: false, private: false, access: { has: obj => "preview" in obj, get: obj => obj.preview, set: (obj, value) => { obj.preview = value; } }, metadata: _metadata }, _preview_initializers, _preview_extraInitializers);
|
|
102
|
+
__esDecorate(null, null, _title_decorators, { kind: "field", name: "title", static: false, private: false, access: { has: obj => "title" in obj, get: obj => obj.title, set: (obj, value) => { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
|
|
103
|
+
__esDecorate(null, null, _subtitle_decorators, { kind: "field", name: "subtitle", static: false, private: false, access: { has: obj => "subtitle" in obj, get: obj => obj.subtitle, set: (obj, value) => { obj.subtitle = value; } }, metadata: _metadata }, _subtitle_initializers, _subtitle_extraInitializers);
|
|
104
|
+
__esDecorate(null, null, _backgroundColor_decorators, { kind: "field", name: "backgroundColor", static: false, private: false, access: { has: obj => "backgroundColor" in obj, get: obj => obj.backgroundColor, set: (obj, value) => { obj.backgroundColor = value; } }, metadata: _metadata }, _backgroundColor_initializers, _backgroundColor_extraInitializers);
|
|
105
|
+
__esDecorate(null, null, _textColor_decorators, { kind: "field", name: "textColor", static: false, private: false, access: { has: obj => "textColor" in obj, get: obj => obj.textColor, set: (obj, value) => { obj.textColor = value; } }, metadata: _metadata }, _textColor_initializers, _textColor_extraInitializers);
|
|
106
|
+
__esDecorate(null, null, _zIndex_decorators, { kind: "field", name: "zIndex", static: false, private: false, access: { has: obj => "zIndex" in obj, get: obj => obj.zIndex, set: (obj, value) => { obj.zIndex = value; } }, metadata: _metadata }, _zIndex_initializers, _zIndex_extraInitializers);
|
|
107
|
+
__esDecorate(null, null, _showIfLoadingAfterStart_decorators, { kind: "field", name: "showIfLoadingAfterStart", static: false, private: false, access: { has: obj => "showIfLoadingAfterStart" in obj, get: obj => obj.showIfLoadingAfterStart, set: (obj, value) => { obj.showIfLoadingAfterStart = value; } }, metadata: _metadata }, _showIfLoadingAfterStart_initializers, _showIfLoadingAfterStart_extraInitializers);
|
|
108
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
109
|
+
DefaultLoader = _classThis = _classDescriptor.value;
|
|
110
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
111
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @zignore
|
|
115
|
+
*/
|
|
116
|
+
element = __runInitializers(this, _element_initializers, document.createElement('div'));
|
|
117
|
+
/**
|
|
118
|
+
* @default false
|
|
119
|
+
* @zui
|
|
20
120
|
* @zgroup Design Time
|
|
21
|
-
* @zgrouppriority 30
|
|
22
121
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
122
|
+
preview = (__runInitializers(this, _element_extraInitializers), __runInitializers(this, _preview_initializers, false));
|
|
123
|
+
/**
|
|
124
|
+
* @default ""
|
|
125
|
+
* @zui
|
|
126
|
+
* @zgroup Text
|
|
127
|
+
*/
|
|
128
|
+
title = (__runInitializers(this, _preview_extraInitializers), __runInitializers(this, _title_initializers, ''));
|
|
129
|
+
/**
|
|
130
|
+
* @default ""
|
|
131
|
+
* @zui
|
|
132
|
+
* @zgroup Text
|
|
133
|
+
*/
|
|
134
|
+
subtitle = (__runInitializers(this, _title_extraInitializers), __runInitializers(this, _subtitle_initializers, ''));
|
|
135
|
+
/**
|
|
136
|
+
* @default "#000000"
|
|
137
|
+
* @zui
|
|
138
|
+
* @zgroup Appearance
|
|
139
|
+
* @ztype color-hex
|
|
140
|
+
*/
|
|
141
|
+
backgroundColor = (__runInitializers(this, _subtitle_extraInitializers), __runInitializers(this, _backgroundColor_initializers, '#000000'));
|
|
142
|
+
/**
|
|
143
|
+
* @default "#ffffff"
|
|
144
|
+
* @zui
|
|
145
|
+
* @zgroup Appearance
|
|
146
|
+
* @ztype color-hex
|
|
147
|
+
*/
|
|
148
|
+
textColor = (__runInitializers(this, _backgroundColor_extraInitializers), __runInitializers(this, _textColor_initializers, '#ffffff'));
|
|
149
|
+
/**
|
|
150
|
+
* @default 1000
|
|
151
|
+
* @zui
|
|
152
|
+
* @zgroup Appearance
|
|
153
|
+
*/
|
|
154
|
+
zIndex = (__runInitializers(this, _textColor_extraInitializers), __runInitializers(this, _zIndex_initializers, 1000));
|
|
155
|
+
/**
|
|
156
|
+
* @default false
|
|
157
|
+
* @zui
|
|
158
|
+
* @zgroup Appearance
|
|
159
|
+
*/
|
|
160
|
+
showIfLoadingAfterStart = (__runInitializers(this, _zIndex_extraInitializers), __runInitializers(this, _showIfLoadingAfterStart_initializers, false));
|
|
161
|
+
_percentageElement = __runInitializers(this, _showIfLoadingAfterStart_extraInitializers);
|
|
162
|
+
/**
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
_attached = false;
|
|
166
|
+
/**
|
|
167
|
+
* Creates a new DefaultLoader component.
|
|
168
|
+
* @param contextManager - The current ContextManager
|
|
169
|
+
* @param constructorProps - The constructor properties.
|
|
170
|
+
*/
|
|
171
|
+
constructor(contextManager, constructorProps) {
|
|
172
|
+
super(contextManager, constructorProps);
|
|
173
|
+
this.element.innerHTML = loaderHTML;
|
|
174
|
+
this.element.className = 'zcomponent-defaultloader';
|
|
175
|
+
if (constructorProps.backgroundImage)
|
|
176
|
+
this.element.style.backgroundImage = `url(${constructorProps.backgroundImage})`;
|
|
177
|
+
const titleElement = this.element.querySelector('#zcomponent-defaultloader-title') || document.createElement('h1');
|
|
178
|
+
const subtitleElement = this.element.querySelector('#zcomponent-defaultloader-subtitle') || document.createElement('h1');
|
|
179
|
+
this._percentageElement = this.element.querySelector('#zcomponent-defaultloader-progress-percentage') || document.createElement('div');
|
|
180
|
+
// Set initial values
|
|
181
|
+
if (this.title)
|
|
182
|
+
titleElement.innerText = this.title;
|
|
183
|
+
if (this.subtitle)
|
|
184
|
+
subtitleElement.innerText = this.subtitle;
|
|
185
|
+
this.element.style.color = this.textColor;
|
|
186
|
+
this.element.style.backgroundColor = this.backgroundColor;
|
|
187
|
+
this.element.style.zIndex = this.zIndex.toString();
|
|
188
|
+
// Register event handlers
|
|
189
|
+
this.register(useIsLoaded(contextManager), this._updateVisibility);
|
|
190
|
+
this.register(useLoadPercent(contextManager), this._updatePercentage);
|
|
191
|
+
this._update();
|
|
192
|
+
}
|
|
193
|
+
_updatePercentage = () => {
|
|
194
|
+
const p = isDesignTime(this.contextManager) && this.preview ? 30 : useLoadPercent(this.contextManager).value;
|
|
27
195
|
this._percentageElement.style.width = p.toString() + '%';
|
|
28
196
|
};
|
|
29
|
-
|
|
197
|
+
_updateVisibility = () => {
|
|
30
198
|
let shouldBeAttached = false;
|
|
31
|
-
if (!isDesignTime(this.contextManager) && !useIsLoaded(this.contextManager).value && !isStarted(this.contextManager))
|
|
199
|
+
if (!isDesignTime(this.contextManager) && !useIsLoaded(this.contextManager).value && (!isStarted(this.contextManager) || this.showIfLoadingAfterStart))
|
|
32
200
|
shouldBeAttached = true;
|
|
33
|
-
if (isDesignTime(this.contextManager) && this.preview
|
|
201
|
+
if (isDesignTime(this.contextManager) && this.preview)
|
|
34
202
|
shouldBeAttached = true;
|
|
35
203
|
if (!this._attached && shouldBeAttached) {
|
|
36
204
|
document.body.appendChild(this.element);
|
|
@@ -41,7 +209,7 @@ export class DefaultLoader extends Component {
|
|
|
41
209
|
this._attached = false;
|
|
42
210
|
}
|
|
43
211
|
};
|
|
44
|
-
|
|
212
|
+
_update = () => {
|
|
45
213
|
if (this.disposed)
|
|
46
214
|
return;
|
|
47
215
|
const rect = useCanvas(this.contextManager).getBoundingClientRect();
|
|
@@ -51,30 +219,14 @@ export class DefaultLoader extends Component {
|
|
|
51
219
|
this.element.style.height = rect.height.toString() + 'px';
|
|
52
220
|
requestAnimationFrame(this._update);
|
|
53
221
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.element.style.backgroundImage = `url(${constructorProps.backgroundImage})`;
|
|
222
|
+
dispose() {
|
|
223
|
+
this.element.remove();
|
|
224
|
+
return super.dispose();
|
|
58
225
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.subtitle = new Observable('', t => (subtitleElement.innerText = t));
|
|
64
|
-
this.textColor = new Observable('#ffffff', t => (this.element.style.color = t));
|
|
65
|
-
this.backgroundColor = new Observable('#000000', t => (this.element.style.backgroundColor = t));
|
|
66
|
-
this.zIndex = new Observable(1000, t => (this.element.style.zIndex = t.toString()));
|
|
67
|
-
this.register(this.preview, this._updatePercentage);
|
|
68
|
-
this.register(this.preview, this._updateVisibility);
|
|
69
|
-
this.register(useIsLoaded(contextManager), this._updateVisibility);
|
|
70
|
-
this.register(useLoadPercent(contextManager), this._updatePercentage);
|
|
71
|
-
this._update();
|
|
72
|
-
}
|
|
73
|
-
dispose() {
|
|
74
|
-
this.element.remove();
|
|
75
|
-
return super.dispose();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
226
|
+
};
|
|
227
|
+
return DefaultLoader = _classThis;
|
|
228
|
+
})();
|
|
229
|
+
export { DefaultLoader };
|
|
78
230
|
const loaderHTML = `
|
|
79
231
|
<div id="zcomponent-defaultloader-container">
|
|
80
232
|
<h1 id="zcomponent-defaultloader-title"></h1>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Component } from '../component';
|
|
2
2
|
import { ContextManager } from '../context';
|
|
3
3
|
import { Event } from '../event';
|
|
4
|
-
import { Observable } from '../observable';
|
|
5
4
|
export interface GamepadButtonEvent {
|
|
6
5
|
button: number;
|
|
7
6
|
gamepad: number;
|
|
@@ -17,54 +16,34 @@ export interface GamepadButtonEvent {
|
|
|
17
16
|
* @zicon sports_esports
|
|
18
17
|
*/
|
|
19
18
|
export declare class Gamepad extends Component {
|
|
20
|
-
/** @zprop */
|
|
21
19
|
readonly onButtonDown: Event<[GamepadButtonEvent]>;
|
|
22
|
-
/** @zprop */
|
|
23
20
|
readonly onButtonUp: Event<[GamepadButtonEvent]>;
|
|
24
|
-
/** @zprop */
|
|
25
21
|
readonly onButtonSouth: Event<[GamepadButtonEvent]>;
|
|
26
|
-
/** @zprop */
|
|
27
22
|
readonly onButtonWest: Event<[GamepadButtonEvent]>;
|
|
28
|
-
/** @zprop */
|
|
29
23
|
readonly onButtonNorth: Event<[GamepadButtonEvent]>;
|
|
30
|
-
/** @zprop */
|
|
31
24
|
readonly onButtonEast: Event<[GamepadButtonEvent]>;
|
|
32
|
-
/** @zprop */
|
|
33
25
|
readonly onButtonShoulderLeft: Event<[GamepadButtonEvent]>;
|
|
34
|
-
/** @zprop */
|
|
35
26
|
readonly onButtonShoulderRight: Event<[GamepadButtonEvent]>;
|
|
36
|
-
/** @zprop */
|
|
37
27
|
readonly onButtonTriggerLeft: Event<[GamepadButtonEvent]>;
|
|
38
|
-
/** @zprop */
|
|
39
28
|
readonly onButtonTriggerRight: Event<[GamepadButtonEvent]>;
|
|
40
|
-
/** @zprop */
|
|
41
29
|
readonly onButtonDLeft: Event<[GamepadButtonEvent]>;
|
|
42
|
-
/** @zprop */
|
|
43
30
|
readonly onButtonDRight: Event<[GamepadButtonEvent]>;
|
|
44
|
-
/** @zprop */
|
|
45
31
|
readonly onButtonDUp: Event<[GamepadButtonEvent]>;
|
|
46
|
-
/** @zprop */
|
|
47
32
|
readonly onButtonDDown: Event<[GamepadButtonEvent]>;
|
|
48
|
-
/** @zprop */
|
|
49
33
|
readonly onButtonSelect: Event<[GamepadButtonEvent]>;
|
|
50
|
-
/** @zprop */
|
|
51
34
|
readonly onButtonStart: Event<[GamepadButtonEvent]>;
|
|
52
|
-
/** @zprop */
|
|
53
35
|
readonly onButtonCenter: Event<[GamepadButtonEvent]>;
|
|
54
|
-
/** @zprop */
|
|
55
36
|
readonly onButtonStickLeft: Event<[GamepadButtonEvent]>;
|
|
56
|
-
/** @zprop */
|
|
57
37
|
readonly onButtonStickRight: Event<[GamepadButtonEvent]>;
|
|
58
|
-
private _indexMapping;
|
|
59
38
|
/**
|
|
60
|
-
* @
|
|
39
|
+
* @default []
|
|
61
40
|
*/
|
|
62
|
-
|
|
41
|
+
private _indexMapping;
|
|
42
|
+
controllerIndex?: number;
|
|
63
43
|
/**
|
|
64
|
-
* @
|
|
65
|
-
* @zdefault 0.1
|
|
44
|
+
* @default 0.1
|
|
66
45
|
*/
|
|
67
|
-
|
|
46
|
+
analogPressedThreshold: number;
|
|
68
47
|
private _downLastFrame;
|
|
69
48
|
/**
|
|
70
49
|
* Creates a new Gamepad component.
|