File manager - Edit - /home/u816558632/domains/postills.com/public_html/public/nunomaduro.zip
Back
PK ��Z�)Ȁ� � termwind/playground.phpnu �[��� <?php require_once __DIR__.'/vendor/autoload.php'; use function Termwind\render; render(<<<'HTML' <div class="mx-2 my-1"> <div class="flex space-x-1"> <span class="flex-1 truncate">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sunt illo et nisi omnis porro at, mollitia harum quas esse, aperiam dolorem ab recusandae fugiat nesciunt doloribus rem eaque nostrum itaque.</span> <span class="text-green">DONE</span> </div> </div> HTML); PK ��Z��� termwind/composer.jsonnu �[��� { "name": "nunomaduro/termwind", "description": "Its like Tailwind CSS, but for the console.", "keywords": ["php", "cli", "package", "console", "css", "style"], "license": "MIT", "authors": [ { "name": "Nuno Maduro", "email": "enunomaduro@gmail.com" } ], "require": { "php": "^8.0", "ext-mbstring": "*", "symfony/console": "^5.3.0|^6.0.0" }, "require-dev": { "ergebnis/phpstan-rules": "^1.0.", "illuminate/console": "^8.0|^9.0", "illuminate/support": "^8.0|^9.0", "laravel/pint": "^1.0.0", "pestphp/pest": "^1.21.0", "pestphp/pest-plugin-mock": "^1.0", "phpstan/phpstan": "^1.4.6", "phpstan/phpstan-strict-rules": "^1.1.0", "symfony/var-dumper": "^5.2.7|^6.0.0", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "autoload": { "psr-4": { "Termwind\\": "src/" }, "files": [ "src/Functions.php" ] }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "config": { "sort-packages": true, "preferred-install": "dist", "allow-plugins": { "pestphp/pest-plugin": true } }, "scripts": { "lint": "pint -v", "test:lint": "pint --test -v", "test:types": "phpstan analyse --ansi", "test:unit": "pest --colors=always", "test": [ "@test:lint", "@test:types", "@test:unit" ] }, "extra": { "laravel": { "providers": [ "Termwind\\Laravel\\TermwindServiceProvider" ] } } } PK ��Z�2B� � termwind/docker-compose.ymlnu �[��� version: '3' services: app: image: termwind-docker container_name: termwind-docker stdin_open: true tty: true build: context: . dockerfile: docker/Dockerfile volumes: - .:/usr/src/app PK ��Zm���� � termwind/Makefilenu �[��� # Well documented Makefiles DEFAULT_GOAL := help help: @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-40s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) ##@ [Docker] start: ## Spin up the container docker-compose up -d stop: ## Shut down the containers docker-compose down build: ## Build all docker images docker-compose build ##@ [Application] composer: ## Run composer commands. Specify the command e.g. via "make composer ARGS="install|update|require <dependency>" docker-compose run --rm app composer $(ARGS) lint: ## Run the Linter docker-compose run --rm app ./vendor/bin/pint -v test-lint: ## Run the Linter Test docker-compose run --rm app ./vendor/bin/pint --test -v test-types: ## Run the PHPStan analysis docker-compose run --rm app ./vendor/bin/phpstan analyse --ansi test-unit: ## Run the Pest Test Suite docker-compose run --rm app ./vendor/bin/pest --colors=always test: ## Run the tests. Apply arguments via make test ARGS="--init" make test-lint && make test-types && make test-unit PK ��Z�d� � termwind/src/Question.phpnu �[��� <?php declare(strict_types=1); namespace Termwind; use ReflectionClass; use Symfony\Component\Console\Helper\SymfonyQuestionHelper; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Question\Question as SymfonyQuestion; use Symfony\Component\Console\Style\SymfonyStyle; use Termwind\Helpers\QuestionHelper; /** * @internal */ final class Question { /** * The streamable input to receive the input from the user. */ private static StreamableInputInterface|null $streamableInput; /** * An instance of Symfony's question helper. */ private SymfonyQuestionHelper $helper; public function __construct(SymfonyQuestionHelper $helper = null) { $this->helper = $helper ?? new QuestionHelper(); } /** * Sets the streamable input implementation. */ public static function setStreamableInput(StreamableInputInterface|null $streamableInput): void { self::$streamableInput = $streamableInput ?? new ArgvInput(); } /** * Gets the streamable input implementation. */ public static function getStreamableInput(): StreamableInputInterface { return self::$streamableInput ??= new ArgvInput(); } /** * Renders a prompt to the user. * * @param iterable<array-key, string>|null $autocomplete */ public function ask(string $question, iterable $autocomplete = null): mixed { $html = (new HtmlRenderer)->parse($question)->toString(); $question = new SymfonyQuestion($html); if ($autocomplete !== null) { $question->setAutocompleterValues($autocomplete); } $output = Termwind::getRenderer(); if ($output instanceof SymfonyStyle) { $property = (new ReflectionClass(SymfonyStyle::class)) ->getProperty('questionHelper'); $property->setAccessible(true); $currentHelper = $property->isInitialized($output) ? $property->getValue($output) : new SymfonyQuestionHelper(); $property->setValue($output, new QuestionHelper); try { return $output->askQuestion($question); } finally { $property->setValue($output, $currentHelper); } } return $this->helper->ask( self::getStreamableInput(), Termwind::getRenderer(), $question, ); } } PK ��Z�b�� � ( termwind/src/Exceptions/InvalidStyle.phpnu �[��� <?php declare(strict_types=1); namespace Termwind\Exceptions; use InvalidArgumentException; /** * @internal */ final class InvalidStyle extends InvalidArgumentException { } PK ��Z#�D�O O ) termwind/src/Exceptions/StyleNotFound.phpnu �[��� <?php declare(strict_types=1); namespace Termwind\Exceptions; use InvalidArgumentException; /** * @internal */ final class StyleNotFound extends InvalidArgumentException { /** * Creates a new style not found instance. */ private function __construct(string $message) { parent::__construct($message, 0, $this->getPrevious()); } /** * Creates a new style not found instance from the given style. */ public static function fromStyle(string $style): self { return new self(sprintf('Style [%s] not found.', $style)); } } PK ��Z��� � ) termwind/src/Exceptions/ColorNotFound.phpnu �[��� <?php declare(strict_types=1); namespace Termwind\Exceptions; use InvalidArgumentException; /** * @internal */ final class ColorNotFound extends InvalidArgumentException { } PK ��Z���� � ( termwind/src/Exceptions/InvalidChild.phpnu �[��� <?php declare(strict_types=1); namespace Termwind\Exceptions; use InvalidArgumentException; /** * @internal */ final class InvalidChild extends InvalidArgumentException { } PK ��ZF�s�� � ( termwind/src/Exceptions/InvalidColor.phpnu �[��� <?php declare(strict_types=1); namespace Termwind\Exceptions; use InvalidArgumentException; /** * @internal */ final class InvalidColor extends InvalidArgumentException { } PK ��Z��{�7 7 termwind/src/HtmlRenderer.phpnu �[��� <?php declare(strict_types=1); namespace Termwind; use DOMDocument; use DOMNode; use Termwind\Html\CodeRenderer; use Termwind\Html\PreRenderer; use Termwind\Html\TableRenderer; use Termwind\ValueObjects\Node; /** * @internal */ final class HtmlRenderer { /** * Renders the given html. */ public function render(string $html, int $options): void { $this->parse($html)->render($options); } /** * Parses the given html. */ public function parse(string $html): Components\Element { $dom = new DOMDocument(); if (strip_tags($html) === $html) { return Termwind::span($html); } $html = '<?xml encoding="UTF-8">'.trim($html); $dom->loadHTML($html, LIBXML_NOERROR | LIBXML_COMPACT | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS | LIBXML_NOXMLDECL); /** @var DOMNode $body */ $body = $dom->getElementsByTagName('body')->item(0); $el = $this->convert(new Node($body)); // @codeCoverageIgnoreStart return is_string($el) ? Termwind::span($el) : $el; // @codeCoverageIgnoreEnd } /** * Convert a tree of DOM nodes to a tree of termwind elements. */ private function convert(Node $node): Components\Element|string { $children = []; if ($node->isName('table')) { return (new TableRenderer)->toElement($node); } elseif ($node->isName('code')) { return (new CodeRenderer)->toElement($node); } elseif ($node->isName('pre')) { return (new PreRenderer)->toElement($node); } foreach ($node->getChildNodes() as $child) { $children[] = $this->convert($child); } $children = array_filter($children, fn ($child) => $child !== ''); return $this->toElement($node, $children); } /** * Convert a given DOM node to it's termwind element equivalent. * * @param array<int, Components\Element|string> $children */ private function toElement(Node $node, array $children): Components\Element|string { if ($node->isText() || $node->isComment()) { return (string) $node; } /** @var array<string, mixed> $properties */ $properties = [ 'isFirstChild' => $node->isFirstChild(), ]; $styles = $node->getClassAttribute(); return match ($node->getName()) { 'body' => $children[0], // Pick only the first element from the body node 'div' => Termwind::div($children, $styles, $properties), 'p' => Termwind::paragraph($children, $styles, $properties), 'ul' => Termwind::ul($children, $styles, $properties), 'ol' => Termwind::ol($children, $styles, $properties), 'li' => Termwind::li($children, $styles, $properties), 'dl' => Termwind::dl($children, $styles, $properties), 'dt' => Termwind::dt($children, $styles, $properties), 'dd' => Termwind::dd($children, $styles, $properties), 'span' => Termwind::span($children, $styles, $properties), 'br' => Termwind::breakLine($styles, $properties), 'strong' => Termwind::span($children, $styles, $properties)->strong(), 'b' => Termwind::span($children, $styles, $properties)->fontBold(), 'em', 'i' => Termwind::span($children, $styles, $properties)->italic(), 'u' => Termwind::span($children, $styles, $properties)->underline(), 's' => Termwind::span($children, $styles, $properties)->lineThrough(), 'a' => Termwind::anchor($children, $styles, $properties)->href($node->getAttribute('href')), 'hr' => Termwind::hr($styles, $properties), default => Termwind::div($children, $styles, $properties), }; } } PK ��Z��:� � $ termwind/src/Repositories/Styles.phpnu �[��� <?php declare(strict_types=1); namespace Termwind\Repositories; use Closure; use Termwind\ValueObjects\Style; use Termwind\ValueObjects\Styles as StylesValueObject; /** * @internal */ final class Styles { /** * @var array<string, Style> */ private static array $storage = []; /** * Creates a new style from the given arguments. * * @param (Closure(StylesValueObject $element, string|int ...$arguments): StylesValueObject)|null $callback * @return Style */ public static function create(string $name, Closure $callback = null): Style { self::$storage[$name] = $style = new Style( $callback ?? static fn (StylesValueObject $styles) => $styles ); return $style; } /** * Removes all existing styles. */ public static function flush(): void { self::$storage = []; } /** * Checks a style with the given name exists. */ public static function has(string $name): bool { return array_key_exists($name, self::$storage); } /** * Gets the style with the given name. */ public static function get(string $name): Style { return self::$storage[$name]; } } PK ��ZI�t�K K &