Support Swiper Element (web components)?

Created on 8 November 2024, 16 days ago

Problem/Motivation

We are going "all in" on using Web Components, and so far have been pretty successful in their use on this new Drupal site I'm working on. It'd be really great if we could use the Swiper Element implementation of Swiper (https://swiperjs.com/element).

From what I can tell this module doesn't support this out of the box. I tried fiddling with the Twig templates a bit, replacing divs with their respective custom elements, but none of the JavaScript things would work. Is there any plan/interest to implement the web component-based version? Thanks!

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States dalemoore

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

Comments & Activities

  • Issue created by @dalemoore
  • πŸ‡³πŸ‡±Netherlands nk_

    That's a good point and, in fact, first steps towards that are already there. If you fetch 2.0.x-dev version you will see package.json there (as well as the new option for "Source" of the swiper, "Package". If you

    npm install
    npm run build

    And have selected Package for Swiper template in question you will see it's working. What is weird however, Element is not really recognized, because for quite a while I am busy with Ckeditor5 implementation of Swiper here (from time to time when I catch some time :) and for that, all goes really perfect when using as element inside CKEditor5 scope. Once it is saved as such markup in drupal and later viewed on page, it simply does not work, even though <swiper> and children would still have all required classes.

    Long story short, there's a bit more here to do but is coming as more broad solution. And thanks for pointing indeed!

Production build 0.71.5 2024