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, etcPreviously, Drab intercepted the
connect/2
callback in yourUserSocket
. 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
๐ Use of the custom marker "/" in Drab templates
This version allow you to use of
<%/ %>
marker to avoid usingDrab.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>
๐ Changed event definition core
๐ The existing syntax
drab-event
anddrab-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">
๐ง 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
becomesDrab.Client.run/2
drab-event
anddrab-handler
attributes combination replaced bydrab