SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Try Web Components!
Hiroki Tani

Front-end Developer
2013-11-30(SAT.)
Goal
Goal
$ yo polymer
Web Components?
Shadow DOM Encapsulation
HTML Templates Scaffolding
Custom Elements Extensions
HTML Imports Packaging
<x-calendar></x-calendar>

http://mozilla.github.io/brick/demos/x-tag-calendar/index.html
<x-calendar view="2013-06-09" controls></x-calendar>

http://mozilla.github.io/brick/demos/x-tag-calendar/index.html
<x-flipbox>
<div>I'm the front face.</div>
<div>And I'm the back face.</div>
</x-flipbox>

http://mozilla.github.io/brick/demos/x-tag-flipbox/index.html
<button is="mega-button">Mega button</button>

http://www.webcomponentsshift.com/#10
<gangnam-style></gangnam-style>

http://www.webcomponentsshift.com/#9
<gangnam-style></gangnam-style>

http://www.webcomponentsshift.com/#9
Fail!

Fail!
Fail!

Fail!
Try Web Components!
Try Web Components!
w/ Polymer
http://www.polymer-project.org/
http://www.html5rocks.com/en/tutorials/webcomponents/yeoman/
http://www.html5rocks.com/en/tutorials/webcomponents/yeoman/
$
$
$
$
$

npm install -g yo
npm install generator-polymer -g
mkdir YOUR_PROJECT && cd $_
yo polymer
yo polymer:element YOUR_ELEMENT

http://www.html5rocks.com/en/tutorials/webcomponents/yeoman/
<polymer-element name="YOUR_ELEMENT-element" attributes="">
<template>
<style>
@host { :scope {display: block;} }
</style>
<span>I'm <b>YOURELEMENT-element</b>. This is my Shadow
DOM.</span>
</template>
<script>
Polymer('YOUR_ELEMENT-element', {
//applyAuthorStyles: true,
//resetStyleInheritance: true,
created: function() { },
enteredView: function() { },
leftView: function() { },
attributeChanged: function(attrName, oldVal, newVal) { }
});
</script>
</polymer-element>
<polymer-element name="YOUR_ELEMENT-element" attributes="">
<template>
<style>
@host { :scope {display: block;} }
</style>
<span>I'm <b>YOURELEMENT-element</b>. This is my Shadow
DOM.</span>
</template>
<script>
Polymer('YOUR_ELEMENT-element', {
//applyAuthorStyles: true,
//resetStyleInheritance: true,
created: function() { },
enteredView: function() { },
leftView: function() { },
attributeChanged: function(attrName, oldVal, newVal) { }
});
</script>
</polymer-element>
<polymer-element name="YOUR_ELEMENT-element" attributes="">
<template>
<style>
@host { :scope {display: block;} }
</style>
<span>I'm <b>YOURELEMENT-element</b>. This is my Shadow
DOM.</span>
</template>
<script>
Polymer('YOUR_ELEMENT-element', {
//applyAuthorStyles: true,
//resetStyleInheritance: true,
created: function() { },
enteredView: function() { },
leftView: function() { },
attributeChanged: function(attrName, oldVal, newVal) { }
});
</script>
</polymer-element>

Please...
<x-switch></x-switch>

https://github.com/hiloki/demo/tree/master/frontrend_chrome/switch.html
<polymer-element name="x-switch" attributes="status">
<template>
<style>
...
input[type=checkbox] {
-webkit-appearance: none;
box-shadow: inset 0px 0px 0px 1px #e6e6e6;
...
}
input[type=checkbox]:checked {
box-shadow: inset 0px 0px 0px 20px #53d76a;
}
...
</style>
<input type="checkbox" />
</template>
<script>
...
</script>
</polymer-element>
<x-switch></x-switch>
https://github.com/hiloki/demo/tree/master/frontrend_chrome
<x-appbar heading="Feed" class="the-header">
	 <a href="./home" class="appbar-left">
	 	 <x-icon type="fa-list" attr="fa-lg"></x-icon>
	 </a>
	 <a href="./gear" class="appbar-right">
	 	 <x-icon type="fa-gear" attr="fa-lg"></x-icon>
	 </a>
</x-appbar>
<x-tabs class="the-tabs">
	 <div>
	 	 <x-icon type="fa-pencil" attr="fa-lg"></x-icon> Status
	 </div>
	 <div>
	 	 <x-icon type="fa-camera" attr="fa-lg"></x-icon> Photo
	 </div>
	 <div>
	 	 <x-icon type="fa-map-marker" attr="fa-lg"></x-icon> Check-in
	 </div>
</x-tabs>
<x-media src="/images/hiloki.jpg" width="50" height="50"
class="author">
	 	 <p class="author-name">Hiroki Tani</p>
	 	 <p><x-icon type="fa-map-marker" attr="fa-lg"></x-icon>
Nagiso, Nagano</p>
</x-media>
<x-like class="the-article-feedback-like"></x-like>

index.html
<x-like class="the-article-feedback-like"></x-like>
class="the-article-feedback-like">
<x-icon type="fa-thumbs-o-up" attr="fa-lg" on-click="">
<i class="fa fa-thumbs-o-up fa-lg"></i>
</x-icon>
<span></span>
</x-like>

index.html + Show Shadow DOM
<polymer-element name="x-like" attributes="type count">
<template>
<x-icon type="{{type}}" attr="fa-lg" on-click="{{countup}}"></xicon> <span>{{count}}</span>
</template>
<script>
Polymer('x-like', {
type: "fa-thumbs-o-up",
count: "",
countup: function() {
this.count++;
this.type = "fa-thumbs-up";
}
});
</script>
</polymer-element>

elements/x-like.html
<x-like class="the-article-feedback-like" type="fa-thumbs-up"
count="3">
<x-icon type="fa-thumbs-up" attr="fa-lg" on-click="">
<i class="fa fa-thumbs-up fa-lg"></i>
</x-icon>
<span>3</span>
</x-like>

index.html + Show Shadow DOM
Web Components
makes
Web development
more fun!
Thanks!
Hiroki Tani

@hiloki,@hiloki_en
inkdesign.jp
html5experts.jp/hiloki/

Weitere ähnliche Inhalte

Was ist angesagt?

Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
Anthony Montalbano
 
Gordian Knot Presentation (Help Network)
Gordian Knot Presentation (Help Network)Gordian Knot Presentation (Help Network)
Gordian Knot Presentation (Help Network)
Jim Osowski
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
sblackman
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
vathur
 

Was ist angesagt? (20)

Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
 
High-Quality JavaScript
High-Quality JavaScriptHigh-Quality JavaScript
High-Quality JavaScript
 
Html5 & CSS overview
Html5 & CSS overviewHtml5 & CSS overview
Html5 & CSS overview
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
 
Introduction to web components
Introduction to web componentsIntroduction to web components
Introduction to web components
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 
Test upload
Test uploadTest upload
Test upload
 
Guia de-estudio-2
Guia de-estudio-2Guia de-estudio-2
Guia de-estudio-2
 
Gordian Knot Presentation (Help Network)
Gordian Knot Presentation (Help Network)Gordian Knot Presentation (Help Network)
Gordian Knot Presentation (Help Network)
 
The Thinking behind BEM
The Thinking behind BEMThe Thinking behind BEM
The Thinking behind BEM
 
Stole16
Stole16Stole16
Stole16
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
 
Html bangla
Html banglaHtml bangla
Html bangla
 
Bangla html
Bangla htmlBangla html
Bangla html
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 

Andere mochten auch

Andere mochten auch (7)

Thinking about CSS Architecture
Thinking about CSS ArchitectureThinking about CSS Architecture
Thinking about CSS Architecture
 
Hello jQuery - 速習jQuery +綺麗なコードを書くためのヒント -
Hello jQuery - 速習jQuery +綺麗なコードを書くためのヒント -Hello jQuery - 速習jQuery +綺麗なコードを書くためのヒント -
Hello jQuery - 速習jQuery +綺麗なコードを書くためのヒント -
 
High Performance Webdesign
High Performance WebdesignHigh Performance Webdesign
High Performance Webdesign
 
日米における商品としてのアニメーションの動向
日米における商品としてのアニメーションの動向日米における商品としてのアニメーションの動向
日米における商品としてのアニメーションの動向
 
CSS設計の理想と現実
CSS設計の理想と現実CSS設計の理想と現実
CSS設計の理想と現実
 
10 Revealing Statistics About Compensation & Benefits You should Know
10 Revealing Statistics About Compensation & Benefits You should Know10 Revealing Statistics About Compensation & Benefits You should Know
10 Revealing Statistics About Compensation & Benefits You should Know
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Ähnlich wie Try Web Components

Александр Кашеверов - Polymer
Александр Кашеверов - PolymerАлександр Кашеверов - Polymer
Александр Кашеверов - Polymer
DataArt
 
Polymer
Polymer Polymer
Polymer
jskvara
 

Ähnlich wie Try Web Components (20)

Polymer - Lego for the web!
Polymer - Lego for the web!Polymer - Lego for the web!
Polymer - Lego for the web!
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Polymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaPolymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest Florida
 
Web Components: Web back to future.
Web Components: Web back to future.Web Components: Web back to future.
Web Components: Web back to future.
 
Web Components mit Polymer und AngularJS 1.x
Web Components mit Polymer und AngularJS 1.xWeb Components mit Polymer und AngularJS 1.x
Web Components mit Polymer und AngularJS 1.x
 
Web Components mit Polymer und AngularJS 1.x
Web Components mit Polymer und AngularJS 1.xWeb Components mit Polymer und AngularJS 1.x
Web Components mit Polymer und AngularJS 1.x
 
X tag with web components - joe ssekono
X tag with web components - joe ssekonoX tag with web components - joe ssekono
X tag with web components - joe ssekono
 
Polytechnic 1.0 Granada
Polytechnic 1.0 GranadaPolytechnic 1.0 Granada
Polytechnic 1.0 Granada
 
Web Components: back to the future
Web Components: back to the futureWeb Components: back to the future
Web Components: back to the future
 
TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單
 
Adobe & HTML5
Adobe & HTML5Adobe & HTML5
Adobe & HTML5
 
Александр Кашеверов - Polymer
Александр Кашеверов - PolymerАлександр Кашеверов - Polymer
Александр Кашеверов - Polymer
 
Developing web applications in 2010
Developing web applications in 2010Developing web applications in 2010
Developing web applications in 2010
 
Introduction to Webcomponents
Introduction to WebcomponentsIntroduction to Webcomponents
Introduction to Webcomponents
 
HTML & CSS - Le Wagon Bootcamp
HTML & CSS - Le Wagon BootcampHTML & CSS - Le Wagon Bootcamp
HTML & CSS - Le Wagon Bootcamp
 
Magento Fireside Chat: "Wiring Mageno Projects"
Magento Fireside Chat: "Wiring Mageno Projects"Magento Fireside Chat: "Wiring Mageno Projects"
Magento Fireside Chat: "Wiring Mageno Projects"
 
JQuery Mobile UI
JQuery Mobile UIJQuery Mobile UI
JQuery Mobile UI
 
Polymer
Polymer Polymer
Polymer
 
iWebkit
iWebkitiWebkit
iWebkit
 
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Try Web Components