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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 George Daskalakis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Svelte DocSmith
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/svelte-docsmith)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
The documentation framework for Svelte 5 library authors whose interactive
|
|
7
|
+
examples need to live inside one real, stateful SvelteKit app — not sandboxed as
|
|
8
|
+
isolated islands.
|
|
9
|
+
|
|
10
|
+
Write a markdown file under `src/routes/docs/` and you get a styled page with
|
|
11
|
+
syntax highlighting, heading anchors, a sidebar derived from your content, and a
|
|
12
|
+
live table of contents — no per-page wiring, no content collection to configure.
|
|
13
|
+
|
|
14
|
+
> **Status: pre-1.0.** Published to npm and usable today. The public API is still
|
|
15
|
+
> stabilising, so minor releases may include breaking changes until v1.0.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install svelte-docsmith
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Peer dependencies: Svelte 5, SvelteKit 2, and Tailwind v4 — set up the standard
|
|
24
|
+
way in your app.
|
|
25
|
+
|
|
26
|
+
## Setup
|
|
27
|
+
|
|
28
|
+
Three small pieces, once.
|
|
29
|
+
|
|
30
|
+
**1. The markdown pipeline** — in `svelte.config.js`. One call bundles mdsvex,
|
|
31
|
+
Shiki highlighting (dual light/dark themes, a generous language set, plain-text
|
|
32
|
+
fallback for unknown languages), heading anchors, and the packaged page layout:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// svelte.config.js
|
|
36
|
+
import adapter from '@sveltejs/adapter-auto';
|
|
37
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
38
|
+
import { docsmith } from 'svelte-docsmith/preprocess';
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
extensions: ['.svelte', '.md'],
|
|
42
|
+
preprocess: [vitePreprocess(), docsmith()],
|
|
43
|
+
kit: { adapter: adapter() }
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**2. The Vite plugin** — in `vite.config.ts`. It scans your doc pages'
|
|
48
|
+
frontmatter into the `svelte-docsmith/content` module (so the sidebar is derived
|
|
49
|
+
from content, never hand-written) and powers `LiveExample`:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// vite.config.ts
|
|
53
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
54
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
55
|
+
import { docsmith } from 'svelte-docsmith/vite';
|
|
56
|
+
import { defineConfig } from 'vite';
|
|
57
|
+
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
plugins: [docsmith(), tailwindcss(), sveltekit()]
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
By default it scans `src/routes/docs`; pass `docsmith({ content: 'src/routes/guide' })`
|
|
64
|
+
to point elsewhere.
|
|
65
|
+
|
|
66
|
+
**3. The stylesheet** — in your root `app.css`. Your app needs Tailwind v4 set up
|
|
67
|
+
the standard way (`tailwindcss` + the `@tailwindcss/vite` plugin, stylesheet
|
|
68
|
+
imported in the root layout). After that the whole style contract is one import:
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
@import 'tailwindcss';
|
|
72
|
+
@import 'svelte-docsmith/theme.css';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`theme.css` makes Tailwind scan the package, defines the shadcn theme tokens
|
|
76
|
+
(`--background`, `--primary`, `--radius`, …) for `:root` and `.dark`, and pulls
|
|
77
|
+
in the typography and animation plugins. Override any token by redefining it
|
|
78
|
+
after the import.
|
|
79
|
+
|
|
80
|
+
## The shell
|
|
81
|
+
|
|
82
|
+
Add `DocsShell` once, in `src/routes/docs/+layout.svelte`. It composes the
|
|
83
|
+
header, sidebar, content area, and table of contents. `docs` is the generated
|
|
84
|
+
content index — no import of a content collection, no alias to configure:
|
|
85
|
+
|
|
86
|
+
```svelte
|
|
87
|
+
<script lang="ts">
|
|
88
|
+
import { DocsShell, defineConfig } from 'svelte-docsmith';
|
|
89
|
+
import { docs } from 'svelte-docsmith/content';
|
|
90
|
+
|
|
91
|
+
const config = defineConfig({
|
|
92
|
+
title: 'My Library',
|
|
93
|
+
github: 'https://github.com/you/my-library'
|
|
94
|
+
});
|
|
95
|
+
const { children } = $props();
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<DocsShell {config} content={docs}>
|
|
99
|
+
{@render children()}
|
|
100
|
+
</DocsShell>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Doc pages
|
|
104
|
+
|
|
105
|
+
Each page is a `+page.md` under `src/routes/docs/`. Frontmatter drives the
|
|
106
|
+
sidebar; the body is markdown:
|
|
107
|
+
|
|
108
|
+
````md
|
|
109
|
+
---
|
|
110
|
+
title: Getting Started
|
|
111
|
+
description: Install and configure the library.
|
|
112
|
+
section: Guides
|
|
113
|
+
order: 1
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Installation
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm install my-library
|
|
120
|
+
```
|
|
121
|
+
````
|
|
122
|
+
|
|
123
|
+
`title` names the page. `section` groups pages in the sidebar; `order` sorts
|
|
124
|
+
within a group (and orders the groups by their smallest `order`). Add the file
|
|
125
|
+
and it appears in the sidebar — styled, highlighted, with a table of contents.
|
|
126
|
+
|
|
127
|
+
## Live examples
|
|
128
|
+
|
|
129
|
+
`LiveExample` renders a real, interactive component next to its own
|
|
130
|
+
syntax-highlighted source — one file, imported twice, so the demo and its code
|
|
131
|
+
can never drift. The `?source` import is served by the same `docsmith()` Vite
|
|
132
|
+
plugin you already added:
|
|
133
|
+
|
|
134
|
+
```svelte
|
|
135
|
+
<script>
|
|
136
|
+
import { LiveExample } from 'svelte-docsmith';
|
|
137
|
+
import Counter from '$lib/examples/counter.svelte';
|
|
138
|
+
import counterSource from '$lib/examples/counter.svelte?source';
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<LiveExample source={counterSource}>
|
|
142
|
+
<Counter />
|
|
143
|
+
</LiveExample>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## What's exported
|
|
147
|
+
|
|
148
|
+
| Entry point | What it is |
|
|
149
|
+
| ---------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
150
|
+
| `svelte-docsmith` | `DocsShell`, `LiveExample`, `Tabs`, `TabItem`, `defineConfig` + `DocsmithConfig`/`DocsContentItem` types |
|
|
151
|
+
| `svelte-docsmith/preprocess` | `docsmith()` — the mdsvex/Shiki pipeline (Node, config time) |
|
|
152
|
+
| `svelte-docsmith/vite` | `docsmith()` — content index + `?source` (Node, build time) |
|
|
153
|
+
| `svelte-docsmith/content` | `docs` — the generated sidebar content index |
|
|
154
|
+
| `svelte-docsmith/theme.css` | the style contract |
|
|
155
|
+
|
|
156
|
+
The vendored shadcn primitives and internal helpers (the TOC engine, clipboard
|
|
157
|
+
utility, markdown renderer map) are **not** part of the public API — they can
|
|
158
|
+
change between releases. Get buttons, cards, etc. from `shadcn-svelte` directly.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function useClipboard(timeout = 1500) {
|
|
2
|
+
let text = $state('');
|
|
3
|
+
let copied = $state(false);
|
|
4
|
+
function readText(node) {
|
|
5
|
+
text = node.innerText.trim();
|
|
6
|
+
}
|
|
7
|
+
function copy() {
|
|
8
|
+
if (text) {
|
|
9
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
10
|
+
copied = true;
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
copied = false;
|
|
13
|
+
}, timeout);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
readText,
|
|
19
|
+
copy,
|
|
20
|
+
get currentText() {
|
|
21
|
+
return text;
|
|
22
|
+
},
|
|
23
|
+
get copied() {
|
|
24
|
+
return copied;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static site configuration passed to `DocsShell`. Content-derived data (the
|
|
3
|
+
* sidebar nav) is NOT here — it comes from your content collection at runtime.
|
|
4
|
+
*/
|
|
5
|
+
/** A link rendered in the header nav or footer. */
|
|
6
|
+
export type DocsmithLink = {
|
|
7
|
+
label: string;
|
|
8
|
+
href: string;
|
|
9
|
+
/** Open in a new tab with `rel="noopener"`. */
|
|
10
|
+
external?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** A titled column of links in the footer. */
|
|
13
|
+
export type DocsmithFooterColumn = {
|
|
14
|
+
title: string;
|
|
15
|
+
links: DocsmithLink[];
|
|
16
|
+
};
|
|
17
|
+
export type DocsmithConfig = {
|
|
18
|
+
/** Site title, shown in the header/sidebar. */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Optional GitHub URL; renders a link in the header when set. */
|
|
21
|
+
github?: string;
|
|
22
|
+
/** Optional version string, shown in the header (e.g. your library version). */
|
|
23
|
+
version?: string;
|
|
24
|
+
/** Optional logo image src; falls back to the built-in book mark. */
|
|
25
|
+
logo?: string;
|
|
26
|
+
/** Top-level header navigation links. */
|
|
27
|
+
nav?: DocsmithLink[];
|
|
28
|
+
/** Footer content, driven by data. */
|
|
29
|
+
footer?: {
|
|
30
|
+
/** Copyright / attribution line. */
|
|
31
|
+
copyright?: string;
|
|
32
|
+
/** Titled columns of links. */
|
|
33
|
+
columns?: DocsmithFooterColumn[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Validate a {@link DocsmithConfig} at build time. Purely a pass-through for
|
|
38
|
+
* typed callers; the runtime checks catch untyped or dynamically-built configs
|
|
39
|
+
* with a real error message instead of a blank header.
|
|
40
|
+
*/
|
|
41
|
+
export declare function defineConfig(config: DocsmithConfig): DocsmithConfig;
|
|
42
|
+
/**
|
|
43
|
+
* The minimal shape `DocsShell` needs from each content entry to build the
|
|
44
|
+
* sidebar. A velite `docs` collection with title/section/order/path frontmatter
|
|
45
|
+
* satisfies this structurally.
|
|
46
|
+
*/
|
|
47
|
+
export type DocsContentItem = {
|
|
48
|
+
title: string;
|
|
49
|
+
path: string;
|
|
50
|
+
section?: string;
|
|
51
|
+
order?: number;
|
|
52
|
+
description?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The page's `h2`/`h3` headings, extracted at build time by the `docsmith()`
|
|
55
|
+
* vite plugin, so `DocsShell` can render the in-page TOC server-side. The
|
|
56
|
+
* runtime TOC engine still owns scroll-spy and re-scans the DOM.
|
|
57
|
+
*/
|
|
58
|
+
toc?: {
|
|
59
|
+
id: string;
|
|
60
|
+
title: string;
|
|
61
|
+
depth: 2 | 3;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
/** A single sidebar link. */
|
|
65
|
+
export type NavItem = {
|
|
66
|
+
title: string;
|
|
67
|
+
url: string;
|
|
68
|
+
};
|
|
69
|
+
/** A titled group of sidebar links. */
|
|
70
|
+
export type NavGroup = {
|
|
71
|
+
title: string;
|
|
72
|
+
items: NavItem[];
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Derive sidebar nav from a content collection (PLAN.md §2.6): group by
|
|
76
|
+
* `section`, order by `order` within a group, and order groups by the smallest
|
|
77
|
+
* `order` they contain. Entries without a `section` fall under "Docs".
|
|
78
|
+
*/
|
|
79
|
+
export declare function navFromContent(content: DocsContentItem[]): NavGroup[];
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate a {@link DocsmithConfig} at build time. Purely a pass-through for
|
|
3
|
+
* typed callers; the runtime checks catch untyped or dynamically-built configs
|
|
4
|
+
* with a real error message instead of a blank header.
|
|
5
|
+
*/
|
|
6
|
+
export function defineConfig(config) {
|
|
7
|
+
if (typeof config !== 'object' || config === null) {
|
|
8
|
+
throw new Error('[svelte-docsmith] defineConfig expects a config object.');
|
|
9
|
+
}
|
|
10
|
+
if (typeof config.title !== 'string' || config.title.trim() === '') {
|
|
11
|
+
throw new Error('[svelte-docsmith] config.title is required — the site title shown in the sidebar header.');
|
|
12
|
+
}
|
|
13
|
+
for (const key of ['github', 'version', 'logo']) {
|
|
14
|
+
if (config[key] !== undefined && typeof config[key] !== 'string') {
|
|
15
|
+
throw new Error(`[svelte-docsmith] config.${key} must be a string when set.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (config.nav !== undefined) {
|
|
19
|
+
if (!Array.isArray(config.nav)) {
|
|
20
|
+
throw new Error('[svelte-docsmith] config.nav must be an array of { label, href } links.');
|
|
21
|
+
}
|
|
22
|
+
for (const link of config.nav) {
|
|
23
|
+
if (typeof link?.label !== 'string' || typeof link?.href !== 'string') {
|
|
24
|
+
throw new Error('[svelte-docsmith] each config.nav entry needs a string `label` and `href`.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (config.footer !== undefined &&
|
|
29
|
+
(typeof config.footer !== 'object' || config.footer === null)) {
|
|
30
|
+
throw new Error('[svelte-docsmith] config.footer must be an object ({ copyright?, columns? }).');
|
|
31
|
+
}
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Derive sidebar nav from a content collection (PLAN.md §2.6): group by
|
|
36
|
+
* `section`, order by `order` within a group, and order groups by the smallest
|
|
37
|
+
* `order` they contain. Entries without a `section` fall under "Docs".
|
|
38
|
+
*/
|
|
39
|
+
export function navFromContent(content) {
|
|
40
|
+
const groups = new Map();
|
|
41
|
+
for (const item of content) {
|
|
42
|
+
const section = item.section ?? 'Docs';
|
|
43
|
+
const order = item.order ?? 0;
|
|
44
|
+
const group = groups.get(section) ?? { minOrder: Infinity, items: [] };
|
|
45
|
+
group.items.push({ title: item.title, url: item.path, order });
|
|
46
|
+
group.minOrder = Math.min(group.minOrder, order);
|
|
47
|
+
groups.set(section, group);
|
|
48
|
+
}
|
|
49
|
+
return [...groups.entries()]
|
|
50
|
+
.sort((a, b) => a[1].minOrder - b[1].minOrder)
|
|
51
|
+
.map(([title, group]) => ({
|
|
52
|
+
title,
|
|
53
|
+
items: group.items.sort((a, b) => a.order - b.order).map(({ title, url }) => ({ title, url }))
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `svelte-docsmith/content` — the generated sidebar content index.
|
|
3
|
+
*
|
|
4
|
+
* At build time the `docsmith()` Vite plugin (in `vite.config.ts`) intercepts
|
|
5
|
+
* this import and replaces it with your doc pages' frontmatter. This file is
|
|
6
|
+
* only the fallback that runs when the plugin is missing — it exists so the
|
|
7
|
+
* import type-checks and fails with a clear message instead of a mystery.
|
|
8
|
+
*/
|
|
9
|
+
import type { DocsContentItem } from './config.js';
|
|
10
|
+
export declare const docs: DocsContentItem[];
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Highlighter } from 'shiki';
|
|
2
|
+
/**
|
|
3
|
+
* Shared Shiki defaults for the package's two build-time entries
|
|
4
|
+
* (`svelte-docsmith/preprocess` and `svelte-docsmith/vite`), so the doc
|
|
5
|
+
* pipeline and the LiveExample source panels can never drift apart.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_THEMES: {
|
|
8
|
+
light: string;
|
|
9
|
+
dark: string;
|
|
10
|
+
};
|
|
11
|
+
/** A generous default language set for documentation code fences. */
|
|
12
|
+
export declare const DEFAULT_LANGS: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns a getter that creates the highlighter on first use and caches it.
|
|
15
|
+
* Build-time only — never import this from component code.
|
|
16
|
+
*/
|
|
17
|
+
export declare function lazyHighlighter(themes: string[], langs: string[]): () => Promise<Highlighter>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createHighlighter } from 'shiki';
|
|
2
|
+
/**
|
|
3
|
+
* Shared Shiki defaults for the package's two build-time entries
|
|
4
|
+
* (`svelte-docsmith/preprocess` and `svelte-docsmith/vite`), so the doc
|
|
5
|
+
* pipeline and the LiveExample source panels can never drift apart.
|
|
6
|
+
*/
|
|
7
|
+
export const DEFAULT_THEMES = { light: 'github-light', dark: 'github-dark' };
|
|
8
|
+
/** A generous default language set for documentation code fences. */
|
|
9
|
+
export const DEFAULT_LANGS = [
|
|
10
|
+
'javascript',
|
|
11
|
+
'typescript',
|
|
12
|
+
'jsx',
|
|
13
|
+
'tsx',
|
|
14
|
+
'svelte',
|
|
15
|
+
'html',
|
|
16
|
+
'css',
|
|
17
|
+
'json',
|
|
18
|
+
'jsonc',
|
|
19
|
+
'bash',
|
|
20
|
+
'shell',
|
|
21
|
+
'markdown',
|
|
22
|
+
'yaml',
|
|
23
|
+
'toml',
|
|
24
|
+
'python',
|
|
25
|
+
'diff'
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Returns a getter that creates the highlighter on first use and caches it.
|
|
29
|
+
* Build-time only — never import this from component code.
|
|
30
|
+
*/
|
|
31
|
+
export function lazyHighlighter(themes, langs) {
|
|
32
|
+
let promise;
|
|
33
|
+
return () => (promise ??= createHighlighter({ themes, langs }));
|
|
34
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { default as DocsShell } from './ui/layouts/docs-shell.svelte';
|
|
2
|
+
export { default as ThemeProvider } from './ui/theme-provider.svelte';
|
|
3
|
+
export { default as ThemeToggle } from './ui/theme-toggle.svelte';
|
|
4
|
+
export { default as LiveExample } from './ui/live-example.svelte';
|
|
5
|
+
export { default as Tabs } from './ui/tabs.svelte';
|
|
6
|
+
export { default as TabItem } from './ui/tab-item.svelte';
|
|
7
|
+
export { default as Callout } from './ui/callout.svelte';
|
|
8
|
+
export { default as Steps } from './ui/steps.svelte';
|
|
9
|
+
export { default as Step } from './ui/step.svelte';
|
|
10
|
+
export { default as Card } from './ui/card.svelte';
|
|
11
|
+
export { default as CardGrid } from './ui/card-grid.svelte';
|
|
12
|
+
export { default as Accordion } from './ui/accordion.svelte';
|
|
13
|
+
export { default as AccordionItem } from './ui/accordion-item.svelte';
|
|
14
|
+
export { default as Badge, type BadgeVariant } from './ui/badge.svelte';
|
|
15
|
+
export { default as Kbd } from './ui/kbd.svelte';
|
|
16
|
+
export { default as FileTree } from './ui/file-tree.svelte';
|
|
17
|
+
export { default as FileTreeItem } from './ui/file-tree-item.svelte';
|
|
18
|
+
export { default as PropsTable } from './ui/props-table.svelte';
|
|
19
|
+
export { default as Prop } from './ui/prop.svelte';
|
|
20
|
+
export { defineConfig, type DocsmithConfig, type DocsContentItem } from './config.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// The svelte-docsmith public API. Everything not exported here — the vendored
|
|
2
|
+
// shadcn primitives, the TOC engine, the clipboard helper, the markdown
|
|
3
|
+
// renderer map — is internal and may change between releases.
|
|
4
|
+
// Chrome
|
|
5
|
+
export { default as DocsShell } from './ui/layouts/docs-shell.svelte';
|
|
6
|
+
export { default as ThemeProvider } from './ui/theme-provider.svelte';
|
|
7
|
+
export { default as ThemeToggle } from './ui/theme-toggle.svelte';
|
|
8
|
+
// Docs components (authored inside markdown or composed in pages)
|
|
9
|
+
export { default as LiveExample } from './ui/live-example.svelte';
|
|
10
|
+
export { default as Tabs } from './ui/tabs.svelte';
|
|
11
|
+
export { default as TabItem } from './ui/tab-item.svelte';
|
|
12
|
+
export { default as Callout } from './ui/callout.svelte';
|
|
13
|
+
export { default as Steps } from './ui/steps.svelte';
|
|
14
|
+
export { default as Step } from './ui/step.svelte';
|
|
15
|
+
export { default as Card } from './ui/card.svelte';
|
|
16
|
+
export { default as CardGrid } from './ui/card-grid.svelte';
|
|
17
|
+
export { default as Accordion } from './ui/accordion.svelte';
|
|
18
|
+
export { default as AccordionItem } from './ui/accordion-item.svelte';
|
|
19
|
+
export { default as Badge } from './ui/badge.svelte';
|
|
20
|
+
export { default as Kbd } from './ui/kbd.svelte';
|
|
21
|
+
export { default as FileTree } from './ui/file-tree.svelte';
|
|
22
|
+
export { default as FileTreeItem } from './ui/file-tree-item.svelte';
|
|
23
|
+
export { default as PropsTable } from './ui/props-table.svelte';
|
|
24
|
+
export { default as Prop } from './ui/prop.svelte';
|
|
25
|
+
// Config
|
|
26
|
+
export { defineConfig } from './config.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
// mdsvex maps markdown elements to this module's exports (the export names
|
|
3
|
+
// must match the tag names). `docsmith()` injects this file as the default
|
|
4
|
+
// layout for every compiled markdown page.
|
|
5
|
+
import * as markdown from './ui/markdown/index.js';
|
|
6
|
+
export const pre = markdown.pre;
|
|
7
|
+
export const code = markdown.code;
|
|
8
|
+
export const h2 = markdown.h2;
|
|
9
|
+
export const h3 = markdown.h3;
|
|
10
|
+
export const table = markdown.table;
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import type { Snippet } from 'svelte';
|
|
15
|
+
|
|
16
|
+
const { children }: { children: Snippet } = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<article class="prose prose-base dark:prose-invert max-w-none pb-16">
|
|
20
|
+
{@render children()}
|
|
21
|
+
</article>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const pre: import("svelte").Component<{
|
|
2
|
+
children: Snippet;
|
|
3
|
+
}, {}, "">;
|
|
4
|
+
export declare const code: import("svelte").Component<{
|
|
5
|
+
children: Snippet;
|
|
6
|
+
}, {}, "">;
|
|
7
|
+
export declare const h2: import("svelte").Component<import("./ui/markdown/types.js").HeadingProps, {}, "">;
|
|
8
|
+
export declare const h3: import("svelte").Component<import("./ui/markdown/types.js").HeadingProps, {}, "">;
|
|
9
|
+
export declare const table: import("svelte").Component<{
|
|
10
|
+
children: Snippet;
|
|
11
|
+
}, {}, "">;
|
|
12
|
+
import type { Snippet } from 'svelte';
|
|
13
|
+
type $$ComponentProps = {
|
|
14
|
+
children: Snippet;
|
|
15
|
+
};
|
|
16
|
+
declare const MarkdownLayout: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
17
|
+
type MarkdownLayout = ReturnType<typeof MarkdownLayout>;
|
|
18
|
+
export default MarkdownLayout;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type MdsvexOptions } from 'mdsvex';
|
|
2
|
+
import type { PreprocessorGroup } from 'svelte/compiler';
|
|
3
|
+
export interface DocsmithPreprocessOptions {
|
|
4
|
+
/** File extensions compiled as markdown. Default: `['.md']`. */
|
|
5
|
+
extensions?: string[];
|
|
6
|
+
/** Shiki themes for the dual light/dark render. Default: github-light/github-dark. */
|
|
7
|
+
themes?: {
|
|
8
|
+
light: string;
|
|
9
|
+
dark: string;
|
|
10
|
+
};
|
|
11
|
+
/** Extra Shiki languages to load on top of the defaults. */
|
|
12
|
+
langs?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Absolute path to a custom mdsvex layout, or `false` for no layout.
|
|
15
|
+
* Default: the packaged layout, which wraps pages in a `prose` article and
|
|
16
|
+
* maps `pre`/`code`/`h2`/`h3` to the svelte-docsmith markdown components.
|
|
17
|
+
* A custom layout must export a `pre` component from its module script —
|
|
18
|
+
* code fences render through it (re-export `markdown.pre` if in doubt).
|
|
19
|
+
*/
|
|
20
|
+
layout?: string | false;
|
|
21
|
+
/** Extra remark plugins, appended after docsmith's own. */
|
|
22
|
+
remarkPlugins?: MdsvexOptions['remarkPlugins'];
|
|
23
|
+
/** Extra rehype plugins, appended after docsmith's own (slug, sectionize). */
|
|
24
|
+
rehypePlugins?: MdsvexOptions['rehypePlugins'];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build the svelte-docsmith preprocessor: mdsvex with Shiki highlighting
|
|
28
|
+
* (raw-code `highlight` hook — the correct mdsvex integration point, see the
|
|
29
|
+
* repo's PLAN.md §4.5), heading slugs/anchor sections, and the packaged doc
|
|
30
|
+
* layout. Unknown code-fence languages fall back to plain text instead of
|
|
31
|
+
* failing the build.
|
|
32
|
+
*/
|
|
33
|
+
export declare function docsmith(options?: DocsmithPreprocessOptions): PreprocessorGroup;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `svelte-docsmith/preprocess` — the entire markdown pipeline in one call.
|
|
3
|
+
*
|
|
4
|
+
* This entry runs in Node at config time (registered in `svelte.config.js`,
|
|
5
|
+
* or in `vite.config.js` once SvelteKit 3 consolidates the two — the factory
|
|
6
|
+
* doesn't care where it's registered). It must never import component code.
|
|
7
|
+
*/
|
|
8
|
+
import rehypeSectionize from '@hbsnow/rehype-sectionize';
|
|
9
|
+
import { transformerNotationHighlight } from '@shikijs/transformers';
|
|
10
|
+
import { escapeSvelte, mdsvex } from 'mdsvex';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import rehypeSlug from 'rehype-slug';
|
|
13
|
+
import { DEFAULT_LANGS, DEFAULT_THEMES, lazyHighlighter } from './highlight.js';
|
|
14
|
+
/**
|
|
15
|
+
* Build the svelte-docsmith preprocessor: mdsvex with Shiki highlighting
|
|
16
|
+
* (raw-code `highlight` hook — the correct mdsvex integration point, see the
|
|
17
|
+
* repo's PLAN.md §4.5), heading slugs/anchor sections, and the packaged doc
|
|
18
|
+
* layout. Unknown code-fence languages fall back to plain text instead of
|
|
19
|
+
* failing the build.
|
|
20
|
+
*/
|
|
21
|
+
export function docsmith(options = {}) {
|
|
22
|
+
const themes = options.themes ?? DEFAULT_THEMES;
|
|
23
|
+
const langs = [...new Set([...DEFAULT_LANGS, ...(options.langs ?? [])])];
|
|
24
|
+
const getHighlighter = lazyHighlighter([themes.light, themes.dark], langs);
|
|
25
|
+
const layout = options.layout === false
|
|
26
|
+
? undefined
|
|
27
|
+
: (options.layout ?? fileURLToPath(new URL('./markdown-layout.svelte', import.meta.url)));
|
|
28
|
+
// mdsvex types `markup`'s filename as required where Svelte types it as
|
|
29
|
+
// optional — runtime-compatible (Svelte always passes a filename for real
|
|
30
|
+
// files), but structurally incompatible, hence the cast.
|
|
31
|
+
return mdsvex({
|
|
32
|
+
extensions: options.extensions ?? ['.md'],
|
|
33
|
+
layout,
|
|
34
|
+
highlight: {
|
|
35
|
+
highlighter: async (code, lang) => {
|
|
36
|
+
const highlighter = await getHighlighter();
|
|
37
|
+
const language = lang && highlighter.getLoadedLanguages().includes(lang) ? lang : 'text';
|
|
38
|
+
// Shiki highlights the raw code; escapeSvelte makes the result safe
|
|
39
|
+
// to embed in a Svelte component.
|
|
40
|
+
const html = escapeSvelte(highlighter.codeToHtml(code, {
|
|
41
|
+
lang: language,
|
|
42
|
+
themes,
|
|
43
|
+
transformers: [transformerNotationHighlight()]
|
|
44
|
+
}));
|
|
45
|
+
// Without a layout there is no `Components.pre` to render through —
|
|
46
|
+
// keep Shiki's own <pre> as-is.
|
|
47
|
+
if (layout === undefined)
|
|
48
|
+
return `{@html \`${html}\`}`;
|
|
49
|
+
// Strip Shiki's outer <pre> so the layout's <pre> component (with
|
|
50
|
+
// the copy-button chrome) provides it instead.
|
|
51
|
+
const inner = html
|
|
52
|
+
.replace(/^<pre[^>]*>/, '')
|
|
53
|
+
.replace(/<\/pre>\s*$/, '')
|
|
54
|
+
.trim();
|
|
55
|
+
return `<Components.pre>{@html \`${inner}\`}</Components.pre>`;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
remarkPlugins: options.remarkPlugins,
|
|
59
|
+
rehypePlugins: [
|
|
60
|
+
rehypeSlug,
|
|
61
|
+
[rehypeSectionize, { idPropertyName: 'data-section-id' }],
|
|
62
|
+
...(options.rehypePlugins ?? [])
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
}
|
package/dist/shadcn.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
export type WithoutChild<T> = T extends {
|
|
4
|
+
child?: any;
|
|
5
|
+
} ? Omit<T, 'child'> : T;
|
|
6
|
+
export type WithoutChildren<T> = T extends {
|
|
7
|
+
children?: any;
|
|
8
|
+
} ? Omit<T, 'children'> : T;
|
|
9
|
+
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
|
|
10
|
+
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
|
|
11
|
+
ref?: U | null;
|
|
12
|
+
};
|