svelte-docsmith 0.2.0 → 0.3.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/README.md +57 -25
- package/dist/clipboard.svelte.d.ts +1 -1
- package/dist/clipboard.svelte.js +15 -8
- package/dist/config.d.ts +36 -6
- package/dist/config.js +33 -7
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -0
- package/dist/markdown-layout.svelte +14 -1
- package/dist/markdown-layout.svelte.d.ts +2 -0
- package/dist/preprocess.d.ts +4 -5
- package/dist/preprocess.js +4 -5
- package/dist/search/context.svelte.d.ts +7 -0
- package/dist/search/context.svelte.js +20 -0
- package/dist/search/create-search.d.ts +14 -0
- package/dist/search/create-search.js +56 -0
- package/dist/search/snippet.d.ts +7 -0
- package/dist/search/snippet.js +43 -0
- package/dist/search.d.ts +10 -0
- package/dist/search.js +4 -0
- package/dist/theme.css +25 -0
- package/dist/types.d.ts +0 -6
- package/dist/ui/badge.svelte +10 -1
- package/dist/ui/badge.svelte.d.ts +2 -0
- package/dist/ui/callout.svelte +9 -9
- package/dist/ui/callout.svelte.d.ts +3 -3
- package/dist/ui/layouts/docs-header.svelte +5 -11
- package/dist/ui/layouts/docs-header.svelte.d.ts +0 -6
- package/dist/ui/layouts/docs-mobile-header.svelte +40 -8
- package/dist/ui/layouts/docs-mobile-header.svelte.d.ts +5 -4
- package/dist/ui/layouts/docs-shell.svelte +49 -5
- package/dist/ui/layouts/docs-shell.svelte.d.ts +16 -1
- package/dist/ui/layouts/error-page.svelte +82 -0
- package/dist/ui/layouts/error-page.svelte.d.ts +25 -0
- package/dist/ui/layouts/seo-head.svelte +65 -0
- package/dist/ui/layouts/seo-head.svelte.d.ts +11 -0
- package/dist/ui/markdown/h2.svelte +7 -3
- package/dist/ui/markdown/h3.svelte +7 -3
- package/dist/ui/markdown/pre.svelte +1 -1
- package/dist/ui/prop.svelte +71 -36
- package/dist/ui/prop.svelte.d.ts +1 -1
- package/dist/ui/props-table.svelte +10 -62
- package/dist/ui/search-trigger.svelte +31 -0
- package/dist/ui/search-trigger.svelte.d.ts +6 -0
- package/dist/ui/search.svelte +167 -0
- package/dist/ui/search.svelte.d.ts +13 -0
- package/dist/ui/shadcn/accordion/accordion.svelte.d.ts +1 -1
- package/dist/ui/shadcn/command/command-dialog.svelte +42 -0
- package/dist/ui/shadcn/command/command-dialog.svelte.d.ts +14 -0
- package/dist/ui/shadcn/command/command-empty.svelte +17 -0
- package/dist/ui/shadcn/command/command-empty.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-group.svelte +33 -0
- package/dist/ui/shadcn/command/command-group.svelte.d.ts +7 -0
- package/dist/ui/shadcn/command/command-input.svelte +36 -0
- package/dist/ui/shadcn/command/command-input.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-item.svelte +27 -0
- package/dist/ui/shadcn/command/command-item.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-link-item.svelte +20 -0
- package/dist/ui/shadcn/command/command-link-item.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-list.svelte +20 -0
- package/dist/ui/shadcn/command/command-list.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-loading.svelte +7 -0
- package/dist/ui/shadcn/command/command-loading.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-separator.svelte +17 -0
- package/dist/ui/shadcn/command/command-separator.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-shortcut.svelte +23 -0
- package/dist/ui/shadcn/command/command-shortcut.svelte.d.ts +5 -0
- package/dist/ui/shadcn/command/command.svelte +28 -0
- package/dist/ui/shadcn/command/command.svelte.d.ts +8 -0
- package/dist/ui/shadcn/command/index.d.ts +12 -0
- package/dist/ui/shadcn/command/index.js +14 -0
- package/dist/ui/shadcn/dialog/dialog-close.svelte +11 -0
- package/dist/ui/shadcn/dialog/dialog-close.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-content.svelte +48 -0
- package/dist/ui/shadcn/dialog/dialog-content.svelte.d.ts +13 -0
- package/dist/ui/shadcn/dialog/dialog-description.svelte +20 -0
- package/dist/ui/shadcn/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-footer.svelte +32 -0
- package/dist/ui/shadcn/dialog/dialog-footer.svelte.d.ts +8 -0
- package/dist/ui/shadcn/dialog/dialog-header.svelte +20 -0
- package/dist/ui/shadcn/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/ui/shadcn/dialog/dialog-overlay.svelte +20 -0
- package/dist/ui/shadcn/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-portal.svelte +7 -0
- package/dist/ui/shadcn/dialog/dialog-portal.svelte.d.ts +3 -0
- package/dist/ui/shadcn/dialog/dialog-title.svelte +17 -0
- package/dist/ui/shadcn/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-trigger.svelte +11 -0
- package/dist/ui/shadcn/dialog/dialog-trigger.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog.svelte +7 -0
- package/dist/ui/shadcn/dialog/dialog.svelte.d.ts +3 -0
- package/dist/ui/shadcn/dialog/index.d.ts +11 -0
- package/dist/ui/shadcn/dialog/index.js +13 -0
- package/dist/ui/shadcn/input/index.d.ts +2 -0
- package/dist/ui/shadcn/input/index.js +4 -0
- package/dist/ui/shadcn/input/input.svelte +48 -0
- package/dist/ui/shadcn/input/input.svelte.d.ts +13 -0
- package/dist/ui/shadcn/input-group/index.d.ts +7 -0
- package/dist/ui/shadcn/input-group/index.js +9 -0
- package/dist/ui/shadcn/input-group/input-group-addon.svelte +53 -0
- package/dist/ui/shadcn/input-group/input-group-addon.svelte.d.ts +32 -0
- package/dist/ui/shadcn/input-group/input-group-button.svelte +49 -0
- package/dist/ui/shadcn/input-group/input-group-button.svelte.d.ts +32 -0
- package/dist/ui/shadcn/input-group/input-group-input.svelte +23 -0
- package/dist/ui/shadcn/input-group/input-group-input.svelte.d.ts +11 -0
- package/dist/ui/shadcn/input-group/input-group-text.svelte +22 -0
- package/dist/ui/shadcn/input-group/input-group-text.svelte.d.ts +5 -0
- package/dist/ui/shadcn/input-group/input-group-textarea.svelte +23 -0
- package/dist/ui/shadcn/input-group/input-group-textarea.svelte.d.ts +3 -0
- package/dist/ui/shadcn/input-group/input-group.svelte +24 -0
- package/dist/ui/shadcn/input-group/input-group.svelte.d.ts +5 -0
- package/dist/ui/shadcn/tabs/tabs.svelte.d.ts +1 -1
- package/dist/ui/shadcn/textarea/index.d.ts +2 -0
- package/dist/ui/shadcn/textarea/index.js +4 -0
- package/dist/ui/shadcn/textarea/textarea.svelte +23 -0
- package/dist/ui/shadcn/textarea/textarea.svelte.d.ts +5 -0
- package/dist/ui/tab-item.svelte +35 -9
- package/dist/ui/tab-item.svelte.d.ts +9 -4
- package/dist/ui/tabs-phase.svelte +19 -0
- package/dist/ui/tabs-phase.svelte.d.ts +9 -0
- package/dist/ui/tabs.svelte +47 -24
- package/dist/ui/tabs.svelte.d.ts +16 -6
- package/dist/vite.d.ts +8 -6
- package/dist/vite.js +140 -47
- package/package.json +8 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
export const inputGroupAddonVariants = tv({
|
|
4
|
+
base: "text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none",
|
|
5
|
+
variants: {
|
|
6
|
+
align: {
|
|
7
|
+
'inline-start': 'pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem] order-first',
|
|
8
|
+
'inline-end': 'pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem] order-last',
|
|
9
|
+
'block-start':
|
|
10
|
+
'px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start',
|
|
11
|
+
'block-end':
|
|
12
|
+
'px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
align: 'inline-start'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type InputGroupAddonAlign = VariantProps<typeof inputGroupAddonVariants>['align'];
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
25
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
ref = $bindable(null),
|
|
29
|
+
class: className,
|
|
30
|
+
children,
|
|
31
|
+
align = 'inline-start',
|
|
32
|
+
...restProps
|
|
33
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
+
align?: InputGroupAddonAlign;
|
|
35
|
+
} = $props();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
bind:this={ref}
|
|
40
|
+
role="group"
|
|
41
|
+
data-slot="input-group-addon"
|
|
42
|
+
data-align={align}
|
|
43
|
+
class={cn(inputGroupAddonVariants({ align }), className)}
|
|
44
|
+
onclick={(e) => {
|
|
45
|
+
if ((e.target as HTMLElement).closest('button')) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
e.currentTarget.parentElement?.querySelector('input')?.focus();
|
|
49
|
+
}}
|
|
50
|
+
{...restProps}
|
|
51
|
+
>
|
|
52
|
+
{@render children?.()}
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const inputGroupAddonVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
align: {
|
|
4
|
+
'inline-start': string;
|
|
5
|
+
'inline-end': string;
|
|
6
|
+
'block-start': string;
|
|
7
|
+
'block-end': string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none", {
|
|
10
|
+
align: {
|
|
11
|
+
'inline-start': string;
|
|
12
|
+
'inline-end': string;
|
|
13
|
+
'block-start': string;
|
|
14
|
+
'block-end': string;
|
|
15
|
+
};
|
|
16
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
17
|
+
align: {
|
|
18
|
+
'inline-start': string;
|
|
19
|
+
'inline-end': string;
|
|
20
|
+
'block-start': string;
|
|
21
|
+
'block-end': string;
|
|
22
|
+
};
|
|
23
|
+
}, undefined, "text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none", unknown, unknown, undefined>>;
|
|
24
|
+
export type InputGroupAddonAlign = VariantProps<typeof inputGroupAddonVariants>['align'];
|
|
25
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
26
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
27
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
28
|
+
align?: InputGroupAddonAlign;
|
|
29
|
+
};
|
|
30
|
+
declare const InputGroupAddon: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
31
|
+
type InputGroupAddon = ReturnType<typeof InputGroupAddon>;
|
|
32
|
+
export default InputGroupAddon;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
const inputGroupButtonVariants = tv({
|
|
5
|
+
base: 'gap-2 text-sm flex items-center shadow-none',
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
9
|
+
sm: 'cn-input-group-button-size-sm',
|
|
10
|
+
'icon-xs': 'size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0',
|
|
11
|
+
'icon-sm': 'size-8 p-0 has-[>svg]:p-0'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: 'xs'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type InputGroupButtonSize = VariantProps<typeof inputGroupButtonVariants>['size'];
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { cn } from '../../../shadcn.js';
|
|
24
|
+
import type { ComponentProps } from 'svelte';
|
|
25
|
+
import { Button } from '../button/index.js';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
ref = $bindable(null),
|
|
29
|
+
class: className,
|
|
30
|
+
children,
|
|
31
|
+
type = 'button',
|
|
32
|
+
variant = 'ghost',
|
|
33
|
+
size = 'xs',
|
|
34
|
+
...restProps
|
|
35
|
+
}: Omit<ComponentProps<typeof Button>, 'href' | 'size'> & {
|
|
36
|
+
size?: InputGroupButtonSize;
|
|
37
|
+
} = $props();
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<Button
|
|
41
|
+
bind:ref
|
|
42
|
+
{type}
|
|
43
|
+
data-size={size}
|
|
44
|
+
{variant}
|
|
45
|
+
class={cn(inputGroupButtonVariants({ size }), className)}
|
|
46
|
+
{...restProps}
|
|
47
|
+
>
|
|
48
|
+
{@render children?.()}
|
|
49
|
+
</Button>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const inputGroupButtonVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: {
|
|
4
|
+
xs: string;
|
|
5
|
+
sm: string;
|
|
6
|
+
'icon-xs': string;
|
|
7
|
+
'icon-sm': string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "gap-2 text-sm flex items-center shadow-none", {
|
|
10
|
+
size: {
|
|
11
|
+
xs: string;
|
|
12
|
+
sm: string;
|
|
13
|
+
'icon-xs': string;
|
|
14
|
+
'icon-sm': string;
|
|
15
|
+
};
|
|
16
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
17
|
+
size: {
|
|
18
|
+
xs: string;
|
|
19
|
+
sm: string;
|
|
20
|
+
'icon-xs': string;
|
|
21
|
+
'icon-sm': string;
|
|
22
|
+
};
|
|
23
|
+
}, undefined, "gap-2 text-sm flex items-center shadow-none", unknown, unknown, undefined>>;
|
|
24
|
+
export type InputGroupButtonSize = VariantProps<typeof inputGroupButtonVariants>['size'];
|
|
25
|
+
import type { ComponentProps } from 'svelte';
|
|
26
|
+
import { Button } from '../button/index.js';
|
|
27
|
+
type $$ComponentProps = Omit<ComponentProps<typeof Button>, 'href' | 'size'> & {
|
|
28
|
+
size?: InputGroupButtonSize;
|
|
29
|
+
};
|
|
30
|
+
declare const InputGroupButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
31
|
+
type InputGroupButton = ReturnType<typeof InputGroupButton>;
|
|
32
|
+
export default InputGroupButton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../shadcn.js';
|
|
3
|
+
import type { ComponentProps } from 'svelte';
|
|
4
|
+
import { Input } from '../input/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
class: className,
|
|
10
|
+
...props
|
|
11
|
+
}: ComponentProps<typeof Input> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Input
|
|
15
|
+
bind:ref
|
|
16
|
+
data-slot="input-group-control"
|
|
17
|
+
class={cn(
|
|
18
|
+
'rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const InputGroupInput: import("svelte").Component<(Omit<import("svelte/elements").HTMLInputAttributes, "type"> & ({
|
|
2
|
+
type: "file";
|
|
3
|
+
files?: FileList;
|
|
4
|
+
} | {
|
|
5
|
+
type?: "number" | "time" | "url" | "search" | "text" | "button" | "image" | "hidden" | "color" | "submit" | "reset" | "checkbox" | "radio" | (string & {}) | "tel" | "email" | "date" | "datetime-local" | "month" | "password" | "range" | "week";
|
|
6
|
+
files?: undefined;
|
|
7
|
+
})) & {
|
|
8
|
+
ref?: HTMLElement | null | undefined;
|
|
9
|
+
}, {}, "value" | "ref">;
|
|
10
|
+
type InputGroupInput = ReturnType<typeof InputGroupInput>;
|
|
11
|
+
export default InputGroupInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<span
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
class={cn(
|
|
16
|
+
"text-muted-foreground gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</span>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const InputGroupText: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLSpanElement>>, {}, "ref">;
|
|
4
|
+
type InputGroupText = ReturnType<typeof InputGroupText>;
|
|
5
|
+
export default InputGroupText;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../shadcn.js';
|
|
3
|
+
import { Textarea } from '../textarea/index.js';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
class: className,
|
|
10
|
+
...props
|
|
11
|
+
}: ComponentProps<typeof Textarea> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Textarea
|
|
15
|
+
bind:ref
|
|
16
|
+
data-slot="input-group-control"
|
|
17
|
+
class={cn(
|
|
18
|
+
'rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1 resize-none',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const InputGroupTextarea: import("svelte").Component<Omit<import("../../../shadcn.js").WithElementRef<import("svelte/elements").HTMLTextareaAttributes>, "children">, {}, "value" | "ref">;
|
|
2
|
+
type InputGroupTextarea = ReturnType<typeof InputGroupTextarea>;
|
|
3
|
+
export default InputGroupTextarea;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="input-group"
|
|
16
|
+
role="group"
|
|
17
|
+
class={cn(
|
|
18
|
+
'group/input-group border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-9 rounded-md border shadow-xs transition-[color,box-shadow] in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const InputGroup: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type InputGroup = ReturnType<typeof InputGroup>;
|
|
5
|
+
export default InputGroup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
2
|
-
declare const Tabs: import("svelte").Component<TabsPrimitive.RootProps, {}, "
|
|
2
|
+
declare const Tabs: import("svelte").Component<TabsPrimitive.RootProps, {}, "value" | "ref">;
|
|
3
3
|
type Tabs = ReturnType<typeof Tabs>;
|
|
4
4
|
export default Tabs;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef, type WithoutChildren } from '../../../shadcn.js';
|
|
3
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
'data-slot': dataSlot = 'textarea',
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<textarea
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
data-slot={dataSlot}
|
|
17
|
+
class={cn(
|
|
18
|
+
'border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] focus-visible:ring-3 aria-invalid:ring-3 md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
></textarea>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
2
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
+
declare const Textarea: import("svelte").Component<Omit<WithElementRef<HTMLTextareaAttributes>, "children">, {}, "value" | "ref">;
|
|
4
|
+
type Textarea = ReturnType<typeof Textarea>;
|
|
5
|
+
export default Textarea;
|
package/dist/ui/tab-item.svelte
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { getContext, type Snippet } from 'svelte';
|
|
3
|
+
import * as TabsPrimitive from './shadcn/tabs/index.js';
|
|
4
|
+
import { TABS_PHASE, getTabsContext, type TabsPhase } from './tabs.svelte';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
value: valueProp,
|
|
9
|
+
children
|
|
10
|
+
}: {
|
|
11
|
+
/** The trigger text for this tab. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Underlying value; defaults to `label` (only needed to disambiguate duplicate labels). */
|
|
14
|
+
value?: string;
|
|
15
|
+
children: Snippet;
|
|
16
|
+
} = $props();
|
|
8
17
|
|
|
9
|
-
const
|
|
18
|
+
const value = $derived(valueProp ?? label);
|
|
19
|
+
const phase = getContext<TabsPhase>(TABS_PHASE);
|
|
20
|
+
|
|
21
|
+
// Register once, during the collect pass, so <Tabs> can pick the default tab.
|
|
22
|
+
// svelte-ignore state_referenced_locally
|
|
23
|
+
if (phase === 'collect') getTabsContext()?.register(value);
|
|
10
24
|
</script>
|
|
11
25
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
{#if phase === 'list'}
|
|
27
|
+
<!-- bits-ui v2 emits data-state="active"; the vendored trigger styles the
|
|
28
|
+
active state with data-active (a skew from the CLI's registry version),
|
|
29
|
+
so paint the active state here to match what's actually emitted. -->
|
|
30
|
+
<TabsPrimitive.Trigger
|
|
31
|
+
{value}
|
|
32
|
+
class="data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm"
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
</TabsPrimitive.Trigger>
|
|
36
|
+
{:else if phase === 'panel'}
|
|
37
|
+
<TabsPrimitive.Content {value}>
|
|
38
|
+
{@render children()}
|
|
39
|
+
</TabsPrimitive.Content>
|
|
40
|
+
{/if}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The trigger text for this tab. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Underlying value; defaults to `label` (only needed to disambiguate duplicate labels). */
|
|
6
|
+
value?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const TabItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
10
|
type TabItem = ReturnType<typeof TabItem>;
|
|
6
11
|
export default TabItem;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Internal to <Tabs>. bits-ui renders the trigger row (Tabs.List) and the
|
|
3
|
+
// panels (Tabs.Content) as separate subtrees, but authors write a single flat
|
|
4
|
+
// list of <TabItem>s. So <Tabs> renders that list three times through this
|
|
5
|
+
// wrapper — once per phase — and each <TabItem> reads the phase to decide what
|
|
6
|
+
// to emit: `collect` registers its value (no DOM), `list` renders a trigger,
|
|
7
|
+
// `panel` renders the content. Doing it in render (not an effect) keeps the
|
|
8
|
+
// first tab selected server-side, with no post-hydration pop-in.
|
|
9
|
+
import { setContext, type Snippet } from 'svelte';
|
|
10
|
+
import { TABS_PHASE, type TabsPhase } from './tabs.svelte';
|
|
11
|
+
|
|
12
|
+
const { phase, children }: { phase: TabsPhase; children: Snippet } = $props();
|
|
13
|
+
|
|
14
|
+
// phase is fixed for the lifetime of each scope instance.
|
|
15
|
+
// svelte-ignore state_referenced_locally
|
|
16
|
+
setContext<TabsPhase>(TABS_PHASE, phase);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{@render children()}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import { type TabsPhase } from './tabs.svelte';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
phase: TabsPhase;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const TabsPhase: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type TabsPhase = ReturnType<typeof TabsPhase>;
|
|
9
|
+
export default TabsPhase;
|
package/dist/ui/tabs.svelte
CHANGED
|
@@ -1,29 +1,52 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
|
|
4
|
+
/** Which render pass a <TabItem> is in. See tabs-phase.svelte. */
|
|
5
|
+
export type TabsPhase = 'collect' | 'list' | 'panel';
|
|
6
|
+
|
|
7
|
+
export const TABS_PHASE = Symbol('docsmith-tabs-phase');
|
|
8
|
+
const TABS_CTX = Symbol('docsmith-tabs-ctx');
|
|
4
9
|
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
value: string;
|
|
10
|
+
type TabsContext = {
|
|
11
|
+
/** Called by each <TabItem> during the collect pass, in document order. */
|
|
12
|
+
register: (value: string) => void;
|
|
8
13
|
};
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
/** Read the enclosing <Tabs> context from a <TabItem>. */
|
|
16
|
+
export function getTabsContext(): TabsContext | undefined {
|
|
17
|
+
return getContext<TabsContext | undefined>(TABS_CTX);
|
|
18
|
+
}
|
|
11
19
|
</script>
|
|
12
20
|
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { setContext, type Snippet } from 'svelte';
|
|
23
|
+
import * as TabsPrimitive from './shadcn/tabs/index.js';
|
|
24
|
+
import TabsPhaseScope from './tabs-phase.svelte';
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
value,
|
|
28
|
+
children
|
|
29
|
+
}: {
|
|
30
|
+
/** Value/label of the tab selected by default. Defaults to the first tab. */
|
|
31
|
+
value?: string;
|
|
32
|
+
children: Snippet;
|
|
33
|
+
} = $props();
|
|
34
|
+
|
|
35
|
+
// The first <TabItem> to register wins the default selection. Captured during
|
|
36
|
+
// the collect pass, which renders (below) before <Tabs.Root> reads it — so the
|
|
37
|
+
// correct panel is already selected in the server-rendered HTML.
|
|
38
|
+
let firstValue = $state<string | undefined>();
|
|
39
|
+
setContext<TabsContext>(TABS_CTX, {
|
|
40
|
+
register: (v) => (firstValue ??= v)
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<!-- collect: registers each TabItem's value; renders nothing. -->
|
|
45
|
+
<TabsPhaseScope phase="collect">{@render children()}</TabsPhaseScope>
|
|
46
|
+
|
|
47
|
+
<TabsPrimitive.Root value={value ?? firstValue ?? ''} class="my-6">
|
|
48
|
+
<TabsPrimitive.List class="not-prose mb-3">
|
|
49
|
+
<TabsPhaseScope phase="list">{@render children()}</TabsPhaseScope>
|
|
50
|
+
</TabsPrimitive.List>
|
|
51
|
+
<TabsPhaseScope phase="panel">{@render children()}</TabsPhaseScope>
|
|
52
|
+
</TabsPrimitive.Root>
|
package/dist/ui/tabs.svelte.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/** Which render pass a <TabItem> is in. See tabs-phase.svelte. */
|
|
2
|
+
export type TabsPhase = 'collect' | 'list' | 'panel';
|
|
3
|
+
export declare const TABS_PHASE: unique symbol;
|
|
4
|
+
type TabsContext = {
|
|
5
|
+
/** Called by each <TabItem> during the collect pass, in document order. */
|
|
6
|
+
register: (value: string) => void;
|
|
7
|
+
};
|
|
8
|
+
/** Read the enclosing <Tabs> context from a <TabItem>. */
|
|
9
|
+
export declare function getTabsContext(): TabsContext | undefined;
|
|
10
|
+
import { type Snippet } from 'svelte';
|
|
11
|
+
type $$ComponentProps = {
|
|
12
|
+
/** Value/label of the tab selected by default. Defaults to the first tab. */
|
|
13
|
+
value?: string;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
};
|
|
16
|
+
declare const Tabs: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
17
|
type Tabs = ReturnType<typeof Tabs>;
|
|
8
18
|
export default Tabs;
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
import type { DocsContentItem } from './config.js';
|
|
2
|
+
import type { DocsContentItem, SearchDoc } from './config.js';
|
|
3
3
|
export interface DocsmithViteOptions {
|
|
4
4
|
/** Directory scanned for doc pages. Default: `'src/routes/docs'`. */
|
|
5
5
|
content?: string;
|
|
@@ -23,10 +23,12 @@ export interface DocsmithViteOptions {
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export declare function docsmith(options?: DocsmithViteOptions): Plugin[];
|
|
26
|
+
export declare function collectDocs(contentDir: string, routesDir: string): DocsContentItem[];
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Build the search records for every page under `contentDir`: title, section,
|
|
29
|
+
* description, heading list, and plain-text body. Served as the lazy-loaded
|
|
30
|
+
* `svelte-docsmith/search` virtual module so search can index bodies without
|
|
31
|
+
* bloating the eagerly-imported nav index. The missing-directory case is
|
|
32
|
+
* already reported by {@link collectDocs}, so this stays quiet.
|
|
31
33
|
*/
|
|
32
|
-
export declare function
|
|
34
|
+
export declare function collectSearchDocs(contentDir: string, routesDir: string): SearchDoc[];
|