SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
Web Components
and using of Vuejs
Mikhail Kuznetcov, 2017
About me
Mikhail Kuznetcov
Dev engineer at ING
Twitter: @legkoletat
Github: github.com/shershen08
Vue year later
“Vue.js has just right amount of
Magic”
“Vue.js hits a sweet spot between
readability & maintainability and
fun”
and many more...
Agenda
What are Web Components
Compare usage of WCs and Vue
Good and bad sides
Future promises
What are web components
Web Components are a set of features currently
being added by the W3C to the HTML and DOM
specifications that allow for the creation of
reusable widgets or components in web
documents and web applications.
https://wikipedia.org
In a nutshell
https://meowni.ca/emoji-rain/components/emoji-rain/demo/
Current state (w/o polyfill)
https://caniuse.com/#search=components
Current state
https://github.com/WebComponents/webcomponentsjs
webcomponents-*.js 11-35 Kb
Polymer 25-35 Kb
Today’s implementations
● Polymer
● X-Tag, SkateJS, Bosonic, etc.
● AMP (https://www.ampproject.org )
● Ionic (stencil.js, https://stenciljs.com/ )
+ Large enterprises invest heavily in Web Components
(https://summit.polymer-project.org/speakers )
Very similar api
<script type="text/javascript">
export default {
name: 'RangeSlider',
extends: {},
props: {
bar: {},
foo: {},
fooBar: {},
},
data() {},
methods: {},
beforeCreate() {},
mounted() {},
};
</script>
Polymer
X-tags
Vuejs
Web components specs
Custom Elements
Foundation for designing and using new types of DOM elements.
Shadow DOM
Defines how to use encapsulated style and markup in web components.
HTML imports
Defines the inclusion and reuse of HTML documents in other HTML documents.
HTML Template
Defines how to declare fragments of markup that go unused at page load, but can be instantiated later on
at runtime.
Spec / Custom Elements
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements
var customElement = document.registerElement('foo');
var newCustomPrototype =
Object.create(HTMLElement.prototype,
bar: {
get: function() { return 5; }
},
foo: {
value: function() { alert('foo() called'); }
}
) ✅
Using Vue + any custom elements
● Mix with all frontend
environments (plain JS,
React, Angular)
● Tiny (2.5 kb min, pf - 5 kb)
https://github.com/karol-f/vue-custom-element
Spec / Shadow DOM
By default in most modern
frameworks
http://robdodson.me/shadow-dom-the-basics/
✅
Spec / HTML Templates
Vue + vue-loader
✅
<template id="mytemplate">
<img src="" alt="template image">
<div class="message"></div>
</template>
var myNewTemplate =
document.querySelector('#mytemplate');
myNewTemplate.content.querySelector('img').src =
'logo.png';
Spec / HTML imports
<link rel="import"
href="path/to/importstuff.html">
Vue + vue-loader
✅
Framework usage downsides
● Framework induced overhead (size, extra knowledge, dependencies)
● Trying to reproduce and replace to many parts of the native browser platform
(loading assets, vDOM)
● Fws do not interact well together. Nor can developers easily mix and match
components from different fws.
● Development path of single fw is less predictable than standards
https://www.captaincodeman.com/2017/03/31/polymer-2-10kb-web-framework
Frameworks USP
● Higher level functionality that doesn’t fit well in the single
component that is in web components (e.g. routing, state
management)
● SSR is weak
●
Era of frontend frameworks divergence
In 2011
● Blow up of market requirements
● No common ground
● “Build your own” approach
By 2017
● Solid standards basement
● Market stabilisation
● JS fatigue
Vue team plans
https://github.com/vuejs/roadmap
Backlog
● Leveraging more from Web Components when it reaches
universal adoption in major browsers (e.g. CLI command that
compiles *.vue files into vanilla web components).
Recap
● Vue dev experience and end results is close to that expected when having
fully supported Web Components
● Coming improvements (Vue, browsers, Web Components stack) make Vue
ecosystem a safe bid for a project that may later migrate/heavily use Web
Components
● Era of framework divergence coming to an end
Follow up links
Vue
https://alligator.io/vuejs/vue-integrate-web-components/
https://github.com/karol-f/vue-custom-element
https://vuejsdevelopers.com/2017/09/24/vue-js-single-file-javascript-components/
Web platform
https://thewebplatformpodcast.com
https://github.com/mateusortiz/webcomponents-the-right-way
http://kaytcat.github.io/web-components/
Sharing is caring!
@legkoletat

Más contenido relacionado

La actualidad más candente

Øredev 2014
Øredev 2014Øredev 2014
Øredev 2014
olataube
 
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
Patrick Lauke
 

La actualidad más candente (20)

Pros and cons of vue.js
Pros and cons of vue.jsPros and cons of vue.js
Pros and cons of vue.js
 
Amp by Google: The Present And Future Of Quick Content Delivery
Amp by Google: The Present And Future Of Quick Content DeliveryAmp by Google: The Present And Future Of Quick Content Delivery
Amp by Google: The Present And Future Of Quick Content Delivery
 
Korea linuxforum2014 html5game-sangseoklim
Korea linuxforum2014 html5game-sangseoklimKorea linuxforum2014 html5game-sangseoklim
Korea linuxforum2014 html5game-sangseoklim
 
Single Page Application Best practices
Single Page Application Best practicesSingle Page Application Best practices
Single Page Application Best practices
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
Getting started with Vue.js - CodeMash 2020
Getting started with Vue.js - CodeMash 2020Getting started with Vue.js - CodeMash 2020
Getting started with Vue.js - CodeMash 2020
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascript
 
HTML5 in IE9
HTML5 in IE9HTML5 in IE9
HTML5 in IE9
 
Booting up with polymer
Booting up with polymerBooting up with polymer
Booting up with polymer
 
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
 
Handle the error
Handle the errorHandle the error
Handle the error
 
Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Web
 
Lecture 11 - Web components
Lecture 11 - Web componentsLecture 11 - Web components
Lecture 11 - Web components
 
Development tools & resources
Development tools & resourcesDevelopment tools & resources
Development tools & resources
 
Disruptive code
Disruptive codeDisruptive code
Disruptive code
 
Enterprise makeover. Be a good web citizen, deliver continuously and change y...
Enterprise makeover. Be a good web citizen, deliver continuously and change y...Enterprise makeover. Be a good web citizen, deliver continuously and change y...
Enterprise makeover. Be a good web citizen, deliver continuously and change y...
 
Pinkoi Platform
Pinkoi PlatformPinkoi Platform
Pinkoi Platform
 
Basic Introduction and Overview of Vue.js
Basic Introduction and Overview of Vue.jsBasic Introduction and Overview of Vue.js
Basic Introduction and Overview of Vue.js
 
Øredev 2014
Øredev 2014Øredev 2014
Øredev 2014
 
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
 

Similar a Web components api + Vuejs

Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)
Artur Cistov
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
Artur Cistov
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 

Similar a Web components api + Vuejs (20)

Building reusable components as micro frontends with glimmer js and webcompo...
Building reusable components as micro frontends  with glimmer js and webcompo...Building reusable components as micro frontends  with glimmer js and webcompo...
Building reusable components as micro frontends with glimmer js and webcompo...
 
Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in Gutenberg
 
Component Based Development
Component Based DevelopmentComponent Based Development
Component Based Development
 
Frontend microservices: architectures and solutions
Frontend microservices: architectures and solutionsFrontend microservices: architectures and solutions
Frontend microservices: architectures and solutions
 
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考えるIt is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introduction
 
Web Components: back to the future
Web Components: back to the futureWeb Components: back to the future
Web Components: back to the future
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Polymer Web Framework - Swecha Boot Camp
Polymer Web Framework - Swecha Boot CampPolymer Web Framework - Swecha Boot Camp
Polymer Web Framework - Swecha Boot Camp
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Web summit.pptx
Web summit.pptxWeb summit.pptx
Web summit.pptx
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 

Más de Mikhail Kuznetcov

Más de Mikhail Kuznetcov (8)

Svelte JS introduction
Svelte JS introductionSvelte JS introduction
Svelte JS introduction
 
Front end microservices - October 2019
Front end microservices - October 2019Front end microservices - October 2019
Front end microservices - October 2019
 
Front end microservices: architectures and solution
Front end microservices: architectures and solutionFront end microservices: architectures and solution
Front end microservices: architectures and solution
 
Building decentralised apps with js - Devoxx Morocco 2018
Building decentralised apps with js - Devoxx Morocco 2018Building decentralised apps with js - Devoxx Morocco 2018
Building decentralised apps with js - Devoxx Morocco 2018
 
Vuejs and Web components - current state
Vuejs and Web components - current stateVuejs and Web components - current state
Vuejs and Web components - current state
 
Working with Smart contracts in Javascript
Working with Smart contracts in JavascriptWorking with Smart contracts in Javascript
Working with Smart contracts in Javascript
 
Vuejs for Angular developers
Vuejs for Angular developersVuejs for Angular developers
Vuejs for Angular developers
 
Augmented reality : Technology
Augmented reality : TechnologyAugmented reality : Technology
Augmented reality : Technology
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"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 ...
 
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
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 

Web components api + Vuejs

  • 1. Web Components and using of Vuejs Mikhail Kuznetcov, 2017
  • 2. About me Mikhail Kuznetcov Dev engineer at ING Twitter: @legkoletat Github: github.com/shershen08
  • 3. Vue year later “Vue.js has just right amount of Magic” “Vue.js hits a sweet spot between readability & maintainability and fun” and many more...
  • 4. Agenda What are Web Components Compare usage of WCs and Vue Good and bad sides Future promises
  • 5. What are web components Web Components are a set of features currently being added by the W3C to the HTML and DOM specifications that allow for the creation of reusable widgets or components in web documents and web applications. https://wikipedia.org
  • 7. Current state (w/o polyfill) https://caniuse.com/#search=components
  • 9. Today’s implementations ● Polymer ● X-Tag, SkateJS, Bosonic, etc. ● AMP (https://www.ampproject.org ) ● Ionic (stencil.js, https://stenciljs.com/ ) + Large enterprises invest heavily in Web Components (https://summit.polymer-project.org/speakers )
  • 10. Very similar api <script type="text/javascript"> export default { name: 'RangeSlider', extends: {}, props: { bar: {}, foo: {}, fooBar: {}, }, data() {}, methods: {}, beforeCreate() {}, mounted() {}, }; </script> Polymer X-tags Vuejs
  • 11. Web components specs Custom Elements Foundation for designing and using new types of DOM elements. Shadow DOM Defines how to use encapsulated style and markup in web components. HTML imports Defines the inclusion and reuse of HTML documents in other HTML documents. HTML Template Defines how to declare fragments of markup that go unused at page load, but can be instantiated later on at runtime.
  • 12. Spec / Custom Elements https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements var customElement = document.registerElement('foo'); var newCustomPrototype = Object.create(HTMLElement.prototype, bar: { get: function() { return 5; } }, foo: { value: function() { alert('foo() called'); } } ) ✅
  • 13. Using Vue + any custom elements ● Mix with all frontend environments (plain JS, React, Angular) ● Tiny (2.5 kb min, pf - 5 kb) https://github.com/karol-f/vue-custom-element
  • 14. Spec / Shadow DOM By default in most modern frameworks http://robdodson.me/shadow-dom-the-basics/ ✅
  • 15. Spec / HTML Templates Vue + vue-loader ✅ <template id="mytemplate"> <img src="" alt="template image"> <div class="message"></div> </template> var myNewTemplate = document.querySelector('#mytemplate'); myNewTemplate.content.querySelector('img').src = 'logo.png';
  • 16. Spec / HTML imports <link rel="import" href="path/to/importstuff.html"> Vue + vue-loader ✅
  • 17. Framework usage downsides ● Framework induced overhead (size, extra knowledge, dependencies) ● Trying to reproduce and replace to many parts of the native browser platform (loading assets, vDOM) ● Fws do not interact well together. Nor can developers easily mix and match components from different fws. ● Development path of single fw is less predictable than standards https://www.captaincodeman.com/2017/03/31/polymer-2-10kb-web-framework
  • 18. Frameworks USP ● Higher level functionality that doesn’t fit well in the single component that is in web components (e.g. routing, state management) ● SSR is weak ●
  • 19. Era of frontend frameworks divergence In 2011 ● Blow up of market requirements ● No common ground ● “Build your own” approach By 2017 ● Solid standards basement ● Market stabilisation ● JS fatigue
  • 20. Vue team plans https://github.com/vuejs/roadmap Backlog ● Leveraging more from Web Components when it reaches universal adoption in major browsers (e.g. CLI command that compiles *.vue files into vanilla web components).
  • 21. Recap ● Vue dev experience and end results is close to that expected when having fully supported Web Components ● Coming improvements (Vue, browsers, Web Components stack) make Vue ecosystem a safe bid for a project that may later migrate/heavily use Web Components ● Era of framework divergence coming to an end
  • 22. Follow up links Vue https://alligator.io/vuejs/vue-integrate-web-components/ https://github.com/karol-f/vue-custom-element https://vuejsdevelopers.com/2017/09/24/vue-js-single-file-javascript-components/ Web platform https://thewebplatformpodcast.com https://github.com/mateusortiz/webcomponents-the-right-way http://kaytcat.github.io/web-components/