neo.mjs 4.8.2 → 4.8.4
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/website/data/blog.json +13 -0
- package/package.json +1 -1
- package/resources/scss/src/form/field/TextArea.scss +4 -0
- package/src/button/Base.mjs +2 -1
- package/src/controller/Application.mjs +8 -0
- package/src/controller/Base.mjs +0 -8
- package/src/main/addon/GoogleMaps.mjs +5 -2
- package/src/main/addon/MapboxGL.mjs +25 -29
- package/src/main/addon/Stylesheet.mjs +1 -1
@@ -1,4 +1,17 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"author" : "Tobias Uhlig",
|
4
|
+
"authorImage" : "author_TobiasUhlig.jpeg",
|
5
|
+
"date" : "Jan 18, 2023",
|
6
|
+
"id" : 54,
|
7
|
+
"image" : "changing-scoped-css-variables-using-javascript.png",
|
8
|
+
"name" : "Changing scoped CSS variables using JavaScript",
|
9
|
+
"provider" : "Medium",
|
10
|
+
"publisher" : "",
|
11
|
+
"selectedInto": [],
|
12
|
+
"type" : "Blog Post",
|
13
|
+
"url" : "https://tobiasuhlig.medium.com/changing-scoped-css-variables-using-javascript-96b26dfa43b1?source=friends_link&sk=2be526c9917418b21fe42bd66c40ea87"
|
14
|
+
},
|
2
15
|
{
|
3
16
|
"author" : "Tobias Uhlig",
|
4
17
|
"authorImage" : "author_TobiasUhlig.jpeg",
|
package/package.json
CHANGED
package/src/button/Base.mjs
CHANGED
@@ -73,7 +73,8 @@ class Base extends Component {
|
|
73
73
|
/**
|
74
74
|
* The scope (this pointer) inside the handler function.
|
75
75
|
* Points to the button instance by default.
|
76
|
-
*
|
76
|
+
* You can use 'this' as a string for convenience reasons
|
77
|
+
* @member {Object|String|null} handlerScope=null
|
77
78
|
*/
|
78
79
|
handlerScope: null,
|
79
80
|
/**
|
@@ -6,6 +6,14 @@ import ClassSystemUtil from '../util/ClassSystem.mjs';
|
|
6
6
|
* @extends Neo.controller.Base
|
7
7
|
*/
|
8
8
|
class Application extends Base {
|
9
|
+
static getStaticConfig() {return {
|
10
|
+
/**
|
11
|
+
* True automatically applies the core/Observable.mjs mixin
|
12
|
+
* @member {Boolean} observable=true
|
13
|
+
*/
|
14
|
+
observable: true
|
15
|
+
}}
|
16
|
+
|
9
17
|
static getConfig() {return {
|
10
18
|
/**
|
11
19
|
* @member {String} className='Neo.controller.Application'
|
package/src/controller/Base.mjs
CHANGED
@@ -6,14 +6,6 @@ import HashHistory from '../util/HashHistory.mjs';
|
|
6
6
|
* @extends Neo.core.Base
|
7
7
|
*/
|
8
8
|
class Base extends CoreBase {
|
9
|
-
static getStaticConfig() {return {
|
10
|
-
/**
|
11
|
-
* True automatically applies the core/Observable.mjs mixin
|
12
|
-
* @member {Boolean} observable=true
|
13
|
-
*/
|
14
|
-
observable: true
|
15
|
-
}}
|
16
|
-
|
17
9
|
static getConfig() {return {
|
18
10
|
/**
|
19
11
|
* @member {String} className='Neo.controller.Base'
|
@@ -161,9 +161,12 @@ class GoogleMaps extends Base {
|
|
161
161
|
* @protected
|
162
162
|
*/
|
163
163
|
loadApi() {
|
164
|
-
let key = Neo.config.googleMapsApiKey
|
164
|
+
let key = Neo.config.googleMapsApiKey,
|
165
|
+
url = ' https://maps.googleapis.com/maps/api/js';
|
165
166
|
|
166
|
-
|
167
|
+
window.foo = Neo.emptyFn;
|
168
|
+
|
169
|
+
DomAccess.loadScript(`${url}?key=${key}&v=weekly&callback=Neo.emptyFn`).then(() => {
|
167
170
|
console.log('GoogleMaps API loaded');
|
168
171
|
})
|
169
172
|
}
|
@@ -122,10 +122,9 @@ class MapboxGL extends Base {
|
|
122
122
|
* @param {Object[]} data.layers
|
123
123
|
*/
|
124
124
|
addLayers(data) {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
let beforeId;
|
125
|
+
let me = this,
|
126
|
+
map = me.maps[data.id],
|
127
|
+
beforeId;
|
129
128
|
|
130
129
|
if (map) {
|
131
130
|
data.layers.forEach(item => {
|
@@ -145,10 +144,9 @@ class MapboxGL extends Base {
|
|
145
144
|
* @param {Object[]} data.sources
|
146
145
|
*/
|
147
146
|
addSources(data) {
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
let id;
|
147
|
+
let me = this,
|
148
|
+
map = me.maps[data.id],
|
149
|
+
id;
|
152
150
|
|
153
151
|
if (map) {
|
154
152
|
data.sources.forEach(item => {
|
@@ -170,7 +168,7 @@ class MapboxGL extends Base {
|
|
170
168
|
*/
|
171
169
|
afterSetScriptsLoaded(value, oldValue) {
|
172
170
|
if (value) {
|
173
|
-
|
171
|
+
let me = this;
|
174
172
|
|
175
173
|
me.mapsToCreate.forEach(config => {
|
176
174
|
me.create(config);
|
@@ -203,13 +201,11 @@ class MapboxGL extends Base {
|
|
203
201
|
* @param {String} data.id
|
204
202
|
*/
|
205
203
|
autoResize(data) {
|
206
|
-
|
204
|
+
let map = this.maps[data.id];
|
207
205
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
}, 100);
|
212
|
-
}
|
206
|
+
map && setTimeout(() => {
|
207
|
+
map.resize();
|
208
|
+
}, 100)
|
213
209
|
}
|
214
210
|
|
215
211
|
/**
|
@@ -220,8 +216,8 @@ class MapboxGL extends Base {
|
|
220
216
|
* @param {Number} data.lng
|
221
217
|
*/
|
222
218
|
center(data) {
|
223
|
-
|
224
|
-
|
219
|
+
let map = this.maps[data.id],
|
220
|
+
center = {lat: data.lat, lng: data.lng};
|
225
221
|
|
226
222
|
if (map) {
|
227
223
|
if (data.animate) {
|
@@ -247,7 +243,7 @@ class MapboxGL extends Base {
|
|
247
243
|
* @param {String} data.zoom
|
248
244
|
*/
|
249
245
|
create(data) {
|
250
|
-
|
246
|
+
let me = this;
|
251
247
|
|
252
248
|
if (!me.scriptsLoaded) {
|
253
249
|
me.mapsToCreate.push(data);
|
@@ -290,8 +286,8 @@ class MapboxGL extends Base {
|
|
290
286
|
}
|
291
287
|
|
292
288
|
insertMapboxGLScripts() {
|
293
|
-
|
294
|
-
|
289
|
+
let me = this,
|
290
|
+
basePath = me.downloadPath + me.version + '/';
|
295
291
|
|
296
292
|
Promise.all([
|
297
293
|
DomAccess.loadScript( basePath + 'mapbox-gl.js'),
|
@@ -307,8 +303,8 @@ class MapboxGL extends Base {
|
|
307
303
|
* @param {Object} event.target map instance
|
308
304
|
*/
|
309
305
|
onMapLoaded(data, event) {
|
310
|
-
|
311
|
-
|
306
|
+
let me = this,
|
307
|
+
mapId = data.id;
|
312
308
|
|
313
309
|
if (data.sources) {
|
314
310
|
me.addSources({
|
@@ -346,7 +342,7 @@ class MapboxGL extends Base {
|
|
346
342
|
* @param {Object} event.target map instance
|
347
343
|
*/
|
348
344
|
onMapReallyLoaded(data, event) {
|
349
|
-
|
345
|
+
let me = this;
|
350
346
|
|
351
347
|
setTimeout(() => {
|
352
348
|
if (data.data) {
|
@@ -371,7 +367,7 @@ class MapboxGL extends Base {
|
|
371
367
|
* @param {Array} data.value
|
372
368
|
*/
|
373
369
|
setFilter(data) {
|
374
|
-
|
370
|
+
let map = this.maps[data.id];
|
375
371
|
|
376
372
|
if (map) {
|
377
373
|
map.setFilter(data.layerId, data.value, data.options || {});
|
@@ -391,7 +387,7 @@ class MapboxGL extends Base {
|
|
391
387
|
* @param {String} data.value
|
392
388
|
*/
|
393
389
|
setLayoutProperty(data) {
|
394
|
-
|
390
|
+
let map = this.maps[data.id];
|
395
391
|
|
396
392
|
if (map) {
|
397
393
|
map.setLayoutProperty(data.layerId, data.key, data.value, data.options || {});
|
@@ -411,7 +407,7 @@ class MapboxGL extends Base {
|
|
411
407
|
* @param {String} data.value
|
412
408
|
*/
|
413
409
|
setPaintProperty(data) {
|
414
|
-
|
410
|
+
let map = this.maps[data.id];
|
415
411
|
|
416
412
|
if (map) {
|
417
413
|
map.setPaintProperty(data.layerId, data.key, data.value, data.options || {});
|
@@ -427,7 +423,7 @@ class MapboxGL extends Base {
|
|
427
423
|
* @param {Object|String} data.style
|
428
424
|
*/
|
429
425
|
setStyle(data) {
|
430
|
-
|
426
|
+
let me = this;
|
431
427
|
|
432
428
|
if (!me.scriptsLoaded || !me.hasMap(data.id)) {
|
433
429
|
// todo
|
@@ -459,7 +455,7 @@ class MapboxGL extends Base {
|
|
459
455
|
* @param {String} data.id
|
460
456
|
*/
|
461
457
|
updateData(data) {
|
462
|
-
|
458
|
+
let me = this;
|
463
459
|
|
464
460
|
if (!me.scriptsLoaded || !me.hasMap(data.id)) {
|
465
461
|
me.dataMap[data.id] = data;
|
@@ -482,7 +478,7 @@ class MapboxGL extends Base {
|
|
482
478
|
* @param {Number} data.zoom
|
483
479
|
*/
|
484
480
|
zoom(data) {
|
485
|
-
|
481
|
+
let map = this.maps[data.id];
|
486
482
|
|
487
483
|
if (map) {
|
488
484
|
map.setZoom(data.zoom);
|
@@ -283,7 +283,7 @@ class Stylesheet extends Base {
|
|
283
283
|
for (sheet of document.styleSheets) {
|
284
284
|
if (sheet.href.includes(data.theme)) {
|
285
285
|
for (rule of sheet.cssRules) {
|
286
|
-
if (rule
|
286
|
+
if (Neo.typeOf(rule) === 'CSSStyleRule') {
|
287
287
|
if (rule.style.getPropertyValue(key) !== '') {
|
288
288
|
rule.style.setProperty(key, data.value, data.priority);
|
289
289
|
return true;
|