react-zoom-pan-pinch 3.2.0 → 3.4.0
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/dist/index.cjs.js +54 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +54 -33
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -1
- package/.eslintignore +0 -6
- package/.github/CODEOWNERS +0 -36
- package/.github/FUNDING.yml +0 -13
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/docs.yml +0 -34
- package/.github/workflows/release.yml +0 -46
- package/.github/workflows/tests.yml +0 -42
- package/.prettierrc +0 -10
- package/.releaserc.json +0 -63
- package/.storybook/main.js +0 -23
- package/.storybook/preview-head.html +0 -5
- package/.storybook/preview.js +0 -11
- package/.storybook/theme-overrides.css +0 -49
- package/CHANGELOG.md +0 -26
- package/Code_of_Conduct.md +0 -61
- package/Contributing.md +0 -236
- package/__tests__/features/props.spec.tsx +0 -11
- package/__tests__/features/rendering.spec.tsx +0 -36
- package/__tests__/shared/render.shared.tsx +0 -41
- package/__tests__/utils/controls.utils.tsx +0 -25
- package/__tests__/utils/example.tsx +0 -81
- package/commitlint.config.js +0 -1
- package/dist/__tests__/features/props.spec.d.ts +0 -1
- package/dist/__tests__/features/rendering.spec.d.ts +0 -1
- package/dist/__tests__/shared/render.shared.d.ts +0 -11
- package/dist/__tests__/utils/controls.utils.d.ts +0 -3
- package/dist/__tests__/utils/example.d.ts +0 -6
- package/dist/src/components/index.d.ts +0 -4
- package/dist/src/components/keep-scale/keep-scale.d.ts +0 -2
- package/dist/src/components/mini-map/mini-map.d.ts +0 -8
- package/dist/src/components/mini-map/use-resize.hook.d.ts +0 -8
- package/dist/src/components/transform-component/transform-component.d.ts +0 -12
- package/dist/src/components/transform-wrapper/transform-wrapper.d.ts +0 -5
- package/dist/src/constants/state.constants.d.ts +0 -3
- package/dist/src/core/animations/animations.constants.d.ts +0 -16
- package/dist/src/core/animations/animations.utils.d.ts +0 -4
- package/dist/src/core/bounds/bounds.types.d.ts +0 -8
- package/dist/src/core/bounds/bounds.utils.d.ts +0 -17
- package/dist/src/core/double-click/double-click.logic.d.ts +0 -5
- package/dist/src/core/handlers/handlers.logic.d.ts +0 -8
- package/dist/src/core/handlers/handlers.utils.d.ts +0 -14
- package/dist/src/core/instance.core.d.ts +0 -77
- package/dist/src/core/pan/panning.logic.d.ts +0 -5
- package/dist/src/core/pan/panning.utils.d.ts +0 -10
- package/dist/src/core/pan/velocity.logic.d.ts +0 -5
- package/dist/src/core/pan/velocity.utils.d.ts +0 -5
- package/dist/src/core/pinch/pinch.logic.d.ts +0 -4
- package/dist/src/core/pinch/pinch.utils.d.ts +0 -6
- package/dist/src/core/wheel/wheel.logic.d.ts +0 -4
- package/dist/src/core/wheel/wheel.utils.d.ts +0 -7
- package/dist/src/core/zoom/zoom.logic.d.ts +0 -3
- package/dist/src/core/zoom/zoom.utils.d.ts +0 -3
- package/dist/src/hooks/index.d.ts +0 -4
- package/dist/src/hooks/use-controls.d.ts +0 -2
- package/dist/src/hooks/use-transform-context.d.ts +0 -1
- package/dist/src/hooks/use-transform-effect.d.ts +0 -2
- package/dist/src/hooks/use-transform-init.d.ts +0 -2
- package/dist/src/index.d.ts +0 -5
- package/dist/src/models/calculations.model.d.ts +0 -25
- package/dist/src/models/context.model.d.ts +0 -124
- package/dist/src/models/helpers.model.d.ts +0 -5
- package/dist/src/models/index.d.ts +0 -3
- package/dist/src/stories/docs/handlers.d.ts +0 -12
- package/dist/src/stories/docs/props.d.ts +0 -14
- package/dist/src/stories/examples/content-rerendering/example.d.ts +0 -2
- package/dist/src/stories/examples/image-responsive/example.d.ts +0 -2
- package/dist/src/stories/examples/keep-scale/example.d.ts +0 -2
- package/dist/src/stories/examples/mini-map/example.d.ts +0 -1
- package/dist/src/stories/examples/stress/example.d.ts +0 -2
- package/dist/src/stories/examples/svg-zoom-to-element/example.d.ts +0 -2
- package/dist/src/stories/examples/zoom-to-element/example.d.ts +0 -2
- package/dist/src/stories/types/args.types.d.ts +0 -280
- package/dist/src/stories/utils/args.utils.d.ts +0 -3
- package/dist/src/stories/utils/code.utils.d.ts +0 -6
- package/dist/src/stories/utils/controls.utils.d.ts +0 -3
- package/dist/src/stories/utils/index.d.ts +0 -3
- package/dist/src/utils/calculations.utils.d.ts +0 -11
- package/dist/src/utils/callback.utils.d.ts +0 -2
- package/dist/src/utils/context.utils.d.ts +0 -4
- package/dist/src/utils/event.utils.d.ts +0 -1
- package/dist/src/utils/helpers.utils.d.ts +0 -2
- package/dist/src/utils/index.d.ts +0 -8
- package/dist/src/utils/ref.utils.d.ts +0 -2
- package/dist/src/utils/state.utils.d.ts +0 -3
- package/dist/src/utils/styles.utils.d.ts +0 -4
- package/jest.config.ts +0 -45
- package/rollup.config.js +0 -51
- package/src/.eslintrc.json +0 -90
- package/src/components/index.ts +0 -4
- package/src/components/keep-scale/keep-scale.tsx +0 -28
- package/src/components/mini-map/mini-map.tsx +0 -188
- package/src/components/mini-map/use-resize.hook.ts +0 -69
- package/src/components/transform-component/transform-component.module.css +0 -30
- package/src/components/transform-component/transform-component.tsx +0 -58
- package/src/components/transform-wrapper/transform-wrapper.tsx +0 -42
- package/src/constants/state.constants.ts +0 -74
- package/src/core/animations/animations.constants.ts +0 -78
- package/src/core/animations/animations.utils.ts +0 -114
- package/src/core/bounds/bounds.types.ts +0 -8
- package/src/core/bounds/bounds.utils.ts +0 -198
- package/src/core/double-click/double-click.logic.ts +0 -116
- package/src/core/handlers/handlers.logic.ts +0 -115
- package/src/core/handlers/handlers.utils.ts +0 -195
- package/src/core/instance.core.ts +0 -499
- package/src/core/pan/panning.logic.ts +0 -100
- package/src/core/pan/panning.utils.ts +0 -196
- package/src/core/pan/velocity.logic.ts +0 -149
- package/src/core/pan/velocity.utils.ts +0 -79
- package/src/core/pinch/pinch.logic.ts +0 -81
- package/src/core/pinch/pinch.utils.ts +0 -88
- package/src/core/wheel/wheel.logic.ts +0 -121
- package/src/core/wheel/wheel.utils.ts +0 -122
- package/src/core/zoom/zoom.logic.ts +0 -69
- package/src/core/zoom/zoom.utils.ts +0 -58
- package/src/hooks/index.ts +0 -4
- package/src/hooks/use-controls.tsx +0 -9
- package/src/hooks/use-transform-context.tsx +0 -13
- package/src/hooks/use-transform-effect.tsx +0 -22
- package/src/hooks/use-transform-init.tsx +0 -27
- package/src/index.ts +0 -6
- package/src/models/calculations.model.ts +0 -26
- package/src/models/context.model.ts +0 -196
- package/src/models/helpers.model.ts +0 -15
- package/src/models/index.ts +0 -3
- package/src/react-app-env.d.ts +0 -1
- package/src/stories/assets/big-image.jpeg +0 -0
- package/src/stories/assets/map.jpg +0 -0
- package/src/stories/assets/medium-image.jpg +0 -0
- package/src/stories/assets/pin.svg +0 -1
- package/src/stories/assets/small-image.jpg +0 -0
- package/src/stories/assets/svg-example.svg +0 -14
- package/src/stories/docs/Introduction.stories.mdx +0 -174
- package/src/stories/docs/handlers.stories.mdx +0 -48
- package/src/stories/docs/handlers.tsx +0 -107
- package/src/stories/docs/props.stories.mdx +0 -92
- package/src/stories/docs/props.tsx +0 -508
- package/src/stories/examples/content/content.stories.mdx +0 -121
- package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -45
- package/src/stories/examples/content-rerendering/example.tsx +0 -73
- package/src/stories/examples/controls/controls.stories.mdx +0 -71
- package/src/stories/examples/image-big/image-big.stories.mdx +0 -43
- package/src/stories/examples/image-medium/image-medium.stories.mdx +0 -41
- package/src/stories/examples/image-responsive/example.tsx +0 -103
- package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -32
- package/src/stories/examples/image-small/image-small.stories.mdx +0 -41
- package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -46
- package/src/stories/examples/keep-scale/example.tsx +0 -92
- package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -45
- package/src/stories/examples/mini-map/example.tsx +0 -54
- package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -33
- package/src/stories/examples/stress/example.tsx +0 -23
- package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
- package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
- package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -57
- package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
- package/src/stories/examples/zoom-to-element/example.tsx +0 -94
- package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -28
- package/src/stories/hooks/use-controls.stories.mdx +0 -24
- package/src/stories/hooks/use-transform-context.stories.mdx +0 -15
- package/src/stories/hooks/use-transform-effect.stories.mdx +0 -29
- package/src/stories/hooks/use-transform-init.stories.mdx +0 -25
- package/src/stories/types/args.types.ts +0 -211
- package/src/stories/utils/args.utils.ts +0 -34
- package/src/stories/utils/code.utils.tsx +0 -24
- package/src/stories/utils/controls.utils.tsx +0 -43
- package/src/stories/utils/index.ts +0 -3
- package/src/stories/utils/styles.module.css +0 -34
- package/src/styles.css +0 -8
- package/src/typings.d.ts +0 -10
- package/src/utils/calculations.utils.ts +0 -16
- package/src/utils/callback.utils.ts +0 -11
- package/src/utils/context.utils.ts +0 -48
- package/src/utils/event.utils.ts +0 -22
- package/src/utils/helpers.utils.ts +0 -27
- package/src/utils/index.ts +0 -8
- package/src/utils/ref.utils.ts +0 -16
- package/src/utils/state.utils.ts +0 -40
- package/src/utils/styles.utils.ts +0 -44
- package/tsconfig.json +0 -33
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ declare class ZoomPanPinch {
|
|
|
50
50
|
wheelStopEventTimer: ReturnType<typeof setTimeout> | null;
|
|
51
51
|
wheelAnimationTimer: ReturnType<typeof setTimeout> | null;
|
|
52
52
|
isPanning: boolean;
|
|
53
|
+
isWheelPanning: boolean;
|
|
53
54
|
startCoords: StartCoordsType;
|
|
54
55
|
lastTouch: number | null;
|
|
55
56
|
distance: null | number;
|
|
@@ -76,6 +77,7 @@ declare class ZoomPanPinch {
|
|
|
76
77
|
handleInitializeWrapperEvents: (wrapper: HTMLDivElement) => void;
|
|
77
78
|
handleInitialize: (contentComponent: HTMLDivElement) => void;
|
|
78
79
|
onWheelZoom: (event: WheelEvent) => void;
|
|
80
|
+
onWheelPanning: (event: WheelEvent) => void;
|
|
79
81
|
onPanningStart: (event: MouseEvent) => void;
|
|
80
82
|
onPanning: (event: MouseEvent) => void;
|
|
81
83
|
onPanningStop: (event: MouseEvent | TouchEvent) => void;
|
|
@@ -165,8 +167,12 @@ type ReactZoomPanPinchProps = {
|
|
|
165
167
|
velocityDisabled?: boolean;
|
|
166
168
|
lockAxisX?: boolean;
|
|
167
169
|
lockAxisY?: boolean;
|
|
170
|
+
allowLeftClickPan?: boolean;
|
|
171
|
+
allowMiddleClickPan?: boolean;
|
|
172
|
+
allowRightClickPan?: boolean;
|
|
168
173
|
activationKeys?: string[];
|
|
169
174
|
excluded?: string[];
|
|
175
|
+
wheelPanning?: boolean;
|
|
170
176
|
};
|
|
171
177
|
pinch?: {
|
|
172
178
|
step?: number;
|
package/dist/index.esm.js
CHANGED
|
@@ -216,28 +216,6 @@ var calculateBounds = function (contextInstance, newScale) {
|
|
|
216
216
|
var bounds = getBounds(wrapperWidth, newContentWidth, newDiffWidth, wrapperHeight, newContentHeight, newDiffHeight, Boolean(centerZoomedOut));
|
|
217
217
|
return bounds;
|
|
218
218
|
};
|
|
219
|
-
function clamp(v, min, max) {
|
|
220
|
-
return Math.max(min, Math.min(v, max));
|
|
221
|
-
}
|
|
222
|
-
// Based on @aholachek ;)
|
|
223
|
-
// https://twitter.com/chpwn/status/285540192096497664
|
|
224
|
-
// iOS constant = 0.55
|
|
225
|
-
// https://medium.com/@nathangitter/building-fluid-interfaces-ios-swift-9732bb934bf5
|
|
226
|
-
function rubberband(distance, dimension, constant) {
|
|
227
|
-
if (dimension === 0 || Math.abs(dimension) === Infinity)
|
|
228
|
-
return Math.pow(distance, (constant * 5));
|
|
229
|
-
return (distance * dimension * constant) / (dimension + constant * distance);
|
|
230
|
-
}
|
|
231
|
-
function rubberbandIfOutOfBounds(position, min, max, constant) {
|
|
232
|
-
if (constant === void 0) { constant = 0.15; }
|
|
233
|
-
if (constant === 0)
|
|
234
|
-
return clamp(position, min, max);
|
|
235
|
-
if (position < min)
|
|
236
|
-
return -rubberband(min - position, max - min, constant) + min;
|
|
237
|
-
if (position > max)
|
|
238
|
-
return +rubberband(position - max, max - min, constant) + max;
|
|
239
|
-
return position;
|
|
240
|
-
}
|
|
241
219
|
/**
|
|
242
220
|
* Keeps value between given bounds, used for limiting view to given boundaries
|
|
243
221
|
* 1# eg. boundLimiter(2, 0, 3, true) => 2
|
|
@@ -268,10 +246,8 @@ function getMouseBoundedPosition(positionX, positionY, bounds, limitToBounds, pa
|
|
|
268
246
|
paddingX = paddingValueX;
|
|
269
247
|
paddingY = paddingValueY;
|
|
270
248
|
}
|
|
271
|
-
var
|
|
272
|
-
var
|
|
273
|
-
var x = boundLimiter(rubberbandX, minPositionX - paddingX, maxPositionX + paddingX, limitToBounds);
|
|
274
|
-
var y = boundLimiter(rubberbandY, minPositionY - paddingY, maxPositionY + paddingY, limitToBounds);
|
|
249
|
+
var x = boundLimiter(positionX, minPositionX - paddingX, maxPositionX + paddingX, limitToBounds);
|
|
250
|
+
var y = boundLimiter(positionY, minPositionY - paddingY, maxPositionY + paddingY, limitToBounds);
|
|
275
251
|
return { x: x, y: y };
|
|
276
252
|
}
|
|
277
253
|
|
|
@@ -303,7 +279,15 @@ var isPanningStartAllowed = function (contextInstance, event) {
|
|
|
303
279
|
var excluded = contextInstance.setup.panning.excluded;
|
|
304
280
|
var isInitialized = contextInstance.isInitialized, wrapperComponent = contextInstance.wrapperComponent;
|
|
305
281
|
var target = event.target;
|
|
306
|
-
var
|
|
282
|
+
var targetIsShadowDom = "shadowRoot" in target && "composedPath" in event;
|
|
283
|
+
var isWrapperChild = targetIsShadowDom
|
|
284
|
+
? event.composedPath().some(function (el) {
|
|
285
|
+
if (!(el instanceof Element)) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
return wrapperComponent === null || wrapperComponent === void 0 ? void 0 : wrapperComponent.contains(el);
|
|
289
|
+
})
|
|
290
|
+
: wrapperComponent === null || wrapperComponent === void 0 ? void 0 : wrapperComponent.contains(target);
|
|
307
291
|
var isAllowed = isInitialized && target && isWrapperChild;
|
|
308
292
|
if (!isAllowed)
|
|
309
293
|
return false;
|
|
@@ -691,6 +675,10 @@ var initialSetup = {
|
|
|
691
675
|
velocityDisabled: false,
|
|
692
676
|
lockAxisX: false,
|
|
693
677
|
lockAxisY: false,
|
|
678
|
+
allowLeftClickPan: true,
|
|
679
|
+
allowMiddleClickPan: true,
|
|
680
|
+
allowRightClickPan: true,
|
|
681
|
+
wheelPanning: false,
|
|
694
682
|
activationKeys: [],
|
|
695
683
|
excluded: [],
|
|
696
684
|
},
|
|
@@ -1335,6 +1323,7 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1335
1323
|
this.wheelAnimationTimer = null;
|
|
1336
1324
|
// panning helpers
|
|
1337
1325
|
this.isPanning = false;
|
|
1326
|
+
this.isWheelPanning = false;
|
|
1338
1327
|
this.startCoords = null;
|
|
1339
1328
|
this.lastTouch = null;
|
|
1340
1329
|
// pinch helpers
|
|
@@ -1366,10 +1355,11 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1366
1355
|
_this.setup = createSetup(newProps);
|
|
1367
1356
|
};
|
|
1368
1357
|
this.initializeWindowEvents = function () {
|
|
1369
|
-
var _a;
|
|
1358
|
+
var _a, _b;
|
|
1370
1359
|
var passive = makePassiveEventOption();
|
|
1371
1360
|
var currentDocument = (_a = _this.wrapperComponent) === null || _a === void 0 ? void 0 : _a.ownerDocument;
|
|
1372
1361
|
var currentWindow = currentDocument === null || currentDocument === void 0 ? void 0 : currentDocument.defaultView;
|
|
1362
|
+
(_b = _this.wrapperComponent) === null || _b === void 0 ? void 0 : _b.addEventListener("wheel", _this.onWheelPanning, passive);
|
|
1373
1363
|
// Panning on window to allow panning when mouse is out of component wrapper
|
|
1374
1364
|
currentWindow === null || currentWindow === void 0 ? void 0 : currentWindow.addEventListener("mousedown", _this.onPanningStart, passive);
|
|
1375
1365
|
currentWindow === null || currentWindow === void 0 ? void 0 : currentWindow.addEventListener("mousemove", _this.onPanning, passive);
|
|
@@ -1438,6 +1428,31 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1438
1428
|
/// ///////
|
|
1439
1429
|
// Pan
|
|
1440
1430
|
/// ///////
|
|
1431
|
+
this.onWheelPanning = function (event) {
|
|
1432
|
+
var _a = _this.setup, disabled = _a.disabled, wheel = _a.wheel, panning = _a.panning;
|
|
1433
|
+
if (!_this.wrapperComponent ||
|
|
1434
|
+
!_this.contentComponent ||
|
|
1435
|
+
disabled ||
|
|
1436
|
+
!wheel.wheelDisabled ||
|
|
1437
|
+
panning.disabled ||
|
|
1438
|
+
!panning.wheelPanning ||
|
|
1439
|
+
event.ctrlKey) {
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
event.preventDefault();
|
|
1443
|
+
event.stopPropagation();
|
|
1444
|
+
var _b = _this.transformState, positionX = _b.positionX, positionY = _b.positionY;
|
|
1445
|
+
var mouseX = positionX - event.deltaX;
|
|
1446
|
+
var mouseY = positionY - event.deltaY;
|
|
1447
|
+
var newPositionX = panning.lockAxisX ? positionX : mouseX;
|
|
1448
|
+
var newPositionY = panning.lockAxisY ? positionY : mouseY;
|
|
1449
|
+
var _c = _this.setup.alignmentAnimation, sizeX = _c.sizeX, sizeY = _c.sizeY;
|
|
1450
|
+
var paddingValueX = getPaddingValue(_this, sizeX);
|
|
1451
|
+
var paddingValueY = getPaddingValue(_this, sizeY);
|
|
1452
|
+
if (newPositionX === positionX && newPositionY === positionY)
|
|
1453
|
+
return;
|
|
1454
|
+
handleNewPosition(_this, newPositionX, newPositionY, paddingValueX, paddingValueY);
|
|
1455
|
+
};
|
|
1441
1456
|
this.onPanningStart = function (event) {
|
|
1442
1457
|
var disabled = _this.setup.disabled;
|
|
1443
1458
|
var onPanningStart = _this.props.onPanningStart;
|
|
@@ -1449,6 +1464,12 @@ var ZoomPanPinch = /** @class */ (function () {
|
|
|
1449
1464
|
var keysPressed = _this.isPressingKeys(_this.setup.panning.activationKeys);
|
|
1450
1465
|
if (!keysPressed)
|
|
1451
1466
|
return;
|
|
1467
|
+
if (event.button === 0 && !_this.setup.panning.allowLeftClickPan)
|
|
1468
|
+
return;
|
|
1469
|
+
if (event.button === 1 && !_this.setup.panning.allowMiddleClickPan)
|
|
1470
|
+
return;
|
|
1471
|
+
if (event.button === 2 && !_this.setup.panning.allowRightClickPan)
|
|
1472
|
+
return;
|
|
1452
1473
|
event.preventDefault();
|
|
1453
1474
|
event.stopPropagation();
|
|
1454
1475
|
handleCancelAnimation(_this);
|
|
@@ -1698,9 +1719,6 @@ var TransformWrapper = React.forwardRef(function (props, ref) {
|
|
|
1698
1719
|
useImperativeHandle(ref, function () { return getControls(instance); }, [instance]);
|
|
1699
1720
|
useEffect(function () {
|
|
1700
1721
|
instance.update(props);
|
|
1701
|
-
return function () {
|
|
1702
|
-
instance.cleanupWindowEvents();
|
|
1703
|
-
};
|
|
1704
1722
|
}, [instance, props]);
|
|
1705
1723
|
return React.createElement(Context.Provider, { value: instance }, content);
|
|
1706
1724
|
});
|
|
@@ -1916,16 +1934,19 @@ styleInject(css_248z);
|
|
|
1916
1934
|
|
|
1917
1935
|
var TransformComponent = function (_a) {
|
|
1918
1936
|
var children = _a.children, _b = _a.wrapperClass, wrapperClass = _b === void 0 ? "" : _b, _c = _a.contentClass, contentClass = _c === void 0 ? "" : _c, wrapperStyle = _a.wrapperStyle, contentStyle = _a.contentStyle, _d = _a.wrapperProps, wrapperProps = _d === void 0 ? {} : _d, _e = _a.contentProps, contentProps = _e === void 0 ? {} : _e;
|
|
1919
|
-
var
|
|
1937
|
+
var _f = useContext(Context), init = _f.init, cleanupWindowEvents = _f.cleanupWindowEvents;
|
|
1920
1938
|
var wrapperRef = useRef(null);
|
|
1921
1939
|
var contentRef = useRef(null);
|
|
1922
1940
|
useEffect(function () {
|
|
1923
1941
|
var wrapper = wrapperRef.current;
|
|
1924
1942
|
var content = contentRef.current;
|
|
1925
1943
|
if (wrapper !== null && content !== null && init) {
|
|
1926
|
-
init(wrapper, content);
|
|
1944
|
+
init === null || init === void 0 ? void 0 : init(wrapper, content);
|
|
1927
1945
|
}
|
|
1928
1946
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1947
|
+
return function () {
|
|
1948
|
+
cleanupWindowEvents === null || cleanupWindowEvents === void 0 ? void 0 : cleanupWindowEvents();
|
|
1949
|
+
};
|
|
1929
1950
|
}, []);
|
|
1930
1951
|
return (React.createElement("div", __assign({}, wrapperProps, { ref: wrapperRef, className: "react-transform-wrapper ".concat(styles.wrapper, " ").concat(wrapperClass), style: wrapperStyle }),
|
|
1931
1952
|
React.createElement("div", __assign({}, contentProps, { ref: contentRef, className: "react-transform-component ".concat(styles.content, " ").concat(contentClass), style: contentStyle }), children)));
|