@micromag/screen-article 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 +122 -110
- package/package.json +15 -15
package/es/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useIntl, FormattedMessage, defineMessage } from 'react-intl';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import dayjs from 'dayjs';
|
|
6
|
-
import
|
|
7
|
+
import { useMemo, useState, useCallback } from 'react';
|
|
7
8
|
import { ScreenElement } from '@micromag/core/components';
|
|
8
9
|
import { useScreenSize, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useScreenRenderContext } from '@micromag/core/contexts';
|
|
9
10
|
import { useTrackScreenEvent, useDimensionObserver } from '@micromag/core/hooks';
|
|
@@ -18,6 +19,7 @@ import Layout from '@micromag/element-layout';
|
|
|
18
19
|
import Scroll from '@micromag/element-scroll';
|
|
19
20
|
import Text from '@micromag/element-text';
|
|
20
21
|
import Visual from '@micromag/element-visual';
|
|
22
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
21
23
|
|
|
22
24
|
var styles = {"container":"micromag-screen-article-container","background":"micromag-screen-article-background","content":"micromag-screen-article-content","layout":"micromag-screen-article-layout","emptyTitle":"micromag-screen-article-emptyTitle","emptyAuthor":"micromag-screen-article-emptyAuthor","emptySubtitle":"micromag-screen-article-emptySubtitle","emptyText":"micromag-screen-article-emptyText","emptySurtitle":"micromag-screen-article-emptySurtitle","emptyDate":"micromag-screen-article-emptyDate","main":"micromag-screen-article-main","hasText":"micromag-screen-article-hasText","visualContainer":"micromag-screen-article-visualContainer","surtitle":"micromag-screen-article-surtitle","subtitle":"micromag-screen-article-subtitle","date":"micromag-screen-article-date","title":"micromag-screen-article-title","author":"micromag-screen-article-author","text":"micromag-screen-article-text","topContent":"micromag-screen-article-topContent","footer":"micromag-screen-article-footer","disabled":"micromag-screen-article-disabled","isPlaceholder":"micromag-screen-article-isPlaceholder"};
|
|
23
25
|
|
|
@@ -129,9 +131,9 @@ function ArticleScreen(_ref) {
|
|
|
129
131
|
day: '2-digit'
|
|
130
132
|
}), "</p>") : null;
|
|
131
133
|
}, [partialDate]);
|
|
132
|
-
var imageElement = /*#__PURE__*/
|
|
134
|
+
var imageElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
133
135
|
placeholder: "image",
|
|
134
|
-
emptyLabel: /*#__PURE__*/
|
|
136
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
135
137
|
id: "ebsPd4",
|
|
136
138
|
defaultMessage: [{
|
|
137
139
|
"type": 0,
|
|
@@ -139,24 +141,25 @@ function ArticleScreen(_ref) {
|
|
|
139
141
|
}]
|
|
140
142
|
}),
|
|
141
143
|
emptyClassName: styles.emptyText,
|
|
142
|
-
isEmpty: !hasImage
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
144
|
+
isEmpty: !hasImage,
|
|
145
|
+
children: /*#__PURE__*/jsx("div", {
|
|
146
|
+
ref: imageCntRef,
|
|
147
|
+
className: styles.visualContainer,
|
|
148
|
+
children: hasImage ? /*#__PURE__*/jsx(Visual, {
|
|
149
|
+
media: image
|
|
150
|
+
// width={width - spacing * 2} // in layout flow
|
|
151
|
+
,
|
|
152
|
+
width: width,
|
|
153
|
+
height: mediaHeight,
|
|
154
|
+
shouldLoad: mediaShouldLoad,
|
|
155
|
+
resolution: resolution,
|
|
156
|
+
className: styles.visual
|
|
157
|
+
}) : null
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
var titleElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
158
161
|
placeholder: "title",
|
|
159
|
-
emptyLabel: /*#__PURE__*/
|
|
162
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
160
163
|
id: "2ZOPe+",
|
|
161
164
|
defaultMessage: [{
|
|
162
165
|
"type": 0,
|
|
@@ -164,14 +167,14 @@ function ArticleScreen(_ref) {
|
|
|
164
167
|
}]
|
|
165
168
|
}),
|
|
166
169
|
emptyClassName: styles.emptyTitle,
|
|
167
|
-
isEmpty: !hasTitle
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
isEmpty: !hasTitle,
|
|
171
|
+
children: hasTitle ? /*#__PURE__*/jsx(Heading, _objectSpread({
|
|
172
|
+
className: styles.title
|
|
173
|
+
}, title)) : null
|
|
174
|
+
}, "title");
|
|
175
|
+
var surtitleElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
173
176
|
placeholder: "line",
|
|
174
|
-
emptyLabel: /*#__PURE__*/
|
|
177
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
175
178
|
id: "vdWMTA",
|
|
176
179
|
defaultMessage: [{
|
|
177
180
|
"type": 0,
|
|
@@ -179,14 +182,14 @@ function ArticleScreen(_ref) {
|
|
|
179
182
|
}]
|
|
180
183
|
}),
|
|
181
184
|
emptyClassName: styles.emptySurtitle,
|
|
182
|
-
isEmpty: !hasSurtitle
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
isEmpty: !hasSurtitle,
|
|
186
|
+
children: hasSurtitle ? /*#__PURE__*/jsx(Text, _objectSpread({
|
|
187
|
+
className: styles.surtitle
|
|
188
|
+
}, surtitle)) : null
|
|
189
|
+
}, "surtitle");
|
|
190
|
+
var subtitleElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
188
191
|
placeholder: "line",
|
|
189
|
-
emptyLabel: /*#__PURE__*/
|
|
192
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
190
193
|
id: "d60tSn",
|
|
191
194
|
defaultMessage: [{
|
|
192
195
|
"type": 0,
|
|
@@ -194,14 +197,14 @@ function ArticleScreen(_ref) {
|
|
|
194
197
|
}]
|
|
195
198
|
}),
|
|
196
199
|
emptyClassName: styles.emptySubtitle,
|
|
197
|
-
isEmpty: !hasSubtitle
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
isEmpty: !hasSubtitle,
|
|
201
|
+
children: hasSubtitle ? /*#__PURE__*/jsx(Text, _objectSpread({
|
|
202
|
+
className: styles.subtitle
|
|
203
|
+
}, subtitle)) : null
|
|
204
|
+
}, "subtitle");
|
|
205
|
+
var dateElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
203
206
|
placeholder: "line",
|
|
204
|
-
emptyLabel: /*#__PURE__*/
|
|
207
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
205
208
|
id: "/MsgWe",
|
|
206
209
|
defaultMessage: [{
|
|
207
210
|
"type": 0,
|
|
@@ -209,16 +212,16 @@ function ArticleScreen(_ref) {
|
|
|
209
212
|
}]
|
|
210
213
|
}),
|
|
211
214
|
emptyClassName: styles.emptyDate,
|
|
212
|
-
isEmpty: !hasDate
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
isEmpty: !hasDate,
|
|
216
|
+
children: hasDate ? /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({
|
|
217
|
+
className: styles.date
|
|
218
|
+
}, date), {}, {
|
|
219
|
+
body: finalDate
|
|
220
|
+
})) : null
|
|
221
|
+
}, "date");
|
|
222
|
+
var authorElement = /*#__PURE__*/jsxs(ScreenElement, {
|
|
220
223
|
placeholder: "line",
|
|
221
|
-
emptyLabel: /*#__PURE__*/
|
|
224
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
222
225
|
id: "xYqGzM",
|
|
223
226
|
defaultMessage: [{
|
|
224
227
|
"type": 0,
|
|
@@ -226,15 +229,16 @@ function ArticleScreen(_ref) {
|
|
|
226
229
|
}]
|
|
227
230
|
}),
|
|
228
231
|
emptyClassName: styles.emptyAuthor,
|
|
229
|
-
isEmpty: !hasAuthor && !hasSimpleAuthor
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
isEmpty: !hasAuthor && !hasSimpleAuthor,
|
|
233
|
+
children: [hasSimpleAuthor ? /*#__PURE__*/jsx(Text, _objectSpread({
|
|
234
|
+
className: styles.author
|
|
235
|
+
}, author)) : null, hasAuthor ? /*#__PURE__*/jsx(Author, {
|
|
236
|
+
author: author
|
|
237
|
+
}) : null]
|
|
238
|
+
}, "author");
|
|
239
|
+
var contentElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
236
240
|
placeholder: "text",
|
|
237
|
-
emptyLabel: /*#__PURE__*/
|
|
241
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
238
242
|
id: "z4CiV1",
|
|
239
243
|
defaultMessage: [{
|
|
240
244
|
"type": 0,
|
|
@@ -242,10 +246,11 @@ function ArticleScreen(_ref) {
|
|
|
242
246
|
}]
|
|
243
247
|
}),
|
|
244
248
|
emptyClassName: styles.emptyText,
|
|
245
|
-
isEmpty: !hasText
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
isEmpty: !hasText,
|
|
250
|
+
children: hasText ? /*#__PURE__*/jsx(Text, _objectSpread({
|
|
251
|
+
className: styles.text
|
|
252
|
+
}, text)) : null
|
|
253
|
+
});
|
|
249
254
|
var _useState = useState(false),
|
|
250
255
|
_useState2 = _slicedToArray(_useState, 2),
|
|
251
256
|
scrolledBottom = _useState2[0],
|
|
@@ -269,55 +274,62 @@ function ArticleScreen(_ref) {
|
|
|
269
274
|
var onScrolledNotBottom = useCallback(function () {
|
|
270
275
|
setScrolledBottom(false);
|
|
271
276
|
}, [setScrolledBottom]);
|
|
272
|
-
return /*#__PURE__*/
|
|
277
|
+
return /*#__PURE__*/jsxs("div", {
|
|
273
278
|
className: classNames([styles.container, className, _defineProperty({}, styles.isPlaceholder, isPlaceholder)]),
|
|
274
|
-
"data-screen-ready": ready
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
279
|
+
"data-screen-ready": ready,
|
|
280
|
+
children: [/*#__PURE__*/jsx(Container, {
|
|
281
|
+
width: width,
|
|
282
|
+
height: height,
|
|
283
|
+
className: styles.content,
|
|
284
|
+
children: /*#__PURE__*/jsx(Scroll, {
|
|
285
|
+
disabled: scrollingDisabled,
|
|
286
|
+
onScrolledTrigger: onScrolledTrigger,
|
|
287
|
+
onScrolledBottom: onScrolledBottom,
|
|
288
|
+
onScrolledNotBottom: onScrolledNotBottom,
|
|
289
|
+
withShadow: true,
|
|
290
|
+
children: /*#__PURE__*/jsxs(Layout, {
|
|
291
|
+
className: styles.layout,
|
|
292
|
+
style: !isPlaceholder ? {
|
|
293
|
+
padding: spacing,
|
|
294
|
+
paddingTop: hasHeader ? spacing / 2 + (!isPreview ? viewerTopHeight : 0) : spacing / 2 + imageHeight,
|
|
295
|
+
paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + spacing / 2
|
|
296
|
+
} : null,
|
|
297
|
+
children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
298
|
+
style: {
|
|
299
|
+
height: hasImage && imageHeight > 0 ? 0 : 'auto',
|
|
300
|
+
paddingBottom: imageHeight > 0 ? imageHeight - viewerTopHeight : spacing
|
|
301
|
+
},
|
|
302
|
+
children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
|
|
303
|
+
}, "header") : null, /*#__PURE__*/jsxs("div", {
|
|
304
|
+
className: classNames([styles.main, _defineProperty({}, styles.hasText, hasText && hasAuthor)]),
|
|
305
|
+
children: [imageElement, /*#__PURE__*/jsxs("div", {
|
|
306
|
+
className: styles.topContent,
|
|
307
|
+
children: [surtitleElement, dateElement]
|
|
308
|
+
}), titleElement, authorElement, subtitleElement]
|
|
309
|
+
}), contentElement, !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
310
|
+
className: classNames([styles.footer, _defineProperty({}, styles.disabled, !scrolledBottom)]),
|
|
311
|
+
style: {
|
|
312
|
+
paddingLeft: Math.max(viewerBottomSidesWidth - spacing, 0),
|
|
313
|
+
paddingRight: Math.max(viewerBottomSidesWidth - spacing, 0),
|
|
314
|
+
paddingTop: spacing
|
|
315
|
+
},
|
|
316
|
+
children: /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps))
|
|
317
|
+
}) : null]
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
321
|
+
background: background,
|
|
322
|
+
width: width,
|
|
323
|
+
height: height,
|
|
324
|
+
resolution: resolution,
|
|
325
|
+
playing: backgroundPlaying,
|
|
326
|
+
muted: muted,
|
|
327
|
+
shouldLoad: mediaShouldLoad,
|
|
328
|
+
mediaRef: mediaRef,
|
|
329
|
+
withoutVideo: isPreview,
|
|
330
|
+
className: styles.background
|
|
331
|
+
}) : null]
|
|
332
|
+
});
|
|
321
333
|
}
|
|
322
334
|
|
|
323
335
|
// import * as transforms from './transforms/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-article",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@babel/runtime": "^7.28.6",
|
|
60
|
-
"@micromag/core": "^0.4.
|
|
61
|
-
"@micromag/element-author": "^0.4.
|
|
62
|
-
"@micromag/element-background": "^0.4.
|
|
63
|
-
"@micromag/element-container": "^0.4.
|
|
64
|
-
"@micromag/element-footer": "^0.4.
|
|
65
|
-
"@micromag/element-header": "^0.4.
|
|
66
|
-
"@micromag/element-heading": "^0.4.
|
|
67
|
-
"@micromag/element-layout": "^0.4.
|
|
68
|
-
"@micromag/element-scroll": "^0.4.
|
|
69
|
-
"@micromag/element-stack": "^0.4.
|
|
70
|
-
"@micromag/element-text": "^0.4.
|
|
71
|
-
"@micromag/element-visual": "^0.4.
|
|
72
|
-
"@micromag/transforms": "^0.4.
|
|
60
|
+
"@micromag/core": "^0.4.50",
|
|
61
|
+
"@micromag/element-author": "^0.4.50",
|
|
62
|
+
"@micromag/element-background": "^0.4.50",
|
|
63
|
+
"@micromag/element-container": "^0.4.50",
|
|
64
|
+
"@micromag/element-footer": "^0.4.50",
|
|
65
|
+
"@micromag/element-header": "^0.4.50",
|
|
66
|
+
"@micromag/element-heading": "^0.4.50",
|
|
67
|
+
"@micromag/element-layout": "^0.4.50",
|
|
68
|
+
"@micromag/element-scroll": "^0.4.50",
|
|
69
|
+
"@micromag/element-stack": "^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
|
"dayjs": "^1.11.10",
|
|
75
75
|
"lodash": "^4.17.23",
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"access": "public",
|
|
81
81
|
"registry": "https://registry.npmjs.org/"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
84
84
|
"types": "es/index.d.ts"
|
|
85
85
|
}
|