@alliance-droid/svelte-docs-system 0.0.2 → 0.1.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.
Files changed (185) hide show
  1. package/README.md +155 -23
  2. package/dist/components/APITable.svelte.d.ts +21 -0
  3. package/dist/components/Breadcrumbs.svelte.d.ts +14 -0
  4. package/dist/components/Callout.svelte.d.ts +15 -0
  5. package/dist/components/CodeBlock.svelte.d.ts +12 -0
  6. package/{src/lib → dist}/components/DocLayout.svelte +18 -6
  7. package/dist/components/DocLayout.svelte.d.ts +18 -0
  8. package/dist/components/DocsPage.svelte +39 -0
  9. package/dist/components/DocsPage.svelte.d.ts +8 -0
  10. package/dist/components/Documentation.svelte +639 -0
  11. package/dist/components/Footer.svelte.d.ts +10 -0
  12. package/dist/components/Image.svelte.d.ts +15 -0
  13. package/{src/lib → dist}/components/Navbar.svelte +4 -4
  14. package/dist/components/Navbar.svelte.d.ts +10 -0
  15. package/{src/lib → dist}/components/Search.svelte +2 -2
  16. package/dist/components/Search.svelte.d.ts +6 -0
  17. package/{template-starter/src/lib → dist}/components/Sidebar.svelte +2 -2
  18. package/dist/components/Sidebar.svelte.d.ts +9 -0
  19. package/dist/components/Tabs.svelte.d.ts +16 -0
  20. package/dist/config.d.ts +93 -0
  21. package/dist/config.js +89 -0
  22. package/dist/configLoader.d.ts +48 -0
  23. package/dist/configLoader.js +187 -0
  24. package/dist/configParser.d.ts +27 -0
  25. package/dist/configParser.js +208 -0
  26. package/{template-starter/src/lib/index.ts → dist/index.d.ts} +6 -7
  27. package/dist/index.js +18 -0
  28. package/dist/navigationBuilder.d.ts +64 -0
  29. package/dist/navigationBuilder.js +225 -0
  30. package/dist/plugin.d.ts +30 -0
  31. package/dist/plugin.js +172 -0
  32. package/dist/routing.d.ts +48 -0
  33. package/dist/routing.js +92 -0
  34. package/dist/stores/i18n.d.ts +20 -0
  35. package/dist/stores/i18n.js +119 -0
  36. package/dist/stores/nav.d.ts +20 -0
  37. package/dist/stores/nav.js +15 -0
  38. package/dist/stores/search.d.ts +49 -0
  39. package/dist/stores/search.js +127 -0
  40. package/dist/stores/theme.d.ts +7 -0
  41. package/dist/stores/theme.js +152 -0
  42. package/dist/stores/version.d.ts +18 -0
  43. package/dist/stores/version.js +93 -0
  44. package/dist/themeCustomization.d.ts +46 -0
  45. package/dist/themeCustomization.js +188 -0
  46. package/dist/utils/highlight.d.ts +13 -0
  47. package/dist/utils/highlight.js +83 -0
  48. package/dist/utils/index.d.ts +1 -0
  49. package/dist/utils/index.js +1 -0
  50. package/dist/utils/markdown.d.ts +40 -0
  51. package/dist/utils/markdown.js +165 -0
  52. package/package.json +45 -23
  53. package/COMPONENTS.md +0 -365
  54. package/COVERAGE_REPORT.md +0 -663
  55. package/SEARCH_VERIFICATION.md +0 -229
  56. package/TEST_SUMMARY.md +0 -344
  57. package/bin/init.js +0 -821
  58. package/docs/COMPONENT_LIBRARY_INTEGRATION_REPORT.md +0 -153
  59. package/docs/DARK_MODE_AUDIT_REPORT.md +0 -403
  60. package/docs/E2E_TESTS.md +0 -354
  61. package/docs/TESTING.md +0 -754
  62. package/docs/THEME_INHERITANCE.md +0 -192
  63. package/docs/de/index.md +0 -41
  64. package/docs/en/COMPONENTS.md +0 -443
  65. package/docs/en/api/examples.md +0 -100
  66. package/docs/en/api/overview.md +0 -69
  67. package/docs/en/components/index.md +0 -622
  68. package/docs/en/config/navigation.md +0 -505
  69. package/docs/en/config/theme-and-colors.md +0 -395
  70. package/docs/en/getting-started/integration.md +0 -406
  71. package/docs/en/guides/common-setups.md +0 -651
  72. package/docs/en/index.md +0 -243
  73. package/docs/en/markdown.md +0 -102
  74. package/docs/en/routing.md +0 -64
  75. package/docs/en/setup.md +0 -52
  76. package/docs/en/troubleshooting.md +0 -704
  77. package/docs/es/index.md +0 -41
  78. package/docs/fr/index.md +0 -41
  79. package/docs/ja/index.md +0 -41
  80. package/pagefind.toml +0 -8
  81. package/postcss.config.js +0 -5
  82. package/src/app.css +0 -119
  83. package/src/app.d.ts +0 -13
  84. package/src/app.html +0 -11
  85. package/src/lib/components/APITable.test.ts +0 -153
  86. package/src/lib/components/Breadcrumbs.test.ts +0 -148
  87. package/src/lib/components/Callout.test.ts +0 -100
  88. package/src/lib/components/CodeBlock.test.ts +0 -133
  89. package/src/lib/components/Image.test.ts +0 -163
  90. package/src/lib/components/Sidebar.svelte +0 -110
  91. package/src/lib/components/Tabs.test.ts +0 -102
  92. package/src/lib/config.test.ts +0 -140
  93. package/src/lib/config.ts +0 -179
  94. package/src/lib/configIntegration.test.ts +0 -272
  95. package/src/lib/configLoader.ts +0 -231
  96. package/src/lib/configParser.test.ts +0 -217
  97. package/src/lib/configParser.ts +0 -234
  98. package/src/lib/index.ts +0 -37
  99. package/src/lib/integration.test.ts +0 -426
  100. package/src/lib/navigationBuilder.test.ts +0 -338
  101. package/src/lib/navigationBuilder.ts +0 -268
  102. package/src/lib/performance.test.ts +0 -369
  103. package/src/lib/routing.test.ts +0 -202
  104. package/src/lib/routing.ts +0 -127
  105. package/src/lib/search-functionality.test.ts +0 -493
  106. package/src/lib/stores/i18n.test.ts +0 -180
  107. package/src/lib/stores/i18n.ts +0 -143
  108. package/src/lib/stores/nav.ts +0 -36
  109. package/src/lib/stores/search.test.ts +0 -140
  110. package/src/lib/stores/search.ts +0 -162
  111. package/src/lib/stores/theme.test.ts +0 -117
  112. package/src/lib/stores/theme.ts +0 -167
  113. package/src/lib/stores/version.test.ts +0 -139
  114. package/src/lib/stores/version.ts +0 -111
  115. package/src/lib/themeCustomization.test.ts +0 -223
  116. package/src/lib/themeCustomization.ts +0 -212
  117. package/src/lib/utils/highlight.test.ts +0 -136
  118. package/src/lib/utils/highlight.ts +0 -100
  119. package/src/lib/utils/index.ts +0 -7
  120. package/src/lib/utils/markdown.test.ts +0 -357
  121. package/src/lib/utils/markdown.ts +0 -77
  122. package/src/routes/+layout.server.ts +0 -1
  123. package/src/routes/+layout.svelte +0 -29
  124. package/src/routes/+page.svelte +0 -165
  125. package/src/routes/quote-demo/+page.svelte +0 -141
  126. package/static/robots.txt +0 -3
  127. package/svelte.config.js +0 -15
  128. package/tailwind.config.ts +0 -55
  129. package/template-starter/.github/workflows/build.yml +0 -40
  130. package/template-starter/.github/workflows/deploy-github-pages.yml +0 -47
  131. package/template-starter/.github/workflows/deploy-netlify.yml +0 -41
  132. package/template-starter/.github/workflows/deploy-vercel.yml +0 -64
  133. package/template-starter/NPM-PACKAGE-SETUP.md +0 -233
  134. package/template-starter/README.md +0 -320
  135. package/template-starter/docs/_config.json +0 -39
  136. package/template-starter/docs/api/components.md +0 -257
  137. package/template-starter/docs/api/overview.md +0 -169
  138. package/template-starter/docs/guides/configuration.md +0 -145
  139. package/template-starter/docs/guides/github-pages-deployment.md +0 -254
  140. package/template-starter/docs/guides/netlify-deployment.md +0 -159
  141. package/template-starter/docs/guides/vercel-deployment.md +0 -131
  142. package/template-starter/docs/index.md +0 -49
  143. package/template-starter/docs/setup.md +0 -149
  144. package/template-starter/package.json +0 -31
  145. package/template-starter/pagefind.toml +0 -3
  146. package/template-starter/postcss.config.js +0 -5
  147. package/template-starter/src/app.css +0 -34
  148. package/template-starter/src/app.d.ts +0 -13
  149. package/template-starter/src/app.html +0 -11
  150. package/template-starter/src/lib/components/APITable.svelte +0 -120
  151. package/template-starter/src/lib/components/APITable.test.ts +0 -96
  152. package/template-starter/src/lib/components/Breadcrumbs.svelte +0 -85
  153. package/template-starter/src/lib/components/Breadcrumbs.test.ts +0 -82
  154. package/template-starter/src/lib/components/Callout.svelte +0 -60
  155. package/template-starter/src/lib/components/Callout.test.ts +0 -91
  156. package/template-starter/src/lib/components/CodeBlock.svelte +0 -68
  157. package/template-starter/src/lib/components/CodeBlock.test.ts +0 -62
  158. package/template-starter/src/lib/components/DocLayout.svelte +0 -84
  159. package/template-starter/src/lib/components/Footer.svelte +0 -78
  160. package/template-starter/src/lib/components/Image.svelte +0 -100
  161. package/template-starter/src/lib/components/Image.test.ts +0 -81
  162. package/template-starter/src/lib/components/Navbar.svelte +0 -141
  163. package/template-starter/src/lib/components/Search.svelte +0 -248
  164. package/template-starter/src/lib/components/Tabs.svelte +0 -48
  165. package/template-starter/src/lib/components/Tabs.test.ts +0 -89
  166. package/template-starter/src/routes/+layout.svelte +0 -28
  167. package/template-starter/src/routes/+page.svelte +0 -92
  168. package/template-starter/svelte.config.js +0 -17
  169. package/template-starter/tailwind.config.ts +0 -17
  170. package/template-starter/tsconfig.json +0 -13
  171. package/template-starter/vite.config.ts +0 -6
  172. package/tests/e2e/example.spec.ts +0 -345
  173. package/tsconfig.json +0 -20
  174. package/vite.config.ts +0 -6
  175. package/vitest.config.ts +0 -33
  176. package/vitest.setup.ts +0 -21
  177. /package/{src/lib → dist}/assets/favicon.svg +0 -0
  178. /package/{src/lib → dist}/components/APITable.svelte +0 -0
  179. /package/{src/lib → dist}/components/Breadcrumbs.svelte +0 -0
  180. /package/{src/lib → dist}/components/Callout.svelte +0 -0
  181. /package/{src/lib → dist}/components/CodeBlock.svelte +0 -0
  182. /package/{src/lib → dist}/components/Footer.svelte +0 -0
  183. /package/{src/lib → dist}/components/Image.svelte +0 -0
  184. /package/{src/lib → dist}/components/Tabs.svelte +0 -0
  185. /package/{src/lib → dist}/svelte-component-library.d.ts +0 -0
@@ -1,192 +0,0 @@
1
- # Theme Inheritance from Parent App
2
-
3
- ## Overview
4
-
5
- The svelte-docs-system automatically inherits the theme (light/dark mode) from its parent application when embedded, eliminating the need for separate theme management. When used standalone, it maintains its own theme preference via localStorage.
6
-
7
- ## Architecture
8
-
9
- ### Parent Theme Detection
10
-
11
- The theme store implements a multi-level fallback system to determine the active theme:
12
-
13
- 1. **Parent App Theme (when embedded)** - Checks if the docs are running inside a parent application
14
- 2. **Stored Preference** - Falls back to localStorage in standalone mode
15
- 3. **System Preference** - Uses OS-level dark mode preference if available
16
- 4. **Default** - Falls back to 'light' theme
17
-
18
- ### Detection Mechanism
19
-
20
- #### Embedded Detection
21
- ```typescript
22
- function isEmbedded(): boolean {
23
- try {
24
- return window.parent !== window && window.parent !== null;
25
- } catch {
26
- return false;
27
- }
28
- }
29
- ```
30
-
31
- Checks if `window.parent` is different from the current window, indicating the app is embedded in an iframe or similar container.
32
-
33
- #### Parent Theme Detection
34
- ```typescript
35
- function getParentTheme(): Theme | null {
36
- if (!isEmbedded()) return null;
37
-
38
- try {
39
- if (window.parent?.document?.documentElement) {
40
- const hasDarkClass =
41
- window.parent.document.documentElement.classList.contains('dark');
42
- return hasDarkClass ? 'dark' : 'light';
43
- }
44
- } catch (e) {
45
- // Cross-origin errors are silently handled
46
- }
47
-
48
- return null;
49
- }
50
- ```
51
-
52
- The parent app must apply the `dark` class to its `document.documentElement` when dark mode is active. This is the standard pattern used by Tailwind CSS and similar frameworks.
53
-
54
- ### Reactive Synchronization
55
-
56
- When embedded, the store sets up a MutationObserver to watch the parent's `document.documentElement` for class changes:
57
-
58
- ```typescript
59
- const observer = new MutationObserver((mutations) => {
60
- mutations.forEach((mutation) => {
61
- if (
62
- mutation.type === 'attributes' &&
63
- mutation.attributeName === 'class' &&
64
- mutation.target === window.parent?.document?.documentElement
65
- ) {
66
- // Parent's dark class changed, update our theme
67
- const parentTheme = getParentTheme();
68
- if (parentTheme) {
69
- applyTheme(parentTheme);
70
- set(parentTheme);
71
- }
72
- }
73
- });
74
- });
75
- ```
76
-
77
- This ensures that when the parent app changes themes, the embedded docs automatically update.
78
-
79
- ## Implementation Details
80
-
81
- ### Parent App Requirements
82
-
83
- For the docs to detect and inherit the parent's theme, the parent application must:
84
-
85
- 1. **Add/remove the `dark` class** on `document.documentElement`
86
- ```javascript
87
- // When switching to dark mode:
88
- document.documentElement.classList.add('dark');
89
-
90
- // When switching to light mode:
91
- document.documentElement.classList.remove('dark');
92
- ```
93
-
94
- 2. **Be on the same origin** (or use postMessage for cross-origin scenarios)
95
-
96
- ### Standalone Mode
97
-
98
- When the docs are not embedded in a parent application:
99
-
100
- - Theme preference is saved to `localStorage` with key `'theme'`
101
- - User can toggle theme with the theme button in the navbar
102
- - Theme persists across page reloads
103
- - Falls back to system preference if no localStorage preference exists
104
-
105
- ### Embedded Mode
106
-
107
- When the docs are embedded in a parent application:
108
-
109
- - **Theme is read-only** from the parent's perspective
110
- - The theme toggle button will still work but updates only the local document
111
- - localStorage is NOT used (avoids conflicts with parent app)
112
- - Automatically syncs with parent app theme changes
113
- - Gracefully handles cross-origin access restrictions
114
-
115
- ## Error Handling
116
-
117
- The implementation is defensive and handles various edge cases:
118
-
119
- - **Cross-origin iframes** - Silently falls back to system preference when parent document is inaccessible
120
- - **Missing localStorage** - Uses optional chaining and try-catch blocks
121
- - **SSR environments** - Returns 'light' theme as default when window is undefined
122
- - **Null/undefined checks** - Uses optional chaining throughout
123
-
124
- ## Testing
125
-
126
- The theme store includes comprehensive unit tests:
127
-
128
- - Theme initialization with various scenarios
129
- - Theme set/toggle operations
130
- - Dark class application to document
131
- - localStorage persistence in standalone mode
132
- - Reactive updates based on store changes
133
-
134
- Run tests with:
135
- ```bash
136
- npm test -- src/lib/stores/theme.test.ts
137
- ```
138
-
139
- ## Example Integration
140
-
141
- ### Parent App (system-db-dashboard)
142
-
143
- ```typescript
144
- // In the parent app's theme store
145
- const { subscribe, set } = writable<Theme>(getInitialTheme());
146
-
147
- const setTheme = (theme: Theme) => {
148
- if (theme === 'dark') {
149
- document.documentElement.classList.add('dark');
150
- } else {
151
- document.documentElement.classList.remove('dark');
152
- }
153
- set(theme);
154
- };
155
- ```
156
-
157
- ### Embedded Docs
158
-
159
- The docs automatically detect and use the parent's theme without any additional configuration.
160
-
161
- ## CSS Classes
162
-
163
- The theme uses the standard Tailwind CSS dark mode convention:
164
-
165
- - Light mode: No `dark` class
166
- - Dark mode: `dark` class on `html` element (document.documentElement)
167
-
168
- All styles use the `dark:` variant for dark mode:
169
- ```css
170
- .text-light-color {
171
- @apply text-black dark:text-white;
172
- }
173
- ```
174
-
175
- ## Future Enhancements
176
-
177
- Potential improvements for cross-origin scenarios:
178
-
179
- 1. **PostMessage API** - Use window.parent.postMessage for cross-origin theme sync
180
- 2. **Custom Events** - Emit/listen for custom theme change events
181
- 3. **CSS Custom Properties** - Share theme colors via CSS variables instead of class names
182
-
183
- ## Migration Guide
184
-
185
- If updating from the old theme system:
186
-
187
- 1. The theme store API remains the same (`theme.set()`, `theme.toggle()`, `theme.subscribe()`)
188
- 2. localStorage key is still `'theme'`
189
- 3. Dark mode still uses the `dark` class on `document.documentElement`
190
- 4. No changes needed in components using the theme store
191
-
192
- The new parent detection is completely transparent to existing code.
package/docs/de/index.md DELETED
@@ -1,41 +0,0 @@
1
- ---
2
- title: Dokumentationsstartseite
3
- description: Willkommen beim SvelteKit-Dokumentationssystem
4
- author: Andrew
5
- date: 2026-02-05
6
- ---
7
-
8
- # Willkommen beim Dokumentationssystem
9
-
10
- Dies ist die Startseite Ihrer Dokumentationswebsite. Sie demonstriert das Markdown-Routingsystem in Aktion.
11
-
12
- ## Funktionen
13
-
14
- - **Automatisches Routing** von Markdown-Dateien
15
- - **Unterstützung verschachtelter Pfade** (Dokumente in Ordnern organisieren)
16
- - **Frontmatter-Metadaten** (Titel, Autor, Datum)
17
- - **Professionelle Formatierung** sofort einsatzbereit
18
- - **Einfach zu personalisieren** und zu erweitern
19
-
20
- ## Erste Schritte
21
-
22
- Schauen Sie sich die [Installationsanleitung](/docs/de/setup) an, um zu beginnen.
23
-
24
- ## Projektstruktur
25
-
26
- ```
27
- docs/
28
- ├── index.md (Diese Datei)
29
- ├── setup.md (Erste-Schritte-Anleitung)
30
- ├── routing.md (Funktionsweise des Routings)
31
- ├── api/
32
- │ ├── overview.md (API-Übersicht)
33
- │ └── examples.md (API-Beispiele)
34
- └── guides/
35
- └── advanced.md (Fortgeschrittene Themen)
36
- ```
37
-
38
- Jede Markdown-Datei wird automatisch zu einer Route:
39
- - `docs/setup.md` → `/docs/de/setup`
40
- - `docs/api/overview.md` → `/docs/de/api/overview`
41
- - `docs/guides/advanced.md` → `/docs/de/guides/advanced`
@@ -1,443 +0,0 @@
1
- # Core Documentation Components
2
-
3
- A collection of reusable Svelte 5 components for building beautiful, accessible documentation sites.
4
-
5
- ---
6
-
7
- ## Table of Contents
8
-
9
- 1. [Callout](#callout) - Alert boxes with variants
10
- 2. [Tabs](#tabs) - Switchable content panels
11
- 3. [CodeBlock](#codeblock) - Code display with copy button
12
- 4. [Image](#image) - Responsive images with captions
13
- 5. [APITable](#apitable) - API reference tables
14
- 6. [Breadcrumbs](#breadcrumbs) - Navigation breadcrumbs
15
-
16
- ---
17
-
18
- ## Callout
19
-
20
- **Component:** `<Callout />`
21
-
22
- Alert/notification boxes for highlighting important information.
23
-
24
- ### Props
25
-
26
- | Prop | Type | Default | Description |
27
- |------|------|---------|-------------|
28
- | `variant` | `'info' \| 'warning' \| 'success' \| 'error'` | `'info'` | Visual style variant |
29
- | `title` | `string` | `undefined` | Optional callout title |
30
- | `children` | `Snippet` | required | Content to display |
31
-
32
- ### Variants
33
-
34
- - **info** (blue) - General information and tips
35
- - **warning** (amber) - Caution messages
36
- - **success** (green) - Positive/successful messages
37
- - **error** (red) - Error or critical messages
38
-
39
- ### Usage Examples
40
-
41
- ```svelte
42
- <Callout variant="info" title="Note">
43
- This is informational content.
44
- </Callout>
45
-
46
- <Callout variant="warning" title="Warning">
47
- Be careful with this setting.
48
- </Callout>
49
-
50
- <Callout variant="success" title="Success">
51
- Operation completed successfully!
52
- </Callout>
53
-
54
- <Callout variant="error" title="Error">
55
- Something went wrong. Please try again.
56
- </Callout>
57
- ```
58
-
59
- ### Styling
60
-
61
- - Default background and border colors based on variant
62
- - Dark mode support with `dark:` classes
63
- - Font Awesome icons for visual indicators
64
- - Responsive padding and layout
65
-
66
- ---
67
-
68
- ## Tabs
69
-
70
- **Component:** `<Tabs />`
71
-
72
- Display multiple content panels with tab navigation.
73
-
74
- ### Props
75
-
76
- | Prop | Type | Default | Description |
77
- |------|------|---------|-------------|
78
- | `items` | `TabItem[]` | required | Array of tab definitions |
79
- | `defaultIndex` | `number` | `0` | Initially active tab index |
80
-
81
- ### TabItem Type
82
-
83
- ```typescript
84
- interface TabItem {
85
- label: string; // Tab button label
86
- content?: string; // HTML content (optional)
87
- }
88
- ```
89
-
90
- ### Usage Examples
91
-
92
- ```svelte
93
- <script>
94
- const tabs = [
95
- { label: 'JavaScript', content: '<code>const x = 42;</code>' },
96
- { label: 'Python', content: '<code>x = 42</code>' },
97
- { label: 'Rust', content: '<code>let x = 42;</code>' }
98
- ];
99
- </script>
100
-
101
- <Tabs items={tabs} defaultIndex={0} />
102
- ```
103
-
104
- ### Features
105
-
106
- - Click to switch between tabs
107
- - Active tab highlighting
108
- - HTML content rendering
109
- - Smooth transitions
110
- - Keyboard accessible
111
-
112
- ---
113
-
114
- ## CodeBlock
115
-
116
- **Component:** `<CodeBlock />`
117
-
118
- Display code with syntax highlighting and copy functionality.
119
-
120
- ### Props
121
-
122
- | Prop | Type | Default | Description |
123
- |------|------|---------|-------------|
124
- | `code` | `string` | required | The code content to display |
125
- | `language` | `string` | `'plaintext'` | Programming language identifier |
126
- | `filename` | `string` | `undefined` | Optional filename header |
127
-
128
- ### Usage Examples
129
-
130
- ```svelte
131
- <CodeBlock
132
- code="console.log('Hello, World!');"
133
- language="javascript"
134
- filename="hello.js"
135
- />
136
-
137
- <CodeBlock
138
- code={`function greet(name) {
139
- return \`Hello, \${name}!\`;
140
- }`}
141
- language="javascript"
142
- filename="greet.js"
143
- />
144
-
145
- <CodeBlock
146
- code="npm install @mypackage/docs"
147
- language="bash"
148
- />
149
- ```
150
-
151
- ### Features
152
-
153
- - Copy-to-clipboard button
154
- - Language label display
155
- - Optional filename header
156
- - Monospace font rendering
157
- - Dark mode support
158
- - Visual feedback on copy
159
-
160
- ---
161
-
162
- ## Image
163
-
164
- **Component:** `<Image />`
165
-
166
- Responsive images with caption and zoom functionality.
167
-
168
- ### Props
169
-
170
- | Prop | Type | Default | Description |
171
- |------|------|---------|-------------|
172
- | `src` | `string` | required | Image source URL |
173
- | `alt` | `string` | required | Alt text for accessibility |
174
- | `caption` | `string` | `undefined` | Optional image caption |
175
- | `width` | `number` | `undefined` | Image width (optional) |
176
- | `height` | `number` | `undefined` | Image height (optional) |
177
- | `zoomable` | `boolean` | `true` | Enable zoom on click |
178
-
179
- ### Usage Examples
180
-
181
- ```svelte
182
- <Image
183
- src="/path/to/image.jpg"
184
- alt="A beautiful landscape"
185
- caption="Sunset over the mountains"
186
- />
187
-
188
- <Image
189
- src="https://via.placeholder.com/600x400"
190
- alt="Placeholder"
191
- caption="This image can be zoomed"
192
- width={600}
193
- height={400}
194
- zoomable={true}
195
- />
196
-
197
- <Image
198
- src="/screenshot.png"
199
- alt="App screenshot"
200
- zoomable={false}
201
- />
202
- ```
203
-
204
- ### Features
205
-
206
- - Responsive layout
207
- - Click to zoom overlay
208
- - Figure caption support
209
- - Keyboard support (ESC to close)
210
- - Accessible markup
211
- - Image dimensions support
212
-
213
- ---
214
-
215
- ## APITable
216
-
217
- **Component:** `<APITable />`
218
-
219
- Display API reference documentation in table format.
220
-
221
- ### Props
222
-
223
- | Prop | Type | Default | Description |
224
- |------|------|---------|-------------|
225
- | `columns` | `Column[]` | required | Column definitions |
226
- | `rows` | `Row[]` | required | Table data rows |
227
- | `title` | `string` | `undefined` | Optional table title |
228
- | `description` | `string` | `undefined` | Optional description |
229
-
230
- ### Column Type
231
-
232
- ```typescript
233
- interface Column {
234
- key: string; // Data key
235
- label: string; // Column header label
236
- width?: string; // Optional CSS width
237
- }
238
- ```
239
-
240
- ### Usage Examples
241
-
242
- ```svelte
243
- <script>
244
- const columns = [
245
- { key: 'name', label: 'Parameter Name' },
246
- { key: 'type', label: 'Type' },
247
- { key: 'required', label: 'Required' },
248
- { key: 'description', label: 'Description', width: '40%' }
249
- ];
250
-
251
- const rows = [
252
- {
253
- name: 'apiKey',
254
- type: 'string',
255
- required: true,
256
- description: 'Your API authentication key'
257
- },
258
- {
259
- name: 'timeout',
260
- type: 'number',
261
- required: false,
262
- description: 'Request timeout in milliseconds'
263
- }
264
- ];
265
- </script>
266
-
267
- <APITable
268
- title="API Configuration"
269
- description="Configuration options for the API client"
270
- columns={columns}
271
- rows={rows}
272
- />
273
- ```
274
-
275
- ### Features
276
-
277
- - Sortable column layout
278
- - Alternate row colors
279
- - Boolean/null value formatting
280
- - Custom column widths
281
- - Title and description support
282
- - Empty state handling
283
- - Dark mode styling
284
-
285
- ---
286
-
287
- ## Breadcrumbs
288
-
289
- **Component:** `<Breadcrumbs />`
290
-
291
- Navigation breadcrumb trail showing current page location.
292
-
293
- ### Props
294
-
295
- | Prop | Type | Default | Description |
296
- |------|------|---------|-------------|
297
- | `items` | `BreadcrumbItem[]` | required | Breadcrumb items |
298
-
299
- ### BreadcrumbItem Type
300
-
301
- ```typescript
302
- interface BreadcrumbItem {
303
- label: string; // Display text
304
- href?: string; // Optional link URL
305
- }
306
- ```
307
-
308
- ### Usage Examples
309
-
310
- ```svelte
311
- <script>
312
- const breadcrumbs = [
313
- { label: 'Home', href: '/' },
314
- { label: 'Docs', href: '/docs' },
315
- { label: 'Components', href: '/docs/components' },
316
- { label: 'Callout' } // Current page (no href)
317
- ];
318
- </script>
319
-
320
- <Breadcrumbs items={breadcrumbs} />
321
- ```
322
-
323
- ### Features
324
-
325
- - Clickable navigation links
326
- - Chevron separators
327
- - Current page indicator
328
- - Semantic HTML (`<nav>`, `<ol>`, `<li>`)
329
- - Keyboard accessible
330
- - Dark mode support
331
- - Responsive layout
332
-
333
- ---
334
-
335
- ## Dark Mode Support
336
-
337
- All components include built-in dark mode support using Tailwind CSS `dark:` variants.
338
-
339
- To enable dark mode:
340
-
341
- ```svelte
342
- <script>
343
- import { theme } from '$lib/stores/theme';
344
- </script>
345
-
346
- <button onclick={() => theme.toggle()}>
347
- Toggle Dark Mode
348
- </button>
349
- ```
350
-
351
- ---
352
-
353
- ## Accessibility
354
-
355
- All components are built with accessibility in mind:
356
-
357
- - Semantic HTML structure
358
- - ARIA labels and roles
359
- - Keyboard navigation
360
- - Focus management
361
- - Color contrast compliance
362
- - Alt text support
363
-
364
- ---
365
-
366
- ## Installation & Export
367
-
368
- All components are exported from `$lib`:
369
-
370
- ```svelte
371
- <script>
372
- import {
373
- Callout,
374
- Tabs,
375
- CodeBlock,
376
- Image,
377
- APITable,
378
- Breadcrumbs
379
- } from '$lib';
380
- </script>
381
- ```
382
-
383
- ---
384
-
385
- ## Testing
386
-
387
- Component tests are provided in `src/lib/components/*.test.ts`:
388
-
389
- ```bash
390
- npm test # Run all tests
391
- npm run test:coverage # Generate coverage report
392
- ```
393
-
394
- ---
395
-
396
- ## Styling with Tailwind
397
-
398
- Components use Tailwind CSS for styling. Customize by editing `tailwind.config.js`:
399
-
400
- ```javascript
401
- export default {
402
- content: ['./src/**/*.{html,js,svelte,ts}'],
403
- theme: {
404
- extend: {
405
- colors: {
406
- 'doc-info': '#0ea5e9',
407
- 'doc-warning': '#f59e0b',
408
- 'doc-success': '#10b981',
409
- 'doc-error': '#ef4444',
410
- },
411
- },
412
- },
413
- };
414
- ```
415
-
416
- ---
417
-
418
- ## Performance Notes
419
-
420
- - Components are lightweight and performant
421
- - No external dependencies required
422
- - SSR compatible
423
- - Optimized bundle size
424
- - Lazy loading compatible
425
-
426
- ---
427
-
428
- ## Browser Support
429
-
430
- - Modern browsers (Chrome, Firefox, Safari, Edge)
431
- - Requires Svelte 5+
432
- - JavaScript required (but graceful degradation)
433
-
434
- ---
435
-
436
- ## License
437
-
438
- MIT - Free for personal and commercial use
439
-
440
- ---
441
-
442
- **Last Updated:** February 4, 2026
443
- **Version:** 1.0.0