UNPKG

zliq

Version:

slim and quick framework in low loc

683 lines (647 loc) 578 kB
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; // The require function /******/ /******/ /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if (installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } // Create a new module (and put it into the cache) /******/ /******/ var module = (installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }); // Execute the module function /******/ /******/ /******/ modules[moduleId].call( module.exports, module, module.exports, __webpack_require__ ); // Flag the module as loaded /******/ /******/ /******/ module.l = true; // Return the exports of the module /******/ /******/ /******/ return module.exports; /******/ } // expose the modules object (__webpack_modules__) /******/ /******/ /******/ /******/ __webpack_require__.m = modules; // expose the module cache /******/ /******/ /******/ __webpack_require__.c = installedModules; // identity function for calling harmony imports with the correct context /******/ /******/ /******/ __webpack_require__.i = function(value) { return value; }; // define getter function for harmony exports /******/ /******/ /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if (!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; // getDefaultExport function for compatibility with non-harmony modules /******/ /******/ /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module["default"]; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, "a", getter); /******/ return getter; /******/ }; // Object.prototype.hasOwnProperty.call /******/ /******/ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; // __webpack_public_path__ /******/ /******/ /******/ __webpack_require__.p = ""; // Load entry module and return exports /******/ /******/ /******/ return __webpack_require__((__webpack_require__.s = 18)); /******/ })( /************************************************************************/ /******/ [ /* 0 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __webpack_require__(6); Object.keys(_utils).forEach(function(key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _utils[key]; } }); }); var _testComponent = __webpack_require__(22); Object.keys(_testComponent).forEach(function(key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _testComponent[key]; } }); }); /***/ }, /* 1 */ /***/ function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function() { var list = []; // return the list of modules as css string list.toString = function toString() { var result = []; for (var i = 0; i < this.length; i++) { var item = this[i]; if (item[2]) { result.push("@media " + item[2] + "{" + item[1] + "}"); } else { result.push(item[1]); } } return result.join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if (typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for (var i = 0; i < this.length; i++) { var id = this[i][0]; if (typeof id === "number") alreadyImportedModules[id] = true; } for (i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if ( typeof item[0] !== "number" || !alreadyImportedModules[item[0]] ) { if (mediaQuery && !item[2]) { item[2] = mediaQuery; } else if (mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; /***/ }, /* 2 */ /***/ function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}, memoize = function(fn) { var memo; return function() { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }, isOldIE = memoize(function() { return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase()); }), getHeadElement = memoize(function() { return document.head || document.getElementsByTagName("head")[0]; }), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = []; module.exports = function(list, options) { if (typeof DEBUG !== "undefined" && DEBUG) { if (typeof document !== "object") throw new Error( "The style-loader cannot be used in a non-browser environment" ); } options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (typeof options.singleton === "undefined") options.singleton = isOldIE(); // By default, add <style> tags to the bottom of <head>. if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; var styles = listToStyles(list); addStylesToDom(styles, options); return function update(newList) { var mayRemove = []; for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if (newList) { var newStyles = listToStyles(newList); addStylesToDom(newStyles, options); } for (var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if (domStyle.refs === 0) { for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; }; function addStylesToDom(styles, options) { for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if (domStyle) { domStyle.refs++; for (var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for (; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for (var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }; } } } function listToStyles(list) { var styles = []; var newStyles = {}; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = { css: css, media: media, sourceMap: sourceMap }; if (!newStyles[id]) styles.push((newStyles[id] = { id: id, parts: [part] })); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement(options, styleElement) { var head = getHeadElement(); var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; if (options.insertAt === "top") { if (!lastStyleElementInsertedAtTop) { head.insertBefore(styleElement, head.firstChild); } else if (lastStyleElementInsertedAtTop.nextSibling) { head.insertBefore( styleElement, lastStyleElementInsertedAtTop.nextSibling ); } else { head.appendChild(styleElement); } styleElementsInsertedAtTop.push(styleElement); } else if (options.insertAt === "bottom") { head.appendChild(styleElement); } else { throw new Error( "Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'." ); } } function removeStyleElement(styleElement) { styleElement.parentNode.removeChild(styleElement); var idx = styleElementsInsertedAtTop.indexOf(styleElement); if (idx >= 0) { styleElementsInsertedAtTop.splice(idx, 1); } } function createStyleElement(options) { var styleElement = document.createElement("style"); styleElement.type = "text/css"; insertStyleElement(options, styleElement); return styleElement; } function createLinkElement(options) { var linkElement = document.createElement("link"); linkElement.rel = "stylesheet"; insertStyleElement(options, linkElement); return linkElement; } function addStyle(obj, options) { var styleElement, update, remove; if (options.singleton) { var styleIndex = singletonCounter++; styleElement = singletonElement || (singletonElement = createStyleElement(options)); update = applyToSingletonTag.bind( null, styleElement, styleIndex, false ); remove = applyToSingletonTag.bind( null, styleElement, styleIndex, true ); } else if ( obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function" ) { styleElement = createLinkElement(options); update = updateLink.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); if (styleElement.href) URL.revokeObjectURL(styleElement.href); }; } else { styleElement = createStyleElement(options); update = applyToTag.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); }; } update(obj); return function updateStyle(newObj) { if (newObj) { if ( newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap ) return; update((obj = newObj)); } else { remove(); } }; } var replaceText = (function() { var textStore = []; return function(index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join("\n"); }; })(); function applyToSingletonTag(styleElement, index, remove, obj) { var css = remove ? "" : obj.css; if (styleElement.styleSheet) { styleElement.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = styleElement.childNodes; if (childNodes[index]) styleElement.removeChild(childNodes[index]); if (childNodes.length) { styleElement.insertBefore(cssNode, childNodes[index]); } else { styleElement.appendChild(cssNode); } } } function applyToTag(styleElement, obj) { var css = obj.css; var media = obj.media; if (media) { styleElement.setAttribute("media", media); } if (styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while (styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } function updateLink(linkElement, obj) { var css = obj.css; var sourceMap = obj.sourceMap; if (sourceMap) { // http://stackoverflow.com/a/26603875 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = linkElement.href; linkElement.href = URL.createObjectURL(blob); if (oldSrc) URL.revokeObjectURL(oldSrc); } /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Subheader = undefined; var _src = __webpack_require__(0); var Subheader = (exports.Subheader = function Subheader(_ref) { var title = _ref.title, subtitle = _ref.subtitle, id = _ref.id; return (0, _src.h)("div", { class: "row center" }, [ (0, _src.h)("div", { class: "anchor", id: id }, []), (0, _src.h)("h3", { class: "light header highlight" }, [title]), (0, _src.h)("p", { class: "col s12 m8 offset-m2 caption" }, [ subtitle ]) ]); }); /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stream = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) { return typeof obj; } : function(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.merge$ = merge$; exports.isStream = isStream; var _deepEqual = __webpack_require__(29); var _deepEqual2 = _interopRequireDefault(_deepEqual); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* * stream constructor * constructor returns a stream * get the current value of stream like: stream.value */ var stream = (exports.stream = function stream( init_value ) { var s = function s(value) { if (value === undefined) { return s.value; } update(s, value); return s; }; s.IS_STREAM = true; s.value = init_value; s.listeners = []; s.map = function(fn) { return map(s, fn); }; s.is = function(value) { return map(s, function(cur) { return cur === value; }); }; s.flatMap = function(fn) { return flatMap(s, fn); }; s.filter = function(fn) { return filter(s, fn); }; s.deepSelect = function(fn) { return deepSelect(s, fn); }; s.distinct = function(fn) { return distinct(s, fn); }; s.$ = function(selectorArr) { return query(s, selectorArr); }; s.until = function(stopEmit$) { return until(s, stopEmit$); }; s.patch = function(partialChange) { return patch(s, partialChange); }; s.reduce = function(fn, startValue) { return reduce(s, fn, startValue); }; s.debounce = function(timer) { return debounce(s, timer); }; s.log = function() { var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "Stream:"; return log(s, prefix); }; return s; }); /* * wrapper for the diffing of stream values */ function valuesChanged( oldValue, newValue ) { return !(0, _deepEqual2.default)(oldValue, newValue); } /* * update the stream value and notify listeners on the stream */ function update( parent$, newValue ) { parent$.value = newValue; notifyListeners(parent$.listeners, newValue); } /* * provide a new value to all listeners registered for a stream */ function notifyListeners( listeners, value ) { listeners.forEach(function notifyListener(listener) { listener(value); }); } /* * Do not pipe the value undefined. This allows to wait for an external initialization. * It also saves you from checking for an initial null on every map function. */ function fork$( parent$, mapFunction ) { var initValue = parent$.value !== undefined ? mapFunction(parent$.value) : undefined; return stream(initValue); } /* * provides a new stream applying a transformation function to the value of a parent stream */ function map( parent$, fn ) { var newStream = fork$(parent$, fn); parent$.listeners.push(function mapValue(value) { newStream(fn(value)); }); return newStream; } /* * helper function to debug, calls console.log on every value returnin the parent stream */ function log( parent$, prefix ) { map(parent$, function(value) { return console.log(prefix, value); }); return parent$; } /* * provides a new stream applying a transformation function to the value of a parent stream */ function flatMap( parent$, fn ) { var result$ = void 0; var listener = function updateOuterStream(result) { newStream(result); }; function attachToResult$(mapFn, parentValue, listener) { var result$ = mapFn(parentValue); result$.listeners.push(listener); return result$; } var newStream = fork$(parent$, function getChildStreamValue(value) { result$ = attachToResult$(fn, value, listener); return result$.value; }); parent$.listeners.push(function flatMapValue(value) { // clean up listeners or they will stack on child streams if (result$) { removeItem(result$.listeners, listener); } result$ = attachToResult$(fn, value, listener); newStream(result$.value); }); return newStream; } /* * provides a new stream that only serves the values that a filter function returns true for * still a stream ALWAYS has a value -> so it starts at least with NULL */ function filter( parent$, fn ) { var newStream = fork$(parent$, function(value) { return fn(value) ? value : undefined; }); parent$.listeners.push(function filterValue(value) { if (fn(value)) { newStream(value); } }); return newStream; } /* * recursivly return the nested property of an object defined by an array of selectors * parent: {foo: {bar:1}}, selectors: ['foo','bar'] returns 1 */ function select( parent, selectors ) { if (parent === null || parent === undefined) { return null; } if (selectors.length === 0) { return parent; } var selector = selectors[0]; return select( parent[selector], selectors.splice(1, selectors.length - 1) ); } /* * provides a new stream that has a selected sub property of the object value of the parent stream * the selector has the format [{propertyName}.]* */ function deepSelect( parent$, selector