@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 CHANGED
@@ -1,8 +1,8 @@
1
1
  Iframe Resizer Version 5
2
2
 
3
- This JavaScript library is Copyright © 2013-2024 David J. Bradshaw, and is distobuted for non-comercial usage under the GPL V3. Comerercial license available upon request.
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 infomation on comercial licensing contact dave@bradshaw.net
5
+ For more information on commercial licensing contact dave@bradshaw.net
6
6
 
7
7
  --
8
8
 
package/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/react
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.0.0 2024-05-19 - 19:04:30.239Z_
25
+ _iframe-resizer version 5.0.2 2024-05-30 - 17:45:53.360Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/react 5.0.0 (cjs) - 2024-05-19
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 <dave@bradshaw.net>
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
- "use strict";const e=require("@babel/runtime/helpers/extends"),r=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/objectWithoutProperties"),t=require("@iframe-resizer/core"),o=require("react"),i=require("warning");var c=["license","bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offset","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onReady","onMessage","onResized"];var u=["title","forwardRef"];function s(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}module.exports=function(r){var s=r.title,f=void 0===s?"iframe":s,l=r.forwardRef,d=n(r,u),g=function(e){return e.license,e.bodyBackground,e.bodyMargin,e.bodyPadding,e.checkOrigin,e.inPageLinks,e.offset,e.offsetHeight,e.offsetWidth,e.scrolling,e.warningTimeout,e.tolerance,e.onClosed,e.onReady,e.onMessage,e.onResized,n(e,c)}(d),b=o.useRef(null),m=function(){var e;return i(!b.current,"[iframeSizerReact][".concat(null==b||null===(e=b.current)||void 0===e?void 0:e.id,"] Close event ignored, to remove the iframe update your React component")),!b.current};return o.useEffect((function(){var e=b.current,r=t(a(a({},d),{},{onClose:m}))(e);return function(){return null==r?void 0:r.disconnect()}}),[]),o.useImperativeHandle(l,(function(){return{getRef:function(){return b},getElement:function(){return b.current},resize:function(){return b.current.iframeResizer.resize()},moveToAnchor:function(e){return b.current.iframeResizer.moveToAnchor(e)},sendMessage:function(e,r){b.current.iframeResizer.sendMessage(e,r)}}})),o.createElement("iframe",e({title:f},g,{ref:b}))};
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.0 (esm) - 2024-05-19
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 <dave@bradshaw.net>
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 e from"@babel/runtime/helpers/extends";import r from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import n from"@iframe-resizer/core";import o,{useRef as i,useEffect as c,useImperativeHandle as f}from"react";import u from"warning";var a=["license","bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offset","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onReady","onMessage","onResized"];var s=["title","forwardRef"];function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function m(r){var l=r.title,m=void 0===l?"iframe":l,g=r.forwardRef,p=t(r,s),b=function(e){return e.license,e.bodyBackground,e.bodyMargin,e.bodyPadding,e.checkOrigin,e.inPageLinks,e.offset,e.offsetHeight,e.offsetWidth,e.scrolling,e.warningTimeout,e.tolerance,e.onClosed,e.onReady,e.onMessage,e.onResized,t(e,a)}(p),y=i(null),O=function(){var e;return u(!y.current,"[iframeSizerReact][".concat(null==y||null===(e=y.current)||void 0===e?void 0:e.id,"] Close event ignored, to remove the iframe update your React component")),!y.current};return c((function(){var e=y.current,r=n(d(d({},p),{},{onClose:O}))(e);return function(){return null==r?void 0:r.disconnect()}}),[]),f(g,(function(){return{getRef:function(){return y},getElement:function(){return y.current},resize:function(){return y.current.iframeResizer.resize()},moveToAnchor:function(e){return y.current.iframeResizer.moveToAnchor(e)},sendMessage:function(e,r){y.current.iframeResizer.sendMessage(e,r)}}})),o.createElement("iframe",e({title:m},b,{ref:y}))}export{m as default};
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.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": "dave@bradshaw.net"
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/licenses/"
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
- "auto-height",
32
- "iframe-auto-height",
33
- "height-iframe",
34
- "responsive-iframes",
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
- "heightiframe",
44
- "responsiveiframes",
42
+ "responsive",
45
43
  "react"
46
44
  ],
47
45
  "dependencies": {
48
- "@iframe-resizer/core": "5.0.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>