spyne 0.19.1 → 0.20.1

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 (132) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +4 -3
  3. package/.travis.yml +24 -11
  4. package/karma.conf.js +77 -87
  5. package/lib/spyne.esm.js +15 -0
  6. package/lib/spyne.esm.js.map +1 -0
  7. package/lib/spyne.js +248 -248
  8. package/lib/spyne.umd.js +3 -0
  9. package/lib/spyne.umd.js.LICENSE.txt +16 -0
  10. package/package.json +48 -27
  11. package/rollup.config.js +26 -0
  12. package/src/spyne/channels/channel-fetch-class.js +39 -43
  13. package/src/spyne/channels/channel-payload-class.js +61 -74
  14. package/src/spyne/channels/channel-proxy.js +25 -26
  15. package/src/spyne/channels/channel.js +141 -149
  16. package/src/spyne/channels/channels-config.js +46 -47
  17. package/src/spyne/channels/channels-map.js +61 -65
  18. package/src/spyne/channels/spyne-channel-lifecycle.js +12 -12
  19. package/src/spyne/channels/spyne-channel-route.js +241 -250
  20. package/src/spyne/channels/spyne-channel-ui.js +213 -75
  21. package/src/spyne/channels/spyne-channel-window.js +157 -157
  22. package/src/spyne/spyne-app.js +32 -19
  23. package/src/spyne/spyne-plugins.js +55 -70
  24. package/src/spyne/spyne.js +23 -23
  25. package/src/spyne/utils/channel-config-validator.js +10 -10
  26. package/src/spyne/utils/channel-fetch-util.js +72 -55
  27. package/src/spyne/utils/channel-payload-filter.js +89 -100
  28. package/src/spyne/utils/deep-merge.js +31 -29
  29. package/src/spyne/utils/frp-tools.js +108 -92
  30. package/src/spyne/utils/gc.js +6 -6
  31. package/src/spyne/utils/mixins/base-core-mixins.js +17 -15
  32. package/src/spyne/utils/mixins/base-streams-mixins.js +9 -9
  33. package/src/spyne/utils/route-channel-updater.js +23 -29
  34. package/src/spyne/utils/safe-clone.js +40 -58
  35. package/src/spyne/utils/sanitize-html.js +35 -0
  36. package/src/spyne/utils/security-policy.js +11 -0
  37. package/src/spyne/utils/spyne-app-properties.js +110 -114
  38. package/src/spyne/utils/spyne-logger.js +4 -11
  39. package/src/spyne/utils/spyne-plugins-methods.js +38 -63
  40. package/src/spyne/utils/spyne-trait.js +33 -33
  41. package/src/spyne/utils/spyne-utils-channel-route-url.js +229 -153
  42. package/src/spyne/utils/spyne-utils-channel-route.js +128 -138
  43. package/src/spyne/utils/spyne-utils-channel-window.js +39 -39
  44. package/src/spyne/utils/viewstream-animations.js +12 -12
  45. package/src/spyne/utils/viewstream-observables.js +45 -45
  46. package/src/spyne/views/dom-element-template.js +111 -114
  47. package/src/spyne/views/dom-element.js +82 -84
  48. package/src/spyne/views/view-stream-broadcaster.js +66 -62
  49. package/src/spyne/views/view-stream-element.js +105 -106
  50. package/src/spyne/views/view-stream-payload.js +25 -27
  51. package/src/spyne/views/view-stream-selector.js +157 -163
  52. package/src/spyne/views/view-stream.js +416 -640
  53. package/src/tests/channels/channel-dom.test.js +15 -15
  54. package/src/tests/channels/channel-fetch.test.js +51 -62
  55. package/src/tests/channels/channel-payload-class.test.js +50 -63
  56. package/src/tests/channels/channel-payload-filter.test.js +133 -193
  57. package/src/tests/channels/channel-route.test.js +102 -112
  58. package/src/tests/channels/channel-stream-item.test.js +19 -19
  59. package/src/tests/channels/channel-ui.test.js +15 -27
  60. package/src/tests/channels/channel-util-dom.test.js +31 -31
  61. package/src/tests/channels/channel.test.js +20 -25
  62. package/src/tests/channels/route-utils.test.js +61 -66
  63. package/src/tests/channels/url-utils.test.js +151 -151
  64. package/src/tests/channels/view-stream-broadcaster.test.js +7 -7
  65. package/src/tests/import.test.js +5 -5
  66. package/src/tests/index.js +6 -7
  67. package/src/tests/index.test.js +6 -8
  68. package/src/tests/mocks/channel-payload-data.js +218 -220
  69. package/src/tests/mocks/enhancer.test.js +5 -5
  70. package/src/tests/mocks/payload-ui.js +87 -90
  71. package/src/tests/mocks/routes-data.js +264 -266
  72. package/src/tests/mocks/spyne-docs.mocks.js +3 -3
  73. package/src/tests/mocks/template-renderer.mocks.js +47 -47
  74. package/src/tests/mocks/utils-data.js +78 -79
  75. package/src/tests/mocks/viewstream-internal-payload.mocks.js +50 -50
  76. package/src/tests/mocks/window-events-arr.js +1 -1
  77. package/src/tests/package-json.spec.test.js +9 -0
  78. package/src/tests/spyne-app.test.js +15 -18
  79. package/src/tests/spyne-plugin.test.js +16 -20
  80. package/src/tests/utils/channel-action-filter.test.js +84 -86
  81. package/src/tests/utils/channel-data-packet-generator.unused.js +62 -86
  82. package/src/tests/utils/channel-fetch-util.test.js +64 -66
  83. package/src/tests/utils/frp-tools.test.js +19 -19
  84. package/src/tests/utils/plugins-methods.test.js +31 -55
  85. package/src/tests/utils/security.test.js +10 -0
  86. package/src/tests/utils/spyne-app-properties.test.js +4 -8
  87. package/src/tests/views/dom-el-selectors.test.js +112 -119
  88. package/src/tests/views/dom-el-template-proxy.test.js +7 -0
  89. package/src/tests/views/dom-el-template.test.js +186 -156
  90. package/src/tests/views/dom-el.test.js +58 -56
  91. package/src/tests/views/view-stream-enhancer-loader.test.js +2 -2
  92. package/src/tests/views/view-stream-enhancer.test.js +11 -11
  93. package/src/tests/views/view-stream.test.js +22 -33
  94. package/webpack.config.js +76 -67
  95. package/docs/-_%20Solves%20equations%20of%20the%20form%20a%20_%20x%20=%20b.html +0 -487
  96. package/docs/DomItem.html +0 -298
  97. package/docs/DomItem_DomItem.html +0 -314
  98. package/docs/ViewStream.html +0 -2249
  99. package/docs/ViewStream_ViewStream.html +0 -503
  100. package/docs/custom/css/jsdoc-viewstream.css +0 -377
  101. package/docs/custom/layout.tmpl +0 -47
  102. package/docs/dom-item.js.html +0 -213
  103. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  104. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  105. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  106. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  107. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  108. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  109. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  110. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  111. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  112. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  113. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  114. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  115. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  116. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  117. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  118. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  119. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  120. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  121. package/docs/global.html +0 -548
  122. package/docs/index-custom.html +0 -79
  123. package/docs/index.html +0 -82
  124. package/docs/jsdoc.config.json +0 -22
  125. package/docs/scripts/linenumber.js +0 -25
  126. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  127. package/docs/scripts/prettify/lang-css.js +0 -2
  128. package/docs/scripts/prettify/prettify.js +0 -28
  129. package/docs/styles/jsdoc-default.css +0 -358
  130. package/docs/styles/prettify-jsdoc.css +0 -111
  131. package/docs/styles/prettify-tomorrow.css +0 -132
  132. package/docs/view-stream.js.html +0 -767
package/webpack.config.js CHANGED
@@ -1,79 +1,88 @@
1
+ // webpack.config.js
1
2
  const path = require('path');
2
3
  const webpack = require('webpack');
3
- const PACKAGE = require('./package');
4
- const version = PACKAGE.version;
5
- const getEnv = ()=>{
6
- const npmCommand = process.env.npm_lifecycle_script;
7
- return String(npmCommand).replace(/^(webpack.*--env)(\s)*(\w+)(.*)$/gm, "$3");
8
- }
9
- const env = getEnv();
10
-
11
- const libraryName = 'spyne';
12
- let moduleRulesArr = [];
13
- let devToolValue = 'eval-source-map';
14
- let outputFile;
15
- let externalsArr =[];
4
+ const ESLintPlugin = require('eslint-webpack-plugin');
16
5
  const WebpackRxjsExternals = require('webpack-rxjs-externals');
17
- const loaderOptionsPlugin = new webpack.LoaderOptionsPlugin({ options: {
18
- test: /(\.js)$/,
19
- loader: 'eslint-loader',
20
- exclude: [/node_modules/,/(src\/tests)/],
21
- options: {
22
- fix: true
23
- }
24
- }
25
- });
26
-
27
- let bannerPlugin = new webpack.BannerPlugin({
28
- banner: `spynejs ${version}\nhttps://sypnejs.org\n(c) 2017-present Frank Batista`,
29
- entryOnly:true
30
- })
6
+ const pkg = require('./package.json');
31
7
 
32
-
33
-
34
- let spynePlugins = [loaderOptionsPlugin];
35
-
36
- if (env === 'build') {
37
- outputFile = libraryName + '.min.js';
38
- devToolValue = false;
39
- externalsArr = [
40
- WebpackRxjsExternals(),
41
- {ramda : {
42
- commonjs: 'ramda',
43
- commonjs2: 'ramda',
44
- amd: 'ramda',
45
- root: 'R'
46
- }}
47
- ];
48
- } else if(env === 'dev') {
49
- outputFile = libraryName + '.js';
8
+ // We'll define a base config to share options:
9
+ function baseConfig(mode) {
10
+ return {
11
+ mode,
12
+ devtool: mode === 'production' ? false : 'inline-source-map',
13
+ externals: [
14
+ WebpackRxjsExternals(),
15
+ {
16
+ ramda: {
17
+ commonjs: 'ramda',
18
+ commonjs2: 'ramda',
19
+ amd: 'ramda',
20
+ root: 'R'
21
+ }
22
+ }
23
+ ],
24
+ module: {
25
+ rules: [
26
+ // Add Babel or other loaders here if needed
27
+ // {
28
+ // test: /\.js$/,
29
+ // exclude: /node_modules/,
30
+ // use: 'babel-loader'
31
+ // }
32
+ ]
33
+ },
34
+ resolve: {
35
+ extensions: ['.js'],
36
+ modules: [path.resolve(__dirname, 'node_modules'), 'node_modules']
37
+ },
38
+ plugins: [
39
+ // Modern replacement for eslint-loader
40
+ new ESLintPlugin({
41
+ fix: true,
42
+ extensions: ['js'],
43
+ exclude: ['node_modules']
44
+ }),
45
+ new webpack.BannerPlugin({
46
+ banner: `spynejs ${pkg.version}\nhttps://spynejs.org\n(c) 2017-present Frank Batista`,
47
+ entryOnly: true
48
+ })
49
+ ]
50
+ };
50
51
  }
51
52
 
53
+ // ESM Build:
54
+ const esmConfig = {
55
+ ...baseConfig(process.env.NODE_ENV || 'development'),
52
56
 
53
- const config = {
54
- entry: path.join(__dirname, '/src/spyne/spyne.js'),
55
- devtool: false,
56
-
57
- externals: externalsArr,
57
+ entry: './src/spyne/spyne.js',
58
58
 
59
- module: {
60
- rules: moduleRulesArr
59
+ // Enable module output
60
+ experiments: {
61
+ outputModule: true
61
62
  },
62
- resolve: {
63
- modules: [path.resolve('./node_modules')],
64
- extensions: ['.json', '.js']
65
- },
66
- plugins: spynePlugins
63
+ output: {
64
+ path: path.resolve(__dirname, 'lib'),
65
+ filename: 'spyne.esm.js',
66
+ library: {
67
+ type: 'module'
68
+ }
69
+ }
67
70
  };
68
71
 
69
- if (env!==undefined){
70
- config['output'] = {
71
- path: path.join(__dirname, '/lib'),
72
- filename: outputFile,
73
- library: 'spyne',
74
- libraryTarget: 'umd',
75
- umdNamedDefine: true
76
- };
77
- }
72
+ // UMD Build:
73
+ const umdConfig = {
74
+ ...baseConfig(process.env.NODE_ENV || 'development'),
75
+
76
+ entry: './src/spyne/spyne.js',
77
+
78
+ output: {
79
+ path: path.resolve(__dirname, 'lib'),
80
+ filename: 'spyne.umd.js',
81
+ library: 'spyne',
82
+ libraryTarget: 'umd',
83
+ umdNamedDefine: true
84
+ }
85
+ };
78
86
 
79
- module.exports = config;
87
+ // Export both configs in an array
88
+ module.exports = [esmConfig, umdConfig];
@@ -1,487 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JSDoc: Class: * Solves equations of the form a * x = b</title>
6
-
7
- <script src="scripts/prettify/prettify.js"> </script>
8
- <script src="scripts/prettify/lang-css.js"> </script>
9
- <!--[if lt IE 9]>
10
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
- <![endif]-->
12
- <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
- <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
- </head>
15
-
16
- <body>
17
-
18
- <div id="main">
19
-
20
- <h1 class="page-title">Class: * Solves equations of the form a * x = b</h1>
21
-
22
-
23
-
24
-
25
-
26
-
27
- <section>
28
-
29
- <header>
30
-
31
- <h2>* Solves equations of the form a * x = b</h2>
32
-
33
-
34
- </header>
35
-
36
- <article>
37
- <div class="container-overview">
38
-
39
-
40
-
41
-
42
-
43
- <h4 class="name" id="* Solves equations of the form a * x = b"><span class="type-signature"></span>new * Solves equations of the form a * x = b<span class="signature">(options)</span><span class="type-signature"></span></h4>
44
-
45
-
46
-
47
-
48
-
49
- <div class="description">
50
- This is the main Class used to combine dom elments and to listen for stream events.<br><br>
51
-
52
- The ViewStream class attaches one dom element to one another by passing a reference to one anothers rxjs obxerver.<br><br>
53
-
54
- The ViewStream object can create a dom elment that is as simple as a &#60;p&gt; tag with text or as complex view based on a Mustache template
55
- and a json object
56
- </div>
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
- <h5>Parameters:</h5>
67
-
68
-
69
- <table class="params">
70
- <thead>
71
- <tr>
72
-
73
- <th>Name</th>
74
-
75
-
76
- <th>Type</th>
77
-
78
-
79
-
80
-
81
-
82
- <th class="last">Description</th>
83
- </tr>
84
- </thead>
85
-
86
- <tbody>
87
-
88
-
89
- <tr>
90
-
91
- <td class="name"><code>options</code></td>
92
-
93
-
94
- <td class="type">
95
-
96
-
97
- <span class="param-type">object</span>
98
-
99
-
100
-
101
- </td>
102
-
103
-
104
-
105
-
106
-
107
- <td class="description last">This json object initializes both the View and the RXJS Stream</td>
108
- </tr>
109
-
110
-
111
- </tbody>
112
- </table>
113
-
114
-
115
-
116
-
117
-
118
-
119
- <h5 class="subsection-title">Properties:</h5>
120
-
121
-
122
-
123
- <table class="props">
124
- <thead>
125
- <tr>
126
-
127
- <th>Name</th>
128
-
129
-
130
- <th>Type</th>
131
-
132
-
133
-
134
-
135
-
136
- <th class="last">Description</th>
137
- </tr>
138
- </thead>
139
-
140
- <tbody>
141
-
142
-
143
- <tr>
144
-
145
- <td class="name"><code>options.tagName</code></td>
146
-
147
-
148
- <td class="type">
149
-
150
-
151
- <span class="param-type">string</span>
152
-
153
-
154
-
155
- </td>
156
-
157
-
158
-
159
-
160
-
161
- <td class="description last">'div' This can take any dom tag</td>
162
- </tr>
163
-
164
-
165
-
166
- <tr>
167
-
168
- <td class="name"><code>options.el</code></td>
169
-
170
-
171
- <td class="type">
172
-
173
-
174
- <span class="param-type">domItem</span>
175
-
176
-
177
-
178
- </td>
179
-
180
-
181
-
182
-
183
-
184
- <td class="description last">undefined, connect this viewStream to an already existing item</td>
185
- </tr>
186
-
187
-
188
-
189
- <tr>
190
-
191
- <td class="name"><code>options.data</code></td>
192
-
193
-
194
- <td class="type">
195
-
196
-
197
- <span class="param-type">string</span>
198
- |
199
-
200
- <span class="param-type">object</span>
201
-
202
-
203
-
204
- </td>
205
-
206
-
207
-
208
-
209
-
210
- <td class="description last">undefined, // Text for the domEl or Object for Mustache</td>
211
- </tr>
212
-
213
-
214
-
215
- <tr>
216
-
217
- <td class="name"><code>options.animateIn</code></td>
218
-
219
-
220
- <td class="type">
221
-
222
-
223
- <span class="param-type">boolean</span>
224
-
225
-
226
-
227
- </td>
228
-
229
-
230
-
231
-
232
-
233
- <td class="description last">false, animates in View</td>
234
- </tr>
235
-
236
-
237
-
238
- <tr>
239
-
240
- <td class="name"><code>options.animateInTime</code></td>
241
-
242
-
243
- <td class="type">
244
-
245
-
246
- <span class="param-type">number</span>
247
-
248
-
249
-
250
- </td>
251
-
252
-
253
-
254
-
255
-
256
- <td class="description last">.5</td>
257
- </tr>
258
-
259
-
260
-
261
- <tr>
262
-
263
- <td class="name"><code>options.animateOut</code></td>
264
-
265
-
266
- <td class="type">
267
-
268
-
269
- <span class="param-type">boolean</span>
270
-
271
-
272
-
273
- </td>
274
-
275
-
276
-
277
-
278
-
279
- <td class="description last">false, animates in View</td>
280
- </tr>
281
-
282
-
283
-
284
- <tr>
285
-
286
- <td class="name"><code>options.animateOutTime</code></td>
287
-
288
-
289
- <td class="type">
290
-
291
-
292
- <span class="param-type">number</span>
293
-
294
-
295
-
296
- </td>
297
-
298
-
299
-
300
-
301
-
302
- <td class="description last">.5</td>
303
- </tr>
304
-
305
-
306
-
307
- <tr>
308
-
309
- <td class="name"><code>options.id</code></td>
310
-
311
-
312
- <td class="type">
313
-
314
-
315
- <span class="param-type">string</span>
316
-
317
-
318
-
319
- </td>
320
-
321
-
322
-
323
-
324
-
325
- <td class="description last">undefined, add a custom id for the dom element</td>
326
- </tr>
327
-
328
-
329
-
330
- <tr>
331
-
332
- <td class="name"><code>options.debug</code></td>
333
-
334
-
335
- <td class="type">
336
-
337
-
338
- <span class="param-type">boolean</span>
339
-
340
-
341
-
342
- </td>
343
-
344
-
345
-
346
-
347
-
348
- <td class="description last">false</td>
349
- </tr>
350
-
351
-
352
-
353
- <tr>
354
-
355
- <td class="name"><code>options.tmpl</code></td>
356
-
357
-
358
- <td class="type">
359
-
360
-
361
- <span class="param-type">Mustache</span>
362
-
363
-
364
-
365
- </td>
366
-
367
-
368
-
369
-
370
-
371
- <td class="description last">undefined, // Mustache template</td>
372
- </tr>
373
-
374
-
375
- </tbody>
376
- </table>
377
-
378
-
379
-
380
-
381
- <dl class="details">
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
- <dt class="tag-source">Source:</dt>
409
- <dd class="tag-source"><ul class="dummy"><li>
410
- <a href="view-stream.js.html">view-stream.js</a>, <a href="view-stream.js.html#line14">line 14</a>
411
- </li></ul></dd>
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
- </dl>
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
- <h5>Examples</h5>
436
-
437
- <pre class="prettyprint"><code>// returns 2
438
- globalNS.method1(5, 10);</code></pre>
439
-
440
- <pre class="prettyprint"><code>// returns 3
441
- globalNS.method(5, 15);</code></pre>
442
-
443
-
444
-
445
-
446
- </div>
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
-
464
-
465
- </article>
466
-
467
- </section>
468
-
469
-
470
-
471
-
472
- </div>
473
-
474
- <nav>
475
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="-_%2520Solves%2520equations%2520of%2520the%2520form%2520a%2520_%2520x%2520=%2520b.html">* Solves equations of the form a * x = b</a></li><li><a href="DomItem.html">DomItem</a></li></ul>
476
- </nav>
477
-
478
- <br class="clear">
479
-
480
- <footer>
481
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jun 12 2017 02:43:47 GMT-0400 (EDT)
482
- </footer>
483
-
484
- <script> prettyPrint(); </script>
485
- <script src="scripts/linenumber.js"> </script>
486
- </body>
487
- </html>