@iframe-resizer/react 5.2.2-beta.2 → 5.2.2-beta.3

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/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/react
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.2.2-beta.2 2024-07-18 - 14:09:44.747Z_
25
+ _iframe-resizer version 5.2.2-beta.3 2024-07-25 - 16:56:12.114Z_
package/index.cjs.js CHANGED
@@ -1,17 +1,17 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/react 5.2.2-beta.2 (cjs) - 2024-07-18
4
+ * @module iframe-resizer/react 5.2.2-beta.3 (cjs) - 2024-07-25
5
5
  *
6
- * @license GPL-3.0 for non-commercial use only.
7
- * For commercial use, you must purchase a license from
8
- * https://iframe-resizer.com/pricing
6
+ * @license GPL-3.0 for non-commercial use only.
7
+ * For commercial use, you must purchase a license from
8
+ * https://iframe-resizer.com/pricing
9
9
  *
10
- * @desciption Keep same and cross domain iFrames sized to their content
10
+ * @description Keep same and cross domain iFrames sized to their content
11
11
  *
12
- * @author David J. Bradshaw <info@iframe-resizer.com>
12
+ * @author David J. Bradshaw <info@iframe-resizer.com>
13
13
  *
14
- * @see {@link https://iframe-resizer.com}
14
+ * @see {@link https://iframe-resizer.com}
15
15
  *
16
16
  * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
17
  */
@@ -20,69 +20,84 @@
20
20
  'use strict';
21
21
 
22
22
  const _extends = require('@babel/runtime/helpers/extends');
23
+ const _defineProperty = require('@babel/runtime/helpers/defineProperty');
24
+ const _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
23
25
  const connectResizer = require('@iframe-resizer/core');
24
26
  const React = require('react');
25
27
  const warning = require('warning');
26
28
 
27
- const filterIframeAttribs = (props => {
28
- const {
29
- license,
30
- bodyBackground,
31
- bodyMargin,
32
- bodyPadding,
33
- checkOrigin,
34
- direction,
35
- inPageLinks,
36
- offset,
37
- offsetHeight,
38
- offsetWidth,
39
- scrolling,
40
- tolerance,
41
- warningTimeout,
42
- waitForLoad,
43
- onClosed,
44
- onReady,
45
- onMessage,
46
- onResized,
47
- ...iframeProps
48
- } = props;
29
+ var _excluded$1 = ["license", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "direction", "inPageLinks", "log", "offset", "offsetHeight", "offsetWidth", "scrolling", "tolerance", "warningTimeout", "waitForLoad", "onClosed", "onReady", "onMessage", "onResized"];
30
+ const filterIframeAttribs = (function (props) {
31
+ props.license;
32
+ props.bodyBackground;
33
+ props.bodyMargin;
34
+ props.bodyPadding;
35
+ props.checkOrigin;
36
+ props.direction;
37
+ props.inPageLinks;
38
+ props.log;
39
+ props.offset;
40
+ props.offsetHeight;
41
+ props.offsetWidth;
42
+ props.scrolling;
43
+ props.tolerance;
44
+ props.warningTimeout;
45
+ props.waitForLoad;
46
+ props.onClosed;
47
+ props.onReady;
48
+ props.onMessage;
49
+ props.onResized;
50
+ var iframeProps = _objectWithoutProperties(props, _excluded$1);
49
51
  return iframeProps;
50
52
  });
51
53
 
54
+ var _excluded = ["title", "forwardRef"];
55
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
56
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
52
57
  function IframeResizer(props) {
53
58
  // eslint-disable-next-line react/prop-types
54
- const {
55
- title,
56
- forwardRef,
57
- ...rest
58
- } = props;
59
- const filteredProps = filterIframeAttribs(rest);
60
- const iframeRef = React.useRef(null);
61
- const onClose = () => {
62
- warning(!iframeRef.current, `[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
59
+ var title = props.title,
60
+ forwardRef = props.forwardRef,
61
+ rest = _objectWithoutProperties(props, _excluded);
62
+ var filteredProps = filterIframeAttribs(rest);
63
+ var iframeRef = React.useRef(null);
64
+ var onClose = function onClose() {
65
+ var _iframeRef$current;
66
+ warning(!iframeRef.current, "[iframe-resizer/react][".concat(iframeRef === null || iframeRef === void 0 || (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : _iframeRef$current.id, "] Close event ignored, to remove the iframe update your React component."));
63
67
  return !iframeRef.current; // Allow React to close this
64
68
  };
65
69
 
66
70
  // This hook is only run once, as once iframe-resizer is bound, it will
67
71
  // deal with changes to the element and does not need recalling
68
- React.useEffect(() => {
69
- const iframe = iframeRef.current;
70
- const resizer = connectResizer({
71
- ...rest,
72
- onClose
73
- })(iframe);
74
- return () => resizer?.disconnect();
72
+ React.useEffect(function () {
73
+ var iframe = iframeRef.current;
74
+ var resizer = connectResizer(_objectSpread(_objectSpread({}, rest), {}, {
75
+ onClose: onClose
76
+ }))(iframe);
77
+ return function () {
78
+ return resizer === null || resizer === void 0 ? void 0 : resizer.disconnect();
79
+ };
75
80
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
76
81
 
77
- React.useImperativeHandle(forwardRef, () => ({
78
- getRef: () => iframeRef,
79
- getElement: () => iframeRef.current,
80
- resize: () => iframeRef.current.iframeResizer.resize(),
81
- moveToAnchor: anchor => iframeRef.current.iframeResizer.moveToAnchor(anchor),
82
- sendMessage: (message, targetOrigin) => {
83
- iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
84
- }
85
- }));
82
+ React.useImperativeHandle(forwardRef, function () {
83
+ return {
84
+ getRef: function getRef() {
85
+ return iframeRef;
86
+ },
87
+ getElement: function getElement() {
88
+ return iframeRef.current;
89
+ },
90
+ resize: function resize() {
91
+ return iframeRef.current.iframeResizer.resize();
92
+ },
93
+ moveToAnchor: function moveToAnchor(anchor) {
94
+ return iframeRef.current.iframeResizer.moveToAnchor(anchor);
95
+ },
96
+ sendMessage: function sendMessage(message, targetOrigin) {
97
+ iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
98
+ }
99
+ };
100
+ });
86
101
  return /*#__PURE__*/React.createElement("iframe", _extends({
87
102
  title: title
88
103
  }, filteredProps, {
package/index.esm.js CHANGED
@@ -1,86 +1,101 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/react 5.2.2-beta.2 (esm) - 2024-07-18
4
+ * @module iframe-resizer/react 5.2.2-beta.3 (esm) - 2024-07-25
5
5
  *
6
- * @license GPL-3.0 for non-commercial use only.
7
- * For commercial use, you must purchase a license from
8
- * https://iframe-resizer.com/pricing
6
+ * @license GPL-3.0 for non-commercial use only.
7
+ * For commercial use, you must purchase a license from
8
+ * https://iframe-resizer.com/pricing
9
9
  *
10
- * @desciption Keep same and cross domain iFrames sized to their content
10
+ * @description Keep same and cross domain iFrames sized to their content
11
11
  *
12
- * @author David J. Bradshaw <info@iframe-resizer.com>
12
+ * @author David J. Bradshaw <info@iframe-resizer.com>
13
13
  *
14
- * @see {@link https://iframe-resizer.com}
14
+ * @see {@link https://iframe-resizer.com}
15
15
  *
16
16
  * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
17
  */
18
18
 
19
19
 
20
20
  import _extends from '@babel/runtime/helpers/extends';
21
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
22
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
21
23
  import connectResizer from '@iframe-resizer/core';
22
24
  import React, { useRef, useEffect, useImperativeHandle } from 'react';
23
25
  import warning from 'warning';
24
26
 
25
- const filterIframeAttribs = (props => {
26
- const {
27
- license,
28
- bodyBackground,
29
- bodyMargin,
30
- bodyPadding,
31
- checkOrigin,
32
- direction,
33
- inPageLinks,
34
- offset,
35
- offsetHeight,
36
- offsetWidth,
37
- scrolling,
38
- tolerance,
39
- warningTimeout,
40
- waitForLoad,
41
- onClosed,
42
- onReady,
43
- onMessage,
44
- onResized,
45
- ...iframeProps
46
- } = props;
27
+ var _excluded$1 = ["license", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "direction", "inPageLinks", "log", "offset", "offsetHeight", "offsetWidth", "scrolling", "tolerance", "warningTimeout", "waitForLoad", "onClosed", "onReady", "onMessage", "onResized"];
28
+ const filterIframeAttribs = (function (props) {
29
+ props.license;
30
+ props.bodyBackground;
31
+ props.bodyMargin;
32
+ props.bodyPadding;
33
+ props.checkOrigin;
34
+ props.direction;
35
+ props.inPageLinks;
36
+ props.log;
37
+ props.offset;
38
+ props.offsetHeight;
39
+ props.offsetWidth;
40
+ props.scrolling;
41
+ props.tolerance;
42
+ props.warningTimeout;
43
+ props.waitForLoad;
44
+ props.onClosed;
45
+ props.onReady;
46
+ props.onMessage;
47
+ props.onResized;
48
+ var iframeProps = _objectWithoutProperties(props, _excluded$1);
47
49
  return iframeProps;
48
50
  });
49
51
 
52
+ var _excluded = ["title", "forwardRef"];
53
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
50
55
  function IframeResizer(props) {
51
56
  // eslint-disable-next-line react/prop-types
52
- const {
53
- title,
54
- forwardRef,
55
- ...rest
56
- } = props;
57
- const filteredProps = filterIframeAttribs(rest);
58
- const iframeRef = useRef(null);
59
- const onClose = () => {
60
- warning(!iframeRef.current, `[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
57
+ var title = props.title,
58
+ forwardRef = props.forwardRef,
59
+ rest = _objectWithoutProperties(props, _excluded);
60
+ var filteredProps = filterIframeAttribs(rest);
61
+ var iframeRef = useRef(null);
62
+ var onClose = function onClose() {
63
+ var _iframeRef$current;
64
+ warning(!iframeRef.current, "[iframe-resizer/react][".concat(iframeRef === null || iframeRef === void 0 || (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : _iframeRef$current.id, "] Close event ignored, to remove the iframe update your React component."));
61
65
  return !iframeRef.current; // Allow React to close this
62
66
  };
63
67
 
64
68
  // This hook is only run once, as once iframe-resizer is bound, it will
65
69
  // deal with changes to the element and does not need recalling
66
- useEffect(() => {
67
- const iframe = iframeRef.current;
68
- const resizer = connectResizer({
69
- ...rest,
70
- onClose
71
- })(iframe);
72
- return () => resizer?.disconnect();
70
+ useEffect(function () {
71
+ var iframe = iframeRef.current;
72
+ var resizer = connectResizer(_objectSpread(_objectSpread({}, rest), {}, {
73
+ onClose: onClose
74
+ }))(iframe);
75
+ return function () {
76
+ return resizer === null || resizer === void 0 ? void 0 : resizer.disconnect();
77
+ };
73
78
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
74
79
 
75
- useImperativeHandle(forwardRef, () => ({
76
- getRef: () => iframeRef,
77
- getElement: () => iframeRef.current,
78
- resize: () => iframeRef.current.iframeResizer.resize(),
79
- moveToAnchor: anchor => iframeRef.current.iframeResizer.moveToAnchor(anchor),
80
- sendMessage: (message, targetOrigin) => {
81
- iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
82
- }
83
- }));
80
+ useImperativeHandle(forwardRef, function () {
81
+ return {
82
+ getRef: function getRef() {
83
+ return iframeRef;
84
+ },
85
+ getElement: function getElement() {
86
+ return iframeRef.current;
87
+ },
88
+ resize: function resize() {
89
+ return iframeRef.current.iframeResizer.resize();
90
+ },
91
+ moveToAnchor: function moveToAnchor(anchor) {
92
+ return iframeRef.current.iframeResizer.moveToAnchor(anchor);
93
+ },
94
+ sendMessage: function sendMessage(message, targetOrigin) {
95
+ iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
96
+ }
97
+ };
98
+ });
84
99
  return /*#__PURE__*/React.createElement("iframe", _extends({
85
100
  title: title
86
101
  }, filteredProps, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/react",
3
- "version": "5.2.2-beta.2",
3
+ "version": "5.2.2-beta.3",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {
@@ -43,8 +43,8 @@
43
43
  "react"
44
44
  ],
45
45
  "dependencies": {
46
- "@babel/runtime": "^7.0.0",
47
- "@iframe-resizer/core": "5.2.2-beta.2",
46
+ "@babel/runtime": "^7.24.7",
47
+ "@iframe-resizer/core": "5.2.2-beta.3",
48
48
  "warning": "^4.0.3"
49
49
  }
50
50
  }