ruphin / slidem

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

feat: add `defineSteps` public method #48

Closed bennypowers closed 1 year ago

bennypowers commented 1 year ago

this is an escape hatch for advanced usage, ordinary users don't need to use this.

some server-side frameworks will (sometimes helpfully, sometimes annoyingly) "compile away" your slots, and move, rather than project your content

Source (an imaginary framework SFC format):

<template framework:mode="dsd">
  <slot></slot> <!-- it's a trap! framework appends, doesn't project -->
</template>

Source (light DOM):

<dsd-slide>
  <ul>
    <li reveal>A</li>
    <li reveal>B</li>
  <ul>
</dsd-slide>

Result:

<dsd-slide>
  <template shadowrootmode="open">
    <ul>
      <li reveal>A</li>
      <li reveal>B</li>
    </ul>
  </template>
</dsd-slide>

Alternatives

Frameworks shouldn't do that

Agreed! but in the mean time they do do that.

Make more internal state public

not ideal. Better to just pass a reference, like so.

ruphin commented 1 year ago

LGTM. 👍 Let me know if it's ready to merge