@micromag/screen-title 0.3.150 → 0.3.152
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 +26 -26
- package/lib/index.js +25 -25
- package/package.json +10 -10
package/es/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
7
7
|
import { ScreenElement, TransitionsStagger } from '@micromag/core/components';
|
|
8
|
-
import { useScreenSize,
|
|
8
|
+
import { useScreenSize, useScreenRenderContext, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
|
|
9
9
|
import { isTextFilled, getStyleFromBox } from '@micromag/core/utils';
|
|
10
10
|
import Background from '@micromag/element-background';
|
|
11
11
|
import CallToAction from '@micromag/element-call-to-action';
|
|
@@ -38,8 +38,6 @@ var propTypes$2 = {
|
|
|
38
38
|
active: PropTypes.bool,
|
|
39
39
|
transitions: PropTypes$1.transitions,
|
|
40
40
|
transitionStagger: PropTypes.number,
|
|
41
|
-
enableInteraction: PropTypes.func,
|
|
42
|
-
disableInteraction: PropTypes.func,
|
|
43
41
|
className: PropTypes.string
|
|
44
42
|
};
|
|
45
43
|
var defaultProps$2 = {
|
|
@@ -65,8 +63,6 @@ var defaultProps$2 = {
|
|
|
65
63
|
active: true,
|
|
66
64
|
transitions: null,
|
|
67
65
|
transitionStagger: 100,
|
|
68
|
-
enableInteraction: null,
|
|
69
|
-
disableInteraction: null,
|
|
70
66
|
className: null
|
|
71
67
|
};
|
|
72
68
|
|
|
@@ -89,19 +85,13 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
89
85
|
active = _ref.active,
|
|
90
86
|
transitions = _ref.transitions,
|
|
91
87
|
transitionStagger = _ref.transitionStagger,
|
|
92
|
-
enableInteraction = _ref.enableInteraction,
|
|
93
|
-
disableInteraction = _ref.disableInteraction,
|
|
94
88
|
className = _ref.className;
|
|
95
89
|
|
|
96
90
|
var _useScreenSize = useScreenSize(),
|
|
97
91
|
width = _useScreenSize.width,
|
|
98
92
|
height = _useScreenSize.height,
|
|
99
|
-
menuOverScreen = _useScreenSize.menuOverScreen,
|
|
100
93
|
resolution = _useScreenSize.resolution;
|
|
101
94
|
|
|
102
|
-
var _useViewer = useViewer(),
|
|
103
|
-
menuSize = _useViewer.menuSize;
|
|
104
|
-
|
|
105
95
|
var _useScreenRenderConte = useScreenRenderContext(),
|
|
106
96
|
isView = _useScreenRenderConte.isView,
|
|
107
97
|
isPreview = _useScreenRenderConte.isPreview,
|
|
@@ -110,6 +100,18 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
110
100
|
isStatic = _useScreenRenderConte.isStatic,
|
|
111
101
|
isCapture = _useScreenRenderConte.isCapture;
|
|
112
102
|
|
|
103
|
+
var _useViewerContext = useViewerContext(),
|
|
104
|
+
viewerTopHeight = _useViewerContext.topHeight,
|
|
105
|
+
viewerBottomHeight = _useViewerContext.bottomHeight,
|
|
106
|
+
viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
|
|
107
|
+
|
|
108
|
+
var _useViewerWebView = useViewerWebView(),
|
|
109
|
+
openWebView = _useViewerWebView.open;
|
|
110
|
+
|
|
111
|
+
var _usePlaybackContext = usePlaybackContext(),
|
|
112
|
+
muted = _usePlaybackContext.muted;
|
|
113
|
+
|
|
114
|
+
var mediaRef = usePlaybackMediaRef(current);
|
|
113
115
|
var hasTitle = isTextFilled(title);
|
|
114
116
|
var hasSubtitle = isTextFilled(subtitle);
|
|
115
117
|
var hasDescription = isTextFilled(description);
|
|
@@ -175,7 +177,9 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
175
177
|
height: height,
|
|
176
178
|
resolution: resolution,
|
|
177
179
|
playing: backgroundPlaying,
|
|
178
|
-
|
|
180
|
+
muted: muted,
|
|
181
|
+
shouldLoad: backgroundShouldLoad,
|
|
182
|
+
mediaRef: mediaRef
|
|
179
183
|
}) : null, /*#__PURE__*/React.createElement(Container, {
|
|
180
184
|
width: width,
|
|
181
185
|
height: height
|
|
@@ -185,7 +189,8 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
185
189
|
verticalAlign: verticalAlign,
|
|
186
190
|
style: !isPlaceholder ? {
|
|
187
191
|
padding: spacing,
|
|
188
|
-
paddingTop: (
|
|
192
|
+
paddingTop: (!isPreview ? viewerTopHeight : 0) + spacing,
|
|
193
|
+
paddingBottom: (!isPreview ? viewerBottomHeight : 0) + spacing
|
|
189
194
|
} : null
|
|
190
195
|
}, !isPlaceholder && hasCallToAction && isMiddleLayout ? /*#__PURE__*/React.createElement(Spacer, {
|
|
191
196
|
key: "spacer-cta-top"
|
|
@@ -227,22 +232,17 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
227
232
|
}), descriptionElement) : null, !isPlaceholder && hasCallToAction && (isTopLayout || isMiddleLayout) ? /*#__PURE__*/React.createElement(Spacer, {
|
|
228
233
|
key: "spacer-cta-bottom"
|
|
229
234
|
}) : null, !isPlaceholder && hasCallToAction ? /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
key: "call-to-action",
|
|
230
236
|
style: {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}, /*#__PURE__*/React.createElement(CallToAction, {
|
|
236
|
-
callToAction: callToAction,
|
|
237
|
+
paddingTop: spacing,
|
|
238
|
+
paddingLeft: Math.max(0, viewerBottomSidesWidth - spacing),
|
|
239
|
+
paddingRight: Math.max(0, viewerBottomSidesWidth - spacing)
|
|
240
|
+
}
|
|
241
|
+
}, /*#__PURE__*/React.createElement(CallToAction, Object.assign({}, callToAction, {
|
|
237
242
|
animationDisabled: isPreview,
|
|
238
243
|
focusable: current && isView,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
height: height
|
|
242
|
-
},
|
|
243
|
-
enableInteraction: enableInteraction,
|
|
244
|
-
disableInteraction: disableInteraction
|
|
245
|
-
})) : null)));
|
|
244
|
+
openWebView: openWebView
|
|
245
|
+
}))) : null)));
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
TitleScreen.propTypes = propTypes$2;
|
package/lib/index.js
CHANGED
|
@@ -59,8 +59,6 @@ var propTypes$2 = {
|
|
|
59
59
|
active: PropTypes__default["default"].bool,
|
|
60
60
|
transitions: core.PropTypes.transitions,
|
|
61
61
|
transitionStagger: PropTypes__default["default"].number,
|
|
62
|
-
enableInteraction: PropTypes__default["default"].func,
|
|
63
|
-
disableInteraction: PropTypes__default["default"].func,
|
|
64
62
|
className: PropTypes__default["default"].string
|
|
65
63
|
};
|
|
66
64
|
var defaultProps$2 = {
|
|
@@ -86,8 +84,6 @@ var defaultProps$2 = {
|
|
|
86
84
|
active: true,
|
|
87
85
|
transitions: null,
|
|
88
86
|
transitionStagger: 100,
|
|
89
|
-
enableInteraction: null,
|
|
90
|
-
disableInteraction: null,
|
|
91
87
|
className: null
|
|
92
88
|
};
|
|
93
89
|
|
|
@@ -110,19 +106,13 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
110
106
|
active = _ref.active,
|
|
111
107
|
transitions = _ref.transitions,
|
|
112
108
|
transitionStagger = _ref.transitionStagger,
|
|
113
|
-
enableInteraction = _ref.enableInteraction,
|
|
114
|
-
disableInteraction = _ref.disableInteraction,
|
|
115
109
|
className = _ref.className;
|
|
116
110
|
|
|
117
111
|
var _useScreenSize = contexts.useScreenSize(),
|
|
118
112
|
width = _useScreenSize.width,
|
|
119
113
|
height = _useScreenSize.height,
|
|
120
|
-
menuOverScreen = _useScreenSize.menuOverScreen,
|
|
121
114
|
resolution = _useScreenSize.resolution;
|
|
122
115
|
|
|
123
|
-
var _useViewer = contexts.useViewer(),
|
|
124
|
-
menuSize = _useViewer.menuSize;
|
|
125
|
-
|
|
126
116
|
var _useScreenRenderConte = contexts.useScreenRenderContext(),
|
|
127
117
|
isView = _useScreenRenderConte.isView,
|
|
128
118
|
isPreview = _useScreenRenderConte.isPreview,
|
|
@@ -131,6 +121,18 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
131
121
|
isStatic = _useScreenRenderConte.isStatic,
|
|
132
122
|
isCapture = _useScreenRenderConte.isCapture;
|
|
133
123
|
|
|
124
|
+
var _useViewerContext = contexts.useViewerContext(),
|
|
125
|
+
viewerTopHeight = _useViewerContext.topHeight,
|
|
126
|
+
viewerBottomHeight = _useViewerContext.bottomHeight,
|
|
127
|
+
viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
|
|
128
|
+
|
|
129
|
+
var _useViewerWebView = contexts.useViewerWebView(),
|
|
130
|
+
openWebView = _useViewerWebView.open;
|
|
131
|
+
|
|
132
|
+
var _usePlaybackContext = contexts.usePlaybackContext(),
|
|
133
|
+
muted = _usePlaybackContext.muted;
|
|
134
|
+
|
|
135
|
+
var mediaRef = contexts.usePlaybackMediaRef(current);
|
|
134
136
|
var hasTitle = utils.isTextFilled(title);
|
|
135
137
|
var hasSubtitle = utils.isTextFilled(subtitle);
|
|
136
138
|
var hasDescription = utils.isTextFilled(description);
|
|
@@ -196,7 +198,9 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
196
198
|
height: height,
|
|
197
199
|
resolution: resolution,
|
|
198
200
|
playing: backgroundPlaying,
|
|
199
|
-
|
|
201
|
+
muted: muted,
|
|
202
|
+
shouldLoad: backgroundShouldLoad,
|
|
203
|
+
mediaRef: mediaRef
|
|
200
204
|
}) : null, /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
|
|
201
205
|
width: width,
|
|
202
206
|
height: height
|
|
@@ -206,7 +210,8 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
206
210
|
verticalAlign: verticalAlign,
|
|
207
211
|
style: !isPlaceholder ? {
|
|
208
212
|
padding: spacing,
|
|
209
|
-
paddingTop: (
|
|
213
|
+
paddingTop: (!isPreview ? viewerTopHeight : 0) + spacing,
|
|
214
|
+
paddingBottom: (!isPreview ? viewerBottomHeight : 0) + spacing
|
|
210
215
|
} : null
|
|
211
216
|
}, !isPlaceholder && hasCallToAction && isMiddleLayout ? /*#__PURE__*/React__default["default"].createElement(Layout.Spacer, {
|
|
212
217
|
key: "spacer-cta-top"
|
|
@@ -248,22 +253,17 @@ var TitleScreen = function TitleScreen(_ref) {
|
|
|
248
253
|
}), descriptionElement) : null, !isPlaceholder && hasCallToAction && (isTopLayout || isMiddleLayout) ? /*#__PURE__*/React__default["default"].createElement(Layout.Spacer, {
|
|
249
254
|
key: "spacer-cta-bottom"
|
|
250
255
|
}) : null, !isPlaceholder && hasCallToAction ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
256
|
+
key: "call-to-action",
|
|
251
257
|
style: {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}, /*#__PURE__*/React__default["default"].createElement(CallToAction__default["default"], {
|
|
257
|
-
callToAction: callToAction,
|
|
258
|
+
paddingTop: spacing,
|
|
259
|
+
paddingLeft: Math.max(0, viewerBottomSidesWidth - spacing),
|
|
260
|
+
paddingRight: Math.max(0, viewerBottomSidesWidth - spacing)
|
|
261
|
+
}
|
|
262
|
+
}, /*#__PURE__*/React__default["default"].createElement(CallToAction__default["default"], Object.assign({}, callToAction, {
|
|
258
263
|
animationDisabled: isPreview,
|
|
259
264
|
focusable: current && isView,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
height: height
|
|
263
|
-
},
|
|
264
|
-
enableInteraction: enableInteraction,
|
|
265
|
-
disableInteraction: disableInteraction
|
|
266
|
-
})) : null)));
|
|
265
|
+
openWebView: openWebView
|
|
266
|
+
}))) : null)));
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
TitleScreen.propTypes = propTypes$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-title",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.152",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.13.10",
|
|
52
|
-
"@micromag/core": "^0.3.
|
|
53
|
-
"@micromag/element-background": "^0.3.
|
|
54
|
-
"@micromag/element-call-to-action": "^0.3.
|
|
55
|
-
"@micromag/element-container": "^0.3.
|
|
56
|
-
"@micromag/element-heading": "^0.3.
|
|
57
|
-
"@micromag/element-layout": "^0.3.
|
|
58
|
-
"@micromag/element-text": "^0.3.
|
|
59
|
-
"@micromag/transforms": "^0.3.
|
|
52
|
+
"@micromag/core": "^0.3.152",
|
|
53
|
+
"@micromag/element-background": "^0.3.152",
|
|
54
|
+
"@micromag/element-call-to-action": "^0.3.152",
|
|
55
|
+
"@micromag/element-container": "^0.3.152",
|
|
56
|
+
"@micromag/element-heading": "^0.3.152",
|
|
57
|
+
"@micromag/element-layout": "^0.3.152",
|
|
58
|
+
"@micromag/element-text": "^0.3.152",
|
|
59
|
+
"@micromag/transforms": "^0.3.152",
|
|
60
60
|
"classnames": "^2.2.6",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
62
62
|
"prop-types": "^15.7.2",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "23db6c104c10cc70a73366c8b04576a312a36206"
|
|
70
70
|
}
|