urfu-ui-kit-react 2.1.0 → 2.1.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 +4 -2
- package/dist/components/ColumnSettings/ColumnSettings.d.ts.map +1 -1
- package/dist/components/Modal/useModalTitleClearance.d.ts.map +1 -1
- package/dist/components/StickyActionBar/StickyActionBar.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/dev/index.js +268 -254
- package/dist/shared/devLauncherOffset.d.ts +8 -0
- package/dist/shared/devLauncherOffset.d.ts.map +1 -0
- package/dist/style-no-fonts.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layer.css +11 -2
- package/dist/style.shell.css +20 -148
- package/dist/urfu-ui-kit-react.js +5085 -5014
- package/package.json +4 -7
package/dist/dev/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { useSyncExternalStore as
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
let
|
|
1
|
+
import { useSyncExternalStore as Rt } from "react";
|
|
2
|
+
let M = [], It = 1;
|
|
3
|
+
const N = /* @__PURE__ */ new Set();
|
|
4
|
+
let P = !1;
|
|
5
5
|
function _() {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
P || (P = !0, setTimeout(() => {
|
|
7
|
+
P = !1, N.forEach((t) => t());
|
|
8
8
|
}, 16));
|
|
9
9
|
}
|
|
10
10
|
function zt(t, e, n) {
|
|
11
|
-
const a = Date.now(),
|
|
12
|
-
|
|
11
|
+
const a = Date.now(), r = { id: It++, service: t, method: e.toUpperCase(), path: n, status: "pending", duration: null, endedAt: null, faked: !1 };
|
|
12
|
+
M = [...M.slice(-49), r], _();
|
|
13
13
|
let o = !1;
|
|
14
|
-
return (i,
|
|
15
|
-
o || (o = !0,
|
|
14
|
+
return (i, s) => {
|
|
15
|
+
o || (o = !0, r.status = i, r.faked = s, r.endedAt = Date.now(), r.duration = r.endedAt - a, _());
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return [...
|
|
18
|
+
function Y() {
|
|
19
|
+
return [...M].reverse();
|
|
20
20
|
}
|
|
21
21
|
function ct() {
|
|
22
|
-
|
|
22
|
+
M = [], P = !1, _();
|
|
23
23
|
}
|
|
24
24
|
function qt(t) {
|
|
25
|
-
return
|
|
26
|
-
|
|
25
|
+
return N.add(t), () => {
|
|
26
|
+
N.delete(t);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
const ut = "urfu-ui-kit:dev:",
|
|
29
|
+
const ut = "urfu-ui-kit:dev:", m = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set();
|
|
30
30
|
let dt;
|
|
31
31
|
const ft = (t) => `${ut}${t}`, jt = ["offline", "network", "slow"];
|
|
32
32
|
let E = null;
|
|
33
|
-
const
|
|
33
|
+
const O = /* @__PURE__ */ new Set();
|
|
34
34
|
function Ut() {
|
|
35
35
|
let t;
|
|
36
36
|
try {
|
|
@@ -46,7 +46,7 @@ function Ut() {
|
|
|
46
46
|
} catch {
|
|
47
47
|
}
|
|
48
48
|
} else
|
|
49
|
-
E = t.split(",").map((e) => e.trim()).filter(Boolean),
|
|
49
|
+
E = t.split(",").map((e) => e.trim()).filter(Boolean), O.clear();
|
|
50
50
|
try {
|
|
51
51
|
const e = new URL(window.location.href);
|
|
52
52
|
e.searchParams.delete("dev"), window.history.replaceState(window.history.state, "", e.href);
|
|
@@ -57,12 +57,12 @@ function Ut() {
|
|
|
57
57
|
function Ft(t) {
|
|
58
58
|
return [...jt, ...t.builtins ?? [], ...(t.groups ?? []).flatMap((e) => e.items.map((n) => n.id))];
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
if (!E ||
|
|
60
|
+
function Ht(t) {
|
|
61
|
+
if (!E || O.has(t.config.service)) return;
|
|
62
62
|
const e = new Set(Ft(t.config)), n = E.filter((a) => e.has(a));
|
|
63
|
-
n.length && (
|
|
63
|
+
n.length && (O.add(t.config.service), t.state = { ...t.state, faults: n }, F(t.config.service, t.state));
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Nt(t) {
|
|
66
66
|
try {
|
|
67
67
|
const e = JSON.parse(localStorage.getItem(ft(t)) ?? "null");
|
|
68
68
|
return {
|
|
@@ -83,87 +83,87 @@ function F(t, e) {
|
|
|
83
83
|
function _t(t) {
|
|
84
84
|
t && (dt = t);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function Bt() {
|
|
87
87
|
return dt;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const e = { config: t, state:
|
|
91
|
-
return
|
|
89
|
+
function Wt(t) {
|
|
90
|
+
const e = { config: t, state: Nt(t.service) };
|
|
91
|
+
return Ht(e), m.set(t.service, e), C(), e;
|
|
92
92
|
}
|
|
93
93
|
function Kt(t) {
|
|
94
|
-
|
|
94
|
+
m.delete(t), m.size || (E = null, O.clear()), C();
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return [...
|
|
96
|
+
function v() {
|
|
97
|
+
return [...m.values()];
|
|
98
98
|
}
|
|
99
99
|
function Jt(t) {
|
|
100
|
-
return t ?
|
|
100
|
+
return t ? m.get(t) : m.values().next().value;
|
|
101
101
|
}
|
|
102
102
|
function pt(t) {
|
|
103
|
-
return
|
|
104
|
-
|
|
103
|
+
return B.add(t), () => {
|
|
104
|
+
B.delete(t);
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
107
|
+
function C() {
|
|
108
|
+
B.forEach((t) => t());
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
t.state = e, F(t.config.service, e),
|
|
110
|
+
function H(t, e) {
|
|
111
|
+
t.state = e, F(t.config.service, e), C();
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const a = t.state.faults.filter((
|
|
115
|
-
|
|
113
|
+
function Zt(t, e, n) {
|
|
114
|
+
const a = t.state.faults.filter((r) => r !== e);
|
|
115
|
+
H(t, { ...t.state, faults: n ? [...a, e] : a });
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Xt(t, e) {
|
|
118
118
|
const n = `rule-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
119
|
-
|
|
119
|
+
H(t, { ...t.state, rules: [...t.state.rules, { ...e, id: n, enabled: !0 }] });
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
function Vt(t, e, n) {
|
|
122
|
+
H(t, { ...t.state, rules: t.state.rules.map((a) => a.id === e ? { ...a, enabled: n } : a) });
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
124
|
+
function Gt(t, e) {
|
|
125
|
+
H(t, { ...t.state, rules: t.state.rules.filter((n) => n.id !== e) });
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
127
|
+
function Yt() {
|
|
128
|
+
m.forEach((t) => {
|
|
129
129
|
t.state = { faults: [], rules: [], ...t.state.launcher ? { launcher: t.state.launcher } : {} }, F(t.config.service, t.state);
|
|
130
|
-
}),
|
|
130
|
+
}), C();
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function R(t) {
|
|
133
133
|
return t.state.faults.length + t.state.rules.filter((e) => e.enabled).length;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Qt(t) {
|
|
136
136
|
return t.state.launcher ?? t.config.launcher ?? "visible";
|
|
137
137
|
}
|
|
138
138
|
function tt(t) {
|
|
139
|
-
|
|
139
|
+
m.forEach((e) => {
|
|
140
140
|
e.state = { ...e.state, launcher: t }, F(e.config.service, e.state);
|
|
141
|
-
}),
|
|
141
|
+
}), C();
|
|
142
142
|
}
|
|
143
|
-
const te = 1e4, et = 200,
|
|
144
|
-
let
|
|
145
|
-
const
|
|
143
|
+
const te = 1e4, et = 200, L = ".u-error-screen, .u-notification-fail, .u-notification-warning, .u-offline-banner-offline";
|
|
144
|
+
let I = [], ee = 1;
|
|
145
|
+
const W = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new Set();
|
|
146
146
|
let w = null;
|
|
147
147
|
const x = (t) => {
|
|
148
148
|
const e = (t ?? "").replace(/\s+/g, " ").trim();
|
|
149
149
|
return e.length > et ? `${e.slice(0, et - 1)}…` : e;
|
|
150
150
|
}, ne = (t) => t.status === "network" || typeof t.status == "number" && t.status >= 400;
|
|
151
151
|
function ae(t, e) {
|
|
152
|
-
var
|
|
153
|
-
const n =
|
|
152
|
+
var s;
|
|
153
|
+
const n = v().map((l) => l.config.service), a = (s = e.closest("[data-name]")) == null ? void 0 : s.getAttribute("data-name"), r = a && n.includes(a) ? a : null, o = Y().find((l) => ne(l) && l.endedAt !== null && t - l.endedAt <= te && (!r || l.service === r));
|
|
154
154
|
if (!o) return;
|
|
155
155
|
const i = `${o.method} ${o.path} → ${o.status === "network" ? "сеть" : o.status}`;
|
|
156
156
|
return n.length > 1 ? `${o.service}: ${i}` : i;
|
|
157
157
|
}
|
|
158
158
|
function oe(t) {
|
|
159
|
-
var a,
|
|
159
|
+
var a, r, o;
|
|
160
160
|
if (t.classList.contains("u-error-screen"))
|
|
161
161
|
return {
|
|
162
162
|
kind: "screen",
|
|
163
163
|
// Код — в data-error-code на корне заглушки: крупный код рисуется не у всех вариантов (forbidden, serverError).
|
|
164
164
|
// .u-error-screen-code — для разметки кита до появления атрибута.
|
|
165
165
|
code: x(t.dataset.errorCode || ((a = t.querySelector(".u-error-screen-code")) == null ? void 0 : a.textContent)) || void 0,
|
|
166
|
-
title: x((
|
|
166
|
+
title: x((r = t.querySelector(".u-error-screen-title")) == null ? void 0 : r.textContent) || x(t.getAttribute("aria-label")) || "Заглушка",
|
|
167
167
|
text: x((o = t.querySelector(".u-error-screen-description")) == null ? void 0 : o.textContent) || void 0
|
|
168
168
|
};
|
|
169
169
|
if (t.classList.contains("u-offline-banner-offline"))
|
|
@@ -172,39 +172,39 @@ function oe(t) {
|
|
|
172
172
|
return { kind: "notification", variant: e, title: x(n.textContent) || "Уведомление" };
|
|
173
173
|
}
|
|
174
174
|
function nt(t) {
|
|
175
|
-
if (!t.isConnected || !t.matches(
|
|
175
|
+
if (!t.isConnected || !t.matches(L)) return;
|
|
176
176
|
const e = oe(t);
|
|
177
177
|
if (!e) return;
|
|
178
178
|
const n = JSON.stringify(e);
|
|
179
|
-
if (
|
|
180
|
-
|
|
179
|
+
if (W.get(t) === n) return;
|
|
180
|
+
W.set(t, n);
|
|
181
181
|
const a = Date.now();
|
|
182
|
-
|
|
182
|
+
I = [...I.slice(-29), { id: ee++, at: a, ...e, cause: ae(a, t) }], z.forEach((r) => r());
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
t instanceof Element && (t.matches(
|
|
184
|
+
function re(t, e) {
|
|
185
|
+
t instanceof Element && (t.matches(L) && e.push(t), t.querySelectorAll(L).forEach((n) => e.push(n)));
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function se() {
|
|
188
188
|
w || typeof MutationObserver > "u" || (w = new MutationObserver((t) => {
|
|
189
189
|
const e = [];
|
|
190
190
|
t.forEach((n) => {
|
|
191
191
|
if (n.type === "childList") {
|
|
192
|
-
n.addedNodes.forEach((
|
|
192
|
+
n.addedNodes.forEach((r) => re(r, e));
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
const a = n.target;
|
|
196
|
-
a.matches(
|
|
196
|
+
a.matches(L) ? e.push(a) : W.delete(a);
|
|
197
197
|
}), e.length && setTimeout(() => e.forEach(nt), 0);
|
|
198
|
-
}), w.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["data-error-code", "class"] }), document.querySelectorAll(
|
|
198
|
+
}), w.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["data-error-code", "class"] }), document.querySelectorAll(L).forEach(nt));
|
|
199
199
|
}
|
|
200
200
|
function ie() {
|
|
201
201
|
w == null || w.disconnect(), w = null;
|
|
202
202
|
}
|
|
203
203
|
function K() {
|
|
204
|
-
return [...
|
|
204
|
+
return [...I].reverse();
|
|
205
205
|
}
|
|
206
206
|
function ht() {
|
|
207
|
-
|
|
207
|
+
I = [], z.forEach((t) => t());
|
|
208
208
|
}
|
|
209
209
|
function le(t) {
|
|
210
210
|
return z.add(t), () => {
|
|
@@ -220,13 +220,13 @@ function ue(t, e) {
|
|
|
220
220
|
return null;
|
|
221
221
|
}
|
|
222
222
|
if (!e) return n;
|
|
223
|
-
const a = e.replace(/\/+$/, ""),
|
|
224
|
-
if (
|
|
225
|
-
const o = n.slice(
|
|
223
|
+
const a = e.replace(/\/+$/, ""), r = n.indexOf(a);
|
|
224
|
+
if (r < 0) return null;
|
|
225
|
+
const o = n.slice(r + a.length);
|
|
226
226
|
return o.startsWith("/") || o === "" ? o || "/" : null;
|
|
227
227
|
}
|
|
228
228
|
function de(t, e) {
|
|
229
|
-
const n = (i) => i.split("/").filter(Boolean), a = n(t.trim()),
|
|
229
|
+
const n = (i) => i.split("/").filter(Boolean), a = n(t.trim()), r = n(e), o = (i, s) => i === a.length ? s === r.length : a[i] === "**" ? o(i + 1, s) || s < r.length && o(i, s + 1) : s === r.length ? !1 : (a[i] === "*" || a[i] === r[s]) && o(i + 1, s + 1);
|
|
230
230
|
return o(0, 0);
|
|
231
231
|
}
|
|
232
232
|
function fe(t, e) {
|
|
@@ -254,76 +254,76 @@ function he(t) {
|
|
|
254
254
|
return [...(t.config.groups ?? []).flatMap((a) => a.items).filter((a) => e.has(a.id)).flatMap((a) => [].concat(a.request ?? [])), ...t.state.rules.filter((a) => a.enabled)];
|
|
255
255
|
}
|
|
256
256
|
function gt(t) {
|
|
257
|
-
for (const e of
|
|
257
|
+
for (const e of v()) {
|
|
258
258
|
const n = ue(t, e.config.apiBase);
|
|
259
259
|
if (n !== null) return { entry: e, path: n };
|
|
260
260
|
}
|
|
261
261
|
return null;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
const a = n.toUpperCase(),
|
|
265
|
-
if (
|
|
266
|
-
const i = he(t).find((
|
|
263
|
+
function vt({ entry: t, path: e }, n) {
|
|
264
|
+
const a = n.toUpperCase(), r = new Set(t.state.faults), o = r.has("slow") ? bt : 0;
|
|
265
|
+
if (r.has("offline") || r.has("network")) return { kind: "network", delay: o };
|
|
266
|
+
const i = he(t).find((s) => fe(s, a) && de(s.path, e));
|
|
267
267
|
return i ? pe(i, o) : o ? { kind: "pass", delay: o } : null;
|
|
268
268
|
}
|
|
269
|
-
const
|
|
269
|
+
const mt = (t, e) => zt(t.entry.config.service, e, t.path), J = (t) => t.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
270
270
|
function be(t, e) {
|
|
271
271
|
return new Promise((n, a) => {
|
|
272
272
|
if (e != null && e.aborted) {
|
|
273
273
|
a(J(e));
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const r = setTimeout(n, t);
|
|
277
277
|
e == null || e.addEventListener("abort", () => {
|
|
278
|
-
clearTimeout(
|
|
278
|
+
clearTimeout(r), a(J(e));
|
|
279
279
|
}, { once: !0 });
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
const wt = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
283
283
|
let at = !1;
|
|
284
284
|
function ge() {
|
|
285
|
-
at || typeof window > "u" || (at = !0,
|
|
285
|
+
at || typeof window > "u" || (at = !0, ve(), we());
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function ve() {
|
|
288
288
|
var e;
|
|
289
289
|
const t = (e = window.fetch) == null ? void 0 : e.bind(window);
|
|
290
290
|
t && (window.fetch = async (n, a) => {
|
|
291
|
-
const
|
|
291
|
+
const r = typeof n == "object" && "url" in n ? n : null, o = gt(r ? r.url : String(n));
|
|
292
292
|
if (!o) return t(n, a);
|
|
293
|
-
const i = (a == null ? void 0 : a.method) ?? (
|
|
293
|
+
const i = (a == null ? void 0 : a.method) ?? (r == null ? void 0 : r.method) ?? "GET", s = mt(o, i), l = vt(o, i), f = (a == null ? void 0 : a.signal) ?? (r == null ? void 0 : r.signal);
|
|
294
294
|
try {
|
|
295
295
|
if (l != null && l.delay && await be(l.delay, f), f != null && f.aborted) throw J(f);
|
|
296
296
|
if ((l == null ? void 0 : l.kind) === "network")
|
|
297
|
-
throw
|
|
297
|
+
throw s("network", !0), new TypeError("Failed to fetch");
|
|
298
298
|
if ((l == null ? void 0 : l.kind) === "response")
|
|
299
|
-
return
|
|
299
|
+
return s(l.status, !0), new Response(wt.has(l.status) ? null : l.body, {
|
|
300
300
|
status: l.status,
|
|
301
301
|
headers: { "Content-Type": l.contentType }
|
|
302
302
|
});
|
|
303
303
|
const p = await t(n, a);
|
|
304
|
-
return
|
|
304
|
+
return s(p.status, !1), p;
|
|
305
305
|
} catch (p) {
|
|
306
|
-
throw
|
|
306
|
+
throw s(f != null && f.aborted ? "abort" : "network", !1), p;
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
const ot = /* @__PURE__ */ new WeakMap(),
|
|
310
|
+
const ot = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), me = ["readyState", "responseURL", "status", "statusText", "responseText", "response", "getAllResponseHeaders", "getResponseHeader"];
|
|
311
311
|
function we() {
|
|
312
312
|
if (typeof XMLHttpRequest > "u") return;
|
|
313
313
|
const t = XMLHttpRequest.prototype, e = t.open, n = t.send, a = t.abort;
|
|
314
|
-
t.open = function(o, i, ...
|
|
315
|
-
|
|
314
|
+
t.open = function(o, i, ...s) {
|
|
315
|
+
st(this), me.forEach((l) => {
|
|
316
316
|
Reflect.deleteProperty(this, l);
|
|
317
|
-
}), ot.set(this, { method: o, url: String(i) }), e.call(this, o, i, ...
|
|
317
|
+
}), ot.set(this, { method: o, url: String(i) }), e.call(this, o, i, ...s);
|
|
318
318
|
}, t.send = function(o) {
|
|
319
|
-
const i = ot.get(this),
|
|
320
|
-
if (!i || !
|
|
319
|
+
const i = ot.get(this), s = i ? gt(i.url) : null;
|
|
320
|
+
if (!i || !s) {
|
|
321
321
|
n.call(this, o);
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
const l =
|
|
325
|
-
|
|
326
|
-
const f =
|
|
324
|
+
const l = mt(s, i.method);
|
|
325
|
+
rt.set(this, l);
|
|
326
|
+
const f = vt(s, i.method), p = () => {
|
|
327
327
|
this.addEventListener("abort", () => l("abort", !1), { once: !0 }), this.addEventListener("loadend", () => l(this.status || "network", !1), { once: !0 }), n.call(this, o);
|
|
328
328
|
};
|
|
329
329
|
if (!f) {
|
|
@@ -339,55 +339,55 @@ function we() {
|
|
|
339
339
|
}, f.delay));
|
|
340
340
|
}, t.abort = function() {
|
|
341
341
|
var i;
|
|
342
|
-
if (!
|
|
342
|
+
if (!st(this)) {
|
|
343
343
|
a.call(this);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
(i =
|
|
346
|
+
(i = rt.get(this)) == null || i("abort", !1);
|
|
347
347
|
const o = xt(this);
|
|
348
|
-
o("readyState", 4), o("status", 0),
|
|
348
|
+
o("readyState", 4), o("status", 0), Z(this, ["readystatechange", "abort", "loadend"]), o("readyState", 0);
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function st(t) {
|
|
352
352
|
const e = q.get(t);
|
|
353
353
|
return e === void 0 ? !1 : (clearTimeout(e), q.delete(t), !0);
|
|
354
354
|
}
|
|
355
355
|
const xt = (t) => (e, n) => {
|
|
356
356
|
Object.defineProperty(t, e, { configurable: !0, get: () => n });
|
|
357
|
-
},
|
|
357
|
+
}, Z = (t, e) => {
|
|
358
358
|
e.forEach((n) => t.dispatchEvent(new ProgressEvent(n)));
|
|
359
359
|
};
|
|
360
360
|
function xe(t, e, n) {
|
|
361
361
|
const a = xt(t);
|
|
362
362
|
if (a("readyState", 4), a("responseURL", n), e.kind === "network") {
|
|
363
|
-
a("status", 0), a("statusText", ""),
|
|
363
|
+
a("status", 0), a("statusText", ""), Z(t, ["readystatechange", "error", "loadend"]);
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const
|
|
367
|
-
let o =
|
|
366
|
+
const r = wt.has(e.status) ? "" : e.body;
|
|
367
|
+
let o = r;
|
|
368
368
|
if (t.responseType === "json")
|
|
369
369
|
try {
|
|
370
|
-
o = e.contentType === "application/json" &&
|
|
370
|
+
o = e.contentType === "application/json" && r ? JSON.parse(r) : null;
|
|
371
371
|
} catch {
|
|
372
372
|
o = null;
|
|
373
373
|
}
|
|
374
|
-
a("status", e.status), a("statusText", String(e.status)), a("responseText",
|
|
374
|
+
a("status", e.status), a("statusText", String(e.status)), a("responseText", r), a("response", o);
|
|
375
375
|
const i = `content-type: ${e.contentType}\r
|
|
376
376
|
`;
|
|
377
377
|
Object.defineProperty(t, "getAllResponseHeaders", { configurable: !0, value: () => i }), Object.defineProperty(t, "getResponseHeader", {
|
|
378
378
|
configurable: !0,
|
|
379
|
-
value: (
|
|
380
|
-
}),
|
|
379
|
+
value: (s) => s.toLowerCase() === "content-type" ? e.contentType : null
|
|
380
|
+
}), Z(t, ["readystatechange", "load", "loadend"]);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Q(t) {
|
|
383
383
|
try {
|
|
384
384
|
t ? Reflect.deleteProperty(navigator, "onLine") : Object.defineProperty(navigator, "onLine", { configurable: !0, get: () => !1 }), window.dispatchEvent(new Event(t ? "online" : "offline"));
|
|
385
385
|
} catch {
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
function yt() {
|
|
389
|
-
const t =
|
|
390
|
-
|
|
389
|
+
const t = v().some((e) => e.state.faults.includes("offline"));
|
|
390
|
+
Yt(), ct(), ht(), t && Q(!0);
|
|
391
391
|
}
|
|
392
392
|
const ye = {
|
|
393
393
|
title: "Сеть",
|
|
@@ -400,29 +400,43 @@ const ye = {
|
|
|
400
400
|
authFail: { label: "Сбой входа", hint: "После перезагрузки сервис рисует заглушку входа" },
|
|
401
401
|
crashApp: { label: "Падение приложения", hint: "Ошибка рендера над каркасом сервиса" },
|
|
402
402
|
crashPage: { label: "Падение страницы", hint: "Каждая открытая страница падает, пока флаг включён" }
|
|
403
|
-
},
|
|
403
|
+
}, X = [["", "Любой"], ["GET", "GET"], ["write", "Запись"], ["POST", "POST"], ["PUT", "PUT"], ["PATCH", "PATCH"], ["DELETE", "DELETE"]], ke = [400, 401, 403, 404, 409, 422, 429, 500, 502, 503, 504], d = (t) => String(t ?? "").replace(/[&<>"']/g, (e) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[e]), Se = '<svg viewBox="0 0 36 36" fill="none" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M28 0L20 16H36L28 0ZM28 5.11101L23.6984 13.7143H32.3016L28 5.11101Z" fill="#3BA68C"/><path fill-rule="evenodd" clip-rule="evenodd" d="M9 33.7143C12.1559 33.7143 14.7143 31.1559 14.7143 28C14.7143 24.8441 12.1559 22.2857 9 22.2857C5.84409 22.2857 3.28571 24.8441 3.28571 28C3.28571 31.1559 5.84409 33.7143 9 33.7143ZM9 36C13.4183 36 17 32.4183 17 28C17 23.5817 13.4183 20 9 20C4.58172 20 1 23.5817 1 28C1 32.4183 4.58172 36 9 36Z" fill="#E54B6A"/><path fill-rule="evenodd" clip-rule="evenodd" d="M33.7143 22.2857H22.2857V33.7143H33.7143V22.2857ZM20 20V36H36V20H20Z" fill="#1E4391"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12.0593 4.9091L9 0L5.94073 4.9091L0 6.11146L4.05 10.3478L3.43769 16L9 13.7091L14.5623 16L13.95 10.3478L18 6.11146L12.0593 4.9091ZM14.0262 7.31822L10.7085 6.64674L9 3.90515L7.29149 6.64674L3.97378 7.31822L6.23558 9.68408L5.89362 12.8407L9 11.5613L12.1064 12.8407L11.7644 9.68408L14.0262 7.31822Z" fill="#E98446"/></svg>', Ee = `
|
|
404
404
|
:host { all: initial; }
|
|
405
405
|
* { box-sizing: border-box; }
|
|
406
406
|
.root { --p: #1e4391; --p-soft: #e8eef9; --fg: #222; --muted: #6b7280; --line: #d9dee8; --bg: #fff; --soft: #f5f7fb;
|
|
407
407
|
--danger: #d6342c; --danger-soft: #fdeceb;
|
|
408
|
+
/* Отступ кнопки снизу: StickyActionBar кита, пока стоит у нижнего края, задаёт на <html>
|
|
409
|
+
--u-dev-launcher-bottom (его высота + 12px) — кнопка и панель поднимаются над ним. */
|
|
410
|
+
--launcher-bottom: var(--u-dev-launcher-bottom, calc(12px + env(safe-area-inset-bottom, 0px)));
|
|
408
411
|
font-family: Montserrat, "Segoe UI", Arial, sans-serif; font-size: 13px; line-height: 1.4; color: var(--fg); }
|
|
409
412
|
button, input, select { font: inherit; color: inherit; }
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
.pill
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
413
|
+
/* Кнопка панели — в цветах кита: токены --u-color-* с :root сервиса проходят в shadow DOM
|
|
414
|
+
(all: initial их не сбрасывает), запасные значения — как в ките. В покое — круг с логотипом,
|
|
415
|
+
чтобы меньше закрывать нижние липкие панели сервиса; при наведении и фокусе раскрывается
|
|
416
|
+
в «логотип + Dev»; при включённых сбоях раскрыта всегда, цвет ошибки и число сбоев. */
|
|
417
|
+
.pill { --kit-p: var(--u-color-primary, #1e4391); --kit-error: var(--u-color-error, #ef302b);
|
|
418
|
+
--kit-surface: var(--u-color-surface, #fff); --kit-line: var(--u-color-border, #748ab9);
|
|
419
|
+
position: fixed; left: 12px; bottom: var(--launcher-bottom); z-index: 2147483000;
|
|
420
|
+
display: inline-flex; align-items: center; height: 36px; padding: 0; border: 1px solid var(--kit-line); border-radius: 18px;
|
|
421
|
+
background: var(--kit-surface); color: var(--kit-p); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
|
|
422
|
+
box-shadow: 0 2px 8px rgba(0,0,0,.15); }
|
|
423
|
+
.pill .logo { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--kit-surface); }
|
|
424
|
+
.pill .logo svg { display: block; width: 20px; height: 20px; }
|
|
425
|
+
.pill .label { max-width: 0; overflow: hidden; opacity: 0; padding: 0;
|
|
426
|
+
transition: max-width .2s ease, opacity .2s ease, padding .2s ease; }
|
|
427
|
+
.pill:hover .label, .pill:focus-visible .label, .pill.on .label { max-width: 260px; opacity: 1; padding: 0 14px 0 2px; }
|
|
428
|
+
.pill.on { background: var(--kit-error); border-color: var(--kit-error); color: #fff; }
|
|
429
|
+
.pill.on .logo { width: 30px; height: 30px; margin: 0 1px 0 2px; }
|
|
430
|
+
.pill:focus-visible { outline: 2px solid var(--kit-p); outline-offset: 2px; }
|
|
431
|
+
.panel { position: fixed; left: 12px; bottom: calc(var(--launcher-bottom) + 44px); z-index: 2147483001;
|
|
418
432
|
width: 360px; max-width: calc(100vw - 24px); max-height: min(70vh, 640px); display: flex; flex-direction: column;
|
|
419
433
|
background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.25); }
|
|
420
|
-
.panel.alone { bottom:
|
|
421
|
-
.hint { position: fixed; left: 12px; bottom:
|
|
434
|
+
.panel.alone { bottom: var(--launcher-bottom); }
|
|
435
|
+
.hint { position: fixed; left: 12px; bottom: var(--launcher-bottom); z-index: 2147483000;
|
|
422
436
|
max-width: calc(100vw - 24px); padding: 8px 12px; border-radius: 10px; background: #222; color: #fff; font-size: 12px;
|
|
423
437
|
box-shadow: 0 4px 14px rgba(0,0,0,.2); }
|
|
424
438
|
.note { margin: 0 12px 8px; padding: 6px 10px; border-radius: 8px; background: var(--p-soft); color: var(--fg); font-size: 12px; overflow-wrap: anywhere; }
|
|
425
|
-
.pill ~ .hint { bottom: calc(
|
|
439
|
+
.pill ~ .hint { bottom: calc(var(--launcher-bottom) + 44px); }
|
|
426
440
|
.head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; }
|
|
427
441
|
.title { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
428
442
|
.title select { font-weight: 700; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--bg); max-width: 100%; }
|
|
@@ -476,15 +490,15 @@ dd { margin: 0; font-family: Consolas, monospace; font-size: 12px; overflow-wrap
|
|
|
476
490
|
padding-bottom: env(safe-area-inset-bottom, 0px); }
|
|
477
491
|
.panel ~ .pill { display: none; }
|
|
478
492
|
}
|
|
479
|
-
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }
|
|
480
|
-
`,
|
|
481
|
-
let
|
|
493
|
+
@media (prefers-reduced-motion: reduce) { .switch::after, .pill .label { transition: none; } }
|
|
494
|
+
`, Le = 6e3;
|
|
495
|
+
let V, h = null, u = null, k = null, y = null, T = !1, S = !1;
|
|
482
496
|
const $t = { open: !1, tab: "faults", search: "", service: void 0, hint: "" }, c = { ...$t };
|
|
483
497
|
function D() {
|
|
484
|
-
const t =
|
|
498
|
+
const t = v();
|
|
485
499
|
return t.find((e) => e.config.service === c.service) ?? t[0];
|
|
486
500
|
}
|
|
487
|
-
function
|
|
501
|
+
function kt(t) {
|
|
488
502
|
const e = (t.config.builtins ?? []).map((n) => ({ id: n, ...$e[n] }));
|
|
489
503
|
return [
|
|
490
504
|
...e.length ? [{ title: "Весь сервис", items: e }] : [],
|
|
@@ -494,63 +508,63 @@ function St(t) {
|
|
|
494
508
|
}
|
|
495
509
|
function Te(t, e) {
|
|
496
510
|
var n;
|
|
497
|
-
return ((n =
|
|
511
|
+
return ((n = kt(t).flatMap((a) => a.items).find((a) => a.id === e)) == null ? void 0 : n.label) ?? e;
|
|
498
512
|
}
|
|
499
|
-
function
|
|
513
|
+
function St(t) {
|
|
500
514
|
return [
|
|
501
515
|
...t.state.faults.map((e) => Te(t, e)),
|
|
502
516
|
...t.state.rules.filter((e) => e.enabled).map((e) => `${e.path} → ${e.status}`)
|
|
503
517
|
];
|
|
504
518
|
}
|
|
505
|
-
function
|
|
506
|
-
const
|
|
507
|
-
return
|
|
519
|
+
function Ae(t, e, n, a) {
|
|
520
|
+
const r = t % 100, o = t % 10;
|
|
521
|
+
return r >= 11 && r <= 14 ? a : o === 1 ? e : o >= 2 && o <= 4 ? n : a;
|
|
508
522
|
}
|
|
509
523
|
const it = (t) => !c.search || t.toLowerCase().includes(c.search.toLowerCase());
|
|
510
|
-
function
|
|
511
|
-
const e = new Set(t.state.faults), n =
|
|
512
|
-
const i = o.items.filter((
|
|
513
|
-
return i.length ? `<div><div class="group-title">${d(o.title)}</div>${i.map((
|
|
514
|
-
<label class="row"><span class="text">${d(
|
|
515
|
-
<input class="switch" type="checkbox" role="switch" data-fault="${d(
|
|
516
|
-
aria-label="${d(
|
|
517
|
-
}).join(""), a = t.state.rules.filter((o) => it(`${o.method ?? ""} ${o.path} ${o.status}`)),
|
|
524
|
+
function Ce(t) {
|
|
525
|
+
const e = new Set(t.state.faults), n = kt(t).map((o) => {
|
|
526
|
+
const i = o.items.filter((s) => it(`${s.label} ${s.hint ?? ""} ${s.id}`));
|
|
527
|
+
return i.length ? `<div><div class="group-title">${d(o.title)}</div>${i.map((s) => `
|
|
528
|
+
<label class="row"><span class="text">${d(s.label)}${s.hint ? `<small>${d(s.hint)}</small>` : ""}</span>
|
|
529
|
+
<input class="switch" type="checkbox" role="switch" data-fault="${d(s.id)}" ${e.has(s.id) ? "checked" : ""}
|
|
530
|
+
aria-label="${d(s.label)}"></label>`).join("")}</div>` : "";
|
|
531
|
+
}).join(""), a = t.state.rules.filter((o) => it(`${o.method ?? ""} ${o.path} ${o.status}`)), r = (o) => {
|
|
518
532
|
var i;
|
|
519
|
-
return ((i =
|
|
533
|
+
return ((i = X.find(([s]) => s === (o ?? ""))) == null ? void 0 : i[1]) ?? o;
|
|
520
534
|
};
|
|
521
535
|
return `
|
|
522
536
|
<input class="search" type="search" data-search placeholder="Поиск: 503, офлайн, роли…" aria-label="Поиск по сценариям" value="${d(c.search)}">
|
|
523
537
|
${n || (a.length ? "" : '<div class="empty">Ничего не найдено.</div>')}
|
|
524
538
|
<div><div class="group-title">Ответы сервера</div>
|
|
525
|
-
${a.map((o) => `<div class="rule"><span class="text">${d(
|
|
539
|
+
${a.map((o) => `<div class="rule"><span class="text">${d(r(o.method))} ${d(o.path)} → ${o.status}</span>
|
|
526
540
|
<input class="switch" type="checkbox" role="switch" data-rule="${d(o.id)}" ${o.enabled ? "checked" : ""}
|
|
527
541
|
aria-label="${d(`${o.path} → ${o.status}`)}">
|
|
528
542
|
<button class="remove" type="button" data-remove="${d(o.id)}" aria-label="Удалить правило">×</button></div>`).join("")}
|
|
529
543
|
<form class="add" data-add>
|
|
530
|
-
<select name="method" aria-label="Метод">${
|
|
544
|
+
<select name="method" aria-label="Метод">${X.map(([o, i]) => `<option value="${o}">${i}</option>`).join("")}</select>
|
|
531
545
|
<input name="path" required placeholder="/assets/*" aria-label="Путь после ${d(t.config.apiBase ?? "адреса сайта")}">
|
|
532
|
-
<select name="status" aria-label="Код ответа">${
|
|
546
|
+
<select name="status" aria-label="Код ответа">${ke.map((o) => `<option${o === 503 ? " selected" : ""}>${o}</option>`).join("")}</select>
|
|
533
547
|
<button class="btn primary" type="submit">Добавить</button>
|
|
534
548
|
</form>
|
|
535
549
|
</div>`;
|
|
536
550
|
}
|
|
537
|
-
function
|
|
551
|
+
function De() {
|
|
538
552
|
const t = document.documentElement.getAttribute("data-u-viewport");
|
|
539
553
|
return t || (window.matchMedia("(max-width: 576px)").matches ? "mobile" : window.matchMedia("(max-width: 900px)").matches ? "tablet" : "desktop");
|
|
540
554
|
}
|
|
541
|
-
function
|
|
542
|
-
var
|
|
543
|
-
const e = document.documentElement, n = getComputedStyle(e).getPropertyValue("--u-unit").trim(), a =
|
|
544
|
-
let
|
|
555
|
+
function Pe(t) {
|
|
556
|
+
var s, l, f;
|
|
557
|
+
const e = document.documentElement, n = getComputedStyle(e).getPropertyValue("--u-unit").trim(), a = Bt();
|
|
558
|
+
let r = "—";
|
|
545
559
|
try {
|
|
546
|
-
const p = (l = (
|
|
547
|
-
p && (
|
|
560
|
+
const p = (l = (s = t.config).user) == null ? void 0 : l.call(s);
|
|
561
|
+
p && (r = [p.name, (f = p.roles) != null && f.length ? p.roles.join(", ") : "без ролей"].filter(Boolean).join(" · "));
|
|
548
562
|
} catch {
|
|
549
|
-
|
|
563
|
+
r = "не удалось прочитать";
|
|
550
564
|
}
|
|
551
|
-
const o =
|
|
565
|
+
const o = St(t);
|
|
552
566
|
return `<dl>${[
|
|
553
|
-
["Ширина", `${window.innerWidth} px · ${
|
|
567
|
+
["Ширина", `${window.innerWidth} px · ${De()}`],
|
|
554
568
|
["Шкала", `${e.getAttribute("data-u-responsive") ?? "legacy"}${n ? ` · --u-unit ${n}` : ""}`],
|
|
555
569
|
["Кит", a ? `${a.name} ${a.version}` : "—"],
|
|
556
570
|
["Сервис", [t.config.service, t.config.version].filter(Boolean).join(" ")],
|
|
@@ -558,7 +572,7 @@ function De(t) {
|
|
|
558
572
|
["Оболочка ЛК", window.__POWERED_BY_QIANKUN__ ? "да (Qiankun)" : "нет"],
|
|
559
573
|
["Ввод", e.getAttribute("data-input-mode") ?? "—"],
|
|
560
574
|
["Сеть", navigator.onLine ? "онлайн" : "офлайн"],
|
|
561
|
-
["Пользователь",
|
|
575
|
+
["Пользователь", r],
|
|
562
576
|
["Включено", o.length ? o.join("; ") : "ничего"]
|
|
563
577
|
].map(([p, $]) => `<dt>${d(p)}</dt><dd>${d($)}</dd>`).join("")}</dl>`;
|
|
564
578
|
}
|
|
@@ -569,71 +583,71 @@ function g() {
|
|
|
569
583
|
u.innerHTML = "";
|
|
570
584
|
return;
|
|
571
585
|
}
|
|
572
|
-
const e =
|
|
586
|
+
const e = v().flatMap(St), n = e.length, a = n ? `Dev · ${n === 1 ? e[0] : `${n} ${Ae(n, "сбой", "сбоя", "сбоев")}`}` : "Dev", r = v(), o = r.every((b) => Qt(b) === "hidden"), i = !o || n > 0, s = r.length > 1 ? `<select data-service aria-label="Сервис">${r.map((b) => `<option value="${d(b.config.service)}"${b === t ? " selected" : ""}>Dev · ${d(b.config.service)}</option>`).join("")}</select>` : `Dev · ${d(t.config.service)}`, l = c.open ? `
|
|
573
587
|
<section class="panel${i ? "" : " alone"}" role="region" aria-label="Панель разработки">
|
|
574
|
-
<div class="head"><span class="title">${
|
|
588
|
+
<div class="head"><span class="title">${s}</span>
|
|
575
589
|
<button class="reset" type="button" data-reset>Сбросить всё</button>
|
|
576
590
|
<button class="close" type="button" data-close aria-label="Свернуть панель">×</button></div>
|
|
577
591
|
<div class="escape">Без панели: адрес с ?dev=off · открыть и закрыть: Ctrl+Alt+D</div>
|
|
578
592
|
<div class="tabs" role="tablist">
|
|
579
|
-
<button class="tab" type="button" role="tab" data-tab="faults" aria-selected="${c.tab === "faults"}">Сбои${
|
|
593
|
+
<button class="tab" type="button" role="tab" data-tab="faults" aria-selected="${c.tab === "faults"}">Сбои${R(t) ? ` · ${R(t)}` : ""}</button>
|
|
580
594
|
<button class="tab" type="button" role="tab" data-tab="requests" aria-selected="${c.tab === "requests"}">Запросы</button>
|
|
581
595
|
<button class="tab" type="button" role="tab" data-tab="errors" aria-selected="${c.tab === "errors"}">Ошибки${K().length ? ` · ${K().length}` : ""}</button>
|
|
582
596
|
<button class="tab" type="button" role="tab" data-tab="view" aria-selected="${c.tab === "view"}">Смотреть</button>
|
|
583
597
|
</div>
|
|
584
|
-
<div class="body">${c.tab === "faults" ?
|
|
598
|
+
<div class="body">${c.tab === "faults" ? Ce(t) : c.tab === "requests" ? Tt(t) : c.tab === "errors" ? ze() : Pe(t)}</div>
|
|
585
599
|
${c.hint ? `<div class="note" role="status">${d(c.hint)}</div>` : ""}
|
|
586
600
|
<div class="foot">
|
|
587
601
|
${t.config.onRefetch ? '<button class="btn" type="button" data-refetch>Перезапросить данные</button>' : ""}
|
|
588
602
|
<button class="btn" type="button" data-reload>Перезагрузить</button>
|
|
589
|
-
${
|
|
603
|
+
${r.some((b) => b.state.faults.length) ? '<button class="btn" type="button" data-share>Ссылка на сбои</button>' : ""}
|
|
590
604
|
<button class="btn" type="button" data-launcher="${o ? "visible" : "hidden"}">${o ? "Показывать кнопку" : "Скрыть кнопку"}</button>
|
|
591
605
|
</div>
|
|
592
|
-
</section>` : "", f = u.activeElement, p = Et(f), $ = (f == null ? void 0 : f.dataset.search) !== void 0 ? f.selectionStart : null, Dt =
|
|
593
|
-
|
|
594
|
-
const
|
|
606
|
+
</section>` : "", f = u.activeElement, p = Et(f), $ = (f == null ? void 0 : f.dataset.search) !== void 0 ? f.selectionStart : null, Dt = G ?? Ue();
|
|
607
|
+
G = null;
|
|
608
|
+
const Pt = [
|
|
595
609
|
e.length ? `Включено: ${e.join(", ")}` : "Панель разработки (Ctrl+Alt+D)",
|
|
596
610
|
o ? "Кнопка скрыта и видна, пока включены сбои" : ""
|
|
597
|
-
].filter(Boolean).join(". "),
|
|
611
|
+
].filter(Boolean).join(". "), Mt = i ? `
|
|
598
612
|
<button class="pill${n ? " on" : ""}" type="button" data-toggle aria-expanded="${c.open}"
|
|
599
|
-
title="${d(
|
|
600
|
-
if (u.innerHTML = `<style>${
|
|
613
|
+
title="${d(Pt)}"><span class="logo">${Se}</span><span class="label">${d(a)}</span></button>` : "", Ot = c.hint && !c.open ? `<div class="hint" role="status">${d(c.hint)}</div>` : "";
|
|
614
|
+
if (u.innerHTML = `<style>${Ee}</style><div class="root">${l}${Mt}${Ot}</div>`, Fe(Dt), p) {
|
|
601
615
|
const b = u.querySelector(p);
|
|
602
616
|
b == null || b.focus(), b instanceof HTMLInputElement && $ !== null && b.setSelectionRange($, $);
|
|
603
617
|
}
|
|
604
618
|
}
|
|
605
|
-
const
|
|
619
|
+
const Me = ["search", "fault", "rule", "tab", "service", "reset", "close", "toggle", "ruleFrom", "clearJournal"];
|
|
606
620
|
function Et(t) {
|
|
607
621
|
if (!t) return null;
|
|
608
622
|
const e = t.getAttribute("name");
|
|
609
623
|
if (e && t.closest("[data-add]")) return `[data-add] [name="${e}"]`;
|
|
610
|
-
const n =
|
|
624
|
+
const n = Me.find((o) => t.dataset[o] !== void 0);
|
|
611
625
|
if (!n) return null;
|
|
612
|
-
const a = t.dataset[n],
|
|
613
|
-
return a ? `[${
|
|
626
|
+
const a = t.dataset[n], r = `data-${n.replace(/[A-Z]/g, (o) => `-${o.toLowerCase()}`)}`;
|
|
627
|
+
return a ? `[${r}="${a.replace(/["\\]/g, "\\$&")}"]` : `[${r}]`;
|
|
614
628
|
}
|
|
615
|
-
const
|
|
616
|
-
let
|
|
629
|
+
const Lt = ["method", "path", "status"];
|
|
630
|
+
let G = null;
|
|
617
631
|
const Oe = { network: "сеть", abort: "отмена", pending: "…" };
|
|
618
|
-
function
|
|
619
|
-
const e =
|
|
632
|
+
function Tt(t) {
|
|
633
|
+
const e = Y().filter((n) => n.service === t.config.service);
|
|
620
634
|
return e.length ? `<div class="requests-head"><span>Последние ${e.length}, новые сверху</span>
|
|
621
635
|
<button class="btn" type="button" data-clear-journal>Очистить</button></div>
|
|
622
636
|
<div class="requests">${e.map((n) => {
|
|
623
|
-
const a = typeof n.status == "number" ? String(n.status) : Oe[n.status],
|
|
637
|
+
const a = typeof n.status == "number" ? String(n.status) : Oe[n.status], r = n.status === "network" || typeof n.status == "number" && n.status >= 400, o = [n.duration === null ? "" : `${n.duration} мс`, n.faked ? "подменён панелью" : ""].filter(Boolean).join(" · ");
|
|
624
638
|
return `<div class="req"><span>${d(n.method)}</span>
|
|
625
639
|
<span class="path">${d(n.path)}${o ? `<small>${d(o)}</small>` : ""}</span>
|
|
626
|
-
<span class="status${
|
|
640
|
+
<span class="status${r ? " bad" : ""}">${d(a)}</span>
|
|
627
641
|
<button class="btn" type="button" data-rule-from="${n.id}" title="Ответ на этот адрес — в «Ответах сервера»">Правило</button></div>`;
|
|
628
642
|
}).join("")}</div>` : '<div class="empty">Запросов к API пока не было. Журнал помнит последние 50 и очищается при перезагрузке.</div>';
|
|
629
643
|
}
|
|
630
|
-
const
|
|
644
|
+
const Re = {
|
|
631
645
|
screen: "Заглушка",
|
|
632
646
|
fail: "Уведомление об ошибке",
|
|
633
647
|
warning: "Предупреждение",
|
|
634
648
|
offline: "Нет связи"
|
|
635
|
-
}, Ie = (t) =>
|
|
636
|
-
function
|
|
649
|
+
}, Ie = (t) => Re[t.kind === "notification" ? t.variant ?? "fail" : t.kind];
|
|
650
|
+
function ze() {
|
|
637
651
|
const t = K();
|
|
638
652
|
return t.length ? `<div class="requests-head"><span>Последние ${t.length}, новые сверху</span>
|
|
639
653
|
<button class="btn" type="button" data-clear-shown>Очистить</button></div>
|
|
@@ -645,19 +659,19 @@ function Me() {
|
|
|
645
659
|
<div class="cause">${e.cause ? `← ${d(e.cause)}` : "<small>Неудачных запросов к API перед показом не было</small>"}</div>
|
|
646
660
|
</div>`).join("")}</div>` : '<div class="empty">Ошибок пользователю пока не показывали. Здесь появятся заглушки, уведомления об ошибке и полоса «Нет связи» — с причиной из запросов к API.</div>';
|
|
647
661
|
}
|
|
648
|
-
function
|
|
662
|
+
function qe(t) {
|
|
649
663
|
var a;
|
|
650
|
-
const e =
|
|
664
|
+
const e = Y().find((r) => String(r.id) === String(t));
|
|
651
665
|
if (!e) return;
|
|
652
|
-
|
|
666
|
+
G = { method: X.some(([r]) => r === e.method) ? e.method : "", path: e.path, status: "503" }, c.tab = "faults", c.search = "", g(), (a = u == null ? void 0 : u.querySelector('[data-add] [name="status"]')) == null || a.focus();
|
|
653
667
|
}
|
|
654
|
-
function
|
|
655
|
-
const t = [...new Set(
|
|
668
|
+
function je() {
|
|
669
|
+
const t = [...new Set(v().flatMap((s) => s.state.faults))], e = new URL(window.location.href);
|
|
656
670
|
e.searchParams.set("dev", t.join(","));
|
|
657
|
-
const n = e.href.replace(/%2C/gi, ","),
|
|
658
|
-
A(`Ссылка скопирована.${
|
|
671
|
+
const n = e.href.replace(/%2C/gi, ","), r = v().some((s) => s.state.rules.some((l) => l.enabled)) ? " Свои правила «адрес → код» в неё не входят." : "", o = () => {
|
|
672
|
+
A(`Ссылка скопирована.${r}`), g();
|
|
659
673
|
}, i = () => {
|
|
660
|
-
A(`Ссылка: ${n}${
|
|
674
|
+
A(`Ссылка: ${n}${r}`), g();
|
|
661
675
|
};
|
|
662
676
|
try {
|
|
663
677
|
navigator.clipboard.writeText(n).then(o, i);
|
|
@@ -665,68 +679,68 @@ function qe() {
|
|
|
665
679
|
i();
|
|
666
680
|
}
|
|
667
681
|
}
|
|
668
|
-
function
|
|
682
|
+
function Ue() {
|
|
669
683
|
const t = u == null ? void 0 : u.querySelector("[data-add]");
|
|
670
|
-
return t ? Object.fromEntries(
|
|
684
|
+
return t ? Object.fromEntries(Lt.map((e) => {
|
|
671
685
|
var n;
|
|
672
686
|
return [e, ((n = t.elements.namedItem(e)) == null ? void 0 : n.value) ?? ""];
|
|
673
687
|
})) : null;
|
|
674
688
|
}
|
|
675
|
-
function
|
|
689
|
+
function Fe(t) {
|
|
676
690
|
const e = u == null ? void 0 : u.querySelector("[data-add]");
|
|
677
|
-
!e || !t ||
|
|
691
|
+
!e || !t || Lt.forEach((n) => {
|
|
678
692
|
const a = e.elements.namedItem(n);
|
|
679
693
|
a && (a.value = t[n]);
|
|
680
694
|
});
|
|
681
695
|
}
|
|
682
|
-
function
|
|
696
|
+
function He(t) {
|
|
683
697
|
if (!t) {
|
|
684
698
|
A(""), tt("visible");
|
|
685
699
|
return;
|
|
686
700
|
}
|
|
687
701
|
c.open = !1;
|
|
688
|
-
const e =
|
|
702
|
+
const e = v().some((n) => R(n) > 0);
|
|
689
703
|
A(`Кнопка Dev скрыта${e ? " и видна, пока включены сбои" : ""}. Панель: Ctrl+Alt+D`), tt("hidden");
|
|
690
704
|
}
|
|
691
705
|
function A(t) {
|
|
692
|
-
clearTimeout(
|
|
706
|
+
clearTimeout(V), c.hint = t, t && (V = setTimeout(() => {
|
|
693
707
|
c.hint = "", g();
|
|
694
|
-
},
|
|
708
|
+
}, Le));
|
|
695
709
|
}
|
|
696
710
|
function j(t = !c.open) {
|
|
697
711
|
var e, n;
|
|
698
712
|
t && A(""), c.open = t, g(), t ? (e = u == null ? void 0 : u.querySelector("[data-search], [data-tab]")) == null || e.focus() : (n = u == null ? void 0 : u.querySelector("[data-toggle]")) == null || n.focus();
|
|
699
713
|
}
|
|
700
714
|
function Ne(t) {
|
|
701
|
-
var a,
|
|
715
|
+
var a, r, o, i;
|
|
702
716
|
const e = t.target, n = D();
|
|
703
717
|
if (n)
|
|
704
718
|
if (e.closest("[data-toggle]")) j();
|
|
705
719
|
else if (e.closest("[data-close]")) j(!1);
|
|
706
720
|
else if (e.closest("[data-reset]"))
|
|
707
|
-
yt(), (
|
|
721
|
+
yt(), (r = (a = n.config).onRefetch) == null || r.call(a);
|
|
708
722
|
else if (e.closest("[data-reload]")) window.location.reload();
|
|
709
|
-
else if (e.closest("[data-rule-from]"))
|
|
723
|
+
else if (e.closest("[data-rule-from]")) qe(Number(e.closest("[data-rule-from]").dataset.ruleFrom));
|
|
710
724
|
else if (e.closest("[data-clear-journal]"))
|
|
711
725
|
ct(), g();
|
|
712
726
|
else if (e.closest("[data-clear-shown]")) ht();
|
|
713
|
-
else if (e.closest("[data-share]"))
|
|
714
|
-
else if (e.closest("[data-launcher]"))
|
|
727
|
+
else if (e.closest("[data-share]")) je();
|
|
728
|
+
else if (e.closest("[data-launcher]")) He(e.closest("[data-launcher]").dataset.launcher === "hidden");
|
|
715
729
|
else if (e.closest("[data-refetch]")) (i = (o = n.config).onRefetch) == null || i.call(o);
|
|
716
730
|
else if (e.closest("[data-tab]")) {
|
|
717
|
-
const
|
|
718
|
-
c.tab =
|
|
719
|
-
} else e.closest("[data-remove]") &&
|
|
731
|
+
const s = e.closest("[data-tab]").dataset.tab;
|
|
732
|
+
c.tab = s === "view" || s === "requests" || s === "errors" ? s : "faults", g();
|
|
733
|
+
} else e.closest("[data-remove]") && Gt(n, e.closest("[data-remove]").dataset.remove);
|
|
720
734
|
}
|
|
721
|
-
function
|
|
735
|
+
function _e(t) {
|
|
722
736
|
const e = t.target, n = D();
|
|
723
737
|
if (n)
|
|
724
738
|
if (e.dataset.fault) {
|
|
725
739
|
const a = e.checked;
|
|
726
|
-
|
|
727
|
-
} else e.dataset.rule ?
|
|
740
|
+
Zt(n, e.dataset.fault, a), e.dataset.fault === "offline" && Q(!a);
|
|
741
|
+
} else e.dataset.rule ? Vt(n, e.dataset.rule, e.checked) : e.dataset.service !== void 0 && (c.service = e.value, g());
|
|
728
742
|
}
|
|
729
|
-
function
|
|
743
|
+
function Be(t) {
|
|
730
744
|
const e = t.target;
|
|
731
745
|
e.dataset.search !== void 0 && (c.search = e.value, g());
|
|
732
746
|
}
|
|
@@ -734,10 +748,10 @@ function We(t) {
|
|
|
734
748
|
const e = t.target;
|
|
735
749
|
if (e.dataset.add === void 0) return;
|
|
736
750
|
t.preventDefault();
|
|
737
|
-
const n = D(), a = new FormData(e),
|
|
738
|
-
!n || !
|
|
751
|
+
const n = D(), a = new FormData(e), r = String(a.get("path") ?? "").trim();
|
|
752
|
+
!n || !r || (e.reset(), Xt(n, {
|
|
739
753
|
method: String(a.get("method") ?? "") || void 0,
|
|
740
|
-
path:
|
|
754
|
+
path: r.startsWith("/") ? r : `/${r}`,
|
|
741
755
|
status: Number(a.get("status")) || 500,
|
|
742
756
|
html: Number(a.get("status")) === 502 || void 0
|
|
743
757
|
}));
|
|
@@ -745,21 +759,21 @@ function We(t) {
|
|
|
745
759
|
function At(t) {
|
|
746
760
|
t.ctrlKey && t.altKey && t.code === "KeyD" ? (t.preventDefault(), j()) : t.key === "Escape" && c.open && h && t.composedPath().includes(h) && (t.preventDefault(), t.stopPropagation(), j(!1));
|
|
747
761
|
}
|
|
748
|
-
function
|
|
762
|
+
function Ke() {
|
|
749
763
|
if (h || typeof document > "u") return;
|
|
750
|
-
h = document.createElement("div"), h.id = "urfu-ui-kit-dev", h.setAttribute("data-urfu-ui-kit-dev", ""), u = h.attachShadow({ mode: "open" }), u.addEventListener("click", Ne), u.addEventListener("change",
|
|
751
|
-
(!(h != null && h.isConnected) || a.some((
|
|
752
|
-
}), y.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["open"] }), c.open =
|
|
753
|
-
const t = pt(g), e = qt(
|
|
754
|
-
u.addEventListener("pointerdown",
|
|
764
|
+
h = document.createElement("div"), h.id = "urfu-ui-kit-dev", h.setAttribute("data-urfu-ui-kit-dev", ""), u = h.attachShadow({ mode: "open" }), u.addEventListener("click", Ne), u.addEventListener("change", _e), u.addEventListener("input", Be), u.addEventListener("submit", We), window.addEventListener("keydown", At, !0), lt(), y = new MutationObserver((a) => {
|
|
765
|
+
(!(h != null && h.isConnected) || a.some((r) => r.type === "attributes")) && lt();
|
|
766
|
+
}), y.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["open"] }), c.open = v().some((a) => R(a) > 0);
|
|
767
|
+
const t = pt(g), e = qt(Ct);
|
|
768
|
+
u.addEventListener("pointerdown", Ze), window.addEventListener("pointerup", U, !0), window.addEventListener("pointercancel", U, !0);
|
|
755
769
|
const n = le(() => {
|
|
756
770
|
c.open && g();
|
|
757
771
|
});
|
|
758
|
-
|
|
772
|
+
se(), k = () => {
|
|
759
773
|
t(), e(), n(), ie();
|
|
760
774
|
}, g();
|
|
761
775
|
}
|
|
762
|
-
function
|
|
776
|
+
function Je() {
|
|
763
777
|
try {
|
|
764
778
|
const t = document.querySelectorAll("dialog:modal");
|
|
765
779
|
return t[t.length - 1] ?? null;
|
|
@@ -769,70 +783,70 @@ function Ke() {
|
|
|
769
783
|
}
|
|
770
784
|
function lt() {
|
|
771
785
|
if (!h) return;
|
|
772
|
-
const t =
|
|
786
|
+
const t = Je() ?? document.documentElement;
|
|
773
787
|
h.parentNode !== t && t.appendChild(h);
|
|
774
788
|
}
|
|
775
|
-
function
|
|
776
|
-
var
|
|
789
|
+
function Ct() {
|
|
790
|
+
var r;
|
|
777
791
|
if (!c.open || c.tab !== "requests") {
|
|
778
|
-
|
|
792
|
+
S = !1;
|
|
779
793
|
return;
|
|
780
794
|
}
|
|
781
|
-
if (
|
|
782
|
-
|
|
795
|
+
if (T) {
|
|
796
|
+
S = !0;
|
|
783
797
|
return;
|
|
784
798
|
}
|
|
785
|
-
|
|
799
|
+
S = !1;
|
|
786
800
|
const t = u == null ? void 0 : u.querySelector(".body"), e = D();
|
|
787
801
|
if (!u || !t || !e) {
|
|
788
802
|
g();
|
|
789
803
|
return;
|
|
790
804
|
}
|
|
791
805
|
const n = u.activeElement, a = n && t.contains(n) ? Et(n) : null;
|
|
792
|
-
t.innerHTML =
|
|
806
|
+
t.innerHTML = Tt(e), a && ((r = t.querySelector(a)) == null || r.focus());
|
|
793
807
|
}
|
|
794
|
-
function
|
|
795
|
-
|
|
808
|
+
function Ze() {
|
|
809
|
+
T = !0;
|
|
796
810
|
}
|
|
797
811
|
function U() {
|
|
798
|
-
|
|
812
|
+
T && (T = !1, S && setTimeout(Ct, 0));
|
|
799
813
|
}
|
|
800
814
|
function Xe() {
|
|
801
|
-
|
|
815
|
+
k == null || k(), k = null, y == null || y.disconnect(), y = null, window.removeEventListener("keydown", At, !0), window.removeEventListener("pointerup", U, !0), window.removeEventListener("pointercancel", U, !0), T = !1, S = !1, clearTimeout(V), h == null || h.remove(), h = null, u = null, Object.assign(c, $t);
|
|
802
816
|
}
|
|
803
|
-
function
|
|
817
|
+
function Ve(t, e) {
|
|
804
818
|
return typeof window > "u" ? () => {
|
|
805
|
-
} : (Ut(), _t(e),
|
|
806
|
-
Kt(t.service),
|
|
819
|
+
} : (Ut(), _t(e), Wt(t).state.faults.includes("offline") && Q(!1), ge(), Ke(), () => {
|
|
820
|
+
Kt(t.service), v().length || Xe();
|
|
807
821
|
});
|
|
808
822
|
}
|
|
809
|
-
function
|
|
823
|
+
function Ge(t, e) {
|
|
810
824
|
var n;
|
|
811
825
|
return ((n = Jt(e)) == null ? void 0 : n.state.faults.includes(t)) ?? !1;
|
|
812
826
|
}
|
|
813
|
-
function
|
|
827
|
+
function Ye(t) {
|
|
814
828
|
return pt(t);
|
|
815
829
|
}
|
|
816
|
-
function
|
|
830
|
+
function nn() {
|
|
817
831
|
yt();
|
|
818
832
|
}
|
|
819
|
-
const Qe = () => "2.1.
|
|
820
|
-
function
|
|
821
|
-
return
|
|
833
|
+
const Qe = () => "2.1.1";
|
|
834
|
+
function an(t) {
|
|
835
|
+
return Ve(t, { name: "urfu-ui-kit-react", version: Qe() });
|
|
822
836
|
}
|
|
823
|
-
function
|
|
824
|
-
return
|
|
837
|
+
function tn(t, e) {
|
|
838
|
+
return Rt(Ye, () => Ge(t, e), () => !1);
|
|
825
839
|
}
|
|
826
|
-
function
|
|
827
|
-
if (
|
|
840
|
+
function on({ scope: t, service: e }) {
|
|
841
|
+
if (tn(t === "app" ? "crashApp" : "crashPage", e)) throw new Error(`Сбой из dev-панели: падение ${t === "app" ? "приложения" : "страницы"}`);
|
|
828
842
|
return null;
|
|
829
843
|
}
|
|
830
844
|
export {
|
|
831
|
-
|
|
832
|
-
|
|
845
|
+
on as DevCrashProbe,
|
|
846
|
+
Ge as isDevFault,
|
|
833
847
|
de as matchPath,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
848
|
+
an as mountDevPanel,
|
|
849
|
+
nn as resetDevFaults,
|
|
850
|
+
Ye as subscribeDevFaults,
|
|
851
|
+
tn as useDevFault
|
|
838
852
|
};
|