@micromag/screen-slideshow 0.4.49 → 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.
- package/es/index.js +127 -114
- package/package.json +11 -11
package/es/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FormattedMessage, defineMessage } from 'react-intl';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
|
-
import
|
|
6
|
+
import { useState, useCallback, useRef } from 'react';
|
|
6
7
|
import { Transitions, ScreenElement } from '@micromag/core/components';
|
|
7
8
|
import { useScreenSize, useViewerContext, useViewerInteraction, useScreenRenderContext, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
|
|
8
9
|
import { useDimensionObserver } from '@micromag/core/hooks';
|
|
@@ -13,6 +14,7 @@ import Footer from '@micromag/element-footer';
|
|
|
13
14
|
import Header from '@micromag/element-header';
|
|
14
15
|
import Text from '@micromag/element-text';
|
|
15
16
|
import Visual from '@micromag/element-visual';
|
|
17
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
16
18
|
|
|
17
19
|
var styles = {"container":"micromag-screen-slideshow-container","background":"micromag-screen-slideshow-background","content":"micromag-screen-slideshow-content","inner":"micromag-screen-slideshow-inner","placeholder":"micromag-screen-slideshow-placeholder","caption":"micromag-screen-slideshow-caption","header":"micromag-screen-slideshow-header","footer":"micromag-screen-slideshow-footer"};
|
|
18
20
|
|
|
@@ -111,123 +113,134 @@ function SlideshowScreen(_ref) {
|
|
|
111
113
|
var hasImage = media !== null;
|
|
112
114
|
var hasCaption = isTextFilled(caption);
|
|
113
115
|
var finalTransitionDelay = itemI > 0 ? itemI * (transitionDelay * 1000) : 0;
|
|
114
|
-
return /*#__PURE__*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
116
|
+
return /*#__PURE__*/jsxs("div", {
|
|
117
|
+
className: styles.gridItem,
|
|
118
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
119
|
+
className: styles.imageContainer,
|
|
120
|
+
ref: function ref(el) {
|
|
121
|
+
imagesEl.current[itemI] = el;
|
|
122
|
+
},
|
|
123
|
+
children: /*#__PURE__*/jsx(Transitions, {
|
|
124
|
+
transitions: transitions,
|
|
125
|
+
delay: finalTransitionDelay,
|
|
126
|
+
playing: transitionPlaying,
|
|
127
|
+
disabled: transitionDisabled,
|
|
128
|
+
fullscreen: true,
|
|
129
|
+
children: /*#__PURE__*/jsx(ScreenElement, {
|
|
130
|
+
placeholder: "image",
|
|
131
|
+
placeholderProps: {
|
|
132
|
+
className: styles.placeholder,
|
|
133
|
+
height: '100%'
|
|
134
|
+
},
|
|
135
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
136
|
+
id: "ebsPd4",
|
|
137
|
+
defaultMessage: [{
|
|
138
|
+
"type": 0,
|
|
139
|
+
"value": "Image"
|
|
140
|
+
}]
|
|
141
|
+
}),
|
|
142
|
+
emptyClassName: styles.emptyImage,
|
|
143
|
+
isEmpty: !hasImage,
|
|
144
|
+
children: mediaShouldLoad ? /*#__PURE__*/jsx(Visual, _objectSpread(_objectSpread({
|
|
145
|
+
className: styles.image,
|
|
146
|
+
media: media,
|
|
147
|
+
muted: muted
|
|
148
|
+
}, imageSize), {}, {
|
|
149
|
+
resolution: resolution,
|
|
150
|
+
objectFit: {
|
|
151
|
+
fit: 'cover'
|
|
152
|
+
},
|
|
153
|
+
playing: backgroundPlaying,
|
|
154
|
+
active: active,
|
|
155
|
+
withoutVideo: isPreview,
|
|
156
|
+
onLoaded: onImageLoaded
|
|
157
|
+
})) : null
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
}), withCaptions ? /*#__PURE__*/jsx(Transitions, {
|
|
161
|
+
transitions: transitions,
|
|
162
|
+
delay: finalTransitionDelay,
|
|
163
|
+
playing: transitionPlaying,
|
|
164
|
+
disabled: transitionDisabled,
|
|
165
|
+
children: /*#__PURE__*/jsx(ScreenElement, {
|
|
166
|
+
placeholder: "line",
|
|
167
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
168
|
+
id: "6tIigB",
|
|
169
|
+
defaultMessage: [{
|
|
170
|
+
"type": 0,
|
|
171
|
+
"value": "Caption"
|
|
172
|
+
}]
|
|
173
|
+
}),
|
|
174
|
+
emptyClassName: styles.emptyCaption,
|
|
175
|
+
isEmpty: !hasCaption,
|
|
176
|
+
children: hasCaption ? /*#__PURE__*/jsx("div", {
|
|
177
|
+
className: styles.caption,
|
|
178
|
+
children: /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, caption), {}, {
|
|
179
|
+
className: styles.captionText,
|
|
180
|
+
lineClamp: captionMaxLines
|
|
181
|
+
}))
|
|
182
|
+
}) : null
|
|
183
|
+
})
|
|
184
|
+
}) : null]
|
|
185
|
+
}, "item-".concat(itemI));
|
|
186
|
+
});
|
|
187
|
+
return /*#__PURE__*/jsxs("div", {
|
|
188
|
+
className: classNames([styles.container, className, _defineProperty({}, styles.isPlaceholder, isPlaceholder)]),
|
|
189
|
+
"data-screen-ready": ready,
|
|
190
|
+
children: [/*#__PURE__*/jsx(Container, {
|
|
191
|
+
width: width,
|
|
192
|
+
height: height,
|
|
193
|
+
className: styles.content,
|
|
194
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
195
|
+
className: styles.inner,
|
|
196
|
+
style: {
|
|
197
|
+
paddingTop: !isPreview ? viewerTopHeight : null,
|
|
198
|
+
paddingBottom: (hasFooter ? footerHeight - finalSpacing : 0) + (current && !isPreview ? viewerBottomHeight : 0)
|
|
199
|
+
},
|
|
200
|
+
children: [isPlaceholder ? /*#__PURE__*/jsx(ScreenElement, {
|
|
201
|
+
placeholder: "image",
|
|
202
|
+
placeholderProps: {
|
|
203
|
+
className: styles.placeholder,
|
|
204
|
+
height: '100%'
|
|
205
|
+
},
|
|
206
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
207
|
+
id: "ebsPd4",
|
|
208
|
+
defaultMessage: [{
|
|
209
|
+
"type": 0,
|
|
210
|
+
"value": "Image"
|
|
211
|
+
}]
|
|
212
|
+
})
|
|
213
|
+
}) : null, !isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
214
|
+
className: styles.header,
|
|
215
|
+
ref: headerRef,
|
|
216
|
+
style: {
|
|
217
|
+
padding: finalSpacing,
|
|
218
|
+
paddingTop: finalSpacing / 2,
|
|
219
|
+
transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
|
|
220
|
+
},
|
|
221
|
+
children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
|
|
222
|
+
}) : null, items, !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
223
|
+
className: styles.footer,
|
|
224
|
+
ref: footerRef,
|
|
225
|
+
style: {
|
|
226
|
+
padding: finalSpacing / 2
|
|
227
|
+
},
|
|
228
|
+
children: /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps))
|
|
229
|
+
}) : null]
|
|
230
|
+
})
|
|
231
|
+
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
232
|
+
background: background,
|
|
233
|
+
width: width,
|
|
234
|
+
height: height,
|
|
148
235
|
resolution: resolution,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
},
|
|
236
|
+
muted: muted,
|
|
237
|
+
mediaRef: mediaRef,
|
|
152
238
|
playing: backgroundPlaying,
|
|
153
|
-
|
|
239
|
+
shouldLoad: mediaShouldLoad,
|
|
154
240
|
withoutVideo: isPreview,
|
|
155
|
-
|
|
156
|
-
})
|
|
157
|
-
transitions: transitions,
|
|
158
|
-
delay: finalTransitionDelay,
|
|
159
|
-
playing: transitionPlaying,
|
|
160
|
-
disabled: transitionDisabled
|
|
161
|
-
}, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
162
|
-
placeholder: "line",
|
|
163
|
-
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
164
|
-
id: "6tIigB",
|
|
165
|
-
defaultMessage: [{
|
|
166
|
-
"type": 0,
|
|
167
|
-
"value": "Caption"
|
|
168
|
-
}]
|
|
169
|
-
}),
|
|
170
|
-
emptyClassName: styles.emptyCaption,
|
|
171
|
-
isEmpty: !hasCaption
|
|
172
|
-
}, hasCaption ? /*#__PURE__*/React.createElement("div", {
|
|
173
|
-
className: styles.caption
|
|
174
|
-
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, caption, {
|
|
175
|
-
className: styles.captionText,
|
|
176
|
-
lineClamp: captionMaxLines
|
|
177
|
-
}))) : null)) : null);
|
|
241
|
+
className: styles.background
|
|
242
|
+
}) : null]
|
|
178
243
|
});
|
|
179
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
180
|
-
className: classNames([styles.container, className, _defineProperty({}, styles.isPlaceholder, isPlaceholder)]),
|
|
181
|
-
"data-screen-ready": ready
|
|
182
|
-
}, /*#__PURE__*/React.createElement(Container, {
|
|
183
|
-
width: width,
|
|
184
|
-
height: height,
|
|
185
|
-
className: styles.content
|
|
186
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
187
|
-
className: styles.inner,
|
|
188
|
-
style: {
|
|
189
|
-
paddingTop: !isPreview ? viewerTopHeight : null,
|
|
190
|
-
paddingBottom: (hasFooter ? footerHeight - finalSpacing : 0) + (current && !isPreview ? viewerBottomHeight : 0)
|
|
191
|
-
}
|
|
192
|
-
}, isPlaceholder ? /*#__PURE__*/React.createElement(ScreenElement, {
|
|
193
|
-
placeholder: "image",
|
|
194
|
-
placeholderProps: {
|
|
195
|
-
className: styles.placeholder,
|
|
196
|
-
height: '100%'
|
|
197
|
-
},
|
|
198
|
-
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
199
|
-
id: "ebsPd4",
|
|
200
|
-
defaultMessage: [{
|
|
201
|
-
"type": 0,
|
|
202
|
-
"value": "Image"
|
|
203
|
-
}]
|
|
204
|
-
})
|
|
205
|
-
}) : null, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
|
|
206
|
-
className: styles.header,
|
|
207
|
-
ref: headerRef,
|
|
208
|
-
style: {
|
|
209
|
-
padding: finalSpacing,
|
|
210
|
-
paddingTop: finalSpacing / 2,
|
|
211
|
-
transform: !isPreview ? "translate(0, ".concat(viewerTopHeight, "px)") : null
|
|
212
|
-
}
|
|
213
|
-
}, /*#__PURE__*/React.createElement(Header, header)) : null, items, !isPlaceholder && hasFooter ? /*#__PURE__*/React.createElement("div", {
|
|
214
|
-
className: styles.footer,
|
|
215
|
-
ref: footerRef,
|
|
216
|
-
style: {
|
|
217
|
-
padding: finalSpacing / 2
|
|
218
|
-
}
|
|
219
|
-
}, /*#__PURE__*/React.createElement(Footer, footerProps)) : null)), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
220
|
-
background: background,
|
|
221
|
-
width: width,
|
|
222
|
-
height: height,
|
|
223
|
-
resolution: resolution,
|
|
224
|
-
muted: muted,
|
|
225
|
-
mediaRef: mediaRef,
|
|
226
|
-
playing: backgroundPlaying,
|
|
227
|
-
shouldLoad: mediaShouldLoad,
|
|
228
|
-
withoutVideo: isPreview,
|
|
229
|
-
className: styles.background
|
|
230
|
-
}) : null);
|
|
231
244
|
}
|
|
232
245
|
|
|
233
246
|
// import * as transforms from './transforms/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-slideshow",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/runtime": "^7.28.6",
|
|
64
|
-
"@micromag/core": "^0.4.
|
|
65
|
-
"@micromag/element-background": "^0.4.
|
|
66
|
-
"@micromag/element-container": "^0.4.
|
|
67
|
-
"@micromag/element-footer": "^0.4.
|
|
68
|
-
"@micromag/element-header": "^0.4.
|
|
69
|
-
"@micromag/element-layout": "^0.4.
|
|
70
|
-
"@micromag/element-text": "^0.4.
|
|
71
|
-
"@micromag/element-visual": "^0.4.
|
|
72
|
-
"@micromag/transforms": "^0.4.
|
|
64
|
+
"@micromag/core": "^0.4.50",
|
|
65
|
+
"@micromag/element-background": "^0.4.50",
|
|
66
|
+
"@micromag/element-container": "^0.4.50",
|
|
67
|
+
"@micromag/element-footer": "^0.4.50",
|
|
68
|
+
"@micromag/element-header": "^0.4.50",
|
|
69
|
+
"@micromag/element-layout": "^0.4.50",
|
|
70
|
+
"@micromag/element-text": "^0.4.50",
|
|
71
|
+
"@micromag/element-visual": "^0.4.50",
|
|
72
|
+
"@micromag/transforms": "^0.4.50",
|
|
73
73
|
"classnames": "^2.2.6",
|
|
74
74
|
"lodash": "^4.17.23",
|
|
75
75
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
"access": "public",
|
|
80
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
83
83
|
"types": "es/index.d.ts"
|
|
84
84
|
}
|