@opentrace/components 0.1.1-rc.30 → 0.1.1-rc.44

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.
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const urlNormalize = require("./urlNormalize-DL0SAEQS.cjs");
4
+ exports.AddRepoModal = urlNormalize.AddRepoModal;
5
+ exports.IndexingProgress = urlNormalize.IndexingProgress;
6
+ exports.detectProvider = urlNormalize.detectProvider;
7
+ exports.normalizeRepoUrl = urlNormalize.normalizeRepoUrl;
8
+ //# sourceMappingURL=indexing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexing.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,8 @@
1
+ import { A, I, d, n } from "./urlNormalize-KY4ngwCQ.js";
2
+ export {
3
+ A as AddRepoModal,
4
+ I as IndexingProgress,
5
+ d as detectProvider,
6
+ n as normalizeRepoUrl
7
+ };
8
+ //# sourceMappingURL=indexing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexing.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const t = require("react");
5
5
  const useHighlights = require("./useHighlights-fRWg-A_c.cjs");
6
+ const urlNormalize = require("./urlNormalize-DL0SAEQS.cjs");
6
7
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
7
8
  function _toPrimitive$1(t2, r) {
8
9
  if ("object" != typeof t2 || !t2) return t2;
@@ -7798,7 +7799,7 @@ function GraphBadge({
7798
7799
  totalNodes,
7799
7800
  ")"
7800
7801
  ] }),
7801
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "nodes" }),
7802
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "graph-badge-label", children: "nodes" }),
7802
7803
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "graph-badge-sep", children: "·" }),
7803
7804
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "graph-badge-rendered", children: edgeCount }),
7804
7805
  totalEdges != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "graph-badge-total", children: [
@@ -7806,7 +7807,7 @@ function GraphBadge({
7806
7807
  totalEdges,
7807
7808
  ")"
7808
7809
  ] }),
7809
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "edges" })
7810
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "graph-badge-label", children: "edges" })
7810
7811
  ] });
7811
7812
  }
7812
7813
  const DEFAULT_MAX_VISIBLE = 5;
@@ -7876,6 +7877,198 @@ function GraphLegend({
7876
7877
  ] })
7877
7878
  ] });
7878
7879
  }
7880
+ function GraphToolbar({
7881
+ logo,
7882
+ searchQuery,
7883
+ onSearchQueryChange,
7884
+ onSearch,
7885
+ onReset,
7886
+ searchDisabled,
7887
+ showResetButton,
7888
+ hops,
7889
+ onHopsChange,
7890
+ maxHops = 5,
7891
+ nodeCount,
7892
+ edgeCount,
7893
+ totalNodes,
7894
+ totalEdges,
7895
+ mobilePanelTabs,
7896
+ onMobilePanelTab,
7897
+ actions,
7898
+ persistentActions,
7899
+ className
7900
+ }) {
7901
+ const [menuOpen, setMenuOpen] = t.useState(false);
7902
+ const navRef = t.useRef(null);
7903
+ const burgerRef = t.useRef(null);
7904
+ t.useEffect(() => {
7905
+ if (!menuOpen) return;
7906
+ const onClickOutside = (e2) => {
7907
+ if (navRef.current?.contains(e2.target)) return;
7908
+ if (burgerRef.current?.contains(e2.target)) return;
7909
+ setMenuOpen(false);
7910
+ };
7911
+ const onEscape = (e2) => {
7912
+ if (e2.key === "Escape") setMenuOpen(false);
7913
+ };
7914
+ document.addEventListener("mousedown", onClickOutside);
7915
+ document.addEventListener("keydown", onEscape);
7916
+ return () => {
7917
+ document.removeEventListener("mousedown", onClickOutside);
7918
+ document.removeEventListener("keydown", onEscape);
7919
+ };
7920
+ }, [menuOpen]);
7921
+ const handleNavClick = t.useCallback((e2) => {
7922
+ const target = e2.target;
7923
+ const clickable = target.closest("button, a");
7924
+ if (clickable && !clickable.classList.contains("ot-clear-search") && !clickable.classList.contains("ot-search-btn")) {
7925
+ setMenuOpen(false);
7926
+ }
7927
+ }, []);
7928
+ const visibleTabs = mobilePanelTabs?.filter((t2) => t2.visible !== false);
7929
+ const searchMarkup = (id) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ot-search-container", children: [
7930
+ /* @__PURE__ */ jsxRuntime.jsx(
7931
+ "input",
7932
+ {
7933
+ type: "text",
7934
+ placeholder: "Search nodes...",
7935
+ value: searchQuery,
7936
+ onChange: (e2) => onSearchQueryChange(e2.target.value),
7937
+ onKeyDown: (e2) => e2.key === "Enter" && onSearch(),
7938
+ className: "ot-search-input"
7939
+ }
7940
+ ),
7941
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ot-search-params", children: [
7942
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: `ot-hops-input-${id}`, children: "Hops:" }),
7943
+ /* @__PURE__ */ jsxRuntime.jsx(
7944
+ "input",
7945
+ {
7946
+ id: `ot-hops-input-${id}`,
7947
+ type: "number",
7948
+ min: "0",
7949
+ max: maxHops,
7950
+ value: hops,
7951
+ onChange: (e2) => onHopsChange(
7952
+ Math.min(maxHops, Math.max(0, parseInt(e2.target.value) || 0))
7953
+ ),
7954
+ className: "ot-hops-input",
7955
+ title: `Number of connection hops to include (max ${maxHops})`
7956
+ }
7957
+ )
7958
+ ] }),
7959
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ot-search-actions", children: [
7960
+ searchQuery && /* @__PURE__ */ jsxRuntime.jsx(
7961
+ "button",
7962
+ {
7963
+ className: "ot-clear-search",
7964
+ onClick: onReset,
7965
+ title: "Clear search",
7966
+ children: "×"
7967
+ }
7968
+ ),
7969
+ /* @__PURE__ */ jsxRuntime.jsx(
7970
+ "button",
7971
+ {
7972
+ className: "ot-search-btn",
7973
+ onClick: onSearch,
7974
+ title: "Query API and rerender",
7975
+ disabled: searchDisabled,
7976
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
7977
+ "svg",
7978
+ {
7979
+ width: "14",
7980
+ height: "14",
7981
+ viewBox: "0 0 24 24",
7982
+ fill: "none",
7983
+ stroke: "currentColor",
7984
+ strokeWidth: "2.5",
7985
+ strokeLinecap: "round",
7986
+ strokeLinejoin: "round",
7987
+ children: [
7988
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "8" }),
7989
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
7990
+ ]
7991
+ }
7992
+ )
7993
+ }
7994
+ )
7995
+ ] })
7996
+ ] });
7997
+ return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: `ot-toolbar${className ? ` ${className}` : ""}`, children: [
7998
+ logo,
7999
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ot-search-tablet", children: searchMarkup("tablet") }),
8000
+ persistentActions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ot-persistent-mobile", children: persistentActions }),
8001
+ /* @__PURE__ */ jsxRuntime.jsx(
8002
+ "button",
8003
+ {
8004
+ type: "button",
8005
+ className: "ot-burger-btn",
8006
+ ref: burgerRef,
8007
+ onClick: () => setMenuOpen((v2) => !v2),
8008
+ "aria-label": "Toggle menu",
8009
+ "aria-expanded": menuOpen,
8010
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8011
+ "svg",
8012
+ {
8013
+ width: "22",
8014
+ height: "22",
8015
+ viewBox: "0 0 24 24",
8016
+ fill: "none",
8017
+ stroke: "currentColor",
8018
+ strokeWidth: "2",
8019
+ strokeLinecap: "round",
8020
+ strokeLinejoin: "round",
8021
+ children: menuOpen ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8022
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
8023
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
8024
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8025
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
8026
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "3", y1: "12", x2: "21", y2: "12" }),
8027
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "3", y1: "18", x2: "21", y2: "18" })
8028
+ ] })
8029
+ }
8030
+ )
8031
+ }
8032
+ ),
8033
+ /* @__PURE__ */ jsxRuntime.jsxs(
8034
+ "nav",
8035
+ {
8036
+ className: `ot-toolbar-nav${menuOpen ? " open" : ""}`,
8037
+ ref: navRef,
8038
+ onClick: handleNavClick,
8039
+ children: [
8040
+ visibleTabs?.map((tab) => /* @__PURE__ */ jsxRuntime.jsxs(
8041
+ "button",
8042
+ {
8043
+ type: "button",
8044
+ className: "ot-mobile-panel-btn",
8045
+ onClick: () => onMobilePanelTab?.(tab.key),
8046
+ children: [
8047
+ tab.icon,
8048
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ot-menu-label", children: tab.label })
8049
+ ]
8050
+ },
8051
+ tab.key
8052
+ )),
8053
+ visibleTabs && visibleTabs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ot-menu-divider" }),
8054
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ot-search-nav", children: searchMarkup("nav") }),
8055
+ showResetButton && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "ot-reset-btn", onClick: onReset, children: "Show All" }),
8056
+ /* @__PURE__ */ jsxRuntime.jsx(
8057
+ GraphBadge,
8058
+ {
8059
+ nodeCount,
8060
+ edgeCount,
8061
+ totalNodes,
8062
+ totalEdges
8063
+ }
8064
+ ),
8065
+ persistentActions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ot-persistent-desktop", children: persistentActions }),
8066
+ actions
8067
+ ]
8068
+ }
8069
+ )
8070
+ ] });
8071
+ }
7879
8072
  const q = typeof window < "u" ? t.useLayoutEffect : t.useEffect;
7880
8073
  function ie(e2) {
7881
8074
  if (e2 !== void 0)
@@ -8782,6 +8975,10 @@ exports.shouldHideNode = useHighlights.shouldHideNode;
8782
8975
  exports.useCommunities = useHighlights.useCommunities;
8783
8976
  exports.useGraphFilters = useHighlights.useGraphFilters;
8784
8977
  exports.useHighlights = useHighlights.useHighlights;
8978
+ exports.AddRepoModal = urlNormalize.AddRepoModal;
8979
+ exports.IndexingProgress = urlNormalize.IndexingProgress;
8980
+ exports.detectProvider = urlNormalize.detectProvider;
8981
+ exports.normalizeRepoUrl = urlNormalize.normalizeRepoUrl;
8785
8982
  exports.DEFAULT_LAYOUT_CONFIG = DEFAULT_LAYOUT_CONFIG;
8786
8983
  exports.DiscoverPanel = DiscoverPanel;
8787
8984
  exports.EDGE_OPACITY_DEFAULT = EDGE_OPACITY_DEFAULT;
@@ -8800,6 +8997,7 @@ exports.Graph = GraphCanvas;
8800
8997
  exports.GraphBadge = GraphBadge;
8801
8998
  exports.GraphCanvas = GraphCanvas;
8802
8999
  exports.GraphLegend = GraphLegend;
9000
+ exports.GraphToolbar = GraphToolbar;
8803
9001
  exports.LABEL_COLOR = LABEL_COLOR;
8804
9002
  exports.LABEL_FONT = LABEL_FONT;
8805
9003
  exports.LABEL_RENDERED_SIZE_THRESHOLD = LABEL_RENDERED_SIZE_THRESHOLD;