neo.mjs 6.39.0 → 6.40.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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.39.0'
23
+ * @member {String} version='6.40.0'
24
24
  */
25
- version: '6.39.0'
25
+ version: '6.40.0'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.39.0'
23
+ * @member {String} version='6.40.0'
24
24
  */
25
- version: '6.39.0'
25
+ version: '6.40.0'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "6.39.0",
3
+ "version": "6.40.0",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -2,7 +2,7 @@
2
2
  {"name": "Welcome!", "parentId": null, "isLeaf": true, "id": "Welcome" },
3
3
  {"name": "Benefits", "parentId": null, "isLeaf": false, "id": "WhyNeo"},
4
4
  {"name": "Introduction ", "parentId": "WhyNeo", "isLeaf": true, "id": "WhyNeo-Intro"},
5
- {"name": "Multi-Threading", "parentId": "WhyNeo", "isLeaf": true, "id": "benefits.MultiThreading"},
5
+ {"name": "Multi-Threading", "parentId": "WhyNeo", "isLeaf": true, "id": "benefits.Multi-Threading"},
6
6
  {"name": "Extreme Speed", "parentId": "WhyNeo", "isLeaf": true, "id": "WhyNeo-Speed"},
7
7
  {"name": "Multi-Window Applications", "parentId": "WhyNeo", "isLeaf": true, "id": "WhyNeo-Multi-Window"},
8
8
  {"name": "Quick Application Development", "parentId": "WhyNeo", "isLeaf": true, "id": "WhyNeo-Quick"},
@@ -95,6 +95,10 @@
95
95
  pointer-events: none;
96
96
  text-transform: var(--button-text-transform);
97
97
  z-index : 2;
98
+
99
+ @media (max-width: 600px) {
100
+ font-size: 13px;
101
+ }
98
102
  }
99
103
 
100
104
  &:active {
@@ -260,12 +260,12 @@ const DefaultConfig = {
260
260
  useVdomWorker: true,
261
261
  /**
262
262
  * buildScripts/injectPackageVersion.mjs will update this value
263
- * @default '6.39.0'
263
+ * @default '6.40.0'
264
264
  * @memberOf! module:Neo
265
265
  * @name config.version
266
266
  * @type String
267
267
  */
268
- version: '6.39.0'
268
+ version: '6.40.0'
269
269
  };
270
270
 
271
271
  Object.assign(DefaultConfig, {
@@ -23,6 +23,11 @@ class HighlightJS extends Base {
23
23
  * @protected
24
24
  */
25
25
  highlightJsLineNumbersPath: Neo.config.basePath + 'node_modules/highlightjs-line-numbers.js/dist/highlightjs-line-numbers.min.js',
26
+ /**
27
+ * @member {Boolean} libraryLoaded_=true
28
+ * @protected
29
+ */
30
+ libraryLoaded_: false,
26
31
  /**
27
32
  * Remote method access for other workers
28
33
  * @member {Object} remote
@@ -46,6 +51,43 @@ class HighlightJS extends Base {
46
51
  themePath: './resources/highlightjs-custom-github-theme.css'
47
52
  }
48
53
 
54
+ /**
55
+ * @member {Object[]} cache=[]
56
+ * @protected
57
+ */
58
+ cache = []
59
+
60
+ /**
61
+ * Triggered after the libraryLoaded config got changed
62
+ * @param {Boolean} value
63
+ * @param {Boolean} oldValue
64
+ * @protected
65
+ */
66
+ afterSetLibraryLoaded(value, oldValue) {
67
+ if (value) {
68
+ let me = this,
69
+ returnValue;
70
+
71
+ me.cache.forEach(item => {
72
+ returnValue = me[item.fn](item.data);
73
+ item.resolve(returnValue)
74
+ });
75
+
76
+ me.cache = []
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Internally caches call when the hljs namespace does not exist yet
82
+ * @param item
83
+ * @returns {Promise<unknown>}
84
+ */
85
+ cacheMethodCall(item) {
86
+ return new Promise((resolve, reject) => {
87
+ this.cache.push({...item, resolve})
88
+ })
89
+ }
90
+
49
91
  /**
50
92
  * See: https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto
51
93
  * @param {Object} data
@@ -53,10 +95,10 @@ class HighlightJS extends Base {
53
95
  * @returns {Object} of the form {language, relevance, value, secondBest}
54
96
  */
55
97
  highlightAuto(data) {
56
- if (hljs) {
98
+ if (window.hljs) {
57
99
  return hljs.highlightAuto(data.html)
58
100
  } else {
59
- console.error('highlight.js is not included inside the main thread.')
101
+ return this.cacheMethodCall({fn: 'highlightAuto', data})
60
102
  }
61
103
  }
62
104
 
@@ -77,6 +119,8 @@ class HighlightJS extends Base {
77
119
 
78
120
  Neo.main.addon.Stylesheet.createStyleSheet(null, 'hljs-theme', me.themePath);
79
121
 
122
+ this.libraryLoaded = true;
123
+
80
124
  return true
81
125
  }
82
126
 
@@ -118,13 +162,15 @@ class HighlightJS extends Base {
118
162
  * @param {String} data.vnodeId
119
163
  */
120
164
  syntaxHighlight(data) {
121
- if (hljs) {
165
+ if (window.hljs) {
122
166
  let node = document.getElementById(data.vnodeId);
123
167
 
124
- hljs.highlightBlock(node);
125
- hljs.lineNumbersBlock(node)
168
+ if (node) {
169
+ hljs.highlightBlock(node);
170
+ hljs.lineNumbersBlock(node)
171
+ }
126
172
  } else {
127
- console.error('highlight.js is not included inside the main thread.')
173
+ return this.cacheMethodCall({fn: 'syntaxHighlight', data})
128
174
  }
129
175
  }
130
176
 
@@ -132,11 +178,11 @@ class HighlightJS extends Base {
132
178
  * @param {Object} data
133
179
  */
134
180
  syntaxHighlightInit(data) {
135
- if (hljs) {
181
+ if (window.hljs) {
136
182
  let blocks = document.querySelectorAll('pre code:not(.hljs)');
137
183
  Array.prototype.forEach.call(blocks, hljs.highlightBlock)
138
184
  } else {
139
- console.error('highlight.js is not included inside the main thread.')
185
+ return this.cacheMethodCall({fn: 'syntaxHighlightInit', data})
140
186
  }
141
187
  }
142
188
 
@@ -147,6 +193,10 @@ class HighlightJS extends Base {
147
193
  * @param {Number} data.removeLine
148
194
  */
149
195
  syntaxHighlightLine(data) {
196
+ if (!window.hljs) {
197
+ return this.cacheMethodCall({fn: 'syntaxHighlightLine', data})
198
+ }
199
+
150
200
  let parentEl = document.getElementById(data.vnodeId),
151
201
  cls = 'neo-highlighted-line',
152
202
  el;