@micromag/screen-audio 0.4.71 → 0.4.74

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 (3) hide show
  1. package/es/index.d.ts +2 -2
  2. package/es/index.js +614 -268
  3. package/package.json +16 -15
package/es/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ForwardedRef } from 'react';
3
- import { AudioElement, BackgroundElement, Header, Footer } from '@micromag/core';
3
+ import { AudioElement, BackgroundElement, Header, Footer, MediaElement } from '@micromag/core';
4
4
 
5
5
  interface AudioScreenProps {
6
6
  layout?: 'middle';
@@ -11,7 +11,7 @@ interface AudioScreenProps {
11
11
  footer?: Footer | null;
12
12
  current?: boolean;
13
13
  preload?: boolean;
14
- mediaRef?: ForwardedRef<HTMLMediaElement> | null;
14
+ mediaRef?: ForwardedRef<MediaElement> | null;
15
15
  showWave?: boolean;
16
16
  className?: string | null;
17
17
  }
package/es/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import { FormattedMessage, defineMessage } from 'react-intl';
2
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import { c } from 'react/compiler-runtime';
5
3
  import classNames from 'classnames';
6
- import { useState, useEffect, useCallback, useMemo } from 'react';
4
+ import { useState, useEffect } from 'react';
7
5
  import { ScreenElement } from '@micromag/core/components';
8
6
  import { useScreenSize, useScreenRenderContext, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
9
7
  import { useTrackScreenMedia } from '@micromag/core/hooks';
@@ -15,254 +13,591 @@ import Container from '@micromag/element-container';
15
13
  import Footer from '@micromag/element-footer';
16
14
  import Header from '@micromag/element-header';
17
15
  import Layout, { Spacer } from '@micromag/element-layout';
18
- import { jsxs, jsx } from 'react/jsx-runtime';
16
+ import { jsx, jsxs } from 'react/jsx-runtime';
19
17
 
20
18
  var styles = {"container":"micromag-screen-audio-container","background":"micromag-screen-audio-background","content":"micromag-screen-audio-content","audio":"micromag-screen-audio-audio","bottom":"micromag-screen-audio-bottom","empty":"micromag-screen-audio-empty","isPreview":"micromag-screen-audio-isPreview"};
21
19
 
22
- function AudioScreen(_ref) {
23
- _ref.layout;
24
- var _ref$audio = _ref.audio,
25
- audio = _ref$audio === void 0 ? null : _ref$audio,
26
- _ref$spacing = _ref.spacing,
27
- spacing = _ref$spacing === void 0 ? 20 : _ref$spacing,
28
- _ref$background = _ref.background,
29
- background = _ref$background === void 0 ? null : _ref$background,
30
- _ref$header = _ref.header,
31
- header = _ref$header === void 0 ? null : _ref$header,
32
- _ref$footer = _ref.footer,
33
- footer = _ref$footer === void 0 ? null : _ref$footer,
34
- _ref$current = _ref.current,
35
- current = _ref$current === void 0 ? true : _ref$current,
36
- _ref$preload = _ref.preload,
37
- preload = _ref$preload === void 0 ? true : _ref$preload,
38
- _ref$mediaRef = _ref.mediaRef,
39
- customMediaRef = _ref$mediaRef === void 0 ? null : _ref$mediaRef,
40
- _ref$showWave = _ref.showWave,
41
- showWave = _ref$showWave === void 0 ? true : _ref$showWave,
42
- _ref$className = _ref.className,
43
- className = _ref$className === void 0 ? null : _ref$className;
44
- var _useScreenSize = useScreenSize(),
45
- width = _useScreenSize.width,
46
- height = _useScreenSize.height,
47
- resolution = _useScreenSize.resolution;
48
- var _useScreenRenderConte = useScreenRenderContext(),
49
- isPlaceholder = _useScreenRenderConte.isPlaceholder,
50
- isPreview = _useScreenRenderConte.isPreview,
51
- isView = _useScreenRenderConte.isView,
52
- isEdit = _useScreenRenderConte.isEdit,
53
- isStatic = _useScreenRenderConte.isStatic,
54
- isCapture = _useScreenRenderConte.isCapture;
55
- var _useViewerContext = useViewerContext(),
56
- viewerTopHeight = _useViewerContext.topHeight,
57
- viewerBottomHeight = _useViewerContext.bottomHeight,
58
- viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
59
- var _useViewerWebView = useViewerWebView(),
60
- openWebView = _useViewerWebView.open;
61
- var trackScreenMedia = useTrackScreenMedia('audio');
62
- var _useState = useState(isStatic || isPlaceholder),
63
- _useState2 = _slicedToArray(_useState, 2),
64
- ready = _useState2[0],
65
- setReady = _useState2[1];
66
- var backgroundPlaying = current && (isView || isEdit);
67
- var mediaShouldLoad = current || preload;
68
- // const transitionPlaying = current && ready;
69
- // const transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
70
-
71
- var hasHeader = isHeaderFilled(header);
72
- var hasFooter = isFooterFilled(footer);
73
- var footerProps = getFooterProps(footer, {
74
- isView: isView,
75
- current: current,
76
- openWebView: openWebView,
77
- isPreview: isPreview
78
- });
79
- var hasAudio = audio !== null;
80
- var _ref2 = audio || {},
81
- _ref2$media = _ref2.media,
82
- audioMedia = _ref2$media === void 0 ? null : _ref2$media,
83
- _ref2$autoPlay = _ref2.autoPlay,
84
- autoPlay = _ref2$autoPlay === void 0 ? true : _ref2$autoPlay,
85
- _ref2$closedCaptions = _ref2.closedCaptions,
86
- closedCaptions = _ref2$closedCaptions === void 0 ? null : _ref2$closedCaptions,
87
- _ref2$captions = _ref2.captions,
88
- captions = _ref2$captions === void 0 ? null : _ref2$captions,
89
- _ref2$withWave = _ref2.withWave,
90
- withWave = _ref2$withWave === void 0 ? false : _ref2$withWave,
91
- _ref2$withControls = _ref2.withControls,
92
- withControls = _ref2$withControls === void 0 ? false : _ref2$withControls,
93
- _ref2$withSeekBar = _ref2.withSeekBar,
94
- withSeekBar = _ref2$withSeekBar === void 0 ? false : _ref2$withSeekBar,
95
- _ref2$color = _ref2.color,
96
- color = _ref2$color === void 0 ? null : _ref2$color,
97
- _ref2$progressColor = _ref2.progressColor,
98
- progressColor = _ref2$progressColor === void 0 ? null : _ref2$progressColor;
99
- var _ref3 = audioMedia || {},
100
- _ref3$url = _ref3.url,
101
- audioUrl = _ref3$url === void 0 ? null : _ref3$url;
102
- var hasAudioUrl = audioUrl !== null;
103
- var finalAudio = hasAudio ? _objectSpread(_objectSpread({}, audio), {}, {
104
- autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
105
- }) : null;
106
- var hasClosedCaptions = closedCaptions !== null || captions !== null;
107
- var _usePlaybackContext = usePlaybackContext(),
108
- playing = _usePlaybackContext.playing,
109
- muted = _usePlaybackContext.muted,
110
- setControls = _usePlaybackContext.setControls,
111
- setControlsSuggestPlay = _usePlaybackContext.setControlsSuggestPlay,
112
- setControlsTheme = _usePlaybackContext.setControlsTheme,
113
- setPlaying = _usePlaybackContext.setPlaying;
114
- var _usePlaybackMediaRef = usePlaybackMediaRef(current),
115
- mediaRef = _usePlaybackMediaRef.ref,
116
- _usePlaybackMediaRef$ = _usePlaybackMediaRef.isCurrent,
117
- isCurrentMedia = _usePlaybackMediaRef$ === void 0 ? false : _usePlaybackMediaRef$;
118
- var paused = !current || !playing || !isCurrentMedia && isView;
119
- useEffect(function () {
120
- if (!current) {
121
- return function () {};
122
- }
123
- if (withControls || withSeekBar) {
124
- setControls(true);
125
- setControlsTheme({
126
- seekBarOnly: withSeekBar,
127
- color: color,
128
- progressColor: progressColor
129
- });
130
- } else {
131
- setControls(false);
132
- }
133
- return function () {
20
+ function AudioScreen(t0) {
21
+ const $ = c(150);
22
+ const {
23
+ layout: t1,
24
+ audio: t2,
25
+ spacing: t3,
26
+ background: t4,
27
+ header: t5,
28
+ footer: t6,
29
+ current: t7,
30
+ preload: t8,
31
+ mediaRef: t9,
32
+ showWave: t10,
33
+ className: t11
34
+ } = t0;
35
+ const audio = t2 === undefined ? null : t2;
36
+ const spacing = t3 === undefined ? 20 : t3;
37
+ const background = t4 === undefined ? null : t4;
38
+ const header = t5 === undefined ? null : t5;
39
+ const footer = t6 === undefined ? null : t6;
40
+ const current = t7 === undefined ? true : t7;
41
+ const preload = t8 === undefined ? true : t8;
42
+ const customMediaRef = t9 === undefined ? null : t9;
43
+ const showWave = t10 === undefined ? true : t10;
44
+ const className = t11 === undefined ? null : t11;
45
+ const {
46
+ width,
47
+ height,
48
+ resolution
49
+ } = useScreenSize();
50
+ const {
51
+ isPlaceholder,
52
+ isPreview,
53
+ isView,
54
+ isEdit,
55
+ isStatic,
56
+ isCapture
57
+ } = useScreenRenderContext();
58
+ const {
59
+ topHeight: viewerTopHeight,
60
+ bottomHeight: viewerBottomHeight,
61
+ bottomSidesWidth: viewerBottomSidesWidth
62
+ } = useViewerContext();
63
+ const {
64
+ open: openWebView
65
+ } = useViewerWebView();
66
+ const trackScreenMedia = useTrackScreenMedia("audio");
67
+ const [ready, setReady] = useState(isStatic || isPlaceholder);
68
+ const backgroundPlaying = current && (isView || isEdit);
69
+ const mediaShouldLoad = current || preload;
70
+ let t12;
71
+ if ($[0] !== header) {
72
+ t12 = isHeaderFilled(header);
73
+ $[0] = header;
74
+ $[1] = t12;
75
+ } else {
76
+ t12 = $[1];
77
+ }
78
+ const hasHeader = t12;
79
+ let t13;
80
+ if ($[2] !== footer) {
81
+ t13 = isFooterFilled(footer);
82
+ $[2] = footer;
83
+ $[3] = t13;
84
+ } else {
85
+ t13 = $[3];
86
+ }
87
+ const hasFooter = t13;
88
+ let t14;
89
+ if ($[4] !== current || $[5] !== footer || $[6] !== isPreview || $[7] !== isView || $[8] !== openWebView) {
90
+ t14 = getFooterProps(footer, {
91
+ isView,
92
+ current,
93
+ openWebView,
94
+ isPreview
95
+ });
96
+ $[4] = current;
97
+ $[5] = footer;
98
+ $[6] = isPreview;
99
+ $[7] = isView;
100
+ $[8] = openWebView;
101
+ $[9] = t14;
102
+ } else {
103
+ t14 = $[9];
104
+ }
105
+ const footerProps = t14;
106
+ const hasAudio = audio !== null;
107
+ let t15;
108
+ if ($[10] !== audio) {
109
+ t15 = audio || {};
110
+ $[10] = audio;
111
+ $[11] = t15;
112
+ } else {
113
+ t15 = $[11];
114
+ }
115
+ const {
116
+ media: t16,
117
+ autoPlay: t17,
118
+ closedCaptions: t18,
119
+ captions: t19,
120
+ withWave: t20,
121
+ withControls: t21,
122
+ withSeekBar: t22,
123
+ color: t23,
124
+ progressColor: t24
125
+ } = t15;
126
+ const audioMedia = t16 === undefined ? null : t16;
127
+ const autoPlay = t17 === undefined ? true : t17;
128
+ const closedCaptions = t18 === undefined ? null : t18;
129
+ const captions = t19 === undefined ? null : t19;
130
+ const withWave = t20 === undefined ? false : t20;
131
+ const withControls = t21 === undefined ? false : t21;
132
+ const withSeekBar = t22 === undefined ? false : t22;
133
+ const color = t23 === undefined ? null : t23;
134
+ const progressColor = t24 === undefined ? null : t24;
135
+ let t25;
136
+ if ($[12] !== audioMedia) {
137
+ t25 = audioMedia || {};
138
+ $[12] = audioMedia;
139
+ $[13] = t25;
140
+ } else {
141
+ t25 = $[13];
142
+ }
143
+ const {
144
+ url: t26
145
+ } = t25;
146
+ const audioUrl = t26 === undefined ? null : t26;
147
+ const hasAudioUrl = audioUrl !== null;
148
+ let t27;
149
+ if ($[14] !== audio || $[15] !== autoPlay || $[16] !== current || $[17] !== hasAudio || $[18] !== isCapture || $[19] !== isPreview || $[20] !== isStatic) {
150
+ t27 = hasAudio ? {
151
+ ...audio,
152
+ autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
153
+ } : null;
154
+ $[14] = audio;
155
+ $[15] = autoPlay;
156
+ $[16] = current;
157
+ $[17] = hasAudio;
158
+ $[18] = isCapture;
159
+ $[19] = isPreview;
160
+ $[20] = isStatic;
161
+ $[21] = t27;
162
+ } else {
163
+ t27 = $[21];
164
+ }
165
+ const finalAudio = t27;
166
+ const hasClosedCaptions = closedCaptions !== null || captions !== null;
167
+ const {
168
+ playing,
169
+ muted,
170
+ setControls,
171
+ setControlsSuggestPlay,
172
+ setControlsTheme,
173
+ setPlaying
174
+ } = usePlaybackContext();
175
+ const {
176
+ ref: mediaRef,
177
+ isCurrent: t28
178
+ } = usePlaybackMediaRef(current);
179
+ const isCurrentMedia = t28 === undefined ? false : t28;
180
+ const paused = !current || !playing || !isCurrentMedia && isView;
181
+ let t29;
182
+ if ($[22] !== color || $[23] !== current || $[24] !== progressColor || $[25] !== setControls || $[26] !== setControlsTheme || $[27] !== withControls || $[28] !== withSeekBar) {
183
+ t29 = () => {
184
+ if (!current) {
185
+ return _temp;
186
+ }
134
187
  if (withControls || withSeekBar) {
188
+ setControls(true);
189
+ setControlsTheme({
190
+ seekBarOnly: withSeekBar,
191
+ color,
192
+ progressColor
193
+ });
194
+ } else {
135
195
  setControls(false);
136
196
  }
197
+ return () => {
198
+ if (withControls || withSeekBar) {
199
+ setControls(false);
200
+ }
201
+ };
137
202
  };
138
- }, [current, withControls, withSeekBar, setControls, color, progressColor]);
139
- var onAudioReady = useCallback(function () {
140
- setReady(true);
141
- }, [setReady]);
142
- var _useState3 = useState(null),
143
- _useState4 = _slicedToArray(_useState3, 2),
144
- currentTime = _useState4[0],
145
- setCurrentTime = _useState4[1];
146
- var _useState5 = useState(null),
147
- _useState6 = _slicedToArray(_useState5, 2),
148
- duration = _useState6[0],
149
- setDuration = _useState6[1];
150
- var isIOS = useMemo(function () {
151
- return isIos();
152
- }, [isIos]);
153
- useEffect(function () {
154
- if (current && autoPlay && !playing) {
155
- setPlaying(true);
156
- }
157
- }, [current, autoPlay]);
158
- var onTimeUpdate = useCallback(function (_ref4) {
159
- var _ref4$timeStamp = _ref4.timeStamp,
160
- timeStamp = _ref4$timeStamp === void 0 ? 0 : _ref4$timeStamp;
161
- setCurrentTime(timeStamp);
162
- }, [setCurrentTime, setDuration, duration]);
163
- var onProgressStep = useCallback(function (step, meta) {
164
- trackScreenMedia(audioMedia, "progress_".concat(Math.round(step * 100, 10), "%"), meta);
165
- }, [trackScreenMedia, audioMedia]);
166
- var onDurationChange = useCallback(function (dur) {
167
- setDuration(dur);
168
- }, [setDuration]);
169
- var onPlay = useCallback(function (_ref5) {
170
- var initial = _ref5.initial;
171
- trackScreenMedia(audioMedia, initial ? 'play' : 'resume');
172
- }, [trackScreenMedia, audioMedia]);
173
- var onPause = useCallback(function (_ref6) {
174
- var midway = _ref6.midway;
175
- trackScreenMedia(audioMedia, midway ? 'pause' : 'ended');
176
- }, [trackScreenMedia, audioMedia]);
177
- var onEnded = useCallback(function () {
178
- if (current) {
179
- setPlaying(false);
180
- }
181
- }, [current, setPlaying]);
182
- var onSeeked = useCallback(function (time) {
183
- if (time > 0) {
184
- trackScreenMedia(audioMedia, 'seek');
185
- }
186
- }, [trackScreenMedia, audioMedia]);
187
- var onPlayError = useCallback(function () {
188
- if (isView && playing && current && hasAudio && autoPlay) {
189
- setPlaying(false);
190
- setControlsSuggestPlay(true);
191
- }
192
- }, [isView, current, playing, hasAudio, autoPlay, setPlaying, setControlsSuggestPlay]);
193
- return /*#__PURE__*/jsxs("div", {
194
- className: classNames([styles.container, className, _defineProperty(_defineProperty({}, styles.placeholder, isPlaceholder), styles.isPreview, isPreview)]),
195
- "data-screen-ready": ready,
196
- children: [/*#__PURE__*/jsx(Container, {
203
+ $[22] = color;
204
+ $[23] = current;
205
+ $[24] = progressColor;
206
+ $[25] = setControls;
207
+ $[26] = setControlsTheme;
208
+ $[27] = withControls;
209
+ $[28] = withSeekBar;
210
+ $[29] = t29;
211
+ } else {
212
+ t29 = $[29];
213
+ }
214
+ let t30;
215
+ if ($[30] !== color || $[31] !== current || $[32] !== progressColor || $[33] !== setControls || $[34] !== withControls || $[35] !== withSeekBar) {
216
+ t30 = [current, withControls, withSeekBar, setControls, color, progressColor];
217
+ $[30] = color;
218
+ $[31] = current;
219
+ $[32] = progressColor;
220
+ $[33] = setControls;
221
+ $[34] = withControls;
222
+ $[35] = withSeekBar;
223
+ $[36] = t30;
224
+ } else {
225
+ t30 = $[36];
226
+ }
227
+ useEffect(t29, t30);
228
+ let t31;
229
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
230
+ t31 = () => {
231
+ setReady(true);
232
+ };
233
+ $[37] = t31;
234
+ } else {
235
+ t31 = $[37];
236
+ }
237
+ const onAudioReady = t31;
238
+ const [currentTime, setCurrentTime] = useState(null);
239
+ const [duration, setDuration] = useState(null);
240
+ let t32;
241
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
242
+ t32 = isIos();
243
+ $[38] = t32;
244
+ } else {
245
+ t32 = $[38];
246
+ }
247
+ const isIOS = t32;
248
+ let t33;
249
+ if ($[39] !== autoPlay || $[40] !== current || $[41] !== playing || $[42] !== setPlaying) {
250
+ t33 = () => {
251
+ if (current && autoPlay && !playing) {
252
+ setPlaying(true);
253
+ }
254
+ };
255
+ $[39] = autoPlay;
256
+ $[40] = current;
257
+ $[41] = playing;
258
+ $[42] = setPlaying;
259
+ $[43] = t33;
260
+ } else {
261
+ t33 = $[43];
262
+ }
263
+ let t34;
264
+ if ($[44] !== autoPlay || $[45] !== current) {
265
+ t34 = [current, autoPlay];
266
+ $[44] = autoPlay;
267
+ $[45] = current;
268
+ $[46] = t34;
269
+ } else {
270
+ t34 = $[46];
271
+ }
272
+ useEffect(t33, t34);
273
+ let t35;
274
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
275
+ t35 = t36 => {
276
+ const {
277
+ timeStamp: t37
278
+ } = t36;
279
+ const timeStamp = t37 === undefined ? 0 : t37;
280
+ setCurrentTime(timeStamp);
281
+ };
282
+ $[47] = t35;
283
+ } else {
284
+ t35 = $[47];
285
+ }
286
+ const onTimeUpdate = t35;
287
+ let t36;
288
+ if ($[48] !== audioMedia || $[49] !== trackScreenMedia) {
289
+ t36 = (step, meta) => {
290
+ trackScreenMedia(audioMedia, `progress_${Math.round(step * 100, 10)}%`, meta);
291
+ };
292
+ $[48] = audioMedia;
293
+ $[49] = trackScreenMedia;
294
+ $[50] = t36;
295
+ } else {
296
+ t36 = $[50];
297
+ }
298
+ const onProgressStep = t36;
299
+ let t37;
300
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
301
+ t37 = dur => {
302
+ setDuration(dur);
303
+ };
304
+ $[51] = t37;
305
+ } else {
306
+ t37 = $[51];
307
+ }
308
+ const onDurationChange = t37;
309
+ let t38;
310
+ if ($[52] !== audioMedia || $[53] !== trackScreenMedia) {
311
+ t38 = t39 => {
312
+ const {
313
+ initial
314
+ } = t39;
315
+ trackScreenMedia(audioMedia, initial ? "play" : "resume");
316
+ };
317
+ $[52] = audioMedia;
318
+ $[53] = trackScreenMedia;
319
+ $[54] = t38;
320
+ } else {
321
+ t38 = $[54];
322
+ }
323
+ const onPlay = t38;
324
+ let t39;
325
+ if ($[55] !== audioMedia || $[56] !== trackScreenMedia) {
326
+ t39 = t40 => {
327
+ const {
328
+ midway
329
+ } = t40;
330
+ trackScreenMedia(audioMedia, midway ? "pause" : "ended");
331
+ };
332
+ $[55] = audioMedia;
333
+ $[56] = trackScreenMedia;
334
+ $[57] = t39;
335
+ } else {
336
+ t39 = $[57];
337
+ }
338
+ const onPause = t39;
339
+ let t40;
340
+ if ($[58] !== current || $[59] !== setPlaying) {
341
+ t40 = () => {
342
+ if (current) {
343
+ setPlaying(false);
344
+ }
345
+ };
346
+ $[58] = current;
347
+ $[59] = setPlaying;
348
+ $[60] = t40;
349
+ } else {
350
+ t40 = $[60];
351
+ }
352
+ const onEnded = t40;
353
+ let t41;
354
+ if ($[61] !== audioMedia || $[62] !== trackScreenMedia) {
355
+ t41 = time => {
356
+ if (time > 0) {
357
+ trackScreenMedia(audioMedia, "seek");
358
+ }
359
+ };
360
+ $[61] = audioMedia;
361
+ $[62] = trackScreenMedia;
362
+ $[63] = t41;
363
+ } else {
364
+ t41 = $[63];
365
+ }
366
+ const onSeeked = t41;
367
+ let t42;
368
+ if ($[64] !== autoPlay || $[65] !== current || $[66] !== hasAudio || $[67] !== isView || $[68] !== playing || $[69] !== setControlsSuggestPlay || $[70] !== setPlaying) {
369
+ t42 = () => {
370
+ if (isView && playing && current && hasAudio && autoPlay) {
371
+ setPlaying(false);
372
+ setControlsSuggestPlay(true);
373
+ }
374
+ };
375
+ $[64] = autoPlay;
376
+ $[65] = current;
377
+ $[66] = hasAudio;
378
+ $[67] = isView;
379
+ $[68] = playing;
380
+ $[69] = setControlsSuggestPlay;
381
+ $[70] = setPlaying;
382
+ $[71] = t42;
383
+ } else {
384
+ t42 = $[71];
385
+ }
386
+ const onPlayError = t42;
387
+ let t43;
388
+ if ($[72] !== className || $[73] !== isPlaceholder || $[74] !== isPreview) {
389
+ t43 = classNames([styles.container, className, {
390
+ [styles.placeholder]: isPlaceholder,
391
+ [styles.isPreview]: isPreview
392
+ }]);
393
+ $[72] = className;
394
+ $[73] = isPlaceholder;
395
+ $[74] = isPreview;
396
+ $[75] = t43;
397
+ } else {
398
+ t43 = $[75];
399
+ }
400
+ let t44;
401
+ if ($[76] !== hasHeader || $[77] !== isPlaceholder || $[78] !== isPreview || $[79] !== spacing || $[80] !== viewerTopHeight) {
402
+ t44 = !isPlaceholder ? {
403
+ paddingLeft: spacing,
404
+ paddingRight: spacing,
405
+ paddingBottom: spacing,
406
+ paddingTop: (!isPreview ? viewerTopHeight : 0) + (hasHeader ? spacing / 2 : spacing)
407
+ } : null;
408
+ $[76] = hasHeader;
409
+ $[77] = isPlaceholder;
410
+ $[78] = isPreview;
411
+ $[79] = spacing;
412
+ $[80] = viewerTopHeight;
413
+ $[81] = t44;
414
+ } else {
415
+ t44 = $[81];
416
+ }
417
+ let t45;
418
+ if ($[82] !== hasHeader || $[83] !== header) {
419
+ t45 = hasHeader ? /*#__PURE__*/jsx(Header, {
420
+ ...header
421
+ }) : /*#__PURE__*/jsx(Spacer, {}, "spacer-top");
422
+ $[82] = hasHeader;
423
+ $[83] = header;
424
+ $[84] = t45;
425
+ } else {
426
+ t45 = $[84];
427
+ }
428
+ let t46;
429
+ if ($[85] === Symbol.for("react.memo_cache_sentinel")) {
430
+ t46 = /*#__PURE__*/jsx(FormattedMessage, {
431
+ id: "MYZwSA",
432
+ defaultMessage: "Audio"
433
+ });
434
+ $[85] = t46;
435
+ } else {
436
+ t46 = $[85];
437
+ }
438
+ const t47 = !hasAudioUrl;
439
+ let t48;
440
+ if ($[86] !== customMediaRef || $[87] !== mediaRef) {
441
+ t48 = mergeRefs(mediaRef, customMediaRef);
442
+ $[86] = customMediaRef;
443
+ $[87] = mediaRef;
444
+ $[88] = t48;
445
+ } else {
446
+ t48 = $[88];
447
+ }
448
+ const t49 = isIOS || isPreview;
449
+ let t50;
450
+ if ($[89] !== color || $[90] !== isPreview || $[91] !== progressColor) {
451
+ t50 = isPreview ? {
452
+ sampleWidth: 10,
453
+ sampleMargin: 5,
454
+ minSampleHeight: 5,
455
+ backgroundColor: color,
456
+ progressColor
457
+ } : {
458
+ backgroundColor: color,
459
+ progressColor
460
+ };
461
+ $[89] = color;
462
+ $[90] = isPreview;
463
+ $[91] = progressColor;
464
+ $[92] = t50;
465
+ } else {
466
+ t50 = $[92];
467
+ }
468
+ const t51 = showWave && withWave;
469
+ let t52;
470
+ if ($[93] !== finalAudio || $[94] !== muted || $[95] !== onEnded || $[96] !== onPause || $[97] !== onPlay || $[98] !== onPlayError || $[99] !== onProgressStep || $[100] !== onSeeked || $[101] !== paused || $[102] !== t48 || $[103] !== t49 || $[104] !== t50 || $[105] !== t51) {
471
+ t52 = /*#__PURE__*/jsx(Audio, {
472
+ ...finalAudio,
473
+ mediaRef: t48,
474
+ waveFake: t49,
475
+ waveProps: t50,
476
+ paused: paused,
477
+ muted: muted,
478
+ className: styles.audio,
479
+ onReady: onAudioReady,
480
+ onPlay: onPlay,
481
+ onPause: onPause,
482
+ onTimeUpdate: onTimeUpdate,
483
+ onProgressStep: onProgressStep,
484
+ onDurationChange: onDurationChange,
485
+ onSeeked: onSeeked,
486
+ onEnded: onEnded,
487
+ onPlayError: onPlayError,
488
+ withWave: t51
489
+ });
490
+ $[93] = finalAudio;
491
+ $[94] = muted;
492
+ $[95] = onEnded;
493
+ $[96] = onPause;
494
+ $[97] = onPlay;
495
+ $[98] = onPlayError;
496
+ $[99] = onProgressStep;
497
+ $[100] = onSeeked;
498
+ $[101] = paused;
499
+ $[102] = t48;
500
+ $[103] = t49;
501
+ $[104] = t50;
502
+ $[105] = t51;
503
+ $[106] = t52;
504
+ } else {
505
+ t52 = $[106];
506
+ }
507
+ let t53;
508
+ if ($[107] !== t47 || $[108] !== t52) {
509
+ t53 = /*#__PURE__*/jsx(ScreenElement, {
510
+ placeholder: "audio",
511
+ emptyLabel: t46,
512
+ emptyClassName: styles.empty,
513
+ isEmpty: t47,
514
+ children: t52
515
+ }, "audio");
516
+ $[107] = t47;
517
+ $[108] = t52;
518
+ $[109] = t53;
519
+ } else {
520
+ t53 = $[109];
521
+ }
522
+ let t54;
523
+ if ($[110] === Symbol.for("react.memo_cache_sentinel")) {
524
+ t54 = /*#__PURE__*/jsx(Spacer, {}, "spacer-middle");
525
+ $[110] = t54;
526
+ } else {
527
+ t54 = $[110];
528
+ }
529
+ let t55;
530
+ if ($[111] !== captions || $[112] !== closedCaptions || $[113] !== current || $[114] !== currentTime || $[115] !== footerProps || $[116] !== hasClosedCaptions || $[117] !== hasFooter || $[118] !== isCapture || $[119] !== isPlaceholder || $[120] !== isPreview || $[121] !== isStatic || $[122] !== spacing || $[123] !== viewerBottomHeight || $[124] !== viewerBottomSidesWidth) {
531
+ t55 = !isPlaceholder ? /*#__PURE__*/jsxs("div", {
532
+ className: styles.bottom,
533
+ style: {
534
+ transform: current && !isPreview ? `translate(0, -${viewerBottomHeight}px)` : null,
535
+ paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
536
+ paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
537
+ paddingBottom: spacing / 2,
538
+ paddingTop: 0
539
+ },
540
+ children: [hasClosedCaptions && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/jsx(ClosedCaptions, {
541
+ className: styles.closedCaptions,
542
+ media: closedCaptions,
543
+ ...captions,
544
+ currentTime: currentTime
545
+ }) : null, hasFooter ? /*#__PURE__*/jsx(Footer, {
546
+ ...footerProps,
547
+ className: styles.callToAction
548
+ }) : null]
549
+ }, "bottom") : null;
550
+ $[111] = captions;
551
+ $[112] = closedCaptions;
552
+ $[113] = current;
553
+ $[114] = currentTime;
554
+ $[115] = footerProps;
555
+ $[116] = hasClosedCaptions;
556
+ $[117] = hasFooter;
557
+ $[118] = isCapture;
558
+ $[119] = isPlaceholder;
559
+ $[120] = isPreview;
560
+ $[121] = isStatic;
561
+ $[122] = spacing;
562
+ $[123] = viewerBottomHeight;
563
+ $[124] = viewerBottomSidesWidth;
564
+ $[125] = t55;
565
+ } else {
566
+ t55 = $[125];
567
+ }
568
+ let t56;
569
+ if ($[126] !== t44 || $[127] !== t45 || $[128] !== t53 || $[129] !== t55) {
570
+ t56 = /*#__PURE__*/jsxs(Layout, {
571
+ fullscreen: true,
572
+ style: t44,
573
+ children: [t45, t53, t54, t55]
574
+ });
575
+ $[126] = t44;
576
+ $[127] = t45;
577
+ $[128] = t53;
578
+ $[129] = t55;
579
+ $[130] = t56;
580
+ } else {
581
+ t56 = $[130];
582
+ }
583
+ let t57;
584
+ if ($[131] !== height || $[132] !== t56 || $[133] !== width) {
585
+ t57 = /*#__PURE__*/jsx(Container, {
197
586
  width: width,
198
587
  height: height,
199
588
  className: styles.content,
200
- children: /*#__PURE__*/jsxs(Layout, {
201
- fullscreen: true,
202
- style: !isPlaceholder ? {
203
- paddingLeft: spacing,
204
- paddingRight: spacing,
205
- paddingBottom: spacing,
206
- paddingTop: (!isPreview ? viewerTopHeight : 0) + (hasHeader ? spacing / 2 : spacing)
207
- } : null,
208
- children: [hasHeader ? /*#__PURE__*/jsx(Header, _objectSpread({}, header)) : /*#__PURE__*/jsx(Spacer, {}, "spacer-top"), /*#__PURE__*/jsx(ScreenElement, {
209
- placeholder: "audio",
210
- emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
211
- id: "MYZwSA",
212
- defaultMessage: [{
213
- "type": 0,
214
- "value": "Audio"
215
- }]
216
- }),
217
- emptyClassName: styles.empty,
218
- isEmpty: !hasAudioUrl,
219
- children: /*#__PURE__*/jsx(Audio, _objectSpread(_objectSpread({}, finalAudio), {}, {
220
- mediaRef: mergeRefs(mediaRef, customMediaRef),
221
- waveFake: isIOS || isPreview,
222
- waveProps: isPreview ? {
223
- sampleWidth: 10,
224
- sampleMargin: 5,
225
- minSampleHeight: 5,
226
- backgroundColor: color,
227
- progressColor: progressColor
228
- } : {
229
- backgroundColor: color,
230
- progressColor: progressColor
231
- },
232
- paused: paused,
233
- muted: muted,
234
- className: styles.audio,
235
- onReady: onAudioReady,
236
- onPlay: onPlay,
237
- onPause: onPause,
238
- onTimeUpdate: onTimeUpdate,
239
- onProgressStep: onProgressStep,
240
- onDurationChange: onDurationChange,
241
- onSeeked: onSeeked,
242
- onEnded: onEnded,
243
- onPlayError: onPlayError,
244
- withWave: showWave && withWave
245
- }))
246
- }, "audio"), /*#__PURE__*/jsx(Spacer, {}, "spacer-middle"), !isPlaceholder ? /*#__PURE__*/jsxs("div", {
247
- className: styles.bottom,
248
- style: {
249
- transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
250
- paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
251
- paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
252
- paddingBottom: spacing / 2,
253
- paddingTop: 0
254
- },
255
- children: [hasClosedCaptions && !isPreview && !isCapture && !isStatic ? /*#__PURE__*/jsx(ClosedCaptions, _objectSpread(_objectSpread({
256
- className: styles.closedCaptions,
257
- media: closedCaptions
258
- }, captions), {}, {
259
- currentTime: currentTime
260
- })) : null, hasFooter ? /*#__PURE__*/jsx(Footer, _objectSpread(_objectSpread({}, footerProps), {}, {
261
- className: styles.callToAction
262
- })) : null]
263
- }, "bottom") : null]
264
- })
265
- }), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
589
+ children: t56
590
+ });
591
+ $[131] = height;
592
+ $[132] = t56;
593
+ $[133] = width;
594
+ $[134] = t57;
595
+ } else {
596
+ t57 = $[134];
597
+ }
598
+ let t58;
599
+ if ($[135] !== background || $[136] !== backgroundPlaying || $[137] !== height || $[138] !== isPlaceholder || $[139] !== isPreview || $[140] !== mediaShouldLoad || $[141] !== muted || $[142] !== resolution || $[143] !== width) {
600
+ t58 = !isPlaceholder ? /*#__PURE__*/jsx(Background, {
266
601
  background: background,
267
602
  width: width,
268
603
  height: height,
@@ -272,9 +607,38 @@ function AudioScreen(_ref) {
272
607
  shouldLoad: mediaShouldLoad,
273
608
  withoutVideo: isPreview,
274
609
  className: styles.background
275
- }) : null]
276
- });
610
+ }) : null;
611
+ $[135] = background;
612
+ $[136] = backgroundPlaying;
613
+ $[137] = height;
614
+ $[138] = isPlaceholder;
615
+ $[139] = isPreview;
616
+ $[140] = mediaShouldLoad;
617
+ $[141] = muted;
618
+ $[142] = resolution;
619
+ $[143] = width;
620
+ $[144] = t58;
621
+ } else {
622
+ t58 = $[144];
623
+ }
624
+ let t59;
625
+ if ($[145] !== ready || $[146] !== t43 || $[147] !== t57 || $[148] !== t58) {
626
+ t59 = /*#__PURE__*/jsxs("div", {
627
+ className: t43,
628
+ "data-screen-ready": ready,
629
+ children: [t57, t58]
630
+ });
631
+ $[145] = ready;
632
+ $[146] = t43;
633
+ $[147] = t57;
634
+ $[148] = t58;
635
+ $[149] = t59;
636
+ } else {
637
+ t59 = $[149];
638
+ }
639
+ return t59;
277
640
  }
641
+ function _temp() {}
278
642
 
279
643
  // import * as transforms from './transforms/index';
280
644
 
@@ -284,19 +648,13 @@ var definition = {
284
648
  group: {
285
649
  label: defineMessage({
286
650
  id: "+9akmg",
287
- defaultMessage: [{
288
- "type": 0,
289
- "value": "Audio and Video"
290
- }]
651
+ defaultMessage: "Audio and Video"
291
652
  }),
292
653
  order: 5
293
654
  },
294
655
  title: defineMessage({
295
656
  id: "bhEaUt",
296
- defaultMessage: [{
297
- "type": 0,
298
- "value": "Audio"
299
- }]
657
+ defaultMessage: "Audio"
300
658
  }),
301
659
  component: AudioScreen,
302
660
  layouts: ['middle'],
@@ -312,30 +670,21 @@ var definition = {
312
670
  },
313
671
  label: defineMessage({
314
672
  id: "169xnt",
315
- defaultMessage: [{
316
- "type": 0,
317
- "value": "Audio"
318
- }]
673
+ defaultMessage: "Audio"
319
674
  })
320
675
  }, {
321
676
  name: 'background',
322
677
  type: 'background',
323
678
  label: defineMessage({
324
679
  id: "+MPZRu",
325
- defaultMessage: [{
326
- "type": 0,
327
- "value": "Background"
328
- }]
680
+ defaultMessage: "Background"
329
681
  })
330
682
  }, {
331
683
  name: 'header',
332
684
  type: 'header',
333
685
  label: defineMessage({
334
686
  id: "rhuDxI",
335
- defaultMessage: [{
336
- "type": 0,
337
- "value": "Header"
338
- }]
687
+ defaultMessage: "Header"
339
688
  }),
340
689
  theme: {
341
690
  badge: {
@@ -350,10 +699,7 @@ var definition = {
350
699
  type: 'footer',
351
700
  label: defineMessage({
352
701
  id: "g4nybp",
353
- defaultMessage: [{
354
- "type": 0,
355
- "value": "Footer"
356
- }]
702
+ defaultMessage: "Footer"
357
703
  }),
358
704
  theme: {
359
705
  callToAction: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-audio",
3
- "version": "0.4.71",
3
+ "version": "0.4.74",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -36,6 +36,7 @@
36
36
  "exports": {
37
37
  ".": {
38
38
  "types": "./es/index.d.ts",
39
+ "style": "./assets/css/styles.css",
39
40
  "import": "./es/index.js"
40
41
  },
41
42
  "./assets/css/styles": "./assets/css/styles.css",
@@ -52,24 +53,24 @@
52
53
  "build": "../../scripts/prepare-package.sh --types"
53
54
  },
54
55
  "devDependencies": {
55
- "react": "^18.3.0 || ^19.0.0",
56
- "react-dom": "^18.3.0 || ^19.0.0"
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
57
58
  },
58
59
  "peerDependencies": {
59
- "react": "^18.3.0 || ^19.0.0",
60
- "react-dom": "^18.3.0 || ^19.0.0"
60
+ "react": "^19.0.0",
61
+ "react-dom": "^19.0.0"
61
62
  },
62
63
  "dependencies": {
63
64
  "@babel/runtime": "^7.28.6",
64
- "@micromag/core": "^0.4.71",
65
- "@micromag/element-audio": "^0.4.71",
66
- "@micromag/element-background": "^0.4.71",
67
- "@micromag/element-closed-captions": "^0.4.71",
68
- "@micromag/element-container": "^0.4.71",
69
- "@micromag/element-footer": "^0.4.71",
70
- "@micromag/element-header": "^0.4.71",
71
- "@micromag/element-layout": "^0.4.71",
72
- "@micromag/transforms": "^0.4.71",
65
+ "@micromag/core": "^0.4.74",
66
+ "@micromag/element-audio": "^0.4.74",
67
+ "@micromag/element-background": "^0.4.74",
68
+ "@micromag/element-closed-captions": "^0.4.74",
69
+ "@micromag/element-container": "^0.4.74",
70
+ "@micromag/element-footer": "^0.4.74",
71
+ "@micromag/element-header": "^0.4.74",
72
+ "@micromag/element-layout": "^0.4.74",
73
+ "@micromag/transforms": "^0.4.74",
73
74
  "classnames": "^2.2.6",
74
75
  "lodash": "^4.17.23",
75
76
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -79,6 +80,6 @@
79
80
  "access": "public",
80
81
  "registry": "https://registry.npmjs.org/"
81
82
  },
82
- "gitHead": "9101554bc5761e32b4a002a10d26800608c69773",
83
+ "gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
83
84
  "types": "es/index.d.ts"
84
85
  }