@vaadin/component-base 24.6.0-beta1 → 24.7.0-alpha1

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.6.0-beta1",
3
+ "version": "24.7.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,9 +38,9 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "24.6.0-beta1",
41
+ "@vaadin/chai-plugins": "24.7.0-alpha1",
42
42
  "@vaadin/testing-helpers": "^1.0.0",
43
43
  "sinon": "^18.0.0"
44
44
  },
45
- "gitHead": "ab28efb0dcf2cd1ef72100e2e8f32232fa49aacc"
45
+ "gitHead": "04be941c9a7b659871c97f31b9cc3ffd7528087b"
46
46
  }
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '24.6.0-beta1') {
16
+ export function defineCustomElement(CustomElement, version = '24.7.0-alpha1') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -195,6 +195,27 @@ const PolylitMixinImplementation = (superclass) => {
195
195
  return result;
196
196
  }
197
197
 
198
+ constructor() {
199
+ super();
200
+ this.__hasPolylitMixin = true;
201
+ }
202
+
203
+ /** @protected */
204
+ connectedCallback() {
205
+ super.connectedCallback();
206
+
207
+ // Components like `vaadin-overlay` are teleported to the body element when opened.
208
+ // If their opened state is set as an attribute, the teleportation happens immediately
209
+ // after they are connected to the DOM. This means they will be outside the scope of
210
+ // querySelectorAll in the parent component's `firstUpdated()`. To ensure their reference
211
+ // is still registered in the $ map, we propagate the reference here.
212
+ const parentHost = this.getRootNode().host;
213
+ if (parentHost && parentHost.__hasPolylitMixin && this.id) {
214
+ parentHost.$ ||= {};
215
+ parentHost.$[this.id] = this;
216
+ }
217
+ }
218
+
198
219
  /** @protected */
199
220
  firstUpdated() {
200
221
  super.firstUpdated();
@@ -203,8 +224,10 @@ const PolylitMixinImplementation = (superclass) => {
203
224
  this.$ = {};
204
225
  }
205
226
 
206
- this.renderRoot.querySelectorAll('[id]').forEach((node) => {
207
- this.$[node.id] = node;
227
+ [...Object.values(this.$), this.renderRoot].forEach((node) => {
228
+ node.querySelectorAll('[id]').forEach((node) => {
229
+ this.$[node.id] = node;
230
+ });
208
231
  });
209
232
  }
210
233
 
@@ -213,18 +236,21 @@ const PolylitMixinImplementation = (superclass) => {
213
236
 
214
237
  /** @protected */
215
238
  updated(props) {
239
+ const wasReadyInvoked = this.__isReadyInvoked;
240
+ this.__isReadyInvoked = true;
241
+
216
242
  if (this.constructor.__observers) {
217
243
  this.__runObservers(props, this.constructor.__observers);
218
244
  }
219
245
 
220
- if (this.__dynamicPropertyObservers) {
221
- this.__runDynamicObservers(props, this.__dynamicPropertyObservers);
222
- }
223
-
224
246
  if (this.constructor.__complexObservers) {
225
247
  this.__runComplexObservers(props, this.constructor.__complexObservers);
226
248
  }
227
249
 
250
+ if (this.__dynamicPropertyObservers) {
251
+ this.__runDynamicObservers(props, this.__dynamicPropertyObservers);
252
+ }
253
+
228
254
  if (this.__dynamicMethodObservers) {
229
255
  this.__runComplexObservers(props, this.__dynamicMethodObservers);
230
256
  }
@@ -233,8 +259,7 @@ const PolylitMixinImplementation = (superclass) => {
233
259
  this.__runNotifyProps(props, this.constructor.__notifyProps);
234
260
  }
235
261
 
236
- if (!this.__isReadyInvoked) {
237
- this.__isReadyInvoked = true;
262
+ if (!wasReadyInvoked) {
238
263
  this.ready();
239
264
  }
240
265
  }