Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/zero state #1

Merged
merged 6 commits into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 21 additions & 274 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,274 +1,21 @@
// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles

// eslint-disable-next-line no-global-assign
parcelRequire = (function (modules, cache, entry, globalName) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
var nodeRequire = typeof require === 'function' && require;

function newRequire(name, jumped) {
if (!cache[name]) {
if (!modules[name]) {
// if we cannot find the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
if (!jumped && currentRequire) {
return currentRequire(name, true);
}

// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) {
return previousRequire(name, true);
}

// Try the node require function if it exists.
if (nodeRequire && typeof name === 'string') {
return nodeRequire(name);
}

var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}

localRequire.resolve = resolve;

var module = cache[name] = new newRequire.Module(name);

modules[name][0].call(module.exports, localRequire, module, module.exports, this);
}

return cache[name].exports;

function localRequire(x){
return newRequire(localRequire.resolve(x));
}

function resolve(x){
return modules[name][1][x] || x;
}
}

function Module(moduleName) {
this.id = moduleName;
this.bundle = newRequire;
this.exports = {};
}

newRequire.isParcelRequire = true;
newRequire.Module = Module;
newRequire.modules = modules;
newRequire.cache = cache;
newRequire.parent = previousRequire;

for (var i = 0; i < entry.length; i++) {
newRequire(entry[i]);
}

if (entry.length) {
// Expose entry point to Node, AMD or browser globals
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
var mainExports = newRequire(entry[entry.length - 1]);

// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = mainExports;

// RequireJS
} else if (typeof define === "function" && define.amd) {
define(function () {
return mainExports;
});

// <script>
} else if (globalName) {
this[globalName] = mainExports;
}
}

// Override the current require with this new one
return newRequire;
})({1:[function(require,module,exports) {
console.log('yung vinnie');
},{}],5:[function(require,module,exports) {
var global = arguments[3];
var OVERLAY_ID = '__parcel__error__overlay__';

var OldModule = module.bundle.Module;

function Module(moduleName) {
OldModule.call(this, moduleName);
this.hot = {
data: module.bundle.hotData,
_acceptCallbacks: [],
_disposeCallbacks: [],
accept: function (fn) {
this._acceptCallbacks.push(fn || function () {});
},
dispose: function (fn) {
this._disposeCallbacks.push(fn);
}
};

module.bundle.hotData = null;
}

module.bundle.Module = Module;

var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = '' || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + '57024' + '/');
ws.onmessage = function (event) {
var data = JSON.parse(event.data);

if (data.type === 'update') {
data.assets.forEach(function (asset) {
hmrApply(global.parcelRequire, asset);
});

data.assets.forEach(function (asset) {
if (!asset.isNew) {
hmrAccept(global.parcelRequire, asset.id);
}
});
// Clear the console after HMR
console.clear();
}

if (data.type === 'reload') {
ws.close();
ws.onclose = function () {
location.reload();
};
}

if (data.type === 'error-resolved') {
console.log('[parcel] ✨ Error resolved');

removeErrorOverlay();
}

if (data.type === 'error') {
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);

removeErrorOverlay();

var overlay = createErrorOverlay(data);
document.body.appendChild(overlay);
}
};
}

function removeErrorOverlay() {
var overlay = document.getElementById(OVERLAY_ID);
if (overlay) {
overlay.remove();
}
}

function createErrorOverlay(data) {
var overlay = document.createElement('div');
overlay.id = OVERLAY_ID;

// html encode message and stack trace
var message = document.createElement('div');
var stackTrace = document.createElement('pre');
message.innerText = data.error.message;
stackTrace.innerText = data.error.stack;

overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';

return overlay;
}

function getParents(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return [];
}

var parents = [];
var k, d, dep;

for (k in modules) {
for (d in modules[k][1]) {
dep = modules[k][1][d];
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
parents.push(+k);
}
}
}

if (bundle.parent) {
parents = parents.concat(getParents(bundle.parent, id));
}

return parents;
}

function hmrApply(bundle, asset) {
var modules = bundle.modules;
if (!modules) {
return;
}

if (modules[asset.id] || !bundle.parent) {
var fn = new Function('require', 'module', 'exports', asset.generated.js);
asset.isNew = !modules[asset.id];
modules[asset.id] = [fn, asset.deps];
} else if (bundle.parent) {
hmrApply(bundle.parent, asset);
}
}

function hmrAccept(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return;
}

if (!modules[id] && bundle.parent) {
return hmrAccept(bundle.parent, id);
}

var cached = bundle.cache[id];
bundle.hotData = {};
if (cached) {
cached.hot.data = bundle.hotData;
}

if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
cached.hot._disposeCallbacks.forEach(function (cb) {
cb(bundle.hotData);
});
}

delete bundle.cache[id];
bundle(id);

cached = bundle.cache[id];
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
cached.hot._acceptCallbacks.forEach(function (cb) {
cb();
});
return true;
}

return getParents(global.parcelRequire, id).some(function (id) {
return hmrAccept(global.parcelRequire, id);
});
}
},{}]},{},[5,1], null)
//# sourceMappingURL=/index.map
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function() {
var demoSelection = {
selection: [],
selectButtons: [],
getButtons: document.querySelectorAll('.selection-screen li'),
init: function() {
if (this.getButtons()) {
this.selectButtons = this.getButtons();
console.log(this.selectButtons);
}
},
onSelect: function(evt) {
if (this.selectButtons.length < 2) {
this.classList.add('selected');
}
},
};
})();

},{}]},{},[1]);
63 changes: 59 additions & 4 deletions dist/main.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,59 @@
body {
background-color: #2a80f9; }
body h1 {
background-color: orange; }
* {
margin: 0;
padding: 0;
font-family: helvetica, sans-serif; }

.home {
background-color: #017b92;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column; }
.home h1, .home h2, .home li, .home a, .home p {
color: white; }
.home h1 {
margin: 1em 0 2em .4em;
font-size: 3em; }
.home div {
margin-bottom: 4em;
margin-left: 1em; }
.home div h2 {
font-size: 1.8em;
padding-bottom: .1em;
border-bottom: 2px solid white; }
.home div h2 span {
font-size: .5em; }
.home div ul {
list-style: none; }
.home div ul li a {
width: auto;
height: auto;
text-decoration: none;
display: flex;
flex-direction: row;
justify-content: space-between;
padding: .9em; }

.selection-screen {
background: #fff;
height: 100%;
margin: auto;
padding: .8rem;
overflow-y: scroll; }
.selection-screen p {
text-align: center; }
.selection-screen ul {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 0;
padding: 0; }
.selection-screen li {
display: inline-block;
background: #D8D8D8;
height: 6rem;
width: 6rem;
margin-bottom: .8rem;
border-radius: 50%; }
.selection-screen li .selected {
border: solid skyblue 2px; }
Loading