SlideShare une entreprise Scribd logo
1  sur  27
User-Customizable
Web Components
for Building
One-Page Sites
Pasquale.
Lisena
@polito.it
Jetmir.
Xhembulla
@polito.it
Giovanni.
Malnati
@polito.it
Pasquale.
Morra
@seat.it
2User-Customizable Web Components for Building One-Page Sites23/04/2015
Agenda
1. Modules VS Web Components
a. Starting Point
b. What are Web Components?
c. Why we are using them
2. The Approach
a. Design of a Component
b. Component Manipulation
3. The Page Generator
a. generator overview
b. app flow
4. Conclusion
3
Modules VS Web Components
Part I
4User-Customizable Web Components for Building One-Page Sites23/04/2015
Starting point
Industrial need:
One-Page Site Generator
● For small business
● For one-shot landing page
● Fully customizable
● Integrable in current
enterprise product
5User-Customizable Web Components for Building One-Page Sites23/04/2015
Starting point
All available page generator are based on the
combination and manipulation of modules.
LIMITS
Possible
CSS/JS
scope
overflow
Third Part structure for
saving the page for
future editings.
Lack of
interoperability
with different
technologies
Possible
duplicate
IDs
Specific server
environment
required
6User-Customizable Web Components for Building One-Page Sites23/04/2015
What are Web Components?
A family of 4 W3C Specification:
Official blog: webcomponents.org
CUSTOM ELEMENTS
Define and use custom
DOM elements in a
document
HTML IMPORTS
Include and reuse
HTML documents as
dependencies
TEMPLATES
An element for
describe structures
SHADOW DOM
Encapsulate DOM trees,
isolating their scope and
controlling their
interaction
7User-Customizable Web Components for Building One-Page Sites23/04/2015
What are Web Components?
Create and use a Web Component means:
Write a template
(HTML + CSS + JS)
in component.html
Import it in your
main.html
Register it with
the tag name “my-
component”.
Use it in
main.html by adding
<my-component>.
The browser will
render the
component in the
shadow DOM.
my-component
#shadow-root
<div>Hello!</div>
Hello!
8User-Customizable Web Components for Building One-Page Sites23/04/2015
SupportofWebComponents
source: http://jonrimmer.github.io/are-we-componentized-yet/
9User-Customizable Web Components for Building One-Page Sites23/04/2015
… and with Google’s Polymer
What are Web Components?
Advantages:
Reusability
Isolation of JS and CSS
Standard
Declarative syntax
Easiness of use
Full browser support with polyfill
10
The Approach:
Web Components as Modules
Part II
11User-Customizable Web Components for Building One-Page Sites23/04/2015
Design of a Component
<dom-module id="descriptive-content">
<style include="component-base"></style>
<style>
p { color: var(--descriptive-text-color); }
</style>
<template><p>{{text}}</p></template>
<script>
Polymer({
is: 'descriptive-content',
behaviors: [ComponentBehavior],
properties: {
text: {
type: String,
logicType: 'textarea',
value: 'Lorem ipsum....',
label: 'Text',
reflectToAttribute: true,
customizable: true
},
textColor: {
type: String,
logicType: 'color',
value: '#ffffff',
cssVariable: '--descriptive-text-color',
label: 'Text color',
reflectToAttribute: true,
customizable: true,
observer: 'computeStyle'
}, // other properties
}
//methods and lifecycle callback
});
</dom-module>
Style
(applies only to the
component)
Template
(this will written in
the Shadow DOM)
Component registration
● Declare the component name
● Assign the
ComponentBehavior (common
properties for our modules)
● Define the available properties
● Contains the JS needed for
component lifecycle
12User-Customizable Web Components for Building One-Page Sites23/04/2015
Design of a Component
Polymer({
is: 'descriptive-content',
behaviors: [ComponentBehavior],
properties: {
text: {
type: String,
logicType: 'textarea',
value: 'Lorem ipsum....',
label: 'Text',
reflectToAttribute: true,
customizable: true
},
textColor: {
type: String,
logicType: 'color',
value: '#ffffff',
cssVariable: '--descriptive-text-color',
label: 'Text color',
reflectToAttribute: true,
customizable: true,
observer: 'computeStyle'
}, // other properties
}
//methods and lifecycle callback
});
A property represents a value
that will bound in the template
and reflected on the component
node
13User-Customizable Web Components for Building One-Page Sites23/04/2015
Design of a Component
<descriptive-content text="Lorem ipsum..."
text-color="#ffffff”>
#shadow-root //not shown
<style> ... </style>
<p> Lorem ipsum...</p>
</descriptive-content>
in the DOM attributes in the render
14User-Customizable Web Components for Building One-Page Sites23/04/2015
Component Manipulation
Component
text
textColor
Input 1
Input 2
Inputs
value
value
user interaction
current value
current value
user interaction
How to design each input?
15User-Customizable Web Components for Building One-Page Sites23/04/2015
Component Manipulation
ANSWER: With Web Components
How to design each input?
Label
logicType: textarea
logicType: color
<textarea>
<input type=”color”>
Native input elements
16User-Customizable Web Components for Building One-Page Sites23/04/2015
Component Manipulation
ANSWER: With Web Components
How to design each input?
logicType: background
<background-input>
Custom Component that expose a
value attribute (like native inputs)
17
The Page Generator
Part III
18User-Customizable Web Components for Building One-Page Sites23/04/2015
Application overview
19User-Customizable Web Components for Building One-Page Sites23/04/2015
Application overview
20User-Customizable Web Components for Building One-Page Sites23/04/2015
Application overview
21User-Customizable Web Components for Building One-Page Sites23/04/2015
Application overview
22User-Customizable Web Components for Building One-Page Sites23/04/2015
Application overview
<html>
<head><!-- dependencies loading --></head>
<body>
<!-- other components -->
<descriptive-content text-color="#FFFFFF"
text="Hello ACHI 2016!">
</descriptive-content>
<!-- other components -->
</body>
<html>
Output HTML
23User-Customizable Web Components for Building One-Page Sites23/04/2015
Applicationflow
24
Conclusions
Part IV
25User-Customizable Web Components for Building One-Page Sites23/04/2015
Conclusions
We used the Web Components standard in a novel way
(user-driven instead of developer-driven)
We built a web page generator which works with client-side
only technologies
It uses standards, in order to have high integration
possibilities
Shadow DOM grants isolation of modules and avoid overflow
of JS and CSS.
26User-Customizable Web Components for Building One-Page Sites23/04/2015
Conclusions
Writing and sharing components platform for webmaster
Supporting dependency managers
Concatenation of the output (Vulcanization)
Page theme with CSS variables
FUTURE WORKS
27
This work has been presented at
Ninth International Conference on Advances in Computer-
Human Interactions (ACHI) 2016
Venice, 24-28 April 2016
background picture by FergieFam007, flic.kr/p/88iw5D
paper goo.gl/T3Ipuv
demo goo.gl/LW3WGE

Contenu connexe

Similaire à User-Customizable Web Components for Building One-Page Sites

Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introductioncherukumilli2
 
Vue micro frontend implementation patterns
Vue micro frontend implementation patternsVue micro frontend implementation patterns
Vue micro frontend implementation patternsAlbert Brand
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMAdobeMarketingCloud
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMAdobeMarketingCloud
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMconnectwebex
 
JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!_Dewy_
 
Building fast track external facing sharepoint site
Building fast track external facing sharepoint siteBuilding fast track external facing sharepoint site
Building fast track external facing sharepoint siteManish Rawat
 
Oracle portal 10g release 2 technical overview an oracle white paper august 2005
Oracle portal 10g release 2 technical overview an oracle white paper august 2005Oracle portal 10g release 2 technical overview an oracle white paper august 2005
Oracle portal 10g release 2 technical overview an oracle white paper august 2005FITSFSd
 
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMSMagnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMSMagnolia
 
Web Components: Web back to future.
Web Components: Web back to future.Web Components: Web back to future.
Web Components: Web back to future.GlobalLogic Ukraine
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5Vinayak Tavargeri
 
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDESAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDEMarkus Van Kempen
 
Front-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and PolymerFront-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and PolymeruEngine Solutions
 
MicroFrontends für Microservices
MicroFrontends für MicroservicesMicroFrontends für Microservices
MicroFrontends für MicroservicesComsysto Reply GmbH
 
Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.
Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.
Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.Basant Kumar Yadav
 
Design and Development of a Headless Content Management System
Design and Development of a Headless Content Management SystemDesign and Development of a Headless Content Management System
Design and Development of a Headless Content Management SystemIRJET Journal
 
SharePoint Web part programming
SharePoint Web part programmingSharePoint Web part programming
SharePoint Web part programmingQuang Nguyễn Bá
 

Similaire à User-Customizable Web Components for Building One-Page Sites (20)

Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introduction
 
Vue micro frontend implementation patterns
Vue micro frontend implementation patternsVue micro frontend implementation patterns
Vue micro frontend implementation patterns
 
Kentico 12 Launch Webinar
Kentico 12 Launch WebinarKentico 12 Launch Webinar
Kentico 12 Launch Webinar
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!
 
Building fast track external facing sharepoint site
Building fast track external facing sharepoint siteBuilding fast track external facing sharepoint site
Building fast track external facing sharepoint site
 
Oracle portal 10g release 2 technical overview an oracle white paper august 2005
Oracle portal 10g release 2 technical overview an oracle white paper august 2005Oracle portal 10g release 2 technical overview an oracle white paper august 2005
Oracle portal 10g release 2 technical overview an oracle white paper august 2005
 
Magento Presentation Layer
Magento Presentation LayerMagento Presentation Layer
Magento Presentation Layer
 
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMSMagnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
 
Web Components: Web back to future.
Web Components: Web back to future.Web Components: Web back to future.
Web Components: Web back to future.
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5
 
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDESAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
 
Front-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and PolymerFront-end architecture for cloud applications and Polymer
Front-end architecture for cloud applications and Polymer
 
MicroFrontends für Microservices
MicroFrontends für MicroservicesMicroFrontends für Microservices
MicroFrontends für Microservices
 
Resume
ResumeResume
Resume
 
Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.
Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.
Technical Lead (Azure , SharePoint, ASP.Net ), 12+ years exp.
 
Design and Development of a Headless Content Management System
Design and Development of a Headless Content Management SystemDesign and Development of a Headless Content Management System
Design and Development of a Headless Content Management System
 
SharePoint Web part programming
SharePoint Web part programmingSharePoint Web part programming
SharePoint Web part programming
 

Dernier

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf203318pmpc
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 

Dernier (20)

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 

User-Customizable Web Components for Building One-Page Sites

  • 1. User-Customizable Web Components for Building One-Page Sites Pasquale. Lisena @polito.it Jetmir. Xhembulla @polito.it Giovanni. Malnati @polito.it Pasquale. Morra @seat.it
  • 2. 2User-Customizable Web Components for Building One-Page Sites23/04/2015 Agenda 1. Modules VS Web Components a. Starting Point b. What are Web Components? c. Why we are using them 2. The Approach a. Design of a Component b. Component Manipulation 3. The Page Generator a. generator overview b. app flow 4. Conclusion
  • 3. 3 Modules VS Web Components Part I
  • 4. 4User-Customizable Web Components for Building One-Page Sites23/04/2015 Starting point Industrial need: One-Page Site Generator ● For small business ● For one-shot landing page ● Fully customizable ● Integrable in current enterprise product
  • 5. 5User-Customizable Web Components for Building One-Page Sites23/04/2015 Starting point All available page generator are based on the combination and manipulation of modules. LIMITS Possible CSS/JS scope overflow Third Part structure for saving the page for future editings. Lack of interoperability with different technologies Possible duplicate IDs Specific server environment required
  • 6. 6User-Customizable Web Components for Building One-Page Sites23/04/2015 What are Web Components? A family of 4 W3C Specification: Official blog: webcomponents.org CUSTOM ELEMENTS Define and use custom DOM elements in a document HTML IMPORTS Include and reuse HTML documents as dependencies TEMPLATES An element for describe structures SHADOW DOM Encapsulate DOM trees, isolating their scope and controlling their interaction
  • 7. 7User-Customizable Web Components for Building One-Page Sites23/04/2015 What are Web Components? Create and use a Web Component means: Write a template (HTML + CSS + JS) in component.html Import it in your main.html Register it with the tag name “my- component”. Use it in main.html by adding <my-component>. The browser will render the component in the shadow DOM. my-component #shadow-root <div>Hello!</div> Hello!
  • 8. 8User-Customizable Web Components for Building One-Page Sites23/04/2015 SupportofWebComponents source: http://jonrimmer.github.io/are-we-componentized-yet/
  • 9. 9User-Customizable Web Components for Building One-Page Sites23/04/2015 … and with Google’s Polymer What are Web Components? Advantages: Reusability Isolation of JS and CSS Standard Declarative syntax Easiness of use Full browser support with polyfill
  • 10. 10 The Approach: Web Components as Modules Part II
  • 11. 11User-Customizable Web Components for Building One-Page Sites23/04/2015 Design of a Component <dom-module id="descriptive-content"> <style include="component-base"></style> <style> p { color: var(--descriptive-text-color); } </style> <template><p>{{text}}</p></template> <script> Polymer({ is: 'descriptive-content', behaviors: [ComponentBehavior], properties: { text: { type: String, logicType: 'textarea', value: 'Lorem ipsum....', label: 'Text', reflectToAttribute: true, customizable: true }, textColor: { type: String, logicType: 'color', value: '#ffffff', cssVariable: '--descriptive-text-color', label: 'Text color', reflectToAttribute: true, customizable: true, observer: 'computeStyle' }, // other properties } //methods and lifecycle callback }); </dom-module> Style (applies only to the component) Template (this will written in the Shadow DOM) Component registration ● Declare the component name ● Assign the ComponentBehavior (common properties for our modules) ● Define the available properties ● Contains the JS needed for component lifecycle
  • 12. 12User-Customizable Web Components for Building One-Page Sites23/04/2015 Design of a Component Polymer({ is: 'descriptive-content', behaviors: [ComponentBehavior], properties: { text: { type: String, logicType: 'textarea', value: 'Lorem ipsum....', label: 'Text', reflectToAttribute: true, customizable: true }, textColor: { type: String, logicType: 'color', value: '#ffffff', cssVariable: '--descriptive-text-color', label: 'Text color', reflectToAttribute: true, customizable: true, observer: 'computeStyle' }, // other properties } //methods and lifecycle callback }); A property represents a value that will bound in the template and reflected on the component node
  • 13. 13User-Customizable Web Components for Building One-Page Sites23/04/2015 Design of a Component <descriptive-content text="Lorem ipsum..." text-color="#ffffff”> #shadow-root //not shown <style> ... </style> <p> Lorem ipsum...</p> </descriptive-content> in the DOM attributes in the render
  • 14. 14User-Customizable Web Components for Building One-Page Sites23/04/2015 Component Manipulation Component text textColor Input 1 Input 2 Inputs value value user interaction current value current value user interaction How to design each input?
  • 15. 15User-Customizable Web Components for Building One-Page Sites23/04/2015 Component Manipulation ANSWER: With Web Components How to design each input? Label logicType: textarea logicType: color <textarea> <input type=”color”> Native input elements
  • 16. 16User-Customizable Web Components for Building One-Page Sites23/04/2015 Component Manipulation ANSWER: With Web Components How to design each input? logicType: background <background-input> Custom Component that expose a value attribute (like native inputs)
  • 18. 18User-Customizable Web Components for Building One-Page Sites23/04/2015 Application overview
  • 19. 19User-Customizable Web Components for Building One-Page Sites23/04/2015 Application overview
  • 20. 20User-Customizable Web Components for Building One-Page Sites23/04/2015 Application overview
  • 21. 21User-Customizable Web Components for Building One-Page Sites23/04/2015 Application overview
  • 22. 22User-Customizable Web Components for Building One-Page Sites23/04/2015 Application overview <html> <head><!-- dependencies loading --></head> <body> <!-- other components --> <descriptive-content text-color="#FFFFFF" text="Hello ACHI 2016!"> </descriptive-content> <!-- other components --> </body> <html> Output HTML
  • 23. 23User-Customizable Web Components for Building One-Page Sites23/04/2015 Applicationflow
  • 25. 25User-Customizable Web Components for Building One-Page Sites23/04/2015 Conclusions We used the Web Components standard in a novel way (user-driven instead of developer-driven) We built a web page generator which works with client-side only technologies It uses standards, in order to have high integration possibilities Shadow DOM grants isolation of modules and avoid overflow of JS and CSS.
  • 26. 26User-Customizable Web Components for Building One-Page Sites23/04/2015 Conclusions Writing and sharing components platform for webmaster Supporting dependency managers Concatenation of the output (Vulcanization) Page theme with CSS variables FUTURE WORKS
  • 27. 27 This work has been presented at Ninth International Conference on Advances in Computer- Human Interactions (ACHI) 2016 Venice, 24-28 April 2016 background picture by FergieFam007, flic.kr/p/88iw5D paper goo.gl/T3Ipuv demo goo.gl/LW3WGE