SlideShare a Scribd company logo
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

More Related Content

PPTX
Froala - Code Rage Webinar
PDF
Streaming Linked Data to Web UI
PPTX
Vaadin7 - coding ui components
PPT
Kentico Cms 5.5 Overview
PPTX
SharePoint 2013: Using Client-Side Rendering to color-code list cells
PPTX
Managed Metadata SPS 062011
PDF
Des Catalogues au Web des Données [FR]
PDF
Données ouvertes et traces numériques
Froala - Code Rage Webinar
Streaming Linked Data to Web UI
Vaadin7 - coding ui components
Kentico Cms 5.5 Overview
SharePoint 2013: Using Client-Side Rendering to color-code list cells
Managed Metadata SPS 062011
Des Catalogues au Web des Données [FR]
Données ouvertes et traces numériques

Similar to User-Customizable Web Components for Building One-Page Sites (20)

PPTX
Web Components
PDF
Web components are the future of the web - Take advantage of new web technolo...
PPTX
Web Components
PPTX
Web Components: The Future of Web Development is Here
PDF
Web components the future is here
PDF
2014 03-25 - GDG Nantes - Web Components avec Polymer
PPTX
Web Components: The Future of Web Development is Here
PPT
Reaching for the Future with Web Components and Polymer
PDF
Devoxx France - Web Components, Polymer et Material Design
PDF
Tech talk polymer
PDF
Introduction to Web Components
PPTX
Web components Introduction
PDF
Introduction to Web Components & Polymer Workshop - JS Interactive
PDF
Custom Elements with Polymer Web Components #econfpsu16
PPTX
Introduction to Web Components & Polymer Workshop - U of I WebCon
PDF
Levent-Gurses' Introduction to Web Components & Polymer
PDF
PPTX
Web component
PPTX
Web Components: Introduction and Practical Use Cases
PDF
Introduction to Web Components
Web Components
Web components are the future of the web - Take advantage of new web technolo...
Web Components
Web Components: The Future of Web Development is Here
Web components the future is here
2014 03-25 - GDG Nantes - Web Components avec Polymer
Web Components: The Future of Web Development is Here
Reaching for the Future with Web Components and Polymer
Devoxx France - Web Components, Polymer et Material Design
Tech talk polymer
Introduction to Web Components
Web components Introduction
Introduction to Web Components & Polymer Workshop - JS Interactive
Custom Elements with Polymer Web Components #econfpsu16
Introduction to Web Components & Polymer Workshop - U of I WebCon
Levent-Gurses' Introduction to Web Components & Polymer
Web component
Web Components: Introduction and Practical Use Cases
Introduction to Web Components
Ad

Recently uploaded (20)

PPTX
Sustainable Sites - Green Building Construction
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
DOCX
573137875-Attendance-Management-System-original
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPT
Mechanical Engineering MATERIALS Selection
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
additive manufacturing of ss316l using mig welding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Geodesy 1.pptx...............................................
PPT
Project quality management in manufacturing
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Well-logging-methods_new................
Sustainable Sites - Green Building Construction
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Foundation to blockchain - A guide to Blockchain Tech
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
573137875-Attendance-Management-System-original
Model Code of Practice - Construction Work - 21102022 .pdf
Mechanical Engineering MATERIALS Selection
OOP with Java - Java Introduction (Basics)
additive manufacturing of ss316l using mig welding
Operating System & Kernel Study Guide-1 - converted.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Geodesy 1.pptx...............................................
Project quality management in manufacturing
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
UNIT 4 Total Quality Management .pptx
Lecture Notes Electrical Wiring System Components
Well-logging-methods_new................
Ad

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