@plurid/plurid-engine 0.0.0-10 → 0.0.0-13

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.
@@ -4,14 +4,6 @@ import { objects, uuid, mathematics } from "@plurid/plurid-functions";
4
4
 
5
5
  import themes, { THEME_NAMES } from "@plurid/plurid-themes";
6
6
 
7
- const specifiedOrDefault = (path, type, configuration) => {
8
- const item = objects.getNested(configuration, path);
9
- if (typeof item === type) {
10
- return item;
11
- }
12
- return objects.getNested(defaultConfiguration, path);
13
- };
14
-
15
7
  const resolveTheme = (theme, type) => {
16
8
  if (!theme) {
17
9
  return "plurid";
@@ -38,6 +30,13 @@ const merge = (configuration, target) => {
38
30
  if (!configuration) {
39
31
  return Object.assign({}, targetConfiguration);
40
32
  }
33
+ const specifiedOrDefault = (path, type, configuration) => {
34
+ const item = objects.getNested(configuration, path);
35
+ if (typeof item === type) {
36
+ return item;
37
+ }
38
+ return objects.getNested(targetConfiguration, path);
39
+ };
41
40
  const layout = configuration && configuration.space && typeof configuration.space.layout === "object" ? configuration.space.layout : targetConfiguration.space.layout;
42
41
  const mergedConfiguration = Object.assign(Object.assign({}, targetConfiguration), {
43
42
  global: {
@@ -2111,10 +2110,10 @@ var index$5 = Object.freeze({
2111
2110
  computeZigZagLayout: computeZigZagLayout
2112
2111
  });
2113
2112
 
2114
- const resolveViewItem = (planes, view, configuration) => {
2113
+ const resolveViewItem = (planes, view, configuration, origin = "origin") => {
2115
2114
  const {protocol: protocol, host: host} = configuration.network;
2116
2115
  const viewData = typeof view === "string" ? view : view.plane;
2117
- const viewAddress = computePlaneAddress(viewData);
2116
+ const viewAddress = computePlaneAddress(viewData, undefined, origin);
2118
2117
  const iPlanes = planes.values();
2119
2118
  const pluridPlanes = [];
2120
2119
  for (const iPlane of iPlanes) {
@@ -2190,10 +2189,10 @@ const resolveViewItem = (planes, view, configuration) => {
2190
2189
  return;
2191
2190
  };
2192
2191
 
2193
- const computeSpaceTree = (planes, view, configuration) => {
2192
+ const computeSpaceTree = (planes, view, configuration, origin = "origin") => {
2194
2193
  const treePlanes = [];
2195
2194
  for (const viewItem of view) {
2196
- const treePlane = resolveViewItem(planes, viewItem, configuration);
2195
+ const treePlane = resolveViewItem(planes, viewItem, configuration, origin);
2197
2196
  if (treePlane) {
2198
2197
  treePlanes.push(treePlane);
2199
2198
  }
@@ -2495,12 +2494,13 @@ var logic = Object.freeze({
2495
2494
  });
2496
2495
 
2497
2496
  class Tree {
2498
- constructor(data) {
2497
+ constructor(data, origin = "origin") {
2499
2498
  this.data = data;
2499
+ this.origin = origin;
2500
2500
  }
2501
2501
  compute() {
2502
2502
  const {planes: planes, view: view, configuration: configuration} = this.data;
2503
- return computeSpaceTree(planes, view, configuration);
2503
+ return computeSpaceTree(planes, view, configuration, this.origin);
2504
2504
  }
2505
2505
  }
2506
2506
 
@@ -2568,13 +2568,13 @@ var index$2 = Object.freeze({
2568
2568
  view: index$3
2569
2569
  });
2570
2570
 
2571
- const resolveSpace = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState) => {
2571
+ const resolveSpace = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname = "origin") => {
2572
2572
  const registeredPlanes = getRegisteredPlanes(planesRegistrar);
2573
2573
  const spaceTree = new Tree({
2574
2574
  planes: registeredPlanes,
2575
2575
  configuration: configuration,
2576
2576
  view: view
2577
- });
2577
+ }, hostname);
2578
2578
  const computedTree = spaceTree.compute();
2579
2579
  const stateSpace = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
2580
2580
  loading: true,
@@ -2659,10 +2659,10 @@ const resolveThemes = (configuration, precomputedState) => {
2659
2659
  return stateThemes;
2660
2660
  };
2661
2661
 
2662
- const compute = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState) => {
2662
+ const compute = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname = "origin") => {
2663
2663
  const specifiedConfiguration = merge(configuration);
2664
2664
  const stateConfiguration = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, specifiedConfiguration), precomputedState === null || precomputedState === void 0 ? void 0 : precomputedState.configuration), contextState === null || contextState === void 0 ? void 0 : contextState.configuration), localState === null || localState === void 0 ? void 0 : localState.configuration), currentState === null || currentState === void 0 ? void 0 : currentState.configuration);
2665
- const stateSpace = resolveSpace(view, stateConfiguration, planesRegistrar, currentState, localState, precomputedState, contextState);
2665
+ const stateSpace = resolveSpace(view, stateConfiguration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname);
2666
2666
  const stateThemes = resolveThemes(stateConfiguration, precomputedState);
2667
2667
  const state = {
2668
2668
  configuration: Object.assign({}, stateConfiguration),