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.
- package/README.md +0 -60
- package/karma.conf.js +5 -61
- package/lib/spyne.js +566 -1218
- package/lib/spyne.min.js +1 -1
- package/lib/spyne.min.js.LICENSE.txt +1 -1
- package/package.json +22 -15
- 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 +4 -54
- package/src/spyne/spyne-app.js +5 -21
- package/src/spyne/spyne-plugins.js +35 -64
- 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 +2 -4
- 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 +253 -280
- package/webpack.config.js +0 -29
- package/lib/channel-action-filter.test.871939702.js +0 -20
- package/lib/channel-dom.test.2857423116.js +0 -20
- package/lib/channel-fetch-util.test.1782805723.js +0 -20
- package/lib/channel-fetch.test.3331576485.js +0 -20
- package/lib/channel-payload-class.test.99440410.js +0 -20
- package/lib/channel-payload-filter.test.2135136282.js +0 -20
- package/lib/channel-route.test.3036804306.js +0 -20
- package/lib/channel-stream-item.test.1523843610.js +0 -20
- package/lib/channel-ui.test.367398224.js +0 -20
- package/lib/channel-util-dom.test.3758627277.js +0 -20
- package/lib/channel.test.1717017712.js +0 -20
- package/lib/commons.js +0 -50372
- package/lib/dom-el-selectors.test.2633571626.js +0 -20
- package/lib/dom-el-template.test.268653142.js +0 -20
- package/lib/dom-el.test.4051977500.js +0 -20
- package/lib/frp-tools.test.3814897075.js +0 -20
- package/lib/index.test.1514915838.js +0 -20
- package/lib/plugins-methods.test.2326717190.js +0 -20
- package/lib/route-utils.test.2350761994.js +0 -20
- package/lib/runtime.js +0 -174
- package/lib/spyne-app-properties.test.96729569.js +0 -20
- package/lib/spyne-app.test.1443517996.js +0 -20
- package/lib/spyne-plugin.test.1247070970.js +0 -20
- package/lib/url-utils.test.516839067.js +0 -20
- package/lib/view-stream-broadcaster.test.934532750.js +0 -20
- package/lib/view-stream-enhancer-loader.test.2755314117.js +0 -20
- package/lib/view-stream-enhancer.test.414877881.js +0 -20
- package/lib/view-stream.test.2479353905.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,7 +1,7 @@
|
|
|
1
1
|
import { Channel } from './channel';
|
|
2
2
|
import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
3
3
|
import { Subject, ReplaySubject, merge } from 'rxjs';
|
|
4
|
-
import {includes
|
|
4
|
+
import {includes} from 'ramda';
|
|
5
5
|
import {delayCall} from '../utils/frp-tools';
|
|
6
6
|
|
|
7
7
|
export class ChannelProxy extends Channel {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { registeredStreamNames } from './channels-config';
|
|
2
2
|
import { ChannelPayload } from './channel-payload-class';
|
|
3
|
-
import { ChannelPayloadFilter} from '../utils/channel-payload-filter';
|
|
4
3
|
import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
5
4
|
import {RouteChannelUpdater} from '../utils/route-channel-updater';
|
|
6
5
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
@@ -19,12 +18,10 @@ import {
|
|
|
19
18
|
always,
|
|
20
19
|
fromPairs,
|
|
21
20
|
path,
|
|
22
|
-
|
|
23
|
-
isEmpty,
|
|
21
|
+
isEmpty,
|
|
24
22
|
equals,
|
|
25
23
|
prop,
|
|
26
|
-
|
|
27
|
-
apply,
|
|
24
|
+
propEq
|
|
28
25
|
} from 'ramda';
|
|
29
26
|
const rMap = require('ramda').map;
|
|
30
27
|
|
|
@@ -152,7 +149,7 @@ export class Channel {
|
|
|
152
149
|
traits = [traits];
|
|
153
150
|
}
|
|
154
151
|
const addTrait=(TraitClass)=>{
|
|
155
|
-
new TraitClass(this);
|
|
152
|
+
return new TraitClass(this);
|
|
156
153
|
};
|
|
157
154
|
|
|
158
155
|
traits.forEach(addTrait);
|
|
@@ -403,26 +400,6 @@ export class Channel {
|
|
|
403
400
|
return fn(CHANNEL_NAME);
|
|
404
401
|
}
|
|
405
402
|
|
|
406
|
-
/**
|
|
407
|
-
*
|
|
408
|
-
* Wraps window.setTimeout with a check to see if "this" ViewStream element and its props property still exists
|
|
409
|
-
* @property {function} fn - = 'function'; The local method that is to be called.
|
|
410
|
-
* @property {number} ms - = 0; The time, in milleseconds, for the timeout.
|
|
411
|
-
* @property {boolean} bind - = false; When true, will bind the method to 'this'.
|
|
412
|
-
*
|
|
413
|
-
*/
|
|
414
|
-
|
|
415
|
-
/*
|
|
416
|
-
setTimeout(fn, ms=0, bind=false){
|
|
417
|
-
const timeoutMethod = (...args)=>{
|
|
418
|
-
if (this!==undefined && this.props!==undefined){
|
|
419
|
-
const methodFn = bind===true ? fn.bind(this) : fn;
|
|
420
|
-
apply(methodFn, args);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
window.setTimeout(timeoutMethod, ms);
|
|
424
|
-
}
|
|
425
|
-
*/
|
|
426
403
|
|
|
427
404
|
|
|
428
405
|
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
// import {baseCoreMixins} from '../utils/mixins/base-core-mixins';
|
|
2
|
-
// import {BaseStreamsMixins} from '../utils/mixins/base-streams-mixins';
|
|
3
1
|
import { SpyneChannelRoute } from './spyne-channel-route';
|
|
4
2
|
import { SpyneChannelUI } from './spyne-channel-ui';
|
|
5
3
|
import { SpyneChannelWindow } from './spyne-channel-window';
|
|
6
4
|
import { SpyneChannelLifecycle } from './spyne-channel-lifecycle';
|
|
7
|
-
//import { validate } from '../utils/channel-config-validator';
|
|
8
5
|
|
|
9
6
|
import { Subject } from 'rxjs';
|
|
10
7
|
import { ChannelProxy } from './channel-proxy';
|
|
11
|
-
import {propEq, pluck, prop, filter, pathEq,
|
|
8
|
+
import {propEq, pluck, prop, filter, pathEq, reject, compose, join} from 'ramda';
|
|
12
9
|
const rMap = require('ramda').map;
|
|
13
10
|
const _map = new Map();
|
|
14
11
|
|
|
15
|
-
// import * as R from 'ramda';
|
|
16
12
|
|
|
17
13
|
export class ChannelsMap {
|
|
18
14
|
/**
|
|
@@ -29,10 +25,6 @@ export class ChannelsMap {
|
|
|
29
25
|
|
|
30
26
|
constructor() {
|
|
31
27
|
this.addMixins();
|
|
32
|
-
//_map = new Map();
|
|
33
|
-
|
|
34
|
-
// console.log('Rx is ',Rx);
|
|
35
|
-
// console.log('RX IS ', Subject);
|
|
36
28
|
_map.set('DISPATCHER', new Subject());
|
|
37
29
|
this.listRegisteredChannels = ChannelsMap.listRegisteredChannels.bind(this);
|
|
38
30
|
this.getChannelsList = ChannelsMap.getChannelsList.bind(this);
|
|
@@ -73,23 +65,14 @@ export class ChannelsMap {
|
|
|
73
65
|
let channels = compose(join(', '), rMap(prop('key')))(filterProxyArr);
|
|
74
66
|
let filterPrefixWarning = `Spyne Warning: The following ${channelStr} not been initialized: ${channels}`;
|
|
75
67
|
console.warn(filterPrefixWarning);
|
|
76
|
-
// console.log("FILTER PROXY WARNING ",filterProxyArr);
|
|
77
68
|
}
|
|
78
69
|
|
|
79
|
-
// console.log(filterProxy(proxyMap),' proxyMap ', proxyMap);
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
init() {
|
|
83
73
|
this.createMainStreams();
|
|
84
74
|
}
|
|
85
75
|
|
|
86
|
-
/*
|
|
87
|
-
createObserver(obj) {
|
|
88
|
-
// RIGHT NOW THIS CREATES THE DISPATCHER STREAM
|
|
89
|
-
validate(obj.validations, obj.init);
|
|
90
|
-
_map.set(obj.init.name, obj.init.observable());
|
|
91
|
-
}
|
|
92
|
-
*/
|
|
93
76
|
|
|
94
77
|
createMainStreams() {
|
|
95
78
|
this.routeStream = new SpyneChannelRoute();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Channel } from './channel';
|
|
2
|
-
import {prop} from 'ramda';
|
|
3
2
|
|
|
4
3
|
export class SpyneChannelLifecycle extends Channel {
|
|
5
4
|
/**
|
|
@@ -30,7 +29,7 @@ export class SpyneChannelLifecycle extends Channel {
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
onViewStreamInfo(obj) {
|
|
33
|
-
let {
|
|
32
|
+
let {action, srcElement} = obj;
|
|
34
33
|
let payload = srcElement;
|
|
35
34
|
payload['action'] = action;
|
|
36
35
|
this.onSendEvent(action, payload);
|
|
@@ -6,13 +6,11 @@ import { ReplaySubject, merge } from 'rxjs';
|
|
|
6
6
|
import { map } from 'rxjs/operators';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
clone,
|
|
10
9
|
pick,
|
|
11
|
-
|
|
10
|
+
find,
|
|
12
11
|
omit,
|
|
13
12
|
over,
|
|
14
13
|
mergeRight,
|
|
15
|
-
mergeDeepRight,
|
|
16
14
|
is,
|
|
17
15
|
objOf,
|
|
18
16
|
mergeAll,
|
|
@@ -33,7 +31,10 @@ import {
|
|
|
33
31
|
reverse,
|
|
34
32
|
curryN,
|
|
35
33
|
__,
|
|
36
|
-
test,
|
|
34
|
+
test,
|
|
35
|
+
replace,
|
|
36
|
+
toPairs,
|
|
37
|
+
reduce
|
|
37
38
|
} from 'ramda';
|
|
38
39
|
const ramdaFilter = require('ramda').filter;
|
|
39
40
|
const rMerge = require('ramda').mergeRight;
|
|
@@ -140,7 +141,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
140
141
|
this.bindStaticMethods();
|
|
141
142
|
this.navToStream$ = new ReplaySubject(1);
|
|
142
143
|
this.observer$ = this.navToStream$.pipe(map(info => this.onMapNext(info)));
|
|
143
|
-
// let compareKeysFn = SpyneUtilsChannelRoute.compareRouteKeywords.bind(this);
|
|
144
144
|
this.compareRouteKeywords = SpyneUtilsChannelRoute.compareRouteKeywords();
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -203,9 +203,7 @@ export class SpyneChannelRoute extends Channel {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
let arr = SpyneUtilsChannelRoute.flattenConfigObject(routeConfig.routes);
|
|
206
|
-
// console.log("FLATTENED CONFIG ",arr);
|
|
207
206
|
routeConfig['paramsArr'] = arr;
|
|
208
|
-
//console.log("ROUTE CONFIG IS ",routeConfig);
|
|
209
207
|
return routeConfig;
|
|
210
208
|
}
|
|
211
209
|
|
|
@@ -220,7 +218,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
220
218
|
}
|
|
221
219
|
|
|
222
220
|
onMapNext(data, firstLoaded = false) {
|
|
223
|
-
// console.log("MAP NEXT ",{firstLoaded, data});
|
|
224
221
|
data['action'] = 'CHANNEL_ROUTE_CHANGE_EVENT';
|
|
225
222
|
return data;
|
|
226
223
|
}
|
|
@@ -247,15 +244,11 @@ export class SpyneChannelRoute extends Channel {
|
|
|
247
244
|
|
|
248
245
|
let keywordArrs = this.compareRouteKeywords.compare(payload.routeData, payload.paths);
|
|
249
246
|
payload = rMerge(payload, keywordArrs);
|
|
250
|
-
// console.log("SEND STREAM onIncomingDomEvent", payload, keywordArrs);;
|
|
251
|
-
// payload = SpyneChannelRoute.removeSSID(payload);
|
|
252
247
|
this.sendChannelPayload(action, payload, undefined, evt, this.navToStream$);
|
|
253
248
|
|
|
254
249
|
}
|
|
255
250
|
|
|
256
251
|
static checkForRouteParamsOverrides(payload) {
|
|
257
|
-
// console.log("CHECK FOR OVERRIDES ",payload);
|
|
258
|
-
|
|
259
252
|
return payload;
|
|
260
253
|
}
|
|
261
254
|
|
|
@@ -280,31 +273,13 @@ export class SpyneChannelRoute extends Channel {
|
|
|
280
273
|
}
|
|
281
274
|
|
|
282
275
|
|
|
283
|
-
|
|
284
|
-
/*
|
|
285
|
-
static checkToPreventDefaultEvent(obs) {
|
|
286
|
-
const checkDataForPreventDefault = pathEq(['viewStreamInfo', 'payload', 'eventPreventDefault'], 'true');
|
|
287
|
-
const setPreventDefault = (evt) => {
|
|
288
|
-
if (evt !== undefined) {
|
|
289
|
-
evt.preventDefault();
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
const selectEvtAndPreventDefault = compose(setPreventDefault, prop('event'));
|
|
293
|
-
const checkForPreventDefault = when(checkDataForPreventDefault, selectEvtAndPreventDefault);
|
|
294
|
-
checkForPreventDefault(obs);
|
|
295
|
-
}
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
276
|
static checkForEndRoute(pl, routeConfigJson = this.routeConfigJson, debugBool){
|
|
300
277
|
|
|
301
278
|
const endRoute = compose(equals("true"), path(['payload', 'endRoute']))(pl);
|
|
302
|
-
//console.log('pl and aend route',{endRoute, pl})
|
|
303
279
|
|
|
304
280
|
if (endRoute!==true){
|
|
305
281
|
return pl;
|
|
306
282
|
}
|
|
307
|
-
const win = window || {};
|
|
308
283
|
const debug = debugBool !== undefined ? debugBool : SpyneAppProperties.debug === true;
|
|
309
284
|
const {payload} = pl;
|
|
310
285
|
|
|
@@ -316,7 +291,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
316
291
|
let routeNameVal = payload[routeName]
|
|
317
292
|
const pred = arrStr => new RegExp(`^${arrStr}$`).test(routeNameVal);
|
|
318
293
|
const routeVal = find(pred, keysArr);
|
|
319
|
-
// console.log('route val is ',{routeVal, keysArr})
|
|
320
294
|
return routeVal;
|
|
321
295
|
|
|
322
296
|
}
|
|
@@ -347,7 +321,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
347
321
|
acc.push(routeName)
|
|
348
322
|
}
|
|
349
323
|
}
|
|
350
|
-
// compose(reduce(onReduceRoutePaths), toPairs)(nextRoutePath);
|
|
351
324
|
}
|
|
352
325
|
return acc;
|
|
353
326
|
|
|
@@ -375,17 +348,15 @@ export class SpyneChannelRoute extends Channel {
|
|
|
375
348
|
SpyneChannelRoute.checkForEventMethods(pl);
|
|
376
349
|
pl = this.checkForEndRoute(pl);
|
|
377
350
|
let payload = this.getDataFromParams(pl);
|
|
378
|
-
const {routeConfigJson} = this;
|
|
379
|
-
//console.log("LOADING ROUTE FROM LINK ", {pl, payload,routeConfigJson})
|
|
380
351
|
|
|
381
352
|
let srcElement = prop('srcElement', pl);
|
|
382
353
|
let event = prop('event', pl);
|
|
383
354
|
let changeLocationBool = !payload.isHidden;
|
|
384
355
|
let keywordArrs = this.compareRouteKeywords.compare(payload.routeData, payload.paths);
|
|
356
|
+
|
|
385
357
|
payload = rMerge(payload, keywordArrs);
|
|
386
|
-
// this.checkForRouteParamsOverrides(payload);
|
|
387
358
|
this.sendRouteStream(payload, changeLocationBool);
|
|
388
|
-
|
|
359
|
+
|
|
389
360
|
payload = SpyneChannelRoute.removeSSID(payload);
|
|
390
361
|
|
|
391
362
|
this.sendChannelPayload(action, payload, srcElement, event,
|
|
@@ -426,7 +397,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
426
397
|
static getExtraPayloadParams(config = this.routeConfigJson, isHistory=false) {
|
|
427
398
|
let routeCount = this.getRouteCount(isHistory);
|
|
428
399
|
let isDeepLink = this.getIsDeepLinkBool(isHistory);
|
|
429
|
-
//console.log("GETTING DEEP LINK ", {routeCount, isDeepLink,isHistory, config})
|
|
430
400
|
let isHash = config.isHash;
|
|
431
401
|
let isHidden = config.isHidden;
|
|
432
402
|
let routeType = config.type;
|
|
@@ -445,7 +415,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
445
415
|
let nextWindowLoc = SpyneUtilsChannelRouteUrl.formatStrAsWindowLocation(routeValue);
|
|
446
416
|
let dataFromStr = this.getDataFromLocationStr(typeForStr, isHashForStr, nextWindowLoc);
|
|
447
417
|
|
|
448
|
-
// console.log(" DATA FROM STRING ",{routeValue, pl, dataFromStr});
|
|
449
418
|
let { pathInnermost, paths } = dataFromStr;
|
|
450
419
|
|
|
451
420
|
routeData = rMerge(dataFromStr.routeData, routeData);
|
|
@@ -469,7 +438,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
469
438
|
static getDataFromString(config = this.routeConfigJson, isHistory=false) {
|
|
470
439
|
const type = config.type;
|
|
471
440
|
const hashIsTrue = config.isHash === true;
|
|
472
|
-
// type = config.isHash === true ? ''
|
|
473
441
|
const str = SpyneUtilsChannelRouteUrl.getLocationStrByType(type, hashIsTrue);
|
|
474
442
|
let { paths, pathInnermost, routeData, routeValue } = SpyneChannelRoute.getParamsFromRouteStr(
|
|
475
443
|
str, config, type);
|
|
@@ -496,7 +464,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
496
464
|
? this.routeConfigJson.type
|
|
497
465
|
: t;
|
|
498
466
|
|
|
499
|
-
// console.log("DATA CHECK STRING ",loc);
|
|
500
467
|
const str = SpyneUtilsChannelRouteUrl.getLocationStrByType(type, isHash, loc);
|
|
501
468
|
let { paths, pathInnermost, routeData, routeValue } = this.getParamsFromRouteStr(
|
|
502
469
|
str, this.routeConfigJson, type);
|
|
@@ -521,15 +488,12 @@ export class SpyneChannelRoute extends Channel {
|
|
|
521
488
|
static getRouteStrFromParams(paramsData, routeConfig, t) {
|
|
522
489
|
const type = t !== undefined ? t : routeConfig.type;
|
|
523
490
|
let obj = SpyneUtilsChannelRouteUrl.convertParamsToRoute(paramsData, routeConfig, type);
|
|
524
|
-
|
|
525
|
-
// console.log("ROUTE getRouteStrFromParams ",paramsData,obj);
|
|
526
491
|
return obj;
|
|
527
492
|
}
|
|
528
493
|
|
|
529
494
|
static getParamsFromRouteStr(str, routeConfig, t) {
|
|
530
495
|
const type = t !== undefined ? t : routeConfig.type;
|
|
531
496
|
let obj = SpyneUtilsChannelRouteUrl.convertRouteToParams(str, routeConfig, type);
|
|
532
|
-
// console.log("ROUTE getParamsFromRouteStr ",obj);
|
|
533
497
|
return obj;
|
|
534
498
|
}
|
|
535
499
|
|
|
@@ -539,7 +503,6 @@ export class SpyneChannelRoute extends Channel {
|
|
|
539
503
|
const hashNameIsEmptyBool = isEmptyBool === true && isHash === true;
|
|
540
504
|
const hashNameBool = isEmptyBool === false && isHash === true;
|
|
541
505
|
|
|
542
|
-
// console.log('ROUTE STR CHECK ', {str, isHash});
|
|
543
506
|
if (pathNameIsEmptyBool === true || hashNameIsEmptyBool === true) {
|
|
544
507
|
return '/';
|
|
545
508
|
} else if (hashNameBool === true) {
|
|
@@ -559,11 +522,8 @@ export class SpyneChannelRoute extends Channel {
|
|
|
559
522
|
if (isHash === true) {
|
|
560
523
|
let pathName = SpyneChannelRoute.removeLastSlash(window.location.pathname);
|
|
561
524
|
routeValue = pathName + routeValue;
|
|
562
|
-
// window.location.hash = routeValue;
|
|
563
|
-
// console.log('ROUTE STR FOR HASH ', routeValue);
|
|
564
525
|
window.history.pushState({routeCount}, '', routeValue);
|
|
565
526
|
} else {
|
|
566
|
-
// routeValue = when(isEmpty, always('/'))(routeValue);
|
|
567
527
|
const checkForSlash = when(
|
|
568
528
|
compose(complement(equals('/')), head), concat('/', __));
|
|
569
529
|
window.history.pushState({routeCount}, '', checkForSlash(routeValue));
|
|
@@ -25,7 +25,6 @@ export class SpyneChannelUI extends Channel {
|
|
|
25
25
|
super(name, props);
|
|
26
26
|
this.keyEventsLoaded = false;
|
|
27
27
|
this.keyCodeArr = [];
|
|
28
|
-
// this.addKeyEvent(13);
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
addRegisteredActions() {
|
|
@@ -137,7 +136,6 @@ export class SpyneChannelUI extends Channel {
|
|
|
137
136
|
onIncomingObservable(obj) {
|
|
138
137
|
let eqsName = equals(obj.name, this.props.name);
|
|
139
138
|
obj.data = SpyneChannelUI.removeSSID(obj.data);
|
|
140
|
-
//console.log("OBJECT DATA ",obj.data);
|
|
141
139
|
let {payload, srcElement} = obj.data;
|
|
142
140
|
let dataObj = obsVal => ({ payload, srcElement, event: obsVal });
|
|
143
141
|
let onSuccess = (obj) => obj.observable.pipe(map(dataObj))
|
|
@@ -4,7 +4,7 @@ import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
|
4
4
|
import { SpyneUtilsChannelWindow } from '../utils/spyne-utils-channel-window';
|
|
5
5
|
import { merge } from 'rxjs';
|
|
6
6
|
import { map, debounceTime, skipWhile } from 'rxjs/operators';
|
|
7
|
-
import {curry,
|
|
7
|
+
import {curry, pick, partialRight, mapObjIndexed, apply} from 'ramda';
|
|
8
8
|
import {deepMerge} from '../utils/deep-merge';
|
|
9
9
|
|
|
10
10
|
const rMap = require('ramda').map;
|
|
@@ -39,8 +39,6 @@ export class SpyneChannelWindow extends Channel {
|
|
|
39
39
|
this.bindStaticMethods();
|
|
40
40
|
this.currentScrollY=0;
|
|
41
41
|
|
|
42
|
-
//this.spyneScrollLock = SpyneAppProperties.scrollLock;
|
|
43
|
-
// this.props.name = 'WINDOW';
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
initializeStream() {
|
|
@@ -167,19 +165,10 @@ export class SpyneChannelWindow extends Channel {
|
|
|
167
165
|
return SpyneUtilsChannelWindow.createDomObservableFromEvent('scroll',
|
|
168
166
|
scrollMapFn, isPassive, element)
|
|
169
167
|
.pipe(
|
|
170
|
-
/* map(p=>{
|
|
171
|
-
if (pathEq(['Spyne', 'config', 'scrollLock'], true)(scrollElement)){
|
|
172
|
-
let x = SpyneAppProperties.config.scrollLockX
|
|
173
|
-
let y = SpyneAppProperties.config.scrollLockY;
|
|
174
|
-
window.scrollTo(x,y);
|
|
175
|
-
}
|
|
176
|
-
return p;
|
|
177
|
-
}),*/
|
|
178
168
|
debounceTime(dTime),
|
|
179
169
|
skipWhile(skipWhenDirIsMissing),
|
|
180
170
|
map(p=>{
|
|
181
171
|
const newScrollY = SpyneChannelWindow.getScrollY(element);
|
|
182
|
-
//console.log("SCROLL P IS ",{p});
|
|
183
172
|
p.payload['scrollDistanceAbs'] = Math.abs(this.currentScrollY-newScrollY);
|
|
184
173
|
this.currentScrollY=newScrollY;
|
|
185
174
|
return p;
|
|
@@ -218,13 +207,11 @@ export class SpyneChannelWindow extends Channel {
|
|
|
218
207
|
// CHECK TO ADD MEDIA QUERY OBSERVABLE
|
|
219
208
|
// ==========================================
|
|
220
209
|
config['listenForMediaQueries'] = checkIfObjIsNotEmptyOrNil(
|
|
221
|
-
config.
|
|
210
|
+
config.mediaQueries) || checkIfObjIsNotEmptyOrNil(
|
|
211
|
+
config.mediqQueries);
|
|
222
212
|
|
|
223
213
|
// =========================================
|
|
224
214
|
|
|
225
|
-
// config.listenForResize = false;
|
|
226
|
-
// config.listenForMouseWheel = true;
|
|
227
|
-
// config.listenForScroll = false;
|
|
228
215
|
let methods = {
|
|
229
216
|
'listenForResize': this.createResizeObservable.bind(this),
|
|
230
217
|
'listenForOrientation': this.createOrientationObservable.bind(this),
|
|
@@ -338,43 +325,7 @@ export class SpyneChannelWindow extends Channel {
|
|
|
338
325
|
}
|
|
339
326
|
|
|
340
327
|
onScrollLockEvent(e){
|
|
341
|
-
|
|
342
|
-
SpyneAppProperties.config.scrollLockX = window.scrollX;
|
|
343
|
-
SpyneAppProperties.config.scrollLockY = window.scrollY;
|
|
344
|
-
this.spyneScrollLock.setScroll();
|
|
345
|
-
};
|
|
346
|
-
let {action, scrollLock, el} = e.payload;
|
|
347
|
-
SpyneAppProperties.config.scrollLock = scrollLock;
|
|
348
|
-
el = el || window;
|
|
349
|
-
if (scrollLock === true){
|
|
350
|
-
// setScrollPos();
|
|
351
|
-
|
|
352
|
-
this.spyneScrollLock.disableBodyScroll();
|
|
353
|
-
const id = path(['srcElement', 'id'], e);
|
|
354
|
-
/**
|
|
355
|
-
* TODO: ADD EL TO Scroll lock --- this is hard coded .scroll-lock class
|
|
356
|
-
*
|
|
357
|
-
* */
|
|
358
|
-
//el = document.querySelector(`#${id} .card-scroll`);
|
|
359
|
-
//console.log("E TO SCROLL IS ",{id,el,e});
|
|
360
|
-
// this.onSetElementToScroll({}, el);
|
|
361
|
-
|
|
362
|
-
this.createScrollObservable(this.domChannelConfig, el, true)
|
|
363
|
-
.subscribe(p => {
|
|
364
|
-
let { action, payload, srcElement, event } = p;
|
|
365
|
-
//console.log("SCROLL OBS IS ",p)
|
|
366
|
-
this.sendChannelPayload(action, payload, srcElement, event);
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
} else {
|
|
372
|
-
this.spyneScrollLock.enableBodyScroll();
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
//console.log('scroll lock window channel ',{action,scrollLock});
|
|
376
|
-
|
|
377
|
-
this.sendChannelPayload(action, {scrollLock}, el);
|
|
328
|
+
// DEPRECATED -- MOVED TO spyne-plugin-scroll-lock;
|
|
378
329
|
}
|
|
379
330
|
|
|
380
331
|
onSetElementToScroll(e){
|
|
@@ -384,7 +335,6 @@ export class SpyneChannelWindow extends Channel {
|
|
|
384
335
|
config = deepMerge(this.domChannelConfig, config);
|
|
385
336
|
|
|
386
337
|
scrollElement = scrollElement || el;
|
|
387
|
-
//console.log('set elemenet to scroll ',{scrollElement})
|
|
388
338
|
|
|
389
339
|
const action = "CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT";
|
|
390
340
|
this.sendChannelPayload(action, {el}, el);
|
package/src/spyne/spyne-app.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {ChannelsMap} from './channels/channels-map';
|
|
2
2
|
import {ViewStream} from './views/view-stream';
|
|
3
|
-
import {SpyneUtilsChannelRoute} from './utils/spyne-utils-channel-route';
|
|
4
3
|
import {SpyneAppProperties} from './utils/spyne-app-properties';
|
|
5
4
|
import {deepMerge} from './utils/deep-merge';
|
|
6
5
|
const _channels = new ChannelsMap();
|
|
7
|
-
const version = '0.
|
|
6
|
+
const version = '0.18.3';
|
|
8
7
|
|
|
9
8
|
class SpyneApplication {
|
|
10
9
|
/**
|
|
@@ -42,7 +41,7 @@ class SpyneApplication {
|
|
|
42
41
|
init(config = {}, testMode=false) {
|
|
43
42
|
//this.channels = new ChannelsMap();
|
|
44
43
|
/*!
|
|
45
|
-
* Spyne 0.
|
|
44
|
+
* Spyne 0.18.3
|
|
46
45
|
* https://spynejs.org
|
|
47
46
|
*
|
|
48
47
|
* @license Copyright 2017-2021, Frank Batista, Relevant Context, LLC. All rights reserved.
|
|
@@ -52,18 +51,9 @@ class SpyneApplication {
|
|
|
52
51
|
* @email: frbatista.nyc@gmail.com
|
|
53
52
|
*/
|
|
54
53
|
/* eslint-disable */
|
|
55
|
-
/* this.ViewStream = ViewStream;
|
|
56
|
-
this.BasicView = ViewStreamElement;
|
|
57
|
-
this.DomEl = DomElement;
|
|
58
|
-
this.ViewStreamBroadcaster = ViewStreamBroadcaster;
|
|
59
|
-
this.ChannelsPayload = ViewStreamPayload;
|
|
60
|
-
this.ChannelsController = ChannelsMap;
|
|
61
|
-
this.ChannelsBase = Channel;
|
|
62
|
-
this.ChannelPayloadItem = ChannelPayload;*/
|
|
63
|
-
|
|
64
|
-
//console.log('spyne app ',{config,testMode}, SpyneAppProperties.initialized);
|
|
65
|
-
if(SpyneAppProperties.initialized === true){
|
|
66
54
|
|
|
55
|
+
|
|
56
|
+
if(SpyneAppProperties.initialized === true){
|
|
67
57
|
if (testMode){
|
|
68
58
|
return 'The Spyne Application has already been initialized!';
|
|
69
59
|
} else {
|
|
@@ -113,14 +103,9 @@ class SpyneApplication {
|
|
|
113
103
|
if (config !== undefined) {
|
|
114
104
|
config = SpyneAppProperties.initialize(defaultConfig, config, _channels);
|
|
115
105
|
//window.Spyne = this;
|
|
116
|
-
//window.Spyne['config'] = "SDFSD";// {};
|
|
117
|
-
//config = SpyneUtilsChannelRoute.conformRouteObject(config);
|
|
118
106
|
//window.Spyne['config'] = deepMerge(defaultConfig, config)
|
|
119
107
|
}
|
|
120
108
|
|
|
121
|
-
|
|
122
|
-
//const ranNum = Math.random();
|
|
123
|
-
//console.log('ranNum is ',{ranNum})
|
|
124
109
|
this.pluginsFn = SpyneAppProperties.getPluginsMethodObj(config['pluginMethods']);
|
|
125
110
|
this.getChannelActions = (str) => _channels.getChannelActions(str);
|
|
126
111
|
this.registerChannel = (val) => _channels.registerStream(val);
|
|
@@ -130,10 +115,9 @@ class SpyneApplication {
|
|
|
130
115
|
nullHolder.appendToDom(document.body);
|
|
131
116
|
nullHolder.props.el.style.cssText = 'display:none; opacity:0; pointer-events:none;';
|
|
132
117
|
_channels.init();
|
|
133
|
-
//console.log('spyne app initialized ',SpyneAppProperties.config.debug);
|
|
134
118
|
|
|
135
119
|
if (SpyneAppProperties.config.debug===true){
|
|
136
|
-
|
|
120
|
+
window.Spyne = {version};
|
|
137
121
|
}
|
|
138
122
|
|
|
139
123
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {SpyneApp,
|
|
2
|
-
import {
|
|
1
|
+
import {SpyneApp, DomElement, SpyneAppProperties} from './spyne';
|
|
2
|
+
import {is, clone, pathSatisfies} from 'ramda';
|
|
3
3
|
export class SpynePlugin {
|
|
4
4
|
|
|
5
5
|
constructor(props={}) {
|
|
@@ -11,20 +11,11 @@ export class SpynePlugin {
|
|
|
11
11
|
config = clone(props);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
//console.log("CONFIG AND PROPS ",{config, props});
|
|
16
|
-
|
|
17
14
|
this.name = name || 'empty';
|
|
18
15
|
this.props.name = name;
|
|
19
16
|
config = SpynePlugin.mergeDefaultConfig(config, this.defaultConfig());
|
|
20
17
|
this.props.parentEl = parentEl || SpynePlugin.createParentEl();
|
|
21
18
|
SpynePlugin.getSpyneApp(name, config);
|
|
22
|
-
//console.log("SPYNE APP ",{name},this.name,this.props.spyneApp);
|
|
23
|
-
// if (this.props.spyneApp===false){
|
|
24
|
-
//console.warn(`Spyne Warning: Spyne Plugin, ${this.name} already exists!`)
|
|
25
|
-
// return false;
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
19
|
|
|
29
20
|
if (this.props.traits!==undefined){
|
|
30
21
|
this.addTraits(this.props.traits);
|
|
@@ -35,70 +26,24 @@ export class SpynePlugin {
|
|
|
35
26
|
this.onRender();
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
addTraits(traits){
|
|
40
|
-
if (traits.constructor.name!=='Array'){
|
|
41
|
-
traits = [traits];
|
|
42
|
-
}
|
|
43
|
-
const addTrait=(TraitClass)=>{
|
|
44
|
-
new TraitClass(this);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
traits.forEach(addTrait);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onBeforeRegistered(){
|
|
54
|
-
this.props.pluginName = this.props.name;
|
|
55
|
-
//this.props.config = path(['Spyne', 'config', 'plugins', this.props.name], window);
|
|
56
|
-
this.props.config = SpyneAppProperties.getPluginConfigByPluginName(this.props.pluginName);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
29
|
static mergeDefaultConfig(config={}, defaultConfig=this.defaultConfig()){
|
|
60
|
-
return Object.assign(defaultConfig, config);
|
|
30
|
+
return Object.assign(defaultConfig, config);
|
|
61
31
|
}
|
|
62
32
|
|
|
63
|
-
|
|
64
|
-
defaultConfig(){
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
33
|
static getSpyneApp(name, config){
|
|
76
|
-
// const win = window || {};
|
|
77
|
-
// let spyneApp = prop('Spyne', win) ;
|
|
78
|
-
// const spyneInitialized = typeof(spyneApp) === 'object';
|
|
79
|
-
//console.log('spyne app is ',{spyneApp, spyneInitialized}, typeof(spyneApp));
|
|
80
|
-
|
|
81
|
-
// spyneApp = spyneInitialized === true ? spyneApp : new spyneApp();
|
|
82
34
|
if(SpyneAppProperties.initialized===false){
|
|
83
|
-
SpyneApp.init()
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
SpyneAppProperties.addPluginConfig(name, config);
|
|
88
|
-
|
|
89
|
-
/* const updateConfig = SpynePlugin.updateSpyneConfig(spyneApp, name, config);
|
|
90
35
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
36
|
+
console.warn(`Spyne Warning: Unable to install plugin, ${name}! SpyneApp has not been initialized!`);
|
|
37
|
+
//SpyneApp.init()
|
|
38
|
+
} else{
|
|
39
|
+
SpyneAppProperties.addPluginConfig(name, config);
|
|
40
|
+
}
|
|
94
41
|
|
|
95
|
-
// spyneApp.config.plugins[name] = config;
|
|
96
|
-
//return spyneApp;
|
|
97
42
|
}
|
|
98
43
|
|
|
44
|
+
|
|
99
45
|
static updateSpyneConfig(spyneApp, pluginName, pluginConfig){
|
|
100
46
|
const pathExists = pathSatisfies(is(Object), ['config', 'plugins', pluginName])(spyneApp);
|
|
101
|
-
// console.log('path exists ',{pathExists}, spyneApp.config.plugins[pluginName])
|
|
102
47
|
|
|
103
48
|
if (pathExists===true){
|
|
104
49
|
if (spyneApp.config.debug===true) {
|
|
@@ -130,6 +75,32 @@ export class SpynePlugin {
|
|
|
130
75
|
return el || createPluginParentEl();
|
|
131
76
|
}
|
|
132
77
|
|
|
78
|
+
addTraits(traits){
|
|
79
|
+
if (traits.constructor.name!=='Array'){
|
|
80
|
+
traits = [traits];
|
|
81
|
+
}
|
|
82
|
+
const addTrait=(TraitClass)=>{
|
|
83
|
+
return new TraitClass(this);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
traits.forEach(addTrait);
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onBeforeRegistered(){
|
|
91
|
+
this.props.pluginName = this.props.name;
|
|
92
|
+
this.props.config = SpyneAppProperties.getPluginConfigByPluginName(this.props.pluginName);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
defaultConfig(){
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
133
104
|
onRegistered(){
|
|
134
105
|
|
|
135
106
|
|
package/src/spyne/spyne.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Validation from 'data.validation';
|
|
2
2
|
import {curry, curryN, length, always, reduce} from 'ramda';
|
|
3
|
-
// import { curry, curryN, reduce, length, always } from 'ramda';
|
|
4
3
|
const success = Validation.Success;
|
|
5
4
|
const failure = Validation.Failure;
|
|
6
5
|
let validate = () => {};
|