UI Patterns is not planet yet, and we may want to keep the 1.x branch going as long as possible to not break the ecosystem.
However, it is not too soon to start to gather some ideas and proposal.
Adopt semantic versioning
Get rid of the ugly outdated 8.x- prefix and call it 2.0.0
See: Drupal.org release version numbers allow semantic versioning: "There will be restrictions on version numbering to avoid conflicts; for example, if a project has 8.x-1.0 released, they will not be able to release 1.0.0 too."
So, it will be easier and less intimidating to publish fixes in patch releases
Rebuild on top of Drupal Core SDC
If #3313520: Single-directory components in core lands in Drupal Core and if its architecture is compatible with our goals, we will be able to do a loose integration in the 1.x branch, adding SDC as a discovery, so becoming a SDC consumer.
However, the 2.x branch brings us the opportunity to rebuild UI Patterns on top of SDC in order to:
- become a SDC provider, so other modules can use components provided by UI Patterns (with a raw API unfortunately)
- make the ui patterns codebase lighter, focusing on the extra layer (variant,library, previews...) and the exposition to Drupa lAPI (render arrays, twig function, configurable plugins...)
It will also be the opportunity of renaming:
- "fields" to "slots"
- "settings" to "props"
In order to adopt terms more commonly used in the industry:

Integrate a subset of ui_patterns_settings
UI Patterns Settings is great and is becoming a central part of the ecosystem. It would be nice to implement a subset of this module directly in UI Patterns 2.x in order to extends the API around props and build forms for them.
Remove of DS & Field Groups sub-modules
As decided during Februray 2023 Monthly meeting, moving out sub-modules to their own projects will require a compatibility breaking UI Patterns 2.0 release.
So, this is the opportunity to remove the sub-modules which are targeting contrib APIs :
- https://git.drupalcode.org/project/ui_patterns/-/tree/8.x-1.x/modules/ui... which is related to https://www.drupal.org/project/ds
- https://git.drupalcode.org/project/ui_patterns/-/tree/8.x-1.x/modules/ui... which is related to https://www.drupal.org/project/field_group
Move YAML discovery from library module to main module
As already proposed in #3333742: Ecosystem reorganization
Remove unused or rarely used features or properties
To keep the codebase light. For example:
escapeproperty from Field definitions because it seems it is used nor documented nowehrepreviewproperty from Field definitions if we adopt #3336654: [2.0.x] Update ui_patterns_library and rethink patterns previews
What else?
Feel free to propose anything in the comment or editing the issue summary.
| Comment | File | Size | Author |
|---|
Comments
Comment #2
pdureau commentedComment #3
christian.wiedemann commentedHi all,
Here is an overview of my ideas for version 2:
1. Make UI Patterns independent of Drupal
From my Point of view, UI Patterns/Templates should be Drupal independent so that Patterns/Templates can be used in all TWIG based CMS/Frameworks. UI Patterns Core could be a composer package with core Logic and a base set of TWIG Functions/Filter.
2. New UI Patterns YAML Schema Version
I think fields/props is misleading. Also, UI Patterns Settings is a mix of UI and configuration. We could provide an optional backward compatible Schema version. It could look like: (If no schema provided, the old logic should still work)
3. Replacements for include/embed/extends.
Right now, we have multiple ways to include patterns. Either the include/embed/extend or the pattern function.
If patterns included by include/embed the TWIG Template is not prepared with UI Patterns variables like settings or data.
Templates needs code to prepare default values if the pattern is loaded by include/embed.
4. Integrate UI Patterns Settings.
5. "Everything" in core should mapped with UI Patterns without ecosystem modules.
6. Videos.
We need a bunch of tutorial Videos.
7. A new platform to share components. https://bit.dev/ for TWIG :) (Just kidding.)
Comment #4
pdureau commentedHello Christian,
So many interesting stuff here. So, I will freely brainstorm, just throwing stuff around, without being afraid of saying crap.
So, we would need to reconsider the parts which are Drupal related like the libraries definition:
Or the preview using render arrays:
Or, the Twig Print Node which is overriden by Drupal:
By the way, Twig Print Nodes are the double curly braces in templates:
This code snippet is where the magic happens. This is the perfect slot system in my opinion. You can inject anything here:
And the template will call the renderer again merging the renderer a the template engine into a single loop which is exploring both the fuil render tree and the templates nodes, with a render flow only going forward:
When I heard discussion about slots in templating languages, I never see this mechanism, but those 2 proposals which look inferior to me:
A big part of what make UI Patterns great is the Drupal layer we are building it on. Sure, the Render API is old, ugly and kind of broken, but this idea of nested declarative renderable must be kept if UI Patterns 2.x is built and available outside of Drupal.
How can we achieve that? Extracting the render API (or cretaing a smiliar API) outside of Drupal (that sounds crazy, but I told you i was freely brainstorming)?
It seems we are agreeing on "slots" and "props" since September, considering our fields must be slots, and our setting must be props.
Many of us are successfully moving our non-slots fields to props. Example in UI Suite DSFR: #3341139: [beta1] ⚠️ Fix compatibility with layout builder One of the last pain point is the management of menu and breadcrumbs structures which are props but stay as fields until #3345071: Add links setting type is done.
I agree the strong coupling between props and UI must be removed if we merge it into UI Patterns.
Your proposal looks great! Can we add JSON schema in the mix? SDC is using JSON schema for the props and it sounds like a good idea, so this:
Could become:
By the way, I am very pleased your example doesn't have typing for slots :)
But I didn't' understand the data: {classes: []} stuff. What is it?
This is a 2 levels issue IMHO.
First, we need to discourage call from patterns to patterns. block, embed, extends, from, include, import, sandbox & use Twig filters must be considered as bad practice. block, include, parent & source Twig functions too.
The recommended way of nesting component is to define them outside the template and to inject them into slots. Hardcoding must be avoided as much as possible to keep the template rock solid and flexible.
Second, when hardcoding is unavoidable (for example, legal expectations for theDSFR consent banner or technical constraint for the Bootstrap navbar), the only recommended function must be pattern().
Because:
This is a controversial take, and I don't have strong opinion about it.
By the way, which way are you suggesting:
Comment #5
grimreaperHi,
Thanks both for your thoughts.
Adopt semantic versioning
Yes, automatic with new branch.
Rebuild on top of Drupal Core SDC
Depending of the progression of this core initiative, we may want to do that in 2.1.x or 3.0.x, to not block UI Patterns enhancements.
Integrate a subset of ui_patterns_settings
Yes! I want to get rid of #3311340: [2.0.x] UI Patterns Library: support UI Patterns Settings
Remove of DS & Field Groups sub-modules
Issues created:
- #3349077: [2.0.x] Move ui_patterns_ds into a dedicated project
- #3349076: [2.0.x] Move ui_patterns_field_group into a dedicated project
Move YAML discovery from library module to main module
Issue created: #3349079: [2.0.x] Move YAML discovery from ui_patterns_library to ui_patterns
I don't know if this has to wait for 2.0.x or can be done in 8.x-1.x?
Remove unused or rarely used features or properties
Agreed but not urgent.
Make UI Patterns independent of Drupal
Wow, this would be huge but not urgent, I think that's in the direction of a lot of Pierre's issue about removing drupalism and PHP.
But I think not all drupalism will be able to be removed.
New UI Patterns YAML Schema Version
No opinion. It may join the point "Rebuild on top of Drupal Core SDC"?
Replacements for include/embed/extends
Same as Pierre's response.
"Everything" in core should mapped with UI Patterns without ecosystem modules.
Agreed. Ecosystem reorganization issues had been created, if it is the idea behind this sentence.
Videos.
Why not :)
A new platform to share components.
???
Comment #6
pdureau commentedWhat will be the compatibility breaking strategy ? I think we need to start with that.
Here is my proposal.
We don't break the themer experience:
Breaking the themes currently using UI Patterns (the "implementations") is a no-go. We need to be very strict about that.
We freely break the back dev experience :
Breaking the modules currently using UI Patterns (the "ecosystem") is possible. This is the purpose of a major release.
We kindly break the site builder experience :
Let's be careful.
Comment #7
grimreaperHi,
I am ok with this proposal of upgrade strategy.
Comment #8
christian.wiedemann commentedHi,
sounds good!
Comment #9
duaelfrComment #10
nedjoStarting in 2020, I developed the Component Schema module as a fresh start on the problem set addressed by UI Patterns, UI Patterns Settings and related modules. I did so after working extensively with UI Patterns, UI Patterns Settings, and other similar efforts. I drew a lot on the work done in this module set. I found UI Patterns Settings in particular to be an innovative layer on top of UI Patterns. However, in working with the module set, I kept hitting basic limitations that seemed to me to derive from basic architectural decisions. I decided there was a need to start fresh to meet several key principles.
I modelled Component Schema on the configuration schema API from Drupal core, in many cases directly leveraging that API. As a demonstration of how the module works, I coded up a Bulma Components module that provides a set of components based on the Bulma CSS framework. Using Component Schema, a module or theme may provide a component schema in a
.ymlfile in acomponent/schemadirectory, directly parallel to the way modules provide configuration schemas inconfig/schema.ymlfiles. The Component Schema module itself provides all the basic types that should cover the vast majority of cases. Bulma Components provides a set of reusable types such asbulma_alignmentin its own*.ymlfile. See the Component Schema documentation for more detail.I mention this work now because, as a considerable effort is considered towards reworking UI Patterns, there may be an opportunity to leverage the significant work that has already been completed in Component Schema. Specifically, Component Schema could be introduced as a dependency for UI Patterns 2.x, allowing the new branch to take full advantage of the foundational work already complete in Component Schema and freeing up new work to focus explicitly on UI rather than data modelling. As an initial pointer, a sub-module integrating with UI Patterns 1.x, Component Schema UI Patterns, provides pointers on how component schema could provide the data needed for the UI integration in UI Patterns and UI Patterns Settings.
Comment #11
pdureau commentedHello Nedjo,
Thanks for your message. We know about your work and we are impressed by it. We will be pleased of welcoming you in the UI Patterns 2.x team.
Here is the plan for UI Patterns 2.x
We want to rebuild UI Patterns around SDC (Single Directory Component), which was shipped with Drupal 10.1
SDC provides:
SDC lacks:
SDC also lacks:
We are still not decided about the way we are extending SDC:
Our strategy stay the same:
See: https://www.drupal.org/project/ui_patterns/issues/3344518#comment-14974878
So, to not break current themes, we will also need:
We have already started to work on it and it is going well.
I will contact you on MP.
Comment #12
nedjo@pdureau sounds good and makes sense. I'm in any case moving on from Drupal and have already passed on maintainership of Component Schema as well as almost all my other modules. All the best with this initiative.
Comment #13
pdureau commentedWe released alpha3. 2.0.0 is coming in 3 months, this roadmap is outdated.