@sentinel-core/sentinel 1.0.40 → 1.0.42

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.
@@ -2306,13 +2306,13 @@ function G(...e) {
2306
2306
  //#region src/ui/components/Tabs.tsx
2307
2307
  var pn = Ae, mn = e.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e.createElement(Ne, {
2308
2308
  ref: r,
2309
- className: G("inline-flex h-10 items-center justify-center rounded-md bg-muted !p-1 text-muted-foreground", t),
2309
+ className: G("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", t),
2310
2310
  ...n
2311
2311
  }));
2312
2312
  mn.displayName = Ne.displayName;
2313
2313
  var K = e.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e.createElement(ze, {
2314
2314
  ref: r,
2315
- className: G("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3! py-1.5! text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs", t),
2315
+ className: G("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs", t),
2316
2316
  ...n
2317
2317
  }));
2318
2318
  K.displayName = ze.displayName;
@@ -4024,7 +4024,7 @@ var Co = (e) => {
4024
4024
  let [t] = e.split(":");
4025
4025
  return t.replace(/\\/g, "/").split("/").slice(-3).join("/");
4026
4026
  }, Oo = () => {
4027
- let { openDialogId: e, closeDialog: n, dialogMeta: r } = rd();
4027
+ let { openDialogId: e, closeDialog: n, dialogMeta: r } = ad();
4028
4028
  return /* @__PURE__ */ t.createElement($i, {
4029
4029
  open: e !== null,
4030
4030
  onOpenChange: (e) => !e && n()
@@ -4034,7 +4034,13 @@ var Co = (e) => {
4034
4034
  }, /* @__PURE__ */ t.createElement(na, { className: "h-fit overflow-y-auto" }, /* @__PURE__ */ t.createElement(ra, null, /* @__PURE__ */ t.createElement(aa, { className: "text-center" }, /* @__PURE__ */ t.createElement("span", { className: "flex items-center justify-center gap-2" }, r != null && r.componentName ? /* @__PURE__ */ t.createElement("span", null, /* @__PURE__ */ t.createElement("span", { className: "text-muted-foreground font-normal" }, "<"), r.componentName, /* @__PURE__ */ t.createElement("span", { className: "text-muted-foreground font-normal" }, " />")) : "Sentinel", (r == null ? void 0 : r.renderCount) !== void 0 && /* @__PURE__ */ t.createElement("span", { className: "text-xs font-normal bg-muted text-muted-foreground px-1.5 py-0.5 rounded-full" }, "×", r.renderCount)), (r == null ? void 0 : r.sourceFile) && /* @__PURE__ */ t.createElement("a", {
4035
4035
  href: `vscode://file/${r.sourceFile}`,
4036
4036
  className: "block text-xs font-normal text-muted-foreground hover:text-sky-400 transition-colors mt-0.5 font-mono"
4037
- }, Do(r.sourceFile))), /* @__PURE__ */ t.createElement(oa, null, /* @__PURE__ */ t.createElement(mn, { className: "grid w-full grid-cols-4" }, /* @__PURE__ */ t.createElement(K, { value: "md" }, ".md"), /* @__PURE__ */ t.createElement(K, { value: "props-tracker" }, "Props Tracker"), /* @__PURE__ */ t.createElement(K, { value: "api-layer" }, "API Layer"), /* @__PURE__ */ t.createElement(K, { value: "event-tracker" }, "Event Tracker")))), /* @__PURE__ */ t.createElement(q, { value: "md" }, /* @__PURE__ */ t.createElement(da, { content: (r == null ? void 0 : r.md) || "" })), /* @__PURE__ */ t.createElement(q, { value: "props-tracker" }, r.componentProps && /* @__PURE__ */ t.createElement(Eo, {
4037
+ }, Do(r.sourceFile)), (r == null ? void 0 : r.externalLinks) && r.externalLinks.length > 0 && /* @__PURE__ */ t.createElement("span", { className: "flex items-center justify-center gap-2 mt-1" }, r.externalLinks.map((e) => /* @__PURE__ */ t.createElement("a", {
4038
+ key: e.url,
4039
+ href: e.url,
4040
+ target: "_blank",
4041
+ rel: "noopener noreferrer",
4042
+ className: "text-xs font-normal text-sky-400 hover:text-sky-300 transition-colors"
4043
+ }, e.label, " →")))), /* @__PURE__ */ t.createElement(oa, null, /* @__PURE__ */ t.createElement(mn, { className: "grid w-full grid-cols-4" }, /* @__PURE__ */ t.createElement(K, { value: "md" }, ".md"), /* @__PURE__ */ t.createElement(K, { value: "props-tracker" }, "Props Tracker"), /* @__PURE__ */ t.createElement(K, { value: "api-layer" }, "API Layer"), /* @__PURE__ */ t.createElement(K, { value: "event-tracker" }, "Event Tracker")))), /* @__PURE__ */ t.createElement(q, { value: "md" }, /* @__PURE__ */ t.createElement(da, { content: (r == null ? void 0 : r.md) || "" })), /* @__PURE__ */ t.createElement(q, { value: "props-tracker" }, r.componentProps && /* @__PURE__ */ t.createElement(Eo, {
4038
4044
  data: r.componentProps,
4039
4045
  history: r.propHistory
4040
4046
  })), /* @__PURE__ */ t.createElement(q, { value: "api-layer" }), /* @__PURE__ */ t.createElement(q, { value: "event-tracker" }), /* @__PURE__ */ t.createElement(ia, null))));
@@ -6041,28 +6047,53 @@ var Fu = 100, Iu = (e) => {
6041
6047
  resolved: "text-emerald-400",
6042
6048
  rejected: "text-red-400",
6043
6049
  cancelled: "text-muted-foreground"
6044
- }, Wu = ({ effects: e }) => e.length === 0 ? /* @__PURE__ */ t.createElement("div", { className: "py-4 text-center text-xs text-muted-foreground" }, "No calls captured yet.") : /* @__PURE__ */ t.createElement(_o, {
6045
- type: "multiple",
6046
- className: "w-full font-mono text-xs"
6047
- }, e.map((e) => {
6048
- var n, r;
6049
- return /* @__PURE__ */ t.createElement(vo, {
6050
- key: e.id,
6051
- value: String(e.id)
6052
- }, /* @__PURE__ */ t.createElement(bo, { className: "py-2 px-2 hover:no-underline hover:bg-muted/50 rounded font-mono text-xs font-normal" }, /* @__PURE__ */ t.createElement("span", { className: G("shrink-0 w-4 text-center", Uu[e.status]) }, Hu[e.status]), /* @__PURE__ */ t.createElement("span", { className: "flex-1 truncate text-left text-foreground mx-2" }, e.fnName), e.duration !== void 0 && /* @__PURE__ */ t.createElement("span", { className: "shrink-0 text-muted-foreground mr-1" }, e.duration, "ms")), /* @__PURE__ */ t.createElement(xo, { className: "pb-2! pt-0 px-2" }, /* @__PURE__ */ t.createElement("div", { className: "space-y-1.5" }, ((n = (r = e.args) == null ? void 0 : r.length) == null ? 0 : n) > 0 && /* @__PURE__ */ t.createElement("div", { className: "bg-muted p-2! rounded overflow-x-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "text-muted-foreground mb-1!" }, "args"), /* @__PURE__ */ t.createElement(ma, {
6053
- value: e.args,
6054
- collapseFromDepth: 1
6055
- })), e.result !== void 0 && /* @__PURE__ */ t.createElement("div", { className: "bg-primary text-primary-foreground p-2! rounded overflow-x-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "text-muted-foreground mb-1" }, "result"), /* @__PURE__ */ t.createElement(ma, {
6056
- value: e.result,
6057
- collapseFromDepth: 1
6058
- })), e.error !== void 0 && /* @__PURE__ */ t.createElement("div", { className: "bg-destructive/10 text-destructive p-2 rounded overflow-x-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "mb-1! font-medium" }, "error"), /* @__PURE__ */ t.createElement(ma, {
6059
- value: e.error instanceof Error ? e.error.message : e.error,
6060
- collapseFromDepth: 1
6061
- })))));
6062
- })), Gu = ({ effects: e, onClear: n }) => {
6063
- let r = e == null ? [] : e, [i, a] = t.useState(""), [o, s] = t.useState(!1), c = i ? r.filter((e) => e.fnName.toLowerCase().includes(i.toLowerCase())) : r;
6050
+ }, Wu = (e, t) => {
6051
+ try {
6052
+ return wo(e, t) !== void 0;
6053
+ } catch {
6054
+ try {
6055
+ var n;
6056
+ return ((n = JSON.stringify(e)) == null ? "" : n).toLowerCase().includes(t);
6057
+ } catch {
6058
+ return !1;
6059
+ }
6060
+ }
6061
+ }, Gu = (e, t) => !!(e.fnName.toLowerCase().includes(t) || Wu(e.args, t) || e.result !== void 0 && Wu(e.result, t) || e.error !== void 0 && Wu(e.error, t)), Ku = ({ effects: e, search: n = "" }) => {
6062
+ let r = n.toLowerCase(), i = r ? e.filter((e) => Gu(e, r)) : e, [a, o] = t.useState([]);
6063
+ return t.useEffect(() => {
6064
+ o(r ? i.map((e) => String(e.id)) : []);
6065
+ }, [n]), e.length === 0 ? /* @__PURE__ */ t.createElement("div", { className: "py-4 text-center text-xs text-muted-foreground" }, "No calls captured yet.") : i.length === 0 ? /* @__PURE__ */ t.createElement("span", { className: "text-muted-foreground italic text-xs px-1" }, "No results for \"", n, "\"") : /* @__PURE__ */ t.createElement(_o, {
6066
+ type: "multiple",
6067
+ value: a,
6068
+ onValueChange: o,
6069
+ className: "w-full font-mono text-xs"
6070
+ }, i.map((e) => {
6071
+ var n, i, a, o, s;
6072
+ let c = (e) => {
6073
+ try {
6074
+ return wo(e, r);
6075
+ } catch {
6076
+ return;
6077
+ }
6078
+ }, l = r ? (n = c(e.args)) == null ? e.args : n : e.args, u = r && e.result !== void 0 ? (i = c(e.result)) == null ? e.result : i : e.result, d = r && e.error !== void 0 ? (a = c(e.error)) == null ? e.error : a : e.error;
6079
+ return /* @__PURE__ */ t.createElement(vo, {
6080
+ key: e.id,
6081
+ value: String(e.id)
6082
+ }, /* @__PURE__ */ t.createElement(bo, { className: "py-2 px-2 hover:no-underline hover:bg-muted/50 rounded font-mono text-xs font-normal" }, /* @__PURE__ */ t.createElement("span", { className: G("shrink-0 w-4 text-center", Uu[e.status]) }, Hu[e.status]), /* @__PURE__ */ t.createElement("span", { className: "flex-1 truncate text-left text-foreground mx-2" }, e.fnName), e.duration !== void 0 && /* @__PURE__ */ t.createElement("span", { className: "shrink-0 text-muted-foreground mr-1" }, e.duration, "ms")), /* @__PURE__ */ t.createElement(xo, { className: "pb-2! pt-0 px-2" }, /* @__PURE__ */ t.createElement("div", { className: "space-y-1.5" }, ((o = (s = e.args) == null ? void 0 : s.length) == null ? 0 : o) > 0 && /* @__PURE__ */ t.createElement("div", { className: "bg-muted p-2! rounded overflow-x-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "text-muted-foreground mb-1!" }, "args"), /* @__PURE__ */ t.createElement(ma, {
6083
+ value: l,
6084
+ collapseFromDepth: r ? 10 : 1
6085
+ })), e.result !== void 0 && /* @__PURE__ */ t.createElement("div", { className: "bg-primary text-primary-foreground p-2! rounded overflow-x-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "text-muted-foreground mb-1" }, "result"), /* @__PURE__ */ t.createElement(ma, {
6086
+ value: u,
6087
+ collapseFromDepth: r ? 10 : 1
6088
+ })), d !== void 0 && /* @__PURE__ */ t.createElement("div", { className: "bg-destructive/10 text-destructive p-2 rounded overflow-x-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "mb-1! font-medium" }, "error"), /* @__PURE__ */ t.createElement(ma, {
6089
+ value: d instanceof Error ? d.message : d,
6090
+ collapseFromDepth: r ? 10 : 1
6091
+ })))));
6092
+ }));
6093
+ }, qu = ({ effects: e, onClear: n }) => {
6094
+ let r = e == null ? [] : e, [i, a] = t.useState(""), [o, s] = t.useState(!1);
6064
6095
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { className: "py-3! space-y-2!" }, /* @__PURE__ */ t.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ t.createElement(So, {
6065
- placeholder: "Search calls…",
6096
+ placeholder: "Deep search calls…",
6066
6097
  value: i,
6067
6098
  onChange: (e) => a(e.target.value),
6068
6099
  className: "h-7 text-xs"
@@ -6073,23 +6104,29 @@ var Fu = 100, Iu = (e) => {
6073
6104
  onClick: () => s(!0),
6074
6105
  title: "Expand",
6075
6106
  className: "shrink-0 text-muted-foreground hover:text-foreground transition-colors"
6076
- }, /* @__PURE__ */ t.createElement(ho, { size: 14 }))), /* @__PURE__ */ t.createElement("div", { className: "max-h-60 overflow-y-auto" }, /* @__PURE__ */ t.createElement(Wu, { effects: c }))), /* @__PURE__ */ t.createElement($i, {
6107
+ }, /* @__PURE__ */ t.createElement(ho, { size: 14 }))), /* @__PURE__ */ t.createElement("div", { className: "max-h-60 overflow-y-auto" }, /* @__PURE__ */ t.createElement(Ku, {
6108
+ effects: r,
6109
+ search: i
6110
+ }))), /* @__PURE__ */ t.createElement($i, {
6077
6111
  open: o,
6078
6112
  onOpenChange: s
6079
6113
  }, /* @__PURE__ */ t.createElement(na, { className: "flex flex-col overflow-hidden" }, /* @__PURE__ */ t.createElement(ra, null, /* @__PURE__ */ t.createElement(aa, null, "Saga Calls")), /* @__PURE__ */ t.createElement(So, {
6080
- placeholder: "Search calls…",
6114
+ placeholder: "Deep search calls…",
6081
6115
  value: i,
6082
6116
  onChange: (e) => a(e.target.value),
6083
6117
  className: "h-8 text-sm shrink-0"
6084
- }), /* @__PURE__ */ t.createElement("div", { className: "overflow-y-auto min-h-0 flex-1" }, /* @__PURE__ */ t.createElement(Wu, { effects: c })))));
6085
- }, Ku = ({ monitor: e, serverEffects: n }) => {
6118
+ }), /* @__PURE__ */ t.createElement("div", { className: "overflow-y-auto min-h-0 flex-1" }, /* @__PURE__ */ t.createElement(Ku, {
6119
+ effects: r,
6120
+ search: i
6121
+ })))));
6122
+ }, Ju = ({ monitor: e, serverEffects: n }) => {
6086
6123
  let [r, i] = t.useState(() => {
6087
6124
  var t;
6088
6125
  return (t = e == null ? void 0 : e._getEffects()) == null ? [] : t;
6089
6126
  });
6090
6127
  return t.useEffect(() => {
6091
6128
  if (e) return i(e._getEffects()), e._subscribe(() => i(e._getEffects()));
6092
- }, [e]), n == null ? e ? /* @__PURE__ */ t.createElement(Gu, {
6129
+ }, [e]), n == null ? e ? /* @__PURE__ */ t.createElement(qu, {
6093
6130
  effects: r,
6094
6131
  onClear: () => e._clear()
6095
6132
  }) : /* @__PURE__ */ t.createElement("div", { className: "py-6 text-center text-sm text-muted-foreground" }, "No saga monitor connected.", /* @__PURE__ */ t.createElement("span", { className: "block mt-1 text-xs font-mono" }, "sagaMonitor={sentinelMonitor}")) : /* @__PURE__ */ t.createElement(pn, { defaultValue: "server" }, /* @__PURE__ */ t.createElement(mn, { className: "grid w-full grid-cols-2 mx-0 rounded-none border-b bg-transparent h-8 gap-1 mt-2" }, /* @__PURE__ */ t.createElement(K, {
@@ -6101,15 +6138,15 @@ var Fu = 100, Iu = (e) => {
6101
6138
  }, "Server")), /* @__PURE__ */ t.createElement(q, {
6102
6139
  value: "client",
6103
6140
  className: "mt-0"
6104
- }, e ? /* @__PURE__ */ t.createElement(Gu, {
6141
+ }, e ? /* @__PURE__ */ t.createElement(qu, {
6105
6142
  effects: r,
6106
6143
  onClear: () => e._clear()
6107
6144
  }) : /* @__PURE__ */ t.createElement("div", { className: "py-4 text-center text-xs text-muted-foreground" }, "No client monitor connected.")), /* @__PURE__ */ t.createElement(q, {
6108
6145
  value: "server",
6109
6146
  className: "mt-0"
6110
- }, /* @__PURE__ */ t.createElement(Gu, { effects: n })));
6111
- }, qu = ({ sagaMonitor: e, serverState: n, serverSagaEffects: r }) => {
6112
- let { isActive: i, setIsActive: a, showOutlines: o, setShowOutlines: s, highlightName: c, setHighlightName: l, reduxStore: u } = nd();
6147
+ }, /* @__PURE__ */ t.createElement(qu, { effects: n })));
6148
+ }, Yu = ({ sagaMonitor: e, serverState: n, serverSagaEffects: r }) => {
6149
+ let { isActive: i, setIsActive: a, showOutlines: o, setShowOutlines: s, highlightName: c, setHighlightName: l, reduxStore: u } = id();
6113
6150
  return /* @__PURE__ */ t.createElement(gn, null, /* @__PURE__ */ t.createElement("div", { className: "sentinel-root" }, /* @__PURE__ */ t.createElement("div", { className: "fixed bottom-4 right-4 z-[9999]" }, /* @__PURE__ */ t.createElement(lu, null, /* @__PURE__ */ t.createElement(uu, { className: G("flex h-10 w-10 items-center justify-center rounded-full border shadow-lg transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring cursor-pointer", i ? "bg-primary text-primary-foreground border-primary/30" : "bg-background text-muted-foreground border-border hover:text-foreground") }, /* @__PURE__ */ t.createElement(go, { size: 18 })), /* @__PURE__ */ t.createElement(du, {
6114
6151
  side: "top",
6115
6152
  align: "end",
@@ -6163,13 +6200,13 @@ var Fu = 100, Iu = (e) => {
6163
6200
  })), /* @__PURE__ */ t.createElement(q, {
6164
6201
  value: "saga",
6165
6202
  className: "mt-0"
6166
- }, /* @__PURE__ */ t.createElement(Ku, {
6203
+ }, /* @__PURE__ */ t.createElement(Ju, {
6167
6204
  monitor: e,
6168
6205
  serverEffects: r
6169
6206
  }))))))));
6170
- }, Ju = "rgba(10, 10, 12, 0.72)", Yu = "blur(8px) saturate(140%) contrast(105%)", Xu = ({ children: e, active: n = !0 }) => {
6207
+ }, Xu = "rgba(10, 10, 12, 0.72)", Zu = "blur(8px) saturate(140%) contrast(105%)", Qu = ({ children: e, active: n = !0 }) => {
6171
6208
  if (!n) return /* @__PURE__ */ t.createElement(t.Fragment, null, e);
6172
- let { activeRect: r } = nd();
6209
+ let { activeRect: r } = id();
6173
6210
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(gn, null, /* @__PURE__ */ t.createElement("div", { className: "sentinel-root" }, r && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", {
6174
6211
  className: "pointer-events-none fixed z-[999]",
6175
6212
  style: {
@@ -6177,9 +6214,9 @@ var Fu = 100, Iu = (e) => {
6177
6214
  left: 0,
6178
6215
  right: 0,
6179
6216
  height: r.top,
6180
- background: Ju,
6181
- backdropFilter: Yu,
6182
- WebkitBackdropFilter: Yu
6217
+ background: Xu,
6218
+ backdropFilter: Zu,
6219
+ WebkitBackdropFilter: Zu
6183
6220
  }
6184
6221
  }), /* @__PURE__ */ t.createElement("div", {
6185
6222
  className: "pointer-events-none fixed z-[999]",
@@ -6188,9 +6225,9 @@ var Fu = 100, Iu = (e) => {
6188
6225
  left: 0,
6189
6226
  right: 0,
6190
6227
  bottom: 0,
6191
- background: Ju,
6192
- backdropFilter: Yu,
6193
- WebkitBackdropFilter: Yu
6228
+ background: Xu,
6229
+ backdropFilter: Zu,
6230
+ WebkitBackdropFilter: Zu
6194
6231
  }
6195
6232
  }), /* @__PURE__ */ t.createElement("div", {
6196
6233
  className: "pointer-events-none fixed z-[999]",
@@ -6199,9 +6236,9 @@ var Fu = 100, Iu = (e) => {
6199
6236
  left: 0,
6200
6237
  width: r.left,
6201
6238
  height: r.height,
6202
- background: Ju,
6203
- backdropFilter: Yu,
6204
- WebkitBackdropFilter: Yu
6239
+ background: Xu,
6240
+ backdropFilter: Zu,
6241
+ WebkitBackdropFilter: Zu
6205
6242
  }
6206
6243
  }), /* @__PURE__ */ t.createElement("div", {
6207
6244
  className: "pointer-events-none fixed z-[999]",
@@ -6210,9 +6247,9 @@ var Fu = 100, Iu = (e) => {
6210
6247
  left: r.right,
6211
6248
  right: 0,
6212
6249
  height: r.height,
6213
- background: Ju,
6214
- backdropFilter: Yu,
6215
- WebkitBackdropFilter: Yu
6250
+ background: Xu,
6251
+ backdropFilter: Zu,
6252
+ WebkitBackdropFilter: Zu
6216
6253
  }
6217
6254
  }), /* @__PURE__ */ t.createElement("div", {
6218
6255
  className: "pointer-events-none fixed z-[1000]",
@@ -6225,76 +6262,86 @@ var Fu = 100, Iu = (e) => {
6225
6262
  borderRadius: 4
6226
6263
  }
6227
6264
  })), e)));
6228
- }, Zu = n(void 0), Qu = n(void 0), $u = ({ children: e, store: n, sagaMonitor: r, serverState: i, serverSagaEffects: o }) => {
6229
- let [c, u] = d(null), [f, p] = d(null), [m, h] = d(null), [g, _] = d({}), [v, y] = d(!1), [b, x] = d(!1), [S, C] = d("");
6265
+ }, $u = n(void 0), ed = n(void 0), td = ({ children: e, store: n, sagaMonitor: r, serverState: i, serverSagaEffects: o, externalLinks: c }) => {
6266
+ let [u, f] = d(null), [p, m] = d(null), [h, g] = d(null), [_, v] = d({}), [y, b] = d(!1), [x, S] = d(!1), [C, w] = d("");
6230
6267
  s(() => {
6231
- v || (u(null), p(null), h(null), _({}));
6232
- }, [v]), s(() => {
6268
+ y || (f(null), m(null), g(null), v({}));
6269
+ }, [y]), s(() => {
6233
6270
  let e = (e) => {
6234
- e.ctrlKey && e.shiftKey && e.key === "S" && y((e) => !e);
6271
+ e.ctrlKey && e.shiftKey && e.key === "S" && b((e) => !e);
6235
6272
  };
6236
6273
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
6237
6274
  }, []);
6238
- let w = a((e, t) => {
6239
- u(e), p(t);
6275
+ let T = a((e, t) => {
6276
+ f(e), m(t);
6240
6277
  }, []);
6241
6278
  s(() => {
6242
6279
  let e = () => {
6243
- u(null), p(null);
6280
+ f(null), m(null);
6244
6281
  };
6245
6282
  return window.addEventListener("scroll", e, !0), () => window.removeEventListener("scroll", e, !0);
6246
6283
  }, []);
6247
- let T = a((e) => {
6248
- u((t) => t === e ? (p(null), null) : t);
6249
- }, []), E = a((e, t, n, r, i, a, o) => {
6250
- h(e), _({
6284
+ let E = a((e) => {
6285
+ f((t) => t === e ? (m(null), null) : t);
6286
+ }, []), D = a((e, t, n, i, a, s, l) => {
6287
+ var u;
6288
+ let d = [...(u = r == null ? void 0 : r._getEffects()) == null ? [] : u, ...o == null ? [] : o], f = c == null ? void 0 : c.filter((e) => t && i && e.match(t, i)).map((e) => ({
6289
+ label: e.label,
6290
+ url: e.url(i == null ? {} : i, d)
6291
+ })).filter((e) => e.url);
6292
+ g(e), v({
6251
6293
  componentName: t,
6252
- sourceFile: i,
6253
- renderCount: a,
6254
- propHistory: o,
6294
+ sourceFile: a,
6295
+ renderCount: s,
6296
+ propHistory: l,
6255
6297
  md: n,
6256
- componentProps: r
6298
+ componentProps: i,
6299
+ externalLinks: f
6257
6300
  });
6258
- }, []), D = a(() => {
6259
- h(null), _({});
6260
- }, []), O = l(() => ({
6261
- activeId: c,
6262
- activeRect: f,
6263
- isActive: v,
6264
- setIsActive: y,
6265
- showOutlines: b,
6266
- setShowOutlines: x,
6267
- highlightName: S,
6268
- setHighlightName: C,
6301
+ }, [
6302
+ c,
6303
+ r,
6304
+ o
6305
+ ]), O = a(() => {
6306
+ g(null), v({});
6307
+ }, []), k = l(() => ({
6308
+ activeId: u,
6309
+ activeRect: p,
6310
+ isActive: y,
6311
+ setIsActive: b,
6312
+ showOutlines: x,
6313
+ setShowOutlines: S,
6314
+ highlightName: C,
6315
+ setHighlightName: w,
6269
6316
  reduxStore: n,
6270
- registerHover: w,
6271
- unregisterHover: T,
6272
- openDialog: E
6317
+ registerHover: T,
6318
+ unregisterHover: E,
6319
+ openDialog: D
6273
6320
  }), [
6274
- c,
6275
- f,
6276
- v,
6277
- b,
6278
- S,
6321
+ u,
6322
+ p,
6323
+ y,
6324
+ x,
6325
+ C,
6279
6326
  n,
6280
- w,
6281
6327
  T,
6282
- E
6283
- ]), k = l(() => ({
6284
- openDialogId: m,
6285
- dialogMeta: g,
6286
- closeDialog: D
6287
- }), [
6288
- m,
6289
- g,
6328
+ E,
6290
6329
  D
6330
+ ]), A = l(() => ({
6331
+ openDialogId: h,
6332
+ dialogMeta: _,
6333
+ closeDialog: O
6334
+ }), [
6335
+ h,
6336
+ _,
6337
+ O
6291
6338
  ]);
6292
- return /* @__PURE__ */ t.createElement(Zu.Provider, { value: O }, /* @__PURE__ */ t.createElement(Qu.Provider, { value: k }, e, /* @__PURE__ */ t.createElement(Xu, { active: v }, /* @__PURE__ */ t.createElement(Oo, null)), /* @__PURE__ */ t.createElement(qu, {
6339
+ return /* @__PURE__ */ t.createElement($u.Provider, { value: k }, /* @__PURE__ */ t.createElement(ed.Provider, { value: A }, e, /* @__PURE__ */ t.createElement(Qu, { active: y }, /* @__PURE__ */ t.createElement(Oo, null)), /* @__PURE__ */ t.createElement(Yu, {
6293
6340
  sagaMonitor: r,
6294
6341
  serverState: i,
6295
6342
  serverSagaEffects: o
6296
6343
  })));
6297
- }, ed = {
6344
+ }, nd = {
6298
6345
  activeId: null,
6299
6346
  activeRect: null,
6300
6347
  isActive: !1,
@@ -6307,18 +6354,18 @@ var Fu = 100, Iu = (e) => {
6307
6354
  registerHover: () => {},
6308
6355
  unregisterHover: () => {},
6309
6356
  openDialog: () => {}
6310
- }, td = {
6357
+ }, rd = {
6311
6358
  openDialogId: null,
6312
6359
  dialogMeta: {},
6313
6360
  closeDialog: () => {}
6314
- }, nd = () => {
6361
+ }, id = () => {
6315
6362
  var e;
6316
- return (e = o(Zu)) == null ? ed : e;
6317
- }, rd = () => {
6363
+ return (e = o($u)) == null ? nd : e;
6364
+ }, ad = () => {
6318
6365
  var e;
6319
- return (e = o(Qu)) == null ? td : e;
6320
- }, id = () => {
6321
- let e = nd(), t = rd();
6366
+ return (e = o(ed)) == null ? rd : e;
6367
+ }, od = () => {
6368
+ let e = id(), t = ad();
6322
6369
  return {
6323
6370
  ...e,
6324
6371
  ...t
@@ -6326,7 +6373,7 @@ var Fu = 100, Iu = (e) => {
6326
6373
  };
6327
6374
  //#endregion
6328
6375
  //#region src/utils/safeSerialize.ts
6329
- function ad(e, t = 0, n = /* @__PURE__ */ new WeakSet()) {
6376
+ function sd(e, t = 0, n = /* @__PURE__ */ new WeakSet()) {
6330
6377
  if (t > 6) return "[Max Depth]";
6331
6378
  if (e === null) return null;
6332
6379
  if (typeof e == "function") return "[Function]";
@@ -6334,15 +6381,15 @@ function ad(e, t = 0, n = /* @__PURE__ */ new WeakSet()) {
6334
6381
  if (n.has(e)) return "[Circular]";
6335
6382
  if (n.add(e), "$$typeof" in e) return "[React Element]";
6336
6383
  if ("_context" in e || "Provider" in e && "Consumer" in e) return "[React Context]";
6337
- if (Array.isArray(e)) return e.map((e) => ad(e, t + 1, n));
6384
+ if (Array.isArray(e)) return e.map((e) => sd(e, t + 1, n));
6338
6385
  let r = {};
6339
- for (let [i, a] of Object.entries(e)) i.startsWith("__react") || i.startsWith("_react") || i === "_owner" || (r[i] = ad(a, t + 1, n));
6386
+ for (let [i, a] of Object.entries(e)) i.startsWith("__react") || i.startsWith("_react") || i === "_owner" || (r[i] = sd(a, t + 1, n));
6340
6387
  return r;
6341
6388
  }
6342
6389
  //#endregion
6343
6390
  //#region src/react/Sentinel.tsx
6344
- var od = ({ children: e, componentName: n, sourceFile: r, renderCount: i, dialogMd: a, componentProps: o }) => {
6345
- let s = M(), { isActive: c, showOutlines: l, highlightName: d, registerHover: f, unregisterHover: p, openDialog: m } = nd(), h = u([]), g = u(""), _ = o ? ad(o) : void 0, v = _ ? JSON.stringify(_) : "";
6391
+ var cd = ({ children: e, componentName: n, sourceFile: r, renderCount: i, dialogMd: a, componentProps: o }) => {
6392
+ let s = M(), { isActive: c, showOutlines: l, highlightName: d, registerHover: f, unregisterHover: p, openDialog: m } = id(), h = u([]), g = u(""), _ = o ? sd(o) : void 0, v = _ ? JSON.stringify(_) : "";
6346
6393
  if (_ && v !== g.current && (g.current = v, h.current = [_, ...h.current].slice(0, 6)), !c) return /* @__PURE__ */ t.createElement(t.Fragment, null, e);
6347
6394
  let y = !!d && !!n && n.toLowerCase().includes(d.toLowerCase());
6348
6395
  return /* @__PURE__ */ t.createElement("div", {
@@ -6363,6 +6410,31 @@ var od = ({ children: e, componentName: n, sourceFile: r, renderCount: i, dialog
6363
6410
  borderRadius: "inherit"
6364
6411
  }
6365
6412
  }, e));
6413
+ }, ld = (e, t) => {
6414
+ for (let i of t) {
6415
+ var n, r;
6416
+ if (i.fnName !== "getFragments" || !Array.isArray((n = i.args) == null ? void 0 : n[0])) continue;
6417
+ let t = i.args[0].findIndex((t) => t.id === e);
6418
+ if (t === -1 || !Array.isArray(i.result)) continue;
6419
+ let a = (r = i.result[t]) == null || (r = r.result) == null ? void 0 : r.config;
6420
+ if (!(a != null && a.url)) continue;
6421
+ let o = a.params && Object.keys(a.params).length ? "?" + new URLSearchParams(a.params).toString() : "";
6422
+ return a.url + o;
6423
+ }
6424
+ return "";
6425
+ }, ud = (e = {}) => {
6426
+ var t;
6427
+ return {
6428
+ label: (t = e.label) == null ? "Open in Microfrontend" : t,
6429
+ match: (e, t) => {
6430
+ var n;
6431
+ return (t == null || (n = t.fragmentInfo) == null ? void 0 : n.id) != null;
6432
+ },
6433
+ url: (e, t) => {
6434
+ var n;
6435
+ return ld((n = e.fragmentInfo) == null ? void 0 : n.id, t);
6436
+ }
6437
+ };
6366
6438
  };
6367
6439
  //#endregion
6368
- export { od as Sentinel, $u as SentinelProvider, Ru as createSentinelSagaMonitor, id as useSentinel, rd as useSentinelDialog, nd as useSentinelInteraction };
6440
+ export { cd as Sentinel, td as SentinelProvider, Ru as createSentinelSagaMonitor, od as useSentinel, ad as useSentinelDialog, id as useSentinelInteraction, ud as voltranExternalLink };
@@ -1,5 +1,7 @@
1
1
  export { Sentinel } from './Sentinel';
2
2
  export { SentinelProvider } from './provider';
3
3
  export { useSentinel, useSentinelInteraction, useSentinelDialog } from './provider';
4
+ export type { ExternalLink } from './provider';
5
+ export { voltranExternalLink } from './voltranExternalLink';
4
6
  export { createSentinelSagaMonitor } from '../saga/createSentinelSagaMonitor';
5
7
  export type { SentinelSagaMonitor, EffectRecord, EffectStatus } from '../saga/createSentinelSagaMonitor';
@@ -1,5 +1,14 @@
1
1
  import { default as React } from 'react';
2
2
  import { SentinelSagaMonitor, EffectRecord } from '../saga/createSentinelSagaMonitor';
3
+ export type ExternalLink = {
4
+ match: (componentName: string, props: Record<string, any>) => boolean;
5
+ url: (props: Record<string, any>, sagaEffects: EffectRecord[]) => string;
6
+ label: string;
7
+ };
8
+ type ResolvedExternalLink = {
9
+ label: string;
10
+ url: string;
11
+ };
3
12
  type DialogMeta = {
4
13
  componentName?: string;
5
14
  sourceFile?: string;
@@ -7,6 +16,7 @@ type DialogMeta = {
7
16
  propHistory?: Record<string, any>[];
8
17
  md?: string;
9
18
  componentProps?: Record<string, any>;
19
+ externalLinks?: ResolvedExternalLink[];
10
20
  };
11
21
  export type ReduxStore = {
12
22
  getState: () => unknown;
@@ -31,12 +41,13 @@ type SentinelDialogContextType = {
31
41
  dialogMeta: DialogMeta;
32
42
  closeDialog: () => void;
33
43
  };
34
- export declare const SentinelProvider: ({ children, store: reduxStore, sagaMonitor, serverState, serverSagaEffects, }: {
44
+ export declare const SentinelProvider: ({ children, store: reduxStore, sagaMonitor, serverState, serverSagaEffects, externalLinks, }: {
35
45
  children: React.ReactNode;
36
46
  store?: ReduxStore;
37
47
  sagaMonitor?: SentinelSagaMonitor;
38
48
  serverState?: unknown;
39
49
  serverSagaEffects?: EffectRecord[];
50
+ externalLinks?: ExternalLink[];
40
51
  }) => React.JSX.Element;
41
52
  export declare const useSentinelInteraction: () => SentinelInteractionContextType;
42
53
  export declare const useSentinelDialog: () => SentinelDialogContextType;
@@ -0,0 +1,6 @@
1
+ import { ExternalLink } from './provider';
2
+ type VoltranExternalLinkOptions = {
3
+ label?: string;
4
+ };
5
+ export declare const voltranExternalLink: (options?: VoltranExternalLinkOptions) => ExternalLink;
6
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentinel-core/sentinel",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "Runtime intelligence for your UI.",
5
5
  "author": "firatorhan",
6
6
  "private": false,