@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.
Files changed (168) hide show
  1. package/README.md +1 -0
  2. package/css/zcomponent.css +121 -122
  3. package/index.js +0 -3
  4. package/lib/actionbehavior.d.ts +3 -3
  5. package/lib/actionbehavior.js +20 -19
  6. package/lib/animation/animation.d.ts +13 -6
  7. package/lib/animation/animation.js +56 -43
  8. package/lib/animation/bezier.d.ts +6 -0
  9. package/lib/animation/bezier.js +8 -2
  10. package/lib/animation/clips/clip.d.ts +13 -1
  11. package/lib/animation/clips/clip.js +34 -14
  12. package/lib/animation/index.d.ts +4 -4
  13. package/lib/animation/index.js +4 -4
  14. package/lib/animation/layer.d.ts +9 -0
  15. package/lib/animation/layer.js +28 -12
  16. package/lib/animation/layerclip.d.ts +21 -0
  17. package/lib/animation/layerclip.js +82 -45
  18. package/lib/animation/tracks/cliptrack.d.ts +18 -0
  19. package/lib/animation/tracks/cliptrack.js +27 -6
  20. package/lib/animation/tracks/functiontrack.d.ts +9 -0
  21. package/lib/animation/tracks/functiontrack.js +16 -3
  22. package/lib/animation/tracks/propertytrack.d.ts +20 -1
  23. package/lib/animation/tracks/propertytrack.js +48 -11
  24. package/lib/animation/tracks/streamtrack.d.ts +18 -0
  25. package/lib/animation/tracks/streamtrack.js +32 -6
  26. package/lib/animation/tracks/track.d.ts +8 -2
  27. package/lib/animation/tracks/track.js +3 -2
  28. package/lib/behavior.js +13 -10
  29. package/lib/behaviors/ActivateState.d.ts +22 -24
  30. package/lib/behaviors/ActivateState.js +145 -35
  31. package/lib/behaviors/CallFunction.d.ts +2 -4
  32. package/lib/behaviors/CallFunction.js +69 -11
  33. package/lib/behaviors/ChangeRootScene.d.ts +35 -0
  34. package/lib/behaviors/ChangeRootScene.js +123 -0
  35. package/lib/behaviors/ConsoleLog.d.ts +6 -5
  36. package/lib/behaviors/ConsoleLog.js +95 -12
  37. package/lib/behaviors/DownloadSnapshot.d.ts +7 -12
  38. package/lib/behaviors/DownloadSnapshot.js +70 -19
  39. package/lib/behaviors/EmitComponentPropEvent.d.ts +1 -3
  40. package/lib/behaviors/EmitComponentPropEvent.js +80 -12
  41. package/lib/behaviors/LaunchURL.d.ts +5 -5
  42. package/lib/behaviors/LaunchURL.js +92 -10
  43. package/lib/behaviors/LogAnalyticsEvent.d.ts +10 -4
  44. package/lib/behaviors/LogAnalyticsEvent.js +88 -7
  45. package/lib/behaviors/PauseLayerClip.d.ts +7 -9
  46. package/lib/behaviors/PauseLayerClip.js +89 -21
  47. package/lib/behaviors/PlayLayerClip.d.ts +35 -32
  48. package/lib/behaviors/PlayLayerClip.js +202 -48
  49. package/lib/behaviors/PlaySound.d.ts +19 -25
  50. package/lib/behaviors/PlaySound.js +122 -28
  51. package/lib/behaviors/SetLayerOff.d.ts +7 -9
  52. package/lib/behaviors/SetLayerOff.js +88 -21
  53. package/lib/behaviors/ShareSnapshot.d.ts +5 -9
  54. package/lib/behaviors/ShareSnapshot.js +70 -17
  55. package/lib/behaviors/ShowTextAlert.d.ts +16 -29
  56. package/lib/behaviors/ShowTextAlert.js +116 -48
  57. package/lib/behaviors/TakeSnapshot.d.ts +22 -26
  58. package/lib/behaviors/TakeSnapshot.js +131 -56
  59. package/lib/behaviors/ToggleLayerClips.d.ts +45 -62
  60. package/lib/behaviors/ToggleLayerClips.js +233 -64
  61. package/lib/behaviors/stream/PauseStream.d.ts +5 -16
  62. package/lib/behaviors/stream/PauseStream.js +94 -34
  63. package/lib/behaviors/stream/PlayStream.d.ts +14 -27
  64. package/lib/behaviors/stream/PlayStream.js +123 -34
  65. package/lib/behaviors/stream/SeekStream.d.ts +8 -18
  66. package/lib/behaviors/stream/SeekStream.js +97 -31
  67. package/lib/behaviors/stream/StopStream.d.ts +6 -15
  68. package/lib/behaviors/stream/StopStream.js +89 -27
  69. package/lib/component.d.ts +36 -13
  70. package/lib/component.js +237 -151
  71. package/lib/components/AnimatedLoader.d.ts +51 -0
  72. package/lib/components/AnimatedLoader.js +159 -0
  73. package/lib/components/Audio.d.ts +35 -37
  74. package/lib/components/Audio.js +264 -151
  75. package/lib/components/AudioLayerSettings.d.ts +13 -11
  76. package/lib/components/AudioLayerSettings.js +76 -18
  77. package/lib/components/Children.d.ts +2 -1
  78. package/lib/components/Children.js +66 -13
  79. package/lib/components/ConditionalConstruct.d.ts +44 -0
  80. package/lib/components/ConditionalConstruct.js +142 -0
  81. package/lib/components/DefaultCookieConsent.d.ts +53 -73
  82. package/lib/components/DefaultCookieConsent.js +382 -264
  83. package/lib/components/DefaultLoader.d.ts +40 -28
  84. package/lib/components/DefaultLoader.js +198 -46
  85. package/lib/components/Gamepad.d.ts +5 -26
  86. package/lib/components/Gamepad.js +201 -65
  87. package/lib/components/LoaderScope.d.ts +15 -0
  88. package/lib/components/LoaderScope.js +71 -0
  89. package/lib/components/LongLoad.d.ts +11 -15
  90. package/lib/components/LongLoad.js +89 -34
  91. package/lib/components/SnapshotUI.d.ts +19 -24
  92. package/lib/components/SnapshotUI.js +202 -105
  93. package/lib/context.d.ts +23 -5
  94. package/lib/context.js +12 -6
  95. package/lib/contexts/analyticscontext.d.ts +12 -2
  96. package/lib/contexts/analyticscontext.js +68 -10
  97. package/lib/contexts/audiocontextcontext.d.ts +1 -1
  98. package/lib/contexts/audiocontextcontext.js +9 -8
  99. package/lib/contexts/canvascontext.d.ts +32 -18
  100. package/lib/contexts/canvascontext.js +195 -120
  101. package/lib/contexts/cookieconsentcontext.d.ts +38 -28
  102. package/lib/contexts/cookieconsentcontext.js +35 -32
  103. package/lib/contexts/documentflagmanager.js +15 -11
  104. package/lib/contexts/environmentcontext.d.ts +22 -6
  105. package/lib/contexts/environmentcontext.js +135 -21
  106. package/lib/contexts/gamepadcontext.d.ts +29 -26
  107. package/lib/contexts/gamepadcontext.js +46 -46
  108. package/lib/contexts/gesturecontext.d.ts +31 -6
  109. package/lib/contexts/gesturecontext.js +110 -85
  110. package/lib/contexts/globaltagcontext.d.ts +1 -1
  111. package/lib/contexts/globaltagcontext.js +8 -11
  112. package/lib/contexts/loadcontext.d.ts +45 -8
  113. package/lib/contexts/loadcontext.js +232 -82
  114. package/lib/contexts/orientationcontext.d.ts +13 -15
  115. package/lib/contexts/orientationcontext.js +150 -67
  116. package/lib/contexts/rootcomponentscontext.d.ts +16 -0
  117. package/lib/contexts/rootcomponentscontext.js +65 -0
  118. package/lib/contexts/snapshotContext.d.ts +0 -3
  119. package/lib/contexts/snapshotContext.js +78 -23
  120. package/lib/contexts/tagcontext.d.ts +5 -5
  121. package/lib/contexts/tagcontext.js +16 -16
  122. package/lib/contexts/textalertcontext.d.ts +1 -5
  123. package/lib/contexts/textalertcontext.js +1 -5
  124. package/lib/contexts/usereventcontext.d.ts +1 -1
  125. package/lib/contexts/usereventcontext.js +12 -12
  126. package/lib/data/animation.d.ts +10 -2
  127. package/lib/data/change.d.ts +1 -1
  128. package/lib/data/change.js +7 -0
  129. package/lib/data/core.d.ts +9 -1
  130. package/lib/data/index.d.ts +1 -1
  131. package/lib/data/index.js +1 -1
  132. package/lib/decorators.d.ts +348 -0
  133. package/lib/decorators.js +239 -0
  134. package/lib/decoratorutils.d.ts +3 -0
  135. package/lib/decoratorutils.js +8 -0
  136. package/lib/emitter.d.ts +15 -2
  137. package/lib/emitter.js +15 -6
  138. package/lib/entity.d.ts +43 -25
  139. package/lib/entity.js +104 -71
  140. package/lib/event.d.ts +2 -1
  141. package/lib/event.js +1 -4
  142. package/lib/groups.d.ts +18 -0
  143. package/lib/groups.js +19 -0
  144. package/lib/icons.d.ts +3372 -0
  145. package/lib/icons.js +1 -0
  146. package/lib/index.d.ts +18 -13
  147. package/lib/index.js +17 -13
  148. package/lib/inflate.d.ts +7 -7
  149. package/lib/inflate.js +5 -5
  150. package/lib/observable.d.ts +9 -2
  151. package/lib/observable.js +5 -4
  152. package/lib/observe.d.ts +18 -0
  153. package/lib/observe.js +177 -0
  154. package/lib/profile.d.ts +9 -5
  155. package/lib/profile.js +27 -17
  156. package/lib/selectors.d.ts +1 -1
  157. package/lib/selectors.js +5 -4
  158. package/lib/types.d.ts +161 -19
  159. package/lib/types.js +22 -1
  160. package/lib/values/values.d.ts +7 -8
  161. package/lib/values/values.js +1 -2
  162. package/lib/values/valuesmutator.d.ts +4 -1
  163. package/lib/values/valuesmutator.js +10 -8
  164. package/lib/zcomponent.d.ts +21 -10
  165. package/lib/zcomponent.js +717 -540
  166. package/package.json +22 -5
  167. package/lib/behaviors/ChangeCursor.d.ts +0 -39
  168. package/lib/behaviors/ChangeCursor.js +0 -44
@@ -1,80 +1,148 @@
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 { registerBehaviorRunAtDesignTime } from '../behavior';
3
36
  import { showTextAlert } from '../contexts/textalertcontext';
4
- import { Observable } from '../observable';
37
+ import { zBehavior, zUI } from '../decorators';
38
+ import { BehaviorGroups, PropGroups } from '../groups';
5
39
  /**
6
40
  * Displays a pop-up text alert on screen.
7
- *
8
41
  * @zbehavior
9
42
  * @zicon sms
10
43
  * @zgroup Actions
11
44
  */
12
- export class ShowTextAlert extends ActionBehavior {
13
- constructor() {
14
- super(...arguments);
45
+ let ShowTextAlert = (() => {
46
+ let _classDecorators = [zBehavior({ icon: 'sms', group: BehaviorGroups.Actions, runAtDesignTime: true })];
47
+ let _classDescriptor;
48
+ let _classExtraInitializers = [];
49
+ let _classThis;
50
+ let _classSuper = ActionBehavior;
51
+ let _instanceExtraInitializers = [];
52
+ let _text_decorators;
53
+ let _text_initializers = [];
54
+ let _text_extraInitializers = [];
55
+ let _timeout_decorators;
56
+ let _timeout_initializers = [];
57
+ let _timeout_extraInitializers = [];
58
+ let _backgroundColor_decorators;
59
+ let _backgroundColor_initializers = [];
60
+ let _backgroundColor_extraInitializers = [];
61
+ let _textColor_decorators;
62
+ let _textColor_initializers = [];
63
+ let _textColor_extraInitializers = [];
64
+ let _classNames_decorators;
65
+ let _classNames_initializers = [];
66
+ let _classNames_extraInitializers = [];
67
+ let _preview_decorators;
68
+ var ShowTextAlert = 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
+ _text_decorators = [zUI()];
73
+ _timeout_decorators = [zUI({ type: 'time-milliseconds' })];
74
+ _backgroundColor_decorators = [zUI({ group: PropGroups.Appearance, type: 'color-hex' })];
75
+ _textColor_decorators = [zUI({ group: PropGroups.Appearance, type: 'color-hex' })];
76
+ _classNames_decorators = [zUI({ group: PropGroups.Appearance })];
77
+ _preview_decorators = [zUI()];
78
+ __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);
79
+ __esDecorate(null, null, _text_decorators, { kind: "field", name: "text", static: false, private: false, access: { has: obj => "text" in obj, get: obj => obj.text, set: (obj, value) => { obj.text = value; } }, metadata: _metadata }, _text_initializers, _text_extraInitializers);
80
+ __esDecorate(null, null, _timeout_decorators, { kind: "field", name: "timeout", static: false, private: false, access: { has: obj => "timeout" in obj, get: obj => obj.timeout, set: (obj, value) => { obj.timeout = value; } }, metadata: _metadata }, _timeout_initializers, _timeout_extraInitializers);
81
+ __esDecorate(null, null, _backgroundColor_decorators, { kind: "field", name: "backgroundColor", static: false, private: false, access: { has: obj => "backgroundColor" in obj, get: obj => obj.backgroundColor, set: (obj, value) => { obj.backgroundColor = value; } }, metadata: _metadata }, _backgroundColor_initializers, _backgroundColor_extraInitializers);
82
+ __esDecorate(null, null, _textColor_decorators, { kind: "field", name: "textColor", static: false, private: false, access: { has: obj => "textColor" in obj, get: obj => obj.textColor, set: (obj, value) => { obj.textColor = value; } }, metadata: _metadata }, _textColor_initializers, _textColor_extraInitializers);
83
+ __esDecorate(null, null, _classNames_decorators, { kind: "field", name: "classNames", static: false, private: false, access: { has: obj => "classNames" in obj, get: obj => obj.classNames, set: (obj, value) => { obj.classNames = value; } }, metadata: _metadata }, _classNames_initializers, _classNames_extraInitializers);
84
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
85
+ ShowTextAlert = _classThis = _classDescriptor.value;
86
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
87
+ __runInitializers(_classThis, _classExtraInitializers);
88
+ }
15
89
  /**
16
90
  * The text to show in the alert
17
- * @zprop
18
- * @zgroup ShowTextAlert
19
- * @zgrouppriority 20
91
+ * @default ""
20
92
  */
21
- this.text = new Observable('');
93
+ text = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _text_initializers, ''));
22
94
  /**
23
95
  * The time (in milliseconds) that the text alert should remain on screen
24
- *
25
- * @zprop
26
- * @zgroup Appearance
27
- * @zgrouppriority 10
28
- * @zdefault 3000
96
+ * @default 3000
97
+ * @zui
29
98
  * @ztype time-milliseconds
30
99
  */
31
- this.timeout = new Observable(3000);
100
+ timeout = (__runInitializers(this, _text_extraInitializers), __runInitializers(this, _timeout_initializers, 3000));
32
101
  /**
33
102
  * The color of the background of the text alert
34
- *
35
- * @zprop
103
+ * @default "#000000"
104
+ * @zui
36
105
  * @zgroup Appearance
37
106
  * @zgrouppriority 10
38
- * @zdefault black
39
107
  * @ztype color-hex
40
108
  */
41
- this.backgroundColor = new Observable('#000000');
109
+ backgroundColor = (__runInitializers(this, _timeout_extraInitializers), __runInitializers(this, _backgroundColor_initializers, '#000000'));
42
110
  /**
43
111
  * The color of the text of the text alert
44
- *
45
- * @zprop
112
+ * @default "#ffffff"
113
+ * @zui
46
114
  * @zgroup Appearance
47
115
  * @zgrouppriority 10
48
- * @zdefault #ffffff
49
116
  * @ztype color-hex
50
117
  */
51
- this.textColor = new Observable('#ffffff');
118
+ textColor = (__runInitializers(this, _backgroundColor_extraInitializers), __runInitializers(this, _textColor_initializers, '#ffffff'));
52
119
  /**
53
120
  * Additional CSS class names to add to the alert DOM element
54
- *
55
- * @zprop
121
+ * @default []
122
+ * @zui
56
123
  * @zgroup Appearance
57
124
  * @zgrouppriority 10
58
- * @zdefault []
59
125
  */
60
- this.classNames = new Observable([]);
61
- }
62
- /**
63
- * How long the alert will apear on the screen
64
- *
65
- * @zprop
66
- */
67
- perform() {
68
- showTextAlert(this.contextManager, this.text.value, {
69
- backgroundColor: this.backgroundColor.value,
70
- textColor: this.textColor.value,
71
- classNames: this.classNames.value,
72
- timeout: this.timeout.value,
73
- });
74
- }
75
- /** @zui */
76
- preview() {
77
- this.perform();
78
- }
79
- }
80
- registerBehaviorRunAtDesignTime(ShowTextAlert);
126
+ classNames = (__runInitializers(this, _textColor_extraInitializers), __runInitializers(this, _classNames_initializers, []));
127
+ perform() {
128
+ showTextAlert(this.contextManager, this.text, {
129
+ backgroundColor: this.backgroundColor,
130
+ textColor: this.textColor,
131
+ classNames: this.classNames,
132
+ timeout: this.timeout,
133
+ });
134
+ }
135
+ /**
136
+ * @zui
137
+ */
138
+ preview() {
139
+ this.perform();
140
+ }
141
+ constructor() {
142
+ super(...arguments);
143
+ __runInitializers(this, _classNames_extraInitializers);
144
+ }
145
+ };
146
+ return ShowTextAlert = _classThis;
147
+ })();
148
+ export { ShowTextAlert };
@@ -1,54 +1,50 @@
1
1
  import { ActionBehavior, ActionBehaviorConstructorProps } from '../actionbehavior';
2
- import { Component } from '../component';
3
- import { ContextManager } from '../context';
4
- import { Observable } from '../observable';
5
- export declare enum ImageFormat {
6
- PNG = "png",
7
- JPEG = "jpeg"
8
- }
2
+ import { ValueOf } from '../types';
3
+ export declare const ImageFormat: {
4
+ readonly PNG: "png";
5
+ readonly JPEG: "jpeg";
6
+ };
9
7
  /**
10
8
  * Captures the canvas as an image.
11
9
  * This image can then be shared or downloaded using other behaviors.
12
- *
13
10
  * @zbehavior
14
11
  * @zicon photo_camera
15
12
  * @zgroup Actions
16
13
  */
17
14
  export declare class TakeSnapshot extends ActionBehavior<ActionBehaviorConstructorProps> {
18
- constructor(contextManager: ContextManager, instance: Component, props: ActionBehaviorConstructorProps);
15
+ /**
16
+ * @default ""
17
+ */
18
+ private _dataUrl;
19
19
  /**
20
20
  * The format of the image to capture.
21
- * @zprop
22
- * @zdefault jpeg
21
+ * @default "jpeg"
23
22
  */
24
- format: Observable<ImageFormat, never>;
23
+ format: ValueOf<typeof ImageFormat>;
25
24
  /**
26
25
  * The quality of the image to capture.
27
- * @zprop
28
- * @zdefault 0.92
26
+ * @default 0.92
29
27
  */
30
- quality: Observable<number, never>;
28
+ quality: number;
31
29
  /**
32
30
  * The name of the file to download.
33
- * @zprop
34
- * @zdefault canvas
31
+ * @default "canvas"
35
32
  */
36
- fileName: Observable<string, never>;
33
+ fileName: string;
37
34
  /**
38
35
  * The text to share.
39
- * @zprop
40
- * @zdefault ''
36
+ * @default ""
41
37
  */
42
- text: Observable<string, never>;
38
+ text: string;
43
39
  /**
44
40
  * The title to share.
45
- * @zprop
46
- * @zdefault ''
41
+ * @default ""
47
42
  */
48
- title: Observable<string, never>;
49
- private dataUrl;
50
- /** @zprop */
43
+ title: string;
51
44
  perform(): void;
52
45
  private capture;
46
+ /**
47
+ * @zui
48
+ */
53
49
  preview(): void;
54
50
  }
@@ -1,84 +1,159 @@
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 { registerBehaviorRunAtDesignTime } from '../behavior';
3
36
  import { CanvasContext } from '../contexts/canvascontext';
4
37
  import { SnapshotContext } from '../contexts/snapshotContext';
5
- import { Observable } from '../observable';
6
- export var ImageFormat;
7
- (function (ImageFormat) {
8
- ImageFormat["PNG"] = "png";
9
- ImageFormat["JPEG"] = "jpeg";
10
- })(ImageFormat || (ImageFormat = {}));
38
+ import { zBehavior, zObserve, zUI } from '../decorators';
39
+ import { BehaviorGroups } from '../groups';
40
+ export const ImageFormat = {
41
+ PNG: 'png',
42
+ JPEG: 'jpeg',
43
+ };
44
+ Object.freeze(ImageFormat);
11
45
  /**
12
46
  * Captures the canvas as an image.
13
47
  * This image can then be shared or downloaded using other behaviors.
14
- *
15
48
  * @zbehavior
16
49
  * @zicon photo_camera
17
50
  * @zgroup Actions
18
51
  */
19
- export class TakeSnapshot extends ActionBehavior {
20
- constructor(contextManager, instance, props) {
21
- super(contextManager, instance, props);
52
+ let TakeSnapshot = (() => {
53
+ let _classDecorators = [zBehavior({ icon: 'photo_camera', group: BehaviorGroups.Actions, runAtDesignTime: true })];
54
+ let _classDescriptor;
55
+ let _classExtraInitializers = [];
56
+ let _classThis;
57
+ let _classSuper = ActionBehavior;
58
+ let _instanceExtraInitializers = [];
59
+ let _format_decorators;
60
+ let _format_initializers = [];
61
+ let _format_extraInitializers = [];
62
+ let _quality_decorators;
63
+ let _quality_initializers = [];
64
+ let _quality_extraInitializers = [];
65
+ let _fileName_decorators;
66
+ let _fileName_initializers = [];
67
+ let _fileName_extraInitializers = [];
68
+ let _text_decorators;
69
+ let _text_initializers = [];
70
+ let _text_extraInitializers = [];
71
+ let _title_decorators;
72
+ let _title_initializers = [];
73
+ let _title_extraInitializers = [];
74
+ let _preview_decorators;
75
+ var TakeSnapshot = class extends _classSuper {
76
+ static { _classThis = this; }
77
+ static {
78
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
79
+ _format_decorators = [zObserve((format, instance) => {
80
+ const ssctx = instance.contextManager.get(SnapshotContext);
81
+ ssctx.fileType.value = format === ImageFormat.PNG ? 'image/png' : 'image/jpeg';
82
+ })];
83
+ _quality_decorators = [zObserve((quality, instance) => {
84
+ const ssctx = instance.contextManager.get(SnapshotContext);
85
+ ssctx.quality.value = quality;
86
+ })];
87
+ _fileName_decorators = [zObserve((fileName, instance) => {
88
+ const ssctx = instance.contextManager.get(SnapshotContext);
89
+ ssctx.fileName.value = fileName;
90
+ })];
91
+ _text_decorators = [zObserve((fileName, instance) => {
92
+ const ssctx = instance.contextManager.get(SnapshotContext);
93
+ ssctx.text.value = fileName;
94
+ })];
95
+ _title_decorators = [zObserve((fileName, instance) => {
96
+ const ssctx = instance.contextManager.get(SnapshotContext);
97
+ ssctx.title.value = fileName;
98
+ })];
99
+ _preview_decorators = [zUI()];
100
+ __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);
101
+ __esDecorate(null, null, _format_decorators, { kind: "field", name: "format", static: false, private: false, access: { has: obj => "format" in obj, get: obj => obj.format, set: (obj, value) => { obj.format = value; } }, metadata: _metadata }, _format_initializers, _format_extraInitializers);
102
+ __esDecorate(null, null, _quality_decorators, { kind: "field", name: "quality", static: false, private: false, access: { has: obj => "quality" in obj, get: obj => obj.quality, set: (obj, value) => { obj.quality = value; } }, metadata: _metadata }, _quality_initializers, _quality_extraInitializers);
103
+ __esDecorate(null, null, _fileName_decorators, { kind: "field", name: "fileName", static: false, private: false, access: { has: obj => "fileName" in obj, get: obj => obj.fileName, set: (obj, value) => { obj.fileName = value; } }, metadata: _metadata }, _fileName_initializers, _fileName_extraInitializers);
104
+ __esDecorate(null, null, _text_decorators, { kind: "field", name: "text", static: false, private: false, access: { has: obj => "text" in obj, get: obj => obj.text, set: (obj, value) => { obj.text = value; } }, metadata: _metadata }, _text_initializers, _text_extraInitializers);
105
+ __esDecorate(null, null, _title_decorators, { kind: "field", name: "title", static: false, private: false, access: { has: obj => "title" in obj, get: obj => obj.title, set: (obj, value) => { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
106
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
107
+ TakeSnapshot = _classThis = _classDescriptor.value;
108
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
109
+ __runInitializers(_classThis, _classExtraInitializers);
110
+ }
111
+ /**
112
+ * @default ""
113
+ */
114
+ _dataUrl = (__runInitializers(this, _instanceExtraInitializers), '');
22
115
  /**
23
116
  * The format of the image to capture.
24
- * @zprop
25
- * @zdefault jpeg
117
+ * @default "jpeg"
26
118
  */
27
- this.format = new Observable(ImageFormat.JPEG, format => {
28
- const ssctx = this.contextManager.get(SnapshotContext);
29
- ssctx.fileType.value = format === ImageFormat.PNG ? 'image/png' : 'image/jpeg';
30
- });
119
+ format = __runInitializers(this, _format_initializers, ImageFormat.JPEG);
31
120
  /**
32
121
  * The quality of the image to capture.
33
- * @zprop
34
- * @zdefault 0.92
122
+ * @default 0.92
35
123
  */
36
- this.quality = new Observable(0.92, quality => {
37
- const ssctx = this.contextManager.get(SnapshotContext);
38
- ssctx.quality.value = quality;
39
- });
124
+ quality = (__runInitializers(this, _format_extraInitializers), __runInitializers(this, _quality_initializers, 0.92));
40
125
  /**
41
126
  * The name of the file to download.
42
- * @zprop
43
- * @zdefault canvas
127
+ * @default "canvas"
44
128
  */
45
- this.fileName = new Observable('canvas', fileName => {
46
- const ssctx = this.contextManager.get(SnapshotContext);
47
- ssctx.fileName.value = fileName;
48
- });
129
+ fileName = (__runInitializers(this, _quality_extraInitializers), __runInitializers(this, _fileName_initializers, 'canvas'));
49
130
  /**
50
131
  * The text to share.
51
- * @zprop
52
- * @zdefault ''
132
+ * @default ""
53
133
  */
54
- this.text = new Observable('', text => {
55
- const ssctx = this.contextManager.get(SnapshotContext);
56
- ssctx.text.value = text;
57
- });
134
+ text = (__runInitializers(this, _fileName_extraInitializers), __runInitializers(this, _text_initializers, ''));
58
135
  /**
59
136
  * The title to share.
60
- * @zprop
61
- * @zdefault ''
137
+ * @default ""
62
138
  */
63
- this.title = new Observable('', title => {
64
- const ssctx = this.contextManager.get(SnapshotContext);
65
- ssctx.title.value = title;
66
- });
67
- this.dataUrl = '';
68
- this.capture = async () => {
139
+ title = (__runInitializers(this, _text_extraInitializers), __runInitializers(this, _title_initializers, ''));
140
+ perform() {
141
+ this.capture();
142
+ }
143
+ capture = (__runInitializers(this, _title_extraInitializers), async () => {
69
144
  const snapshotContext = this.contextManager.get(SnapshotContext);
70
145
  const mimeType = snapshotContext.fileType.value === ImageFormat.PNG ? 'image/png' : 'image/jpeg';
71
146
  const canvasContext = this.contextManager.get(CanvasContext);
72
- this.dataUrl = await canvasContext.captureToDataURL(mimeType, this.quality.value);
73
- snapshotContext.canvasImage.value = this.dataUrl;
74
- };
75
- }
76
- /** @zprop */
77
- perform() {
78
- this.capture();
79
- }
80
- preview() {
81
- this.perform();
82
- }
83
- }
84
- registerBehaviorRunAtDesignTime(TakeSnapshot);
147
+ this._dataUrl = await canvasContext.captureToDataURL(mimeType, this.quality);
148
+ snapshotContext.canvasImage.value = this._dataUrl;
149
+ });
150
+ /**
151
+ * @zui
152
+ */
153
+ preview() {
154
+ this.perform();
155
+ }
156
+ };
157
+ return TakeSnapshot = _classThis;
158
+ })();
159
+ export { TakeSnapshot };
@@ -1,6 +1,6 @@
1
- import { ActionBehavior, ActionBehaviorConstructorProps } from '../actionbehavior';
2
- import { Component } from '../component';
3
- import { ContextManager } from '../context';
1
+ import { ActionBehavior } from '../actionbehavior';
2
+ import { Easing } from '../data';
3
+ import { ValueOf } from '../types';
4
4
  /**
5
5
  * Toggles between two layer clips.
6
6
  * @zbehavior
@@ -8,96 +8,79 @@ import { ContextManager } from '../context';
8
8
  * @zgroup Animation Actions
9
9
  */
10
10
  export declare class ToggleLayerClips extends ActionBehavior {
11
- private zcomponent;
11
+ private readonly zcomponent;
12
12
  /**
13
- * @zprop
14
- * @zgroup Play Settings
15
- * @zgrouppriority 20
13
+ * @default true
14
+ */
15
+ isA: boolean;
16
+ /**
17
+ * @zui
16
18
  * @zvalues layerclipids
17
19
  */
18
- layerClipA: string | undefined;
20
+ layerClipA?: string;
19
21
  /**
20
- * @zprop
21
- * @zgroup Play Settings
22
- * @zgrouppriority 20
22
+ * @zui
23
23
  * @zvalues layerids
24
24
  */
25
- layerOffA: string | undefined;
25
+ layerOffA?: string;
26
26
  /**
27
- * @zprop
28
- * @zgroup Play Settings
29
- * @zgrouppriority 20
27
+ * @zui
30
28
  * @zvalues layerclipids
31
29
  */
32
- layerClipB: string | undefined;
30
+ layerClipB?: string;
33
31
  /**
34
- * @zprop
35
- * @zgroup Play Settings
36
- * @zgrouppriority 20
32
+ * @zui
37
33
  * @zvalues layerids
38
34
  */
39
- layerOffB: string | undefined;
35
+ layerOffB?: string;
40
36
  /**
41
- * @zprop
42
- * @zgroup Play Settings
43
- * @zgrouppriority 20
44
- * @zdefault false
37
+ * @default false
38
+ * @zui
45
39
  */
46
- loop?: boolean;
40
+ loop: boolean;
47
41
  /**
48
- * @zprop
49
- * @zgroup Play Settings
50
- * @zgrouppriority 20
51
- * @zdefault 1
42
+ * @default 1
43
+ * @zui
52
44
  */
53
- speed?: number;
45
+ speed: number;
54
46
  /**
55
- * @zprop
56
- * @zgroup Play Settings
57
- * @zgrouppriority 20
58
- * @zdefault false
47
+ * @default false
48
+ * @zui
59
49
  */
60
50
  queue: boolean;
61
51
  /**
62
- * Seek the clip to the start before playing
63
- *
64
- * @zprop
65
- * @zgroup Play Settings
66
- * @zgrouppriority 20
67
- * @zdefault false
52
+ * Seek the clip to the start before playing.
53
+ * @default false
54
+ * @zui
68
55
  */
69
56
  fromStart: boolean;
70
57
  /**
71
- * @zprop
72
- * @zgroup Override Fade
73
- * @zgrouppriority 10
58
+ * @zui
74
59
  * @ztype time-milliseconds
75
60
  */
76
61
  fadeTime?: number;
77
62
  /**
78
- * @zprop
79
- * @zgroup Override Fade
80
- * @zgrouppriority 10
81
- * @zdefault 0
63
+ * @zui
82
64
  */
83
- pin?: Pin | number;
65
+ pin?: PinValue | number;
84
66
  /**
85
- * @zprop
86
- * @zgroup Override Fade
87
- * @zgrouppriority 10
88
- * @zdefault 0
67
+ * @default "linear"
68
+ * @zui
89
69
  * @zvalues easings
90
70
  */
91
- easing?: string;
92
- isA: boolean;
93
- constructor(contextManager: ContextManager, instance: Component, props: ActionBehaviorConstructorProps);
94
- /** @zprop */
71
+ easing: Easing;
72
+ /**
73
+ * @zui
74
+ */
95
75
  perform(): void;
96
- /** @zui */
76
+ /**
77
+ * @zui
78
+ */
97
79
  preview(): void;
98
80
  }
99
- export declare enum Pin {
100
- Start = 0,
101
- Middle = 0.5,
102
- End = 1
103
- }
81
+ export declare const Pin: {
82
+ readonly Start: 0;
83
+ readonly Middle: 0.5;
84
+ readonly End: 1;
85
+ };
86
+ export type PinValue = ValueOf<typeof Pin>;