3.0.2 • Published 1 year ago

@w0s/portal-animation v3.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Add animated motion to the <portal> element

npm version test status

Demo

Examples

<script type="importmap">
  {
    "imports": {
      "@w0s/portal-animation": "..."
    }
  }
</script>
<script type="module">
  import PortalAnimation from '@w0s/portal-animation';

  customElements.define('x-portal-animation', PortalAnimation);
</script>

<x-portal-animation
  src="foo.html"
  referrerpolicy="origin">
</x-portal-animation>

Attributes

e.g. <x-portal-animation src="https://example.com/" referrerpolicy="same-origin"></x-portal-animation>

Style customization (CSS custom properties)

namedeaultDescription
--portal-width640pxWidth of portal
--portal-height360pxHeight of portal
--portal-max-width100%Maximum width of portal
--portal-max-height100vhMaximum height of portal
--portal-border-stylesolidBorder style of portal (border-style property)
--portal-border-width1pxBorder width of portal (border-width property)
--portal-border-colorcurrentColorBorder color of portal (border-color property)
--portal-scale0.5Amount of scaling of portal (The value of the scale() in the transform property)
--portal-animation-duration0.5sTime a transition animation (transition-duration property)
--portal-outline-stylesolidOutline style of portal (outline-style property)
--portal-outline-width1pxOutline width of portal (outline-width property)
--portal-outline-colorcurrentColorOutline color of portal (outline-color property)
--portal-outline-offset0pxOutline offset of portal (outline-offset property)
  • * Specify a value greater than 0, because setting --portal-animation-duration to '0s' disables the detection of 'transitionend' events.

⚠ Precautions for use

As of October 2022, there is no officially supported browser for the <portal> element (Can I use...). Chrome is supported with chrome://flags/#enable-portals enabled.

3.0.2

1 year ago

3.0.1

2 years ago

3.0.0

2 years ago