Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,13 @@
EOF,
];

$finder = PhpCsFixer\Finder::create()
// Some directories may not exist when running Fabbot action, if no files under them were changed.
->in(array_filter([__DIR__.'/src', __DIR__.'/apps'], is_dir(...)))
->append([__FILE__])
->notPath('#/Fixtures/#')
->notPath('#/assets/#')
->notPath('#/var/#')
// does not work well with `fully_qualified_strict_types` rule
->notPath('LiveComponent/tests/Integration/LiveComponentHydratorTest.php')
// apps/
->notPath(['#config/#', '#public/#', 'importmap.php'])
;

return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PHP81Migration' => true, // take lowest version from `git grep -h '"php"' **/composer.json | uniq | sort`
'@PHPUnit91Migration:risky' => true,
'@PHP8x1Migration' => true, // take lowest version from `git grep -h '"php"' **/composer.json | uniq | sort`
'@PHPUnit9x1Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'protected_to_private' => false,
'header_comment' => [
'header' => implode('', $fileHeaderParts),
'validator' => implode('', [
Expand All @@ -56,5 +42,13 @@
],
])
->setRiskyAllowed(true)
->setFinder($finder)
->setFinder((new PhpCsFixer\Finder())
->in(__DIR__)
->append([__FILE__])
->notPath('#/Fixtures/#')
->notPath('#/assets/#')
->notPath('#/var/#')
// apps/
->notPath(['#config/#', '#public/#', 'importmap.php'])
)
;
9 changes: 9 additions & 0 deletions apps/encore/src/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/

// @php-cs-fixer-ignore fully_qualified_strict_types Due to https://github.com/symfony/ux/pull/2768#issuecomment-2905091761

namespace Symfony\UX\LiveComponent\Tests\Integration;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand Down Expand Up @@ -155,6 +157,7 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer

/**
* @group transient-on-windows
*
* @dataProvider provideDehydrationHydrationTests
*/
public function testCanDehydrateAndHydrateComponentWithTestCases(callable $testFactory, ?int $minPhpVersion = null)
Expand Down
45 changes: 0 additions & 45 deletions ux.symfony.com/.php-cs-fixer.dist.php

This file was deleted.

9 changes: 9 additions & 0 deletions ux.symfony.com/migrations/Version20220610165503.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
Expand Down
9 changes: 9 additions & 0 deletions ux.symfony.com/migrations/Version20220615204017.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
Expand Down
9 changes: 9 additions & 0 deletions ux.symfony.com/migrations/Version20220617021557.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
Expand Down
9 changes: 9 additions & 0 deletions ux.symfony.com/migrations/Version20220617110534.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
Expand Down
9 changes: 9 additions & 0 deletions ux.symfony.com/migrations/Version20230418200005.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
Expand Down
2 changes: 1 addition & 1 deletion ux.symfony.com/src/Controller/Demo/LiveDemoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function inlineEdit(LiveDemoRepository $liveDemoRepository, FoodRepositor
#[Route('/invoice/{id}', name: 'app_demo_live_component_invoice', defaults: ['id' => null])]
public function invoice(LiveDemoRepository $liveDemoRepository, ?Invoice $invoice = null): Response
{
$invoice = $invoice ?? new Invoice();
$invoice ??= new Invoice();

return $this->render('demos/live_component/invoice.html.twig', parameters: [
'demo' => $liveDemoRepository->find('invoice'),
Expand Down
20 changes: 10 additions & 10 deletions ux.symfony.com/src/Controller/Toolkit/ComponentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ public function previewComponent(
$kit = $this->toolkitService->getKit($kitId);

$template = $twig->createTemplate(<<<HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Preview</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ importmap('toolkit-{$kitId->value}') }}
</head>
<body class="flex min-h-[{$height}] w-full justify-center p-5 items-center">{$code}</body>
</html>
HTML);
<html lang="en">
<head>
<meta charset="utf-8">
<title>Preview</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ importmap('toolkit-{$kitId->value}') }}
</head>
<body class="flex min-h-[{$height}] w-full justify-center p-5 items-center">{$code}</body>
</html>
HTML);

return new Response(
$kitContextRunner->runForKit($kit, fn () => $twig->render($template)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer): s
}

return <<<HTML
<div class="Wysiwyg_Tabs" data-controller="tabs" data-tabs-tab-value="{$activeTabId}" data-tabs-active-class="active">
<nav class="Wysiwyg_TabHead" role="tablist" style="border-bottom: 1px solid var(--bs-border-color)">{$tabsControls}</nav>
<div class="Wysiwyg_TabBody">{$tabsPanels}</div>
</div>
HTML;
<div class="Wysiwyg_Tabs" data-controller="tabs" data-tabs-tab-value="{$activeTabId}" data-tabs-active-class="active">
<nav class="Wysiwyg_TabHead" role="tablist" style="border-bottom: 1px solid var(--bs-border-color)">{$tabsControls}</nav>
<div class="Wysiwyg_TabBody">{$tabsPanels}</div>
</div>
HTML;
}
}
64 changes: 32 additions & 32 deletions ux.symfony.com/src/Service/LiveDemoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function findAll(): array
publishedAt: '2024-06-07',
tags: ['grid', 'pagination', 'loading', 'scroll'],
longDescription: <<<EOF
The second and final part of the **Infinite Scroll Serie**, with a new range of (lovely) T-Shirts!
Now with `automatic loading on scroll`, a new trick and amazing `loading animations`!
EOF,
The second and final part of the **Infinite Scroll Serie**, with a new range of (lovely) T-Shirts!
Now with `automatic loading on scroll`, a new trick and amazing `loading animations`!
EOF,
),
new LiveDemo(
'infinite-scroll',
Expand All @@ -41,9 +41,9 @@ public function findAll(): array
publishedAt: '2024-06-07',
tags: ['grid', 'pagination', 'navigation'],
longDescription: <<<EOF
Infinite scroll allows users to continuously load content as they scroll down the page.
`Part One` of this demo shows how to `append new items` to the page with a [`LiveComponent`](/live-component).
EOF,
Infinite scroll allows users to continuously load content as they scroll down the page.
`Part One` of this demo shows how to `append new items` to the page with a [`LiveComponent`](/live-component).
EOF,
),
new LiveDemo(
'live-memory',
Expand All @@ -53,10 +53,10 @@ public function findAll(): array
publishedAt: '2024-06-07',
tags: ['game', 'time', 'events', 'LiveAction'],
longDescription: <<<EOF
A Memorable Game UX with Live Components! Discover how to use Live Components to create a game with a vibrant interface,
rich interactions and real-time updates. This journey will take you through many features of Live Components, and you'll
learn how to use them to create a fun and engaging game.
EOF,
A Memorable Game UX with Live Components! Discover how to use Live Components to create a game with a vibrant interface,
rich interactions and real-time updates. This journey will take you through many features of Live Components, and you'll
learn how to use them to create a fun and engaging game.
EOF,
),
new LiveDemo(
'auto-validating-form',
Expand All @@ -66,12 +66,12 @@ public function findAll(): array
publishedAt: '2022-06-17',
tags: ['form', 'validation', 'inline'],
longDescription: <<<EOF
Enter a bad email or leave the password empty, and see how the
form validates in real time!
Enter a bad email or leave the password empty, and see how the
form validates in real time!

This renders a normal `Symfony` form but with extras added on top,
all generated from Symfony & Twig.
EOF,
This renders a normal `Symfony` form but with extras added on top,
all generated from Symfony & Twig.
EOF,
),
new LiveDemo(
'form-collection-type',
Expand All @@ -81,9 +81,9 @@ public function findAll(): array
publishedAt: '2022-06-17',
tags: ['form', 'collection'],
longDescription: <<<EOF
Unlock the potential of Symfony's [`CollectionType`](https://symfony.com/doc/current/reference/forms/types/collection.html) while writing zero JavaScript.
This demo shows off adding and removing items entirely in PHP & Twig.
EOF,
Unlock the potential of Symfony's [`CollectionType`](https://symfony.com/doc/current/reference/forms/types/collection.html) while writing zero JavaScript.
This demo shows off adding and removing items entirely in PHP & Twig.
EOF,
),
new LiveDemo(
'dependent-form-fields',
Expand All @@ -93,8 +93,8 @@ public function findAll(): array
publishedAt: '2022-06-17',
tags: ['form', 'field', 'events'],
longDescription: <<<EOF
Unleash the power of form events, thanks to [`LiveComponent`](/live-component) and [`DynamicForms`](https://github.com/SymfonyCasts/dynamic-forms).
EOF,
Unleash the power of form events, thanks to [`LiveComponent`](/live-component) and [`DynamicForms`](https://github.com/SymfonyCasts/dynamic-forms).
EOF,
),
new LiveDemo(
'voting',
Expand All @@ -104,9 +104,9 @@ public function findAll(): array
publishedAt: '2022-06-17',
tags: ['form', 'LiveAction'],
longDescription: <<<EOF
With each row as its own component, it's easy to add up & down voting + keep track of which items have been voted on.
This uses a [LiveAction](https://symfony.com/bundles/ux-live-component/current/index.html#actions) to save everything with Ajax.
EOF,
With each row as its own component, it's easy to add up & down voting + keep track of which items have been voted on.
This uses a [LiveAction](https://symfony.com/bundles/ux-live-component/current/index.html#actions) to save everything with Ajax.
EOF,
),
new LiveDemo(
'inline-edit',
Expand All @@ -116,9 +116,9 @@ public function findAll(): array
publishedAt: '2023-02-21',
tags: ['form', 'inline', 'LiveAction'],
longDescription: <<<EOF
Inline editing? Simple. Use LiveComponents to track if you're in "edit" mode, let
the user update any fields on your entity, and save through a `LiveAction`.
EOF,
Inline editing? Simple. Use LiveComponents to track if you're in "edit" mode, let
the user update any fields on your entity, and save through a `LiveAction`.
EOF,
),
new LiveDemo(
'chartjs',
Expand All @@ -128,10 +128,10 @@ public function findAll(): array
publishedAt: '2023-03-16',
tags: ['chart', 'data', 'LiveAction', 'stimulus'],
longDescription: <<<EOF
What do you get with Live Components + UX Chart.js + UX Autocomplete?
What do you get with Live Components + UX Chart.js + UX Autocomplete?

An auto-updating chart that you will ❤️.
EOF,
An auto-updating chart that you will ❤️.
EOF,
),
new LiveDemo(
'invoice',
Expand All @@ -141,10 +141,10 @@ public function findAll(): array
publishedAt: '2023-04-20',
tags: ['form', 'entity', 'events', 'LiveAction'],
longDescription: <<<EOF
Create or edit an `Invoice` entity along with child components for each related `InvoiceItem` entity.
Create or edit an `Invoice` entity along with child components for each related `InvoiceItem` entity.

Children components emit events to communicate to the parent and everything is saved in a `saveInvoice` LiveAction method.
EOF,
Children components emit events to communicate to the parent and everything is saved in a `saveInvoice` LiveAction method.
EOF,
),
new LiveDemo(
'product-form',
Expand Down
Loading
Loading