@plurid/plurid-engine 0.0.0-1 → 0.0.0-12
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/distribution/functions/index.d.ts +2 -0
- package/distribution/functions/navigate/index.d.ts +1 -0
- package/distribution/functions/template/index.d.ts +1 -0
- package/distribution/index.d.ts +2 -2
- package/distribution/index.es.js +893 -858
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +876 -851
- package/distribution/index.js.map +1 -1
- package/distribution/modules/general/configuration/index.d.ts +2 -0
- package/distribution/modules/general/index.d.ts +3 -0
- package/distribution/modules/{setup/general → general}/tree/index.d.ts +1 -1
- package/distribution/modules/index.d.ts +9 -12
- package/distribution/modules/interaction/direction/index.d.ts +1 -1
- package/distribution/modules/interaction/index.d.ts +5 -0
- package/distribution/modules/interaction/mathematics/transform/general/index.d.ts +9 -0
- package/distribution/modules/interaction/mathematics/transform/index.d.ts +3 -69
- package/distribution/modules/interaction/mathematics/transform/matrix3d/index.d.ts +69 -0
- package/distribution/modules/{setup/internationalization → internationalization}/index.d.ts +0 -0
- package/distribution/modules/planes/index.d.ts +2 -0
- package/distribution/modules/planes/logic/index.d.ts +6 -0
- package/distribution/modules/planes/registrar/index.d.ts +3 -0
- package/distribution/modules/{setup/objects/PlanesRegistrar → planes/registrar}/object.d.ts +6 -5
- package/distribution/modules/planes/registrar/utilities.d.ts +6 -0
- package/distribution/modules/routing/IsoMatcher/index.d.ts +44 -0
- package/distribution/modules/{setup/router → routing}/Parser/index.d.ts +4 -4
- package/distribution/modules/{setup/router → routing}/Parser/interfaces.d.ts +10 -2
- package/distribution/modules/{setup/router → routing}/Parser/logic.d.ts +2 -2
- package/distribution/modules/routing/index.d.ts +6 -0
- package/distribution/modules/routing/logic/general/index.d.ts +8 -0
- package/distribution/modules/routing/logic/index.d.ts +3 -0
- package/distribution/modules/{setup/router → routing/logic}/utilities/index.d.ts +11 -2
- package/distribution/modules/routing/logic/validity/index.d.ts +3 -0
- package/distribution/modules/space/index.d.ts +6 -0
- package/distribution/modules/{setup/space → space}/layout/column.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/layout/faceToFace.d.ts +0 -0
- package/distribution/modules/space/layout/index.d.ts +6 -0
- package/distribution/modules/{setup/space → space}/layout/row.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/layout/sheaves.d.ts +0 -0
- package/distribution/modules/{setup/space → space}/layout/zigZag.d.ts +0 -0
- package/distribution/modules/{setup/space → space}/location/index.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/location/logic.d.ts +1 -1
- package/distribution/modules/space/tree/index.d.ts +3 -0
- package/distribution/modules/space/tree/logic.d.ts +37 -0
- package/distribution/modules/space/tree/object.d.ts +14 -0
- package/distribution/modules/{setup/space → space}/utilities/index.d.ts +0 -0
- package/distribution/modules/{setup/space → space}/view/index.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/view/logic.d.ts +0 -0
- package/distribution/modules/state/compute/index.d.ts +3 -0
- package/distribution/modules/state/compute/space/index.d.ts +3 -0
- package/distribution/modules/{setup/state → state}/compute/themes/index.d.ts +0 -0
- package/distribution/modules/state/index.d.ts +3 -0
- package/distribution/modules/{setup/state → state}/local/index.d.ts +0 -0
- package/package.json +31 -31
- package/distribution/data/constants/index.d.ts +0 -1
- package/distribution/data/interfaces/index.d.ts +0 -4
- package/distribution/modules/setup/general/configuration/index.d.ts +0 -2
- package/distribution/modules/setup/general/helpers/identified.d.ts +0 -1
- package/distribution/modules/setup/general/helpers/index.d.ts +0 -2
- package/distribution/modules/setup/general/helpers/indexed.d.ts +0 -6
- package/distribution/modules/setup/general/index.d.ts +0 -7
- package/distribution/modules/setup/general/paths/index.d.ts +0 -8
- package/distribution/modules/setup/general/planes/index.d.ts +0 -4
- package/distribution/modules/setup/general/universes/index.d.ts +0 -21
- package/distribution/modules/setup/objects/PlanesRegistrar/index.d.ts +0 -3
- package/distribution/modules/setup/objects/PlanesRegistrar/utilities.d.ts +0 -6
- package/distribution/modules/setup/router/Matcher/index.d.ts +0 -15
- package/distribution/modules/setup/router/Matcher/interfaces.d.ts +0 -12
- package/distribution/modules/setup/router/Matcher/logic.d.ts +0 -4
- package/distribution/modules/setup/router/Router/index.d.ts +0 -28
- package/distribution/modules/setup/router/Router/interfaces.d.ts +0 -8
- package/distribution/modules/setup/router/URLRouter/data.d.ts +0 -27
- package/distribution/modules/setup/router/URLRouter/index.d.ts +0 -8
- package/distribution/modules/setup/router/URLRouter/logic.d.ts +0 -12
- package/distribution/modules/setup/router/index.d.ts +0 -11
- package/distribution/modules/setup/router/interfaces.d.ts +0 -3
- package/distribution/modules/setup/space/index.d.ts +0 -6
- package/distribution/modules/setup/space/layout/index.d.ts +0 -6
- package/distribution/modules/setup/space/tree/index.d.ts +0 -3
- package/distribution/modules/setup/space/tree/logic.d.ts +0 -33
- package/distribution/modules/setup/space/tree/object.d.ts +0 -13
- package/distribution/modules/setup/state/compute/index.d.ts +0 -3
- package/distribution/modules/setup/state/compute/space/index.d.ts +0 -3
- package/distribution/modules/setup/state/index.d.ts +0 -3
package/distribution/index.es.js
CHANGED
|
@@ -1,45 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultConfiguration, protocols, HTTPS_PROTOCOL, HTTP_PROTOCOL, compareTypes, defaultTreePlane, internationalization, ROOTS_GAP, LAYOUT_TYPES, PLANE_DEFAULT_ANGLE, PLURID_ROUTER_LOCATION_CHANGED } from "@plurid/plurid-data";
|
|
2
2
|
|
|
3
|
-
import { objects,
|
|
3
|
+
import { objects, uuid, mathematics } from "@plurid/plurid-functions";
|
|
4
4
|
|
|
5
5
|
import themes, { THEME_NAMES } from "@plurid/plurid-themes";
|
|
6
6
|
|
|
7
|
-
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
8
|
-
let direction = "left";
|
|
9
|
-
const wheelDeltaX = deltas.deltaX;
|
|
10
|
-
const wheelDeltaY = deltas.deltaY;
|
|
11
|
-
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
12
|
-
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
13
|
-
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
14
|
-
direction = "left";
|
|
15
|
-
}
|
|
16
|
-
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
17
|
-
direction = "right";
|
|
18
|
-
}
|
|
19
|
-
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
20
|
-
direction = "up";
|
|
21
|
-
}
|
|
22
|
-
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
23
|
-
direction = "down";
|
|
24
|
-
}
|
|
25
|
-
return direction;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var index$k = Object.freeze({
|
|
29
|
-
__proto__: null,
|
|
30
|
-
getWheelDirection: getWheelDirection
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const internatiolate = (lamguage, field) => internationalization[lamguage][field];
|
|
34
|
-
|
|
35
|
-
const specifiedOrDefault = (path, type, configuration) => {
|
|
36
|
-
const item = objects.getNested(configuration, path);
|
|
37
|
-
if (typeof item === type) {
|
|
38
|
-
return item;
|
|
39
|
-
}
|
|
40
|
-
return objects.getNested(defaultConfiguration, path);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
7
|
const resolveTheme = (theme, type) => {
|
|
44
8
|
if (!theme) {
|
|
45
9
|
return "plurid";
|
|
@@ -66,6 +30,13 @@ const merge = (configuration, target) => {
|
|
|
66
30
|
if (!configuration) {
|
|
67
31
|
return Object.assign({}, targetConfiguration);
|
|
68
32
|
}
|
|
33
|
+
const specifiedOrDefault = (path, type, configuration) => {
|
|
34
|
+
const item = objects.getNested(configuration, path);
|
|
35
|
+
if (typeof item === type) {
|
|
36
|
+
return item;
|
|
37
|
+
}
|
|
38
|
+
return objects.getNested(targetConfiguration, path);
|
|
39
|
+
};
|
|
69
40
|
const layout = configuration && configuration.space && typeof configuration.space.layout === "object" ? configuration.space.layout : targetConfiguration.space.layout;
|
|
70
41
|
const mergedConfiguration = Object.assign(Object.assign({}, targetConfiguration), {
|
|
71
42
|
global: {
|
|
@@ -85,6 +56,7 @@ const merge = (configuration, target) => {
|
|
|
85
56
|
conceal: specifiedOrDefault("elements.toolbar.conceal", "boolean", configuration),
|
|
86
57
|
transformIcons: specifiedOrDefault("elements.toolbar.transformIcons", "boolean", configuration),
|
|
87
58
|
transformButtons: specifiedOrDefault("elements.toolbar.transformButtons", "boolean", configuration),
|
|
59
|
+
drawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.drawers ? configuration.elements.toolbar.drawers : targetConfiguration.elements.toolbar.drawers,
|
|
88
60
|
toggledDrawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.toggledDrawers ? configuration.elements.toolbar.toggledDrawers : targetConfiguration.elements.toolbar.toggledDrawers
|
|
89
61
|
},
|
|
90
62
|
viewcube: {
|
|
@@ -112,6 +84,7 @@ const merge = (configuration, target) => {
|
|
|
112
84
|
camera: specifiedOrDefault("space.camera", "string", configuration),
|
|
113
85
|
perspective: specifiedOrDefault("space.perspective", "number", configuration),
|
|
114
86
|
opaque: specifiedOrDefault("space.opaque", "boolean", configuration),
|
|
87
|
+
fadeInTime: specifiedOrDefault("space.fadeInTime", "number", configuration),
|
|
115
88
|
center: specifiedOrDefault("space.center", "boolean", configuration),
|
|
116
89
|
transformOrigin: {
|
|
117
90
|
show: specifiedOrDefault("space.transformOrigin.show", "boolean", configuration),
|
|
@@ -142,94 +115,11 @@ const merge = (configuration, target) => {
|
|
|
142
115
|
return mergedConfiguration;
|
|
143
116
|
};
|
|
144
117
|
|
|
145
|
-
var index$
|
|
118
|
+
var index$k = Object.freeze({
|
|
146
119
|
__proto__: null,
|
|
147
120
|
merge: merge
|
|
148
121
|
});
|
|
149
122
|
|
|
150
|
-
const createIndexed = items => indexing.create(items);
|
|
151
|
-
|
|
152
|
-
var index$i = Object.freeze({
|
|
153
|
-
__proto__: null,
|
|
154
|
-
createIndexed: createIndexed
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
const registerPaths = pages => {
|
|
158
|
-
const paths = [];
|
|
159
|
-
for (const page of pages) {
|
|
160
|
-
const handledPath = handlePath(page.path);
|
|
161
|
-
const path = {
|
|
162
|
-
id: uuid.generate(),
|
|
163
|
-
pageID: page.id,
|
|
164
|
-
address: page.path,
|
|
165
|
-
parameters: handledPath.parameters
|
|
166
|
-
};
|
|
167
|
-
paths.push(path);
|
|
168
|
-
}
|
|
169
|
-
return paths;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const handlePath = path => ({
|
|
173
|
-
regex: ""
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const composePathRegex = match => {
|
|
177
|
-
let reString = "";
|
|
178
|
-
for (const matched of match) {
|
|
179
|
-
if (!subpathIsParameter(matched)) {
|
|
180
|
-
reString += matched.replace("/", "\\/");
|
|
181
|
-
} else {
|
|
182
|
-
reString += "\\/([^\\/]+)";
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return reString;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const subpathIsParameter = subpath => subpath[0] === "/" && subpath[1] === ":";
|
|
189
|
-
|
|
190
|
-
var index$h = Object.freeze({
|
|
191
|
-
__proto__: null,
|
|
192
|
-
registerPaths: registerPaths,
|
|
193
|
-
composePathRegex: composePathRegex,
|
|
194
|
-
subpathIsParameter: subpathIsParameter
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
const createInternalStatePlane = plane => {
|
|
198
|
-
const statePlane = {
|
|
199
|
-
id: uuid.generate(),
|
|
200
|
-
path: plane.route
|
|
201
|
-
};
|
|
202
|
-
return statePlane;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const createInternalContextPlane = plane => {
|
|
206
|
-
const {route: route, component: component} = plane;
|
|
207
|
-
const contextPlane = {
|
|
208
|
-
id: uuid.generate(),
|
|
209
|
-
path: route,
|
|
210
|
-
component: component
|
|
211
|
-
};
|
|
212
|
-
return contextPlane;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
const getPluridPlaneIDByData = element => {
|
|
216
|
-
if (!element) {
|
|
217
|
-
return "";
|
|
218
|
-
}
|
|
219
|
-
const parent = element.parentElement;
|
|
220
|
-
if (parent && parent.dataset.pluridPlane) {
|
|
221
|
-
return parent.dataset.pluridPlane;
|
|
222
|
-
}
|
|
223
|
-
return getPluridPlaneIDByData(parent);
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
var index$g = Object.freeze({
|
|
227
|
-
__proto__: null,
|
|
228
|
-
createInternalStatePlane: createInternalStatePlane,
|
|
229
|
-
createInternalContextPlane: createInternalContextPlane,
|
|
230
|
-
getPluridPlaneIDByData: getPluridPlaneIDByData
|
|
231
|
-
});
|
|
232
|
-
|
|
233
123
|
const extractPathname = location => {
|
|
234
124
|
const queryIndex = location.indexOf("?");
|
|
235
125
|
const noQueryPath = queryIndex === -1 ? location : location.substring(0, queryIndex);
|
|
@@ -284,7 +174,7 @@ const computeComparingPath = (path, parameters) => {
|
|
|
284
174
|
comparingPathElements[index] = parameters[index];
|
|
285
175
|
}
|
|
286
176
|
}
|
|
287
|
-
const comparingPath =
|
|
177
|
+
const comparingPath = comparingPathElements.join("/");
|
|
288
178
|
return {
|
|
289
179
|
locationElements: locationElements,
|
|
290
180
|
comparingPath: comparingPath
|
|
@@ -400,54 +290,77 @@ const extractOccurence = occurence => {
|
|
|
400
290
|
return occurenceValue;
|
|
401
291
|
};
|
|
402
292
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.path = path;
|
|
407
|
-
this.options = this.handleOptions(options);
|
|
293
|
+
const stringInsertInitial = (value, insert) => {
|
|
294
|
+
if (!value.startsWith(insert)) {
|
|
295
|
+
value = insert + value;
|
|
408
296
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
297
|
+
return value;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const stringRemoveTrailing = (value, trail) => {
|
|
301
|
+
if (value.endsWith(trail)) {
|
|
302
|
+
value = value.slice(0, value.length - trail.length);
|
|
414
303
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
304
|
+
return value;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const PATH_SEPARATOR = "/";
|
|
308
|
+
|
|
309
|
+
const cleanupPath = value => {
|
|
310
|
+
value = stringInsertInitial(value, PATH_SEPARATOR);
|
|
311
|
+
value = stringRemoveTrailing(value, PATH_SEPARATOR);
|
|
312
|
+
return value;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const computePlaneAddress = (plane, route, origin = "origin") => {
|
|
316
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
317
|
+
origin = location.host;
|
|
418
318
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
319
|
+
const cleanPlane = extractPathname(plane);
|
|
320
|
+
const planeAddressType = checkPlaneAddressType(cleanPlane);
|
|
321
|
+
switch (planeAddressType) {
|
|
322
|
+
case "http":
|
|
323
|
+
case "https":
|
|
324
|
+
case "pttp":
|
|
325
|
+
return cleanPlane;
|
|
422
326
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
327
|
+
origin = stringRemoveTrailing(origin, "/");
|
|
328
|
+
const absolutePlane = isAbsolutePlane(plane);
|
|
329
|
+
const path = route && route !== "/" ? absolutePlane ? cleanupPath(cleanPlane) : cleanupPath(route) + cleanupPath(cleanPlane) : cleanupPath(cleanPlane);
|
|
330
|
+
const planeAddress = protocols.plurid + origin + path;
|
|
331
|
+
return planeAddress;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const isAbsolutePlane = value => value[0] === "/";
|
|
335
|
+
|
|
336
|
+
const checkPlaneAddressType = value => {
|
|
337
|
+
value = value.toLowerCase().trim();
|
|
338
|
+
if (value.startsWith(protocols.plurid)) {
|
|
339
|
+
return "pttp";
|
|
426
340
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
return fragments;
|
|
341
|
+
if (value.startsWith(protocols.https)) {
|
|
342
|
+
return HTTPS_PROTOCOL;
|
|
430
343
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
const {match: match, parameters: parameters, elements: elements} = this.extractParametersAndMatch();
|
|
434
|
-
const query = this.extractQuery();
|
|
435
|
-
const queryData = Object.entries(query).map((([key, value]) => key + "=" + value)).join("&");
|
|
436
|
-
const queryString = queryData ? "?" + queryData : "";
|
|
437
|
-
const fragments = this.extractFragments();
|
|
438
|
-
const parserResponse = {
|
|
439
|
-
path: this.path,
|
|
440
|
-
pathname: pathname,
|
|
441
|
-
elements: elements,
|
|
442
|
-
match: match,
|
|
443
|
-
parameters: parameters,
|
|
444
|
-
query: query,
|
|
445
|
-
fragments: fragments,
|
|
446
|
-
route: pathname + queryString
|
|
447
|
-
};
|
|
448
|
-
return parserResponse;
|
|
344
|
+
if (value.startsWith(protocols.http)) {
|
|
345
|
+
return HTTP_PROTOCOL;
|
|
449
346
|
}
|
|
450
|
-
|
|
347
|
+
return "relative";
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const removeTrailingSlash = value => {
|
|
351
|
+
if (value.endsWith("/") && value.length > 1) {
|
|
352
|
+
return value.slice(0, value.length - 1);
|
|
353
|
+
}
|
|
354
|
+
return value;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const cleanPathValue = value => {
|
|
358
|
+
const queryStart = value.indexOf("?");
|
|
359
|
+
if (queryStart < 0) {
|
|
360
|
+
return removeTrailingSlash(value);
|
|
361
|
+
}
|
|
362
|
+
return removeTrailingSlash(value.substring(0, queryStart));
|
|
363
|
+
};
|
|
451
364
|
|
|
452
365
|
const checkParameterLength = (parameter, length, compareType) => {
|
|
453
366
|
const parameterLength = parameter.length;
|
|
@@ -472,9 +385,7 @@ const checkParameterLength = (parameter, length, compareType) => {
|
|
|
472
385
|
}
|
|
473
386
|
};
|
|
474
387
|
|
|
475
|
-
const checkValidPath
|
|
476
|
-
const {path: path, parameters: parameters} = data;
|
|
477
|
-
const {parameters: validationParameters} = path;
|
|
388
|
+
const checkValidPath = (validationParameters, parameters) => {
|
|
478
389
|
if (validationParameters) {
|
|
479
390
|
for (const [parameterKey, parameterData] of Object.entries(validationParameters)) {
|
|
480
391
|
const {length: length, lengthType: lengthType, startsWith: startsWith, endsWith: endsWith, includes: includes} = parameterData;
|
|
@@ -500,35 +411,6 @@ const checkValidPath$1 = data => {
|
|
|
500
411
|
return true;
|
|
501
412
|
};
|
|
502
413
|
|
|
503
|
-
class Matcher {
|
|
504
|
-
constructor(location, path, options) {
|
|
505
|
-
this.location = location;
|
|
506
|
-
this.path = path;
|
|
507
|
-
this.options = this.handleOptions(options);
|
|
508
|
-
this.checkMatch();
|
|
509
|
-
}
|
|
510
|
-
handleOptions(options) {
|
|
511
|
-
const matcherOptions = {};
|
|
512
|
-
return matcherOptions;
|
|
513
|
-
}
|
|
514
|
-
checkMatch() {
|
|
515
|
-
const parsedLocation = new Parser(this.location, this.path);
|
|
516
|
-
const parserResponse = parsedLocation.extract();
|
|
517
|
-
if (parserResponse.match) {
|
|
518
|
-
const validPath = checkValidPath$1(parserResponse);
|
|
519
|
-
if (validPath) {
|
|
520
|
-
const matcherResponse = Object.assign({}, parserResponse);
|
|
521
|
-
this.matchedData = matcherResponse;
|
|
522
|
-
} else {
|
|
523
|
-
this.matchedData = undefined;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
data() {
|
|
528
|
-
return this.matchedData;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
414
|
const cleanPathElement = path => {
|
|
533
415
|
if (path[0] === "/") {
|
|
534
416
|
return path.slice(1);
|
|
@@ -536,7 +418,7 @@ const cleanPathElement = path => {
|
|
|
536
418
|
return path;
|
|
537
419
|
};
|
|
538
420
|
|
|
539
|
-
var index$
|
|
421
|
+
var index$j = Object.freeze({
|
|
540
422
|
__proto__: null,
|
|
541
423
|
cleanPathElement: cleanPathElement
|
|
542
424
|
});
|
|
@@ -794,402 +676,103 @@ const resolveRoute = (route, protocol, host) => {
|
|
|
794
676
|
route: absoluteRoute
|
|
795
677
|
};
|
|
796
678
|
}
|
|
797
|
-
|
|
798
|
-
const absoluteRoute = resolvers.join(separator);
|
|
679
|
+
[ protocolDivision, hostDivision.value, path.value, space.value, universe.value, cluster.value, cleanPathElement(plane.value) ];
|
|
799
680
|
return {
|
|
800
|
-
protocol:
|
|
801
|
-
host:
|
|
681
|
+
protocol: "",
|
|
682
|
+
host: "",
|
|
802
683
|
path: path,
|
|
803
|
-
space:
|
|
804
|
-
universe:
|
|
805
|
-
cluster:
|
|
806
|
-
plane:
|
|
807
|
-
route:
|
|
684
|
+
space: "",
|
|
685
|
+
universe: "",
|
|
686
|
+
cluster: "",
|
|
687
|
+
plane: "",
|
|
688
|
+
route: route
|
|
808
689
|
};
|
|
809
690
|
};
|
|
810
691
|
|
|
811
|
-
const
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
for (const universe of space.universes) {
|
|
822
|
-
if (universe.value === pathDivisions.universe.value || universe.value === "default" && pathDivisions.universe.value === "u") {
|
|
823
|
-
console.log("universe", universe);
|
|
824
|
-
if (universe.clusters) {
|
|
825
|
-
for (const cluster of universe.clusters) {
|
|
826
|
-
if (cluster.value === pathDivisions.cluster.value || cluster.value === "default" && pathDivisions.cluster.value === "c") {
|
|
827
|
-
console.log("cluster", cluster);
|
|
828
|
-
if (cluster.planes) {
|
|
829
|
-
for (const plane of cluster.planes) {
|
|
830
|
-
console.log("plane", plane);
|
|
831
|
-
if (plane.value === pathDivisions.plane.value) {
|
|
832
|
-
return {
|
|
833
|
-
path: path,
|
|
834
|
-
pathname: path.value,
|
|
835
|
-
parameters: {},
|
|
836
|
-
query: {},
|
|
837
|
-
fragments: {
|
|
838
|
-
texts: [],
|
|
839
|
-
elements: []
|
|
840
|
-
},
|
|
841
|
-
route: ""
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
return;
|
|
692
|
+
const createTreePlane = (contextPlane, documentPlane) => {
|
|
693
|
+
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
694
|
+
const treePlane = Object.assign(Object.assign({}, defaultTreePlane), {
|
|
695
|
+
routeDivisions: routeDivisions,
|
|
696
|
+
sourceID: contextPlane.id,
|
|
697
|
+
planeID: uuid.generate(),
|
|
698
|
+
route: contextPlane.path,
|
|
699
|
+
show: true
|
|
700
|
+
});
|
|
701
|
+
return treePlane;
|
|
858
702
|
};
|
|
859
703
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
this.cachedMatched = {};
|
|
865
|
-
}
|
|
866
|
-
handleOptions(options) {
|
|
867
|
-
const routerOptions = {
|
|
868
|
-
cacheLimit: (options === null || options === void 0 ? void 0 : options.cacheLimit) || 1e3,
|
|
869
|
-
gateway: options === null || options === void 0 ? void 0 : options.gateway
|
|
870
|
-
};
|
|
871
|
-
return routerOptions;
|
|
872
|
-
}
|
|
873
|
-
checkCacheReset() {
|
|
874
|
-
if (Object.entries(this.cachedMatched).length > this.options.cacheLimit) {
|
|
875
|
-
this.cachedMatched = {};
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
match(location) {
|
|
879
|
-
if (location === this.options.gateway) {
|
|
880
|
-
const query = extractQuery(window.location.search);
|
|
881
|
-
if (query.plurid) {
|
|
882
|
-
const path = findPathByDivisions(this.paths, query.plurid);
|
|
883
|
-
if (path) {
|
|
884
|
-
return path;
|
|
885
|
-
}
|
|
886
|
-
console.log("GATEWAY");
|
|
887
|
-
console.log("query", query);
|
|
888
|
-
console.log("paths", this.paths);
|
|
889
|
-
}
|
|
890
|
-
if (query.plurids) {
|
|
891
|
-
const split = query.plurids.split(",");
|
|
892
|
-
const paths = [];
|
|
893
|
-
for (const plurid of split) {
|
|
894
|
-
const path = findPathByDivisions(this.paths, plurid);
|
|
895
|
-
if (path) {
|
|
896
|
-
paths.push(path);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
console.log("GATEWAY");
|
|
900
|
-
console.log("query", query);
|
|
901
|
-
console.log("paths", this.paths);
|
|
902
|
-
console.log("paths", paths);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
const cached = this.cachedMatched[location];
|
|
906
|
-
if (cached) {
|
|
907
|
-
this.checkCacheReset();
|
|
908
|
-
return cached;
|
|
909
|
-
}
|
|
910
|
-
for (const path of this.paths) {
|
|
911
|
-
const matcher = new Matcher(location, path);
|
|
912
|
-
const data = matcher.data();
|
|
913
|
-
if (data) {
|
|
914
|
-
this.cachedMatched[location] = Object.assign({}, data);
|
|
915
|
-
return data;
|
|
916
|
-
}
|
|
704
|
+
const updateTreePlane$1 = (tree, page) => {
|
|
705
|
+
const updatedTree = tree.map((treePlane => {
|
|
706
|
+
if (treePlane.planeID === page.planeID) {
|
|
707
|
+
return Object.assign({}, page);
|
|
917
708
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
const processRoute = route => {
|
|
923
|
-
const routeElements = splitPath(route.value);
|
|
924
|
-
const parametersValues = [];
|
|
925
|
-
routeElements.map((routeElement => {
|
|
926
|
-
if (routeElement[0] === ":") {
|
|
927
|
-
parametersValues.push(routeElement);
|
|
928
|
-
} else {
|
|
929
|
-
parametersValues.push("");
|
|
709
|
+
if (treePlane.children) {
|
|
710
|
+
return Object.assign(Object.assign({}, treePlane), {
|
|
711
|
+
children: updateTreePlane$1(treePlane.children, page)
|
|
712
|
+
});
|
|
930
713
|
}
|
|
714
|
+
return treePlane;
|
|
931
715
|
}));
|
|
932
|
-
|
|
933
|
-
value: route.value,
|
|
934
|
-
parametersValues: parametersValues,
|
|
935
|
-
parameters: route.parameters
|
|
936
|
-
};
|
|
937
|
-
return processedRoute;
|
|
716
|
+
return updatedTree;
|
|
938
717
|
};
|
|
939
718
|
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
719
|
+
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
720
|
+
const updatedTree = tree.map((treePlane => {
|
|
721
|
+
if (treePlane.planeID === planeID) {
|
|
722
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
723
|
+
linkCoordinates: linkCoordinates
|
|
724
|
+
});
|
|
725
|
+
return updatedPlane;
|
|
945
726
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
727
|
+
if (treePlane.children) {
|
|
728
|
+
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
729
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
730
|
+
children: updatedChildren
|
|
731
|
+
});
|
|
732
|
+
return updatedPlane;
|
|
733
|
+
}
|
|
734
|
+
return treePlane;
|
|
735
|
+
}));
|
|
736
|
+
return updatedTree;
|
|
949
737
|
};
|
|
950
738
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
const validPath = checkValidPath(parametersValues, processedRoute.parameters);
|
|
958
|
-
if (!validPath) {
|
|
959
|
-
return;
|
|
960
|
-
}
|
|
961
|
-
const internalMatchedRoute = {
|
|
962
|
-
target: processedRoute.value,
|
|
963
|
-
source: route,
|
|
964
|
-
parameters: parametersValues
|
|
965
|
-
};
|
|
966
|
-
return internalMatchedRoute;
|
|
967
|
-
};
|
|
739
|
+
var index$i = Object.freeze({
|
|
740
|
+
__proto__: null,
|
|
741
|
+
createTreePlane: createTreePlane,
|
|
742
|
+
updateTreePlane: updateTreePlane$1,
|
|
743
|
+
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
744
|
+
});
|
|
968
745
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
const query = splitQuery[0] || "";
|
|
975
|
-
const fragment = splitQuery[1] || "";
|
|
976
|
-
const routeElements = {
|
|
977
|
-
path: path,
|
|
978
|
-
query: query,
|
|
979
|
-
fragment: fragment
|
|
980
|
-
};
|
|
981
|
-
return routeElements;
|
|
982
|
-
};
|
|
746
|
+
var index$h = Object.freeze({
|
|
747
|
+
__proto__: null,
|
|
748
|
+
configuration: index$k,
|
|
749
|
+
tree: index$i
|
|
750
|
+
});
|
|
983
751
|
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
if (startsWith && !paramaterValue.startsWith(startsWith)) {
|
|
993
|
-
return false;
|
|
994
|
-
}
|
|
995
|
-
if (endsWith && !paramaterValue.endsWith(endsWith)) {
|
|
996
|
-
return false;
|
|
997
|
-
}
|
|
998
|
-
if (includes && !includes.includes(paramaterValue)) {
|
|
999
|
-
return false;
|
|
1000
|
-
}
|
|
1001
|
-
if (length) {
|
|
1002
|
-
const validLength = checkParameterLength(paramaterValue, length, lengthType);
|
|
1003
|
-
return validLength;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
return true;
|
|
1008
|
-
};
|
|
1009
|
-
|
|
1010
|
-
const CATCH_ALL_ROUTE = "*";
|
|
1011
|
-
|
|
1012
|
-
class URLRouter {
|
|
1013
|
-
constructor(routes) {
|
|
1014
|
-
this.routes = this.processRoutes(routes);
|
|
1015
|
-
}
|
|
1016
|
-
match(route) {
|
|
1017
|
-
const routeElements = extractRouteElements(route);
|
|
1018
|
-
const {path: path} = routeElements;
|
|
1019
|
-
if (this.routes[path]) {
|
|
1020
|
-
const matchedRoute = matchRoute(path, this.routes[path]);
|
|
1021
|
-
if (matchedRoute) {
|
|
1022
|
-
const {target: target, source: source, parameters: parameters} = matchedRoute;
|
|
1023
|
-
return {
|
|
1024
|
-
elements: routeElements,
|
|
1025
|
-
target: target,
|
|
1026
|
-
source: source,
|
|
1027
|
-
parameters: parameters
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
const matchedRoute = matchRoutes(path, this.routes);
|
|
1032
|
-
if (matchedRoute) {
|
|
1033
|
-
const {target: target, source: source, parameters: parameters} = matchedRoute;
|
|
1034
|
-
return {
|
|
1035
|
-
elements: routeElements,
|
|
1036
|
-
target: target,
|
|
1037
|
-
source: source,
|
|
1038
|
-
parameters: parameters
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
if (this.routes[CATCH_ALL_ROUTE]) {
|
|
1042
|
-
const matchedRoute = matchRoute(path, this.routes[CATCH_ALL_ROUTE]);
|
|
1043
|
-
if (matchedRoute) {
|
|
1044
|
-
const {target: target, source: source, parameters: parameters} = matchedRoute;
|
|
1045
|
-
return {
|
|
1046
|
-
elements: routeElements,
|
|
1047
|
-
target: target,
|
|
1048
|
-
source: source,
|
|
1049
|
-
parameters: parameters
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
return;
|
|
752
|
+
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
753
|
+
let direction = "left";
|
|
754
|
+
const wheelDeltaX = deltas.deltaX;
|
|
755
|
+
const wheelDeltaY = deltas.deltaY;
|
|
756
|
+
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
757
|
+
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
758
|
+
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
759
|
+
direction = "left";
|
|
1054
760
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
for (const route of routes) {
|
|
1058
|
-
const processedRoute = processRoute(route);
|
|
1059
|
-
index[processedRoute.value] = Object.assign({}, processedRoute);
|
|
1060
|
-
}
|
|
1061
|
-
return index;
|
|
761
|
+
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
762
|
+
direction = "right";
|
|
1062
763
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
var index$e = Object.freeze({
|
|
1066
|
-
__proto__: null,
|
|
1067
|
-
default: Router,
|
|
1068
|
-
URLRouter: URLRouter,
|
|
1069
|
-
RouteMatcher: Matcher,
|
|
1070
|
-
RouteParser: Parser,
|
|
1071
|
-
mapPathsToRoutes: mapPathsToRoutes,
|
|
1072
|
-
pluridLinkPathDivider: pluridLinkPathDivider,
|
|
1073
|
-
resolveRoute: resolveRoute,
|
|
1074
|
-
extractQuery: extractQuery
|
|
1075
|
-
});
|
|
1076
|
-
|
|
1077
|
-
const createTreePlane = (contextPlane, documentPlane) => {
|
|
1078
|
-
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
1079
|
-
const treePlane = Object.assign(Object.assign({}, defaultTreePlane), {
|
|
1080
|
-
routeDivisions: routeDivisions,
|
|
1081
|
-
sourceID: contextPlane.id,
|
|
1082
|
-
planeID: uuid.generate(),
|
|
1083
|
-
route: contextPlane.path,
|
|
1084
|
-
show: true
|
|
1085
|
-
});
|
|
1086
|
-
return treePlane;
|
|
1087
|
-
};
|
|
1088
|
-
|
|
1089
|
-
const updateTreePlane$1 = (tree, page) => {
|
|
1090
|
-
const updatedTree = tree.map((treePlane => {
|
|
1091
|
-
if (treePlane.planeID === page.planeID) {
|
|
1092
|
-
return Object.assign({}, page);
|
|
1093
|
-
}
|
|
1094
|
-
if (treePlane.children) {
|
|
1095
|
-
return Object.assign(Object.assign({}, treePlane), {
|
|
1096
|
-
children: updateTreePlane$1(treePlane.children, page)
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
return treePlane;
|
|
1100
|
-
}));
|
|
1101
|
-
return updatedTree;
|
|
1102
|
-
};
|
|
1103
|
-
|
|
1104
|
-
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
1105
|
-
const updatedTree = tree.map((treePlane => {
|
|
1106
|
-
if (treePlane.planeID === planeID) {
|
|
1107
|
-
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
1108
|
-
linkCoordinates: linkCoordinates
|
|
1109
|
-
});
|
|
1110
|
-
return updatedPlane;
|
|
1111
|
-
}
|
|
1112
|
-
if (treePlane.children) {
|
|
1113
|
-
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
1114
|
-
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
1115
|
-
children: updatedChildren
|
|
1116
|
-
});
|
|
1117
|
-
return updatedPlane;
|
|
1118
|
-
}
|
|
1119
|
-
return treePlane;
|
|
1120
|
-
}));
|
|
1121
|
-
return updatedTree;
|
|
1122
|
-
};
|
|
1123
|
-
|
|
1124
|
-
var index$d = Object.freeze({
|
|
1125
|
-
__proto__: null,
|
|
1126
|
-
createTreePlane: createTreePlane,
|
|
1127
|
-
updateTreePlane: updateTreePlane$1,
|
|
1128
|
-
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
1129
|
-
});
|
|
1130
|
-
|
|
1131
|
-
const createInternalStateUniverse = universe => {
|
|
1132
|
-
const statePlanes = universe.planes.map((plane => {
|
|
1133
|
-
const internalStatePlane = createInternalStatePlane(plane);
|
|
1134
|
-
return internalStatePlane;
|
|
1135
|
-
}));
|
|
1136
|
-
const indexedStatePlanes = createIndexed(statePlanes);
|
|
1137
|
-
const paths = registerPaths(statePlanes);
|
|
1138
|
-
const indexedPaths = createIndexed(paths);
|
|
1139
|
-
const stateUniverse = {
|
|
1140
|
-
name: universe.name,
|
|
1141
|
-
planes: indexedStatePlanes,
|
|
1142
|
-
paths: indexedPaths,
|
|
1143
|
-
id: universe.id || uuid.generate(),
|
|
1144
|
-
ordinal: universe.ordinal || 0,
|
|
1145
|
-
active: universe.active || false
|
|
1146
|
-
};
|
|
1147
|
-
return stateUniverse;
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
const createInternalContextUniverse = universe => {
|
|
1151
|
-
const contextPlanes = universe.planes.map((plane => {
|
|
1152
|
-
const internalContextPlane = createInternalContextPlane(plane);
|
|
1153
|
-
return internalContextPlane;
|
|
1154
|
-
}));
|
|
1155
|
-
const indexedContextPlanes = createIndexed(contextPlanes);
|
|
1156
|
-
const contextUniverse = {
|
|
1157
|
-
name: universe.name,
|
|
1158
|
-
planes: indexedContextPlanes,
|
|
1159
|
-
id: universe.id || uuid.generate()
|
|
1160
|
-
};
|
|
1161
|
-
return contextUniverse;
|
|
1162
|
-
};
|
|
1163
|
-
|
|
1164
|
-
const findActiveUniverse = universes => {
|
|
1165
|
-
if (universes.length === 0) {
|
|
1166
|
-
return "";
|
|
764
|
+
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
765
|
+
direction = "up";
|
|
1167
766
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
if (universe.active) {
|
|
1171
|
-
activeUniverseID = universe.id;
|
|
1172
|
-
break;
|
|
1173
|
-
}
|
|
767
|
+
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
768
|
+
direction = "down";
|
|
1174
769
|
}
|
|
1175
|
-
return
|
|
770
|
+
return direction;
|
|
1176
771
|
};
|
|
1177
772
|
|
|
1178
|
-
var index$
|
|
1179
|
-
__proto__: null,
|
|
1180
|
-
createInternalStateUniverse: createInternalStateUniverse,
|
|
1181
|
-
createInternalContextUniverse: createInternalContextUniverse,
|
|
1182
|
-
findActiveUniverse: findActiveUniverse
|
|
1183
|
-
});
|
|
1184
|
-
|
|
1185
|
-
var index$b = Object.freeze({
|
|
773
|
+
var index$g = Object.freeze({
|
|
1186
774
|
__proto__: null,
|
|
1187
|
-
|
|
1188
|
-
universes: index$c,
|
|
1189
|
-
helpers: index$i,
|
|
1190
|
-
planes: index$g,
|
|
1191
|
-
paths: index$h,
|
|
1192
|
-
tree: index$d
|
|
775
|
+
getWheelDirection: getWheelDirection
|
|
1193
776
|
});
|
|
1194
777
|
|
|
1195
778
|
const degToRad = deg => deg * .01745329252;
|
|
@@ -1300,7 +883,7 @@ function makeRotationMatrixFromQuaternion(quaternion) {
|
|
|
1300
883
|
return [ 1 - (num5 + num6), num7 - num12, num8 + num11, 0, num7 + num12, 1 - (num4 + num6), num9 - num10, 0, num8 - num11, num9 + num10, 1 - (num4 + num5), 0, 0, 0, 0, 1 ];
|
|
1301
884
|
}
|
|
1302
885
|
|
|
1303
|
-
var index$
|
|
886
|
+
var index$f = Object.freeze({
|
|
1304
887
|
__proto__: null,
|
|
1305
888
|
degToRad: degToRad,
|
|
1306
889
|
radToDeg: radToDeg,
|
|
@@ -1324,7 +907,7 @@ function rotateMatrix(xAngle, yAngle, zAngle = 0) {
|
|
|
1324
907
|
return rotationMatrix;
|
|
1325
908
|
}
|
|
1326
909
|
|
|
1327
|
-
function translateMatrix(x, y, z) {
|
|
910
|
+
function translateMatrix$1(x, y, z) {
|
|
1328
911
|
return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ];
|
|
1329
912
|
}
|
|
1330
913
|
|
|
@@ -1332,7 +915,7 @@ function scaleMatrix(s) {
|
|
|
1332
915
|
return [ s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 ];
|
|
1333
916
|
}
|
|
1334
917
|
|
|
1335
|
-
function multiplyMatrices(matrixA, matrixB) {
|
|
918
|
+
function multiplyMatrices$1(matrixA, matrixB) {
|
|
1336
919
|
const result = [];
|
|
1337
920
|
const a00 = matrixA[0];
|
|
1338
921
|
const a01 = matrixA[1];
|
|
@@ -1388,7 +971,7 @@ function multiplyMatrices(matrixA, matrixB) {
|
|
|
1388
971
|
function multiplyArrayOfMatrices(matrices) {
|
|
1389
972
|
let inputMatrix = matrices[0];
|
|
1390
973
|
for (let i = 1; i < matrices.length; i++) {
|
|
1391
|
-
inputMatrix = multiplyMatrices(inputMatrix, matrices[i]);
|
|
974
|
+
inputMatrix = multiplyMatrices$1(inputMatrix, matrices[i]);
|
|
1392
975
|
}
|
|
1393
976
|
return inputMatrix;
|
|
1394
977
|
}
|
|
@@ -1397,16 +980,105 @@ function matrixArrayToCSSMatrix(array) {
|
|
|
1397
980
|
return "matrix3d(" + array.join(",") + ")";
|
|
1398
981
|
}
|
|
1399
982
|
|
|
1400
|
-
var index$
|
|
983
|
+
var index$e = Object.freeze({
|
|
1401
984
|
__proto__: null,
|
|
1402
985
|
rotateMatrix: rotateMatrix,
|
|
1403
|
-
translateMatrix: translateMatrix,
|
|
986
|
+
translateMatrix: translateMatrix$1,
|
|
1404
987
|
scaleMatrix: scaleMatrix,
|
|
1405
|
-
multiplyMatrices: multiplyMatrices,
|
|
988
|
+
multiplyMatrices: multiplyMatrices$1,
|
|
1406
989
|
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
1407
990
|
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
1408
991
|
});
|
|
1409
992
|
|
|
993
|
+
const multiplyMatrices = (m1, m2) => {
|
|
994
|
+
const result = [];
|
|
995
|
+
for (let i = 0; i < m1.length; i++) {
|
|
996
|
+
result[i] = [];
|
|
997
|
+
for (let j = 0; j < m2[0].length; j++) {
|
|
998
|
+
let sum = 0;
|
|
999
|
+
for (let k = 0; k < m1[0].length; k++) {
|
|
1000
|
+
sum += m1[i][k] * m2[k][j];
|
|
1001
|
+
}
|
|
1002
|
+
result[i][j] = sum;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
return result;
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
const arrayToMatrix = array => {
|
|
1009
|
+
const matrix = [];
|
|
1010
|
+
for (let i = 0; i < array.length; i += 4) {
|
|
1011
|
+
const row = [];
|
|
1012
|
+
row.push(array[i]);
|
|
1013
|
+
row.push(array[i + 1]);
|
|
1014
|
+
row.push(array[i + 2]);
|
|
1015
|
+
row.push(array[i + 3]);
|
|
1016
|
+
matrix.push(row);
|
|
1017
|
+
}
|
|
1018
|
+
return matrix;
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
const matrixToArray = matrix => matrix.flat();
|
|
1022
|
+
|
|
1023
|
+
const printMatrix = (matrix, name) => {
|
|
1024
|
+
const normalize = value => {
|
|
1025
|
+
if (value === 1 || value === 0) {
|
|
1026
|
+
return value + " ";
|
|
1027
|
+
}
|
|
1028
|
+
if (value > 0) {
|
|
1029
|
+
return value.toFixed(2) + " ";
|
|
1030
|
+
}
|
|
1031
|
+
return value.toFixed(2) + " ";
|
|
1032
|
+
};
|
|
1033
|
+
console.log("matrix", name + ":");
|
|
1034
|
+
for (const row of matrix) {
|
|
1035
|
+
console.log(normalize(row[0]), normalize(row[1]), normalize(row[2]), normalize(row[3]));
|
|
1036
|
+
}
|
|
1037
|
+
console.log(`matrix3d(${matrix.flat().join(",")})`);
|
|
1038
|
+
console.log();
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
const rotateXMatrix = angle => {
|
|
1042
|
+
const x = Math.cos(angle);
|
|
1043
|
+
const y = -1 * Math.sin(angle);
|
|
1044
|
+
const z = Math.sin(angle);
|
|
1045
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, x, y, 0 ], [ 0, z, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1046
|
+
return m;
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
const rotateYMatrix = angle => {
|
|
1050
|
+
const x = Math.cos(angle);
|
|
1051
|
+
const y = -1 * Math.sin(angle);
|
|
1052
|
+
const z = Math.sin(angle);
|
|
1053
|
+
const m = [ [ x, 0, z, 0 ], [ 0, 1, 0, 0 ], [ y, 0, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1054
|
+
return m;
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
const rotateZMatrix = angle => {
|
|
1058
|
+
const x = Math.cos(angle);
|
|
1059
|
+
const y = -1 * Math.sin(angle);
|
|
1060
|
+
const z = Math.sin(angle);
|
|
1061
|
+
const m = [ [ x, y, 0, 0 ], [ z, x, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1062
|
+
return m;
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
const translateMatrix = (x = 0, y = 0, z = 0) => {
|
|
1066
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ x, y, z, 1 ] ];
|
|
1067
|
+
return m;
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
var index$d = Object.freeze({
|
|
1071
|
+
__proto__: null,
|
|
1072
|
+
multiplyMatrices: multiplyMatrices,
|
|
1073
|
+
arrayToMatrix: arrayToMatrix,
|
|
1074
|
+
matrixToArray: matrixToArray,
|
|
1075
|
+
printMatrix: printMatrix,
|
|
1076
|
+
rotateXMatrix: rotateXMatrix,
|
|
1077
|
+
rotateYMatrix: rotateYMatrix,
|
|
1078
|
+
rotateZMatrix: rotateZMatrix,
|
|
1079
|
+
translateMatrix: translateMatrix
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1410
1082
|
function getMatrixValues(matrix3d) {
|
|
1411
1083
|
const matrixValues = matrix3d.split("(")[1].split(")")[0].split(",");
|
|
1412
1084
|
const matrixValuesInt = [];
|
|
@@ -1536,7 +1208,7 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1536
1208
|
const translateZ = transformTranslate.translateZ;
|
|
1537
1209
|
const scale = getTransformScale(matrix3d).scale;
|
|
1538
1210
|
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1539
|
-
const valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1211
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1540
1212
|
const valScalationMatrix = scaleMatrix(scale);
|
|
1541
1213
|
if (direction === "left") {
|
|
1542
1214
|
rotateY -= angleIncrement;
|
|
@@ -1554,88 +1226,567 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1554
1226
|
rotateY += angleIncrement;
|
|
1555
1227
|
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
1556
1228
|
}
|
|
1557
|
-
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1558
|
-
return transformedMatrix3d;
|
|
1559
|
-
}
|
|
1229
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1230
|
+
return transformedMatrix3d;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
function translatePlurid(matrix3d, direction = "", linearIncrement = 50) {
|
|
1234
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1235
|
+
const rotateX = transformRotate.rotateX;
|
|
1236
|
+
const rotateY = transformRotate.rotateY;
|
|
1237
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1238
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1239
|
+
let translateX = transformTranslate.translateX;
|
|
1240
|
+
let translateY = transformTranslate.translateY;
|
|
1241
|
+
const translateZ = transformTranslate.translateZ;
|
|
1242
|
+
const scale = getTransformScale(matrix3d).scale;
|
|
1243
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1244
|
+
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1245
|
+
const valScalationMatrix = scaleMatrix(scale);
|
|
1246
|
+
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1247
|
+
if (direction === "left") {
|
|
1248
|
+
translateX += linearIncrement;
|
|
1249
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1250
|
+
}
|
|
1251
|
+
if (direction === "right") {
|
|
1252
|
+
translateX -= linearIncrement;
|
|
1253
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1254
|
+
}
|
|
1255
|
+
if (direction === "up") {
|
|
1256
|
+
translateY += linearIncrement;
|
|
1257
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1258
|
+
}
|
|
1259
|
+
if (direction === "down") {
|
|
1260
|
+
translateY -= linearIncrement;
|
|
1261
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1262
|
+
}
|
|
1263
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1264
|
+
return transformedMatrix3d;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
function scalePlurid(matrix3d, direction = "", scaleIncrement = .05) {
|
|
1268
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1269
|
+
const rotateX = transformRotate.rotateX;
|
|
1270
|
+
const rotateY = transformRotate.rotateY;
|
|
1271
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1272
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1273
|
+
const translateX = transformTranslate.translateX;
|
|
1274
|
+
const translateY = transformTranslate.translateY;
|
|
1275
|
+
const translateZ = transformTranslate.translateZ;
|
|
1276
|
+
let scale = getTransformScale(matrix3d).scale;
|
|
1277
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1278
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1279
|
+
let valScalationMatrix = scaleMatrix(scale);
|
|
1280
|
+
if (direction === "up") {
|
|
1281
|
+
scale -= scaleIncrement;
|
|
1282
|
+
if (scale < .1) {
|
|
1283
|
+
scale = .1;
|
|
1284
|
+
}
|
|
1285
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1286
|
+
}
|
|
1287
|
+
if (direction === "down") {
|
|
1288
|
+
scale += scaleIncrement;
|
|
1289
|
+
if (scale > 4) {
|
|
1290
|
+
scale = 4;
|
|
1291
|
+
}
|
|
1292
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1293
|
+
}
|
|
1294
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1295
|
+
return transformedMatrix3d;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
var index$c = Object.freeze({
|
|
1299
|
+
__proto__: null,
|
|
1300
|
+
getMatrixValues: getMatrixValues,
|
|
1301
|
+
getRotationMatrix: getRotationMatrix,
|
|
1302
|
+
getTranslationMatrix: getTranslationMatrix,
|
|
1303
|
+
getScalationValue: getScalationValue,
|
|
1304
|
+
setTransform: setTransform,
|
|
1305
|
+
getTransformRotate: getTransformRotate,
|
|
1306
|
+
getTransformTranslate: getTransformTranslate,
|
|
1307
|
+
getTransformScale: getTransformScale,
|
|
1308
|
+
rotatePlurid: rotatePlurid,
|
|
1309
|
+
translatePlurid: translatePlurid,
|
|
1310
|
+
scalePlurid: scalePlurid
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
var index$b = Object.freeze({
|
|
1314
|
+
__proto__: null,
|
|
1315
|
+
general: index$d,
|
|
1316
|
+
matrix3d: index$c
|
|
1317
|
+
});
|
|
1318
|
+
|
|
1319
|
+
var index$a = Object.freeze({
|
|
1320
|
+
__proto__: null,
|
|
1321
|
+
direction: index$g,
|
|
1322
|
+
matrix: index$e,
|
|
1323
|
+
quaternion: index$f,
|
|
1324
|
+
transform: index$b
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
const internatiolate = (lamguage, field) => internationalization[lamguage][field];
|
|
1328
|
+
|
|
1329
|
+
const resolvePluridPlaneData = plane => {
|
|
1330
|
+
if (Array.isArray(plane)) {
|
|
1331
|
+
const [route, component, options] = plane;
|
|
1332
|
+
return Object.assign({
|
|
1333
|
+
route: route,
|
|
1334
|
+
component: component
|
|
1335
|
+
}, options);
|
|
1336
|
+
}
|
|
1337
|
+
return plane;
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
const resolvePluridRoutePlaneData = plane => {
|
|
1341
|
+
if (Array.isArray(plane)) {
|
|
1342
|
+
const [value, component, options] = plane;
|
|
1343
|
+
return Object.assign({
|
|
1344
|
+
value: value,
|
|
1345
|
+
component: component
|
|
1346
|
+
}, options);
|
|
1347
|
+
}
|
|
1348
|
+
return plane;
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
const createInternalStatePlane = plane => {
|
|
1352
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1353
|
+
const statePlane = {
|
|
1354
|
+
id: uuid.generate(),
|
|
1355
|
+
path: planeData.route
|
|
1356
|
+
};
|
|
1357
|
+
return statePlane;
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
const createInternalContextPlane = plane => {
|
|
1361
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1362
|
+
const {route: route, component: component} = planeData;
|
|
1363
|
+
const contextPlane = {
|
|
1364
|
+
id: uuid.generate(),
|
|
1365
|
+
path: route,
|
|
1366
|
+
component: component
|
|
1367
|
+
};
|
|
1368
|
+
return contextPlane;
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
const getPluridPlaneIDByData = element => {
|
|
1372
|
+
if (!element) {
|
|
1373
|
+
return "";
|
|
1374
|
+
}
|
|
1375
|
+
const parent = element.parentElement;
|
|
1376
|
+
if (parent && parent.dataset.pluridPlane) {
|
|
1377
|
+
return parent.dataset.pluridPlane;
|
|
1378
|
+
}
|
|
1379
|
+
return getPluridPlaneIDByData(parent);
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
class IsoMatcher {
|
|
1383
|
+
constructor(data, origin = "origin") {
|
|
1384
|
+
this.routesIndex = new Map;
|
|
1385
|
+
this.planesIndex = new Map;
|
|
1386
|
+
this.routesKeys = [];
|
|
1387
|
+
this.planesKeys = [];
|
|
1388
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
1389
|
+
this.origin = location.host;
|
|
1390
|
+
} else {
|
|
1391
|
+
this.origin = origin;
|
|
1392
|
+
}
|
|
1393
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1394
|
+
}
|
|
1395
|
+
match(path, context = "plane") {
|
|
1396
|
+
switch (context) {
|
|
1397
|
+
case "plane":
|
|
1398
|
+
return this.matchPlane(path);
|
|
1399
|
+
|
|
1400
|
+
case "route":
|
|
1401
|
+
return this.matchRoute(path);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
index(data) {
|
|
1405
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1406
|
+
}
|
|
1407
|
+
clear() {
|
|
1408
|
+
this.routesIndex = new Map;
|
|
1409
|
+
this.planesIndex = new Map;
|
|
1410
|
+
this.routesKeys = [];
|
|
1411
|
+
this.planesKeys = [];
|
|
1412
|
+
}
|
|
1413
|
+
getPlanesIndex() {
|
|
1414
|
+
return this.planesIndex;
|
|
1415
|
+
}
|
|
1416
|
+
updateIndexes(routes, routePlanes, planes) {
|
|
1417
|
+
this.indexPlanes(planes, "Plane");
|
|
1418
|
+
this.indexPlanes(routePlanes, "RoutePlane");
|
|
1419
|
+
for (const route of routes) {
|
|
1420
|
+
if (route.planes) {
|
|
1421
|
+
this.indexPlanes(route.planes, "RoutePlane", route.value);
|
|
1422
|
+
}
|
|
1423
|
+
this.routesIndex.set(route.value, {
|
|
1424
|
+
data: Object.assign({}, route)
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
this.routesKeys = Array.from(this.routesIndex.keys());
|
|
1428
|
+
this.planesKeys = Array.from(this.planesIndex.keys());
|
|
1429
|
+
}
|
|
1430
|
+
indexPlanes(planes, kind, parent) {
|
|
1431
|
+
for (const plane of planes) {
|
|
1432
|
+
const planeData = kind === "Plane" ? resolvePluridPlaneData(plane) : resolvePluridRoutePlaneData(plane);
|
|
1433
|
+
const address = computePlaneAddress(kind === "Plane" ? planeData.route : planeData.value, parent, this.origin);
|
|
1434
|
+
const indexedPlane = {
|
|
1435
|
+
kind: kind,
|
|
1436
|
+
data: Object.assign({}, planeData)
|
|
1437
|
+
};
|
|
1438
|
+
if (parent) {
|
|
1439
|
+
indexedPlane["parent"] = parent;
|
|
1440
|
+
}
|
|
1441
|
+
this.planesIndex.set(address, indexedPlane);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
matchPlane(value) {
|
|
1445
|
+
const planeAddress = computePlaneAddress(value, undefined, this.origin);
|
|
1446
|
+
const plane = this.planesIndex.get(planeAddress);
|
|
1447
|
+
if (plane) {
|
|
1448
|
+
const query = extractQuery(value);
|
|
1449
|
+
const fragments = extractFragments(value);
|
|
1450
|
+
const match = {
|
|
1451
|
+
value: planeAddress,
|
|
1452
|
+
fragments: fragments,
|
|
1453
|
+
query: query,
|
|
1454
|
+
parameters: {}
|
|
1455
|
+
};
|
|
1456
|
+
if (plane.kind === "Plane") {
|
|
1457
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1458
|
+
const result = {
|
|
1459
|
+
kind: kind,
|
|
1460
|
+
data: data,
|
|
1461
|
+
parent: parent,
|
|
1462
|
+
match: match
|
|
1463
|
+
};
|
|
1464
|
+
return result;
|
|
1465
|
+
}
|
|
1466
|
+
if (plane.kind === "RoutePlane") {
|
|
1467
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1468
|
+
const result = {
|
|
1469
|
+
kind: kind,
|
|
1470
|
+
data: data,
|
|
1471
|
+
parent: parent,
|
|
1472
|
+
match: match
|
|
1473
|
+
};
|
|
1474
|
+
return result;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
for (const planePath of this.planesKeys) {
|
|
1478
|
+
const normalizedPlanePath = planePath.replace(protocols.plurid, "");
|
|
1479
|
+
const normalizedPlaneAddress = planeAddress.replace(protocols.plurid, "");
|
|
1480
|
+
const planePathSplit = normalizedPlanePath.split("/");
|
|
1481
|
+
const planeAddressSplit = normalizedPlaneAddress.split("/");
|
|
1482
|
+
if (planePathSplit[0] !== planeAddressSplit[0]) {
|
|
1483
|
+
continue;
|
|
1484
|
+
}
|
|
1485
|
+
if (planePathSplit.length !== planeAddressSplit.length) {
|
|
1486
|
+
continue;
|
|
1487
|
+
}
|
|
1488
|
+
const parametersAndMatch = extractParametersAndMatch(normalizedPlaneAddress, normalizedPlanePath);
|
|
1489
|
+
if (parametersAndMatch.match) {
|
|
1490
|
+
const plane = this.planesIndex.get(planePath);
|
|
1491
|
+
if (!plane) {
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1495
|
+
const validPath = checkValidPath(plane.data.parameters, parameters);
|
|
1496
|
+
if (!validPath) {
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
const query = extractQuery(value);
|
|
1500
|
+
const fragments = extractFragments(value);
|
|
1501
|
+
const match = {
|
|
1502
|
+
value: planeAddress,
|
|
1503
|
+
fragments: fragments,
|
|
1504
|
+
query: query,
|
|
1505
|
+
parameters: parameters
|
|
1506
|
+
};
|
|
1507
|
+
if (plane.kind === "Plane") {
|
|
1508
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1509
|
+
const result = {
|
|
1510
|
+
kind: kind,
|
|
1511
|
+
data: data,
|
|
1512
|
+
parent: parent,
|
|
1513
|
+
match: match
|
|
1514
|
+
};
|
|
1515
|
+
return result;
|
|
1516
|
+
}
|
|
1517
|
+
if (plane.kind === "RoutePlane") {
|
|
1518
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1519
|
+
const result = {
|
|
1520
|
+
kind: kind,
|
|
1521
|
+
data: data,
|
|
1522
|
+
parent: parent,
|
|
1523
|
+
match: match
|
|
1524
|
+
};
|
|
1525
|
+
return result;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
matchRoute(value) {
|
|
1532
|
+
const routeValue = cleanPathValue(value);
|
|
1533
|
+
const route = this.routesIndex.get(routeValue);
|
|
1534
|
+
if (route) {
|
|
1535
|
+
const query = extractQuery(value);
|
|
1536
|
+
const result = {
|
|
1537
|
+
kind: "Route",
|
|
1538
|
+
data: route.data,
|
|
1539
|
+
match: {
|
|
1540
|
+
value: routeValue,
|
|
1541
|
+
query: query,
|
|
1542
|
+
parameters: {}
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
return result;
|
|
1546
|
+
}
|
|
1547
|
+
for (const routePath of this.routesKeys) {
|
|
1548
|
+
const routeSplit = routePath.split("/");
|
|
1549
|
+
const valueSplit = routeValue.split("/");
|
|
1550
|
+
if (routeSplit.length !== valueSplit.length) {
|
|
1551
|
+
continue;
|
|
1552
|
+
}
|
|
1553
|
+
const parametersAndMatch = extractParametersAndMatch(routeValue.slice(1), routePath.slice(1));
|
|
1554
|
+
if (parametersAndMatch.match) {
|
|
1555
|
+
const route = this.routesIndex.get(routePath);
|
|
1556
|
+
if (!route) {
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1560
|
+
const validPath = checkValidPath(route.data.parameters, parameters);
|
|
1561
|
+
if (!validPath) {
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
const query = extractQuery(routeValue);
|
|
1565
|
+
const match = {
|
|
1566
|
+
value: routeValue,
|
|
1567
|
+
query: query,
|
|
1568
|
+
parameters: parameters
|
|
1569
|
+
};
|
|
1570
|
+
if (route) {
|
|
1571
|
+
const result = {
|
|
1572
|
+
kind: "Route",
|
|
1573
|
+
data: route.data,
|
|
1574
|
+
match: match
|
|
1575
|
+
};
|
|
1576
|
+
return result;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
const routePlane = this.matchPlane(routeValue);
|
|
1581
|
+
if (routePlane) {
|
|
1582
|
+
const result = {
|
|
1583
|
+
kind: "RoutePlane",
|
|
1584
|
+
data: routePlane.data,
|
|
1585
|
+
match: {
|
|
1586
|
+
value: routeValue,
|
|
1587
|
+
query: routePlane.match.query,
|
|
1588
|
+
parameters: routePlane.match.parameters
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
return result;
|
|
1592
|
+
}
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
class Parser {
|
|
1598
|
+
constructor(location, path, options) {
|
|
1599
|
+
this.location = location;
|
|
1600
|
+
this.path = path;
|
|
1601
|
+
this.options = this.handleOptions(options);
|
|
1602
|
+
}
|
|
1603
|
+
handleOptions(options) {
|
|
1604
|
+
const parserOptions = {
|
|
1605
|
+
fragment: (options === null || options === void 0 ? void 0 : options.fragment) || true
|
|
1606
|
+
};
|
|
1607
|
+
return parserOptions;
|
|
1608
|
+
}
|
|
1609
|
+
extractPathname() {
|
|
1610
|
+
const pathname = extractPathname(this.location);
|
|
1611
|
+
return pathname;
|
|
1612
|
+
}
|
|
1613
|
+
extractParametersAndMatch() {
|
|
1614
|
+
const parametersAndMatch = extractParametersAndMatch(this.location, this.path.value);
|
|
1615
|
+
return parametersAndMatch;
|
|
1616
|
+
}
|
|
1617
|
+
extractQuery() {
|
|
1618
|
+
const query = extractQuery(this.location);
|
|
1619
|
+
return query;
|
|
1620
|
+
}
|
|
1621
|
+
extractFragments() {
|
|
1622
|
+
const fragments = this.options.fragment ? extractFragments(this.location) : extractFragments();
|
|
1623
|
+
return fragments;
|
|
1624
|
+
}
|
|
1625
|
+
extract() {
|
|
1626
|
+
const pathname = this.extractPathname();
|
|
1627
|
+
const {match: match, parameters: parameters, elements: elements} = this.extractParametersAndMatch();
|
|
1628
|
+
const query = this.extractQuery();
|
|
1629
|
+
const queryData = Object.entries(query).map((([key, value]) => key + "=" + value)).join("&");
|
|
1630
|
+
const queryString = queryData ? "?" + queryData : "";
|
|
1631
|
+
const fragments = this.extractFragments();
|
|
1632
|
+
const parserResponse = {
|
|
1633
|
+
path: this.path,
|
|
1634
|
+
pathname: pathname,
|
|
1635
|
+
elements: elements,
|
|
1636
|
+
match: match,
|
|
1637
|
+
parameters: parameters,
|
|
1638
|
+
query: query,
|
|
1639
|
+
fragments: fragments,
|
|
1640
|
+
route: pathname + queryString
|
|
1641
|
+
};
|
|
1642
|
+
return parserResponse;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
var index$9 = Object.freeze({
|
|
1647
|
+
__proto__: null,
|
|
1648
|
+
IsoMatcher: IsoMatcher,
|
|
1649
|
+
RouteParser: Parser,
|
|
1650
|
+
extractQuery: extractQuery,
|
|
1651
|
+
stringInsertInitial: stringInsertInitial,
|
|
1652
|
+
stringRemoveTrailing: stringRemoveTrailing,
|
|
1653
|
+
cleanupPath: cleanupPath,
|
|
1654
|
+
computePlaneAddress: computePlaneAddress,
|
|
1655
|
+
isAbsolutePlane: isAbsolutePlane,
|
|
1656
|
+
checkPlaneAddressType: checkPlaneAddressType,
|
|
1657
|
+
removeTrailingSlash: removeTrailingSlash,
|
|
1658
|
+
cleanPathValue: cleanPathValue,
|
|
1659
|
+
checkParameterLength: checkParameterLength,
|
|
1660
|
+
checkValidPath: checkValidPath,
|
|
1661
|
+
mapPathsToRoutes: mapPathsToRoutes,
|
|
1662
|
+
pluridLinkPathDivider: pluridLinkPathDivider,
|
|
1663
|
+
resolveRoute: resolveRoute
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
class PluridPlanesRegistrar {
|
|
1667
|
+
constructor(planes) {
|
|
1668
|
+
this.isoMatcher = new IsoMatcher({
|
|
1669
|
+
planes: planes
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
register(planes) {
|
|
1673
|
+
this.isoMatcher.index({
|
|
1674
|
+
planes: planes
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
identify() {
|
|
1678
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1679
|
+
return [ ...planes.keys() ];
|
|
1680
|
+
}
|
|
1681
|
+
get(route) {
|
|
1682
|
+
const match = this.isoMatcher.match(route);
|
|
1683
|
+
if (match) {
|
|
1684
|
+
const absoluteRoute = match.kind === "Plane" ? match.data.route : match.data.value;
|
|
1685
|
+
const registeredPlane = {
|
|
1686
|
+
route: {
|
|
1687
|
+
absolute: absoluteRoute,
|
|
1688
|
+
fragments: match.match.fragments,
|
|
1689
|
+
parameters: match.match.parameters,
|
|
1690
|
+
query: match.match.query
|
|
1691
|
+
},
|
|
1692
|
+
component: match.data.component
|
|
1693
|
+
};
|
|
1694
|
+
return registeredPlane;
|
|
1695
|
+
}
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
getAll() {
|
|
1699
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1700
|
+
const all = new Map;
|
|
1701
|
+
for (const [path, plane] of planes) {
|
|
1702
|
+
const absoluteRoute = plane.kind === "Plane" ? plane.data.route : plane.data.value;
|
|
1703
|
+
const registeredPlane = {
|
|
1704
|
+
route: {
|
|
1705
|
+
absolute: absoluteRoute,
|
|
1706
|
+
fragments: {
|
|
1707
|
+
elements: [],
|
|
1708
|
+
texts: []
|
|
1709
|
+
},
|
|
1710
|
+
parameters: {},
|
|
1711
|
+
query: {}
|
|
1712
|
+
},
|
|
1713
|
+
component: plane.data.component
|
|
1714
|
+
};
|
|
1715
|
+
all.set(path, registeredPlane);
|
|
1716
|
+
}
|
|
1717
|
+
return all;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
const registerPlanes = (planes, planesRegistrar) => {
|
|
1722
|
+
if (!planes) {
|
|
1723
|
+
return;
|
|
1724
|
+
}
|
|
1725
|
+
if (planesRegistrar) {
|
|
1726
|
+
planesRegistrar.register(planes);
|
|
1727
|
+
return;
|
|
1728
|
+
}
|
|
1729
|
+
if (typeof window === "undefined") {
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
1733
|
+
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
1734
|
+
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
1735
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1739
|
+
return;
|
|
1740
|
+
};
|
|
1560
1741
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
const rotateY = transformRotate.rotateY;
|
|
1565
|
-
const rotateZ = transformRotate.rotateZ;
|
|
1566
|
-
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1567
|
-
let translateX = transformTranslate.translateX;
|
|
1568
|
-
let translateY = transformTranslate.translateY;
|
|
1569
|
-
const translateZ = transformTranslate.translateZ;
|
|
1570
|
-
const scale = getTransformScale(matrix3d).scale;
|
|
1571
|
-
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1572
|
-
let valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1573
|
-
const valScalationMatrix = scaleMatrix(scale);
|
|
1574
|
-
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1575
|
-
if (direction === "left") {
|
|
1576
|
-
translateX += linearIncrement;
|
|
1577
|
-
valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1742
|
+
const getPlanesRegistrar = planesRegistrar => {
|
|
1743
|
+
if (planesRegistrar) {
|
|
1744
|
+
return planesRegistrar;
|
|
1578
1745
|
}
|
|
1579
|
-
if (
|
|
1580
|
-
|
|
1581
|
-
|
|
1746
|
+
if (typeof window !== "undefined") {
|
|
1747
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1748
|
+
return window.__pluridPlanesRegistrar__;
|
|
1749
|
+
}
|
|
1582
1750
|
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1751
|
+
return;
|
|
1752
|
+
};
|
|
1753
|
+
|
|
1754
|
+
const getRegisteredPlanes = planesRegistrar => {
|
|
1755
|
+
if (planesRegistrar) {
|
|
1756
|
+
return planesRegistrar.getAll();
|
|
1586
1757
|
}
|
|
1587
|
-
if (
|
|
1588
|
-
|
|
1589
|
-
|
|
1758
|
+
if (typeof window !== "undefined") {
|
|
1759
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1760
|
+
return window.__pluridPlanesRegistrar__.getAll();
|
|
1761
|
+
}
|
|
1590
1762
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1763
|
+
return new Map;
|
|
1764
|
+
};
|
|
1594
1765
|
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
const rotateY = transformRotate.rotateY;
|
|
1599
|
-
const rotateZ = transformRotate.rotateZ;
|
|
1600
|
-
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1601
|
-
const translateX = transformTranslate.translateX;
|
|
1602
|
-
const translateY = transformTranslate.translateY;
|
|
1603
|
-
const translateZ = transformTranslate.translateZ;
|
|
1604
|
-
let scale = getTransformScale(matrix3d).scale;
|
|
1605
|
-
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1606
|
-
const valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1607
|
-
let valScalationMatrix = scaleMatrix(scale);
|
|
1608
|
-
if (direction === "up") {
|
|
1609
|
-
scale -= scaleIncrement;
|
|
1610
|
-
if (scale < .1) {
|
|
1611
|
-
scale = .1;
|
|
1612
|
-
}
|
|
1613
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1766
|
+
const getRegisteredPlane = (route, planesRegistrar) => {
|
|
1767
|
+
if (planesRegistrar) {
|
|
1768
|
+
return planesRegistrar.get(route);
|
|
1614
1769
|
}
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
scale = 4;
|
|
1770
|
+
if (typeof window !== "undefined") {
|
|
1771
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1772
|
+
return window.__pluridPlanesRegistrar__.get(route);
|
|
1619
1773
|
}
|
|
1620
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1621
1774
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
}
|
|
1775
|
+
return;
|
|
1776
|
+
};
|
|
1625
1777
|
|
|
1626
1778
|
var index$8 = Object.freeze({
|
|
1627
1779
|
__proto__: null,
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
scalePlurid: scalePlurid
|
|
1780
|
+
resolvePluridPlaneData: resolvePluridPlaneData,
|
|
1781
|
+
resolvePluridRoutePlaneData: resolvePluridRoutePlaneData,
|
|
1782
|
+
createInternalStatePlane: createInternalStatePlane,
|
|
1783
|
+
createInternalContextPlane: createInternalContextPlane,
|
|
1784
|
+
getPluridPlaneIDByData: getPluridPlaneIDByData,
|
|
1785
|
+
registerPlanes: registerPlanes,
|
|
1786
|
+
getPlanesRegistrar: getPlanesRegistrar,
|
|
1787
|
+
getRegisteredPlanes: getRegisteredPlanes,
|
|
1788
|
+
getRegisteredPlane: getRegisteredPlane,
|
|
1789
|
+
Registrar: PluridPlanesRegistrar
|
|
1639
1790
|
});
|
|
1640
1791
|
|
|
1641
1792
|
const computeSpaceSize = tree => {
|
|
@@ -1959,93 +2110,29 @@ var index$5 = Object.freeze({
|
|
|
1959
2110
|
computeZigZagLayout: computeZigZagLayout
|
|
1960
2111
|
});
|
|
1961
2112
|
|
|
1962
|
-
const
|
|
1963
|
-
if (routePath === viewPath) {
|
|
1964
|
-
return {
|
|
1965
|
-
value: viewPath,
|
|
1966
|
-
parameters: {},
|
|
1967
|
-
query: {}
|
|
1968
|
-
};
|
|
1969
|
-
}
|
|
1970
|
-
const parameters = [];
|
|
1971
|
-
const routeSplit = routePath.split("/");
|
|
1972
|
-
routeSplit.forEach((routeElement => {
|
|
1973
|
-
if (routeElement[0] === ":") {
|
|
1974
|
-
parameters.push(routeElement);
|
|
1975
|
-
} else {
|
|
1976
|
-
parameters.push("");
|
|
1977
|
-
}
|
|
1978
|
-
}));
|
|
1979
|
-
const {locationElements: locationElements, comparingPath: comparingPath} = computeComparingPath(viewPath, parameters);
|
|
1980
|
-
if (comparingPath !== "/" + routePath) {
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
const parametersValues = extractParametersValues(parameters, locationElements);
|
|
1984
|
-
return {
|
|
1985
|
-
value: viewPath,
|
|
1986
|
-
parameters: parametersValues,
|
|
1987
|
-
query: {}
|
|
1988
|
-
};
|
|
1989
|
-
};
|
|
1990
|
-
|
|
1991
|
-
const matchRouteToView = (route, view) => {
|
|
1992
|
-
const routeSplit = route.split(PLURID_ROUTE_SEPARATOR);
|
|
1993
|
-
const viewSplit = view.split(PLURID_ROUTE_SEPARATOR);
|
|
1994
|
-
if (routeSplit.length !== viewSplit.length) {
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
const routePath = routeSplit[2];
|
|
1998
|
-
const viewPath = viewSplit[2];
|
|
1999
|
-
const pathMatch = matchRouteElements(routePath, viewPath);
|
|
2000
|
-
if (!pathMatch) {
|
|
2001
|
-
return;
|
|
2002
|
-
}
|
|
2003
|
-
const routeSpace = routeSplit[3];
|
|
2004
|
-
const viewSpace = viewSplit[3];
|
|
2005
|
-
const spaceMatch = matchRouteElements(routeSpace, viewSpace);
|
|
2006
|
-
if (!spaceMatch) {
|
|
2007
|
-
return;
|
|
2008
|
-
}
|
|
2009
|
-
const routeUniverse = routeSplit[4];
|
|
2010
|
-
const viewUniverse = viewSplit[4];
|
|
2011
|
-
const universeMatch = matchRouteElements(routeUniverse, viewUniverse);
|
|
2012
|
-
if (!universeMatch) {
|
|
2013
|
-
return;
|
|
2014
|
-
}
|
|
2015
|
-
const routeCluster = routeSplit[5];
|
|
2016
|
-
const viewCluster = viewSplit[5];
|
|
2017
|
-
const clusterMatch = matchRouteElements(routeCluster, viewCluster);
|
|
2018
|
-
if (!clusterMatch) {
|
|
2019
|
-
return;
|
|
2020
|
-
}
|
|
2021
|
-
const routePlane = routeSplit[6];
|
|
2022
|
-
const viewPlane = viewSplit[6];
|
|
2023
|
-
const planeMatch = matchRouteElements(routePlane, viewPlane);
|
|
2024
|
-
if (!planeMatch) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
return {
|
|
2028
|
-
path: Object.assign({}, pathMatch),
|
|
2029
|
-
space: Object.assign({}, spaceMatch),
|
|
2030
|
-
universe: Object.assign({}, universeMatch),
|
|
2031
|
-
cluster: Object.assign({}, clusterMatch),
|
|
2032
|
-
plane: Object.assign({}, planeMatch)
|
|
2033
|
-
};
|
|
2034
|
-
};
|
|
2035
|
-
|
|
2036
|
-
const resolveViewItem = (planes, view, configuration) => {
|
|
2113
|
+
const resolveViewItem = (planes, view, configuration, origin = "origin") => {
|
|
2037
2114
|
const {protocol: protocol, host: host} = configuration.network;
|
|
2038
2115
|
const viewData = typeof view === "string" ? view : view.plane;
|
|
2039
|
-
const
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2116
|
+
const viewAddress = computePlaneAddress(viewData, undefined, origin);
|
|
2117
|
+
const iPlanes = planes.values();
|
|
2118
|
+
const pluridPlanes = [];
|
|
2119
|
+
for (const iPlane of iPlanes) {
|
|
2120
|
+
const plane = {
|
|
2121
|
+
route: iPlane.route.absolute,
|
|
2122
|
+
component: iPlane.component
|
|
2123
|
+
};
|
|
2124
|
+
pluridPlanes.push(plane);
|
|
2125
|
+
}
|
|
2126
|
+
const isoMatcher = new IsoMatcher({
|
|
2127
|
+
planes: pluridPlanes
|
|
2128
|
+
});
|
|
2129
|
+
const match = isoMatcher.match(viewData);
|
|
2130
|
+
if (match) {
|
|
2131
|
+
const route = match.match.value;
|
|
2045
2132
|
const treePlane = {
|
|
2046
2133
|
sourceID: route,
|
|
2047
2134
|
planeID: uuid.generate(),
|
|
2048
|
-
route:
|
|
2135
|
+
route: viewAddress,
|
|
2049
2136
|
routeDivisions: {
|
|
2050
2137
|
protocol: {
|
|
2051
2138
|
value: "",
|
|
@@ -2055,11 +2142,35 @@ const resolveViewItem = (planes, view, configuration) => {
|
|
|
2055
2142
|
value: host,
|
|
2056
2143
|
controlled: true
|
|
2057
2144
|
},
|
|
2058
|
-
path:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2145
|
+
path: {
|
|
2146
|
+
parameters: {},
|
|
2147
|
+
query: {},
|
|
2148
|
+
value: ""
|
|
2149
|
+
},
|
|
2150
|
+
space: {
|
|
2151
|
+
parameters: {},
|
|
2152
|
+
query: {},
|
|
2153
|
+
value: ""
|
|
2154
|
+
},
|
|
2155
|
+
universe: {
|
|
2156
|
+
parameters: {},
|
|
2157
|
+
query: {},
|
|
2158
|
+
value: ""
|
|
2159
|
+
},
|
|
2160
|
+
cluster: {
|
|
2161
|
+
parameters: {},
|
|
2162
|
+
query: {},
|
|
2163
|
+
value: ""
|
|
2164
|
+
},
|
|
2165
|
+
plane: {
|
|
2166
|
+
parameters: {},
|
|
2167
|
+
fragments: {
|
|
2168
|
+
elements: [],
|
|
2169
|
+
texts: []
|
|
2170
|
+
},
|
|
2171
|
+
query: {},
|
|
2172
|
+
value: ""
|
|
2173
|
+
},
|
|
2063
2174
|
valid: true
|
|
2064
2175
|
},
|
|
2065
2176
|
height: 0,
|
|
@@ -2078,10 +2189,10 @@ const resolveViewItem = (planes, view, configuration) => {
|
|
|
2078
2189
|
return;
|
|
2079
2190
|
};
|
|
2080
2191
|
|
|
2081
|
-
const computeSpaceTree = (planes, view, configuration) => {
|
|
2192
|
+
const computeSpaceTree = (planes, view, configuration, origin = "origin") => {
|
|
2082
2193
|
const treePlanes = [];
|
|
2083
2194
|
for (const viewItem of view) {
|
|
2084
|
-
const treePlane = resolveViewItem(planes, viewItem, configuration);
|
|
2195
|
+
const treePlane = resolveViewItem(planes, viewItem, configuration, origin);
|
|
2085
2196
|
if (treePlane) {
|
|
2086
2197
|
treePlanes.push(treePlane);
|
|
2087
2198
|
}
|
|
@@ -2166,16 +2277,16 @@ const assignPagesFromView = (planes, view) => {
|
|
|
2166
2277
|
};
|
|
2167
2278
|
|
|
2168
2279
|
const updateTreePlane = (tree, updatedPage) => {
|
|
2169
|
-
const updatedTree = tree.map((
|
|
2170
|
-
if (
|
|
2280
|
+
const updatedTree = tree.map((treePlane => {
|
|
2281
|
+
if (treePlane.planeID === updatedPage.planeID) {
|
|
2171
2282
|
return updatedPage;
|
|
2172
2283
|
}
|
|
2173
|
-
if (
|
|
2174
|
-
const pageTree = updateTreePlane(
|
|
2175
|
-
|
|
2176
|
-
return
|
|
2284
|
+
if (treePlane.children) {
|
|
2285
|
+
const pageTree = updateTreePlane(treePlane.children, updatedPage);
|
|
2286
|
+
treePlane.children = pageTree;
|
|
2287
|
+
return treePlane;
|
|
2177
2288
|
}
|
|
2178
|
-
return
|
|
2289
|
+
return treePlane;
|
|
2179
2290
|
}));
|
|
2180
2291
|
return updatedTree;
|
|
2181
2292
|
};
|
|
@@ -2218,7 +2329,8 @@ const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree
|
|
|
2218
2329
|
const updatedTree = updateTreePlane(tree, updatedParentPlane);
|
|
2219
2330
|
return {
|
|
2220
2331
|
pluridPlaneID: updatedTreePlane.planeID,
|
|
2221
|
-
updatedTree: updatedTree
|
|
2332
|
+
updatedTree: updatedTree,
|
|
2333
|
+
updatedTreePlane: updatedTreePlane
|
|
2222
2334
|
};
|
|
2223
2335
|
};
|
|
2224
2336
|
|
|
@@ -2338,24 +2450,32 @@ const toggleChildren = children => {
|
|
|
2338
2450
|
|
|
2339
2451
|
const togglePlaneFromTree = (tree, pluridPlaneID) => {
|
|
2340
2452
|
const updatedTree = [];
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2453
|
+
let updatedPlane;
|
|
2454
|
+
for (const plane of tree) {
|
|
2455
|
+
if (plane.planeID === pluridPlaneID) {
|
|
2456
|
+
const treeUpdatedPlane = Object.assign(Object.assign({}, plane), {
|
|
2457
|
+
show: !plane.show,
|
|
2345
2458
|
children: []
|
|
2346
2459
|
});
|
|
2347
|
-
updatedTree.push(
|
|
2460
|
+
updatedTree.push(treeUpdatedPlane);
|
|
2461
|
+
updatedPlane = Object.assign({}, treeUpdatedPlane);
|
|
2348
2462
|
continue;
|
|
2349
2463
|
}
|
|
2350
|
-
if (
|
|
2351
|
-
const
|
|
2352
|
-
|
|
2353
|
-
updatedTree.push(
|
|
2464
|
+
if (plane.children) {
|
|
2465
|
+
const {updatedTree: childrenUpdatedTree, updatedPlane: childrenUpdatedPlane} = togglePlaneFromTree(plane.children, pluridPlaneID);
|
|
2466
|
+
plane.children = [ ...childrenUpdatedTree ];
|
|
2467
|
+
updatedTree.push(plane);
|
|
2468
|
+
if (childrenUpdatedPlane) {
|
|
2469
|
+
updatedPlane = Object.assign({}, childrenUpdatedPlane);
|
|
2470
|
+
}
|
|
2354
2471
|
continue;
|
|
2355
2472
|
}
|
|
2356
|
-
updatedTree.push(
|
|
2473
|
+
updatedTree.push(plane);
|
|
2357
2474
|
}
|
|
2358
|
-
return
|
|
2475
|
+
return {
|
|
2476
|
+
updatedTree: updatedTree,
|
|
2477
|
+
updatedPlane: updatedPlane
|
|
2478
|
+
};
|
|
2359
2479
|
};
|
|
2360
2480
|
|
|
2361
2481
|
var logic = Object.freeze({
|
|
@@ -2374,12 +2494,13 @@ var logic = Object.freeze({
|
|
|
2374
2494
|
});
|
|
2375
2495
|
|
|
2376
2496
|
class Tree {
|
|
2377
|
-
constructor(data) {
|
|
2497
|
+
constructor(data, origin = "origin") {
|
|
2378
2498
|
this.data = data;
|
|
2499
|
+
this.origin = origin;
|
|
2379
2500
|
}
|
|
2380
2501
|
compute() {
|
|
2381
2502
|
const {planes: planes, view: view, configuration: configuration} = this.data;
|
|
2382
|
-
return computeSpaceTree(planes, view, configuration);
|
|
2503
|
+
return computeSpaceTree(planes, view, configuration, this.origin);
|
|
2383
2504
|
}
|
|
2384
2505
|
}
|
|
2385
2506
|
|
|
@@ -2447,106 +2568,6 @@ var index$2 = Object.freeze({
|
|
|
2447
2568
|
view: index$3
|
|
2448
2569
|
});
|
|
2449
2570
|
|
|
2450
|
-
class PluridPlanesRegistrar {
|
|
2451
|
-
constructor() {
|
|
2452
|
-
this.planes = new Map;
|
|
2453
|
-
}
|
|
2454
|
-
register(planes) {
|
|
2455
|
-
for (const plane of planes) {
|
|
2456
|
-
const {component: component, route: route} = plane;
|
|
2457
|
-
const resolvedRoute = resolveRoute(route, "http", "localhost");
|
|
2458
|
-
const {protocol: protocol, host: host, path: routePath, space: space, universe: universe, cluster: cluster, plane: planePath, route: absoluteRoute} = resolvedRoute;
|
|
2459
|
-
const registeredPluridPlane = {
|
|
2460
|
-
component: component,
|
|
2461
|
-
route: {
|
|
2462
|
-
protocol: {},
|
|
2463
|
-
host: {},
|
|
2464
|
-
path: {},
|
|
2465
|
-
space: {},
|
|
2466
|
-
universe: {},
|
|
2467
|
-
cluster: {},
|
|
2468
|
-
plane: {},
|
|
2469
|
-
absolute: absoluteRoute
|
|
2470
|
-
}
|
|
2471
|
-
};
|
|
2472
|
-
this.planes.set(absoluteRoute, registeredPluridPlane);
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
identify() {
|
|
2476
|
-
if (this.planes.size === 0) {
|
|
2477
|
-
return [];
|
|
2478
|
-
}
|
|
2479
|
-
const ids = [];
|
|
2480
|
-
for (const [id, _] of this.planes) {
|
|
2481
|
-
ids.push(id);
|
|
2482
|
-
}
|
|
2483
|
-
return ids;
|
|
2484
|
-
}
|
|
2485
|
-
get(route) {
|
|
2486
|
-
return this.planes.get(route);
|
|
2487
|
-
}
|
|
2488
|
-
getAll() {
|
|
2489
|
-
return this.planes;
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
const registerPlanes = (planes, planesRegistrar) => {
|
|
2494
|
-
if (!planes) {
|
|
2495
|
-
return;
|
|
2496
|
-
}
|
|
2497
|
-
if (planesRegistrar) {
|
|
2498
|
-
planesRegistrar.register(planes);
|
|
2499
|
-
return;
|
|
2500
|
-
}
|
|
2501
|
-
if (typeof window === "undefined") {
|
|
2502
|
-
return;
|
|
2503
|
-
}
|
|
2504
|
-
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
2505
|
-
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
2506
|
-
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
2507
|
-
window.__pluridPlanesRegistrar__.register(planes);
|
|
2508
|
-
return;
|
|
2509
|
-
}
|
|
2510
|
-
window.__pluridPlanesRegistrar__.register(planes);
|
|
2511
|
-
return;
|
|
2512
|
-
};
|
|
2513
|
-
|
|
2514
|
-
const getPlanesRegistrar = planesRegistrar => {
|
|
2515
|
-
if (planesRegistrar) {
|
|
2516
|
-
return planesRegistrar;
|
|
2517
|
-
}
|
|
2518
|
-
if (typeof window !== "undefined") {
|
|
2519
|
-
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
2520
|
-
return window.__pluridPlanesRegistrar__;
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
return;
|
|
2524
|
-
};
|
|
2525
|
-
|
|
2526
|
-
const getRegisteredPlanes = planesRegistrar => {
|
|
2527
|
-
if (planesRegistrar) {
|
|
2528
|
-
return planesRegistrar.getAll();
|
|
2529
|
-
}
|
|
2530
|
-
if (typeof window !== "undefined") {
|
|
2531
|
-
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
2532
|
-
return window.__pluridPlanesRegistrar__.getAll();
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
return new Map;
|
|
2536
|
-
};
|
|
2537
|
-
|
|
2538
|
-
const getRegisteredPlane = (route, planesRegistrar) => {
|
|
2539
|
-
if (planesRegistrar) {
|
|
2540
|
-
return planesRegistrar.get(route);
|
|
2541
|
-
}
|
|
2542
|
-
if (typeof window !== "undefined") {
|
|
2543
|
-
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
2544
|
-
return window.__pluridPlanesRegistrar__.get(route);
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
return;
|
|
2548
|
-
};
|
|
2549
|
-
|
|
2550
2571
|
const resolveSpace = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState) => {
|
|
2551
2572
|
const registeredPlanes = getRegisteredPlanes(planesRegistrar);
|
|
2552
2573
|
const spaceTree = new Tree({
|
|
@@ -2688,5 +2709,19 @@ var index = Object.freeze({
|
|
|
2688
2709
|
local: index$1
|
|
2689
2710
|
});
|
|
2690
2711
|
|
|
2691
|
-
|
|
2712
|
+
const cleanTemplate = template => template.replace(/(?:\r\n|\r|\n)/g, " ").replace(/ +/g, " ").trim();
|
|
2713
|
+
|
|
2714
|
+
const pluridRouterNavigate = path => {
|
|
2715
|
+
if (!CustomEvent || !window) {
|
|
2716
|
+
return;
|
|
2717
|
+
}
|
|
2718
|
+
const event = new CustomEvent(PLURID_ROUTER_LOCATION_CHANGED, {
|
|
2719
|
+
detail: {
|
|
2720
|
+
path: path
|
|
2721
|
+
}
|
|
2722
|
+
});
|
|
2723
|
+
window.dispatchEvent(event);
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
export { cleanTemplate, index$h as general, index$a as interaction, internatiolate, index$8 as planes, pluridRouterNavigate, index$9 as routing, index$2 as space, index as state, index$j as utilities };
|
|
2692
2727
|
//# sourceMappingURL=index.es.js.map
|