@abdellatifui/react 3.1.79 → 3.1.81

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/nextgen.d.ts CHANGED
@@ -618,12 +618,16 @@ declare type NetworkMapProps_2 = {
618
618
  staticMapColor: string;
619
619
  isolateNonSelectedLinksOnNodeClick: boolean;
620
620
  showLinkCount: boolean;
621
+ showEndpoints: boolean;
622
+ getOverLinkElementDelay: number;
621
623
  tid: string | number;
622
624
  onConnClick: (conn: object) => void;
623
625
  onNodeClick: (node: object) => void;
624
626
  getCenterBox: (conn: object) => void;
625
627
  onNodeMouseOver: (node: object) => void;
626
628
  getMenuTitle: (connection: object) => void;
629
+ getOverLinkElement: (connection: object) => void;
630
+ getEndpointText: (connection: object) => void;
627
631
  onLinkContextMenu: (info: {
628
632
  data: object;
629
633
  event: default_2.MouseEvent;
package/dist/nextgen.js CHANGED
@@ -13471,6 +13471,7 @@ const PinItem = (props) => {
13471
13471
  setNodeContextMenuEvent,
13472
13472
  nodes,
13473
13473
  connections,
13474
+ hoveredConnection,
13474
13475
  onNodeSelected = () => {
13475
13476
  },
13476
13477
  onNodeMouseOver = () => {
@@ -13485,6 +13486,19 @@ const PinItem = (props) => {
13485
13486
  const defaultIcon = useMemo(() => {
13486
13487
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, className: "w-[50px] h-[50px] hover:scale-[1.5] transition-all ease-in-out duration-300 bg-black/70 p-2 rounded-2xl outline-blue-600 outline z-[300]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { className: "w-full h-full", src: NetworkCloudIcon, alt: "s" }) });
13487
13488
  }, [name2]);
13489
+ useEffect(() => {
13490
+ var _a;
13491
+ if (!hoveredConnection) {
13492
+ setOpacity(1);
13493
+ return;
13494
+ }
13495
+ const f = (_a = hoveredConnection == null ? void 0 : hoveredConnection.nodes) == null ? void 0 : _a.find((n) => (n == null ? void 0 : n.elementId) == (item == null ? void 0 : item.elementId));
13496
+ if (f) {
13497
+ setOpacity(1);
13498
+ } else {
13499
+ setOpacity(0.7);
13500
+ }
13501
+ }, [hoveredConnection]);
13488
13502
  const changeMarkerOutline = useCallback((state) => {
13489
13503
  setOutlined(state);
13490
13504
  }, [item]);
@@ -14051,6 +14065,266 @@ const LinkCountCircule = (props) => {
14051
14065
  );
14052
14066
  };
14053
14067
  const LinkCountCircule$1 = memo(LinkCountCircule);
14068
+ const LinkOverContainer = (props) => {
14069
+ const ref = useRef();
14070
+ const [position2, setPosition] = useState([0, 0]);
14071
+ const [Element2, setElement] = useState(null);
14072
+ const {
14073
+ conn,
14074
+ coordinates,
14075
+ getOverLinkElement,
14076
+ getOverLinkElementDelay,
14077
+ mapApi
14078
+ } = props;
14079
+ useEffect(() => {
14080
+ if (!coordinates) return;
14081
+ if (!(coordinates == null ? void 0 : coordinates[0])) return;
14082
+ if (!conn) return;
14083
+ const timeout2 = setTimeout(() => {
14084
+ const screenPos = mapApi.current.project([coordinates[0], coordinates[1]]);
14085
+ setElement(getOverLinkElement({ ...conn, containerRef: ref, currentCoordinates: coordinates, currentPosition: position2 }));
14086
+ setPosition([screenPos.x, screenPos.y]);
14087
+ }, getOverLinkElementDelay);
14088
+ return () => {
14089
+ clearTimeout(timeout2);
14090
+ setElement(null);
14091
+ setPosition([0, 0]);
14092
+ };
14093
+ }, [coordinates == null ? void 0 : coordinates[0]]);
14094
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14095
+ "div",
14096
+ {
14097
+ ref,
14098
+ onMouseLeave: () => {
14099
+ setElement(null);
14100
+ },
14101
+ className: "absolute z-30 pointer-events-auto",
14102
+ style: {
14103
+ transform: "translate(-50%, -50%)",
14104
+ left: position2[0],
14105
+ top: position2[1]
14106
+ },
14107
+ children: Element2
14108
+ }
14109
+ );
14110
+ };
14111
+ const PortText = (props) => {
14112
+ const ref = useRef(null);
14113
+ const {
14114
+ text,
14115
+ rotation,
14116
+ isVisible,
14117
+ data,
14118
+ isFocused
14119
+ } = props;
14120
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14121
+ "div",
14122
+ {
14123
+ ref,
14124
+ className: cn(
14125
+ "w-fit h-fit font-geist text-xs z-[300] rounded-full text-accent px-1 cursor-default pointer-events-all hover:!scale-[1.5] transition-all duration-300",
14126
+ isFocused && "!scale-[1.5]"
14127
+ ),
14128
+ style: {
14129
+ transform: `rotate(${rotation}deg)`,
14130
+ transformOrigin: "50% 50%",
14131
+ display: "inline-flex",
14132
+ alignItems: "center",
14133
+ justifyContent: "center",
14134
+ backgroundColor: data == null ? void 0 : data.linkColorHex,
14135
+ opacity: isVisible ? 1 : 0
14136
+ },
14137
+ children: text
14138
+ }
14139
+ );
14140
+ };
14141
+ const SourcesPorts = (props) => {
14142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
14143
+ const {
14144
+ data,
14145
+ mapApi,
14146
+ currentZoomLevel,
14147
+ hoveredConnection,
14148
+ mapDragging,
14149
+ getEndpointText
14150
+ } = props;
14151
+ const [midpoint, setMidpoint] = useState(null);
14152
+ const [isVisible, setIsVisible] = useState(true);
14153
+ useRef(null);
14154
+ useRef(null);
14155
+ const [viewportRevision, setViewportRevision] = useState(0);
14156
+ const [isFocused, setIsFocused] = useState(false);
14157
+ useEffect(() => {
14158
+ if (mapDragging) {
14159
+ setIsVisible(false);
14160
+ return;
14161
+ } else {
14162
+ setIsVisible(true);
14163
+ }
14164
+ if (currentZoomLevel < 5) {
14165
+ setIsVisible(false);
14166
+ return;
14167
+ } else if (currentZoomLevel > 6) {
14168
+ setIsVisible(true);
14169
+ }
14170
+ }, [currentZoomLevel]);
14171
+ useEffect(() => {
14172
+ if (!hoveredConnection) {
14173
+ setIsVisible(true);
14174
+ setIsFocused(false);
14175
+ return;
14176
+ }
14177
+ if ((hoveredConnection == null ? void 0 : hoveredConnection.u_id) == (data == null ? void 0 : data.u_id)) {
14178
+ setIsVisible(true);
14179
+ setIsFocused(true);
14180
+ } else {
14181
+ setIsVisible(false);
14182
+ setIsFocused(false);
14183
+ }
14184
+ }, [hoveredConnection == null ? void 0 : hoveredConnection.u_id, data == null ? void 0 : data.u_id, currentZoomLevel]);
14185
+ useEffect(() => {
14186
+ const map = mapApi == null ? void 0 : mapApi.current;
14187
+ if (!map) return;
14188
+ const onMove = () => setViewportRevision((v) => v + 1);
14189
+ map.on("move", onMove);
14190
+ map.on("zoom", onMove);
14191
+ map.on("rotate", onMove);
14192
+ return () => {
14193
+ try {
14194
+ map.off("move", onMove);
14195
+ map.off("zoom", onMove);
14196
+ map.off("rotate", onMove);
14197
+ } catch (e) {
14198
+ }
14199
+ };
14200
+ }, [mapApi == null ? void 0 : mapApi.current]);
14201
+ const sourceLabel = useMemo(() => {
14202
+ var _a2, _b2, _c2, _d2, _e2, _f2;
14203
+ try {
14204
+ const map = mapApi == null ? void 0 : mapApi.current;
14205
+ if (!map || !(data == null ? void 0 : data.source) || !(data == null ? void 0 : data.destination)) return null;
14206
+ const p1 = map.project([(_a2 = data == null ? void 0 : data.source) == null ? void 0 : _a2.lng, (_b2 = data == null ? void 0 : data.source) == null ? void 0 : _b2.lat]);
14207
+ const p2 = map.project([(_c2 = data == null ? void 0 : data.destination) == null ? void 0 : _c2.lng, (_d2 = data == null ? void 0 : data.destination) == null ? void 0 : _d2.lat]);
14208
+ const dx = (p2 == null ? void 0 : p2.x) - (p1 == null ? void 0 : p1.x);
14209
+ const dy = (p2 == null ? void 0 : p2.y) - (p1 == null ? void 0 : p1.y);
14210
+ const length2 = Math.hypot(dx, dy) || 1;
14211
+ const ux = dx / length2;
14212
+ const uy = dy / length2;
14213
+ const nx = -uy;
14214
+ const ny = ux;
14215
+ const markerHalfSize = ((_e2 = data == null ? void 0 : data.source) == null ? void 0 : _e2.markerSize) ? ((_f2 = data == null ? void 0 : data.source) == null ? void 0 : _f2.markerSize) / 2 : 12;
14216
+ const totalLength = length2;
14217
+ const defaultOffset = { along: 100, perpendicular: 0 };
14218
+ const customOffset = (data == null ? void 0 : data.sourcePortOffset) || {};
14219
+ const alongOffset = typeof (customOffset == null ? void 0 : customOffset.along) === "number" ? customOffset.along : defaultOffset.along;
14220
+ const perpendicularOffset = typeof (customOffset == null ? void 0 : customOffset.perpendicular) === "number" ? customOffset.perpendicular : defaultOffset.perpendicular;
14221
+ const distanceFromNode = markerHalfSize + alongOffset;
14222
+ const alongDistance = Math.min(Math.max(distanceFromNode, markerHalfSize + 4), totalLength * 0.6);
14223
+ const perpendicularDistance = perpendicularOffset;
14224
+ const offX = nx * perpendicularDistance + ux * alongDistance;
14225
+ const offY = ny * perpendicularDistance + uy * alongDistance;
14226
+ const px = (p1 == null ? void 0 : p1.x) + offX;
14227
+ const py = (p1 == null ? void 0 : p1.y) + offY;
14228
+ const ll = map.unproject([px, py]);
14229
+ const rotation = Math.atan2(uy, ux) * 180 / Math.PI;
14230
+ const normalizedRotation = (rotation + 360) % 360;
14231
+ const isUpsideDown = normalizedRotation > 90 && normalizedRotation < 270;
14232
+ const displayRotation = isUpsideDown ? rotation + 180 : rotation;
14233
+ return { position: { lng: ll == null ? void 0 : ll.lng, lat: ll == null ? void 0 : ll.lat }, rotation: displayRotation };
14234
+ } catch (e) {
14235
+ return null;
14236
+ }
14237
+ }, [mapApi == null ? void 0 : mapApi.current, (_a = data == null ? void 0 : data.source) == null ? void 0 : _a.lat, (_b = data == null ? void 0 : data.source) == null ? void 0 : _b.lng, (_c = data == null ? void 0 : data.destination) == null ? void 0 : _c.lat, (_d = data == null ? void 0 : data.destination) == null ? void 0 : _d.lng, (_e = data == null ? void 0 : data.sourcePortOffset) == null ? void 0 : _e.along, (_f = data == null ? void 0 : data.sourcePortOffset) == null ? void 0 : _f.perpendicular, viewportRevision, currentZoomLevel]);
14238
+ const destinationLabel = useMemo(() => {
14239
+ var _a2, _b2, _c2, _d2, _e2, _f2;
14240
+ try {
14241
+ const map = mapApi == null ? void 0 : mapApi.current;
14242
+ if (!map || !(data == null ? void 0 : data.source) || !(data == null ? void 0 : data.destination)) return null;
14243
+ const pSource = map.project([(_a2 = data == null ? void 0 : data.source) == null ? void 0 : _a2.lng, (_b2 = data == null ? void 0 : data.source) == null ? void 0 : _b2.lat]);
14244
+ const pDestination = map.project([(_c2 = data == null ? void 0 : data.destination) == null ? void 0 : _c2.lng, (_d2 = data == null ? void 0 : data.destination) == null ? void 0 : _d2.lat]);
14245
+ const dx = (pSource == null ? void 0 : pSource.x) - (pDestination == null ? void 0 : pDestination.x);
14246
+ const dy = (pSource == null ? void 0 : pSource.y) - (pDestination == null ? void 0 : pDestination.y);
14247
+ const length2 = Math.hypot(dx, dy) || 1;
14248
+ const ux = dx / length2;
14249
+ const uy = dy / length2;
14250
+ const nx = -uy;
14251
+ const ny = ux;
14252
+ const markerHalfSize = ((_e2 = data == null ? void 0 : data.destination) == null ? void 0 : _e2.markerSize) ? ((_f2 = data == null ? void 0 : data.destination) == null ? void 0 : _f2.markerSize) / 2 : 12;
14253
+ const totalLength = length2;
14254
+ const defaultOffset = { along: 100, perpendicular: 0 };
14255
+ const customOffset = (data == null ? void 0 : data.destinationPortOffset) || {};
14256
+ const alongOffset = typeof (customOffset == null ? void 0 : customOffset.along) === "number" ? customOffset.along : defaultOffset.along;
14257
+ const perpendicularOffset = typeof (customOffset == null ? void 0 : customOffset.perpendicular) === "number" ? customOffset.perpendicular : defaultOffset.perpendicular;
14258
+ const distanceFromNode = markerHalfSize + alongOffset;
14259
+ const alongDistance = Math.min(Math.max(distanceFromNode, markerHalfSize + 4), totalLength * 0.6);
14260
+ const perpendicularDistance = perpendicularOffset;
14261
+ const offX = nx * perpendicularDistance + ux * alongDistance;
14262
+ const offY = ny * perpendicularDistance + uy * alongDistance;
14263
+ const px = (pDestination == null ? void 0 : pDestination.x) + offX;
14264
+ const py = (pDestination == null ? void 0 : pDestination.y) + offY;
14265
+ const ll = map.unproject([px, py]);
14266
+ const rotation = Math.atan2(uy, ux) * 180 / Math.PI;
14267
+ const normalizedRotation = (rotation + 360) % 360;
14268
+ const isUpsideDown = normalizedRotation > 90 && normalizedRotation < 270;
14269
+ const displayRotation = isUpsideDown ? rotation + 180 : rotation;
14270
+ return { position: { lng: ll == null ? void 0 : ll.lng, lat: ll == null ? void 0 : ll.lat }, rotation: displayRotation };
14271
+ } catch (e) {
14272
+ return null;
14273
+ }
14274
+ }, [mapApi == null ? void 0 : mapApi.current, (_g = data == null ? void 0 : data.source) == null ? void 0 : _g.lat, (_h = data == null ? void 0 : data.source) == null ? void 0 : _h.lng, (_i = data == null ? void 0 : data.destination) == null ? void 0 : _i.lat, (_j = data == null ? void 0 : data.destination) == null ? void 0 : _j.lng, (_k = data == null ? void 0 : data.destinationPortOffset) == null ? void 0 : _k.along, (_l = data == null ? void 0 : data.destinationPortOffset) == null ? void 0 : _l.perpendicular, viewportRevision, currentZoomLevel]);
14275
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
14276
+ sourceLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(
14277
+ CustomMarker$1,
14278
+ {
14279
+ longitude: (_m = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _m.lng,
14280
+ latitude: (_n = sourceLabel == null ? void 0 : sourceLabel.position) == null ? void 0 : _n.lat,
14281
+ offset: [0, 0],
14282
+ children: getEndpointText ? getEndpointText({
14283
+ ...data,
14284
+ rotation: sourceLabel == null ? void 0 : sourceLabel.rotation,
14285
+ isVisible,
14286
+ text: data == null ? void 0 : data.sourcePort,
14287
+ isFocused
14288
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14289
+ PortText,
14290
+ {
14291
+ text: data == null ? void 0 : data.sourcePort,
14292
+ rotation: sourceLabel == null ? void 0 : sourceLabel.rotation,
14293
+ isVisible,
14294
+ data,
14295
+ isFocused
14296
+ }
14297
+ )
14298
+ }
14299
+ ),
14300
+ destinationLabel && (data == null ? void 0 : data.destinationPort) && /* @__PURE__ */ jsxRuntimeExports.jsx(
14301
+ CustomMarker$1,
14302
+ {
14303
+ longitude: (_o = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _o.lng,
14304
+ latitude: (_p = destinationLabel == null ? void 0 : destinationLabel.position) == null ? void 0 : _p.lat,
14305
+ offset: [0, 0],
14306
+ children: getEndpointText ? getEndpointText({
14307
+ ...data,
14308
+ rotation: destinationLabel == null ? void 0 : destinationLabel.rotation,
14309
+ isVisible,
14310
+ text: data == null ? void 0 : data.destinationPort,
14311
+ isFocused
14312
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
14313
+ PortText,
14314
+ {
14315
+ text: data == null ? void 0 : data.destinationPort,
14316
+ rotation: destinationLabel == null ? void 0 : destinationLabel.rotation,
14317
+ isVisible,
14318
+ data,
14319
+ getEndpointText,
14320
+ isFocused
14321
+ }
14322
+ )
14323
+ }
14324
+ )
14325
+ ] });
14326
+ };
14327
+ const SourcesPorts$1 = memo(SourcesPorts);
14054
14328
  const mapStyles = [
14055
14329
  { "name": "street1", url: "https://api.maptiler.com/maps/streets/style.json?key=4s1cX8zNpChcrWFsQqbP" },
14056
14330
  { "name": "street2", url: "https://api.maptiler.com/maps/streets-v2/style.json?key=4s1cX8zNpChcrWFsQqbP" },
@@ -14081,6 +14355,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14081
14355
  },
14082
14356
  onNodeClick = () => {
14083
14357
  },
14358
+ getEndpointText,
14084
14359
  staticMapColor,
14085
14360
  maxZoomOutForLinkCount = 4,
14086
14361
  nodeSizeScaler = 1,
@@ -14089,10 +14364,13 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14089
14364
  },
14090
14365
  onLinkMouseOver = () => {
14091
14366
  },
14367
+ getOverLinkElementDelay = 500,
14092
14368
  onLinkContextMenu = () => {
14093
14369
  },
14094
14370
  getMenuTitle = () => {
14095
14371
  },
14372
+ getOverLinkElement,
14373
+ showEndpoints = true,
14096
14374
  enableNativeContextMenu = true,
14097
14375
  hideLinks = false,
14098
14376
  getCenterBox,
@@ -14125,121 +14403,12 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14125
14403
  const [hoveredNode, setHoveredNode] = useState({});
14126
14404
  const [mapZooming, setMapZooming] = useState(false);
14127
14405
  const [startLinkCounterRerender, setStartLinkCounterRerender] = useState(false);
14406
+ const [currentZoomLevel, setCurrentZoomLevel] = useState(6);
14128
14407
  useEffect(() => {
14129
14408
  if (debug) {
14130
14409
  console.log(props);
14131
14410
  }
14132
14411
  }, [debug]);
14133
- function getBearing(source, destination) {
14134
- const φ1 = source.lat * Math.PI / 180;
14135
- const φ2 = destination.lat * Math.PI / 180;
14136
- const Δλ = (destination.lng - source.lng) * Math.PI / 180;
14137
- const y = Math.sin(Δλ) * Math.cos(φ2);
14138
- const x = Math.cos(φ1) * Math.sin(φ2) - Math.sin(φ1) * Math.cos(φ2) * Math.cos(Δλ);
14139
- const θ = Math.atan2(y, x);
14140
- const bearing = (θ * 180 / Math.PI + 360) % 360;
14141
- return bearing;
14142
- }
14143
- function getFixedOffsetPosition(source, dest, offsetFromEdge = 0.5) {
14144
- var _a;
14145
- try {
14146
- if (debug) {
14147
- console.log("source", source);
14148
- console.log("dest", dest);
14149
- }
14150
- const dx = dest.lng - source.lng;
14151
- const dy = dest.lat - source.lat;
14152
- const dist2 = Math.sqrt(dx * dx + dy * dy);
14153
- const dirX = dx / dist2;
14154
- const dirY = dy / dist2;
14155
- const offsetLng = source.lng + dirX * offsetFromEdge;
14156
- const offsetLat = source.lat + dirY * offsetFromEdge;
14157
- const screenPos = mapApi.current.project([offsetLng, offsetLat]);
14158
- const mapBearing = (_a = mapApi == null ? void 0 : mapApi.current) == null ? void 0 : _a.getBearing();
14159
- const mapRotation = getBearing(source, dest) - mapBearing;
14160
- const adjustedAngle = mapRotation + 90;
14161
- return [screenPos.x, screenPos.y, adjustedAngle];
14162
- } catch (e) {
14163
- return [null, null, null];
14164
- }
14165
- }
14166
- useMemo(() => {
14167
- var _a, _b, _c;
14168
- if (!((_a = mapApi == null ? void 0 : mapApi.current) == null ? void 0 : _a.getZoom) || !showLinkCount) return [];
14169
- if (draggingMode) return [];
14170
- if (((_b = mapApi.current) == null ? void 0 : _b.getZoom()) < 6) return [];
14171
- return (_c = _conns == null ? void 0 : _conns.filter((item) => (item == null ? void 0 : item.layer) == 0)) == null ? void 0 : _c.map((conn) => {
14172
- var _a2, _b2, _c2;
14173
- const [offsetX, offsetY, _rotationAngle] = getFixedOffsetPosition(conn == null ? void 0 : conn.source, conn == null ? void 0 : conn.destination, 0.4);
14174
- const [offsetX2, offsetY2, _rotationAngle2] = getFixedOffsetPosition(conn == null ? void 0 : conn.destination, conn == null ? void 0 : conn.source, 0.4);
14175
- if (!offsetX || !offsetY || !_rotationAngle || !offsetX2 || !offsetY2 || !_rotationAngle2) {
14176
- return null;
14177
- }
14178
- const rotationAngle = _rotationAngle + 180;
14179
- const rotationAngle2 = _rotationAngle2 + 180;
14180
- conn._rotationAngle = _rotationAngle;
14181
- conn._rotationAngle2 = _rotationAngle2;
14182
- conn.rotationAngle = rotationAngle;
14183
- conn.rotationAngle2 = rotationAngle2;
14184
- if (((_a2 = onScreenLinksGroup == null ? void 0 : onScreenLinksGroup.countBoxes) == null ? void 0 : _a2.length) > 0) {
14185
- if (!((_b2 = onScreenLinksGroup == null ? void 0 : onScreenLinksGroup.countBoxes) == null ? void 0 : _b2.includes(conn == null ? void 0 : conn.connCountBoxId))) {
14186
- conn.visible = false;
14187
- } else {
14188
- conn.visible = true;
14189
- }
14190
- }
14191
- if (hoveredConnection && (hoveredConnection == null ? void 0 : hoveredConnection.connCountBoxId) == (conn == null ? void 0 : conn.connCountBoxId)) {
14192
- conn.visible = true;
14193
- } else {
14194
- conn.visible = false;
14195
- }
14196
- if (((_c2 = onScreenLinksGroup == null ? void 0 : onScreenLinksGroup.countBoxes) == null ? void 0 : _c2.length) == 0 && !hoveredConnection) {
14197
- conn.visible = true;
14198
- }
14199
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledTooltip, { title: "Number of connections", children: [
14200
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14201
- "div",
14202
- {
14203
- id: "#" + (conn == null ? void 0 : conn.connCountBoxId),
14204
- style: {
14205
- top: offsetY,
14206
- left: offsetX,
14207
- "textShadow": "-1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black",
14208
- transform: `translate(-50%, -50%) rotate(${rotationAngle}deg)`,
14209
- display: !startLinkCounterRerender ? "none" : ""
14210
- },
14211
- className: cn(
14212
- "z-[30] drop-shadow-2xl select-none pointer-events-none absolute font-geist text-white text-[12px] font-bold flex items-center justify-center",
14213
- "w-fit",
14214
- (conn == null ? void 0 : conn.visible) == false ? "hidden" : ""
14215
- ),
14216
- children: conn == null ? void 0 : conn.name
14217
- },
14218
- "_s-" + (conn == null ? void 0 : conn.u_id)
14219
- ),
14220
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14221
- "div",
14222
- {
14223
- id: "#s-" + (conn == null ? void 0 : conn.connCountBoxId),
14224
- style: {
14225
- top: offsetY2,
14226
- left: offsetX2,
14227
- "textShadow": "-1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black",
14228
- transform: `translate(-50%, -50%) rotate(${rotationAngle2}deg)`,
14229
- display: !startLinkCounterRerender ? "none" : ""
14230
- },
14231
- className: cn(
14232
- "z-[30] drop-shadow-2xl select-none pointer-events-none absolute font-geist text-white text-[12px] font-bold flex items-center justify-center",
14233
- "w-fit",
14234
- (conn == null ? void 0 : conn.visible) == false ? "hidden" : ""
14235
- ),
14236
- children: conn == null ? void 0 : conn.name
14237
- },
14238
- "_s-s" + (conn == null ? void 0 : conn.u_id)
14239
- )
14240
- ] });
14241
- });
14242
- }, [_conns, maxZoomOutForLinkCount, draggingMode, hoveredConnection, onScreenLinksGroup == null ? void 0 : onScreenLinksGroup.countBoxes, startLinkCounterRerender, showLinkCount, mapApi == null ? void 0 : mapApi.current]);
14243
14412
  const _menuTitle = useMemo(() => {
14244
14413
  var _a;
14245
14414
  const t = getMenuTitle(selectedConn);
@@ -14334,6 +14503,8 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14334
14503
  nodes: [],
14335
14504
  source: null,
14336
14505
  destination: null,
14506
+ sourcePort: conn == null ? void 0 : conn.sourcePort,
14507
+ destinationPort: conn == null ? void 0 : conn.destinationPort,
14337
14508
  data: conn,
14338
14509
  connCountBoxId: useRandomId(),
14339
14510
  timestamp: [0, 5, 10, 15],
@@ -14576,7 +14747,9 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14576
14747
  maxZoom: 10
14577
14748
  },
14578
14749
  mapStyle: MapStyleUrl,
14579
- onZoom: () => {
14750
+ onZoom: (e) => {
14751
+ var _a;
14752
+ setCurrentZoomLevel((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.getZoom());
14580
14753
  setMapZooming((prev2) => !prev2);
14581
14754
  },
14582
14755
  onDragStart: () => setMapDragging(true),
@@ -14619,6 +14792,7 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14619
14792
  CreateMapObjectsScheme,
14620
14793
  latitude: (_b = item == null ? void 0 : item.location) == null ? void 0 : _b.lat,
14621
14794
  nodeIconMapper,
14795
+ hoveredConnection,
14622
14796
  onScreenLinksGroup,
14623
14797
  selectedNode,
14624
14798
  onNodeSelected: _onNodeSelected,
@@ -14631,6 +14805,16 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14631
14805
  "_node_" + (item == null ? void 0 : item.elementId)
14632
14806
  );
14633
14807
  }),
14808
+ getOverLinkElement && /* @__PURE__ */ jsxRuntimeExports.jsx(
14809
+ LinkOverContainer,
14810
+ {
14811
+ conn: hoveredConnection,
14812
+ coordinates: currentCoordinates,
14813
+ mapApi,
14814
+ getOverLinkElement,
14815
+ getOverLinkElementDelay
14816
+ }
14817
+ ),
14634
14818
  showLinkCount && !mapDragging && (_conns == null ? void 0 : _conns.map((con, index) => {
14635
14819
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14636
14820
  LinkCountCircule$1,
@@ -14644,6 +14828,20 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14644
14828
  "_lnk_count_circule_" + index
14645
14829
  );
14646
14830
  })),
14831
+ showEndpoints && (_conns == null ? void 0 : _conns.map((con, index) => {
14832
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14833
+ SourcesPorts$1,
14834
+ {
14835
+ data: con,
14836
+ mapApi,
14837
+ currentZoomLevel,
14838
+ hoveredConnection,
14839
+ mapDragging,
14840
+ getEndpointText
14841
+ },
14842
+ "_source_port_" + index
14843
+ );
14844
+ })),
14647
14845
  /* @__PURE__ */ jsxRuntimeExports.jsx(NavigationControl, {}),
14648
14846
  enableLngLatBox && /* @__PURE__ */ jsxRuntimeExports.jsx(LngLatBox, { coordinates: currentCoordinates })
14649
14847
  ]
package/dist/style.css CHANGED
@@ -991,6 +991,9 @@ video {
991
991
  .h-9 {
992
992
  height: 2.25rem;
993
993
  }
994
+ .h-\[100px\] {
995
+ height: 100px;
996
+ }
994
997
  .h-\[14px\] {
995
998
  height: 14px;
996
999
  }
@@ -1157,6 +1160,9 @@ video {
1157
1160
  .w-9 {
1158
1161
  width: 2.25rem;
1159
1162
  }
1163
+ .w-\[100px\] {
1164
+ width: 100px;
1165
+ }
1160
1166
  .w-\[14px\] {
1161
1167
  width: 14px;
1162
1168
  }
@@ -1353,6 +1359,11 @@ video {
1353
1359
  --tw-rotate: 90deg;
1354
1360
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1355
1361
  }
1362
+ .\!scale-\[1\.5\] {
1363
+ --tw-scale-x: 1.5 !important;
1364
+ --tw-scale-y: 1.5 !important;
1365
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;
1366
+ }
1356
1367
  .scale-75 {
1357
1368
  --tw-scale-x: .75;
1358
1369
  --tw-scale-y: .75;
@@ -2482,10 +2493,6 @@ video {
2482
2493
  --tw-blur: blur(8px);
2483
2494
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
2484
2495
  }
2485
- .drop-shadow-2xl {
2486
- --tw-drop-shadow: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15));
2487
- filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
2488
- }
2489
2496
  .filter {
2490
2497
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
2491
2498
  }
@@ -2761,6 +2768,12 @@ body {
2761
2768
  z-index: auto;
2762
2769
  }
2763
2770
 
2771
+ .hover\:\!scale-\[1\.5\]:hover {
2772
+ --tw-scale-x: 1.5 !important;
2773
+ --tw-scale-y: 1.5 !important;
2774
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;
2775
+ }
2776
+
2764
2777
  .hover\:scale-105:hover {
2765
2778
  --tw-scale-x: 1.05;
2766
2779
  --tw-scale-y: 1.05;
@@ -0,0 +1,2 @@
1
+ export declare const LinkOverContainer: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=LinkOverContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkOverContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/LinkOverContainer.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAAI,UAAK,4CA8CtC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/Map.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwG,MAAM,OAAO,CAAC;AAG7H,OAAO,kCAAkC,CAAC;AAY1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK1C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;IAWrB,CAAA;AAqoBD,QAAA,MAAM,UAAU,4GAA4B,CAAC;AAC7C,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/Map.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwG,MAAM,OAAO,CAAC;AAG7H,OAAO,kCAAkC,CAAC;AAY1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO1C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;IAWrB,CAAA;AA4iBD,QAAA,MAAM,UAAU,4GAA4B,CAAC;AAC7C,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PinItem.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/PinItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4F,MAAM,OAAO,CAAA;;AA6IhH,wBAA4B"}
1
+ {"version":3,"file":"PinItem.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/PinItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4F,MAAM,OAAO,CAAA;;AA6JhH,wBAA4B"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("react").MemoExoticComponent<(props: any) => import("react/jsx-runtime").JSX.Element>;
2
+ export default _default;
3
+ //# sourceMappingURL=SourcePort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourcePort.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/SourcePort.tsx"],"names":[],"mappings":";AAiQA,wBAAiC"}
@@ -17,12 +17,16 @@ export type NetworkMapProps = {
17
17
  staticMapColor: string;
18
18
  isolateNonSelectedLinksOnNodeClick: boolean;
19
19
  showLinkCount: boolean;
20
+ showEndpoints: boolean;
21
+ getOverLinkElementDelay: number;
20
22
  tid: string | number;
21
23
  onConnClick: (conn: object) => void;
22
24
  onNodeClick: (node: object) => void;
23
25
  getCenterBox: (conn: object) => void;
24
26
  onNodeMouseOver: (node: object) => void;
25
27
  getMenuTitle: (connection: object) => void;
28
+ getOverLinkElement: (connection: object) => void;
29
+ getEndpointText: (connection: object) => void;
26
30
  onLinkContextMenu: (info: {
27
31
  data: object;
28
32
  event: React.MouseEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkMap/types.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,EAAG,OAAO,CAAC;IACvB,sBAAsB,EAAG,MAAM,CAAC;IAChC,cAAc,EAAG,MAAM,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAG,MAAM,CAAC;IACxB,kCAAkC,EAAE,OAAO,CAAC;IAC5C,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAG,MAAM,GAAG,MAAM,CAAG;IACxB,WAAW,EAAE,CAAC,I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/stories/Map/map.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAW1D,wBAsCC;AA0ID,eAAO,MAAM,OAAO,KAAoB,CAAC;AAgEzC,eAAO,MAAM,cAAc,KAAoB,CAAC;AAYhD,eAAO,MAAM,mBAAmB,KAAoB,CAAC;AAOrD,eAAO,MAAM,eAAe,KAAoB,CAAC;AAIjD,eAAO,MAAM,WAAW,KAAoB,CAAC;AAK7C,eAAO,MAAM,UAAU,KAAoB,CAAC"}
1
+ {"version":3,"file":"map.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Map/map.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAY1D,wBAsCC;AA0ID,eAAO,MAAM,OAAO,KAAoB,CAAC;AA4EzC,eAAO,MAAM,cAAc,KAAoB,CAAC;AAYhD,eAAO,MAAM,mBAAmB,KAAoB,CAAC;AAOrD,eAAO,MAAM,eAAe,KAAoB,CAAC;AAIjD,eAAO,MAAM,WAAW,KAAoB,CAAC;AAK7C,eAAO,MAAM,UAAU,KAAoB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abdellatifui/react",
3
3
  "private": false,
4
- "version": "3.1.79",
4
+ "version": "3.1.81",
5
5
  "type": "module",
6
6
  "types": "dist/nextgen.d.ts",
7
7
  "files": [