@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.js
CHANGED
|
@@ -18,34 +18,6 @@ function _interopDefaultLegacy(e) {
|
|
|
18
18
|
|
|
19
19
|
var themes__default = _interopDefaultLegacy(themes);
|
|
20
20
|
|
|
21
|
-
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
22
|
-
let direction = "left";
|
|
23
|
-
const wheelDeltaX = deltas.deltaX;
|
|
24
|
-
const wheelDeltaY = deltas.deltaY;
|
|
25
|
-
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
26
|
-
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
27
|
-
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
28
|
-
direction = "left";
|
|
29
|
-
}
|
|
30
|
-
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
31
|
-
direction = "right";
|
|
32
|
-
}
|
|
33
|
-
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
34
|
-
direction = "up";
|
|
35
|
-
}
|
|
36
|
-
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
37
|
-
direction = "down";
|
|
38
|
-
}
|
|
39
|
-
return direction;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var index$k = Object.freeze({
|
|
43
|
-
__proto__: null,
|
|
44
|
-
getWheelDirection: getWheelDirection
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const internatiolate = (lamguage, field) => pluridData.internationalization[lamguage][field];
|
|
48
|
-
|
|
49
21
|
const specifiedOrDefault = (path, type, configuration) => {
|
|
50
22
|
const item = pluridFunctions.objects.getNested(configuration, path);
|
|
51
23
|
if (typeof item === type) {
|
|
@@ -99,6 +71,7 @@ const merge = (configuration, target) => {
|
|
|
99
71
|
conceal: specifiedOrDefault("elements.toolbar.conceal", "boolean", configuration),
|
|
100
72
|
transformIcons: specifiedOrDefault("elements.toolbar.transformIcons", "boolean", configuration),
|
|
101
73
|
transformButtons: specifiedOrDefault("elements.toolbar.transformButtons", "boolean", configuration),
|
|
74
|
+
drawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.drawers ? configuration.elements.toolbar.drawers : targetConfiguration.elements.toolbar.drawers,
|
|
102
75
|
toggledDrawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.toggledDrawers ? configuration.elements.toolbar.toggledDrawers : targetConfiguration.elements.toolbar.toggledDrawers
|
|
103
76
|
},
|
|
104
77
|
viewcube: {
|
|
@@ -126,6 +99,7 @@ const merge = (configuration, target) => {
|
|
|
126
99
|
camera: specifiedOrDefault("space.camera", "string", configuration),
|
|
127
100
|
perspective: specifiedOrDefault("space.perspective", "number", configuration),
|
|
128
101
|
opaque: specifiedOrDefault("space.opaque", "boolean", configuration),
|
|
102
|
+
fadeInTime: specifiedOrDefault("space.fadeInTime", "number", configuration),
|
|
129
103
|
center: specifiedOrDefault("space.center", "boolean", configuration),
|
|
130
104
|
transformOrigin: {
|
|
131
105
|
show: specifiedOrDefault("space.transformOrigin.show", "boolean", configuration),
|
|
@@ -156,94 +130,11 @@ const merge = (configuration, target) => {
|
|
|
156
130
|
return mergedConfiguration;
|
|
157
131
|
};
|
|
158
132
|
|
|
159
|
-
var index$
|
|
133
|
+
var index$k = Object.freeze({
|
|
160
134
|
__proto__: null,
|
|
161
135
|
merge: merge
|
|
162
136
|
});
|
|
163
137
|
|
|
164
|
-
const createIndexed = items => pluridFunctions.indexing.create(items);
|
|
165
|
-
|
|
166
|
-
var index$i = Object.freeze({
|
|
167
|
-
__proto__: null,
|
|
168
|
-
createIndexed: createIndexed
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const registerPaths = pages => {
|
|
172
|
-
const paths = [];
|
|
173
|
-
for (const page of pages) {
|
|
174
|
-
const handledPath = handlePath(page.path);
|
|
175
|
-
const path = {
|
|
176
|
-
id: pluridFunctions.uuid.generate(),
|
|
177
|
-
pageID: page.id,
|
|
178
|
-
address: page.path,
|
|
179
|
-
parameters: handledPath.parameters
|
|
180
|
-
};
|
|
181
|
-
paths.push(path);
|
|
182
|
-
}
|
|
183
|
-
return paths;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handlePath = path => ({
|
|
187
|
-
regex: ""
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
const composePathRegex = match => {
|
|
191
|
-
let reString = "";
|
|
192
|
-
for (const matched of match) {
|
|
193
|
-
if (!subpathIsParameter(matched)) {
|
|
194
|
-
reString += matched.replace("/", "\\/");
|
|
195
|
-
} else {
|
|
196
|
-
reString += "\\/([^\\/]+)";
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return reString;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const subpathIsParameter = subpath => subpath[0] === "/" && subpath[1] === ":";
|
|
203
|
-
|
|
204
|
-
var index$h = Object.freeze({
|
|
205
|
-
__proto__: null,
|
|
206
|
-
registerPaths: registerPaths,
|
|
207
|
-
composePathRegex: composePathRegex,
|
|
208
|
-
subpathIsParameter: subpathIsParameter
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const createInternalStatePlane = plane => {
|
|
212
|
-
const statePlane = {
|
|
213
|
-
id: pluridFunctions.uuid.generate(),
|
|
214
|
-
path: plane.route
|
|
215
|
-
};
|
|
216
|
-
return statePlane;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const createInternalContextPlane = plane => {
|
|
220
|
-
const {route: route, component: component} = plane;
|
|
221
|
-
const contextPlane = {
|
|
222
|
-
id: pluridFunctions.uuid.generate(),
|
|
223
|
-
path: route,
|
|
224
|
-
component: component
|
|
225
|
-
};
|
|
226
|
-
return contextPlane;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const getPluridPlaneIDByData = element => {
|
|
230
|
-
if (!element) {
|
|
231
|
-
return "";
|
|
232
|
-
}
|
|
233
|
-
const parent = element.parentElement;
|
|
234
|
-
if (parent && parent.dataset.pluridPlane) {
|
|
235
|
-
return parent.dataset.pluridPlane;
|
|
236
|
-
}
|
|
237
|
-
return getPluridPlaneIDByData(parent);
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
var index$g = Object.freeze({
|
|
241
|
-
__proto__: null,
|
|
242
|
-
createInternalStatePlane: createInternalStatePlane,
|
|
243
|
-
createInternalContextPlane: createInternalContextPlane,
|
|
244
|
-
getPluridPlaneIDByData: getPluridPlaneIDByData
|
|
245
|
-
});
|
|
246
|
-
|
|
247
138
|
const extractPathname = location => {
|
|
248
139
|
const queryIndex = location.indexOf("?");
|
|
249
140
|
const noQueryPath = queryIndex === -1 ? location : location.substring(0, queryIndex);
|
|
@@ -298,7 +189,7 @@ const computeComparingPath = (path, parameters) => {
|
|
|
298
189
|
comparingPathElements[index] = parameters[index];
|
|
299
190
|
}
|
|
300
191
|
}
|
|
301
|
-
const comparingPath =
|
|
192
|
+
const comparingPath = comparingPathElements.join("/");
|
|
302
193
|
return {
|
|
303
194
|
locationElements: locationElements,
|
|
304
195
|
comparingPath: comparingPath
|
|
@@ -414,54 +305,77 @@ const extractOccurence = occurence => {
|
|
|
414
305
|
return occurenceValue;
|
|
415
306
|
};
|
|
416
307
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
this.path = path;
|
|
421
|
-
this.options = this.handleOptions(options);
|
|
308
|
+
const stringInsertInitial = (value, insert) => {
|
|
309
|
+
if (!value.startsWith(insert)) {
|
|
310
|
+
value = insert + value;
|
|
422
311
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
312
|
+
return value;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const stringRemoveTrailing = (value, trail) => {
|
|
316
|
+
if (value.endsWith(trail)) {
|
|
317
|
+
value = value.slice(0, value.length - trail.length);
|
|
428
318
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
319
|
+
return value;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
const PATH_SEPARATOR = "/";
|
|
323
|
+
|
|
324
|
+
const cleanupPath = value => {
|
|
325
|
+
value = stringInsertInitial(value, PATH_SEPARATOR);
|
|
326
|
+
value = stringRemoveTrailing(value, PATH_SEPARATOR);
|
|
327
|
+
return value;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const computePlaneAddress = (plane, route, origin = "origin") => {
|
|
331
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
332
|
+
origin = location.host;
|
|
432
333
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
334
|
+
const cleanPlane = extractPathname(plane);
|
|
335
|
+
const planeAddressType = checkPlaneAddressType(cleanPlane);
|
|
336
|
+
switch (planeAddressType) {
|
|
337
|
+
case "http":
|
|
338
|
+
case "https":
|
|
339
|
+
case "pttp":
|
|
340
|
+
return cleanPlane;
|
|
436
341
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
342
|
+
origin = stringRemoveTrailing(origin, "/");
|
|
343
|
+
const absolutePlane = isAbsolutePlane(plane);
|
|
344
|
+
const path = route && route !== "/" ? absolutePlane ? cleanupPath(cleanPlane) : cleanupPath(route) + cleanupPath(cleanPlane) : cleanupPath(cleanPlane);
|
|
345
|
+
const planeAddress = pluridData.protocols.plurid + origin + path;
|
|
346
|
+
return planeAddress;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const isAbsolutePlane = value => value[0] === "/";
|
|
350
|
+
|
|
351
|
+
const checkPlaneAddressType = value => {
|
|
352
|
+
value = value.toLowerCase().trim();
|
|
353
|
+
if (value.startsWith(pluridData.protocols.plurid)) {
|
|
354
|
+
return "pttp";
|
|
440
355
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
return fragments;
|
|
356
|
+
if (value.startsWith(pluridData.protocols.https)) {
|
|
357
|
+
return pluridData.HTTPS_PROTOCOL;
|
|
444
358
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
const {match: match, parameters: parameters, elements: elements} = this.extractParametersAndMatch();
|
|
448
|
-
const query = this.extractQuery();
|
|
449
|
-
const queryData = Object.entries(query).map((([key, value]) => key + "=" + value)).join("&");
|
|
450
|
-
const queryString = queryData ? "?" + queryData : "";
|
|
451
|
-
const fragments = this.extractFragments();
|
|
452
|
-
const parserResponse = {
|
|
453
|
-
path: this.path,
|
|
454
|
-
pathname: pathname,
|
|
455
|
-
elements: elements,
|
|
456
|
-
match: match,
|
|
457
|
-
parameters: parameters,
|
|
458
|
-
query: query,
|
|
459
|
-
fragments: fragments,
|
|
460
|
-
route: pathname + queryString
|
|
461
|
-
};
|
|
462
|
-
return parserResponse;
|
|
359
|
+
if (value.startsWith(pluridData.protocols.http)) {
|
|
360
|
+
return pluridData.HTTP_PROTOCOL;
|
|
463
361
|
}
|
|
464
|
-
|
|
362
|
+
return "relative";
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
const removeTrailingSlash = value => {
|
|
366
|
+
if (value.endsWith("/") && value.length > 1) {
|
|
367
|
+
return value.slice(0, value.length - 1);
|
|
368
|
+
}
|
|
369
|
+
return value;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const cleanPathValue = value => {
|
|
373
|
+
const queryStart = value.indexOf("?");
|
|
374
|
+
if (queryStart < 0) {
|
|
375
|
+
return removeTrailingSlash(value);
|
|
376
|
+
}
|
|
377
|
+
return removeTrailingSlash(value.substring(0, queryStart));
|
|
378
|
+
};
|
|
465
379
|
|
|
466
380
|
const checkParameterLength = (parameter, length, compareType) => {
|
|
467
381
|
const parameterLength = parameter.length;
|
|
@@ -486,9 +400,7 @@ const checkParameterLength = (parameter, length, compareType) => {
|
|
|
486
400
|
}
|
|
487
401
|
};
|
|
488
402
|
|
|
489
|
-
const checkValidPath
|
|
490
|
-
const {path: path, parameters: parameters} = data;
|
|
491
|
-
const {parameters: validationParameters} = path;
|
|
403
|
+
const checkValidPath = (validationParameters, parameters) => {
|
|
492
404
|
if (validationParameters) {
|
|
493
405
|
for (const [parameterKey, parameterData] of Object.entries(validationParameters)) {
|
|
494
406
|
const {length: length, lengthType: lengthType, startsWith: startsWith, endsWith: endsWith, includes: includes} = parameterData;
|
|
@@ -514,35 +426,6 @@ const checkValidPath$1 = data => {
|
|
|
514
426
|
return true;
|
|
515
427
|
};
|
|
516
428
|
|
|
517
|
-
class Matcher {
|
|
518
|
-
constructor(location, path, options) {
|
|
519
|
-
this.location = location;
|
|
520
|
-
this.path = path;
|
|
521
|
-
this.options = this.handleOptions(options);
|
|
522
|
-
this.checkMatch();
|
|
523
|
-
}
|
|
524
|
-
handleOptions(options) {
|
|
525
|
-
const matcherOptions = {};
|
|
526
|
-
return matcherOptions;
|
|
527
|
-
}
|
|
528
|
-
checkMatch() {
|
|
529
|
-
const parsedLocation = new Parser(this.location, this.path);
|
|
530
|
-
const parserResponse = parsedLocation.extract();
|
|
531
|
-
if (parserResponse.match) {
|
|
532
|
-
const validPath = checkValidPath$1(parserResponse);
|
|
533
|
-
if (validPath) {
|
|
534
|
-
const matcherResponse = Object.assign({}, parserResponse);
|
|
535
|
-
this.matchedData = matcherResponse;
|
|
536
|
-
} else {
|
|
537
|
-
this.matchedData = undefined;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
data() {
|
|
542
|
-
return this.matchedData;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
429
|
const cleanPathElement = path => {
|
|
547
430
|
if (path[0] === "/") {
|
|
548
431
|
return path.slice(1);
|
|
@@ -550,7 +433,7 @@ const cleanPathElement = path => {
|
|
|
550
433
|
return path;
|
|
551
434
|
};
|
|
552
435
|
|
|
553
|
-
var index$
|
|
436
|
+
var index$j = Object.freeze({
|
|
554
437
|
__proto__: null,
|
|
555
438
|
cleanPathElement: cleanPathElement
|
|
556
439
|
});
|
|
@@ -808,402 +691,103 @@ const resolveRoute = (route, protocol, host) => {
|
|
|
808
691
|
route: absoluteRoute
|
|
809
692
|
};
|
|
810
693
|
}
|
|
811
|
-
|
|
812
|
-
const absoluteRoute = resolvers.join(separator);
|
|
694
|
+
[ protocolDivision, hostDivision.value, path.value, space.value, universe.value, cluster.value, cleanPathElement(plane.value) ];
|
|
813
695
|
return {
|
|
814
|
-
protocol:
|
|
815
|
-
host:
|
|
696
|
+
protocol: "",
|
|
697
|
+
host: "",
|
|
816
698
|
path: path,
|
|
817
|
-
space:
|
|
818
|
-
universe:
|
|
819
|
-
cluster:
|
|
820
|
-
plane:
|
|
821
|
-
route:
|
|
699
|
+
space: "",
|
|
700
|
+
universe: "",
|
|
701
|
+
cluster: "",
|
|
702
|
+
plane: "",
|
|
703
|
+
route: route
|
|
822
704
|
};
|
|
823
705
|
};
|
|
824
706
|
|
|
825
|
-
const
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
for (const universe of space.universes) {
|
|
836
|
-
if (universe.value === pathDivisions.universe.value || universe.value === "default" && pathDivisions.universe.value === "u") {
|
|
837
|
-
console.log("universe", universe);
|
|
838
|
-
if (universe.clusters) {
|
|
839
|
-
for (const cluster of universe.clusters) {
|
|
840
|
-
if (cluster.value === pathDivisions.cluster.value || cluster.value === "default" && pathDivisions.cluster.value === "c") {
|
|
841
|
-
console.log("cluster", cluster);
|
|
842
|
-
if (cluster.planes) {
|
|
843
|
-
for (const plane of cluster.planes) {
|
|
844
|
-
console.log("plane", plane);
|
|
845
|
-
if (plane.value === pathDivisions.plane.value) {
|
|
846
|
-
return {
|
|
847
|
-
path: path,
|
|
848
|
-
pathname: path.value,
|
|
849
|
-
parameters: {},
|
|
850
|
-
query: {},
|
|
851
|
-
fragments: {
|
|
852
|
-
texts: [],
|
|
853
|
-
elements: []
|
|
854
|
-
},
|
|
855
|
-
route: ""
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
return;
|
|
707
|
+
const createTreePlane = (contextPlane, documentPlane) => {
|
|
708
|
+
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
709
|
+
const treePlane = Object.assign(Object.assign({}, pluridData.defaultTreePlane), {
|
|
710
|
+
routeDivisions: routeDivisions,
|
|
711
|
+
sourceID: contextPlane.id,
|
|
712
|
+
planeID: pluridFunctions.uuid.generate(),
|
|
713
|
+
route: contextPlane.path,
|
|
714
|
+
show: true
|
|
715
|
+
});
|
|
716
|
+
return treePlane;
|
|
872
717
|
};
|
|
873
718
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
this.cachedMatched = {};
|
|
879
|
-
}
|
|
880
|
-
handleOptions(options) {
|
|
881
|
-
const routerOptions = {
|
|
882
|
-
cacheLimit: (options === null || options === void 0 ? void 0 : options.cacheLimit) || 1e3,
|
|
883
|
-
gateway: options === null || options === void 0 ? void 0 : options.gateway
|
|
884
|
-
};
|
|
885
|
-
return routerOptions;
|
|
886
|
-
}
|
|
887
|
-
checkCacheReset() {
|
|
888
|
-
if (Object.entries(this.cachedMatched).length > this.options.cacheLimit) {
|
|
889
|
-
this.cachedMatched = {};
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
match(location) {
|
|
893
|
-
if (location === this.options.gateway) {
|
|
894
|
-
const query = extractQuery(window.location.search);
|
|
895
|
-
if (query.plurid) {
|
|
896
|
-
const path = findPathByDivisions(this.paths, query.plurid);
|
|
897
|
-
if (path) {
|
|
898
|
-
return path;
|
|
899
|
-
}
|
|
900
|
-
console.log("GATEWAY");
|
|
901
|
-
console.log("query", query);
|
|
902
|
-
console.log("paths", this.paths);
|
|
903
|
-
}
|
|
904
|
-
if (query.plurids) {
|
|
905
|
-
const split = query.plurids.split(",");
|
|
906
|
-
const paths = [];
|
|
907
|
-
for (const plurid of split) {
|
|
908
|
-
const path = findPathByDivisions(this.paths, plurid);
|
|
909
|
-
if (path) {
|
|
910
|
-
paths.push(path);
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
console.log("GATEWAY");
|
|
914
|
-
console.log("query", query);
|
|
915
|
-
console.log("paths", this.paths);
|
|
916
|
-
console.log("paths", paths);
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
const cached = this.cachedMatched[location];
|
|
920
|
-
if (cached) {
|
|
921
|
-
this.checkCacheReset();
|
|
922
|
-
return cached;
|
|
923
|
-
}
|
|
924
|
-
for (const path of this.paths) {
|
|
925
|
-
const matcher = new Matcher(location, path);
|
|
926
|
-
const data = matcher.data();
|
|
927
|
-
if (data) {
|
|
928
|
-
this.cachedMatched[location] = Object.assign({}, data);
|
|
929
|
-
return data;
|
|
930
|
-
}
|
|
719
|
+
const updateTreePlane$1 = (tree, page) => {
|
|
720
|
+
const updatedTree = tree.map((treePlane => {
|
|
721
|
+
if (treePlane.planeID === page.planeID) {
|
|
722
|
+
return Object.assign({}, page);
|
|
931
723
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
const processRoute = route => {
|
|
937
|
-
const routeElements = splitPath(route.value);
|
|
938
|
-
const parametersValues = [];
|
|
939
|
-
routeElements.map((routeElement => {
|
|
940
|
-
if (routeElement[0] === ":") {
|
|
941
|
-
parametersValues.push(routeElement);
|
|
942
|
-
} else {
|
|
943
|
-
parametersValues.push("");
|
|
724
|
+
if (treePlane.children) {
|
|
725
|
+
return Object.assign(Object.assign({}, treePlane), {
|
|
726
|
+
children: updateTreePlane$1(treePlane.children, page)
|
|
727
|
+
});
|
|
944
728
|
}
|
|
729
|
+
return treePlane;
|
|
945
730
|
}));
|
|
946
|
-
|
|
947
|
-
value: route.value,
|
|
948
|
-
parametersValues: parametersValues,
|
|
949
|
-
parameters: route.parameters
|
|
950
|
-
};
|
|
951
|
-
return processedRoute;
|
|
731
|
+
return updatedTree;
|
|
952
732
|
};
|
|
953
733
|
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
734
|
+
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
735
|
+
const updatedTree = tree.map((treePlane => {
|
|
736
|
+
if (treePlane.planeID === planeID) {
|
|
737
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
738
|
+
linkCoordinates: linkCoordinates
|
|
739
|
+
});
|
|
740
|
+
return updatedPlane;
|
|
959
741
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
742
|
+
if (treePlane.children) {
|
|
743
|
+
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
744
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
745
|
+
children: updatedChildren
|
|
746
|
+
});
|
|
747
|
+
return updatedPlane;
|
|
748
|
+
}
|
|
749
|
+
return treePlane;
|
|
750
|
+
}));
|
|
751
|
+
return updatedTree;
|
|
963
752
|
};
|
|
964
753
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
const validPath = checkValidPath(parametersValues, processedRoute.parameters);
|
|
972
|
-
if (!validPath) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
const internalMatchedRoute = {
|
|
976
|
-
target: processedRoute.value,
|
|
977
|
-
source: route,
|
|
978
|
-
parameters: parametersValues
|
|
979
|
-
};
|
|
980
|
-
return internalMatchedRoute;
|
|
981
|
-
};
|
|
754
|
+
var index$i = Object.freeze({
|
|
755
|
+
__proto__: null,
|
|
756
|
+
createTreePlane: createTreePlane,
|
|
757
|
+
updateTreePlane: updateTreePlane$1,
|
|
758
|
+
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
759
|
+
});
|
|
982
760
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
const query = splitQuery[0] || "";
|
|
989
|
-
const fragment = splitQuery[1] || "";
|
|
990
|
-
const routeElements = {
|
|
991
|
-
path: path,
|
|
992
|
-
query: query,
|
|
993
|
-
fragment: fragment
|
|
994
|
-
};
|
|
995
|
-
return routeElements;
|
|
996
|
-
};
|
|
761
|
+
var index$h = Object.freeze({
|
|
762
|
+
__proto__: null,
|
|
763
|
+
configuration: index$k,
|
|
764
|
+
tree: index$i
|
|
765
|
+
});
|
|
997
766
|
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
if (startsWith && !paramaterValue.startsWith(startsWith)) {
|
|
1007
|
-
return false;
|
|
1008
|
-
}
|
|
1009
|
-
if (endsWith && !paramaterValue.endsWith(endsWith)) {
|
|
1010
|
-
return false;
|
|
1011
|
-
}
|
|
1012
|
-
if (includes && !includes.includes(paramaterValue)) {
|
|
1013
|
-
return false;
|
|
1014
|
-
}
|
|
1015
|
-
if (length) {
|
|
1016
|
-
const validLength = checkParameterLength(paramaterValue, length, lengthType);
|
|
1017
|
-
return validLength;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
return true;
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
|
-
const CATCH_ALL_ROUTE = "*";
|
|
1025
|
-
|
|
1026
|
-
class URLRouter {
|
|
1027
|
-
constructor(routes) {
|
|
1028
|
-
this.routes = this.processRoutes(routes);
|
|
1029
|
-
}
|
|
1030
|
-
match(route) {
|
|
1031
|
-
const routeElements = extractRouteElements(route);
|
|
1032
|
-
const {path: path} = routeElements;
|
|
1033
|
-
if (this.routes[path]) {
|
|
1034
|
-
const matchedRoute = matchRoute(path, this.routes[path]);
|
|
1035
|
-
if (matchedRoute) {
|
|
1036
|
-
const {target: target, source: source, parameters: parameters} = matchedRoute;
|
|
1037
|
-
return {
|
|
1038
|
-
elements: routeElements,
|
|
1039
|
-
target: target,
|
|
1040
|
-
source: source,
|
|
1041
|
-
parameters: parameters
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
const matchedRoute = matchRoutes(path, this.routes);
|
|
1046
|
-
if (matchedRoute) {
|
|
1047
|
-
const {target: target, source: source, parameters: parameters} = matchedRoute;
|
|
1048
|
-
return {
|
|
1049
|
-
elements: routeElements,
|
|
1050
|
-
target: target,
|
|
1051
|
-
source: source,
|
|
1052
|
-
parameters: parameters
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
if (this.routes[CATCH_ALL_ROUTE]) {
|
|
1056
|
-
const matchedRoute = matchRoute(path, this.routes[CATCH_ALL_ROUTE]);
|
|
1057
|
-
if (matchedRoute) {
|
|
1058
|
-
const {target: target, source: source, parameters: parameters} = matchedRoute;
|
|
1059
|
-
return {
|
|
1060
|
-
elements: routeElements,
|
|
1061
|
-
target: target,
|
|
1062
|
-
source: source,
|
|
1063
|
-
parameters: parameters
|
|
1064
|
-
};
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
return;
|
|
767
|
+
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
768
|
+
let direction = "left";
|
|
769
|
+
const wheelDeltaX = deltas.deltaX;
|
|
770
|
+
const wheelDeltaY = deltas.deltaY;
|
|
771
|
+
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
772
|
+
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
773
|
+
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
774
|
+
direction = "left";
|
|
1068
775
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
for (const route of routes) {
|
|
1072
|
-
const processedRoute = processRoute(route);
|
|
1073
|
-
index[processedRoute.value] = Object.assign({}, processedRoute);
|
|
1074
|
-
}
|
|
1075
|
-
return index;
|
|
776
|
+
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
777
|
+
direction = "right";
|
|
1076
778
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
var index$e = Object.freeze({
|
|
1080
|
-
__proto__: null,
|
|
1081
|
-
default: Router,
|
|
1082
|
-
URLRouter: URLRouter,
|
|
1083
|
-
RouteMatcher: Matcher,
|
|
1084
|
-
RouteParser: Parser,
|
|
1085
|
-
mapPathsToRoutes: mapPathsToRoutes,
|
|
1086
|
-
pluridLinkPathDivider: pluridLinkPathDivider,
|
|
1087
|
-
resolveRoute: resolveRoute,
|
|
1088
|
-
extractQuery: extractQuery
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
const createTreePlane = (contextPlane, documentPlane) => {
|
|
1092
|
-
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
1093
|
-
const treePlane = Object.assign(Object.assign({}, pluridData.defaultTreePlane), {
|
|
1094
|
-
routeDivisions: routeDivisions,
|
|
1095
|
-
sourceID: contextPlane.id,
|
|
1096
|
-
planeID: pluridFunctions.uuid.generate(),
|
|
1097
|
-
route: contextPlane.path,
|
|
1098
|
-
show: true
|
|
1099
|
-
});
|
|
1100
|
-
return treePlane;
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
const updateTreePlane$1 = (tree, page) => {
|
|
1104
|
-
const updatedTree = tree.map((treePlane => {
|
|
1105
|
-
if (treePlane.planeID === page.planeID) {
|
|
1106
|
-
return Object.assign({}, page);
|
|
1107
|
-
}
|
|
1108
|
-
if (treePlane.children) {
|
|
1109
|
-
return Object.assign(Object.assign({}, treePlane), {
|
|
1110
|
-
children: updateTreePlane$1(treePlane.children, page)
|
|
1111
|
-
});
|
|
1112
|
-
}
|
|
1113
|
-
return treePlane;
|
|
1114
|
-
}));
|
|
1115
|
-
return updatedTree;
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
|
-
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
1119
|
-
const updatedTree = tree.map((treePlane => {
|
|
1120
|
-
if (treePlane.planeID === planeID) {
|
|
1121
|
-
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
1122
|
-
linkCoordinates: linkCoordinates
|
|
1123
|
-
});
|
|
1124
|
-
return updatedPlane;
|
|
1125
|
-
}
|
|
1126
|
-
if (treePlane.children) {
|
|
1127
|
-
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
1128
|
-
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
1129
|
-
children: updatedChildren
|
|
1130
|
-
});
|
|
1131
|
-
return updatedPlane;
|
|
1132
|
-
}
|
|
1133
|
-
return treePlane;
|
|
1134
|
-
}));
|
|
1135
|
-
return updatedTree;
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
var index$d = Object.freeze({
|
|
1139
|
-
__proto__: null,
|
|
1140
|
-
createTreePlane: createTreePlane,
|
|
1141
|
-
updateTreePlane: updateTreePlane$1,
|
|
1142
|
-
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
const createInternalStateUniverse = universe => {
|
|
1146
|
-
const statePlanes = universe.planes.map((plane => {
|
|
1147
|
-
const internalStatePlane = createInternalStatePlane(plane);
|
|
1148
|
-
return internalStatePlane;
|
|
1149
|
-
}));
|
|
1150
|
-
const indexedStatePlanes = createIndexed(statePlanes);
|
|
1151
|
-
const paths = registerPaths(statePlanes);
|
|
1152
|
-
const indexedPaths = createIndexed(paths);
|
|
1153
|
-
const stateUniverse = {
|
|
1154
|
-
name: universe.name,
|
|
1155
|
-
planes: indexedStatePlanes,
|
|
1156
|
-
paths: indexedPaths,
|
|
1157
|
-
id: universe.id || pluridFunctions.uuid.generate(),
|
|
1158
|
-
ordinal: universe.ordinal || 0,
|
|
1159
|
-
active: universe.active || false
|
|
1160
|
-
};
|
|
1161
|
-
return stateUniverse;
|
|
1162
|
-
};
|
|
1163
|
-
|
|
1164
|
-
const createInternalContextUniverse = universe => {
|
|
1165
|
-
const contextPlanes = universe.planes.map((plane => {
|
|
1166
|
-
const internalContextPlane = createInternalContextPlane(plane);
|
|
1167
|
-
return internalContextPlane;
|
|
1168
|
-
}));
|
|
1169
|
-
const indexedContextPlanes = createIndexed(contextPlanes);
|
|
1170
|
-
const contextUniverse = {
|
|
1171
|
-
name: universe.name,
|
|
1172
|
-
planes: indexedContextPlanes,
|
|
1173
|
-
id: universe.id || pluridFunctions.uuid.generate()
|
|
1174
|
-
};
|
|
1175
|
-
return contextUniverse;
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
|
-
const findActiveUniverse = universes => {
|
|
1179
|
-
if (universes.length === 0) {
|
|
1180
|
-
return "";
|
|
779
|
+
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
780
|
+
direction = "up";
|
|
1181
781
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
if (universe.active) {
|
|
1185
|
-
activeUniverseID = universe.id;
|
|
1186
|
-
break;
|
|
1187
|
-
}
|
|
782
|
+
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
783
|
+
direction = "down";
|
|
1188
784
|
}
|
|
1189
|
-
return
|
|
785
|
+
return direction;
|
|
1190
786
|
};
|
|
1191
787
|
|
|
1192
|
-
var index$
|
|
1193
|
-
__proto__: null,
|
|
1194
|
-
createInternalStateUniverse: createInternalStateUniverse,
|
|
1195
|
-
createInternalContextUniverse: createInternalContextUniverse,
|
|
1196
|
-
findActiveUniverse: findActiveUniverse
|
|
1197
|
-
});
|
|
1198
|
-
|
|
1199
|
-
var index$b = Object.freeze({
|
|
788
|
+
var index$g = Object.freeze({
|
|
1200
789
|
__proto__: null,
|
|
1201
|
-
|
|
1202
|
-
universes: index$c,
|
|
1203
|
-
helpers: index$i,
|
|
1204
|
-
planes: index$g,
|
|
1205
|
-
paths: index$h,
|
|
1206
|
-
tree: index$d
|
|
790
|
+
getWheelDirection: getWheelDirection
|
|
1207
791
|
});
|
|
1208
792
|
|
|
1209
793
|
const degToRad = deg => deg * .01745329252;
|
|
@@ -1314,7 +898,7 @@ function makeRotationMatrixFromQuaternion(quaternion) {
|
|
|
1314
898
|
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 ];
|
|
1315
899
|
}
|
|
1316
900
|
|
|
1317
|
-
var index$
|
|
901
|
+
var index$f = Object.freeze({
|
|
1318
902
|
__proto__: null,
|
|
1319
903
|
degToRad: degToRad,
|
|
1320
904
|
radToDeg: radToDeg,
|
|
@@ -1338,7 +922,7 @@ function rotateMatrix(xAngle, yAngle, zAngle = 0) {
|
|
|
1338
922
|
return rotationMatrix;
|
|
1339
923
|
}
|
|
1340
924
|
|
|
1341
|
-
function translateMatrix(x, y, z) {
|
|
925
|
+
function translateMatrix$1(x, y, z) {
|
|
1342
926
|
return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ];
|
|
1343
927
|
}
|
|
1344
928
|
|
|
@@ -1346,7 +930,7 @@ function scaleMatrix(s) {
|
|
|
1346
930
|
return [ s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 ];
|
|
1347
931
|
}
|
|
1348
932
|
|
|
1349
|
-
function multiplyMatrices(matrixA, matrixB) {
|
|
933
|
+
function multiplyMatrices$1(matrixA, matrixB) {
|
|
1350
934
|
const result = [];
|
|
1351
935
|
const a00 = matrixA[0];
|
|
1352
936
|
const a01 = matrixA[1];
|
|
@@ -1402,7 +986,7 @@ function multiplyMatrices(matrixA, matrixB) {
|
|
|
1402
986
|
function multiplyArrayOfMatrices(matrices) {
|
|
1403
987
|
let inputMatrix = matrices[0];
|
|
1404
988
|
for (let i = 1; i < matrices.length; i++) {
|
|
1405
|
-
inputMatrix = multiplyMatrices(inputMatrix, matrices[i]);
|
|
989
|
+
inputMatrix = multiplyMatrices$1(inputMatrix, matrices[i]);
|
|
1406
990
|
}
|
|
1407
991
|
return inputMatrix;
|
|
1408
992
|
}
|
|
@@ -1411,16 +995,105 @@ function matrixArrayToCSSMatrix(array) {
|
|
|
1411
995
|
return "matrix3d(" + array.join(",") + ")";
|
|
1412
996
|
}
|
|
1413
997
|
|
|
1414
|
-
var index$
|
|
998
|
+
var index$e = Object.freeze({
|
|
1415
999
|
__proto__: null,
|
|
1416
1000
|
rotateMatrix: rotateMatrix,
|
|
1417
|
-
translateMatrix: translateMatrix,
|
|
1001
|
+
translateMatrix: translateMatrix$1,
|
|
1418
1002
|
scaleMatrix: scaleMatrix,
|
|
1419
|
-
multiplyMatrices: multiplyMatrices,
|
|
1003
|
+
multiplyMatrices: multiplyMatrices$1,
|
|
1420
1004
|
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
1421
1005
|
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
1422
1006
|
});
|
|
1423
1007
|
|
|
1008
|
+
const multiplyMatrices = (m1, m2) => {
|
|
1009
|
+
const result = [];
|
|
1010
|
+
for (let i = 0; i < m1.length; i++) {
|
|
1011
|
+
result[i] = [];
|
|
1012
|
+
for (let j = 0; j < m2[0].length; j++) {
|
|
1013
|
+
let sum = 0;
|
|
1014
|
+
for (let k = 0; k < m1[0].length; k++) {
|
|
1015
|
+
sum += m1[i][k] * m2[k][j];
|
|
1016
|
+
}
|
|
1017
|
+
result[i][j] = sum;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return result;
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
const arrayToMatrix = array => {
|
|
1024
|
+
const matrix = [];
|
|
1025
|
+
for (let i = 0; i < array.length; i += 4) {
|
|
1026
|
+
const row = [];
|
|
1027
|
+
row.push(array[i]);
|
|
1028
|
+
row.push(array[i + 1]);
|
|
1029
|
+
row.push(array[i + 2]);
|
|
1030
|
+
row.push(array[i + 3]);
|
|
1031
|
+
matrix.push(row);
|
|
1032
|
+
}
|
|
1033
|
+
return matrix;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
const matrixToArray = matrix => matrix.flat();
|
|
1037
|
+
|
|
1038
|
+
const printMatrix = (matrix, name) => {
|
|
1039
|
+
const normalize = value => {
|
|
1040
|
+
if (value === 1 || value === 0) {
|
|
1041
|
+
return value + " ";
|
|
1042
|
+
}
|
|
1043
|
+
if (value > 0) {
|
|
1044
|
+
return value.toFixed(2) + " ";
|
|
1045
|
+
}
|
|
1046
|
+
return value.toFixed(2) + " ";
|
|
1047
|
+
};
|
|
1048
|
+
console.log("matrix", name + ":");
|
|
1049
|
+
for (const row of matrix) {
|
|
1050
|
+
console.log(normalize(row[0]), normalize(row[1]), normalize(row[2]), normalize(row[3]));
|
|
1051
|
+
}
|
|
1052
|
+
console.log(`matrix3d(${matrix.flat().join(",")})`);
|
|
1053
|
+
console.log();
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
const rotateXMatrix = angle => {
|
|
1057
|
+
const x = Math.cos(angle);
|
|
1058
|
+
const y = -1 * Math.sin(angle);
|
|
1059
|
+
const z = Math.sin(angle);
|
|
1060
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, x, y, 0 ], [ 0, z, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1061
|
+
return m;
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
const rotateYMatrix = angle => {
|
|
1065
|
+
const x = Math.cos(angle);
|
|
1066
|
+
const y = -1 * Math.sin(angle);
|
|
1067
|
+
const z = Math.sin(angle);
|
|
1068
|
+
const m = [ [ x, 0, z, 0 ], [ 0, 1, 0, 0 ], [ y, 0, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1069
|
+
return m;
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
const rotateZMatrix = angle => {
|
|
1073
|
+
const x = Math.cos(angle);
|
|
1074
|
+
const y = -1 * Math.sin(angle);
|
|
1075
|
+
const z = Math.sin(angle);
|
|
1076
|
+
const m = [ [ x, y, 0, 0 ], [ z, x, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1077
|
+
return m;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
const translateMatrix = (x = 0, y = 0, z = 0) => {
|
|
1081
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ x, y, z, 1 ] ];
|
|
1082
|
+
return m;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
var index$d = Object.freeze({
|
|
1086
|
+
__proto__: null,
|
|
1087
|
+
multiplyMatrices: multiplyMatrices,
|
|
1088
|
+
arrayToMatrix: arrayToMatrix,
|
|
1089
|
+
matrixToArray: matrixToArray,
|
|
1090
|
+
printMatrix: printMatrix,
|
|
1091
|
+
rotateXMatrix: rotateXMatrix,
|
|
1092
|
+
rotateYMatrix: rotateYMatrix,
|
|
1093
|
+
rotateZMatrix: rotateZMatrix,
|
|
1094
|
+
translateMatrix: translateMatrix
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1424
1097
|
function getMatrixValues(matrix3d) {
|
|
1425
1098
|
const matrixValues = matrix3d.split("(")[1].split(")")[0].split(",");
|
|
1426
1099
|
const matrixValuesInt = [];
|
|
@@ -1550,7 +1223,7 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1550
1223
|
const translateZ = transformTranslate.translateZ;
|
|
1551
1224
|
const scale = getTransformScale(matrix3d).scale;
|
|
1552
1225
|
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1553
|
-
const valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1226
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1554
1227
|
const valScalationMatrix = scaleMatrix(scale);
|
|
1555
1228
|
if (direction === "left") {
|
|
1556
1229
|
rotateY -= angleIncrement;
|
|
@@ -1583,73 +1256,552 @@ function translatePlurid(matrix3d, direction = "", linearIncrement = 50) {
|
|
|
1583
1256
|
const translateZ = transformTranslate.translateZ;
|
|
1584
1257
|
const scale = getTransformScale(matrix3d).scale;
|
|
1585
1258
|
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1586
|
-
let valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1259
|
+
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1587
1260
|
const valScalationMatrix = scaleMatrix(scale);
|
|
1588
1261
|
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1589
1262
|
if (direction === "left") {
|
|
1590
1263
|
translateX += linearIncrement;
|
|
1591
|
-
valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1264
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1265
|
+
}
|
|
1266
|
+
if (direction === "right") {
|
|
1267
|
+
translateX -= linearIncrement;
|
|
1268
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1269
|
+
}
|
|
1270
|
+
if (direction === "up") {
|
|
1271
|
+
translateY += linearIncrement;
|
|
1272
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1273
|
+
}
|
|
1274
|
+
if (direction === "down") {
|
|
1275
|
+
translateY -= linearIncrement;
|
|
1276
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1277
|
+
}
|
|
1278
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1279
|
+
return transformedMatrix3d;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
function scalePlurid(matrix3d, direction = "", scaleIncrement = .05) {
|
|
1283
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1284
|
+
const rotateX = transformRotate.rotateX;
|
|
1285
|
+
const rotateY = transformRotate.rotateY;
|
|
1286
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1287
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1288
|
+
const translateX = transformTranslate.translateX;
|
|
1289
|
+
const translateY = transformTranslate.translateY;
|
|
1290
|
+
const translateZ = transformTranslate.translateZ;
|
|
1291
|
+
let scale = getTransformScale(matrix3d).scale;
|
|
1292
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1293
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1294
|
+
let valScalationMatrix = scaleMatrix(scale);
|
|
1295
|
+
if (direction === "up") {
|
|
1296
|
+
scale -= scaleIncrement;
|
|
1297
|
+
if (scale < .1) {
|
|
1298
|
+
scale = .1;
|
|
1299
|
+
}
|
|
1300
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1301
|
+
}
|
|
1302
|
+
if (direction === "down") {
|
|
1303
|
+
scale += scaleIncrement;
|
|
1304
|
+
if (scale > 4) {
|
|
1305
|
+
scale = 4;
|
|
1306
|
+
}
|
|
1307
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1308
|
+
}
|
|
1309
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1310
|
+
return transformedMatrix3d;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
var index$c = Object.freeze({
|
|
1314
|
+
__proto__: null,
|
|
1315
|
+
getMatrixValues: getMatrixValues,
|
|
1316
|
+
getRotationMatrix: getRotationMatrix,
|
|
1317
|
+
getTranslationMatrix: getTranslationMatrix,
|
|
1318
|
+
getScalationValue: getScalationValue,
|
|
1319
|
+
setTransform: setTransform,
|
|
1320
|
+
getTransformRotate: getTransformRotate,
|
|
1321
|
+
getTransformTranslate: getTransformTranslate,
|
|
1322
|
+
getTransformScale: getTransformScale,
|
|
1323
|
+
rotatePlurid: rotatePlurid,
|
|
1324
|
+
translatePlurid: translatePlurid,
|
|
1325
|
+
scalePlurid: scalePlurid
|
|
1326
|
+
});
|
|
1327
|
+
|
|
1328
|
+
var index$b = Object.freeze({
|
|
1329
|
+
__proto__: null,
|
|
1330
|
+
general: index$d,
|
|
1331
|
+
matrix3d: index$c
|
|
1332
|
+
});
|
|
1333
|
+
|
|
1334
|
+
var index$a = Object.freeze({
|
|
1335
|
+
__proto__: null,
|
|
1336
|
+
direction: index$g,
|
|
1337
|
+
matrix: index$e,
|
|
1338
|
+
quaternion: index$f,
|
|
1339
|
+
transform: index$b
|
|
1340
|
+
});
|
|
1341
|
+
|
|
1342
|
+
const internatiolate = (lamguage, field) => pluridData.internationalization[lamguage][field];
|
|
1343
|
+
|
|
1344
|
+
const resolvePluridPlaneData = plane => {
|
|
1345
|
+
if (Array.isArray(plane)) {
|
|
1346
|
+
const [route, component, options] = plane;
|
|
1347
|
+
return Object.assign({
|
|
1348
|
+
route: route,
|
|
1349
|
+
component: component
|
|
1350
|
+
}, options);
|
|
1351
|
+
}
|
|
1352
|
+
return plane;
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
const resolvePluridRoutePlaneData = plane => {
|
|
1356
|
+
if (Array.isArray(plane)) {
|
|
1357
|
+
const [value, component, options] = plane;
|
|
1358
|
+
return Object.assign({
|
|
1359
|
+
value: value,
|
|
1360
|
+
component: component
|
|
1361
|
+
}, options);
|
|
1362
|
+
}
|
|
1363
|
+
return plane;
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
const createInternalStatePlane = plane => {
|
|
1367
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1368
|
+
const statePlane = {
|
|
1369
|
+
id: pluridFunctions.uuid.generate(),
|
|
1370
|
+
path: planeData.route
|
|
1371
|
+
};
|
|
1372
|
+
return statePlane;
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
const createInternalContextPlane = plane => {
|
|
1376
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1377
|
+
const {route: route, component: component} = planeData;
|
|
1378
|
+
const contextPlane = {
|
|
1379
|
+
id: pluridFunctions.uuid.generate(),
|
|
1380
|
+
path: route,
|
|
1381
|
+
component: component
|
|
1382
|
+
};
|
|
1383
|
+
return contextPlane;
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
const getPluridPlaneIDByData = element => {
|
|
1387
|
+
if (!element) {
|
|
1388
|
+
return "";
|
|
1389
|
+
}
|
|
1390
|
+
const parent = element.parentElement;
|
|
1391
|
+
if (parent && parent.dataset.pluridPlane) {
|
|
1392
|
+
return parent.dataset.pluridPlane;
|
|
1393
|
+
}
|
|
1394
|
+
return getPluridPlaneIDByData(parent);
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
class IsoMatcher {
|
|
1398
|
+
constructor(data, origin = "origin") {
|
|
1399
|
+
this.routesIndex = new Map;
|
|
1400
|
+
this.planesIndex = new Map;
|
|
1401
|
+
this.routesKeys = [];
|
|
1402
|
+
this.planesKeys = [];
|
|
1403
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
1404
|
+
this.origin = location.host;
|
|
1405
|
+
} else {
|
|
1406
|
+
this.origin = origin;
|
|
1407
|
+
}
|
|
1408
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1409
|
+
}
|
|
1410
|
+
match(path, context = "plane") {
|
|
1411
|
+
switch (context) {
|
|
1412
|
+
case "plane":
|
|
1413
|
+
return this.matchPlane(path);
|
|
1414
|
+
|
|
1415
|
+
case "route":
|
|
1416
|
+
return this.matchRoute(path);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
index(data) {
|
|
1420
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1421
|
+
}
|
|
1422
|
+
clear() {
|
|
1423
|
+
this.routesIndex = new Map;
|
|
1424
|
+
this.planesIndex = new Map;
|
|
1425
|
+
this.routesKeys = [];
|
|
1426
|
+
this.planesKeys = [];
|
|
1427
|
+
}
|
|
1428
|
+
getPlanesIndex() {
|
|
1429
|
+
return this.planesIndex;
|
|
1430
|
+
}
|
|
1431
|
+
updateIndexes(routes, routePlanes, planes) {
|
|
1432
|
+
this.indexPlanes(planes, "Plane");
|
|
1433
|
+
this.indexPlanes(routePlanes, "RoutePlane");
|
|
1434
|
+
for (const route of routes) {
|
|
1435
|
+
if (route.planes) {
|
|
1436
|
+
this.indexPlanes(route.planes, "RoutePlane", route.value);
|
|
1437
|
+
}
|
|
1438
|
+
this.routesIndex.set(route.value, {
|
|
1439
|
+
data: Object.assign({}, route)
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
this.routesKeys = Array.from(this.routesIndex.keys());
|
|
1443
|
+
this.planesKeys = Array.from(this.planesIndex.keys());
|
|
1444
|
+
}
|
|
1445
|
+
indexPlanes(planes, kind, parent) {
|
|
1446
|
+
for (const plane of planes) {
|
|
1447
|
+
const planeData = kind === "Plane" ? resolvePluridPlaneData(plane) : resolvePluridRoutePlaneData(plane);
|
|
1448
|
+
const address = computePlaneAddress(kind === "Plane" ? planeData.route : planeData.value, parent, this.origin);
|
|
1449
|
+
const indexedPlane = {
|
|
1450
|
+
kind: kind,
|
|
1451
|
+
data: Object.assign({}, planeData)
|
|
1452
|
+
};
|
|
1453
|
+
if (parent) {
|
|
1454
|
+
indexedPlane["parent"] = parent;
|
|
1455
|
+
}
|
|
1456
|
+
this.planesIndex.set(address, indexedPlane);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
matchPlane(value) {
|
|
1460
|
+
const planeAddress = computePlaneAddress(value, undefined, this.origin);
|
|
1461
|
+
const plane = this.planesIndex.get(planeAddress);
|
|
1462
|
+
if (plane) {
|
|
1463
|
+
const query = extractQuery(value);
|
|
1464
|
+
const fragments = extractFragments(value);
|
|
1465
|
+
const match = {
|
|
1466
|
+
value: planeAddress,
|
|
1467
|
+
fragments: fragments,
|
|
1468
|
+
query: query,
|
|
1469
|
+
parameters: {}
|
|
1470
|
+
};
|
|
1471
|
+
if (plane.kind === "Plane") {
|
|
1472
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1473
|
+
const result = {
|
|
1474
|
+
kind: kind,
|
|
1475
|
+
data: data,
|
|
1476
|
+
parent: parent,
|
|
1477
|
+
match: match
|
|
1478
|
+
};
|
|
1479
|
+
return result;
|
|
1480
|
+
}
|
|
1481
|
+
if (plane.kind === "RoutePlane") {
|
|
1482
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1483
|
+
const result = {
|
|
1484
|
+
kind: kind,
|
|
1485
|
+
data: data,
|
|
1486
|
+
parent: parent,
|
|
1487
|
+
match: match
|
|
1488
|
+
};
|
|
1489
|
+
return result;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
for (const planePath of this.planesKeys) {
|
|
1493
|
+
const normalizedPlanePath = planePath.replace(pluridData.protocols.plurid, "");
|
|
1494
|
+
const normalizedPlaneAddress = planeAddress.replace(pluridData.protocols.plurid, "");
|
|
1495
|
+
const planePathSplit = normalizedPlanePath.split("/");
|
|
1496
|
+
const planeAddressSplit = normalizedPlaneAddress.split("/");
|
|
1497
|
+
if (planePathSplit[0] !== planeAddressSplit[0]) {
|
|
1498
|
+
continue;
|
|
1499
|
+
}
|
|
1500
|
+
if (planePathSplit.length !== planeAddressSplit.length) {
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
const parametersAndMatch = extractParametersAndMatch(normalizedPlaneAddress, normalizedPlanePath);
|
|
1504
|
+
if (parametersAndMatch.match) {
|
|
1505
|
+
const plane = this.planesIndex.get(planePath);
|
|
1506
|
+
if (!plane) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1510
|
+
const validPath = checkValidPath(plane.data.parameters, parameters);
|
|
1511
|
+
if (!validPath) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
const query = extractQuery(value);
|
|
1515
|
+
const fragments = extractFragments(value);
|
|
1516
|
+
const match = {
|
|
1517
|
+
value: planeAddress,
|
|
1518
|
+
fragments: fragments,
|
|
1519
|
+
query: query,
|
|
1520
|
+
parameters: parameters
|
|
1521
|
+
};
|
|
1522
|
+
if (plane.kind === "Plane") {
|
|
1523
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1524
|
+
const result = {
|
|
1525
|
+
kind: kind,
|
|
1526
|
+
data: data,
|
|
1527
|
+
parent: parent,
|
|
1528
|
+
match: match
|
|
1529
|
+
};
|
|
1530
|
+
return result;
|
|
1531
|
+
}
|
|
1532
|
+
if (plane.kind === "RoutePlane") {
|
|
1533
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1534
|
+
const result = {
|
|
1535
|
+
kind: kind,
|
|
1536
|
+
data: data,
|
|
1537
|
+
parent: parent,
|
|
1538
|
+
match: match
|
|
1539
|
+
};
|
|
1540
|
+
return result;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
matchRoute(value) {
|
|
1547
|
+
const routeValue = cleanPathValue(value);
|
|
1548
|
+
const route = this.routesIndex.get(routeValue);
|
|
1549
|
+
if (route) {
|
|
1550
|
+
const query = extractQuery(value);
|
|
1551
|
+
const result = {
|
|
1552
|
+
kind: "Route",
|
|
1553
|
+
data: route.data,
|
|
1554
|
+
match: {
|
|
1555
|
+
value: routeValue,
|
|
1556
|
+
query: query,
|
|
1557
|
+
parameters: {}
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
return result;
|
|
1561
|
+
}
|
|
1562
|
+
for (const routePath of this.routesKeys) {
|
|
1563
|
+
const routeSplit = routePath.split("/");
|
|
1564
|
+
const valueSplit = routeValue.split("/");
|
|
1565
|
+
if (routeSplit.length !== valueSplit.length) {
|
|
1566
|
+
continue;
|
|
1567
|
+
}
|
|
1568
|
+
const parametersAndMatch = extractParametersAndMatch(routeValue.slice(1), routePath.slice(1));
|
|
1569
|
+
if (parametersAndMatch.match) {
|
|
1570
|
+
const route = this.routesIndex.get(routePath);
|
|
1571
|
+
if (!route) {
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1575
|
+
const validPath = checkValidPath(route.data.parameters, parameters);
|
|
1576
|
+
if (!validPath) {
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
const query = extractQuery(routeValue);
|
|
1580
|
+
const match = {
|
|
1581
|
+
value: routeValue,
|
|
1582
|
+
query: query,
|
|
1583
|
+
parameters: parameters
|
|
1584
|
+
};
|
|
1585
|
+
if (route) {
|
|
1586
|
+
const result = {
|
|
1587
|
+
kind: "Route",
|
|
1588
|
+
data: route.data,
|
|
1589
|
+
match: match
|
|
1590
|
+
};
|
|
1591
|
+
return result;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
const routePlane = this.matchPlane(routeValue);
|
|
1596
|
+
if (routePlane) {
|
|
1597
|
+
const result = {
|
|
1598
|
+
kind: "RoutePlane",
|
|
1599
|
+
data: routePlane.data,
|
|
1600
|
+
match: {
|
|
1601
|
+
value: routeValue,
|
|
1602
|
+
query: routePlane.match.query,
|
|
1603
|
+
parameters: routePlane.match.parameters
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
return result;
|
|
1607
|
+
}
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
class Parser {
|
|
1613
|
+
constructor(location, path, options) {
|
|
1614
|
+
this.location = location;
|
|
1615
|
+
this.path = path;
|
|
1616
|
+
this.options = this.handleOptions(options);
|
|
1617
|
+
}
|
|
1618
|
+
handleOptions(options) {
|
|
1619
|
+
const parserOptions = {
|
|
1620
|
+
fragment: (options === null || options === void 0 ? void 0 : options.fragment) || true
|
|
1621
|
+
};
|
|
1622
|
+
return parserOptions;
|
|
1623
|
+
}
|
|
1624
|
+
extractPathname() {
|
|
1625
|
+
const pathname = extractPathname(this.location);
|
|
1626
|
+
return pathname;
|
|
1627
|
+
}
|
|
1628
|
+
extractParametersAndMatch() {
|
|
1629
|
+
const parametersAndMatch = extractParametersAndMatch(this.location, this.path.value);
|
|
1630
|
+
return parametersAndMatch;
|
|
1631
|
+
}
|
|
1632
|
+
extractQuery() {
|
|
1633
|
+
const query = extractQuery(this.location);
|
|
1634
|
+
return query;
|
|
1635
|
+
}
|
|
1636
|
+
extractFragments() {
|
|
1637
|
+
const fragments = this.options.fragment ? extractFragments(this.location) : extractFragments();
|
|
1638
|
+
return fragments;
|
|
1639
|
+
}
|
|
1640
|
+
extract() {
|
|
1641
|
+
const pathname = this.extractPathname();
|
|
1642
|
+
const {match: match, parameters: parameters, elements: elements} = this.extractParametersAndMatch();
|
|
1643
|
+
const query = this.extractQuery();
|
|
1644
|
+
const queryData = Object.entries(query).map((([key, value]) => key + "=" + value)).join("&");
|
|
1645
|
+
const queryString = queryData ? "?" + queryData : "";
|
|
1646
|
+
const fragments = this.extractFragments();
|
|
1647
|
+
const parserResponse = {
|
|
1648
|
+
path: this.path,
|
|
1649
|
+
pathname: pathname,
|
|
1650
|
+
elements: elements,
|
|
1651
|
+
match: match,
|
|
1652
|
+
parameters: parameters,
|
|
1653
|
+
query: query,
|
|
1654
|
+
fragments: fragments,
|
|
1655
|
+
route: pathname + queryString
|
|
1656
|
+
};
|
|
1657
|
+
return parserResponse;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
var index$9 = Object.freeze({
|
|
1662
|
+
__proto__: null,
|
|
1663
|
+
IsoMatcher: IsoMatcher,
|
|
1664
|
+
RouteParser: Parser,
|
|
1665
|
+
extractQuery: extractQuery,
|
|
1666
|
+
stringInsertInitial: stringInsertInitial,
|
|
1667
|
+
stringRemoveTrailing: stringRemoveTrailing,
|
|
1668
|
+
cleanupPath: cleanupPath,
|
|
1669
|
+
computePlaneAddress: computePlaneAddress,
|
|
1670
|
+
isAbsolutePlane: isAbsolutePlane,
|
|
1671
|
+
checkPlaneAddressType: checkPlaneAddressType,
|
|
1672
|
+
removeTrailingSlash: removeTrailingSlash,
|
|
1673
|
+
cleanPathValue: cleanPathValue,
|
|
1674
|
+
checkParameterLength: checkParameterLength,
|
|
1675
|
+
checkValidPath: checkValidPath,
|
|
1676
|
+
mapPathsToRoutes: mapPathsToRoutes,
|
|
1677
|
+
pluridLinkPathDivider: pluridLinkPathDivider,
|
|
1678
|
+
resolveRoute: resolveRoute
|
|
1679
|
+
});
|
|
1680
|
+
|
|
1681
|
+
class PluridPlanesRegistrar {
|
|
1682
|
+
constructor(planes) {
|
|
1683
|
+
this.isoMatcher = new IsoMatcher({
|
|
1684
|
+
planes: planes
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
register(planes) {
|
|
1688
|
+
this.isoMatcher.index({
|
|
1689
|
+
planes: planes
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
identify() {
|
|
1693
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1694
|
+
return [ ...planes.keys() ];
|
|
1695
|
+
}
|
|
1696
|
+
get(route) {
|
|
1697
|
+
const match = this.isoMatcher.match(route);
|
|
1698
|
+
if (match) {
|
|
1699
|
+
const absoluteRoute = match.kind === "Plane" ? match.data.route : match.data.value;
|
|
1700
|
+
const registeredPlane = {
|
|
1701
|
+
route: {
|
|
1702
|
+
absolute: absoluteRoute,
|
|
1703
|
+
fragments: match.match.fragments,
|
|
1704
|
+
parameters: match.match.parameters,
|
|
1705
|
+
query: match.match.query
|
|
1706
|
+
},
|
|
1707
|
+
component: match.data.component
|
|
1708
|
+
};
|
|
1709
|
+
return registeredPlane;
|
|
1710
|
+
}
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
getAll() {
|
|
1714
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1715
|
+
const all = new Map;
|
|
1716
|
+
for (const [path, plane] of planes) {
|
|
1717
|
+
const absoluteRoute = plane.kind === "Plane" ? plane.data.route : plane.data.value;
|
|
1718
|
+
const registeredPlane = {
|
|
1719
|
+
route: {
|
|
1720
|
+
absolute: absoluteRoute,
|
|
1721
|
+
fragments: {
|
|
1722
|
+
elements: [],
|
|
1723
|
+
texts: []
|
|
1724
|
+
},
|
|
1725
|
+
parameters: {},
|
|
1726
|
+
query: {}
|
|
1727
|
+
},
|
|
1728
|
+
component: plane.data.component
|
|
1729
|
+
};
|
|
1730
|
+
all.set(path, registeredPlane);
|
|
1731
|
+
}
|
|
1732
|
+
return all;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
const registerPlanes = (planes, planesRegistrar) => {
|
|
1737
|
+
if (!planes) {
|
|
1738
|
+
return;
|
|
1592
1739
|
}
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
|
|
1740
|
+
if (planesRegistrar) {
|
|
1741
|
+
planesRegistrar.register(planes);
|
|
1742
|
+
return;
|
|
1596
1743
|
}
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1599
|
-
valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1744
|
+
if (typeof window === "undefined") {
|
|
1745
|
+
return;
|
|
1600
1746
|
}
|
|
1601
|
-
if (
|
|
1602
|
-
|
|
1603
|
-
|
|
1747
|
+
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
1748
|
+
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
1749
|
+
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
1750
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1751
|
+
return;
|
|
1604
1752
|
}
|
|
1605
|
-
|
|
1606
|
-
return
|
|
1607
|
-
}
|
|
1753
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1754
|
+
return;
|
|
1755
|
+
};
|
|
1608
1756
|
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
const translateY = transformTranslate.translateY;
|
|
1617
|
-
const translateZ = transformTranslate.translateZ;
|
|
1618
|
-
let scale = getTransformScale(matrix3d).scale;
|
|
1619
|
-
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1620
|
-
const valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1621
|
-
let valScalationMatrix = scaleMatrix(scale);
|
|
1622
|
-
if (direction === "up") {
|
|
1623
|
-
scale -= scaleIncrement;
|
|
1624
|
-
if (scale < .1) {
|
|
1625
|
-
scale = .1;
|
|
1757
|
+
const getPlanesRegistrar = planesRegistrar => {
|
|
1758
|
+
if (planesRegistrar) {
|
|
1759
|
+
return planesRegistrar;
|
|
1760
|
+
}
|
|
1761
|
+
if (typeof window !== "undefined") {
|
|
1762
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1763
|
+
return window.__pluridPlanesRegistrar__;
|
|
1626
1764
|
}
|
|
1627
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1628
1765
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1766
|
+
return;
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
const getRegisteredPlanes = planesRegistrar => {
|
|
1770
|
+
if (planesRegistrar) {
|
|
1771
|
+
return planesRegistrar.getAll();
|
|
1772
|
+
}
|
|
1773
|
+
if (typeof window !== "undefined") {
|
|
1774
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1775
|
+
return window.__pluridPlanesRegistrar__.getAll();
|
|
1633
1776
|
}
|
|
1634
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1635
1777
|
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1778
|
+
return new Map;
|
|
1779
|
+
};
|
|
1780
|
+
|
|
1781
|
+
const getRegisteredPlane = (route, planesRegistrar) => {
|
|
1782
|
+
if (planesRegistrar) {
|
|
1783
|
+
return planesRegistrar.get(route);
|
|
1784
|
+
}
|
|
1785
|
+
if (typeof window !== "undefined") {
|
|
1786
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1787
|
+
return window.__pluridPlanesRegistrar__.get(route);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
return;
|
|
1791
|
+
};
|
|
1639
1792
|
|
|
1640
1793
|
var index$8 = Object.freeze({
|
|
1641
1794
|
__proto__: null,
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
scalePlurid: scalePlurid
|
|
1795
|
+
resolvePluridPlaneData: resolvePluridPlaneData,
|
|
1796
|
+
resolvePluridRoutePlaneData: resolvePluridRoutePlaneData,
|
|
1797
|
+
createInternalStatePlane: createInternalStatePlane,
|
|
1798
|
+
createInternalContextPlane: createInternalContextPlane,
|
|
1799
|
+
getPluridPlaneIDByData: getPluridPlaneIDByData,
|
|
1800
|
+
registerPlanes: registerPlanes,
|
|
1801
|
+
getPlanesRegistrar: getPlanesRegistrar,
|
|
1802
|
+
getRegisteredPlanes: getRegisteredPlanes,
|
|
1803
|
+
getRegisteredPlane: getRegisteredPlane,
|
|
1804
|
+
Registrar: PluridPlanesRegistrar
|
|
1653
1805
|
});
|
|
1654
1806
|
|
|
1655
1807
|
const computeSpaceSize = tree => {
|
|
@@ -1973,93 +2125,29 @@ var index$5 = Object.freeze({
|
|
|
1973
2125
|
computeZigZagLayout: computeZigZagLayout
|
|
1974
2126
|
});
|
|
1975
2127
|
|
|
1976
|
-
const matchRouteElements = (routePath, viewPath) => {
|
|
1977
|
-
if (routePath === viewPath) {
|
|
1978
|
-
return {
|
|
1979
|
-
value: viewPath,
|
|
1980
|
-
parameters: {},
|
|
1981
|
-
query: {}
|
|
1982
|
-
};
|
|
1983
|
-
}
|
|
1984
|
-
const parameters = [];
|
|
1985
|
-
const routeSplit = routePath.split("/");
|
|
1986
|
-
routeSplit.forEach((routeElement => {
|
|
1987
|
-
if (routeElement[0] === ":") {
|
|
1988
|
-
parameters.push(routeElement);
|
|
1989
|
-
} else {
|
|
1990
|
-
parameters.push("");
|
|
1991
|
-
}
|
|
1992
|
-
}));
|
|
1993
|
-
const {locationElements: locationElements, comparingPath: comparingPath} = computeComparingPath(viewPath, parameters);
|
|
1994
|
-
if (comparingPath !== "/" + routePath) {
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
const parametersValues = extractParametersValues(parameters, locationElements);
|
|
1998
|
-
return {
|
|
1999
|
-
value: viewPath,
|
|
2000
|
-
parameters: parametersValues,
|
|
2001
|
-
query: {}
|
|
2002
|
-
};
|
|
2003
|
-
};
|
|
2004
|
-
|
|
2005
|
-
const matchRouteToView = (route, view) => {
|
|
2006
|
-
const routeSplit = route.split(pluridData.PLURID_ROUTE_SEPARATOR);
|
|
2007
|
-
const viewSplit = view.split(pluridData.PLURID_ROUTE_SEPARATOR);
|
|
2008
|
-
if (routeSplit.length !== viewSplit.length) {
|
|
2009
|
-
return;
|
|
2010
|
-
}
|
|
2011
|
-
const routePath = routeSplit[2];
|
|
2012
|
-
const viewPath = viewSplit[2];
|
|
2013
|
-
const pathMatch = matchRouteElements(routePath, viewPath);
|
|
2014
|
-
if (!pathMatch) {
|
|
2015
|
-
return;
|
|
2016
|
-
}
|
|
2017
|
-
const routeSpace = routeSplit[3];
|
|
2018
|
-
const viewSpace = viewSplit[3];
|
|
2019
|
-
const spaceMatch = matchRouteElements(routeSpace, viewSpace);
|
|
2020
|
-
if (!spaceMatch) {
|
|
2021
|
-
return;
|
|
2022
|
-
}
|
|
2023
|
-
const routeUniverse = routeSplit[4];
|
|
2024
|
-
const viewUniverse = viewSplit[4];
|
|
2025
|
-
const universeMatch = matchRouteElements(routeUniverse, viewUniverse);
|
|
2026
|
-
if (!universeMatch) {
|
|
2027
|
-
return;
|
|
2028
|
-
}
|
|
2029
|
-
const routeCluster = routeSplit[5];
|
|
2030
|
-
const viewCluster = viewSplit[5];
|
|
2031
|
-
const clusterMatch = matchRouteElements(routeCluster, viewCluster);
|
|
2032
|
-
if (!clusterMatch) {
|
|
2033
|
-
return;
|
|
2034
|
-
}
|
|
2035
|
-
const routePlane = routeSplit[6];
|
|
2036
|
-
const viewPlane = viewSplit[6];
|
|
2037
|
-
const planeMatch = matchRouteElements(routePlane, viewPlane);
|
|
2038
|
-
if (!planeMatch) {
|
|
2039
|
-
return;
|
|
2040
|
-
}
|
|
2041
|
-
return {
|
|
2042
|
-
path: Object.assign({}, pathMatch),
|
|
2043
|
-
space: Object.assign({}, spaceMatch),
|
|
2044
|
-
universe: Object.assign({}, universeMatch),
|
|
2045
|
-
cluster: Object.assign({}, clusterMatch),
|
|
2046
|
-
plane: Object.assign({}, planeMatch)
|
|
2047
|
-
};
|
|
2048
|
-
};
|
|
2049
|
-
|
|
2050
2128
|
const resolveViewItem = (planes, view, configuration) => {
|
|
2051
2129
|
const {protocol: protocol, host: host} = configuration.network;
|
|
2052
2130
|
const viewData = typeof view === "string" ? view : view.plane;
|
|
2053
|
-
const
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2131
|
+
const viewAddress = computePlaneAddress(viewData);
|
|
2132
|
+
const iPlanes = planes.values();
|
|
2133
|
+
const pluridPlanes = [];
|
|
2134
|
+
for (const iPlane of iPlanes) {
|
|
2135
|
+
const plane = {
|
|
2136
|
+
route: iPlane.route.absolute,
|
|
2137
|
+
component: iPlane.component
|
|
2138
|
+
};
|
|
2139
|
+
pluridPlanes.push(plane);
|
|
2140
|
+
}
|
|
2141
|
+
const isoMatcher = new IsoMatcher({
|
|
2142
|
+
planes: pluridPlanes
|
|
2143
|
+
});
|
|
2144
|
+
const match = isoMatcher.match(viewData);
|
|
2145
|
+
if (match) {
|
|
2146
|
+
const route = match.match.value;
|
|
2059
2147
|
const treePlane = {
|
|
2060
2148
|
sourceID: route,
|
|
2061
2149
|
planeID: pluridFunctions.uuid.generate(),
|
|
2062
|
-
route:
|
|
2150
|
+
route: viewAddress,
|
|
2063
2151
|
routeDivisions: {
|
|
2064
2152
|
protocol: {
|
|
2065
2153
|
value: "",
|
|
@@ -2069,11 +2157,35 @@ const resolveViewItem = (planes, view, configuration) => {
|
|
|
2069
2157
|
value: host,
|
|
2070
2158
|
controlled: true
|
|
2071
2159
|
},
|
|
2072
|
-
path:
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2160
|
+
path: {
|
|
2161
|
+
parameters: {},
|
|
2162
|
+
query: {},
|
|
2163
|
+
value: ""
|
|
2164
|
+
},
|
|
2165
|
+
space: {
|
|
2166
|
+
parameters: {},
|
|
2167
|
+
query: {},
|
|
2168
|
+
value: ""
|
|
2169
|
+
},
|
|
2170
|
+
universe: {
|
|
2171
|
+
parameters: {},
|
|
2172
|
+
query: {},
|
|
2173
|
+
value: ""
|
|
2174
|
+
},
|
|
2175
|
+
cluster: {
|
|
2176
|
+
parameters: {},
|
|
2177
|
+
query: {},
|
|
2178
|
+
value: ""
|
|
2179
|
+
},
|
|
2180
|
+
plane: {
|
|
2181
|
+
parameters: {},
|
|
2182
|
+
fragments: {
|
|
2183
|
+
elements: [],
|
|
2184
|
+
texts: []
|
|
2185
|
+
},
|
|
2186
|
+
query: {},
|
|
2187
|
+
value: ""
|
|
2188
|
+
},
|
|
2077
2189
|
valid: true
|
|
2078
2190
|
},
|
|
2079
2191
|
height: 0,
|
|
@@ -2180,16 +2292,16 @@ const assignPagesFromView = (planes, view) => {
|
|
|
2180
2292
|
};
|
|
2181
2293
|
|
|
2182
2294
|
const updateTreePlane = (tree, updatedPage) => {
|
|
2183
|
-
const updatedTree = tree.map((
|
|
2184
|
-
if (
|
|
2295
|
+
const updatedTree = tree.map((treePlane => {
|
|
2296
|
+
if (treePlane.planeID === updatedPage.planeID) {
|
|
2185
2297
|
return updatedPage;
|
|
2186
2298
|
}
|
|
2187
|
-
if (
|
|
2188
|
-
const pageTree = updateTreePlane(
|
|
2189
|
-
|
|
2190
|
-
return
|
|
2299
|
+
if (treePlane.children) {
|
|
2300
|
+
const pageTree = updateTreePlane(treePlane.children, updatedPage);
|
|
2301
|
+
treePlane.children = pageTree;
|
|
2302
|
+
return treePlane;
|
|
2191
2303
|
}
|
|
2192
|
-
return
|
|
2304
|
+
return treePlane;
|
|
2193
2305
|
}));
|
|
2194
2306
|
return updatedTree;
|
|
2195
2307
|
};
|
|
@@ -2232,7 +2344,8 @@ const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree
|
|
|
2232
2344
|
const updatedTree = updateTreePlane(tree, updatedParentPlane);
|
|
2233
2345
|
return {
|
|
2234
2346
|
pluridPlaneID: updatedTreePlane.planeID,
|
|
2235
|
-
updatedTree: updatedTree
|
|
2347
|
+
updatedTree: updatedTree,
|
|
2348
|
+
updatedTreePlane: updatedTreePlane
|
|
2236
2349
|
};
|
|
2237
2350
|
};
|
|
2238
2351
|
|
|
@@ -2352,24 +2465,32 @@ const toggleChildren = children => {
|
|
|
2352
2465
|
|
|
2353
2466
|
const togglePlaneFromTree = (tree, pluridPlaneID) => {
|
|
2354
2467
|
const updatedTree = [];
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2468
|
+
let updatedPlane;
|
|
2469
|
+
for (const plane of tree) {
|
|
2470
|
+
if (plane.planeID === pluridPlaneID) {
|
|
2471
|
+
const treeUpdatedPlane = Object.assign(Object.assign({}, plane), {
|
|
2472
|
+
show: !plane.show,
|
|
2359
2473
|
children: []
|
|
2360
2474
|
});
|
|
2361
|
-
updatedTree.push(
|
|
2475
|
+
updatedTree.push(treeUpdatedPlane);
|
|
2476
|
+
updatedPlane = Object.assign({}, treeUpdatedPlane);
|
|
2362
2477
|
continue;
|
|
2363
2478
|
}
|
|
2364
|
-
if (
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
updatedTree.push(
|
|
2479
|
+
if (plane.children) {
|
|
2480
|
+
const {updatedTree: childrenUpdatedTree, updatedPlane: childrenUpdatedPlane} = togglePlaneFromTree(plane.children, pluridPlaneID);
|
|
2481
|
+
plane.children = [ ...childrenUpdatedTree ];
|
|
2482
|
+
updatedTree.push(plane);
|
|
2483
|
+
if (childrenUpdatedPlane) {
|
|
2484
|
+
updatedPlane = Object.assign({}, childrenUpdatedPlane);
|
|
2485
|
+
}
|
|
2368
2486
|
continue;
|
|
2369
2487
|
}
|
|
2370
|
-
updatedTree.push(
|
|
2488
|
+
updatedTree.push(plane);
|
|
2371
2489
|
}
|
|
2372
|
-
return
|
|
2490
|
+
return {
|
|
2491
|
+
updatedTree: updatedTree,
|
|
2492
|
+
updatedPlane: updatedPlane
|
|
2493
|
+
};
|
|
2373
2494
|
};
|
|
2374
2495
|
|
|
2375
2496
|
var logic = Object.freeze({
|
|
@@ -2461,106 +2582,6 @@ var index$2 = Object.freeze({
|
|
|
2461
2582
|
view: index$3
|
|
2462
2583
|
});
|
|
2463
2584
|
|
|
2464
|
-
class PluridPlanesRegistrar {
|
|
2465
|
-
constructor() {
|
|
2466
|
-
this.planes = new Map;
|
|
2467
|
-
}
|
|
2468
|
-
register(planes) {
|
|
2469
|
-
for (const plane of planes) {
|
|
2470
|
-
const {component: component, route: route} = plane;
|
|
2471
|
-
const resolvedRoute = resolveRoute(route, "http", "localhost");
|
|
2472
|
-
const {protocol: protocol, host: host, path: routePath, space: space, universe: universe, cluster: cluster, plane: planePath, route: absoluteRoute} = resolvedRoute;
|
|
2473
|
-
const registeredPluridPlane = {
|
|
2474
|
-
component: component,
|
|
2475
|
-
route: {
|
|
2476
|
-
protocol: {},
|
|
2477
|
-
host: {},
|
|
2478
|
-
path: {},
|
|
2479
|
-
space: {},
|
|
2480
|
-
universe: {},
|
|
2481
|
-
cluster: {},
|
|
2482
|
-
plane: {},
|
|
2483
|
-
absolute: absoluteRoute
|
|
2484
|
-
}
|
|
2485
|
-
};
|
|
2486
|
-
this.planes.set(absoluteRoute, registeredPluridPlane);
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
|
-
identify() {
|
|
2490
|
-
if (this.planes.size === 0) {
|
|
2491
|
-
return [];
|
|
2492
|
-
}
|
|
2493
|
-
const ids = [];
|
|
2494
|
-
for (const [id, _] of this.planes) {
|
|
2495
|
-
ids.push(id);
|
|
2496
|
-
}
|
|
2497
|
-
return ids;
|
|
2498
|
-
}
|
|
2499
|
-
get(route) {
|
|
2500
|
-
return this.planes.get(route);
|
|
2501
|
-
}
|
|
2502
|
-
getAll() {
|
|
2503
|
-
return this.planes;
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
const registerPlanes = (planes, planesRegistrar) => {
|
|
2508
|
-
if (!planes) {
|
|
2509
|
-
return;
|
|
2510
|
-
}
|
|
2511
|
-
if (planesRegistrar) {
|
|
2512
|
-
planesRegistrar.register(planes);
|
|
2513
|
-
return;
|
|
2514
|
-
}
|
|
2515
|
-
if (typeof window === "undefined") {
|
|
2516
|
-
return;
|
|
2517
|
-
}
|
|
2518
|
-
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
2519
|
-
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
2520
|
-
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
2521
|
-
window.__pluridPlanesRegistrar__.register(planes);
|
|
2522
|
-
return;
|
|
2523
|
-
}
|
|
2524
|
-
window.__pluridPlanesRegistrar__.register(planes);
|
|
2525
|
-
return;
|
|
2526
|
-
};
|
|
2527
|
-
|
|
2528
|
-
const getPlanesRegistrar = planesRegistrar => {
|
|
2529
|
-
if (planesRegistrar) {
|
|
2530
|
-
return planesRegistrar;
|
|
2531
|
-
}
|
|
2532
|
-
if (typeof window !== "undefined") {
|
|
2533
|
-
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
2534
|
-
return window.__pluridPlanesRegistrar__;
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
return;
|
|
2538
|
-
};
|
|
2539
|
-
|
|
2540
|
-
const getRegisteredPlanes = planesRegistrar => {
|
|
2541
|
-
if (planesRegistrar) {
|
|
2542
|
-
return planesRegistrar.getAll();
|
|
2543
|
-
}
|
|
2544
|
-
if (typeof window !== "undefined") {
|
|
2545
|
-
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
2546
|
-
return window.__pluridPlanesRegistrar__.getAll();
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
return new Map;
|
|
2550
|
-
};
|
|
2551
|
-
|
|
2552
|
-
const getRegisteredPlane = (route, planesRegistrar) => {
|
|
2553
|
-
if (planesRegistrar) {
|
|
2554
|
-
return planesRegistrar.get(route);
|
|
2555
|
-
}
|
|
2556
|
-
if (typeof window !== "undefined") {
|
|
2557
|
-
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
2558
|
-
return window.__pluridPlanesRegistrar__.get(route);
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
return;
|
|
2562
|
-
};
|
|
2563
|
-
|
|
2564
2585
|
const resolveSpace = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState) => {
|
|
2565
2586
|
const registeredPlanes = getRegisteredPlanes(planesRegistrar);
|
|
2566
2587
|
const spaceTree = new Tree({
|
|
@@ -2702,33 +2723,37 @@ var index = Object.freeze({
|
|
|
2702
2723
|
local: index$1
|
|
2703
2724
|
});
|
|
2704
2725
|
|
|
2705
|
-
|
|
2726
|
+
const cleanTemplate = template => template.replace(/(?:\r\n|\r|\n)/g, " ").replace(/ +/g, " ").trim();
|
|
2706
2727
|
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2728
|
+
const pluridRouterNavigate = path => {
|
|
2729
|
+
if (!CustomEvent || !window) {
|
|
2730
|
+
return;
|
|
2731
|
+
}
|
|
2732
|
+
const event = new CustomEvent(pluridData.PLURID_ROUTER_LOCATION_CHANGED, {
|
|
2733
|
+
detail: {
|
|
2734
|
+
path: path
|
|
2735
|
+
}
|
|
2736
|
+
});
|
|
2737
|
+
window.dispatchEvent(event);
|
|
2738
|
+
};
|
|
2710
2739
|
|
|
2711
|
-
exports.
|
|
2740
|
+
exports.cleanTemplate = cleanTemplate;
|
|
2712
2741
|
|
|
2713
|
-
exports.
|
|
2742
|
+
exports.general = index$h;
|
|
2714
2743
|
|
|
2715
|
-
exports.
|
|
2744
|
+
exports.interaction = index$a;
|
|
2716
2745
|
|
|
2717
2746
|
exports.internatiolate = internatiolate;
|
|
2718
2747
|
|
|
2719
|
-
exports.
|
|
2748
|
+
exports.planes = index$8;
|
|
2720
2749
|
|
|
2721
|
-
exports.
|
|
2750
|
+
exports.pluridRouterNavigate = pluridRouterNavigate;
|
|
2722
2751
|
|
|
2723
|
-
exports.
|
|
2724
|
-
|
|
2725
|
-
exports.router = index$e;
|
|
2752
|
+
exports.routing = index$9;
|
|
2726
2753
|
|
|
2727
2754
|
exports.space = index$2;
|
|
2728
2755
|
|
|
2729
2756
|
exports.state = index;
|
|
2730
2757
|
|
|
2731
|
-
exports.
|
|
2732
|
-
|
|
2733
|
-
exports.utilities = index$f;
|
|
2758
|
+
exports.utilities = index$j;
|
|
2734
2759
|
//# sourceMappingURL=index.js.map
|