My tools dont work with your tools…
How can we share UI code?
Across any framework, using any build system,
with any module format?
Write UI Components once.
Components work with any framework.
Frameworks manage components, routing and data.
Extend the DOM to create new HTML Elements.
JavaScript has lots of tool to work with DOM (Frameworks, Libraries, Toolkits, Native DOM APIs), if we can extned the DOM we can write custom code that interoperates with ALL those tools.
Extend the DOM to create new HTML Elements.
<esri-web>
, <open-data-search>
, <calcite-modal>
Shadow DOM v1 status
— Polymer (@polymer) September 16, 2015
Chrome: http://t.co/pXtwYxrXQj
Saf: https://t.co/86Q3tq0Ble
FF: https://t.co/nUmI5iuc8q
Edge: http://t.co/WfOk1wpEWz
Total rewrite of the spec. All major browsers have agreed to impliment!
Spec rewrite, Safari has begun implementation. IE will likely impliment.
<opendata-search
api="http://opendata.arcgis.com"
limit="20"
sort="relevance"
group="62be2f179f674941b393f1c9bc8ca73e"
fields="record_count, item_type"></opendata-search>
<calcite-modal id="dialog-modal" aria-label="Confirmation Modal">
<p>Comfirm something.</p>
<button type="button" data-calcite-action="close-modal" class="btn">Ok</button>
</calcite-modal>
<arcgis-share-item itemid="44612e6217d34f40b1ce2a48f367e90a"></arcgis-share-item>
<esri-map
id="map"
basemap="topo"
zoom="5"
lat="38.95"
lng="-100.95"></esri-map>
Demo
<esri-feature-layer
url="http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Alternative_Fueling_Stations/FeatureServer/0"
popupbody="popup"
popuptitle="{Station_Na}"
></esri-feature-layer>
<template id="popup">
{Station_Na}
{Street_Add}
{City}, {State}, {ZIP}
Fuel Type: {Fuel_Type}
Phone: {Station_Ph}
Open to: {Groups_Wit}
Hours: {Access_Day}
</template>
Demo
<esri-basemap-toggle
map-id="map" basemap="gray"></esri-feature-layer>
Demo
😱😂😎
We built 3 componets to make a simple app.
Reused components in 5 different frameworks.
Localization?
Accessible?
Browser/Spec Stability?
Proven in production, will still keep working once the new spec is implimented.
All browsers will impliment Shadow DOM this year. One browser besides Chrome will ship Custom Elements in a stable release.
Thre is lots of additional info about the demos and my research on GitHub.
https://github.com/patrickarlt/custom-elements-dev-summit-2016