@diegopluna/narvi 0.5.0 → 0.5.2
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.
- package/dist/components/app-shell/AppShellPanel.svelte +3 -2
- package/dist/components/collapsible/CollapsibleRoot.svelte +7 -1
- package/dist/components/command/CommandDialog.svelte +20 -3
- package/dist/components/command/CommandStatus.svelte +15 -0
- package/dist/components/command/CommandStatus.svelte.d.ts +7 -0
- package/dist/components/command/index.d.ts +2 -4
- package/dist/components/command/index.js +1 -4
- package/dist/components/composer/ComposerModelPicker.svelte +3 -0
- package/dist/components/dialog/ConfirmDialog.svelte +7 -2
- package/dist/components/dialog/DialogContent.svelte +9 -2
- package/dist/components/dialog/DialogRoot.svelte +20 -2
- package/dist/components/dialog/styles.d.ts +3 -0
- package/dist/components/dialog/styles.js +5 -0
- package/dist/components/hover-card/HoverCardContent.svelte +7 -1
- package/dist/components/hover-card/HoverCardRoot.svelte +17 -1
- package/dist/components/menu/ContextMenuContent.svelte +11 -1
- package/dist/components/menu/MenuContent.svelte +7 -1
- package/dist/components/menu/MenuRoot.svelte +27 -0
- package/dist/components/menu/MenuRoot.svelte.d.ts +7 -0
- package/dist/components/menu/MenuSub.svelte +26 -0
- package/dist/components/menu/MenuSub.svelte.d.ts +7 -0
- package/dist/components/menu/context-menu.d.ts +2 -3
- package/dist/components/menu/context-menu.js +2 -4
- package/dist/components/menu/index.d.ts +4 -4
- package/dist/components/menu/index.js +2 -7
- package/dist/components/popover/PopoverContent.svelte +7 -1
- package/dist/components/popover/PopoverRoot.svelte +27 -0
- package/dist/components/popover/PopoverRoot.svelte.d.ts +7 -0
- package/dist/components/popover/index.d.ts +2 -3
- package/dist/components/popover/index.js +1 -5
- package/dist/components/resize-handle/ResizeHandle.svelte +80 -14
- package/dist/components/resize-handle/ResizeHandle.svelte.d.ts +15 -1
- package/dist/components/select/Select.svelte +4 -1
- package/dist/components/sheet/SheetContent.svelte +8 -1
- package/dist/components/split-button/SplitButton.svelte +10 -1
- package/dist/components/tooltip/TooltipContent.svelte +7 -1
- package/dist/components/tooltip/TooltipRoot.svelte +12 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +4 -0
- package/dist/internal/popup.d.ts +24 -0
- package/dist/internal/popup.js +56 -0
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +8 -8
- package/skills/building-ui/references/components.md +42 -0
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +3 -1
- package/skills/styling/SKILL.md +1 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
display: 'flex',
|
|
67
67
|
flexDirection: 'column',
|
|
68
68
|
flexShrink: 0,
|
|
69
|
-
|
|
69
|
+
// The handle's size while it is dragged, which is not inherited, so the panel restyles
|
|
70
|
+
// alone as it moves; its width once it is let go
|
|
71
|
+
width: 'var(--narvi-size, var(--narvi-panel-width))',
|
|
70
72
|
minWidth: 0,
|
|
71
73
|
minHeight: 0,
|
|
72
74
|
overflow: 'clip',
|
|
@@ -201,7 +203,6 @@
|
|
|
201
203
|
defaultValue={defaultWidth}
|
|
202
204
|
edge="start"
|
|
203
205
|
target={element}
|
|
204
|
-
property="--narvi-panel-width"
|
|
205
206
|
label={edgeLabel ?? `Resize the ${label.toLowerCase()} panel`}
|
|
206
207
|
title={edgeTitle}
|
|
207
208
|
sx={styles.handle}
|
|
@@ -38,8 +38,14 @@
|
|
|
38
38
|
});
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
|
+
<!-- `open` is written back only when the app has not followed (`internal/popup.ts`) -->
|
|
41
42
|
<Collapsible
|
|
42
|
-
bind:open
|
|
43
|
+
bind:open={
|
|
44
|
+
() => open,
|
|
45
|
+
(next) => {
|
|
46
|
+
if (open !== next) open = next;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
43
49
|
{...rest}
|
|
44
50
|
{...attrs([styles.root, sx], className)}
|
|
45
51
|
{@attach (element: HTMLElement) => {
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
import { Dialog, DialogBackdrop, DialogContent, DialogTitle } from '@ui-sdk/svelte/dialog';
|
|
7
7
|
import * as stylex from '@stylexjs/stylex';
|
|
8
8
|
import type { Snippet } from 'svelte';
|
|
9
|
+
import { nestDialog, popupContainer } from '../../internal/popup.js';
|
|
9
10
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
11
|
+
import { dialog } from '../dialog/styles.js';
|
|
10
12
|
import { visuallyHidden } from '../../visually-hidden.js';
|
|
11
13
|
import { provideDialogLabel } from './context.js';
|
|
12
14
|
import { command } from './styles.js';
|
|
@@ -51,6 +53,9 @@
|
|
|
51
53
|
|
|
52
54
|
provideDialogLabel(() => label);
|
|
53
55
|
|
|
56
|
+
const container = popupContainer();
|
|
57
|
+
const nested = nestDialog();
|
|
58
|
+
|
|
54
59
|
// Heard on its way up to the document, where ui-sdk closes the dialog: an Escape the search
|
|
55
60
|
// used to clear itself comes prevented, and one the caller prevents here keeps it open. A
|
|
56
61
|
// menu open inside the palette, in a popover of its own, takes its own Escape.
|
|
@@ -62,9 +67,21 @@
|
|
|
62
67
|
};
|
|
63
68
|
</script>
|
|
64
69
|
|
|
65
|
-
<!--
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
<!--
|
|
71
|
+
In the top layer, in place unless the app gives a container. `open` is written back only when
|
|
72
|
+
the app has not followed (`internal/popup.ts`).
|
|
73
|
+
-->
|
|
74
|
+
<Dialog
|
|
75
|
+
bind:open={
|
|
76
|
+
() => open,
|
|
77
|
+
(next) => {
|
|
78
|
+
if (open !== next) open = next;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
container={container()}
|
|
82
|
+
onOpenChange={(next) => onopenchange?.(next)}
|
|
83
|
+
>
|
|
84
|
+
<DialogBackdrop {...stylex.attrs(command.overlay, nested && dialog.nested)} />
|
|
68
85
|
<DialogContent
|
|
69
86
|
finalFocus={restoreFocus ? undefined : 'none'}
|
|
70
87
|
onkeydown={escape}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { CommandStatus as UiCommandStatus } from '@ui-sdk/svelte/command';
|
|
4
|
+
|
|
5
|
+
// ui-sdk's part, with nothing to style, under props of its own names: ui-sdk's take any
|
|
6
|
+
// attribute at all, which would let a misspelled prop through (`internal/loose.ts`)
|
|
7
|
+
export interface CommandStatusProps extends Loose<PartProps<typeof UiCommandStatus>> {}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
let props: CommandStatusProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<!-- Says how many items are listed, or that they are loading, from the root's `status` -->
|
|
15
|
+
<UiCommandStatus {...props} />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { CommandStatus as UiCommandStatus } from '@ui-sdk/svelte/command';
|
|
3
|
+
export interface CommandStatusProps extends Loose<PartProps<typeof UiCommandStatus>> {
|
|
4
|
+
}
|
|
5
|
+
declare const CommandStatus: import("svelte").Component<CommandStatusProps, {}, "">;
|
|
6
|
+
type CommandStatus = ReturnType<typeof CommandStatus>;
|
|
7
|
+
export default CommandStatus;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { CommandStatus } from '@ui-sdk/svelte/command';
|
|
2
|
-
import { type Loosened } from '../../internal/loose.js';
|
|
3
1
|
import Dialog from './CommandDialog.svelte';
|
|
4
2
|
import Empty from './CommandEmpty.svelte';
|
|
5
3
|
import Footer from './CommandFooter.svelte';
|
|
@@ -9,8 +7,7 @@ import Item from './CommandItem.svelte';
|
|
|
9
7
|
import List from './CommandList.svelte';
|
|
10
8
|
import Root from './CommandRoot.svelte';
|
|
11
9
|
import Separator from './CommandSeparator.svelte';
|
|
12
|
-
|
|
13
|
-
declare const Status: Loosened<typeof CommandStatus>;
|
|
10
|
+
import Status from './CommandStatus.svelte';
|
|
14
11
|
export { Dialog, Root, Input, List, Group, Item, Empty, Separator, Status, Footer };
|
|
15
12
|
export type { CommandDialogProps } from './CommandDialog.svelte';
|
|
16
13
|
export type { CommandEmptyProps } from './CommandEmpty.svelte';
|
|
@@ -21,3 +18,4 @@ export type { CommandItemProps } from './CommandItem.svelte';
|
|
|
21
18
|
export type { CommandListProps } from './CommandList.svelte';
|
|
22
19
|
export type { CommandRootProps } from './CommandRoot.svelte';
|
|
23
20
|
export type { CommandSeparatorProps } from './CommandSeparator.svelte';
|
|
21
|
+
export type { CommandStatusProps } from './CommandStatus.svelte';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { CommandStatus } from '@ui-sdk/svelte/command';
|
|
2
|
-
import { loose } from '../../internal/loose.js';
|
|
3
1
|
import Dialog from './CommandDialog.svelte';
|
|
4
2
|
import Empty from './CommandEmpty.svelte';
|
|
5
3
|
import Footer from './CommandFooter.svelte';
|
|
@@ -9,6 +7,5 @@ import Item from './CommandItem.svelte';
|
|
|
9
7
|
import List from './CommandList.svelte';
|
|
10
8
|
import Root from './CommandRoot.svelte';
|
|
11
9
|
import Separator from './CommandSeparator.svelte';
|
|
12
|
-
|
|
13
|
-
const Status = loose(CommandStatus);
|
|
10
|
+
import Status from './CommandStatus.svelte';
|
|
14
11
|
export { Dialog, Root, Input, List, Group, Item, Empty, Separator, Status, Footer };
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import Glyph from '../../internal/Glyph.svelte';
|
|
21
21
|
import type { IconComponent } from '../../internal/icon.js';
|
|
22
22
|
import '../../internal/icons.css';
|
|
23
|
+
import { popupContainer } from '../../internal/popup.js';
|
|
23
24
|
import { visuallyHidden } from '../../visually-hidden.js';
|
|
24
25
|
import { shared } from '../../internal/shared.js';
|
|
25
26
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
@@ -557,6 +558,7 @@
|
|
|
557
558
|
type Details = { reason: string; event?: Event | undefined; cancel: () => void };
|
|
558
559
|
|
|
559
560
|
const composer = getComposerContext();
|
|
561
|
+
const container = popupContainer();
|
|
560
562
|
|
|
561
563
|
let content = $state<HTMLElement | null>(null);
|
|
562
564
|
let field = $state<HTMLInputElement | null>(null);
|
|
@@ -886,6 +888,7 @@
|
|
|
886
888
|
multiple={several}
|
|
887
889
|
value={picked}
|
|
888
890
|
bind:open={() => open && !empty, setOpen}
|
|
891
|
+
container={container()}
|
|
889
892
|
bind:query
|
|
890
893
|
filter={false}
|
|
891
894
|
loop={false}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { colors, density, font, space } from '../../tokens.stylex.js';
|
|
23
23
|
import Button from '../button/Button.svelte';
|
|
24
24
|
import Notice from '../notice/Notice.svelte';
|
|
25
|
+
import { nestDialog, popupContainer } from '../../internal/popup.js';
|
|
25
26
|
import { dialog } from './styles.js';
|
|
26
27
|
|
|
27
28
|
export type ConfirmDialogProps = {
|
|
@@ -105,6 +106,9 @@
|
|
|
105
106
|
children
|
|
106
107
|
}: ConfirmDialogProps = $props();
|
|
107
108
|
|
|
109
|
+
const container = popupContainer();
|
|
110
|
+
const nested = nestDialog();
|
|
111
|
+
|
|
108
112
|
let busy = $state(false);
|
|
109
113
|
// Whether the children rendered anything. A block of content always reaches the dialog as
|
|
110
114
|
// children, even one whose `{#if}` is false, and an empty body would leave a gap.
|
|
@@ -155,6 +159,7 @@
|
|
|
155
159
|
<!-- While the action runs, nothing but the action closes it: not Escape, not Cancel -->
|
|
156
160
|
<AlertDialog
|
|
157
161
|
bind:open
|
|
162
|
+
container={container()}
|
|
158
163
|
dismissible={!busy}
|
|
159
164
|
onOpenChange={(next, details) => {
|
|
160
165
|
if (busy && !next) details.cancel();
|
|
@@ -163,8 +168,8 @@
|
|
|
163
168
|
{#if trigger}
|
|
164
169
|
<AlertDialogTrigger render={trigger} />
|
|
165
170
|
{/if}
|
|
166
|
-
<!-- In
|
|
167
|
-
<AlertDialogBackdrop {...stylex.attrs(dialog.overlay)} />
|
|
171
|
+
<!-- In the top layer, in place unless the app gives a container -->
|
|
172
|
+
<AlertDialogBackdrop {...stylex.attrs(dialog.overlay, nested && dialog.nested)} />
|
|
168
173
|
<AlertDialogContent {...stylex.attrs(dialog.content, styles.content)}>
|
|
169
174
|
<div {...stylex.attrs(dialog.header, styles.header)}>
|
|
170
175
|
<AlertDialogTitle {...stylex.attrs(dialog.title)}>{title}</AlertDialogTitle>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { nestDialog, usePopupContainer } from '../../internal/popup.js';
|
|
3
4
|
import {
|
|
4
5
|
DialogBackdrop,
|
|
5
6
|
DialogClose,
|
|
@@ -41,16 +42,22 @@
|
|
|
41
42
|
side,
|
|
42
43
|
as = 'div',
|
|
43
44
|
closeLabel = 'Close',
|
|
45
|
+
container,
|
|
44
46
|
sx,
|
|
45
47
|
class: className,
|
|
46
48
|
children,
|
|
47
49
|
...rest
|
|
48
50
|
}: DialogContentProps = $props();
|
|
51
|
+
|
|
52
|
+
// In the container around it, or its own; the popups inside it follow
|
|
53
|
+
const target = usePopupContainer(() => container);
|
|
54
|
+
const nested = nestDialog();
|
|
49
55
|
</script>
|
|
50
56
|
|
|
51
|
-
<!-- In
|
|
52
|
-
<DialogBackdrop {...stylex.attrs(dialog.overlay)} />
|
|
57
|
+
<!-- In the top layer, in place unless given a container. The backdrop opens just below it. -->
|
|
58
|
+
<DialogBackdrop {...stylex.attrs(dialog.overlay, nested && dialog.nested)} />
|
|
53
59
|
<UiDialogContent
|
|
60
|
+
container={target()}
|
|
54
61
|
{...rest}
|
|
55
62
|
{...attrs(
|
|
56
63
|
[dialog.content, side ? [sheet.sheet, sheet.md, sheet[side]] : dialog[size], sx],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
3
|
import { Dialog } from '@ui-sdk/svelte/dialog';
|
|
4
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
4
5
|
|
|
5
6
|
// No `presentation`: ui-sdk's own sheet moves itself, where Narvi's content is placed and
|
|
6
7
|
// animated by its styles. `Sheet` is Narvi's sheet.
|
|
@@ -12,9 +13,26 @@
|
|
|
12
13
|
defaultOpen,
|
|
13
14
|
open = $bindable(defaultOpen ?? false),
|
|
14
15
|
persistentElements,
|
|
16
|
+
container,
|
|
15
17
|
...rest
|
|
16
18
|
}: DialogRootProps = $props();
|
|
19
|
+
|
|
20
|
+
// The root's container is the backdrop's as well as the content's
|
|
21
|
+
const target = usePopupContainer(() => container);
|
|
17
22
|
</script>
|
|
18
23
|
|
|
19
|
-
<!--
|
|
20
|
-
|
|
24
|
+
<!--
|
|
25
|
+
Behaviour only. ui-sdk's toast region stays above it and usable while it is open. `open` is
|
|
26
|
+
written back only when the app has not followed (`internal/popup.ts`).
|
|
27
|
+
-->
|
|
28
|
+
<Dialog
|
|
29
|
+
bind:open={
|
|
30
|
+
() => open,
|
|
31
|
+
(next) => {
|
|
32
|
+
if (open !== next) open = next;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
container={target()}
|
|
36
|
+
{persistentElements}
|
|
37
|
+
{...rest}
|
|
38
|
+
/>
|
|
@@ -9,6 +9,9 @@ export declare const dialog: Readonly<{
|
|
|
9
9
|
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
10
10
|
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
|
|
11
11
|
}>;
|
|
12
|
+
readonly nested: Readonly<{
|
|
13
|
+
readonly display: stylex.StyleXClassNameFor<"display", "none" | null>;
|
|
14
|
+
}>;
|
|
12
15
|
readonly content: Readonly<{
|
|
13
16
|
readonly position: stylex.StyleXClassNameFor<"position", "fixed">;
|
|
14
17
|
readonly insetInline: stylex.StyleXClassNameFor<"insetInline", 0>;
|
|
@@ -19,6 +19,11 @@ export const dialog = stylex.create({
|
|
|
19
19
|
transitionDuration: { default: motion.base, [CLOSED]: motion.fast },
|
|
20
20
|
transitionTimingFunction: motion.easeOut
|
|
21
21
|
},
|
|
22
|
+
// A dialog opened from another drops its backdrop as soon as it closes. ui-sdk swallows a
|
|
23
|
+
// press on the backdrop of a dialog on its way out, so a click on the scrim that closed it
|
|
24
|
+
// does not land on the page, but this one covers the dialog under it, whose controls would
|
|
25
|
+
// ignore presses until the exit had played. The scrim of the dialog under it stays.
|
|
26
|
+
nested: { display: { default: null, [CLOSED]: 'none' } },
|
|
22
27
|
// Centred, and never past the window: 2rem of margin, the body scrolls inside
|
|
23
28
|
content: {
|
|
24
29
|
position: 'fixed',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
3
4
|
import { HoverCardContent as UiHoverCardContent } from '@ui-sdk/svelte/hover-card';
|
|
4
5
|
import * as stylex from '@stylexjs/stylex';
|
|
5
6
|
import { density } from '../../tokens.stylex.js';
|
|
@@ -46,15 +47,20 @@
|
|
|
46
47
|
layout = 'block',
|
|
47
48
|
padding = 'default',
|
|
48
49
|
ref = $bindable(null),
|
|
50
|
+
container,
|
|
49
51
|
sx,
|
|
50
52
|
class: className,
|
|
51
53
|
children,
|
|
52
54
|
...rest
|
|
53
55
|
}: HoverCardContentProps = $props();
|
|
56
|
+
|
|
57
|
+
// In the container around it, or its own; the popups inside it follow
|
|
58
|
+
const target = usePopupContainer(() => container);
|
|
54
59
|
</script>
|
|
55
60
|
|
|
56
|
-
<!-- In
|
|
61
|
+
<!-- In the top layer, in place unless the app or the part gives a container -->
|
|
57
62
|
<UiHoverCardContent
|
|
63
|
+
container={target()}
|
|
58
64
|
{side}
|
|
59
65
|
{sideOffset}
|
|
60
66
|
{collisionPadding}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
3
|
import { HoverCard } from '@ui-sdk/svelte/hover-card';
|
|
4
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
4
5
|
|
|
5
6
|
export interface HoverCardRootProps extends Loose<PartProps<typeof HoverCard>> {}
|
|
6
7
|
</script>
|
|
@@ -13,11 +14,26 @@
|
|
|
13
14
|
open = $bindable(),
|
|
14
15
|
delay = 500,
|
|
15
16
|
closeDelay = 150,
|
|
17
|
+
container,
|
|
16
18
|
children,
|
|
17
19
|
...rest
|
|
18
20
|
}: HoverCardRootProps = $props();
|
|
21
|
+
|
|
22
|
+
const target = usePopupContainer(() => container);
|
|
19
23
|
</script>
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
<!-- `open` is written back only when the app has not followed (`internal/popup.ts`) -->
|
|
26
|
+
<HoverCard
|
|
27
|
+
bind:open={
|
|
28
|
+
() => open,
|
|
29
|
+
(next) => {
|
|
30
|
+
if (open !== next) open = next;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
container={target()}
|
|
34
|
+
{delay}
|
|
35
|
+
{closeDelay}
|
|
36
|
+
{...rest}
|
|
37
|
+
>
|
|
22
38
|
{@render children?.()}
|
|
23
39
|
</HoverCard>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
3
4
|
import { MenuContent } from '@ui-sdk/svelte/menu';
|
|
4
5
|
import * as stylex from '@stylexjs/stylex';
|
|
5
6
|
import type { Snippet } from 'svelte';
|
|
@@ -24,13 +25,22 @@
|
|
|
24
25
|
<script lang="ts">
|
|
25
26
|
let {
|
|
26
27
|
collisionPadding = 8,
|
|
28
|
+
container,
|
|
27
29
|
sx,
|
|
28
30
|
class: className,
|
|
29
31
|
children,
|
|
30
32
|
...rest
|
|
31
33
|
}: ContextMenuContentProps = $props();
|
|
34
|
+
|
|
35
|
+
// In the container around it, or its own; the popups inside it follow
|
|
36
|
+
const target = usePopupContainer(() => container);
|
|
32
37
|
</script>
|
|
33
38
|
|
|
34
|
-
<MenuContent
|
|
39
|
+
<MenuContent
|
|
40
|
+
{collisionPadding}
|
|
41
|
+
container={target()}
|
|
42
|
+
{...rest}
|
|
43
|
+
{...attrs([layer.surface, styles.width, sx], className)}
|
|
44
|
+
>
|
|
35
45
|
{@render children?.()}
|
|
36
46
|
</MenuContent>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
3
4
|
import { MenuContent as UiMenuContent } from '@ui-sdk/svelte/menu';
|
|
4
5
|
import type { Snippet } from 'svelte';
|
|
5
6
|
import { layer, widthStyle } from '../../internal/layer.js';
|
|
@@ -31,15 +32,20 @@
|
|
|
31
32
|
minWidth,
|
|
32
33
|
style,
|
|
33
34
|
align = 'start',
|
|
35
|
+
container,
|
|
34
36
|
sx,
|
|
35
37
|
class: className,
|
|
36
38
|
children,
|
|
37
39
|
...rest
|
|
38
40
|
}: MenuContentProps = $props();
|
|
41
|
+
|
|
42
|
+
// In the container around it, or its own; the popups inside it follow
|
|
43
|
+
const target = usePopupContainer(() => container);
|
|
39
44
|
</script>
|
|
40
45
|
|
|
41
|
-
<!-- In
|
|
46
|
+
<!-- In the top layer, in place unless the app or the part gives a container -->
|
|
42
47
|
<UiMenuContent
|
|
48
|
+
container={target()}
|
|
43
49
|
{sideOffset}
|
|
44
50
|
{collisionPadding}
|
|
45
51
|
{align}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { Menu } from '@ui-sdk/svelte/menu';
|
|
4
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
5
|
+
|
|
6
|
+
export interface MenuRootProps extends Loose<PartProps<typeof Menu>> {}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
let { open = $bindable(), container, children, ...rest }: MenuRootProps = $props();
|
|
11
|
+
|
|
12
|
+
const target = usePopupContainer(() => container);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- Behaviour only. `open` is written back only when the app has not followed (`internal/popup.ts`). -->
|
|
16
|
+
<Menu
|
|
17
|
+
bind:open={
|
|
18
|
+
() => open,
|
|
19
|
+
(next) => {
|
|
20
|
+
if (open !== next) open = next;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
container={target()}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</Menu>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { Menu } from '@ui-sdk/svelte/menu';
|
|
3
|
+
export interface MenuRootProps extends Loose<PartProps<typeof Menu>> {
|
|
4
|
+
}
|
|
5
|
+
declare const MenuRoot: import("svelte").Component<MenuRootProps, {}, "open">;
|
|
6
|
+
type MenuRoot = ReturnType<typeof MenuRoot>;
|
|
7
|
+
export default MenuRoot;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuSub as UiMenuSub } from '@ui-sdk/svelte/menu';
|
|
4
|
+
|
|
5
|
+
export interface MenuSubProps extends Loose<PartProps<typeof UiMenuSub>> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
let { open = $bindable(), children, ...rest }: MenuSubProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<!--
|
|
13
|
+
Behaviour only, in the container of the menu it is in. `open` is written back only when the app
|
|
14
|
+
has not followed (`internal/popup.ts`).
|
|
15
|
+
-->
|
|
16
|
+
<UiMenuSub
|
|
17
|
+
bind:open={
|
|
18
|
+
() => open,
|
|
19
|
+
(next) => {
|
|
20
|
+
if (open !== next) open = next;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
{@render children?.()}
|
|
26
|
+
</UiMenuSub>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuSub as UiMenuSub } from '@ui-sdk/svelte/menu';
|
|
3
|
+
export interface MenuSubProps extends Loose<PartProps<typeof UiMenuSub>> {
|
|
4
|
+
}
|
|
5
|
+
declare const MenuSub: import("svelte").Component<MenuSubProps, {}, "open">;
|
|
6
|
+
type MenuSub = ReturnType<typeof MenuSub>;
|
|
7
|
+
export default MenuSub;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Menu } from '@ui-sdk/svelte/menu';
|
|
2
|
-
import { type Loosened } from '../../internal/loose.js';
|
|
3
1
|
import Content from './ContextMenuContent.svelte';
|
|
2
|
+
import Root from './MenuRoot.svelte';
|
|
4
3
|
import Trigger from './ContextMenuTrigger.svelte';
|
|
5
4
|
/**
|
|
6
5
|
* A menu that opens over a region on right-click, or from the keyboard with
|
|
7
6
|
* Shift+F10 or the Menu key. Fill it with the parts of Menu: Menu.Item,
|
|
8
7
|
* Menu.Group, Menu.Separator and the rest.
|
|
9
8
|
*/
|
|
10
|
-
declare const Root: Loosened<typeof Menu>;
|
|
11
9
|
export { Root, Trigger, Content };
|
|
12
10
|
export type { ContextMenuContentProps } from './ContextMenuContent.svelte';
|
|
13
11
|
export type { ContextMenuTriggerProps } from './ContextMenuTrigger.svelte';
|
|
12
|
+
export type { MenuRootProps as ContextMenuRootProps } from './MenuRoot.svelte';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Menu } from '@ui-sdk/svelte/menu';
|
|
2
|
-
import { loose } from '../../internal/loose.js';
|
|
3
1
|
import Content from './ContextMenuContent.svelte';
|
|
2
|
+
import Root from './MenuRoot.svelte';
|
|
4
3
|
import Trigger from './ContextMenuTrigger.svelte';
|
|
5
4
|
/**
|
|
6
5
|
* A menu that opens over a region on right-click, or from the keyboard with
|
|
7
6
|
* Shift+F10 or the Menu key. Fill it with the parts of Menu: Menu.Item,
|
|
8
7
|
* Menu.Group, Menu.Separator and the rest.
|
|
9
8
|
*/
|
|
10
|
-
// One
|
|
11
|
-
const Root = loose(Menu);
|
|
9
|
+
// One Menu, opened from a context area rather than a button
|
|
12
10
|
export { Root, Trigger, Content };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Menu, MenuSub } from '@ui-sdk/svelte/menu';
|
|
2
|
-
import { type Loosened } from '../../internal/loose.js';
|
|
3
1
|
import CheckboxItem from './MenuCheckboxItem.svelte';
|
|
4
2
|
import Content from './MenuContent.svelte';
|
|
5
3
|
import Group from './MenuGroup.svelte';
|
|
@@ -7,12 +5,12 @@ import Item from './MenuItem.svelte';
|
|
|
7
5
|
import Label from './MenuLabel.svelte';
|
|
8
6
|
import RadioGroup from './MenuRadioGroup.svelte';
|
|
9
7
|
import RadioItem from './MenuRadioItem.svelte';
|
|
8
|
+
import Root from './MenuRoot.svelte';
|
|
10
9
|
import Separator from './MenuSeparator.svelte';
|
|
10
|
+
import Sub from './MenuSub.svelte';
|
|
11
11
|
import SubContent from './MenuSubContent.svelte';
|
|
12
12
|
import SubTrigger from './MenuSubTrigger.svelte';
|
|
13
13
|
import Trigger from './MenuTrigger.svelte';
|
|
14
|
-
declare const Root: Loosened<typeof Menu>;
|
|
15
|
-
declare const Sub: Loosened<typeof MenuSub>;
|
|
16
14
|
export { Root, Trigger, Content, Item, CheckboxItem, RadioGroup, RadioItem, Group, Label, Separator, Sub, SubTrigger, SubContent };
|
|
17
15
|
export type { MenuCheckboxItemProps } from './MenuCheckboxItem.svelte';
|
|
18
16
|
export type { MenuContentProps } from './MenuContent.svelte';
|
|
@@ -21,7 +19,9 @@ export type { MenuItemProps } from './MenuItem.svelte';
|
|
|
21
19
|
export type { MenuLabelProps } from './MenuLabel.svelte';
|
|
22
20
|
export type { MenuRadioGroupProps } from './MenuRadioGroup.svelte';
|
|
23
21
|
export type { MenuRadioItemProps } from './MenuRadioItem.svelte';
|
|
22
|
+
export type { MenuRootProps } from './MenuRoot.svelte';
|
|
24
23
|
export type { MenuSeparatorProps } from './MenuSeparator.svelte';
|
|
24
|
+
export type { MenuSubProps } from './MenuSub.svelte';
|
|
25
25
|
export type { MenuSubContentProps } from './MenuSubContent.svelte';
|
|
26
26
|
export type { MenuSubTriggerProps } from './MenuSubTrigger.svelte';
|
|
27
27
|
export type { MenuTriggerProps } from './MenuTrigger.svelte';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Menu, MenuSub } from '@ui-sdk/svelte/menu';
|
|
2
|
-
import { loose } from '../../internal/loose.js';
|
|
3
1
|
import CheckboxItem from './MenuCheckboxItem.svelte';
|
|
4
2
|
import Content from './MenuContent.svelte';
|
|
5
3
|
import Group from './MenuGroup.svelte';
|
|
@@ -7,13 +5,10 @@ import Item from './MenuItem.svelte';
|
|
|
7
5
|
import Label from './MenuLabel.svelte';
|
|
8
6
|
import RadioGroup from './MenuRadioGroup.svelte';
|
|
9
7
|
import RadioItem from './MenuRadioItem.svelte';
|
|
8
|
+
import Root from './MenuRoot.svelte';
|
|
10
9
|
import Separator from './MenuSeparator.svelte';
|
|
10
|
+
import Sub from './MenuSub.svelte';
|
|
11
11
|
import SubContent from './MenuSubContent.svelte';
|
|
12
12
|
import SubTrigger from './MenuSubTrigger.svelte';
|
|
13
13
|
import Trigger from './MenuTrigger.svelte';
|
|
14
|
-
// Behaviour only, with nothing to style: ui-sdk's own parts, typed to take `undefined` for
|
|
15
|
-
// each optional prop (`internal/loose.ts`). Their type is named, so svelte-package writes
|
|
16
|
-
// this module's declarations (it leaves them out without a word on TS2883).
|
|
17
|
-
const Root = loose(Menu);
|
|
18
|
-
const Sub = loose(MenuSub);
|
|
19
14
|
export { Root, Trigger, Content, Item, CheckboxItem, RadioGroup, RadioItem, Group, Label, Separator, Sub, SubTrigger, SubContent };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
3
4
|
import { PopoverContent as UiPopoverContent } from '@ui-sdk/svelte/popover';
|
|
4
5
|
import * as stylex from '@stylexjs/stylex';
|
|
5
6
|
import { density } from '../../tokens.stylex.js';
|
|
@@ -47,15 +48,20 @@
|
|
|
47
48
|
layout = 'block',
|
|
48
49
|
width,
|
|
49
50
|
style,
|
|
51
|
+
container,
|
|
50
52
|
sx,
|
|
51
53
|
class: className,
|
|
52
54
|
children,
|
|
53
55
|
...rest
|
|
54
56
|
}: PopoverContentProps = $props();
|
|
57
|
+
|
|
58
|
+
// In the container around it, or its own; the popups inside it follow
|
|
59
|
+
const target = usePopupContainer(() => container);
|
|
55
60
|
</script>
|
|
56
61
|
|
|
57
|
-
<!-- In
|
|
62
|
+
<!-- In the top layer, in place unless the app or the part gives a container -->
|
|
58
63
|
<UiPopoverContent
|
|
64
|
+
container={target()}
|
|
59
65
|
{sideOffset}
|
|
60
66
|
{collisionPadding}
|
|
61
67
|
{align}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { Popover } from '@ui-sdk/svelte/popover';
|
|
4
|
+
import { usePopupContainer } from '../../internal/popup.js';
|
|
5
|
+
|
|
6
|
+
export interface PopoverRootProps extends Loose<PartProps<typeof Popover>> {}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
let { open = $bindable(), container, children, ...rest }: PopoverRootProps = $props();
|
|
11
|
+
|
|
12
|
+
const target = usePopupContainer(() => container);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- Behaviour only. `open` is written back only when the app has not followed (`internal/popup.ts`). -->
|
|
16
|
+
<Popover
|
|
17
|
+
bind:open={
|
|
18
|
+
() => open,
|
|
19
|
+
(next) => {
|
|
20
|
+
if (open !== next) open = next;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
container={target()}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</Popover>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { Popover } from '@ui-sdk/svelte/popover';
|
|
3
|
+
export interface PopoverRootProps extends Loose<PartProps<typeof Popover>> {
|
|
4
|
+
}
|
|
5
|
+
declare const PopoverRoot: import("svelte").Component<PopoverRootProps, {}, "open">;
|
|
6
|
+
type PopoverRoot = ReturnType<typeof PopoverRoot>;
|
|
7
|
+
export default PopoverRoot;
|