@vaadin/component-base 24.2.0-alpha14 → 24.2.0-alpha16

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/component-base",
3
- "version": "24.2.0-alpha14",
3
+ "version": "24.2.0-alpha16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.5.0",
43
43
  "sinon": "^13.0.2"
44
44
  },
45
- "gitHead": "203a2fda8d879db6ee8bccd7cf5b915de3e5008b"
45
+ "gitHead": "133d3aeb00dedc8be975affa81c7af4b4d22acf6"
46
46
  }
@@ -45,7 +45,7 @@ const registered = new Set();
45
45
  export const ElementMixin = (superClass) =>
46
46
  class VaadinElementMixin extends DirMixin(superClass) {
47
47
  static get version() {
48
- return '24.2.0-alpha14';
48
+ return '24.2.0-alpha16';
49
49
  }
50
50
 
51
51
  /** @protected */
@@ -93,17 +93,6 @@ const PolylitMixinImplementation = (superclass) => {
93
93
 
94
94
  let result = defaultDescriptor;
95
95
 
96
- if ('value' in options) {
97
- // Set the default value
98
- this.addCheckedInitializer((instance) => {
99
- if (typeof options.value === 'function') {
100
- instance[name] = options.value.call(instance);
101
- } else {
102
- instance[name] = options.value;
103
- }
104
- });
105
- }
106
-
107
96
  if (options.sync) {
108
97
  result = {
109
98
  get: defaultDescriptor.get,
@@ -129,6 +118,10 @@ const PolylitMixinImplementation = (superclass) => {
129
118
  // This is run during construction of the element
130
119
  instance[`_set${upper(name)}`] = function (value) {
131
120
  setter.call(instance, value);
121
+
122
+ if (options.sync) {
123
+ this.performUpdate();
124
+ }
132
125
  };
133
126
  });
134
127
 
@@ -142,6 +135,19 @@ const PolylitMixinImplementation = (superclass) => {
142
135
  };
143
136
  }
144
137
 
138
+ if ('value' in options) {
139
+ // Set the default value
140
+ this.addCheckedInitializer((instance) => {
141
+ const value = typeof options.value === 'function' ? options.value.call(instance) : options.value;
142
+
143
+ if (options.readOnly) {
144
+ instance[`_set${upper(name)}`](value);
145
+ } else {
146
+ instance[name] = value;
147
+ }
148
+ });
149
+ }
150
+
145
151
  if (options.observer) {
146
152
  const method = options.observer;
147
153
 
@@ -28,7 +28,7 @@ export class TooltipController extends SlotController {
28
28
  * via `aria-describedby` attribute used by screen readers.
29
29
  * When not set, defaults to `target`.
30
30
  */
31
- ariaTarget: HTMLElement;
31
+ ariaTarget: HTMLElement | HTMLElement[];
32
32
 
33
33
  /**
34
34
  * Object with properties passed to `generator`
@@ -62,7 +62,7 @@ export class TooltipController extends SlotController {
62
62
  * Set an HTML element for linking with the tooltip overlay
63
63
  * via `aria-describedby` attribute used by screen readers.
64
64
  */
65
- setAriaTarget(ariaTarget: HTMLElement): void;
65
+ setAriaTarget(ariaTarget: HTMLElement | HTMLElement[]): void;
66
66
 
67
67
  /**
68
68
  * Set a context object to be used by generator.
@@ -49,6 +49,19 @@ export class TooltipController extends SlotController {
49
49
  if (this.shouldShow !== undefined) {
50
50
  tooltipNode.shouldShow = this.shouldShow;
51
51
  }
52
+
53
+ this.__notifyChange();
54
+ }
55
+
56
+ /**
57
+ * Override to notify the host when the tooltip is removed.
58
+ *
59
+ * @param {Node} tooltipNode
60
+ * @protected
61
+ * @override
62
+ */
63
+ teardownNode() {
64
+ this.__notifyChange();
52
65
  }
53
66
 
54
67
  /**
@@ -145,4 +158,9 @@ export class TooltipController extends SlotController {
145
158
  tooltipNode.target = target;
146
159
  }
147
160
  }
161
+
162
+ /** @private */
163
+ __notifyChange() {
164
+ this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node: this.node } }));
165
+ }
148
166
  }