spyne 0.17.3 → 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.
- package/karma.conf.js +5 -61
- package/lib/spyne.js +554 -1221
- package/lib/spyne.min.js +1 -1
- package/lib/spyne.min.js.LICENSE.txt +1 -1
- package/package.json +1 -1
- package/src/spyne/channels/channel-fetch-class.js +1 -4
- package/src/spyne/channels/channel-payload-class.js +8 -9
- package/src/spyne/channels/channel-proxy.js +1 -1
- package/src/spyne/channels/channel.js +3 -26
- package/src/spyne/channels/channels-config.js +0 -2
- package/src/spyne/channels/channels-map.js +1 -18
- package/src/spyne/channels/spyne-channel-lifecycle.js +1 -2
- package/src/spyne/channels/spyne-channel-route.js +7 -47
- package/src/spyne/channels/spyne-channel-ui.js +0 -2
- package/src/spyne/channels/spyne-channel-window.js +2 -53
- package/src/spyne/spyne-app.js +5 -23
- package/src/spyne/spyne-plugins.js +29 -61
- package/src/spyne/spyne.js +0 -1
- package/src/spyne/utils/channel-config-validator.js +0 -1
- package/src/spyne/utils/channel-fetch-util.js +1 -2
- package/src/spyne/utils/channel-payload-filter.js +4 -73
- package/src/spyne/utils/gc.js +1 -1
- package/src/spyne/utils/route-channel-updater.js +0 -4
- package/src/spyne/utils/spyne-app-properties.js +42 -72
- package/src/spyne/utils/spyne-plugins-methods.js +1 -9
- package/src/spyne/utils/spyne-trait.js +2 -5
- package/src/spyne/utils/spyne-utils-channel-route-url.js +1 -7
- package/src/spyne/utils/spyne-utils-channel-route.js +3 -13
- package/src/spyne/utils/spyne-utils-channel-window.js +1 -3
- package/src/spyne/utils/viewstream-observables.js +2 -3
- package/src/spyne/views/dom-element-template.js +1 -6
- package/src/spyne/views/dom-element.js +0 -19
- package/src/spyne/views/view-stream-broadcaster.js +2 -7
- package/src/spyne/views/view-stream-element.js +1 -18
- package/src/spyne/views/view-stream-payload.js +2 -69
- package/src/spyne/views/view-stream-selector.js +1 -6
- package/src/spyne/views/view-stream.js +255 -292
- package/webpack.config.js +0 -29
- package/lib/channel-action-filter.test.2418910233.js +0 -20
- package/lib/channel-dom.test.1490741340.js +0 -20
- package/lib/channel-fetch-util.test.3681936279.js +0 -20
- package/lib/channel-fetch.test.380764798.js +0 -20
- package/lib/channel-payload-class.test.2325155642.js +0 -20
- package/lib/channel-payload-filter.test.1598505124.js +0 -20
- package/lib/channel-route.test.921296320.js +0 -20
- package/lib/channel-stream-item.test.159699696.js +0 -20
- package/lib/channel-ui.test.291129654.js +0 -20
- package/lib/channel-util-dom.test.181212370.js +0 -20
- package/lib/channel.test.706832124.js +0 -20
- package/lib/commons.js +0 -50363
- package/lib/dom-el-selectors.test.3296414834.js +0 -20
- package/lib/dom-el-template.test.1459850380.js +0 -20
- package/lib/dom-el.test.2449130808.js +0 -20
- package/lib/frp-tools.test.1620088187.js +0 -20
- package/lib/import.test.723835576.js +0 -20
- package/lib/index.test.2146503294.js +0 -20
- package/lib/plugins-methods.test.3482246428.js +0 -20
- package/lib/route-utils.test.2932649409.js +0 -20
- package/lib/runtime.js +0 -174
- package/lib/spyne-app-properties.test.485192211.js +0 -20
- package/lib/spyne-app.test.4150724251.js +0 -20
- package/lib/spyne-plugin.test.3993976219.js +0 -20
- package/lib/url-utils.test.3668806082.js +0 -20
- package/lib/view-stream-broadcaster.test.2534955231.js +0 -20
- package/lib/view-stream-enhancer-loader.test.3395418180.js +0 -20
- package/lib/view-stream-enhancer.test.1043626253.js +0 -20
- package/lib/view-stream.test.1765314964.js +0 -20
- package/src/spyne/channels/lifestream-payload.js +0 -56
- package/src/spyne/utils/spyne-scroll-lock.js +0 -95
- package/src/spyne/views/view-stream-enhancer-loader.js +0 -70
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { baseCoreMixins } from '../utils/mixins/base-core-mixins';
|
|
2
2
|
import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
3
|
-
//import { baseStreamsMixins } from '../utils/mixins/base-streams-mixins';
|
|
4
3
|
import { deepMerge } from '../utils/deep-merge';
|
|
5
4
|
import {
|
|
6
5
|
findStrOrRegexMatchStr,
|
|
7
6
|
getConstructorName
|
|
8
7
|
} from '../utils/frp-tools';
|
|
9
|
-
// import {gc} from '../utils/gc';
|
|
10
8
|
import { ViewStreamElement } from './view-stream-element';
|
|
11
|
-
import { ViewStreamEnhancerLoader } from './view-stream-enhancer-loader';
|
|
12
9
|
import { registeredStreamNames } from '../channels/channels-config';
|
|
13
10
|
import { ViewStreamBroadcaster } from './view-stream-broadcaster';
|
|
14
11
|
import { ViewStreamPayload } from './view-stream-payload';
|
|
@@ -22,12 +19,10 @@ import {
|
|
|
22
19
|
compose,
|
|
23
20
|
isNil,
|
|
24
21
|
all,
|
|
25
|
-
isEmpty,
|
|
26
22
|
forEach,
|
|
27
23
|
toLower,
|
|
28
24
|
either,
|
|
29
25
|
findIndex,
|
|
30
|
-
partial,
|
|
31
26
|
apply,
|
|
32
27
|
test,
|
|
33
28
|
flatten,
|
|
@@ -38,19 +33,15 @@ import {
|
|
|
38
33
|
propSatisfies,
|
|
39
34
|
allPass,
|
|
40
35
|
curry,
|
|
41
|
-
nth,
|
|
42
36
|
is,
|
|
43
37
|
slice,
|
|
44
38
|
path,
|
|
45
39
|
omit,
|
|
46
40
|
ifElse,
|
|
47
|
-
lensPath,
|
|
48
|
-
view,
|
|
49
41
|
clone,
|
|
50
42
|
mergeRight,
|
|
51
43
|
where,
|
|
52
44
|
equals,
|
|
53
|
-
assocPath,
|
|
54
45
|
} from 'ramda';
|
|
55
46
|
|
|
56
47
|
const rMap = require('ramda').map;
|
|
@@ -195,7 +186,6 @@ export class ViewStream {
|
|
|
195
186
|
if (this.props.traits!==undefined){
|
|
196
187
|
this.addTraits(this.props.traits);
|
|
197
188
|
}
|
|
198
|
-
this.loadEnhancers();
|
|
199
189
|
this.loadAllMethods();
|
|
200
190
|
this.props.action = 'LOADED';
|
|
201
191
|
this.sink$ = new Subject();
|
|
@@ -212,11 +202,244 @@ export class ViewStream {
|
|
|
212
202
|
this.checkIfElementAlreadyExists();
|
|
213
203
|
}
|
|
214
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
|
+
|
|
215
436
|
updatePropsToMatchEl() {
|
|
216
437
|
const getTagName = compose(toLower, either(prop('tagName'), always('')));
|
|
217
438
|
this.props.tagName = getTagName(this.props.el);
|
|
218
439
|
}
|
|
219
440
|
|
|
441
|
+
// =====================================================================
|
|
442
|
+
|
|
220
443
|
checkIfElementAlreadyExists() {
|
|
221
444
|
const elIsDomElement = compose(lte(0), defaultTo(-1), prop('nodeType'));
|
|
222
445
|
const elIsRendered = el => document.body.contains(el);
|
|
@@ -229,12 +452,6 @@ export class ViewStream {
|
|
|
229
452
|
}
|
|
230
453
|
}
|
|
231
454
|
|
|
232
|
-
loadEnhancers(arr = []) {
|
|
233
|
-
let enhancerLoader = new ViewStreamEnhancerLoader(this, arr);
|
|
234
|
-
this.props['enhancersMap'] = enhancerLoader.getEnhancersMap();
|
|
235
|
-
enhancerLoader = undefined;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
455
|
loadAllMethods() {
|
|
239
456
|
const channelFn = curry(this.onChannelMethodCall.bind(this));
|
|
240
457
|
let createExtraStatesMethod = (arr) => {
|
|
@@ -287,23 +504,17 @@ export class ViewStream {
|
|
|
287
504
|
this.sourceStreams.raw$.next(obj);
|
|
288
505
|
}
|
|
289
506
|
let filterPayload = defaultTo(always(true), actionFilter);
|
|
290
|
-
const filterLabel = `filtering-${Math.floor(Math.random() * 999999)}`;
|
|
291
507
|
|
|
292
508
|
if (actionFilter !== undefined) {
|
|
293
|
-
//console.time(filterLabel);
|
|
294
|
-
|
|
295
509
|
|
|
296
510
|
}
|
|
297
511
|
if (filterPayload(p) === true) {
|
|
298
|
-
// p = omit(['dir$'],p);
|
|
299
512
|
p = omit(['$dir'], p)
|
|
513
|
+
|
|
300
514
|
if (actionFilter !== undefined) {
|
|
301
515
|
|
|
302
|
-
// console.log(`pf - ${filterLabel}: `, p);
|
|
303
|
-
//console.timeEnd(filterLabel);
|
|
304
516
|
}
|
|
305
517
|
runFunc(p);
|
|
306
|
-
//this[str](p);
|
|
307
518
|
}
|
|
308
519
|
}
|
|
309
520
|
|
|
@@ -322,7 +533,6 @@ export class ViewStream {
|
|
|
322
533
|
return deepMerge.all([{}, hashSourceKeys, extendedSourcesHashMethods]);
|
|
323
534
|
}
|
|
324
535
|
|
|
325
|
-
// =====================================================================
|
|
326
536
|
// ====================== MAIN STREAM METHODS ==========================
|
|
327
537
|
initViewStream() {
|
|
328
538
|
this._source$ = this._rawSource$.pipe(map(
|
|
@@ -389,6 +599,8 @@ export class ViewStream {
|
|
|
389
599
|
|
|
390
600
|
}
|
|
391
601
|
|
|
602
|
+
// =======================================================================================
|
|
603
|
+
|
|
392
604
|
onChildCompleted(p) {
|
|
393
605
|
let findName = (x) => {
|
|
394
606
|
let finalDest = (y) => {
|
|
@@ -406,8 +618,6 @@ export class ViewStream {
|
|
|
406
618
|
return childCompletedData;
|
|
407
619
|
}
|
|
408
620
|
|
|
409
|
-
|
|
410
|
-
|
|
411
621
|
initAutoMergeSourceStreams() {
|
|
412
622
|
// ====================== SUBSCRIPTION SOURCE =========================
|
|
413
623
|
let subscriber = {
|
|
@@ -504,6 +714,14 @@ export class ViewStream {
|
|
|
504
714
|
console.log('ALL ERROR ', this.constructor.name, payload);
|
|
505
715
|
}
|
|
506
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
|
+
|
|
507
725
|
onSubscribeToSourcesComplete() {
|
|
508
726
|
// console.log('==== EXTIRPATER ALL COMPLETED ====', this.constructor.name);
|
|
509
727
|
this.tracer('onSubscribeToSourcesComplete', 'VS_DETRITUS_COLLECT');
|
|
@@ -511,12 +729,6 @@ export class ViewStream {
|
|
|
511
729
|
this.openSpigot('VS_DETRITUS_COLLECT');
|
|
512
730
|
}
|
|
513
731
|
|
|
514
|
-
// =======================================================================================
|
|
515
|
-
// ============================= HASH KEY AND SPIGOT METHODS==============================
|
|
516
|
-
get source$() {
|
|
517
|
-
return this._source$;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
732
|
sendExtendedStreams(payload) {
|
|
521
733
|
this.tracer('sendExtendedStreams', payload);
|
|
522
734
|
// console.log('extended methods ', payload.action, payload);
|
|
@@ -533,19 +745,11 @@ export class ViewStream {
|
|
|
533
745
|
this.openSpigot('VS_SPAWN');
|
|
534
746
|
}
|
|
535
747
|
|
|
536
|
-
renderViewAndAttachToDom(node, type, attachType) {
|
|
537
|
-
let attachData = { node, type, attachType };
|
|
538
|
-
this.openSpigot('VS_SPAWN_AND_ATTACH_TO_DOM', { attachData });
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/*
|
|
542
|
-
attachChildToView(data) {
|
|
543
|
-
// let childRenderData = data.attachData;
|
|
544
|
-
// console.log('CHILD DATA ', this.constructor.name, childRenderData);
|
|
545
|
-
// this.openSpigot('ATTACH_CHILD_TO_SELF', {childRenderData});
|
|
546
|
-
}
|
|
547
|
-
*/
|
|
548
|
-
|
|
748
|
+
renderViewAndAttachToDom(node, type, attachType) {
|
|
749
|
+
let attachData = { node, type, attachType };
|
|
750
|
+
this.openSpigot('VS_SPAWN_AND_ATTACH_TO_DOM', { attachData });
|
|
751
|
+
}
|
|
752
|
+
|
|
549
753
|
// ===================================== EXTIRPATE METHODS =================================
|
|
550
754
|
checkParentDispose(p) {
|
|
551
755
|
if (p.from$ === 'parent') {
|
|
@@ -557,6 +761,8 @@ export class ViewStream {
|
|
|
557
761
|
|
|
558
762
|
}
|
|
559
763
|
|
|
764
|
+
// ===================================== SINK$ METHODS =================================
|
|
765
|
+
|
|
560
766
|
/**
|
|
561
767
|
*
|
|
562
768
|
* Wraps window.setTimeout with a check to see if "this" ViewStream element and its props property still exists
|
|
@@ -576,7 +782,6 @@ export class ViewStream {
|
|
|
576
782
|
window.setTimeout(timeoutMethod, ms);
|
|
577
783
|
}
|
|
578
784
|
|
|
579
|
-
|
|
580
785
|
/**
|
|
581
786
|
*
|
|
582
787
|
* Begins the removal process of the ViewStream instance along with all of its chained ViewStream children.
|
|
@@ -603,8 +808,6 @@ export class ViewStream {
|
|
|
603
808
|
this.tracer('onReadyToGC', isInternal, p);
|
|
604
809
|
}
|
|
605
810
|
|
|
606
|
-
// ===================================== SINK$ METHODS =================================
|
|
607
|
-
|
|
608
811
|
openSpigot(action, obj = {}) {
|
|
609
812
|
if (this.props !== undefined) {
|
|
610
813
|
this.props.action = action;
|
|
@@ -615,10 +818,6 @@ export class ViewStream {
|
|
|
615
818
|
}
|
|
616
819
|
}
|
|
617
820
|
|
|
618
|
-
static isDevMode(){
|
|
619
|
-
return SpyneAppProperties.debug;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
821
|
setAttachData(attachType, query) {
|
|
623
822
|
const checkQuery = ()=>{
|
|
624
823
|
let q = this.props.el.querySelector(query);
|
|
@@ -862,12 +1061,10 @@ export class ViewStream {
|
|
|
862
1061
|
|
|
863
1062
|
traits.forEach(addTrait);
|
|
864
1063
|
|
|
865
|
-
if (this.isDevMode === true){
|
|
866
|
-
const actionsArr = this.addActionListeners();
|
|
867
|
-
}
|
|
868
|
-
|
|
869
1064
|
}
|
|
870
1065
|
|
|
1066
|
+
// ================================= METHODS TO BE EXTENDED ==============================
|
|
1067
|
+
|
|
871
1068
|
afterBroadcastEvents(){
|
|
872
1069
|
|
|
873
1070
|
if (this.isDevMode === true ){
|
|
@@ -900,28 +1097,6 @@ export class ViewStream {
|
|
|
900
1097
|
this.setTimeout(delayForProxyChannelResets, 500);
|
|
901
1098
|
}
|
|
902
1099
|
}
|
|
903
|
-
static checkIfActionsAreRegistered(channelsArr=[], actionsArr){
|
|
904
|
-
if (actionsArr.length>0){
|
|
905
|
-
const getAllActions = (a)=>{
|
|
906
|
-
const getRegisteredActionsArr = (str)=>SpyneAppProperties.getChannelActions(str);
|
|
907
|
-
let arr = a.map(getRegisteredActionsArr);
|
|
908
|
-
return flatten(arr);
|
|
909
|
-
}
|
|
910
|
-
const checkForMatch = (strMatch) => {
|
|
911
|
-
let re = new RegExp(strMatch);
|
|
912
|
-
let actionIndex = findIndex(test(re), getAllActionsArr)
|
|
913
|
-
if (actionIndex<0){
|
|
914
|
-
let channelSyntax = channelsArr.length === 1 ? "from added channel" : "from added channels";
|
|
915
|
-
console.warn(`Spyne Warning: The action, ${strMatch}, in ${this.props.name}, does not match any of the registered actions ${channelSyntax}, ${channelsArr.join(', ')}`)
|
|
916
|
-
}
|
|
917
|
-
// const vsnum = ()=> R.test(new RegExp(str), "CHANNEL_ROUTE_TEST_EVENT")
|
|
918
|
-
}
|
|
919
|
-
let getAllActionsArr = getAllActions(channelsArr);
|
|
920
|
-
actionsArr.forEach(checkForMatch);
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
}
|
|
925
1100
|
|
|
926
1101
|
setDataVSID(){
|
|
927
1102
|
this.props.el.dataset.vsid = this.props.vsid;// String(this.props.vsid).replace(/^(vsid-)(.*)$/, '$2');
|
|
@@ -941,13 +1116,11 @@ export class ViewStream {
|
|
|
941
1116
|
// window.theEl$ = this.props.el$;
|
|
942
1117
|
}
|
|
943
1118
|
|
|
944
|
-
// ================================= METHODS TO BE EXTENDED ==============================
|
|
945
|
-
|
|
946
|
-
|
|
947
1119
|
// THIS IS AN EVENT HOLDER METHOD BECAUSE SENDING DOWNSTREAM REQUIRE THE PARENT TO HAVE A METHOD
|
|
948
1120
|
downStream() {
|
|
949
1121
|
|
|
950
1122
|
}
|
|
1123
|
+
|
|
951
1124
|
/**
|
|
952
1125
|
*
|
|
953
1126
|
* This method is called as soon as the element has been rendered.
|
|
@@ -966,10 +1139,6 @@ export class ViewStream {
|
|
|
966
1139
|
onAnimFrameAfterRendered() {
|
|
967
1140
|
}
|
|
968
1141
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
1142
|
/**
|
|
974
1143
|
*
|
|
975
1144
|
* (Deprecated. Use onRendered). This method is called as soon as the element has been rendered.
|
|
@@ -979,35 +1148,6 @@ export class ViewStream {
|
|
|
979
1148
|
afterRender() {
|
|
980
1149
|
}
|
|
981
1150
|
|
|
982
|
-
/**
|
|
983
|
-
*
|
|
984
|
-
* Add any query within the ViewStream's dom and any dom events to automatically be observed by the UI Channel.
|
|
985
|
-
* <br>
|
|
986
|
-
* @example
|
|
987
|
-
*
|
|
988
|
-
* broadcastEvents() {
|
|
989
|
-
* // ADD BUTTON EVENTS AS NESTED ARRAYS
|
|
990
|
-
* return [
|
|
991
|
-
* ['#my-button', 'mouseover'],
|
|
992
|
-
* ['#my-input', 'change']
|
|
993
|
-
* ]
|
|
994
|
-
* }
|
|
995
|
-
*
|
|
996
|
-
*
|
|
997
|
-
* */
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
static isValidNestedArr(eventsArr){
|
|
1001
|
-
const isTrue = equals(true);
|
|
1002
|
-
const allIsTrue = all(isTrue);
|
|
1003
|
-
const isString = is(String);
|
|
1004
|
-
const isValidArr = compose(allIsTrue, rMap(isString), slice(0,2), defaultTo([]));
|
|
1005
|
-
const mapEventsArrFn = compose( allIsTrue, rMap(isValidArr), defaultTo([]));
|
|
1006
|
-
return mapEventsArrFn(eventsArr);
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
1151
|
broadcastEvents() {
|
|
1012
1152
|
// ADD BUTTON EVENTS AS NESTED ARRAYS
|
|
1013
1153
|
return [];
|
|
@@ -1104,7 +1244,6 @@ export class ViewStream {
|
|
|
1104
1244
|
this.props.addedChannels.push(str);
|
|
1105
1245
|
}
|
|
1106
1246
|
|
|
1107
|
-
|
|
1108
1247
|
checkIfChannelExists(channelName) {
|
|
1109
1248
|
let channelExists = SpyneAppProperties.channelsMap.testStream(channelName);
|
|
1110
1249
|
if (channelExists !== true) {
|
|
@@ -1113,7 +1252,6 @@ export class ViewStream {
|
|
|
1113
1252
|
return channelExists;
|
|
1114
1253
|
}
|
|
1115
1254
|
|
|
1116
|
-
|
|
1117
1255
|
/**
|
|
1118
1256
|
*
|
|
1119
1257
|
* @param {String} channelName
|
|
@@ -1160,15 +1298,12 @@ export class ViewStream {
|
|
|
1160
1298
|
}
|
|
1161
1299
|
|
|
1162
1300
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
1301
|
}
|
|
1168
1302
|
|
|
1169
1303
|
tracer(...args) {
|
|
1170
1304
|
this.sendLifecycleMethod(...args);
|
|
1171
1305
|
}
|
|
1306
|
+
|
|
1172
1307
|
sendLifecycleMethodInactive() {
|
|
1173
1308
|
|
|
1174
1309
|
}
|
|
@@ -1197,178 +1332,6 @@ export class ViewStream {
|
|
|
1197
1332
|
return ViewStream.elIsDomElement(thisEl) && ViewStream.elIsDomElement(itemEl) && thisEl.contains(itemEl);
|
|
1198
1333
|
}
|
|
1199
1334
|
|
|
1200
|
-
static elIsDomElement(o) {
|
|
1201
|
-
if (is(String,o)){
|
|
1202
|
-
o = document.querySelector(o);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
return compose(lte(0), defaultTo(-1), prop('nodeType'))(o);
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
get attributesArray() {
|
|
1210
|
-
return [
|
|
1211
|
-
'accept',
|
|
1212
|
-
'accept-charset',
|
|
1213
|
-
'accesskey',
|
|
1214
|
-
'action',
|
|
1215
|
-
'align',
|
|
1216
|
-
'allow',
|
|
1217
|
-
'alt',
|
|
1218
|
-
'aria-autocomplete',
|
|
1219
|
-
'aria-checked',
|
|
1220
|
-
'aria-disabled',
|
|
1221
|
-
'aria-expanded',
|
|
1222
|
-
'aria-haspopup',
|
|
1223
|
-
'aria-hidden',
|
|
1224
|
-
'aria-invalid',
|
|
1225
|
-
'aria-label',
|
|
1226
|
-
'aria-level',
|
|
1227
|
-
'aria-multiline',
|
|
1228
|
-
'aria-multiselectable',
|
|
1229
|
-
'aria-orientation',
|
|
1230
|
-
'aria-pressed',
|
|
1231
|
-
'aria-readonly',
|
|
1232
|
-
'aria-required',
|
|
1233
|
-
'aria-selected',
|
|
1234
|
-
'aria-sort',
|
|
1235
|
-
'aria-valuemax',
|
|
1236
|
-
'aria-valuemin',
|
|
1237
|
-
'aria-valuenow',
|
|
1238
|
-
'aria-valuetext',
|
|
1239
|
-
'aria-atomic',
|
|
1240
|
-
'aria-busy',
|
|
1241
|
-
'aria-live',
|
|
1242
|
-
'aria-relevant',
|
|
1243
|
-
'aria-dropeffect',
|
|
1244
|
-
'aria-grabbed',
|
|
1245
|
-
'aria-activedescendant',
|
|
1246
|
-
'aria-controls',
|
|
1247
|
-
'aria-describedby',
|
|
1248
|
-
'aria-flowto',
|
|
1249
|
-
'aria-labelledby',
|
|
1250
|
-
'aria-owns',
|
|
1251
|
-
'aria-posinset',
|
|
1252
|
-
'aria-setsize',
|
|
1253
|
-
'async',
|
|
1254
|
-
'autocapitalize',
|
|
1255
|
-
'autocomplete',
|
|
1256
|
-
'autofocus',
|
|
1257
|
-
'autoplay',
|
|
1258
|
-
'bgcolor',
|
|
1259
|
-
'border',
|
|
1260
|
-
'buffered',
|
|
1261
|
-
'challenge',
|
|
1262
|
-
'charset',
|
|
1263
|
-
'checked',
|
|
1264
|
-
'cite',
|
|
1265
|
-
'class',
|
|
1266
|
-
'code',
|
|
1267
|
-
'codebase',
|
|
1268
|
-
'color',
|
|
1269
|
-
'cols',
|
|
1270
|
-
'colspan',
|
|
1271
|
-
'content',
|
|
1272
|
-
'contenteditable',
|
|
1273
|
-
'contextmenu',
|
|
1274
|
-
'controls',
|
|
1275
|
-
'coords',
|
|
1276
|
-
'crossorigin',
|
|
1277
|
-
'csp',
|
|
1278
|
-
'dataset',
|
|
1279
|
-
'datetime',
|
|
1280
|
-
'decoding',
|
|
1281
|
-
'default',
|
|
1282
|
-
'defer',
|
|
1283
|
-
'dir',
|
|
1284
|
-
'dirname',
|
|
1285
|
-
'disabled',
|
|
1286
|
-
'download',
|
|
1287
|
-
'draggable',
|
|
1288
|
-
'dropzone',
|
|
1289
|
-
'enctype',
|
|
1290
|
-
'for',
|
|
1291
|
-
'form',
|
|
1292
|
-
'formaction',
|
|
1293
|
-
'headers',
|
|
1294
|
-
'height',
|
|
1295
|
-
'hidden',
|
|
1296
|
-
'high',
|
|
1297
|
-
'href',
|
|
1298
|
-
'hreflang',
|
|
1299
|
-
'http-equiv',
|
|
1300
|
-
'icon',
|
|
1301
|
-
'id',
|
|
1302
|
-
'importance',
|
|
1303
|
-
'integrity',
|
|
1304
|
-
'ismap',
|
|
1305
|
-
'itemprop',
|
|
1306
|
-
'keytype',
|
|
1307
|
-
'kind',
|
|
1308
|
-
'label',
|
|
1309
|
-
'lang',
|
|
1310
|
-
'language',
|
|
1311
|
-
'lazyload',
|
|
1312
|
-
'list',
|
|
1313
|
-
'loop',
|
|
1314
|
-
'low',
|
|
1315
|
-
'manifest',
|
|
1316
|
-
'max',
|
|
1317
|
-
'maxlength',
|
|
1318
|
-
'minlength',
|
|
1319
|
-
'media',
|
|
1320
|
-
'method',
|
|
1321
|
-
'min',
|
|
1322
|
-
'multiple',
|
|
1323
|
-
'muted',
|
|
1324
|
-
'name',
|
|
1325
|
-
'novalidate',
|
|
1326
|
-
'open',
|
|
1327
|
-
'optimum',
|
|
1328
|
-
'pattern',
|
|
1329
|
-
'ping',
|
|
1330
|
-
'placeholder',
|
|
1331
|
-
'poster',
|
|
1332
|
-
'preload',
|
|
1333
|
-
'radiogroup',
|
|
1334
|
-
'readonly',
|
|
1335
|
-
'referrerpolicy',
|
|
1336
|
-
'rel',
|
|
1337
|
-
'required',
|
|
1338
|
-
'reversed',
|
|
1339
|
-
'role',
|
|
1340
|
-
'rows',
|
|
1341
|
-
'rowspan',
|
|
1342
|
-
'sandbox',
|
|
1343
|
-
'scope',
|
|
1344
|
-
'scoped',
|
|
1345
|
-
'selected',
|
|
1346
|
-
'shape',
|
|
1347
|
-
'size',
|
|
1348
|
-
'sizes',
|
|
1349
|
-
'slot',
|
|
1350
|
-
'span',
|
|
1351
|
-
'spellcheck',
|
|
1352
|
-
'src',
|
|
1353
|
-
'srcdoc',
|
|
1354
|
-
'srclang',
|
|
1355
|
-
'srcset',
|
|
1356
|
-
'start',
|
|
1357
|
-
'step',
|
|
1358
|
-
'style',
|
|
1359
|
-
'summary',
|
|
1360
|
-
'tabindex',
|
|
1361
|
-
'target',
|
|
1362
|
-
'title',
|
|
1363
|
-
'translate',
|
|
1364
|
-
'type',
|
|
1365
|
-
'usemap',
|
|
1366
|
-
'value',
|
|
1367
|
-
'width',
|
|
1368
|
-
'wrap'
|
|
1369
|
-
];
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
1335
|
// =======================================================================================
|
|
1373
1336
|
addMixins() {
|
|
1374
1337
|
// ==================================
|