@zcomponent/core 1.14.3 → 1.16.0-beta
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 +0 -6
- package/lib/actionbehavior.d.ts +12 -3
- package/lib/actionbehavior.js +12 -3
- package/lib/animation/animation.d.ts +96 -4
- package/lib/animation/animation.js +93 -0
- package/lib/animation/animationstate.d.ts +52 -2
- package/lib/animation/bezier.d.ts +12 -1
- package/lib/animation/bezier.js +15 -12
- package/lib/animation/clips/clip.d.ts +71 -0
- package/lib/animation/clips/clip.js +68 -0
- package/lib/animation/interpolate.d.ts +17 -0
- package/lib/animation/interpolate.js +71 -0
- package/lib/animation/keyframe.d.ts +24 -1
- package/lib/animation/layer.d.ts +73 -1
- package/lib/animation/layer.js +69 -0
- package/lib/animation/layerclip.d.ts +75 -0
- package/lib/animation/layerclip.js +69 -0
- package/lib/animation/stream.d.ts +49 -7
- package/lib/animation/stream.js +3 -0
- package/lib/animation/tracks/cliptrack.d.ts +64 -0
- package/lib/animation/tracks/cliptrack.js +65 -1
- package/lib/animation/tracks/functiontrack.d.ts +60 -0
- package/lib/animation/tracks/functiontrack.js +62 -3
- package/lib/animation/tracks/propertytrack.d.ts +84 -0
- package/lib/animation/tracks/propertytrack.js +75 -0
- package/lib/animation/tracks/streamtrack.d.ts +51 -0
- package/lib/animation/tracks/streamtrack.js +54 -3
- package/lib/animation/tracks/track.d.ts +56 -0
- package/lib/animation/tracks/track.js +40 -0
- package/lib/behavior.d.ts +37 -0
- package/lib/behavior.js +21 -0
- package/lib/behaviors/ActivateState.d.ts +10 -3
- package/lib/behaviors/ActivateState.js +8 -4
- package/lib/behaviors/CallFunction.d.ts +1 -1
- package/lib/behaviors/CallFunction.js +2 -2
- package/lib/behaviors/ConsoleLog.d.ts +1 -1
- package/lib/behaviors/ConsoleLog.js +2 -2
- package/lib/behaviors/DownloadSnapshot.d.ts +5 -2
- package/lib/behaviors/DownloadSnapshot.js +5 -2
- package/lib/behaviors/LaunchURL.d.ts +1 -1
- package/lib/behaviors/LaunchURL.js +1 -1
- package/lib/behaviors/LogAnalyticsEvent.d.ts +1 -1
- package/lib/behaviors/LogAnalyticsEvent.js +2 -2
- package/lib/behaviors/PauseLayerClip.d.ts +5 -3
- package/lib/behaviors/PauseLayerClip.js +3 -2
- package/lib/behaviors/PlayLayerClip.d.ts +10 -4
- package/lib/behaviors/PlayLayerClip.js +7 -5
- package/lib/behaviors/PlaySound.d.ts +4 -4
- package/lib/behaviors/PlaySound.js +4 -4
- package/lib/behaviors/SetLayerOff.d.ts +4 -3
- package/lib/behaviors/SetLayerOff.js +3 -2
- package/lib/behaviors/ShowTextAlert.d.ts +2 -2
- package/lib/behaviors/ShowTextAlert.js +5 -5
- package/lib/behaviors/ToggleLayerClips.d.ts +4 -3
- package/lib/behaviors/ToggleLayerClips.js +5 -4
- package/lib/behaviors/stream/PauseStream.d.ts +15 -3
- package/lib/behaviors/stream/PauseStream.js +13 -2
- package/lib/behaviors/stream/PlayStream.d.ts +14 -4
- package/lib/behaviors/stream/PlayStream.js +10 -3
- package/lib/behaviors/stream/SeekStream.d.ts +12 -3
- package/lib/behaviors/stream/SeekStream.js +10 -2
- package/lib/behaviors/stream/StopStream.d.ts +11 -3
- package/lib/behaviors/stream/StopStream.js +9 -2
- package/lib/component.d.ts +85 -5
- package/lib/component.js +49 -1
- package/lib/components/Audio.d.ts +14 -5
- package/lib/components/Audio.js +19 -10
- package/lib/components/AudioLayerSettings.d.ts +9 -3
- package/lib/components/AudioLayerSettings.js +9 -3
- package/lib/components/Children.d.ts +7 -2
- package/lib/components/Children.js +6 -1
- package/lib/components/DefaultCookieConsent.d.ts +13 -3
- package/lib/components/DefaultCookieConsent.js +62 -38
- package/lib/components/DefaultLoader.d.ts +14 -9
- package/lib/components/DefaultLoader.js +25 -20
- package/lib/components/Gamepad.d.ts +12 -4
- package/lib/components/Gamepad.js +16 -8
- package/lib/components/LongLoad.d.ts +7 -1
- package/lib/components/LongLoad.js +7 -1
- package/lib/components/SnapshotUI.d.ts +10 -0
- package/lib/components/SnapshotUI.js +24 -0
- package/lib/context.d.ts +117 -0
- package/lib/context.js +50 -71
- package/lib/contexts/analyticscontext.d.ts +6 -0
- package/lib/contexts/analyticscontext.js +6 -0
- package/lib/contexts/audiocontextcontext.d.ts +26 -1
- package/lib/contexts/audiocontextcontext.js +26 -1
- package/lib/contexts/canvascontext.d.ts +59 -1
- package/lib/contexts/canvascontext.js +54 -1
- package/lib/contexts/cookieconsentcontext.d.ts +84 -10
- package/lib/contexts/cookieconsentcontext.js +71 -0
- package/lib/contexts/environmentcontext.d.ts +40 -5
- package/lib/contexts/environmentcontext.js +40 -5
- package/lib/contexts/gamepadcontext.d.ts +38 -0
- package/lib/contexts/gamepadcontext.js +38 -0
- package/lib/contexts/gesturecontext.d.ts +31 -4
- package/lib/contexts/gesturecontext.js +28 -4
- package/lib/contexts/globaltagcontext.d.ts +14 -2
- package/lib/contexts/globaltagcontext.js +13 -1
- package/lib/contexts/loadcontext.d.ts +92 -5
- package/lib/contexts/loadcontext.js +98 -11
- package/lib/contexts/orientationcontext.d.ts +58 -1
- package/lib/contexts/orientationcontext.js +51 -1
- package/lib/contexts/snapshotContext.d.ts +97 -4
- package/lib/contexts/snapshotContext.js +115 -4
- package/lib/contexts/tagcontext.d.ts +56 -2
- package/lib/contexts/tagcontext.js +77 -7
- package/lib/contexts/textalertcontext.d.ts +35 -2
- package/lib/contexts/textalertcontext.js +20 -2
- package/lib/contexts/usereventcontext.d.ts +29 -0
- package/lib/contexts/usereventcontext.js +30 -1
- package/lib/data/animation.d.ts +163 -0
- package/lib/data/animation.js +9 -0
- package/lib/data/change.d.ts +199 -0
- package/lib/data/change.js +190 -0
- package/lib/emitter.d.ts +8 -1
- package/lib/emitter.js +7 -0
- package/lib/entity.d.ts +30 -5
- package/lib/entity.js +23 -7
- package/lib/event.d.ts +19 -2
- package/lib/event.js +19 -2
- package/lib/fractionalindexing.js +38 -42
- package/lib/inflate.d.ts +68 -0
- package/lib/inflate.js +76 -0
- package/lib/observable.d.ts +3 -3
- package/lib/observable.js +4 -4
- package/lib/profile.d.ts +27 -0
- package/lib/profile.js +26 -0
- package/lib/selectors.d.ts +114 -0
- package/lib/selectors.js +159 -7
- package/lib/types.d.ts +215 -0
- package/lib/types.js +110 -1
- package/lib/validators.d.ts +27 -0
- package/lib/validators.js +27 -0
- package/lib/values/values.d.ts +5 -0
- package/lib/values/values.js +5 -0
- package/lib/zcomponent.d.ts +72 -0
- package/lib/zcomponent.js +81 -0
- package/lib/zcomponentconstruction.d.ts +11 -1
- package/lib/zcomponentconstruction.js +10 -0
- package/package.json +7 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component } from
|
|
2
|
-
import { ConsentStatus, CookieConsentContext, CookieType, Status, useCookieConsentFunctional, useCookieConsentMarketing, useCookieConsentPerformance, useMarketingVendors, usePerformanceVendors } from
|
|
3
|
-
import { isDesignTime } from
|
|
4
|
-
import { constructed, started } from
|
|
5
|
-
import { Observable } from
|
|
1
|
+
import { Component } from '../component';
|
|
2
|
+
import { ConsentStatus, CookieConsentContext, CookieType, Status, useCookieConsentFunctional, useCookieConsentMarketing, useCookieConsentPerformance, useMarketingVendors, usePerformanceVendors, } from '../contexts/cookieconsentcontext';
|
|
3
|
+
import { isDesignTime } from '../contexts/environmentcontext';
|
|
4
|
+
import { constructed, started } from '../contexts/loadcontext';
|
|
5
|
+
import { Observable } from '../observable';
|
|
6
6
|
const html = `
|
|
7
7
|
<div id='zcomponent-cookieconsent-panel'>
|
|
8
8
|
<h1 id='zcomponent-cookieconsent-title'></h1>
|
|
@@ -11,11 +11,21 @@ const html = `
|
|
|
11
11
|
</div>
|
|
12
12
|
`;
|
|
13
13
|
/**
|
|
14
|
+
* The CookieConsent component is responsible for displaying a cookie consent banner to the user.
|
|
15
|
+
*
|
|
16
|
+
* This banner informs the user about the use of cookies on the website and asks for their consent.
|
|
17
|
+
* The component handles the logic for displaying the banner, receiving the user's consent, and storing this consent.
|
|
18
|
+
* It also provides methods to check if the user has already given their consent.
|
|
14
19
|
* @zcomponent
|
|
15
20
|
* @zgroup Cookie Consent
|
|
16
21
|
* @zicon cookie
|
|
17
22
|
*/
|
|
18
23
|
export class DefaultCookieConsent extends Component {
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of DefaultCookieConsent.
|
|
26
|
+
* @param contextManager - The current ContextManager
|
|
27
|
+
* @param constructorProps - The properties of the component
|
|
28
|
+
*/
|
|
19
29
|
constructor(contextManager, constructorProps) {
|
|
20
30
|
super(contextManager, constructorProps);
|
|
21
31
|
this.constructorProps = constructorProps;
|
|
@@ -25,112 +35,112 @@ export class DefaultCookieConsent extends Component {
|
|
|
25
35
|
* @zgrouppriority 20
|
|
26
36
|
* @zdefault "This website uses cookies to store information on your computer."
|
|
27
37
|
*/
|
|
28
|
-
this.title = new Observable(
|
|
38
|
+
this.title = new Observable('This website uses cookies to store information on your computer.');
|
|
29
39
|
/**
|
|
30
40
|
* @zprop
|
|
31
41
|
* @zgroup Consent Screen
|
|
32
42
|
* @zgrouppriority 20
|
|
33
43
|
* @zdefault "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
|
|
34
44
|
*/
|
|
35
|
-
this.description = new Observable(
|
|
45
|
+
this.description = new Observable('Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used.');
|
|
36
46
|
/**
|
|
37
47
|
* @zprop
|
|
38
48
|
* @zgroup Settings
|
|
39
49
|
* @zgrouppriority 10
|
|
40
50
|
* @zdefault "Privacy Policy"
|
|
41
51
|
*/
|
|
42
|
-
this.privacyPolicyText = new Observable(
|
|
52
|
+
this.privacyPolicyText = new Observable('Privacy Policy');
|
|
43
53
|
/**
|
|
44
54
|
* @zprop
|
|
45
55
|
* @zgroup Settings
|
|
46
56
|
* @zgrouppriority 10
|
|
47
57
|
* @zdefault ""
|
|
48
58
|
*/
|
|
49
|
-
this.privacyPolicyURL = new Observable(
|
|
59
|
+
this.privacyPolicyURL = new Observable('');
|
|
50
60
|
/**
|
|
51
61
|
* @zprop
|
|
52
62
|
* @zgroup Consent Screen
|
|
53
63
|
* @zgrouppriority 20
|
|
54
64
|
* @zdefault "I Accept Cookies"
|
|
55
65
|
*/
|
|
56
|
-
this.acceptButton = new Observable(
|
|
66
|
+
this.acceptButton = new Observable('I Accept Cookies');
|
|
57
67
|
/**
|
|
58
68
|
* @zprop
|
|
59
69
|
* @zgroup Consent Screen
|
|
60
70
|
* @zgrouppriority 20
|
|
61
71
|
* @zdefault "Settings"
|
|
62
72
|
*/
|
|
63
|
-
this.settingsButton = new Observable(
|
|
73
|
+
this.settingsButton = new Observable('Settings');
|
|
64
74
|
/**
|
|
65
75
|
* @zprop
|
|
66
76
|
* @zgroup Consent Screen
|
|
67
77
|
* @zgrouppriority 20
|
|
68
78
|
* @zdefault "Save"
|
|
69
79
|
*/
|
|
70
|
-
this.saveButton = new Observable(
|
|
80
|
+
this.saveButton = new Observable('Save');
|
|
71
81
|
/**
|
|
72
82
|
* @zprop
|
|
73
83
|
* @zgroup Settings
|
|
74
84
|
* @zgrouppriority 10
|
|
75
85
|
* @zdefault "Essential"
|
|
76
86
|
*/
|
|
77
|
-
this.essentialTitle = new Observable(
|
|
87
|
+
this.essentialTitle = new Observable('Essential');
|
|
78
88
|
/**
|
|
79
89
|
* @zprop
|
|
80
90
|
* @zgroup Settings
|
|
81
91
|
* @zgrouppriority 10
|
|
82
92
|
* @zdefault "Cookies that are necessary to provide the service."
|
|
83
93
|
*/
|
|
84
|
-
this.essentialDescription = new Observable(
|
|
94
|
+
this.essentialDescription = new Observable('Cookies that are necessary to provide the service.');
|
|
85
95
|
/**
|
|
86
96
|
* @zprop
|
|
87
97
|
* @zgroup Settings
|
|
88
98
|
* @zgrouppriority 10
|
|
89
99
|
* @zdefault "Functional"
|
|
90
100
|
*/
|
|
91
|
-
this.functionalTitle = new Observable(
|
|
101
|
+
this.functionalTitle = new Observable('Functional');
|
|
92
102
|
/**
|
|
93
103
|
* @zprop
|
|
94
104
|
* @zgroup Settings
|
|
95
105
|
* @zgrouppriority 10
|
|
96
106
|
* @zdefault "Cookies that provide you with useful functionality, such as saving your preferences."
|
|
97
107
|
*/
|
|
98
|
-
this.functionalDescription = new Observable(
|
|
108
|
+
this.functionalDescription = new Observable('Cookies that provide you with useful functionality, such as saving your preferences.');
|
|
99
109
|
/**
|
|
100
110
|
* @zprop
|
|
101
111
|
* @zgroup Settings
|
|
102
112
|
* @zgrouppriority 10
|
|
103
113
|
* @zdefault "Performance"
|
|
104
114
|
*/
|
|
105
|
-
this.performanceTitle = new Observable(
|
|
115
|
+
this.performanceTitle = new Observable('Performance');
|
|
106
116
|
/**
|
|
107
117
|
* @zprop
|
|
108
118
|
* @zgroup Settings
|
|
109
119
|
* @zgrouppriority 10
|
|
110
120
|
* @zdefault "Cookies that help us measure and understand how the site is being used."
|
|
111
121
|
*/
|
|
112
|
-
this.performanceDescription = new Observable(
|
|
122
|
+
this.performanceDescription = new Observable('Cookies that help us measure and understand how the site is being used.');
|
|
113
123
|
/**
|
|
114
124
|
* @zprop
|
|
115
125
|
* @zgroup Settings
|
|
116
126
|
* @zgrouppriority 10
|
|
117
127
|
* @zdefault "Marketing"
|
|
118
128
|
*/
|
|
119
|
-
this.marketingTitle = new Observable(
|
|
129
|
+
this.marketingTitle = new Observable('Marketing');
|
|
120
130
|
/**
|
|
121
131
|
* @zprop
|
|
122
132
|
* @zgroup Settings
|
|
123
133
|
* @zgrouppriority 10
|
|
124
134
|
* @zdefault "Cookies that help us market our site and services."
|
|
125
135
|
*/
|
|
126
|
-
this.marketingDescription = new Observable(
|
|
136
|
+
this.marketingDescription = new Observable('Cookies that help us market our site and services.');
|
|
127
137
|
/**
|
|
128
138
|
* @zprop
|
|
129
139
|
* @zgroup Settings
|
|
130
140
|
* @zgrouppriority 10
|
|
131
141
|
* @zdefault "Required"
|
|
132
142
|
*/
|
|
133
|
-
this.required = new Observable(
|
|
143
|
+
this.required = new Observable('Required');
|
|
134
144
|
this._dom = document.createElement('div');
|
|
135
145
|
this._functional = document.createElement('input');
|
|
136
146
|
this._performance = document.createElement('input');
|
|
@@ -156,14 +166,20 @@ export class DefaultCookieConsent extends Component {
|
|
|
156
166
|
if (!panel)
|
|
157
167
|
return;
|
|
158
168
|
const title = this._dom.querySelector('#zcomponent-cookieconsent-title');
|
|
159
|
-
this.title.addListener(v => {
|
|
160
|
-
title
|
|
169
|
+
this.title.addListener(v => {
|
|
170
|
+
if (title)
|
|
171
|
+
title.textContent = v;
|
|
172
|
+
}, undefined, true);
|
|
161
173
|
const description = this._dom.querySelector('#zcomponent-cookieconsent-description');
|
|
162
|
-
this.description.addListener(v => {
|
|
163
|
-
description
|
|
174
|
+
this.description.addListener(v => {
|
|
175
|
+
if (description)
|
|
176
|
+
description.textContent = v;
|
|
177
|
+
}, undefined, true);
|
|
164
178
|
const privacyPolicy = this._dom.querySelector('#zcomponent-cookieconsent-privacypolicy');
|
|
165
|
-
this.privacyPolicyText.addListener(val => {
|
|
166
|
-
privacyPolicy
|
|
179
|
+
this.privacyPolicyText.addListener(val => {
|
|
180
|
+
if (privacyPolicy && privacyPolicy instanceof HTMLAnchorElement)
|
|
181
|
+
privacyPolicy.innerText = val;
|
|
182
|
+
}, undefined, true);
|
|
167
183
|
this.privacyPolicyURL.addListener(val => {
|
|
168
184
|
if (!privacyPolicy || !(privacyPolicy instanceof HTMLAnchorElement))
|
|
169
185
|
return;
|
|
@@ -173,8 +189,10 @@ export class DefaultCookieConsent extends Component {
|
|
|
173
189
|
if (isSettings) {
|
|
174
190
|
const requiredDOM = document.createElement('span');
|
|
175
191
|
requiredDOM.innerText = 'Required';
|
|
176
|
-
this.required.addListener(v => {
|
|
177
|
-
requiredDOM
|
|
192
|
+
this.required.addListener(v => {
|
|
193
|
+
if (requiredDOM)
|
|
194
|
+
requiredDOM.textContent = v;
|
|
195
|
+
}, undefined, true);
|
|
178
196
|
requiredDOM.style.float = 'right';
|
|
179
197
|
panel.appendChild(this._createEntry(this.essentialTitle, this.essentialDescription, [], requiredDOM));
|
|
180
198
|
panel.appendChild(this._createEntry(this.functionalTitle, this.functionalDescription, [], this._functional));
|
|
@@ -185,8 +203,10 @@ export class DefaultCookieConsent extends Component {
|
|
|
185
203
|
this._marketing.checked = useCookieConsentMarketing(this.contextManager).value === ConsentStatus.granted;
|
|
186
204
|
const saveButton = document.createElement('button');
|
|
187
205
|
saveButton.id = 'zcomponent-cookieconsent-save';
|
|
188
|
-
this.saveButton.addListener(v => {
|
|
189
|
-
saveButton
|
|
206
|
+
this.saveButton.addListener(v => {
|
|
207
|
+
if (saveButton)
|
|
208
|
+
saveButton.textContent = v;
|
|
209
|
+
}, undefined, true);
|
|
190
210
|
panel.appendChild(saveButton);
|
|
191
211
|
if (!isDesignTime(this.contextManager)) {
|
|
192
212
|
saveButton.addEventListener('click', () => this._save());
|
|
@@ -195,13 +215,17 @@ export class DefaultCookieConsent extends Component {
|
|
|
195
215
|
}
|
|
196
216
|
const acceptButton = document.createElement('button');
|
|
197
217
|
acceptButton.id = 'zcomponent-cookieconsent-accept';
|
|
198
|
-
this.acceptButton.addListener(v => {
|
|
199
|
-
acceptButton
|
|
218
|
+
this.acceptButton.addListener(v => {
|
|
219
|
+
if (acceptButton)
|
|
220
|
+
acceptButton.textContent = v;
|
|
221
|
+
}, undefined, true);
|
|
200
222
|
panel.appendChild(acceptButton);
|
|
201
223
|
const settingsButton = document.createElement('button');
|
|
202
224
|
settingsButton.id = 'zcomponent-cookieconsent-settings';
|
|
203
|
-
this.settingsButton.addListener(v => {
|
|
204
|
-
settingsButton
|
|
225
|
+
this.settingsButton.addListener(v => {
|
|
226
|
+
if (settingsButton)
|
|
227
|
+
settingsButton.textContent = v;
|
|
228
|
+
}, undefined, true);
|
|
205
229
|
settingsButton.addEventListener('click', () => {
|
|
206
230
|
console.log('Settings click');
|
|
207
231
|
this._loadDOM(true);
|
|
@@ -224,10 +248,10 @@ export class DefaultCookieConsent extends Component {
|
|
|
224
248
|
container.classList.add('zcomponent-cookieconsent-type');
|
|
225
249
|
container.appendChild(elm);
|
|
226
250
|
const header = document.createElement('h3');
|
|
227
|
-
title.addListener(val => header.innerText = val, undefined, true);
|
|
251
|
+
title.addListener(val => (header.innerText = val), undefined, true);
|
|
228
252
|
container.appendChild(header);
|
|
229
253
|
const descriptionDom = document.createElement('div');
|
|
230
|
-
description.addListener(val => descriptionDom.innerText = val, undefined, true);
|
|
254
|
+
description.addListener(val => (descriptionDom.innerText = val), undefined, true);
|
|
231
255
|
container.appendChild(descriptionDom);
|
|
232
256
|
if (vendors.length === 0)
|
|
233
257
|
return container;
|
|
@@ -242,7 +266,7 @@ export class DefaultCookieConsent extends Component {
|
|
|
242
266
|
li.append(document.createElement('br'));
|
|
243
267
|
if (vendor.privacyPolicyUrl?.length > 0) {
|
|
244
268
|
const privacy = document.createElement('a');
|
|
245
|
-
this.privacyPolicyText.addListener(val => privacy.innerText = val, undefined, true);
|
|
269
|
+
this.privacyPolicyText.addListener(val => (privacy.innerText = val), undefined, true);
|
|
246
270
|
privacy.href = vendor.privacyPolicyUrl;
|
|
247
271
|
privacy.rel = 'noreferrer noopener';
|
|
248
272
|
privacy.target = '_blank';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Observable, ContextManager } from
|
|
1
|
+
import { Component, Observable, ContextManager } from '..';
|
|
2
2
|
export interface DefaultLoaderConstructorProps {
|
|
3
3
|
/** @zprop
|
|
4
4
|
* @zgroup Appearance
|
|
@@ -17,10 +17,10 @@ export interface DefaultLoaderConstructorProps {
|
|
|
17
17
|
export declare class DefaultLoader extends Component {
|
|
18
18
|
element: HTMLDivElement;
|
|
19
19
|
/** @zprop
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
* @zdefault false
|
|
21
|
+
* @zgroup Design Time
|
|
22
|
+
* @zgrouppriority 30
|
|
23
|
+
*/
|
|
24
24
|
readonly preview: Observable<boolean, never>;
|
|
25
25
|
/** @zprop
|
|
26
26
|
* @zgroup Text
|
|
@@ -47,13 +47,18 @@ export declare class DefaultLoader extends Component {
|
|
|
47
47
|
*/
|
|
48
48
|
readonly textColor: Observable<string>;
|
|
49
49
|
/** @zprop
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
* @zdefault 1000
|
|
51
|
+
* @zgroup Appearance
|
|
52
|
+
* @zgrouppriority 10
|
|
53
|
+
*/
|
|
54
54
|
readonly zIndex: Observable<number>;
|
|
55
55
|
private _percentageElement;
|
|
56
56
|
private _attached;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new DefaultLoader component.
|
|
59
|
+
* @param contextManager - The current ContextManager
|
|
60
|
+
* @param constructorProps - The constructor properties.
|
|
61
|
+
*/
|
|
57
62
|
constructor(contextManager: ContextManager, constructorProps: DefaultLoaderConstructorProps);
|
|
58
63
|
private _updatePercentage;
|
|
59
64
|
private _updateVisibility;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, useCanvas, Observable, isDesignTime, useIsLoaded, useLoadPercent } from
|
|
1
|
+
import { Component, useCanvas, Observable, isDesignTime, useIsLoaded, useLoadPercent } from '..';
|
|
2
2
|
/**
|
|
3
3
|
* The DefaultLoader shows a customizable loading bar while the assets of your experience are being downloaded and parsed by the browser.
|
|
4
4
|
*
|
|
@@ -7,19 +7,24 @@ import { Component, useCanvas, Observable, isDesignTime, useIsLoaded, useLoadPer
|
|
|
7
7
|
* @zgroup Advanced
|
|
8
8
|
*/
|
|
9
9
|
export class DefaultLoader extends Component {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new DefaultLoader component.
|
|
12
|
+
* @param contextManager - The current ContextManager
|
|
13
|
+
* @param constructorProps - The constructor properties.
|
|
14
|
+
*/
|
|
10
15
|
constructor(contextManager, constructorProps) {
|
|
11
16
|
super(contextManager, constructorProps);
|
|
12
17
|
this.element = document.createElement('div');
|
|
13
18
|
/** @zprop
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
* @zdefault false
|
|
20
|
+
* @zgroup Design Time
|
|
21
|
+
* @zgrouppriority 30
|
|
22
|
+
*/
|
|
18
23
|
this.preview = new Observable(false);
|
|
19
24
|
this._attached = false;
|
|
20
25
|
this._updatePercentage = () => {
|
|
21
|
-
const p =
|
|
22
|
-
this._percentageElement.style.width = p.toString() +
|
|
26
|
+
const p = isDesignTime(this.contextManager) && this.preview.value ? 30 : useLoadPercent(this.contextManager).value;
|
|
27
|
+
this._percentageElement.style.width = p.toString() + '%';
|
|
23
28
|
};
|
|
24
29
|
this._updateVisibility = () => {
|
|
25
30
|
let shouldBeAttached = false;
|
|
@@ -40,25 +45,25 @@ export class DefaultLoader extends Component {
|
|
|
40
45
|
if (this.disposed)
|
|
41
46
|
return;
|
|
42
47
|
const rect = useCanvas(this.contextManager).getBoundingClientRect();
|
|
43
|
-
this.element.style.left = rect.left.toString() +
|
|
44
|
-
this.element.style.top = rect.top.toString() +
|
|
45
|
-
this.element.style.width = rect.width.toString() +
|
|
46
|
-
this.element.style.height = rect.height.toString() +
|
|
48
|
+
this.element.style.left = rect.left.toString() + 'px';
|
|
49
|
+
this.element.style.top = rect.top.toString() + 'px';
|
|
50
|
+
this.element.style.width = rect.width.toString() + 'px';
|
|
51
|
+
this.element.style.height = rect.height.toString() + 'px';
|
|
47
52
|
requestAnimationFrame(this._update);
|
|
48
53
|
};
|
|
49
54
|
this.element.innerHTML = loaderHTML;
|
|
50
|
-
this.element.className =
|
|
55
|
+
this.element.className = 'zcomponent-defaultloader';
|
|
51
56
|
if (constructorProps.backgroundImage) {
|
|
52
57
|
this.element.style.backgroundImage = `url(${constructorProps.backgroundImage})`;
|
|
53
58
|
}
|
|
54
|
-
const titleElement = this.element.querySelector(
|
|
55
|
-
const subtitleElement = this.element.querySelector(
|
|
56
|
-
this._percentageElement = this.element.querySelector(
|
|
57
|
-
this.title = new Observable('', t => titleElement.innerText = t);
|
|
58
|
-
this.subtitle = new Observable('', t => subtitleElement.innerText = t);
|
|
59
|
-
this.textColor = new Observable('#ffffff', t => this.element.style.color = t);
|
|
60
|
-
this.backgroundColor = new Observable('#000000', t => this.element.style.backgroundColor = t);
|
|
61
|
-
this.zIndex = new Observable(1000, t => this.element.style.zIndex = t.toString());
|
|
59
|
+
const titleElement = this.element.querySelector('#zcomponent-defaultloader-title') || document.createElement('h1');
|
|
60
|
+
const subtitleElement = this.element.querySelector('#zcomponent-defaultloader-subtitle') || document.createElement('h1');
|
|
61
|
+
this._percentageElement = this.element.querySelector('#zcomponent-defaultloader-progress-percentage') || document.createElement('div');
|
|
62
|
+
this.title = new Observable('', t => (titleElement.innerText = t));
|
|
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()));
|
|
62
67
|
this.register(this.preview, this._updatePercentage);
|
|
63
68
|
this.register(this.preview, this._updateVisibility);
|
|
64
69
|
this.register(useIsLoaded(contextManager), this._updateVisibility);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Component } from
|
|
2
|
-
import { ContextManager } from
|
|
3
|
-
import { Event } from
|
|
4
|
-
import { Observable } from
|
|
1
|
+
import { Component } from '../component';
|
|
2
|
+
import { ContextManager } from '../context';
|
|
3
|
+
import { Event } from '../event';
|
|
4
|
+
import { Observable } from '../observable';
|
|
5
5
|
export interface GamepadButtonEvent {
|
|
6
6
|
button: number;
|
|
7
7
|
gamepad: number;
|
|
@@ -10,6 +10,9 @@ export interface GamepadButtonEvent {
|
|
|
10
10
|
value: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
+
* Manages gamepad interactions, facilitating the tracking and handling of button press events for a specific controller.
|
|
14
|
+
*
|
|
15
|
+
* It offers a comprehensive set of events for individual gamepad buttons, allowing for detailed and responsive input handling in a gaming context.
|
|
13
16
|
* @zcomponent
|
|
14
17
|
* @zicon sports_esports
|
|
15
18
|
*/
|
|
@@ -63,6 +66,11 @@ export declare class Gamepad extends Component {
|
|
|
63
66
|
*/
|
|
64
67
|
readonly analogPressedThreshold: Observable<number, never>;
|
|
65
68
|
private _downLastFrame;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new Gamepad component.
|
|
71
|
+
* @param contextManager - The current ContextManager
|
|
72
|
+
* @param props - The constructor properties.
|
|
73
|
+
*/
|
|
66
74
|
constructor(contextManager: ContextManager, props: any);
|
|
67
75
|
private _updateRegistration;
|
|
68
76
|
private _update;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { Component } from
|
|
2
|
-
import { useOnBeforeRender } from
|
|
3
|
-
import { isEditTime, EnvironmentContext } from
|
|
4
|
-
import { GamepadContext } from
|
|
5
|
-
import { Event } from
|
|
6
|
-
import { Observable } from
|
|
1
|
+
import { Component } from '../component';
|
|
2
|
+
import { useOnBeforeRender } from '../contexts/canvascontext';
|
|
3
|
+
import { isEditTime, EnvironmentContext } from '../contexts/environmentcontext';
|
|
4
|
+
import { GamepadContext } from '../contexts/gamepadcontext';
|
|
5
|
+
import { Event } from '../event';
|
|
6
|
+
import { Observable } from '../observable';
|
|
7
7
|
/**
|
|
8
|
+
* Manages gamepad interactions, facilitating the tracking and handling of button press events for a specific controller.
|
|
9
|
+
*
|
|
10
|
+
* It offers a comprehensive set of events for individual gamepad buttons, allowing for detailed and responsive input handling in a gaming context.
|
|
8
11
|
* @zcomponent
|
|
9
12
|
* @zicon sports_esports
|
|
10
13
|
*/
|
|
11
14
|
export class Gamepad extends Component {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new Gamepad component.
|
|
17
|
+
* @param contextManager - The current ContextManager
|
|
18
|
+
* @param props - The constructor properties.
|
|
19
|
+
*/
|
|
12
20
|
constructor(contextManager, props) {
|
|
13
21
|
super(contextManager, props);
|
|
14
22
|
/** @zprop */
|
|
@@ -102,7 +110,7 @@ export class Gamepad extends Component {
|
|
|
102
110
|
gamepad: gamepad.index,
|
|
103
111
|
pressed: button.pressed,
|
|
104
112
|
touched: button.touched,
|
|
105
|
-
value: button.value
|
|
113
|
+
value: button.value,
|
|
106
114
|
});
|
|
107
115
|
if (!downThisFrame && downLastFrame.has(i))
|
|
108
116
|
upEvents.push({
|
|
@@ -110,7 +118,7 @@ export class Gamepad extends Component {
|
|
|
110
118
|
gamepad: gamepad.index,
|
|
111
119
|
pressed: button.pressed,
|
|
112
120
|
touched: button.touched,
|
|
113
|
-
value: button.value
|
|
121
|
+
value: button.value,
|
|
114
122
|
});
|
|
115
123
|
if (downThisFrame)
|
|
116
124
|
downLastFrame.add(i);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ContextManager, Event } from
|
|
1
|
+
import { Component, ContextManager, Event } from '..';
|
|
2
2
|
export interface LongLoadConstructorProps {
|
|
3
3
|
/**
|
|
4
4
|
* The number of loading processes to simulate
|
|
@@ -45,5 +45,11 @@ export interface LongLoadConstructorProps {
|
|
|
45
45
|
export declare class LongLoad extends Component<any, LongLoadConstructorProps> {
|
|
46
46
|
/** @zui */
|
|
47
47
|
readonly onLoad: Event<[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Creates an instance of LongLoad.
|
|
50
|
+
* @param contextManager - The current ContextManager
|
|
51
|
+
* @param props - The constructor properties.
|
|
52
|
+
* @returns - A new LongLoad instance.
|
|
53
|
+
*/
|
|
48
54
|
constructor(contextManager: ContextManager, props: LongLoadConstructorProps);
|
|
49
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Event, isDevelopmentBuild, registerLoadable } from
|
|
1
|
+
import { Component, Event, isDevelopmentBuild, registerLoadable } from '..';
|
|
2
2
|
/**
|
|
3
3
|
* Simulates long random loading times to facilitate development and debugging of loading processes.
|
|
4
4
|
*
|
|
@@ -7,6 +7,12 @@ import { Component, Event, isDevelopmentBuild, registerLoadable } from "..";
|
|
|
7
7
|
* @zgroup Advanced
|
|
8
8
|
*/
|
|
9
9
|
export class LongLoad extends Component {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of LongLoad.
|
|
12
|
+
* @param contextManager - The current ContextManager
|
|
13
|
+
* @param props - The constructor properties.
|
|
14
|
+
* @returns - A new LongLoad instance.
|
|
15
|
+
*/
|
|
10
16
|
constructor(contextManager, props) {
|
|
11
17
|
super(contextManager, props);
|
|
12
18
|
/** @zui */
|
|
@@ -4,6 +4,11 @@ import { Component, ConstructorProps } from '../component';
|
|
|
4
4
|
import { ContextManager } from '../context';
|
|
5
5
|
import { Event } from '../event';
|
|
6
6
|
/**
|
|
7
|
+
* Provides a user interface for capturing, downloading, and sharing snapshots of a canvas element.
|
|
8
|
+
*
|
|
9
|
+
* This component integrates snapshot capture and social sharing functionalities.
|
|
10
|
+
* It includes observable properties to customize snapshot format, quality, file name, and sharing text or title.
|
|
11
|
+
* Events are emitted for save and share actions.
|
|
7
12
|
* @zcomponent
|
|
8
13
|
* @zgroup Social Sharing
|
|
9
14
|
* @zicon photo_camera
|
|
@@ -51,6 +56,11 @@ export declare class SnapshotUI extends Component {
|
|
|
51
56
|
* @zdefault ''
|
|
52
57
|
*/
|
|
53
58
|
readonly title: Observable<string, never>;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new SnapshotUI component.
|
|
61
|
+
* @param contextManager - The current ContextManager
|
|
62
|
+
* @param props - The constructor properties.
|
|
63
|
+
*/
|
|
54
64
|
constructor(contextManager: ContextManager, props: ConstructorProps);
|
|
55
65
|
dispose(): never;
|
|
56
66
|
}
|
|
@@ -10,11 +10,21 @@ const back_src = new URL('../../assets/back.png', import.meta.url).href;
|
|
|
10
10
|
const download_src = new URL('../../assets/download.png', import.meta.url).href;
|
|
11
11
|
const share_src = new URL('../../assets/share.png', import.meta.url).href;
|
|
12
12
|
/**
|
|
13
|
+
* Provides a user interface for capturing, downloading, and sharing snapshots of a canvas element.
|
|
14
|
+
*
|
|
15
|
+
* This component integrates snapshot capture and social sharing functionalities.
|
|
16
|
+
* It includes observable properties to customize snapshot format, quality, file name, and sharing text or title.
|
|
17
|
+
* Events are emitted for save and share actions.
|
|
13
18
|
* @zcomponent
|
|
14
19
|
* @zgroup Social Sharing
|
|
15
20
|
* @zicon photo_camera
|
|
16
21
|
*/
|
|
17
22
|
export class SnapshotUI extends Component {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new SnapshotUI component.
|
|
25
|
+
* @param contextManager - The current ContextManager
|
|
26
|
+
* @param props - The constructor properties.
|
|
27
|
+
*/
|
|
18
28
|
constructor(contextManager, props) {
|
|
19
29
|
super(contextManager, props);
|
|
20
30
|
this.style = document.createElement('link');
|
|
@@ -119,6 +129,11 @@ export class SnapshotUI extends Component {
|
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
class SocialShareBehaviors {
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new SocialShareBehaviors component.
|
|
134
|
+
* @param contextManager - The current ContextManager
|
|
135
|
+
* @param parent - The parent component.
|
|
136
|
+
*/
|
|
122
137
|
constructor(contextManager, parent) {
|
|
123
138
|
this.capture_b = new TakeSnapshot(contextManager, parent, { event: 'social-share', runAtEditTime: false });
|
|
124
139
|
this.download_b = new DownloadSnapshot(contextManager, parent, { event: 'social-share', runAtEditTime: false });
|
|
@@ -149,6 +164,10 @@ class SocialShareBehaviors {
|
|
|
149
164
|
}
|
|
150
165
|
}
|
|
151
166
|
class CaptureButtonElement {
|
|
167
|
+
/**
|
|
168
|
+
* Creates a new CaptureButtonElement component.
|
|
169
|
+
* @param contextManager - The current ContextManager
|
|
170
|
+
*/
|
|
152
171
|
constructor(contextManager) {
|
|
153
172
|
this.contextManager = contextManager;
|
|
154
173
|
this.clickEvent = new Event();
|
|
@@ -222,6 +241,11 @@ class CaptureButtonElement {
|
|
|
222
241
|
}
|
|
223
242
|
}
|
|
224
243
|
class ShareDivElement {
|
|
244
|
+
/**
|
|
245
|
+
* Creates a new ShareDivElement component.
|
|
246
|
+
* @param withShareButton - Whether to include a share button.
|
|
247
|
+
* @param shareFunction - The function to call when the share button is clicked.
|
|
248
|
+
*/
|
|
225
249
|
constructor(withShareButton, shareFunction) {
|
|
226
250
|
this.shareFunction = shareFunction;
|
|
227
251
|
this.onDownload = new Event();
|