@vaadin/tooltip 25.4.0-alpha2 → 25.4.0-alpha4
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/custom-elements.json +5 -20
- package/package.json +12 -12
- package/src/vaadin-tooltip-mixin.js +13 -4
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"type": {
|
|
44
44
|
"text": "object"
|
|
45
45
|
},
|
|
46
|
-
"description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`."
|
|
47
|
-
"attribute": "aria-target"
|
|
46
|
+
"description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`."
|
|
48
47
|
}
|
|
49
48
|
],
|
|
50
49
|
"attributes": [
|
|
@@ -106,7 +105,6 @@
|
|
|
106
105
|
"text": "object"
|
|
107
106
|
},
|
|
108
107
|
"description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
|
|
109
|
-
"attribute": "aria-target",
|
|
110
108
|
"inheritedFrom": {
|
|
111
109
|
"name": "TooltipAriaMixin",
|
|
112
110
|
"module": "src/vaadin-tooltip-aria-mixin.js"
|
|
@@ -119,8 +117,7 @@
|
|
|
119
117
|
"type": {
|
|
120
118
|
"text": "object"
|
|
121
119
|
},
|
|
122
|
-
"description": "Object with properties passed to `generator` and\n`shouldShow` functions for generating tooltip text\nor detecting whether to show the tooltip or not."
|
|
123
|
-
"attribute": "context"
|
|
120
|
+
"description": "Object with properties passed to `generator` and\n`shouldShow` functions for generating tooltip text\nor detecting whether to show the tooltip or not."
|
|
124
121
|
},
|
|
125
122
|
{
|
|
126
123
|
"kind": "field",
|
|
@@ -153,8 +150,7 @@
|
|
|
153
150
|
"type": {
|
|
154
151
|
"text": "object"
|
|
155
152
|
},
|
|
156
|
-
"description": "Function used to generate the tooltip content.\nWhen provided, it overrides the `text` property.\nUse the `context` property to provide argument\nthat can be passed to the generator function."
|
|
157
|
-
"attribute": "generator"
|
|
153
|
+
"description": "Function used to generate the tooltip content.\nWhen provided, it overrides the `text` property.\nUse the `context` property to provide argument\nthat can be passed to the generator function."
|
|
158
154
|
},
|
|
159
155
|
{
|
|
160
156
|
"kind": "field",
|
|
@@ -269,8 +265,7 @@
|
|
|
269
265
|
"type": {
|
|
270
266
|
"text": "object"
|
|
271
267
|
},
|
|
272
|
-
"description": "Function used to detect whether to show the tooltip based on a condition,\ncalled every time the tooltip is about to be shown on hover and focus.\nThe function takes two parameters: `target` and `context`, which contain\nvalues of the corresponding tooltip properties at the time of calling.\nThe tooltip is only shown when the function invocation returns `true`."
|
|
273
|
-
"attribute": "should-show"
|
|
268
|
+
"description": "Function used to detect whether to show the tooltip based on a condition,\ncalled every time the tooltip is about to be shown on hover and focus.\nThe function takes two parameters: `target` and `context`, which contain\nvalues of the corresponding tooltip properties at the time of calling.\nThe tooltip is only shown when the function invocation returns `true`."
|
|
274
269
|
},
|
|
275
270
|
{
|
|
276
271
|
"kind": "field",
|
|
@@ -280,7 +275,6 @@
|
|
|
280
275
|
"text": "object"
|
|
281
276
|
},
|
|
282
277
|
"description": "Reference to the DOM element used both to trigger the overlay\nby user interaction and to visually position it on the screen.\n\nDefaults to an element referenced with `for` attribute, in\nwhich case it must be located in the same shadow scope.",
|
|
283
|
-
"attribute": "target",
|
|
284
278
|
"inheritedFrom": {
|
|
285
279
|
"name": "PopoverTargetMixin",
|
|
286
280
|
"package": "@vaadin/popover/src/vaadin-popover-target-mixin.js"
|
|
@@ -462,7 +456,6 @@
|
|
|
462
456
|
"text": "object"
|
|
463
457
|
},
|
|
464
458
|
"description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
|
|
465
|
-
"attribute": "aria-target",
|
|
466
459
|
"inheritedFrom": {
|
|
467
460
|
"name": "TooltipAriaMixin",
|
|
468
461
|
"module": "src/vaadin-tooltip-aria-mixin.js"
|
|
@@ -476,7 +469,6 @@
|
|
|
476
469
|
"text": "object"
|
|
477
470
|
},
|
|
478
471
|
"description": "Object with properties passed to `generator` and\n`shouldShow` functions for generating tooltip text\nor detecting whether to show the tooltip or not.",
|
|
479
|
-
"attribute": "context",
|
|
480
472
|
"inheritedFrom": {
|
|
481
473
|
"name": "TooltipMixin",
|
|
482
474
|
"module": "src/vaadin-tooltip-mixin.js"
|
|
@@ -518,7 +510,6 @@
|
|
|
518
510
|
"text": "object"
|
|
519
511
|
},
|
|
520
512
|
"description": "Function used to generate the tooltip content.\nWhen provided, it overrides the `text` property.\nUse the `context` property to provide argument\nthat can be passed to the generator function.",
|
|
521
|
-
"attribute": "generator",
|
|
522
513
|
"inheritedFrom": {
|
|
523
514
|
"name": "TooltipMixin",
|
|
524
515
|
"module": "src/vaadin-tooltip-mixin.js"
|
|
@@ -670,7 +661,6 @@
|
|
|
670
661
|
"text": "object"
|
|
671
662
|
},
|
|
672
663
|
"description": "Function used to detect whether to show the tooltip based on a condition,\ncalled every time the tooltip is about to be shown on hover and focus.\nThe function takes two parameters: `target` and `context`, which contain\nvalues of the corresponding tooltip properties at the time of calling.\nThe tooltip is only shown when the function invocation returns `true`.",
|
|
673
|
-
"attribute": "should-show",
|
|
674
664
|
"inheritedFrom": {
|
|
675
665
|
"name": "TooltipMixin",
|
|
676
666
|
"module": "src/vaadin-tooltip-mixin.js"
|
|
@@ -684,7 +674,6 @@
|
|
|
684
674
|
"text": "object"
|
|
685
675
|
},
|
|
686
676
|
"description": "Reference to the DOM element used both to trigger the overlay\nby user interaction and to visually position it on the screen.\n\nDefaults to an element referenced with `for` attribute, in\nwhich case it must be located in the same shadow scope.",
|
|
687
|
-
"attribute": "target",
|
|
688
677
|
"inheritedFrom": {
|
|
689
678
|
"name": "PopoverTargetMixin",
|
|
690
679
|
"package": "@vaadin/popover/src/vaadin-popover-target-mixin.js"
|
|
@@ -707,15 +696,11 @@
|
|
|
707
696
|
],
|
|
708
697
|
"events": [
|
|
709
698
|
{
|
|
710
|
-
"name": "content-changed",
|
|
711
699
|
"type": {
|
|
712
700
|
"text": "CustomEvent"
|
|
713
701
|
},
|
|
714
702
|
"description": "Fired when the tooltip text content is changed.",
|
|
715
|
-
"
|
|
716
|
-
"name": "TooltipMixin",
|
|
717
|
-
"module": "src/vaadin-tooltip-mixin.js"
|
|
718
|
-
}
|
|
703
|
+
"name": "content-changed"
|
|
719
704
|
}
|
|
720
705
|
],
|
|
721
706
|
"attributes": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/tooltip",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.4.0-
|
|
39
|
-
"@vaadin/component-base": "25.4.0-
|
|
40
|
-
"@vaadin/markdown": "25.4.0-
|
|
41
|
-
"@vaadin/overlay": "25.4.0-
|
|
42
|
-
"@vaadin/popover": "25.4.0-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.4.0-alpha4",
|
|
39
|
+
"@vaadin/component-base": "25.4.0-alpha4",
|
|
40
|
+
"@vaadin/markdown": "25.4.0-alpha4",
|
|
41
|
+
"@vaadin/overlay": "25.4.0-alpha4",
|
|
42
|
+
"@vaadin/popover": "25.4.0-alpha4",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-alpha4",
|
|
44
44
|
"lit": "^3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@vaadin/aura": "25.4.0-
|
|
48
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
49
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
47
|
+
"@vaadin/aura": "25.4.0-alpha4",
|
|
48
|
+
"@vaadin/chai-plugins": "25.4.0-alpha4",
|
|
49
|
+
"@vaadin/test-runner-commands": "25.4.0-alpha4",
|
|
50
50
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
51
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-alpha4",
|
|
52
52
|
"sinon": "^22.0.0"
|
|
53
53
|
},
|
|
54
54
|
"customElements": "custom-elements.json",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"web-types.json",
|
|
57
57
|
"web-types.lit.json"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "7809e4c099538333a6dbd11d8da18a0c6ec30dad"
|
|
60
60
|
}
|
|
@@ -20,6 +20,8 @@ const closing = new Set();
|
|
|
20
20
|
|
|
21
21
|
let warmedUp = false;
|
|
22
22
|
let warmUpTimeout = null;
|
|
23
|
+
/** The tooltip that opens when the warm up timeout ends. */
|
|
24
|
+
let warmUpTooltip = null;
|
|
23
25
|
let cooldownTimeout = null;
|
|
24
26
|
|
|
25
27
|
/**
|
|
@@ -32,6 +34,7 @@ export function resetGlobalTooltipState() {
|
|
|
32
34
|
clearTimeout(warmUpTimeout);
|
|
33
35
|
clearTimeout(cooldownTimeout);
|
|
34
36
|
warmUpTimeout = null;
|
|
37
|
+
warmUpTooltip = null;
|
|
35
38
|
cooldownTimeout = null;
|
|
36
39
|
closing.clear();
|
|
37
40
|
}
|
|
@@ -144,8 +147,9 @@ class TooltipStateController {
|
|
|
144
147
|
if (warmedUp) {
|
|
145
148
|
// Warmed up, show the tooltip.
|
|
146
149
|
this.__showTooltip();
|
|
147
|
-
} else if (warmUpTimeout == null) {
|
|
148
|
-
// Ensure there is no duplicate warm up.
|
|
150
|
+
} else if (warmUpTimeout == null || !warmUpTooltip.isConnected) {
|
|
151
|
+
// Ensure there is no duplicate warm up, unless its tooltip was removed.
|
|
152
|
+
this.__abortWarmUp();
|
|
149
153
|
this.__scheduleWarmUp(isFocus);
|
|
150
154
|
}
|
|
151
155
|
}
|
|
@@ -177,6 +181,7 @@ class TooltipStateController {
|
|
|
177
181
|
if (warmUpTimeout) {
|
|
178
182
|
clearTimeout(warmUpTimeout);
|
|
179
183
|
warmUpTimeout = null;
|
|
184
|
+
warmUpTooltip = null;
|
|
180
185
|
}
|
|
181
186
|
}
|
|
182
187
|
|
|
@@ -206,10 +211,14 @@ class TooltipStateController {
|
|
|
206
211
|
/** @private */
|
|
207
212
|
__scheduleWarmUp(isFocus) {
|
|
208
213
|
const delay = isFocus ? this.focusDelay : this.hoverDelay;
|
|
214
|
+
warmUpTooltip = this.host;
|
|
209
215
|
warmUpTimeout = setTimeout(() => {
|
|
210
216
|
warmUpTimeout = null;
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
warmUpTooltip = null;
|
|
218
|
+
// Do not open a tooltip that was removed while waiting.
|
|
219
|
+
if (this.host.isConnected) {
|
|
220
|
+
this.__showTooltip();
|
|
221
|
+
}
|
|
213
222
|
}, delay);
|
|
214
223
|
}
|
|
215
224
|
}
|
package/web-types.json
CHANGED