Skip to content

Releases: alpinejs/alpine

v1.8.1

14 Jan 14:12
Compare
Choose a tag to compare

Fixed

  • x-if without transitions applied was behaving badly. (#82)

v1.8.0

11 Jan 21:21
Compare
Choose a tag to compare

Fixed:

  • Allow colons in event names: x-on:custom:event="..." (#65)
  • Support for "space" keydown modifier: x-on:keydown.space="..." (#69)
  • Class attribute bindings (for string and array syntax) weren't merging. Now, Alpine matches the behavior of VueJS (#75)
  • Some reactivity issues have been fixed by a pretty major refactor of the core dependancy tracking mechanism (#74)

v1.7.0

10 Jan 16:54
Compare
Choose a tag to compare

Added

  • The ability to return a callback from x-init and it will run AFTER Alpine makes it's initial DOM updates (similar to the mounted() hook in VueJS, or the current, but now deprecated, x-mounted hook)
<div x-data="initialData()" x-init="init()">
    <span x-text="foo" x-ref="span">bar</span>
</div>
<script>
function initialData() {
    return {
        foo: 'baz',
        init() {
            this.$refs.span.innerText // 'bar'

            return () => {
                this.$refs.span.innerText // 'baz'
            }
        }
    }
}
</script>

Deprecated

  • x-created and x-mounted are now deprecated and will be removed in 2.0

v1.6.2

09 Jan 15:09
Compare
Choose a tag to compare

Re-introduce x-init (sorry for the breaking change) - will remove in the next major release

v1.6.1

09 Jan 14:59
Compare
Choose a tag to compare

FIxed

  • this.$el now returns raw DOM node instead of Proxy

v1.6.0

09 Jan 06:21
Compare
Choose a tag to compare

Upgrade Guide

  • Convert all instances of x-init to x-created:
<div x-data="{ foo: 'bar' }" x-init="foo.bar = 'baz">
<!-- To: -->
<div x-data="{ foo: 'bar' }" x-created="foo.bar = 'baz">

Added

  • x-created lifecycle hook (runs on initialization, but BEFORE dom elements initialized)
  • x-mounted lifecycle hook (runs on initialization, and AFTER dom elements are initialized)
  • $el magic accessor (access the root dom node of the component)

Fixed

  • Data reactivity from inside extracted components and callbacks
  • Made setting a value for x-data optional

Removed

  • The x-init directive

v1.5.0

07 Jan 23:17
Compare
Choose a tag to compare

Added

  • @ and : short syntaxes:
<button @click="..."></button>
<span :class="isOpen ? '' : 'hidden'"></span>

Fixed

  • class bindings now support string output (already supported arrays and objects)

v1.4.0

07 Jan 22:04
Compare
Choose a tag to compare

Added

  • $nextTick magic function:
<div x-data="{ fruit: 'apple' }">
    <button
        x-on:click="
            fruit = 'pear';
            $nextTick(() => { console.log($event.target.innerText) });
        "
        x-text="fruit"
    >
</div>

v1.3.1

07 Jan 04:36
Compare
Choose a tag to compare

Fixed

  • $refs was causing "Invalid invocation" error - fixed now

v1.3.0

07 Jan 03:48
Compare
Choose a tag to compare

Added

  • x-init expression:
<div x-data="{ foo: 'bar' }" x-init="foo = 'baz'">
  <span x-text="foo"></span>
</div>

(<span> will be set to "baz" initially)