sdocs 0.0.43 → 0.0.44

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 (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +55 -66
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.0.44] - 2026-07-04
11
+
12
+ ### Changed
13
+
14
+ - The README documents the block format — the npm listing previously showed
15
+ the retired `export const meta` convention.
16
+
10
17
  ## [0.0.43] - 2026-07-04
11
18
 
12
19
  ### Added
package/README.md CHANGED
@@ -96,93 +96,80 @@ That's it — your docs page lives at `/docs` inside your existing app.
96
96
 
97
97
  ## Writing Docs
98
98
 
99
- sdocs supports three types of doc files:
99
+ A `.sdoc` file is `<script>` at the top, entity blocks in the middle, and an
100
+ optional `<style>` at the bottom. Every entity is its own sidebar entry, so
101
+ one file can hold several.
100
102
 
101
- ### Component Docs (`.sdoc`)
103
+ ### Component docs `[DOCS]`
102
104
 
103
- Document a Svelte component with interactive controls and examples.
104
-
105
- ```svelte
106
- <!-- Button.sdoc -->
105
+ ```sdoc
107
106
  <script lang="ts">
108
- import Button from './Button.svelte';
109
-
110
- export const meta = {
111
- component: Button,
112
- title: 'Components / Button',
113
- description: 'A flexible button component.',
114
- args: {
115
- label: 'Click me',
116
- size: 'md',
117
- disabled: false,
118
- },
119
- };
107
+ import Button from './Button.svelte';
120
108
  </script>
121
109
 
122
- {#snippet Default()}
123
- <Button {...args} />
124
- {/snippet}
110
+ [DOCS title="Components / Button" description="A flexible button component."]
111
+
112
+ [preview component={Button} args={{ label: 'Click me', disabled: false }}]
113
+ <Button {...args} />
114
+ [/preview]
125
115
 
126
- {#snippet WithIcon()}
127
- <Button>
128
- <Icon name="settings" /> Settings
129
- </Button>
130
- {/snippet}
116
+ [example title="With icon"]
117
+ <Button><Icon name="settings" /> Settings</Button>
118
+ [/example]
119
+
120
+ [/DOCS]
131
121
  ```
132
122
 
133
- - **`component`** — the Svelte component to document (auto-extracts props, events, snippets, methods, state, CSS custom properties)
134
- - **`title`** slash-separated path for sidebar navigation (e.g. `'Components / Button'`)
135
- - **`args`** — default prop values, used as initial values for interactive controls
136
- - **`Default` snippet** gets live interactive controls. Auto-generated as `<Component {...args} />` if omitted.
137
- - **Named snippets**static examples listed in the sidebar
123
+ - **`[preview]`** — a live showcase with interactive controls.
124
+ `component={X}` names the previewed component (its props, events,
125
+ snippets, methods, state, and CSS custom properties are extracted
126
+ automatically) and `args` sets the control defaults. A `[DOCS]` block can
127
+ hold several previewsthey render as tabs, each fully live.
128
+ - **`[example]`** — frozen showcases rendered exactly as written, shown
129
+ below the preview area. Each needs a unique `title`.
130
+ - **`title`** — slash-separated path for sidebar navigation.
138
131
 
139
- ### Page Docs (`.page.sdoc`)
132
+ ### Pages `[PAGE]`
140
133
 
141
- Freeform content pages with auto-generated table of contents.
134
+ Freeform markdown content with `{expression}` interpolation and Svelte
135
+ component islands; code fences are inert. The table of contents is generated
136
+ from the headings.
142
137
 
143
- ```svelte
144
- <!-- GettingStarted.page.sdoc -->
145
- <script lang="ts">
146
- export const meta = {
147
- title: 'Docs / Getting Started',
148
- description: 'How to set up sdocs.',
149
- };
150
- </script>
138
+ ```sdoc
139
+ [PAGE title="Docs / Getting Started"]
151
140
 
152
- <h1>Getting Started</h1>
153
- <p>Install sdocs and create your first doc file.</p>
141
+ ## Installation
154
142
 
155
- <h2>Installation</h2>
156
- <p>Run <code>npm install sdocs</code>...</p>
157
- ```
143
+ Run `npm install sdocs` and create your first doc file.
158
144
 
159
- Table of contents is auto-generated from `<h2>`, `<h3>`, and `<h4>` headings.
145
+ [/PAGE]
146
+ ```
160
147
 
161
- ### Layout Docs (`.layout.sdoc`)
148
+ ### Layouts `[LAYOUT]`
162
149
 
163
- Component compositions rendered in an isolated iframe.
150
+ Full-page component compositions rendered on an isolated stage.
164
151
 
165
- ```svelte
166
- <!-- LoginForm.layout.sdoc -->
152
+ ```sdoc
167
153
  <script lang="ts">
168
- import Card from './Card.svelte';
169
- import Input from './Input.svelte';
170
- import Button from './Button.svelte';
171
-
172
- export const meta = {
173
- title: 'Patterns / Login Form',
174
- description: 'A login form combining multiple components.',
175
- settings: { padding: '24px' },
176
- };
154
+ import Card from './Card.svelte';
155
+ import Input from './Input.svelte';
156
+ import Button from './Button.svelte';
177
157
  </script>
178
158
 
179
- <Card padding="24px">
180
- <Input label="Email" type="email" />
181
- <Input label="Password" type="password" />
182
- <Button>Sign in</Button>
183
- </Card>
159
+ [LAYOUT title="Patterns / Login Form" padding="24px"]
160
+
161
+ <Card padding="24px">
162
+ <Input label="Email" type="email" />
163
+ <Input label="Password" type="password" />
164
+ <Button>Sign in</Button>
165
+ </Card>
166
+
167
+ [/LAYOUT]
184
168
  ```
185
169
 
170
+ The full language reference lives at
171
+ [gabilungu.github.io/sdocs/language](https://gabilungu.github.io/sdocs/language).
172
+
186
173
  ## Prop Extraction
187
174
 
188
175
  sdocs automatically extracts from your Svelte components:
@@ -200,7 +187,7 @@ JSDoc comments on props are picked up as descriptions.
200
187
 
201
188
  ## Interactive Controls
202
189
 
203
- The Default snippet gets live controls based on prop types:
190
+ Each preview gets live controls based on prop types:
204
191
 
205
192
  | Prop Type | Control |
206
193
  |-----------|---------|
@@ -275,6 +262,8 @@ sidebar: {
275
262
  | `sdocs/vite` | Vite plugin function |
276
263
  | `sdocs/explorer` | Explorer.svelte UI component |
277
264
  | `sdocs/ui` | Reusable UI components (Button, Frame, Icon, Control, NavTree, Stack) |
265
+ | `sdocs/language` | The sdoc scanner, parser, and Svelte projection |
266
+ | `sdocs/grammar/sdoc.tmLanguage.json` | TextMate grammar for editors and highlighters |
278
267
 
279
268
  ## License
280
269
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdocs",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "description": "A lightweight documentation tool for Svelte 5 components",
5
5
  "type": "module",
6
6
  "license": "MIT",