dev-inspector 1.0.5 → 1.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 +22 -1
- package/lib/init.d.ts +5 -2
- package/lib/init.js +5 -2
- package/lib/integrations/index.d.ts +2 -0
- package/lib/integrations/index.js +7 -0
- package/lib/integrations/jira/adf.d.ts +11 -0
- package/lib/integrations/jira/adf.js +17 -0
- package/lib/integrations/jira/client.d.ts +4 -0
- package/lib/integrations/jira/client.js +113 -0
- package/lib/integrations/jira/errors.d.ts +10 -0
- package/lib/integrations/jira/errors.js +13 -0
- package/lib/integrations/jira/index.d.ts +2 -0
- package/lib/integrations/jira/index.js +8 -0
- package/lib/integrations/types.d.ts +54 -0
- package/lib/integrations/types.js +2 -0
- package/lib/storage/localStorage.d.ts +30 -0
- package/lib/storage/localStorage.js +166 -0
- package/lib/ui/panel/behavior/setupPanelBehavior.d.ts +4 -1
- package/lib/ui/panel/behavior/setupPanelBehavior.js +48 -1
- package/lib/ui/panel/bindings/bindStorageToPanelView.d.ts +2 -0
- package/lib/ui/panel/bindings/bindStorageToPanelView.js +50 -6
- package/lib/ui/panel/bindings/matchesQuery.d.ts +2 -0
- package/lib/ui/panel/bindings/matchesQuery.js +54 -0
- package/lib/ui/panel/bindings/types.d.ts +2 -0
- package/lib/ui/panel/dom/buildPanelDOM.js +65 -6
- package/lib/ui/panel/dom/constants.d.ts +5 -1
- package/lib/ui/panel/dom/constants.js +35 -20
- package/lib/ui/panel/dom/types.d.ts +6 -0
- package/lib/ui/panel/index.d.ts +4 -0
- package/lib/ui/panel/index.js +8 -3
- package/lib/ui/panel/integrations/icons.d.ts +1 -0
- package/lib/ui/panel/integrations/icons.js +7 -0
- package/lib/ui/panel/integrations/index.d.ts +1 -0
- package/lib/ui/panel/integrations/index.js +5 -0
- package/lib/ui/panel/integrations/jiraDialog.d.ts +6 -0
- package/lib/ui/panel/integrations/jiraDialog.js +234 -0
- package/lib/ui/panel/integrations/screenshot.d.ts +4 -0
- package/lib/ui/panel/integrations/screenshot.js +51 -0
- package/lib/ui/panel/localStorage/createLocalStorageView.d.ts +4 -0
- package/lib/ui/panel/localStorage/createLocalStorageView.js +108 -0
- package/lib/ui/panel/localStorage/index.d.ts +3 -0
- package/lib/ui/panel/localStorage/index.js +7 -0
- package/lib/ui/panel/localStorage/setupLocalStorageSync.d.ts +9 -0
- package/lib/ui/panel/localStorage/setupLocalStorageSync.js +30 -0
- package/lib/ui/panel/localStorage/types.d.ts +6 -0
- package/lib/ui/panel/localStorage/types.js +2 -0
- package/lib/ui/panel/state/createPanelState.d.ts +2 -1
- package/lib/ui/panel/state/createPanelState.js +5 -1
- package/lib/ui/panel/state/types.d.ts +5 -0
- package/lib/ui/panel/theme/applyTheme.d.ts +2 -0
- package/lib/ui/panel/theme/applyTheme.js +6 -0
- package/lib/ui/panel/theme/index.d.ts +3 -0
- package/lib/ui/panel/theme/index.js +9 -0
- package/lib/ui/panel/theme/storage.d.ts +4 -0
- package/lib/ui/panel/theme/storage.js +45 -0
- package/lib/ui/panel/theme/types.d.ts +6 -0
- package/lib/ui/panel/theme/types.js +2 -0
- package/lib/ui/panelStyles.d.ts +1 -1
- package/lib/ui/panelStyles.js +514 -125
- package/lib/ui/shared/copy.d.ts +2 -0
- package/lib/ui/shared/copy.js +101 -0
- package/package.json +1 -1
- package/lib/ui/logList/networkDetails.d.ts +0 -2
- package/lib/ui/logList/networkDetails.js +0 -227
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.launchMiniConfetti = launchMiniConfetti;
|
|
4
|
+
exports.copyText = copyText;
|
|
5
|
+
function prefersReducedMotion() {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
try {
|
|
8
|
+
const mm = globalThis;
|
|
9
|
+
return ((_b = (_a = mm.matchMedia) === null || _a === void 0 ? void 0 : _a.call(mm, "(prefers-reduced-motion: reduce)")) === null || _b === void 0 ? void 0 : _b.matches) === true;
|
|
10
|
+
}
|
|
11
|
+
catch (_c) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function rand(min, max) {
|
|
16
|
+
return min + Math.random() * (max - min);
|
|
17
|
+
}
|
|
18
|
+
function launchMiniConfetti(anchor) {
|
|
19
|
+
if (prefersReducedMotion())
|
|
20
|
+
return;
|
|
21
|
+
if (typeof document === "undefined")
|
|
22
|
+
return;
|
|
23
|
+
const rect = anchor.getBoundingClientRect();
|
|
24
|
+
const cx = rect.left + rect.width / 2;
|
|
25
|
+
const cy = rect.top + rect.height / 2;
|
|
26
|
+
const root = document.createElement("div");
|
|
27
|
+
root.style.position = "fixed";
|
|
28
|
+
root.style.left = "0";
|
|
29
|
+
root.style.top = "0";
|
|
30
|
+
root.style.width = "0";
|
|
31
|
+
root.style.height = "0";
|
|
32
|
+
root.style.pointerEvents = "none";
|
|
33
|
+
root.style.zIndex = "2147483647";
|
|
34
|
+
document.body.append(root);
|
|
35
|
+
const colors = ["#a7ff00", "#7c5cff", "#00c4ff", "#ff9030", "#ef4444"];
|
|
36
|
+
const n = 14;
|
|
37
|
+
const duration = 520;
|
|
38
|
+
for (let i = 0; i < n; i += 1) {
|
|
39
|
+
const p = document.createElement("span");
|
|
40
|
+
const size = Math.round(rand(3, 6));
|
|
41
|
+
p.style.position = "fixed";
|
|
42
|
+
p.style.left = `${cx}px`;
|
|
43
|
+
p.style.top = `${cy}px`;
|
|
44
|
+
p.style.width = `${size}px`;
|
|
45
|
+
p.style.height = `${size}px`;
|
|
46
|
+
p.style.borderRadius = Math.random() < 0.35 ? "999px" : "2px";
|
|
47
|
+
p.style.background = colors[i % colors.length];
|
|
48
|
+
p.style.opacity = "1";
|
|
49
|
+
p.style.willChange = "transform, opacity";
|
|
50
|
+
root.append(p);
|
|
51
|
+
const angle = rand(0, Math.PI * 2);
|
|
52
|
+
const dist = rand(18, 46);
|
|
53
|
+
const dx = Math.cos(angle) * dist;
|
|
54
|
+
const dy = Math.sin(angle) * dist + rand(8, 16);
|
|
55
|
+
const rot = rand(-220, 220);
|
|
56
|
+
const delay = Math.round(rand(0, 60));
|
|
57
|
+
try {
|
|
58
|
+
const anim = p.animate([
|
|
59
|
+
{ transform: `translate(-50%, -50%) translate(0px, 0px) rotate(0deg) scale(1)`, opacity: 1 },
|
|
60
|
+
{ transform: `translate(-50%, -50%) translate(${dx}px, ${dy}px) rotate(${rot}deg) scale(0.9)`, opacity: 0 },
|
|
61
|
+
], { duration, delay, easing: "cubic-bezier(0.2, 0.7, 0.2, 1)", fill: "forwards" });
|
|
62
|
+
anim.addEventListener("finish", () => p.remove());
|
|
63
|
+
}
|
|
64
|
+
catch (_a) {
|
|
65
|
+
globalThis.setTimeout(() => p.remove(), duration + delay + 50);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
globalThis.setTimeout(() => root.remove(), duration + 120);
|
|
69
|
+
}
|
|
70
|
+
async function copyText(text) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
try {
|
|
73
|
+
const nav = globalThis;
|
|
74
|
+
const fn = (_b = (_a = nav.navigator) === null || _a === void 0 ? void 0 : _a.clipboard) === null || _b === void 0 ? void 0 : _b.writeText;
|
|
75
|
+
if (typeof fn === "function") {
|
|
76
|
+
await fn(text);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (_c) {
|
|
81
|
+
void 0;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
if (typeof document === "undefined")
|
|
85
|
+
return false;
|
|
86
|
+
const ta = document.createElement("textarea");
|
|
87
|
+
ta.value = text;
|
|
88
|
+
ta.setAttribute("readonly", "true");
|
|
89
|
+
ta.style.position = "fixed";
|
|
90
|
+
ta.style.left = "-9999px";
|
|
91
|
+
ta.style.top = "0";
|
|
92
|
+
document.body.append(ta);
|
|
93
|
+
ta.select();
|
|
94
|
+
const ok = document.execCommand("copy");
|
|
95
|
+
ta.remove();
|
|
96
|
+
return ok;
|
|
97
|
+
}
|
|
98
|
+
catch (_d) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNetworkDetails = createNetworkDetails;
|
|
4
|
-
const jsonViewer_1 = require("../jsonViewer");
|
|
5
|
-
function tryParseJson(text) {
|
|
6
|
-
const t = text.trim();
|
|
7
|
-
if (t.length < 2)
|
|
8
|
-
return undefined;
|
|
9
|
-
const looksLikeObject = t.startsWith("{") && t.endsWith("}");
|
|
10
|
-
const looksLikeArray = t.startsWith("[") && t.endsWith("]");
|
|
11
|
-
if (!looksLikeObject && !looksLikeArray)
|
|
12
|
-
return undefined;
|
|
13
|
-
try {
|
|
14
|
-
return JSON.parse(t);
|
|
15
|
-
}
|
|
16
|
-
catch (_a) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function safeStringify(value) {
|
|
21
|
-
const seen = new WeakSet();
|
|
22
|
-
const replacer = (_key, v) => {
|
|
23
|
-
if (typeof v === "object" && v !== null) {
|
|
24
|
-
const o = v;
|
|
25
|
-
if (seen.has(o))
|
|
26
|
-
return "[circular]";
|
|
27
|
-
seen.add(o);
|
|
28
|
-
}
|
|
29
|
-
return v;
|
|
30
|
-
};
|
|
31
|
-
try {
|
|
32
|
-
return JSON.stringify(value, replacer, 2);
|
|
33
|
-
}
|
|
34
|
-
catch (_a) {
|
|
35
|
-
try {
|
|
36
|
-
return String(value);
|
|
37
|
-
}
|
|
38
|
-
catch (_b) {
|
|
39
|
-
return "[unserializable]";
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async function copyText(text) {
|
|
44
|
-
var _a, _b;
|
|
45
|
-
try {
|
|
46
|
-
const nav = globalThis;
|
|
47
|
-
const fn = (_b = (_a = nav.navigator) === null || _a === void 0 ? void 0 : _a.clipboard) === null || _b === void 0 ? void 0 : _b.writeText;
|
|
48
|
-
if (typeof fn === "function") {
|
|
49
|
-
await fn(text);
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (_c) {
|
|
54
|
-
void 0;
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
if (typeof document === "undefined")
|
|
58
|
-
return false;
|
|
59
|
-
const ta = document.createElement("textarea");
|
|
60
|
-
ta.value = text;
|
|
61
|
-
ta.setAttribute("readonly", "true");
|
|
62
|
-
ta.style.position = "fixed";
|
|
63
|
-
ta.style.left = "-9999px";
|
|
64
|
-
ta.style.top = "0";
|
|
65
|
-
document.body.append(ta);
|
|
66
|
-
ta.select();
|
|
67
|
-
const ok = document.execCommand("copy");
|
|
68
|
-
ta.remove();
|
|
69
|
-
return ok;
|
|
70
|
-
}
|
|
71
|
-
catch (_d) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function prefersReducedMotion() {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
try {
|
|
78
|
-
const mm = globalThis;
|
|
79
|
-
return ((_b = (_a = mm.matchMedia) === null || _a === void 0 ? void 0 : _a.call(mm, "(prefers-reduced-motion: reduce)")) === null || _b === void 0 ? void 0 : _b.matches) === true;
|
|
80
|
-
}
|
|
81
|
-
catch (_c) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function rand(min, max) {
|
|
86
|
-
return min + Math.random() * (max - min);
|
|
87
|
-
}
|
|
88
|
-
function launchMiniConfetti(anchor) {
|
|
89
|
-
if (prefersReducedMotion())
|
|
90
|
-
return;
|
|
91
|
-
if (typeof document === "undefined")
|
|
92
|
-
return;
|
|
93
|
-
const rect = anchor.getBoundingClientRect();
|
|
94
|
-
const cx = rect.left + rect.width / 2;
|
|
95
|
-
const cy = rect.top + rect.height / 2;
|
|
96
|
-
const root = document.createElement("div");
|
|
97
|
-
root.style.position = "fixed";
|
|
98
|
-
root.style.left = "0";
|
|
99
|
-
root.style.top = "0";
|
|
100
|
-
root.style.width = "0";
|
|
101
|
-
root.style.height = "0";
|
|
102
|
-
root.style.pointerEvents = "none";
|
|
103
|
-
root.style.zIndex = "2147483647";
|
|
104
|
-
document.body.append(root);
|
|
105
|
-
const colors = ["#a7ff00", "#7c5cff", "#00c4ff", "#ff9030", "#ef4444"];
|
|
106
|
-
const n = 14;
|
|
107
|
-
const duration = 520;
|
|
108
|
-
for (let i = 0; i < n; i += 1) {
|
|
109
|
-
const p = document.createElement("span");
|
|
110
|
-
const size = Math.round(rand(3, 6));
|
|
111
|
-
p.style.position = "fixed";
|
|
112
|
-
p.style.left = `${cx}px`;
|
|
113
|
-
p.style.top = `${cy}px`;
|
|
114
|
-
p.style.width = `${size}px`;
|
|
115
|
-
p.style.height = `${size}px`;
|
|
116
|
-
p.style.borderRadius = Math.random() < 0.35 ? "999px" : "2px";
|
|
117
|
-
p.style.background = colors[i % colors.length];
|
|
118
|
-
p.style.opacity = "1";
|
|
119
|
-
p.style.willChange = "transform, opacity";
|
|
120
|
-
root.append(p);
|
|
121
|
-
const angle = rand(0, Math.PI * 2);
|
|
122
|
-
const dist = rand(18, 46);
|
|
123
|
-
const dx = Math.cos(angle) * dist;
|
|
124
|
-
const dy = Math.sin(angle) * dist + rand(8, 16);
|
|
125
|
-
const rot = rand(-220, 220);
|
|
126
|
-
const delay = Math.round(rand(0, 60));
|
|
127
|
-
try {
|
|
128
|
-
const anim = p.animate([
|
|
129
|
-
{ transform: `translate(-50%, -50%) translate(0px, 0px) rotate(0deg) scale(1)`, opacity: 1 },
|
|
130
|
-
{ transform: `translate(-50%, -50%) translate(${dx}px, ${dy}px) rotate(${rot}deg) scale(0.9)`, opacity: 0 },
|
|
131
|
-
], { duration, delay, easing: "cubic-bezier(0.2, 0.7, 0.2, 1)", fill: "forwards" });
|
|
132
|
-
anim.addEventListener("finish", () => p.remove());
|
|
133
|
-
}
|
|
134
|
-
catch (_a) {
|
|
135
|
-
globalThis.setTimeout(() => p.remove(), duration + delay + 50);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
globalThis.setTimeout(() => root.remove(), duration + 120);
|
|
139
|
-
}
|
|
140
|
-
function valueToElement(doc, value) {
|
|
141
|
-
if (typeof value === "string") {
|
|
142
|
-
const parsed = tryParseJson(value);
|
|
143
|
-
if (parsed && typeof parsed === "object") {
|
|
144
|
-
return (0, jsonViewer_1.createJsonViewer)(doc, parsed, { maxDepth: 6, maxKeys: 200, maxNodes: 2000 });
|
|
145
|
-
}
|
|
146
|
-
const el = doc.createElement("div");
|
|
147
|
-
el.className = "di-netBodyText";
|
|
148
|
-
el.textContent = value;
|
|
149
|
-
return el;
|
|
150
|
-
}
|
|
151
|
-
if (value instanceof Error) {
|
|
152
|
-
const el = doc.createElement("div");
|
|
153
|
-
el.className = "di-netBodyText";
|
|
154
|
-
el.textContent = `${value.name}: ${value.message}`;
|
|
155
|
-
return el;
|
|
156
|
-
}
|
|
157
|
-
if (value === null || typeof value !== "object") {
|
|
158
|
-
const el = doc.createElement("div");
|
|
159
|
-
el.className = "di-netBodyText";
|
|
160
|
-
el.textContent = String(value);
|
|
161
|
-
return el;
|
|
162
|
-
}
|
|
163
|
-
return (0, jsonViewer_1.createJsonViewer)(doc, value, { maxDepth: 6, maxKeys: 200, maxNodes: 2000 });
|
|
164
|
-
}
|
|
165
|
-
function valueToCopyText(value) {
|
|
166
|
-
if (typeof value === "string")
|
|
167
|
-
return value;
|
|
168
|
-
if (value instanceof Error)
|
|
169
|
-
return `${value.name}: ${value.message}`;
|
|
170
|
-
return safeStringify(value);
|
|
171
|
-
}
|
|
172
|
-
function createBodyDetails(doc, title, value, truncated, maxLen) {
|
|
173
|
-
const details = doc.createElement("details");
|
|
174
|
-
details.className = "di-details di-netBodyDetails";
|
|
175
|
-
const summary = doc.createElement("summary");
|
|
176
|
-
summary.className = "di-detailsSummary di-netDetailsSummary";
|
|
177
|
-
const titleEl = doc.createElement("span");
|
|
178
|
-
titleEl.className = "di-netDetailsTitle";
|
|
179
|
-
titleEl.textContent = title;
|
|
180
|
-
const copyBtn = doc.createElement("button");
|
|
181
|
-
copyBtn.type = "button";
|
|
182
|
-
copyBtn.className = "di-copyBtn";
|
|
183
|
-
copyBtn.textContent = "Copy";
|
|
184
|
-
copyBtn.setAttribute("aria-label", `Copy ${title.toLowerCase()}`);
|
|
185
|
-
copyBtn.addEventListener("click", (ev) => {
|
|
186
|
-
ev.preventDefault();
|
|
187
|
-
ev.stopPropagation();
|
|
188
|
-
const txt = valueToCopyText(value);
|
|
189
|
-
void copyText(txt).then((ok) => {
|
|
190
|
-
if (!ok)
|
|
191
|
-
return;
|
|
192
|
-
launchMiniConfetti(copyBtn);
|
|
193
|
-
const prev = copyBtn.textContent;
|
|
194
|
-
copyBtn.textContent = "Copied";
|
|
195
|
-
globalThis.setTimeout(() => {
|
|
196
|
-
copyBtn.textContent = prev !== null && prev !== void 0 ? prev : "Copy";
|
|
197
|
-
}, 900);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
summary.append(titleEl, copyBtn);
|
|
201
|
-
const body = doc.createElement("div");
|
|
202
|
-
body.className = "di-detailsBody";
|
|
203
|
-
if (truncated) {
|
|
204
|
-
const warn = doc.createElement("div");
|
|
205
|
-
warn.className = "di-netTrunc";
|
|
206
|
-
warn.textContent = typeof maxLen === "number" ? `Truncated to first ${maxLen} characters.` : "Truncated.";
|
|
207
|
-
body.append(warn);
|
|
208
|
-
}
|
|
209
|
-
body.append(valueToElement(doc, value));
|
|
210
|
-
details.append(summary, body);
|
|
211
|
-
return details;
|
|
212
|
-
}
|
|
213
|
-
function createNetworkDetails(doc, entry) {
|
|
214
|
-
const hasReq = typeof entry.requestBody !== "undefined";
|
|
215
|
-
const hasRes = typeof entry.responseBody !== "undefined";
|
|
216
|
-
if (!hasReq && !hasRes)
|
|
217
|
-
return null;
|
|
218
|
-
const wrap = doc.createElement("div");
|
|
219
|
-
wrap.className = "di-netDetailsWrap";
|
|
220
|
-
if (hasReq) {
|
|
221
|
-
wrap.append(createBodyDetails(doc, "Request", entry.requestBody, entry.requestBodyTruncated === true, entry.bodyMaxLength));
|
|
222
|
-
}
|
|
223
|
-
if (hasRes) {
|
|
224
|
-
wrap.append(createBodyDetails(doc, "Response", entry.responseBody, entry.responseBodyTruncated === true, entry.bodyMaxLength));
|
|
225
|
-
}
|
|
226
|
-
return wrap;
|
|
227
|
-
}
|