dox_view 3.1.0
dox_view: ^3.1.0 copied to clipboard
A template engine for the Dox framework, like Edge.js: layouts with components and slots, @if, @each and escaped output in .dox.html files.
3.1.0 #
-
New tags:
@isset,@empty,@auth,@guest,@env,@production,@once,@verbatim,@class,@checked,@selectedand@disabled. A component with the same name still wins. With no( ),@isset,@empty,@env,@class,@checked,@selectedand@disabledstay plain text.@auth,@guest,@production,@onceand@verbatimare tags only alone on their line, so text like@once upon a timestays text.@envand@productionignore case, like the cache default. -
ViewEnginetakesenvironmentfor@envand@production. By default it isAPP_ENV. -
Components get
$attributes: the props as HTML attributes, withmerge()for default attributes. The values are escaped. -
Components get
$slot, the same as$slots.main. Before,$slots.mainwas missing when the component had no body. Now both are always there, as empty text. So{{ $slots.main ?? 'x' }}no longer printsxfor an empty body. -
An empty
SafeString(no text at all) is now false in@if, like empty text. So a named slot with no text is false. A named slot with only spaces is still true. -
Fix: an app global named
errorswas hidden by the emptyerrorsthat every view gets. Now the global shows when there are no validation errors. -
Fix:
{{ errors.email }}threw an error when there was no session, and inView.render. Nowerrorsis always there: an empty map when there is no session, so the template prints nothing. -
Fix: the
toJson()of an object was kept for the life of the object. A change to the object (for example a global) did not show in later renders. Now the cache lasts only one render.
3.0.0 #
- The first stable release.
3.0.0-rc.1 #
- Fix:
View.configure()dropped the globals added before it withView.global(). Now it keeps them. The globals of the config win on the same name.
3.0.0-alpha.3 #
ViewProvider(was a DoxService): extend it in your app,shutdown()is optional.
3.0.0-alpha.2 #
- Components and layouts now see the request helpers of
view():request,csrfField(),csrfToken(),errors,old()andsession(). Before, a form inside a layout failed withcan not read "path" of null. ViewEngine.rendertakes a third map,shared: data that components see too.- README: credits to Edge.js.
3.0.0-alpha.1 #
- First version.
- Templates in
.dox.htmlfiles, rendered withview(req, name, data)orView.render(name, data). {{ }}escapes HTML,{{{ }}}does not.{{-- --}}comments.@if,@elseif,@else,@unless,@each(with index, key,$loopand@else),@let,@assign,@includeand@includeIf.- Components with props and slots, for layouts too. A template in
components/is also a tag, like@button(...). - Expressions with fields, math, logic,
??,?:, functions and methods. Objects withtoJson()work, like Dox models. - With a session:
csrfField(),csrfToken(),errors,old()andsession().route()andrequestin every view. - Parsed templates are cached, but not when
APP_ENVisdevelopmentorlocal. - Errors name the template and the line.