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,13 +1,11 @@
1
1
  import { baseCoreMixins } from '../utils/mixins/base-core-mixins';
2
- //import { baseStreamsMixins } from '../utils/mixins/base-streams-mixins';
2
+ import {SpyneAppProperties} from '../utils/spyne-app-properties';
3
3
  import { deepMerge } from '../utils/deep-merge';
4
4
  import {
5
5
  findStrOrRegexMatchStr,
6
6
  getConstructorName
7
7
  } from '../utils/frp-tools';
8
- // import {gc} from '../utils/gc';
9
8
  import { ViewStreamElement } from './view-stream-element';
10
- import { ViewStreamEnhancerLoader } from './view-stream-enhancer-loader';
11
9
  import { registeredStreamNames } from '../channels/channels-config';
12
10
  import { ViewStreamBroadcaster } from './view-stream-broadcaster';
13
11
  import { ViewStreamPayload } from './view-stream-payload';
@@ -21,12 +19,10 @@ import {
21
19
  compose,
22
20
  isNil,
23
21
  all,
24
- isEmpty,
25
22
  forEach,
26
23
  toLower,
27
24
  either,
28
25
  findIndex,
29
- partial,
30
26
  apply,
31
27
  test,
32
28
  flatten,
@@ -37,19 +33,15 @@ import {
37
33
  propSatisfies,
38
34
  allPass,
39
35
  curry,
40
- nth,
41
36
  is,
42
37
  slice,
43
38
  path,
44
39
  omit,
45
40
  ifElse,
46
- lensPath,
47
- view,
48
41
  clone,
49
42
  mergeRight,
50
43
  where,
51
44
  equals,
52
- assocPath,
53
45
  } from 'ramda';
54
46
 
55
47
  const rMap = require('ramda').map;
@@ -194,7 +186,6 @@ export class ViewStream {
194
186
  if (this.props.traits!==undefined){
195
187
  this.addTraits(this.props.traits);
196
188
  }
197
- this.loadEnhancers();
198
189
  this.loadAllMethods();
199
190
  this.props.action = 'LOADED';
200
191
  this.sink$ = new Subject();
@@ -211,11 +202,244 @@ export class ViewStream {
211
202
  this.checkIfElementAlreadyExists();
212
203
  }
213
204
 
205
+ // ============================= HASH KEY AND SPIGOT METHODS==============================
206
+ get source$() {
207
+ return this._source$;
208
+ }
209
+
210
+ get attributesArray() {
211
+ return [
212
+ 'accept',
213
+ 'accept-charset',
214
+ 'accesskey',
215
+ 'action',
216
+ 'align',
217
+ 'allow',
218
+ 'alt',
219
+ 'aria-autocomplete',
220
+ 'aria-checked',
221
+ 'aria-disabled',
222
+ 'aria-expanded',
223
+ 'aria-haspopup',
224
+ 'aria-hidden',
225
+ 'aria-invalid',
226
+ 'aria-label',
227
+ 'aria-level',
228
+ 'aria-multiline',
229
+ 'aria-multiselectable',
230
+ 'aria-orientation',
231
+ 'aria-pressed',
232
+ 'aria-readonly',
233
+ 'aria-required',
234
+ 'aria-selected',
235
+ 'aria-sort',
236
+ 'aria-valuemax',
237
+ 'aria-valuemin',
238
+ 'aria-valuenow',
239
+ 'aria-valuetext',
240
+ 'aria-atomic',
241
+ 'aria-busy',
242
+ 'aria-live',
243
+ 'aria-relevant',
244
+ 'aria-dropeffect',
245
+ 'aria-grabbed',
246
+ 'aria-activedescendant',
247
+ 'aria-controls',
248
+ 'aria-describedby',
249
+ 'aria-flowto',
250
+ 'aria-labelledby',
251
+ 'aria-owns',
252
+ 'aria-posinset',
253
+ 'aria-setsize',
254
+ 'async',
255
+ 'autocapitalize',
256
+ 'autocomplete',
257
+ 'autofocus',
258
+ 'autoplay',
259
+ 'bgcolor',
260
+ 'border',
261
+ 'buffered',
262
+ 'challenge',
263
+ 'charset',
264
+ 'checked',
265
+ 'cite',
266
+ 'class',
267
+ 'code',
268
+ 'codebase',
269
+ 'color',
270
+ 'cols',
271
+ 'colspan',
272
+ 'content',
273
+ 'contenteditable',
274
+ 'contextmenu',
275
+ 'controls',
276
+ 'coords',
277
+ 'crossorigin',
278
+ 'csp',
279
+ 'dataset',
280
+ 'datetime',
281
+ 'decoding',
282
+ 'default',
283
+ 'defer',
284
+ 'dir',
285
+ 'dirname',
286
+ 'disabled',
287
+ 'download',
288
+ 'draggable',
289
+ 'dropzone',
290
+ 'enctype',
291
+ 'for',
292
+ 'form',
293
+ 'formaction',
294
+ 'headers',
295
+ 'height',
296
+ 'hidden',
297
+ 'high',
298
+ 'href',
299
+ 'hreflang',
300
+ 'http-equiv',
301
+ 'icon',
302
+ 'id',
303
+ 'importance',
304
+ 'integrity',
305
+ 'ismap',
306
+ 'itemprop',
307
+ 'keytype',
308
+ 'kind',
309
+ 'label',
310
+ 'lang',
311
+ 'language',
312
+ 'lazyload',
313
+ 'list',
314
+ 'loop',
315
+ 'low',
316
+ 'manifest',
317
+ 'max',
318
+ 'maxlength',
319
+ 'minlength',
320
+ 'media',
321
+ 'method',
322
+ 'min',
323
+ 'multiple',
324
+ 'muted',
325
+ 'name',
326
+ 'novalidate',
327
+ 'open',
328
+ 'optimum',
329
+ 'pattern',
330
+ 'ping',
331
+ 'placeholder',
332
+ 'poster',
333
+ 'preload',
334
+ 'radiogroup',
335
+ 'readonly',
336
+ 'referrerpolicy',
337
+ 'rel',
338
+ 'required',
339
+ 'reversed',
340
+ 'role',
341
+ 'rows',
342
+ 'rowspan',
343
+ 'sandbox',
344
+ 'scope',
345
+ 'scoped',
346
+ 'selected',
347
+ 'shape',
348
+ 'size',
349
+ 'sizes',
350
+ 'slot',
351
+ 'span',
352
+ 'spellcheck',
353
+ 'src',
354
+ 'srcdoc',
355
+ 'srclang',
356
+ 'srcset',
357
+ 'start',
358
+ 'step',
359
+ 'style',
360
+ 'summary',
361
+ 'tabindex',
362
+ 'target',
363
+ 'title',
364
+ 'translate',
365
+ 'type',
366
+ 'usemap',
367
+ 'value',
368
+ 'width',
369
+ 'wrap'
370
+ ];
371
+ }
372
+
373
+ static isDevMode(){
374
+ return SpyneAppProperties.debug;
375
+ }
376
+
377
+ static checkIfActionsAreRegistered(channelsArr=[], actionsArr){
378
+ if (actionsArr.length>0){
379
+ const getAllActions = (a)=>{
380
+ const getRegisteredActionsArr = (str)=>SpyneAppProperties.getChannelActions(str);
381
+ let arr = a.map(getRegisteredActionsArr);
382
+ return flatten(arr);
383
+ }
384
+ const checkForMatch = (strMatch) => {
385
+ let re = new RegExp(strMatch);
386
+ let actionIndex = findIndex(test(re), getAllActionsArr)
387
+ if (actionIndex<0){
388
+ let channelSyntax = channelsArr.length === 1 ? "from added channel" : "from added channels";
389
+ console.warn(`Spyne Warning: The action, ${strMatch}, in ${this.props.name}, does not match any of the registered actions ${channelSyntax}, ${channelsArr.join(', ')}`)
390
+ }
391
+ // const vsnum = ()=> R.test(new RegExp(str), "CHANNEL_ROUTE_TEST_EVENT")
392
+ }
393
+ let getAllActionsArr = getAllActions(channelsArr);
394
+ actionsArr.forEach(checkForMatch);
395
+
396
+ }
397
+
398
+ }
399
+
400
+ /**
401
+ *
402
+ * Add any query within the ViewStream's dom and any dom events to automatically be observed by the UI Channel.
403
+ * <br>
404
+ * @example
405
+ *
406
+ * broadcastEvents() {
407
+ * // ADD BUTTON EVENTS AS NESTED ARRAYS
408
+ * return [
409
+ * ['#my-button', 'mouseover'],
410
+ * ['#my-input', 'change']
411
+ * ]
412
+ * }
413
+ *
414
+ *
415
+ * */
416
+
417
+
418
+ static isValidNestedArr(eventsArr){
419
+ const isTrue = equals(true);
420
+ const allIsTrue = all(isTrue);
421
+ const isString = is(String);
422
+ const isValidArr = compose(allIsTrue, rMap(isString), slice(0,2), defaultTo([]));
423
+ const mapEventsArrFn = compose( allIsTrue, rMap(isValidArr), defaultTo([]));
424
+ return mapEventsArrFn(eventsArr);
425
+ }
426
+
427
+ static elIsDomElement(o) {
428
+ if (is(String,o)){
429
+ o = document.querySelector(o);
430
+ }
431
+
432
+
433
+ return compose(lte(0), defaultTo(-1), prop('nodeType'))(o);
434
+ }
435
+
214
436
  updatePropsToMatchEl() {
215
437
  const getTagName = compose(toLower, either(prop('tagName'), always('')));
216
438
  this.props.tagName = getTagName(this.props.el);
217
439
  }
218
440
 
441
+ // =====================================================================
442
+
219
443
  checkIfElementAlreadyExists() {
220
444
  const elIsDomElement = compose(lte(0), defaultTo(-1), prop('nodeType'));
221
445
  const elIsRendered = el => document.body.contains(el);
@@ -228,12 +452,6 @@ export class ViewStream {
228
452
  }
229
453
  }
230
454
 
231
- loadEnhancers(arr = []) {
232
- let enhancerLoader = new ViewStreamEnhancerLoader(this, arr);
233
- this.props['enhancersMap'] = enhancerLoader.getEnhancersMap();
234
- enhancerLoader = undefined;
235
- }
236
-
237
455
  loadAllMethods() {
238
456
  const channelFn = curry(this.onChannelMethodCall.bind(this));
239
457
  let createExtraStatesMethod = (arr) => {
@@ -286,23 +504,17 @@ export class ViewStream {
286
504
  this.sourceStreams.raw$.next(obj);
287
505
  }
288
506
  let filterPayload = defaultTo(always(true), actionFilter);
289
- const filterLabel = `filtering-${Math.floor(Math.random() * 999999)}`;
290
507
 
291
508
  if (actionFilter !== undefined) {
292
- //console.time(filterLabel);
293
-
294
509
 
295
510
  }
296
511
  if (filterPayload(p) === true) {
297
- // p = omit(['dir$'],p);
298
512
  p = omit(['$dir'], p)
513
+
299
514
  if (actionFilter !== undefined) {
300
515
 
301
- // console.log(`pf - ${filterLabel}: `, p);
302
- //console.timeEnd(filterLabel);
303
516
  }
304
517
  runFunc(p);
305
- //this[str](p);
306
518
  }
307
519
  }
308
520
 
@@ -321,7 +533,6 @@ export class ViewStream {
321
533
  return deepMerge.all([{}, hashSourceKeys, extendedSourcesHashMethods]);
322
534
  }
323
535
 
324
- // =====================================================================
325
536
  // ====================== MAIN STREAM METHODS ==========================
326
537
  initViewStream() {
327
538
  this._source$ = this._rawSource$.pipe(map(
@@ -388,6 +599,8 @@ export class ViewStream {
388
599
 
389
600
  }
390
601
 
602
+ // =======================================================================================
603
+
391
604
  onChildCompleted(p) {
392
605
  let findName = (x) => {
393
606
  let finalDest = (y) => {
@@ -405,15 +618,6 @@ export class ViewStream {
405
618
  return childCompletedData;
406
619
  }
407
620
 
408
- static removeDataFromTmpDir(vsid){
409
- const tmpDir = path(['Spyne', 'config', 'tmp'], window);
410
- const tmpDirExists = tmpDir[vsid] !== undefined;
411
- if(tmpDirExists){
412
- //console.log('remove from tmp dir ', {tmpDirExists, vsid});
413
- delete window.Spyne.config.tmp[vsid];
414
- }
415
- }
416
-
417
621
  initAutoMergeSourceStreams() {
418
622
  // ====================== SUBSCRIPTION SOURCE =========================
419
623
  let subscriber = {
@@ -510,6 +714,14 @@ export class ViewStream {
510
714
  console.log('ALL ERROR ', this.constructor.name, payload);
511
715
  }
512
716
 
717
+ /*
718
+ attachChildToView(data) {
719
+ // let childRenderData = data.attachData;
720
+ // console.log('CHILD DATA ', this.constructor.name, childRenderData);
721
+ // this.openSpigot('ATTACH_CHILD_TO_SELF', {childRenderData});
722
+ }
723
+ */
724
+
513
725
  onSubscribeToSourcesComplete() {
514
726
  // console.log('==== EXTIRPATER ALL COMPLETED ====', this.constructor.name);
515
727
  this.tracer('onSubscribeToSourcesComplete', 'VS_DETRITUS_COLLECT');
@@ -517,12 +729,6 @@ export class ViewStream {
517
729
  this.openSpigot('VS_DETRITUS_COLLECT');
518
730
  }
519
731
 
520
- // =======================================================================================
521
- // ============================= HASH KEY AND SPIGOT METHODS==============================
522
- get source$() {
523
- return this._source$;
524
- }
525
-
526
732
  sendExtendedStreams(payload) {
527
733
  this.tracer('sendExtendedStreams', payload);
528
734
  // console.log('extended methods ', payload.action, payload);
@@ -544,14 +750,6 @@ export class ViewStream {
544
750
  this.openSpigot('VS_SPAWN_AND_ATTACH_TO_DOM', { attachData });
545
751
  }
546
752
 
547
- /*
548
- attachChildToView(data) {
549
- // let childRenderData = data.attachData;
550
- // console.log('CHILD DATA ', this.constructor.name, childRenderData);
551
- // this.openSpigot('ATTACH_CHILD_TO_SELF', {childRenderData});
552
- }
553
- */
554
-
555
753
  // ===================================== EXTIRPATE METHODS =================================
556
754
  checkParentDispose(p) {
557
755
  if (p.from$ === 'parent') {
@@ -563,6 +761,8 @@ export class ViewStream {
563
761
 
564
762
  }
565
763
 
764
+ // ===================================== SINK$ METHODS =================================
765
+
566
766
  /**
567
767
  *
568
768
  * Wraps window.setTimeout with a check to see if "this" ViewStream element and its props property still exists
@@ -582,7 +782,6 @@ export class ViewStream {
582
782
  window.setTimeout(timeoutMethod, ms);
583
783
  }
584
784
 
585
-
586
785
  /**
587
786
  *
588
787
  * Begins the removal process of the ViewStream instance along with all of its chained ViewStream children.
@@ -609,20 +808,16 @@ export class ViewStream {
609
808
  this.tracer('onReadyToGC', isInternal, p);
610
809
  }
611
810
 
612
- // ===================================== SINK$ METHODS =================================
613
-
614
811
  openSpigot(action, obj = {}) {
615
812
  if (this.props !== undefined) {
616
813
  this.props.action = action;
617
814
  let data = mergeRight(this.props, obj);
815
+ //let data = Object.assign({}, this.props, obj);
816
+
618
817
  this.sink$.next(Object.freeze(data));
619
818
  }
620
819
  }
621
820
 
622
- static isDevMode(){
623
- return path(['Spyne', 'config', 'debug'], window)===true;
624
- }
625
-
626
821
  setAttachData(attachType, query) {
627
822
  const checkQuery = ()=>{
628
823
  let q = this.props.el.querySelector(query);
@@ -654,11 +849,12 @@ export class ViewStream {
654
849
 
655
850
  setAttachParentData(attachType, query, level) {
656
851
  query = query!=="" ? query : undefined;
852
+ const node = this.getParentEls(this.props.el, level);
657
853
  return {
658
- node: this.getParentEls(this.props.el, level),
854
+ node,
659
855
  type: 'ViewStreamObservable',
660
856
  attachType,
661
- query: this.props.el.parentElement.querySelector(query)
857
+ query: node.querySelector(query)
662
858
  };
663
859
  }
664
860
 
@@ -834,7 +1030,12 @@ export class ViewStream {
834
1030
  postRender() {
835
1031
  this.beforeAfterRender();
836
1032
  this.afterRender();
1033
+
837
1034
  this.onRendered();
1035
+ const startAnimFrameAfterRendered = ()=>this.onAnimFrameAfterRendered();
1036
+ requestAnimationFrame(startAnimFrameAfterRendered);
1037
+
1038
+
838
1039
 
839
1040
  if (this.isDevMode === true ){
840
1041
  const eventsArr = this.broadcastEvents();
@@ -860,12 +1061,10 @@ export class ViewStream {
860
1061
 
861
1062
  traits.forEach(addTrait);
862
1063
 
863
- if (this.isDevMode === true){
864
- const actionsArr = this.addActionListeners();
865
- }
866
-
867
1064
  }
868
1065
 
1066
+ // ================================= METHODS TO BE EXTENDED ==============================
1067
+
869
1068
  afterBroadcastEvents(){
870
1069
 
871
1070
  if (this.isDevMode === true ){
@@ -898,29 +1097,6 @@ export class ViewStream {
898
1097
  this.setTimeout(delayForProxyChannelResets, 500);
899
1098
  }
900
1099
  }
901
- static checkIfActionsAreRegistered(channelsArr=[], actionsArr){
902
- //const getActionsFn = path(['Spyne', 'channels', 'getChannelActions'], window);
903
- if (actionsArr.length>0){
904
- const getAllActions = (a)=>{
905
- const getRegisteredActionsArr = (str)=>window.Spyne.channels.getChannelActions(str);
906
- let arr = a.map(getRegisteredActionsArr);
907
- return flatten(arr);
908
- }
909
- const checkForMatch = (strMatch) => {
910
- let re = new RegExp(strMatch);
911
- let actionIndex = findIndex(test(re), getAllActionsArr)
912
- if (actionIndex<0){
913
- let channelSyntax = channelsArr.length === 1 ? "from added channel" : "from added dchannels";
914
- console.warn(`Spyne Warning: The action, ${strMatch}, in ${this.props.name}, does not match any of the registered actions ${channelSyntax}, ${channelsArr.join(', ')}`)
915
- }
916
- // const vsnum = ()=> R.test(new RegExp(str), "CHANNEL_ROUTE_TEST_EVENT")
917
- }
918
- let getAllActionsArr = getAllActions(channelsArr);
919
- actionsArr.forEach(checkForMatch);
920
-
921
- }
922
-
923
- }
924
1100
 
925
1101
  setDataVSID(){
926
1102
  this.props.el.dataset.vsid = this.props.vsid;// String(this.props.vsid).replace(/^(vsid-)(.*)$/, '$2');
@@ -940,13 +1116,11 @@ export class ViewStream {
940
1116
  // window.theEl$ = this.props.el$;
941
1117
  }
942
1118
 
943
- // ================================= METHODS TO BE EXTENDED ==============================
944
-
945
-
946
1119
  // THIS IS AN EVENT HOLDER METHOD BECAUSE SENDING DOWNSTREAM REQUIRE THE PARENT TO HAVE A METHOD
947
1120
  downStream() {
948
1121
 
949
1122
  }
1123
+
950
1124
  /**
951
1125
  *
952
1126
  * This method is called as soon as the element has been rendered.
@@ -956,46 +1130,24 @@ export class ViewStream {
956
1130
  onRendered() {
957
1131
  }
958
1132
 
959
-
960
-
961
1133
  /**
962
1134
  *
963
- * (Deprecated. Use onRendered). This method is called as soon as the element has been rendered.
1135
+ * This method is useful to add animation classes to be called immediately after rendering.
964
1136
  *
965
1137
  */
966
1138
 
967
- afterRender() {
1139
+ onAnimFrameAfterRendered() {
968
1140
  }
969
1141
 
970
1142
  /**
971
1143
  *
972
- * Add any query within the ViewStream's dom and any dom events to automatically be observed by the UI Channel.
973
- * <br>
974
- * @example
975
- *
976
- * broadcastEvents() {
977
- * // ADD BUTTON EVENTS AS NESTED ARRAYS
978
- * return [
979
- * ['#my-button', 'mouseover'],
980
- * ['#my-input', 'change']
981
- * ]
982
- * }
983
- *
1144
+ * (Deprecated. Use onRendered). This method is called as soon as the element has been rendered.
984
1145
  *
985
- * */
986
-
1146
+ */
987
1147
 
988
- static isValidNestedArr(eventsArr){
989
- const isTrue = equals(true);
990
- const allIsTrue = all(isTrue);
991
- const isString = is(String);
992
- const isValidArr = compose(allIsTrue, rMap(isString), slice(0,2), defaultTo([]));
993
- const mapEventsArrFn = compose( allIsTrue, rMap(isValidArr), defaultTo([]));
994
- return mapEventsArrFn(eventsArr);
1148
+ afterRender() {
995
1149
  }
996
1150
 
997
-
998
-
999
1151
  broadcastEvents() {
1000
1152
  // ADD BUTTON EVENTS AS NESTED ARRAYS
1001
1153
  return [];
@@ -1021,7 +1173,7 @@ export class ViewStream {
1021
1173
  let error = c => console.warn(
1022
1174
  `channel name ${c} is not within ${registeredStreamNames}`);
1023
1175
  let startSubscribe = (c) => {
1024
- let obs$ = window.Spyne.channels.getStream(c).observer;
1176
+ let obs$ = SpyneAppProperties.channelsMap.getStream(c).observer;
1025
1177
 
1026
1178
  return obs$.pipe(takeWhile(p => this.deleted !== true));
1027
1179
  };// getGlobalParam('streamsController').getStream(c).observer;
@@ -1092,16 +1244,14 @@ export class ViewStream {
1092
1244
  this.props.addedChannels.push(str);
1093
1245
  }
1094
1246
 
1095
-
1096
1247
  checkIfChannelExists(channelName) {
1097
- let channelExists = window.Spyne.channels.map.get(channelName) !== undefined;
1248
+ let channelExists = SpyneAppProperties.channelsMap.testStream(channelName);
1098
1249
  if (channelExists !== true) {
1099
1250
  console.warn(`SPYNE WARNING: The ChannelPayload from ${this.props.name}, has been sent to a channel, ${channelName}, that has not been registered!`);
1100
1251
  }
1101
1252
  return channelExists;
1102
1253
  }
1103
1254
 
1104
-
1105
1255
  /**
1106
1256
  *
1107
1257
  * @param {String} channelName
@@ -1116,9 +1266,17 @@ export class ViewStream {
1116
1266
  *
1117
1267
  */
1118
1268
 
1119
- sendInfoToChannel(channelName, pl = {}, action = 'VIEWSTREAM_EVENT') {
1269
+ sendInfoToChannel(channelName, pl = {}, action) {
1120
1270
  const payload = pl;
1121
1271
 
1272
+ let defaultToAction = defaultTo('VIEWSTREAM_EVENT');
1273
+ const channelDefaultActionHash = {
1274
+ CHANNEL_ROUTE: "CHANNEL_ROUTE_CHANGE_EVENT"
1275
+ }
1276
+ const getActionFn = compose(defaultToAction, prop(channelName))
1277
+
1278
+ action = action || getActionFn(channelDefaultActionHash);
1279
+
1122
1280
 
1123
1281
  let data = { payload, action };
1124
1282
 
@@ -1126,22 +1284,13 @@ export class ViewStream {
1126
1284
  data.srcElement = compose(pick(['id','vsid','class','tagName']), prop('props'))(this);
1127
1285
  if (this.checkIfChannelExists(channelName) === true) {
1128
1286
  if (/CHANNEL_LIFECYCLE/.test(action)===false){
1129
- const payloadPath = ['Spyne', 'config', 'tmp'];
1130
- const payloadPathAll = ['Spyne', 'config', 'tmp', this.props.vsid];
1131
- const tmpDir = path(payloadPath, window);
1132
- tmpDir[this.props.vsid] = pl;
1133
- const vsid = this.props.vsid;
1134
-
1135
1287
  Object.defineProperties(data, {
1136
1288
  payload: {
1137
- get: ()=> compose(clone, path(payloadPathAll))(window)
1289
+ get: ()=> clone(pl)
1138
1290
 
1139
1291
  }
1140
1292
  })
1141
1293
 
1142
- const removePayload = ()=>ViewStream.removeDataFromTmpDir(vsid);
1143
- window.requestAnimationFrame(removePayload)
1144
-
1145
1294
  }
1146
1295
  let obs$ = of(data);
1147
1296
  return new ViewStreamPayload(channelName, obs$, data);
@@ -1149,15 +1298,12 @@ export class ViewStream {
1149
1298
  }
1150
1299
 
1151
1300
 
1152
-
1153
-
1154
-
1155
-
1156
1301
  }
1157
1302
 
1158
1303
  tracer(...args) {
1159
1304
  this.sendLifecycleMethod(...args);
1160
1305
  }
1306
+
1161
1307
  sendLifecycleMethodInactive() {
1162
1308
 
1163
1309
  }
@@ -1181,171 +1327,9 @@ export class ViewStream {
1181
1327
 
1182
1328
  isLocalEvent(channelPayloadItem) {
1183
1329
  const itemEl = path(['srcElement', 'el'], channelPayloadItem);
1184
- return itemEl !== undefined &&
1185
- this.props.el.contains(channelPayloadItem.srcElement.el);
1186
- }
1187
-
1188
- get attributesArray() {
1189
- return [
1190
- 'accept',
1191
- 'accept-charset',
1192
- 'accesskey',
1193
- 'action',
1194
- 'align',
1195
- 'allow',
1196
- 'alt',
1197
- 'aria-autocomplete',
1198
- 'aria-checked',
1199
- 'aria-disabled',
1200
- 'aria-expanded',
1201
- 'aria-haspopup',
1202
- 'aria-hidden',
1203
- 'aria-invalid',
1204
- 'aria-label',
1205
- 'aria-level',
1206
- 'aria-multiline',
1207
- 'aria-multiselectable',
1208
- 'aria-orientation',
1209
- 'aria-pressed',
1210
- 'aria-readonly',
1211
- 'aria-required',
1212
- 'aria-selected',
1213
- 'aria-sort',
1214
- 'aria-valuemax',
1215
- 'aria-valuemin',
1216
- 'aria-valuenow',
1217
- 'aria-valuetext',
1218
- 'aria-atomic',
1219
- 'aria-busy',
1220
- 'aria-live',
1221
- 'aria-relevant',
1222
- 'aria-dropeffect',
1223
- 'aria-grabbed',
1224
- 'aria-activedescendant',
1225
- 'aria-controls',
1226
- 'aria-describedby',
1227
- 'aria-flowto',
1228
- 'aria-labelledby',
1229
- 'aria-owns',
1230
- 'aria-posinset',
1231
- 'aria-setsize',
1232
- 'async',
1233
- 'autocapitalize',
1234
- 'autocomplete',
1235
- 'autofocus',
1236
- 'autoplay',
1237
- 'bgcolor',
1238
- 'border',
1239
- 'buffered',
1240
- 'challenge',
1241
- 'charset',
1242
- 'checked',
1243
- 'cite',
1244
- 'class',
1245
- 'code',
1246
- 'codebase',
1247
- 'color',
1248
- 'cols',
1249
- 'colspan',
1250
- 'content',
1251
- 'contenteditable',
1252
- 'contextmenu',
1253
- 'controls',
1254
- 'coords',
1255
- 'crossorigin',
1256
- 'csp',
1257
- 'dataset',
1258
- 'datetime',
1259
- 'decoding',
1260
- 'default',
1261
- 'defer',
1262
- 'dir',
1263
- 'dirname',
1264
- 'disabled',
1265
- 'download',
1266
- 'draggable',
1267
- 'dropzone',
1268
- 'enctype',
1269
- 'for',
1270
- 'form',
1271
- 'formaction',
1272
- 'headers',
1273
- 'height',
1274
- 'hidden',
1275
- 'high',
1276
- 'href',
1277
- 'hreflang',
1278
- 'http-equiv',
1279
- 'icon',
1280
- 'id',
1281
- 'importance',
1282
- 'integrity',
1283
- 'ismap',
1284
- 'itemprop',
1285
- 'keytype',
1286
- 'kind',
1287
- 'label',
1288
- 'lang',
1289
- 'language',
1290
- 'lazyload',
1291
- 'list',
1292
- 'loop',
1293
- 'low',
1294
- 'manifest',
1295
- 'max',
1296
- 'maxlength',
1297
- 'minlength',
1298
- 'media',
1299
- 'method',
1300
- 'min',
1301
- 'multiple',
1302
- 'muted',
1303
- 'name',
1304
- 'novalidate',
1305
- 'open',
1306
- 'optimum',
1307
- 'pattern',
1308
- 'ping',
1309
- 'placeholder',
1310
- 'poster',
1311
- 'preload',
1312
- 'radiogroup',
1313
- 'readonly',
1314
- 'referrerpolicy',
1315
- 'rel',
1316
- 'required',
1317
- 'reversed',
1318
- 'role',
1319
- 'rows',
1320
- 'rowspan',
1321
- 'sandbox',
1322
- 'scope',
1323
- 'scoped',
1324
- 'selected',
1325
- 'shape',
1326
- 'size',
1327
- 'sizes',
1328
- 'slot',
1329
- 'span',
1330
- 'spellcheck',
1331
- 'src',
1332
- 'srcdoc',
1333
- 'srclang',
1334
- 'srcset',
1335
- 'start',
1336
- 'step',
1337
- 'style',
1338
- 'summary',
1339
- 'tabindex',
1340
- 'target',
1341
- 'title',
1342
- 'translate',
1343
- 'type',
1344
- 'usemap',
1345
- 'value',
1346
- 'width',
1347
- 'wrap'
1348
- ];
1330
+ const thisEl = path(['props', 'el'], this);
1331
+ //console.log('this el is ',{thisEl, itemEl});
1332
+ return ViewStream.elIsDomElement(thisEl) && ViewStream.elIsDomElement(itemEl) && thisEl.contains(itemEl);
1349
1333
  }
1350
1334
 
1351
1335
  // =======================================================================================