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