Add style, font, and card example packages; extend geometry and color
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c0685fe01
commit
1e2bcde532
26 files changed
+45666
-30
No files matched your search
@@ -13,6 +13,43 @@ roadmap.
|
||||
| `experiments/gpui/geometry` | `geometry.rs`, `ContentMask` | Ported (units, Point/Size/Bounds/Edges/Corners, lengths) |
|
||||
| `experiments/gpui/color` | `color.rs` | Ported (Rgba/Hsla, hex parsing, Background) |
|
||||
| `experiments/gpui/scene` | `scene.rs`, `bounds_tree.rs` | Ported (primitives, draw ordering, layers, batching, replay) |
|
||||
| `experiments/gpui/font` | font descriptors in `text_system.rs` | Ported (`Font`, weights, styles, features, fallbacks) |
|
||||
| `experiments/gpui/style` | `style.rs`, `styled.rs`, Refineable, gpui_macros style helpers | Ported (`Style`/`StyleRefinement`, the full `Styled` fluent API) |
|
||||
|
||||
## Example
|
||||
|
||||
Nothing renders yet. `src/examples/card` resolves a style written with
|
||||
GPUI's fluent API, paints it into a `Scene` by hand, and prints the draw
|
||||
batches:
|
||||
|
||||
```sh
|
||||
moon run src/examples/card --target js
|
||||
```
|
||||
|
||||
```moonbit
|
||||
@style.StyleRefinement::new()
|
||||
.flex().flex_col().gap_2().p_4()
|
||||
.w(@geometry.px(320.0))
|
||||
.rounded_lg().border_1().border_color(@color.rgb(0xd0d7de))
|
||||
.bg(@color.rgb(0xffffff)).shadow_md()
|
||||
.text_color(@color.rgb(0x1f2328)).text_sm()
|
||||
```
|
||||
|
||||
The first example that renders in the browser comes with milestone M8; see
|
||||
the roadmap.
|
||||
|
||||
## Generated code
|
||||
|
||||
`src/style/style_generated.mbt`, `styled_generated.mbt` and
|
||||
`styled_extend_generated.mbt` are generated by `tools/gen_style.py`, which
|
||||
stands in for GPUI's Rust macros. Do not edit them by hand; change the
|
||||
script or `src/style/styled.mbt`, then run:
|
||||
|
||||
```sh
|
||||
python3 tools/gen_style.py && moon fmt
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
All packages are pure MoonBit and are tested on every backend:
|
||||
|
||||
|
||||
Reference in new issue
Block a user