mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Compare commits
1 Commits
4b8c8ea00d
...
failed-v6.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd251a6463 |
7
.bazelrc
7
.bazelrc
@@ -1,7 +0,0 @@
|
|||||||
build --features=layering_check
|
|
||||||
build --enable_bzlmod
|
|
||||||
|
|
||||||
build --enable_platform_specific_config
|
|
||||||
build:linux --cxxopt=-std=c++20
|
|
||||||
build:macos --cxxopt=-std=c++20
|
|
||||||
build:windows --cxxopt=-std:c++20
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# Bazel Central Registry
|
|
||||||
|
|
||||||
When the ruleset is released, we want it to be published to the
|
|
||||||
Bazel Central Registry automatically:
|
|
||||||
<https://registry.bazel.build>
|
|
||||||
|
|
||||||
This folder contains configuration files to automate the publish step.
|
|
||||||
See <https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md>
|
|
||||||
for authoritative documentation about these files.
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"homepage": "https://github.com/ArthurSonzogni/FTXUI",
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "Arthur Sonzogni",
|
|
||||||
"email": "sonzogniarthur@gmail.com",
|
|
||||||
"github": "ArthurSonzogni",
|
|
||||||
"github_user_id": 4759106
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"repository": [
|
|
||||||
"github:ArthurSonzogni/FTXUI"
|
|
||||||
],
|
|
||||||
"versions": [],
|
|
||||||
"yanked_versions": {}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
matrix:
|
|
||||||
bazel:
|
|
||||||
- 7.x
|
|
||||||
- 8.x
|
|
||||||
- rolling
|
|
||||||
unix_platform:
|
|
||||||
- debian11
|
|
||||||
- ubuntu2204
|
|
||||||
- macos
|
|
||||||
- macos_arm64
|
|
||||||
win_platform:
|
|
||||||
- windows
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
unix_test:
|
|
||||||
name: Verify build targets on Unix
|
|
||||||
platform: ${{ unix_platform }}
|
|
||||||
bazel: ${{ bazel }}
|
|
||||||
build_flags:
|
|
||||||
- --cxxopt=-std=c++20
|
|
||||||
build_targets:
|
|
||||||
- '@ftxui//:dom'
|
|
||||||
- '@ftxui//:component'
|
|
||||||
- '@ftxui//:screen'
|
|
||||||
|
|
||||||
windows_test:
|
|
||||||
name: Verify build targets
|
|
||||||
platform: ${{ win_platform }}
|
|
||||||
bazel: ${{ bazel }}
|
|
||||||
build_flags:
|
|
||||||
- --cxxopt=/std:c++20
|
|
||||||
build_targets:
|
|
||||||
- '@ftxui//:dom'
|
|
||||||
- '@ftxui//:component'
|
|
||||||
- '@ftxui//:screen'
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"integrity": "",
|
|
||||||
"strip_prefix": "",
|
|
||||||
"url": "https://github.com/ArthurSonzogni/FTXUI/releases/download/{TAG}/source.tar.gz"
|
|
||||||
}
|
|
||||||
127
.github/workflows/build.yaml
vendored
127
.github/workflows/build.yaml
vendored
@@ -1,63 +1,17 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# On new commits to main:
|
create:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
# On pull requests:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
test_bazel:
|
name: "Tests"
|
||||||
name: "Bazel, ${{ matrix.cxx }}, ${{ matrix.os }}"
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
cxx: g++
|
|
||||||
cc: gcc
|
|
||||||
|
|
||||||
- os: ubuntu-latest
|
|
||||||
cxx: clang++
|
|
||||||
cc: clang
|
|
||||||
|
|
||||||
- os: macos-latest
|
|
||||||
cxx: g++
|
|
||||||
cc: gcc
|
|
||||||
|
|
||||||
- os: macos-latest
|
|
||||||
cxx: clang++
|
|
||||||
cc: clang
|
|
||||||
|
|
||||||
- os: windows-latest
|
|
||||||
cxx: cl
|
|
||||||
cc: cl
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Build with Bazel"
|
|
||||||
env:
|
|
||||||
CC: ${{ matrix.cc }}
|
|
||||||
CXX: ${{ matrix.cxx }}
|
|
||||||
run: bazel build ...
|
|
||||||
|
|
||||||
- name: "Tests with Bazel"
|
|
||||||
env:
|
|
||||||
CC: ${{ matrix.cc }}
|
|
||||||
CXX: ${{ matrix.cxx }}
|
|
||||||
run: bazel test --test_output=all ...
|
|
||||||
|
|
||||||
test_cmake:
|
|
||||||
name: "CMake, ${{ matrix.compiler }}, ${{ matrix.os }}"
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -150,7 +104,7 @@ jobs:
|
|||||||
--gcov-executable '${{ matrix.gcov_executable }}';
|
--gcov-executable '${{ matrix.gcov_executable }}';
|
||||||
|
|
||||||
- name: Windows - Test and coverage
|
- name: Windows - Test and coverage
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows' && false
|
||||||
working-directory: ./build
|
working-directory: ./build
|
||||||
run: >
|
run: >
|
||||||
OpenCppCoverage.exe
|
OpenCppCoverage.exe
|
||||||
@@ -166,55 +120,9 @@ jobs:
|
|||||||
name: ${{ runner.os }}-coverage
|
name: ${{ runner.os }}-coverage
|
||||||
files: ./build/coverage.xml
|
files: ./build/coverage.xml
|
||||||
|
|
||||||
test_modules:
|
|
||||||
name: "Test modules"
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
compiler: llvm
|
|
||||||
# TODO add gcc / msvc
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Setup Cpp"
|
|
||||||
uses: aminya/setup-cpp@v1
|
|
||||||
with:
|
|
||||||
compiler: ${{ matrix.compiler }}
|
|
||||||
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
|
|
||||||
cmake: true
|
|
||||||
ninja: true
|
|
||||||
clangtidy: false
|
|
||||||
cppcheck: false
|
|
||||||
opencppcoverage: false
|
|
||||||
|
|
||||||
- name: "Generate ./examples_modules"
|
|
||||||
run: >
|
|
||||||
./tools/generate_examples_modules.sh
|
|
||||||
|
|
||||||
- name: "Build modules"
|
|
||||||
run: >
|
|
||||||
mkdir build;
|
|
||||||
cd build;
|
|
||||||
cmake ..
|
|
||||||
-DCMAKE_GENERATOR=Ninja
|
|
||||||
-DFTXUI_BUILD_MODULES=ON
|
|
||||||
-DFTXUI_BUILD_EXAMPLES=ON
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug
|
|
||||||
-DFTXUI_BUILD_DOCS=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
|
||||||
-DFTXUI_ENABLE_INSTALL=ON
|
|
||||||
-DFTXUI_DEV_WARNINGS=ON ;
|
|
||||||
cmake --build .
|
|
||||||
|
|
||||||
# Create a release on new v* tags
|
# Create a release on new v* tags
|
||||||
release:
|
release:
|
||||||
needs:
|
needs: test
|
||||||
- test_cmake
|
|
||||||
- test_bazel
|
|
||||||
if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }}
|
if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }}
|
||||||
name: "Create release"
|
name: "Create release"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -230,7 +138,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Build artifact for the release
|
# Build artifact for the release
|
||||||
package_compiled:
|
package:
|
||||||
name: "Build packages"
|
name: "Build packages"
|
||||||
needs: release
|
needs: release
|
||||||
strategy:
|
strategy:
|
||||||
@@ -275,29 +183,6 @@ jobs:
|
|||||||
asset_path: ${{ matrix.asset_path }}
|
asset_path: ${{ matrix.asset_path }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
# Build "source" artifact for the release. This is the same as the github
|
|
||||||
# "source" archive, but with a stable URL. This is useful for the Bazel
|
|
||||||
# Central Repository.
|
|
||||||
package_source:
|
|
||||||
name: "Build source package"
|
|
||||||
needs: release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Create source package"
|
|
||||||
run: >
|
|
||||||
git archive --format=tar.gz -o source.tar.gz HEAD
|
|
||||||
|
|
||||||
- name: "Upload source package"
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: source.tar.gz
|
|
||||||
overwrite: true
|
|
||||||
|
|
||||||
|
|
||||||
documentation:
|
documentation:
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
60
.github/workflows/documentation.yaml
vendored
60
.github/workflows/documentation.yaml
vendored
@@ -1,60 +0,0 @@
|
|||||||
name: Documentation
|
|
||||||
|
|
||||||
on:
|
|
||||||
# On new commits to main:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
documentation:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Install cmake"
|
|
||||||
uses: lukka/get-cmake@latest
|
|
||||||
|
|
||||||
- name: "Install emsdk"
|
|
||||||
uses: mymindstorm/setup-emsdk@v7
|
|
||||||
|
|
||||||
- name: "Install Doxygen/Graphviz"
|
|
||||||
run: >
|
|
||||||
sudo apt-get update;
|
|
||||||
sudo apt-get install doxygen graphviz;
|
|
||||||
|
|
||||||
- name: "Build documentation"
|
|
||||||
run: >
|
|
||||||
mkdir build;
|
|
||||||
cd build;
|
|
||||||
emcmake cmake ..
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DFTXUI_BUILD_DOCS=ON
|
|
||||||
-DFTXUI_BUILD_EXAMPLES=ON
|
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
|
||||||
-DFTXUI_ENABLE_INSTALL=OFF
|
|
||||||
-DFTXUI_DEV_WARNINGS=ON ;
|
|
||||||
cmake --build . --target doc;
|
|
||||||
cmake --build . ;
|
|
||||||
rsync -amv
|
|
||||||
--include='*/'
|
|
||||||
--include='*.html'
|
|
||||||
--include='*.css'
|
|
||||||
--include='*.mjs'
|
|
||||||
--include='*.js'
|
|
||||||
--include='*.wasm'
|
|
||||||
--exclude='*'
|
|
||||||
examples
|
|
||||||
doc/doxygen/html;
|
|
||||||
|
|
||||||
- name: "Deploy"
|
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
publish_dir: build/doc/doxygen/html/
|
|
||||||
enable_jekyll: false
|
|
||||||
allow_empty_commit: false
|
|
||||||
force_orphan: true
|
|
||||||
publish_branch: gh-pages
|
|
||||||
24
.github/workflows/publish.yaml
vendored
24
.github/workflows/publish.yaml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: "Publish to Bazel Central Registry"
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Manual kick-off (you type the tag)
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag_name:
|
|
||||||
description: "Tag to publish"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.event.inputs.tag_name }}
|
|
||||||
registry_fork: ArthurSonzogni/bazel-central-registry
|
|
||||||
attest: false
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
publish_token: ${{ secrets.PUBLISH_TOKEN }}
|
|
||||||
100
.github/workflows/release.yaml
vendored
100
.github/workflows/release.yaml
vendored
@@ -1,100 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
# On push to a tag:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
# On manual trigger:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
# Needed to mint attestations
|
|
||||||
id-token: write
|
|
||||||
attestations: write
|
|
||||||
# Needed to upload release assets
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
name: "Create release"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
steps:
|
|
||||||
- name: "Create release"
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
id: create_release
|
|
||||||
with:
|
|
||||||
draft: true
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# Build artifact for the release
|
|
||||||
package_compiled:
|
|
||||||
name: "Build packages"
|
|
||||||
needs: release
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
asset_path: build/ftxui*Linux*
|
|
||||||
- os: macos-latest
|
|
||||||
asset_path: build/ftxui*Darwin*
|
|
||||||
- os: windows-latest
|
|
||||||
asset_path: build/ftxui*Win64*
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Get number of CPU cores
|
|
||||||
uses: SimenB/github-actions-cpu-cores@v1
|
|
||||||
id: cpu-cores
|
|
||||||
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Install cmake"
|
|
||||||
uses: lukka/get-cmake@latest
|
|
||||||
|
|
||||||
- name: "Build packages"
|
|
||||||
run: >
|
|
||||||
mkdir build;
|
|
||||||
cd build;
|
|
||||||
cmake ..
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
|
|
||||||
-DFTXUI_BUILD_DOCS=OFF
|
|
||||||
-DFTXUI_BUILD_EXAMPLES=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
|
||||||
-DFTXUI_ENABLE_INSTALL=ON
|
|
||||||
-DFTXUI_DEV_WARNINGS=ON ;
|
|
||||||
cmake --build . --target package;
|
|
||||||
|
|
||||||
- uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: ${{ matrix.asset_path }}
|
|
||||||
overwrite: true
|
|
||||||
|
|
||||||
# Build "source" artifact for the release. This is the same as the github
|
|
||||||
# "source" archive, but with a stable URL. This is useful for the Bazel
|
|
||||||
# Central Repository.
|
|
||||||
package_source:
|
|
||||||
name: "Build source package"
|
|
||||||
needs: release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Create source package"
|
|
||||||
run: >
|
|
||||||
git archive --format=tar.gz -o source.tar.gz HEAD
|
|
||||||
|
|
||||||
- name: "Upload source package"
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: source.tar.gz
|
|
||||||
overwrite: true
|
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -20,10 +20,6 @@ out/
|
|||||||
!flake.nix
|
!flake.nix
|
||||||
!ftxui.pc.in
|
!ftxui.pc.in
|
||||||
!iwyu.imp
|
!iwyu.imp
|
||||||
!WORKSPACE.bazel
|
|
||||||
!BUILD.bazel
|
|
||||||
!MODULE.bazel
|
|
||||||
!.bazelrc
|
|
||||||
|
|
||||||
# .github directory:
|
# .github directory:
|
||||||
!.github/**/*.yaml
|
!.github/**/*.yaml
|
||||||
@@ -33,10 +29,6 @@ out/
|
|||||||
!cmake/**/*.in
|
!cmake/**/*.in
|
||||||
!cmake/**/*.cmake
|
!cmake/**/*.cmake
|
||||||
|
|
||||||
# bazel directory:
|
|
||||||
!bazel/**/*.bzl
|
|
||||||
!.bcr/*
|
|
||||||
|
|
||||||
# doc directory:
|
# doc directory:
|
||||||
!doc/**/Doxyfile.in
|
!doc/**/Doxyfile.in
|
||||||
!doc/**/*.txt
|
!doc/**/*.txt
|
||||||
@@ -62,10 +54,8 @@ out/
|
|||||||
!include/ftxui/**/*.cpp
|
!include/ftxui/**/*.cpp
|
||||||
|
|
||||||
# src directory:
|
# src directory:
|
||||||
!src/ftxui/*.cppm
|
|
||||||
!src/ftxui/**/*.hpp
|
!src/ftxui/**/*.hpp
|
||||||
!src/ftxui/**/*.cpp
|
!src/ftxui/**/*.cpp
|
||||||
!src/ftxui/**/*.cppm
|
|
||||||
|
|
||||||
# tools directory:
|
# tools directory:
|
||||||
!tools/**/*.sh
|
!tools/**/*.sh
|
||||||
|
|||||||
270
BUILD.bazel
270
BUILD.bazel
@@ -1,270 +0,0 @@
|
|||||||
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
|
||||||
# Use of this source code is governed by the MIT license that can be found in
|
|
||||||
# the LICENSE file.
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# - Build benchmark.
|
|
||||||
# - Build fuzzers.
|
|
||||||
# - Build documentation.
|
|
||||||
# - Enable the two tests timing out.
|
|
||||||
# - Support WebAssembly
|
|
||||||
|
|
||||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
|
||||||
load(":bazel/ftxui.bzl", "ftxui_cc_library")
|
|
||||||
load(":bazel/ftxui.bzl", "generate_examples")
|
|
||||||
load(":bazel/ftxui.bzl", "windows_copts")
|
|
||||||
load(":bazel/ftxui.bzl", "pthread_linkopts")
|
|
||||||
|
|
||||||
# A meta target depending on all of the ftxui submodules.
|
|
||||||
# Note that component depends on dom and screen, so ftxui is just an alias for
|
|
||||||
# component.
|
|
||||||
# ┌component──┐
|
|
||||||
# │┌dom──────┐│
|
|
||||||
# ││┌screen─┐││
|
|
||||||
# └┴┴───────┴┴┘
|
|
||||||
alias(name = "ftxui", actual = ":component")
|
|
||||||
|
|
||||||
# @ftxui:screen is a module that provides a screen buffer and color management
|
|
||||||
# for terminal applications. A screen is a 2D array of cells, each cell can
|
|
||||||
# contain a glyph, a color, and other attributes. The library also provides
|
|
||||||
# functions to manipulate the screen.
|
|
||||||
ftxui_cc_library(
|
|
||||||
name = "screen",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/screen/box.cpp",
|
|
||||||
"src/ftxui/screen/color.cpp",
|
|
||||||
"src/ftxui/screen/color_info.cpp",
|
|
||||||
"src/ftxui/screen/image.cpp",
|
|
||||||
"src/ftxui/screen/screen.cpp",
|
|
||||||
"src/ftxui/screen/string.cpp",
|
|
||||||
"src/ftxui/screen/string_internal.hpp",
|
|
||||||
"src/ftxui/screen/terminal.cpp",
|
|
||||||
"src/ftxui/screen/util.hpp",
|
|
||||||
],
|
|
||||||
hdrs = [
|
|
||||||
"include/ftxui/screen/box.hpp",
|
|
||||||
"include/ftxui/screen/color.hpp",
|
|
||||||
"include/ftxui/screen/color_info.hpp",
|
|
||||||
"include/ftxui/screen/deprecated.hpp",
|
|
||||||
"include/ftxui/screen/image.hpp",
|
|
||||||
"include/ftxui/screen/pixel.hpp",
|
|
||||||
"include/ftxui/screen/screen.hpp",
|
|
||||||
"include/ftxui/screen/string.hpp",
|
|
||||||
"include/ftxui/screen/terminal.hpp",
|
|
||||||
"include/ftxui/util/autoreset.hpp",
|
|
||||||
"include/ftxui/util/ref.hpp",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# @ftxui:dom is a library that provides a way to create and manipulate a
|
|
||||||
# "document" that can be rendered to a screen. The document is a tree of nodes.
|
|
||||||
# Nodes can be text, layouts, or various decorators. Users needs to compose
|
|
||||||
# nodes to create a document. A document is responsive to the size of the
|
|
||||||
# screen.
|
|
||||||
ftxui_cc_library(
|
|
||||||
name = "dom",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/dom/automerge.cpp",
|
|
||||||
"src/ftxui/dom/blink.cpp",
|
|
||||||
"src/ftxui/dom/bold.cpp",
|
|
||||||
"src/ftxui/dom/border.cpp",
|
|
||||||
"src/ftxui/dom/box_helper.cpp",
|
|
||||||
"src/ftxui/dom/box_helper.hpp",
|
|
||||||
"src/ftxui/dom/canvas.cpp",
|
|
||||||
"src/ftxui/dom/clear_under.cpp",
|
|
||||||
"src/ftxui/dom/color.cpp",
|
|
||||||
"src/ftxui/dom/composite_decorator.cpp",
|
|
||||||
"src/ftxui/dom/dbox.cpp",
|
|
||||||
"src/ftxui/dom/dim.cpp",
|
|
||||||
"src/ftxui/dom/flex.cpp",
|
|
||||||
"src/ftxui/dom/flexbox.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_config.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_helper.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_helper.hpp",
|
|
||||||
"src/ftxui/dom/focus.cpp",
|
|
||||||
"src/ftxui/dom/frame.cpp",
|
|
||||||
"src/ftxui/dom/gauge.cpp",
|
|
||||||
"src/ftxui/dom/graph.cpp",
|
|
||||||
"src/ftxui/dom/gridbox.cpp",
|
|
||||||
"src/ftxui/dom/hbox.cpp",
|
|
||||||
"src/ftxui/dom/hyperlink.cpp",
|
|
||||||
"src/ftxui/dom/inverted.cpp",
|
|
||||||
"src/ftxui/dom/italic.cpp",
|
|
||||||
"src/ftxui/dom/linear_gradient.cpp",
|
|
||||||
"src/ftxui/dom/node.cpp",
|
|
||||||
"src/ftxui/dom/node_decorator.cpp",
|
|
||||||
"src/ftxui/dom/node_decorator.hpp",
|
|
||||||
"src/ftxui/dom/paragraph.cpp",
|
|
||||||
"src/ftxui/dom/reflect.cpp",
|
|
||||||
"src/ftxui/dom/scroll_indicator.cpp",
|
|
||||||
"src/ftxui/dom/selection.cpp",
|
|
||||||
"src/ftxui/dom/selection_style.cpp",
|
|
||||||
"src/ftxui/dom/separator.cpp",
|
|
||||||
"src/ftxui/dom/size.cpp",
|
|
||||||
"src/ftxui/dom/spinner.cpp",
|
|
||||||
"src/ftxui/dom/strikethrough.cpp",
|
|
||||||
"src/ftxui/dom/table.cpp",
|
|
||||||
"src/ftxui/dom/text.cpp",
|
|
||||||
"src/ftxui/dom/underlined.cpp",
|
|
||||||
"src/ftxui/dom/underlined_double.cpp",
|
|
||||||
"src/ftxui/dom/util.cpp",
|
|
||||||
"src/ftxui/dom/vbox.cpp",
|
|
||||||
],
|
|
||||||
hdrs = [
|
|
||||||
"include/ftxui/dom/canvas.hpp",
|
|
||||||
"include/ftxui/dom/deprecated.hpp",
|
|
||||||
"include/ftxui/dom/direction.hpp",
|
|
||||||
"include/ftxui/dom/elements.hpp",
|
|
||||||
"include/ftxui/dom/flexbox_config.hpp",
|
|
||||||
"include/ftxui/dom/linear_gradient.hpp",
|
|
||||||
"include/ftxui/dom/node.hpp",
|
|
||||||
"include/ftxui/dom/requirement.hpp",
|
|
||||||
"include/ftxui/dom/selection.hpp",
|
|
||||||
"include/ftxui/dom/table.hpp",
|
|
||||||
"include/ftxui/dom/take_any_args.hpp",
|
|
||||||
],
|
|
||||||
deps = [":screen"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# @ftxui:component is a library to create "dynamic" component renderering and
|
|
||||||
# updating a ftxui::dom document on the screen. It is a higher level API than
|
|
||||||
# ftxui:dom.
|
|
||||||
#
|
|
||||||
# The module is required if your program needs to respond to user input. It
|
|
||||||
# defines a set of ftxui::Component. These components can be utilized to
|
|
||||||
# navigate using the arrow keys and/or cursor. There are several builtin widgets
|
|
||||||
# like checkbox/inputbox/etc to interact with. You can combine them, or even
|
|
||||||
# define your own custom components.
|
|
||||||
ftxui_cc_library(
|
|
||||||
name = "component",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/component/animation.cpp",
|
|
||||||
"src/ftxui/component/button.cpp",
|
|
||||||
"src/ftxui/component/catch_event.cpp",
|
|
||||||
"src/ftxui/component/checkbox.cpp",
|
|
||||||
"src/ftxui/component/collapsible.cpp",
|
|
||||||
"src/ftxui/component/component.cpp",
|
|
||||||
"src/ftxui/component/component_options.cpp",
|
|
||||||
"src/ftxui/component/container.cpp",
|
|
||||||
"src/ftxui/component/dropdown.cpp",
|
|
||||||
"src/ftxui/component/event.cpp",
|
|
||||||
"src/ftxui/component/hoverable.cpp",
|
|
||||||
"src/ftxui/component/input.cpp",
|
|
||||||
"src/ftxui/component/loop.cpp",
|
|
||||||
"src/ftxui/component/maybe.cpp",
|
|
||||||
"src/ftxui/component/menu.cpp",
|
|
||||||
"src/ftxui/component/modal.cpp",
|
|
||||||
"src/ftxui/component/radiobox.cpp",
|
|
||||||
"src/ftxui/component/renderer.cpp",
|
|
||||||
"src/ftxui/component/resizable_split.cpp",
|
|
||||||
"src/ftxui/component/screen_interactive.cpp",
|
|
||||||
"src/ftxui/component/slider.cpp",
|
|
||||||
"src/ftxui/component/terminal_input_parser.cpp",
|
|
||||||
"src/ftxui/component/terminal_input_parser.hpp",
|
|
||||||
"src/ftxui/component/util.cpp",
|
|
||||||
"src/ftxui/component/window.cpp",
|
|
||||||
|
|
||||||
# Private header from ftxui:dom.
|
|
||||||
"src/ftxui/dom/node_decorator.hpp",
|
|
||||||
|
|
||||||
# Private header from ftxui:screen.
|
|
||||||
"src/ftxui/screen/string_internal.hpp",
|
|
||||||
"src/ftxui/screen/util.hpp",
|
|
||||||
],
|
|
||||||
hdrs = [
|
|
||||||
"include/ftxui/component/animation.hpp",
|
|
||||||
"include/ftxui/component/captured_mouse.hpp",
|
|
||||||
"include/ftxui/component/component.hpp",
|
|
||||||
"include/ftxui/component/component_base.hpp",
|
|
||||||
"include/ftxui/component/component_options.hpp",
|
|
||||||
"include/ftxui/component/event.hpp",
|
|
||||||
"include/ftxui/component/loop.hpp",
|
|
||||||
"include/ftxui/component/mouse.hpp",
|
|
||||||
"include/ftxui/component/receiver.hpp",
|
|
||||||
"include/ftxui/component/screen_interactive.hpp",
|
|
||||||
"include/ftxui/component/task.hpp",
|
|
||||||
],
|
|
||||||
linkopts = pthread_linkopts(),
|
|
||||||
deps = [
|
|
||||||
":dom",
|
|
||||||
":screen",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# FTXUI's tests
|
|
||||||
cc_test(
|
|
||||||
name = "tests",
|
|
||||||
testonly = True,
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/component/animation_test.cpp",
|
|
||||||
"src/ftxui/component/button_test.cpp",
|
|
||||||
"src/ftxui/component/collapsible_test.cpp",
|
|
||||||
"src/ftxui/component/component_test.cpp",
|
|
||||||
"src/ftxui/component/container_test.cpp",
|
|
||||||
"src/ftxui/component/dropdown_test.cpp",
|
|
||||||
"src/ftxui/component/hoverable_test.cpp",
|
|
||||||
"src/ftxui/component/input_test.cpp",
|
|
||||||
"src/ftxui/component/menu_test.cpp",
|
|
||||||
"src/ftxui/component/modal_test.cpp",
|
|
||||||
"src/ftxui/component/radiobox_test.cpp",
|
|
||||||
"src/ftxui/component/receiver_test.cpp",
|
|
||||||
"src/ftxui/component/resizable_split_test.cpp",
|
|
||||||
"src/ftxui/component/slider_test.cpp",
|
|
||||||
"src/ftxui/component/terminal_input_parser_test.cpp",
|
|
||||||
"src/ftxui/component/toggle_test.cpp",
|
|
||||||
"src/ftxui/dom/blink_test.cpp",
|
|
||||||
"src/ftxui/dom/bold_test.cpp",
|
|
||||||
"src/ftxui/dom/border_test.cpp",
|
|
||||||
"src/ftxui/dom/canvas_test.cpp",
|
|
||||||
"src/ftxui/dom/color_test.cpp",
|
|
||||||
"src/ftxui/dom/dbox_test.cpp",
|
|
||||||
"src/ftxui/dom/dim_test.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_helper_test.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_test.cpp",
|
|
||||||
"src/ftxui/dom/gauge_test.cpp",
|
|
||||||
"src/ftxui/dom/gridbox_test.cpp",
|
|
||||||
"src/ftxui/dom/hbox_test.cpp",
|
|
||||||
"src/ftxui/dom/hyperlink_test.cpp",
|
|
||||||
"src/ftxui/dom/italic_test.cpp",
|
|
||||||
"src/ftxui/dom/linear_gradient_test.cpp",
|
|
||||||
"src/ftxui/dom/scroll_indicator_test.cpp",
|
|
||||||
"src/ftxui/dom/separator_test.cpp",
|
|
||||||
"src/ftxui/dom/spinner_test.cpp",
|
|
||||||
"src/ftxui/dom/table_test.cpp",
|
|
||||||
"src/ftxui/dom/text_test.cpp",
|
|
||||||
"src/ftxui/dom/underlined_test.cpp",
|
|
||||||
"src/ftxui/dom/vbox_test.cpp",
|
|
||||||
"src/ftxui/screen/color_test.cpp",
|
|
||||||
"src/ftxui/screen/string_test.cpp",
|
|
||||||
"src/ftxui/util/ref_test.cpp",
|
|
||||||
|
|
||||||
# Private header from ftxui:screen for string_test.cpp.
|
|
||||||
"src/ftxui/screen/string_internal.hpp",
|
|
||||||
|
|
||||||
# Private header from ftxui::component for
|
|
||||||
# terminal_input_parser_test.cpp.
|
|
||||||
"src/ftxui/component/terminal_input_parser.hpp",
|
|
||||||
|
|
||||||
# Private header from ftxui::dom for
|
|
||||||
# flexbox_helper_test.cpp.
|
|
||||||
"src/ftxui/dom/flexbox_helper.hpp",
|
|
||||||
|
|
||||||
# TODO: Enable the two tests timing out with Bazel:
|
|
||||||
# - "src/ftxui/component/screen_interactive_test.cpp",
|
|
||||||
# - "src/ftxui/dom/selection_test.cpp",
|
|
||||||
],
|
|
||||||
includes = [
|
|
||||||
"include",
|
|
||||||
"src",
|
|
||||||
],
|
|
||||||
copts = windows_copts(),
|
|
||||||
deps = [
|
|
||||||
":screen",
|
|
||||||
":dom",
|
|
||||||
":component",
|
|
||||||
"@googletest//:gtest",
|
|
||||||
"@googletest//:gtest_main",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
generate_examples()
|
|
||||||
90
CHANGELOG.md
90
CHANGELOG.md
@@ -1,90 +1,8 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Development
|
current (development)
|
||||||
-----------
|
---------------------
|
||||||
|
|
||||||
### Build
|
|
||||||
- Feature: Support C++20 modules.
|
|
||||||
This requires:
|
|
||||||
- Using the Ninja or MSVC generator
|
|
||||||
- A recent Clang/GCC/MSVC compiler.
|
|
||||||
- Cmake 3.28 or higher.
|
|
||||||
Usage:
|
|
||||||
```cpp
|
|
||||||
import ftxui;
|
|
||||||
import ftxui.component;
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
```
|
|
||||||
Thanks @mikomikotaishi for PR #1015.
|
|
||||||
|
|
||||||
|
|
||||||
Future release
|
|
||||||
=======
|
|
||||||
6.1.9 (2025-05-07
|
|
||||||
|
|
||||||
### Build
|
|
||||||
If all goes well (pending), ftxui should appear in the Bazel central repository.
|
|
||||||
It can be imported into your project using the following lines:
|
|
||||||
|
|
||||||
**MODULE.bazel**
|
|
||||||
```bazel
|
|
||||||
bazel_dep(name = "ftxui", version = "6.1.9")
|
|
||||||
```
|
|
||||||
|
|
||||||
Thanks @robinlinden and @kcc for the reviews.
|
|
||||||
|
|
||||||
### dom
|
|
||||||
- Bugfix: Restore the `dbox` behavior from ftxui 5.0.0. To apply bgcolor
|
|
||||||
blending between the two layers, a new `dboxBlend` will be added.
|
|
||||||
|
|
||||||
6.1.8 (2025-05-01)
|
|
||||||
------------------
|
|
||||||
|
|
||||||
### Build
|
|
||||||
- Feature: Support `bazel` build system. See #1032.
|
|
||||||
Proposed by Kostya Serebryany @kcc
|
|
||||||
|
|
||||||
**BUILD.bazel**
|
|
||||||
```bazel
|
|
||||||
deps = [
|
|
||||||
// Depend on the whole library:
|
|
||||||
"@ftxui//:ftxui",
|
|
||||||
|
|
||||||
// Choose a specific submodule:
|
|
||||||
"@ftxui//:component",
|
|
||||||
"@ftxui//:dom",
|
|
||||||
"@ftxui//:screen",
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Component
|
|
||||||
- Bugfix: Fix a crash with ResizeableSplit. See #1023.
|
|
||||||
- Clamp screen size to terminal size.
|
|
||||||
- Disallow `ResizeableSplit` with negative size.
|
|
||||||
|
|
||||||
### Dom
|
|
||||||
- Bugfix: Disallow specifying a negative size constraint. See #1023.
|
|
||||||
|
|
||||||
|
|
||||||
6.0.2 (2025-03-30)
|
|
||||||
-----
|
|
||||||
|
|
||||||
### Component
|
|
||||||
- BugFix: Fix major crash on Windows affecting all components. See #1020
|
|
||||||
- BugFix: Fix focusRelative.
|
|
||||||
|
|
||||||
6.0.1 (2025-03-28)
|
|
||||||
-----
|
|
||||||
|
|
||||||
Same as v6.0.0.
|
|
||||||
|
|
||||||
Due to a problem tag v6.0.0 was replaced. This isn't a good practice and affect
|
|
||||||
developers that started using it in the short timeframe. Submitting a new
|
|
||||||
release with the same content is the best way to fix this.
|
|
||||||
|
|
||||||
See #1017 and #1019.
|
|
||||||
|
|
||||||
6.0.0 (2025-03-23)
|
6.0.0 (2025-03-23)
|
||||||
-----
|
-----
|
||||||
@@ -156,10 +74,6 @@ See #1017 and #1019.
|
|||||||
- See `selectionStyleReset` decorator.
|
- See `selectionStyleReset` decorator.
|
||||||
- Breaking change: Change how "focus"/"select" are handled. This fixes the
|
- Breaking change: Change how "focus"/"select" are handled. This fixes the
|
||||||
behavior.
|
behavior.
|
||||||
- Breaking change: `Component::OnRender()` becomes the method to override to
|
|
||||||
render a component. This replaces `Component::Render()` that is still in use
|
|
||||||
to call the rendering method on the children. This change allows to fix a
|
|
||||||
couple of issues around focus handling.
|
|
||||||
|
|
||||||
### Screen
|
### Screen
|
||||||
- Feature: Add `Box::IsEmpty()`.
|
- Feature: Add `Box::IsEmpty()`.
|
||||||
|
|||||||
@@ -1,26 +1,20 @@
|
|||||||
option(FTXUI_BUILD_DOCS "Set to ON to build docs" OFF)
|
|
||||||
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" OFF)
|
|
||||||
option(FTXUI_BUILD_MODULES "Build the C++20 modules" OFF)
|
|
||||||
option(FTXUI_BUILD_TESTS "Set to ON to build tests" OFF)
|
|
||||||
option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
|
|
||||||
option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF)
|
|
||||||
option(FTXUI_DEV_WARNINGS "Enable more compiler warnings and warnings as errors" OFF)
|
|
||||||
option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF)
|
|
||||||
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
|
|
||||||
option(FTXUI_QUIET "Set to ON for FTXUI to be quiet" OFF)
|
|
||||||
|
|
||||||
if (FTXUI_BUILD_MODULES)
|
|
||||||
cmake_minimum_required(VERSION 3.28.2)
|
|
||||||
else()
|
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
endif()
|
|
||||||
|
|
||||||
project(ftxui
|
project(ftxui
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
VERSION 6.1.9
|
VERSION 6.0.0
|
||||||
DESCRIPTION "C++ Functional Terminal User Interface."
|
DESCRIPTION "C++ Functional Terminal User Interface."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(FTXUI_QUIET "Set to ON for FTXUI to be quiet" OFF)
|
||||||
|
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" OFF)
|
||||||
|
option(FTXUI_BUILD_DOCS "Set to ON to build docs" OFF)
|
||||||
|
option(FTXUI_BUILD_TESTS "Set to ON to build tests" OFF)
|
||||||
|
option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
|
||||||
|
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
|
||||||
|
option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF)
|
||||||
|
option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF)
|
||||||
|
option(FTXUI_DEV_WARNINGS "Enable more compiler warnings and warnings as errors" OFF)
|
||||||
|
|
||||||
set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \
|
set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \
|
||||||
terminal used will be one of Microsoft and use a set of reasonnable fallback \
|
terminal used will be one of Microsoft and use a set of reasonnable fallback \
|
||||||
@@ -182,13 +176,6 @@ include(cmake/iwyu.cmake)
|
|||||||
include(cmake/ftxui_export.cmake)
|
include(cmake/ftxui_export.cmake)
|
||||||
include(cmake/ftxui_install.cmake)
|
include(cmake/ftxui_install.cmake)
|
||||||
include(cmake/ftxui_package.cmake)
|
include(cmake/ftxui_package.cmake)
|
||||||
include(cmake/ftxui_modules.cmake)
|
|
||||||
|
|
||||||
add_subdirectory(doc)
|
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
|
add_subdirectory(doc)
|
||||||
# You can generate ./examples_modules/ by running
|
|
||||||
# ./tools/generate_examples_modules.sh
|
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples_modules/CMakeLists.txt")
|
|
||||||
add_subdirectory(examples_modules)
|
|
||||||
endif()
|
|
||||||
|
|||||||
13
MODULE.bazel
13
MODULE.bazel
@@ -1,13 +0,0 @@
|
|||||||
# FTXUI module.
|
|
||||||
module(
|
|
||||||
name = "ftxui",
|
|
||||||
version = "6.1.9",
|
|
||||||
compatibility_level = 6,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build dependencies.
|
|
||||||
bazel_dep(name = "rules_cc", version = "0.1.1")
|
|
||||||
bazel_dep(name = "platforms", version = "0.0.10")
|
|
||||||
|
|
||||||
# Test dependencies.
|
|
||||||
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", dev_dependency = True)
|
|
||||||
76
README.md
76
README.md
@@ -40,27 +40,17 @@ A simple cross-platform C++ library for terminal based user interfaces!
|
|||||||
* Support for animations. [Demo 1](https://arthursonzogni.github.io/FTXUI/examples/?file=component/menu_underline_animated_gallery), [Demo 2](https://arthursonzogni.github.io/FTXUI/examples/?file=component/button_style)
|
* Support for animations. [Demo 1](https://arthursonzogni.github.io/FTXUI/examples/?file=component/menu_underline_animated_gallery), [Demo 2](https://arthursonzogni.github.io/FTXUI/examples/?file=component/button_style)
|
||||||
* Support for drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated)
|
* Support for drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated)
|
||||||
* No dependencies
|
* No dependencies
|
||||||
* Module support
|
|
||||||
* **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
|
* **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
|
||||||
* Learn by [examples](#documentation), and [tutorials](#documentation)
|
* Learn by [examples](#documentation), and [tutorials](#documentation)
|
||||||
* Multiple packages:
|
* Multiple packages: CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred), vcpkg, pkgbuild, conan.
|
||||||
- CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred)
|
|
||||||
- [Bazel](https://registry.bazel.build/modules/ftxui)
|
|
||||||
- [vcpkg](https://vcpkg.link/ports/ftxui)
|
|
||||||
- [Conan](https://conan.io/center/recipes/ftxui) [Debian package](https://tracker.debian.org/pkg/ftxui)
|
|
||||||
- [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui)
|
|
||||||
- [Arch Linux](https://aur.archlinux.org/packages/ftxui/)
|
|
||||||
- [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
|
|
||||||
* Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
|
* Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- [Starter CMake](https://github.com/ArthurSonzogni/ftxui-starter)
|
- [Starter example project](https://github.com/ArthurSonzogni/ftxui-starter)
|
||||||
- [Starter Bazel](https://github.com/ArthurSonzogni/ftxui-bazel)
|
|
||||||
- [Documentation](https://arthursonzogni.github.io/FTXUI/)
|
- [Documentation](https://arthursonzogni.github.io/FTXUI/)
|
||||||
- [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/)
|
- [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/)
|
||||||
- [Build using CMake](https://arthursonzogni.github.io/FTXUI/#build-cmake)
|
- [Build using CMake](https://arthursonzogni.github.io/FTXUI/#build-cmake)
|
||||||
- [Build using Bazel](https://arthursonzogni.github.io/FTXUI/#build-bazel)
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
~~~cpp
|
~~~cpp
|
||||||
@@ -358,8 +348,6 @@ Feel free to add your projects here:
|
|||||||
- [terminal-rain](https://github.com/Oakamoore/terminal-rain)
|
- [terminal-rain](https://github.com/Oakamoore/terminal-rain)
|
||||||
- [keywords](https://github.com/Oakamoore/keywords) ([Play web version :heart:](https://oakamoore.itch.io/keywords))
|
- [keywords](https://github.com/Oakamoore/keywords) ([Play web version :heart:](https://oakamoore.itch.io/keywords))
|
||||||
- [FTB - tertminal file browser](https://github.com/Cyxuan0311/FTB)
|
- [FTB - tertminal file browser](https://github.com/Cyxuan0311/FTB)
|
||||||
- [openJuice](https://github.com/mikomikotaishi/openJuice)
|
|
||||||
- [SHOOT!](https://github.com/ShingZhanho/ENGG1340-Project-25Spring)
|
|
||||||
|
|
||||||
### [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam)
|
### [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam)
|
||||||
|
|
||||||
@@ -376,68 +364,38 @@ Several games using the FTXUI have been made during the Game Jam:
|
|||||||
- [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md)
|
- [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md)
|
||||||
- [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md)
|
- [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md)
|
||||||
|
|
||||||
## Build using CMake
|
## Utilization
|
||||||
|
|
||||||
It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on.
|
It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on.
|
||||||
```cmake
|
```cmake
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(ftxui
|
FetchContent_Declare(ftxui
|
||||||
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
||||||
GIT_TAG v6.1.9
|
GIT_TAG v6.0.0
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(ftxui)
|
|
||||||
|
|
||||||
target_link_libraries(your_target PRIVATE
|
FetchContent_GetProperties(ftxui)
|
||||||
# Chose a submodule
|
if(NOT ftxui_POPULATED)
|
||||||
ftxui::component
|
FetchContent_Populate(ftxui)
|
||||||
ftxui::dom
|
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||||
ftxui::screen
|
endif()
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# Build using Bazel
|
|
||||||
|
|
||||||
**MODULE.bazel**
|
|
||||||
```starlark
|
|
||||||
bazel_dep(
|
|
||||||
name = "ftxui",
|
|
||||||
version = "v6.1.9",
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
**BUILD.bazel**
|
|
||||||
```starlark
|
|
||||||
cc_binary(
|
|
||||||
name = "your_target",
|
|
||||||
srcs = ["your_source.cc"],
|
|
||||||
deps = [
|
|
||||||
"@ftxui//:ftxui_component",
|
|
||||||
"@ftxui//:ftxui_dom",
|
|
||||||
"@ftxui//:ftxui_screen",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# Build with something else:
|
|
||||||
If you don't, FTXUI may be used from the following packages:
|
If you don't, FTXUI may be used from the following packages:
|
||||||
- CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred),
|
- [vcpkg](https://vcpkgx.com/details.html?package=ftxui)
|
||||||
- [Bazel](https://registry.bazel.build/modules/ftxui),
|
- [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/).
|
||||||
- [vcpkg](https://vcpkg.link/ports/ftxui),
|
- [conan.io](https://conan.io/center/ftxui)
|
||||||
- [Conan](https://conan.io/center/recipes/ftxui)
|
- [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
|
||||||
- [Debian package](https://tracker.debian.org/pkg/ftxui),
|
-
|
||||||
- [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui),
|
[](https://repology.org/project/ftxui/versions)
|
||||||
- [Arch Linux](https://aur.archlinux.org/packages/ftxui/),
|
|
||||||
- [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui),
|
|
||||||
[](https://repology.org/project/libftxui/versions)
|
|
||||||
|
|
||||||
|
|
||||||
If you choose to build and link FTXUI yourself, `ftxui-component` must be first in the linking order relative to the other FTXUI libraries, i.e.
|
If you choose to build and link FTXUI yourself, `ftxui-component` must be first in the linking order relative to the other FTXUI libraries, i.e.
|
||||||
```bash
|
```bash
|
||||||
g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . .
|
g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . .
|
||||||
```
|
```
|
||||||
|
|
||||||
To build FTXUI with modules, ensure that you are using a generator like Ninja or Visual Studio that supports modules, and pass the flag `FTXUI_BUILD_MODULES`.
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
|
||||||
# Use of this source code is governed by the MIT license that can be found in
|
|
||||||
# the LICENSE file.
|
|
||||||
workspace(name = "ftxui")
|
|
||||||
104
bazel/ftxui.bzl
104
bazel/ftxui.bzl
@@ -1,104 +0,0 @@
|
|||||||
# ftxui_common.bzl
|
|
||||||
|
|
||||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
|
||||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
|
||||||
|
|
||||||
# Microsoft terminal is a bit buggy ¯\_(ツ)_/¯ and MSVC uses bad defaults.
|
|
||||||
def windows_copts():
|
|
||||||
MSVC_COPTS = [
|
|
||||||
# Microsoft Visual Studio must decode sources files as UTF-8.
|
|
||||||
"/utf-8",
|
|
||||||
|
|
||||||
# Microsoft Visual Studio must interpret the codepoint using unicode.
|
|
||||||
"/DUNICODE",
|
|
||||||
"/D_UNICODE",
|
|
||||||
|
|
||||||
# Fallback for Microsoft Terminal.
|
|
||||||
# This
|
|
||||||
# - Replace missing font symbols by others.
|
|
||||||
# - Reduce screen position pooling frequency to deals against a Microsoft
|
|
||||||
# race condition. This was fixed in 2020, but clients never not updated.
|
|
||||||
# - https://github.com/microsoft/terminal/pull/7583
|
|
||||||
# - https://github.com/ArthurSonzogni/FTXUI/issues/136
|
|
||||||
"/DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
|
||||||
]
|
|
||||||
|
|
||||||
WINDOWS_COPTS = [
|
|
||||||
# Fallback for Microsoft Terminal.
|
|
||||||
# This
|
|
||||||
# - Replace missing font symbols by others.
|
|
||||||
# - Reduce screen position pooling frequency to deals against a Microsoft
|
|
||||||
# race condition. This was fixed in 2020, but clients are still using
|
|
||||||
# old versions.
|
|
||||||
# - https://github.com/microsoft/terminal/pull/7583
|
|
||||||
# - https://github.com/ArthurSonzogni/FTXUI/issues/136
|
|
||||||
"-DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
|
||||||
];
|
|
||||||
|
|
||||||
return select({
|
|
||||||
# MSVC:
|
|
||||||
"@rules_cc//cc/compiler:msvc-cl": MSVC_COPTS,
|
|
||||||
"@rules_cc//cc/compiler:clang-cl": MSVC_COPTS,
|
|
||||||
"@platforms//os:windows": WINDOWS_COPTS,
|
|
||||||
"//conditions:default": [],
|
|
||||||
})
|
|
||||||
|
|
||||||
def pthread_linkopts():
|
|
||||||
return select({
|
|
||||||
# With MSVC, threading is already built-in (you don't need -pthread.
|
|
||||||
"@rules_cc//cc/compiler:msvc-cl": [],
|
|
||||||
"@rules_cc//cc/compiler:clang-cl": [],
|
|
||||||
"@rules_cc//cc/compiler:clang": ["-pthread"],
|
|
||||||
"@rules_cc//cc/compiler:gcc": ["-pthread"],
|
|
||||||
"//conditions:default": ["-pthread"],
|
|
||||||
})
|
|
||||||
|
|
||||||
def ftxui_cc_library(
|
|
||||||
name,
|
|
||||||
srcs = [],
|
|
||||||
hdrs = [],
|
|
||||||
linkopts = [],
|
|
||||||
deps = []):
|
|
||||||
|
|
||||||
cc_library(
|
|
||||||
name = name,
|
|
||||||
srcs = srcs,
|
|
||||||
hdrs = hdrs,
|
|
||||||
linkopts = linkopts,
|
|
||||||
deps = deps,
|
|
||||||
strip_include_prefix = "",
|
|
||||||
include_prefix = "",
|
|
||||||
includes = [
|
|
||||||
"include",
|
|
||||||
"src",
|
|
||||||
],
|
|
||||||
copts = windows_copts(),
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Compile all the examples in the examples/ directory.
|
|
||||||
# This is useful to check the Bazel is always synchronized against CMake
|
|
||||||
# definitions.
|
|
||||||
def generate_examples():
|
|
||||||
cpp_files = native.glob(["examples/**/*.cpp"])
|
|
||||||
|
|
||||||
for src in cpp_files:
|
|
||||||
# Skip failing examples due to the color_info_sorted_2d.ipp dependency.
|
|
||||||
if src == "examples/component/homescreen.cpp" or \
|
|
||||||
src == "examples/dom/color_info_palette256.cpp" or \
|
|
||||||
src == "examples/dom/color_gallery.cpp":
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Turn "examples/component/button.cpp" → "example_component_button"
|
|
||||||
name = src.replace("/", "_").replace(".cpp", "")
|
|
||||||
|
|
||||||
cc_binary(
|
|
||||||
name = name,
|
|
||||||
srcs = [src],
|
|
||||||
deps = [
|
|
||||||
":component",
|
|
||||||
":dom",
|
|
||||||
":screen",
|
|
||||||
],
|
|
||||||
copts = windows_copts(),
|
|
||||||
)
|
|
||||||
@@ -5,14 +5,13 @@ function(ftxui_message msg)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
ftxui_message("┌─ FTXUI options ─────────────────────")
|
ftxui_message("┌─ FTXUI options ─────────────────────")
|
||||||
ftxui_message("│ FTXUI_BUILD_DOCS : ${FTXUI_BUILD_DOCS}")
|
ftxui_message("│ FTXUI_ENABLE_INSTALL : ${FTXUI_ENABLE_INSTALL}")
|
||||||
ftxui_message("│ FTXUI_BUILD_EXAMPLES : ${FTXUI_BUILD_EXAMPLES}")
|
ftxui_message("│ FTXUI_BUILD_EXAMPLES : ${FTXUI_BUILD_EXAMPLES}")
|
||||||
ftxui_message("│ FTXUI_BUILD_MODULES : ${FTXUI_BUILD_MODULES}")
|
ftxui_message("│ FTXUI_QUIET : ${FTXUI_QUIET}")
|
||||||
|
ftxui_message("│ FTXUI_BUILD_DOCS : ${FTXUI_BUILD_DOCS}")
|
||||||
ftxui_message("│ FTXUI_BUILD_TESTS : ${FTXUI_BUILD_TESTS}")
|
ftxui_message("│ FTXUI_BUILD_TESTS : ${FTXUI_BUILD_TESTS}")
|
||||||
ftxui_message("│ FTXUI_BUILD_TESTS_FUZZER : ${FTXUI_BUILD_TESTS_FUZZER}")
|
ftxui_message("│ FTXUI_BUILD_TESTS_FUZZER : ${FTXUI_BUILD_TESTS_FUZZER}")
|
||||||
ftxui_message("│ FTXUI_CLANG_TIDY : ${FTXUI_CLANG_TIDY}")
|
|
||||||
ftxui_message("│ FTXUI_DEV_WARNINGS : ${FTXUI_DEV_WARNINGS}")
|
|
||||||
ftxui_message("│ FTXUI_ENABLE_COVERAGE : ${FTXUI_ENABLE_COVERAGE}")
|
ftxui_message("│ FTXUI_ENABLE_COVERAGE : ${FTXUI_ENABLE_COVERAGE}")
|
||||||
ftxui_message("│ FTXUI_ENABLE_INSTALL : ${FTXUI_ENABLE_INSTALL}")
|
ftxui_message("│ FTXUI_DEV_WARNINGS : ${FTXUI_DEV_WARNINGS}")
|
||||||
ftxui_message("│ FTXUI_QUIET : ${FTXUI_QUIET}")
|
ftxui_message("│ FTXUI_CLANG_TIDY : ${FTXUI_CLANG_TIDY}")
|
||||||
ftxui_message("└─────────────────────────────────────")
|
ftxui_message("└─────────────────────────────────────")
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
if (NOT FTXUI_BUILD_MODULES)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(ftxui-modules)
|
|
||||||
|
|
||||||
target_sources(ftxui-modules
|
|
||||||
PUBLIC FILE_SET CXX_MODULES FILES
|
|
||||||
src/ftxui/component.cppm
|
|
||||||
src/ftxui/component/Animation.cppm
|
|
||||||
src/ftxui/component/CapturedMouse.cppm
|
|
||||||
src/ftxui/component/Component.cppm
|
|
||||||
src/ftxui/component/ComponentBase.cppm
|
|
||||||
src/ftxui/component/ComponentOptions.cppm
|
|
||||||
src/ftxui/component/Event.cppm
|
|
||||||
src/ftxui/component/Loop.cppm
|
|
||||||
src/ftxui/component/Mouse.cppm
|
|
||||||
src/ftxui/component/Receiver.cppm
|
|
||||||
src/ftxui/component/ScreenInteractive.cppm
|
|
||||||
src/ftxui/component/Task.cppm
|
|
||||||
src/ftxui/dom.cppm
|
|
||||||
src/ftxui/dom/Canvas.cppm
|
|
||||||
src/ftxui/dom/Deprecated.cppm
|
|
||||||
src/ftxui/dom/Direction.cppm
|
|
||||||
src/ftxui/dom/Elements.cppm
|
|
||||||
src/ftxui/dom/FlexboxConfig.cppm
|
|
||||||
src/ftxui/dom/LinearGradient.cppm
|
|
||||||
src/ftxui/dom/Node.cppm
|
|
||||||
src/ftxui/dom/Requirement.cppm
|
|
||||||
src/ftxui/dom/Selection.cppm
|
|
||||||
src/ftxui/dom/Table.cppm
|
|
||||||
src/ftxui/screen.cppm
|
|
||||||
src/ftxui/screen/Box.cppm
|
|
||||||
src/ftxui/screen/Color.cppm
|
|
||||||
src/ftxui/screen/ColorInfo.cppm
|
|
||||||
src/ftxui/screen/Deprecated.cppm
|
|
||||||
src/ftxui/screen/Image.cppm
|
|
||||||
src/ftxui/screen/Pixel.cppm
|
|
||||||
src/ftxui/screen/Screen.cppm
|
|
||||||
src/ftxui/screen/String.cppm
|
|
||||||
src/ftxui/screen/Terminal.cppm
|
|
||||||
src/ftxui/util.cppm
|
|
||||||
src/ftxui/util/AutoReset.cppm
|
|
||||||
src/ftxui/util/Ref.cppm
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(ftxui-modules
|
|
||||||
PUBLIC
|
|
||||||
ftxui::screen
|
|
||||||
ftxui::dom
|
|
||||||
ftxui::component
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_features(ftxui-modules PUBLIC cxx_std_20)
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
target_compile_options(${name} PUBLIC -fmodules-ts)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_library(ftxui::modules ALIAS ftxui-modules)
|
|
||||||
|
|
||||||
if(FTXUI_ENABLE_INSTALL)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
install(TARGETS ftxui-modules
|
|
||||||
EXPORT ftxui-targets
|
|
||||||
FILE_SET CXX_MODULES
|
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui
|
|
||||||
FILE_SET HEADERS
|
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui
|
|
||||||
INCLUDES
|
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui
|
|
||||||
)
|
|
||||||
install(EXPORT ftxui-targets
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
|
||||||
CXX_MODULES_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
|
||||||
)
|
|
||||||
install(FILES my_package-config.cmake
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
@@ -81,7 +81,7 @@ include(FetchContent)
|
|||||||
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
|
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
|
||||||
FetchContent_Declare(ftxui
|
FetchContent_Declare(ftxui
|
||||||
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
||||||
GIT_TAG 6.1.9
|
GIT_TAG main # Important: Specify a version or a commit hash here.
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(ftxui)
|
FetchContent_MakeAvailable(ftxui)
|
||||||
|
|
||||||
@@ -94,33 +94,13 @@ target_link_libraries(ftxui-starter
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Bazel {#build-bazel}
|
## Build
|
||||||
|
|
||||||
See [ftxui module](https://registry.bazel.build/modules/ftxui) from the Bazel
|
```bash
|
||||||
Central Registry.
|
mkdir build && cd build
|
||||||
|
cmake ..
|
||||||
See also this [starter](https://github.com/ArthurSonzogni/ftxui-bazel) project.
|
make
|
||||||
|
./main
|
||||||
**Module.bazel**
|
|
||||||
```starlark
|
|
||||||
bazel_dep(
|
|
||||||
name = "ftxui",
|
|
||||||
version = "6.1.9",
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
**BUILD.bazel**
|
|
||||||
```starlark
|
|
||||||
cc_binary(
|
|
||||||
name = "main",
|
|
||||||
srcs = ["main.cpp"],
|
|
||||||
deps = [
|
|
||||||
# Choose one of the following:
|
|
||||||
"@ftxui//:dom",
|
|
||||||
"@ftxui//:screen",
|
|
||||||
"@ftxui//:component",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# List of modules. {#modules}
|
# List of modules. {#modules}
|
||||||
|
|||||||
@@ -1,65 +1,9 @@
|
|||||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
#include "ftxui/component/component.hpp"
|
||||||
// Use of this source code is governed by the MIT license that can be found in
|
#include "ftxui/component/screen_interactive.hpp"
|
||||||
// the LICENSE file.
|
|
||||||
#include <memory> // for shared_ptr, __shared_ptr_access
|
|
||||||
#include <string> // for operator+, to_string
|
|
||||||
|
|
||||||
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
|
||||||
#include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer
|
|
||||||
#include "ftxui/component/component_base.hpp" // for ComponentBase
|
|
||||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
|
||||||
#include "ftxui/dom/elements.hpp" // for separator, gauge, text, Element, operator|, vbox, border
|
|
||||||
|
|
||||||
using namespace ftxui;
|
|
||||||
|
|
||||||
// This is a helper function to create a button with a custom style.
|
|
||||||
// The style is defined by a lambda function that takes an EntryState and
|
|
||||||
// returns an Element.
|
|
||||||
// We are using `center` to center the text inside the button, then `border` to
|
|
||||||
// add a border around the button, and finally `flex` to make the button fill
|
|
||||||
// the available space.
|
|
||||||
ButtonOption ButtonStyle() {
|
|
||||||
auto option = ButtonOption::Animated();
|
|
||||||
option.transform = [](const EntryState& s) {
|
|
||||||
auto element = text(s.label);
|
|
||||||
if (s.focused) {
|
|
||||||
element |= bold;
|
|
||||||
}
|
|
||||||
return element | center | borderEmpty | flex;
|
|
||||||
};
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
int value = 50;
|
auto screen = ftxui::ScreenInteractive::Fullscreen();
|
||||||
|
auto testComponent = ftxui::Renderer([](){return ftxui::text("test Component");});
|
||||||
// The tree of components. This defines how to navigate using the keyboard.
|
screen.Loop(testComponent);
|
||||||
auto buttons = Container::Vertical({
|
|
||||||
Container::Horizontal({
|
|
||||||
Button(
|
|
||||||
"-1", [&] { value--; }, ButtonStyle()),
|
|
||||||
Button(
|
|
||||||
"+1", [&] { value++; }, ButtonStyle()),
|
|
||||||
}) | flex,
|
|
||||||
Container::Horizontal({
|
|
||||||
Button(
|
|
||||||
"-10", [&] { value -= 10; }, ButtonStyle()),
|
|
||||||
Button(
|
|
||||||
"+10", [&] { value += 10; }, ButtonStyle()),
|
|
||||||
}) | flex,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Modify the way to render them on screen:
|
|
||||||
auto component = Renderer(buttons, [&] {
|
|
||||||
return vbox({
|
|
||||||
text("value = " + std::to_string(value)),
|
|
||||||
separator(),
|
|
||||||
buttons->Render() | flex,
|
|
||||||
}) |
|
|
||||||
flex | border;
|
|
||||||
});
|
|
||||||
|
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
|
||||||
screen.Loop(component);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using namespace ftxui;
|
|||||||
int main() {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
std::array<int, 30> values;
|
std::array<int, 30> values;
|
||||||
for (size_t i = 0; i < values.size(); ++i) {
|
for (int i = 0; i < values.size(); ++i) {
|
||||||
values[i] = 50 + 20 * std::sin(i * 0.3);
|
values[i] = 50 + 20 * std::sin(i * 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
|
int saturation = 255;
|
||||||
Elements red_line;
|
Elements red_line;
|
||||||
Elements green_line;
|
Elements green_line;
|
||||||
Elements blue_line;
|
Elements blue_line;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
#include <string> // for operator<<, string
|
#include <string> // for operator<<, string
|
||||||
#include <thread> // for sleep_for
|
#include <thread> // for sleep_for
|
||||||
#include <utility> // for ignore
|
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
@@ -50,7 +49,6 @@ int main() {
|
|||||||
|
|
||||||
std::string reset_position;
|
std::string reset_position;
|
||||||
for (int i = 0;; ++i) {
|
for (int i = 0;; ++i) {
|
||||||
std::ignore = i;
|
|
||||||
auto document = hbox({
|
auto document = hbox({
|
||||||
vbox({
|
vbox({
|
||||||
graph(std::ref(my_graph)),
|
graph(std::ref(my_graph)),
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file component.cppm
|
|
||||||
* @brief Module file for FTXUI component operations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export module ftxui.component;
|
|
||||||
|
|
||||||
export import ftxui.component.Animation;
|
|
||||||
export import ftxui.component.CapturedMouse;
|
|
||||||
export import ftxui.component.Component;
|
|
||||||
export import ftxui.component.ComponentBase;
|
|
||||||
export import ftxui.component.ComponentOptions;
|
|
||||||
export import ftxui.component.Event;
|
|
||||||
export import ftxui.component.Loop;
|
|
||||||
export import ftxui.component.Mouse;
|
|
||||||
export import ftxui.component.Receiver;
|
|
||||||
export import ftxui.component.ScreenInteractive;
|
|
||||||
export import ftxui.component.Task;
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Animation.cppm
|
|
||||||
* @brief Module file for the Animation namespace of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/animation.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Animation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui::animation
|
|
||||||
* @brief The FTXUI ftxui::animation:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui::animation {
|
|
||||||
using ftxui::animation::RequestAnimationFrame;
|
|
||||||
|
|
||||||
using ftxui::animation::Clock;
|
|
||||||
using ftxui::animation::TimePoint;
|
|
||||||
using ftxui::animation::Duration;
|
|
||||||
|
|
||||||
using ftxui::animation::Params;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace easing
|
|
||||||
* @brief The FTXUI sf::animation::easing:: namespace
|
|
||||||
*/
|
|
||||||
namespace easing {
|
|
||||||
using ftxui::animation::easing::Function;
|
|
||||||
|
|
||||||
using ftxui::animation::easing::Linear;
|
|
||||||
using ftxui::animation::easing::QuadraticIn;
|
|
||||||
using ftxui::animation::easing::QuadraticOut;
|
|
||||||
using ftxui::animation::easing::QuadraticInOut;
|
|
||||||
using ftxui::animation::easing::CubicIn;
|
|
||||||
using ftxui::animation::easing::CubicOut;
|
|
||||||
using ftxui::animation::easing::CubicInOut;
|
|
||||||
using ftxui::animation::easing::QuarticIn;
|
|
||||||
using ftxui::animation::easing::QuarticOut;
|
|
||||||
using ftxui::animation::easing::QuarticInOut;
|
|
||||||
using ftxui::animation::easing::QuinticIn;
|
|
||||||
using ftxui::animation::easing::QuinticOut;
|
|
||||||
using ftxui::animation::easing::QuinticInOut;
|
|
||||||
using ftxui::animation::easing::SineIn;
|
|
||||||
using ftxui::animation::easing::SineOut;
|
|
||||||
using ftxui::animation::easing::SineInOut;
|
|
||||||
using ftxui::animation::easing::CircularIn;
|
|
||||||
using ftxui::animation::easing::CircularOut;
|
|
||||||
using ftxui::animation::easing::CircularInOut;
|
|
||||||
using ftxui::animation::easing::ExponentialIn;
|
|
||||||
using ftxui::animation::easing::ExponentialOut;
|
|
||||||
using ftxui::animation::easing::ExponentialInOut;
|
|
||||||
using ftxui::animation::easing::ElasticIn;
|
|
||||||
using ftxui::animation::easing::ElasticOut;
|
|
||||||
using ftxui::animation::easing::ElasticInOut;
|
|
||||||
using ftxui::animation::easing::BackIn;
|
|
||||||
using ftxui::animation::easing::BackOut;
|
|
||||||
using ftxui::animation::easing::BackInOut;
|
|
||||||
using ftxui::animation::easing::BounceIn;
|
|
||||||
using ftxui::animation::easing::BounceOut;
|
|
||||||
using ftxui::animation::easing::BounceInOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
using ftxui::animation::Animator;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file CapturedMouse.cppm
|
|
||||||
* @brief Module file for the CapturedMouseInterface class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/captured_mouse.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.CapturedMouse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::CapturedMouseInterface;
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Component.cppm
|
|
||||||
* @brief Module file for the Component classes of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/component.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::ButtonOption;
|
|
||||||
using ftxui::CheckboxOption;
|
|
||||||
using ftxui::Event;
|
|
||||||
using ftxui::InputOption;
|
|
||||||
using ftxui::MenuOption;
|
|
||||||
using ftxui::RadioboxOption;
|
|
||||||
using ftxui::MenuEntryOption;
|
|
||||||
|
|
||||||
using ftxui::Make;
|
|
||||||
|
|
||||||
using ftxui::ComponentDecorator;
|
|
||||||
using ftxui::ElementDecorator;
|
|
||||||
|
|
||||||
using ftxui::operator|;
|
|
||||||
using ftxui::operator|=;
|
|
||||||
|
|
||||||
namespace Container {
|
|
||||||
using ftxui::Container::Vertical;
|
|
||||||
using ftxui::Container::Horizontal;
|
|
||||||
using ftxui::Container::Tab;
|
|
||||||
using ftxui::Container::Stacked;
|
|
||||||
}
|
|
||||||
|
|
||||||
using ftxui::Button;
|
|
||||||
using ftxui::Checkbox;
|
|
||||||
using ftxui::Input;
|
|
||||||
using ftxui::Menu;
|
|
||||||
using ftxui::MenuEntry;
|
|
||||||
using ftxui::Radiobox;
|
|
||||||
using ftxui::Dropdown;
|
|
||||||
using ftxui::Toggle;
|
|
||||||
using ftxui::Slider;
|
|
||||||
using ftxui::ResizableSplit;
|
|
||||||
using ftxui::ResizableSplitLeft;
|
|
||||||
using ftxui::ResizableSplitRight;
|
|
||||||
using ftxui::ResizableSplitTop;
|
|
||||||
using ftxui::ResizableSplitBottom;
|
|
||||||
using ftxui::Renderer;
|
|
||||||
using ftxui::CatchEvent;
|
|
||||||
using ftxui::Maybe;
|
|
||||||
using ftxui::Modal;
|
|
||||||
using ftxui::Collapsible;
|
|
||||||
using ftxui::Hoverable;
|
|
||||||
using ftxui::Window;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file ComponentBase.cppm
|
|
||||||
* @brief Module file for the ComponentBase class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/component_base.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.ComponentBase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Delegate;
|
|
||||||
using ftxui::Focus;
|
|
||||||
using ftxui::Event;
|
|
||||||
|
|
||||||
namespace animation {
|
|
||||||
using ftxui::animation::Params;
|
|
||||||
}
|
|
||||||
|
|
||||||
using ftxui::ComponentBase;
|
|
||||||
using ftxui::Component;
|
|
||||||
using ftxui::Components;
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file ComponentOptions.cppm
|
|
||||||
* @brief Module file for options for the Component class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/component_options.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.ComponentOptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::EntryState;
|
|
||||||
using ftxui::UnderlineOption;
|
|
||||||
using ftxui::AnimatedColorOption;
|
|
||||||
using ftxui::AnimatedColorsOption;
|
|
||||||
using ftxui::MenuEntryOption;
|
|
||||||
using ftxui::MenuOption;
|
|
||||||
using ftxui::ButtonOption;
|
|
||||||
using ftxui::CheckboxOption;
|
|
||||||
using ftxui::InputState;
|
|
||||||
using ftxui::InputOption;
|
|
||||||
using ftxui::RadioboxOption;
|
|
||||||
using ftxui::ResizableSplitOption;
|
|
||||||
using ftxui::SliderOption;
|
|
||||||
using ftxui::WindowRenderState;
|
|
||||||
using ftxui::WindowOptions;
|
|
||||||
using ftxui::DropdownOption;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Event.cppm
|
|
||||||
* @brief Module file for the Event struct of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/event.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::ScreenInteractive;
|
|
||||||
using ftxui::ComponentBase;
|
|
||||||
|
|
||||||
using ftxui::Event;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Loop.cppm
|
|
||||||
* @brief Module file for the Loop class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/loop.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Loop;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::ComponentBase;
|
|
||||||
using ftxui::Component;
|
|
||||||
using ftxui::ScreenInteractive;
|
|
||||||
|
|
||||||
using ftxui::Loop;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Mouse.cppm
|
|
||||||
* @brief Module file for the Mouse struct of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/mouse.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Mouse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Mouse;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Receiver.cppm
|
|
||||||
* @brief Module file for the Receiver class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/receiver.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Receiver;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::SenderImpl;
|
|
||||||
using ftxui::ReceiverImpl;
|
|
||||||
using ftxui::Sender;
|
|
||||||
using ftxui::Receiver;
|
|
||||||
using ftxui::MakeReceiver;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file ScreenInteractive.cppm
|
|
||||||
* @brief Module file for the ScreenInteractive class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/screen_interactive.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.ScreenInteractive;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::ComponentBase;
|
|
||||||
using ftxui::Loop;
|
|
||||||
using ftxui::Event;
|
|
||||||
using ftxui::Component;
|
|
||||||
|
|
||||||
using ftxui::Screen;
|
|
||||||
using ftxui::ScreenInteractivePrivate;
|
|
||||||
using ftxui::ScreenInteractive;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Task.cppm
|
|
||||||
* @brief Module file for the Task class of the Component module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/component/task.hpp>
|
|
||||||
|
|
||||||
export module ftxui.component.Task;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::AnimationTask;
|
|
||||||
using ftxui::Closure;
|
|
||||||
using ftxui::Task;
|
|
||||||
}
|
|
||||||
@@ -266,7 +266,7 @@ TEST(MenuTest, MenuEntryIndex) {
|
|||||||
menu->OnEvent(Event::ArrowDown);
|
menu->OnEvent(Event::ArrowDown);
|
||||||
menu->OnEvent(Event::ArrowDown);
|
menu->OnEvent(Event::ArrowDown);
|
||||||
menu->OnEvent(Event::Return);
|
menu->OnEvent(Event::Return);
|
||||||
for (size_t index = 0; index < menu->ChildCount(); index++) {
|
for (int index = 0; index < menu->ChildCount(); index++) {
|
||||||
EXPECT_EQ(menu->ChildAt(index)->Index(), index);
|
EXPECT_EQ(menu->ChildAt(index)->Index(), index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,16 +77,16 @@ class ResizableSplitBase : public ComponentBase {
|
|||||||
|
|
||||||
switch (options_->direction()) {
|
switch (options_->direction()) {
|
||||||
case Direction::Left:
|
case Direction::Left:
|
||||||
options_->main_size() = std::max(0, event.mouse().x - box_.x_min);
|
options_->main_size() = event.mouse().x - box_.x_min;
|
||||||
return true;
|
return true;
|
||||||
case Direction::Right:
|
case Direction::Right:
|
||||||
options_->main_size() = std::max(0, box_.x_max - event.mouse().x);
|
options_->main_size() = box_.x_max - event.mouse().x;
|
||||||
return true;
|
return true;
|
||||||
case Direction::Up:
|
case Direction::Up:
|
||||||
options_->main_size() = std::max(0, event.mouse().y - box_.y_min);
|
options_->main_size() = event.mouse().y - box_.y_min;
|
||||||
return true;
|
return true;
|
||||||
case Direction::Down:
|
case Direction::Down:
|
||||||
options_->main_size() = std::max(0, box_.y_max - event.mouse().y);
|
options_->main_size() = box_.y_max - event.mouse().y;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "ftxui/dom/requirement.hpp" // for Requirement
|
#include "ftxui/dom/requirement.hpp" // for Requirement
|
||||||
#include "ftxui/screen/pixel.hpp" // for Pixel
|
#include "ftxui/screen/pixel.hpp" // for Pixel
|
||||||
#include "ftxui/screen/terminal.hpp" // for Dimensions, Size
|
#include "ftxui/screen/terminal.hpp" // for Dimensions, Size
|
||||||
#include "ftxui/screen/util.hpp" // for util::clamp
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define DEFINE_CONSOLEV2_PROPERTIES
|
#define DEFINE_CONSOLEV2_PROPERTIES
|
||||||
@@ -918,15 +917,15 @@ void ScreenInteractive::Draw(Component component) {
|
|||||||
break;
|
break;
|
||||||
case Dimension::TerminalOutput:
|
case Dimension::TerminalOutput:
|
||||||
dimx = terminal.dimx;
|
dimx = terminal.dimx;
|
||||||
dimy = util::clamp(document->requirement().min_y, 0, terminal.dimy);
|
dimy = document->requirement().min_y;
|
||||||
break;
|
break;
|
||||||
case Dimension::Fullscreen:
|
case Dimension::Fullscreen:
|
||||||
dimx = terminal.dimx;
|
dimx = terminal.dimx;
|
||||||
dimy = terminal.dimy;
|
dimy = terminal.dimy;
|
||||||
break;
|
break;
|
||||||
case Dimension::FitComponent:
|
case Dimension::FitComponent:
|
||||||
dimx = util::clamp(document->requirement().min_x, 0, terminal.dimx);
|
dimx = std::min(document->requirement().min_x, terminal.dimx);
|
||||||
dimy = util::clamp(document->requirement().min_y, 0, terminal.dimy);
|
dimy = std::min(document->requirement().min_y, terminal.dimy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file dom.cppm
|
|
||||||
* @brief Module file for FTXUI main operations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export module ftxui.dom;
|
|
||||||
|
|
||||||
export import ftxui.dom.Canvas;
|
|
||||||
export import ftxui.dom.Deprecated;
|
|
||||||
export import ftxui.dom.Direction;
|
|
||||||
export import ftxui.dom.Elements;
|
|
||||||
export import ftxui.dom.FlexboxConfig;
|
|
||||||
export import ftxui.dom.LinearGradient;
|
|
||||||
export import ftxui.dom.Node;
|
|
||||||
export import ftxui.dom.Requirement;
|
|
||||||
export import ftxui.dom.Selection;
|
|
||||||
export import ftxui.dom.Table;
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Canvas.cppm
|
|
||||||
* @brief Module file for the Canvas struct of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/canvas.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Canvas;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Canvas;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Deprecated.cppm
|
|
||||||
* @brief Module file for deprecated parts of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/deprecated.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Deprecated;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::text;
|
|
||||||
using ftxui::vtext;
|
|
||||||
using ftxui::paragraph;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Direction.cppm
|
|
||||||
* @brief Module file for the Direction enum of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/direction.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Direction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Direction;
|
|
||||||
}
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Canvas.cppm
|
|
||||||
* @brief Module file for the Element classes and functions of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/elements.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Elements;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Node;
|
|
||||||
using ftxui::Element;
|
|
||||||
using ftxui::Elements;
|
|
||||||
using ftxui::Decorator;
|
|
||||||
using ftxui::GraphFunction;
|
|
||||||
|
|
||||||
using ftxui::BorderStyle;
|
|
||||||
|
|
||||||
using ftxui::operator|;
|
|
||||||
using ftxui::operator|=;
|
|
||||||
|
|
||||||
using ftxui::text;
|
|
||||||
using ftxui::vtext;
|
|
||||||
using ftxui::separator;
|
|
||||||
using ftxui::separatorLight;
|
|
||||||
using ftxui::separatorDashed;
|
|
||||||
using ftxui::separatorHeavy;
|
|
||||||
using ftxui::separatorDouble;
|
|
||||||
using ftxui::separatorEmpty;
|
|
||||||
using ftxui::separatorStyled;
|
|
||||||
using ftxui::separatorCharacter;
|
|
||||||
using ftxui::separatorHSelector;
|
|
||||||
using ftxui::separatorVSelector;
|
|
||||||
using ftxui::gauge;
|
|
||||||
using ftxui::gaugeLeft;
|
|
||||||
using ftxui::gaugeRight;
|
|
||||||
using ftxui::gaugeUp;
|
|
||||||
using ftxui::gaugeDown;
|
|
||||||
using ftxui::gaugeDirection;
|
|
||||||
using ftxui::border;
|
|
||||||
using ftxui::borderLight;
|
|
||||||
using ftxui::borderDashed;
|
|
||||||
using ftxui::borderHeavy;
|
|
||||||
using ftxui::borderDouble;
|
|
||||||
using ftxui::borderRounded;
|
|
||||||
using ftxui::borderEmpty;
|
|
||||||
using ftxui::borderStyled;
|
|
||||||
using ftxui::borderWith;
|
|
||||||
using ftxui::window;
|
|
||||||
using ftxui::spinner;
|
|
||||||
using ftxui::paragraph;
|
|
||||||
using ftxui::paragraphAlignLeft;
|
|
||||||
using ftxui::paragraphAlignRight;
|
|
||||||
using ftxui::paragraphAlignCenter;
|
|
||||||
using ftxui::paragraphAlignJustify;
|
|
||||||
using ftxui::graph;
|
|
||||||
using ftxui::emptyElement;
|
|
||||||
using ftxui::canvas;
|
|
||||||
|
|
||||||
using ftxui::bold;
|
|
||||||
using ftxui::dim;
|
|
||||||
using ftxui::inverted;
|
|
||||||
using ftxui::underlined;
|
|
||||||
using ftxui::underlinedDouble;
|
|
||||||
using ftxui::blink;
|
|
||||||
using ftxui::strikethrough;
|
|
||||||
using ftxui::color;
|
|
||||||
using ftxui::bgcolor;
|
|
||||||
using ftxui::focusPosition;
|
|
||||||
using ftxui::focusPositionRelative;
|
|
||||||
using ftxui::automerge;
|
|
||||||
using ftxui::hyperlink;
|
|
||||||
using ftxui::selectionStyleReset;
|
|
||||||
using ftxui::selectionColor;
|
|
||||||
using ftxui::selectionBackgroundColor;
|
|
||||||
using ftxui::selectionForegroundColor;
|
|
||||||
using ftxui::selectionStyle;
|
|
||||||
|
|
||||||
using ftxui::hbox;
|
|
||||||
using ftxui::vbox;
|
|
||||||
using ftxui::dbox;
|
|
||||||
using ftxui::flexbox;
|
|
||||||
using ftxui::gridbox;
|
|
||||||
using ftxui::hflow;
|
|
||||||
using ftxui::vflow;
|
|
||||||
|
|
||||||
using ftxui::flex;
|
|
||||||
using ftxui::flex_grow;
|
|
||||||
using ftxui::flex_shrink;
|
|
||||||
using ftxui::xflex;
|
|
||||||
using ftxui::xflex_grow;
|
|
||||||
using ftxui::xflex_shrink;
|
|
||||||
using ftxui::yflex;
|
|
||||||
using ftxui::yflex_grow;
|
|
||||||
using ftxui::yflex_shrink;
|
|
||||||
using ftxui::notflex;
|
|
||||||
using ftxui::filler;
|
|
||||||
|
|
||||||
using ftxui::WidthOrHeight;
|
|
||||||
using ftxui::Constraint;
|
|
||||||
using ftxui::size;
|
|
||||||
|
|
||||||
using ftxui::focusCursorBlock;
|
|
||||||
using ftxui::focusCursorBlockBlinking;
|
|
||||||
using ftxui::focusCursorBar;
|
|
||||||
using ftxui::focusCursorBarBlinking;
|
|
||||||
using ftxui::focusCursorUnderline;
|
|
||||||
using ftxui::focusCursorUnderlineBlinking;
|
|
||||||
|
|
||||||
using ftxui::vscroll_indicator;
|
|
||||||
using ftxui::hscroll_indicator;
|
|
||||||
using ftxui::reflect;
|
|
||||||
using ftxui::clear_under;
|
|
||||||
|
|
||||||
using ftxui::hcenter;
|
|
||||||
using ftxui::vcenter;
|
|
||||||
using ftxui::center;
|
|
||||||
using ftxui::align_right;
|
|
||||||
using ftxui::nothing;
|
|
||||||
|
|
||||||
namespace Dimension {
|
|
||||||
using ftxui::Dimension::Fit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file FlexboxConfig.cppm
|
|
||||||
* @brief Module file for the FlexboxConfig struct of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/flexbox_config.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.FlexboxConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::FlexboxConfig;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file LinearGradient.cppm
|
|
||||||
* @brief Module file for the LinearGradient struct of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/linear_gradient.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.LinearGradient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::LinearGradient;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Node.cppm
|
|
||||||
* @brief Module file for the Node class of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/node.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Node;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Node;
|
|
||||||
using ftxui::Screen;
|
|
||||||
|
|
||||||
using ftxui::Element;
|
|
||||||
using ftxui::Elements;
|
|
||||||
|
|
||||||
using ftxui::Render;
|
|
||||||
using ftxui::GetNodeSelectedContent;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Requirement.cppm
|
|
||||||
* @brief Module file for the Requirement struct of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/requirement.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Requirement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Requirement;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Selection.cppm
|
|
||||||
* @brief Module file for the Selection class of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/selection.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Selection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Selection;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Table.cppm
|
|
||||||
* @brief Module file for the Table class of the Dom module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/dom/table.hpp>
|
|
||||||
|
|
||||||
export module ftxui.dom.Table;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Table;
|
|
||||||
using ftxui::TableSelection;
|
|
||||||
}
|
|
||||||
@@ -45,6 +45,59 @@ class DBox : public Node {
|
|||||||
child->SetBox(box);
|
child->SetBox(box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Render(Screen& screen) override {
|
||||||
|
if (children_.size() <= 1) {
|
||||||
|
Node::Render(screen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int width = box_.x_max - box_.x_min + 1;
|
||||||
|
const int height = box_.y_max - box_.y_min + 1;
|
||||||
|
std::vector<Pixel> pixels(std::size_t(width * height));
|
||||||
|
|
||||||
|
for (auto& child : children_) {
|
||||||
|
child->Render(screen);
|
||||||
|
|
||||||
|
// Accumulate the pixels
|
||||||
|
Pixel* acc = pixels.data();
|
||||||
|
for (int x = 0; x < width; ++x) {
|
||||||
|
for (int y = 0; y < height; ++y) {
|
||||||
|
auto& pixel = screen.PixelAt(x + box_.x_min, y + box_.y_min);
|
||||||
|
acc->background_color =
|
||||||
|
Color::Blend(acc->background_color, pixel.background_color);
|
||||||
|
acc->automerge = pixel.automerge || acc->automerge;
|
||||||
|
if (pixel.character.empty()) {
|
||||||
|
acc->foreground_color =
|
||||||
|
Color::Blend(acc->foreground_color, pixel.background_color);
|
||||||
|
} else {
|
||||||
|
acc->blink = pixel.blink;
|
||||||
|
acc->bold = pixel.bold;
|
||||||
|
acc->dim = pixel.dim;
|
||||||
|
acc->inverted = pixel.inverted;
|
||||||
|
acc->italic = pixel.italic;
|
||||||
|
acc->underlined = pixel.underlined;
|
||||||
|
acc->underlined_double = pixel.underlined_double;
|
||||||
|
acc->strikethrough = pixel.strikethrough;
|
||||||
|
acc->hyperlink = pixel.hyperlink;
|
||||||
|
acc->character = pixel.character;
|
||||||
|
acc->foreground_color = pixel.foreground_color;
|
||||||
|
}
|
||||||
|
++acc; // NOLINT
|
||||||
|
|
||||||
|
pixel = Pixel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the accumulated pixels:
|
||||||
|
Pixel* acc = pixels.data();
|
||||||
|
for (int x = 0; x < width; ++x) {
|
||||||
|
for (int y = 0; y < height; ++y) {
|
||||||
|
screen.PixelAt(x + box_.x_min, y + box_.y_min) = *acc++; // NOLINT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Decorator focusPositionRelative(float x, float y) {
|
|||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
NodeDecorator::ComputeRequirement();
|
NodeDecorator::ComputeRequirement();
|
||||||
requirement_.focused.enabled = true;
|
requirement_.focused.enabled = false;
|
||||||
requirement_.focused.node = this;
|
requirement_.focused.node = this;
|
||||||
requirement_.focused.box.x_min = int(float(requirement_.min_x) * x_);
|
requirement_.focused.box.x_min = int(float(requirement_.min_x) * x_);
|
||||||
requirement_.focused.box.y_min = int(float(requirement_.min_y) * y_);
|
requirement_.focused.box.y_min = int(float(requirement_.min_y) * y_);
|
||||||
|
|||||||
@@ -125,8 +125,6 @@ void Render(Screen& screen, Node* node, Selection& selection) {
|
|||||||
node->Select(selection);
|
node->Select(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->requirement().focused.enabled
|
|
||||||
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
|
||||||
// Setting the cursor to the right position allow folks using CJK (China,
|
// Setting the cursor to the right position allow folks using CJK (China,
|
||||||
// Japanese, Korean, ...) characters to see their [input method editor]
|
// Japanese, Korean, ...) characters to see their [input method editor]
|
||||||
// displayed at the right location. See [issue].
|
// displayed at the right location. See [issue].
|
||||||
@@ -138,14 +136,16 @@ void Render(Screen& screen, Node* node, Selection& selection) {
|
|||||||
// https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
|
// https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
|
||||||
//
|
//
|
||||||
// Unfortunately, Microsoft terminal do not handle properly hiding the
|
// Unfortunately, Microsoft terminal do not handle properly hiding the
|
||||||
// cursor. Instead the character under the cursor is hidden, which is a
|
// cursor. Instead the character under the cursor is hidden, which is a big
|
||||||
// big problem. As a result, we can't enable setting cursor to the right
|
// problem. As a result, we can't enable setting cursor to the right
|
||||||
// location. It will be displayed at the bottom right corner.
|
// location. It will be displayed at the bottom right corner.
|
||||||
// See:
|
// See:
|
||||||
// https://github.com/microsoft/terminal/issues/1203
|
// https://github.com/microsoft/terminal/issues/1203
|
||||||
// https://github.com/microsoft/terminal/issues/3093
|
// https://github.com/microsoft/terminal/issues/3093
|
||||||
&&
|
if (node->requirement().focused.enabled
|
||||||
node->requirement().focused.cursor_shape != Screen::Cursor::Shape::Hidden
|
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||||
|
||
|
||||||
|
node->requirement().focused.cursor_shape == Screen::Cursor::Shape::Hidden
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
screen.SetCursor(Screen::Cursor{
|
screen.SetCursor(Screen::Cursor{
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ TEST(SelectionTest, SelectionOnChangeSquashedEvents) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(SelectionTest, StyleSelection) {
|
TEST(SelectionTest, StyleSelection) {
|
||||||
|
int selectionChangeCounter = 0;
|
||||||
|
|
||||||
auto element = hbox({
|
auto element = hbox({
|
||||||
text("Lorem "),
|
text("Lorem "),
|
||||||
text("ipsum") | selectionColor(Color::Red),
|
text("ipsum") | selectionColor(Color::Red),
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Size : public Node {
|
|||||||
: Node(unpack(std::move(child))),
|
: Node(unpack(std::move(child))),
|
||||||
direction_(direction),
|
direction_(direction),
|
||||||
constraint_(constraint),
|
constraint_(constraint),
|
||||||
value_(std::max(0, value)) {}
|
value_(value) {}
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
Node::ComputeRequirement();
|
Node::ComputeRequirement();
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file ftxui.cppm
|
|
||||||
* @brief Module file re-exporting all FTXUI submodules.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export module ftxui;
|
|
||||||
|
|
||||||
export import ftxui.component;
|
|
||||||
export import ftxui.dom;
|
|
||||||
export import ftxui.screen;
|
|
||||||
export import ftxui.util;
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file screen.cppm
|
|
||||||
* @brief Module file for FTXUI screen operations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export module ftxui.screen;
|
|
||||||
|
|
||||||
export import ftxui.screen.Box;
|
|
||||||
export import ftxui.screen.Color;
|
|
||||||
export import ftxui.screen.ColorInfo;
|
|
||||||
export import ftxui.screen.Deprecated;
|
|
||||||
export import ftxui.screen.Image;
|
|
||||||
export import ftxui.screen.Pixel;
|
|
||||||
export import ftxui.screen.Screen;
|
|
||||||
export import ftxui.screen.String;
|
|
||||||
export import ftxui.screen.Terminal;
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Box.cppm
|
|
||||||
* @brief Module file for the Box struct of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/box.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Box;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Box;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Color.cppm
|
|
||||||
* @brief Module file for the Color class of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/color.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Color;
|
|
||||||
|
|
||||||
inline namespace literals {
|
|
||||||
using ftxui::literals::operator""_rgb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file ColorInfo.cppm
|
|
||||||
* @brief Module file for the ColorInfo struct of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/color_info.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.ColorInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::ColorInfo;
|
|
||||||
|
|
||||||
using ftxui::GetColorInfo;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Box.cppm
|
|
||||||
* @brief Module file for the deprecated parts of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/deprecated.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Deprecated;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::wchar_width;
|
|
||||||
using ftxui::wstring_width;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Image.cppm
|
|
||||||
* @brief Module file for the Image class of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/image.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Image;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Image;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Pixel.cppm
|
|
||||||
* @brief Module file for the Pixel struct of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/pixel.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Pixel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Pixel;
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Screen.cppm
|
|
||||||
* @brief Module file for the Screen class of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/screen.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Screen;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
namespace Dimension {
|
|
||||||
using ftxui::Dimension::Fixed;
|
|
||||||
using ftxui::Dimension::Full;
|
|
||||||
}
|
|
||||||
|
|
||||||
using ftxui::Image;
|
|
||||||
using ftxui::Screen;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file String.cppm
|
|
||||||
* @brief Module file for string functions of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/string.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.String;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::to_string;
|
|
||||||
using ftxui::to_wstring;
|
|
||||||
using ftxui::string_width;
|
|
||||||
using ftxui::Utf8ToGlyphs;
|
|
||||||
using ftxui::CellToGlyphIndex;
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Terminal.cppm
|
|
||||||
* @brief Module file for the Terminal namespace of the Screen module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/screen/terminal.hpp>
|
|
||||||
|
|
||||||
export module ftxui.screen.Terminal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::Dimensions;
|
|
||||||
|
|
||||||
namespace Terminal {
|
|
||||||
using ftxui::Terminal::Size;
|
|
||||||
using ftxui::Terminal::SetFallbackSize;
|
|
||||||
using ftxui::Terminal::Color;
|
|
||||||
using ftxui::Terminal::ColorSupport;
|
|
||||||
using ftxui::Terminal::SetColorSupport;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file util.cppm
|
|
||||||
* @brief Module file for FTXUI utility operations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export module ftxui.util;
|
|
||||||
|
|
||||||
export import ftxui.util.AutoReset;
|
|
||||||
export import ftxui.util.Ref;
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file AutoReset.cppm
|
|
||||||
* @brief Module file for the AutoReset class of the Util module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/util/autoreset.hpp>
|
|
||||||
|
|
||||||
export module ftxui.util.AutoReset;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::AutoReset;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file Ref.cppm
|
|
||||||
* @brief Module file for the Ref classes of the Util module
|
|
||||||
*/
|
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <ftxui/util/ref.hpp>
|
|
||||||
|
|
||||||
export module ftxui.util.Ref;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace ftxui
|
|
||||||
* @brief The FTXUI ftxui:: namespace
|
|
||||||
*/
|
|
||||||
export namespace ftxui {
|
|
||||||
using ftxui::ConstRef;
|
|
||||||
using ftxui::Ref;
|
|
||||||
using ftxui::StringRef;
|
|
||||||
using ftxui::ConstStringRef;
|
|
||||||
using ftxui::ConstStringListRef;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Generate ./examples_modules from ./examples to using C++20 modules instead of
|
|
||||||
# #includes for ftxui.
|
|
||||||
# This is useful for testing ftxui with modules. This ensures we don't forget
|
|
||||||
# to update the FTXUI modules when adding new features to FTXUI.
|
|
||||||
|
|
||||||
echo "Generating ./examples_modules"
|
|
||||||
rm -rf ./examples_modules
|
|
||||||
cp -r ./examples ./examples_modules
|
|
||||||
|
|
||||||
for file in ./examples_modules/**/*.cpp; do
|
|
||||||
echo "Generating $file"
|
|
||||||
|
|
||||||
sed -i '/#include "ftxui/d' "$file"
|
|
||||||
sed -i '/#include <ftxui/d' "$file"
|
|
||||||
sed -i '1i\import ftxui.component;' "$file"
|
|
||||||
sed -i '2i\import ftxui.dom;' "$file"
|
|
||||||
sed -i '3i\import ftxui.screen;' "$file"
|
|
||||||
sed -i '4i\import ftxui.util;' "$file"
|
|
||||||
sed -i '5i\\' "$file"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Modify the CMakeLists.txt file to link against ftxui-modules
|
|
||||||
sed -i 's/${DIRECTORY_LIB}/ftxui-modules/g' ./examples_modules/CMakeLists.txt
|
|
||||||
sed -i 's/ftxui_example_/ftxui_modules_example_/g' ./examples_modules/CMakeLists.txt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# This script tests the project with different versions of Bazel and compilers
|
|
||||||
# locally. This avoids waiting on the CI to run the tests.
|
|
||||||
|
|
||||||
for ver in \
|
|
||||||
"6.0.0" \
|
|
||||||
"7.0.0" \
|
|
||||||
"8.0.0"
|
|
||||||
do
|
|
||||||
for cc in \
|
|
||||||
"gcc" \
|
|
||||||
"clang"
|
|
||||||
do
|
|
||||||
echo "=== Testing with Bazel ${ver} with ${cc} ==="
|
|
||||||
USE_BAZEL_VERSION=${ver} CC=${cc} bazel clean --expunge
|
|
||||||
USE_BAZEL_VERSION=${ver} CC=${cc} bazel build //...
|
|
||||||
USE_BAZEL_VERSION=${ver} CC=${cc} bazel test //...
|
|
||||||
done
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user