@signal9/era-ui 22.0.0 → 23.0.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/era-ui.css +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/ui/accordion/accordion-trigger.svelte +2 -2
  5. package/dist/ui/accordion/accordion-trigger.svelte.d.ts +2 -2
  6. package/dist/ui/alert-dialog/alert-dialog-content.svelte +6 -2
  7. package/dist/ui/alert-dialog/alert-dialog-content.svelte.d.ts +2 -2
  8. package/dist/ui/alert-dialog/alert-dialog-root.svelte +33 -0
  9. package/dist/ui/alert-dialog/alert-dialog-root.svelte.d.ts +8 -0
  10. package/dist/ui/alert-dialog/alert-dialog-trigger.svelte +8 -0
  11. package/dist/ui/alert-dialog/index.d.ts +1 -1
  12. package/dist/ui/alert-dialog/index.js +1 -1
  13. package/dist/ui/combobox/combobox-trigger.svelte +2 -2
  14. package/dist/ui/combobox/combobox-trigger.svelte.d.ts +2 -2
  15. package/dist/ui/context-menu/context-menu-content.svelte +6 -2
  16. package/dist/ui/context-menu/context-menu-content.svelte.d.ts +2 -2
  17. package/dist/ui/context-menu/context-menu-root.svelte +33 -0
  18. package/dist/ui/context-menu/context-menu-root.svelte.d.ts +8 -0
  19. package/dist/ui/context-menu/context-menu-sub-content.svelte +6 -2
  20. package/dist/ui/context-menu/context-menu-sub-content.svelte.d.ts +2 -2
  21. package/dist/ui/context-menu/context-menu-sub-trigger.svelte +2 -2
  22. package/dist/ui/context-menu/context-menu-sub-trigger.svelte.d.ts +2 -2
  23. package/dist/ui/context-menu/context-menu-trigger.svelte +8 -0
  24. package/dist/ui/context-menu/index.d.ts +1 -1
  25. package/dist/ui/context-menu/index.js +1 -1
  26. package/dist/ui/date-picker/date-picker-trigger.svelte +2 -2
  27. package/dist/ui/date-picker/date-picker-trigger.svelte.d.ts +2 -2
  28. package/dist/ui/date-range-picker/date-range-picker-trigger.svelte +2 -2
  29. package/dist/ui/date-range-picker/date-range-picker-trigger.svelte.d.ts +2 -2
  30. package/dist/ui/dialog/dialog-content.svelte +16 -2
  31. package/dist/ui/dialog/dialog-content.svelte.d.ts +2 -2
  32. package/dist/ui/dialog/dialog-root.svelte +43 -0
  33. package/dist/ui/dialog/dialog-root.svelte.d.ts +8 -0
  34. package/dist/ui/dialog/dialog-trigger.svelte +10 -0
  35. package/dist/ui/dialog/index.d.ts +1 -1
  36. package/dist/ui/dialog/index.js +1 -1
  37. package/dist/ui/dropdown-menu/dropdown-menu-content.svelte +6 -2
  38. package/dist/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +2 -2
  39. package/dist/ui/dropdown-menu/dropdown-menu-root.svelte +33 -0
  40. package/dist/ui/dropdown-menu/dropdown-menu-root.svelte.d.ts +8 -0
  41. package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte +6 -2
  42. package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +2 -2
  43. package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +2 -2
  44. package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +2 -2
  45. package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte +10 -2
  46. package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +2 -2
  47. package/dist/ui/dropdown-menu/index.d.ts +1 -1
  48. package/dist/ui/dropdown-menu/index.js +1 -1
  49. package/dist/ui/index.d.ts +1 -0
  50. package/dist/ui/index.js +1 -0
  51. package/dist/ui/link-preview/index.d.ts +1 -1
  52. package/dist/ui/link-preview/index.js +1 -1
  53. package/dist/ui/link-preview/link-preview-content.svelte +6 -2
  54. package/dist/ui/link-preview/link-preview-content.svelte.d.ts +2 -2
  55. package/dist/ui/link-preview/link-preview-root.svelte +33 -0
  56. package/dist/ui/link-preview/link-preview-root.svelte.d.ts +8 -0
  57. package/dist/ui/link-preview/link-preview-trigger.svelte +8 -0
  58. package/dist/ui/menubar/menubar-content.svelte +6 -2
  59. package/dist/ui/menubar/menubar-content.svelte.d.ts +2 -2
  60. package/dist/ui/menubar/menubar-root.svelte +26 -1
  61. package/dist/ui/menubar/menubar-root.svelte.d.ts +1 -1
  62. package/dist/ui/menubar/menubar-sub-content.svelte +6 -2
  63. package/dist/ui/menubar/menubar-sub-content.svelte.d.ts +2 -2
  64. package/dist/ui/menubar/menubar-sub-trigger.svelte +2 -2
  65. package/dist/ui/menubar/menubar-sub-trigger.svelte.d.ts +2 -2
  66. package/dist/ui/nav/index.d.ts +2 -0
  67. package/dist/ui/nav/index.js +2 -0
  68. package/dist/ui/nav/nav-bar.svelte +51 -0
  69. package/dist/ui/nav/nav-bar.svelte.d.ts +21 -0
  70. package/dist/ui/nav/nav-item.svelte +79 -0
  71. package/dist/ui/nav/nav-item.svelte.d.ts +29 -0
  72. package/dist/ui/provider/axes.d.ts +14 -1
  73. package/dist/ui/provider/axis-relay.svelte.d.ts +34 -0
  74. package/dist/ui/provider/axis-relay.svelte.js +109 -0
  75. package/dist/ui/select/select-content.svelte +2 -2
  76. package/dist/ui/select/select-content.svelte.d.ts +2 -2
  77. package/dist/ui/select/select-trigger.svelte +2 -2
  78. package/dist/ui/select/select-trigger.svelte.d.ts +2 -2
  79. package/dist/ui/sheet/sheet-content.svelte +8 -2
  80. package/dist/ui/sheet/sheet-content.svelte.d.ts +2 -2
  81. package/dist/ui/step/step-content.svelte +2 -2
  82. package/dist/ui/step/step-content.svelte.d.ts +2 -2
  83. package/dist/ui/step/step-summary.svelte +2 -2
  84. package/dist/ui/step/step-summary.svelte.d.ts +2 -2
  85. package/dist/ui/tooltip/index.d.ts +1 -1
  86. package/dist/ui/tooltip/index.js +1 -1
  87. package/dist/ui/tooltip/tooltip-content.svelte +6 -2
  88. package/dist/ui/tooltip/tooltip-content.svelte.d.ts +2 -2
  89. package/dist/ui/tooltip/tooltip-root.svelte +33 -0
  90. package/dist/ui/tooltip/tooltip-root.svelte.d.ts +8 -0
  91. package/dist/ui/tooltip/tooltip-trigger.svelte +8 -0
  92. package/dist/utils/index.d.ts +36 -3
  93. package/package.json +1 -1
@@ -1,19 +1,23 @@
1
1
  <script lang="ts">
2
+ import { getAxisRelay } from '../provider/axis-relay.svelte.js';
2
3
  import { AlertDialog } from 'bits-ui';
3
- import { cn, type PartProps } from '../../utils/index.js';
4
+ import { cn, type OwnedPartProps } from '../../utils/index.js';
4
5
 
5
6
  let {
6
7
  ref = $bindable(null),
7
8
  children,
8
9
  class: className,
9
10
  ...restProps
10
- }: PartProps<AlertDialog.ContentProps> = $props();
11
+ }: OwnedPartProps<AlertDialog.ContentProps> = $props();
12
+
13
+ const relay = getAxisRelay();
11
14
  </script>
12
15
 
13
16
  <AlertDialog.Portal>
14
17
  <AlertDialog.Overlay class="fixed inset-0 z-overlay bg-overlay" />
15
18
  <AlertDialog.Content
16
19
  bind:ref
20
+ {...relay?.attrs}
17
21
  class={cn(
18
22
  '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 gap-gutter rounded-bar border border-divider bg-well p-card shadow-lg glass-blur',
19
23
  className
@@ -1,4 +1,4 @@
1
- import { type PartProps } from '../../utils/index.js';
2
- declare const AlertDialogContent: import("svelte").Component<PartProps<import("bits-ui").DialogContentProps>, {}, "ref">;
1
+ import { type OwnedPartProps } from '../../utils/index.js';
2
+ declare const AlertDialogContent: import("svelte").Component<OwnedPartProps<import("bits-ui").DialogContentProps>, {}, "ref">;
3
3
  type AlertDialogContent = ReturnType<typeof AlertDialogContent>;
4
4
  export default AlertDialogContent;
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { AlertDialog } 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 = AlertDialog.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
+ }: AlertDialog.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
+ <AlertDialog.Root bind:open {...restProps}>
32
+ {@render children?.()}
33
+ </AlertDialog.Root>
@@ -0,0 +1,8 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { AlertDialog } from 'bits-ui';
3
+ type $$ComponentProps = AlertDialog.RootProps & {
4
+ children?: Snippet;
5
+ };
6
+ declare const AlertDialogRoot: import("svelte").Component<$$ComponentProps, {}, "open">;
7
+ type AlertDialogRoot = ReturnType<typeof AlertDialogRoot>;
8
+ export default AlertDialogRoot;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { getAxisRelay } from '../provider/axis-relay.svelte.js';
2
3
  import type { Snippet } from 'svelte';
3
4
  import { AlertDialog, type WithoutChildrenOrChild } from 'bits-ui';
4
5
  import { Button, type ButtonVariants } from '../button';
@@ -17,6 +18,13 @@
17
18
  ButtonVariants & {
18
19
  children?: Snippet;
19
20
  } = $props();
21
+
22
+ // The trigger is the last node still inside the subtree, so it is the
23
+ // anchor the axes are read FROM when the content opens.
24
+ const relay = getAxisRelay();
25
+ $effect(() => {
26
+ relay?.register(ref);
27
+ });
20
28
  </script>
21
29
 
22
30
  <AlertDialog.Trigger {...restProps}>
@@ -1,5 +1,5 @@
1
1
  import { AlertDialog } from 'bits-ui';
2
- export declare const Root: typeof AlertDialog.Root;
2
+ export { default as Root } from './alert-dialog-root.svelte';
3
3
  export declare const Portal: typeof AlertDialog.Portal;
4
4
  export { default as Trigger } from './alert-dialog-trigger.svelte';
5
5
  export { default as Content } from './alert-dialog-content.svelte';
@@ -1,5 +1,5 @@
1
1
  import { AlertDialog } from 'bits-ui';
2
- export const Root = AlertDialog.Root;
2
+ export { default as Root } from './alert-dialog-root.svelte';
3
3
  export const Portal = AlertDialog.Portal;
4
4
  export { default as Trigger } from './alert-dialog-trigger.svelte';
5
5
  export { default as Content } from './alert-dialog-content.svelte';
@@ -1,14 +1,14 @@
1
1
  <script lang="ts">
2
2
  import { Combobox } from 'bits-ui';
3
3
  import ChevronDown from '@lucide/svelte/icons/chevron-down';
4
- import { cn, type PartProps } from '../../utils/index.js';
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
- }: PartProps<Combobox.TriggerProps> = $props();
11
+ }: OwnedPartProps<Combobox.TriggerProps> = $props();
12
12
  </script>
13
13
 
14
14
  <Combobox.Trigger
@@ -1,5 +1,5 @@
1
1
  import { Combobox } from 'bits-ui';
2
- import { type PartProps } from '../../utils/index.js';
3
- declare const ComboboxTrigger: import("svelte").Component<PartProps<Combobox.TriggerProps>, {}, "ref">;
2
+ import { type OwnedPartProps } from '../../utils/index.js';
3
+ declare const ComboboxTrigger: import("svelte").Component<OwnedPartProps<Combobox.TriggerProps>, {}, "ref">;
4
4
  type ComboboxTrigger = ReturnType<typeof ComboboxTrigger>;
5
5
  export default ComboboxTrigger;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
+ import { getAxisRelay } from '../provider/axis-relay.svelte.js';
2
3
  import { ContextMenu } from 'bits-ui';
3
- import { cn, type PartProps } from '../../utils/index.js';
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
- }: PartProps<ContextMenu.ContentProps> = $props();
12
+ }: OwnedPartProps<ContextMenu.ContentProps> = $props();
13
+
14
+ const relay = getAxisRelay();
12
15
  </script>
13
16
 
14
17
  <ContextMenu.Portal>
15
18
  <ContextMenu.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,4 +1,4 @@
1
- import { type PartProps } from '../../utils/index.js';
2
- declare const ContextMenuContent: import("svelte").Component<PartProps<import("bits-ui").DropdownMenuContentProps>, {}, "ref">;
1
+ import { type OwnedPartProps } from '../../utils/index.js';
2
+ declare const ContextMenuContent: import("svelte").Component<OwnedPartProps<import("bits-ui").DropdownMenuContentProps>, {}, "ref">;
3
3
  type ContextMenuContent = ReturnType<typeof ContextMenuContent>;
4
4
  export default ContextMenuContent;
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { ContextMenu } 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 = ContextMenu.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
+ }: ContextMenu.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
+ <ContextMenu.Root bind:open {...restProps}>
32
+ {@render children?.()}
33
+ </ContextMenu.Root>
@@ -0,0 +1,8 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { ContextMenu } from 'bits-ui';
3
+ type $$ComponentProps = ContextMenu.RootProps & {
4
+ children?: Snippet;
5
+ };
6
+ declare const ContextMenuRoot: import("svelte").Component<$$ComponentProps, {}, "open">;
7
+ type ContextMenuRoot = ReturnType<typeof ContextMenuRoot>;
8
+ export default ContextMenuRoot;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
+ import { getAxisRelay } from '../provider/axis-relay.svelte.js';
2
3
  import { ContextMenu } from 'bits-ui';
3
- import { cn, type PartProps } from '../../utils/index.js';
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
- }: PartProps<ContextMenu.SubContentProps> = $props();
12
+ }: OwnedPartProps<ContextMenu.SubContentProps> = $props();
13
+
14
+ const relay = getAxisRelay();
12
15
  </script>
13
16
 
14
17
  <ContextMenu.Portal>
15
18
  <ContextMenu.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 { ContextMenu } from 'bits-ui';
2
- import { type PartProps } from '../../utils/index.js';
3
- declare const ContextMenuSubContent: import("svelte").Component<PartProps<ContextMenu.SubContentProps>, {}, "ref">;
2
+ import { type OwnedPartProps } from '../../utils/index.js';
3
+ declare const ContextMenuSubContent: import("svelte").Component<OwnedPartProps<ContextMenu.SubContentProps>, {}, "ref">;
4
4
  type ContextMenuSubContent = ReturnType<typeof ContextMenuSubContent>;
5
5
  export default ContextMenuSubContent;
@@ -1,14 +1,14 @@
1
1
  <script lang="ts">
2
2
  import { ContextMenu } from 'bits-ui';
3
3
  import ChevronRight from '@lucide/svelte/icons/chevron-right';
4
- import { cn, type PartProps } from '../../utils/index.js';
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
- }: PartProps<ContextMenu.SubTriggerProps> = $props();
11
+ }: OwnedPartProps<ContextMenu.SubTriggerProps> = $props();
12
12
  </script>
13
13
 
14
14
  <ContextMenu.SubTrigger
@@ -1,5 +1,5 @@
1
1
  import { ContextMenu } from 'bits-ui';
2
- import { type PartProps } from '../../utils/index.js';
3
- declare const ContextMenuSubTrigger: import("svelte").Component<PartProps<ContextMenu.SubTriggerProps>, {}, "ref">;
2
+ import { type OwnedPartProps } from '../../utils/index.js';
3
+ declare const ContextMenuSubTrigger: import("svelte").Component<OwnedPartProps<ContextMenu.SubTriggerProps>, {}, "ref">;
4
4
  type ContextMenuSubTrigger = ReturnType<typeof ContextMenuSubTrigger>;
5
5
  export default ContextMenuSubTrigger;
@@ -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 declare const Root: typeof ContextMenu.Root;
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 const Root = ContextMenu.Root;
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 PartProps } from '../../utils/index.js';
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
- }: PartProps<DatePicker.TriggerProps> = $props();
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 PartProps } from '../../utils/index.js';
3
- declare const DatePickerTrigger: import("svelte").Component<PartProps<DatePicker.TriggerProps>, {}, "ref">;
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 PartProps } from '../../utils/index.js';
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
- }: PartProps<DateRangePicker.TriggerProps> = $props();
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 PartProps } from '../../utils/index.js';
3
- declare const DateRangePickerTrigger: import("svelte").Component<PartProps<DateRangePicker.TriggerProps>, {}, "ref">;
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 PartProps } from '../../utils/index.js';
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
- }: PartProps<Dialog.ContentProps> & {
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 PartProps } from '../../utils/index.js';
4
- type $$ComponentProps = PartProps<Dialog.ContentProps> & {
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 declare const Root: typeof Dialog.Root;
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';
@@ -1,5 +1,5 @@
1
1
  import { Dialog } from 'bits-ui';
2
- export const Root = Dialog.Root;
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 PartProps } from '../../utils/index.js';
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
- }: PartProps<DropdownMenu.ContentProps> = $props();
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 PartProps } from '../../utils/index.js';
3
- declare const DropdownMenuContent: import("svelte").Component<PartProps<DropdownMenu.ContentProps>, {}, "ref">;
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 PartProps } from '../../utils/index.js';
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
- }: PartProps<DropdownMenu.SubContentProps> = $props();
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 PartProps } from '../../utils/index.js';
3
- declare const DropdownMenuSubContent: import("svelte").Component<PartProps<DropdownMenu.SubContentProps>, {}, "ref">;
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;