@zcomponent/core 2.0.0-alpha.1 → 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/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
package/css/zcomponent.css
CHANGED
|
@@ -1,243 +1,242 @@
|
|
|
1
1
|
.zcomponent-defaultloader {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
position: fixed;
|
|
3
|
+
font-family: sans-serif;
|
|
4
|
+
color: white;
|
|
5
|
+
background-color: black;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
background-size: cover;
|
|
10
|
+
background-position: center center;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
#zcomponent-defaultloader-container {
|
|
14
|
-
|
|
14
|
+
text-align: center;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
#zcomponent-defaultloader-subtitle {
|
|
18
|
-
|
|
18
|
+
margin-bottom: 32px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
#zcomponent-defaultloader-progress {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
position: relative;
|
|
23
|
+
width: 300px;
|
|
24
|
+
background-color: #333;
|
|
25
|
+
height: 12px;
|
|
26
|
+
border-radius: 6px;
|
|
27
|
+
margin: 0 auto;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
#zcomponent-defaultloader-progress-percentage {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
position: relative;
|
|
32
|
+
background-color: white;
|
|
33
|
+
height: 12px;
|
|
34
|
+
border-radius: 6px;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
#zcomponent-overlay {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
position: fixed;
|
|
39
|
+
top: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
overflow: hidden;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
#zcomponent-overlay > * {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
pointer-events: auto;
|
|
47
|
+
position: absolute;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
50
|
.zcomponent-align {
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
position: absolute;
|
|
52
|
+
transform-origin: 0 0;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
.zcomponent-h-left {
|
|
57
|
-
|
|
56
|
+
left: 0px;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
.zcomponent-h-left-safe {
|
|
61
|
-
|
|
60
|
+
left: env(safe-area-inset-left, 0px);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
.zcomponent-h-center {
|
|
65
|
-
|
|
64
|
+
left: 50%;
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
.zcomponent-h-right {
|
|
69
|
-
|
|
68
|
+
right: 0px;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
.zcomponent-h-right-safe {
|
|
73
|
-
|
|
72
|
+
right: env(safe-area-inset-right, 0px);
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
.zcomponent-v-top {
|
|
77
|
-
|
|
76
|
+
top: 0px;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
.zcomponent-v-top-safe {
|
|
81
|
-
|
|
80
|
+
top: env(safe-area-inset-top, 0px);
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
.zcomponent-v-center {
|
|
85
|
-
|
|
84
|
+
top: 50%;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
.zcomponent-v-bottom {
|
|
89
|
-
|
|
88
|
+
bottom: 0px;
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
.zcomponent-v-bottom-safe {
|
|
93
|
-
|
|
92
|
+
bottom: env(safe-area-inset-bottom, 0px);
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
:xr-overlay .zcomponent-v-top-safe {
|
|
97
|
-
|
|
96
|
+
top: 45px;
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
.zcomponent-hc-v {
|
|
101
|
-
|
|
100
|
+
transform: translate(-50%, 0);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
.zcomponent-h-vc {
|
|
105
|
-
|
|
104
|
+
transform: translate(0%, -50%);
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
.zcomponent-h-v {
|
|
109
|
-
|
|
108
|
+
transform: translate(0%, 0%);
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
.zcomponent-hc-vc {
|
|
113
|
-
|
|
112
|
+
transform: translate(-50%, -50%);
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
.zcomponent-textalert-container {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
116
|
+
position: absolute;
|
|
117
|
+
bottom: 30px;
|
|
118
|
+
left: 50%;
|
|
119
|
+
transform: translate(-50%, 0);
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
justify-content: end;
|
|
123
|
+
align-items: center;
|
|
124
|
+
row-gap: 24px;
|
|
125
|
+
max-width: 80%;
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
.zcomponent-textalert {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
transition: opacity 0.5s;
|
|
130
|
+
background-color: black;
|
|
131
|
+
border-radius: 10px;
|
|
132
|
+
padding: 20px;
|
|
133
|
+
color: white;
|
|
134
|
+
font-family: sans-serif;
|
|
135
|
+
opacity: 0;
|
|
136
|
+
text-align: center;
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
.zcomponent-textalert-shown {
|
|
141
|
-
|
|
140
|
+
opacity: 1;
|
|
142
141
|
}
|
|
143
142
|
|
|
144
143
|
.zcomponent-cookieconsent {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
z-index: 10000000;
|
|
145
|
+
position: fixed;
|
|
146
|
+
top: 0;
|
|
147
|
+
left: 0;
|
|
148
|
+
width: 100%;
|
|
149
|
+
height: 100%;
|
|
150
|
+
background: rgba(0, 0, 0, 0.7);
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
align-items: center;
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
#zcomponent-cookieconsent-panel {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
157
|
+
background: white;
|
|
158
|
+
border-top-left-radius: 8px;
|
|
159
|
+
border-top-right-radius: 8px;
|
|
160
|
+
margin-top: auto;
|
|
161
|
+
max-width: 500px;
|
|
162
|
+
font-family: sans-serif;
|
|
163
|
+
padding: 24px;
|
|
164
|
+
margin-left: 24px;
|
|
165
|
+
margin-right: 24px;
|
|
166
|
+
max-height: 80%;
|
|
167
|
+
overflow: scroll;
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
#zcomponent-cookieconsent-panel > h1 {
|
|
172
|
-
|
|
171
|
+
font-size: 24px;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
174
|
#zcomponent-cookieconsent-panel button {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
padding: 12px 24px;
|
|
176
|
+
background: none;
|
|
177
|
+
border: 2px solid black;
|
|
178
|
+
border-radius: 4px;
|
|
179
|
+
color: black;
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
#zcomponent-cookieconsent-panel button {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
padding: 12px 24px;
|
|
184
|
+
background: none;
|
|
185
|
+
border: 2px solid black;
|
|
186
|
+
border-radius: 4px;
|
|
187
|
+
color: black;
|
|
188
|
+
display: block;
|
|
189
|
+
outline: none;
|
|
191
190
|
}
|
|
192
191
|
|
|
193
192
|
#zcomponent-cookieconsent-panel #zcomponent-cookieconsent-settings {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
193
|
+
padding: 0;
|
|
194
|
+
border: 0;
|
|
195
|
+
background: none;
|
|
196
|
+
font-weight: bold;
|
|
197
|
+
text-decoration: underline;
|
|
198
|
+
padding-top: 12px;
|
|
200
199
|
}
|
|
201
200
|
|
|
202
201
|
.zcomponent-cookieconsent-type {
|
|
203
|
-
|
|
202
|
+
position: relative;
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
.zcomponent-cookieconsent-type input {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
float: right;
|
|
207
|
+
/* top: 0px; */
|
|
208
|
+
/* right: 0px; */
|
|
209
|
+
width: 32px;
|
|
210
|
+
height: 32px;
|
|
212
211
|
}
|
|
213
212
|
|
|
214
213
|
#zcomponent-cookieconsent-panel h3 {
|
|
215
|
-
|
|
214
|
+
margin-bottom: 6px;
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
#zcomponent-cookieconsent-panel h5 {
|
|
219
|
-
|
|
218
|
+
margin-bottom: 6px;
|
|
220
219
|
}
|
|
221
220
|
|
|
222
221
|
#zcomponent-cookieconsent-panel #zcomponent-cookieconsent-save {
|
|
223
|
-
|
|
222
|
+
padding-top: 12px;
|
|
224
223
|
}
|
|
225
224
|
|
|
226
225
|
#zcomponent-cookieconsent-panel ul {
|
|
227
|
-
|
|
226
|
+
list-style-type: none;
|
|
228
227
|
}
|
|
229
228
|
|
|
230
229
|
#zcomponent-cookieconsent-privacypolicy {
|
|
231
|
-
|
|
230
|
+
padding-bottom: 12px;
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
:root {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
--safe-area-inset-left: env(safe-area-inset-left, 0px);
|
|
235
|
+
--safe-area-inset-right: env(safe-area-inset-right, 0px);
|
|
236
|
+
--safe-area-inset-top: env(safe-area-inset-top, 0px);
|
|
237
|
+
--safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
|
|
239
238
|
}
|
|
240
239
|
|
|
241
240
|
:xr-overlay {
|
|
242
|
-
|
|
243
|
-
}
|
|
241
|
+
--safe-area-inset-top: 45px;
|
|
242
|
+
}
|
package/index.js
CHANGED
package/lib/actionbehavior.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import { ContextManager } from './context';
|
|
|
4
4
|
export interface ActionBehaviorConstructorProps {
|
|
5
5
|
/**
|
|
6
6
|
* The event to listen to in the node that this behavior is attached to. It should be the full name of the event, e.g. "onClick".
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* @zvalues events
|
|
9
9
|
*/
|
|
10
10
|
event: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
12
|
+
*
|
|
13
|
+
* @default false
|
|
14
14
|
*/
|
|
15
15
|
runAtEditTime: boolean;
|
|
16
16
|
}
|
package/lib/actionbehavior.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Event } from './event';
|
|
|
5
5
|
* Base class for all behaviors that perform an action in response to an event.
|
|
6
6
|
*/
|
|
7
7
|
export class ActionBehavior extends Behavior {
|
|
8
|
+
constructorProps;
|
|
8
9
|
/**
|
|
9
10
|
* Creates an instance of ActionBehavior.
|
|
10
11
|
* @param contextManager The current ContextManager
|
|
@@ -14,26 +15,26 @@ export class ActionBehavior extends Behavior {
|
|
|
14
15
|
constructor(contextManager, instance, constructorProps) {
|
|
15
16
|
super(contextManager, instance);
|
|
16
17
|
this.constructorProps = constructorProps;
|
|
17
|
-
this._updateRegistration = () => {
|
|
18
|
-
const evt = this.instance[this.constructorProps.event];
|
|
19
|
-
if (evt instanceof Event) {
|
|
20
|
-
this.unregister(evt, this._perform);
|
|
21
|
-
if (this.enabledResolved.value && (!isEditTime(this.contextManager) || this.constructorProps.runAtEditTime === true)) {
|
|
22
|
-
this.register(evt, this._perform);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
this._perform = (...args) => {
|
|
27
|
-
if (!this.enabledResolved.value)
|
|
28
|
-
return;
|
|
29
|
-
this.perform(...args);
|
|
30
|
-
const e = args[0];
|
|
31
|
-
if (e && typeof e === 'object' && typeof e['stopPropagation'] === 'function') {
|
|
32
|
-
e['stopPropagation'].call(e);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
18
|
const env = contextManager.get(EnvironmentContext);
|
|
36
19
|
this.register(env.editTime, this._updateRegistration, { bindWhenDisabled: true });
|
|
37
|
-
this.
|
|
20
|
+
this.observe(this, 'enabledResolved', this._updateRegistration, { bindWhenDisabled: true });
|
|
38
21
|
}
|
|
22
|
+
_updateRegistration = () => {
|
|
23
|
+
const evt = this.instance[this.constructorProps.event];
|
|
24
|
+
if (evt instanceof Event) {
|
|
25
|
+
this.unregister(evt, this._perform);
|
|
26
|
+
if (this.enabledResolved && (!isEditTime(this.contextManager) || this.constructorProps.runAtEditTime === true)) {
|
|
27
|
+
this.register(evt, this._perform);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
_perform = (...args) => {
|
|
32
|
+
if (!this.enabledResolved)
|
|
33
|
+
return;
|
|
34
|
+
this.perform(...args);
|
|
35
|
+
const e = args[0];
|
|
36
|
+
if (e && typeof e === 'object' && typeof e['stopPropagation'] === 'function') {
|
|
37
|
+
e['stopPropagation'].call(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
39
40
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Layer } from './layer';
|
|
2
|
-
import { Observable } from '../observable';
|
|
3
1
|
import { Event } from '../event';
|
|
4
|
-
import {
|
|
5
|
-
import { Clip } from './clips/clip';
|
|
2
|
+
import { Observable } from '../observable';
|
|
6
3
|
import { AnimationState } from './animationstate';
|
|
7
|
-
import { Track } from './tracks/track';
|
|
8
4
|
import { Bezier } from './bezier';
|
|
5
|
+
import { Clip } from './clips/clip';
|
|
6
|
+
import { Layer } from './layer';
|
|
7
|
+
import { LayerClip } from './layerclip';
|
|
8
|
+
import { Track } from './tracks/track';
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare enum AnimationEvents {
|
|
11
11
|
onLayerClipNotActive = "onLayerClipNotActive",
|
|
@@ -22,6 +22,7 @@ export declare class Animation {
|
|
|
22
22
|
private _initialize;
|
|
23
23
|
/**
|
|
24
24
|
* @internal
|
|
25
|
+
* @default true
|
|
25
26
|
*/
|
|
26
27
|
_FIX_SERIALIZE: boolean;
|
|
27
28
|
/**
|
|
@@ -63,6 +64,9 @@ export declare class Animation {
|
|
|
63
64
|
* Observable indicating whether there are any layers.
|
|
64
65
|
*/
|
|
65
66
|
hasLayers: Observable<boolean, never>;
|
|
67
|
+
/**
|
|
68
|
+
* @default []
|
|
69
|
+
*/
|
|
66
70
|
private _layers;
|
|
67
71
|
private _spotlightLayer?;
|
|
68
72
|
/**
|
|
@@ -71,7 +75,10 @@ export declare class Animation {
|
|
|
71
75
|
timeSource: (() => number) | undefined;
|
|
72
76
|
private _entityPaths;
|
|
73
77
|
private _defaultValuesByPath;
|
|
74
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
* @default []
|
|
81
|
+
*/
|
|
75
82
|
_pendingEvents: {
|
|
76
83
|
evt: AnimationEvents;
|
|
77
84
|
args: any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from '../observable';
|
|
2
1
|
import { Event } from '../event';
|
|
2
|
+
import { Observable } from '../observable';
|
|
3
3
|
import { LayerClip } from './layerclip';
|
|
4
4
|
/** @internal */
|
|
5
5
|
export var AnimationEvents;
|
|
@@ -15,54 +15,67 @@ export var AnimationEvents;
|
|
|
15
15
|
* Ensures proper initialization, disposal, and entity property influence, and emits events based on animation progression.
|
|
16
16
|
*/
|
|
17
17
|
export class Animation {
|
|
18
|
+
_initialize;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
_FIX_SERIALIZE = true;
|
|
24
|
+
/**
|
|
25
|
+
* Collection of layers indexed by ID.
|
|
26
|
+
*/
|
|
27
|
+
layers = Object.create(null);
|
|
28
|
+
/**
|
|
29
|
+
* Collection of clips indexed by ID.
|
|
30
|
+
*/
|
|
31
|
+
clips = Object.create(null);
|
|
32
|
+
curves = Object.create(null);
|
|
33
|
+
onTick = new Event();
|
|
34
|
+
onLayerClipNotActive = new Event();
|
|
35
|
+
onLayerClipActive = new Event();
|
|
36
|
+
onLayerClipState = new Event();
|
|
37
|
+
/**
|
|
38
|
+
* Map for quick access to animation elements by ID.
|
|
39
|
+
*/
|
|
40
|
+
clipByID = new Map();
|
|
41
|
+
/**
|
|
42
|
+
* Map for quick access to animation elements by ID.
|
|
43
|
+
*/
|
|
44
|
+
layerByID = new Map();
|
|
45
|
+
/**
|
|
46
|
+
* Map for quick access to animation elements by ID.
|
|
47
|
+
*/
|
|
48
|
+
layerClipByID = new Map();
|
|
49
|
+
/**
|
|
50
|
+
* Map for quick access to animation elements by ID.
|
|
51
|
+
*/
|
|
52
|
+
trackByID = new Map();
|
|
53
|
+
/**
|
|
54
|
+
* Observable indicating whether there are any layers.
|
|
55
|
+
*/
|
|
56
|
+
hasLayers = new Observable(false);
|
|
57
|
+
/**
|
|
58
|
+
* @default []
|
|
59
|
+
*/
|
|
60
|
+
_layers = [];
|
|
61
|
+
_spotlightLayer;
|
|
62
|
+
/**
|
|
63
|
+
* Source of time for the animation.
|
|
64
|
+
*/
|
|
65
|
+
timeSource;
|
|
66
|
+
_entityPaths = new Map();
|
|
67
|
+
_defaultValuesByPath = new Map();
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @default []
|
|
71
|
+
*/
|
|
72
|
+
_pendingEvents = [];
|
|
18
73
|
/**
|
|
19
74
|
* Creates an instance of Animation.
|
|
20
75
|
* @param _initialize Whether to initialize the animation. Defaults to true.
|
|
21
76
|
*/
|
|
22
77
|
constructor(_initialize = true) {
|
|
23
78
|
this._initialize = _initialize;
|
|
24
|
-
/**
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
this._FIX_SERIALIZE = true;
|
|
28
|
-
/**
|
|
29
|
-
* Collection of layers indexed by ID.
|
|
30
|
-
*/
|
|
31
|
-
this.layers = Object.create(null);
|
|
32
|
-
/**
|
|
33
|
-
* Collection of clips indexed by ID.
|
|
34
|
-
*/
|
|
35
|
-
this.clips = Object.create(null);
|
|
36
|
-
this.curves = Object.create(null);
|
|
37
|
-
this.onTick = new Event();
|
|
38
|
-
this.onLayerClipNotActive = new Event();
|
|
39
|
-
this.onLayerClipActive = new Event();
|
|
40
|
-
this.onLayerClipState = new Event();
|
|
41
|
-
/**
|
|
42
|
-
* Map for quick access to animation elements by ID.
|
|
43
|
-
*/
|
|
44
|
-
this.clipByID = new Map();
|
|
45
|
-
/**
|
|
46
|
-
* Map for quick access to animation elements by ID.
|
|
47
|
-
*/
|
|
48
|
-
this.layerByID = new Map();
|
|
49
|
-
/**
|
|
50
|
-
* Map for quick access to animation elements by ID.
|
|
51
|
-
*/
|
|
52
|
-
this.layerClipByID = new Map();
|
|
53
|
-
/**
|
|
54
|
-
* Map for quick access to animation elements by ID.
|
|
55
|
-
*/
|
|
56
|
-
this.trackByID = new Map();
|
|
57
|
-
/**
|
|
58
|
-
* Observable indicating whether there are any layers.
|
|
59
|
-
*/
|
|
60
|
-
this.hasLayers = new Observable(false);
|
|
61
|
-
this._layers = [];
|
|
62
|
-
this._entityPaths = new Map();
|
|
63
|
-
this._defaultValuesByPath = new Map();
|
|
64
|
-
/** @internal */
|
|
65
|
-
this._pendingEvents = [];
|
|
66
79
|
}
|
|
67
80
|
/**
|
|
68
81
|
* Serializes the current state of the animation.
|
|
@@ -4,7 +4,13 @@ export type Easing = keyof typeof predefinedCurve | null | Bezier;
|
|
|
4
4
|
* Cass to generate and evaluate multiple Bezier curve segments based on provided control points.
|
|
5
5
|
*/
|
|
6
6
|
export declare class Bezier {
|
|
7
|
+
/**
|
|
8
|
+
* @default []
|
|
9
|
+
*/
|
|
7
10
|
private _curves;
|
|
11
|
+
/**
|
|
12
|
+
* @default []
|
|
13
|
+
*/
|
|
8
14
|
private _curveEvaluator;
|
|
9
15
|
/**
|
|
10
16
|
* Creates an instance of Bezier.
|
package/lib/animation/bezier.js
CHANGED
|
@@ -53,13 +53,19 @@ function BezierFactory(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
|
|
|
53
53
|
* Cass to generate and evaluate multiple Bezier curve segments based on provided control points.
|
|
54
54
|
*/
|
|
55
55
|
export class Bezier {
|
|
56
|
+
/**
|
|
57
|
+
* @default []
|
|
58
|
+
*/
|
|
59
|
+
_curves = [];
|
|
60
|
+
/**
|
|
61
|
+
* @default []
|
|
62
|
+
*/
|
|
63
|
+
_curveEvaluator = [];
|
|
56
64
|
/**
|
|
57
65
|
* Creates an instance of Bezier.
|
|
58
66
|
* @param curves An array of control points for each Bezier curve segment.
|
|
59
67
|
*/
|
|
60
68
|
constructor(curves) {
|
|
61
|
-
this._curves = [];
|
|
62
|
-
this._curveEvaluator = [];
|
|
63
69
|
this.updateCurves(curves);
|
|
64
70
|
}
|
|
65
71
|
/**
|
|
@@ -28,11 +28,23 @@ export declare class Clip {
|
|
|
28
28
|
* Optional default parameters for fading animation properties.
|
|
29
29
|
*/
|
|
30
30
|
defaultFadeParameters?: Partial<Data.FadeParameters>;
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
* @default []
|
|
34
|
+
*/
|
|
32
35
|
_streamTracks: (StreamTrack | ClipTrack | FunctionTrack)[];
|
|
36
|
+
/**
|
|
37
|
+
* @default []
|
|
38
|
+
*/
|
|
33
39
|
private _influencedPaths;
|
|
34
40
|
private _tracksByPath;
|
|
41
|
+
/**
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
35
44
|
private _tracksByPathDirty;
|
|
45
|
+
/**
|
|
46
|
+
* @default []
|
|
47
|
+
*/
|
|
36
48
|
private _tracks;
|
|
37
49
|
/**
|
|
38
50
|
* Creates an instance of Clip.
|