@trops/dash-core 0.1.43 → 0.1.45

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
@@ -122,14 +122,36 @@ var event = {
122
122
  this.list = new Map();
123
123
  }
124
124
  };
125
+ var ipcBridgeListener = null;
125
126
  var DashboardPublisher = {
126
127
  sub: function sub(eventType, action, uuid) {
127
128
  event.on(eventType, action, uuid);
128
129
  },
129
130
  pub: function pub(eventType, content) {
131
+ var _window$mainApi;
130
132
  event.emit(eventType, content);
131
- // send to ALL
132
- // event.emit("DashboardPublisher.monitor", { eventType, content });
133
+
134
+ // Forward to other windows via IPC bridge
135
+ if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && _window$mainApi.widgetEvent) {
136
+ window.mainApi.widgetEvent.publish(eventType, content);
137
+ }
138
+ },
139
+ enableIpcBridge: function enableIpcBridge() {
140
+ var _window$mainApi2;
141
+ if (ipcBridgeListener) return;
142
+ if (!((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.on)) return;
143
+ ipcBridgeListener = function ipcBridgeListener(_e, message) {
144
+ event.emit(message.eventType, message.content);
145
+ };
146
+ window.mainApi.on("widget-event:broadcast", ipcBridgeListener);
147
+ },
148
+ disableIpcBridge: function disableIpcBridge() {
149
+ var _window$mainApi3;
150
+ if (!ipcBridgeListener) return;
151
+ if ((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.removeListener) {
152
+ window.mainApi.removeListener("widget-event:broadcast", ipcBridgeListener);
153
+ }
154
+ ipcBridgeListener = null;
133
155
  },
134
156
  listeners: function listeners() {
135
157
  return event.list;
@@ -2471,6 +2493,12 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2471
2493
  w.setElectronApi(dashApi);
2472
2494
  return w;
2473
2495
  }, [dashApi]);
2496
+ React.useEffect(function () {
2497
+ DashboardPublisher.enableIpcBridge();
2498
+ return function () {
2499
+ return DashboardPublisher.disableIpcBridge();
2500
+ };
2501
+ }, []);
2474
2502
  var providers = (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || EMPTY_PROVIDERS;
2475
2503
  var contextValue = React.useMemo(function () {
2476
2504
  return {
@@ -14022,6 +14050,37 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
14022
14050
  return cells;
14023
14051
  }
14024
14052
 
14053
+ // Hover-based popout overlay — avoids Tailwind named groups (requires v3.4+)
14054
+ function PopoutOverlay(_ref6) {
14055
+ var children = _ref6.children,
14056
+ onPopout = _ref6.onPopout;
14057
+ var _React$useState = React.useState(false),
14058
+ _React$useState2 = _slicedToArray(_React$useState, 2),
14059
+ hovered = _React$useState2[0],
14060
+ setHovered = _React$useState2[1];
14061
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
14062
+ className: "relative w-full h-full",
14063
+ onMouseEnter: function onMouseEnter() {
14064
+ return setHovered(true);
14065
+ },
14066
+ onMouseLeave: function onMouseLeave() {
14067
+ return setHovered(false);
14068
+ },
14069
+ children: [children, /*#__PURE__*/jsxRuntime.jsx("button", {
14070
+ className: "absolute top-1 right-1 p-1 rounded transition-opacity bg-black/60 hover:bg-black/80 text-gray-300 hover:text-white z-10 ".concat(hovered ? "opacity-100" : "opacity-0 pointer-events-none"),
14071
+ onClick: function onClick(e) {
14072
+ e.stopPropagation();
14073
+ onPopout();
14074
+ },
14075
+ title: "Pop out widget",
14076
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
14077
+ icon: "arrow-up-right-from-square",
14078
+ className: "h-3 w-3"
14079
+ })
14080
+ })]
14081
+ });
14082
+ }
14083
+
14025
14084
  // Render component inside a grid cell (preview mode only)
14026
14085
  function renderCellComponent(componentId, cellNumber, selectableSet) {
14027
14086
  if (!layout || !workspace) {
@@ -14035,20 +14094,11 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
14035
14094
  }
14036
14095
  var rendered = renderComponent(cellComponent.component, cellComponent.id, cellComponent, null);
14037
14096
  if (onWidgetPopout && cellComponent.component) {
14038
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
14039
- className: "relative w-full h-full group/popout",
14040
- children: [rendered, /*#__PURE__*/jsxRuntime.jsx("button", {
14041
- className: "absolute top-1 right-1 p-1 rounded opacity-0 group-hover/popout:opacity-100 transition-opacity bg-black/60 hover:bg-black/80 text-gray-300 hover:text-white z-10",
14042
- onClick: function onClick(e) {
14043
- e.stopPropagation();
14044
- onWidgetPopout(cellComponent.id);
14045
- },
14046
- title: "Pop out widget",
14047
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
14048
- icon: "arrow-up-right-from-square",
14049
- className: "h-3 w-3"
14050
- })
14051
- })]
14097
+ return /*#__PURE__*/jsxRuntime.jsx(PopoutOverlay, {
14098
+ onPopout: function onPopout() {
14099
+ return onWidgetPopout(cellComponent.id);
14100
+ },
14101
+ children: rendered
14052
14102
  });
14053
14103
  }
14054
14104
  return rendered;