@vaadin/field-highlighter 25.3.0-alpha10 → 25.3.0-alpha11

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": "25.3.0-alpha10",
3
+ "version": "25.3.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,33 +32,33 @@
32
32
  "field"
33
33
  ],
34
34
  "dependencies": {
35
- "@vaadin/a11y-base": "25.3.0-alpha10",
36
- "@vaadin/component-base": "25.3.0-alpha10",
37
- "@vaadin/overlay": "25.3.0-alpha10",
38
- "@vaadin/popover": "25.3.0-alpha10",
39
- "@vaadin/tooltip": "25.3.0-alpha10",
40
- "@vaadin/vaadin-themable-mixin": "25.3.0-alpha10",
35
+ "@vaadin/a11y-base": "25.3.0-alpha11",
36
+ "@vaadin/component-base": "25.3.0-alpha11",
37
+ "@vaadin/overlay": "25.3.0-alpha11",
38
+ "@vaadin/popover": "25.3.0-alpha11",
39
+ "@vaadin/tooltip": "25.3.0-alpha11",
40
+ "@vaadin/vaadin-themable-mixin": "25.3.0-alpha11",
41
41
  "lit": "^3.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@vaadin/aura": "25.3.0-alpha10",
45
- "@vaadin/chai-plugins": "25.3.0-alpha10",
46
- "@vaadin/checkbox": "25.3.0-alpha10",
47
- "@vaadin/checkbox-group": "25.3.0-alpha10",
48
- "@vaadin/custom-field": "25.3.0-alpha10",
49
- "@vaadin/date-picker": "25.3.0-alpha10",
50
- "@vaadin/date-time-picker": "25.3.0-alpha10",
51
- "@vaadin/item": "25.3.0-alpha10",
52
- "@vaadin/list-box": "25.3.0-alpha10",
53
- "@vaadin/radio-group": "25.3.0-alpha10",
54
- "@vaadin/select": "25.3.0-alpha10",
55
- "@vaadin/test-runner-commands": "25.3.0-alpha10",
44
+ "@vaadin/aura": "25.3.0-alpha11",
45
+ "@vaadin/chai-plugins": "25.3.0-alpha11",
46
+ "@vaadin/checkbox": "25.3.0-alpha11",
47
+ "@vaadin/checkbox-group": "25.3.0-alpha11",
48
+ "@vaadin/custom-field": "25.3.0-alpha11",
49
+ "@vaadin/date-picker": "25.3.0-alpha11",
50
+ "@vaadin/date-time-picker": "25.3.0-alpha11",
51
+ "@vaadin/item": "25.3.0-alpha11",
52
+ "@vaadin/list-box": "25.3.0-alpha11",
53
+ "@vaadin/radio-group": "25.3.0-alpha11",
54
+ "@vaadin/select": "25.3.0-alpha11",
55
+ "@vaadin/test-runner-commands": "25.3.0-alpha11",
56
56
  "@vaadin/testing-helpers": "^2.0.0",
57
- "@vaadin/text-area": "25.3.0-alpha10",
58
- "@vaadin/text-field": "25.3.0-alpha10",
59
- "@vaadin/time-picker": "25.3.0-alpha10",
60
- "@vaadin/vaadin-lumo-styles": "25.3.0-alpha10",
57
+ "@vaadin/text-area": "25.3.0-alpha11",
58
+ "@vaadin/text-field": "25.3.0-alpha11",
59
+ "@vaadin/time-picker": "25.3.0-alpha11",
60
+ "@vaadin/vaadin-lumo-styles": "25.3.0-alpha11",
61
61
  "sinon": "^22.0.0"
62
62
  },
63
- "gitHead": "f2833abdf9b613fa0d0ed216830e3f4de87b7dac"
63
+ "gitHead": "7e0c61a37e68d8971def9cdf28ad0548a0f530a9"
64
64
  }
@@ -25,8 +25,6 @@ const DEFAULT_I18N = {
25
25
  badgeTooltip: 'Field value modified by AI.\nClick for details',
26
26
  };
27
27
 
28
- const POPOVER_TRIGGER = ['click'];
29
-
30
28
  // Half of the 1s working shimmer slide (`--vaadin-ai-field-marker-slide` in
31
29
  // the base styles), so that held-back values land — and the read-only lock
32
30
  // lifts — in the middle of a slide instead of at its edge.
@@ -96,6 +94,9 @@ class DelayedFieldValue {
96
94
  /** The queued value, while `#timer` is pending. */
97
95
  #queuedValue;
98
96
 
97
+ /** Whether the field's own `value` accessor is currently replaced. */
98
+ #installed = false;
99
+
99
100
  constructor(field, delay) {
100
101
  this.#field = field;
101
102
  this.#delay = delay;
@@ -146,12 +147,17 @@ class DelayedFieldValue {
146
147
  this.#timer = setTimeout(() => this.#flush(), this.#delay);
147
148
  },
148
149
  });
150
+ this.#installed = true;
149
151
  }
150
152
 
151
153
  /** Restores the field's own accessor, applying a queued value right away. */
152
154
  uninstall() {
153
- if (Object.getOwnPropertyDescriptor(this.#field, 'value')) {
155
+ // Only remove an own property that this instance defined, so that a field
156
+ // keeping its value in an own property instead of an accessor — which
157
+ // `install()` leaves alone — does not lose it.
158
+ if (this.#installed) {
154
159
  delete this.#field.value;
160
+ this.#installed = false;
155
161
  }
156
162
  this.#flush();
157
163
  }
@@ -510,15 +516,7 @@ class AiFieldMarker extends SlotStylesMixin(I18nMixin(DirMixin(PolylitMixin(LitE
510
516
  return html`
511
517
  <button id="${this.#badgeId}" class="badge" type="button" tabindex="0" aria-label="${badgeLabel}"></button>
512
518
  <vaadin-tooltip for="${this.#badgeId}" text="${badgeTooltip}"></vaadin-tooltip>
513
- <vaadin-popover
514
- for="${this.#badgeId}"
515
- role="dialog"
516
- aria-label="${badgeLabel}"
517
- .trigger="${POPOVER_TRIGGER}"
518
- autofocus
519
- theme="arrow"
520
- position="end-top"
521
- >
519
+ <vaadin-popover for="${this.#badgeId}" aria-label="${badgeLabel}" autofocus theme="arrow" position="end-top">
522
520
  <p class="message">${message}</p>
523
521
  <div class="actions">
524
522
  <button type="button" tabindex="0" @click="${this.#onRevert}">${revert}</button>
@@ -673,9 +671,6 @@ class AiFieldMarker extends SlotStylesMixin(I18nMixin(DirMixin(PolylitMixin(LitE
673
671
  */
674
672
  #stopWorking(immediate = false) {
675
673
  const field = this.#field;
676
- if (!field) {
677
- return;
678
- }
679
674
 
680
675
  if (this.#restoreTimer != null) {
681
676
  // Already winding down. Finish it now when the marker is going away, so