spyne 0.17.1 → 0.18.3

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.
Files changed (70) hide show
  1. package/README.md +0 -60
  2. package/karma.conf.js +5 -61
  3. package/lib/spyne.js +566 -1218
  4. package/lib/spyne.min.js +1 -1
  5. package/lib/spyne.min.js.LICENSE.txt +1 -1
  6. package/package.json +22 -15
  7. package/src/spyne/channels/channel-fetch-class.js +1 -4
  8. package/src/spyne/channels/channel-payload-class.js +8 -9
  9. package/src/spyne/channels/channel-proxy.js +1 -1
  10. package/src/spyne/channels/channel.js +3 -26
  11. package/src/spyne/channels/channels-config.js +0 -2
  12. package/src/spyne/channels/channels-map.js +1 -18
  13. package/src/spyne/channels/spyne-channel-lifecycle.js +1 -2
  14. package/src/spyne/channels/spyne-channel-route.js +7 -47
  15. package/src/spyne/channels/spyne-channel-ui.js +0 -2
  16. package/src/spyne/channels/spyne-channel-window.js +4 -54
  17. package/src/spyne/spyne-app.js +5 -21
  18. package/src/spyne/spyne-plugins.js +35 -64
  19. package/src/spyne/spyne.js +0 -1
  20. package/src/spyne/utils/channel-config-validator.js +0 -1
  21. package/src/spyne/utils/channel-fetch-util.js +1 -2
  22. package/src/spyne/utils/channel-payload-filter.js +4 -73
  23. package/src/spyne/utils/gc.js +1 -1
  24. package/src/spyne/utils/route-channel-updater.js +0 -4
  25. package/src/spyne/utils/spyne-app-properties.js +42 -72
  26. package/src/spyne/utils/spyne-plugins-methods.js +1 -9
  27. package/src/spyne/utils/spyne-trait.js +2 -5
  28. package/src/spyne/utils/spyne-utils-channel-route-url.js +1 -7
  29. package/src/spyne/utils/spyne-utils-channel-route.js +3 -13
  30. package/src/spyne/utils/spyne-utils-channel-window.js +2 -4
  31. package/src/spyne/utils/viewstream-observables.js +2 -3
  32. package/src/spyne/views/dom-element-template.js +1 -6
  33. package/src/spyne/views/dom-element.js +0 -19
  34. package/src/spyne/views/view-stream-broadcaster.js +2 -7
  35. package/src/spyne/views/view-stream-element.js +1 -18
  36. package/src/spyne/views/view-stream-payload.js +2 -69
  37. package/src/spyne/views/view-stream-selector.js +1 -6
  38. package/src/spyne/views/view-stream.js +253 -280
  39. package/webpack.config.js +0 -29
  40. package/lib/channel-action-filter.test.871939702.js +0 -20
  41. package/lib/channel-dom.test.2857423116.js +0 -20
  42. package/lib/channel-fetch-util.test.1782805723.js +0 -20
  43. package/lib/channel-fetch.test.3331576485.js +0 -20
  44. package/lib/channel-payload-class.test.99440410.js +0 -20
  45. package/lib/channel-payload-filter.test.2135136282.js +0 -20
  46. package/lib/channel-route.test.3036804306.js +0 -20
  47. package/lib/channel-stream-item.test.1523843610.js +0 -20
  48. package/lib/channel-ui.test.367398224.js +0 -20
  49. package/lib/channel-util-dom.test.3758627277.js +0 -20
  50. package/lib/channel.test.1717017712.js +0 -20
  51. package/lib/commons.js +0 -50372
  52. package/lib/dom-el-selectors.test.2633571626.js +0 -20
  53. package/lib/dom-el-template.test.268653142.js +0 -20
  54. package/lib/dom-el.test.4051977500.js +0 -20
  55. package/lib/frp-tools.test.3814897075.js +0 -20
  56. package/lib/index.test.1514915838.js +0 -20
  57. package/lib/plugins-methods.test.2326717190.js +0 -20
  58. package/lib/route-utils.test.2350761994.js +0 -20
  59. package/lib/runtime.js +0 -174
  60. package/lib/spyne-app-properties.test.96729569.js +0 -20
  61. package/lib/spyne-app.test.1443517996.js +0 -20
  62. package/lib/spyne-plugin.test.1247070970.js +0 -20
  63. package/lib/url-utils.test.516839067.js +0 -20
  64. package/lib/view-stream-broadcaster.test.934532750.js +0 -20
  65. package/lib/view-stream-enhancer-loader.test.2755314117.js +0 -20
  66. package/lib/view-stream-enhancer.test.414877881.js +0 -20
  67. package/lib/view-stream.test.2479353905.js +0 -20
  68. package/src/spyne/channels/lifestream-payload.js +0 -56
  69. package/src/spyne/utils/spyne-scroll-lock.js +0 -95
  70. package/src/spyne/views/view-stream-enhancer-loader.js +0 -70
@@ -1,12 +1,7 @@
1
- // import {createElement} from '../utils/dom-methods';
2
1
  import { baseCoreMixins } from '../utils/mixins/base-core-mixins';
3
2
  import { DomElementTemplate } from './dom-element-template';
4
3
  import { deepMerge } from '../utils/deep-merge';
5
- // import {DomElementTemplate} from './template-renderer';
6
-
7
4
  import {is, defaultTo, pick, mapObjIndexed, forEachObjIndexed, pipe} from 'ramda';
8
- //import {ViewStreamElement} from './view-stream-element';
9
- //import {getConstructorName} from '../utils/frp-tools';
10
5
 
11
6
  class DomElement {
12
7
  /**
@@ -31,35 +26,21 @@ class DomElement {
31
26
  */
32
27
 
33
28
  constructor(props={}) {
34
- //let isSimpleView = both(is(String), complement(isEmpty))(attributes);
35
- // if (isSimpleView === true) {
36
- // data = attributes;
37
- // attributes = {};
38
29
 
39
- // }
40
30
  const checkDefault = (dflt, val)=>defaultTo(dflt)(val);
41
31
 
42
32
  props.tagName = checkDefault('div', props.tagName);
43
33
 
44
-
45
34
  props.attributes = props.attributes!==undefined ? props.attributes : this.getDomAttributes(props);
46
35
  props.attrs = this.updateAttrs(props.attributes);
47
36
 
48
37
  props.fragment = document.createDocumentFragment()
49
38
  this.props = props;
50
39
 
51
- //this.setProp('tagName', tagName);
52
- //this.setProp('attrs', this.updateAttrs(attributes));
53
- //this.setProp('data', data);
54
- // this.setProp('template', template);
55
-
56
- // this.setProp('fragment', document.createDocumentFragment());
57
-
58
40
  this.addMixins();
59
41
  }
60
42
 
61
43
  setProp(key, val) {
62
- //this.props.set(key, val);
63
44
  this.props[key] = val;
64
45
  }
65
46
 
@@ -3,7 +3,7 @@ import { convertDomStringMapToObj } from '../utils/frp-tools';
3
3
  import {SpyneAppProperties} from '../utils/spyne-app-properties';
4
4
  import { fromEvent } from 'rxjs';
5
5
  import { map } from 'rxjs/operators';
6
- import {clone, omit, path} from 'ramda';
6
+ import {clone, omit} from 'ramda';
7
7
 
8
8
  export class ViewStreamBroadcaster {
9
9
  /**
@@ -47,9 +47,7 @@ export class ViewStreamBroadcaster {
47
47
  };
48
48
  // spread operator to select variables from arrays
49
49
  let [selector, event, local] = args;
50
- // console.log('args is ',args);
51
50
  // btn query
52
- // let query = this.props.el.querySelectorAll(selector);
53
51
  let channel; // hoist channel and later check if chnl exists
54
52
  let query = this.props.el.querySelectorAll(selector);
55
53
 
@@ -85,8 +83,6 @@ export class ViewStreamBroadcaster {
85
83
  data['channel'] = channel;
86
84
  // payload needs vsid# to pass verification
87
85
 
88
- // data['event'] = event;
89
- // data['el'] = q;
90
86
  data['srcElement'] = {};// pick(['vsid','viewName'], data);
91
87
  data.srcElement['id'] = this.props.id;
92
88
  data.srcElement['vsid'] = this.props.vsid;
@@ -103,7 +99,7 @@ export class ViewStreamBroadcaster {
103
99
  let queryIsNil = query === undefined || query.length <= 0;
104
100
  if (queryIsNil === true && isDevMode === true) {
105
101
  console.warn(`Spyne Warning: The item ${selector}, does not appear to exist in ${this.props.name} --> vsid:${this.props.vsid}!`);
106
- // query = this.props.el;
102
+
107
103
  // addObservable(query, event);
108
104
  } else {
109
105
  query.forEach = Array.prototype.forEach;
@@ -124,6 +120,5 @@ export class ViewStreamBroadcaster {
124
120
  let streamMixins = baseStreamsMixins();
125
121
  this.sendUIPayload = streamMixins.sendUIPayload;
126
122
  this.sendRoutePayload = streamMixins.sendRoutePayload;
127
- //this.createLifeStreamPayload = streamMixins.createLifeStreamPayload;
128
123
  }
129
124
  }
@@ -1,6 +1,4 @@
1
- //import { baseCoreMixins } from '../utils/mixins/base-core-mixins';
2
1
  import { DomElement } from './dom-element';
3
- //import { ifNilThenUpdate, convertDomStringMapToObj } from '../utils/frp-tools';
4
2
  import { fadein, fadeout } from '../utils/viewstream-animations';
5
3
  import { ViewStreamObservable } from '../utils/viewstream-observables';
6
4
  import { deepMerge } from '../utils/deep-merge';
@@ -108,7 +106,6 @@ export class ViewStreamElement {
108
106
 
109
107
  let fadeOutObs = bindCallback(animateOut);
110
108
  let onFadeoutCompleted = (e) => {
111
- // console.log('fade out completed ', e, d);
112
109
  this._source$.next(gcData);
113
110
  };
114
111
 
@@ -139,7 +136,6 @@ export class ViewStreamElement {
139
136
  }
140
137
 
141
138
  onGarbageCollect(p) {
142
- // console.log('MEDIATOR onGarbageCollect ', this.vsid, this.vsName, p);
143
139
  if (this.domItem!==undefined) {
144
140
  this.domItem.unmount();
145
141
  }
@@ -161,9 +157,7 @@ export class ViewStreamElement {
161
157
  let append = (node, item) => node.appendChild(item);
162
158
  // DETERMINE WHETHER TO USE APPEND OR PREPEND
163
159
  // ON CONNECTING DOM ITEMS TO EACH OTHER
164
- // this.domItemEl = this.domItem.render();
165
160
  let attachFunc = d.attachType === 'appendChild' ? append : prepend;
166
- // d.node = isNil(d.query) ? d.node : d.query;
167
161
  attachFunc(container, this.domItem.render());
168
162
  this.setAnimateIn(d);
169
163
  }
@@ -177,7 +171,6 @@ export class ViewStreamElement {
177
171
  onAttachChildToSelf(p) {
178
172
  let data = p.childRenderData;
179
173
  this.combineDomItems(data);
180
- //console.log("ATTACHING CHID TO SELF ===============")
181
174
  return {
182
175
  action: 'CHILD_ATTACHED',
183
176
  $dir: this.$dirs.PI
@@ -201,13 +194,8 @@ export class ViewStreamElement {
201
194
  }
202
195
 
203
196
  renderDomItem(d) {
204
- let tagName, attributes, data, template;
205
- [tagName,attributes,data,template]=d;
206
- //console.log("RENDER DOM EL ",{tagName, attributes, data,template,d});
207
-
208
- //this.domItem = new DomElement(...d);
197
+ const [tagName,attributes,data,template]=d;
209
198
  this.domItem = new DomElement({tagName,attributes,data,template});
210
-
211
199
  return this.domItem;
212
200
  }
213
201
 
@@ -232,7 +220,6 @@ export class ViewStreamElement {
232
220
  */
233
221
  onRenderAndAttachToDom(d) {
234
222
  let getEl = (data) => this.renderDomItem(data);
235
- // let getEl = (data) => new DomElement(...data);
236
223
  d.attachData['el'] = getEl(props(['tagName', 'domAttributes', 'data', 'template'], d));
237
224
  this.combineDomItems(d.attachData);
238
225
  return {
@@ -252,13 +239,9 @@ export class ViewStreamElement {
252
239
  let action = payload.action;
253
240
  let defaultToFn = defaultTo((data) => this.extendedMethods(data));
254
241
  let fn = defaultToFn(this.options.hashMethods[action]);
255
- // console.log('MEDIATOR onObsSinkSubscribe before ', this.vsid, action, payload);
256
242
  let data = fn(payload);
257
- // data = this.addDefaultDir(data);
258
- // console.log('add default dir ', data);
259
243
  let sendData = (d) => this._source$.next(d);
260
244
  if (data !== undefined) {
261
- // console.log('MEDIATOR onObsSinkSubscribe ', this.vsid, data, payload);
262
245
  sendData(Object.freeze(data));
263
246
  }
264
247
  }
@@ -1,14 +1,11 @@
1
- import { uiValidations } from '../channels/channels-config';
2
1
  import {SpyneAppProperties} from '../utils/spyne-app-properties';
3
- //import { validate } from '../utils/channel-config-validator';
4
2
  import { gc } from '../utils/gc';
5
3
  import {
6
4
  compose,
7
5
  clone,
8
6
  fromPairs,
9
7
  toPairs,
10
- __,
11
- lte, defaultTo, prop, is,
8
+ is,
12
9
  } from 'ramda';
13
10
 
14
11
  export class ViewStreamPayload {
@@ -34,48 +31,17 @@ export class ViewStreamPayload {
34
31
  'data': data,
35
32
  'action': action
36
33
  };
37
- // this.getValidationChecks(name);
38
34
  this.sendToDirectorStream(options);
39
35
  }
40
- /* getValidationChecks(n) {
41
- let left = e => console.warn(e);
42
- let right = val => this.onRunValidations(val);
43
- let channelExists = SpyneAppProperties.channelsMap.testStream(n);
44
- if (channelExists === true) {
45
- return right(uiValidations);
46
- } else {
47
- return left('payload Needs a Valid Stream Name!');//
48
- }
49
- }
50
- onRunValidations(checks) {
51
- /!*validate(checks(), this.options).fold(
52
- this.onError.bind(this),
53
- this.onSuccess.bind(this));*!/
54
- }
55
- onPayloadValidated(p) {
56
- this.sendToDirectorStream(p);
57
- }*/
36
+
58
37
  sendToDirectorStream(payload) {
59
38
  let directorStream$ = SpyneAppProperties.channelsMap.getStream('DISPATCHER');
60
39
  const frozenPayload = ViewStreamPayload.deepClone(payload);
61
- //console.log('payload is ',frozenPayload);
62
40
  directorStream$.next(frozenPayload);
63
41
  payload = undefined;
64
42
 
65
- //this.gc();
66
- //console.timeEnd(label);
67
-
68
43
  delete this;
69
44
  }
70
- /*
71
- onError(errors) {
72
- console.warn('payload failed due to:\n' + errors.map(e => '* ' + e).join('\n'));
73
- this.gc();
74
- }
75
- onSuccess(payload) {
76
- this.onPayloadValidated(payload);
77
- }
78
- */
79
45
 
80
46
  static deepClone(o) {
81
47
  const isArr = is(Array);
@@ -87,44 +53,11 @@ export class ViewStreamPayload {
87
53
  }
88
54
 
89
55
 
90
-
91
- static deepFreeze(o) {
92
- //return o;
93
- //return Object.freeze(o);
94
- const elIsDomElement = compose(lte(0), defaultTo(-1), prop('nodeType'));
95
-
96
- try {
97
- Object.freeze(o);
98
- Object.getOwnPropertyNames(o).forEach(function(prop) {
99
- if (o.hasOwnProperty(prop)
100
- && elIsDomElement(o[prop]) === false
101
- && o[prop] !== null
102
- && (typeof o[prop] === "object" || typeof o[prop] === "function")
103
- && !Object.isFrozen(o[prop])) {
104
- ChannelPayload.deepFreeze(o[prop]);
105
- }
106
- });
107
-
108
- } catch(e){
109
- //console.log("FREEZE ERR ",{o,e});
110
- return o;
111
-
112
- }
113
-
114
- return o;
115
- }
116
-
117
56
  static getMouseEventKeys() {
118
57
  return ['altKey', 'bubbles', 'cancelBubble', 'cancelable', 'clientX', 'clientY', 'composed', 'ctrlKey', 'currentTarget', 'defaultPrevented', 'detail', 'eventPhase', 'fromElement', 'isTrusted', 'layerX', 'layerY', 'metaKey', 'movementX', 'movementY', 'offsetX', 'offsetY', 'pageX', 'pageY', 'path', 'relatedTarget', 'returnValue', 'screenX', 'screenY', 'shiftKey', 'sourceCapabilities', 'srcElement', 'target', 'timeStamp', 'toElement', 'type', 'view', 'which', 'x', 'y'];
119
58
  }
120
59
 
121
-
122
-
123
60
  addMixins() {
124
- // ==================================
125
- // BASE CORE MIXINS
126
- // ==================================
127
- // let coreMixins = baseCoreMixins();
128
61
  this.gc = gc;
129
62
  }
130
63
  }
@@ -1,9 +1,7 @@
1
- import {head, compose, reject, split, isEmpty, path, lte, defaultTo, prop} from 'ramda';
1
+ import {head, compose, reject, split, isEmpty, lte, defaultTo, prop} from 'ramda';
2
2
  import {SpyneAppProperties} from '../utils/spyne-app-properties';
3
3
 
4
4
  function generateSpyneSelectorId(el) {
5
- //const num = () => Math.floor(Math.random(10000000) * 10000000);
6
- //const num = () => Math.random().toString(36).substring(2, 8);;
7
5
  const num = () => Math.random().toString(36).replace(/\d/gm, '').substring(1,8);
8
6
  let vsid = `${num()}`;
9
7
  if (el.dataset.vsid === undefined) {
@@ -203,9 +201,6 @@ function ViewStreamSelector(cxt, str) {
203
201
  };
204
202
 
205
203
 
206
-
207
-
208
-
209
204
  /**
210
205
  * Attaches html to the Selector's element
211
206
  * @param htmlElement