lutra 0.1.38 → 0.1.40
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,9 +9,10 @@
|
|
|
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"],
|
|
14
|
+
visibility = "anchors-visible",
|
|
15
|
+
tryOrder = "most-block-size",
|
|
15
16
|
mode = "auto",
|
|
16
17
|
offset,
|
|
17
18
|
width,
|
|
@@ -28,15 +29,17 @@
|
|
|
28
29
|
open?: boolean;
|
|
29
30
|
/** Element to anchor to (if no trigger snippet provided) */
|
|
30
31
|
anchor?: HTMLElement | string;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** Inline alignment: "start", "center", or "end" */
|
|
34
|
-
align?: "start" | "center" | "end";
|
|
32
|
+
/** CSS position-area value (e.g., "block-end inline-start", "block-start center") */
|
|
33
|
+
positionArea?: string;
|
|
35
34
|
/** CSS position-try-fallbacks values */
|
|
36
35
|
fallbacks?: string[];
|
|
36
|
+
/** CSS position-visibility value */
|
|
37
|
+
visibility?: "always" | "anchors-visible" | "no-overflow";
|
|
38
|
+
/** CSS position-try-order value */
|
|
39
|
+
tryOrder?: "normal" | "most-block-size" | "most-inline-size";
|
|
37
40
|
/** Popover mode: "auto" (light dismiss) or "manual" */
|
|
38
41
|
mode?: "auto" | "manual";
|
|
39
|
-
/** Gap between anchor and popover (CSS
|
|
42
|
+
/** Gap between anchor and popover (CSS length value) */
|
|
40
43
|
offset?: string;
|
|
41
44
|
/** Width of the popover */
|
|
42
45
|
width?: string;
|
|
@@ -130,14 +133,6 @@
|
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
|
|
133
|
-
// Compute position-area value: combines block position with inline alignment
|
|
134
|
-
// e.g., "block-end start" means below anchor, aligned to start
|
|
135
|
-
const positionArea = $derived(
|
|
136
|
-
align === "center"
|
|
137
|
-
? position // Just "block-end" centers by default
|
|
138
|
-
: `${position} ${align}` // "block-end start" or "block-end end"
|
|
139
|
-
);
|
|
140
|
-
|
|
141
136
|
// Attrs to spread on trigger element
|
|
142
137
|
const triggerAttrs = $derived({
|
|
143
138
|
popovertarget: id,
|
|
@@ -151,7 +146,8 @@
|
|
|
151
146
|
const popoverStyle = $derived([
|
|
152
147
|
`position-anchor: ${anchorName}`,
|
|
153
148
|
`position-area: ${positionArea}`,
|
|
154
|
-
`position-
|
|
149
|
+
`position-visibility: ${visibility}`,
|
|
150
|
+
`position-try-order: ${tryOrder}`,
|
|
155
151
|
fallbacks.length ? `position-try-fallbacks: ${fallbacks.join(", ")}` : "",
|
|
156
152
|
offset ? `--popover-offset: ${offset}` : "",
|
|
157
153
|
width ? `--popover-width: ${width}` : "",
|
|
@@ -4,15 +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[];
|
|
11
|
+
/** CSS position-visibility value */
|
|
12
|
+
visibility?: "always" | "anchors-visible" | "no-overflow";
|
|
13
|
+
/** CSS position-try-order value */
|
|
14
|
+
tryOrder?: "normal" | "most-block-size" | "most-inline-size";
|
|
13
15
|
/** Popover mode: "auto" (light dismiss) or "manual" */
|
|
14
16
|
mode?: "auto" | "manual";
|
|
15
|
-
/** Gap between anchor and popover (CSS
|
|
17
|
+
/** Gap between anchor and popover (CSS length value) */
|
|
16
18
|
offset?: string;
|
|
17
19
|
/** Width of the popover */
|
|
18
20
|
width?: string;
|