vuesp-components 5.3.1 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +57 -0
- package/dist/components/index.es.js +2855 -2733
- package/dist/components/serial/SerialConsole.vue.d.ts.map +1 -1
- package/dist/components/serial/labels.d.ts.map +1 -1
- package/dist/components/serial/types.d.ts +7 -0
- package/dist/components/serial/types.d.ts.map +1 -1
- package/dist/composables/index.es.js +243 -236
- package/dist/composables/useSerialConsole.d.ts +16 -2
- package/dist/composables/useSerialConsole.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
import { ref as f, reactive as _, watch as
|
|
2
|
-
import { u as
|
|
3
|
-
function
|
|
4
|
-
const { validationSchema:
|
|
5
|
-
w ?
|
|
6
|
-
), F = f(!0),
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}),
|
|
12
|
-
|
|
13
|
-
}), Q(),
|
|
14
|
-
},
|
|
15
|
-
Object.keys(
|
|
16
|
-
|
|
1
|
+
import { ref as f, reactive as _, watch as G, computed as O, onMounted as Me, onBeforeUnmount as Ce } from "vue";
|
|
2
|
+
import { u as Ge, b as Je, a as We } from "../useDialog-Buvn63AR.js";
|
|
3
|
+
function He(l) {
|
|
4
|
+
const { validationSchema: u, initialValues: v = {} } = l, w = typeof u == "function", E = f(
|
|
5
|
+
w ? u(v) : u
|
|
6
|
+
), F = f(!0), D = (n) => {
|
|
7
|
+
E.value = n;
|
|
8
|
+
const s = Object.keys(n), c = Object.keys(o);
|
|
9
|
+
s.forEach((r) => {
|
|
10
|
+
r in o || (o[r] = v[r] ?? "", p[r] = [], x[r] = !1, g[r] = !1);
|
|
11
|
+
}), c.forEach((r) => {
|
|
12
|
+
s.includes(r) || (delete o[r], delete p[r], delete x[r], delete g[r]);
|
|
13
|
+
}), Q(), I();
|
|
14
|
+
}, o = _({}), p = _({}), x = _({}), g = _({}), d = /* @__PURE__ */ new Map(), C = () => {
|
|
15
|
+
Object.keys(E.value).forEach((n) => {
|
|
16
|
+
o[n] = v[n] ?? "", p[n] = [], x[n] = !1, g[n] = !1;
|
|
17
17
|
}), F.value = !0;
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
for (const
|
|
21
|
-
const
|
|
22
|
-
|
|
18
|
+
}, k = () => w ? u(o) : E.value, T = (n, s) => {
|
|
19
|
+
const r = k()[n] || [], h = [];
|
|
20
|
+
for (const m of r) {
|
|
21
|
+
const L = m(s, o);
|
|
22
|
+
L !== !0 && h.push(L);
|
|
23
23
|
}
|
|
24
24
|
return p[n] = h, h.length === 0;
|
|
25
|
-
}, K = (n,
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}),
|
|
25
|
+
}, K = (n, s) => {
|
|
26
|
+
const c = k();
|
|
27
|
+
if (!c[n]) return;
|
|
28
|
+
T(n, s);
|
|
29
|
+
const r = d.get(n);
|
|
30
|
+
r && r.forEach((h) => {
|
|
31
|
+
c[h] && T(h, o[h]);
|
|
32
|
+
}), I();
|
|
33
33
|
}, Q = () => {
|
|
34
34
|
d.clear();
|
|
35
|
-
const n =
|
|
36
|
-
Object.keys(n).forEach((
|
|
37
|
-
(n[
|
|
38
|
-
if (typeof
|
|
39
|
-
const h =
|
|
35
|
+
const n = k();
|
|
36
|
+
Object.keys(n).forEach((s) => {
|
|
37
|
+
(n[s] || []).forEach((r) => {
|
|
38
|
+
if (typeof r == "function" && r.name === "sameAs") {
|
|
39
|
+
const h = r.toString().match(/['"](.*?)['"]/);
|
|
40
40
|
if (h) {
|
|
41
|
-
const
|
|
42
|
-
d.has(
|
|
41
|
+
const m = h[1];
|
|
42
|
+
d.has(m) || d.set(m, /* @__PURE__ */ new Set()), d.get(m).add(s);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
|
-
},
|
|
48
|
-
const n =
|
|
49
|
-
let
|
|
50
|
-
return Object.keys(n).forEach((
|
|
51
|
-
|
|
52
|
-
}), F.value =
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
get: () =>
|
|
57
|
-
set: (
|
|
58
|
-
|
|
47
|
+
}, I = () => {
|
|
48
|
+
const n = k();
|
|
49
|
+
let s = !0;
|
|
50
|
+
return Object.keys(n).forEach((c) => {
|
|
51
|
+
T(c, o[c]) || (s = !1);
|
|
52
|
+
}), F.value = s, s;
|
|
53
|
+
}, j = (n, s = {}) => {
|
|
54
|
+
k()[n] || console.warn(`Field "${n}" not found in current validationSchema`);
|
|
55
|
+
const r = O({
|
|
56
|
+
get: () => o[n],
|
|
57
|
+
set: (m) => {
|
|
58
|
+
o[n] = m, g[n] = !0, K(n, m);
|
|
59
59
|
}
|
|
60
|
-
}), h =
|
|
61
|
-
var
|
|
62
|
-
const
|
|
60
|
+
}), h = O(() => {
|
|
61
|
+
var M;
|
|
62
|
+
const m = {
|
|
63
63
|
errors: p[n] || [],
|
|
64
64
|
touched: x[n] || !1,
|
|
65
65
|
dirty: g[n] || !1
|
|
66
|
-
},
|
|
67
|
-
message: (
|
|
68
|
-
onInput: (
|
|
69
|
-
const $ =
|
|
70
|
-
|
|
66
|
+
}, L = {
|
|
67
|
+
message: (M = p[n]) == null ? void 0 : M[0],
|
|
68
|
+
onInput: (A) => {
|
|
69
|
+
const $ = A.target;
|
|
70
|
+
r.value = $.value;
|
|
71
71
|
},
|
|
72
72
|
onBlur: () => {
|
|
73
|
-
x[n] = !0, K(n,
|
|
73
|
+
x[n] = !0, K(n, o[n]);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
return { ...
|
|
76
|
+
if (s.props) {
|
|
77
|
+
const A = s.props(m);
|
|
78
|
+
return { ...L, ...A };
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return L;
|
|
81
81
|
});
|
|
82
|
-
return [
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
Object.keys(
|
|
82
|
+
return [r, h];
|
|
83
|
+
}, U = (n) => async (s) => {
|
|
84
|
+
s && s.preventDefault();
|
|
85
|
+
const c = k();
|
|
86
|
+
Object.keys(c).forEach((h) => {
|
|
87
87
|
x[h] = !0;
|
|
88
|
-
}),
|
|
89
|
-
},
|
|
90
|
-
const n =
|
|
91
|
-
Object.keys(n).forEach((
|
|
92
|
-
|
|
88
|
+
}), I() && await n(o);
|
|
89
|
+
}, S = () => {
|
|
90
|
+
const n = k();
|
|
91
|
+
Object.keys(n).forEach((s) => {
|
|
92
|
+
o[s] = v[s] || "", p[s] = [], x[s] = !1, g[s] = !1;
|
|
93
93
|
}), F.value = !0;
|
|
94
94
|
};
|
|
95
|
-
return
|
|
96
|
-
() =>
|
|
95
|
+
return C(), Q(), w && G(
|
|
96
|
+
() => o,
|
|
97
97
|
() => {
|
|
98
|
-
const n =
|
|
99
|
-
(
|
|
98
|
+
const n = u(o), s = E.value, c = Object.keys(n), r = Object.keys(s);
|
|
99
|
+
(c.length !== r.length || c.some((h) => !r.includes(h))) && D(n);
|
|
100
100
|
},
|
|
101
101
|
{ deep: !0 }
|
|
102
102
|
), {
|
|
103
|
-
values:
|
|
103
|
+
values: o,
|
|
104
104
|
errors: p,
|
|
105
|
-
defineField:
|
|
106
|
-
handleSubmit:
|
|
107
|
-
resetForm:
|
|
108
|
-
validate:
|
|
109
|
-
updateSchema:
|
|
105
|
+
defineField: j,
|
|
106
|
+
handleSubmit: U,
|
|
107
|
+
resetForm: S,
|
|
108
|
+
validate: I,
|
|
109
|
+
updateSchema: D,
|
|
110
110
|
isValid: F
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const je = 150, $e = 4096, fe = 256 * 1024, he = 12, Be = 1200, _e = { utf8: "utf-8", cp1251: "windows-1251" }, Ke = {
|
|
114
114
|
encoding: "utf8",
|
|
115
115
|
framing: "line",
|
|
116
116
|
gapMs: 25,
|
|
117
117
|
paused: !1
|
|
118
|
-
},
|
|
118
|
+
}, Qe = (l, u) => (
|
|
119
119
|
// eslint-disable-next-line no-control-regex
|
|
120
|
-
new TextDecoder(
|
|
121
|
-
),
|
|
122
|
-
function
|
|
123
|
-
var
|
|
124
|
-
const
|
|
125
|
-
let
|
|
126
|
-
const
|
|
120
|
+
new TextDecoder(_e[u]).decode(l).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, ".")
|
|
121
|
+
), Ve = (l) => Array.from(l, (u) => u.toString(16).padStart(2, "0")).join(" ");
|
|
122
|
+
function Pe(l) {
|
|
123
|
+
var ue, ie;
|
|
124
|
+
const u = f([]), v = _({ ...Ke }), w = f(0), E = f(0), F = f(0), D = f(0), o = f(""), p = f(!1), x = f(((ue = l.initialLineEnding) == null ? void 0 : ue.call(l)) ?? "crlf"), g = f([]), d = f(-1), C = f(""), k = f("text"), T = f(null), K = f(!0), Q = f(!0), I = f(!0), j = f(!1), U = f(!1), S = f([]), n = f("");
|
|
125
|
+
let s = 0, c = [], r = [], h = null, m = null, L = null, M = "", A = null, $ = 0, H = 0, V = 0, R = null;
|
|
126
|
+
const J = (e) => {
|
|
127
127
|
var a;
|
|
128
|
-
const t = (a =
|
|
128
|
+
const t = (a = l.storageKey) == null ? void 0 : a.call(l);
|
|
129
129
|
return t ? `${t}:${e}` : null;
|
|
130
|
-
},
|
|
131
|
-
const t =
|
|
130
|
+
}, W = (e) => {
|
|
131
|
+
const t = J(e);
|
|
132
132
|
if (!t || typeof localStorage > "u") return null;
|
|
133
133
|
try {
|
|
134
134
|
const a = localStorage.getItem(t);
|
|
@@ -136,214 +136,221 @@ function Qe(c) {
|
|
|
136
136
|
} catch {
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
},
|
|
140
|
-
const a =
|
|
139
|
+
}, P = (e, t) => {
|
|
140
|
+
const a = J(e);
|
|
141
141
|
if (!(!a || typeof localStorage > "u"))
|
|
142
142
|
try {
|
|
143
143
|
localStorage.setItem(a, JSON.stringify(t));
|
|
144
144
|
} catch {
|
|
145
145
|
}
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const a =
|
|
152
|
-
|
|
153
|
-
id: ++
|
|
146
|
+
}, Y = W("view");
|
|
147
|
+
Y && Object.assign(v, Y, { paused: !1 }), v.paused = !1;
|
|
148
|
+
const de = W("quick"), ve = ((ie = l.initialQuickCommands) == null ? void 0 : ie.call(l)) ?? [];
|
|
149
|
+
S.value = (de ?? ve).filter((e) => typeof e == "string").slice(0, he), G(v, () => P("view", { ...v, paused: !1 }), { deep: !0 });
|
|
150
|
+
const X = (e, t) => {
|
|
151
|
+
const a = Qe(t, v.encoding);
|
|
152
|
+
u.value.push({
|
|
153
|
+
id: ++s,
|
|
154
154
|
dir: e,
|
|
155
|
-
at: (/* @__PURE__ */ new Date()).toLocaleTimeString(
|
|
155
|
+
at: (/* @__PURE__ */ new Date()).toLocaleTimeString(l.locale() === "ru" ? "ru-RU" : "en-GB", { hour12: !1 }),
|
|
156
156
|
text: v.framing === "gap" ? a.replace(/[\r\n]+/g, " ") : a,
|
|
157
|
-
hex:
|
|
158
|
-
bytes: t.length
|
|
157
|
+
hex: Ve(t),
|
|
158
|
+
bytes: t.length,
|
|
159
|
+
// Keep a bounded copy for the binary view and byte inspector.
|
|
160
|
+
data: Array.from(t.slice(0, 1024))
|
|
159
161
|
});
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
+
const i = l.maxLines();
|
|
163
|
+
u.value.length > i && u.value.splice(0, u.value.length - i);
|
|
162
164
|
}, q = () => {
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
if (q(), !
|
|
166
|
-
const e = new Uint8Array(
|
|
167
|
-
|
|
168
|
-
},
|
|
165
|
+
h && (clearTimeout(h), h = null);
|
|
166
|
+
}, Z = () => {
|
|
167
|
+
if (q(), !c.length) return;
|
|
168
|
+
const e = new Uint8Array(c);
|
|
169
|
+
c = [], X("rx", e);
|
|
170
|
+
}, ge = () => {
|
|
169
171
|
q();
|
|
170
|
-
const e = v.framing === "gap" ? Math.max(5, v.gapMs) :
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
for (const t of e)
|
|
172
|
+
const e = v.framing === "gap" ? Math.max(5, v.gapMs) : je;
|
|
173
|
+
h = setTimeout(Z, e);
|
|
174
|
+
}, N = (e) => {
|
|
175
|
+
for (const t of e) c.push(t);
|
|
174
176
|
if (v.framing === "line") {
|
|
175
177
|
let t = 0;
|
|
176
|
-
for (let a = 0; a <
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
|
|
178
|
+
for (let a = 0; a < c.length; a++) {
|
|
179
|
+
const i = c[a];
|
|
180
|
+
if (i !== 10 && i !== 13) continue;
|
|
181
|
+
const y = c.slice(t, a);
|
|
182
|
+
y.length && X("rx", new Uint8Array(y)), i === 13 && c[a + 1] === 10 && a++, t = a + 1;
|
|
181
183
|
}
|
|
182
|
-
t && (
|
|
184
|
+
t && (c = c.slice(t));
|
|
183
185
|
}
|
|
184
|
-
|
|
186
|
+
c.length >= $e ? Z() : ge();
|
|
185
187
|
}, B = () => {
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
+
L && clearTimeout(L), L = null, U.value = !1;
|
|
189
|
+
}, ye = (e) => {
|
|
188
190
|
var a;
|
|
189
|
-
const t = (a =
|
|
190
|
-
t && (B(),
|
|
191
|
-
w.value === e && (
|
|
191
|
+
const t = (a = l.noReplyHint) == null ? void 0 : a.call(l);
|
|
192
|
+
t && (B(), L = setTimeout(() => {
|
|
193
|
+
w.value === e && (U.value = !0);
|
|
192
194
|
}, t.delay ?? 1500));
|
|
193
|
-
},
|
|
195
|
+
}, me = (e) => {
|
|
194
196
|
if (e != null && e.length) {
|
|
195
|
-
if (
|
|
196
|
-
for (const t of e)
|
|
197
|
-
|
|
197
|
+
if (U.value && B(), w.value += e.length, v.paused) {
|
|
198
|
+
for (const t of e) r.push(t);
|
|
199
|
+
r.length > fe && r.splice(0, r.length - fe);
|
|
198
200
|
return;
|
|
199
201
|
}
|
|
200
|
-
|
|
202
|
+
N(e);
|
|
201
203
|
}
|
|
202
|
-
},
|
|
203
|
-
R == null || R(), R =
|
|
204
|
+
}, pe = () => {
|
|
205
|
+
R == null || R(), R = l.transport().subscribe(me);
|
|
204
206
|
};
|
|
205
|
-
|
|
207
|
+
G(
|
|
206
208
|
() => v.paused,
|
|
207
209
|
(e) => {
|
|
208
|
-
if (e || !
|
|
209
|
-
const t = new Uint8Array(
|
|
210
|
-
|
|
210
|
+
if (e || !r.length) return;
|
|
211
|
+
const t = new Uint8Array(r);
|
|
212
|
+
r = [], N(t);
|
|
211
213
|
}
|
|
212
214
|
);
|
|
213
|
-
const
|
|
214
|
-
const t = await
|
|
215
|
-
return t && (
|
|
216
|
-
},
|
|
217
|
-
const e =
|
|
215
|
+
const ee = async (e) => {
|
|
216
|
+
const t = await l.transport().send(e);
|
|
217
|
+
return t && (E.value += e.length, X("tx", e)), t;
|
|
218
|
+
}, z = O(() => o.value.replace(/^0x/i, "").replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "")), xe = O(() => {
|
|
219
|
+
const e = o.value.replace(/0x/gi, "").replace(/[\s,;:]/g, "");
|
|
218
220
|
return e.length > 0 && /[^0-9a-fA-F]/.test(e);
|
|
219
|
-
}),
|
|
220
|
-
const e =
|
|
221
|
+
}), te = O(() => {
|
|
222
|
+
const e = z.value, t = [];
|
|
221
223
|
for (let a = 0; a + 1 < e.length; a += 2) t.push(parseInt(e.slice(a, a + 2), 16));
|
|
222
224
|
return t;
|
|
223
|
-
}),
|
|
225
|
+
}), ne = O(() => p.value ? xe.value ? l.labels().hexInvalid : z.value && z.value.length % 2 ? l.labels().hexOdd : "" : ""), ae = (e, t) => {
|
|
224
226
|
if (t) {
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
const
|
|
228
|
-
for (let
|
|
229
|
-
return
|
|
227
|
+
const i = e.replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "");
|
|
228
|
+
if (!i.length || i.length % 2) return [];
|
|
229
|
+
const y = [];
|
|
230
|
+
for (let b = 0; b + 1 < i.length; b += 2) y.push(parseInt(i.slice(b, b + 2), 16));
|
|
231
|
+
return y;
|
|
230
232
|
}
|
|
231
233
|
const a = Array.from(new TextEncoder().encode(e));
|
|
232
234
|
return (x.value === "cr" || x.value === "crlf") && a.push(13), (x.value === "lf" || x.value === "crlf") && a.push(10), a;
|
|
233
|
-
},
|
|
234
|
-
if (p.value && (
|
|
235
|
-
const e =
|
|
236
|
-
!t.length || !await
|
|
235
|
+
}, we = async () => {
|
|
236
|
+
if (p.value && (ne.value || !te.value.length)) return;
|
|
237
|
+
const e = o.value, t = ae(e, p.value);
|
|
238
|
+
!t.length || !await ee(new Uint8Array(t.slice(0, 4096))) || (e.trim() && (g.value = [e, ...g.value.filter((i) => i !== e)].slice(0, 50), d.value = -1), o.value = "");
|
|
237
239
|
}, re = async (e) => {
|
|
238
|
-
const t =
|
|
240
|
+
const t = ae(e, !1);
|
|
239
241
|
if (!t.length) return;
|
|
240
242
|
const a = w.value;
|
|
241
|
-
await
|
|
242
|
-
},
|
|
243
|
+
await ee(new Uint8Array(t.slice(0, 4096))) && (g.value = [e, ...g.value.filter((y) => y !== e)].slice(0, 50), d.value = -1, M = e, ye(a));
|
|
244
|
+
}, ke = async () => {
|
|
243
245
|
var t;
|
|
244
|
-
const e = (t =
|
|
245
|
-
e != null && e.onAction && (B(), await e.onAction(), (e.resend ?? !0) &&
|
|
246
|
-
},
|
|
246
|
+
const e = (t = l.noReplyHint) == null ? void 0 : t.call(l);
|
|
247
|
+
e != null && e.onAction && (B(), await e.onAction(), (e.resend ?? !0) && M && await re(M));
|
|
248
|
+
}, Se = (e) => {
|
|
247
249
|
if (e.key === "ArrowUp") {
|
|
248
250
|
if (!g.value.length) return;
|
|
249
|
-
e.preventDefault(), d.value = d.value === -1 ? g.value.length - 1 : Math.max(0, d.value - 1),
|
|
251
|
+
e.preventDefault(), d.value = d.value === -1 ? g.value.length - 1 : Math.max(0, d.value - 1), o.value = g.value[d.value] ?? "";
|
|
250
252
|
return;
|
|
251
253
|
}
|
|
252
254
|
if (e.key === "ArrowDown") {
|
|
253
255
|
if (d.value === -1) return;
|
|
254
|
-
e.preventDefault(), d.value++, d.value >= g.value.length ? (d.value = -1,
|
|
256
|
+
e.preventDefault(), d.value++, d.value >= g.value.length ? (d.value = -1, o.value = "") : o.value = g.value[d.value] ?? "";
|
|
255
257
|
return;
|
|
256
258
|
}
|
|
257
|
-
e.key === "Escape" && (
|
|
258
|
-
},
|
|
259
|
-
const e =
|
|
260
|
-
return e ?
|
|
261
|
-
}),
|
|
262
|
-
|
|
259
|
+
e.key === "Escape" && (o.value = "", d.value = -1);
|
|
260
|
+
}, be = O(() => {
|
|
261
|
+
const e = C.value.trim().toLowerCase();
|
|
262
|
+
return e ? u.value.filter((t) => t.text.toLowerCase().includes(e) || t.hex.toLowerCase().includes(e)) : u.value;
|
|
263
|
+
}), Ee = (e) => (e.data ?? []).map((t) => t.toString(2).padStart(8, "0")).join(" "), Le = (e) => k.value === "hex" ? e.hex : k.value === "bin" ? Ee(e) : e.text || e.hex, Te = O(() => u.value.find((e) => e.id === T.value) ?? null), Ae = (e) => {
|
|
264
|
+
T.value = T.value === e.id ? null : e.id;
|
|
265
|
+
}, Fe = (e) => {
|
|
266
|
+
const t = C.value.trim().toLowerCase();
|
|
263
267
|
if (!t) return [{ text: e, match: !1 }];
|
|
264
|
-
const a = e.toLowerCase(),
|
|
265
|
-
let
|
|
266
|
-
for (;
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
|
|
268
|
+
const a = e.toLowerCase(), i = [];
|
|
269
|
+
let y = 0;
|
|
270
|
+
for (; y < e.length; ) {
|
|
271
|
+
const b = a.indexOf(t, y);
|
|
272
|
+
if (b === -1) break;
|
|
273
|
+
b > y && i.push({ text: e.slice(y, b), match: !1 }), i.push({ text: e.slice(b, b + t.length), match: !0 }), y = b + t.length;
|
|
270
274
|
}
|
|
271
|
-
return
|
|
272
|
-
},
|
|
273
|
-
`),
|
|
274
|
-
if (!
|
|
275
|
+
return y < e.length && i.push({ text: e.slice(y), match: !1 }), i.length ? i : [{ text: e, match: !1 }];
|
|
276
|
+
}, se = () => u.value.map((e) => `${e.at} ${e.dir.toUpperCase()} ${e.text || e.hex}`).join(`
|
|
277
|
+
`), le = async () => {
|
|
278
|
+
if (!u.value.length) return !1;
|
|
275
279
|
try {
|
|
276
|
-
return await navigator.clipboard.writeText(
|
|
277
|
-
|
|
278
|
-
},
|
|
280
|
+
return await navigator.clipboard.writeText(se()), j.value = !0, A && clearTimeout(A), A = setTimeout(() => {
|
|
281
|
+
j.value = !1;
|
|
282
|
+
}, Be), !0;
|
|
279
283
|
} catch {
|
|
280
284
|
return !1;
|
|
281
285
|
}
|
|
282
|
-
},
|
|
283
|
-
if (!
|
|
284
|
-
const e = new Blob([
|
|
285
|
-
return a.href = t, a.download = `serial-${
|
|
286
|
+
}, Re = () => {
|
|
287
|
+
if (!u.value.length) return !1;
|
|
288
|
+
const e = new Blob([se()], { type: "text/plain;charset=utf-8" }), t = URL.createObjectURL(e), a = document.createElement("a"), i = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
289
|
+
return a.href = t, a.download = `serial-${i}.log`, a.click(), URL.revokeObjectURL(t), !0;
|
|
286
290
|
}, ce = () => {
|
|
287
|
-
B(), q(),
|
|
288
|
-
},
|
|
289
|
-
const t =
|
|
291
|
+
B(), q(), c = [], r = [], u.value = [], T.value = null, w.value = 0, E.value = 0, F.value = 0, D.value = 0, $ = 0, H = 0, V = performance.now();
|
|
292
|
+
}, Oe = (e) => {
|
|
293
|
+
const t = l.labels();
|
|
290
294
|
return e < 1024 ? `${e} ${t.byteShort}` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} ${t.kiloShort}` : `${(e / (1024 * 1024)).toFixed(2)} ${t.megaShort}`;
|
|
291
|
-
},
|
|
295
|
+
}, De = () => {
|
|
292
296
|
const e = performance.now(), t = (e - V) / 1e3;
|
|
293
|
-
t <= 0 || (F.value = Math.max(0, Math.round((w.value -
|
|
294
|
-
},
|
|
295
|
-
const e =
|
|
296
|
-
e && (
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
},
|
|
300
|
-
e.ctrlKey && (e.key.toLowerCase() === "l" && (e.preventDefault(), ce()), e.shiftKey && e.key.toLowerCase() === "c" && (e.preventDefault(),
|
|
297
|
+
t <= 0 || (F.value = Math.max(0, Math.round((w.value - $) / t)), D.value = Math.max(0, Math.round((E.value - H) / t)), $ = w.value, H = E.value, V = e);
|
|
298
|
+
}, Ie = () => {
|
|
299
|
+
const e = n.value.trim();
|
|
300
|
+
e && (S.value.includes(e) || (S.value = [...S.value, e].slice(0, he)), n.value = "", P("quick", S.value));
|
|
301
|
+
}, Ue = (e) => {
|
|
302
|
+
S.value = S.value.filter((t) => t !== e), P("quick", S.value);
|
|
303
|
+
}, oe = (e) => {
|
|
304
|
+
e.ctrlKey && (e.key.toLowerCase() === "l" && (e.preventDefault(), ce()), e.shiftKey && e.key.toLowerCase() === "c" && (e.preventDefault(), le()));
|
|
301
305
|
};
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
}),
|
|
305
|
-
R == null || R(), R = null, B(), q(),
|
|
306
|
+
return Me(() => {
|
|
307
|
+
pe(), V = performance.now(), m = setInterval(De, 1e3), window.addEventListener("keydown", oe);
|
|
308
|
+
}), Ce(() => {
|
|
309
|
+
R == null || R(), R = null, B(), q(), m && clearInterval(m), A && clearTimeout(A), window.removeEventListener("keydown", oe);
|
|
306
310
|
}), {
|
|
307
|
-
lines:
|
|
308
|
-
visibleLines:
|
|
311
|
+
lines: u,
|
|
312
|
+
visibleLines: be,
|
|
309
313
|
view: v,
|
|
310
314
|
rxBytes: w,
|
|
311
|
-
txBytes:
|
|
315
|
+
txBytes: E,
|
|
312
316
|
rxRate: F,
|
|
313
|
-
txRate:
|
|
314
|
-
input:
|
|
317
|
+
txRate: D,
|
|
318
|
+
input: o,
|
|
315
319
|
hexSend: p,
|
|
316
320
|
lineEnding: x,
|
|
317
321
|
history: g,
|
|
318
|
-
filter:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
322
|
+
filter: C,
|
|
323
|
+
mode: k,
|
|
324
|
+
selectedId: T,
|
|
325
|
+
selectedLine: Te,
|
|
326
|
+
selectLine: Ae,
|
|
327
|
+
showTime: K,
|
|
328
|
+
wrapLines: Q,
|
|
329
|
+
autoScroll: I,
|
|
330
|
+
copied: j,
|
|
331
|
+
showNoReply: U,
|
|
332
|
+
quickCommands: S,
|
|
333
|
+
quickInput: n,
|
|
334
|
+
hexBytes: te,
|
|
335
|
+
hexError: ne,
|
|
336
|
+
sendText: we,
|
|
330
337
|
sendQuick: re,
|
|
331
|
-
onInputKeydown:
|
|
332
|
-
lineContent:
|
|
333
|
-
lineSegments:
|
|
334
|
-
copyLog:
|
|
335
|
-
downloadLog:
|
|
338
|
+
onInputKeydown: Se,
|
|
339
|
+
lineContent: Le,
|
|
340
|
+
lineSegments: Fe,
|
|
341
|
+
copyLog: le,
|
|
342
|
+
downloadLog: Re,
|
|
336
343
|
clearLog: ce,
|
|
337
|
-
formatBytes:
|
|
338
|
-
addQuick:
|
|
339
|
-
removeQuick:
|
|
340
|
-
applyHintAction:
|
|
344
|
+
formatBytes: Oe,
|
|
345
|
+
addQuick: Ie,
|
|
346
|
+
removeQuick: Ue,
|
|
347
|
+
applyHintAction: ke
|
|
341
348
|
};
|
|
342
349
|
}
|
|
343
350
|
export {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
Ge as useDialog,
|
|
352
|
+
Je as useFocusTrap,
|
|
353
|
+
He as useForm,
|
|
354
|
+
Pe as useSerialConsole,
|
|
355
|
+
We as useSwipeDown
|
|
349
356
|
};
|