@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.
@@ -5028,7 +5028,7 @@ const handleView = view => {
5028
5028
  const {getRegisteredPlanes: getRegisteredPlanes} = pluridEngine.planes;
5029
5029
 
5030
5030
  const PluridView = properties => {
5031
- 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;
5031
+ 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;
5032
5032
  const viewElement = React.useRef(null);
5033
5033
  const [pluridPubSub, setPluridPubSub] = React.useState(pubsub ? [ pubsub ] : []);
5034
5034
  const shortcutsCallback = React.useCallback((event => {
@@ -5050,7 +5050,7 @@ const PluridView = properties => {
5050
5050
  planes: planes,
5051
5051
  configuration: configuration,
5052
5052
  view: view
5053
- });
5053
+ }, hostname);
5054
5054
  const computedTree = spaceTree.compute();
5055
5055
  for (const statePlane of stateTree) {
5056
5056
  for (const [index, computedPlane] of computedTree.entries()) {
@@ -5453,6 +5453,9 @@ const PluridView = properties => {
5453
5453
  handlePubSubPublish(pubsub);
5454
5454
  }
5455
5455
  }), [ pluridPubSub.length, stateConfiguration, stateTransform ]);
5456
+ React.useEffect((() => {
5457
+ treeUpdateCallback();
5458
+ }), []);
5456
5459
  const pluridContext = {
5457
5460
  planesRegistrar: planesRegistrar,
5458
5461
  planeContext: planeContext,
@@ -5540,12 +5543,12 @@ class PluridApplication extends React.Component {
5540
5543
  }, React__default["default"].createElement(ConnectedView, Object.assign({}, this.props)));
5541
5544
  }
5542
5545
  computeStore() {
5543
- const {view: view, planes: planes, configuration: configuration, precomputedState: precomputedState, planesRegistrar: planesRegistrar, id: id, useLocalStorage: useLocalStorage} = this.props;
5546
+ const {view: view, planes: planes, configuration: configuration, precomputedState: precomputedState, planesRegistrar: planesRegistrar, id: id, useLocalStorage: useLocalStorage, hostname: hostname} = this.props;
5544
5547
  registerPlanes(planes, planesRegistrar);
5545
5548
  const currentState = this.store ? this.store.getState() : undefined;
5546
5549
  const localState = pluridEngine.state.local.load(this.storeID, useLocalStorage);
5547
5550
  const contextState = id && this.context && this.context.states[id] ? this.context.states[id] : undefined;
5548
- const store = pluridEngine.state.compute(view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState);
5551
+ const store = pluridEngine.state.compute(view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname);
5549
5552
  return store;
5550
5553
  }
5551
5554
  subscribeStore() {
@@ -5786,13 +5789,13 @@ const gatherPluridPlanes = (routes, planes) => {
5786
5789
  return pluridPlanes;
5787
5790
  };
5788
5791
 
5789
- const renderMultispace = matchedRoute => {
5792
+ const renderMultispace = (matchedRoute, hostname = "origin") => {
5790
5793
  var _a, _b, _c, _d, _e, _f;
5791
5794
  if (matchedRoute.kind !== "Route") {
5792
5795
  return () => () => React__default["default"].createElement(React__default["default"].Fragment, null);
5793
5796
  }
5794
5797
  const protocol = "http";
5795
- const host = "localhost:63000";
5798
+ const host = hostname;
5796
5799
  const {match: match, data: path} = matchedRoute;
5797
5800
  const {parameters: parameters, query: query} = match;
5798
5801
  const pluridRouteProperty = {
@@ -5889,7 +5892,8 @@ const renderMultispace = matchedRoute => {
5889
5892
  planes: planes,
5890
5893
  view: view,
5891
5894
  configuration: space.configuration,
5892
- planesRegistrar: pluridPlanesRegistrar
5895
+ planesRegistrar: pluridPlanesRegistrar,
5896
+ hostname: hostname
5893
5897
  });
5894
5898
  spacesArray.push(App);
5895
5899
  }
@@ -5925,7 +5929,8 @@ const renderMultispace = matchedRoute => {
5925
5929
  id: path.value,
5926
5930
  planes: pluridPlanes,
5927
5931
  view: view,
5928
- configuration: path.defaultConfiguration
5932
+ configuration: path.defaultConfiguration,
5933
+ hostname: hostname
5929
5934
  });
5930
5935
  spacesArray.push(App);
5931
5936
  }
@@ -5955,19 +5960,19 @@ const renderMultispace = matchedRoute => {
5955
5960
  };
5956
5961
  };
5957
5962
 
5958
- const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPlane) => {
5963
+ const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPlane, hostname = "origin") => {
5959
5964
  if (directPlane || (matchedRoute === null || matchedRoute === void 0 ? void 0 : matchedRoute.kind) === "RoutePlane") {
5960
5965
  const match = directPlane || matchedRoute;
5961
5966
  if (!match) {
5962
5967
  return () => () => React__default["default"].createElement(React__default["default"].Fragment, null);
5963
5968
  }
5964
- const DirectPlane = renderDirectPlane(match, planesRegistrar);
5969
+ const DirectPlane = renderDirectPlane(match, planesRegistrar, hostname);
5965
5970
  return DirectPlane;
5966
5971
  }
5967
5972
  if (!matchedRoute) {
5968
5973
  const notFoundRoute = isoMatcher.match("/not-found", "route");
5969
5974
  if (notFoundRoute && notFoundRoute.kind === "Route") {
5970
- const notFoundRender = computePluridRoute(notFoundRoute, planesRegistrar, isoMatcher);
5975
+ const notFoundRender = computePluridRoute(notFoundRoute, planesRegistrar, isoMatcher, undefined, hostname);
5971
5976
  return notFoundRender;
5972
5977
  }
5973
5978
  return () => () => React__default["default"].createElement(React__default["default"].Fragment, null);
@@ -6004,7 +6009,8 @@ const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPla
6004
6009
  planesRegistrar: planesRegistrar,
6005
6010
  configuration: defaultConfiguration,
6006
6011
  pubsub: pubsub,
6007
- matchedRoute: matchedRoute
6012
+ matchedRoute: matchedRoute,
6013
+ hostname: hostname
6008
6014
  });
6009
6015
  const PluridRoute = () => React__default["default"].createElement(React__default["default"].Fragment, null, PluridRouteExterior && React__default["default"].createElement(PluridRouteExterior, {
6010
6016
  plurid: pluridRouteProperty,
@@ -6064,7 +6070,7 @@ const getDirectPlaneMatch = (matchedPath, routes, planes) => {
6064
6070
  };
6065
6071
  };
6066
6072
 
6067
- const renderDirectPlane = (routePlane, planesRegistrar) => {
6073
+ const renderDirectPlane = (routePlane, planesRegistrar, hostname = "origin") => {
6068
6074
  if (routePlane.match.query.flat) {
6069
6075
  const flat = routePlane.match.query.flat.toLowerCase();
6070
6076
  const renderFlat = flat === "true" || flat === "1";
@@ -6088,7 +6094,8 @@ const renderDirectPlane = (routePlane, planesRegistrar) => {
6088
6094
  const PluridRoute = () => React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(PluridApplication, {
6089
6095
  view: [ routePlane.match.value ],
6090
6096
  planesRegistrar: planesRegistrar,
6091
- configuration: defaultConfiguration
6097
+ configuration: defaultConfiguration,
6098
+ hostname: hostname
6092
6099
  }));
6093
6100
  return PluridRoute;
6094
6101
  };
@@ -6100,18 +6107,18 @@ const {Registrar: PluridPlanesRegistrar} = pluridEngine.planes;
6100
6107
  const {IsoMatcher: PluridIsoMatcher$1} = pluridEngine.routing;
6101
6108
 
6102
6109
  const PluridRouterBrowser = properties => {
6103
- const {routes: routes, planes: planes, exterior: exterior, shell: shell, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
6110
+ const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
6104
6111
  const notFoundPath = notFoundPathProperty || "/not-found";
6105
6112
  const pluridPlanes = gatherPluridPlanes(routes, planes);
6106
6113
  const pluridPlanesRegistrar = React.useRef(new PluridPlanesRegistrar(pluridPlanes));
6107
6114
  const pluridIsoMatcher = React.useRef(new PluridIsoMatcher$1({
6108
6115
  routes: routes,
6109
6116
  routePlanes: planes
6110
- }));
6117
+ }, hostname));
6111
6118
  const mounted = pluridFunctionsReact.useMounted();
6112
6119
  const [matchedPath, setMatchedPath] = React.useState(computeInitialMatchedPath(staticContext));
6113
6120
  const [matchedRoute, setMatchedRoute] = React.useState(pluridIsoMatcher.current.match(matchedPath, "route"));
6114
- const [PluridRoute, setPluridRoute] = React.useState(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, staticContext && staticContext.directPlane ? pluridIsoMatcher.current.match(staticContext.directPlane, "route") : undefined));
6121
+ const [PluridRoute, setPluridRoute] = React.useState(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, staticContext && staticContext.directPlane ? pluridIsoMatcher.current.match(staticContext.directPlane, "route") : undefined, hostname));
6115
6122
  const handleLocation = event => {
6116
6123
  let matchedPath;
6117
6124
  if (event && event.detail && event.detail.path && !matchedPath) {
@@ -6145,7 +6152,7 @@ const PluridRouterBrowser = properties => {
6145
6152
  }
6146
6153
  let matchedRoute = pluridIsoMatcher.current.match(matchedPath, "route");
6147
6154
  if (matchedRoute && matchedRoute.kind === "RoutePlane") {
6148
- const DirectPlane = renderDirectPlane(matchedRoute, pluridPlanesRegistrar.current);
6155
+ const DirectPlane = renderDirectPlane(matchedRoute, pluridPlanesRegistrar.current, hostname);
6149
6156
  setMatchedRoute(matchedRoute);
6150
6157
  setPluridRoute(DirectPlane);
6151
6158
  return;
@@ -6154,7 +6161,7 @@ const PluridRouterBrowser = properties => {
6154
6161
  matchedRoute = pluridIsoMatcher.current.match(notFoundPath, "route");
6155
6162
  }
6156
6163
  setMatchedRoute(matchedRoute);
6157
- setPluridRoute(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current));
6164
+ setPluridRoute(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, undefined, hostname));
6158
6165
  }), [ mounted, matchedPath ]);
6159
6166
  React.useEffect((() => {
6160
6167
  if (!matchedRoute) {
@@ -6194,9 +6201,9 @@ const PluridRouterBrowser = properties => {
6194
6201
  };
6195
6202
 
6196
6203
  const PluridRouterStatic = properties => {
6197
- const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, host: hostProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty} = properties;
6204
+ const {path: path, directPlane: directPlane, routes: routes, planes: planes, exterior: exterior, shell: shell, protocol: protocolProperty, hostname: hostnameProperty, gateway: gateway, gatewayQuery: gatewayQueryProperty, gatewayEndpoint: gatewayEndpointProperty} = properties;
6198
6205
  const protocol = protocolProperty || "http";
6199
- const host = hostProperty || "localhost:63000";
6206
+ const hostname = hostnameProperty || "localhost:63000";
6200
6207
  return React__default["default"].createElement(PluridRouterBrowser, {
6201
6208
  routes: routes,
6202
6209
  planes: planes,
@@ -6207,7 +6214,7 @@ const PluridRouterStatic = properties => {
6207
6214
  directPlane: directPlane
6208
6215
  },
6209
6216
  protocol: protocol,
6210
- host: host
6217
+ hostname: hostname
6211
6218
  });
6212
6219
  };
6213
6220
 
@@ -6357,7 +6364,7 @@ const PluridLink = properties => {
6357
6364
  const [showLink, setShowLink] = React.useState(false);
6358
6365
  const [planeID, setPlaneID] = React.useState("");
6359
6366
  const [pluridPlaneID, setPluridPlaneID] = React.useState("");
6360
- const [parentPlaneID, setParentPlaneID] = React.useState("");
6367
+ const [parentPlaneID, setParentPlaneID] = React.useState(getPluridPlaneIDByData$1(linkElement.current));
6361
6368
  const [linkCoordinates, setLinkCoordinates] = React.useState(defaultLinkCoordinates);
6362
6369
  const getPluridLinkCoordinates = () => {
6363
6370
  const link = linkElement.current;