Skip to content

Instantly share code, notes, and snippets.

View daKmoR's full-sized avatar
❤️
Web Components & open-wc

Thomas Allmer daKmoR

❤️
Web Components & open-wc
View GitHub Profile
@daKmoR
daKmoR / BaseElement.html
Created March 15, 2017 14:02
IE Edge will ignore inline style set variables e.g. style="--my-color: #ccc" will not overwrite any default value for my-color.
<link rel="import" href="../../../../bower_components/polymer/polymer.html">
<script>
class BaseElement extends Polymer.Element {
vhToPx(vh) {
if (vh.indexOf('vh') > 0) {
return document.documentElement.clientHeight * (parseInt(vh)/100) + '';
}
@daKmoR
daKmoR / BaseElement.html
Created March 15, 2017 14:05
IE Edge will ignore inline style variables in webcomponents
<!--
IE Edge will ignore inline style variables in webcomponents
e.g. style="--my-color: #ccc" will not overwrite any default value for --my-color.
for an example open this in IE Edge
http://plnkr.co/edit/cSIs0ODeyUsaXiemxhyP?p=preview
If you extend an element from this element instead e.g.
class ImageBlock extends BaseElement {
}
inline style variables be properly set even in IE Edge.
@daKmoR
daKmoR / container-masonry.html
Created April 21, 2017 13:10
masonry custom element
<link rel="import" href="../../../Polymer/Polymer/DomModules/BaseElement.html">
<link rel="import" href="../../../Polymer/Polymer/DomModules/ResponsiveBehavior.html">
<link rel="import" href="MasonryImport.html">
<style>
.container-masonry-animate-move-up {
transform: translateY(200px);
opacity: 0;
animation: containerMasonryMoveToOrigin 0.65s ease forwards;
}
@daKmoR
daKmoR / asdf
Created October 7, 2018 12:50
asdf
test
@daKmoR
daKmoR / index.js
Last active March 21, 2019 22:31 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
const util = require('util');
const exec = util.promisify(require('child_process').exec);
async function systemVersionInfos() {
const { stdout: nodeVersion } = await exec('node --version');
console.log('$ node --version');
console.log(nodeVersion);
@daKmoR
daKmoR / CLA.md
Created December 17, 2018 12:51
CLA for MIT license

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the MIT license; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the MIT license; or

@daKmoR
daKmoR / index.stories.js
Created December 11, 2019 19:55
Storybook - source code order how?
import { html } from '../../index.js';
import '../demo-wc-card.js';
export default {
title: 'Demo Card|Component Story Format',
component: 'demo-wc-card',
};
export const heading = () =>
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
// defining the Mixin
export const LoggingMixin = superclass =>
class LoggingMixin extends superclass {
// logging logic
};
class Page {}
// applying a Mixin
class PageRed extends LoggingMixin(Page) {}
class PageGreen extends LoggingMixin(Page) {}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { specialAddEventListener } from './helpers.js';
specialAddEventListener(this, 'click', () => console.log('clicked'));
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { dedupeMixin } from '@open-wc/dedupe-mixin';
export const LocalizeMixin = dedupeMixin(
superclass =>
class LocalizeMixin extends superclass {
// this assumes a Mixin for LitElement
static get properties() {
return {
locale: { type: String }
};