@plurid/plurid-react 0.0.0-24 → 0.0.0-25
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/README.md +8 -12
- package/distribution/containers/Application/View/index.d.ts +2 -2
- package/distribution/containers/RouterBrowser/styled.d.ts +1 -0
- package/distribution/index.es.js +50 -8
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +50 -8
- package/distribution/index.js.map +1 -1
- package/distribution/index.min.js +66 -63
- package/distribution/index.min.js.map +1 -1
- package/distribution/services/state/actions/index.d.ts +22 -1
- package/distribution/services/state/modules/space/index.d.ts +46 -3
- package/distribution/services/state/modules/space/selectors.d.ts +2 -9
- package/package.json +16 -16
package/distribution/index.js
CHANGED
|
@@ -416,8 +416,10 @@ const initialState$2 = {
|
|
|
416
416
|
lastClosedPlane: ""
|
|
417
417
|
};
|
|
418
418
|
|
|
419
|
+
const name = "space";
|
|
420
|
+
|
|
419
421
|
const space = toolkit.createSlice({
|
|
420
|
-
name:
|
|
422
|
+
name: name,
|
|
421
423
|
initialState: initialState$2,
|
|
422
424
|
reducers: {
|
|
423
425
|
setSpaceField: (state, action) => {
|
|
@@ -450,7 +452,11 @@ const space = toolkit.createSlice({
|
|
|
450
452
|
state.transformTime = action.payload;
|
|
451
453
|
},
|
|
452
454
|
setSpaceLocation: (state, action) => {
|
|
453
|
-
|
|
455
|
+
const newState = Object.assign(Object.assign({}, state), action.payload);
|
|
456
|
+
const transform = computeMatrix(newState);
|
|
457
|
+
return Object.assign(Object.assign({}, newState), {
|
|
458
|
+
transform: transform
|
|
459
|
+
});
|
|
454
460
|
},
|
|
455
461
|
viewCameraMoveForward: state => {
|
|
456
462
|
state.translationZ = state.translationZ + pluridData.TRANSLATION_STEP * 6 * Math.cos(toRadians(-state.rotationY));
|
|
@@ -638,6 +644,7 @@ const reducer$3 = space.reducer;
|
|
|
638
644
|
|
|
639
645
|
var space$1 = Object.freeze({
|
|
640
646
|
__proto__: null,
|
|
647
|
+
name: name,
|
|
641
648
|
space: space,
|
|
642
649
|
actions: actions$3,
|
|
643
650
|
selectors: selectors$3,
|
|
@@ -991,9 +998,16 @@ const navigateToRoot = (dispatch, state, type) => {
|
|
|
991
998
|
return;
|
|
992
999
|
}
|
|
993
1000
|
const treeIndex = type === "previous" ? rootIndex - 1 || 0 : rootIndex + 1;
|
|
994
|
-
|
|
1001
|
+
let root = tree[treeIndex];
|
|
995
1002
|
if (!root) {
|
|
996
|
-
|
|
1003
|
+
if (type === "previous") {
|
|
1004
|
+
root = tree[tree.length - 1];
|
|
1005
|
+
} else {
|
|
1006
|
+
root = tree[0];
|
|
1007
|
+
}
|
|
1008
|
+
if (!root) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
997
1011
|
}
|
|
998
1012
|
navigateToPluridPlane(dispatch, root, undefined, true);
|
|
999
1013
|
};
|
|
@@ -1209,6 +1223,15 @@ const handleGlobalShortcuts = (dispatch, state, pubsub, event, firstPerson, lock
|
|
|
1209
1223
|
focusNextRoot(dispatch, state);
|
|
1210
1224
|
return;
|
|
1211
1225
|
}
|
|
1226
|
+
if (event.altKey && event.code === "Tab") {
|
|
1227
|
+
event.preventDefault();
|
|
1228
|
+
if (event.shiftKey) {
|
|
1229
|
+
focusPreviousRoot(dispatch, state);
|
|
1230
|
+
} else {
|
|
1231
|
+
focusNextRoot(dispatch, state);
|
|
1232
|
+
}
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1212
1235
|
if (event.altKey && event.code.startsWith("Digit")) {
|
|
1213
1236
|
const index = parseInt(event.code.replace("Digit", "")) - 1;
|
|
1214
1237
|
focusRootIndex(dispatch, state, index);
|
|
@@ -4346,7 +4369,7 @@ const PluridView = properties => {
|
|
|
4346
4369
|
};
|
|
4347
4370
|
const treeUpdateCallback = React.useCallback((() => {
|
|
4348
4371
|
treeUpdate(stateSpaceView);
|
|
4349
|
-
}), [ hostname, stateSpaceView, stateConfiguration ]);
|
|
4372
|
+
}), [ hostname, stateSpaceView, stateConfiguration, JSON.stringify(stateTree) ]);
|
|
4350
4373
|
const handlePubSubSubscribe = pubsub => {
|
|
4351
4374
|
const subscriptions = [ {
|
|
4352
4375
|
topic: pluridData.PLURID_PUBSUB_TOPIC.CONFIGURATION,
|
|
@@ -4756,7 +4779,7 @@ const PluridView = properties => {
|
|
|
4756
4779
|
return () => {
|
|
4757
4780
|
window.removeEventListener("resize", treeUpdateCallback);
|
|
4758
4781
|
};
|
|
4759
|
-
}), [ stateSpaceView, stateConfiguration ]);
|
|
4782
|
+
}), [ stateSpaceView, stateConfiguration, JSON.stringify(stateTree) ]);
|
|
4760
4783
|
React.useEffect((() => {
|
|
4761
4784
|
if (typeof window === "undefined") {
|
|
4762
4785
|
return;
|
|
@@ -5397,10 +5420,16 @@ const renderDirectPlane = (routePlane, planesRegistrar, hostname = "origin") =>
|
|
|
5397
5420
|
return DirectPlane;
|
|
5398
5421
|
};
|
|
5399
5422
|
|
|
5423
|
+
const PluridScrollTop = styled__default["default"].div`
|
|
5424
|
+
height: 0;
|
|
5425
|
+
width: 0;
|
|
5426
|
+
`;
|
|
5427
|
+
|
|
5400
5428
|
const PluridRouterBrowser = properties => {
|
|
5401
|
-
const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
|
|
5429
|
+
const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, scrollToTop: scrollToTop, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
|
|
5402
5430
|
const notFoundPath = notFoundPathProperty || "/not-found";
|
|
5403
5431
|
const pluridPlanes = gatherPluridPlanes(routes, planes);
|
|
5432
|
+
const topContainer = React.useRef(null);
|
|
5404
5433
|
const pluridPlanesRegistrar = React.useRef(new PluridPlanesRegistrar(pluridPlanes, hostname));
|
|
5405
5434
|
const pluridIsoMatcher = React.useRef(new PluridIsoMatcher$1({
|
|
5406
5435
|
routes: routes,
|
|
@@ -5410,6 +5439,15 @@ const PluridRouterBrowser = properties => {
|
|
|
5410
5439
|
const [matchedPath, setMatchedPath] = React.useState(computeInitialMatchedPath(staticContext));
|
|
5411
5440
|
const [matchedRoute, setMatchedRoute] = React.useState(pluridIsoMatcher.current.match(matchedPath, "route"));
|
|
5412
5441
|
const [PluridRoute, setPluridRoute] = React.useState(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, staticContext && staticContext.directPlane ? pluridIsoMatcher.current.match(staticContext.directPlane, "route") : undefined, hostname));
|
|
5442
|
+
const scrollTop = () => {
|
|
5443
|
+
if (!topContainer.current || scrollToTop === false) {
|
|
5444
|
+
return;
|
|
5445
|
+
}
|
|
5446
|
+
const behavior = typeof scrollToTop === "undefined" || scrollToTop === true || scrollToTop === "smooth" ? "smooth" : "auto";
|
|
5447
|
+
topContainer.current.scrollIntoView({
|
|
5448
|
+
behavior: behavior
|
|
5449
|
+
});
|
|
5450
|
+
};
|
|
5413
5451
|
const handleLocation = event => {
|
|
5414
5452
|
let matchedPath;
|
|
5415
5453
|
if (event && event.detail && event.detail.path && !matchedPath) {
|
|
@@ -5423,6 +5461,7 @@ const PluridRouterBrowser = properties => {
|
|
|
5423
5461
|
matchedPath = pathname + window.location.search;
|
|
5424
5462
|
}
|
|
5425
5463
|
setMatchedPath(matchedPath);
|
|
5464
|
+
scrollTop();
|
|
5426
5465
|
};
|
|
5427
5466
|
React.useEffect((() => {
|
|
5428
5467
|
window.addEventListener("popstate", handleLocation);
|
|
@@ -5484,7 +5523,9 @@ const PluridRouterBrowser = properties => {
|
|
|
5484
5523
|
PluridRouterShell.displayName = "PluridRouterShell";
|
|
5485
5524
|
}
|
|
5486
5525
|
}
|
|
5487
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5526
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(PluridScrollTop, {
|
|
5527
|
+
ref: topContainer
|
|
5528
|
+
}), PluridRouterExterior && React__default["default"].createElement(PluridRouterExterior, {
|
|
5488
5529
|
matchedRoute: matchedRoute
|
|
5489
5530
|
}), React__default["default"].createElement(PluridRouterShell, {
|
|
5490
5531
|
matchedRoute: matchedRoute
|
|
@@ -6337,6 +6378,7 @@ const serverComputeMetastate = (isoMatch, paths, globals) => __awaiter(void 0, v
|
|
|
6337
6378
|
space: {
|
|
6338
6379
|
loading: false,
|
|
6339
6380
|
animatedTransform: false,
|
|
6381
|
+
transform: "matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)",
|
|
6340
6382
|
scale: 1,
|
|
6341
6383
|
rotationX: 0,
|
|
6342
6384
|
rotationY: 0,
|