@vaadin/component-base 24.1.0-alpha3 → 24.1.0-alpha5
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 +2 -2
- package/src/async.js +1 -13
- package/src/dom-utils.d.ts +10 -0
- package/src/dom-utils.js +7 -3
- package/src/element-mixin.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "24.1.0-
|
|
3
|
+
"version": "24.1.0-alpha5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@vaadin/testing-helpers": "^0.4.0",
|
|
43
43
|
"sinon": "^13.0.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "1ab6c977fe239d94aac5f39940c1a4722ad4bb63"
|
|
46
46
|
}
|
package/src/async.js
CHANGED
|
@@ -20,13 +20,10 @@
|
|
|
20
20
|
* asynchronous tasks.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
// Microtask implemented using Mutation Observer
|
|
24
23
|
let microtaskCurrHandle = 0;
|
|
25
24
|
let microtaskLastHandle = 0;
|
|
26
25
|
const microtaskCallbacks = [];
|
|
27
|
-
let microtaskNodeContent = 0;
|
|
28
26
|
let microtaskScheduled = false;
|
|
29
|
-
const microtaskNode = document.createTextNode('');
|
|
30
27
|
|
|
31
28
|
function microtaskFlush() {
|
|
32
29
|
microtaskScheduled = false;
|
|
@@ -47,8 +44,6 @@ function microtaskFlush() {
|
|
|
47
44
|
microtaskLastHandle += len;
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
new window.MutationObserver(microtaskFlush).observe(microtaskNode, { characterData: true });
|
|
51
|
-
|
|
52
47
|
/**
|
|
53
48
|
* Async interface wrapper around `setTimeout`.
|
|
54
49
|
*
|
|
@@ -166,12 +161,6 @@ export { idlePeriod };
|
|
|
166
161
|
/**
|
|
167
162
|
* Async interface for enqueuing callbacks that run at microtask timing.
|
|
168
163
|
*
|
|
169
|
-
* Note that microtask timing is achieved via a single `MutationObserver`,
|
|
170
|
-
* and thus callbacks enqueued with this API will all run in a single
|
|
171
|
-
* batch, and not interleaved with other microtasks such as promises.
|
|
172
|
-
* Promises are avoided as an implementation choice for the time being
|
|
173
|
-
* due to Safari bugs that cause Promises to lack microtask guarantees.
|
|
174
|
-
*
|
|
175
164
|
* @namespace
|
|
176
165
|
* @summary Async interface for enqueuing callbacks that run at microtask
|
|
177
166
|
* timing.
|
|
@@ -187,8 +176,7 @@ const microTask = {
|
|
|
187
176
|
run(callback) {
|
|
188
177
|
if (!microtaskScheduled) {
|
|
189
178
|
microtaskScheduled = true;
|
|
190
|
-
|
|
191
|
-
microtaskNodeContent += 1;
|
|
179
|
+
queueMicrotask(() => microtaskFlush());
|
|
192
180
|
}
|
|
193
181
|
microtaskCallbacks.push(callback);
|
|
194
182
|
const result = microtaskCurrHandle;
|
package/src/dom-utils.d.ts
CHANGED
|
@@ -13,6 +13,16 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export function getAncestorRootNodes(node: Node): Node[];
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Takes a string with values separated by space and returns a set the values
|
|
18
|
+
*/
|
|
19
|
+
export function deserializeAttributeValue(value: string): Set<string>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Takes a set of string values and returns a string with values separated by space
|
|
23
|
+
*/
|
|
24
|
+
export function serializeAttributeValue(values: Set<string>): string;
|
|
25
|
+
|
|
16
26
|
/**
|
|
17
27
|
* Adds a value to an attribute containing space-delimited values.
|
|
18
28
|
*/
|
package/src/dom-utils.js
CHANGED
|
@@ -41,10 +41,12 @@ export function getAncestorRootNodes(node) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
+
* Takes a string with values separated by space and returns a set the values
|
|
45
|
+
*
|
|
44
46
|
* @param {string} value
|
|
45
47
|
* @return {Set<string>}
|
|
46
48
|
*/
|
|
47
|
-
function deserializeAttributeValue(value) {
|
|
49
|
+
export function deserializeAttributeValue(value) {
|
|
48
50
|
if (!value) {
|
|
49
51
|
return new Set();
|
|
50
52
|
}
|
|
@@ -53,11 +55,13 @@ function deserializeAttributeValue(value) {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/**
|
|
58
|
+
* Takes a set of string values and returns a string with values separated by space
|
|
59
|
+
*
|
|
56
60
|
* @param {Set<string>} values
|
|
57
61
|
* @return {string}
|
|
58
62
|
*/
|
|
59
|
-
function serializeAttributeValue(values) {
|
|
60
|
-
return [...values].join(' ');
|
|
63
|
+
export function serializeAttributeValue(values) {
|
|
64
|
+
return values ? [...values].join(' ') : '';
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
/**
|
package/src/element-mixin.js
CHANGED