Drab v0.7.0 Release Notes

  • ⚡️ Updated the Drab core to introduce few important features. Fixed to Elixir version >= 1.5.2. Tested with Elixir 1.6.0.

    Possibility to provide own connect/2 callback for socket authentication, etc

    Previously, Drab intercepted the connect/2 callback in your UserSocket. Now, there is a possibility to use your own callback:

    defmodule MyApp.UserSocket do
      use Phoenix.Socket
    
      channel "__drab:*", Drab.Channel
    
      def connect(params, socket) do
        Drab.Socket.verify(socket, params)
      end
    end
    

    Do You Want to Know More?

    👉 Use of the custom marker "/" in Drab templates

    This version allow you to use of <%/ %> marker to avoid using Drab.Live for a given expression. The expression would be treaten as a normal Phoenix one, so will be displayed in rendered html, but Drab will have no access to it.

    <div>
      <%/ @this_assigns_will_be_displayed_but_not_drabbed %>
    </div>
    

    Do You Want to Know More?

    🔄 Changed event definition core

    👍 The existing syntax drab-event and drab-handler attributes does not allow having multiple events on the one DOM object (#73). This form is now depreciated and replaces with the brand new, better syntax of:

    <tag drab="event:handler">
    

    Now may set more event on the single object:

    <input drab="focus:input_focus blur:input_blur"
    

    or:

    <input drab-focus="input_focus" drab-blur="input_blur">
    

    Do You Want to Know More?

    🔧 Event shorthands list is now configurable

    🔧 By default, you can use only few arbitrary-chosen shorthands for the event name / handler name (drab-click="clicked") attribute. Now you may configure the list with :events_shorthands config. 👀 See #73.

    💅 Style changes:

    • source code formatted with 1.6.0
    • 👉 use @impl true in behaviour callbacks
    • started annotating all functions with @spec (so far only few)
    • 💅 small style improvements suggested by Credo

    Depreciations:

    • Drab.Client.js/2 becomes Drab.Client.run/2
    • drab-event and drab-handler attributes combination replaced by drab