This commit is contained in:
eewing
2026-02-17 14:10:16 -06:00
parent 2bca5834c5
commit cf73cd3b4c
11246 changed files with 1690552 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import { SeparatorRootState } from "../separator.svelte.js";
import type { SeparatorRootProps } from "../types.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
id = createId(uid),
ref = $bindable(null),
child,
children,
decorative = false,
orientation = "horizontal",
...restProps
}: SeparatorRootProps = $props();
const rootState = SeparatorRootState.create({
ref: boxWith(
() => ref,
(v) => (ref = v)
),
id: boxWith(() => id),
decorative: boxWith(() => decorative),
orientation: boxWith(() => orientation),
});
const mergedProps = $derived(mergeProps(restProps, rootState.props));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<div {...mergedProps}>
{@render children?.()}
</div>
{/if}
@@ -0,0 +1,4 @@
import type { SeparatorRootProps } from "../types.js";
declare const Separator: import("svelte").Component<SeparatorRootProps, {}, "ref">;
type Separator = ReturnType<typeof Separator>;
export default Separator;
+2
View File
@@ -0,0 +1,2 @@
export { default as Root } from "./components/separator.svelte";
export type { SeparatorRootProps as RootProps } from "./types.js";
+1
View File
@@ -0,0 +1 @@
export { default as Root } from "./components/separator.svelte";
+1
View File
@@ -0,0 +1 @@
export * as Separator from "./exports.js";
+1
View File
@@ -0,0 +1 @@
export * as Separator from "./exports.js";
+22
View File
@@ -0,0 +1,22 @@
import { type ReadableBoxedValues } from "svelte-toolbelt";
import type { RefAttachment, WithRefOpts } from "../../internal/types.js";
import type { Orientation } from "../../shared/index.js";
interface SeparatorRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
orientation: Orientation;
decorative: boolean;
}> {
}
export declare class SeparatorRootState {
static create(opts: SeparatorRootStateOpts): SeparatorRootState;
readonly opts: SeparatorRootStateOpts;
readonly attachment: RefAttachment;
constructor(opts: SeparatorRootStateOpts);
readonly props: {
readonly id: string;
readonly role: "none" | "separator";
readonly "aria-orientation": Orientation;
readonly "aria-hidden": "true" | undefined;
readonly "data-orientation": Orientation;
};
}
export {};
+26
View File
@@ -0,0 +1,26 @@
import { attachRef } from "svelte-toolbelt";
import { createBitsAttrs, boolToStrTrueOrUndef } from "../../internal/attrs.js";
const separatorAttrs = createBitsAttrs({
component: "separator",
parts: ["root"],
});
export class SeparatorRootState {
static create(opts) {
return new SeparatorRootState(opts);
}
opts;
attachment;
constructor(opts) {
this.opts = opts;
this.attachment = attachRef(opts.ref);
}
props = $derived.by(() => ({
id: this.opts.id.current,
role: this.opts.decorative.current ? "none" : "separator",
"aria-orientation": this.opts.orientation.current,
"aria-hidden": boolToStrTrueOrUndef(this.opts.decorative.current),
"data-orientation": this.opts.orientation.current,
[separatorAttrs.root]: "",
...this.attachment,
}));
}
+18
View File
@@ -0,0 +1,18 @@
import type { WithChild, Without } from "../../internal/types.js";
import type { Orientation } from "../../shared/index.js";
import type { BitsPrimitiveDivAttributes } from "../../shared/attributes.js";
export type SeparatorRootPropsWithoutHTML = WithChild<{
/**
* The orientation of the separator.
*
* @defaultValue "horizontal"
*/
orientation?: Orientation;
/**
* Whether the separator is decorative and should be hidden from assistive technologies.
*
* @defaultValue false
*/
decorative?: boolean;
}>;
export type SeparatorRootProps = SeparatorRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, SeparatorRootPropsWithoutHTML>;
+1
View File
@@ -0,0 +1 @@
export {};