@iframe-resizer/vue 6.0.0-beta.0 → 6.0.0-beta.1
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 +1 -1
- package/iframe-resizer.vue +90 -122
- package/iframe-resizer.vue.d.ts +4 -6
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/index.d.ts +2 -4
- package/index.esm.js +58 -100
- package/index.esm.js.map +1 -1
- package/index.umd.js +1 -1
- package/index.umd.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
package/iframe-resizer.vue
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<iframe ref="
|
|
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
|
-
|
|
24
|
-
name: 'IframeResizer',
|
|
22
|
+
defineOptions({ name: 'IframeResizer' })
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
29
|
+
bodyBackground: String,
|
|
30
|
+
bodyMargin: String,
|
|
31
|
+
bodyPadding: String,
|
|
32
|
+
checkOrigin: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true,
|
|
84
35
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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>
|
package/iframe-resizer.vue.d.ts
CHANGED
|
@@ -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,11 +16,8 @@ export interface IframeResizerProps {
|
|
|
15
16
|
warningTimeout?: number
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
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
22
|
export interface IframeResizerEmits {
|
|
25
23
|
onReady: (...args: any[]) => void
|
package/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const
|
|
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=\"
|
|
1
|
+
{"version":3,"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
package/index.esm.js
CHANGED
|
@@ -1,41 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
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
|
-
|
|
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: (
|
|
33
|
-
switch (
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
Object.
|
|
71
|
-
([
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
},
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
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=\"
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOjB,UAAMC,KALkB,CAACC;AAAA;AAAA,MAEvBA,GAAK,aAAaA,EAAI,UAAUA;AAAA,OAGaC,CAAG,GAI5CC,IAAQC,G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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(
|
|
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=\"
|
|
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,EAA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C,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iframe-resizer/vue",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.1",
|
|
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": "^
|
|
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.
|
|
43
|
+
"@iframe-resizer/core": "6.0.0-beta.1",
|
|
44
44
|
"auto-console-group": "1.3.0"
|
|
45
45
|
}
|
|
46
46
|
}
|