neo.mjs 6.9.8 → 6.9.9
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/learnneo/index.html +5 -0
- package/apps/learnneo/view/home/ContentTreeList.mjs +14 -3
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +2 -2
- package/resources/scss/src/apps/learnneo/Viewport.scss +45 -2
- package/src/DefaultConfig.mjs +2 -2
- package/src/form/field/Text.mjs +32 -4
- package/src/main/addon/HighlightJS.mjs +0 -12
- package/src/util/String.mjs +5 -3
- package/resources/data/learnneo/content.json +0 -27
package/apps/ServiceWorker.mjs
CHANGED
package/apps/learnneo/index.html
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
<!DOCTYPE HTML>
|
2
2
|
<html>
|
3
|
+
|
3
4
|
<head>
|
4
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
6
|
<meta charset="UTF-8">
|
6
7
|
<title>LearnNeo</title>
|
8
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans|Inconsolata">
|
9
|
+
</link>
|
7
10
|
</head>
|
11
|
+
|
8
12
|
<body>
|
9
13
|
<script src="../../src/MicroLoader.mjs" type="module"></script>
|
10
14
|
</body>
|
15
|
+
|
11
16
|
</html>
|
@@ -15,7 +15,9 @@ class ContentTreeList extends TreeList {
|
|
15
15
|
/**
|
16
16
|
* @member {Neo.data.Store} store=ContentStore
|
17
17
|
*/
|
18
|
-
store: ContentStore
|
18
|
+
store: ContentStore,
|
19
|
+
|
20
|
+
cls: 'topics-tree'
|
19
21
|
}
|
20
22
|
|
21
23
|
/**
|
@@ -33,9 +35,11 @@ class ContentTreeList extends TreeList {
|
|
33
35
|
console.log(search);
|
34
36
|
});
|
35
37
|
}
|
38
|
+
|
36
39
|
get contentPath() {
|
37
40
|
return `../../../resources/data/${this.deck}`;
|
38
41
|
}
|
42
|
+
|
39
43
|
doLoadStore() {
|
40
44
|
const me = this;
|
41
45
|
Neo.Xhr.promiseJson({
|
@@ -48,18 +52,25 @@ class ContentTreeList extends TreeList {
|
|
48
52
|
})
|
49
53
|
}
|
50
54
|
|
55
|
+
onLeafItemClick(record) {
|
56
|
+
super.onLeafItemClick(record);
|
57
|
+
this.doFetchContent(record);
|
58
|
+
}
|
59
|
+
|
51
60
|
async doFetchContent(record) {
|
52
|
-
let me
|
61
|
+
let me = this,
|
53
62
|
path = `${me.contentPath}`;
|
63
|
+
|
54
64
|
path += record.path ? `/pages/${record.path}` : `/p/${record.id}.md`;
|
55
65
|
|
56
66
|
if (record.isLeaf && path) {
|
57
67
|
const data = await fetch(path);
|
58
68
|
const content = await data.text();
|
69
|
+
|
59
70
|
await Neo.main.addon.Markdown.markdownToHtml(content)
|
60
71
|
.then(
|
61
72
|
html => me.fire('contentChange', {component: me, html}),
|
62
|
-
()
|
73
|
+
() => me.fire('contentChange', {component: me}));
|
63
74
|
}
|
64
75
|
}
|
65
76
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "6.9.
|
3
|
+
"version": "6.9.9",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"clean-webpack-plugin": "^4.0.0",
|
50
50
|
"commander": "^11.1.0",
|
51
51
|
"cssnano": "^6.0.1",
|
52
|
-
"envinfo": "^7.
|
52
|
+
"envinfo": "^7.11.0",
|
53
53
|
"fs-extra": "^11.1.1",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
55
|
"inquirer": "^9.2.11",
|
@@ -1,8 +1,9 @@
|
|
1
1
|
.learn-content {
|
2
|
-
|
3
2
|
font-size: 13pt;
|
4
3
|
letter-spacing: 1px;
|
5
4
|
|
5
|
+
font-family: 'Open Sans';
|
6
|
+
|
6
7
|
em,
|
7
8
|
i {
|
8
9
|
font-family: Palatino, "Times New Roman", serif;
|
@@ -10,7 +11,7 @@
|
|
10
11
|
}
|
11
12
|
|
12
13
|
p {
|
13
|
-
margin: 0.5em 0em 0.7em 0em
|
14
|
+
margin: 0.5em 0em 0.7em 0em;
|
14
15
|
}
|
15
16
|
|
16
17
|
mark {
|
@@ -60,4 +61,46 @@
|
|
60
61
|
summary::-webkit-details-marker {
|
61
62
|
display: none;
|
62
63
|
}
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
.topics-tree {
|
68
|
+
&.neo-tree-list {
|
69
|
+
|
70
|
+
.neo-treelist-collapse-all-icon {
|
71
|
+
.neo-treelist-menu-item-content:before {
|
72
|
+
content: "\f102" !important;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
.neo-treelist-expand-all-icon {
|
77
|
+
.neo-treelist-menu-item-content:before {
|
78
|
+
content: "\f103" !important;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
.neo-list-container {
|
83
|
+
.neo-list-item {
|
84
|
+
&.neo-list-item-leaf {
|
85
|
+
.neo-list-item-content:before {
|
86
|
+
content: none !important;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
&.neo-list-folder {
|
91
|
+
.neo-list-item-content:before {
|
92
|
+
content: "\f107" !important;
|
93
|
+
}
|
94
|
+
|
95
|
+
&.neo-folder-open {
|
96
|
+
.neo-list-item-content:before {
|
97
|
+
content: "\f106" !important;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
}
|
105
|
+
|
63
106
|
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '6.9.
|
239
|
+
* @default '6.9.9'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '6.9.
|
244
|
+
version: '6.9.9'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/form/field/Text.mjs
CHANGED
@@ -2,6 +2,7 @@ import Base from './Base.mjs';
|
|
2
2
|
import BaseTrigger from './trigger/Base.mjs';
|
3
3
|
import ClearTrigger from './trigger/Clear.mjs';
|
4
4
|
import NeoArray from '../../util/Array.mjs';
|
5
|
+
import StringUtil from '../../util/String.mjs';
|
5
6
|
import VDomUtil from '../../util/VDom.mjs';
|
6
7
|
import VNodeUtil from '../../util/VNode.mjs';
|
7
8
|
|
@@ -234,6 +235,14 @@ class Text extends Base {
|
|
234
235
|
* @member {Function|String|null} validator=null
|
235
236
|
*/
|
236
237
|
validator: null,
|
238
|
+
/**
|
239
|
+
* getVlue can be xssProtected and values are escaped
|
240
|
+
* @member {Boolean} xssProtected=false
|
241
|
+
*/
|
242
|
+
xssProtected_: false,
|
243
|
+
/**
|
244
|
+
* @member {Object} _vdom
|
245
|
+
*/
|
237
246
|
/**
|
238
247
|
* @member {Object} _vdom
|
239
248
|
*/
|
@@ -1144,6 +1153,17 @@ class Text extends Base {
|
|
1144
1153
|
return this.id + '-trigger-' + type
|
1145
1154
|
}
|
1146
1155
|
|
1156
|
+
/**
|
1157
|
+
* @returns {*}
|
1158
|
+
*/
|
1159
|
+
getValue() {
|
1160
|
+
if (this.xssProtected) {
|
1161
|
+
return StringUtil.escapeHtml(super.getValue())
|
1162
|
+
} else {
|
1163
|
+
return super.getValue()
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
|
1147
1167
|
/**
|
1148
1168
|
* @returns {Boolean}
|
1149
1169
|
*/
|
@@ -1269,10 +1289,14 @@ class Text extends Base {
|
|
1269
1289
|
if (centerBorderEl && me.isEmpty()) {
|
1270
1290
|
delete centerBorderEl.width;
|
1271
1291
|
}
|
1292
|
+
}
|
1272
1293
|
|
1273
|
-
|
1294
|
+
if (Neo.isString(me.value)) {
|
1295
|
+
me.value = me.value.trim()
|
1274
1296
|
}
|
1275
1297
|
|
1298
|
+
me.update();
|
1299
|
+
|
1276
1300
|
super.onFocusLeave(data)
|
1277
1301
|
}
|
1278
1302
|
|
@@ -1283,12 +1307,16 @@ class Text extends Base {
|
|
1283
1307
|
onInputValueChange(data) {
|
1284
1308
|
let me = this,
|
1285
1309
|
oldValue = me.value,
|
1286
|
-
value = data.value
|
1310
|
+
value = data.value,
|
1287
1311
|
vnode = VNodeUtil.findChildVnode(me.vnode, {nodeName: 'input'});
|
1288
1312
|
|
1289
1313
|
if (vnode) {
|
1290
1314
|
// required for validation -> revert a wrong user input
|
1291
|
-
vnode.vnode.attributes.value = value
|
1315
|
+
vnode.vnode.attributes.value = value
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
if (Neo.isString(value)) {
|
1319
|
+
value = value.trim()
|
1292
1320
|
}
|
1293
1321
|
|
1294
1322
|
me.clean = false;
|
@@ -1482,7 +1510,7 @@ class Text extends Base {
|
|
1482
1510
|
minLength = me.minLength,
|
1483
1511
|
required = me.required,
|
1484
1512
|
returnValue = true,
|
1485
|
-
value = me.value
|
1513
|
+
value = me.value,
|
1486
1514
|
valueLength = value?.toString().length,
|
1487
1515
|
inputPattern = me.inputPattern,
|
1488
1516
|
isEmpty = value !== 0 && (!value || valueLength < 1),
|
@@ -96,18 +96,6 @@ class HighlightJS extends Base {
|
|
96
96
|
})
|
97
97
|
}
|
98
98
|
|
99
|
-
/**
|
100
|
-
* @param {Object} data
|
101
|
-
* @returns {Boolean}
|
102
|
-
*/
|
103
|
-
setConfigs(data) {
|
104
|
-
delete data.appName;
|
105
|
-
|
106
|
-
this.set(data);
|
107
|
-
|
108
|
-
return true
|
109
|
-
}
|
110
|
-
|
111
99
|
/**
|
112
100
|
* You can pass in 'light', 'dark', or a path for a custom theme
|
113
101
|
* @param {String} theme
|
package/src/util/String.mjs
CHANGED
@@ -14,18 +14,20 @@ class StringUtil extends Base {
|
|
14
14
|
'<' : '<',
|
15
15
|
'>' : '>',
|
16
16
|
'"' : '"',
|
17
|
-
'\'': '
|
17
|
+
'\'': ''',
|
18
|
+
'$' : '$',
|
19
|
+
'\\': '\'
|
18
20
|
}
|
19
21
|
/**
|
20
22
|
* @member {RegExp} charPattern
|
21
23
|
* @static
|
22
24
|
*/
|
23
|
-
static charPattern = /[&<>"']/g
|
25
|
+
static charPattern = /[&<>"'$\\]/g
|
24
26
|
/**
|
25
27
|
* @member {RegExp} entityPattern
|
26
28
|
* @static
|
27
29
|
*/
|
28
|
-
static entityPattern = /(&)|(<)|(>)|(")|(
|
30
|
+
static entityPattern = /(&)|(<)|(>)|(")|(')|($)|(\)/g
|
29
31
|
|
30
32
|
static config = {
|
31
33
|
/**
|
@@ -1,27 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"data": [{
|
3
|
-
"id" : 1,
|
4
|
-
"isLeaf" : true,
|
5
|
-
"name" : "Why neo.mjs",
|
6
|
-
"parentId": null,
|
7
|
-
"path" : "whyneo.md"
|
8
|
-
}, {
|
9
|
-
"id" : 2,
|
10
|
-
"isLeaf" : false,
|
11
|
-
"name" : "Class Definitions and Config",
|
12
|
-
"parentId": null,
|
13
|
-
"path" : null
|
14
|
-
}, {
|
15
|
-
"id" : 3,
|
16
|
-
"isLeaf" : false,
|
17
|
-
"name" : "Class Basics",
|
18
|
-
"parentId": 2,
|
19
|
-
"path" : null
|
20
|
-
}, {
|
21
|
-
"id" : 4,
|
22
|
-
"isLeaf" : true,
|
23
|
-
"name" : "Classes, Properties, and Methods",
|
24
|
-
"parentId": 3,
|
25
|
-
"path" : null
|
26
|
-
}]
|
27
|
-
}
|