@zcomponent/core 2.0.0-alpha.2 → 2.0.0-alpha.4

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 (63) hide show
  1. package/lib/animation/layer.js +5 -0
  2. package/lib/animation/tracks/streamtrack.js +12 -1
  3. package/lib/behavior.d.ts +7 -1
  4. package/lib/behavior.js +6 -1
  5. package/lib/behaviors/ConsoleLog.d.ts +2 -0
  6. package/lib/behaviors/ConsoleLog.js +2 -0
  7. package/lib/behaviors/LaunchURL.d.ts +2 -0
  8. package/lib/behaviors/LaunchURL.js +2 -0
  9. package/lib/behaviors/LogAnalyticsEvent.d.ts +2 -0
  10. package/lib/behaviors/LogAnalyticsEvent.js +2 -0
  11. package/lib/behaviors/PlaySound.d.ts +3 -0
  12. package/lib/behaviors/PlaySound.js +7 -1
  13. package/lib/behaviors/ShowTextAlert.d.ts +1 -0
  14. package/lib/behaviors/ShowTextAlert.js +1 -0
  15. package/lib/behaviors/ToggleLayerClips.d.ts +1 -0
  16. package/lib/behaviors/ToggleLayerClips.js +9 -3
  17. package/lib/component.d.ts +7 -0
  18. package/lib/component.js +6 -0
  19. package/lib/components/AnimatedLoader.d.ts +6 -0
  20. package/lib/components/AnimatedLoader.js +6 -0
  21. package/lib/components/Audio.d.ts +28 -2
  22. package/lib/components/Audio.js +55 -8
  23. package/lib/components/DefaultCookieConsent.d.ts +11 -0
  24. package/lib/components/DefaultCookieConsent.js +33 -9
  25. package/lib/components/DefaultLoader.d.ts +3 -0
  26. package/lib/components/DefaultLoader.js +15 -8
  27. package/lib/components/Gamepad.d.ts +61 -0
  28. package/lib/components/Gamepad.js +61 -0
  29. package/lib/components/LongLoad.d.ts +3 -0
  30. package/lib/components/LongLoad.js +3 -0
  31. package/lib/components/SnapshotUI.d.ts +14 -0
  32. package/lib/components/SnapshotUI.js +27 -9
  33. package/lib/context.d.ts +11 -1
  34. package/lib/context.js +9 -1
  35. package/lib/contexts/analyticscontext.d.ts +3 -0
  36. package/lib/contexts/analyticscontext.js +14 -2
  37. package/lib/contexts/audiocontextcontext.d.ts +12 -0
  38. package/lib/contexts/audiocontextcontext.js +131 -56
  39. package/lib/contexts/canvascontext.d.ts +25 -0
  40. package/lib/contexts/canvascontext.js +75 -15
  41. package/lib/contexts/cookieconsentcontext.d.ts +19 -0
  42. package/lib/contexts/cookieconsentcontext.js +135 -27
  43. package/lib/contexts/environmentcontext.d.ts +13 -5
  44. package/lib/contexts/environmentcontext.js +26 -14
  45. package/lib/contexts/gamepadcontext.d.ts +17 -0
  46. package/lib/contexts/gamepadcontext.js +160 -74
  47. package/lib/contexts/gesturecontext.d.ts +11 -0
  48. package/lib/contexts/gesturecontext.js +266 -169
  49. package/lib/contexts/globaltagcontext.d.ts +2 -0
  50. package/lib/contexts/globaltagcontext.js +69 -10
  51. package/lib/contexts/loadcontext.d.ts +19 -0
  52. package/lib/contexts/loadcontext.js +68 -18
  53. package/lib/contexts/orientationcontext.d.ts +13 -0
  54. package/lib/contexts/orientationcontext.js +60 -11
  55. package/lib/contexts/snapshotContext.d.ts +10 -0
  56. package/lib/contexts/snapshotContext.js +55 -9
  57. package/lib/contexts/tagcontext.d.ts +14 -0
  58. package/lib/contexts/tagcontext.js +186 -98
  59. package/lib/entity.d.ts +5 -1
  60. package/lib/entity.js +4 -1
  61. package/lib/zcomponent.d.ts +20 -0
  62. package/lib/zcomponent.js +81 -12
  63. package/package.json +84 -84
@@ -191,6 +191,11 @@ export class Layer {
191
191
  break;
192
192
  }
193
193
  }
194
+ // If this clip is already in the queue (still fading out from a previous
195
+ // switch), remove that old entry before re-adding it, so the same LayerClip
196
+ // is never queued twice. Otherwise, when tick() later cleans up the old
197
+ // entry, it pauses the clip - which is now also the active one - freezing it.
198
+ this._queue = this._queue.filter(entry => entry === this._active || entry.layerClip !== layerClip);
194
199
  const entry = this.queue(layerClip, {
195
200
  ...playOptions,
196
201
  fade: playOptions?.fade !== undefined ? playOptions.fade : this._active === undefined || layerClip === undefined ? { time: 0, easing: null } : undefined,
@@ -187,7 +187,18 @@ export class StreamTrack extends Track {
187
187
  }
188
188
  else {
189
189
  const [bt, loopNumber] = resolveClipTimeLoops(t, block.t0, block.s0, block.rate, this.stream?.length?.() ?? Infinity, rate * block.rate < 0, block.t1);
190
- if ((t === block.t1 && rate >= +0) || (t === block.t0 && rate < 0)) {
190
+ if (block.t1 !== undefined && block.t1 === block.t0) {
191
+ // Zero-length (state) block: seek to its start offset and hold. Without
192
+ // this the boundary check below pauses before seeking, so the state
193
+ // never applies (e.g. a "reset" streamed from a sub-component).
194
+ if (this._lastLoopNumber !== loopNumber || lastBlock !== block) {
195
+ this._lastLoopNumber = loopNumber;
196
+ force = true;
197
+ this.stream?.seek(block.s0);
198
+ }
199
+ desiredState = StreamState.Paused;
200
+ }
201
+ else if ((t === block.t1 && rate >= +0) || (t === block.t0 && rate < 0)) {
191
202
  desiredState = StreamState.Paused;
192
203
  force = true;
193
204
  }
package/lib/behavior.d.ts CHANGED
@@ -33,6 +33,7 @@ export type ConstructorForBehavior<BehaviorType extends Behavior = Behavior> = n
33
33
  * @link [custom-behaviors](https://docs.zap.works/mattercraft/scripting/custom-behaviors/)
34
34
  */
35
35
  export declare class Behavior<InstanceType extends Component = Component> extends Entity {
36
+ /** @zignore */
36
37
  readonly instance: InstanceType;
37
38
  /**
38
39
  * Constructs this behavior
@@ -40,8 +41,13 @@ export declare class Behavior<InstanceType extends Component = Component> extend
40
41
  * @param contextManager The current ContextManager
41
42
  * @param instance The instance of the component that this behavior is attached to
42
43
  */
43
- constructor(contextManager: ContextManager, instance: InstanceType);
44
+ constructor(contextManager: ContextManager,
45
+ /** @zignore */
46
+ instance: InstanceType);
44
47
  private _updateEnabledResolved;
48
+ /**
49
+ * @zignore
50
+ */
45
51
  dispose(): never;
46
52
  }
47
53
  /**
package/lib/behavior.js CHANGED
@@ -17,7 +17,9 @@ export class Behavior extends Entity {
17
17
  * @param contextManager The current ContextManager
18
18
  * @param instance The instance of the component that this behavior is attached to
19
19
  */
20
- constructor(contextManager, instance) {
20
+ constructor(contextManager,
21
+ /** @zignore */
22
+ instance) {
21
23
  super(contextManager);
22
24
  this.instance = instance;
23
25
  instance.addBehavior(this);
@@ -33,6 +35,9 @@ export class Behavior extends Entity {
33
35
  notify(this, 'enabledResolved');
34
36
  }
35
37
  };
38
+ /**
39
+ * @zignore
40
+ */
36
41
  dispose() {
37
42
  this.instance.removeBehavior(this);
38
43
  return super.dispose();
@@ -9,11 +9,13 @@ export declare class ConsoleLog extends ActionBehavior {
9
9
  /**
10
10
  * The text to log
11
11
  * @default ""
12
+ * @zui
12
13
  */
13
14
  text: string;
14
15
  /**
15
16
  * If true, the event name will be logged in addition to the text
16
17
  * @default true
18
+ * @zui
17
19
  */
18
20
  includeEventName: boolean;
19
21
  perform(): void;
@@ -73,11 +73,13 @@ let ConsoleLog = (() => {
73
73
  /**
74
74
  * The text to log
75
75
  * @default ""
76
+ * @zui
76
77
  */
77
78
  text = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _text_initializers, ''));
78
79
  /**
79
80
  * If true, the event name will be logged in addition to the text
80
81
  * @default true
82
+ * @zui
81
83
  */
82
84
  includeEventName = (__runInitializers(this, _text_extraInitializers), __runInitializers(this, _includeEventName_initializers, true));
83
85
  perform() {
@@ -11,11 +11,13 @@ export declare class LaunchURL extends ActionBehavior {
11
11
  /**
12
12
  * The URL to open
13
13
  * @default "https://www.example.com/"
14
+ * @zui
14
15
  */
15
16
  url: string;
16
17
  /**
17
18
  * If true, the URL will be opened in a new tab (using target '_blank')
18
19
  * @default true
20
+ * @zui
19
21
  */
20
22
  openInNew: boolean;
21
23
  /**
@@ -75,11 +75,13 @@ let LaunchURL = (() => {
75
75
  /**
76
76
  * The URL to open
77
77
  * @default "https://www.example.com/"
78
+ * @zui
78
79
  */
79
80
  url = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _url_initializers, 'https://www.example.com/'));
80
81
  /**
81
82
  * If true, the URL will be opened in a new tab (using target '_blank')
82
83
  * @default true
84
+ * @zui
83
85
  */
84
86
  openInNew = (__runInitializers(this, _url_extraInitializers), __runInitializers(this, _openInNew_initializers, true));
85
87
  /**
@@ -11,10 +11,12 @@ export declare class LogAnalyticsEvent extends ActionBehavior {
11
11
  /**
12
12
  * The name of the event to log
13
13
  * @default ""
14
+ * @zui
14
15
  */
15
16
  name: string;
16
17
  /**
17
18
  * The parameters to log with the event
19
+ * @zui
18
20
  */
19
21
  params: any;
20
22
  /**
@@ -76,10 +76,12 @@ let LogAnalyticsEvent = (() => {
76
76
  /**
77
77
  * The name of the event to log
78
78
  * @default ""
79
+ * @zui
79
80
  */
80
81
  name = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _name_initializers, ''));
81
82
  /**
82
83
  * The parameters to log with the event
84
+ * @zui
83
85
  */
84
86
  params = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _params_initializers, void 0));
85
87
  /**
@@ -42,5 +42,8 @@ export declare class PlaySound extends ActionBehavior<PlaySoundProps> {
42
42
  * @zui
43
43
  */
44
44
  preview(): void;
45
+ /**
46
+ * @zignore
47
+ */
45
48
  dispose(): never;
46
49
  }
@@ -34,7 +34,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
34
34
  };
35
35
  import { ActionBehavior } from '../actionbehavior';
36
36
  import { Audio } from '../components/Audio';
37
- import { zBehavior, zObserve, zUI } from '../decorators';
37
+ import { zBehavior, zIgnore, zObserve, zUI } from '../decorators';
38
38
  import { BehaviorGroups } from '../groups';
39
39
  const audioGroup = {
40
40
  name: 'Audio',
@@ -63,6 +63,7 @@ let PlaySound = (() => {
63
63
  let _speed_initializers = [];
64
64
  let _speed_extraInitializers = [];
65
65
  let _preview_decorators;
66
+ let _dispose_decorators;
66
67
  var PlaySound = class extends _classSuper {
67
68
  static { _classThis = this; }
68
69
  static {
@@ -75,7 +76,9 @@ let PlaySound = (() => {
75
76
  })];
76
77
  _speed_decorators = [zUI({ group: audioGroup })];
77
78
  _preview_decorators = [zUI()];
79
+ _dispose_decorators = [zIgnore()];
78
80
  __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);
81
+ __esDecorate(this, null, _dispose_decorators, { kind: "method", name: "dispose", static: false, private: false, access: { has: obj => "dispose" in obj, get: obj => obj.dispose }, metadata: _metadata }, null, _instanceExtraInitializers);
79
82
  __esDecorate(null, null, _muted_decorators, { kind: "field", name: "muted", static: false, private: false, access: { has: obj => "muted" in obj, get: obj => obj.muted, set: (obj, value) => { obj.muted = value; } }, metadata: _metadata }, _muted_initializers, _muted_extraInitializers);
80
83
  __esDecorate(null, null, _volume_decorators, { kind: "field", name: "volume", static: false, private: false, access: { has: obj => "volume" in obj, get: obj => obj.volume, set: (obj, value) => { obj.volume = value; } }, metadata: _metadata }, _volume_initializers, _volume_extraInitializers);
81
84
  __esDecorate(null, null, _speed_decorators, { kind: "field", name: "speed", static: false, private: false, access: { has: obj => "speed" in obj, get: obj => obj.speed, set: (obj, value) => { obj.speed = value; } }, metadata: _metadata }, _speed_initializers, _speed_extraInitializers);
@@ -124,6 +127,9 @@ let PlaySound = (() => {
124
127
  preview() {
125
128
  this.perform();
126
129
  }
130
+ /**
131
+ * @zignore
132
+ */
127
133
  dispose() {
128
134
  this._component.dispose();
129
135
  return super.dispose();
@@ -9,6 +9,7 @@ export declare class ShowTextAlert extends ActionBehavior {
9
9
  /**
10
10
  * The text to show in the alert
11
11
  * @default ""
12
+ * @zui
12
13
  */
13
14
  text: string;
14
15
  /**
@@ -89,6 +89,7 @@ let ShowTextAlert = (() => {
89
89
  /**
90
90
  * The text to show in the alert
91
91
  * @default ""
92
+ * @zui
92
93
  */
93
94
  text = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _text_initializers, ''));
94
95
  /**
@@ -11,6 +11,7 @@ export declare class ToggleLayerClips extends ActionBehavior {
11
11
  private readonly zcomponent;
12
12
  /**
13
13
  * @default true
14
+ * @zignore
14
15
  */
15
16
  isA: boolean;
16
17
  /**
@@ -33,7 +33,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
33
33
  done = true;
34
34
  };
35
35
  import { ActionBehavior } from '../actionbehavior';
36
- import { zBehavior, zUI } from '../decorators';
36
+ import { zBehavior, zIgnore, zUI } from '../decorators';
37
37
  import { BehaviorGroups } from '../groups';
38
38
  const playSettingsGroup = {
39
39
  name: 'Play Settings',
@@ -56,6 +56,9 @@ let ToggleLayerClips = (() => {
56
56
  let _classThis;
57
57
  let _classSuper = ActionBehavior;
58
58
  let _instanceExtraInitializers = [];
59
+ let _isA_decorators;
60
+ let _isA_initializers = [];
61
+ let _isA_extraInitializers = [];
59
62
  let _layerClipA_decorators;
60
63
  let _layerClipA_initializers = [];
61
64
  let _layerClipA_extraInitializers = [];
@@ -95,6 +98,7 @@ let ToggleLayerClips = (() => {
95
98
  static { _classThis = this; }
96
99
  static {
97
100
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
101
+ _isA_decorators = [zIgnore()];
98
102
  _layerClipA_decorators = [zUI({ values: 'layerclipids' })];
99
103
  _layerOffA_decorators = [zUI({ values: 'layerids' })];
100
104
  _layerClipB_decorators = [zUI({ values: 'layerclipids' })];
@@ -110,6 +114,7 @@ let ToggleLayerClips = (() => {
110
114
  _preview_decorators = [zUI()];
111
115
  __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);
112
116
  __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);
117
+ __esDecorate(null, null, _isA_decorators, { kind: "field", name: "isA", static: false, private: false, access: { has: obj => "isA" in obj, get: obj => obj.isA, set: (obj, value) => { obj.isA = value; } }, metadata: _metadata }, _isA_initializers, _isA_extraInitializers);
113
118
  __esDecorate(null, null, _layerClipA_decorators, { kind: "field", name: "layerClipA", static: false, private: false, access: { has: obj => "layerClipA" in obj, get: obj => obj.layerClipA, set: (obj, value) => { obj.layerClipA = value; } }, metadata: _metadata }, _layerClipA_initializers, _layerClipA_extraInitializers);
114
119
  __esDecorate(null, null, _layerOffA_decorators, { kind: "field", name: "layerOffA", static: false, private: false, access: { has: obj => "layerOffA" in obj, get: obj => obj.layerOffA, set: (obj, value) => { obj.layerOffA = value; } }, metadata: _metadata }, _layerOffA_initializers, _layerOffA_extraInitializers);
115
120
  __esDecorate(null, null, _layerClipB_decorators, { kind: "field", name: "layerClipB", static: false, private: false, access: { has: obj => "layerClipB" in obj, get: obj => obj.layerClipB, set: (obj, value) => { obj.layerClipB = value; } }, metadata: _metadata }, _layerClipB_initializers, _layerClipB_extraInitializers);
@@ -129,13 +134,14 @@ let ToggleLayerClips = (() => {
129
134
  zcomponent = (__runInitializers(this, _instanceExtraInitializers), this.getZComponentInstance());
130
135
  /**
131
136
  * @default true
137
+ * @zignore
132
138
  */
133
- isA = true;
139
+ isA = __runInitializers(this, _isA_initializers, true);
134
140
  /**
135
141
  * @zui
136
142
  * @zvalues layerclipids
137
143
  */
138
- layerClipA = __runInitializers(this, _layerClipA_initializers, void 0);
144
+ layerClipA = (__runInitializers(this, _isA_extraInitializers), __runInitializers(this, _layerClipA_initializers, void 0));
139
145
  /**
140
146
  * @zui
141
147
  * @zvalues layerids
@@ -51,6 +51,7 @@ export type ComponentChildren = ComponentChild<Component>[];
51
51
  */
52
52
  export interface ConstructorProps {
53
53
  [id: string]: any;
54
+ /** @zignore */
54
55
  children?: ComponentChildren;
55
56
  }
56
57
  /**
@@ -112,6 +113,9 @@ export declare class Component<ElementType = any, ConstructorPropsType extends C
112
113
  * @zignore
113
114
  */
114
115
  appendChild(c: Component): void;
116
+ /**
117
+ * @zignore
118
+ */
115
119
  connectElements(): void;
116
120
  /**
117
121
  * Removes the supplied component instance from the list of children.
@@ -156,10 +160,12 @@ export declare class Component<ElementType = any, ConstructorPropsType extends C
156
160
  * An array of the elements that this component instance exposes. In the case that this component
157
161
  * does not expose any elements of its own, this will be an array of the elements
158
162
  * exposed by this component's children.
163
+ * @zignore
159
164
  */
160
165
  get elementsResolved(): any[];
161
166
  /**
162
167
  * Returns true if this component, or any of its parents, are marked as locked.
168
+ * @zignore
163
169
  */
164
170
  get lockedResolved(): boolean;
165
171
  /**
@@ -178,6 +184,7 @@ export declare class Component<ElementType = any, ConstructorPropsType extends C
178
184
  private _updateEnabledResolved;
179
185
  /**
180
186
  * Dispose of this component and all of its children.
187
+ * @zignore
181
188
  */
182
189
  dispose(): never;
183
190
  }
package/lib/component.js CHANGED
@@ -135,6 +135,9 @@ let Component = (() => {
135
135
  c.connectElements();
136
136
  c._updateEnabledResolved();
137
137
  }
138
+ /**
139
+ * @zignore
140
+ */
138
141
  connectElements() {
139
142
  if (this.element === undefined) {
140
143
  for (const child of this.children) {
@@ -206,6 +209,7 @@ let Component = (() => {
206
209
  * An array of the elements that this component instance exposes. In the case that this component
207
210
  * does not expose any elements of its own, this will be an array of the elements
208
211
  * exposed by this component's children.
212
+ * @zignore
209
213
  */
210
214
  get elementsResolved() {
211
215
  if (this.element !== undefined) {
@@ -221,6 +225,7 @@ let Component = (() => {
221
225
  }
222
226
  /**
223
227
  * Returns true if this component, or any of its parents, are marked as locked.
228
+ * @zignore
224
229
  */
225
230
  get lockedResolved() {
226
231
  return (this.locked ?? false) || (this._parent?.lockedResolved ?? false);
@@ -251,6 +256,7 @@ let Component = (() => {
251
256
  });
252
257
  /**
253
258
  * Dispose of this component and all of its children.
259
+ * @zignore
254
260
  */
255
261
  dispose() {
256
262
  for (const child of this.children) {
@@ -12,7 +12,13 @@ import { Event } from '../event';
12
12
  * @zgroup Advanced
13
13
  */
14
14
  export declare class AnimatedLoader extends Component {
15
+ /**
16
+ * @zui
17
+ */
15
18
  onLoading: Event<[]>;
19
+ /**
20
+ * @zui
21
+ */
16
22
  onNotLoading: Event<[]>;
17
23
  /**
18
24
  * A layer clip that will be played when there is no loading being performed
@@ -86,7 +86,13 @@ let AnimatedLoader = (() => {
86
86
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
87
87
  __runInitializers(_classThis, _classExtraInitializers);
88
88
  }
89
+ /**
90
+ * @zui
91
+ */
89
92
  onLoading = __runInitializers(this, _onLoading_initializers, new Event());
93
+ /**
94
+ * @zui
95
+ */
90
96
  onNotLoading = (__runInitializers(this, _onLoading_extraInitializers), __runInitializers(this, _onNotLoading_initializers, new Event()));
91
97
  /**
92
98
  * A layer clip that will be played when there is no loading being performed
@@ -19,12 +19,11 @@ export interface AudioConstructorProps {
19
19
  * The Audio class represents an audio component that can be controlled.
20
20
  * It provides methods to play, pause, stop, and seek the audio.
21
21
  * It also provides observables for volume and mute state, and events for when the audio ends, stops, pauses, and plays.
22
- *
23
- * @zstream
24
22
  * @zcomponent
25
23
  * @zicon music_note
26
24
  * @zgroup Media
27
25
  * @ztag core/audio
26
+ * @zstream
28
27
  */
29
28
  export declare class Audio extends Component<undefined, AudioConstructorProps> implements Stream {
30
29
  private _gain;
@@ -38,12 +37,33 @@ export declare class Audio extends Component<undefined, AudioConstructorProps> i
38
37
  */
39
38
  private _rate;
40
39
  private _session?;
40
+ /**
41
+ * @zui
42
+ */
41
43
  readonly onEnded: Event<[Audio]>;
44
+ /**
45
+ * @zui
46
+ */
42
47
  readonly onStop: Event<[Audio]>;
48
+ /**
49
+ * @zui
50
+ */
43
51
  readonly onPause: Event<[Audio]>;
52
+ /**
53
+ * @zui
54
+ */
44
55
  readonly onPlay: Event<[Audio]>;
56
+ /**
57
+ * @zignore
58
+ */
45
59
  readonly audioContext: AudioContext;
60
+ /**
61
+ * @zignore
62
+ */
46
63
  readonly destination: AudioNode;
64
+ /**
65
+ * @zignore
66
+ */
47
67
  audioBuffer?: AudioBuffer;
48
68
  /**
49
69
  * Creates a new Audio component.
@@ -90,6 +110,12 @@ export declare class Audio extends Component<undefined, AudioConstructorProps> i
90
110
  * @zui
91
111
  */
92
112
  seek(t: number): void;
113
+ /**
114
+ * @zignore
115
+ */
93
116
  length(): number | undefined;
117
+ /**
118
+ * @zignore
119
+ */
94
120
  dispose(): never;
95
121
  }
@@ -36,18 +36,17 @@ import { Component } from '../component';
36
36
  import { AudioContextContext, useAudioContext } from '../contexts/audiocontextcontext';
37
37
  import { isDesignTime } from '../contexts/environmentcontext';
38
38
  import { started, zLoad } from '../contexts/loadcontext';
39
- import { zComponent, zObserve, zUI } from '../decorators';
39
+ import { zComponent, zIgnore, zObserve, zUI } from '../decorators';
40
40
  import { Event } from '../event';
41
41
  /**
42
42
  * The Audio class represents an audio component that can be controlled.
43
43
  * It provides methods to play, pause, stop, and seek the audio.
44
44
  * It also provides observables for volume and mute state, and events for when the audio ends, stops, pauses, and plays.
45
- *
46
- * @zstream
47
45
  * @zcomponent
48
46
  * @zicon music_note
49
47
  * @zgroup Media
50
48
  * @ztag core/audio
49
+ * @zstream
51
50
  */
52
51
  let Audio = (() => {
53
52
  let _classDecorators = [zComponent({ icon: 'music_note', group: 'Media', tags: ['core/audio'] })];
@@ -68,6 +67,15 @@ let Audio = (() => {
68
67
  let _onPlay_decorators;
69
68
  let _onPlay_initializers = [];
70
69
  let _onPlay_extraInitializers = [];
70
+ let _audioContext_decorators;
71
+ let _audioContext_initializers = [];
72
+ let _audioContext_extraInitializers = [];
73
+ let _destination_decorators;
74
+ let _destination_initializers = [];
75
+ let _destination_extraInitializers = [];
76
+ let _audioBuffer_decorators;
77
+ let _audioBuffer_initializers = [];
78
+ let _audioBuffer_extraInitializers = [];
71
79
  let __load_decorators;
72
80
  let _muted_decorators;
73
81
  let _muted_initializers = [];
@@ -82,6 +90,8 @@ let Audio = (() => {
82
90
  let _pause_decorators;
83
91
  let _stop_decorators;
84
92
  let _seek_decorators;
93
+ let _length_decorators;
94
+ let _dispose_decorators;
85
95
  var Audio = class extends _classSuper {
86
96
  static { _classThis = this; }
87
97
  static {
@@ -90,6 +100,9 @@ let Audio = (() => {
90
100
  _onStop_decorators = [zUI()];
91
101
  _onPause_decorators = [zUI()];
92
102
  _onPlay_decorators = [zUI()];
103
+ _audioContext_decorators = [zIgnore()];
104
+ _destination_decorators = [zIgnore()];
105
+ _audioBuffer_decorators = [zIgnore()];
93
106
  __load_decorators = [zLoad()];
94
107
  _muted_decorators = [zUI({ group: 'Audio', priority: 20 }), zObserve((v, instance) => {
95
108
  instance._updateVolume();
@@ -105,15 +118,22 @@ let Audio = (() => {
105
118
  _pause_decorators = [zUI()];
106
119
  _stop_decorators = [zUI()];
107
120
  _seek_decorators = [zUI({ type: 'time-milliseconds' })];
121
+ _length_decorators = [zIgnore()];
122
+ _dispose_decorators = [zIgnore()];
108
123
  __esDecorate(this, null, __load_decorators, { kind: "method", name: "_load", static: false, private: false, access: { has: obj => "_load" in obj, get: obj => obj._load }, metadata: _metadata }, null, _instanceExtraInitializers);
109
124
  __esDecorate(this, null, _play_decorators, { kind: "method", name: "play", static: false, private: false, access: { has: obj => "play" in obj, get: obj => obj.play }, metadata: _metadata }, null, _instanceExtraInitializers);
110
125
  __esDecorate(this, null, _pause_decorators, { kind: "method", name: "pause", static: false, private: false, access: { has: obj => "pause" in obj, get: obj => obj.pause }, metadata: _metadata }, null, _instanceExtraInitializers);
111
126
  __esDecorate(this, null, _stop_decorators, { kind: "method", name: "stop", static: false, private: false, access: { has: obj => "stop" in obj, get: obj => obj.stop }, metadata: _metadata }, null, _instanceExtraInitializers);
112
127
  __esDecorate(this, null, _seek_decorators, { kind: "method", name: "seek", static: false, private: false, access: { has: obj => "seek" in obj, get: obj => obj.seek }, metadata: _metadata }, null, _instanceExtraInitializers);
128
+ __esDecorate(this, null, _length_decorators, { kind: "method", name: "length", static: false, private: false, access: { has: obj => "length" in obj, get: obj => obj.length }, metadata: _metadata }, null, _instanceExtraInitializers);
129
+ __esDecorate(this, null, _dispose_decorators, { kind: "method", name: "dispose", static: false, private: false, access: { has: obj => "dispose" in obj, get: obj => obj.dispose }, metadata: _metadata }, null, _instanceExtraInitializers);
113
130
  __esDecorate(null, null, _onEnded_decorators, { kind: "field", name: "onEnded", static: false, private: false, access: { has: obj => "onEnded" in obj, get: obj => obj.onEnded, set: (obj, value) => { obj.onEnded = value; } }, metadata: _metadata }, _onEnded_initializers, _onEnded_extraInitializers);
114
131
  __esDecorate(null, null, _onStop_decorators, { kind: "field", name: "onStop", static: false, private: false, access: { has: obj => "onStop" in obj, get: obj => obj.onStop, set: (obj, value) => { obj.onStop = value; } }, metadata: _metadata }, _onStop_initializers, _onStop_extraInitializers);
115
132
  __esDecorate(null, null, _onPause_decorators, { kind: "field", name: "onPause", static: false, private: false, access: { has: obj => "onPause" in obj, get: obj => obj.onPause, set: (obj, value) => { obj.onPause = value; } }, metadata: _metadata }, _onPause_initializers, _onPause_extraInitializers);
116
133
  __esDecorate(null, null, _onPlay_decorators, { kind: "field", name: "onPlay", static: false, private: false, access: { has: obj => "onPlay" in obj, get: obj => obj.onPlay, set: (obj, value) => { obj.onPlay = value; } }, metadata: _metadata }, _onPlay_initializers, _onPlay_extraInitializers);
134
+ __esDecorate(null, null, _audioContext_decorators, { kind: "field", name: "audioContext", static: false, private: false, access: { has: obj => "audioContext" in obj, get: obj => obj.audioContext, set: (obj, value) => { obj.audioContext = value; } }, metadata: _metadata }, _audioContext_initializers, _audioContext_extraInitializers);
135
+ __esDecorate(null, null, _destination_decorators, { kind: "field", name: "destination", static: false, private: false, access: { has: obj => "destination" in obj, get: obj => obj.destination, set: (obj, value) => { obj.destination = value; } }, metadata: _metadata }, _destination_initializers, _destination_extraInitializers);
136
+ __esDecorate(null, null, _audioBuffer_decorators, { kind: "field", name: "audioBuffer", static: false, private: false, access: { has: obj => "audioBuffer" in obj, get: obj => obj.audioBuffer, set: (obj, value) => { obj.audioBuffer = value; } }, metadata: _metadata }, _audioBuffer_initializers, _audioBuffer_extraInitializers);
117
137
  __esDecorate(null, null, _muted_decorators, { kind: "field", name: "muted", static: false, private: false, access: { has: obj => "muted" in obj, get: obj => obj.muted, set: (obj, value) => { obj.muted = value; } }, metadata: _metadata }, _muted_initializers, _muted_extraInitializers);
118
138
  __esDecorate(null, null, _volume_decorators, { kind: "field", name: "volume", static: false, private: false, access: { has: obj => "volume" in obj, get: obj => obj.volume, set: (obj, value) => { obj.volume = value; } }, metadata: _metadata }, _volume_initializers, _volume_extraInitializers);
119
139
  __esDecorate(null, null, _loop_decorators, { kind: "field", name: "loop", static: false, private: false, access: { has: obj => "loop" in obj, get: obj => obj.loop, set: (obj, value) => { obj.loop = value; } }, metadata: _metadata }, _loop_initializers, _loop_extraInitializers);
@@ -133,13 +153,34 @@ let Audio = (() => {
133
153
  */
134
154
  _rate = 1;
135
155
  _session;
156
+ /**
157
+ * @zui
158
+ */
136
159
  onEnded = __runInitializers(this, _onEnded_initializers, new Event());
160
+ /**
161
+ * @zui
162
+ */
137
163
  onStop = (__runInitializers(this, _onEnded_extraInitializers), __runInitializers(this, _onStop_initializers, new Event()));
164
+ /**
165
+ * @zui
166
+ */
138
167
  onPause = (__runInitializers(this, _onStop_extraInitializers), __runInitializers(this, _onPause_initializers, new Event()));
168
+ /**
169
+ * @zui
170
+ */
139
171
  onPlay = (__runInitializers(this, _onPause_extraInitializers), __runInitializers(this, _onPlay_initializers, new Event()));
140
- audioContext = __runInitializers(this, _onPlay_extraInitializers);
141
- destination;
142
- audioBuffer;
172
+ /**
173
+ * @zignore
174
+ */
175
+ audioContext = (__runInitializers(this, _onPlay_extraInitializers), __runInitializers(this, _audioContext_initializers, void 0));
176
+ /**
177
+ * @zignore
178
+ */
179
+ destination = (__runInitializers(this, _audioContext_extraInitializers), __runInitializers(this, _destination_initializers, void 0));
180
+ /**
181
+ * @zignore
182
+ */
183
+ audioBuffer = (__runInitializers(this, _destination_extraInitializers), __runInitializers(this, _audioBuffer_initializers, void 0));
143
184
  /**
144
185
  * Creates a new Audio component.
145
186
  * @param mgr - The current ContextManager
@@ -164,9 +205,9 @@ let Audio = (() => {
164
205
  const audioContext = useAudioContext(this.contextManager);
165
206
  this.audioBuffer = await audioContext.decodeAudioData(data);
166
207
  }
167
- _updateVolume = () => {
208
+ _updateVolume = (__runInitializers(this, _audioBuffer_extraInitializers), () => {
168
209
  this._gain.gain.value = this.muted === true ? 0 : this.volume;
169
- };
210
+ });
170
211
  /**
171
212
  * @default false
172
213
  * @zui
@@ -276,9 +317,15 @@ let Audio = (() => {
276
317
  if (previousSession)
277
318
  this.play({ speed: this._rate });
278
319
  }
320
+ /**
321
+ * @zignore
322
+ */
279
323
  length() {
280
324
  return this.audioBuffer ? this.audioBuffer.duration * 1000 : undefined;
281
325
  }
326
+ /**
327
+ * @zignore
328
+ */
282
329
  dispose() {
283
330
  this.stop();
284
331
  this._gain.disconnect();
@@ -142,11 +142,22 @@ export declare class DefaultCookieConsent extends Component {
142
142
  private _setConsentStatus;
143
143
  /**
144
144
  * Shows the cookie consent dialog.
145
+ *
145
146
  * @param isSettings - Determines if the settings screen should be shown
146
147
  * @param force - Forces the dialog to be shown, regardless of the current consent status. Defaults to false.
148
+ * @zui
147
149
  */
148
150
  show(isSettings: boolean, force?: boolean): void;
151
+ /**
152
+ * @zui
153
+ */
149
154
  hide(): void;
155
+ /**
156
+ * @zui
157
+ */
150
158
  acceptAll(): void;
159
+ /**
160
+ * @zignore
161
+ */
151
162
  dispose(): never;
152
163
  }