@micromag/screen-image-360 0.4.48 → 0.4.50

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 (2) hide show
  1. package/es/index.js +104 -93
  2. package/package.json +11 -11
package/es/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { FormattedMessage, defineMessage } from 'react-intl';
2
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
5
  import { getSizeWithinBounds } from '@folklore/size';
5
6
  import classNames from 'classnames';
6
- import React, { useState, useEffect, useRef, useCallback } from 'react';
7
+ import { useState, useEffect, useRef, useCallback } from 'react';
7
8
  import { ScreenElement, PlaceholderVideo360 } from '@micromag/core/components';
8
9
  import { useScreenRenderContext, useScreenSize, useViewerNavigation, useViewerWebView, useViewerContext, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
9
10
  import { useTrackScreenEvent, useDevicePixelRatio, useAnimationFrame } from '@micromag/core/hooks';
@@ -13,6 +14,7 @@ import Container from '@micromag/element-container';
13
14
  import Footer from '@micromag/element-footer';
14
15
  import Header from '@micromag/element-header';
15
16
  import Image from '@micromag/element-image';
17
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
16
18
 
17
19
  /**
18
20
  * Locale loader
@@ -347,99 +349,108 @@ function Image360Screen(_ref) {
347
349
  }
348
350
  pointerDown.current = false;
349
351
  }, [gotoPreviousScreen, gotoNextScreen, landscape]);
350
- return /*#__PURE__*/React.createElement("div", {
352
+ return /*#__PURE__*/jsxs("div", {
351
353
  className: classNames([styles.container, className, _defineProperty({}, styles.showVideo, isPreview || isStatic || isCapture)]),
352
- "data-screen-ready": (isStatic || isCapture) && posterReady || ready
353
- }, /*#__PURE__*/React.createElement(Container, {
354
- width: width,
355
- height: height,
356
- className: styles.content
357
- }, /*#__PURE__*/React.createElement("div", {
358
- ref: canvasContainerRef,
359
- className: styles.videoContainer,
360
- style: {
361
- width: resizedImageWidth,
362
- height: resizedImageHeight,
363
- left: resizedImageLeft,
364
- top: resizedImageTop
365
- }
366
- }), /*#__PURE__*/React.createElement("div", {
367
- className: styles.inner
368
- }, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
369
- className: styles.header,
370
- style: {
371
- paddingTop: spacing / 2,
372
- paddingLeft: spacing,
373
- paddingRight: spacing
374
- }
375
- }, /*#__PURE__*/React.createElement(Header, header)) : null, /*#__PURE__*/React.createElement(ScreenElement, {
376
- placeholder: /*#__PURE__*/React.createElement(PlaceholderVideo360, {
377
- className: styles.placeholder,
378
- width: "100%",
379
- height: "100%"
380
- }),
381
- emptyClassName: styles.empty,
382
- emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
383
- id: "/YQ+xP",
384
- defaultMessage: [{
385
- "type": 0,
386
- "value": "Image 360"
387
- }]
388
- }),
389
- isEmpty: !withSphere
390
- }, withSphere ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("canvas", {
391
- ref: canvasRef,
392
- className: styles.canvas
393
- }), /*#__PURE__*/React.createElement("button", {
394
- className: styles.canvasButton,
395
- type: "button",
396
- "aria-label": "canvas-interaction",
397
- onPointerDown: onPointerDown,
398
- onPointerMove: onPointerMove,
399
- onPointerUp: onPointerUp,
400
- tabIndex: current && isView ? null : '-1'
401
- })) : /*#__PURE__*/React.createElement("div", {
402
- className: styles.videoContainer,
403
- style: {
404
- width: resizedImageWidth,
405
- height: resizedImageHeight,
406
- left: resizedImageLeft,
407
- top: resizedImageTop
408
- }
409
- }, /*#__PURE__*/React.createElement(Image, {
410
- className: styles.video,
411
- media: {
412
- url: thumbnailUrl,
413
- metadata: {
414
- width: imageWidth,
415
- height: imageHeight
416
- }
417
- },
418
- width: resizedImageWidth,
419
- height: resizedImageHeight,
420
- resolution: resolution,
421
- shouldLoad: mediaShouldLoad
422
- }))), !isPlaceholder && hasFooter ? /*#__PURE__*/React.createElement("div", {
423
- className: styles.footer,
424
- style: {
425
- transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
426
- paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
427
- paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
428
- paddingBottom: spacing / 2,
429
- paddingTop: 0
430
- }
431
- }, /*#__PURE__*/React.createElement(Footer, footerProps)) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
432
- background: background,
433
- width: width,
434
- height: height,
435
- resolution: resolution,
436
- playing: backgroundPlaying,
437
- muted: muted,
438
- shouldLoad: mediaShouldLoad,
439
- mediaRef: mediaRef,
440
- withoutVideo: isPreview,
441
- className: styles.background
442
- }) : null);
354
+ "data-screen-ready": (isStatic || isCapture) && posterReady || ready,
355
+ children: [/*#__PURE__*/jsxs(Container, {
356
+ width: width,
357
+ height: height,
358
+ className: styles.content,
359
+ children: [/*#__PURE__*/jsx("div", {
360
+ ref: canvasContainerRef,
361
+ className: styles.videoContainer,
362
+ style: {
363
+ width: resizedImageWidth,
364
+ height: resizedImageHeight,
365
+ left: resizedImageLeft,
366
+ top: resizedImageTop
367
+ }
368
+ }), /*#__PURE__*/jsxs("div", {
369
+ className: styles.inner,
370
+ children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
371
+ className: styles.header,
372
+ style: {
373
+ paddingTop: spacing / 2,
374
+ paddingLeft: spacing,
375
+ paddingRight: spacing
376
+ },
377
+ children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
378
+ }) : null, /*#__PURE__*/jsx(ScreenElement, {
379
+ placeholder: /*#__PURE__*/jsx(PlaceholderVideo360, {
380
+ className: styles.placeholder,
381
+ width: "100%",
382
+ height: "100%"
383
+ }),
384
+ emptyClassName: styles.empty,
385
+ emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
386
+ id: "/YQ+xP",
387
+ defaultMessage: [{
388
+ "type": 0,
389
+ "value": "Image 360"
390
+ }]
391
+ }),
392
+ isEmpty: !withSphere,
393
+ children: withSphere ? /*#__PURE__*/jsxs(Fragment, {
394
+ children: [/*#__PURE__*/jsx("canvas", {
395
+ ref: canvasRef,
396
+ className: styles.canvas
397
+ }), /*#__PURE__*/jsx("button", {
398
+ className: styles.canvasButton,
399
+ type: "button",
400
+ "aria-label": "canvas-interaction",
401
+ onPointerDown: onPointerDown,
402
+ onPointerMove: onPointerMove,
403
+ onPointerUp: onPointerUp,
404
+ tabIndex: current && isView ? null : '-1'
405
+ })]
406
+ }) : /*#__PURE__*/jsx("div", {
407
+ className: styles.videoContainer,
408
+ style: {
409
+ width: resizedImageWidth,
410
+ height: resizedImageHeight,
411
+ left: resizedImageLeft,
412
+ top: resizedImageTop
413
+ },
414
+ children: /*#__PURE__*/jsx(Image, {
415
+ className: styles.video,
416
+ media: {
417
+ url: thumbnailUrl,
418
+ metadata: {
419
+ width: imageWidth,
420
+ height: imageHeight
421
+ }
422
+ },
423
+ width: resizedImageWidth,
424
+ height: resizedImageHeight,
425
+ resolution: resolution,
426
+ shouldLoad: mediaShouldLoad
427
+ })
428
+ })
429
+ }), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
430
+ className: styles.footer,
431
+ style: {
432
+ transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
433
+ paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
434
+ paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
435
+ paddingBottom: spacing / 2,
436
+ paddingTop: 0
437
+ },
438
+ children: /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps))
439
+ }) : null]
440
+ })]
441
+ }), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
442
+ background: background,
443
+ width: width,
444
+ height: height,
445
+ resolution: resolution,
446
+ playing: backgroundPlaying,
447
+ muted: muted,
448
+ shouldLoad: mediaShouldLoad,
449
+ mediaRef: mediaRef,
450
+ withoutVideo: isPreview,
451
+ className: styles.background
452
+ }) : null]
453
+ });
443
454
  }
444
455
 
445
456
  // import * as transforms from './transforms/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-image-360",
3
- "version": "0.4.48",
3
+ "version": "0.4.50",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -62,15 +62,15 @@
62
62
  "dependencies": {
63
63
  "@babel/runtime": "^7.28.6",
64
64
  "@folklore/size": "^0.1.20",
65
- "@micromag/core": "^0.4.48",
66
- "@micromag/element-background": "^0.4.48",
67
- "@micromag/element-closed-captions": "^0.4.48",
68
- "@micromag/element-container": "^0.4.48",
69
- "@micromag/element-footer": "^0.4.48",
70
- "@micromag/element-header": "^0.4.48",
71
- "@micromag/element-image": "^0.4.48",
72
- "@micromag/element-video": "^0.4.48",
73
- "@micromag/transforms": "^0.4.48",
65
+ "@micromag/core": "^0.4.50",
66
+ "@micromag/element-background": "^0.4.50",
67
+ "@micromag/element-closed-captions": "^0.4.50",
68
+ "@micromag/element-container": "^0.4.50",
69
+ "@micromag/element-footer": "^0.4.50",
70
+ "@micromag/element-header": "^0.4.50",
71
+ "@micromag/element-image": "^0.4.50",
72
+ "@micromag/element-video": "^0.4.50",
73
+ "@micromag/transforms": "^0.4.50",
74
74
  "classnames": "^2.2.6",
75
75
  "lodash": "^4.17.23",
76
76
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -81,6 +81,6 @@
81
81
  "access": "public",
82
82
  "registry": "https://registry.npmjs.org/"
83
83
  },
84
- "gitHead": "d6772865be1ee3f2d19288ebfbf4b9b6860f4cd7",
84
+ "gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
85
85
  "types": "es/index.d.ts"
86
86
  }