preact-custom-element icon indicating copy to clipboard operation
preact-custom-element copied to clipboard

Add support for {mode: 'closed'}

Open stevenle opened this issue 2 years ago • 0 comments

The current implementation of register(..., {shadow: true}), always attaches the shadow DOM in {mode: 'open'}. This is a request to add support for {mode: 'closed'} as well.

Relevant docs: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM#basic_usage

Screen Shot 2022-09-09 at 3 14 20 AM

I'm happy to send a PR to support the above. The way I see it there are two options:

  1. In addition to the option{shadow: true}, add support for {shadow: 'open'} and {shadow: 'closed'}.

  2. Add a new option called mode, e.g.: {shadow: true, mode: 'closed'}.

Let me know which option is preferred and I'm happy to send over the PR, including updating the @types/ package.

stevenle avatar Sep 09 '22 10:09 stevenle