@qodalis/react-cli 2.0.0-beta.12 → 2.0.0-beta.13

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.mjs CHANGED
@@ -289,7 +289,7 @@ var CliPanel = React3.forwardRef(
289
289
  const [statusServerState, setStatusServerState] = useState2("none");
290
290
  const [statusServerDetails, setStatusServerDetails] = useState2([]);
291
291
  const [statusUptime, setStatusUptime] = useState2(0);
292
- const [statusText, setStatusText] = useState2(null);
292
+ const [notification, setNotification] = useState2(null);
293
293
  const [servicesDropdownOpen, setServicesDropdownOpen] = useState2(false);
294
294
  const [serversDropdownOpen, setServersDropdownOpen] = useState2(false);
295
295
  const servicesDropdownRef = useRef3(null);
@@ -542,8 +542,8 @@ var CliPanel = React3.forwardRef(
542
542
  setStatusExecutionState(running ? "running" : "idle");
543
543
  const result = context.lastCommandResult;
544
544
  setStatusLastCommand(result ? { name: result.command, success: result.success } : null);
545
- const text = context.getStatusText?.();
546
- setStatusText(text || null);
545
+ const notif = context.notifier?.current;
546
+ setNotification(notif || null);
547
547
  }, 300);
548
548
  const pollGlobal = setInterval(() => {
549
549
  const tab = tabs.find((t) => t.id === activeTabIdRef.current);
@@ -867,7 +867,41 @@ var CliPanel = React3.forwardRef(
867
867
  /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-icon", children: "\u2191" }),
868
868
  /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-label", children: formattedUptime })
869
869
  ] }),
870
- statusText && /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-item status-text", children: /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-label", children: statusText }) })
870
+ notification && /* @__PURE__ */ jsx3("span", { className: `cli-panel-status-item status-text level-${notification.level}`, children: /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-label", children: notification.message }) })
871
+ ] }),
872
+ /* @__PURE__ */ jsxs("div", { className: "cli-panel-status-indicators-compact", children: [
873
+ /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-compact-item", title: statusExecutionState, children: /* @__PURE__ */ jsx3("span", { className: `cli-panel-status-dot ${statusExecutionState === "running" ? "dot-running" : "dot-idle"}` }) }),
874
+ statusServiceCount.total > 0 && /* @__PURE__ */ jsx3(
875
+ "span",
876
+ {
877
+ ref: servicesDropdownRef,
878
+ className: "cli-panel-status-compact-item status-clickable",
879
+ title: `${statusServiceCount.running}/${statusServiceCount.total} services`,
880
+ onClick: (e) => {
881
+ e.stopPropagation();
882
+ setServicesDropdownOpen((prev) => !prev);
883
+ setServersDropdownOpen(false);
884
+ },
885
+ children: /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-icon", children: "\u2699" })
886
+ }
887
+ ),
888
+ statusLastCommand && /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-compact-item", title: `${statusLastCommand.success ? "\u2713" : "\u2717"} ${statusLastCommand.name}`, children: /* @__PURE__ */ jsx3("span", { className: `cli-panel-status-icon ${statusLastCommand.success ? "status-success" : "status-error"}`, children: statusLastCommand.success ? "\u2713" : "\u2717" }) }),
889
+ statusServerState !== "none" && /* @__PURE__ */ jsx3(
890
+ "span",
891
+ {
892
+ ref: serversDropdownRef,
893
+ className: "cli-panel-status-compact-item status-clickable",
894
+ title: `${statusServerDetails.filter((s) => s.connected).length}/${statusServerDetails.length} servers`,
895
+ onClick: (e) => {
896
+ e.stopPropagation();
897
+ setServersDropdownOpen((prev) => !prev);
898
+ setServicesDropdownOpen(false);
899
+ },
900
+ children: /* @__PURE__ */ jsx3("span", { className: `cli-panel-status-dot ${statusServerState === "connected" ? "dot-idle" : "dot-error"}` })
901
+ }
902
+ ),
903
+ statusUptime > 0 && /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-compact-item status-muted", title: formattedUptime, children: /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-icon", children: "\u2191" }) }),
904
+ notification && /* @__PURE__ */ jsx3("span", { className: "cli-panel-status-compact-item", title: notification.message, children: /* @__PURE__ */ jsx3("span", { className: `cli-panel-status-compact-dot level-${notification.level}` }) })
871
905
  ] }),
872
906
  /* @__PURE__ */ jsxs("div", { className: "cli-panel-action-buttons", children: [
873
907
  /* @__PURE__ */ jsxs("div", { className: "cli-panel-btn-position-wrapper", onClick: (e) => e.stopPropagation(), children: [
@@ -1062,7 +1096,17 @@ var CliPanel = React3.forwardRef(
1062
1096
  const el = servicesDropdownRef.current;
1063
1097
  if (!el) return {};
1064
1098
  const rect = el.getBoundingClientRect();
1065
- return position === "top" ? { position: "fixed", top: rect.bottom + 4, left: rect.left, zIndex: 1100 } : { position: "fixed", bottom: window.innerHeight - rect.top + 4, left: rect.left, zIndex: 1100 };
1099
+ const base = { position: "fixed", zIndex: 1100 };
1100
+ switch (position) {
1101
+ case "top":
1102
+ return { ...base, top: rect.bottom + 4, left: rect.left };
1103
+ case "left":
1104
+ return { ...base, top: rect.top, left: rect.right + 4 };
1105
+ case "right":
1106
+ return { ...base, top: rect.top, right: window.innerWidth - rect.left + 4 };
1107
+ default:
1108
+ return { ...base, bottom: window.innerHeight - rect.top + 4, left: rect.left };
1109
+ }
1066
1110
  })(),
1067
1111
  onClick: (e) => e.stopPropagation(),
1068
1112
  children: [
@@ -1087,7 +1131,17 @@ var CliPanel = React3.forwardRef(
1087
1131
  const el = serversDropdownRef.current;
1088
1132
  if (!el) return {};
1089
1133
  const rect = el.getBoundingClientRect();
1090
- return position === "top" ? { position: "fixed", top: rect.bottom + 4, left: rect.left, zIndex: 1100 } : { position: "fixed", bottom: window.innerHeight - rect.top + 4, left: rect.left, zIndex: 1100 };
1134
+ const base = { position: "fixed", zIndex: 1100 };
1135
+ switch (position) {
1136
+ case "top":
1137
+ return { ...base, top: rect.bottom + 4, left: rect.left };
1138
+ case "left":
1139
+ return { ...base, top: rect.top, left: rect.right + 4 };
1140
+ case "right":
1141
+ return { ...base, top: rect.top, right: window.innerWidth - rect.left + 4 };
1142
+ default:
1143
+ return { ...base, bottom: window.innerHeight - rect.top + 4, left: rect.left };
1144
+ }
1091
1145
  })(),
1092
1146
  onClick: (e) => e.stopPropagation(),
1093
1147
  children: [