SlideShare a Scribd company logo
1 of 26
WebComponents
+MaterialDesign
=
VyacheslavPotravnyy
Polymer
Polyfills?
What’sPolymer?So,
Framework?
UI Widgets?
Let’slookat<select>.
<select>
<option>Small</option>
<option>Medium</option>
<option>Large</option>
</select>
<select id="schwag">
<option disabled>Medium</option>
<option disabled>Large</option>
<option selected>XX-large</option>
</select>
<select size=“3” multiple>
<option>Do</option>
<option>Re</option>
<option>Mi</option>
</select>
<select>
<optgroup label=“German cars”>
<option>Mercedes</option>
<option>Audi</option>
</optgroup>
</select>
<form>
<select name=“size”>
<option value=“s”>Small</option>
<option value=“m”>Medium</option>
<option value=“l”>Large</option>
</select>
</form>
Everythingwasgreatthesetimes…
Wherearewetoday?
Damnhere.
Let’sdosometabs. tabs. tabs.tabs.
Whendidthishappentous?
Everything.Is.Very.Bad.
Butwhatcanbedone?
Markupcanbemeaningfulagain.
<hangout-module>
<hangout-chat from="Paul, Addy" profile="1c18a0e">
<hangout-discussion>
<hangout-message from="Paul" datetime="2013-07-17T12:02">
<p>Feelin' this Web Components thing.</p>
<p>Heard of it?</p>
</hangout-message>
<hangout-message from="Addy" datetime="2013-07-17T12:12">
...
</hangout-message>
<hangout-message>...</hangout-message>
...
</hangout-discussion>
</hangout-chat>
<hangout-chat></hangout-chat>
</hangout-module>
Particles
Polyfills.
Sugar
UI Widgets
Shadow DOM,Custom Elements,
HTML Imports, Pointer Events...
Some facade and common interface
Comprehensive set (in progress)
And Material Design concepts
Philosophy&Goals
Utilizethe modernwebplatform
Eliminateboilerplate
Everythingis an element
Support modernbrowsers
Removetediousness of building web component-based apps
HTML iscool. DOM feels good.
Polymerelements
Everything isan element
polymer-project.org/docs/elements/
Aniconforexample.
<core-icon class="big" icon=“menu” alt=“Menu”>
</core-icon>
<style>
.big {
height: 32px;
width: 32px;
}
</style>
More than 700 SVGicons at the moment
AJAX...usingDOM.
<core-ajax url="/api/videos/"
params='{"alt":"json"}'>
</core-ajax>
var ajax = document.querySelector(‘core-ajax');
ajax.addEventListener(‘core-response',
function(e) {
console.log(JSON.parse(this.response));
});
ajax.go();
Exampleofcore-list
<core-list height="800" data="{{collection}} ">
<template>
<div class="todo-item">
<input type="checkbox" checked="{{model.checked}}">
{{model.name}}
</div>
</template>
</core-list>
<script>
Polymer({"collection": [
{"name": "Milk", "checked": false},
{"name": "Bread", "checked": false}
{"name": "Meat", "checked": true}
]})
</script>
Alotofalreadycreatedmodules
core-a11y-keys
core-ajax
core-animated-pages
core-animation
core-collapse
core-component-page
core-doc-viewer
core-docs
core-drag-drop
core-drawer-panel
core-dropdown
core-dropdown-menu
core-elements
core-field
core-focusable
core-header-panel
core-icon
core-icon-button
core-icons
core-iconset
core-iconset-svg
core-image
core-input
core-item
core-label
core-layout-grid
core-layout-trbl
core-list
core-localstorage
core-media-query
core-menu
core-menu-button
core-meta
core-overlay
core-pages
core-range
core-resizable
core-scaffold
core-scroll-header-
panel
core-scroll-threshold
core-selection
core-selector
core-shared-lib
core-signals
core-splitter
core-style
core-tests
core-toolbar
core-tooltip
core-transition
AndalotspecialforMaterialDesign
paper-behaviors
paper-button
paper-checkbox
paper-dialog
paper-dialog-scrollable
paper-drawer-panel
paper-fab
paper-header-panel
paper-icon-button
paper-input
paper-item
paper-material
paper-menu
paper-progress
paper-radio-button
paper-radio-group
paper-ripple
paper-slider
paper-spinner
paper-styles
paper-tabs
paper-toast
paper-toggle-button
paper-toolbar
Polymercore
Eliminateboilerplate
Declarativewebcomponents.
oDeclarative element registration: <polymer-element>
oDeclarative inheritance: <polymer-element extends="...">
oDeclarative two-way data-binding: <input id="input" value="{{foo}}">
oDeclarative event handlers: <button on-click="{{handleClick}}">
oPublished properties: xFoo.bar = 5 <-> <x-foo bar="5">
oProperty change watchers: barChanged: function() {...}
oAutomatic node finding: this.$.input.value = 5
oPointerEvents / PointerGestures by default
Be declarative. Write less code.
CustomelementswithoutPolymer :(
<template id="template">
<style>input { color: orange; }</style>
<input type="text">
</template>
<script>
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var t = document.querySelector('#template');
this.createShadowRoot()
.appendChild(document.importNode(t.content, true));
}
}
});
var MyInput = document.register('my-input', {prototype: proto});
</script>
CustomelementswithPolymer :)
<polymer-element name="my-input" constructor="MyInput" noscript>
<template>
<style>input { color: orange; }</style>
<input type="text">
</template>
</polymer-element>
<my-input></my-input>
// var myInput = document.createElement('my-input');
// var myInput = new MyInput();
DefineanAPI.
<polymer-element name="my-input">
<template>
<input type=“{{type}}" id="in" style="color: {{color}};">
</template>
<script>
Polymer('my-input', {
type: “text”,
color: “orange”,
get length() { return this.$.in.value.length; },
ready: function() { ... }
});
</script>
</polymer-element>
Createyourelements.
Basicly,app is just acollectionof elements.
Makethem
Thankyou!
Vyacheslav Potravnyy,05/2015
Special thanks to Eric Bidelman and Polymer Team

More Related Content

Similar to Polymer

Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckAnthony Montalbano
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and ImprovedTimothy Fisher
 
Creating HTML Pages
Creating HTML PagesCreating HTML Pages
Creating HTML PagesMike Crabb
 
Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Formssathish sak
 
Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and inputJesus Obenita Jr.
 
Updated html programs
Updated html programsUpdated html programs
Updated html programsDeepali54
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to BootstrapRon Reiter
 
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...Jeremy Fuksa
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by MukeshMukesh Kumar
 
14_ HTML Con't.ppt
14_ HTML Con't.ppt14_ HTML Con't.ppt
14_ HTML Con't.pptvasujaiswal4
 
Reading listの検索結果
Reading listの検索結果Reading listの検索結果
Reading listの検索結果Yohei Munesada
 

Similar to Polymer (20)

Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Creating HTML Pages
Creating HTML PagesCreating HTML Pages
Creating HTML Pages
 
Introduction html
Introduction htmlIntroduction html
Introduction html
 
Html 4
Html   4Html   4
Html 4
 
Html 4
Html   4Html   4
Html 4
 
Higher - HTML forms
Higher - HTML formsHigher - HTML forms
Higher - HTML forms
 
Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Forms
 
Html forms
Html formsHtml forms
Html forms
 
Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and input
 
Updated html programs
Updated html programsUpdated html programs
Updated html programs
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
 
14_ HTML Con't.ppt
14_ HTML Con't.ppt14_ HTML Con't.ppt
14_ HTML Con't.ppt
 
Html Hands On
Html Hands OnHtml Hands On
Html Hands On
 
Web 3 | Bootstrap
Web 3 | BootstrapWeb 3 | Bootstrap
Web 3 | Bootstrap
 
Reading listの検索結果
Reading listの検索結果Reading listの検索結果
Reading listの検索結果
 

Polymer