@nkduy/mc-easy-tooltips 0.0.0-stage → 3.6.0
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/LICENSE +373 -0
- package/README.md +346 -2
- package/dist/mc-easy-tooltips.cjs +1 -0
- package/dist/style.css +7 -0
- package/package.json +54 -4
- package/types/mc-easy-tooltips.d.ts +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Mozilla Public License Version 2.0
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
1. Definitions
|
|
5
|
+
--------------
|
|
6
|
+
|
|
7
|
+
1.1. "Contributor"
|
|
8
|
+
means each individual or legal entity that creates, contributes to
|
|
9
|
+
the creation of, or owns Covered Software.
|
|
10
|
+
|
|
11
|
+
1.2. "Contributor Version"
|
|
12
|
+
means the combination of the Contributions of others (if any) used
|
|
13
|
+
by a Contributor and that particular Contributor's Contribution.
|
|
14
|
+
|
|
15
|
+
1.3. "Contribution"
|
|
16
|
+
means Covered Software of a particular Contributor.
|
|
17
|
+
|
|
18
|
+
1.4. "Covered Software"
|
|
19
|
+
means Source Code Form to which the initial Contributor has attached
|
|
20
|
+
the notice in Exhibit A, the Executable Form of such Source Code
|
|
21
|
+
Form, and Modifications of such Source Code Form, in each case
|
|
22
|
+
including portions thereof.
|
|
23
|
+
|
|
24
|
+
1.5. "Incompatible With Secondary Licenses"
|
|
25
|
+
means
|
|
26
|
+
|
|
27
|
+
(a) that the initial Contributor has attached the notice described
|
|
28
|
+
in Exhibit B to the Covered Software; or
|
|
29
|
+
|
|
30
|
+
(b) that the Covered Software was made available under the terms of
|
|
31
|
+
version 1.1 or earlier of the License, but not also under the
|
|
32
|
+
terms of a Secondary License.
|
|
33
|
+
|
|
34
|
+
1.6. "Executable Form"
|
|
35
|
+
means any form of the work other than Source Code Form.
|
|
36
|
+
|
|
37
|
+
1.7. "Larger Work"
|
|
38
|
+
means a work that combines Covered Software with other material, in
|
|
39
|
+
a separate file or files, that is not Covered Software.
|
|
40
|
+
|
|
41
|
+
1.8. "License"
|
|
42
|
+
means this document.
|
|
43
|
+
|
|
44
|
+
1.9. "Licensable"
|
|
45
|
+
means having the right to grant, to the maximum extent possible,
|
|
46
|
+
whether at the time of the initial grant or subsequently, any and
|
|
47
|
+
all of the rights conveyed by this License.
|
|
48
|
+
|
|
49
|
+
1.10. "Modifications"
|
|
50
|
+
means any of the following:
|
|
51
|
+
|
|
52
|
+
(a) any file in Source Code Form that results from an addition to,
|
|
53
|
+
deletion from, or modification of the contents of Covered
|
|
54
|
+
Software; or
|
|
55
|
+
|
|
56
|
+
(b) any new file in Source Code Form that contains any Covered
|
|
57
|
+
Software.
|
|
58
|
+
|
|
59
|
+
1.11. "Patent Claims" of a Contributor
|
|
60
|
+
means any patent claim(s), including without limitation, method,
|
|
61
|
+
process, and apparatus claims, in any patent Licensable by such
|
|
62
|
+
Contributor that would be infringed, but for the grant of the
|
|
63
|
+
License, by the making, using, selling, offering for sale, having
|
|
64
|
+
made, import, or transfer of either its Contributions or its
|
|
65
|
+
Contributor Version.
|
|
66
|
+
|
|
67
|
+
1.12. "Secondary License"
|
|
68
|
+
means either the GNU General Public License, Version 2.0, the GNU
|
|
69
|
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
|
70
|
+
Public License, Version 3.0, or any later versions of those
|
|
71
|
+
licenses.
|
|
72
|
+
|
|
73
|
+
1.13. "Source Code Form"
|
|
74
|
+
means the form of the work preferred for making modifications.
|
|
75
|
+
|
|
76
|
+
1.14. "You" (or "Your")
|
|
77
|
+
means an individual or a legal entity exercising rights under this
|
|
78
|
+
License. For legal entities, "You" includes any entity that
|
|
79
|
+
controls, is controlled by, or is under common control with You. For
|
|
80
|
+
purposes of this definition, "control" means (a) the power, direct
|
|
81
|
+
or indirect, to cause the direction or management of such entity,
|
|
82
|
+
whether by contract or otherwise, or (b) ownership of more than
|
|
83
|
+
fifty percent (50%) of the outstanding shares or beneficial
|
|
84
|
+
ownership of such entity.
|
|
85
|
+
|
|
86
|
+
2. License Grants and Conditions
|
|
87
|
+
--------------------------------
|
|
88
|
+
|
|
89
|
+
2.1. Grants
|
|
90
|
+
|
|
91
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
92
|
+
non-exclusive license:
|
|
93
|
+
|
|
94
|
+
(a) under intellectual property rights (other than patent or trademark)
|
|
95
|
+
Licensable by such Contributor to use, reproduce, make available,
|
|
96
|
+
modify, display, perform, distribute, and otherwise exploit its
|
|
97
|
+
Contributions, either on an unmodified basis, with Modifications, or
|
|
98
|
+
as part of a Larger Work; and
|
|
99
|
+
|
|
100
|
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
|
101
|
+
for sale, have made, import, and otherwise transfer either its
|
|
102
|
+
Contributions or its Contributor Version.
|
|
103
|
+
|
|
104
|
+
2.2. Effective Date
|
|
105
|
+
|
|
106
|
+
The licenses granted in Section 2.1 with respect to any Contribution
|
|
107
|
+
become effective for each Contribution on the date the Contributor first
|
|
108
|
+
distributes such Contribution.
|
|
109
|
+
|
|
110
|
+
2.3. Limitations on Grant Scope
|
|
111
|
+
|
|
112
|
+
The licenses granted in this Section 2 are the only rights granted under
|
|
113
|
+
this License. No additional rights or licenses will be implied from the
|
|
114
|
+
distribution or licensing of Covered Software under this License.
|
|
115
|
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
|
116
|
+
Contributor:
|
|
117
|
+
|
|
118
|
+
(a) for any code that a Contributor has removed from Covered Software;
|
|
119
|
+
or
|
|
120
|
+
|
|
121
|
+
(b) for infringements caused by: (i) Your and any other third party's
|
|
122
|
+
modifications of Covered Software, or (ii) the combination of its
|
|
123
|
+
Contributions with other software (except as part of its Contributor
|
|
124
|
+
Version); or
|
|
125
|
+
|
|
126
|
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
|
127
|
+
its Contributions.
|
|
128
|
+
|
|
129
|
+
This License does not grant any rights in the trademarks, service marks,
|
|
130
|
+
or logos of any Contributor (except as may be necessary to comply with
|
|
131
|
+
the notice requirements in Section 3.4).
|
|
132
|
+
|
|
133
|
+
2.4. Subsequent Licenses
|
|
134
|
+
|
|
135
|
+
No Contributor makes additional grants as a result of Your choice to
|
|
136
|
+
distribute the Covered Software under a subsequent version of this
|
|
137
|
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
|
138
|
+
permitted under the terms of Section 3.3).
|
|
139
|
+
|
|
140
|
+
2.5. Representation
|
|
141
|
+
|
|
142
|
+
Each Contributor represents that the Contributor believes its
|
|
143
|
+
Contributions are its original creation(s) or it has sufficient rights
|
|
144
|
+
to grant the rights to its Contributions conveyed by this License.
|
|
145
|
+
|
|
146
|
+
2.6. Fair Use
|
|
147
|
+
|
|
148
|
+
This License is not intended to limit any rights You have under
|
|
149
|
+
applicable copyright doctrines of fair use, fair dealing, or other
|
|
150
|
+
equivalents.
|
|
151
|
+
|
|
152
|
+
2.7. Conditions
|
|
153
|
+
|
|
154
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
|
155
|
+
in Section 2.1.
|
|
156
|
+
|
|
157
|
+
3. Responsibilities
|
|
158
|
+
-------------------
|
|
159
|
+
|
|
160
|
+
3.1. Distribution of Source Form
|
|
161
|
+
|
|
162
|
+
All distribution of Covered Software in Source Code Form, including any
|
|
163
|
+
Modifications that You create or to which You contribute, must be under
|
|
164
|
+
the terms of this License. You must inform recipients that the Source
|
|
165
|
+
Code Form of the Covered Software is governed by the terms of this
|
|
166
|
+
License, and how they can obtain a copy of this License. You may not
|
|
167
|
+
attempt to alter or restrict the recipients' rights in the Source Code
|
|
168
|
+
Form.
|
|
169
|
+
|
|
170
|
+
3.2. Distribution of Executable Form
|
|
171
|
+
|
|
172
|
+
If You distribute Covered Software in Executable Form then:
|
|
173
|
+
|
|
174
|
+
(a) such Covered Software must also be made available in Source Code
|
|
175
|
+
Form, as described in Section 3.1, and You must inform recipients of
|
|
176
|
+
the Executable Form how they can obtain a copy of such Source Code
|
|
177
|
+
Form by reasonable means in a timely manner, at a charge no more
|
|
178
|
+
than the cost of distribution to the recipient; and
|
|
179
|
+
|
|
180
|
+
(b) You may distribute such Executable Form under the terms of this
|
|
181
|
+
License, or sublicense it under different terms, provided that the
|
|
182
|
+
license for the Executable Form does not attempt to limit or alter
|
|
183
|
+
the recipients' rights in the Source Code Form under this License.
|
|
184
|
+
|
|
185
|
+
3.3. Distribution of a Larger Work
|
|
186
|
+
|
|
187
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
|
188
|
+
provided that You also comply with the requirements of this License for
|
|
189
|
+
the Covered Software. If the Larger Work is a combination of Covered
|
|
190
|
+
Software with a work governed by one or more Secondary Licenses, and the
|
|
191
|
+
Covered Software is not Incompatible With Secondary Licenses, this
|
|
192
|
+
License permits You to additionally distribute such Covered Software
|
|
193
|
+
under the terms of such Secondary License(s), so that the recipient of
|
|
194
|
+
the Larger Work may, at their option, further distribute the Covered
|
|
195
|
+
Software under the terms of either this License or such Secondary
|
|
196
|
+
License(s).
|
|
197
|
+
|
|
198
|
+
3.4. Notices
|
|
199
|
+
|
|
200
|
+
You may not remove or alter the substance of any license notices
|
|
201
|
+
(including copyright notices, patent notices, disclaimers of warranty,
|
|
202
|
+
or limitations of liability) contained within the Source Code Form of
|
|
203
|
+
the Covered Software, except that You may alter any license notices to
|
|
204
|
+
the extent required to remedy known factual inaccuracies.
|
|
205
|
+
|
|
206
|
+
3.5. Application of Additional Terms
|
|
207
|
+
|
|
208
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
|
209
|
+
indemnity or liability obligations to one or more recipients of Covered
|
|
210
|
+
Software. However, You may do so only on Your own behalf, and not on
|
|
211
|
+
behalf of any Contributor. You must make it absolutely clear that any
|
|
212
|
+
such warranty, support, indemnity, or liability obligation is offered by
|
|
213
|
+
You alone, and You hereby agree to indemnify every Contributor for any
|
|
214
|
+
liability incurred by such Contributor as a result of warranty, support,
|
|
215
|
+
indemnity or liability terms You offer. You may include additional
|
|
216
|
+
disclaimers of warranty and limitations of liability specific to any
|
|
217
|
+
jurisdiction.
|
|
218
|
+
|
|
219
|
+
4. Inability to Comply Due to Statute or Regulation
|
|
220
|
+
---------------------------------------------------
|
|
221
|
+
|
|
222
|
+
If it is impossible for You to comply with any of the terms of this
|
|
223
|
+
License with respect to some or all of the Covered Software due to
|
|
224
|
+
statute, judicial order, or regulation then You must: (a) comply with
|
|
225
|
+
the terms of this License to the maximum extent possible; and (b)
|
|
226
|
+
describe the limitations and the code they affect. Such description must
|
|
227
|
+
be placed in a text file included with all distributions of the Covered
|
|
228
|
+
Software under this License. Except to the extent prohibited by statute
|
|
229
|
+
or regulation, such description must be sufficiently detailed for a
|
|
230
|
+
recipient of ordinary skill to be able to understand it.
|
|
231
|
+
|
|
232
|
+
5. Termination
|
|
233
|
+
--------------
|
|
234
|
+
|
|
235
|
+
5.1. The rights granted under this License will terminate automatically
|
|
236
|
+
if You fail to comply with any of its terms. However, if You become
|
|
237
|
+
compliant, then the rights granted under this License from a particular
|
|
238
|
+
Contributor are reinstated (a) provisionally, unless and until such
|
|
239
|
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
|
240
|
+
ongoing basis, if such Contributor fails to notify You of the
|
|
241
|
+
non-compliance by some reasonable means prior to 60 days after You have
|
|
242
|
+
come back into compliance. Moreover, Your grants from a particular
|
|
243
|
+
Contributor are reinstated on an ongoing basis if such Contributor
|
|
244
|
+
notifies You of the non-compliance by some reasonable means, this is the
|
|
245
|
+
first time You have received notice of non-compliance with this License
|
|
246
|
+
from such Contributor, and You become compliant prior to 30 days after
|
|
247
|
+
Your receipt of the notice.
|
|
248
|
+
|
|
249
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
|
250
|
+
infringement claim (excluding declaratory judgment actions,
|
|
251
|
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
|
252
|
+
directly or indirectly infringes any patent, then the rights granted to
|
|
253
|
+
You by any and all Contributors for the Covered Software under Section
|
|
254
|
+
2.1 of this License shall terminate.
|
|
255
|
+
|
|
256
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
|
257
|
+
end user license agreements (excluding distributors and resellers) which
|
|
258
|
+
have been validly granted by You or Your distributors under this License
|
|
259
|
+
prior to termination shall survive termination.
|
|
260
|
+
|
|
261
|
+
************************************************************************
|
|
262
|
+
* *
|
|
263
|
+
* 6. Disclaimer of Warranty *
|
|
264
|
+
* ------------------------- *
|
|
265
|
+
* *
|
|
266
|
+
* Covered Software is provided under this License on an "as is" *
|
|
267
|
+
* basis, without warranty of any kind, either expressed, implied, or *
|
|
268
|
+
* statutory, including, without limitation, warranties that the *
|
|
269
|
+
* Covered Software is free of defects, merchantable, fit for a *
|
|
270
|
+
* particular purpose or non-infringing. The entire risk as to the *
|
|
271
|
+
* quality and performance of the Covered Software is with You. *
|
|
272
|
+
* Should any Covered Software prove defective in any respect, You *
|
|
273
|
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
|
274
|
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
|
275
|
+
* essential part of this License. No use of any Covered Software is *
|
|
276
|
+
* authorized under this License except under this disclaimer. *
|
|
277
|
+
* *
|
|
278
|
+
************************************************************************
|
|
279
|
+
|
|
280
|
+
************************************************************************
|
|
281
|
+
* *
|
|
282
|
+
* 7. Limitation of Liability *
|
|
283
|
+
* -------------------------- *
|
|
284
|
+
* *
|
|
285
|
+
* Under no circumstances and under no legal theory, whether tort *
|
|
286
|
+
* (including negligence), contract, or otherwise, shall any *
|
|
287
|
+
* Contributor, or anyone who distributes Covered Software as *
|
|
288
|
+
* permitted above, be liable to You for any direct, indirect, *
|
|
289
|
+
* special, incidental, or consequential damages of any character *
|
|
290
|
+
* including, without limitation, damages for lost profits, loss of *
|
|
291
|
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
|
292
|
+
* and all other commercial damages or losses, even if such party *
|
|
293
|
+
* shall have been informed of the possibility of such damages. This *
|
|
294
|
+
* limitation of liability shall not apply to liability for death or *
|
|
295
|
+
* personal injury resulting from such party's negligence to the *
|
|
296
|
+
* extent applicable law prohibits such limitation. Some *
|
|
297
|
+
* jurisdictions do not allow the exclusion or limitation of *
|
|
298
|
+
* incidental or consequential damages, so this exclusion and *
|
|
299
|
+
* limitation may not apply to You. *
|
|
300
|
+
* *
|
|
301
|
+
************************************************************************
|
|
302
|
+
|
|
303
|
+
8. Litigation
|
|
304
|
+
-------------
|
|
305
|
+
|
|
306
|
+
Any litigation relating to this License may be brought only in the
|
|
307
|
+
courts of a jurisdiction where the defendant maintains its principal
|
|
308
|
+
place of business and such litigation shall be governed by laws of that
|
|
309
|
+
jurisdiction, without reference to its conflict-of-law provisions.
|
|
310
|
+
Nothing in this Section shall prevent a party's ability to bring
|
|
311
|
+
cross-claims or counter-claims.
|
|
312
|
+
|
|
313
|
+
9. Miscellaneous
|
|
314
|
+
----------------
|
|
315
|
+
|
|
316
|
+
This License represents the complete agreement concerning the subject
|
|
317
|
+
matter hereof. If any provision of this License is held to be
|
|
318
|
+
unenforceable, such provision shall be reformed only to the extent
|
|
319
|
+
necessary to make it enforceable. Any law or regulation which provides
|
|
320
|
+
that the language of a contract shall be construed against the drafter
|
|
321
|
+
shall not be used to construe this License against a Contributor.
|
|
322
|
+
|
|
323
|
+
10. Versions of the License
|
|
324
|
+
---------------------------
|
|
325
|
+
|
|
326
|
+
10.1. New Versions
|
|
327
|
+
|
|
328
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
|
329
|
+
10.3, no one other than the license steward has the right to modify or
|
|
330
|
+
publish new versions of this License. Each version will be given a
|
|
331
|
+
distinguishing version number.
|
|
332
|
+
|
|
333
|
+
10.2. Effect of New Versions
|
|
334
|
+
|
|
335
|
+
You may distribute the Covered Software under the terms of the version
|
|
336
|
+
of the License under which You originally received the Covered Software,
|
|
337
|
+
or under the terms of any subsequent version published by the license
|
|
338
|
+
steward.
|
|
339
|
+
|
|
340
|
+
10.3. Modified Versions
|
|
341
|
+
|
|
342
|
+
If you create software not governed by this License, and you want to
|
|
343
|
+
create a new license for such software, you may create and use a
|
|
344
|
+
modified version of this License if you rename the license and remove
|
|
345
|
+
any references to the name of the license steward (except to note that
|
|
346
|
+
such modified license differs from this License).
|
|
347
|
+
|
|
348
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
|
349
|
+
Licenses
|
|
350
|
+
|
|
351
|
+
If You choose to distribute Source Code Form that is Incompatible With
|
|
352
|
+
Secondary Licenses under the terms of this version of the License, the
|
|
353
|
+
notice described in Exhibit B of this License must be attached.
|
|
354
|
+
|
|
355
|
+
Exhibit A - Source Code Form License Notice
|
|
356
|
+
-------------------------------------------
|
|
357
|
+
|
|
358
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
|
359
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
360
|
+
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
361
|
+
|
|
362
|
+
If it is not possible or desirable to put the notice in a particular
|
|
363
|
+
file, then You may include the notice in a location (such as a LICENSE
|
|
364
|
+
file in a relevant directory) where a recipient would be likely to look
|
|
365
|
+
for such a notice.
|
|
366
|
+
|
|
367
|
+
You may add additional accurate notices of copyright ownership.
|
|
368
|
+
|
|
369
|
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
370
|
+
---------------------------------------------------------
|
|
371
|
+
|
|
372
|
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
373
|
+
defined by the Mozilla Public License, v. 2.0.
|
package/README.md
CHANGED
|
@@ -1,3 +1,347 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nkduy/mc-easy-tooltips
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lightweight, zero-dependency tooltip library using modern JavaScript and CSS.
|
|
4
|
+
Just add `data-easy-tooltip` to any element! No setup or config required.
|
|
5
|
+
|
|
6
|
+
[**Live Demo**](https://mc-easy-tooltips.web.app/)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
* No dependencies
|
|
11
|
+
* Works with mouse, touch, and keyboard focus
|
|
12
|
+
* Customizable via CSS variables
|
|
13
|
+
* Gradient and image backgrounds and borders
|
|
14
|
+
* Automatically repositions and shifts to fit the screen
|
|
15
|
+
* Smooth, non-interrupting animations with smart skip-delay between adjacent tooltips
|
|
16
|
+
* Anchor to the trigger element, the cursor, or where the user first hovered
|
|
17
|
+
* Plain text or arbitrary HTML content
|
|
18
|
+
* Seamless body + arrow drawn as a single SVG path
|
|
19
|
+
* Compatible with Vue, React, Svelte, and more
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Install via npm
|
|
24
|
+
```bash
|
|
25
|
+
npm install @nkduy/mc-easy-tooltips
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import "@nkduy/mc-easy-tooltips/styles.css"
|
|
30
|
+
import "@nkduy/mc-easy-tooltips"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Or use via CDN
|
|
34
|
+
https://www.jsdelivr.com/package/npm/@nkduy/mc-easy-tooltips
|
|
35
|
+
|
|
36
|
+
### Add tooltips to your HTML
|
|
37
|
+
```html
|
|
38
|
+
<button data-easy-tooltip="Click to save your changes">Save</button>
|
|
39
|
+
<span data-easy-tooltip="This field is required">Username *</span>
|
|
40
|
+
<div data-easy-tooltip="Multi-line tooltips are supported too">Info</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Multi-line text uses ` ` (newline). For full HTML content see [Custom HTML](#custom-html) below.
|
|
44
|
+
|
|
45
|
+
No additional setup is needed for Vue, React, Svelte, or other frameworks! Tooltips automatically update when the element updates!
|
|
46
|
+
|
|
47
|
+
Tooltips also show on keyboard focus. Natively focusable elements (buttons, links, inputs) work automatically; for other elements (such as a `<div>` or `<span>`), add `tabindex="0"` so they can receive focus.
|
|
48
|
+
|
|
49
|
+
## Advanced Usage
|
|
50
|
+
|
|
51
|
+
### Custom HTML
|
|
52
|
+
You can render custom HTML inside a tooltip using `data-easy-tooltip-src`. The value can be a CSS selector or the literal keywords `next`/`prev`.
|
|
53
|
+
|
|
54
|
+
The matched element's content is copied into the tooltip.
|
|
55
|
+
|
|
56
|
+
**Using a CSS selector**
|
|
57
|
+
Point to any element in the document. The value is matched by id first, then as a CSS selector, so `tip-shipping` and `#tip-shipping` both work.
|
|
58
|
+
```html
|
|
59
|
+
<button data-easy-tooltip-src="#tip-shipping">Shipping info</button>
|
|
60
|
+
<template id="tip-shipping">
|
|
61
|
+
<strong>Free shipping</strong> on orders over £50<br>
|
|
62
|
+
Delivered in 2 to 4 working days
|
|
63
|
+
</template>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Using `next` or `prev`**
|
|
67
|
+
Use `next` to automatically pull content from the next DOM element, or `prev` for the previous one.
|
|
68
|
+
The source element is automatically hidden.
|
|
69
|
+
```html
|
|
70
|
+
<button data-easy-tooltip-src="next">Ingredients</button>
|
|
71
|
+
<div>
|
|
72
|
+
<ul>
|
|
73
|
+
<li>Oats</li>
|
|
74
|
+
<li>Honey</li>
|
|
75
|
+
<li>Sea salt</li>
|
|
76
|
+
</ul>
|
|
77
|
+
</div>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Custom tooltip classes
|
|
81
|
+
For styling specific tooltips, add `data-easy-tooltip-class`. The value is applied as a class on the generated tooltip:
|
|
82
|
+
```html
|
|
83
|
+
<button data-easy-tooltip="Saved!" data-easy-tooltip-class="success-tooltip">Save</button>
|
|
84
|
+
<button data-easy-tooltip="This cannot be undone!" data-easy-tooltip-class="danger-tooltip bold-tooltip">Delete</button>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```css
|
|
88
|
+
.success-tooltip {
|
|
89
|
+
--easy-tooltip-background-color: #f0fdf4;
|
|
90
|
+
--easy-tooltip-border-color: #27ae60;
|
|
91
|
+
--easy-tooltip-text-color: #27ae60;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.danger-tooltip {
|
|
95
|
+
--easy-tooltip-background-color: #fef2f2;
|
|
96
|
+
--easy-tooltip-border-color: #e74c3c;
|
|
97
|
+
--easy-tooltip-text-color: #e74c3c;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.bold-tooltip {
|
|
101
|
+
font-weight: bold;
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Per-tooltip styling
|
|
106
|
+
For a one-off tweak that doesn't warrant a class, `data-easy-tooltip-style` writes inline styles (typically the CSS variables below) straight onto that tooltip, just like the HTML `style` attribute:
|
|
107
|
+
```html
|
|
108
|
+
<div data-easy-tooltip="Pill shaped, just for me" data-easy-tooltip-style="--easy-tooltip-border-radius: 999px;">?</div>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The attribute is observed, so changing it while the tooltip is visible re-renders it live.
|
|
112
|
+
|
|
113
|
+
### Preferred side
|
|
114
|
+
Use `data-easy-tooltip-prefer` to control which side a tooltip shows on. It still flips to the opposite side when there isn't room. Using `left` or `right` switches the tooltip to horizontal mode.
|
|
115
|
+
|
|
116
|
+
* `above` (default): show above, fall back to below
|
|
117
|
+
* `below`: show below, fall back to above
|
|
118
|
+
* `left`: show to the left, fall back to the right
|
|
119
|
+
* `right`: show to the right, fall back to the left
|
|
120
|
+
* `entry`: show on whichever edge of the trigger the cursor crossed on the way in. The side is locked in as you enter, so it stays right even when you move fast. Keyboard focus has no entry point, so it falls back to `above`
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<button data-easy-tooltip="Shows below" data-easy-tooltip-prefer="below">Hover me</button>
|
|
124
|
+
<button data-easy-tooltip="Shows on the right" data-easy-tooltip-prefer="right">Hover me</button>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Anchor modes
|
|
128
|
+
By default a tooltip is anchored to its trigger element. Use `data-easy-tooltip-anchor` to change the anchor point:
|
|
129
|
+
|
|
130
|
+
* `element` (default): anchored to the trigger's bounding box.
|
|
131
|
+
* `cursor`: anchored to the cursor (or touch point), follows the cursor as it moves around the element. On touch, the tooltip appears at the tap point and tracks the finger if you drag.
|
|
132
|
+
* `pin`: pins to the point on the trigger's nearest edge to the cursor when the tooltip appears, so coming in from the left pins it to the left edge at the height you are at. The side defaults to `entry`, and setting `data-easy-tooltip-prefer` overrides that while keeping the pinned position. If the tooltip is delayed, it pins where the cursor ends up rather than where it entered, and it keeps tracking the page as you scroll.
|
|
133
|
+
|
|
134
|
+
`cursor` and `pin` also come in single axis versions, which take one axis from the cursor and the other from the trigger's bounding box:
|
|
135
|
+
|
|
136
|
+
* `cursor-x` and `pin-x`: horizontally on the cursor, vertically on the trigger
|
|
137
|
+
* `cursor-y` and `pin-y`: vertically on the cursor, horizontally on the trigger
|
|
138
|
+
|
|
139
|
+
The axis versions of `pin` freeze the cursor position on that axis rather than snapping to an edge.
|
|
140
|
+
|
|
141
|
+
```html
|
|
142
|
+
<div data-easy-tooltip="I follow your cursor" data-easy-tooltip-anchor="cursor">…</div>
|
|
143
|
+
<div data-easy-tooltip="I stay where you first hovered" data-easy-tooltip-anchor="pin">…</div>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Keyboard focus has no coordinates and automatically falls back to element anchoring.
|
|
147
|
+
|
|
148
|
+
### Holding while interacting
|
|
149
|
+
A tooltip stays open while you are pressing its trigger, even once the pointer leaves it. This means that dragging a slider keeps its tooltip up until you let go, instead of losing it as soon as the cursor leaves the track.
|
|
150
|
+
|
|
151
|
+
This happens automatically when the press lands on a control: `input`, `select`, `textarea`, `button`, or anything with a `button`, `slider`, `checkbox`, `radio`, or `switch` role. The control can be the trigger itself, or sit inside it.
|
|
152
|
+
|
|
153
|
+
Use `data-easy-tooltip-hold` to turn it on for anything else, and `data-easy-tooltip-hold="false"` to turn it off for a control:
|
|
154
|
+
```html
|
|
155
|
+
<div data-easy-tooltip="I stay while you drag me" data-easy-tooltip-hold>…</div>
|
|
156
|
+
<button data-easy-tooltip="I hide as soon as you leave" data-easy-tooltip-hold="false">Press me</button>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The tooltip hides when you release, unless the pointer is back over the trigger by then.
|
|
160
|
+
|
|
161
|
+
### Dismissing on click
|
|
162
|
+
`data-easy-tooltip-dismiss` hides the tooltip when its trigger is clicked, and keeps it hidden until the pointer leaves the trigger. It takes priority over holding. Touch is not affected, since a tap is how a tooltip is shown there.
|
|
163
|
+
|
|
164
|
+
Unlike the other attributes, it is inherited, so putting it on `<html>` turns it on for every tooltip on the page. Use `data-easy-tooltip-dismiss="false"` to turn it off for one trigger:
|
|
165
|
+
```html
|
|
166
|
+
<html data-easy-tooltip-dismiss>
|
|
167
|
+
…
|
|
168
|
+
<button data-easy-tooltip="Copied!" data-easy-tooltip-dismiss="false">Copy</button>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Events
|
|
172
|
+
Tooltips fire events on their trigger element. They bubble, so you can listen on `document`.
|
|
173
|
+
|
|
174
|
+
* `easy-tooltip-open`: the tooltip appeared
|
|
175
|
+
* `easy-tooltip-close`: the tooltip started hiding
|
|
176
|
+
* `easy-tooltip-move`: the tooltip changed where it is attached
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
document.addEventListener("easy-tooltip-open", e => {
|
|
180
|
+
console.log(e.detail.side, e.detail.point)
|
|
181
|
+
})
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Every event has the same `detail`:
|
|
185
|
+
|
|
186
|
+
* `trigger`: the element the tooltip belongs to
|
|
187
|
+
* `tooltip`: the tooltip element
|
|
188
|
+
* `text`: the tooltip text
|
|
189
|
+
* `side`: `above`, `below`, `left`, or `right`
|
|
190
|
+
* `inside`: `true` when the tooltip did not fit on any side, so it floats over the trigger without an arrow. `side` still reports the side it is using
|
|
191
|
+
* `anchor`: the anchor mode in use, `element` unless the tooltip was opened by pointer
|
|
192
|
+
* `anchorRect`: the box the tooltip is anchored to. For cursor and pin anchoring this is a zero size box at the anchor point
|
|
193
|
+
* `point`: the point on the anchor that the tooltip points at
|
|
194
|
+
* `rect`: the box of the tooltip itself
|
|
195
|
+
* `previous`: on `move`, the same placement values from before the change
|
|
196
|
+
|
|
197
|
+
All coordinates are viewport coordinates, the same as `getBoundingClientRect`. TypeScript users get the event names and the `detail` typed automatically, and the types are exported if you need them:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import type { TooltipEvent, TooltipEventDetail, TooltipSide, TooltipAnchor } from "@nkduy/mc-easy-tooltips"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`open` fires when the tooltip actually appears, after any delay, so a hover too brief to show a tooltip fires nothing at all.
|
|
204
|
+
|
|
205
|
+
`move` fires when the tooltip flips to another side, and when its anchor point moves, for example while scrolling or when using cursor anchoring. Flips are sent straight away. Anchor point changes are limited to one event every 100ms, so cursor anchoring does not spam.
|
|
206
|
+
|
|
207
|
+
## Customization
|
|
208
|
+
|
|
209
|
+
You can style tooltips using CSS variables (recommended) or by targeting the tooltip classes directly. Note that some CSS variables are required for proper positioning:
|
|
210
|
+
|
|
211
|
+
```css
|
|
212
|
+
:root {
|
|
213
|
+
/* Tooltip appearance */
|
|
214
|
+
--easy-tooltip-background-color: #fff; /* Background color */
|
|
215
|
+
--easy-tooltip-text-color: #000; /* Text color */
|
|
216
|
+
--easy-tooltip-border-color: #aaa; /* Border color */
|
|
217
|
+
--easy-tooltip-border-size: 1px; /* Border thickness */
|
|
218
|
+
--easy-tooltip-background: none; /* Background image/gradient, replaces the background color */
|
|
219
|
+
--easy-tooltip-border: none; /* Border image/gradient, replaces the border color */
|
|
220
|
+
--easy-tooltip-border-radius: 4px; /* Corner radius, clamped to half the tooltip like CSS, so a large value gives a pill */
|
|
221
|
+
--easy-tooltip-padding: 8px 12px; /* Inner padding */
|
|
222
|
+
--easy-tooltip-max-width: 100%; /* Maximum tooltip width */
|
|
223
|
+
|
|
224
|
+
/* Positioning */
|
|
225
|
+
--easy-tooltip-distance: 16px; /* Distance from trigger element */
|
|
226
|
+
--easy-tooltip-viewport-padding: 16px; /* Minimum distance from screen edges */
|
|
227
|
+
--easy-tooltip-arrow-size: 16px; /* Arrow size (height defaults to width / 2; 0 to disable) */
|
|
228
|
+
--easy-tooltip-arrow-size: 16px 8px; /* Or specify arrow width and height separately */
|
|
229
|
+
--easy-tooltip-arrow-edge-buffer-x: 12px; /* Minimum arrow gap from where the border radius starts (for above or below tooltips) */
|
|
230
|
+
--easy-tooltip-arrow-edge-buffer-y: 6px; /* Minimum arrow gap from where the border radius starts (for left or right tooltips) */
|
|
231
|
+
--easy-tooltip-arrow-radius: 0; /* Border radius of the arrow tip */
|
|
232
|
+
|
|
233
|
+
/* Animation */
|
|
234
|
+
--easy-tooltip-animation-length: 0.15s; /* Duration of fade animation */
|
|
235
|
+
--easy-tooltip-animation-distance: 4px; /* Distance the tooltip slides in */
|
|
236
|
+
--easy-tooltip-delay: 0s; /* Base delay before the tooltip shows; always added */
|
|
237
|
+
--easy-tooltip-inactive-delay: 0.15s; /* Extra delay when no tooltip was recently active; drops to 0 once a tooltip is showing */
|
|
238
|
+
--easy-tooltip-cooldown: 0.15s; /* How long after the last tooltip closes before the inactive-delay applies again */
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Image backgrounds and borders
|
|
243
|
+
|
|
244
|
+
`--easy-tooltip-background` and `--easy-tooltip-border` accept any CSS `<image>`: gradients or `url()` images. Both follow the tooltip shape, arrow included, and replace the flat background/border colors when set.
|
|
245
|
+
|
|
246
|
+
```css
|
|
247
|
+
.fancy-tooltip {
|
|
248
|
+
--easy-tooltip-background: linear-gradient(135deg, #667eea, #764ba2);
|
|
249
|
+
--easy-tooltip-border: linear-gradient(135deg, #f0f, #0ff);
|
|
250
|
+
--easy-tooltip-border-size: 2px;
|
|
251
|
+
--easy-tooltip-text-color: #fff;
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
They can also be set per element with data attributes, which take priority over the variables:
|
|
256
|
+
|
|
257
|
+
```html
|
|
258
|
+
<button data-easy-tooltip="Photo background" data-easy-tooltip-background="url('photo.jpg')">Hover me</button>
|
|
259
|
+
<button data-easy-tooltip="Gradient border" data-easy-tooltip-border="linear-gradient(135deg, #f0f, #0ff)">Hover me</button>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Show delay and quick-switch
|
|
263
|
+
Easy-tooltips uses a two-part delay so that the first tooltip waits, but switching between adjacent tooltips feels instant:
|
|
264
|
+
|
|
265
|
+
* On the first hover, the tooltip waits `delay + inactive-delay` (`0 + 0.15s` by default) before showing. This protects against accidental hovers.
|
|
266
|
+
* Once a tooltip has fully appeared, all subsequent tooltips skip the inactive-delay and show in just `delay` (`0s` by default, i.e. instantly).
|
|
267
|
+
* When all tooltips have been closed for `cooldown` (`0.15s` by default), behaviour resets to "first hover" again.
|
|
268
|
+
|
|
269
|
+
Each part is its own variable so you can tune them independently. For example, a slow, deliberate tooltip with a long initial wait but instant skip:
|
|
270
|
+
|
|
271
|
+
```css
|
|
272
|
+
.slow-tooltip {
|
|
273
|
+
--easy-tooltip-inactive-delay: 1s;
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Or a permanent delay regardless of recent activity (e.g. a 500ms reveal on every tooltip):
|
|
278
|
+
|
|
279
|
+
```css
|
|
280
|
+
.always-slow-tooltip {
|
|
281
|
+
--easy-tooltip-delay: 500ms;
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Advanced customization
|
|
286
|
+
|
|
287
|
+
The tooltip body and arrow are drawn as a single SVG path, so anything beyond the variables can be done by targeting the path directly with SVG-flavored CSS. `.easy-tooltip-bg` is the SVG element; `.easy-tooltip-bg path` is the path that draws the outline and fill.
|
|
288
|
+
|
|
289
|
+
#### Borders
|
|
290
|
+
|
|
291
|
+
The border is the SVG path's `stroke`, so any stroke property works:
|
|
292
|
+
|
|
293
|
+
```css
|
|
294
|
+
/* Dashed border */
|
|
295
|
+
.dashed-tooltip .easy-tooltip-bg path {
|
|
296
|
+
stroke-dasharray: 5 3;
|
|
297
|
+
stroke-linecap: round;
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### Backgrounds
|
|
302
|
+
|
|
303
|
+
For gradient or image backgrounds, use `--easy-tooltip-background` (see [Image backgrounds and borders](#image-backgrounds-and-borders)). Alternatively, the path's `fill` accepts any SVG paint server declared in the document, referenced by id:
|
|
304
|
+
|
|
305
|
+
```html
|
|
306
|
+
<svg width="0" height="0" style="position:absolute" aria-hidden="true">
|
|
307
|
+
<defs>
|
|
308
|
+
<linearGradient id="brand-gradient" x1="0" y1="0" x2="1" y2="1">
|
|
309
|
+
<stop offset="0%" stop-color="#3498db"/>
|
|
310
|
+
<stop offset="100%" stop-color="#9b59b6"/>
|
|
311
|
+
</linearGradient>
|
|
312
|
+
</defs>
|
|
313
|
+
</svg>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
```css
|
|
317
|
+
.gradient-tooltip .easy-tooltip-bg path {
|
|
318
|
+
fill: url(#brand-gradient);
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The same approach works for `stroke` (an alternative to `--easy-tooltip-border`), and for radial, conic, or pattern paint servers.
|
|
323
|
+
|
|
324
|
+
For a drop shadow that follows the full body + arrow shape, apply a filter to the SVG element:
|
|
325
|
+
|
|
326
|
+
```css
|
|
327
|
+
.shadow-tooltip .easy-tooltip-bg {
|
|
328
|
+
filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## How it works
|
|
333
|
+
|
|
334
|
+
Easy-tooltips uses a smart positioning system that:
|
|
335
|
+
|
|
336
|
+
1. **Picks a side** - Shows on the preferred side (above by default, or below/left/right) and flips to the opposite side when there isn't room
|
|
337
|
+
2. **Keeps it on screen** - Shifts the tooltip along its edge (horizontally for above/below, vertically for left/right) so it stays within the viewport while the arrow keeps pointing at the element
|
|
338
|
+
3. **Falls back gracefully** - When a tooltip can't fit on either side, it pins inside the viewport instead of overflowing
|
|
339
|
+
4. **Manages animations** - Queues tooltip updates to prevent conflicts and flicker on rapid hover
|
|
340
|
+
5. **Skips the delay when grazing** - The first hover waits a short delay to ignore accidental movement, but once any tooltip is showing, switching to adjacent tooltips is instant until you stop hovering for the cooldown period
|
|
341
|
+
6. **Stacks newest on top** - When multiple tooltips are visible at once, the most recently activated one renders above the others. When triggers are nested, only the innermost one shows
|
|
342
|
+
7. **Always paints above everything** - The tooltip container lives in the browser's top layer (via the Popover API), so tooltips render above any z-index, no matter how large, and re-promote themselves above modal dialogs and fullscreen elements when activated. Falls back to a high z-index in browsers without popover support
|
|
343
|
+
8. **Cleans up** - Removes a tooltip automatically when its trigger element leaves the DOM
|
|
344
|
+
|
|
345
|
+
## License
|
|
346
|
+
|
|
347
|
+
[MPL-2.0](LICENSE) © NKDuy
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";{let ge=function(h){h.style.width="";const z=h.getBoundingClientRect(),I=Math.round(z.height);if(z.width<=0||I<=0)return;const lt=Math.ceil(z.width);h.style.maxWidth="none",h.style.width="max-content";const V=Math.ceil(h.getBoundingClientRect().width);if(h.style.maxWidth="",V<=lt){h.style.width="";return}h.style.minWidth="0",h.style.width="min-content";const W=h.getBoundingClientRect(),F=Math.ceil(W.width),$=Math.round(W.height)<=I;if(h.style.minWidth="",$){h.style.width=`${F}px`;return}let A=F+1,Q=lt+1,S=lt;for(;A<=Q;){const L=Math.floor((A+Q)/2);h.style.width=`${L}px`,Math.round(h.getBoundingClientRect().height)<=I?(S=L,Q=L-1):A=L+1}h.style.width=`${S}px`},Zt=function(){const h=document.createElement("div");h.id="easy-tooltips",document.body.append(h);const z=!!h.showPopover;function I(){if(!(!z||h.matches(":popover-open")))try{h.showPopover()}catch{}}function lt(){if(z){try{h.matches(":popover-open")&&h.hidePopover()}catch{}I()}}z&&(h.popover="manual",I(),h.addEventListener("toggle",t=>{t.newState==="closed"&&requestAnimationFrame(I)}));let V,W,F,$,A,Q,S,L,St,Ct,ct,Ot=0,gt=0,ye=0;const _e=100,ve="input, select, textarea, button, [role=button], [role=slider], [role=checkbox], [role=radio], [role=switch]";let B;function Ut(t){lt(),t._activated=!0,oe(t);const e=t._trigger;if(e&&$!==void 0){const{pin:a,entry:d}=te(e);(a||d)&&(Jt(e,a,d),N())}Ot++,clearTimeout(Ct),h.classList.add("easy-tooltips-active"),t.style.zIndex=String(++ye),$e()}function Kt(t){t._activated&&(t._activated=!1,oe(t),--Ot<=0&&(Ot=0,clearTimeout(Ct),Ct=setTimeout(()=>h.classList.remove("easy-tooltips-active"),bt(getComputedStyle(document.documentElement).getPropertyValue("--easy-tooltip-cooldown")))))}const et=new Set;function be(t){var a,d;const e=t._tooltip;e&&(clearTimeout(e._moveTimer),t===B&&(B=void 0),e._dispatched&&(e._dispatched=!1,vt(e,"close")),e.classList.contains("easy-tooltip-visible")&>--,clearTimeout(e._timeout),clearTimeout(e._activateTimer),Kt(e),e.remove()),(a=t._observer)==null||a.disconnect(),(d=t._sourceObserver)==null||d.disconnect(),t._observer=t._sourceObserver=void 0,et.delete(t),t._tooltip=t._tooltipText=t._svgPath=t._clipPath=t._foreignObj=t._surfaceDiv=t._borderMask=t._borderMaskPath=t._borderForeignObj=t._borderSurfaceDiv=t._tooltipClass=t._source=t._anchorPoint=t._anchorSide=void 0,t===V&&(V=void 0)}let kt;new MutationObserver(t=>{kt||!t.some(e=>e.removedNodes.length)||(kt=!0,queueMicrotask(()=>{kt=!1;for(const e of et)e.isConnected||be(e)}))}).observe(document.body,{childList:!0,subtree:!0});let yt;function Gt(){if(yt=0,F&&$!==void 0){const t=document.elementFromPoint($,A);for(const e of et){const a=e._tooltip;a&&!a._held&&a.classList.contains("easy-tooltip-visible")&&e!==t&&!e.contains(t)&&k(a,!1)}}gt>0&&(yt=requestAnimationFrame(Gt))}function $e(){yt||(yt=requestAnimationFrame(Gt))}function _t(t){return t!=null&&t.endsWith("-x")?"x":t!=null&&t.endsWith("-y")?"y":"both"}function Vt(t){return t==null?void 0:t.replace(/-[xy]$/,"")}function Ft(t,e){S=$,L=A,$=t,A=e}function we(t){if(S===void 0)return;const e=$-S,a=A-L;let d,c=1/0;const g=(T,f,w,R,C)=>{f<0||f>1||f>=c||w<R||w>C||(c=f,d=T)};return e>0&&S<t.left&&g("left",(t.left-S)/e,L+a*((t.left-S)/e),t.top,t.bottom),e<0&&S>t.right&&g("right",(t.right-S)/e,L+a*((t.right-S)/e),t.top,t.bottom),a>0&&L<t.top&&g("above",(t.top-L)/a,S+e*((t.top-L)/a),t.left,t.right),a<0&&L>t.bottom&&g("below",(t.bottom-L)/a,S+e*((t.bottom-L)/a),t.left,t.right),d}function Jt(t,e,a){const d=_t(t.dataset.easyTooltipAnchor);if((a||e&&d==="both")&&t._anchorSide===void 0){const f=t.getBoundingClientRect(),w={left:$-f.left,right:f.right-$,above:A-f.top,below:f.bottom-A};t._anchorSide=we(f)??Object.keys(w).reduce((R,C)=>w[C]<w[R]?C:R)}if(!e)return;let c=$,g=A;const T=t._anchorSide;if(T&&d==="both"){const f=t.getBoundingClientRect(),w=(R,C,Z)=>Math.min(Math.max(R,C),Z);c=T==="left"?f.left:T==="right"?f.right:w($,f.left,f.right),g=T==="above"?f.top:T==="below"?f.bottom:w(A,f.top,f.bottom)}t._anchorPoint={x:c+window.scrollX,y:g+window.scrollY}}function te(t){const e=t.dataset.easyTooltipPrefer,a=Vt(t.dataset.easyTooltipAnchor)==="pin"&&W,d=a&&_t(t.dataset.easyTooltipAnchor)==="both";return{preferAttr:e,pin:a,entry:W&&(e==="entry"||!e&&d)}}function ee(t){return{x:t.left,y:t.top,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}}function vt(t,e,a){var g;const d=t._trigger;if(!d)return;const c=t._placement;c&&(t._reported=c),d.dispatchEvent(new CustomEvent(`easy-tooltip-${e}`,{bubbles:!0,composed:!0,detail:{trigger:d,tooltip:t,text:((g=d._tooltipText)==null?void 0:g.textContent)??"",side:c==null?void 0:c.side,inside:(c==null?void 0:c.inside)??!1,anchor:(c==null?void 0:c.anchor)??"element",anchorRect:c==null?void 0:c.anchorRect,point:c==null?void 0:c.point,rect:ee(t.getBoundingClientRect()),previous:a}}))}function Pe(t){const e=t._reported,a=t._placement;if(!e||!a)return;const d=e.side!==a.side||e.inside!==a.inside||e.anchor!==a.anchor;if(!d&&e.point.x===a.point.x&&e.point.y===a.point.y)return;const c=performance.now(),g=d?0:_e-(c-(t._moveAt??0));if(g<=0){clearTimeout(t._moveTimer),t._moveTimer=void 0,t._moveAt=c,vt(t,"move",e);return}t._moveTimer||(t._moveTimer=setTimeout(()=>{t._moveTimer=void 0,!(!t._dispatched||!t._reported||!t._placement)&&(t._moveAt=performance.now(),vt(t,"move",t._reported))},g))}function oe(t){t._dispatchQueued||(t._dispatchQueued=!0,queueMicrotask(()=>{t._dispatchQueued=!1;const e=!!t._activated;e!==!!t._dispatched&&(t._dispatched=e,clearTimeout(t._moveTimer),t._moveTimer=void 0,t._moveAt=e?performance.now():void 0,vt(t,e?"open":"close"))}))}function bt(t){t=t.trim();const e=parseFloat(t);return t.endsWith("ms")?e:e*1e3}function k(t,e){const a=getComputedStyle(t),d=bt(a.getPropertyValue("--easy-tooltip-animation-length"));if(e){const c=bt(a.getPropertyValue("--easy-tooltip-delay"))+bt(a.getPropertyValue("--easy-tooltip-inactive-delay"));c&&(t._start=performance.now(),t._delay=c),t._animation_duration=d+c}else{if(t._delay&&performance.now()<Number(t._start)+t._delay){t.classList.contains("easy-tooltip-visible")&>--,t.classList.remove("easy-tooltip-visible"),t._trigger&&(t._trigger._anchorSide=t._trigger._anchorPoint=void 0),clearTimeout(t._timeout),clearTimeout(t._activateTimer),t._timeout=t._activateTimer=t._start=t._delay=void 0;return}t._animation_duration=d}if(t.classList.contains("easy-tooltip-visible")===e){t._next=void 0;return}t._timeout===void 0?(t._next=void 0,t.classList.toggle("easy-tooltip-visible",e),e&&(t._hold=t._clampArmed=void 0),!e&&t._trigger&&(t._trigger._anchorSide=t._trigger._anchorPoint=void 0),gt+=e?1:-1,clearTimeout(t._activateTimer),t._activateTimer=void 0,e?t._delay?t._activateTimer=setTimeout(()=>{t._activateTimer=void 0,Ut(t)},t._delay):Ut(t):Kt(t),t._timeout=setTimeout(()=>{t._timeout=void 0,t._next!==void 0&&k(t,t._next)},t._animation_duration)):t._next=e}function ie(t){return t.transform!=="none"||t.translate!=="none"||t.rotate!=="none"||t.scale!=="none"||t.perspective!=="none"||t.filter!=="none"||t.backdropFilter!=="none"||/paint|layout|strict|content/.test(t.contain)||/transform|translate|rotate|scale|perspective|filter/.test(t.willChange)}function Ae(t){const e=t.getBoundingClientRect();let a=e.left,d=e.top,c=e.right,g=e.bottom,T=getComputedStyle(t).position,f=t.parentElement;for(;f&&f!==document.body;){const w=getComputedStyle(f);if(T==="fixed"?ie(w):T==="absolute"?w.position!=="static"||ie(w):!0){const C=w.overflowX!=="visible",Z=w.overflowY!=="visible";if(C||Z){const U=f.getBoundingClientRect();C&&(a=Math.max(a,U.left),c=Math.min(c,U.right)),Z&&(d=Math.max(d,U.top),g=Math.min(g,U.bottom))}T=w.position}f=f.parentElement}return{x:a,y:d,left:a,top:d,right:c,bottom:g,width:c-a,height:g-d}}function se(){var t,e,a,d,c,g,T,f,w,R,C,Z,U,ce;if(Q=!1,V){const K=h.getBoundingClientRect();h.style.setProperty("--easy-tooltip-view-width",((visualViewport==null?void 0:visualViewport.width)??document.documentElement.clientWidth)+"px");const ut=[];let u=V;for(;u&&u!==document.body;){if(ut.length)u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1);else if(u._dismissed)u._tooltip&&k(u._tooltip,!1);else if(u.dataset.easyTooltip)(t=u._sourceObserver)==null||t.disconnect(),u._sourceObserver=u._source=void 0,ut.push(u);else if(u.dataset.easyTooltipSrc){const G=u.dataset.easyTooltipSrc,wt=u._source;if(G==="next")u._source=u.nextElementSibling??void 0;else if(G==="prev")u._source=u.previousElementSibling??void 0;else try{u._source=(document.getElementById(G)||document.querySelector(G))??void 0}catch{}wt!==u._source&&u._sourceObserver&&(u._sourceObserver.disconnect(),u._sourceObserver=void 0),u._source?ut.push(u):u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1)}else u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1);u=u.parentElement}for(let G=ut.length;G--;){let wt=function(n,r,l,i,E,y,x){const P=l/2-Y/2-y-Dt,b=i+H,M=i+E-H;let p=0,D=0;return n<b?(p=Math.min(b-n,P),n+p<b&&(D=b-(n+p))):r>M&&(p=-Math.min(r-M,P),r+p>M&&(D=-(r+p-M))),p&&v!==void 0&&(v.style.translate=x?`0 ${p}px`:`${p}px`),qt=D,p},Te=function(n,r,l,i,E,y,x,P,b){const M=E/2,p=b*Math.SQRT1_2;if(n==="above"){const q=b>0?`L${x+p} ${l+y-p}A${b} ${b} 0 0 1 ${x-p} ${l+y-p}`:`L${x} ${l+y}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${x+M}${q}L${x-M} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}if(n==="below"){const q=b>0?`L${x-p} ${-y+p}A${b} ${b} 0 0 1 ${x+p} ${-y+p}`:`L${x} ${-y}`;return`M${i} 0H${x-M}${q}L${x+M} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}if(n==="right"){const q=b>0?`L${-y+p} ${P+p}A${b} ${b} 0 0 1 ${-y+p} ${P-p}`:`L${-y} ${P}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${P+M}${q}L0 ${P-M}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}const D=b>0?`L${r+y-p} ${P-p}A${b} ${b} 0 0 1 ${r+y-p} ${P+p}`:`L${r+y} ${P}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${P-M}${D}L${r} ${P+M}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`};const o=ut[G];let s=o._tooltip,v=o._tooltipText;if(!s||!v){s=document.createElement("div"),s.className="easy-tooltip easy-tooltip-setup",s._trigger=o,o._tooltip=s;const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.classList.add("easy-tooltip-bg"),n.setAttribute("aria-hidden","true");const r=document.createElementNS("http://www.w3.org/2000/svg","defs"),l=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),i="easy-tooltip-clip-"+Math.random().toString(36).substring(2,9);l.id=i;const E=document.createElementNS("http://www.w3.org/2000/svg","path");l.append(E),r.append(l),o._clipPath=E;const y=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");y.setAttribute("clip-path",`url(#${i})`);const x=document.createElement("div");x.className="easy-tooltip-surface",y.append(x),o._foreignObj=y,o._surfaceDiv=x;const P=document.createElementNS("http://www.w3.org/2000/svg","mask"),b="easy-tooltip-mask-"+Math.random().toString(36).substring(2,9);P.id=b,P.setAttribute("maskUnits","userSpaceOnUse");const M=document.createElementNS("http://www.w3.org/2000/svg","path");P.append(M),r.append(P),o._borderMask=P,o._borderMaskPath=M;const p=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");p.setAttribute("mask",`url(#${b})`);const D=document.createElement("div");D.className="easy-tooltip-surface",p.append(D),o._borderForeignObj=p,o._borderSurfaceDiv=D;const q=document.createElementNS("http://www.w3.org/2000/svg","path");o._svgPath=q,n.append(r,y,q,p),v=document.createElement("div"),v.className="easy-tooltip-text",o._tooltipText=v,s.append(n,v),h.append(s)}const de=s.style.zIndex;s.style.cssText=o.dataset.easyTooltipStyle??"",de&&(s.style.zIndex=de);const Pt=o.dataset.easyTooltipClass;o._tooltipClass!==Pt&&(o._tooltipClass&&s.classList.remove(...o._tooltipClass.trim().split(/\s+/)),Pt&&s.classList.add(...Pt.trim().split(/\s+/)),o._tooltipClass=Pt),o._source?(v.replaceChildren(...o._source.cloneNode(!0).childNodes),v.classList.add("easy-tooltip-text-html")):(v.textContent=o.dataset.easyTooltip??null,v.classList.remove("easy-tooltip-text-html"));const At=o.dataset.easyTooltipAnchor,J=_t(At),ft=Vt(At)==="cursor"&&W,{preferAttr:xe,pin:Tt,entry:jt}=te(o);ft&&(Q=!0);const Me=(n,r,l)=>Math.min(Math.max(n,r),l),Le=(n,r)=>At?r:((!s._hold||s._hold.axis!==n)&&(s._hold={axis:n,pos:r}),s._hold.pos);(Tt||jt)&&!s._activated&&o._anchorSide===void 0&&o._anchorPoint===void 0&&Jt(o,Tt,jt);let m;if(ft||Tt&&o._anchorPoint){const n=ft?$:o._anchorPoint.x-window.scrollX,r=ft?A:o._anchorPoint.y-window.scrollY,l=J==="both"?null:o.getBoundingClientRect();m={left:J==="y"?l.left:n,right:J==="y"?l.right:n,width:J==="y"?l.width:0,top:J==="x"?l.top:r,bottom:J==="x"?l.bottom:r,height:J==="x"?l.height:0}}else m=Ae(o);const j=getComputedStyle(s),ot=parseFloat(j.getPropertyValue("--easy-tooltip-distance")),H=parseFloat(j.getPropertyValue("--easy-tooltip-viewport-padding")),Wt=j.getPropertyValue("--easy-tooltip-arrow-size").trim().split(/\s+/),Y=parseFloat(Wt[0]),xt=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-x")),Ht=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-y")),Dt=parseFloat(j.getPropertyValue("--easy-tooltip-border-radius"))||0;s.style.minWidth=`${xt*2+Y}px`,v.style.minHeight="";const Mt=Math.min(Dt,v.getBoundingClientRect().height/2);s.style.minWidth=`${xt*2+Y+Mt*2}px`;const pt=K.left+((visualViewport==null?void 0:visualViewport.offsetLeft)??0),Nt=K.top+((visualViewport==null?void 0:visualViewport.offsetTop)??0),Xt=(visualViewport==null?void 0:visualViewport.width)??document.documentElement.clientWidth,Yt=(visualViewport==null?void 0:visualViewport.height)??document.documentElement.clientHeight,it=jt?o._anchorSide:xe,ue=Math.round(m.right-pt+ot-H),fe=Math.round(pt+Xt-m.left+ot-H);s.style.translate="",s.style.removeProperty("--easy-tooltip-left-offset"),s.style.removeProperty("--easy-tooltip-right-offset"),v.style.translate="",v.style.width="",s.classList.remove("easy-tooltip-below","easy-tooltip-inside","easy-tooltip-left","easy-tooltip-right");let _,tt;if(it==="left"||it==="right"){s.style.minWidth=`${Mt*2}px`,v.style.width="min-content",v.style.minWidth="0";const n=s.getBoundingClientRect().width;v.style.width="",v.style.minWidth="";for(const r of[it,it==="left"?"right":"left"])if(!((r==="left"?m.left-pt-ot-H:pt+Xt-m.right-ot-H)<n)&&(s.classList.remove("easy-tooltip-left","easy-tooltip-right"),s.classList.add("easy-tooltip-"+r),r==="right"?(s.style.setProperty("--easy-tooltip-left-offset",`${ue}px`),s.style.removeProperty("--easy-tooltip-right-offset")):(s.style.setProperty("--easy-tooltip-right-offset",`${fe}px`),s.style.removeProperty("--easy-tooltip-left-offset")),s.getBoundingClientRect().height<=Yt-H*2)){_=r;break}_||(_=it,tt=!0)}else{const{height:n}=s.getBoundingClientRect(),r=Math.round(m.top),l=r-n-ot>Nt+H,i=r+m.height+n+ot<Nt+Yt-H;it==="below"?_=i?"below":l?"above":"below":_=l?"above":i?"below":"above",tt=!l&&!i}s.classList.remove("easy-tooltip-below","easy-tooltip-inside","easy-tooltip-left","easy-tooltip-right"),s.style.removeProperty("--easy-tooltip-left-offset"),s.style.removeProperty("--easy-tooltip-right-offset"),s.style.top="",s.style.left="",_!=="above"&&s.classList.add("easy-tooltip-"+_),tt&&s.classList.add("easy-tooltip-inside"),tt||(_==="right"?s.style.setProperty("--easy-tooltip-left-offset",`${ue}px`):_==="left"&&s.style.setProperty("--easy-tooltip-right-offset",`${fe}px`)),ge(v),s.classList.remove("easy-tooltip-setup");let pe=!0;if(F&&$!==void 0){const n=document.elementFromPoint($,A);pe=!!n&&(o===n||o.contains(n))}k(s,pe||!!s._held),_==="left"||_==="right"?v.style.minHeight=`${Ht*2+Y+Mt*2}px`:v.style.minHeight=`${Mt*2}px`;let O,qt=0,zt;const Ee=F&&$!==void 0,Se=!!s._held||!Ee||$>=m.left&&$<=m.right&&A>=m.top&&A<=m.bottom,he=(n,r,l,i)=>{const E=Le(n,r);if(!Se)return E;const y=Me(E,l,i);return y===E?(s._clampArmed=!1,E):s._clampArmed?(s._hold&&(s._hold.pos=y),y):(s._clampArmed=!0,E)};if(_==="left"||_==="right"){const n=Math.round(he("y",m.top+m.height/2,m.top,m.bottom));zt={x:Math.round(_==="right"?m.right:m.left),y:n},tt||(s.style.left=`${Math.round(_==="right"?m.right:m.left)-K.left}px`);const r=s.getBoundingClientRect().height;O=wt(n-r/2,n+r/2,r,Nt,Yt,Ht,!0),s.style.top=`${n-K.top+qt}px`}else{const n=Math.round(he("x",m.left+m.width/2,m.left,m.right)),r=Math.round(m.top);zt={x:n,y:Math.round(_==="below"?m.bottom:m.top)},tt||(s.style.top=_==="above"?`${r-K.top}px`:`${r+m.height-K.top}px`);const l=s.getBoundingClientRect().width;O=wt(n-l/2,n+l/2,l,pt,Xt,xt,!1),s.style.left=`${n-K.left+qt}px`}const{width:st,height:rt}=v.getBoundingClientRect(),ht=Wt[1]?parseFloat(Wt[1]):Y/2,Ce=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-radius"))||0,mt=_==="left"||_==="right",Oe=mt?st/2:st/2-O,ke=mt?rt/2-O:rt/2,Ve=mt?(rt-Y-Ht*2)/2:(st-Y-xt*2)/2,Fe=Math.max(0,Math.min(Dt,st/2,rt/2,Ve)),It=Te(_,st,rt,Fe,Y,ht,Oe,ke,Ce);if((e=o._svgPath)==null||e.setAttribute("d",It),(a=o._clipPath)==null||a.setAttribute("d",It),(d=o._borderMaskPath)==null||d.setAttribute("d",It),O){const n=mt?`translate(0 ${O})`:`translate(${O} 0)`;(c=o._svgPath)==null||c.setAttribute("transform",n),(g=o._clipPath)==null||g.setAttribute("transform",n),(T=o._borderMaskPath)==null||T.setAttribute("transform",n)}else(f=o._svgPath)==null||f.removeAttribute("transform"),(w=o._clipPath)==null||w.removeAttribute("transform"),(R=o._borderMaskPath)==null||R.removeAttribute("transform");const me=o.dataset.easyTooltipBackground||j.getPropertyValue("--easy-tooltip-background").trim(),Qt=o.dataset.easyTooltipBorder||j.getPropertyValue("--easy-tooltip-border").trim();let nt=0,Lt=st,at=0,Et=rt;if(_==="left"?Lt+=ht:_==="right"?nt-=ht:_==="above"?Et+=ht:_==="below"&&(at-=ht),O&&(mt?(at+=Math.min(0,O),Et+=Math.max(0,O)):(nt+=Math.min(0,O),Lt+=Math.max(0,O))),me&&o._surfaceDiv&&o._foreignObj?(o._foreignObj.setAttribute("x",`${nt}`),o._foreignObj.setAttribute("y",`${at}`),o._foreignObj.setAttribute("width",`${Lt-nt}`),o._foreignObj.setAttribute("height",`${Et-at}`),o._surfaceDiv.style.width="100%",o._surfaceDiv.style.height="100%",o._surfaceDiv.style.background=me,o._foreignObj.style.display="",(C=o._svgPath)==null||C.style.setProperty("fill","none")):o._foreignObj&&(o._foreignObj.style.display="none",(Z=o._svgPath)==null||Z.style.removeProperty("fill")),Qt&&Qt!=="none"&&o._borderMask&&o._borderSurfaceDiv&&o._borderForeignObj){const r=(parseFloat(j.getPropertyValue("--easy-tooltip-border-size"))||0)*2,l=nt-r,i=at-r,E=Lt-nt+r*2,y=Et-at+r*2;o._borderMask.setAttribute("x",`${l}`),o._borderMask.setAttribute("y",`${i}`),o._borderMask.setAttribute("width",`${E}`),o._borderMask.setAttribute("height",`${y}`),o._borderForeignObj.setAttribute("x",`${l}`),o._borderForeignObj.setAttribute("y",`${i}`),o._borderForeignObj.setAttribute("width",`${E}`),o._borderForeignObj.setAttribute("height",`${y}`),o._borderSurfaceDiv.style.width="100%",o._borderSurfaceDiv.style.height="100%",o._borderSurfaceDiv.style.background=Qt,o._borderForeignObj.style.display="",(U=o._svgPath)==null||U.style.setProperty("stroke","none")}else o._borderForeignObj&&(o._borderForeignObj.style.display="none",(ce=o._svgPath)==null||ce.style.removeProperty("stroke"));const Be=ee(m);if(s._trigger=o,s._placement={side:_,inside:!!tt,anchor:ft||Tt?At:"element",anchorRect:Be,point:zt},s._dispatched&&Pe(s),!o._observer){const n=new MutationObserver(()=>N());n.observe(o,{attributes:!0,attributeFilter:["data-easy-tooltip","data-easy-tooltip-src","data-easy-tooltip-background","data-easy-tooltip-border","data-easy-tooltip-style"]}),o._observer=n}if(et.add(o),o._source&&!o._sourceObserver){const n=new MutationObserver(()=>N());n.observe(o._source,{childList:!0,subtree:!0,characterData:!0}),o._sourceObserver=n}}}}function re(t,e=!1){for(;t&&t!==document.body;)t._tooltip&&!t._tooltip._held&&(e||!t.matches(":hover"))&&k(t._tooltip,!1),t=t.parentElement??void 0}let Bt,$t;function dt(t){if(Bt){$t=t;return}Bt=!0,t(),queueMicrotask(()=>{if(Bt=!1,$t){const e=$t;$t=null,dt(e)}})}function N(){dt(se)}function Rt(t,e=!1){dt(()=>{re(V,e),V=t.target??void 0,se()})}let X=0;function ne(t){const e=t.touches[0];return e?(Ft(e.clientX,e.clientY),!0):!1}function ae(){const t=B;if(!t)return;B=void 0;const e=t._tooltip;e&&(e._held=!1,t.matches(":hover")||k(e,!1))}document.addEventListener("pointerdown",t=>{var c,g,T;ae();let e=t.target;for(;e&&e!==document.body&&!e._tooltip;)e=e.parentElement;if(!(e!=null&&e._tooltip))return;const a=(c=e.closest("[data-easy-tooltip-dismiss]"))==null?void 0:c.getAttribute("data-easy-tooltip-dismiss");if(t.pointerType!=="touch"&&a!==void 0&&a!=="false"){const f=e;f._dismissed=!0,k(f._tooltip,!1),f.addEventListener("pointerleave",()=>f._dismissed=!1,{once:!0});return}const d=e.dataset.easyTooltipHold;d!=="false"&&(d===void 0&&!((T=(g=t.target)==null?void 0:g.closest)!=null&&T.call(g,ve))||(B=e,e._tooltip._held=!0))});for(const t of["pointerup","pointercancel"])window.addEventListener(t,ae);document.addEventListener("touchstart",t=>{X=performance.now(),ct=!1,W=!0,F=!1,ne(t),t.target!==V&&Rt(t,!0)}),document.addEventListener("touchmove",t=>{X=performance.now(),ne(t)&&le()}),document.addEventListener("mouseover",t=>{X&&performance.now()-X<700||(ct=!1,W=!0,F=!0,Ft(t.clientX,t.clientY),Rt(t))});function le(){let t;for(const e of et){const a=e.dataset.easyTooltipAnchor;if(Vt(a)!=="cursor"||!e._tooltip)continue;const d=_t(a);t??(t=h.getBoundingClientRect()),d!=="x"&&(e._tooltip.style.top=`${A-t.top}px`),d!=="y"&&(e._tooltip.style.left=`${$-t.left}px`)}Q&&!St&&(St=!0,requestAnimationFrame(()=>{St=!1,N()}))}document.addEventListener("mousemove",t=>{X&&performance.now()-X<700||(F=!0,Ft(t.clientX,t.clientY),le())}),document.addEventListener("focusin",t=>{if(!(X&&performance.now()-X<700)){if(ct){ct=!1;return}W=!1,F=!1,Rt(t)}}),document.addEventListener("focusout",t=>{dt(()=>{t.target&&re(t.target)})}),window.addEventListener("blur",()=>{B!=null&&B._tooltip&&(B._tooltip._held=!1),B=void 0,ct=document.activeElement!==document.body,dt(()=>{V=void 0;for(const t of et)t._tooltip&&k(t._tooltip,!1)})}),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),visualViewport==null||visualViewport.addEventListener("resize",N),visualViewport==null||visualViewport.addEventListener("scroll",N)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Zt):Zt()}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nkduy/mc-easy-tooltips
|
|
3
|
+
* Version : 3.6.0
|
|
4
|
+
* License : MPL-2.0
|
|
5
|
+
* Copyright: 2026 NKDuy
|
|
6
|
+
*/
|
|
7
|
+
:root{--easy-tooltip-padding: 8px 12px;--easy-tooltip-animation-distance: 4px}@property --easy-tooltip-distance{syntax: "<length>"; inherits: true; initial-value: 16px;}@property --easy-tooltip-arrow-size{syntax: "<length>+"; inherits: true; initial-value: 16px;}@property --easy-tooltip-arrow-edge-buffer-x{syntax: "<length>"; inherits: true; initial-value: 12px;}@property --easy-tooltip-arrow-edge-buffer-y{syntax: "<length>"; inherits: true; initial-value: 6px;}@property --easy-tooltip-viewport-padding{syntax: "<length>"; inherits: true; initial-value: 16px;}@property --easy-tooltip-border-size{syntax: "<length>"; inherits: true; initial-value: 1px;}@property --easy-tooltip-border-radius{syntax: "<length>"; inherits: true; initial-value: 4px;}@property --easy-tooltip-animation-length{syntax: "<time>"; inherits: true; initial-value: .15s;}@property --easy-tooltip-delay{syntax: "<time>"; inherits: true; initial-value: 0s;}@property --easy-tooltip-inactive-delay{syntax: "<time>"; inherits: true; initial-value: .15s;}@property --easy-tooltip-cooldown{syntax: "<time>"; inherits: true; initial-value: .15s;}@property --easy-tooltip-background-color{syntax: "<color>"; inherits: true; initial-value: #fff;}@property --easy-tooltip-text-color{syntax: "<color>"; inherits: true; initial-value: #000;}@property --easy-tooltip-border-color{syntax: "<color>"; inherits: true; initial-value: #aaa;}@property --easy-tooltip-arrow-radius{syntax: "<length-percentage>"; inherits: true; initial-value: 0;}@property --easy-tooltip-max-width{syntax: "<length-percentage>"; inherits: true; initial-value: 100%;}@property --easy-tooltip-background{syntax: "<image>"; inherits: true; initial-value: none;}@property --easy-tooltip-border{syntax: "<image>"; inherits: true; initial-value: none;}#easy-tooltips{z-index:99999;position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;-webkit-user-select:none;user-select:none}#easy-tooltips[popover]{display:block!important;position:fixed!important;top:0!important;right:0!important;bottom:0!important;left:0!important;width:auto!important;height:auto!important;margin:0!important;border:none!important;padding:0!important;background:none!important;overflow:visible!important}.easy-tooltip{position:fixed;transform:translate(-50%,calc(-100% - var(--easy-tooltip-distance)));opacity:0;transition:opacity var(--easy-tooltip-animation-length),translate var(--easy-tooltip-animation-length);translate:0 var(--easy-tooltip-animation-distance);max-width:min(var(--easy-tooltip-view-width, 100%) - var(--easy-tooltip-viewport-padding) * 2 - var(--easy-tooltip-left-offset, 0px) - var(--easy-tooltip-right-offset, 0px),var(--easy-tooltip-max-width, 100%))}.easy-tooltip.easy-tooltip-setup{transition:none}#easy-tooltips.easy-tooltips-active{--easy-tooltip-inactive-delay: 0s}.easy-tooltip.easy-tooltip-below{transform:translate(-50%,var(--easy-tooltip-distance))}.easy-tooltip.easy-tooltip-inside{top:var(--easy-tooltip-viewport-padding);transform:translate(-50%)}.easy-tooltip.easy-tooltip-inside.easy-tooltip-below{top:auto;bottom:var(--easy-tooltip-viewport-padding)}.easy-tooltip.easy-tooltip-inside.easy-tooltip-left{left:var(--easy-tooltip-viewport-padding);right:auto;transform:translateY(-50%)}.easy-tooltip.easy-tooltip-inside.easy-tooltip-right{left:auto;right:var(--easy-tooltip-viewport-padding);transform:translateY(-50%)}.easy-tooltip-bg{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;overflow:visible!important}.easy-tooltip-bg path{fill:var(--easy-tooltip-background-color);stroke:var(--easy-tooltip-border-color);stroke-width:var(--easy-tooltip-border-size)}.easy-tooltip-bg mask path{fill:none;stroke:#fff;stroke-width:var(--easy-tooltip-border-size)}.easy-tooltip.easy-tooltip-right{transform:translate(var(--easy-tooltip-distance),-50%)}.easy-tooltip.easy-tooltip-left{transform:translate(calc(-100% - var(--easy-tooltip-distance)),-50%)}.easy-tooltip.easy-tooltip-right{translate:calc(var(--easy-tooltip-animation-distance) * -1) 0}.easy-tooltip.easy-tooltip-left{translate:var(--easy-tooltip-animation-distance) 0}.easy-tooltip.easy-tooltip-visible{opacity:1;translate:0;transition-delay:calc(var(--easy-tooltip-delay) + var(--easy-tooltip-inactive-delay))}.easy-tooltip-text{display:flex;flex-direction:column;justify-content:center;position:relative;z-index:1;width:max-content;max-width:100%;padding:var(--easy-tooltip-padding);color:var(--easy-tooltip-text-color);text-align:center;box-sizing:border-box;min-width:100%;border-radius:var(--easy-tooltip-border-radius);overflow:hidden}.easy-tooltip-text:not(.easy-tooltip-text-html){white-space:pre-line}[data-easy-tooltip-src=next]+*,*:has(+[data-easy-tooltip-src=prev]){display:none!important}@media (prefers-reduced-motion){*{--easy-tooltip-animation-distance: 0px !important}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkduy/mc-easy-tooltips",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "3.6.0",
|
|
4
|
+
"description": "A lightweight, zero-dependency tooltip library using modern JavaScript and CSS.",
|
|
5
|
+
"author": "NKDuy",
|
|
6
|
+
"license": "MPL-2.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/mc-easy-tooltips.min.js",
|
|
9
|
+
"style": "./dist/mc-easy-tooltips.min.css",
|
|
10
|
+
"types": "./types/mc-easy-tooltips.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./types/mc-easy-tooltips.d.ts",
|
|
14
|
+
"default": "./dist/mc-easy-tooltips.min.js"
|
|
15
|
+
},
|
|
16
|
+
"./styles.css": "./dist/mc-easy-tooltips.min.css"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"types"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/khanhduy1407/McTitleGen.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/khanhduy1407/McTitleGen/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://mc-easy-tooltips.web.app/",
|
|
30
|
+
"keywords": [
|
|
31
|
+
"tooltip",
|
|
32
|
+
"tooltips",
|
|
33
|
+
"popover",
|
|
34
|
+
"hover",
|
|
35
|
+
"css",
|
|
36
|
+
"lightweight",
|
|
37
|
+
"zero-dependency",
|
|
38
|
+
"data-attribute",
|
|
39
|
+
"vanilla-js",
|
|
40
|
+
"javascript",
|
|
41
|
+
"title",
|
|
42
|
+
"ui",
|
|
43
|
+
"framework-agnostic",
|
|
44
|
+
"keyboard",
|
|
45
|
+
"positioning"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "lahm build",
|
|
49
|
+
"dev": "lahm dev"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^26.1.1",
|
|
53
|
+
"typescript": "^7.0.2",
|
|
54
|
+
"lahm": "^5.0.5"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type TooltipSide = "above" | "below" | "left" | "right"
|
|
2
|
+
|
|
3
|
+
export type TooltipAnchor =
|
|
4
|
+
| "element"
|
|
5
|
+
| "cursor"
|
|
6
|
+
| "cursor-x"
|
|
7
|
+
| "cursor-y"
|
|
8
|
+
| "pin"
|
|
9
|
+
| "pin-x"
|
|
10
|
+
| "pin-y"
|
|
11
|
+
|
|
12
|
+
export interface TooltipRect {
|
|
13
|
+
x: number
|
|
14
|
+
y: number
|
|
15
|
+
width: number
|
|
16
|
+
height: number
|
|
17
|
+
top: number
|
|
18
|
+
right: number
|
|
19
|
+
bottom: number
|
|
20
|
+
left: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface TooltipPoint {
|
|
24
|
+
x: number
|
|
25
|
+
y: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface TooltipPlacement {
|
|
29
|
+
/** The side of the anchor the tooltip is on */
|
|
30
|
+
side: TooltipSide
|
|
31
|
+
/** True when the tooltip did not fit on any side, so it floats over the trigger without an arrow */
|
|
32
|
+
inside: boolean
|
|
33
|
+
/** The anchor mode in use, `element` unless the tooltip was opened by pointer */
|
|
34
|
+
anchor: TooltipAnchor
|
|
35
|
+
/** The box the tooltip is anchored to. A zero size box at the anchor point for cursor and pin anchoring */
|
|
36
|
+
anchorRect: TooltipRect
|
|
37
|
+
/** The point on the anchor that the tooltip points at */
|
|
38
|
+
point: TooltipPoint
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface TooltipEventDetail extends TooltipPlacement {
|
|
42
|
+
/** The element the tooltip belongs to */
|
|
43
|
+
trigger: HTMLElement
|
|
44
|
+
/** The tooltip element */
|
|
45
|
+
tooltip: HTMLElement
|
|
46
|
+
/** The tooltip text */
|
|
47
|
+
text: string
|
|
48
|
+
/** The box of the tooltip itself */
|
|
49
|
+
rect: TooltipRect
|
|
50
|
+
/** The placement from before the change, on `easy-tooltip-move` only */
|
|
51
|
+
previous?: TooltipPlacement
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type TooltipEvent = CustomEvent<TooltipEventDetail>
|
|
55
|
+
|
|
56
|
+
export interface TooltipEventMap {
|
|
57
|
+
"easy-tooltip-open": TooltipEvent
|
|
58
|
+
"easy-tooltip-close": TooltipEvent
|
|
59
|
+
"easy-tooltip-move": TooltipEvent
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare global {
|
|
63
|
+
interface HTMLElementEventMap extends TooltipEventMap {}
|
|
64
|
+
interface DocumentEventMap extends TooltipEventMap {}
|
|
65
|
+
interface WindowEventMap extends TooltipEventMap {}
|
|
66
|
+
}
|