@open-iframe-resizer/vue 1.6.0 → 1.6.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.
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as I, ref as O, onMounted as k, onBeforeUnmount as M, createElementBlock as B, openBlock as P, mergeProps as A } from "vue";
|
|
2
|
+
const v = () => typeof window < "u", H = () => window.self !== window.top, h = (e) => e instanceof HTMLIFrameElement, _ = (e) => {
|
|
3
3
|
window.document.readyState === "complete" ? e() : window.addEventListener("load", e);
|
|
4
|
-
},
|
|
4
|
+
}, D = (e, t) => {
|
|
5
5
|
t(), e.addEventListener("load", t);
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, C = () => ({ offsetSize: 0, checkOrigin: !0, enableLegacyLibSupport: !1 }), W = (e) => {
|
|
6
|
+
}, T = (e, t) => {
|
|
7
|
+
const n = e.contentWindow?.document.readyState === "complete";
|
|
8
|
+
return e.src !== "about:blank" && e.contentWindow?.location.href !== "about:blank" && n ? t() : e.addEventListener("load", t);
|
|
9
|
+
}, x = () => ({ offsetSize: 0, checkOrigin: !0, enableLegacyLibSupport: !1 }), C = (e) => {
|
|
11
10
|
try {
|
|
12
11
|
return new URL(e.src).origin === window.location.origin;
|
|
13
12
|
} catch {
|
|
14
13
|
return !1;
|
|
15
14
|
}
|
|
16
|
-
},
|
|
15
|
+
}, W = (e) => {
|
|
17
16
|
try {
|
|
18
17
|
const t = new URL(e.src).origin;
|
|
19
18
|
if (t !== "about:blank")
|
|
@@ -21,55 +20,57 @@ const S = () => typeof window < "u", _ = () => window.self !== window.top, v = (
|
|
|
21
20
|
} catch {
|
|
22
21
|
}
|
|
23
22
|
return null;
|
|
24
|
-
},
|
|
23
|
+
}, F = (e) => (Object.keys(e).forEach((t) => {
|
|
24
|
+
e[t] === void 0 && delete e[t];
|
|
25
|
+
}), e), S = (e) => {
|
|
25
26
|
const { height: t, width: n } = e.getBoundingClientRect();
|
|
26
27
|
return { height: Math.ceil(t), width: Math.ceil(n) };
|
|
27
|
-
},
|
|
28
|
+
}, l = (e, t) => e ? t ? e.querySelector(t) : e.documentElement : null, E = (e, t) => {
|
|
28
29
|
e && (t.bodyPadding && (e.body.style.padding = t.bodyPadding), t.bodyMargin && (e.body.style.margin = t.bodyMargin));
|
|
29
|
-
},
|
|
30
|
-
function
|
|
30
|
+
}, g = (e) => e <= 100 ? 100 : e <= 120 ? 1e3 : 1e4, $ = () => "[iFrameSizer]ID:0:false:false:32:true:true::auto:::0:false:child:auto:true:::true:::false";
|
|
31
|
+
function N(e) {
|
|
31
32
|
if (typeof e.data != "string" || !e.data.startsWith("[iFrameSizer]") || !e.data.endsWith("mutationObserver") && !e.data.endsWith("resizeObserver"))
|
|
32
33
|
return null;
|
|
33
34
|
const [t, n] = e.data.split(":"), r = +n;
|
|
34
35
|
return r > 0 ? r : null;
|
|
35
36
|
}
|
|
36
|
-
const w =
|
|
37
|
+
const w = Q();
|
|
37
38
|
let f = [];
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
39
|
+
const U = (e, t) => {
|
|
40
|
+
if (!v())
|
|
40
41
|
return [];
|
|
41
|
-
const n = { ...
|
|
42
|
-
return r.map((
|
|
42
|
+
const n = { ...x(), ...F(e ?? {}) }, r = j(t), a = q(n, r);
|
|
43
|
+
return r.map((i) => {
|
|
43
44
|
const o = {
|
|
44
|
-
iframe:
|
|
45
|
+
iframe: i,
|
|
45
46
|
settings: n,
|
|
46
47
|
interactionState: { isHovered: !1 },
|
|
47
48
|
initContext: { isInitialized: !1, retryAttempts: 0 }
|
|
48
|
-
}, s =
|
|
49
|
+
}, s = J(o, a);
|
|
49
50
|
return f.push(o), {
|
|
50
51
|
unsubscribe: () => {
|
|
51
|
-
s(), f = f.filter((
|
|
52
|
+
s(), f = f.filter((c) => c.iframe !== i);
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
|
-
function
|
|
57
|
-
return typeof e == "string" ? Array.from(document.querySelectorAll(e)).filter(
|
|
57
|
+
function j(e) {
|
|
58
|
+
return typeof e == "string" ? Array.from(document.querySelectorAll(e)).filter(h) : e ? h(e) ? [e] : [] : Array.from(document.getElementsByTagName("iframe"));
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function q(e, t) {
|
|
60
61
|
if (Array.isArray(e.checkOrigin))
|
|
61
62
|
return e.checkOrigin;
|
|
62
63
|
if (!e.checkOrigin)
|
|
63
64
|
return [];
|
|
64
65
|
const n = [];
|
|
65
66
|
for (const r of t) {
|
|
66
|
-
const
|
|
67
|
-
|
|
67
|
+
const a = W(r);
|
|
68
|
+
a && n.push(a);
|
|
68
69
|
}
|
|
69
70
|
return n;
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
const n =
|
|
72
|
+
function J(e, t) {
|
|
73
|
+
const n = C(e.iframe) ? G(e) : V(e, t), r = K(e);
|
|
73
74
|
return () => {
|
|
74
75
|
n(), r();
|
|
75
76
|
};
|
|
@@ -78,47 +79,43 @@ function V(e, t) {
|
|
|
78
79
|
const {
|
|
79
80
|
iframe: n,
|
|
80
81
|
initContext: r,
|
|
81
|
-
settings: { checkOrigin:
|
|
82
|
-
} = e,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
u && g({ newHeight: u, registeredElement: e });
|
|
82
|
+
settings: { checkOrigin: a, enableLegacyLibSupport: i, targetElementSelector: o, bodyPadding: s, bodyMargin: c }
|
|
83
|
+
} = e, b = (u) => {
|
|
84
|
+
const L = !a || t.includes(u.origin);
|
|
85
|
+
if (!(n.contentWindow !== u.source || !L)) {
|
|
86
|
+
if (u.data?.type === "iframe-resized") {
|
|
87
|
+
const { height: d } = u.data;
|
|
88
|
+
d && m({ newHeight: d, registeredElement: e });
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
91
|
+
if (i) {
|
|
92
|
+
const d = N(u);
|
|
93
|
+
d !== null && m({ newHeight: d, registeredElement: e });
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
window.addEventListener("message",
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
var c;
|
|
102
|
-
return (c = n.contentWindow) == null ? void 0 : c.postMessage(L, "*");
|
|
103
|
-
}), r.retryAttempts++, r.retryTimeoutId = window.setTimeout(y, b(r.retryAttempts));
|
|
98
|
+
window.addEventListener("message", b);
|
|
99
|
+
const R = i ? $() : { type: "iframe-child-init", targetElementSelector: o, bodyPadding: s, bodyMargin: c }, y = () => {
|
|
100
|
+
D(n, () => n.contentWindow?.postMessage(R, "*")), r.retryAttempts++, r.retryTimeoutId = window.setTimeout(y, g(r.retryAttempts));
|
|
104
101
|
};
|
|
105
|
-
return y(), () => window.removeEventListener("message",
|
|
102
|
+
return y(), () => window.removeEventListener("message", b);
|
|
106
103
|
}
|
|
107
|
-
function
|
|
104
|
+
function G(e) {
|
|
108
105
|
const { iframe: t, settings: n } = e, { targetElementSelector: r } = n;
|
|
109
|
-
let
|
|
110
|
-
const
|
|
111
|
-
const o =
|
|
106
|
+
let a = 0;
|
|
107
|
+
const i = () => {
|
|
108
|
+
const o = l(t.contentDocument, r);
|
|
112
109
|
if (!t.contentDocument || !o)
|
|
113
|
-
return
|
|
114
|
-
|
|
110
|
+
return a++, setTimeout(i, g(a));
|
|
111
|
+
E(t.contentDocument, n), w().observe(o);
|
|
115
112
|
};
|
|
116
|
-
return
|
|
117
|
-
const o =
|
|
118
|
-
o && w().unobserve(o), t.removeEventListener("load",
|
|
113
|
+
return T(t, i), () => {
|
|
114
|
+
const o = l(t.contentDocument, r);
|
|
115
|
+
o && w().unobserve(o), t.removeEventListener("load", i);
|
|
119
116
|
};
|
|
120
117
|
}
|
|
121
|
-
function
|
|
118
|
+
function K({ iframe: e, interactionState: t }) {
|
|
122
119
|
const n = () => {
|
|
123
120
|
t.isHovered = !0;
|
|
124
121
|
}, r = () => {
|
|
@@ -128,75 +125,73 @@ function Q({ iframe: e, interactionState: t }) {
|
|
|
128
125
|
e.removeEventListener("mouseenter", n), e.removeEventListener("mouseleave", r);
|
|
129
126
|
};
|
|
130
127
|
}
|
|
131
|
-
function
|
|
128
|
+
function Q() {
|
|
132
129
|
let e = null;
|
|
133
130
|
return () => {
|
|
134
131
|
if (!e) {
|
|
135
132
|
const t = ({ target: n }) => {
|
|
136
|
-
const r = f.find(({ iframe:
|
|
133
|
+
const r = f.find(({ iframe: c }) => c.contentDocument === n.ownerDocument);
|
|
137
134
|
if (!r)
|
|
138
135
|
return;
|
|
139
|
-
const { iframe:
|
|
136
|
+
const { iframe: a, settings: i } = r, o = l(a.contentDocument, i.targetElementSelector);
|
|
140
137
|
if (!o)
|
|
141
138
|
return;
|
|
142
|
-
const { height: s } =
|
|
143
|
-
s &&
|
|
139
|
+
const { height: s } = S(o);
|
|
140
|
+
s && m({ newHeight: s, registeredElement: r });
|
|
144
141
|
};
|
|
145
142
|
e = new ResizeObserver((n) => n.forEach(t));
|
|
146
143
|
}
|
|
147
144
|
return e;
|
|
148
145
|
};
|
|
149
146
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (o.isInitialized || (o.isInitialized = !0, clearTimeout(o.retryTimeoutId)), ((n = i.onBeforeIframeResize) == null ? void 0 : n.call(i, { iframe: r, settings: { ...i }, observedHeight: t })) === !1)
|
|
147
|
+
function m({ registeredElement: e, newHeight: t }) {
|
|
148
|
+
const { iframe: n, settings: r, interactionState: a, initContext: i } = e;
|
|
149
|
+
if (i.isInitialized || (i.isInitialized = !0, clearTimeout(i.retryTimeoutId)), r.onBeforeIframeResize?.({ iframe: n, settings: { ...r }, observedHeight: t }) === !1)
|
|
154
150
|
return;
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
151
|
+
const o = n.getBoundingClientRect(), s = t + r.offsetSize;
|
|
152
|
+
if (n.style.height = `${s}px`, !r.onIframeResize)
|
|
157
153
|
return;
|
|
158
|
-
const
|
|
159
|
-
iframe:
|
|
160
|
-
settings: { ...
|
|
154
|
+
const c = {
|
|
155
|
+
iframe: n,
|
|
156
|
+
settings: { ...r },
|
|
161
157
|
interactionState: { ...a },
|
|
162
|
-
previousRenderState: { rect:
|
|
163
|
-
nextRenderState: { rect:
|
|
158
|
+
previousRenderState: { rect: o },
|
|
159
|
+
nextRenderState: { rect: n.getBoundingClientRect() }
|
|
164
160
|
};
|
|
165
|
-
|
|
161
|
+
r.onIframeResize(c);
|
|
166
162
|
}
|
|
167
|
-
const
|
|
163
|
+
const X = Z();
|
|
168
164
|
let p = !1;
|
|
169
|
-
|
|
170
|
-
function
|
|
171
|
-
!
|
|
172
|
-
|
|
173
|
-
((t = e.data) == null ? void 0 : t.type) === "iframe-child-init" && D(() => R(e));
|
|
165
|
+
Y();
|
|
166
|
+
function Y() {
|
|
167
|
+
!v() || !H() || window.addEventListener("message", (e) => {
|
|
168
|
+
e.data?.type === "iframe-child-init" && _(() => z(e));
|
|
174
169
|
});
|
|
175
170
|
}
|
|
176
|
-
function
|
|
177
|
-
const { targetElementSelector: n, bodyPadding: r, bodyMargin:
|
|
171
|
+
function z(e, t = 0) {
|
|
172
|
+
const { targetElementSelector: n, bodyPadding: r, bodyMargin: a } = e.data, i = l(document, n);
|
|
178
173
|
if (p || window.parent !== e.source)
|
|
179
174
|
return;
|
|
180
|
-
if (!
|
|
181
|
-
return setTimeout(() =>
|
|
182
|
-
|
|
183
|
-
const o =
|
|
184
|
-
o.disconnect(), o.observe(
|
|
175
|
+
if (!i)
|
|
176
|
+
return setTimeout(() => z(e, t + 1), g(t));
|
|
177
|
+
E(document, { bodyMargin: a, bodyPadding: r });
|
|
178
|
+
const o = X();
|
|
179
|
+
o.disconnect(), o.observe(i), p = !0;
|
|
185
180
|
}
|
|
186
|
-
function
|
|
181
|
+
function Z() {
|
|
187
182
|
let e = null;
|
|
188
183
|
return () => (e || (e = new ResizeObserver((t) => {
|
|
189
184
|
if (!t[0].target)
|
|
190
185
|
return;
|
|
191
|
-
const { height: n, width: r } =
|
|
186
|
+
const { height: n, width: r } = S(t[0].target), a = {
|
|
192
187
|
type: "iframe-resized",
|
|
193
188
|
width: r,
|
|
194
189
|
height: n
|
|
195
190
|
};
|
|
196
|
-
window.parent.postMessage(
|
|
191
|
+
window.parent.postMessage(a, "*");
|
|
197
192
|
})), e);
|
|
198
193
|
}
|
|
199
|
-
const
|
|
194
|
+
const ee = I({
|
|
200
195
|
name: "ResizableIframe",
|
|
201
196
|
props: {
|
|
202
197
|
offsetSize: [String, Number, Object],
|
|
@@ -209,9 +204,9 @@ const te = O({
|
|
|
209
204
|
enableLegacyLibSupport: Boolean
|
|
210
205
|
},
|
|
211
206
|
setup(e, { attrs: t }) {
|
|
212
|
-
const n =
|
|
207
|
+
const n = O(null);
|
|
213
208
|
let r = [];
|
|
214
|
-
const
|
|
209
|
+
const a = (i) => {
|
|
215
210
|
const o = {
|
|
216
211
|
offsetSize: e.offsetSize,
|
|
217
212
|
enableLegacyLibSupport: e.enableLegacyLibSupport,
|
|
@@ -224,32 +219,34 @@ const te = O({
|
|
|
224
219
|
};
|
|
225
220
|
Object.keys(o).forEach((s) => {
|
|
226
221
|
o[s] === void 0 && delete o[s];
|
|
227
|
-
}), r =
|
|
222
|
+
}), r = U(o, i);
|
|
228
223
|
};
|
|
229
|
-
return
|
|
230
|
-
n.value &&
|
|
231
|
-
}),
|
|
232
|
-
r.forEach((
|
|
224
|
+
return k(() => {
|
|
225
|
+
n.value && a(n.value);
|
|
226
|
+
}), M(() => {
|
|
227
|
+
r.forEach((i) => {
|
|
228
|
+
i.unsubscribe();
|
|
229
|
+
}), r = [];
|
|
233
230
|
}), {
|
|
234
231
|
iframeRef: n,
|
|
235
232
|
attrs: t
|
|
236
233
|
};
|
|
237
234
|
}
|
|
238
|
-
}),
|
|
235
|
+
}), te = (e, t) => {
|
|
239
236
|
const n = e.__vccOpts || e;
|
|
240
|
-
for (const [r,
|
|
241
|
-
n[r] =
|
|
237
|
+
for (const [r, a] of t)
|
|
238
|
+
n[r] = a;
|
|
242
239
|
return n;
|
|
243
240
|
};
|
|
244
|
-
function
|
|
245
|
-
return
|
|
241
|
+
function ne(e, t, n, r, a, i) {
|
|
242
|
+
return P(), B("iframe", A({ ref: "iframeRef" }, e.$attrs), null, 16);
|
|
246
243
|
}
|
|
247
|
-
const
|
|
244
|
+
const re = /* @__PURE__ */ te(ee, [["render", ne]]), oe = {
|
|
248
245
|
install(e) {
|
|
249
|
-
e.component("IframeResizer",
|
|
246
|
+
e.component("IframeResizer", re);
|
|
250
247
|
}
|
|
251
248
|
};
|
|
252
249
|
export {
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
re as IframeResizer,
|
|
251
|
+
oe as IframeResizerPlugin
|
|
255
252
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u["open-iframe-resizer-vue"]={},u.Vue))})(this,function(u,a){"use strict";const h=()=>typeof window<"u",O=()=>window.self!==window.top,p=e=>e instanceof HTMLIFrameElement,M=e=>{window.document.readyState==="complete"?e():window.addEventListener("load",e)},k=(e,t)=>{t(),e.addEventListener("load",t)},B=(e,t)=>{const n=e.contentWindow?.document.readyState==="complete";return e.src!=="about:blank"&&e.contentWindow?.location.href!=="about:blank"&&n?t():e.addEventListener("load",t)},P=()=>({offsetSize:0,checkOrigin:!0,enableLegacyLibSupport:!1}),T=e=>{try{return new URL(e.src).origin===window.location.origin}catch{return!1}},A=e=>{try{const t=new URL(e.src).origin;if(t!=="about:blank")return t}catch{}return null},H=e=>(Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e),w=e=>{const{height:t,width:n}=e.getBoundingClientRect();return{height:Math.ceil(t),width:Math.ceil(n)}},m=(e,t)=>e?t?e.querySelector(t):e.documentElement:null,S=(e,t)=>{e&&(t.bodyPadding&&(e.body.style.padding=t.bodyPadding),t.bodyMargin&&(e.body.style.margin=t.bodyMargin))},y=e=>e<=100?100:e<=120?1e3:1e4,_=()=>"[iFrameSizer]ID:0:false:false:32:true:true::auto:::0:false:child:auto:true:::true:::false";function D(e){if(typeof e.data!="string"||!e.data.startsWith("[iFrameSizer]")||!e.data.endsWith("mutationObserver")&&!e.data.endsWith("resizeObserver"))return null;const[t,n]=e.data.split(":"),r=+n;return r>0?r:null}const v=q();let g=[];const x=(e,t)=>{if(!h())return[];const n={...P(),...H(e??{})},r=C(t),s=W(n,r);return r.map(i=>{const o={iframe:i,settings:n,interactionState:{isHovered:!1},initContext:{isInitialized:!1,retryAttempts:0}},c=F(o,s);return g.push(o),{unsubscribe:()=>{c(),g=g.filter(d=>d.iframe!==i)}}})};function C(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)).filter(p):e?p(e)?[e]:[]:Array.from(document.getElementsByTagName("iframe"))}function W(e,t){if(Array.isArray(e.checkOrigin))return e.checkOrigin;if(!e.checkOrigin)return[];const n=[];for(const r of t){const s=A(r);s&&n.push(s)}return n}function F(e,t){const n=T(e.iframe)?j(e):$(e,t),r=N(e);return()=>{n(),r()}}function $(e,t){const{iframe:n,initContext:r,settings:{checkOrigin:s,enableLegacyLibSupport:i,targetElementSelector:o,bodyPadding:c,bodyMargin:d}}=e,L=f=>{const Z=!s||t.includes(f.origin);if(!(n.contentWindow!==f.source||!Z)){if(f.data?.type==="iframe-resized"){const{height:l}=f.data;l&&b({newHeight:l,registeredElement:e});return}if(i){const l=D(f);l!==null&&b({newHeight:l,registeredElement:e});return}}};window.addEventListener("message",L);const Y=i?_():{type:"iframe-child-init",targetElementSelector:o,bodyPadding:c,bodyMargin:d},I=()=>{k(n,()=>n.contentWindow?.postMessage(Y,"*")),r.retryAttempts++,r.retryTimeoutId=window.setTimeout(I,y(r.retryAttempts))};return I(),()=>window.removeEventListener("message",L)}function j(e){const{iframe:t,settings:n}=e,{targetElementSelector:r}=n;let s=0;const i=()=>{const o=m(t.contentDocument,r);if(!t.contentDocument||!o)return s++,setTimeout(i,y(s));S(t.contentDocument,n),v().observe(o)};return B(t,i),()=>{const o=m(t.contentDocument,r);o&&v().unobserve(o),t.removeEventListener("load",i)}}function N({iframe:e,interactionState:t}){const n=()=>{t.isHovered=!0},r=()=>{t.isHovered=!1};return e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",r),()=>{e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",r)}}function q(){let e=null;return()=>{if(!e){const t=({target:n})=>{const r=g.find(({iframe:d})=>d.contentDocument===n.ownerDocument);if(!r)return;const{iframe:s,settings:i}=r,o=m(s.contentDocument,i.targetElementSelector);if(!o)return;const{height:c}=w(o);c&&b({newHeight:c,registeredElement:r})};e=new ResizeObserver(n=>n.forEach(t))}return e}}function b({registeredElement:e,newHeight:t}){const{iframe:n,settings:r,interactionState:s,initContext:i}=e;if(i.isInitialized||(i.isInitialized=!0,clearTimeout(i.retryTimeoutId)),r.onBeforeIframeResize?.({iframe:n,settings:{...r},observedHeight:t})===!1)return;const o=n.getBoundingClientRect(),c=t+r.offsetSize;if(n.style.height=`${c}px`,!r.onIframeResize)return;const d={iframe:n,settings:{...r},interactionState:{...s},previousRenderState:{rect:o},nextRenderState:{rect:n.getBoundingClientRect()}};r.onIframeResize(d)}const U=J();let z=!1;V();function V(){!h()||!O()||window.addEventListener("message",e=>{e.data?.type==="iframe-child-init"&&M(()=>E(e))})}function E(e,t=0){const{targetElementSelector:n,bodyPadding:r,bodyMargin:s}=e.data,i=m(document,n);if(z||window.parent!==e.source)return;if(!i)return setTimeout(()=>E(e,t+1),y(t));S(document,{bodyMargin:s,bodyPadding:r});const o=U();o.disconnect(),o.observe(i),z=!0}function J(){let e=null;return()=>(e||(e=new ResizeObserver(t=>{if(!t[0].target)return;const{height:n,width:r}=w(t[0].target),s={type:"iframe-resized",width:r,height:n};window.parent.postMessage(s,"*")})),e)}const G=a.defineComponent({name:"ResizableIframe",props:{offsetSize:[String,Number,Object],checkOrigin:[Boolean,Array],onIframeResize:Function,onBeforeIframeResize:Function,targetElementSelector:[String],bodyMargin:[String,Number],bodyPadding:[String,Number],enableLegacyLibSupport:Boolean},setup(e,{attrs:t}){const n=a.ref(null);let r=[];const s=i=>{const o={offsetSize:e.offsetSize,enableLegacyLibSupport:e.enableLegacyLibSupport,checkOrigin:e.checkOrigin,onIframeResize:e.onIframeResize,onBeforeIframeResize:e.onBeforeIframeResize,targetElementSelector:e.targetElementSelector,bodyMargin:e.bodyMargin,bodyPadding:e.bodyPadding};Object.keys(o).forEach(c=>{o[c]===void 0&&delete o[c]}),r=x(o,i)};return a.onMounted(()=>{n.value&&s(n.value)}),a.onBeforeUnmount(()=>{r.forEach(i=>{i.unsubscribe()}),r=[]}),{iframeRef:n,attrs:t}}}),K=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n};function Q(e,t,n,r,s,i){return a.openBlock(),a.createElementBlock("iframe",a.mergeProps({ref:"iframeRef"},e.$attrs),null,16)}const R=K(G,[["render",Q]]),X={install(e){e.component("IframeResizer",R)}};u.IframeResizer=R,u.IframeResizerPlugin=X,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-iframe-resizer/vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "Open-source modern iframe resizer component",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"test": "npx playwright install --with-deps && npx playwright test"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@open-iframe-resizer/core": "1.6.
|
|
46
|
+
"@open-iframe-resizer/core": "1.6.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@vitejs/plugin-vue": "^
|
|
50
|
-
"@vue/tsconfig": "^0.
|
|
51
|
-
"vue": "^3.5.
|
|
52
|
-
"vue-tsc": "^
|
|
49
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
50
|
+
"@vue/tsconfig": "^0.8.1",
|
|
51
|
+
"vue": "^3.5.21",
|
|
52
|
+
"vue-tsc": "^3.0.7"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vue": ">=3.0.0"
|