@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,26 +1,49 @@
|
|
|
1
1
|
import { ContextManager, Context } from '../context';
|
|
2
2
|
import { Observable } from '../observable';
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the overall status of the cookie consent process: 'unknown', 'initializing', 'initialized'.
|
|
5
|
+
*/
|
|
3
6
|
export declare enum Status {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
'unknown' = "unknown",
|
|
8
|
+
'initializing' = "initializing",
|
|
9
|
+
'initialized' = "initialized"
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Enum representing the consent status for different types of cookies: 'unknown', 'granted', 'rejected'.
|
|
13
|
+
*/
|
|
8
14
|
export declare enum ConsentStatus {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
'unknown' = "unknown",
|
|
16
|
+
'granted' = "granted",
|
|
17
|
+
'rejected' = "rejected"
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Enum representing different types of cookies: 'essential', 'functional', 'performance', 'marketing'.
|
|
21
|
+
*/
|
|
13
22
|
export declare enum CookieType {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
'essential' = "essential",
|
|
24
|
+
'functional' = "functional",
|
|
25
|
+
'performance' = "performance",
|
|
26
|
+
'marketing' = "marketing"
|
|
18
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Defines the structure of a vendor's information including name, description, and privacy policy URL.
|
|
30
|
+
*/
|
|
19
31
|
export interface Vendor {
|
|
20
32
|
name: string;
|
|
21
33
|
description: string;
|
|
22
34
|
privacyPolicyUrl: string;
|
|
23
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Manages the state and information related to cookie consent within a context.
|
|
38
|
+
* - `status`: Observable representing the overall status of the cookie consent.
|
|
39
|
+
* - `functionalCookies`: Observable for the consent status of functional cookies.
|
|
40
|
+
* - `performanceCookies`: Observable for the consent status of performance cookies.
|
|
41
|
+
* - `marketingCookies`: Observable for the consent status of marketing cookies.
|
|
42
|
+
* - `showSettings`: Observable for displaying cookie settings.
|
|
43
|
+
* - `performanceVendors`: Array of registered performance vendors.
|
|
44
|
+
* - `marketingVendors`: Array of registered marketing vendors.
|
|
45
|
+
* @zcontext
|
|
46
|
+
*/
|
|
24
47
|
export declare class CookieConsentContext extends Context {
|
|
25
48
|
readonly status: Observable<Status, never>;
|
|
26
49
|
readonly functionalCookies: Observable<ConsentStatus, never>;
|
|
@@ -29,15 +52,66 @@ export declare class CookieConsentContext extends Context {
|
|
|
29
52
|
readonly showSettings: Observable<(() => void) | undefined, never>;
|
|
30
53
|
readonly performanceVendors: Vendor[];
|
|
31
54
|
readonly marketingVendors: Vendor[];
|
|
55
|
+
/**
|
|
56
|
+
* Registers a performance vendor.
|
|
57
|
+
*/
|
|
32
58
|
registerPerformanceVendor(v: Vendor): void;
|
|
59
|
+
/**
|
|
60
|
+
* Registers a marketing vendor.
|
|
61
|
+
*/
|
|
33
62
|
registerMarketingVendor(v: Vendor): void;
|
|
34
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves the consent status for functional cookies.
|
|
66
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
67
|
+
* @returns {Observable<ConsentStatus>} The observable representing the consent status of functional cookies.
|
|
68
|
+
*/
|
|
35
69
|
export declare function useCookieConsentFunctional(mgr: ContextManager): Observable<ConsentStatus, never>;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieves the consent status for performance cookies.
|
|
72
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
73
|
+
* @returns {Observable<ConsentStatus>} The observable representing the consent status of performance cookies.
|
|
74
|
+
*/
|
|
36
75
|
export declare function useCookieConsentPerformance(mgr: ContextManager): Observable<ConsentStatus, never>;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves the consent status for marketing cookies.
|
|
78
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
79
|
+
* @returns {Observable<ConsentStatus>} The observable representing the consent status of marketing cookies.
|
|
80
|
+
*/
|
|
37
81
|
export declare function useCookieConsentMarketing(mgr: ContextManager): Observable<ConsentStatus, never>;
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves the overall cookie consent status.
|
|
84
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
85
|
+
* @returns {Observable<Status>} The observable representing the overall cookie consent status.
|
|
86
|
+
*/
|
|
38
87
|
export declare function useCookieConsentStatus(mgr: ContextManager): Observable<Status, never>;
|
|
88
|
+
/**
|
|
89
|
+
* Registers a performance vendor in the `CookieConsentContext`.
|
|
90
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
91
|
+
* @param {Vendor} vendor The performance vendor to register.
|
|
92
|
+
*/
|
|
39
93
|
export declare function registerPerformanceVendor(mgr: ContextManager, vendor: Vendor): void;
|
|
94
|
+
/**
|
|
95
|
+
* Registers a marketing vendor in the `CookieConsentContext`.
|
|
96
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
97
|
+
* @param {Vendor} vendor The marketing vendor to register.
|
|
98
|
+
*/
|
|
40
99
|
export declare function registerMarketingVendor(mgr: ContextManager, vendor: Vendor): void;
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves the list of registered performance vendors.
|
|
102
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
103
|
+
* @returns {Vendor[]} An array of registered performance vendors.
|
|
104
|
+
*/
|
|
41
105
|
export declare function usePerformanceVendors(mgr: ContextManager): Vendor[];
|
|
106
|
+
/**
|
|
107
|
+
* Retrieves the list of registered marketing vendors.
|
|
108
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
109
|
+
* @returns {Vendor[]} An array of registered marketing vendors.
|
|
110
|
+
*/
|
|
42
111
|
export declare function useMarketingVendors(mgr: ContextManager): Vendor[];
|
|
112
|
+
/**
|
|
113
|
+
* Retrieves the function to show cookie settings from the `CookieConsentContext`.
|
|
114
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
115
|
+
* @returns {Observable<(() => void)|undefined>} The observable representing the function to show cookie settings.
|
|
116
|
+
*/
|
|
43
117
|
export declare function useShowCookieSettings(mgr: ContextManager): Observable<(() => void) | undefined, never>;
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { Context } from '../context';
|
|
2
2
|
import { Observable } from '../observable';
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the overall status of the cookie consent process: 'unknown', 'initializing', 'initialized'.
|
|
5
|
+
*/
|
|
3
6
|
export var Status;
|
|
4
7
|
(function (Status) {
|
|
5
8
|
Status["unknown"] = "unknown";
|
|
6
9
|
Status["initializing"] = "initializing";
|
|
7
10
|
Status["initialized"] = "initialized";
|
|
8
11
|
})(Status || (Status = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Enum representing the consent status for different types of cookies: 'unknown', 'granted', 'rejected'.
|
|
14
|
+
*/
|
|
9
15
|
export var ConsentStatus;
|
|
10
16
|
(function (ConsentStatus) {
|
|
11
17
|
ConsentStatus["unknown"] = "unknown";
|
|
12
18
|
ConsentStatus["granted"] = "granted";
|
|
13
19
|
ConsentStatus["rejected"] = "rejected";
|
|
14
20
|
})(ConsentStatus || (ConsentStatus = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Enum representing different types of cookies: 'essential', 'functional', 'performance', 'marketing'.
|
|
23
|
+
*/
|
|
15
24
|
export var CookieType;
|
|
16
25
|
(function (CookieType) {
|
|
17
26
|
CookieType["essential"] = "essential";
|
|
@@ -19,6 +28,17 @@ export var CookieType;
|
|
|
19
28
|
CookieType["performance"] = "performance";
|
|
20
29
|
CookieType["marketing"] = "marketing";
|
|
21
30
|
})(CookieType || (CookieType = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Manages the state and information related to cookie consent within a context.
|
|
33
|
+
* - `status`: Observable representing the overall status of the cookie consent.
|
|
34
|
+
* - `functionalCookies`: Observable for the consent status of functional cookies.
|
|
35
|
+
* - `performanceCookies`: Observable for the consent status of performance cookies.
|
|
36
|
+
* - `marketingCookies`: Observable for the consent status of marketing cookies.
|
|
37
|
+
* - `showSettings`: Observable for displaying cookie settings.
|
|
38
|
+
* - `performanceVendors`: Array of registered performance vendors.
|
|
39
|
+
* - `marketingVendors`: Array of registered marketing vendors.
|
|
40
|
+
* @zcontext
|
|
41
|
+
*/
|
|
22
42
|
export class CookieConsentContext extends Context {
|
|
23
43
|
constructor() {
|
|
24
44
|
super(...arguments);
|
|
@@ -30,37 +50,88 @@ export class CookieConsentContext extends Context {
|
|
|
30
50
|
this.performanceVendors = [];
|
|
31
51
|
this.marketingVendors = [];
|
|
32
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Registers a performance vendor.
|
|
55
|
+
*/
|
|
33
56
|
registerPerformanceVendor(v) {
|
|
34
57
|
this.performanceVendors.push(v);
|
|
35
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Registers a marketing vendor.
|
|
61
|
+
*/
|
|
36
62
|
registerMarketingVendor(v) {
|
|
37
63
|
this.marketingVendors.push(v);
|
|
38
64
|
}
|
|
39
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Retrieves the consent status for functional cookies.
|
|
68
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
69
|
+
* @returns {Observable<ConsentStatus>} The observable representing the consent status of functional cookies.
|
|
70
|
+
*/
|
|
40
71
|
export function useCookieConsentFunctional(mgr) {
|
|
41
72
|
return mgr.get(CookieConsentContext).functionalCookies;
|
|
42
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves the consent status for performance cookies.
|
|
76
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
77
|
+
* @returns {Observable<ConsentStatus>} The observable representing the consent status of performance cookies.
|
|
78
|
+
*/
|
|
43
79
|
export function useCookieConsentPerformance(mgr) {
|
|
44
80
|
return mgr.get(CookieConsentContext).performanceCookies;
|
|
45
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves the consent status for marketing cookies.
|
|
84
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
85
|
+
* @returns {Observable<ConsentStatus>} The observable representing the consent status of marketing cookies.
|
|
86
|
+
*/
|
|
46
87
|
export function useCookieConsentMarketing(mgr) {
|
|
47
88
|
return mgr.get(CookieConsentContext).marketingCookies;
|
|
48
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves the overall cookie consent status.
|
|
92
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
93
|
+
* @returns {Observable<Status>} The observable representing the overall cookie consent status.
|
|
94
|
+
*/
|
|
49
95
|
export function useCookieConsentStatus(mgr) {
|
|
50
96
|
return mgr.get(CookieConsentContext).status;
|
|
51
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Registers a performance vendor in the `CookieConsentContext`.
|
|
100
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
101
|
+
* @param {Vendor} vendor The performance vendor to register.
|
|
102
|
+
*/
|
|
52
103
|
export function registerPerformanceVendor(mgr, vendor) {
|
|
53
104
|
return mgr.get(CookieConsentContext).registerPerformanceVendor(vendor);
|
|
54
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Registers a marketing vendor in the `CookieConsentContext`.
|
|
108
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
109
|
+
* @param {Vendor} vendor The marketing vendor to register.
|
|
110
|
+
*/
|
|
55
111
|
export function registerMarketingVendor(mgr, vendor) {
|
|
56
112
|
return mgr.get(CookieConsentContext).registerMarketingVendor(vendor);
|
|
57
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves the list of registered performance vendors.
|
|
116
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
117
|
+
* @returns {Vendor[]} An array of registered performance vendors.
|
|
118
|
+
*/
|
|
58
119
|
export function usePerformanceVendors(mgr) {
|
|
59
120
|
return mgr.get(CookieConsentContext).performanceVendors;
|
|
60
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves the list of registered marketing vendors.
|
|
124
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
125
|
+
* @returns {Vendor[]} An array of registered marketing vendors.
|
|
126
|
+
*/
|
|
61
127
|
export function useMarketingVendors(mgr) {
|
|
62
128
|
return mgr.get(CookieConsentContext).marketingVendors;
|
|
63
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves the function to show cookie settings from the `CookieConsentContext`.
|
|
132
|
+
* @param {ContextManager} mgr The context manager instance.
|
|
133
|
+
* @returns {Observable<(() => void)|undefined>} The observable representing the function to show cookie settings.
|
|
134
|
+
*/
|
|
64
135
|
export function useShowCookieSettings(mgr) {
|
|
65
136
|
return mgr.get(CookieConsentContext).showSettings;
|
|
66
137
|
}
|
|
@@ -2,18 +2,53 @@ import { ContextManager, Context } from '../context';
|
|
|
2
2
|
import { Observable } from '../observable';
|
|
3
3
|
/** @zcontext */
|
|
4
4
|
export declare class EnvironmentContext extends Context {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Observable indicating if the application is in design time.
|
|
7
|
+
* @zprop
|
|
8
|
+
**/
|
|
6
9
|
readonly designTime: Observable<boolean, never>;
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Observable indicating if the application is in edit time.
|
|
12
|
+
* @zprop
|
|
13
|
+
* */
|
|
8
14
|
readonly editTime: Observable<boolean, never>;
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Observable indicating if the application is in run time.
|
|
17
|
+
* @zprop
|
|
18
|
+
**/
|
|
10
19
|
readonly runTime: Observable<boolean, never>;
|
|
11
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Observable indicating if the application is a development build.
|
|
22
|
+
* @zprop
|
|
23
|
+
**/
|
|
12
24
|
readonly developmentBuild: Observable<boolean, never>;
|
|
13
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Observable indicating if the application is a production build.
|
|
27
|
+
* @zprop
|
|
28
|
+
* */
|
|
14
29
|
readonly productionBuild: Observable<boolean, never>;
|
|
15
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Determines if the application is in design time.
|
|
33
|
+
* @param ctx The context manager to query.
|
|
34
|
+
* @returns {boolean} True if in design time, otherwise false.
|
|
35
|
+
*/
|
|
16
36
|
export declare function isDesignTime(ctx: ContextManager): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Determines if the application is in edit time.
|
|
39
|
+
* @param ctx The context manager to query.
|
|
40
|
+
* @returns {boolean} True if in edit time, otherwise false.
|
|
41
|
+
*/
|
|
17
42
|
export declare function isEditTime(ctx: ContextManager): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Determines if the application is a development build.
|
|
45
|
+
* @param ctx The context manager to query.
|
|
46
|
+
* @returns {boolean} True if it's a development build, otherwise false.
|
|
47
|
+
*/
|
|
18
48
|
export declare function isDevelopmentBuild(ctx: ContextManager): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Determines if the application is a production build.
|
|
51
|
+
* @param ctx The context manager to query.
|
|
52
|
+
* @returns {boolean} True if it's a production build, otherwise false.
|
|
53
|
+
*/
|
|
19
54
|
export declare function isProductionBuild(ctx: ContextManager): boolean;
|
|
@@ -4,27 +4,62 @@ import { Observable } from '../observable';
|
|
|
4
4
|
export class EnvironmentContext extends Context {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Observable indicating if the application is in design time.
|
|
9
|
+
* @zprop
|
|
10
|
+
**/
|
|
8
11
|
this.designTime = new Observable(false);
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Observable indicating if the application is in edit time.
|
|
14
|
+
* @zprop
|
|
15
|
+
* */
|
|
10
16
|
this.editTime = new Observable(false);
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Observable indicating if the application is in run time.
|
|
19
|
+
* @zprop
|
|
20
|
+
**/
|
|
12
21
|
this.runTime = new Observable(true);
|
|
13
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Observable indicating if the application is a development build.
|
|
24
|
+
* @zprop
|
|
25
|
+
**/
|
|
14
26
|
this.developmentBuild = new Observable(typeof process !== 'undefined' && process?.env?.NODE_ENV === 'development');
|
|
15
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Observable indicating if the application is a production build.
|
|
29
|
+
* @zprop
|
|
30
|
+
* */
|
|
16
31
|
this.productionBuild = new Observable(!this.developmentBuild.value);
|
|
17
32
|
}
|
|
18
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Determines if the application is in design time.
|
|
36
|
+
* @param ctx The context manager to query.
|
|
37
|
+
* @returns {boolean} True if in design time, otherwise false.
|
|
38
|
+
*/
|
|
19
39
|
export function isDesignTime(ctx) {
|
|
20
40
|
return ctx.get(EnvironmentContext).designTime.value;
|
|
21
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Determines if the application is in edit time.
|
|
44
|
+
* @param ctx The context manager to query.
|
|
45
|
+
* @returns {boolean} True if in edit time, otherwise false.
|
|
46
|
+
*/
|
|
22
47
|
export function isEditTime(ctx) {
|
|
23
48
|
return ctx.get(EnvironmentContext).editTime.value;
|
|
24
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Determines if the application is a development build.
|
|
52
|
+
* @param ctx The context manager to query.
|
|
53
|
+
* @returns {boolean} True if it's a development build, otherwise false.
|
|
54
|
+
*/
|
|
25
55
|
export function isDevelopmentBuild(ctx) {
|
|
26
56
|
return ctx.get(EnvironmentContext).developmentBuild.value;
|
|
27
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Determines if the application is a production build.
|
|
60
|
+
* @param ctx The context manager to query.
|
|
61
|
+
* @returns {boolean} True if it's a production build, otherwise false.
|
|
62
|
+
*/
|
|
28
63
|
export function isProductionBuild(ctx) {
|
|
29
64
|
return ctx.get(EnvironmentContext).productionBuild.value;
|
|
30
65
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Context, ContextManager } from '../context';
|
|
2
2
|
import { Event } from '../event';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the axes of a gamepad.
|
|
5
|
+
*/
|
|
3
6
|
export declare enum GamepadAxis {
|
|
4
7
|
LeftStickHorizontal = "LeftStickHorizontal",
|
|
5
8
|
LeftStickVertical = "LeftStickVertical",
|
|
6
9
|
RightStickHorizontal = "RightStickHorizontal",
|
|
7
10
|
RightStickVertical = "RightStickVertical"
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents the buttons on a gamepad.
|
|
14
|
+
*/
|
|
9
15
|
export declare enum GamepadButton {
|
|
10
16
|
South = "South",
|
|
11
17
|
East = "East",
|
|
@@ -25,16 +31,48 @@ export declare enum GamepadButton {
|
|
|
25
31
|
DRight = "DRight",
|
|
26
32
|
Center = "Center"
|
|
27
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Manages and tracks gamepad connections and states.
|
|
36
|
+
* @zcontext
|
|
37
|
+
*/
|
|
28
38
|
export declare class GamepadContext extends Context {
|
|
29
39
|
readonly onGamepadsChange: Event<[]>;
|
|
30
40
|
readonly activeGamepads: Set<number>;
|
|
31
41
|
private _registeredGamepads;
|
|
42
|
+
/**
|
|
43
|
+
* Creates an instance of GamepadContext.
|
|
44
|
+
* @param contextManager - The current ContextManager
|
|
45
|
+
*/
|
|
32
46
|
constructor(contextManager: ContextManager);
|
|
33
47
|
private _update;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves a gamepad instance by its index.
|
|
50
|
+
* @param indx The index of the gamepad.
|
|
51
|
+
* @returns The gamepad instance or null if not found.
|
|
52
|
+
*/
|
|
34
53
|
getGamepad(indx: number): Gamepad | null;
|
|
54
|
+
/**
|
|
55
|
+
* Executes a function on each active gamepad, optionally filtered by index.
|
|
56
|
+
* @param requestedIndex The index to filter gamepads by, if specified.
|
|
57
|
+
* @param fn The function to execute on each matching gamepad.
|
|
58
|
+
*/
|
|
35
59
|
forGamepadsMatchingIndex(requestedIndex: number | undefined, fn: (gamepad: Gamepad) => void): void;
|
|
60
|
+
/**
|
|
61
|
+
* Registers a gamepad with a specific index.
|
|
62
|
+
* @param indx The index of the gamepad.
|
|
63
|
+
* @param gamepad The gamepad to register.
|
|
64
|
+
*/
|
|
36
65
|
registerGamepad(indx: number, gamepad: Gamepad): void;
|
|
66
|
+
/**
|
|
67
|
+
* Unregisters a gamepad by its index.
|
|
68
|
+
* @param indx The index of the gamepad to unregister.
|
|
69
|
+
*/
|
|
37
70
|
unregsiterGamepad(indx: number): void;
|
|
38
71
|
dispose(): never;
|
|
39
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Converts a gamepad axis enum value to its corresponding numeric representation.
|
|
75
|
+
* @param axis The gamepad axis to translate.
|
|
76
|
+
* @returns The numeric representation of the gamepad axis.
|
|
77
|
+
*/
|
|
40
78
|
export declare function translateGamepadAxis(axis: GamepadAxis): number;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Context } from '../context';
|
|
2
2
|
import { Event } from '../event';
|
|
3
3
|
import { isDesignTime } from './environmentcontext';
|
|
4
|
+
/**
|
|
5
|
+
* Represents the axes of a gamepad.
|
|
6
|
+
*/
|
|
4
7
|
export var GamepadAxis;
|
|
5
8
|
(function (GamepadAxis) {
|
|
6
9
|
GamepadAxis["LeftStickHorizontal"] = "LeftStickHorizontal";
|
|
@@ -8,6 +11,9 @@ export var GamepadAxis;
|
|
|
8
11
|
GamepadAxis["RightStickHorizontal"] = "RightStickHorizontal";
|
|
9
12
|
GamepadAxis["RightStickVertical"] = "RightStickVertical";
|
|
10
13
|
})(GamepadAxis || (GamepadAxis = {}));
|
|
14
|
+
/**
|
|
15
|
+
* Represents the buttons on a gamepad.
|
|
16
|
+
*/
|
|
11
17
|
export var GamepadButton;
|
|
12
18
|
(function (GamepadButton) {
|
|
13
19
|
GamepadButton["South"] = "South";
|
|
@@ -28,7 +34,15 @@ export var GamepadButton;
|
|
|
28
34
|
GamepadButton["DRight"] = "DRight";
|
|
29
35
|
GamepadButton["Center"] = "Center";
|
|
30
36
|
})(GamepadButton || (GamepadButton = {}));
|
|
37
|
+
/**
|
|
38
|
+
* Manages and tracks gamepad connections and states.
|
|
39
|
+
* @zcontext
|
|
40
|
+
*/
|
|
31
41
|
export class GamepadContext extends Context {
|
|
42
|
+
/**
|
|
43
|
+
* Creates an instance of GamepadContext.
|
|
44
|
+
* @param contextManager - The current ContextManager
|
|
45
|
+
*/
|
|
32
46
|
constructor(contextManager) {
|
|
33
47
|
super(contextManager, {});
|
|
34
48
|
this.onGamepadsChange = new Event();
|
|
@@ -56,9 +70,19 @@ export class GamepadContext extends Context {
|
|
|
56
70
|
}
|
|
57
71
|
this._update();
|
|
58
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Retrieves a gamepad instance by its index.
|
|
75
|
+
* @param indx The index of the gamepad.
|
|
76
|
+
* @returns The gamepad instance or null if not found.
|
|
77
|
+
*/
|
|
59
78
|
getGamepad(indx) {
|
|
60
79
|
return this._registeredGamepads.get(indx) ?? (navigator.getGamepads?.()?.[indx] || null);
|
|
61
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Executes a function on each active gamepad, optionally filtered by index.
|
|
83
|
+
* @param requestedIndex The index to filter gamepads by, if specified.
|
|
84
|
+
* @param fn The function to execute on each matching gamepad.
|
|
85
|
+
*/
|
|
62
86
|
forGamepadsMatchingIndex(requestedIndex, fn) {
|
|
63
87
|
for (const indx of this.activeGamepads) {
|
|
64
88
|
if (requestedIndex !== undefined && indx !== requestedIndex)
|
|
@@ -68,12 +92,21 @@ export class GamepadContext extends Context {
|
|
|
68
92
|
fn(gamepad);
|
|
69
93
|
}
|
|
70
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Registers a gamepad with a specific index.
|
|
97
|
+
* @param indx The index of the gamepad.
|
|
98
|
+
* @param gamepad The gamepad to register.
|
|
99
|
+
*/
|
|
71
100
|
registerGamepad(indx, gamepad) {
|
|
72
101
|
this._registeredGamepads.set(indx, gamepad);
|
|
73
102
|
if (gamepad !== null)
|
|
74
103
|
this.activeGamepads.add(indx);
|
|
75
104
|
this.onGamepadsChange.emit();
|
|
76
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Unregisters a gamepad by its index.
|
|
108
|
+
* @param indx The index of the gamepad to unregister.
|
|
109
|
+
*/
|
|
77
110
|
unregsiterGamepad(indx) {
|
|
78
111
|
this._registeredGamepads.delete(indx);
|
|
79
112
|
this.activeGamepads.delete(indx);
|
|
@@ -85,6 +118,11 @@ export class GamepadContext extends Context {
|
|
|
85
118
|
return super.dispose();
|
|
86
119
|
}
|
|
87
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Converts a gamepad axis enum value to its corresponding numeric representation.
|
|
123
|
+
* @param axis The gamepad axis to translate.
|
|
124
|
+
* @returns The numeric representation of the gamepad axis.
|
|
125
|
+
*/
|
|
88
126
|
export function translateGamepadAxis(axis) {
|
|
89
127
|
switch (axis) {
|
|
90
128
|
case GamepadAxis.LeftStickHorizontal:
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Context, ContextManager, Event, Observable } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the modes for interpreting touch gestures.
|
|
4
|
+
*/
|
|
2
5
|
export declare enum GestureMode {
|
|
3
6
|
ScaleOnly = "Scale Only",
|
|
4
7
|
RotateOnly = "Rotate Only",
|
|
5
8
|
ScaleRotate = "Scale Rotate"
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Configuration options for GestureContext construction.
|
|
12
|
+
*/
|
|
7
13
|
interface ConstructionProps {
|
|
8
14
|
/**
|
|
9
15
|
* The HTML element to which touch event listeners are attached.
|
|
@@ -11,7 +17,10 @@ interface ConstructionProps {
|
|
|
11
17
|
*/
|
|
12
18
|
element?: HTMLElement;
|
|
13
19
|
}
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Manages touch gestures for scaling and rotating elements.
|
|
22
|
+
* @zcontext
|
|
23
|
+
**/
|
|
15
24
|
export declare class GestureContext extends Context<ConstructionProps> {
|
|
16
25
|
private element;
|
|
17
26
|
private canScale;
|
|
@@ -21,26 +30,44 @@ export declare class GestureContext extends Context<ConstructionProps> {
|
|
|
21
30
|
private initialAngle;
|
|
22
31
|
private oneFingerRotateMode;
|
|
23
32
|
private initialTouchX;
|
|
33
|
+
/**
|
|
34
|
+
* Observable representing the current rotation value.
|
|
35
|
+
*/
|
|
24
36
|
rotation: Observable<number, never>;
|
|
37
|
+
/**
|
|
38
|
+
* Observable representing the current scale value.
|
|
39
|
+
*/
|
|
25
40
|
scale: Observable<number, never>;
|
|
41
|
+
/**
|
|
42
|
+
* Event triggered when rotation occurs.
|
|
43
|
+
*/
|
|
26
44
|
onRotate: Event<[number]>;
|
|
45
|
+
/**
|
|
46
|
+
* Event triggered when scaling occurs.
|
|
47
|
+
*/
|
|
27
48
|
onScale: Event<[number]>;
|
|
28
49
|
/**
|
|
50
|
+
* Observable indicating whether gesture interactions are enabled.
|
|
29
51
|
* Defaults to true.
|
|
30
52
|
*/
|
|
31
53
|
enabled: Observable<boolean, never>;
|
|
32
54
|
/**
|
|
33
|
-
* Defaults to 0.5
|
|
55
|
+
* Minimum scale factor. Defaults to 0.5.
|
|
34
56
|
*/
|
|
35
57
|
minScale: number;
|
|
36
58
|
/**
|
|
37
|
-
* Defaults to 2.
|
|
59
|
+
* Maximum scale factor. Defaults to 2.
|
|
38
60
|
*/
|
|
39
61
|
maxScale: number;
|
|
40
62
|
/**
|
|
41
|
-
* Defaults to 1.
|
|
63
|
+
* Sensitivity of rotation. Defaults to 1.
|
|
42
64
|
*/
|
|
43
65
|
rotationSensitivity: number;
|
|
66
|
+
/**
|
|
67
|
+
* Creates an instance of GestureContext.
|
|
68
|
+
* @param contextManager - The current ContextManager
|
|
69
|
+
* @param constructorProps - The constructor properties.
|
|
70
|
+
*/
|
|
44
71
|
constructor(contextManager: ContextManager, constructorProps: ConstructionProps);
|
|
45
72
|
private onTouchStart;
|
|
46
73
|
private onTouchMove;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { Context, Event, Observable, useCanvas } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the modes for interpreting touch gestures.
|
|
4
|
+
*/
|
|
2
5
|
export var GestureMode;
|
|
3
6
|
(function (GestureMode) {
|
|
4
7
|
GestureMode["ScaleOnly"] = "Scale Only";
|
|
5
8
|
GestureMode["RotateOnly"] = "Rotate Only";
|
|
6
9
|
GestureMode["ScaleRotate"] = "Scale Rotate";
|
|
7
10
|
})(GestureMode || (GestureMode = {}));
|
|
8
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Manages touch gestures for scaling and rotating elements.
|
|
13
|
+
* @zcontext
|
|
14
|
+
**/
|
|
9
15
|
export class GestureContext extends Context {
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of GestureContext.
|
|
18
|
+
* @param contextManager - The current ContextManager
|
|
19
|
+
* @param constructorProps - The constructor properties.
|
|
20
|
+
*/
|
|
10
21
|
constructor(contextManager, constructorProps) {
|
|
11
22
|
super(contextManager, constructorProps);
|
|
12
23
|
this.canScale = true;
|
|
@@ -16,24 +27,37 @@ export class GestureContext extends Context {
|
|
|
16
27
|
this.initialAngle = null;
|
|
17
28
|
this.oneFingerRotateMode = true;
|
|
18
29
|
this.initialTouchX = null;
|
|
30
|
+
/**
|
|
31
|
+
* Observable representing the current rotation value.
|
|
32
|
+
*/
|
|
19
33
|
this.rotation = new Observable(0);
|
|
34
|
+
/**
|
|
35
|
+
* Observable representing the current scale value.
|
|
36
|
+
*/
|
|
20
37
|
this.scale = new Observable(0);
|
|
38
|
+
/**
|
|
39
|
+
* Event triggered when rotation occurs.
|
|
40
|
+
*/
|
|
21
41
|
this.onRotate = new Event();
|
|
42
|
+
/**
|
|
43
|
+
* Event triggered when scaling occurs.
|
|
44
|
+
*/
|
|
22
45
|
this.onScale = new Event();
|
|
23
46
|
/**
|
|
47
|
+
* Observable indicating whether gesture interactions are enabled.
|
|
24
48
|
* Defaults to true.
|
|
25
49
|
*/
|
|
26
50
|
this.enabled = new Observable(true);
|
|
27
51
|
/**
|
|
28
|
-
* Defaults to 0.5
|
|
52
|
+
* Minimum scale factor. Defaults to 0.5.
|
|
29
53
|
*/
|
|
30
54
|
this.minScale = 0.5;
|
|
31
55
|
/**
|
|
32
|
-
* Defaults to 2.
|
|
56
|
+
* Maximum scale factor. Defaults to 2.
|
|
33
57
|
*/
|
|
34
58
|
this.maxScale = 2;
|
|
35
59
|
/**
|
|
36
|
-
* Defaults to 1.
|
|
60
|
+
* Sensitivity of rotation. Defaults to 1.
|
|
37
61
|
*/
|
|
38
62
|
this.rotationSensitivity = 1;
|
|
39
63
|
this.onTouchStart = (event) => {
|