@plurid/plurid-react 0.0.0-31 → 0.0.0-32
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/components/links/Link/index.d.ts +2 -1
- package/distribution/index.d.ts +1 -1
- package/distribution/index.es.js +26 -22
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +25 -21
- package/distribution/index.js.map +1 -1
- package/distribution/index.min.js +2 -2
- package/distribution/index.min.js.map +1 -1
- package/distribution/services/state/actions/index.d.ts +4 -0
- package/distribution/services/state/modules/space/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -18,7 +18,8 @@ export interface PluridLinkDispatchProperties {
|
|
|
18
18
|
dispatchSetTree: DispatchAction<typeof actions.space.setTree>;
|
|
19
19
|
dispatchSetSpaceField: DispatchAction<typeof actions.space.setSpaceField>;
|
|
20
20
|
dispatchUpdateSpaceLinkCoordinates: DispatchAction<typeof actions.space.updateSpaceLinkCoordinates>;
|
|
21
|
+
dispatchRemovePlane: DispatchAction<typeof actions.space.removePlane>;
|
|
21
22
|
}
|
|
22
23
|
export declare type PluridLinkProperties = PluridLinkOwnProperties<PluridReactComponent, React.CSSProperties, React.MouseEvent> & PluridLinkStateProperties & PluridLinkDispatchProperties;
|
|
23
|
-
declare const ConnectedPluridLink: import("react-redux").ConnectedComponent<React.FC<React.PropsWithChildren<PluridLinkProperties>>, Omit<React.PropsWithChildren<PluridLinkProperties>, "dispatch" | "stateGeneralTheme" | "stateConfiguration" | "stateTree" | "stateViewSize" | "dispatchSetSpaceField" | "dispatchSetTree" | "stateLastClosedPlane" | "dispatchUpdateSpaceLinkCoordinates"> & import("react-redux").ConnectProps>;
|
|
24
|
+
declare const ConnectedPluridLink: import("react-redux").ConnectedComponent<React.FC<React.PropsWithChildren<PluridLinkProperties>>, Omit<React.PropsWithChildren<PluridLinkProperties>, "dispatch" | "stateGeneralTheme" | "stateConfiguration" | "stateTree" | "stateViewSize" | "dispatchSetSpaceField" | "dispatchSetTree" | "stateLastClosedPlane" | "dispatchUpdateSpaceLinkCoordinates" | "dispatchRemovePlane"> & import("react-redux").ConnectProps>;
|
|
24
25
|
export default ConnectedPluridLink;
|
package/distribution/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ declare const Plurid: {
|
|
|
35
35
|
RouterStatic: (properties: import("./containers/RouterStatic").PluridRouterStaticOwnProperties) => JSX.Element;
|
|
36
36
|
RouterBrowser: (properties: PluridRouterProperties<PluridReactComponent<any, PluridPlaneComponentProperty | PluridRouteComponentProperty>>) => JSX.Element;
|
|
37
37
|
Provider: typeof PluridProvider;
|
|
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>;
|
|
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" | "dispatchRemovePlane"> & import("react-redux").ConnectProps>;
|
|
39
39
|
RouterLink: import("react").FC<import("./components/links/RouterLink").PluridRouterLinkOwnProperties>;
|
|
40
40
|
ApplicationConfigurator: import("react-redux").ConnectedComponent<import("react").FC<import("react").PropsWithChildren<import("./components/utilities/ApplicationConfigurator").PluridApplicationConfiguratorProperties>>, Omit<import("react").PropsWithChildren<import("./components/utilities/ApplicationConfigurator").PluridApplicationConfiguratorProperties>, "stateConfiguration" | "dispatchSetConfiguration"> & import("react-redux").ConnectProps>;
|
|
41
41
|
PlaneConfigurator: import("react-redux").ConnectedComponent<import("react").FC<import("react").PropsWithChildren<import("./components/utilities/PlaneConfigurator").PluridPlaneConfiguratorProperties>>, Omit<import("react").PropsWithChildren<import("./components/utilities/PlaneConfigurator").PluridPlaneConfiguratorProperties>, never> & import("react-redux").ConnectProps>;
|
package/distribution/index.es.js
CHANGED
|
@@ -16,7 +16,7 @@ import { connect, Provider } from "react-redux";
|
|
|
16
16
|
|
|
17
17
|
import { createSlice, combineReducers, configureStore } from "@reduxjs/toolkit";
|
|
18
18
|
|
|
19
|
-
import { mathematics, dom, meta,
|
|
19
|
+
import { mathematics, objects, dom, meta, uuid, storage } from "@plurid/plurid-functions";
|
|
20
20
|
|
|
21
21
|
import themes$2, { plurid, decomposeColor } from "@plurid/plurid-themes";
|
|
22
22
|
|
|
@@ -602,6 +602,10 @@ const space = createSlice({
|
|
|
602
602
|
},
|
|
603
603
|
spaceSetCulledView: (state, action) => {
|
|
604
604
|
state.culledView = action.payload;
|
|
605
|
+
},
|
|
606
|
+
removePlane: (state, action) => {
|
|
607
|
+
const updatedTree = space$2.tree.logic.removePlaneFromTree(objects.clone(state.tree), action.payload);
|
|
608
|
+
state.tree = updatedTree;
|
|
605
609
|
}
|
|
606
610
|
}
|
|
607
611
|
});
|
|
@@ -5695,7 +5699,7 @@ const PluridLink = properties => {
|
|
|
5695
5699
|
if (!planesRegistry) {
|
|
5696
5700
|
return React.createElement(React.Fragment, null, properties.children);
|
|
5697
5701
|
}
|
|
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;
|
|
5702
|
+
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, dispatchRemovePlane: dispatchRemovePlane} = properties;
|
|
5699
5703
|
const planeControls = stateConfiguration.elements.plane.controls.show;
|
|
5700
5704
|
const previewAppearTime = previewFadeIn || PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN;
|
|
5701
5705
|
const previewDisappearTime = previewFadeOut || PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT;
|
|
@@ -5706,7 +5710,6 @@ const PluridLink = properties => {
|
|
|
5706
5710
|
const linkElement = useRef(null);
|
|
5707
5711
|
const hoverInTimeout = useRef(null);
|
|
5708
5712
|
const hoverOutTimeout = useRef(null);
|
|
5709
|
-
const planeRef = useRef();
|
|
5710
5713
|
const [mouseOver, setMouseOver] = useState(false);
|
|
5711
5714
|
const [showPreview, setShowPreview] = useState(false);
|
|
5712
5715
|
const [showLink, setShowLink] = useState(false);
|
|
@@ -5784,6 +5787,9 @@ const PluridLink = properties => {
|
|
|
5784
5787
|
continue;
|
|
5785
5788
|
}
|
|
5786
5789
|
if (plane.linkCoordinates.x === linkCoordinates.x || plane.linkCoordinates.y === linkCoordinates.y) {
|
|
5790
|
+
if (pluridPlaneID === plane.planeID) {
|
|
5791
|
+
continue;
|
|
5792
|
+
}
|
|
5787
5793
|
setShowLink(true);
|
|
5788
5794
|
setPluridPlaneID(plane.planeID);
|
|
5789
5795
|
}
|
|
@@ -5849,9 +5855,12 @@ const PluridLink = properties => {
|
|
|
5849
5855
|
}
|
|
5850
5856
|
};
|
|
5851
5857
|
const removePlane = () => {
|
|
5852
|
-
const
|
|
5853
|
-
|
|
5854
|
-
|
|
5858
|
+
const pluridPlane = document.getElementById(pluridPlaneID);
|
|
5859
|
+
if (!pluridPlane) {
|
|
5860
|
+
return;
|
|
5861
|
+
}
|
|
5862
|
+
dispatchRemovePlane(pluridPlaneID);
|
|
5863
|
+
setShowLink(false);
|
|
5855
5864
|
setShowPreview(false);
|
|
5856
5865
|
};
|
|
5857
5866
|
const handleClick = useCallback((event => {
|
|
@@ -5871,11 +5880,11 @@ const PluridLink = properties => {
|
|
|
5871
5880
|
return;
|
|
5872
5881
|
};
|
|
5873
5882
|
useEffect((() => {
|
|
5874
|
-
const
|
|
5875
|
-
setParentPlaneID(
|
|
5883
|
+
const newParentPlaneID = getPluridPlaneIDByData$1(linkElement.current);
|
|
5884
|
+
setParentPlaneID(newParentPlaneID);
|
|
5876
5885
|
const linkCoordinates = getPluridLinkCoordinates();
|
|
5877
5886
|
setLinkCoordinates(linkCoordinates);
|
|
5878
|
-
const parentPlane = space$2.tree.logic.getTreePlaneByID(stateTree,
|
|
5887
|
+
const parentPlane = space$2.tree.logic.getTreePlaneByID(stateTree, newParentPlaneID);
|
|
5879
5888
|
assignTreePlaneToLink(parentPlane, linkCoordinates);
|
|
5880
5889
|
}), []);
|
|
5881
5890
|
useEffect((() => {
|
|
@@ -5910,7 +5919,6 @@ const PluridLink = properties => {
|
|
|
5910
5919
|
}
|
|
5911
5920
|
};
|
|
5912
5921
|
}), [ preview, mouseOver ]);
|
|
5913
|
-
useEffect((() => {}), []);
|
|
5914
5922
|
useEffect((() => {
|
|
5915
5923
|
const openClosedPlaneIndex = defaultPubSub.subscribe({
|
|
5916
5924
|
topic: PLURID_PUBSUB_TOPIC.OPEN_CLOSED_PLANE,
|
|
@@ -5949,17 +5957,12 @@ const PluridLink = properties => {
|
|
|
5949
5957
|
defaultPubSub.unsubscribe(closePlaneIndex);
|
|
5950
5958
|
};
|
|
5951
5959
|
}), [ showLink, pluridPlaneID, JSON.stringify(stateTree) ]);
|
|
5952
|
-
useEffect((() => {
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
if (showLink && linkElement.current === null && ((_a = planeRef.current) === null || _a === void 0 ? void 0 : _a.show) === false) {
|
|
5959
|
-
removePlane();
|
|
5960
|
-
}
|
|
5961
|
-
}), 10);
|
|
5962
|
-
};
|
|
5960
|
+
useEffect((() => () => {
|
|
5961
|
+
setTimeout((() => {
|
|
5962
|
+
if (pluridPlaneID && showLink && linkElement.current === null) {
|
|
5963
|
+
removePlane();
|
|
5964
|
+
}
|
|
5965
|
+
}), 10);
|
|
5963
5966
|
}), [ showLink, showPreview, pluridPlaneID, parentPlaneID, JSON.stringify(stateTree) ]);
|
|
5964
5967
|
return React.createElement(StyledPluridLink, {
|
|
5965
5968
|
ref: linkElement,
|
|
@@ -5998,7 +6001,8 @@ const mapDispatchToProperties$5 = dispatch => ({
|
|
|
5998
6001
|
dispatch: dispatch,
|
|
5999
6002
|
dispatchSetTree: payload => dispatch(actions.space.setTree(payload)),
|
|
6000
6003
|
dispatchSetSpaceField: payload => dispatch(actions.space.setSpaceField(payload)),
|
|
6001
|
-
dispatchUpdateSpaceLinkCoordinates: payload => dispatch(actions.space.updateSpaceLinkCoordinates(payload))
|
|
6004
|
+
dispatchUpdateSpaceLinkCoordinates: payload => dispatch(actions.space.updateSpaceLinkCoordinates(payload)),
|
|
6005
|
+
dispatchRemovePlane: payload => dispatch(actions.space.removePlane(payload))
|
|
6002
6006
|
});
|
|
6003
6007
|
|
|
6004
6008
|
const ConnectedPluridLink = connect(mapStateToProperties$5, mapDispatchToProperties$5, null, {
|