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

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.
Files changed (95) hide show
  1. package/distribution/components/links/Link/components/Preview/index.d.ts +1 -1
  2. package/distribution/components/links/Link/index.d.ts +1 -3
  3. package/distribution/components/planes/ExternalPlane/index.d.ts +1 -1
  4. package/distribution/components/planes/IframePlane/index.d.ts +1 -1
  5. package/distribution/components/structural/Plane/components/PlaneBridge/index.d.ts +1 -1
  6. package/distribution/components/structural/Plane/components/PlaneControls/components/SearchItem/index.d.ts +1 -1
  7. package/distribution/components/structural/Plane/components/PlaneControls/components/SearchList/index.d.ts +1 -1
  8. package/distribution/components/structural/Plane/components/PlaneControls/index.d.ts +1 -1
  9. package/distribution/components/structural/Plane/components/PlaneDebugger/index.d.ts +1 -1
  10. package/distribution/components/structural/Plane/index.d.ts +1 -3
  11. package/distribution/components/structural/Root/index.d.ts +1 -1
  12. package/distribution/components/structural/Roots/index.d.ts +1 -1
  13. package/distribution/components/structural/Space/components/SpaceDebugger/index.d.ts +1 -1
  14. package/distribution/components/structural/Space/index.d.ts +1 -1
  15. package/distribution/components/utilities/ApplicationConfigurator/index.d.ts +1 -3
  16. package/distribution/components/utilities/NotFound/index.d.ts +1 -1
  17. package/distribution/components/utilities/Origin/index.d.ts +1 -1
  18. package/distribution/components/utilities/PlaneConfigurator/index.d.ts +1 -3
  19. package/distribution/components/utilities/Toolbar/General/components/Drawer/index.d.ts +1 -1
  20. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Global/index.d.ts +1 -1
  21. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Shortcuts/index.d.ts +1 -1
  22. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Space/index.d.ts +1 -1
  23. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Technical/index.d.ts +1 -1
  24. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Toolbar/index.d.ts +1 -1
  25. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Transform/index.d.ts +1 -1
  26. package/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Viewcube/index.d.ts +1 -1
  27. package/distribution/components/utilities/Toolbar/General/components/MenuMore/index.d.ts +1 -1
  28. package/distribution/components/utilities/Toolbar/General/components/MenuUniverses/index.d.ts +1 -1
  29. package/distribution/components/utilities/Toolbar/General/components/ToolbarRotate/index.d.ts +1 -1
  30. package/distribution/components/utilities/Toolbar/General/components/ToolbarScale/index.d.ts +1 -1
  31. package/distribution/components/utilities/Toolbar/General/components/ToolbarTranslate/index.d.ts +1 -1
  32. package/distribution/components/utilities/Toolbar/General/components/TransformArrow/index.d.ts +1 -1
  33. package/distribution/components/utilities/Toolbar/General/index.d.ts +1 -1
  34. package/distribution/components/utilities/UniverseExplorer/index.d.ts +1 -1
  35. package/distribution/components/utilities/Viewcube/components/ViewcubeFace/index.d.ts +1 -1
  36. package/distribution/components/utilities/Viewcube/components/ViewcubeModel/index.d.ts +1 -1
  37. package/distribution/components/utilities/Viewcube/index.d.ts +1 -1
  38. package/distribution/components/virtuals/List/index.d.ts +1 -1
  39. package/distribution/containers/Application/View/PlanesView/index.d.ts +1 -1
  40. package/distribution/containers/Application/View/index.d.ts +3 -2
  41. package/distribution/data/interfaces/index.d.ts +1 -1
  42. package/distribution/distribution/components/links/Link/components/Preview/index.d.ts +1 -1
  43. package/distribution/distribution/components/links/Link/index.d.ts +1 -3
  44. package/distribution/distribution/components/planes/ExternalPlane/index.d.ts +1 -1
  45. package/distribution/distribution/components/planes/IframePlane/index.d.ts +1 -1
  46. package/distribution/distribution/components/structural/Plane/components/PlaneBridge/index.d.ts +1 -1
  47. package/distribution/distribution/components/structural/Plane/components/PlaneControls/components/SearchItem/index.d.ts +1 -1
  48. package/distribution/distribution/components/structural/Plane/components/PlaneControls/components/SearchList/index.d.ts +1 -1
  49. package/distribution/distribution/components/structural/Plane/components/PlaneControls/index.d.ts +1 -1
  50. package/distribution/distribution/components/structural/Plane/components/PlaneDebugger/index.d.ts +1 -1
  51. package/distribution/distribution/components/structural/Plane/index.d.ts +1 -3
  52. package/distribution/distribution/components/structural/Root/index.d.ts +1 -1
  53. package/distribution/distribution/components/structural/Roots/index.d.ts +1 -1
  54. package/distribution/distribution/components/structural/Space/components/SpaceDebugger/index.d.ts +1 -1
  55. package/distribution/distribution/components/structural/Space/index.d.ts +1 -1
  56. package/distribution/distribution/components/utilities/ApplicationConfigurator/index.d.ts +1 -3
  57. package/distribution/distribution/components/utilities/NotFound/index.d.ts +1 -1
  58. package/distribution/distribution/components/utilities/Origin/index.d.ts +1 -1
  59. package/distribution/distribution/components/utilities/PlaneConfigurator/index.d.ts +1 -3
  60. package/distribution/distribution/components/utilities/Toolbar/General/components/Drawer/index.d.ts +1 -1
  61. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Global/index.d.ts +1 -1
  62. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Shortcuts/index.d.ts +1 -1
  63. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Space/index.d.ts +1 -1
  64. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Technical/index.d.ts +1 -1
  65. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Toolbar/index.d.ts +1 -1
  66. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Transform/index.d.ts +1 -1
  67. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/components/Viewcube/index.d.ts +1 -1
  68. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuMore/index.d.ts +1 -1
  69. package/distribution/distribution/components/utilities/Toolbar/General/components/MenuUniverses/index.d.ts +1 -1
  70. package/distribution/distribution/components/utilities/Toolbar/General/components/ToolbarRotate/index.d.ts +1 -1
  71. package/distribution/distribution/components/utilities/Toolbar/General/components/ToolbarScale/index.d.ts +1 -1
  72. package/distribution/distribution/components/utilities/Toolbar/General/components/ToolbarTranslate/index.d.ts +1 -1
  73. package/distribution/distribution/components/utilities/Toolbar/General/components/TransformArrow/index.d.ts +1 -1
  74. package/distribution/distribution/components/utilities/Toolbar/General/index.d.ts +1 -1
  75. package/distribution/distribution/components/utilities/UniverseExplorer/index.d.ts +1 -1
  76. package/distribution/distribution/components/utilities/Viewcube/components/ViewcubeFace/index.d.ts +1 -1
  77. package/distribution/distribution/components/utilities/Viewcube/components/ViewcubeModel/index.d.ts +1 -1
  78. package/distribution/distribution/components/utilities/Viewcube/index.d.ts +1 -1
  79. package/distribution/distribution/components/virtuals/List/index.d.ts +1 -1
  80. package/distribution/distribution/containers/Application/View/PlanesView/index.d.ts +1 -1
  81. package/distribution/distribution/containers/Application/View/index.d.ts +3 -2
  82. package/distribution/distribution/data/interfaces/index.d.ts +1 -1
  83. package/distribution/distribution/index.d.ts +15 -21
  84. package/distribution/distribution/services/logic/router/index.d.ts +3 -3
  85. package/distribution/distribution/services/logic/server/index.d.ts +1 -1
  86. package/distribution/index.d.ts +15 -21
  87. package/distribution/index.es.js +53 -25
  88. package/distribution/index.es.js.map +1 -1
  89. package/distribution/index.js +53 -25
  90. package/distribution/index.js.map +1 -1
  91. package/distribution/index.min.js +25 -25
  92. package/distribution/index.min.js.map +1 -1
  93. package/distribution/services/logic/router/index.d.ts +3 -3
  94. package/distribution/services/logic/server/index.d.ts +1 -1
  95. package/package.json +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, 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, 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 => {
@@ -5004,15 +5004,27 @@ const PluridView = properties => {
5004
5004
  };
5005
5005
  handleGlobalWheel(dispatch, event, transformModes, transformLocks);
5006
5006
  }), [ dispatch, stateConfiguration.space.transformMode, stateConfiguration.space.transformLocks ]);
5007
- const treeUpdateCallback = useCallback((() => {
5007
+ const treeUpdate = (view, configuration = stateConfiguration) => {
5008
5008
  const planes = getRegisteredPlanes(planesRegistrar);
5009
5009
  const spaceTree = new space$1.tree.Tree({
5010
5010
  planes: planes,
5011
- configuration: stateConfiguration,
5012
- view: stateSpaceView
5011
+ configuration: configuration,
5012
+ view: view
5013
5013
  });
5014
5014
  const computedTree = spaceTree.compute();
5015
+ for (const statePlane of stateTree) {
5016
+ for (const [index, computedPlane] of computedTree.entries()) {
5017
+ if (statePlane.route === computedPlane.route) {
5018
+ if (statePlane.children) {
5019
+ computedTree[index].children = statePlane.children;
5020
+ }
5021
+ }
5022
+ }
5023
+ }
5015
5024
  dispatchSetTree(computedTree);
5025
+ };
5026
+ const treeUpdateCallback = useCallback((() => {
5027
+ treeUpdate(stateSpaceView);
5016
5028
  }), [ stateSpaceView, stateConfiguration ]);
5017
5029
  const handlePubSubSubscribe = pubsub => {
5018
5030
  const configurationIndex = pubsub.subscribe({
@@ -5110,6 +5122,7 @@ const PluridView = properties => {
5110
5122
  const {plane: plane} = data;
5111
5123
  const updatedView = [ ...stateSpaceView, plane ];
5112
5124
  dispatchSpaceSetView(updatedView);
5125
+ treeUpdate(updatedView);
5113
5126
  }
5114
5127
  });
5115
5128
  const viewSetPlanesIndex = pubsub.subscribe({
@@ -5117,6 +5130,7 @@ const PluridView = properties => {
5117
5130
  callback: data => {
5118
5131
  const {view: view} = data;
5119
5132
  dispatchSpaceSetView([ ...view ]);
5133
+ treeUpdate(view);
5120
5134
  }
5121
5135
  });
5122
5136
  const viewRemovePlaneIndex = pubsub.subscribe({
@@ -5130,6 +5144,7 @@ const PluridView = properties => {
5130
5144
  return true;
5131
5145
  }));
5132
5146
  dispatchSpaceSetView(updatedView);
5147
+ treeUpdate(updatedView);
5133
5148
  }
5134
5149
  });
5135
5150
  return () => {
@@ -5169,10 +5184,10 @@ const PluridView = properties => {
5169
5184
  };
5170
5185
  const handleSwipe = event => {
5171
5186
  const {transformMode: transformMode} = stateConfiguration.space;
5172
- const {velocity: velocity, distance: distance, direction: direction} = event;
5173
5187
  if (transformMode === TRANSFORM_MODES.ALL) {
5174
5188
  return;
5175
5189
  }
5190
+ const {velocity: velocity, distance: distance, direction: direction} = event;
5176
5191
  const rotationMode = transformMode === TRANSFORM_MODES.ROTATION;
5177
5192
  const translationMode = transformMode === TRANSFORM_MODES.TRANSLATION;
5178
5193
  const scalationMode = transformMode === TRANSFORM_MODES.SCALE;
@@ -5226,10 +5241,10 @@ const PluridView = properties => {
5226
5241
  };
5227
5242
  const handlePan = event => {
5228
5243
  const {transformMode: transformMode} = stateConfiguration.space;
5229
- const {velocity: velocity, distance: distance, direction: direction} = event;
5230
5244
  if (transformMode === TRANSFORM_MODES.ALL) {
5231
5245
  return;
5232
5246
  }
5247
+ const {velocity: velocity, distance: distance, direction: direction} = event;
5233
5248
  const rotationMode = transformMode === TRANSFORM_MODES.ROTATION;
5234
5249
  const translationMode = transformMode === TRANSFORM_MODES.TRANSLATION;
5235
5250
  const scalationMode = transformMode === TRANSFORM_MODES.SCALE;
@@ -5350,18 +5365,17 @@ const PluridView = properties => {
5350
5365
  }));
5351
5366
  handleTouch();
5352
5367
  return () => {
5368
+ if (!touch) {
5369
+ return;
5370
+ }
5353
5371
  const {transformTouch: transformTouch} = stateConfiguration.space;
5354
5372
  if (transformTouch === TRANSFORM_TOUCHES.PAN) {
5355
- if (touch) {
5356
- touch.off("pan", handlePan);
5357
- }
5373
+ touch.off("pan", handlePan);
5358
5374
  } else {
5359
- if (touch) {
5360
- touch.off("swipe", handleSwipe);
5361
- }
5375
+ touch.off("swipe", handleSwipe);
5362
5376
  }
5363
5377
  };
5364
- }), [ viewElement.current, stateConfiguration.space.transformTouch ]);
5378
+ }), [ viewElement.current, stateConfiguration.space.transformTouch, stateConfiguration.space.transformMode ]);
5365
5379
  useEffect((() => {
5366
5380
  const handleGamepadConnect = event => {
5367
5381
  const gamepad = navigator.getGamepads()[event.gamepad.index];
@@ -5423,6 +5437,7 @@ const PluridView = properties => {
5423
5437
  const mapStateToProperties$7 = state => ({
5424
5438
  stateConfiguration: selectors.configuration.getConfiguration(state),
5425
5439
  stateTransform: selectors.space.getTransform(state),
5440
+ stateTree: selectors.space.getTree(state),
5426
5441
  stateSpaceLoading: selectors.space.getLoading(state),
5427
5442
  stateSpaceView: selectors.space.getView(state)
5428
5443
  });
@@ -5623,13 +5638,23 @@ const computeIndexedPlanes = (routes, protocol, host) => {
5623
5638
  return indexedPlanes;
5624
5639
  };
5625
5640
 
5626
- const collectApplicationsFromPath = (isoMatch, protocol, host) => {
5641
+ const collectApplicationsFromPath = (isoMatch, protocol, host, globals) => __awaiter(void 0, void 0, void 0, (function*() {
5627
5642
  const path = {
5628
- planes: isoMatch.data.planes || [],
5629
- spaces: isoMatch.data.spaces || [],
5630
- view: isoMatch.data.view || [],
5631
- value: isoMatch.data.value || ""
5643
+ planes: [],
5644
+ spaces: [],
5645
+ view: [],
5646
+ value: ""
5632
5647
  };
5648
+ if (isoMatch.kind === "Route") {
5649
+ let routeData = isoMatch.data;
5650
+ if (isoMatch.data.resolver) {
5651
+ routeData = yield isoMatch.data.resolver(globals);
5652
+ }
5653
+ path.planes = routeData.planes || [];
5654
+ path.spaces = routeData.spaces || [];
5655
+ path.view = routeData.view || [];
5656
+ path.value = isoMatch.data.value || "";
5657
+ }
5633
5658
  const {planes: planes, spaces: spaces, view: view} = path;
5634
5659
  const plurids = [];
5635
5660
  if (spaces) {
@@ -5690,7 +5715,7 @@ const collectApplicationsFromPath = (isoMatch, protocol, host) => {
5690
5715
  plurids.push(pluridApplication);
5691
5716
  }
5692
5717
  return plurids;
5693
- };
5718
+ }));
5694
5719
 
5695
5720
  const gatherPluridPlanes = (routes, planes) => {
5696
5721
  const pluridPlanes = [];
@@ -5907,7 +5932,10 @@ const computePluridRoute = (matchedRoute, planesRegistrar, isoMatcher, directPla
5907
5932
  }
5908
5933
  return () => () => React.createElement(React.Fragment, null);
5909
5934
  }
5910
- const {exterior: exterior, view: view, planes: planes, spaces: spaces, defaultConfiguration: defaultConfiguration, slotted: slotted} = matchedRoute.data;
5935
+ const {exterior: exterior, view: view, planes: planes, spaces: spaces, defaultConfiguration: defaultConfiguration, slotted: slotted, resolver: resolver} = matchedRoute.data;
5936
+ if (resolver) {
5937
+ resolver(undefined);
5938
+ }
5911
5939
  const pluridRouteProperty = {
5912
5940
  value: matchedRoute.match.value,
5913
5941
  parameters: matchedRoute.match.parameters,
@@ -6368,7 +6396,7 @@ const PluridLink = properties => {
6368
6396
  if (showLink) {
6369
6397
  return;
6370
6398
  }
6371
- if (event.ctrlKey || event.metaKey) {
6399
+ if (event.altKey || event.metaKey) {
6372
6400
  return;
6373
6401
  }
6374
6402
  const {location: location} = updatedPlane;
@@ -6906,11 +6934,11 @@ const computeApplication = (indexedPlanes, planes, configuration, view) => {
6906
6934
  return data;
6907
6935
  };
6908
6936
 
6909
- const serverComputeMetastate = (isoMatch, paths) => {
6937
+ const serverComputeMetastate = (isoMatch, paths, globals) => __awaiter(void 0, void 0, void 0, (function*() {
6910
6938
  const protocol = "http";
6911
6939
  const host = "localhost:63000";
6912
6940
  const indexedPlanes = computeIndexedPlanes(paths, protocol, host);
6913
- const pluridApplications = collectApplicationsFromPath(isoMatch);
6941
+ const pluridApplications = yield collectApplicationsFromPath(isoMatch, protocol, host, globals);
6914
6942
  const states = {};
6915
6943
  for (const application of pluridApplications) {
6916
6944
  const {planes: planes, view: view} = application;
@@ -6968,13 +6996,13 @@ const serverComputeMetastate = (isoMatch, paths) => {
6968
6996
  return {
6969
6997
  states: states
6970
6998
  };
6971
- };
6999
+ }));
6972
7000
 
6973
7001
  const usePluridRouter = () => {
6974
7002
  const [routerValue, setRouterValue] = useState("");
6975
7003
  useEffect((() => {
6976
7004
  const fetchState = () => {
6977
- const state = storage.loadState("__PLURID_ROUTER__");
7005
+ const state = storage.loadState(PLURID_ROUTER_STORAGE);
6978
7006
  if (state) {
6979
7007
  setRouterValue(state);
6980
7008
  }