compote-ui 0.75.3 → 0.75.4
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Menu } from '@ark-ui/svelte/menu';
|
|
2
|
+
import { Menu, useMenuContext } from '@ark-ui/svelte/menu';
|
|
3
3
|
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
4
|
import type { MenuContentBaseProps } from '@ark-ui/svelte/menu';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
@@ -11,6 +11,26 @@
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const { class: className, children, ...restProps }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const menu = useMenuContext();
|
|
16
|
+
const open = $derived(menu().open);
|
|
17
|
+
|
|
18
|
+
// Workaround for context menus opening at (0,0) the first time: zag skips
|
|
19
|
+
// `trackPositioning` for context triggers, so `currentPlacement` is first set in
|
|
20
|
+
// the popper's onComplete — after it wrote --x/--y. That changes the positioner
|
|
21
|
+
// style, and Svelte rewrites the whole `style` attribute, wiping --x/--y.
|
|
22
|
+
// Re-positioning once that settles makes the coordinates stick.
|
|
23
|
+
$effect(() => {
|
|
24
|
+
if (!open) return;
|
|
25
|
+
let inner = 0;
|
|
26
|
+
const outer = requestAnimationFrame(() => {
|
|
27
|
+
inner = requestAnimationFrame(() => menu().reposition());
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
cancelAnimationFrame(outer);
|
|
31
|
+
cancelAnimationFrame(inner);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
14
34
|
</script>
|
|
15
35
|
|
|
16
36
|
<Portal>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compote-ui",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@tailwindcss/vite": "^4.3.3",
|
|
72
72
|
"@tanstack/intent": "^0.4.0",
|
|
73
73
|
"@tanstack/svelte-table": "9.2.4",
|
|
74
|
-
"@types/node": "^
|
|
74
|
+
"@types/node": "^24",
|
|
75
75
|
"eslint": "^10.10.0",
|
|
76
76
|
"eslint-config-prettier": "^10.1.8",
|
|
77
77
|
"eslint-plugin-svelte": "^3.23.0",
|