@websublime/vite-plugin-open-api-devtools 0.8.5 → 0.9.0-next.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.
Files changed (82) hide show
  1. package/dist/ModelsPage-OOYQ3USo.js +798 -0
  2. package/dist/ModelsPage-OOYQ3USo.js.map +1 -0
  3. package/dist/{RoutesPage-BCKS0kdj.js → RoutesPage-BgsspZkr.js} +191 -191
  4. package/dist/RoutesPage-BgsspZkr.js.map +1 -0
  5. package/dist/SimulatorPage-g9fGUP4F.js +436 -0
  6. package/dist/SimulatorPage-g9fGUP4F.js.map +1 -0
  7. package/dist/TimelinePage-D_GD3OjL.js +861 -0
  8. package/dist/TimelinePage-D_GD3OjL.js.map +1 -0
  9. package/dist/{check-BZ_jBwd4.js → check-B4mNtdMg.js} +2 -2
  10. package/dist/{check-BZ_jBwd4.js.map → check-B4mNtdMg.js.map} +1 -1
  11. package/dist/devtools.css +1 -1
  12. package/dist/devtools.js +1 -1
  13. package/dist/devtools.umd.cjs +3 -3
  14. package/dist/devtools.umd.cjs.map +1 -1
  15. package/dist/{format-Dq-zmlAN.js → format-Dj37a-xS.js} +2 -2
  16. package/dist/{format-Dq-zmlAN.js.map → format-Dj37a-xS.js.map} +1 -1
  17. package/dist/main-CWgkFc8w.js +620 -0
  18. package/dist/main-CWgkFc8w.js.map +1 -0
  19. package/dist/registry-SW4SCwV5.js +216 -0
  20. package/dist/registry-SW4SCwV5.js.map +1 -0
  21. package/dist/spa/assets/{ModelsPage-8zCKSqIw.css → ModelsPage-CrseRvBH.css} +1 -1
  22. package/dist/spa/assets/ModelsPage-CxzHlUKB.js +4 -0
  23. package/dist/spa/assets/ModelsPage-CxzHlUKB.js.map +1 -0
  24. package/dist/spa/assets/RoutesPage-BchriFi3.js +2 -0
  25. package/dist/spa/assets/RoutesPage-BchriFi3.js.map +1 -0
  26. package/dist/spa/assets/{RoutesPage-BVXzvJ2S.css → RoutesPage-Wp_sf4Io.css} +1 -1
  27. package/dist/spa/assets/SimulatorPage-CHGPhn5Y.js +2 -0
  28. package/dist/spa/assets/SimulatorPage-CHGPhn5Y.js.map +1 -0
  29. package/dist/spa/assets/SimulatorPage-p6R5JJTE.css +1 -0
  30. package/dist/spa/assets/{TimelinePage-BDyp8kvu.css → TimelinePage-ED20f46Y.css} +1 -1
  31. package/dist/spa/assets/TimelinePage-zBBJCjLX.js +2 -0
  32. package/dist/spa/assets/TimelinePage-zBBJCjLX.js.map +1 -0
  33. package/dist/spa/assets/check-CDp1nxJT.js +2 -0
  34. package/dist/spa/assets/{check-DaD3RpI4.js.map → check-CDp1nxJT.js.map} +1 -1
  35. package/dist/spa/assets/{format-er1_KlP8.js → format-DA0n5kox.js} +2 -2
  36. package/dist/spa/assets/{format-er1_KlP8.js.map → format-DA0n5kox.js.map} +1 -1
  37. package/dist/spa/assets/index-Ddu0x8qb.js +3 -0
  38. package/dist/spa/assets/index-Ddu0x8qb.js.map +1 -0
  39. package/dist/spa/assets/registry-CKvK0Ln5.js +2 -0
  40. package/dist/spa/assets/registry-CKvK0Ln5.js.map +1 -0
  41. package/dist/spa/assets/{trash-2-BhRxw6RN.js → trash-2-B1UuFJDm.js} +2 -2
  42. package/dist/spa/assets/{trash-2-BhRxw6RN.js.map → trash-2-B1UuFJDm.js.map} +1 -1
  43. package/dist/spa/assets/{triangle-alert-QXcMwGDR.js → triangle-alert-ITT7135L.js} +2 -2
  44. package/dist/spa/assets/{triangle-alert-QXcMwGDR.js.map → triangle-alert-ITT7135L.js.map} +1 -1
  45. package/dist/spa/assets/{vue-vendor-Bkktf9yg.js → vue-vendor-D62nux6V.js} +2 -2
  46. package/dist/spa/assets/{vue-vendor-Bkktf9yg.js.map → vue-vendor-D62nux6V.js.map} +1 -1
  47. package/dist/spa/assets/x-YOimnrsL.js +2 -0
  48. package/dist/spa/assets/{x-DGt4DUCk.js.map → x-YOimnrsL.js.map} +1 -1
  49. package/dist/spa/index.html +2 -2
  50. package/dist/{trash-2-D9Av3Lfp.js → trash-2-CDLzu4_Y.js} +2 -2
  51. package/dist/{trash-2-D9Av3Lfp.js.map → trash-2-CDLzu4_Y.js.map} +1 -1
  52. package/dist/{triangle-alert-6Spra6HA.js → triangle-alert-BP3-t-po.js} +2 -2
  53. package/dist/{triangle-alert-6Spra6HA.js.map → triangle-alert-BP3-t-po.js.map} +1 -1
  54. package/dist/{x-DI-fqJ3g.js → x-BZzigrBR.js} +2 -2
  55. package/dist/{x-DI-fqJ3g.js.map → x-BZzigrBR.js.map} +1 -1
  56. package/package.json +13 -12
  57. package/dist/ModelsPage-DxcKgz3y.js +0 -757
  58. package/dist/ModelsPage-DxcKgz3y.js.map +0 -1
  59. package/dist/RoutesPage-BCKS0kdj.js.map +0 -1
  60. package/dist/SimulatorPage-BlbxLDdf.js +0 -430
  61. package/dist/SimulatorPage-BlbxLDdf.js.map +0 -1
  62. package/dist/TimelinePage-BhtcWy3o.js +0 -849
  63. package/dist/TimelinePage-BhtcWy3o.js.map +0 -1
  64. package/dist/main-DmyM_bX3.js +0 -537
  65. package/dist/main-DmyM_bX3.js.map +0 -1
  66. package/dist/registry-BQhccWMq.js +0 -153
  67. package/dist/registry-BQhccWMq.js.map +0 -1
  68. package/dist/spa/assets/ModelsPage-Bd7YM0_p.js +0 -4
  69. package/dist/spa/assets/ModelsPage-Bd7YM0_p.js.map +0 -1
  70. package/dist/spa/assets/RoutesPage-YQcTov5t.js +0 -2
  71. package/dist/spa/assets/RoutesPage-YQcTov5t.js.map +0 -1
  72. package/dist/spa/assets/SimulatorPage-DGEq_rzM.css +0 -1
  73. package/dist/spa/assets/SimulatorPage-DPxecZGS.js +0 -2
  74. package/dist/spa/assets/SimulatorPage-DPxecZGS.js.map +0 -1
  75. package/dist/spa/assets/TimelinePage-CbWvtFc_.js +0 -2
  76. package/dist/spa/assets/TimelinePage-CbWvtFc_.js.map +0 -1
  77. package/dist/spa/assets/check-DaD3RpI4.js +0 -2
  78. package/dist/spa/assets/index-x38XzU3c.js +0 -3
  79. package/dist/spa/assets/index-x38XzU3c.js.map +0 -1
  80. package/dist/spa/assets/registry-DjJcdO1T.js +0 -2
  81. package/dist/spa/assets/registry-DjJcdO1T.js.map +0 -1
  82. package/dist/spa/assets/x-DGt4DUCk.js +0 -2
@@ -1,757 +0,0 @@
1
- import { ref as C, computed as D, toRaw as te, defineComponent as q, createElementBlock as m, openBlock as f, createCommentVNode as M, createVNode as $, createElementVNode as n, unref as r, Fragment as N, renderList as A, normalizeClass as P, toDisplayString as S, watch as H, normalizeStyle as se, reactive as ne, onMounted as ae, nextTick as oe, createBlock as le, Teleport as re, withModifiers as ie, createTextVNode as G } from "vue";
2
- import { c as W, D as K, _ as X, u as ce } from "./main-DmyM_bX3.js";
3
- import { C as de } from "./check-BZ_jBwd4.js";
4
- import { defineStore as ue } from "pinia";
5
- import { X as fe } from "./x-DI-fqJ3g.js";
6
- import { T as me } from "./trash-2-D9Av3Lfp.js";
7
- const ve = W("circle-alert", [
8
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
9
- ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
10
- ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
11
- ]);
12
- const he = W("refresh-cw", [
13
- ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
14
- ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
15
- ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
16
- ["path", { d: "M8 16H3v5", key: "1cv678" }]
17
- ]);
18
- const ye = W("save", [
19
- [
20
- "path",
21
- {
22
- d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
23
- key: "1c8476"
24
- }
25
- ],
26
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
27
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
28
- ]);
29
- function U(t) {
30
- try {
31
- return structuredClone(te(t));
32
- } catch {
33
- return JSON.parse(JSON.stringify(t));
34
- }
35
- }
36
- const _e = ue("models", () => {
37
- const t = C([]), e = C(null), i = C([]), c = C([]), u = C(!1), l = C(null), _ = D(() => e.value ? t.value.find((a) => a.name === e.value) ?? null : null), g = C(!1), d = D(() => g.value), v = D(() => t.value.length), p = D(() => t.value.reduce((a, y) => a + y.count, 0));
38
- async function k() {
39
- u.value = !0, l.value = null;
40
- try {
41
- const a = await fetch("/_api/store");
42
- if (!a.ok)
43
- throw new Error(`Failed to fetch schemas: ${a.statusText}`);
44
- const y = await a.json();
45
- t.value = y.schemas ?? [];
46
- } catch (a) {
47
- l.value = a instanceof Error ? a.message : "Failed to fetch schemas", console.error("[ModelsStore] Error fetching schemas:", a);
48
- } finally {
49
- u.value = !1;
50
- }
51
- }
52
- async function F(a) {
53
- e.value !== a && (e.value = a, await T(a));
54
- }
55
- async function T(a) {
56
- u.value = !0, l.value = null;
57
- try {
58
- const y = await fetch(`/_api/store/${encodeURIComponent(a)}`);
59
- if (!y.ok)
60
- throw new Error(`Failed to fetch schema data: ${y.statusText}`);
61
- const x = await y.json(), j = x.items ?? [];
62
- i.value = U(j), c.value = U(j), g.value = !1;
63
- const Y = t.value.findIndex((ee) => ee.name === a);
64
- Y !== -1 && (t.value[Y].count = x.count);
65
- } catch (y) {
66
- l.value = y instanceof Error ? y.message : "Failed to fetch schema data", console.error("[ModelsStore] Error fetching schema data:", y);
67
- } finally {
68
- u.value = !1;
69
- }
70
- }
71
- function R(a) {
72
- if (!Array.isArray(a)) {
73
- l.value = "Invalid data: Expected an array of items", console.error("[ModelsStore] updateItems received non-array value:", typeof a);
74
- return;
75
- }
76
- i.value = a, l.value = null, g.value = !0;
77
- }
78
- async function V() {
79
- if (!e.value)
80
- return l.value = "No schema selected", !1;
81
- u.value = !0, l.value = null;
82
- try {
83
- const a = await fetch(`/_api/store/${encodeURIComponent(e.value)}`, {
84
- method: "POST",
85
- headers: {
86
- "Content-Type": "application/json"
87
- },
88
- body: JSON.stringify(i.value)
89
- });
90
- if (!a.ok) {
91
- const j = await a.json().catch(() => ({}));
92
- throw new Error(j.error || `Failed to save items: ${a.statusText}`);
93
- }
94
- const y = await a.json();
95
- c.value = U(i.value), g.value = !1;
96
- const x = t.value.findIndex((j) => j.name === e.value);
97
- return x !== -1 && (t.value[x].count = y.created ?? i.value.length), !0;
98
- } catch (a) {
99
- return l.value = a instanceof Error ? a.message : "Failed to save items", console.error("[ModelsStore] Error saving items:", a), !1;
100
- } finally {
101
- u.value = !1;
102
- }
103
- }
104
- async function O() {
105
- if (!e.value)
106
- return l.value = "No schema selected", !1;
107
- u.value = !0, l.value = null;
108
- try {
109
- const a = await fetch(`/_api/store/${encodeURIComponent(e.value)}`, {
110
- method: "DELETE"
111
- });
112
- if (!a.ok)
113
- throw new Error(`Failed to clear schema: ${a.statusText}`);
114
- i.value = [], c.value = [], g.value = !1;
115
- const y = t.value.findIndex((x) => x.name === e.value);
116
- return y !== -1 && (t.value[y].count = 0), !0;
117
- } catch (a) {
118
- return l.value = a instanceof Error ? a.message : "Failed to clear schema", console.error("[ModelsStore] Error clearing schema:", a), !1;
119
- } finally {
120
- u.value = !1;
121
- }
122
- }
123
- function h() {
124
- i.value = U(c.value), g.value = !1;
125
- }
126
- async function o() {
127
- e.value ? await T(e.value) : await k();
128
- }
129
- function s() {
130
- t.value = [], e.value = null, i.value = [], c.value = [], u.value = !1, l.value = null, g.value = !1;
131
- }
132
- function b(a) {
133
- const y = t.value.findIndex((x) => x.name === a.schema);
134
- y !== -1 && (t.value[y].count = a.count), e.value === a.schema && (d.value ? console.warn(
135
- `[ModelsStore] Skipping auto-refresh for schema "${a.schema}" - unsaved changes exist`
136
- ) : T(a.schema));
137
- }
138
- function E(a) {
139
- a.success && (k(), e.value && (d.value ? console.warn(
140
- `[ModelsStore] Skipping auto-refresh after reseed for schema "${e.value}" - unsaved changes exist`
141
- ) : T(e.value)));
142
- }
143
- return {
144
- // State
145
- schemas: t,
146
- selectedSchema: e,
147
- currentItems: i,
148
- loading: u,
149
- error: l,
150
- // Computed
151
- currentSchema: _,
152
- isDirty: d,
153
- schemaCount: v,
154
- totalItems: p,
155
- // Actions
156
- fetchSchemas: k,
157
- selectSchemaByName: F,
158
- fetchSchemaData: T,
159
- updateItems: R,
160
- saveItems: V,
161
- clearSchema: O,
162
- discardChanges: h,
163
- refresh: o,
164
- reset: s,
165
- handleStoreUpdate: b,
166
- handleReseedComplete: E
167
- };
168
- });
169
- function B(t, e) {
170
- return t.length <= e ? t : `${t.slice(0, e)}…`;
171
- }
172
- function pe(t) {
173
- return t == null ? "--" : typeof t == "string" ? B(t, 50) : typeof t == "number" || typeof t == "boolean" ? String(t) : Array.isArray(t) || typeof t == "object" ? B(JSON.stringify(t), 50) : String(t);
174
- }
175
- function Q(t, e) {
176
- if (!(typeof t != "object" || t === null))
177
- return t[e];
178
- }
179
- function ge(t, e, i) {
180
- const c = Q(t, e);
181
- return typeof c == "string" || typeof c == "number" ? c : i;
182
- }
183
- function be(t, e) {
184
- if (t.length === 0) return [];
185
- const i = /* @__PURE__ */ new Set();
186
- for (const u of t)
187
- if (typeof u == "object" && u !== null)
188
- for (const l of Object.keys(u))
189
- i.add(l);
190
- if (i.size === 0) return [];
191
- const c = Array.from(i);
192
- return c.includes(e) ? [e, ...c.filter((u) => u !== e)] : c;
193
- }
194
- const Se = { class: "data-table" }, ke = {
195
- key: 0,
196
- class: "data-table__empty"
197
- }, Ce = {
198
- key: 1,
199
- class: "data-table__container"
200
- }, we = { class: "data-table__table" }, xe = ["onClick"], Ie = { class: "data-table__row-num" }, $e = {
201
- key: 2,
202
- class: "data-table__footer"
203
- }, Te = { class: "data-table__info" }, Ee = { class: "data-table__info" }, je = /* @__PURE__ */ q({
204
- __name: "DataTable",
205
- props: {
206
- items: {},
207
- idField: {},
208
- selectedIndex: { default: -1 }
209
- },
210
- emits: ["select"],
211
- setup(t, { emit: e }) {
212
- const i = t, c = e, u = D(() => be(i.items, i.idField));
213
- function l(g) {
214
- c("select", g);
215
- }
216
- function _(g, d) {
217
- return ge(g, i.idField, d);
218
- }
219
- return (g, d) => (f(), m("div", Se, [
220
- t.items.length === 0 ? (f(), m("div", ke, [
221
- $(r(K), {
222
- size: 32,
223
- class: "data-table__empty-icon"
224
- }),
225
- d[0] || (d[0] = n("span", null, "No items", -1))
226
- ])) : (f(), m("div", Ce, [
227
- n("table", we, [
228
- n("thead", null, [
229
- n("tr", null, [
230
- d[1] || (d[1] = n("th", { class: "data-table__row-num" }, "#", -1)),
231
- (f(!0), m(N, null, A(u.value, (v) => (f(), m("th", {
232
- key: v,
233
- class: P(["data-table__header", { "data-table__header--id": v === t.idField }])
234
- }, S(v), 3))), 128))
235
- ])
236
- ]),
237
- n("tbody", null, [
238
- (f(!0), m(N, null, A(t.items, (v, p) => (f(), m("tr", {
239
- key: _(v, p),
240
- class: P(["data-table__row", { "data-table__row--selected": p === t.selectedIndex }]),
241
- onClick: (k) => l(p)
242
- }, [
243
- n("td", Ie, S(p + 1), 1),
244
- (f(!0), m(N, null, A(u.value, (k) => (f(), m("td", {
245
- key: k,
246
- class: P(["data-table__cell", { "data-table__cell--id": k === t.idField }])
247
- }, S(r(pe)(r(Q)(v, k))), 3))), 128))
248
- ], 10, xe))), 128))
249
- ])
250
- ])
251
- ])),
252
- t.items.length > 0 ? (f(), m("div", $e, [
253
- n("span", Te, S(t.items.length) + " items", 1),
254
- n("span", Ee, S(u.value.length) + " columns", 1)
255
- ])) : M("", !0)
256
- ]));
257
- }
258
- }), De = /* @__PURE__ */ X(je, [["__scopeId", "data-v-dcdce8f7"]]), Me = { class: "json-editor" }, Ne = { class: "json-editor__container" }, Je = ["value", "readonly", "placeholder"], Fe = { class: "json-editor__status" }, Re = { class: "json-editor__status-left" }, Ve = {
259
- key: 0,
260
- class: "json-editor__valid"
261
- }, Oe = {
262
- key: 1,
263
- class: "json-editor__error"
264
- }, Ae = { class: "json-editor__status-right" }, ze = { class: "json-editor__info" }, Ue = /* @__PURE__ */ q({
265
- __name: "JsonEditor",
266
- props: {
267
- modelValue: {},
268
- readonly: { type: Boolean, default: !1 },
269
- placeholder: { default: "Enter JSON data..." },
270
- minHeight: { default: 200 }
271
- },
272
- emits: ["update:modelValue"],
273
- setup(t, { expose: e, emit: i }) {
274
- const c = t, u = i, l = C(""), _ = C(null), g = D(() => _.value === null), d = D(() => l.value.split(`
275
- `).length), v = D(() => Array.from({ length: d.value }, (h, o) => o + 1)), p = C(null);
276
- function k() {
277
- try {
278
- l.value = JSON.stringify(c.modelValue, null, 2), _.value = null;
279
- } catch {
280
- l.value = "", _.value = "Invalid initial value";
281
- }
282
- }
283
- k(), H(
284
- () => c.modelValue,
285
- () => {
286
- try {
287
- const h = JSON.parse(l.value);
288
- JSON.stringify(h) !== JSON.stringify(c.modelValue) && k();
289
- } catch {
290
- k();
291
- }
292
- }
293
- );
294
- function F(h) {
295
- const o = h.target;
296
- l.value = o.value, T();
297
- }
298
- function T() {
299
- if (l.value.trim() === "") {
300
- _.value = null, u("update:modelValue", []);
301
- return;
302
- }
303
- try {
304
- const h = JSON.parse(l.value);
305
- _.value = null, u("update:modelValue", h);
306
- } catch (h) {
307
- if (h instanceof Error) {
308
- const o = h.message.match(/position (\d+)/);
309
- if (o) {
310
- const s = Number.parseInt(o[1], 10), b = l.value.substring(0, s).split(`
311
- `), E = b.length, a = b[b.length - 1].length + 1;
312
- _.value = `Line ${E}, Column ${a}: ${h.message}`;
313
- } else
314
- _.value = h.message;
315
- } else
316
- _.value = "Invalid JSON";
317
- }
318
- }
319
- function R() {
320
- try {
321
- const h = JSON.parse(l.value);
322
- l.value = JSON.stringify(h, null, 2), _.value = null, u("update:modelValue", h);
323
- } catch {
324
- }
325
- }
326
- function V(h) {
327
- if (h.key === "Tab") {
328
- h.preventDefault();
329
- const o = h.target, s = o.selectionStart, b = o.selectionEnd, E = `${l.value.substring(0, s)} ${l.value.substring(b)}`;
330
- l.value = E, setTimeout(() => {
331
- o.selectionStart = o.selectionEnd = s + 2;
332
- }, 0), T();
333
- }
334
- }
335
- function O(h) {
336
- const o = h.target;
337
- p.value && (p.value.scrollTop = o.scrollTop);
338
- }
339
- return e({
340
- formatJson: R,
341
- isValid: g
342
- }), (h, o) => (f(), m("div", Me, [
343
- n("div", Ne, [
344
- n("div", {
345
- ref_key: "linesRef",
346
- ref: p,
347
- class: "json-editor__lines",
348
- "aria-hidden": "true"
349
- }, [
350
- (f(!0), m(N, null, A(v.value, (s) => (f(), m("div", {
351
- key: s,
352
- class: "json-editor__line-number"
353
- }, S(s), 1))), 128))
354
- ], 512),
355
- n("textarea", {
356
- value: l.value,
357
- readonly: t.readonly,
358
- placeholder: t.placeholder,
359
- style: se({ "--json-editor-min-height": `${t.minHeight}px` }),
360
- class: "json-editor__textarea",
361
- spellcheck: "false",
362
- onInput: F,
363
- onKeydown: V,
364
- onScroll: O
365
- }, null, 44, Je)
366
- ]),
367
- n("div", Fe, [
368
- n("div", Re, [
369
- g.value ? (f(), m("div", Ve, [
370
- $(r(de), { size: 14 }),
371
- o[0] || (o[0] = n("span", null, "Valid JSON", -1))
372
- ])) : _.value ? (f(), m("div", Oe, [
373
- $(r(ve), { size: 14 }),
374
- n("span", null, S(_.value), 1)
375
- ])) : M("", !0)
376
- ]),
377
- n("div", Ae, [
378
- n("span", ze, S(d.value) + " lines", 1)
379
- ])
380
- ])
381
- ]));
382
- }
383
- }), Le = /* @__PURE__ */ X(Ue, [["__scopeId", "data-v-a953e764"]]), z = C([]), I = ne({
384
- visible: !1,
385
- title: "",
386
- message: "",
387
- confirmText: "Confirm",
388
- cancelText: "Cancel",
389
- onConfirm: null,
390
- onCancel: null
391
- }), J = /* @__PURE__ */ new Map();
392
- let w = null, Pe = 0;
393
- function Be() {
394
- return `toast-${Date.now()}-${Pe++}`;
395
- }
396
- function L(t, e, i = 3e3) {
397
- const c = Be(), u = {
398
- id: c,
399
- type: t,
400
- message: e,
401
- duration: i,
402
- timestamp: Date.now()
403
- };
404
- if (z.value.push(u), i > 0) {
405
- const l = setTimeout(() => {
406
- Z(c), J.delete(c);
407
- }, i);
408
- J.set(c, l);
409
- }
410
- return c;
411
- }
412
- function Z(t) {
413
- const e = J.get(t);
414
- e !== void 0 && (clearTimeout(e), J.delete(t));
415
- const i = z.value.findIndex((c) => c.id === t);
416
- i !== -1 && z.value.splice(i, 1);
417
- }
418
- function He() {
419
- function t(d, v) {
420
- return L("success", d, v);
421
- }
422
- function e(d, v) {
423
- return L("error", d, v);
424
- }
425
- function i(d, v) {
426
- return L("info", d, v);
427
- }
428
- function c(d, v) {
429
- return L("warning", d, v);
430
- }
431
- function u(d, v) {
432
- return new Promise((p) => {
433
- w && (w(!1), w = null), w = p, I.visible = !0, I.title = v?.title || "Confirm", I.message = d, I.confirmText = v?.confirmText || "Confirm", I.cancelText = v?.cancelText || "Cancel", I.onConfirm = () => {
434
- I.visible = !1, w && (w(!0), w = null);
435
- }, I.onCancel = () => {
436
- I.visible = !1, w && (w(!1), w = null);
437
- };
438
- });
439
- }
440
- function l() {
441
- I.visible = !1, w && (w(!1), w = null);
442
- }
443
- function _(d) {
444
- Z(d);
445
- }
446
- function g() {
447
- for (const d of J.values())
448
- clearTimeout(d);
449
- J.clear(), z.value = [];
450
- }
451
- return {
452
- // State
453
- toasts: z,
454
- confirmDialog: I,
455
- // Toast methods
456
- success: t,
457
- error: e,
458
- info: i,
459
- warning: c,
460
- dismiss: _,
461
- clearAll: g,
462
- // Confirm methods
463
- confirm: u,
464
- closeConfirm: l
465
- };
466
- }
467
- const Ke = { class: "models-page" }, qe = { class: "models-sidebar" }, We = { class: "models-sidebar__header" }, Xe = { class: "models-sidebar__badge" }, Ye = {
468
- key: 0,
469
- class: "models-sidebar__loading"
470
- }, Ge = {
471
- key: 1,
472
- class: "models-sidebar__list"
473
- }, Qe = ["onClick"], Ze = { class: "models-sidebar__name" }, et = { class: "models-sidebar__count" }, tt = { class: "models-sidebar__footer" }, st = { class: "models-sidebar__stat" }, nt = { class: "font-mono" }, at = { class: "models-content" }, ot = { class: "models-toolbar" }, lt = { class: "models-toolbar__title" }, rt = { class: "font-mono" }, it = { class: "text-muted" }, ct = {
474
- key: 0,
475
- class: "models-toolbar__badge models-toolbar__badge--warning"
476
- }, dt = { class: "models-toolbar__actions" }, ut = ["disabled"], ft = ["disabled"], mt = {
477
- key: 0,
478
- class: "models-error"
479
- }, vt = { class: "models-panels" }, ht = { class: "models-panel" }, yt = { class: "models-panel" }, _t = {
480
- key: 1,
481
- class: "models-loading-overlay"
482
- }, pt = {
483
- key: 1,
484
- class: "empty-state"
485
- }, gt = {
486
- key: 0,
487
- class: "models-error"
488
- }, bt = { class: "modal__body" }, St = { class: "modal__footer" }, kt = /* @__PURE__ */ q({
489
- __name: "ModelsPage",
490
- setup(t) {
491
- const e = _e(), { send: i, on: c, connected: u } = ce(), { success: l, error: _, confirm: g } = He(), d = C(null), v = C(!1), p = C(-1);
492
- ae(async () => {
493
- try {
494
- await e.fetchSchemas(), e.schemas.length > 0 && !e.selectedSchema && await e.selectSchemaByName(e.schemas[0].name);
495
- } catch (o) {
496
- e.error || (e.error = o instanceof Error ? o.message : "Failed to load schemas");
497
- }
498
- }), c("store:updated", (o) => {
499
- const s = o;
500
- if (typeof o != "object" || o === null || typeof s.schema != "string" || typeof s.action != "string" || typeof s.count != "number") {
501
- console.warn("[ModelsPage] Invalid store:updated payload:", o);
502
- return;
503
- }
504
- e.handleStoreUpdate(o), p.value = -1;
505
- }), c("reseeded", (o) => {
506
- const s = o;
507
- if (typeof o != "object" || o === null || typeof s.success != "boolean" || !Array.isArray(s.schemas)) {
508
- console.warn("[ModelsPage] Invalid reseeded payload:", o);
509
- return;
510
- }
511
- e.handleReseedComplete(o), p.value = -1;
512
- }), H(
513
- () => e.selectedSchema,
514
- async () => {
515
- p.value = -1, d.value && e.currentItems.length > 0 && (await oe(), d.value?.formatJson());
516
- }
517
- ), H(
518
- () => e.currentItems,
519
- (o, s) => {
520
- const b = p.value;
521
- if (b < 0) return;
522
- if (b >= o.length) {
523
- p.value = -1;
524
- return;
525
- }
526
- const E = e.currentSchema?.idField ?? "id", a = s?.[b], y = o[b];
527
- if (a !== y) {
528
- if (typeof a == "object" && a !== null && typeof y == "object" && y !== null) {
529
- const x = a[E], j = y[E];
530
- if (x !== void 0 && x === j) return;
531
- }
532
- p.value = -1;
533
- }
534
- }
535
- );
536
- async function k(o) {
537
- e.isDirty && !await g(
538
- "You have unsaved changes. Are you sure you want to switch schemas?",
539
- {
540
- title: "Unsaved Changes",
541
- confirmText: "Switch Schema",
542
- cancelText: "Cancel"
543
- }
544
- ) || await e.selectSchemaByName(o);
545
- }
546
- async function F() {
547
- if (!d.value?.isValid) {
548
- _("Cannot save invalid JSON. Please fix the errors first.");
549
- return;
550
- }
551
- if (await e.saveItems())
552
- l("Items saved successfully");
553
- else {
554
- const s = e.error || "Failed to save items";
555
- _(s);
556
- }
557
- }
558
- async function T() {
559
- if (!e.isDirty) return;
560
- await g("Discard all changes and revert to saved data?", {
561
- title: "Discard Changes",
562
- confirmText: "Discard",
563
- cancelText: "Cancel"
564
- }) && (e.discardChanges(), l("Changes discarded"));
565
- }
566
- async function R() {
567
- v.value = !1;
568
- try {
569
- if (await e.clearSchema())
570
- l("Schema cleared successfully");
571
- else {
572
- const s = e.error || "Failed to clear schema";
573
- _(s);
574
- }
575
- } catch (o) {
576
- const s = o instanceof Error ? o.message : "Failed to clear schema";
577
- _(s);
578
- }
579
- }
580
- async function V() {
581
- if (!u.value) {
582
- _("WebSocket not connected. Cannot trigger reseed.");
583
- return;
584
- }
585
- await g(
586
- "This will regenerate all seed data and replace existing items. Continue?",
587
- {
588
- title: "Reseed All Schemas",
589
- confirmText: "Reseed",
590
- cancelText: "Cancel"
591
- }
592
- ) && (i({ type: "reseed" }), l("Reseed command sent"));
593
- }
594
- function O(o) {
595
- e.updateItems(o);
596
- }
597
- function h(o) {
598
- p.value = p.value === o ? -1 : o;
599
- }
600
- return (o, s) => (f(), m("div", Ke, [
601
- n("aside", qe, [
602
- n("div", We, [
603
- $(r(K), { size: 18 }),
604
- s[4] || (s[4] = n("span", null, "Schemas", -1)),
605
- n("span", Xe, S(r(e).schemaCount), 1)
606
- ]),
607
- r(e).loading && r(e).schemas.length === 0 ? (f(), m("div", Ye, [...s[5] || (s[5] = [
608
- n("div", { class: "spinner" }, null, -1),
609
- n("span", null, "Loading...", -1)
610
- ])])) : (f(), m("div", Ge, [
611
- (f(!0), m(N, null, A(r(e).schemas, (b) => (f(), m("button", {
612
- key: b.name,
613
- class: P([
614
- "models-sidebar__item",
615
- { "models-sidebar__item--active": r(e).selectedSchema === b.name }
616
- ]),
617
- onClick: (E) => k(b.name)
618
- }, [
619
- n("span", Ze, S(b.name), 1),
620
- n("span", et, S(b.count), 1)
621
- ], 10, Qe))), 128))
622
- ])),
623
- n("div", tt, [
624
- n("div", st, [
625
- s[6] || (s[6] = n("span", { class: "text-muted" }, "Total Items:", -1)),
626
- n("span", nt, S(r(e).totalItems), 1)
627
- ])
628
- ])
629
- ]),
630
- n("main", at, [
631
- r(e).selectedSchema ? (f(), m(N, { key: 0 }, [
632
- n("div", ot, [
633
- n("div", lt, [
634
- n("span", rt, S(r(e).selectedSchema), 1),
635
- n("span", it, "(" + S(r(e).currentItems.length) + " items)", 1),
636
- r(e).isDirty ? (f(), m("span", ct, " Unsaved ")) : M("", !0)
637
- ]),
638
- n("div", dt, [
639
- r(e).isDirty ? (f(), m("button", {
640
- key: 0,
641
- class: "btn btn--ghost",
642
- title: "Discard changes",
643
- onClick: T
644
- }, [
645
- $(r(fe), { size: 16 }),
646
- s[7] || (s[7] = n("span", null, "Discard", -1))
647
- ])) : M("", !0),
648
- n("button", {
649
- disabled: !r(e).isDirty || r(e).loading,
650
- class: "btn btn--primary",
651
- title: "Save changes",
652
- onClick: F
653
- }, [
654
- $(r(ye), { size: 16 }),
655
- s[8] || (s[8] = n("span", null, "Save", -1))
656
- ], 8, ut),
657
- n("button", {
658
- class: "btn btn--danger",
659
- title: "Clear all items",
660
- onClick: s[0] || (s[0] = (b) => v.value = !0)
661
- }, [
662
- $(r(me), { size: 16 }),
663
- s[9] || (s[9] = n("span", null, "Clear", -1))
664
- ]),
665
- n("button", {
666
- disabled: !r(u),
667
- class: "btn btn--secondary",
668
- title: "Reseed all schemas with generated data",
669
- onClick: V
670
- }, [
671
- $(r(he), { size: 16 }),
672
- s[10] || (s[10] = n("span", null, "Reseed All", -1))
673
- ], 8, ft)
674
- ])
675
- ]),
676
- r(e).error ? (f(), m("div", mt, [
677
- n("span", null, "⚠️ " + S(r(e).error), 1)
678
- ])) : M("", !0),
679
- n("div", vt, [
680
- n("div", ht, [
681
- $(Le, {
682
- ref_key: "jsonEditorRef",
683
- ref: d,
684
- "model-value": r(e).currentItems,
685
- readonly: r(e).loading,
686
- "min-height": 400,
687
- "onUpdate:modelValue": O
688
- }, null, 8, ["model-value", "readonly"])
689
- ]),
690
- n("div", yt, [
691
- $(De, {
692
- items: r(e).currentItems,
693
- "id-field": r(e).currentSchema?.idField ?? "id",
694
- "selected-index": p.value,
695
- onSelect: h
696
- }, null, 8, ["items", "id-field", "selected-index"])
697
- ])
698
- ]),
699
- r(e).loading ? (f(), m("div", _t, [...s[11] || (s[11] = [
700
- n("div", { class: "spinner" }, null, -1),
701
- n("span", null, "Loading...", -1)
702
- ])])) : M("", !0)
703
- ], 64)) : (f(), m("div", pt, [
704
- r(e).error ? (f(), m("div", gt, [
705
- n("span", null, "⚠️ " + S(r(e).error), 1)
706
- ])) : (f(), m(N, { key: 1 }, [
707
- $(r(K), {
708
- size: 48,
709
- class: "empty-state__icon"
710
- }),
711
- s[12] || (s[12] = n("h3", { class: "empty-state__title" }, "Select a schema", -1)),
712
- s[13] || (s[13] = n("p", { class: "empty-state__description" }, " Choose a schema from the sidebar to view and edit its data. ", -1))
713
- ], 64))
714
- ]))
715
- ]),
716
- (f(), le(re, { to: "body" }, [
717
- v.value ? (f(), m("div", {
718
- key: 0,
719
- class: "modal-overlay",
720
- onClick: s[3] || (s[3] = (b) => v.value = !1)
721
- }, [
722
- n("div", {
723
- class: "modal",
724
- onClick: s[2] || (s[2] = ie(() => {
725
- }, ["stop"]))
726
- }, [
727
- s[17] || (s[17] = n("div", { class: "modal__header" }, [
728
- n("h3", null, "Clear Schema Data")
729
- ], -1)),
730
- n("div", bt, [
731
- n("p", null, [
732
- s[14] || (s[14] = G(" Are you sure you want to clear all items for ", -1)),
733
- n("strong", null, S(r(e).selectedSchema), 1),
734
- s[15] || (s[15] = G("? ", -1))
735
- ]),
736
- s[16] || (s[16] = n("p", { class: "text-muted" }, "This action cannot be undone.", -1))
737
- ]),
738
- n("div", St, [
739
- n("button", {
740
- class: "btn btn--ghost",
741
- onClick: s[1] || (s[1] = (b) => v.value = !1)
742
- }, " Cancel "),
743
- n("button", {
744
- class: "btn btn--danger",
745
- onClick: R
746
- }, " Clear Schema ")
747
- ])
748
- ])
749
- ])) : M("", !0)
750
- ]))
751
- ]));
752
- }
753
- }), Et = /* @__PURE__ */ X(kt, [["__scopeId", "data-v-62a953d5"]]);
754
- export {
755
- Et as default
756
- };
757
- //# sourceMappingURL=ModelsPage-DxcKgz3y.js.map