neo.mjs 5.1.5 → 5.1.6

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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.1.5'
23
+ * @member {String} version='5.1.6'
24
24
  */
25
- version: '5.1.5'
25
+ version: '5.1.6'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.1.5'
23
+ * @member {String} version='5.1.6'
24
24
  */
25
- version: '5.1.5'
25
+ version: '5.1.6'
26
26
  }
27
27
 
28
28
  /**
@@ -121,7 +121,7 @@ class MainContainer extends ConfigurationViewport {
121
121
  * @param {Object} opts
122
122
  */
123
123
  onLeafNodesOnlyChange(opts) {
124
- let dragZone = this.exampleComponent.dragZone;
124
+ let dragZone = this.exampleComponent.down({module: ApiTreeList}).dragZone;
125
125
 
126
126
  if (dragZone) {
127
127
  dragZone.leafNodesOnly = opts.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.1.5",
3
+ "version": "5.1.6",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://neomjs.github.io/pages/",
43
43
  "dependencies": {
44
- "@fortawesome/fontawesome-free": "^6.2.1",
44
+ "@fortawesome/fontawesome-free": "^6.3.0",
45
45
  "@material/mwc-button": "^0.27.0",
46
46
  "@material/mwc-textfield": "^0.27.0",
47
47
  "autoprefixer": "^10.4.13",
@@ -56,7 +56,7 @@
56
56
 
57
57
  &:before {
58
58
  color : v(dateselector-nav-button-color);
59
- font-family: "Font Awesome 5 Free";
59
+ font-family: var(--fa-style-family-classic);
60
60
  font-weight: 900;
61
61
  transition : color 150ms cubic-bezier(0.4, 0, 0.2, 1);
62
62
  }
@@ -185,7 +185,7 @@
185
185
 
186
186
  &:before {
187
187
  color : v(dateselector-nav-button-color);
188
- font-family: "Font Awesome 5 Free";
188
+ font-family: var(--fa-style-family-classic);
189
189
  font-size : 18px;
190
190
  font-weight: 900;
191
191
  transition : color 150ms cubic-bezier(0.4, 0, 0.2, 1);
@@ -3,7 +3,7 @@
3
3
  color : v(searchfield-glyph-color);
4
4
  content : "\f002";
5
5
  display : inline-block;
6
- font-family: "Font Awesome 5 Free";
6
+ font-family: var(--fa-style-family-classic);
7
7
  font-size : 14px;
8
8
  font-weight: 900;
9
9
  padding : 7px;
@@ -16,4 +16,4 @@
16
16
  padding-left: 25px;
17
17
  }
18
18
  }
19
- }
19
+ }
@@ -19,7 +19,6 @@
19
19
  border-color: transparent;
20
20
  color : v(selectfield-input-hint-color);
21
21
  font : v(textfield-input-font);
22
- min-height : 25px;
23
22
  opacity : v(selectfield-input-hint-opacity);
24
23
  }
25
24
  }
@@ -20,7 +20,7 @@
20
20
  color : v(list-item-glyph-color);
21
21
  content : "\f0c8";
22
22
  display : inline-block;
23
- font-family: "Font Awesome 5 Free";
23
+ font-family: var(--fa-style-family-classic);
24
24
  width : 25px;
25
25
  }
26
26
 
@@ -6,7 +6,7 @@
6
6
  align-items : center;
7
7
  color : #bbb;
8
8
  display : flex;
9
- font-family : "Font Awesome 5 Free";
9
+ font-family : var(--fa-style-family-classic);
10
10
  font-weight : 600;
11
11
  height : 10px;
12
12
  justify-content: center;
@@ -110,4 +110,4 @@
110
110
  transform: rotate(270deg);
111
111
  }
112
112
  }
113
- }
113
+ }
@@ -7,7 +7,7 @@
7
7
  color : v(button-text-color);
8
8
  content : "\f105";
9
9
  display : block;
10
- font-family : "Font Awesome 5 Free";
10
+ font-family : var(--fa-style-family-classic);
11
11
  font-weight : 600;
12
12
  position : absolute;
13
13
  right : -20px;
@@ -48,7 +48,7 @@
48
48
  color : v(list-item-glyph-color); // todo: tree-list var
49
49
  content : "\f1f9";
50
50
  display : inline-block;
51
- font-family: "Font Awesome 5 Free";
51
+ font-family: var(--fa-style-family-classic);
52
52
  font-weight: 900;
53
53
  width : 25px;
54
54
  }
@@ -75,7 +75,7 @@
75
75
  .neo-treelist-menu-item-content:before {
76
76
  color : v(tree-list-menu-item-color);
77
77
  display : inline-block;
78
- font-family: "Font Awesome 5 Free";
78
+ font-family: var(--fa-style-family-classic);
79
79
  font-weight: 900;
80
80
  width : 25px;
81
81
  }
@@ -1,7 +1,7 @@
1
1
  $neoMap: map-merge($neoMap, (
2
2
  'checkboxfield-color' : #eee,
3
3
  'checkboxfield-color-checked' : #64B5F6,
4
- 'checkboxfield-icon-font-family': '"Font Awesome 5 Free"',
4
+ 'checkboxfield-icon-font-family': var(--fa-style-family-classic),
5
5
  'checkboxfield-icon-font-size' : 14px,
6
6
  'checkboxfield-label-top-margin': 0 0 3px
7
7
  ));
@@ -1,7 +1,7 @@
1
1
  $neoMap: map-merge($neoMap, (
2
2
  'checkboxfield-color' : #aaa,
3
3
  'checkboxfield-color-checked' : #1c60a0,
4
- 'checkboxfield-icon-font-family': '"Font Awesome 5 Free"',
4
+ 'checkboxfield-icon-font-family': var(--fa-style-family-classic),
5
5
  'checkboxfield-icon-font-size' : 14px,
6
6
  'checkboxfield-label-top-margin': 0 0 3px
7
7
  ));
@@ -237,12 +237,12 @@ const DefaultConfig = {
237
237
  useVdomWorker: true,
238
238
  /**
239
239
  * buildScripts/injectPackageVersion.mjs will update this value
240
- * @default '5.1.5'
240
+ * @default '5.1.6'
241
241
  * @memberOf! module:Neo
242
242
  * @name config.version
243
243
  * @type String
244
244
  */
245
- version: '5.1.5'
245
+ version: '5.1.6'
246
246
  };
247
247
 
248
248
  Object.assign(DefaultConfig, {
package/src/Neo.mjs CHANGED
@@ -52,7 +52,7 @@ Neo = globalThis.Neo = Object.assign({
52
52
  ntypeMap = Neo.ntypeMap,
53
53
  proto = cls.prototype || cls,
54
54
  protos = [],
55
- cfg, config, ctor, overrides;
55
+ cfg, config, ctor, ntype;
56
56
 
57
57
  while (proto.__proto__) {
58
58
  ctor = proto.constructor;
@@ -74,7 +74,7 @@ Neo = globalThis.Neo = Object.assign({
74
74
  ctor = element.constructor;
75
75
 
76
76
  cfg = ctor.config || {};
77
-
77
+
78
78
  if (Neo.overwrites) {
79
79
  ctor.applyOverwrites(cfg);
80
80
  }
@@ -99,11 +99,15 @@ Neo = globalThis.Neo = Object.assign({
99
99
  });
100
100
 
101
101
  if (Object.hasOwn(cfg, 'ntype')) {
102
- if (Object.hasOwn(ntypeMap, cfg.ntype)) {
103
- throw new Error(`ntype conflict for '${cfg.ntype}' inside the classes:\n${ntypeMap[cfg.ntype]}\n${cfg.className}`);
102
+ ntype = cfg.ntype;
103
+
104
+ // Running the docs app inside a workspace can pull in the same classes from different roots,
105
+ // so we want to check for different class names as well
106
+ if (Object.hasOwn(ntypeMap, ntype) && cfg.className !== ntypeMap[ntype]) {
107
+ throw new Error(`ntype conflict for '${ntype}' inside the classes:\n${ntypeMap[ntype]}\n${cfg.className}`);
104
108
  }
105
109
 
106
- ntypeMap[cfg.ntype] = cfg.className;
110
+ ntypeMap[ntype] = cfg.className;
107
111
  }
108
112
 
109
113
  mixins = Object.hasOwn(config, 'mixins') && config.mixins || [];
@@ -396,7 +400,7 @@ Neo = globalThis.Neo = Object.assign({
396
400
  *
397
401
  * @memberOf module:Neo
398
402
  * @param {Array|String} names The class name string containing dots or an Array of the string parts
399
- * @param {Boolean} [create] Set create to true to create empty objects for non existing parts
403
+ * @param {Boolean} [create] Set create to true to create empty objects for non-existing parts
400
404
  * @param {Object} [scope] Set a different starting point as globalThis
401
405
  * @returns {Object} reference to the toplevel namespace
402
406
  */
@@ -252,6 +252,12 @@ class Base extends CoreBase {
252
252
  * @protected
253
253
  */
254
254
  rendering_: false,
255
+ /**
256
+ * Specify a role tag attribute for the vdom root.
257
+ * See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles
258
+ * @member {String|null} role_=null
259
+ */
260
+ role_: null,
255
261
  /**
256
262
  * Set this to true for bulk updates.
257
263
  * Ensure to set it back to false afterwards.
@@ -625,6 +631,16 @@ class Base extends CoreBase {
625
631
  }
626
632
  }
627
633
 
634
+ /**
635
+ * Triggered after the role config got changed
636
+ * @param {String|null} value
637
+ * @param {String|null} oldValue
638
+ * @protected
639
+ */
640
+ afterSetRole(value, oldValue) {
641
+ this.changeVdomRootKey('role', value);
642
+ }
643
+
628
644
  /**
629
645
  * Triggered after the style config got changed
630
646
  * @param {Object} value
@@ -1,6 +1,6 @@
1
1
  import Base from '../component/Base.mjs';
2
- import ToastManager from '../manager/Toast.mjs';
3
2
  import NeoArray from "../util/Array.mjs";
3
+ import ToastManager from '../manager/Toast.mjs';
4
4
 
5
5
  /**
6
6
  * @class Neo.component.Toast
@@ -21,18 +21,6 @@ import NeoArray from "../util/Array.mjs";
21
21
  })
22
22
  */
23
23
  class Toast extends Base {
24
- /**
25
- * Used by the ToastManager
26
- * @member {Boolean} running=false
27
- * @private
28
- */
29
- running = false
30
- /**
31
- * Timeout in ms after which the toast is removed
32
- * @member {Number} timeout=3000
33
- */
34
- timeout = 3000
35
-
36
24
  /**
37
25
  * Valid values for positions
38
26
  * @member {String[]} positions = ['tl','tc','tr','bl','bc','br']
@@ -122,6 +110,18 @@ class Toast extends Base {
122
110
  }]}
123
111
  }
124
112
 
113
+ /**
114
+ * Used by the ToastManager
115
+ * @member {Boolean} running=false
116
+ * @private
117
+ */
118
+ running = false
119
+ /**
120
+ * Timeout in ms after which the toast is removed
121
+ * @member {Number} timeout=3000
122
+ */
123
+ timeout = 3000
124
+
125
125
  /**
126
126
  * @param {Object} config
127
127
  */
@@ -79,6 +79,11 @@ class Picker extends Text {
79
79
  * @member {Number|null} pickerWidth=100
80
80
  */
81
81
  pickerWidth: 100,
82
+ /**
83
+ * @member {Boolean} showPickerOnFocus=false
84
+ * @protected
85
+ */
86
+ showPickerOnFocus: false,
82
87
  /**
83
88
  * @member {Object|Object[]} triggers=[]
84
89
  * @protected
@@ -168,7 +173,7 @@ class Picker extends Text {
168
173
  id : me.getPickerId(),
169
174
  items : pickerComponent ? [pickerComponent] : [],
170
175
  maxHeight: me.pickerMaxHeight,
171
- vdom : {cn: [], tabIndex: -1},
176
+ vdom : {cn: [], 'aria-activedescendant': me.id, tabIndex: -1},
172
177
  width : me.pickerWidth,
173
178
  ...me.pickerConfig,
174
179
 
@@ -258,6 +263,18 @@ class Picker extends Text {
258
263
  me.pickerIsMounted = false;
259
264
  }
260
265
 
266
+ /**
267
+ * @param {Object} data
268
+ * @protected
269
+ */
270
+ onFocusEnter(data) {
271
+ super.onFocusEnter(data);
272
+
273
+ let me = this;
274
+
275
+ me.showPickerOnFocus && !me.pickerIsMounted && me.getClientRectsThenShow();
276
+ }
277
+
261
278
  /**
262
279
  * @param {Object} data
263
280
  * @protected
@@ -82,6 +82,10 @@ class Select extends Picker {
82
82
  * @protected
83
83
  */
84
84
  record: null,
85
+ /**
86
+ * @member {String|null} role='listbox'
87
+ */
88
+ role: 'listbox',
85
89
  /**
86
90
  * @member {Neo.data.Store|null} store_=null
87
91
  */
@@ -128,6 +132,7 @@ class Select extends Picker {
128
132
  module : List,
129
133
  appName : me.appName,
130
134
  displayField : me.displayField,
135
+ itemRole : 'option',
131
136
  parentId : me.id,
132
137
  selectionModel: {stayInList: false},
133
138
  store : me.store,
@@ -361,6 +366,21 @@ class Select extends Picker {
361
366
  return me.record?.[me.valueField] || me.value
362
367
  }
363
368
 
369
+ /**
370
+ * @param {Object} data
371
+ * @protected
372
+ */
373
+ handleKeyDownEnter(data) {
374
+ let me = this;
375
+
376
+ if (me.pickerIsMounted) {
377
+ me.selectListItem();
378
+ super.onKeyDownEnter(data)
379
+ } else {
380
+ super.onKeyDownEnter(data, me.selectListItem)
381
+ }
382
+ }
383
+
364
384
  /**
365
385
  * @param {Object} data
366
386
  * @protected
@@ -406,7 +426,7 @@ class Select extends Picker {
406
426
  * @protected
407
427
  */
408
428
  onKeyDownDown(data) {
409
- this.onKeyDownEnter(data)
429
+ this.handleKeyDownEnter(data)
410
430
  }
411
431
 
412
432
  /**
@@ -414,14 +434,7 @@ class Select extends Picker {
414
434
  * @protected
415
435
  */
416
436
  onKeyDownEnter(data) {
417
- let me = this;
418
-
419
- if (me.pickerIsMounted) {
420
- me.selectListItem();
421
- super.onKeyDownEnter(data)
422
- } else {
423
- super.onKeyDownEnter(data, me.selectListItem)
424
- }
437
+ this.handleKeyDownEnter(data);
425
438
  }
426
439
 
427
440
  /**
package/src/list/Base.mjs CHANGED
@@ -132,6 +132,11 @@ class Base extends Component {
132
132
  {tag: 'ul', cn: []}
133
133
  }
134
134
 
135
+ /**
136
+ * @member {String|null} itemRole=null
137
+ */
138
+ itemRole = null
139
+
135
140
  /**
136
141
  * @param {Object} config
137
142
  */
@@ -370,6 +375,10 @@ class Base extends Component {
370
375
  tabIndex: -1
371
376
  };
372
377
 
378
+ if (me.itemRole) {
379
+ item.role = me.itemRole;
380
+ }
381
+
373
382
  switch (Neo.typeOf(itemContent)) {
374
383
  case null: {
375
384
  return null;