🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

@iframe-resizer/react

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iframe-resizer/react - npm Package Compare versions

Comparing version
6.0.0-beta.2
to
6.0.0-beta.3
+1
-1
filter-iframe-attribs.d.ts

@@ -1,2 +0,2 @@

declare const _default: ({ license, bodyBackground, bodyMargin, bodyPadding, checkOrigin, direction, inPageLinks, log, offset, offsetHeight, offsetWidth, scrolling, tolerance, warningTimeout, waitForLoad, onAfterClose, onReady, onMessage, onResized, ...iframeProps }: Record<string, unknown>) => Record<string, unknown>;
declare const _default: ({ license, bodyBackground, bodyMargin, bodyPadding, checkOrigin, direction, inPageLinks, log, logExpand, offsetSize, scrolling, tolerance, waitForLoad, warningTimeout, onAfterClose, onMessage, onMouseEnter, onMouseLeave, onReady, onResized, onScroll, ...iframeProps }: Record<string, unknown>) => Record<string, unknown>;
export default _default;

@@ -1,2 +0,2 @@

"use strict";const g=require("@iframe-resizer/core"),m=require("auto-console-group"),t=require("react"),R=e=>e?.__esModule?e.default:e,p=({license:e,bodyBackground:c,bodyMargin:i,bodyPadding:a,checkOrigin:f,direction:r,inPageLinks:n,log:u,offset:o,offsetHeight:s,offsetWidth:l,scrolling:A,tolerance:M,warningTimeout:b,waitForLoad:y,onAfterClose:C,onReady:w,onMessage:x,onResized:E,...d})=>d,z=R(m);function v(e,c){const{log:i,logExpand:a}=e,f=p(e),r=t.useRef(null),n=z(),u=()=>(n.event("close"),n.warn("Close event ignored, to remove the iframe update your React component."),!1);return t.useEffect(()=>{const o=r.current,s={...e,onBeforeClose:u};n.label(`react(${o.id})`),n.event("setup");const l=g(s)(o);return n.expand(a),i&&n.log("Created React component"),()=>{n.endAutoGroup(),l?.disconnect()}},[]),t.useImperativeHandle(c,()=>({getRef:()=>r,getElement:()=>r.current,resize:()=>r.current.iframeResizer.resize(),moveToAnchor:o=>r.current.iframeResizer.moveToAnchor(o),sendMessage:(o,s)=>{r.current.iframeResizer.sendMessage(o,s)}})),t.createElement("iframe",{...f,ref:r})}const h=t.forwardRef(v);module.exports=h;
"use strict";const g=require("@iframe-resizer/core"),m=require("auto-console-group"),t=require("react"),R=e=>e?.__esModule?e.default:e,p=({license:e,bodyBackground:c,bodyMargin:i,bodyPadding:a,checkOrigin:u,direction:n,inPageLinks:o,log:l,logExpand:r,offsetSize:s,scrolling:d,tolerance:A,waitForLoad:E,warningTimeout:b,onAfterClose:x,onMessage:y,onMouseEnter:C,onMouseLeave:h,onReady:w,onResized:I,onScroll:k,...f})=>f,v=R(m);function z(e,c){const{log:i,logExpand:a}=e,u=p(e),n=t.useRef(null),o=v(),l=()=>(o.event("close"),o.warn("Close event ignored, to remove the iframe update your React component."),!1);return t.useEffect(()=>{const r=n.current,s={...e,onBeforeClose:l};o.label(`react(${r.id})`),o.event("setup");const d=g(s)(r);return o.expand(a),i&&o.log("Created React component"),()=>{o.endAutoGroup(),d?.disconnect()}},[]),t.useImperativeHandle(c,()=>({getRef:()=>n,getElement:()=>n.current,moveToAnchor:r=>n.current.iframeResizer.moveToAnchor(r),sendMessage:(r,s)=>{n.current.iframeResizer.sendMessage(r,s)}})),t.createElement("iframe",{...u,ref:n})}const M=t.forwardRef(z);module.exports=M;
//# sourceMappingURL=index.cjs.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.cjs.js","sources":["../../packages/common/utils.ts","../../packages/react/filter-iframe-attribs.ts","../../packages/react/index.tsx"],"sourcesContent":["import { OBJECT, STRING } from './consts'\n\nexport const isElement = (node: Node): boolean =>\n node.nodeType === Node.ELEMENT_NODE\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value)\nexport const isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === OBJECT && value !== null\nexport const isString = (value: unknown): value is string =>\n typeof value === STRING\n\nexport const isSafari: boolean = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent,\n)\n\nexport function isIframe(element: unknown): element is HTMLIFrameElement {\n if (!isObject(element)) return false\n\n try {\n return (\n (element as unknown as HTMLElement).tagName === 'IFRAME' ||\n element instanceof HTMLIFrameElement\n )\n } catch (error) {\n return false\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\nexport const isolateUserCode = (\n func: AnyFunction,\n ...val: unknown[]\n): ReturnType<typeof setTimeout> => setTimeout(() => func(...val), 0)\n\nexport const once = <T extends AnyFunction>(fn: T): T => {\n let done = false\n\n return function (this: unknown, ...args: unknown[]) {\n return done ? undefined : ((done = true), fn.apply(this, args))\n } as unknown as T\n}\n\nconst hasOwnFallback = (o: object, k: PropertyKey): boolean =>\n Object.prototype.hasOwnProperty.call(o, k)\n\nexport const hasOwn = (o: object, k: PropertyKey): boolean =>\n Object.hasOwn ? Object.hasOwn(o, k) : hasOwnFallback(o, k)\n\nexport const isDarkModeEnabled = (): boolean =>\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n\nexport const id = <T>(x: T): T => x\n\nconst ROUNDING = 1000\n\nexport const round = (value: number): number =>\n Math.round(value * ROUNDING) / ROUNDING\n\nexport const capitalizeFirstLetter = (string: string): string =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const isDef = (value: unknown): boolean =>\n `${value}` !== '' && value !== undefined\n\nexport const invoke = <T>(fn: () => T): T => fn()\n\nexport const lower = (str: string): string => str.toLowerCase()\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getElementName(el: any): string {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName} (${el.name}`\n\n case isDef(el.className):\n return `${el.nodeName}.${el.className}`\n\n default:\n return el.nodeName\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const esModuleInterop = <T = any>(mod: any): T =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\nexport const typeAssert = (\n value: unknown,\n type: string,\n error: string,\n): void => {\n // eslint-disable-next-line valid-typeof\n if (typeof value !== type) {\n throw new TypeError(`${error} is not a ${capitalizeFirstLetter(type)}`)\n }\n}\n","export default ({\n license,\n bodyBackground,\n bodyMargin,\n bodyPadding,\n checkOrigin,\n direction,\n inPageLinks,\n log,\n offset,\n offsetHeight,\n offsetWidth,\n scrolling,\n tolerance,\n warningTimeout,\n waitForLoad,\n onAfterClose,\n onReady,\n onMessage,\n onResized,\n ...iframeProps\n}: Record<string, unknown>): Record<string, unknown> => iframeProps\n","// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable react/require-default-props */\nimport type {\n Direction,\n IFrameComponent,\n IFrameMessageData,\n IFrameMouseData,\n IFrameObject,\n IFrameResizedData,\n IFrameScrollData,\n LogOption,\n ScrollOption,\n} from '@iframe-resizer/core'\nimport connectResizer from '@iframe-resizer/core'\nimport acg from 'auto-console-group'\nimport React, {\n forwardRef,\n type ReactElement,\n type RefObject,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\n\nimport { esModuleInterop } from '../common/utils'\nimport filterIframeAttribs from './filter-iframe-attribs'\n\nexport type IFrameForwardRef = Omit<IFrameObject, 'close' | 'disconnect'> & {\n getElement: () => IFrameComponent\n getRef: () => RefObject<HTMLIFrameElement | null>\n}\n\ntype IframeProps = React.DetailedHTMLProps<\n React.IframeHTMLAttributes<HTMLIFrameElement>,\n HTMLIFrameElement\n>\n\nexport type ResizerOptions = {\n bodyBackground?: string | null\n bodyMargin?: string | number | null\n bodyPadding?: string | number | null\n checkOrigin?: boolean | string[]\n direction?: Direction\n inPageLinks?: boolean\n license: string\n log?: LogOption\n logExpand?: boolean\n offsetSize?: number\n scrolling?: ScrollOption\n tolerance?: number\n waitForLoad?: boolean\n warningTimeout?: number\n}\n\nexport type ResizerEvents = {\n onAfterClose?: (iframeId: string) => void\n onMessage?: (ev: IFrameMessageData) => void\n onMouseEnter?: (ev: IFrameMouseData) => void\n onMouseLeave?: (ev: IFrameMouseData) => void\n onReady?: (iframe: IFrameComponent) => void\n onResized?: (ev: IFrameResizedData) => void\n onScroll?: (ev: IFrameScrollData) => boolean\n}\n\nexport type IframeResizerProps = Omit<IframeProps, 'scrolling'> &\n ResizerOptions &\n ResizerEvents\n\n// Deal with UMD not converting default exports to named exports\nconst createAutoConsoleGroup = esModuleInterop(acg)\n\nfunction IframeResizer(\n props: IframeResizerProps,\n ref: React.ForwardedRef<IFrameForwardRef>,\n): ReactElement {\n const { log, logExpand } = props\n const filteredProps = filterIframeAttribs(props)\n const iframeRef = useRef<IFrameComponent>(null)\n const consoleGroup = createAutoConsoleGroup()\n\n const onBeforeClose = (): boolean => {\n consoleGroup.event('close')\n consoleGroup.warn(\n `Close event ignored, to remove the iframe update your React component.`,\n )\n\n return false\n }\n\n // This hook is only run once, as once iframe-resizer is bound, it will\n // deal with changes to the element and does not need recalling\n useEffect(() => {\n const iframe = iframeRef.current\n const resizerOptions = { ...props, onBeforeClose }\n\n consoleGroup.label(`react(${iframe.id})`)\n consoleGroup.event('setup')\n\n const resizer = connectResizer(resizerOptions)(iframe)\n\n consoleGroup.expand(logExpand)\n if (log) consoleGroup.log('Created React component')\n\n return () => {\n consoleGroup.endAutoGroup()\n resizer?.disconnect()\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n useImperativeHandle(ref, () => ({\n getRef: () => iframeRef,\n getElement: () => iframeRef.current,\n resize: () => iframeRef.current.iframeResizer.resize(),\n moveToAnchor: (anchor: string) =>\n iframeRef.current.iframeResizer.moveToAnchor(anchor),\n sendMessage: (message: string, targetOrigin?: string) => {\n iframeRef.current.iframeResizer.sendMessage(message, targetOrigin)\n },\n }))\n\n // eslint-disable-next-line jsx-a11y/iframe-has-title\n return <iframe {...filteredProps} ref={iframeRef} />\n}\n\nexport default forwardRef<IFrameForwardRef, IframeResizerProps>(IframeResizer)\n\nexport { type IFrameComponent, type IFrameObject } from '@iframe-resizer/core'\n"],"names":["esModuleInterop","mod","filterIframeAttribs","license","bodyBackground","bodyMargin","bodyPadding","checkOrigin","direction","inPageLinks","log","offset","offsetHeight","offsetWidth","scrolling","tolerance","warningTimeout","waitForLoad","onAfterClose","onReady","onMessage","onResized","iframeProps","createAutoConsoleGroup","acg","IframeResizer","props","ref","logExpand","filteredProps","iframeRef","useRef","consoleGroup","onBeforeClose","useEffect","iframe","resizerOptions","resizer","connectResizer","useImperativeHandle","anchor","message","targetOrigin","React","index","forwardRef"],"mappings":"wGA2FaA,EAA4BC,GAEvCA,GAAK,WAAaA,EAAI,QAAUA,EC7FlCC,EAAe,CAAC,CACd,QAAAC,EACA,eAAAC,EACA,WAAAC,EACA,YAAAC,EACA,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,IAAAC,EACA,OAAAC,EACA,aAAAC,EACA,YAAAC,EACA,UAAAC,EACA,UAAAC,EACA,eAAAC,EACA,YAAAC,EACA,aAAAC,EACA,QAAAC,EACA,UAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IAAwDA,ECgDlDC,EAAyBvB,EAAgBwB,CAAG,EAElD,SAASC,EACPC,EACAC,EACc,CACd,KAAM,CAAE,IAAAjB,EAAK,UAAAkB,CAAA,EAAcF,EACrBG,EAAgB3B,EAAoBwB,CAAK,EACzCI,EAAYC,EAAAA,OAAwB,IAAI,EACxCC,EAAeT,EAAA,EAEfU,EAAgB,KACpBD,EAAa,MAAM,OAAO,EAC1BA,EAAa,KACX,wEAAA,EAGK,IAKTE,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAASL,EAAU,QACnBM,EAAiB,CAAE,GAAGV,EAAO,cAAAO,CAAA,EAEnCD,EAAa,MAAM,SAASG,EAAO,EAAE,GAAG,EACxCH,EAAa,MAAM,OAAO,EAE1B,MAAMK,EAAUC,EAAeF,CAAc,EAAED,CAAM,EAErD,OAAAH,EAAa,OAAOJ,CAAS,EACzBlB,GAAKsB,EAAa,IAAI,yBAAyB,EAE5C,IAAM,CACXA,EAAa,aAAA,EACbK,GAAS,WAAA,CACX,CACF,EAAG,CAAA,CAAE,EAELE,EAAAA,oBAAoBZ,EAAK,KAAO,CAC9B,OAAQ,IAAMG,EACd,WAAY,IAAMA,EAAU,QAC5B,OAAQ,IAAMA,EAAU,QAAQ,cAAc,OAAA,EAC9C,aAAeU,GACbV,EAAU,QAAQ,cAAc,aAAaU,CAAM,EACrD,YAAa,CAACC,EAAiBC,IAA0B,CACvDZ,EAAU,QAAQ,cAAc,YAAYW,EAASC,CAAY,CACnE,CAAA,EACA,EAGKC,EAAA,cAAC,SAAA,CAAQ,GAAGd,EAAe,IAAKC,EAAW,CACpD,CAEA,MAAAc,EAAeC,EAAAA,WAAiDpB,CAAa"}
{"version":3,"file":"index.cjs.js","sources":["../../packages/common/utils.ts","../../packages/react/filter-iframe-attribs.ts","../../packages/react/index.tsx"],"sourcesContent":["import { OBJECT, STRING } from './consts'\n\nexport const isElement = (node: Node): boolean =>\n node.nodeType === Node.ELEMENT_NODE\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value)\nexport const isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === OBJECT && value !== null\nexport const isString = (value: unknown): value is string =>\n typeof value === STRING\n\nexport const isSafari: boolean = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent,\n)\n\nexport function isIframe(element: unknown): element is HTMLIFrameElement {\n if (!isObject(element)) return false\n\n try {\n return (\n (element as unknown as HTMLElement).tagName === 'IFRAME' ||\n element instanceof HTMLIFrameElement\n )\n } catch (error) {\n return false\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\nexport const isolateUserCode = (\n func: AnyFunction,\n ...val: unknown[]\n): ReturnType<typeof setTimeout> => setTimeout(() => func(...val), 0)\n\nexport const once = <T extends AnyFunction>(fn: T): T => {\n let done = false\n\n return function (this: unknown, ...args: unknown[]) {\n return done ? undefined : ((done = true), fn.apply(this, args))\n } as unknown as T\n}\n\nconst hasOwnFallback = (o: object, k: PropertyKey): boolean =>\n Object.prototype.hasOwnProperty.call(o, k)\n\nexport const hasOwn = (o: object, k: PropertyKey): boolean =>\n Object.hasOwn ? Object.hasOwn(o, k) : hasOwnFallback(o, k)\n\nexport const isDarkModeEnabled = (): boolean =>\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n\nexport const id = <T>(x: T): T => x\n\nconst ROUNDING = 1000\n\nexport const round = (value: number): number =>\n Math.round(value * ROUNDING) / ROUNDING\n\nexport const capitalizeFirstLetter = (string: string): string =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const isDef = (value: unknown): boolean =>\n `${value}` !== '' && value !== undefined\n\nexport const invoke = <T>(fn: () => T): T => fn()\n\nexport const lower = (str: string): string => str.toLowerCase()\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getElementName(el: any): string {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName} (${el.name}`\n\n case isDef(el.className):\n return `${el.nodeName}.${el.className}`\n\n default:\n return el.nodeName\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const esModuleInterop = <T = any>(mod: any): T =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\nexport const typeAssert = (\n value: unknown,\n type: string,\n error: string,\n): void => {\n // eslint-disable-next-line valid-typeof\n if (typeof value !== type) {\n throw new TypeError(`${error} is not a ${capitalizeFirstLetter(type)}`)\n }\n}\n","export default ({\n license,\n bodyBackground,\n bodyMargin,\n bodyPadding,\n checkOrigin,\n direction,\n inPageLinks,\n log,\n logExpand,\n offsetSize,\n scrolling,\n tolerance,\n waitForLoad,\n warningTimeout,\n onAfterClose,\n onMessage,\n onMouseEnter,\n onMouseLeave,\n onReady,\n onResized,\n onScroll,\n ...iframeProps\n}: Record<string, unknown>): Record<string, unknown> => iframeProps\n","// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable react/require-default-props */\nimport { esModuleInterop } from '@iframe-resizer/common/utils'\nimport type {\n IframeComponent,\n IframeObject,\n IframeOptions,\n} from '@iframe-resizer/core'\nimport connectResizer from '@iframe-resizer/core'\nimport acg from 'auto-console-group'\nimport React, {\n forwardRef,\n type ReactElement,\n type RefObject,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\n\nimport filterIframeAttribs from './filter-iframe-attribs'\n\nexport type IframeForwardRef = Omit<IframeObject, 'close' | 'disconnect'> & {\n getElement: () => IframeComponent\n getRef: () => RefObject<HTMLIFrameElement | null>\n}\n\ntype IframeProps = React.DetailedHTMLProps<\n React.IframeHTMLAttributes<HTMLIFrameElement>,\n HTMLIFrameElement\n>\n\nexport type IframeResizerProps = Omit<IframeProps, 'scrolling'> &\n Omit<IframeOptions, 'id' | 'onBeforeClose'>\n\n// Deal with UMD not converting default exports to named exports\nconst createAutoConsoleGroup = esModuleInterop(acg)\n\nfunction IframeResizer(\n props: IframeResizerProps,\n ref: React.ForwardedRef<IframeForwardRef>,\n): ReactElement {\n const { log, logExpand } = props\n const filteredProps = filterIframeAttribs(props)\n const iframeRef = useRef<IframeComponent>(null)\n const consoleGroup = createAutoConsoleGroup()\n\n const onBeforeClose = (): boolean => {\n consoleGroup.event('close')\n consoleGroup.warn(\n `Close event ignored, to remove the iframe update your React component.`,\n )\n\n return false\n }\n\n // This hook is only run once, as once iframe-resizer is bound, it will\n // deal with changes to the element and does not need recalling\n useEffect(() => {\n const iframe = iframeRef.current\n const resizerOptions = { ...props, onBeforeClose }\n\n consoleGroup.label(`react(${iframe.id})`)\n consoleGroup.event('setup')\n\n const resizer = connectResizer(resizerOptions)(iframe)\n\n consoleGroup.expand(logExpand)\n if (log) consoleGroup.log('Created React component')\n\n return () => {\n consoleGroup.endAutoGroup()\n resizer?.disconnect()\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n useImperativeHandle(ref, () => ({\n getRef: () => iframeRef,\n getElement: () => iframeRef.current,\n moveToAnchor: (anchor: string) =>\n iframeRef.current.iframeResizer.moveToAnchor(anchor),\n sendMessage: (message: any, targetOrigin?: string) => {\n iframeRef.current.iframeResizer.sendMessage(message, targetOrigin)\n },\n }))\n\n // eslint-disable-next-line jsx-a11y/iframe-has-title\n return <iframe {...filteredProps} ref={iframeRef} />\n}\n\nexport default forwardRef<IframeForwardRef, IframeResizerProps>(IframeResizer)\n\nexport {\n type IframeComponent,\n type IframeMessageData,\n type IframeMouseData,\n type IframeObject,\n type IframeOptions,\n type IframeResizedData,\n type IframeScrollData,\n} from '@iframe-resizer/core'\n"],"names":["esModuleInterop","mod","filterIframeAttribs","license","bodyBackground","bodyMargin","bodyPadding","checkOrigin","direction","inPageLinks","log","logExpand","offsetSize","scrolling","tolerance","waitForLoad","warningTimeout","onAfterClose","onMessage","onMouseEnter","onMouseLeave","onReady","onResized","onScroll","iframeProps","createAutoConsoleGroup","acg","IframeResizer","props","ref","filteredProps","iframeRef","useRef","consoleGroup","onBeforeClose","useEffect","iframe","resizerOptions","resizer","connectResizer","useImperativeHandle","anchor","message","targetOrigin","React","index","forwardRef"],"mappings":"wGA2FaA,EAA4BC,GAEvCA,GAAK,WAAaA,EAAI,QAAUA,EC7FlCC,EAAe,CAAC,CACd,QAAAC,EACA,eAAAC,EACA,WAAAC,EACA,YAAAC,EACA,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,IAAAC,EACA,UAAAC,EACA,WAAAC,EACA,UAAAC,EACA,UAAAC,EACA,YAAAC,EACA,eAAAC,EACA,aAAAC,EACA,UAAAC,EACA,aAAAC,EACA,aAAAC,EACA,QAAAC,EACA,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAwDA,ECYlDC,EAAyBzB,EAAgB0B,CAAG,EAElD,SAASC,EACPC,EACAC,EACc,CACd,KAAM,CAAE,IAAAnB,EAAK,UAAAC,CAAA,EAAciB,EACrBE,EAAgB5B,EAAoB0B,CAAK,EACzCG,EAAYC,EAAAA,OAAwB,IAAI,EACxCC,EAAeR,EAAA,EAEfS,EAAgB,KACpBD,EAAa,MAAM,OAAO,EAC1BA,EAAa,KACX,wEAAA,EAGK,IAKTE,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAASL,EAAU,QACnBM,EAAiB,CAAE,GAAGT,EAAO,cAAAM,CAAA,EAEnCD,EAAa,MAAM,SAASG,EAAO,EAAE,GAAG,EACxCH,EAAa,MAAM,OAAO,EAE1B,MAAMK,EAAUC,EAAeF,CAAc,EAAED,CAAM,EAErD,OAAAH,EAAa,OAAOtB,CAAS,EACzBD,GAAKuB,EAAa,IAAI,yBAAyB,EAE5C,IAAM,CACXA,EAAa,aAAA,EACbK,GAAS,WAAA,CACX,CACF,EAAG,CAAA,CAAE,EAELE,EAAAA,oBAAoBX,EAAK,KAAO,CAC9B,OAAQ,IAAME,EACd,WAAY,IAAMA,EAAU,QAC5B,aAAeU,GACbV,EAAU,QAAQ,cAAc,aAAaU,CAAM,EACrD,YAAa,CAACC,EAAcC,IAA0B,CACpDZ,EAAU,QAAQ,cAAc,YAAYW,EAASC,CAAY,CACnE,CAAA,EACA,EAGKC,EAAA,cAAC,SAAA,CAAQ,GAAGd,EAAe,IAAKC,EAAW,CACpD,CAEA,MAAAc,EAAeC,EAAAA,WAAiDnB,CAAa"}

@@ -1,36 +0,11 @@

import { Direction, IFrameComponent, IFrameMessageData, IFrameMouseData, IFrameObject, IFrameResizedData, IFrameScrollData, LogOption, ScrollOption } from '@iframe-resizer/core';
import { IframeComponent, IframeObject, IframeOptions } from '@iframe-resizer/core';
import { default as React, RefObject } from 'react';
export type IFrameForwardRef = Omit<IFrameObject, 'close' | 'disconnect'> & {
getElement: () => IFrameComponent;
export type IframeForwardRef = Omit<IframeObject, 'close' | 'disconnect'> & {
getElement: () => IframeComponent;
getRef: () => RefObject<HTMLIFrameElement | null>;
};
type IframeProps = React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
export type ResizerOptions = {
bodyBackground?: string | null;
bodyMargin?: string | number | null;
bodyPadding?: string | number | null;
checkOrigin?: boolean | string[];
direction?: Direction;
inPageLinks?: boolean;
license: string;
log?: LogOption;
logExpand?: boolean;
offsetSize?: number;
scrolling?: ScrollOption;
tolerance?: number;
waitForLoad?: boolean;
warningTimeout?: number;
};
export type ResizerEvents = {
onAfterClose?: (iframeId: string) => void;
onMessage?: (ev: IFrameMessageData) => void;
onMouseEnter?: (ev: IFrameMouseData) => void;
onMouseLeave?: (ev: IFrameMouseData) => void;
onReady?: (iframe: IFrameComponent) => void;
onResized?: (ev: IFrameResizedData) => void;
onScroll?: (ev: IFrameScrollData) => boolean;
};
export type IframeResizerProps = Omit<IframeProps, 'scrolling'> & ResizerOptions & ResizerEvents;
export type IframeResizerProps = Omit<IframeProps, 'scrolling'> & Omit<IframeOptions, 'id' | 'onBeforeClose'>;
declare const _default: any;
export default _default;
export { type IFrameComponent, type IFrameObject } from '@iframe-resizer/core';
export { type IframeComponent, type IframeMessageData, type IframeMouseData, type IframeObject, type IframeOptions, type IframeResizedData, type IframeScrollData, } from '@iframe-resizer/core';

@@ -1,5 +0,5 @@

import u from "@iframe-resizer/core";
import d from "@iframe-resizer/core";
import m from "auto-console-group";
import g, { forwardRef as R, useRef as p, useEffect as z, useImperativeHandle as v } from "react";
const h = (e) => (
import g, { forwardRef as p, useRef as R, useEffect as v, useImperativeHandle as z } from "react";
const M = (e) => (
// eslint-disable-next-line no-underscore-dangle

@@ -10,46 +10,47 @@ e?.__esModule ? e.default : e

bodyBackground: s,
bodyMargin: i,
bodyPadding: c,
checkOrigin: a,
direction: o,
inPageLinks: r,
log: f,
offset: t,
offsetHeight: n,
offsetWidth: l,
scrolling: y,
tolerance: C,
warningTimeout: w,
waitForLoad: x,
onAfterClose: E,
onReady: I,
onMessage: k,
onResized: G,
...d
}) => d, M = h(m);
bodyMargin: c,
bodyPadding: a,
checkOrigin: i,
direction: n,
inPageLinks: o,
log: l,
logExpand: r,
offsetSize: t,
scrolling: f,
tolerance: x,
waitForLoad: y,
warningTimeout: C,
onAfterClose: h,
onMessage: w,
onMouseEnter: I,
onMouseLeave: k,
onReady: G,
onResized: L,
onScroll: P,
...u
}) => u, E = M(m);
function b(e, s) {
const { log: i, logExpand: c } = e, a = A(e), o = p(null), r = M(), f = () => (r.event("close"), r.warn(
const { log: c, logExpand: a } = e, i = A(e), n = R(null), o = E(), l = () => (o.event("close"), o.warn(
"Close event ignored, to remove the iframe update your React component."
), !1);
return z(() => {
const t = o.current, n = { ...e, onBeforeClose: f };
r.label(`react(${t.id})`), r.event("setup");
const l = u(n)(t);
return r.expand(c), i && r.log("Created React component"), () => {
r.endAutoGroup(), l?.disconnect();
return v(() => {
const r = n.current, t = { ...e, onBeforeClose: l };
o.label(`react(${r.id})`), o.event("setup");
const f = d(t)(r);
return o.expand(a), c && o.log("Created React component"), () => {
o.endAutoGroup(), f?.disconnect();
};
}, []), v(s, () => ({
getRef: () => o,
getElement: () => o.current,
resize: () => o.current.iframeResizer.resize(),
moveToAnchor: (t) => o.current.iframeResizer.moveToAnchor(t),
sendMessage: (t, n) => {
o.current.iframeResizer.sendMessage(t, n);
}, []), z(s, () => ({
getRef: () => n,
getElement: () => n.current,
moveToAnchor: (r) => n.current.iframeResizer.moveToAnchor(r),
sendMessage: (r, t) => {
n.current.iframeResizer.sendMessage(r, t);
}
})), /* @__PURE__ */ g.createElement("iframe", { ...a, ref: o });
})), /* @__PURE__ */ g.createElement("iframe", { ...i, ref: n });
}
const H = R(b);
const S = p(b);
export {
H as default
S as default
};
//# sourceMappingURL=index.esm.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.esm.js","sources":["../../packages/common/utils.ts","../../packages/react/filter-iframe-attribs.ts","../../packages/react/index.tsx"],"sourcesContent":["import { OBJECT, STRING } from './consts'\n\nexport const isElement = (node: Node): boolean =>\n node.nodeType === Node.ELEMENT_NODE\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value)\nexport const isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === OBJECT && value !== null\nexport const isString = (value: unknown): value is string =>\n typeof value === STRING\n\nexport const isSafari: boolean = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent,\n)\n\nexport function isIframe(element: unknown): element is HTMLIFrameElement {\n if (!isObject(element)) return false\n\n try {\n return (\n (element as unknown as HTMLElement).tagName === 'IFRAME' ||\n element instanceof HTMLIFrameElement\n )\n } catch (error) {\n return false\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\nexport const isolateUserCode = (\n func: AnyFunction,\n ...val: unknown[]\n): ReturnType<typeof setTimeout> => setTimeout(() => func(...val), 0)\n\nexport const once = <T extends AnyFunction>(fn: T): T => {\n let done = false\n\n return function (this: unknown, ...args: unknown[]) {\n return done ? undefined : ((done = true), fn.apply(this, args))\n } as unknown as T\n}\n\nconst hasOwnFallback = (o: object, k: PropertyKey): boolean =>\n Object.prototype.hasOwnProperty.call(o, k)\n\nexport const hasOwn = (o: object, k: PropertyKey): boolean =>\n Object.hasOwn ? Object.hasOwn(o, k) : hasOwnFallback(o, k)\n\nexport const isDarkModeEnabled = (): boolean =>\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n\nexport const id = <T>(x: T): T => x\n\nconst ROUNDING = 1000\n\nexport const round = (value: number): number =>\n Math.round(value * ROUNDING) / ROUNDING\n\nexport const capitalizeFirstLetter = (string: string): string =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const isDef = (value: unknown): boolean =>\n `${value}` !== '' && value !== undefined\n\nexport const invoke = <T>(fn: () => T): T => fn()\n\nexport const lower = (str: string): string => str.toLowerCase()\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getElementName(el: any): string {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName} (${el.name}`\n\n case isDef(el.className):\n return `${el.nodeName}.${el.className}`\n\n default:\n return el.nodeName\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const esModuleInterop = <T = any>(mod: any): T =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\nexport const typeAssert = (\n value: unknown,\n type: string,\n error: string,\n): void => {\n // eslint-disable-next-line valid-typeof\n if (typeof value !== type) {\n throw new TypeError(`${error} is not a ${capitalizeFirstLetter(type)}`)\n }\n}\n","export default ({\n license,\n bodyBackground,\n bodyMargin,\n bodyPadding,\n checkOrigin,\n direction,\n inPageLinks,\n log,\n offset,\n offsetHeight,\n offsetWidth,\n scrolling,\n tolerance,\n warningTimeout,\n waitForLoad,\n onAfterClose,\n onReady,\n onMessage,\n onResized,\n ...iframeProps\n}: Record<string, unknown>): Record<string, unknown> => iframeProps\n","// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable react/require-default-props */\nimport type {\n Direction,\n IFrameComponent,\n IFrameMessageData,\n IFrameMouseData,\n IFrameObject,\n IFrameResizedData,\n IFrameScrollData,\n LogOption,\n ScrollOption,\n} from '@iframe-resizer/core'\nimport connectResizer from '@iframe-resizer/core'\nimport acg from 'auto-console-group'\nimport React, {\n forwardRef,\n type ReactElement,\n type RefObject,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\n\nimport { esModuleInterop } from '../common/utils'\nimport filterIframeAttribs from './filter-iframe-attribs'\n\nexport type IFrameForwardRef = Omit<IFrameObject, 'close' | 'disconnect'> & {\n getElement: () => IFrameComponent\n getRef: () => RefObject<HTMLIFrameElement | null>\n}\n\ntype IframeProps = React.DetailedHTMLProps<\n React.IframeHTMLAttributes<HTMLIFrameElement>,\n HTMLIFrameElement\n>\n\nexport type ResizerOptions = {\n bodyBackground?: string | null\n bodyMargin?: string | number | null\n bodyPadding?: string | number | null\n checkOrigin?: boolean | string[]\n direction?: Direction\n inPageLinks?: boolean\n license: string\n log?: LogOption\n logExpand?: boolean\n offsetSize?: number\n scrolling?: ScrollOption\n tolerance?: number\n waitForLoad?: boolean\n warningTimeout?: number\n}\n\nexport type ResizerEvents = {\n onAfterClose?: (iframeId: string) => void\n onMessage?: (ev: IFrameMessageData) => void\n onMouseEnter?: (ev: IFrameMouseData) => void\n onMouseLeave?: (ev: IFrameMouseData) => void\n onReady?: (iframe: IFrameComponent) => void\n onResized?: (ev: IFrameResizedData) => void\n onScroll?: (ev: IFrameScrollData) => boolean\n}\n\nexport type IframeResizerProps = Omit<IframeProps, 'scrolling'> &\n ResizerOptions &\n ResizerEvents\n\n// Deal with UMD not converting default exports to named exports\nconst createAutoConsoleGroup = esModuleInterop(acg)\n\nfunction IframeResizer(\n props: IframeResizerProps,\n ref: React.ForwardedRef<IFrameForwardRef>,\n): ReactElement {\n const { log, logExpand } = props\n const filteredProps = filterIframeAttribs(props)\n const iframeRef = useRef<IFrameComponent>(null)\n const consoleGroup = createAutoConsoleGroup()\n\n const onBeforeClose = (): boolean => {\n consoleGroup.event('close')\n consoleGroup.warn(\n `Close event ignored, to remove the iframe update your React component.`,\n )\n\n return false\n }\n\n // This hook is only run once, as once iframe-resizer is bound, it will\n // deal with changes to the element and does not need recalling\n useEffect(() => {\n const iframe = iframeRef.current\n const resizerOptions = { ...props, onBeforeClose }\n\n consoleGroup.label(`react(${iframe.id})`)\n consoleGroup.event('setup')\n\n const resizer = connectResizer(resizerOptions)(iframe)\n\n consoleGroup.expand(logExpand)\n if (log) consoleGroup.log('Created React component')\n\n return () => {\n consoleGroup.endAutoGroup()\n resizer?.disconnect()\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n useImperativeHandle(ref, () => ({\n getRef: () => iframeRef,\n getElement: () => iframeRef.current,\n resize: () => iframeRef.current.iframeResizer.resize(),\n moveToAnchor: (anchor: string) =>\n iframeRef.current.iframeResizer.moveToAnchor(anchor),\n sendMessage: (message: string, targetOrigin?: string) => {\n iframeRef.current.iframeResizer.sendMessage(message, targetOrigin)\n },\n }))\n\n // eslint-disable-next-line jsx-a11y/iframe-has-title\n return <iframe {...filteredProps} ref={iframeRef} />\n}\n\nexport default forwardRef<IFrameForwardRef, IframeResizerProps>(IframeResizer)\n\nexport { type IFrameComponent, type IFrameObject } from '@iframe-resizer/core'\n"],"names":["esModuleInterop","mod","filterIframeAttribs","license","bodyBackground","bodyMargin","bodyPadding","checkOrigin","direction","inPageLinks","log","offset","offsetHeight","offsetWidth","scrolling","tolerance","warningTimeout","waitForLoad","onAfterClose","onReady","onMessage","onResized","iframeProps","createAutoConsoleGroup","acg","IframeResizer","props","ref","logExpand","filteredProps","iframeRef","useRef","consoleGroup","onBeforeClose","useEffect","iframe","resizerOptions","resizer","connectResizer","useImperativeHandle","anchor","message","targetOrigin","React","index","forwardRef"],"mappings":";;;AA2FO,MAAMA,IAAkB,CAAUC;AAAA;AAAA,EAEvCA,GAAK,aAAaA,EAAI,UAAUA;AAAA,GC7FlCC,IAAe,CAAC;AAAA,EACd,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,KAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MAAwDA,GCgDlDC,IAAyBvB,EAAgBwB,CAAG;AAElD,SAASC,EACPC,GACAC,GACc;AACd,QAAM,EAAE,KAAAjB,GAAK,WAAAkB,EAAA,IAAcF,GACrBG,IAAgB3B,EAAoBwB,CAAK,GACzCI,IAAYC,EAAwB,IAAI,GACxCC,IAAeT,EAAA,GAEfU,IAAgB,OACpBD,EAAa,MAAM,OAAO,GAC1BA,EAAa;AAAA,IACX;AAAA,EAAA,GAGK;AAKT,SAAAE,EAAU,MAAM;AACd,UAAMC,IAASL,EAAU,SACnBM,IAAiB,EAAE,GAAGV,GAAO,eAAAO,EAAA;AAEnC,IAAAD,EAAa,MAAM,SAASG,EAAO,EAAE,GAAG,GACxCH,EAAa,MAAM,OAAO;AAE1B,UAAMK,IAAUC,EAAeF,CAAc,EAAED,CAAM;AAErD,WAAAH,EAAa,OAAOJ,CAAS,GACzBlB,KAAKsB,EAAa,IAAI,yBAAyB,GAE5C,MAAM;AACX,MAAAA,EAAa,aAAA,GACbK,GAAS,WAAA;AAAA,IACX;AAAA,EACF,GAAG,CAAA,CAAE,GAELE,EAAoBZ,GAAK,OAAO;AAAA,IAC9B,QAAQ,MAAMG;AAAA,IACd,YAAY,MAAMA,EAAU;AAAA,IAC5B,QAAQ,MAAMA,EAAU,QAAQ,cAAc,OAAA;AAAA,IAC9C,cAAc,CAACU,MACbV,EAAU,QAAQ,cAAc,aAAaU,CAAM;AAAA,IACrD,aAAa,CAACC,GAAiBC,MAA0B;AACvD,MAAAZ,EAAU,QAAQ,cAAc,YAAYW,GAASC,CAAY;AAAA,IACnE;AAAA,EAAA,EACA,GAGK,gBAAAC,EAAA,cAAC,UAAA,EAAQ,GAAGd,GAAe,KAAKC,GAAW;AACpD;AAEA,MAAAc,IAAeC,EAAiDpB,CAAa;"}
{"version":3,"file":"index.esm.js","sources":["../../packages/common/utils.ts","../../packages/react/filter-iframe-attribs.ts","../../packages/react/index.tsx"],"sourcesContent":["import { OBJECT, STRING } from './consts'\n\nexport const isElement = (node: Node): boolean =>\n node.nodeType === Node.ELEMENT_NODE\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value)\nexport const isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === OBJECT && value !== null\nexport const isString = (value: unknown): value is string =>\n typeof value === STRING\n\nexport const isSafari: boolean = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent,\n)\n\nexport function isIframe(element: unknown): element is HTMLIFrameElement {\n if (!isObject(element)) return false\n\n try {\n return (\n (element as unknown as HTMLElement).tagName === 'IFRAME' ||\n element instanceof HTMLIFrameElement\n )\n } catch (error) {\n return false\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\nexport const isolateUserCode = (\n func: AnyFunction,\n ...val: unknown[]\n): ReturnType<typeof setTimeout> => setTimeout(() => func(...val), 0)\n\nexport const once = <T extends AnyFunction>(fn: T): T => {\n let done = false\n\n return function (this: unknown, ...args: unknown[]) {\n return done ? undefined : ((done = true), fn.apply(this, args))\n } as unknown as T\n}\n\nconst hasOwnFallback = (o: object, k: PropertyKey): boolean =>\n Object.prototype.hasOwnProperty.call(o, k)\n\nexport const hasOwn = (o: object, k: PropertyKey): boolean =>\n Object.hasOwn ? Object.hasOwn(o, k) : hasOwnFallback(o, k)\n\nexport const isDarkModeEnabled = (): boolean =>\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n\nexport const id = <T>(x: T): T => x\n\nconst ROUNDING = 1000\n\nexport const round = (value: number): number =>\n Math.round(value * ROUNDING) / ROUNDING\n\nexport const capitalizeFirstLetter = (string: string): string =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const isDef = (value: unknown): boolean =>\n `${value}` !== '' && value !== undefined\n\nexport const invoke = <T>(fn: () => T): T => fn()\n\nexport const lower = (str: string): string => str.toLowerCase()\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getElementName(el: any): string {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName} (${el.name}`\n\n case isDef(el.className):\n return `${el.nodeName}.${el.className}`\n\n default:\n return el.nodeName\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const esModuleInterop = <T = any>(mod: any): T =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\nexport const typeAssert = (\n value: unknown,\n type: string,\n error: string,\n): void => {\n // eslint-disable-next-line valid-typeof\n if (typeof value !== type) {\n throw new TypeError(`${error} is not a ${capitalizeFirstLetter(type)}`)\n }\n}\n","export default ({\n license,\n bodyBackground,\n bodyMargin,\n bodyPadding,\n checkOrigin,\n direction,\n inPageLinks,\n log,\n logExpand,\n offsetSize,\n scrolling,\n tolerance,\n waitForLoad,\n warningTimeout,\n onAfterClose,\n onMessage,\n onMouseEnter,\n onMouseLeave,\n onReady,\n onResized,\n onScroll,\n ...iframeProps\n}: Record<string, unknown>): Record<string, unknown> => iframeProps\n","// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable react/require-default-props */\nimport { esModuleInterop } from '@iframe-resizer/common/utils'\nimport type {\n IframeComponent,\n IframeObject,\n IframeOptions,\n} from '@iframe-resizer/core'\nimport connectResizer from '@iframe-resizer/core'\nimport acg from 'auto-console-group'\nimport React, {\n forwardRef,\n type ReactElement,\n type RefObject,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\n\nimport filterIframeAttribs from './filter-iframe-attribs'\n\nexport type IframeForwardRef = Omit<IframeObject, 'close' | 'disconnect'> & {\n getElement: () => IframeComponent\n getRef: () => RefObject<HTMLIFrameElement | null>\n}\n\ntype IframeProps = React.DetailedHTMLProps<\n React.IframeHTMLAttributes<HTMLIFrameElement>,\n HTMLIFrameElement\n>\n\nexport type IframeResizerProps = Omit<IframeProps, 'scrolling'> &\n Omit<IframeOptions, 'id' | 'onBeforeClose'>\n\n// Deal with UMD not converting default exports to named exports\nconst createAutoConsoleGroup = esModuleInterop(acg)\n\nfunction IframeResizer(\n props: IframeResizerProps,\n ref: React.ForwardedRef<IframeForwardRef>,\n): ReactElement {\n const { log, logExpand } = props\n const filteredProps = filterIframeAttribs(props)\n const iframeRef = useRef<IframeComponent>(null)\n const consoleGroup = createAutoConsoleGroup()\n\n const onBeforeClose = (): boolean => {\n consoleGroup.event('close')\n consoleGroup.warn(\n `Close event ignored, to remove the iframe update your React component.`,\n )\n\n return false\n }\n\n // This hook is only run once, as once iframe-resizer is bound, it will\n // deal with changes to the element and does not need recalling\n useEffect(() => {\n const iframe = iframeRef.current\n const resizerOptions = { ...props, onBeforeClose }\n\n consoleGroup.label(`react(${iframe.id})`)\n consoleGroup.event('setup')\n\n const resizer = connectResizer(resizerOptions)(iframe)\n\n consoleGroup.expand(logExpand)\n if (log) consoleGroup.log('Created React component')\n\n return () => {\n consoleGroup.endAutoGroup()\n resizer?.disconnect()\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n useImperativeHandle(ref, () => ({\n getRef: () => iframeRef,\n getElement: () => iframeRef.current,\n moveToAnchor: (anchor: string) =>\n iframeRef.current.iframeResizer.moveToAnchor(anchor),\n sendMessage: (message: any, targetOrigin?: string) => {\n iframeRef.current.iframeResizer.sendMessage(message, targetOrigin)\n },\n }))\n\n // eslint-disable-next-line jsx-a11y/iframe-has-title\n return <iframe {...filteredProps} ref={iframeRef} />\n}\n\nexport default forwardRef<IframeForwardRef, IframeResizerProps>(IframeResizer)\n\nexport {\n type IframeComponent,\n type IframeMessageData,\n type IframeMouseData,\n type IframeObject,\n type IframeOptions,\n type IframeResizedData,\n type IframeScrollData,\n} from '@iframe-resizer/core'\n"],"names":["esModuleInterop","mod","filterIframeAttribs","license","bodyBackground","bodyMargin","bodyPadding","checkOrigin","direction","inPageLinks","log","logExpand","offsetSize","scrolling","tolerance","waitForLoad","warningTimeout","onAfterClose","onMessage","onMouseEnter","onMouseLeave","onReady","onResized","onScroll","iframeProps","createAutoConsoleGroup","acg","IframeResizer","props","ref","filteredProps","iframeRef","useRef","consoleGroup","onBeforeClose","useEffect","iframe","resizerOptions","resizer","connectResizer","useImperativeHandle","anchor","message","targetOrigin","React","index","forwardRef"],"mappings":";;;AA2FO,MAAMA,IAAkB,CAAUC;AAAA;AAAA,EAEvCA,GAAK,aAAaA,EAAI,UAAUA;AAAA,GC7FlCC,IAAe,CAAC;AAAA,EACd,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,KAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAAwDA,GCYlDC,IAAyBzB,EAAgB0B,CAAG;AAElD,SAASC,EACPC,GACAC,GACc;AACd,QAAM,EAAE,KAAAnB,GAAK,WAAAC,EAAA,IAAciB,GACrBE,IAAgB5B,EAAoB0B,CAAK,GACzCG,IAAYC,EAAwB,IAAI,GACxCC,IAAeR,EAAA,GAEfS,IAAgB,OACpBD,EAAa,MAAM,OAAO,GAC1BA,EAAa;AAAA,IACX;AAAA,EAAA,GAGK;AAKT,SAAAE,EAAU,MAAM;AACd,UAAMC,IAASL,EAAU,SACnBM,IAAiB,EAAE,GAAGT,GAAO,eAAAM,EAAA;AAEnC,IAAAD,EAAa,MAAM,SAASG,EAAO,EAAE,GAAG,GACxCH,EAAa,MAAM,OAAO;AAE1B,UAAMK,IAAUC,EAAeF,CAAc,EAAED,CAAM;AAErD,WAAAH,EAAa,OAAOtB,CAAS,GACzBD,KAAKuB,EAAa,IAAI,yBAAyB,GAE5C,MAAM;AACX,MAAAA,EAAa,aAAA,GACbK,GAAS,WAAA;AAAA,IACX;AAAA,EACF,GAAG,CAAA,CAAE,GAELE,EAAoBX,GAAK,OAAO;AAAA,IAC9B,QAAQ,MAAME;AAAA,IACd,YAAY,MAAMA,EAAU;AAAA,IAC5B,cAAc,CAACU,MACbV,EAAU,QAAQ,cAAc,aAAaU,CAAM;AAAA,IACrD,aAAa,CAACC,GAAcC,MAA0B;AACpD,MAAAZ,EAAU,QAAQ,cAAc,YAAYW,GAASC,CAAY;AAAA,IACnE;AAAA,EAAA,EACA,GAGK,gBAAAC,EAAA,cAAC,UAAA,EAAQ,GAAGd,GAAe,KAAKC,GAAW;AACpD;AAEA,MAAAc,IAAeC,EAAiDnB,CAAa;"}
{
"name": "@iframe-resizer/react",
"version": "6.0.0-beta.2",
"version": "6.0.0-beta.3",
"license": "GPL-3.0",

@@ -41,3 +41,3 @@ "homepage": "https://iframe-resizer.com",

"dependencies": {
"@iframe-resizer/core": "6.0.0-beta.2",
"@iframe-resizer/core": "6.0.0-beta.3",
"auto-console-group": "1.3.0",

@@ -44,0 +44,0 @@ "react": "^19.2.4"

@@ -28,2 +28,2 @@ <p align="center"><br>

_iframe-resizer version 6.0.0-beta.2 2026-04-08 - 17:04:14.048Z_
_iframe-resizer version 6.0.0-beta.3 2026-04-10 - 14:34:29.258Z_