@trops/dash-core 0.1.35 → 0.1.37

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.js CHANGED
@@ -7931,7 +7931,7 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
7931
7931
  }), selectedWidget.packageDescription && /*#__PURE__*/jsxRuntime.jsx("div", {
7932
7932
  className: "mb-2",
7933
7933
  children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Paragraph, {
7934
- padding: false,
7934
+ padding: "py-2",
7935
7935
  className: "text-sm",
7936
7936
  children: selectedWidget.packageDescription
7937
7937
  })
@@ -8244,7 +8244,7 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
8244
8244
  }), selectedWidget.description && /*#__PURE__*/jsxRuntime.jsx("div", {
8245
8245
  className: "mb-2",
8246
8246
  children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Paragraph, {
8247
- padding: false,
8247
+ padding: "py-2",
8248
8248
  className: "text-sm",
8249
8249
  children: selectedWidget.description
8250
8250
  })
@@ -30695,7 +30695,11 @@ var DashboardStage = function DashboardStage(_ref) {
30695
30695
  _ref$preview = _ref.preview,
30696
30696
  preview = _ref$preview === void 0 ? true : _ref$preview,
30697
30697
  _ref$backgroundColor = _ref.backgroundColor,
30698
- backgroundColor = _ref$backgroundColor === void 0 ? null : _ref$backgroundColor;
30698
+ backgroundColor = _ref$backgroundColor === void 0 ? null : _ref$backgroundColor,
30699
+ _ref$popout = _ref.popout,
30700
+ popout = _ref$popout === void 0 ? false : _ref$popout,
30701
+ _ref$popoutWorkspaceI = _ref.popoutWorkspaceId,
30702
+ popoutWorkspaceId = _ref$popoutWorkspaceI === void 0 ? null : _ref$popoutWorkspaceI;
30699
30703
  return /*#__PURE__*/jsxRuntime.jsx(React.Profiler, {
30700
30704
  id: "myapp",
30701
30705
  onRender: function onRender() {},
@@ -30708,7 +30712,9 @@ var DashboardStage = function DashboardStage(_ref) {
30708
30712
  credentials: credentials,
30709
30713
  workspace: workspace,
30710
30714
  preview: preview,
30711
- backgroundColor: backgroundColor
30715
+ backgroundColor: backgroundColor,
30716
+ popout: popout,
30717
+ popoutWorkspaceId: popoutWorkspaceId
30712
30718
  })
30713
30719
  })
30714
30720
  });
@@ -30722,6 +30728,10 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
30722
30728
  _ref2$preview = _ref2.preview,
30723
30729
  preview = _ref2$preview === void 0 ? true : _ref2$preview;
30724
30730
  _ref2.backgroundColor;
30731
+ var _ref2$popout = _ref2.popout,
30732
+ popout = _ref2$popout === void 0 ? false : _ref2$popout,
30733
+ _ref2$popoutWorkspace = _ref2.popoutWorkspaceId,
30734
+ popoutWorkspaceId = _ref2$popoutWorkspace === void 0 ? null : _ref2$popoutWorkspace;
30725
30735
  var _useContext = React.useContext(DashboardContext),
30726
30736
  pub = _useContext.pub;
30727
30737
  var appContext = React.useContext(AppContext);
@@ -30836,6 +30846,41 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
30836
30846
  // eslint-disable-next-line react-hooks/exhaustive-deps
30837
30847
  }, [workspace]);
30838
30848
 
30849
+ // ─── Popout: auto-load workspace by ID ──────────────────────────
30850
+ React.useEffect(function () {
30851
+ if (!popout || popoutWorkspaceId === null) return;
30852
+ if (workspaceConfig.length === 0) return;
30853
+ var target = workspaceConfig.find(function (ws) {
30854
+ return ws.id === popoutWorkspaceId;
30855
+ });
30856
+ if (target) {
30857
+ var _window$mainApi;
30858
+ handleOpenTab(target);
30859
+ if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.popout) !== null && _window$mainApi !== void 0 && _window$mainApi.setTitle) {
30860
+ window.mainApi.popout.setTitle(popoutWorkspaceId, target.name || "Untitled");
30861
+ }
30862
+ }
30863
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30864
+ }, [popout, popoutWorkspaceId, workspaceConfig]);
30865
+
30866
+ // ─── Popout: listen for workspace:saved broadcasts ─────────────
30867
+ React.useEffect(function () {
30868
+ var _window$mainApi2;
30869
+ if (!popout) return;
30870
+ if (!((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.on)) return;
30871
+ var handler = function handler() {
30872
+ loadWorkspaces();
30873
+ };
30874
+ window.mainApi.on("workspace:saved", handler);
30875
+ return function () {
30876
+ var _window$mainApi3;
30877
+ if ((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.removeListener) {
30878
+ window.mainApi.removeListener("workspace:saved", handler);
30879
+ }
30880
+ };
30881
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30882
+ }, [popout]);
30883
+
30839
30884
  // ─── Tab Handlers ─────────────────────────────────────────────────
30840
30885
 
30841
30886
  function handleOpenTab(workspaceItem) {
@@ -31211,6 +31256,12 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
31211
31256
  function handleToggleThemeVariant() {
31212
31257
  changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
31213
31258
  }
31259
+ function handlePopout() {
31260
+ var _window$mainApi4;
31261
+ if (workspaceSelected && (_window$mainApi4 = window.mainApi) !== null && _window$mainApi4 !== void 0 && (_window$mainApi4 = _window$mainApi4.popout) !== null && _window$mainApi4 !== void 0 && _window$mainApi4.open) {
31262
+ window.mainApi.popout.open(workspaceSelected.id);
31263
+ }
31264
+ }
31214
31265
  return /*#__PURE__*/jsxRuntime.jsxs(LayoutContainer, {
31215
31266
  padding: false,
31216
31267
  space: false,
@@ -31223,7 +31274,7 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
31223
31274
  backend: reactDndHtml5Backend.HTML5Backend,
31224
31275
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
31225
31276
  className: "flex flex-row flex-1 overflow-hidden",
31226
- children: [/*#__PURE__*/jsxRuntime.jsx(DashSidebar, {
31277
+ children: [!popout && /*#__PURE__*/jsxRuntime.jsx(DashSidebar, {
31227
31278
  collapsed: sidebarCollapsed,
31228
31279
  onCollapsedChange: setSidebarCollapsed,
31229
31280
  workspaces: workspaceConfig,
@@ -31254,23 +31305,24 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
31254
31305
  children: workspaceSelected !== null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
31255
31306
  children: [/*#__PURE__*/jsxRuntime.jsx(DashboardHeader, {
31256
31307
  workspace: workspaceSelected,
31257
- preview: previewMode,
31308
+ preview: popout ? true : previewMode,
31258
31309
  onNameChange: handleWorkspaceNameChange,
31259
- onClickEdit: handleToggleEditMode,
31260
- onSaveChanges: handleClickSaveWorkspace,
31310
+ onClickEdit: popout ? null : handleToggleEditMode,
31311
+ onPopout: popout ? null : handlePopout,
31312
+ onSaveChanges: popout ? null : handleClickSaveWorkspace,
31261
31313
  menuItems: menuItems,
31262
31314
  themes: themes || {},
31263
- onFolderChange: handleWorkspaceFolderChange,
31264
- onThemeChange: handleWorkspaceThemeChange,
31315
+ onFolderChange: popout ? null : handleWorkspaceFolderChange,
31316
+ onThemeChange: popout ? null : handleWorkspaceThemeChange,
31265
31317
  scrollableEnabled: getRootScrollable(),
31266
- onScrollableChange: handleScrollableChange
31318
+ onScrollableChange: popout ? null : handleScrollableChange
31267
31319
  }), /*#__PURE__*/jsxRuntime.jsx(DashboardThemeProvider, {
31268
31320
  themeKey: workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.themeKey,
31269
31321
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
31270
- className: "flex flex-col w-full flex-1 ".concat(previewMode === true ? "overflow-y-auto" : "overflow-clip"),
31322
+ className: "flex flex-col w-full flex-1 ".concat(popout || previewMode === true ? "overflow-y-auto" : "overflow-clip"),
31271
31323
  children: renderComponent(workspaceSelected)
31272
31324
  })
31273
- }), /*#__PURE__*/jsxRuntime.jsx(DashTabBar, {
31325
+ }), !popout && /*#__PURE__*/jsxRuntime.jsx(DashTabBar, {
31274
31326
  tabs: openTabs,
31275
31327
  activeTabId: activeTabId,
31276
31328
  onSwitchTab: handleSwitchTab,
@@ -31283,9 +31335,9 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
31283
31335
  icon: "clone",
31284
31336
  className: "h-12 w-12"
31285
31337
  }),
31286
- title: "No dashboards open",
31287
- description: "Press \u2318K to search dashboards, or create a new one.",
31288
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
31338
+ title: popout ? "Dashboard not found" : "No dashboards open",
31339
+ description: popout ? "The requested dashboard could not be loaded." : "Press \u2318K to search dashboards, or create a new one.",
31340
+ children: !popout && /*#__PURE__*/jsxRuntime.jsxs("div", {
31289
31341
  className: "flex flex-row gap-2",
31290
31342
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
31291
31343
  icon: "magnifying-glass",
@@ -31303,51 +31355,53 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
31303
31355
  })
31304
31356
  })
31305
31357
  })
31306
- }), !previewMode && workspaceSelected && /*#__PURE__*/jsxRuntime.jsx(WidgetSidebar, {
31358
+ }), !popout && !previewMode && workspaceSelected && /*#__PURE__*/jsxRuntime.jsx(WidgetSidebar, {
31307
31359
  collapsed: widgetSidebarCollapsed,
31308
31360
  onCollapsedChange: setWidgetSidebarCollapsed
31309
31361
  })]
31310
- }), /*#__PURE__*/jsxRuntime.jsx(AppSettingsModal, {
31311
- isOpen: isAppSettingsOpen,
31312
- setIsOpen: setIsAppSettingsOpen,
31313
- initialSection: appSettingsInitialSection,
31314
- workspaces: workspaceConfig,
31315
- menuItems: menuItems,
31316
- dashApi: dashApi,
31317
- credentials: credentials,
31318
- onReloadWorkspaces: loadWorkspaces,
31319
- onReloadMenuItems: loadMenuItems,
31320
- onOpenThemeEditor: function onOpenThemeEditor() {
31321
- setIsAppSettingsOpen(false);
31322
- setIsThemeManagerOpen(true);
31323
- }
31324
- }), /*#__PURE__*/jsxRuntime.jsx(ThemeManagerModal, {
31325
- open: isThemeManagerOpen,
31326
- setIsOpen: function setIsOpen() {
31327
- return setIsThemeManagerOpen(!isThemeManagerOpen);
31328
- },
31329
- onSave: function onSave(themeKey) {
31330
- changeCurrentTheme(themeKey);
31331
- setIsThemeManagerOpen(function () {
31332
- return false;
31333
- });
31334
- }
31335
- }), /*#__PURE__*/jsxRuntime.jsx(DashboardLoaderModal, {
31336
- open: isDashboardLoaderOpen,
31337
- setIsOpen: setIsDashboardLoaderOpen,
31338
- workspaces: workspaceConfig,
31339
- onSelecDashboard: handleSelectLoadDashboard,
31340
- onClose: function onClose() {
31341
- return handleCloseDashboardLoader();
31342
- }
31343
- }), /*#__PURE__*/jsxRuntime.jsx(LayoutManagerModal, {
31344
- open: isLayoutPickerOpen,
31345
- setIsOpen: setIsLayoutPickerOpen,
31346
- onCreateWorkspace: handleCreateFromTemplate,
31347
- menuItems: menuItems,
31348
- onSaveMenuItem: handleSaveNewMenuItem
31362
+ }), !popout && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
31363
+ children: [/*#__PURE__*/jsxRuntime.jsx(AppSettingsModal, {
31364
+ isOpen: isAppSettingsOpen,
31365
+ setIsOpen: setIsAppSettingsOpen,
31366
+ initialSection: appSettingsInitialSection,
31367
+ workspaces: workspaceConfig,
31368
+ menuItems: menuItems,
31369
+ dashApi: dashApi,
31370
+ credentials: credentials,
31371
+ onReloadWorkspaces: loadWorkspaces,
31372
+ onReloadMenuItems: loadMenuItems,
31373
+ onOpenThemeEditor: function onOpenThemeEditor() {
31374
+ setIsAppSettingsOpen(false);
31375
+ setIsThemeManagerOpen(true);
31376
+ }
31377
+ }), /*#__PURE__*/jsxRuntime.jsx(ThemeManagerModal, {
31378
+ open: isThemeManagerOpen,
31379
+ setIsOpen: function setIsOpen() {
31380
+ return setIsThemeManagerOpen(!isThemeManagerOpen);
31381
+ },
31382
+ onSave: function onSave(themeKey) {
31383
+ changeCurrentTheme(themeKey);
31384
+ setIsThemeManagerOpen(function () {
31385
+ return false;
31386
+ });
31387
+ }
31388
+ }), /*#__PURE__*/jsxRuntime.jsx(DashboardLoaderModal, {
31389
+ open: isDashboardLoaderOpen,
31390
+ setIsOpen: setIsDashboardLoaderOpen,
31391
+ workspaces: workspaceConfig,
31392
+ onSelecDashboard: handleSelectLoadDashboard,
31393
+ onClose: function onClose() {
31394
+ return handleCloseDashboardLoader();
31395
+ }
31396
+ }), /*#__PURE__*/jsxRuntime.jsx(LayoutManagerModal, {
31397
+ open: isLayoutPickerOpen,
31398
+ setIsOpen: setIsLayoutPickerOpen,
31399
+ onCreateWorkspace: handleCreateFromTemplate,
31400
+ menuItems: menuItems,
31401
+ onSaveMenuItem: handleSaveNewMenuItem
31402
+ })]
31349
31403
  })]
31350
- }), /*#__PURE__*/jsxRuntime.jsx(DashCommandPalette, {
31404
+ }), !popout && /*#__PURE__*/jsxRuntime.jsx(DashCommandPalette, {
31351
31405
  isOpen: isCommandPaletteOpen,
31352
31406
  setIsOpen: setIsCommandPaletteOpen,
31353
31407
  workspaces: workspaceConfig,
@@ -31480,6 +31534,8 @@ var DashboardHeader = function DashboardHeader(_ref) {
31480
31534
  preview = _ref.preview,
31481
31535
  _ref$onClickEdit = _ref.onClickEdit,
31482
31536
  onClickEdit = _ref$onClickEdit === void 0 ? null : _ref$onClickEdit,
31537
+ _ref$onPopout = _ref.onPopout,
31538
+ onPopout = _ref$onPopout === void 0 ? null : _ref$onPopout,
31483
31539
  onNameChange = _ref.onNameChange,
31484
31540
  _ref$onSaveChanges = _ref.onSaveChanges,
31485
31541
  onSaveChanges = _ref$onSaveChanges === void 0 ? null : _ref$onSaveChanges,
@@ -31519,10 +31575,17 @@ var DashboardHeader = function DashboardHeader(_ref) {
31519
31575
  }),
31520
31576
  padding: false,
31521
31577
  className: "font-bold text-base"
31522
- }), onClickEdit !== null && /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
31523
- icon: "pencil",
31524
- onClick: onClickEdit,
31525
- hoverBackgroundColor: "hover:bg-indigo-700"
31578
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
31579
+ className: "flex flex-row items-center gap-1",
31580
+ children: [onPopout !== null && /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
31581
+ icon: "arrow-up-right-from-square",
31582
+ onClick: onPopout,
31583
+ hoverBackgroundColor: "hover:bg-indigo-700"
31584
+ }), onClickEdit !== null && /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
31585
+ icon: "pencil",
31586
+ onClick: onClickEdit,
31587
+ hoverBackgroundColor: "hover:bg-indigo-700"
31588
+ })]
31526
31589
  })]
31527
31590
  }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
31528
31591
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {