@iframe-resizer/vue 6.0.0-beta.0 → 6.0.0-beta.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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  This package is part of the __[iframe-resizer](https://iframe-resizer.com)__ library, which automatically resizes the height and width of both same-origin and cross-origin iframes to match their content. It also includes a range of features designed to address common issues associated with using iframes.
8
8
 
9
9
 
10
- __For more information, visit [iframe-resizer.com](https://iframe-resizer.com).__
10
+ __For more information, please visit [iframe-resizer.com](https://iframe-resizer.com).__
11
11
 
12
12
  ## Install
13
13
 
@@ -25,4 +25,4 @@ yarn add @iframe-resizer/vue
25
25
 
26
26
  ---
27
27
 
28
- _iframe-resizer version 6.0.0-beta.0 2026-02-23 - 11:30:22.346Z_
28
+ _iframe-resizer version 6.0.0-beta.2 2026-04-08 - 17:04:14.539Z_
@@ -1,18 +1,17 @@
1
1
  <template>
2
- <iframe ref="iframe" v-bind="$attrs"></iframe>
2
+ <iframe ref="iframeRef" v-bind="$attrs"></iframe>
3
3
  </template>
4
4
 
5
- <script lang="ts">
5
+ <script setup lang="ts">
6
+ import { onBeforeUnmount, onMounted, ref, toRaw } from 'vue'
6
7
  import type { PropType } from 'vue'
7
8
  import connectResizer from '@iframe-resizer/core'
8
- import type { IFrameObject } from '@iframe-resizer/core'
9
+ import type { IFrameObject, LogOption } from '@iframe-resizer/core'
9
10
  import acg from 'auto-console-group'
10
11
 
11
12
  const EXPAND = 'expanded'
12
13
  const COLLAPSE = 'collapsed'
13
14
 
14
- type LogOption = 'expanded' | 'collapsed' | boolean | -1
15
-
16
15
  const esModuleInterop = (mod: any) =>
17
16
  // eslint-disable-next-line no-underscore-dangle
18
17
  mod?.__esModule ? mod.default : mod
@@ -20,126 +19,95 @@
20
19
  // Deal with UMD not converting default exports to named exports
21
20
  const createAutoConsoleGroup = esModuleInterop(acg)
22
21
 
23
- export default {
24
- name: 'IframeResizer',
22
+ defineOptions({ name: 'IframeResizer' })
25
23
 
26
- props: {
27
- license: {
28
- type: String,
29
- required: true,
30
- },
31
- bodyBackground: {
32
- type: String,
33
- },
34
- bodyMargin: {
35
- type: String,
36
- },
37
- bodyPadding: {
38
- type: String,
39
- },
40
- checkOrigin: {
41
- type: Boolean,
42
- default: true,
43
- },
44
- direction: {
45
- type: String,
46
- },
47
- log: {
48
- type: [String, Boolean, Number] as PropType<LogOption>,
49
- validator: (value: LogOption) => {
50
- switch (value) {
51
- case COLLAPSE:
52
- case EXPAND:
53
- case false:
54
- case true:
55
- case -1:
56
- return true
57
- default:
58
- return false
59
- }
60
- },
61
- default: undefined,
62
- },
63
- inPageLinks: {
64
- type: Boolean,
65
- },
66
- offset: {
67
- type: Number,
68
- },
69
- scrolling: {
70
- type: Boolean,
71
- },
72
- tolerance: {
73
- type: Number,
74
- },
75
- warningTimeout: {
76
- type: Number,
77
- },
24
+ const props = defineProps({
25
+ license: {
26
+ type: String,
27
+ required: true,
78
28
  },
79
-
80
- data() {
81
- return {
82
- resizer: null as IFrameObject | null,
83
- }
29
+ bodyBackground: String,
30
+ bodyMargin: String,
31
+ bodyPadding: String,
32
+ checkOrigin: {
33
+ type: Boolean,
34
+ default: true,
84
35
  },
85
-
86
- mounted() {
87
- const self = this
88
- const { iframe } = this.$refs as { iframe: HTMLIFrameElement }
89
- const options: any = {
90
- ...Object.fromEntries(
91
- Object.entries(this.$props).filter(
92
- ([key, value]) => value !== undefined
93
- )
94
- ),
95
- waitForLoad: true,
96
-
97
- onBeforeClose: () => {
98
- consoleGroup.event('Blocked Close Event')
99
- consoleGroup.warn('Close method is disabled, use Vue to remove iframe')
100
- return false
101
- },
102
- onReady: (...args: any[]) => self.$emit('onReady', ...args),
103
- onMessage: (...args: any[]) => self.$emit('onMessage', ...args),
104
- onResized: (...args: any[]) => self.$emit('onResized', ...args),
105
- }
106
-
107
- const connectWithOptions = connectResizer(options)
108
- self.resizer = connectWithOptions(iframe)
109
-
110
- const consoleOptions = {
111
- label: `vue(${iframe.id})`,
112
- expand: (options as any).logExpand, // set inside connectResizer
113
- }
114
-
115
- const consoleGroup = createAutoConsoleGroup(consoleOptions)
116
- consoleGroup.event('setup')
117
-
118
- if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {
119
- consoleGroup.log('Created Vue component')
120
- }
121
- },
122
-
123
- // Vue 2 lifecycle hook
124
- beforeDestroy() {
125
- this.resizer?.disconnect()
126
- },
127
-
128
- // Vue 3 lifecycle hook
129
- beforeUnmount() {
130
- this.resizer?.disconnect()
131
- },
132
-
133
- methods: {
134
- moveToAnchor(anchor: string) {
135
- this.resizer?.moveToAnchor(anchor)
136
- },
137
- resize() {
138
- this.resizer?.resize()
139
- },
140
- sendMessage(msg: any, target?: string) {
141
- this.resizer?.sendMessage(msg, target)
36
+ direction: String,
37
+ log: {
38
+ type: [String, Boolean, Number] as PropType<LogOption>,
39
+ validator: (value: LogOption) => {
40
+ switch (value) {
41
+ case COLLAPSE:
42
+ case EXPAND:
43
+ case false:
44
+ case true:
45
+ case -1:
46
+ case 0:
47
+ case 1:
48
+ case 2:
49
+ return true
50
+ default:
51
+ return false
52
+ }
142
53
  },
54
+ default: undefined,
143
55
  },
144
- }
56
+ inPageLinks: Boolean,
57
+ offset: Number,
58
+ scrolling: Boolean,
59
+ tolerance: Number,
60
+ warningTimeout: Number,
61
+ })
62
+
63
+ const emit = defineEmits<{
64
+ onReady: [...args: any[]]
65
+ onMessage: [...args: any[]]
66
+ onResized: [...args: any[]]
67
+ }>()
68
+
69
+ const iframeRef = ref<HTMLIFrameElement | null>(null)
70
+ const resizer = ref<IFrameObject | null>(null)
71
+
72
+ onMounted(() => {
73
+ const consoleGroup = createAutoConsoleGroup()
74
+ // Template refs are guaranteed populated before onMounted fires
75
+ const iframe = iframeRef.value!
76
+ const options: any = {
77
+ ...Object.fromEntries(
78
+ Object.entries(toRaw(props)).filter(([, value]) => value !== undefined),
79
+ ),
80
+ waitForLoad: true,
81
+
82
+ onBeforeClose: () => {
83
+ consoleGroup.event('Blocked Close Event')
84
+ consoleGroup.warn('Close method is disabled, use Vue to remove iframe')
85
+ return false
86
+ },
87
+ onReady: (...args: any[]) => emit('onReady', ...args),
88
+ onMessage: (...args: any[]) => emit('onMessage', ...args),
89
+ onResized: (...args: any[]) => emit('onResized', ...args),
90
+ }
91
+
92
+ consoleGroup.label(`vue(${iframe.id})`)
93
+ consoleGroup.event('setup')
94
+
95
+ resizer.value = connectResizer(options)(iframe)
96
+
97
+ consoleGroup.expand(options.logExpand)
98
+ if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {
99
+ consoleGroup.log('Created Vue component')
100
+ }
101
+ })
102
+
103
+ onBeforeUnmount(() => {
104
+ resizer.value?.disconnect()
105
+ })
106
+
107
+ defineExpose({
108
+ moveToAnchor: (anchor: string) => resizer.value?.moveToAnchor(anchor),
109
+ resize: () => resizer.value?.resize(),
110
+ sendMessage: (msg: any, target?: string) =>
111
+ resizer.value?.sendMessage(msg, target),
112
+ })
145
113
  </script>
@@ -1,4 +1,5 @@
1
- import { DefineComponent } from 'vue'
1
+ import type { DefineComponent } from 'vue'
2
+ import type { IFrameObject } from '@iframe-resizer/core'
2
3
 
3
4
  export interface IframeResizerProps {
4
5
  license: string
@@ -15,13 +16,10 @@ export interface IframeResizerProps {
15
16
  warningTimeout?: number
16
17
  }
17
18
 
18
- export interface IframeResizerMethods {
19
- moveToAnchor(anchor: string): void
20
- resize(): void
21
- sendMessage(msg: any, target?: string): void
22
- }
19
+ /** Methods exposed via defineExpose, accessible on template refs */
20
+ export type IframeResizerMethods = Pick<IFrameObject, 'moveToAnchor' | 'resize' | 'sendMessage'>
23
21
 
24
- export interface IframeResizerEmits {
22
+ export type IframeResizerEmits = {
25
23
  onReady: (...args: any[]) => void
26
24
  onMessage: (...args: any[]) => void
27
25
  onResized: (...args: any[]) => void
package/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const d=require("@iframe-resizer/core"),p=require("auto-console-group"),c=require("vue"),a="expanded",l="collapsed",f=e=>e?.__esModule?e.default:e,m=f(p),g={name:"IframeResizer",props:{license:{type:String,required:!0},bodyBackground:{type:String},bodyMargin:{type:String},bodyPadding:{type:String},checkOrigin:{type:Boolean,default:!0},direction:{type:String},log:{type:[String,Boolean,Number],validator:e=>{switch(e){case l:case a:case!1:case!0:case-1:return!0;default:return!1}},default:void 0},inPageLinks:{type:Boolean},offset:{type:Number},scrolling:{type:Boolean},tolerance:{type:Number},warningTimeout:{type:Number}},data(){return{resizer:null}},mounted(){const e=this,{iframe:t}=this.$refs,o={...Object.fromEntries(Object.entries(this.$props).filter(([r,u])=>u!==void 0)),waitForLoad:!0,onBeforeClose:()=>(s.event("Blocked Close Event"),s.warn("Close method is disabled, use Vue to remove iframe"),!1),onReady:(...r)=>e.$emit("onReady",...r),onMessage:(...r)=>e.$emit("onMessage",...r),onResized:(...r)=>e.$emit("onResized",...r)},n=d(o);e.resizer=n(t);const i={label:`vue(${t.id})`,expand:o.logExpand},s=m(i);s.event("setup"),[l,a,!0].includes(o.log)&&s.log("Created Vue component")},beforeDestroy(){this.resizer?.disconnect()},beforeUnmount(){this.resizer?.disconnect()},methods:{moveToAnchor(e){this.resizer?.moveToAnchor(e)},resize(){this.resizer?.resize()},sendMessage(e,t){this.resizer?.sendMessage(e,t)}}},y=(e,t)=>{const o=e.__vccOpts||e;for(const[n,i]of t)o[n]=i;return o};function h(e,t,o,n,i,s){return c.openBlock(),c.createElementBlock("iframe",c.mergeProps({ref:"iframe"},e.$attrs),null,16)}const z=y(g,[["render",h]]),b={install(e){e.component("IframeResizer",z)}};module.exports=b;
1
+ "use strict";const o=require("vue"),g=require("@iframe-resizer/core"),v=require("auto-console-group"),l="expanded",u="collapsed",R=o.defineComponent({name:"IframeResizer",__name:"iframe-resizer",props:{license:{type:String,required:!0},bodyBackground:String,bodyMargin:String,bodyPadding:String,checkOrigin:{type:Boolean,default:!0},direction:String,log:{type:[String,Boolean,Number],validator:r=>{switch(r){case u:case l:case!1:case!0:case-1:case 0:case 1:case 2:return!0;default:return!1}},default:void 0},inPageLinks:Boolean,offset:Number,scrolling:Boolean,tolerance:Number,warningTimeout:Number},emits:["onReady","onMessage","onResized"],setup(r,{expose:d,emit:f}){const m=(e=>e?.__esModule?e.default:e)(v),p=r,a=f,c=o.ref(null),s=o.ref(null);return o.onMounted(()=>{const e=m(),t=c.value,i={...Object.fromEntries(Object.entries(o.toRaw(p)).filter(([,n])=>n!==void 0)),waitForLoad:!0,onBeforeClose:()=>(e.event("Blocked Close Event"),e.warn("Close method is disabled, use Vue to remove iframe"),!1),onReady:(...n)=>a("onReady",...n),onMessage:(...n)=>a("onMessage",...n),onResized:(...n)=>a("onResized",...n)};e.label(`vue(${t.id})`),e.event("setup"),s.value=g(i)(t),e.expand(i.logExpand),[u,l,!0].includes(i.log)&&e.log("Created Vue component")}),o.onBeforeUnmount(()=>{s.value?.disconnect()}),d({moveToAnchor:e=>s.value?.moveToAnchor(e),resize:()=>s.value?.resize(),sendMessage:(e,t)=>s.value?.sendMessage(e,t)}),(e,t)=>(o.openBlock(),o.createElementBlock("iframe",o.mergeProps({ref_key:"iframeRef",ref:c},e.$attrs),null,16))}}),b={install(r){r.component("IframeResizer",R)}};module.exports=b;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/index.cjs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../packages/vue/iframe-resizer.vue","../../packages/vue/index.ts"],"sourcesContent":["<template>\n <iframe ref=\"iframe\" v-bind=\"$attrs\"></iframe>\n</template>\n\n<script lang=\"ts\">\n import type { PropType } from 'vue'\n import connectResizer from '@iframe-resizer/core'\n import type { IFrameObject } from '@iframe-resizer/core'\n import acg from 'auto-console-group'\n\n const EXPAND = 'expanded'\n const COLLAPSE = 'collapsed'\n\n type LogOption = 'expanded' | 'collapsed' | boolean | -1\n\n const esModuleInterop = (mod: any) =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\n // Deal with UMD not converting default exports to named exports\n const createAutoConsoleGroup = esModuleInterop(acg)\n\n export default {\n name: 'IframeResizer',\n\n props: {\n license: {\n type: String,\n required: true,\n },\n bodyBackground: {\n type: String,\n },\n bodyMargin: {\n type: String,\n },\n bodyPadding: {\n type: String,\n },\n checkOrigin: {\n type: Boolean,\n default: true,\n },\n direction: {\n type: String,\n },\n log: {\n type: [String, Boolean, Number] as PropType<LogOption>,\n validator: (value: LogOption) => {\n switch (value) {\n case COLLAPSE:\n case EXPAND:\n case false:\n case true:\n case -1:\n return true\n default:\n return false\n }\n },\n default: undefined,\n },\n inPageLinks: {\n type: Boolean,\n },\n offset: {\n type: Number,\n },\n scrolling: {\n type: Boolean,\n },\n tolerance: {\n type: Number,\n },\n warningTimeout: {\n type: Number,\n },\n },\n\n data() {\n return {\n resizer: null as IFrameObject | null,\n }\n },\n\n mounted() {\n const self = this\n const { iframe } = this.$refs as { iframe: HTMLIFrameElement }\n const options: any = {\n ...Object.fromEntries(\n Object.entries(this.$props).filter(\n ([key, value]) => value !== undefined\n )\n ),\n waitForLoad: true,\n\n onBeforeClose: () => {\n consoleGroup.event('Blocked Close Event')\n consoleGroup.warn('Close method is disabled, use Vue to remove iframe')\n return false\n },\n onReady: (...args: any[]) => self.$emit('onReady', ...args),\n onMessage: (...args: any[]) => self.$emit('onMessage', ...args),\n onResized: (...args: any[]) => self.$emit('onResized', ...args),\n }\n\n const connectWithOptions = connectResizer(options)\n self.resizer = connectWithOptions(iframe)\n\n const consoleOptions = {\n label: `vue(${iframe.id})`,\n expand: (options as any).logExpand, // set inside connectResizer\n }\n\n const consoleGroup = createAutoConsoleGroup(consoleOptions)\n consoleGroup.event('setup')\n\n if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {\n consoleGroup.log('Created Vue component')\n }\n },\n\n // Vue 2 lifecycle hook\n beforeDestroy() {\n this.resizer?.disconnect()\n },\n\n // Vue 3 lifecycle hook\n beforeUnmount() {\n this.resizer?.disconnect()\n },\n\n methods: {\n moveToAnchor(anchor: string) {\n this.resizer?.moveToAnchor(anchor)\n },\n resize() {\n this.resizer?.resize()\n },\n sendMessage(msg: any, target?: string) {\n this.resizer?.sendMessage(msg, target)\n },\n },\n }\n</script>\n","import IframeResizer from './iframe-resizer.vue'\n\n// Duck-typed interface compatible with both Vue 2 and Vue 3\ninterface VueApp {\n component: (name: string, component: any) => void\n}\n\nexport default {\n install(app: VueApp) {\n app.component('IframeResizer', IframeResizer)\n },\n}\n"],"names":["EXPAND","COLLAPSE","esModuleInterop","mod","createAutoConsoleGroup","acg","_sfc_main","value","self","iframe","options","key","consoleGroup","args","connectWithOptions","connectResizer","consoleOptions","anchor","msg","target","_openBlock","_createElementBlock","_mergeProps","_ctx","index","app","IframeResizer"],"mappings":"sGAUQA,EAAS,WACTC,EAAW,YAIXC,EAAmBC,GAEvBA,GAAK,WAAaA,EAAI,QAAUA,EAG5BC,EAAyBF,EAAgBG,CAAG,EAElDC,EAAe,CACb,KAAM,gBAEN,MAAO,CACL,QAAS,CACP,KAAM,OACN,SAAU,EAAA,EAEZ,eAAgB,CACd,KAAM,MAAA,EAER,WAAY,CACV,KAAM,MAAA,EAER,YAAa,CACX,KAAM,MAAA,EAER,YAAa,CACX,KAAM,QACN,QAAS,EAAA,EAEX,UAAW,CACT,KAAM,MAAA,EAER,IAAK,CACH,KAAM,CAAC,OAAQ,QAAS,MAAM,EAC9B,UAAYC,GAAqB,CAC/B,OAAQA,EAAA,CACN,KAAKN,EACL,KAAKD,EACL,IAAK,GACL,IAAK,GACL,IAAK,GACH,MAAO,GACT,QACE,MAAO,EAAA,CAEb,EACA,QAAS,MAAA,EAEX,YAAa,CACX,KAAM,OAAA,EAER,OAAQ,CACN,KAAM,MAAA,EAER,UAAW,CACT,KAAM,OAAA,EAER,UAAW,CACT,KAAM,MAAA,EAER,eAAgB,CACd,KAAM,MAAA,CACR,EAGF,MAAO,CACL,MAAO,CACL,QAAS,IAAA,CAEb,EAEA,SAAU,CACR,MAAMQ,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"file":"index.cjs.js","sources":["../../packages/vue/iframe-resizer.vue","../../packages/vue/index.ts"],"sourcesContent":["<template>\n <iframe ref=\"iframeRef\" v-bind=\"$attrs\"></iframe>\n</template>\n\n<script setup lang=\"ts\">\n import { onBeforeUnmount, onMounted, ref, toRaw } from 'vue'\n import type { PropType } from 'vue'\n import connectResizer from '@iframe-resizer/core'\n import type { IFrameObject, LogOption } from '@iframe-resizer/core'\n import acg from 'auto-console-group'\n\n const EXPAND = 'expanded'\n const COLLAPSE = 'collapsed'\n\n const esModuleInterop = (mod: any) =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\n // Deal with UMD not converting default exports to named exports\n const createAutoConsoleGroup = esModuleInterop(acg)\n\n defineOptions({ name: 'IframeResizer' })\n\n const props = defineProps({\n license: {\n type: String,\n required: true,\n },\n bodyBackground: String,\n bodyMargin: String,\n bodyPadding: String,\n checkOrigin: {\n type: Boolean,\n default: true,\n },\n direction: String,\n log: {\n type: [String, Boolean, Number] as PropType<LogOption>,\n validator: (value: LogOption) => {\n switch (value) {\n case COLLAPSE:\n case EXPAND:\n case false:\n case true:\n case -1:\n case 0:\n case 1:\n case 2:\n return true\n default:\n return false\n }\n },\n default: undefined,\n },\n inPageLinks: Boolean,\n offset: Number,\n scrolling: Boolean,\n tolerance: Number,\n warningTimeout: Number,\n })\n\n const emit = defineEmits<{\n onReady: [...args: any[]]\n onMessage: [...args: any[]]\n onResized: [...args: any[]]\n }>()\n\n const iframeRef = ref<HTMLIFrameElement | null>(null)\n const resizer = ref<IFrameObject | null>(null)\n\n onMounted(() => {\n const consoleGroup = createAutoConsoleGroup()\n // Template refs are guaranteed populated before onMounted fires\n const iframe = iframeRef.value!\n const options: any = {\n ...Object.fromEntries(\n Object.entries(toRaw(props)).filter(([, value]) => value !== undefined),\n ),\n waitForLoad: true,\n\n onBeforeClose: () => {\n consoleGroup.event('Blocked Close Event')\n consoleGroup.warn('Close method is disabled, use Vue to remove iframe')\n return false\n },\n onReady: (...args: any[]) => emit('onReady', ...args),\n onMessage: (...args: any[]) => emit('onMessage', ...args),\n onResized: (...args: any[]) => emit('onResized', ...args),\n }\n\n consoleGroup.label(`vue(${iframe.id})`)\n consoleGroup.event('setup')\n\n resizer.value = connectResizer(options)(iframe)\n\n consoleGroup.expand(options.logExpand)\n if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {\n consoleGroup.log('Created Vue component')\n }\n })\n\n onBeforeUnmount(() => {\n resizer.value?.disconnect()\n })\n\n defineExpose({\n moveToAnchor: (anchor: string) => resizer.value?.moveToAnchor(anchor),\n resize: () => resizer.value?.resize(),\n sendMessage: (msg: any, target?: string) =>\n resizer.value?.sendMessage(msg, target),\n })\n</script>\n","import type { App } from 'vue'\n\nimport IframeResizer from './iframe-resizer.vue'\n\nexport default {\n install(app: App) {\n app.component('IframeResizer', IframeResizer)\n },\n}\n"],"names":["EXPAND","COLLAPSE","createAutoConsoleGroup","mod","acg","props","__props","emit","__emit","iframeRef","ref","resizer","onMounted","consoleGroup","iframe","options","toRaw","value","args","connectResizer","onBeforeUnmount","__expose","anchor","msg","target","_openBlock","_createElementBlock","_mergeProps","$attrs","index","app","IframeResizer"],"mappings":"sGAWQA,EAAS,WACTC,EAAW,wiBAOjB,MAAMC,GALmBC,GAEvBA,GAAK,WAAaA,EAAI,QAAUA,GAGaC,CAAG,EAI5CC,EAAQC,EAuCRC,EAAOC,EAMPC,EAAYC,EAAAA,IAA8B,IAAI,EAC9CC,EAAUD,EAAAA,IAAyB,IAAI,EAE7CE,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAeX,EAAA,EAEfY,EAASL,EAAU,MACnBM,EAAe,CACnB,GAAG,OAAO,YACR,OAAO,QAAQC,EAAAA,MAAMX,CAAK,CAAC,EAAE,OAAO,CAAC,CAAA,CAAGY,CAAK,IAAMA,IAAU,MAAS,CAAA,EAExE,YAAa,GAEb,cAAe,KACbJ,EAAa,MAAM,qBAAqB,EACxCA,EAAa,KAAK,oDAAoD,EAC/D,IAET,QAAS,IAAIK,IAAgBX,EAAK,UAAW,GAAGW,CAAI,EACpD,UAAW,IAAIA,IAAgBX,EAAK,YAAa,GAAGW,CAAI,EACxD,UAAW,IAAIA,IAAgBX,EAAK,YAAa,GAAGW,CAAI,CAAA,EAG1DL,EAAa,MAAM,OAAOC,EAAO,EAAE,GAAG,EACtCD,EAAa,MAAM,OAAO,EAE1BF,EAAQ,MAAQQ,EAAeJ,CAAO,EAAED,CAAM,EAE9CD,EAAa,OAAOE,EAAQ,SAAS,EACjC,CAACd,EAAUD,EAAQ,EAAI,EAAE,SAASe,EAAQ,GAAU,GACtDF,EAAa,IAAI,uBAAuB,CAE5C,CAAC,EAEDO,EAAAA,gBAAgB,IAAM,CACpBT,EAAQ,OAAO,WAAA,CACjB,CAAC,EAEDU,EAAa,CACX,aAAeC,GAAmBX,EAAQ,OAAO,aAAaW,CAAM,EACpE,OAAQ,IAAMX,EAAQ,OAAO,OAAA,EAC7B,YAAa,CAACY,EAAUC,IACtBb,EAAQ,OAAO,YAAYY,EAAKC,CAAM,CAAA,CACzC,UA9GDC,EAAAA,YAAAC,EAAAA,mBAAiD,SAAjDC,aAAiD,SAArC,YAAJ,IAAIlB,CAAA,EAAoBmB,EAAAA,MAAM,EAAA,KAAA,EAAA,MCGxCC,EAAe,CACb,QAAQC,EAAU,CAChBA,EAAI,UAAU,gBAAiBC,CAAa,CAC9C,CACF"}
package/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- interface VueApp {
2
- component: (name: string, component: any) => void;
3
- }
1
+ import { App } from 'vue';
4
2
  declare const _default: {
5
- install(app: VueApp): void;
3
+ install(app: App): void;
6
4
  };
7
5
  export default _default;
package/index.esm.js CHANGED
@@ -1,41 +1,34 @@
1
- import d from "@iframe-resizer/core";
2
- import p from "auto-console-group";
3
- import { openBlock as u, createElementBlock as f, mergeProps as m } from "vue";
4
- const a = "expanded", c = "collapsed", g = (e) => (
5
- // eslint-disable-next-line no-underscore-dangle
6
- e?.__esModule ? e.default : e
7
- ), y = g(p), h = {
1
+ import { defineComponent as g, ref as l, onMounted as v, toRaw as R, onBeforeUnmount as b, openBlock as y, createElementBlock as z, mergeProps as B } from "vue";
2
+ import M from "@iframe-resizer/core";
3
+ import _ from "auto-console-group";
4
+ const c = "expanded", u = "collapsed", k = /* @__PURE__ */ g({
8
5
  name: "IframeResizer",
6
+ __name: "iframe-resizer",
9
7
  props: {
10
8
  license: {
11
9
  type: String,
12
10
  required: !0
13
11
  },
14
- bodyBackground: {
15
- type: String
16
- },
17
- bodyMargin: {
18
- type: String
19
- },
20
- bodyPadding: {
21
- type: String
22
- },
12
+ bodyBackground: String,
13
+ bodyMargin: String,
14
+ bodyPadding: String,
23
15
  checkOrigin: {
24
16
  type: Boolean,
25
17
  default: !0
26
18
  },
27
- direction: {
28
- type: String
29
- },
19
+ direction: String,
30
20
  log: {
31
21
  type: [String, Boolean, Number],
32
- validator: (e) => {
33
- switch (e) {
22
+ validator: (n) => {
23
+ switch (n) {
24
+ case u:
34
25
  case c:
35
- case a:
36
26
  case !1:
37
27
  case !0:
38
28
  case -1:
29
+ case 0:
30
+ case 1:
31
+ case 2:
39
32
  return !0;
40
33
  default:
41
34
  return !1;
@@ -43,88 +36,53 @@ const a = "expanded", c = "collapsed", g = (e) => (
43
36
  },
44
37
  default: void 0
45
38
  },
46
- inPageLinks: {
47
- type: Boolean
48
- },
49
- offset: {
50
- type: Number
51
- },
52
- scrolling: {
53
- type: Boolean
54
- },
55
- tolerance: {
56
- type: Number
57
- },
58
- warningTimeout: {
59
- type: Number
60
- }
39
+ inPageLinks: Boolean,
40
+ offset: Number,
41
+ scrolling: Boolean,
42
+ tolerance: Number,
43
+ warningTimeout: Number
61
44
  },
62
- data() {
63
- return {
64
- resizer: null
65
- };
66
- },
67
- mounted() {
68
- const e = this, { iframe: t } = this.$refs, o = {
69
- ...Object.fromEntries(
70
- Object.entries(this.$props).filter(
71
- ([r, l]) => l !== void 0
72
- )
73
- ),
74
- waitForLoad: !0,
75
- onBeforeClose: () => (n.event("Blocked Close Event"), n.warn("Close method is disabled, use Vue to remove iframe"), !1),
76
- onReady: (...r) => e.$emit("onReady", ...r),
77
- onMessage: (...r) => e.$emit("onMessage", ...r),
78
- onResized: (...r) => e.$emit("onResized", ...r)
79
- }, s = d(o);
80
- e.resizer = s(t);
81
- const i = {
82
- label: `vue(${t.id})`,
83
- expand: o.logExpand
84
- // set inside connectResizer
85
- }, n = y(i);
86
- n.event("setup"), [c, a, !0].includes(o.log) && n.log("Created Vue component");
87
- },
88
- // Vue 2 lifecycle hook
89
- beforeDestroy() {
90
- this.resizer?.disconnect();
91
- },
92
- // Vue 3 lifecycle hook
93
- beforeUnmount() {
94
- this.resizer?.disconnect();
95
- },
96
- methods: {
97
- moveToAnchor(e) {
98
- this.resizer?.moveToAnchor(e);
99
- },
100
- resize() {
101
- this.resizer?.resize();
102
- },
103
- sendMessage(e, t) {
104
- this.resizer?.sendMessage(e, t);
105
- }
45
+ emits: ["onReady", "onMessage", "onResized"],
46
+ setup(n, { expose: d, emit: m }) {
47
+ const f = ((e) => (
48
+ // eslint-disable-next-line no-underscore-dangle
49
+ e?.__esModule ? e.default : e
50
+ ))(_), p = n, s = m, i = l(null), r = l(null);
51
+ return v(() => {
52
+ const e = f(), t = i.value, a = {
53
+ ...Object.fromEntries(
54
+ Object.entries(R(p)).filter(([, o]) => o !== void 0)
55
+ ),
56
+ waitForLoad: !0,
57
+ onBeforeClose: () => (e.event("Blocked Close Event"), e.warn("Close method is disabled, use Vue to remove iframe"), !1),
58
+ onReady: (...o) => s("onReady", ...o),
59
+ onMessage: (...o) => s("onMessage", ...o),
60
+ onResized: (...o) => s("onResized", ...o)
61
+ };
62
+ e.label(`vue(${t.id})`), e.event("setup"), r.value = M(a)(t), e.expand(a.logExpand), [u, c, !0].includes(a.log) && e.log("Created Vue component");
63
+ }), b(() => {
64
+ r.value?.disconnect();
65
+ }), d({
66
+ moveToAnchor: (e) => r.value?.moveToAnchor(e),
67
+ resize: () => r.value?.resize(),
68
+ sendMessage: (e, t) => r.value?.sendMessage(e, t)
69
+ }), (e, t) => (y(), z(
70
+ "iframe",
71
+ B({
72
+ ref_key: "iframeRef",
73
+ ref: i
74
+ }, e.$attrs),
75
+ null,
76
+ 16
77
+ /* FULL_PROPS */
78
+ ));
106
79
  }
107
- }, z = (e, t) => {
108
- const o = e.__vccOpts || e;
109
- for (const [s, i] of t)
110
- o[s] = i;
111
- return o;
112
- };
113
- function b(e, t, o, s, i, n) {
114
- return u(), f(
115
- "iframe",
116
- m({ ref: "iframe" }, e.$attrs),
117
- null,
118
- 16
119
- /* FULL_PROPS */
120
- );
121
- }
122
- const v = /* @__PURE__ */ z(h, [["render", b]]), k = {
123
- install(e) {
124
- e.component("IframeResizer", v);
80
+ }), E = {
81
+ install(n) {
82
+ n.component("IframeResizer", k);
125
83
  }
126
84
  };
127
85
  export {
128
- k as default
86
+ E as default
129
87
  };
130
88
  //# sourceMappingURL=index.esm.js.map
package/index.esm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../packages/vue/iframe-resizer.vue","../../packages/vue/index.ts"],"sourcesContent":["<template>\n <iframe ref=\"iframe\" v-bind=\"$attrs\"></iframe>\n</template>\n\n<script lang=\"ts\">\n import type { PropType } from 'vue'\n import connectResizer from '@iframe-resizer/core'\n import type { IFrameObject } from '@iframe-resizer/core'\n import acg from 'auto-console-group'\n\n const EXPAND = 'expanded'\n const COLLAPSE = 'collapsed'\n\n type LogOption = 'expanded' | 'collapsed' | boolean | -1\n\n const esModuleInterop = (mod: any) =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\n // Deal with UMD not converting default exports to named exports\n const createAutoConsoleGroup = esModuleInterop(acg)\n\n export default {\n name: 'IframeResizer',\n\n props: {\n license: {\n type: String,\n required: true,\n },\n bodyBackground: {\n type: String,\n },\n bodyMargin: {\n type: String,\n },\n bodyPadding: {\n type: String,\n },\n checkOrigin: {\n type: Boolean,\n default: true,\n },\n direction: {\n type: String,\n },\n log: {\n type: [String, Boolean, Number] as PropType<LogOption>,\n validator: (value: LogOption) => {\n switch (value) {\n case COLLAPSE:\n case EXPAND:\n case false:\n case true:\n case -1:\n return true\n default:\n return false\n }\n },\n default: undefined,\n },\n inPageLinks: {\n type: Boolean,\n },\n offset: {\n type: Number,\n },\n scrolling: {\n type: Boolean,\n },\n tolerance: {\n type: Number,\n },\n warningTimeout: {\n type: Number,\n },\n },\n\n data() {\n return {\n resizer: null as IFrameObject | null,\n }\n },\n\n mounted() {\n const self = this\n const { iframe } = this.$refs as { iframe: HTMLIFrameElement }\n const options: any = {\n ...Object.fromEntries(\n Object.entries(this.$props).filter(\n ([key, value]) => value !== undefined\n )\n ),\n waitForLoad: true,\n\n onBeforeClose: () => {\n consoleGroup.event('Blocked Close Event')\n consoleGroup.warn('Close method is disabled, use Vue to remove iframe')\n return false\n },\n onReady: (...args: any[]) => self.$emit('onReady', ...args),\n onMessage: (...args: any[]) => self.$emit('onMessage', ...args),\n onResized: (...args: any[]) => self.$emit('onResized', ...args),\n }\n\n const connectWithOptions = connectResizer(options)\n self.resizer = connectWithOptions(iframe)\n\n const consoleOptions = {\n label: `vue(${iframe.id})`,\n expand: (options as any).logExpand, // set inside connectResizer\n }\n\n const consoleGroup = createAutoConsoleGroup(consoleOptions)\n consoleGroup.event('setup')\n\n if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {\n consoleGroup.log('Created Vue component')\n }\n },\n\n // Vue 2 lifecycle hook\n beforeDestroy() {\n this.resizer?.disconnect()\n },\n\n // Vue 3 lifecycle hook\n beforeUnmount() {\n this.resizer?.disconnect()\n },\n\n methods: {\n moveToAnchor(anchor: string) {\n this.resizer?.moveToAnchor(anchor)\n },\n resize() {\n this.resizer?.resize()\n },\n sendMessage(msg: any, target?: string) {\n this.resizer?.sendMessage(msg, target)\n },\n },\n }\n</script>\n","import IframeResizer from './iframe-resizer.vue'\n\n// Duck-typed interface compatible with both Vue 2 and Vue 3\ninterface VueApp {\n component: (name: string, component: any) => void\n}\n\nexport default {\n install(app: VueApp) {\n app.component('IframeResizer', IframeResizer)\n },\n}\n"],"names":["EXPAND","COLLAPSE","esModuleInterop","mod","createAutoConsoleGroup","acg","_sfc_main","value","self","iframe","options","key","consoleGroup","args","connectWithOptions","connectResizer","consoleOptions","anchor","msg","target","_openBlock","_createElementBlock","_mergeProps","_ctx","index","app","IframeResizer"],"mappings":";;;AAUE,MAAMA,IAAS,YACTC,IAAW,aAIXC,IAAkB,CAACC;AAAA;AAAA,EAEvBA,GAAK,aAAaA,EAAI,UAAUA;AAAA,GAG5BC,IAAyBF,EAAgBG,CAAG,GAElDC,IAAe;AAAA,EACb,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,IAEZ,gBAAgB;AAAA,MACd,MAAM;AAAA,IAAA;AAAA,IAER,YAAY;AAAA,MACV,MAAM;AAAA,IAAA;AAAA,IAER,aAAa;AAAA,MACX,MAAM;AAAA,IAAA;AAAA,IAER,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEX,WAAW;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,IAER,KAAK;AAAA,MACH,MAAM,CAAC,QAAQ,SAAS,MAAM;AAAA,MAC9B,WAAW,CAACC,MAAqB;AAC/B,gBAAQA,GAAA;AAAA,UACN,KAAKN;AAAA,UACL,KAAKD;AAAA,UACL,KAAK;AAAA,UACL,KAAK;AAAA,UACL,KAAK;AACH,mBAAO;AAAA,UACT;AACE,mBAAO;AAAA,QAAA;AAAA,MAEb;AAAA,MACA,SAAS;AAAA,IAAA;AAAA,IAEX,aAAa;AAAA,MACX,MAAM;AAAA,IAAA;AAAA,IAER,QAAQ;AAAA,MACN,MAAM;AAAA,IAAA;AAAA,IAER,WAAW;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,IAER,WA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IACnC;AAAA,IACA,SAAS;AACP,WAAK,SAAS,OAAA;AAAA,IAChB;AAAA,IACA,YAAYC,GAAUC,GAAiB;AACrC,WAAK,SAAS,YAAYD,GAAKC,CAAM;AAAA,IACvC;AAAA,EAAA;AAEJ;;;;;;;AA9IA,SAAAC,EAAA,GAAAC;AAAAA,IAA8C;AAAA,IAA9CC,EAA8C,EAAtC,KAAI,SAAA,GAAiBC,EAAA,MAAM;AAAA,IAAA;AAAA,IAAA;AAAA;AAAA,EAAA;;iDCMrCC,IAAe;AAAA,EACb,QAAQC,GAAa;AACnB,IAAAA,EAAI,UAAU,iBAAiBC,CAAa;AAAA,EAC9C;AACF;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../packages/vue/iframe-resizer.vue","../../packages/vue/index.ts"],"sourcesContent":["<template>\n <iframe ref=\"iframeRef\" v-bind=\"$attrs\"></iframe>\n</template>\n\n<script setup lang=\"ts\">\n import { onBeforeUnmount, onMounted, ref, toRaw } from 'vue'\n import type { PropType } from 'vue'\n import connectResizer from '@iframe-resizer/core'\n import type { IFrameObject, LogOption } from '@iframe-resizer/core'\n import acg from 'auto-console-group'\n\n const EXPAND = 'expanded'\n const COLLAPSE = 'collapsed'\n\n const esModuleInterop = (mod: any) =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\n // Deal with UMD not converting default exports to named exports\n const createAutoConsoleGroup = esModuleInterop(acg)\n\n defineOptions({ name: 'IframeResizer' })\n\n const props = defineProps({\n license: {\n type: String,\n required: true,\n },\n bodyBackground: String,\n bodyMargin: String,\n bodyPadding: String,\n checkOrigin: {\n type: Boolean,\n default: true,\n },\n direction: String,\n log: {\n type: [String, Boolean, Number] as PropType<LogOption>,\n validator: (value: LogOption) => {\n switch (value) {\n case COLLAPSE:\n case EXPAND:\n case false:\n case true:\n case -1:\n case 0:\n case 1:\n case 2:\n return true\n default:\n return false\n }\n },\n default: undefined,\n },\n inPageLinks: Boolean,\n offset: Number,\n scrolling: Boolean,\n tolerance: Number,\n warningTimeout: Number,\n })\n\n const emit = defineEmits<{\n onReady: [...args: any[]]\n onMessage: [...args: any[]]\n onResized: [...args: any[]]\n }>()\n\n const iframeRef = ref<HTMLIFrameElement | null>(null)\n const resizer = ref<IFrameObject | null>(null)\n\n onMounted(() => {\n const consoleGroup = createAutoConsoleGroup()\n // Template refs are guaranteed populated before onMounted fires\n const iframe = iframeRef.value!\n const options: any = {\n ...Object.fromEntries(\n Object.entries(toRaw(props)).filter(([, value]) => value !== undefined),\n ),\n waitForLoad: true,\n\n onBeforeClose: () => {\n consoleGroup.event('Blocked Close Event')\n consoleGroup.warn('Close method is disabled, use Vue to remove iframe')\n return false\n },\n onReady: (...args: any[]) => emit('onReady', ...args),\n onMessage: (...args: any[]) => emit('onMessage', ...args),\n onResized: (...args: any[]) => emit('onResized', ...args),\n }\n\n consoleGroup.label(`vue(${iframe.id})`)\n consoleGroup.event('setup')\n\n resizer.value = connectResizer(options)(iframe)\n\n consoleGroup.expand(options.logExpand)\n if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {\n consoleGroup.log('Created Vue component')\n }\n })\n\n onBeforeUnmount(() => {\n resizer.value?.disconnect()\n })\n\n defineExpose({\n moveToAnchor: (anchor: string) => resizer.value?.moveToAnchor(anchor),\n resize: () => resizer.value?.resize(),\n sendMessage: (msg: any, target?: string) =>\n resizer.value?.sendMessage(msg, target),\n })\n</script>\n","import type { App } from 'vue'\n\nimport IframeResizer from './iframe-resizer.vue'\n\nexport default {\n install(app: App) {\n app.component('IframeResizer', IframeResizer)\n },\n}\n"],"names":["EXPAND","COLLAPSE","createAutoConsoleGroup","mod","acg","props","__props","emit","__emit","iframeRef","ref","resizer","onMounted","consoleGroup","iframe","options","toRaw","value","args","connectResizer","onBeforeUnmount","__expose","anchor","msg","target","_openBlock","_createElementBlock","_mergeProps","$attrs","index","app","IframeResizer"],"mappings":";;;AAWE,MAAMA,IAAS,YACTC,IAAW;;;;;;;;;;;;;;;;;;;;;;;;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CAAM;AAAA,IAAA,CACzC,cA9GDC,KAAAC;AAAAA,MAAiD;AAAA,MAAjDC,EAAiD;AAAA,iBAArC;AAAA,QAAJ,KAAIlB;AAAA,MAAA,GAAoBmB,EAAAA,MAAM;AAAA,MAAA;AAAA,MAAA;AAAA;AAAA,IAAA;AAAA;ICGxCC,IAAe;AAAA,EACb,QAAQC,GAAU;AAChB,IAAAA,EAAI,UAAU,iBAAiBC,CAAa;AAAA,EAC9C;AACF;"}
package/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(t,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("@iframe-resizer/core"),require("auto-console-group"),require("vue")):typeof define=="function"&&define.amd?define(["@iframe-resizer/core","auto-console-group","vue"],s):(t=typeof globalThis<"u"?globalThis:t||self,t.IframeResizer=s(t.connectResizer,t.acg,t.Vue))})(this,(function(t,s,u){"use strict";const d="expanded",l="collapsed",p=(e=>e?.__esModule?e.default:e)(s),f={name:"IframeResizer",props:{license:{type:String,required:!0},bodyBackground:{type:String},bodyMargin:{type:String},bodyPadding:{type:String},checkOrigin:{type:Boolean,default:!0},direction:{type:String},log:{type:[String,Boolean,Number],validator:e=>{switch(e){case l:case d:case!1:case!0:case-1:return!0;default:return!1}},default:void 0},inPageLinks:{type:Boolean},offset:{type:Number},scrolling:{type:Boolean},tolerance:{type:Number},warningTimeout:{type:Number}},data(){return{resizer:null}},mounted(){const e=this,{iframe:o}=this.$refs,r={...Object.fromEntries(Object.entries(this.$props).filter(([n,h])=>h!==void 0)),waitForLoad:!0,onBeforeClose:()=>(i.event("Blocked Close Event"),i.warn("Close method is disabled, use Vue to remove iframe"),!1),onReady:(...n)=>e.$emit("onReady",...n),onMessage:(...n)=>e.$emit("onMessage",...n),onResized:(...n)=>e.$emit("onResized",...n)},c=t(r);e.resizer=c(o);const a={label:`vue(${o.id})`,expand:r.logExpand},i=p(a);i.event("setup"),[l,d,!0].includes(r.log)&&i.log("Created Vue component")},beforeDestroy(){this.resizer?.disconnect()},beforeUnmount(){this.resizer?.disconnect()},methods:{moveToAnchor(e){this.resizer?.moveToAnchor(e)},resize(){this.resizer?.resize()},sendMessage(e,o){this.resizer?.sendMessage(e,o)}}},m=(e,o)=>{const r=e.__vccOpts||e;for(const[c,a]of o)r[c]=a;return r};function g(e,o,r,c,a,i){return u.openBlock(),u.createElementBlock("iframe",u.mergeProps({ref:"iframe"},e.$attrs),null,16)}const y=m(f,[["render",g]]);return{install(e){e.component("IframeResizer",y)}}}));
1
+ (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("vue"),require("@iframe-resizer/core"),require("auto-console-group")):typeof define=="function"&&define.amd?define(["vue","@iframe-resizer/core","auto-console-group"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.IframeResizer=r(e.Vue,e.connectResizer,e.acg))})(this,(function(e,r,f){"use strict";const u="expanded",d="collapsed",m=e.defineComponent({name:"IframeResizer",__name:"iframe-resizer",props:{license:{type:String,required:!0},bodyBackground:String,bodyMargin:String,bodyPadding:String,checkOrigin:{type:Boolean,default:!0},direction:String,log:{type:[String,Boolean,Number],validator:t=>{switch(t){case d:case u:case!1:case!0:case-1:case 0:case 1:case 2:return!0;default:return!1}},default:void 0},inPageLinks:Boolean,offset:Number,scrolling:Boolean,tolerance:Number,warningTimeout:Number},emits:["onReady","onMessage","onResized"],setup(t,{expose:p,emit:g}){const z=(o=>o?.__esModule?o.default:o)(f),R=t,a=g,l=e.ref(null),s=e.ref(null);return e.onMounted(()=>{const o=z(),i=l.value,c={...Object.fromEntries(Object.entries(e.toRaw(R)).filter(([,n])=>n!==void 0)),waitForLoad:!0,onBeforeClose:()=>(o.event("Blocked Close Event"),o.warn("Close method is disabled, use Vue to remove iframe"),!1),onReady:(...n)=>a("onReady",...n),onMessage:(...n)=>a("onMessage",...n),onResized:(...n)=>a("onResized",...n)};o.label(`vue(${i.id})`),o.event("setup"),s.value=r(c)(i),o.expand(c.logExpand),[d,u,!0].includes(c.log)&&o.log("Created Vue component")}),e.onBeforeUnmount(()=>{s.value?.disconnect()}),p({moveToAnchor:o=>s.value?.moveToAnchor(o),resize:()=>s.value?.resize(),sendMessage:(o,i)=>s.value?.sendMessage(o,i)}),(o,i)=>(e.openBlock(),e.createElementBlock("iframe",e.mergeProps({ref_key:"iframeRef",ref:l},o.$attrs),null,16))}});return{install(t){t.component("IframeResizer",m)}}}));
2
2
  //# sourceMappingURL=index.umd.js.map
package/index.umd.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../packages/vue/iframe-resizer.vue","../../packages/vue/index.ts"],"sourcesContent":["<template>\n <iframe ref=\"iframe\" v-bind=\"$attrs\"></iframe>\n</template>\n\n<script lang=\"ts\">\n import type { PropType } from 'vue'\n import connectResizer from '@iframe-resizer/core'\n import type { IFrameObject } from '@iframe-resizer/core'\n import acg from 'auto-console-group'\n\n const EXPAND = 'expanded'\n const COLLAPSE = 'collapsed'\n\n type LogOption = 'expanded' | 'collapsed' | boolean | -1\n\n const esModuleInterop = (mod: any) =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\n // Deal with UMD not converting default exports to named exports\n const createAutoConsoleGroup = esModuleInterop(acg)\n\n export default {\n name: 'IframeResizer',\n\n props: {\n license: {\n type: String,\n required: true,\n },\n bodyBackground: {\n type: String,\n },\n bodyMargin: {\n type: String,\n },\n bodyPadding: {\n type: String,\n },\n checkOrigin: {\n type: Boolean,\n default: true,\n },\n direction: {\n type: String,\n },\n log: {\n type: [String, Boolean, Number] as PropType<LogOption>,\n validator: (value: LogOption) => {\n switch (value) {\n case COLLAPSE:\n case EXPAND:\n case false:\n case true:\n case -1:\n return true\n default:\n return false\n }\n },\n default: undefined,\n },\n inPageLinks: {\n type: Boolean,\n },\n offset: {\n type: Number,\n },\n scrolling: {\n type: Boolean,\n },\n tolerance: {\n type: Number,\n },\n warningTimeout: {\n type: Number,\n },\n },\n\n data() {\n return {\n resizer: null as IFrameObject | null,\n }\n },\n\n mounted() {\n const self = this\n const { iframe } = this.$refs as { iframe: HTMLIFrameElement }\n const options: any = {\n ...Object.fromEntries(\n Object.entries(this.$props).filter(\n ([key, value]) => value !== undefined\n )\n ),\n waitForLoad: true,\n\n onBeforeClose: () => {\n consoleGroup.event('Blocked Close Event')\n consoleGroup.warn('Close method is disabled, use Vue to remove iframe')\n return false\n },\n onReady: (...args: any[]) => self.$emit('onReady', ...args),\n onMessage: (...args: any[]) => self.$emit('onMessage', ...args),\n onResized: (...args: any[]) => self.$emit('onResized', ...args),\n }\n\n const connectWithOptions = connectResizer(options)\n self.resizer = connectWithOptions(iframe)\n\n const consoleOptions = {\n label: `vue(${iframe.id})`,\n expand: (options as any).logExpand, // set inside connectResizer\n }\n\n const consoleGroup = createAutoConsoleGroup(consoleOptions)\n consoleGroup.event('setup')\n\n if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {\n consoleGroup.log('Created Vue component')\n }\n },\n\n // Vue 2 lifecycle hook\n beforeDestroy() {\n this.resizer?.disconnect()\n },\n\n // Vue 3 lifecycle hook\n beforeUnmount() {\n this.resizer?.disconnect()\n },\n\n methods: {\n moveToAnchor(anchor: string) {\n this.resizer?.moveToAnchor(anchor)\n },\n resize() {\n this.resizer?.resize()\n },\n sendMessage(msg: any, target?: string) {\n this.resizer?.sendMessage(msg, target)\n },\n },\n }\n</script>\n","import IframeResizer from './iframe-resizer.vue'\n\n// Duck-typed interface compatible with both Vue 2 and Vue 3\ninterface VueApp {\n component: (name: string, component: any) => void\n}\n\nexport default {\n install(app: VueApp) {\n app.component('IframeResizer', IframeResizer)\n },\n}\n"],"names":["EXPAND","COLLAPSE","createAutoConsoleGroup","mod","acg","_sfc_main","value","self","iframe","options","key","consoleGroup","args","connectWithOptions","connectResizer","consoleOptions","anchor","msg","target","_openBlock","_createElementBlock","_mergeProps","_ctx","app","IframeResizer"],"mappings":"gYAUE,MAAMA,EAAS,WACTC,EAAW,YASXC,GALmBC,GAEvBA,GAAK,WAAaA,EAAI,QAA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,SAAA,EAGrBE,EAAeT,EAAuBa,CAAc,EAC1DJ,EAAa,MAAM,OAAO,EAEtB,CAACV,EAAUD,EAAQ,EAAI,EAAE,SAASS,EAAQ,GAAU,GACtDE,EAAa,IAAI,uBAAuB,CAE5C,EAGA,eAAgB,CACd,KAAK,SAAS,WAAA,CAChB,EAGA,eAAgB,CACd,KAAK,SAAS,WAAA,CAChB,EAEA,QAAS,CACP,aAAaK,EAAgB,CAC3B,KAAK,SAAS,aAAaA,CAAM,CACnC,EACA,QAAS,CACP,KAAK,SAAS,OAAA,CAChB,EACA,YAAYC,EAAUC,EAAiB,CACrC,KAAK,SAAS,YAAYD,EAAKC,CAAM,CACvC,CAAA,CAEJ,+FA9IA,OAAAC,EAAAA,UAAA,EAAAC,EAAAA,mBAA8C,SAA9CC,EAAAA,WAA8C,CAAtC,IAAI,QAAA,EAAiBC,EAAA,MAAM,EAAA,KAAA,EAAA,oCCMtB,CACb,QAAQC,EAAa,CACnBA,EAAI,UAAU,gBAAiBC,CAAa,CAC9C,CACF"}
1
+ {"version":3,"file":"index.umd.js","sources":["../../packages/vue/iframe-resizer.vue","../../packages/vue/index.ts"],"sourcesContent":["<template>\n <iframe ref=\"iframeRef\" v-bind=\"$attrs\"></iframe>\n</template>\n\n<script setup lang=\"ts\">\n import { onBeforeUnmount, onMounted, ref, toRaw } from 'vue'\n import type { PropType } from 'vue'\n import connectResizer from '@iframe-resizer/core'\n import type { IFrameObject, LogOption } from '@iframe-resizer/core'\n import acg from 'auto-console-group'\n\n const EXPAND = 'expanded'\n const COLLAPSE = 'collapsed'\n\n const esModuleInterop = (mod: any) =>\n // eslint-disable-next-line no-underscore-dangle\n mod?.__esModule ? mod.default : mod\n\n // Deal with UMD not converting default exports to named exports\n const createAutoConsoleGroup = esModuleInterop(acg)\n\n defineOptions({ name: 'IframeResizer' })\n\n const props = defineProps({\n license: {\n type: String,\n required: true,\n },\n bodyBackground: String,\n bodyMargin: String,\n bodyPadding: String,\n checkOrigin: {\n type: Boolean,\n default: true,\n },\n direction: String,\n log: {\n type: [String, Boolean, Number] as PropType<LogOption>,\n validator: (value: LogOption) => {\n switch (value) {\n case COLLAPSE:\n case EXPAND:\n case false:\n case true:\n case -1:\n case 0:\n case 1:\n case 2:\n return true\n default:\n return false\n }\n },\n default: undefined,\n },\n inPageLinks: Boolean,\n offset: Number,\n scrolling: Boolean,\n tolerance: Number,\n warningTimeout: Number,\n })\n\n const emit = defineEmits<{\n onReady: [...args: any[]]\n onMessage: [...args: any[]]\n onResized: [...args: any[]]\n }>()\n\n const iframeRef = ref<HTMLIFrameElement | null>(null)\n const resizer = ref<IFrameObject | null>(null)\n\n onMounted(() => {\n const consoleGroup = createAutoConsoleGroup()\n // Template refs are guaranteed populated before onMounted fires\n const iframe = iframeRef.value!\n const options: any = {\n ...Object.fromEntries(\n Object.entries(toRaw(props)).filter(([, value]) => value !== undefined),\n ),\n waitForLoad: true,\n\n onBeforeClose: () => {\n consoleGroup.event('Blocked Close Event')\n consoleGroup.warn('Close method is disabled, use Vue to remove iframe')\n return false\n },\n onReady: (...args: any[]) => emit('onReady', ...args),\n onMessage: (...args: any[]) => emit('onMessage', ...args),\n onResized: (...args: any[]) => emit('onResized', ...args),\n }\n\n consoleGroup.label(`vue(${iframe.id})`)\n consoleGroup.event('setup')\n\n resizer.value = connectResizer(options)(iframe)\n\n consoleGroup.expand(options.logExpand)\n if ([COLLAPSE, EXPAND, true].includes(options.log as any)) {\n consoleGroup.log('Created Vue component')\n }\n })\n\n onBeforeUnmount(() => {\n resizer.value?.disconnect()\n })\n\n defineExpose({\n moveToAnchor: (anchor: string) => resizer.value?.moveToAnchor(anchor),\n resize: () => resizer.value?.resize(),\n sendMessage: (msg: any, target?: string) =>\n resizer.value?.sendMessage(msg, target),\n })\n</script>\n","import type { App } from 'vue'\n\nimport IframeResizer from './iframe-resizer.vue'\n\nexport default {\n install(app: App) {\n app.component('IframeResizer', IframeResizer)\n },\n}\n"],"names":["EXPAND","COLLAPSE","createAutoConsoleGroup","mod","acg","props","__props","emit","__emit","iframeRef","ref","resizer","onMounted","consoleGroup","iframe","options","toRaw","value","args","connectResizer","onBeforeUnmount","__expose","anchor","msg","target","_openBlock","_createElementBlock","_mergeProps","$attrs","app","IframeResizer"],"mappings":"gYAWE,MAAMA,EAAS,WACTC,EAAW,wiBAOjB,MAAMC,GALmBC,GAEvBA,GAAK,WAAaA,EAAI,QAAUA,GAGaC,CAAG,EAI5CC,EAAQC,EAuCRC,EAAOC,EAMPC,EAAYC,EAAAA,IAA8B,IAAI,EAC9CC,EAAUD,EAAAA,IAAyB,IAAI,EAE7CE,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAeX,EAAA,EAEfY,EAASL,EAAU,MACnBM,EAAe,CACnB,GAAG,OAAO,YACR,OAAO,QAAQC,EAAAA,MAAMX,CAAK,CAAC,EAAE,OAAO,CAAC,CAAA,CAAGY,CAAK,IAAMA,IAAU,MAAS,CAAA,EAExE,YAAa,GAEb,cAAe,KACbJ,EAAa,MAAM,qBAAqB,EACxCA,EAAa,KAAK,oDAAoD,EAC/D,IAET,QAAS,IAAIK,IAAgBX,EAAK,UAAW,GAAGW,CAAI,EACpD,UAAW,IAAIA,IAAgBX,EAAK,YAAa,GAAGW,CAAI,EACxD,UAAW,IAAIA,IAAgBX,EAAK,YAAa,GAAGW,CAAI,CAAA,EAG1DL,EAAa,MAAM,OAAOC,EAAO,EAAE,GAAG,EACtCD,EAAa,MAAM,OAAO,EAE1BF,EAAQ,MAAQQ,EAAeJ,CAAO,EAAED,CAAM,EAE9CD,EAAa,OAAOE,EAAQ,SAAS,EACjC,CAACd,EAAUD,EAAQ,EAAI,EAAE,SAASe,EAAQ,GAAU,GACtDF,EAAa,IAAI,uBAAuB,CAE5C,CAAC,EAEDO,EAAAA,gBAAgB,IAAM,CACpBT,EAAQ,OAAO,WAAA,CACjB,CAAC,EAEDU,EAAa,CACX,aAAeC,GAAmBX,EAAQ,OAAO,aAAaW,CAAM,EACpE,OAAQ,IAAMX,EAAQ,OAAO,OAAA,EAC7B,YAAa,CAACY,EAAUC,IACtBb,EAAQ,OAAO,YAAYY,EAAKC,CAAM,CAAA,CACzC,UA9GDC,EAAAA,YAAAC,EAAAA,mBAAiD,SAAjDC,aAAiD,SAArC,YAAJ,IAAIlB,CAAA,EAAoBmB,EAAAA,MAAM,EAAA,KAAA,EAAA,YCGzB,CACb,QAAQC,EAAU,CAChBA,EAAI,UAAU,gBAAiBC,CAAa,CAC9C,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/vue",
3
- "version": "6.0.0-beta.0",
3
+ "version": "6.0.0-beta.2",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {
@@ -24,7 +24,7 @@
24
24
  "./sfc": "iframe-resizer.vue"
25
25
  },
26
26
  "peerDependencies": {
27
- "vue": "^2.6.0 || ^3.0.0"
27
+ "vue": "^3.3.0"
28
28
  },
29
29
  "keywords": [
30
30
  "iframe",
@@ -40,7 +40,7 @@
40
40
  "vue"
41
41
  ],
42
42
  "dependencies": {
43
- "@iframe-resizer/core": "6.0.0-beta.0",
43
+ "@iframe-resizer/core": "6.0.0-beta.2",
44
44
  "auto-console-group": "1.3.0"
45
45
  }
46
46
  }