spyne 0.21.2 → 0.22.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Spyne 0.21.2
2
+ * Spyne 0.22.2
3
3
  * https://spynejs.org
4
4
  *
5
5
  * @license
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  /*!
18
- * spynejs 0.21.2
18
+ * spynejs 0.22.2
19
19
  * https://spynejs.org
20
20
  * (c) 2017-present Frank Batista
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spyne",
3
- "version": "0.21.2",
3
+ "version": "0.22.2",
4
4
  "description": "Reactive Real-DOM Framework for Advanced Javascript applications",
5
5
  "sideEffects": true,
6
6
  "main": "./lib/spyne.esm.js",
@@ -18,7 +18,6 @@
18
18
  "eslint-fix-tests": "eslint --fix 'src/tests/**'",
19
19
  "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
20
20
  "commit": "git-cz",
21
- "start": "webpack-dev-server --hot",
22
21
  "build": "webpack --config webpack.config.js --mode production",
23
22
  "build:esm": "rollup --config rollup.config.js",
24
23
  "dev": "webpack --config webpack.config.js --mode development",
@@ -52,6 +51,7 @@
52
51
  "@rollup/plugin-json": "^6.1.0",
53
52
  "@rollup/plugin-node-resolve": "^16.0.0",
54
53
  "@rollup/plugin-replace": "^6.0.2",
54
+ "@rollup/plugin-terser": "^1.0.0",
55
55
  "chai": "^4.3.9",
56
56
  "chai-dom": "^1.11.0",
57
57
  "clean-webpack-plugin": "^4.0.0",
@@ -72,19 +72,22 @@
72
72
  "karma-mocha": "^2.0.1",
73
73
  "karma-rollup-preprocessor": "^7.0.8",
74
74
  "karma-webpack": "^5.0.1",
75
- "mocha": "^10.7.3",
75
+ "mocha": "^11.7.5",
76
76
  "rollup": "^2.79.2",
77
- "rollup-plugin-terser": "^7.0.2",
78
77
  "webpack": "^5.94.0",
79
78
  "webpack-cli": "^5.1.4",
80
- "webpack-dev-middleware": "^7.4.2",
81
- "webpack-dev-server": "^5.1.0",
82
79
  "webpack-rxjs-externals": "^2.0.0"
83
80
  },
81
+ "overrides": {
82
+ "mocha": {
83
+ "serialize-javascript": "^7.0.4",
84
+ "diff": "^8.0.2"
85
+ }
86
+ },
84
87
  "config": {},
85
88
  "dependencies": {
86
89
  "dompurify": "^3.1.6",
87
- "ramda": "^0.30.1",
90
+ "ramda": "^0.32.0",
88
91
  "rxjs": "^7.8.1"
89
92
  }
90
93
  }
package/rollup.config.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import resolve from '@rollup/plugin-node-resolve';
3
3
  import commonjs from '@rollup/plugin-commonjs';
4
4
  import json from '@rollup/plugin-json';
5
- import { terser } from 'rollup-plugin-terser';
5
+ import terser from '@rollup/plugin-terser';
6
6
 
7
7
  export default {
8
8
  input: 'src/spyne/spyne.js', // Your main entry (the "barrel")
@@ -2,6 +2,7 @@ import { SpyneChannelRoute } from './spyne-channel-route.js'
2
2
  import { SpyneChannelUI } from './spyne-channel-ui.js'
3
3
  import { SpyneChannelWindow } from './spyne-channel-window.js'
4
4
  import { SpyneChannelLifecycle } from './spyne-channel-lifecycle.js'
5
+ import { SpyneChannelAI } from './spyne-channel-ai.js'
5
6
 
6
7
  import { Subject } from 'rxjs'
7
8
  import { ChannelProxy } from './channel-proxy.js'
@@ -84,6 +85,9 @@ export class ChannelsMap {
84
85
  this.viewStreamLifecycle = new SpyneChannelLifecycle()
85
86
  _map.set('CHANNEL_LIFECYCLE', this.viewStreamLifecycle)
86
87
 
88
+ this.aiStream = new SpyneChannelAI()
89
+ _map.set('CHANNEL_AI', this.aiStream)
90
+
87
91
  this.routeStream.initializeStream()
88
92
  this.domStream.initializeStream()
89
93
  }
@@ -0,0 +1,45 @@
1
+ import { Channel } from './channel.js'
2
+
3
+ export class SpyneChannelAI extends Channel {
4
+ /**
5
+ * @module SpyneChannelAI
6
+ * @type core
7
+ *
8
+ * @desc
9
+ * Internal Channel that publishes rendering and disposing events of all ViewStreams whose property, proper.sendAIEvents is set to true.
10
+ *
11
+ * <h3>The two actions that are regsitered for this channel are:</h3>
12
+ * <ul>
13
+ * <li>CHANNEL_AI_RENDERED_EVENT</li>
14
+ * <li>CHANNEL_AI_DISPOSED_EVENT</li>
15
+ * </ul>
16
+ * @constructor
17
+ * @property {String} CHANNEL_NAME - = 'CHANNEL_AI';
18
+ */
19
+
20
+ constructor(props = {}) {
21
+ super('CHANNEL_AI', props)
22
+ }
23
+
24
+ addRegisteredActions() {
25
+ return [
26
+ 'CHANNEL_AI_RENDERED_EVENT',
27
+ 'CHANNEL_AI_DISPOSED_EVENT'
28
+ ]
29
+ }
30
+
31
+ onViewStreamInfo(obj) {
32
+ const { action, srcElement } = obj
33
+ const payload = srcElement
34
+ payload.action = action
35
+ this.onSendEvent(action, payload)
36
+ }
37
+
38
+ onSendEvent(actionStr, payload = {}) {
39
+ const action = this.channelActions[actionStr]
40
+ const srcElement = {}
41
+ const event = undefined
42
+ const delayStream = () => this.sendChannelPayload(action, payload, srcElement, event)
43
+ window.setTimeout(delayStream, 0)
44
+ }
45
+ }
@@ -247,7 +247,7 @@ export class SpyneChannelRoute extends Channel {
247
247
  // define an alias property using Object.defineProperty
248
248
  Object.defineProperty(payload, 'linksData', {
249
249
  get() {
250
- console.warn('get links data is deprecated in ROUTE DEEPLINK DATA, use navLinks')
250
+ // console.warn('get links data is deprecated in ROUTE DEEPLINK DATA, use navLinks')
251
251
  return this.navLinks
252
252
  },
253
253
  set(value) {
@@ -6,7 +6,7 @@ import { sanitizeHTMLConfigure } from './utils/sanitize-html.js'
6
6
  import { sanitizeDataConfigure } from './utils/sanitize-data.js'
7
7
 
8
8
  const _channels = new ChannelsMap()
9
- const version = '0.21.2'
9
+ const version = '0.22.2'
10
10
 
11
11
  class SpyneApplication {
12
12
  /**
@@ -41,7 +41,7 @@ class SpyneApplication {
41
41
  init(config = {}, testMode = false) {
42
42
  // this.channels = new ChannelsMap();
43
43
  /*!
44
- * Spyne 0.21.2
44
+ * Spyne 0.22.2
45
45
  * https://spynejs.org
46
46
  *
47
47
  * @license
@@ -233,7 +233,7 @@ export class ChannelPayloadFilter {
233
233
  // LOOP THROUGH NODES IN querySelectorAll()
234
234
  const mapNodeArrWithEl = (sel) => {
235
235
  // convert nodelist to array of els
236
- const nodeArr = flatten(document.querySelectorAll(sel))
236
+ const nodeArr = Array.from(document.querySelectorAll(sel))
237
237
  // els array to boolean array
238
238
  return rMap(compareEls, nodeArr)
239
239
  }
@@ -11,7 +11,7 @@ let forceStrict = false // legacy compatibility toggle
11
11
  * ------------------------------------------- */
12
12
  const SAFE_FOR_RICH_TEXT = {
13
13
  ALLOWED_TAGS: [
14
- 'a', 'b', 'i', 'em', 'strong', 'u', 'p', 'br', 'ul', 'ol', 'li',
14
+ 'a', 'b', 'i', 'em', 'strong', 'u', 'p', 'br', 'ul', 'dl', 'dt', 'dd', 'ol', 'li', 'hr',
15
15
  'blockquote', 'pre', 'code', 'span', 'div', 'section', 'article', 'aside',
16
16
  'header', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
17
17
  'table', 'thead', 'tbody', 'tr', 'td', 'th', 'img', 'figure', 'figcaption',
@@ -24,7 +24,7 @@ const SAFE_FOR_RICH_TEXT = {
24
24
  ],
25
25
  ALLOW_DATA_ATTR: true,
26
26
  FORBID_ATTR: ['onerror', 'onload', 'onclick', 'onmouseover', 'onfocus', 'onblur', 'onchange'],
27
- FORBID_TAGS: ['script', 'object', 'embed', 'meta', 'link'],
27
+ FORBID_TAGS: ['script', 'object', 'embed', 'meta'],
28
28
  SAFE_URL_PATTERN: /^(https?:|mailto:|tel:|data:image\/)/i
29
29
  }
30
30
 
@@ -1,4 +1,5 @@
1
1
  import { SpyneUtilsChannelRoute } from './spyne-utils-channel-route.js'
2
+ import { SpyneUtilsChannelRouteUrl } from './spyne-utils-channel-route-url.js'
2
3
  import { SpynePluginsMethods } from './spyne-plugins-methods.js'
3
4
  import { deepMerge } from './deep-merge.js'
4
5
 
@@ -272,6 +273,12 @@ class SpyneAppPropertiesClass {
272
273
  return _enableCMSProxies
273
274
  }
274
275
 
276
+ getHrefFromData(routeProps={}){
277
+
278
+ return SpyneUtilsChannelRouteUrl.convertParamsToRoute(routeProps);
279
+
280
+ }
281
+
275
282
  set enableCMSProxies(bool=true){
276
283
  _enableCMSProxies = Boolean(bool);
277
284
  }