spyne 0.14.8 → 0.17.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/.travis.yml +2 -2
- package/karma.conf.js +27 -20
- package/lib/channel-action-filter.test.2418910233.js +20 -0
- package/lib/channel-dom.test.1490741340.js +20 -0
- package/lib/channel-fetch-util.test.3681936279.js +20 -0
- package/lib/channel-fetch.test.380764798.js +20 -0
- package/lib/channel-payload-class.test.2325155642.js +20 -0
- package/lib/channel-payload-filter.test.1598505124.js +20 -0
- package/lib/channel-route.test.921296320.js +20 -0
- package/lib/channel-stream-item.test.159699696.js +20 -0
- package/lib/channel-ui.test.291129654.js +20 -0
- package/lib/channel-util-dom.test.181212370.js +20 -0
- package/lib/channel.test.706832124.js +20 -0
- package/lib/commons.js +50363 -0
- package/lib/dom-el-selectors.test.3296414834.js +20 -0
- package/lib/dom-el-template.test.1459850380.js +20 -0
- package/lib/dom-el.test.2449130808.js +20 -0
- package/lib/frp-tools.test.1620088187.js +20 -0
- package/lib/import.test.723835576.js +20 -0
- package/lib/index.test.2146503294.js +20 -0
- package/lib/plugins-methods.test.3482246428.js +20 -0
- package/lib/route-utils.test.2932649409.js +20 -0
- package/lib/runtime.js +174 -0
- package/lib/spyne-app-properties.test.485192211.js +20 -0
- package/lib/spyne-app.test.4150724251.js +20 -0
- package/lib/spyne-plugin.test.3993976219.js +20 -0
- package/lib/spyne.js +15477 -18467
- package/lib/spyne.min.js +2 -12
- package/lib/spyne.min.js.LICENSE.txt +10 -0
- package/lib/url-utils.test.3668806082.js +20 -0
- package/lib/view-stream-broadcaster.test.2534955231.js +20 -0
- package/lib/view-stream-enhancer-loader.test.3395418180.js +20 -0
- package/lib/view-stream-enhancer.test.1043626253.js +20 -0
- package/lib/view-stream.test.1765314964.js +20 -0
- package/package.json +37 -65
- package/src/spyne/channels/channel-fetch-class.js +24 -1
- package/src/spyne/channels/channel-payload-class.js +102 -11
- package/src/spyne/channels/channel-proxy.js +6 -4
- package/src/spyne/channels/channel.js +66 -6
- package/src/spyne/channels/channels-config.js +2 -2
- package/src/spyne/channels/{channels-delegator.js → channels-map.js} +37 -21
- package/src/spyne/channels/spyne-channel-lifecycle.js +1 -1
- package/src/spyne/channels/spyne-channel-route.js +95 -15
- package/src/spyne/channels/spyne-channel-ui.js +1 -0
- package/src/spyne/channels/spyne-channel-window.js +60 -20
- package/src/spyne/spyne-app.js +181 -0
- package/src/spyne/spyne-plugins.js +146 -0
- package/src/spyne/spyne.js +11 -139
- package/src/spyne/utils/channel-fetch-util.js +1 -1
- package/src/spyne/utils/channel-payload-filter.js +166 -30
- package/src/spyne/utils/frp-tools.js +21 -1
- package/src/spyne/utils/mixins/base-streams-mixins.js +1 -0
- package/src/spyne/utils/spyne-app-properties.js +213 -0
- package/src/spyne/utils/spyne-logger.js +18 -0
- package/src/spyne/utils/spyne-plugins-methods.js +105 -0
- package/src/spyne/utils/spyne-scroll-lock.js +95 -0
- package/src/spyne/utils/spyne-utils-channel-route-url.js +2 -1
- package/src/spyne/utils/spyne-utils-channel-route.js +3 -1
- package/src/spyne/utils/spyne-utils-channel-window.js +2 -2
- package/src/spyne/views/dom-element-template.js +52 -23
- package/src/spyne/views/dom-element.js +11 -2
- package/src/spyne/views/view-stream-broadcaster.js +3 -3
- package/src/spyne/views/view-stream-payload.js +76 -15
- package/src/spyne/views/view-stream-selector.js +2 -2
- package/src/spyne/views/view-stream.js +219 -115
- package/src/tests/channels/channel-fetch.test.js +102 -0
- package/src/tests/channels/channel-payload-class.test.js +149 -0
- package/src/tests/channels/channel-payload-filter.test.js +298 -0
- package/src/tests/channels/channel-route.test.js +76 -1
- package/src/tests/channels/channel-stream-item.test.js +3 -2
- package/src/tests/channels/channel.test.js +38 -0
- package/src/tests/channels/route-utils.test.js +1 -1
- package/src/tests/index.js +0 -1
- package/src/tests/index.test.js +6 -0
- package/src/tests/mocks/channel-payload-data.js +93 -1
- package/src/tests/mocks/msf-user-data-small.json +4103 -0
- package/src/tests/mocks/msf-user-data.json +47035 -0
- package/src/tests/mocks/utils-data.js +20 -2
- package/src/tests/spyne-app.test.js +27 -0
- package/src/tests/spyne-plugin.test.js +49 -0
- package/src/tests/utils/channel-action-filter.test.js +22 -11
- package/src/tests/utils/channel-data-packet-generator.unused.js +119 -0
- package/src/tests/utils/plugins-methods.test.js +103 -0
- package/src/tests/utils/spyne-app-properties.test.js +11 -0
- package/src/tests/views/dom-el-selectors.test.js +1 -1
- package/webpack.config.js +30 -15
- package/lib/spyne.js.map +0 -1
- package/src/spyne/utils/viewstream-dom-utils.js +0 -8
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export class SpyneScrollLock {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @module SpyneScrollLock
|
|
5
|
+
* @type core
|
|
6
|
+
* @desc
|
|
7
|
+
* Channel Window utility that handles locking body scroll.
|
|
8
|
+
*
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {Number} x - = 0; Window scroll X position.
|
|
11
|
+
* @param {Number} y - = 0; Window scroll Y position.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
constructor(x=window.scrollX,y=window.scrollY) {
|
|
17
|
+
this.scrollX = x;
|
|
18
|
+
this.scrollY = y;
|
|
19
|
+
this.scrollLocked = false;
|
|
20
|
+
this.scrollElement = undefined;
|
|
21
|
+
this.defaultScrollState = SpyneScrollLock.getDefaultScrollState();
|
|
22
|
+
/**
|
|
23
|
+
* TODO: GET IOS BOOL -- check window height in IOS and adjust
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* */
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static getDefaultOverflow(){
|
|
32
|
+
return window.getComputedStyle(document.body)['overflow'];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static getDefaultPosition(){
|
|
36
|
+
return window.getComputedStyle(document.body)['position'];
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static getDefaultTop(){
|
|
41
|
+
return window.getComputedStyle(document.body)['top'];
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static getDefaultBodyTop(){
|
|
46
|
+
return window.getComputedStyle(document.body)['top'];
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static getDefaultScrollState(){
|
|
51
|
+
return {
|
|
52
|
+
position: SpyneScrollLock.getDefaultPosition(),
|
|
53
|
+
overflow: SpyneScrollLock.getDefaultOverflow(),
|
|
54
|
+
top: SpyneScrollLock.getDefaultTop(),
|
|
55
|
+
x: window.scrollX,
|
|
56
|
+
y: window.scrollY
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
disableBodyScroll(){
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// this.defaultBodyOverflow = SpyneScrollLock.getDefaultOverflow();
|
|
67
|
+
this.defaultScrollState = SpyneScrollLock.getDefaultScrollState();
|
|
68
|
+
const {y} = this.defaultScrollState;
|
|
69
|
+
const bodyTopPos = `${y*-1}px`;
|
|
70
|
+
|
|
71
|
+
//console.log('disable body scroll ', this.defaultScrollState, bodyTopPos)
|
|
72
|
+
document.body.style.overflow = 'hidden';
|
|
73
|
+
document.body.style.position = 'fixed';
|
|
74
|
+
document.body.style.top = bodyTopPos;
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
enableBodyScroll(){
|
|
81
|
+
const {position, overflow, top, x, y} = this.defaultScrollState;
|
|
82
|
+
|
|
83
|
+
//console.log('Enable body scroll ', this.defaultScrollState)
|
|
84
|
+
|
|
85
|
+
document.body.style.overflow = overflow;
|
|
86
|
+
document.body.style.position = position;
|
|
87
|
+
document.body.style.top = top;
|
|
88
|
+
window.scrollTo(x,y);
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {isEmpty, head, values, compose, prop, complement, isNil, allPass, reduce, filter, equals, toPairs, replace, either, propEq, __,invert,path,zipObj, reject, keys, find, assoc, is,has, when, split, always, concat, join, flatten, map, ifElse, test, findLastIndex,last, defaultTo,fromPairs } from 'ramda';
|
|
2
|
+
import {SpyneAppProperties} from './spyne-app-properties';
|
|
2
3
|
|
|
3
4
|
export class SpyneUtilsChannelRouteUrl {
|
|
4
5
|
constructor() {
|
|
@@ -163,7 +164,7 @@ export class SpyneUtilsChannelRouteUrl {
|
|
|
163
164
|
return map(mapUrlProps, urlsArr);
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
static convertParamsToRoute(data, r =
|
|
167
|
+
static convertParamsToRoute(data, r = SpyneAppProperties.config.channels.ROUTE, t, locStr) {
|
|
167
168
|
const urlType = t !== undefined ? t : r.type;
|
|
168
169
|
const isHash = r.isHash;
|
|
169
170
|
let route = r.routes.routePath;
|
|
@@ -129,7 +129,9 @@ export class SpyneUtilsChannelRoute {
|
|
|
129
129
|
const [key, val] = arrPair;
|
|
130
130
|
const isObject = is(Object, val);
|
|
131
131
|
|
|
132
|
-
const
|
|
132
|
+
const createTitle = (str)=>String(str).replace(/([-_])/g, " ").toUpperCase();
|
|
133
|
+
|
|
134
|
+
const getLinkText = str => test(isValidStrRE, str) ? createTitle(str) : key;
|
|
133
135
|
|
|
134
136
|
if (key === 'routeName' || key === '404'){
|
|
135
137
|
return acc;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromEventPattern } from 'rxjs';
|
|
1
|
+
import { fromEventPattern, fromEvent } from 'rxjs';
|
|
2
2
|
import { map } from 'rxjs/operators';
|
|
3
3
|
import {mapObjIndexed} from 'ramda';
|
|
4
4
|
|
|
@@ -66,7 +66,7 @@ export class SpyneUtilsChannelWindow {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
static createMergedObsFromObj(config) {
|
|
69
|
-
let mediaQueriesObj = config.mediqQueries;
|
|
69
|
+
let mediaQueriesObj = config.mediaQueries || config.mediqQueries;
|
|
70
70
|
let arr = [];
|
|
71
71
|
|
|
72
72
|
const loopQueries = (val, key, obj) => {
|
|
@@ -136,6 +136,9 @@ export class DomElementTemplate {
|
|
|
136
136
|
constructor(template, data) {
|
|
137
137
|
this.template = this.formatTemplate(template);
|
|
138
138
|
|
|
139
|
+
//const tempL = `template-${Math.floor(Math.random()*99999)}`
|
|
140
|
+
// this.tempL=tempL
|
|
141
|
+
|
|
139
142
|
const checkForArrayData = ()=>{
|
|
140
143
|
if (is(Array, data) === true) {
|
|
141
144
|
data = {spyneData:data};
|
|
@@ -144,19 +147,21 @@ export class DomElementTemplate {
|
|
|
144
147
|
}
|
|
145
148
|
};
|
|
146
149
|
|
|
147
|
-
checkForArrayData();
|
|
148
150
|
|
|
151
|
+
checkForArrayData();
|
|
149
152
|
|
|
150
153
|
this.templateData = data;
|
|
151
154
|
|
|
155
|
+
|
|
152
156
|
let strArr = DomElementTemplate.getStringArray(this.template);
|
|
153
157
|
|
|
158
|
+
|
|
154
159
|
let strMatches = this.template.match(DomElementTemplate.findTmplLoopsRE());
|
|
155
160
|
strMatches = strMatches === null ? [] : strMatches;
|
|
156
161
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
const parseTmplLoopsRE = DomElementTemplate.parseTmplLoopsRE();
|
|
163
|
+
const parseTmplLoopFn = this.parseTheTmplLoop.bind(this);
|
|
164
|
+
const mapTmplLoop = (str, data) => str.replace(parseTmplLoopsRE, parseTmplLoopFn);
|
|
160
165
|
const findTmplLoopsPred = includes(__, strMatches);
|
|
161
166
|
|
|
162
167
|
const checkForMatches = ifElse(
|
|
@@ -165,6 +170,7 @@ export class DomElementTemplate {
|
|
|
165
170
|
this.addParams.bind(this));
|
|
166
171
|
|
|
167
172
|
this.finalArr = strArr.map(checkForMatches);
|
|
173
|
+
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
static getStringArray(template) {
|
|
@@ -197,11 +203,24 @@ export class DomElementTemplate {
|
|
|
197
203
|
*
|
|
198
204
|
* @desc Returns a document fragment generated from the template and any added data.
|
|
199
205
|
*/
|
|
206
|
+
|
|
207
|
+
|
|
200
208
|
renderDocFrag() {
|
|
209
|
+
|
|
210
|
+
|
|
201
211
|
const html = this.finalArr.join('');
|
|
202
|
-
const
|
|
203
|
-
|
|
212
|
+
const isTableSubTag = /^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/.test(html);
|
|
213
|
+
const el = isTableSubTag ? html : document.createRange().createContextualFragment(html);
|
|
214
|
+
|
|
215
|
+
window.setTimeout(this.removeThis(), 2);
|
|
204
216
|
return el;
|
|
217
|
+
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
renderToString(){
|
|
221
|
+
const html = this.finalArr.join('');
|
|
222
|
+
window.setTimeout(this.removeThis(), 2);
|
|
223
|
+
return html;
|
|
205
224
|
}
|
|
206
225
|
|
|
207
226
|
getTemplateString() {
|
|
@@ -210,21 +229,33 @@ export class DomElementTemplate {
|
|
|
210
229
|
|
|
211
230
|
formatTemplate(template) {
|
|
212
231
|
return prop('nodeName', template)==='SCRIPT' ? template.innerHTML : template;
|
|
232
|
+
}
|
|
213
233
|
|
|
214
|
-
|
|
234
|
+
getDataValFromPathStr(pathStr, dataFile){
|
|
235
|
+
const pathArr = String(pathStr).split('.');
|
|
236
|
+
const pathData = path(pathArr, dataFile);
|
|
237
|
+
return pathData || '';
|
|
215
238
|
}
|
|
216
239
|
|
|
217
240
|
addParams(str) {
|
|
241
|
+
//console.time(this.tempL+'9')
|
|
242
|
+
const re = /(\.)/gm;
|
|
243
|
+
|
|
218
244
|
const replaceTags = (str, p1, p2, p3) => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
245
|
+
if (re.test(p2) === false && this.templateData[p2] !==undefined){
|
|
246
|
+
return this.templateData[p2];
|
|
247
|
+
}
|
|
248
|
+
return this.getDataValFromPathStr(p2, this.templateData);
|
|
222
249
|
};
|
|
223
250
|
|
|
224
|
-
|
|
251
|
+
return str.replace(DomElementTemplate.swapParamsForTagsRE(), replaceTags);
|
|
252
|
+
|
|
225
253
|
}
|
|
226
254
|
|
|
227
255
|
parseTheTmplLoop(str, p1, p2, p3) {
|
|
256
|
+
|
|
257
|
+
//console.time(this.tempL+'5b')
|
|
258
|
+
const reDot = /(\.)/gm;
|
|
228
259
|
const subStr = p3;
|
|
229
260
|
let elData = this.templateData[p2];
|
|
230
261
|
const parseString = (item, str) => {
|
|
@@ -233,22 +264,17 @@ export class DomElementTemplate {
|
|
|
233
264
|
const parseObject = (obj, str) => {
|
|
234
265
|
const loopObj = (str, p1, p2) => {
|
|
235
266
|
// DOT SYNTAX CHECK
|
|
236
|
-
|
|
267
|
+
if (reDot.test(p2) === false && obj[p2] !==undefined) {
|
|
268
|
+
return obj[p2]
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return this.getDataValFromPathStr(p2, obj);
|
|
237
272
|
};
|
|
238
273
|
return str.replace(DomElementTemplate.swapParamsForTagsRE(), loopObj);
|
|
239
274
|
};
|
|
240
|
-
const mapStringData = (d) =>
|
|
241
|
-
if (typeof (d) === 'string') {
|
|
242
|
-
//console.log("MAP STR 1 ",{d, subStr});
|
|
275
|
+
const mapStringData = (d) => typeof(d) === 'string' ? parseString(d, subStr) : parseObject(d, subStr);
|
|
243
276
|
|
|
244
|
-
d = parseString(d, subStr);
|
|
245
|
-
// console.log("MAP STR 2",{d, subStr});
|
|
246
277
|
|
|
247
|
-
} else {
|
|
248
|
-
d = parseObject(d, subStr);
|
|
249
|
-
}
|
|
250
|
-
return d;
|
|
251
|
-
};
|
|
252
278
|
if (isNil(elData) === true || isEmpty(elData)) {
|
|
253
279
|
return '';
|
|
254
280
|
}
|
|
@@ -256,6 +282,9 @@ export class DomElementTemplate {
|
|
|
256
282
|
if (elData.length===undefined) {
|
|
257
283
|
elData = [elData];
|
|
258
284
|
}
|
|
259
|
-
|
|
285
|
+
|
|
286
|
+
return elData.map(mapStringData).join('');
|
|
287
|
+
|
|
288
|
+
|
|
260
289
|
}
|
|
261
290
|
}
|
|
@@ -97,9 +97,9 @@ class DomElement {
|
|
|
97
97
|
let addTmpl = (template) => {
|
|
98
98
|
let data = this.getProp('data');
|
|
99
99
|
data = is(Object, data) ? data : {};
|
|
100
|
-
|
|
101
100
|
let frag = new DomElementTemplate(template, data).renderDocFrag();
|
|
102
|
-
|
|
101
|
+
const fragIsString = is(String, frag);
|
|
102
|
+
fragIsString ? el.innerHTML = frag : el.appendChild(frag);
|
|
103
103
|
return el;
|
|
104
104
|
};
|
|
105
105
|
let doNothing = (el) => el;
|
|
@@ -143,6 +143,15 @@ class DomElement {
|
|
|
143
143
|
return this.getProp('el');
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
renderToHTMLString() {
|
|
147
|
+
this.execute();
|
|
148
|
+
this.props.template = undefined;
|
|
149
|
+
this.props.data = undefined;
|
|
150
|
+
this.props.attributes = undefined;
|
|
151
|
+
return this.getProp('el').outerHTML;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
146
155
|
returnIfDefined(obj, val) {
|
|
147
156
|
if (val !== undefined) {
|
|
148
157
|
let isObj = typeof (val) === 'undefined';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { baseStreamsMixins } from '../utils/mixins/base-streams-mixins';
|
|
2
2
|
import { convertDomStringMapToObj } from '../utils/frp-tools';
|
|
3
|
-
|
|
3
|
+
import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
4
4
|
import { fromEvent } from 'rxjs';
|
|
5
5
|
import { map } from 'rxjs/operators';
|
|
6
6
|
import {clone, omit, path} from 'ramda';
|
|
@@ -99,10 +99,10 @@ export class ViewStreamBroadcaster {
|
|
|
99
99
|
// run payload
|
|
100
100
|
channelPayload(observable, data);
|
|
101
101
|
};
|
|
102
|
-
let isDevMode =
|
|
102
|
+
let isDevMode = SpyneAppProperties.debug === true;
|
|
103
103
|
let queryIsNil = query === undefined || query.length <= 0;
|
|
104
104
|
if (queryIsNil === true && isDevMode === true) {
|
|
105
|
-
console.warn(`Spyne Warning: The item ${selector}, does not appear to exist!`);
|
|
105
|
+
console.warn(`Spyne Warning: The item ${selector}, does not appear to exist in ${this.props.name} --> vsid:${this.props.vsid}!`);
|
|
106
106
|
// query = this.props.el;
|
|
107
107
|
// addObservable(query, event);
|
|
108
108
|
} else {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { uiValidations } from '../channels/channels-config';
|
|
2
|
-
import {
|
|
2
|
+
import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
3
|
+
//import { validate } from '../utils/channel-config-validator';
|
|
3
4
|
import { gc } from '../utils/gc';
|
|
5
|
+
import {
|
|
6
|
+
compose,
|
|
7
|
+
clone,
|
|
8
|
+
fromPairs,
|
|
9
|
+
toPairs,
|
|
10
|
+
__,
|
|
11
|
+
lte, defaultTo, prop, is,
|
|
12
|
+
} from 'ramda';
|
|
4
13
|
|
|
5
14
|
export class ViewStreamPayload {
|
|
6
15
|
/**
|
|
@@ -18,40 +27,47 @@ export class ViewStreamPayload {
|
|
|
18
27
|
* @param {Boolean} debug
|
|
19
28
|
*/
|
|
20
29
|
constructor(name, observable, data, action = 'subscribe', debug = false) {
|
|
21
|
-
this.addMixins();
|
|
22
|
-
|
|
30
|
+
//this.addMixins();
|
|
31
|
+
const options = {
|
|
23
32
|
'name' : name,
|
|
24
33
|
'observable': observable,
|
|
25
34
|
'data': data,
|
|
26
35
|
'action': action
|
|
27
36
|
};
|
|
28
|
-
|
|
37
|
+
// this.getValidationChecks(name);
|
|
38
|
+
this.sendToDirectorStream(options);
|
|
29
39
|
}
|
|
30
|
-
getValidationChecks(n) {
|
|
40
|
+
/* getValidationChecks(n) {
|
|
31
41
|
let left = e => console.warn(e);
|
|
32
42
|
let right = val => this.onRunValidations(val);
|
|
33
|
-
|
|
34
|
-
if (
|
|
43
|
+
let channelExists = SpyneAppProperties.channelsMap.testStream(n);
|
|
44
|
+
if (channelExists === true) {
|
|
35
45
|
return right(uiValidations);
|
|
36
46
|
} else {
|
|
37
47
|
return left('payload Needs a Valid Stream Name!');//
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
onRunValidations(checks) {
|
|
41
|
-
validate(checks(), this.options).fold(
|
|
51
|
+
/!*validate(checks(), this.options).fold(
|
|
42
52
|
this.onError.bind(this),
|
|
43
|
-
this.onSuccess.bind(this))
|
|
53
|
+
this.onSuccess.bind(this));*!/
|
|
44
54
|
}
|
|
45
55
|
onPayloadValidated(p) {
|
|
46
56
|
this.sendToDirectorStream(p);
|
|
47
|
-
}
|
|
57
|
+
}*/
|
|
48
58
|
sendToDirectorStream(payload) {
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
directorStream$.next(
|
|
53
|
-
|
|
59
|
+
let directorStream$ = SpyneAppProperties.channelsMap.getStream('DISPATCHER');
|
|
60
|
+
const frozenPayload = ViewStreamPayload.deepClone(payload);
|
|
61
|
+
//console.log('payload is ',frozenPayload);
|
|
62
|
+
directorStream$.next(frozenPayload);
|
|
63
|
+
payload = undefined;
|
|
64
|
+
|
|
65
|
+
//this.gc();
|
|
66
|
+
//console.timeEnd(label);
|
|
67
|
+
|
|
68
|
+
delete this;
|
|
54
69
|
}
|
|
70
|
+
/*
|
|
55
71
|
onError(errors) {
|
|
56
72
|
console.warn('payload failed due to:\n' + errors.map(e => '* ' + e).join('\n'));
|
|
57
73
|
this.gc();
|
|
@@ -59,6 +75,51 @@ export class ViewStreamPayload {
|
|
|
59
75
|
onSuccess(payload) {
|
|
60
76
|
this.onPayloadValidated(payload);
|
|
61
77
|
}
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
static deepClone(o) {
|
|
81
|
+
const isArr = is(Array);
|
|
82
|
+
const isObj = is(Object);
|
|
83
|
+
const isIter = ob => isArr(ob)===false && isObj(ob)===true;
|
|
84
|
+
const isIterable = isIter(o);
|
|
85
|
+
return isIterable ? compose(fromPairs, toPairs, clone)(o) : clone(o);
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
static deepFreeze(o) {
|
|
92
|
+
//return o;
|
|
93
|
+
//return Object.freeze(o);
|
|
94
|
+
const elIsDomElement = compose(lte(0), defaultTo(-1), prop('nodeType'));
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
Object.freeze(o);
|
|
98
|
+
Object.getOwnPropertyNames(o).forEach(function(prop) {
|
|
99
|
+
if (o.hasOwnProperty(prop)
|
|
100
|
+
&& elIsDomElement(o[prop]) === false
|
|
101
|
+
&& o[prop] !== null
|
|
102
|
+
&& (typeof o[prop] === "object" || typeof o[prop] === "function")
|
|
103
|
+
&& !Object.isFrozen(o[prop])) {
|
|
104
|
+
ChannelPayload.deepFreeze(o[prop]);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
} catch(e){
|
|
109
|
+
//console.log("FREEZE ERR ",{o,e});
|
|
110
|
+
return o;
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return o;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static getMouseEventKeys() {
|
|
118
|
+
return ['altKey', 'bubbles', 'cancelBubble', 'cancelable', 'clientX', 'clientY', 'composed', 'ctrlKey', 'currentTarget', 'defaultPrevented', 'detail', 'eventPhase', 'fromElement', 'isTrusted', 'layerX', 'layerY', 'metaKey', 'movementX', 'movementY', 'offsetX', 'offsetY', 'pageX', 'pageY', 'path', 'relatedTarget', 'returnValue', 'screenX', 'screenY', 'shiftKey', 'sourceCapabilities', 'srcElement', 'target', 'timeStamp', 'toElement', 'type', 'view', 'which', 'x', 'y'];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
62
123
|
addMixins() {
|
|
63
124
|
// ==================================
|
|
64
125
|
// BASE CORE MIXINS
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {head, compose, reject, split, isEmpty, path, lte, defaultTo, prop} from 'ramda';
|
|
2
|
-
|
|
2
|
+
import {SpyneAppProperties} from '../utils/spyne-app-properties';
|
|
3
3
|
|
|
4
4
|
function generateSpyneSelectorId(el) {
|
|
5
5
|
//const num = () => Math.floor(Math.random(10000000) * 10000000);
|
|
@@ -15,7 +15,7 @@ function generateSpyneSelectorId(el) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function isDevMode(){
|
|
18
|
-
return
|
|
18
|
+
return SpyneAppProperties.debug === true;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|