···11+# Contributing to VoltX
22+33+## Documentation
44+55+### API Doc Parser Spec
66+77+- `docsCommand` currently walks every `.ts` file under `src/` and emits markdown for exported functions, interfaces, and type aliases.
88+ - Extend `parseFile` before adding new declaration shapes so documentation stays complete.
99+- When enhancing the parser:
1010+ - Normalize all leading whitespace with the `getFullText` helpers
1111+ - Prefer passing structured data (description, tags, examples) into `generateMD`.
1212+ - Avoid baking markdown formatting inside the extractor so the generator can evolve independently.
1313+- Preserve ordering: `parseFile` visits nodes in source order.
1414+ - When adding new collectors, keep this invariant so the docs mirror the file’s story.
1515+- Add unit coverage under `test/dev/docs-parser.test.ts` (or a new spec) whenever you touch comment parsing.
1616+ - Sample TS files with edge-case syntax (generics, overloads, multi-line examples) make regressions easy to catch.
1717+- After updating comments or the parser, build new API docs and inspect the refreshed files in `docs/api/` before submitting changes
1818+1919+### Writing API Documentation (TypeScript)
2020+2121+- Start each source file that ships public APIs with a `@packageDocumentation` tag
2222+ - Give a one-sentence summary on the first line, follow with paragraphs that explain when to reach for the module
2323+ - Avoid other tags in this block so `extractModDocs` can surface clean prose (see `dev/src/commands/docs.ts`).
2424+- Document every exported symbol (functions, interfaces, types, classes, consts) with a JSDoc block placed immediately above the declaration.
2525+ - Keep the first sentence under 121 characters; subsequent sentences can wrap naturally.\
2626+ - Publicly exported symbols are in entry points (`index.ts`, `debug.ts`)
2727+- Structure symbol docs as:
2828+ 1. Summary line
2929+ 2. Optional paragraphs
3030+ 3. `@remarks` for nuance
3131+ 4. Any number of `@example` blocks
3232+ - Use markdown code block syntax tagged with `ts` or `typescript`
3333+- The parser doesn't render `@param`, `@returns`, and `@throws` (as of 2025-10-20),
3434+ - Fold critical argument and return-value notes into `@remarks` or provide a short table in markdown
3535+ - When the parser gains tag support, prefer one tag per line (`@param input Signal to watch`) so it can be emitted as a definition list
3636+- Use deliberate naming in overloads and generics; the generator flattens signatures (`extractFnSig`) and shows exactly what the compiler sees.
3737+ - Keep overloads minimal and consider documenting helper types separately if they deserve their own section.
3838+3939+### Writing CSS Documentation
4040+4141+- Place JSDoc-style blocks immediately above the selector or at-rule they describe.
4242+ - The CSS parser associates the next non-empty line that opens a block with the comment so keep unrelated declarations between the comment and selector out of the way.
4343+ - See `extractCSSComments` in `dev/src/commands/css-docs.ts`
4444+- Keep comments under ~180 characters or split them into multiple sentences
4545+ - `generateSemanticsDocs` currently (2025-10-20) discards longer blobs
4646+ - Should answer:
4747+ 1. "What does this selector represent?"
4848+ 2. "Why does it exist?"
4949+- Explain theme or state-specific overrides (`@media`, `[data-variant]`, etc.) directly in the comment so the semantics page contextualizes duplicated selectors.
5050+ - For shared guidance, prefer separate comments per selector rather than trailing inline notes.
5151+- Name CSS custom properties with the established prefixes (`--color-*`, `--space-*`, `--font-*`, …).
5252+ - The generator buckets them by prefix (`categorizeCSSVar`), so consistent naming keeps the documentation grouped sensibly.
5353+- After editing CSS docs, rebuild and review `docs/css/semantics.md` for accidental duplicates or missing selectors
5454+ - Adjust comments or parser thresholds before committing if the output reads awkwardly
···11# Global State
2233-VoltX provides built-in global state management through special variables and the global store. These features enable sharing state across components, accessing metadata, and coordinating behavior without external dependencies.
33+VoltX provides built-in global state management through special variables and a globally available store.
44+These features enable sharing state across components, accessing metadata, and coordinating behavior without external dependencies.
4556## Overview
67···210211<div data-volt
211212 data-volt-state='{"initialized": false}'
212213 data-volt-init="initialized.set(true)">
213213-214214 <p data-volt-text="initialized"></p>
215215 <!-- Displays: true -->
216216</div>
···222222<div data-volt
223223 data-volt-state='{"count": 0, "log": []}'
224224 data-volt-init="$probe('count', v => log.push(v))">
225225-226225 <button data-volt-on-click="count.set(count.get() + 1)">Increment</button>
227226 <p data-volt-text="log.join(', ')"></p>
228227 <!-- Displays: "0, 1, 2, ..." -->
···236235 id="main"
237236 data-volt-state='{"rootId": ""}'
238237 data-volt-init="rootId.set($origin.id)">
239239-240238 <p data-volt-text="rootId"></p>
241239 <!-- Displays: "main" -->
242240</div>
···419417<!-- Add todo form -->
420418<div data-volt data-volt-state='{"newTodo": ""}'>
421419 <input data-volt-model="newTodo" data-volt-pin="todoInput" />
422422- <button data-volt-on-click="$store.get('todos').push({ text: newTodo.get(), done: false }); newTodo.set(''); $pins.todoInput.focus()">
420420+ <button data-volt-on-click="$store.set('todos', [...$store.get('todos'), { text: newTodo.get(), done: false }]); newTodo.set(''); $pins.todoInput.focus()">
423421 Add
424422 </button>
425423</div>
+6-7
docs/index.md
···1818 link: /api-examples
19192020features:
2121- - title: Feature A
2222- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
2323- - title: Feature B
2424- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
2525- - title: Feature C
2626- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
2121+ - title: Reactive
2222+ details: Signal-driven rendering keeps your markup in sync with data.
2323+ - title: Hypermedia Powered
2424+ details: Built-in hypermedia helpers stream link and form updates across HTTP and WebSocket transports.
2525+ - title: Expandable
2626+ details: A modular plugin system lets you ship custom bindings, transports, and diagnostics
2727---
2828-