neo.mjs 6.39.0 → 6.41.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.
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/view/learn/ContentView.mjs +5 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/data/deck/learnneo/pages/benefits/FormsEngine.md +10 -20
- package/resources/data/deck/learnneo/tree.json +1 -1
- package/resources/scss/src/button/Base.scss +4 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/main/DomEvents.mjs +13 -7
- package/src/main/addon/HighlightJS.mjs +58 -8
- /package/resources/data/deck/learnneo/pages/benefits/{MultiThreading.md → Multi-Threading.md} +0 -0
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
@@ -202,34 +202,24 @@ class MainView extends FormContainer {
|
|
202
202
|
}]
|
203
203
|
}
|
204
204
|
|
205
|
-
async
|
206
|
-
const formValues = await
|
205
|
+
async getFormValues(form) {
|
206
|
+
const formValues = await form.getValues();
|
207
207
|
Neo.Main.log({value: formValues});
|
208
208
|
|
209
|
-
const isValid = await
|
210
|
-
Neo.Main.log({value: `isValid: ${isValid}`})
|
209
|
+
const isValid = await form.validate();
|
210
|
+
Neo.Main.log({value: `isValid: ${isValid}`})
|
211
211
|
}
|
212
212
|
|
213
|
-
async
|
214
|
-
|
215
|
-
|
216
|
-
formValues = await form.getValues();
|
217
|
-
|
218
|
-
Neo.Main.log({value: formValues});
|
213
|
+
async getMainFormValues(data) {
|
214
|
+
await this.getFormValues(this)
|
215
|
+
}
|
219
216
|
|
220
|
-
|
221
|
-
|
217
|
+
async getProductFormValues(data) {
|
218
|
+
await this.getFormValues(this.getReference('product-form'))
|
222
219
|
}
|
223
220
|
|
224
221
|
async getUserFormValues(data) {
|
225
|
-
|
226
|
-
form = this.getReference('user-form'),
|
227
|
-
formValues = await form.getValues();
|
228
|
-
|
229
|
-
Neo.Main.log({value: formValues});
|
230
|
-
|
231
|
-
const isValid = await form.validate();
|
232
|
-
Neo.Main.log({value: `isValid: ${isValid}`});
|
222
|
+
await this.getFormValues(this.getReference('user-form'))
|
233
223
|
}
|
234
224
|
}
|
235
225
|
Neo.setupClass(MainView);
|
@@ -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": "
|
5
|
+
{"name": "Off the Main Thread", "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"},
|
package/src/DefaultConfig.mjs
CHANGED
@@ -260,12 +260,12 @@ const DefaultConfig = {
|
|
260
260
|
useVdomWorker: true,
|
261
261
|
/**
|
262
262
|
* buildScripts/injectPackageVersion.mjs will update this value
|
263
|
-
* @default '6.
|
263
|
+
* @default '6.41.0'
|
264
264
|
* @memberOf! module:Neo
|
265
265
|
* @name config.version
|
266
266
|
* @type String
|
267
267
|
*/
|
268
|
-
version: '6.
|
268
|
+
version: '6.41.0'
|
269
269
|
};
|
270
270
|
|
271
271
|
Object.assign(DefaultConfig, {
|
package/src/main/DomEvents.mjs
CHANGED
@@ -542,17 +542,19 @@ class DomEvents extends Base {
|
|
542
542
|
onKeyDown(event) {
|
543
543
|
let {target} = event,
|
544
544
|
{tagName} = target,
|
545
|
-
isInput
|
545
|
+
isInput = tagName === 'INPUT' || tagName === 'TEXTAREA';
|
546
546
|
|
547
547
|
if (isInput && disabledInputKeys[target.id]?.includes(event.key)) {
|
548
548
|
event.preventDefault()
|
549
549
|
} else {
|
550
550
|
this.sendMessageToApp(this.getKeyboardEventData(event));
|
551
551
|
|
552
|
-
if (
|
553
|
-
|
554
|
-
|
555
|
-
|
552
|
+
if (
|
553
|
+
!isInput &&
|
554
|
+
['ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowUp'].includes(event.key) &&
|
555
|
+
this.testPathInclusion(event, ['neo-selection'], true)
|
556
|
+
) {
|
557
|
+
event.preventDefault()
|
556
558
|
}
|
557
559
|
}
|
558
560
|
}
|
@@ -832,9 +834,10 @@ event.preventDefault();
|
|
832
834
|
/**
|
833
835
|
* @param {Object} event
|
834
836
|
* @param {Object} targetArray
|
837
|
+
* @param {Object} testSubstring=false
|
835
838
|
* @returns {Object|Boolean} target cls & node if found, false otherwise
|
836
839
|
*/
|
837
|
-
testPathInclusion(event, targetArray) {
|
840
|
+
testPathInclusion(event, targetArray, testSubstring=false) {
|
838
841
|
let countTargets = targetArray.length,
|
839
842
|
path = event.path || event.composedPath(),
|
840
843
|
i = 0,
|
@@ -845,7 +848,10 @@ event.preventDefault();
|
|
845
848
|
node = path[i];
|
846
849
|
|
847
850
|
for (j = 0; j < countTargets; j++) {
|
848
|
-
if (
|
851
|
+
if (
|
852
|
+
testSubstring && node.classList?.value?.includes(targetArray[j]) ||
|
853
|
+
node.classList?.contains(targetArray[j])
|
854
|
+
) {
|
849
855
|
return {cls: targetArray[j], node}
|
850
856
|
}
|
851
857
|
}
|
@@ -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
|
-
|
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
|
-
|
125
|
-
|
168
|
+
if (node) {
|
169
|
+
hljs.highlightBlock(node);
|
170
|
+
hljs.lineNumbersBlock(node)
|
171
|
+
}
|
126
172
|
} else {
|
127
|
-
|
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
|
-
|
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;
|
/package/resources/data/deck/learnneo/pages/benefits/{MultiThreading.md → Multi-Threading.md}
RENAMED
File without changes
|