@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.
- package/distribution/containers/RouterBrowser/FadeIn/index.d.ts +1 -0
- package/distribution/containers/RouterStatic/index.d.ts +2 -1
- package/distribution/index.d.ts +4 -3
- package/distribution/index.es.js +46 -16
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +46 -16
- package/distribution/index.js.map +1 -1
- package/distribution/index.min.js +2 -2
- package/distribution/index.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PluridRoute, PluridRoutePlane } from '@plurid/plurid-data';
|
|
2
|
+
import { PluridRoute, PluridRoutePlane, PluridRouterProperties } from '@plurid/plurid-data';
|
|
3
3
|
import { PluridReactComponent } from "../../data/interfaces";
|
|
4
4
|
export interface PluridRouterStaticOwnProperties {
|
|
5
5
|
path: string;
|
|
@@ -13,6 +13,7 @@ export interface PluridRouterStaticOwnProperties {
|
|
|
13
13
|
gateway?: boolean;
|
|
14
14
|
gatewayQuery?: string;
|
|
15
15
|
gatewayEndpoint?: string;
|
|
16
|
+
routerProperties?: Partial<PluridRouterProperties<PluridReactComponent>>;
|
|
16
17
|
}
|
|
17
18
|
declare const PluridRouterStatic: (properties: PluridRouterStaticOwnProperties) => JSX.Element;
|
|
18
19
|
export default PluridRouterStatic;
|
package/distribution/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Theme } from '@plurid/plurid-themes';
|
|
3
|
-
import { PLURID_PUBSUB_TOPIC, PluridPlane, PluridView, PluridUniverse, PluridConfiguration, PluridPartialConfiguration, RecursivePartial, PluridRoute, PluridRouteSpace, PluridRouteUniverse, PluridRoutePlane, ComponentWithPlurid, PluridPlaneComponentProperty, PluridRouteComponentProperty, PluridPreserve, PluridPreserveTransmission, PluridPubSubPublishMessage, PluridPubSubSubscribeMessage, LAYOUT_TYPES as SPACE_LAYOUT, SIZES, TRANSFORM_MODES, TRANSFORM_TOUCHES, PLURID_ROUTER_LOCATION_CHANGED, PLURID_ROUTER_LOCATION_STORED } from '@plurid/plurid-data';
|
|
3
|
+
import { PLURID_PUBSUB_TOPIC, PluridPlane, PluridView, PluridUniverse, PluridConfiguration, PluridPartialConfiguration, PluridRouterProperties, RecursivePartial, PluridRoute, PluridRouteSpace, PluridRouteUniverse, PluridRoutePlane, ComponentWithPlurid, PluridPlaneComponentProperty, PluridRouteComponentProperty, PluridPreserve, PluridPreserveTransmission, PluridPubSubPublishMessage, PluridPubSubSubscribeMessage, LAYOUT_TYPES as SPACE_LAYOUT, SIZES, TRANSFORM_MODES, TRANSFORM_TOUCHES, PLURID_ROUTER_LOCATION_CHANGED, PLURID_ROUTER_LOCATION_STORED } from '@plurid/plurid-data';
|
|
4
4
|
import { routing, pluridRouterNavigate } from '@plurid/plurid-engine';
|
|
5
5
|
import PluridPubSub from '@plurid/plurid-pubsub';
|
|
6
6
|
import { PluridReactComponent, PluridReactPlaneComponent, PluridReactRouteComponent, PluridReactPlane, PluridReactRoute, PluridReactRoutePlane, PluridRouteMatch } from './data/interfaces';
|
|
@@ -33,7 +33,7 @@ declare const internals: {
|
|
|
33
33
|
declare const Plurid: {
|
|
34
34
|
Application: typeof PluridApplication;
|
|
35
35
|
RouterStatic: (properties: import("./containers/RouterStatic").PluridRouterStaticOwnProperties) => JSX.Element;
|
|
36
|
-
RouterBrowser: (properties:
|
|
36
|
+
RouterBrowser: (properties: PluridRouterProperties<PluridReactComponent<any, PluridPlaneComponentProperty | PluridRouteComponentProperty>>) => JSX.Element;
|
|
37
37
|
Provider: typeof PluridProvider;
|
|
38
38
|
Link: import("react-redux").ConnectedComponent<import("react").FC<import("react").PropsWithChildren<import("./components/links/Link").PluridLinkProperties>>, Omit<import("react").PropsWithChildren<import("./components/links/Link").PluridLinkProperties>, "dispatch" | "stateGeneralTheme" | "stateConfiguration" | "stateTree" | "stateViewSize" | "dispatchSetSpaceField" | "dispatchSetTree" | "stateLastClosedPlane" | "dispatchUpdateSpaceLinkCoordinates"> & import("react-redux").ConnectProps>;
|
|
39
39
|
RouterLink: import("react").FC<import("./components/links/RouterLink").PluridRouterLinkOwnProperties>;
|
|
@@ -99,9 +99,10 @@ declare const Plurid: {
|
|
|
99
99
|
PluridSpaceDebugger: import("react-redux").ConnectedComponent<import("react").FC<import("./components/structural/Space/components/SpaceDebugger").PluridSpaceDebuggerProperties>, Omit<import("./components/structural/Space/components/SpaceDebugger").PluridSpaceDebuggerProperties, "stateGeneralTheme" | "stateInteractionTheme"> & import("react-redux").ConnectProps>;
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
+
declare type PluridRouterPartialProperties = Partial<PluridRouterProperties<PluridReactComponent>>;
|
|
102
103
|
export { PluridApplication, PluridRouterBrowser, PluridRouterStatic, PluridProvider, PluridLink, PluridRouterLink, PluridApplicationConfigurator, PluridPlaneConfigurator, PluridExternalPlane, PluridIframePlane, PluridVirtualList,
|
|
103
104
|
/** Interfaces */
|
|
104
|
-
Theme, PluridPlane, PluridView, PluridUniverse, PluridRoute, PluridRouteSpace, PluridRouteUniverse, PluridRoutePlane, ComponentWithPlurid, PluridPlaneComponentProperty, PluridRouteComponentProperty, PluridReactComponent, PluridReactPlane, PluridReactPlaneComponent, PluridReactRouteComponent, PluridReactRoute, PluridReactRoutePlane, PluridRouteMatch, PluridPreserve, PluridPreserveTransmission, PluridPubSubPublishMessage, PluridPubSubSubscribeMessage, PluridConfiguration, PluridPartialConfiguration, RecursivePartial,
|
|
105
|
+
Theme, PluridPlane, PluridView, PluridUniverse, PluridRouterProperties, PluridRouterPartialProperties, PluridRoute, PluridRouteSpace, PluridRouteUniverse, PluridRoutePlane, ComponentWithPlurid, PluridPlaneComponentProperty, PluridRouteComponentProperty, PluridReactComponent, PluridReactPlane, PluridReactPlaneComponent, PluridReactRouteComponent, PluridReactRoute, PluridReactRoutePlane, PluridRouteMatch, PluridPreserve, PluridPreserveTransmission, PluridPubSubPublishMessage, PluridPubSubSubscribeMessage, PluridConfiguration, PluridPartialConfiguration, RecursivePartial,
|
|
105
106
|
/** Enumerations */
|
|
106
107
|
SPACE_LAYOUT, SIZES, TRANSFORM_MODES, TRANSFORM_TOUCHES, PLURID_ROUTER_LOCATION_CHANGED, PLURID_ROUTER_LOCATION_STORED,
|
|
107
108
|
/** Engine */
|
package/distribution/index.es.js
CHANGED
|
@@ -5430,21 +5430,25 @@ const StyledFadeIn = styled.div`
|
|
|
5430
5430
|
`;
|
|
5431
5431
|
|
|
5432
5432
|
const FadeIn = properties => {
|
|
5433
|
+
const {time: time} = properties;
|
|
5433
5434
|
const [fadedIn, setFadedIn] = useState(false);
|
|
5434
5435
|
useEffect((() => {
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5436
|
+
if (time > 0) {
|
|
5437
|
+
setTimeout((() => {
|
|
5438
|
+
setFadedIn(true);
|
|
5439
|
+
}), time);
|
|
5440
|
+
}
|
|
5438
5441
|
}), []);
|
|
5439
|
-
if (fadedIn) {
|
|
5442
|
+
if (fadedIn || time === 0) {
|
|
5440
5443
|
return React.createElement(React.Fragment, null);
|
|
5441
5444
|
}
|
|
5442
5445
|
return React.createElement(StyledFadeIn, null);
|
|
5443
5446
|
};
|
|
5444
5447
|
|
|
5445
5448
|
const PluridRouterBrowser = properties => {
|
|
5446
|
-
const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, scrollToTop: scrollToTop, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
|
|
5449
|
+
const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, scrollToTop: scrollToTop, fadeIn: fadeInProperty, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
|
|
5447
5450
|
const notFoundPath = notFoundPathProperty || "/not-found";
|
|
5451
|
+
const fadeIn = fadeInProperty !== null && fadeInProperty !== void 0 ? fadeInProperty : 10;
|
|
5448
5452
|
const pluridPlanes = gatherPluridPlanes(routes, planes);
|
|
5449
5453
|
const topContainer = useRef(null);
|
|
5450
5454
|
const pluridPlanesRegistrar = useRef(new PluridPlanesRegistrar(pluridPlanes, hostname));
|
|
@@ -5540,7 +5544,9 @@ const PluridRouterBrowser = properties => {
|
|
|
5540
5544
|
PluridRouterShell.displayName = "PluridRouterShell";
|
|
5541
5545
|
}
|
|
5542
5546
|
}
|
|
5543
|
-
return React.createElement(React.Fragment, null, React.createElement(FadeIn,
|
|
5547
|
+
return React.createElement(React.Fragment, null, React.createElement(FadeIn, {
|
|
5548
|
+
time: fadeIn
|
|
5549
|
+
}), React.createElement(PluridScrollTop, {
|
|
5544
5550
|
ref: topContainer
|
|
5545
5551
|
}), PluridRouterExterior && React.createElement(PluridRouterExterior, {
|
|
5546
5552
|
matchedRoute: matchedRoute
|
|
@@ -5550,10 +5556,10 @@ const PluridRouterBrowser = properties => {
|
|
|
5550
5556
|
};
|
|
5551
5557
|
|
|
5552
5558
|
const PluridRouterStatic = properties => {
|
|
5553
|
-
const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, hostname: hostnameProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty} = properties;
|
|
5559
|
+
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;
|
|
5554
5560
|
const protocol = protocolProperty || "http";
|
|
5555
5561
|
const hostname = hostnameProperty || "origin";
|
|
5556
|
-
return React.createElement(PluridRouterBrowser, {
|
|
5562
|
+
return React.createElement(PluridRouterBrowser, Object.assign({
|
|
5557
5563
|
routes: routes,
|
|
5558
5564
|
planes: planes,
|
|
5559
5565
|
exterior: exterior,
|
|
@@ -5564,7 +5570,7 @@ const PluridRouterStatic = properties => {
|
|
|
5564
5570
|
},
|
|
5565
5571
|
protocol: protocol,
|
|
5566
5572
|
hostname: hostname
|
|
5567
|
-
});
|
|
5573
|
+
}, routerProperties));
|
|
5568
5574
|
};
|
|
5569
5575
|
|
|
5570
5576
|
class PluridProvider extends Component {
|
|
@@ -5689,17 +5695,18 @@ const PluridLink = properties => {
|
|
|
5689
5695
|
if (!planesRegistry) {
|
|
5690
5696
|
return React.createElement(React.Fragment, null, properties.children);
|
|
5691
5697
|
}
|
|
5692
|
-
const {children: children, route: planeRoute, devisible:
|
|
5698
|
+
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;
|
|
5693
5699
|
const planeControls = stateConfiguration.elements.plane.controls.show;
|
|
5694
5700
|
const previewAppearTime = previewFadeIn || PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN;
|
|
5695
5701
|
const previewDisappearTime = previewFadeOut || PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT;
|
|
5696
5702
|
const planeRouteResolved = computePlaneAddress(planeRoute);
|
|
5697
5703
|
const absolutePlaneRoute = resolveRoute(planeRouteResolved, stateConfiguration.network.protocol, hostname || stateConfiguration.network.host);
|
|
5698
|
-
const suffix =
|
|
5699
|
-
const devisible =
|
|
5704
|
+
const suffix = suffixProperty !== null && suffixProperty !== void 0 ? suffixProperty : PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX;
|
|
5705
|
+
const devisible = devisibleProperty !== null && devisibleProperty !== void 0 ? devisibleProperty : false;
|
|
5700
5706
|
const linkElement = useRef(null);
|
|
5701
5707
|
const hoverInTimeout = useRef(null);
|
|
5702
5708
|
const hoverOutTimeout = useRef(null);
|
|
5709
|
+
const planeRef = useRef();
|
|
5703
5710
|
const [mouseOver, setMouseOver] = useState(false);
|
|
5704
5711
|
const [showPreview, setShowPreview] = useState(false);
|
|
5705
5712
|
const [showLink, setShowLink] = useState(false);
|
|
@@ -5768,6 +5775,20 @@ const PluridLink = properties => {
|
|
|
5768
5775
|
const debouncedUpdateLinkCoordinates = useDebouncedCallback((() => {
|
|
5769
5776
|
updateLinkCoordinates();
|
|
5770
5777
|
}), PLURID_DEFAULT_RESIZE_DEBOUNCE_TIME);
|
|
5778
|
+
const assignTreePlaneToLink = (parentPlane, linkCoordinates) => {
|
|
5779
|
+
if (!parentPlane || !parentPlane.children) {
|
|
5780
|
+
return;
|
|
5781
|
+
}
|
|
5782
|
+
for (const plane of parentPlane.children) {
|
|
5783
|
+
if (!plane.linkCoordinates) {
|
|
5784
|
+
continue;
|
|
5785
|
+
}
|
|
5786
|
+
if (plane.linkCoordinates.x === linkCoordinates.x || plane.linkCoordinates.y === linkCoordinates.y) {
|
|
5787
|
+
setShowLink(true);
|
|
5788
|
+
setPluridPlaneID(plane.planeID);
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
};
|
|
5771
5792
|
const updateTreeWithLink = event => {
|
|
5772
5793
|
if (!parentPlaneID || !absolutePlaneRoute) {
|
|
5773
5794
|
return;
|
|
@@ -5854,6 +5875,8 @@ const PluridLink = properties => {
|
|
|
5854
5875
|
setParentPlaneID(parentPlaneID);
|
|
5855
5876
|
const linkCoordinates = getPluridLinkCoordinates();
|
|
5856
5877
|
setLinkCoordinates(linkCoordinates);
|
|
5878
|
+
const parentPlane = space$2.tree.logic.getTreePlaneByID(stateTree, parentPlaneID);
|
|
5879
|
+
assignTreePlaneToLink(parentPlane, linkCoordinates);
|
|
5857
5880
|
}), []);
|
|
5858
5881
|
useEffect((() => {
|
|
5859
5882
|
if (showLink) {
|
|
@@ -5926,10 +5949,17 @@ const PluridLink = properties => {
|
|
|
5926
5949
|
defaultPubSub.unsubscribe(closePlaneIndex);
|
|
5927
5950
|
};
|
|
5928
5951
|
}), [ showLink, pluridPlaneID, JSON.stringify(stateTree) ]);
|
|
5929
|
-
useEffect((() =>
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5952
|
+
useEffect((() => {
|
|
5953
|
+
const plane = space$2.tree.logic.getTreePlaneByID(stateTree, pluridPlaneID);
|
|
5954
|
+
planeRef.current = plane;
|
|
5955
|
+
return () => {
|
|
5956
|
+
setTimeout((() => {
|
|
5957
|
+
var _a;
|
|
5958
|
+
if (showLink && linkElement.current === null && ((_a = planeRef.current) === null || _a === void 0 ? void 0 : _a.show) === false) {
|
|
5959
|
+
removePlane();
|
|
5960
|
+
}
|
|
5961
|
+
}), 10);
|
|
5962
|
+
};
|
|
5933
5963
|
}), [ showLink, showPreview, pluridPlaneID, parentPlaneID, JSON.stringify(stateTree) ]);
|
|
5934
5964
|
return React.createElement(StyledPluridLink, {
|
|
5935
5965
|
ref: linkElement,
|