vuesp-components 5.5.0 → 6.0.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +13 -0
  3. package/dist/{VDialog.vue_vue_type_script_setup_true_lang-IsyzXM12.js → VDialog.vue_vue_type_script_setup_true_lang-Eo7yIqxr.js} +1 -1
  4. package/dist/components/index.d.ts +1 -0
  5. package/dist/components/index.d.ts.map +1 -1
  6. package/dist/components/index.es.js +5221 -3328
  7. package/dist/components/modbus/ModbusConnectionCard.vue.d.ts +37 -0
  8. package/dist/components/modbus/ModbusConnectionCard.vue.d.ts.map +1 -0
  9. package/dist/components/modbus/ModbusDeleteDialog.vue.d.ts +10 -0
  10. package/dist/components/modbus/ModbusDeleteDialog.vue.d.ts.map +1 -0
  11. package/dist/components/modbus/ModbusDeviceDialog.vue.d.ts +16 -0
  12. package/dist/components/modbus/ModbusDeviceDialog.vue.d.ts.map +1 -0
  13. package/dist/components/modbus/ModbusDeviceList.vue.d.ts +12 -0
  14. package/dist/components/modbus/ModbusDeviceList.vue.d.ts.map +1 -0
  15. package/dist/components/modbus/ModbusMapDetails.vue.d.ts +12 -0
  16. package/dist/components/modbus/ModbusMapDetails.vue.d.ts.map +1 -0
  17. package/dist/components/modbus/ModbusMapTable.vue.d.ts +10 -0
  18. package/dist/components/modbus/ModbusMapTable.vue.d.ts.map +1 -0
  19. package/dist/components/modbus/ModbusPointDialog.vue.d.ts +28 -0
  20. package/dist/components/modbus/ModbusPointDialog.vue.d.ts.map +1 -0
  21. package/dist/components/modbus/ModbusPointList.vue.d.ts +16 -0
  22. package/dist/components/modbus/ModbusPointList.vue.d.ts.map +1 -0
  23. package/dist/components/modbus/ModbusProfileToolbar.vue.d.ts +16 -0
  24. package/dist/components/modbus/ModbusProfileToolbar.vue.d.ts.map +1 -0
  25. package/dist/components/modbus/ModbusSlaveDialog.vue.d.ts +22 -0
  26. package/dist/components/modbus/ModbusSlaveDialog.vue.d.ts.map +1 -0
  27. package/dist/components/modbus/ModbusSlaveValueList.vue.d.ts +12 -0
  28. package/dist/components/modbus/ModbusSlaveValueList.vue.d.ts.map +1 -0
  29. package/dist/components/modbus/ModbusVarDialog.vue.d.ts +18 -0
  30. package/dist/components/modbus/ModbusVarDialog.vue.d.ts.map +1 -0
  31. package/dist/components/modbus/ModbusVarList.vue.d.ts +12 -0
  32. package/dist/components/modbus/ModbusVarList.vue.d.ts.map +1 -0
  33. package/dist/components/modbus/index.d.ts +16 -0
  34. package/dist/components/modbus/index.d.ts.map +1 -0
  35. package/dist/components/modbus/modbusMapTypes.d.ts +31 -0
  36. package/dist/components/modbus/modbusMapTypes.d.ts.map +1 -0
  37. package/dist/components/modbus/types.d.ts +310 -0
  38. package/dist/components/modbus/types.d.ts.map +1 -0
  39. package/dist/components/script/ScriptDeleteDialog.vue.d.ts +10 -0
  40. package/dist/components/script/ScriptDeleteDialog.vue.d.ts.map +1 -0
  41. package/dist/components/script/ScriptDetailsDialog.vue.d.ts +8 -0
  42. package/dist/components/script/ScriptDetailsDialog.vue.d.ts.map +1 -0
  43. package/dist/components/script/ScriptDiscardDialog.vue.d.ts +11 -0
  44. package/dist/components/script/ScriptDiscardDialog.vue.d.ts.map +1 -0
  45. package/dist/components/script/ScriptRenameDialog.vue.d.ts +10 -0
  46. package/dist/components/script/ScriptRenameDialog.vue.d.ts.map +1 -0
  47. package/dist/components/script/ScriptStudioActionBar.vue.d.ts +10 -0
  48. package/dist/components/script/ScriptStudioActionBar.vue.d.ts.map +1 -0
  49. package/dist/components/script/ScriptStudioLogs.vue.d.ts +15 -0
  50. package/dist/components/script/ScriptStudioLogs.vue.d.ts.map +1 -0
  51. package/dist/components/script/ScriptStudioMetrics.vue.d.ts +19 -0
  52. package/dist/components/script/ScriptStudioMetrics.vue.d.ts.map +1 -0
  53. package/dist/components/script/ScriptStudioTabs.vue.d.ts +18 -0
  54. package/dist/components/script/ScriptStudioTabs.vue.d.ts.map +1 -0
  55. package/dist/components/script/ScriptStudioToolbar.vue.d.ts +35 -0
  56. package/dist/components/script/ScriptStudioToolbar.vue.d.ts.map +1 -0
  57. package/dist/components/script/editor/suggestions.d.ts +1 -1
  58. package/dist/components/script/editor/suggestions.d.ts.map +1 -1
  59. package/dist/components/script/helpers.d.ts +28 -0
  60. package/dist/components/script/helpers.d.ts.map +1 -0
  61. package/dist/components/script/index.d.ts +11 -5
  62. package/dist/components/script/index.d.ts.map +1 -1
  63. package/dist/components/script/types.d.ts +112 -3
  64. package/dist/components/script/types.d.ts.map +1 -1
  65. package/dist/composables/index.d.ts +2 -0
  66. package/dist/composables/index.d.ts.map +1 -1
  67. package/dist/composables/index.es.js +101 -512
  68. package/dist/composables/useI18n.d.ts +3 -0
  69. package/dist/composables/useI18n.d.ts.map +1 -0
  70. package/dist/composables/useScriptStudioLogs.d.ts +30 -0
  71. package/dist/composables/useScriptStudioLogs.d.ts.map +1 -0
  72. package/dist/composables/useSerialConsole.d.ts +1 -1
  73. package/dist/helpers/index.d.ts +0 -1
  74. package/dist/helpers/index.d.ts.map +1 -1
  75. package/dist/helpers/index.es.js +60 -77
  76. package/dist/index.es.js +1 -1
  77. package/dist/pages/kit/KitShowcase.vue.d.ts.map +1 -1
  78. package/dist/style.css +1 -1
  79. package/dist/types/index.d.ts +1 -0
  80. package/dist/types/index.d.ts.map +1 -1
  81. package/dist/{useDialog-Buvn63AR.js → useDialog-XDF9alzt.js} +2 -2
  82. package/dist/useSerialConsole-DaedwQe_.js +564 -0
  83. package/package.json +1 -1
  84. package/dist/app-3Zj29UoC.js +0 -64
  85. package/dist/components/script/dialog/ScriptDialog.vue.d.ts +0 -10
  86. package/dist/components/script/dialog/ScriptDialog.vue.d.ts.map +0 -1
  87. package/dist/components/script/dialog/types.d.ts +0 -8
  88. package/dist/components/script/dialog/types.d.ts.map +0 -1
  89. package/dist/components/script/editor/ScriptEditor.vue.d.ts +0 -10
  90. package/dist/components/script/editor/ScriptEditor.vue.d.ts.map +0 -1
  91. package/dist/components/script/editor/format.d.ts +0 -3
  92. package/dist/components/script/editor/format.d.ts.map +0 -1
  93. package/dist/components/script/editor/highlighters/index.d.ts +0 -3
  94. package/dist/components/script/editor/highlighters/index.d.ts.map +0 -1
  95. package/dist/components/script/editor/plugins/autoSemicolon.d.ts +0 -3
  96. package/dist/components/script/editor/plugins/autoSemicolon.d.ts.map +0 -1
  97. package/dist/components/script/editor/plugins/autocomplete.d.ts +0 -4
  98. package/dist/components/script/editor/plugins/autocomplete.d.ts.map +0 -1
  99. package/dist/components/script/editor/plugins/index.d.ts +0 -3
  100. package/dist/components/script/editor/plugins/index.d.ts.map +0 -1
  101. package/dist/components/script/editor/plugins/render/index.d.ts +0 -7
  102. package/dist/components/script/editor/plugins/render/index.d.ts.map +0 -1
  103. package/dist/components/script/editor/plugins/types.d.ts +0 -24
  104. package/dist/components/script/editor/plugins/types.d.ts.map +0 -1
  105. package/dist/components/script/editor/types.d.ts +0 -10
  106. package/dist/components/script/editor/types.d.ts.map +0 -1
  107. package/dist/components/script/viewDocs/ScriptViewDocs.vue.d.ts +0 -13
  108. package/dist/components/script/viewDocs/ScriptViewDocs.vue.d.ts.map +0 -1
  109. package/dist/components/script/viewDocs/types.d.ts +0 -4
  110. package/dist/components/script/viewDocs/types.d.ts.map +0 -1
@@ -1,533 +1,122 @@
1
- import { ref as l, reactive as G, watch as oe, computed as U, onMounted as kt, onBeforeUnmount as bt } from "vue";
2
- import { u as Mt, b as $t, a as Ct } from "../useDialog-Buvn63AR.js";
3
- function It(c) {
4
- const { validationSchema: i, initialValues: y = {} } = c, p = typeof i == "function", m = l(
5
- p ? i(y) : i
6
- ), L = l(!0), C = (s) => {
7
- m.value = s;
8
- const u = Object.keys(s), h = Object.keys(f);
9
- u.forEach((a) => {
10
- a in f || (f[a] = y[a] ?? "", g[a] = [], E[a] = !1, k[a] = !1);
11
- }), h.forEach((a) => {
12
- u.includes(a) || (delete f[a], delete g[a], delete E[a], delete k[a]);
13
- }), W(), R();
14
- }, f = G({}), g = G({}), E = G({}), k = G({}), O = /* @__PURE__ */ new Map(), q = () => {
15
- Object.keys(m.value).forEach((s) => {
16
- f[s] = y[s] ?? "", g[s] = [], E[s] = !1, k[s] = !1;
17
- }), L.value = !0;
18
- }, b = () => p ? i(f) : m.value, _ = (s, u) => {
19
- const a = b()[s] || [], v = [];
20
- for (const w of a) {
21
- const $ = w(u, f);
22
- $ !== !0 && v.push($);
1
+ import { ref as w, reactive as S, watch as K, computed as D } from "vue";
2
+ import { u as P, a as T, b as W } from "../useDialog-XDF9alzt.js";
3
+ import { u as q, a as G, b as H } from "../useSerialConsole-DaedwQe_.js";
4
+ function B(V) {
5
+ const { validationSchema: l, initialValues: v = {} } = V, b = typeof l == "function", m = w(
6
+ b ? l(v) : l
7
+ ), y = w(!0), E = (t) => {
8
+ m.value = t;
9
+ const e = Object.keys(t), n = Object.keys(c);
10
+ e.forEach((s) => {
11
+ s in c || (c[s] = v[s] ?? "", r[s] = [], u[s] = !1, h[s] = !1);
12
+ }), n.forEach((s) => {
13
+ e.includes(s) || (delete c[s], delete r[s], delete u[s], delete h[s]);
14
+ }), j(), d();
15
+ }, c = S({}), r = S({}), u = S({}), h = S({}), p = /* @__PURE__ */ new Map(), x = () => {
16
+ Object.keys(m.value).forEach((t) => {
17
+ c[t] = v[t] ?? "", r[t] = [], u[t] = !1, h[t] = !1;
18
+ }), y.value = !0;
19
+ }, i = () => b ? l(c) : m.value, g = (t, e) => {
20
+ const s = i()[t] || [], o = [];
21
+ for (const a of s) {
22
+ const f = a(e, c);
23
+ f !== !0 && o.push(f);
23
24
  }
24
- return g[s] = v, v.length === 0;
25
- }, T = (s, u) => {
26
- const h = b();
27
- if (!h[s]) return;
28
- _(s, u);
29
- const a = O.get(s);
30
- a && a.forEach((v) => {
31
- h[v] && _(v, f[v]);
32
- }), R();
33
- }, W = () => {
34
- O.clear();
35
- const s = b();
36
- Object.keys(s).forEach((u) => {
37
- (s[u] || []).forEach((a) => {
38
- if (typeof a == "function" && a.name === "sameAs") {
39
- const v = a.toString().match(/['"](.*?)['"]/);
40
- if (v) {
41
- const w = v[1];
42
- O.has(w) || O.set(w, /* @__PURE__ */ new Set()), O.get(w).add(u);
25
+ return r[t] = o, o.length === 0;
26
+ }, O = (t, e) => {
27
+ const n = i();
28
+ if (!n[t]) return;
29
+ g(t, e);
30
+ const s = p.get(t);
31
+ s && s.forEach((o) => {
32
+ n[o] && g(o, c[o]);
33
+ }), d();
34
+ }, j = () => {
35
+ p.clear();
36
+ const t = i();
37
+ Object.keys(t).forEach((e) => {
38
+ (t[e] || []).forEach((s) => {
39
+ if (typeof s == "function" && s.name === "sameAs") {
40
+ const o = s.toString().match(/['"](.*?)['"]/);
41
+ if (o) {
42
+ const a = o[1];
43
+ p.has(a) || p.set(a, /* @__PURE__ */ new Set()), p.get(a).add(e);
43
44
  }
44
45
  }
45
46
  });
46
47
  });
47
- }, R = () => {
48
- const s = b();
49
- let u = !0;
50
- return Object.keys(s).forEach((h) => {
51
- _(h, f[h]) || (u = !1);
52
- }), L.value = u, u;
53
- }, j = (s, u = {}) => {
54
- b()[s] || console.warn(`Field "${s}" not found in current validationSchema`);
55
- const a = U({
56
- get: () => f[s],
57
- set: (w) => {
58
- f[s] = w, k[s] = !0, T(s, w);
48
+ }, d = () => {
49
+ const t = i();
50
+ let e = !0;
51
+ return Object.keys(t).forEach((n) => {
52
+ g(n, c[n]) || (e = !1);
53
+ }), y.value = e, e;
54
+ }, R = (t, e = {}) => {
55
+ i()[t] || console.warn(`Field "${t}" not found in current validationSchema`);
56
+ const s = D({
57
+ get: () => c[t],
58
+ set: (a) => {
59
+ c[t] = a, h[t] = !0, O(t, a);
59
60
  }
60
- }), v = U(() => {
61
- var P;
62
- const w = {
63
- errors: g[s] || [],
64
- touched: E[s] || !1,
65
- dirty: k[s] || !1
66
- }, $ = {
67
- message: (P = g[s]) == null ? void 0 : P[0],
68
- onInput: (A) => {
69
- const Q = A.target;
70
- a.value = Q.value;
61
+ }), o = D(() => {
62
+ var k;
63
+ const a = {
64
+ errors: r[t] || [],
65
+ touched: u[t] || !1,
66
+ dirty: h[t] || !1
67
+ }, f = {
68
+ message: (k = r[t]) == null ? void 0 : k[0],
69
+ onInput: (F) => {
70
+ const I = F.target;
71
+ s.value = I.value;
71
72
  },
72
73
  onBlur: () => {
73
- E[s] = !0, T(s, f[s]);
74
+ u[t] = !0, O(t, c[t]);
74
75
  }
75
76
  };
76
- if (u.props) {
77
- const A = u.props(w);
78
- return { ...$, ...A };
77
+ if (e.props) {
78
+ const F = e.props(a);
79
+ return { ...f, ...F };
79
80
  }
80
- return $;
81
+ return f;
81
82
  });
82
- return [a, v];
83
- }, M = (s) => async (u) => {
84
- u && u.preventDefault();
85
- const h = b();
86
- Object.keys(h).forEach((v) => {
87
- E[v] = !0;
88
- }), R() && await s(f);
89
- }, x = () => {
90
- const s = b();
91
- Object.keys(s).forEach((u) => {
92
- f[u] = y[u] || "", g[u] = [], E[u] = !1, k[u] = !1;
93
- }), L.value = !0;
83
+ return [s, o];
84
+ }, A = (t) => async (e) => {
85
+ e && e.preventDefault();
86
+ const n = i();
87
+ Object.keys(n).forEach((o) => {
88
+ u[o] = !0;
89
+ }), d() && await t(c);
90
+ }, C = () => {
91
+ const t = i();
92
+ Object.keys(t).forEach((e) => {
93
+ c[e] = v[e] || "", r[e] = [], u[e] = !1, h[e] = !1;
94
+ }), y.value = !0;
94
95
  };
95
- return q(), W(), p && oe(
96
- () => f,
96
+ return x(), j(), b && K(
97
+ () => c,
97
98
  () => {
98
- const s = i(f), u = m.value, h = Object.keys(s), a = Object.keys(u);
99
- (h.length !== a.length || h.some((v) => !a.includes(v))) && C(s);
99
+ const t = l(c), e = m.value, n = Object.keys(t), s = Object.keys(e);
100
+ (n.length !== s.length || n.some((o) => !s.includes(o))) && E(t);
100
101
  },
101
102
  { deep: !0 }
102
103
  ), {
103
- values: f,
104
- errors: g,
105
- defineField: j,
106
- handleSubmit: M,
107
- resetForm: x,
108
- validate: R,
109
- updateSchema: C,
110
- isValid: L
111
- };
112
- }
113
- const Et = 150, Tt = 4096, $e = 256 * 1024, Ce = 12, Rt = 1200, Bt = { utf8: "utf-8", cp1251: "windows-1251" }, Lt = {
114
- encoding: "utf8",
115
- framing: "line",
116
- gapMs: 25,
117
- paused: !1
118
- }, Ot = (c, i) => (
119
- // eslint-disable-next-line no-control-regex
120
- new TextDecoder(Bt[i]).decode(c).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, ".")
121
- ), At = (c) => Array.from(c, (i) => i.toString(16).padStart(2, "0")).join(" ");
122
- function Ft(c) {
123
- var Fe, Ue;
124
- const i = l([]), y = G({ ...Lt }), p = l(0), m = l(0), L = l(0), C = l(0), f = l(""), g = l(!1), E = l(!1), k = l(!1), O = l(1e3), q = l("all"), b = l(!1), _ = l(!1), T = l([]), W = l(!1), R = l(""), j = l(!1), M = l(((Fe = c.initialLineEnding) == null ? void 0 : Fe.call(c)) ?? "crlf"), x = l([]), s = l(-1), u = l(""), h = l("text"), a = l(null), v = l(!0), w = l(!0), $ = l(!0), P = l(!1), A = l(!1), Q = l(!1), B = l([]), ce = l("");
125
- let xe = 0, S = [], D = [], Y = null, le = null, Z = null, V = null, N = null, H = !1, ue = "", X = null, ie = 0, fe = 0, ee = 0, I = null;
126
- const we = (e) => {
127
- var n;
128
- const t = (n = c.storageKey) == null ? void 0 : n.call(c);
129
- return t ? `${t}:${e}` : null;
130
- }, de = (e) => {
131
- const t = we(e);
132
- if (!t || typeof localStorage > "u") return null;
133
- try {
134
- const n = localStorage.getItem(t);
135
- return n ? JSON.parse(n) : null;
136
- } catch {
137
- return null;
138
- }
139
- }, te = (e, t) => {
140
- const n = we(e);
141
- if (!(!n || typeof localStorage > "u"))
142
- try {
143
- localStorage.setItem(n, JSON.stringify(t));
144
- } catch {
145
- }
146
- }, Se = de("view");
147
- Se && Object.assign(y, Se, { paused: !1 }), y.paused = !1;
148
- const ke = de("scenario");
149
- typeof ke == "string" && (R.value = ke);
150
- const _e = de("quick"), Pe = ((Ue = c.initialQuickCommands) == null ? void 0 : Ue.call(c)) ?? [];
151
- B.value = (_e ?? Pe).filter((e) => typeof e == "string").slice(0, Ce), oe(y, () => te("view", { ...y, paused: !1 }), { deep: !0 });
152
- const Ke = "vuesp-serial", F = "sessions", ne = () => {
153
- var t, n;
154
- const e = (t = c.storageKey) == null ? void 0 : t.call(c);
155
- return (n = c.session) != null && n.call(c) && e ? `${e}:session` : null;
156
- }, he = () => new Promise((e, t) => {
157
- const n = indexedDB.open(Ke, 1);
158
- n.onupgradeneeded = () => {
159
- n.result.objectStoreNames.contains(F) || n.result.createObjectStore(F);
160
- }, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
161
- }), qe = async (e) => {
162
- if (typeof indexedDB > "u") return null;
163
- const t = await he();
164
- return new Promise((n, r) => {
165
- const o = t.transaction(F, "readonly").objectStore(F).get(e);
166
- o.onsuccess = () => n(o.result ?? null), o.onerror = () => r(o.error);
167
- });
168
- }, Qe = async (e, t) => {
169
- if (typeof indexedDB > "u") return;
170
- const n = await he();
171
- await new Promise((r, o) => {
172
- const d = n.transaction(F, "readwrite").objectStore(F).put(t, e);
173
- d.onsuccess = () => r(), d.onerror = () => o(d.error);
174
- });
175
- }, Ve = async (e) => {
176
- if (typeof indexedDB > "u") return;
177
- const t = await he();
178
- await new Promise((n, r) => {
179
- const o = t.transaction(F, "readwrite").objectStore(F).delete(e);
180
- o.onsuccess = () => n(), o.onerror = () => r(o.error);
181
- });
182
- }, He = () => {
183
- const e = ne();
184
- e && (V && clearTimeout(V), V = setTimeout(() => {
185
- const t = {
186
- lines: i.value.map((n) => ({ ...n, data: n.data ? [...n.data] : void 0 })),
187
- rxBytes: p.value,
188
- txBytes: m.value
189
- };
190
- Qe(e, t).catch(() => {
191
- });
192
- }, 800));
193
- }, Xe = async () => {
194
- var t;
195
- const e = ne();
196
- if (!(!e || i.value.length))
197
- try {
198
- const n = await qe(e);
199
- if (!((t = n == null ? void 0 : n.lines) != null && t.length)) return;
200
- i.value = n.lines, xe = n.lines.reduce((r, o) => Math.max(r, o.id), 0), p.value = n.rxBytes ?? 0, m.value = n.txBytes ?? 0, Q.value = !0;
201
- } catch {
202
- }
203
- }, ve = (e, t) => {
204
- const n = Ot(t, y.encoding);
205
- i.value.push({
206
- id: ++xe,
207
- dir: e,
208
- at: (/* @__PURE__ */ new Date()).toLocaleTimeString(c.locale() === "ru" ? "ru-RU" : "en-GB", { hour12: !1 }),
209
- text: y.framing === "gap" ? n.replace(/[\r\n]+/g, " ") : n,
210
- hex: At(t),
211
- bytes: t.length,
212
- // Keep a bounded copy for the binary view and byte inspector.
213
- data: Array.from(t.slice(0, 1024))
214
- });
215
- const r = c.maxLines();
216
- i.value.length > r && i.value.splice(0, i.value.length - r), He();
217
- }, se = () => {
218
- Y && (clearTimeout(Y), Y = null);
219
- }, be = () => {
220
- if (se(), !S.length) return;
221
- const e = new Uint8Array(S);
222
- S = [], ve("rx", e);
223
- }, Je = () => {
224
- se();
225
- const e = y.framing === "gap" ? Math.max(5, y.gapMs) : Et;
226
- Y = setTimeout(be, e);
227
- }, Ee = (e) => {
228
- for (const t of e) S.push(t);
229
- if (y.framing === "line") {
230
- let t = 0;
231
- for (let n = 0; n < S.length; n++) {
232
- const r = S[n];
233
- if (r !== 10 && r !== 13) continue;
234
- const o = S.slice(t, n);
235
- o.length && ve("rx", new Uint8Array(o)), r === 13 && S[n + 1] === 10 && n++, t = n + 1;
236
- }
237
- t && (S = S.slice(t));
238
- }
239
- S.length >= Tt ? be() : Je();
240
- }, J = () => {
241
- Z && clearTimeout(Z), Z = null, A.value = !1;
242
- }, ze = (e) => {
243
- var n;
244
- const t = (n = c.noReplyHint) == null ? void 0 : n.call(c);
245
- t && (J(), Z = setTimeout(() => {
246
- p.value === e && (A.value = !0);
247
- }, t.delay ?? 1500));
248
- }, Ge = (e) => {
249
- if (e != null && e.length) {
250
- if (A.value && J(), p.value += e.length, y.paused) {
251
- for (const t of e) D.push(t);
252
- D.length > $e && D.splice(0, D.length - $e);
253
- return;
254
- }
255
- Ee(e);
256
- }
257
- }, We = () => {
258
- I == null || I(), I = c.transport().subscribe(Ge);
259
- };
260
- oe(
261
- () => y.paused,
262
- (e) => {
263
- if (e || !D.length) return;
264
- const t = new Uint8Array(D);
265
- D = [], Ee(t);
266
- }
267
- );
268
- const K = async (e) => {
269
- const t = await c.transport().send(e);
270
- return t && (m.value += e.length, ve("tx", e)), t;
271
- }, ye = U(() => f.value.replace(/^0x/i, "").replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "")), Ye = U(() => {
272
- const e = f.value.replace(/0x/gi, "").replace(/[\s,;:]/g, "");
273
- return e.length > 0 && /[^0-9a-fA-F]/.test(e);
274
- }), Te = U(() => {
275
- const e = ye.value, t = [];
276
- for (let n = 0; n + 1 < e.length; n += 2) t.push(parseInt(e.slice(n, n + 2), 16));
277
- return t;
278
- }), Re = U(() => g.value ? Ye.value ? c.labels().hexInvalid : ye.value && ye.value.length % 2 ? c.labels().hexOdd : "" : ""), Ze = (e) => {
279
- const t = new TextEncoder(), n = [];
280
- let r = "";
281
- const o = () => {
282
- r && (n.push(...t.encode(r)), r = "");
283
- };
284
- for (let d = 0; d < e.length; d++) {
285
- const me = e[d];
286
- if (me !== "\\") {
287
- r += me;
288
- continue;
289
- }
290
- const z = e[d + 1], je = e.slice(d + 2, d + 4);
291
- if ((z === "x" || z === "X") && /^[0-9a-fA-F]{2}$/.test(je)) {
292
- o(), n.push(parseInt(je, 16)), d += 3;
293
- continue;
294
- }
295
- const Me = { r: 13, n: 10, t: 9, 0: 0, "\\": 92 };
296
- if (z !== void 0 && z in Me) {
297
- o(), n.push(Me[z]), d += 1;
298
- continue;
299
- }
300
- r += me;
301
- }
302
- return o(), n;
303
- }, re = (e, t) => {
304
- if (t) {
305
- const r = e.replace(/0x/gi, "").replace(/[^0-9a-fA-F]/g, "");
306
- if (!r.length || r.length % 2) return [];
307
- const o = [];
308
- for (let d = 0; d + 1 < r.length; d += 2) o.push(parseInt(r.slice(d, d + 2), 16));
309
- return o;
310
- }
311
- const n = E.value ? Ze(e) : Array.from(new TextEncoder().encode(e));
312
- return (M.value === "cr" || M.value === "crlf") && n.push(13), (M.value === "lf" || M.value === "crlf") && n.push(10), n;
313
- }, Ne = async () => {
314
- if (g.value && (Re.value || !Te.value.length)) return;
315
- const e = f.value, t = re(e, g.value);
316
- !t.length || !await K(new Uint8Array(t.slice(0, 4096))) || (e.trim() && (x.value = [e, ...x.value.filter((r) => r !== e)].slice(0, 50), s.value = -1), f.value = "");
317
- }, Be = async (e) => {
318
- const t = re(e, !1);
319
- if (!t.length) return;
320
- const n = p.value;
321
- await K(new Uint8Array(t.slice(0, 4096))) && (x.value = [e, ...x.value.filter((o) => o !== e)].slice(0, 50), s.value = -1, ue = e, ze(n));
322
- }, et = async (e) => {
323
- const t = new Uint8Array(await e.arrayBuffer());
324
- if (!t.length) return !1;
325
- const n = 256;
326
- for (let r = 0; r < t.length; r += n) {
327
- if (!await K(t.slice(r, r + n))) return !1;
328
- await new Promise((d) => setTimeout(d, 8));
329
- }
330
- return !0;
331
- }, ae = () => {
332
- N && clearInterval(N), N = null, k.value = !1;
333
- }, tt = async () => {
334
- if (k.value) {
335
- ae();
336
- return;
337
- }
338
- const e = re(f.value, g.value);
339
- if (!e.length) return;
340
- const t = new Uint8Array(e.slice(0, 4096));
341
- await K(t) && (k.value = !0, N = setInterval(() => {
342
- K(t);
343
- }, Math.max(50, O.value)));
344
- }, nt = async () => {
345
- var t;
346
- const e = (t = c.noReplyHint) == null ? void 0 : t.call(c);
347
- e != null && e.onAction && (J(), await e.onAction(), (e.resend ?? !0) && ue && await Be(ue));
348
- }, st = (e) => {
349
- if (e.key === "ArrowUp") {
350
- if (!x.value.length) return;
351
- e.preventDefault(), s.value = s.value === -1 ? x.value.length - 1 : Math.max(0, s.value - 1), f.value = x.value[s.value] ?? "";
352
- return;
353
- }
354
- if (e.key === "ArrowDown") {
355
- if (s.value === -1) return;
356
- e.preventDefault(), s.value++, s.value >= x.value.length ? (s.value = -1, f.value = "") : f.value = x.value[s.value] ?? "";
357
- return;
358
- }
359
- e.key === "Escape" && (f.value = "", s.value = -1);
360
- }, rt = (e, t) => {
361
- if (!t) return !0;
362
- if (b.value)
363
- try {
364
- const n = new RegExp(t, "i");
365
- return n.test(e.text) || n.test(e.hex);
366
- } catch {
367
- return !1;
368
- }
369
- return e.text.toLowerCase().includes(t) || e.hex.toLowerCase().includes(t);
370
- }, at = U(() => {
371
- const e = u.value.trim().toLowerCase(), t = new Set(T.value);
372
- return i.value.filter((n) => q.value !== "all" && n.dir !== q.value || _.value && !t.has(n.id) ? !1 : rt(n, e));
373
- }), Le = (e) => T.value.includes(e.id), ot = (e) => {
374
- T.value = Le(e) ? T.value.filter((t) => t !== e.id) : [...T.value, e.id];
375
- }, ct = (e) => e.split(`
376
- `).map((t) => t.trim()).filter(Boolean).map((t) => {
377
- const n = /^(\d+)\s*:\s*(.*)$/.exec(t);
378
- return n ? { delay: Number(n[1]), command: n[2] } : { delay: 0, command: t };
379
- }).filter((t) => t.command.length > 0), ge = () => {
380
- H = !0, j.value = !1;
381
- }, lt = async () => {
382
- if (j.value) return;
383
- const e = ct(R.value);
384
- if (e.length) {
385
- H = !1, j.value = !0;
386
- try {
387
- for (const t of e) {
388
- if (H || (t.delay > 0 && await new Promise((r) => setTimeout(r, t.delay)), H)) break;
389
- const n = re(t.command, !1);
390
- n.length && await K(new Uint8Array(n.slice(0, 4096)));
391
- }
392
- } finally {
393
- j.value = !1, H = !1;
394
- }
395
- }
396
- };
397
- oe(R, (e) => te("scenario", e));
398
- const ut = (e) => (e.data ?? []).map((t) => t.toString(2).padStart(8, "0")).join(" "), it = (e) => h.value === "hex" ? e.hex : h.value === "bin" ? ut(e) : e.text || e.hex, ft = U(() => i.value.find((e) => e.id === a.value) ?? null), dt = (e) => {
399
- a.value = a.value === e.id ? null : e.id;
400
- }, ht = (e) => {
401
- const t = u.value.trim().toLowerCase();
402
- if (!t || b.value) return [{ text: e, match: !1 }];
403
- const n = e.toLowerCase(), r = [];
404
- let o = 0;
405
- for (; o < e.length; ) {
406
- const d = n.indexOf(t, o);
407
- if (d === -1) break;
408
- d > o && r.push({ text: e.slice(o, d), match: !1 }), r.push({ text: e.slice(d, d + t.length), match: !0 }), o = d + t.length;
409
- }
410
- return o < e.length && r.push({ text: e.slice(o), match: !1 }), r.length ? r : [{ text: e, match: !1 }];
411
- }, pe = (e, t) => {
412
- const n = URL.createObjectURL(t), r = document.createElement("a"), o = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
413
- return r.href = n, r.download = `serial-${o}.${e}`, r.click(), URL.revokeObjectURL(n), !0;
414
- }, Oe = () => i.value.map((e) => `${e.at} ${e.dir.toUpperCase()} ${e.text || e.hex}`).join(`
415
- `), vt = () => {
416
- if (!i.value.length) return !1;
417
- const e = (n) => `"${String(n).replace(/"/g, '""')}"`, t = i.value.map((n) => [n.at, n.dir, n.bytes, e(n.text), e(n.hex)].join(","));
418
- return pe("csv", new Blob([["time,direction,bytes,text,hex", ...t].join(`
419
- `)], { type: "text/csv;charset=utf-8" }));
420
- }, yt = () => {
421
- if (!i.value.length) return !1;
422
- const e = i.value.map((t) => ({ at: t.at, dir: t.dir, bytes: t.bytes, text: t.text, hex: t.hex }));
423
- return pe("json", new Blob([JSON.stringify(e, null, 2)], { type: "application/json;charset=utf-8" }));
424
- }, gt = () => {
425
- var t;
426
- const e = [];
427
- for (const n of i.value)
428
- n.dir === "rx" && ((t = n.data) != null && t.length) && e.push(...n.data);
429
- return e.length ? pe("bin", new Blob([new Uint8Array(e)], { type: "application/octet-stream" })) : !1;
430
- }, Ae = async () => {
431
- if (!i.value.length) return !1;
432
- try {
433
- return await navigator.clipboard.writeText(Oe()), P.value = !0, X && clearTimeout(X), X = setTimeout(() => {
434
- P.value = !1;
435
- }, Rt), !0;
436
- } catch {
437
- return !1;
438
- }
439
- }, pt = () => {
440
- if (!i.value.length) return !1;
441
- const e = new Blob([Oe()], { type: "text/plain;charset=utf-8" }), t = URL.createObjectURL(e), n = document.createElement("a"), r = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
442
- return n.href = t, n.download = `serial-${r}.log`, n.click(), URL.revokeObjectURL(t), !0;
443
- }, De = () => {
444
- ae(), ge(), J(), se();
445
- const e = ne();
446
- e && Ve(e).catch(() => {
447
- }), Q.value = !1, S = [], D = [], i.value = [], a.value = null, p.value = 0, m.value = 0, L.value = 0, C.value = 0, ie = 0, fe = 0, ee = performance.now();
448
- }, mt = (e) => {
449
- const t = c.labels();
450
- return e < 1024 ? `${e} ${t.byteShort}` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} ${t.kiloShort}` : `${(e / (1024 * 1024)).toFixed(2)} ${t.megaShort}`;
451
- }, xt = () => {
452
- const e = performance.now(), t = (e - ee) / 1e3;
453
- t <= 0 || (L.value = Math.max(0, Math.round((p.value - ie) / t)), C.value = Math.max(0, Math.round((m.value - fe) / t)), ie = p.value, fe = m.value, ee = e);
454
- }, wt = () => {
455
- const e = ce.value.trim();
456
- e && (B.value.includes(e) || (B.value = [...B.value, e].slice(0, Ce)), ce.value = "", te("quick", B.value));
457
- }, St = (e) => {
458
- B.value = B.value.filter((t) => t !== e), te("quick", B.value);
459
- }, Ie = (e) => {
460
- e.ctrlKey && (e.key.toLowerCase() === "l" && (e.preventDefault(), De()), e.shiftKey && e.key.toLowerCase() === "c" && (e.preventDefault(), Ae()));
461
- };
462
- return kt(() => {
463
- We(), ne() && Xe(), ee = performance.now(), le = setInterval(xt, 1e3), window.addEventListener("keydown", Ie);
464
- }), bt(() => {
465
- I == null || I(), I = null, ae(), ge(), J(), se(), le && clearInterval(le), X && clearTimeout(X), V && clearTimeout(V), window.removeEventListener("keydown", Ie);
466
- }), {
467
- lines: i,
468
- visibleLines: at,
469
- view: y,
470
- rxBytes: p,
471
- txBytes: m,
472
- rxRate: L,
473
- txRate: C,
474
- input: f,
475
- hexSend: g,
476
- escape: E,
477
- repeat: k,
478
- repeatMs: O,
479
- direction: q,
480
- regex: b,
481
- onlyBookmarks: _,
482
- bookmarkIds: T,
483
- isBookmarked: Le,
484
- toggleBookmark: ot,
485
- scenarioOpen: W,
486
- scenarioText: R,
487
- scenarioRunning: j,
488
- startScenario: lt,
489
- stopScenario: ge,
490
- sendFile: et,
491
- toggleRepeat: tt,
492
- stopRepeat: ae,
493
- lineEnding: M,
494
- history: x,
495
- filter: u,
496
- mode: h,
497
- selectedId: a,
498
- selectedLine: ft,
499
- selectLine: dt,
500
- showTime: v,
501
- wrapLines: w,
502
- autoScroll: $,
503
- copied: P,
504
- showNoReply: A,
505
- quickCommands: B,
506
- quickInput: ce,
507
- hexBytes: Te,
508
- hexError: Re,
509
- sendText: Ne,
510
- sendQuick: Be,
511
- onInputKeydown: st,
512
- lineContent: it,
513
- lineSegments: ht,
514
- copyLog: Ae,
515
- downloadLog: pt,
516
- exportCsv: vt,
517
- exportJson: yt,
518
- exportRxBin: gt,
519
- sessionRestored: Q,
520
- clearLog: De,
521
- formatBytes: mt,
522
- addQuick: wt,
523
- removeQuick: St,
524
- applyHintAction: nt
104
+ values: c,
105
+ errors: r,
106
+ defineField: R,
107
+ handleSubmit: A,
108
+ resetForm: C,
109
+ validate: d,
110
+ updateSchema: E,
111
+ isValid: y
525
112
  };
526
113
  }
527
114
  export {
528
- Mt as useDialog,
529
- $t as useFocusTrap,
530
- It as useForm,
531
- Ft as useSerialConsole,
532
- Ct as useSwipeDown
115
+ P as useDialog,
116
+ T as useFocusTrap,
117
+ B as useForm,
118
+ q as useI18n,
119
+ G as useScriptStudioLogs,
120
+ H as useSerialConsole,
121
+ W as useSwipeDown
533
122
  };
@@ -0,0 +1,3 @@
1
+ import { II18nInstance } from '../plugins/i18n/types';
2
+ export declare const useI18n: () => II18nInstance;
3
+ //# sourceMappingURL=useI18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/composables/useI18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,OAAO,QAAO,aAQ1B,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Ref } from 'vue';
2
+ import { IScriptLog, TLogMode } from '../components/script/types';
3
+ export declare const useScriptStudioLogs: (getScriptName: () => string, logs: Ref<readonly IScriptLog[]>, onClear: () => void) => {
4
+ logs: Ref<readonly IScriptLog[], readonly IScriptLog[]>;
5
+ liveLogs: import('vue').ComputedRef<readonly IScriptLog[]>;
6
+ visibleLogs: import('vue').ComputedRef<readonly IScriptLog[]>;
7
+ count: import('vue').ComputedRef<number>;
8
+ isOpen: Ref<boolean, boolean>;
9
+ hasUnread: Ref<boolean, boolean>;
10
+ pulseSeq: Ref<number, number>;
11
+ isPaused: Ref<boolean, boolean>;
12
+ isSearchOpen: Ref<boolean, boolean>;
13
+ isAutoScroll: Ref<boolean, boolean>;
14
+ isCopied: Ref<boolean, boolean>;
15
+ mode: Ref<TLogMode, TLogMode>;
16
+ search: Ref<string, string>;
17
+ logsPanel: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
18
+ logEl: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
19
+ onOpen: () => void;
20
+ onToggleOpen: () => void;
21
+ onTogglePause: () => void;
22
+ onToggleSearch: () => void;
23
+ onClear: () => void;
24
+ onFollow: () => void;
25
+ onScroll: () => void;
26
+ onCopy: () => Promise<boolean>;
27
+ onDownload: () => void;
28
+ getLogText: (text: string, mode: TLogMode) => string;
29
+ };
30
+ //# sourceMappingURL=useScriptStudioLogs.d.ts.map