@plurid/plurid-engine 0.0.0-1 → 0.0.0-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distribution/functions/index.d.ts +2 -0
- package/distribution/functions/navigate/index.d.ts +1 -0
- package/distribution/functions/template/index.d.ts +1 -0
- package/distribution/index.d.ts +2 -2
- package/distribution/index.es.js +893 -858
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +876 -851
- package/distribution/index.js.map +1 -1
- package/distribution/modules/general/configuration/index.d.ts +2 -0
- package/distribution/modules/general/index.d.ts +3 -0
- package/distribution/modules/{setup/general → general}/tree/index.d.ts +1 -1
- package/distribution/modules/index.d.ts +9 -12
- package/distribution/modules/interaction/direction/index.d.ts +1 -1
- package/distribution/modules/interaction/index.d.ts +5 -0
- package/distribution/modules/interaction/mathematics/transform/general/index.d.ts +9 -0
- package/distribution/modules/interaction/mathematics/transform/index.d.ts +3 -69
- package/distribution/modules/interaction/mathematics/transform/matrix3d/index.d.ts +69 -0
- package/distribution/modules/{setup/internationalization → internationalization}/index.d.ts +0 -0
- package/distribution/modules/planes/index.d.ts +2 -0
- package/distribution/modules/planes/logic/index.d.ts +6 -0
- package/distribution/modules/planes/registrar/index.d.ts +3 -0
- package/distribution/modules/{setup/objects/PlanesRegistrar → planes/registrar}/object.d.ts +6 -5
- package/distribution/modules/planes/registrar/utilities.d.ts +6 -0
- package/distribution/modules/routing/IsoMatcher/index.d.ts +44 -0
- package/distribution/modules/{setup/router → routing}/Parser/index.d.ts +4 -4
- package/distribution/modules/{setup/router → routing}/Parser/interfaces.d.ts +10 -2
- package/distribution/modules/{setup/router → routing}/Parser/logic.d.ts +2 -2
- package/distribution/modules/routing/index.d.ts +6 -0
- package/distribution/modules/routing/logic/general/index.d.ts +8 -0
- package/distribution/modules/routing/logic/index.d.ts +3 -0
- package/distribution/modules/{setup/router → routing/logic}/utilities/index.d.ts +11 -2
- package/distribution/modules/routing/logic/validity/index.d.ts +3 -0
- package/distribution/modules/space/index.d.ts +6 -0
- package/distribution/modules/{setup/space → space}/layout/column.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/layout/faceToFace.d.ts +0 -0
- package/distribution/modules/space/layout/index.d.ts +6 -0
- package/distribution/modules/{setup/space → space}/layout/row.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/layout/sheaves.d.ts +0 -0
- package/distribution/modules/{setup/space → space}/layout/zigZag.d.ts +0 -0
- package/distribution/modules/{setup/space → space}/location/index.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/location/logic.d.ts +1 -1
- package/distribution/modules/space/tree/index.d.ts +3 -0
- package/distribution/modules/space/tree/logic.d.ts +37 -0
- package/distribution/modules/space/tree/object.d.ts +14 -0
- package/distribution/modules/{setup/space → space}/utilities/index.d.ts +0 -0
- package/distribution/modules/{setup/space → space}/view/index.d.ts +1 -1
- package/distribution/modules/{setup/space → space}/view/logic.d.ts +0 -0
- package/distribution/modules/state/compute/index.d.ts +3 -0
- package/distribution/modules/state/compute/space/index.d.ts +3 -0
- package/distribution/modules/{setup/state → state}/compute/themes/index.d.ts +0 -0
- package/distribution/modules/state/index.d.ts +3 -0
- package/distribution/modules/{setup/state → state}/local/index.d.ts +0 -0
- package/package.json +31 -31
- package/distribution/data/constants/index.d.ts +0 -1
- package/distribution/data/interfaces/index.d.ts +0 -4
- package/distribution/modules/setup/general/configuration/index.d.ts +0 -2
- package/distribution/modules/setup/general/helpers/identified.d.ts +0 -1
- package/distribution/modules/setup/general/helpers/index.d.ts +0 -2
- package/distribution/modules/setup/general/helpers/indexed.d.ts +0 -6
- package/distribution/modules/setup/general/index.d.ts +0 -7
- package/distribution/modules/setup/general/paths/index.d.ts +0 -8
- package/distribution/modules/setup/general/planes/index.d.ts +0 -4
- package/distribution/modules/setup/general/universes/index.d.ts +0 -21
- package/distribution/modules/setup/objects/PlanesRegistrar/index.d.ts +0 -3
- package/distribution/modules/setup/objects/PlanesRegistrar/utilities.d.ts +0 -6
- package/distribution/modules/setup/router/Matcher/index.d.ts +0 -15
- package/distribution/modules/setup/router/Matcher/interfaces.d.ts +0 -12
- package/distribution/modules/setup/router/Matcher/logic.d.ts +0 -4
- package/distribution/modules/setup/router/Router/index.d.ts +0 -28
- package/distribution/modules/setup/router/Router/interfaces.d.ts +0 -8
- package/distribution/modules/setup/router/URLRouter/data.d.ts +0 -27
- package/distribution/modules/setup/router/URLRouter/index.d.ts +0 -8
- package/distribution/modules/setup/router/URLRouter/logic.d.ts +0 -12
- package/distribution/modules/setup/router/index.d.ts +0 -11
- package/distribution/modules/setup/router/interfaces.d.ts +0 -3
- package/distribution/modules/setup/space/index.d.ts +0 -6
- package/distribution/modules/setup/space/layout/index.d.ts +0 -6
- package/distribution/modules/setup/space/tree/index.d.ts +0 -3
- package/distribution/modules/setup/space/tree/logic.d.ts +0 -33
- package/distribution/modules/setup/space/tree/object.d.ts +0 -13
- package/distribution/modules/setup/state/compute/index.d.ts +0 -3
- package/distribution/modules/setup/state/compute/space/index.d.ts +0 -3
- package/distribution/modules/setup/state/index.d.ts +0 -3
package/distribution/index.js
CHANGED
|
@@ -18,42 +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
|
-
const specifiedOrDefault = (path, type, configuration) => {
|
|
50
|
-
const item = pluridFunctions.objects.getNested(configuration, path);
|
|
51
|
-
if (typeof item === type) {
|
|
52
|
-
return item;
|
|
53
|
-
}
|
|
54
|
-
return pluridFunctions.objects.getNested(pluridData.defaultConfiguration, path);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
21
|
const resolveTheme = (theme, type) => {
|
|
58
22
|
if (!theme) {
|
|
59
23
|
return "plurid";
|
|
@@ -80,6 +44,13 @@ const merge = (configuration, target) => {
|
|
|
80
44
|
if (!configuration) {
|
|
81
45
|
return Object.assign({}, targetConfiguration);
|
|
82
46
|
}
|
|
47
|
+
const specifiedOrDefault = (path, type, configuration) => {
|
|
48
|
+
const item = pluridFunctions.objects.getNested(configuration, path);
|
|
49
|
+
if (typeof item === type) {
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
return pluridFunctions.objects.getNested(targetConfiguration, path);
|
|
53
|
+
};
|
|
83
54
|
const layout = configuration && configuration.space && typeof configuration.space.layout === "object" ? configuration.space.layout : targetConfiguration.space.layout;
|
|
84
55
|
const mergedConfiguration = Object.assign(Object.assign({}, targetConfiguration), {
|
|
85
56
|
global: {
|
|
@@ -99,6 +70,7 @@ const merge = (configuration, target) => {
|
|
|
99
70
|
conceal: specifiedOrDefault("elements.toolbar.conceal", "boolean", configuration),
|
|
100
71
|
transformIcons: specifiedOrDefault("elements.toolbar.transformIcons", "boolean", configuration),
|
|
101
72
|
transformButtons: specifiedOrDefault("elements.toolbar.transformButtons", "boolean", configuration),
|
|
73
|
+
drawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.drawers ? configuration.elements.toolbar.drawers : targetConfiguration.elements.toolbar.drawers,
|
|
102
74
|
toggledDrawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.toggledDrawers ? configuration.elements.toolbar.toggledDrawers : targetConfiguration.elements.toolbar.toggledDrawers
|
|
103
75
|
},
|
|
104
76
|
viewcube: {
|
|
@@ -126,6 +98,7 @@ const merge = (configuration, target) => {
|
|
|
126
98
|
camera: specifiedOrDefault("space.camera", "string", configuration),
|
|
127
99
|
perspective: specifiedOrDefault("space.perspective", "number", configuration),
|
|
128
100
|
opaque: specifiedOrDefault("space.opaque", "boolean", configuration),
|
|
101
|
+
fadeInTime: specifiedOrDefault("space.fadeInTime", "number", configuration),
|
|
129
102
|
center: specifiedOrDefault("space.center", "boolean", configuration),
|
|
130
103
|
transformOrigin: {
|
|
131
104
|
show: specifiedOrDefault("space.transformOrigin.show", "boolean", configuration),
|
|
@@ -156,94 +129,11 @@ const merge = (configuration, target) => {
|
|
|
156
129
|
return mergedConfiguration;
|
|
157
130
|
};
|
|
158
131
|
|
|
159
|
-
var index$
|
|
132
|
+
var index$k = Object.freeze({
|
|
160
133
|
__proto__: null,
|
|
161
134
|
merge: merge
|
|
162
135
|
});
|
|
163
136
|
|
|
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
137
|
const extractPathname = location => {
|
|
248
138
|
const queryIndex = location.indexOf("?");
|
|
249
139
|
const noQueryPath = queryIndex === -1 ? location : location.substring(0, queryIndex);
|
|
@@ -298,7 +188,7 @@ const computeComparingPath = (path, parameters) => {
|
|
|
298
188
|
comparingPathElements[index] = parameters[index];
|
|
299
189
|
}
|
|
300
190
|
}
|
|
301
|
-
const comparingPath =
|
|
191
|
+
const comparingPath = comparingPathElements.join("/");
|
|
302
192
|
return {
|
|
303
193
|
locationElements: locationElements,
|
|
304
194
|
comparingPath: comparingPath
|
|
@@ -414,54 +304,77 @@ const extractOccurence = occurence => {
|
|
|
414
304
|
return occurenceValue;
|
|
415
305
|
};
|
|
416
306
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
this.path = path;
|
|
421
|
-
this.options = this.handleOptions(options);
|
|
307
|
+
const stringInsertInitial = (value, insert) => {
|
|
308
|
+
if (!value.startsWith(insert)) {
|
|
309
|
+
value = insert + value;
|
|
422
310
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
311
|
+
return value;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const stringRemoveTrailing = (value, trail) => {
|
|
315
|
+
if (value.endsWith(trail)) {
|
|
316
|
+
value = value.slice(0, value.length - trail.length);
|
|
428
317
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
318
|
+
return value;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const PATH_SEPARATOR = "/";
|
|
322
|
+
|
|
323
|
+
const cleanupPath = value => {
|
|
324
|
+
value = stringInsertInitial(value, PATH_SEPARATOR);
|
|
325
|
+
value = stringRemoveTrailing(value, PATH_SEPARATOR);
|
|
326
|
+
return value;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const computePlaneAddress = (plane, route, origin = "origin") => {
|
|
330
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
331
|
+
origin = location.host;
|
|
432
332
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
333
|
+
const cleanPlane = extractPathname(plane);
|
|
334
|
+
const planeAddressType = checkPlaneAddressType(cleanPlane);
|
|
335
|
+
switch (planeAddressType) {
|
|
336
|
+
case "http":
|
|
337
|
+
case "https":
|
|
338
|
+
case "pttp":
|
|
339
|
+
return cleanPlane;
|
|
436
340
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
341
|
+
origin = stringRemoveTrailing(origin, "/");
|
|
342
|
+
const absolutePlane = isAbsolutePlane(plane);
|
|
343
|
+
const path = route && route !== "/" ? absolutePlane ? cleanupPath(cleanPlane) : cleanupPath(route) + cleanupPath(cleanPlane) : cleanupPath(cleanPlane);
|
|
344
|
+
const planeAddress = pluridData.protocols.plurid + origin + path;
|
|
345
|
+
return planeAddress;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const isAbsolutePlane = value => value[0] === "/";
|
|
349
|
+
|
|
350
|
+
const checkPlaneAddressType = value => {
|
|
351
|
+
value = value.toLowerCase().trim();
|
|
352
|
+
if (value.startsWith(pluridData.protocols.plurid)) {
|
|
353
|
+
return "pttp";
|
|
440
354
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
return fragments;
|
|
355
|
+
if (value.startsWith(pluridData.protocols.https)) {
|
|
356
|
+
return pluridData.HTTPS_PROTOCOL;
|
|
444
357
|
}
|
|
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;
|
|
358
|
+
if (value.startsWith(pluridData.protocols.http)) {
|
|
359
|
+
return pluridData.HTTP_PROTOCOL;
|
|
463
360
|
}
|
|
464
|
-
|
|
361
|
+
return "relative";
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
const removeTrailingSlash = value => {
|
|
365
|
+
if (value.endsWith("/") && value.length > 1) {
|
|
366
|
+
return value.slice(0, value.length - 1);
|
|
367
|
+
}
|
|
368
|
+
return value;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const cleanPathValue = value => {
|
|
372
|
+
const queryStart = value.indexOf("?");
|
|
373
|
+
if (queryStart < 0) {
|
|
374
|
+
return removeTrailingSlash(value);
|
|
375
|
+
}
|
|
376
|
+
return removeTrailingSlash(value.substring(0, queryStart));
|
|
377
|
+
};
|
|
465
378
|
|
|
466
379
|
const checkParameterLength = (parameter, length, compareType) => {
|
|
467
380
|
const parameterLength = parameter.length;
|
|
@@ -486,9 +399,7 @@ const checkParameterLength = (parameter, length, compareType) => {
|
|
|
486
399
|
}
|
|
487
400
|
};
|
|
488
401
|
|
|
489
|
-
const checkValidPath
|
|
490
|
-
const {path: path, parameters: parameters} = data;
|
|
491
|
-
const {parameters: validationParameters} = path;
|
|
402
|
+
const checkValidPath = (validationParameters, parameters) => {
|
|
492
403
|
if (validationParameters) {
|
|
493
404
|
for (const [parameterKey, parameterData] of Object.entries(validationParameters)) {
|
|
494
405
|
const {length: length, lengthType: lengthType, startsWith: startsWith, endsWith: endsWith, includes: includes} = parameterData;
|
|
@@ -514,35 +425,6 @@ const checkValidPath$1 = data => {
|
|
|
514
425
|
return true;
|
|
515
426
|
};
|
|
516
427
|
|
|
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
428
|
const cleanPathElement = path => {
|
|
547
429
|
if (path[0] === "/") {
|
|
548
430
|
return path.slice(1);
|
|
@@ -550,7 +432,7 @@ const cleanPathElement = path => {
|
|
|
550
432
|
return path;
|
|
551
433
|
};
|
|
552
434
|
|
|
553
|
-
var index$
|
|
435
|
+
var index$j = Object.freeze({
|
|
554
436
|
__proto__: null,
|
|
555
437
|
cleanPathElement: cleanPathElement
|
|
556
438
|
});
|
|
@@ -808,402 +690,103 @@ const resolveRoute = (route, protocol, host) => {
|
|
|
808
690
|
route: absoluteRoute
|
|
809
691
|
};
|
|
810
692
|
}
|
|
811
|
-
|
|
812
|
-
const absoluteRoute = resolvers.join(separator);
|
|
693
|
+
[ protocolDivision, hostDivision.value, path.value, space.value, universe.value, cluster.value, cleanPathElement(plane.value) ];
|
|
813
694
|
return {
|
|
814
|
-
protocol:
|
|
815
|
-
host:
|
|
695
|
+
protocol: "",
|
|
696
|
+
host: "",
|
|
816
697
|
path: path,
|
|
817
|
-
space:
|
|
818
|
-
universe:
|
|
819
|
-
cluster:
|
|
820
|
-
plane:
|
|
821
|
-
route:
|
|
698
|
+
space: "",
|
|
699
|
+
universe: "",
|
|
700
|
+
cluster: "",
|
|
701
|
+
plane: "",
|
|
702
|
+
route: route
|
|
822
703
|
};
|
|
823
704
|
};
|
|
824
705
|
|
|
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;
|
|
706
|
+
const createTreePlane = (contextPlane, documentPlane) => {
|
|
707
|
+
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
708
|
+
const treePlane = Object.assign(Object.assign({}, pluridData.defaultTreePlane), {
|
|
709
|
+
routeDivisions: routeDivisions,
|
|
710
|
+
sourceID: contextPlane.id,
|
|
711
|
+
planeID: pluridFunctions.uuid.generate(),
|
|
712
|
+
route: contextPlane.path,
|
|
713
|
+
show: true
|
|
714
|
+
});
|
|
715
|
+
return treePlane;
|
|
872
716
|
};
|
|
873
717
|
|
|
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
|
-
}
|
|
718
|
+
const updateTreePlane$1 = (tree, page) => {
|
|
719
|
+
const updatedTree = tree.map((treePlane => {
|
|
720
|
+
if (treePlane.planeID === page.planeID) {
|
|
721
|
+
return Object.assign({}, page);
|
|
931
722
|
}
|
|
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("");
|
|
723
|
+
if (treePlane.children) {
|
|
724
|
+
return Object.assign(Object.assign({}, treePlane), {
|
|
725
|
+
children: updateTreePlane$1(treePlane.children, page)
|
|
726
|
+
});
|
|
944
727
|
}
|
|
728
|
+
return treePlane;
|
|
945
729
|
}));
|
|
946
|
-
|
|
947
|
-
value: route.value,
|
|
948
|
-
parametersValues: parametersValues,
|
|
949
|
-
parameters: route.parameters
|
|
950
|
-
};
|
|
951
|
-
return processedRoute;
|
|
730
|
+
return updatedTree;
|
|
952
731
|
};
|
|
953
732
|
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
733
|
+
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
734
|
+
const updatedTree = tree.map((treePlane => {
|
|
735
|
+
if (treePlane.planeID === planeID) {
|
|
736
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
737
|
+
linkCoordinates: linkCoordinates
|
|
738
|
+
});
|
|
739
|
+
return updatedPlane;
|
|
959
740
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
741
|
+
if (treePlane.children) {
|
|
742
|
+
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
743
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
744
|
+
children: updatedChildren
|
|
745
|
+
});
|
|
746
|
+
return updatedPlane;
|
|
747
|
+
}
|
|
748
|
+
return treePlane;
|
|
749
|
+
}));
|
|
750
|
+
return updatedTree;
|
|
963
751
|
};
|
|
964
752
|
|
|
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
|
-
};
|
|
753
|
+
var index$i = Object.freeze({
|
|
754
|
+
__proto__: null,
|
|
755
|
+
createTreePlane: createTreePlane,
|
|
756
|
+
updateTreePlane: updateTreePlane$1,
|
|
757
|
+
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
758
|
+
});
|
|
982
759
|
|
|
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
|
-
};
|
|
760
|
+
var index$h = Object.freeze({
|
|
761
|
+
__proto__: null,
|
|
762
|
+
configuration: index$k,
|
|
763
|
+
tree: index$i
|
|
764
|
+
});
|
|
997
765
|
|
|
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;
|
|
766
|
+
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
767
|
+
let direction = "left";
|
|
768
|
+
const wheelDeltaX = deltas.deltaX;
|
|
769
|
+
const wheelDeltaY = deltas.deltaY;
|
|
770
|
+
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
771
|
+
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
772
|
+
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
773
|
+
direction = "left";
|
|
1068
774
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
for (const route of routes) {
|
|
1072
|
-
const processedRoute = processRoute(route);
|
|
1073
|
-
index[processedRoute.value] = Object.assign({}, processedRoute);
|
|
1074
|
-
}
|
|
1075
|
-
return index;
|
|
775
|
+
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
776
|
+
direction = "right";
|
|
1076
777
|
}
|
|
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 "";
|
|
778
|
+
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
779
|
+
direction = "up";
|
|
1181
780
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
if (universe.active) {
|
|
1185
|
-
activeUniverseID = universe.id;
|
|
1186
|
-
break;
|
|
1187
|
-
}
|
|
781
|
+
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
782
|
+
direction = "down";
|
|
1188
783
|
}
|
|
1189
|
-
return
|
|
784
|
+
return direction;
|
|
1190
785
|
};
|
|
1191
786
|
|
|
1192
|
-
var index$
|
|
1193
|
-
__proto__: null,
|
|
1194
|
-
createInternalStateUniverse: createInternalStateUniverse,
|
|
1195
|
-
createInternalContextUniverse: createInternalContextUniverse,
|
|
1196
|
-
findActiveUniverse: findActiveUniverse
|
|
1197
|
-
});
|
|
1198
|
-
|
|
1199
|
-
var index$b = Object.freeze({
|
|
787
|
+
var index$g = Object.freeze({
|
|
1200
788
|
__proto__: null,
|
|
1201
|
-
|
|
1202
|
-
universes: index$c,
|
|
1203
|
-
helpers: index$i,
|
|
1204
|
-
planes: index$g,
|
|
1205
|
-
paths: index$h,
|
|
1206
|
-
tree: index$d
|
|
789
|
+
getWheelDirection: getWheelDirection
|
|
1207
790
|
});
|
|
1208
791
|
|
|
1209
792
|
const degToRad = deg => deg * .01745329252;
|
|
@@ -1314,7 +897,7 @@ function makeRotationMatrixFromQuaternion(quaternion) {
|
|
|
1314
897
|
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
898
|
}
|
|
1316
899
|
|
|
1317
|
-
var index$
|
|
900
|
+
var index$f = Object.freeze({
|
|
1318
901
|
__proto__: null,
|
|
1319
902
|
degToRad: degToRad,
|
|
1320
903
|
radToDeg: radToDeg,
|
|
@@ -1338,7 +921,7 @@ function rotateMatrix(xAngle, yAngle, zAngle = 0) {
|
|
|
1338
921
|
return rotationMatrix;
|
|
1339
922
|
}
|
|
1340
923
|
|
|
1341
|
-
function translateMatrix(x, y, z) {
|
|
924
|
+
function translateMatrix$1(x, y, z) {
|
|
1342
925
|
return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ];
|
|
1343
926
|
}
|
|
1344
927
|
|
|
@@ -1346,7 +929,7 @@ function scaleMatrix(s) {
|
|
|
1346
929
|
return [ s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 ];
|
|
1347
930
|
}
|
|
1348
931
|
|
|
1349
|
-
function multiplyMatrices(matrixA, matrixB) {
|
|
932
|
+
function multiplyMatrices$1(matrixA, matrixB) {
|
|
1350
933
|
const result = [];
|
|
1351
934
|
const a00 = matrixA[0];
|
|
1352
935
|
const a01 = matrixA[1];
|
|
@@ -1402,7 +985,7 @@ function multiplyMatrices(matrixA, matrixB) {
|
|
|
1402
985
|
function multiplyArrayOfMatrices(matrices) {
|
|
1403
986
|
let inputMatrix = matrices[0];
|
|
1404
987
|
for (let i = 1; i < matrices.length; i++) {
|
|
1405
|
-
inputMatrix = multiplyMatrices(inputMatrix, matrices[i]);
|
|
988
|
+
inputMatrix = multiplyMatrices$1(inputMatrix, matrices[i]);
|
|
1406
989
|
}
|
|
1407
990
|
return inputMatrix;
|
|
1408
991
|
}
|
|
@@ -1411,16 +994,105 @@ function matrixArrayToCSSMatrix(array) {
|
|
|
1411
994
|
return "matrix3d(" + array.join(",") + ")";
|
|
1412
995
|
}
|
|
1413
996
|
|
|
1414
|
-
var index$
|
|
997
|
+
var index$e = Object.freeze({
|
|
1415
998
|
__proto__: null,
|
|
1416
999
|
rotateMatrix: rotateMatrix,
|
|
1417
|
-
translateMatrix: translateMatrix,
|
|
1000
|
+
translateMatrix: translateMatrix$1,
|
|
1418
1001
|
scaleMatrix: scaleMatrix,
|
|
1419
|
-
multiplyMatrices: multiplyMatrices,
|
|
1002
|
+
multiplyMatrices: multiplyMatrices$1,
|
|
1420
1003
|
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
1421
1004
|
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
1422
1005
|
});
|
|
1423
1006
|
|
|
1007
|
+
const multiplyMatrices = (m1, m2) => {
|
|
1008
|
+
const result = [];
|
|
1009
|
+
for (let i = 0; i < m1.length; i++) {
|
|
1010
|
+
result[i] = [];
|
|
1011
|
+
for (let j = 0; j < m2[0].length; j++) {
|
|
1012
|
+
let sum = 0;
|
|
1013
|
+
for (let k = 0; k < m1[0].length; k++) {
|
|
1014
|
+
sum += m1[i][k] * m2[k][j];
|
|
1015
|
+
}
|
|
1016
|
+
result[i][j] = sum;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
return result;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
const arrayToMatrix = array => {
|
|
1023
|
+
const matrix = [];
|
|
1024
|
+
for (let i = 0; i < array.length; i += 4) {
|
|
1025
|
+
const row = [];
|
|
1026
|
+
row.push(array[i]);
|
|
1027
|
+
row.push(array[i + 1]);
|
|
1028
|
+
row.push(array[i + 2]);
|
|
1029
|
+
row.push(array[i + 3]);
|
|
1030
|
+
matrix.push(row);
|
|
1031
|
+
}
|
|
1032
|
+
return matrix;
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
const matrixToArray = matrix => matrix.flat();
|
|
1036
|
+
|
|
1037
|
+
const printMatrix = (matrix, name) => {
|
|
1038
|
+
const normalize = value => {
|
|
1039
|
+
if (value === 1 || value === 0) {
|
|
1040
|
+
return value + " ";
|
|
1041
|
+
}
|
|
1042
|
+
if (value > 0) {
|
|
1043
|
+
return value.toFixed(2) + " ";
|
|
1044
|
+
}
|
|
1045
|
+
return value.toFixed(2) + " ";
|
|
1046
|
+
};
|
|
1047
|
+
console.log("matrix", name + ":");
|
|
1048
|
+
for (const row of matrix) {
|
|
1049
|
+
console.log(normalize(row[0]), normalize(row[1]), normalize(row[2]), normalize(row[3]));
|
|
1050
|
+
}
|
|
1051
|
+
console.log(`matrix3d(${matrix.flat().join(",")})`);
|
|
1052
|
+
console.log();
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
const rotateXMatrix = angle => {
|
|
1056
|
+
const x = Math.cos(angle);
|
|
1057
|
+
const y = -1 * Math.sin(angle);
|
|
1058
|
+
const z = Math.sin(angle);
|
|
1059
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, x, y, 0 ], [ 0, z, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1060
|
+
return m;
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
const rotateYMatrix = angle => {
|
|
1064
|
+
const x = Math.cos(angle);
|
|
1065
|
+
const y = -1 * Math.sin(angle);
|
|
1066
|
+
const z = Math.sin(angle);
|
|
1067
|
+
const m = [ [ x, 0, z, 0 ], [ 0, 1, 0, 0 ], [ y, 0, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1068
|
+
return m;
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
const rotateZMatrix = angle => {
|
|
1072
|
+
const x = Math.cos(angle);
|
|
1073
|
+
const y = -1 * Math.sin(angle);
|
|
1074
|
+
const z = Math.sin(angle);
|
|
1075
|
+
const m = [ [ x, y, 0, 0 ], [ z, x, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1076
|
+
return m;
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
const translateMatrix = (x = 0, y = 0, z = 0) => {
|
|
1080
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ x, y, z, 1 ] ];
|
|
1081
|
+
return m;
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
var index$d = Object.freeze({
|
|
1085
|
+
__proto__: null,
|
|
1086
|
+
multiplyMatrices: multiplyMatrices,
|
|
1087
|
+
arrayToMatrix: arrayToMatrix,
|
|
1088
|
+
matrixToArray: matrixToArray,
|
|
1089
|
+
printMatrix: printMatrix,
|
|
1090
|
+
rotateXMatrix: rotateXMatrix,
|
|
1091
|
+
rotateYMatrix: rotateYMatrix,
|
|
1092
|
+
rotateZMatrix: rotateZMatrix,
|
|
1093
|
+
translateMatrix: translateMatrix
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1424
1096
|
function getMatrixValues(matrix3d) {
|
|
1425
1097
|
const matrixValues = matrix3d.split("(")[1].split(")")[0].split(",");
|
|
1426
1098
|
const matrixValuesInt = [];
|
|
@@ -1550,7 +1222,7 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1550
1222
|
const translateZ = transformTranslate.translateZ;
|
|
1551
1223
|
const scale = getTransformScale(matrix3d).scale;
|
|
1552
1224
|
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1553
|
-
const valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1225
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1554
1226
|
const valScalationMatrix = scaleMatrix(scale);
|
|
1555
1227
|
if (direction === "left") {
|
|
1556
1228
|
rotateY -= angleIncrement;
|
|
@@ -1583,73 +1255,552 @@ function translatePlurid(matrix3d, direction = "", linearIncrement = 50) {
|
|
|
1583
1255
|
const translateZ = transformTranslate.translateZ;
|
|
1584
1256
|
const scale = getTransformScale(matrix3d).scale;
|
|
1585
1257
|
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1586
|
-
let valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1258
|
+
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1587
1259
|
const valScalationMatrix = scaleMatrix(scale);
|
|
1588
1260
|
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1589
1261
|
if (direction === "left") {
|
|
1590
1262
|
translateX += linearIncrement;
|
|
1591
|
-
valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1263
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1264
|
+
}
|
|
1265
|
+
if (direction === "right") {
|
|
1266
|
+
translateX -= linearIncrement;
|
|
1267
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1268
|
+
}
|
|
1269
|
+
if (direction === "up") {
|
|
1270
|
+
translateY += linearIncrement;
|
|
1271
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1272
|
+
}
|
|
1273
|
+
if (direction === "down") {
|
|
1274
|
+
translateY -= linearIncrement;
|
|
1275
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1276
|
+
}
|
|
1277
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1278
|
+
return transformedMatrix3d;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
function scalePlurid(matrix3d, direction = "", scaleIncrement = .05) {
|
|
1282
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1283
|
+
const rotateX = transformRotate.rotateX;
|
|
1284
|
+
const rotateY = transformRotate.rotateY;
|
|
1285
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1286
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1287
|
+
const translateX = transformTranslate.translateX;
|
|
1288
|
+
const translateY = transformTranslate.translateY;
|
|
1289
|
+
const translateZ = transformTranslate.translateZ;
|
|
1290
|
+
let scale = getTransformScale(matrix3d).scale;
|
|
1291
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1292
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1293
|
+
let valScalationMatrix = scaleMatrix(scale);
|
|
1294
|
+
if (direction === "up") {
|
|
1295
|
+
scale -= scaleIncrement;
|
|
1296
|
+
if (scale < .1) {
|
|
1297
|
+
scale = .1;
|
|
1298
|
+
}
|
|
1299
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1300
|
+
}
|
|
1301
|
+
if (direction === "down") {
|
|
1302
|
+
scale += scaleIncrement;
|
|
1303
|
+
if (scale > 4) {
|
|
1304
|
+
scale = 4;
|
|
1305
|
+
}
|
|
1306
|
+
valScalationMatrix = scaleMatrix(scale);
|
|
1307
|
+
}
|
|
1308
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1309
|
+
return transformedMatrix3d;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
var index$c = Object.freeze({
|
|
1313
|
+
__proto__: null,
|
|
1314
|
+
getMatrixValues: getMatrixValues,
|
|
1315
|
+
getRotationMatrix: getRotationMatrix,
|
|
1316
|
+
getTranslationMatrix: getTranslationMatrix,
|
|
1317
|
+
getScalationValue: getScalationValue,
|
|
1318
|
+
setTransform: setTransform,
|
|
1319
|
+
getTransformRotate: getTransformRotate,
|
|
1320
|
+
getTransformTranslate: getTransformTranslate,
|
|
1321
|
+
getTransformScale: getTransformScale,
|
|
1322
|
+
rotatePlurid: rotatePlurid,
|
|
1323
|
+
translatePlurid: translatePlurid,
|
|
1324
|
+
scalePlurid: scalePlurid
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
var index$b = Object.freeze({
|
|
1328
|
+
__proto__: null,
|
|
1329
|
+
general: index$d,
|
|
1330
|
+
matrix3d: index$c
|
|
1331
|
+
});
|
|
1332
|
+
|
|
1333
|
+
var index$a = Object.freeze({
|
|
1334
|
+
__proto__: null,
|
|
1335
|
+
direction: index$g,
|
|
1336
|
+
matrix: index$e,
|
|
1337
|
+
quaternion: index$f,
|
|
1338
|
+
transform: index$b
|
|
1339
|
+
});
|
|
1340
|
+
|
|
1341
|
+
const internatiolate = (lamguage, field) => pluridData.internationalization[lamguage][field];
|
|
1342
|
+
|
|
1343
|
+
const resolvePluridPlaneData = plane => {
|
|
1344
|
+
if (Array.isArray(plane)) {
|
|
1345
|
+
const [route, component, options] = plane;
|
|
1346
|
+
return Object.assign({
|
|
1347
|
+
route: route,
|
|
1348
|
+
component: component
|
|
1349
|
+
}, options);
|
|
1350
|
+
}
|
|
1351
|
+
return plane;
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
const resolvePluridRoutePlaneData = plane => {
|
|
1355
|
+
if (Array.isArray(plane)) {
|
|
1356
|
+
const [value, component, options] = plane;
|
|
1357
|
+
return Object.assign({
|
|
1358
|
+
value: value,
|
|
1359
|
+
component: component
|
|
1360
|
+
}, options);
|
|
1361
|
+
}
|
|
1362
|
+
return plane;
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
const createInternalStatePlane = plane => {
|
|
1366
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1367
|
+
const statePlane = {
|
|
1368
|
+
id: pluridFunctions.uuid.generate(),
|
|
1369
|
+
path: planeData.route
|
|
1370
|
+
};
|
|
1371
|
+
return statePlane;
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
const createInternalContextPlane = plane => {
|
|
1375
|
+
const planeData = resolvePluridPlaneData(plane);
|
|
1376
|
+
const {route: route, component: component} = planeData;
|
|
1377
|
+
const contextPlane = {
|
|
1378
|
+
id: pluridFunctions.uuid.generate(),
|
|
1379
|
+
path: route,
|
|
1380
|
+
component: component
|
|
1381
|
+
};
|
|
1382
|
+
return contextPlane;
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1385
|
+
const getPluridPlaneIDByData = element => {
|
|
1386
|
+
if (!element) {
|
|
1387
|
+
return "";
|
|
1388
|
+
}
|
|
1389
|
+
const parent = element.parentElement;
|
|
1390
|
+
if (parent && parent.dataset.pluridPlane) {
|
|
1391
|
+
return parent.dataset.pluridPlane;
|
|
1392
|
+
}
|
|
1393
|
+
return getPluridPlaneIDByData(parent);
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
class IsoMatcher {
|
|
1397
|
+
constructor(data, origin = "origin") {
|
|
1398
|
+
this.routesIndex = new Map;
|
|
1399
|
+
this.planesIndex = new Map;
|
|
1400
|
+
this.routesKeys = [];
|
|
1401
|
+
this.planesKeys = [];
|
|
1402
|
+
if (origin === "origin" && typeof location !== "undefined") {
|
|
1403
|
+
this.origin = location.host;
|
|
1404
|
+
} else {
|
|
1405
|
+
this.origin = origin;
|
|
1406
|
+
}
|
|
1407
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1408
|
+
}
|
|
1409
|
+
match(path, context = "plane") {
|
|
1410
|
+
switch (context) {
|
|
1411
|
+
case "plane":
|
|
1412
|
+
return this.matchPlane(path);
|
|
1413
|
+
|
|
1414
|
+
case "route":
|
|
1415
|
+
return this.matchRoute(path);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
index(data) {
|
|
1419
|
+
this.updateIndexes(data.routes || [], data.routePlanes || [], data.planes || []);
|
|
1420
|
+
}
|
|
1421
|
+
clear() {
|
|
1422
|
+
this.routesIndex = new Map;
|
|
1423
|
+
this.planesIndex = new Map;
|
|
1424
|
+
this.routesKeys = [];
|
|
1425
|
+
this.planesKeys = [];
|
|
1426
|
+
}
|
|
1427
|
+
getPlanesIndex() {
|
|
1428
|
+
return this.planesIndex;
|
|
1429
|
+
}
|
|
1430
|
+
updateIndexes(routes, routePlanes, planes) {
|
|
1431
|
+
this.indexPlanes(planes, "Plane");
|
|
1432
|
+
this.indexPlanes(routePlanes, "RoutePlane");
|
|
1433
|
+
for (const route of routes) {
|
|
1434
|
+
if (route.planes) {
|
|
1435
|
+
this.indexPlanes(route.planes, "RoutePlane", route.value);
|
|
1436
|
+
}
|
|
1437
|
+
this.routesIndex.set(route.value, {
|
|
1438
|
+
data: Object.assign({}, route)
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
this.routesKeys = Array.from(this.routesIndex.keys());
|
|
1442
|
+
this.planesKeys = Array.from(this.planesIndex.keys());
|
|
1443
|
+
}
|
|
1444
|
+
indexPlanes(planes, kind, parent) {
|
|
1445
|
+
for (const plane of planes) {
|
|
1446
|
+
const planeData = kind === "Plane" ? resolvePluridPlaneData(plane) : resolvePluridRoutePlaneData(plane);
|
|
1447
|
+
const address = computePlaneAddress(kind === "Plane" ? planeData.route : planeData.value, parent, this.origin);
|
|
1448
|
+
const indexedPlane = {
|
|
1449
|
+
kind: kind,
|
|
1450
|
+
data: Object.assign({}, planeData)
|
|
1451
|
+
};
|
|
1452
|
+
if (parent) {
|
|
1453
|
+
indexedPlane["parent"] = parent;
|
|
1454
|
+
}
|
|
1455
|
+
this.planesIndex.set(address, indexedPlane);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
matchPlane(value) {
|
|
1459
|
+
const planeAddress = computePlaneAddress(value, undefined, this.origin);
|
|
1460
|
+
const plane = this.planesIndex.get(planeAddress);
|
|
1461
|
+
if (plane) {
|
|
1462
|
+
const query = extractQuery(value);
|
|
1463
|
+
const fragments = extractFragments(value);
|
|
1464
|
+
const match = {
|
|
1465
|
+
value: planeAddress,
|
|
1466
|
+
fragments: fragments,
|
|
1467
|
+
query: query,
|
|
1468
|
+
parameters: {}
|
|
1469
|
+
};
|
|
1470
|
+
if (plane.kind === "Plane") {
|
|
1471
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1472
|
+
const result = {
|
|
1473
|
+
kind: kind,
|
|
1474
|
+
data: data,
|
|
1475
|
+
parent: parent,
|
|
1476
|
+
match: match
|
|
1477
|
+
};
|
|
1478
|
+
return result;
|
|
1479
|
+
}
|
|
1480
|
+
if (plane.kind === "RoutePlane") {
|
|
1481
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1482
|
+
const result = {
|
|
1483
|
+
kind: kind,
|
|
1484
|
+
data: data,
|
|
1485
|
+
parent: parent,
|
|
1486
|
+
match: match
|
|
1487
|
+
};
|
|
1488
|
+
return result;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
for (const planePath of this.planesKeys) {
|
|
1492
|
+
const normalizedPlanePath = planePath.replace(pluridData.protocols.plurid, "");
|
|
1493
|
+
const normalizedPlaneAddress = planeAddress.replace(pluridData.protocols.plurid, "");
|
|
1494
|
+
const planePathSplit = normalizedPlanePath.split("/");
|
|
1495
|
+
const planeAddressSplit = normalizedPlaneAddress.split("/");
|
|
1496
|
+
if (planePathSplit[0] !== planeAddressSplit[0]) {
|
|
1497
|
+
continue;
|
|
1498
|
+
}
|
|
1499
|
+
if (planePathSplit.length !== planeAddressSplit.length) {
|
|
1500
|
+
continue;
|
|
1501
|
+
}
|
|
1502
|
+
const parametersAndMatch = extractParametersAndMatch(normalizedPlaneAddress, normalizedPlanePath);
|
|
1503
|
+
if (parametersAndMatch.match) {
|
|
1504
|
+
const plane = this.planesIndex.get(planePath);
|
|
1505
|
+
if (!plane) {
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1509
|
+
const validPath = checkValidPath(plane.data.parameters, parameters);
|
|
1510
|
+
if (!validPath) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const query = extractQuery(value);
|
|
1514
|
+
const fragments = extractFragments(value);
|
|
1515
|
+
const match = {
|
|
1516
|
+
value: planeAddress,
|
|
1517
|
+
fragments: fragments,
|
|
1518
|
+
query: query,
|
|
1519
|
+
parameters: parameters
|
|
1520
|
+
};
|
|
1521
|
+
if (plane.kind === "Plane") {
|
|
1522
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1523
|
+
const result = {
|
|
1524
|
+
kind: kind,
|
|
1525
|
+
data: data,
|
|
1526
|
+
parent: parent,
|
|
1527
|
+
match: match
|
|
1528
|
+
};
|
|
1529
|
+
return result;
|
|
1530
|
+
}
|
|
1531
|
+
if (plane.kind === "RoutePlane") {
|
|
1532
|
+
const {kind: kind, data: data, parent: parent} = plane;
|
|
1533
|
+
const result = {
|
|
1534
|
+
kind: kind,
|
|
1535
|
+
data: data,
|
|
1536
|
+
parent: parent,
|
|
1537
|
+
match: match
|
|
1538
|
+
};
|
|
1539
|
+
return result;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
matchRoute(value) {
|
|
1546
|
+
const routeValue = cleanPathValue(value);
|
|
1547
|
+
const route = this.routesIndex.get(routeValue);
|
|
1548
|
+
if (route) {
|
|
1549
|
+
const query = extractQuery(value);
|
|
1550
|
+
const result = {
|
|
1551
|
+
kind: "Route",
|
|
1552
|
+
data: route.data,
|
|
1553
|
+
match: {
|
|
1554
|
+
value: routeValue,
|
|
1555
|
+
query: query,
|
|
1556
|
+
parameters: {}
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1559
|
+
return result;
|
|
1560
|
+
}
|
|
1561
|
+
for (const routePath of this.routesKeys) {
|
|
1562
|
+
const routeSplit = routePath.split("/");
|
|
1563
|
+
const valueSplit = routeValue.split("/");
|
|
1564
|
+
if (routeSplit.length !== valueSplit.length) {
|
|
1565
|
+
continue;
|
|
1566
|
+
}
|
|
1567
|
+
const parametersAndMatch = extractParametersAndMatch(routeValue.slice(1), routePath.slice(1));
|
|
1568
|
+
if (parametersAndMatch.match) {
|
|
1569
|
+
const route = this.routesIndex.get(routePath);
|
|
1570
|
+
if (!route) {
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
const {parameters: parameters} = parametersAndMatch;
|
|
1574
|
+
const validPath = checkValidPath(route.data.parameters, parameters);
|
|
1575
|
+
if (!validPath) {
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
const query = extractQuery(routeValue);
|
|
1579
|
+
const match = {
|
|
1580
|
+
value: routeValue,
|
|
1581
|
+
query: query,
|
|
1582
|
+
parameters: parameters
|
|
1583
|
+
};
|
|
1584
|
+
if (route) {
|
|
1585
|
+
const result = {
|
|
1586
|
+
kind: "Route",
|
|
1587
|
+
data: route.data,
|
|
1588
|
+
match: match
|
|
1589
|
+
};
|
|
1590
|
+
return result;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
const routePlane = this.matchPlane(routeValue);
|
|
1595
|
+
if (routePlane) {
|
|
1596
|
+
const result = {
|
|
1597
|
+
kind: "RoutePlane",
|
|
1598
|
+
data: routePlane.data,
|
|
1599
|
+
match: {
|
|
1600
|
+
value: routeValue,
|
|
1601
|
+
query: routePlane.match.query,
|
|
1602
|
+
parameters: routePlane.match.parameters
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
return result;
|
|
1606
|
+
}
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
class Parser {
|
|
1612
|
+
constructor(location, path, options) {
|
|
1613
|
+
this.location = location;
|
|
1614
|
+
this.path = path;
|
|
1615
|
+
this.options = this.handleOptions(options);
|
|
1616
|
+
}
|
|
1617
|
+
handleOptions(options) {
|
|
1618
|
+
const parserOptions = {
|
|
1619
|
+
fragment: (options === null || options === void 0 ? void 0 : options.fragment) || true
|
|
1620
|
+
};
|
|
1621
|
+
return parserOptions;
|
|
1622
|
+
}
|
|
1623
|
+
extractPathname() {
|
|
1624
|
+
const pathname = extractPathname(this.location);
|
|
1625
|
+
return pathname;
|
|
1626
|
+
}
|
|
1627
|
+
extractParametersAndMatch() {
|
|
1628
|
+
const parametersAndMatch = extractParametersAndMatch(this.location, this.path.value);
|
|
1629
|
+
return parametersAndMatch;
|
|
1630
|
+
}
|
|
1631
|
+
extractQuery() {
|
|
1632
|
+
const query = extractQuery(this.location);
|
|
1633
|
+
return query;
|
|
1634
|
+
}
|
|
1635
|
+
extractFragments() {
|
|
1636
|
+
const fragments = this.options.fragment ? extractFragments(this.location) : extractFragments();
|
|
1637
|
+
return fragments;
|
|
1638
|
+
}
|
|
1639
|
+
extract() {
|
|
1640
|
+
const pathname = this.extractPathname();
|
|
1641
|
+
const {match: match, parameters: parameters, elements: elements} = this.extractParametersAndMatch();
|
|
1642
|
+
const query = this.extractQuery();
|
|
1643
|
+
const queryData = Object.entries(query).map((([key, value]) => key + "=" + value)).join("&");
|
|
1644
|
+
const queryString = queryData ? "?" + queryData : "";
|
|
1645
|
+
const fragments = this.extractFragments();
|
|
1646
|
+
const parserResponse = {
|
|
1647
|
+
path: this.path,
|
|
1648
|
+
pathname: pathname,
|
|
1649
|
+
elements: elements,
|
|
1650
|
+
match: match,
|
|
1651
|
+
parameters: parameters,
|
|
1652
|
+
query: query,
|
|
1653
|
+
fragments: fragments,
|
|
1654
|
+
route: pathname + queryString
|
|
1655
|
+
};
|
|
1656
|
+
return parserResponse;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
var index$9 = Object.freeze({
|
|
1661
|
+
__proto__: null,
|
|
1662
|
+
IsoMatcher: IsoMatcher,
|
|
1663
|
+
RouteParser: Parser,
|
|
1664
|
+
extractQuery: extractQuery,
|
|
1665
|
+
stringInsertInitial: stringInsertInitial,
|
|
1666
|
+
stringRemoveTrailing: stringRemoveTrailing,
|
|
1667
|
+
cleanupPath: cleanupPath,
|
|
1668
|
+
computePlaneAddress: computePlaneAddress,
|
|
1669
|
+
isAbsolutePlane: isAbsolutePlane,
|
|
1670
|
+
checkPlaneAddressType: checkPlaneAddressType,
|
|
1671
|
+
removeTrailingSlash: removeTrailingSlash,
|
|
1672
|
+
cleanPathValue: cleanPathValue,
|
|
1673
|
+
checkParameterLength: checkParameterLength,
|
|
1674
|
+
checkValidPath: checkValidPath,
|
|
1675
|
+
mapPathsToRoutes: mapPathsToRoutes,
|
|
1676
|
+
pluridLinkPathDivider: pluridLinkPathDivider,
|
|
1677
|
+
resolveRoute: resolveRoute
|
|
1678
|
+
});
|
|
1679
|
+
|
|
1680
|
+
class PluridPlanesRegistrar {
|
|
1681
|
+
constructor(planes) {
|
|
1682
|
+
this.isoMatcher = new IsoMatcher({
|
|
1683
|
+
planes: planes
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
register(planes) {
|
|
1687
|
+
this.isoMatcher.index({
|
|
1688
|
+
planes: planes
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
identify() {
|
|
1692
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1693
|
+
return [ ...planes.keys() ];
|
|
1694
|
+
}
|
|
1695
|
+
get(route) {
|
|
1696
|
+
const match = this.isoMatcher.match(route);
|
|
1697
|
+
if (match) {
|
|
1698
|
+
const absoluteRoute = match.kind === "Plane" ? match.data.route : match.data.value;
|
|
1699
|
+
const registeredPlane = {
|
|
1700
|
+
route: {
|
|
1701
|
+
absolute: absoluteRoute,
|
|
1702
|
+
fragments: match.match.fragments,
|
|
1703
|
+
parameters: match.match.parameters,
|
|
1704
|
+
query: match.match.query
|
|
1705
|
+
},
|
|
1706
|
+
component: match.data.component
|
|
1707
|
+
};
|
|
1708
|
+
return registeredPlane;
|
|
1709
|
+
}
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
getAll() {
|
|
1713
|
+
const planes = this.isoMatcher.getPlanesIndex();
|
|
1714
|
+
const all = new Map;
|
|
1715
|
+
for (const [path, plane] of planes) {
|
|
1716
|
+
const absoluteRoute = plane.kind === "Plane" ? plane.data.route : plane.data.value;
|
|
1717
|
+
const registeredPlane = {
|
|
1718
|
+
route: {
|
|
1719
|
+
absolute: absoluteRoute,
|
|
1720
|
+
fragments: {
|
|
1721
|
+
elements: [],
|
|
1722
|
+
texts: []
|
|
1723
|
+
},
|
|
1724
|
+
parameters: {},
|
|
1725
|
+
query: {}
|
|
1726
|
+
},
|
|
1727
|
+
component: plane.data.component
|
|
1728
|
+
};
|
|
1729
|
+
all.set(path, registeredPlane);
|
|
1730
|
+
}
|
|
1731
|
+
return all;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
const registerPlanes = (planes, planesRegistrar) => {
|
|
1736
|
+
if (!planes) {
|
|
1737
|
+
return;
|
|
1592
1738
|
}
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
|
|
1739
|
+
if (planesRegistrar) {
|
|
1740
|
+
planesRegistrar.register(planes);
|
|
1741
|
+
return;
|
|
1596
1742
|
}
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1599
|
-
valTranslationMatrix = translateMatrix(translateX, translateY, translateZ);
|
|
1743
|
+
if (typeof window === "undefined") {
|
|
1744
|
+
return;
|
|
1600
1745
|
}
|
|
1601
|
-
if (
|
|
1602
|
-
|
|
1603
|
-
|
|
1746
|
+
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
1747
|
+
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
1748
|
+
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
1749
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1750
|
+
return;
|
|
1604
1751
|
}
|
|
1605
|
-
|
|
1606
|
-
return
|
|
1607
|
-
}
|
|
1752
|
+
window.__pluridPlanesRegistrar__.register(planes);
|
|
1753
|
+
return;
|
|
1754
|
+
};
|
|
1608
1755
|
|
|
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;
|
|
1756
|
+
const getPlanesRegistrar = planesRegistrar => {
|
|
1757
|
+
if (planesRegistrar) {
|
|
1758
|
+
return planesRegistrar;
|
|
1759
|
+
}
|
|
1760
|
+
if (typeof window !== "undefined") {
|
|
1761
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1762
|
+
return window.__pluridPlanesRegistrar__;
|
|
1626
1763
|
}
|
|
1627
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1628
1764
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1765
|
+
return;
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
const getRegisteredPlanes = planesRegistrar => {
|
|
1769
|
+
if (planesRegistrar) {
|
|
1770
|
+
return planesRegistrar.getAll();
|
|
1771
|
+
}
|
|
1772
|
+
if (typeof window !== "undefined") {
|
|
1773
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1774
|
+
return window.__pluridPlanesRegistrar__.getAll();
|
|
1633
1775
|
}
|
|
1634
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1635
1776
|
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1777
|
+
return new Map;
|
|
1778
|
+
};
|
|
1779
|
+
|
|
1780
|
+
const getRegisteredPlane = (route, planesRegistrar) => {
|
|
1781
|
+
if (planesRegistrar) {
|
|
1782
|
+
return planesRegistrar.get(route);
|
|
1783
|
+
}
|
|
1784
|
+
if (typeof window !== "undefined") {
|
|
1785
|
+
if (window.__pluridPlanesRegistrar__ !== undefined) {
|
|
1786
|
+
return window.__pluridPlanesRegistrar__.get(route);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
return;
|
|
1790
|
+
};
|
|
1639
1791
|
|
|
1640
1792
|
var index$8 = Object.freeze({
|
|
1641
1793
|
__proto__: null,
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
scalePlurid: scalePlurid
|
|
1794
|
+
resolvePluridPlaneData: resolvePluridPlaneData,
|
|
1795
|
+
resolvePluridRoutePlaneData: resolvePluridRoutePlaneData,
|
|
1796
|
+
createInternalStatePlane: createInternalStatePlane,
|
|
1797
|
+
createInternalContextPlane: createInternalContextPlane,
|
|
1798
|
+
getPluridPlaneIDByData: getPluridPlaneIDByData,
|
|
1799
|
+
registerPlanes: registerPlanes,
|
|
1800
|
+
getPlanesRegistrar: getPlanesRegistrar,
|
|
1801
|
+
getRegisteredPlanes: getRegisteredPlanes,
|
|
1802
|
+
getRegisteredPlane: getRegisteredPlane,
|
|
1803
|
+
Registrar: PluridPlanesRegistrar
|
|
1653
1804
|
});
|
|
1654
1805
|
|
|
1655
1806
|
const computeSpaceSize = tree => {
|
|
@@ -1973,93 +2124,29 @@ var index$5 = Object.freeze({
|
|
|
1973
2124
|
computeZigZagLayout: computeZigZagLayout
|
|
1974
2125
|
});
|
|
1975
2126
|
|
|
1976
|
-
const
|
|
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
|
-
const resolveViewItem = (planes, view, configuration) => {
|
|
2127
|
+
const resolveViewItem = (planes, view, configuration, origin = "origin") => {
|
|
2051
2128
|
const {protocol: protocol, host: host} = configuration.network;
|
|
2052
2129
|
const viewData = typeof view === "string" ? view : view.plane;
|
|
2053
|
-
const
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2130
|
+
const viewAddress = computePlaneAddress(viewData, undefined, origin);
|
|
2131
|
+
const iPlanes = planes.values();
|
|
2132
|
+
const pluridPlanes = [];
|
|
2133
|
+
for (const iPlane of iPlanes) {
|
|
2134
|
+
const plane = {
|
|
2135
|
+
route: iPlane.route.absolute,
|
|
2136
|
+
component: iPlane.component
|
|
2137
|
+
};
|
|
2138
|
+
pluridPlanes.push(plane);
|
|
2139
|
+
}
|
|
2140
|
+
const isoMatcher = new IsoMatcher({
|
|
2141
|
+
planes: pluridPlanes
|
|
2142
|
+
});
|
|
2143
|
+
const match = isoMatcher.match(viewData);
|
|
2144
|
+
if (match) {
|
|
2145
|
+
const route = match.match.value;
|
|
2059
2146
|
const treePlane = {
|
|
2060
2147
|
sourceID: route,
|
|
2061
2148
|
planeID: pluridFunctions.uuid.generate(),
|
|
2062
|
-
route:
|
|
2149
|
+
route: viewAddress,
|
|
2063
2150
|
routeDivisions: {
|
|
2064
2151
|
protocol: {
|
|
2065
2152
|
value: "",
|
|
@@ -2069,11 +2156,35 @@ const resolveViewItem = (planes, view, configuration) => {
|
|
|
2069
2156
|
value: host,
|
|
2070
2157
|
controlled: true
|
|
2071
2158
|
},
|
|
2072
|
-
path:
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2159
|
+
path: {
|
|
2160
|
+
parameters: {},
|
|
2161
|
+
query: {},
|
|
2162
|
+
value: ""
|
|
2163
|
+
},
|
|
2164
|
+
space: {
|
|
2165
|
+
parameters: {},
|
|
2166
|
+
query: {},
|
|
2167
|
+
value: ""
|
|
2168
|
+
},
|
|
2169
|
+
universe: {
|
|
2170
|
+
parameters: {},
|
|
2171
|
+
query: {},
|
|
2172
|
+
value: ""
|
|
2173
|
+
},
|
|
2174
|
+
cluster: {
|
|
2175
|
+
parameters: {},
|
|
2176
|
+
query: {},
|
|
2177
|
+
value: ""
|
|
2178
|
+
},
|
|
2179
|
+
plane: {
|
|
2180
|
+
parameters: {},
|
|
2181
|
+
fragments: {
|
|
2182
|
+
elements: [],
|
|
2183
|
+
texts: []
|
|
2184
|
+
},
|
|
2185
|
+
query: {},
|
|
2186
|
+
value: ""
|
|
2187
|
+
},
|
|
2077
2188
|
valid: true
|
|
2078
2189
|
},
|
|
2079
2190
|
height: 0,
|
|
@@ -2092,10 +2203,10 @@ const resolveViewItem = (planes, view, configuration) => {
|
|
|
2092
2203
|
return;
|
|
2093
2204
|
};
|
|
2094
2205
|
|
|
2095
|
-
const computeSpaceTree = (planes, view, configuration) => {
|
|
2206
|
+
const computeSpaceTree = (planes, view, configuration, origin = "origin") => {
|
|
2096
2207
|
const treePlanes = [];
|
|
2097
2208
|
for (const viewItem of view) {
|
|
2098
|
-
const treePlane = resolveViewItem(planes, viewItem, configuration);
|
|
2209
|
+
const treePlane = resolveViewItem(planes, viewItem, configuration, origin);
|
|
2099
2210
|
if (treePlane) {
|
|
2100
2211
|
treePlanes.push(treePlane);
|
|
2101
2212
|
}
|
|
@@ -2180,16 +2291,16 @@ const assignPagesFromView = (planes, view) => {
|
|
|
2180
2291
|
};
|
|
2181
2292
|
|
|
2182
2293
|
const updateTreePlane = (tree, updatedPage) => {
|
|
2183
|
-
const updatedTree = tree.map((
|
|
2184
|
-
if (
|
|
2294
|
+
const updatedTree = tree.map((treePlane => {
|
|
2295
|
+
if (treePlane.planeID === updatedPage.planeID) {
|
|
2185
2296
|
return updatedPage;
|
|
2186
2297
|
}
|
|
2187
|
-
if (
|
|
2188
|
-
const pageTree = updateTreePlane(
|
|
2189
|
-
|
|
2190
|
-
return
|
|
2298
|
+
if (treePlane.children) {
|
|
2299
|
+
const pageTree = updateTreePlane(treePlane.children, updatedPage);
|
|
2300
|
+
treePlane.children = pageTree;
|
|
2301
|
+
return treePlane;
|
|
2191
2302
|
}
|
|
2192
|
-
return
|
|
2303
|
+
return treePlane;
|
|
2193
2304
|
}));
|
|
2194
2305
|
return updatedTree;
|
|
2195
2306
|
};
|
|
@@ -2232,7 +2343,8 @@ const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree
|
|
|
2232
2343
|
const updatedTree = updateTreePlane(tree, updatedParentPlane);
|
|
2233
2344
|
return {
|
|
2234
2345
|
pluridPlaneID: updatedTreePlane.planeID,
|
|
2235
|
-
updatedTree: updatedTree
|
|
2346
|
+
updatedTree: updatedTree,
|
|
2347
|
+
updatedTreePlane: updatedTreePlane
|
|
2236
2348
|
};
|
|
2237
2349
|
};
|
|
2238
2350
|
|
|
@@ -2352,24 +2464,32 @@ const toggleChildren = children => {
|
|
|
2352
2464
|
|
|
2353
2465
|
const togglePlaneFromTree = (tree, pluridPlaneID) => {
|
|
2354
2466
|
const updatedTree = [];
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2467
|
+
let updatedPlane;
|
|
2468
|
+
for (const plane of tree) {
|
|
2469
|
+
if (plane.planeID === pluridPlaneID) {
|
|
2470
|
+
const treeUpdatedPlane = Object.assign(Object.assign({}, plane), {
|
|
2471
|
+
show: !plane.show,
|
|
2359
2472
|
children: []
|
|
2360
2473
|
});
|
|
2361
|
-
updatedTree.push(
|
|
2474
|
+
updatedTree.push(treeUpdatedPlane);
|
|
2475
|
+
updatedPlane = Object.assign({}, treeUpdatedPlane);
|
|
2362
2476
|
continue;
|
|
2363
2477
|
}
|
|
2364
|
-
if (
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
updatedTree.push(
|
|
2478
|
+
if (plane.children) {
|
|
2479
|
+
const {updatedTree: childrenUpdatedTree, updatedPlane: childrenUpdatedPlane} = togglePlaneFromTree(plane.children, pluridPlaneID);
|
|
2480
|
+
plane.children = [ ...childrenUpdatedTree ];
|
|
2481
|
+
updatedTree.push(plane);
|
|
2482
|
+
if (childrenUpdatedPlane) {
|
|
2483
|
+
updatedPlane = Object.assign({}, childrenUpdatedPlane);
|
|
2484
|
+
}
|
|
2368
2485
|
continue;
|
|
2369
2486
|
}
|
|
2370
|
-
updatedTree.push(
|
|
2487
|
+
updatedTree.push(plane);
|
|
2371
2488
|
}
|
|
2372
|
-
return
|
|
2489
|
+
return {
|
|
2490
|
+
updatedTree: updatedTree,
|
|
2491
|
+
updatedPlane: updatedPlane
|
|
2492
|
+
};
|
|
2373
2493
|
};
|
|
2374
2494
|
|
|
2375
2495
|
var logic = Object.freeze({
|
|
@@ -2388,12 +2508,13 @@ var logic = Object.freeze({
|
|
|
2388
2508
|
});
|
|
2389
2509
|
|
|
2390
2510
|
class Tree {
|
|
2391
|
-
constructor(data) {
|
|
2511
|
+
constructor(data, origin = "origin") {
|
|
2392
2512
|
this.data = data;
|
|
2513
|
+
this.origin = origin;
|
|
2393
2514
|
}
|
|
2394
2515
|
compute() {
|
|
2395
2516
|
const {planes: planes, view: view, configuration: configuration} = this.data;
|
|
2396
|
-
return computeSpaceTree(planes, view, configuration);
|
|
2517
|
+
return computeSpaceTree(planes, view, configuration, this.origin);
|
|
2397
2518
|
}
|
|
2398
2519
|
}
|
|
2399
2520
|
|
|
@@ -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
|