ratatui/examples
Josh McKinney 728f82c084
refactor(text): replace Spans with Line (#178)
* refactor: add Line type to replace Spans

`Line` is a significantly better name over `Spans` as the plural causes
confusion and the type really is a representation of a line of text made
up of spans.

This is a backwards compatible version of the approach from
https://github.com/tui-rs-revival/ratatui/pull/175

There is a significant amount of code that uses the Spans type and
methods, so instead of just renaming it, we add a new type and replace
parameters that accepts a `Spans` with a parameter that accepts
`Into<Line>`.

Note that the examples have been intentionally left using `Spans` in
this commit to demonstrate the compiler warnings that will be emitted in
existing code.

Implementation notes:
- moves the Spans code to text::spans and publicly reexports on the text
module. This makes the test in that module only relevant to the Spans
type.
- adds a line module with a copy of the code and tests from Spans with a
single addition: `impl<'a> From<Spans<'a>> for Line<'a>`
- adds tests for `Spans` (created and checked before refactoring)
- adds the same tests for `Line`
- updates all widget methods that accept and store Spans to instead
store `Line` and accept `Into<Line>`

* refactor: move text::Masked to text::masked::Masked

Re-exports the Masked type at text::Masked

* refactor: replace Spans with Line in tests/examples/docs
2023-05-18 20:21:43 +02:00
..
demo refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00
barchart.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
block.rs feat(widget): support adding padding to Block (#20) 2023-04-27 12:30:13 +02:00
calendar.rs feat(calendar): add calendar widget (#138) 2023-04-26 23:02:35 +02:00
canvas.rs fix(canvas)!: use full block for Marker::Block (#133) 2023-04-15 17:40:28 +02:00
chart.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
custom_widget.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
gauge.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
inline.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00
layout.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
list.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00
panic.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00
paragraph.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00
popup.rs fix(examples): update input in examples to only use press events (#129) 2023-04-13 22:21:35 +02:00
sparkline.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
table.rs fix(examples): update input in examples to only use press events (#129) 2023-04-13 22:21:35 +02:00
tabs.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00
user_input.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00