spyne 0.16.0 → 0.18.0

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 (81) hide show
  1. package/.travis.yml +2 -2
  2. package/karma.conf.js +18 -69
  3. package/lib/spyne.js +29752 -28672
  4. package/lib/spyne.min.js +1 -1
  5. package/lib/spyne.min.js.LICENSE.txt +9 -9
  6. package/package.json +21 -42
  7. package/src/spyne/channels/channel-fetch-class.js +25 -5
  8. package/src/spyne/channels/channel-payload-class.js +36 -23
  9. package/src/spyne/channels/channel-proxy.js +7 -5
  10. package/src/spyne/channels/channel.js +54 -28
  11. package/src/spyne/channels/channels-config.js +2 -4
  12. package/src/spyne/channels/{channels-delegator.js → channels-map.js} +25 -41
  13. package/src/spyne/channels/spyne-channel-lifecycle.js +1 -2
  14. package/src/spyne/channels/spyne-channel-route.js +21 -62
  15. package/src/spyne/channels/spyne-channel-ui.js +1 -2
  16. package/src/spyne/channels/spyne-channel-window.js +24 -35
  17. package/src/spyne/spyne-app.js +163 -0
  18. package/src/spyne/spyne-plugins.js +43 -40
  19. package/src/spyne/spyne.js +6 -157
  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 +9 -76
  23. package/src/spyne/utils/frp-tools.js +21 -1
  24. package/src/spyne/utils/gc.js +1 -1
  25. package/src/spyne/utils/route-channel-updater.js +0 -4
  26. package/src/spyne/utils/spyne-app-properties.js +183 -0
  27. package/src/spyne/utils/spyne-logger.js +18 -0
  28. package/src/spyne/utils/spyne-plugins-methods.js +97 -0
  29. package/src/spyne/utils/spyne-trait.js +2 -5
  30. package/src/spyne/utils/spyne-utils-channel-route-url.js +3 -8
  31. package/src/spyne/utils/spyne-utils-channel-route.js +6 -14
  32. package/src/spyne/utils/spyne-utils-channel-window.js +1 -3
  33. package/src/spyne/utils/viewstream-observables.js +2 -3
  34. package/src/spyne/views/dom-element-template.js +2 -7
  35. package/src/spyne/views/dom-element.js +0 -19
  36. package/src/spyne/views/view-stream-broadcaster.js +5 -10
  37. package/src/spyne/views/view-stream-element.js +1 -18
  38. package/src/spyne/views/view-stream-payload.js +31 -37
  39. package/src/spyne/views/view-stream-selector.js +3 -8
  40. package/src/spyne/views/view-stream.js +281 -297
  41. package/src/tests/channels/channel-fetch.test.js +102 -0
  42. package/src/tests/channels/channel-payload-class.test.js +14 -5
  43. package/src/tests/channels/channel-payload-filter.test.js +3 -28
  44. package/src/tests/channels/channel.test.js +38 -0
  45. package/src/tests/index.js +0 -1
  46. package/src/tests/index.test.js +6 -0
  47. package/src/tests/spyne-app.test.js +27 -0
  48. package/src/tests/spyne-plugin.test.js +13 -9
  49. package/src/tests/utils/plugins-methods.test.js +103 -0
  50. package/src/tests/utils/spyne-app-properties.test.js +11 -0
  51. package/webpack.config.js +19 -34
  52. package/lib/channel-action-filter.test.3516417154.js +0 -20
  53. package/lib/channel-dom.test.104366832.js +0 -20
  54. package/lib/channel-fetch-util.test.3506167575.js +0 -20
  55. package/lib/channel-payload-class.test.1081032524.js +0 -20
  56. package/lib/channel-payload-filter.test.977308429.js +0 -20
  57. package/lib/channel-route.test.3513636042.js +0 -20
  58. package/lib/channel-stream-item.test.119388071.js +0 -20
  59. package/lib/channel-ui.test.3778619579.js +0 -20
  60. package/lib/channel-util-dom.test.908537750.js +0 -20
  61. package/lib/commons.js +0 -49268
  62. package/lib/dom-el-selectors.test.1268485916.js +0 -20
  63. package/lib/dom-el-template.test.842696987.js +0 -20
  64. package/lib/dom-el.test.2045076905.js +0 -20
  65. package/lib/frp-tools.test.2503042868.js +0 -20
  66. package/lib/import.test.2658619365.js +0 -20
  67. package/lib/index.test.2372977745.js +0 -20
  68. package/lib/route-utils.test.273346057.js +0 -20
  69. package/lib/runtime.js +0 -172
  70. package/lib/spyne-plugin.test.301647328.js +0 -20
  71. package/lib/spyne.js.map +0 -1
  72. package/lib/url-utils.test.1931189114.js +0 -20
  73. package/lib/view-stream-broadcaster.test.1306675435.js +0 -20
  74. package/lib/view-stream-enhancer-loader.test.3617829096.js +0 -20
  75. package/lib/view-stream-enhancer.test.1053738169.js +0 -20
  76. package/lib/view-stream.test.573231784.js +0 -20
  77. package/src/spyne/channels/lifestream-payload.js +0 -56
  78. package/src/spyne/utils/channel-data-packet-generator.js +0 -200
  79. package/src/spyne/utils/channel-data-packet.js +0 -59
  80. package/src/spyne/utils/viewstream-dom-utils.js +0 -51
  81. package/src/spyne/views/view-stream-enhancer-loader.js +0 -70
@@ -1,6 +1,12 @@
1
- import { uiValidations } from '../channels/channels-config';
2
- import { validate } from '../utils/channel-config-validator';
1
+ import {SpyneAppProperties} from '../utils/spyne-app-properties';
3
2
  import { gc } from '../utils/gc';
3
+ import {
4
+ compose,
5
+ clone,
6
+ fromPairs,
7
+ toPairs,
8
+ is,
9
+ } from 'ramda';
4
10
 
5
11
  export class ViewStreamPayload {
6
12
  /**
@@ -18,52 +24,40 @@ export class ViewStreamPayload {
18
24
  * @param {Boolean} debug
19
25
  */
20
26
  constructor(name, observable, data, action = 'subscribe', debug = false) {
21
- this.addMixins();
22
- this.options = {
27
+ //this.addMixins();
28
+ const options = {
23
29
  'name' : name,
24
30
  'observable': observable,
25
31
  'data': data,
26
32
  'action': action
27
33
  };
28
- this.getValidationChecks(name);
29
- }
30
- getValidationChecks(n) {
31
- let left = e => console.warn(e);
32
- let right = val => this.onRunValidations(val);
33
- const channelMap = window.Spyne.channels.map;
34
- if (channelMap.has(n) === true) {
35
- return right(uiValidations);
36
- } else {
37
- return left('payload Needs a Valid Stream Name!');//
38
- }
39
- }
40
- onRunValidations(checks) {
41
- validate(checks(), this.options).fold(
42
- this.onError.bind(this),
43
- this.onSuccess.bind(this));
44
- }
45
- onPayloadValidated(p) {
46
- this.sendToDirectorStream(p);
34
+ this.sendToDirectorStream(options);
47
35
  }
36
+
48
37
  sendToDirectorStream(payload) {
49
- let streamsController = window.Spyne.channels;// getGlobalParam('streamsController');
50
- let directorStream$ = streamsController.getStream('DISPATCHER');
51
- // console.log('payload is ',payload);
52
- directorStream$.next(payload);
53
- this.gc();
38
+ let directorStream$ = SpyneAppProperties.channelsMap.getStream('DISPATCHER');
39
+ const frozenPayload = ViewStreamPayload.deepClone(payload);
40
+ directorStream$.next(frozenPayload);
41
+ payload = undefined;
42
+
43
+ delete this;
54
44
  }
55
- onError(errors) {
56
- console.warn('payload failed due to:\n' + errors.map(e => '* ' + e).join('\n'));
57
- this.gc();
45
+
46
+ static deepClone(o) {
47
+ const isArr = is(Array);
48
+ const isObj = is(Object);
49
+ const isIter = ob => isArr(ob)===false && isObj(ob)===true;
50
+ const isIterable = isIter(o);
51
+ return isIterable ? compose(fromPairs, toPairs, clone)(o) : clone(o);
52
+
58
53
  }
59
- onSuccess(payload) {
60
- this.onPayloadValidated(payload);
54
+
55
+
56
+ static getMouseEventKeys() {
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'];
61
58
  }
59
+
62
60
  addMixins() {
63
- // ==================================
64
- // BASE CORE MIXINS
65
- // ==================================
66
- // let coreMixins = baseCoreMixins();
67
61
  this.gc = gc;
68
62
  }
69
63
  }
@@ -1,9 +1,7 @@
1
- import {head, compose, reject, split, isEmpty, path, lte, defaultTo, prop} from 'ramda';
2
-
1
+ import {head, compose, reject, split, isEmpty, lte, defaultTo, prop} from 'ramda';
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) {
@@ -15,7 +13,7 @@ function generateSpyneSelectorId(el) {
15
13
  }
16
14
 
17
15
  function isDevMode(){
18
- return path(['Spyne', 'config', 'debug'], window) === true;
16
+ return SpyneAppProperties.debug === true;
19
17
  }
20
18
 
21
19
 
@@ -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