svelte-docsmith 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/clipboard.svelte.d.ts +6 -0
- package/dist/clipboard.svelte.js +27 -0
- package/dist/config.d.ts +79 -0
- package/dist/config.js +55 -0
- package/dist/content.d.ts +10 -0
- package/dist/content.js +4 -0
- package/dist/highlight.d.ts +17 -0
- package/dist/highlight.js +34 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +26 -0
- package/dist/markdown-layout.svelte +21 -0
- package/dist/markdown-layout.svelte.d.ts +18 -0
- package/dist/preprocess.d.ts +33 -0
- package/dist/preprocess.js +65 -0
- package/dist/shadcn.d.ts +12 -0
- package/dist/shadcn.js +5 -0
- package/dist/theme.css +201 -0
- package/dist/themes/amethyst.css +76 -0
- package/dist/themes/bubblegum.css +79 -0
- package/dist/themes/claude.css +79 -0
- package/dist/themes/evergreen.css +76 -0
- package/dist/themes/graphite.css +79 -0
- package/dist/themes/mono.css +79 -0
- package/dist/themes/nord.css +79 -0
- package/dist/themes/ocean.css +76 -0
- package/dist/themes/rose.css +78 -0
- package/dist/themes/tangerine.css +81 -0
- package/dist/toc/from-content.d.ts +11 -0
- package/dist/toc/from-content.js +18 -0
- package/dist/toc/index.d.ts +3 -0
- package/dist/toc/index.js +3 -0
- package/dist/toc/toc.svelte.d.ts +26 -0
- package/dist/toc/toc.svelte.js +74 -0
- package/dist/toc/types.d.ts +11 -0
- package/dist/toc/types.js +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.js +1 -0
- package/dist/ui/accordion-item.svelte +24 -0
- package/dist/ui/accordion-item.svelte.d.ts +9 -0
- package/dist/ui/accordion.svelte +45 -0
- package/dist/ui/accordion.svelte.d.ts +15 -0
- package/dist/ui/background-pattern.svelte +17 -0
- package/dist/ui/background-pattern.svelte.d.ts +26 -0
- package/dist/ui/badge.svelte +54 -0
- package/dist/ui/badge.svelte.d.ts +12 -0
- package/dist/ui/callout.svelte +125 -0
- package/dist/ui/callout.svelte.d.ts +13 -0
- package/dist/ui/card-grid.svelte +10 -0
- package/dist/ui/card-grid.svelte.d.ts +7 -0
- package/dist/ui/card.svelte +52 -0
- package/dist/ui/card.svelte.d.ts +14 -0
- package/dist/ui/copy-button.svelte +30 -0
- package/dist/ui/copy-button.svelte.d.ts +9 -0
- package/dist/ui/file-tree-item.svelte +70 -0
- package/dist/ui/file-tree-item.svelte.d.ts +14 -0
- package/dist/ui/file-tree.svelte +34 -0
- package/dist/ui/file-tree.svelte.d.ts +7 -0
- package/dist/ui/icons/github.svelte +14 -0
- package/dist/ui/icons/github.svelte.d.ts +6 -0
- package/dist/ui/kbd.svelte +11 -0
- package/dist/ui/kbd.svelte.d.ts +7 -0
- package/dist/ui/layouts/breadcrumbs.svelte +37 -0
- package/dist/ui/layouts/breadcrumbs.svelte.d.ts +10 -0
- package/dist/ui/layouts/docs-footer.svelte +40 -0
- package/dist/ui/layouts/docs-footer.svelte.d.ts +7 -0
- package/dist/ui/layouts/docs-header.svelte +109 -0
- package/dist/ui/layouts/docs-header.svelte.d.ts +18 -0
- package/dist/ui/layouts/docs-mobile-header.svelte +106 -0
- package/dist/ui/layouts/docs-mobile-header.svelte.d.ts +18 -0
- package/dist/ui/layouts/docs-shell.svelte +133 -0
- package/dist/ui/layouts/docs-shell.svelte.d.ts +25 -0
- package/dist/ui/layouts/docs-sidebar.svelte +36 -0
- package/dist/ui/layouts/docs-sidebar.svelte.d.ts +8 -0
- package/dist/ui/layouts/prev-next-nav.svelte +32 -0
- package/dist/ui/layouts/prev-next-nav.svelte.d.ts +8 -0
- package/dist/ui/live-example.svelte +67 -0
- package/dist/ui/live-example.svelte.d.ts +10 -0
- package/dist/ui/markdown/code.svelte +11 -0
- package/dist/ui/markdown/code.svelte.d.ts +7 -0
- package/dist/ui/markdown/h2.svelte +13 -0
- package/dist/ui/markdown/h2.svelte.d.ts +4 -0
- package/dist/ui/markdown/h3.svelte +13 -0
- package/dist/ui/markdown/h3.svelte.d.ts +4 -0
- package/dist/ui/markdown/index.d.ts +5 -0
- package/dist/ui/markdown/index.js +5 -0
- package/dist/ui/markdown/pre.svelte +88 -0
- package/dist/ui/markdown/pre.svelte.d.ts +7 -0
- package/dist/ui/markdown/table.svelte +80 -0
- package/dist/ui/markdown/table.svelte.d.ts +7 -0
- package/dist/ui/markdown/types.d.ts +3 -0
- package/dist/ui/markdown/types.js +1 -0
- package/dist/ui/prop.svelte +130 -0
- package/dist/ui/prop.svelte.d.ts +16 -0
- package/dist/ui/props-table.svelte +127 -0
- package/dist/ui/props-table.svelte.d.ts +9 -0
- package/dist/ui/shadcn/accordion/accordion-content.svelte +27 -0
- package/dist/ui/shadcn/accordion/accordion-content.svelte.d.ts +4 -0
- package/dist/ui/shadcn/accordion/accordion-item.svelte +17 -0
- package/dist/ui/shadcn/accordion/accordion-item.svelte.d.ts +4 -0
- package/dist/ui/shadcn/accordion/accordion-trigger.svelte +38 -0
- package/dist/ui/shadcn/accordion/accordion-trigger.svelte.d.ts +8 -0
- package/dist/ui/shadcn/accordion/accordion.svelte +19 -0
- package/dist/ui/shadcn/accordion/accordion.svelte.d.ts +4 -0
- package/dist/ui/shadcn/accordion/index.d.ts +5 -0
- package/dist/ui/shadcn/accordion/index.js +7 -0
- package/dist/ui/shadcn/badge/badge.svelte +50 -0
- package/dist/ui/shadcn/badge/badge.svelte.d.ts +38 -0
- package/dist/ui/shadcn/badge/index.d.ts +2 -0
- package/dist/ui/shadcn/badge/index.js +2 -0
- package/dist/ui/shadcn/button/button.svelte +89 -0
- package/dist/ui/shadcn/button/button.svelte.d.ts +70 -0
- package/dist/ui/shadcn/button/index.d.ts +2 -0
- package/dist/ui/shadcn/button/index.js +4 -0
- package/dist/ui/shadcn/popover/index.d.ts +9 -0
- package/dist/ui/shadcn/popover/index.js +11 -0
- package/dist/ui/shadcn/popover/popover-close.svelte +7 -0
- package/dist/ui/shadcn/popover/popover-close.svelte.d.ts +4 -0
- package/dist/ui/shadcn/popover/popover-content.svelte +31 -0
- package/dist/ui/shadcn/popover/popover-content.svelte.d.ts +10 -0
- package/dist/ui/shadcn/popover/popover-description.svelte +20 -0
- package/dist/ui/shadcn/popover/popover-description.svelte.d.ts +5 -0
- package/dist/ui/shadcn/popover/popover-header.svelte +20 -0
- package/dist/ui/shadcn/popover/popover-header.svelte.d.ts +5 -0
- package/dist/ui/shadcn/popover/popover-portal.svelte +7 -0
- package/dist/ui/shadcn/popover/popover-portal.svelte.d.ts +3 -0
- package/dist/ui/shadcn/popover/popover-title.svelte +15 -0
- package/dist/ui/shadcn/popover/popover-title.svelte.d.ts +5 -0
- package/dist/ui/shadcn/popover/popover-trigger.svelte +17 -0
- package/dist/ui/shadcn/popover/popover-trigger.svelte.d.ts +4 -0
- package/dist/ui/shadcn/popover/popover.svelte +7 -0
- package/dist/ui/shadcn/popover/popover.svelte.d.ts +3 -0
- package/dist/ui/shadcn/scroll-area/index.d.ts +3 -0
- package/dist/ui/shadcn/scroll-area/index.js +5 -0
- package/dist/ui/shadcn/scroll-area/scroll-area-scrollbar.svelte +30 -0
- package/dist/ui/shadcn/scroll-area/scroll-area-scrollbar.svelte.d.ts +4 -0
- package/dist/ui/shadcn/scroll-area/scroll-area.svelte +43 -0
- package/dist/ui/shadcn/scroll-area/scroll-area.svelte.d.ts +11 -0
- package/dist/ui/shadcn/separator/index.d.ts +2 -0
- package/dist/ui/shadcn/separator/index.js +4 -0
- package/dist/ui/shadcn/separator/separator.svelte +23 -0
- package/dist/ui/shadcn/separator/separator.svelte.d.ts +4 -0
- package/dist/ui/shadcn/sheet/index.d.ts +11 -0
- package/dist/ui/shadcn/sheet/index.js +13 -0
- package/dist/ui/shadcn/sheet/sheet-close.svelte +7 -0
- package/dist/ui/shadcn/sheet/sheet-close.svelte.d.ts +4 -0
- package/dist/ui/shadcn/sheet/sheet-content.svelte +55 -0
- package/dist/ui/shadcn/sheet/sheet-content.svelte.d.ts +15 -0
- package/dist/ui/shadcn/sheet/sheet-description.svelte +17 -0
- package/dist/ui/shadcn/sheet/sheet-description.svelte.d.ts +4 -0
- package/dist/ui/shadcn/sheet/sheet-footer.svelte +20 -0
- package/dist/ui/shadcn/sheet/sheet-footer.svelte.d.ts +5 -0
- package/dist/ui/shadcn/sheet/sheet-header.svelte +20 -0
- package/dist/ui/shadcn/sheet/sheet-header.svelte.d.ts +5 -0
- package/dist/ui/shadcn/sheet/sheet-overlay.svelte +17 -0
- package/dist/ui/shadcn/sheet/sheet-overlay.svelte.d.ts +4 -0
- package/dist/ui/shadcn/sheet/sheet-portal.svelte +7 -0
- package/dist/ui/shadcn/sheet/sheet-portal.svelte.d.ts +3 -0
- package/dist/ui/shadcn/sheet/sheet-title.svelte +17 -0
- package/dist/ui/shadcn/sheet/sheet-title.svelte.d.ts +4 -0
- package/dist/ui/shadcn/sheet/sheet-trigger.svelte +7 -0
- package/dist/ui/shadcn/sheet/sheet-trigger.svelte.d.ts +4 -0
- package/dist/ui/shadcn/sheet/sheet.svelte +7 -0
- package/dist/ui/shadcn/sheet/sheet.svelte.d.ts +3 -0
- package/dist/ui/shadcn/tabs/index.d.ts +5 -0
- package/dist/ui/shadcn/tabs/index.js +7 -0
- package/dist/ui/shadcn/tabs/tabs-content.svelte +17 -0
- package/dist/ui/shadcn/tabs/tabs-content.svelte.d.ts +4 -0
- package/dist/ui/shadcn/tabs/tabs-list.svelte +40 -0
- package/dist/ui/shadcn/tabs/tabs-list.svelte.d.ts +25 -0
- package/dist/ui/shadcn/tabs/tabs-trigger.svelte +23 -0
- package/dist/ui/shadcn/tabs/tabs-trigger.svelte.d.ts +4 -0
- package/dist/ui/shadcn/tabs/tabs.svelte +19 -0
- package/dist/ui/shadcn/tabs/tabs.svelte.d.ts +4 -0
- package/dist/ui/step.svelte +82 -0
- package/dist/ui/step.svelte.d.ts +9 -0
- package/dist/ui/steps.svelte +71 -0
- package/dist/ui/steps.svelte.d.ts +7 -0
- package/dist/ui/tab-item.svelte +14 -0
- package/dist/ui/tab-item.svelte.d.ts +6 -0
- package/dist/ui/table-of-contents.svelte +114 -0
- package/dist/ui/table-of-contents.svelte.d.ts +9 -0
- package/dist/ui/tabs.svelte +29 -0
- package/dist/ui/tabs.svelte.d.ts +8 -0
- package/dist/ui/theme-provider.svelte +23 -0
- package/dist/ui/theme-provider.svelte.d.ts +10 -0
- package/dist/ui/theme-toggle.svelte +22 -0
- package/dist/ui/theme-toggle.svelte.d.ts +6 -0
- package/dist/vite.d.ts +32 -0
- package/dist/vite.js +216 -0
- package/package.json +115 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useClipboard } from '../../clipboard.svelte.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import { ScrollArea } from '../shadcn/scroll-area/index.js';
|
|
5
|
+
import CopyButton from '../copy-button.svelte';
|
|
6
|
+
|
|
7
|
+
const clipboard = useClipboard();
|
|
8
|
+
|
|
9
|
+
const { children }: { children: Snippet } = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div class="rounded-md overflow-hidden bg-muted mt-2 shadow-md text-sm relative">
|
|
13
|
+
<ScrollArea orientation="both" class="relative">
|
|
14
|
+
<CopyButton
|
|
15
|
+
copied={clipboard.copied}
|
|
16
|
+
onclick={() => clipboard.copy()}
|
|
17
|
+
class="bg-muted absolute top-2 right-2 z-10"
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
<pre class="not-prose shiki max-h-[32rem] flex shrink" use:clipboard.readText>
|
|
21
|
+
{@render children()}
|
|
22
|
+
</pre>
|
|
23
|
+
|
|
24
|
+
<!-- Scroll indicators with increased fade intensity -->
|
|
25
|
+
<div
|
|
26
|
+
class="absolute bottom-0 left-0 right-0 h-4 bg-gradient-to-t from-muted via-muted/70 to-transparent pointer-events-none"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
></div>
|
|
29
|
+
<div
|
|
30
|
+
class="absolute top-0 left-0 right-0 h-4 bg-gradient-to-b from-muted via-muted/70 to-transparent pointer-events-none"
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
></div>
|
|
33
|
+
<div
|
|
34
|
+
class="absolute top-0 bottom-0 right-0 w-4 bg-gradient-to-l from-muted via-muted/70 to-transparent pointer-events-none"
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
></div>
|
|
37
|
+
<div
|
|
38
|
+
class="absolute top-0 bottom-0 left-0 w-4 bg-gradient-to-r from-muted via-muted/70 to-transparent pointer-events-none"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
></div>
|
|
41
|
+
</ScrollArea>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
/*
|
|
46
|
+
* Plain CSS (not @apply): these style Shiki's output and ship inside the
|
|
47
|
+
* published package, where the consumer's Tailwind theme context isn't
|
|
48
|
+
* available to resolve @apply (Tailwind v4 compiles scoped styles in
|
|
49
|
+
* isolation). See PLAN.md §2.5.
|
|
50
|
+
*/
|
|
51
|
+
:global(pre code) {
|
|
52
|
+
display: block;
|
|
53
|
+
flex-grow: 1;
|
|
54
|
+
height: 100%;
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding-block: 1rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:global(pre span.line) {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
width: 100%;
|
|
62
|
+
padding-inline: 1rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:global(pre span.line.highlighted) {
|
|
66
|
+
background-color: rgb(254 240 138 / 0.5);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:global(.dark pre span.line.highlighted) {
|
|
70
|
+
background-color: rgb(250 204 21 / 0.2);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:global(pre span.line.diff.add) {
|
|
74
|
+
background-color: rgb(134 239 172 / 0.5);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:global(pre span.line.diff.remove) {
|
|
78
|
+
background-color: rgb(252 165 165 / 0.5);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:global(.dark pre span.line.diff.add) {
|
|
82
|
+
background-color: rgb(22 163 74 / 0.2);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:global(.dark pre span.line.diff.remove) {
|
|
86
|
+
background-color: rgb(220 38 38 / 0.2);
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
// mdsvex maps every markdown `<table>` to this component, so plain markdown
|
|
5
|
+
// tables (API entry points, token lists, frontmatter fields) render with the
|
|
6
|
+
// same bordered, quiet-header look as the PropsTable component. Authors write
|
|
7
|
+
// normal markdown; the styling is automatic.
|
|
8
|
+
const { children }: { children: Snippet } = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="md-table not-prose">
|
|
12
|
+
<div class="md-table-scroll">
|
|
13
|
+
<table>
|
|
14
|
+
{@render children()}
|
|
15
|
+
</table>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
.md-table {
|
|
21
|
+
margin: 1.75rem 0;
|
|
22
|
+
border: 1px solid var(--border);
|
|
23
|
+
border-radius: var(--radius);
|
|
24
|
+
background: var(--card);
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.md-table-scroll {
|
|
28
|
+
overflow-x: auto;
|
|
29
|
+
}
|
|
30
|
+
.md-table table {
|
|
31
|
+
width: 100%;
|
|
32
|
+
border-collapse: collapse;
|
|
33
|
+
font-size: 0.875rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.md-table :global(thead th) {
|
|
37
|
+
text-align: left;
|
|
38
|
+
font-size: 0.75rem;
|
|
39
|
+
font-weight: 500;
|
|
40
|
+
color: var(--muted-foreground);
|
|
41
|
+
padding: 0.6rem 1rem;
|
|
42
|
+
border-bottom: 1px solid var(--border);
|
|
43
|
+
background: color-mix(in oklch, var(--muted) 55%, var(--card));
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
}
|
|
46
|
+
.md-table :global(tbody td) {
|
|
47
|
+
padding: 0.7rem 1rem;
|
|
48
|
+
vertical-align: baseline;
|
|
49
|
+
border-top: 1px solid var(--border);
|
|
50
|
+
color: var(--foreground);
|
|
51
|
+
transition: background-color 120ms ease;
|
|
52
|
+
}
|
|
53
|
+
.md-table :global(tbody tr:first-child td) {
|
|
54
|
+
border-top: none;
|
|
55
|
+
}
|
|
56
|
+
.md-table :global(tbody tr:hover td) {
|
|
57
|
+
background: color-mix(in oklch, var(--muted) 45%, transparent);
|
|
58
|
+
}
|
|
59
|
+
/* Inline code inside cells: subtle chip so token names stay scannable. */
|
|
60
|
+
.md-table :global(td code),
|
|
61
|
+
.md-table :global(th code) {
|
|
62
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
63
|
+
font-size: 0.82em;
|
|
64
|
+
padding: 0.05em 0.35em;
|
|
65
|
+
border-radius: 0.35rem;
|
|
66
|
+
background: color-mix(in oklch, var(--muted) 60%, transparent);
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
.md-table :global(td a) {
|
|
70
|
+
color: var(--primary);
|
|
71
|
+
text-decoration: underline;
|
|
72
|
+
text-underline-offset: 2px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (prefers-reduced-motion: reduce) {
|
|
76
|
+
.md-table :global(tbody td) {
|
|
77
|
+
transition: none;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
name,
|
|
6
|
+
type,
|
|
7
|
+
required = false,
|
|
8
|
+
default: defaultValue,
|
|
9
|
+
children
|
|
10
|
+
}: {
|
|
11
|
+
/** Property name. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Type signature, shown as code. */
|
|
14
|
+
type?: string;
|
|
15
|
+
/** Mark the property as required. */
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** Default value, shown in its own column. */
|
|
18
|
+
default?: string;
|
|
19
|
+
/** Description. */
|
|
20
|
+
children?: Snippet;
|
|
21
|
+
} = $props();
|
|
22
|
+
|
|
23
|
+
// Split a union into per-value chips so long ones wrap as a tidy pill group
|
|
24
|
+
// instead of ugly broken text. Skip splitting when the type is a generic
|
|
25
|
+
// (`Array<A | B>`) where a top-level `|` split would be wrong.
|
|
26
|
+
const typeParts = $derived.by(() => {
|
|
27
|
+
if (!type) return [];
|
|
28
|
+
if (/[<(]/.test(type)) return [type];
|
|
29
|
+
return type
|
|
30
|
+
.split('|')
|
|
31
|
+
.map((s) => s.trim())
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<tr>
|
|
37
|
+
<td class="prop-name">
|
|
38
|
+
<code>{name}</code>
|
|
39
|
+
{#if required}<span class="prop-required">required</span>{/if}
|
|
40
|
+
</td>
|
|
41
|
+
<td class="prop-type">
|
|
42
|
+
{#each typeParts as part (part)}
|
|
43
|
+
<code class="type-chip">{part}</code>
|
|
44
|
+
{/each}
|
|
45
|
+
</td>
|
|
46
|
+
<td class="prop-default">
|
|
47
|
+
{#if defaultValue !== undefined}
|
|
48
|
+
<code>{defaultValue}</code>
|
|
49
|
+
{:else}
|
|
50
|
+
<span class="prop-none" aria-hidden="true">—</span>
|
|
51
|
+
{/if}
|
|
52
|
+
</td>
|
|
53
|
+
<td class="prop-desc">
|
|
54
|
+
{#if children}{@render children()}{/if}
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
/* Name is the anchor you scan for: mono, ink, medium weight. */
|
|
60
|
+
.prop-name {
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
}
|
|
63
|
+
.prop-name code {
|
|
64
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
65
|
+
font-size: 0.8125rem;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
color: var(--foreground);
|
|
68
|
+
}
|
|
69
|
+
/* Solid brand pill — the sanctioned primary-foreground-on-primary pairing,
|
|
70
|
+
so it stays legible in both themes (terracotta-on-tint fails AA in light). */
|
|
71
|
+
.prop-required {
|
|
72
|
+
display: inline-block;
|
|
73
|
+
margin-left: 0.45rem;
|
|
74
|
+
padding: 0.05rem 0.4rem;
|
|
75
|
+
border-radius: 9999px;
|
|
76
|
+
background: var(--primary);
|
|
77
|
+
color: var(--primary-foreground);
|
|
78
|
+
font-size: 0.625rem;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
letter-spacing: 0.02em;
|
|
81
|
+
vertical-align: 0.1em;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Type values as chips: a union wraps as a neat pill group, each token
|
|
85
|
+
unbroken. Single types render as one chip. */
|
|
86
|
+
.prop-type {
|
|
87
|
+
max-width: 26rem;
|
|
88
|
+
}
|
|
89
|
+
.type-chip {
|
|
90
|
+
display: inline-block;
|
|
91
|
+
margin: 0.1rem 0.3rem 0.1rem 0;
|
|
92
|
+
padding: 0.05rem 0.4rem;
|
|
93
|
+
border-radius: 0.4rem;
|
|
94
|
+
border: 1px solid var(--border);
|
|
95
|
+
background: color-mix(in oklch, var(--muted) 55%, transparent);
|
|
96
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
97
|
+
font-size: 0.78rem;
|
|
98
|
+
color: var(--foreground);
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.prop-default {
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
}
|
|
105
|
+
.prop-default code {
|
|
106
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
107
|
+
font-size: 0.8125rem;
|
|
108
|
+
color: var(--foreground);
|
|
109
|
+
}
|
|
110
|
+
.prop-none {
|
|
111
|
+
color: var(--muted-foreground);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.prop-desc {
|
|
115
|
+
color: var(--foreground);
|
|
116
|
+
line-height: 1.55;
|
|
117
|
+
}
|
|
118
|
+
.prop-desc :global(code) {
|
|
119
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
120
|
+
font-size: 0.85em;
|
|
121
|
+
padding: 0.05em 0.3em;
|
|
122
|
+
border-radius: 0.3rem;
|
|
123
|
+
background: color-mix(in oklch, var(--muted) 60%, transparent);
|
|
124
|
+
}
|
|
125
|
+
.prop-desc :global(a) {
|
|
126
|
+
color: var(--primary);
|
|
127
|
+
text-decoration: underline;
|
|
128
|
+
text-underline-offset: 2px;
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** Property name. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Type signature, shown as code. */
|
|
6
|
+
type?: string;
|
|
7
|
+
/** Mark the property as required. */
|
|
8
|
+
required?: boolean;
|
|
9
|
+
/** Default value, shown in its own column. */
|
|
10
|
+
default?: string;
|
|
11
|
+
/** Description. */
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
};
|
|
14
|
+
declare const Prop: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
15
|
+
type Prop = ReturnType<typeof Prop>;
|
|
16
|
+
export default Prop;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
title,
|
|
6
|
+
children
|
|
7
|
+
}: {
|
|
8
|
+
/** Optional caption — the component name when a page documents several. */
|
|
9
|
+
title?: string;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
} = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<!--
|
|
15
|
+
A component API reference. Compose it from <Prop> rows:
|
|
16
|
+
|
|
17
|
+
<PropsTable title="Badge">
|
|
18
|
+
<Prop name="variant" type="'a' | 'b'" default="'a'">Visual intent.</Prop>
|
|
19
|
+
<Prop name="href" type="string" required>Turns it into a link.</Prop>
|
|
20
|
+
</PropsTable>
|
|
21
|
+
-->
|
|
22
|
+
<div class="props-table not-prose">
|
|
23
|
+
{#if title}
|
|
24
|
+
<div class="props-table-caption">
|
|
25
|
+
<span class="props-table-caption-mark" aria-hidden="true"></></span>
|
|
26
|
+
<span class="props-table-caption-name">{title}</span>
|
|
27
|
+
</div>
|
|
28
|
+
{/if}
|
|
29
|
+
<div class="props-table-scroll">
|
|
30
|
+
<table>
|
|
31
|
+
<thead>
|
|
32
|
+
<tr>
|
|
33
|
+
<th class="col-prop">Prop</th>
|
|
34
|
+
<th class="col-type">Type</th>
|
|
35
|
+
<th class="col-default">Default</th>
|
|
36
|
+
<th class="col-desc">Description</th>
|
|
37
|
+
</tr>
|
|
38
|
+
</thead>
|
|
39
|
+
<tbody>
|
|
40
|
+
{@render children()}
|
|
41
|
+
</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<style>
|
|
47
|
+
.props-table {
|
|
48
|
+
margin: 1.75rem 0;
|
|
49
|
+
border: 1px solid var(--border);
|
|
50
|
+
border-radius: var(--radius);
|
|
51
|
+
background: var(--card);
|
|
52
|
+
/* Clip the scroll region to the rounded corners. */
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Caption = which component. Mono + ink weight, distinct from the quiet
|
|
57
|
+
column-header row below it so the two never read as one grey slab. */
|
|
58
|
+
.props-table-caption {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 0.5rem;
|
|
62
|
+
padding: 0.65rem 1rem;
|
|
63
|
+
border-bottom: 1px solid var(--border);
|
|
64
|
+
background: color-mix(in oklch, var(--muted) 55%, var(--card));
|
|
65
|
+
}
|
|
66
|
+
.props-table-caption-mark {
|
|
67
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
68
|
+
font-size: 0.7rem;
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
color: var(--primary);
|
|
71
|
+
opacity: 0.85;
|
|
72
|
+
}
|
|
73
|
+
.props-table-caption-name {
|
|
74
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
75
|
+
font-size: 0.8125rem;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
letter-spacing: -0.01em;
|
|
78
|
+
color: var(--foreground);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.props-table-scroll {
|
|
82
|
+
overflow-x: auto;
|
|
83
|
+
}
|
|
84
|
+
.props-table table {
|
|
85
|
+
width: 100%;
|
|
86
|
+
border-collapse: collapse;
|
|
87
|
+
font-size: 0.875rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Column headers: quiet labels, no fill — the caption owns the emphasis. */
|
|
91
|
+
.props-table :global(thead th) {
|
|
92
|
+
text-align: left;
|
|
93
|
+
font-size: 0.75rem;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
color: var(--muted-foreground);
|
|
96
|
+
padding: 0.55rem 1rem;
|
|
97
|
+
border-bottom: 1px solid var(--border);
|
|
98
|
+
white-space: nowrap;
|
|
99
|
+
}
|
|
100
|
+
/* Prop / Default shrink to their content; Type flexes; Description holds width. */
|
|
101
|
+
.props-table :global(.col-prop),
|
|
102
|
+
.props-table :global(.col-default) {
|
|
103
|
+
width: 1%;
|
|
104
|
+
}
|
|
105
|
+
.props-table :global(.col-desc) {
|
|
106
|
+
width: 40%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.props-table :global(tbody td) {
|
|
110
|
+
padding: 0.7rem 1rem;
|
|
111
|
+
vertical-align: baseline;
|
|
112
|
+
border-top: 1px solid var(--border);
|
|
113
|
+
transition: background-color 120ms ease;
|
|
114
|
+
}
|
|
115
|
+
.props-table :global(tbody tr:first-child td) {
|
|
116
|
+
border-top: none;
|
|
117
|
+
}
|
|
118
|
+
.props-table :global(tbody tr:hover td) {
|
|
119
|
+
background: color-mix(in oklch, var(--muted) 45%, transparent);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@media (prefers-reduced-motion: reduce) {
|
|
123
|
+
.props-table :global(tbody td) {
|
|
124
|
+
transition: none;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** Optional caption — the component name when a page documents several. */
|
|
4
|
+
title?: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const PropsTable: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type PropsTable = ReturnType<typeof PropsTable>;
|
|
9
|
+
export default PropsTable;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChild } from '../../../shadcn.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChild<AccordionPrimitive.ContentProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AccordionPrimitive.Content
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="accordion-content"
|
|
16
|
+
class="data-open:animate-accordion-down data-closed:animate-accordion-up text-sm overflow-hidden"
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class={cn(
|
|
21
|
+
'pt-0 pb-4 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4',
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
{@render children?.()}
|
|
26
|
+
</div>
|
|
27
|
+
</AccordionPrimitive.Content>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
2
|
+
declare const AccordionContent: import("svelte").Component<Omit<AccordionPrimitive.ContentProps, "child">, {}, "ref">;
|
|
3
|
+
type AccordionContent = ReturnType<typeof AccordionContent>;
|
|
4
|
+
export default AccordionContent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../shadcn.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: AccordionPrimitive.ItemProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<AccordionPrimitive.Item
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="accordion-item"
|
|
15
|
+
class={cn('not-last:border-b', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChild } from '../../../shadcn.js';
|
|
4
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
5
|
+
import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
level = 3,
|
|
11
|
+
children,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithoutChild<AccordionPrimitive.TriggerProps> & {
|
|
14
|
+
level?: AccordionPrimitive.HeaderProps['level'];
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<AccordionPrimitive.Header {level} class="flex">
|
|
19
|
+
<AccordionPrimitive.Trigger
|
|
20
|
+
data-slot="accordion-trigger"
|
|
21
|
+
bind:ref
|
|
22
|
+
class={cn(
|
|
23
|
+
'focus-visible:ring-ring/50 focus-visible:border-ring focus-visible:after:border-ring **:data-[slot=accordion-trigger-icon]:text-muted-foreground rounded-md py-4 text-left text-sm font-medium hover:underline focus-visible:ring-3 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 group/accordion-trigger relative flex flex-1 items-start justify-between border border-transparent transition-all outline-none disabled:pointer-events-none disabled:opacity-50',
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...restProps}
|
|
27
|
+
>
|
|
28
|
+
{@render children?.()}
|
|
29
|
+
<ChevronDownIcon
|
|
30
|
+
data-slot="accordion-trigger-icon"
|
|
31
|
+
class="cn-accordion-trigger-icon pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
|
|
32
|
+
/>
|
|
33
|
+
<ChevronUpIcon
|
|
34
|
+
data-slot="accordion-trigger-icon"
|
|
35
|
+
class="cn-accordion-trigger-icon pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
|
|
36
|
+
/>
|
|
37
|
+
</AccordionPrimitive.Trigger>
|
|
38
|
+
</AccordionPrimitive.Header>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
2
|
+
import { type WithoutChild } from '../../../shadcn.js';
|
|
3
|
+
type $$ComponentProps = WithoutChild<AccordionPrimitive.TriggerProps> & {
|
|
4
|
+
level?: AccordionPrimitive.HeaderProps['level'];
|
|
5
|
+
};
|
|
6
|
+
declare const AccordionTrigger: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
7
|
+
type AccordionTrigger = ReturnType<typeof AccordionTrigger>;
|
|
8
|
+
export default AccordionTrigger;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../shadcn.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: AccordionPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AccordionPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
bind:value={value as never}
|
|
16
|
+
data-slot="accordion"
|
|
17
|
+
class={cn('cn-accordion flex w-full flex-col', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from './accordion.svelte';
|
|
2
|
+
import Content from './accordion-content.svelte';
|
|
3
|
+
import Item from './accordion-item.svelte';
|
|
4
|
+
import Trigger from './accordion-trigger.svelte';
|
|
5
|
+
export { Root, Content, Item, Trigger, Root as Accordion, Content as AccordionContent, Item as AccordionItem, Trigger as AccordionTrigger };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Root from './accordion.svelte';
|
|
2
|
+
import Content from './accordion-content.svelte';
|
|
3
|
+
import Item from './accordion-item.svelte';
|
|
4
|
+
import Trigger from './accordion-trigger.svelte';
|
|
5
|
+
export { Root, Content, Item, Trigger,
|
|
6
|
+
//
|
|
7
|
+
Root as Accordion, Content as AccordionContent, Item as AccordionItem, Trigger as AccordionTrigger };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const badgeVariants = tv({
|
|
5
|
+
base: 'h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-colors focus-visible:ring-[3px] [&>svg]:pointer-events-none',
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
9
|
+
secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
|
|
10
|
+
destructive:
|
|
11
|
+
'bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20',
|
|
12
|
+
outline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',
|
|
13
|
+
ghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',
|
|
14
|
+
link: 'text-primary underline-offset-4 hover:underline'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: 'default'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>['variant'];
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
27
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
ref = $bindable(null),
|
|
31
|
+
href,
|
|
32
|
+
class: className,
|
|
33
|
+
variant = 'default',
|
|
34
|
+
children,
|
|
35
|
+
...restProps
|
|
36
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
37
|
+
variant?: BadgeVariant;
|
|
38
|
+
} = $props();
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<svelte:element
|
|
42
|
+
this={href ? 'a' : 'span'}
|
|
43
|
+
bind:this={ref}
|
|
44
|
+
data-slot="badge"
|
|
45
|
+
{href}
|
|
46
|
+
class={cn(badgeVariants({ variant }), className)}
|
|
47
|
+
{...restProps}
|
|
48
|
+
>
|
|
49
|
+
{@render children?.()}
|
|
50
|
+
</svelte:element>
|