@burdenoff/microfe-bigconsole 2026.613.1 → 2026.613.3

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.
@@ -1,21 +1,22 @@
1
1
  import { useWidgetStore as e } from "../store/widgetStore.js";
2
2
  import { useDashboardStore as t } from "../store/dashboardStore.js";
3
3
  import "../store/index.js";
4
- import { useBigConsoleNavigate as n } from "../context/BigConsoleContext.js";
4
+ import { useBigConsole as n, useBigConsoleNavigate as r } from "../context/BigConsoleContext.js";
5
5
  import "../context/index.js";
6
- import r from "../hooks/useWidgetOperations.js";
7
- import i from "../hooks/useDashboardOperations.js";
8
- import a from "../hooks/usePageOperations.js";
6
+ import { getWidgetDefinition as i } from "../components/widgets/WidgetRegistry.js";
7
+ import a from "../hooks/useWidgetCatalog.js";
8
+ import o from "../hooks/useWidgetOperations.js";
9
+ import s from "../hooks/useDashboardOperations.js";
10
+ import c from "../hooks/usePageOperations.js";
9
11
  import "../hooks/index.js";
10
- import { getWidgetDefinition as o } from "../components/widgets/WidgetRegistry.js";
11
- import s from "../components/widgets/WidgetTypeSelector.js";
12
- import { findNextAvailablePosition as c } from "../utils/widgetPositioning.js";
13
- import l from "../components/dashboard/DashboardCanvas.js";
14
- import u from "../components/dashboard/ExportDashboardDialog.js";
12
+ import l from "../components/widgets/WidgetTypeSelector.js";
13
+ import { findNextAvailablePosition as u } from "../utils/widgetPositioning.js";
14
+ import ee from "../components/dashboard/DashboardCanvas.js";
15
+ import d from "../components/dashboard/ExportDashboardDialog.js";
15
16
  import "../components/dashboard/index.js";
16
- import { memo as d, useCallback as f, useEffect as p, useState as m } from "react";
17
- import { useParams as h } from "react-router-dom";
18
- import { ArrowLeft as g } from "lucide-react";
17
+ import { memo as f, useCallback as p, useEffect as m, useState as h } from "react";
18
+ import { useParams as g } from "react-router-dom";
19
+ import { ArrowLeft as te } from "lucide-react";
19
20
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
20
21
  import { Button as y } from "@burdenoff/fe-libs/ui";
21
22
  //#region src/bigconsole/pages/DashboardBuilderPage.tsx
@@ -30,19 +31,23 @@ function x(e, t) {
30
31
  let n = b();
31
32
  n?.register && n.register(e, t);
32
33
  }
33
- function S(e) {
34
+ function ne(e) {
34
35
  let t = b();
35
36
  t?.unregister && t.unregister(e);
36
37
  }
37
- var C = d(function() {
38
- let { dashboardId: d } = h(), b = n(), [C, w] = m(!1), [T, E] = m(!1), [D, O] = m(!1), [k, A] = m(null), { fetchDashboard: j, updateDashboard: M, loading: N, error: P } = i(), { createWidget: F, updateWidget: I, deleteWidget: L, duplicateWidget: R, batchUpdatePositions: z } = r(void 0, d), { createPage: B, updatePage: V, deletePage: H, reorderPages: U } = a(), W = t((e) => e.setCurrentDashboard), G = t((e) => e.currentDashboard), K = t((e) => e.setViewMode), q = e((e) => e.selectWidget), J = e((e) => e.widgets), Y = e((e) => e.clipboardWidgetId), X = e((e) => e.clipboardAction), Z = e((e) => e.clearClipboard);
39
- p(() => (K("edit"), () => K("view")), [K]), p(() => {
40
- if (!d) {
38
+ var S = f(function() {
39
+ let { dashboardId: f } = g(), b = r(), { workspaceId: S, apiGatewayUrl: C, authToken: w } = n(), { definitions: T } = a({
40
+ workspaceId: S,
41
+ apiGatewayUrl: C,
42
+ authToken: w
43
+ }), [E, D] = h(!1), [re, O] = h(!1), [ie, k] = h(!1), [A, j] = h(null), { fetchDashboard: M, updateDashboard: N, loading: P, error: F } = s(), { createWidget: I, updateWidget: L, deleteWidget: R, duplicateWidget: z, batchUpdatePositions: B } = o(void 0, f), { createPage: V, updatePage: H, deletePage: U, reorderPages: W } = c(), G = t((e) => e.setCurrentDashboard), K = t((e) => e.currentDashboard), q = t((e) => e.setViewMode), J = e((e) => e.selectWidget), Y = e((e) => e.widgets), X = e((e) => e.clipboardWidgetId), Z = e((e) => e.clipboardAction), Q = e((e) => e.clearClipboard);
44
+ m(() => (q("edit"), () => q("view")), [q]), m(() => {
45
+ if (!f) {
41
46
  b("/dashboards");
42
47
  return;
43
48
  }
44
- return j(d).then((e) => {
45
- e ? (W({
49
+ return M(f).then((e) => {
50
+ e ? (G({
46
51
  id: e.id,
47
52
  title: e.name,
48
53
  description: e.description || "",
@@ -54,39 +59,39 @@ var C = d(function() {
54
59
  })),
55
60
  createdAt: e.createdAt,
56
61
  updatedAt: e.updatedAt
57
- }), e.pages.length > 0 && !k && A(e.pages[0].id), e.name && x(d, e.name)) : b("/dashboards");
62
+ }), e.pages.length > 0 && !A && j(e.pages[0].id), e.name && x(f, e.name)) : b("/dashboards");
58
63
  }), () => {
59
- d && S(d);
64
+ f && ne(f);
60
65
  };
61
66
  }, [
62
- d,
67
+ f,
63
68
  b,
64
- W,
65
- j,
66
- k
69
+ G,
70
+ M,
71
+ A
67
72
  ]);
68
- let Q = f(async () => {
69
- if (!Y || !d || !G?.pages?.[0]?.id) return;
70
- let e = J.get(Y);
73
+ let ae = p(async () => {
74
+ if (!X || !f || !K?.pages?.[0]?.id) return;
75
+ let e = Y.get(X);
71
76
  if (!e) {
72
- Z();
77
+ Q();
73
78
  return;
74
79
  }
75
- let t = G.pages[0].id, n = Array.from(J.values()), r = {
80
+ let t = K.pages[0].id, n = Array.from(Y.values()), r = {
76
81
  width: e.positionWidth ?? 4,
77
82
  height: e.positionHeight ?? 4
78
- }, { x: i, y: a } = c(n, r, { cols: 12 }), o = {
83
+ }, { x: i, y: a } = u(n, r, { cols: 12 }), o = {
79
84
  x: i,
80
85
  y: a,
81
86
  width: r.width,
82
87
  height: r.height
83
- }, s = X === "copy" ? `${e.title} (Copy)` : e.title, l = null;
88
+ }, s = Z === "copy" ? `${e.title} (Copy)` : e.title, c = null;
84
89
  try {
85
- l = await R(Y, o, s);
90
+ c = await z(X, o, s);
86
91
  } catch {}
87
- l ||= await F({
92
+ c ||= await I({
88
93
  pageId: t,
89
- dashboardId: d,
94
+ dashboardId: f,
90
95
  type: e.type,
91
96
  title: s,
92
97
  description: e.description,
@@ -98,48 +103,49 @@ var C = d(function() {
98
103
  position: o,
99
104
  refreshInterval: e.refreshInterval ?? void 0,
100
105
  metadata: e.metadata
101
- }), l && (q(l.id), X === "cut" && await L(Y)), Z();
106
+ }), c && (J(c.id), Z === "cut" && await R(X)), Q();
102
107
  }, [
103
- Y,
104
108
  X,
105
- d,
106
- G,
107
- J,
109
+ Z,
110
+ f,
111
+ K,
112
+ Y,
113
+ z,
114
+ I,
108
115
  R,
109
- F,
110
- L,
111
- q,
112
- Z
113
- ]), $ = f(async (e) => {
114
- if (!d || !G?.pages?.[0]?.id) return;
115
- let t = G.pages[0].id, n = e.replace(/_/g, " ").toLowerCase().replace(/^\w/, (e) => e.toUpperCase()), r = Array.from(J.values()), i = o(e), a = {
116
- width: i?.defaultSize?.width ?? 4,
117
- height: i?.defaultSize?.height ?? 4
118
- }, { x: s, y: l } = c(r, a, { cols: 12 }), u = await F({
116
+ J,
117
+ Q
118
+ ]), oe = p(async (e) => {
119
+ if (!f || !K?.pages?.[0]?.id) return;
120
+ let t = K.pages[0].id, n = e.replace(/_/g, " ").toLowerCase().replace(/^\w/, (e) => e.toUpperCase()), r = Array.from(Y.values()), a = T.find((t) => t.type === e) ?? i(e), o = {
121
+ width: a?.defaultSize?.width ?? 4,
122
+ height: a?.defaultSize?.height ?? 4
123
+ }, { x: s, y: c } = u(r, o, { cols: 12 }), l = await I({
119
124
  pageId: t,
120
- dashboardId: d,
125
+ dashboardId: f,
121
126
  type: e,
122
127
  title: n,
123
128
  config: {},
124
129
  position: {
125
130
  x: s,
126
- y: l,
127
- width: a.width,
128
- height: a.height
131
+ y: c,
132
+ width: o.width,
133
+ height: o.height
129
134
  }
130
135
  });
131
- u && (q(u.id), w(!1));
136
+ l && (J(l.id), D(!1));
132
137
  }, [
133
- d,
134
- G,
135
- F,
136
- q,
137
- J
138
- ]), ee = f(() => {
138
+ f,
139
+ K,
140
+ I,
141
+ J,
142
+ Y,
143
+ T
144
+ ]), se = p(() => {
139
145
  b("/dashboards");
140
- }, [b]), te = f(async () => {
141
- if (d) {
142
- E(!0);
146
+ }, [b]), $ = p(async () => {
147
+ if (f) {
148
+ O(!0);
143
149
  try {
144
150
  let t = e.getState(), n = Array.from(t.widgets.values()), r = t.dirtyWidgetIds, i = n.filter((e) => r.has(e.id));
145
151
  if (i.length > 0) {
@@ -155,14 +161,14 @@ var C = d(function() {
155
161
  parserRules: e.parserRules ?? void 0
156
162
  };
157
163
  try {
158
- return await I(t);
164
+ return await L(t);
159
165
  } catch (e) {
160
166
  throw e;
161
167
  }
162
168
  });
163
169
  await Promise.all(e), t.clearAllDirty();
164
170
  }
165
- n.length > 0 && await z(n.map((e) => ({
171
+ n.length > 0 && await B(n.map((e) => ({
166
172
  id: e.id,
167
173
  position: e.position || {
168
174
  x: e.positionX ?? 0,
@@ -170,118 +176,118 @@ var C = d(function() {
170
176
  width: e.positionWidth ?? 4,
171
177
  height: e.positionHeight ?? 4
172
178
  }
173
- }))), G && await M({
174
- id: d,
175
- name: G.title,
176
- description: G.description
179
+ }))), K && await N({
180
+ id: f,
181
+ name: K.title,
182
+ description: K.description
177
183
  });
178
184
  } catch {} finally {
179
- E(!1);
185
+ O(!1);
180
186
  }
181
187
  }
182
188
  }, [
183
- d,
184
- G,
185
- I,
186
- z,
187
- M
188
- ]), ne = f(() => {
189
- O(!0);
190
- }, []), re = f(() => {
191
- O(!1);
192
- }, []), ie = f((e) => {
193
- A(e);
194
- }, []), ae = f(async () => {
195
- if (!G || !d) return;
196
- let e = await B({
197
- dashboardId: d,
198
- name: `Page ${G.pages.length + 1}`
189
+ f,
190
+ K,
191
+ L,
192
+ B,
193
+ N
194
+ ]), ce = p(() => {
195
+ k(!0);
196
+ }, []), le = p(() => {
197
+ k(!1);
198
+ }, []), ue = p((e) => {
199
+ j(e);
200
+ }, []), de = p(async () => {
201
+ if (!K || !f) return;
202
+ let e = await V({
203
+ dashboardId: f,
204
+ name: `Page ${K.pages.length + 1}`
199
205
  });
200
- e && (W({
201
- ...G,
202
- pages: [...G.pages, {
206
+ e && (G({
207
+ ...K,
208
+ pages: [...K.pages, {
203
209
  id: e.id,
204
210
  title: e.name,
205
211
  index: e.order,
206
212
  layoutConfig: e.layoutConfig || {}
207
213
  }]
208
- }), A(e.id));
214
+ }), j(e.id));
209
215
  }, [
216
+ K,
217
+ f,
210
218
  G,
211
- d,
212
- W,
213
- B
214
- ]), oe = f(async (e, t) => {
215
- G && await V({
219
+ V
220
+ ]), fe = p(async (e, t) => {
221
+ K && await H({
216
222
  id: e,
217
223
  name: t
218
- }) && W({
219
- ...G,
220
- pages: G.pages.map((n) => n.id === e ? {
224
+ }) && G({
225
+ ...K,
226
+ pages: K.pages.map((n) => n.id === e ? {
221
227
  ...n,
222
228
  title: t
223
229
  } : n)
224
230
  });
225
231
  }, [
232
+ K,
226
233
  G,
227
- W,
228
- V
229
- ]), se = f(async (e) => {
230
- if (!G || !d) return;
231
- let t = G.pages.find((t) => t.id === e);
234
+ H
235
+ ]), pe = p(async (e) => {
236
+ if (!K || !f) return;
237
+ let t = K.pages.find((t) => t.id === e);
232
238
  if (!t) return;
233
- let n = await B({
234
- dashboardId: d,
239
+ let n = await V({
240
+ dashboardId: f,
235
241
  name: `${t.title} (Copy)`
236
242
  });
237
- n && (W({
238
- ...G,
239
- pages: [...G.pages, {
243
+ n && (G({
244
+ ...K,
245
+ pages: [...K.pages, {
240
246
  id: n.id,
241
247
  title: n.name,
242
248
  index: n.order,
243
249
  layoutConfig: n.layoutConfig || {}
244
250
  }]
245
- }), A(n.id));
251
+ }), j(n.id));
246
252
  }, [
253
+ K,
254
+ f,
247
255
  G,
248
- d,
249
- W,
250
- B
251
- ]), ce = f(async (e) => {
252
- if (!(!G || G.pages.length <= 1) && await H(e)) {
253
- let t = G.pages.filter((t) => t.id !== e).map((e, t) => ({
256
+ V
257
+ ]), me = p(async (e) => {
258
+ if (!(!K || K.pages.length <= 1) && await U(e)) {
259
+ let t = K.pages.filter((t) => t.id !== e).map((e, t) => ({
254
260
  ...e,
255
261
  index: t
256
262
  }));
257
- W({
258
- ...G,
263
+ G({
264
+ ...K,
259
265
  pages: t
260
- }), k === e && A(t[0]?.id || null);
266
+ }), A === e && j(t[0]?.id || null);
261
267
  }
262
268
  }, [
269
+ K,
263
270
  G,
264
- W,
265
- k,
266
- H
267
- ]), le = f(async (e) => {
268
- !G || !d || (W({
269
- ...G,
271
+ A,
272
+ U
273
+ ]), he = p(async (e) => {
274
+ !K || !f || (G({
275
+ ...K,
270
276
  pages: e.map((e, t) => ({
271
277
  ...e,
272
278
  index: t
273
279
  }))
274
- }), await U(d, e.map((e) => e.id)));
280
+ }), await W(f, e.map((e) => e.id)));
275
281
  }, [
282
+ K,
283
+ f,
276
284
  G,
277
- d,
278
- W,
279
- U
285
+ W
280
286
  ]);
281
- return N || !G ? /* @__PURE__ */ _("div", {
287
+ return P || !K ? /* @__PURE__ */ _("div", {
282
288
  className: "flex items-center justify-center h-full",
283
289
  children: /* @__PURE__ */ _("div", { className: "animate-spin w-8 h-8 border-4 border-action-primary-bg border-t-transparent rounded-full" })
284
- }) : P ? /* @__PURE__ */ _("div", {
290
+ }) : F ? /* @__PURE__ */ _("div", {
285
291
  className: "flex flex-col items-center justify-center h-full p-6",
286
292
  children: /* @__PURE__ */ v("div", {
287
293
  className: "bg-status-error-bg border border-status-error-border rounded-lg p-4 max-w-md",
@@ -292,7 +298,7 @@ var C = d(function() {
292
298
  }),
293
299
  /* @__PURE__ */ _("p", {
294
300
  className: "text-sm text-text-secondary mt-1",
295
- children: P.message
301
+ children: F.message
296
302
  }),
297
303
  /* @__PURE__ */ _("button", {
298
304
  type: "button",
@@ -307,29 +313,29 @@ var C = d(function() {
307
313
  children: [/* @__PURE__ */ v("div", {
308
314
  className: "flex items-center gap-3 px-3 py-2 border-b border-border-default bg-bg-surface flex-shrink-0",
309
315
  children: [/* @__PURE__ */ v(y, {
310
- onClick: ee,
316
+ onClick: se,
311
317
  variant: "ghost",
312
318
  size: "sm",
313
319
  title: "Back to Dashboards",
314
320
  "aria-label": "Back to Dashboards",
315
- children: [/* @__PURE__ */ _(g, { className: "w-4 h-4 mr-2" }), "Back"]
321
+ children: [/* @__PURE__ */ _(te, { className: "w-4 h-4 mr-2" }), "Back"]
316
322
  }), /* @__PURE__ */ _("h2", {
317
323
  className: "text-sm font-semibold text-text-primary truncate",
318
- children: G.title
324
+ children: K.title
319
325
  })]
320
326
  }), /* @__PURE__ */ v("div", {
321
327
  className: "flex flex-1 min-h-0 relative",
322
328
  children: [
323
329
  /* @__PURE__ */ _("div", {
324
330
  className: `
325
- ${C ? "w-72" : "w-0"}
331
+ ${E ? "w-72" : "w-0"}
326
332
  flex-shrink-0
327
333
  bg-bg-surface
328
334
  border-r border-border-default
329
335
  transition-all duration-300
330
336
  overflow-hidden
331
337
  `,
332
- children: C && /* @__PURE__ */ v("div", {
338
+ children: E && /* @__PURE__ */ v("div", {
333
339
  className: "h-full flex flex-col",
334
340
  children: [/* @__PURE__ */ v("div", {
335
341
  className: "flex items-center justify-between p-3 border-b border-border-default",
@@ -338,7 +344,7 @@ var C = d(function() {
338
344
  children: "Widgets"
339
345
  }), /* @__PURE__ */ _("button", {
340
346
  type: "button",
341
- onClick: () => w(!1),
347
+ onClick: () => D(!1),
342
348
  className: "\n p-1 rounded-md\n text-text-secondary\n hover:text-text-primary\n hover:bg-bg-muted\n ",
343
349
  children: /* @__PURE__ */ _("svg", {
344
350
  className: "w-4 h-4",
@@ -355,13 +361,16 @@ var C = d(function() {
355
361
  })]
356
362
  }), /* @__PURE__ */ _("div", {
357
363
  className: "flex-1 overflow-auto",
358
- children: /* @__PURE__ */ _(s, { onSelect: $ })
364
+ children: /* @__PURE__ */ _(l, {
365
+ onSelect: oe,
366
+ definitions: T
367
+ })
359
368
  })]
360
369
  })
361
370
  }),
362
- !C && /* @__PURE__ */ _("button", {
371
+ !E && /* @__PURE__ */ _("button", {
363
372
  type: "button",
364
- onClick: () => w(!0),
373
+ onClick: () => D(!0),
365
374
  className: "\n absolute left-0 top-1/2 -translate-y-1/2 z-20\n w-8 h-24\n bg-bg-surface\n border border-l-0 border-border-default\n rounded-r-lg\n flex items-center justify-center\n text-text-secondary\n hover:text-text-primary\n hover:bg-bg-muted\n transition-colors\n ",
366
375
  title: "Open widget panel",
367
376
  children: /* @__PURE__ */ _("svg", {
@@ -379,40 +388,40 @@ var C = d(function() {
379
388
  }),
380
389
  /* @__PURE__ */ _("div", {
381
390
  className: "flex-1 relative",
382
- children: /* @__PURE__ */ _(l, {
383
- dashboardId: G.id,
384
- pageId: k || G.pages?.[0]?.id,
385
- title: G.title,
386
- onPaste: Q,
387
- onSave: te,
388
- isSaving: T,
389
- onExport: ne,
390
- pages: G.pages.map((e) => ({
391
+ children: /* @__PURE__ */ _(ee, {
392
+ dashboardId: K.id,
393
+ pageId: A || K.pages?.[0]?.id,
394
+ title: K.title,
395
+ onPaste: ae,
396
+ onSave: $,
397
+ isSaving: re,
398
+ onExport: ce,
399
+ pages: K.pages.map((e) => ({
391
400
  id: e.id,
392
401
  name: e.title || `Page ${(e.index ?? 0) + 1}`,
393
402
  order: e.index ?? 0
394
403
  })),
395
- activePageId: k || G.pages?.[0]?.id,
396
- onPageChange: ie,
397
- onPageAdd: ae,
398
- onPageRename: oe,
399
- onPageDuplicate: se,
400
- onPageDelete: ce,
401
- onPagesReorder: le,
404
+ activePageId: A || K.pages?.[0]?.id,
405
+ onPageChange: ue,
406
+ onPageAdd: de,
407
+ onPageRename: fe,
408
+ onPageDuplicate: pe,
409
+ onPageDelete: me,
410
+ onPagesReorder: he,
402
411
  showPageTabs: !0
403
412
  })
404
413
  }),
405
- /* @__PURE__ */ _(u, {
406
- isOpen: D,
407
- dashboardId: G.id,
408
- dashboardName: G.title,
409
- onClose: re
414
+ /* @__PURE__ */ _(d, {
415
+ isOpen: ie,
416
+ dashboardId: K.id,
417
+ dashboardName: K.title,
418
+ onClose: le
410
419
  })
411
420
  ]
412
421
  })]
413
422
  });
414
423
  });
415
424
  //#endregion
416
- export { C as DashboardBuilderPage, C as default };
425
+ export { S as DashboardBuilderPage, S as default };
417
426
 
418
427
  //# sourceMappingURL=DashboardBuilderPage.js.map