diff --git a/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/components/one-column/one-column.component.yml b/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/components/one-column/one-column.component.yml index c1b8e22892048caa596ab23f200d9f40a0079f20..9b2b5f43ee77ec3a7705888e956c9b19b629a078 100644 --- a/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/components/one-column/one-column.component.yml +++ b/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/components/one-column/one-column.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: One columns description: Widget Test with One Column libraryOverrides: diff --git a/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/ui_patterns_layouts_test.info.yml b/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/ui_patterns_layouts_test.info.yml index 9362391d03699ace91e1c0fc5ffeaa20f1a43f52..a2dc214693886eb60d49c0032adb3aea04dd80c9 100644 --- a/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/ui_patterns_layouts_test.info.yml +++ b/modules/ui_patterns_layouts/tests/modules/ui_patterns_layouts_test/ui_patterns_layouts_test.info.yml @@ -9,7 +9,6 @@ dependencies: - drupal:text - ui_patterns:ui_patterns - ui_patterns:ui_patterns_layouts - - drupal:sdc config_devel: install: - field.field.node.article.body diff --git a/modules/ui_patterns_layouts/ui_patterns_layouts.module b/modules/ui_patterns_layouts/ui_patterns_layouts.module index d5681b0d16b3a9244c438afdca9ef7a3be22ca71..67fe8769d6400b537a9565c3b3c7366420e49830 100644 --- a/modules/ui_patterns_layouts/ui_patterns_layouts.module +++ b/modules/ui_patterns_layouts/ui_patterns_layouts.module @@ -18,12 +18,12 @@ use Drupal\Core\Layout\LayoutDefinition; */ function ui_patterns_layouts_layout_alter(&$definitions) { $plugin_manager = \Drupal::service('plugin.manager.sdc'); - /** @var \Drupal\sdc\Component\ComponentMetadata[] $components */ + /** @var \Drupal\Core\Theme\Component\ComponentMetadata[] $components */ $components = $plugin_manager->getSortedDefinitions(); foreach ($components as $component) { $definition = [ 'label' => $component['name'] ?? $component['id'], - 'category' => 'sdc', + 'category' => 'Components', 'provider' => $component['provider'], 'class' => '\Drupal\ui_patterns_layouts\Plugin\Layout\ComponentLayout', 'id' => $component['id'], diff --git a/modules/ui_patterns_legacy/src/ComponentConverter.php b/modules/ui_patterns_legacy/src/ComponentConverter.php index 3a4cb960b91a81fe40b2add21aa277677607588f..31c17a3207f5117d3e520ebf7a83efcba819f231 100644 --- a/modules/ui_patterns_legacy/src/ComponentConverter.php +++ b/modules/ui_patterns_legacy/src/ComponentConverter.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace Drupal\ui_patterns_legacy; use Drupal\Core\Render\Component\Exception\InvalidComponentDataException; -use Drupal\sdc\Component\ComponentValidator; +use Drupal\Core\Theme\Component\ComponentValidator; /** * Component converter. @@ -256,7 +256,7 @@ class ComponentConverter { ], $consolidated_library, ); - // For each component the sdc module adds a library with the name + // For each component, SDC adds a library with the name // "sdc/{extension}--{machine_name_with_dashes}. // For example, for a component with the name "my-banner" on theme // "my_theme" the asset library is "sdc/my_theme--my-banner". @@ -291,7 +291,7 @@ class ComponentConverter { "#story" => $story_id, ]; try { - \Drupal::service('renderer')->renderPlain($renderable); + \Drupal::service('renderer')->renderInIsolation($renderable); } catch (InvalidComponentDataException $e) { $errors[] = $e->getMessage(); diff --git a/modules/ui_patterns_library/src/Template/TwigExtension.php b/modules/ui_patterns_library/src/Template/TwigExtension.php index 96d1699e1bf1e4b709178f430d829170914b6661..0717891bb2bbec5b8e3a987c96875aae75585466 100644 --- a/modules/ui_patterns_library/src/Template/TwigExtension.php +++ b/modules/ui_patterns_library/src/Template/TwigExtension.php @@ -48,7 +48,7 @@ class TwigExtension extends AbstractExtension { * @return array * Pattern render array. * - * @see \Drupal\sdc\Element\ComponentElement + * @see \Drupal\Core\Theme\Element\ComponentElement */ public function renderComponentStory(string $component_id, string $story_id, array $slots = [], array $props = []) { return [ diff --git a/src/ComponentPluginManager.php b/src/ComponentPluginManager.php index 4cd7e5f2c4f9e74237b7453b72bf453592de7594..21aaa76955a840a92924f69cc4d418ce5bbf33c5 100644 --- a/src/ComponentPluginManager.php +++ b/src/ComponentPluginManager.php @@ -10,11 +10,11 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\File\FileSystemInterface; +use Drupal\Core\Theme\Component\ComponentValidator; +use Drupal\Core\Theme\Component\SchemaCompatibilityChecker; +use Drupal\Core\Theme\ComponentNegotiator; +use Drupal\Core\Theme\ComponentPluginManager as SdcPluginManager; use Drupal\Core\Theme\ThemeManagerInterface; -use Drupal\sdc\Component\ComponentValidator; -use Drupal\sdc\Component\SchemaCompatibilityChecker; -use Drupal\sdc\ComponentNegotiator; -use Drupal\sdc\ComponentPluginManager as SdcPluginManager; use Drupal\ui_patterns\SchemaManager\ReferencesResolver; /** @@ -115,7 +115,7 @@ class ComponentPluginManager extends SdcPluginManager implements CategorizingPlu if (isset($prop['$ref']) && str_starts_with($prop['$ref'], "ui-patterns://")) { // Resolve prop schema here, because: - // - Drupal\sdc\Component\ComponentValidator::getClassProps() is + // - Drupal\Core\Theme\Component\ComponentValidator::getClassProps() is // executed before schema references are resolved, so SDC believe // a reference is a PHP namespace. // - It is not possible to propose a patch to SDC because diff --git a/src/Element/ComponentElementBuilder.php b/src/Element/ComponentElementBuilder.php index b049680254d65016b8f21f538be502059dd52b8b..a74eca7f4939bb4aeb7742b56bccb3a5a163397c 100644 --- a/src/Element/ComponentElementBuilder.php +++ b/src/Element/ComponentElementBuilder.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace Drupal\ui_patterns\Element; +use Drupal\Core\Plugin\Component; use Drupal\Core\Security\TrustedCallbackInterface; -use Drupal\sdc\ComponentPluginManager; -use Drupal\sdc\Plugin\Component; +use Drupal\Core\Theme\ComponentPluginManager; use Drupal\ui_patterns\PropTypeAdapterPluginManager; use Drupal\ui_patterns\SourcePluginManager; diff --git a/src/Element/ComponentFormBase.php b/src/Element/ComponentFormBase.php index 4527869a09e61a0365de9cb6e1b60e71ccdab828..4fcbc693eaee529a5bf686f0a7918ef5a33ac796 100644 --- a/src/Element/ComponentFormBase.php +++ b/src/Element/ComponentFormBase.php @@ -2,13 +2,13 @@ namespace Drupal\ui_patterns\Element; -use Drupal\Core\Render\Element\FormElement; -use Drupal\sdc\Plugin\Component; +use Drupal\Core\Plugin\Component; +use Drupal\Core\Render\Element\FormElementBase; /** * Base class for components forms. */ -abstract class ComponentFormBase extends FormElement { +abstract class ComponentFormBase extends FormElementBase { /** * Expand each ajax element with ajax urls. @@ -32,9 +32,9 @@ abstract class ComponentFormBase extends FormElement { */ protected static function getComponent(array $element): Component | NULL { $component_id = $element['#default_value']['component_id'] ?? $element['#component_id'] ?? NULL; - /** @var \Drupal\sdc\ComponentPluginManager $sdc_plugin_manager */ - $sdc_plugin_manager = \Drupal::service("plugin.manager.sdc"); - return $component_id ? $sdc_plugin_manager->find($component_id) : NULL; + /** @var \Drupal\Core\Theme\ComponentPluginManager $component_plugin_manager */ + $component_plugin_manager = \Drupal::service("plugin.manager.sdc"); + return $component_id ? $component_plugin_manager->find($component_id) : NULL; } /** diff --git a/src/Element/UiPatternsOperations.php b/src/Element/UiPatternsOperations.php index e25c8528240a913405df25cba6835f634d6ef7a0..00689b33d18d9d162cb7202bd3e08b8f653b0f23 100644 --- a/src/Element/UiPatternsOperations.php +++ b/src/Element/UiPatternsOperations.php @@ -3,7 +3,7 @@ namespace Drupal\ui_patterns\Element; use Drupal\Core\Render\Element\Operations; -use Drupal\Core\Render\Element\RenderElement; +use Drupal\Core\Render\Element\RenderElementBase; /** * {@inheritdoc} @@ -28,7 +28,7 @@ class UiPatternsOperations extends Operations { // Attach #ajax events if title is a render array. foreach ($element['#links'] as &$link) { if (isset($link['title']['#ajax'])) { - $link['title'] = RenderElement::preRenderAjaxForm($link['title']); + $link['title'] = RenderElementBase::preRenderAjaxForm($link['title']); } } diff --git a/src/SchemaManager/CompatibilityChecker.php b/src/SchemaManager/CompatibilityChecker.php index 5bc4092cb3ecdefd61194b410dee12e57121084d..3fec77aa166df2b4b484b66c4c7b8f12ef5c972f 100644 --- a/src/SchemaManager/CompatibilityChecker.php +++ b/src/SchemaManager/CompatibilityChecker.php @@ -9,8 +9,8 @@ namespace Drupal\ui_patterns\SchemaManager; * * Used for prop typing. * - * Not the same as Drupal\sdc\Component\SchemaCompatibilityChecker which has - * different rules and a different goal: validating replace mechanism. + * Not the same as Drupal\Core\Theme\Component\SchemaCompatibilityChecker which + * has different rules and a different goal: validating replace mechanism. */ class CompatibilityChecker { diff --git a/src/Template/TwigExtension.php b/src/Template/TwigExtension.php index 6f21cd0fd20bb2de3bbd038dab4b87aba612ebb6..22c704f204121a5d58e764a83fa4f6f154e4f110 100644 --- a/src/Template/TwigExtension.php +++ b/src/Template/TwigExtension.php @@ -59,7 +59,7 @@ class TwigExtension extends AbstractExtension { * @return array * Pattern render array. * - * @see \Drupal\sdc\Element\ComponentElement + * @see \Drupal\Core\Theme\Element\ComponentElement */ public function renderComponent(string $component_id, array $slots = [], array $props = []) { return [ diff --git a/tests/modules/ui_patterns_test/components/README.md b/tests/modules/ui_patterns_test/components/README.md deleted file mode 100644 index 03d1d2e41452e0693272e61671c386e465033849..0000000000000000000000000000000000000000 --- a/tests/modules/ui_patterns_test/components/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# alert - -A medium complexity component for usual testing, using component() Twig function. - -❌ Not a valid SDC component because of the component() Twig function. - -# blockquote - -A simple component for basic testing. -No props. No variants. - -✅ Valid SDC component. The additions can be ignored. - -I was forced to write this anyway, because the component come from a module: - -``` -props: - type: object - properties: {} -``` - -# button - -A lot of variants. Props (with implicit typing) & slots. -With explicit template path (local, without namespace, the filename from UI Patterns 1.x) - -❌ Not a valid SDC component, because of the explicit template path. - -SDC do a fatal error: - -> Drupal\sdc\Exception\InvalidComponentException: Unable to find the Twig template for the component "ui_patterns_test:button". - -# card - -A complex component with a template by variant. A story calling another component ("button"). - -Props with implicit typing and default values. - -✅ Valid SDC component. The additions can be ignored. - -# close_button - -Here in order to test the component() Twig function in `alert`. - -Only props, no slots. - -There was initially an issue about the use of "\_" and "-" in component ID and template filename. See issue: [SDC should use dashes in file names](https://www.drupal.org/project/drupal/issues/3379527), but we renamed the template. - -✅ Valid SDC component. The additions can be ignored. - -# figure - -1 prop (with explicit typing) and slots. No variants. - -Replace `replaced_figure` - -✅ Valid SDC component. UI Patterns explciit typing is compatible with this SDC mechanism. - -# my-widget - -A more "traditional" SDC example with JSON schema examples instead of stories, and Twig blocks for slots. - -2 variants. - -✅ Valid SDC component. The additions can be ignored. - -# progress - -With explicit template path (in a subfolder, without namespace, expected filename) - -❌ Not a valid SDC component, because of explicit template path. - -# replaced_figure - -To test replacement mechanism - -✅ Valid SDC component. diff --git a/tests/modules/ui_patterns_test/components/alert/alert.component.yml b/tests/modules/ui_patterns_test/components/alert/alert.component.yml index 438a7713fc9f4ecd4fb062bf671465052de9602a..10f4c0e67ba34648c82a8ee1e8dfa1ffae61733b 100644 --- a/tests/modules/ui_patterns_test/components/alert/alert.component.yml +++ b/tests/modules/ui_patterns_test/components/alert/alert.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Alert" description: "Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages." links: diff --git a/tests/modules/ui_patterns_test/components/blockquote/blockquote.component.yml b/tests/modules/ui_patterns_test/components/blockquote/blockquote.component.yml index 94089024f894bd4f559bfb913242ddd312a53447..aefa2fa7a99279f68e5ec4bc91594a9150996e8f 100644 --- a/tests/modules/ui_patterns_test/components/blockquote/blockquote.component.yml +++ b/tests/modules/ui_patterns_test/components/blockquote/blockquote.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: Blockquote description: "For quoting blocks of content from another source within your document." links: diff --git a/tests/modules/ui_patterns_test/components/button/button.component.yml b/tests/modules/ui_patterns_test/components/button/button.component.yml index b2b75579c92bcf6735b584b7ce1f5da64e94f078..d6aeb4e7f152d46f8536a921affb1230c2897b2d 100644 --- a/tests/modules/ui_patterns_test/components/button/button.component.yml +++ b/tests/modules/ui_patterns_test/components/button/button.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Button" description: "For actions in forms, dialogs, and more with support for multiple sizes, states, and more." links: diff --git a/tests/modules/ui_patterns_test/components/card/card.component.yml b/tests/modules/ui_patterns_test/components/card/card.component.yml index caae13bdf4b088adde6dba275ca4100a353021a0..f47288a7205cb3229c11d0ac9a1adc9312c47356 100644 --- a/tests/modules/ui_patterns_test/components/card/card.component.yml +++ b/tests/modules/ui_patterns_test/components/card/card.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Card" description: "A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options." links: diff --git a/tests/modules/ui_patterns_test/components/close_button/close_button.component.yml b/tests/modules/ui_patterns_test/components/close_button/close_button.component.yml index a2f5abe669b10f207810c6b98b280903bdc7e3c5..7e29c128776aef804459bc2d14532365d8401151 100644 --- a/tests/modules/ui_patterns_test/components/close_button/close_button.component.yml +++ b/tests/modules/ui_patterns_test/components/close_button/close_button.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Close button" description: "A generic close button for dismissing content like modals and alerts." links: diff --git a/tests/modules/ui_patterns_test/components/figure/figure.component.yml b/tests/modules/ui_patterns_test/components/figure/figure.component.yml index 56c3563b52400e8205feb65f37bea6aa8004cf39..0f1884175aec76cc79302570c18543efce579d23 100644 --- a/tests/modules/ui_patterns_test/components/figure/figure.component.yml +++ b/tests/modules/ui_patterns_test/components/figure/figure.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Figure" description: "Used to display a piece of self-contained content (illustrations, diagrams, photos, code, etc) along with an optional caption. This content can be removed from the document without affecting the meaning of the document." links: diff --git a/tests/modules/ui_patterns_test/components/menu/menu.component.yml b/tests/modules/ui_patterns_test/components/menu/menu.component.yml index 6591ab56a0742b0140bc4138a755cb36f3bb0209..a9c61d22daae8fe3e4a88ccca5e5053af50945ba 100644 --- a/tests/modules/ui_patterns_test/components/menu/menu.component.yml +++ b/tests/modules/ui_patterns_test/components/menu/menu.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Menu" variants: default: diff --git a/tests/modules/ui_patterns_test/components/my-widget/my-widget.component.yml b/tests/modules/ui_patterns_test/components/my-widget/my-widget.component.yml index 4fe768443cc35d800b898203575997c5e268b2c6..9ee8210fc17a4060f28f2d8d532fc6fa9e18d432 100644 --- a/tests/modules/ui_patterns_test/components/my-widget/my-widget.component.yml +++ b/tests/modules/ui_patterns_test/components/my-widget/my-widget.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: Widget description: Widget Test with title and a CTA link libraryOverrides: diff --git a/tests/modules/ui_patterns_test/components/progress/progress.component.yml b/tests/modules/ui_patterns_test/components/progress/progress.component.yml index 06e31808140e540f6e23d31452e4088b18118a39..3ee327510d668519e0a904c65c49f839b4cea231 100644 --- a/tests/modules/ui_patterns_test/components/progress/progress.component.yml +++ b/tests/modules/ui_patterns_test/components/progress/progress.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Progress" description: "The progress element displays an indicator showing the completion progress of a task, typically in the form of a bar. Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. Bootstrap does not use the HTML5 <progress> element, ensuring you can stack progress bars, animate them, and place text labels over them." links: diff --git a/tests/modules/ui_patterns_test/components/prop_types_tests/prop_types_tests.component.yml b/tests/modules/ui_patterns_test/components/prop_types_tests/prop_types_tests.component.yml index a2201122041005f25661917fec064389d12a0c2e..b01714a09c9c95fe5bd7e9ea363053cc7a11ff12 100644 --- a/tests/modules/ui_patterns_test/components/prop_types_tests/prop_types_tests.component.yml +++ b/tests/modules/ui_patterns_test/components/prop_types_tests/prop_types_tests.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Prop types tests" props: type: object diff --git a/tests/modules/ui_patterns_test/components/replaced_figure/replaced_figure.component.yml b/tests/modules/ui_patterns_test/components/replaced_figure/replaced_figure.component.yml index d4ea2091481dc4220a9e3c003b02983defd0736e..d1fefbe044c4efa3216d542523d532468a26857b 100644 --- a/tests/modules/ui_patterns_test/components/replaced_figure/replaced_figure.component.yml +++ b/tests/modules/ui_patterns_test/components/replaced_figure/replaced_figure.component.yml @@ -1,4 +1,3 @@ -$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json name: "Figure without caption (replaced by the 'real' Figure)" props: type: object diff --git a/tests/src/Kernel/PropTypePluginManagerTest.php b/tests/src/Kernel/PropTypePluginManagerTest.php index 44da9a9af178bc3b1f22d1d80e7d714437aca6f1..d1d9521d9321bf75dd335c287b4a4a71b5bb400a 100644 --- a/tests/src/Kernel/PropTypePluginManagerTest.php +++ b/tests/src/Kernel/PropTypePluginManagerTest.php @@ -17,7 +17,7 @@ final class PropTypePluginManagerTest extends KernelTestBase { /** * {@inheritdoc} */ - protected static $modules = ['sdc', 'ui_patterns', 'ui_patterns_test']; + protected static $modules = ['ui_patterns', 'ui_patterns_test']; /** * Test callback. diff --git a/tests/src/Kernel/SourcePluginManagerTest.php b/tests/src/Kernel/SourcePluginManagerTest.php index ef7e4e8ee60675e66d73fd9c6895e3a98bda2ab0..ac07c3f104bcb6e96dee9247fc1296210fb03278 100644 --- a/tests/src/Kernel/SourcePluginManagerTest.php +++ b/tests/src/Kernel/SourcePluginManagerTest.php @@ -17,7 +17,7 @@ final class SourcePluginManagerTest extends KernelTestBase { /** * {@inheritdoc} */ - protected static $modules = ['sdc', 'ui_patterns', 'ui_patterns_test']; + protected static $modules = ['ui_patterns', 'ui_patterns_test']; /** * Validate source. diff --git a/ui_patterns.info.yml b/ui_patterns.info.yml index c6e40ecc453d6e955d53a56654e38023015d7e01..8e766c5b5ce1048a205177f47558fd7841b83008 100644 --- a/ui_patterns.info.yml +++ b/ui_patterns.info.yml @@ -1,7 +1,5 @@ name: "UI Patterns" type: module description: "Define and expose self-contained UI Components as Drupal plugins and use them seamlessly in Drupal development and site-building." -core_version_requirement: ^10.2 +core_version_requirement: ^10.3 package: "User interface" -dependencies: - - drupal:sdc diff --git a/ui_patterns.services.yml b/ui_patterns.services.yml index 07a6c9969a5ee2ed71a094bb27d6e9b8adb12d3e..914914d42ea1c4d8809d04e8da5a576b83faa497 100644 --- a/ui_patterns.services.yml +++ b/ui_patterns.services.yml @@ -8,10 +8,10 @@ services: - "@cache.discovery" - "@config.factory" - "@theme.manager" - - '@Drupal\sdc\ComponentNegotiator' + - '@Drupal\Core\Theme\ComponentNegotiator' - "@file_system" - - '@Drupal\sdc\Component\SchemaCompatibilityChecker' - - '@Drupal\sdc\Component\ComponentValidator' + - '@Drupal\Core\Theme\Component\SchemaCompatibilityChecker' + - '@Drupal\Core\Theme\Component\ComponentValidator' - "%app.root%" - "@plugin.manager.ui_patterns_prop_type" - "@plugin.manager.ui_patterns_prop_type_adapter" @@ -20,7 +20,7 @@ services: class: Drupal\ui_patterns\PropTypePluginManager parent: default_plugin_manager arguments: - - '@Drupal\sdc\Component\SchemaCompatibilityChecker' + - '@Drupal\Core\Theme\Component\SchemaCompatibilityChecker' plugin.manager.ui_patterns_prop_type_adapter: class: Drupal\ui_patterns\PropTypeAdapterPluginManager parent: default_plugin_manager