@iframe-resizer/react 5.0.0 → 5.0.2
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/LICENSE +2 -2
- package/README.md +1 -1
- package/index.cjs.js +89 -3
- package/index.esm.js +87 -3
- package/package.json +13 -15
- package/FUNDING.md +0 -5
package/LICENSE
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Iframe Resizer Version 5
|
|
2
2
|
|
|
3
|
-
This JavaScript library is Copyright © 2013-2024 David J. Bradshaw
|
|
3
|
+
This JavaScript library is Copyright © 2013-2024 David J. Bradshaw and is distributed under the GPL V3 for non-commercial use. A commercial license is available upon request.
|
|
4
4
|
|
|
5
|
-
For more
|
|
5
|
+
For more information on commercial licensing contact dave@bradshaw.net
|
|
6
6
|
|
|
7
7
|
--
|
|
8
8
|
|
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/react 5.0.
|
|
4
|
+
* @module iframe-resizer/react 5.0.2 (cjs) - 2024-05-30
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
|
-
* @author David J. Bradshaw <
|
|
12
|
+
* @author David J. Bradshaw <info@iframe-resizer.com>
|
|
13
13
|
*
|
|
14
14
|
* @see {@link https://iframe-resizer.com}
|
|
15
15
|
*
|
|
@@ -17,4 +17,90 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
const _extends = require('@babel/runtime/helpers/extends');
|
|
23
|
+
const _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
24
|
+
const _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
25
|
+
const connectResizer = require('@iframe-resizer/core');
|
|
26
|
+
const React = require('react');
|
|
27
|
+
const warning = require('warning');
|
|
28
|
+
|
|
29
|
+
var _excluded$1 = ["license", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "direction", "inPageLinks", "offset", "offsetHeight", "offsetWidth", "scrolling", "tolerance", "warningTimeout", "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.offset;
|
|
39
|
+
props.offsetHeight;
|
|
40
|
+
props.offsetWidth;
|
|
41
|
+
props.scrolling;
|
|
42
|
+
props.tolerance;
|
|
43
|
+
props.warningTimeout;
|
|
44
|
+
props.onClosed;
|
|
45
|
+
props.onReady;
|
|
46
|
+
props.onMessage;
|
|
47
|
+
props.onResized;
|
|
48
|
+
var iframeProps = _objectWithoutProperties(props, _excluded$1);
|
|
49
|
+
return iframeProps;
|
|
50
|
+
});
|
|
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; }
|
|
55
|
+
function IframeResizer(props) {
|
|
56
|
+
// eslint-disable-next-line react/prop-types
|
|
57
|
+
var title = props.title,
|
|
58
|
+
forwardRef = props.forwardRef,
|
|
59
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
60
|
+
var filteredProps = filterIframeAttribs(rest);
|
|
61
|
+
var iframeRef = React.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."));
|
|
65
|
+
return !iframeRef.current; // Allow React to close this
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// This hook is only run once, as once iframe-resizer is bound, it will
|
|
69
|
+
// deal with changes to the element and does not need recalling
|
|
70
|
+
React.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
|
+
};
|
|
78
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
79
|
+
|
|
80
|
+
React.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
|
+
});
|
|
99
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({
|
|
100
|
+
title: title
|
|
101
|
+
}, filteredProps, {
|
|
102
|
+
ref: iframeRef
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = IframeResizer;
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/react 5.0.
|
|
4
|
+
* @module iframe-resizer/react 5.0.2 (esm) - 2024-05-30
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
|
-
* @author David J. Bradshaw <
|
|
12
|
+
* @author David J. Bradshaw <info@iframe-resizer.com>
|
|
13
13
|
*
|
|
14
14
|
* @see {@link https://iframe-resizer.com}
|
|
15
15
|
*
|
|
@@ -17,4 +17,88 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
21
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
22
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
23
|
+
import connectResizer from '@iframe-resizer/core';
|
|
24
|
+
import React, { useRef, useEffect, useImperativeHandle } from 'react';
|
|
25
|
+
import warning from 'warning';
|
|
26
|
+
|
|
27
|
+
var _excluded$1 = ["license", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "direction", "inPageLinks", "offset", "offsetHeight", "offsetWidth", "scrolling", "tolerance", "warningTimeout", "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.offset;
|
|
37
|
+
props.offsetHeight;
|
|
38
|
+
props.offsetWidth;
|
|
39
|
+
props.scrolling;
|
|
40
|
+
props.tolerance;
|
|
41
|
+
props.warningTimeout;
|
|
42
|
+
props.onClosed;
|
|
43
|
+
props.onReady;
|
|
44
|
+
props.onMessage;
|
|
45
|
+
props.onResized;
|
|
46
|
+
var iframeProps = _objectWithoutProperties(props, _excluded$1);
|
|
47
|
+
return iframeProps;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
var _excluded = ["title", "forwardRef"];
|
|
51
|
+
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; }
|
|
52
|
+
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; }
|
|
53
|
+
function IframeResizer(props) {
|
|
54
|
+
// eslint-disable-next-line react/prop-types
|
|
55
|
+
var title = props.title,
|
|
56
|
+
forwardRef = props.forwardRef,
|
|
57
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
58
|
+
var filteredProps = filterIframeAttribs(rest);
|
|
59
|
+
var iframeRef = useRef(null);
|
|
60
|
+
var onClose = function onClose() {
|
|
61
|
+
var _iframeRef$current;
|
|
62
|
+
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
|
+
return !iframeRef.current; // Allow React to close this
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// This hook is only run once, as once iframe-resizer is bound, it will
|
|
67
|
+
// deal with changes to the element and does not need recalling
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
var iframe = iframeRef.current;
|
|
70
|
+
var resizer = connectResizer(_objectSpread(_objectSpread({}, rest), {}, {
|
|
71
|
+
onClose: onClose
|
|
72
|
+
}))(iframe);
|
|
73
|
+
return function () {
|
|
74
|
+
return resizer === null || resizer === void 0 ? void 0 : resizer.disconnect();
|
|
75
|
+
};
|
|
76
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
77
|
+
|
|
78
|
+
useImperativeHandle(forwardRef, function () {
|
|
79
|
+
return {
|
|
80
|
+
getRef: function getRef() {
|
|
81
|
+
return iframeRef;
|
|
82
|
+
},
|
|
83
|
+
getElement: function getElement() {
|
|
84
|
+
return iframeRef.current;
|
|
85
|
+
},
|
|
86
|
+
resize: function resize() {
|
|
87
|
+
return iframeRef.current.iframeResizer.resize();
|
|
88
|
+
},
|
|
89
|
+
moveToAnchor: function moveToAnchor(anchor) {
|
|
90
|
+
return iframeRef.current.iframeResizer.moveToAnchor(anchor);
|
|
91
|
+
},
|
|
92
|
+
sendMessage: function sendMessage(message, targetOrigin) {
|
|
93
|
+
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({
|
|
98
|
+
title: title
|
|
99
|
+
}, filteredProps, {
|
|
100
|
+
ref: iframeRef
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { IframeResizer as default };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iframe-resizer/react",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"homepage": "https://iframe-resizer.com",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "David J. Bradshaw",
|
|
8
|
-
"email": "
|
|
8
|
+
"email": "info@iframe-resizer.com"
|
|
9
9
|
},
|
|
10
10
|
"description": "Keep same and cross domain iFrames sized to their content.",
|
|
11
11
|
"github": "https://github.com/davidjbradshaw/iframe-resizer",
|
|
@@ -15,37 +15,35 @@
|
|
|
15
15
|
},
|
|
16
16
|
"funding": {
|
|
17
17
|
"type": "individual",
|
|
18
|
-
"url": "https://iframe-resizer.com/
|
|
18
|
+
"url": "https://iframe-resizer.com/pricing/"
|
|
19
19
|
},
|
|
20
|
+
"main": "index.cjs.js",
|
|
21
|
+
"module": "index.esm.js",
|
|
22
|
+
"types": "iframe-resizer.react.d.ts",
|
|
20
23
|
"peerDependencies": {
|
|
21
24
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
22
25
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
23
26
|
},
|
|
24
|
-
"main": "index.cjs.js",
|
|
25
|
-
"module": "index.esm.js",
|
|
26
|
-
"types": "iframe-resizer.react.d.ts",
|
|
27
27
|
"keywords": [
|
|
28
28
|
"iframe",
|
|
29
29
|
"Resizing",
|
|
30
30
|
"Resizer",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"Cross-Domain",
|
|
31
|
+
"resize",
|
|
32
|
+
"cross",
|
|
33
|
+
"same",
|
|
34
|
+
"domain",
|
|
36
35
|
"width",
|
|
36
|
+
"height",
|
|
37
37
|
"postMessage",
|
|
38
38
|
"mutationObserver",
|
|
39
39
|
"resizeObserver",
|
|
40
40
|
"RWD",
|
|
41
|
-
"autoheight",
|
|
42
41
|
"CrossDomain",
|
|
43
|
-
"
|
|
44
|
-
"responsiveiframes",
|
|
42
|
+
"responsive",
|
|
45
43
|
"react"
|
|
46
44
|
],
|
|
47
45
|
"dependencies": {
|
|
48
|
-
"@iframe-resizer/core": "5.0.
|
|
46
|
+
"@iframe-resizer/core": "5.0.2",
|
|
49
47
|
"warning": "^4.0.3"
|
|
50
48
|
}
|
|
51
49
|
}
|
package/FUNDING.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Donate to Iframe-Resizer
|
|
2
|
-
|
|
3
|
-
Iframe-resizer is the result of many 100s of hours of work, if you would like to join others in showing support for the development of this project, then please feel free to buy me a coffee.
|
|
4
|
-
|
|
5
|
-
<a href="https://www.buymeacoffee.com/davidjbradshaw " target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|