@plurid/plurid-react 0.0.0-24 → 0.0.0-27
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 +88 -8
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +88 -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/logic/transform/index.d.ts +2 -2
- package/distribution/services/state/actions/index.d.ts +71 -50
- package/distribution/services/state/modules/space/index.d.ts +142 -121
- package/distribution/services/state/modules/space/selectors.d.ts +4 -11
- package/distribution/services/state/modules/space/types.d.ts +2 -3
- package/distribution/services/state/selectors/index.d.ts +6 -6
- package/distribution/services/state/store/index.d.ts +2 -2
- package/distribution/services/state/store/reducer/index.d.ts +1 -1
- package/package.json +20 -20
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
|
};
|
|
@@ -1089,127 +1103,174 @@ const handleGlobalShortcuts = (dispatch, state, pubsub, event, firstPerson, lock
|
|
|
1089
1103
|
return;
|
|
1090
1104
|
}
|
|
1091
1105
|
const noModifiers = !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
1106
|
+
const handleEvent = () => {
|
|
1107
|
+
event.preventDefault();
|
|
1108
|
+
};
|
|
1092
1109
|
if (event.code === "KeyF" && noModifiers) {
|
|
1110
|
+
handleEvent();
|
|
1093
1111
|
return dispatch(actions.configuration.toggleConfigurationSpaceFirstPerson());
|
|
1094
1112
|
}
|
|
1095
1113
|
if (firstPerson) {
|
|
1096
1114
|
if (event.code === "KeyW" && noModifiers && locks.translationZ) {
|
|
1115
|
+
handleEvent();
|
|
1097
1116
|
return dispatch(actions.space.viewCameraMoveForward());
|
|
1098
1117
|
}
|
|
1099
1118
|
if (event.code === "KeyS" && noModifiers && locks.translationZ) {
|
|
1119
|
+
handleEvent();
|
|
1100
1120
|
return dispatch(actions.space.viewCameraMoveBackward());
|
|
1101
1121
|
}
|
|
1102
1122
|
if (event.code === "KeyA" && noModifiers && locks.translationX) {
|
|
1123
|
+
handleEvent();
|
|
1103
1124
|
return dispatch(actions.space.viewCameraMoveLeft());
|
|
1104
1125
|
}
|
|
1105
1126
|
if (event.code === "KeyA" && event.shiftKey && locks.rotationY) {
|
|
1127
|
+
handleEvent();
|
|
1106
1128
|
return dispatch(actions.space.viewCameraTurnLeft());
|
|
1107
1129
|
}
|
|
1108
1130
|
if (event.code === "KeyD" && noModifiers && locks.translationX) {
|
|
1131
|
+
handleEvent();
|
|
1109
1132
|
return dispatch(actions.space.viewCameraMoveRight());
|
|
1110
1133
|
}
|
|
1111
1134
|
if (event.code === "KeyD" && event.shiftKey && locks.rotationY) {
|
|
1135
|
+
handleEvent();
|
|
1112
1136
|
return dispatch(actions.space.viewCameraTurnRight());
|
|
1113
1137
|
}
|
|
1114
1138
|
if (event.code === "KeyQ" && noModifiers && locks.rotationX) {
|
|
1139
|
+
handleEvent();
|
|
1115
1140
|
return dispatch(actions.space.viewCameraTurnUp());
|
|
1116
1141
|
}
|
|
1117
1142
|
if (event.code === "KeyZ" && noModifiers && locks.rotationX) {
|
|
1143
|
+
handleEvent();
|
|
1118
1144
|
return dispatch(actions.space.viewCameraTurnDown());
|
|
1119
1145
|
}
|
|
1120
1146
|
if (event.code === "KeyE" && noModifiers && locks.translationY) {
|
|
1147
|
+
handleEvent();
|
|
1121
1148
|
return dispatch(actions.space.viewCameraMoveUp());
|
|
1122
1149
|
}
|
|
1123
1150
|
if (event.code === "KeyC" && noModifiers && locks.translationY) {
|
|
1151
|
+
handleEvent();
|
|
1124
1152
|
return dispatch(actions.space.viewCameraMoveDown());
|
|
1125
1153
|
}
|
|
1126
1154
|
}
|
|
1127
1155
|
if (event.code === "KeyR" && noModifiers) {
|
|
1156
|
+
handleEvent();
|
|
1128
1157
|
return dispatch(actions.configuration.setConfigurationSpaceTransformMode(pluridData.TRANSFORM_MODES.ROTATION));
|
|
1129
1158
|
}
|
|
1130
1159
|
if (event.code === "KeyT" && noModifiers) {
|
|
1160
|
+
handleEvent();
|
|
1131
1161
|
return dispatch(actions.configuration.setConfigurationSpaceTransformMode(pluridData.TRANSFORM_MODES.TRANSLATION));
|
|
1132
1162
|
}
|
|
1133
1163
|
if (event.code === "KeyS" && noModifiers && !firstPerson) {
|
|
1164
|
+
handleEvent();
|
|
1134
1165
|
return dispatch(actions.configuration.setConfigurationSpaceTransformMode(pluridData.TRANSFORM_MODES.SCALE));
|
|
1135
1166
|
}
|
|
1136
1167
|
if (event.key === "ArrowRight") {
|
|
1137
1168
|
if (event.shiftKey && locks.rotationY) {
|
|
1169
|
+
handleEvent();
|
|
1138
1170
|
return dispatch(actions.space.rotateLeft());
|
|
1139
1171
|
}
|
|
1140
1172
|
if (event.altKey && locks.translationX) {
|
|
1173
|
+
handleEvent();
|
|
1141
1174
|
return dispatch(actions.space.translateRight());
|
|
1142
1175
|
}
|
|
1143
1176
|
}
|
|
1144
1177
|
if (event.key === "ArrowLeft") {
|
|
1145
1178
|
if (event.shiftKey && locks.rotationY) {
|
|
1179
|
+
handleEvent();
|
|
1146
1180
|
return dispatch(actions.space.rotateRight());
|
|
1147
1181
|
}
|
|
1148
1182
|
if (event.altKey && locks.translationX) {
|
|
1183
|
+
handleEvent();
|
|
1149
1184
|
return dispatch(actions.space.translateLeft());
|
|
1150
1185
|
}
|
|
1151
1186
|
}
|
|
1152
1187
|
if (event.key === "ArrowUp") {
|
|
1153
1188
|
if (event.shiftKey && event.altKey && locks.translationZ) {
|
|
1189
|
+
handleEvent();
|
|
1154
1190
|
return dispatch(actions.space.translateIn());
|
|
1155
1191
|
}
|
|
1156
1192
|
if (event.shiftKey && !event.altKey && locks.rotationX) {
|
|
1193
|
+
handleEvent();
|
|
1157
1194
|
return dispatch(actions.space.rotateUp());
|
|
1158
1195
|
}
|
|
1159
1196
|
if (event.altKey && !event.shiftKey && locks.translationY) {
|
|
1197
|
+
handleEvent();
|
|
1160
1198
|
return dispatch(actions.space.translateUp());
|
|
1161
1199
|
}
|
|
1162
1200
|
if (event.metaKey || event.ctrlKey && locks.scale) {
|
|
1201
|
+
handleEvent();
|
|
1163
1202
|
return dispatch(actions.space.scaleUp());
|
|
1164
1203
|
}
|
|
1165
1204
|
}
|
|
1166
1205
|
if (event.key === "ArrowDown") {
|
|
1167
1206
|
if (event.shiftKey && event.altKey && locks.translationZ) {
|
|
1207
|
+
handleEvent();
|
|
1168
1208
|
return dispatch(actions.space.translateOut());
|
|
1169
1209
|
}
|
|
1170
1210
|
if (event.shiftKey && !event.altKey && locks.rotationX) {
|
|
1211
|
+
handleEvent();
|
|
1171
1212
|
return dispatch(actions.space.rotateDown());
|
|
1172
1213
|
}
|
|
1173
1214
|
if (event.altKey && !event.shiftKey && locks.translationY) {
|
|
1215
|
+
handleEvent();
|
|
1174
1216
|
return dispatch(actions.space.translateDown());
|
|
1175
1217
|
}
|
|
1176
1218
|
if (event.metaKey || event.ctrlKey && locks.scale) {
|
|
1219
|
+
handleEvent();
|
|
1177
1220
|
return dispatch(actions.space.scaleDown());
|
|
1178
1221
|
}
|
|
1179
1222
|
}
|
|
1180
1223
|
if (event.altKey && event.code === "KeyF") {
|
|
1224
|
+
handleEvent();
|
|
1181
1225
|
focusActivePlane(dispatch, state);
|
|
1182
1226
|
return;
|
|
1183
1227
|
}
|
|
1184
1228
|
if (event.altKey && event.code === "KeyB") {
|
|
1229
|
+
handleEvent();
|
|
1185
1230
|
focusParentActivePlane(dispatch, state);
|
|
1186
1231
|
return;
|
|
1187
1232
|
}
|
|
1188
1233
|
if (event.altKey && event.code === "KeyR") {
|
|
1234
|
+
handleEvent();
|
|
1189
1235
|
refreshActivePlane(state, pubsub);
|
|
1190
1236
|
return;
|
|
1191
1237
|
}
|
|
1192
1238
|
if (event.altKey && event.code === "KeyE") {
|
|
1239
|
+
handleEvent();
|
|
1193
1240
|
isolateActivePlane(state, pubsub);
|
|
1194
1241
|
return;
|
|
1195
1242
|
}
|
|
1196
1243
|
if (event.altKey && event.shiftKey && event.code === "KeyT") {
|
|
1244
|
+
handleEvent();
|
|
1197
1245
|
openClosedPlane(pubsub);
|
|
1198
1246
|
return;
|
|
1199
1247
|
}
|
|
1200
1248
|
if (event.altKey && event.code === "KeyW") {
|
|
1249
|
+
handleEvent();
|
|
1201
1250
|
closeActivePlane(state, pubsub);
|
|
1202
1251
|
return;
|
|
1203
1252
|
}
|
|
1204
1253
|
if (event.altKey && event.code === "KeyA") {
|
|
1254
|
+
handleEvent();
|
|
1205
1255
|
focusPreviousRoot(dispatch, state);
|
|
1206
1256
|
return;
|
|
1207
1257
|
}
|
|
1208
1258
|
if (event.altKey && event.code === "KeyD") {
|
|
1259
|
+
handleEvent();
|
|
1209
1260
|
focusNextRoot(dispatch, state);
|
|
1210
1261
|
return;
|
|
1211
1262
|
}
|
|
1263
|
+
if (event.altKey && event.code === "Tab") {
|
|
1264
|
+
handleEvent();
|
|
1265
|
+
if (event.shiftKey) {
|
|
1266
|
+
focusPreviousRoot(dispatch, state);
|
|
1267
|
+
} else {
|
|
1268
|
+
focusNextRoot(dispatch, state);
|
|
1269
|
+
}
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1212
1272
|
if (event.altKey && event.code.startsWith("Digit")) {
|
|
1273
|
+
handleEvent();
|
|
1213
1274
|
const index = parseInt(event.code.replace("Digit", "")) - 1;
|
|
1214
1275
|
focusRootIndex(dispatch, state, index);
|
|
1215
1276
|
return;
|
|
@@ -4346,7 +4407,7 @@ const PluridView = properties => {
|
|
|
4346
4407
|
};
|
|
4347
4408
|
const treeUpdateCallback = React.useCallback((() => {
|
|
4348
4409
|
treeUpdate(stateSpaceView);
|
|
4349
|
-
}), [ hostname, stateSpaceView, stateConfiguration ]);
|
|
4410
|
+
}), [ hostname, stateSpaceView, stateConfiguration, JSON.stringify(stateTree) ]);
|
|
4350
4411
|
const handlePubSubSubscribe = pubsub => {
|
|
4351
4412
|
const subscriptions = [ {
|
|
4352
4413
|
topic: pluridData.PLURID_PUBSUB_TOPIC.CONFIGURATION,
|
|
@@ -4756,7 +4817,7 @@ const PluridView = properties => {
|
|
|
4756
4817
|
return () => {
|
|
4757
4818
|
window.removeEventListener("resize", treeUpdateCallback);
|
|
4758
4819
|
};
|
|
4759
|
-
}), [ stateSpaceView, stateConfiguration ]);
|
|
4820
|
+
}), [ stateSpaceView, stateConfiguration, JSON.stringify(stateTree) ]);
|
|
4760
4821
|
React.useEffect((() => {
|
|
4761
4822
|
if (typeof window === "undefined") {
|
|
4762
4823
|
return;
|
|
@@ -5397,10 +5458,16 @@ const renderDirectPlane = (routePlane, planesRegistrar, hostname = "origin") =>
|
|
|
5397
5458
|
return DirectPlane;
|
|
5398
5459
|
};
|
|
5399
5460
|
|
|
5461
|
+
const PluridScrollTop = styled__default["default"].div`
|
|
5462
|
+
height: 0;
|
|
5463
|
+
width: 0;
|
|
5464
|
+
`;
|
|
5465
|
+
|
|
5400
5466
|
const PluridRouterBrowser = properties => {
|
|
5401
|
-
const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
|
|
5467
|
+
const {routes: routes, planes: planes, exterior: exterior, shell: shell, hostname: hostname, scrollToTop: scrollToTop, static: staticContext, view: cleanNavigationView, cleanNavigation: cleanNavigation, notFoundPath: notFoundPathProperty} = properties;
|
|
5402
5468
|
const notFoundPath = notFoundPathProperty || "/not-found";
|
|
5403
5469
|
const pluridPlanes = gatherPluridPlanes(routes, planes);
|
|
5470
|
+
const topContainer = React.useRef(null);
|
|
5404
5471
|
const pluridPlanesRegistrar = React.useRef(new PluridPlanesRegistrar(pluridPlanes, hostname));
|
|
5405
5472
|
const pluridIsoMatcher = React.useRef(new PluridIsoMatcher$1({
|
|
5406
5473
|
routes: routes,
|
|
@@ -5410,6 +5477,15 @@ const PluridRouterBrowser = properties => {
|
|
|
5410
5477
|
const [matchedPath, setMatchedPath] = React.useState(computeInitialMatchedPath(staticContext));
|
|
5411
5478
|
const [matchedRoute, setMatchedRoute] = React.useState(pluridIsoMatcher.current.match(matchedPath, "route"));
|
|
5412
5479
|
const [PluridRoute, setPluridRoute] = React.useState(computePluridRoute(matchedRoute, pluridPlanesRegistrar.current, pluridIsoMatcher.current, staticContext && staticContext.directPlane ? pluridIsoMatcher.current.match(staticContext.directPlane, "route") : undefined, hostname));
|
|
5480
|
+
const scrollTop = () => {
|
|
5481
|
+
if (!topContainer.current || scrollToTop === false) {
|
|
5482
|
+
return;
|
|
5483
|
+
}
|
|
5484
|
+
const behavior = typeof scrollToTop === "undefined" || scrollToTop === true || scrollToTop === "smooth" ? "smooth" : "auto";
|
|
5485
|
+
topContainer.current.scrollIntoView({
|
|
5486
|
+
behavior: behavior
|
|
5487
|
+
});
|
|
5488
|
+
};
|
|
5413
5489
|
const handleLocation = event => {
|
|
5414
5490
|
let matchedPath;
|
|
5415
5491
|
if (event && event.detail && event.detail.path && !matchedPath) {
|
|
@@ -5423,6 +5499,7 @@ const PluridRouterBrowser = properties => {
|
|
|
5423
5499
|
matchedPath = pathname + window.location.search;
|
|
5424
5500
|
}
|
|
5425
5501
|
setMatchedPath(matchedPath);
|
|
5502
|
+
scrollTop();
|
|
5426
5503
|
};
|
|
5427
5504
|
React.useEffect((() => {
|
|
5428
5505
|
window.addEventListener("popstate", handleLocation);
|
|
@@ -5484,7 +5561,9 @@ const PluridRouterBrowser = properties => {
|
|
|
5484
5561
|
PluridRouterShell.displayName = "PluridRouterShell";
|
|
5485
5562
|
}
|
|
5486
5563
|
}
|
|
5487
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5564
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(PluridScrollTop, {
|
|
5565
|
+
ref: topContainer
|
|
5566
|
+
}), PluridRouterExterior && React__default["default"].createElement(PluridRouterExterior, {
|
|
5488
5567
|
matchedRoute: matchedRoute
|
|
5489
5568
|
}), React__default["default"].createElement(PluridRouterShell, {
|
|
5490
5569
|
matchedRoute: matchedRoute
|
|
@@ -6337,6 +6416,7 @@ const serverComputeMetastate = (isoMatch, paths, globals) => __awaiter(void 0, v
|
|
|
6337
6416
|
space: {
|
|
6338
6417
|
loading: false,
|
|
6339
6418
|
animatedTransform: false,
|
|
6419
|
+
transform: "matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)",
|
|
6340
6420
|
scale: 1,
|
|
6341
6421
|
rotationX: 0,
|
|
6342
6422
|
rotationY: 0,
|