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
/** | |
* Use Mitt instead: https://github.com/developit/mitt | |
*/ | |
const EventBus = { | |
topics: {}, | |
subscribe: function (topic, listener) { | |
// Create topic if not yet created | |
if (!this.topics[topic]) { |
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
/** | |
* Visually hides elements but keeps them accessible for screen readers and | |
* keyboard users. | |
* | |
* Source: | |
* https://allyjs.io/tutorials/hiding-elements.html#2017-edition-of-visuallyhidden | |
*/ | |
.sr-only:not(:focus):not(:active) { | |
position: absolute; |
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
// Modern browsers have support for the CSS clamp function: | |
// https://developer.mozilla.org/en-US/docs/Web/CSS/clamp() | |
// Source: https://css-tricks.com/snippets/css/fluid-typography/ | |
@mixin fluid-type($min-font-size, $max-font-size, $min-vw: $breakpoint-min, $max-vw: $breakpoint-max) { | |
$u1: unit($min-vw); | |
$u2: unit($max-vw); | |
$u3: unit($min-font-size); | |
$u4: unit($max-font-size); |
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
/** | |
* Modern browsers support the `once` option for event listeners: | |
* https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#parameters | |
*/ | |
module.exports = function(target, type, callback) { | |
let eventWrapper = function(event) { | |
target.removeEventListener(type, eventWrapper); | |
callback(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
// SVG URL | |
// | |
// Generate an escaped SVG for data URIs. | |
// | |
// Usage: | |
// .selector { | |
// background-image: svg-url('<svg>…</svg>'); | |
// } | |
// | |
// Source: |
NewerOlder