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 addClick(){ | |
colorPickerStatus.nClicks = colorPickerStatus.nClicks + 1; | |
} | |
function restartClicks() { | |
colorPickerStatus.nClicks = 0; | |
} | |
function restartPicker() { | |
colorPickerStatus.nClicks = 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
import m from 'mithril' | |
import O from 'mergerino' | |
import {viewOf} from 'mithril-machine-tools' | |
export default Simple | |
export function Simple(){ | |
let size = 0 | |
let column = 0 | |
let 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
/* Default style extends .5em of empty space */ | |
.form-switch { | |
padding-left: 2em; | |
} | |
.form-switch .form-check-input { | |
margin-left: -2em; | |
} | |
/* Bootstrap default switch input assumes extra valence in on state */ | |
.form-switch .form-check-input:checked { |
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 default generator => | |
new Proxy(generator, {apply(){ | |
return recorder( | |
generator, this, arguments | |
) | |
}}) | |
function recorder([generator, context, args], ...records){ | |
const iterator = generator.apply(context, args) | |
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
// Serialise command-line parameters of form: | |
// `--boolean`, `--key=value`, `--multiple:value1 --multiple:value2` | |
export default args => args.reduce((input, arg) => { | |
const [param, key, verb, value] = (/--(\w+)(=|:)?(.+)?/).exec(arg) || [] | |
if (param) | |
input[key] = ( | |
// No verb means boolean; '=' means direct assignment; ':' means accumulate array | |
!verb ? true : verb == "=" ? value : !input[key] ? [value] : [...input[key], value] | |
) |
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
|
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 default function changeTag(original, tagName){ | |
// Create a replacement tag of the desired type | |
const replacement = document.createElement(tagName) | |
// Grab all of the original's attributes, and pass them to the replacement | |
Array.prototype.forEach.call(original.attributes, ({name, value}) => { | |
replacement.setAttribute(name, value) | |
}) | |
// Persist contents |
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
import muty from 'muty' | |
export default function ui_io(callback = Function.prototype){ | |
const {addEventListener} = EventTarget.prototype | |
const promises = [] | |
const listeners = [] | |
const logs = [] | |
function register(entry){ |
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 {addEventListener} = EventTarget.prototype | |
export default function EventListenerListener({ | |
blocking = false, | |
removing = true, | |
visitor = Function.prototype, | |
} = {}){ | |
if(this instanceof EventListenerListener){} | |
else return new EventListenerListener(...arguments) | |