@plurid/plurid-engine 0.0.0-1 → 0.0.0-10
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 +880 -845
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +863 -838
- package/distribution/index.js.map +1 -1
- package/distribution/modules/{setup/general → general}/configuration/index.d.ts +0 -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 +1 -1
- 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 +10 -1
- 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 +0 -0
- 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 +0 -0
- 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/{setup/space → space}/tree/logic.d.ts +12 -8
- package/distribution/modules/space/tree/object.d.ts +13 -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 +30 -31
- package/distribution/data/constants/index.d.ts +0 -1
- package/distribution/data/interfaces/index.d.ts +0 -4
- 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/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,37 +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
7
|
const specifiedOrDefault = (path, type, configuration) => {
|
|
36
8
|
const item = objects.getNested(configuration, path);
|
|
37
9
|
if (typeof item === type) {
|
|
@@ -85,6 +57,7 @@ const merge = (configuration, target) => {
|
|
|
85
57
|
conceal: specifiedOrDefault("elements.toolbar.conceal", "boolean", configuration),
|
|
86
58
|
transformIcons: specifiedOrDefault("elements.toolbar.transformIcons", "boolean", configuration),
|
|
87
59
|
transformButtons: specifiedOrDefault("elements.toolbar.transformButtons", "boolean", configuration),
|
|
60
|
+
drawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.drawers ? configuration.elements.toolbar.drawers : targetConfiguration.elements.toolbar.drawers,
|
|
88
61
|
toggledDrawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.toggledDrawers ? configuration.elements.toolbar.toggledDrawers : targetConfiguration.elements.toolbar.toggledDrawers
|
|
89
62
|
},
|
|
90
63
|
viewcube: {
|
|
@@ -112,6 +85,7 @@ const merge = (configuration, target) => {
|
|
|
112
85
|
camera: specifiedOrDefault("space.camera", "string", configuration),
|
|
113
86
|
perspective: specifiedOrDefault("space.perspective", "number", configuration),
|
|
114
87
|
opaque: specifiedOrDefault("space.opaque", "boolean", configuration),
|
|
88
|
+
fadeInTime: specifiedOrDefault("space.fadeInTime", "number", configuration),
|
|
115
89
|
center: specifiedOrDefault("space.center", "boolean", configuration),
|
|
116
90
|
transformOrigin: {
|
|
117
91
|
show: specifiedOrDefault("space.transformOrigin.show", "boolean", configuration),
|
|
@@ -142,94 +116,11 @@ const merge = (configuration, target) => {
|
|
|
142
116
|
return mergedConfiguration;
|
|
143
117
|
};
|
|
144
118
|
|
|
145
|
-
var index$
|
|
119
|
+
var index$k = Object.freeze({
|
|
146
120
|
__proto__: null,
|
|
147
121
|
merge: merge
|
|
148
122
|
});
|
|
149
123
|
|
|
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
124
|
const extractPathname = location => {
|
|
234
125
|
const queryIndex = location.indexOf("?");
|
|
235
126
|
const noQueryPath = queryIndex === -1 ? location : location.substring(0, queryIndex);
|
|
@@ -284,7 +175,7 @@ const computeComparingPath = (path, parameters) => {
|
|
|
284
175
|
comparingPathElements[index] = parameters[index];
|
|
285
176
|
}
|
|
286
177
|
}
|
|
287
|
-
const comparingPath =
|
|
178
|
+
const comparingPath = comparingPathElements.join("/");
|
|
288
179
|
return {
|
|
289
180
|
locationElements: locationElements,
|
|
290
181
|
comparingPath: comparingPath
|
|
@@ -400,54 +291,77 @@ const extractOccurence = occurence => {
|
|
|
400
291
|
return occurenceValue;
|
|
401
292
|
};
|
|
402
293
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.path = path;
|
|
407
|
-
this.options = this.handleOptions(options);
|
|
294
|
+
const stringInsertInitial = (value, insert) => {
|
|
295
|
+
if (!value.startsWith(insert)) {
|
|
296
|
+
value = insert + value;
|
|
408
297
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
298
|
+
return value;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const stringRemoveTrailing = (value, trail) => {
|
|
302
|
+
if (value.endsWith(trail)) {
|
|
303
|
+
value = value.slice(0, value.length - trail.length);
|
|
414
304
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
305
|
+
return value;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const PATH_SEPARATOR = "/";
|
|
309
|
+
|
|
310
|
+
const cleanupPath = value => {
|
|
311
|
+
value = stringInsertInitial(value, PATH_SEPARATOR);
|
|
312
|
+
value = stringRemoveTrailing(value, PATH_SEPARATOR);
|
|
313
|
+
return value;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const computePlaneAddress = (plane, route, origin = "origin") => {
|
|
317
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
318
|
+
origin = location.host;
|
|
418
319
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
320
|
+
const cleanPlane = extractPathname(plane);
|
|
321
|
+
const planeAddressType = checkPlaneAddressType(cleanPlane);
|
|
322
|
+
switch (planeAddressType) {
|
|
323
|
+
case "http":
|
|
324
|
+
case "https":
|
|
325
|
+
case "pttp":
|
|
326
|
+
return cleanPlane;
|
|
422
327
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
328
|
+
origin = stringRemoveTrailing(origin, "/");
|
|
329
|
+
const absolutePlane = isAbsolutePlane(plane);
|
|
330
|
+
const path = route && route !== "/" ? absolutePlane ? cleanupPath(cleanPlane) : cleanupPath(route) + cleanupPath(cleanPlane) : cleanupPath(cleanPlane);
|
|
331
|
+
const planeAddress = protocols.plurid + origin + path;
|
|
332
|
+
return planeAddress;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const isAbsolutePlane = value => value[0] === "/";
|
|
336
|
+
|
|
337
|
+
const checkPlaneAddressType = value => {
|
|
338
|
+
value = value.toLowerCase().trim();
|
|
339
|
+
if (value.startsWith(protocols.plurid)) {
|
|
340
|
+
return "pttp";
|
|
426
341
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
return fragments;
|
|
342
|
+
if (value.startsWith(protocols.https)) {
|
|
343
|
+
return HTTPS_PROTOCOL;
|
|
430
344
|
}
|
|
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;
|
|
345
|
+
if (value.startsWith(protocols.http)) {
|
|
346
|
+
return HTTP_PROTOCOL;
|
|
449
347
|
}
|
|
450
|
-
|
|
348
|
+
return "relative";
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const removeTrailingSlash = value => {
|
|
352
|
+
if (value.endsWith("/") && value.length > 1) {
|
|
353
|
+
return value.slice(0, value.length - 1);
|
|
354
|
+
}
|
|
355
|
+
return value;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const cleanPathValue = value => {
|
|
359
|
+
const queryStart = value.indexOf("?");
|
|
360
|
+
if (queryStart < 0) {
|
|
361
|
+
return removeTrailingSlash(value);
|
|
362
|
+
}
|
|
363
|
+
return removeTrailingSlash(value.substring(0, queryStart));
|
|
364
|
+
};
|
|
451
365
|
|
|
452
366
|
const checkParameterLength = (parameter, length, compareType) => {
|
|
453
367
|
const parameterLength = parameter.length;
|
|
@@ -472,9 +386,7 @@ const checkParameterLength = (parameter, length, compareType) => {
|
|
|
472
386
|
}
|
|
473
387
|
};
|
|
474
388
|
|
|
475
|
-
const checkValidPath
|
|
476
|
-
const {path: path, parameters: parameters} = data;
|
|
477
|
-
const {parameters: validationParameters} = path;
|
|
389
|
+
const checkValidPath = (validationParameters, parameters) => {
|
|
478
390
|
if (validationParameters) {
|
|
479
391
|
for (const [parameterKey, parameterData] of Object.entries(validationParameters)) {
|
|
480
392
|
const {length: length, lengthType: lengthType, startsWith: startsWith, endsWith: endsWith, includes: includes} = parameterData;
|
|
@@ -500,35 +412,6 @@ const checkValidPath$1 = data => {
|
|
|
500
412
|
return true;
|
|
501
413
|
};
|
|
502
414
|
|
|
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
415
|
const cleanPathElement = path => {
|
|
533
416
|
if (path[0] === "/") {
|
|
534
417
|
return path.slice(1);
|
|
@@ -536,7 +419,7 @@ const cleanPathElement = path => {
|
|
|
536
419
|
return path;
|
|
537
420
|
};
|
|
538
421
|
|
|
539
|
-
var index$
|
|
422
|
+
var index$j = Object.freeze({
|
|
540
423
|
__proto__: null,
|
|
541
424
|
cleanPathElement: cleanPathElement
|
|
542
425
|
});
|
|
@@ -794,402 +677,103 @@ const resolveRoute = (route, protocol, host) => {
|
|
|
794
677
|
route: absoluteRoute
|
|
795
678
|
};
|
|
796
679
|
}
|
|
797
|
-
|
|
798
|
-
const absoluteRoute = resolvers.join(separator);
|
|
680
|
+
[ protocolDivision, hostDivision.value, path.value, space.value, universe.value, cluster.value, cleanPathElement(plane.value) ];
|
|
799
681
|
return {
|
|
800
|
-
protocol:
|
|
801
|
-
host:
|
|
682
|
+
protocol: "",
|
|
683
|
+
host: "",
|
|
802
684
|
path: path,
|
|
803
|
-
space:
|
|
804
|
-
universe:
|
|
805
|
-
cluster:
|
|
806
|
-
plane:
|
|
807
|
-
route:
|
|
685
|
+
space: "",
|
|
686
|
+
universe: "",
|
|
687
|
+
cluster: "",
|
|
688
|
+
plane: "",
|
|
689
|
+
route: route
|
|
808
690
|
};
|
|
809
691
|
};
|
|
810
692
|
|
|
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;
|
|
693
|
+
const createTreePlane = (contextPlane, documentPlane) => {
|
|
694
|
+
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
695
|
+
const treePlane = Object.assign(Object.assign({}, defaultTreePlane), {
|
|
696
|
+
routeDivisions: routeDivisions,
|
|
697
|
+
sourceID: contextPlane.id,
|
|
698
|
+
planeID: uuid.generate(),
|
|
699
|
+
route: contextPlane.path,
|
|
700
|
+
show: true
|
|
701
|
+
});
|
|
702
|
+
return treePlane;
|
|
858
703
|
};
|
|
859
704
|
|
|
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
|
-
}
|
|
705
|
+
const updateTreePlane$1 = (tree, page) => {
|
|
706
|
+
const updatedTree = tree.map((treePlane => {
|
|
707
|
+
if (treePlane.planeID === page.planeID) {
|
|
708
|
+
return Object.assign({}, page);
|
|
917
709
|
}
|
|
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("");
|
|
710
|
+
if (treePlane.children) {
|
|
711
|
+
return Object.assign(Object.assign({}, treePlane), {
|
|
712
|
+
children: updateTreePlane$1(treePlane.children, page)
|
|
713
|
+
});
|
|
930
714
|
}
|
|
715
|
+
return treePlane;
|
|
931
716
|
}));
|
|
932
|
-
|
|
933
|
-
value: route.value,
|
|
934
|
-
parametersValues: parametersValues,
|
|
935
|
-
parameters: route.parameters
|
|
936
|
-
};
|
|
937
|
-
return processedRoute;
|
|
717
|
+
return updatedTree;
|
|
938
718
|
};
|
|
939
719
|
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
720
|
+
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
721
|
+
const updatedTree = tree.map((treePlane => {
|
|
722
|
+
if (treePlane.planeID === planeID) {
|
|
723
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
724
|
+
linkCoordinates: linkCoordinates
|
|
725
|
+
});
|
|
726
|
+
return updatedPlane;
|
|
945
727
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
728
|
+
if (treePlane.children) {
|
|
729
|
+
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
730
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
731
|
+
children: updatedChildren
|
|
732
|
+
});
|
|
733
|
+
return updatedPlane;
|
|
734
|
+
}
|
|
735
|
+
return treePlane;
|
|
736
|
+
}));
|
|
737
|
+
return updatedTree;
|
|
949
738
|
};
|
|
950
739
|
|
|
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
|
-
};
|
|
740
|
+
var index$i = Object.freeze({
|
|
741
|
+
__proto__: null,
|
|
742
|
+
createTreePlane: createTreePlane,
|
|
743
|
+
updateTreePlane: updateTreePlane$1,
|
|
744
|
+
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
745
|
+
});
|
|
968
746
|
|
|
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
|
-
};
|
|
747
|
+
var index$h = Object.freeze({
|
|
748
|
+
__proto__: null,
|
|
749
|
+
configuration: index$k,
|
|
750
|
+
tree: index$i
|
|
751
|
+
});
|
|
983
752
|
|
|
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;
|
|
753
|
+
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
754
|
+
let direction = "left";
|
|
755
|
+
const wheelDeltaX = deltas.deltaX;
|
|
756
|
+
const wheelDeltaY = deltas.deltaY;
|
|
757
|
+
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
758
|
+
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
759
|
+
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
760
|
+
direction = "left";
|
|
1054
761
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
for (const route of routes) {
|
|
1058
|
-
const processedRoute = processRoute(route);
|
|
1059
|
-
index[processedRoute.value] = Object.assign({}, processedRoute);
|
|
1060
|
-
}
|
|
1061
|
-
return index;
|
|
762
|
+
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
763
|
+
direction = "right";
|
|
1062
764
|
}
|
|
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 "";
|
|
765
|
+
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
766
|
+
direction = "up";
|
|
1167
767
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
if (universe.active) {
|
|
1171
|
-
activeUniverseID = universe.id;
|
|
1172
|
-
break;
|
|
1173
|
-
}
|
|
768
|
+
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
769
|
+
direction = "down";
|
|
1174
770
|
}
|
|
1175
|
-
return
|
|
771
|
+
return direction;
|
|
1176
772
|
};
|
|
1177
773
|
|
|
1178
|
-
var index$
|
|
1179
|
-
__proto__: null,
|
|
1180
|
-
createInternalStateUniverse: createInternalStateUniverse,
|
|
1181
|
-
createInternalContextUniverse: createInternalContextUniverse,
|
|
1182
|
-
findActiveUniverse: findActiveUniverse
|
|
1183
|
-
});
|
|
1184
|
-
|
|
1185
|
-
var index$b = Object.freeze({
|
|
774
|
+
var index$g = Object.freeze({
|
|
1186
775
|
__proto__: null,
|
|
1187
|
-
|
|
1188
|
-
universes: index$c,
|
|
1189
|
-
helpers: index$i,
|
|
1190
|
-
planes: index$g,
|
|
1191
|
-
paths: index$h,
|
|
1192
|
-
tree: index$d
|
|
776
|
+
getWheelDirection: getWheelDirection
|
|
1193
777
|
});
|
|
1194
778
|
|
|
1195
779
|
const degToRad = deg => deg * .01745329252;
|
|
@@ -1300,7 +884,7 @@ function makeRotationMatrixFromQuaternion(quaternion) {
|
|
|
1300
884
|
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
885
|
}
|
|
1302
886
|
|
|
1303
|
-
var index$
|
|
887
|
+
var index$f = Object.freeze({
|
|
1304
888
|
__proto__: null,
|
|
1305
889
|
degToRad: degToRad,
|
|
1306
890
|
radToDeg: radToDeg,
|
|
@@ -1324,7 +908,7 @@ function rotateMatrix(xAngle, yAngle, zAngle = 0) {
|
|
|
1324
908
|
return rotationMatrix;
|
|
1325
909
|
}
|
|
1326
910
|
|
|
1327
|
-
function translateMatrix(x, y, z) {
|
|
911
|
+
function translateMatrix$1(x, y, z) {
|
|
1328
912
|
return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ];
|
|
1329
913
|
}
|
|
1330
914
|
|
|
@@ -1332,7 +916,7 @@ function scaleMatrix(s) {
|
|
|
1332
916
|
return [ s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 ];
|
|
1333
917
|
}
|
|
1334
918
|
|
|
1335
|
-
function multiplyMatrices(matrixA, matrixB) {
|
|
919
|
+
function multiplyMatrices$1(matrixA, matrixB) {
|
|
1336
920
|
const result = [];
|
|
1337
921
|
const a00 = matrixA[0];
|
|
1338
922
|
const a01 = matrixA[1];
|
|
@@ -1388,7 +972,7 @@ function multiplyMatrices(matrixA, matrixB) {
|
|
|
1388
972
|
function multiplyArrayOfMatrices(matrices) {
|
|
1389
973
|
let inputMatrix = matrices[0];
|
|
1390
974
|
for (let i = 1; i < matrices.length; i++) {
|
|
1391
|
-
inputMatrix = multiplyMatrices(inputMatrix, matrices[i]);
|
|
975
|
+
inputMatrix = multiplyMatrices$1(inputMatrix, matrices[i]);
|
|
1392
976
|
}
|
|
1393
977
|
return inputMatrix;
|
|
1394
978
|
}
|
|
@@ -1397,16 +981,105 @@ function matrixArrayToCSSMatrix(array) {
|
|
|
1397
981
|
return "matrix3d(" + array.join(",") + ")";
|
|
1398
982
|
}
|
|
1399
983
|
|
|
1400
|
-
var index$
|
|
984
|
+
var index$e = Object.freeze({
|
|
1401
985
|
__proto__: null,
|
|
1402
986
|
rotateMatrix: rotateMatrix,
|
|
1403
|
-
translateMatrix: translateMatrix,
|
|
987
|
+
translateMatrix: translateMatrix$1,
|
|
1404
988
|
scaleMatrix: scaleMatrix,
|
|
1405
|
-
multiplyMatrices: multiplyMatrices,
|
|
989
|
+
multiplyMatrices: multiplyMatrices$1,
|
|
1406
990
|
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
1407
991
|
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
1408
992
|
});
|
|
1409
993
|
|
|
994
|
+
const multiplyMatrices = (m1, m2) => {
|
|
995
|
+
const result = [];
|
|
996
|
+
for (let i = 0; i < m1.length; i++) {
|
|
997
|
+
result[i] = [];
|
|
998
|
+
for (let j = 0; j < m2[0].length; j++) {
|
|
999
|
+
let sum = 0;
|
|
1000
|
+
for (let k = 0; k < m1[0].length; k++) {
|
|
1001
|
+
sum += m1[i][k] * m2[k][j];
|
|
1002
|
+
}
|
|
1003
|
+
result[i][j] = sum;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return result;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
const arrayToMatrix = array => {
|
|
1010
|
+
const matrix = [];
|
|
1011
|
+
for (let i = 0; i < array.length; i += 4) {
|
|
1012
|
+
const row = [];
|
|
1013
|
+
row.push(array[i]);
|
|
1014
|
+
row.push(array[i + 1]);
|
|
1015
|
+
row.push(array[i + 2]);
|
|
1016
|
+
row.push(array[i + 3]);
|
|
1017
|
+
matrix.push(row);
|
|
1018
|
+
}
|
|
1019
|
+
return matrix;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
const matrixToArray = matrix => matrix.flat();
|
|
1023
|
+
|
|
1024
|
+
const printMatrix = (matrix, name) => {
|
|
1025
|
+
const normalize = value => {
|
|
1026
|
+
if (value === 1 || value === 0) {
|
|
1027
|
+
return value + " ";
|
|
1028
|
+
}
|
|
1029
|
+
if (value > 0) {
|
|
1030
|
+
return value.toFixed(2) + " ";
|
|
1031
|
+
}
|
|
1032
|
+
return value.toFixed(2) + " ";
|
|
1033
|
+
};
|
|
1034
|
+
console.log("matrix", name + ":");
|
|
1035
|
+
for (const row of matrix) {
|
|
1036
|
+
console.log(normalize(row[0]), normalize(row[1]), normalize(row[2]), normalize(row[3]));
|
|
1037
|
+
}
|
|
1038
|
+
console.log(`matrix3d(${matrix.flat().join(",")})`);
|
|
1039
|
+
console.log();
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
const rotateXMatrix = angle => {
|
|
1043
|
+
const x = Math.cos(angle);
|
|
1044
|
+
const y = -1 * Math.sin(angle);
|
|
1045
|
+
const z = Math.sin(angle);
|
|
1046
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, x, y, 0 ], [ 0, z, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1047
|
+
return m;
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
const rotateYMatrix = angle => {
|
|
1051
|
+
const x = Math.cos(angle);
|
|
1052
|
+
const y = -1 * Math.sin(angle);
|
|
1053
|
+
const z = Math.sin(angle);
|
|
1054
|
+
const m = [ [ x, 0, z, 0 ], [ 0, 1, 0, 0 ], [ y, 0, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1055
|
+
return m;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
const rotateZMatrix = angle => {
|
|
1059
|
+
const x = Math.cos(angle);
|
|
1060
|
+
const y = -1 * Math.sin(angle);
|
|
1061
|
+
const z = Math.sin(angle);
|
|
1062
|
+
const m = [ [ x, y, 0, 0 ], [ z, x, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1063
|
+
return m;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
const translateMatrix = (x = 0, y = 0, z = 0) => {
|
|
1067
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ x, y, z, 1 ] ];
|
|
1068
|
+
return m;
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
var index$d = Object.freeze({
|
|
1072
|
+
__proto__: null,
|
|
1073
|
+
multiplyMatrices: multiplyMatrices,
|
|
1074
|
+
arrayToMatrix: arrayToMatrix,
|
|
1075
|
+
matrixToArray: matrixToArray,
|
|
1076
|
+
printMatrix: printMatrix,
|
|
1077
|
+
rotateXMatrix: rotateXMatrix,
|
|
1078
|
+
rotateYMatrix: rotateYMatrix,
|
|
1079
|
+
rotateZMatrix: rotateZMatrix,
|
|
1080
|
+
translateMatrix: translateMatrix
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1410
1083
|
function getMatrixValues(matrix3d) {
|
|
1411
1084
|
const matrixValues = matrix3d.split("(")[1].split(")")[0].split(",");
|
|
1412
1085
|
const matrixValuesInt = [];
|
|
@@ -1536,7 +1209,7 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1536
1209
|
const translateZ = transformTranslate.translateZ;
|
|
1537
1210
|
const scale = getTransformScale(matrix3d).scale;
|
|
1538
1211
|
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1539
|
-
const valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1212
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1540
1213
|
const valScalationMatrix = scaleMatrix(scale);
|
|
1541
1214
|
if (direction === "left") {
|
|
1542
1215
|
rotateY -= angleIncrement;
|
|
@@ -1554,88 +1227,567 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1554
1227
|
rotateY += angleIncrement;
|
|
1555
1228
|
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
1556
1229
|
}
|
|
1557
|
-
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1558
|
-
return transformedMatrix3d;
|
|
1559
|
-
}
|
|
1230
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1231
|
+
return transformedMatrix3d;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
function translatePlurid(matrix3d, direction = "", linearIncrement = 50) {
|
|
1235
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1236
|
+
const rotateX = transformRotate.rotateX;
|
|
1237
|
+
const rotateY = transformRotate.rotateY;
|
|
1238
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1239
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1240
|
+
let translateX = transformTranslate.translateX;
|
|
1241
|
+
let translateY = transformTranslate.translateY;
|
|
1242
|
+
const translateZ = transformTranslate.translateZ;
|
|
1243
|
+
const scale = getTransformScale(matrix3d).scale;
|
|
1244
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1245
|
+
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1246
|
+
const valScalationMatrix = scaleMatrix(scale);
|
|
1247
|
+
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1248
|
+
if (direction === "left") {
|
|
1249
|
+
translateX += linearIncrement;
|
|
1250
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1251
|
+
}
|
|
1252
|
+
if (direction === "right") {
|
|
1253
|
+
translateX -= linearIncrement;
|
|
1254
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1255
|
+
}
|
|
1256
|
+
if (direction === "up") {
|
|
1257
|
+
translateY += linearIncrement;
|
|
1258
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1259
|
+
}
|
|
1260
|
+
if (direction === "down") {
|
|
1261
|
+
translateY -= linearIncrement;
|
|
1262
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1263
|
+
}
|
|
1264
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1265
|
+
return transformedMatrix3d;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
function scalePlurid(matrix3d, direction = "", scaleIncrement = .05) {
|
|
1269
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1270
|
+
const rotateX = transformRotate.rotateX;
|
|
1271
|
+
const rotateY = transformRotate.rotateY;
|
|
1272
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1273
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1274
|
+
const translateX = transformTranslate.translateX;
|
|
1275
|
+
const translateY = transformTranslate.translateY;
|
|
1276
|
+
const translateZ = transformTranslate.translateZ;
|
|
1277
|
+
let scale = getTransformScale(matrix3d).scale;
|
|
1278
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1279
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1280
|
+
let valScalationMatrix = scaleMatrix(scale);
|
|
1281
|
+
if (direction === "up") {
|
|
1282
|
+
scale -= scaleIncrement;
|
|
1283
|
+
if (scale < .1) {
|
|
1284
|
+
scale = .1;
|
|
1285
|
+
}
|
|
1286
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1287
|
+
}
|
|
1288
|
+
if (direction === "down") {
|
|
1289
|
+
scale += scaleIncrement;
|
|
1290
|
+
if (scale > 4) {
|
|
1291
|
+
scale = 4;
|
|
1292
|
+
}
|
|
1293
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1294
|
+
}
|
|
1295
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1296
|
+
return transformedMatrix3d;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
var index$c = Object.freeze({
|
|
1300
|
+
__proto__: null,
|
|
1301
|
+
getMatrixValues: getMatrixValues,
|
|
1302
|
+
getRotationMatrix: getRotationMatrix,
|
|
1303
|
+
getTranslationMatrix: getTranslationMatrix,
|
|
1304
|
+
getScalationValue: getScalationValue,
|
|
1305
|
+
setTransform: setTransform,
|
|
1306
|
+
getTransformRotate: getTransformRotate,
|
|
1307
|
+
getTransformTranslate: getTransformTranslate,
|
|
1308
|
+
getTransformScale: getTransformScale,
|
|
1309
|
+
rotatePlurid: rotatePlurid,
|
|
1310
|
+
translatePlurid: translatePlurid,
|
|
1311
|
+
scalePlurid: scalePlurid
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
var index$b = Object.freeze({
|
|
1315
|
+
__proto__: null,
|
|
1316
|
+
general: index$d,
|
|
1317
|
+
matrix3d: index$c
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
var index$a = Object.freeze({
|
|
1321
|
+
__proto__: null,
|
|
1322
|
+
direction: index$g,
|
|
1323
|
+
matrix: index$e,
|
|
1324
|
+
quaternion: index$f,
|
|
1325
|
+
transform: index$b
|
|
1326
|
+
});
|
|
1327
|
+
|
|
1328
|
+
const internatiolate = (lamguage, field) => internationalization[lamguage][field];
|
|
1329
|
+
|
|
1330
|
+
const resolvePluridPlaneData = plane => {
|
|
1331
|
+
if (Array.isArray(plane)) {
|
|
1332
|
+
const [route, component, options] = plane;
|
|
1333
|
+
return Object.assign({
|
|
1334
|
+
route: route,
|
|
1335
|
+
component: component
|
|
1336
|
+
}, options);
|
|
1337
|
+
}
|
|
1338
|
+
return plane;
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
const resolvePluridRoutePlaneData = plane => {
|
|
1342
|
+
if (Array.isArray(plane)) {
|
|
1343
|
+
const [value, component, options] = plane;
|
|
1344
|
+
return Object.assign({
|
|
1345
|
+
value: value,
|
|
1346
|
+
component: component
|
|
1347
|
+
}, options);
|
|
1348
|
+
}
|
|
1349
|
+
return plane;
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
const createInternalStatePlane = plane => {
|
|
1353
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1354
|
+
const statePlane = {
|
|
1355
|
+
id: uuid.generate(),
|
|
1356
|
+
path: planeData.route
|
|
1357
|
+
};
|
|
1358
|
+
return statePlane;
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
const createInternalContextPlane = plane => {
|
|
1362
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1363
|
+
const {route: route, component: component} = planeData;
|
|
1364
|
+
const contextPlane = {
|
|
1365
|
+
id: uuid.generate(),
|
|
1366
|
+
path: route,
|
|
1367
|
+
component: component
|
|
1368
|
+
};
|
|
1369
|
+
return contextPlane;
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
const getPluridPlaneIDByData = element => {
|
|
1373
|
+
if (!element) {
|
|
1374
|
+
return "";
|
|
1375
|
+
}
|
|
1376
|
+
const parent = element.parentElement;
|
|
1377
|
+
if (parent && parent.dataset.pluridPlane) {
|
|
1378
|
+
return parent.dataset.pluridPlane;
|
|
1379
|
+
}
|
|
1380
|
+
return getPluridPlaneIDByData(parent);
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
class IsoMatcher {
|
|
1384
|
+
constructor(data, origin = "origin") {
|
|
1385
|
+
this.routesIndex = new Map;
|
|
1386
|
+
this.planesIndex = new Map;
|
|
1387
|
+
this.routesKeys = [];
|
|
1388
|
+
this.planesKeys = [];
|
|
1389
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
1390
|
+
this.origin = location.host;
|
|
1391
|
+
} else {
|
|
1392
|
+
this.origin = origin;
|
|
1393
|
+
}
|
|
1394
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1395
|
+
}
|
|
1396
|
+
match(path, context = "plane") {
|
|
1397
|
+
switch (context) {
|
|
1398
|
+
case "plane":
|
|
1399
|
+
return this.matchPlane(path);
|
|
1400
|
+
|
|
1401
|
+
case "route":
|
|
1402
|
+
return this.matchRoute(path);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
index(data) {
|
|
1406
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1407
|
+
}
|
|
1408
|
+
clear() {
|
|
1409
|
+
this.routesIndex = new Map;
|
|
1410
|
+
this.planesIndex = new Map;
|
|
1411
|
+
this.routesKeys = [];
|
|
1412
|
+
this.planesKeys = [];
|
|
1413
|
+
}
|
|
1414
|
+
getPlanesIndex() {
|
|
1415
|
+
return this.planesIndex;
|
|
1416
|
+
}
|
|
1417
|
+
updateIndexes(routes, routePlanes, planes) {
|
|
1418
|
+
this.indexPlanes(planes, "Plane");
|
|
1419
|
+
this.indexPlanes(routePlanes, "RoutePlane");
|
|
1420
|
+
for (const route of routes) {
|
|
1421
|
+
if (route.planes) {
|
|
1422
|
+
this.indexPlanes(route.planes, "RoutePlane", route.value);
|
|
1423
|
+
}
|
|
1424
|
+
this.routesIndex.set(route.value, {
|
|
1425
|
+
data: Object.assign({}, route)
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
this.routesKeys = Array.from(this.routesIndex.keys());
|
|
1429
|
+
this.planesKeys = Array.from(this.planesIndex.keys());
|
|
1430
|
+
}
|
|
1431
|
+
indexPlanes(planes, kind, parent) {
|
|
1432
|
+
for (const plane of planes) {
|
|
1433
|
+
const planeData = kind === "Plane" ? resolvePluridPlaneData(plane) : resolvePluridRoutePlaneData(plane);
|
|
1434
|
+
const address = computePlaneAddress(kind === "Plane" ? planeData.route : planeData.value, parent, this.origin);
|
|
1435
|
+
const indexedPlane = {
|
|
1436
|
+
kind: kind,
|
|
1437
|
+
data: Object.assign({}, planeData)
|
|
1438
|
+
};
|
|
1439
|
+
if (parent) {
|
|
1440
|
+
indexedPlane["parent"] = parent;
|
|
1441
|
+
}
|
|
1442
|
+
this.planesIndex.set(address, indexedPlane);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
matchPlane(value) {
|
|
1446
|
+
const planeAddress = computePlaneAddress(value, undefined, this.origin);
|
|
1447
|
+
const plane = this.planesIndex.get(planeAddress);
|
|
1448
|
+
if (plane) {
|
|
1449
|
+
const query = extractQuery(value);
|
|
1450
|
+
const fragments = extractFragments(value);
|
|
1451
|
+
const match = {
|
|
1452
|
+
value: planeAddress,
|
|
1453
|
+
fragments: fragments,
|
|
1454
|
+
query: query,
|
|
1455
|
+
parameters: {}
|
|
1456
|
+
};
|
|
1457
|
+
if (plane.kind === "Plane") {
|
|
1458
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1459
|
+
const result = {
|
|
1460
|
+
kind: kind,
|
|
1461
|
+
data: data,
|
|
1462
|
+
parent: parent,
|
|
1463
|
+
match: match
|
|
1464
|
+
};
|
|
1465
|
+
return result;
|
|
1466
|
+
}
|
|
1467
|
+
if (plane.kind === "RoutePlane") {
|
|
1468
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1469
|
+
const result = {
|
|
1470
|
+
kind: kind,
|
|
1471
|
+
data: data,
|
|
1472
|
+
parent: parent,
|
|
1473
|
+
match: match
|
|
1474
|
+
};
|
|
1475
|
+
return result;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
for (const planePath of this.planesKeys) {
|
|
1479
|
+
const normalizedPlanePath = planePath.replace(protocols.plurid, "");
|
|
1480
|
+
const normalizedPlaneAddress = planeAddress.replace(protocols.plurid, "");
|
|
1481
|
+
const planePathSplit = normalizedPlanePath.split("/");
|
|
1482
|
+
const planeAddressSplit = normalizedPlaneAddress.split("/");
|
|
1483
|
+
if (planePathSplit[0] !== planeAddressSplit[0]) {
|
|
1484
|
+
continue;
|
|
1485
|
+
}
|
|
1486
|
+
if (planePathSplit.length !== planeAddressSplit.length) {
|
|
1487
|
+
continue;
|
|
1488
|
+
}
|
|
1489
|
+
const parametersAndMatch = extractParametersAndMatch(normalizedPlaneAddress, normalizedPlanePath);
|
|
1490
|
+
if (parametersAndMatch.match) {
|
|
1491
|
+
const plane = this.planesIndex.get(planePath);
|
|
1492
|
+
if (!plane) {
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1496
|
+
const validPath = checkValidPath(plane.data.parameters, parameters);
|
|
1497
|
+
if (!validPath) {
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
const query = extractQuery(value);
|
|
1501
|
+
const fragments = extractFragments(value);
|
|
1502
|
+
const match = {
|
|
1503
|
+
value: planeAddress,
|
|
1504
|
+
fragments: fragments,
|
|
1505
|
+
query: query,
|
|
1506
|
+
parameters: parameters
|
|
1507
|
+
};
|
|
1508
|
+
if (plane.kind === "Plane") {
|
|
1509
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1510
|
+
const result = {
|
|
1511
|
+
kind: kind,
|
|
1512
|
+
data: data,
|
|
1513
|
+
parent: parent,
|
|
1514
|
+
match: match
|
|
1515
|
+
};
|
|
1516
|
+
return result;
|
|
1517
|
+
}
|
|
1518
|
+
if (plane.kind === "RoutePlane") {
|
|
1519
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1520
|
+
const result = {
|
|
1521
|
+
kind: kind,
|
|
1522
|
+
data: data,
|
|
1523
|
+
parent: parent,
|
|
1524
|
+
match: match
|
|
1525
|
+
};
|
|
1526
|
+
return result;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
return;
|
|
1531
|
+
}
|
|
1532
|
+
matchRoute(value) {
|
|
1533
|
+
const routeValue = cleanPathValue(value);
|
|
1534
|
+
const route = this.routesIndex.get(routeValue);
|
|
1535
|
+
if (route) {
|
|
1536
|
+
const query = extractQuery(value);
|
|
1537
|
+
const result = {
|
|
1538
|
+
kind: "Route",
|
|
1539
|
+
data: route.data,
|
|
1540
|
+
match: {
|
|
1541
|
+
value: routeValue,
|
|
1542
|
+
query: query,
|
|
1543
|
+
parameters: {}
|
|
1544
|
+
}
|
|
1545
|
+
};
|
|
1546
|
+
return result;
|
|
1547
|
+
}
|
|
1548
|
+
for (const routePath of this.routesKeys) {
|
|
1549
|
+
const routeSplit = routePath.split("/");
|
|
1550
|
+
const valueSplit = routeValue.split("/");
|
|
1551
|
+
if (routeSplit.length !== valueSplit.length) {
|
|
1552
|
+
continue;
|
|
1553
|
+
}
|
|
1554
|
+
const parametersAndMatch = extractParametersAndMatch(routeValue.slice(1), routePath.slice(1));
|
|
1555
|
+
if (parametersAndMatch.match) {
|
|
1556
|
+
const route = this.routesIndex.get(routePath);
|
|
1557
|
+
if (!route) {
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1561
|
+
const validPath = checkValidPath(route.data.parameters, parameters);
|
|
1562
|
+
if (!validPath) {
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
const query = extractQuery(routeValue);
|
|
1566
|
+
const match = {
|
|
1567
|
+
value: routeValue,
|
|
1568
|
+
query: query,
|
|
1569
|
+
parameters: parameters
|
|
1570
|
+
};
|
|
1571
|
+
if (route) {
|
|
1572
|
+
const result = {
|
|
1573
|
+
kind: "Route",
|
|
1574
|
+
data: route.data,
|
|
1575
|
+
match: match
|
|
1576
|
+
};
|
|
1577
|
+
return result;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
const routePlane = this.matchPlane(routeValue);
|
|
1582
|
+
if (routePlane) {
|
|
1583
|
+
const result = {
|
|
1584
|
+
kind: "RoutePlane",
|
|
1585
|
+
data: routePlane.data,
|
|
1586
|
+
match: {
|
|
1587
|
+
value: routeValue,
|
|
1588
|
+
query: routePlane.match.query,
|
|
1589
|
+
parameters: routePlane.match.parameters
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
return result;
|
|
1593
|
+
}
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
class Parser {
|
|
1599
|
+
constructor(location, path, options) {
|
|
1600
|
+
this.location = location;
|
|
1601
|
+
this.path = path;
|
|
1602
|
+
this.options = this.handleOptions(options);
|
|
1603
|
+
}
|
|
1604
|
+
handleOptions(options) {
|
|
1605
|
+
const parserOptions = {
|
|
1606
|
+
fragment: (options === null || options === void 0 ? void 0 : options.fragment) || true
|
|
1607
|
+
};
|
|
1608
|
+
return parserOptions;
|
|
1609
|
+
}
|
|
1610
|
+
extractPathname() {
|
|
1611
|
+
const pathname = extractPathname(this.location);
|
|
1612
|
+
return pathname;
|
|
1613
|
+
}
|
|
1614
|
+
extractParametersAndMatch() {
|
|
1615
|
+
const parametersAndMatch = extractParametersAndMatch(this.location, this.path.value);
|
|
1616
|
+
return parametersAndMatch;
|
|
1617
|
+
}
|
|
1618
|
+
extractQuery() {
|
|
1619
|
+
const query = extractQuery(this.location);
|
|
1620
|
+
return query;
|
|
1621
|
+
}
|
|
1622
|
+
extractFragments() {
|
|
1623
|
+
const fragments = this.options.fragment ? extractFragments(this.location) : extractFragments();
|
|
1624
|
+
return fragments;
|
|
1625
|
+
}
|
|
1626
|
+
extract() {
|
|
1627
|
+
const pathname = this.extractPathname();
|
|
1628
|
+
const {match: match, parameters: parameters, elements: elements} = this.extractParametersAndMatch();
|
|
1629
|
+
const query = this.extractQuery();
|
|
1630
|
+
const queryData = Object.entries(query).map((([key, value]) => key + "=" + value)).join("&");
|
|
1631
|
+
const queryString = queryData ? "?" + queryData : "";
|
|
1632
|
+
const fragments = this.extractFragments();
|
|
1633
|
+
const parserResponse = {
|
|
1634
|
+
path: this.path,
|
|
1635
|
+
pathname: pathname,
|
|
1636
|
+
elements: elements,
|
|
1637
|
+
match: match,
|
|
1638
|
+
parameters: parameters,
|
|
1639
|
+
query: query,
|
|
1640
|
+
fragments: fragments,
|
|
1641
|
+
route: pathname + queryString
|
|
1642
|
+
};
|
|
1643
|
+
return parserResponse;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
var index$9 = Object.freeze({
|
|
1648
|
+
__proto__: null,
|
|
1649
|
+
IsoMatcher: IsoMatcher,
|
|
1650
|
+
RouteParser: Parser,
|
|
1651
|
+
extractQuery: extractQuery,
|
|
1652
|
+
stringInsertInitial: stringInsertInitial,
|
|
1653
|
+
stringRemoveTrailing: stringRemoveTrailing,
|
|
1654
|
+
cleanupPath: cleanupPath,
|
|
1655
|
+
computePlaneAddress: computePlaneAddress,
|
|
1656
|
+
isAbsolutePlane: isAbsolutePlane,
|
|
1657
|
+
checkPlaneAddressType: checkPlaneAddressType,
|
|
1658
|
+
removeTrailingSlash: removeTrailingSlash,
|
|
1659
|
+
cleanPathValue: cleanPathValue,
|
|
1660
|
+
checkParameterLength: checkParameterLength,
|
|
1661
|
+
checkValidPath: checkValidPath,
|
|
1662
|
+
mapPathsToRoutes: mapPathsToRoutes,
|
|
1663
|
+
pluridLinkPathDivider: pluridLinkPathDivider,
|
|
1664
|
+
resolveRoute: resolveRoute
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
class PluridPlanesRegistrar {
|
|
1668
|
+
constructor(planes) {
|
|
1669
|
+
this.isoMatcher = new IsoMatcher({
|
|
1670
|
+
planes: planes
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
register(planes) {
|
|
1674
|
+
this.isoMatcher.index({
|
|
1675
|
+
planes: planes
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
identify() {
|
|
1679
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1680
|
+
return [ ...planes.keys() ];
|
|
1681
|
+
}
|
|
1682
|
+
get(route) {
|
|
1683
|
+
const match = this.isoMatcher.match(route);
|
|
1684
|
+
if (match) {
|
|
1685
|
+
const absoluteRoute = match.kind === "Plane" ? match.data.route : match.data.value;
|
|
1686
|
+
const registeredPlane = {
|
|
1687
|
+
route: {
|
|
1688
|
+
absolute: absoluteRoute,
|
|
1689
|
+
fragments: match.match.fragments,
|
|
1690
|
+
parameters: match.match.parameters,
|
|
1691
|
+
query: match.match.query
|
|
1692
|
+
},
|
|
1693
|
+
component: match.data.component
|
|
1694
|
+
};
|
|
1695
|
+
return registeredPlane;
|
|
1696
|
+
}
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
getAll() {
|
|
1700
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1701
|
+
const all = new Map;
|
|
1702
|
+
for (const [path, plane] of planes) {
|
|
1703
|
+
const absoluteRoute = plane.kind === "Plane" ? plane.data.route : plane.data.value;
|
|
1704
|
+
const registeredPlane = {
|
|
1705
|
+
route: {
|
|
1706
|
+
absolute: absoluteRoute,
|
|
1707
|
+
fragments: {
|
|
1708
|
+
elements: [],
|
|
1709
|
+
texts: []
|
|
1710
|
+
},
|
|
1711
|
+
parameters: {},
|
|
1712
|
+
query: {}
|
|
1713
|
+
},
|
|
1714
|
+
component: plane.data.component
|
|
1715
|
+
};
|
|
1716
|
+
all.set(path, registeredPlane);
|
|
1717
|
+
}
|
|
1718
|
+
return all;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
const registerPlanes = (planes, planesRegistrar) => {
|
|
1723
|
+
if (!planes) {
|
|
1724
|
+
return;
|
|
1725
|
+
}
|
|
1726
|
+
if (planesRegistrar) {
|
|
1727
|
+
planesRegistrar.register(planes);
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
if (typeof window === "undefined") {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
1734
|
+
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
1735
|
+
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
1736
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1740
|
+
return;
|
|
1741
|
+
};
|
|
1560
1742
|
|
|
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);
|
|
1743
|
+
const getPlanesRegistrar = planesRegistrar => {
|
|
1744
|
+
if (planesRegistrar) {
|
|
1745
|
+
return planesRegistrar;
|
|
1578
1746
|
}
|
|
1579
|
-
if (
|
|
1580
|
-
|
|
1581
|
-
|
|
1747
|
+
if (typeof window !== "undefined") {
|
|
1748
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1749
|
+
return window.__pluridPlanesRegistrar__;
|
|
1750
|
+
}
|
|
1582
1751
|
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1752
|
+
return;
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
const getRegisteredPlanes = planesRegistrar => {
|
|
1756
|
+
if (planesRegistrar) {
|
|
1757
|
+
return planesRegistrar.getAll();
|
|
1586
1758
|
}
|
|
1587
|
-
if (
|
|
1588
|
-
|
|
1589
|
-
|
|
1759
|
+
if (typeof window !== "undefined") {
|
|
1760
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1761
|
+
return window.__pluridPlanesRegistrar__.getAll();
|
|
1762
|
+
}
|
|
1590
1763
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1764
|
+
return new Map;
|
|
1765
|
+
};
|
|
1594
1766
|
|
|
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);
|
|
1767
|
+
const getRegisteredPlane = (route, planesRegistrar) => {
|
|
1768
|
+
if (planesRegistrar) {
|
|
1769
|
+
return planesRegistrar.get(route);
|
|
1614
1770
|
}
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
scale = 4;
|
|
1771
|
+
if (typeof window !== "undefined") {
|
|
1772
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1773
|
+
return window.__pluridPlanesRegistrar__.get(route);
|
|
1619
1774
|
}
|
|
1620
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1621
1775
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
}
|
|
1776
|
+
return;
|
|
1777
|
+
};
|
|
1625
1778
|
|
|
1626
1779
|
var index$8 = Object.freeze({
|
|
1627
1780
|
__proto__: null,
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
scalePlurid: scalePlurid
|
|
1781
|
+
resolvePluridPlaneData: resolvePluridPlaneData,
|
|
1782
|
+
resolvePluridRoutePlaneData: resolvePluridRoutePlaneData,
|
|
1783
|
+
createInternalStatePlane: createInternalStatePlane,
|
|
1784
|
+
createInternalContextPlane: createInternalContextPlane,
|
|
1785
|
+
getPluridPlaneIDByData: getPluridPlaneIDByData,
|
|
1786
|
+
registerPlanes: registerPlanes,
|
|
1787
|
+
getPlanesRegistrar: getPlanesRegistrar,
|
|
1788
|
+
getRegisteredPlanes: getRegisteredPlanes,
|
|
1789
|
+
getRegisteredPlane: getRegisteredPlane,
|
|
1790
|
+
Registrar: PluridPlanesRegistrar
|
|
1639
1791
|
});
|
|
1640
1792
|
|
|
1641
1793
|
const computeSpaceSize = tree => {
|
|
@@ -1959,93 +2111,29 @@ var index$5 = Object.freeze({
|
|
|
1959
2111
|
computeZigZagLayout: computeZigZagLayout
|
|
1960
2112
|
});
|
|
1961
2113
|
|
|
1962
|
-
const matchRouteElements = (routePath, viewPath) => {
|
|
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
2114
|
const resolveViewItem = (planes, view, configuration) => {
|
|
2037
2115
|
const {protocol: protocol, host: host} = configuration.network;
|
|
2038
2116
|
const viewData = typeof view === "string" ? view : view.plane;
|
|
2039
|
-
const
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2117
|
+
const viewAddress = computePlaneAddress(viewData);
|
|
2118
|
+
const iPlanes = planes.values();
|
|
2119
|
+
const pluridPlanes = [];
|
|
2120
|
+
for (const iPlane of iPlanes) {
|
|
2121
|
+
const plane = {
|
|
2122
|
+
route: iPlane.route.absolute,
|
|
2123
|
+
component: iPlane.component
|
|
2124
|
+
};
|
|
2125
|
+
pluridPlanes.push(plane);
|
|
2126
|
+
}
|
|
2127
|
+
const isoMatcher = new IsoMatcher({
|
|
2128
|
+
planes: pluridPlanes
|
|
2129
|
+
});
|
|
2130
|
+
const match = isoMatcher.match(viewData);
|
|
2131
|
+
if (match) {
|
|
2132
|
+
const route = match.match.value;
|
|
2045
2133
|
const treePlane = {
|
|
2046
2134
|
sourceID: route,
|
|
2047
2135
|
planeID: uuid.generate(),
|
|
2048
|
-
route:
|
|
2136
|
+
route: viewAddress,
|
|
2049
2137
|
routeDivisions: {
|
|
2050
2138
|
protocol: {
|
|
2051
2139
|
value: "",
|
|
@@ -2055,11 +2143,35 @@ const resolveViewItem = (planes, view, configuration) => {
|
|
|
2055
2143
|
value: host,
|
|
2056
2144
|
controlled: true
|
|
2057
2145
|
},
|
|
2058
|
-
path:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2146
|
+
path: {
|
|
2147
|
+
parameters: {},
|
|
2148
|
+
query: {},
|
|
2149
|
+
value: ""
|
|
2150
|
+
},
|
|
2151
|
+
space: {
|
|
2152
|
+
parameters: {},
|
|
2153
|
+
query: {},
|
|
2154
|
+
value: ""
|
|
2155
|
+
},
|
|
2156
|
+
universe: {
|
|
2157
|
+
parameters: {},
|
|
2158
|
+
query: {},
|
|
2159
|
+
value: ""
|
|
2160
|
+
},
|
|
2161
|
+
cluster: {
|
|
2162
|
+
parameters: {},
|
|
2163
|
+
query: {},
|
|
2164
|
+
value: ""
|
|
2165
|
+
},
|
|
2166
|
+
plane: {
|
|
2167
|
+
parameters: {},
|
|
2168
|
+
fragments: {
|
|
2169
|
+
elements: [],
|
|
2170
|
+
texts: []
|
|
2171
|
+
},
|
|
2172
|
+
query: {},
|
|
2173
|
+
value: ""
|
|
2174
|
+
},
|
|
2063
2175
|
valid: true
|
|
2064
2176
|
},
|
|
2065
2177
|
height: 0,
|
|
@@ -2166,16 +2278,16 @@ const assignPagesFromView = (planes, view) => {
|
|
|
2166
2278
|
};
|
|
2167
2279
|
|
|
2168
2280
|
const updateTreePlane = (tree, updatedPage) => {
|
|
2169
|
-
const updatedTree = tree.map((
|
|
2170
|
-
if (
|
|
2281
|
+
const updatedTree = tree.map((treePlane => {
|
|
2282
|
+
if (treePlane.planeID === updatedPage.planeID) {
|
|
2171
2283
|
return updatedPage;
|
|
2172
2284
|
}
|
|
2173
|
-
if (
|
|
2174
|
-
const pageTree = updateTreePlane(
|
|
2175
|
-
|
|
2176
|
-
return
|
|
2285
|
+
if (treePlane.children) {
|
|
2286
|
+
const pageTree = updateTreePlane(treePlane.children, updatedPage);
|
|
2287
|
+
treePlane.children = pageTree;
|
|
2288
|
+
return treePlane;
|
|
2177
2289
|
}
|
|
2178
|
-
return
|
|
2290
|
+
return treePlane;
|
|
2179
2291
|
}));
|
|
2180
2292
|
return updatedTree;
|
|
2181
2293
|
};
|
|
@@ -2218,7 +2330,8 @@ const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree
|
|
|
2218
2330
|
const updatedTree = updateTreePlane(tree, updatedParentPlane);
|
|
2219
2331
|
return {
|
|
2220
2332
|
pluridPlaneID: updatedTreePlane.planeID,
|
|
2221
|
-
updatedTree: updatedTree
|
|
2333
|
+
updatedTree: updatedTree,
|
|
2334
|
+
updatedTreePlane: updatedTreePlane
|
|
2222
2335
|
};
|
|
2223
2336
|
};
|
|
2224
2337
|
|
|
@@ -2338,24 +2451,32 @@ const toggleChildren = children => {
|
|
|
2338
2451
|
|
|
2339
2452
|
const togglePlaneFromTree = (tree, pluridPlaneID) => {
|
|
2340
2453
|
const updatedTree = [];
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2454
|
+
let updatedPlane;
|
|
2455
|
+
for (const plane of tree) {
|
|
2456
|
+
if (plane.planeID === pluridPlaneID) {
|
|
2457
|
+
const treeUpdatedPlane = Object.assign(Object.assign({}, plane), {
|
|
2458
|
+
show: !plane.show,
|
|
2345
2459
|
children: []
|
|
2346
2460
|
});
|
|
2347
|
-
updatedTree.push(
|
|
2461
|
+
updatedTree.push(treeUpdatedPlane);
|
|
2462
|
+
updatedPlane = Object.assign({}, treeUpdatedPlane);
|
|
2348
2463
|
continue;
|
|
2349
2464
|
}
|
|
2350
|
-
if (
|
|
2351
|
-
const
|
|
2352
|
-
|
|
2353
|
-
updatedTree.push(
|
|
2465
|
+
if (plane.children) {
|
|
2466
|
+
const {updatedTree: childrenUpdatedTree, updatedPlane: childrenUpdatedPlane} = togglePlaneFromTree(plane.children, pluridPlaneID);
|
|
2467
|
+
plane.children = [ ...childrenUpdatedTree ];
|
|
2468
|
+
updatedTree.push(plane);
|
|
2469
|
+
if (childrenUpdatedPlane) {
|
|
2470
|
+
updatedPlane = Object.assign({}, childrenUpdatedPlane);
|
|
2471
|
+
}
|
|
2354
2472
|
continue;
|
|
2355
2473
|
}
|
|
2356
|
-
updatedTree.push(
|
|
2474
|
+
updatedTree.push(plane);
|
|
2357
2475
|
}
|
|
2358
|
-
return
|
|
2476
|
+
return {
|
|
2477
|
+
updatedTree: updatedTree,
|
|
2478
|
+
updatedPlane: updatedPlane
|
|
2479
|
+
};
|
|
2359
2480
|
};
|
|
2360
2481
|
|
|
2361
2482
|
var logic = Object.freeze({
|
|
@@ -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
|