@salmexio/ui 1.2.0 → 1.2.1
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.
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import type { Snippet } from 'svelte';
|
|
18
18
|
import { cn } from '../../utils/cn.js';
|
|
19
19
|
import { tick } from 'svelte';
|
|
20
|
+
import { onMount } from 'svelte';
|
|
20
21
|
|
|
21
22
|
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
22
23
|
|
|
@@ -140,6 +141,28 @@ function positionTooltip() {
|
|
|
140
141
|
computedLeft = `${left}px`;
|
|
141
142
|
placementOverride = finalPlacement;
|
|
142
143
|
}
|
|
144
|
+
|
|
145
|
+
// Portal: move tooltip to document.body so position:fixed is viewport-relative
|
|
146
|
+
// (ancestors with transform/backdrop-filter would otherwise create a containing block)
|
|
147
|
+
$effect(() => {
|
|
148
|
+
if (tooltipEl && visible) {
|
|
149
|
+
document.body.appendChild(tooltipEl);
|
|
150
|
+
tick().then(() => positionTooltip());
|
|
151
|
+
return () => {
|
|
152
|
+
if (tooltipEl?.parentNode === document.body) {
|
|
153
|
+
document.body.removeChild(tooltipEl);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
onMount(() => {
|
|
160
|
+
return () => {
|
|
161
|
+
if (tooltipEl?.parentNode === document.body) {
|
|
162
|
+
document.body.removeChild(tooltipEl);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
});
|
|
143
166
|
</script>
|
|
144
167
|
|
|
145
168
|
<svelte:window onkeydown={handleKeydown} />
|
|
@@ -204,6 +227,7 @@ function positionTooltip() {
|
|
|
204
227
|
0 0 8px -4px rgba(255, 107, 53, 0.1);
|
|
205
228
|
pointer-events: none;
|
|
206
229
|
animation: sx-tooltip-in 150ms var(--sx-ease-out) both;
|
|
230
|
+
white-space: normal;
|
|
207
231
|
word-wrap: break-word;
|
|
208
232
|
}
|
|
209
233
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.svelte.d.ts","sourceRoot":"","sources":["../../../src/primitives/Tooltip/Tooltip.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.svelte.d.ts","sourceRoot":"","sources":["../../../src/primitives/Tooltip/Tooltip.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMtC,KAAK,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAErD,UAAU,KAAK;IACd,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAgKD;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|