@vaadin/field-highlighter 23.1.0-alpha3 → 23.1.0-beta2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/field-highlighter",
3
- "version": "23.1.0-alpha3",
3
+ "version": "23.1.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,27 +34,27 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "23.1.0-alpha3",
38
- "@vaadin/vaadin-lumo-styles": "23.1.0-alpha3",
39
- "@vaadin/vaadin-material-styles": "23.1.0-alpha3",
40
- "@vaadin/vaadin-overlay": "23.1.0-alpha3",
41
- "@vaadin/vaadin-themable-mixin": "23.1.0-alpha3",
37
+ "@vaadin/component-base": "23.1.0-beta2",
38
+ "@vaadin/vaadin-lumo-styles": "23.1.0-beta2",
39
+ "@vaadin/vaadin-material-styles": "23.1.0-beta2",
40
+ "@vaadin/vaadin-overlay": "23.1.0-beta2",
41
+ "@vaadin/vaadin-themable-mixin": "23.1.0-beta2",
42
42
  "lit": "^2.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@esm-bundle/chai": "^4.3.4",
46
- "@vaadin/checkbox": "23.1.0-alpha3",
47
- "@vaadin/combo-box": "23.1.0-alpha3",
48
- "@vaadin/date-picker": "23.1.0-alpha3",
49
- "@vaadin/date-time-picker": "23.1.0-alpha3",
50
- "@vaadin/item": "23.1.0-alpha3",
51
- "@vaadin/list-box": "23.1.0-alpha3",
52
- "@vaadin/radio-group": "23.1.0-alpha3",
53
- "@vaadin/select": "23.1.0-alpha3",
46
+ "@vaadin/checkbox": "23.1.0-beta2",
47
+ "@vaadin/combo-box": "23.1.0-beta2",
48
+ "@vaadin/date-picker": "23.1.0-beta2",
49
+ "@vaadin/date-time-picker": "23.1.0-beta2",
50
+ "@vaadin/item": "23.1.0-beta2",
51
+ "@vaadin/list-box": "23.1.0-beta2",
52
+ "@vaadin/radio-group": "23.1.0-beta2",
53
+ "@vaadin/select": "23.1.0-beta2",
54
54
  "@vaadin/testing-helpers": "^0.3.2",
55
- "@vaadin/text-field": "23.1.0-alpha3",
56
- "@vaadin/time-picker": "23.1.0-alpha3",
55
+ "@vaadin/text-field": "23.1.0-beta2",
56
+ "@vaadin/time-picker": "23.1.0-beta2",
57
57
  "sinon": "^13.0.2"
58
58
  },
59
- "gitHead": "8c9e64e8dfa158dd52a9bf6da351ff038c88ca85"
59
+ "gitHead": "f11f9245a0b5e6bf912725a501c27c24b74e7c8d"
60
60
  }
@@ -12,6 +12,6 @@ export class CheckboxGroupObserver extends FieldObserver {
12
12
 
13
13
  getFocusTarget(event) {
14
14
  const fields = this.getFields();
15
- return Array.from(event.composedPath()).filter((node) => fields.indexOf(node) !== -1)[0];
15
+ return Array.from(event.composedPath()).filter((node) => fields.includes(node))[0];
16
16
  }
17
17
  }
@@ -32,7 +32,7 @@ export class ComponentObserver {
32
32
  this._tags = tags;
33
33
 
34
34
  component.addEventListener('mouseenter', (event) => {
35
- // ignore mouseleave on overlay opening
35
+ // Ignore mouseleave on overlay opening
36
36
  if (event.relatedTarget === this._tags.$.overlay) {
37
37
  return;
38
38
  }
@@ -45,7 +45,7 @@ export class ComponentObserver {
45
45
  });
46
46
 
47
47
  component.addEventListener('mouseleave', (event) => {
48
- // ignore mouseleave on overlay opening
48
+ // Ignore mouseleave on overlay opening
49
49
  if (event.relatedTarget === this._tags.$.overlay) {
50
50
  return;
51
51
  }
@@ -76,7 +76,7 @@ export class ComponentObserver {
76
76
  });
77
77
 
78
78
  this._tags.$.overlay.addEventListener('mouseleave', (event) => {
79
- // ignore mouseleave when moving back to field
79
+ // Ignore mouseleave when moving back to field
80
80
  if (event.relatedTarget === component) {
81
81
  return;
82
82
  }
@@ -109,8 +109,8 @@ export class ComponentObserver {
109
109
  new CustomEvent(`vaadin-highlight-${action}`, {
110
110
  bubbles: true,
111
111
  composed: true,
112
- detail: { fieldIndex: this.getFieldIndex(field) }
113
- })
112
+ detail: { fieldIndex: this.getFieldIndex(field) },
113
+ }),
114
114
  );
115
115
  }
116
116
 
@@ -45,13 +45,13 @@ export class DatePickerObserver extends ComponentObserver {
45
45
 
46
46
  onFocusIn(event) {
47
47
  if (event.relatedTarget === this.overlay) {
48
- // focus returns from the overlay, do nothing.
48
+ // Focus returns from the overlay, do nothing.
49
49
  return;
50
50
  }
51
51
 
52
52
  if (this.blurWhileOpened) {
53
53
  this.blurWhileOpened = false;
54
- // focus returns from outside the browser tab, ignore.
54
+ // Focus returns from outside the browser tab, ignore.
55
55
  return;
56
56
  }
57
57
 
@@ -60,9 +60,9 @@ export class DatePickerObserver extends ComponentObserver {
60
60
 
61
61
  onFocusOut(event) {
62
62
  if (this.fullscreenFocus || event.relatedTarget === this.overlay) {
63
- // do nothing, overlay is opening.
63
+ // Do nothing, overlay is opening.
64
64
  } else if (!this.datePicker.opened) {
65
- // field blur when closed.
65
+ // Field blur when closed.
66
66
  this.hideOutline(this.datePicker);
67
67
  } else {
68
68
  // Focus moves away while still opened, e.g. outside the browser.
@@ -84,7 +84,7 @@ export class DatePickerObserver extends ComponentObserver {
84
84
  this.showOutline(this.datePicker);
85
85
  }
86
86
 
87
- // closing after previously moving focus away.
87
+ // Closing after previously moving focus away.
88
88
  if (event.detail.value === false && this.blurWhileOpened) {
89
89
  this.blurWhileOpened = false;
90
90
  this.hideOutline(this.datePicker);
@@ -11,7 +11,7 @@ class DateObserver extends DatePickerObserver {
11
11
  constructor(datePicker, host) {
12
12
  super(datePicker);
13
13
 
14
- // fire events on the host
14
+ // Fire events on the host
15
15
  this.component = host;
16
16
  }
17
17
 
@@ -24,7 +24,7 @@ class TimeObserver extends FieldObserver {
24
24
  constructor(timePicker, host) {
25
25
  super(timePicker);
26
26
 
27
- // fire events on the host
27
+ // Fire events on the host
28
28
  this.component = host;
29
29
  this.timePicker = timePicker;
30
30
  }
@@ -12,6 +12,6 @@ export class ListBoxObserver extends FieldObserver {
12
12
 
13
13
  getFocusTarget(event) {
14
14
  const fields = this.getFields();
15
- return Array.from(event.composedPath()).filter((node) => fields.indexOf(node) !== -1)[0];
15
+ return Array.from(event.composedPath()).filter((node) => fields.includes(node))[0];
16
16
  }
17
17
  }
@@ -12,6 +12,6 @@ export class RadioGroupObserver extends FieldObserver {
12
12
 
13
13
  getFocusTarget(event) {
14
14
  const fields = this.getFields();
15
- return Array.from(event.composedPath()).filter((node) => fields.indexOf(node) !== -1)[0];
15
+ return Array.from(event.composedPath()).filter((node) => fields.includes(node))[0];
16
16
  }
17
17
  }
@@ -17,7 +17,7 @@ export class SelectObserver extends FieldObserver {
17
17
  super.addListeners(select);
18
18
 
19
19
  select.addEventListener('opened-changed', (event) => {
20
- // when in phone mode, focus is lost when closing.
20
+ // When in phone mode, focus is lost when closing.
21
21
  if (select._phone && event.detail.value === false) {
22
22
  this.hideOutline(select);
23
23
  }
@@ -26,12 +26,12 @@ export class SelectObserver extends FieldObserver {
26
26
 
27
27
  onFocusIn(event) {
28
28
  if (this.overlay.contains(event.relatedTarget)) {
29
- // focus returns on item select, do nothing.
29
+ // Focus returns on item select, do nothing.
30
30
  return;
31
31
  }
32
32
 
33
33
  if (!this.component._phone && this.overlay.hasAttribute('closing')) {
34
- // focus returns on outside click, do nothing.
34
+ // Focus returns on outside click, do nothing.
35
35
  return;
36
36
  }
37
37
 
@@ -40,7 +40,7 @@ export class SelectObserver extends FieldObserver {
40
40
 
41
41
  onFocusOut(event) {
42
42
  if (this.overlay.contains(event.relatedTarget)) {
43
- // do nothing, overlay is opening.
43
+ // Do nothing, overlay is opening.
44
44
  return;
45
45
  }
46
46
  super.onFocusOut(event);
@@ -54,8 +54,8 @@ export class FieldOutline extends ThemableMixin(DirMixin(PolymerElement)) {
54
54
  user: {
55
55
  type: Object,
56
56
  value: null,
57
- observer: '_userChanged'
58
- }
57
+ observer: '_userChanged',
58
+ },
59
59
  };
60
60
  }
61
61
 
@@ -66,14 +66,14 @@ export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
66
66
  * Name of the user.
67
67
  */
68
68
  name: {
69
- type: String
69
+ type: String,
70
70
  },
71
71
 
72
72
  /**
73
73
  * Id of the user.
74
74
  */
75
75
  uid: {
76
- type: String
76
+ type: String,
77
77
  },
78
78
 
79
79
  /**
@@ -81,8 +81,8 @@ export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
81
81
  */
82
82
  colorIndex: {
83
83
  type: Number,
84
- observer: '_colorIndexChanged'
85
- }
84
+ observer: '_colorIndexChanged',
85
+ },
86
86
  };
87
87
  }
88
88
 
@@ -114,9 +114,9 @@ export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
114
114
  bubbles: true,
115
115
  composed: true,
116
116
  detail: {
117
- name: this.name
118
- }
119
- })
117
+ name: this.name,
118
+ },
119
+ }),
120
120
  );
121
121
  }
122
122
  }
@@ -64,7 +64,7 @@ registerStyles(
64
64
  opacity: 1;
65
65
  }
66
66
  }
67
- `
67
+ `,
68
68
  );
69
69
 
70
70
  /**
@@ -59,7 +59,7 @@ export class UserTags extends PolymerElement {
59
59
  hasFocus: {
60
60
  type: Boolean,
61
61
  value: false,
62
- observer: '_hasFocusChanged'
62
+ observer: '_hasFocusChanged',
63
63
  },
64
64
 
65
65
  /**
@@ -68,7 +68,7 @@ export class UserTags extends PolymerElement {
68
68
  opened: {
69
69
  type: Boolean,
70
70
  value: false,
71
- observer: '_openedChanged'
71
+ observer: '_openedChanged',
72
72
  },
73
73
 
74
74
  /**
@@ -77,14 +77,14 @@ export class UserTags extends PolymerElement {
77
77
  */
78
78
  flashing: {
79
79
  type: Boolean,
80
- value: false
80
+ value: false,
81
81
  },
82
82
 
83
83
  /**
84
84
  * A target element that the overlay is positioned to.
85
85
  */
86
86
  target: {
87
- type: Object
87
+ type: Object,
88
88
  },
89
89
 
90
90
  /**
@@ -92,14 +92,14 @@ export class UserTags extends PolymerElement {
92
92
  */
93
93
  users: {
94
94
  type: Array,
95
- value: () => []
95
+ value: () => [],
96
96
  },
97
97
 
98
98
  /** @private */
99
99
  _flashQueue: {
100
100
  type: Array,
101
- value: () => []
102
- }
101
+ value: () => [],
102
+ },
103
103
  };
104
104
  }
105
105
 
@@ -220,7 +220,7 @@ export class UserTags extends PolymerElement {
220
220
  }
221
221
  });
222
222
 
223
- // filter out users that are only moved
223
+ // Filter out users that are only moved
224
224
  const addedUsers = usersToAdd.filter((u) => !usersToRemove.some((u2) => u.id === u2.id));
225
225
  const removedUsers = usersToRemove.filter((u) => !usersToAdd.some((u2) => u.id === u2.id));
226
226
 
@@ -264,7 +264,7 @@ export class UserTags extends PolymerElement {
264
264
 
265
265
  const changedTags = this.getChangedTags(addedUsers, removedUsers);
266
266
 
267
- // check if flash queue contains pending tags for removed users
267
+ // Check if flash queue contains pending tags for removed users
268
268
  if (this._flashQueue.length > 0) {
269
269
  for (let i = 0; i < removedUsers.length; i++) {
270
270
  if (changedTags.removed[i] === null) {
@@ -283,7 +283,7 @@ export class UserTags extends PolymerElement {
283
283
  // Avoid adding to queue if window is not visible.
284
284
  const tags = changedTags.added;
285
285
  if (this.flashing) {
286
- // schedule next flash later
286
+ // Schedule next flash later
287
287
  this.push('_flashQueue', tags);
288
288
  } else {
289
289
  this.flashTags(tags);
@@ -296,7 +296,7 @@ export class UserTags extends PolymerElement {
296
296
 
297
297
  /** @private */
298
298
  _onOverlayOpen() {
299
- // animate all tags except removing ones
299
+ // Animate all tags except removing ones
300
300
  Array.from(this.wrapper.children).forEach((tag) => {
301
301
  if (!tag.classList.contains('removing')) {
302
302
  tag.classList.add('show');
@@ -308,11 +308,11 @@ export class UserTags extends PolymerElement {
308
308
  this.flashing = true;
309
309
  const wrapper = this.wrapper;
310
310
 
311
- // hide existing tags
311
+ // Hide existing tags
312
312
  const hidden = Array.from(wrapper.children);
313
313
  hidden.forEach((tag) => (tag.style.display = 'none'));
314
314
 
315
- // render new tags
315
+ // Render new tags
316
316
  added.forEach((tag) => {
317
317
  wrapper.insertBefore(tag, wrapper.firstChild);
318
318
  });
@@ -320,12 +320,12 @@ export class UserTags extends PolymerElement {
320
320
  this.flashPromise = new Promise((resolve) => {
321
321
  listenOnce(this.$.overlay, 'vaadin-overlay-open').then(() => {
322
322
  this._debounceFlashStart = Debouncer.debounce(this._debounceFlashStart, timeOut.after(DURATION + DELAY), () => {
323
- // animate disappearing
323
+ // Animate disappearing
324
324
  if (!this.hasFocus) {
325
325
  added.forEach((tag) => tag.classList.remove('show'));
326
326
  }
327
327
  this._debounceFlashEnd = Debouncer.debounce(this._debounceFlashEnd, timeOut.after(DURATION), () => {
328
- // show all tags
328
+ // Show all tags
329
329
  const finishFlash = () => {
330
330
  hidden.forEach((tag) => (tag.style.display = 'block'));
331
331
  this.flashing = false;
@@ -335,7 +335,7 @@ export class UserTags extends PolymerElement {
335
335
  if (this.hasFocus) {
336
336
  finishFlash();
337
337
  } else {
338
- // wait for overlay closing animation to complete
338
+ // Wait for overlay closing animation to complete
339
339
  listenOnce(this.$.overlay, 'animationend').then(() => {
340
340
  finishFlash();
341
341
  });
@@ -357,8 +357,12 @@ export class UserTags extends PolymerElement {
357
357
  }
358
358
 
359
359
  stopFlash() {
360
- this._debounceFlashStart && this._debounceFlashStart.flush();
361
- this._debounceFlashEnd && this._debounceFlashEnd.flush();
360
+ if (this._debounceFlashStart) {
361
+ this._debounceFlashStart.flush();
362
+ }
363
+ if (this._debounceFlashEnd) {
364
+ this._debounceFlashEnd.flush();
365
+ }
362
366
  this.$.overlay._flushAnimation('closing');
363
367
  }
364
368
 
@@ -41,5 +41,5 @@ registerStyles(
41
41
  box-shadow: inset 0 0 0 2px var(--_active-user-color);
42
42
  }
43
43
  `,
44
- { moduleId: 'lumo-field-outline' }
44
+ { moduleId: 'lumo-field-outline' },
45
45
  );
@@ -37,8 +37,8 @@ registerStyles(
37
37
  }
38
38
  `,
39
39
  {
40
- moduleId: 'lumo-user-tags-overlay'
41
- }
40
+ moduleId: 'lumo-user-tags-overlay',
41
+ },
42
42
  );
43
43
 
44
44
  registerStyles(
@@ -60,5 +60,5 @@ registerStyles(
60
60
  min-width: calc(var(--lumo-line-height-xs) * 1em + 0.45em);
61
61
  }
62
62
  `,
63
- { moduleId: 'lumo-user-tag' }
63
+ { moduleId: 'lumo-user-tag' },
64
64
  );
@@ -39,5 +39,5 @@ registerStyles(
39
39
  box-shadow: inset 0 0 0 2px var(--_active-user-color);
40
40
  }
41
41
  `,
42
- { moduleId: 'material-field-outline' }
42
+ { moduleId: 'material-field-outline' },
43
43
  );
@@ -27,5 +27,5 @@ registerStyles(
27
27
  min-width: 1.75em;
28
28
  }
29
29
  `,
30
- { moduleId: 'material-user-tag' }
30
+ { moduleId: 'material-user-tag' },
31
31
  );