@alliance-droid/svelte-docs-system 0.0.1
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/COMPONENTS.md +365 -0
- package/COVERAGE_REPORT.md +663 -0
- package/README.md +42 -0
- package/SEARCH_VERIFICATION.md +229 -0
- package/TEST_SUMMARY.md +344 -0
- package/bin/init.js +821 -0
- package/docs/E2E_TESTS.md +354 -0
- package/docs/TESTING.md +754 -0
- package/docs/de/index.md +41 -0
- package/docs/en/COMPONENTS.md +443 -0
- package/docs/en/api/examples.md +100 -0
- package/docs/en/api/overview.md +69 -0
- package/docs/en/components/index.md +622 -0
- package/docs/en/config/navigation.md +505 -0
- package/docs/en/config/theme-and-colors.md +395 -0
- package/docs/en/getting-started/integration.md +406 -0
- package/docs/en/guides/common-setups.md +651 -0
- package/docs/en/index.md +243 -0
- package/docs/en/markdown.md +102 -0
- package/docs/en/routing.md +64 -0
- package/docs/en/setup.md +52 -0
- package/docs/en/troubleshooting.md +704 -0
- package/docs/es/index.md +41 -0
- package/docs/fr/index.md +41 -0
- package/docs/ja/index.md +41 -0
- package/package.json +40 -0
- package/pagefind.toml +8 -0
- package/postcss.config.js +5 -0
- package/src/app.css +119 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +11 -0
- package/src/lib/assets/favicon.svg +1 -0
- package/src/lib/components/APITable.svelte +120 -0
- package/src/lib/components/APITable.test.ts +153 -0
- package/src/lib/components/Breadcrumbs.svelte +85 -0
- package/src/lib/components/Breadcrumbs.test.ts +148 -0
- package/src/lib/components/Callout.svelte +60 -0
- package/src/lib/components/Callout.test.ts +100 -0
- package/src/lib/components/CodeBlock.svelte +68 -0
- package/src/lib/components/CodeBlock.test.ts +133 -0
- package/src/lib/components/DocLayout.svelte +84 -0
- package/src/lib/components/Footer.svelte +78 -0
- package/src/lib/components/Image.svelte +100 -0
- package/src/lib/components/Image.test.ts +163 -0
- package/src/lib/components/Navbar.svelte +141 -0
- package/src/lib/components/Search.svelte +248 -0
- package/src/lib/components/Sidebar.svelte +110 -0
- package/src/lib/components/Tabs.svelte +48 -0
- package/src/lib/components/Tabs.test.ts +102 -0
- package/src/lib/config.test.ts +140 -0
- package/src/lib/config.ts +179 -0
- package/src/lib/configIntegration.test.ts +272 -0
- package/src/lib/configLoader.ts +231 -0
- package/src/lib/configParser.test.ts +217 -0
- package/src/lib/configParser.ts +234 -0
- package/src/lib/index.ts +34 -0
- package/src/lib/integration.test.ts +426 -0
- package/src/lib/navigationBuilder.test.ts +338 -0
- package/src/lib/navigationBuilder.ts +268 -0
- package/src/lib/performance.test.ts +369 -0
- package/src/lib/routing.test.ts +202 -0
- package/src/lib/routing.ts +127 -0
- package/src/lib/search-functionality.test.ts +493 -0
- package/src/lib/stores/i18n.test.ts +180 -0
- package/src/lib/stores/i18n.ts +143 -0
- package/src/lib/stores/nav.ts +36 -0
- package/src/lib/stores/search.test.ts +140 -0
- package/src/lib/stores/search.ts +162 -0
- package/src/lib/stores/theme.ts +59 -0
- package/src/lib/stores/version.test.ts +139 -0
- package/src/lib/stores/version.ts +111 -0
- package/src/lib/themeCustomization.test.ts +223 -0
- package/src/lib/themeCustomization.ts +212 -0
- package/src/lib/utils/highlight.test.ts +136 -0
- package/src/lib/utils/highlight.ts +100 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/markdown.test.ts +357 -0
- package/src/lib/utils/markdown.ts +77 -0
- package/src/routes/+layout.server.ts +1 -0
- package/src/routes/+layout.svelte +28 -0
- package/src/routes/+page.svelte +165 -0
- package/static/robots.txt +3 -0
- package/svelte.config.js +18 -0
- package/tailwind.config.ts +55 -0
- package/template-starter/.github/workflows/build.yml +40 -0
- package/template-starter/.github/workflows/deploy-github-pages.yml +47 -0
- package/template-starter/.github/workflows/deploy-netlify.yml +41 -0
- package/template-starter/.github/workflows/deploy-vercel.yml +64 -0
- package/template-starter/NPM-PACKAGE-SETUP.md +233 -0
- package/template-starter/README.md +320 -0
- package/template-starter/docs/_config.json +39 -0
- package/template-starter/docs/api/components.md +257 -0
- package/template-starter/docs/api/overview.md +169 -0
- package/template-starter/docs/guides/configuration.md +145 -0
- package/template-starter/docs/guides/github-pages-deployment.md +254 -0
- package/template-starter/docs/guides/netlify-deployment.md +159 -0
- package/template-starter/docs/guides/vercel-deployment.md +131 -0
- package/template-starter/docs/index.md +49 -0
- package/template-starter/docs/setup.md +149 -0
- package/template-starter/package.json +31 -0
- package/template-starter/pagefind.toml +3 -0
- package/template-starter/postcss.config.js +5 -0
- package/template-starter/src/app.css +34 -0
- package/template-starter/src/app.d.ts +13 -0
- package/template-starter/src/app.html +11 -0
- package/template-starter/src/lib/components/APITable.svelte +120 -0
- package/template-starter/src/lib/components/APITable.test.ts +19 -0
- package/template-starter/src/lib/components/Breadcrumbs.svelte +85 -0
- package/template-starter/src/lib/components/Breadcrumbs.test.ts +19 -0
- package/template-starter/src/lib/components/Callout.svelte +60 -0
- package/template-starter/src/lib/components/Callout.test.ts +16 -0
- package/template-starter/src/lib/components/CodeBlock.svelte +68 -0
- package/template-starter/src/lib/components/CodeBlock.test.ts +12 -0
- package/template-starter/src/lib/components/DocLayout.svelte +84 -0
- package/template-starter/src/lib/components/Footer.svelte +78 -0
- package/template-starter/src/lib/components/Image.svelte +100 -0
- package/template-starter/src/lib/components/Image.test.ts +15 -0
- package/template-starter/src/lib/components/Navbar.svelte +141 -0
- package/template-starter/src/lib/components/Search.svelte +248 -0
- package/template-starter/src/lib/components/Sidebar.svelte +110 -0
- package/template-starter/src/lib/components/Tabs.svelte +48 -0
- package/template-starter/src/lib/components/Tabs.test.ts +17 -0
- package/template-starter/src/lib/index.ts +15 -0
- package/template-starter/src/routes/+layout.svelte +28 -0
- package/template-starter/src/routes/+page.svelte +92 -0
- package/template-starter/svelte.config.js +17 -0
- package/template-starter/tailwind.config.ts +17 -0
- package/template-starter/tsconfig.json +13 -0
- package/template-starter/vite.config.ts +6 -0
- package/tests/e2e/example.spec.ts +345 -0
- package/tsconfig.json +20 -0
- package/vite.config.ts +6 -0
- package/vitest.config.ts +34 -0
- package/vitest.setup.ts +21 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Components Reference
|
|
3
|
+
description: Complete reference for all documentation system components
|
|
4
|
+
author: Andrew
|
|
5
|
+
date: 2026-02-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Components Reference
|
|
9
|
+
|
|
10
|
+
Complete reference for the 6 core components that make up the SvelteKit Documentation System.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
The documentation system provides these ready-to-use components:
|
|
15
|
+
|
|
16
|
+
1. **DocLayout** - Main wrapper that orchestrates all theme components
|
|
17
|
+
2. **Navbar** - Fixed header with navigation and controls
|
|
18
|
+
3. **Sidebar** - Responsive navigation sidebar
|
|
19
|
+
4. **Footer** - Multi-column footer with links
|
|
20
|
+
5. **Callout** - Alert boxes with info/warning/success/error variants
|
|
21
|
+
6. **Breadcrumbs** - Path navigation for current page
|
|
22
|
+
|
|
23
|
+
Additional utility components:
|
|
24
|
+
- **CodeBlock** - Code highlighting with copy button
|
|
25
|
+
- **Tabs** - Tabbed content switcher
|
|
26
|
+
- **Image** - Responsive image with captions
|
|
27
|
+
- **APITable** - API reference table component
|
|
28
|
+
- **Search** - Full-text search interface
|
|
29
|
+
|
|
30
|
+
## Component Import
|
|
31
|
+
|
|
32
|
+
Import components from `$lib/components`:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import DocLayout from '$lib/components/DocLayout.svelte';
|
|
36
|
+
import Navbar from '$lib/components/Navbar.svelte';
|
|
37
|
+
import Sidebar from '$lib/components/Sidebar.svelte';
|
|
38
|
+
import Footer from '$lib/components/Footer.svelte';
|
|
39
|
+
import Callout from '$lib/components/Callout.svelte';
|
|
40
|
+
import Breadcrumbs from '$lib/components/Breadcrumbs.svelte';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or use the barrel export:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import {
|
|
47
|
+
DocLayout,
|
|
48
|
+
Navbar,
|
|
49
|
+
Sidebar,
|
|
50
|
+
Footer,
|
|
51
|
+
Callout,
|
|
52
|
+
Breadcrumbs,
|
|
53
|
+
} from '$lib/components';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 1. DocLayout
|
|
57
|
+
|
|
58
|
+
**Purpose:** Main wrapper component that orchestrates theme, navbar, sidebar, and footer.
|
|
59
|
+
|
|
60
|
+
### Props
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
interface DocLayoutProps {
|
|
64
|
+
title?: string; // Documentation title/site name
|
|
65
|
+
logo?: string | null; // Logo image URL
|
|
66
|
+
sections?: NavSection[]; // Navigation sections for sidebar
|
|
67
|
+
copyright?: string; // Footer copyright text
|
|
68
|
+
footerLinks?: FooterLink[]; // Additional footer links
|
|
69
|
+
children?: Snippet; // Page content
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface NavSection {
|
|
73
|
+
title: string;
|
|
74
|
+
items: NavItem[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface NavItem {
|
|
78
|
+
label: string;
|
|
79
|
+
href?: string;
|
|
80
|
+
icon?: string;
|
|
81
|
+
children?: NavItem[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface FooterLink {
|
|
85
|
+
label: string;
|
|
86
|
+
href: string;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Example Usage
|
|
91
|
+
|
|
92
|
+
```svelte
|
|
93
|
+
<script lang="ts">
|
|
94
|
+
import DocLayout from '$lib/components/DocLayout.svelte';
|
|
95
|
+
import type { NavSection } from '$lib/stores/nav';
|
|
96
|
+
|
|
97
|
+
const sections: NavSection[] = [
|
|
98
|
+
{
|
|
99
|
+
title: 'Documentation',
|
|
100
|
+
items: [
|
|
101
|
+
{ label: 'Home', href: '/docs' },
|
|
102
|
+
{ label: 'Setup', href: '/docs/setup' },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<DocLayout
|
|
109
|
+
title="My Documentation"
|
|
110
|
+
logo="/logo.svg"
|
|
111
|
+
{sections}
|
|
112
|
+
copyright="© 2026 My Project"
|
|
113
|
+
footerLinks={[
|
|
114
|
+
{ label: 'GitHub', href: 'https://github.com/myproject' },
|
|
115
|
+
{ label: 'Support', href: 'https://support.myproject.com' },
|
|
116
|
+
]}
|
|
117
|
+
>
|
|
118
|
+
<slot />
|
|
119
|
+
</DocLayout>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Features
|
|
123
|
+
|
|
124
|
+
- ✅ Responsive grid layout (sidebar + main content)
|
|
125
|
+
- ✅ Mobile sidebar overlay with backdrop
|
|
126
|
+
- ✅ Dark mode support
|
|
127
|
+
- ✅ Sticky navbar
|
|
128
|
+
- ✅ Automatic active page highlighting
|
|
129
|
+
- ✅ Accessible navigation
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 2. Navbar
|
|
134
|
+
|
|
135
|
+
**Purpose:** Fixed header with logo, navigation toggle, theme selector, and controls.
|
|
136
|
+
|
|
137
|
+
### Props
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
interface NavbarProps {
|
|
141
|
+
title?: string; // Brand/site name
|
|
142
|
+
logo?: string | null; // Logo image URL
|
|
143
|
+
onLogoClick?: () => void; // Logo click handler
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Example Usage
|
|
148
|
+
|
|
149
|
+
```svelte
|
|
150
|
+
<script lang="ts">
|
|
151
|
+
import Navbar from '$lib/components/Navbar.svelte';
|
|
152
|
+
|
|
153
|
+
function handleLogoClick() {
|
|
154
|
+
window.location.href = '/';
|
|
155
|
+
}
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<Navbar
|
|
159
|
+
title="My Docs"
|
|
160
|
+
logo="/logo.svg"
|
|
161
|
+
onLogoClick={handleLogoClick}
|
|
162
|
+
/>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Features
|
|
166
|
+
|
|
167
|
+
- ✅ Sticky positioning at viewport top
|
|
168
|
+
- ✅ Logo/brand click handler
|
|
169
|
+
- ✅ Mobile hamburger menu button
|
|
170
|
+
- ✅ Dark mode toggle (sun/moon icons)
|
|
171
|
+
- ✅ Language selector dropdown
|
|
172
|
+
- ✅ Version selector dropdown
|
|
173
|
+
- ✅ Responsive: hamburger on mobile, controls on desktop
|
|
174
|
+
- ✅ FontAwesome icon support
|
|
175
|
+
|
|
176
|
+
### Customizing Navbar
|
|
177
|
+
|
|
178
|
+
Edit `src/lib/components/Navbar.svelte` to add custom buttons or controls:
|
|
179
|
+
|
|
180
|
+
```svelte
|
|
181
|
+
<nav class="navbar">
|
|
182
|
+
<div class="navbar-brand">
|
|
183
|
+
<button on:click={onLogoClick}>
|
|
184
|
+
{#if logo}
|
|
185
|
+
<img src={logo} alt={title} />
|
|
186
|
+
{/if}
|
|
187
|
+
{title}
|
|
188
|
+
</button>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div class="navbar-center">
|
|
192
|
+
<!-- Add custom buttons here -->
|
|
193
|
+
<button class="btn btn-sm">Custom Action</button>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="navbar-end">
|
|
197
|
+
<!-- Hamburger, theme toggle, etc -->
|
|
198
|
+
</div>
|
|
199
|
+
</nav>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 3. Sidebar
|
|
205
|
+
|
|
206
|
+
**Purpose:** Responsive navigation sidebar with nested items, active highlighting, and mobile overlay.
|
|
207
|
+
|
|
208
|
+
### Props
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
interface SidebarProps {
|
|
212
|
+
sections?: NavSection[]; // Navigation sections
|
|
213
|
+
currentPath?: string; // Current route for active state
|
|
214
|
+
onNavigate?: (path: string) => void; // Called when item clicked
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Example Usage
|
|
219
|
+
|
|
220
|
+
```svelte
|
|
221
|
+
<script lang="ts">
|
|
222
|
+
import Sidebar from '$lib/components/Sidebar.svelte';
|
|
223
|
+
import { page } from '$app/stores';
|
|
224
|
+
|
|
225
|
+
let currentPath = $derived($page.url.pathname);
|
|
226
|
+
|
|
227
|
+
const sections = [
|
|
228
|
+
{
|
|
229
|
+
title: 'Getting Started',
|
|
230
|
+
items: [
|
|
231
|
+
{ label: 'Installation', href: '/docs/install' },
|
|
232
|
+
{ label: 'Quick Start', href: '/docs/quick-start' },
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
];
|
|
236
|
+
|
|
237
|
+
function handleNavigate(path: string) {
|
|
238
|
+
window.location.href = path;
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<Sidebar {sections} {currentPath} onNavigate={handleNavigate} />
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Features
|
|
246
|
+
|
|
247
|
+
- ✅ Collapsible sections
|
|
248
|
+
- ✅ Nested navigation items
|
|
249
|
+
- ✅ Active page highlighting with blue accent
|
|
250
|
+
- ✅ Mobile overlay with backdrop
|
|
251
|
+
- ✅ Auto-close on navigation (mobile)
|
|
252
|
+
- ✅ FontAwesome icon support
|
|
253
|
+
- ✅ Smooth slide-in animation
|
|
254
|
+
- ✅ Scrollable on overflow
|
|
255
|
+
|
|
256
|
+
### Sidebar Variants
|
|
257
|
+
|
|
258
|
+
**Compact mode** (less padding):
|
|
259
|
+
|
|
260
|
+
```svelte
|
|
261
|
+
<style>
|
|
262
|
+
:global(.sidebar-item) {
|
|
263
|
+
@apply py-1 px-2; /* Less padding */
|
|
264
|
+
}
|
|
265
|
+
</style>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Collapsible sections** (by default):
|
|
269
|
+
|
|
270
|
+
```svelte
|
|
271
|
+
<script lang="ts">
|
|
272
|
+
let expandedSections = new Set();
|
|
273
|
+
|
|
274
|
+
function toggleSection(title: string) {
|
|
275
|
+
if (expandedSections.has(title)) {
|
|
276
|
+
expandedSections.delete(title);
|
|
277
|
+
} else {
|
|
278
|
+
expandedSections.add(title);
|
|
279
|
+
}
|
|
280
|
+
expandedSections = expandedSections;
|
|
281
|
+
}
|
|
282
|
+
</script>
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## 4. Footer
|
|
288
|
+
|
|
289
|
+
**Purpose:** Multi-column footer with project info, links, and social media.
|
|
290
|
+
|
|
291
|
+
### Props
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
interface FooterProps {
|
|
295
|
+
copyright?: string; // Copyright text
|
|
296
|
+
links?: { label: string; href: string }[]; // Footer links
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Example Usage
|
|
301
|
+
|
|
302
|
+
```svelte
|
|
303
|
+
<script lang="ts">
|
|
304
|
+
import Footer from '$lib/components/Footer.svelte';
|
|
305
|
+
</script>
|
|
306
|
+
|
|
307
|
+
<Footer
|
|
308
|
+
copyright="© 2026 My Project. All rights reserved."
|
|
309
|
+
links={[
|
|
310
|
+
{ label: 'GitHub', href: 'https://github.com' },
|
|
311
|
+
{ label: 'Twitter', href: 'https://twitter.com' },
|
|
312
|
+
{ label: 'Support', href: 'https://support.example.com' },
|
|
313
|
+
]}
|
|
314
|
+
/>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Features
|
|
318
|
+
|
|
319
|
+
- ✅ Three-column layout (About, Resources, Connect)
|
|
320
|
+
- ✅ Responsive grid (stacks on mobile)
|
|
321
|
+
- ✅ Social media buttons
|
|
322
|
+
- ✅ Copyright notice
|
|
323
|
+
- ✅ Dark mode styling
|
|
324
|
+
- ✅ Customizable links
|
|
325
|
+
- ✅ FontAwesome icon support
|
|
326
|
+
|
|
327
|
+
### Footer Structure
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
┌─────────────────────────────────────────┐
|
|
331
|
+
│ About Resources Connect │
|
|
332
|
+
│ Description - Link 1 GitHub │
|
|
333
|
+
│ of project - Link 2 Twitter │
|
|
334
|
+
│ - Link 3 Email │
|
|
335
|
+
│ © 2026 - Link 4 RSS │
|
|
336
|
+
└─────────────────────────────────────────┘
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## 5. Callout
|
|
342
|
+
|
|
343
|
+
**Purpose:** Alert boxes with different variants (info, warning, success, error).
|
|
344
|
+
|
|
345
|
+
### Props
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
interface CalloutProps {
|
|
349
|
+
variant?: 'info' | 'warning' | 'success' | 'error'; // Box type
|
|
350
|
+
title?: string; // Optional title
|
|
351
|
+
icon?: string; // FontAwesome icon
|
|
352
|
+
children?: Snippet; // Content
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Example Usage
|
|
357
|
+
|
|
358
|
+
```svelte
|
|
359
|
+
<script lang="ts">
|
|
360
|
+
import Callout from '$lib/components/Callout.svelte';
|
|
361
|
+
</script>
|
|
362
|
+
|
|
363
|
+
<!-- Info callout -->
|
|
364
|
+
<Callout variant="info" title="Pro Tip">
|
|
365
|
+
You can customize colors in tailwind.config.ts
|
|
366
|
+
</Callout>
|
|
367
|
+
|
|
368
|
+
<!-- Warning callout -->
|
|
369
|
+
<Callout variant="warning" title="Breaking Change">
|
|
370
|
+
Version 2.0 requires Node.js 18+
|
|
371
|
+
</Callout>
|
|
372
|
+
|
|
373
|
+
<!-- Success callout -->
|
|
374
|
+
<Callout variant="success" title="Installation Complete">
|
|
375
|
+
Your documentation system is ready to use!
|
|
376
|
+
</Callout>
|
|
377
|
+
|
|
378
|
+
<!-- Error callout -->
|
|
379
|
+
<Callout variant="error" title="Configuration Error">
|
|
380
|
+
Please check your theme configuration
|
|
381
|
+
</Callout>
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Callout Variants
|
|
385
|
+
|
|
386
|
+
| Variant | Color | Icon | Use Case |
|
|
387
|
+
|---------|-------|------|----------|
|
|
388
|
+
| `info` | Blue | ℹ️ | Tips, notes, FYI |
|
|
389
|
+
| `warning` | Amber | ⚠️ | Important warnings |
|
|
390
|
+
| `success` | Green | ✓ | Confirmations, completed tasks |
|
|
391
|
+
| `error` | Red | ✕ | Errors, failures |
|
|
392
|
+
|
|
393
|
+
### Styling
|
|
394
|
+
|
|
395
|
+
```svelte
|
|
396
|
+
<style>
|
|
397
|
+
:global(.callout-info) {
|
|
398
|
+
@apply bg-blue-50 border-l-4 border-blue-500;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
:global(.callout-info.dark) {
|
|
402
|
+
@apply bg-blue-900/20 border-blue-400;
|
|
403
|
+
}
|
|
404
|
+
</style>
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## 6. Breadcrumbs
|
|
410
|
+
|
|
411
|
+
**Purpose:** Display current page path as navigable breadcrumbs.
|
|
412
|
+
|
|
413
|
+
### Props
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
interface BreadcrumbsProps {
|
|
417
|
+
items?: BreadcrumbItem[];
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
interface BreadcrumbItem {
|
|
421
|
+
label: string;
|
|
422
|
+
href?: string; // Optional - no href = current page
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Example Usage
|
|
427
|
+
|
|
428
|
+
```svelte
|
|
429
|
+
<script lang="ts">
|
|
430
|
+
import Breadcrumbs from '$lib/components/Breadcrumbs.svelte';
|
|
431
|
+
</script>
|
|
432
|
+
|
|
433
|
+
<Breadcrumbs
|
|
434
|
+
items={[
|
|
435
|
+
{ label: 'Docs', href: '/docs' },
|
|
436
|
+
{ label: 'Getting Started', href: '/docs/getting-started' },
|
|
437
|
+
{ label: 'Installation' }, <!-- Current page -->
|
|
438
|
+
]}
|
|
439
|
+
/>
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Rendering
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
Home > Documentation > Getting Started > Installation
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Auto-Generate from Path
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
import { page } from '$app/stores';
|
|
452
|
+
|
|
453
|
+
let breadcrumbs = $derived.by(() => {
|
|
454
|
+
const segments = $page.url.pathname
|
|
455
|
+
.split('/')
|
|
456
|
+
.filter(s => s && s !== 'docs');
|
|
457
|
+
|
|
458
|
+
return [
|
|
459
|
+
{ label: 'Docs', href: '/docs' },
|
|
460
|
+
...segments.map((segment, i) => ({
|
|
461
|
+
label: segment
|
|
462
|
+
.split('-')
|
|
463
|
+
.map(w => w.charAt(0).toUpperCase() + w.slice(1))
|
|
464
|
+
.join(' '),
|
|
465
|
+
href: i < segments.length - 1
|
|
466
|
+
? '/docs/' + segments.slice(0, i + 1).join('/')
|
|
467
|
+
: undefined,
|
|
468
|
+
})),
|
|
469
|
+
];
|
|
470
|
+
});
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
## Additional Components
|
|
476
|
+
|
|
477
|
+
### CodeBlock
|
|
478
|
+
|
|
479
|
+
Syntax-highlighted code blocks with copy button:
|
|
480
|
+
|
|
481
|
+
```svelte
|
|
482
|
+
<script lang="ts">
|
|
483
|
+
import CodeBlock from '$lib/components/CodeBlock.svelte';
|
|
484
|
+
</script>
|
|
485
|
+
|
|
486
|
+
<CodeBlock
|
|
487
|
+
language="typescript"
|
|
488
|
+
code={`export interface Props {
|
|
489
|
+
title: string;
|
|
490
|
+
variant: 'info' | 'warning';
|
|
491
|
+
}`}
|
|
492
|
+
/>
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Tabs
|
|
496
|
+
|
|
497
|
+
Tabbed content interface:
|
|
498
|
+
|
|
499
|
+
```svelte
|
|
500
|
+
<script lang="ts">
|
|
501
|
+
import Tabs from '$lib/components/Tabs.svelte';
|
|
502
|
+
</script>
|
|
503
|
+
|
|
504
|
+
<Tabs
|
|
505
|
+
tabs={[
|
|
506
|
+
{ label: 'TypeScript', content: '// TS code' },
|
|
507
|
+
{ label: 'JavaScript', content: '// JS code' },
|
|
508
|
+
]}
|
|
509
|
+
/>
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### Image
|
|
513
|
+
|
|
514
|
+
Responsive images with captions:
|
|
515
|
+
|
|
516
|
+
```svelte
|
|
517
|
+
<script lang="ts">
|
|
518
|
+
import Image from '$lib/components/Image.svelte';
|
|
519
|
+
</script>
|
|
520
|
+
|
|
521
|
+
<Image
|
|
522
|
+
src="/screenshots/dashboard.png"
|
|
523
|
+
alt="Dashboard overview"
|
|
524
|
+
caption="The main dashboard interface"
|
|
525
|
+
width={800}
|
|
526
|
+
height={600}
|
|
527
|
+
/>
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### APITable
|
|
531
|
+
|
|
532
|
+
API reference table component:
|
|
533
|
+
|
|
534
|
+
```svelte
|
|
535
|
+
<script lang="ts">
|
|
536
|
+
import APITable from '$lib/components/APITable.svelte';
|
|
537
|
+
</script>
|
|
538
|
+
|
|
539
|
+
<APITable
|
|
540
|
+
rows={[
|
|
541
|
+
{
|
|
542
|
+
method: 'GET',
|
|
543
|
+
endpoint: '/api/users',
|
|
544
|
+
description: 'Get all users',
|
|
545
|
+
returns: 'User[]',
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
method: 'POST',
|
|
549
|
+
endpoint: '/api/users',
|
|
550
|
+
description: 'Create new user',
|
|
551
|
+
returns: 'User',
|
|
552
|
+
},
|
|
553
|
+
]}
|
|
554
|
+
/>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
## Component Composition
|
|
560
|
+
|
|
561
|
+
Build custom components by composing these primitives:
|
|
562
|
+
|
|
563
|
+
```svelte
|
|
564
|
+
<script lang="ts">
|
|
565
|
+
import Callout from '$lib/components/Callout.svelte';
|
|
566
|
+
import CodeBlock from '$lib/components/CodeBlock.svelte';
|
|
567
|
+
</script>
|
|
568
|
+
|
|
569
|
+
<Callout variant="warning" title="Before You Start">
|
|
570
|
+
This example requires Node.js 18+
|
|
571
|
+
</Callout>
|
|
572
|
+
|
|
573
|
+
<CodeBlock
|
|
574
|
+
language="bash"
|
|
575
|
+
code="npm install my-package"
|
|
576
|
+
/>
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## Accessibility
|
|
582
|
+
|
|
583
|
+
All components follow Web Content Accessibility Guidelines (WCAG):
|
|
584
|
+
|
|
585
|
+
- ✅ Semantic HTML
|
|
586
|
+
- ✅ ARIA labels where needed
|
|
587
|
+
- ✅ Keyboard navigation support
|
|
588
|
+
- ✅ Sufficient color contrast
|
|
589
|
+
- ✅ Focus management
|
|
590
|
+
- ✅ Screen reader tested
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
## Dark Mode
|
|
595
|
+
|
|
596
|
+
All components fully support dark mode via Tailwind's `dark:` prefix:
|
|
597
|
+
|
|
598
|
+
```svelte
|
|
599
|
+
<div class="bg-claude-bg dark:bg-claude-dark-bg text-claude-text dark:text-claude-dark-text">
|
|
600
|
+
Content adapts to theme automatically
|
|
601
|
+
</div>
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Responsive Design
|
|
607
|
+
|
|
608
|
+
Components are fully responsive:
|
|
609
|
+
|
|
610
|
+
- **Mobile** (< 768px) - Single column, stacked layout
|
|
611
|
+
- **Tablet** (768px - 1024px) - Two column layout
|
|
612
|
+
- **Desktop** (> 1024px) - Full multi-column layout
|
|
613
|
+
|
|
614
|
+
Test using browser dev tools to verify responsive behavior.
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
## Next Steps
|
|
619
|
+
|
|
620
|
+
- [Explore Component Examples](/docs/components/examples)
|
|
621
|
+
- [Customize Component Styling](/docs/config/theme)
|
|
622
|
+
- [Build Custom Components](/docs/guides/custom-components)
|