@micromag/screen-urbania-article 0.3.148 → 0.3.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +37 -31
- package/lib/index.js +35 -29
- package/package.json +15 -15
package/es/index.js
CHANGED
|
@@ -10,8 +10,8 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
12
12
|
import { ScreenElement, PlaceholderSubtitle, Empty, PlaceholderTitle, Transitions, PlaceholderImage } from '@micromag/core/components';
|
|
13
|
-
import { useScreenSize, useScreenRenderContext } from '@micromag/core/contexts';
|
|
14
|
-
import {
|
|
13
|
+
import { useScreenSize, useScreenRenderContext, useViewerWebView, useViewerContext, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
|
|
14
|
+
import { useDimensionObserver } from '@micromag/core/hooks';
|
|
15
15
|
import Background from '@micromag/element-background';
|
|
16
16
|
import CallToAction from '@micromag/element-call-to-action';
|
|
17
17
|
import Container from '@micromag/element-container';
|
|
@@ -116,8 +116,6 @@ var propTypes$1 = {
|
|
|
116
116
|
active: PropTypes.bool,
|
|
117
117
|
transitions: PropTypes$1.transitions,
|
|
118
118
|
spacing: PropTypes.number,
|
|
119
|
-
enableInteraction: PropTypes.func,
|
|
120
|
-
disableInteraction: PropTypes.func,
|
|
121
119
|
className: PropTypes.string
|
|
122
120
|
};
|
|
123
121
|
var defaultProps$1 = {
|
|
@@ -138,8 +136,6 @@ var defaultProps$1 = {
|
|
|
138
136
|
active: true,
|
|
139
137
|
transitions: null,
|
|
140
138
|
spacing: 20,
|
|
141
|
-
enableInteraction: null,
|
|
142
|
-
disableInteraction: null,
|
|
143
139
|
className: null
|
|
144
140
|
};
|
|
145
141
|
|
|
@@ -163,8 +159,6 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
163
159
|
active = _ref.active,
|
|
164
160
|
transitions = _ref.transitions,
|
|
165
161
|
spacing = _ref.spacing,
|
|
166
|
-
enableInteraction = _ref.enableInteraction,
|
|
167
|
-
disableInteraction = _ref.disableInteraction,
|
|
168
162
|
className = _ref.className;
|
|
169
163
|
|
|
170
164
|
var _useScreenSize = useScreenSize(),
|
|
@@ -172,16 +166,35 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
172
166
|
height = _useScreenSize.height,
|
|
173
167
|
resolution = _useScreenSize.resolution;
|
|
174
168
|
|
|
169
|
+
var _useScreenRenderConte = useScreenRenderContext(),
|
|
170
|
+
isView = _useScreenRenderConte.isView,
|
|
171
|
+
isPreview = _useScreenRenderConte.isPreview,
|
|
172
|
+
isPlaceholder = _useScreenRenderConte.isPlaceholder,
|
|
173
|
+
isEdit = _useScreenRenderConte.isEdit,
|
|
174
|
+
isStatic = _useScreenRenderConte.isStatic,
|
|
175
|
+
isCapture = _useScreenRenderConte.isCapture;
|
|
176
|
+
|
|
175
177
|
var _ref2 = background || {},
|
|
176
178
|
_ref2$color = _ref2.color,
|
|
177
179
|
backgroundColor = _ref2$color === void 0 ? null : _ref2$color;
|
|
178
180
|
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
var _useViewerWebView = useViewerWebView(),
|
|
182
|
+
openWebView = _useViewerWebView.open;
|
|
183
|
+
|
|
184
|
+
var _useViewerContext = useViewerContext(),
|
|
185
|
+
viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
|
|
186
|
+
|
|
187
|
+
var _usePlaybackContext = usePlaybackContext(),
|
|
188
|
+
muted = _usePlaybackContext.muted;
|
|
189
|
+
|
|
190
|
+
var mediaRef = usePlaybackMediaRef(current);
|
|
191
|
+
|
|
192
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
193
|
+
contentRef = _useDimensionObserver.ref,
|
|
194
|
+
contentRect = _useDimensionObserver.entry.contentRect,
|
|
195
|
+
contentHeight = _useDimensionObserver.height;
|
|
182
196
|
|
|
183
197
|
var _ref3 = contentRect || {},
|
|
184
|
-
contentHeight = _ref3.height,
|
|
185
198
|
contentTop = _ref3.top;
|
|
186
199
|
|
|
187
200
|
var _useMemo = useMemo(function () {
|
|
@@ -204,14 +217,6 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
204
217
|
_useMemo$imageHeight = _useMemo.imageHeight,
|
|
205
218
|
imageHeight = _useMemo$imageHeight === void 0 ? null : _useMemo$imageHeight;
|
|
206
219
|
|
|
207
|
-
var _useScreenRenderConte = useScreenRenderContext(),
|
|
208
|
-
isView = _useScreenRenderConte.isView,
|
|
209
|
-
isPreview = _useScreenRenderConte.isPreview,
|
|
210
|
-
isPlaceholder = _useScreenRenderConte.isPlaceholder,
|
|
211
|
-
isEdit = _useScreenRenderConte.isEdit,
|
|
212
|
-
isStatic = _useScreenRenderConte.isStatic,
|
|
213
|
-
isCapture = _useScreenRenderConte.isCapture;
|
|
214
|
-
|
|
215
220
|
var isVideo = type === 'video';
|
|
216
221
|
var hasOverTitle = isTextFilled(overTitle);
|
|
217
222
|
var hasTitle = isTextFilled(title);
|
|
@@ -342,7 +347,9 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
342
347
|
height: height,
|
|
343
348
|
resolution: resolution,
|
|
344
349
|
playing: backgroundPlaying,
|
|
345
|
-
|
|
350
|
+
muted: muted,
|
|
351
|
+
shouldLoad: mediaShouldLoad,
|
|
352
|
+
mediaRef: mediaRef
|
|
346
353
|
}), /*#__PURE__*/React.createElement(Container, {
|
|
347
354
|
className: styles.inner,
|
|
348
355
|
width: width,
|
|
@@ -400,26 +407,25 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
400
407
|
shouldLoad: mediaShouldLoad,
|
|
401
408
|
playing: backgroundPlaying
|
|
402
409
|
}) : null), !isPlaceholder && hasCallToAction ? /*#__PURE__*/React.createElement("div", {
|
|
410
|
+
style: {
|
|
411
|
+
paddingTop: spacing,
|
|
412
|
+
paddingLeft: Math.max(0, viewerBottomSidesWidth - spacing),
|
|
413
|
+
paddingRight: Math.max(0, viewerBottomSidesWidth - spacing)
|
|
414
|
+
},
|
|
403
415
|
key: "call-to-action"
|
|
404
|
-
}, /*#__PURE__*/React.createElement(CallToAction, {
|
|
416
|
+
}, /*#__PURE__*/React.createElement(CallToAction, Object.assign({}, callToAction, {
|
|
405
417
|
className: styles.callToAction,
|
|
406
418
|
buttonClassName: styles.button,
|
|
407
419
|
labelClassName: styles.label,
|
|
408
420
|
arrowClassName: styles.arrow,
|
|
409
|
-
callToAction: callToAction,
|
|
410
421
|
animationDisabled: isPreview,
|
|
411
422
|
focusable: current && isView,
|
|
412
|
-
screenSize: {
|
|
413
|
-
width: width,
|
|
414
|
-
height: height
|
|
415
|
-
},
|
|
416
423
|
arrow: /*#__PURE__*/React.createElement(Arrow, null),
|
|
417
|
-
enableInteraction: enableInteraction,
|
|
418
|
-
disableInteraction: disableInteraction,
|
|
419
424
|
icon: type === 'video' ? /*#__PURE__*/React.createElement(WatchIcon, {
|
|
420
425
|
className: styles.icon
|
|
421
|
-
}) : null
|
|
422
|
-
|
|
426
|
+
}) : null,
|
|
427
|
+
openWebView: openWebView
|
|
428
|
+
}))) : null))));
|
|
423
429
|
};
|
|
424
430
|
|
|
425
431
|
UrbaniaArticle.propTypes = propTypes$1;
|
package/lib/index.js
CHANGED
|
@@ -137,8 +137,6 @@ var propTypes$1 = {
|
|
|
137
137
|
active: PropTypes__default["default"].bool,
|
|
138
138
|
transitions: core.PropTypes.transitions,
|
|
139
139
|
spacing: PropTypes__default["default"].number,
|
|
140
|
-
enableInteraction: PropTypes__default["default"].func,
|
|
141
|
-
disableInteraction: PropTypes__default["default"].func,
|
|
142
140
|
className: PropTypes__default["default"].string
|
|
143
141
|
};
|
|
144
142
|
var defaultProps$1 = {
|
|
@@ -159,8 +157,6 @@ var defaultProps$1 = {
|
|
|
159
157
|
active: true,
|
|
160
158
|
transitions: null,
|
|
161
159
|
spacing: 20,
|
|
162
|
-
enableInteraction: null,
|
|
163
|
-
disableInteraction: null,
|
|
164
160
|
className: null
|
|
165
161
|
};
|
|
166
162
|
|
|
@@ -184,8 +180,6 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
184
180
|
active = _ref.active,
|
|
185
181
|
transitions = _ref.transitions,
|
|
186
182
|
spacing = _ref.spacing,
|
|
187
|
-
enableInteraction = _ref.enableInteraction,
|
|
188
|
-
disableInteraction = _ref.disableInteraction,
|
|
189
183
|
className = _ref.className;
|
|
190
184
|
|
|
191
185
|
var _useScreenSize = contexts.useScreenSize(),
|
|
@@ -193,16 +187,35 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
193
187
|
height = _useScreenSize.height,
|
|
194
188
|
resolution = _useScreenSize.resolution;
|
|
195
189
|
|
|
190
|
+
var _useScreenRenderConte = contexts.useScreenRenderContext(),
|
|
191
|
+
isView = _useScreenRenderConte.isView,
|
|
192
|
+
isPreview = _useScreenRenderConte.isPreview,
|
|
193
|
+
isPlaceholder = _useScreenRenderConte.isPlaceholder,
|
|
194
|
+
isEdit = _useScreenRenderConte.isEdit,
|
|
195
|
+
isStatic = _useScreenRenderConte.isStatic,
|
|
196
|
+
isCapture = _useScreenRenderConte.isCapture;
|
|
197
|
+
|
|
196
198
|
var _ref2 = background || {},
|
|
197
199
|
_ref2$color = _ref2.color,
|
|
198
200
|
backgroundColor = _ref2$color === void 0 ? null : _ref2$color;
|
|
199
201
|
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
var _useViewerWebView = contexts.useViewerWebView(),
|
|
203
|
+
openWebView = _useViewerWebView.open;
|
|
204
|
+
|
|
205
|
+
var _useViewerContext = contexts.useViewerContext(),
|
|
206
|
+
viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
|
|
207
|
+
|
|
208
|
+
var _usePlaybackContext = contexts.usePlaybackContext(),
|
|
209
|
+
muted = _usePlaybackContext.muted;
|
|
210
|
+
|
|
211
|
+
var mediaRef = contexts.usePlaybackMediaRef(current);
|
|
212
|
+
|
|
213
|
+
var _useDimensionObserver = hooks.useDimensionObserver(),
|
|
214
|
+
contentRef = _useDimensionObserver.ref,
|
|
215
|
+
contentRect = _useDimensionObserver.entry.contentRect,
|
|
216
|
+
contentHeight = _useDimensionObserver.height;
|
|
203
217
|
|
|
204
218
|
var _ref3 = contentRect || {},
|
|
205
|
-
contentHeight = _ref3.height,
|
|
206
219
|
contentTop = _ref3.top;
|
|
207
220
|
|
|
208
221
|
var _useMemo = React.useMemo(function () {
|
|
@@ -225,14 +238,6 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
225
238
|
_useMemo$imageHeight = _useMemo.imageHeight,
|
|
226
239
|
imageHeight = _useMemo$imageHeight === void 0 ? null : _useMemo$imageHeight;
|
|
227
240
|
|
|
228
|
-
var _useScreenRenderConte = contexts.useScreenRenderContext(),
|
|
229
|
-
isView = _useScreenRenderConte.isView,
|
|
230
|
-
isPreview = _useScreenRenderConte.isPreview,
|
|
231
|
-
isPlaceholder = _useScreenRenderConte.isPlaceholder,
|
|
232
|
-
isEdit = _useScreenRenderConte.isEdit,
|
|
233
|
-
isStatic = _useScreenRenderConte.isStatic,
|
|
234
|
-
isCapture = _useScreenRenderConte.isCapture;
|
|
235
|
-
|
|
236
241
|
var isVideo = type === 'video';
|
|
237
242
|
var hasOverTitle = utils.isTextFilled(overTitle);
|
|
238
243
|
var hasTitle = utils.isTextFilled(title);
|
|
@@ -363,7 +368,9 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
363
368
|
height: height,
|
|
364
369
|
resolution: resolution,
|
|
365
370
|
playing: backgroundPlaying,
|
|
366
|
-
|
|
371
|
+
muted: muted,
|
|
372
|
+
shouldLoad: mediaShouldLoad,
|
|
373
|
+
mediaRef: mediaRef
|
|
367
374
|
}), /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
|
|
368
375
|
className: styles.inner,
|
|
369
376
|
width: width,
|
|
@@ -421,26 +428,25 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
|
|
|
421
428
|
shouldLoad: mediaShouldLoad,
|
|
422
429
|
playing: backgroundPlaying
|
|
423
430
|
}) : null), !isPlaceholder && hasCallToAction ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
431
|
+
style: {
|
|
432
|
+
paddingTop: spacing,
|
|
433
|
+
paddingLeft: Math.max(0, viewerBottomSidesWidth - spacing),
|
|
434
|
+
paddingRight: Math.max(0, viewerBottomSidesWidth - spacing)
|
|
435
|
+
},
|
|
424
436
|
key: "call-to-action"
|
|
425
|
-
}, /*#__PURE__*/React__default["default"].createElement(CallToAction__default["default"], {
|
|
437
|
+
}, /*#__PURE__*/React__default["default"].createElement(CallToAction__default["default"], Object.assign({}, callToAction, {
|
|
426
438
|
className: styles.callToAction,
|
|
427
439
|
buttonClassName: styles.button,
|
|
428
440
|
labelClassName: styles.label,
|
|
429
441
|
arrowClassName: styles.arrow,
|
|
430
|
-
callToAction: callToAction,
|
|
431
442
|
animationDisabled: isPreview,
|
|
432
443
|
focusable: current && isView,
|
|
433
|
-
screenSize: {
|
|
434
|
-
width: width,
|
|
435
|
-
height: height
|
|
436
|
-
},
|
|
437
444
|
arrow: /*#__PURE__*/React__default["default"].createElement(Arrow, null),
|
|
438
|
-
enableInteraction: enableInteraction,
|
|
439
|
-
disableInteraction: disableInteraction,
|
|
440
445
|
icon: type === 'video' ? /*#__PURE__*/React__default["default"].createElement(WatchIcon, {
|
|
441
446
|
className: styles.icon
|
|
442
|
-
}) : null
|
|
443
|
-
|
|
447
|
+
}) : null,
|
|
448
|
+
openWebView: openWebView
|
|
449
|
+
}))) : null))));
|
|
444
450
|
};
|
|
445
451
|
|
|
446
452
|
UrbaniaArticle.propTypes = propTypes$1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-urbania-article",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.153",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
"@babel/runtime": "^7.13.10",
|
|
52
52
|
"@folklore/fetch": "^0.1.15",
|
|
53
53
|
"@folklore/size": "^0.1.20",
|
|
54
|
-
"@micromag/core": "^0.3.
|
|
55
|
-
"@micromag/element-background": "^0.3.
|
|
56
|
-
"@micromag/element-call-to-action": "^0.3.
|
|
57
|
-
"@micromag/element-closed-captions": "^0.3.
|
|
58
|
-
"@micromag/element-container": "^0.3.
|
|
59
|
-
"@micromag/element-heading": "^0.3.
|
|
60
|
-
"@micromag/element-image": "^0.3.
|
|
61
|
-
"@micromag/element-media-controls": "^0.3.
|
|
62
|
-
"@micromag/element-text": "^0.3.
|
|
63
|
-
"@micromag/element-urbania-author": "^0.3.
|
|
64
|
-
"@micromag/element-video": "^0.3.
|
|
65
|
-
"@micromag/element-visual": "^0.3.
|
|
66
|
-
"@micromag/transforms": "^0.3.
|
|
54
|
+
"@micromag/core": "^0.3.153",
|
|
55
|
+
"@micromag/element-background": "^0.3.153",
|
|
56
|
+
"@micromag/element-call-to-action": "^0.3.153",
|
|
57
|
+
"@micromag/element-closed-captions": "^0.3.153",
|
|
58
|
+
"@micromag/element-container": "^0.3.153",
|
|
59
|
+
"@micromag/element-heading": "^0.3.153",
|
|
60
|
+
"@micromag/element-image": "^0.3.153",
|
|
61
|
+
"@micromag/element-media-controls": "^0.3.153",
|
|
62
|
+
"@micromag/element-text": "^0.3.153",
|
|
63
|
+
"@micromag/element-urbania-author": "^0.3.153",
|
|
64
|
+
"@micromag/element-video": "^0.3.153",
|
|
65
|
+
"@micromag/element-visual": "^0.3.153",
|
|
66
|
+
"@micromag/transforms": "^0.3.153",
|
|
67
67
|
"classnames": "^2.2.6",
|
|
68
68
|
"lodash": "^4.17.21",
|
|
69
69
|
"prop-types": "^15.7.2",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "3832de24bc306639b162f9778b3250ce1d05b2aa"
|
|
77
77
|
}
|