@trops/dash-core 0.1.330 → 0.1.331

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/dist/index.esm.js CHANGED
@@ -595,10 +595,13 @@ var DashboardApi = {
595
595
  * Widgets can call these methods directly (not via events) to
596
596
  * control the dashboard they are rendered in.
597
597
  *
598
- * Internally dispatches CustomEvents on `window` so the API
599
- * stays decoupled from the React component tree.
598
+ * Write actions internally dispatch CustomEvents on `window` so the
599
+ * API stays decoupled from the React component tree. Read methods
600
+ * return values from `window.__dashState`, which DashboardStage
601
+ * keeps up-to-date as workspace/page state changes.
600
602
  */
601
603
  var DashboardActionsApi = {
604
+ // ─── Page Navigation ──────────────────────────────────────────────
602
605
  /**
603
606
  * Switch the active page by its internal ID.
604
607
  * @param {string} pageId - The ID of the page to switch to
@@ -620,6 +623,119 @@ var DashboardActionsApi = {
620
623
  pageName: pageName
621
624
  }
622
625
  }));
626
+ },
627
+ /**
628
+ * Navigate to the previous page in history (browser-style back).
629
+ */
630
+ goBack: function goBack() {
631
+ window.dispatchEvent(new CustomEvent("dash:go-back"));
632
+ },
633
+ // ─── Workspace Nav Sidebar (far-left DashSidebar) ─────────────────
634
+ /**
635
+ * Collapse the workspace nav sidebar.
636
+ */
637
+ closeSidebar: function closeSidebar() {
638
+ window.dispatchEvent(new CustomEvent("dash:set-nav-sidebar", {
639
+ detail: {
640
+ collapsed: true
641
+ }
642
+ }));
643
+ },
644
+ /**
645
+ * Expand the workspace nav sidebar.
646
+ */
647
+ openSidebar: function openSidebar() {
648
+ window.dispatchEvent(new CustomEvent("dash:set-nav-sidebar", {
649
+ detail: {
650
+ collapsed: false
651
+ }
652
+ }));
653
+ },
654
+ /**
655
+ * Toggle the workspace nav sidebar.
656
+ */
657
+ toggleSidebar: function toggleSidebar() {
658
+ window.dispatchEvent(new CustomEvent("dash:toggle-nav-sidebar"));
659
+ },
660
+ // ─── Workspace (Dashboard) Navigation ─────────────────────────────
661
+ /**
662
+ * Open another dashboard in a tab by name.
663
+ * @param {string} name - The display name of the dashboard
664
+ */
665
+ openDashboardByName: function openDashboardByName(name) {
666
+ window.dispatchEvent(new CustomEvent("dash:open-dashboard", {
667
+ detail: {
668
+ name: name
669
+ }
670
+ }));
671
+ },
672
+ /**
673
+ * Close a dashboard tab. Closes the active tab if no name is given.
674
+ * @param {string} [name] - Optional: name of the dashboard tab to close
675
+ */
676
+ closeDashboard: function closeDashboard(name) {
677
+ window.dispatchEvent(new CustomEvent("dash:close-dashboard", {
678
+ detail: {
679
+ name: name
680
+ }
681
+ }));
682
+ },
683
+ // ─── Notifications (in-app toasts) ────────────────────────────────
684
+ /**
685
+ * Show an in-app toast notification.
686
+ * @param {string} message - The toast message
687
+ * @param {object} [options]
688
+ * @param {"success"|"error"|"info"|"warning"} [options.type="info"]
689
+ * @param {string} [options.title]
690
+ * @param {number} [options.duration=4000] - Auto-dismiss after ms
691
+ */
692
+ notify: function notify(message) {
693
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
694
+ window.dispatchEvent(new CustomEvent("dash:notify", {
695
+ detail: {
696
+ message: message,
697
+ type: options.type || "info",
698
+ title: options.title,
699
+ duration: options.duration || 4000
700
+ }
701
+ }));
702
+ },
703
+ // ─── Read Methods (synchronous, from window.__dashState) ──────────
704
+ /**
705
+ * @returns {string|null} The ID of the active page
706
+ */
707
+ getCurrentPageId: function getCurrentPageId() {
708
+ var _window$__dashState;
709
+ return ((_window$__dashState = window.__dashState) === null || _window$__dashState === void 0 ? void 0 : _window$__dashState.currentPageId) || null;
710
+ },
711
+ /**
712
+ * @returns {string|null} The display name of the active page
713
+ */
714
+ getCurrentPageName: function getCurrentPageName() {
715
+ var _window$__dashState2;
716
+ return ((_window$__dashState2 = window.__dashState) === null || _window$__dashState2 === void 0 ? void 0 : _window$__dashState2.currentPageName) || null;
717
+ },
718
+ /**
719
+ * @returns {number|null} The ID of the active dashboard
720
+ */
721
+ getCurrentDashboardId: function getCurrentDashboardId() {
722
+ var _window$__dashState3;
723
+ return ((_window$__dashState3 = window.__dashState) === null || _window$__dashState3 === void 0 ? void 0 : _window$__dashState3.currentDashboardId) || null;
724
+ },
725
+ /**
726
+ * @returns {string|null} The display name of the active dashboard
727
+ */
728
+ getCurrentDashboardName: function getCurrentDashboardName() {
729
+ var _window$__dashState4;
730
+ return ((_window$__dashState4 = window.__dashState) === null || _window$__dashState4 === void 0 ? void 0 : _window$__dashState4.currentDashboardName) || null;
731
+ },
732
+ /**
733
+ * @returns {Array<{id: string, name: string, order: number}>}
734
+ * Pages in the current dashboard
735
+ */
736
+ listPages: function listPages() {
737
+ var _window$__dashState5;
738
+ return ((_window$__dashState5 = window.__dashState) === null || _window$__dashState5 === void 0 ? void 0 : _window$__dashState5.pages) || [];
623
739
  }
624
740
  };
625
741
 
@@ -50995,22 +51111,28 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
50995
51111
  widgetSidebarCollapsed = _useState0[0],
50996
51112
  setWidgetSidebarCollapsed = _useState0[1];
50997
51113
 
50998
- // ─── Recents + Session ──────────────────────────────────────────
51114
+ // ─── In-app toasts (driven by DashboardActionsApi.notify) ────────
50999
51115
  var _useState1 = useState([]),
51000
51116
  _useState10 = _slicedToArray(_useState1, 2),
51001
- recentDashboards = _useState10[0],
51002
- setRecentDashboards = _useState10[1];
51117
+ toasts = _useState10[0],
51118
+ setToasts = _useState10[1];
51119
+
51120
+ // ─── Recents + Session ──────────────────────────────────────────
51121
+ var _useState11 = useState([]),
51122
+ _useState12 = _slicedToArray(_useState11, 2),
51123
+ recentDashboards = _useState12[0],
51124
+ setRecentDashboards = _useState12[1];
51003
51125
  var sessionRestored = useRef(false);
51004
51126
 
51005
51127
  // ─── Registry Auth (for sidebar) ────────────────────────────────
51006
- var _useState11 = useState("loading"),
51007
- _useState12 = _slicedToArray(_useState11, 2),
51008
- authStatus = _useState12[0],
51009
- setAuthStatus = _useState12[1];
51010
- var _useState13 = useState(null),
51128
+ var _useState13 = useState("loading"),
51011
51129
  _useState14 = _slicedToArray(_useState13, 2),
51012
- authProfile = _useState14[0],
51013
- setAuthProfile = _useState14[1];
51130
+ authStatus = _useState14[0],
51131
+ setAuthStatus = _useState14[1];
51132
+ var _useState15 = useState(null),
51133
+ _useState16 = _slicedToArray(_useState15, 2),
51134
+ authProfile = _useState16[0],
51135
+ setAuthProfile = _useState16[1];
51014
51136
 
51015
51137
  // Derive workspaceSelected from active tab
51016
51138
  var workspaceSelected = activeTabId ? (_openTabs$find$worksp = (_openTabs$find = openTabs.find(function (tab) {
@@ -51020,84 +51142,84 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51020
51142
  /**
51021
51143
  * @param {Boolean} previewMode this is a toggle telling the dash we are editing
51022
51144
  */
51023
- var _useState15 = useState(preview),
51024
- _useState16 = _slicedToArray(_useState15, 2),
51025
- previewMode = _useState16[0],
51026
- setPreviewMode = _useState16[1];
51145
+ var _useState17 = useState(preview),
51146
+ _useState18 = _slicedToArray(_useState17, 2),
51147
+ previewMode = _useState18[0],
51148
+ setPreviewMode = _useState18[1];
51027
51149
 
51028
51150
  /**
51029
51151
  * @param {String["layout", "workspace", "widget"]} editMode this is the actual mode we are in
51030
51152
  */
51031
- var _useState17 = useState("all"),
51032
- _useState18 = _slicedToArray(_useState17, 1),
51033
- editMode = _useState18[0]; // for the time being use "all" as our "old" way
51153
+ var _useState19 = useState("all"),
51154
+ _useState20 = _slicedToArray(_useState19, 1),
51155
+ editMode = _useState20[0]; // for the time being use "all" as our "old" way
51034
51156
 
51035
51157
  // Workspace Management (loading)
51036
- var _useState19 = useState(false),
51037
- _useState20 = _slicedToArray(_useState19, 2),
51038
- isLoadingWorkspaces = _useState20[0],
51039
- setIsLoadingWorkspaces = _useState20[1];
51040
51158
  var _useState21 = useState(false),
51041
51159
  _useState22 = _slicedToArray(_useState21, 2),
51042
- isLoadingMenuItems = _useState22[0],
51043
- setIsLoadingMenuItems = _useState22[1];
51044
- var _useState23 = useState([]),
51160
+ isLoadingWorkspaces = _useState22[0],
51161
+ setIsLoadingWorkspaces = _useState22[1];
51162
+ var _useState23 = useState(false),
51045
51163
  _useState24 = _slicedToArray(_useState23, 2),
51046
- menuItems = _useState24[0],
51047
- setMenuItems = _useState24[1];
51164
+ isLoadingMenuItems = _useState24[0],
51165
+ setIsLoadingMenuItems = _useState24[1];
51048
51166
  var _useState25 = useState([]),
51049
51167
  _useState26 = _slicedToArray(_useState25, 2),
51050
- workspaceConfig = _useState26[0],
51051
- setWorkspaceConfig = _useState26[1];
51168
+ menuItems = _useState26[0],
51169
+ setMenuItems = _useState26[1];
51170
+ var _useState27 = useState([]),
51171
+ _useState28 = _slicedToArray(_useState27, 2),
51172
+ workspaceConfig = _useState28[0],
51173
+ setWorkspaceConfig = _useState28[1];
51052
51174
 
51053
51175
  // Modal state
51054
- var _useState27 = useState(false),
51055
- _useState28 = _slicedToArray(_useState27, 2),
51056
- isThemeManagerOpen = _useState28[0],
51057
- setIsThemeManagerOpen = _useState28[1];
51058
51176
  var _useState29 = useState(false),
51059
51177
  _useState30 = _slicedToArray(_useState29, 2),
51060
- isDashboardLoaderOpen = _useState30[0],
51061
- setIsDashboardLoaderOpen = _useState30[1];
51178
+ isThemeManagerOpen = _useState30[0],
51179
+ setIsThemeManagerOpen = _useState30[1];
51062
51180
  var _useState31 = useState(false),
51063
51181
  _useState32 = _slicedToArray(_useState31, 2),
51064
- isLayoutPickerOpen = _useState32[0],
51065
- setIsLayoutPickerOpen = _useState32[1];
51182
+ isDashboardLoaderOpen = _useState32[0],
51183
+ setIsDashboardLoaderOpen = _useState32[1];
51066
51184
  var _useState33 = useState(false),
51067
51185
  _useState34 = _slicedToArray(_useState33, 2),
51068
- isWizardOpen = _useState34[0],
51069
- setIsWizardOpen = _useState34[1];
51186
+ isLayoutPickerOpen = _useState34[0],
51187
+ setIsLayoutPickerOpen = _useState34[1];
51188
+ var _useState35 = useState(false),
51189
+ _useState36 = _slicedToArray(_useState35, 2),
51190
+ isWizardOpen = _useState36[0],
51191
+ setIsWizardOpen = _useState36[1];
51070
51192
 
51071
51193
  // Missing widgets detection
51072
51194
  var _useMissingWidgets = useMissingWidgets(workspaceSelected),
51073
51195
  missingComponents = _useMissingWidgets.missingComponents,
51074
51196
  hasMissing = _useMissingWidgets.hasMissing;
51075
- var _useState35 = useState(false),
51076
- _useState36 = _slicedToArray(_useState35, 2),
51077
- isMissingWidgetsModalOpen = _useState36[0],
51078
- setIsMissingWidgetsModalOpen = _useState36[1];
51079
- var _useState37 = useState(new Set()),
51197
+ var _useState37 = useState(false),
51080
51198
  _useState38 = _slicedToArray(_useState37, 2),
51081
- dismissedMissingForWorkspace = _useState38[0],
51082
- setDismissedMissingForWorkspace = _useState38[1];
51199
+ isMissingWidgetsModalOpen = _useState38[0],
51200
+ setIsMissingWidgetsModalOpen = _useState38[1];
51201
+ var _useState39 = useState(new Set()),
51202
+ _useState40 = _slicedToArray(_useState39, 2),
51203
+ dismissedMissingForWorkspace = _useState40[0],
51204
+ setDismissedMissingForWorkspace = _useState40[1];
51083
51205
 
51084
51206
  // Unified App Settings Modal
51085
- var _useState39 = useState(false),
51086
- _useState40 = _slicedToArray(_useState39, 2),
51087
- isAppSettingsOpen = _useState40[0],
51088
- setIsAppSettingsOpen = _useState40[1];
51089
- var _useState41 = useState("dashboards"),
51207
+ var _useState41 = useState(false),
51090
51208
  _useState42 = _slicedToArray(_useState41, 2),
51091
- appSettingsInitialSection = _useState42[0],
51092
- setAppSettingsInitialSection = _useState42[1];
51093
- var _useState43 = useState(null),
51209
+ isAppSettingsOpen = _useState42[0],
51210
+ setIsAppSettingsOpen = _useState42[1];
51211
+ var _useState43 = useState("dashboards"),
51094
51212
  _useState44 = _slicedToArray(_useState43, 2),
51095
- appSettingsInitialProvider = _useState44[0],
51096
- setAppSettingsInitialProvider = _useState44[1];
51097
- var _useState45 = useState(false),
51213
+ appSettingsInitialSection = _useState44[0],
51214
+ setAppSettingsInitialSection = _useState44[1];
51215
+ var _useState45 = useState(null),
51098
51216
  _useState46 = _slicedToArray(_useState45, 2),
51099
- appSettingsCreateProvider = _useState46[0],
51100
- setAppSettingsCreateProvider = _useState46[1];
51217
+ appSettingsInitialProvider = _useState46[0],
51218
+ setAppSettingsInitialProvider = _useState46[1];
51219
+ var _useState47 = useState(false),
51220
+ _useState48 = _slicedToArray(_useState47, 2),
51221
+ appSettingsCreateProvider = _useState48[0],
51222
+ setAppSettingsCreateProvider = _useState48[1];
51101
51223
  function openAppSettings() {
51102
51224
  var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
51103
51225
  var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -51503,10 +51625,29 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51503
51625
  }
51504
51626
 
51505
51627
  // ─── Page State ──────────────────────────────────────────────────
51506
- var _useState47 = useState(null),
51507
- _useState48 = _slicedToArray(_useState47, 2),
51508
- activePageId = _useState48[0],
51509
- setActivePageId = _useState48[1];
51628
+ var _useState49 = useState(null),
51629
+ _useState50 = _slicedToArray(_useState49, 2),
51630
+ activePageId = _useState50[0],
51631
+ setActivePageId = _useState50[1];
51632
+
51633
+ // Page history stack for goBack() — pushes the previous page id
51634
+ // whenever a navigation happens through navigateToPage().
51635
+ var pageHistoryRef = useRef([]);
51636
+
51637
+ // Wrapper that records history before switching pages.
51638
+ // Pass recordHistory=false to switch without recording (e.g. for goBack).
51639
+ var navigateToPage = useCallback(function (pageId) {
51640
+ var recordHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
51641
+ if (!pageId) return;
51642
+ if (recordHistory) {
51643
+ var _workspaceSelected$pa, _workspaceSelected$pa2;
51644
+ var prevId = activePageId || (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.activePageId) || ((_workspaceSelected$pa = workspaceSelected === null || workspaceSelected === void 0 || (_workspaceSelected$pa2 = workspaceSelected.pages) === null || _workspaceSelected$pa2 === void 0 || (_workspaceSelected$pa2 = _workspaceSelected$pa2[0]) === null || _workspaceSelected$pa2 === void 0 ? void 0 : _workspaceSelected$pa2.id) !== null && _workspaceSelected$pa !== void 0 ? _workspaceSelected$pa : null);
51645
+ if (prevId && prevId !== pageId) {
51646
+ pageHistoryRef.current.push(prevId);
51647
+ }
51648
+ }
51649
+ setActivePageId(pageId);
51650
+ }, [activePageId, workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.activePageId, workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages]);
51510
51651
 
51511
51652
  // Listen for programmatic page switches via DashboardActionsApi
51512
51653
  useEffect(function () {
@@ -51515,20 +51656,63 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51515
51656
  pageId = _ref4.pageId,
51516
51657
  pageName = _ref4.pageName;
51517
51658
  if (pageId) {
51518
- setActivePageId(pageId);
51659
+ navigateToPage(pageId);
51519
51660
  } else if (pageName) {
51520
51661
  var pages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
51521
51662
  var match = pages.find(function (p) {
51522
51663
  return p.name.toLowerCase() === pageName.toLowerCase();
51523
51664
  });
51524
- if (match) setActivePageId(match.id);
51665
+ if (match) navigateToPage(match.id);
51525
51666
  }
51526
51667
  }
51527
51668
  window.addEventListener("dash:switch-page", onSwitchPage);
51528
51669
  return function () {
51529
51670
  return window.removeEventListener("dash:switch-page", onSwitchPage);
51530
51671
  };
51531
- }, [workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages]);
51672
+ }, [workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages, navigateToPage]);
51673
+
51674
+ // Listen for runtime UX actions: goBack, sidebar control, notify
51675
+ useEffect(function () {
51676
+ function onGoBack() {
51677
+ var prev = pageHistoryRef.current.pop();
51678
+ if (prev) setActivePageId(prev); // bypass history recording
51679
+ }
51680
+ function onSetNavSidebar(e) {
51681
+ var _e$detail;
51682
+ setSidebarCollapsed(!!((_e$detail = e.detail) !== null && _e$detail !== void 0 && _e$detail.collapsed));
51683
+ }
51684
+ function onToggleNavSidebar() {
51685
+ setSidebarCollapsed(function (c) {
51686
+ return !c;
51687
+ });
51688
+ }
51689
+ function onNotify(e) {
51690
+ var id = "".concat(Date.now(), "-").concat(Math.random());
51691
+ var toast = _objectSpread$5({
51692
+ id: id
51693
+ }, e.detail || {});
51694
+ setToasts(function (prev) {
51695
+ return [].concat(_toConsumableArray(prev), [toast]);
51696
+ });
51697
+ setTimeout(function () {
51698
+ setToasts(function (prev) {
51699
+ return prev.filter(function (t) {
51700
+ return t.id !== id;
51701
+ });
51702
+ });
51703
+ }, toast.duration || 4000);
51704
+ }
51705
+ window.addEventListener("dash:go-back", onGoBack);
51706
+ window.addEventListener("dash:set-nav-sidebar", onSetNavSidebar);
51707
+ window.addEventListener("dash:toggle-nav-sidebar", onToggleNavSidebar);
51708
+ window.addEventListener("dash:notify", onNotify);
51709
+ return function () {
51710
+ window.removeEventListener("dash:go-back", onGoBack);
51711
+ window.removeEventListener("dash:set-nav-sidebar", onSetNavSidebar);
51712
+ window.removeEventListener("dash:toggle-nav-sidebar", onToggleNavSidebar);
51713
+ window.removeEventListener("dash:notify", onNotify);
51714
+ };
51715
+ }, []);
51532
51716
  var workspacePages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
51533
51717
 
51534
51718
  // Memoize sorted pages so page object references stay stable across re-renders
@@ -51544,6 +51728,71 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51544
51728
  return "".concat(p.id, ":").concat(p.order, ":").concat(p.name);
51545
51729
  }).join(",")]);
51546
51730
  var currentActivePageId = activePageId || (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.activePageId) || ((_workspacePages$0$id = (_workspacePages$ = workspacePages[0]) === null || _workspacePages$ === void 0 ? void 0 : _workspacePages$.id) !== null && _workspacePages$0$id !== void 0 ? _workspacePages$0$id : null);
51731
+
51732
+ // Stable refs for tab/dashboard handlers so the open/close-dashboard
51733
+ // listener doesn't have to re-subscribe on every render.
51734
+ var handleOpenTabRef = useRef(null);
51735
+ var handleCloseTabRef = useRef(null);
51736
+ var workspaceConfigRef = useRef([]);
51737
+ var openTabsRef = useRef([]);
51738
+ var activeTabIdRef = useRef(null);
51739
+ handleOpenTabRef.current = handleOpenTab;
51740
+ handleCloseTabRef.current = handleCloseTab;
51741
+ workspaceConfigRef.current = workspaceConfig;
51742
+ openTabsRef.current = openTabs;
51743
+ activeTabIdRef.current = activeTabId;
51744
+
51745
+ // Listen for open/close dashboard actions via DashboardActionsApi
51746
+ useEffect(function () {
51747
+ function onOpen(e) {
51748
+ var _e$detail2;
51749
+ var name = (_e$detail2 = e.detail) === null || _e$detail2 === void 0 ? void 0 : _e$detail2.name;
51750
+ if (!name) return;
51751
+ var ws = (workspaceConfigRef.current || []).find(function (w) {
51752
+ return (w.name || "").toLowerCase() === name.toLowerCase();
51753
+ });
51754
+ if (ws && handleOpenTabRef.current) handleOpenTabRef.current(ws);
51755
+ }
51756
+ function onClose(e) {
51757
+ var _e$detail3;
51758
+ var name = (_e$detail3 = e.detail) === null || _e$detail3 === void 0 ? void 0 : _e$detail3.name;
51759
+ if (name) {
51760
+ var tab = (openTabsRef.current || []).find(function (t) {
51761
+ return (t.name || "").toLowerCase() === name.toLowerCase();
51762
+ });
51763
+ if (tab && handleCloseTabRef.current) handleCloseTabRef.current(tab.id);
51764
+ } else if (activeTabIdRef.current && handleCloseTabRef.current) {
51765
+ handleCloseTabRef.current(activeTabIdRef.current);
51766
+ }
51767
+ }
51768
+ window.addEventListener("dash:open-dashboard", onOpen);
51769
+ window.addEventListener("dash:close-dashboard", onClose);
51770
+ return function () {
51771
+ window.removeEventListener("dash:open-dashboard", onOpen);
51772
+ window.removeEventListener("dash:close-dashboard", onClose);
51773
+ };
51774
+ }, []);
51775
+
51776
+ // Maintain window.__dashState so DashboardActionsApi read methods
51777
+ // (getCurrentPageName, listPages, etc.) return up-to-date values.
51778
+ useEffect(function () {
51779
+ var activePage = workspacePages.find(function (p) {
51780
+ return p.id === currentActivePageId;
51781
+ });
51782
+ window.__dashState = {
51783
+ currentPageId: currentActivePageId,
51784
+ currentPageName: (activePage === null || activePage === void 0 ? void 0 : activePage.name) || null,
51785
+ currentDashboardId: (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.id) || null,
51786
+ currentDashboardName: (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.name) || null,
51787
+ pages: workspacePages.map(function (p) {
51788
+ return {
51789
+ id: p.id,
51790
+ name: p.name,
51791
+ order: p.order
51792
+ };
51793
+ })
51794
+ };
51795
+ }, [currentActivePageId, workspacePages, workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.id, workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.name]);
51547
51796
  function handleAddPage() {
51548
51797
  if (!workspaceSelected) return;
51549
51798
  var existingPages = _toConsumableArray(workspacePages);
@@ -51557,7 +51806,7 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51557
51806
  handleWorkspaceChange(updatedWorkspace);
51558
51807
  }
51559
51808
  function handleSwitchPage(pageId) {
51560
- setActivePageId(pageId);
51809
+ navigateToPage(pageId);
51561
51810
  }
51562
51811
  function handleRenamePage(pageId, newName) {
51563
51812
  if (!workspaceSelected) return;
@@ -52028,7 +52277,25 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
52028
52277
  direction: "col",
52029
52278
  scrollable: false,
52030
52279
  grow: true,
52031
- children: [/*#__PURE__*/jsxs(DndProvider, {
52280
+ children: [toasts.length > 0 && /*#__PURE__*/jsx("div", {
52281
+ className: "fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",
52282
+ children: toasts.map(function (t) {
52283
+ return /*#__PURE__*/jsx("div", {
52284
+ className: "pointer-events-auto",
52285
+ children: /*#__PURE__*/jsx(Toast, {
52286
+ title: t.title,
52287
+ message: t.message,
52288
+ onClose: function onClose() {
52289
+ return setToasts(function (prev) {
52290
+ return prev.filter(function (x) {
52291
+ return x.id !== t.id;
52292
+ });
52293
+ });
52294
+ }
52295
+ })
52296
+ }, t.id);
52297
+ })
52298
+ }), /*#__PURE__*/jsxs(DndProvider, {
52032
52299
  backend: HTML5Backend,
52033
52300
  children: [/*#__PURE__*/jsxs("div", {
52034
52301
  className: "flex flex-row flex-1 overflow-hidden",