@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
|
@@ -9,17 +9,43 @@ import { resolveClipTimeLoops, Track } from './track';
|
|
|
9
9
|
* @param _property The property or array of properties targeted by the stream.
|
|
10
10
|
*/
|
|
11
11
|
export class StreamTrack extends Track {
|
|
12
|
+
animation;
|
|
13
|
+
_entity;
|
|
14
|
+
_property;
|
|
15
|
+
_stream;
|
|
16
|
+
/**
|
|
17
|
+
* @default []
|
|
18
|
+
*/
|
|
19
|
+
_entities = [];
|
|
20
|
+
/**
|
|
21
|
+
* @default {}
|
|
22
|
+
*/
|
|
23
|
+
_entitiesById = {};
|
|
24
|
+
/**
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
_entitiesDirty = false;
|
|
28
|
+
/**
|
|
29
|
+
* @default []
|
|
30
|
+
*/
|
|
31
|
+
_weights = [];
|
|
32
|
+
/**
|
|
33
|
+
* @default {}
|
|
34
|
+
*/
|
|
35
|
+
_weightsById = {};
|
|
36
|
+
/**
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
_weightsDirty = false;
|
|
40
|
+
_lastTick;
|
|
41
|
+
_lastLoopNumber;
|
|
42
|
+
_lastState;
|
|
43
|
+
_lastRate;
|
|
12
44
|
constructor(animation, _entity, _property) {
|
|
13
45
|
super(animation);
|
|
14
46
|
this.animation = animation;
|
|
15
47
|
this._entity = _entity;
|
|
16
48
|
this._property = _property;
|
|
17
|
-
this._entities = [];
|
|
18
|
-
this._entitiesById = {};
|
|
19
|
-
this._entitiesDirty = false;
|
|
20
|
-
this._weights = [];
|
|
21
|
-
this._weightsById = {};
|
|
22
|
-
this._weightsDirty = false;
|
|
23
49
|
}
|
|
24
50
|
/**
|
|
25
51
|
* Getter for the list of paths influenced by the track.
|
|
@@ -54,7 +54,10 @@ export declare function resolveKeyframeValue(t: number, before: Keyframe, after:
|
|
|
54
54
|
* @param t The time for which to find the keyframes.
|
|
55
55
|
* @returns A tuple containing the keyframes before and after the given time.
|
|
56
56
|
*/
|
|
57
|
-
export declare function resolveKeyframes(keyframes: Keyframe[], t: number): [
|
|
57
|
+
export declare function resolveKeyframes(keyframes: Keyframe[], t: number): [
|
|
58
|
+
before: Keyframe | undefined,
|
|
59
|
+
after: Keyframe | undefined
|
|
60
|
+
];
|
|
58
61
|
/**
|
|
59
62
|
* Resolves the clip time and loop number for a given time within a clip.
|
|
60
63
|
*
|
|
@@ -67,4 +70,7 @@ export declare function resolveKeyframes(keyframes: Keyframe[], t: number): [bef
|
|
|
67
70
|
* @param t1 Optional end time of the clip.
|
|
68
71
|
* @returns A tuple containing the resolved clip time and loop number.
|
|
69
72
|
*/
|
|
70
|
-
export declare function resolveClipTimeLoops(t: number, t0: number, s0: number, rate: number, length: number, timeBackwards: boolean, t1?: number): [
|
|
73
|
+
export declare function resolveClipTimeLoops(t: number, t0: number, s0: number, rate: number, length: number, timeBackwards: boolean, t1?: number): [
|
|
74
|
+
ct: number,
|
|
75
|
+
loop: number
|
|
76
|
+
];
|
|
@@ -9,10 +9,11 @@ import { interpolate } from '../interpolate';
|
|
|
9
9
|
* @param id Optional unique identifier for the track.
|
|
10
10
|
*/
|
|
11
11
|
export class Track {
|
|
12
|
+
id;
|
|
13
|
+
/** @internal */
|
|
14
|
+
influencedPathsDirty = new Observable(false);
|
|
12
15
|
constructor(anim, id) {
|
|
13
16
|
this.id = id;
|
|
14
|
-
/** @internal */
|
|
15
|
-
this.influencedPathsDirty = new Observable(false);
|
|
16
17
|
if (id)
|
|
17
18
|
anim.trackByID.set(id, this);
|
|
18
19
|
}
|
package/lib/behavior.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Entity } from './entity';
|
|
2
|
+
import { notify } from './observe';
|
|
2
3
|
/**
|
|
3
4
|
* Base class for all behaviors.
|
|
4
5
|
*
|
|
@@ -9,6 +10,7 @@ import { Entity } from './entity';
|
|
|
9
10
|
* @link [custom-behaviors](https://docs.zap.works/mattercraft/scripting/custom-behaviors/)
|
|
10
11
|
*/
|
|
11
12
|
export class Behavior extends Entity {
|
|
13
|
+
instance;
|
|
12
14
|
/**
|
|
13
15
|
* Constructs this behavior
|
|
14
16
|
*
|
|
@@ -18,18 +20,19 @@ export class Behavior extends Entity {
|
|
|
18
20
|
constructor(contextManager, instance) {
|
|
19
21
|
super(contextManager);
|
|
20
22
|
this.instance = instance;
|
|
21
|
-
this._updateEnabledResolved = () => {
|
|
22
|
-
let newValue = this.enabled.value;
|
|
23
|
-
if (this.instance.enabledResolved?.value === false)
|
|
24
|
-
newValue = false;
|
|
25
|
-
if (newValue !== this.enabledResolved.value) {
|
|
26
|
-
this.enabledResolved.value = newValue;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
23
|
instance.addBehavior(this);
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
24
|
+
this.observe(this, 'enabled', this._updateEnabledResolved, { bindWhenDisabled: true });
|
|
25
|
+
this.observe(instance, 'enabledResolved', this._updateEnabledResolved, { bindWhenDisabled: true });
|
|
32
26
|
}
|
|
27
|
+
_updateEnabledResolved = () => {
|
|
28
|
+
let newValue = this.enabled;
|
|
29
|
+
if (this.instance.enabledResolved === false)
|
|
30
|
+
newValue = false;
|
|
31
|
+
if (newValue !== this.enabledResolved) {
|
|
32
|
+
this._enabledResolved = newValue;
|
|
33
|
+
notify(this, 'enabledResolved');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
33
36
|
dispose() {
|
|
34
37
|
this.instance.removeBehavior(this);
|
|
35
38
|
return super.dispose();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionBehavior
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ActionBehavior } from '../actionbehavior';
|
|
2
|
+
import { Easing } from '../data';
|
|
3
|
+
import { ValueOf } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Behavior to activate a specific animation state.
|
|
6
6
|
* @zbehavior
|
|
@@ -8,50 +8,48 @@ import { ContextManager } from '../context';
|
|
|
8
8
|
* @zgroup Animation Actions
|
|
9
9
|
*/
|
|
10
10
|
export declare class ActivateState extends ActionBehavior {
|
|
11
|
-
private zcomponent;
|
|
11
|
+
private readonly zcomponent;
|
|
12
12
|
/**
|
|
13
13
|
* The ID of the animation state to be activated.
|
|
14
|
-
* @
|
|
15
|
-
* @zgroup Activate State Settings
|
|
16
|
-
* @zgrouppriority 20
|
|
14
|
+
* @zui
|
|
17
15
|
* @zvalues layerclipids
|
|
18
16
|
*/
|
|
19
|
-
state
|
|
17
|
+
state?: string;
|
|
20
18
|
/**
|
|
21
19
|
* Override time for the fade transition.
|
|
22
|
-
* @
|
|
20
|
+
* @zui
|
|
23
21
|
* @zgroup Override Fade
|
|
24
22
|
* @zgrouppriority 10
|
|
25
23
|
* @ztype time-milliseconds
|
|
26
24
|
*/
|
|
27
25
|
fadeTime?: number;
|
|
28
26
|
/**
|
|
29
|
-
* @
|
|
27
|
+
* @zui
|
|
30
28
|
* @zgroup Override Fade
|
|
31
29
|
* @zgrouppriority 10
|
|
32
|
-
* @zdefault 0
|
|
33
30
|
*/
|
|
34
|
-
pin?:
|
|
31
|
+
pin?: PinValue | number;
|
|
35
32
|
/**
|
|
36
33
|
* Easing function for the fade transition.
|
|
37
|
-
* @
|
|
34
|
+
* @default "linear"
|
|
35
|
+
* @zui
|
|
38
36
|
* @zgroup Override Fade
|
|
39
37
|
* @zgrouppriority 10
|
|
40
|
-
* @zdefault 0
|
|
41
38
|
* @zvalues easings
|
|
42
39
|
*/
|
|
43
|
-
easing
|
|
44
|
-
constructor(contextManager: ContextManager, instance: Component, props: ActionBehaviorConstructorProps);
|
|
45
|
-
/** @zprop */
|
|
40
|
+
easing: Easing;
|
|
46
41
|
perform(): void;
|
|
47
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* @zui
|
|
44
|
+
*/
|
|
48
45
|
preview(): void;
|
|
49
46
|
}
|
|
50
47
|
/**
|
|
51
|
-
*
|
|
48
|
+
* Object for specifying the pin point of the animation.
|
|
52
49
|
*/
|
|
53
|
-
export declare
|
|
54
|
-
Start
|
|
55
|
-
Middle
|
|
56
|
-
End
|
|
57
|
-
}
|
|
50
|
+
export declare const Pin: {
|
|
51
|
+
readonly Start: 0;
|
|
52
|
+
readonly Middle: 0.5;
|
|
53
|
+
readonly End: 1;
|
|
54
|
+
};
|
|
55
|
+
export type PinValue = ValueOf<typeof Pin>;
|
|
@@ -1,44 +1,154 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
1
35
|
import { ActionBehavior } from '../actionbehavior';
|
|
2
|
-
import {
|
|
36
|
+
import { zBehavior, zUI } from '../decorators';
|
|
37
|
+
import { BehaviorGroups } from '../groups';
|
|
38
|
+
const overrideFadeGroup = {
|
|
39
|
+
name: 'Override Fade',
|
|
40
|
+
priority: 10,
|
|
41
|
+
};
|
|
3
42
|
/**
|
|
4
43
|
* Behavior to activate a specific animation state.
|
|
5
44
|
* @zbehavior
|
|
6
45
|
* @zicon play_circle
|
|
7
46
|
* @zgroup Animation Actions
|
|
8
47
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
48
|
+
let ActivateState = (() => {
|
|
49
|
+
let _classDecorators = [zBehavior({ runAtDesignTime: true, icon: 'play_circle', group: BehaviorGroups.AnimationActions })];
|
|
50
|
+
let _classDescriptor;
|
|
51
|
+
let _classExtraInitializers = [];
|
|
52
|
+
let _classThis;
|
|
53
|
+
let _classSuper = ActionBehavior;
|
|
54
|
+
let _instanceExtraInitializers = [];
|
|
55
|
+
let _state_decorators;
|
|
56
|
+
let _state_initializers = [];
|
|
57
|
+
let _state_extraInitializers = [];
|
|
58
|
+
let _fadeTime_decorators;
|
|
59
|
+
let _fadeTime_initializers = [];
|
|
60
|
+
let _fadeTime_extraInitializers = [];
|
|
61
|
+
let _pin_decorators;
|
|
62
|
+
let _pin_initializers = [];
|
|
63
|
+
let _pin_extraInitializers = [];
|
|
64
|
+
let _easing_decorators;
|
|
65
|
+
let _easing_initializers = [];
|
|
66
|
+
let _easing_extraInitializers = [];
|
|
67
|
+
let _preview_decorators;
|
|
68
|
+
var ActivateState = class extends _classSuper {
|
|
69
|
+
static { _classThis = this; }
|
|
70
|
+
static {
|
|
71
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
72
|
+
_state_decorators = [zUI({ values: 'layerclipids' })];
|
|
73
|
+
_fadeTime_decorators = [zUI({ group: overrideFadeGroup, type: 'time-milliseconds' })];
|
|
74
|
+
_pin_decorators = [zUI({ group: overrideFadeGroup })];
|
|
75
|
+
_easing_decorators = [zUI({ group: overrideFadeGroup, values: 'easings' })];
|
|
76
|
+
_preview_decorators = [zUI()];
|
|
77
|
+
__esDecorate(this, null, _preview_decorators, { kind: "method", name: "preview", static: false, private: false, access: { has: obj => "preview" in obj, get: obj => obj.preview }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
78
|
+
__esDecorate(null, null, _state_decorators, { kind: "field", name: "state", static: false, private: false, access: { has: obj => "state" in obj, get: obj => obj.state, set: (obj, value) => { obj.state = value; } }, metadata: _metadata }, _state_initializers, _state_extraInitializers);
|
|
79
|
+
__esDecorate(null, null, _fadeTime_decorators, { kind: "field", name: "fadeTime", static: false, private: false, access: { has: obj => "fadeTime" in obj, get: obj => obj.fadeTime, set: (obj, value) => { obj.fadeTime = value; } }, metadata: _metadata }, _fadeTime_initializers, _fadeTime_extraInitializers);
|
|
80
|
+
__esDecorate(null, null, _pin_decorators, { kind: "field", name: "pin", static: false, private: false, access: { has: obj => "pin" in obj, get: obj => obj.pin, set: (obj, value) => { obj.pin = value; } }, metadata: _metadata }, _pin_initializers, _pin_extraInitializers);
|
|
81
|
+
__esDecorate(null, null, _easing_decorators, { kind: "field", name: "easing", static: false, private: false, access: { has: obj => "easing" in obj, get: obj => obj.easing, set: (obj, value) => { obj.easing = value; } }, metadata: _metadata }, _easing_initializers, _easing_extraInitializers);
|
|
82
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
83
|
+
ActivateState = _classThis = _classDescriptor.value;
|
|
84
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
85
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
86
|
+
}
|
|
87
|
+
zcomponent = (__runInitializers(this, _instanceExtraInitializers), this.getZComponentInstance());
|
|
88
|
+
/**
|
|
89
|
+
* The ID of the animation state to be activated.
|
|
90
|
+
* @zui
|
|
91
|
+
* @zvalues layerclipids
|
|
92
|
+
*/
|
|
93
|
+
state = __runInitializers(this, _state_initializers, void 0);
|
|
94
|
+
/**
|
|
95
|
+
* Override time for the fade transition.
|
|
96
|
+
* @zui
|
|
97
|
+
* @zgroup Override Fade
|
|
98
|
+
* @zgrouppriority 10
|
|
99
|
+
* @ztype time-milliseconds
|
|
100
|
+
*/
|
|
101
|
+
fadeTime = (__runInitializers(this, _state_extraInitializers), __runInitializers(this, _fadeTime_initializers, void 0));
|
|
102
|
+
/**
|
|
103
|
+
* @zui
|
|
104
|
+
* @zgroup Override Fade
|
|
105
|
+
* @zgrouppriority 10
|
|
106
|
+
*/
|
|
107
|
+
pin = (__runInitializers(this, _fadeTime_extraInitializers), __runInitializers(this, _pin_initializers, void 0));
|
|
108
|
+
/**
|
|
109
|
+
* Easing function for the fade transition.
|
|
110
|
+
* @default "linear"
|
|
111
|
+
* @zui
|
|
112
|
+
* @zgroup Override Fade
|
|
113
|
+
* @zgrouppriority 10
|
|
114
|
+
* @zvalues easings
|
|
115
|
+
*/
|
|
116
|
+
easing = (__runInitializers(this, _pin_extraInitializers), __runInitializers(this, _easing_initializers, 'linear'));
|
|
117
|
+
perform() {
|
|
118
|
+
if (!this.state)
|
|
119
|
+
return;
|
|
120
|
+
const layerclip = this.zcomponent.animation.layerClipByID.get(this.state);
|
|
121
|
+
if (!layerclip)
|
|
122
|
+
return;
|
|
123
|
+
const opts = {
|
|
124
|
+
fade: {
|
|
125
|
+
time: this.fadeTime,
|
|
126
|
+
pin: this.pin,
|
|
127
|
+
easing: this.easing,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
layerclip.play(opts);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @zui
|
|
134
|
+
*/
|
|
135
|
+
preview() {
|
|
136
|
+
this.perform();
|
|
137
|
+
}
|
|
138
|
+
constructor() {
|
|
139
|
+
super(...arguments);
|
|
140
|
+
__runInitializers(this, _easing_extraInitializers);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
return ActivateState = _classThis;
|
|
144
|
+
})();
|
|
145
|
+
export { ActivateState };
|
|
35
146
|
/**
|
|
36
|
-
*
|
|
147
|
+
* Object for specifying the pin point of the animation.
|
|
37
148
|
*/
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
registerBehaviorRunAtDesignTime(ActivateState);
|
|
149
|
+
export const Pin = {
|
|
150
|
+
Start: 0,
|
|
151
|
+
Middle: 0.5,
|
|
152
|
+
End: 1,
|
|
153
|
+
};
|
|
154
|
+
Object.freeze(Pin);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ActionBehavior } from '../actionbehavior';
|
|
2
2
|
/**
|
|
3
3
|
* Calls an exposed function on a context
|
|
4
|
-
*
|
|
5
4
|
* @zbehavior
|
|
6
5
|
* @zicon function
|
|
7
6
|
* @zgroup Actions
|
|
@@ -9,11 +8,10 @@ import { ActionBehavior } from '../actionbehavior';
|
|
|
9
8
|
export declare class CallFunction extends ActionBehavior {
|
|
10
9
|
/**
|
|
11
10
|
* The function and arguments to call
|
|
12
|
-
* @zprop
|
|
13
11
|
*/
|
|
14
12
|
function: () => any;
|
|
15
|
-
/**
|
|
16
|
-
* @
|
|
13
|
+
/**
|
|
14
|
+
* @zui
|
|
17
15
|
*/
|
|
18
16
|
perform(): void;
|
|
19
17
|
}
|
|
@@ -1,18 +1,76 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
1
35
|
import { ActionBehavior } from '../actionbehavior';
|
|
2
|
-
import {
|
|
36
|
+
import { zBehavior, zUI } from '../decorators';
|
|
37
|
+
import { BehaviorGroups } from '../groups';
|
|
3
38
|
/**
|
|
4
39
|
* Calls an exposed function on a context
|
|
5
|
-
*
|
|
6
40
|
* @zbehavior
|
|
7
41
|
* @zicon function
|
|
8
42
|
* @zgroup Actions
|
|
9
43
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
44
|
+
let CallFunction = (() => {
|
|
45
|
+
let _classDecorators = [zBehavior({ icon: 'function', group: BehaviorGroups.Actions, runAtDesignTime: true })];
|
|
46
|
+
let _classDescriptor;
|
|
47
|
+
let _classExtraInitializers = [];
|
|
48
|
+
let _classThis;
|
|
49
|
+
let _classSuper = ActionBehavior;
|
|
50
|
+
let _instanceExtraInitializers = [];
|
|
51
|
+
let _perform_decorators;
|
|
52
|
+
var CallFunction = class extends _classSuper {
|
|
53
|
+
static { _classThis = this; }
|
|
54
|
+
static {
|
|
55
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
56
|
+
_perform_decorators = [zUI()];
|
|
57
|
+
__esDecorate(this, null, _perform_decorators, { kind: "method", name: "perform", static: false, private: false, access: { has: obj => "perform" in obj, get: obj => obj.perform }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
58
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
59
|
+
CallFunction = _classThis = _classDescriptor.value;
|
|
60
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The function and arguments to call
|
|
65
|
+
*/
|
|
66
|
+
function = __runInitializers(this, _instanceExtraInitializers);
|
|
67
|
+
/**
|
|
68
|
+
* @zui
|
|
69
|
+
*/
|
|
70
|
+
perform() {
|
|
71
|
+
this.function();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return CallFunction = _classThis;
|
|
75
|
+
})();
|
|
76
|
+
export { CallFunction };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ActionBehavior } from '../actionbehavior';
|
|
2
|
+
import { ConstructorForComponent } from '../component';
|
|
3
|
+
/**
|
|
4
|
+
* Changes the root scene of the experience to a different scene/zcomp.
|
|
5
|
+
* @zbehavior
|
|
6
|
+
* @zicon airline_stops
|
|
7
|
+
* @zgroup Actions
|
|
8
|
+
*/
|
|
9
|
+
export declare class ChangeRootScene extends ActionBehavior {
|
|
10
|
+
/**
|
|
11
|
+
* @zui
|
|
12
|
+
* @zgroup ChangeRootScene
|
|
13
|
+
* @zgrouppriority 100
|
|
14
|
+
* @zvalues components zcomponent
|
|
15
|
+
*/
|
|
16
|
+
newScene: ConstructorForComponent<any>;
|
|
17
|
+
/**
|
|
18
|
+
* An amount of time to delay any changes to loading state. Use this to give time for a loader to appear before changing the content.
|
|
19
|
+
* @default 0
|
|
20
|
+
* @zui
|
|
21
|
+
* @zgroup ChangeRootScene
|
|
22
|
+
* @zgrouppriority 100
|
|
23
|
+
* @ztype time-milliseconds
|
|
24
|
+
*/
|
|
25
|
+
delayForLoader: number;
|
|
26
|
+
/**
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
private _isDelaying;
|
|
30
|
+
/**
|
|
31
|
+
* @zui
|
|
32
|
+
*/
|
|
33
|
+
perform(): void;
|
|
34
|
+
private _changeRoot;
|
|
35
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { ActionBehavior } from '../actionbehavior';
|
|
36
|
+
import { registerLoadable } from '../contexts/loadcontext';
|
|
37
|
+
import { RootComponentsContext } from '../contexts/rootcomponentscontext';
|
|
38
|
+
import { zBehavior, zUI } from '../decorators';
|
|
39
|
+
/**
|
|
40
|
+
* Changes the root scene of the experience to a different scene/zcomp.
|
|
41
|
+
* @zbehavior
|
|
42
|
+
* @zicon airline_stops
|
|
43
|
+
* @zgroup Actions
|
|
44
|
+
*/
|
|
45
|
+
let ChangeRootScene = (() => {
|
|
46
|
+
let _classDecorators = [zBehavior({
|
|
47
|
+
icon: 'airline_stops',
|
|
48
|
+
group: 'Actions',
|
|
49
|
+
})];
|
|
50
|
+
let _classDescriptor;
|
|
51
|
+
let _classExtraInitializers = [];
|
|
52
|
+
let _classThis;
|
|
53
|
+
let _classSuper = ActionBehavior;
|
|
54
|
+
let _instanceExtraInitializers = [];
|
|
55
|
+
let _newScene_decorators;
|
|
56
|
+
let _newScene_initializers = [];
|
|
57
|
+
let _newScene_extraInitializers = [];
|
|
58
|
+
let _delayForLoader_decorators;
|
|
59
|
+
let _delayForLoader_initializers = [];
|
|
60
|
+
let _delayForLoader_extraInitializers = [];
|
|
61
|
+
let _perform_decorators;
|
|
62
|
+
var ChangeRootScene = class extends _classSuper {
|
|
63
|
+
static { _classThis = this; }
|
|
64
|
+
static {
|
|
65
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
66
|
+
_newScene_decorators = [zUI({ group: { name: 'ChangeRootScene', priority: 100 }, values: ['components', 'zcomponent'] })];
|
|
67
|
+
_delayForLoader_decorators = [zUI({ group: { name: 'ChangeRootScene', priority: 100 }, type: 'time-milliseconds' })];
|
|
68
|
+
_perform_decorators = [zUI()];
|
|
69
|
+
__esDecorate(this, null, _perform_decorators, { kind: "method", name: "perform", static: false, private: false, access: { has: obj => "perform" in obj, get: obj => obj.perform }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
70
|
+
__esDecorate(null, null, _newScene_decorators, { kind: "field", name: "newScene", static: false, private: false, access: { has: obj => "newScene" in obj, get: obj => obj.newScene, set: (obj, value) => { obj.newScene = value; } }, metadata: _metadata }, _newScene_initializers, _newScene_extraInitializers);
|
|
71
|
+
__esDecorate(null, null, _delayForLoader_decorators, { kind: "field", name: "delayForLoader", static: false, private: false, access: { has: obj => "delayForLoader" in obj, get: obj => obj.delayForLoader, set: (obj, value) => { obj.delayForLoader = value; } }, metadata: _metadata }, _delayForLoader_initializers, _delayForLoader_extraInitializers);
|
|
72
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
73
|
+
ChangeRootScene = _classThis = _classDescriptor.value;
|
|
74
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
75
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @zui
|
|
79
|
+
* @zgroup ChangeRootScene
|
|
80
|
+
* @zgrouppriority 100
|
|
81
|
+
* @zvalues components zcomponent
|
|
82
|
+
*/
|
|
83
|
+
newScene = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _newScene_initializers, void 0));
|
|
84
|
+
/**
|
|
85
|
+
* An amount of time to delay any changes to loading state. Use this to give time for a loader to appear before changing the content.
|
|
86
|
+
* @default 0
|
|
87
|
+
* @zui
|
|
88
|
+
* @zgroup ChangeRootScene
|
|
89
|
+
* @zgrouppriority 100
|
|
90
|
+
* @ztype time-milliseconds
|
|
91
|
+
*/
|
|
92
|
+
delayForLoader = (__runInitializers(this, _newScene_extraInitializers), __runInitializers(this, _delayForLoader_initializers, 0));
|
|
93
|
+
/**
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
_isDelaying = (__runInitializers(this, _delayForLoader_extraInitializers), false);
|
|
97
|
+
/**
|
|
98
|
+
* @zui
|
|
99
|
+
*/
|
|
100
|
+
perform() {
|
|
101
|
+
if (this.delayForLoader === 0)
|
|
102
|
+
return this._changeRoot();
|
|
103
|
+
if (this._isDelaying)
|
|
104
|
+
return; // prevent multiple calls
|
|
105
|
+
this._isDelaying = true;
|
|
106
|
+
registerLoadable(this, (async () => {
|
|
107
|
+
await delay(this.delayForLoader);
|
|
108
|
+
this._isDelaying = false;
|
|
109
|
+
this._changeRoot();
|
|
110
|
+
})());
|
|
111
|
+
}
|
|
112
|
+
_changeRoot() {
|
|
113
|
+
if (!this.newScene)
|
|
114
|
+
return;
|
|
115
|
+
this.contextManager.get(RootComponentsContext).constructAndReplaceRootComponent(this.newScene, {});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return ChangeRootScene = _classThis;
|
|
119
|
+
})();
|
|
120
|
+
export { ChangeRootScene };
|
|
121
|
+
function delay(ms) {
|
|
122
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
123
|
+
}
|