@plurid/plurid-react 0.0.0-20 → 0.0.0-23

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.
@@ -9,7 +9,7 @@ export interface PluridRouterStaticOwnProperties {
9
9
  routes: PluridRoute<PluridReactComponent>[];
10
10
  planes: PluridRoutePlane<PluridReactComponent>[];
11
11
  protocol?: string;
12
- host?: string;
12
+ hostname?: string;
13
13
  gateway?: boolean;
14
14
  gatewayQuery?: string;
15
15
  gatewayEndpoint?: string;
@@ -9,7 +9,7 @@ export interface PluridRouterStaticOwnProperties {
9
9
  routes: PluridRoute<PluridReactComponent>[];
10
10
  planes: PluridRoutePlane<PluridReactComponent>[];
11
11
  protocol?: string;
12
- host?: string;
12
+ hostname?: string;
13
13
  gateway?: boolean;
14
14
  gatewayQuery?: string;
15
15
  gatewayEndpoint?: string;
@@ -40,12 +40,12 @@ export declare const collectApplicationsFromPath: (isoMatch: PluridRouteMatch, p
40
40
  view: string[];
41
41
  }[]>;
42
42
  export declare const gatherPluridPlanes: (routes: PluridRoute<PluridReactComponent>[], planes: PluridRoutePlane<PluridReactComponent>[] | undefined) => PluridPlane<PluridReactComponent<any, import("@plurid/plurid-data").PluridPlaneComponentProperty | PluridRouteComponentProperty>>[];
43
- export declare const renderMultispace: (matchedRoute: PluridRouteMatch) => (() => () => JSX.Element) | (() => React.FC<any>);
44
- export declare const computePluridRoute: (matchedRoute: PluridRouteMatch | undefined, planesRegistrar: planes.Registrar<PluridReactComponent>, isoMatcher: routing.IsoMatcher<PluridReactComponent>, directPlane?: PluridRouteMatch | undefined) => any;
45
- export declare const computeInitialMatchedPath: (staticContext?: PluridRouterStatic | undefined) => string;
43
+ export declare const renderMultispace: (matchedRoute: PluridRouteMatch, hostname?: string) => (() => () => JSX.Element) | (() => React.FC<any>);
44
+ export declare const computePluridRoute: (matchedRoute: PluridRouteMatch | undefined, planesRegistrar: planes.Registrar<PluridReactComponent>, isoMatcher: routing.IsoMatcher<PluridReactComponent>, directPlane?: PluridRouteMatch, hostname?: string) => any;
45
+ export declare const computeInitialMatchedPath: (staticContext?: PluridRouterStatic) => string;
46
46
  export declare const getDirectPlaneMatch: (matchedPath: string, routes: PluridRoute<PluridReactComponent>[], planes: PluridRoutePlane<PluridReactComponent>[] | undefined) => {
47
47
  matchRoute: PluridRoute<PluridReactComponent<any, import("@plurid/plurid-data").PluridPlaneComponentProperty | PluridRouteComponentProperty>, any> | undefined;
48
48
  matchPlane: PluridRoutePlane<PluridReactComponent<any, import("@plurid/plurid-data").PluridPlaneComponentProperty | PluridRouteComponentProperty>> | undefined;
49
49
  matchPath: string | undefined;
50
50
  };
51
- export declare const renderDirectPlane: (routePlane: PluridRouteMatch, planesRegistrar: planes.Registrar<PluridReactComponent>) => () => any;
51
+ export declare const renderDirectPlane: (routePlane: PluridRouteMatch, planesRegistrar: planes.Registrar<PluridReactComponent>, hostname?: string) => () => any;
@@ -1,4 +1,4 @@
1
- import { defaultConfiguration, TRANSFORM_MODES, LAYOUT_TYPES, TRANSLATION_STEP, ROTATION_STEP, SCALE_STEP, SCALE_UPPER_LIMIT, SCALE_LOWER_LIMIT, PLURID_ENTITY_PLANE_BRIDGE, PLURID_ENTITY_PLANE_CONTROLS, PLURID_ENTITY_PLANE_CONTENT, PLURID_ENTITY_PLANE, PLURID_ENTITY_ROOT, PLURID_ENTITY_ROOTS, PLURID_ENTITY_SPACE, SIZES, PLURID_ENTITY_TRANSFORM_ORIGIN, internationalization, TRANSFORM_TOUCHES, layoutNames, defaultShortcuts, shortcutsNames, TOOLBAR_DRAWERS, PLURID_ENTITY_TOOLBAR, PLURID_ENTITY_VIEWCUBE, PLURID_PUBSUB_TOPIC, PLURID_ENTITY_VIEW, PLURID_ROUTE_DEFAULT_PATH_VALUE, PLURID_ROUTE_DEFAULT_PATH, PLURID_ROUTE_DEFAULT_SPACE_VALUE, PLURID_ROUTE_DEFAULT_SPACE, PLURID_ROUTE_DEFAULT_UNIVERSE_VALUE, PLURID_ROUTE_DEFAULT_UNIVERSE, PLURID_ROUTE_DEFAULT_CLUSTER_VALUE, PLURID_ROUTE_DEFAULT_CLUSTER, PLURID_ROUTE_SEPARATOR, PLURID_ENTITY_MULTISPACE, PLURID_ROUTER_LOCATION_CHANGED, PLURID_ROUTER_STORAGE, PLURID_ROUTER_LOCATION_STORED, PLURID_ENTITY_LINK, PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN, PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT, PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX, PLURID_ENTITY_APPLICATION_CONFIGURATOR, PLURID_ENTITY_PLANE_CONFIGURATOR } from "@plurid/plurid-data";
1
+ import { defaultConfiguration, TRANSFORM_MODES, LAYOUT_TYPES, TRANSLATION_STEP, ROTATION_STEP, SCALE_STEP, SCALE_UPPER_LIMIT, SCALE_LOWER_LIMIT, PLURID_ENTITY_PLANE_BRIDGE, PLURID_ENTITY_PLANE_CONTROLS, PLURID_ENTITY_PLANE_CONTENT, PLURID_ENTITY_PLANE, PLURID_ENTITY_ROOT, PLURID_ENTITY_ROOTS, PLURID_ENTITY_SPACE, SIZES, PLURID_ENTITY_TRANSFORM_ORIGIN, internationalization, TRANSFORM_TOUCHES, layoutNames, defaultShortcuts, shortcutsNames, TOOLBAR_DRAWERS, PLURID_ENTITY_TOOLBAR, PLURID_ENTITY_VIEWCUBE, PLURID_ENTITY_VIEW, PLURID_PUBSUB_TOPIC, PLURID_ROUTE_DEFAULT_PATH_VALUE, PLURID_ROUTE_DEFAULT_PATH, PLURID_ROUTE_DEFAULT_SPACE_VALUE, PLURID_ROUTE_DEFAULT_SPACE, PLURID_ROUTE_DEFAULT_UNIVERSE_VALUE, PLURID_ROUTE_DEFAULT_UNIVERSE, PLURID_ROUTE_DEFAULT_CLUSTER_VALUE, PLURID_ROUTE_DEFAULT_CLUSTER, PLURID_ROUTE_SEPARATOR, PLURID_ENTITY_MULTISPACE, PLURID_ROUTER_LOCATION_CHANGED, PLURID_ROUTER_STORAGE, PLURID_ROUTER_LOCATION_STORED, PLURID_ENTITY_LINK, PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN, PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT, PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX, PLURID_ENTITY_APPLICATION_CONFIGURATOR, PLURID_ENTITY_PLANE_CONFIGURATOR } from "@plurid/plurid-data";
2
2
 
3
3
  export { PLURID_PUBSUB_TOPIC, PLURID_ROUTER_LOCATION_CHANGED, PLURID_ROUTER_LOCATION_STORED, SIZES, LAYOUT_TYPES as SPACE_LAYOUT, TRANSFORM_MODES, TRANSFORM_TOUCHES } from "@plurid/plurid-data";
4
4
 
@@ -4988,7 +4988,7 @@ const handleView = view => {
4988
4988
  const {getRegisteredPlanes: getRegisteredPlanes} = planes;
4989
4989
 
4990
4990
  const PluridView = properties => {
4991
- const {planesRegistrar: planesRegistrar, customPlane: customPlane, planeContext: planeContext, planeContextValue: planeContextValue, pubsub: pubsub, planeNotFound: planeNotFound, planeRenderError: planeRenderError, matchedRoute: matchedRoute, stateConfiguration: stateConfiguration, stateTransform: stateTransform, stateSpaceView: stateSpaceView, stateTree: stateTree, dispatch: dispatch, dispatchSetConfiguration: dispatchSetConfiguration, dispatchSetGeneralTheme: dispatchSetGeneralTheme, dispatchSetInteractionTheme: dispatchSetInteractionTheme, dispatchSetSpaceLocation: dispatchSetSpaceLocation, dispatchSetAnimatedTransform: dispatchSetAnimatedTransform, dispatchSetTransformTime: dispatchSetTransformTime, dispatchSetTree: dispatchSetTree, dispatchRotateXWith: dispatchRotateXWith, dispatchRotateX: dispatchRotateX, dispatchRotateYWith: dispatchRotateYWith, dispatchRotateY: dispatchRotateY, dispatchTranslateXWith: dispatchTranslateXWith, dispatchTranslateYWith: dispatchTranslateYWith, dispatchScaleUpWith: dispatchScaleUpWith, dispatchScaleDownWith: dispatchScaleDownWith, dispatchSpaceSetViewSize: dispatchSpaceSetViewSize, dispatchSpaceSetView: dispatchSpaceSetView} = properties;
4991
+ const {planesRegistrar: planesRegistrar, customPlane: customPlane, planeContext: planeContext, planeContextValue: planeContextValue, pubsub: pubsub, planeNotFound: planeNotFound, planeRenderError: planeRenderError, matchedRoute: matchedRoute, hostname: hostname, stateConfiguration: stateConfiguration, stateTransform: stateTransform, stateSpaceView: stateSpaceView, stateTree: stateTree, dispatch: dispatch, dispatchSetConfiguration: dispatchSetConfiguration, dispatchSetGeneralTheme: dispatchSetGeneralTheme, dispatchSetInteractionTheme: dispatchSetInteractionTheme, dispatchSetSpaceLocation: dispatchSetSpaceLocation, dispatchSetAnimatedTransform: dispatchSetAnimatedTransform, dispatchSetTransformTime: dispatchSetTransformTime, dispatchSetTree: dispatchSetTree, dispatchRotateXWith: dispatchRotateXWith, dispatchRotateX: dispatchRotateX, dispatchRotateYWith: dispatchRotateYWith, dispatchRotateY: dispatchRotateY, dispatchTranslateXWith: dispatchTranslateXWith, dispatchTranslateYWith: dispatchTranslateYWith, dispatchScaleUpWith: dispatchScaleUpWith, dispatchScaleDownWith: dispatchScaleDownWith, dispatchSpaceSetViewSize: dispatchSpaceSetViewSize, dispatchSpaceSetView: dispatchSpaceSetView} = properties;
4992
4992
  const viewElement = useRef(null);
4993
4993
  const [pluridPubSub, setPluridPubSub] = useState(pubsub ? [ pubsub ] : []);
4994
4994
  const shortcutsCallback = useCallback((event => {
@@ -5010,7 +5010,7 @@ const PluridView = properties => {
5010
5010
  planes: planes,
5011
5011
  configuration: configuration,
5012
5012
  view: view
5013
- });
5013
+ }, hostname);
5014
5014
  const computedTree = spaceTree.compute();
5015
5015
  for (const statePlane of stateTree) {
5016
5016
  for (const [index, computedPlane] of computedTree.entries()) {
@@ -5413,6 +5413,9 @@ const PluridView = properties => {
5413
5413
  handlePubSubPublish(pubsub);
5414
5414
  }
5415
5415
  }), [ pluridPubSub.length, stateConfiguration, stateTransform ]);
5416
+ useEffect((() => {
5417
+ treeUpdateCallback();
5418
+ }), []);
5416
5419
  const pluridContext = {
5417
5420
  planesRegistrar: planesRegistrar,
5418
5421
  planeContext: planeContext,
@@ -5500,12 +5503,12 @@ class PluridApplication extends Component {
5500
5503
  }, React.createElement(ConnectedView, Object.assign({}, this.props)));
5501
5504
  }
5502
5505
  computeStore() {
5503
- const {view: view, planes: planes, configuration: configuration, precomputedState: precomputedState, planesRegistrar: planesRegistrar, id: id, useLocalStorage: useLocalStorage} = this.props;
5506
+ const {view: view, planes: planes, configuration: configuration, precomputedState: precomputedState, planesRegistrar: planesRegistrar, id: id, useLocalStorage: useLocalStorage, hostname: hostname} = this.props;
5504
5507
  registerPlanes(planes, planesRegistrar);
5505
5508
  const currentState = this.store ? this.store.getState() : undefined;
5506
5509
  const localState = state.local.load(this.storeID, useLocalStorage);
5507
5510
  const contextState = id && this.context && this.context.states[id] ? this.context.states[id] : undefined;
5508
- const store = state.compute(view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState);
5511
+ const store = state.compute(view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname);
5509
5512
  return store;
5510
5513
  }
5511
5514
  subscribeStore() {
@@ -5746,13 +5749,13 @@ const gatherPluridPlanes = (routes, planes) => {
5746
5749
  return pluridPlanes;
5747
5750
  };
5748
5751
 
5749
- const renderMultispace = matchedRoute => {
5752
+ const renderMultispace = (matchedRoute, hostname = "origin") => {
5750
5753
  var _a, _b, _c, _d, _e, _f;
5751
5754
  if (matchedRoute.kind !== "Route") {
5752
5755
  return () => () => React.createElement(React.Fragment, null);
5753
5756
  }
5754
5757
  const protocol = "http";
5755
- const host = "localhost:63000";
5758
+ const host = hostname;
5756
5759
  const {match: match, data: path} = matchedRoute;
5757
5760
  const {parameters: parameters, query: query} = match;
5758
5761
  const pluridRouteProperty = {
@@ -5849,7 +5852,8 @@ const renderMultispace = matchedRoute => {
5849
5852
  planes: planes,
5850
5853
  view: view,
5851
5854
  configuration: space.configuration,
5852
- planesRegistrar: pluridPlanesRegistrar
5855
+ planesRegistrar: pluridPlanesRegistrar,
5856
+ hostname: hostname
5853
5857
  });
5854
5858
  spacesArray.push(App);
5855
5859
  }
@@ -5885,7 +5889,8 @@ const renderMultispace = matchedRoute => {
5885
5889
  id: path.value,
5886
5890
  planes: pluridPlanes,
5887
5891
  view: view,
5888
- configuration: path.defaultConfiguration
5892
+ configuration: path.defaultConfiguration,
5893
+ hostname: hostname
5889
5894
  });
5890
5895
  spacesArray.push(App);
5891
5896
  }
@@ -5915,19 +5920,19 @@ const renderMultispace = matchedRoute => {
5915
5920
  };
5916
5921
  };
5917
5922
 
5918
- const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPlane) => {
5923
+ const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPlane, hostname = "origin") => {
5919
5924
  if (directPlane || (matchedRoute === null || matchedRoute === void 0 ? void 0 : matchedRoute.kind) === "RoutePlane") {
5920
5925
  const match = directPlane || matchedRoute;
5921
5926
  if (!match) {
5922
5927
  return () => () => React.createElement(React.Fragment, null);
5923
5928
  }
5924
- const DirectPlane = renderDirectPlane(match, planesRegistrar);
5929
+ const DirectPlane = renderDirectPlane(match, planesRegistrar, hostname);
5925
5930
  return DirectPlane;
5926
5931
  }
5927
5932
  if (!matchedRoute) {
5928
5933
  const notFoundRoute = isoMatcher.match("/not-found", "route");
5929
5934
  if (notFoundRoute && notFoundRoute.kind === "Route") {
5930
- const notFoundRender = computePluridRoute(notFoundRoute, planesRegistrar, isoMatcher);
5935
+ const notFoundRender = computePluridRoute(notFoundRoute, planesRegistrar, isoMatcher, undefined, hostname);
5931
5936
  return notFoundRender;
5932
5937
  }
5933
5938
  return () => () => React.createElement(React.Fragment, null);
@@ -5964,7 +5969,8 @@ const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPla
5964
5969
  planesRegistrar: planesRegistrar,
5965
5970
  configuration: defaultConfiguration,
5966
5971
  pubsub: pubsub,
5967
- matchedRoute: matchedRoute
5972
+ matchedRoute: matchedRoute,
5973
+ hostname: hostname
5968
5974
  });
5969
5975
  const PluridRoute = () => React.createElement(React.Fragment, null, PluridRouteExterior && React.createElement(PluridRouteExterior, {
5970
5976
  plurid: pluridRouteProperty,
@@ -6024,7 +6030,7 @@ const getDirectPlaneMatch = (matchedPath, routes, planes) => {
6024
6030
  };
6025
6031
  };
6026
6032
 
6027
- const renderDirectPlane = (routePlane, planesRegistrar) => {
6033
+ const renderDirectPlane = (routePlane, planesRegistrar, hostname = "origin") => {
6028
6034
  if (routePlane.match.query.flat) {
6029
6035
  const flat = routePlane.match.query.flat.toLowerCase();
6030
6036
  const renderFlat = flat === "true" || flat === "1";
@@ -6048,7 +6054,8 @@ const renderDirectPlane = (routePlane, planesRegistrar) => {
6048
6054
  const PluridRoute = () => React.createElement(React.Fragment, null, React.createElement(PluridApplication, {
6049
6055
  view: [ routePlane.match.value ],
6050
6056
  planesRegistrar: planesRegistrar,
6051
- configuration: defaultConfiguration
6057
+ configuration: defaultConfiguration,
6058
+ hostname: hostname
6052
6059
  }));
6053
6060
  return PluridRoute;
6054
6061
  };
@@ -6060,18 +6067,18 @@ const {Registrar: PluridPlanesRegistrar} = planes;
6060
6067
  const {IsoMatcher: PluridIsoMatcher$1} = routing;
6061
6068
 
6062
6069
  const PluridRouterBrowser = properties => {
6063
- const {routes: routes, planes: planes, exterior: exterior, shell: shell, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
6070
+ const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
6064
6071
  const notFoundPath = notFoundPathProperty || "/not-found";
6065
6072
  const pluridPlanes = gatherPluridPlanes(routes, planes);
6066
6073
  const pluridPlanesRegistrar = useRef(new PluridPlanesRegistrar(pluridPlanes));
6067
6074
  const pluridIsoMatcher = useRef(new PluridIsoMatcher$1({
6068
6075
  routes: routes,
6069
6076
  routePlanes: planes
6070
- }));
6077
+ }, hostname));
6071
6078
  const mounted = useMounted();
6072
6079
  const [matchedPath, setMatchedPath] = useState(computeInitialMatchedPath(staticContext));
6073
6080
  const [matchedRoute, setMatchedRoute] = useState(pluridIsoMatcher.current.match(matchedPath, "route"));
6074
- const [PluridRoute, setPluridRoute] = useState(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, staticContext && staticContext.directPlane ? pluridIsoMatcher.current.match(staticContext.directPlane, "route") : undefined));
6081
+ const [PluridRoute, setPluridRoute] = useState(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, staticContext && staticContext.directPlane ? pluridIsoMatcher.current.match(staticContext.directPlane, "route") : undefined, hostname));
6075
6082
  const handleLocation = event => {
6076
6083
  let matchedPath;
6077
6084
  if (event && event.detail && event.detail.path && !matchedPath) {
@@ -6105,7 +6112,7 @@ const PluridRouterBrowser = properties => {
6105
6112
  }
6106
6113
  let matchedRoute = pluridIsoMatcher.current.match(matchedPath, "route");
6107
6114
  if (matchedRoute && matchedRoute.kind === "RoutePlane") {
6108
- const DirectPlane = renderDirectPlane(matchedRoute, pluridPlanesRegistrar.current);
6115
+ const DirectPlane = renderDirectPlane(matchedRoute, pluridPlanesRegistrar.current, hostname);
6109
6116
  setMatchedRoute(matchedRoute);
6110
6117
  setPluridRoute(DirectPlane);
6111
6118
  return;
@@ -6114,7 +6121,7 @@ const PluridRouterBrowser = properties => {
6114
6121
  matchedRoute = pluridIsoMatcher.current.match(notFoundPath, "route");
6115
6122
  }
6116
6123
  setMatchedRoute(matchedRoute);
6117
- setPluridRoute(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current));
6124
+ setPluridRoute(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, undefined, hostname));
6118
6125
  }), [ mounted, matchedPath ]);
6119
6126
  useEffect((() => {
6120
6127
  if (!matchedRoute) {
@@ -6154,9 +6161,9 @@ const PluridRouterBrowser = properties => {
6154
6161
  };
6155
6162
 
6156
6163
  const PluridRouterStatic = properties => {
6157
- const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, host: hostProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty} = properties;
6164
+ const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, hostname: hostnameProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty} = properties;
6158
6165
  const protocol = protocolProperty || "http";
6159
- const host = hostProperty || "localhost:63000";
6166
+ const hostname = hostnameProperty || "localhost:63000";
6160
6167
  return React.createElement(PluridRouterBrowser, {
6161
6168
  routes: routes,
6162
6169
  planes: planes,
@@ -6167,7 +6174,7 @@ const PluridRouterStatic = properties => {
6167
6174
  directPlane: directPlane
6168
6175
  },
6169
6176
  protocol: protocol,
6170
- host: host
6177
+ hostname: hostname
6171
6178
  });
6172
6179
  };
6173
6180
 
@@ -6317,7 +6324,7 @@ const PluridLink = properties => {
6317
6324
  const [showLink, setShowLink] = useState(false);
6318
6325
  const [planeID, setPlaneID] = useState("");
6319
6326
  const [pluridPlaneID, setPluridPlaneID] = useState("");
6320
- const [parentPlaneID, setParentPlaneID] = useState("");
6327
+ const [parentPlaneID, setParentPlaneID] = useState(getPluridPlaneIDByData$1(linkElement.current));
6321
6328
  const [linkCoordinates, setLinkCoordinates] = useState(defaultLinkCoordinates);
6322
6329
  const getPluridLinkCoordinates = () => {
6323
6330
  const link = linkElement.current;