@iframe-resizer/react 5.0.0-alpha.1 → 5.0.0-alpha.11

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
@@ -1,6 +1,15 @@
1
- ## @iframe-resizer/react
1
+ <img src="https://iframe-resizer.com/logo-full.png" alt="" title="" />
2
2
 
3
- This is package is part of [iframe-resizer](http://davidjbradshaw.github.io/iframe-resizer/).
3
+ # @iframe-resizer/react
4
4
 
5
- --
6
- _ iframe-resizer version 5.0.0-alpha.1 2024-04-12 - 13:11:29.509Z _
5
+ > _Keep same and cross domain iframes sized to their content_
6
+
7
+ This package is an alpha release of version 5 of _iframe-resizer_ for the production version see the [iframe-resizer](https://www.npmjs.com/package/iframe-resizer) package.
8
+
9
+ This version has an unstable API and should not be used on production sites.
10
+
11
+ Alpha version 5 docs: http://iframe-resizer.com/.
12
+
13
+ ---
14
+
15
+ _iframe-resizer version 5.0.0-alpha.11 2024-04-26 - 12:19:19.804Z_
@@ -1,57 +1,61 @@
1
- declare module "iframe-resizer-react" {
2
- import * as React from "react";
1
+ declare module '@iframe-resizer/react' {
2
+ import * as React from 'react'
3
3
 
4
4
  namespace IframeResizer {
5
5
  type IFrameObject = {
6
- close: () => void;
7
- moveToAnchor: (anchor: string) => void;
8
- resize: () => void;
9
- sendMessage: (message: any, targetOrigin?: string) => void;
10
- removeListeners: () => void;
11
- };
6
+ moveToAnchor: (anchor: string) => void
7
+ resize: () => void
8
+ sendMessage: (message: any, targetOrigin?: string) => void
9
+ }
12
10
  interface IFrameComponent extends HTMLIFrameElement {
13
- iFrameResizer: IFrameObject;
11
+ iFrameResizer: IFrameObject
12
+ }
13
+
14
+ type IFrameForwardRef = Omit<IFrameObject, 'close' | 'removeListeners'> & {
15
+ getIframeElement: () => IFrameComponent
14
16
  }
15
17
 
16
18
  type IframeProps = React.DetailedHTMLProps<
17
19
  React.IframeHTMLAttributes<HTMLIFrameElement>,
18
20
  HTMLIFrameElement
19
- >;
21
+ >
20
22
 
21
23
  type ResizerOptions = {
22
- bodyBackground?: string | null;
23
- bodyMargin?: string | number | null;
24
- bodyPadding?: string | number | null;
25
- checkOrigin?: boolean | string[];
26
- direction?: "vertical" | "horizontal" | "none";
27
- forwardRef?: any;
28
- inPageLinks?: boolean;
29
- enablePublicMethods?: boolean;
30
- offsetHeight?: number;
31
- offsetWidth?: number;
32
- scrolling?: boolean | "omit";
33
- tolerance?: number;
34
- };
24
+ bodyBackground?: string | null
25
+ bodyMargin?: string | number | null
26
+ bodyPadding?: string | number | null
27
+ checkOrigin?: boolean | string[]
28
+ direction?: 'vertical' | 'horizontal' | 'none'
29
+ forwardRef?: any
30
+ inPageLinks?: boolean
31
+ license: string
32
+ enablePublicMethods?: boolean
33
+ offsetHeight?: number
34
+ offsetWidth?: number
35
+ scrolling?: boolean | 'omit'
36
+ tolerance?: number
37
+ warningTimeout?: number
38
+ }
35
39
 
36
40
  type ResizerEvents = {
37
- onInit?: (iframe: IFrameComponent) => void;
38
- onMessage?: (ev: { iframe: IFrameComponent; message: any }) => void;
41
+ onInit?: (iframe: IFrameComponent) => void
42
+ onMessage?: (ev: { iframe: IFrameComponent; message: any }) => void
39
43
  onResized?: (ev: {
40
- iframe: IFrameComponent;
41
- height: number;
42
- width: number;
43
- type: string;
44
- }) => void;
45
- onScroll?: (ev: { x: number; y: number }) => boolean;
46
- };
44
+ iframe: IFrameComponent
45
+ height: number
46
+ width: number
47
+ type: string
48
+ }) => void
49
+ onScroll?: (ev: { x: number; y: number }) => boolean
50
+ }
47
51
 
48
- type IframeResizerProps = Omit<IframeProps, "scrolling"> &
52
+ type IframeResizerProps = Omit<IframeProps, 'scrolling'> &
49
53
  ResizerOptions &
50
- ResizerEvents;
54
+ ResizerEvents
51
55
  }
52
56
 
53
57
  function IframeResizer(
54
- props: IframeResizer.IframeResizerProps
55
- ): React.ReactElement;
56
- export = IframeResizer;
58
+ props: IframeResizer.IframeResizerProps,
59
+ ): React.ReactElement
60
+ export = IframeResizer
57
61
  }
package/index.cjs.js ADDED
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * @preserve
3
+ *
4
+ * @module iframe-resizer/react 5.0.0-alpha.11 (cjs) - 2024-04-26
5
+ *
6
+ * @license GPL-3.0 for non-commercial use only.
7
+ * For commercial use, you must purchase a license from
8
+ * http://iframe-resizer.com/pricing
9
+ *
10
+ * @desciption Keep same and cross domain iFrames sized to their content
11
+ *
12
+ * @author David J. Bradshaw <dave@bradshaw.net>
13
+ *
14
+ * @see {@link http://iframe-resizer.com}
15
+ *
16
+ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
+ */
18
+
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"),i=require("prop-types"),o=require("react"),c=require("warning");var u=["bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onInit","onMessage","onResized"];var s=["title","forwardRef"];function a(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 f(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function l(r){var i=r.title,a=void 0===i?"iframe":i,l=r.forwardRef,d=n(r,s),g=function(e){return e.bodyBackground,e.bodyMargin,e.bodyPadding,e.checkOrigin,e.inPageLinks,e.offsetHeight,e.offsetWidth,e.scrolling,e.warningTimeout,e.tolerance,e.onClosed,e.onInit,e.onMessage,e.onResized,n(e,u)}(d),p=o.useRef(null),b=function(){var e;return c(!p.current,"[iframeSizerReact][".concat(null==p||null===(e=p.current)||void 0===e?void 0:e.id,"] Close event ignored, to remove the iframe update your React component")),!p.current};return o.useEffect((function(){var e=p.current,r=t(f(f({},d),{},{onClose:b}))(e);return function(){return null==r?void 0:r.disconnect()}}),[]),o.useImperativeHandle(l,(function(){return{getIframeElement:function(){return p.current},resize:function(){return p.current.iFrameResizer.resize()},moveToAnchor:function(e){return p.current.iFrameResizer.moveToAnchor(e)},sendMessage:function(e,r){p.current.iFrameResizer.sendMessage(e,r)}}})),o.createElement("iframe",e({title:a},g,{ref:p}))}l.propTypes={title:i.string},module.exports=l;
package/index.esm.js ADDED
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * @preserve
3
+ *
4
+ * @module iframe-resizer/react 5.0.0-alpha.11 (esm) - 2024-04-26
5
+ *
6
+ * @license GPL-3.0 for non-commercial use only.
7
+ * For commercial use, you must purchase a license from
8
+ * http://iframe-resizer.com/pricing
9
+ *
10
+ * @desciption Keep same and cross domain iFrames sized to their content
11
+ *
12
+ * @author David J. Bradshaw <dave@bradshaw.net>
13
+ *
14
+ * @see {@link http://iframe-resizer.com}
15
+ *
16
+ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
+ */
18
+
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 from"prop-types";import i,{useRef as c,useEffect as u,useImperativeHandle as a}from"react";import s from"warning";var f=["bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onInit","onMessage","onResized"];var l=["title","forwardRef"];function m(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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function d(r){var o=r.title,m=void 0===o?"iframe":o,d=r.forwardRef,g=t(r,l),b=function(e){return e.bodyBackground,e.bodyMargin,e.bodyPadding,e.checkOrigin,e.inPageLinks,e.offsetHeight,e.offsetWidth,e.scrolling,e.warningTimeout,e.tolerance,e.onClosed,e.onInit,e.onMessage,e.onResized,t(e,f)}(g),y=c(null),O=function(){var e;return s(!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 u((function(){var e=y.current,r=n(p(p({},g),{},{onClose:O}))(e);return function(){return null==r?void 0:r.disconnect()}}),[]),a(d,(function(){return{getIframeElement: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)}}})),i.createElement("iframe",e({title:m},b,{ref:y}))}d.propTypes={title:o.string};export{d as default};
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@iframe-resizer/react",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.11",
4
4
  "license": "GPL-3.0",
5
- "private": false,
6
- "homepage": "https://iframeresizer.com",
5
+ "homepage": "http://iframe-resizer.com",
7
6
  "author": {
8
7
  "name": "David J. Bradshaw",
9
8
  "email": "dave@bradshaw.net"
@@ -22,8 +21,8 @@
22
21
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
23
22
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
24
23
  },
25
- "main": "iframe-resizer.react.cjs.js",
26
- "module": "iframe-resizer.react.esm.js",
24
+ "main": "index.cjs.js",
25
+ "module": "index.esm.js",
27
26
  "types": "iframe-resizer.react.d.ts",
28
27
  "keywords": [
29
28
  "iFrame",
@@ -46,7 +45,7 @@
46
45
  "react"
47
46
  ],
48
47
  "dependencies": {
49
- "@iframe-resizer/core": "5.0.0-alpha.1",
48
+ "@iframe-resizer/core": "5.0.0-alpha.11",
50
49
  "prop-types": "^15.8.1",
51
50
  "warning": "^4.0.3"
52
51
  }
@@ -1,20 +0,0 @@
1
- /*!
2
- * @preserve
3
- *
4
- * @module iframe-resizer/react 5.0.0-alpha.1 (cjs) - 2024-04-12
5
- *
6
- * @license GPL-3.0 for non-commercial use only.
7
- * For commercial use, you must purchase a license from
8
- * https://iframeresizer.com/pricing
9
- *
10
- * @desciption Keep same and cross domain iFrames sized to their content
11
- *
12
- * @author David J. Bradshaw <dave@bradshaw.net>
13
- *
14
- * @see {@link https://iframeresizer.com}
15
- *
16
- * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
- */
18
-
19
-
20
- "use strict";const e=require("@babel/runtime/helpers/extends"),r=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@iframe-resizer/core"),i=require("prop-types"),o=require("react"),c=require("warning");var u=["bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onInit","onMessage","onResized"];var s=["title","forwardRef"];function a(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function l(r){var i=r.title,a=r.forwardRef,l=t(r,s),d=function(e){return e.bodyBackground,e.bodyMargin,e.bodyPadding,e.checkOrigin,e.inPageLinks,e.offsetHeight,e.offsetWidth,e.scrolling,e.warningTimeout,e.tolerance,e.onClosed,e.onInit,e.onMessage,e.onResized,t(e,u)}(l),p=o.useRef(null),g=function(){return c(!p.current,"[iframeSizerReact][".concat(p&&p.current&&p.current.id,"] Close event ignored, to remove the iframe update your React component")),!p.current};return o.useEffect((function(){var e=p.current;return n(f(f({},l),{},{onClose:g}))(e),function(){return null==e?void 0:e.iFrameResizer.removeListeners()}}),[]),o.useImperativeHandle(a,(function(){return{resize:function(){return p.current.iFrameResizer.resize()},moveToAnchor:function(e){return p.current.iFrameResizer.moveToAnchor(e)},sendMessage:function(e,r){p.current.iFrameResizer.sendMessage(e,r)}}})),o.createElement("iframe",e({title:i},d,{ref:p}))}l.defaultProps={title:"iframe"},l.propTypes={title:i.string,forwardRef:i.oneOfType([i.func,i.shape({current:i.any})]).isRequired},module.exports=l;
@@ -1,20 +0,0 @@
1
- /*!
2
- * @preserve
3
- *
4
- * @module iframe-resizer/react 5.0.0-alpha.1 (esm) - 2024-04-12
5
- *
6
- * @license GPL-3.0 for non-commercial use only.
7
- * For commercial use, you must purchase a license from
8
- * https://iframeresizer.com/pricing
9
- *
10
- * @desciption Keep same and cross domain iFrames sized to their content
11
- *
12
- * @author David J. Bradshaw <dave@bradshaw.net>
13
- *
14
- * @see {@link https://iframeresizer.com}
15
- *
16
- * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
- */
18
-
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 from"prop-types";import i,{useRef as c,useEffect as s,useImperativeHandle as a}from"react";import f from"warning";var u=["bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onInit","onMessage","onResized"];var p=["title","forwardRef"];function m(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function d(r){var o=r.title,m=r.forwardRef,d=t(r,p),g=function(e){return e.bodyBackground,e.bodyMargin,e.bodyPadding,e.checkOrigin,e.inPageLinks,e.offsetHeight,e.offsetWidth,e.scrolling,e.warningTimeout,e.tolerance,e.onClosed,e.onInit,e.onMessage,e.onResized,t(e,u)}(d),b=c(null),y=function(){return f(!b.current,"[iframeSizerReact][".concat(b&&b.current&&b.current.id,"] Close event ignored, to remove the iframe update your React component")),!b.current};return s((function(){var e=b.current;return n(l(l({},d),{},{onClose:y}))(e),function(){return null==e?void 0:e.iFrameResizer.removeListeners()}}),[]),a(m,(function(){return{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)}}})),i.createElement("iframe",e({title:o},g,{ref:b}))}d.defaultProps={title:"iframe"},d.propTypes={title:o.string,forwardRef:o.oneOfType([o.func,o.shape({current:o.any})]).isRequired};export{d as default};