@iteraai/react-component-inspector 0.1.0
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 +168 -0
- package/dist/adapters/base/baseAdapter.d.ts +24 -0
- package/dist/adapters/base/createReactInspectorAdapter.d.ts +6 -0
- package/dist/adapters/base/index.d.ts +4 -0
- package/dist/adapters/base/runtimeConfig.d.ts +4 -0
- package/dist/adapters/base/sourceMetadata.d.ts +3 -0
- package/dist/adapters/base/types.d.ts +23 -0
- package/dist/adapters/cra/craAdapter.d.ts +6 -0
- package/dist/adapters/cra/index.d.ts +3 -0
- package/dist/adapters/fiber/fiberAdapter.d.ts +9 -0
- package/dist/adapters/fiber/highlightTarget.d.ts +2 -0
- package/dist/adapters/fiber/index.d.ts +3 -0
- package/dist/adapters/fiber/nodeIdentity.d.ts +14 -0
- package/dist/adapters/fiber/nodeLookup.d.ts +23 -0
- package/dist/adapters/fiber/props.d.ts +2 -0
- package/dist/adapters/fiber/rootDiscovery.d.ts +2 -0
- package/dist/adapters/fiber/source.d.ts +2 -0
- package/dist/adapters/fiber/spike/devtoolsProbe.d.ts +2 -0
- package/dist/adapters/fiber/spike/displayName.d.ts +1 -0
- package/dist/adapters/fiber/spike/fallbackDecision.d.ts +26 -0
- package/dist/adapters/fiber/spike/fiberTraversal.d.ts +12 -0
- package/dist/adapters/fiber/spike/types.d.ts +35 -0
- package/dist/adapters/fiber/traversal.d.ts +31 -0
- package/dist/adapters/fiber/treeMapping.d.ts +8 -0
- package/dist/adapters/fiber/types.d.ts +35 -0
- package/dist/adapters/next/index.d.ts +3 -0
- package/dist/adapters/next/nextAdapter.d.ts +6 -0
- package/dist/adapters/vite/index.d.ts +3 -0
- package/dist/adapters/vite/viteAdapter.d.ts +6 -0
- package/dist/bridgeRuntime.d.ts +37 -0
- package/dist/bridgeRuntime.js +7 -0
- package/dist/bridgeRuntime.js.map +1 -0
- package/dist/chunks/bridgeRuntime-Da4khSK2.js +2278 -0
- package/dist/chunks/bridgeRuntime-Da4khSK2.js.map +1 -0
- package/dist/chunks/embeddedBootstrap-v-MS8cPB.js +358 -0
- package/dist/chunks/embeddedBootstrap-v-MS8cPB.js.map +1 -0
- package/dist/devtoolsInlineBackendHook.d.ts +5 -0
- package/dist/embeddedBootstrap.d.ts +24 -0
- package/dist/embeddedBootstrap.js +7 -0
- package/dist/embeddedBootstrap.js.map +1 -0
- package/dist/embeddedRuntimeTelemetry.d.ts +34 -0
- package/dist/highlighter.d.ts +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/iterationInspector/index.d.ts +2 -0
- package/dist/iterationInspector/runtime.d.ts +23 -0
- package/dist/iterationInspector/types.d.ts +74 -0
- package/dist/iterationInspector.js +708 -0
- package/dist/iterationInspector.js.map +1 -0
- package/dist/reactDevtoolsInlineBackend.d.ts +7 -0
- package/dist/reactTreeAdapter.d.ts +3 -0
- package/dist/security/bridgeTelemetry.d.ts +50 -0
- package/dist/security/inspectorSecurityEvents.d.ts +18 -0
- package/dist/security/messageSizePolicy.d.ts +19 -0
- package/dist/security/redactionPolicy.d.ts +2 -0
- package/dist/security/tokenValidation.d.ts +15 -0
- package/dist/serializer.d.ts +10 -0
- package/package.json +77 -0
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
const T = "itera:iteration-inspector", me = (e) => typeof e == "object" && e !== null, Ye = (e) => !me(e) || e.channel !== T ? !1 : e.kind === "enter_select_mode" || e.kind === "exit_select_mode" || e.kind === "clear_hover", dt = (e) => !me(e) || e.channel !== T ? !1 : e.kind === "runtime_ready" || e.kind === "mode_changed" || e.kind === "element_selected" || e.kind === "selection_invalidated" || e.kind === "debug_log", he = "itera-iteration-inspector-overlay-root", $e = "2147483647", be = "Select an element", Fe = "#14b8a6", Ue = "rgba(20, 184, 166, 0.08)", ze = "#115e59", Ge = "#2563eb", Ve = "rgba(37, 99, 235, 0.08)", We = "#1d4ed8";
|
|
2
|
+
const xe = /* @__PURE__ */ new Set([
|
|
3
|
+
"button",
|
|
4
|
+
"input",
|
|
5
|
+
"textarea",
|
|
6
|
+
"select"
|
|
7
|
+
]), je = /* @__PURE__ */ new Set([
|
|
8
|
+
...xe,
|
|
9
|
+
"div",
|
|
10
|
+
"img"
|
|
11
|
+
]), g = (e) => {
|
|
12
|
+
if (e == null)
|
|
13
|
+
return null;
|
|
14
|
+
const t = e.replaceAll(/\s+/g, " ").trim();
|
|
15
|
+
return t.length === 0 ? null : t.length <= 120 ? t : `${t.slice(0, 117)}...`;
|
|
16
|
+
}, Ee = (e) => e.replaceAll(/([ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1"), h = (e) => Math.round(e * 100) / 100, Te = (e) => ({
|
|
17
|
+
top: h(e.top),
|
|
18
|
+
left: h(e.left),
|
|
19
|
+
width: h(e.width),
|
|
20
|
+
height: h(e.height)
|
|
21
|
+
}), ue = (e, t) => t.clientX >= e.left && t.clientX <= e.left + e.width && t.clientY >= e.top && t.clientY <= e.top + e.height, I = (e) => `${e.pathname}${e.search}${e.hash}`, W = (e) => {
|
|
22
|
+
if (e instanceof HTMLTextAreaElement || e instanceof HTMLInputElement && !["button", "submit", "reset"].includes(
|
|
23
|
+
e.type.toLowerCase() || "text"
|
|
24
|
+
))
|
|
25
|
+
return null;
|
|
26
|
+
const t = e instanceof HTMLElement && typeof e.innerText == "string" ? e.innerText : e.textContent;
|
|
27
|
+
return g(t);
|
|
28
|
+
}, w = (e) => g(
|
|
29
|
+
e.getAttribute("data-testid") ?? e.getAttribute("data-test-id") ?? e.getAttribute("data-cy")
|
|
30
|
+
), Y = (e) => {
|
|
31
|
+
var r;
|
|
32
|
+
const t = g(e.getAttribute("role"));
|
|
33
|
+
if (t !== null)
|
|
34
|
+
return t;
|
|
35
|
+
const n = e.tagName.toLowerCase();
|
|
36
|
+
if (n === "button")
|
|
37
|
+
return "button";
|
|
38
|
+
if (n === "a" && e.hasAttribute("href"))
|
|
39
|
+
return "link";
|
|
40
|
+
if (n === "textarea")
|
|
41
|
+
return "textbox";
|
|
42
|
+
if (n === "select")
|
|
43
|
+
return "combobox";
|
|
44
|
+
if (n === "img")
|
|
45
|
+
return "img";
|
|
46
|
+
if (n === "input") {
|
|
47
|
+
const i = ((r = e.getAttribute("type")) == null ? void 0 : r.toLowerCase()) ?? "text";
|
|
48
|
+
return i === "button" || i === "submit" || i === "reset" ? "button" : i === "checkbox" || i === "radio" || i === "range" ? i : "textbox";
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}, Ke = (e, t) => {
|
|
52
|
+
var n;
|
|
53
|
+
return !(e instanceof HTMLInputElement) && !(e instanceof HTMLTextAreaElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLMeterElement) && !(e instanceof HTMLProgressElement) ? null : e.labels !== null && e.labels.length > 0 ? g(
|
|
54
|
+
Array.from(e.labels).map((r) => r.textContent ?? "").join(" ")
|
|
55
|
+
) : e.id.length === 0 ? null : g(
|
|
56
|
+
((n = t.querySelector(`label[for="${Ee(e.id)}"]`)) == null ? void 0 : n.textContent) ?? null
|
|
57
|
+
);
|
|
58
|
+
}, j = (e, t, n = {}) => {
|
|
59
|
+
const { includeTextFallback: r = !0 } = n, i = g(e.getAttribute("aria-label"));
|
|
60
|
+
if (i !== null)
|
|
61
|
+
return i;
|
|
62
|
+
const o = e.getAttribute("aria-labelledby");
|
|
63
|
+
if (o !== null) {
|
|
64
|
+
const d = o.split(/\s+/).map((b) => b.trim()).filter(Boolean), m = g(
|
|
65
|
+
d.map((b) => {
|
|
66
|
+
var _;
|
|
67
|
+
return ((_ = t.getElementById(b)) == null ? void 0 : _.textContent) ?? "";
|
|
68
|
+
}).join(" ")
|
|
69
|
+
);
|
|
70
|
+
if (m !== null)
|
|
71
|
+
return m;
|
|
72
|
+
}
|
|
73
|
+
const s = g(e.getAttribute("alt"));
|
|
74
|
+
if (s !== null)
|
|
75
|
+
return s;
|
|
76
|
+
const a = g(e.getAttribute("title"));
|
|
77
|
+
if (a !== null)
|
|
78
|
+
return a;
|
|
79
|
+
const E = g(
|
|
80
|
+
e.getAttribute("placeholder")
|
|
81
|
+
);
|
|
82
|
+
if (E !== null)
|
|
83
|
+
return E;
|
|
84
|
+
const u = Ke(e, t);
|
|
85
|
+
if (u !== null)
|
|
86
|
+
return u;
|
|
87
|
+
if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
|
|
88
|
+
const d = e instanceof HTMLInputElement && ["button", "submit", "reset"].includes(
|
|
89
|
+
e.type.toLowerCase() || "text"
|
|
90
|
+
) ? g(e.value) : null;
|
|
91
|
+
if (d !== null)
|
|
92
|
+
return d;
|
|
93
|
+
}
|
|
94
|
+
return r ? W(e) : null;
|
|
95
|
+
}, _e = (e) => e instanceof HTMLButtonElement || e instanceof HTMLAnchorElement || e instanceof HTMLLabelElement || e instanceof HTMLOptionElement || e instanceof HTMLInputElement && ["button", "submit", "reset"].includes(e.type.toLowerCase() || "text") ? !0 : e.children.length === 0, qe = (e, t, n = {}) => j(e, t, n), ye = (e, t, n = {}) => {
|
|
96
|
+
var s;
|
|
97
|
+
const r = e.tagName.toLowerCase(), i = Y(e) ?? r, o = (s = qe(e, t, n)) == null ? void 0 : s.replaceAll(
|
|
98
|
+
'"',
|
|
99
|
+
"'"
|
|
100
|
+
);
|
|
101
|
+
return o == null ? `@${i}` : `@${i} "${o}"`;
|
|
102
|
+
}, Ze = (e) => {
|
|
103
|
+
const t = e == null ? void 0 : e.replaceAll('"', "'");
|
|
104
|
+
return t == null ? "@text" : `@text "${t}"`;
|
|
105
|
+
}, Je = (e) => {
|
|
106
|
+
var i;
|
|
107
|
+
const t = e.tagName.toLowerCase(), r = Array.from(((i = e.parentElement) == null ? void 0 : i.children) ?? []).filter(
|
|
108
|
+
(o) => o.tagName === e.tagName
|
|
109
|
+
).indexOf(e) + 1;
|
|
110
|
+
return `${t}:nth-of-type(${Math.max(r, 1)})`;
|
|
111
|
+
}, Le = (e) => {
|
|
112
|
+
if (e.id.length > 0)
|
|
113
|
+
return `${e.tagName.toLowerCase()}#${Ee(e.id)}`;
|
|
114
|
+
const t = w(e);
|
|
115
|
+
if (t !== null)
|
|
116
|
+
return `${e.tagName.toLowerCase()}[data-testid="${t.replaceAll('"', '\\"')}"]`;
|
|
117
|
+
const n = [];
|
|
118
|
+
let r = e;
|
|
119
|
+
for (; r !== null && r.tagName.toLowerCase() !== "html"; )
|
|
120
|
+
n.unshift(Je(r)), r = r.parentElement;
|
|
121
|
+
return ["html", ...n].join(" > ");
|
|
122
|
+
}, Ie = (e) => {
|
|
123
|
+
const t = [];
|
|
124
|
+
let n = e;
|
|
125
|
+
for (; n !== null; ) {
|
|
126
|
+
const r = n, o = (r.parentElement === null ? [r] : Array.from(r.parentElement.children).filter(
|
|
127
|
+
(s) => s.tagName === r.tagName
|
|
128
|
+
)).indexOf(r) + 1;
|
|
129
|
+
t.unshift(
|
|
130
|
+
`${r.tagName.toLowerCase()}[${Math.max(o, 1)}]`
|
|
131
|
+
), n = r.parentElement;
|
|
132
|
+
}
|
|
133
|
+
return `/${t.join("/")}`;
|
|
134
|
+
}, Qe = (e) => Te(e.getBoundingClientRect()), Ne = (e) => {
|
|
135
|
+
const t = e instanceof Element ? e : (e == null ? void 0 : e.parentElement) ?? null;
|
|
136
|
+
return t === null ? !1 : t.closest(`#${he}`) !== null;
|
|
137
|
+
}, $ = (e) => g(e.textContent), F = (e) => {
|
|
138
|
+
const t = e.tagName.toLowerCase();
|
|
139
|
+
if (xe.has(t))
|
|
140
|
+
return !0;
|
|
141
|
+
const n = Y(e);
|
|
142
|
+
return n === "button" || n === "textbox" || n === "combobox" || n === "checkbox" || n === "radio" || n === "range";
|
|
143
|
+
}, Ce = (e) => {
|
|
144
|
+
if (!(e instanceof Text) || Ne(e))
|
|
145
|
+
return null;
|
|
146
|
+
const t = e.parentElement, n = $(e);
|
|
147
|
+
return t === null || n === null ? null : {
|
|
148
|
+
kind: "text",
|
|
149
|
+
element: t,
|
|
150
|
+
textNode: e
|
|
151
|
+
};
|
|
152
|
+
}, K = (e) => {
|
|
153
|
+
let t = e instanceof Element ? e : (e == null ? void 0 : e.parentElement) ?? null, n = null;
|
|
154
|
+
for (; t !== null; ) {
|
|
155
|
+
if (Ne(t))
|
|
156
|
+
return null;
|
|
157
|
+
const r = t.tagName.toLowerCase();
|
|
158
|
+
if (F(t))
|
|
159
|
+
return t;
|
|
160
|
+
n === null && je.has(r) && (n = t), t = t.parentElement;
|
|
161
|
+
}
|
|
162
|
+
return n;
|
|
163
|
+
}, et = (e, t) => {
|
|
164
|
+
var i, o;
|
|
165
|
+
const n = e.caretPositionFromPoint;
|
|
166
|
+
if (typeof n == "function")
|
|
167
|
+
return ((i = n.call(e, t.clientX, t.clientY)) == null ? void 0 : i.offsetNode) ?? null;
|
|
168
|
+
const r = e.caretRangeFromPoint;
|
|
169
|
+
return typeof r == "function" ? ((o = r.call(e, t.clientX, t.clientY)) == null ? void 0 : o.startContainer) ?? null : null;
|
|
170
|
+
}, q = (e, t) => typeof e.elementFromPoint != "function" ? null : e.elementFromPoint(t.clientX, t.clientY), tt = (e, t, n, r) => {
|
|
171
|
+
if (e.kind !== "text")
|
|
172
|
+
return !1;
|
|
173
|
+
try {
|
|
174
|
+
const i = t.createRange();
|
|
175
|
+
if (i.selectNodeContents(e.textNode), typeof i.getClientRects == "function") {
|
|
176
|
+
const o = Array.from(i.getClientRects()).filter(
|
|
177
|
+
(s) => s.width > 0 || s.height > 0
|
|
178
|
+
);
|
|
179
|
+
if (o.length > 0)
|
|
180
|
+
return o.some((s) => ue(s, n));
|
|
181
|
+
}
|
|
182
|
+
if (typeof i.getBoundingClientRect == "function") {
|
|
183
|
+
const o = i.getBoundingClientRect();
|
|
184
|
+
if (o.width > 0 || o.height > 0)
|
|
185
|
+
return ue(o, n);
|
|
186
|
+
}
|
|
187
|
+
} catch {
|
|
188
|
+
}
|
|
189
|
+
return r !== null && (r === e.element || e.element.contains(r));
|
|
190
|
+
}, Ae = (e, t, n = q(e, t)) => {
|
|
191
|
+
const r = Ce(
|
|
192
|
+
et(e, t)
|
|
193
|
+
);
|
|
194
|
+
return r === null || !tt(r, e, t, n) ? null : r;
|
|
195
|
+
}, Re = (e) => {
|
|
196
|
+
const t = Ce(e), n = K(e);
|
|
197
|
+
return t !== null && (n === null || !F(n)) ? t : n === null ? null : {
|
|
198
|
+
kind: "element",
|
|
199
|
+
element: n
|
|
200
|
+
};
|
|
201
|
+
}, Pe = (e, t) => {
|
|
202
|
+
if (e.kind !== "text")
|
|
203
|
+
return e.element.getBoundingClientRect();
|
|
204
|
+
try {
|
|
205
|
+
const n = t.createRange();
|
|
206
|
+
if (n.selectNodeContents(e.textNode), typeof n.getBoundingClientRect == "function") {
|
|
207
|
+
const r = n.getBoundingClientRect();
|
|
208
|
+
if (r.width > 0 || r.height > 0)
|
|
209
|
+
return r;
|
|
210
|
+
}
|
|
211
|
+
} catch {
|
|
212
|
+
}
|
|
213
|
+
return e.element.getBoundingClientRect();
|
|
214
|
+
}, nt = (e, t) => Te(Pe(e, t)), Z = (e, t, n = {}) => e.kind === "text" ? Ze($(e.textNode)) : ye(e.element, t, n), Oe = (e) => e.kind === "text" ? "text" : Y(e.element), lt = (e, t) => e.kind === "text" ? $(e.textNode) : j(e.element, t), rt = (e) => e.kind === "text" ? $(e.textNode) : W(e.element), ot = (e, t = window, n = document) => {
|
|
215
|
+
const r = e.element.tagName.toLowerCase(), i = Oe(e), o = lt(e, n), s = rt(e);
|
|
216
|
+
return {
|
|
217
|
+
displayText: Z(e, n, {
|
|
218
|
+
includeTextFallback: !0
|
|
219
|
+
}),
|
|
220
|
+
element: {
|
|
221
|
+
urlPath: I(t.location),
|
|
222
|
+
cssSelector: Le(e.element),
|
|
223
|
+
domPath: Ie(e.element),
|
|
224
|
+
tagName: r,
|
|
225
|
+
role: i,
|
|
226
|
+
accessibleName: o,
|
|
227
|
+
textPreview: s,
|
|
228
|
+
id: g(e.element.id),
|
|
229
|
+
dataTestId: w(e.element),
|
|
230
|
+
bounds: nt(e, n),
|
|
231
|
+
scrollOffset: {
|
|
232
|
+
x: h(t.scrollX),
|
|
233
|
+
y: h(t.scrollY)
|
|
234
|
+
},
|
|
235
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}, it = (e, t) => {
|
|
239
|
+
var n;
|
|
240
|
+
try {
|
|
241
|
+
const r = (n = t.__ARA_EMBEDDED_REACT_INSPECTOR_SELECTION__) == null ? void 0 : n.getReactComponentPathForElement(
|
|
242
|
+
e
|
|
243
|
+
);
|
|
244
|
+
if (r === void 0)
|
|
245
|
+
return;
|
|
246
|
+
const i = r.map((o) => o.trim()).filter((o) => o.length > 0);
|
|
247
|
+
return i.length > 0 ? i : void 0;
|
|
248
|
+
} catch {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
}, ft = (e, t = window, n = document) => {
|
|
252
|
+
const r = e.tagName.toLowerCase(), i = Y(e), o = j(e, n), s = W(e), a = it(e, t);
|
|
253
|
+
return {
|
|
254
|
+
displayText: ye(e, n, {
|
|
255
|
+
includeTextFallback: !0
|
|
256
|
+
}),
|
|
257
|
+
element: {
|
|
258
|
+
urlPath: I(t.location),
|
|
259
|
+
cssSelector: Le(e),
|
|
260
|
+
domPath: Ie(e),
|
|
261
|
+
tagName: r,
|
|
262
|
+
role: i,
|
|
263
|
+
accessibleName: o,
|
|
264
|
+
textPreview: s,
|
|
265
|
+
id: g(e.id),
|
|
266
|
+
dataTestId: w(e),
|
|
267
|
+
bounds: Qe(e),
|
|
268
|
+
scrollOffset: {
|
|
269
|
+
x: h(t.scrollX),
|
|
270
|
+
y: h(t.scrollY)
|
|
271
|
+
},
|
|
272
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
273
|
+
...a !== void 0 && {
|
|
274
|
+
reactComponentPath: a
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}, st = (e) => {
|
|
279
|
+
const t = e.createElement("div");
|
|
280
|
+
t.id = he, t.setAttribute("aria-hidden", "true"), t.style.position = "fixed", t.style.inset = "0", t.style.pointerEvents = "none", t.style.zIndex = $e;
|
|
281
|
+
const n = (E, u) => {
|
|
282
|
+
const d = e.createElement("div");
|
|
283
|
+
return d.style.position = "fixed", d.style.border = `2px solid ${E}`, d.style.borderRadius = "8px", d.style.background = u, d.style.display = "none", d;
|
|
284
|
+
}, r = (E) => {
|
|
285
|
+
const u = e.createElement("div");
|
|
286
|
+
return u.style.position = "fixed", u.style.maxWidth = "320px", u.style.padding = "6px 10px", u.style.borderRadius = "999px", u.style.background = E, u.style.color = "#f8fafc", u.style.fontFamily = "ui-monospace, SFMono-Regular, SF Mono, Consolas, monospace", u.style.fontSize = "12px", u.style.lineHeight = "1", u.style.display = "none", u.style.whiteSpace = "nowrap", u.style.overflow = "hidden", u.style.textOverflow = "ellipsis", u.textContent = be, u;
|
|
287
|
+
}, i = n(
|
|
288
|
+
Fe,
|
|
289
|
+
Ue
|
|
290
|
+
), o = n(
|
|
291
|
+
Ge,
|
|
292
|
+
Ve
|
|
293
|
+
);
|
|
294
|
+
o.style.boxShadow = "0 0 0 9999px rgba(15, 23, 42, 0.12)";
|
|
295
|
+
const s = r(ze), a = r(We);
|
|
296
|
+
return t.append(i, o, s, a), e.body.append(t), { root: t, selectedBox: i, selectedLabel: s, hoverBox: o, hoverLabel: a };
|
|
297
|
+
}, ke = (e, t) => t === "selected" ? {
|
|
298
|
+
box: e.selectedBox,
|
|
299
|
+
label: e.selectedLabel
|
|
300
|
+
} : {
|
|
301
|
+
box: e.hoverBox,
|
|
302
|
+
label: e.hoverLabel
|
|
303
|
+
}, L = (e, t, n, r) => {
|
|
304
|
+
const i = Pe(t, n), o = Z(t, n, {
|
|
305
|
+
includeTextFallback: t.kind === "text" ? !0 : _e(t.element)
|
|
306
|
+
}), s = ke(e, r);
|
|
307
|
+
s.box.style.display = "block", s.box.style.left = `${h(i.left)}px`, s.box.style.top = `${h(i.top)}px`, s.box.style.width = `${h(i.width)}px`, s.box.style.height = `${h(i.height)}px`, s.label.style.display = "block", s.label.style.left = `${Math.max(h(i.left), 8)}px`, s.label.style.top = `${Math.max(h(i.top) - 36, 8)}px`, s.label.textContent = o;
|
|
308
|
+
}, A = (e, t) => {
|
|
309
|
+
const n = ke(e, t);
|
|
310
|
+
n.box.style.display = "none", n.label.style.display = "none", n.label.textContent = be;
|
|
311
|
+
}, de = (e, t) => e === null || t === null ? !1 : t.root.contains(e), at = (e, t) => {
|
|
312
|
+
if (de(e.target, t))
|
|
313
|
+
return !0;
|
|
314
|
+
if (e.type !== "childList")
|
|
315
|
+
return !1;
|
|
316
|
+
const n = (r) => r !== null && !de(r, t);
|
|
317
|
+
return !(Array.from(e.addedNodes).some(n) || Array.from(e.removedNodes).some(n));
|
|
318
|
+
}, B = (e, t, n) => {
|
|
319
|
+
const r = n === void 0 ? null : q(e, n), i = t instanceof Node ? t : null, o = i !== null && r !== null && !r.contains(i) && !i.contains(r), s = K(
|
|
320
|
+
o ? i : r ?? i
|
|
321
|
+
);
|
|
322
|
+
if (n !== void 0) {
|
|
323
|
+
const a = o ? null : Ae(e, n, r);
|
|
324
|
+
if (a !== null && (s === null || !F(s)))
|
|
325
|
+
return a;
|
|
326
|
+
}
|
|
327
|
+
return s !== null ? {
|
|
328
|
+
kind: "element",
|
|
329
|
+
element: s
|
|
330
|
+
} : Re(i ?? r);
|
|
331
|
+
}, fe = (e, t) => {
|
|
332
|
+
const n = q(e, t), r = K(n), i = Ae(e, t, n);
|
|
333
|
+
return i !== null && (r === null || !F(r)) ? i : r !== null ? {
|
|
334
|
+
kind: "element",
|
|
335
|
+
element: r
|
|
336
|
+
} : Re(n);
|
|
337
|
+
}, pe = (e, t) => Math.hypot(t.clientX - e.clientX, t.clientY - e.clientY) > 8, ct = (e, t) => e instanceof Node && t.contains(e), v = (e) => ({
|
|
338
|
+
tagName: e.element.tagName.toLowerCase(),
|
|
339
|
+
id: g(e.element.getAttribute("id")),
|
|
340
|
+
role: Oe(e),
|
|
341
|
+
displayText: Z(
|
|
342
|
+
e,
|
|
343
|
+
e.element.ownerDocument ?? document,
|
|
344
|
+
{
|
|
345
|
+
includeTextFallback: e.kind === "text" ? !0 : _e(e.element)
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
dataTestId: w(e.element),
|
|
349
|
+
disabled: e.element instanceof HTMLButtonElement || e.element instanceof HTMLInputElement || e.element instanceof HTMLSelectElement || e.element instanceof HTMLTextAreaElement ? e.element.disabled : void 0
|
|
350
|
+
}), V = (e, t, n) => {
|
|
351
|
+
const r = B(e, t, n);
|
|
352
|
+
return r === null ? null : v(r);
|
|
353
|
+
}, ge = (e) => {
|
|
354
|
+
e.preventDefault(), e.stopPropagation();
|
|
355
|
+
}, X = (e, t) => e === null || t === null || e.kind !== t.kind || e.element !== t.element ? !1 : e.kind === "text" && t.kind === "text" ? e.textNode === t.textNode : !0, ut = ({
|
|
356
|
+
allowSelfMessaging: e = !1,
|
|
357
|
+
win: t = window,
|
|
358
|
+
doc: n = document
|
|
359
|
+
} = {}) => {
|
|
360
|
+
let r = !1, i = !1, o = null, s = null, a = null, E = !1, u = null, d = null, m = null, b = null, _ = !1, R = null, N = null, P = null, U = !1, S = "single";
|
|
361
|
+
const ve = e || t.parent !== t, C = (l) => {
|
|
362
|
+
ve && t.parent.postMessage(l, u ?? "*");
|
|
363
|
+
}, p = (l, c = {}) => {
|
|
364
|
+
if (!_)
|
|
365
|
+
return;
|
|
366
|
+
const f = typeof c == "function" ? c() : c;
|
|
367
|
+
try {
|
|
368
|
+
console.debug("[itera/iteration-inspector/runtime]", {
|
|
369
|
+
sessionId: R ?? void 0,
|
|
370
|
+
event: l,
|
|
371
|
+
...f
|
|
372
|
+
});
|
|
373
|
+
} catch {
|
|
374
|
+
}
|
|
375
|
+
C({
|
|
376
|
+
channel: T,
|
|
377
|
+
kind: "debug_log",
|
|
378
|
+
event: l,
|
|
379
|
+
sessionId: R ?? void 0,
|
|
380
|
+
details: f
|
|
381
|
+
});
|
|
382
|
+
}, Se = (l) => {
|
|
383
|
+
if (!l.debugEnabled)
|
|
384
|
+
return;
|
|
385
|
+
const c = _;
|
|
386
|
+
_ = !0, R = typeof l.debugSessionId == "string" && l.debugSessionId.length > 0 ? l.debugSessionId : R, c || p("debug_enabled", {
|
|
387
|
+
urlPath: I(t.location)
|
|
388
|
+
});
|
|
389
|
+
}, z = () => (a !== null || (a = st(n)), a), x = () => {
|
|
390
|
+
const l = o;
|
|
391
|
+
o = null, a !== null && A(a, "hover"), l !== null && p("hover_cleared", () => ({
|
|
392
|
+
target: v(l)
|
|
393
|
+
}));
|
|
394
|
+
}, J = (l) => {
|
|
395
|
+
const c = (o == null ? void 0 : o.kind) !== l.kind || o.element !== l.element || o.kind === "text" && l.kind === "text" && o.textNode !== l.textNode;
|
|
396
|
+
o = l;
|
|
397
|
+
const f = z();
|
|
398
|
+
X(s, l) ? A(f, "hover") : L(f, l, n, "hover"), c && p("hover_target_changed", () => ({
|
|
399
|
+
target: v(l)
|
|
400
|
+
}));
|
|
401
|
+
}, Q = () => {
|
|
402
|
+
if (!r || d === null)
|
|
403
|
+
return;
|
|
404
|
+
const l = fe(n, d);
|
|
405
|
+
if (l === null) {
|
|
406
|
+
x();
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
J(l);
|
|
410
|
+
}, ee = () => {
|
|
411
|
+
s = null, a !== null && A(a, "selected");
|
|
412
|
+
}, te = (l) => {
|
|
413
|
+
s = l;
|
|
414
|
+
const c = z();
|
|
415
|
+
L(c, l, n, "selected"), X(o, l) && A(c, "hover");
|
|
416
|
+
}, ne = (l = "command") => {
|
|
417
|
+
m = null, l !== "selection" && (b = null);
|
|
418
|
+
}, le = (l, c, f) => {
|
|
419
|
+
ge(c), o = l, te(l);
|
|
420
|
+
const y = ot(l, t, n);
|
|
421
|
+
C({
|
|
422
|
+
channel: T,
|
|
423
|
+
kind: "element_selected",
|
|
424
|
+
selection: y
|
|
425
|
+
}), b = f.suppressFollowUpClick ? l.element : null, p("selection_emitted", () => ({
|
|
426
|
+
source: f.source,
|
|
427
|
+
suppressFollowUpClick: f.suppressFollowUpClick === !0,
|
|
428
|
+
selectionMode: S,
|
|
429
|
+
selectionDisplayText: y.displayText,
|
|
430
|
+
target: v(l)
|
|
431
|
+
})), S === "single" && O(!1, "selection");
|
|
432
|
+
}, M = (l) => {
|
|
433
|
+
x(), ee(), C({
|
|
434
|
+
channel: T,
|
|
435
|
+
kind: "selection_invalidated",
|
|
436
|
+
reason: l
|
|
437
|
+
});
|
|
438
|
+
}, O = (l, c = "command") => {
|
|
439
|
+
if (r === l) {
|
|
440
|
+
r || x();
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (r = l, ne(c), U = !1, r || (S = "single"), r) {
|
|
444
|
+
z(), s !== null && te(s), Q(), p("mode_changed", {
|
|
445
|
+
active: !0,
|
|
446
|
+
reason: c
|
|
447
|
+
}), C({
|
|
448
|
+
channel: T,
|
|
449
|
+
kind: "mode_changed",
|
|
450
|
+
active: !0
|
|
451
|
+
});
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
x(), a !== null && A(a, "selected"), p("mode_changed", {
|
|
455
|
+
active: !1,
|
|
456
|
+
reason: c
|
|
457
|
+
}), c !== "reload" && C({
|
|
458
|
+
channel: T,
|
|
459
|
+
kind: "mode_changed",
|
|
460
|
+
active: !1
|
|
461
|
+
});
|
|
462
|
+
}, Me = () => {
|
|
463
|
+
if (!r)
|
|
464
|
+
return;
|
|
465
|
+
if (s !== null) {
|
|
466
|
+
if (!(s.element.isConnected && (s.kind !== "text" || s.textNode.isConnected))) {
|
|
467
|
+
M("node_detached");
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
a !== null && L(a, s, n, "selected");
|
|
471
|
+
}
|
|
472
|
+
if (o === null)
|
|
473
|
+
return;
|
|
474
|
+
if (o.element.isConnected && (o.kind !== "text" || o.textNode.isConnected)) {
|
|
475
|
+
a !== null && (X(s, o) || L(a, o, n, "hover"));
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
x();
|
|
479
|
+
}, G = () => {
|
|
480
|
+
r && (M("route_change"), O(!1, "route_change"));
|
|
481
|
+
}, He = () => {
|
|
482
|
+
const l = t.history.pushState.bind(t.history), c = t.history.replaceState.bind(t.history), f = (De) => (...Xe) => {
|
|
483
|
+
const Be = I(t.location), we = De(...Xe);
|
|
484
|
+
return I(t.location) !== Be && G(), we;
|
|
485
|
+
};
|
|
486
|
+
t.history.pushState = f(l), t.history.replaceState = f(c);
|
|
487
|
+
const y = () => {
|
|
488
|
+
G();
|
|
489
|
+
}, k = () => {
|
|
490
|
+
G();
|
|
491
|
+
};
|
|
492
|
+
return t.addEventListener("popstate", y), t.addEventListener("hashchange", k), () => {
|
|
493
|
+
t.history.pushState = l, t.history.replaceState = c, t.removeEventListener("popstate", y), t.removeEventListener("hashchange", k);
|
|
494
|
+
};
|
|
495
|
+
}, re = (l) => {
|
|
496
|
+
if (!Ye(l.data) || l.source !== t.parent && (!e || l.source !== t))
|
|
497
|
+
return;
|
|
498
|
+
const c = l.origin === "null" ? null : l.origin;
|
|
499
|
+
if (!(E && c !== u)) {
|
|
500
|
+
if (u = c, E = !0, Se(l.data), p("command_received", {
|
|
501
|
+
kind: l.data.kind,
|
|
502
|
+
origin: l.origin,
|
|
503
|
+
urlPath: I(t.location)
|
|
504
|
+
}), l.data.kind === "enter_select_mode") {
|
|
505
|
+
S = l.data.selectionMode ?? "single", O(!0);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
if (l.data.kind === "exit_select_mode") {
|
|
509
|
+
O(!1);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
ee(), x();
|
|
513
|
+
}
|
|
514
|
+
}, oe = (l) => {
|
|
515
|
+
if (d = {
|
|
516
|
+
clientX: l.clientX,
|
|
517
|
+
clientY: l.clientY
|
|
518
|
+
}, m !== null && m.pointerId === l.pointerId && pe(
|
|
519
|
+
m.origin,
|
|
520
|
+
d
|
|
521
|
+
) && (m = null), !r)
|
|
522
|
+
return;
|
|
523
|
+
const c = B(
|
|
524
|
+
n,
|
|
525
|
+
l.target,
|
|
526
|
+
d
|
|
527
|
+
);
|
|
528
|
+
if (c === null) {
|
|
529
|
+
x();
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
J(c);
|
|
533
|
+
}, ie = (l) => {
|
|
534
|
+
if (d = {
|
|
535
|
+
clientX: l.clientX,
|
|
536
|
+
clientY: l.clientY
|
|
537
|
+
}, b = null, !!r) {
|
|
538
|
+
if (p("pointer_down_received", () => ({
|
|
539
|
+
button: l.button,
|
|
540
|
+
pointerId: l.pointerId,
|
|
541
|
+
target: V(n, l.target, {
|
|
542
|
+
clientX: l.clientX,
|
|
543
|
+
clientY: l.clientY
|
|
544
|
+
})
|
|
545
|
+
})), l.button !== 0) {
|
|
546
|
+
m = null, p("pointer_down_ignored", () => ({
|
|
547
|
+
reason: "non_primary_button",
|
|
548
|
+
button: l.button,
|
|
549
|
+
target: V(n, l.target, {
|
|
550
|
+
clientX: l.clientX,
|
|
551
|
+
clientY: l.clientY
|
|
552
|
+
})
|
|
553
|
+
}));
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
m = {
|
|
557
|
+
pointerId: l.pointerId,
|
|
558
|
+
origin: d
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
}, se = (l) => {
|
|
562
|
+
if (d = {
|
|
563
|
+
clientX: l.clientX,
|
|
564
|
+
clientY: l.clientY
|
|
565
|
+
}, !r) {
|
|
566
|
+
m = null, p("pointer_up_ignored", {
|
|
567
|
+
reason: "inactive",
|
|
568
|
+
button: l.button,
|
|
569
|
+
pointerId: l.pointerId
|
|
570
|
+
});
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
p("pointer_up_received", () => ({
|
|
574
|
+
button: l.button,
|
|
575
|
+
pointerId: l.pointerId,
|
|
576
|
+
target: V(n, l.target, {
|
|
577
|
+
clientX: l.clientX,
|
|
578
|
+
clientY: l.clientY
|
|
579
|
+
})
|
|
580
|
+
}));
|
|
581
|
+
const c = m, f = c !== null && c.pointerId === l.pointerId, y = f && pe(
|
|
582
|
+
c.origin,
|
|
583
|
+
d
|
|
584
|
+
);
|
|
585
|
+
if (m = null, !f || y) {
|
|
586
|
+
p("pointer_up_ignored", {
|
|
587
|
+
reason: f ? "pointer_moved" : "missing_pending_selection",
|
|
588
|
+
button: l.button,
|
|
589
|
+
pointerId: l.pointerId
|
|
590
|
+
});
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
if (l.button !== 0) {
|
|
594
|
+
p("pointer_up_ignored", {
|
|
595
|
+
reason: "non_primary_button",
|
|
596
|
+
button: l.button,
|
|
597
|
+
pointerId: l.pointerId
|
|
598
|
+
});
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const k = B(n, l.target, d) ?? fe(n, d) ?? o;
|
|
602
|
+
if (k === null) {
|
|
603
|
+
p("pointer_up_ignored", {
|
|
604
|
+
reason: "no_target",
|
|
605
|
+
button: l.button,
|
|
606
|
+
pointerId: l.pointerId
|
|
607
|
+
}), x();
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
le(k, l, {
|
|
611
|
+
suppressFollowUpClick: !0,
|
|
612
|
+
source: "pointerup"
|
|
613
|
+
});
|
|
614
|
+
}, ae = () => {
|
|
615
|
+
m = null;
|
|
616
|
+
}, H = () => {
|
|
617
|
+
if (r) {
|
|
618
|
+
if (s !== null && (!s.element.isConnected || s.kind === "text" && !s.textNode.isConnected)) {
|
|
619
|
+
M("node_detached");
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (o !== null && (!o.element.isConnected || o.kind === "text" && !o.textNode.isConnected) && x(), d !== null) {
|
|
623
|
+
a !== null && s !== null && L(a, s, n, "selected"), Q();
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
if (a !== null) {
|
|
627
|
+
if (s !== null && L(a, s, n, "selected"), o !== null && !X(s, o)) {
|
|
628
|
+
L(a, o, n, "hover");
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
A(a, "hover");
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}, ce = (l) => {
|
|
635
|
+
if (b !== null && ct(l.target, b)) {
|
|
636
|
+
const f = b;
|
|
637
|
+
p("follow_up_click_suppressed", () => ({
|
|
638
|
+
target: v({
|
|
639
|
+
kind: "element",
|
|
640
|
+
element: f
|
|
641
|
+
})
|
|
642
|
+
})), ge(l), b = null;
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
if (b = null, !r)
|
|
646
|
+
return;
|
|
647
|
+
const c = B(n, l.target, {
|
|
648
|
+
clientX: l.clientX,
|
|
649
|
+
clientY: l.clientY
|
|
650
|
+
}) ?? o;
|
|
651
|
+
if (c === null) {
|
|
652
|
+
p("click_selection_ignored", {
|
|
653
|
+
reason: "no_target"
|
|
654
|
+
}), x();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
le(c, l, {
|
|
658
|
+
source: "click"
|
|
659
|
+
});
|
|
660
|
+
}, D = () => {
|
|
661
|
+
r && (M("reload"), O(!1, "reload"));
|
|
662
|
+
};
|
|
663
|
+
return {
|
|
664
|
+
start: () => {
|
|
665
|
+
i || (i = !0, P = He(), n.addEventListener("pointermove", oe, !0), n.addEventListener("pointerdown", ie, !0), n.addEventListener("pointerup", se, !0), n.addEventListener("pointercancel", ae, !0), n.addEventListener("click", ce, !0), t.addEventListener("message", re), t.addEventListener("scroll", H, !0), t.addEventListener("resize", H), t.addEventListener("pagehide", D), t.addEventListener("beforeunload", D), N = new MutationObserver((l) => {
|
|
666
|
+
if (!(o === null && s === null)) {
|
|
667
|
+
if (l.every(
|
|
668
|
+
(c) => at(c, a)
|
|
669
|
+
)) {
|
|
670
|
+
U || (p("mutation_ignored", {
|
|
671
|
+
reason: "overlay_only"
|
|
672
|
+
}), U = !0);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
Me();
|
|
676
|
+
}
|
|
677
|
+
}), N.observe(n.body, {
|
|
678
|
+
childList: !0,
|
|
679
|
+
subtree: !0,
|
|
680
|
+
attributes: !0
|
|
681
|
+
}), C({
|
|
682
|
+
channel: T,
|
|
683
|
+
kind: "runtime_ready",
|
|
684
|
+
urlPath: I(t.location)
|
|
685
|
+
}));
|
|
686
|
+
},
|
|
687
|
+
stop: () => {
|
|
688
|
+
i && (i = !1, r = !1, E = !1, u = null, _ = !1, R = null, ne(), x(), P == null || P(), P = null, N == null || N.disconnect(), N = null, n.removeEventListener("pointermove", oe, !0), n.removeEventListener("pointerdown", ie, !0), n.removeEventListener("pointerup", se, !0), n.removeEventListener("pointercancel", ae, !0), n.removeEventListener("click", ce, !0), t.removeEventListener("message", re), t.removeEventListener("scroll", H, !0), t.removeEventListener("resize", H), t.removeEventListener("pagehide", D), t.removeEventListener("beforeunload", D), a !== null && (a.root.remove(), a = null));
|
|
689
|
+
},
|
|
690
|
+
isActive: () => r
|
|
691
|
+
};
|
|
692
|
+
}, pt = (e = {}) => {
|
|
693
|
+
if (!e.allowSelfMessaging && window.parent === window)
|
|
694
|
+
return null;
|
|
695
|
+
if (window.__ITERA_ITERATION_INSPECTOR_RUNTIME__ !== void 0)
|
|
696
|
+
return window.__ITERA_ITERATION_INSPECTOR_RUNTIME__;
|
|
697
|
+
const t = ut(e);
|
|
698
|
+
return t.start(), window.__ITERA_ITERATION_INSPECTOR_RUNTIME__ = t, t;
|
|
699
|
+
};
|
|
700
|
+
export {
|
|
701
|
+
T as ITERATION_INSPECTOR_CHANNEL,
|
|
702
|
+
pt as bootIterationInspectorRuntime,
|
|
703
|
+
ft as buildIterationElementSelection,
|
|
704
|
+
ut as createIterationInspectorRuntime,
|
|
705
|
+
Ye as isIterationInspectorParentMessage,
|
|
706
|
+
dt as isIterationInspectorRuntimeMessage
|
|
707
|
+
};
|
|
708
|
+
//# sourceMappingURL=iterationInspector.js.map
|