UNPKG

@kano/web-components

Version:

Shared web-components for the Kano ecosystem.

58 lines (55 loc) 2.63 kB
<!DOCTYPE html> <html lang="en"> <head> <title></title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="../../../../@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script> <script type="module" src="../../../../@polymer/iron-demo-helpers/demo-snippet.js"></script> <script type="module" src="../../../../@polymer/iron-demo-helpers/demo-pages-shared-styles.js"></script> <script type="module" src="../kano-user-stats.js"></script> <!-- FIXME(polymer-modulizer): These imperative modules that innerHTML your HTML are a hacky way to be sure that any mixins in included style modules are ready before any elements that reference them are instantiated, otherwise the CSS @apply mixin polyfill won't be able to expand the underlying CSS custom properties. See: https://github.com/Polymer/polymer-modulizer/issues/154 --> <script type="module"> const $_documentContainer = document.createElement('template'); $_documentContainer.setAttribute('style', 'display: none;'); $_documentContainer.innerHTML = `<style is="custom-style" include="demo-pages-shared-styles"></style>`; document.head.appendChild($_documentContainer.content); </script> </head> <body unresolved> <script type="module"> const $_documentContainer = document.createElement('template'); $_documentContainer.innerHTML = `<div class="vertical-section-container"> <demo-snippet> <h2>Kano user stats</h2> <template> <kano-user-stats></kano-user-stats> <script> document.addEventListener('WebComponentsReady', () => { let stats = document.querySelector('kano-user-stats'); stats.user = { username: 'heymaaaan', profile: { progress: { levels: { level: 7, complete: 0.4, xp: 304 } } } }; }); &lt;/script> </template> </demo-snippet> </div>`; document.body.appendChild($_documentContainer.content); </script>