neo.mjs 6.33.0 → 6.35.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/blog/List.mjs +38 -12
- package/apps/portal/view/home/MainContainer.mjs +10 -3
- package/apps/portal/view/home/parts/AfterMath.mjs +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +2 -2
- package/resources/scss/src/apps/portal/Viewport.scss +10 -0
- package/resources/scss/src/apps/portal/home/FooterContainer.scss +19 -2
- package/resources/scss/src/apps/portal/home/MainContainer.scss +6 -1
- package/resources/scss/src/apps/portal/home/parts/AfterMath.scss +2 -0
- package/resources/scss/src/apps/portal/home/parts/BaseContainer.scss +6 -3
- package/resources/scss/src/apps/portal/home/parts/Features.scss +5 -0
- package/resources/scss/src/apps/portal/home/parts/Helix.scss +6 -0
- package/resources/scss/src/apps/portal/home/parts/How.scss +14 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +2 -2
- package/src/main/addon/IntersectionObserver.mjs +19 -3
package/apps/ServiceWorker.mjs
CHANGED
@@ -25,6 +25,12 @@ class List extends BaseList {
|
|
25
25
|
* @member {String[]} baseCls=['portal-blog-list','neo-list']
|
26
26
|
*/
|
27
27
|
baseCls: ['portal-blog-list', 'neo-list'],
|
28
|
+
/**
|
29
|
+
* Specify the amount of delayed observe() calls, in case the IntersectionObserver does not find targets.
|
30
|
+
* This can happen when moving the component inside the DOM (e.g. cube layout)
|
31
|
+
* @member {Number} intersectionObserverReconnects=5
|
32
|
+
*/
|
33
|
+
intersectionObserverReconnects: 5,
|
28
34
|
/**
|
29
35
|
* Specify how many blog item images to preload when intersecting
|
30
36
|
* @member {Number} preloadImages=5
|
@@ -88,18 +94,7 @@ class List extends BaseList {
|
|
88
94
|
*/
|
89
95
|
afterSetMounted(value, oldValue) {
|
90
96
|
super.afterSetMounted(value, oldValue);
|
91
|
-
|
92
|
-
let me = this;
|
93
|
-
|
94
|
-
value && me.timeout(50).then(() => {
|
95
|
-
Neo.main.addon.IntersectionObserver.register({
|
96
|
-
callback: 'isVisible',
|
97
|
-
id : me.id,
|
98
|
-
observe : ['.content'],
|
99
|
-
root : `#${me.parentId}`,
|
100
|
-
windowId: me.windowId
|
101
|
-
})
|
102
|
-
})
|
97
|
+
value && this.registerIntersectionObserver()
|
103
98
|
}
|
104
99
|
|
105
100
|
/**
|
@@ -243,6 +238,37 @@ class List extends BaseList {
|
|
243
238
|
|
244
239
|
needsUpdate && me.update()
|
245
240
|
}
|
241
|
+
|
242
|
+
/**
|
243
|
+
*
|
244
|
+
*/
|
245
|
+
async registerIntersectionObserver() {
|
246
|
+
let me = this,
|
247
|
+
opts = {id: me.id, observe: ['.content'], windowId: me.windowId},
|
248
|
+
i = 0,
|
249
|
+
len = me.intersectionObserverReconnects,
|
250
|
+
data;
|
251
|
+
|
252
|
+
await me.timeout(50);
|
253
|
+
|
254
|
+
data = await Neo.main.addon.IntersectionObserver.register({
|
255
|
+
...opts,
|
256
|
+
callback: 'isVisible',
|
257
|
+
root : `#${me.parentId}`
|
258
|
+
});
|
259
|
+
|
260
|
+
if (data.countTargets < 1) {
|
261
|
+
for (; i < len; i++) {
|
262
|
+
await me.timeout(100);
|
263
|
+
|
264
|
+
data = await Neo.main.addon.IntersectionObserver.observe(opts);
|
265
|
+
|
266
|
+
if (data.countTargets > 0) {
|
267
|
+
break
|
268
|
+
}
|
269
|
+
}
|
270
|
+
}
|
271
|
+
}
|
246
272
|
}
|
247
273
|
|
248
274
|
Neo.setupClass(List);
|
@@ -28,8 +28,9 @@ class MainContainer extends Container {
|
|
28
28
|
*/
|
29
29
|
domListeners: [{
|
30
30
|
intersect(data) {
|
31
|
-
|
32
|
-
|
31
|
+
let id = data.path[1].id;
|
32
|
+
this.activePartsId = id;
|
33
|
+
Neo.getComponent(id)?.activate?.()
|
33
34
|
},
|
34
35
|
scroll(event) {
|
35
36
|
if (event.target.cls.includes('portal-home-maincontainer')) {
|
@@ -37,6 +38,12 @@ class MainContainer extends Container {
|
|
37
38
|
}
|
38
39
|
}
|
39
40
|
}],
|
41
|
+
/**
|
42
|
+
* @member {Object} itemDefaults
|
43
|
+
*/
|
44
|
+
itemDefaults: {
|
45
|
+
flex: 'none'
|
46
|
+
},
|
40
47
|
/**
|
41
48
|
* @member {Object[]} items
|
42
49
|
*/
|
@@ -78,7 +85,7 @@ class MainContainer extends Container {
|
|
78
85
|
Neo.main.addon.IntersectionObserver.register({
|
79
86
|
callback : 'isVisible',
|
80
87
|
id,
|
81
|
-
observe : ['.portal-
|
88
|
+
observe : ['.portal-content-wrapper'],
|
82
89
|
root : `#${id}`,
|
83
90
|
threshold: 1.0,
|
84
91
|
windowId
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.35.0",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -53,7 +53,7 @@
|
|
53
53
|
"fs-extra": "^11.2.0",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
55
|
"inquirer": "^10.1.8",
|
56
|
-
"marked": "^
|
56
|
+
"marked": "^14.0.0",
|
57
57
|
"monaco-editor": "^0.50.0",
|
58
58
|
"neo-jsdoc": "1.0.1",
|
59
59
|
"neo-jsdoc-x": "1.0.5",
|
@@ -1,3 +1,13 @@
|
|
1
|
+
body {
|
2
|
+
> .neo-viewport {
|
3
|
+
// without the snap scrolling it is possible to scroll the viewport
|
4
|
+
// by the height of the header toolbar outside the visible area
|
5
|
+
// see: https://github.com/neomjs/neo/issues/5715
|
6
|
+
position: fixed;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
|
1
11
|
.neo-viewport {
|
2
12
|
// sometimes when transitioning between card & cube layouts, the flex value does get lost
|
3
13
|
// see: https://github.com/neomjs/neo/issues/5637
|
@@ -1,5 +1,6 @@
|
|
1
1
|
.portal-home-footer-container {
|
2
2
|
background-color: black;
|
3
|
+
height : 35%;
|
3
4
|
padding : 2em;
|
4
5
|
|
5
6
|
.neo-button.neo-button-ghost {
|
@@ -29,8 +30,24 @@
|
|
29
30
|
color : white;
|
30
31
|
}
|
31
32
|
|
32
|
-
@media (max-width:
|
33
|
-
|
33
|
+
@media (max-width: 800px) {
|
34
|
+
max-height: 18em;
|
35
|
+
min-height: 18em;
|
36
|
+
padding : 1em;
|
37
|
+
|
38
|
+
h2.neo-h2 {
|
39
|
+
font-size: 1.2rem;
|
40
|
+
}
|
41
|
+
|
42
|
+
.neo-button {
|
43
|
+
padding: 0 3px;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
@media (max-width: 500px) {
|
48
|
+
max-height: 15em;
|
49
|
+
min-height: 15em;
|
50
|
+
padding : 1em;
|
34
51
|
|
35
52
|
h2.neo-h2 {
|
36
53
|
font-size: 1.2rem;
|
@@ -1,8 +1,13 @@
|
|
1
1
|
.portal-home-maincontainer {
|
2
|
-
overflow-x : hidden!important;
|
2
|
+
overflow-x : hidden !important;
|
3
3
|
scroll-behavior : smooth;
|
4
4
|
scroll-snap-type: y mandatory;
|
5
5
|
|
6
|
+
@media (max-width: 840px) {
|
7
|
+
scroll-behavior : unset;
|
8
|
+
scroll-snap-type: unset;
|
9
|
+
}
|
10
|
+
|
6
11
|
/* Style and position the progress bar */
|
7
12
|
.portal-home-progress {
|
8
13
|
background : var(--sem-color-surface-primary-background);
|
@@ -27,8 +27,9 @@
|
|
27
27
|
|
28
28
|
.portal-content-text {
|
29
29
|
@media (max-width: 600px) {
|
30
|
+
flex : .5 !important;
|
30
31
|
justify-content: start;
|
31
|
-
|
32
|
+
padding : 1rem;
|
32
33
|
}
|
33
34
|
}
|
34
35
|
|
@@ -36,8 +37,10 @@
|
|
36
37
|
background-color: lightgray;
|
37
38
|
padding : 20px;
|
38
39
|
|
39
|
-
@media (max-width:
|
40
|
-
|
40
|
+
@media (max-width: 600px) {
|
41
|
+
max-height: 35em;
|
42
|
+
min-height: 35em;
|
43
|
+
padding : 5px;
|
41
44
|
}
|
42
45
|
}
|
43
46
|
}
|
@@ -22,10 +22,24 @@
|
|
22
22
|
padding : 20px;
|
23
23
|
}
|
24
24
|
|
25
|
+
@media (max-width: 500px) {
|
26
|
+
min-height: 100%;
|
27
|
+
|
28
|
+
.portal-content-text {
|
29
|
+
flex: 1.2 !important;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
25
33
|
@media (max-width: 840px) {
|
34
|
+
min-height: 100%;
|
35
|
+
|
26
36
|
&.neo-flex-container {
|
27
37
|
flex-direction: column;
|
28
38
|
}
|
39
|
+
|
40
|
+
.portal-content-text {
|
41
|
+
flex: 0.8 !important;
|
42
|
+
}
|
29
43
|
}
|
30
44
|
|
31
45
|
@media (max-width: 500px) {
|
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.35.0'
|
264
264
|
* @memberOf! module:Neo
|
265
265
|
* @name config.version
|
266
266
|
* @type String
|
267
267
|
*/
|
268
|
-
version: '6.
|
268
|
+
version: '6.35.0'
|
269
269
|
};
|
270
270
|
|
271
271
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -275,9 +275,9 @@ class Base extends CoreBase {
|
|
275
275
|
parentComponent_: null,
|
276
276
|
/**
|
277
277
|
* The parent component id or document.body
|
278
|
-
* @member {String}
|
278
|
+
* @member {String} parentId_='document.body'
|
279
279
|
*/
|
280
|
-
|
280
|
+
parentId_: 'document.body',
|
281
281
|
/**
|
282
282
|
* Array of Plugin Modules and / or config objects
|
283
283
|
* @member {Array|null} plugins_=null
|
@@ -102,11 +102,14 @@ class NeoIntersectionObserver extends Base {
|
|
102
102
|
* @param {Boolean} [data.disconnect=false] true removes all currently observed targets
|
103
103
|
* @param {String} data.id
|
104
104
|
* @param {String|String[]} data.observe The querySelector to match elements
|
105
|
-
* @returns {
|
105
|
+
* @returns {Object} opts
|
106
|
+
* {Boolean} opts.cached : true in case the observer is not registered yet
|
107
|
+
* {Number} opts.countTargets: amount of found target nodes inside the DOM
|
106
108
|
*/
|
107
109
|
observe(data) {
|
108
110
|
let me = this,
|
109
111
|
cache = me.cache,
|
112
|
+
cached = false,
|
110
113
|
{id, observe} = data,
|
111
114
|
observer = me.map[data.id],
|
112
115
|
targets = [];
|
@@ -126,6 +129,8 @@ class NeoIntersectionObserver extends Base {
|
|
126
129
|
observer.observe(target)
|
127
130
|
})
|
128
131
|
} else {
|
132
|
+
cached = true;
|
133
|
+
|
129
134
|
if (!cache[id]) {
|
130
135
|
cache[id] = []
|
131
136
|
}
|
@@ -133,7 +138,10 @@ class NeoIntersectionObserver extends Base {
|
|
133
138
|
cache[id].push(data);
|
134
139
|
}
|
135
140
|
|
136
|
-
return
|
141
|
+
return {
|
142
|
+
cached,
|
143
|
+
countTargets: targets.length
|
144
|
+
}
|
137
145
|
}
|
138
146
|
|
139
147
|
/**
|
@@ -144,11 +152,15 @@ class NeoIntersectionObserver extends Base {
|
|
144
152
|
* @param {String} data.root
|
145
153
|
* @param {String} data.rootMargin='0px'
|
146
154
|
* @param {Number|Number[]} data.threshold=0.0
|
155
|
+
* @returns {Boolean}
|
156
|
+
* if data.observe is passed: true in case there is at least one found target node inside the DOM
|
157
|
+
* if data.observe is not passed: true
|
147
158
|
*/
|
148
159
|
register(data) {
|
149
160
|
let me = this,
|
150
161
|
{cache} = me,
|
151
162
|
{id, observe} = data,
|
163
|
+
returnValue = true,
|
152
164
|
observer;
|
153
165
|
|
154
166
|
me.map[id] = observer = new IntersectionObserver(me[data.callback].bind(me), {
|
@@ -159,12 +171,16 @@ class NeoIntersectionObserver extends Base {
|
|
159
171
|
|
160
172
|
observer.rootId = data.id; // storing the component id
|
161
173
|
|
162
|
-
|
174
|
+
if (observe) {
|
175
|
+
returnValue = me.observe({id, observe})
|
176
|
+
}
|
163
177
|
|
164
178
|
if (cache[id]) {
|
165
179
|
cache[id].forEach(item => me.observe(item));
|
166
180
|
delete cache[id]
|
167
181
|
}
|
182
|
+
|
183
|
+
return returnValue
|
168
184
|
}
|
169
185
|
|
170
186
|
/**
|