ruphin / slidem

Web Component based Presentation Library
https://slidem.ruph.in
MIT License
18 stars 3 forks source link

refactor: remove styles from slidem-slide-base #46

Open bennypowers opened 1 year ago

bennypowers commented 1 year ago

Users that extend slidem-slide-base should be able to apply their own styles and DOM without having to cascade over slidem's styles.

There are different ways to accomplish content scaling than the one used in slidem-slide, so let's give users the choice by moving the constructed stylesheet from base to slidem-slide

ruphin commented 1 year ago

I originally designed the separation between slidem-slide-base and slidem-slide based on this reasoning;

Slidem-slide

Should contain only things that are additional features to style text and make basic slides using HTML only. The main functionality is enabling basic layout and styling through attributes of specific child elements. It is meant to provide an "easy" way to quickly make a slide without having to touch any CSS, so a user can quickly make a deck with nothing but an HTML file.

Slidem-slide-base

Contains all the fundamental things that are required to make slides work. This includes slide-specific behaviours like steps. The main reason it contains some styles, is that the zoom animation is really difficult to implement from the slidem-deck, and it relies on some HTML structure and layout in slidem-slide-base. Another reason is that it was difficult to implement the automatic scaling of slides without having some sort of container for the slide content. Currently this container is created in slidem-slide-base, and the relevant styles also live there. If I remember correctly the main issue is that if a slide doesn't have a container for the content like it does currently, you cannot simultaneously have a fullscreen background while scaling the content.


I consider the zoom animation and the automatic scaling of content to be core functionalities of Slidem, and unfortunately the only way I was able to implement them is by enforcing a bit of structure in slidem-slide-base. If you can find a way to implement the zoom animation and the scaling in slidem-deck, and make it work completely agnostic of the html structure of the slides, then that opens a possibility of removing the styles from slidem-slide-base.

bennypowers commented 1 year ago

it's not that slidem's solution is bad, it's just that sometimes an author wants to bring their own. So i'm not advocating to remove the current solution, just to give authors an escape hatch in case they have special needs.

bennypowers commented 1 year ago

to clarify the intent here: for regular users nothing should change they would still import deck and slide and get the same behavior that they have now.

But "advanced" or "escape hatch" users would get a DOM-less experience, at least as far as slide is concerned. We should consider the possibility of providing a DOM-less base deck as well.

Wherever the base class is coupled to the DOM, we can provide overridable getters, or some default configuration.

ruphin commented 1 year ago

I understand, and I think we're in agreement here. I just don't have an idea on how to facilitate this from a technical point of view, other than just exposing more internals.

If you have a proposal on how to implement this change I'm happy to take a look