@signal9/era-ui 22.0.0 → 23.1.0
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/CHANGELOG.md +32 -0
- package/dist/era-ui.css +1 -1
- package/dist/eslint/index.d.ts +55 -0
- package/dist/eslint/index.js +77 -0
- package/dist/eslint/rules-core.d.ts +14 -0
- package/dist/eslint/rules-core.js +111 -0
- package/dist/index.d.ts +1 -1
- package/dist/os/desktop.svelte +42 -11
- package/dist/os/desktop.svelte.d.ts +16 -0
- package/dist/ui/accordion/accordion-trigger.svelte +2 -2
- package/dist/ui/accordion/accordion-trigger.svelte.d.ts +2 -2
- package/dist/ui/alert-dialog/alert-dialog-content.svelte +6 -2
- package/dist/ui/alert-dialog/alert-dialog-content.svelte.d.ts +2 -2
- package/dist/ui/alert-dialog/alert-dialog-root.svelte +33 -0
- package/dist/ui/alert-dialog/alert-dialog-root.svelte.d.ts +8 -0
- package/dist/ui/alert-dialog/alert-dialog-trigger.svelte +8 -0
- package/dist/ui/alert-dialog/index.d.ts +1 -1
- package/dist/ui/alert-dialog/index.js +1 -1
- package/dist/ui/combobox/combobox-trigger.svelte +2 -2
- package/dist/ui/combobox/combobox-trigger.svelte.d.ts +2 -2
- package/dist/ui/context-menu/context-menu-content.svelte +6 -2
- package/dist/ui/context-menu/context-menu-content.svelte.d.ts +2 -2
- package/dist/ui/context-menu/context-menu-root.svelte +33 -0
- package/dist/ui/context-menu/context-menu-root.svelte.d.ts +8 -0
- package/dist/ui/context-menu/context-menu-sub-content.svelte +6 -2
- package/dist/ui/context-menu/context-menu-sub-content.svelte.d.ts +2 -2
- package/dist/ui/context-menu/context-menu-sub-trigger.svelte +2 -2
- package/dist/ui/context-menu/context-menu-sub-trigger.svelte.d.ts +2 -2
- package/dist/ui/context-menu/context-menu-trigger.svelte +8 -0
- package/dist/ui/context-menu/index.d.ts +1 -1
- package/dist/ui/context-menu/index.js +1 -1
- package/dist/ui/date-picker/date-picker-trigger.svelte +2 -2
- package/dist/ui/date-picker/date-picker-trigger.svelte.d.ts +2 -2
- package/dist/ui/date-range-picker/date-range-picker-trigger.svelte +2 -2
- package/dist/ui/date-range-picker/date-range-picker-trigger.svelte.d.ts +2 -2
- package/dist/ui/dialog/dialog-content.svelte +16 -2
- package/dist/ui/dialog/dialog-content.svelte.d.ts +2 -2
- package/dist/ui/dialog/dialog-root.svelte +43 -0
- package/dist/ui/dialog/dialog-root.svelte.d.ts +8 -0
- package/dist/ui/dialog/dialog-trigger.svelte +10 -0
- package/dist/ui/dialog/index.d.ts +1 -1
- package/dist/ui/dialog/index.js +1 -1
- package/dist/ui/dropdown-menu/dropdown-menu-content.svelte +6 -2
- package/dist/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +2 -2
- package/dist/ui/dropdown-menu/dropdown-menu-root.svelte +33 -0
- package/dist/ui/dropdown-menu/dropdown-menu-root.svelte.d.ts +8 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte +6 -2
- package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +2 -2
- package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +2 -2
- package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +2 -2
- package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte +10 -2
- package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +2 -2
- package/dist/ui/dropdown-menu/index.d.ts +1 -1
- package/dist/ui/dropdown-menu/index.js +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/link-preview/index.d.ts +1 -1
- package/dist/ui/link-preview/index.js +1 -1
- package/dist/ui/link-preview/link-preview-content.svelte +6 -2
- package/dist/ui/link-preview/link-preview-content.svelte.d.ts +2 -2
- package/dist/ui/link-preview/link-preview-root.svelte +33 -0
- package/dist/ui/link-preview/link-preview-root.svelte.d.ts +8 -0
- package/dist/ui/link-preview/link-preview-trigger.svelte +8 -0
- package/dist/ui/menubar/menubar-content.svelte +6 -2
- package/dist/ui/menubar/menubar-content.svelte.d.ts +2 -2
- package/dist/ui/menubar/menubar-root.svelte +26 -1
- package/dist/ui/menubar/menubar-root.svelte.d.ts +1 -1
- package/dist/ui/menubar/menubar-sub-content.svelte +6 -2
- package/dist/ui/menubar/menubar-sub-content.svelte.d.ts +2 -2
- package/dist/ui/menubar/menubar-sub-trigger.svelte +2 -2
- package/dist/ui/menubar/menubar-sub-trigger.svelte.d.ts +2 -2
- package/dist/ui/nav/index.d.ts +2 -0
- package/dist/ui/nav/index.js +2 -0
- package/dist/ui/nav/nav-bar.svelte +51 -0
- package/dist/ui/nav/nav-bar.svelte.d.ts +21 -0
- package/dist/ui/nav/nav-item.svelte +79 -0
- package/dist/ui/nav/nav-item.svelte.d.ts +29 -0
- package/dist/ui/provider/axes.d.ts +14 -1
- package/dist/ui/provider/axis-relay.svelte.d.ts +34 -0
- package/dist/ui/provider/axis-relay.svelte.js +109 -0
- package/dist/ui/select/select-content.svelte +2 -2
- package/dist/ui/select/select-content.svelte.d.ts +2 -2
- package/dist/ui/select/select-trigger.svelte +2 -2
- package/dist/ui/select/select-trigger.svelte.d.ts +2 -2
- package/dist/ui/sheet/sheet-content.svelte +8 -2
- package/dist/ui/sheet/sheet-content.svelte.d.ts +2 -2
- package/dist/ui/step/step-content.svelte +2 -2
- package/dist/ui/step/step-content.svelte.d.ts +2 -2
- package/dist/ui/step/step-summary.svelte +2 -2
- package/dist/ui/step/step-summary.svelte.d.ts +2 -2
- package/dist/ui/tooltip/index.d.ts +1 -1
- package/dist/ui/tooltip/index.js +1 -1
- package/dist/ui/tooltip/tooltip-content.svelte +6 -2
- package/dist/ui/tooltip/tooltip-content.svelte.d.ts +2 -2
- package/dist/ui/tooltip/tooltip-root.svelte +33 -0
- package/dist/ui/tooltip/tooltip-root.svelte.d.ts +8 -0
- package/dist/ui/tooltip/tooltip-trigger.svelte +8 -0
- package/dist/utils/index.d.ts +36 -3
- package/package.json +10 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { ContextMenu } from 'bits-ui';
|
|
3
4
|
|
|
4
5
|
// Pattern A: no extra DOM, so children flow through restProps untouched.
|
|
@@ -7,6 +8,13 @@
|
|
|
7
8
|
class: className,
|
|
8
9
|
...restProps
|
|
9
10
|
}: ContextMenu.TriggerProps = $props();
|
|
11
|
+
|
|
12
|
+
// The trigger is the last node still inside the subtree, so it is the
|
|
13
|
+
// anchor the axes are read FROM when the content opens.
|
|
14
|
+
const relay = getAxisRelay();
|
|
15
|
+
$effect(() => {
|
|
16
|
+
relay?.register(ref);
|
|
17
|
+
});
|
|
10
18
|
</script>
|
|
11
19
|
|
|
12
20
|
<ContextMenu.Trigger bind:ref class={className} {...restProps} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextMenu } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './context-menu-root.svelte';
|
|
3
3
|
export declare const Group: typeof ContextMenu.Group;
|
|
4
4
|
export declare const RadioGroup: typeof ContextMenu.RadioGroup;
|
|
5
5
|
export declare const Sub: typeof ContextMenu.Sub;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextMenu } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './context-menu-root.svelte';
|
|
3
3
|
export const Group = ContextMenu.Group;
|
|
4
4
|
export const RadioGroup = ContextMenu.RadioGroup;
|
|
5
5
|
export const Sub = ContextMenu.Sub;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DatePicker } from 'bits-ui';
|
|
3
3
|
import CalendarDays from '@lucide/svelte/icons/calendar-days';
|
|
4
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
ref = $bindable(null),
|
|
8
8
|
children,
|
|
9
9
|
class: className,
|
|
10
10
|
...restProps
|
|
11
|
-
}:
|
|
11
|
+
}: OwnedPartProps<DatePicker.TriggerProps> = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<DatePicker.Trigger
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DatePicker } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const DatePickerTrigger: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const DatePickerTrigger: import("svelte").Component<OwnedPartProps<DatePicker.TriggerProps>, {}, "ref">;
|
|
4
4
|
type DatePickerTrigger = ReturnType<typeof DatePickerTrigger>;
|
|
5
5
|
export default DatePickerTrigger;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DateRangePicker } from 'bits-ui';
|
|
3
3
|
import CalendarDays from '@lucide/svelte/icons/calendar-days';
|
|
4
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
ref = $bindable(null),
|
|
8
8
|
children,
|
|
9
9
|
class: className,
|
|
10
10
|
...restProps
|
|
11
|
-
}:
|
|
11
|
+
}: OwnedPartProps<DateRangePicker.TriggerProps> = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<DateRangePicker.Trigger
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DateRangePicker } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const DateRangePickerTrigger: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const DateRangePickerTrigger: import("svelte").Component<OwnedPartProps<DateRangePicker.TriggerProps>, {}, "ref">;
|
|
4
4
|
type DateRangePickerTrigger = ReturnType<typeof DateRangePickerTrigger>;
|
|
5
5
|
export default DateRangePickerTrigger;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { Dialog } from 'bits-ui';
|
|
4
4
|
import Overlay from './dialog-overlay.svelte';
|
|
5
|
-
import { cn, type
|
|
5
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
6
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
6
7
|
|
|
7
8
|
let {
|
|
8
9
|
ref = $bindable(null),
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
header,
|
|
11
12
|
class: className,
|
|
12
13
|
...restProps
|
|
13
|
-
}:
|
|
14
|
+
}: OwnedPartProps<Dialog.ContentProps> & {
|
|
14
15
|
/**
|
|
15
16
|
* A top bar in the pane's grammar — pass `Dialog.Header` (usually holding
|
|
16
17
|
* `Dialog.Title`). With it the panel goes sectioned like a Card: the bar
|
|
@@ -20,6 +21,13 @@
|
|
|
20
21
|
*/
|
|
21
22
|
header?: Snippet;
|
|
22
23
|
} = $props();
|
|
24
|
+
|
|
25
|
+
const relay = getAxisRelay();
|
|
26
|
+
// Content is created fresh on every open, so this reads the axes as they are
|
|
27
|
+
// NOW rather than as they were when the trigger mounted.
|
|
28
|
+
$effect(() => {
|
|
29
|
+
relay?.refresh();
|
|
30
|
+
});
|
|
23
31
|
</script>
|
|
24
32
|
|
|
25
33
|
<Dialog.Portal>
|
|
@@ -27,9 +35,15 @@
|
|
|
27
35
|
<!-- border-divider: the pane's hairline-edge law. A floating panel must be
|
|
28
36
|
separable from what's behind it, and on the flat surface shadow-lg
|
|
29
37
|
collapses to none — without the hairline the whole edge was a tone step. -->
|
|
38
|
+
<!-- The axes the trigger was standing in, re-declared here — see
|
|
39
|
+
provider/axis-relay.svelte.ts. Portalled content is a child of <body>,
|
|
40
|
+
so without this it inherits the page's density, surface, corners, font,
|
|
41
|
+
motion and theme rather than the subtree's. -->
|
|
30
42
|
<Dialog.Content
|
|
31
43
|
bind:ref
|
|
44
|
+
{...relay?.attrs}
|
|
32
45
|
class={cn(
|
|
46
|
+
relay?.schemeClass,
|
|
33
47
|
'fixed top-1/2 left-1/2 z-overlay flex w-full max-w-md -translate-x-1/2 -translate-y-1/2 flex-col border border-divider bg-well shadow-lg glass-blur',
|
|
34
48
|
header ? 'rounded-control' : 'gap-gutter rounded-bar p-card',
|
|
35
49
|
className
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import { Dialog } from 'bits-ui';
|
|
3
|
-
import { type
|
|
4
|
-
type $$ComponentProps =
|
|
3
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
4
|
+
type $$ComponentProps = OwnedPartProps<Dialog.ContentProps> & {
|
|
5
5
|
/**
|
|
6
6
|
* A top bar in the pane's grammar — pass `Dialog.Header` (usually holding
|
|
7
7
|
* `Dialog.Title`). With it the panel goes sectioned like a Card: the bar
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { Dialog } from 'bits-ui';
|
|
4
|
+
import { setAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* era owns Root ONLY to open the axis channel. It renders no DOM, adds no
|
|
8
|
+
* behaviour and forwards everything — it is bits-ui's Root plus a context.
|
|
9
|
+
*
|
|
10
|
+
* There has to BE a component here, though, which is the whole reason the
|
|
11
|
+
* axes could not cross the portal for as long as they could not: `export
|
|
12
|
+
* const Root = Dialog.Root` is a re-export, and a re-export has nowhere to
|
|
13
|
+
* put a context.
|
|
14
|
+
*
|
|
15
|
+
* `open` is declared bindable explicitly. A spread cannot carry a two-way
|
|
16
|
+
* binding, so wrapping a primitive silently breaks `bind:open` at every call
|
|
17
|
+
* site unless the wrapper re-declares it — which is exactly what happened the
|
|
18
|
+
* first time this was written, caught by svelte-check on a real consumer.
|
|
19
|
+
*/
|
|
20
|
+
let {
|
|
21
|
+
open = $bindable(false),
|
|
22
|
+
children,
|
|
23
|
+
...restProps
|
|
24
|
+
}: Dialog.RootProps & { children?: Snippet } = $props();
|
|
25
|
+
|
|
26
|
+
const relay = setAxisRelay();
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* CAPTURE ON OPEN, which is not the same as capture on mount and was the
|
|
30
|
+
* first thing this got wrong. bits-ui mounts content eagerly and toggles it,
|
|
31
|
+
* so a refresh scheduled by the content's own mount runs once at page load —
|
|
32
|
+
* before a consumer has scoped anything, and never again. Reading when `open`
|
|
33
|
+
* turns true is the moment the answer is actually needed, and it re-reads on
|
|
34
|
+
* every open, so an axis that changed in between is picked up.
|
|
35
|
+
*/
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (open) relay.refresh();
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<Dialog.Root bind:open {...restProps}>
|
|
42
|
+
{@render children?.()}
|
|
43
|
+
</Dialog.Root>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { Dialog } from 'bits-ui';
|
|
3
|
+
type $$ComponentProps = Dialog.RootProps & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const DialogRoot: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
7
|
+
type DialogRoot = ReturnType<typeof DialogRoot>;
|
|
8
|
+
export default DialogRoot;
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { Dialog, type WithoutChildrenOrChild } from 'bits-ui';
|
|
4
4
|
import { Button, type ButtonVariants } from '../button';
|
|
5
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
6
|
+
|
|
7
|
+
// The trigger is the last node still inside the subtree, so it is the anchor
|
|
8
|
+
// the axes are read FROM. It only registers itself; the reading happens when
|
|
9
|
+
// the content opens, because an axis can change under a mounted trigger.
|
|
10
|
+
const relay = getAxisRelay();
|
|
5
11
|
|
|
6
12
|
let {
|
|
7
13
|
ref = $bindable(null),
|
|
@@ -17,6 +23,10 @@
|
|
|
17
23
|
ButtonVariants & {
|
|
18
24
|
children?: Snippet;
|
|
19
25
|
} = $props();
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
relay?.register(ref);
|
|
29
|
+
});
|
|
20
30
|
</script>
|
|
21
31
|
|
|
22
32
|
<Dialog.Trigger {...restProps}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dialog } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './dialog-root.svelte';
|
|
3
3
|
export declare const Portal: typeof Dialog.Portal;
|
|
4
4
|
export { default as Trigger } from './dialog-trigger.svelte';
|
|
5
5
|
export { default as Content } from './dialog-content.svelte';
|
package/dist/ui/dialog/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dialog } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './dialog-root.svelte';
|
|
3
3
|
export const Portal = Dialog.Portal;
|
|
4
4
|
export { default as Trigger } from './dialog-trigger.svelte';
|
|
5
5
|
export { default as Content } from './dialog-content.svelte';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { DropdownMenu } from 'bits-ui';
|
|
3
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
ref = $bindable(null),
|
|
@@ -8,12 +9,15 @@
|
|
|
8
9
|
class: className,
|
|
9
10
|
sideOffset = 4,
|
|
10
11
|
...restProps
|
|
11
|
-
}:
|
|
12
|
+
}: OwnedPartProps<DropdownMenu.ContentProps> = $props();
|
|
13
|
+
|
|
14
|
+
const relay = getAxisRelay();
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
17
|
<DropdownMenu.Portal>
|
|
15
18
|
<DropdownMenu.Content
|
|
16
19
|
bind:ref
|
|
20
|
+
{...relay?.attrs}
|
|
17
21
|
align="start"
|
|
18
22
|
// p-menu, SURFACE-owned on purpose: 0 on flat — rows run the
|
|
19
23
|
// panel's full width, flush, and the first row sits directly under the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownMenu } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const DropdownMenuContent: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const DropdownMenuContent: import("svelte").Component<OwnedPartProps<DropdownMenu.ContentProps>, {}, "ref">;
|
|
4
4
|
type DropdownMenuContent = ReturnType<typeof DropdownMenuContent>;
|
|
5
5
|
export default DropdownMenuContent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { DropdownMenu } from 'bits-ui';
|
|
4
|
+
import { setAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* era owns Root ONLY to open the axis channel — it renders no DOM, adds no
|
|
8
|
+
* behaviour and forwards everything. There has to BE a component here: a
|
|
9
|
+
* re-export (`export const Root = DropdownMenu.Root`) has nowhere to put a context,
|
|
10
|
+
* which is exactly why the axes could not cross the portal before.
|
|
11
|
+
*
|
|
12
|
+
* `open` is re-declared bindable because a spread cannot carry a two-way
|
|
13
|
+
* binding, so wrapping a primitive breaks `bind:open` at every call site
|
|
14
|
+
* unless the wrapper states it.
|
|
15
|
+
*/
|
|
16
|
+
let {
|
|
17
|
+
open = $bindable(false),
|
|
18
|
+
children,
|
|
19
|
+
...restProps
|
|
20
|
+
}: DropdownMenu.RootProps & { children?: Snippet } = $props();
|
|
21
|
+
|
|
22
|
+
const relay = setAxisRelay();
|
|
23
|
+
|
|
24
|
+
// Capture on OPEN, not on mount: bits-ui mounts content eagerly and toggles
|
|
25
|
+
// it, so a mount-time read runs once at page load and never again.
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (open) relay.refresh();
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<DropdownMenu.Root bind:open {...restProps}>
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</DropdownMenu.Root>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { DropdownMenu } from 'bits-ui';
|
|
3
|
+
type $$ComponentProps = DropdownMenu.RootProps & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const DropdownMenuRoot: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
7
|
+
type DropdownMenuRoot = ReturnType<typeof DropdownMenuRoot>;
|
|
8
|
+
export default DropdownMenuRoot;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { DropdownMenu } from 'bits-ui';
|
|
3
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
ref = $bindable(null),
|
|
@@ -8,12 +9,15 @@
|
|
|
8
9
|
class: className,
|
|
9
10
|
sideOffset = 4,
|
|
10
11
|
...restProps
|
|
11
|
-
}:
|
|
12
|
+
}: OwnedPartProps<DropdownMenu.SubContentProps> = $props();
|
|
13
|
+
|
|
14
|
+
const relay = getAxisRelay();
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
17
|
<DropdownMenu.Portal>
|
|
15
18
|
<DropdownMenu.SubContent
|
|
16
19
|
bind:ref
|
|
20
|
+
{...relay?.attrs}
|
|
17
21
|
class={cn(
|
|
18
22
|
'z-overlay w-max overflow-hidden rounded-control bg-elevated p-menu shadow-lg glass-blur',
|
|
19
23
|
className
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownMenu } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const DropdownMenuSubContent: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const DropdownMenuSubContent: import("svelte").Component<OwnedPartProps<DropdownMenu.SubContentProps>, {}, "ref">;
|
|
4
4
|
type DropdownMenuSubContent = ReturnType<typeof DropdownMenuSubContent>;
|
|
5
5
|
export default DropdownMenuSubContent;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DropdownMenu } from 'bits-ui';
|
|
3
3
|
import ChevronRight from '@lucide/svelte/icons/chevron-right';
|
|
4
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
ref = $bindable(null),
|
|
8
8
|
children,
|
|
9
9
|
class: className,
|
|
10
10
|
...restProps
|
|
11
|
-
}:
|
|
11
|
+
}: OwnedPartProps<DropdownMenu.SubTriggerProps> = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<DropdownMenu.SubTrigger
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownMenu } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const DropdownMenuSubTrigger: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const DropdownMenuSubTrigger: import("svelte").Component<OwnedPartProps<DropdownMenu.SubTriggerProps>, {}, "ref">;
|
|
4
4
|
type DropdownMenuSubTrigger = ReturnType<typeof DropdownMenuSubTrigger>;
|
|
5
5
|
export default DropdownMenuSubTrigger;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { DropdownMenu } from 'bits-ui';
|
|
3
4
|
import ChevronDown from '@lucide/svelte/icons/chevron-down';
|
|
4
|
-
import { cn, type
|
|
5
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
5
6
|
|
|
6
7
|
let {
|
|
7
8
|
ref = $bindable(null),
|
|
8
9
|
children,
|
|
9
10
|
class: className,
|
|
10
11
|
...restProps
|
|
11
|
-
}:
|
|
12
|
+
}: OwnedPartProps<DropdownMenu.TriggerProps> = $props();
|
|
13
|
+
|
|
14
|
+
// The trigger is the last node still inside the subtree, so it is the
|
|
15
|
+
// anchor the axes are read FROM when the content opens.
|
|
16
|
+
const relay = getAxisRelay();
|
|
17
|
+
$effect(() => {
|
|
18
|
+
relay?.register(ref);
|
|
19
|
+
});
|
|
12
20
|
</script>
|
|
13
21
|
|
|
14
22
|
<DropdownMenu.Trigger
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownMenu } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const DropdownMenuTrigger: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const DropdownMenuTrigger: import("svelte").Component<OwnedPartProps<DropdownMenu.TriggerProps>, {}, "ref">;
|
|
4
4
|
type DropdownMenuTrigger = ReturnType<typeof DropdownMenuTrigger>;
|
|
5
5
|
export default DropdownMenuTrigger;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownMenu } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './dropdown-menu-root.svelte';
|
|
3
3
|
export declare const Group: typeof DropdownMenu.Group;
|
|
4
4
|
export declare const RadioGroup: typeof DropdownMenu.RadioGroup;
|
|
5
5
|
export declare const Sub: typeof DropdownMenu.Sub;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownMenu } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './dropdown-menu-root.svelte';
|
|
3
3
|
export const Group = DropdownMenu.Group;
|
|
4
4
|
export const RadioGroup = DropdownMenu.RadioGroup;
|
|
5
5
|
export const Sub = DropdownMenu.Sub;
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * as Dialog from './dialog/index.js';
|
|
|
23
23
|
export * as DropdownMenu from './dropdown-menu/index.js';
|
|
24
24
|
export { FileUpload } from './file-upload/index.js';
|
|
25
25
|
export * as Menubar from './menubar/index.js';
|
|
26
|
+
export * as Nav from './nav/index.js';
|
|
26
27
|
export * as Menu from './menu/index.js';
|
|
27
28
|
export { Meter } from './meter/index.js';
|
|
28
29
|
export { Progress } from './progress/index.js';
|
package/dist/ui/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export * as Dialog from './dialog/index.js';
|
|
|
23
23
|
export * as DropdownMenu from './dropdown-menu/index.js';
|
|
24
24
|
export { FileUpload } from './file-upload/index.js';
|
|
25
25
|
export * as Menubar from './menubar/index.js';
|
|
26
|
+
export * as Nav from './nav/index.js';
|
|
26
27
|
export * as Menu from './menu/index.js';
|
|
27
28
|
export { Meter } from './meter/index.js';
|
|
28
29
|
export { Progress } from './progress/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkPreview } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './link-preview-root.svelte';
|
|
3
3
|
export declare const Arrow: typeof LinkPreview.Arrow;
|
|
4
4
|
export declare const ContentStatic: typeof LinkPreview.ContentStatic;
|
|
5
5
|
export declare const Portal: typeof LinkPreview.Portal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkPreview } from 'bits-ui';
|
|
2
|
-
export
|
|
2
|
+
export { default as Root } from './link-preview-root.svelte';
|
|
3
3
|
export const Arrow = LinkPreview.Arrow;
|
|
4
4
|
export const ContentStatic = LinkPreview.ContentStatic;
|
|
5
5
|
export const Portal = LinkPreview.Portal;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { LinkPreview } from 'bits-ui';
|
|
3
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
ref = $bindable(null),
|
|
@@ -8,12 +9,15 @@
|
|
|
8
9
|
class: className,
|
|
9
10
|
sideOffset = 8,
|
|
10
11
|
...restProps
|
|
11
|
-
}:
|
|
12
|
+
}: OwnedPartProps<LinkPreview.ContentProps> = $props();
|
|
13
|
+
|
|
14
|
+
const relay = getAxisRelay();
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
17
|
<LinkPreview.Portal>
|
|
15
18
|
<LinkPreview.Content
|
|
16
19
|
bind:ref
|
|
20
|
+
{...relay?.attrs}
|
|
17
21
|
class={cn(
|
|
18
22
|
'z-overlay max-w-xs rounded-control bg-elevated p-inset-control text-body shadow-lg glass-blur',
|
|
19
23
|
className
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkPreview } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const LinkPreviewContent: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const LinkPreviewContent: import("svelte").Component<OwnedPartProps<LinkPreview.ContentProps>, {}, "ref">;
|
|
4
4
|
type LinkPreviewContent = ReturnType<typeof LinkPreviewContent>;
|
|
5
5
|
export default LinkPreviewContent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { LinkPreview } from 'bits-ui';
|
|
4
|
+
import { setAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* era owns Root ONLY to open the axis channel — it renders no DOM, adds no
|
|
8
|
+
* behaviour and forwards everything. There has to BE a component here: a
|
|
9
|
+
* re-export (`export const Root = LinkPreview.Root`) has nowhere to put a context,
|
|
10
|
+
* which is exactly why the axes could not cross the portal before.
|
|
11
|
+
*
|
|
12
|
+
* `open` is re-declared bindable because a spread cannot carry a two-way
|
|
13
|
+
* binding, so wrapping a primitive breaks `bind:open` at every call site
|
|
14
|
+
* unless the wrapper states it.
|
|
15
|
+
*/
|
|
16
|
+
let {
|
|
17
|
+
open = $bindable(false),
|
|
18
|
+
children,
|
|
19
|
+
...restProps
|
|
20
|
+
}: LinkPreview.RootProps & { children?: Snippet } = $props();
|
|
21
|
+
|
|
22
|
+
const relay = setAxisRelay();
|
|
23
|
+
|
|
24
|
+
// Capture on OPEN, not on mount: bits-ui mounts content eagerly and toggles
|
|
25
|
+
// it, so a mount-time read runs once at page load and never again.
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (open) relay.refresh();
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<LinkPreview.Root bind:open {...restProps}>
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</LinkPreview.Root>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { LinkPreview } from 'bits-ui';
|
|
3
|
+
type $$ComponentProps = LinkPreview.RootProps & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const LinkPreviewRoot: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
7
|
+
type LinkPreviewRoot = ReturnType<typeof LinkPreviewRoot>;
|
|
8
|
+
export default LinkPreviewRoot;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { LinkPreview } from 'bits-ui';
|
|
3
4
|
import { cn, type PartProps } from '../../utils/index.js';
|
|
4
5
|
|
|
@@ -8,6 +9,13 @@
|
|
|
8
9
|
class: className,
|
|
9
10
|
...restProps
|
|
10
11
|
}: PartProps<LinkPreview.TriggerProps> = $props();
|
|
12
|
+
|
|
13
|
+
// The trigger is the last node still inside the subtree, so it is the
|
|
14
|
+
// anchor the axes are read FROM when the content opens.
|
|
15
|
+
const relay = getAxisRelay();
|
|
16
|
+
$effect(() => {
|
|
17
|
+
relay?.register(ref);
|
|
18
|
+
});
|
|
11
19
|
</script>
|
|
12
20
|
|
|
13
21
|
<LinkPreview.Trigger
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { getAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
2
3
|
import { Menubar } from 'bits-ui';
|
|
3
|
-
import { cn, type
|
|
4
|
+
import { cn, type OwnedPartProps } from '../../utils/index.js';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
ref = $bindable(null),
|
|
@@ -8,12 +9,15 @@
|
|
|
8
9
|
class: className,
|
|
9
10
|
sideOffset = 4,
|
|
10
11
|
...restProps
|
|
11
|
-
}:
|
|
12
|
+
}: OwnedPartProps<Menubar.ContentProps> = $props();
|
|
13
|
+
|
|
14
|
+
const relay = getAxisRelay();
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
17
|
<Menubar.Portal>
|
|
15
18
|
<Menubar.Content
|
|
16
19
|
bind:ref
|
|
20
|
+
{...relay?.attrs}
|
|
17
21
|
align="start"
|
|
18
22
|
// p-menu, SURFACE-owned on purpose: 0 on flat — rows run the
|
|
19
23
|
// panel's full width, flush, and the first row sits directly under the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Menubar } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const MenubarContent: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const MenubarContent: import("svelte").Component<OwnedPartProps<Menubar.ContentProps>, {}, "ref">;
|
|
4
4
|
type MenubarContent = ReturnType<typeof MenubarContent>;
|
|
5
5
|
export default MenubarContent;
|