This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!(function(t, i) { | |
"object" == typeof exports && "undefined" != typeof module | |
? (module.exports = i()) | |
: "function" == typeof define && define.amd ? define(i) : (t.Layout = i()); | |
})(this, function() { | |
"use strict"; | |
function t(t, i, n) { | |
let e = S; | |
if (n) { | |
X.length = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const OptCode = { | |
ADD_NODE: 1, | |
SET_PROPERTY: 2, | |
SET_TEXT: 3, | |
REMOVE_PROPERTY: 4, | |
REMOVE_NODE: 5 | |
}; | |
// a = new | |
// b = old |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template tag="video-playback-control"> | |
<style> | |
:host { | |
display: block; | |
} | |
#playButton::slotted { | |
color: red; | |
} | |
</style> | |
<slot id="playButton" name="play-button"></slot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SENTINEL = -Infinity; | |
function groupEvents(events) { | |
if (!Array.isArray(events) || events.length === 0) { | |
return []; | |
} | |
events = events.slice(); | |
events.sort((a, b) => a.start - b.start); | |
let group, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HAS_NATIVE_CE = window.customElements != null; | |
const HTMLElement = HAS_NATIVE_CE ? window.HTMLElement : class{ constructor(self) { return self; } }; | |
export class CustomElement extends HTMLElement { | |
constructor(inst) { | |
this.__instance = super(inst); | |
return this.__instance; | |
} | |
get props() { | |
return Object.assign({}, this.__props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Input | |
function NumberPad({ onPadPressed } = props) { | |
let keys = [0, 1, 2, 3, 4, 5, 6, 7, 8]; | |
return keys.map(digit => <button key={digit} onClick={(event) => { onPadPressed({ digit: digit }); }}>{key}</button>); | |
} | |
function Calculator({ result, set} = props) { | |
return <div style={{ backgroundColor: 'gray' }}> | |
<input type="text" readOnly="true" value={result} /> | |
<NumberPad onPadPressed={(event) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class SideBar extends HTMLElement { | |
static render({ name } = props) { | |
return <div>{name}</div>; | |
} | |
} | |
customElements.define('side-bar', SideBar); | |
export class ListView extends HTMLElement { | |
static render({ items } = props) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_queue = []; | |
_isRunning = false; | |
async _runLoop(task) { | |
let job, queue = this._queue; | |
if (this._isRunning) { | |
// Preempt the current tasks | |
while (job = queue[0]) { | |
queue.shift(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! function(t, i) { | |
"object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : t.Layout = i() | |
}(this, function() { | |
"use strict"; | |
function t(t) { | |
return new Promise(function(i, n) { | |
function s(h, o) { | |
try { | |
var r = t[o ? "throw" : "next"](h) |