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 / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
class Page {}
class PageRed extends Page {}
class PageGreen extends Page {}
class PageBlue extends Page {}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
class Page {}
class PageRed extends Page {}
class PageGreen extends Page {}
class PageBlue extends Page {}
class LoggedPagRed extends PageRed {}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { isIE11 } from './helpers.js';
if (isIE11()) {}
@daKmoR
daKmoR / Markdium-Shell.bash
Created February 18, 2020 12:24
Markdium-What is a Mixin?
npm i @open-wc/dedupe-mixin
@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 MyMixin = dedupeMixin(
superclass =>
class MyMixin extends superclass {
// your mixin code goes here
},
);
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 6, 2020 21:35
Markdium-The evolution of open-wc scoped-elements
import { LitElement } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { MyPanel } from './MyPanel.js';
export class MyElement extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'my-panel': MyPanel,
};
}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 6, 2020 21:35
Markdium-The evolution of open-wc scoped-elements
import { LitElement, html, css } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { FeatureA } from 'feature-a';
import { FeatureB } from 'feature-b';
export class PageA extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'feature-a': FeatureA,
'feature-b': FeatureB,
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 6, 2020 21:35
Markdium-The evolution of open-wc scoped-elements
import { LitElement } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { MyPanel } from './MyPanel.js';
export class MyElement extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'my-panel': MyPanel,
};
}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 13, 2020 21:22
Markdium-Introducing mdjs - interactive demos everywhere
{
html: '<h1>This is my component</h1><my-component></my-component>',
jsCode: "import './my-component.js';",
stories: [
key: 'demo',
name: 'demo',
code: 'export const demo = () => `<my-component header="from attribute"></my-component>`',
]
}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 13, 2020 21:22
Markdium-Introducing mdjs - interactive demos everywhere
const { mdjsTransformer } = require('@mdjs/core');
module.exports = {
nodeResolve: true,
open: 'README.md',
watch: true,
responseTransformers: [mdjsTransformer],
};