mozilla.github.io/brick
@MozBrick
Soledad Penadés
soledadpenades.com
@supersole
Photo by apeofjungle
Photo by oskay
Photo by Neosnaps
Sample by LanDub
div
s?
<div class="widget calendar ui theme-winter">
<div class="component-wrapper">
<div class="inner-content">
(ad nauseaum)
</div>
</div>
</div>
$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
$( "#locale" ).change(function() {
$( "#datepicker" ).datepicker( "option",
$.datepicker.regional[ $( this ).val() ] );
});
document.register
HTMLTemplateElement
<x-layout>
<x-appbar>
<header>
Spiffy header!
</header>
</x-appbar>
Marvelous content!
<footer>
Magnificent footer!
</footer>
</x-layout>
See it in action
i.e. "the name of a custom element must contain a hyphen"
the spec
var cal = document.createElement('x-calendar');
document.querySelector('section').appendChild(cal);
See it in action
<link rel="stylesheet" type="text/css" href="css/brick.css" />
<script src="js/brick.js"></script>
window.onload
, listen for DOMElementsLoaded
See it in action
brick.css
file firstYour CSS file overwrites some of Brick's default styles.
x-appbar {
background-image: linear-gradient(-180deg, #f0f 0%,
#f00 30%, #ff0 50%, #0f0 75%, #00f 100%);
color: #fff;
text-shadow: 1px 1px 1px #000;
padding: 1rem;
font-size: 2rem;
}
See it in action
make
dist/core/core.min.js
dist/calendar/calendar.min.js
dist/core/core.min.js
your-brick.js
your-brick.css
(optional)your-brick.js
?
(function() {
xtag.register('your-brick', {
lifecycle: {
created: function() {
this.innerHTML = 'I am a brick';
}
}
});
})();
See it in action
(function() {
xtag.register('your-brick', {
// ...
events: {
'tap': function(e) {
this.style.backgroundColor =
'#' + Math.round(0xFFFFFF * Math.random())
.toString(16);
}
}
});
})();
See it in action
Expect bumps
:-(
@supersole
@supersole
Slides & code at https://github.com/sole/ota2013