@vaadin/component-base 24.6.0-rc1 → 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-rc1",
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-rc1",
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": "d62ba309e3286777ad3ea7e015d50a2c4976bb42"
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-rc1') {
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
 
@@ -220,14 +243,14 @@ const PolylitMixinImplementation = (superclass) => {
220
243
  this.__runObservers(props, this.constructor.__observers);
221
244
  }
222
245
 
223
- if (this.__dynamicPropertyObservers) {
224
- this.__runDynamicObservers(props, this.__dynamicPropertyObservers);
225
- }
226
-
227
246
  if (this.constructor.__complexObservers) {
228
247
  this.__runComplexObservers(props, this.constructor.__complexObservers);
229
248
  }
230
249
 
250
+ if (this.__dynamicPropertyObservers) {
251
+ this.__runDynamicObservers(props, this.__dynamicPropertyObservers);
252
+ }
253
+
231
254
  if (this.__dynamicMethodObservers) {
232
255
  this.__runComplexObservers(props, this.__dynamicMethodObservers);
233
256
  }