Single-Directory Components (SDC) has been added to Drupal core as an experimental module.
Once enabled, this module allows themes and modules to create “components'' within the project’s themes and modules, under the components/
directory. Components consist of all files necessary to render the component grouped together in a single directory. This includes Twig, YAML, and optional CSS, JavaScript, etc. SDC will automatically generate a library to load CSS/JS when the template is invoked.
SDC includes a robust API for creating, extending components, as well as a powerful base from which additional functionality can be built.
Note that while SDC is currently a standalone module, the intention is to include the functionality into Drupal Core’s base theme system when it becomes stable.
For more information, see Using Single-Directory Components within Drupal’s documentation.