@vaadin/component-base 23.2.4 → 23.2.5

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.2.4",
3
+ "version": "23.2.5",
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": "d6cb1fbaaf436635de6854653b8b205065e15688"
45
+ "gitHead": "ec895786a271257420f69043ffb8de7088cea22c"
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.2.4';
42
+ return '23.2.5';
43
43
  }
44
44
 
45
45
  /** @protected */