config: storybook,src,package (2 files)

This commit is contained in:
Richard Ward
2025-12-30 20:53:28 +00:00
parent 15347dc2ef
commit fe17aac9d7
2 changed files with 5077 additions and 0 deletions

4999
storybook/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,78 @@
import { Meta } from '@storybook/blocks'
<Meta title="Introduction" />
# MetaBuilder Lua Package Storybook
This Storybook renders **Lua packages** from the MetaBuilder platform without running the actual application.
## How It Works
1. **Lua packages** in `/packages/*/seed/scripts/` define UI as component trees
2. **Mock data** mirrors the output structure of Lua render functions
3. **LuaPackageRenderer** converts the component tree to React components
4. **Component Registry** maps Lua type names to React implementations
## Package Structure
Each Lua package follows this structure:
```
packages/
└── {package_name}/
└── seed/
├── metadata.json # Package info
├── components.json # Component definitions
└── scripts/
├── manifest.json # Script manifest
├── init.lua # Initialization
└── *.lua # Render functions
```
## Lua Render Output
Lua render functions return component trees like:
```lua
return {
type = "Card",
props = { className = "p-4" },
children = {
{ type = "Typography", props = { variant = "h5", text = "Title" } },
{ type = "Button", props = { children = "Click Me" } }
}
}
```
## Adding New Package Mocks
1. Create a file in `src/mocks/packages/{package-name}.ts`
2. Define the `MockPackageDefinition` with metadata and renders
3. Call `registerMockPackage()` to register it
4. Import it in `src/mocks/packages/index.ts`
5. Create stories in `src/stories/`
## Available Component Types
The component registry maps these Lua types to React:
### Layout
- `Box`, `Stack`, `Flex`, `Grid`, `Container`
### Surfaces
- `Card`, `CardHeader`, `CardContent`, `CardActions`, `Paper`
### Typography
- `Typography` (with variants: h1-h6, body1, body2, caption, overline)
### Inputs
- `Button` (variants: contained, outlined, text)
### Display
- `Icon`, `Avatar`, `Badge`, `Chip`, `Divider`, `Alert`
### Navigation
- `Tabs`, `Tab`
### App-Specific
- `Level4Header`, `IntroSection`, `AppHeader`, `AppFooter`, `Sidebar`