neo.mjs 4.8.1 → 4.8.3

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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.8.1",
3
+ "version": "4.8.3",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,6 +1,10 @@
1
1
  .neo-textarea {
2
2
  align-items: stretch;
3
3
 
4
+ .neo-input-wrapper {
5
+ height: fit-content;
6
+ }
7
+
4
8
  .neo-field-trigger {
5
9
  border-bottom: 1px solid var(--textfield-border-color);
6
10
  }
@@ -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
- * @member {Object|null} handlerScope=null
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
  /**
@@ -16,6 +16,11 @@ class GoogleMaps extends Base {
16
16
  * @member {Object} markerStoreConfig=null
17
17
  */
18
18
  markerStoreConfig = null
19
+ /**
20
+ * Internal flag. Gets set to true once Neo.main.addon.GoogleMaps.create() is finished.
21
+ * @member {Boolean} mapCreated=false
22
+ */
23
+ mapCreated = false
19
24
  /**
20
25
  * Pass any options to the map instance which are not explicitly defined here
21
26
  * @member {Object} mapOptions={}
@@ -118,10 +123,12 @@ class GoogleMaps extends Base {
118
123
  * @protected
119
124
  */
120
125
  afterSetCenter(value, oldValue) {
121
- if (oldValue !== undefined) {
126
+ let me = this;
127
+
128
+ if (me.mapCreated) {
122
129
  Neo.main.addon.GoogleMaps.setCenter({
123
- appName: this.appName,
124
- id : this.id,
130
+ appName: me.appName,
131
+ id : me.id,
125
132
  value
126
133
  })
127
134
  }
@@ -176,6 +183,7 @@ class GoogleMaps extends Base {
176
183
 
177
184
  setTimeout(() => {
178
185
  Neo.main.addon.GoogleMaps.create(opts).then(() => {
186
+ me.mapCreated = true;
179
187
  me.onComponentMounted();
180
188
  });
181
189
  }, 50);
@@ -189,9 +197,9 @@ class GoogleMaps extends Base {
189
197
  * @protected
190
198
  */
191
199
  afterSetZoom(value, oldValue) {
192
- if (oldValue !== undefined) {
193
- let me = this;
200
+ let me = this;
194
201
 
202
+ if (me.mapCreated) {
195
203
  Neo.main.addon.GoogleMaps.setZoom({
196
204
  appName: me.appName,
197
205
  id : me.id,
@@ -290,10 +298,9 @@ class GoogleMaps extends Base {
290
298
  * @protected
291
299
  */
292
300
  parseMarkerClick(data) {
293
- let me = this,
294
- record = me.markerStore.get(data.id);
301
+ let me = this;
295
302
 
296
- data.record = record;
303
+ data.record = me.markerStore.get(data.id);
297
304
 
298
305
  me.onMarkerClick(data);
299
306
 
@@ -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'
@@ -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'
@@ -122,10 +122,9 @@ class MapboxGL extends Base {
122
122
  * @param {Object[]} data.layers
123
123
  */
124
124
  addLayers(data) {
125
- const me = this,
126
- map = me.maps[data.id];
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
- const me = this,
149
- map = me.maps[data.id];
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
- const me = this;
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
- const map = this.maps[data.id];
204
+ let map = this.maps[data.id];
207
205
 
208
- if (map) {
209
- setTimeout(() => {
210
- map.resize();
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
- const map = this.maps[data.id],
224
- center = {lat: data.lat, lng: data.lng};
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
- const me = this;
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
- const me = this,
294
- basePath = me.downloadPath + me.version + '/';
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
- const me = this,
311
- mapId = data.id;
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
- const me = this;
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
- const map = this.maps[data.id];
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
- const map = this.maps[data.id];
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
- const map = this.maps[data.id];
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
- const me = this;
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
- const me = this;
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
- const map = this.maps[data.id];
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.type === 1) { // CSSRule.STYLE_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;