Add a generic JavaScriptComponentSource

Created on 12 September 2025, about 2 months ago

Overview

For the work on 📌 First-class experience builder support Active the plan is to create a dedicate component-source implementation for Nuxt/CustomElements based components. While this could go into some dedicated module, I think this could become a generally useful component source for everyone who wants to do some sort of custom javascript-rendered component.

Proposed resolution

In short:

  • Add new JavaScriptComponent source implementation.
  • Rename JsComponent to CodeComponent, since it really is a special snowflake for code components.

The new JavaScriptComponent could work like this:

  • The component simply stores its essential component-metadata as part of its ComponentConfig config entity, i.e. the component name, slots and props (including metadata / schema).
  • Next to the component-metadata, the config entity would store a reference on the Drupal library to use for rendering the component.
  • For rendering the component, there will have to be some little standarized Javascript glue code, which invokes a function of the Drupal (javascript) library to render the component, while passing the component name and all the needed props/slots to it. It would also render the div with a unique element ID where the component shall be rendered.
  • For Nuxt/Custom Elements module would take care of providing a suting drupal library, that works for all of the components via 📌 Add API to preview custom elements in Drupal Active . Some script / drush command would take care of creating component config entities as needed.
  • Developers could use the JavaScriptComponent source by simply creating config entities and specifying their own drupal library for rendering. This would enable developers to easily add custom JS based components, without having to implement a SDC and coming up with a solution for finding a unique DOM-element ID for the target element.
Feature request
Status

Active

Version

1.0

Component

Component sources

Created by

🇦🇹Austria fago Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Merge request !73Draft: Resolve #3546449 "Add a generic" → (Open) created by fago
  • Pipeline finished with Failed
    about 2 months ago
    Total: 860s
    #598402
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1451s
    #609766
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1301s
    #610048
Production build 0.71.5 2024