Skip to content

Commit 70b60f9

Browse files
committed
feat(panel-view): add typed stats, cards with titled columns, file lists, and link strips with factory methods.
1 parent 6d253a4 commit 70b60f9

48 files changed

Lines changed: 1608 additions & 1063 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## 0.1.4 Under development
8+
## 0.2.0 Under development
9+
10+
- feat(panel-view)!: add typed presenters and factory methods; remove array shapes, JSON serialization, and runtime validation.
911

1012
## 0.1.3 September 14, 2026
1113

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ replays a stored capture with no debugger host present.
153153

154154
## Presentation vocabulary
155155

156-
Five types are published: `CollectorInterface`, `Panel`, `PanelView`, `Tone`, and `ColumnStyle`. Everything a panel can
157-
display is a `PanelView` method, so there is no value class to import and no shape to build by hand.
156+
Five types are published for panel authors: `CollectorInterface`, `Panel`, `PanelView`, `Tone`, and `ColumnStyle`.
157+
Everything a panel can display is a `PanelView` method, so an extension imports no value class and builds nothing by
158+
hand.
158159

159160
```php
160161
use PHPForge\Debug\{ColumnStyle, PanelView, Tone};
@@ -175,8 +176,24 @@ PanelView::create()
175176

176177
Plain scalars and `null` become text. `PanelView::text()`, `::strong()`, `::code()`, `::preview()`, `::badge()`, and
177178
`::value()` produce validated inline values accepted wherever a scalar is accepted. Every method validates its
178-
arguments and rejects invalid input with an explicit `InvalidArgumentException`. The host reads the finished
179-
description through `summaryMetrics()`, `toolbarMetrics()`, `blocks()`, and `isActive()`.
179+
arguments and rejects invalid input with an explicit `InvalidArgumentException`.
180+
181+
The host reads the finished description through `summaryMetrics()`, `toolbarMetrics()`, `blocks()`, and `isActive()`.
182+
Those accessors return `PHPForge\Debug\Presenter` value objects: `SummaryMetric`, `ToolbarMetric`, and the blocks,
183+
entries, and inline values behind them. A renderer narrows each value with `instanceof` over the sealed `Block` and
184+
`Inline` unions, which static analysis proves exhaustive, and reads its public properties. Inline text carries a
185+
`TextStyle` case and a table carries its `ColumnStyle` cases, so semantics reach the markup without parsing strings.
186+
187+
```php
188+
use PHPForge\Debug\Presenter\{HeadingBlock, ParagraphBlock, TableBlock};
189+
190+
$html = match (true) {
191+
$block instanceof HeadingBlock => $this->heading($block->title, $block->section),
192+
$block instanceof ParagraphBlock => $this->paragraph($block->content, $block->tone),
193+
$block instanceof TableBlock => $this->table($block->headers, $block->rows, $block->styles),
194+
// one arm per block; PHPStan reports a missing arm as an unhandled match value.
195+
};
196+
```
180197

181198
## Documentation
182199

src/Exception/PanelViewMessage.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ enum PanelViewMessage: string
2727
*/
2828
case COLUMN_STYLE_KEY_INVALID = 'Debug panel column styles must be keyed by an existing column index.';
2929

30-
/**
31-
* Indicates that an entry passed to a composite block was not built by the matching factory.
32-
*
33-
* Format: "Debug panel %s entries must be built with PanelView::%s()."
34-
*/
35-
case ENTRY_INVALID = 'Debug panel %s entries must be built with PanelView::%s().';
36-
3730
/**
3831
* Indicates that an inline value is neither a scalar, `null`, nor a shape this class produces.
3932
*

0 commit comments

Comments
 (0)