:weight_lifting_man: CSS height transition from any to auto and vice versa for Vue and Nuxt. Accordion ready.
<Collapse />
was displayed as expanded on initial render until JS was loaded (if collapsed). #22 - Thanks @zhaivoronokrequestAnimationFrame
is availableThis patch release doesn't bring any new feature nor fix. It is just a "courtesy-release" to enable from now on, publishments via the newly introduced npm provenance statements.
I also took the chance to improve a bit the (one year old) codebase by:
defineOptions
in the setup blockdisplay: none
.requestAnimationFrame
call per expand/collapse. This was achieved by streamlining the logic behind retrieving the auto duration value, which is now only captured on mount.margin: 0
and border: 0
on the Collapse element fixed styles.baseHeight
dynamically updates to 0 on collapsed state, display: hidden
is now added on the Collapse element styles.The next minor release of vue-collapsed
brings a lot of improvements and a new feature.
height var(--vc-auto-duration) cubic-bezier(0.33, 1, 0.68, 1)
.prefers-reduced-motion: reduce
and the ability to manually disable transitions via CSS.Callback props have been replaced by emits. This won't break any functionality, as Vue emits can also be defined using the previous props' syntax (onCollapsed
, onExpand
, etc).
If you were using them, you can update your code as displayed below.
Pre v1.2
<Collapse :when="isExpanded" :onExpand="callback">
<p>This is a paragraph.</p>
</Collapse>
v1.2
<Collapse :when="isExpanded" @expand="callback">
<p>This is a paragraph.</p>
</Collapse>
vite-plugin-dts
configuration for better types generation