You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
- Replace 370-line switch statement in `renderMacro()` with
`getMacro()`/`isSubMacro()` registry lookups (render.tsx: 627→258 lines)
- Each of 34 macro components self-registers via `registerMacro()` at
module level
- Sub-macros (`option`, `case`, `default`, `next`) registered via
`registerSubMacro()`
- `MacroProps` extended with `children?: ASTNode[]` and `branches?:
Branch[]` to cover all macro prop shapes
- New `src/macros/register-builtins.ts` import manifest triggers all
registrations
- Updated custom macro docs to reflect new `children` type (raw AST
nodes instead of pre-rendered)
Closes#21
## Test plan
- [x] `npx tsc --noEmit` passes
- [x] `npx vitest run` — all 656 tests pass
- [x] `npm run test:e2e` — all 177 e2e tests pass
- [x] Every case from old switch has a corresponding `registerMacro()`
call
- [x] All sub-macro names have `registerSubMacro()` calls
release-npm
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|`rawArgs`|`string`| The raw argument string after the macro name, e.g. `"$x + 1"` in `{mymacro $x + 1}`|
33
+
|`className`|`string \| undefined`| CSS class from selector syntax: `{.highlight mymacro}`|
34
+
|`id`|`string \| undefined`| CSS id from selector syntax: `{#foo mymacro}`|
35
+
|`children`|`ASTNode[] \| undefined`| Raw AST child nodes (for block macros with `{/mymacro}`). Render with `renderNodes(children)` or `renderInlineNodes(children)`. |
36
+
|`branches`|`Branch[] \| undefined`| Branch nodes from sub-macros like `{case}`, `{default}`, `{next}`. Only present for macros that define branching sub-macros. |
36
37
37
38
## Reading State
38
39
@@ -114,7 +115,9 @@ function MyButton({ rawArgs, children }) {
0 commit comments