@plurid/plurid-react 0.0.0-29 → 0.0.0-31

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.
@@ -5468,21 +5468,25 @@ const StyledFadeIn = styled__default["default"].div`
5468
5468
  `;
5469
5469
 
5470
5470
  const FadeIn = properties => {
5471
+ const {time: time} = properties;
5471
5472
  const [fadedIn, setFadedIn] = React.useState(false);
5472
5473
  React.useEffect((() => {
5473
- setTimeout((() => {
5474
- setFadedIn(true);
5475
- }), 10);
5474
+ if (time > 0) {
5475
+ setTimeout((() => {
5476
+ setFadedIn(true);
5477
+ }), time);
5478
+ }
5476
5479
  }), []);
5477
- if (fadedIn) {
5480
+ if (fadedIn || time === 0) {
5478
5481
  return React__default["default"].createElement(React__default["default"].Fragment, null);
5479
5482
  }
5480
5483
  return React__default["default"].createElement(StyledFadeIn, null);
5481
5484
  };
5482
5485
 
5483
5486
  const PluridRouterBrowser = properties => {
5484
- const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, scrollToTop: scrollToTop, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
5487
+ const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, scrollToTop: scrollToTop, fadeIn: fadeInProperty, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
5485
5488
  const notFoundPath = notFoundPathProperty || "/not-found";
5489
+ const fadeIn = fadeInProperty !== null && fadeInProperty !== void 0 ? fadeInProperty : 10;
5486
5490
  const pluridPlanes = gatherPluridPlanes(routes, planes);
5487
5491
  const topContainer = React.useRef(null);
5488
5492
  const pluridPlanesRegistrar = React.useRef(new PluridPlanesRegistrar(pluridPlanes, hostname));
@@ -5578,7 +5582,9 @@ const PluridRouterBrowser = properties => {
5578
5582
  PluridRouterShell.displayName = "PluridRouterShell";
5579
5583
  }
5580
5584
  }
5581
- return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(FadeIn, null), React__default["default"].createElement(PluridScrollTop, {
5585
+ return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(FadeIn, {
5586
+ time: fadeIn
5587
+ }), React__default["default"].createElement(PluridScrollTop, {
5582
5588
  ref: topContainer
5583
5589
  }), PluridRouterExterior && React__default["default"].createElement(PluridRouterExterior, {
5584
5590
  matchedRoute: matchedRoute
@@ -5588,10 +5594,10 @@ const PluridRouterBrowser = properties => {
5588
5594
  };
5589
5595
 
5590
5596
  const PluridRouterStatic = properties => {
5591
- const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, hostname: hostnameProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty} = properties;
5597
+ const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, hostname: hostnameProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty, routerProperties: routerProperties} = properties;
5592
5598
  const protocol = protocolProperty || "http";
5593
5599
  const hostname = hostnameProperty || "origin";
5594
- return React__default["default"].createElement(PluridRouterBrowser, {
5600
+ return React__default["default"].createElement(PluridRouterBrowser, Object.assign({
5595
5601
  routes: routes,
5596
5602
  planes: planes,
5597
5603
  exterior: exterior,
@@ -5602,7 +5608,7 @@ const PluridRouterStatic = properties => {
5602
5608
  },
5603
5609
  protocol: protocol,
5604
5610
  hostname: hostname
5605
- });
5611
+ }, routerProperties));
5606
5612
  };
5607
5613
 
5608
5614
  class PluridProvider extends React.Component {
@@ -5727,17 +5733,18 @@ const PluridLink = properties => {
5727
5733
  if (!planesRegistry) {
5728
5734
  return React__default["default"].createElement(React__default["default"].Fragment, null, properties.children);
5729
5735
  }
5730
- const {children: children, route: planeRoute, devisible: _devisible, suffix: _suffix, atClick: atClick, style: style, className: className, preview: preview, previewComponent: previewComponent, previewFadeIn: previewFadeIn, previewFadeOut: previewFadeOut, previewOffsetX: previewOffsetX, previewOffsetY: previewOffsetY, stateTree: stateTree, stateLastClosedPlane: stateLastClosedPlane, stateGeneralTheme: stateGeneralTheme, stateConfiguration: stateConfiguration, stateViewSize: stateViewSize, dispatch: dispatch, dispatchSetTree: dispatchSetTree, dispatchSetSpaceField: dispatchSetSpaceField, dispatchUpdateSpaceLinkCoordinates: dispatchUpdateSpaceLinkCoordinates} = properties;
5736
+ const {children: children, route: planeRoute, devisible: devisibleProperty, suffix: suffixProperty, atClick: atClick, style: style, className: className, preview: preview, previewComponent: previewComponent, previewFadeIn: previewFadeIn, previewFadeOut: previewFadeOut, previewOffsetX: previewOffsetX, previewOffsetY: previewOffsetY, stateTree: stateTree, stateLastClosedPlane: stateLastClosedPlane, stateGeneralTheme: stateGeneralTheme, stateConfiguration: stateConfiguration, stateViewSize: stateViewSize, dispatch: dispatch, dispatchSetTree: dispatchSetTree, dispatchSetSpaceField: dispatchSetSpaceField, dispatchUpdateSpaceLinkCoordinates: dispatchUpdateSpaceLinkCoordinates} = properties;
5731
5737
  const planeControls = stateConfiguration.elements.plane.controls.show;
5732
5738
  const previewAppearTime = previewFadeIn || pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN;
5733
5739
  const previewDisappearTime = previewFadeOut || pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT;
5734
5740
  const planeRouteResolved = computePlaneAddress(planeRoute);
5735
5741
  const absolutePlaneRoute = resolveRoute(planeRouteResolved, stateConfiguration.network.protocol, hostname || stateConfiguration.network.host);
5736
- const suffix = _suffix !== null && _suffix !== void 0 ? _suffix : pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX;
5737
- const devisible = _devisible !== null && _devisible !== void 0 ? _devisible : false;
5742
+ const suffix = suffixProperty !== null && suffixProperty !== void 0 ? suffixProperty : pluridData.PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX;
5743
+ const devisible = devisibleProperty !== null && devisibleProperty !== void 0 ? devisibleProperty : false;
5738
5744
  const linkElement = React.useRef(null);
5739
5745
  const hoverInTimeout = React.useRef(null);
5740
5746
  const hoverOutTimeout = React.useRef(null);
5747
+ const planeRef = React.useRef();
5741
5748
  const [mouseOver, setMouseOver] = React.useState(false);
5742
5749
  const [showPreview, setShowPreview] = React.useState(false);
5743
5750
  const [showLink, setShowLink] = React.useState(false);
@@ -5806,6 +5813,20 @@ const PluridLink = properties => {
5806
5813
  const debouncedUpdateLinkCoordinates = pluridFunctionsReact.useDebouncedCallback((() => {
5807
5814
  updateLinkCoordinates();
5808
5815
  }), pluridData.PLURID_DEFAULT_RESIZE_DEBOUNCE_TIME);
5816
+ const assignTreePlaneToLink = (parentPlane, linkCoordinates) => {
5817
+ if (!parentPlane || !parentPlane.children) {
5818
+ return;
5819
+ }
5820
+ for (const plane of parentPlane.children) {
5821
+ if (!plane.linkCoordinates) {
5822
+ continue;
5823
+ }
5824
+ if (plane.linkCoordinates.x === linkCoordinates.x || plane.linkCoordinates.y === linkCoordinates.y) {
5825
+ setShowLink(true);
5826
+ setPluridPlaneID(plane.planeID);
5827
+ }
5828
+ }
5829
+ };
5809
5830
  const updateTreeWithLink = event => {
5810
5831
  if (!parentPlaneID || !absolutePlaneRoute) {
5811
5832
  return;
@@ -5892,6 +5913,8 @@ const PluridLink = properties => {
5892
5913
  setParentPlaneID(parentPlaneID);
5893
5914
  const linkCoordinates = getPluridLinkCoordinates();
5894
5915
  setLinkCoordinates(linkCoordinates);
5916
+ const parentPlane = pluridEngine.space.tree.logic.getTreePlaneByID(stateTree, parentPlaneID);
5917
+ assignTreePlaneToLink(parentPlane, linkCoordinates);
5895
5918
  }), []);
5896
5919
  React.useEffect((() => {
5897
5920
  if (showLink) {
@@ -5964,10 +5987,17 @@ const PluridLink = properties => {
5964
5987
  defaultPubSub.unsubscribe(closePlaneIndex);
5965
5988
  };
5966
5989
  }), [ showLink, pluridPlaneID, JSON.stringify(stateTree) ]);
5967
- React.useEffect((() => () => {
5968
- if (showLink && linkElement.current === null) {
5969
- removePlane();
5970
- }
5990
+ React.useEffect((() => {
5991
+ const plane = pluridEngine.space.tree.logic.getTreePlaneByID(stateTree, pluridPlaneID);
5992
+ planeRef.current = plane;
5993
+ return () => {
5994
+ setTimeout((() => {
5995
+ var _a;
5996
+ if (showLink && linkElement.current === null && ((_a = planeRef.current) === null || _a === void 0 ? void 0 : _a.show) === false) {
5997
+ removePlane();
5998
+ }
5999
+ }), 10);
6000
+ };
5971
6001
  }), [ showLink, showPreview, pluridPlaneID, parentPlaneID, JSON.stringify(stateTree) ]);
5972
6002
  return React__default["default"].createElement(StyledPluridLink, {
5973
6003
  ref: linkElement,