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

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,13 @@
1
- ## @iframe-resizer/react
1
+ # @iframe-resizer/react
2
2
 
3
- This is package is part of [iframe-resizer](http://davidjbradshaw.github.io/iframe-resizer/).
3
+ > _Keep same and cross domain iframes sized to their content_
4
4
 
5
- --
6
- _ iframe-resizer version 5.0.0-alpha.1 2024-04-12 - 13:11:29.509Z _
5
+ 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.
6
+
7
+ This version has an unstable API and should not be used on production sites.
8
+
9
+ Alpha version 5 docs: http://iframe-resizer.com/.
10
+
11
+ ---
12
+
13
+ _iframe-resizer version 5.0.0-alpha.10 2024-04-24 - 11:25:20.781Z_
@@ -1,57 +1,60 @@
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
+ }
35
38
 
36
39
  type ResizerEvents = {
37
- onInit?: (iframe: IFrameComponent) => void;
38
- onMessage?: (ev: { iframe: IFrameComponent; message: any }) => void;
40
+ onInit?: (iframe: IFrameComponent) => void
41
+ onMessage?: (ev: { iframe: IFrameComponent; message: any }) => void
39
42
  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
- };
43
+ iframe: IFrameComponent
44
+ height: number
45
+ width: number
46
+ type: string
47
+ }) => void
48
+ onScroll?: (ev: { x: number; y: number }) => boolean
49
+ }
47
50
 
48
- type IframeResizerProps = Omit<IframeProps, "scrolling"> &
51
+ type IframeResizerProps = Omit<IframeProps, 'scrolling'> &
49
52
  ResizerOptions &
50
- ResizerEvents;
53
+ ResizerEvents
51
54
  }
52
55
 
53
56
  function IframeResizer(
54
- props: IframeResizer.IframeResizerProps
55
- ): React.ReactElement;
56
- export = IframeResizer;
57
+ props: IframeResizer.IframeResizerProps,
58
+ ): React.ReactElement
59
+ export = IframeResizer
57
60
  }
@@ -1,20 +1,20 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/react 5.0.0-alpha.1 (cjs) - 2024-04-12
4
+ * @module iframe-resizer/react 5.0.0-alpha.10 (cjs) - 2024-04-24
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
8
- * https://iframeresizer.com/pricing
8
+ * http://iframe-resizer.com/pricing
9
9
  *
10
10
  * @desciption Keep same and cross domain iFrames sized to their content
11
11
  *
12
12
  * @author David J. Bradshaw <dave@bradshaw.net>
13
13
  *
14
- * @see {@link https://iframeresizer.com}
14
+ * @see {@link http://iframe-resizer.com}
15
15
  *
16
16
  * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
17
  */
18
18
 
19
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;
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=void 0===i?"iframe":i,l=r.forwardRef,d=t(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,t(e,u)}(d),p=o.useRef(null),b=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,r=n(f(f({},d),{},{onClose:b}))(e);return function(){return 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.10 (esm) - 2024-04-24
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 a,useImperativeHandle as s}from"react";import u from"warning";var f=["bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","offsetHeight","offsetWidth","scrolling","warningTimeout","tolerance","onClosed","onInit","onMessage","onResized"];var m=["title","forwardRef"];function p(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?p(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function d(r){var o=r.title,p=void 0===o?"iframe":o,d=r.forwardRef,g=t(r,m),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(){return u(!y.current,"[iframeSizerReact][".concat(y&&y.current&&y.current.id,"] Close event ignored, to remove the iframe update your React component")),!y.current};return a((function(){var e=y.current,r=n(l(l({},g),{},{onClose:O}))(e);return function(){return r.disconnect()}}),[]),s(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:p},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.10",
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.10",
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 (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};