@nookuio/iframe 1.0.1 → 1.0.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/dist/iframe.js +100 -99
- package/dist/iframe.mjs +87 -86
- package/package.json +1 -1
package/dist/iframe.js
CHANGED
|
@@ -7,24 +7,24 @@ exports.createVueIframeClient = createVueIframeClient;
|
|
|
7
7
|
var _constants = require("./constants");
|
|
8
8
|
var _rpc = require("@nookuio/rpc");
|
|
9
9
|
var _telejson = require("telejson");
|
|
10
|
-
function u(
|
|
11
|
-
return `[data-node-id="${
|
|
10
|
+
function u(c, a) {
|
|
11
|
+
return `[data-node-id="${a}"][data-node-path="${c}"]`;
|
|
12
12
|
}
|
|
13
|
-
function y(
|
|
14
|
-
const n = document.querySelectorAll(
|
|
13
|
+
function y(c, a) {
|
|
14
|
+
const n = document.querySelectorAll(c);
|
|
15
15
|
if (!n?.length) return;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
width:
|
|
20
|
-
height:
|
|
21
|
-
top:
|
|
22
|
-
left:
|
|
16
|
+
const t = Array.from(n).map(d => {
|
|
17
|
+
const o = d.getBoundingClientRect(),
|
|
18
|
+
s = {
|
|
19
|
+
width: o.width,
|
|
20
|
+
height: o.height,
|
|
21
|
+
top: o.top,
|
|
22
|
+
left: o.left
|
|
23
23
|
};
|
|
24
|
-
if (!
|
|
25
|
-
const i = window.getComputedStyle(
|
|
24
|
+
if (!a) return s;
|
|
25
|
+
const i = window.getComputedStyle(d) ?? {};
|
|
26
26
|
return {
|
|
27
|
-
...
|
|
27
|
+
...s,
|
|
28
28
|
padding: {
|
|
29
29
|
top: i.paddingTop,
|
|
30
30
|
right: i.paddingRight,
|
|
@@ -33,109 +33,110 @@ function y(l, t) {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
});
|
|
36
|
-
if (
|
|
36
|
+
if (t?.length) return t.length === 1 ? t[0] : t;
|
|
37
37
|
}
|
|
38
|
-
function C(
|
|
38
|
+
function C(c) {
|
|
39
|
+
async function a() {
|
|
40
|
+
return document.body.scrollHeight > 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
|
|
41
|
+
}
|
|
39
42
|
return {
|
|
40
43
|
async editText({
|
|
41
|
-
path:
|
|
42
|
-
id:
|
|
44
|
+
path: n,
|
|
45
|
+
id: t
|
|
43
46
|
}) {
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
if (!
|
|
48
|
-
|
|
49
|
-
const s =
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
path:
|
|
55
|
-
id:
|
|
56
|
-
content:
|
|
57
|
-
}),
|
|
47
|
+
if (!n || t === void 0) return;
|
|
48
|
+
const d = u(n, t),
|
|
49
|
+
o = document.querySelector(d);
|
|
50
|
+
if (!o) return;
|
|
51
|
+
o.style.outline = "none", o.setAttribute("spellcheck", "false"), o.setAttribute("contenteditable", "true");
|
|
52
|
+
const s = l => {
|
|
53
|
+
const e = l.target;
|
|
54
|
+
if (!e) return;
|
|
55
|
+
const r = e.innerText;
|
|
56
|
+
o.removeAttribute("contenteditable"), c?.onTextUpdate?.({
|
|
57
|
+
path: n,
|
|
58
|
+
id: t,
|
|
59
|
+
content: r
|
|
60
|
+
}), o.removeEventListener("blur", s), o.removeEventListener("keydown", i), o.blur();
|
|
58
61
|
},
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
i = l => {
|
|
63
|
+
l.key === "Enter" && (l.stopPropagation(), l.preventDefault(), s(l));
|
|
61
64
|
};
|
|
62
|
-
|
|
65
|
+
o.addEventListener("keydown", i), o.addEventListener("blur", s), o.focus();
|
|
63
66
|
},
|
|
64
67
|
async getHoveredElement({
|
|
65
|
-
path:
|
|
66
|
-
id:
|
|
67
|
-
x:
|
|
68
|
-
y:
|
|
68
|
+
path: n,
|
|
69
|
+
id: t,
|
|
70
|
+
x: d,
|
|
71
|
+
y: o
|
|
69
72
|
}) {
|
|
70
|
-
if (
|
|
71
|
-
let s = document.elementFromPoint(
|
|
73
|
+
if (n) if (d !== void 0 && o !== void 0) {
|
|
74
|
+
let s = document.elementFromPoint(d, o);
|
|
72
75
|
if (!s) return;
|
|
73
|
-
let
|
|
74
|
-
if (
|
|
76
|
+
let i = s.getAttribute("data-node-path");
|
|
77
|
+
if (i !== n) {
|
|
75
78
|
if (!s.parentElement) return;
|
|
76
|
-
for (; s.parentElement &&
|
|
79
|
+
for (; s.parentElement && i !== n;) s = s.parentElement, i = s.getAttribute("data-node-path");
|
|
77
80
|
}
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
return
|
|
83
|
-
id:
|
|
84
|
-
path:
|
|
85
|
-
data:
|
|
81
|
+
const l = s.getAttribute("data-node-id");
|
|
82
|
+
if (!l) return;
|
|
83
|
+
const e = u(n, l),
|
|
84
|
+
r = y(e, !1);
|
|
85
|
+
return r ? {
|
|
86
|
+
id: l,
|
|
87
|
+
path: n,
|
|
88
|
+
data: r
|
|
86
89
|
} : void 0;
|
|
87
90
|
} else {
|
|
88
|
-
const s = u(
|
|
89
|
-
|
|
90
|
-
return
|
|
91
|
-
id:
|
|
92
|
-
path:
|
|
93
|
-
data:
|
|
91
|
+
const s = u(n, t),
|
|
92
|
+
i = y(s, !1);
|
|
93
|
+
return i ? {
|
|
94
|
+
id: t,
|
|
95
|
+
path: n,
|
|
96
|
+
data: i
|
|
94
97
|
} : void 0;
|
|
95
98
|
}
|
|
96
99
|
},
|
|
97
|
-
|
|
98
|
-
return document.body.scrollHeight > 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
|
|
99
|
-
},
|
|
100
|
+
getPageHeight: a,
|
|
100
101
|
async getSelectedElement({
|
|
101
|
-
path:
|
|
102
|
-
id:
|
|
102
|
+
path: n,
|
|
103
|
+
id: t
|
|
103
104
|
}) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
path:
|
|
108
|
-
id:
|
|
109
|
-
data:
|
|
105
|
+
const d = u(n, t),
|
|
106
|
+
o = y(d, !0);
|
|
107
|
+
if (o) return {
|
|
108
|
+
path: n,
|
|
109
|
+
id: t,
|
|
110
|
+
data: o
|
|
110
111
|
};
|
|
111
112
|
},
|
|
112
|
-
setTheme(
|
|
113
|
-
const
|
|
114
|
-
|
|
113
|
+
setTheme(n) {
|
|
114
|
+
const t = document.querySelector("body");
|
|
115
|
+
n === "dark" ? (document.documentElement.classList.remove("light"), document.documentElement.classList.add("dark"), t && (t.classList.remove("light"), t.classList.add("dark"))) : (document.documentElement.classList.remove("dark"), document.documentElement.classList.add("light"), t && (t.classList.remove("dark"), t.classList.add("light")));
|
|
115
116
|
},
|
|
116
|
-
async updateCode(
|
|
117
|
-
typeof
|
|
117
|
+
async updateCode(n, t) {
|
|
118
|
+
typeof t > "u" ? document.body.innerHTML = "" : document.body.innerHTML = t, c?.onResize?.(await a());
|
|
118
119
|
}
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
|
-
function createVueIframeClient(
|
|
122
|
+
function createVueIframeClient(c, a) {
|
|
122
123
|
const n = new Map();
|
|
123
124
|
window.addEventListener("message", async e => {
|
|
124
125
|
if (typeof e.data != "object" || e.data.source !== _constants.EDITOR_SOURCE_NAME || e.data.type === "event" || !e.data.response) return;
|
|
125
|
-
const
|
|
126
|
-
|
|
126
|
+
const r = n.get(e.data.response.id);
|
|
127
|
+
r && (n.delete(e.data.response.id), r(e.data.response));
|
|
127
128
|
});
|
|
128
|
-
const
|
|
129
|
-
...l,
|
|
129
|
+
const t = (0, _rpc.createClient)({
|
|
130
130
|
...C({
|
|
131
|
-
onResize: (...e) =>
|
|
132
|
-
onTextUpdate: (...e) =>
|
|
133
|
-
})
|
|
131
|
+
onResize: (...e) => t?.emit("resize", ...e),
|
|
132
|
+
onTextUpdate: (...e) => t?.emit("text-update", ...e)
|
|
133
|
+
}),
|
|
134
|
+
...c
|
|
134
135
|
}, {
|
|
135
136
|
handle(e) {
|
|
136
|
-
window.addEventListener("message", async
|
|
137
|
-
if (typeof
|
|
138
|
-
const m = await e(
|
|
137
|
+
window.addEventListener("message", async r => {
|
|
138
|
+
if (typeof r.data != "object" || r.data.source !== _constants.EDITOR_SOURCE_NAME || r.data.type === "event" || !r.data.request) return;
|
|
139
|
+
const m = await e(r.data.request);
|
|
139
140
|
window.parent.postMessage({
|
|
140
141
|
source: _constants.IFRAME_SOURCE_NAME,
|
|
141
142
|
response: m
|
|
@@ -143,10 +144,10 @@ function createVueIframeClient(l, t) {
|
|
|
143
144
|
});
|
|
144
145
|
},
|
|
145
146
|
invoke(e) {
|
|
146
|
-
return new Promise((
|
|
147
|
+
return new Promise((r, m) => {
|
|
147
148
|
const E = setTimeout(() => m(new Error("Request timed out")), 5e3);
|
|
148
149
|
n.set(e.id, p => {
|
|
149
|
-
clearTimeout(E),
|
|
150
|
+
clearTimeout(E), r(p);
|
|
150
151
|
}), window.parent.postMessage({
|
|
151
152
|
source: _constants.IFRAME_SOURCE_NAME,
|
|
152
153
|
request: e
|
|
@@ -161,8 +162,8 @@ function createVueIframeClient(l, t) {
|
|
|
161
162
|
}, "*");
|
|
162
163
|
},
|
|
163
164
|
handleEvent(e) {
|
|
164
|
-
window.addEventListener("message",
|
|
165
|
-
typeof
|
|
165
|
+
window.addEventListener("message", r => {
|
|
166
|
+
typeof r.data == "object" && (r.data.source !== _constants.EDITOR_SOURCE_NAME || r.data.type !== "event" || !r.data.request || e(r.data.request));
|
|
166
167
|
});
|
|
167
168
|
},
|
|
168
169
|
destroy() {
|
|
@@ -174,22 +175,22 @@ function createVueIframeClient(l, t) {
|
|
|
174
175
|
}),
|
|
175
176
|
timeout: 5e3
|
|
176
177
|
}),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
i =
|
|
178
|
+
d = a?.disableDefaultConsole ? void 0 : console.log.bind(console),
|
|
179
|
+
o = a?.disableDefaultConsole ? void 0 : console.warn.bind(console),
|
|
180
|
+
s = a?.disableDefaultConsole ? void 0 : console.error.bind(console),
|
|
181
|
+
i = a?.disableDefaultConsole ? void 0 : console.info.bind(console);
|
|
181
182
|
return console.log = (...e) => {
|
|
182
|
-
|
|
183
|
+
t.emit("console", "log", e), d?.(...e);
|
|
183
184
|
}, console.warn = (...e) => {
|
|
184
|
-
|
|
185
|
+
o?.(...e);
|
|
185
186
|
}, console.error = (...e) => {
|
|
186
|
-
|
|
187
|
+
t.emit("console", "error", e), s?.(...e);
|
|
187
188
|
}, console.info = (...e) => {
|
|
188
|
-
|
|
189
|
-
}, window.addEventListener("resize", async () =>
|
|
189
|
+
t.emit("console", "info", e), i?.(...e);
|
|
190
|
+
}, window.addEventListener("resize", async () => t.emit("resize", await t.$context.getPageHeight())), new MutationObserver(async () => t.emit("resize", await t.$context.getPageHeight())).observe(document.body, {
|
|
190
191
|
childList: !0,
|
|
191
192
|
subtree: !0,
|
|
192
193
|
attributes: !0,
|
|
193
194
|
characterData: !0
|
|
194
|
-
}),
|
|
195
|
+
}), t.emit("ready"), t;
|
|
195
196
|
}
|
package/dist/iframe.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { EDITOR_SOURCE_NAME as f, IFRAME_SOURCE_NAME as g } from "./constants.mjs";
|
|
2
2
|
import { createClient as b } from "@nookuio/rpc";
|
|
3
3
|
import { stringify as h, parse as w } from "telejson";
|
|
4
|
-
function u(
|
|
5
|
-
return `[data-node-id="${
|
|
4
|
+
function u(c, a) {
|
|
5
|
+
return `[data-node-id="${a}"][data-node-path="${c}"]`;
|
|
6
6
|
}
|
|
7
|
-
function y(
|
|
8
|
-
const n = document.querySelectorAll(
|
|
7
|
+
function y(c, a) {
|
|
8
|
+
const n = document.querySelectorAll(c);
|
|
9
9
|
if (!n?.length) return;
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
width:
|
|
13
|
-
height:
|
|
14
|
-
top:
|
|
15
|
-
left:
|
|
10
|
+
const t = Array.from(n).map((d) => {
|
|
11
|
+
const o = d.getBoundingClientRect(), s = {
|
|
12
|
+
width: o.width,
|
|
13
|
+
height: o.height,
|
|
14
|
+
top: o.top,
|
|
15
|
+
left: o.left
|
|
16
16
|
};
|
|
17
|
-
if (!
|
|
18
|
-
const i = window.getComputedStyle(
|
|
17
|
+
if (!a) return s;
|
|
18
|
+
const i = window.getComputedStyle(d) ?? {};
|
|
19
19
|
return {
|
|
20
|
-
...
|
|
20
|
+
...s,
|
|
21
21
|
padding: {
|
|
22
22
|
top: i.paddingTop,
|
|
23
23
|
right: i.paddingRight,
|
|
@@ -26,72 +26,73 @@ function y(l, t) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
});
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
29
|
+
if (t?.length)
|
|
30
|
+
return t.length === 1 ? t[0] : t;
|
|
31
31
|
}
|
|
32
|
-
function C(
|
|
32
|
+
function C(c) {
|
|
33
|
+
async function a() {
|
|
34
|
+
return document.body.scrollHeight > 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
|
|
35
|
+
}
|
|
33
36
|
return {
|
|
34
|
-
async editText({ path:
|
|
35
|
-
if (!
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
|
|
39
|
-
const s = (
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
37
|
+
async editText({ path: n, id: t }) {
|
|
38
|
+
if (!n || t === void 0) return;
|
|
39
|
+
const d = u(n, t), o = document.querySelector(d);
|
|
40
|
+
if (!o) return;
|
|
41
|
+
o.style.outline = "none", o.setAttribute("spellcheck", "false"), o.setAttribute("contenteditable", "true");
|
|
42
|
+
const s = (l) => {
|
|
43
|
+
const e = l.target;
|
|
44
|
+
if (!e) return;
|
|
45
|
+
const r = e.innerText;
|
|
46
|
+
o.removeAttribute("contenteditable"), c?.onTextUpdate?.({ path: n, id: t, content: r }), o.removeEventListener("blur", s), o.removeEventListener("keydown", i), o.blur();
|
|
47
|
+
}, i = (l) => {
|
|
48
|
+
l.key === "Enter" && (l.stopPropagation(), l.preventDefault(), s(l));
|
|
46
49
|
};
|
|
47
|
-
|
|
50
|
+
o.addEventListener("keydown", i), o.addEventListener("blur", s), o.focus();
|
|
48
51
|
},
|
|
49
|
-
async getHoveredElement({ path:
|
|
50
|
-
if (
|
|
51
|
-
if (
|
|
52
|
-
let s = document.elementFromPoint(
|
|
52
|
+
async getHoveredElement({ path: n, id: t, x: d, y: o }) {
|
|
53
|
+
if (n)
|
|
54
|
+
if (d !== void 0 && o !== void 0) {
|
|
55
|
+
let s = document.elementFromPoint(d, o);
|
|
53
56
|
if (!s) return;
|
|
54
|
-
let
|
|
55
|
-
if (
|
|
57
|
+
let i = s.getAttribute("data-node-path");
|
|
58
|
+
if (i !== n) {
|
|
56
59
|
if (!s.parentElement) return;
|
|
57
|
-
for (; s.parentElement &&
|
|
58
|
-
s = s.parentElement,
|
|
60
|
+
for (; s.parentElement && i !== n; )
|
|
61
|
+
s = s.parentElement, i = s.getAttribute("data-node-path");
|
|
59
62
|
}
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
id:
|
|
65
|
-
path:
|
|
66
|
-
data:
|
|
63
|
+
const l = s.getAttribute("data-node-id");
|
|
64
|
+
if (!l) return;
|
|
65
|
+
const e = u(n, l), r = y(e, !1);
|
|
66
|
+
return r ? {
|
|
67
|
+
id: l,
|
|
68
|
+
path: n,
|
|
69
|
+
data: r
|
|
67
70
|
} : void 0;
|
|
68
71
|
} else {
|
|
69
|
-
const s = u(
|
|
70
|
-
return
|
|
71
|
-
id:
|
|
72
|
-
path:
|
|
73
|
-
data:
|
|
72
|
+
const s = u(n, t), i = y(s, !1);
|
|
73
|
+
return i ? {
|
|
74
|
+
id: t,
|
|
75
|
+
path: n,
|
|
76
|
+
data: i
|
|
74
77
|
} : void 0;
|
|
75
78
|
}
|
|
76
79
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const o = u(t, n), r = y(o, !0);
|
|
82
|
-
if (r)
|
|
80
|
+
getPageHeight: a,
|
|
81
|
+
async getSelectedElement({ path: n, id: t }) {
|
|
82
|
+
const d = u(n, t), o = y(d, !0);
|
|
83
|
+
if (o)
|
|
83
84
|
return {
|
|
84
|
-
path:
|
|
85
|
-
id:
|
|
86
|
-
data:
|
|
85
|
+
path: n,
|
|
86
|
+
id: t,
|
|
87
|
+
data: o
|
|
87
88
|
};
|
|
88
89
|
},
|
|
89
|
-
setTheme(
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
setTheme(n) {
|
|
91
|
+
const t = document.querySelector("body");
|
|
92
|
+
n === "dark" ? (document.documentElement.classList.remove("light"), document.documentElement.classList.add("dark"), t && (t.classList.remove("light"), t.classList.add("dark"))) : (document.documentElement.classList.remove("dark"), document.documentElement.classList.add("light"), t && (t.classList.remove("dark"), t.classList.add("light")));
|
|
92
93
|
},
|
|
93
|
-
async updateCode(
|
|
94
|
-
typeof
|
|
94
|
+
async updateCode(n, t) {
|
|
95
|
+
typeof t > "u" ? document.body.innerHTML = "" : document.body.innerHTML = t, c?.onResize?.(await a());
|
|
95
96
|
}
|
|
96
97
|
// updateElementClass({ className, id, path }) {
|
|
97
98
|
// const selector = getSelector(path, id);
|
|
@@ -117,34 +118,34 @@ function C(l) {
|
|
|
117
118
|
// }
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
|
-
export function createVueIframeClient(
|
|
121
|
+
export function createVueIframeClient(c, a) {
|
|
121
122
|
const n = /* @__PURE__ */ new Map();
|
|
122
123
|
window.addEventListener("message", async (e) => {
|
|
123
124
|
if (typeof e.data != "object" || e.data.source !== f || e.data.type === "event" || !e.data.response) return;
|
|
124
|
-
const
|
|
125
|
-
|
|
125
|
+
const r = n.get(e.data.response.id);
|
|
126
|
+
r && (n.delete(e.data.response.id), r(e.data.response));
|
|
126
127
|
});
|
|
127
|
-
const
|
|
128
|
+
const t = b(
|
|
128
129
|
{
|
|
129
|
-
...l,
|
|
130
130
|
...C({
|
|
131
|
-
onResize: (...e) =>
|
|
132
|
-
onTextUpdate: (...e) =>
|
|
133
|
-
})
|
|
131
|
+
onResize: (...e) => t?.emit("resize", ...e),
|
|
132
|
+
onTextUpdate: (...e) => t?.emit("text-update", ...e)
|
|
133
|
+
}),
|
|
134
|
+
...c
|
|
134
135
|
},
|
|
135
136
|
{
|
|
136
137
|
handle(e) {
|
|
137
|
-
window.addEventListener("message", async (
|
|
138
|
-
if (typeof
|
|
139
|
-
const m = await e(
|
|
138
|
+
window.addEventListener("message", async (r) => {
|
|
139
|
+
if (typeof r.data != "object" || r.data.source !== f || r.data.type === "event" || !r.data.request) return;
|
|
140
|
+
const m = await e(r.data.request);
|
|
140
141
|
window.parent.postMessage({ source: g, response: m }, "*");
|
|
141
142
|
});
|
|
142
143
|
},
|
|
143
144
|
invoke(e) {
|
|
144
|
-
return new Promise((
|
|
145
|
+
return new Promise((r, m) => {
|
|
145
146
|
const E = setTimeout(() => m(new Error("Request timed out")), 5e3);
|
|
146
147
|
n.set(e.id, (p) => {
|
|
147
|
-
clearTimeout(E),
|
|
148
|
+
clearTimeout(E), r(p);
|
|
148
149
|
}), window.parent.postMessage({ source: g, request: e }, "*");
|
|
149
150
|
});
|
|
150
151
|
},
|
|
@@ -152,8 +153,8 @@ export function createVueIframeClient(l, t) {
|
|
|
152
153
|
window.parent.postMessage({ source: g, type: "event", request: e }, "*");
|
|
153
154
|
},
|
|
154
155
|
handleEvent(e) {
|
|
155
|
-
window.addEventListener("message", (
|
|
156
|
-
typeof
|
|
156
|
+
window.addEventListener("message", (r) => {
|
|
157
|
+
typeof r.data == "object" && (r.data.source !== f || r.data.type !== "event" || !r.data.request || e(r.data.request));
|
|
157
158
|
});
|
|
158
159
|
},
|
|
159
160
|
destroy() {
|
|
@@ -163,17 +164,17 @@ export function createVueIframeClient(l, t) {
|
|
|
163
164
|
serialize: (e) => h(e, { maxDepth: 1 / 0 }),
|
|
164
165
|
timeout: 5e3
|
|
165
166
|
}
|
|
166
|
-
),
|
|
167
|
+
), d = a?.disableDefaultConsole ? void 0 : console.log.bind(console), o = a?.disableDefaultConsole ? void 0 : console.warn.bind(console), s = a?.disableDefaultConsole ? void 0 : console.error.bind(console), i = a?.disableDefaultConsole ? void 0 : console.info.bind(console);
|
|
167
168
|
return console.log = (...e) => {
|
|
168
|
-
|
|
169
|
+
t.emit("console", "log", e), d?.(...e);
|
|
169
170
|
}, console.warn = (...e) => {
|
|
170
|
-
|
|
171
|
+
o?.(...e);
|
|
171
172
|
}, console.error = (...e) => {
|
|
172
|
-
|
|
173
|
+
t.emit("console", "error", e), s?.(...e);
|
|
173
174
|
}, console.info = (...e) => {
|
|
174
|
-
|
|
175
|
-
}, window.addEventListener("resize", async () =>
|
|
176
|
-
async () =>
|
|
175
|
+
t.emit("console", "info", e), i?.(...e);
|
|
176
|
+
}, window.addEventListener("resize", async () => t.emit("resize", await t.$context.getPageHeight())), new MutationObserver(
|
|
177
|
+
async () => t.emit("resize", await t.$context.getPageHeight())
|
|
177
178
|
).observe(document.body, {
|
|
178
179
|
childList: !0,
|
|
179
180
|
// observe direct children additions/removals
|
|
@@ -183,5 +184,5 @@ export function createVueIframeClient(l, t) {
|
|
|
183
184
|
// observe attribute changes (like style, class)
|
|
184
185
|
characterData: !0
|
|
185
186
|
// observe text changes
|
|
186
|
-
}),
|
|
187
|
+
}), t.emit("ready"), t;
|
|
187
188
|
}
|