@micromag/screen-timeline 0.4.28 → 0.4.29
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 +51 -25
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import React, { useMemo, useState, useEffect, useCallback
|
|
7
|
+
import React, { useMemo, useState, useEffect, useCallback } from 'react';
|
|
8
8
|
import { ScreenElement } from '@micromag/core/components';
|
|
9
9
|
import { useScreenSize, useViewerContext, useViewerWebView, useScreenRenderContext, usePlaybackContext, usePlaybackMediaRef, useViewerContainer } from '@micromag/core/contexts';
|
|
10
10
|
import { useTrackScreenEvent, useActivityDetector, useDebounce, useTrackScreenMedia, useDimensionObserver } from '@micromag/core/hooks';
|
|
@@ -265,22 +265,48 @@ function Timeline(_ref) {
|
|
|
265
265
|
return count + 1;
|
|
266
266
|
});
|
|
267
267
|
}, [setImagesLoaded]);
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
268
|
+
|
|
269
|
+
// const {
|
|
270
|
+
// ref: firstLineRef,
|
|
271
|
+
// entry: { contentRect: firstLineContentRect = null },
|
|
272
|
+
// } = useResizeObserver();
|
|
273
|
+
// const {
|
|
274
|
+
// ref: firstContentRef,
|
|
275
|
+
// entry: { contentRect: firstContentRect = null },
|
|
276
|
+
// } = useResizeObserver();
|
|
277
|
+
// const { width: firstLineWidth = null } = firstLineContentRect || {};
|
|
278
|
+
// const { width: firstContentWidth = null } = firstContentRect || {};
|
|
279
|
+
|
|
280
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
281
|
+
firstLineRef = _useDimensionObserver.ref,
|
|
282
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
283
|
+
firstLineWidth = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2;
|
|
284
|
+
var _useDimensionObserver3 = useDimensionObserver(),
|
|
285
|
+
firstContentRef = _useDimensionObserver3.ref,
|
|
286
|
+
_useDimensionObserver4 = _useDimensionObserver3.width,
|
|
287
|
+
firstContentWidth = _useDimensionObserver4 === void 0 ? null : _useDimensionObserver4;
|
|
288
|
+
var imageWidth = (firstContentWidth !== null && firstContentWidth !== void 0 ? firstContentWidth : 0) - (firstLineWidth !== null && firstLineWidth !== void 0 ? firstLineWidth : 0);
|
|
289
|
+
|
|
290
|
+
// const firstLineRef = useRef(null);
|
|
291
|
+
// const firstContentRef = useRef(null);
|
|
292
|
+
// const [legacyImageWidth, setImageWidth] = useState(0);
|
|
293
|
+
|
|
294
|
+
// useEffect(() => {
|
|
295
|
+
// if (firstContentRef.current === null) {
|
|
296
|
+
// return;
|
|
297
|
+
// }
|
|
298
|
+
// if (firstLineRef.current !== null) {
|
|
299
|
+
// setImageWidth(firstContentRef.current.offsetWidth - firstLineRef.current.offsetWidth);
|
|
300
|
+
// } else {
|
|
301
|
+
// setImageWidth(firstContentRef.current.offsetWidth);
|
|
302
|
+
// }
|
|
303
|
+
// }, [width, height, finalItems]);
|
|
304
|
+
|
|
305
|
+
// console.log('firstLineWidth', firstLineWidth);
|
|
306
|
+
// console.log('firstContentWidth', firstContentWidth);
|
|
307
|
+
// console.log('legacyImageWidth', legacyImageWidth);
|
|
308
|
+
// console.log('imageWidth', imageWidth);
|
|
309
|
+
|
|
284
310
|
var timelineElements = (finalItems || []).map(function (item, itemI) {
|
|
285
311
|
var _ref8 = item || {},
|
|
286
312
|
_ref8$title = _ref8.title,
|
|
@@ -420,14 +446,14 @@ function Timeline(_ref) {
|
|
|
420
446
|
openWebView: openWebView,
|
|
421
447
|
isPreview: isPreview
|
|
422
448
|
});
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
scrolledBottom =
|
|
426
|
-
setScrolledBottom =
|
|
427
|
-
var
|
|
428
|
-
footerRef =
|
|
429
|
-
|
|
430
|
-
footerHeight =
|
|
449
|
+
var _useState1 = useState(false),
|
|
450
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
451
|
+
scrolledBottom = _useState10[0],
|
|
452
|
+
setScrolledBottom = _useState10[1];
|
|
453
|
+
var _useDimensionObserver5 = useDimensionObserver(),
|
|
454
|
+
footerRef = _useDimensionObserver5.ref,
|
|
455
|
+
_useDimensionObserver6 = _useDimensionObserver5.height,
|
|
456
|
+
footerHeight = _useDimensionObserver6 === void 0 ? 0 : _useDimensionObserver6;
|
|
431
457
|
var onScrolledBottom = useCallback(function (_ref12) {
|
|
432
458
|
var initial = _ref12.initial;
|
|
433
459
|
if (initial) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-timeline",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"access": "public",
|
|
82
82
|
"registry": "https://registry.npmjs.org/"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "916ccd47c5782c43457310e7c72d0fa4f5ea6742",
|
|
85
85
|
"types": "es/index.d.ts"
|
|
86
86
|
}
|