@vaadin/component-base 23.3.0-alpha3 → 24.0.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": "23.3.0-alpha3",
3
+ "version": "24.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.3.2",
43
43
  "sinon": "^13.0.2"
44
44
  },
45
- "gitHead": "e86cd2abf3e28bade37711291331415d92c454ec"
45
+ "gitHead": "427527c27c4b27822d61fd41d38d7b170134770b"
46
46
  }
@@ -3,9 +3,8 @@
3
3
  * Copyright (c) 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
-
7
- import { animationFrame } from '@vaadin/component-base/src/async.js';
8
- import { Debouncer } from '@vaadin/component-base/src/debounce.js';
6
+ import { animationFrame } from './async.js';
7
+ import { Debouncer } from './debounce.js';
9
8
 
10
9
  const region = document.createElement('div');
11
10
 
@@ -3,8 +3,8 @@
3
3
  * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { addListener } from '@vaadin/component-base/src/gestures.js';
7
6
  import { DisabledMixin } from './disabled-mixin.js';
7
+ import { addListener } from './gestures.js';
8
8
  import { KeyboardMixin } from './keyboard-mixin.js';
9
9
 
10
10
  /**
package/src/dir-mixin.js CHANGED
@@ -9,6 +9,7 @@ import { DirHelper } from './dir-helper.js';
9
9
  * Array of Vaadin custom element classes that have been subscribed to the dir changes.
10
10
  */
11
11
  const directionSubscribers = [];
12
+
12
13
  function directionUpdater() {
13
14
  const documentDir = getDocumentDir();
14
15
  directionSubscribers.forEach((element) => {
@@ -74,7 +75,7 @@ export const DirMixin = (superClass) =>
74
75
  connectedCallback() {
75
76
  super.connectedCallback();
76
77
 
77
- if (!this.hasAttribute('dir')) {
78
+ if (!this.hasAttribute('dir') || this.__restoreSubscription) {
78
79
  this.__subscribe();
79
80
  alignDirs(this, getDocumentDir(), null);
80
81
  }
@@ -100,15 +101,15 @@ export const DirMixin = (superClass) =>
100
101
  this.__subscribe();
101
102
  alignDirs(this, documentDir, newValue);
102
103
  } else if (newDiffValue) {
103
- this.__subscribe(false);
104
+ this.__unsubscribe();
104
105
  }
105
106
  }
106
107
 
107
108
  /** @protected */
108
109
  disconnectedCallback() {
109
110
  super.disconnectedCallback();
110
- this.__subscribe(false);
111
- this.removeAttribute('dir');
111
+ this.__restoreSubscription = directionSubscribers.includes(this);
112
+ this.__unsubscribe();
112
113
  }
113
114
 
114
115
  /** @protected */
@@ -133,12 +134,15 @@ export const DirMixin = (superClass) =>
133
134
  }
134
135
 
135
136
  /** @private */
136
- __subscribe(push = true) {
137
- if (push) {
138
- if (!directionSubscribers.includes(this)) {
139
- directionSubscribers.push(this);
140
- }
141
- } else if (directionSubscribers.includes(this)) {
137
+ __subscribe() {
138
+ if (!directionSubscribers.includes(this)) {
139
+ directionSubscribers.push(this);
140
+ }
141
+ }
142
+
143
+ /** @private */
144
+ __unsubscribe() {
145
+ if (directionSubscribers.includes(this)) {
142
146
  directionSubscribers.splice(directionSubscribers.indexOf(this), 1);
143
147
  }
144
148
  }
@@ -39,7 +39,7 @@ const registered = new Set();
39
39
  export const ElementMixin = (superClass) =>
40
40
  class VaadinElementMixin extends DirMixin(superClass) {
41
41
  static get version() {
42
- return '23.3.0-alpha3';
42
+ return '24.0.0-alpha1';
43
43
  }
44
44
 
45
45
  /** @protected */
@@ -155,6 +155,10 @@ export class IronListAdapter {
155
155
  // Assign a temporary placeholder sizing to elements that would otherwise end up having
156
156
  // no height.
157
157
  el.style.paddingTop = `${this.__placeholderHeight}px`;
158
+
159
+ // Manually schedule the resize handler to make sure the placeholder padding is
160
+ // cleared in case the resize observer never triggers.
161
+ requestAnimationFrame(() => this._resizeHandler());
158
162
  } else {
159
163
  // Add element height to the queue
160
164
  this.__elementHeightQueue.push(elementHeight);