Skip to content

Commit

Permalink
Update tui.php and composer.json
Browse files Browse the repository at this point in the history
Updated tui.php to add new widgets and infinitely draw the display. Also, changed the php-tui dependence in composer.json from a specific version to the development branch. This commit has extensive updates to the terminal user interface, enhancing the features and functionality.
  • Loading branch information
AuroraYolo committed Nov 29, 2023
1 parent b223371 commit 1d69ffe
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"hyperf/utils": "~3.0.0",
"hyperf/validation": "^3.0",
"jetbrains/phpstorm-attributes": "^1.0",
"php-tui/php-tui": "^0.0.2",
"php-tui/php-tui": "dev-main",
"phper666/jwt-auth": "^4.0",
"ramsey/uuid": "^4.7",
"swow-cloud/debugger": "^0.1.0",
Expand Down
103 changes: 93 additions & 10 deletions tui.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,107 @@
<?php

declare(strict_types=1);
/**
* This file is part of Cloud-Admin project.
*
* @link https://www.cloud-admin.jayjay.cn
* @document https://wiki.cloud-admin.jayjay.cn
* @license https://github.com/swow-cloud/swow-admin/blob/master/LICENSE
*/

use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\Core\Shape\MapResolution;
use PhpTui\Tui\Extension\Core\Shape\MapShape;
use PhpTui\Tui\Extension\Core\Widget\Block\Padding;
use PhpTui\Tui\Extension\Core\Widget\BlockWidget;
use PhpTui\Tui\Extension\Core\Widget\CanvasWidget;
use PhpTui\Tui\Extension\Core\Widget\GridWidget;
use PhpTui\Tui\Extension\Core\Widget\ParagraphWidget;
use PhpTui\Tui\Model\Direction;
use PhpTui\Tui\Model\Layout\Constraint;
use PhpTui\Tui\Model\Text\Text;
use PhpTui\Tui\Model\Text\Title;
use PhpTui\Tui\Model\Widget\Borders;
use PhpTui\Tui\Model\Widget\BorderType;

require 'vendor/autoload.php';

$display = DisplayBuilder::default()->build();
$display->clear();
$display->draw(
CanvasWidget::fromIntBounds(-180, 180, -90, 90)
->draw(
MapShape::default()->resolution(MapResolution::High)
GridWidget::default()
->direction(Direction::Horizontal)
->constraints(
Constraint::percentage(50),
Constraint::percentage(50)
)
->widgets(
BlockWidget::default()
->titles(Title::fromString('Left'))
->padding(Padding::all(2))
->borders(Borders::ALL)
->borderType(BorderType::Rounded)
->widget(
CanvasWidget::fromIntBounds(-180, 180, -90, 90)
->draw(
MapShape::default()->resolution(MapResolution::High)
),
),
BlockWidget::default()
->titles(Title::fromString('Right'))
->padding(Padding::all(2))
->borders(Borders::ALL)
->borderType(BorderType::Rounded)
->widget(
ParagraphWidget::fromText(
Text::parse(<<<'EOT'
The <fg=green>world</> is the totality of <options=bold>entities</>,
the whole of reality, or everything that is.[1] The nature of the
world has been <fg=red>conceptualized</> differently in different fields. Some
conceptions see the world as unique while others talk of a
plurality of <bg=green>worlds</>.
EOT
)
)
),
)
);
$i = 0;
while (true) {
$i++;
if ($i > 100) {
break;
}
$display->draw(
GridWidget::default()
->direction(Direction::Horizontal)
->constraints(
Constraint::percentage(50),
Constraint::percentage(50)
)
->widgets(
BlockWidget::default()
->titles(Title::fromString('Left'))
->padding(Padding::all(2))
->borders(Borders::ALL)
->borderType(BorderType::Rounded)
->widget(
CanvasWidget::fromIntBounds(-180, 180, -90, 90)
->draw(
MapShape::default()->resolution(MapResolution::High)
),
),
BlockWidget::default()
->titles(Title::fromString('Right'))
->padding(Padding::all(2))
->borders(Borders::ALL)
->borderType(BorderType::Rounded)
->widget(
ParagraphWidget::fromText(
Text::parse(<<<'EOT'
The <fg=green>world</> is the totality of <options=bold>entities</>,
the whole of reality, or everything that is.[1] The nature of the
world has been <fg=red>conceptualized</> differently in different fields. Some
conceptions see the world as unique while others talk of a
plurality of <bg=green>worlds</>.
EOT
)
)
),
)
);
sleep(3);
}

0 comments on commit 1d69ffe

Please sign in to comment.