@signal9/era-ui 21.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.
- package/CHANGELOG.md +45 -0
- package/dist/dev/audit/audits/off-tier-height.js +16 -2
- package/dist/dev/audit/audits/wall-is-isotropic.js +15 -10
- package/dist/era-ui.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles/typography.css +48 -9
- 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/card/card.svelte +3 -0
- 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-field/date-field-input.svelte +9 -0
- 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-field/date-range-field-input.svelte +9 -0
- 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/meter/meter.svelte +50 -2
- package/dist/ui/meter/meter.svelte.d.ts +38 -1
- 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/time-field/time-field-input.svelte +9 -0
- package/dist/ui/time-range-field/time-range-field-input.svelte +9 -0
- 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 +6 -4
|
@@ -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;
|
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Menubar } from 'bits-ui';
|
|
3
3
|
import { cn } from '../../utils/index.js';
|
|
4
|
+
import { setAxisRelay } from '../provider/axis-relay.svelte.js';
|
|
4
5
|
|
|
5
|
-
let {
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(''),
|
|
9
|
+
class: className,
|
|
10
|
+
...restProps
|
|
11
|
+
}: Menubar.RootProps = $props();
|
|
12
|
+
|
|
13
|
+
const relay = setAxisRelay();
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Menubar's "open" is `value` — WHICH menu is open, not whether one is — so
|
|
17
|
+
* the capture keys off a non-empty value. Same reason as everywhere else:
|
|
18
|
+
* bits-ui mounts content eagerly, so reading at mount reads page load.
|
|
19
|
+
*
|
|
20
|
+
* The root ELEMENT is the anchor here rather than a trigger. A menubar's
|
|
21
|
+
* triggers are inside it, so the bar sits at the same place in the tree for
|
|
22
|
+
* axis purposes, and it exists whether or not any menu has been opened.
|
|
23
|
+
*/
|
|
24
|
+
$effect(() => {
|
|
25
|
+
relay.register(ref);
|
|
26
|
+
});
|
|
27
|
+
$effect(() => {
|
|
28
|
+
if (value) relay.refresh();
|
|
29
|
+
});
|
|
6
30
|
</script>
|
|
7
31
|
|
|
8
32
|
<Menubar.Root
|
|
9
33
|
bind:ref
|
|
34
|
+
bind:value
|
|
10
35
|
class={cn('flex h-bar items-center rounded-bar bg-well px-gutter shadow-sm', className)}
|
|
11
36
|
{...restProps}
|
|
12
37
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Menubar } from 'bits-ui';
|
|
2
|
-
declare const MenubarRoot: import("svelte").Component<Menubar.RootProps, {}, "ref">;
|
|
2
|
+
declare const MenubarRoot: import("svelte").Component<Menubar.RootProps, {}, "value" | "ref">;
|
|
3
3
|
type MenubarRoot = ReturnType<typeof MenubarRoot>;
|
|
4
4
|
export default MenubarRoot;
|
|
@@ -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.SubContentProps> = $props();
|
|
13
|
+
|
|
14
|
+
const relay = getAxisRelay();
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
17
|
<Menubar.Portal>
|
|
15
18
|
<Menubar.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 { Menubar } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const MenubarSubContent: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const MenubarSubContent: import("svelte").Component<OwnedPartProps<Menubar.SubContentProps>, {}, "ref">;
|
|
4
4
|
type MenubarSubContent = ReturnType<typeof MenubarSubContent>;
|
|
5
5
|
export default MenubarSubContent;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Menubar } 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<Menubar.SubTriggerProps> = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<Menubar.SubTrigger
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Menubar } from 'bits-ui';
|
|
2
|
-
import { type
|
|
3
|
-
declare const MenubarSubTrigger: import("svelte").Component<
|
|
2
|
+
import { type OwnedPartProps } from '../../utils/index.js';
|
|
3
|
+
declare const MenubarSubTrigger: import("svelte").Component<OwnedPartProps<Menubar.SubTriggerProps>, {}, "ref">;
|
|
4
4
|
type MenubarSubTrigger = ReturnType<typeof MenubarSubTrigger>;
|
|
5
5
|
export default MenubarSubTrigger;
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv } from '../../utils/index.js';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* A meter reports a LEVEL inside a known range — disk usage, a quota, a
|
|
6
|
+
* score — so "how is this level doing" is the one thing it exists to say,
|
|
7
|
+
* and it was the one thing it could not say. Consumers were reaching past
|
|
8
|
+
* the component for it (`class="[&>div]:bg-destructive"`), which reaches
|
|
9
|
+
* through a private child and breaks the moment the fill's markup changes.
|
|
10
|
+
*
|
|
11
|
+
* The tones are the library's five, spelled exactly as Badge and Button
|
|
12
|
+
* spell them, so a meter beside a badge that both read "warning" render the
|
|
13
|
+
* same hue. `default` stays bg-fg: a meter with nothing to report should not
|
|
14
|
+
* look like it is reporting something.
|
|
15
|
+
*
|
|
16
|
+
* The tone is on the FILL, not the track. The track is the well the value
|
|
17
|
+
* sits in — it belongs to the container, not to the reading — so tinting it
|
|
18
|
+
* would say "this whole control is in a warning state" rather than "the
|
|
19
|
+
* value has reached the warning band".
|
|
20
|
+
*/
|
|
21
|
+
export const meterFillVariants = tv({
|
|
22
|
+
base: 'h-full w-full transition-transform duration-base ease-base',
|
|
23
|
+
variants: {
|
|
24
|
+
tone: {
|
|
25
|
+
default: 'bg-fg',
|
|
26
|
+
accent: 'bg-primary',
|
|
27
|
+
destructive: 'bg-destructive',
|
|
28
|
+
success: 'bg-success',
|
|
29
|
+
warning: 'bg-warning'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: { tone: 'default' }
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
1
36
|
<script lang="ts">
|
|
2
37
|
import { Meter } from 'bits-ui';
|
|
3
38
|
import { cn } from '../../utils/index.js';
|
|
@@ -7,9 +42,21 @@
|
|
|
7
42
|
value = 0,
|
|
8
43
|
min = 0,
|
|
9
44
|
max = 100,
|
|
45
|
+
tone = 'default',
|
|
10
46
|
class: className,
|
|
11
47
|
...restProps
|
|
12
|
-
}: Meter.RootProps
|
|
48
|
+
}: Meter.RootProps & {
|
|
49
|
+
/**
|
|
50
|
+
* The band this reading falls in. Tone is the fill's colour only — the
|
|
51
|
+
* track stays neutral, because the well belongs to the control and the
|
|
52
|
+
* fill belongs to the value.
|
|
53
|
+
*
|
|
54
|
+
* Tone carries no semantics on its own: a meter in the destructive band
|
|
55
|
+
* still needs an accessible label saying what has run out. Pair it with
|
|
56
|
+
* `aria-label` / a visible label, never rely on the hue alone.
|
|
57
|
+
*/
|
|
58
|
+
tone?: 'default' | 'accent' | 'destructive' | 'success' | 'warning';
|
|
59
|
+
} = $props();
|
|
13
60
|
|
|
14
61
|
let percentage = $derived(((value - min) / (max - min)) * 100);
|
|
15
62
|
</script>
|
|
@@ -19,6 +66,7 @@
|
|
|
19
66
|
{value}
|
|
20
67
|
{min}
|
|
21
68
|
{max}
|
|
69
|
+
data-tone={tone}
|
|
22
70
|
class={cn(
|
|
23
71
|
'h-(--era-sp) w-full overflow-hidden rounded-control bg-elevated shadow-well',
|
|
24
72
|
className
|
|
@@ -26,7 +74,7 @@
|
|
|
26
74
|
{...restProps}
|
|
27
75
|
>
|
|
28
76
|
<div
|
|
29
|
-
class=
|
|
77
|
+
class={meterFillVariants({ tone })}
|
|
30
78
|
style="transform: translateX(-{100 - percentage}%)"
|
|
31
79
|
></div>
|
|
32
80
|
</Meter.Root>
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
+
export declare const meterFillVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
tone: {
|
|
3
|
+
default: "bg-fg";
|
|
4
|
+
accent: "bg-primary";
|
|
5
|
+
destructive: "bg-destructive";
|
|
6
|
+
success: "bg-success";
|
|
7
|
+
warning: "bg-warning";
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "h-full w-full transition-transform duration-base ease-base", {
|
|
10
|
+
tone: {
|
|
11
|
+
default: "bg-fg";
|
|
12
|
+
accent: "bg-primary";
|
|
13
|
+
destructive: "bg-destructive";
|
|
14
|
+
success: "bg-success";
|
|
15
|
+
warning: "bg-warning";
|
|
16
|
+
};
|
|
17
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
18
|
+
tone: {
|
|
19
|
+
default: "bg-fg";
|
|
20
|
+
accent: "bg-primary";
|
|
21
|
+
destructive: "bg-destructive";
|
|
22
|
+
success: "bg-success";
|
|
23
|
+
warning: "bg-warning";
|
|
24
|
+
};
|
|
25
|
+
}, undefined>>;
|
|
1
26
|
import { Meter } from 'bits-ui';
|
|
2
|
-
|
|
27
|
+
type $$ComponentProps = Meter.RootProps & {
|
|
28
|
+
/**
|
|
29
|
+
* The band this reading falls in. Tone is the fill's colour only — the
|
|
30
|
+
* track stays neutral, because the well belongs to the control and the
|
|
31
|
+
* fill belongs to the value.
|
|
32
|
+
*
|
|
33
|
+
* Tone carries no semantics on its own: a meter in the destructive band
|
|
34
|
+
* still needs an accessible label saying what has run out. Pair it with
|
|
35
|
+
* `aria-label` / a visible label, never rely on the hue alone.
|
|
36
|
+
*/
|
|
37
|
+
tone?: 'default' | 'accent' | 'destructive' | 'success' | 'warning';
|
|
38
|
+
};
|
|
39
|
+
declare const Meter: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
3
40
|
type Meter = ReturnType<typeof Meter>;
|
|
4
41
|
export default Meter;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn } from '../../utils/index.js';
|
|
5
|
+
// Bar's geometry, imported rather than restated. A re-export here would be a
|
|
6
|
+
// second name for one thing; anyone who wants the variants imports them from
|
|
7
|
+
// Bar, which is where they are defined.
|
|
8
|
+
import { barVariants } from '../bar/bar.svelte';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
ref = $bindable(null),
|
|
12
|
+
size = 'bar',
|
|
13
|
+
content = 'tier',
|
|
14
|
+
label = 'Main',
|
|
15
|
+
children,
|
|
16
|
+
class: className,
|
|
17
|
+
...restProps
|
|
18
|
+
}: HTMLAttributes<HTMLElement> & {
|
|
19
|
+
ref?: HTMLElement | null;
|
|
20
|
+
/** Height tier, exactly as Bar's — the geometry is Bar's, not a second copy. */
|
|
21
|
+
size?: 'chip' | 'control' | 'bar';
|
|
22
|
+
/** Tier of the items inside, so the wall stays concentric to them. */
|
|
23
|
+
content?: 'tier' | 'pill';
|
|
24
|
+
/**
|
|
25
|
+
* The accessible name for this landmark. A page may hold several
|
|
26
|
+
* navigations (primary, breadcrumb, pagination, footer) and a screen
|
|
27
|
+
* reader lists them all by name — unnamed, they read as "navigation",
|
|
28
|
+
* "navigation", "navigation". Defaults to "Main" rather than nothing so
|
|
29
|
+
* the common case is named without anyone having to know this.
|
|
30
|
+
*/
|
|
31
|
+
label?: string;
|
|
32
|
+
children?: Snippet;
|
|
33
|
+
} = $props();
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<!--
|
|
37
|
+
A <nav> LANDMARK, not a styled div, which is the entire reason this exists
|
|
38
|
+
next to Bar. Bar is a layout primitive: a flex row on a tier with concentric
|
|
39
|
+
walls, and deliberately semantics-free, so consumers were building tab bars
|
|
40
|
+
out of it and shipping a row of links no assistive technology could find or
|
|
41
|
+
skip. Nav.Bar is that same geometry — it literally reuses barVariants rather
|
|
42
|
+
than restating it — with the landmark and the name attached.
|
|
43
|
+
-->
|
|
44
|
+
<nav
|
|
45
|
+
bind:this={ref}
|
|
46
|
+
aria-label={label}
|
|
47
|
+
class={cn(barVariants({ size, content }), className)}
|
|
48
|
+
{...restProps}
|
|
49
|
+
>
|
|
50
|
+
{@render children?.()}
|
|
51
|
+
</nav>
|