@zcomponent/core 2.0.0-alpha.2 → 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/animation/layer.js +5 -0
- package/lib/animation/tracks/streamtrack.js +12 -1
- 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 +84 -84
|
@@ -32,33 +32,47 @@ export declare class LoadContext extends Context {
|
|
|
32
32
|
/**
|
|
33
33
|
* Observable indicating whether the root component's construction is complete.
|
|
34
34
|
* This is typically set to true immediately after the root component and its children are constructed.
|
|
35
|
+
* @zui
|
|
35
36
|
*/
|
|
36
37
|
readonly isConstructed: Observable<boolean, never>;
|
|
37
38
|
/**
|
|
38
39
|
* Observable indicating whether all loadable processes have completed.
|
|
39
40
|
* This is true when all assets and dependencies required for the experience are fully loaded.
|
|
41
|
+
* @zui
|
|
40
42
|
*/
|
|
41
43
|
readonly isLoaded: Observable<boolean, never>;
|
|
42
44
|
/**
|
|
43
45
|
* Observable indicating whether the experience has started.
|
|
44
46
|
* This becomes true at the point where the experience transitions from loading to active interaction.
|
|
47
|
+
* @zui
|
|
45
48
|
*/
|
|
46
49
|
readonly isStarted: Observable<boolean, never>;
|
|
47
50
|
/**
|
|
48
51
|
* Observable indicating whether the experience has been launched.
|
|
49
52
|
* This is set to true typically when the user interacts with a splash screen or an initial launch button.
|
|
53
|
+
* @zui
|
|
50
54
|
*/
|
|
51
55
|
readonly isLaunched: Observable<boolean, never>;
|
|
52
56
|
/**
|
|
53
57
|
* Observable representing the progress percentage of loadable processes.
|
|
54
58
|
* This provides a numerical value representing the completion percentage of all loading operations.
|
|
59
|
+
* @zui
|
|
55
60
|
*/
|
|
56
61
|
readonly progressPercent: Observable<number, never>;
|
|
57
62
|
private _startedResolved;
|
|
63
|
+
/**
|
|
64
|
+
* @zignore
|
|
65
|
+
*/
|
|
58
66
|
readonly started: Promise<void>;
|
|
59
67
|
private _constructedResolved;
|
|
68
|
+
/**
|
|
69
|
+
* @zignore
|
|
70
|
+
*/
|
|
60
71
|
readonly constructed: Promise<void>;
|
|
61
72
|
private _launchedResolved;
|
|
73
|
+
/**
|
|
74
|
+
* @zignore
|
|
75
|
+
*/
|
|
62
76
|
readonly launched: Promise<void>;
|
|
63
77
|
private _loadables;
|
|
64
78
|
/**
|
|
@@ -75,23 +89,28 @@ export declare class LoadContext extends Context {
|
|
|
75
89
|
private _loadedCount;
|
|
76
90
|
/**
|
|
77
91
|
* Start the experience.
|
|
92
|
+
* @zignore
|
|
78
93
|
*/
|
|
79
94
|
start(): void;
|
|
80
95
|
/**
|
|
81
96
|
* Called when the root component's constructor (and thus any recursive children) has finished.
|
|
97
|
+
* @zignore
|
|
82
98
|
*/
|
|
83
99
|
constructionComplete(): void;
|
|
84
100
|
/**
|
|
85
101
|
* Called when the user taps on a splash screen's 'launch' button or, in the case that there's no launch
|
|
102
|
+
* @zignore
|
|
86
103
|
*/
|
|
87
104
|
launch(): void;
|
|
88
105
|
private _update;
|
|
89
106
|
/**
|
|
90
107
|
* Start the experience when all loadables have completed.
|
|
108
|
+
* @zignore
|
|
91
109
|
*/
|
|
92
110
|
startWhenLoaded(): void;
|
|
93
111
|
/**
|
|
94
112
|
* Register a loadable process.
|
|
113
|
+
* @zignore
|
|
95
114
|
*/
|
|
96
115
|
registerLoadable(p: Promise<any>, entity?: Entity): void;
|
|
97
116
|
}
|
|
@@ -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,15 +32,8 @@ 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 { Entity } from '../entity';
|
|
38
38
|
import { Observable } from '../observable';
|
|
39
39
|
/**
|
|
@@ -65,6 +65,7 @@ import { Observable } from '../observable';
|
|
|
65
65
|
* @zcontext */
|
|
66
66
|
let LoadContext = (() => {
|
|
67
67
|
let _classSuper = Context;
|
|
68
|
+
let _instanceExtraInitializers = [];
|
|
68
69
|
let _isConstructed_decorators;
|
|
69
70
|
let _isConstructed_initializers = [];
|
|
70
71
|
let _isConstructed_extraInitializers = [];
|
|
@@ -80,6 +81,20 @@ let LoadContext = (() => {
|
|
|
80
81
|
let _progressPercent_decorators;
|
|
81
82
|
let _progressPercent_initializers = [];
|
|
82
83
|
let _progressPercent_extraInitializers = [];
|
|
84
|
+
let _started_decorators;
|
|
85
|
+
let _started_initializers = [];
|
|
86
|
+
let _started_extraInitializers = [];
|
|
87
|
+
let _constructed_decorators;
|
|
88
|
+
let _constructed_initializers = [];
|
|
89
|
+
let _constructed_extraInitializers = [];
|
|
90
|
+
let _launched_decorators;
|
|
91
|
+
let _launched_initializers = [];
|
|
92
|
+
let _launched_extraInitializers = [];
|
|
93
|
+
let _start_decorators;
|
|
94
|
+
let _constructionComplete_decorators;
|
|
95
|
+
let _launch_decorators;
|
|
96
|
+
let _startWhenLoaded_decorators;
|
|
97
|
+
let _registerLoadable_decorators;
|
|
83
98
|
return class LoadContext extends _classSuper {
|
|
84
99
|
static {
|
|
85
100
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -88,51 +103,81 @@ let LoadContext = (() => {
|
|
|
88
103
|
_isStarted_decorators = [zUI()];
|
|
89
104
|
_isLaunched_decorators = [zUI()];
|
|
90
105
|
_progressPercent_decorators = [zUI()];
|
|
106
|
+
_started_decorators = [zIgnore()];
|
|
107
|
+
_constructed_decorators = [zIgnore()];
|
|
108
|
+
_launched_decorators = [zIgnore()];
|
|
109
|
+
_start_decorators = [zIgnore()];
|
|
110
|
+
_constructionComplete_decorators = [zIgnore()];
|
|
111
|
+
_launch_decorators = [zIgnore()];
|
|
112
|
+
_startWhenLoaded_decorators = [zIgnore()];
|
|
113
|
+
_registerLoadable_decorators = [zIgnore()];
|
|
114
|
+
__esDecorate(this, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: obj => "start" in obj, get: obj => obj.start }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
115
|
+
__esDecorate(this, null, _constructionComplete_decorators, { kind: "method", name: "constructionComplete", static: false, private: false, access: { has: obj => "constructionComplete" in obj, get: obj => obj.constructionComplete }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
116
|
+
__esDecorate(this, null, _launch_decorators, { kind: "method", name: "launch", static: false, private: false, access: { has: obj => "launch" in obj, get: obj => obj.launch }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
117
|
+
__esDecorate(this, null, _startWhenLoaded_decorators, { kind: "method", name: "startWhenLoaded", static: false, private: false, access: { has: obj => "startWhenLoaded" in obj, get: obj => obj.startWhenLoaded }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
118
|
+
__esDecorate(this, null, _registerLoadable_decorators, { kind: "method", name: "registerLoadable", static: false, private: false, access: { has: obj => "registerLoadable" in obj, get: obj => obj.registerLoadable }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
91
119
|
__esDecorate(null, null, _isConstructed_decorators, { kind: "field", name: "isConstructed", static: false, private: false, access: { has: obj => "isConstructed" in obj, get: obj => obj.isConstructed, set: (obj, value) => { obj.isConstructed = value; } }, metadata: _metadata }, _isConstructed_initializers, _isConstructed_extraInitializers);
|
|
92
120
|
__esDecorate(null, null, _isLoaded_decorators, { kind: "field", name: "isLoaded", static: false, private: false, access: { has: obj => "isLoaded" in obj, get: obj => obj.isLoaded, set: (obj, value) => { obj.isLoaded = value; } }, metadata: _metadata }, _isLoaded_initializers, _isLoaded_extraInitializers);
|
|
93
121
|
__esDecorate(null, null, _isStarted_decorators, { kind: "field", name: "isStarted", static: false, private: false, access: { has: obj => "isStarted" in obj, get: obj => obj.isStarted, set: (obj, value) => { obj.isStarted = value; } }, metadata: _metadata }, _isStarted_initializers, _isStarted_extraInitializers);
|
|
94
122
|
__esDecorate(null, null, _isLaunched_decorators, { kind: "field", name: "isLaunched", static: false, private: false, access: { has: obj => "isLaunched" in obj, get: obj => obj.isLaunched, set: (obj, value) => { obj.isLaunched = value; } }, metadata: _metadata }, _isLaunched_initializers, _isLaunched_extraInitializers);
|
|
95
123
|
__esDecorate(null, null, _progressPercent_decorators, { kind: "field", name: "progressPercent", static: false, private: false, access: { has: obj => "progressPercent" in obj, get: obj => obj.progressPercent, set: (obj, value) => { obj.progressPercent = value; } }, metadata: _metadata }, _progressPercent_initializers, _progressPercent_extraInitializers);
|
|
124
|
+
__esDecorate(null, null, _started_decorators, { kind: "field", name: "started", static: false, private: false, access: { has: obj => "started" in obj, get: obj => obj.started, set: (obj, value) => { obj.started = value; } }, metadata: _metadata }, _started_initializers, _started_extraInitializers);
|
|
125
|
+
__esDecorate(null, null, _constructed_decorators, { kind: "field", name: "constructed", static: false, private: false, access: { has: obj => "constructed" in obj, get: obj => obj.constructed, set: (obj, value) => { obj.constructed = value; } }, metadata: _metadata }, _constructed_initializers, _constructed_extraInitializers);
|
|
126
|
+
__esDecorate(null, null, _launched_decorators, { kind: "field", name: "launched", static: false, private: false, access: { has: obj => "launched" in obj, get: obj => obj.launched, set: (obj, value) => { obj.launched = value; } }, metadata: _metadata }, _launched_initializers, _launched_extraInitializers);
|
|
96
127
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
97
128
|
}
|
|
98
129
|
/**
|
|
99
130
|
* Observable indicating whether the root component's construction is complete.
|
|
100
131
|
* This is typically set to true immediately after the root component and its children are constructed.
|
|
132
|
+
* @zui
|
|
101
133
|
*/
|
|
102
|
-
isConstructed = __runInitializers(this, _isConstructed_initializers, new Observable(false));
|
|
134
|
+
isConstructed = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _isConstructed_initializers, new Observable(false)));
|
|
103
135
|
/**
|
|
104
136
|
* Observable indicating whether all loadable processes have completed.
|
|
105
137
|
* This is true when all assets and dependencies required for the experience are fully loaded.
|
|
138
|
+
* @zui
|
|
106
139
|
*/
|
|
107
140
|
isLoaded = (__runInitializers(this, _isConstructed_extraInitializers), __runInitializers(this, _isLoaded_initializers, new Observable(false)));
|
|
108
141
|
/**
|
|
109
142
|
* Observable indicating whether the experience has started.
|
|
110
143
|
* This becomes true at the point where the experience transitions from loading to active interaction.
|
|
144
|
+
* @zui
|
|
111
145
|
*/
|
|
112
146
|
isStarted = (__runInitializers(this, _isLoaded_extraInitializers), __runInitializers(this, _isStarted_initializers, new Observable(false)));
|
|
113
147
|
/**
|
|
114
148
|
* Observable indicating whether the experience has been launched.
|
|
115
149
|
* This is set to true typically when the user interacts with a splash screen or an initial launch button.
|
|
150
|
+
* @zui
|
|
116
151
|
*/
|
|
117
152
|
isLaunched = (__runInitializers(this, _isStarted_extraInitializers), __runInitializers(this, _isLaunched_initializers, new Observable(false)));
|
|
118
153
|
/**
|
|
119
154
|
* Observable representing the progress percentage of loadable processes.
|
|
120
155
|
* This provides a numerical value representing the completion percentage of all loading operations.
|
|
156
|
+
* @zui
|
|
121
157
|
*/
|
|
122
158
|
progressPercent = (__runInitializers(this, _isLaunched_extraInitializers), __runInitializers(this, _progressPercent_initializers, new Observable(0)));
|
|
123
159
|
_startedResolved = __runInitializers(this, _progressPercent_extraInitializers);
|
|
124
|
-
|
|
160
|
+
/**
|
|
161
|
+
* @zignore
|
|
162
|
+
*/
|
|
163
|
+
started = __runInitializers(this, _started_initializers, new Promise(resolve => {
|
|
125
164
|
this._startedResolved = resolve;
|
|
126
|
-
});
|
|
127
|
-
_constructedResolved;
|
|
128
|
-
|
|
165
|
+
}));
|
|
166
|
+
_constructedResolved = __runInitializers(this, _started_extraInitializers);
|
|
167
|
+
/**
|
|
168
|
+
* @zignore
|
|
169
|
+
*/
|
|
170
|
+
constructed = __runInitializers(this, _constructed_initializers, new Promise(resolve => {
|
|
129
171
|
this._constructedResolved = resolve;
|
|
130
|
-
});
|
|
131
|
-
_launchedResolved;
|
|
132
|
-
|
|
172
|
+
}));
|
|
173
|
+
_launchedResolved = __runInitializers(this, _constructed_extraInitializers);
|
|
174
|
+
/**
|
|
175
|
+
* @zignore
|
|
176
|
+
*/
|
|
177
|
+
launched = __runInitializers(this, _launched_initializers, new Promise(resolve => {
|
|
133
178
|
this._launchedResolved = resolve;
|
|
134
|
-
});
|
|
135
|
-
_loadables = new Set();
|
|
179
|
+
}));
|
|
180
|
+
_loadables = (__runInitializers(this, _launched_extraInitializers), new Set());
|
|
136
181
|
/**
|
|
137
182
|
* @default false
|
|
138
183
|
*/
|
|
@@ -147,6 +192,7 @@ let LoadContext = (() => {
|
|
|
147
192
|
_loadedCount = 0;
|
|
148
193
|
/**
|
|
149
194
|
* Start the experience.
|
|
195
|
+
* @zignore
|
|
150
196
|
*/
|
|
151
197
|
start() {
|
|
152
198
|
if (this.isStarted.value)
|
|
@@ -156,6 +202,7 @@ let LoadContext = (() => {
|
|
|
156
202
|
}
|
|
157
203
|
/**
|
|
158
204
|
* Called when the root component's constructor (and thus any recursive children) has finished.
|
|
205
|
+
* @zignore
|
|
159
206
|
*/
|
|
160
207
|
constructionComplete() {
|
|
161
208
|
if (this.isConstructed.value)
|
|
@@ -165,6 +212,7 @@ let LoadContext = (() => {
|
|
|
165
212
|
}
|
|
166
213
|
/**
|
|
167
214
|
* Called when the user taps on a splash screen's 'launch' button or, in the case that there's no launch
|
|
215
|
+
* @zignore
|
|
168
216
|
*/
|
|
169
217
|
launch() {
|
|
170
218
|
if (this.isLaunched.value)
|
|
@@ -188,6 +236,7 @@ let LoadContext = (() => {
|
|
|
188
236
|
}
|
|
189
237
|
/**
|
|
190
238
|
* Start the experience when all loadables have completed.
|
|
239
|
+
* @zignore
|
|
191
240
|
*/
|
|
192
241
|
startWhenLoaded() {
|
|
193
242
|
this._startWhenLoaded = true;
|
|
@@ -195,6 +244,7 @@ let LoadContext = (() => {
|
|
|
195
244
|
}
|
|
196
245
|
/**
|
|
197
246
|
* Register a loadable process.
|
|
247
|
+
* @zignore
|
|
198
248
|
*/
|
|
199
249
|
registerLoadable(p, entity) {
|
|
200
250
|
if (this.disposed)
|
|
@@ -16,42 +16,52 @@ export type OrientationValue = ValueOf<typeof Orientation>;
|
|
|
16
16
|
export declare class OrientationContext extends Context {
|
|
17
17
|
/**
|
|
18
18
|
* Observable indicating whether the current orientation is portrait.
|
|
19
|
+
* @zui
|
|
19
20
|
*/
|
|
20
21
|
readonly isPortrait: Observable<boolean>;
|
|
21
22
|
/**
|
|
22
23
|
* Observable indicating whether the current orientation is landscape.
|
|
24
|
+
* @zui
|
|
23
25
|
*/
|
|
24
26
|
readonly isLandscape: Observable<boolean>;
|
|
25
27
|
/**
|
|
26
28
|
* Observable indicating whether the current orientation is secondary portrait.
|
|
29
|
+
* @zui
|
|
27
30
|
*/
|
|
28
31
|
readonly isPortraitSecondary: Observable<boolean>;
|
|
29
32
|
/**
|
|
30
33
|
* Observable indicating whether the current orientation is secondary landscape.
|
|
34
|
+
* @zui
|
|
31
35
|
*/
|
|
32
36
|
readonly isLandscapeSecondary: Observable<boolean>;
|
|
33
37
|
/**
|
|
34
38
|
* Observable representing the current orientation.
|
|
39
|
+
* @zignore
|
|
35
40
|
*/
|
|
36
41
|
readonly orientation: Observable<OrientationValue>;
|
|
37
42
|
/**
|
|
38
43
|
* Event triggered when the orientation changes to portrait.
|
|
44
|
+
* @zignore
|
|
39
45
|
*/
|
|
40
46
|
readonly onPortrait: Event<[void]>;
|
|
41
47
|
/**
|
|
42
48
|
* Event triggered when the orientation changes to landscape.
|
|
49
|
+
* @zignore
|
|
43
50
|
*/
|
|
44
51
|
readonly onLandscape: Event<[void]>;
|
|
45
52
|
/**
|
|
46
53
|
* Event triggered when the orientation changes to secondary portrait.
|
|
54
|
+
* @zignore
|
|
47
55
|
*/
|
|
48
56
|
readonly onPortraitSecondary: Event<[void]>;
|
|
49
57
|
/**
|
|
50
58
|
* Event triggered when the orientation changes to secondary landscape.
|
|
59
|
+
* @zignore
|
|
51
60
|
*/
|
|
52
61
|
readonly onLandscapeSecondary: Event<[void]>;
|
|
53
62
|
/**
|
|
54
63
|
* Event triggered when there is any orientation change.
|
|
64
|
+
* @zignore
|
|
55
65
|
*/
|
|
56
66
|
readonly onOrientationChange: Event<[OrientationValue]>;
|
|
57
67
|
/**
|
|
@@ -66,6 +76,9 @@ export declare class OrientationContext extends Context {
|
|
|
66
76
|
private getOrientationFromScreen;
|
|
67
77
|
private getOrientationFromWindow;
|
|
68
78
|
private getOrientationFromDimensions;
|
|
79
|
+
/**
|
|
80
|
+
* @zignore
|
|
81
|
+
*/
|
|
69
82
|
dispose: () => never;
|
|
70
83
|
}
|
|
71
84
|
/**
|
|
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { Context } from '../context';
|
|
36
|
-
import { zUI } from '../decorators';
|
|
36
|
+
import { zIgnore, zUI } from '../decorators';
|
|
37
37
|
import { Event } from '../event';
|
|
38
38
|
import { Observable } from '../observable';
|
|
39
39
|
export const Orientation = {
|
|
@@ -61,6 +61,27 @@ let OrientationContext = (() => {
|
|
|
61
61
|
let _isLandscapeSecondary_decorators;
|
|
62
62
|
let _isLandscapeSecondary_initializers = [];
|
|
63
63
|
let _isLandscapeSecondary_extraInitializers = [];
|
|
64
|
+
let _orientation_decorators;
|
|
65
|
+
let _orientation_initializers = [];
|
|
66
|
+
let _orientation_extraInitializers = [];
|
|
67
|
+
let _onPortrait_decorators;
|
|
68
|
+
let _onPortrait_initializers = [];
|
|
69
|
+
let _onPortrait_extraInitializers = [];
|
|
70
|
+
let _onLandscape_decorators;
|
|
71
|
+
let _onLandscape_initializers = [];
|
|
72
|
+
let _onLandscape_extraInitializers = [];
|
|
73
|
+
let _onPortraitSecondary_decorators;
|
|
74
|
+
let _onPortraitSecondary_initializers = [];
|
|
75
|
+
let _onPortraitSecondary_extraInitializers = [];
|
|
76
|
+
let _onLandscapeSecondary_decorators;
|
|
77
|
+
let _onLandscapeSecondary_initializers = [];
|
|
78
|
+
let _onLandscapeSecondary_extraInitializers = [];
|
|
79
|
+
let _onOrientationChange_decorators;
|
|
80
|
+
let _onOrientationChange_initializers = [];
|
|
81
|
+
let _onOrientationChange_extraInitializers = [];
|
|
82
|
+
let _dispose_decorators;
|
|
83
|
+
let _dispose_initializers = [];
|
|
84
|
+
let _dispose_extraInitializers = [];
|
|
64
85
|
return class OrientationContext extends _classSuper {
|
|
65
86
|
static {
|
|
66
87
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -68,58 +89,83 @@ let OrientationContext = (() => {
|
|
|
68
89
|
_isLandscape_decorators = [zUI()];
|
|
69
90
|
_isPortraitSecondary_decorators = [zUI()];
|
|
70
91
|
_isLandscapeSecondary_decorators = [zUI()];
|
|
92
|
+
_orientation_decorators = [zIgnore()];
|
|
93
|
+
_onPortrait_decorators = [zIgnore()];
|
|
94
|
+
_onLandscape_decorators = [zIgnore()];
|
|
95
|
+
_onPortraitSecondary_decorators = [zIgnore()];
|
|
96
|
+
_onLandscapeSecondary_decorators = [zIgnore()];
|
|
97
|
+
_onOrientationChange_decorators = [zIgnore()];
|
|
98
|
+
_dispose_decorators = [zIgnore()];
|
|
71
99
|
__esDecorate(null, null, _isPortrait_decorators, { kind: "field", name: "isPortrait", static: false, private: false, access: { has: obj => "isPortrait" in obj, get: obj => obj.isPortrait, set: (obj, value) => { obj.isPortrait = value; } }, metadata: _metadata }, _isPortrait_initializers, _isPortrait_extraInitializers);
|
|
72
100
|
__esDecorate(null, null, _isLandscape_decorators, { kind: "field", name: "isLandscape", static: false, private: false, access: { has: obj => "isLandscape" in obj, get: obj => obj.isLandscape, set: (obj, value) => { obj.isLandscape = value; } }, metadata: _metadata }, _isLandscape_initializers, _isLandscape_extraInitializers);
|
|
73
101
|
__esDecorate(null, null, _isPortraitSecondary_decorators, { kind: "field", name: "isPortraitSecondary", static: false, private: false, access: { has: obj => "isPortraitSecondary" in obj, get: obj => obj.isPortraitSecondary, set: (obj, value) => { obj.isPortraitSecondary = value; } }, metadata: _metadata }, _isPortraitSecondary_initializers, _isPortraitSecondary_extraInitializers);
|
|
74
102
|
__esDecorate(null, null, _isLandscapeSecondary_decorators, { kind: "field", name: "isLandscapeSecondary", static: false, private: false, access: { has: obj => "isLandscapeSecondary" in obj, get: obj => obj.isLandscapeSecondary, set: (obj, value) => { obj.isLandscapeSecondary = value; } }, metadata: _metadata }, _isLandscapeSecondary_initializers, _isLandscapeSecondary_extraInitializers);
|
|
103
|
+
__esDecorate(null, null, _orientation_decorators, { kind: "field", name: "orientation", static: false, private: false, access: { has: obj => "orientation" in obj, get: obj => obj.orientation, set: (obj, value) => { obj.orientation = value; } }, metadata: _metadata }, _orientation_initializers, _orientation_extraInitializers);
|
|
104
|
+
__esDecorate(null, null, _onPortrait_decorators, { kind: "field", name: "onPortrait", static: false, private: false, access: { has: obj => "onPortrait" in obj, get: obj => obj.onPortrait, set: (obj, value) => { obj.onPortrait = value; } }, metadata: _metadata }, _onPortrait_initializers, _onPortrait_extraInitializers);
|
|
105
|
+
__esDecorate(null, null, _onLandscape_decorators, { kind: "field", name: "onLandscape", static: false, private: false, access: { has: obj => "onLandscape" in obj, get: obj => obj.onLandscape, set: (obj, value) => { obj.onLandscape = value; } }, metadata: _metadata }, _onLandscape_initializers, _onLandscape_extraInitializers);
|
|
106
|
+
__esDecorate(null, null, _onPortraitSecondary_decorators, { kind: "field", name: "onPortraitSecondary", static: false, private: false, access: { has: obj => "onPortraitSecondary" in obj, get: obj => obj.onPortraitSecondary, set: (obj, value) => { obj.onPortraitSecondary = value; } }, metadata: _metadata }, _onPortraitSecondary_initializers, _onPortraitSecondary_extraInitializers);
|
|
107
|
+
__esDecorate(null, null, _onLandscapeSecondary_decorators, { kind: "field", name: "onLandscapeSecondary", static: false, private: false, access: { has: obj => "onLandscapeSecondary" in obj, get: obj => obj.onLandscapeSecondary, set: (obj, value) => { obj.onLandscapeSecondary = value; } }, metadata: _metadata }, _onLandscapeSecondary_initializers, _onLandscapeSecondary_extraInitializers);
|
|
108
|
+
__esDecorate(null, null, _onOrientationChange_decorators, { kind: "field", name: "onOrientationChange", static: false, private: false, access: { has: obj => "onOrientationChange" in obj, get: obj => obj.onOrientationChange, set: (obj, value) => { obj.onOrientationChange = value; } }, metadata: _metadata }, _onOrientationChange_initializers, _onOrientationChange_extraInitializers);
|
|
109
|
+
__esDecorate(null, null, _dispose_decorators, { kind: "field", name: "dispose", static: false, private: false, access: { has: obj => "dispose" in obj, get: obj => obj.dispose, set: (obj, value) => { obj.dispose = value; } }, metadata: _metadata }, _dispose_initializers, _dispose_extraInitializers);
|
|
75
110
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
76
111
|
}
|
|
77
112
|
/**
|
|
78
113
|
* Observable indicating whether the current orientation is portrait.
|
|
114
|
+
* @zui
|
|
79
115
|
*/
|
|
80
116
|
isPortrait = __runInitializers(this, _isPortrait_initializers, void 0);
|
|
81
117
|
/**
|
|
82
118
|
* Observable indicating whether the current orientation is landscape.
|
|
119
|
+
* @zui
|
|
83
120
|
*/
|
|
84
121
|
isLandscape = (__runInitializers(this, _isPortrait_extraInitializers), __runInitializers(this, _isLandscape_initializers, void 0));
|
|
85
122
|
/**
|
|
86
123
|
* Observable indicating whether the current orientation is secondary portrait.
|
|
124
|
+
* @zui
|
|
87
125
|
*/
|
|
88
126
|
isPortraitSecondary = (__runInitializers(this, _isLandscape_extraInitializers), __runInitializers(this, _isPortraitSecondary_initializers, void 0));
|
|
89
127
|
/**
|
|
90
128
|
* Observable indicating whether the current orientation is secondary landscape.
|
|
129
|
+
* @zui
|
|
91
130
|
*/
|
|
92
131
|
isLandscapeSecondary = (__runInitializers(this, _isPortraitSecondary_extraInitializers), __runInitializers(this, _isLandscapeSecondary_initializers, void 0));
|
|
93
132
|
/**
|
|
94
133
|
* Observable representing the current orientation.
|
|
134
|
+
* @zignore
|
|
95
135
|
*/
|
|
96
|
-
orientation = __runInitializers(this, _isLandscapeSecondary_extraInitializers);
|
|
136
|
+
orientation = (__runInitializers(this, _isLandscapeSecondary_extraInitializers), __runInitializers(this, _orientation_initializers, void 0));
|
|
97
137
|
/**
|
|
98
138
|
* Event triggered when the orientation changes to portrait.
|
|
139
|
+
* @zignore
|
|
99
140
|
*/
|
|
100
|
-
onPortrait = new Event();
|
|
141
|
+
onPortrait = (__runInitializers(this, _orientation_extraInitializers), __runInitializers(this, _onPortrait_initializers, new Event()));
|
|
101
142
|
/**
|
|
102
143
|
* Event triggered when the orientation changes to landscape.
|
|
144
|
+
* @zignore
|
|
103
145
|
*/
|
|
104
|
-
onLandscape = new Event();
|
|
146
|
+
onLandscape = (__runInitializers(this, _onPortrait_extraInitializers), __runInitializers(this, _onLandscape_initializers, new Event()));
|
|
105
147
|
/**
|
|
106
148
|
* Event triggered when the orientation changes to secondary portrait.
|
|
149
|
+
* @zignore
|
|
107
150
|
*/
|
|
108
|
-
onPortraitSecondary = new Event();
|
|
151
|
+
onPortraitSecondary = (__runInitializers(this, _onLandscape_extraInitializers), __runInitializers(this, _onPortraitSecondary_initializers, new Event()));
|
|
109
152
|
/**
|
|
110
153
|
* Event triggered when the orientation changes to secondary landscape.
|
|
154
|
+
* @zignore
|
|
111
155
|
*/
|
|
112
|
-
onLandscapeSecondary = new Event();
|
|
156
|
+
onLandscapeSecondary = (__runInitializers(this, _onPortraitSecondary_extraInitializers), __runInitializers(this, _onLandscapeSecondary_initializers, new Event()));
|
|
113
157
|
/**
|
|
114
158
|
* Event triggered when there is any orientation change.
|
|
159
|
+
* @zignore
|
|
115
160
|
*/
|
|
116
|
-
onOrientationChange = new Event();
|
|
161
|
+
onOrientationChange = (__runInitializers(this, _onLandscapeSecondary_extraInitializers), __runInitializers(this, _onOrientationChange_initializers, new Event()));
|
|
117
162
|
/**
|
|
118
163
|
* Creates an instance of OrientationContext.
|
|
119
164
|
* @param contextManager - The current ContextManager
|
|
120
165
|
*/
|
|
121
166
|
constructor(contextManager) {
|
|
122
167
|
super(contextManager, {});
|
|
168
|
+
__runInitializers(this, _dispose_extraInitializers);
|
|
123
169
|
const currentOrientation = this.getOrientation();
|
|
124
170
|
this.orientation = new Observable(currentOrientation);
|
|
125
171
|
this.isPortrait = new Observable(currentOrientation === Orientation.Portrait);
|
|
@@ -128,13 +174,13 @@ let OrientationContext = (() => {
|
|
|
128
174
|
this.isLandscapeSecondary = new Observable(currentOrientation === Orientation.LandscapeSecondary);
|
|
129
175
|
this.attachListeners();
|
|
130
176
|
}
|
|
131
|
-
attachListeners = () => {
|
|
177
|
+
attachListeners = (__runInitializers(this, _onOrientationChange_extraInitializers), () => {
|
|
132
178
|
this.orientation.addListener(this._onOrientationChange);
|
|
133
179
|
window.addEventListener('resize', this.orientationChangeHandler);
|
|
134
180
|
if ('orientation' in screen && screen.orientation) {
|
|
135
181
|
screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
136
182
|
}
|
|
137
|
-
};
|
|
183
|
+
});
|
|
138
184
|
_onOrientationChange = (orientation) => {
|
|
139
185
|
this.onOrientationChange.emit(orientation);
|
|
140
186
|
this.isPortrait.value = orientation === Orientation.Portrait;
|
|
@@ -197,13 +243,16 @@ let OrientationContext = (() => {
|
|
|
197
243
|
getOrientationFromDimensions() {
|
|
198
244
|
return window.innerWidth > window.innerHeight ? Orientation.Landscape : Orientation.Portrait;
|
|
199
245
|
}
|
|
200
|
-
|
|
246
|
+
/**
|
|
247
|
+
* @zignore
|
|
248
|
+
*/
|
|
249
|
+
dispose = __runInitializers(this, _dispose_initializers, () => {
|
|
201
250
|
window.removeEventListener('resize', this.orientationChangeHandler);
|
|
202
251
|
if ('orientation' in screen && screen.orientation)
|
|
203
252
|
screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
204
253
|
this.orientation.removeListener(this._onOrientationChange);
|
|
205
254
|
return super.dispose();
|
|
206
|
-
};
|
|
255
|
+
});
|
|
207
256
|
};
|
|
208
257
|
})();
|
|
209
258
|
export { OrientationContext };
|
|
@@ -7,40 +7,49 @@ import { Observable } from '../observable';
|
|
|
7
7
|
export declare class SnapshotContext extends Context {
|
|
8
8
|
/**
|
|
9
9
|
* Observable holding the current canvas image data URL.
|
|
10
|
+
* @zui
|
|
10
11
|
*/
|
|
11
12
|
readonly canvasImage: Observable<string, never>;
|
|
12
13
|
/**
|
|
13
14
|
* Observable indicating whether the Share API is supported in the current environment.
|
|
15
|
+
* @zui
|
|
14
16
|
*/
|
|
15
17
|
readonly shareAPISupported: Observable<boolean, never>;
|
|
16
18
|
/**
|
|
17
19
|
* Observable determining if the current canvas content can be shared.
|
|
20
|
+
* @zui
|
|
18
21
|
*/
|
|
19
22
|
readonly canShare: Observable<boolean, never>;
|
|
20
23
|
/**
|
|
21
24
|
* Observable containing the canvas image as a File object.
|
|
25
|
+
* @zignore
|
|
22
26
|
*/
|
|
23
27
|
readonly canvasFile: Observable<File | null, never>;
|
|
24
28
|
/**
|
|
25
29
|
* Observable storing the file name for the snapshot.
|
|
26
30
|
* Updates the file upon change.
|
|
31
|
+
* @zignore
|
|
27
32
|
*/
|
|
28
33
|
readonly fileName: Observable<string, never>;
|
|
29
34
|
/**
|
|
30
35
|
* Observable holding the text content to be shared with the snapshot.
|
|
36
|
+
* @zignore
|
|
31
37
|
*/
|
|
32
38
|
readonly text: Observable<string, never>;
|
|
33
39
|
/**
|
|
34
40
|
* Observable containing the title for the snapshot.
|
|
41
|
+
* @zignore
|
|
35
42
|
*/
|
|
36
43
|
readonly title: Observable<string, never>;
|
|
37
44
|
/**
|
|
38
45
|
* Observable storing the file type for the snapshot (e.g., 'image/png').
|
|
39
46
|
* Updates the file upon change.
|
|
47
|
+
* @zignore
|
|
40
48
|
*/
|
|
41
49
|
readonly fileType: Observable<string, never>;
|
|
42
50
|
/**
|
|
43
51
|
* Observable representing the quality setting of the snapshot image.
|
|
52
|
+
* @zignore
|
|
44
53
|
*/
|
|
45
54
|
readonly quality: Observable<number, never>;
|
|
46
55
|
/**
|
|
@@ -50,6 +59,7 @@ export declare class SnapshotContext extends Context {
|
|
|
50
59
|
constructor(contextManager: ContextManager);
|
|
51
60
|
/**
|
|
52
61
|
* Converts the canvas image to a file.
|
|
62
|
+
* @zignore
|
|
53
63
|
*/
|
|
54
64
|
updateFile: () => Promise<void>;
|
|
55
65
|
}
|