lutra 0.1.39 → 0.1.41
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.
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
open = $bindable(false),
|
|
15
15
|
items,
|
|
16
16
|
trigger: triggerProp,
|
|
17
|
-
align = "start",
|
|
17
|
+
align = "inline-start",
|
|
18
18
|
width,
|
|
19
19
|
maxWidth,
|
|
20
20
|
}: {
|
|
@@ -24,14 +24,18 @@
|
|
|
24
24
|
items: Item[];
|
|
25
25
|
/** The trigger snippet or string */
|
|
26
26
|
trigger: string | Snippet<[{ toggle: () => void; isOpen: boolean; triggerAttrs?: Record<string, string> }]>;
|
|
27
|
-
/**
|
|
28
|
-
align?: "start" | "center" | "end";
|
|
27
|
+
/** Inline alignment: "inline-start" (default), "center", or "inline-end" */
|
|
28
|
+
align?: "inline-start" | "center" | "inline-end";
|
|
29
29
|
/** The width of the menu */
|
|
30
30
|
width?: string;
|
|
31
31
|
/** The max width of the menu */
|
|
32
32
|
maxWidth?: string;
|
|
33
33
|
} = $props();
|
|
34
34
|
|
|
35
|
+
const positionArea = $derived(
|
|
36
|
+
align === "center" ? "block-end" : `block-end ${align}`
|
|
37
|
+
);
|
|
38
|
+
|
|
35
39
|
let menuEl: HTMLDivElement | null = $state(null);
|
|
36
40
|
let keyboardHasFocus: boolean = $state(false);
|
|
37
41
|
|
|
@@ -95,8 +99,7 @@
|
|
|
95
99
|
<UiContent>
|
|
96
100
|
<Popover
|
|
97
101
|
bind:open
|
|
98
|
-
|
|
99
|
-
{align}
|
|
102
|
+
{positionArea}
|
|
100
103
|
fallbacks={["flip-block", "flip-inline"]}
|
|
101
104
|
offset="0.5rem"
|
|
102
105
|
{width}
|
|
@@ -11,8 +11,8 @@ type $$ComponentProps = {
|
|
|
11
11
|
isOpen: boolean;
|
|
12
12
|
triggerAttrs?: Record<string, string>;
|
|
13
13
|
}]>;
|
|
14
|
-
/**
|
|
15
|
-
align?: "start" | "center" | "end";
|
|
14
|
+
/** Inline alignment: "inline-start" (default), "center", or "inline-end" */
|
|
15
|
+
align?: "inline-start" | "center" | "inline-end";
|
|
16
16
|
/** The width of the menu */
|
|
17
17
|
width?: string;
|
|
18
18
|
/** The max width of the menu */
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
let {
|
|
10
10
|
open = $bindable(false),
|
|
11
11
|
anchor,
|
|
12
|
-
|
|
13
|
-
align = "start",
|
|
12
|
+
positionArea = "block-end inline-start",
|
|
14
13
|
fallbacks = ["flip-block", "flip-inline"],
|
|
15
14
|
visibility = "anchors-visible",
|
|
16
15
|
tryOrder = "most-block-size",
|
|
@@ -30,19 +29,17 @@
|
|
|
30
29
|
open?: boolean;
|
|
31
30
|
/** Element to anchor to (if no trigger snippet provided) */
|
|
32
31
|
anchor?: HTMLElement | string;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/** Inline alignment: "start", "center", or "end" */
|
|
36
|
-
align?: "start" | "center" | "end";
|
|
32
|
+
/** CSS position-area value (e.g., "block-end inline-start", "block-start center") */
|
|
33
|
+
positionArea?: string;
|
|
37
34
|
/** CSS position-try-fallbacks values */
|
|
38
35
|
fallbacks?: string[];
|
|
39
|
-
/**
|
|
36
|
+
/** CSS position-visibility value */
|
|
40
37
|
visibility?: "always" | "anchors-visible" | "no-overflow";
|
|
41
|
-
/**
|
|
38
|
+
/** CSS position-try-order value */
|
|
42
39
|
tryOrder?: "normal" | "most-block-size" | "most-inline-size";
|
|
43
40
|
/** Popover mode: "auto" (light dismiss) or "manual" */
|
|
44
41
|
mode?: "auto" | "manual";
|
|
45
|
-
/** Gap between anchor and popover (CSS
|
|
42
|
+
/** Gap between anchor and popover (CSS length value) */
|
|
46
43
|
offset?: string;
|
|
47
44
|
/** Width of the popover */
|
|
48
45
|
width?: string;
|
|
@@ -136,14 +133,6 @@
|
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
|
|
139
|
-
// Compute position-area value: combines block position with inline alignment
|
|
140
|
-
// e.g., "block-end start" means below anchor, aligned to start
|
|
141
|
-
const positionArea = $derived(
|
|
142
|
-
align === "center"
|
|
143
|
-
? position // Just "block-end" centers by default
|
|
144
|
-
: `${position} ${align}` // "block-end start" or "block-end end"
|
|
145
|
-
);
|
|
146
|
-
|
|
147
136
|
// Attrs to spread on trigger element
|
|
148
137
|
const triggerAttrs = $derived({
|
|
149
138
|
popovertarget: id,
|
|
@@ -4,19 +4,17 @@ type $$ComponentProps = {
|
|
|
4
4
|
open?: boolean;
|
|
5
5
|
/** Element to anchor to (if no trigger snippet provided) */
|
|
6
6
|
anchor?: HTMLElement | string;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
/** Inline alignment: "start", "center", or "end" */
|
|
10
|
-
align?: "start" | "center" | "end";
|
|
7
|
+
/** CSS position-area value (e.g., "block-end inline-start", "block-start center") */
|
|
8
|
+
positionArea?: string;
|
|
11
9
|
/** CSS position-try-fallbacks values */
|
|
12
10
|
fallbacks?: string[];
|
|
13
|
-
/**
|
|
11
|
+
/** CSS position-visibility value */
|
|
14
12
|
visibility?: "always" | "anchors-visible" | "no-overflow";
|
|
15
|
-
/**
|
|
13
|
+
/** CSS position-try-order value */
|
|
16
14
|
tryOrder?: "normal" | "most-block-size" | "most-inline-size";
|
|
17
15
|
/** Popover mode: "auto" (light dismiss) or "manual" */
|
|
18
16
|
mode?: "auto" | "manual";
|
|
19
|
-
/** Gap between anchor and popover (CSS
|
|
17
|
+
/** Gap between anchor and popover (CSS length value) */
|
|
20
18
|
offset?: string;
|
|
21
19
|
/** Width of the popover */
|
|
22
20
|
width?: string;
|