@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.
@@ -18,14 +18,6 @@ function _interopDefaultLegacy(e) {
18
18
 
19
19
  var themes__default = _interopDefaultLegacy(themes);
20
20
 
21
- const specifiedOrDefault = (path, type, configuration) => {
22
- const item = pluridFunctions.objects.getNested(configuration, path);
23
- if (typeof item === type) {
24
- return item;
25
- }
26
- return pluridFunctions.objects.getNested(pluridData.defaultConfiguration, path);
27
- };
28
-
29
21
  const resolveTheme = (theme, type) => {
30
22
  if (!theme) {
31
23
  return "plurid";
@@ -52,6 +44,13 @@ const merge = (configuration, target) => {
52
44
  if (!configuration) {
53
45
  return Object.assign({}, targetConfiguration);
54
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
+ };
55
54
  const layout = configuration && configuration.space && typeof configuration.space.layout === "object" ? configuration.space.layout : targetConfiguration.space.layout;
56
55
  const mergedConfiguration = Object.assign(Object.assign({}, targetConfiguration), {
57
56
  global: {
@@ -2125,10 +2124,10 @@ var index$5 = Object.freeze({
2125
2124
  computeZigZagLayout: computeZigZagLayout
2126
2125
  });
2127
2126
 
2128
- const resolveViewItem = (planes, view, configuration) => {
2127
+ const resolveViewItem = (planes, view, configuration, origin = "origin") => {
2129
2128
  const {protocol: protocol, host: host} = configuration.network;
2130
2129
  const viewData = typeof view === "string" ? view : view.plane;
2131
- const viewAddress = computePlaneAddress(viewData);
2130
+ const viewAddress = computePlaneAddress(viewData, undefined, origin);
2132
2131
  const iPlanes = planes.values();
2133
2132
  const pluridPlanes = [];
2134
2133
  for (const iPlane of iPlanes) {
@@ -2204,10 +2203,10 @@ const resolveViewItem = (planes, view, configuration) => {
2204
2203
  return;
2205
2204
  };
2206
2205
 
2207
- const computeSpaceTree = (planes, view, configuration) => {
2206
+ const computeSpaceTree = (planes, view, configuration, origin = "origin") => {
2208
2207
  const treePlanes = [];
2209
2208
  for (const viewItem of view) {
2210
- const treePlane = resolveViewItem(planes, viewItem, configuration);
2209
+ const treePlane = resolveViewItem(planes, viewItem, configuration, origin);
2211
2210
  if (treePlane) {
2212
2211
  treePlanes.push(treePlane);
2213
2212
  }
@@ -2509,12 +2508,13 @@ var logic = Object.freeze({
2509
2508
  });
2510
2509
 
2511
2510
  class Tree {
2512
- constructor(data) {
2511
+ constructor(data, origin = "origin") {
2513
2512
  this.data = data;
2513
+ this.origin = origin;
2514
2514
  }
2515
2515
  compute() {
2516
2516
  const {planes: planes, view: view, configuration: configuration} = this.data;
2517
- return computeSpaceTree(planes, view, configuration);
2517
+ return computeSpaceTree(planes, view, configuration, this.origin);
2518
2518
  }
2519
2519
  }
2520
2520
 
@@ -2582,13 +2582,13 @@ var index$2 = Object.freeze({
2582
2582
  view: index$3
2583
2583
  });
2584
2584
 
2585
- const resolveSpace = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState) => {
2585
+ const resolveSpace = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname = "origin") => {
2586
2586
  const registeredPlanes = getRegisteredPlanes(planesRegistrar);
2587
2587
  const spaceTree = new Tree({
2588
2588
  planes: registeredPlanes,
2589
2589
  configuration: configuration,
2590
2590
  view: view
2591
- });
2591
+ }, hostname);
2592
2592
  const computedTree = spaceTree.compute();
2593
2593
  const stateSpace = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
2594
2594
  loading: true,
@@ -2673,10 +2673,10 @@ const resolveThemes = (configuration, precomputedState) => {
2673
2673
  return stateThemes;
2674
2674
  };
2675
2675
 
2676
- const compute = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState) => {
2676
+ const compute = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname = "origin") => {
2677
2677
  const specifiedConfiguration = merge(configuration);
2678
2678
  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);
2679
- const stateSpace = resolveSpace(view, stateConfiguration, planesRegistrar, currentState, localState, precomputedState, contextState);
2679
+ const stateSpace = resolveSpace(view, stateConfiguration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname);
2680
2680
  const stateThemes = resolveThemes(stateConfiguration, precomputedState);
2681
2681
  const state = {
2682
2682
  configuration: Object.assign({}, stateConfiguration),