gibbu / svooltip Goto Github PK
View Code? Open in Web Editor NEWA basic Svelte tooltip directive.
Home Page: https://svooltip.vercel.app
License: MIT License
A basic Svelte tooltip directive.
Home Page: https://svooltip.vercel.app
License: MIT License
I would like to use HTML formatted strings in the tooltip content but not sure how to do so.
If that's not possible yet, I would like to request it as an optional param e.g. format: "raw" | "html"
that will internally use Svelte's {@html ... }
Hi again!
It seems like the format: 'html'
is broken in the latest version(s).
Here is a StackBlitz repro:
https://stackblitz.com/edit/sveltejs-kit-template-default-f5rdtj?file=src/routes/+page.svelte
I added the HTML tooltip from the doc site to the "Welcome" image. As you can see, it is not parsed correctly.
Let me know if I need to provide additional information.
Hi!
After updating from 0.3.0 to 0.4.2 I am unable to import the default styling.
Both import 'svooltip/styles.css';
and import 'svooltip/svooltip.css';
gives me:
1:35:06 PM [vite] Internal server error: Missing "./styles.css" export in "svooltip" package
I am using a pretty standard svelte kit setup with tailwindcss and postcss enabled.
Let me know if I can provide more details.
System:
OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Xeon(R) Platinum 8268 CPU @ 2.90GHz
Memory: 24.23 GB / 31.33 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 18.11.0 - ~/.local/share/pnpm/node
npm: 8.19.2 - ~/.local/share/pnpm/npm
Browsers:
Firefox: 107.0
npmPackages:
@sveltejs/adapter-node: 1.0.0-next.104 => 1.0.0-next.104
@sveltejs/kit: 1.0.0-next.583 => 1.0.0-next.583
@tailwindcss/forms: ^0.5.3 => 0.5.3
@types/sharp: ^0.31.0 => 0.31.0
@typescript-eslint/eslint-plugin: ^5.46.0 => 5.46.0
@typescript-eslint/parser: ^5.46.0 => 5.46.0
autoprefixer: ^10.4.13 => 10.4.13
eslint: ^8.29.0 => 8.29.0
eslint-config-prettier: ^8.5.0 => 8.5.0
eslint-plugin-svelte3: ^4.0.0 => 4.0.0
postcss: ^8.4.20 => 8.4.20
prettier: ^2.8.1 => 2.8.1
prettier-plugin-svelte: ^2.9.0 => 2.9.0
sharp: ^0.31.2 => 0.31.2
svelte: ^3.54.0 => 3.54.0
svelte-check: ^2.10.2 => 2.10.2
svooltip: ^0.4.2 => 0.4.2
tailwindcss: ^3.2.4 => 3.2.4
tslib: ^2.4.1 => 2.4.1
typescript: ^4.9.4 => 4.9.4
vite: ^4.0.0 => 4.0.0
I tested using the data-placement param in .scss file, but it seems like it is not working. I tried the following code:
.svooltip[data-placement='top'] {
--svooltip-bg: white;
border: 1px solid red;
}
.svooltip[data-placement='bottom'] {
--svooltip-bg: black;
border: 1px solid blue;
}
For me it seems like a bug, or do I do something wrong?
Dear @Gibbu , Thank you so much for this minimalistic tooltip, I love it! 😃
In our project, we use Sass and try to optimize the css output. Svooltip currently provides the basic styling only as css. Because of that, no matter how we @use oder @import the styles, we will always have some default values in our delivered css. For example the value var(--svooltip-bg, #444)
will be delivered no matter what.
We would like to avoid that. That´s why I would be glad to get the styles in Sass already.
I think, it fits quite well to the minimalistic approach, because sass is already a dependency of the Svooltip project. So its just a little refactoring, not really adding anything new.
I will implement that myself and make a pull request.
The package.json file of this library doesn't define any export condition for svelte, due to which this warning is shown.
[vite-plugin-svelte] WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.
See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition for details.
Here is repl with example:
https://svelte.dev/repl/f7d1f23c84294dd581402ef5016015c6?version=3.58.0
You can reproduce this bug with rapid clicking on the button:
The problem seems that in between any await wait
, or await animate
svelte can destroy the tooltip target node.
There is no way in Svelte to optionally use the use
direction. I would like to conditionally show/hide my tooltip, but currently there is no way to do that. The package leaves behind "arrow" element when content
is null
.
Would it be possible to either add new option to enable/disable the tooltip or simply don't show the tooltip when content
is null
?
Rapid pointer movement over a tooltipped element causes the tooltip to stay displayed forever.
The delay parameter only delays displaying the tooltip, but the event is always fired.
hi!
thanks for creating svooltip, I use it in nearly all of my svelte projects.
sometimes, I find that it would have been useful to different content in the tooltip depending on how long it has been hovered.
say that first you could display:
<username>
but after for example 1 seconds, the content would change to:
<username>
<status>
<bio>
<email>
I hope you get my idea, if not I would be happy to expand on this
Hello there!
I really enjoy this library, although I have one improvement that I'd suggest (if possible), I'm having problems in relation to the z-index value, looking at the scss
files it looks to be set to 1, some of my other components have higher z-indexes, which cause them to overlap the tooltips and look clipped.
Is it possible for a simple adjustment of the value from 1 to another value?
Thanks.
Hello there. Thanks for this lib.
Any reason why Props
is exported, but not Options
?
From index.d.ts
export { default as tooltip } from './tooltip.js';
export { default as Tooltip } from './Tooltip.svelte';
export type { Props } from './types';
export type { Placement } from '@floating-ui/dom';
This size from the docs, does indeed make the arrow smaller, but also reveals the box used to make it:
:root {
--svooltip-arrow-size: 6px;
}
I have some CSS classes as follows:
.svooltip[data-placement^='top'] .svooltip-arrow {
@apply border-b border-r;
}
.svooltip[data-placement^='bottom'] .svooltip-arrow {
@apply border-t border-l;
}
But the issue is, they are not applied when the tooltip is overflowing and changes position, so I end up getting the incorrect classes for the position that it's in.
Example:
Correct placement:
Notice the arrow border
Would like to show these to keyboard users too
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.