@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,30 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context, ContextManager } from '../context';
|
|
2
2
|
import { Observable } from '../observable';
|
|
3
|
+
import { ValueOf } from '../types';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Representing the overall status of the cookie consent process: 'unknown', 'initializing', 'initialized'.
|
|
5
6
|
*/
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
export declare const Status: {
|
|
8
|
+
readonly unknown: "unknown";
|
|
9
|
+
readonly initializing: "initializing";
|
|
10
|
+
readonly initialized: "initialized";
|
|
11
|
+
};
|
|
12
|
+
export type StatusValue = ValueOf<typeof Status>;
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* Representing the consent status for different types of cookies: 'unknown', 'granted', 'rejected'.
|
|
13
15
|
*/
|
|
14
|
-
export declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
export declare const ConsentStatus: {
|
|
17
|
+
readonly unknown: "unknown";
|
|
18
|
+
readonly granted: "granted";
|
|
19
|
+
readonly rejected: "rejected";
|
|
20
|
+
};
|
|
21
|
+
export type ConsentStatusValue = ValueOf<typeof ConsentStatus>;
|
|
19
22
|
/**
|
|
20
|
-
*
|
|
23
|
+
* Representing different types of cookies: 'essential', 'functional', 'performance', 'marketing'.
|
|
21
24
|
*/
|
|
22
|
-
export declare
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
25
|
+
export declare const CookieType: {
|
|
26
|
+
readonly essential: "essential";
|
|
27
|
+
readonly functional: "functional";
|
|
28
|
+
readonly performance: "performance";
|
|
29
|
+
readonly marketing: "marketing";
|
|
30
|
+
};
|
|
31
|
+
export type CookieTypeValue = ValueOf<typeof CookieType>;
|
|
28
32
|
/**
|
|
29
33
|
* Defines the structure of a vendor's information including name, description, and privacy policy URL.
|
|
30
34
|
*/
|
|
@@ -45,12 +49,18 @@ export interface Vendor {
|
|
|
45
49
|
* @zcontext
|
|
46
50
|
*/
|
|
47
51
|
export declare class CookieConsentContext extends Context {
|
|
48
|
-
readonly status: Observable<
|
|
49
|
-
readonly functionalCookies: Observable<
|
|
50
|
-
readonly performanceCookies: Observable<
|
|
51
|
-
readonly marketingCookies: Observable<
|
|
52
|
+
readonly status: Observable<StatusValue, never>;
|
|
53
|
+
readonly functionalCookies: Observable<ConsentStatusValue, never>;
|
|
54
|
+
readonly performanceCookies: Observable<ConsentStatusValue, never>;
|
|
55
|
+
readonly marketingCookies: Observable<ConsentStatusValue, never>;
|
|
52
56
|
readonly showSettings: Observable<(() => void) | undefined, never>;
|
|
57
|
+
/**
|
|
58
|
+
* @default []
|
|
59
|
+
*/
|
|
53
60
|
readonly performanceVendors: Vendor[];
|
|
61
|
+
/**
|
|
62
|
+
* @default []
|
|
63
|
+
*/
|
|
54
64
|
readonly marketingVendors: Vendor[];
|
|
55
65
|
/**
|
|
56
66
|
* Registers a performance vendor.
|
|
@@ -66,25 +76,25 @@ export declare class CookieConsentContext extends Context {
|
|
|
66
76
|
* @param {ContextManager} mgr The context manager instance.
|
|
67
77
|
* @returns {Observable<ConsentStatus>} The observable representing the consent status of functional cookies.
|
|
68
78
|
*/
|
|
69
|
-
export declare function useCookieConsentFunctional(mgr: ContextManager): Observable<
|
|
79
|
+
export declare function useCookieConsentFunctional(mgr: ContextManager): Observable<ConsentStatusValue, never>;
|
|
70
80
|
/**
|
|
71
81
|
* Retrieves the consent status for performance cookies.
|
|
72
82
|
* @param {ContextManager} mgr The context manager instance.
|
|
73
83
|
* @returns {Observable<ConsentStatus>} The observable representing the consent status of performance cookies.
|
|
74
84
|
*/
|
|
75
|
-
export declare function useCookieConsentPerformance(mgr: ContextManager): Observable<
|
|
85
|
+
export declare function useCookieConsentPerformance(mgr: ContextManager): Observable<ConsentStatusValue, never>;
|
|
76
86
|
/**
|
|
77
87
|
* Retrieves the consent status for marketing cookies.
|
|
78
88
|
* @param {ContextManager} mgr The context manager instance.
|
|
79
89
|
* @returns {Observable<ConsentStatus>} The observable representing the consent status of marketing cookies.
|
|
80
90
|
*/
|
|
81
|
-
export declare function useCookieConsentMarketing(mgr: ContextManager): Observable<
|
|
91
|
+
export declare function useCookieConsentMarketing(mgr: ContextManager): Observable<ConsentStatusValue, never>;
|
|
82
92
|
/**
|
|
83
93
|
* Retrieves the overall cookie consent status.
|
|
84
94
|
* @param {ContextManager} mgr The context manager instance.
|
|
85
95
|
* @returns {Observable<Status>} The observable representing the overall cookie consent status.
|
|
86
96
|
*/
|
|
87
|
-
export declare function useCookieConsentStatus(mgr: ContextManager): Observable<
|
|
97
|
+
export declare function useCookieConsentStatus(mgr: ContextManager): Observable<StatusValue, never>;
|
|
88
98
|
/**
|
|
89
99
|
* Registers a performance vendor in the `CookieConsentContext`.
|
|
90
100
|
* @param {ContextManager} mgr The context manager instance.
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Context } from '../context';
|
|
2
2
|
import { Observable } from '../observable';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Representing the overall status of the cookie consent process: 'unknown', 'initializing', 'initialized'.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export const Status = {
|
|
7
|
+
unknown: 'unknown',
|
|
8
|
+
initializing: 'initializing',
|
|
9
|
+
initialized: 'initialized',
|
|
10
|
+
};
|
|
11
|
+
Object.freeze(Status);
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Representing the consent status for different types of cookies: 'unknown', 'granted', 'rejected'.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
export const ConsentStatus = {
|
|
16
|
+
unknown: 'unknown',
|
|
17
|
+
granted: 'granted',
|
|
18
|
+
rejected: 'rejected',
|
|
19
|
+
};
|
|
20
|
+
Object.freeze(ConsentStatus);
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Representing different types of cookies: 'essential', 'functional', 'performance', 'marketing'.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
export const CookieType = {
|
|
25
|
+
essential: 'essential',
|
|
26
|
+
functional: 'functional',
|
|
27
|
+
performance: 'performance',
|
|
28
|
+
marketing: 'marketing',
|
|
29
|
+
};
|
|
30
|
+
Object.freeze(CookieType);
|
|
31
31
|
/**
|
|
32
32
|
* Manages the state and information related to cookie consent within a context.
|
|
33
33
|
* - `status`: Observable representing the overall status of the cookie consent.
|
|
@@ -40,16 +40,19 @@ export var CookieType;
|
|
|
40
40
|
* @zcontext
|
|
41
41
|
*/
|
|
42
42
|
export class CookieConsentContext extends Context {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
status = new Observable(Status.unknown);
|
|
44
|
+
functionalCookies = new Observable(ConsentStatus.unknown);
|
|
45
|
+
performanceCookies = new Observable(ConsentStatus.unknown);
|
|
46
|
+
marketingCookies = new Observable(ConsentStatus.unknown);
|
|
47
|
+
showSettings = new Observable(undefined);
|
|
48
|
+
/**
|
|
49
|
+
* @default []
|
|
50
|
+
*/
|
|
51
|
+
performanceVendors = [];
|
|
52
|
+
/**
|
|
53
|
+
* @default []
|
|
54
|
+
*/
|
|
55
|
+
marketingVendors = [];
|
|
53
56
|
/**
|
|
54
57
|
* Registers a performance vendor.
|
|
55
58
|
*/
|
|
@@ -2,20 +2,11 @@
|
|
|
2
2
|
* Internal context that manages the document flags.
|
|
3
3
|
*/
|
|
4
4
|
export class DocumentFlagManager {
|
|
5
|
+
_environmentContext;
|
|
6
|
+
_loadContext;
|
|
5
7
|
constructor(_environmentContext, _loadContext) {
|
|
6
8
|
this._environmentContext = _environmentContext;
|
|
7
9
|
this._loadContext = _loadContext;
|
|
8
|
-
this._update = () => {
|
|
9
|
-
if (!document?.body)
|
|
10
|
-
return;
|
|
11
|
-
document.body.classList.toggle('zcomponent-designtime', this._environmentContext.designTime.value);
|
|
12
|
-
document.body.classList.toggle('zcomponent-runtime', this._environmentContext.runTime.value);
|
|
13
|
-
document.body.classList.toggle('zcomponent-development', this._environmentContext.developmentBuild.value);
|
|
14
|
-
document.body.classList.toggle('zcomponent-production', this._environmentContext.productionBuild.value);
|
|
15
|
-
document.body.classList.toggle('zcomponent-started', this._loadContext.isStarted.value);
|
|
16
|
-
document.body.classList.toggle('zcomponent-launched', this._loadContext.isLaunched.value);
|
|
17
|
-
document.body.classList.toggle('zcomponent-loaded', this._loadContext.isLoaded.value);
|
|
18
|
-
};
|
|
19
10
|
this._update();
|
|
20
11
|
this._environmentContext.designTime.addListener(this._update);
|
|
21
12
|
this._environmentContext.runTime.addListener(this._update);
|
|
@@ -25,6 +16,19 @@ export class DocumentFlagManager {
|
|
|
25
16
|
this._loadContext.isLaunched.addListener(this._update);
|
|
26
17
|
this._loadContext.isLoaded.addListener(this._update);
|
|
27
18
|
}
|
|
19
|
+
_update = () => {
|
|
20
|
+
if (typeof document === 'undefined')
|
|
21
|
+
return;
|
|
22
|
+
if (!document?.body)
|
|
23
|
+
return;
|
|
24
|
+
document.body.classList.toggle('zcomponent-designtime', this._environmentContext.designTime.value);
|
|
25
|
+
document.body.classList.toggle('zcomponent-runtime', this._environmentContext.runTime.value);
|
|
26
|
+
document.body.classList.toggle('zcomponent-development', this._environmentContext.developmentBuild.value);
|
|
27
|
+
document.body.classList.toggle('zcomponent-production', this._environmentContext.productionBuild.value);
|
|
28
|
+
document.body.classList.toggle('zcomponent-started', this._loadContext.isStarted.value);
|
|
29
|
+
document.body.classList.toggle('zcomponent-launched', this._loadContext.isLaunched.value);
|
|
30
|
+
document.body.classList.toggle('zcomponent-loaded', this._loadContext.isLoaded.value);
|
|
31
|
+
};
|
|
28
32
|
dispose() {
|
|
29
33
|
this._environmentContext.designTime.removeListener(this._update);
|
|
30
34
|
this._environmentContext.runTime.removeListener(this._update);
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context, ContextManager } from '../context';
|
|
2
|
+
import type { Entity } from '../entity';
|
|
2
3
|
import { Observable } from '../observable';
|
|
3
4
|
/** @zcontext */
|
|
4
5
|
export declare class EnvironmentContext extends Context {
|
|
5
6
|
/**
|
|
6
7
|
* Observable indicating if the application is in design time.
|
|
7
|
-
* @zprop
|
|
8
8
|
**/
|
|
9
9
|
readonly designTime: Observable<boolean, never>;
|
|
10
10
|
/**
|
|
11
11
|
* Observable indicating if the application is in edit time.
|
|
12
|
-
* @zprop
|
|
13
12
|
* */
|
|
14
13
|
readonly editTime: Observable<boolean, never>;
|
|
15
14
|
/**
|
|
16
15
|
* Observable indicating if the application is in run time.
|
|
17
|
-
* @zprop
|
|
18
16
|
**/
|
|
19
17
|
readonly runTime: Observable<boolean, never>;
|
|
20
18
|
/**
|
|
21
19
|
* Observable indicating if the application is a development build.
|
|
22
|
-
* @zprop
|
|
23
20
|
**/
|
|
24
21
|
readonly developmentBuild: Observable<boolean, never>;
|
|
25
22
|
/**
|
|
26
23
|
* Observable indicating if the application is a production build.
|
|
27
|
-
* @zprop
|
|
28
24
|
* */
|
|
29
25
|
readonly productionBuild: Observable<boolean, never>;
|
|
30
26
|
private readonly _documentFlagManager;
|
|
@@ -55,3 +51,23 @@ export declare function isDevelopmentBuild(ctx: ContextManager): boolean;
|
|
|
55
51
|
* @returns {boolean} True if it's a production build, otherwise false.
|
|
56
52
|
*/
|
|
57
53
|
export declare function isProductionBuild(ctx: ContextManager): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* A decorator that will permit its decorated function to be called only durning runtime (and not design or edit time). If execution is prevented, the function will return `undefined` to the caller.
|
|
56
|
+
*/
|
|
57
|
+
export declare function zOnlyRuntime<EntityType extends Entity>(): (originalMethod: (...args: any) => void, context: ClassMethodDecoratorContext<EntityType, (this: EntityType, ...args: any[]) => void>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* A decorator that will permit its decorated function to be called only durning edit time. If execution is prevented, the function will return `undefined` to the caller.
|
|
60
|
+
*/
|
|
61
|
+
export declare function zOnlyEditTime<EntityType extends Entity>(): (originalMethod: (...args: any) => void, context: ClassMethodDecoratorContext<EntityType, (this: EntityType, ...args: any[]) => void>) => void;
|
|
62
|
+
/**
|
|
63
|
+
* A decorator that will permit its decorated function to be called only durning design time. If execution is prevented, the function will return `undefined` to the caller.
|
|
64
|
+
*/
|
|
65
|
+
export declare function zOnlyDesignTime<EntityType extends Entity>(): (originalMethod: (...args: any) => void, context: ClassMethodDecoratorContext<EntityType, (this: EntityType, ...args: any[]) => void>) => void;
|
|
66
|
+
/**
|
|
67
|
+
* A decorator that will permit its decorated function to be called only in production builds. If execution is prevented, the function will return `undefined` to the caller.
|
|
68
|
+
*/
|
|
69
|
+
export declare function zOnlyProduction<EntityType extends Entity>(): (originalMethod: (...args: any) => void, context: ClassMethodDecoratorContext<EntityType, (this: EntityType, ...args: any[]) => void>) => void;
|
|
70
|
+
/**
|
|
71
|
+
* A decorator that will permit its decorated function to be called only in development builds. If execution is prevented, the function will return `undefined` to the caller.
|
|
72
|
+
*/
|
|
73
|
+
export declare function zOnlyDevelopment<EntityType extends Entity>(): (originalMethod: (...args: any) => void, context: ClassMethodDecoratorContext<EntityType, (this: EntityType, ...args: any[]) => void>) => void;
|
|
@@ -1,44 +1,108 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
1
35
|
import { Context } from '../context';
|
|
36
|
+
import { zUI } from '../decorators';
|
|
2
37
|
import { Observable } from '../observable';
|
|
3
38
|
import { DocumentFlagManager } from './documentflagmanager';
|
|
4
39
|
import { LoadContext } from './loadcontext';
|
|
5
40
|
/** @zcontext */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
41
|
+
let EnvironmentContext = (() => {
|
|
42
|
+
let _classSuper = Context;
|
|
43
|
+
let _designTime_decorators;
|
|
44
|
+
let _designTime_initializers = [];
|
|
45
|
+
let _designTime_extraInitializers = [];
|
|
46
|
+
let _editTime_decorators;
|
|
47
|
+
let _editTime_initializers = [];
|
|
48
|
+
let _editTime_extraInitializers = [];
|
|
49
|
+
let _runTime_decorators;
|
|
50
|
+
let _runTime_initializers = [];
|
|
51
|
+
let _runTime_extraInitializers = [];
|
|
52
|
+
let _developmentBuild_decorators;
|
|
53
|
+
let _developmentBuild_initializers = [];
|
|
54
|
+
let _developmentBuild_extraInitializers = [];
|
|
55
|
+
let _productionBuild_decorators;
|
|
56
|
+
let _productionBuild_initializers = [];
|
|
57
|
+
let _productionBuild_extraInitializers = [];
|
|
58
|
+
return class EnvironmentContext extends _classSuper {
|
|
59
|
+
static {
|
|
60
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
61
|
+
_designTime_decorators = [zUI()];
|
|
62
|
+
_editTime_decorators = [zUI()];
|
|
63
|
+
_runTime_decorators = [zUI()];
|
|
64
|
+
_developmentBuild_decorators = [zUI()];
|
|
65
|
+
_productionBuild_decorators = [zUI()];
|
|
66
|
+
__esDecorate(null, null, _designTime_decorators, { kind: "field", name: "designTime", static: false, private: false, access: { has: obj => "designTime" in obj, get: obj => obj.designTime, set: (obj, value) => { obj.designTime = value; } }, metadata: _metadata }, _designTime_initializers, _designTime_extraInitializers);
|
|
67
|
+
__esDecorate(null, null, _editTime_decorators, { kind: "field", name: "editTime", static: false, private: false, access: { has: obj => "editTime" in obj, get: obj => obj.editTime, set: (obj, value) => { obj.editTime = value; } }, metadata: _metadata }, _editTime_initializers, _editTime_extraInitializers);
|
|
68
|
+
__esDecorate(null, null, _runTime_decorators, { kind: "field", name: "runTime", static: false, private: false, access: { has: obj => "runTime" in obj, get: obj => obj.runTime, set: (obj, value) => { obj.runTime = value; } }, metadata: _metadata }, _runTime_initializers, _runTime_extraInitializers);
|
|
69
|
+
__esDecorate(null, null, _developmentBuild_decorators, { kind: "field", name: "developmentBuild", static: false, private: false, access: { has: obj => "developmentBuild" in obj, get: obj => obj.developmentBuild, set: (obj, value) => { obj.developmentBuild = value; } }, metadata: _metadata }, _developmentBuild_initializers, _developmentBuild_extraInitializers);
|
|
70
|
+
__esDecorate(null, null, _productionBuild_decorators, { kind: "field", name: "productionBuild", static: false, private: false, access: { has: obj => "productionBuild" in obj, get: obj => obj.productionBuild, set: (obj, value) => { obj.productionBuild = value; } }, metadata: _metadata }, _productionBuild_initializers, _productionBuild_extraInitializers);
|
|
71
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
72
|
+
}
|
|
9
73
|
/**
|
|
10
74
|
* Observable indicating if the application is in design time.
|
|
11
|
-
* @zprop
|
|
12
75
|
**/
|
|
13
|
-
|
|
76
|
+
designTime = __runInitializers(this, _designTime_initializers, new Observable(false));
|
|
14
77
|
/**
|
|
15
78
|
* Observable indicating if the application is in edit time.
|
|
16
|
-
* @zprop
|
|
17
79
|
* */
|
|
18
|
-
|
|
80
|
+
editTime = (__runInitializers(this, _designTime_extraInitializers), __runInitializers(this, _editTime_initializers, new Observable(false)));
|
|
19
81
|
/**
|
|
20
82
|
* Observable indicating if the application is in run time.
|
|
21
|
-
* @zprop
|
|
22
83
|
**/
|
|
23
|
-
|
|
84
|
+
runTime = (__runInitializers(this, _editTime_extraInitializers), __runInitializers(this, _runTime_initializers, new Observable(true)));
|
|
24
85
|
/**
|
|
25
86
|
* Observable indicating if the application is a development build.
|
|
26
|
-
* @zprop
|
|
27
87
|
**/
|
|
28
|
-
|
|
88
|
+
developmentBuild = (__runInitializers(this, _runTime_extraInitializers), __runInitializers(this, _developmentBuild_initializers, new Observable(typeof process !== 'undefined' && process?.env?.NODE_ENV === 'development')));
|
|
29
89
|
/**
|
|
30
90
|
* Observable indicating if the application is a production build.
|
|
31
|
-
* @zprop
|
|
32
91
|
* */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
92
|
+
productionBuild = (__runInitializers(this, _developmentBuild_extraInitializers), __runInitializers(this, _productionBuild_initializers, new Observable(!this.developmentBuild.value)));
|
|
93
|
+
_documentFlagManager = __runInitializers(this, _productionBuild_extraInitializers);
|
|
94
|
+
constructor(contextManager, props) {
|
|
95
|
+
super(contextManager, props);
|
|
96
|
+
const loadContext = this.contextManager.get(LoadContext);
|
|
97
|
+
this._documentFlagManager = new DocumentFlagManager(this, loadContext);
|
|
98
|
+
}
|
|
99
|
+
dispose() {
|
|
100
|
+
this._documentFlagManager.dispose();
|
|
101
|
+
return super.dispose();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
})();
|
|
105
|
+
export { EnvironmentContext };
|
|
42
106
|
/**
|
|
43
107
|
* Determines if the application is in design time.
|
|
44
108
|
* @param ctx The context manager to query.
|
|
@@ -71,3 +135,53 @@ export function isDevelopmentBuild(ctx) {
|
|
|
71
135
|
export function isProductionBuild(ctx) {
|
|
72
136
|
return ctx.get(EnvironmentContext).productionBuild.value;
|
|
73
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* A decorator that will permit its decorated function to be called only durning runtime (and not design or edit time). If execution is prevented, the function will return `undefined` to the caller.
|
|
140
|
+
*/
|
|
141
|
+
export function zOnlyRuntime() {
|
|
142
|
+
return (originalMethod, context) => function (...args) {
|
|
143
|
+
if (isDesignTime(this.contextManager) || isEditTime(this.contextManager))
|
|
144
|
+
return;
|
|
145
|
+
originalMethod.call(this, ...args);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A decorator that will permit its decorated function to be called only durning edit time. If execution is prevented, the function will return `undefined` to the caller.
|
|
150
|
+
*/
|
|
151
|
+
export function zOnlyEditTime() {
|
|
152
|
+
return (originalMethod, context) => function (...args) {
|
|
153
|
+
if (!isEditTime(this.contextManager))
|
|
154
|
+
return;
|
|
155
|
+
originalMethod.call(this, ...args);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* A decorator that will permit its decorated function to be called only durning design time. If execution is prevented, the function will return `undefined` to the caller.
|
|
160
|
+
*/
|
|
161
|
+
export function zOnlyDesignTime() {
|
|
162
|
+
return (originalMethod, context) => function (...args) {
|
|
163
|
+
if (!isDesignTime(this.contextManager))
|
|
164
|
+
return;
|
|
165
|
+
originalMethod.call(this, ...args);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A decorator that will permit its decorated function to be called only in production builds. If execution is prevented, the function will return `undefined` to the caller.
|
|
170
|
+
*/
|
|
171
|
+
export function zOnlyProduction() {
|
|
172
|
+
return (originalMethod, context) => function (...args) {
|
|
173
|
+
if (!isProductionBuild(this.contextManager))
|
|
174
|
+
return;
|
|
175
|
+
originalMethod.call(this, ...args);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A decorator that will permit its decorated function to be called only in development builds. If execution is prevented, the function will return `undefined` to the caller.
|
|
180
|
+
*/
|
|
181
|
+
export function zOnlyDevelopment() {
|
|
182
|
+
return (originalMethod, context) => function (...args) {
|
|
183
|
+
if (!isDevelopmentBuild(this.contextManager))
|
|
184
|
+
return;
|
|
185
|
+
originalMethod.call(this, ...args);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import { Context, ContextManager } from '../context';
|
|
2
2
|
import { Event } from '../event';
|
|
3
|
+
import { ValueOf } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Represents the axes of a gamepad.
|
|
5
6
|
*/
|
|
6
|
-
export declare
|
|
7
|
-
LeftStickHorizontal
|
|
8
|
-
LeftStickVertical
|
|
9
|
-
RightStickHorizontal
|
|
10
|
-
RightStickVertical
|
|
11
|
-
}
|
|
7
|
+
export declare const GamepadAxis: {
|
|
8
|
+
readonly LeftStickHorizontal: "LeftStickHorizontal";
|
|
9
|
+
readonly LeftStickVertical: "LeftStickVertical";
|
|
10
|
+
readonly RightStickHorizontal: "RightStickHorizontal";
|
|
11
|
+
readonly RightStickVertical: "RightStickVertical";
|
|
12
|
+
};
|
|
13
|
+
export type GamepadAxisValue = ValueOf<typeof GamepadAxis>;
|
|
12
14
|
/**
|
|
13
15
|
* Represents the buttons on a gamepad.
|
|
14
16
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
South
|
|
17
|
-
East
|
|
18
|
-
West
|
|
19
|
-
North
|
|
20
|
-
ShoulderLeft
|
|
21
|
-
ShoulderRight
|
|
22
|
-
TriggerLeft
|
|
23
|
-
TriggerRight
|
|
24
|
-
Select
|
|
25
|
-
Start
|
|
26
|
-
StickLeft
|
|
27
|
-
StickRight
|
|
28
|
-
DUp
|
|
29
|
-
DDown
|
|
30
|
-
DLeft
|
|
31
|
-
DRight
|
|
32
|
-
Center
|
|
33
|
-
}
|
|
17
|
+
export declare const GamepadButton: {
|
|
18
|
+
readonly South: "South";
|
|
19
|
+
readonly East: "East";
|
|
20
|
+
readonly West: "West";
|
|
21
|
+
readonly North: "North";
|
|
22
|
+
readonly ShoulderLeft: "ShoulderLeft";
|
|
23
|
+
readonly ShoulderRight: "ShoulderRight";
|
|
24
|
+
readonly TriggerLeft: "TriggerLeft";
|
|
25
|
+
readonly TriggerRight: "TriggerRight";
|
|
26
|
+
readonly Select: "Select";
|
|
27
|
+
readonly Start: "Start";
|
|
28
|
+
readonly StickLeft: "StickLeft";
|
|
29
|
+
readonly StickRight: "StickRight";
|
|
30
|
+
readonly DUp: "DUp";
|
|
31
|
+
readonly DDown: "DDown";
|
|
32
|
+
readonly DLeft: "DLeft";
|
|
33
|
+
readonly DRight: "DRight";
|
|
34
|
+
readonly Center: "Center";
|
|
35
|
+
};
|
|
36
|
+
export type GamepadButtonValue = ValueOf<typeof GamepadButton>;
|
|
34
37
|
/**
|
|
35
38
|
* Manages and tracks gamepad connections and states.
|
|
36
39
|
* @zcontext
|
|
@@ -75,4 +78,4 @@ export declare class GamepadContext extends Context {
|
|
|
75
78
|
* @param axis The gamepad axis to translate.
|
|
76
79
|
* @returns The numeric representation of the gamepad axis.
|
|
77
80
|
*/
|
|
78
|
-
export declare function translateGamepadAxis(axis:
|
|
81
|
+
export declare function translateGamepadAxis(axis: GamepadAxisValue): number;
|