Implement flexbox (#277)

This implement the flexbox elements, following the HTML one.

Built from them, there is also the following elements:
- `paragraph`
- `paragraphAlignLeft`
- `paragraphAlignRight`
- `paragraphAlignCenter`
- `paragraphAlignJustify`

This is a breaking change.
This commit is contained in:
Arthur Sonzogni
2021-12-11 17:58:25 +01:00
committed by GitHub
parent f7c6bf91a7
commit 602392c43d
70 changed files with 2163 additions and 300 deletions

View File

@@ -1,5 +1,5 @@
#include <stddef.h> // for size_t
#include <algorithm> // for find_if, max
#include <algorithm> // for find_if
#include <cassert> // for assert
#include <iterator> // for begin, end
#include <utility> // for move
@@ -7,7 +7,7 @@
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse, CapturedMouseInterface
#include "ftxui/component/component.hpp"
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/component_base.hpp" // for ComponentBase, Components
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, Element

View File

@@ -6,7 +6,7 @@
#include "ftxui/component/component.hpp" // for Horizontal, Vertical, Tab
#include "ftxui/component/component_base.hpp" // for Components, Component, ComponentBase
#include "ftxui/component/event.hpp" // for Event, Event::Tab, Event::TabReverse, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp
#include "ftxui/component/event.hpp" // for Event, Event::Tab, Event::TabReverse, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp, Event::End, Event::Home, Event::PageDown, Event::PageUp
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::WheelDown, Mouse::WheelUp
#include "ftxui/dom/elements.hpp" // for text, Elements, operator|, reflect, Element, hbox, vbox
#include "ftxui/screen/box.hpp" // for Box
@@ -102,11 +102,11 @@ class VerticalContainer : public ContainerBase {
if (event == Event::ArrowDown || event == Event::Character('j'))
MoveSelector(+1);
if (event == Event::PageUp) {
for(int i = 0; i<box_.y_max - box_.y_min; ++i)
for (int i = 0; i < box_.y_max - box_.y_min; ++i)
MoveSelector(-1);
}
if (event == Event::PageDown) {
for(int i = 0; i<box_.y_max - box_.y_min; ++i)
for (int i = 0; i < box_.y_max - box_.y_min; ++i)
MoveSelector(1);
}
if (event == Event::Home) {

View File

@@ -1,7 +1,7 @@
#include <cmath>
#include <memory> // for __shared_ptr_access
#include <string> // for string
#include <utility> // for move
#include <algorithm> // for max, min
#include <memory> // for __shared_ptr_access
#include <string> // for string
#include <utility> // for move
#include "ftxui/component/component.hpp" // for Maybe, Checkbox, Make, Radiobox, Vertical, Dropdown
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase

View File

@@ -6,7 +6,7 @@
#include <iostream> // for cout, ostream, basic_ostream, operator<<, endl, flush
#include <stack> // for stack
#include <thread> // for thread
#include <utility> // for move
#include <utility> // for swap, move
#include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse, CapturedMouseInterface
@@ -18,7 +18,7 @@
#include "ftxui/component/terminal_input_parser.hpp" // for TerminalInputParser
#include "ftxui/dom/node.hpp" // for Node, Render
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/terminal.hpp" // for Terminal::Dimensions, Terminal
#include "ftxui/screen/terminal.hpp" // for Size, Dimensions
#if defined(_WIN32)
#define DEFINE_CONSOLEV2_PROPERTIES
@@ -32,8 +32,8 @@
#endif
#else
#include <sys/select.h> // for select, FD_ISSET, FD_SET, FD_ZERO, fd_set
#include <termios.h> // for tcsetattr, termios, tcgetattr, TCSANOW, cc_t, ECHO, ICANON, VMIN, VTIME
#include <unistd.h> // for STDIN_FILENO, read
#include <termios.h> // for tcsetattr, tcgetattr, cc_t
#include <unistd.h> // for STDIN_FILENO, read
#endif
// Quick exit is missing in standard CLang headers