Releases: lume/element-behaviors
v5.0.0 - Unglobalization
BREAKING: remove the global build. Migration: if you were importing the dist/global.js file with a script tag, instead use import
syntax to import element-behaviors
into your project.
Full Changelog: v4.0.0...v5.0.0
v4.0.0
Bite the bullet and commit build outputs so that they are as accessible as possible for people that may not be able to run the build in some OS or setup.
BREAKING:
- limit the version of solid-js or the build breaks (test in Windows PowerShell)
Full Changelog:
v3.1.0 - Sparkles!
This release introduces a elementBehaviors.whenDefined(name)
method on the BehaviorRegistry
class, similar to the customElements.whenDefined(name)
method on the CustomElementRegistry
class. The method can be used to wait for a behavior class to be defined before performing logic.
Previous code ordering issues would lead to behaviors not being instantiated if the has=""
attribute was defined before the behaviors were defined. Now the has=""
attribute uses the new elementBehaviors.whenDefined()
method internally to fix this problem by waiting for definitions to exist instead of returning if a definition doesn't exist.
Example:
<script src="https://unpkg.com/[email protected]/dist/global.js"></script>
<h1 has="sparkles">Sparkles!</h1>
<script>
elementBehaviors.whenDefined('sparkles').then(() => {
console.log('Sparkles are ready!')
})
setTimeout(() => {
// if the sparkles behavior class gets defined later, then it will be
// instantiated as expected, and the above console.log will run:
elementBehaviors.define('sparkles', class {
// ... add sparkles to host element ...
})
})
</script>
Full Sparkles demo on CodePen: https://codepen.io/trusktr/pen/MWzzNdV?editors=1000
Screen.Recording.2023-07-30.at.1.06.32.PM.mov
v3.0.2
v3.0.1
v3.0.0
Breaking:
- Life cycle ordering slightly changed: behaviors are constructed and their
connectedCallback
executed at the same time, back to back. awaitElementDefined
is now a static property, f.e.static awaitElementDefined = true
. The non-static property is no longer supported.
Fixes:
- This slight change in ordering was needed in order for the
awaitElementDefined
property to work well. Previously, a behavior would be instantiated even if an element was not yet defined, then itsconnectedCallback
fired later after element definition. Now, behaviors will not be instantiated at all, until their host element is defined, upgraded, and connected. Additionally, behaviors will no longer be instantiated and connected at all if their element is removed from DOM before being defined and upgraded.
Features:
Overall this stabilizes the way behaviors work, and it is only a breaking change mainly if you were previously using the awaitElementDefined
property, which was previously undocumented.
- The README has been updated to document the
awaitElementDefined
property.