@spaethtech/svelte-ui 0.1.10 → 0.3.1-dev.10.ff03a8d
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/.claude/skills/svelte-ui/SKILL.md +118 -0
- package/.claude/skills/themes/SKILL.md +303 -0
- package/CLAUDE.md +248 -0
- package/README.md +180 -42
- package/dist/components/Alert.svelte +119 -0
- package/dist/components/Alert.svelte.d.ts +29 -0
- package/dist/components/Badge/Badge.svelte +142 -69
- package/dist/components/Badge/Badge.svelte.d.ts +26 -6
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Banner.svelte +133 -0
- package/dist/components/Banner.svelte.d.ts +31 -0
- package/dist/components/Button.svelte +240 -0
- package/dist/components/Button.svelte.d.ts +33 -0
- package/dist/components/ButtonDropdown.svelte +145 -0
- package/dist/components/ButtonDropdown.svelte.d.ts +31 -0
- package/dist/components/Calendar.svelte +259 -0
- package/dist/components/Calendar.svelte.d.ts +27 -0
- package/dist/components/Card.svelte +79 -0
- package/dist/components/Card.svelte.d.ts +17 -0
- package/dist/components/CardBody.svelte +41 -0
- package/dist/components/CardBody.svelte.d.ts +17 -0
- package/dist/components/CardFooter.svelte +51 -0
- package/dist/components/CardFooter.svelte.d.ts +16 -0
- package/dist/components/CardHeader.svelte +51 -0
- package/dist/components/CardHeader.svelte.d.ts +16 -0
- package/dist/components/Checkbox.svelte +131 -0
- package/dist/components/Checkbox.svelte.d.ts +16 -0
- package/dist/components/ConfirmDialog.svelte +103 -0
- package/dist/components/ConfirmDialog.svelte.d.ts +33 -0
- package/dist/components/DataTable.svelte +518 -0
- package/dist/components/DataTable.svelte.d.ts +74 -0
- package/dist/components/DatePicker.svelte +312 -0
- package/dist/components/DatePicker.svelte.d.ts +32 -0
- package/dist/components/DateTimeInput.svelte +93 -0
- package/dist/components/DateTimeInput.svelte.d.ts +20 -0
- package/dist/components/Dialog.svelte +151 -0
- package/dist/components/Dialog.svelte.d.ts +30 -0
- package/dist/components/{EmailInput/EmailInput.svelte → EmailInput.svelte} +17 -8
- package/dist/components/EmailInput.svelte.d.ts +21 -0
- package/dist/components/Input.svelte +369 -0
- package/dist/components/Input.svelte.d.ts +35 -0
- package/dist/components/{List/List.svelte → List.svelte} +194 -133
- package/dist/components/{List/List.svelte.d.ts → List.svelte.d.ts} +9 -1
- package/dist/components/Menu.svelte +117 -0
- package/dist/components/Menu.svelte.d.ts +20 -0
- package/dist/components/NotesEditor.svelte +127 -0
- package/dist/components/NotesEditor.svelte.d.ts +17 -0
- package/dist/components/{NumberInput/NumberInput.svelte → NumberInput.svelte} +146 -105
- package/dist/components/{NumberInput/NumberInput.svelte.d.ts → NumberInput.svelte.d.ts} +11 -4
- package/dist/components/PasswordInput.svelte +52 -0
- package/dist/components/PasswordInput.svelte.d.ts +20 -0
- package/dist/components/Popup.svelte +140 -0
- package/dist/components/Popup.svelte.d.ts +31 -0
- package/dist/components/Query.svelte +284 -0
- package/dist/components/Query.svelte.d.ts +15 -0
- package/dist/components/{Rating/Rating.svelte → Rating.svelte} +19 -10
- package/dist/components/Rating.svelte.d.ts +13 -0
- package/dist/components/{SearchInput/SearchInput.svelte → SearchInput.svelte} +19 -8
- package/dist/components/{SearchInput/SearchInput.svelte.d.ts → SearchInput.svelte.d.ts} +9 -2
- package/dist/components/{Select/Select.svelte → Select.svelte} +48 -76
- package/dist/components/{Select/Select.svelte.d.ts → Select.svelte.d.ts} +11 -1
- package/dist/components/SideBarMenu/SideBarMenu.svelte +724 -0
- package/dist/components/SideBarMenu/SideBarMenu.svelte.d.ts +109 -0
- package/dist/components/SideBarMenu/index.d.ts +2 -0
- package/dist/components/SideBarMenu/index.js +1 -0
- package/dist/components/TabStrip/TabStrip.svelte +384 -0
- package/dist/components/TabStrip/TabStrip.svelte.d.ts +50 -0
- package/dist/components/TabStrip/index.d.ts +3 -0
- package/dist/components/TabStrip/index.js +2 -0
- package/dist/components/{TextArea/TextArea.svelte → TextArea.svelte} +143 -112
- package/dist/components/TextArea.svelte.d.ts +38 -0
- package/dist/components/ThemeSelector.svelte +81 -0
- package/dist/components/ThemeSelector.svelte.d.ts +10 -0
- package/dist/components/TimePicker.svelte +148 -0
- package/dist/components/TimePicker.svelte.d.ts +28 -0
- package/dist/components/TimeRangeInput.svelte +203 -0
- package/dist/components/TimeRangeInput.svelte.d.ts +29 -0
- package/dist/components/TimeSpinner.svelte +202 -0
- package/dist/components/TimeSpinner.svelte.d.ts +26 -0
- package/dist/components/Toast/Toaster.svelte +51 -0
- package/dist/components/Toast/Toaster.svelte.d.ts +12 -0
- package/dist/components/Toast/toast.svelte.d.ts +29 -0
- package/dist/components/Toast/toast.svelte.js +27 -0
- package/dist/components/Toggle.svelte +93 -0
- package/dist/components/Toggle.svelte.d.ts +15 -0
- package/dist/data/dataset.d.ts +42 -0
- package/dist/data/dataset.js +3 -0
- package/dist/data/index.d.ts +3 -0
- package/dist/data/index.js +3 -0
- package/dist/data/query/ast.d.ts +62 -0
- package/dist/data/query/ast.js +12 -0
- package/dist/data/query/index.d.ts +3 -0
- package/dist/data/query/index.js +3 -0
- package/dist/data/query/lexer.d.ts +33 -0
- package/dist/data/query/lexer.js +225 -0
- package/dist/data/query/parser.d.ts +11 -0
- package/dist/data/query/parser.js +252 -0
- package/dist/data/table/grid.svelte.d.ts +57 -0
- package/dist/data/table/grid.svelte.js +139 -0
- package/dist/data/table/index.d.ts +2 -0
- package/dist/data/table/index.js +2 -0
- package/dist/data/table/types.d.ts +79 -0
- package/dist/index.d.ts +49 -22
- package/dist/index.js +46 -21
- package/dist/positioning/anchored.d.ts +61 -0
- package/dist/positioning/anchored.js +122 -0
- package/dist/positioning/tooltip.d.ts +41 -0
- package/dist/positioning/tooltip.js +147 -0
- package/dist/theme.css +205 -0
- package/dist/types/breakpoints.d.ts +24 -0
- package/dist/types/breakpoints.js +13 -0
- package/dist/types/responsive.d.ts +32 -0
- package/dist/types/responsive.js +54 -0
- package/dist/types/sizes.d.ts +10 -3
- package/dist/types/time.d.ts +19 -0
- package/dist/types/time.js +10 -0
- package/dist/types/variants.d.ts +8 -1
- package/dist/types/variants.js +16 -1
- package/docs/components.md +255 -0
- package/docs/examples.md +323 -0
- package/docs/paradigm.md +240 -0
- package/docs/themes.md +170 -0
- package/docs/usage.md +450 -0
- package/package.json +97 -63
- package/dist/components/Button/Button.svelte +0 -172
- package/dist/components/Button/Button.svelte.d.ts +0 -32
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Button/index.js +0 -1
- package/dist/components/Dialog/Dialog.svelte +0 -101
- package/dist/components/Dialog/Dialog.svelte.d.ts +0 -18
- package/dist/components/Dialog/index.d.ts +0 -1
- package/dist/components/Dialog/index.js +0 -1
- package/dist/components/ElementManager/ElementManager.svelte +0 -397
- package/dist/components/ElementManager/ElementManager.svelte.d.ts +0 -43
- package/dist/components/ElementManager/index.d.ts +0 -1
- package/dist/components/ElementManager/index.js +0 -1
- package/dist/components/EmailInput/EmailInput.svelte.d.ts +0 -14
- package/dist/components/EmailInput/index.d.ts +0 -1
- package/dist/components/EmailInput/index.js +0 -1
- package/dist/components/Icon/Icon.svelte +0 -74
- package/dist/components/Icon/Icon.svelte.d.ts +0 -13
- package/dist/components/Icon/index.d.ts +0 -1
- package/dist/components/Icon/index.js +0 -1
- package/dist/components/Input/Input.svelte +0 -268
- package/dist/components/Input/Input.svelte.d.ts +0 -18
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Input/index.js +0 -1
- package/dist/components/List/index.d.ts +0 -1
- package/dist/components/List/index.js +0 -1
- package/dist/components/ListItem/ListItem.svelte +0 -175
- package/dist/components/ListItem/ListItem.svelte.d.ts +0 -24
- package/dist/components/ListItem/index.d.ts +0 -2
- package/dist/components/ListItem/index.js +0 -2
- package/dist/components/ListView/ListView.svelte +0 -463
- package/dist/components/ListView/ListView.svelte.d.ts +0 -37
- package/dist/components/ListView/index.d.ts +0 -2
- package/dist/components/ListView/index.js +0 -2
- package/dist/components/NodeGraph/BaseNode.d.ts +0 -57
- package/dist/components/NodeGraph/BaseNode.js +0 -30
- package/dist/components/NodeGraph/Edge.svelte +0 -60
- package/dist/components/NodeGraph/Edge.svelte.d.ts +0 -16
- package/dist/components/NodeGraph/ExpressionEvaluator.d.ts +0 -82
- package/dist/components/NodeGraph/ExpressionEvaluator.js +0 -152
- package/dist/components/NodeGraph/Node.svelte +0 -100
- package/dist/components/NodeGraph/Node.svelte.d.ts +0 -10
- package/dist/components/NodeGraph/NodeGraph.svelte +0 -52
- package/dist/components/NodeGraph/NodeGraph.svelte.d.ts +0 -14
- package/dist/components/NodeGraph/NodeInstance.svelte.d.ts +0 -80
- package/dist/components/NodeGraph/NodeInstance.svelte.js +0 -241
- package/dist/components/NodeGraph/NodePort.svelte +0 -75
- package/dist/components/NodeGraph/NodePort.svelte.d.ts +0 -11
- package/dist/components/NodeGraph/decorators.d.ts +0 -81
- package/dist/components/NodeGraph/decorators.js +0 -148
- package/dist/components/NodeGraph/index.d.ts +0 -9
- package/dist/components/NodeGraph/index.js +0 -9
- package/dist/components/NodeGraph/types.d.ts +0 -94
- package/dist/components/NodeGraph/types.js +0 -33
- package/dist/components/NotesEditor/NotesEditor.svelte +0 -203
- package/dist/components/NotesEditor/NotesEditor.svelte.d.ts +0 -9
- package/dist/components/NotesEditor/index.d.ts +0 -1
- package/dist/components/NotesEditor/index.js +0 -1
- package/dist/components/NumberInput/index.d.ts +0 -1
- package/dist/components/NumberInput/index.js +0 -1
- package/dist/components/PasswordInput/PasswordInput.svelte +0 -41
- package/dist/components/PasswordInput/PasswordInput.svelte.d.ts +0 -13
- package/dist/components/PasswordInput/index.d.ts +0 -1
- package/dist/components/PasswordInput/index.js +0 -1
- package/dist/components/Popup/index.d.ts +0 -1
- package/dist/components/Popup/index.js +0 -1
- package/dist/components/Rating/Rating.svelte.d.ts +0 -7
- package/dist/components/Rating/index.d.ts +0 -1
- package/dist/components/Rating/index.js +0 -1
- package/dist/components/ScrollView/ScrollView.svelte +0 -285
- package/dist/components/ScrollView/ScrollView.svelte.d.ts +0 -19
- package/dist/components/ScrollView/index.d.ts +0 -1
- package/dist/components/ScrollView/index.js +0 -1
- package/dist/components/SearchInput/index.d.ts +0 -1
- package/dist/components/SearchInput/index.js +0 -1
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Select/index.js +0 -1
- package/dist/components/TextArea/TextArea.svelte.d.ts +0 -19
- package/dist/components/TextArea/index.d.ts +0 -1
- package/dist/components/TextArea/index.js +0 -1
- package/dist/components/ThemeSelector/ThemeSelector.svelte +0 -64
- package/dist/components/ThemeSelector/ThemeSelector.svelte.d.ts +0 -3
- package/dist/components/ThemeSelector/index.d.ts +0 -1
- package/dist/components/ThemeSelector/index.js +0 -1
- package/dist/components/TooltipHandler/TooltipHandler.svelte +0 -593
- package/dist/components/TooltipHandler/TooltipHandler.svelte.d.ts +0 -10
- package/dist/components/TooltipHandler/index.d.ts +0 -1
- package/dist/components/TooltipHandler/index.js +0 -1
- package/dist/styles/sizes.d.ts +0 -78
- package/dist/styles/sizes.js +0 -120
- package/dist/styles/variants.d.ts +0 -106
- package/dist/styles/variants.js +0 -194
- package/dist/types/ManagerTypes.d.ts +0 -42
- /package/dist/{types/ManagerTypes.js → data/table/types.js} +0 -0
package/docs/examples.md
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Demo Page Standards
|
|
2
|
+
|
|
3
|
+
This document defines the unified format for all component demo pages in the svelte-ui library.
|
|
4
|
+
The live demo runs at **http://localhost:5173** (`npm run dev`).
|
|
5
|
+
|
|
6
|
+
## Current State Analysis
|
|
7
|
+
|
|
8
|
+
### Consistent Elements Found:
|
|
9
|
+
|
|
10
|
+
- **Back navigation** - Button linking to main page
|
|
11
|
+
- **Theme selector** - ThemeSelector component in header
|
|
12
|
+
- **Component sections** - Grouped examples (variants, sizes, states)
|
|
13
|
+
- **Code examples** - TextArea components showing code snippets
|
|
14
|
+
|
|
15
|
+
### Inconsistencies Found:
|
|
16
|
+
|
|
17
|
+
- **Import patterns** - Mixed usage of imports
|
|
18
|
+
- **Layout structure** - Different container classes and layouts
|
|
19
|
+
- **Header positioning** - Theme selector and back button placement varies
|
|
20
|
+
- **Section organization** - Inconsistent section naming and ordering
|
|
21
|
+
- **Code formatting** - Different TextArea configurations
|
|
22
|
+
- **Missing elements** - Some pages lack back buttons or theme selectors
|
|
23
|
+
|
|
24
|
+
## Standard Template
|
|
25
|
+
|
|
26
|
+
All demo pages should follow this structure:
|
|
27
|
+
|
|
28
|
+
### File Location
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
src/routes/[component-name]/+page.svelte
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Standard Template Structure
|
|
35
|
+
|
|
36
|
+
```svelte
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
// IMPORTS - Use consistent library imports
|
|
39
|
+
import { ComponentName, Button, ThemeSelector, TextArea } from "$lib/index.js";
|
|
40
|
+
// Icons are MDI via unplugin-icons — import the ones this page uses.
|
|
41
|
+
import IconArrowLeft from "~icons/mdi/arrow-left";
|
|
42
|
+
|
|
43
|
+
// DEMO STATE - Component-specific state variables
|
|
44
|
+
let demoState = $state("initial");
|
|
45
|
+
|
|
46
|
+
// DEMO DATA - Static data for examples
|
|
47
|
+
const exampleData = [
|
|
48
|
+
{ id: "1", name: "Example 1" },
|
|
49
|
+
{ id: "2", name: "Example 2" },
|
|
50
|
+
];
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<!-- PAGE CONTAINER -->
|
|
54
|
+
<div class="p-8 max-w-4xl mx-auto space-y-8">
|
|
55
|
+
<!-- HEADER -->
|
|
56
|
+
<div class="flex items-center justify-between flex-col sm:flex-row gap-4 mb-6">
|
|
57
|
+
<Button href="/" variant="ghost" text="Back to Components">
|
|
58
|
+
{#snippet icon()}<IconArrowLeft />{/snippet}
|
|
59
|
+
</Button>
|
|
60
|
+
<ThemeSelector />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<!-- PAGE TITLE -->
|
|
64
|
+
<h1 class="text-3xl font-bold mb-8">ComponentName Component</h1>
|
|
65
|
+
|
|
66
|
+
<!-- SECTION: Basic Usage -->
|
|
67
|
+
<section>
|
|
68
|
+
<h2 class="text-2xl font-semibold mb-4">Basic Usage</h2>
|
|
69
|
+
<div class="mb-6">
|
|
70
|
+
<!-- Example components -->
|
|
71
|
+
<ComponentName prop="value" />
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<TextArea
|
|
75
|
+
value={`import { ComponentName } from '@spaethtech/svelte-ui';
|
|
76
|
+
|
|
77
|
+
<ComponentName prop="value" />`}
|
|
78
|
+
readonly
|
|
79
|
+
textareaClass="font-mono text-sm"
|
|
80
|
+
/>
|
|
81
|
+
</section>
|
|
82
|
+
|
|
83
|
+
<!-- SECTION: Variants (if applicable) -->
|
|
84
|
+
<section>
|
|
85
|
+
<h2 class="text-2xl font-semibold mb-4">Variants</h2>
|
|
86
|
+
<div class="flex gap-4 flex-wrap mb-6">
|
|
87
|
+
<ComponentName variant="primary" />
|
|
88
|
+
<ComponentName variant="secondary" />
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<TextArea
|
|
92
|
+
value={`<ComponentName variant="primary" />
|
|
93
|
+
<ComponentName variant="secondary" />`}
|
|
94
|
+
readonly
|
|
95
|
+
textareaClass="font-mono text-sm"
|
|
96
|
+
/>
|
|
97
|
+
</section>
|
|
98
|
+
|
|
99
|
+
<!-- SECTION: Sizes (if applicable) -->
|
|
100
|
+
<section>
|
|
101
|
+
<h2 class="text-2xl font-semibold mb-4">Sizes</h2>
|
|
102
|
+
<div class="flex items-center gap-2 mb-6">
|
|
103
|
+
<ComponentName size="sm" />
|
|
104
|
+
<ComponentName size="md" />
|
|
105
|
+
<ComponentName size="lg" />
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<TextArea
|
|
109
|
+
value={`<ComponentName size="sm" />
|
|
110
|
+
<ComponentName size="md" />
|
|
111
|
+
<ComponentName size="lg" />`}
|
|
112
|
+
readonly
|
|
113
|
+
textareaClass="font-mono text-sm"
|
|
114
|
+
/>
|
|
115
|
+
</section>
|
|
116
|
+
|
|
117
|
+
<!-- SECTION: Interactive Examples -->
|
|
118
|
+
<section>
|
|
119
|
+
<h2 class="text-2xl font-semibold mb-4">Interactive Examples</h2>
|
|
120
|
+
<div class="mb-6">
|
|
121
|
+
<ComponentName bind:value={demoState} />
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<TextArea
|
|
125
|
+
value={`<script>
|
|
126
|
+
let value = $state('');
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<ComponentName bind:value />`}
|
|
130
|
+
readonly
|
|
131
|
+
textareaClass="font-mono text-sm"
|
|
132
|
+
/>
|
|
133
|
+
</section>
|
|
134
|
+
|
|
135
|
+
<!-- SECTION: Advanced Features (if applicable) -->
|
|
136
|
+
<section>
|
|
137
|
+
<h2 class="text-2xl font-semibold mb-4">Advanced Features</h2>
|
|
138
|
+
<div class="mb-6">
|
|
139
|
+
<!-- Advanced examples -->
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<TextArea value={`<!-- Advanced usage code -->`} readonly textareaClass="font-mono text-sm" />
|
|
143
|
+
</section>
|
|
144
|
+
</div>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Required Elements
|
|
148
|
+
|
|
149
|
+
### 1. Container Structure
|
|
150
|
+
|
|
151
|
+
```svelte
|
|
152
|
+
<div class="p-8 max-w-4xl mx-auto space-y-8">
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- **Padding**: `p-8` for consistent spacing
|
|
156
|
+
- **Max width**: `max-w-4xl` for readability
|
|
157
|
+
- **Centering**: `mx-auto` to center content
|
|
158
|
+
- **Spacing**: `space-y-8` between sections
|
|
159
|
+
|
|
160
|
+
### 2. Header Layout
|
|
161
|
+
|
|
162
|
+
```svelte
|
|
163
|
+
<div class="flex items-center justify-between flex-col sm:flex-row gap-4 mb-6">
|
|
164
|
+
<Button href="/" variant="ghost" text="Back to Components">
|
|
165
|
+
{#snippet icon()}<IconArrowLeft />{/snippet}
|
|
166
|
+
</Button>
|
|
167
|
+
<ThemeSelector />
|
|
168
|
+
</div>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- **Responsive**: Stacks on mobile (`flex-col sm:flex-row`)
|
|
172
|
+
- **Back button**: Links to main page with consistent styling
|
|
173
|
+
- **Theme selector**: Always in top-right area
|
|
174
|
+
|
|
175
|
+
### 3. Page Title
|
|
176
|
+
|
|
177
|
+
```svelte
|
|
178
|
+
<h1 class="text-3xl font-bold mb-8">ComponentName Component</h1>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- **Size**: `text-3xl` for prominence
|
|
182
|
+
- **Weight**: `font-bold` for emphasis
|
|
183
|
+
- **Spacing**: `mb-8` for separation
|
|
184
|
+
|
|
185
|
+
### 4. Section Structure
|
|
186
|
+
|
|
187
|
+
```svelte
|
|
188
|
+
<section>
|
|
189
|
+
<h2 class="text-2xl font-semibold mb-4">Section Name</h2>
|
|
190
|
+
<div class="mb-6">
|
|
191
|
+
<!-- Examples -->
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<TextArea value={`code example`} readonly textareaClass="font-mono text-sm" />
|
|
195
|
+
</section>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 5. Code Examples
|
|
199
|
+
|
|
200
|
+
- **Always include** corresponding code for each example
|
|
201
|
+
- **Use TextArea** component for code display
|
|
202
|
+
- **Readonly**: Always `readonly`
|
|
203
|
+
- **Styling**: `textareaClass="font-mono text-sm"`
|
|
204
|
+
- **Import format**: Use `'@spaethtech/svelte-ui'` (not internal paths)
|
|
205
|
+
|
|
206
|
+
## Standard Sections (in order)
|
|
207
|
+
|
|
208
|
+
1. **Basic Usage** - Simplest implementation
|
|
209
|
+
2. **Variants** - Different visual styles (if applicable)
|
|
210
|
+
3. **Sizes** - Different size options (if applicable)
|
|
211
|
+
4. **States** - Disabled, loading, error states (if applicable)
|
|
212
|
+
5. **Interactive Examples** - Functional examples with state
|
|
213
|
+
6. **Advanced Features** - Complex usage patterns
|
|
214
|
+
7. **Accessibility** - A11y features demonstration (if notable)
|
|
215
|
+
|
|
216
|
+
## Import Standards
|
|
217
|
+
|
|
218
|
+
### Consistent Library Imports
|
|
219
|
+
|
|
220
|
+
```svelte
|
|
221
|
+
import {(ComponentName, Button, ThemeSelector, TextArea)} from '$lib/index.js';
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### MDI Icons (unplugin-icons)
|
|
225
|
+
|
|
226
|
+
Icons are MDI components imported from `~icons/mdi/*` and rendered into a component's `icon`
|
|
227
|
+
snippet — there is no `Icon` component.
|
|
228
|
+
|
|
229
|
+
```svelte
|
|
230
|
+
import IconArrowLeft from '~icons/mdi/arrow-left'; import IconPencil from '~icons/mdi/pencil';
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Code Example Imports
|
|
234
|
+
|
|
235
|
+
In TextArea code examples, always show:
|
|
236
|
+
|
|
237
|
+
```javascript
|
|
238
|
+
import { ComponentName } from "@spaethtech/svelte-ui";
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Responsive Design
|
|
242
|
+
|
|
243
|
+
### Container Breakpoints
|
|
244
|
+
|
|
245
|
+
- **Mobile**: Full width with padding
|
|
246
|
+
- **Desktop**: Max-width container centered
|
|
247
|
+
|
|
248
|
+
### Header Layout
|
|
249
|
+
|
|
250
|
+
- **Mobile**: Stack vertically (back button top, theme selector bottom)
|
|
251
|
+
- **Desktop**: Horizontal layout (back button left, theme selector right)
|
|
252
|
+
|
|
253
|
+
### Example Layout
|
|
254
|
+
|
|
255
|
+
- **Flex wrapping**: Use `flex-wrap` for button/badge groups
|
|
256
|
+
- **Grid layouts**: Use responsive grids for complex examples
|
|
257
|
+
|
|
258
|
+
## Code Example Best Practices
|
|
259
|
+
|
|
260
|
+
### 1. Realistic Examples
|
|
261
|
+
|
|
262
|
+
- Use meaningful prop values
|
|
263
|
+
- Show practical use cases
|
|
264
|
+
- Include realistic data
|
|
265
|
+
|
|
266
|
+
### 2. Progressive Complexity
|
|
267
|
+
|
|
268
|
+
- Start with simplest usage
|
|
269
|
+
- Build up to more complex examples
|
|
270
|
+
- Show common patterns
|
|
271
|
+
|
|
272
|
+
### 3. Complete Code Snippets
|
|
273
|
+
|
|
274
|
+
- Include necessary imports
|
|
275
|
+
- Show complete functional examples
|
|
276
|
+
- Include state management when relevant
|
|
277
|
+
|
|
278
|
+
### 4. Consistent Formatting
|
|
279
|
+
|
|
280
|
+
- Use 2-space indentation
|
|
281
|
+
- Keep lines under 80 characters when possible
|
|
282
|
+
- Use clear prop names
|
|
283
|
+
|
|
284
|
+
## Component-Specific Guidelines
|
|
285
|
+
|
|
286
|
+
### Form Components
|
|
287
|
+
|
|
288
|
+
- Show validation examples
|
|
289
|
+
- Demonstrate error states
|
|
290
|
+
- Include accessibility attributes
|
|
291
|
+
|
|
292
|
+
### Interactive Components
|
|
293
|
+
|
|
294
|
+
- Show event handling
|
|
295
|
+
- Demonstrate state binding
|
|
296
|
+
- Include keyboard navigation
|
|
297
|
+
|
|
298
|
+
### Layout Components
|
|
299
|
+
|
|
300
|
+
- Show responsive behavior
|
|
301
|
+
- Demonstrate different content types
|
|
302
|
+
- Include slot usage
|
|
303
|
+
|
|
304
|
+
### Theme Integration
|
|
305
|
+
|
|
306
|
+
- Show theme-aware styling
|
|
307
|
+
- Demonstrate CSS variable usage
|
|
308
|
+
- Include light/dark mode examples
|
|
309
|
+
|
|
310
|
+
## Quality Checklist
|
|
311
|
+
|
|
312
|
+
Before considering a demo page complete:
|
|
313
|
+
|
|
314
|
+
- [ ] Header with back button and theme selector
|
|
315
|
+
- [ ] Consistent import statements
|
|
316
|
+
- [ ] All major features demonstrated
|
|
317
|
+
- [ ] Code examples for every visual example
|
|
318
|
+
- [ ] Responsive layout tested
|
|
319
|
+
- [ ] Accessibility considerations shown
|
|
320
|
+
- [ ] Error-free TypeScript
|
|
321
|
+
- [ ] Consistent styling and spacing
|
|
322
|
+
- [ ] Realistic example data
|
|
323
|
+
- [ ] Progressive complexity in examples
|
package/docs/paradigm.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Development Paradigm
|
|
2
|
+
|
|
3
|
+
This project uses **specification-driven development** (a form of behavior-driven development) where specifications are written before implementation. This paradigm ensures clear requirements, consistent implementation, and better testing.
|
|
4
|
+
|
|
5
|
+
## Workflow Overview
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph LR
|
|
9
|
+
A[Write Spec] --> B[Review & Approve]
|
|
10
|
+
B --> C[Implement Component]
|
|
11
|
+
C --> D[Validate Against Spec]
|
|
12
|
+
D --> E[Write Tests]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Interactive Commands
|
|
16
|
+
|
|
17
|
+
### `/specify <component-name>`
|
|
18
|
+
|
|
19
|
+
Creates a new component specification interactively.
|
|
20
|
+
|
|
21
|
+
- Prompts for purpose, API, behavior, etc.
|
|
22
|
+
- Generates `.spec.md` file
|
|
23
|
+
- Sets up component folder structure
|
|
24
|
+
|
|
25
|
+
### `/implement <component-name>`
|
|
26
|
+
|
|
27
|
+
Implements a component from its specification.
|
|
28
|
+
|
|
29
|
+
- Reads existing `.spec.md` file
|
|
30
|
+
- Creates Svelte component following spec
|
|
31
|
+
- Optionally creates tests and demo page
|
|
32
|
+
|
|
33
|
+
### `/validate <component-name>`
|
|
34
|
+
|
|
35
|
+
Validates implementation against specification.
|
|
36
|
+
|
|
37
|
+
- Compares implementation with spec
|
|
38
|
+
- Checks acceptance criteria
|
|
39
|
+
- Reports discrepancies
|
|
40
|
+
- Can auto-fix issues
|
|
41
|
+
|
|
42
|
+
## Manual Workflow
|
|
43
|
+
|
|
44
|
+
### 1. Write Specification
|
|
45
|
+
|
|
46
|
+
Create `src/lib/components/ComponentName/ComponentName.spec.md`:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
# Component Specification: ComponentName
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
- **Purpose**: What the component does
|
|
54
|
+
- **User Story**: As a [user], I want to [action] so that [benefit]
|
|
55
|
+
|
|
56
|
+
## API Contract
|
|
57
|
+
|
|
58
|
+
### Props
|
|
59
|
+
|
|
60
|
+
- `propName` (type, required/optional): Description
|
|
61
|
+
- Default values and constraints
|
|
62
|
+
|
|
63
|
+
### Events
|
|
64
|
+
|
|
65
|
+
- `eventName`: When triggered, payload structure
|
|
66
|
+
|
|
67
|
+
### Slots
|
|
68
|
+
|
|
69
|
+
- Slot name and purpose
|
|
70
|
+
|
|
71
|
+
## Behavior Specifications
|
|
72
|
+
|
|
73
|
+
### Visual States
|
|
74
|
+
|
|
75
|
+
- Default appearance
|
|
76
|
+
- Interactive states (hover, focus, active)
|
|
77
|
+
- Variant appearances
|
|
78
|
+
|
|
79
|
+
### User Interactions
|
|
80
|
+
|
|
81
|
+
- Click behavior
|
|
82
|
+
- Keyboard navigation
|
|
83
|
+
- Touch interactions
|
|
84
|
+
|
|
85
|
+
### Accessibility Requirements
|
|
86
|
+
|
|
87
|
+
- ARIA attributes
|
|
88
|
+
- Keyboard support
|
|
89
|
+
- Screen reader behavior
|
|
90
|
+
|
|
91
|
+
## Performance Constraints
|
|
92
|
+
|
|
93
|
+
- Bundle size limits
|
|
94
|
+
- Rendering performance
|
|
95
|
+
- Memory usage
|
|
96
|
+
|
|
97
|
+
## Edge Cases
|
|
98
|
+
|
|
99
|
+
- Empty states
|
|
100
|
+
- Error states
|
|
101
|
+
- Boundary conditions
|
|
102
|
+
|
|
103
|
+
## Acceptance Criteria
|
|
104
|
+
|
|
105
|
+
- [ ] Specific, testable requirements
|
|
106
|
+
- [ ] Each item should be verifiable
|
|
107
|
+
- [ ] Clear pass/fail conditions
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 2. Implement Component
|
|
111
|
+
|
|
112
|
+
Create `src/lib/components/ComponentName/ComponentName.svelte`:
|
|
113
|
+
|
|
114
|
+
```svelte
|
|
115
|
+
<script lang="ts">
|
|
116
|
+
// Follow the specification exactly
|
|
117
|
+
interface Props {
|
|
118
|
+
// Props as defined in spec
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let {} /* props */ : Props = $props();
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<!-- Implementation matching spec -->
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 3. Create Tests
|
|
128
|
+
|
|
129
|
+
Tests use **Playwright** (the project's test runner — `npm run test`). Create
|
|
130
|
+
`src/lib/components/ComponentName/ComponentName.test.ts`:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { test, expect } from "@playwright/test";
|
|
134
|
+
|
|
135
|
+
test.describe("ComponentName - Spec Validation", () => {
|
|
136
|
+
// Test each acceptance criterion against the rendered demo page.
|
|
137
|
+
test("meets acceptance criterion 1", async ({ page }) => {
|
|
138
|
+
await page.goto("/component-name");
|
|
139
|
+
// assertions…
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 4. Export Component
|
|
145
|
+
|
|
146
|
+
Add to `src/lib/index.ts`:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
export { default as ComponentName } from "./components/ComponentName/ComponentName.svelte";
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Component Structure
|
|
153
|
+
|
|
154
|
+
### Colocated Structure (Recommended)
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
src/lib/components/
|
|
158
|
+
└── ComponentName/
|
|
159
|
+
├── ComponentName.spec.md # Write first
|
|
160
|
+
├── ComponentName.svelte # Implement second
|
|
161
|
+
├── ComponentName.test.ts # Test third
|
|
162
|
+
└── index.ts # Export
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Benefits
|
|
166
|
+
|
|
167
|
+
1. **Clear Requirements**: Specs define exactly what to build
|
|
168
|
+
2. **Consistent Implementation**: All components follow same pattern
|
|
169
|
+
3. **Better Testing**: Tests validate against documented requirements
|
|
170
|
+
4. **Living Documentation**: Specs serve as component documentation
|
|
171
|
+
5. **Reduced Iterations**: Clear specs mean fewer revisions
|
|
172
|
+
|
|
173
|
+
## Example: Badge Component
|
|
174
|
+
|
|
175
|
+
### 1. Specification (Badge.spec.md)
|
|
176
|
+
|
|
177
|
+
```markdown
|
|
178
|
+
# Component Specification: Badge
|
|
179
|
+
|
|
180
|
+
## Overview
|
|
181
|
+
|
|
182
|
+
- **Purpose**: Display status indicators or labels
|
|
183
|
+
- **User Story**: As a developer, I want to display badges with consistent styling
|
|
184
|
+
|
|
185
|
+
## API Contract
|
|
186
|
+
|
|
187
|
+
### Props
|
|
188
|
+
|
|
189
|
+
- `text` (string, required): Display text
|
|
190
|
+
- `variant` (string, optional): Visual style
|
|
191
|
+
- `size` (string, optional): Size variant
|
|
192
|
+
- `dismissible` (boolean, optional): Show dismiss button
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 2. Implementation (Badge.svelte)
|
|
196
|
+
|
|
197
|
+
```svelte
|
|
198
|
+
<script lang="ts">
|
|
199
|
+
interface Props {
|
|
200
|
+
text: string;
|
|
201
|
+
variant?: "default" | "primary" | "success";
|
|
202
|
+
size?: "sm" | "md" | "lg";
|
|
203
|
+
dismissible?: boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let { text, variant = "default", size = "md", dismissible = false }: Props = $props();
|
|
207
|
+
</script>
|
|
208
|
+
|
|
209
|
+
<span class="badge badge-{variant} badge-{size}">
|
|
210
|
+
{text}
|
|
211
|
+
{#if dismissible}
|
|
212
|
+
<button onclick={() => dispatch("dismiss")}>×</button>
|
|
213
|
+
{/if}
|
|
214
|
+
</span>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Best Practices
|
|
218
|
+
|
|
219
|
+
1. **Write specs before code** - Never implement without a spec
|
|
220
|
+
2. **Include acceptance criteria** - Make requirements testable
|
|
221
|
+
3. **Update specs when requirements change** - Keep documentation current
|
|
222
|
+
4. **Use `/validate` after changes** - Ensure compliance
|
|
223
|
+
5. **Reference specs in PRs** - Link implementation to requirements
|
|
224
|
+
|
|
225
|
+
## Tips for Writing Good Specs
|
|
226
|
+
|
|
227
|
+
- Be specific about behavior, not implementation
|
|
228
|
+
- Include all edge cases
|
|
229
|
+
- Define clear acceptance criteria
|
|
230
|
+
- Consider accessibility from the start
|
|
231
|
+
- Think about theme compatibility
|
|
232
|
+
- Document performance requirements
|
|
233
|
+
|
|
234
|
+
## Common Pitfalls to Avoid
|
|
235
|
+
|
|
236
|
+
- Don't skip the spec phase
|
|
237
|
+
- Don't implement features not in the spec
|
|
238
|
+
- Don't modify specs after implementation (unless updating both)
|
|
239
|
+
- Don't write vague acceptance criteria
|
|
240
|
+
- Don't forget accessibility requirements
|