Skip to content

Commit 6f5d702

Browse files
authored
Merge pull request #101 from ynqa/v0.17.0/dev
v0.17.0
2 parents d6fc7c7 + 433bc54 commit 6f5d702

24 files changed

Lines changed: 701 additions & 34 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
> Patch versions are not included due to maintenance cost considerations.
1111
> More detailed version tracking may be described as the project matures.
1212
13+
## [0.17.0] - Unreleased
14+
15+
### Added
16+
17+
- Added `Document::child_count(row_index)` to JSON and YAML for querying immediate container sizes independently of folding; empty containers return `Some(0)`, closing rows return their opening container's count, and non-container rows return `None`
18+
- Added optional child-count annotations for collapsed and empty JSON and YAML containers, such as `[…] (3 items)` and `{…} (2 keys)`, controlled by `show_child_count` and `child_count_style`
19+
20+
### Changed
21+
22+
- Added `child_count` to `ContainerNode::Open`; direct constructors and exhaustive patterns must account for the new field
23+
- Extended JSON and YAML `Config` with child-count settings, disabled by default; existing serialized configurations retain the previous display, and pretty-printed exports omit annotations
24+
- Updated `promkit-widgets` to `v0.10.0`
25+
26+
## [0.16.0] - 2026-09-07
27+
28+
### Added
29+
30+
- Added `Document::row_index_for_path` and `Document::move_to_path` to JSON and YAML for navigating jq-style paths, including object keys, array indices, quoted string keys, and YAML non-string scalar keys
31+
- Added zero-based document indexes to path navigation for JSON Lines and YAML document streams; moving to a path expands folded ancestors while preserving unrelated folding state
32+
- Added `Document::selected_path()` to retrieve the selected row's document index and jq-style path
33+
34+
### Changed
35+
36+
- Improved selected-path lookup with compact per-row parent and array-index metadata
37+
- Updated workspace dependencies, `promkit-core` to `v0.6.1`, and `promkit-widgets` to `v0.9.0`
38+
39+
## [0.15.0] - 2026-08-16
40+
41+
### Added
42+
43+
- Added `WidgetLayout::height_policy` with `HeightPolicy::OrderedContent`, `FairContent`, and `FairFill` for content-based allocation, equal-share limits, and padded fill areas
44+
- Added configurable text overflow through `text::config::OverflowMode`, supporting wrapping by default or truncation with an ellipsis
45+
- Added terminal regression scenarios for renderer height allocation
46+
47+
### Changed
48+
49+
- Replaced the mutating `PrefixSearch::search` API with `PrefixSearch::query`, which returns an independently selectable `PrefixSearchResult` snapshot
50+
- Changed prefix-search widget state from `State::prefix_search` to `State::result`, moving candidate selection and navigation to the result snapshot
51+
- Extracted renderer height allocation into a dedicated module; fair-content panes stay within their equal share without redistributing unused rows
52+
- Updated `promkit-core` to `v0.6.0` and `promkit-widgets` to `v0.8.0`
53+
54+
### Removed
55+
56+
- Removed the status widget and its `status` Cargo feature from `promkit` and `promkit-widgets`
57+
1358
## [0.14.0] - 2026-07-28
1459

1560
### Added
@@ -158,7 +203,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158203

159204
For versions prior to 0.10.0, please refer to the git history or GitHub releases.
160205

161-
[Unreleased]: https://github.com/ynqa/promkit/compare/v0.13.0...HEAD
206+
[Unreleased]: https://github.com/ynqa/promkit/compare/v0.16.0...HEAD
207+
[0.17.0]: https://github.com/ynqa/promkit/compare/v0.16.0...HEAD
208+
[0.16.0]: https://github.com/ynqa/promkit/releases/tag/v0.16.0
209+
[0.15.0]: https://github.com/ynqa/promkit/releases/tag/v0.15.0
210+
[0.14.0]: https://github.com/ynqa/promkit/releases/tag/v0.14.0
162211
[0.13.0]: https://github.com/ynqa/promkit/releases/tag/v0.13.0
163212
[0.12.0]: https://github.com/ynqa/promkit/releases/tag/v0.12.0
164213
[0.11.0]: https://github.com/ynqa/promkit/releases/tag/v0.11.0

‎Concept.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Applications select the capabilities and widgets they need through Cargo
154154
features. The runtime is independent from the widget set:
155155

156156
```toml
157-
promkit = { version = "0.16.0", features = [
157+
promkit = { version = "0.17.0", features = [
158158
"runtime",
159159
"validate",
160160
"prefixsearch",

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Put the package in your `Cargo.toml`.
1111

1212
```toml
1313
[dependencies]
14-
promkit = { version = "0.16.0", features = ["runtime", "texteditor"] }
14+
promkit = { version = "0.17.0", features = ["runtime", "texteditor"] }
1515
```
1616

1717
## Features

‎examples/json/src/json.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ impl JsonViewer {
104104
overflow_mode: OverflowMode::Wrap,
105105
lines: None,
106106
show_line_numbers: true,
107+
show_child_count: true,
108+
child_count_style: ContentStyle {
109+
foreground_color: Some(Color::DarkGrey),
110+
..Default::default()
111+
},
107112
},
108113
},
109114
}

‎examples/yaml/src/yaml.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ impl YamlViewer {
108108
overflow_mode: OverflowMode::Wrap,
109109
lines: None,
110110
show_line_numbers: true,
111+
show_child_count: true,
112+
child_count_style: ContentStyle {
113+
foreground_color: Some(Color::DarkGrey),
114+
..Default::default()
115+
},
111116
},
112117
},
113118
}

‎promkit-widgets/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "promkit-widgets"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2024"
55
authors = ["ynqa <un.pensiero.vano@gmail.com>"]
66
description = "Widgets for promkit"

‎promkit-widgets/README.md‎

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ using the `promkit` runtime can enable them through the main crate:
1414

1515
```toml
1616
[dependencies]
17-
promkit = { version = "0.16.0", features = ["runtime", "texteditor"] }
17+
promkit = { version = "0.17.0", features = ["runtime", "texteditor"] }
1818
```
1919

2020
The widget states can also be used directly:
2121

2222
```toml
2323
[dependencies]
24-
promkit-widgets = { version = "0.9", features = ["json", "yaml"] }
24+
promkit-widgets = { version = "0.10", features = ["json", "yaml"] }
2525
```
2626

2727
`promkit` re-exports this crate as `promkit::widgets`, while
@@ -44,6 +44,43 @@ promkit-widgets = { version = "0.9", features = ["json", "yaml"] }
4444
| `serde` | Serde support for widget configuration |
4545
| `all` | All features above |
4646

47+
## JSON and YAML child counts
48+
49+
JSON and YAML documents retain the number of immediate array/sequence elements
50+
or object/mapping entries, independently of folding. Query a container with
51+
`Document::child_count(row_index)`, using a zero-based index into `Document::rows()`.
52+
Empty containers return `Some(0)`; closing rows return the opening container's
53+
count. Scalars, YAML document separators, and invalid indices return `None`.
54+
55+
Enable annotations through the widget configuration:
56+
57+
```rust
58+
use promkit_widgets::json::{Config, Document, State};
59+
60+
let mut state = State {
61+
document: Document::from_str(r#"{"items": [1, 2, 3]}"#)?,
62+
config: Config {
63+
show_child_count: true,
64+
..Default::default()
65+
},
66+
};
67+
assert_eq!(state.document.child_count(1), Some(3));
68+
state.document.toggle_at(1);
69+
// The items row now displays: "items": […] (3 items)
70+
```
71+
72+
The same APIs are available under `promkit_widgets::yaml`. Annotations appear
73+
beside collapsed or empty containers, for example `{…} (2 keys)` and `[] (0 items)`.
74+
`show_child_count` defaults to `false`; `child_count_style` controls annotation
75+
styling. Changing these settings does not fold or expand containers. Existing
76+
`toggle()` / `toggle_at()` operations control folding. Pretty-printed data exports
77+
do not include annotations.
78+
79+
When constructing `ContainerNode::Open` directly, supply its new `child_count`
80+
field. Existing exhaustive `Open` patterns must include the field or `..`.
81+
For `Config` struct literals, use `..Default::default()` or supply the new fields;
82+
stored Serde configurations without these fields keep the default display.
83+
4784
## Responsibilities
4885

4986
Widgets manage state and project it into renderable content. They intentionally

‎promkit-widgets/benches/structured/json.rs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ fn benchmark_fixture(c: &mut Criterion, path: &Path) {
9898
});
9999
});
100100

101+
state.document.set_nodes_visibility(true);
102+
for show_child_count in [false, true] {
103+
state.config.show_child_count = show_child_count;
104+
let label = if show_child_count {
105+
"counts_visible"
106+
} else {
107+
"counts_hidden"
108+
};
109+
group.bench_function(format!("collapsed_viewport_projection/{label}"), |b| {
110+
b.iter(|| {
111+
black_box(state.create_graphemes_in_viewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT))
112+
});
113+
});
114+
}
115+
101116
group.finish();
102117
}
103118

‎promkit-widgets/benches/structured/yaml.rs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ fn benchmark_fixture(c: &mut Criterion, path: &Path) {
9898
});
9999
});
100100

101+
state.document.set_nodes_visibility(true);
102+
for show_child_count in [false, true] {
103+
state.config.show_child_count = show_child_count;
104+
let label = if show_child_count {
105+
"counts_visible"
106+
} else {
107+
"counts_hidden"
108+
};
109+
group.bench_function(format!("collapsed_viewport_projection/{label}"), |b| {
110+
b.iter(|| {
111+
black_box(state.create_graphemes_in_viewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT))
112+
});
113+
});
114+
}
115+
101116
group.finish();
102117
}
103118

0 commit comments

Comments
 (0)