Skip to content

Commit 2defab2

Browse files
committed
feature #1419 [Live][Stimulus] Prepping the LiveComponent Stable Release 🚀 (weaverryan)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Live][Stimulus] Prepping the LiveComponent Stable Release 🚀 | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Issues | None | License | MIT Hi! LiveComponents has, really, been quite stable for a long time, but it's kept its experimental status. Removing that is really about deciding that we'll protect backwards-compatibility. It's time to do that :). This is planned as the 2.15.0 release near the end of Feb (assuming we get the items below done before then). TODOs: * #1418 * Possibly remove Twig 2.x compat * #1428 * #1392 * Moving `Idiomorph` to a peer dependency would be great, but blocked by bigskysoftware/idiomorph#35 - **still need a tag** for the PR merge * #1426 as it may include some edge-case BC breaks. If there's anything else on your mind before stable, now is the time to mention it :). Cheers! Commits ------- 7932a9d [Live][Stimulus] Prepping the LiveComponent Stable Release 🚀
2 parents b72aeaa + 7932a9d commit 2defab2

File tree

64 files changed

+36
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+36
-127
lines changed

src/LiveComponent/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Live Components
22

3-
**EXPERIMENTAL** This component is currently experimental and is
4-
likely to change, or even change drastically.
5-
63
Live components work with the [TwigComponent](https://symfony.com/bundles/ux-twig-component/current/index.html)
74
library to give you the power to automatically update your
85
Twig components on the frontend as the user interacts with them.
96
Inspired by [Livewire](https://laravel-livewire.com/) and
107
[Phoenix LiveView](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html).
118

12-
Want a demo? Check out https://github.com/weaverryan/live-demo.
9+
Want a demo? Check out https://ux.symfony.com/live-component.
1310

1411
**This repository is a READ-ONLY sub-tree split**. See
1512
https://github.com/symfony/ux to create issues or submit pull requests.

src/LiveComponent/assets/dist/live_controller.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1374,9 +1374,9 @@ function executeMorphdom(rootFromElement, rootToElement, modifiedFieldElements,
13741374
if (modifiedFieldElements.includes(fromEl)) {
13751375
setValueOnElement(toEl, getElementValue(fromEl));
13761376
}
1377-
if (fromEl === document.activeElement
1378-
&& fromEl !== document.body
1379-
&& null !== getModelDirectiveFromElement(fromEl, false)) {
1377+
if (fromEl === document.activeElement &&
1378+
fromEl !== document.body &&
1379+
null !== getModelDirectiveFromElement(fromEl, false)) {
13801380
setValueOnElement(toEl, getElementValue(fromEl));
13811381
}
13821382
const elementChanges = externalMutationTracker.getChangedElement(fromEl);

src/LiveComponent/assets/src/morphdom.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ export function executeMorphdom(
110110
// We skip this for non-model elements and allow this to either
111111
// maintain the value if changed (see code above) or for the
112112
// morphing process to update it to the value from the server.
113-
if (fromEl === document.activeElement
114-
&& fromEl !== document.body
115-
&& null !== getModelDirectiveFromElement(fromEl, false)
113+
if (
114+
fromEl === document.activeElement &&
115+
fromEl !== document.body &&
116+
null !== getModelDirectiveFromElement(fromEl, false)
116117
) {
117118
setValueOnElement(toEl, getElementValue(fromEl));
118119
}

src/LiveComponent/doc/index.rst

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
Live Components
22
===============
33

4-
.. caution::
5-
6-
This component is currently experimental and is likely to change, or even
7-
change drastically.
8-
94
Live components builds on top of the `TwigComponent`_ library
105
to give you the power to automatically update your Twig components on
116
the frontend as the user interacts with them. Inspired by
@@ -3528,8 +3523,10 @@ This bundle aims at following the same Backward Compatibility promise as
35283523
the Symfony framework:
35293524
https://symfony.com/doc/current/contributing/code/bc.html
35303525

3531-
However it is currently considered `experimental`_, meaning it is not
3532-
bound to Symfony's BC policy for the moment.
3526+
For JavaScript files, the public API (i.e. documented features and exports
3527+
from the main JavaScript file) is protected by the backward compatibility
3528+
promise. However, any internal implementation in the JavaScript files
3529+
(i.e. exports from internal files) is not protected.
35333530

35343531
.. _`TwigComponent`: https://symfony.com/bundles/ux-twig-component/current/index.html
35353532
.. _TwigComponent documentation: https://symfony.com/bundles/ux-twig-component/current/index.html
@@ -3538,7 +3535,6 @@ bound to Symfony's BC policy for the moment.
35383535
.. _`Twig Component`: https://symfony.com/bundles/ux-twig-component/current/index.html
35393536
.. _`Twig Component mount documentation`: https://symfony.com/bundles/ux-twig-component/current/index.html#the-mount-method
35403537
.. _`Symfony form`: https://symfony.com/doc/current/forms.html
3541-
.. _`experimental`: https://symfony.com/doc/current/contributing/code/experimental.html
35423538
.. _`dependent form fields`: https://ux.symfony.com/live-component/demos/dependent-form-fields
35433539
.. _StimulusBundle configured in your app: https://symfony.com/bundles/StimulusBundle/current/index.html
35443540
.. _`attributes variable`: https://symfony.com/bundles/ux-twig-component/current/index.html#component-attributes

src/LiveComponent/src/Attribute/AsLiveComponent.php

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* @see https://symfony.com/bundles/ux-live-component
2121
*
2222
* @author Kevin Bond <[email protected]>
23-
*
24-
* @experimental
2523
*/
2624
#[\Attribute(\Attribute::TARGET_CLASS)]
2725
final class AsLiveComponent extends AsTwigComponent

src/LiveComponent/src/Attribute/LiveAction.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* An attribute to register a LiveAction method.
1616
*
1717
* @see https://symfony.com/bundles/ux-live-component/current/index.html#actions
18-
*
19-
* @experimental
2018
*/
2119
#[\Attribute(\Attribute::TARGET_METHOD)]
2220
class LiveAction

src/LiveComponent/src/Attribute/LiveArg.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* @see https://symfony.com/bundles/ux-live-component/current/index.html#actions-arguments
1818
*
1919
* @author Tomas Norkūnas <[email protected]>
20-
*
21-
* @experimental
2220
*/
2321
#[\Attribute(\Attribute::TARGET_PARAMETER)]
2422
final class LiveArg

src/LiveComponent/src/Attribute/LiveListener.php

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* method and re-render the component.
1919
*
2020
* @see https://symfony.com/bundles/ux-live-component/current/index.html#listeners
21-
*
22-
* @experimental
2321
*/
2422
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
2523
class LiveListener extends LiveAction

src/LiveComponent/src/Attribute/LiveProp.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* An attribute to mark a property as a "LiveProp".
1616
*
1717
* @see https://symfony.com/bundles/ux-live-component/current/index.html#liveprops-stateful-component-properties
18-
*
19-
* @experimental
2018
*/
2119
#[\Attribute(\Attribute::TARGET_PROPERTY)]
2220
final class LiveProp

src/LiveComponent/src/Attribute/PostHydrate.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
/**
1515
* An attribute to register a PostHydrate hook.
16-
*
17-
* @experimental
1816
*/
1917
#[\Attribute(\Attribute::TARGET_METHOD)]
2018
final class PostHydrate

src/LiveComponent/src/Attribute/PreDehydrate.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
/**
1515
* An attribute to register a PreDehydrate hook.
16-
*
17-
* @experimental
1816
*/
1917
#[\Attribute(\Attribute::TARGET_METHOD)]
2018
final class PreDehydrate

src/LiveComponent/src/Attribute/PreReRender.php

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*
1717
* This hook ONLY happens when rendering via HTTP: it does
1818
* not happen during the initial render of a component.
19-
*
20-
* @experimental
2119
*/
2220
#[\Attribute(\Attribute::TARGET_METHOD)]
2321
final class PreReRender

src/LiveComponent/src/ComponentToolsTrait.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* Trait with shortcut methods useful for live components.
1818
*
1919
* @author Ryan Weaver <[email protected]>
20-
*
21-
* @experimental
2220
*/
2321
trait ComponentToolsTrait
2422
{

src/LiveComponent/src/ComponentValidator.php

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
/**
2020
* @author Ryan Weaver <[email protected]>
2121
*
22-
* @experimental
23-
*
2422
* @internal
2523
*/
2624
class ComponentValidator implements ComponentValidatorInterface, ServiceSubscriberInterface

src/LiveComponent/src/ComponentValidatorInterface.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
/**
1717
* @author Ryan Weaver <[email protected]>
18-
*
19-
* @experimental
2018
*/
2119
interface ComponentValidatorInterface
2220
{

src/LiveComponent/src/ComponentWithFormTrait.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
/**
2525
* @author Ryan Weaver <[email protected]>
26-
*
27-
* @experimental
2826
*/
2927
trait ComponentWithFormTrait
3028
{

src/LiveComponent/src/DefaultActionTrait.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
/**
1515
* @author Kevin Bond <[email protected]>
16-
*
17-
* @experimental
1816
*/
1917
trait DefaultActionTrait
2018
{

src/LiveComponent/src/DependencyInjection/Compiler/ComponentDefaultActionPass.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
/**
1818
* @author Kevin Bond <[email protected]>
1919
*
20-
* @experimental
21-
*
2220
* @internal
2321
*/
2422
final class ComponentDefaultActionPass implements CompilerPassInterface

src/LiveComponent/src/DependencyInjection/Compiler/OptionalDependencyPass.php

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
/**
2222
* @author Kevin Bond <[email protected]>
2323
*
24-
* @experimental
25-
*
2624
* @internal
2725
*/
2826
final class OptionalDependencyPass implements CompilerPassInterface

src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php

-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
/**
5656
* @author Kevin Bond <[email protected]>
5757
*
58-
* @experimental
59-
*
6058
* @internal
6159
*/
6260
final class LiveComponentExtension extends Extension implements PrependExtensionInterface

src/LiveComponent/src/EventListener/AddLiveAttributesSubscriber.php

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*
3030
* @author Kevin Bond <[email protected]>
3131
*
32-
* @experimental
33-
*
3432
* @internal
3533
*/
3634
final class AddLiveAttributesSubscriber implements EventSubscriberInterface, ServiceSubscriberInterface

src/LiveComponent/src/EventListener/DeferLiveComponentSubscriber.php

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
use Symfony\UX\TwigComponent\Event\PostMountEvent;
1818
use Symfony\UX\TwigComponent\Event\PreRenderEvent;
1919

20+
/**
21+
* Handles the "defer" key, which causes the component to be rendered asynchronously.
22+
*
23+
* @internal
24+
*/
2025
final class DeferLiveComponentSubscriber implements EventSubscriberInterface
2126
{
2227
private const DEFAULT_LOADING_TAG = 'div';

src/LiveComponent/src/EventListener/InterceptChildComponentRenderSubscriber.php

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
*
2626
* @author Ryan Weaver <[email protected]>
2727
*
28-
* @experimental
29-
*
3028
* @internal
3129
*/
3230
class InterceptChildComponentRenderSubscriber implements EventSubscriberInterface, ServiceSubscriberInterface

src/LiveComponent/src/EventListener/LiveComponentSubscriber.php

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
* @author Kevin Bond <[email protected]>
4343
* @author Ryan Weaver <[email protected]>
4444
*
45-
* @experimental
46-
*
4745
* @internal
4846
*/
4947
class LiveComponentSubscriber implements EventSubscriberInterface, ServiceSubscriberInterface

src/LiveComponent/src/EventListener/QueryStringInitializeSubscriber.php

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
/**
2121
* @author Nicolas Rigaud <[email protected]>
2222
*
23-
* @experimental
24-
*
2523
* @internal
2624
*/
2725
class QueryStringInitializeSubscriber implements EventSubscriberInterface

src/LiveComponent/src/EventListener/ResetDeterministicIdSubscriber.php

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
*
3737
* @author Ryan Weaver <[email protected]>
3838
*
39-
* @experimental
40-
*
4139
* @internal
4240
*/
4341
final class ResetDeterministicIdSubscriber implements EventSubscriberInterface

src/LiveComponent/src/Exception/HydrationException.php

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
*
2121
* @author Ryan Weaver <[email protected]>
2222
*
23-
* @experimental
24-
*
2523
* @internal
2624
*/
2725
class HydrationException extends BadRequestHttpException

src/LiveComponent/src/Form/Type/LiveCollectionType.php

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
/**
2323
* @author Gábor Egyed <[email protected]>
24-
*
25-
* @experimental
2624
*/
2725
final class LiveCollectionType extends AbstractType
2826
{

src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
use Doctrine\Persistence\ManagerRegistry;
1616
use Doctrine\Persistence\ObjectManager;
1717

18+
/**
19+
* Handles hydration of Doctrine entities.
20+
*
21+
* @internal
22+
*/
1823
class DoctrineEntityHydrationExtension implements HydrationExtensionInterface
1924
{
2025
/**

src/LiveComponent/src/Hydration/HydrationExtensionInterface.php

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\UX\LiveComponent\Hydration;
1313

14+
/**
15+
* Interface for custom hydration of objects.
16+
*/
1417
interface HydrationExtensionInterface
1518
{
1619
/**

src/LiveComponent/src/LiveCollectionTrait.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
/**
1919
* @author Gábor Egyed <[email protected]>
20-
*
21-
* @experimental
2220
*/
2321
trait LiveCollectionTrait
2422
{

src/LiveComponent/src/LiveComponentBundle.php

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
/**
2121
* @author Kevin Bond <[email protected]>
22-
*
23-
* @experimental
2422
*/
2523
final class LiveComponentBundle extends Bundle
2624
{

src/LiveComponent/src/LiveComponentHydrator.php

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
/**
3636
* @author Kevin Bond <[email protected]>
3737
*
38-
* @experimental
39-
*
4038
* @internal
4139
*/
4240
final class LiveComponentHydrator

src/LiveComponent/src/LiveResponder.php

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Symfony\UX\LiveComponent;
1313

1414
/**
15-
* @experimental
16-
*
1715
* @author Ryan Weaver <[email protected]>
1816
*/
1917
final class LiveResponder

src/LiveComponent/src/Metadata/LiveComponentMetadata.php

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
/**
1717
* @author Ryan Weaver <[email protected]>
1818
*
19-
* @experimental
20-
*
2119
* @internal
2220
*/
2321
class LiveComponentMetadata

src/LiveComponent/src/Metadata/LiveComponentMetadataFactory.php

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
/**
2121
* @author Ryan Weaver <[email protected]>
2222
*
23-
* @experimental
24-
*
2523
* @internal
2624
*/
2725
class LiveComponentMetadataFactory implements ResetInterface

src/LiveComponent/src/Metadata/LivePropMetadata.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
/**
1818
* @author Kevin Bond <[email protected]>
1919
*
20-
* @experimental
21-
*
2220
* @internal
2321
*/
2422
final class LivePropMetadata

src/LiveComponent/src/Twig/DeterministicTwigIdCalculator.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
/**
1818
* @author Ryan Weaver <[email protected]>
1919
*
20-
* @experimental
21-
*
2220
* @internal
2321
*/
2422
class DeterministicTwigIdCalculator

src/LiveComponent/src/Twig/LiveComponentExtension.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
/**
1818
* @author Kevin Bond <[email protected]>
1919
*
20-
* @experimental
21-
*
2220
* @internal
2321
*/
2422
final class LiveComponentExtension extends AbstractExtension

0 commit comments

Comments
 (0)